@deephaven/embed-chart 0.38.1-beta.7 → 0.38.1-chart-refactor.20

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