@deephaven/embed-chart 0.38.1-beta.5 → 0.38.1-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ var $s=Object.defineProperty;var _s=(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)=>(_s(n,typeof i!="symbol"?i+"":i,e),e);import{A as u,B as f,G as T,P as Vs,C as l,D as Ce,E as I,R as yn,M as Nt,K as $e,L as Y,F as Z,N as pe,O as Bs,Q as Hs,S as Ks,T as Ws,U as Gs,V as vt,$ as qs,W as De,X as zs,Y as Zs,Z as Xs,_ as En,a0 as Js,a1 as Qs}from"./vendor-c6328e9a.js";import{T as oe,L as F,c as Ys,e as ei,M as kt,f as Dt,g as In,h as ti,i as ni,j as si,k as ii,l as oi,m as wn,n as ai,o as ri,p as li,q as ci,r as ui,s as Tn,t as di,u as hi,b as Oe,w as Mn,A as pi,x as mi}from"./index-3ebf01f9.js";import{d as Nn,e as z,i as pt,f as kn,a as fi,C as gi,g as Dn,h as bi,c as ve,j as Ve,k as On,B as Ci,l as vi,m as xi,D as Si,n as yi,o as Ei,b as An,F as xt,I as Ii,S as wi,p as Ti,T as Rn,q as Mi,r as Ni,s as ki,P as tn,t as Di,v as Oi}from"./useConnection-f6190b1f.js";import{w as Ur,u as $r}from"./useConnection-f6190b1f.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 Vs(s||a,this.element,o),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t&&!this.element.contains(document.activeElement)){const r=this.element.firstElementChild;r instanceof HTMLElement&&r.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:r}=this.state;return l.jsx(Ce,{in:r,timeout:s,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:l.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:l.jsxs("div",{className:"popper-content",children:[t,l.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){const{popper:e}=this.state,{"data-testid":t}=this.props;return l.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
+ `).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
+ `)}`:""}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
+ ${Xe.formatStack(e.stack,e.type)}`:"")).join(`
5
+ `)}}const Li=Xe,ji=Object.freeze(Object.defineProperty({__proto__:null,Log:F,LogHistory:Li,LogProxy:Ri,Logger:Ys,LoggerLevel:ei,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(),r=this.parent.getBoundingClientRect();t>=a.left&&t<=a.left+a.width&&s>=a.top&&s<=a.top+a.height?this.handleMouseMove():t>=r.left&&t<=r.left+r.width&&s>=r.top&&s<=r.top+r.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:r}=this.props,{isShown:c}=this.state;let{options:d}=this.props;return d={placement:"bottom",...d},l.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":a,children:l.jsx(Ae,{className:I(o),options:d,ref:this.popper,onEntered:r,onExited:this.handleExited,interactive:e,referenceObject:s,children:l.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 Ln=(n=>(n.UP="UP",n.DOWN="DOWN",n))(Ln||{});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 r;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}(r=this.popper.current)==null||r.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 l.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?l.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 l.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:r,"data-testid":c}=this.props,{title:d,menuIsOpen:h,popperOptions:m,invalid:g}=this.state;return l.jsxs("div",{className:"aci-container",ref:this.cbContainer,children:[l.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:r,"data-testid":c}),l.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",Ln);const Ui=Ee;function At({className:n="",value:i,onChange:e,spellCheck:t=!1,placeholder:s="",disabled:o=!1,delimiter:a="",id:r="","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
+ ${a.trim()}`)}function E(w){return w.split(`
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]),l.jsx("textarea",{ref:b,id:r,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 l.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:r=!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:l.jsx(Z,{icon:a}));let D;o!==void 0&&(D=typeof o=="string"?l.jsx(Ot,{children:o}):o);let A=O;O===void 0&&w&&o!=null&&typeof o=="string"&&(A=o);const B=l.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:r,tabIndex:C,"aria-label":A,children:[a&&J,U,o!=null&&!r&&D]});return r?l.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 jn 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 r=o[a],c=r[0],d=r[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 r=o[a],c=r[0],d=r[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 Pn(){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 Fn(n,i,{autoLoad:e=!0}={}){const[t,s]=u.useState(null),[o,a]=u.useState(null),[r,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:r,reload:d}}function Un(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:Nn,useCopyToClipboard:Pn,useDebouncedValue:Un,useFormWithDetachedSubmitButton:zi,useForwardedRef:Lt,usePrevious:Rt,usePromiseFactory:Fn},Symbol.toStringTag,{value:"Module"}));function Xi({blockInteraction:n=!0,children:i,debounceMs:e,isOpen:t=!1}){const s=Un(t,e);return l.jsxs(l.Fragment,{children:[n&&t&&l.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 l.jsx(kt,{isOpen:e,className:n,children:l.jsx(Dt,{children:l.jsxs("div",{className:"info-modal",children:[i!=null&&l.jsx("div",{className:"message-icon",children:l.jsx(Z,{icon:i})}),l.jsx("div",{className:"message-header",children:s}),t!=null&&l.jsx("div",{className:"message-content",children:t})]})})})}function $n({className:n="modal-footer",children:i,"data-testid":e}){return l.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:r,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&&r&&r(),o()},[o,r]),P=u.useCallback(()=>{var C;(C=S.current)==null||C.focus()},[]);let U="";return i&&(U=typeof t=="function"?t():t),l.jsxs(kt,{isOpen:i,className:"theme-bg-light",onOpened:P,children:[l.jsx(In,{closeButton:!1,children:e}),l.jsx(Dt,{children:U}),l.jsxs($n,{children:[r&&l.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[l.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}),l.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),a&&l.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&&l.jsx(ee,{kind:"secondary","data-dismiss":"modal",onClick:s,"data-testid":b!==void 0?`${b}-btn-cancel`:void 0,children:c}),l.jsxs(Be,{children:[l.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:r}=n;return l.jsx("button",{ref:i,type:"button",className:I("btn",t),onClick:o,style:a,disabled:s,id:r,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")},[]),r=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]),l.jsxs("div",{className:I(n,{"card-flip--show-front":i,"card-flip--show-back":!i}),"data-testid":t,children:[l.jsx("div",{className:"card-flip--back",children:s(0)}),l.jsx("div",{ref:o,className:"card-flip--front",onTransitionEnd:r,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 r=l.jsx(to,{action:o,"data-testid":e},`${o.title}.${a==null?void 0:a.id}`);t.push(r)}}return t}}const so=no;const He=F.module("ContextActions");class _n 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,r=t.find(c=>a.contains(c));if(r!==void 0){He.debug2(`Contextmenu event ignored based on the target className "${r}"`);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 l.jsx("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:l.jsx(so,{actions:t})})}}p(_n,"groups",{default:null,high:100,medium:5e3,low:1e4,global:1e5,edit:100});const io=_n,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 l.jsx(Ce,{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=>l.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:r,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 l.jsxs("div",{className:I("custom-control custom-checkbox",s),children:[l.jsx("input",{type:"checkbox",ref:b,checked:e??!1,className:I("custom-control-input",a,{"is-invalid":r}),disabled:o,id:g,name:d,onChange:S,"data-testid":m}),l.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 Vn 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:r,matchCount:c,id:d,onKeyDown:h,"data-testid":m}=this.props;return l.jsxs("div",{className:I("search-group",a),children:[l.jsx("input",{type:"search",value:e,onBlur:s,onChange:o,onKeyDown:h,className:"form-control",disabled:r,placeholder:t,ref:this.inputField,id:d,"data-testid":m}),c!=null&&l.jsx("span",{className:"search-match",children:c}),l.jsx("span",{className:"search-icon",children:l.jsx(Z,{icon:ti})})]})}}p(Vn,"defaultProps",{placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0});const it=Vn;var Bn=(n=>(n.UP="UP",n.DOWN="DOWN",n))(Bn||{});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,r=t?s:a;switch(e.key){case"Enter":((c=r[o])==null?void 0:c.value)!=null&&this.updateInputValue(r[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===r.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,r=s?o:a;this.updateInputValue(r[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,r=(t?s:o).findIndex(c=>c.value===e);this.setState({keyboardOptionIndex:r})}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 l.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:[l.jsx("div",{className:"cb-search-input-container",children:l.jsx(it,{value:t,ref:this.searchInput,onChange:this.handleFilterChange,className:"cb-search-input",placeholder:e})}),l.jsx("div",{className:"cb-options-container",children:l.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((r,c)=>{const d=`option-${c}-${r.value}`;return l.jsx("button",{type:"button",value:c,className:I("cb-option-btn",{"keyboard-active":t===c}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:r.title},d)})}render(){const{options:e,inputPlaceholder:t,disabled:s,className:o,defaultValue:a,spellCheck:r,"data-testid":c}=this.props,{value:d}=this.state;let{popperOptions:h}=this.props;return h={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...h},l.jsxs("div",{className:"input-group cb-container",ref:this.cbContainer,children:[l.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:r,"data-testid":c!==void 0?`${c}-input`:void 0}),l.jsx("div",{className:"input-group-append cb-dropdown",children:l.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:[l.jsx(Z,{icon:ni}),l.jsx(Ae,{ref:this.popper,options:h,className:I("combobox interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})})]})}};let fe=Ne;p(fe,"MENU_NAVIGATION_DIRECTION",Bn),p(fe,"DROP_DOWN_MENU_HEIGHT",200),p(fe,"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(fe,"defaultProps",{onChange(){},inputPlaceholder:"",searchPlaceholder:"Search",disabled:!1,className:"",defaultValue:"",popperOptions:null,spellCheck:!0,onEnter(){},"data-testid":void 0});const ao=fe;function ro({copy:n,kind:i="ghost",tooltip:e="Copy",className:t,"data-testid":s,children:o}){const[a,r]=Pn();return l.jsx(ee,{kind:i,className:t,"data-testid":s,icon:a?si:ii,tooltip:a?"Copied":e,onClick:()=>{r(typeof n=="function"?n():n)},children:o})}function ot(n,i,e){return n.substring(0,i)+e+n.substring(i+1)}function Hn(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=" ",Kn=T.forwardRef((n,i)=>{const{className:e,example:t,getNextSegmentValue:s=(N,M,v)=>v,getPreferredReplacementString:o=ot,onChange:a=()=>!1,onSelect:r=()=>!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),r(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"){r({...m});return}if(M===v){const _=C(M);te.debug("Selection segment from ",M,v,"=>",_),r(_)}else r({selectionStart:M,selectionEnd:v,selectionDirection:L})}},[C,r,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"?r(R(v)):M==="ArrowRight"?r(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),r({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),r({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),r({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=Hn(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),r(ht);return}}}}return l.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})});Kn.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=Kn,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"],Wn=T.forwardRef((n,i)=>{const{allowValueWrapping:e=!0,className:t="",onChange:s=()=>!1,value:o=0,onFocus:a=()=>!1,onBlur:r=()=>!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 l.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:r,"data-testid":d})});Wn.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const Qe=Wn;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(l.jsx("hr",{},`${c}.separator`));const h=l.jsx(kn,{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:r}=this.props;return l.jsx("div",{className:"context-menu-container",style:{...r},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 Gn 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:r,popperOptions:c}=this.props;return c={placement:"bottom",...c},r={separateKeyboardMouse:!0,...r},l.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":o,children:l.jsx(Ae,{ref:this.popper,options:c,className:I("menu-popper",s),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:l.jsx(po,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:r,menuStyle:a})})})}}p(Gn,"defaultProps",{isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0});const qn=Gn;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 r=e[a];if(r.value===t)return r.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 r=t;switch(e){case se.MENU_NAVIGATION_DIRECTION.UP:if(!s&&t===0){this.focusInput();break}else s&&this.focusOption(t);t>0&&!s?(r=(r-1)%a,this.setState({keyboardOptionIndex:r})):t===0&&(r=a-1,this.setState({keyboardOptionIndex:r})),this.scrollOptionIntoView(r);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)&&(r=(r+1)%a,this.setState({keyboardOptionIndex:r})),this.scrollOptionIntoView(r);break}}handleOptionClick(e){const t=Number(e.currentTarget.value),{options:s,timeToValue:o}=this.props,{customTime:a}=this.state;if(t===on){const r=o(a);this.updateAndClose(r)}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 r;const{options:e,value:t}=this.props,{keyboardOptionIndex:s}=this.state;this.scrollOptionIntoView(s);const o=(r=this.menuContainer.current)==null?void 0:r.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 l.jsx("div",{className:"cs-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:t=>{t.stopPropagation()},style:{width:e},children:l.jsx("div",{className:"cs-options-container",children:l.jsx("div",{className:"cs-options",children:this.renderOptions()})})})}renderOptions(){const{options:e,value:t,icon:s,customText:o}=this.props,{keyboardOptionIndex:a,customTime:r,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(l.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&&l.jsx(Z,{icon:s,className:"mr-2"}),g.value!==t&&l.jsx("span",{className:"mr-4"}),g.title]},b))}return h.push(l.jsx("hr",{className:"cs-divider"},"option-divider")),h.push(l.jsxs("button",{type:"button",value:on,className:I("cs-option-btn",{"keyboard-active":c}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!d&&t!==null?l.jsx(Z,{icon:s,className:"mr-2"}):l.jsx("span",{className:"mr-4"}),o]},"option-custom-label")),h.push(l.jsxs("div",{className:"cs-custom-container",children:[l.jsx("span",{className:"mr-2"}),l.jsx(Qe,{ref:this.input,onChange:this.handleCustomInput,value:r,onFocus:()=>this.setState({inputFocused:!0}),onBlur:()=>this.setState({inputFocused:!1})},"option-input"),l.jsx("span",{className:"ml-2"})]},"cs-custom-container")),h.push(l.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:r}=this.props;return r={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...r},l.jsx("div",{className:"input-group cs-container context-menu",ref:this.csContainer,"data-testid":o,children:l.jsx("div",{className:I("input-group-append cs-dropdown",{"cs-dropdown-invalid":t}),children:l.jsxs("button",{type:"button",className:I("btn cs-btn form-control",{"cs-btn-invalid":t}),ref:this.button,onClick:this.toggleMenu,disabled:e,children:[l.jsx("span",{className:I({"text-muted":s===null}),children:this.getSelectedText()}),l.jsx("span",{children:l.jsx(Z,{icon:wn,className:"cs-caret"})}),l.jsx(qn,{isShown:a,actions:{menuElement:this.renderMenuElement()},popperOptions:r,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:oi,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 Zn(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",Xn=`${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")}${Xn.substring(n.length)}`:n}function rn(n){return n.replace(/\u200B/g,"")}const xo=[Et(Xn)],Ft=T.forwardRef((n,i)=>{const{className:e="",onChange:t=()=>{},defaultValue:s="",onFocus:o=()=>{},onBlur:a=()=>{},onSubmit:r,"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 l.jsx("div",{className:"d-flex flex-row align-items-center",children:l.jsx(at,{ref:i,className:I(e),example:xo,getNextSegmentValue:Zn,onChange:b,onSelect:g,onSubmit:r,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":r}=n,[c,d]=u.useState(s),[h,m]=u.useState(),g=u.useCallback(b=>{yo.debug("handleChange",b),d(b),t(b)},[t]);return l.jsx("div",{className:"d-flex flex-row align-items-center",children:l.jsx(at,{ref:i,className:I(e),example:Io,getNextSegmentValue:Zn,onChange:g,onSelect:m,pattern:Eo,placeholder:wo,selection:h,value:c,onFocus:o,onBlur:a,"data-testid":r})})});Ut.displayName="DateInput";Ut.defaultProps={className:"",onChange:()=>!1,defaultValue:"",onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const To=Ut;class Jn 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:r}=this.state;return l.jsx(it,{value:r,placeholder:e,onChange:this.handleChange,className:t,matchCount:s,ref:this.searchInput,id:o,"data-testid":a})}}p(Jn,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});const Mo=Jn;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":r}=this.props;return l.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":r,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 Qn=ze;const ln=F.module("ItemList"),cn=5,be=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:be.CACHE_SIZE}));p(this,"getCachedItem",Y((e,t,s,o,a,r,c,d)=>{const h=r({item:s,itemIndex:e,isFocused:o,isSelected:a,style:c});return l.jsx(Qn,{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:be.CACHE_SIZE}));p(this,"getOuterElement",Y(e=>{const t=T.forwardRef((s,o)=>l.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)=>l.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 l.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:r,scrollOffset:c,height:d,selectedRanges:h}=this.state;if(r&&!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:r,selectedRanges:c,mouseX:d,mouseY:h}=this.state;if(r==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||r===e)&&(this.focusItem(e),o?(!s&&!this.getItemSelected(e,c)&&!z.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(r,e),Math.max(r,e)])):this.toggleSelect(e,t.shiftKey,z.isModifierKeyDown(t),!1))}handleItemMouseUp(e,t){const{isDeselectOnClick:s,isDoubleClickSelect:o,onSelect:a}=this.props,{mouseDownIndex:r,isDragging:c}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(r===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 r=a;if(e.key==="Enter"||e.key===" "){!t&&r!=null&&this.setState({selectedRanges:[[r,r]]},()=>{r!=null&&o(r,e)});return}if(e.key==="ArrowUp")r!=null&&r>=0?r=Math.max(0,r-1):r=s-1;else if(e.key==="ArrowDown")r!=null&&r>=0?r=Math.min(r+1,s-1):r=0;else return;if(a!==r){e.stopPropagation(),e.preventDefault(),this.focusItem(r);const{selectedRanges:d}=this.state;if(e.shiftKey&&d.length>0){const h=d[d.length-1];this.selectRange([Math.min(r,h[0]),Math.max(r,h[1])])}else this.deselectAll(),r!==null?this.selectItem(r):(c=this.listContainer.current)==null||c.focus();this.scrollIntoView(r)}}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:r}=this.state;if(a&&t&&r.length>0){const c=r[r.length-1];this.selectRange([Math.min(c[0],e),Math.max(e,c[1])])}else a&&r.length===1&&r[0][0]===e&&r[0][1]===e?o&&this.deselectItem(e):a&&s?this.getItemSelected(e,r)?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),r=a+Math.ceil(t/o);s(a,r)}}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:r}=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&&!r,this.getItemSelected(e,d),a,t,r)}render(){const{items:e,itemCount:t,overscanCount:s,renderItem:o,rowHeight:a,"data-testid":r}=this.props,{selectedRanges:c,isStuckToBottom:d}=this.state;return l.jsx(Bs,{className:"item-list-auto-sizer",onResize:this.handleResize,children:({width:h,height:m})=>l.jsx(Hs,{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":r,children:this.renderInnerElement})})}};let ne=be;p(ne,"CACHE_SIZE",1e3),p(ne,"DEFAULT_ROW_HEIGHT",20),p(ne,"DEFAULT_OVERSCAN",10),p(ne,"defaultProps",{offset:0,items:[],rowHeight:be.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:be.DEFAULT_OVERSCAN,renderItem:be.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,r,c,d)=>l.jsx(Ks,{draggableId:de.getDraggableId(e,o),index:o,isDragDisabled:c,children:h=>l.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:r,style:d,isClone:!1})})},o),{max:ne.CACHE_SIZE}));p(this,"getCachedRenderDraggableItem",Y((e,t,s)=>({item:o,itemIndex:a,isFocused:r,isSelected:c,style:d})=>this.getCachedDraggableItem(e,s,o,a,r,c,t,d),{max:1}));p(this,"getCachedRenderClone",Y((e,t,s,o)=>(a,r,c)=>{const{selectedCount:d}=this.state,{draggableProps:h,dragHandleProps:m,innerRef:g}=a,{index:b}=c.source,S=t[b-s];return l.jsx("div",{className:I("draggable-item-list-dragging-item-container",e),...h,...m,ref:g,children:l.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 l.jsxs("div",{children:[l.jsx(Ot,{children:"Drag to re-order"}),l.jsx(Z,{icon:ai})]})}static renderBadge({text:e}){return e!=null&&e.length>0?l.jsx("span",{className:"number-badge",children:e}):null}static renderTextItem({text:e,badgeText:t="",className:s=""}){return l.jsxs("div",{className:I("item-list-item-content","draggable-item-list-item-content",s),children:[l.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}`:"",r=t!==void 0&&t?"item-list-item-clone":"";return de.renderTextItem({text:o,badgeText:a,className:r})}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:r,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 l.jsx(Ws,{isDropDisabled:c,droppableId:o,mode:"virtual",renderClone:this.getCachedRenderClone(s,g,b,P),"data-testid":O,children:(w,R)=>l.jsx("div",{role:"menu",className:I("draggable-item-list",e,{"is-drop-disabled":c,"is-drag-disabled":r,"is-dragging-from-this":R.draggingFromThisWith,"is-dragging-over":R.isDraggingOver,"is-dropping":R.draggingOverWith}),style:k,ref:w.innerRef,...w.droppableProps,children:l.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,r,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:r}=s[o],[c,d]=a;t[r]=i.splice(c,d-c+1)}return Gs(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,r]=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("")):r(C)},[h,t,o]),E=u.useCallback(C=>{const{value:k}=C.target;m(k),r(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 l.jsxs("div",{className:I("editable-item-list-container",{"is-invalid":i}),children:[l.jsx("div",{style:{height:U},children:l.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})}),l.jsxs("div",{className:"d-flex flex-row pt-2",children:[l.jsx("div",{className:"d-flex flex-grow-1",children:l.jsx("input",{className:I("form-control",{"is-invalid":a!=null}),placeholder:"Enter value",type:"text",value:h,onChange:E,onFocus:x,onKeyDown:P})}),l.jsxs("div",{className:"d-flex align-items-start mt-1 ml-2",children:[l.jsx(ee,{kind:"ghost",onClick:S,disabled:a!=null||h==="",icon:ri,tooltip:"Add new item","data-testid":"add-item-button"}),l.jsx(ee,{kind:"ghost",onClick:b,disabled:c.length===0,icon:li,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 r=o.get(i);if(e===void 0&&r!==void 0&&typeof r!="boolean"){const c=Ue.isParentSelected(i,t);c!=null&&c?r.forEach((d,h)=>r.set(h,!1)):r.forEach((d,h)=>r.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 r=new Map;o.forEach((c,d)=>r.set(d,i)),s.set(a,r)}}),t(s)}selectAll(){this.setAllValues(!0)}clear(){this.setAllValues(!1)}renderMenuElement(){const{valueMap:i,"data-testid":e}=this.props;return l.jsxs("div",{className:"hcm-menu-container",children:[Array.from(i.entries()).map(([t,s])=>l.jsxs("div",{children:[l.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])=>l.jsx(Je,{className:"hcm-child",checked:a,onChange:()=>this.toggleValueFor(t,o),children:o},o))]},t)),l.jsx(ee,{kind:"ghost",onClick:this.selectAll,"data-testid":e!==void 0?`${e}-btn-select-all`:void 0,children:"Select All"}),l.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 l.jsxs("button",{type:"button",className:I("btn hcm-btn",e),onClick:this.toggleMenu,id:s,"data-testid":o,children:[l.jsxs("span",{children:[t&&l.jsx(Z,{icon:t,className:"hcm-icon mr-1"}),i]}),l.jsx(Z,{icon:wn,className:"hcm-icon ml-1"}),l.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 Yn({on:n,id:i,className:e,isInvalid:t,disabled:s=!1,onClick:o,"data-testid":a}){return l.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:l.jsx("div",{className:"handle"})})}function un(n){return n.isOn!==void 0}function es({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 l.jsxs("div",{className:"btn btn-navigation-menu-item","data-testid":`menu-item-${o}`,onClick:a,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&a()},tabIndex:0,role:"menuitem",children:[t!==void 0&&l.jsx("div",{className:"icon",children:l.jsx(Z,{icon:t})}),l.jsx("div",{className:"title",children:o}),s!==void 0&&l.jsx("div",{className:"shortcut",children:s}),l.jsx("div",{className:"accessory","data-testid":e,children:un(n)?l.jsx(Yn,{on:n.isOn,onClick:r=>{r.stopPropagation(),a()}}):l.jsx(Z,{icon:ci})})]})}function Ro({items:n,onSelect:i=()=>{},"data-testid":e}){return l.jsx("div",{className:"navigation-menu-view","data-testid":e,children:l.jsx("ul",{className:"navigation-menu-list",children:n.map((t,s)=>l.jsx("li",{children:l.jsx(es,{item:t,onSelect:()=>{i(s)}})},t.title))})})}function Lo({children:n,onBack:i,onClose:e,title:t,"data-testid":s}){return l.jsxs("div",{className:"navigation-page","data-testid":s,children:[l.jsxs("div",{className:"navigation-title-bar",children:[l.jsx("div",{className:"navigation-left-buttons",children:i!==void 0&&l.jsx(ee,{kind:"ghost",className:"btn-back","data-testid":"btn-page-back",onClick:i,icon:ui,children:"Back"})}),l.jsx("div",{className:"navigation-title",children:t}),l.jsx("div",{className:"navigation-right-buttons",children:e!==void 0&&l.jsx(ee,{kind:"ghost",className:"btn-close px-2 m-1","data-testid":"btn-page-close",onClick:e,icon:Tn,tooltip:"Close"})})]}),l.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,r]=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?r(b):b!==c&&b!==s&&o(b):e.length>t.length?r(b):e.length<t.length&&(o(b),d(t[t.length-1]))},[e,t,a,c,s]);const h=u.useCallback(()=>{o(a),r(null)},[a]),m=u.useCallback(()=>{d(null)},[]);return l.jsxs("div",{className:"navigation-stack",children:[l.jsx("div",{className:"main-view","data-testid":i,children:s}),l.jsx(Ce,{in:c!=null,timeout:oe.transitionMidMs,classNames:"slide-right",onEntered:m,children:l.jsx(l.Fragment,{children:c!=null&&l.jsx("div",{className:"popping-view",children:c})})}),l.jsx(Ce,{in:a!=null,timeout:oe.transitionMidMs,classNames:"slide-left",onEntered:h,children:l.jsx(l.Fragment,{children:a!=null&&l.jsx("div",{className:"pushing-view",children:a})})})]})}function Po({children:n,disabled:i,value:e,"data-testid":t}){return l.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,[r]=u.useState(t??pe());return l.jsx(l.Fragment,{children:T.Children.map(i,c=>c?T.cloneElement(c,{name:r,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:r=!1,labelClassName:c="",name:d,onChange:h,value:m,"data-testid":g}=n,[b]=u.useState(pe());return l.jsxs("div",{className:I("custom-control custom-radio",s),children:[l.jsx("input",{type:"radio",id:b,"data-testid":g,name:d,ref:i,className:I("custom-control-input",a,{"is-invalid":r}),checked:e,disabled:o,value:m,onChange:h}),l.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"],me={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,r,c,d,h=null,m=[];function g(){i.current!=null&&(r=i.current.offsetWidth,c=i.current.offsetHeight),n.current!=null&&(n.current.style.width=`${r}px`,n.current.style.height=`${c}px`,n.current.width=r*s,n.current.height=c*s),o==null||o.scale(s,s)}function b(){const D=document.createElement("canvas");D.width=me.SIZE,D.height=me.SIZE;const A=D.getContext("2d");return A!=null&&(A.fillStyle=mt,A.fillRect(0,0,me.DOT_SIZE,me.DOT_SIZE),A.fillStyle=mt+Math.round(255*me.FILL_OPACITY).toString(16).padStart(2,"0"),A.fillRect(0,0,me.SIZE,me.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<r+le;B+=1)A=S(A),D.push(A);return D}function x(){for(;m.length>=r+le;)m.pop();for(;m.length<r+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(r+le,c*D[D.length-1]),A.lineTo(r+le,c+1),A.closePath()}function U(D){D.beginPath();for(let A=1;A<r;A+=dn)D.moveTo(A,0),D.lineTo(A,c);for(let A=1;A<c;A+=dn)D.moveTo(0,A),D.lineTo(r,A)}function C(D){h=h??D,fi(o),o.fillStyle=Ko,o.fillRect(0,0,r,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()}},[]),l.jsx("div",{className:"random-area-plot-animation-container",ref:i,children:l.jsx("canvas",{ref:n,className:e?"shade":""})})}),ts=qo;function zo({children:n,onBlur:i,onChange:e,className:t,defaultValue:s,name:o,value:a,disabled:r,"data-testid":c}){const d=u.useCallback(h=>{e(h.target.value)},[e]);return l.jsx("select",{className:I("custom-select",t),onBlur:i,onChange:d,defaultValue:s,value:a,name:o,disabled:r,"data-testid":c,children:n})}class ns 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,r,c)=>{const d={height:a},h=o??s;return l.jsx("li",{className:"value-list-item",style:d,tabIndex:-1,children:l.jsx(Je,{checked:r,disabled:c,onChange:()=>this.handleSelect(e),children:h})},t)},{max:1e3}));p(this,"getCachedItems",Y((e,t,s,o)=>{const a=[];for(let r=0;r<e.length;r+=1){const c=e[r],{value:d,displayValue:h,isSelected:m}=c,g=s+r,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 r=t[a],{value:c}=r;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),r=Math.ceil(o/t);(this.topRow!==a||this.bottomRow!==r)&&(this.topRow=a,this.bottomRow=r,e(a,r))}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:r,rowHeight:c,"data-testid":d}=this.props,h=this.getCachedItems(o,c,r,t);return l.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:l.jsx("div",{className:"select-value-list",style:{height:a*c},children:l.jsx("ol",{className:"select-value-list-content",style:{position:"absolute",height:o.length*c,top:r*c,left:0},children:h})})})}}p(ns,"defaultProps",{disabled:!1,rowHeight:21,onBlur:()=>{},"data-testid":void 0});const ss=ns,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:r}){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=r,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 jn("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 jn("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),ge=Jo,Qo={COPY:ge.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[Q.CTRL,G.C],macShortcut:[Q.CMD,G.C],isEditable:!1}),PASTE:ge.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[Q.CTRL,G.V],macShortcut:[Q.CMD,G.V],isEditable:!1}),SAVE:ge.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[Q.CTRL,G.S],macShortcut:[Q.CMD,G.S],isEditable:!1}),SELECT_ALL:ge.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[Q.CTRL,G.A],macShortcut:[Q.CMD,G.A],isEditable:!1}),LINKER:ge.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[Q.CTRL,G.L],macShortcut:[Q.CMD,G.L]}),LINKER_CLOSE:ge.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:r,isInvalid:c,onClick:d,onMouseEnter:h,onMouseLeave:m,style:g,"data-testid":b}=n;return l.jsxs("button",{ref:i,type:"button",className:I("btn-socketed",{"btn-socketed-linked":a!==void 0&&a||r},{"btn-socketed-linked-source":r},{"is-invalid":c},t),id:o,onClick:d,onMouseEnter:h,onMouseLeave:m,style:g,disabled:s,"data-testid":b,children:[e,l.jsx(Z,{icon:di,className:"linked btn-socketed-icon",transform:"down-1"}),l.jsx(Z,{icon:hi,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}=qs,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",is={"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(is["handle-size"],10),mn=parseInt(is["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,r]=u.useState(n),[c,d]=u.useState(i),h=u.useRef(null);u.useEffect(function(){r(n),d(i)},[n,i]);const m=u.useCallback((S,E)=>{let x=S,P=E;x===P&&(P<X?P+=1:x-=1),r(x),d(P),e({startTime:x,endTime:P})},[r,d,e]),g=u.useCallback(S=>{m(S,c)},[m,c]),b=u.useCallback(S=>{m(a,S)},[m,a]);return l.jsxs("div",{className:"time-slider","data-testid":o,children:[l.jsx(pa,{startTime:a,endTime:c,onStartTimeChange:g,onEndTimeChange:b,isStartModified:t,isEndModified:s}),l.jsxs("div",{className:"track",ref:h,children:[l.jsx(ma,{startTime:a,endTime:c}),l.jsx("div",{className:"ticks",children:Array(24).fill(null).map((S,E)=>l.jsx("div",{className:"tick"},E))}),l.jsx(gn,{track:h,time:a,setTime:g}),l.jsx(gn,{track:h,time:c,setTime:b})]}),l.jsxs("div",{className:"tick-labels",children:[l.jsx("div",{className:"tick-label",children:"0:00"}),l.jsx("div",{className:"tick-label-wrapper",children:Array(24).fill(null).map((S,E)=>l.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":r}=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 l.jsxs("div",{className:"time-slider-popovers",children:[l.jsx("div",{className:"flex",style:{flexBasis:`calc(${d/X*100}% - ${mn/2}px)`}}),l.jsxs("div",{className:"handle-popper",children:[l.jsx("label",{className:I({modified:c?a:o}),children:c?"End Time":"Start Time"}),l.jsx(Qe,{ref:b,allowValueWrapping:!1,value:d,onChange:P,onSelect:C,"data-testid":r!==void 0?`${r}-input-1`:void 0})]}),l.jsx("div",{className:"flex-spacer"}),l.jsxs("div",{className:"handle-popper",children:[l.jsx("label",{className:I({modified:c?o:a}),children:c?"Start Time":"End Time"}),l.jsx(Qe,{ref:S,allowValueWrapping:!1,value:m,onChange:U,onSelect:k,"data-testid":r!==void 0?`${r}-input-2`:void 0})]}),l.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 l.jsxs("div",{className:"track-fills","data-testid":t,children:[i>e&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"track-fill track-fill-start",style:{transform:`scaleX(${e/X})`}}),l.jsx("div",{className:"track-fill track-fill-end",style:{transform:`scaleX(${(X-i)/X})`}})]}),i<e&&l.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]),r=u.useCallback(({clientX:g})=>{t(a(g))},[t,a]),c=u.useCallback(({clientX:g})=>{t(a(g)),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",c),document.documentElement.classList.remove("drag-pointer-events-none")},[t,a,r]),d=u.useCallback(()=>{window.addEventListener("mousemove",r),window.addEventListener("mouseup",c),document.documentElement.classList.add("drag-pointer-events-none")},[r,c]),h=u.useCallback(()=>{window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",c),document.documentElement.classList.remove("drag-pointer-events-none")},[r,c]),m=u.useCallback(()=>{d()},[d]);return u.useEffect(function(){return()=>{h()}},[h]),l.jsx("div",{className:"handle-track",style:{transform:o},children:l.jsx("button",{className:"handle",type:"button","aria-label":"Change time",onMouseDown:m,"data-testid":s})})}function os({buttons:n,isShown:i=!1,classNames:e,message:t,type:s,onClick:o,onDismiss:a,"data-testid":r}){const c=n&&n.length!==0;return l.jsx(Ce,{in:i,timeout:oe.transitionMs,classNames:"toast-notification-slide-up",mountOnEnter:!0,unmountOnExit:!0,children:l.jsxs("div",{className:I("toast-notification",e,s),role:"presentation",onClick:o,onKeyPress:o,"data-testid":r,children:[l.jsx("div",{className:"message-container",children:l.jsx("span",{className:"message",children:t})}),l.jsx(Ce,{in:c,timeout:oe.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:l.jsx("div",{className:"buttons-container",children:n})}),a&&l.jsx(ee,{kind:"ghost",icon:Tn,tooltip:"Close notification",className:"my-2",onClick:a})]})})}os.TYPE=Object.freeze({ERROR:"error"});function fa(n){const{children:i,className:e,labelText:t,hintText:s,isModified:o,validationError:a,showValidationError:r=!0,"data-testid":c,id:d}=n,{current:h}=u.useRef(d??pe());return l.jsxs(l.Fragment,{children:[l.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})}):l.jsx("div",{className:I(e),children:m})),s!==void 0&&l.jsx("small",{className:"form-text text-muted",children:s}),a!==void 0&&r&&l.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:kn,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:qn,EditableItemList:Oo,GLOBAL_SHORTCUTS:Yo,HierarchicalCheckboxMenu:Ao,InfoModal:Ji,ItemList:ne,ItemListItem:Qn,KEY:G,LoadingOverlay:Oe,LoadingSpinner:Mn,MODIFIER:Q,MaskedInput:at,Menu:Ro,MenuItem:es,Modal:kt,ModalBody:Dt,ModalFooter:$n,ModalHeader:In,Option:Po,Page:Lo,Popper:Ae,RadioGroup:Fo,RadioItem:Uo,RandomAreaPlotAnimation:ts,SearchInput:it,Select:zo,SelectValueList:ss,Shortcut:we,ShortcutRegistry:ge,SocketedButton:ea,Stack:jo,ThemeExport:oe,TimeInput:Qe,TimeSlider:ha,ToastNotification:os,Tooltip:Ot,UISwitch:Yn,ValidateLabelInput:fa,fillToLength:Hn,themeDHDefault:la,trimTrailingMask:yt},Symbol.toStringTag,{value:"Module"})),ba=Object.freeze(Object.defineProperty({__proto__:null,ApiBootstrap:pi,ApiContext:mi,ClientBootstrap:Dn,ClientContext:bi,useApi:ve,useClient:Ve},Symbol.toStringTag,{value:"Module"})),as=1e4;function Ca(n,i,e=as){return new Promise((t,s)=>{let o;const a=setTimeout(()=>{o==null||o(),s(new On(`Variable ${i} not found`))},e);function r(c){const d=c.created.find(h=>h.title===i);d!=null&&(clearTimeout(a),o==null||o(),t(d))}o=n.subscribeToFieldUpdates(r)})}const ft=F.module("MessageUtils"),rs="io.deephaven.message.LoginOptions.request",ls="io.deephaven.message.SessionDetails.request",cs="io.deephaven.broadcast",Vt="io.deephaven.broadcast.Login",us="io.deephaven.broadcast.Logout";function rt(n){const i=n;return i!=null&&typeof i.id=="string"&&typeof i.message=="string"}function ds(n){return rt(n)&&n.message===Vt}function hs(n){return rt(n)&&n.message===us}function ps(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=r=>{const{data:c}=r;if(!ps(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 On("Request timed out"))},i),window.opener.postMessage(Bt(n,o),"*")})}class ms extends Error{constructor(){super(...arguments);p(this,"isNoConsolesError",!0)}}function fs(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 gs(n,i){Te.info("Getting console types...");const e=await n.getConsoleTypes();if(e.length===0)throw new ms("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(ls);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 gs(n,i)}catch(t){if(!fs(t))throw t}return e}const Ta=F.module("ViewportDataUtils");function bs(n,i){return String(n.offsetInSnapshot+i)}function Cs(n,i){return function(t){const{columns:s,offset:o,rows:a}=t.detail;Ta.debug("table updated",t.detail),a.forEach(r=>{const c=i(r,s),d={key:bs(r,o),item:c};n.getItem(d.key)!=null?n.update(d.key,d):n.append(d)})}}function vs(n,i){return i.reduce((e,t)=>(e[t.name]=n.get(t),e),{})}function*xs(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 Ss(n,i,e,t){const s=n+i-1,[o,a]=[0,t-1],r=vt(n-e,o,a),c=vt(s+e,o,a);return[r,c]}const Na=Object.freeze(Object.defineProperty({__proto__:null,BROADCAST_CHANNEL_NAME:cs,BROADCAST_LOGIN_MESSAGE:Vt,BROADCAST_LOGOUT_MESSAGE:us,BooleanColumnFormatter:Ci,CharColumnFormatter:vi,DateTimeColumnFormatter:xi,DateUtils:Si,DecimalColumnFormatter:yi,DefaultColumnFormatter:Ei,FETCH_TIMEOUT:as,Formatter:An,FormatterUtils:xt,IntegerColumnFormatter:Ii,LOGIN_OPTIONS_REQUEST:rs,NoConsolesError:ms,SESSION_DETAILS_REQUEST:ls,StringColumnFormatter:wi,TableColumnFormatter:Ti,TableUtils:Rn,createConnection:xa,createCoreClient:Sa,createKeyFromOffsetRow:bs,createOnTableUpdatedHandler:Cs,createSessionWrapper:gs,defaultRowDeserializer:vs,fetchVariableDefinition:Ca,generateEmptyKeyedItems:xs,getColumnFormats:Mi,getDateTimeFormatterOptions:Ni,getItemsFromListData:Ma,getSessionDetails:Ia,getSize:Kt,isBroadcastLoginMessage:ds,isBroadcastLogoutMessage:hs,isClosed:lt,isCustomColumnFormatDefined:ki,isMessage:rt,isNoConsolesError:fs,isResponse:ps,loadSessionWrapper:wa,makeMessage:Bt,makeResponse:va,padFirstAndLastRow:Ss,requestParentResponse:Ht},Symbol.toStringTag,{value:"Module"})),bn=F.module("useTableListener"),ka=(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=ka;class Da extends Error{constructor(){super(...arguments);p(this,"isColumnNameError",!0)}}const Oa=Da;class Aa extends Error{constructor(){super(...arguments);p(this,"isTableDisconnectError",!0)}}const Ra=Aa,Ge=F.module("useTable"),La=(n,i,e,t)=>{const s=ve(),[o,a]=u.useState(void 0),[r,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 Oa("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 Ra("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:r,error:m??d}},ys=La,ja=(n,i,e,t)=>{const s=u.useMemo(()=>[t],[t]),{columns:o=[],data:a=[],error:r}=ys(n,i,e,s);return{column:o[0],data:a[0],error:r}},Es=ja;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:r=()=>!1,table:c}=n,d=u.useRef(null),h=ve(),m=u.useMemo(()=>{const y=xt.getColumnFormats(t),j=xt.getDateTimeFormatterOptions(t),{defaultDecimalFormatOptions:V={},defaultIntegerFormatOptions:H={}}=t;return new An(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}=Es(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))&&r()},[r]),_=$.length===0;return l.jsxs("div",{ref:d,className:I("table-input-container d-flex flex-column position-relative",i),children:[l.jsx(it,{disabled:!!w||_,value:g,placeholder:"Search",onChange:A,className:"mb-2 d-flex",onBlur:L}),l.jsx(ss,{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&&l.jsxs("div",{className:"meta-row",children:[l.jsx("div",{className:"d-flex align-items-center text-muted small",children:x!=null&&x.size>C&&l.jsxs(l.Fragment,{children:["Table is too large, showing the first ",gt," items."]})}),l.jsxs("div",{children:[l.jsx("button",{type:"button",className:"btn btn-link",onBlur:L,onClick:N,children:"Select All"}),l.jsx("button",{type:"button",className:"btn btn-link mr-a",onBlur:L,onClick:M,children:"Clear"})]})]}),x==null||w&&l.jsx("div",{className:"h-100 w-100 position-absolute",children:l.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=cs){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=>{ds(t.data)?n==null||n(t.data):hs(t.data)&&(i==null||i(t.data))},[n,i]);Gt(e)}const et="io.deephaven.web.client.auth.refreshToken",Is=u.createContext(null),Pa=F.module("RefreshTokenUtils");function It(){const n=De.get(et);try{if(n!=null)return JSON.parse(n)}catch(i){Pa.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 ws({children:n}){const i=ve(),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),l.jsx(Is.Provider,{value:t,children:n})}const vn=F.module("useDebouncedViewportSearch"),Fa=200;function Ua(n,i,e=Fa){const t=ve(),s=u.useMemo(()=>new Rn(t),[t]),{table:o,applyFiltersAndRefresh:a}=n,r=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"),r.cancel()},[r]),r}function qt(n){const[,i]=u.useState(0);return ke(n,dh.Table.EVENT_SIZECHANGED,()=>{i(e=>e+1)}),Kt(n)}function Ts(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,...xs(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}=Fn(e,[]);return u.useEffect(()=>()=>{t==null||t.close()},[t]),{distinctTable:t,error:s,isError:o,isLoading:a}}function Ms(n,i,e){return u.useCallback(function(s){const[o,a]=Ss(s,i,e,Kt(n));n==null||n.setViewport(o,a)},[n,e,i])}function _a(n){u.useEffect(()=>()=>{n!=null&&(lt(n)||n.close())},[n])}function Va({table:n,viewportSize:i=10,viewportPadding:e=50,deserializeRow:t=vs}){const s=Ts(n),o=Ms(n,i,e),a=u.useCallback(d=>{n==null||n.applyFilter(d),o(0)},[o,n]),r=ve();ke(n,r.Table.EVENT_UPDATED,Cs(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 Ba=Object.freeze(Object.defineProperty({__proto__:null,REFRESH_TOKEN_KEY:et,RefreshTokenBootstrap:ws,RefreshTokenContext:Is,TableInput:Wt,readRefreshToken:It,storeRefreshToken:wt,useBroadcastChannel:Gt,useBroadcastLoginListener:ct,useDebouncedViewportSearch:Ua,useInitializeViewportData:Ts,useSelectDistinctTable:$a,useSetPaddedViewportCallback:Ms,useTable:ys,useTableClose:_a,useTableColumn:Es,useTableListener:ke,useTableSize:qt,useViewportData:Va},Symbol.toStringTag,{value:"Module"})),Ns=u.createContext(!1);function Ha({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)})},[]),l.jsxs(l.Fragment,{children:[l.jsx(Ns.Provider,{value:e,children:i}),l.jsx("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:n.map(s=>l.jsx("p",{className:s,children:"preload"},s))})]})}function ks(n){if(n==null)return!1;const i=n;return i.Component!==void 0&&typeof i.isAvailable=="function"}const Ds="io.deephaven.auth.AnonymousAuthenticationHandler",Ka="io.deephaven.authentication.psk.PskAuthenticationHandler";class Wa extends Error{constructor(){super(...arguments);p(this,"name","AuthenticationError");p(this,"isAuthenticationError",!0)}}const Os=Wa,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 r=!1;function c(){if(r)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(!r){xn.error("Unable to login:",h);const m=_e(h)??"Unable to login. Verify credentials.";s(new Os(m)),a(!1)}}}return d(),()=>{r=!0}},[e,i]),o?l.jsx(l.Fragment,{children:n}):l.jsx(Oe,{"data-testid":"auth-base-loading",isLoading:t==null,isLoaded:!1,errorMessage:_e(t)})}const Ga=u.createContext({}),Zt=u.createContext({}),qa={canLogout:!1};function za({children:n}){const i=ve(),e=u.useCallback(()=>({type:i.CoreClient.LOGIN_TYPE_ANONYMOUS}),[i]);return l.jsx(zt,{getLoginOptions:e,children:l.jsx(Zt.Provider,{value:qa,children:n})})}const Za={Component:za,isAvailable:n=>n.includes(Ds)},As=Za,Xa=F.module("AuthPluginParent"),Ja={canLogout:!1};function Qa(n){return n!=null&&typeof n.type=="string"}async function Ya(){Xa.info("Logging in by delegating to parent window...");const n=await Ht(rs);if(!Qa(n))throw new Error(`Unexpected login options response: ${n}`);return n}function er(){return new URLSearchParams(window.location.search).get("authProvider")??""}function tr({children:n}){return l.jsx(zt,{getLoginOptions:Ya,children:l.jsx(Zt.Provider,{value:Ja,children:n})})}const nr={Component:tr,isAvailable:()=>window.opener!=null&&er()==="parent"},Rs=nr;function Ls({children:n,errorMessage:i,isLoggingIn:e=!1,onSubmit:t}){return l.jsxs("form",{className:"login-form",onSubmit:s=>{s.preventDefault(),s.stopPropagation(),t==null||t(s)},children:[l.jsx("div",{className:"flex-spacer"}),l.jsxs("div",{className:"flex-wrapper",children:[l.jsx("fieldset",{disabled:e,className:"container-fluid",children:n}),l.jsx("div",{className:"form-group d-flex justify-content-end align-items-center mb-0",children:l.jsxs("button",{type:"submit",className:I("btn btn-primary",{"btn-spinner":e},{"btn-cancelable":e}),"data-testid":"btn-login",children:[e&&l.jsxs("span",{children:[l.jsx(Mn,{}),l.jsx("span",{className:"btn-normal-content",children:"Logging in"}),l.jsx("span",{className:"btn-hover-content",children:"Cancel"})]}),!e&&"Login"]})})]}),l.jsx("div",{className:"flex-spacer",children:i!=null&&l.jsx("p",{className:"error-message mb-0",role:"alert",children:`${i}`})})]})}function js({children:n,logoPath:i="./logo.png"}){return l.jsxs("div",{className:"login-container",children:[l.jsx(ts,{}),l.jsxs("div",{className:"login-box",children:[l.jsx("div",{className:"logo",children:l.jsx("img",{src:i,alt:"Deephaven Data Labs"})}),n,l.jsxs("p",{className:"footer",children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})}const Tt="io.deephaven.authentication.psk.PskAuthenticationHandler",Ps="psk",Mt="io.deephaven.web.client.auth.psk.token",Me=F.module("AuthPluginPsk");function sr(){return new URLSearchParams(window.location.search).get(Ps)}function ir(){Me.debug2("clearWindowToken");const n=new URL(window.location.href);n.searchParams.delete(Ps),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 or({children:n,logoPath:i}){const e=Ve(),t=u.useRef(null),s=u.useRef(null),[o,a]=u.useState(),[r,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 Os($))}}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=sr()??Sn();if(ir(),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,r]),l.jsxs(l.Fragment,{children:[d&&n,r&&l.jsx(Ce,{in:!d,timeout:oe.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:l.jsx(js,{logoPath:i,children:l.jsx(Ls,{errorMessage:_e(o),isLoggingIn:m,onSubmit:C,children:l.jsxs("div",{className:"form-group",children:[l.jsx("label",{htmlFor:"auth-psk-token-input",children:"Token"}),l.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)}})]})})})}),l.jsx(Oe,{"data-testid":"auth-psk-loading",isLoaded:d||r,isLoading:!d&&!r})]})}const ar={Component:or,isAvailable:n=>n.includes(Tt)},Fs=ar,rr=Object.freeze(Object.defineProperty({__proto__:null,AUTH_HANDLER_TYPE_ANONYMOUS:Ds,AUTH_HANDLER_TYPE_PSK:Ka,AuthPluginAnonymous:As,AuthPluginBase:zt,AuthPluginParent:Rs,AuthPluginPsk:Fs,Login:js,LoginForm:Ls,UserOverrideContext:Ga,UserPermissionsOverrideContext:Zt,isAuthPlugin:ks},Symbol.toStringTag,{value:"Module"})),Us={react:T,"react-dom":yn,redux:Zs,"react-redux":Xs,"@deephaven/auth-plugins":rr,"@deephaven/components":ga,"@deephaven/jsapi-bootstrap":ba,"@deephaven/jsapi-components":Ba,"@deephaven/jsapi-utils":Na,"@deephaven/log":ji,"@deephaven/react-hooks":Zi},lr=En.createRequires(()=>Us),cr=En.createRemoteComponent({requires:lr}),ur=cr,dr=Js.createRequires(Us),hr=Qs({requires:dr}),pr=hr,he=F.module("@deephaven/app-utils.PluginUtils");function Ar(n,i){const e=new URL(`${i}.js`,n),t=T.forwardRef((s,o)=>l.jsx(ur,{url:e.href,render:({err:a,Component:r})=>{if(a!=null&&a!==""){const c=`Error loading plugin ${i} from ${e} due to ${a}`;return he.error(c),l.jsx("div",{className:"error-message",children:`${c}`})}return l.jsx(r,{ref:o,...s})}}));return t.pluginName=i,t.displayName="Plugin",t}async function mr(n){return await pr(n)}async function fr(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 gr(n){he.debug("Loading plugins...");try{const i=await fr(`${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:r}=i.plugins[o],c=`${n}/${a}/${r}`;e.push(mr(c))}const t=await Promise.allSettled(e),s=new Map;for(let o=0;o<t.length;o+=1){const a=t[o],{name:r}=i.plugins[o];a.status==="fulfilled"?s.set(r,a.value):he.error(`Unable to load plugin ${r}`,a.reason)}return he.info("Plugins loaded:",s),s}catch(i){return he.error("Unable to load plugins:",i),new Map}}function br(n){var i;return((i=n.get("AuthHandlers"))==null?void 0:i.split(","))??[]}function Cr(n,i,e){const t=br(i),s=[...n.entries()].filter(([,c])=>ks(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,r]=o[0];return he.info("Using LoginPlugin",a),r.Component}const Xt=u.createContext(null);function vr({pluginsUrl:n,children:i}){const[e,t]=u.useState(null);return u.useEffect(function(){let o=!1;async function a(){const r=await gr(n);o||t(r)}return a(),()=>{o=!0}},[n]),l.jsx(Xt.Provider,{value:e,children:i})}function xr(){const n=Gt();return u.useEffect(function(){n.postMessage(Bt(Vt))},[n]),null}const Sr=new Map([["@deephaven/auth-plugins.AuthPluginPsk",Fs],["@deephaven/auth-plugins.AuthPluginParent",Rs],["@deephaven/auth-plugins.AuthPluginAnonymous",As]]);function yr({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 r=u.useMemo(()=>{if(!(e==null||t==null))try{return Cr(e,t,Sr)}catch(d){a(d)}},[t,e]),c=r==null||t==null;return c||o!=null?l.jsx(Oe,{isLoading:c&&o==null,errorMessage:_e(o)}):l.jsx(r,{authConfigValues:t,children:l.jsxs(l.Fragment,{children:[l.jsx(xr,{}),n]})})}function Rr(n){return new URL(n,`${window.location}`)}function Er(){return new URLSearchParams(window.location.search).get("envoyPrefix")}function Ir(){const n=Er();return n!=null?{headers:{"envoy-prefix":n}}:{headers:{}}}function wr({children:n}){return u.useContext(Ns)?l.jsx(l.Fragment,{children:n}):l.jsx(Oe,{"data-testid":"fonts-loaded-loading"})}function Lr({fontClassNames:n,pluginsUrl:i,serverUrl:e,children:t}){const s=u.useMemo(()=>Ir(),[]),[o,a]=u.useState(0),r=u.useCallback(()=>{},[]),c=u.useCallback(()=>{a(d=>d+1)},[]);return ct(r,c),l.jsx(Ha,{fontClassNames:n,children:l.jsx(vr,{pluginsUrl:i,children:l.jsx(Dn,{serverUrl:e,options:s,children:l.jsx(ws,{children:l.jsx(yr,{children:l.jsx(Oi,{children:l.jsx(wr,{children:t})})})})},o)})})}function jr(){return Nn(Xt,"No Plugins available in usePlugins. Was code wrapped in PluginsBootstrap or PluginsContext.Provider?")}export{Lr as AppBootstrap,yr as AuthBootstrap,Oi as ConnectionBootstrap,Ur as ConnectionContext,Ha as FontBootstrap,wr as FontsLoaded,Ns as FontsLoadedContext,vr as PluginsBootstrap,Xt as PluginsContext,ur as RemoteComponent,br as getAuthHandlers,Cr as getAuthPluginComponent,Rr as getBaseUrl,Ir as getConnectOptions,Er as getEnvoyPrefix,Ar as loadComponentPlugin,fr as loadJson,mr as loadModulePlugin,gr as loadModulePlugins,$r as useConnection,jr as usePlugins};
9
+ //# sourceMappingURL=index-843cf23f.js.map