@deephaven/embed-chart 0.38.1-chart-refactor.20 → 0.38.1-deglobalized-jsapi.16

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,9 +1,9 @@
1
- var _s=Object.defineProperty;var Vs=(n,i,e)=>i in n?_s(n,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[i]=e;var p=(n,i,e)=>(Vs(n,typeof i!="symbol"?i+"":i,e),e);import{A as u,B as f,G as T,P as Bs,C as r,D as ve,E as I,R as yn,M as Nt,K as $e,L as Y,F as Z,N as pe,O as Hs,Q as Ks,S as Ws,T as Gs,U as qs,V as vt,$ as zs,W as De,X as Zs,Y as Xs,Z as Js,_ as En,a0 as Qs,a1 as Ys}from"./vendor-c6328e9a.js";import{T as oe,L as F,c as ei,e as ti,M as kt,f as Dt,g as In,h as ni,i as si,j as ii,k as oi,l as ai,m as wn,n as ri,o as li,p as ci,q as ui,r as di,s as Tn,t as hi,u as pi,b as Oe,w as Mn,A as mi,x as Nn}from"./index-1c678b43.js";import{d as kn,e as z,i as pt,f as Dn,a as fi,C as gi,g as On,h as bi,c as me,j as Ve,k as An,B as Ci,l as vi,m as xi,D as Si,n as yi,o as Ei,b as Rn,F as xt,I as Ii,S as wi,p as Ti,T as Ln,q as Mi,r as Ni,s as ki,P as tn,t as Di,v as Oi}from"./useConnection-f786b0a3.js";import{w as $r,u as _r}from"./useConnection-f786b0a3.js";import"./helpers-042e6b4d.js";class St extends u.Component{constructor(e){super(e);p(this,"element");p(this,"container");p(this,"rAF");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=T.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)}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:s}=this.props;if(e||this.container.current===null)return;let{options:o}=this.props;o={placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}},...o},document.body.appendChild(this.element);let a=this.getVisibleElement(this.container.current);a==null&&(a=this.container.current),e=new Bs(s||a,this.element,o),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t&&!this.element.contains(document.activeElement)){const l=this.element.firstElementChild;l instanceof HTMLElement&&l.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:s,interactive:o,closeOnBlur:a}=this.props,{show:l}=this.state;return r.jsx(ve,{in:l,timeout:s,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:r.jsx("div",{onClick:c=>{c.stopPropagation()},onKeyDown:c=>{c.key==="Escape"&&this.hide()},className:I("popper",{interactive:o},e),onBlur:a?this.handleBlur:void 0,tabIndex:a?-1:void 0,role:"presentation",children:r.jsxs("div",{className:"popper-content",children:[t,r.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){const{popper:e}=this.state,{"data-testid":t}=this.props;return r.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&yn.createPortal(this.renderContent(),this.element)})}}p(St,"propTypes",{children:f.node.isRequired,options:f.shape({}),className:f.string,timeout:f.number,onEntered:f.func,onExited:f.func,isShown:f.bool,closeOnBlur:f.bool,interactive:f.bool,referenceObject:f.shape({}),"data-testid":f.string}),p(St,"defaultProps",{options:{},className:"",timeout:oe.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0});const Ae=St;var W=(n=>(n.DEBUG="D",n.LOG="L",n.WARN="W",n.ERROR="E",n.UNCAUGHT_ERROR="U",n))(W||{});function Re(n,i){return new CustomEvent(n,{detail:i})}class Ai{constructor(){p(this,"isEnabled",!1);p(this,"debug");p(this,"log");p(this,"warn");p(this,"error");p(this,"eventTarget");p(this,"handleUncaughtError",i=>{const e=[];i.error!=null&&e.push(i.error),i.message&&e.push(i.message),this.eventTarget.dispatchEvent(Re("U",e))});this.debug=console.debug,this.log=console.log,this.warn=console.warn,this.error=console.error,this.eventTarget=new Nt}enable(){this.isEnabled||(console.debug=(...i)=>{this.eventTarget.dispatchEvent(Re("D",i)),this.debug.apply(console,i)},console.log=(...i)=>{this.eventTarget.dispatchEvent(Re("L",i)),this.log.apply(console,i)},console.warn=(...i)=>{this.eventTarget.dispatchEvent(Re("W",i)),this.warn.apply(console,i)},console.error=(...i)=>{this.eventTarget.dispatchEvent(Re("E",i)),this.error.apply(console,i)},window.addEventListener("error",this.handleUncaughtError),F.setLogLevel(F.level),this.isEnabled=!0)}disable(){this.isEnabled&&(console.debug=this.debug,console.log=this.log,console.warn=this.warn,console.error=this.error,window.removeEventListener("error",this.handleUncaughtError),F.setLogLevel(F.level),this.isEnabled=!1)}addEventListener(i,e){this.eventTarget.addEventListener(i,e)}removeEventListener(i,e){this.eventTarget.removeEventListener(i,e)}}const Ri=Ai;class Xe{constructor(i){p(this,"history");p(this,"offset");p(this,"limit");p(this,"isEnabled");p(this,"proxy");this.history=[],this.offset=0,this.limit=1e4,this.isEnabled=!1,this.proxy=i,this.addHistory=this.addHistory.bind(this)}static formatMessages(i){return i.map(t=>{if(typeof t=="string")return t;let s="";try{s=JSON.stringify(t)}catch{s=t.toString()}return s==="{}"?t.toString():s}).join(" ")}static formatStack(i,e){if(i==="")return"";let t=i.split(`
1
+ var _s=Object.defineProperty;var Vs=(n,i,e)=>i in n?_s(n,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[i]=e;var p=(n,i,e)=>(Vs(n,typeof i!="symbol"?i+"":i,e),e);import{A as u,B as f,G as T,P as Bs,C as r,D as ve,E as I,R as yn,M as Nt,K as $e,L as Y,F as Z,N as pe,O as Hs,Q as Ks,S as Ws,T as Gs,U as qs,V as vt,$ as zs,W as De,X as Zs,Y as Xs,Z as Js,_ as En,a0 as Qs,a1 as Ys}from"./vendor-c6328e9a.js";import{T as oe,L as F,c as ei,e as ti,M as kt,f as Dt,g as In,h as ni,i as si,j as ii,k as oi,l as ai,m as wn,n as ri,o as li,p as ci,q as ui,r as di,s as Tn,t as hi,u as pi,b as Oe,w as Mn,A as mi,x as Nn}from"./index-e0e6bee6.js";import{d as kn,e as z,i as pt,f as Dn,a as fi,C as gi,g as On,h as bi,c as me,j as Ve,k as An,B as Ci,l as vi,m as xi,D as Si,n as yi,o as Ei,b as Rn,F as xt,I as Ii,S as wi,p as Ti,T as Ln,q as Mi,r as Ni,s as ki,P as tn,t as Di,v as Oi}from"./useConnection-ab7c46dd.js";import{w as $r,u as _r}from"./useConnection-ab7c46dd.js";import"./helpers-042e6b4d.js";class St extends u.Component{constructor(e){super(e);p(this,"element");p(this,"container");p(this,"rAF");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=T.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)}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:s}=this.props;if(e||this.container.current===null)return;let{options:o}=this.props;o={placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}},...o},document.body.appendChild(this.element);let a=this.getVisibleElement(this.container.current);a==null&&(a=this.container.current),e=new Bs(s||a,this.element,o),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t&&!this.element.contains(document.activeElement)){const l=this.element.firstElementChild;l instanceof HTMLElement&&l.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:s,interactive:o,closeOnBlur:a}=this.props,{show:l}=this.state;return r.jsx(ve,{in:l,timeout:s,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:r.jsx("div",{onClick:c=>{c.stopPropagation()},onKeyDown:c=>{c.key==="Escape"&&this.hide()},className:I("popper",{interactive:o},e),onBlur:a?this.handleBlur:void 0,tabIndex:a?-1:void 0,role:"presentation",children:r.jsxs("div",{className:"popper-content",children:[t,r.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){const{popper:e}=this.state,{"data-testid":t}=this.props;return r.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&yn.createPortal(this.renderContent(),this.element)})}}p(St,"propTypes",{children:f.node.isRequired,options:f.shape({}),className:f.string,timeout:f.number,onEntered:f.func,onExited:f.func,isShown:f.bool,closeOnBlur:f.bool,interactive:f.bool,referenceObject:f.shape({}),"data-testid":f.string}),p(St,"defaultProps",{options:{},className:"",timeout:oe.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0});const Ae=St;var W=(n=>(n.DEBUG="D",n.LOG="L",n.WARN="W",n.ERROR="E",n.UNCAUGHT_ERROR="U",n))(W||{});function Re(n,i){return new CustomEvent(n,{detail:i})}class Ai{constructor(){p(this,"isEnabled",!1);p(this,"debug");p(this,"log");p(this,"warn");p(this,"error");p(this,"eventTarget");p(this,"handleUncaughtError",i=>{const e=[];i.error!=null&&e.push(i.error),i.message&&e.push(i.message),this.eventTarget.dispatchEvent(Re("U",e))});this.debug=console.debug,this.log=console.log,this.warn=console.warn,this.error=console.error,this.eventTarget=new Nt}enable(){this.isEnabled||(console.debug=(...i)=>{this.eventTarget.dispatchEvent(Re("D",i)),this.debug.apply(console,i)},console.log=(...i)=>{this.eventTarget.dispatchEvent(Re("L",i)),this.log.apply(console,i)},console.warn=(...i)=>{this.eventTarget.dispatchEvent(Re("W",i)),this.warn.apply(console,i)},console.error=(...i)=>{this.eventTarget.dispatchEvent(Re("E",i)),this.error.apply(console,i)},window.addEventListener("error",this.handleUncaughtError),F.setLogLevel(F.level),this.isEnabled=!0)}disable(){this.isEnabled&&(console.debug=this.debug,console.log=this.log,console.warn=this.warn,console.error=this.error,window.removeEventListener("error",this.handleUncaughtError),F.setLogLevel(F.level),this.isEnabled=!1)}addEventListener(i,e){this.eventTarget.addEventListener(i,e)}removeEventListener(i,e){this.eventTarget.removeEventListener(i,e)}}const Ri=Ai;class Xe{constructor(i){p(this,"history");p(this,"offset");p(this,"limit");p(this,"isEnabled");p(this,"proxy");this.history=[],this.offset=0,this.limit=1e4,this.isEnabled=!1,this.proxy=i,this.addHistory=this.addHistory.bind(this)}static formatMessages(i){return i.map(t=>{if(typeof t=="string")return t;let s="";try{s=JSON.stringify(t)}catch{s=t.toString()}return s==="{}"?t.toString():s}).join(" ")}static formatStack(i,e){if(i==="")return"";let t=i.split(`
2
2
  `).map(s=>s.trim());switch(e){case W.ERROR:t=t.splice(i[0]==="Error"?4:3);break;case W.UNCAUGHT_ERROR:t=t.splice(i[0]==="Error"?3:2);break}return t!=null?` ${t.join(`
3
3
  `)}`:""}enable(){this.isEnabled||(this.proxy.addEventListener(W.DEBUG,this.addHistory),this.proxy.addEventListener(W.LOG,this.addHistory),this.proxy.addEventListener(W.WARN,this.addHistory),this.proxy.addEventListener(W.ERROR,this.addHistory),this.proxy.addEventListener(W.UNCAUGHT_ERROR,this.addHistory),this.isEnabled=!0)}disable(){this.isEnabled&&(this.proxy.removeEventListener(W.DEBUG,this.addHistory),this.proxy.removeEventListener(W.LOG,this.addHistory),this.proxy.removeEventListener(W.WARN,this.addHistory),this.proxy.removeEventListener(W.ERROR,this.addHistory),this.proxy.removeEventListener(W.UNCAUGHT_ERROR,this.addHistory),this.isEnabled=!1)}addHistory({type:i,detail:e}){const t={type:i,messages:e,time:new Date};switch(i){case W.ERROR:case W.UNCAUGHT_ERROR:t.stack=Error().stack;break}this.history[this.offset%this.limit]=t,this.offset+=1}getHistory(){if(this.offset>this.limit){const i=this.offset%this.limit;this.history=this.history.slice(i).concat(this.history.slice(0,i)),this.offset=this.limit}return this.history}getFormattedHistory(){return this.getHistory().map(e=>`${e.time.toISOString()} ${e.type} ${Xe.formatMessages(e.messages)}`+(e.stack!=null?`
4
4
  ${Xe.formatStack(e.stack,e.type)}`:"")).join(`
5
5
  `)}}const Li=Xe,ji=Object.freeze(Object.defineProperty({__proto__:null,Log:F,LogHistory:Li,LogProxy:Ri,Logger:ei,LoggerLevel:ti,default:F},Symbol.toStringTag,{value:"Module"})),Pi=F.module("Tooltip"),q=class extends u.Component{constructor(e){super(e);p(this,"container");p(this,"popper");p(this,"parent");p(this,"timer");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=T.createRef(),this.popper=T.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}static handleHidden(){q.shownTooltipCount-=1,q.shownTooltipCount===0&&(q.lastHiddenTime=Date.now())}static handleShown(){q.shownTooltipCount+=1}componentDidMount(){this.startListening();const{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){const{isShown:s}=t,{isShown:o}=this.state;o!==s&&(o?q.handleShown():q.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();const{isShown:e}=this.state;e&&q.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){Pi.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,s=e.clientY,{isShown:o}=this.state;if(!this.popper.current||!this.parent)return;const a=this.popper.current.element.getBoundingClientRect(),l=this.parent.getBoundingClientRect();t>=a.left&&t<=a.left+a.width&&s>=a.top&&s<=a.top+a.height?this.handleMouseMove():t>=l.left&&t<=l.left+l.width&&s>=l.top&&s<=l.top+l.height?this.handleMouseMove():o&&(this.stopTimer(),this.hide())}startTimer(){this.stopTimer();const{timeout:e,reshowTimeout:t}=this.props;let s=e;(q.shownTooltipCount>0||Date.now()-q.lastHiddenTime<q.triggerReshowThreshold)&&(s=t),this.timer=window.setTimeout(this.handleTimeout,s)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var t;const{isShown:e}=this.state;if(this.stopTimer(),!e){(t=this.popper.current)==null||t.show(),this.setState({isShown:!0});const{interactive:s}=this.props;s&&this.startListeningWindow()}}hide(){var e;(e=this.popper.current)==null||e.hide(),this.stopListeningWindow()}update(){var e;(e=this.popper.current)==null||e.scheduleUpdate()}handleExited(){this.setState({isShown:!1});const{onExited:e}=this.props;e()}stopShowingTooltip(){const{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){const{interactive:e,children:t,referenceObject:s,popperClassName:o,"data-testid":a,onEntered:l}=this.props,{isShown:c}=this.state;let{options:d}=this.props;return d={placement:"bottom",...d},r.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":a,children:r.jsx(Ae,{className:I(o),options:d,ref:this.popper,onEntered:l,onExited:this.handleExited,interactive:e,referenceObject:s,children:r.jsxs("div",{className:"tooltip-content",children:[" ",c&&t]})})})}};let re=q;p(re,"defaultTimeout",500),p(re,"defaultReshowTimeout",100),p(re,"triggerReshowThreshold",300),p(re,"shownTooltipCount",0),p(re,"lastHiddenTime",Date.now()),p(re,"defaultProps",{interactive:!1,options:{},popperClassName:"",reshowTimeout:q.defaultReshowTimeout,timeout:q.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});const Ot=re;const Fi=100;var jn=(n=>(n.UP="UP",n.DOWN="DOWN",n))(jn||{});const ce=class extends u.Component{constructor(e){super(e);p(this,"popper");p(this,"cbContainer");p(this,"menuContainer");p(this,"input");p(this,"getCachedFilteredOptions",Y((e,t)=>e.filter(s=>s.title.toLowerCase().indexOf(t.toLowerCase())>=0)));let{popperOptions:t}=this.props;t={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...t},this.state={title:"",filteredOptions:[],keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,invalid:!1,popperOptions:t},this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.handleMenuBlur=this.handleMenuBlur.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputBlur=this.handleInputBlur.bind(this),this.handelInputFocus=this.handelInputFocus.bind(this),this.handleInputClick=this.handleInputClick.bind(this),this.updateInputValue=$e(this.updateInputValue,Fi),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=T.createRef(),this.cbContainer=T.createRef(),this.menuContainer=T.createRef(),this.input=T.createRef()}setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}getValueAndValidate(e){if(!e)return this.setState({invalid:!1}),{value:e,isValid:!1};const{options:t}=this.props,s=t.filter(o=>o.title.toLowerCase()===e.toLowerCase());return s.length<1?(this.setState({invalid:!0}),{value:e,isValid:!1}):(this.setState({invalid:!1}),{value:s[0].value,isValid:!0})}updateInputValue(e){const{menuIsOpen:t}=this.state,{value:s,isValid:o}=this.getValueAndValidate(e);t&&this.processFilterChange(e),this.fireOnChange(s,o)}fireOnChange(e,t=!0){const{onChange:s}=this.props;s(e,t)}processFilterChange(e){var l;const{options:t}=this.props,{menuIsOpen:s}=this.state,o=e?this.getCachedFilteredOptions(t,e):t,a=o.length===1&&o[0].title===e;if(this.setState({filteredOptions:o,keyboardOptionIndex:0}),a&&s){this.closeMenu();return}(l=this.popper.current)==null||l.scheduleUpdate()}resetValue(){this.setState({title:""}),this.fireOnChange("")}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var a;const{filteredOptions:t,keyboardOptionIndex:s}=this.state,o=t[s];switch(e.key){case"Enter":case"ArrowRight":e.stopPropagation(),e.preventDefault(),o!=null&&(this.setState({title:o.title,invalid:!1}),this.fireOnChange(o.value)),this.closeMenu(),(a=this.input.current)==null||a.focus();break;case"ArrowUp":e.stopPropagation(),e.preventDefault(),this.navigateMenu(ce.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":e.stopPropagation(),e.preventDefault(),this.navigateMenu(ce.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(e.stopPropagation(),e.preventDefault(),e.shiftKey){this.navigateMenu(ce.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(ce.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.closeMenu();break}}navigateMenu(e){const{filteredOptions:t,keyboardOptionIndex:s}=this.state;let o=s;e===ce.MENU_NAVIGATION_DIRECTION.UP?s>0?(o=(o-1)%t.length,this.setState({keyboardOptionIndex:o})):s===0&&(o=t.length-1,this.setState({keyboardOptionIndex:o})):e===ce.MENU_NAVIGATION_DIRECTION.DOWN&&s<t.length&&(o=(o+1)%t.length,this.setState({keyboardOptionIndex:o})),this.scrollOptionIntoView(o)}handleInputKeyDown(e){const{onEnter:t}=this.props,{menuIsOpen:s}=this.state;s?this.handleMenuKeyDown(e):e.key==="Enter"?t():e.key==="Escape"?(this.resetValue(),e.preventDefault(),e.stopPropagation()):e.key==="ArrowRight"||e.key==="ArrowLeft"||e.key==="Tab"||e.key==="Shift"||this.openMenu()}handleInputChange(e){this.setState({title:e.target.value}),this.updateInputValue(e.target.value)}handleOptionClick(e){var t;this.setState({title:e.title,invalid:!1}),this.fireOnChange(e.value),this.closeMenu(),(t=this.input.current)==null||t.focus()}handelInputFocus(){const{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputClick(){const{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputBlur(e){const{menuIsOpen:t}=this.state;t&&e.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuBlur(e){e.relatedTarget===this.input.current||e.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){var e;(e=this.input.current)==null||e.focus()}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}openMenu(){const{title:e}=this.state;this.processFilterChange(e),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{var t;(t=this.popper.current)==null||t.show()})}closeMenu(e=!0){var t,s;this.setState({menuIsOpen:!1,keyboardOptionIndex:0}),e&&((t=this.input.current)==null||t.focus()),(s=this.popper.current)==null||s.hide()}scrollOptionIntoView(e){var t;this.menuContainer.current&&((t=this.menuContainer.current.children.item(e))==null||t.scrollIntoView({behavior:"smooth",block:"nearest"}))}renderMenuElement(){const{inputWidth:e}=this.state;return r.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:s}=this.state;return t&&s.length===0?r.jsx("div",{className:"no-match",children:e}):s.map((o,a)=>this.renderOption(o,a))}renderOption(e,t){const{keyboardOptionIndex:s}=this.state,o=`option-${t}-${e.value}`;return r.jsx("button",{type:"button",className:I("aci-option-btn",{"keyboard-active":s===t}),onClick:()=>this.handleOptionClick(e),onFocus:()=>this.setState({keyboardOptionIndex:t}),children:e.title},o)}render(){const{options:e,inputPlaceholder:t,disabled:s,className:o,defaultTitle:a,spellCheck:l,"data-testid":c}=this.props,{title:d,menuIsOpen:h,popperOptions:m,invalid:g}=this.state;return r.jsxs("div",{className:"aci-container",ref:this.cbContainer,children:[r.jsx("input",{value:d||a,className:I("form-control",o,"aci-input",{"is-invalid":g&&!h}),ref:this.input,onChange:this.handleInputChange,placeholder:t||e[0].title,disabled:s,onFocus:this.handelInputFocus,onClick:this.handleInputClick,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:l,"data-testid":c}),r.jsx(Ae,{ref:this.popper,options:m,className:I("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}};let Ee=ce;p(Ee,"propTypes",{options:f.arrayOf(f.shape({title:f.string.isRequired,value:f.string.isRequired})).isRequired,popperOptions:f.shape({}),onChange:f.func,inputPlaceholder:f.string,disabled:f.bool,className:f.string,defaultTitle:f.string,spellCheck:f.bool,onEnter:f.func,noMatchText:f.string,"data-testid":f.string}),p(Ee,"defaultProps",{onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0}),p(Ee,"MENU_NAVIGATION_DIRECTION",jn);const Ui=Ee;function At({className:n="",value:i,onChange:e,spellCheck:t=!1,placeholder:s="",disabled:o=!1,delimiter:a="",id:l="","data-testid":c}){const[d,h]=u.useState(i),[m,g]=u.useState(!1),b=u.useRef(null);u.useEffect(function(){h(i)},[i]);function S(w){return w.trim().split(a).filter(R=>R).join(`
6
6
  ${a.trim()}`)}function E(w){return w.split(`
7
7
  `).map(R=>R.trim()).join(" ")}function x(){if(!b.current)return;b.current.style.height="0";const w=b.current.scrollHeight+(b.current.offsetHeight-b.current.clientHeight);w>0&&(b.current.style.height=`${w}px`)}function P(w){let R=w.target.value;m&&(a&&(R=S(R)),g(!1)),h(R),e(R)}function U(){b.current&&(a&&(h(S(d)),x()),b.current.scrollLeft=0)}function C(){b.current&&document.activeElement!==b.current&&b.current.focus()}function k(){a&&(h(E(d)),e(E(d)))}function O(){g(!0)}return u.useEffect(function(){x()},[d]),r.jsx("textarea",{ref:b,id:l,className:I(n,"auto-resize-textarea form-control"),placeholder:s,value:d,rows:1,onChange:P,onFocus:U,onMouseDown:C,onBlur:k,onPaste:O,spellCheck:t,disabled:o,"data-testid":c})}At.propTypes={value:f.string.isRequired,onChange:f.func.isRequired,className:f.string,placeholder:f.string,spellCheck:f.bool,disabled:f.bool,delimiter:f.string,id:f.string,"data-testid":f.string};At.defaultProps={className:"",id:"",placeholder:"",disabled:!1,spellCheck:!1,delimiter:"","data-testid":void 0};function Be(n){const{children:i,className:e,style:t,"data-testid":s}=n;return r.jsx("div",{className:I("btn-group",e),style:t,role:"group","data-testid":s,children:i})}Be.displayName="ButtonGroup";Be.propTypes={children:f.node.isRequired,className:f.string,style:f.object,"data-testid":f.string};Be.defaultProps={className:null,style:{},"data-testid":void 0};const $i=["primary","secondary","tertiary","success","danger","inline","ghost"],_i=["group-end"];function Vi(n,i){switch(n){case"primary":return"btn-primary";case"secondary":return"btn-outline-primary";case"tertiary":return"btn-secondary";case"success":return"btn-success";case"danger":return"btn-danger";case"inline":return"btn-inline";case"ghost":return I("btn-link",{"btn-link-icon":i,"btn-link-icon-only":i})}}function Bi(n){switch(n){case"group-end":return I("pl-2","pr-3")}}const tt=T.forwardRef((n,i)=>{const{kind:e,variant:t,type:s,tooltip:o,icon:a,disabled:l=!1,active:c,onClick:d,onContextMenu:h,onMouseDown:m,onMouseUp:g,onMouseEnter:b,onMouseLeave:S,onKeyDown:E,className:x,style:P,children:U,tabIndex:C,"data-testid":k,"aria-label":O}=n,w=Boolean(a&&U==null),R=Vi(e,w);let $;t&&($=Bi(t));let J;a&&(J=T.isValidElement(a)?a:r.jsx(Z,{icon:a}));let D;o!==void 0&&(D=typeof o=="string"?r.jsx(Ot,{children:o}):o);let A=O;O===void 0&&w&&o!=null&&typeof o=="string"&&(A=o);const B=r.jsxs("button",{"data-testid":k,ref:i,type:s,className:I("btn",R,$,{active:c},x),onClick:d,onContextMenu:h,onMouseUp:g,onMouseDown:m,onMouseEnter:b,onMouseLeave:S,onKeyDown:E,style:P,disabled:l,tabIndex:C,"aria-label":A,children:[a&&J,U,o!=null&&!l&&D]});return l?r.jsxs("span",{className:"btn-disabled-wrapper",children:[B,o!==void 0&&D]}):B});tt.displayName="Button";tt.propTypes={kind:f.oneOf($i).isRequired,variant:f.oneOf(_i),type:f.oneOf(["submit","reset","button"]),tooltip(n){const{tooltip:i,icon:e,children:t}=n;return i===void 0&&e!=null&&t==null?new Error("Tooltip is required for icon only buttons"):null},icon(n){const{children:i,icon:e}=n;return e==null&&i==null?new Error("Icon is required if no children are provided"):i==null&&!T.isValidElement(e)&&(e==null||e.iconName===""||e.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:f.bool,active:f.bool,onClick(n){const{onClick:i,type:e}=n;return e==="button"&&typeof i!="function"?new Error("type button requires an onClick function"):i!==void 0&&typeof i!="function"?new Error("onClick must be a function"):null},onContextMenu:f.func,onMouseUp:f.func,onMouseDown:f.func,onMouseEnter:f.func,onMouseLeave:f.func,onKeyDown:f.func,tabIndex:f.number,children:f.node,className:f.string,style:f.object,"data-testid":f.string};tt.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 ee=tt;function Rt(n){const i=u.useRef();return u.useEffect(function(){i.current=n}),i.current}function Lt(n){const i=u.useRef(null);return u.useEffect(function(){n&&(typeof n=="function"?n(i.current):n.current=i.current)}),i}const Hi=()=>{};async function Ki(n){const{clipboard:i}=navigator;if(i!==void 0)try{return navigator.clipboard.writeText(n)}catch{return nn(n)}nn(n)}function nn(n){const i=document.activeElement,e=document.createElement("textarea");e.value=n,document.body.appendChild(e),e.focus(),e.select();const t=document.execCommand("copy");if(document.body.removeChild(e),i instanceof HTMLElement&&i.focus(),!t)throw new Error("Unable to execute copy command")}class Pn extends CustomEvent{constructor(i,e){super(i,e)}}function _e(n){let i=n;n instanceof CustomEvent&&(i=n.detail);let e="";if(i instanceof Error?e=i.message:i!=null&&(e=`${i}`),e=e.trim(),e.length>0)return e}class jt{static isValidRange(i){return i!=null&&i.length===2&&Number.isInteger(i[0])&&Number.isInteger(i[1])&&i[0]<=i[1]}static validateRange(i){if(!jt.isValidRange(i))throw new Error(`Invalid range! ${i}`)}static isSelected(i,e){for(let t=0;t<i.length;t+=1){const s=i[t],o=s[0],a=s[1];if(o<=e&&e<=a)return!0}return!1}static selectRange(i,e){let[t,s]=e;const o=[...i];for(let a=o.length-1;a>=0;a-=1){const l=o[a],c=l[0],d=l[1];if(c<=t&&s<=d)return o;t<=d&&c<=s&&(t=Math.min(t,c),s=Math.max(s,d),o.splice(a,1))}return o.push([t,s]),o}static deselectRange(i,e){const[t,s]=e,o=[...i];for(let a=o.length-1;a>=0;a-=1){const l=o[a],c=l[0],d=l[1];if(!(s<c||d<t))if(c<t&&s<d){o[a]=[c,t-1],o.splice(a+1,0,[s+1,d]);break}else t<=c&&d<=s?o.splice(a,1):c<t?o[a]=[c,t-1]:o[a]=[s+1,d]}return o}static count(i){return i.reduce((e,t)=>e+(t[1]-t[0]+1),0)}static getItemsInRanges(i,e){return e.reduce((t,s)=>{const o=[...t];for(let a=s[0];a<=s[1];a+=1)o.push(i[a]);return o},[])}}const ie=jt,Jt=class{static formatElapsedTime(i){if(typeof i!="number"||!Number.isInteger(i))throw new Error(`${i} is not a number that can be expressed as a formatted time`);const e=Math.floor(i/3600),t=Math.floor(i%3600/60),s=i%60;return`${e>0?`${e}h `:""}${t>0||e>0?`${t}m `:""}${i>=60?`${s}s`.padStart(3,"0"):`${s}s`}`}static formatTime(i){if(typeof i!="number"||!Number.isInteger(i)||i<0)throw new Error(`${i} is not a number that can be expressed as a formatted time`);const e=String(Math.floor(i/(60*60))).padStart(2,"0"),t=i%(60*60),s=String(Math.floor(t/60)).padStart(2,"0"),o=t%60,a=String(Math.ceil(o)).padStart(2,"0");return`${e}:${s}:${a}`}static isTimeString(i){return new RegExp(Jt.TIME_PATTERN).test(i)}static parseTime(i){if(i==null||typeof i!="string")throw new Error(`${i} is not a valid string`);const e=i.split(":");if(e.length!==3)throw new Error(`${i} is not a time string that can be parsed`);return Number(e[0])*60*60+Number(e[1])*60+Number(e[2])}};let Le=Jt;p(Le,"TIME_PATTERN","([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]"),p(Le,"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"}]));const je=Le,Wi=3500,Gi=F.module("useCopyToClipboard");function Fn(){const[n,i]=u.useState(!1),e=u.useRef(null),t=u.useCallback(s=>{Ki(s).then(()=>{i(!0)}).catch(o=>Gi.error(`Unable to copy ${s}`,`
8
- `,o))},[]);return u.useEffect(()=>(e.current&&clearTimeout(e.current),n&&(e.current=setTimeout(()=>{i(!1)},Wi)),()=>{e.current&&clearTimeout(e.current)}),[n]),[n,t]}function qi(n){n.preventDefault()}function zi(n=!1){const i=u.useMemo(()=>`useSubmitButtonRef-${pe()}`,[]),e=u.useCallback(o=>{o==null||o.UNSAFE_getDOMNode().setAttribute("form",i)},[i]),t=u.useMemo(()=>({id:i,onSubmit:n?void 0:qi}),[i,n]),s=u.useMemo(()=>({form:i,ref:e}),[i,e]);return{formProps:t,submitButtonProps:s}}function Un(n,i,{autoLoad:e=!0}={}){const[t,s]=u.useState(null),[o,a]=u.useState(null),[l,c]=u.useState(!1),d=u.useCallback(async()=>{c(!0);try{const h=await n(...i);s(h),a(null)}catch(h){s(null),a(h)}finally{c(!1)}},[n,...i]);return u.useEffect(()=>{e&&d()},[e,d]),{data:t,error:o,isError:o!=null,isLoading:l,reload:d}}function $n(n,i){const[e,t]=u.useState(n);return u.useEffect(()=>{const s=setTimeout(()=>{t(n)},i);return()=>{clearTimeout(s)}},[n,i]),e}const Zi=Object.freeze(Object.defineProperty({__proto__:null,useContextOrThrow:kn,useCopyToClipboard:Fn,useDebouncedValue:$n,useFormWithDetachedSubmitButton:zi,useForwardedRef:Lt,usePrevious:Rt,usePromiseFactory:Un},Symbol.toStringTag,{value:"Module"}));function Xi({blockInteraction:n=!0,children:i,debounceMs:e,isOpen:t=!1}){const s=$n(t,e);return r.jsxs(r.Fragment,{children:[n&&t&&r.jsx("div",{className:"modal-backdrop",style:{backgroundColor:"transparent"},"data-testid":"debounced-modal-backdrop"}),T.cloneElement(i,{isOpen:t&&s})]})}function Ji({className:n,icon:i,isOpen:e=!1,subtitle:t,title:s}){return r.jsx(kt,{isOpen:e,className:n,children:r.jsx(Dt,{children:r.jsxs("div",{className:"info-modal",children:[i!=null&&r.jsx("div",{className:"message-icon",children:r.jsx(Z,{icon:i})}),r.jsx("div",{className:"message-header",children:s}),t!=null&&r.jsx("div",{className:"message-content",children:t})]})})})}function _n({className:n="modal-footer",children:i,"data-testid":e}){return r.jsx("div",{className:n,"data-testid":e,children:i})}function Pt(n){const{isOpen:i,headerText:e,bodyText:t,onCancel:s,onConfirm:o,onDiscard:a,onModalDisable:l,cancelButtonText:c="Cancel",confirmButtonText:d="Okay",discardButtonText:h="Discard",isConfirmDanger:m=!1,children:g,"data-testid":b}=n,S=u.useRef(null),E=u.useRef(null),x=u.useCallback(()=>{E.current!==null&&E.current.checked&&l&&l(),o()},[o,l]),P=u.useCallback(()=>{var C;(C=S.current)==null||C.focus()},[]);let U="";return i&&(U=typeof t=="function"?t():t),r.jsxs(kt,{isOpen:i,className:"theme-bg-light",onOpened:P,children:[r.jsx(In,{closeButton:!1,children:e}),r.jsx(Dt,{children:U}),r.jsxs(_n,{children:[l&&r.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[r.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:E,"data-testid":b!==void 0?`${b}-checkbox-confirm`:void 0}),r.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),a&&r.jsx(ee,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:a,"data-testid":b!==void 0?`${b}-btn-discard`:void 0,children:h}),s&&r.jsx(ee,{kind:"secondary","data-dismiss":"modal",onClick:s,"data-testid":b!==void 0?`${b}-btn-cancel`:void 0,children:c}),r.jsxs(Be,{children:[r.jsx(ee,{kind:m?"danger":"primary",onClick:x,ref:S,"data-testid":b!==void 0?`${b}-btn-confirm`:void 0,children:d}),g]})]})]})}Pt.propTypes={isOpen:f.bool.isRequired,headerText:f.string.isRequired,bodyText:f.oneOfType([f.string,f.func]).isRequired,onCancel:f.func,onConfirm:f.func.isRequired,onDiscard:f.func,onModalDisable:f.func,cancelButtonText:f.string,confirmButtonText:f.string,discardButtonText:f.string,children:f.node,"data-testid":f.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 nt=T.forwardRef((n,i)=>{const{children:e,className:t,disabled:s,onClick:o,style:a,id:l}=n;return r.jsx("button",{ref:i,type:"button",className:I("btn",t),onClick:o,style:a,disabled:s,id:l,children:e})});nt.displayName="Button";nt.propTypes={children:f.node,className:f.string,disabled:f.bool,onClick:f.func,style:f.shape({}),id:f.string};nt.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Qi=nt;function Yi({className:n,isFlipped:i,children:e,"data-testid":t}){const s=c=>{if(e.length!==2)throw new Error("CardFlip requires 2 children to function");return e[c]},o=u.useRef(null),a=u.useCallback(c=>{c.target===c.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),l=u.useCallback(c=>{c.target===c.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return u.useEffect(function(){if(!o.current)throw Error("ref undefined");o.current.addEventListener("transitionstart",a);const d=o.current;return function(){if(d!=null)return d.removeEventListener("transitionstart",a)}},[a]),r.jsxs("div",{className:I(n,{"card-flip--show-front":i,"card-flip--show-back":!i}),"data-testid":t,children:[r.jsx("div",{className:"card-flip--back",children:s(0)}),r.jsx("div",{ref:o,className:"card-flip--front",onTransitionEnd:l,children:s(1)})]})}const sn=F.module("GlobalContextAction");class eo extends u.Component{constructor(i){super(i),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(i){const e=i;e.contextActions==null&&(e.contextActions=[]);const{action:t}=this.props;t.title==null&&!t.menuElement||(e.contextActions==null&&(e.contextActions=[]),e.contextActions.push(t),sn.debug("Received context menu event at global action! Menu items are now: ",e.contextActions))}handleKeyDown(i){var t;const{action:e}=this.props;!z.actionsDisabled&&e.shortcut!==void 0&&e.shortcut.matchesEvent(i)&&(sn.debug("Global hotkey matched!",i),(t=e.action)==null||t.call(e,i),i.preventDefault(),i.stopPropagation())}render(){return null}}const to=eo;class no extends u.Component{render(){const{actions:i,"data-testid":e}=this.props,t=[];for(let s=0;s<i.length;s+=1){const o=i[s],{shortcut:a}=o;if(o.title!=null||o.menuElement||a){const l=r.jsx(to,{action:o,"data-testid":e},`${o.title}.${a==null?void 0:a.id}`);t.push(l)}}return t}}const so=no;const He=F.module("ContextActions");class Vn extends u.Component{constructor(e){super(e);p(this,"container");this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=T.createRef(),this.state={globalActions:[],keyboardActions:[]}}static triggerMenu(e,t,s,o){if(o.length===0)return;const a=new MouseEvent("contextmenu",{clientX:t,clientY:s,bubbles:!0,cancelable:!0});a.contextActions=o,e.dispatchEvent(a)}static getDerivedStateFromProps(e){if(e.actions==null||!Array.isArray(e.actions))return{globalActions:[],keyboardActions:[]};const t=e.actions.filter(o=>!pt(o)&&typeof o!="function"&&o.isGlobal),s=e.actions.filter(o=>!pt(o)&&typeof o!="function"&&(o.isGlobal===void 0||!o.isGlobal)&&o.shortcut!=null);return{globalActions:t,keyboardActions:s}}componentDidMount(){var e;(e=this.container.current)!=null&&e.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){var e;(e=this.container.current)!=null&&e.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}handleContextMenu(e){const{ignoreClassNames:t=[]}=this.props;if(t.length>0){let o=e.target;for(;o!=null;){const{classList:a}=o,l=t.find(c=>a.contains(c));if(l!==void 0){He.debug2(`Contextmenu event ignored based on the target className "${l}"`);return}o=o.parentElement}}if(z.isContextActionEvent(e)||(e.contextActions=[]),!z.isContextActionEvent(e))return;const{actions:s}=this.props;if(s!=null){let o=s;Array.isArray(o)&&(o=o.filter(a=>pt(a)||typeof a=="function"||a.isGlobal===void 0||!a.isGlobal)),e.contextActions=e.contextActions.concat(o)}He.debug("Received context menu event! Menu items are now: ",e.contextActions)}handleKeyDown(e){var s;const{keyboardActions:t}=this.state;for(let o=0;o<t.length;o+=1){const a=t[o];!z.actionsDisabled&&a.shortcut!=null&&a.shortcut.matchesEvent(e)&&(He.debug("Context hotkey matched!",e),(s=a.action)==null||s.call(a,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 r.jsx("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:r.jsx(so,{actions:t})})}}p(Vn,"groups",{default:null,high:100,medium:5e3,low:1e4,global:1e5,edit:100});const io=Vn,ue=class extends u.Component{static handleEnter(i){const e=i;e.style.height="0"}static handleEntering(i){const e=i;e.style.height=`${ue.getHeight(e)}px`}static handleExiting(i){const e=i;e.style.height="0"}static handleExit(i){const e=i;e.style.height=`${ue.getHeight(e)}px`}static getHeight(i){const e=i.scrollWidth-i.clientWidth;return i.scrollHeight-e}constructor(i){super(i),this.handleEntered=this.handleEntered.bind(this)}handleEntered(i){const e=i;e.style.height="";const{autoFocusOnShow:t}=this.props;if(t!==void 0&&t){const s=e.querySelector("input, select, textarea");s!=null&&s.focus()}}render(){const{children:i,className:e,in:t,"data-testid":s}=this.props;return r.jsx(ve,{in:t,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:ue.handleEnter,onEntering:ue.handleEntering,onEntered:this.handleEntered,onExit:ue.handleExit,onExiting:ue.handleExiting,timeout:350,children:o=>r.jsx("div",{className:I({collapse:o==="exited"},e),"data-testid":s,children:i})})}};let Pe=ue;p(Pe,"propTypes",{className:f.string,in:f.bool.isRequired,children:f.node.isRequired,autoFocusOnShow:f.bool,"data-testid":f.string}),p(Pe,"defaultProps",{className:"",autoFocusOnShow:!1,"data-testid":void 0});const oo=Pe,st=T.forwardRef((n,i)=>{const{checked:e=!1,children:t,className:s,disabled:o,inputClassName:a,isInvalid:l,labelClassName:c,name:d,onChange:h,"data-testid":m}=n,[g]=u.useState(pe()),b=Lt(i);u.useEffect(function(){b.current&&(b.current.indeterminate=e===null)},[b,e]);const S=u.useCallback(E=>{b.current&&(b.current.indeterminate=e===null),h&&h(E)},[b,e,h]);return r.jsxs("div",{className:I("custom-control custom-checkbox",s),children:[r.jsx("input",{type:"checkbox",ref:b,checked:e??!1,className:I("custom-control-input",a,{"is-invalid":l}),disabled:o,id:g,name:d,onChange:S,"data-testid":m}),r.jsx("label",{className:I("custom-control-label",c),htmlFor:g,children:t})]})});st.displayName="Checkbox";st.propTypes={checked:(n,i)=>{const{[i]:e}=n;return e!==null&&typeof e!="boolean"?new Error("Checked must be a boolean or null for indeterminate"):null},children:f.node.isRequired,className:f.string,disabled:f.bool,inputClassName:f.string,isInvalid:f.bool,labelClassName:f.string,name:f.string,onChange:f.func,"data-testid":f.string};st.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const Je=st;class Bn extends u.PureComponent{constructor(e){super(e);p(this,"inputField");this.inputField=T.createRef()}focus(){var e;(e=this.inputField.current)==null||e.focus()}render(){const{value:e,placeholder:t,onBlur:s,onChange:o,className:a,disabled:l,matchCount:c,id:d,onKeyDown:h,"data-testid":m}=this.props;return r.jsxs("div",{className:I("search-group",a),children:[r.jsx("input",{type:"search",value:e,onBlur:s,onChange:o,onKeyDown:h,className:"form-control",disabled:l,placeholder:t,ref:this.inputField,id:d,"data-testid":m}),c!=null&&r.jsx("span",{className:"search-match",children:c}),r.jsx("span",{className:"search-icon",children:r.jsx(Z,{icon:ni})})]})}}p(Bn,"defaultProps",{placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0});const it=Bn;var Hn=(n=>(n.UP="UP",n.DOWN="DOWN",n))(Hn||{});const Ne=class extends u.Component{constructor(e){super(e);p(this,"popper");p(this,"cbContainer");p(this,"toggleButton");p(this,"menuContainer");p(this,"input");p(this,"searchInput");p(this,"getCachedFilteredOptions",Y((e,t)=>e.filter(s=>s.title.toLowerCase().indexOf(t.toLowerCase())>=0||s.value.toLowerCase().indexOf(t.toLowerCase())>=0)));this.state={value:"",filter:"",filteredOptions:e.options,keyboardOptionIndex:-1,menuIsOpen:!1,inputWidth:100},this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.handleMenuBlur=this.handleMenuBlur.bind(this),this.closeMenu=this.closeMenu.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputBlur=this.handleInputBlur.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleOptionFocus=this.handleOptionFocus.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=T.createRef(),this.cbContainer=T.createRef(),this.toggleButton=T.createRef(),this.menuContainer=T.createRef(),this.input=T.createRef(),this.searchInput=T.createRef()}componentDidUpdate(){const{menuIsOpen:e,keyboardOptionIndex:t}=this.state;e&&t>=0&&this.scrollOptionIntoView()}setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}focus(){var e;(e=this.input.current)==null||e.focus()}resetValue(){this.setState({value:""})}updateInputValue(e){const{onChange:t}=this.props;this.setState({value:e}),t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var c,d;const{filter:t,filteredOptions:s,keyboardOptionIndex:o}=this.state,{options:a}=this.props,l=t?s:a;switch(e.key){case"Enter":((c=l[o])==null?void 0:c.value)!=null&&this.updateInputValue(l[o].value),this.closeMenu(),(d=this.input.current)==null||d.focus(),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(Ne.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(Ne.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":t!==""?(this.setState({filter:""}),e.stopPropagation()):this.closeMenu();break;case"Tab":!e.shiftKey&&o===l.length-1&&this.closeMenu();break}}handleMenuNavigation(e){const{filter:t,filteredOptions:s,keyboardOptionIndex:o}=this.state,{options:a}=this.props,c=(t?s:a).length;let d=0;switch(e){case Ne.MENU_NAVIGATION_DIRECTION.UP:d=-1;break;case Ne.MENU_NAVIGATION_DIRECTION.DOWN:d=1;break}d!==0&&this.setState({keyboardOptionIndex:(o+d+c)%c})}handleInputKeyDown(e){const{onEnter:t}=this.props,{menuIsOpen:s}=this.state;e.key==="ArrowDown"||e.key==="ArrowUp"?s||this.openMenu():e.key==="Enter"&&t()}handleInputChange(e){this.updateInputValue(e.target.value)}handleOptionClick(e){var c;const t=Number(e.currentTarget.value),{filter:s,filteredOptions:o}=this.state,{options:a}=this.props,l=s?o:a;this.updateInputValue(l[t].value),this.closeMenu(),(c=this.input.current)==null||c.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleFilterChange(e){var a;const{options:t}=this.props,s=e.target.value,o=this.getCachedFilteredOptions(t,s);this.setState({filter:s,filteredOptions:o,keyboardOptionIndex:0}),(a=this.popper.current)==null||a.scheduleUpdate()}handleMenuBlur(e){e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||e.relatedTarget===this.toggleButton.current||this.closeMenu(!1)}handleInputBlur(e){const{menuIsOpen:t}=this.state;t&&e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){var e;this.scrollOptionIntoView(),(e=this.searchInput.current)==null||e.focus()}handleMenuExited(){var t;const{menuIsOpen:e}=this.state;e&&(this.setState({menuIsOpen:!1}),(t=this.popper.current)==null||t.hide()),this.setState({filter:""})}toggleMenu(e){const{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{var e;(e=this.popper.current)==null||e.show()})}closeMenu(e=!0){var t,s;this.setState({menuIsOpen:!1}),e&&((t=this.input.current)==null||t.focus()),(s=this.popper.current)==null||s.hide()}updateKeyboardIndex(){const{value:e,filter:t,filteredOptions:s}=this.state,{options:o}=this.props,l=(t?s:o).findIndex(c=>c.value===e);this.setState({keyboardOptionIndex:l})}scrollOptionIntoView(){var t;const e=(t=this.menuContainer.current)==null?void 0:t.querySelector(".cb-option-btn.keyboard-active");e instanceof HTMLElement&&e.scrollIntoView({block:"nearest",inline:"nearest"})}renderMenuElement(){const{searchPlaceholder:e}=this.props,{filter:t,inputWidth:s}=this.state;return r.jsxs("div",{className:"cb-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:o=>{o.stopPropagation()},style:{width:s},onBlur:this.handleMenuBlur,children:[r.jsx("div",{className:"cb-search-input-container",children:r.jsx(it,{value:t,ref:this.searchInput,onChange:this.handleFilterChange,className:"cb-search-input",placeholder:e})}),r.jsx("div",{className:"cb-options-container",children:r.jsx("div",{className:"cb-options",children:this.renderOptions()})})]})}renderOptions(){const{options:e}=this.props,{keyboardOptionIndex:t,filter:s,filteredOptions:o}=this.state;return(s?o:e).map((l,c)=>{const d=`option-${c}-${l.value}`;return r.jsx("button",{type:"button",value:c,className:I("cb-option-btn",{"keyboard-active":t===c}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:l.title},d)})}render(){const{options:e,inputPlaceholder:t,disabled:s,className:o,defaultValue:a,spellCheck:l,"data-testid":c}=this.props,{value:d}=this.state;let{popperOptions:h}=this.props;return h={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...h},r.jsxs("div",{className:"input-group cb-container",ref:this.cbContainer,children:[r.jsx("input",{value:d||a,className:I("form-control",o,"cb-input"),ref:this.input,onChange:this.handleInputChange,placeholder:t||(e[0]!=null?e[0].title:void 0),disabled:s,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:l,"data-testid":c!==void 0?`${c}-input`:void 0}),r.jsx("div",{className:"input-group-append cb-dropdown",children:r.jsxs("button",{type:"button",className:"btn cb-btn form-control",ref:this.toggleButton,onClick:this.toggleMenu,onKeyDown:this.handleInputKeyDown,disabled:s,"data-testid":c!==void 0?`${c}-btn`:void 0,children:[r.jsx(Z,{icon:si}),r.jsx(Ae,{ref:this.popper,options:h,className:I("combobox interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})})]})}};let ge=Ne;p(ge,"MENU_NAVIGATION_DIRECTION",Hn),p(ge,"DROP_DOWN_MENU_HEIGHT",200),p(ge,"propTypes",{options:f.arrayOf(f.shape({title:f.string.isRequired,value:f.string.isRequired})).isRequired,popperOptions:f.shape({title:f.string.isRequired,value:f.string.isRequired}),onChange:f.func,inputPlaceholder:f.string,searchPlaceholder:f.string,disabled:f.bool,className:f.string,defaultValue:f.string,spellCheck:f.bool,onEnter:f.func,"data-testid":f.string}),p(ge,"defaultProps",{onChange(){},inputPlaceholder:"",searchPlaceholder:"Search",disabled:!1,className:"",defaultValue:"",popperOptions:null,spellCheck:!0,onEnter(){},"data-testid":void 0});const ao=ge;function ro({copy:n,kind:i="ghost",tooltip:e="Copy",className:t,"data-testid":s,children:o}){const[a,l]=Fn();return r.jsx(ee,{kind:i,className:t,"data-testid":s,icon:a?ii:oi,tooltip:a?"Copied":e,onClick:()=>{l(typeof n=="function"?n():n)},children:o})}function ot(n,i,e){return n.substring(0,i)+e+n.substring(i+1)}function Kn(n,i,e){return n.length<e?`${n}${i.substring(n.length,e)}`:n}function yt(n,i){let{length:e}=n;for(let t=n.length-1;t>=0&&i[t]===n[t];t-=1)e=t;return n.substring(0,e)}const te=F.module("MaskedInput"),Se={FORWARD:"forward",BACKWARD:"backward",NONE:"none"},Ke=" ",Wn=T.forwardRef((n,i)=>{const{className:e,example:t,getNextSegmentValue:s=(N,M,v)=>v,getPreferredReplacementString:o=ot,onChange:a=()=>!1,onSelect:l=()=>!1,onSubmit:c,pattern:d,placeholder:h,selection:m,value:g,onFocus:b=()=>!1,onBlur:S=()=>!1,"data-testid":E}=n,x=Lt(i),P=u.useMemo(()=>Array.isArray(t)?t:[t],[t]),U=u.useMemo(()=>P[0].replace(/[a-zA-Z0-9]/g,Ke),[P]);u.useEffect(function(){var M;if(m!=null){te.debug("setting selection...",m);const{selectionStart:v,selectionEnd:L,selectionDirection:_}=m;(M=x.current)==null||M.setSelectionRange(v,L,_),te.debug("selection set!")}},[m,x]);const C=u.useCallback(N=>{let M=N,v=N;const L=P.length>0?P[0]:g;for(let y=M-1;y>=0&&/[a-zA-Z0-9]/g.test(L.charAt(y));y-=1)M=y;for(let y=v;y<L.length&&/[a-zA-Z0-9]/g.test(L.charAt(y));y+=1)v=y+1;const _=M===v?Se.NONE:Se.BACKWARD;return{selectionStart:M,selectionEnd:v,selectionDirection:_}},[P,g]);function k(N,M,v=N.length){let L="";for(let _=0;_<v;_+=1)N.charAt(_)!==Ke?L=L.concat(N[_]):L=L.concat(M[_]);return L=L.concat(M.substring(v)),L}function O(N,M=N.length){const v=new RegExp(`^${d}$`);if(v.test(N))return!0;for(let L=0;L<P.length;L+=1){const _=k(N,P[L],M);if(v.test(_))return!0}return!1}function w(N){const M=C(N),v=M.selectionEnd+1;return v>=g.length?M:C(v)}function R(N){const M=C(N),v=M.selectionStart-1;return v<=0?M:C(v)}function $(N,M){const v=C(N),L=g.substring(v.selectionStart,v.selectionEnd),_=s(v,M,L,g),y=g.substring(0,v.selectionStart)+_+g.substring(v.selectionEnd);O(y,v.selectionEnd)&&(a(y),l(v))}const J=u.useCallback(N=>{const{selectionStart:M=0,selectionEnd:v=0,selectionDirection:L="none"}=N.target;if(M===null||v===null||L===null){te.error("Selection attempted on non-text input element",N.target);return}if(te.debug2("handleSelect",M,v,L),!(m!=null&&M===m.selectionStart&&v===m.selectionEnd)){if(m!=null&&M===g.length&&v===g.length&&N.nativeEvent.type!=="mouseup"){l({...m});return}if(M===v){const _=C(M);te.debug("Selection segment from ",M,v,"=>",_),l(_)}else l({selectionStart:M,selectionEnd:v,selectionDirection:L})}},[C,l,m,g]),D=u.useCallback(N=>{if(!x.current)return;te.debug("handleSelectCapture",N);const M=x.current.selectionStart??0;M===g.length&&m!=null&&M!==m.selectionStart&&(N.preventDefault(),N.stopPropagation())},[x,m,g]);function A(N){if(N.preventDefault(),N.stopPropagation(),!x.current)return;const{key:M}=N,{selectionStart:v=0,selectionEnd:L=0}=x.current;if(v===null||L===null){te.error("Selection arrow nvaigation attempted on non-text input element",N.target);return}M==="ArrowLeft"?l(R(v)):M==="ArrowRight"?l(w(L)):M==="ArrowUp"?$(v,-1):M==="ArrowDown"&&$(v,1)}function B(N){if(!x.current)return;te.debug("handleKeyDown",N);const{key:M}=N,{selectionStart:v=0,selectionEnd:L=0}=x.current;if(v===null||L===null){te.error("Selection key event on non-text input element",N.target);return}if(M==="Enter"){c==null||c(N);return}if(M.startsWith("Arrow")){A(N);return}if(M==="Delete"||M==="Backspace"){if(N.preventDefault(),N.stopPropagation(),L>=yt(g,U).length){const y=g.substring(0,v===L?v-1:v),j=yt(y,U);j!==g&&(a(j),l({selectionStart:j.length,selectionEnd:j.length,selectionDirection:Se.NONE}));return}if(v!==L){const y=g.substring(0,v)+g.substring(v,L).replace(/[a-zA-Z0-9]/g,Ke)+g.substring(L);te.debug("Range ",v,L,"deleted, setting value",y),a(y),l({selectionStart:v,selectionEnd:v,selectionDirection:Se.NONE})}else if(v>0)for(let y=v-1;y>=0;y-=1){const j=g.substring(0,y)+g.substring(y,v).replace(/[a-zA-Z0-9]/g,Ke)+g.substring(v);if(j!==g){a(j),l({selectionStart:y,selectionEnd:y,selectionDirection:Se.NONE});return}}return}if(N.altKey||N.metaKey||N.ctrlKey||M.length>1)return;N.preventDefault(),N.stopPropagation();const _=Array.from(new Set([M,M.toUpperCase(),M.toLowerCase()]));for(let y=0;y<_.length;y+=1){const j=_[y],V=/[a-zA-Z0-9]/g.test(j)?P[0].length-1:v;for(let H=v;H<=V;H+=1){const xe=Kn(g,P[0],H+1),ut=o(xe,H,j,v,L);if(O(ut,H+1)){const Yt=C(H),dt=H+1;let ht={selectionStart:dt,selectionEnd:dt,selectionDirection:Se.NONE};if(dt>=Yt.selectionEnd){const en=w(H);en.selectionStart!==Yt.selectionStart&&(ht=en)}te.debug("handleKeyDown",M,"=>",ut,ht),a(ut),l(ht);return}}}}return r.jsx("input",{ref:x,className:I("form-control masked-input",e),type:"text",pattern:d,placeholder:h,value:g,onChange:()=>{},onKeyDown:B,onSelect:J,onSelectCapture:D,onFocus:b,onBlur:S,"data-testid":E})});Wn.defaultProps={className:"",placeholder:void 0,onChange(){},onSelect(){},getNextSegmentValue:(n,i,e)=>e,getPreferredReplacementString:ot,selection:void 0,onFocus(){},onBlur(){},"data-testid":void 0};const at=Wn,lo=F.module("TimeInput"),co="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",uo=["00:00:00","12:34:56","23:59:59"],Gn=T.forwardRef((n,i)=>{const{allowValueWrapping:e=!0,className:t="",onChange:s=()=>!1,value:o=0,onFocus:a=()=>!1,onBlur:l=()=>!1,onSelect:c=()=>!1,"data-testid":d}=n,[h,m]=u.useState(je.formatTime(o)),[g,b]=u.useState(),S=u.useRef(null);u.useImperativeHandle(i,()=>({focus:()=>{var C;(C=S.current)==null||C.focus()},setSelection:C=>{var k;(k=S.current)==null||k.focus(),b(C)}}),[]),u.useEffect(function(){m(je.formatTime(o))},[o]);function E(C,k,O){const w=C.selectionStart===0?24:60;let R=parseInt(O,10)-k;return Number.isNaN(R)?R=0:e?R=(R%w+w)%w:R=Math.min(Math.max(0,R),w-1),`${R}`.padStart(2,"0")}function x(C,k,O,w,R){return w===0&&R===2&&k===1&&parseInt(O,10)>1?`0${O}${C.substring(2)}`:ot(C,k,O)}function P(C){lo.debug("handleChange",C),m(C),je.isTimeString(C)&&s(je.parseTime(C))}const U=u.useCallback(C=>{b(C),c(C)},[c]);return r.jsx(at,{ref:S,className:t,example:uo,getNextSegmentValue:E,getPreferredReplacementString:x,onChange:P,onSelect:U,pattern:co,selection:g,value:h,onFocus:a,onBlur:l,"data-testid":d})});Gn.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const Qe=Gn;var Ct;let ho=(Ct=class extends u.PureComponent{constructor(e){super(e);p(this,"container");p(this,"oldFocus");p(this,"rAF");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=T.createRef(),this.oldFocus=document.activeElement,this.rAF=0;const{options:t}=e,s=t.initialKeyboardIndex??-1;this.state={menuItems:[],keyboardIndex:s,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.rAF=window.requestAnimationFrame(()=>{var t;(t=this.container.current)==null||t.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e){const{actions:t}=this.props;e.actions!==t&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}getKeyboardIndex(){const{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){const{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){const{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});const{actions:e}=this.props,t=z.getMenuItems(e,!1);t.length>0&&this.setState(s=>({menuItems:z.sortActions(s.menuItems.concat(t))}))}handleKeyDown(e){const{menuItems:t}=this.state,s=this.getKeyboardIndex();let o=s;if(e.key==="Enter"||e.key===" "){s!=null&&s>=0&&s<t.length&&this.handleMenuItemClick(t[s],e);return}e.key==="Escape"?o=null:e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0?o=z.getNextMenuItem(o??0,-1,t):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(o=z.getNextMenuItem(o??0,1,t)),s!==o&&(o!==null?this.setKeyboardIndex(o):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(e=!1){const{closeMenu:t,onMenuClosed:s}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),s(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,s=t.indexOf(e);this.setMouseIndex(s)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{"data-testid":t}=this.props,{keyboardIndex:s,menuItems:o,mouseIndex:a}=this.state;for(let c=0;c<o.length;c+=1){const d=o[c];c>0&&d.group!==o[c-1].group&&e.push(r.jsx("hr",{},`${c}.separator`));const h=r.jsx(Dn,{isKeyboardSelected:s===c,isMouseSelected:a===c,menuItem:d,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},c);e.push(h)}const{menuStyle:l}=this.props;return r.jsx("div",{className:"context-menu-container",style:{...l},ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}},p(Ct,"defaultProps",{closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0}),Ct);const po=ho;class qn extends u.PureComponent{constructor(e){super(e);p(this,"container");p(this,"parent");p(this,"popper");p(this,"isOpen");this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=T.createRef(),this.parent=null,this.popper=T.createRef(),this.isOpen=!1}componentDidMount(){var t;const{isShown:e}=this.props;e===null?(t=this.container.current)!=null&&t.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)}closeMenu(){var e;(e=this.popper.current)==null||e.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){var e;(e=this.popper.current)==null||e.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:s,"data-testid":o}=this.props,{menuStyle:a}=this.props;let{options:l,popperOptions:c}=this.props;return c={placement:"bottom",...c},l={separateKeyboardMouse:!0,...l},r.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":o,children:r.jsx(Ae,{ref:this.popper,options:c,className:I("menu-popper",s),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:r.jsx(po,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:l,menuStyle:a})})})}}p(qn,"defaultProps",{isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0});const zn=qn;const on=-1;var Zn=(n=>(n.UP="UP",n.DOWN="DOWN",n))(Zn||{});const se=class extends u.Component{constructor(e){super(e);p(this,"csContainer");p(this,"menuContainer");p(this,"button");p(this,"input");const{value:t,valueToTime:s}=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=T.createRef(),this.menuContainer=T.createRef(),this.button=T.createRef(),this.input=T.createRef(),this.state={keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,customTime:s(t),inputFocused:!1}}getSelectedText(){const{options:e,value:t,placeholder:s}=this.props,{customTime:o}=this.state;if(t===null)return s;for(let a=0;a<e.length;a+=1){const l=e[a];if(l.value===t)return l.title}return je.formatTime(o)}setInputWidth(){this.csContainer.current&&this.setState({inputWidth:this.csContainer.current.getBoundingClientRect().width})}focus(){var e;(e=this.button.current)==null||e.focus()}updateInputValue(e){const{onChange:t}=this.props;t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var a;const{keyboardOptionIndex:t,inputFocused:s}=this.state,{options:o}=this.props;switch(e.key){case"Enter":case" ":s?this.updateFromCustom():this.updateInputValue(o[t].value),this.closeMenu(),(a=this.button.current)==null||a.focus(),e.stopPropagation(),e.preventDefault();break;case"Tab":e.shiftKey?this.handleMenuNavigation(se.MENU_NAVIGATION_DIRECTION.UP):this.handleMenuNavigation(se.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(se.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(se.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":this.closeMenu();break}}handleMenuNavigation(e){const{keyboardOptionIndex:t,inputFocused:s}=this.state,{options:o}=this.props,a=o.length;let l=t;switch(e){case se.MENU_NAVIGATION_DIRECTION.UP:if(!s&&t===0){this.focusInput();break}else s&&this.focusOption(t);t>0&&!s?(l=(l-1)%a,this.setState({keyboardOptionIndex:l})):t===0&&(l=a-1,this.setState({keyboardOptionIndex:l})),this.scrollOptionIntoView(l);break;case se.MENU_NAVIGATION_DIRECTION.DOWN:if(!s&&t===a-1){this.focusInput();break}else s&&this.focusOption(t);t<a&&!(s&&t===0)&&(l=(l+1)%a,this.setState({keyboardOptionIndex:l})),this.scrollOptionIntoView(l);break}}handleOptionClick(e){const t=Number(e.currentTarget.value),{options:s,timeToValue:o}=this.props,{customTime:a}=this.state;if(t===on){const l=o(a);this.updateAndClose(l)}else this.updateAndClose(s[t].value)}updateAndClose(e){var t;this.updateInputValue(e),this.closeMenu(),(t=this.button.current)==null||t.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleMenuOpened(){var l;const{options:e,value:t}=this.props,{keyboardOptionIndex:s}=this.state;this.scrollOptionIntoView(s);const o=(l=this.menuContainer.current)==null?void 0:l.querySelector(".cs-option-btn.keyboard-active");if(o instanceof HTMLElement&&o.focus(),t===null)return;e.map(c=>c.value).indexOf(t)<0&&this.focusInput()}focusInput(){var e;(e=this.input.current)==null||e.focus()}focusOption(e){var s;const t=(s=this.menuContainer.current)==null?void 0:s.querySelector(".cs-options");if(t&&t.children!=null){const o=t.children.item(e);o instanceof HTMLElement&&o.focus()}}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}handleCustomInput(e){const{timeToValue:t}=this.props,s=t(e);this.updateInputValue(s),this.setState({customTime:e})}updateFromCustom(){const{timeToValue:e}=this.props,{customTime:t}=this.state,s=e(t);this.updateInputValue(s)}toggleMenu(e){const{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0})}closeMenu(e=!0){var t;this.setState({menuIsOpen:!1}),e&&((t=this.button.current)==null||t.focus())}updateKeyboardIndex(){const{options:e,value:t}=this.props;if(t===null)return;const s=e.map(o=>o.value).indexOf(t);s>0&&this.setState({keyboardOptionIndex:s})}scrollOptionIntoView(e){var s;const t=(s=this.menuContainer.current)==null?void 0:s.querySelector(".cs-options");if(t&&t.children!=null){const o=t.children.item(e);o instanceof HTMLElement&&o.offsetTop>se.DROP_DOWN_MENU_HEIGHT?t.scrollTop=o.offsetTop-se.DROP_DOWN_MENU_HEIGHT:(o instanceof HTMLElement&&o.offsetTop<0||e===0)&&(t.scrollTop=0)}}renderMenuElement(){const{inputWidth:e}=this.state;return r.jsx("div",{className:"cs-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:t=>{t.stopPropagation()},style:{width:e},children:r.jsx("div",{className:"cs-options-container",children:r.jsx("div",{className:"cs-options",children:this.renderOptions()})})})}renderOptions(){const{options:e,value:t,icon:s,customText:o}=this.props,{keyboardOptionIndex:a,customTime:l,inputFocused:c}=this.state;let d=!1;const h=[];for(let m=0;m<e.length;m+=1){const g=e[m],b=`option-${m}-${g.value}`;d=d||g.value===t,h.push(r.jsxs("button",{type:"button",value:m,className:I("cs-option-btn",{"keyboard-active":a===m&&!c}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[g.value===t&&r.jsx(Z,{icon:s,className:"mr-2"}),g.value!==t&&r.jsx("span",{className:"mr-4"}),g.title]},b))}return h.push(r.jsx("hr",{className:"cs-divider"},"option-divider")),h.push(r.jsxs("button",{type:"button",value:on,className:I("cs-option-btn",{"keyboard-active":c}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!d&&t!==null?r.jsx(Z,{icon:s,className:"mr-2"}):r.jsx("span",{className:"mr-4"}),o]},"option-custom-label")),h.push(r.jsxs("div",{className:"cs-custom-container",children:[r.jsx("span",{className:"mr-2"}),r.jsx(Qe,{ref:this.input,onChange:this.handleCustomInput,value:l,onFocus:()=>this.setState({inputFocused:!0}),onBlur:()=>this.setState({inputFocused:!1})},"option-input"),r.jsx("span",{className:"ml-2"})]},"cs-custom-container")),h.push(r.jsx("hr",{className:"mb-2"},"option-end")),h}render(){const{disabled:e,invalid:t,value:s,"data-testid":o}=this.props,{menuIsOpen:a}=this.state;let{popperOptions:l}=this.props;return l={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...l},r.jsx("div",{className:"input-group cs-container context-menu",ref:this.csContainer,"data-testid":o,children:r.jsx("div",{className:I("input-group-append cs-dropdown",{"cs-dropdown-invalid":t}),children:r.jsxs("button",{type:"button",className:I("btn cs-btn form-control",{"cs-btn-invalid":t}),ref:this.button,onClick:this.toggleMenu,disabled:e,children:[r.jsx("span",{className:I({"text-muted":s===null}),children:this.getSelectedText()}),r.jsx("span",{children:r.jsx(Z,{icon:wn,className:"cs-caret"})}),r.jsx(zn,{isShown:a,actions:{menuElement:this.renderMenuElement()},popperOptions:l,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}};let Ie=se;p(Ie,"MENU_NAVIGATION_DIRECTION",Zn),p(Ie,"DROP_DOWN_MENU_HEIGHT",125),p(Ie,"defaultProps",{onChange(){},value:null,disabled:!1,popperOptions:{},icon:ai,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});const mo=Ie;function ye(n,i,e,t,s){const o=t-e+1;return`${((parseInt(i,10)-n-e)%o+o)%o+e}`.padStart(s,"0")}function Xn(n,i,e){const{selectionStart:t}=n;return t===0?ye(i,e,1900,2099,4):t===5?ye(i,e,1,12,2):t===8?ye(i,e,1,31,2):t===11?ye(i,e,0,23,2):t===17||t===14?ye(i,e,0,59,2):t===20||t===24||t===28?ye(i,e,0,999,3):e}function Et(n){const i=n.substring(0,23),e=n.substring(23,26),t=n.substring(26);return[i,e,t].filter(s=>s!=="").join("​")}const fo=F.module("DateTimeInput"),go="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",bo="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\\.[0-9]{3}​[0-9]{3}​[0-9]{3}",Co=`${go} ${bo}`,qe="2022-01-01",Jn=`${qe} 00:00:00.000000000`,vo="YYYY-MM-DD HH:MM:SS.SSSSSSSSS";function an(n){return n!=null&&n.length>=qe.length?`${n.substring(0,qe.length)}${n.substring(qe.length).replace(/\u2007/g,"0")}${Jn.substring(n.length)}`:n}function rn(n){return n.replace(/\u200B/g,"")}const xo=[Et(Jn)],Ft=T.forwardRef((n,i)=>{const{className:e="",onChange:t=()=>{},defaultValue:s="",onFocus:o=()=>{},onBlur:a=()=>{},onSubmit:l,"data-testid":c}=n,[d,h]=u.useState(s.length>0?Et(s):""),[m,g]=u.useState(),b=u.useCallback(E=>{fo.debug("handleChange",E),h(E),t(an(rn(E)))},[t]),S=u.useCallback(()=>{const E=rn(d),x=an(E);x!==E&&h(Et(x)),a()},[d,a]);return r.jsx("div",{className:"d-flex flex-row align-items-center",children:r.jsx(at,{ref:i,className:I(e),example:xo,getNextSegmentValue:Xn,onChange:b,onSelect:g,onSubmit:l,pattern:Co,placeholder:vo,selection:m,value:d,onFocus:o,onBlur:S,"data-testid":c})})});Ft.displayName="DateTimeInput";Ft.defaultProps={className:"",onChange:()=>{},defaultValue:"",onFocus:()=>{},onBlur:()=>{},"data-testid":void 0};const So=Ft,yo=F.module("DateInput"),Eo="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",Io=["2000-01-01","2022-12-31"],wo="YYYY-MM-DD",Ut=T.forwardRef((n,i)=>{const{className:e="",onChange:t=()=>{},defaultValue:s="",onFocus:o=()=>{},onBlur:a=()=>{},"data-testid":l}=n,[c,d]=u.useState(s),[h,m]=u.useState(),g=u.useCallback(b=>{yo.debug("handleChange",b),d(b),t(b)},[t]);return r.jsx("div",{className:"d-flex flex-row align-items-center",children:r.jsx(at,{ref:i,className:I(e),example:Io,getNextSegmentValue:Xn,onChange:g,onSelect:m,pattern:Eo,placeholder:wo,selection:h,value:c,onFocus:o,onBlur:a,"data-testid":l})})});Ut.displayName="DateInput";Ut.defaultProps={className:"",onChange:()=>!1,defaultValue:"",onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const To=Ut;class Qn extends u.PureComponent{constructor(e){super(e);p(this,"searchInput");this.searchInput=T.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=$e(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})}focus(){var e;(e=this.searchInput.current)==null||e.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:s,id:o,"data-testid":a}=this.props,{value:l}=this.state;return r.jsx(it,{value:l,placeholder:e,onChange:this.handleChange,className:t,matchCount:s,ref:this.searchInput,id:o,"data-testid":a})}}p(Qn,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});const Mo=Qn;const No=F.module("ItemListItem"),Qt=class extends u.Component{constructor(e){super(e);p(this,"itemRef");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=T.createRef()}static handleKeyDown(){return No.log("ItemListItem.handleKeyDown false"),!1}handleBlur(e){const{itemIndex:t,onBlur:s}=this.props;s(t,e)}handleFocus(e){const{itemIndex:t,onFocus:s}=this.props;s(t,e)}handleClick(e){const{itemIndex:t,onClick:s}=this.props;s(t,e)}handleContextMenu(e){const{itemIndex:t,onContextMenu:s}=this.props;s(t,e)}handleDragStart(e){const{itemIndex:t,onDragStart:s}=this.props;s(t,e)}handleDrag(e){const{itemIndex:t,onDrag:s}=this.props;s(t,e)}handleDragOver(e){e.preventDefault();const{itemIndex:t,onDragOver:s}=this.props;s(t,e)}handleDragEnd(e){const{itemIndex:t,onDragEnd:s}=this.props;s(t,e)}handleDrop(e){const{itemIndex:t,onDrop:s}=this.props;s(t,e)}handleDoubleClick(e){const{itemIndex:t,onDoubleClick:s}=this.props;s(t,e)}handleMouseMove(e){const{itemIndex:t,onMouseMove:s}=this.props;s(t,e)}handleMouseDown(e){const{itemIndex:t,onMouseDown:s}=this.props;s(t,e)}handleMouseUp(e){const{itemIndex:t,onMouseUp:s}=this.props;s(t,e)}render(){const{isDraggable:e,isFocused:t,isSelected:s,style:o,children:a,"data-testid":l}=this.props;return r.jsx("div",{className:I("item-list-item",{active:s},{"is-focused":t},{"is-draggable":e}),onKeyDown:Qt.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:o,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:e,"data-testid":l,children:a})}};let ze=Qt;p(ze,"defaultProps",{children:null,isDraggable:!1,isFocused:!1,isSelected:!1,itemIndex:0,"data-testid":void 0,onBlur(){},onClick(){},onContextMenu(){},onDragStart(){},onDrag(){},onDragOver(){},onDragEnd(){},onDrop(){},onDoubleClick(){},onFocus(){},onMouseDown(){},onMouseMove(){},onMouseUp(){},style:{}});const Yn=ze;const ln=F.module("ItemList"),cn=5,Ce=class extends u.PureComponent{constructor(e){super(e);p(this,"list");p(this,"listContainer");p(this,"getItemSelected",Y((e,t)=>ie.isSelected(t,e),{max:Ce.CACHE_SIZE}));p(this,"getCachedItem",Y((e,t,s,o,a,l,c,d)=>{const h=l({item:s,itemIndex:e,isFocused:o,isSelected:a,style:c});return r.jsx(Yn,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:d,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:o,isSelected:a,itemIndex:e,style:c,children:h},t)},{max:Ce.CACHE_SIZE}));p(this,"getOuterElement",Y(e=>{const t=T.forwardRef((s,o)=>r.jsx("div",{ref:o,tabIndex:-1,onKeyDown:e,role:"presentation",...s}));return t.displayName="ItemListOuterElement",t}));p(this,"getInnerElement",Y(()=>{const e=T.forwardRef((t,s)=>r.jsx("div",{className:"item-list-inner-element",ref:s,...t}));return e.displayName="ItemListInnerElement",e}));p(this,"getItemData",Y((e,t,s)=>({items:e,selectedRanges:t,renderItem:s})));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=T.createRef(),this.listContainer=T.createRef();const{isStickyBottom:t,selectedRanges:s}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:s,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null,mouseX:null,mouseY:null}}static renderItem({item:e}){return r.jsx("div",{className:"item-list-item-content",children:e!=null&&(e.displayValue??e.value??`${e}`)})}componentDidUpdate(e,t){const{selectedRanges:s,itemCount:o}=this.props,{focusIndex:a,isStuckToBottom:l,scrollOffset:c,height:d,selectedRanges:h}=this.state;if(l&&!this.isListAtBottom()&&o>0&&this.scrollToBottom(),(c!==t.scrollOffset||d!==t.height)&&this.sendViewportUpdate(),s!==e.selectedRanges&&s!==h)this.setSelectedRanges(s);else if(h!==t.selectedRanges){const{onSelectionChange:m}=this.props;m(h)}if(a!==t.focusIndex){const{onFocusChange:m}=this.props;m(a)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var e;(e=this.listContainer.current)==null||e.focus()}restoreScrollPosition(){var t;const{scrollOffset:e}=this.state;e!=null&&((t=this.listContainer.current)==null||t.scrollTo(0,e))}getElement(e){if(this.listContainer.current==null)return null;const{focusSelector:t}=this.props,{overscanStartIndex:s}=this.state,o=this.listContainer.current.querySelectorAll(t),a=e-s;return o[a]}focusItem(e){const{disableSelect:t}=this.props;if(t)return;this.setState({focusIndex:e});const s=this.getElement(e);s instanceof HTMLElement&&s.focus()}scrollToItem(e){const t=this.getElement(e);t!=null&&t.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){const{selectedRanges:s}=this.state,a=ie.isSelected(s,e)||z.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,a,!1)}handleItemDoubleClick(e,t){const{isDoubleClickSelect:s,onSelect:o}=this.props;s&&this.setState(({selectedRanges:a})=>({selectedRanges:ie.selectRange(a,[e,e])}),()=>{o(e,t)})}handleItemMouseDown(e,t){const{selectedRanges:s}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&s.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){ln.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){ln.debug2("item focus",e,t.target),this.setState(s=>{const{focusIndex:o}=s;return o!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){const{isDragSelect:s,isMultiSelect:o,disableSelect:a}=this.props,{mouseDownIndex:l,selectedRanges:c,mouseX:d,mouseY:h}=this.state;if(l==null||a)return;const m=Math.abs(t.clientX-(d??0)),g=Math.abs(t.clientY-(h??0));m>cn&&g>cn&&this.setState({isDragging:!0}),(s||l===e)&&(this.focusItem(e),o?(!s&&!this.getItemSelected(e,c)&&!z.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(l,e),Math.max(l,e)])):this.toggleSelect(e,t.shiftKey,z.isModifierKeyDown(t),!1))}handleItemMouseUp(e,t){const{isDeselectOnClick:s,isDoubleClickSelect:o,onSelect:a}=this.props,{mouseDownIndex:l,isDragging:c}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(l===e&&!c){const d=t.shiftKey,h=z.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,d,h,s),!o&&!d&&!h&&a(e,t)}this.resetMouseState()}}handleItemsRendered({overscanStartIndex:e}){this.setState({overscanStartIndex:e})}handleResize({height:e}){this.setState({height:e})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(e){var c;const{isMultiSelect:t,itemCount:s,onSelect:o}=this.props,{focusIndex:a}=this.state;let l=a;if(e.key==="Enter"||e.key===" "){!t&&l!=null&&this.setState({selectedRanges:[[l,l]]},()=>{l!=null&&o(l,e)});return}if(e.key==="ArrowUp")l!=null&&l>=0?l=Math.max(0,l-1):l=s-1;else if(e.key==="ArrowDown")l!=null&&l>=0?l=Math.min(l+1,s-1):l=0;else return;if(a!==l){e.stopPropagation(),e.preventDefault(),this.focusItem(l);const{selectedRanges:d}=this.state;if(e.shiftKey&&d.length>0){const h=d[d.length-1];this.selectRange([Math.min(l,h[0]),Math.max(l,h[1])])}else this.deselectAll(),l!==null?this.selectItem(l):(c=this.listContainer.current)==null||c.focus();this.scrollIntoView(l)}}handleScroll({scrollUpdateWasRequested:e,scrollOffset:t}){this.setState(s=>{if(e)return{scrollOffset:t};const{isStickyBottom:o}=this.props,{height:a}=s;return{isStuckToBottom:o&&this.isListAtBottom({scrollOffset:t,height:a}),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,s,o=!0){const{isMultiSelect:a}=this.props,{selectedRanges:l}=this.state;if(a&&t&&l.length>0){const c=l[l.length-1];this.selectRange([Math.min(c[0],e),Math.max(e,c[1])])}else a&&l.length===1&&l[0][0]===e&&l[0][1]===e?o&&this.deselectItem(e):a&&s?this.getItemSelected(e,l)?o&&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){ie.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:ie.deselectRange(t,e)}))}selectItem(e){const{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){ie.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:ie.selectRange(t,e)}))}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){const{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){const{onViewportChange:s,rowHeight:o}=this.props,a=Math.floor(e/o),l=a+Math.ceil(t/o);s(a,l)}}isListAtBottom({scrollOffset:e,height:t}=this.state){if(t==null||e==null)return!1;const{itemCount:s,rowHeight:o}=this.props;return e+t>=s*o}renderInnerElement({index:e,style:t}){const{items:s,offset:o,renderItem:a,disableSelect:l}=this.props,{focusIndex:c,selectedRanges:d}=this.state;if(e<o||e>=o+s.length)return null;const h=s[e-o];return this.getCachedItem(e,e,h,e===c&&!l,this.getItemSelected(e,d),a,t,l)}render(){const{items:e,itemCount:t,overscanCount:s,renderItem:o,rowHeight:a,"data-testid":l}=this.props,{selectedRanges:c,isStuckToBottom:d}=this.state;return r.jsx(Hs,{className:"item-list-auto-sizer",onResize:this.handleResize,children:({width:h,height:m})=>r.jsx(Ks,{className:"item-list-scroll-pane",height:m,width:h,initialScrollOffset:d?t*a:0,itemCount:t,itemSize:a,itemData:this.getItemData(e,c,o),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:s,"data-testid":l,children:this.renderInnerElement})})}};let ne=Ce;p(ne,"CACHE_SIZE",1e3),p(ne,"DEFAULT_ROW_HEIGHT",20),p(ne,"DEFAULT_OVERSCAN",10),p(ne,"defaultProps",{offset:0,items:[],rowHeight:Ce.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Ce.DEFAULT_OVERSCAN,renderItem:Ce.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0});const de=class extends u.PureComponent{constructor(e){super(e);p(this,"itemList");p(this,"getCachedDraggableItem",Y((e,t,s,o,a,l,c,d)=>r.jsx(Ws,{draggableId:de.getDraggableId(e,o),index:o,isDragDisabled:c,children:h=>r.jsx("div",{role:"menuitem",className:"draggable-item-list-item",ref:h.innerRef,tabIndex:-1,...h.draggableProps,...h.dragHandleProps,children:t({item:s,itemIndex:o,isFocused:a,isSelected:l,style:d,isClone:!1})})},o),{max:ne.CACHE_SIZE}));p(this,"getCachedRenderDraggableItem",Y((e,t,s)=>({item:o,itemIndex:a,isFocused:l,isSelected:c,style:d})=>this.getCachedDraggableItem(e,s,o,a,l,c,t,d),{max:1}));p(this,"getCachedRenderClone",Y((e,t,s,o)=>(a,l,c)=>{const{selectedCount:d}=this.state,{draggableProps:h,dragHandleProps:m,innerRef:g}=a,{index:b}=c.source,S=t[b-s];return r.jsx("div",{className:I("draggable-item-list-dragging-item-container",e),...h,...m,ref:g,children:r.jsx("div",{className:I("draggable-item-list-dragging-item",{"two-dragged":d===2},{"multiple-dragged":d>2}),children:o({item:S,itemIndex:b,isFocused:!1,isSelected:!0,style:{},isClone:!0,selectedCount:d})})})},{max:1}));this.handleSelectionChange=this.handleSelectionChange.bind(this),this.itemList=T.createRef(),this.state={selectedCount:0}}static renderHandle(){return r.jsxs("div",{children:[r.jsx(Ot,{children:"Drag to re-order"}),r.jsx(Z,{icon:ri})]})}static renderBadge({text:e}){return e!=null&&e.length>0?r.jsx("span",{className:"number-badge",children:e}):null}static renderTextItem({text:e,badgeText:t="",className:s=""}){return r.jsxs("div",{className:I("item-list-item-content","draggable-item-list-item-content",s),children:[r.jsx("span",{className:"title",children:e}),de.renderBadge({text:t}),de.renderHandle()]})}static renderItem({item:e,isClone:t,selectedCount:s}){const o=e!=null?e.displayValue??e.value??`${e}`:"",a=t!==void 0&&t?`${s}`:"",l=t!==void 0&&t?"item-list-item-clone":"";return de.renderTextItem({text:o,badgeText:a,className:l})}static getDraggableId(e,t){return`${e}/${t}`}static getDraggableIndex(e){const t=e.split("/").pop();return parseInt(t!==void 0?t:"",10)}selectItem(e){var t;(t=this.itemList.current)==null||t.selectItem(e)}focusItem(e){var t;(t=this.itemList.current)==null||t.focusItem(e)}scrollToItem(e){var t;(t=this.itemList.current)==null||t.scrollToItem(e)}handleSelectionChange(e){this.setState({selectedCount:ie.count(e)});const{onSelectionChange:t}=this.props;t(e)}render(){const{className:e,draggablePrefix:t,draggingItemClassName:s,droppableId:o,isDoubleClickSelect:a,isDragDisabled:l,isDropDisabled:c,isMultiSelect:d,isStickyBottom:h,itemCount:m,items:g,offset:b,onFocusChange:S,onSelect:E,onViewportChange:x,renderItem:P,rowHeight:U,selectedRanges:C,style:k,"data-testid":O}=this.props;return r.jsx(Gs,{isDropDisabled:c,droppableId:o,mode:"virtual",renderClone:this.getCachedRenderClone(s,g,b,P),"data-testid":O,children:(w,R)=>r.jsx("div",{role:"menu",className:I("draggable-item-list",e,{"is-drop-disabled":c,"is-drag-disabled":l,"is-dragging-from-this":R.draggingFromThisWith,"is-dragging-over":R.isDraggingOver,"is-dropping":R.draggingOverWith}),style:k,ref:w.innerRef,...w.droppableProps,children:r.jsx(ne,{focusSelector:".draggable-item-list-item",isDoubleClickSelect:a,isDragSelect:!1,isMultiSelect:d,isStickyBottom:h,itemCount:m,items:g,onFocusChange:S,onSelect:E,onSelectionChange:this.handleSelectionChange,onViewportChange:x,offset:b,ref:this.itemList,renderItem:this.getCachedRenderDraggableItem(t,l,P),rowHeight:U,selectedRanges:C})})})}};let Fe=de;p(Fe,"DEFAULT_ROW_HEIGHT",30),p(Fe,"defaultProps",{className:"",draggingItemClassName:"",offset:0,items:[],rowHeight:de.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!0,isDropDisabled:!1,isDragDisabled:!1,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,style:null,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},renderItem:de.renderItem,selectedRanges:[],draggablePrefix:"draggable-item",droppableId:"droppable-item-list","data-testid":void 0});const ko=Fe;class Ye{static reorder(i,e,t,s){const o=i===t?Ye.adjustDestinationIndex(s,e):s,a=Ye.removeItems(i,e);return t.splice(o,0,...a),a}static removeItems(i,e){const t=[],s=e.map((o,a)=>({range:o,index:a})).sort((o,a)=>a.range[0]-o.range[0]);for(let o=0;o<s.length;o+=1){const{range:a,index:l}=s[o],[c,d]=a;t[l]=i.splice(c,d-c+1)}return qs(t)}static adjustDestinationIndex(i,e){let t=i;for(let s=0;s<e.length;s+=1){const[o,a]=e[s];if(o>i)break;t-=Math.min(a,i-1)-o+1}return t}static startDragging(){document.documentElement.classList.add("drag-pointer-events-none")}static stopDragging(){document.documentElement.classList.remove("drag-pointer-events-none")}}const Do=Ye;function Oo(n){const{isInvalid:i=!1,items:e,onAdd:t=()=>{},onDelete:s=()=>{},validate:o=()=>null}=n,[a,l]=u.useState(null),[c,d]=u.useState([]),[h,m]=u.useState(""),g=u.useCallback(C=>{d(C)},[]),b=u.useCallback(()=>{s(ie.getItemsInRanges(e,c)),d([])},[e,c,s]),S=u.useCallback(()=>{if(h==="")return;const C=o(h);C==null?(t(h),m("")):l(C)},[h,t,o]),E=u.useCallback(C=>{const{value:k}=C.target;m(k),l(k===""?null:o(k))},[o]),x=u.useCallback(()=>{d([])},[]),P=u.useCallback(C=>{C.key==="Enter"&&S()},[S]),U=u.useMemo(()=>14+vt(e.length,1,6)*ne.DEFAULT_ROW_HEIGHT,[e.length]);return r.jsxs("div",{className:I("editable-item-list-container",{"is-invalid":i}),children:[r.jsx("div",{style:{height:U},children:r.jsx(ne,{itemCount:e.length,items:e.map((C,k)=>({value:C,isSelected:ie.isSelected(c,k)})),offset:0,selectedRanges:c,onSelectionChange:g,isMultiSelect:!0})}),r.jsxs("div",{className:"d-flex flex-row pt-2",children:[r.jsx("div",{className:"d-flex flex-grow-1",children:r.jsx("input",{className:I("form-control",{"is-invalid":a!=null}),placeholder:"Enter value",type:"text",value:h,onChange:E,onFocus:x,onKeyDown:P})}),r.jsxs("div",{className:"d-flex align-items-start mt-1 ml-2",children:[r.jsx(ee,{kind:"ghost",onClick:S,disabled:a!=null||h==="",icon:li,tooltip:"Add new item","data-testid":"add-item-button"}),r.jsx(ee,{kind:"ghost",onClick:b,disabled:c.length===0,icon:ci,tooltip:"Delete selected items","data-testid":"delete-item-button"})]})]})]})}const Ue=class extends u.Component{static isParentSelected(i,e){const t=e.get(i);if(t===void 0)return!1;if(typeof t=="boolean")return t;const s=Array.from(t.values()).includes(!0),o=Array.from(t.values()).includes(!1);return s&&o?null:s}constructor(i){super(i),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(i){i.stopPropagation(),i.preventDefault(),this.setState(e=>{const{menuIsOpen:t}=e;return{menuIsOpen:!t}})}toggleValueFor(i,e){const{valueMap:t,onUpdateValueMap:s}=this.props,o=new Map(t),a=o.get(i);if(a instanceof Map){const c=new Map(a);if(e!=null)c.set(e,a.get(e)===void 0);else{const d=Ue.isParentSelected(i,o),h=d==null||!d;a.forEach((m,g)=>c.set(g,h))}o.set(i,c)}else o.set(i,a==null||!a);const l=o.get(i);if(e===void 0&&l!==void 0&&typeof l!="boolean"){const c=Ue.isParentSelected(i,t);c!=null&&c?l.forEach((d,h)=>l.set(h,!1)):l.forEach((d,h)=>l.set(h,!0))}s(o)}setAllValues(i){const{valueMap:e,onUpdateValueMap:t}=this.props,s=new Map;e.forEach((o,a)=>{if(typeof o=="boolean")s.set(a,i);else{const l=new Map;o.forEach((c,d)=>l.set(d,i)),s.set(a,l)}}),t(s)}selectAll(){this.setAllValues(!0)}clear(){this.setAllValues(!1)}renderMenuElement(){const{valueMap:i,"data-testid":e}=this.props;return r.jsxs("div",{className:"hcm-menu-container",children:[Array.from(i.entries()).map(([t,s])=>r.jsxs("div",{children:[r.jsx(Je,{className:"hcm-parent",checked:Ue.isParentSelected(t,i),onChange:()=>this.toggleValueFor(t),children:t}),s!==void 0&&typeof s!="boolean"&&Array.from(s.entries()).map(([o,a])=>r.jsx(Je,{className:"hcm-child",checked:a,onChange:()=>this.toggleValueFor(t,o),children:o},o))]},t)),r.jsx(ee,{kind:"ghost",onClick:this.selectAll,"data-testid":e!==void 0?`${e}-btn-select-all`:void 0,children:"Select All"}),r.jsx(ee,{kind:"ghost",onClick:this.clear,"data-testid":e!==void 0?`${e}-btn-clear`:void 0,children:"Clear"})]})}render(){const{menuText:i,className:e,icon:t,id:s,"data-testid":o}=this.props,{menuIsOpen:a}=this.state;return r.jsxs("button",{type:"button",className:I("btn hcm-btn",e),onClick:this.toggleMenu,id:s,"data-testid":o,children:[r.jsxs("span",{children:[t&&r.jsx(Z,{icon:t,className:"hcm-icon mr-1"}),i]}),r.jsx(Z,{icon:wn,className:"hcm-icon ml-1"}),r.jsx(Ae,{options:{placement:"bottom"},isShown:a,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}};let Ze=Ue;p(Ze,"defaultProps",{className:"",icon:null,id:"","data-testid":void 0});const Ao=Ze;function es({on:n,id:i,className:e,isInvalid:t,disabled:s=!1,onClick:o,"data-testid":a}){return r.jsx("button",{type:"button",className:I("btn","btn-switch",e,{active:n},{"is-invalid":t}),id:i,onClick:o,disabled:s,"data-testid":a,children:r.jsx("div",{className:"handle"})})}function un(n){return n.isOn!==void 0}function ts({item:n,onSelect:i=()=>{},"data-testid":e}){const{icon:t,subtitle:s,title:o}=n,a=u.useMemo(()=>un(n)?()=>{n.onChange(!n.isOn)}:i,[n,i]);return r.jsxs("div",{className:"btn btn-navigation-menu-item","data-testid":`menu-item-${o}`,onClick:a,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&a()},tabIndex:0,role:"menuitem",children:[t!==void 0&&r.jsx("div",{className:"icon",children:r.jsx(Z,{icon:t})}),r.jsx("div",{className:"title",children:o}),s!==void 0&&r.jsx("div",{className:"shortcut",children:s}),r.jsx("div",{className:"accessory","data-testid":e,children:un(n)?r.jsx(es,{on:n.isOn,onClick:l=>{l.stopPropagation(),a()}}):r.jsx(Z,{icon:ui})})]})}function Ro({items:n,onSelect:i=()=>{},"data-testid":e}){return r.jsx("div",{className:"navigation-menu-view","data-testid":e,children:r.jsx("ul",{className:"navigation-menu-list",children:n.map((t,s)=>r.jsx("li",{children:r.jsx(ts,{item:t,onSelect:()=>{i(s)}})},t.title))})})}function Lo({children:n,onBack:i,onClose:e,title:t,"data-testid":s}){return r.jsxs("div",{className:"navigation-page","data-testid":s,children:[r.jsxs("div",{className:"navigation-title-bar",children:[r.jsx("div",{className:"navigation-left-buttons",children:i!==void 0&&r.jsx(ee,{kind:"ghost",className:"btn-back","data-testid":"btn-page-back",onClick:i,icon:di,children:"Back"})}),r.jsx("div",{className:"navigation-title",children:t}),r.jsx("div",{className:"navigation-right-buttons",children:e!==void 0&&r.jsx(ee,{kind:"ghost",className:"btn-close px-2 m-1","data-testid":"btn-page-close",onClick:e,icon:Tn,tooltip:"Close"})})]}),r.jsx("div",{className:"navigation-content",children:n})]})}function jo({children:n,"data-testid":i}){const e=u.useMemo(()=>T.Children.toArray(n),[n]),t=Rt(e),[s,o]=u.useState(e[e.length-1]),[a,l]=u.useState(null),[c,d]=u.useState(null);u.useEffect(function(){if(t===void 0||e===t)return;const b=e[e.length-1];e.length===t.length||t.length===0||a!==null||c!==null?a!==null&&b!==a?l(b):b!==c&&b!==s&&o(b):e.length>t.length?l(b):e.length<t.length&&(o(b),d(t[t.length-1]))},[e,t,a,c,s]);const h=u.useCallback(()=>{o(a),l(null)},[a]),m=u.useCallback(()=>{d(null)},[]);return r.jsxs("div",{className:"navigation-stack",children:[r.jsx("div",{className:"main-view","data-testid":i,children:s}),r.jsx(ve,{in:c!=null,timeout:oe.transitionMidMs,classNames:"slide-right",onEntered:m,children:r.jsx(r.Fragment,{children:c!=null&&r.jsx("div",{className:"popping-view",children:c})})}),r.jsx(ve,{in:a!=null,timeout:oe.transitionMidMs,classNames:"slide-left",onEntered:h,children:r.jsx(r.Fragment,{children:a!=null&&r.jsx("div",{className:"pushing-view",children:a})})})]})}function Po({children:n,disabled:i,value:e,"data-testid":t}){return r.jsx("option",{value:e,disabled:i,"data-testid":t,children:n})}function Fo(n){const{children:i,disabled:e=!1,name:t,onChange:s,value:o="","data-testid":a}=n,[l]=u.useState(t??pe());return r.jsx(r.Fragment,{children:T.Children.map(i,c=>c?T.cloneElement(c,{name:l,onChange:c.props.onChange??s,checked:o===c.props.value,disabled:c.props.disabled??e,"data-testid":a}):null)})}const $t=T.forwardRef((n,i)=>{const{checked:e,children:t,className:s="",disabled:o=!1,inputClassName:a="",isInvalid:l=!1,labelClassName:c="",name:d,onChange:h,value:m,"data-testid":g}=n,[b]=u.useState(pe());return r.jsxs("div",{className:I("custom-control custom-radio",s),children:[r.jsx("input",{type:"radio",id:b,"data-testid":g,name:d,ref:i,className:I("custom-control-input",a,{"is-invalid":l}),checked:e,disabled:o,value:m,onChange:h}),r.jsx("label",{className:I("custom-control-label",c),htmlFor:b,children:t})]})});$t.displayName="RadioItem";$t.defaultProps={checked:void 0,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const Uo=$t;const $o=.025,_o=.9,Vo=.1,Bo=.618,mt=oe["primary-dark"],dn=80,Ho=oe["gray-800"],Ko=oe["gray-900"],fe={SIZE:8,DOT_SIZE:2,FILL_OPACITY:.25},le=18,Wo=250,Go=60*1e3,qo=T.memo(()=>{const n=u.useRef(null),i=u.useRef(null),[e,t]=u.useState(!1),s=window.devicePixelRatio;let o,a,l,c,d,h=null,m=[];function g(){i.current!=null&&(l=i.current.offsetWidth,c=i.current.offsetHeight),n.current!=null&&(n.current.style.width=`${l}px`,n.current.style.height=`${c}px`,n.current.width=l*s,n.current.height=c*s),o==null||o.scale(s,s)}function b(){const D=document.createElement("canvas");D.width=fe.SIZE,D.height=fe.SIZE;const A=D.getContext("2d");return A!=null&&(A.fillStyle=mt,A.fillRect(0,0,fe.DOT_SIZE,fe.DOT_SIZE),A.fillStyle=mt+Math.round(255*fe.FILL_OPACITY).toString(16).padStart(2,"0"),A.fillRect(0,0,fe.SIZE,fe.SIZE)),A==null?void 0:A.createPattern(D,"repeat")}function S(D){const A=Math.random()-.5;let B=$o*A;return D<Vo?B=Math.abs(B):D>_o&&(B=-Math.abs(B)),D+B}function E(){const D=[];let A=Bo;for(let B=0;B<l+le;B+=1)A=S(A),D.push(A);return D}function x(){for(;m.length>=l+le;)m.pop();for(;m.length<l+le;)m.push(S(m[m.length-1]))}function P(D,A){A.beginPath(),A.moveTo(-1,c+1),A.lineTo(-1,c*D[0]);for(let B=0;B<D.length;B+=1)A.lineTo(B,c*D[B]);A.lineTo(l+le,c*D[D.length-1]),A.lineTo(l+le,c+1),A.closePath()}function U(D){D.beginPath();for(let A=1;A<l;A+=dn)D.moveTo(A,0),D.lineTo(A,c);for(let A=1;A<c;A+=dn)D.moveTo(0,A),D.lineTo(l,A)}function C(D){h=h??D,fi(o),o.fillStyle=Ko,o.fillRect(0,0,l,c),U(o),o.lineWidth=1,o.strokeStyle=Ho,o.stroke();const A=((h??0)-(D??0))/(1e3/le);if(o.translate(A,0),P(m,o),o.lineWidth=2,o.strokeStyle=mt,o.stroke(),o.translate(-A,0),a!=null&&(o.fillStyle=a),o.fill(),o.setTransform(s,0,0,s,0,0),(D??0)-(h??0)>1e3/le){const B=Math.floor(((D??0)-(h??0))/(1e3/le));for(let N=0;N<B;N+=1)m.shift(),m.push(S(m[m.length-1]));h=D}d!=null&&cancelAnimationFrame(d),d=requestAnimationFrame(C)}const k=$e(()=>{d=requestAnimationFrame(D=>{g(),x(),t(!1),C(D)})},Wo,{leading:!0});function O(){t(!0),d!=null&&cancelAnimationFrame(d),d=null,h=null}const w=$e(()=>{O()},Go);function R(){d==null&&(t(!1),g(),x(),d=requestAnimationFrame(C)),w()}function $(){document.hasFocus()&&R()}function J(){d!=null&&cancelAnimationFrame(d),w(),k()}return u.useEffect(()=>{var D;return o=(D=n.current)==null?void 0:D.getContext("2d",{alpha:!1}),g(),m=E(),a=b(),C(),w(),window.addEventListener("resize",J),window.addEventListener("focus",R),window.addEventListener("blur",O),window.addEventListener("mousemove",$),window.addEventListener("keydown",$),()=>{d!=null&&cancelAnimationFrame(d),window.removeEventListener("resize",J),window.removeEventListener("focus",R),window.removeEventListener("blur",O),window.removeEventListener("mousemove",$),window.removeEventListener("keydown",$),w.cancel(),k.cancel()}},[]),r.jsx("div",{className:"random-area-plot-animation-container",ref:i,children:r.jsx("canvas",{ref:n,className:e?"shade":""})})}),ns=qo;function zo({children:n,onBlur:i,onChange:e,className:t,defaultValue:s,name:o,value:a,disabled:l,"data-testid":c}){const d=u.useCallback(h=>{e(h.target.value)},[e]);return r.jsx("select",{className:I("custom-select",t),onBlur:i,onChange:d,defaultValue:s,value:a,name:o,disabled:l,"data-testid":c,children:n})}class ss extends u.PureComponent{constructor(e){super(e);p(this,"list");p(this,"topRow");p(this,"bottomRow");p(this,"getCachedItem",Y((e,t,s,o,a,l,c)=>{const d={height:a},h=o??s;return r.jsx("li",{className:"value-list-item",style:d,tabIndex:-1,children:r.jsx(Je,{checked:l,disabled:c,onChange:()=>this.handleSelect(e),children:h})},t)},{max:1e3}));p(this,"getCachedItems",Y((e,t,s,o)=>{const a=[];for(let l=0;l<e.length;l+=1){const c=e[l],{value:d,displayValue:h,isSelected:m}=c,g=s+l,b=g,S=this.getCachedItem(g,b,d,h,t,m,o);a.push(S)}return a},{max:1}));this.handleBlur=this.handleBlur.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleSelect=this.handleSelect.bind(this),this.list=T.createRef(),this.topRow=null,this.bottomRow=null}componentDidMount(){this.sendViewportUpdate()}componentDidUpdate(){this.sendViewportUpdate()}handleBlur(e){if(!e.relatedTarget||this.list.current&&e.relatedTarget instanceof HTMLElement&&!this.list.current.contains(e.relatedTarget)){const{onBlur:t}=this.props;t==null||t(e)}}handleScroll(){this.sendViewportUpdate()}handleSelect(e){const{items:t,offset:s,onSelect:o}=this.props,a=e-s;if(a>=0&&a<t.length){const l=t[a],{value:c}=l;o(e,c)}else o(e,null)}sendViewportUpdate(){if(!this.list.current||this.list.current.clientHeight===0)return;const{onViewportChange:e,rowHeight:t}=this.props,s=this.list.current.scrollTop,o=s+this.list.current.clientHeight,a=Math.floor(s/t),l=Math.ceil(o/t);(this.topRow!==a||this.bottomRow!==l)&&(this.topRow=a,this.bottomRow=l,e(a,l))}getElement(e){return this.list.current==null?null:this.list.current.querySelectorAll(".value-list-item")[e]}scrollIntoView(e){const t=this.getElement(e);t==null||t.scrollIntoView({block:"center"})}render(){const{className:e,disabled:t,isInvalid:s,items:o,itemCount:a,offset:l,rowHeight:c,"data-testid":d}=this.props,h=this.getCachedItems(o,c,l,t);return r.jsx("div",{className:I("select-value-list-scroll-pane h-100 w-100",{"is-invalid":s},e),onBlur:this.handleBlur,onScroll:this.handleScroll,ref:this.list,"data-testid":d,children:r.jsx("div",{className:"select-value-list",style:{height:a*c},children:r.jsx("ol",{className:"select-value-list-content",style:{position:"absolute",height:o.length*c,top:l*c,left:0},children:h})})})}}p(ss,"defaultProps",{disabled:!1,rowHeight:21,onBlur:()=>{},"data-testid":void 0});const is=ss,hn=F.module("Shortcut");var Q=(n=>(n.CTRL="MODIFIER_CTRL",n.CMD="MODIFIER_CMD",n.ALT="MODIFIER_ALT",n.OPTION="MODIFIER_OPTION",n.SHIFT="MODIFIER_SHIFT",n))(Q||{}),G=(n=>(n.A="A",n.B="B",n.C="C",n.D="D",n.E="E",n.F="F",n.G="G",n.H="H",n.I="I",n.J="J",n.K="K",n.L="L",n.M="M",n.N="N",n.O="O",n.P="P",n.Q="Q",n.R="R",n.S="S",n.T="T",n.U="U",n.V="V",n.W="W",n.X="X",n.Y="Y",n.Z="Z",n.ZERO="0",n.ONE="1",n.TWO="2",n.THREE="3",n.FOUR="4",n.FIVE="5",n.SIX="6",n.SEVEN="7",n.EIGHT="8",n.NINE="9",n.BACKSPACE="Backspace",n.ESCAPE="Escape",n.ENTER="Enter",n.DELETE="Delete",n.SLASH="/",n.QUESTION_MARK="?",n.BACKSLASH="\\",n.PIPE="|",n.MINUS="-",n.UNDERSCORE="_",n.EQUALS="=",n.PLUS="+",n.BACKTICK="`",n.TILDE="~",n.COMMA=",",n.LEFT_CHEVRON="<",n.PERIOD=".",n.RIGHT_CHEVRON=">",n.SEMICOLON=";",n.COLON=":",n.SINGLE_QUOTE="'",n.DOUBLE_QUOTE='"',n.LEFT_BRACKET="[",n.RIGHT_BRACKET="]",n.LEFT_CURLY="{",n.RIGHT_CURLY="}",n.F1="F1",n.F2="F2",n.F3="F3",n.F4="F4",n.F5="F5",n.F6="F6",n.F7="F7",n.F8="F8",n.F9="F9",n.F10="F10",n.F11="F11",n.F12="F12",n))(G||{});const Zo=new Set(["Enter","Delete","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),K=class extends Nt{constructor({id:e,shortcut:t,macShortcut:s,isEditable:o=!0,name:a,tooltip:l}){super();p(this,"id");p(this,"name");p(this,"tooltip");p(this,"isEditable");p(this,"defaultKeyState");p(this,"keyState");this.id=e,this.name=a,this.tooltip=l,this.isEditable=o;const d=K.isMacPlatform?s:t;this.defaultKeyState=K.createKeyState(d),this.keyState=this.defaultKeyState}static isAllowedKey(e){return Object.values(G).includes(e)}static isValidKeyState(e){const{keyValue:t}=e;return t===null?!0:!K.isMacPlatform&&e.metaKey||!K.isAllowedKey(t)?!1:!(!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey)||Zo.has(t)}static createKeyState(e){const t={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:e[e.length-1]};return e.forEach(s=>{switch(s){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:s}=e;let o="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?o="":!K.isAllowedKey(t)&&K.isAllowedKey(String.fromCharCode(s))?o=String.fromCharCode(s):o=t,{keyValue:o,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){var s,o;return((s=e.keyValue)==null?void 0:s.toUpperCase())===((o=t.keyValue)==null?void 0:o.toUpperCase())&&e.altKey===t.altKey&&e.ctrlKey===t.ctrlKey&&e.metaKey===t.metaKey&&e.shiftKey===t.shiftKey}static getDisplayText(e){return e.keyValue===null?"":K.isMacPlatform?K.getMacDisplayText(e):K.getWindowsDisplayText(e)}getDisplayText(){return K.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){K.isValidKeyState(e)?(hn.debug2(`Shortcut ${this.id} updated to ${JSON.stringify(e)}`),this.keyState=e,this.dispatchEvent(new Pn("onUpdate",{detail:this}))):hn.debug2(`Shortcut ${this.id} tried to update to invalid keyState ${JSON.stringify(e)}`)}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return K.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(K.NULL_KEY_STATE)}isNull(){return K.doKeyStatesMatch(this.keyState,K.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return K.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(K.getKeyStateFromEvent(e))}};let we=K;p(we,"NULL_KEY_STATE",{metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null}),p(we,"isMacPlatform",z.isMacPlatform());const pn=F.module("ShortcutRegistry");class Xo extends Nt{constructor(){super(...arguments);p(this,"shortcutMap",new Map);p(this,"shortcutsByCategory",new Map)}createAndAdd(e){const t=new we(e);return this.add(t)}add(e){var o;const t=this.shortcutMap.get(e.id);if(t)return pn.warn(`Skipping attempt to add duplicate shortcut ID to registry: ${e.id}`),t;pn.debug2(`Adding shortcut to registry: ${e.id}`),e.addEventListener("onUpdate",({detail:a})=>this.dispatchEvent(new Pn("onUpdate",{detail:a})));const s=e.id.split(".")[0];return this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(s)?(o=this.shortcutsByCategory.get(s))==null||o.push(e):this.shortcutsByCategory.set(s,[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 Jo=Object.freeze(new Xo),be=Jo,Qo={COPY:be.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[Q.CTRL,G.C],macShortcut:[Q.CMD,G.C],isEditable:!1}),PASTE:be.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[Q.CTRL,G.V],macShortcut:[Q.CMD,G.V],isEditable:!1}),SAVE:be.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[Q.CTRL,G.S],macShortcut:[Q.CMD,G.S],isEditable:!1}),SELECT_ALL:be.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[Q.CTRL,G.A],macShortcut:[Q.CMD,G.A],isEditable:!1}),LINKER:be.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[Q.CTRL,G.L],macShortcut:[Q.CMD,G.L]}),LINKER_CLOSE:be.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[G.ESCAPE],macShortcut:[G.ESCAPE],isEditable:!1})},Yo=Qo;const _t=T.forwardRef((n,i)=>{const{children:e,className:t,disabled:s,id:o,isLinked:a,isLinkedSource:l,isInvalid:c,onClick:d,onMouseEnter:h,onMouseLeave:m,style:g,"data-testid":b}=n;return r.jsxs("button",{ref:i,type:"button",className:I("btn-socketed",{"btn-socketed-linked":a!==void 0&&a||l},{"btn-socketed-linked-source":l},{"is-invalid":c},t),id:o,onClick:d,onMouseEnter:h,onMouseLeave:m,style:g,disabled:s,"data-testid":b,children:[e,r.jsx(Z,{icon:hi,className:"linked btn-socketed-icon",transform:"down-1"}),r.jsx(Z,{icon:pi,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 ea=_t,ta={"dh-spectrum-theme--dark":"_dh-spectrum-theme--dark_i6xja_5"},na={"dh-spectrum-theme--light":"_dh-spectrum-theme--light_16vb7_5"},{global:sa,light:ia,dark:oa,medium:aa,large:ra}=zs,la={global:sa,light:{...ia,...na},dark:{...oa,...ta},medium:aa,large:ra},ca="_track_535ju_30",ua="_handle_535ju_13",da="_ticks_535ju_98",os={"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:ca,"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:ua,ticks:da,"tick-labels":"_tick-labels_535ju_116","tick-label":"_tick-label_535ju_116","tick-label-wrapper":"_tick-label-wrapper_535ju_132"};const We=parseInt(os["handle-size"],10),mn=parseInt(os["popover-width"],10),X=24*60*60-1,fn=5*60;function ha({startTime:n,endTime:i,onChange:e,isStartModified:t=!1,isEndModified:s=!1,"data-testid":o}){const[a,l]=u.useState(n),[c,d]=u.useState(i),h=u.useRef(null);u.useEffect(function(){l(n),d(i)},[n,i]);const m=u.useCallback((S,E)=>{let x=S,P=E;x===P&&(P<X?P+=1:x-=1),l(x),d(P),e({startTime:x,endTime:P})},[l,d,e]),g=u.useCallback(S=>{m(S,c)},[m,c]),b=u.useCallback(S=>{m(a,S)},[m,a]);return r.jsxs("div",{className:"time-slider","data-testid":o,children:[r.jsx(pa,{startTime:a,endTime:c,onStartTimeChange:g,onEndTimeChange:b,isStartModified:t,isEndModified:s}),r.jsxs("div",{className:"track",ref:h,children:[r.jsx(ma,{startTime:a,endTime:c}),r.jsx("div",{className:"ticks",children:Array(24).fill(null).map((S,E)=>r.jsx("div",{className:"tick"},E))}),r.jsx(gn,{track:h,time:a,setTime:g}),r.jsx(gn,{track:h,time:c,setTime:b})]}),r.jsxs("div",{className:"tick-labels",children:[r.jsx("div",{className:"tick-label",children:"0:00"}),r.jsx("div",{className:"tick-label-wrapper",children:Array(24).fill(null).map((S,E)=>r.jsx("div",{className:"tick-label",children:`${E+1}:00`},E))})]})]})}function pa(n){const{startTime:i,endTime:e,onStartTimeChange:t,onEndTimeChange:s,isStartModified:o,isEndModified:a,"data-testid":l}=n,c=i>e,[d,h]=u.useState(c?e:i),[m,g]=u.useState(c?i:e),b=u.useRef(null),S=u.useRef(null),E=u.useRef(null),x=u.useRef(null);u.useEffect(function(){h(i>e?e:i),g(i>e?i:e)},[i,e]),u.useEffect(function(){var w,R;E.current!==null&&((w=S.current)==null||w.setSelection(E.current)),x.current!==null&&((R=b.current)==null||R.setSelection(x.current))},[c]);function P(O){i<=e?t(O):s(O)}function U(O){i<=e?s(O):t(O)}const C=u.useCallback(O=>{E.current=O,x.current=null},[]),k=u.useCallback(O=>{E.current=null,x.current=O},[]);return r.jsxs("div",{className:"time-slider-popovers",children:[r.jsx("div",{className:"flex",style:{flexBasis:`calc(${d/X*100}% - ${mn/2}px)`}}),r.jsxs("div",{className:"handle-popper",children:[r.jsx("label",{className:I({modified:c?a:o}),children:c?"End Time":"Start Time"}),r.jsx(Qe,{ref:b,allowValueWrapping:!1,value:d,onChange:P,onSelect:C,"data-testid":l!==void 0?`${l}-input-1`:void 0})]}),r.jsx("div",{className:"flex-spacer"}),r.jsxs("div",{className:"handle-popper",children:[r.jsx("label",{className:I({modified:c?o:a}),children:c?"Start Time":"End Time"}),r.jsx(Qe,{ref:S,allowValueWrapping:!1,value:m,onChange:U,onSelect:k,"data-testid":l!==void 0?`${l}-input-2`:void 0})]}),r.jsx("div",{className:"flex",style:{flexBasis:`calc(${(X-m)/X*100}% - ${mn/2}px)`}})]})}function ma(n){const{startTime:i,endTime:e,"data-testid":t}=n;return r.jsxs("div",{className:"track-fills","data-testid":t,children:[i>e&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"track-fill track-fill-start",style:{transform:`scaleX(${e/X})`}}),r.jsx("div",{className:"track-fill track-fill-end",style:{transform:`scaleX(${(X-i)/X})`}})]}),i<e&&r.jsx("div",{className:"track-fill track-fill-middle",style:{transform:`translateX(${i/X*100}%) scaleX(${(e-i)/X})`}})]})}function gn(n){const{track:i,time:e,setTime:t,"data-testid":s}=n,o=u.useMemo(()=>{let b=We/2;return e<3600?b=e/3600*(We/2):e>23*3600&&(b=We/2+1/(X-23*3600)*(e-23*3600)*(We/2)),`translateX(calc(${e/X*100}% - ${b}px))`},[e]),a=u.useCallback(g=>{if(!i.current)return 0;const b=i.current.getBoundingClientRect(),S=Math.max(g-b.left,0),E=X*Math.min(1,S/b.width),x=fn*Math.round(E/fn);return Math.min(X,x)},[i]),l=u.useCallback(({clientX:g})=>{t(a(g))},[t,a]),c=u.useCallback(({clientX:g})=>{t(a(g)),window.removeEventListener("mousemove",l),window.removeEventListener("mouseup",c),document.documentElement.classList.remove("drag-pointer-events-none")},[t,a,l]),d=u.useCallback(()=>{window.addEventListener("mousemove",l),window.addEventListener("mouseup",c),document.documentElement.classList.add("drag-pointer-events-none")},[l,c]),h=u.useCallback(()=>{window.removeEventListener("mousemove",l),window.removeEventListener("mouseup",c),document.documentElement.classList.remove("drag-pointer-events-none")},[l,c]),m=u.useCallback(()=>{d()},[d]);return u.useEffect(function(){return()=>{h()}},[h]),r.jsx("div",{className:"handle-track",style:{transform:o},children:r.jsx("button",{className:"handle",type:"button","aria-label":"Change time",onMouseDown:m,"data-testid":s})})}function as({buttons:n,isShown:i=!1,classNames:e,message:t,type:s,onClick:o,onDismiss:a,"data-testid":l}){const c=n&&n.length!==0;return r.jsx(ve,{in:i,timeout:oe.transitionMs,classNames:"toast-notification-slide-up",mountOnEnter:!0,unmountOnExit:!0,children:r.jsxs("div",{className:I("toast-notification",e,s),role:"presentation",onClick:o,onKeyPress:o,"data-testid":l,children:[r.jsx("div",{className:"message-container",children:r.jsx("span",{className:"message",children:t})}),r.jsx(ve,{in:c,timeout:oe.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:r.jsx("div",{className:"buttons-container",children:n})}),a&&r.jsx(ee,{kind:"ghost",icon:Tn,tooltip:"Close notification",className:"my-2",onClick:a})]})})}as.TYPE=Object.freeze({ERROR:"error"});function fa(n){const{children:i,className:e,labelText:t,hintText:s,isModified:o,validationError:a,showValidationError:l=!0,"data-testid":c,id:d}=n,{current:h}=u.useRef(d??pe());return r.jsxs(r.Fragment,{children:[r.jsx("label",{className:I("validate-label",e,{modified:o}),htmlFor:h,"data-testid":c,children:t}),T.Children.toArray(i).map(m=>T.isValidElement(m)?T.cloneElement(m,{className:I(m.props.className,{"is-invalid":a})}):r.jsx("div",{className:I(e),children:m})),s!==void 0&&r.jsx("small",{className:"form-text text-muted",children:s}),a!==void 0&&l&&r.jsx("p",{className:"validate-label-error text-danger",children:a})]})}const ga=Object.freeze(Object.defineProperty({__proto__:null,AutoCompleteInput:Ui,AutoResizeTextarea:At,BasicModal:Pt,Button:ee,ButtonGroup:Be,ButtonOld:Qi,CardFlip:Yi,Checkbox:Je,Collapse:oo,ComboBox:ao,ContextActionUtils:z,ContextActions:io,ContextMenuItem:Dn,ContextMenuRoot:gi,CopyButton:ro,CustomTimeSelect:mo,DEFAULT_GET_PREFERRED_REPLACEMENT_STRING:ot,DateInput:To,DateTimeInput:So,DebouncedModal:Xi,DebouncedSearchInput:Mo,DragUtils:Do,DraggableItemList:ko,DropdownMenu:zn,EditableItemList:Oo,GLOBAL_SHORTCUTS:Yo,HierarchicalCheckboxMenu:Ao,InfoModal:Ji,ItemList:ne,ItemListItem:Yn,KEY:G,LoadingOverlay:Oe,LoadingSpinner:Mn,MODIFIER:Q,MaskedInput:at,Menu:Ro,MenuItem:ts,Modal:kt,ModalBody:Dt,ModalFooter:_n,ModalHeader:In,Option:Po,Page:Lo,Popper:Ae,RadioGroup:Fo,RadioItem:Uo,RandomAreaPlotAnimation:ns,SearchInput:it,Select:zo,SelectValueList:is,Shortcut:we,ShortcutRegistry:be,SocketedButton:ea,Stack:jo,ThemeExport:oe,TimeInput:Qe,TimeSlider:ha,ToastNotification:as,Tooltip:Ot,UISwitch:es,ValidateLabelInput:fa,fillToLength:Kn,themeDHDefault:la,trimTrailingMask:yt},Symbol.toStringTag,{value:"Module"})),ba=Object.freeze(Object.defineProperty({__proto__:null,ApiBootstrap:mi,ApiContext:Nn,ClientBootstrap:On,ClientContext:bi,useApi:me,useClient:Ve},Symbol.toStringTag,{value:"Module"})),rs=1e4;function Ca(n,i,e=rs){return new Promise((t,s)=>{let o;const a=setTimeout(()=>{o==null||o(),s(new An(`Variable ${i} not found`))},e);function l(c){const d=c.created.find(h=>h.title===i);d!=null&&(clearTimeout(a),o==null||o(),t(d))}o=n.subscribeToFieldUpdates(l)})}const ft=F.module("MessageUtils"),ls="io.deephaven.message.LoginOptions.request",cs="io.deephaven.message.SessionDetails.request",us="io.deephaven.broadcast",Vt="io.deephaven.broadcast.Login",ds="io.deephaven.broadcast.Logout";function rt(n){const i=n;return i!=null&&typeof i.id=="string"&&typeof i.message=="string"}function hs(n){return rt(n)&&n.message===Vt}function ps(n){return rt(n)&&n.message===ds}function ms(n){const i=n;return i!=null&&typeof i.id=="string"}function Bt(n,i=pe(),e){return{message:n,id:i,payload:e}}function va(n,i){return{id:n,payload:i}}async function Ht(n,i=3e4){if(window.opener==null)throw new Error("window.opener is null, unable to send request.");return new Promise((e,t)=>{let s;const o=pe(),a=l=>{const{data:c}=l;if(!ms(c)){ft.debug("Ignoring non-deephaven response",c);return}if(ft.debug("Received message",c),(c==null?void 0:c.id)!==o){ft.debug("Ignore message, id doesn't match",c);return}window.clearTimeout(s),window.removeEventListener("message",a),e(c.payload)};window.addEventListener("message",a),s=window.setTimeout(()=>{window.removeEventListener("message",a),t(new An("Request timed out"))},i),window.opener.postMessage(Bt(n,o),"*")})}class fs extends Error{constructor(){super(...arguments);p(this,"isNoConsolesError",!0)}}function gs(n){return n.isNoConsolesError}const Te=F.module("SessionUtils");function xa(n,i){return Te.info(`Starting connection to '${i}'...`),new n.IdeConnection(i)}async function bs(n,i){Te.info("Getting console types...");const e=await n.getConsoleTypes();if(e.length===0)throw new fs("No console types available");Te.info("Available types:",e);const t=e[0];Te.info("Starting session with type",t);const s=await n.startSession(t),o={type:t,id:pe.generate()};return Te.info("Console session established",o),{session:s,config:o,connection:n,details:i}}function Sa(n,i,e){return Te.info("createCoreClient",i),new n.CoreClient(i,e)}function ya(n){return n!=null&&typeof n=="object"}async function Ea(){const n=await Ht(cs);if(!ya(n))throw new Error(`Unexpected session details response: ${n}`);return n}async function Ia(){switch(new URLSearchParams(window.location.search).get("authProvider")){case"parent":return Ea()}return{}}async function wa(n,i){let e;try{e=await bs(n,i)}catch(t){if(!gs(t))throw t}return e}const Ta=F.module("ViewportDataUtils");function Cs(n,i){return String(n.offsetInSnapshot+i)}function vs(n,i){return function(t){const{columns:s,offset:o,rows:a}=t.detail;Ta.debug("table updated",t.detail),a.forEach(l=>{const c=i(l,s),d={key:Cs(l,o),item:c};n.getItem(d.key)!=null?n.update(d.key,d):n.append(d)})}}function xs(n,i){return i.reduce((e,t)=>(e[t.name]=n.get(t),e),{})}function*Ss(n,i){for(let e=n;e<=i;++e)yield{key:String(e)}}function Ma(n,...i){return i.map(e=>n.getItem(e))}function Kt(n){return n==null||lt(n)?0:n.size}function lt(n){return"isClosed"in n?n.isClosed:!1}function ys(n,i,e,t){const s=n+i-1,[o,a]=[0,t-1],l=vt(n-e,o,a),c=vt(s+e,o,a);return[l,c]}const Na=Object.freeze(Object.defineProperty({__proto__:null,BROADCAST_CHANNEL_NAME:us,BROADCAST_LOGIN_MESSAGE:Vt,BROADCAST_LOGOUT_MESSAGE:ds,BooleanColumnFormatter:Ci,CharColumnFormatter:vi,DateTimeColumnFormatter:xi,DateUtils:Si,DecimalColumnFormatter:yi,DefaultColumnFormatter:Ei,FETCH_TIMEOUT:rs,Formatter:Rn,FormatterUtils:xt,IntegerColumnFormatter:Ii,LOGIN_OPTIONS_REQUEST:ls,NoConsolesError:fs,SESSION_DETAILS_REQUEST:cs,StringColumnFormatter:wi,TableColumnFormatter:Ti,TableUtils:Ln,createConnection:xa,createCoreClient:Sa,createKeyFromOffsetRow:Cs,createOnTableUpdatedHandler:vs,createSessionWrapper:bs,defaultRowDeserializer:xs,fetchVariableDefinition:Ca,generateEmptyKeyedItems:Ss,getColumnFormats:Mi,getDateTimeFormatterOptions:Ni,getItemsFromListData:Ma,getSessionDetails:Ia,getSize:Kt,isBroadcastLoginMessage:hs,isBroadcastLogoutMessage:ps,isClosed:lt,isCustomColumnFormatDefined:ki,isMessage:rt,isNoConsolesError:gs,isResponse:ms,loadSessionWrapper:wa,makeMessage:Bt,makeResponse:va,padFirstAndLastRow:ys,requestParentResponse:Ht},Symbol.toStringTag,{value:"Module"}));function ka(n){return function({children:e}){return r.jsx(Nn.Provider,{value:n,children:e})}}const bn=F.module("useTableListener"),Da=(n,i,e)=>u.useEffect(function(){if(n==null){bn.debug2("Emitter undefined, skipping addEventListener",i);return}return bn.debug2("Adding listener",i),n.addEventListener(i,e)},[n,i,e]),ke=Da;class Oa extends Error{constructor(){super(...arguments);p(this,"isColumnNameError",!0)}}const Aa=Oa;class Ra extends Error{constructor(){super(...arguments);p(this,"isTableDisconnectError",!0)}}const La=Ra,Ge=F.module("useTable"),ja=(n,i,e,t)=>{const s=me(),[o,a]=u.useState(void 0),[l,c]=u.useState([]),[d,h]=u.useState(null),[m,g]=u.useState(null);u.useEffect(()=>{if(t===void 0){a(n==null?void 0:n.columns),h(null);return}try{a(n==null?void 0:n.findColumns(t)),h(null)}catch(x){Ge.error("Column not found",x,t),h(new Aa("Invalid columnNames argument"))}},[n,t]),u.useEffect(()=>{if(!o||!n){Ge.debug2("Table or column not initialized, skip viewport update.");return}Ge.debug2("Setting viewport",i,e),n.setViewport(i,e,o)},[o,n,i,e]);const b=u.useCallback(({detail:x})=>{if(!o){Ge.error("Columns not initialized.");return}const P=o.map(U=>x.rows.map(C=>C.get(U)));c(P)},[o]),S=u.useCallback(()=>{g(new La("Table disconnected"))},[]),E=u.useCallback(()=>{g(null)},[]);return ke(n,s.Table.EVENT_UPDATED,b),ke(n,s.Table.EVENT_DISCONNECT,S),ke(n,s.Table.EVENT_RECONNECT,E),{columns:o,data:l,error:m??d}},Es=ja,Pa=(n,i,e,t)=>{const s=u.useMemo(()=>[t],[t]),{columns:o=[],data:a=[],error:l}=Es(n,i,e,s);return{column:o[0],data:a[0],error:l}},Is=Pa;const ae=F.module("TableInput"),gt=250;function Wt(n){const{className:i=void 0,columnName:e,settings:t,defaultValue:s=[],isInvalid:o=!1,onChange:a=()=>!1,onBlur:l=()=>!1,table:c}=n,d=u.useRef(null),h=me(),m=u.useMemo(()=>{const y=xt.getColumnFormats(t),j=xt.getDateTimeFormatterOptions(t),{defaultDecimalFormatOptions:V={},defaultIntegerFormatOptions:H={}}=t;return new Rn(h,y,j,V,H)},[h,t]),[g,b]=u.useState(""),[S,E]=u.useState(new Set(s)),[x,P]=u.useState(),U=u.useRef(null),C=Math.min((x==null?void 0:x.size)??0,gt),{column:k,data:O,error:w}=Is(x,0,gt-1,e),R=u.useCallback(y=>k?m.getFormattedString(y,k.type,k.name):`${y}`,[k,m]),[$,J]=u.useMemo(()=>{const y=new Set(S),j=[];if(O==null)return[j,null];if(O.forEach(V=>{const H=`${V}`,xe=S.has(H);xe&&y.delete(H),j.push({value:H,displayValue:R(V),isSelected:xe})}),y.size>0){ae.debug2("Selection has items that are missing from the viewport");const V=new Set(S);return Array.from(y).forEach(H=>{V.delete(H)}),[j,V]}return[j,null]},[O,S,R]);u.useEffect(()=>{J!==null&&(E(J),a(Array.from(J)))},[a,J]);const D=u.useCallback(async y=>{try{const j=await y;ae.debug("Table resolved",j),P(j)}catch(j){if(tn.isCanceled(j))return;ae.error(j)}},[]);u.useEffect(()=>{const y=tn.makeCancelable(c);return D(y),()=>{ae.debug2("Cancel table promise"),y.cancel()}},[c,D]);const A=u.useCallback(y=>{var H;const{value:j}=y.target;b(j);const V=$.findIndex(xe=>xe.displayValue.includes(j));V>-1?(ae.debug2(`Found ${j} at index ${V}`),(H=U.current)==null||H.scrollIntoView(V)):ae.debug2(`${j} not found`)},[$,U]),B=u.useCallback(y=>{if(ae.debug("handleSelect",y),y>=$.length){ae.error("Invalid index",y);return}const j=$[y].value,V=new Set(S);$[y].isSelected?V.delete(j):V.add(j),E(V),a(Array.from(V))},[a,$,S]),N=u.useCallback(()=>{const y=$.map(V=>V.value),j=new Set(y);E(j),a(y)},[$,a]),M=u.useCallback(()=>{E(new Set),a([])},[a]),v=u.useCallback(()=>{},[]),L=u.useCallback(y=>{var V;const{relatedTarget:j}=y;ae.debug("handleChildBlur",j,j instanceof HTMLElement,d.current,(V=d.current)==null?void 0:V.contains(j)),(!j||d.current&&j instanceof HTMLElement&&!d.current.contains(j))&&l()},[l]),_=$.length===0;return r.jsxs("div",{ref:d,className:I("table-input-container d-flex flex-column position-relative",i),children:[r.jsx(it,{disabled:!!w||_,value:g,placeholder:"Search",onChange:A,className:"mb-2 d-flex",onBlur:L}),r.jsx(is,{className:"table-input-list",disabled:x===void 0||_,isInvalid:o,items:_?[{value:"Empty",isSelected:!1}]:$,itemCount:C,offset:0,onSelect:B,onViewportChange:v,ref:U,onBlur:L}),x&&r.jsxs("div",{className:"meta-row",children:[r.jsx("div",{className:"d-flex align-items-center text-muted small",children:x!=null&&x.size>C&&r.jsxs(r.Fragment,{children:["Table is too large, showing the first ",gt," items."]})}),r.jsxs("div",{children:[r.jsx("button",{type:"button",className:"btn btn-link",onBlur:L,onClick:N,children:"Select All"}),r.jsx("button",{type:"button",className:"btn btn-link mr-a",onBlur:L,onClick:M,children:"Clear"})]})]}),x==null||w&&r.jsx("div",{className:"h-100 w-100 position-absolute",children:r.jsx(Oe,{isLoaded:x!=null,isLoading:x==null&&w==null,errorMessage:(w==null?void 0:w.message)??null})})]})}Wt.displayName="TableInput";Wt.defaultProps={isInvalid:!1,className:void 0};const Cn=F.module("useBroadcastChannel");function Gt(n=Hi,i=us){const e=u.useMemo(()=>new BroadcastChannel(i),[i]);return u.useEffect(()=>()=>{e.close()},[e]),u.useEffect(()=>{function t(s){const{data:o}=s;if(!rt(o)){Cn.debug("Ignoring non-deephaven message",o);return}Cn.debug("event received",o),n(s)}return e.addEventListener("message",t),()=>{e.removeEventListener("message",t)}},[e,n]),e}function ct(n,i){const e=u.useCallback(t=>{hs(t.data)?n==null||n(t.data):ps(t.data)&&(i==null||i(t.data))},[n,i]);Gt(e)}const et="io.deephaven.web.client.auth.refreshToken",ws=u.createContext(null),Fa=F.module("RefreshTokenUtils");function It(){const n=De.get(et);try{if(n!=null)return JSON.parse(n)}catch(i){Fa.error("Error parsing refresh token",n,i)}return null}function wt(n){if(n==null){De.remove(et);return}const i=JSON.stringify({bytes:n.bytes,expiry:n.expiry}),e=new Date(n.expiry);De.set(et,i,{secure:!0,sameSite:"strict",expires:e})}function Ts({children:n}){const i=me(),e=Ve(),[t,s]=u.useState(It());u.useEffect(function(){return e.addEventListener(i.CoreClient.EVENT_REFRESH_TOKEN_UPDATED,d=>{const{detail:h}=d;wt(h),s(h)})},[i,e,t]);const o=u.useCallback(()=>{s(It())},[]),a=u.useCallback(()=>{wt(null),s(null)},[]);return ct(o,a),r.jsx(ws.Provider,{value:t,children:n})}const vn=F.module("useDebouncedViewportSearch"),Ua=200;function $a(n,i,e=Ua){const t=me(),s=u.useMemo(()=>new Ln(t),[t]),{table:o,applyFiltersAndRefresh:a}=n,l=u.useMemo(()=>$e(c=>{if(vn.debug(`Applying debounced searchText '${c}'`),o==null)return;const d=c.trim();if(d===""){a([]);return}const h=o.findColumn(i),m=s.makeFilterValue(h.type,d),g=[h.filter().contains(m)];a(g)},e),[a,i,e,o,s]);return u.useEffect(()=>()=>{vn.debug("Cancelling debounced search function"),l.cancel()},[l]),l}function qt(n){const[,i]=u.useState(0),e=me();return ke(n,e.Table.EVENT_SIZECHANGED,()=>{i(t=>t+1)}),Kt(n)}function Ms(n){const i=Zs({}),e=Rt(n),t=Math.max(0,qt(n));return u.useEffect(()=>{let s=i.items.length;if(n!==e&&s&&(i.remove(...i.items.map(({key:o})=>o)),s=0),!!n){if(t>s)i.insert(s,...Ss(s,t-1));else if(t<s){const o=i.items.slice(t).map(({key:a})=>a);i.remove(...o)}}},[t,n]),i}function _a(n,...i){const e=u.useCallback(async()=>(n==null?void 0:n.selectDistinct(n.findColumns(i)))??null,[n,...i]),{data:t,error:s,isError:o,isLoading:a}=Un(e,[]);return u.useEffect(()=>()=>{t==null||t.close()},[t]),{distinctTable:t,error:s,isError:o,isLoading:a}}function Ns(n,i,e){return u.useCallback(function(s){const[o,a]=ys(s,i,e,Kt(n));n==null||n.setViewport(o,a)},[n,e,i])}function Va(n){u.useEffect(()=>()=>{n!=null&&(lt(n)||n.close())},[n])}function Ba({table:n,viewportSize:i=10,viewportPadding:e=50,deserializeRow:t=xs}){const s=Ms(n),o=Ns(n,i,e),a=u.useCallback(d=>{n==null||n.applyFilter(d),o(0)},[o,n]),l=me();ke(n,l.Table.EVENT_UPDATED,vs(s,t));const c=qt(n);return u.useEffect(()=>{n&&!lt(n)&&o(0)},[n,o,c]),{viewportData:s,size:c,table:n,applyFiltersAndRefresh:a,setViewport:o}}const Ha=Object.freeze(Object.defineProperty({__proto__:null,REFRESH_TOKEN_KEY:et,RefreshTokenBootstrap:Ts,RefreshTokenContext:ws,TableInput:Wt,makeApiContextWrapper:ka,readRefreshToken:It,storeRefreshToken:wt,useBroadcastChannel:Gt,useBroadcastLoginListener:ct,useDebouncedViewportSearch:$a,useInitializeViewportData:Ms,useSelectDistinctTable:_a,useSetPaddedViewportCallback:Ns,useTable:Es,useTableClose:Va,useTableColumn:Is,useTableListener:ke,useTableSize:qt,useViewportData:Ba},Symbol.toStringTag,{value:"Module"})),ks=u.createContext(!1);function Ka({fontClassNames:n=["fira-sans-regular","fira-sans-bold","fira-mono"],children:i}){const[e,t]=u.useState(!1);return u.useEffect(function(){document.fonts.ready.then(()=>{t(!0)})},[]),r.jsxs(r.Fragment,{children:[r.jsx(ks.Provider,{value:e,children:i}),r.jsx("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:n.map(s=>r.jsx("p",{className:s,children:"preload"},s))})]})}function Ds(n){if(n==null)return!1;const i=n;return i.Component!==void 0&&typeof i.isAvailable=="function"}const Os="io.deephaven.auth.AnonymousAuthenticationHandler",Wa="io.deephaven.authentication.psk.PskAuthenticationHandler";class Ga extends Error{constructor(){super(...arguments);p(this,"name","AuthenticationError");p(this,"isAuthenticationError",!0)}}const As=Ga,xn=F.module("AuthPluginBase");function zt({children:n,getLoginOptions:i}){const e=Ve(),[t,s]=u.useState(),[o,a]=u.useState(!1);return u.useEffect(()=>{let l=!1;function c(){if(l)throw new Di("Login canceled.")}async function d(){try{const h=await i();c(),xn.info("Logging in..."),await e.login(h),c(),a(!0)}catch(h){if(!l){xn.error("Unable to login:",h);const m=_e(h)??"Unable to login. Verify credentials.";s(new As(m)),a(!1)}}}return d(),()=>{l=!0}},[e,i]),o?r.jsx(r.Fragment,{children:n}):r.jsx(Oe,{"data-testid":"auth-base-loading",isLoading:t==null,isLoaded:!1,errorMessage:_e(t)})}const qa=u.createContext({}),Zt=u.createContext({}),za={canLogout:!1};function Za({children:n}){const i=me(),e=u.useCallback(()=>({type:i.CoreClient.LOGIN_TYPE_ANONYMOUS}),[i]);return r.jsx(zt,{getLoginOptions:e,children:r.jsx(Zt.Provider,{value:za,children:n})})}const Xa={Component:Za,isAvailable:n=>n.includes(Os)},Rs=Xa,Ja=F.module("AuthPluginParent"),Qa={canLogout:!1};function Ya(n){return n!=null&&typeof n.type=="string"}async function er(){Ja.info("Logging in by delegating to parent window...");const n=await Ht(ls);if(!Ya(n))throw new Error(`Unexpected login options response: ${n}`);return n}function tr(){return new URLSearchParams(window.location.search).get("authProvider")??""}function nr({children:n}){return r.jsx(zt,{getLoginOptions:er,children:r.jsx(Zt.Provider,{value:Qa,children:n})})}const sr={Component:nr,isAvailable:()=>window.opener!=null&&tr()==="parent"},Ls=sr;function js({children:n,errorMessage:i,isLoggingIn:e=!1,onSubmit:t}){return r.jsxs("form",{className:"login-form",onSubmit:s=>{s.preventDefault(),s.stopPropagation(),t==null||t(s)},children:[r.jsx("div",{className:"flex-spacer"}),r.jsxs("div",{className:"flex-wrapper",children:[r.jsx("fieldset",{disabled:e,className:"container-fluid",children:n}),r.jsx("div",{className:"form-group d-flex justify-content-end align-items-center mb-0",children:r.jsxs("button",{type:"submit",className:I("btn btn-primary",{"btn-spinner":e},{"btn-cancelable":e}),"data-testid":"btn-login",children:[e&&r.jsxs("span",{children:[r.jsx(Mn,{}),r.jsx("span",{className:"btn-normal-content",children:"Logging in"}),r.jsx("span",{className:"btn-hover-content",children:"Cancel"})]}),!e&&"Login"]})})]}),r.jsx("div",{className:"flex-spacer",children:i!=null&&r.jsx("p",{className:"error-message mb-0",role:"alert",children:`${i}`})})]})}function Ps({children:n,logoPath:i="./logo.png"}){return r.jsxs("div",{className:"login-container",children:[r.jsx(ns,{}),r.jsxs("div",{className:"login-box",children:[r.jsx("div",{className:"logo",children:r.jsx("img",{src:i,alt:"Deephaven Data Labs"})}),n,r.jsxs("p",{className:"footer",children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})}const Tt="io.deephaven.authentication.psk.PskAuthenticationHandler",Fs="psk",Mt="io.deephaven.web.client.auth.psk.token",Me=F.module("AuthPluginPsk");function ir(){return new URLSearchParams(window.location.search).get(Fs)}function or(){Me.debug2("clearWindowToken");const n=new URL(window.location.href);n.searchParams.delete(Fs),window.history.replaceState(null,"",n.href)}function Sn(){return De.get(Mt)??null}function bt(n){Me.debug2("Storing token in cookie",n),n!=null?De.set(Mt,n,{secure:!0,sameSite:"strict"}):De.remove(Mt)}function ar({children:n,logoPath:i}){const e=Ve(),t=u.useRef(null),s=u.useRef(null),[o,a]=u.useState(),[l,c]=u.useState(!1),[d,h]=u.useState(!1),[m,g]=u.useState(!1),[b,S]=u.useState(""),E=u.useCallback(async(k,O=!0)=>{Me.info("Logging in..."),g(!0);let w=null;try{if(w=e.login({type:Tt,token:k}),s.current=w,await w,Me.info("Logged in successfully"),s.current!==w)return;bt(k),h(!0)}catch(R){if(s.current!==w)return;if(c(!0),O){Me.error("Unable to login",R);const $=_e(R)??"Unable to login: Verify credentials.";a(new As($))}}g(!1)},[e]),x=u.useCallback(()=>{s.current=null,g(!1)},[]),P=u.useCallback(async()=>{Me.debug("onLogin");const k=Sn();d||m||k==null||E(k,!1)},[d,m,E]),U=u.useCallback(()=>{bt(null)},[]);ct(P,U),u.useEffect(()=>{let k=!1;async function O(){const w=ir()??Sn();if(or(),w==null){c(!0);return}g(!0);try{await e.login({type:Tt,token:w}),k||(bt(w),h(!0),g(!1))}catch{k||(c(!0),g(!1))}}return O(),()=>{k=!0}},[e]);const C=u.useCallback(()=>{m?x():E(b)},[x,m,E,b]);return u.useEffect(function(){var O;(O=t.current)==null||O.focus()},[t,l]),r.jsxs(r.Fragment,{children:[d&&n,l&&r.jsx(ve,{in:!d,timeout:oe.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:r.jsx(Ps,{logoPath:i,children:r.jsx(js,{errorMessage:_e(o),isLoggingIn:m,onSubmit:C,children:r.jsxs("div",{className:"form-group",children:[r.jsx("label",{htmlFor:"auth-psk-token-input",children:"Token"}),r.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:t,value:b,onChange:k=>{a(void 0),S(k.target.value)}})]})})})}),r.jsx(Oe,{"data-testid":"auth-psk-loading",isLoaded:d||l,isLoading:!d&&!l})]})}const rr={Component:ar,isAvailable:n=>n.includes(Tt)},Us=rr,lr=Object.freeze(Object.defineProperty({__proto__:null,AUTH_HANDLER_TYPE_ANONYMOUS:Os,AUTH_HANDLER_TYPE_PSK:Wa,AuthPluginAnonymous:Rs,AuthPluginBase:zt,AuthPluginParent:Ls,AuthPluginPsk:Us,Login:Ps,LoginForm:js,UserOverrideContext:qa,UserPermissionsOverrideContext:Zt,isAuthPlugin:Ds},Symbol.toStringTag,{value:"Module"})),$s={react:T,"react-dom":yn,redux:Xs,"react-redux":Js,"@deephaven/auth-plugins":lr,"@deephaven/components":ga,"@deephaven/jsapi-bootstrap":ba,"@deephaven/jsapi-components":Ha,"@deephaven/jsapi-utils":Na,"@deephaven/log":ji,"@deephaven/react-hooks":Zi},cr=En.createRequires(()=>$s),ur=En.createRemoteComponent({requires:cr}),dr=ur,hr=Qs.createRequires($s),pr=Ys({requires:hr}),mr=pr,he=F.module("@deephaven/app-utils.PluginUtils");function Rr(n,i){const e=new URL(`${i}.js`,n),t=T.forwardRef((s,o)=>r.jsx(dr,{url:e.href,render:({err:a,Component:l})=>{if(a!=null&&a!==""){const c=`Error loading plugin ${i} from ${e} due to ${a}`;return he.error(c),r.jsx("div",{className:"error-message",children:`${c}`})}return r.jsx(l,{ref:o,...s})}}));return t.pluginName=i,t.displayName="Plugin",t}async function fr(n){return await mr(n)}async function gr(n){const i=await fetch(n);if(!i.ok)throw new Error(i.statusText);try{return await i.json()}catch{throw new Error("Could not be parsed as JSON")}}async function br(n){he.debug("Loading plugins...");try{const i=await gr(`${n}/manifest.json`);if(!Array.isArray(i.plugins))throw new Error("Plugin manifest JSON does not contain plugins array");he.debug("Plugin manifest loaded:",i);const e=[];for(let o=0;o<i.plugins.length;o+=1){const{name:a,main:l}=i.plugins[o],c=`${n}/${a}/${l}`;e.push(fr(c))}const t=await Promise.allSettled(e),s=new Map;for(let o=0;o<t.length;o+=1){const a=t[o],{name:l}=i.plugins[o];a.status==="fulfilled"?s.set(l,a.value):he.error(`Unable to load plugin ${l}`,a.reason)}return he.info("Plugins loaded:",s),s}catch(i){return he.error("Unable to load plugins:",i),new Map}}function Cr(n){var i;return((i=n.get("AuthHandlers"))==null?void 0:i.split(","))??[]}function vr(n,i,e){const t=Cr(i),s=[...n.entries()].filter(([,c])=>Ds(c.AuthPlugin)).map(([c,d])=>[c,d.AuthPlugin]);s.push(...e??[]);const o=s.filter(([c,d])=>d.isAvailable(t,i));if(o.length===0)throw new Error(`No login plugins found, please register a login plugin for auth handlers: ${t}`);o.length>1&&he.warn("More than one login plugin available, will use the first one: ",o.map(([c])=>c).join(", "));const[a,l]=o[0];return he.info("Using LoginPlugin",a),l.Component}const Xt=u.createContext(null);function xr({pluginsUrl:n,children:i}){const[e,t]=u.useState(null);return u.useEffect(function(){let o=!1;async function a(){const l=await br(n);o||t(l)}return a(),()=>{o=!0}},[n]),r.jsx(Xt.Provider,{value:e,children:i})}function Sr(){const n=Gt();return u.useEffect(function(){n.postMessage(Bt(Vt))},[n]),null}const yr=new Map([["@deephaven/auth-plugins.AuthPluginPsk",Us],["@deephaven/auth-plugins.AuthPluginParent",Ls],["@deephaven/auth-plugins.AuthPluginAnonymous",Rs]]);function Er({children:n}){const i=Ve(),e=u.useContext(Xt),[t,s]=u.useState(),[o,a]=u.useState();u.useEffect(function(){let h=!1;async function m(){try{const g=await i.getAuthConfigValues();h||s(new Map(g))}catch(g){h||a(g)}}return m(),()=>{h=!0}},[i]);const l=u.useMemo(()=>{if(!(e==null||t==null))try{return vr(e,t,yr)}catch(d){a(d)}},[t,e]),c=l==null||t==null;return c||o!=null?r.jsx(Oe,{isLoading:c&&o==null,errorMessage:_e(o)}):r.jsx(l,{authConfigValues:t,children:r.jsxs(r.Fragment,{children:[r.jsx(Sr,{}),n]})})}function Lr(n){return new URL(n,`${window.location}`)}function Ir(){return new URLSearchParams(window.location.search).get("envoyPrefix")}function wr(){const n=Ir();return n!=null?{headers:{"envoy-prefix":n}}:{headers:{}}}function Tr({children:n}){return u.useContext(ks)?r.jsx(r.Fragment,{children:n}):r.jsx(Oe,{"data-testid":"fonts-loaded-loading"})}function jr({fontClassNames:n,pluginsUrl:i,serverUrl:e,children:t}){const s=u.useMemo(()=>wr(),[]),[o,a]=u.useState(0),l=u.useCallback(()=>{},[]),c=u.useCallback(()=>{a(d=>d+1)},[]);return ct(l,c),r.jsx(Ka,{fontClassNames:n,children:r.jsx(xr,{pluginsUrl:i,children:r.jsx(On,{serverUrl:e,options:s,children:r.jsx(Ts,{children:r.jsx(Er,{children:r.jsx(Oi,{children:r.jsx(Tr,{children:t})})})})},o)})})}function Pr(){return kn(Xt,"No Plugins available in usePlugins. Was code wrapped in PluginsBootstrap or PluginsContext.Provider?")}export{jr as AppBootstrap,Er as AuthBootstrap,Oi as ConnectionBootstrap,$r as ConnectionContext,Ka as FontBootstrap,Tr as FontsLoaded,ks as FontsLoadedContext,xr as PluginsBootstrap,Xt as PluginsContext,dr as RemoteComponent,Cr as getAuthHandlers,vr as getAuthPluginComponent,Lr as getBaseUrl,wr as getConnectOptions,Ir as getEnvoyPrefix,Rr as loadComponentPlugin,gr as loadJson,fr as loadModulePlugin,br as loadModulePlugins,_r as useConnection,Pr as usePlugins};
9
- //# sourceMappingURL=index-bc9b0636.js.map
8
+ `,o))},[]);return u.useEffect(()=>(e.current&&clearTimeout(e.current),n&&(e.current=setTimeout(()=>{i(!1)},Wi)),()=>{e.current&&clearTimeout(e.current)}),[n]),[n,t]}function qi(n){n.preventDefault()}function zi(n=!1){const i=u.useMemo(()=>`useSubmitButtonRef-${pe()}`,[]),e=u.useCallback(o=>{o==null||o.UNSAFE_getDOMNode().setAttribute("form",i)},[i]),t=u.useMemo(()=>({id:i,onSubmit:n?void 0:qi}),[i,n]),s=u.useMemo(()=>({form:i,ref:e}),[i,e]);return{formProps:t,submitButtonProps:s}}function Un(n,i,{autoLoad:e=!0}={}){const[t,s]=u.useState(null),[o,a]=u.useState(null),[l,c]=u.useState(!1),d=u.useCallback(async()=>{c(!0);try{const h=await n(...i);s(h),a(null)}catch(h){s(null),a(h)}finally{c(!1)}},[n,...i]);return u.useEffect(()=>{e&&d()},[e,d]),{data:t,error:o,isError:o!=null,isLoading:l,reload:d}}function $n(n,i){const[e,t]=u.useState(n);return u.useEffect(()=>{const s=setTimeout(()=>{t(n)},i);return()=>{clearTimeout(s)}},[n,i]),e}const Zi=Object.freeze(Object.defineProperty({__proto__:null,useContextOrThrow:kn,useCopyToClipboard:Fn,useDebouncedValue:$n,useFormWithDetachedSubmitButton:zi,useForwardedRef:Lt,usePrevious:Rt,usePromiseFactory:Un},Symbol.toStringTag,{value:"Module"}));function Xi({blockInteraction:n=!0,children:i,debounceMs:e,isOpen:t=!1}){const s=$n(t,e);return r.jsxs(r.Fragment,{children:[n&&t&&r.jsx("div",{className:"modal-backdrop",style:{backgroundColor:"transparent"},"data-testid":"debounced-modal-backdrop"}),T.cloneElement(i,{isOpen:t&&s})]})}function Ji({className:n,icon:i,isOpen:e=!1,subtitle:t,title:s}){return r.jsx(kt,{isOpen:e,className:n,children:r.jsx(Dt,{children:r.jsxs("div",{className:"info-modal",children:[i!=null&&r.jsx("div",{className:"message-icon",children:r.jsx(Z,{icon:i})}),r.jsx("div",{className:"message-header",children:s}),t!=null&&r.jsx("div",{className:"message-content",children:t})]})})})}function _n({className:n="modal-footer",children:i,"data-testid":e}){return r.jsx("div",{className:n,"data-testid":e,children:i})}function Pt(n){const{isOpen:i,headerText:e,bodyText:t,onCancel:s,onConfirm:o,onDiscard:a,onModalDisable:l,cancelButtonText:c="Cancel",confirmButtonText:d="Okay",discardButtonText:h="Discard",isConfirmDanger:m=!1,children:g,"data-testid":b}=n,S=u.useRef(null),E=u.useRef(null),x=u.useCallback(()=>{E.current!==null&&E.current.checked&&l&&l(),o()},[o,l]),P=u.useCallback(()=>{var C;(C=S.current)==null||C.focus()},[]);let U="";return i&&(U=typeof t=="function"?t():t),r.jsxs(kt,{isOpen:i,className:"theme-bg-light",onOpened:P,children:[r.jsx(In,{closeButton:!1,children:e}),r.jsx(Dt,{children:U}),r.jsxs(_n,{children:[l&&r.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[r.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:E,"data-testid":b!==void 0?`${b}-checkbox-confirm`:void 0}),r.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),a&&r.jsx(ee,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:a,"data-testid":b!==void 0?`${b}-btn-discard`:void 0,children:h}),s&&r.jsx(ee,{kind:"secondary","data-dismiss":"modal",onClick:s,"data-testid":b!==void 0?`${b}-btn-cancel`:void 0,children:c}),r.jsxs(Be,{children:[r.jsx(ee,{kind:m?"danger":"primary",onClick:x,ref:S,"data-testid":b!==void 0?`${b}-btn-confirm`:void 0,children:d}),g]})]})]})}Pt.propTypes={isOpen:f.bool.isRequired,headerText:f.string.isRequired,bodyText:f.oneOfType([f.string,f.func]).isRequired,onCancel:f.func,onConfirm:f.func.isRequired,onDiscard:f.func,onModalDisable:f.func,cancelButtonText:f.string,confirmButtonText:f.string,discardButtonText:f.string,children:f.node,"data-testid":f.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 nt=T.forwardRef((n,i)=>{const{children:e,className:t,disabled:s,onClick:o,style:a,id:l}=n;return r.jsx("button",{ref:i,type:"button",className:I("btn",t),onClick:o,style:a,disabled:s,id:l,children:e})});nt.displayName="Button";nt.propTypes={children:f.node,className:f.string,disabled:f.bool,onClick:f.func,style:f.shape({}),id:f.string};nt.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Qi=nt;function Yi({className:n,isFlipped:i,children:e,"data-testid":t}){const s=c=>{if(e.length!==2)throw new Error("CardFlip requires 2 children to function");return e[c]},o=u.useRef(null),a=u.useCallback(c=>{c.target===c.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),l=u.useCallback(c=>{c.target===c.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return u.useEffect(function(){if(!o.current)throw Error("ref undefined");o.current.addEventListener("transitionstart",a);const d=o.current;return function(){if(d!=null)return d.removeEventListener("transitionstart",a)}},[a]),r.jsxs("div",{className:I(n,{"card-flip--show-front":i,"card-flip--show-back":!i}),"data-testid":t,children:[r.jsx("div",{className:"card-flip--back",children:s(0)}),r.jsx("div",{ref:o,className:"card-flip--front",onTransitionEnd:l,children:s(1)})]})}const sn=F.module("GlobalContextAction");class eo extends u.Component{constructor(i){super(i),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(i){const e=i;e.contextActions==null&&(e.contextActions=[]);const{action:t}=this.props;t.title==null&&!t.menuElement||(e.contextActions==null&&(e.contextActions=[]),e.contextActions.push(t),sn.debug("Received context menu event at global action! Menu items are now: ",e.contextActions))}handleKeyDown(i){var t;const{action:e}=this.props;!z.actionsDisabled&&e.shortcut!==void 0&&e.shortcut.matchesEvent(i)&&(sn.debug("Global hotkey matched!",i),(t=e.action)==null||t.call(e,i),i.preventDefault(),i.stopPropagation())}render(){return null}}const to=eo;class no extends u.Component{render(){const{actions:i,"data-testid":e}=this.props,t=[];for(let s=0;s<i.length;s+=1){const o=i[s],{shortcut:a}=o;if(o.title!=null||o.menuElement||a){const l=r.jsx(to,{action:o,"data-testid":e},`${o.title}.${a==null?void 0:a.id}`);t.push(l)}}return t}}const so=no;const He=F.module("ContextActions");class Vn extends u.Component{constructor(e){super(e);p(this,"container");this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=T.createRef(),this.state={globalActions:[],keyboardActions:[]}}static triggerMenu(e,t,s,o){if(o.length===0)return;const a=new MouseEvent("contextmenu",{clientX:t,clientY:s,bubbles:!0,cancelable:!0});a.contextActions=o,e.dispatchEvent(a)}static getDerivedStateFromProps(e){if(e.actions==null||!Array.isArray(e.actions))return{globalActions:[],keyboardActions:[]};const t=e.actions.filter(o=>!pt(o)&&typeof o!="function"&&o.isGlobal),s=e.actions.filter(o=>!pt(o)&&typeof o!="function"&&(o.isGlobal===void 0||!o.isGlobal)&&o.shortcut!=null);return{globalActions:t,keyboardActions:s}}componentDidMount(){var e;(e=this.container.current)!=null&&e.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){var e;(e=this.container.current)!=null&&e.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}handleContextMenu(e){const{ignoreClassNames:t=[]}=this.props;if(t.length>0){let o=e.target;for(;o!=null;){const{classList:a}=o,l=t.find(c=>a.contains(c));if(l!==void 0){He.debug2(`Contextmenu event ignored based on the target className "${l}"`);return}o=o.parentElement}}if(z.isContextActionEvent(e)||(e.contextActions=[]),!z.isContextActionEvent(e))return;const{actions:s}=this.props;if(s!=null){let o=s;Array.isArray(o)&&(o=o.filter(a=>pt(a)||typeof a=="function"||a.isGlobal===void 0||!a.isGlobal)),e.contextActions=e.contextActions.concat(o)}He.debug("Received context menu event! Menu items are now: ",e.contextActions)}handleKeyDown(e){var s;const{keyboardActions:t}=this.state;for(let o=0;o<t.length;o+=1){const a=t[o];!z.actionsDisabled&&a.shortcut!=null&&a.shortcut.matchesEvent(e)&&(He.debug("Context hotkey matched!",e),(s=a.action)==null||s.call(a,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 r.jsx("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:r.jsx(so,{actions:t})})}}p(Vn,"groups",{default:null,high:100,medium:5e3,low:1e4,global:1e5,edit:100});const io=Vn,ue=class extends u.Component{static handleEnter(i){const e=i;e.style.height="0"}static handleEntering(i){const e=i;e.style.height=`${ue.getHeight(e)}px`}static handleExiting(i){const e=i;e.style.height="0"}static handleExit(i){const e=i;e.style.height=`${ue.getHeight(e)}px`}static getHeight(i){const e=i.scrollWidth-i.clientWidth;return i.scrollHeight-e}constructor(i){super(i),this.handleEntered=this.handleEntered.bind(this)}handleEntered(i){const e=i;e.style.height="";const{autoFocusOnShow:t}=this.props;if(t!==void 0&&t){const s=e.querySelector("input, select, textarea");s!=null&&s.focus()}}render(){const{children:i,className:e,in:t,"data-testid":s}=this.props;return r.jsx(ve,{in:t,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:ue.handleEnter,onEntering:ue.handleEntering,onEntered:this.handleEntered,onExit:ue.handleExit,onExiting:ue.handleExiting,timeout:350,children:o=>r.jsx("div",{className:I({collapse:o==="exited"},e),"data-testid":s,children:i})})}};let Pe=ue;p(Pe,"propTypes",{className:f.string,in:f.bool.isRequired,children:f.node.isRequired,autoFocusOnShow:f.bool,"data-testid":f.string}),p(Pe,"defaultProps",{className:"",autoFocusOnShow:!1,"data-testid":void 0});const oo=Pe,st=T.forwardRef((n,i)=>{const{checked:e=!1,children:t,className:s,disabled:o,inputClassName:a,isInvalid:l,labelClassName:c,name:d,onChange:h,"data-testid":m}=n,[g]=u.useState(pe()),b=Lt(i);u.useEffect(function(){b.current&&(b.current.indeterminate=e===null)},[b,e]);const S=u.useCallback(E=>{b.current&&(b.current.indeterminate=e===null),h&&h(E)},[b,e,h]);return r.jsxs("div",{className:I("custom-control custom-checkbox",s),children:[r.jsx("input",{type:"checkbox",ref:b,checked:e??!1,className:I("custom-control-input",a,{"is-invalid":l}),disabled:o,id:g,name:d,onChange:S,"data-testid":m}),r.jsx("label",{className:I("custom-control-label",c),htmlFor:g,children:t})]})});st.displayName="Checkbox";st.propTypes={checked:(n,i)=>{const{[i]:e}=n;return e!==null&&typeof e!="boolean"?new Error("Checked must be a boolean or null for indeterminate"):null},children:f.node.isRequired,className:f.string,disabled:f.bool,inputClassName:f.string,isInvalid:f.bool,labelClassName:f.string,name:f.string,onChange:f.func,"data-testid":f.string};st.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const Je=st;class Bn extends u.PureComponent{constructor(e){super(e);p(this,"inputField");this.inputField=T.createRef()}focus(){var e;(e=this.inputField.current)==null||e.focus()}render(){const{value:e,placeholder:t,onBlur:s,onChange:o,className:a,disabled:l,matchCount:c,id:d,onKeyDown:h,"data-testid":m}=this.props;return r.jsxs("div",{className:I("search-group",a),children:[r.jsx("input",{type:"search",value:e,onBlur:s,onChange:o,onKeyDown:h,className:"form-control",disabled:l,placeholder:t,ref:this.inputField,id:d,"data-testid":m}),c!=null&&r.jsx("span",{className:"search-match",children:c}),r.jsx("span",{className:"search-icon",children:r.jsx(Z,{icon:ni})})]})}}p(Bn,"defaultProps",{placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0});const it=Bn;var Hn=(n=>(n.UP="UP",n.DOWN="DOWN",n))(Hn||{});const Ne=class extends u.Component{constructor(e){super(e);p(this,"popper");p(this,"cbContainer");p(this,"toggleButton");p(this,"menuContainer");p(this,"input");p(this,"searchInput");p(this,"getCachedFilteredOptions",Y((e,t)=>e.filter(s=>s.title.toLowerCase().indexOf(t.toLowerCase())>=0||s.value.toLowerCase().indexOf(t.toLowerCase())>=0)));this.state={value:"",filter:"",filteredOptions:e.options,keyboardOptionIndex:-1,menuIsOpen:!1,inputWidth:100},this.toggleMenu=this.toggleMenu.bind(this),this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.handleMenuBlur=this.handleMenuBlur.bind(this),this.closeMenu=this.closeMenu.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputBlur=this.handleInputBlur.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleOptionFocus=this.handleOptionFocus.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=T.createRef(),this.cbContainer=T.createRef(),this.toggleButton=T.createRef(),this.menuContainer=T.createRef(),this.input=T.createRef(),this.searchInput=T.createRef()}componentDidUpdate(){const{menuIsOpen:e,keyboardOptionIndex:t}=this.state;e&&t>=0&&this.scrollOptionIntoView()}setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}focus(){var e;(e=this.input.current)==null||e.focus()}resetValue(){this.setState({value:""})}updateInputValue(e){const{onChange:t}=this.props;this.setState({value:e}),t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var c,d;const{filter:t,filteredOptions:s,keyboardOptionIndex:o}=this.state,{options:a}=this.props,l=t?s:a;switch(e.key){case"Enter":((c=l[o])==null?void 0:c.value)!=null&&this.updateInputValue(l[o].value),this.closeMenu(),(d=this.input.current)==null||d.focus(),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(Ne.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(Ne.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":t!==""?(this.setState({filter:""}),e.stopPropagation()):this.closeMenu();break;case"Tab":!e.shiftKey&&o===l.length-1&&this.closeMenu();break}}handleMenuNavigation(e){const{filter:t,filteredOptions:s,keyboardOptionIndex:o}=this.state,{options:a}=this.props,c=(t?s:a).length;let d=0;switch(e){case Ne.MENU_NAVIGATION_DIRECTION.UP:d=-1;break;case Ne.MENU_NAVIGATION_DIRECTION.DOWN:d=1;break}d!==0&&this.setState({keyboardOptionIndex:(o+d+c)%c})}handleInputKeyDown(e){const{onEnter:t}=this.props,{menuIsOpen:s}=this.state;e.key==="ArrowDown"||e.key==="ArrowUp"?s||this.openMenu():e.key==="Enter"&&t()}handleInputChange(e){this.updateInputValue(e.target.value)}handleOptionClick(e){var c;const t=Number(e.currentTarget.value),{filter:s,filteredOptions:o}=this.state,{options:a}=this.props,l=s?o:a;this.updateInputValue(l[t].value),this.closeMenu(),(c=this.input.current)==null||c.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleFilterChange(e){var a;const{options:t}=this.props,s=e.target.value,o=this.getCachedFilteredOptions(t,s);this.setState({filter:s,filteredOptions:o,keyboardOptionIndex:0}),(a=this.popper.current)==null||a.scheduleUpdate()}handleMenuBlur(e){e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||e.relatedTarget===this.toggleButton.current||this.closeMenu(!1)}handleInputBlur(e){const{menuIsOpen:t}=this.state;t&&e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){var e;this.scrollOptionIntoView(),(e=this.searchInput.current)==null||e.focus()}handleMenuExited(){var t;const{menuIsOpen:e}=this.state;e&&(this.setState({menuIsOpen:!1}),(t=this.popper.current)==null||t.hide()),this.setState({filter:""})}toggleMenu(e){const{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{var e;(e=this.popper.current)==null||e.show()})}closeMenu(e=!0){var t,s;this.setState({menuIsOpen:!1}),e&&((t=this.input.current)==null||t.focus()),(s=this.popper.current)==null||s.hide()}updateKeyboardIndex(){const{value:e,filter:t,filteredOptions:s}=this.state,{options:o}=this.props,l=(t?s:o).findIndex(c=>c.value===e);this.setState({keyboardOptionIndex:l})}scrollOptionIntoView(){var t;const e=(t=this.menuContainer.current)==null?void 0:t.querySelector(".cb-option-btn.keyboard-active");e instanceof HTMLElement&&e.scrollIntoView({block:"nearest",inline:"nearest"})}renderMenuElement(){const{searchPlaceholder:e}=this.props,{filter:t,inputWidth:s}=this.state;return r.jsxs("div",{className:"cb-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:o=>{o.stopPropagation()},style:{width:s},onBlur:this.handleMenuBlur,children:[r.jsx("div",{className:"cb-search-input-container",children:r.jsx(it,{value:t,ref:this.searchInput,onChange:this.handleFilterChange,className:"cb-search-input",placeholder:e})}),r.jsx("div",{className:"cb-options-container",children:r.jsx("div",{className:"cb-options",children:this.renderOptions()})})]})}renderOptions(){const{options:e}=this.props,{keyboardOptionIndex:t,filter:s,filteredOptions:o}=this.state;return(s?o:e).map((l,c)=>{const d=`option-${c}-${l.value}`;return r.jsx("button",{type:"button",value:c,className:I("cb-option-btn",{"keyboard-active":t===c}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:l.title},d)})}render(){const{options:e,inputPlaceholder:t,disabled:s,className:o,defaultValue:a,spellCheck:l,"data-testid":c}=this.props,{value:d}=this.state;let{popperOptions:h}=this.props;return h={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...h},r.jsxs("div",{className:"input-group cb-container",ref:this.cbContainer,children:[r.jsx("input",{value:d||a,className:I("form-control",o,"cb-input"),ref:this.input,onChange:this.handleInputChange,placeholder:t||(e[0]!=null?e[0].title:void 0),disabled:s,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:l,"data-testid":c!==void 0?`${c}-input`:void 0}),r.jsx("div",{className:"input-group-append cb-dropdown",children:r.jsxs("button",{type:"button",className:"btn cb-btn form-control",ref:this.toggleButton,onClick:this.toggleMenu,onKeyDown:this.handleInputKeyDown,disabled:s,"data-testid":c!==void 0?`${c}-btn`:void 0,children:[r.jsx(Z,{icon:si}),r.jsx(Ae,{ref:this.popper,options:h,className:I("combobox interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})})]})}};let ge=Ne;p(ge,"MENU_NAVIGATION_DIRECTION",Hn),p(ge,"DROP_DOWN_MENU_HEIGHT",200),p(ge,"propTypes",{options:f.arrayOf(f.shape({title:f.string.isRequired,value:f.string.isRequired})).isRequired,popperOptions:f.shape({title:f.string.isRequired,value:f.string.isRequired}),onChange:f.func,inputPlaceholder:f.string,searchPlaceholder:f.string,disabled:f.bool,className:f.string,defaultValue:f.string,spellCheck:f.bool,onEnter:f.func,"data-testid":f.string}),p(ge,"defaultProps",{onChange(){},inputPlaceholder:"",searchPlaceholder:"Search",disabled:!1,className:"",defaultValue:"",popperOptions:null,spellCheck:!0,onEnter(){},"data-testid":void 0});const ao=ge;function ro({copy:n,kind:i="ghost",tooltip:e="Copy",className:t,"data-testid":s,children:o}){const[a,l]=Fn();return r.jsx(ee,{kind:i,className:t,"data-testid":s,icon:a?ii:oi,tooltip:a?"Copied":e,onClick:()=>{l(typeof n=="function"?n():n)},children:o})}function ot(n,i,e){return n.substring(0,i)+e+n.substring(i+1)}function Kn(n,i,e){return n.length<e?`${n}${i.substring(n.length,e)}`:n}function yt(n,i){let{length:e}=n;for(let t=n.length-1;t>=0&&i[t]===n[t];t-=1)e=t;return n.substring(0,e)}const te=F.module("MaskedInput"),Se={FORWARD:"forward",BACKWARD:"backward",NONE:"none"},Ke=" ",Wn=T.forwardRef((n,i)=>{const{className:e,example:t,getNextSegmentValue:s=(N,M,v)=>v,getPreferredReplacementString:o=ot,onChange:a=()=>!1,onSelect:l=()=>!1,onSubmit:c,pattern:d,placeholder:h,selection:m,value:g,onFocus:b=()=>!1,onBlur:S=()=>!1,"data-testid":E}=n,x=Lt(i),P=u.useMemo(()=>Array.isArray(t)?t:[t],[t]),U=u.useMemo(()=>P[0].replace(/[a-zA-Z0-9]/g,Ke),[P]);u.useEffect(function(){var M;if(m!=null){te.debug("setting selection...",m);const{selectionStart:v,selectionEnd:L,selectionDirection:_}=m;(M=x.current)==null||M.setSelectionRange(v,L,_),te.debug("selection set!")}},[m,x]);const C=u.useCallback(N=>{let M=N,v=N;const L=P.length>0?P[0]:g;for(let y=M-1;y>=0&&/[a-zA-Z0-9]/g.test(L.charAt(y));y-=1)M=y;for(let y=v;y<L.length&&/[a-zA-Z0-9]/g.test(L.charAt(y));y+=1)v=y+1;const _=M===v?Se.NONE:Se.BACKWARD;return{selectionStart:M,selectionEnd:v,selectionDirection:_}},[P,g]);function k(N,M,v=N.length){let L="";for(let _=0;_<v;_+=1)N.charAt(_)!==Ke?L=L.concat(N[_]):L=L.concat(M[_]);return L=L.concat(M.substring(v)),L}function O(N,M=N.length){const v=new RegExp(`^${d}$`);if(v.test(N))return!0;for(let L=0;L<P.length;L+=1){const _=k(N,P[L],M);if(v.test(_))return!0}return!1}function w(N){const M=C(N),v=M.selectionEnd+1;return v>=g.length?M:C(v)}function R(N){const M=C(N),v=M.selectionStart-1;return v<=0?M:C(v)}function $(N,M){const v=C(N),L=g.substring(v.selectionStart,v.selectionEnd),_=s(v,M,L,g),y=g.substring(0,v.selectionStart)+_+g.substring(v.selectionEnd);O(y,v.selectionEnd)&&(a(y),l(v))}const J=u.useCallback(N=>{const{selectionStart:M=0,selectionEnd:v=0,selectionDirection:L="none"}=N.target;if(M===null||v===null||L===null){te.error("Selection attempted on non-text input element",N.target);return}if(te.debug2("handleSelect",M,v,L),!(m!=null&&M===m.selectionStart&&v===m.selectionEnd)){if(m!=null&&M===g.length&&v===g.length&&N.nativeEvent.type!=="mouseup"){l({...m});return}if(M===v){const _=C(M);te.debug("Selection segment from ",M,v,"=>",_),l(_)}else l({selectionStart:M,selectionEnd:v,selectionDirection:L})}},[C,l,m,g]),D=u.useCallback(N=>{if(!x.current)return;te.debug("handleSelectCapture",N);const M=x.current.selectionStart??0;M===g.length&&m!=null&&M!==m.selectionStart&&(N.preventDefault(),N.stopPropagation())},[x,m,g]);function A(N){if(N.preventDefault(),N.stopPropagation(),!x.current)return;const{key:M}=N,{selectionStart:v=0,selectionEnd:L=0}=x.current;if(v===null||L===null){te.error("Selection arrow nvaigation attempted on non-text input element",N.target);return}M==="ArrowLeft"?l(R(v)):M==="ArrowRight"?l(w(L)):M==="ArrowUp"?$(v,-1):M==="ArrowDown"&&$(v,1)}function B(N){if(!x.current)return;te.debug("handleKeyDown",N);const{key:M}=N,{selectionStart:v=0,selectionEnd:L=0}=x.current;if(v===null||L===null){te.error("Selection key event on non-text input element",N.target);return}if(M==="Enter"){c==null||c(N);return}if(M.startsWith("Arrow")){A(N);return}if(M==="Delete"||M==="Backspace"){if(N.preventDefault(),N.stopPropagation(),L>=yt(g,U).length){const y=g.substring(0,v===L?v-1:v),j=yt(y,U);j!==g&&(a(j),l({selectionStart:j.length,selectionEnd:j.length,selectionDirection:Se.NONE}));return}if(v!==L){const y=g.substring(0,v)+g.substring(v,L).replace(/[a-zA-Z0-9]/g,Ke)+g.substring(L);te.debug("Range ",v,L,"deleted, setting value",y),a(y),l({selectionStart:v,selectionEnd:v,selectionDirection:Se.NONE})}else if(v>0)for(let y=v-1;y>=0;y-=1){const j=g.substring(0,y)+g.substring(y,v).replace(/[a-zA-Z0-9]/g,Ke)+g.substring(v);if(j!==g){a(j),l({selectionStart:y,selectionEnd:y,selectionDirection:Se.NONE});return}}return}if(N.altKey||N.metaKey||N.ctrlKey||M.length>1)return;N.preventDefault(),N.stopPropagation();const _=Array.from(new Set([M,M.toUpperCase(),M.toLowerCase()]));for(let y=0;y<_.length;y+=1){const j=_[y],V=/[a-zA-Z0-9]/g.test(j)?P[0].length-1:v;for(let H=v;H<=V;H+=1){const xe=Kn(g,P[0],H+1),ut=o(xe,H,j,v,L);if(O(ut,H+1)){const Yt=C(H),dt=H+1;let ht={selectionStart:dt,selectionEnd:dt,selectionDirection:Se.NONE};if(dt>=Yt.selectionEnd){const en=w(H);en.selectionStart!==Yt.selectionStart&&(ht=en)}te.debug("handleKeyDown",M,"=>",ut,ht),a(ut),l(ht);return}}}}return r.jsx("input",{ref:x,className:I("form-control masked-input",e),type:"text",pattern:d,placeholder:h,value:g,onChange:()=>{},onKeyDown:B,onSelect:J,onSelectCapture:D,onFocus:b,onBlur:S,"data-testid":E})});Wn.defaultProps={className:"",placeholder:void 0,onChange(){},onSelect(){},getNextSegmentValue:(n,i,e)=>e,getPreferredReplacementString:ot,selection:void 0,onFocus(){},onBlur(){},"data-testid":void 0};const at=Wn,lo=F.module("TimeInput"),co="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",uo=["00:00:00","12:34:56","23:59:59"],Gn=T.forwardRef((n,i)=>{const{allowValueWrapping:e=!0,className:t="",onChange:s=()=>!1,value:o=0,onFocus:a=()=>!1,onBlur:l=()=>!1,onSelect:c=()=>!1,"data-testid":d}=n,[h,m]=u.useState(je.formatTime(o)),[g,b]=u.useState(),S=u.useRef(null);u.useImperativeHandle(i,()=>({focus:()=>{var C;(C=S.current)==null||C.focus()},setSelection:C=>{var k;(k=S.current)==null||k.focus(),b(C)}}),[]),u.useEffect(function(){m(je.formatTime(o))},[o]);function E(C,k,O){const w=C.selectionStart===0?24:60;let R=parseInt(O,10)-k;return Number.isNaN(R)?R=0:e?R=(R%w+w)%w:R=Math.min(Math.max(0,R),w-1),`${R}`.padStart(2,"0")}function x(C,k,O,w,R){return w===0&&R===2&&k===1&&parseInt(O,10)>1?`0${O}${C.substring(2)}`:ot(C,k,O)}function P(C){lo.debug("handleChange",C),m(C),je.isTimeString(C)&&s(je.parseTime(C))}const U=u.useCallback(C=>{b(C),c(C)},[c]);return r.jsx(at,{ref:S,className:t,example:uo,getNextSegmentValue:E,getPreferredReplacementString:x,onChange:P,onSelect:U,pattern:co,selection:g,value:h,onFocus:a,onBlur:l,"data-testid":d})});Gn.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const Qe=Gn;var Ct;let ho=(Ct=class extends u.PureComponent{constructor(e){super(e);p(this,"container");p(this,"oldFocus");p(this,"rAF");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=T.createRef(),this.oldFocus=document.activeElement,this.rAF=0;const{options:t}=e,s=t.initialKeyboardIndex??-1;this.state={menuItems:[],keyboardIndex:s,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.rAF=window.requestAnimationFrame(()=>{var t;(t=this.container.current)==null||t.focus();const{onMenuOpened:e}=this.props;e(this)})}componentDidUpdate(e){const{actions:t}=this.props;e.actions!==t&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}getKeyboardIndex(){const{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){const{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){const{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){const{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});const{actions:e}=this.props,t=z.getMenuItems(e,!1);t.length>0&&this.setState(s=>({menuItems:z.sortActions(s.menuItems.concat(t))}))}handleKeyDown(e){const{menuItems:t}=this.state,s=this.getKeyboardIndex();let o=s;if(e.key==="Enter"||e.key===" "){s!=null&&s>=0&&s<t.length&&this.handleMenuItemClick(t[s],e);return}e.key==="Escape"?o=null:e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0?o=z.getNextMenuItem(o??0,-1,t):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(o=z.getNextMenuItem(o??0,1,t)),s!==o&&(o!==null?this.setKeyboardIndex(o):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(e=!1){const{closeMenu:t,onMenuClosed:s}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),s(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,s=t.indexOf(e);this.setMouseIndex(s)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{"data-testid":t}=this.props,{keyboardIndex:s,menuItems:o,mouseIndex:a}=this.state;for(let c=0;c<o.length;c+=1){const d=o[c];c>0&&d.group!==o[c-1].group&&e.push(r.jsx("hr",{},`${c}.separator`));const h=r.jsx(Dn,{isKeyboardSelected:s===c,isMouseSelected:a===c,menuItem:d,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},c);e.push(h)}const{menuStyle:l}=this.props;return r.jsx("div",{className:"context-menu-container",style:{...l},ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}},p(Ct,"defaultProps",{closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0}),Ct);const po=ho;class qn extends u.PureComponent{constructor(e){super(e);p(this,"container");p(this,"parent");p(this,"popper");p(this,"isOpen");this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=T.createRef(),this.parent=null,this.popper=T.createRef(),this.isOpen=!1}componentDidMount(){var t;const{isShown:e}=this.props;e===null?(t=this.container.current)!=null&&t.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)}closeMenu(){var e;(e=this.popper.current)==null||e.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){var e;(e=this.popper.current)==null||e.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:s,"data-testid":o}=this.props,{menuStyle:a}=this.props;let{options:l,popperOptions:c}=this.props;return c={placement:"bottom",...c},l={separateKeyboardMouse:!0,...l},r.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":o,children:r.jsx(Ae,{ref:this.popper,options:c,className:I("menu-popper",s),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:r.jsx(po,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:l,menuStyle:a})})})}}p(qn,"defaultProps",{isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0});const zn=qn;const on=-1;var Zn=(n=>(n.UP="UP",n.DOWN="DOWN",n))(Zn||{});const se=class extends u.Component{constructor(e){super(e);p(this,"csContainer");p(this,"menuContainer");p(this,"button");p(this,"input");const{value:t,valueToTime:s}=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=T.createRef(),this.menuContainer=T.createRef(),this.button=T.createRef(),this.input=T.createRef(),this.state={keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,customTime:s(t),inputFocused:!1}}getSelectedText(){const{options:e,value:t,placeholder:s}=this.props,{customTime:o}=this.state;if(t===null)return s;for(let a=0;a<e.length;a+=1){const l=e[a];if(l.value===t)return l.title}return je.formatTime(o)}setInputWidth(){this.csContainer.current&&this.setState({inputWidth:this.csContainer.current.getBoundingClientRect().width})}focus(){var e;(e=this.button.current)==null||e.focus()}updateInputValue(e){const{onChange:t}=this.props;t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var a;const{keyboardOptionIndex:t,inputFocused:s}=this.state,{options:o}=this.props;switch(e.key){case"Enter":case" ":s?this.updateFromCustom():this.updateInputValue(o[t].value),this.closeMenu(),(a=this.button.current)==null||a.focus(),e.stopPropagation(),e.preventDefault();break;case"Tab":e.shiftKey?this.handleMenuNavigation(se.MENU_NAVIGATION_DIRECTION.UP):this.handleMenuNavigation(se.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(se.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(se.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":this.closeMenu();break}}handleMenuNavigation(e){const{keyboardOptionIndex:t,inputFocused:s}=this.state,{options:o}=this.props,a=o.length;let l=t;switch(e){case se.MENU_NAVIGATION_DIRECTION.UP:if(!s&&t===0){this.focusInput();break}else s&&this.focusOption(t);t>0&&!s?(l=(l-1)%a,this.setState({keyboardOptionIndex:l})):t===0&&(l=a-1,this.setState({keyboardOptionIndex:l})),this.scrollOptionIntoView(l);break;case se.MENU_NAVIGATION_DIRECTION.DOWN:if(!s&&t===a-1){this.focusInput();break}else s&&this.focusOption(t);t<a&&!(s&&t===0)&&(l=(l+1)%a,this.setState({keyboardOptionIndex:l})),this.scrollOptionIntoView(l);break}}handleOptionClick(e){const t=Number(e.currentTarget.value),{options:s,timeToValue:o}=this.props,{customTime:a}=this.state;if(t===on){const l=o(a);this.updateAndClose(l)}else this.updateAndClose(s[t].value)}updateAndClose(e){var t;this.updateInputValue(e),this.closeMenu(),(t=this.button.current)==null||t.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleMenuOpened(){var l;const{options:e,value:t}=this.props,{keyboardOptionIndex:s}=this.state;this.scrollOptionIntoView(s);const o=(l=this.menuContainer.current)==null?void 0:l.querySelector(".cs-option-btn.keyboard-active");if(o instanceof HTMLElement&&o.focus(),t===null)return;e.map(c=>c.value).indexOf(t)<0&&this.focusInput()}focusInput(){var e;(e=this.input.current)==null||e.focus()}focusOption(e){var s;const t=(s=this.menuContainer.current)==null?void 0:s.querySelector(".cs-options");if(t&&t.children!=null){const o=t.children.item(e);o instanceof HTMLElement&&o.focus()}}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}handleCustomInput(e){const{timeToValue:t}=this.props,s=t(e);this.updateInputValue(s),this.setState({customTime:e})}updateFromCustom(){const{timeToValue:e}=this.props,{customTime:t}=this.state,s=e(t);this.updateInputValue(s)}toggleMenu(e){const{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0})}closeMenu(e=!0){var t;this.setState({menuIsOpen:!1}),e&&((t=this.button.current)==null||t.focus())}updateKeyboardIndex(){const{options:e,value:t}=this.props;if(t===null)return;const s=e.map(o=>o.value).indexOf(t);s>0&&this.setState({keyboardOptionIndex:s})}scrollOptionIntoView(e){var s;const t=(s=this.menuContainer.current)==null?void 0:s.querySelector(".cs-options");if(t&&t.children!=null){const o=t.children.item(e);o instanceof HTMLElement&&o.offsetTop>se.DROP_DOWN_MENU_HEIGHT?t.scrollTop=o.offsetTop-se.DROP_DOWN_MENU_HEIGHT:(o instanceof HTMLElement&&o.offsetTop<0||e===0)&&(t.scrollTop=0)}}renderMenuElement(){const{inputWidth:e}=this.state;return r.jsx("div",{className:"cs-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:t=>{t.stopPropagation()},style:{width:e},children:r.jsx("div",{className:"cs-options-container",children:r.jsx("div",{className:"cs-options",children:this.renderOptions()})})})}renderOptions(){const{options:e,value:t,icon:s,customText:o}=this.props,{keyboardOptionIndex:a,customTime:l,inputFocused:c}=this.state;let d=!1;const h=[];for(let m=0;m<e.length;m+=1){const g=e[m],b=`option-${m}-${g.value}`;d=d||g.value===t,h.push(r.jsxs("button",{type:"button",value:m,className:I("cs-option-btn",{"keyboard-active":a===m&&!c}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[g.value===t&&r.jsx(Z,{icon:s,className:"mr-2"}),g.value!==t&&r.jsx("span",{className:"mr-4"}),g.title]},b))}return h.push(r.jsx("hr",{className:"cs-divider"},"option-divider")),h.push(r.jsxs("button",{type:"button",value:on,className:I("cs-option-btn",{"keyboard-active":c}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!d&&t!==null?r.jsx(Z,{icon:s,className:"mr-2"}):r.jsx("span",{className:"mr-4"}),o]},"option-custom-label")),h.push(r.jsxs("div",{className:"cs-custom-container",children:[r.jsx("span",{className:"mr-2"}),r.jsx(Qe,{ref:this.input,onChange:this.handleCustomInput,value:l,onFocus:()=>this.setState({inputFocused:!0}),onBlur:()=>this.setState({inputFocused:!1})},"option-input"),r.jsx("span",{className:"ml-2"})]},"cs-custom-container")),h.push(r.jsx("hr",{className:"mb-2"},"option-end")),h}render(){const{disabled:e,invalid:t,value:s,"data-testid":o}=this.props,{menuIsOpen:a}=this.state;let{popperOptions:l}=this.props;return l={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...l},r.jsx("div",{className:"input-group cs-container context-menu",ref:this.csContainer,"data-testid":o,children:r.jsx("div",{className:I("input-group-append cs-dropdown",{"cs-dropdown-invalid":t}),children:r.jsxs("button",{type:"button",className:I("btn cs-btn form-control",{"cs-btn-invalid":t}),ref:this.button,onClick:this.toggleMenu,disabled:e,children:[r.jsx("span",{className:I({"text-muted":s===null}),children:this.getSelectedText()}),r.jsx("span",{children:r.jsx(Z,{icon:wn,className:"cs-caret"})}),r.jsx(zn,{isShown:a,actions:{menuElement:this.renderMenuElement()},popperOptions:l,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}};let Ie=se;p(Ie,"MENU_NAVIGATION_DIRECTION",Zn),p(Ie,"DROP_DOWN_MENU_HEIGHT",125),p(Ie,"defaultProps",{onChange(){},value:null,disabled:!1,popperOptions:{},icon:ai,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});const mo=Ie;function ye(n,i,e,t,s){const o=t-e+1;return`${((parseInt(i,10)-n-e)%o+o)%o+e}`.padStart(s,"0")}function Xn(n,i,e){const{selectionStart:t}=n;return t===0?ye(i,e,1900,2099,4):t===5?ye(i,e,1,12,2):t===8?ye(i,e,1,31,2):t===11?ye(i,e,0,23,2):t===17||t===14?ye(i,e,0,59,2):t===20||t===24||t===28?ye(i,e,0,999,3):e}function Et(n){const i=n.substring(0,23),e=n.substring(23,26),t=n.substring(26);return[i,e,t].filter(s=>s!=="").join("​")}const fo=F.module("DateTimeInput"),go="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",bo="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\\.[0-9]{3}​[0-9]{3}​[0-9]{3}",Co=`${go} ${bo}`,qe="2022-01-01",Jn=`${qe} 00:00:00.000000000`,vo="YYYY-MM-DD HH:MM:SS.SSSSSSSSS";function an(n){return n!=null&&n.length>=qe.length?`${n.substring(0,qe.length)}${n.substring(qe.length).replace(/\u2007/g,"0")}${Jn.substring(n.length)}`:n}function rn(n){return n.replace(/\u200B/g,"")}const xo=[Et(Jn)],Ft=T.forwardRef((n,i)=>{const{className:e="",onChange:t=()=>{},defaultValue:s="",onFocus:o=()=>{},onBlur:a=()=>{},onSubmit:l,"data-testid":c}=n,[d,h]=u.useState(s.length>0?Et(s):""),[m,g]=u.useState(),b=u.useCallback(E=>{fo.debug("handleChange",E),h(E),t(an(rn(E)))},[t]),S=u.useCallback(()=>{const E=rn(d),x=an(E);x!==E&&h(Et(x)),a()},[d,a]);return r.jsx("div",{className:"d-flex flex-row align-items-center",children:r.jsx(at,{ref:i,className:I(e),example:xo,getNextSegmentValue:Xn,onChange:b,onSelect:g,onSubmit:l,pattern:Co,placeholder:vo,selection:m,value:d,onFocus:o,onBlur:S,"data-testid":c})})});Ft.displayName="DateTimeInput";Ft.defaultProps={className:"",onChange:()=>{},defaultValue:"",onFocus:()=>{},onBlur:()=>{},"data-testid":void 0};const So=Ft,yo=F.module("DateInput"),Eo="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",Io=["2000-01-01","2022-12-31"],wo="YYYY-MM-DD",Ut=T.forwardRef((n,i)=>{const{className:e="",onChange:t=()=>{},defaultValue:s="",onFocus:o=()=>{},onBlur:a=()=>{},"data-testid":l}=n,[c,d]=u.useState(s),[h,m]=u.useState(),g=u.useCallback(b=>{yo.debug("handleChange",b),d(b),t(b)},[t]);return r.jsx("div",{className:"d-flex flex-row align-items-center",children:r.jsx(at,{ref:i,className:I(e),example:Io,getNextSegmentValue:Xn,onChange:g,onSelect:m,pattern:Eo,placeholder:wo,selection:h,value:c,onFocus:o,onBlur:a,"data-testid":l})})});Ut.displayName="DateInput";Ut.defaultProps={className:"",onChange:()=>!1,defaultValue:"",onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const To=Ut;class Qn extends u.PureComponent{constructor(e){super(e);p(this,"searchInput");this.searchInput=T.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=$e(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})}focus(){var e;(e=this.searchInput.current)==null||e.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:s,id:o,"data-testid":a}=this.props,{value:l}=this.state;return r.jsx(it,{value:l,placeholder:e,onChange:this.handleChange,className:t,matchCount:s,ref:this.searchInput,id:o,"data-testid":a})}}p(Qn,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});const Mo=Qn;const No=F.module("ItemListItem"),Qt=class extends u.Component{constructor(e){super(e);p(this,"itemRef");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=T.createRef()}static handleKeyDown(){return No.log("ItemListItem.handleKeyDown false"),!1}handleBlur(e){const{itemIndex:t,onBlur:s}=this.props;s(t,e)}handleFocus(e){const{itemIndex:t,onFocus:s}=this.props;s(t,e)}handleClick(e){const{itemIndex:t,onClick:s}=this.props;s(t,e)}handleContextMenu(e){const{itemIndex:t,onContextMenu:s}=this.props;s(t,e)}handleDragStart(e){const{itemIndex:t,onDragStart:s}=this.props;s(t,e)}handleDrag(e){const{itemIndex:t,onDrag:s}=this.props;s(t,e)}handleDragOver(e){e.preventDefault();const{itemIndex:t,onDragOver:s}=this.props;s(t,e)}handleDragEnd(e){const{itemIndex:t,onDragEnd:s}=this.props;s(t,e)}handleDrop(e){const{itemIndex:t,onDrop:s}=this.props;s(t,e)}handleDoubleClick(e){const{itemIndex:t,onDoubleClick:s}=this.props;s(t,e)}handleMouseMove(e){const{itemIndex:t,onMouseMove:s}=this.props;s(t,e)}handleMouseDown(e){const{itemIndex:t,onMouseDown:s}=this.props;s(t,e)}handleMouseUp(e){const{itemIndex:t,onMouseUp:s}=this.props;s(t,e)}render(){const{isDraggable:e,isFocused:t,isSelected:s,style:o,children:a,"data-testid":l}=this.props;return r.jsx("div",{className:I("item-list-item",{active:s},{"is-focused":t},{"is-draggable":e}),onKeyDown:Qt.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:o,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:e,"data-testid":l,children:a})}};let ze=Qt;p(ze,"defaultProps",{children:null,isDraggable:!1,isFocused:!1,isSelected:!1,itemIndex:0,"data-testid":void 0,onBlur(){},onClick(){},onContextMenu(){},onDragStart(){},onDrag(){},onDragOver(){},onDragEnd(){},onDrop(){},onDoubleClick(){},onFocus(){},onMouseDown(){},onMouseMove(){},onMouseUp(){},style:{}});const Yn=ze;const ln=F.module("ItemList"),cn=5,Ce=class extends u.PureComponent{constructor(e){super(e);p(this,"list");p(this,"listContainer");p(this,"getItemSelected",Y((e,t)=>ie.isSelected(t,e),{max:Ce.CACHE_SIZE}));p(this,"getCachedItem",Y((e,t,s,o,a,l,c,d)=>{const h=l({item:s,itemIndex:e,isFocused:o,isSelected:a,style:c});return r.jsx(Yn,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:d,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:o,isSelected:a,itemIndex:e,style:c,children:h},t)},{max:Ce.CACHE_SIZE}));p(this,"getOuterElement",Y(e=>{const t=T.forwardRef((s,o)=>r.jsx("div",{ref:o,tabIndex:-1,onKeyDown:e,role:"presentation",...s}));return t.displayName="ItemListOuterElement",t}));p(this,"getInnerElement",Y(()=>{const e=T.forwardRef((t,s)=>r.jsx("div",{className:"item-list-inner-element",ref:s,...t}));return e.displayName="ItemListInnerElement",e}));p(this,"getItemData",Y((e,t,s)=>({items:e,selectedRanges:t,renderItem:s})));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=T.createRef(),this.listContainer=T.createRef();const{isStickyBottom:t,selectedRanges:s}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:s,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null,mouseX:null,mouseY:null}}static renderItem({item:e}){return r.jsx("div",{className:"item-list-item-content",children:e!=null&&(e.displayValue??e.value??`${e}`)})}componentDidUpdate(e,t){const{selectedRanges:s,itemCount:o}=this.props,{focusIndex:a,isStuckToBottom:l,scrollOffset:c,height:d,selectedRanges:h}=this.state;if(l&&!this.isListAtBottom()&&o>0&&this.scrollToBottom(),(c!==t.scrollOffset||d!==t.height)&&this.sendViewportUpdate(),s!==e.selectedRanges&&s!==h)this.setSelectedRanges(s);else if(h!==t.selectedRanges){const{onSelectionChange:m}=this.props;m(h)}if(a!==t.focusIndex){const{onFocusChange:m}=this.props;m(a)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var e;(e=this.listContainer.current)==null||e.focus()}restoreScrollPosition(){var t;const{scrollOffset:e}=this.state;e!=null&&((t=this.listContainer.current)==null||t.scrollTo(0,e))}getElement(e){if(this.listContainer.current==null)return null;const{focusSelector:t}=this.props,{overscanStartIndex:s}=this.state,o=this.listContainer.current.querySelectorAll(t),a=e-s;return o[a]}focusItem(e){const{disableSelect:t}=this.props;if(t)return;this.setState({focusIndex:e});const s=this.getElement(e);s instanceof HTMLElement&&s.focus()}scrollToItem(e){const t=this.getElement(e);t!=null&&t.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){const{selectedRanges:s}=this.state,a=ie.isSelected(s,e)||z.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,a,!1)}handleItemDoubleClick(e,t){const{isDoubleClickSelect:s,onSelect:o}=this.props;s&&this.setState(({selectedRanges:a})=>({selectedRanges:ie.selectRange(a,[e,e])}),()=>{o(e,t)})}handleItemMouseDown(e,t){const{selectedRanges:s}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&s.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){ln.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){ln.debug2("item focus",e,t.target),this.setState(s=>{const{focusIndex:o}=s;return o!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){const{isDragSelect:s,isMultiSelect:o,disableSelect:a}=this.props,{mouseDownIndex:l,selectedRanges:c,mouseX:d,mouseY:h}=this.state;if(l==null||a)return;const m=Math.abs(t.clientX-(d??0)),g=Math.abs(t.clientY-(h??0));m>cn&&g>cn&&this.setState({isDragging:!0}),(s||l===e)&&(this.focusItem(e),o?(!s&&!this.getItemSelected(e,c)&&!z.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(l,e),Math.max(l,e)])):this.toggleSelect(e,t.shiftKey,z.isModifierKeyDown(t),!1))}handleItemMouseUp(e,t){const{isDeselectOnClick:s,isDoubleClickSelect:o,onSelect:a}=this.props,{mouseDownIndex:l,isDragging:c}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(l===e&&!c){const d=t.shiftKey,h=z.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,d,h,s),!o&&!d&&!h&&a(e,t)}this.resetMouseState()}}handleItemsRendered({overscanStartIndex:e}){this.setState({overscanStartIndex:e})}handleResize({height:e}){this.setState({height:e})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(e){var c;const{isMultiSelect:t,itemCount:s,onSelect:o}=this.props,{focusIndex:a}=this.state;let l=a;if(e.key==="Enter"||e.key===" "){!t&&l!=null&&this.setState({selectedRanges:[[l,l]]},()=>{l!=null&&o(l,e)});return}if(e.key==="ArrowUp")l!=null&&l>=0?l=Math.max(0,l-1):l=s-1;else if(e.key==="ArrowDown")l!=null&&l>=0?l=Math.min(l+1,s-1):l=0;else return;if(a!==l){e.stopPropagation(),e.preventDefault(),this.focusItem(l);const{selectedRanges:d}=this.state;if(e.shiftKey&&d.length>0){const h=d[d.length-1];this.selectRange([Math.min(l,h[0]),Math.max(l,h[1])])}else this.deselectAll(),l!==null?this.selectItem(l):(c=this.listContainer.current)==null||c.focus();this.scrollIntoView(l)}}handleScroll({scrollUpdateWasRequested:e,scrollOffset:t}){this.setState(s=>{if(e)return{scrollOffset:t};const{isStickyBottom:o}=this.props,{height:a}=s;return{isStuckToBottom:o&&this.isListAtBottom({scrollOffset:t,height:a}),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,s,o=!0){const{isMultiSelect:a}=this.props,{selectedRanges:l}=this.state;if(a&&t&&l.length>0){const c=l[l.length-1];this.selectRange([Math.min(c[0],e),Math.max(e,c[1])])}else a&&l.length===1&&l[0][0]===e&&l[0][1]===e?o&&this.deselectItem(e):a&&s?this.getItemSelected(e,l)?o&&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){ie.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:ie.deselectRange(t,e)}))}selectItem(e){const{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){ie.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:ie.selectRange(t,e)}))}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){const{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){const{onViewportChange:s,rowHeight:o}=this.props,a=Math.floor(e/o),l=a+Math.ceil(t/o);s(a,l)}}isListAtBottom({scrollOffset:e,height:t}=this.state){if(t==null||e==null)return!1;const{itemCount:s,rowHeight:o}=this.props;return e+t>=s*o}renderInnerElement({index:e,style:t}){const{items:s,offset:o,renderItem:a,disableSelect:l}=this.props,{focusIndex:c,selectedRanges:d}=this.state;if(e<o||e>=o+s.length)return null;const h=s[e-o];return this.getCachedItem(e,e,h,e===c&&!l,this.getItemSelected(e,d),a,t,l)}render(){const{items:e,itemCount:t,overscanCount:s,renderItem:o,rowHeight:a,"data-testid":l}=this.props,{selectedRanges:c,isStuckToBottom:d}=this.state;return r.jsx(Hs,{className:"item-list-auto-sizer",onResize:this.handleResize,children:({width:h,height:m})=>r.jsx(Ks,{className:"item-list-scroll-pane",height:m,width:h,initialScrollOffset:d?t*a:0,itemCount:t,itemSize:a,itemData:this.getItemData(e,c,o),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:s,"data-testid":l,children:this.renderInnerElement})})}};let ne=Ce;p(ne,"CACHE_SIZE",1e3),p(ne,"DEFAULT_ROW_HEIGHT",20),p(ne,"DEFAULT_OVERSCAN",10),p(ne,"defaultProps",{offset:0,items:[],rowHeight:Ce.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Ce.DEFAULT_OVERSCAN,renderItem:Ce.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0});const de=class extends u.PureComponent{constructor(e){super(e);p(this,"itemList");p(this,"getCachedDraggableItem",Y((e,t,s,o,a,l,c,d)=>r.jsx(Ws,{draggableId:de.getDraggableId(e,o),index:o,isDragDisabled:c,children:h=>r.jsx("div",{role:"menuitem",className:"draggable-item-list-item",ref:h.innerRef,tabIndex:-1,...h.draggableProps,...h.dragHandleProps,children:t({item:s,itemIndex:o,isFocused:a,isSelected:l,style:d,isClone:!1})})},o),{max:ne.CACHE_SIZE}));p(this,"getCachedRenderDraggableItem",Y((e,t,s)=>({item:o,itemIndex:a,isFocused:l,isSelected:c,style:d})=>this.getCachedDraggableItem(e,s,o,a,l,c,t,d),{max:1}));p(this,"getCachedRenderClone",Y((e,t,s,o)=>(a,l,c)=>{const{selectedCount:d}=this.state,{draggableProps:h,dragHandleProps:m,innerRef:g}=a,{index:b}=c.source,S=t[b-s];return r.jsx("div",{className:I("draggable-item-list-dragging-item-container",e),...h,...m,ref:g,children:r.jsx("div",{className:I("draggable-item-list-dragging-item",{"two-dragged":d===2},{"multiple-dragged":d>2}),children:o({item:S,itemIndex:b,isFocused:!1,isSelected:!0,style:{},isClone:!0,selectedCount:d})})})},{max:1}));this.handleSelectionChange=this.handleSelectionChange.bind(this),this.itemList=T.createRef(),this.state={selectedCount:0}}static renderHandle(){return r.jsxs("div",{children:[r.jsx(Ot,{children:"Drag to re-order"}),r.jsx(Z,{icon:ri})]})}static renderBadge({text:e}){return e!=null&&e.length>0?r.jsx("span",{className:"number-badge",children:e}):null}static renderTextItem({text:e,badgeText:t="",className:s=""}){return r.jsxs("div",{className:I("item-list-item-content","draggable-item-list-item-content",s),children:[r.jsx("span",{className:"title",children:e}),de.renderBadge({text:t}),de.renderHandle()]})}static renderItem({item:e,isClone:t,selectedCount:s}){const o=e!=null?e.displayValue??e.value??`${e}`:"",a=t!==void 0&&t?`${s}`:"",l=t!==void 0&&t?"item-list-item-clone":"";return de.renderTextItem({text:o,badgeText:a,className:l})}static getDraggableId(e,t){return`${e}/${t}`}static getDraggableIndex(e){const t=e.split("/").pop();return parseInt(t!==void 0?t:"",10)}selectItem(e){var t;(t=this.itemList.current)==null||t.selectItem(e)}focusItem(e){var t;(t=this.itemList.current)==null||t.focusItem(e)}scrollToItem(e){var t;(t=this.itemList.current)==null||t.scrollToItem(e)}handleSelectionChange(e){this.setState({selectedCount:ie.count(e)});const{onSelectionChange:t}=this.props;t(e)}render(){const{className:e,draggablePrefix:t,draggingItemClassName:s,droppableId:o,isDoubleClickSelect:a,isDragDisabled:l,isDropDisabled:c,isMultiSelect:d,isStickyBottom:h,itemCount:m,items:g,offset:b,onFocusChange:S,onSelect:E,onViewportChange:x,renderItem:P,rowHeight:U,selectedRanges:C,style:k,"data-testid":O}=this.props;return r.jsx(Gs,{isDropDisabled:c,droppableId:o,mode:"virtual",renderClone:this.getCachedRenderClone(s,g,b,P),"data-testid":O,children:(w,R)=>r.jsx("div",{role:"menu",className:I("draggable-item-list",e,{"is-drop-disabled":c,"is-drag-disabled":l,"is-dragging-from-this":R.draggingFromThisWith,"is-dragging-over":R.isDraggingOver,"is-dropping":R.draggingOverWith}),style:k,ref:w.innerRef,...w.droppableProps,children:r.jsx(ne,{focusSelector:".draggable-item-list-item",isDoubleClickSelect:a,isDragSelect:!1,isMultiSelect:d,isStickyBottom:h,itemCount:m,items:g,onFocusChange:S,onSelect:E,onSelectionChange:this.handleSelectionChange,onViewportChange:x,offset:b,ref:this.itemList,renderItem:this.getCachedRenderDraggableItem(t,l,P),rowHeight:U,selectedRanges:C})})})}};let Fe=de;p(Fe,"DEFAULT_ROW_HEIGHT",30),p(Fe,"defaultProps",{className:"",draggingItemClassName:"",offset:0,items:[],rowHeight:de.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!0,isDropDisabled:!1,isDragDisabled:!1,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,style:null,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},renderItem:de.renderItem,selectedRanges:[],draggablePrefix:"draggable-item",droppableId:"droppable-item-list","data-testid":void 0});const ko=Fe;class Ye{static reorder(i,e,t,s){const o=i===t?Ye.adjustDestinationIndex(s,e):s,a=Ye.removeItems(i,e);return t.splice(o,0,...a),a}static removeItems(i,e){const t=[],s=e.map((o,a)=>({range:o,index:a})).sort((o,a)=>a.range[0]-o.range[0]);for(let o=0;o<s.length;o+=1){const{range:a,index:l}=s[o],[c,d]=a;t[l]=i.splice(c,d-c+1)}return qs(t)}static adjustDestinationIndex(i,e){let t=i;for(let s=0;s<e.length;s+=1){const[o,a]=e[s];if(o>i)break;t-=Math.min(a,i-1)-o+1}return t}static startDragging(){document.documentElement.classList.add("drag-pointer-events-none")}static stopDragging(){document.documentElement.classList.remove("drag-pointer-events-none")}}const Do=Ye;function Oo(n){const{isInvalid:i=!1,items:e,onAdd:t=()=>{},onDelete:s=()=>{},validate:o=()=>null}=n,[a,l]=u.useState(null),[c,d]=u.useState([]),[h,m]=u.useState(""),g=u.useCallback(C=>{d(C)},[]),b=u.useCallback(()=>{s(ie.getItemsInRanges(e,c)),d([])},[e,c,s]),S=u.useCallback(()=>{if(h==="")return;const C=o(h);C==null?(t(h),m("")):l(C)},[h,t,o]),E=u.useCallback(C=>{const{value:k}=C.target;m(k),l(k===""?null:o(k))},[o]),x=u.useCallback(()=>{d([])},[]),P=u.useCallback(C=>{C.key==="Enter"&&S()},[S]),U=u.useMemo(()=>14+vt(e.length,1,6)*ne.DEFAULT_ROW_HEIGHT,[e.length]);return r.jsxs("div",{className:I("editable-item-list-container",{"is-invalid":i}),children:[r.jsx("div",{style:{height:U},children:r.jsx(ne,{itemCount:e.length,items:e.map((C,k)=>({value:C,isSelected:ie.isSelected(c,k)})),offset:0,selectedRanges:c,onSelectionChange:g,isMultiSelect:!0})}),r.jsxs("div",{className:"d-flex flex-row pt-2",children:[r.jsx("div",{className:"d-flex flex-grow-1",children:r.jsx("input",{className:I("form-control",{"is-invalid":a!=null}),placeholder:"Enter value",type:"text",value:h,onChange:E,onFocus:x,onKeyDown:P})}),r.jsxs("div",{className:"d-flex align-items-start mt-1 ml-2",children:[r.jsx(ee,{kind:"ghost",onClick:S,disabled:a!=null||h==="",icon:li,tooltip:"Add new item","data-testid":"add-item-button"}),r.jsx(ee,{kind:"ghost",onClick:b,disabled:c.length===0,icon:ci,tooltip:"Delete selected items","data-testid":"delete-item-button"})]})]})]})}const Ue=class extends u.Component{static isParentSelected(i,e){const t=e.get(i);if(t===void 0)return!1;if(typeof t=="boolean")return t;const s=Array.from(t.values()).includes(!0),o=Array.from(t.values()).includes(!1);return s&&o?null:s}constructor(i){super(i),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(i){i.stopPropagation(),i.preventDefault(),this.setState(e=>{const{menuIsOpen:t}=e;return{menuIsOpen:!t}})}toggleValueFor(i,e){const{valueMap:t,onUpdateValueMap:s}=this.props,o=new Map(t),a=o.get(i);if(a instanceof Map){const c=new Map(a);if(e!=null)c.set(e,a.get(e)===void 0);else{const d=Ue.isParentSelected(i,o),h=d==null||!d;a.forEach((m,g)=>c.set(g,h))}o.set(i,c)}else o.set(i,a==null||!a);const l=o.get(i);if(e===void 0&&l!==void 0&&typeof l!="boolean"){const c=Ue.isParentSelected(i,t);c!=null&&c?l.forEach((d,h)=>l.set(h,!1)):l.forEach((d,h)=>l.set(h,!0))}s(o)}setAllValues(i){const{valueMap:e,onUpdateValueMap:t}=this.props,s=new Map;e.forEach((o,a)=>{if(typeof o=="boolean")s.set(a,i);else{const l=new Map;o.forEach((c,d)=>l.set(d,i)),s.set(a,l)}}),t(s)}selectAll(){this.setAllValues(!0)}clear(){this.setAllValues(!1)}renderMenuElement(){const{valueMap:i,"data-testid":e}=this.props;return r.jsxs("div",{className:"hcm-menu-container",children:[Array.from(i.entries()).map(([t,s])=>r.jsxs("div",{children:[r.jsx(Je,{className:"hcm-parent",checked:Ue.isParentSelected(t,i),onChange:()=>this.toggleValueFor(t),children:t}),s!==void 0&&typeof s!="boolean"&&Array.from(s.entries()).map(([o,a])=>r.jsx(Je,{className:"hcm-child",checked:a,onChange:()=>this.toggleValueFor(t,o),children:o},o))]},t)),r.jsx(ee,{kind:"ghost",onClick:this.selectAll,"data-testid":e!==void 0?`${e}-btn-select-all`:void 0,children:"Select All"}),r.jsx(ee,{kind:"ghost",onClick:this.clear,"data-testid":e!==void 0?`${e}-btn-clear`:void 0,children:"Clear"})]})}render(){const{menuText:i,className:e,icon:t,id:s,"data-testid":o}=this.props,{menuIsOpen:a}=this.state;return r.jsxs("button",{type:"button",className:I("btn hcm-btn",e),onClick:this.toggleMenu,id:s,"data-testid":o,children:[r.jsxs("span",{children:[t&&r.jsx(Z,{icon:t,className:"hcm-icon mr-1"}),i]}),r.jsx(Z,{icon:wn,className:"hcm-icon ml-1"}),r.jsx(Ae,{options:{placement:"bottom"},isShown:a,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}};let Ze=Ue;p(Ze,"defaultProps",{className:"",icon:null,id:"","data-testid":void 0});const Ao=Ze;function es({on:n,id:i,className:e,isInvalid:t,disabled:s=!1,onClick:o,"data-testid":a}){return r.jsx("button",{type:"button",className:I("btn","btn-switch",e,{active:n},{"is-invalid":t}),id:i,onClick:o,disabled:s,"data-testid":a,children:r.jsx("div",{className:"handle"})})}function un(n){return n.isOn!==void 0}function ts({item:n,onSelect:i=()=>{},"data-testid":e}){const{icon:t,subtitle:s,title:o}=n,a=u.useMemo(()=>un(n)?()=>{n.onChange(!n.isOn)}:i,[n,i]);return r.jsxs("div",{className:"btn btn-navigation-menu-item","data-testid":`menu-item-${o}`,onClick:a,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&a()},tabIndex:0,role:"menuitem",children:[t!==void 0&&r.jsx("div",{className:"icon",children:r.jsx(Z,{icon:t})}),r.jsx("div",{className:"title",children:o}),s!==void 0&&r.jsx("div",{className:"shortcut",children:s}),r.jsx("div",{className:"accessory","data-testid":e,children:un(n)?r.jsx(es,{on:n.isOn,onClick:l=>{l.stopPropagation(),a()}}):r.jsx(Z,{icon:ui})})]})}function Ro({items:n,onSelect:i=()=>{},"data-testid":e}){return r.jsx("div",{className:"navigation-menu-view","data-testid":e,children:r.jsx("ul",{className:"navigation-menu-list",children:n.map((t,s)=>r.jsx("li",{children:r.jsx(ts,{item:t,onSelect:()=>{i(s)}})},t.title))})})}function Lo({children:n,onBack:i,onClose:e,title:t,"data-testid":s}){return r.jsxs("div",{className:"navigation-page","data-testid":s,children:[r.jsxs("div",{className:"navigation-title-bar",children:[r.jsx("div",{className:"navigation-left-buttons",children:i!==void 0&&r.jsx(ee,{kind:"ghost",className:"btn-back","data-testid":"btn-page-back",onClick:i,icon:di,children:"Back"})}),r.jsx("div",{className:"navigation-title",children:t}),r.jsx("div",{className:"navigation-right-buttons",children:e!==void 0&&r.jsx(ee,{kind:"ghost",className:"btn-close px-2 m-1","data-testid":"btn-page-close",onClick:e,icon:Tn,tooltip:"Close"})})]}),r.jsx("div",{className:"navigation-content",children:n})]})}function jo({children:n,"data-testid":i}){const e=u.useMemo(()=>T.Children.toArray(n),[n]),t=Rt(e),[s,o]=u.useState(e[e.length-1]),[a,l]=u.useState(null),[c,d]=u.useState(null);u.useEffect(function(){if(t===void 0||e===t)return;const b=e[e.length-1];e.length===t.length||t.length===0||a!==null||c!==null?a!==null&&b!==a?l(b):b!==c&&b!==s&&o(b):e.length>t.length?l(b):e.length<t.length&&(o(b),d(t[t.length-1]))},[e,t,a,c,s]);const h=u.useCallback(()=>{o(a),l(null)},[a]),m=u.useCallback(()=>{d(null)},[]);return r.jsxs("div",{className:"navigation-stack",children:[r.jsx("div",{className:"main-view","data-testid":i,children:s}),r.jsx(ve,{in:c!=null,timeout:oe.transitionMidMs,classNames:"slide-right",onEntered:m,children:r.jsx(r.Fragment,{children:c!=null&&r.jsx("div",{className:"popping-view",children:c})})}),r.jsx(ve,{in:a!=null,timeout:oe.transitionMidMs,classNames:"slide-left",onEntered:h,children:r.jsx(r.Fragment,{children:a!=null&&r.jsx("div",{className:"pushing-view",children:a})})})]})}function Po({children:n,disabled:i,value:e,"data-testid":t}){return r.jsx("option",{value:e,disabled:i,"data-testid":t,children:n})}function Fo(n){const{children:i,disabled:e=!1,name:t,onChange:s,value:o="","data-testid":a}=n,[l]=u.useState(t??pe());return r.jsx(r.Fragment,{children:T.Children.map(i,c=>c?T.cloneElement(c,{name:l,onChange:c.props.onChange??s,checked:o===c.props.value,disabled:c.props.disabled??e,"data-testid":a}):null)})}const $t=T.forwardRef((n,i)=>{const{checked:e,children:t,className:s="",disabled:o=!1,inputClassName:a="",isInvalid:l=!1,labelClassName:c="",name:d,onChange:h,value:m,"data-testid":g}=n,[b]=u.useState(pe());return r.jsxs("div",{className:I("custom-control custom-radio",s),children:[r.jsx("input",{type:"radio",id:b,"data-testid":g,name:d,ref:i,className:I("custom-control-input",a,{"is-invalid":l}),checked:e,disabled:o,value:m,onChange:h}),r.jsx("label",{className:I("custom-control-label",c),htmlFor:b,children:t})]})});$t.displayName="RadioItem";$t.defaultProps={checked:void 0,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const Uo=$t;const $o=.025,_o=.9,Vo=.1,Bo=.618,mt=oe["primary-dark"],dn=80,Ho=oe["gray-800"],Ko=oe["gray-900"],fe={SIZE:8,DOT_SIZE:2,FILL_OPACITY:.25},le=18,Wo=250,Go=60*1e3,qo=T.memo(()=>{const n=u.useRef(null),i=u.useRef(null),[e,t]=u.useState(!1),s=window.devicePixelRatio;let o,a,l,c,d,h=null,m=[];function g(){i.current!=null&&(l=i.current.offsetWidth,c=i.current.offsetHeight),n.current!=null&&(n.current.style.width=`${l}px`,n.current.style.height=`${c}px`,n.current.width=l*s,n.current.height=c*s),o==null||o.scale(s,s)}function b(){const D=document.createElement("canvas");D.width=fe.SIZE,D.height=fe.SIZE;const A=D.getContext("2d");return A!=null&&(A.fillStyle=mt,A.fillRect(0,0,fe.DOT_SIZE,fe.DOT_SIZE),A.fillStyle=mt+Math.round(255*fe.FILL_OPACITY).toString(16).padStart(2,"0"),A.fillRect(0,0,fe.SIZE,fe.SIZE)),A==null?void 0:A.createPattern(D,"repeat")}function S(D){const A=Math.random()-.5;let B=$o*A;return D<Vo?B=Math.abs(B):D>_o&&(B=-Math.abs(B)),D+B}function E(){const D=[];let A=Bo;for(let B=0;B<l+le;B+=1)A=S(A),D.push(A);return D}function x(){for(;m.length>=l+le;)m.pop();for(;m.length<l+le;)m.push(S(m[m.length-1]))}function P(D,A){A.beginPath(),A.moveTo(-1,c+1),A.lineTo(-1,c*D[0]);for(let B=0;B<D.length;B+=1)A.lineTo(B,c*D[B]);A.lineTo(l+le,c*D[D.length-1]),A.lineTo(l+le,c+1),A.closePath()}function U(D){D.beginPath();for(let A=1;A<l;A+=dn)D.moveTo(A,0),D.lineTo(A,c);for(let A=1;A<c;A+=dn)D.moveTo(0,A),D.lineTo(l,A)}function C(D){h=h??D,fi(o),o.fillStyle=Ko,o.fillRect(0,0,l,c),U(o),o.lineWidth=1,o.strokeStyle=Ho,o.stroke();const A=((h??0)-(D??0))/(1e3/le);if(o.translate(A,0),P(m,o),o.lineWidth=2,o.strokeStyle=mt,o.stroke(),o.translate(-A,0),a!=null&&(o.fillStyle=a),o.fill(),o.setTransform(s,0,0,s,0,0),(D??0)-(h??0)>1e3/le){const B=Math.floor(((D??0)-(h??0))/(1e3/le));for(let N=0;N<B;N+=1)m.shift(),m.push(S(m[m.length-1]));h=D}d!=null&&cancelAnimationFrame(d),d=requestAnimationFrame(C)}const k=$e(()=>{d=requestAnimationFrame(D=>{g(),x(),t(!1),C(D)})},Wo,{leading:!0});function O(){t(!0),d!=null&&cancelAnimationFrame(d),d=null,h=null}const w=$e(()=>{O()},Go);function R(){d==null&&(t(!1),g(),x(),d=requestAnimationFrame(C)),w()}function $(){document.hasFocus()&&R()}function J(){d!=null&&cancelAnimationFrame(d),w(),k()}return u.useEffect(()=>{var D;return o=(D=n.current)==null?void 0:D.getContext("2d",{alpha:!1}),g(),m=E(),a=b(),C(),w(),window.addEventListener("resize",J),window.addEventListener("focus",R),window.addEventListener("blur",O),window.addEventListener("mousemove",$),window.addEventListener("keydown",$),()=>{d!=null&&cancelAnimationFrame(d),window.removeEventListener("resize",J),window.removeEventListener("focus",R),window.removeEventListener("blur",O),window.removeEventListener("mousemove",$),window.removeEventListener("keydown",$),w.cancel(),k.cancel()}},[]),r.jsx("div",{className:"random-area-plot-animation-container",ref:i,children:r.jsx("canvas",{ref:n,className:e?"shade":""})})}),ns=qo;function zo({children:n,onBlur:i,onChange:e,className:t,defaultValue:s,name:o,value:a,disabled:l,"data-testid":c}){const d=u.useCallback(h=>{e(h.target.value)},[e]);return r.jsx("select",{className:I("custom-select",t),onBlur:i,onChange:d,defaultValue:s,value:a,name:o,disabled:l,"data-testid":c,children:n})}class ss extends u.PureComponent{constructor(e){super(e);p(this,"list");p(this,"topRow");p(this,"bottomRow");p(this,"getCachedItem",Y((e,t,s,o,a,l,c)=>{const d={height:a},h=o??s;return r.jsx("li",{className:"value-list-item",style:d,tabIndex:-1,children:r.jsx(Je,{checked:l,disabled:c,onChange:()=>this.handleSelect(e),children:h})},t)},{max:1e3}));p(this,"getCachedItems",Y((e,t,s,o)=>{const a=[];for(let l=0;l<e.length;l+=1){const c=e[l],{value:d,displayValue:h,isSelected:m}=c,g=s+l,b=g,S=this.getCachedItem(g,b,d,h,t,m,o);a.push(S)}return a},{max:1}));this.handleBlur=this.handleBlur.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleSelect=this.handleSelect.bind(this),this.list=T.createRef(),this.topRow=null,this.bottomRow=null}componentDidMount(){this.sendViewportUpdate()}componentDidUpdate(){this.sendViewportUpdate()}handleBlur(e){if(!e.relatedTarget||this.list.current&&e.relatedTarget instanceof HTMLElement&&!this.list.current.contains(e.relatedTarget)){const{onBlur:t}=this.props;t==null||t(e)}}handleScroll(){this.sendViewportUpdate()}handleSelect(e){const{items:t,offset:s,onSelect:o}=this.props,a=e-s;if(a>=0&&a<t.length){const l=t[a],{value:c}=l;o(e,c)}else o(e,null)}sendViewportUpdate(){if(!this.list.current||this.list.current.clientHeight===0)return;const{onViewportChange:e,rowHeight:t}=this.props,s=this.list.current.scrollTop,o=s+this.list.current.clientHeight,a=Math.floor(s/t),l=Math.ceil(o/t);(this.topRow!==a||this.bottomRow!==l)&&(this.topRow=a,this.bottomRow=l,e(a,l))}getElement(e){return this.list.current==null?null:this.list.current.querySelectorAll(".value-list-item")[e]}scrollIntoView(e){const t=this.getElement(e);t==null||t.scrollIntoView({block:"center"})}render(){const{className:e,disabled:t,isInvalid:s,items:o,itemCount:a,offset:l,rowHeight:c,"data-testid":d}=this.props,h=this.getCachedItems(o,c,l,t);return r.jsx("div",{className:I("select-value-list-scroll-pane h-100 w-100",{"is-invalid":s},e),onBlur:this.handleBlur,onScroll:this.handleScroll,ref:this.list,"data-testid":d,children:r.jsx("div",{className:"select-value-list",style:{height:a*c},children:r.jsx("ol",{className:"select-value-list-content",style:{position:"absolute",height:o.length*c,top:l*c,left:0},children:h})})})}}p(ss,"defaultProps",{disabled:!1,rowHeight:21,onBlur:()=>{},"data-testid":void 0});const is=ss,hn=F.module("Shortcut");var Q=(n=>(n.CTRL="MODIFIER_CTRL",n.CMD="MODIFIER_CMD",n.ALT="MODIFIER_ALT",n.OPTION="MODIFIER_OPTION",n.SHIFT="MODIFIER_SHIFT",n))(Q||{}),G=(n=>(n.A="A",n.B="B",n.C="C",n.D="D",n.E="E",n.F="F",n.G="G",n.H="H",n.I="I",n.J="J",n.K="K",n.L="L",n.M="M",n.N="N",n.O="O",n.P="P",n.Q="Q",n.R="R",n.S="S",n.T="T",n.U="U",n.V="V",n.W="W",n.X="X",n.Y="Y",n.Z="Z",n.ZERO="0",n.ONE="1",n.TWO="2",n.THREE="3",n.FOUR="4",n.FIVE="5",n.SIX="6",n.SEVEN="7",n.EIGHT="8",n.NINE="9",n.BACKSPACE="Backspace",n.ESCAPE="Escape",n.ENTER="Enter",n.DELETE="Delete",n.SLASH="/",n.QUESTION_MARK="?",n.BACKSLASH="\\",n.PIPE="|",n.MINUS="-",n.UNDERSCORE="_",n.EQUALS="=",n.PLUS="+",n.BACKTICK="`",n.TILDE="~",n.COMMA=",",n.LEFT_CHEVRON="<",n.PERIOD=".",n.RIGHT_CHEVRON=">",n.SEMICOLON=";",n.COLON=":",n.SINGLE_QUOTE="'",n.DOUBLE_QUOTE='"',n.LEFT_BRACKET="[",n.RIGHT_BRACKET="]",n.LEFT_CURLY="{",n.RIGHT_CURLY="}",n.F1="F1",n.F2="F2",n.F3="F3",n.F4="F4",n.F5="F5",n.F6="F6",n.F7="F7",n.F8="F8",n.F9="F9",n.F10="F10",n.F11="F11",n.F12="F12",n))(G||{});const Zo=new Set(["Enter","Delete","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),K=class extends Nt{constructor({id:e,shortcut:t,macShortcut:s,isEditable:o=!0,name:a,tooltip:l}){super();p(this,"id");p(this,"name");p(this,"tooltip");p(this,"isEditable");p(this,"defaultKeyState");p(this,"keyState");this.id=e,this.name=a,this.tooltip=l,this.isEditable=o;const d=K.isMacPlatform?s:t;this.defaultKeyState=K.createKeyState(d),this.keyState=this.defaultKeyState}static isAllowedKey(e){return Object.values(G).includes(e)}static isValidKeyState(e){const{keyValue:t}=e;return t===null?!0:!K.isMacPlatform&&e.metaKey||!K.isAllowedKey(t)?!1:!(!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey)||Zo.has(t)}static createKeyState(e){const t={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:e[e.length-1]};return e.forEach(s=>{switch(s){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:s}=e;let o="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?o="":!K.isAllowedKey(t)&&K.isAllowedKey(String.fromCharCode(s))?o=String.fromCharCode(s):o=t,{keyValue:o,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){var s,o;return((s=e.keyValue)==null?void 0:s.toUpperCase())===((o=t.keyValue)==null?void 0:o.toUpperCase())&&e.altKey===t.altKey&&e.ctrlKey===t.ctrlKey&&e.metaKey===t.metaKey&&e.shiftKey===t.shiftKey}static getDisplayText(e){return e.keyValue===null?"":K.isMacPlatform?K.getMacDisplayText(e):K.getWindowsDisplayText(e)}getDisplayText(){return K.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){K.isValidKeyState(e)?(hn.debug2(`Shortcut ${this.id} updated to ${JSON.stringify(e)}`),this.keyState=e,this.dispatchEvent(new Pn("onUpdate",{detail:this}))):hn.debug2(`Shortcut ${this.id} tried to update to invalid keyState ${JSON.stringify(e)}`)}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return K.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(K.NULL_KEY_STATE)}isNull(){return K.doKeyStatesMatch(this.keyState,K.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return K.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(K.getKeyStateFromEvent(e))}};let we=K;p(we,"NULL_KEY_STATE",{metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null}),p(we,"isMacPlatform",z.isMacPlatform());const pn=F.module("ShortcutRegistry");class Xo extends Nt{constructor(){super(...arguments);p(this,"shortcutMap",new Map);p(this,"shortcutsByCategory",new Map)}createAndAdd(e){const t=new we(e);return this.add(t)}add(e){var o;const t=this.shortcutMap.get(e.id);if(t)return pn.warn(`Skipping attempt to add duplicate shortcut ID to registry: ${e.id}`),t;pn.debug2(`Adding shortcut to registry: ${e.id}`),e.addEventListener("onUpdate",({detail:a})=>this.dispatchEvent(new Pn("onUpdate",{detail:a})));const s=e.id.split(".")[0];return this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(s)?(o=this.shortcutsByCategory.get(s))==null||o.push(e):this.shortcutsByCategory.set(s,[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 Jo=Object.freeze(new Xo),be=Jo,Qo={COPY:be.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[Q.CTRL,G.C],macShortcut:[Q.CMD,G.C],isEditable:!1}),PASTE:be.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[Q.CTRL,G.V],macShortcut:[Q.CMD,G.V],isEditable:!1}),SAVE:be.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[Q.CTRL,G.S],macShortcut:[Q.CMD,G.S],isEditable:!1}),SELECT_ALL:be.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[Q.CTRL,G.A],macShortcut:[Q.CMD,G.A],isEditable:!1}),LINKER:be.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[Q.CTRL,G.L],macShortcut:[Q.CMD,G.L]}),LINKER_CLOSE:be.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[G.ESCAPE],macShortcut:[G.ESCAPE],isEditable:!1})},Yo=Qo;const _t=T.forwardRef((n,i)=>{const{children:e,className:t,disabled:s,id:o,isLinked:a,isLinkedSource:l,isInvalid:c,onClick:d,onMouseEnter:h,onMouseLeave:m,style:g,"data-testid":b}=n;return r.jsxs("button",{ref:i,type:"button",className:I("btn-socketed",{"btn-socketed-linked":a!==void 0&&a||l},{"btn-socketed-linked-source":l},{"is-invalid":c},t),id:o,onClick:d,onMouseEnter:h,onMouseLeave:m,style:g,disabled:s,"data-testid":b,children:[e,r.jsx(Z,{icon:hi,className:"linked btn-socketed-icon",transform:"down-1"}),r.jsx(Z,{icon:pi,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 ea=_t,ta={"dh-spectrum-theme--dark":"_dh-spectrum-theme--dark_i6xja_5"},na={"dh-spectrum-theme--light":"_dh-spectrum-theme--light_16vb7_5"},{global:sa,light:ia,dark:oa,medium:aa,large:ra}=zs,la={global:sa,light:{...ia,...na},dark:{...oa,...ta},medium:aa,large:ra},ca="_track_535ju_30",ua="_handle_535ju_13",da="_ticks_535ju_98",os={"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:ca,"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:ua,ticks:da,"tick-labels":"_tick-labels_535ju_116","tick-label":"_tick-label_535ju_116","tick-label-wrapper":"_tick-label-wrapper_535ju_132"};const We=parseInt(os["handle-size"],10),mn=parseInt(os["popover-width"],10),X=24*60*60-1,fn=5*60;function ha({startTime:n,endTime:i,onChange:e,isStartModified:t=!1,isEndModified:s=!1,"data-testid":o}){const[a,l]=u.useState(n),[c,d]=u.useState(i),h=u.useRef(null);u.useEffect(function(){l(n),d(i)},[n,i]);const m=u.useCallback((S,E)=>{let x=S,P=E;x===P&&(P<X?P+=1:x-=1),l(x),d(P),e({startTime:x,endTime:P})},[l,d,e]),g=u.useCallback(S=>{m(S,c)},[m,c]),b=u.useCallback(S=>{m(a,S)},[m,a]);return r.jsxs("div",{className:"time-slider","data-testid":o,children:[r.jsx(pa,{startTime:a,endTime:c,onStartTimeChange:g,onEndTimeChange:b,isStartModified:t,isEndModified:s}),r.jsxs("div",{className:"track",ref:h,children:[r.jsx(ma,{startTime:a,endTime:c}),r.jsx("div",{className:"ticks",children:Array(24).fill(null).map((S,E)=>r.jsx("div",{className:"tick"},E))}),r.jsx(gn,{track:h,time:a,setTime:g}),r.jsx(gn,{track:h,time:c,setTime:b})]}),r.jsxs("div",{className:"tick-labels",children:[r.jsx("div",{className:"tick-label",children:"0:00"}),r.jsx("div",{className:"tick-label-wrapper",children:Array(24).fill(null).map((S,E)=>r.jsx("div",{className:"tick-label",children:`${E+1}:00`},E))})]})]})}function pa(n){const{startTime:i,endTime:e,onStartTimeChange:t,onEndTimeChange:s,isStartModified:o,isEndModified:a,"data-testid":l}=n,c=i>e,[d,h]=u.useState(c?e:i),[m,g]=u.useState(c?i:e),b=u.useRef(null),S=u.useRef(null),E=u.useRef(null),x=u.useRef(null);u.useEffect(function(){h(i>e?e:i),g(i>e?i:e)},[i,e]),u.useEffect(function(){var w,R;E.current!==null&&((w=S.current)==null||w.setSelection(E.current)),x.current!==null&&((R=b.current)==null||R.setSelection(x.current))},[c]);function P(O){i<=e?t(O):s(O)}function U(O){i<=e?s(O):t(O)}const C=u.useCallback(O=>{E.current=O,x.current=null},[]),k=u.useCallback(O=>{E.current=null,x.current=O},[]);return r.jsxs("div",{className:"time-slider-popovers",children:[r.jsx("div",{className:"flex",style:{flexBasis:`calc(${d/X*100}% - ${mn/2}px)`}}),r.jsxs("div",{className:"handle-popper",children:[r.jsx("label",{className:I({modified:c?a:o}),children:c?"End Time":"Start Time"}),r.jsx(Qe,{ref:b,allowValueWrapping:!1,value:d,onChange:P,onSelect:C,"data-testid":l!==void 0?`${l}-input-1`:void 0})]}),r.jsx("div",{className:"flex-spacer"}),r.jsxs("div",{className:"handle-popper",children:[r.jsx("label",{className:I({modified:c?o:a}),children:c?"Start Time":"End Time"}),r.jsx(Qe,{ref:S,allowValueWrapping:!1,value:m,onChange:U,onSelect:k,"data-testid":l!==void 0?`${l}-input-2`:void 0})]}),r.jsx("div",{className:"flex",style:{flexBasis:`calc(${(X-m)/X*100}% - ${mn/2}px)`}})]})}function ma(n){const{startTime:i,endTime:e,"data-testid":t}=n;return r.jsxs("div",{className:"track-fills","data-testid":t,children:[i>e&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"track-fill track-fill-start",style:{transform:`scaleX(${e/X})`}}),r.jsx("div",{className:"track-fill track-fill-end",style:{transform:`scaleX(${(X-i)/X})`}})]}),i<e&&r.jsx("div",{className:"track-fill track-fill-middle",style:{transform:`translateX(${i/X*100}%) scaleX(${(e-i)/X})`}})]})}function gn(n){const{track:i,time:e,setTime:t,"data-testid":s}=n,o=u.useMemo(()=>{let b=We/2;return e<3600?b=e/3600*(We/2):e>23*3600&&(b=We/2+1/(X-23*3600)*(e-23*3600)*(We/2)),`translateX(calc(${e/X*100}% - ${b}px))`},[e]),a=u.useCallback(g=>{if(!i.current)return 0;const b=i.current.getBoundingClientRect(),S=Math.max(g-b.left,0),E=X*Math.min(1,S/b.width),x=fn*Math.round(E/fn);return Math.min(X,x)},[i]),l=u.useCallback(({clientX:g})=>{t(a(g))},[t,a]),c=u.useCallback(({clientX:g})=>{t(a(g)),window.removeEventListener("mousemove",l),window.removeEventListener("mouseup",c),document.documentElement.classList.remove("drag-pointer-events-none")},[t,a,l]),d=u.useCallback(()=>{window.addEventListener("mousemove",l),window.addEventListener("mouseup",c),document.documentElement.classList.add("drag-pointer-events-none")},[l,c]),h=u.useCallback(()=>{window.removeEventListener("mousemove",l),window.removeEventListener("mouseup",c),document.documentElement.classList.remove("drag-pointer-events-none")},[l,c]),m=u.useCallback(()=>{d()},[d]);return u.useEffect(function(){return()=>{h()}},[h]),r.jsx("div",{className:"handle-track",style:{transform:o},children:r.jsx("button",{className:"handle",type:"button","aria-label":"Change time",onMouseDown:m,"data-testid":s})})}function as({buttons:n,isShown:i=!1,classNames:e,message:t,type:s,onClick:o,onDismiss:a,"data-testid":l}){const c=n&&n.length!==0;return r.jsx(ve,{in:i,timeout:oe.transitionMs,classNames:"toast-notification-slide-up",mountOnEnter:!0,unmountOnExit:!0,children:r.jsxs("div",{className:I("toast-notification",e,s),role:"presentation",onClick:o,onKeyPress:o,"data-testid":l,children:[r.jsx("div",{className:"message-container",children:r.jsx("span",{className:"message",children:t})}),r.jsx(ve,{in:c,timeout:oe.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:r.jsx("div",{className:"buttons-container",children:n})}),a&&r.jsx(ee,{kind:"ghost",icon:Tn,tooltip:"Close notification",className:"my-2",onClick:a})]})})}as.TYPE=Object.freeze({ERROR:"error"});function fa(n){const{children:i,className:e,labelText:t,hintText:s,isModified:o,validationError:a,showValidationError:l=!0,"data-testid":c,id:d}=n,{current:h}=u.useRef(d??pe());return r.jsxs(r.Fragment,{children:[r.jsx("label",{className:I("validate-label",e,{modified:o}),htmlFor:h,"data-testid":c,children:t}),T.Children.toArray(i).map(m=>T.isValidElement(m)?T.cloneElement(m,{className:I(m.props.className,{"is-invalid":a})}):r.jsx("div",{className:I(e),children:m})),s!==void 0&&r.jsx("small",{className:"form-text text-muted",children:s}),a!==void 0&&l&&r.jsx("p",{className:"validate-label-error text-danger",children:a})]})}const ga=Object.freeze(Object.defineProperty({__proto__:null,AutoCompleteInput:Ui,AutoResizeTextarea:At,BasicModal:Pt,Button:ee,ButtonGroup:Be,ButtonOld:Qi,CardFlip:Yi,Checkbox:Je,Collapse:oo,ComboBox:ao,ContextActionUtils:z,ContextActions:io,ContextMenuItem:Dn,ContextMenuRoot:gi,CopyButton:ro,CustomTimeSelect:mo,DEFAULT_GET_PREFERRED_REPLACEMENT_STRING:ot,DateInput:To,DateTimeInput:So,DebouncedModal:Xi,DebouncedSearchInput:Mo,DragUtils:Do,DraggableItemList:ko,DropdownMenu:zn,EditableItemList:Oo,GLOBAL_SHORTCUTS:Yo,HierarchicalCheckboxMenu:Ao,InfoModal:Ji,ItemList:ne,ItemListItem:Yn,KEY:G,LoadingOverlay:Oe,LoadingSpinner:Mn,MODIFIER:Q,MaskedInput:at,Menu:Ro,MenuItem:ts,Modal:kt,ModalBody:Dt,ModalFooter:_n,ModalHeader:In,Option:Po,Page:Lo,Popper:Ae,RadioGroup:Fo,RadioItem:Uo,RandomAreaPlotAnimation:ns,SearchInput:it,Select:zo,SelectValueList:is,Shortcut:we,ShortcutRegistry:be,SocketedButton:ea,Stack:jo,ThemeExport:oe,TimeInput:Qe,TimeSlider:ha,ToastNotification:as,Tooltip:Ot,UISwitch:es,ValidateLabelInput:fa,fillToLength:Kn,themeDHDefault:la,trimTrailingMask:yt},Symbol.toStringTag,{value:"Module"})),ba=Object.freeze(Object.defineProperty({__proto__:null,ApiBootstrap:mi,ApiContext:Nn,ClientBootstrap:On,ClientContext:bi,useApi:me,useClient:Ve},Symbol.toStringTag,{value:"Module"})),rs=1e4;function Ca(n,i,e=rs){return new Promise((t,s)=>{let o;const a=setTimeout(()=>{o==null||o(),s(new An(`Variable ${i} not found`))},e);function l(c){const d=c.created.find(h=>h.title===i);d!=null&&(clearTimeout(a),o==null||o(),t(d))}o=n.subscribeToFieldUpdates(l)})}const ft=F.module("MessageUtils"),ls="io.deephaven.message.LoginOptions.request",cs="io.deephaven.message.SessionDetails.request",us="io.deephaven.broadcast",Vt="io.deephaven.broadcast.Login",ds="io.deephaven.broadcast.Logout";function rt(n){const i=n;return i!=null&&typeof i.id=="string"&&typeof i.message=="string"}function hs(n){return rt(n)&&n.message===Vt}function ps(n){return rt(n)&&n.message===ds}function ms(n){const i=n;return i!=null&&typeof i.id=="string"}function Bt(n,i=pe(),e){return{message:n,id:i,payload:e}}function va(n,i){return{id:n,payload:i}}async function Ht(n,i=3e4){if(window.opener==null)throw new Error("window.opener is null, unable to send request.");return new Promise((e,t)=>{let s;const o=pe(),a=l=>{const{data:c}=l;if(!ms(c)){ft.debug("Ignoring non-deephaven response",c);return}if(ft.debug("Received message",c),(c==null?void 0:c.id)!==o){ft.debug("Ignore message, id doesn't match",c);return}window.clearTimeout(s),window.removeEventListener("message",a),e(c.payload)};window.addEventListener("message",a),s=window.setTimeout(()=>{window.removeEventListener("message",a),t(new An("Request timed out"))},i),window.opener.postMessage(Bt(n,o),"*")})}class fs extends Error{constructor(){super(...arguments);p(this,"isNoConsolesError",!0)}}function gs(n){return n.isNoConsolesError}const Te=F.module("SessionUtils");function xa(n,i){return Te.info(`Starting connection to '${i}'...`),new n.IdeConnection(i)}async function bs(n,i,e){Te.info("Getting console types...");const t=await i.getConsoleTypes();if(t.length===0)throw new fs("No console types available");Te.info("Available types:",t);const s=t[0];Te.info("Starting session with type",s);const o=await i.startSession(s),a={type:s,id:pe.generate()};return Te.info("Console session established",a),{session:o,config:a,connection:i,details:e,dh:n}}function Sa(n,i,e){return Te.info("createCoreClient",i),new n.CoreClient(i,e)}function ya(n){return n!=null&&typeof n=="object"}async function Ea(){const n=await Ht(cs);if(!ya(n))throw new Error(`Unexpected session details response: ${n}`);return n}async function Ia(){switch(new URLSearchParams(window.location.search).get("authProvider")){case"parent":return Ea()}return{}}async function wa(n,i,e){let t;try{t=await bs(n,i,e)}catch(s){if(!gs(s))throw s}return t}const Ta=F.module("ViewportDataUtils");function Cs(n,i){return String(n.offsetInSnapshot+i)}function vs(n,i){return function(t){const{columns:s,offset:o,rows:a}=t.detail;Ta.debug("table updated",t.detail),a.forEach(l=>{const c=i(l,s),d={key:Cs(l,o),item:c};n.getItem(d.key)!=null?n.update(d.key,d):n.append(d)})}}function xs(n,i){return i.reduce((e,t)=>(e[t.name]=n.get(t),e),{})}function*Ss(n,i){for(let e=n;e<=i;++e)yield{key:String(e)}}function Ma(n,...i){return i.map(e=>n.getItem(e))}function Kt(n){return n==null||lt(n)?0:n.size}function lt(n){return"isClosed"in n?n.isClosed:!1}function ys(n,i,e,t){const s=n+i-1,[o,a]=[0,t-1],l=vt(n-e,o,a),c=vt(s+e,o,a);return[l,c]}const Na=Object.freeze(Object.defineProperty({__proto__:null,BROADCAST_CHANNEL_NAME:us,BROADCAST_LOGIN_MESSAGE:Vt,BROADCAST_LOGOUT_MESSAGE:ds,BooleanColumnFormatter:Ci,CharColumnFormatter:vi,DateTimeColumnFormatter:xi,DateUtils:Si,DecimalColumnFormatter:yi,DefaultColumnFormatter:Ei,FETCH_TIMEOUT:rs,Formatter:Rn,FormatterUtils:xt,IntegerColumnFormatter:Ii,LOGIN_OPTIONS_REQUEST:ls,NoConsolesError:fs,SESSION_DETAILS_REQUEST:cs,StringColumnFormatter:wi,TableColumnFormatter:Ti,TableUtils:Ln,createConnection:xa,createCoreClient:Sa,createKeyFromOffsetRow:Cs,createOnTableUpdatedHandler:vs,createSessionWrapper:bs,defaultRowDeserializer:xs,fetchVariableDefinition:Ca,generateEmptyKeyedItems:Ss,getColumnFormats:Mi,getDateTimeFormatterOptions:Ni,getItemsFromListData:Ma,getSessionDetails:Ia,getSize:Kt,isBroadcastLoginMessage:hs,isBroadcastLogoutMessage:ps,isClosed:lt,isCustomColumnFormatDefined:ki,isMessage:rt,isNoConsolesError:gs,isResponse:ms,loadSessionWrapper:wa,makeMessage:Bt,makeResponse:va,padFirstAndLastRow:ys,requestParentResponse:Ht},Symbol.toStringTag,{value:"Module"}));function ka(n){return function({children:e}){return r.jsx(Nn.Provider,{value:n,children:e})}}const bn=F.module("useTableListener"),Da=(n,i,e)=>u.useEffect(function(){if(n==null){bn.debug2("Emitter undefined, skipping addEventListener",i);return}return bn.debug2("Adding listener",i),n.addEventListener(i,e)},[n,i,e]),ke=Da;class Oa extends Error{constructor(){super(...arguments);p(this,"isColumnNameError",!0)}}const Aa=Oa;class Ra extends Error{constructor(){super(...arguments);p(this,"isTableDisconnectError",!0)}}const La=Ra,Ge=F.module("useTable"),ja=(n,i,e,t)=>{const s=me(),[o,a]=u.useState(void 0),[l,c]=u.useState([]),[d,h]=u.useState(null),[m,g]=u.useState(null);u.useEffect(()=>{if(t===void 0){a(n==null?void 0:n.columns),h(null);return}try{a(n==null?void 0:n.findColumns(t)),h(null)}catch(x){Ge.error("Column not found",x,t),h(new Aa("Invalid columnNames argument"))}},[n,t]),u.useEffect(()=>{if(!o||!n){Ge.debug2("Table or column not initialized, skip viewport update.");return}Ge.debug2("Setting viewport",i,e),n.setViewport(i,e,o)},[o,n,i,e]);const b=u.useCallback(({detail:x})=>{if(!o){Ge.error("Columns not initialized.");return}const P=o.map(U=>x.rows.map(C=>C.get(U)));c(P)},[o]),S=u.useCallback(()=>{g(new La("Table disconnected"))},[]),E=u.useCallback(()=>{g(null)},[]);return ke(n,s.Table.EVENT_UPDATED,b),ke(n,s.Table.EVENT_DISCONNECT,S),ke(n,s.Table.EVENT_RECONNECT,E),{columns:o,data:l,error:m??d}},Es=ja,Pa=(n,i,e,t)=>{const s=u.useMemo(()=>[t],[t]),{columns:o=[],data:a=[],error:l}=Es(n,i,e,s);return{column:o[0],data:a[0],error:l}},Is=Pa;const ae=F.module("TableInput"),gt=250;function Wt(n){const{className:i=void 0,columnName:e,settings:t,defaultValue:s=[],isInvalid:o=!1,onChange:a=()=>!1,onBlur:l=()=>!1,table:c}=n,d=u.useRef(null),h=me(),m=u.useMemo(()=>{const y=xt.getColumnFormats(t),j=xt.getDateTimeFormatterOptions(t),{defaultDecimalFormatOptions:V={},defaultIntegerFormatOptions:H={}}=t;return new Rn(h,y,j,V,H)},[h,t]),[g,b]=u.useState(""),[S,E]=u.useState(new Set(s)),[x,P]=u.useState(),U=u.useRef(null),C=Math.min((x==null?void 0:x.size)??0,gt),{column:k,data:O,error:w}=Is(x,0,gt-1,e),R=u.useCallback(y=>k?m.getFormattedString(y,k.type,k.name):`${y}`,[k,m]),[$,J]=u.useMemo(()=>{const y=new Set(S),j=[];if(O==null)return[j,null];if(O.forEach(V=>{const H=`${V}`,xe=S.has(H);xe&&y.delete(H),j.push({value:H,displayValue:R(V),isSelected:xe})}),y.size>0){ae.debug2("Selection has items that are missing from the viewport");const V=new Set(S);return Array.from(y).forEach(H=>{V.delete(H)}),[j,V]}return[j,null]},[O,S,R]);u.useEffect(()=>{J!==null&&(E(J),a(Array.from(J)))},[a,J]);const D=u.useCallback(async y=>{try{const j=await y;ae.debug("Table resolved",j),P(j)}catch(j){if(tn.isCanceled(j))return;ae.error(j)}},[]);u.useEffect(()=>{const y=tn.makeCancelable(c);return D(y),()=>{ae.debug2("Cancel table promise"),y.cancel()}},[c,D]);const A=u.useCallback(y=>{var H;const{value:j}=y.target;b(j);const V=$.findIndex(xe=>xe.displayValue.includes(j));V>-1?(ae.debug2(`Found ${j} at index ${V}`),(H=U.current)==null||H.scrollIntoView(V)):ae.debug2(`${j} not found`)},[$,U]),B=u.useCallback(y=>{if(ae.debug("handleSelect",y),y>=$.length){ae.error("Invalid index",y);return}const j=$[y].value,V=new Set(S);$[y].isSelected?V.delete(j):V.add(j),E(V),a(Array.from(V))},[a,$,S]),N=u.useCallback(()=>{const y=$.map(V=>V.value),j=new Set(y);E(j),a(y)},[$,a]),M=u.useCallback(()=>{E(new Set),a([])},[a]),v=u.useCallback(()=>{},[]),L=u.useCallback(y=>{var V;const{relatedTarget:j}=y;ae.debug("handleChildBlur",j,j instanceof HTMLElement,d.current,(V=d.current)==null?void 0:V.contains(j)),(!j||d.current&&j instanceof HTMLElement&&!d.current.contains(j))&&l()},[l]),_=$.length===0;return r.jsxs("div",{ref:d,className:I("table-input-container d-flex flex-column position-relative",i),children:[r.jsx(it,{disabled:!!w||_,value:g,placeholder:"Search",onChange:A,className:"mb-2 d-flex",onBlur:L}),r.jsx(is,{className:"table-input-list",disabled:x===void 0||_,isInvalid:o,items:_?[{value:"Empty",isSelected:!1}]:$,itemCount:C,offset:0,onSelect:B,onViewportChange:v,ref:U,onBlur:L}),x&&r.jsxs("div",{className:"meta-row",children:[r.jsx("div",{className:"d-flex align-items-center text-muted small",children:x!=null&&x.size>C&&r.jsxs(r.Fragment,{children:["Table is too large, showing the first ",gt," items."]})}),r.jsxs("div",{children:[r.jsx("button",{type:"button",className:"btn btn-link",onBlur:L,onClick:N,children:"Select All"}),r.jsx("button",{type:"button",className:"btn btn-link mr-a",onBlur:L,onClick:M,children:"Clear"})]})]}),x==null||w&&r.jsx("div",{className:"h-100 w-100 position-absolute",children:r.jsx(Oe,{isLoaded:x!=null,isLoading:x==null&&w==null,errorMessage:(w==null?void 0:w.message)??null})})]})}Wt.displayName="TableInput";Wt.defaultProps={isInvalid:!1,className:void 0};const Cn=F.module("useBroadcastChannel");function Gt(n=Hi,i=us){const e=u.useMemo(()=>new BroadcastChannel(i),[i]);return u.useEffect(()=>()=>{e.close()},[e]),u.useEffect(()=>{function t(s){const{data:o}=s;if(!rt(o)){Cn.debug("Ignoring non-deephaven message",o);return}Cn.debug("event received",o),n(s)}return e.addEventListener("message",t),()=>{e.removeEventListener("message",t)}},[e,n]),e}function ct(n,i){const e=u.useCallback(t=>{hs(t.data)?n==null||n(t.data):ps(t.data)&&(i==null||i(t.data))},[n,i]);Gt(e)}const et="io.deephaven.web.client.auth.refreshToken",ws=u.createContext(null),Fa=F.module("RefreshTokenUtils");function It(){const n=De.get(et);try{if(n!=null)return JSON.parse(n)}catch(i){Fa.error("Error parsing refresh token",n,i)}return null}function wt(n){if(n==null){De.remove(et);return}const i=JSON.stringify({bytes:n.bytes,expiry:n.expiry}),e=new Date(n.expiry);De.set(et,i,{secure:!0,sameSite:"strict",expires:e})}function Ts({children:n}){const i=me(),e=Ve(),[t,s]=u.useState(It());u.useEffect(function(){return e.addEventListener(i.CoreClient.EVENT_REFRESH_TOKEN_UPDATED,d=>{const{detail:h}=d;wt(h),s(h)})},[i,e,t]);const o=u.useCallback(()=>{s(It())},[]),a=u.useCallback(()=>{wt(null),s(null)},[]);return ct(o,a),r.jsx(ws.Provider,{value:t,children:n})}const vn=F.module("useDebouncedViewportSearch"),Ua=200;function $a(n,i,e=Ua){const t=me(),s=u.useMemo(()=>new Ln(t),[t]),{table:o,applyFiltersAndRefresh:a}=n,l=u.useMemo(()=>$e(c=>{if(vn.debug(`Applying debounced searchText '${c}'`),o==null)return;const d=c.trim();if(d===""){a([]);return}const h=o.findColumn(i),m=s.makeFilterValue(h.type,d),g=[h.filter().contains(m)];a(g)},e),[a,i,e,o,s]);return u.useEffect(()=>()=>{vn.debug("Cancelling debounced search function"),l.cancel()},[l]),l}function qt(n){const[,i]=u.useState(0),e=me();return ke(n,e.Table.EVENT_SIZECHANGED,()=>{i(t=>t+1)}),Kt(n)}function Ms(n){const i=Zs({}),e=Rt(n),t=Math.max(0,qt(n));return u.useEffect(()=>{let s=i.items.length;if(n!==e&&s&&(i.remove(...i.items.map(({key:o})=>o)),s=0),!!n){if(t>s)i.insert(s,...Ss(s,t-1));else if(t<s){const o=i.items.slice(t).map(({key:a})=>a);i.remove(...o)}}},[t,n]),i}function _a(n,...i){const e=u.useCallback(async()=>(n==null?void 0:n.selectDistinct(n.findColumns(i)))??null,[n,...i]),{data:t,error:s,isError:o,isLoading:a}=Un(e,[]);return u.useEffect(()=>()=>{t==null||t.close()},[t]),{distinctTable:t,error:s,isError:o,isLoading:a}}function Ns(n,i,e){return u.useCallback(function(s){const[o,a]=ys(s,i,e,Kt(n));n==null||n.setViewport(o,a)},[n,e,i])}function Va(n){u.useEffect(()=>()=>{n!=null&&(lt(n)||n.close())},[n])}function Ba({table:n,viewportSize:i=10,viewportPadding:e=50,deserializeRow:t=xs}){const s=Ms(n),o=Ns(n,i,e),a=u.useCallback(d=>{n==null||n.applyFilter(d),o(0)},[o,n]),l=me();ke(n,l.Table.EVENT_UPDATED,vs(s,t));const c=qt(n);return u.useEffect(()=>{n&&!lt(n)&&o(0)},[n,o,c]),{viewportData:s,size:c,table:n,applyFiltersAndRefresh:a,setViewport:o}}const Ha=Object.freeze(Object.defineProperty({__proto__:null,REFRESH_TOKEN_KEY:et,RefreshTokenBootstrap:Ts,RefreshTokenContext:ws,TableInput:Wt,makeApiContextWrapper:ka,readRefreshToken:It,storeRefreshToken:wt,useBroadcastChannel:Gt,useBroadcastLoginListener:ct,useDebouncedViewportSearch:$a,useInitializeViewportData:Ms,useSelectDistinctTable:_a,useSetPaddedViewportCallback:Ns,useTable:Es,useTableClose:Va,useTableColumn:Is,useTableListener:ke,useTableSize:qt,useViewportData:Ba},Symbol.toStringTag,{value:"Module"})),ks=u.createContext(!1);function Ka({fontClassNames:n=["fira-sans-regular","fira-sans-bold","fira-mono"],children:i}){const[e,t]=u.useState(!1);return u.useEffect(function(){document.fonts.ready.then(()=>{t(!0)})},[]),r.jsxs(r.Fragment,{children:[r.jsx(ks.Provider,{value:e,children:i}),r.jsx("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:n.map(s=>r.jsx("p",{className:s,children:"preload"},s))})]})}function Ds(n){if(n==null)return!1;const i=n;return i.Component!==void 0&&typeof i.isAvailable=="function"}const Os="io.deephaven.auth.AnonymousAuthenticationHandler",Wa="io.deephaven.authentication.psk.PskAuthenticationHandler";class Ga extends Error{constructor(){super(...arguments);p(this,"name","AuthenticationError");p(this,"isAuthenticationError",!0)}}const As=Ga,xn=F.module("AuthPluginBase");function zt({children:n,getLoginOptions:i}){const e=Ve(),[t,s]=u.useState(),[o,a]=u.useState(!1);return u.useEffect(()=>{let l=!1;function c(){if(l)throw new Di("Login canceled.")}async function d(){try{const h=await i();c(),xn.info("Logging in..."),await e.login(h),c(),a(!0)}catch(h){if(!l){xn.error("Unable to login:",h);const m=_e(h)??"Unable to login. Verify credentials.";s(new As(m)),a(!1)}}}return d(),()=>{l=!0}},[e,i]),o?r.jsx(r.Fragment,{children:n}):r.jsx(Oe,{"data-testid":"auth-base-loading",isLoading:t==null,isLoaded:!1,errorMessage:_e(t)})}const qa=u.createContext({}),Zt=u.createContext({}),za={canLogout:!1};function Za({children:n}){const i=me(),e=u.useCallback(()=>({type:i.CoreClient.LOGIN_TYPE_ANONYMOUS}),[i]);return r.jsx(zt,{getLoginOptions:e,children:r.jsx(Zt.Provider,{value:za,children:n})})}const Xa={Component:Za,isAvailable:n=>n.includes(Os)},Rs=Xa,Ja=F.module("AuthPluginParent"),Qa={canLogout:!1};function Ya(n){return n!=null&&typeof n.type=="string"}async function er(){Ja.info("Logging in by delegating to parent window...");const n=await Ht(ls);if(!Ya(n))throw new Error(`Unexpected login options response: ${n}`);return n}function tr(){return new URLSearchParams(window.location.search).get("authProvider")??""}function nr({children:n}){return r.jsx(zt,{getLoginOptions:er,children:r.jsx(Zt.Provider,{value:Qa,children:n})})}const sr={Component:nr,isAvailable:()=>window.opener!=null&&tr()==="parent"},Ls=sr;function js({children:n,errorMessage:i,isLoggingIn:e=!1,onSubmit:t}){return r.jsxs("form",{className:"login-form",onSubmit:s=>{s.preventDefault(),s.stopPropagation(),t==null||t(s)},children:[r.jsx("div",{className:"flex-spacer"}),r.jsxs("div",{className:"flex-wrapper",children:[r.jsx("fieldset",{disabled:e,className:"container-fluid",children:n}),r.jsx("div",{className:"form-group d-flex justify-content-end align-items-center mb-0",children:r.jsxs("button",{type:"submit",className:I("btn btn-primary",{"btn-spinner":e},{"btn-cancelable":e}),"data-testid":"btn-login",children:[e&&r.jsxs("span",{children:[r.jsx(Mn,{}),r.jsx("span",{className:"btn-normal-content",children:"Logging in"}),r.jsx("span",{className:"btn-hover-content",children:"Cancel"})]}),!e&&"Login"]})})]}),r.jsx("div",{className:"flex-spacer",children:i!=null&&r.jsx("p",{className:"error-message mb-0",role:"alert",children:`${i}`})})]})}function Ps({children:n,logoPath:i="./logo.png"}){return r.jsxs("div",{className:"login-container",children:[r.jsx(ns,{}),r.jsxs("div",{className:"login-box",children:[r.jsx("div",{className:"logo",children:r.jsx("img",{src:i,alt:"Deephaven Data Labs"})}),n,r.jsxs("p",{className:"footer",children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})}const Tt="io.deephaven.authentication.psk.PskAuthenticationHandler",Fs="psk",Mt="io.deephaven.web.client.auth.psk.token",Me=F.module("AuthPluginPsk");function ir(){return new URLSearchParams(window.location.search).get(Fs)}function or(){Me.debug2("clearWindowToken");const n=new URL(window.location.href);n.searchParams.delete(Fs),window.history.replaceState(null,"",n.href)}function Sn(){return De.get(Mt)??null}function bt(n){Me.debug2("Storing token in cookie",n),n!=null?De.set(Mt,n,{secure:!0,sameSite:"strict"}):De.remove(Mt)}function ar({children:n,logoPath:i}){const e=Ve(),t=u.useRef(null),s=u.useRef(null),[o,a]=u.useState(),[l,c]=u.useState(!1),[d,h]=u.useState(!1),[m,g]=u.useState(!1),[b,S]=u.useState(""),E=u.useCallback(async(k,O=!0)=>{Me.info("Logging in..."),g(!0);let w=null;try{if(w=e.login({type:Tt,token:k}),s.current=w,await w,Me.info("Logged in successfully"),s.current!==w)return;bt(k),h(!0)}catch(R){if(s.current!==w)return;if(c(!0),O){Me.error("Unable to login",R);const $=_e(R)??"Unable to login: Verify credentials.";a(new As($))}}g(!1)},[e]),x=u.useCallback(()=>{s.current=null,g(!1)},[]),P=u.useCallback(async()=>{Me.debug("onLogin");const k=Sn();d||m||k==null||E(k,!1)},[d,m,E]),U=u.useCallback(()=>{bt(null)},[]);ct(P,U),u.useEffect(()=>{let k=!1;async function O(){const w=ir()??Sn();if(or(),w==null){c(!0);return}g(!0);try{await e.login({type:Tt,token:w}),k||(bt(w),h(!0),g(!1))}catch{k||(c(!0),g(!1))}}return O(),()=>{k=!0}},[e]);const C=u.useCallback(()=>{m?x():E(b)},[x,m,E,b]);return u.useEffect(function(){var O;(O=t.current)==null||O.focus()},[t,l]),r.jsxs(r.Fragment,{children:[d&&n,l&&r.jsx(ve,{in:!d,timeout:oe.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:r.jsx(Ps,{logoPath:i,children:r.jsx(js,{errorMessage:_e(o),isLoggingIn:m,onSubmit:C,children:r.jsxs("div",{className:"form-group",children:[r.jsx("label",{htmlFor:"auth-psk-token-input",children:"Token"}),r.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:t,value:b,onChange:k=>{a(void 0),S(k.target.value)}})]})})})}),r.jsx(Oe,{"data-testid":"auth-psk-loading",isLoaded:d||l,isLoading:!d&&!l})]})}const rr={Component:ar,isAvailable:n=>n.includes(Tt)},Us=rr,lr=Object.freeze(Object.defineProperty({__proto__:null,AUTH_HANDLER_TYPE_ANONYMOUS:Os,AUTH_HANDLER_TYPE_PSK:Wa,AuthPluginAnonymous:Rs,AuthPluginBase:zt,AuthPluginParent:Ls,AuthPluginPsk:Us,Login:Ps,LoginForm:js,UserOverrideContext:qa,UserPermissionsOverrideContext:Zt,isAuthPlugin:Ds},Symbol.toStringTag,{value:"Module"})),$s={react:T,"react-dom":yn,redux:Xs,"react-redux":Js,"@deephaven/auth-plugins":lr,"@deephaven/components":ga,"@deephaven/jsapi-bootstrap":ba,"@deephaven/jsapi-components":Ha,"@deephaven/jsapi-utils":Na,"@deephaven/log":ji,"@deephaven/react-hooks":Zi},cr=En.createRequires(()=>$s),ur=En.createRemoteComponent({requires:cr}),dr=ur,hr=Qs.createRequires($s),pr=Ys({requires:hr}),mr=pr,he=F.module("@deephaven/app-utils.PluginUtils");function Rr(n,i){const e=new URL(`${i}.js`,n),t=T.forwardRef((s,o)=>r.jsx(dr,{url:e.href,render:({err:a,Component:l})=>{if(a!=null&&a!==""){const c=`Error loading plugin ${i} from ${e} due to ${a}`;return he.error(c),r.jsx("div",{className:"error-message",children:`${c}`})}return r.jsx(l,{ref:o,...s})}}));return t.pluginName=i,t.displayName="Plugin",t}async function fr(n){return await mr(n)}async function gr(n){const i=await fetch(n);if(!i.ok)throw new Error(i.statusText);try{return await i.json()}catch{throw new Error("Could not be parsed as JSON")}}async function br(n){he.debug("Loading plugins...");try{const i=await gr(`${n}/manifest.json`);if(!Array.isArray(i.plugins))throw new Error("Plugin manifest JSON does not contain plugins array");he.debug("Plugin manifest loaded:",i);const e=[];for(let o=0;o<i.plugins.length;o+=1){const{name:a,main:l}=i.plugins[o],c=`${n}/${a}/${l}`;e.push(fr(c))}const t=await Promise.allSettled(e),s=new Map;for(let o=0;o<t.length;o+=1){const a=t[o],{name:l}=i.plugins[o];a.status==="fulfilled"?s.set(l,a.value):he.error(`Unable to load plugin ${l}`,a.reason)}return he.info("Plugins loaded:",s),s}catch(i){return he.error("Unable to load plugins:",i),new Map}}function Cr(n){var i;return((i=n.get("AuthHandlers"))==null?void 0:i.split(","))??[]}function vr(n,i,e){const t=Cr(i),s=[...n.entries()].filter(([,c])=>Ds(c.AuthPlugin)).map(([c,d])=>[c,d.AuthPlugin]);s.push(...e??[]);const o=s.filter(([c,d])=>d.isAvailable(t,i));if(o.length===0)throw new Error(`No login plugins found, please register a login plugin for auth handlers: ${t}`);o.length>1&&he.warn("More than one login plugin available, will use the first one: ",o.map(([c])=>c).join(", "));const[a,l]=o[0];return he.info("Using LoginPlugin",a),l.Component}const Xt=u.createContext(null);function xr({pluginsUrl:n,children:i}){const[e,t]=u.useState(null);return u.useEffect(function(){let o=!1;async function a(){const l=await br(n);o||t(l)}return a(),()=>{o=!0}},[n]),r.jsx(Xt.Provider,{value:e,children:i})}function Sr(){const n=Gt();return u.useEffect(function(){n.postMessage(Bt(Vt))},[n]),null}const yr=new Map([["@deephaven/auth-plugins.AuthPluginPsk",Us],["@deephaven/auth-plugins.AuthPluginParent",Ls],["@deephaven/auth-plugins.AuthPluginAnonymous",Rs]]);function Er({children:n}){const i=Ve(),e=u.useContext(Xt),[t,s]=u.useState(),[o,a]=u.useState();u.useEffect(function(){let h=!1;async function m(){try{const g=await i.getAuthConfigValues();h||s(new Map(g))}catch(g){h||a(g)}}return m(),()=>{h=!0}},[i]);const l=u.useMemo(()=>{if(!(e==null||t==null))try{return vr(e,t,yr)}catch(d){a(d)}},[t,e]),c=l==null||t==null;return c||o!=null?r.jsx(Oe,{isLoading:c&&o==null,errorMessage:_e(o)}):r.jsx(l,{authConfigValues:t,children:r.jsxs(r.Fragment,{children:[r.jsx(Sr,{}),n]})})}function Lr(n){return new URL(n,`${window.location}`)}function Ir(){return new URLSearchParams(window.location.search).get("envoyPrefix")}function wr(){const n=Ir();return n!=null?{headers:{"envoy-prefix":n}}:{headers:{}}}function Tr({children:n}){return u.useContext(ks)?r.jsx(r.Fragment,{children:n}):r.jsx(Oe,{"data-testid":"fonts-loaded-loading"})}function jr({fontClassNames:n,pluginsUrl:i,serverUrl:e,children:t}){const s=u.useMemo(()=>wr(),[]),[o,a]=u.useState(0),l=u.useCallback(()=>{},[]),c=u.useCallback(()=>{a(d=>d+1)},[]);return ct(l,c),r.jsx(Ka,{fontClassNames:n,children:r.jsx(xr,{pluginsUrl:i,children:r.jsx(On,{serverUrl:e,options:s,children:r.jsx(Ts,{children:r.jsx(Er,{children:r.jsx(Oi,{children:r.jsx(Tr,{children:t})})})})},o)})})}function Pr(){return kn(Xt,"No Plugins available in usePlugins. Was code wrapped in PluginsBootstrap or PluginsContext.Provider?")}export{jr as AppBootstrap,Er as AuthBootstrap,Oi as ConnectionBootstrap,$r as ConnectionContext,Ka as FontBootstrap,Tr as FontsLoaded,ks as FontsLoadedContext,xr as PluginsBootstrap,Xt as PluginsContext,dr as RemoteComponent,Cr as getAuthHandlers,vr as getAuthPluginComponent,Lr as getBaseUrl,wr as getConnectOptions,Ir as getEnvoyPrefix,Rr as loadComponentPlugin,gr as loadJson,fr as loadModulePlugin,br as loadModulePlugins,_r as useConnection,Pr as usePlugins};
9
+ //# sourceMappingURL=index-daf3a359.js.map