@deephaven/embed-chart 0.38.1-beta.0 → 0.38.1-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +0,0 @@
1
- var Ps=Object.defineProperty;var Fs=(n,i,e)=>i in n?Ps(n,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[i]=e;var p=(n,i,e)=>(Fs(n,typeof i!="symbol"?i+"":i,e),e);import{A as u,B as f,G as I,P as Us,C as r,D as be,E as S,R as Cn,M as Mt,K as qe,L as Q,F as q,N as Ce,O as $s,Q as _s,S as Vs,T as Bs,U as Hs,V as Ct,$ as Ks,W as Me,X as Ws,Y as Gs,Z as qs,_ as vn,a0 as zs,a1 as Zs}from"./vendor-b7e5da9f.js";import{T as oe,L as U,c as Xs,e as Js,M as Nt,f as kt,g as xn,h as Qs,i as Ys,j as ei,k as ti,l as ni,m as yn,n as si,o as ii,p as oi,q as ai,r as ri,s as En,t as li,u as ci,b as Ne,w as Sn,A as ui,x as di}from"./index-2cf14df3.js";import{c as In,d as G,i as ht,e as wn,a as hi,C as pi,f as Tn,g as mi,h as Ye,j as Ue,k as Mn,B as fi,l as gi,m as bi,D as Ci,n as vi,o as xi,b as Nn,F as vt,I as yi,S as Ei,p as Si,T as Ii,q as wi,r as Ti,t as Mi,P as Qt,v as Ni,w as ki}from"./useConnection-44488217.js";import{x as Or,u as Dr}from"./useConnection-44488217.js";import"./helpers-042e6b4d.js";class xt 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=I.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 Us(s||a,this.element,o),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t&&!this.element.contains(document.activeElement)){const l=this.element.firstElementChild;l instanceof HTMLElement&&l.focus()}}),this.setState({popper:e})}destroyPopper(e=!0){cancelAnimationFrame(this.rAF);const{popper:t}=this.state;t&&(t.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),this.setState({show:!0})}hide(){this.setState({show:!1})}scheduleUpdate(){const{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){const{onEntered:e}=this.props;e()}handleExit(){const{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){const{className:e,children:t,timeout:s,interactive:o,closeOnBlur:a}=this.props,{show:l}=this.state;return r.jsx(be,{in:l,timeout:s,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:r.jsx("div",{onClick:c=>{c.stopPropagation()},onKeyDown:c=>{c.key==="Escape"&&this.hide()},className:S("popper",{interactive:o},e),onBlur:a?this.handleBlur:void 0,tabIndex:a?-1:void 0,role:"presentation",children:r.jsxs("div",{className:"popper-content",children:[t,r.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})}render(){const{popper:e}=this.state,{"data-testid":t}=this.props;return r.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&Cn.createPortal(this.renderContent(),this.element)})}}p(xt,"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(xt,"defaultProps",{options:{},className:"",timeout:oe.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0});const ke=xt;var H=(n=>(n.DEBUG="D",n.LOG="L",n.WARN="W",n.ERROR="E",n.UNCAUGHT_ERROR="U",n))(H||{});function Oe(n,i){return new CustomEvent(n,{detail:i})}class Oi{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(Oe("U",e))});this.debug=console.debug,this.log=console.log,this.warn=console.warn,this.error=console.error,this.eventTarget=new Mt}enable(){this.isEnabled||(console.debug=(...i)=>{this.eventTarget.dispatchEvent(Oe("D",i)),this.debug.apply(console,i)},console.log=(...i)=>{this.eventTarget.dispatchEvent(Oe("L",i)),this.log.apply(console,i)},console.warn=(...i)=>{this.eventTarget.dispatchEvent(Oe("W",i)),this.warn.apply(console,i)},console.error=(...i)=>{this.eventTarget.dispatchEvent(Oe("E",i)),this.error.apply(console,i)},window.addEventListener("error",this.handleUncaughtError),U.setLogLevel(U.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),U.setLogLevel(U.level),this.isEnabled=!1)}addEventListener(i,e){this.eventTarget.addEventListener(i,e)}removeEventListener(i,e){this.eventTarget.removeEventListener(i,e)}}const Di=Oi;class ze{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 H.ERROR:t=t.splice(i[0]==="Error"?4:3);break;case H.UNCAUGHT_ERROR:t=t.splice(i[0]==="Error"?3:2);break}return t!=null?` ${t.join(`
3
- `)}`:""}enable(){this.isEnabled||(this.proxy.addEventListener(H.DEBUG,this.addHistory),this.proxy.addEventListener(H.LOG,this.addHistory),this.proxy.addEventListener(H.WARN,this.addHistory),this.proxy.addEventListener(H.ERROR,this.addHistory),this.proxy.addEventListener(H.UNCAUGHT_ERROR,this.addHistory),this.isEnabled=!0)}disable(){this.isEnabled&&(this.proxy.removeEventListener(H.DEBUG,this.addHistory),this.proxy.removeEventListener(H.LOG,this.addHistory),this.proxy.removeEventListener(H.WARN,this.addHistory),this.proxy.removeEventListener(H.ERROR,this.addHistory),this.proxy.removeEventListener(H.UNCAUGHT_ERROR,this.addHistory),this.isEnabled=!1)}addHistory({type:i,detail:e}){const t={type:i,messages:e,time:new Date};switch(i){case H.ERROR:case H.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} ${ze.formatMessages(e.messages)}`+(e.stack!=null?`
4
- ${ze.formatStack(e.stack,e.type)}`:"")).join(`
5
- `)}}const Ai=ze,Ri=Object.freeze(Object.defineProperty({__proto__:null,Log:U,LogHistory:Ai,LogProxy:Di,Logger:Xs,LoggerLevel:Js,default:U},Symbol.toStringTag,{value:"Module"})),Li=U.module("Tooltip"),W=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=I.createRef(),this.popper=I.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}static handleHidden(){W.shownTooltipCount-=1,W.shownTooltipCount===0&&(W.lastHiddenTime=Date.now())}static handleShown(){W.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?W.handleShown():W.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();const{isShown:e}=this.state;e&&W.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){Li.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){this.parent&&(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){const{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){const{isShown:e}=this.state;this.stopTimer();const{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){const t=e.clientX,s=e.clientY,{isShown:o}=this.state;if(!this.popper.current||!this.parent)return;const a=this.popper.current.element.getBoundingClientRect(),l=this.parent.getBoundingClientRect();t>=a.left&&t<=a.left+a.width&&s>=a.top&&s<=a.top+a.height?this.handleMouseMove():t>=l.left&&t<=l.left+l.width&&s>=l.top&&s<=l.top+l.height?this.handleMouseMove():o&&(this.stopTimer(),this.hide())}startTimer(){this.stopTimer();const{timeout:e,reshowTimeout:t}=this.props;let s=e;(W.shownTooltipCount>0||Date.now()-W.lastHiddenTime<W.triggerReshowThreshold)&&(s=t),this.timer=window.setTimeout(this.handleTimeout,s)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var t;const{isShown:e}=this.state;if(this.stopTimer(),!e){(t=this.popper.current)==null||t.show(),this.setState({isShown:!0});const{interactive:s}=this.props;s&&this.startListeningWindow()}}hide(){var e;(e=this.popper.current)==null||e.hide(),this.stopListeningWindow()}update(){var e;(e=this.popper.current)==null||e.scheduleUpdate()}handleExited(){this.setState({isShown:!1});const{onExited:e}=this.props;e()}stopShowingTooltip(){const{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){const{interactive:e,children:t,referenceObject:s,popperClassName:o,"data-testid":a,onEntered:l}=this.props,{isShown:c}=this.state;let{options:d}=this.props;return d={placement:"bottom",...d},r.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":a,children:r.jsx(ke,{className:S(o),options:d,ref:this.popper,onEntered:l,onExited:this.handleExited,interactive:e,referenceObject:s,children:r.jsxs("div",{className:"tooltip-content",children:[" ",c&&t]})})})}};let re=W;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:W.defaultReshowTimeout,timeout:W.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});const Ot=re;const ji=100;var kn=(n=>(n.UP="UP",n.DOWN="DOWN",n))(kn||{});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",Q((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=qe(this.updateInputValue,ji),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=I.createRef(),this.cbContainer=I.createRef(),this.menuContainer=I.createRef(),this.input=I.createRef()}setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}getValueAndValidate(e){if(!e)return this.setState({invalid:!1}),{value:e,isValid:!1};const{options:t}=this.props,s=t.filter(o=>o.title.toLowerCase()===e.toLowerCase());return s.length<1?(this.setState({invalid:!0}),{value:e,isValid:!1}):(this.setState({invalid:!1}),{value:s[0].value,isValid:!0})}updateInputValue(e){const{menuIsOpen:t}=this.state,{value:s,isValid:o}=this.getValueAndValidate(e);t&&this.processFilterChange(e),this.fireOnChange(s,o)}fireOnChange(e,t=!0){const{onChange:s}=this.props;s(e,t)}processFilterChange(e){var l;const{options:t}=this.props,{menuIsOpen:s}=this.state,o=e?this.getCachedFilteredOptions(t,e):t,a=o.length===1&&o[0].title===e;if(this.setState({filteredOptions:o,keyboardOptionIndex:0}),a&&s){this.closeMenu();return}(l=this.popper.current)==null||l.scheduleUpdate()}resetValue(){this.setState({title:""}),this.fireOnChange("")}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var a;const{filteredOptions:t,keyboardOptionIndex:s}=this.state,o=t[s];switch(e.key){case"Enter":case"ArrowRight":e.stopPropagation(),e.preventDefault(),o!=null&&(this.setState({title:o.title,invalid:!1}),this.fireOnChange(o.value)),this.closeMenu(),(a=this.input.current)==null||a.focus();break;case"ArrowUp":e.stopPropagation(),e.preventDefault(),this.navigateMenu(ce.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":e.stopPropagation(),e.preventDefault(),this.navigateMenu(ce.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(e.stopPropagation(),e.preventDefault(),e.shiftKey){this.navigateMenu(ce.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(ce.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.closeMenu();break}}navigateMenu(e){const{filteredOptions:t,keyboardOptionIndex:s}=this.state;let o=s;e===ce.MENU_NAVIGATION_DIRECTION.UP?s>0?(o=(o-1)%t.length,this.setState({keyboardOptionIndex:o})):s===0&&(o=t.length-1,this.setState({keyboardOptionIndex:o})):e===ce.MENU_NAVIGATION_DIRECTION.DOWN&&s<t.length&&(o=(o+1)%t.length,this.setState({keyboardOptionIndex:o})),this.scrollOptionIntoView(o)}handleInputKeyDown(e){const{onEnter:t}=this.props,{menuIsOpen:s}=this.state;s?this.handleMenuKeyDown(e):e.key==="Enter"?t():e.key==="Escape"?(this.resetValue(),e.preventDefault(),e.stopPropagation()):e.key==="ArrowRight"||e.key==="ArrowLeft"||e.key==="Tab"||e.key==="Shift"||this.openMenu()}handleInputChange(e){this.setState({title:e.target.value}),this.updateInputValue(e.target.value)}handleOptionClick(e){var t;this.setState({title:e.title,invalid:!1}),this.fireOnChange(e.value),this.closeMenu(),(t=this.input.current)==null||t.focus()}handelInputFocus(){const{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputClick(){const{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputBlur(e){const{menuIsOpen:t}=this.state;t&&e.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuBlur(e){e.relatedTarget===this.input.current||e.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){var e;(e=this.input.current)==null||e.focus()}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}openMenu(){const{title:e}=this.state;this.processFilterChange(e),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{var t;(t=this.popper.current)==null||t.show()})}closeMenu(e=!0){var t,s;this.setState({menuIsOpen:!1,keyboardOptionIndex:0}),e&&((t=this.input.current)==null||t.focus()),(s=this.popper.current)==null||s.hide()}scrollOptionIntoView(e){var t;this.menuContainer.current&&((t=this.menuContainer.current.children.item(e))==null||t.scrollIntoView({behavior:"smooth",block:"nearest"}))}renderMenuElement(){const{inputWidth:e}=this.state;return r.jsx("div",{className:S("aci-options"),ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,style:{width:e},onBlur:this.handleMenuBlur,children:this.renderOptions()})}renderOptions(){const{noMatchText:e}=this.props,{title:t,filteredOptions:s}=this.state;return t&&s.length===0?r.jsx("div",{className:"no-match",children:e}):s.map((o,a)=>this.renderOption(o,a))}renderOption(e,t){const{keyboardOptionIndex:s}=this.state,o=`option-${t}-${e.value}`;return r.jsx("button",{type:"button",className:S("aci-option-btn",{"keyboard-active":s===t}),onClick:()=>this.handleOptionClick(e),onFocus:()=>this.setState({keyboardOptionIndex:t}),children:e.title},o)}render(){const{options:e,inputPlaceholder:t,disabled:s,className:o,defaultTitle:a,spellCheck:l,"data-testid":c}=this.props,{title:d,menuIsOpen:h,popperOptions:m,invalid:g}=this.state;return r.jsxs("div",{className:"aci-container",ref:this.cbContainer,children:[r.jsx("input",{value:d||a,className:S("form-control",o,"aci-input",{"is-invalid":g&&!h}),ref:this.input,onChange:this.handleInputChange,placeholder:t||e[0].title,disabled:s,onFocus:this.handelInputFocus,onClick:this.handleInputClick,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:l,"data-testid":c}),r.jsx(ke,{ref:this.popper,options:m,className:S("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}};let ye=ce;p(ye,"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(ye,"defaultProps",{onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0}),p(ye,"MENU_NAVIGATION_DIRECTION",kn);const Pi=ye;function Dt({className:n="",value:i,onChange:e,spellCheck:t=!1,placeholder:s="",disabled:o=!1,delimiter:a="",id:l="","data-testid":c}){const[d,h]=u.useState(i),[m,g]=u.useState(!1),b=u.useRef(null);u.useEffect(function(){h(i)},[i]);function E(k){return k.trim().split(a).filter(N=>N).join(`
6
- ${a.trim()}`)}function x(k){return k.split(`
7
- `).map(N=>N.trim()).join(" ")}function w(){if(!b.current)return;b.current.style.height="0";const k=b.current.scrollHeight+(b.current.offsetHeight-b.current.clientHeight);k>0&&(b.current.style.height=`${k}px`)}function j(k){let N=k.target.value;m&&(a&&(N=E(N)),g(!1)),h(N),e(N)}function $(){b.current&&(a&&(h(E(d)),w()),b.current.scrollLeft=0)}function v(){b.current&&document.activeElement!==b.current&&b.current.focus()}function A(){a&&(h(x(d)),e(x(d)))}function D(){g(!0)}return u.useEffect(function(){w()},[d]),r.jsx("textarea",{ref:b,id:l,className:S(n,"auto-resize-textarea form-control"),placeholder:s,value:d,rows:1,onChange:j,onFocus:$,onMouseDown:v,onBlur:A,onPaste:D,spellCheck:t,disabled:o,"data-testid":c})}Dt.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};Dt.defaultProps={className:"",id:"",placeholder:"",disabled:!1,spellCheck:!1,delimiter:"","data-testid":void 0};function $e(n){const{children:i,className:e,style:t,"data-testid":s}=n;return r.jsx("div",{className:S("btn-group",e),style:t,role:"group","data-testid":s,children:i})}$e.displayName="ButtonGroup";$e.propTypes={children:f.node.isRequired,className:f.string,style:f.object,"data-testid":f.string};$e.defaultProps={className:null,style:{},"data-testid":void 0};const Fi=["primary","secondary","tertiary","success","danger","inline","ghost"],Ui=["group-end"];function $i(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 S("btn-link",{"btn-link-icon":i,"btn-link-icon-only":i})}}function _i(n){switch(n){case"group-end":return S("pl-2","pr-3")}}const et=I.forwardRef((n,i)=>{const{kind:e,variant:t,type:s,tooltip:o,icon:a,disabled:l=!1,active:c,onClick:d,onContextMenu:h,onMouseDown:m,onMouseUp:g,onMouseEnter:b,onMouseLeave:E,onKeyDown:x,className:w,style:j,children:$,tabIndex:v,"data-testid":A,"aria-label":D}=n,k=Boolean(a&&$==null),N=$i(e,k);let B;t&&(B=_i(t));let ne;a&&(ne=I.isValidElement(a)?a:r.jsx(q,{icon:a}));let R;o!==void 0&&(R=typeof o=="string"?r.jsx(Ot,{children:o}):o);let L=D;D===void 0&&k&&o!=null&&typeof o=="string"&&(L=o);const _=r.jsxs("button",{"data-testid":A,ref:i,type:s,className:S("btn",N,B,{active:c},w),onClick:d,onContextMenu:h,onMouseUp:g,onMouseDown:m,onMouseEnter:b,onMouseLeave:E,onKeyDown:x,style:j,disabled:l,tabIndex:v,"aria-label":L,children:[a&&ne,$,o!=null&&!l&&R]});return l?r.jsxs("span",{className:"btn-disabled-wrapper",children:[_,o!==void 0&&R]}):_});et.displayName="Button";et.propTypes={kind:f.oneOf(Fi).isRequired,variant:f.oneOf(Ui),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&&!I.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};et.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 Y=et;function On(n){const i=u.useRef();return u.useEffect(function(){i.current=n}),i.current}function At(n){const i=u.useRef(null);return u.useEffect(function(){n&&(typeof n=="function"?n(i.current):n.current=i.current)}),i}const Vi=()=>{};async function Bi(n){const{clipboard:i}=navigator;if(i!==void 0)try{return navigator.clipboard.writeText(n)}catch{return Yt(n)}Yt(n)}function Yt(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 Dn extends CustomEvent{constructor(i,e){super(i,e)}}function Fe(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 Rt{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(!Rt.isValidRange(i))throw new Error(`Invalid range! ${i}`)}static isSelected(i,e){for(let t=0;t<i.length;t+=1){const s=i[t],o=s[0],a=s[1];if(o<=e&&e<=a)return!0}return!1}static selectRange(i,e){let[t,s]=e;const o=[...i];for(let a=o.length-1;a>=0;a-=1){const l=o[a],c=l[0],d=l[1];if(c<=t&&s<=d)return o;t<=d&&c<=s&&(t=Math.min(t,c),s=Math.max(s,d),o.splice(a,1))}return o.push([t,s]),o}static deselectRange(i,e){const[t,s]=e,o=[...i];for(let a=o.length-1;a>=0;a-=1){const l=o[a],c=l[0],d=l[1];if(!(s<c||d<t))if(c<t&&s<d){o[a]=[c,t-1],o.splice(a+1,0,[s+1,d]);break}else t<=c&&d<=s?o.splice(a,1):c<t?o[a]=[c,t-1]:o[a]=[s+1,d]}return o}static count(i){return i.reduce((e,t)=>e+(t[1]-t[0]+1),0)}static getItemsInRanges(i,e){return e.reduce((t,s)=>{const o=[...t];for(let a=s[0];a<=s[1];a+=1)o.push(i[a]);return o},[])}}const ie=Rt,zt=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(zt.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 De=zt;p(De,"TIME_PATTERN","([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]"),p(De,"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 Ae=De,Hi=3500,Ki=U.module("useCopyToClipboard");function An(){const[n,i]=u.useState(!1),e=u.useRef(null),t=u.useCallback(s=>{Bi(s).then(()=>{i(!0)}).catch(o=>Ki.error(`Unable to copy ${s}`,`
8
- `,o))},[]);return u.useEffect(()=>(e.current&&clearTimeout(e.current),n&&(e.current=setTimeout(()=>{i(!1)},Hi)),()=>{e.current&&clearTimeout(e.current)}),[n]),[n,t]}function Rn(n,i,{autoLoad:e=!0}={}){const[t,s]=u.useState(null),[o,a]=u.useState(null),[l,c]=u.useState(!1),d=u.useCallback(async()=>{c(!0);try{const h=await n(...i);s(h),a(null)}catch(h){s(null),a(h)}finally{c(!1)}},[n,...i]);return u.useEffect(()=>{e&&d()},[e,d]),{data:t,error:o,isError:o!=null,isLoading:l,reload:d}}function Ln(n,i){const[e,t]=u.useState(n);return u.useEffect(()=>{const s=setTimeout(()=>{t(n)},i);return()=>{clearTimeout(s)}},[n,i]),e}const Wi=Object.freeze(Object.defineProperty({__proto__:null,useContextOrThrow:In,useCopyToClipboard:An,useDebouncedValue:Ln,useForwardedRef:At,usePrevious:On,usePromiseFactory:Rn},Symbol.toStringTag,{value:"Module"}));function Gi({blockInteraction:n=!0,children:i,debounceMs:e,isOpen:t=!1}){const s=Ln(t,e);return r.jsxs(r.Fragment,{children:[n&&t&&r.jsx("div",{className:"modal-backdrop",style:{backgroundColor:"transparent"},"data-testid":"debounced-modal-backdrop"}),I.cloneElement(i,{isOpen:t&&s})]})}function qi({className:n,icon:i,isOpen:e=!1,subtitle:t,title:s}){return r.jsx(Nt,{isOpen:e,className:n,children:r.jsx(kt,{children:r.jsxs("div",{className:"info-modal",children:[i!=null&&r.jsx("div",{className:"message-icon",children:r.jsx(q,{icon:i})}),r.jsx("div",{className:"message-header",children:s}),t!=null&&r.jsx("div",{className:"message-content",children:t})]})})})}function jn({className:n="modal-footer",children:i,"data-testid":e}){return r.jsx("div",{className:n,"data-testid":e,children:i})}function Lt(n){const{isOpen:i,headerText:e,bodyText:t,onCancel:s,onConfirm:o,onDiscard:a,onModalDisable:l,cancelButtonText:c="Cancel",confirmButtonText:d="Okay",discardButtonText:h="Discard",isConfirmDanger:m=!1,children:g,"data-testid":b}=n,E=u.useRef(null),x=u.useRef(null),w=u.useCallback(()=>{x.current!==null&&x.current.checked&&l&&l(),o()},[o,l]),j=u.useCallback(()=>{var v;(v=E.current)==null||v.focus()},[]);let $="";return i&&($=typeof t=="function"?t():t),r.jsxs(Nt,{isOpen:i,className:"theme-bg-light",onOpened:j,children:[r.jsx(xn,{closeButton:!1,children:e}),r.jsx(kt,{children:$}),r.jsxs(jn,{children:[l&&r.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[r.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:x,"data-testid":b!==void 0?`${b}-checkbox-confirm`:void 0}),r.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),a&&r.jsx(Y,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:a,"data-testid":b!==void 0?`${b}-btn-discard`:void 0,children:h}),s&&r.jsx(Y,{kind:"secondary","data-dismiss":"modal",onClick:s,"data-testid":b!==void 0?`${b}-btn-cancel`:void 0,children:c}),r.jsxs($e,{children:[r.jsx(Y,{kind:m?"danger":"primary",onClick:w,ref:E,"data-testid":b!==void 0?`${b}-btn-confirm`:void 0,children:d}),g]})]})]})}Lt.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};Lt.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};const tt=I.forwardRef((n,i)=>{const{children:e,className:t,disabled:s,onClick:o,style:a,id:l}=n;return r.jsx("button",{ref:i,type:"button",className:S("btn",t),onClick:o,style:a,disabled:s,id:l,children:e})});tt.displayName="Button";tt.propTypes={children:f.node,className:f.string,disabled:f.bool,onClick:f.func,style:f.shape({}),id:f.string};tt.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const zi=tt;function Zi({className:n,isFlipped:i,children:e,"data-testid":t}){const s=c=>{if(e.length!==2)throw new Error("CardFlip requires 2 children to function");return e[c]},o=u.useRef(null),a=u.useCallback(c=>{c.target===c.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),l=u.useCallback(c=>{c.target===c.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return u.useEffect(function(){if(!o.current)throw Error("ref undefined");o.current.addEventListener("transitionstart",a);const d=o.current;return function(){if(d!=null)return d.removeEventListener("transitionstart",a)}},[a]),r.jsxs("div",{className:S(n,{"card-flip--show-front":i,"card-flip--show-back":!i}),"data-testid":t,children:[r.jsx("div",{className:"card-flip--back",children:s(0)}),r.jsx("div",{ref:o,className:"card-flip--front",onTransitionEnd:l,children:s(1)})]})}const en=U.module("GlobalContextAction");class Xi 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),en.debug("Received context menu event at global action! Menu items are now: ",e.contextActions))}handleKeyDown(i){var t;const{action:e}=this.props;!G.actionsDisabled&&e.shortcut!==void 0&&e.shortcut.matchesEvent(i)&&(en.debug("Global hotkey matched!",i),(t=e.action)==null||t.call(e,i),i.preventDefault(),i.stopPropagation())}render(){return null}}const Ji=Xi;class Qi extends u.Component{render(){const{actions:i,"data-testid":e}=this.props,t=[];for(let s=0;s<i.length;s+=1){const o=i[s],{shortcut:a}=o;if(o.title!=null||o.menuElement||a){const l=r.jsx(Ji,{action:o,"data-testid":e},`${o.title}.${a==null?void 0:a.id}`);t.push(l)}}return t}}const Yi=Qi;const _e=U.module("ContextActions");class Pn extends u.Component{constructor(e){super(e);p(this,"container");this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=I.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=>!ht(o)&&typeof o!="function"&&o.isGlobal),s=e.actions.filter(o=>!ht(o)&&typeof o!="function"&&(o.isGlobal===void 0||!o.isGlobal)&&o.shortcut!=null);return{globalActions:t,keyboardActions:s}}componentDidMount(){var e;(e=this.container.current)!=null&&e.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){var e;(e=this.container.current)!=null&&e.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}handleContextMenu(e){const{ignoreClassNames:t=[]}=this.props;if(t.length>0){let o=e.target;for(;o!=null;){const{classList:a}=o,l=t.find(c=>a.contains(c));if(l!==void 0){_e.debug2(`Contextmenu event ignored based on the target className "${l}"`);return}o=o.parentElement}}if(G.isContextActionEvent(e)||(e.contextActions=[]),!G.isContextActionEvent(e))return;const{actions:s}=this.props;if(s!=null){let o=s;Array.isArray(o)&&(o=o.filter(a=>ht(a)||typeof a=="function"||a.isGlobal===void 0||!a.isGlobal)),e.contextActions=e.contextActions.concat(o)}_e.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];!G.actionsDisabled&&a.shortcut!=null&&a.shortcut.matchesEvent(e)&&(_e.debug("Context hotkey matched!",e),(s=a.action)==null||s.call(a,e),e.stopPropagation(),e.preventDefault(),_e.debug2("Matched hotkey returned false, key event not consumed"))}}render(){const{"data-testid":e}=this.props,{globalActions:t}=this.state;return r.jsx("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:r.jsx(Yi,{actions:t})})}}p(Pn,"groups",{default:null,high:100,medium:5e3,low:1e4,global:1e5,edit:100});const eo=Pn,ue=class extends u.Component{static handleEnter(i){const e=i;e.style.height="0"}static handleEntering(i){const e=i;e.style.height=`${ue.getHeight(e)}px`}static handleExiting(i){const e=i;e.style.height="0"}static handleExit(i){const e=i;e.style.height=`${ue.getHeight(e)}px`}static getHeight(i){const e=i.scrollWidth-i.clientWidth;return i.scrollHeight-e}constructor(i){super(i),this.handleEntered=this.handleEntered.bind(this)}handleEntered(i){const e=i;e.style.height="";const{autoFocusOnShow:t}=this.props;if(t!==void 0&&t){const s=e.querySelector("input, select, textarea");s!=null&&s.focus()}}render(){const{children:i,className:e,in:t,"data-testid":s}=this.props;return r.jsx(be,{in:t,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:ue.handleEnter,onEntering:ue.handleEntering,onEntered:this.handleEntered,onExit:ue.handleExit,onExiting:ue.handleExiting,timeout:350,children:o=>r.jsx("div",{className:S({collapse:o==="exited"},e),"data-testid":s,children:i})})}};let Re=ue;p(Re,"propTypes",{className:f.string,in:f.bool.isRequired,children:f.node.isRequired,autoFocusOnShow:f.bool,"data-testid":f.string}),p(Re,"defaultProps",{className:"",autoFocusOnShow:!1,"data-testid":void 0});const to=Re,nt=I.forwardRef((n,i)=>{const{checked:e=!1,children:t,className:s,disabled:o,inputClassName:a,isInvalid:l,labelClassName:c,name:d,onChange:h,"data-testid":m}=n,[g]=u.useState(Ce()),b=At(i);u.useEffect(function(){b.current&&(b.current.indeterminate=e===null)},[b,e]);const E=u.useCallback(x=>{b.current&&(b.current.indeterminate=e===null),h&&h(x)},[b,e,h]);return r.jsxs("div",{className:S("custom-control custom-checkbox",s),children:[r.jsx("input",{type:"checkbox",ref:b,checked:e??!1,className:S("custom-control-input",a,{"is-invalid":l}),disabled:o,id:g,name:d,onChange:E,"data-testid":m}),r.jsx("label",{className:S("custom-control-label",c),htmlFor:g,children:t})]})});nt.displayName="Checkbox";nt.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};nt.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const Ze=nt;class Fn extends u.PureComponent{constructor(e){super(e);p(this,"inputField");this.inputField=I.createRef()}focus(){var e;(e=this.inputField.current)==null||e.focus()}render(){const{value:e,placeholder:t,onBlur:s,onChange:o,className:a,disabled:l,matchCount:c,id:d,onKeyDown:h,"data-testid":m}=this.props;return r.jsxs("div",{className:S("search-group",a),children:[r.jsx("input",{type:"search",value:e,onBlur:s,onChange:o,onKeyDown:h,className:"form-control",disabled:l,placeholder:t,ref:this.inputField,id:d,"data-testid":m}),c!=null&&r.jsx("span",{className:"search-match",children:c}),r.jsx("span",{className:"search-icon",children:r.jsx(q,{icon:Qs})})]})}}p(Fn,"defaultProps",{placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0});const st=Fn;var Un=(n=>(n.UP="UP",n.DOWN="DOWN",n))(Un||{});const Te=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",Q((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=I.createRef(),this.cbContainer=I.createRef(),this.toggleButton=I.createRef(),this.menuContainer=I.createRef(),this.input=I.createRef(),this.searchInput=I.createRef()}componentDidUpdate(){const{menuIsOpen:e,keyboardOptionIndex:t}=this.state;e&&t>=0&&this.scrollOptionIntoView()}setInputWidth(){this.cbContainer.current&&this.setState({inputWidth:this.cbContainer.current.getBoundingClientRect().width})}focus(){var e;(e=this.input.current)==null||e.focus()}resetValue(){this.setState({value:""})}updateInputValue(e){const{onChange:t}=this.props;this.setState({value:e}),t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var c,d;const{filter:t,filteredOptions:s,keyboardOptionIndex:o}=this.state,{options:a}=this.props,l=t?s:a;switch(e.key){case"Enter":((c=l[o])==null?void 0:c.value)!=null&&this.updateInputValue(l[o].value),this.closeMenu(),(d=this.input.current)==null||d.focus(),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(Te.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(Te.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":t!==""?(this.setState({filter:""}),e.stopPropagation()):this.closeMenu();break;case"Tab":!e.shiftKey&&o===l.length-1&&this.closeMenu();break}}handleMenuNavigation(e){const{filter:t,filteredOptions:s,keyboardOptionIndex:o}=this.state,{options:a}=this.props,c=(t?s:a).length;let d=0;switch(e){case Te.MENU_NAVIGATION_DIRECTION.UP:d=-1;break;case Te.MENU_NAVIGATION_DIRECTION.DOWN:d=1;break}d!==0&&this.setState({keyboardOptionIndex:(o+d+c)%c})}handleInputKeyDown(e){const{onEnter:t}=this.props,{menuIsOpen:s}=this.state;e.key==="ArrowDown"||e.key==="ArrowUp"?s||this.openMenu():e.key==="Enter"&&t()}handleInputChange(e){this.updateInputValue(e.target.value)}handleOptionClick(e){var c;const t=Number(e.currentTarget.value),{filter:s,filteredOptions:o}=this.state,{options:a}=this.props,l=s?o:a;this.updateInputValue(l[t].value),this.closeMenu(),(c=this.input.current)==null||c.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleFilterChange(e){var a;const{options:t}=this.props,s=e.target.value,o=this.getCachedFilteredOptions(t,s);this.setState({filter:s,filteredOptions:o,keyboardOptionIndex:0}),(a=this.popper.current)==null||a.scheduleUpdate()}handleMenuBlur(e){e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||e.relatedTarget===this.toggleButton.current||this.closeMenu(!1)}handleInputBlur(e){const{menuIsOpen:t}=this.state;t&&e.relatedTarget instanceof Element&&this.popper.current!=null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){var e;this.scrollOptionIntoView(),(e=this.searchInput.current)==null||e.focus()}handleMenuExited(){var t;const{menuIsOpen:e}=this.state;e&&(this.setState({menuIsOpen:!1}),(t=this.popper.current)==null||t.hide()),this.setState({filter:""})}toggleMenu(e){const{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{var e;(e=this.popper.current)==null||e.show()})}closeMenu(e=!0){var t,s;this.setState({menuIsOpen:!1}),e&&((t=this.input.current)==null||t.focus()),(s=this.popper.current)==null||s.hide()}updateKeyboardIndex(){const{value:e,filter:t,filteredOptions:s}=this.state,{options:o}=this.props,l=(t?s:o).findIndex(c=>c.value===e);this.setState({keyboardOptionIndex:l})}scrollOptionIntoView(){var t;const e=(t=this.menuContainer.current)==null?void 0:t.querySelector(".cb-option-btn.keyboard-active");e instanceof HTMLElement&&e.scrollIntoView({block:"nearest",inline:"nearest"})}renderMenuElement(){const{searchPlaceholder:e}=this.props,{filter:t,inputWidth:s}=this.state;return r.jsxs("div",{className:"cb-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:o=>{o.stopPropagation()},style:{width:s},onBlur:this.handleMenuBlur,children:[r.jsx("div",{className:"cb-search-input-container",children:r.jsx(st,{value:t,ref:this.searchInput,onChange:this.handleFilterChange,className:"cb-search-input",placeholder:e})}),r.jsx("div",{className:"cb-options-container",children:r.jsx("div",{className:"cb-options",children:this.renderOptions()})})]})}renderOptions(){const{options:e}=this.props,{keyboardOptionIndex:t,filter:s,filteredOptions:o}=this.state;return(s?o:e).map((l,c)=>{const d=`option-${c}-${l.value}`;return r.jsx("button",{type:"button",value:c,className:S("cb-option-btn",{"keyboard-active":t===c}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:l.title},d)})}render(){const{options:e,inputPlaceholder:t,disabled:s,className:o,defaultValue:a,spellCheck:l,"data-testid":c}=this.props,{value:d}=this.state;let{popperOptions:h}=this.props;return h={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...h},r.jsxs("div",{className:"input-group cb-container",ref:this.cbContainer,children:[r.jsx("input",{value:d||a,className:S("form-control",o,"cb-input"),ref:this.input,onChange:this.handleInputChange,placeholder:t||(e[0]!=null?e[0].title:void 0),disabled:s,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:l,"data-testid":c!==void 0?`${c}-input`:void 0}),r.jsx("div",{className:"input-group-append cb-dropdown",children:r.jsxs("button",{type:"button",className:"btn cb-btn form-control",ref:this.toggleButton,onClick:this.toggleMenu,onKeyDown:this.handleInputKeyDown,disabled:s,"data-testid":c!==void 0?`${c}-btn`:void 0,children:[r.jsx(q,{icon:Ys}),r.jsx(ke,{ref:this.popper,options:h,className:S("combobox interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})})]})}};let me=Te;p(me,"MENU_NAVIGATION_DIRECTION",Un),p(me,"DROP_DOWN_MENU_HEIGHT",200),p(me,"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(me,"defaultProps",{onChange(){},inputPlaceholder:"",searchPlaceholder:"Search",disabled:!1,className:"",defaultValue:"",popperOptions:null,spellCheck:!0,onEnter(){},"data-testid":void 0});const no=me;function so({copy:n,kind:i="ghost",tooltip:e="Copy",className:t,"data-testid":s,children:o}){const[a,l]=An();return r.jsx(Y,{kind:i,className:t,"data-testid":s,icon:a?ei:ti,tooltip:a?"Copied":e,onClick:()=>{l(typeof n=="function"?n():n)},children:o})}function it(n,i,e){return n.substring(0,i)+e+n.substring(i+1)}function $n(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 ee=U.module("MaskedInput"),ve={FORWARD:"forward",BACKWARD:"backward",NONE:"none"},Ve=" ",_n=I.forwardRef((n,i)=>{const{className:e,example:t,getNextSegmentValue:s=(M,T,C)=>C,getPreferredReplacementString:o=it,onChange:a=()=>!1,onSelect:l=()=>!1,onSubmit:c,pattern:d,placeholder:h,selection:m,value:g,onFocus:b=()=>!1,onBlur:E=()=>!1,"data-testid":x}=n,w=At(i),j=u.useMemo(()=>Array.isArray(t)?t:[t],[t]),$=u.useMemo(()=>j[0].replace(/[a-zA-Z0-9]/g,Ve),[j]);u.useEffect(function(){var T;if(m!=null){ee.debug("setting selection...",m);const{selectionStart:C,selectionEnd:P,selectionDirection:O}=m;(T=w.current)==null||T.setSelectionRange(C,P,O),ee.debug("selection set!")}},[m,w]);const v=u.useCallback(M=>{let T=M,C=M;const P=j.length>0?j[0]:g;for(let y=T-1;y>=0&&/[a-zA-Z0-9]/g.test(P.charAt(y));y-=1)T=y;for(let y=C;y<P.length&&/[a-zA-Z0-9]/g.test(P.charAt(y));y+=1)C=y+1;const O=T===C?ve.NONE:ve.BACKWARD;return{selectionStart:T,selectionEnd:C,selectionDirection:O}},[j,g]);function A(M,T,C=M.length){let P="";for(let O=0;O<C;O+=1)M.charAt(O)!==Ve?P=P.concat(M[O]):P=P.concat(T[O]);return P=P.concat(T.substring(C)),P}function D(M,T=M.length){const C=new RegExp(`^${d}$`);if(C.test(M))return!0;for(let P=0;P<j.length;P+=1){const O=A(M,j[P],T);if(C.test(O))return!0}return!1}function k(M){const T=v(M),C=T.selectionEnd+1;return C>=g.length?T:v(C)}function N(M){const T=v(M),C=T.selectionStart-1;return C<=0?T:v(C)}function B(M,T){const C=v(M),P=g.substring(C.selectionStart,C.selectionEnd),O=s(C,T,P,g),y=g.substring(0,C.selectionStart)+O+g.substring(C.selectionEnd);D(y,C.selectionEnd)&&(a(y),l(C))}const ne=u.useCallback(M=>{const{selectionStart:T=0,selectionEnd:C=0,selectionDirection:P="none"}=M.target;if(T===null||C===null||P===null){ee.error("Selection attempted on non-text input element",M.target);return}if(ee.debug2("handleSelect",T,C,P),!(m!=null&&T===m.selectionStart&&C===m.selectionEnd)){if(m!=null&&T===g.length&&C===g.length&&M.nativeEvent.type!=="mouseup"){l({...m});return}if(T===C){const O=v(T);ee.debug("Selection segment from ",T,C,"=>",O),l(O)}else l({selectionStart:T,selectionEnd:C,selectionDirection:P})}},[v,l,m,g]),R=u.useCallback(M=>{if(!w.current)return;ee.debug("handleSelectCapture",M);const T=w.current.selectionStart??0;T===g.length&&m!=null&&T!==m.selectionStart&&(M.preventDefault(),M.stopPropagation())},[w,m,g]);function L(M){if(M.preventDefault(),M.stopPropagation(),!w.current)return;const{key:T}=M,{selectionStart:C=0,selectionEnd:P=0}=w.current;if(C===null||P===null){ee.error("Selection arrow nvaigation attempted on non-text input element",M.target);return}T==="ArrowLeft"?l(N(C)):T==="ArrowRight"?l(k(P)):T==="ArrowUp"?B(C,-1):T==="ArrowDown"&&B(C,1)}function _(M){if(!w.current)return;ee.debug("handleKeyDown",M);const{key:T}=M,{selectionStart:C=0,selectionEnd:P=0}=w.current;if(C===null||P===null){ee.error("Selection key event on non-text input element",M.target);return}if(T==="Enter"){c==null||c(M);return}if(T.startsWith("Arrow")){L(M);return}if(T==="Delete"||T==="Backspace"){if(M.preventDefault(),M.stopPropagation(),P>=yt(g,$).length){const y=g.substring(0,C===P?C-1:C),F=yt(y,$);F!==g&&(a(F),l({selectionStart:F.length,selectionEnd:F.length,selectionDirection:ve.NONE}));return}if(C!==P){const y=g.substring(0,C)+g.substring(C,P).replace(/[a-zA-Z0-9]/g,Ve)+g.substring(P);ee.debug("Range ",C,P,"deleted, setting value",y),a(y),l({selectionStart:C,selectionEnd:C,selectionDirection:ve.NONE})}else if(C>0)for(let y=C-1;y>=0;y-=1){const F=g.substring(0,y)+g.substring(y,C).replace(/[a-zA-Z0-9]/g,Ve)+g.substring(C);if(F!==g){a(F),l({selectionStart:y,selectionEnd:y,selectionDirection:ve.NONE});return}}return}if(M.altKey||M.metaKey||M.ctrlKey||T.length>1)return;M.preventDefault(),M.stopPropagation();const O=Array.from(new Set([T,T.toUpperCase(),T.toLowerCase()]));for(let y=0;y<O.length;y+=1){const F=O[y],X=/[a-zA-Z0-9]/g.test(F)?j[0].length-1:C;for(let z=C;z<=X;z+=1){const js=$n(g,j[0],z+1),ct=o(js,z,F,C,P);if(D(ct,z+1)){const Xt=v(z),ut=z+1;let dt={selectionStart:ut,selectionEnd:ut,selectionDirection:ve.NONE};if(ut>=Xt.selectionEnd){const Jt=k(z);Jt.selectionStart!==Xt.selectionStart&&(dt=Jt)}ee.debug("handleKeyDown",T,"=>",ct,dt),a(ct),l(dt);return}}}}return r.jsx("input",{ref:w,className:S("form-control masked-input",e),type:"text",pattern:d,placeholder:h,value:g,onChange:()=>{},onKeyDown:_,onSelect:ne,onSelectCapture:R,onFocus:b,onBlur:E,"data-testid":x})});_n.defaultProps={className:"",placeholder:void 0,onChange(){},onSelect(){},getNextSegmentValue:(n,i,e)=>e,getPreferredReplacementString:it,selection:void 0,onFocus(){},onBlur(){},"data-testid":void 0};const ot=_n,io=U.module("TimeInput"),oo="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",ao=["00:00:00","12:34:56","23:59:59"],Vn=I.forwardRef((n,i)=>{const{allowValueWrapping:e=!0,className:t="",onChange:s=()=>!1,value:o=0,onFocus:a=()=>!1,onBlur:l=()=>!1,onSelect:c=()=>!1,"data-testid":d}=n,[h,m]=u.useState(Ae.formatTime(o)),[g,b]=u.useState(),E=u.useRef(null);u.useImperativeHandle(i,()=>({focus:()=>{var v;(v=E.current)==null||v.focus()},setSelection:v=>{var A;(A=E.current)==null||A.focus(),b(v)}}),[]),u.useEffect(function(){m(Ae.formatTime(o))},[o]);function x(v,A,D){const k=v.selectionStart===0?24:60;let N=parseInt(D,10)-A;return Number.isNaN(N)?N=0:e?N=(N%k+k)%k:N=Math.min(Math.max(0,N),k-1),`${N}`.padStart(2,"0")}function w(v,A,D,k,N){return k===0&&N===2&&A===1&&parseInt(D,10)>1?`0${D}${v.substring(2)}`:it(v,A,D)}function j(v){io.debug("handleChange",v),m(v),Ae.isTimeString(v)&&s(Ae.parseTime(v))}const $=u.useCallback(v=>{b(v),c(v)},[c]);return r.jsx(ot,{ref:E,className:t,example:ao,getNextSegmentValue:x,getPreferredReplacementString:w,onChange:j,onSelect:$,pattern:oo,selection:g,value:h,onFocus:a,onBlur:l,"data-testid":d})});Vn.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const Xe=Vn;var bt;let ro=(bt=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=I.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=G.getMenuItems(e,!1);t.length>0&&this.setState(s=>({menuItems:G.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=G.getNextMenuItem(o??0,-1,t):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(o=G.getNextMenuItem(o??0,1,t)),s!==o&&(o!==null?this.setKeyboardIndex(o):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(e=!1){const{closeMenu:t,onMenuClosed:s}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),s(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation(),e!=null&&(e.disabled===void 0||!e.disabled)&&e.action!=null&&(e.action(),this.closeMenu(!0))}handleMenuItemMouseMove(e){const{menuItems:t}=this.state,s=t.indexOf(e);this.setMouseIndex(s)}handleMouseLeave(){this.setMouseIndex(-1)}render(){const e=[],{"data-testid":t}=this.props,{keyboardIndex:s,menuItems:o,mouseIndex:a}=this.state;for(let c=0;c<o.length;c+=1){const d=o[c];c>0&&d.group!==o[c-1].group&&e.push(r.jsx("hr",{},`${c}.separator`));const h=r.jsx(wn,{isKeyboardSelected:s===c,isMouseSelected:a===c,menuItem:d,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},c);e.push(h)}const{menuStyle:l}=this.props;return r.jsx("div",{className:"context-menu-container",style:{...l},ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}},p(bt,"defaultProps",{closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0}),bt);const lo=ro;class Bn 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=I.createRef(),this.parent=null,this.popper=I.createRef(),this.isOpen=!1}componentDidMount(){var t;const{isShown:e}=this.props;e===null?(t=this.container.current)!=null&&t.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick)):e&&this.openMenu()}componentDidUpdate(e){const{isShown:t}=this.props;e.isShown!==t&&(t!==null&&t?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}closeMenu(){var e;(e=this.popper.current)==null||e.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){var e;(e=this.popper.current)==null||e.scheduleUpdate()}handleClick(e){e.preventDefault(),e.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;const{onMenuClosed:e}=this.props;e()}render(){const{actions:e,onMenuOpened:t,popperClassName:s,"data-testid":o}=this.props,{menuStyle:a}=this.props;let{options:l,popperOptions:c}=this.props;return c={placement:"bottom",...c},l={separateKeyboardMouse:!0,...l},r.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":o,children:r.jsx(ke,{ref:this.popper,options:c,className:S("menu-popper",s),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:r.jsx(lo,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:l,menuStyle:a})})})}}p(Bn,"defaultProps",{isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0});const Hn=Bn;const tn=-1;var Kn=(n=>(n.UP="UP",n.DOWN="DOWN",n))(Kn||{});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=I.createRef(),this.menuContainer=I.createRef(),this.button=I.createRef(),this.input=I.createRef(),this.state={keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,customTime:s(t),inputFocused:!1}}getSelectedText(){const{options:e,value:t,placeholder:s}=this.props,{customTime:o}=this.state;if(t===null)return s;for(let a=0;a<e.length;a+=1){const l=e[a];if(l.value===t)return l.title}return Ae.formatTime(o)}setInputWidth(){this.csContainer.current&&this.setState({inputWidth:this.csContainer.current.getBoundingClientRect().width})}focus(){var e;(e=this.button.current)==null||e.focus()}updateInputValue(e){const{onChange:t}=this.props;t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var a;const{keyboardOptionIndex:t,inputFocused:s}=this.state,{options:o}=this.props;switch(e.key){case"Enter":case" ":s?this.updateFromCustom():this.updateInputValue(o[t].value),this.closeMenu(),(a=this.button.current)==null||a.focus(),e.stopPropagation(),e.preventDefault();break;case"Tab":e.shiftKey?this.handleMenuNavigation(se.MENU_NAVIGATION_DIRECTION.UP):this.handleMenuNavigation(se.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(se.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(se.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":this.closeMenu();break}}handleMenuNavigation(e){const{keyboardOptionIndex:t,inputFocused:s}=this.state,{options:o}=this.props,a=o.length;let l=t;switch(e){case se.MENU_NAVIGATION_DIRECTION.UP:if(!s&&t===0){this.focusInput();break}else s&&this.focusOption(t);t>0&&!s?(l=(l-1)%a,this.setState({keyboardOptionIndex:l})):t===0&&(l=a-1,this.setState({keyboardOptionIndex:l})),this.scrollOptionIntoView(l);break;case se.MENU_NAVIGATION_DIRECTION.DOWN:if(!s&&t===a-1){this.focusInput();break}else s&&this.focusOption(t);t<a&&!(s&&t===0)&&(l=(l+1)%a,this.setState({keyboardOptionIndex:l})),this.scrollOptionIntoView(l);break}}handleOptionClick(e){const t=Number(e.currentTarget.value),{options:s,timeToValue:o}=this.props,{customTime:a}=this.state;if(t===tn){const l=o(a);this.updateAndClose(l)}else this.updateAndClose(s[t].value)}updateAndClose(e){var t;this.updateInputValue(e),this.closeMenu(),(t=this.button.current)==null||t.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleMenuOpened(){var l;const{options:e,value:t}=this.props,{keyboardOptionIndex:s}=this.state;this.scrollOptionIntoView(s);const o=(l=this.menuContainer.current)==null?void 0:l.querySelector(".cs-option-btn.keyboard-active");if(o instanceof HTMLElement&&o.focus(),t===null)return;e.map(c=>c.value).indexOf(t)<0&&this.focusInput()}focusInput(){var e;(e=this.input.current)==null||e.focus()}focusOption(e){var s;const t=(s=this.menuContainer.current)==null?void 0:s.querySelector(".cs-options");if(t&&t.children!=null){const o=t.children.item(e);o instanceof HTMLElement&&o.focus()}}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}handleCustomInput(e){const{timeToValue:t}=this.props,s=t(e);this.updateInputValue(s),this.setState({customTime:e})}updateFromCustom(){const{timeToValue:e}=this.props,{customTime:t}=this.state,s=e(t);this.updateInputValue(s)}toggleMenu(e){const{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0})}closeMenu(e=!0){var t;this.setState({menuIsOpen:!1}),e&&((t=this.button.current)==null||t.focus())}updateKeyboardIndex(){const{options:e,value:t}=this.props;if(t===null)return;const s=e.map(o=>o.value).indexOf(t);s>0&&this.setState({keyboardOptionIndex:s})}scrollOptionIntoView(e){var s;const t=(s=this.menuContainer.current)==null?void 0:s.querySelector(".cs-options");if(t&&t.children!=null){const o=t.children.item(e);o instanceof HTMLElement&&o.offsetTop>se.DROP_DOWN_MENU_HEIGHT?t.scrollTop=o.offsetTop-se.DROP_DOWN_MENU_HEIGHT:(o instanceof HTMLElement&&o.offsetTop<0||e===0)&&(t.scrollTop=0)}}renderMenuElement(){const{inputWidth:e}=this.state;return r.jsx("div",{className:"cs-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:t=>{t.stopPropagation()},style:{width:e},children:r.jsx("div",{className:"cs-options-container",children:r.jsx("div",{className:"cs-options",children:this.renderOptions()})})})}renderOptions(){const{options:e,value:t,icon:s,customText:o}=this.props,{keyboardOptionIndex:a,customTime:l,inputFocused:c}=this.state;let d=!1;const h=[];for(let m=0;m<e.length;m+=1){const g=e[m],b=`option-${m}-${g.value}`;d=d||g.value===t,h.push(r.jsxs("button",{type:"button",value:m,className:S("cs-option-btn",{"keyboard-active":a===m&&!c}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[g.value===t&&r.jsx(q,{icon:s,className:"mr-2"}),g.value!==t&&r.jsx("span",{className:"mr-4"}),g.title]},b))}return h.push(r.jsx("hr",{className:"cs-divider"},"option-divider")),h.push(r.jsxs("button",{type:"button",value:tn,className:S("cs-option-btn",{"keyboard-active":c}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!d&&t!==null?r.jsx(q,{icon:s,className:"mr-2"}):r.jsx("span",{className:"mr-4"}),o]},"option-custom-label")),h.push(r.jsxs("div",{className:"cs-custom-container",children:[r.jsx("span",{className:"mr-2"}),r.jsx(Xe,{ref:this.input,onChange:this.handleCustomInput,value:l,onFocus:()=>this.setState({inputFocused:!0}),onBlur:()=>this.setState({inputFocused:!1})},"option-input"),r.jsx("span",{className:"ml-2"})]},"cs-custom-container")),h.push(r.jsx("hr",{className:"mb-2"},"option-end")),h}render(){const{disabled:e,invalid:t,value:s,"data-testid":o}=this.props,{menuIsOpen:a}=this.state;let{popperOptions:l}=this.props;return l={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...l},r.jsx("div",{className:"input-group cs-container context-menu",ref:this.csContainer,"data-testid":o,children:r.jsx("div",{className:S("input-group-append cs-dropdown",{"cs-dropdown-invalid":t}),children:r.jsxs("button",{type:"button",className:S("btn cs-btn form-control",{"cs-btn-invalid":t}),ref:this.button,onClick:this.toggleMenu,disabled:e,children:[r.jsx("span",{className:S({"text-muted":s===null}),children:this.getSelectedText()}),r.jsx("span",{children:r.jsx(q,{icon:yn,className:"cs-caret"})}),r.jsx(Hn,{isShown:a,actions:{menuElement:this.renderMenuElement()},popperOptions:l,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}};let Ee=se;p(Ee,"MENU_NAVIGATION_DIRECTION",Kn),p(Ee,"DROP_DOWN_MENU_HEIGHT",125),p(Ee,"defaultProps",{onChange(){},value:null,disabled:!1,popperOptions:{},icon:ni,customText:"Custom",placeholder:"Select a time",valueToTime:e=>e===null?0:Math.round(e/1e3),timeToValue:e=>e*1e3,invalid:!1,"data-testid":void 0});const co=Ee;function xe(n,i,e,t,s){const o=t-e+1;return`${((parseInt(i,10)-n-e)%o+o)%o+e}`.padStart(s,"0")}function Wn(n,i,e){const{selectionStart:t}=n;return t===0?xe(i,e,1900,2099,4):t===5?xe(i,e,1,12,2):t===8?xe(i,e,1,31,2):t===11?xe(i,e,0,23,2):t===17||t===14?xe(i,e,0,59,2):t===20||t===24||t===28?xe(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 uo=U.module("DateTimeInput"),ho="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",po="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\\.[0-9]{3}​[0-9]{3}​[0-9]{3}",mo=`${ho} ${po}`,Ke="2022-01-01",Gn=`${Ke} 00:00:00.000000000`,fo="YYYY-MM-DD HH:MM:SS.SSSSSSSSS";function nn(n){return n!=null&&n.length>=Ke.length?`${n.substring(0,Ke.length)}${n.substring(Ke.length).replace(/\u2007/g,"0")}${Gn.substring(n.length)}`:n}function sn(n){return n.replace(/\u200B/g,"")}const go=[Et(Gn)],jt=I.forwardRef((n,i)=>{const{className:e="",onChange:t=()=>{},defaultValue:s="",onFocus:o=()=>{},onBlur:a=()=>{},onSubmit:l,"data-testid":c}=n,[d,h]=u.useState(s.length>0?Et(s):""),[m,g]=u.useState(),b=u.useCallback(x=>{uo.debug("handleChange",x),h(x),t(nn(sn(x)))},[t]),E=u.useCallback(()=>{const x=sn(d),w=nn(x);w!==x&&h(Et(w)),a()},[d,a]);return r.jsx("div",{className:"d-flex flex-row align-items-center",children:r.jsx(ot,{ref:i,className:S(e),example:go,getNextSegmentValue:Wn,onChange:b,onSelect:g,onSubmit:l,pattern:mo,placeholder:fo,selection:m,value:d,onFocus:o,onBlur:E,"data-testid":c})})});jt.displayName="DateTimeInput";jt.defaultProps={className:"",onChange:()=>{},defaultValue:"",onFocus:()=>{},onBlur:()=>{},"data-testid":void 0};const bo=jt,Co=U.module("DateInput"),vo="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",xo=["2000-01-01","2022-12-31"],yo="YYYY-MM-DD",Pt=I.forwardRef((n,i)=>{const{className:e="",onChange:t=()=>{},defaultValue:s="",onFocus:o=()=>{},onBlur:a=()=>{},"data-testid":l}=n,[c,d]=u.useState(s),[h,m]=u.useState(),g=u.useCallback(b=>{Co.debug("handleChange",b),d(b),t(b)},[t]);return r.jsx("div",{className:"d-flex flex-row align-items-center",children:r.jsx(ot,{ref:i,className:S(e),example:xo,getNextSegmentValue:Wn,onChange:g,onSelect:m,pattern:vo,placeholder:yo,selection:h,value:c,onFocus:o,onBlur:a,"data-testid":l})})});Pt.displayName="DateInput";Pt.defaultProps={className:"",onChange:()=>!1,defaultValue:"",onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const Eo=Pt;class qn extends u.PureComponent{constructor(e){super(e);p(this,"searchInput");this.searchInput=I.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=qe(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){const{value:t}=this.props;e.value!==t&&this.setState({value:t})}focus(){var e;(e=this.searchInput.current)==null||e.focus()}handleChange(e){this.setState({value:e.target.value},this.sendUpdate)}sendUpdate(){const{onChange:e}=this.props,{value:t}=this.state;e(t)}render(){const{placeholder:e,className:t,matchCount:s,id:o,"data-testid":a}=this.props,{value:l}=this.state;return r.jsx(st,{value:l,placeholder:e,onChange:this.handleChange,className:t,matchCount:s,ref:this.searchInput,id:o,"data-testid":a})}}p(qn,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});const So=qn;const Io=U.module("ItemListItem"),Zt=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=I.createRef()}static handleKeyDown(){return Io.log("ItemListItem.handleKeyDown false"),!1}handleBlur(e){const{itemIndex:t,onBlur:s}=this.props;s(t,e)}handleFocus(e){const{itemIndex:t,onFocus:s}=this.props;s(t,e)}handleClick(e){const{itemIndex:t,onClick:s}=this.props;s(t,e)}handleContextMenu(e){const{itemIndex:t,onContextMenu:s}=this.props;s(t,e)}handleDragStart(e){const{itemIndex:t,onDragStart:s}=this.props;s(t,e)}handleDrag(e){const{itemIndex:t,onDrag:s}=this.props;s(t,e)}handleDragOver(e){e.preventDefault();const{itemIndex:t,onDragOver:s}=this.props;s(t,e)}handleDragEnd(e){const{itemIndex:t,onDragEnd:s}=this.props;s(t,e)}handleDrop(e){const{itemIndex:t,onDrop:s}=this.props;s(t,e)}handleDoubleClick(e){const{itemIndex:t,onDoubleClick:s}=this.props;s(t,e)}handleMouseMove(e){const{itemIndex:t,onMouseMove:s}=this.props;s(t,e)}handleMouseDown(e){const{itemIndex:t,onMouseDown:s}=this.props;s(t,e)}handleMouseUp(e){const{itemIndex:t,onMouseUp:s}=this.props;s(t,e)}render(){const{isDraggable:e,isFocused:t,isSelected:s,style:o,children:a,"data-testid":l}=this.props;return r.jsx("div",{className:S("item-list-item",{active:s},{"is-focused":t},{"is-draggable":e}),onKeyDown:Zt.handleKeyDown,onContextMenuCapture:this.handleContextMenu,onClick:this.handleClick,onDrag:this.handleDrag,onDragStart:this.handleDragStart,onDragOver:this.handleDragOver,onDragEnd:this.handleDragEnd,onDrop:this.handleDrop,onDoubleClick:this.handleDoubleClick,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,tabIndex:-1,ref:this.itemRef,role:"listitem",style:o,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:e,"data-testid":l,children:a})}};let We=Zt;p(We,"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 zn=We;const on=U.module("ItemList"),an=5,ge=class extends u.PureComponent{constructor(e){super(e);p(this,"list");p(this,"listContainer");p(this,"getItemSelected",Q((e,t)=>ie.isSelected(t,e),{max:ge.CACHE_SIZE}));p(this,"getCachedItem",Q((e,t,s,o,a,l,c,d)=>{const h=l({item:s,itemIndex:e,isFocused:o,isSelected:a,style:c});return r.jsx(zn,{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:ge.CACHE_SIZE}));p(this,"getOuterElement",Q(e=>{const t=I.forwardRef((s,o)=>r.jsx("div",{ref:o,tabIndex:-1,onKeyDown:e,role:"presentation",...s}));return t.displayName="ItemListOuterElement",t}));p(this,"getInnerElement",Q(()=>{const e=I.forwardRef((t,s)=>r.jsx("div",{className:"item-list-inner-element",ref:s,...t}));return e.displayName="ItemListInnerElement",e}));p(this,"getItemData",Q((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=I.createRef(),this.listContainer=I.createRef();const{isStickyBottom:t,selectedRanges:s}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:s,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null,mouseX:null,mouseY:null}}static renderItem({item:e}){return r.jsx("div",{className:"item-list-item-content",children:e!=null&&(e.displayValue??e.value??`${e}`)})}componentDidUpdate(e,t){const{selectedRanges:s,itemCount:o}=this.props,{focusIndex:a,isStuckToBottom:l,scrollOffset:c,height:d,selectedRanges:h}=this.state;if(l&&!this.isListAtBottom()&&o>0&&this.scrollToBottom(),(c!==t.scrollOffset||d!==t.height)&&this.sendViewportUpdate(),s!==e.selectedRanges&&s!==h)this.setSelectedRanges(s);else if(h!==t.selectedRanges){const{onSelectionChange:m}=this.props;m(h)}if(a!==t.focusIndex){const{onFocusChange:m}=this.props;m(a)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var e;(e=this.listContainer.current)==null||e.focus()}restoreScrollPosition(){var t;const{scrollOffset:e}=this.state;e!=null&&((t=this.listContainer.current)==null||t.scrollTo(0,e))}getElement(e){if(this.listContainer.current==null)return null;const{focusSelector:t}=this.props,{overscanStartIndex:s}=this.state,o=this.listContainer.current.querySelectorAll(t),a=e-s;return o[a]}focusItem(e){const{disableSelect:t}=this.props;if(t)return;this.setState({focusIndex:e});const s=this.getElement(e);s instanceof HTMLElement&&s.focus()}scrollToItem(e){const t=this.getElement(e);t!=null&&t.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){const{selectedRanges:s}=this.state,a=ie.isSelected(s,e)||G.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){on.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){on.debug2("item focus",e,t.target),this.setState(s=>{const{focusIndex:o}=s;return o!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){const{isDragSelect:s,isMultiSelect:o,disableSelect:a}=this.props,{mouseDownIndex:l,selectedRanges:c,mouseX:d,mouseY:h}=this.state;if(l==null||a)return;const m=Math.abs(t.clientX-(d??0)),g=Math.abs(t.clientY-(h??0));m>an&&g>an&&this.setState({isDragging:!0}),(s||l===e)&&(this.focusItem(e),o?(!s&&!this.getItemSelected(e,c)&&!G.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(l,e),Math.max(l,e)])):this.toggleSelect(e,t.shiftKey,G.isModifierKeyDown(t),!1))}handleItemMouseUp(e,t){const{isDeselectOnClick:s,isDoubleClickSelect:o,onSelect:a}=this.props,{mouseDownIndex:l,isDragging:c}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(l===e&&!c){const d=t.shiftKey,h=G.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,d,h,s),!o&&!d&&!h&&a(e,t)}this.resetMouseState()}}handleItemsRendered({overscanStartIndex:e}){this.setState({overscanStartIndex:e})}handleResize({height:e}){this.setState({height:e})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(e){var c;const{isMultiSelect:t,itemCount:s,onSelect:o}=this.props,{focusIndex:a}=this.state;let l=a;if(e.key==="Enter"||e.key===" "){!t&&l!=null&&this.setState({selectedRanges:[[l,l]]},()=>{l!=null&&o(l,e)});return}if(e.key==="ArrowUp")l!=null&&l>=0?l=Math.max(0,l-1):l=s-1;else if(e.key==="ArrowDown")l!=null&&l>=0?l=Math.min(l+1,s-1):l=0;else return;if(a!==l){e.stopPropagation(),e.preventDefault(),this.focusItem(l);const{selectedRanges:d}=this.state;if(e.shiftKey&&d.length>0){const h=d[d.length-1];this.selectRange([Math.min(l,h[0]),Math.max(l,h[1])])}else this.deselectAll(),l!==null?this.selectItem(l):(c=this.listContainer.current)==null||c.focus();this.scrollIntoView(l)}}handleScroll({scrollUpdateWasRequested:e,scrollOffset:t}){this.setState(s=>{if(e)return{scrollOffset:t};const{isStickyBottom:o}=this.props,{height:a}=s;return{isStuckToBottom:o&&this.isListAtBottom({scrollOffset:t,height:a}),scrollOffset:t}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){const{itemCount:e}=this.props;this.list.current&&this.list.current.scrollToItem(e)}scrollIntoView(e){this.list.current&&this.list.current.scrollToItem(e)}toggleSelect(e,t,s,o=!0){const{isMultiSelect:a}=this.props,{selectedRanges:l}=this.state;if(a&&t&&l.length>0){const c=l[l.length-1];this.selectRange([Math.min(c[0],e),Math.max(e,c[1])])}else a&&l.length===1&&l[0][0]===e&&l[0][1]===e?o&&this.deselectItem(e):a&&s?this.getItemSelected(e,l)?o&&this.deselectItem(e):this.selectItem(e):(this.deselectAll(),this.selectItem(e))}deselectAll(){const{itemCount:e}=this.props;this.deselectRange([0,e])}deselectItem(e){this.deselectRange([e,e])}deselectRange(e){ie.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:ie.deselectRange(t,e)}))}selectItem(e){const{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){ie.validateRange(e),this.setState(({selectedRanges:t})=>({selectedRanges:ie.selectRange(t,e)}))}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){const{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){const{onViewportChange:s,rowHeight:o}=this.props,a=Math.floor(e/o),l=a+Math.ceil(t/o);s(a,l)}}isListAtBottom({scrollOffset:e,height:t}=this.state){if(t==null||e==null)return!1;const{itemCount:s,rowHeight:o}=this.props;return e+t>=s*o}renderInnerElement({index:e,style:t}){const{items:s,offset:o,renderItem:a,disableSelect:l}=this.props,{focusIndex:c,selectedRanges:d}=this.state;if(e<o||e>=o+s.length)return null;const h=s[e-o];return this.getCachedItem(e,e,h,e===c&&!l,this.getItemSelected(e,d),a,t,l)}render(){const{items:e,itemCount:t,overscanCount:s,renderItem:o,rowHeight:a,"data-testid":l}=this.props,{selectedRanges:c,isStuckToBottom:d}=this.state;return r.jsx($s,{className:"item-list-auto-sizer",onResize:this.handleResize,children:({width:h,height:m})=>r.jsx(_s,{className:"item-list-scroll-pane",height:m,width:h,initialScrollOffset:d?t*a:0,itemCount:t,itemSize:a,itemData:this.getItemData(e,c,o),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:s,"data-testid":l,children:this.renderInnerElement})})}};let te=ge;p(te,"CACHE_SIZE",1e3),p(te,"DEFAULT_ROW_HEIGHT",20),p(te,"DEFAULT_OVERSCAN",10),p(te,"defaultProps",{offset:0,items:[],rowHeight:ge.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:ge.DEFAULT_OVERSCAN,renderItem:ge.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",Q((e,t,s,o,a,l,c,d)=>r.jsx(Vs,{draggableId:de.getDraggableId(e,o),index:o,isDragDisabled:c,children:h=>r.jsx("div",{role:"menuitem",className:"draggable-item-list-item",ref:h.innerRef,tabIndex:-1,...h.draggableProps,...h.dragHandleProps,children:t({item:s,itemIndex:o,isFocused:a,isSelected:l,style:d,isClone:!1})})},o),{max:te.CACHE_SIZE}));p(this,"getCachedRenderDraggableItem",Q((e,t,s)=>({item:o,itemIndex:a,isFocused:l,isSelected:c,style:d})=>this.getCachedDraggableItem(e,s,o,a,l,c,t,d),{max:1}));p(this,"getCachedRenderClone",Q((e,t,s,o)=>(a,l,c)=>{const{selectedCount:d}=this.state,{draggableProps:h,dragHandleProps:m,innerRef:g}=a,{index:b}=c.source,E=t[b-s];return r.jsx("div",{className:S("draggable-item-list-dragging-item-container",e),...h,...m,ref:g,children:r.jsx("div",{className:S("draggable-item-list-dragging-item",{"two-dragged":d===2},{"multiple-dragged":d>2}),children:o({item:E,itemIndex:b,isFocused:!1,isSelected:!0,style:{},isClone:!0,selectedCount:d})})})},{max:1}));this.handleSelectionChange=this.handleSelectionChange.bind(this),this.itemList=I.createRef(),this.state={selectedCount:0}}static renderHandle(){return r.jsxs("div",{children:[r.jsx(Ot,{children:"Drag to re-order"}),r.jsx(q,{icon:si})]})}static renderBadge({text:e}){return e!=null&&e.length>0?r.jsx("span",{className:"number-badge",children:e}):null}static renderTextItem({text:e,badgeText:t="",className:s=""}){return r.jsxs("div",{className:S("item-list-item-content","draggable-item-list-item-content",s),children:[r.jsx("span",{className:"title",children:e}),de.renderBadge({text:t}),de.renderHandle()]})}static renderItem({item:e,isClone:t,selectedCount:s}){const o=e!=null?e.displayValue??e.value??`${e}`:"",a=t!==void 0&&t?`${s}`:"",l=t!==void 0&&t?"item-list-item-clone":"";return de.renderTextItem({text:o,badgeText:a,className:l})}static getDraggableId(e,t){return`${e}/${t}`}static getDraggableIndex(e){const t=e.split("/").pop();return parseInt(t!==void 0?t:"",10)}selectItem(e){var t;(t=this.itemList.current)==null||t.selectItem(e)}focusItem(e){var t;(t=this.itemList.current)==null||t.focusItem(e)}scrollToItem(e){var t;(t=this.itemList.current)==null||t.scrollToItem(e)}handleSelectionChange(e){this.setState({selectedCount:ie.count(e)});const{onSelectionChange:t}=this.props;t(e)}render(){const{className:e,draggablePrefix:t,draggingItemClassName:s,droppableId:o,isDoubleClickSelect:a,isDragDisabled:l,isDropDisabled:c,isMultiSelect:d,isStickyBottom:h,itemCount:m,items:g,offset:b,onFocusChange:E,onSelect:x,onViewportChange:w,renderItem:j,rowHeight:$,selectedRanges:v,style:A,"data-testid":D}=this.props;return r.jsx(Bs,{isDropDisabled:c,droppableId:o,mode:"virtual",renderClone:this.getCachedRenderClone(s,g,b,j),"data-testid":D,children:(k,N)=>r.jsx("div",{role:"menu",className:S("draggable-item-list",e,{"is-drop-disabled":c,"is-drag-disabled":l,"is-dragging-from-this":N.draggingFromThisWith,"is-dragging-over":N.isDraggingOver,"is-dropping":N.draggingOverWith}),style:A,ref:k.innerRef,...k.droppableProps,children:r.jsx(te,{focusSelector:".draggable-item-list-item",isDoubleClickSelect:a,isDragSelect:!1,isMultiSelect:d,isStickyBottom:h,itemCount:m,items:g,onFocusChange:E,onSelect:x,onSelectionChange:this.handleSelectionChange,onViewportChange:w,offset:b,ref:this.itemList,renderItem:this.getCachedRenderDraggableItem(t,l,j),rowHeight:$,selectedRanges:v})})})}};let Le=de;p(Le,"DEFAULT_ROW_HEIGHT",30),p(Le,"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 wo=Le;class Je{static reorder(i,e,t,s){const o=i===t?Je.adjustDestinationIndex(s,e):s,a=Je.removeItems(i,e);return t.splice(o,0,...a),a}static removeItems(i,e){const t=[],s=e.map((o,a)=>({range:o,index:a})).sort((o,a)=>a.range[0]-o.range[0]);for(let o=0;o<s.length;o+=1){const{range:a,index:l}=s[o],[c,d]=a;t[l]=i.splice(c,d-c+1)}return Hs(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 To=Je;function Mo(n){const{isInvalid:i=!1,items:e,onAdd:t=()=>{},onDelete:s=()=>{},validate:o=()=>null}=n,[a,l]=u.useState(null),[c,d]=u.useState([]),[h,m]=u.useState(""),g=u.useCallback(v=>{d(v)},[]),b=u.useCallback(()=>{s(ie.getItemsInRanges(e,c)),d([])},[e,c,s]),E=u.useCallback(()=>{if(h==="")return;const v=o(h);v==null?(t(h),m("")):l(v)},[h,t,o]),x=u.useCallback(v=>{const{value:A}=v.target;m(A),l(A===""?null:o(A))},[o]),w=u.useCallback(()=>{d([])},[]),j=u.useCallback(v=>{v.key==="Enter"&&E()},[E]),$=u.useMemo(()=>14+Ct(e.length,1,6)*te.DEFAULT_ROW_HEIGHT,[e.length]);return r.jsxs("div",{className:S("editable-item-list-container",{"is-invalid":i}),children:[r.jsx("div",{style:{height:$},children:r.jsx(te,{itemCount:e.length,items:e.map((v,A)=>({value:v,isSelected:ie.isSelected(c,A)})),offset:0,selectedRanges:c,onSelectionChange:g,isMultiSelect:!0})}),r.jsxs("div",{className:"d-flex flex-row pt-2",children:[r.jsx("div",{className:"d-flex flex-grow-1",children:r.jsx("input",{className:S("form-control",{"is-invalid":a!=null}),placeholder:"Enter value",type:"text",value:h,onChange:x,onFocus:w,onKeyDown:j})}),r.jsxs("div",{className:"d-flex align-items-start mt-1 ml-2",children:[r.jsx(Y,{kind:"ghost",onClick:E,disabled:a!=null||h==="",icon:ii,tooltip:"Add new item","data-testid":"add-item-button"}),r.jsx(Y,{kind:"ghost",onClick:b,disabled:c.length===0,icon:oi,tooltip:"Delete selected items","data-testid":"delete-item-button"})]})]})]})}const Pe=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=Pe.isParentSelected(i,o),h=d==null||!d;a.forEach((m,g)=>c.set(g,h))}o.set(i,c)}else o.set(i,a==null||!a);const l=o.get(i);if(e===void 0&&l!==void 0&&typeof l!="boolean"){const c=Pe.isParentSelected(i,t);c!=null&&c?l.forEach((d,h)=>l.set(h,!1)):l.forEach((d,h)=>l.set(h,!0))}s(o)}setAllValues(i){const{valueMap:e,onUpdateValueMap:t}=this.props,s=new Map;e.forEach((o,a)=>{if(typeof o=="boolean")s.set(a,i);else{const l=new Map;o.forEach((c,d)=>l.set(d,i)),s.set(a,l)}}),t(s)}selectAll(){this.setAllValues(!0)}clear(){this.setAllValues(!1)}renderMenuElement(){const{valueMap:i,"data-testid":e}=this.props;return r.jsxs("div",{className:"hcm-menu-container",children:[Array.from(i.entries()).map(([t,s])=>r.jsxs("div",{children:[r.jsx(Ze,{className:"hcm-parent",checked:Pe.isParentSelected(t,i),onChange:()=>this.toggleValueFor(t),children:t}),s!==void 0&&typeof s!="boolean"&&Array.from(s.entries()).map(([o,a])=>r.jsx(Ze,{className:"hcm-child",checked:a,onChange:()=>this.toggleValueFor(t,o),children:o},o))]},t)),r.jsx(Y,{kind:"ghost",onClick:this.selectAll,"data-testid":e!==void 0?`${e}-btn-select-all`:void 0,children:"Select All"}),r.jsx(Y,{kind:"ghost",onClick:this.clear,"data-testid":e!==void 0?`${e}-btn-clear`:void 0,children:"Clear"})]})}render(){const{menuText:i,className:e,icon:t,id:s,"data-testid":o}=this.props,{menuIsOpen:a}=this.state;return r.jsxs("button",{type:"button",className:S("btn hcm-btn",e),onClick:this.toggleMenu,id:s,"data-testid":o,children:[r.jsxs("span",{children:[t&&r.jsx(q,{icon:t,className:"hcm-icon mr-1"}),i]}),r.jsx(q,{icon:yn,className:"hcm-icon ml-1"}),r.jsx(ke,{options:{placement:"bottom"},isShown:a,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}};let Ge=Pe;p(Ge,"defaultProps",{className:"",icon:null,id:"","data-testid":void 0});const No=Ge;function Zn({on:n,id:i,className:e,isInvalid:t,disabled:s=!1,onClick:o,"data-testid":a}){return r.jsx("button",{type:"button",className:S("btn","btn-switch",e,{active:n},{"is-invalid":t}),id:i,onClick:o,disabled:s,"data-testid":a,children:r.jsx("div",{className:"handle"})})}function rn(n){return n.isOn!==void 0}function Xn({item:n,onSelect:i=()=>{},"data-testid":e}){const{icon:t,subtitle:s,title:o}=n,a=u.useMemo(()=>rn(n)?()=>{n.onChange(!n.isOn)}:i,[n,i]);return r.jsxs("div",{className:"btn btn-navigation-menu-item","data-testid":`menu-item-${o}`,onClick:a,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&a()},tabIndex:0,role:"menuitem",children:[t!==void 0&&r.jsx("div",{className:"icon",children:r.jsx(q,{icon:t})}),r.jsx("div",{className:"title",children:o}),s!==void 0&&r.jsx("div",{className:"shortcut",children:s}),r.jsx("div",{className:"accessory","data-testid":e,children:rn(n)?r.jsx(Zn,{on:n.isOn,onClick:l=>{l.stopPropagation(),a()}}):r.jsx(q,{icon:ai})})]})}function ko({items:n,onSelect:i=()=>{},"data-testid":e}){return r.jsx("div",{className:"navigation-menu-view","data-testid":e,children:r.jsx("ul",{className:"navigation-menu-list",children:n.map((t,s)=>r.jsx("li",{children:r.jsx(Xn,{item:t,onSelect:()=>{i(s)}})},t.title))})})}function Oo({children:n,onBack:i,onClose:e,title:t,"data-testid":s}){return r.jsxs("div",{className:"navigation-page","data-testid":s,children:[r.jsxs("div",{className:"navigation-title-bar",children:[r.jsx("div",{className:"navigation-left-buttons",children:i!==void 0&&r.jsx(Y,{kind:"ghost",className:"btn-back","data-testid":"btn-page-back",onClick:i,icon:ri,children:"Back"})}),r.jsx("div",{className:"navigation-title",children:t}),r.jsx("div",{className:"navigation-right-buttons",children:e!==void 0&&r.jsx(Y,{kind:"ghost",className:"btn-close px-2 m-1","data-testid":"btn-page-close",onClick:e,icon:En,tooltip:"Close"})})]}),r.jsx("div",{className:"navigation-content",children:n})]})}function Do({children:n,"data-testid":i}){const e=u.useMemo(()=>I.Children.toArray(n),[n]),t=On(e),[s,o]=u.useState(e[e.length-1]),[a,l]=u.useState(null),[c,d]=u.useState(null);u.useEffect(function(){if(t===void 0||e===t)return;const b=e[e.length-1];e.length===t.length||t.length===0||a!==null||c!==null?a!==null&&b!==a?l(b):b!==c&&b!==s&&o(b):e.length>t.length?l(b):e.length<t.length&&(o(b),d(t[t.length-1]))},[e,t,a,c,s]);const h=u.useCallback(()=>{o(a),l(null)},[a]),m=u.useCallback(()=>{d(null)},[]);return r.jsxs("div",{className:"navigation-stack",children:[r.jsx("div",{className:"main-view","data-testid":i,children:s}),r.jsx(be,{in:c!=null,timeout:oe.transitionMidMs,classNames:"slide-right",onEntered:m,children:r.jsx(r.Fragment,{children:c!=null&&r.jsx("div",{className:"popping-view",children:c})})}),r.jsx(be,{in:a!=null,timeout:oe.transitionMidMs,classNames:"slide-left",onEntered:h,children:r.jsx(r.Fragment,{children:a!=null&&r.jsx("div",{className:"pushing-view",children:a})})})]})}function Ao({children:n,disabled:i,value:e,"data-testid":t}){return r.jsx("option",{value:e,disabled:i,"data-testid":t,children:n})}function Ro(n){const{children:i,disabled:e=!1,name:t,onChange:s,value:o="","data-testid":a}=n,[l]=u.useState(t??Ce());return r.jsx(r.Fragment,{children:I.Children.map(i,c=>c?I.cloneElement(c,{name:l,onChange:c.props.onChange??s,checked:o===c.props.value,disabled:c.props.disabled??e,"data-testid":a}):null)})}const Ft=I.forwardRef((n,i)=>{const{checked:e,children:t,className:s="",disabled:o=!1,inputClassName:a="",isInvalid:l=!1,labelClassName:c="",name:d,onChange:h,value:m,"data-testid":g}=n,[b]=u.useState(Ce());return r.jsxs("div",{className:S("custom-control custom-radio",s),children:[r.jsx("input",{type:"radio",id:b,"data-testid":g,name:d,ref:i,className:S("custom-control-input",a,{"is-invalid":l}),checked:e,disabled:o,value:m,onChange:h}),r.jsx("label",{className:S("custom-control-label",c),htmlFor:b,children:t})]})});Ft.displayName="RadioItem";Ft.defaultProps={checked:void 0,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const Lo=Ft;const jo=.025,Po=.9,Fo=.1,Uo=.618,pt=oe["primary-dark"],ln=80,$o=oe["gray-800"],_o=oe["gray-900"],pe={SIZE:8,DOT_SIZE:2,FILL_OPACITY:.25},le=18,Vo=250,Bo=60*1e3,Ho=I.memo(()=>{const n=u.useRef(null),i=u.useRef(null),[e,t]=u.useState(!1),s=window.devicePixelRatio;let o,a,l,c,d,h=null,m=[];function g(){i.current!=null&&(l=i.current.offsetWidth,c=i.current.offsetHeight),n.current!=null&&(n.current.style.width=`${l}px`,n.current.style.height=`${c}px`,n.current.width=l*s,n.current.height=c*s),o==null||o.scale(s,s)}function b(){const R=document.createElement("canvas");R.width=pe.SIZE,R.height=pe.SIZE;const L=R.getContext("2d");return L!=null&&(L.fillStyle=pt,L.fillRect(0,0,pe.DOT_SIZE,pe.DOT_SIZE),L.fillStyle=pt+Math.round(255*pe.FILL_OPACITY).toString(16).padStart(2,"0"),L.fillRect(0,0,pe.SIZE,pe.SIZE)),L==null?void 0:L.createPattern(R,"repeat")}function E(R){const L=Math.random()-.5;let _=jo*L;return R<Fo?_=Math.abs(_):R>Po&&(_=-Math.abs(_)),R+_}function x(){const R=[];let L=Uo;for(let _=0;_<l+le;_+=1)L=E(L),R.push(L);return R}function w(){for(;m.length>=l+le;)m.pop();for(;m.length<l+le;)m.push(E(m[m.length-1]))}function j(R,L){L.beginPath(),L.moveTo(-1,c+1),L.lineTo(-1,c*R[0]);for(let _=0;_<R.length;_+=1)L.lineTo(_,c*R[_]);L.lineTo(l+le,c*R[R.length-1]),L.lineTo(l+le,c+1),L.closePath()}function $(R){R.beginPath();for(let L=1;L<l;L+=ln)R.moveTo(L,0),R.lineTo(L,c);for(let L=1;L<c;L+=ln)R.moveTo(0,L),R.lineTo(l,L)}function v(R){h=h??R,hi(o),o.fillStyle=_o,o.fillRect(0,0,l,c),$(o),o.lineWidth=1,o.strokeStyle=$o,o.stroke();const L=((h??0)-(R??0))/(1e3/le);if(o.translate(L,0),j(m,o),o.lineWidth=2,o.strokeStyle=pt,o.stroke(),o.translate(-L,0),a!=null&&(o.fillStyle=a),o.fill(),o.setTransform(s,0,0,s,0,0),(R??0)-(h??0)>1e3/le){const _=Math.floor(((R??0)-(h??0))/(1e3/le));for(let M=0;M<_;M+=1)m.shift(),m.push(E(m[m.length-1]));h=R}d!=null&&cancelAnimationFrame(d),d=requestAnimationFrame(v)}const A=qe(()=>{d=requestAnimationFrame(R=>{g(),w(),t(!1),v(R)})},Vo,{leading:!0});function D(){t(!0),d!=null&&cancelAnimationFrame(d),d=null,h=null}const k=qe(()=>{D()},Bo);function N(){d==null&&(t(!1),g(),w(),d=requestAnimationFrame(v)),k()}function B(){document.hasFocus()&&N()}function ne(){d!=null&&cancelAnimationFrame(d),k(),A()}return u.useEffect(()=>{var R;return o=(R=n.current)==null?void 0:R.getContext("2d",{alpha:!1}),g(),m=x(),a=b(),v(),k(),window.addEventListener("resize",ne),window.addEventListener("focus",N),window.addEventListener("blur",D),window.addEventListener("mousemove",B),window.addEventListener("keydown",B),()=>{d!=null&&cancelAnimationFrame(d),window.removeEventListener("resize",ne),window.removeEventListener("focus",N),window.removeEventListener("blur",D),window.removeEventListener("mousemove",B),window.removeEventListener("keydown",B),k.cancel(),A.cancel()}},[]),r.jsx("div",{className:"random-area-plot-animation-container",ref:i,children:r.jsx("canvas",{ref:n,className:e?"shade":""})})}),Jn=Ho;function Ko({children:n,onBlur:i,onChange:e,className:t,defaultValue:s,name:o,value:a,disabled:l,"data-testid":c}){const d=u.useCallback(h=>{e(h.target.value)},[e]);return r.jsx("select",{className:S("custom-select",t),onBlur:i,onChange:d,defaultValue:s,value:a,name:o,disabled:l,"data-testid":c,children:n})}class Qn extends u.PureComponent{constructor(e){super(e);p(this,"list");p(this,"topRow");p(this,"bottomRow");p(this,"getCachedItem",Q((e,t,s,o,a,l,c)=>{const d={height:a},h=o??s;return r.jsx("li",{className:"value-list-item",style:d,tabIndex:-1,children:r.jsx(Ze,{checked:l,disabled:c,onChange:()=>this.handleSelect(e),children:h})},t)},{max:1e3}));p(this,"getCachedItems",Q((e,t,s,o)=>{const a=[];for(let l=0;l<e.length;l+=1){const c=e[l],{value:d,displayValue:h,isSelected:m}=c,g=s+l,b=g,E=this.getCachedItem(g,b,d,h,t,m,o);a.push(E)}return a},{max:1}));this.handleBlur=this.handleBlur.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleSelect=this.handleSelect.bind(this),this.list=I.createRef(),this.topRow=null,this.bottomRow=null}componentDidMount(){this.sendViewportUpdate()}componentDidUpdate(){this.sendViewportUpdate()}handleBlur(e){if(!e.relatedTarget||this.list.current&&e.relatedTarget instanceof HTMLElement&&!this.list.current.contains(e.relatedTarget)){const{onBlur:t}=this.props;t==null||t(e)}}handleScroll(){this.sendViewportUpdate()}handleSelect(e){const{items:t,offset:s,onSelect:o}=this.props,a=e-s;if(a>=0&&a<t.length){const l=t[a],{value:c}=l;o(e,c)}else o(e,null)}sendViewportUpdate(){if(!this.list.current||this.list.current.clientHeight===0)return;const{onViewportChange:e,rowHeight:t}=this.props,s=this.list.current.scrollTop,o=s+this.list.current.clientHeight,a=Math.floor(s/t),l=Math.ceil(o/t);(this.topRow!==a||this.bottomRow!==l)&&(this.topRow=a,this.bottomRow=l,e(a,l))}getElement(e){return this.list.current==null?null:this.list.current.querySelectorAll(".value-list-item")[e]}scrollIntoView(e){const t=this.getElement(e);t==null||t.scrollIntoView({block:"center"})}render(){const{className:e,disabled:t,isInvalid:s,items:o,itemCount:a,offset:l,rowHeight:c,"data-testid":d}=this.props,h=this.getCachedItems(o,c,l,t);return r.jsx("div",{className:S("select-value-list-scroll-pane h-100 w-100",{"is-invalid":s},e),onBlur:this.handleBlur,onScroll:this.handleScroll,ref:this.list,"data-testid":d,children:r.jsx("div",{className:"select-value-list",style:{height:a*c},children:r.jsx("ol",{className:"select-value-list-content",style:{position:"absolute",height:o.length*c,top:l*c,left:0},children:h})})})}}p(Qn,"defaultProps",{disabled:!1,rowHeight:21,onBlur:()=>{},"data-testid":void 0});const Yn=Qn,cn=U.module("Shortcut");var J=(n=>(n.CTRL="MODIFIER_CTRL",n.CMD="MODIFIER_CMD",n.ALT="MODIFIER_ALT",n.OPTION="MODIFIER_OPTION",n.SHIFT="MODIFIER_SHIFT",n))(J||{}),K=(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))(K||{});const Wo=new Set(["Enter","Delete","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),V=class extends Mt{constructor({id:e,shortcut:t,macShortcut:s,isEditable:o=!0,name:a,tooltip:l}){super();p(this,"id");p(this,"name");p(this,"tooltip");p(this,"isEditable");p(this,"defaultKeyState");p(this,"keyState");this.id=e,this.name=a,this.tooltip=l,this.isEditable=o;const d=V.isMacPlatform?s:t;this.defaultKeyState=V.createKeyState(d),this.keyState=this.defaultKeyState}static isAllowedKey(e){return Object.values(K).includes(e)}static isValidKeyState(e){const{keyValue:t}=e;return t===null?!0:!V.isMacPlatform&&e.metaKey||!V.isAllowedKey(t)?!1:!(!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey)||Wo.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="":!V.isAllowedKey(t)&&V.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?"":V.isMacPlatform?V.getMacDisplayText(e):V.getWindowsDisplayText(e)}getDisplayText(){return V.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){V.isValidKeyState(e)?(cn.debug2(`Shortcut ${this.id} updated to ${JSON.stringify(e)}`),this.keyState=e,this.dispatchEvent(new Dn("onUpdate",{detail:this}))):cn.debug2(`Shortcut ${this.id} tried to update to invalid keyState ${JSON.stringify(e)}`)}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return V.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(V.NULL_KEY_STATE)}isNull(){return V.doKeyStatesMatch(this.keyState,V.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return V.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(V.getKeyStateFromEvent(e))}};let Se=V;p(Se,"NULL_KEY_STATE",{metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null}),p(Se,"isMacPlatform",G.isMacPlatform());const un=U.module("ShortcutRegistry");class Go extends Mt{constructor(){super(...arguments);p(this,"shortcutMap",new Map);p(this,"shortcutsByCategory",new Map)}createAndAdd(e){const t=new Se(e);return this.add(t)}add(e){var o;const t=this.shortcutMap.get(e.id);if(t)return un.warn(`Skipping attempt to add duplicate shortcut ID to registry: ${e.id}`),t;un.debug2(`Adding shortcut to registry: ${e.id}`),e.addEventListener("onUpdate",({detail:a})=>this.dispatchEvent(new Dn("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 qo=Object.freeze(new Go),fe=qo,zo={COPY:fe.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[J.CTRL,K.C],macShortcut:[J.CMD,K.C],isEditable:!1}),PASTE:fe.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[J.CTRL,K.V],macShortcut:[J.CMD,K.V],isEditable:!1}),SAVE:fe.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[J.CTRL,K.S],macShortcut:[J.CMD,K.S],isEditable:!1}),SELECT_ALL:fe.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[J.CTRL,K.A],macShortcut:[J.CMD,K.A],isEditable:!1}),LINKER:fe.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[J.CTRL,K.L],macShortcut:[J.CMD,K.L]}),LINKER_CLOSE:fe.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[K.ESCAPE],macShortcut:[K.ESCAPE],isEditable:!1})},Zo=zo;const Ut=I.forwardRef((n,i)=>{const{children:e,className:t,disabled:s,id:o,isLinked:a,isLinkedSource:l,isInvalid:c,onClick:d,onMouseEnter:h,onMouseLeave:m,style:g,"data-testid":b}=n;return r.jsxs("button",{ref:i,type:"button",className:S("btn-socketed",{"btn-socketed-linked":a!==void 0&&a||l},{"btn-socketed-linked-source":l},{"is-invalid":c},t),id:o,onClick:d,onMouseEnter:h,onMouseLeave:m,style:g,disabled:s,"data-testid":b,children:[e,r.jsx(q,{icon:li,className:"linked btn-socketed-icon",transform:"down-1"}),r.jsx(q,{icon:ci,className:"is-invalid btn-socketed-icon"})]})});Ut.displayName="SocketedButton";Ut.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 Xo=Ut,Jo={"dh-spectrum-theme--dark":"_dh-spectrum-theme--dark_i6xja_5"},Qo={"dh-spectrum-theme--light":"_dh-spectrum-theme--light_16vb7_5"},{global:Yo,light:ea,dark:ta,medium:na,large:sa}=Ks,ia={global:Yo,light:{...ea,...Qo},dark:{...ta,...Jo},medium:na,large:sa},oa="_track_535ju_30",aa="_handle_535ju_13",ra="_ticks_535ju_98",es={"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:oa,"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:aa,ticks:ra,"tick-labels":"_tick-labels_535ju_116","tick-label":"_tick-label_535ju_116","tick-label-wrapper":"_tick-label-wrapper_535ju_132"};const Be=parseInt(es["handle-size"],10),dn=parseInt(es["popover-width"],10),Z=24*60*60-1,hn=5*60;function la({startTime:n,endTime:i,onChange:e,isStartModified:t=!1,isEndModified:s=!1,"data-testid":o}){const[a,l]=u.useState(n),[c,d]=u.useState(i),h=u.useRef(null);u.useEffect(function(){l(n),d(i)},[n,i]);const m=u.useCallback((E,x)=>{let w=E,j=x;w===j&&(j<Z?j+=1:w-=1),l(w),d(j),e({startTime:w,endTime:j})},[l,d,e]),g=u.useCallback(E=>{m(E,c)},[m,c]),b=u.useCallback(E=>{m(a,E)},[m,a]);return r.jsxs("div",{className:"time-slider","data-testid":o,children:[r.jsx(ca,{startTime:a,endTime:c,onStartTimeChange:g,onEndTimeChange:b,isStartModified:t,isEndModified:s}),r.jsxs("div",{className:"track",ref:h,children:[r.jsx(ua,{startTime:a,endTime:c}),r.jsx("div",{className:"ticks",children:Array(24).fill(null).map((E,x)=>r.jsx("div",{className:"tick"},x))}),r.jsx(pn,{track:h,time:a,setTime:g}),r.jsx(pn,{track:h,time:c,setTime:b})]}),r.jsxs("div",{className:"tick-labels",children:[r.jsx("div",{className:"tick-label",children:"0:00"}),r.jsx("div",{className:"tick-label-wrapper",children:Array(24).fill(null).map((E,x)=>r.jsx("div",{className:"tick-label",children:`${x+1}:00`},x))})]})]})}function ca(n){const{startTime:i,endTime:e,onStartTimeChange:t,onEndTimeChange:s,isStartModified:o,isEndModified:a,"data-testid":l}=n,c=i>e,[d,h]=u.useState(c?e:i),[m,g]=u.useState(c?i:e),b=u.useRef(null),E=u.useRef(null),x=u.useRef(null),w=u.useRef(null);u.useEffect(function(){h(i>e?e:i),g(i>e?i:e)},[i,e]),u.useEffect(function(){var k,N;x.current!==null&&((k=E.current)==null||k.setSelection(x.current)),w.current!==null&&((N=b.current)==null||N.setSelection(w.current))},[c]);function j(D){i<=e?t(D):s(D)}function $(D){i<=e?s(D):t(D)}const v=u.useCallback(D=>{x.current=D,w.current=null},[]),A=u.useCallback(D=>{x.current=null,w.current=D},[]);return r.jsxs("div",{className:"time-slider-popovers",children:[r.jsx("div",{className:"flex",style:{flexBasis:`calc(${d/Z*100}% - ${dn/2}px)`}}),r.jsxs("div",{className:"handle-popper",children:[r.jsx("label",{className:S({modified:c?a:o}),children:c?"End Time":"Start Time"}),r.jsx(Xe,{ref:b,allowValueWrapping:!1,value:d,onChange:j,onSelect:v,"data-testid":l!==void 0?`${l}-input-1`:void 0})]}),r.jsx("div",{className:"flex-spacer"}),r.jsxs("div",{className:"handle-popper",children:[r.jsx("label",{className:S({modified:c?o:a}),children:c?"Start Time":"End Time"}),r.jsx(Xe,{ref:E,allowValueWrapping:!1,value:m,onChange:$,onSelect:A,"data-testid":l!==void 0?`${l}-input-2`:void 0})]}),r.jsx("div",{className:"flex",style:{flexBasis:`calc(${(Z-m)/Z*100}% - ${dn/2}px)`}})]})}function ua(n){const{startTime:i,endTime:e,"data-testid":t}=n;return r.jsxs("div",{className:"track-fills","data-testid":t,children:[i>e&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"track-fill track-fill-start",style:{transform:`scaleX(${e/Z})`}}),r.jsx("div",{className:"track-fill track-fill-end",style:{transform:`scaleX(${(Z-i)/Z})`}})]}),i<e&&r.jsx("div",{className:"track-fill track-fill-middle",style:{transform:`translateX(${i/Z*100}%) scaleX(${(e-i)/Z})`}})]})}function pn(n){const{track:i,time:e,setTime:t,"data-testid":s}=n,o=u.useMemo(()=>{let b=Be/2;return e<3600?b=e/3600*(Be/2):e>23*3600&&(b=Be/2+1/(Z-23*3600)*(e-23*3600)*(Be/2)),`translateX(calc(${e/Z*100}% - ${b}px))`},[e]),a=u.useCallback(g=>{if(!i.current)return 0;const b=i.current.getBoundingClientRect(),E=Math.max(g-b.left,0),x=Z*Math.min(1,E/b.width),w=hn*Math.round(x/hn);return Math.min(Z,w)},[i]),l=u.useCallback(({clientX:g})=>{t(a(g))},[t,a]),c=u.useCallback(({clientX:g})=>{t(a(g)),window.removeEventListener("mousemove",l),window.removeEventListener("mouseup",c),document.documentElement.classList.remove("drag-pointer-events-none")},[t,a,l]),d=u.useCallback(()=>{window.addEventListener("mousemove",l),window.addEventListener("mouseup",c),document.documentElement.classList.add("drag-pointer-events-none")},[l,c]),h=u.useCallback(()=>{window.removeEventListener("mousemove",l),window.removeEventListener("mouseup",c),document.documentElement.classList.remove("drag-pointer-events-none")},[l,c]),m=u.useCallback(()=>{d()},[d]);return u.useEffect(function(){return()=>{h()}},[h]),r.jsx("div",{className:"handle-track",style:{transform:o},children:r.jsx("button",{className:"handle",type:"button","aria-label":"Change time",onMouseDown:m,"data-testid":s})})}function ts({buttons:n,isShown:i=!1,classNames:e,message:t,type:s,onClick:o,onDismiss:a,"data-testid":l}){const c=n&&n.length!==0;return r.jsx(be,{in:i,timeout:oe.transitionMs,classNames:"toast-notification-slide-up",mountOnEnter:!0,unmountOnExit:!0,children:r.jsxs("div",{className:S("toast-notification",e,s),role:"presentation",onClick:o,onKeyPress:o,"data-testid":l,children:[r.jsx("div",{className:"message-container",children:r.jsx("span",{className:"message",children:t})}),r.jsx(be,{in:c,timeout:oe.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:r.jsx("div",{className:"buttons-container",children:n})}),a&&r.jsx(Y,{kind:"ghost",icon:En,tooltip:"Close notification",className:"my-2",onClick:a})]})})}ts.TYPE=Object.freeze({ERROR:"error"});function da(n){const{children:i,className:e,labelText:t,hintText:s,isModified:o,validationError:a,showValidationError:l=!0,"data-testid":c,id:d}=n,{current:h}=u.useRef(d??Ce());return r.jsxs(r.Fragment,{children:[r.jsx("label",{className:S("validate-label",e,{modified:o}),htmlFor:h,"data-testid":c,children:t}),I.Children.toArray(i).map(m=>I.isValidElement(m)?I.cloneElement(m,{className:S(m.props.className,{"is-invalid":a})}):r.jsx("div",{className:S(e),children:m})),s!==void 0&&r.jsx("small",{className:"form-text text-muted",children:s}),a!==void 0&&l&&r.jsx("p",{className:"validate-label-error text-danger",children:a})]})}const ha=Object.freeze(Object.defineProperty({__proto__:null,AutoCompleteInput:Pi,AutoResizeTextarea:Dt,BasicModal:Lt,Button:Y,ButtonGroup:$e,ButtonOld:zi,CardFlip:Zi,Checkbox:Ze,Collapse:to,ComboBox:no,ContextActionUtils:G,ContextActions:eo,ContextMenuItem:wn,ContextMenuRoot:pi,CopyButton:so,CustomTimeSelect:co,DEFAULT_GET_PREFERRED_REPLACEMENT_STRING:it,DateInput:Eo,DateTimeInput:bo,DebouncedModal:Gi,DebouncedSearchInput:So,DragUtils:To,DraggableItemList:wo,DropdownMenu:Hn,EditableItemList:Mo,GLOBAL_SHORTCUTS:Zo,HierarchicalCheckboxMenu:No,InfoModal:qi,ItemList:te,ItemListItem:zn,KEY:K,LoadingOverlay:Ne,LoadingSpinner:Sn,MODIFIER:J,MaskedInput:ot,Menu:ko,MenuItem:Xn,Modal:Nt,ModalBody:kt,ModalFooter:jn,ModalHeader:xn,Option:Ao,Page:Oo,Popper:ke,RadioGroup:Ro,RadioItem:Lo,RandomAreaPlotAnimation:Jn,SearchInput:st,Select:Ko,SelectValueList:Yn,Shortcut:Se,ShortcutRegistry:fe,SocketedButton:Xo,Stack:Do,ThemeExport:oe,TimeInput:Xe,TimeSlider:la,ToastNotification:ts,Tooltip:Ot,UISwitch:Zn,ValidateLabelInput:da,fillToLength:$n,themeDHDefault:ia,trimTrailingMask:yt},Symbol.toStringTag,{value:"Module"})),pa=Object.freeze(Object.defineProperty({__proto__:null,ApiBootstrap:ui,ApiContext:di,ClientBootstrap:Tn,ClientContext:mi,useApi:Ye,useClient:Ue},Symbol.toStringTag,{value:"Module"})),ns=1e4;function ma(n,i,e=ns){return new Promise((t,s)=>{let o;const a=setTimeout(()=>{o==null||o(),s(new Mn(`Variable ${i} not found`))},e);function l(c){const d=c.created.find(h=>h.title===i);d!=null&&(clearTimeout(a),o==null||o(),t(d))}o=n.subscribeToFieldUpdates(l)})}const mt=U.module("MessageUtils"),ss="io.deephaven.message.LoginOptions.request",is="io.deephaven.message.SessionDetails.request",os="io.deephaven.broadcast",$t="io.deephaven.broadcast.Login",as="io.deephaven.broadcast.Logout";function at(n){const i=n;return i!=null&&typeof i.id=="string"&&typeof i.message=="string"}function rs(n){return at(n)&&n.message===$t}function ls(n){return at(n)&&n.message===as}function cs(n){const i=n;return i!=null&&typeof i.id=="string"}function _t(n,i=Ce(),e){return{message:n,id:i,payload:e}}function fa(n,i){return{id:n,payload:i}}async function Vt(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=Ce(),a=l=>{const{data:c}=l;if(!cs(c)){mt.debug("Ignoring non-deephaven response",c);return}if(mt.debug("Received message",c),(c==null?void 0:c.id)!==o){mt.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 Mn("Request timed out"))},i),window.opener.postMessage(_t(n,o),"*")})}class us extends Error{constructor(){super(...arguments);p(this,"isNoConsolesError",!0)}}function ds(n){return n.isNoConsolesError}const Ie=U.module("SessionUtils");function ga(n){return Ie.info(`Starting connection to '${n}'...`),new dh.IdeConnection(n)}async function hs(n,i){Ie.info("Getting console types...");const e=await n.getConsoleTypes();if(e.length===0)throw new us("No console types available");Ie.info("Available types:",e);const t=e[0];Ie.info("Starting session with type",t);const s=await n.startSession(t),o={type:t,id:Ce.generate()};return Ie.info("Console session established",o),{session:s,config:o,connection:n,details:i}}function ba(n,i){return Ie.info("createCoreClient",n),new dh.CoreClient(n,i)}function Ca(n){return n!=null&&typeof n=="object"}async function va(){const n=await Vt(is);if(!Ca(n))throw new Error(`Unexpected session details response: ${n}`);return n}async function xa(){switch(new URLSearchParams(window.location.search).get("authProvider")){case"parent":return va()}return{}}async function ya(n,i){let e;try{e=await hs(n,i)}catch(t){if(!ds(t))throw t}return e}const Ea=U.module("ViewportDataUtils");function ps(n,i){return String(n.offsetInSnapshot+i)}function ms(n,i,e){return function(s){if(n==null)return;const{offset:o,rows:a}=s.detail;Ea.debug("table updated",s.detail),a.forEach(l=>{const c=e(l,n.columns),d={key:ps(l,o),item:c};i.getItem(d.key)!=null?i.update(d.key,d):i.append(d)})}}function fs(n,i){return i.reduce((e,t)=>(e[t.name]=n.get(t),e),{})}function*gs(n){for(let i=0;i<n;++i)yield{key:String(i)}}function rt(n){return n==null||Bt(n)?0:n.size}function Bt(n){return"isClosed"in n?n.isClosed:!1}function bs(n,i,e,t){const s=n+i-1,[o,a]=[0,t-1],l=Ct(n-e,o,a),c=Ct(s+e,o,a);return[l,c]}const Sa=Object.freeze(Object.defineProperty({__proto__:null,BROADCAST_CHANNEL_NAME:os,BROADCAST_LOGIN_MESSAGE:$t,BROADCAST_LOGOUT_MESSAGE:as,BooleanColumnFormatter:fi,CharColumnFormatter:gi,DateTimeColumnFormatter:bi,DateUtils:Ci,DecimalColumnFormatter:vi,DefaultColumnFormatter:xi,FETCH_TIMEOUT:ns,Formatter:Nn,FormatterUtils:vt,IntegerColumnFormatter:yi,LOGIN_OPTIONS_REQUEST:ss,NoConsolesError:us,SESSION_DETAILS_REQUEST:is,StringColumnFormatter:Ei,TableColumnFormatter:Si,TableUtils:Ii,createConnection:ga,createCoreClient:ba,createKeyFromOffsetRow:ps,createOnTableUpdatedHandler:ms,createSessionWrapper:hs,defaultRowDeserializer:fs,fetchVariableDefinition:ma,generateEmptyKeyedItems:gs,getColumnFormats:wi,getDateTimeFormatterOptions:Ti,getSessionDetails:xa,getSize:rt,isBroadcastLoginMessage:rs,isBroadcastLogoutMessage:ls,isClosed:Bt,isCustomColumnFormatDefined:Mi,isMessage:at,isNoConsolesError:ds,isResponse:cs,loadSessionWrapper:ya,makeMessage:_t,makeResponse:fa,padFirstAndLastRow:bs,requestParentResponse:Vt},Symbol.toStringTag,{value:"Module"})),mn=U.module("useTableListener"),Ia=(n,i,e)=>u.useEffect(function(){if(n==null){mn.debug2("Emitter undefined, skipping addEventListener",i);return}return mn.debug2("Adding listener",i),n.addEventListener(i,e)},[n,i,e]),je=Ia;class wa extends Error{constructor(){super(...arguments);p(this,"isColumnNameError",!0)}}const Ta=wa;class Ma extends Error{constructor(){super(...arguments);p(this,"isTableDisconnectError",!0)}}const Na=Ma,He=U.module("useTable"),ka=(n,i,e,t)=>{const s=Ye(),[o,a]=u.useState(void 0),[l,c]=u.useState([]),[d,h]=u.useState(null),[m,g]=u.useState(null);u.useEffect(()=>{if(t===void 0){a(n==null?void 0:n.columns),h(null);return}try{a(n==null?void 0:n.findColumns(t)),h(null)}catch(w){He.error("Column not found",w,t),h(new Ta("Invalid columnNames argument"))}},[n,t]),u.useEffect(()=>{if(!o||!n){He.debug2("Table or column not initialized, skip viewport update.");return}He.debug2("Setting viewport",i,e),n.setViewport(i,e,o)},[o,n,i,e]);const b=u.useCallback(({detail:w})=>{if(!o){He.error("Columns not initialized.");return}const j=o.map($=>w.rows.map(v=>v.get($)));c(j)},[o]),E=u.useCallback(()=>{g(new Na("Table disconnected"))},[]),x=u.useCallback(()=>{g(null)},[]);return je(n,s.Table.EVENT_UPDATED,b),je(n,s.Table.EVENT_DISCONNECT,E),je(n,s.Table.EVENT_RECONNECT,x),{columns:o,data:l,error:m??d}},Cs=ka,Oa=(n,i,e,t)=>{const s=u.useMemo(()=>[t],[t]),{columns:o=[],data:a=[],error:l}=Cs(n,i,e,s);return{column:o[0],data:a[0],error:l}},vs=Oa;const ae=U.module("TableInput"),ft=250;function Ht(n){const{className:i=void 0,columnName:e,settings:t,defaultValue:s=[],isInvalid:o=!1,onChange:a=()=>!1,onBlur:l=()=>!1,table:c}=n,d=u.useRef(null),h=u.useMemo(()=>{const O=vt.getColumnFormats(t),y=vt.getDateTimeFormatterOptions(t),{defaultDecimalFormatOptions:F={},defaultIntegerFormatOptions:X={}}=t;return new Nn(O,y,F,X)},[t]),[m,g]=u.useState(""),[b,E]=u.useState(new Set(s)),[x,w]=u.useState(),j=u.useRef(null),$=Math.min((x==null?void 0:x.size)??0,ft),{column:v,data:A,error:D}=vs(x,0,ft-1,e),k=u.useCallback(O=>v?h.getFormattedString(O,v.type,v.name):`${O}`,[v,h]),[N,B]=u.useMemo(()=>{const O=new Set(b),y=[];if(A==null)return[y,null];if(A.forEach(F=>{const X=`${F}`,z=b.has(X);z&&O.delete(X),y.push({value:X,displayValue:k(F),isSelected:z})}),O.size>0){ae.debug2("Selection has items that are missing from the viewport");const F=new Set(b);return Array.from(O).forEach(X=>{F.delete(X)}),[y,F]}return[y,null]},[A,b,k]);u.useEffect(()=>{B!==null&&(E(B),a(Array.from(B)))},[a,B]);const ne=u.useCallback(async O=>{try{const y=await O;ae.debug("Table resolved",y),w(y)}catch(y){if(Qt.isCanceled(y))return;ae.error(y)}},[]);u.useEffect(()=>{const O=Qt.makeCancelable(c);return ne(O),()=>{ae.debug2("Cancel table promise"),O.cancel()}},[c,ne]);const R=u.useCallback(O=>{var X;const{value:y}=O.target;g(y);const F=N.findIndex(z=>z.displayValue.includes(y));F>-1?(ae.debug2(`Found ${y} at index ${F}`),(X=j.current)==null||X.scrollIntoView(F)):ae.debug2(`${y} not found`)},[N,j]),L=u.useCallback(O=>{if(ae.debug("handleSelect",O),O>=N.length){ae.error("Invalid index",O);return}const y=N[O].value,F=new Set(b);N[O].isSelected?F.delete(y):F.add(y),E(F),a(Array.from(F))},[a,N,b]),_=u.useCallback(()=>{const O=N.map(F=>F.value),y=new Set(O);E(y),a(O)},[N,a]),M=u.useCallback(()=>{E(new Set),a([])},[a]),T=u.useCallback(()=>{},[]),C=u.useCallback(O=>{var F;const{relatedTarget:y}=O;ae.debug("handleChildBlur",y,y instanceof HTMLElement,d.current,(F=d.current)==null?void 0:F.contains(y)),(!y||d.current&&y instanceof HTMLElement&&!d.current.contains(y))&&l()},[l]),P=N.length===0;return r.jsxs("div",{ref:d,className:S("table-input-container d-flex flex-column position-relative",i),children:[r.jsx(st,{disabled:!!D||P,value:m,placeholder:"Search",onChange:R,className:"mb-2 d-flex",onBlur:C}),r.jsx(Yn,{className:"table-input-list",disabled:x===void 0||P,isInvalid:o,items:P?[{value:"Empty",isSelected:!1}]:N,itemCount:$,offset:0,onSelect:L,onViewportChange:T,ref:j,onBlur:C}),x&&r.jsxs("div",{className:"meta-row",children:[r.jsx("div",{className:"d-flex align-items-center text-muted small",children:x!=null&&x.size>$&&r.jsxs(r.Fragment,{children:["Table is too large, showing the first ",ft," items."]})}),r.jsxs("div",{children:[r.jsx("button",{type:"button",className:"btn btn-link",onBlur:C,onClick:_,children:"Select All"}),r.jsx("button",{type:"button",className:"btn btn-link mr-a",onBlur:C,onClick:M,children:"Clear"})]})]}),x==null||D&&r.jsx("div",{className:"h-100 w-100 position-absolute",children:r.jsx(Ne,{isLoaded:x!=null,isLoading:x==null&&D==null,errorMessage:(D==null?void 0:D.message)??null})})]})}Ht.displayName="TableInput";Ht.defaultProps={isInvalid:!1,className:void 0};const fn=U.module("useBroadcastChannel");function Kt(n=Vi,i=os){const e=u.useMemo(()=>new BroadcastChannel(i),[i]);return u.useEffect(()=>()=>{e.close()},[e]),u.useEffect(()=>{function t(s){const{data:o}=s;if(!at(o)){fn.debug("Ignoring non-deephaven message",o);return}fn.debug("event received",o),n(s)}return e.addEventListener("message",t),()=>{e.removeEventListener("message",t)}},[e,n]),e}function lt(n,i){const e=u.useCallback(t=>{rs(t.data)?n==null||n(t.data):ls(t.data)&&(i==null||i(t.data))},[n,i]);Kt(e)}const Qe="io.deephaven.web.client.auth.refreshToken",xs=u.createContext(null),Da=U.module("RefreshTokenUtils");function St(){const n=Me.get(Qe);try{if(n!=null)return JSON.parse(n)}catch(i){Da.error("Error parsing refresh token",n,i)}return null}function It(n){if(n==null){Me.remove(Qe);return}const i=JSON.stringify({bytes:n.bytes,expiry:n.expiry}),e=new Date(n.expiry);Me.set(Qe,i,{secure:!0,sameSite:"strict",expires:e})}function ys({children:n}){const i=Ye(),e=Ue(),[t,s]=u.useState(St());u.useEffect(function(){return e.addEventListener(i.CoreClient.EVENT_REFRESH_TOKEN_UPDATED,d=>{const{detail:h}=d;It(h),s(h)})},[i,e,t]);const o=u.useCallback(()=>{s(St())},[]),a=u.useCallback(()=>{It(null),s(null)},[]);return lt(o,a),r.jsx(xs.Provider,{value:t,children:n})}function Es(n){const i=Ws({});return u.useEffect(()=>{n&&(i.items.length&&i.remove(...i.items.map(({key:e})=>e)),i.insert(0,...gs(rt(n))))},[n]),i}function Aa(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}=Rn(e,[]);return u.useEffect(()=>()=>{t==null||t.close()},[t]),{distinctTable:t,error:s,isError:o,isLoading:a}}function Ss(n,i,e){return u.useCallback(function(s){const[o,a]=bs(s,i,e,rt(n));n==null||n.setViewport(o,a)},[n,e,i])}function Ra({table:n,viewportSize:i=10,viewportPadding:e=50,deserializeRow:t=fs}){const s=Es(n),o=Ss(n,i,e);return je(n,dh.Table.EVENT_UPDATED,ms(n,s,t)),u.useEffect(()=>{n&&!Bt(n)&&o(0)},[n,o]),{viewportData:s,size:rt(n),setViewport:o}}const La=Object.freeze(Object.defineProperty({__proto__:null,REFRESH_TOKEN_KEY:Qe,RefreshTokenBootstrap:ys,RefreshTokenContext:xs,TableInput:Ht,readRefreshToken:St,storeRefreshToken:It,useBroadcastChannel:Kt,useBroadcastLoginListener:lt,useInitializeViewportData:Es,useSelectDistinctTable:Aa,useSetPaddedViewportCallback:Ss,useTable:Cs,useTableColumn:vs,useTableListener:je,useViewportData:Ra},Symbol.toStringTag,{value:"Module"})),Is=u.createContext(!1);function ja({fontClassNames:n=["fira-sans-regular","fira-sans-bold","fira-mono"],children:i}){const[e,t]=u.useState(!1);return u.useEffect(function(){document.fonts.ready.then(()=>{t(!0)})},[]),r.jsxs(r.Fragment,{children:[r.jsx(Is.Provider,{value:e,children:i}),r.jsx("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:n.map(s=>r.jsx("p",{className:s,children:"preload"},s))})]})}function ws(n){if(n==null)return!1;const i=n;return i.Component!==void 0&&typeof i.isAvailable=="function"}const Ts="io.deephaven.auth.AnonymousAuthenticationHandler",Pa="io.deephaven.authentication.psk.PskAuthenticationHandler";class Fa extends Error{constructor(){super(...arguments);p(this,"name","AuthenticationError");p(this,"isAuthenticationError",!0)}}const Ms=Fa,gn=U.module("AuthPluginBase");function Wt({children:n,getLoginOptions:i}){const e=Ue(),[t,s]=u.useState(),[o,a]=u.useState(!1);return u.useEffect(()=>{let l=!1;function c(){if(l)throw new Ni("Login canceled.")}async function d(){try{const h=await i();c(),gn.info("Logging in..."),await e.login(h),c(),a(!0)}catch(h){if(!l){gn.error("Unable to login:",h);const m=Fe(h)??"Unable to login. Verify credentials.";s(new Ms(m)),a(!1)}}}return d(),()=>{l=!0}},[e,i]),o?r.jsx(r.Fragment,{children:n}):r.jsx(Ne,{"data-testid":"auth-base-loading",isLoading:t==null,isLoaded:!1,errorMessage:Fe(t)})}const Ua=u.createContext({}),Gt=u.createContext({}),$a={canLogout:!1};function _a({children:n}){const i=Ye(),e=u.useCallback(()=>({type:i.CoreClient.LOGIN_TYPE_ANONYMOUS}),[i]);return r.jsx(Wt,{getLoginOptions:e,children:r.jsx(Gt.Provider,{value:$a,children:n})})}const Va={Component:_a,isAvailable:n=>n.includes(Ts)},Ns=Va,Ba=U.module("AuthPluginParent"),Ha={canLogout:!1};function Ka(n){return n!=null&&typeof n.type=="string"}async function Wa(){Ba.info("Logging in by delegating to parent window...");const n=await Vt(ss);if(!Ka(n))throw new Error(`Unexpected login options response: ${n}`);return n}function Ga(){return new URLSearchParams(window.location.search).get("authProvider")??""}function qa({children:n}){return r.jsx(Wt,{getLoginOptions:Wa,children:r.jsx(Gt.Provider,{value:Ha,children:n})})}const za={Component:qa,isAvailable:()=>window.opener!=null&&Ga()==="parent"},ks=za;function Os({children:n,errorMessage:i,isLoggingIn:e=!1,onSubmit:t}){return r.jsxs("form",{className:"login-form",onSubmit:s=>{s.preventDefault(),s.stopPropagation(),t==null||t(s)},children:[r.jsx("div",{className:"flex-spacer"}),r.jsxs("div",{className:"flex-wrapper",children:[r.jsx("fieldset",{disabled:e,className:"container-fluid",children:n}),r.jsx("div",{className:"form-group d-flex justify-content-end align-items-center mb-0",children:r.jsxs("button",{type:"submit",className:S("btn btn-primary",{"btn-spinner":e},{"btn-cancelable":e}),"data-testid":"btn-login",children:[e&&r.jsxs("span",{children:[r.jsx(Sn,{}),r.jsx("span",{className:"btn-normal-content",children:"Logging in"}),r.jsx("span",{className:"btn-hover-content",children:"Cancel"})]}),!e&&"Login"]})})]}),r.jsx("div",{className:"flex-spacer",children:i!=null&&r.jsx("p",{className:"error-message mb-0",role:"alert",children:`${i}`})})]})}function Ds({children:n,logoPath:i="./logo.png"}){return r.jsxs("div",{className:"login-container",children:[r.jsx(Jn,{}),r.jsxs("div",{className:"login-box",children:[r.jsx("div",{className:"logo",children:r.jsx("img",{src:i,alt:"Deephaven Data Labs"})}),n,r.jsxs("p",{className:"footer",children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})}const wt="io.deephaven.authentication.psk.PskAuthenticationHandler",As="psk",Tt="io.deephaven.web.client.auth.psk.token",we=U.module("AuthPluginPsk");function Za(){return new URLSearchParams(window.location.search).get(As)}function Xa(){we.debug2("clearWindowToken");const n=new URL(window.location.href);n.searchParams.delete(As),window.history.replaceState(null,"",n.href)}function bn(){return Me.get(Tt)??null}function gt(n){we.debug2("Storing token in cookie",n),n!=null?Me.set(Tt,n,{secure:!0,sameSite:"strict"}):Me.remove(Tt)}function Ja({children:n,logoPath:i}){const e=Ue(),t=u.useRef(null),s=u.useRef(null),[o,a]=u.useState(),[l,c]=u.useState(!1),[d,h]=u.useState(!1),[m,g]=u.useState(!1),[b,E]=u.useState(""),x=u.useCallback(async(A,D=!0)=>{we.info("Logging in..."),g(!0);let k=null;try{if(k=e.login({type:wt,token:A}),s.current=k,await k,we.info("Logged in successfully"),s.current!==k)return;gt(A),h(!0)}catch(N){if(s.current!==k)return;if(c(!0),D){we.error("Unable to login",N);const B=Fe(N)??"Unable to login: Verify credentials.";a(new Ms(B))}}g(!1)},[e]),w=u.useCallback(()=>{s.current=null,g(!1)},[]),j=u.useCallback(async()=>{we.debug("onLogin");const A=bn();d||m||A==null||x(A,!1)},[d,m,x]),$=u.useCallback(()=>{gt(null)},[]);lt(j,$),u.useEffect(()=>{let A=!1;async function D(){const k=Za()??bn();if(Xa(),k==null){c(!0);return}g(!0);try{await e.login({type:wt,token:k}),A||(gt(k),h(!0),g(!1))}catch{A||(c(!0),g(!1))}}return D(),()=>{A=!0}},[e]);const v=u.useCallback(()=>{m?w():x(b)},[w,m,x,b]);return u.useEffect(function(){var D;(D=t.current)==null||D.focus()},[t,l]),r.jsxs(r.Fragment,{children:[d&&n,l&&r.jsx(be,{in:!d,timeout:oe.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:r.jsx(Ds,{logoPath:i,children:r.jsx(Os,{errorMessage:Fe(o),isLoggingIn:m,onSubmit:v,children:r.jsxs("div",{className:"form-group",children:[r.jsx("label",{htmlFor:"auth-psk-token-input",children:"Token"}),r.jsx("input",{id:"auth-psk-token-input",name:"token",className:"input-token form-control",type:"text",autoComplete:"username",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",ref:t,value:b,onChange:A=>{a(void 0),E(A.target.value)}})]})})})}),r.jsx(Ne,{"data-testid":"auth-psk-loading",isLoaded:d||l,isLoading:!d&&!l})]})}const Qa={Component:Ja,isAvailable:n=>n.includes(wt)},Rs=Qa,Ya=Object.freeze(Object.defineProperty({__proto__:null,AUTH_HANDLER_TYPE_ANONYMOUS:Ts,AUTH_HANDLER_TYPE_PSK:Pa,AuthPluginAnonymous:Ns,AuthPluginBase:Wt,AuthPluginParent:ks,AuthPluginPsk:Rs,Login:Ds,LoginForm:Os,UserOverrideContext:Ua,UserPermissionsOverrideContext:Gt,isAuthPlugin:ws},Symbol.toStringTag,{value:"Module"})),Ls={react:I,"react-dom":Cn,redux:Gs,"react-redux":qs,"@deephaven/auth-plugins":Ya,"@deephaven/components":ha,"@deephaven/jsapi-bootstrap":pa,"@deephaven/jsapi-components":La,"@deephaven/jsapi-utils":Sa,"@deephaven/log":Ri,"@deephaven/react-hooks":Wi},er=vn.createRequires(()=>Ls),tr=vn.createRemoteComponent({requires:er}),nr=tr,sr=zs.createRequires(Ls),ir=Zs({requires:sr}),or=ir,he=U.module("@deephaven/app-utils.PluginUtils");function Ir(n,i){const e=new URL(`${i}.js`,n),t=I.forwardRef((s,o)=>r.jsx(nr,{url:e.href,render:({err:a,Component:l})=>{if(a!=null&&a!==""){const c=`Error loading plugin ${i} from ${e} due to ${a}`;return he.error(c),r.jsx("div",{className:"error-message",children:`${c}`})}return r.jsx(l,{ref:o,...s})}}));return t.pluginName=i,t.displayName="Plugin",t}async function ar(n){return await or(n)}async function rr(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 lr(n){he.debug("Loading plugins...");try{const i=await rr(`${n}/manifest.json`);if(!Array.isArray(i.plugins))throw new Error("Plugin manifest JSON does not contain plugins array");he.debug("Plugin manifest loaded:",i);const e=[];for(let o=0;o<i.plugins.length;o+=1){const{name:a,main:l}=i.plugins[o],c=`${n}/${a}/${l}`;e.push(ar(c))}const t=await Promise.allSettled(e),s=new Map;for(let o=0;o<t.length;o+=1){const a=t[o],{name:l}=i.plugins[o];a.status==="fulfilled"?s.set(l,a.value):he.error(`Unable to load plugin ${l}`,a.reason)}return he.info("Plugins loaded:",s),s}catch(i){return he.error("Unable to load plugins:",i),new Map}}function cr(n){var i;return((i=n.get("AuthHandlers"))==null?void 0:i.split(","))??[]}function ur(n,i,e){const t=cr(i),s=[...n.entries()].filter(([,c])=>ws(c.AuthPlugin)).map(([c,d])=>[c,d.AuthPlugin]);s.push(...e??[]);const o=s.filter(([c,d])=>d.isAvailable(t,i));if(o.length===0)throw new Error(`No login plugins found, please register a login plugin for auth handlers: ${t}`);o.length>1&&he.warn("More than one login plugin available, will use the first one: ",o.map(([c])=>c).join(", "));const[a,l]=o[0];return he.info("Using LoginPlugin",a),l.Component}const qt=u.createContext(null);function dr({pluginsUrl:n,children:i}){const[e,t]=u.useState(null);return u.useEffect(function(){let o=!1;async function a(){const l=await lr(n);o||t(l)}return a(),()=>{o=!0}},[n]),r.jsx(qt.Provider,{value:e,children:i})}function hr(){const n=Kt();return u.useEffect(function(){n.postMessage(_t($t))},[n]),null}const pr=new Map([["@deephaven/auth-plugins.AuthPluginPsk",Rs],["@deephaven/auth-plugins.AuthPluginParent",ks],["@deephaven/auth-plugins.AuthPluginAnonymous",Ns]]);function mr({children:n}){const i=Ue(),e=u.useContext(qt),[t,s]=u.useState(),[o,a]=u.useState();u.useEffect(function(){let h=!1;async function m(){try{const g=await i.getAuthConfigValues();h||s(new Map(g))}catch(g){h||a(g)}}return m(),()=>{h=!0}},[i]);const l=u.useMemo(()=>{if(!(e==null||t==null))try{return ur(e,t,pr)}catch(d){a(d)}},[t,e]),c=l==null||t==null;return c||o!=null?r.jsx(Ne,{isLoading:c&&o==null,errorMessage:Fe(o)}):r.jsx(l,{authConfigValues:t,children:r.jsxs(r.Fragment,{children:[r.jsx(hr,{}),n]})})}function wr(n){return new URL(n,`${window.location}`)}function fr(){return new URLSearchParams(window.location.search).get("envoyPrefix")}function gr(){const n=fr();return n!=null?{headers:{"envoy-prefix":n}}:{headers:{}}}function br({children:n}){return u.useContext(Is)?r.jsx(r.Fragment,{children:n}):r.jsx(Ne,{"data-testid":"fonts-loaded-loading"})}function Tr({fontClassNames:n,pluginsUrl:i,serverUrl:e,children:t}){const s=u.useMemo(()=>gr(),[]),[o,a]=u.useState(0),l=u.useCallback(()=>{},[]),c=u.useCallback(()=>{a(d=>d+1)},[]);return lt(l,c),r.jsx(ja,{fontClassNames:n,children:r.jsx(dr,{pluginsUrl:i,children:r.jsx(Tn,{serverUrl:e,options:s,children:r.jsx(ys,{children:r.jsx(mr,{children:r.jsx(ki,{children:r.jsx(br,{children:t})})})})},o)})})}function Mr(){return In(qt,"No Plugins available in usePlugins. Was code wrapped in PluginsBootstrap or PluginsContext.Provider?")}export{Tr as AppBootstrap,mr as AuthBootstrap,ki as ConnectionBootstrap,Or as ConnectionContext,ja as FontBootstrap,br as FontsLoaded,Is as FontsLoadedContext,dr as PluginsBootstrap,qt as PluginsContext,nr as RemoteComponent,cr as getAuthHandlers,ur as getAuthPluginComponent,wr as getBaseUrl,gr as getConnectOptions,fr as getEnvoyPrefix,Ir as loadComponentPlugin,rr as loadJson,ar as loadModulePlugin,lr as loadModulePlugins,Dr as useConnection,Mr as usePlugins};
9
- //# sourceMappingURL=index-baf8f85c.js.map