@deephaven/embed-grid 0.40.1 → 0.40.2-beta.4
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.
- package/build/assets/{App-f95bcb4a.js → App-e4f0479a.js} +2 -2
- package/build/assets/{App-f95bcb4a.js.map → App-e4f0479a.js.map} +1 -1
- package/build/assets/{index-4aaf273d.js → index-2c897ff6.js} +3 -3
- package/build/assets/{index-4aaf273d.js.map → index-2c897ff6.js.map} +1 -1
- package/build/assets/{index-e2aca0bf.js → index-c0e729b6.js} +2 -2
- package/build/assets/{index-e2aca0bf.js.map → index-c0e729b6.js.map} +1 -1
- package/build/assets/{useConnection-c31e301c.js → useConnection-57b48d5d.js} +2 -2
- package/build/assets/{useConnection-c31e301c.js.map → useConnection-57b48d5d.js.map} +1 -1
- package/build/index.html +1 -1
- package/package.json +14 -14
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var yn=Object.defineProperty;var kn=(s,t,e)=>t in s?yn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var E=(s,t,e)=>(kn(s,typeof t!="symbol"?t+"":t,e),e);import{E as Nn,r,P as g,g as ue,a as D,m as Sn,j as a,c as O,s as he,F as Y,C as Ee,b as Pe,$ as In,J as ie,L as wn,R as On,N as jn,O as Mn,Q as xt,T as Rn,U as An}from"./vendor-a75bc0d2.js";import{L as A,ab as Pn,ac as Dn,V as Be,Z as He,W as Et,f as Ln,U as Tt,I as _n,o as Fn,T as Q,y as Un,ad as $n,S as Vn,aa as ae,a as yt,ae as Bn,af as kt}from"./index-
|
|
1
|
+
var yn=Object.defineProperty;var kn=(s,t,e)=>t in s?yn(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var E=(s,t,e)=>(kn(s,typeof t!="symbol"?t+"":t,e),e);import{E as Nn,r,P as g,g as ue,a as D,m as Sn,j as a,c as O,s as he,F as Y,C as Ee,b as Pe,$ as In,J as ie,L as wn,R as On,N as jn,O as Mn,Q as xt,T as Rn,U as An}from"./vendor-a75bc0d2.js";import{L as A,ab as Pn,ac as Dn,V as Be,Z as He,W as Et,f as Ln,U as Tt,I as _n,o as Fn,T as Q,y as Un,ad as $n,S as Vn,aa as ae,a as yt,ae as Bn,af as kt}from"./index-c0e729b6.js";import{z as We,Z as Nt,_ as Hn,$ as Wn,u as St,B as H,x as re,a0 as Ge,a1 as It,A as wt,a2 as Gn,w as Ke,a3 as lt,v as De,t as Le,a as Kn,J as zn,e as qn,k as Yn,a4 as Zn,X as Jn,l as Qn,L as Xn,o as es,p as ts,G as ns,a5 as ss,K as os,M as is,H as as,a6 as rs,r as ls,U as cs,R as us,s as ds,q as hs,m as Ot,a7 as ps,S as fs,Q as ms,f as gs,a8 as vs,a9 as bs,aa as Cs,ab as jt,ac as xs,ad as W,ae as pe,af as Es,ag as Ts,ah as ys,i as ks,D as Ns,j as Ss,ai as Is,aj as ws,N as Mt,F as _e,I as Os,ak as js,h as Ms,b as ze,Y as Rs,al as As,am as Ps,an as Ds,P as ct,ao as Ls,C as _s,ap as Fs}from"./useConnection-57b48d5d.js";import{aq as aa,W as ra}from"./useConnection-57b48d5d.js";import"./helpers-042e6b4d.js";import"./monaco-f56a0d1b.js";var F=(s=>(s.DEBUG="D",s.LOG="L",s.WARN="W",s.ERROR="E",s.UNCAUGHT_ERROR="U",s))(F||{});function X(s,t){return new CustomEvent(s,{detail:t})}class Us{constructor(){E(this,"isEnabled",!1);E(this,"debug");E(this,"log");E(this,"warn");E(this,"error");E(this,"eventTarget");E(this,"handleUncaughtError",t=>{const e=[];t.error!=null&&e.push(t.error),t.message&&e.push(t.message),this.eventTarget.dispatchEvent(X("U",e))});E(this,"handleUncaughtRejection",t=>{const e=[];t.promise!=null&&e.push(t.promise.toString()),t.reason&&e.push(t.reason),this.eventTarget.dispatchEvent(X("U",e))});this.debug=console.debug,this.log=console.log,this.warn=console.warn,this.error=console.error,this.eventTarget=new Nn}enable(){this.isEnabled||(console.debug=(...t)=>{this.eventTarget.dispatchEvent(X("D",t)),this.debug.apply(console,t)},console.log=(...t)=>{this.eventTarget.dispatchEvent(X("L",t)),this.log.apply(console,t)},console.warn=(...t)=>{this.eventTarget.dispatchEvent(X("W",t)),this.warn.apply(console,t)},console.error=(...t)=>{this.eventTarget.dispatchEvent(X("E",t)),this.error.apply(console,t)},window.addEventListener("error",this.handleUncaughtError),window.addEventListener("unhandledrejection",this.handleUncaughtRejection),A.setLogLevel(A.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),window.removeEventListener("unhandledrejection",this.handleUncaughtRejection),A.setLogLevel(A.level),this.isEnabled=!1)}addEventListener(t,e){this.eventTarget.addEventListener(t,e)}removeEventListener(t,e){this.eventTarget.removeEventListener(t,e)}}const $s=Us;class Te{constructor(t){E(this,"history");E(this,"offset");E(this,"limit");E(this,"isEnabled");E(this,"proxy");this.history=[],this.offset=0,this.limit=1e4,this.isEnabled=!1,this.proxy=t,this.addHistory=this.addHistory.bind(this)}static formatMessages(t){return t.map(n=>{if(typeof n=="string")return n;let o="";try{o=JSON.stringify(n)}catch{o=n.toString()}return o==="{}"?n.toString():o}).join(" ")}static formatStack(t,e){if(t==="")return"";let n=t.split(`
|
|
2
2
|
`).map(o=>o.trim());switch(e){case F.ERROR:n=n.splice(t[0]==="Error"?4:3);break;case F.UNCAUGHT_ERROR:n=n.splice(t[0]==="Error"?3:2);break}return n!=null?` ${n.join(`
|
|
3
3
|
`)}`:""}enable(){this.isEnabled||(this.proxy.addEventListener(F.DEBUG,this.addHistory),this.proxy.addEventListener(F.LOG,this.addHistory),this.proxy.addEventListener(F.WARN,this.addHistory),this.proxy.addEventListener(F.ERROR,this.addHistory),this.proxy.addEventListener(F.UNCAUGHT_ERROR,this.addHistory),this.isEnabled=!0)}disable(){this.isEnabled&&(this.proxy.removeEventListener(F.DEBUG,this.addHistory),this.proxy.removeEventListener(F.LOG,this.addHistory),this.proxy.removeEventListener(F.WARN,this.addHistory),this.proxy.removeEventListener(F.ERROR,this.addHistory),this.proxy.removeEventListener(F.UNCAUGHT_ERROR,this.addHistory),this.isEnabled=!1)}addHistory({type:t,detail:e}){const n={type:t,messages:e,time:new Date};switch(t){case F.ERROR:case F.UNCAUGHT_ERROR:n.stack=Error().stack;break}this.history[this.offset%this.limit]=n,this.offset+=1}getHistory(){if(this.offset>this.limit){const t=this.offset%this.limit;this.history=this.history.slice(t).concat(this.history.slice(0,t)),this.offset=this.limit}return this.history}getFormattedHistory(){return this.getHistory().map(e=>`${e.time.toISOString()} ${e.type} ${Te.formatMessages(e.messages)}`+(e.stack!=null?`
|
|
4
4
|
${Te.formatStack(e.stack,e.type)}`:"")).join(`
|
|
5
5
|
`)}}const Vs=Te,Bs=Object.freeze(Object.defineProperty({__proto__:null,Log:A,LogHistory:Vs,LogProxy:$s,Logger:Pn,LoggerLevel:Dn,default:A},Symbol.toStringTag,{value:"Module"}));const Hs=100;var Rt=(s=>(s.UP="UP",s.DOWN="DOWN",s))(Rt||{});const K=class extends r.Component{constructor(e){super(e);E(this,"popper");E(this,"cbContainer");E(this,"menuContainer");E(this,"input");E(this,"getCachedFilteredOptions",Sn((e,n)=>e.filter(o=>o.title.toLowerCase().indexOf(n.toLowerCase())>=0)));let{popperOptions:n}=this.props;n={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...n},this.state={title:"",filteredOptions:[],keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,invalid:!1,popperOptions:n},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=ue(this.updateInputValue,Hs),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=D.createRef(),this.cbContainer=D.createRef(),this.menuContainer=D.createRef(),this.input=D.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:n}=this.props,o=n.filter(i=>i.title.toLowerCase()===e.toLowerCase());return o.length<1?(this.setState({invalid:!0}),{value:e,isValid:!1}):(this.setState({invalid:!1}),{value:o[0].value,isValid:!0})}updateInputValue(e){const{menuIsOpen:n}=this.state,{value:o,isValid:i}=this.getValueAndValidate(e);n&&this.processFilterChange(e),this.fireOnChange(o,i)}fireOnChange(e,n=!0){const{onChange:o}=this.props;o(e,n)}processFilterChange(e){var c;const{options:n}=this.props,{menuIsOpen:o}=this.state,i=e?this.getCachedFilteredOptions(n,e):n,l=i.length===1&&i[0].title===e;if(this.setState({filteredOptions:i,keyboardOptionIndex:0}),l&&o){this.closeMenu();return}(c=this.popper.current)==null||c.scheduleUpdate()}resetValue(){this.setState({title:""}),this.fireOnChange("")}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var l;const{filteredOptions:n,keyboardOptionIndex:o}=this.state,i=n[o];switch(e.key){case"Enter":case"ArrowRight":e.stopPropagation(),e.preventDefault(),i!=null&&(this.setState({title:i.title,invalid:!1}),this.fireOnChange(i.value)),this.closeMenu(),(l=this.input.current)==null||l.focus();break;case"ArrowUp":e.stopPropagation(),e.preventDefault(),this.navigateMenu(K.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":e.stopPropagation(),e.preventDefault(),this.navigateMenu(K.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(e.stopPropagation(),e.preventDefault(),e.shiftKey){this.navigateMenu(K.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(K.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.closeMenu();break}}navigateMenu(e){const{filteredOptions:n,keyboardOptionIndex:o}=this.state;let i=o;e===K.MENU_NAVIGATION_DIRECTION.UP?o>0?(i=(i-1)%n.length,this.setState({keyboardOptionIndex:i})):o===0&&(i=n.length-1,this.setState({keyboardOptionIndex:i})):e===K.MENU_NAVIGATION_DIRECTION.DOWN&&o<n.length&&(i=(i+1)%n.length,this.setState({keyboardOptionIndex:i})),this.scrollOptionIntoView(i)}handleInputKeyDown(e){const{onEnter:n}=this.props,{menuIsOpen:o}=this.state;o?this.handleMenuKeyDown(e):e.key==="Enter"?n():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 n;this.setState({title:e.title,invalid:!1}),this.fireOnChange(e.value),this.closeMenu(),(n=this.input.current)==null||n.focus()}handelInputFocus(){const{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputClick(){const{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputBlur(e){const{menuIsOpen:n}=this.state;n&&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 n;(n=this.popper.current)==null||n.show()})}closeMenu(e=!0){var n,o;this.setState({menuIsOpen:!1,keyboardOptionIndex:0}),e&&((n=this.input.current)==null||n.focus()),(o=this.popper.current)==null||o.hide()}scrollOptionIntoView(e){var n;this.menuContainer.current&&((n=this.menuContainer.current.children.item(e))==null||n.scrollIntoView({behavior:"smooth",block:"nearest"}))}renderMenuElement(){const{inputWidth:e}=this.state;return a.jsx("div",{className:O("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:n,filteredOptions:o}=this.state;return n&&o.length===0?a.jsx("div",{className:"no-match",children:e}):o.map((i,l)=>this.renderOption(i,l))}renderOption(e,n){const{keyboardOptionIndex:o}=this.state,i=`option-${n}-${e.value}`;return a.jsx("button",{type:"button",className:O("aci-option-btn",{"keyboard-active":o===n}),onClick:()=>this.handleOptionClick(e),onFocus:()=>this.setState({keyboardOptionIndex:n}),children:e.title},i)}render(){const{options:e,inputPlaceholder:n,disabled:o,className:i,defaultTitle:l,spellCheck:c,"data-testid":u}=this.props,{title:d,menuIsOpen:h,popperOptions:p,invalid:f}=this.state;return a.jsxs("div",{className:"aci-container",ref:this.cbContainer,children:[a.jsx("input",{value:d||l,className:O("form-control",i,"aci-input",{"is-invalid":f&&!h}),ref:this.input,onChange:this.handleInputChange,placeholder:n||e[0].title,disabled:o,onFocus:this.handelInputFocus,onClick:this.handleInputClick,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:c,"data-testid":u}),a.jsx(We,{ref:this.popper,options:p,className:O("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}};let ee=K;E(ee,"propTypes",{options:g.arrayOf(g.shape({title:g.string.isRequired,value:g.string.isRequired})).isRequired,popperOptions:g.shape({}),onChange:g.func,inputPlaceholder:g.string,disabled:g.bool,className:g.string,defaultTitle:g.string,spellCheck:g.bool,onEnter:g.func,noMatchText:g.string,"data-testid":g.string}),E(ee,"defaultProps",{onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0}),E(ee,"MENU_NAVIGATION_DIRECTION",Rt);const Ws=ee;function qe({className:s="",value:t,onChange:e,spellCheck:n=!1,placeholder:o="",disabled:i=!1,delimiter:l="",id:c="","data-testid":u}){const[d,h]=r.useState(t),[p,f]=r.useState(!1),m=r.useRef(null);r.useEffect(function(){h(t)},[t]);function b(x){return x.trim().split(l).filter(I=>I).join(`
|
|
6
6
|
${l.trim()}`)}function T(x){return x.split(`
|
|
7
|
-
`).map(I=>I.trim()).join(" ")}function C(){if(!m.current)return;m.current.style.height="0";const x=m.current.scrollHeight+(m.current.offsetHeight-m.current.clientHeight);x>0&&(m.current.style.height=`${x}px`)}function M(x){let I=x.target.value;p&&(l&&(I=b(I)),f(!1)),h(I),e(I)}function P(){m.current&&(l&&(h(b(d)),C()),m.current.scrollLeft=0)}function v(){m.current&&document.activeElement!==m.current&&m.current.focus()}function y(){l&&(h(T(d)),e(T(d)))}function S(){f(!0)}return r.useEffect(function(){C()},[d]),a.jsx("textarea",{ref:m,id:c,className:O(s,"auto-resize-textarea form-control"),placeholder:o,value:d,rows:1,onChange:M,onFocus:P,onMouseDown:v,onBlur:y,onPaste:S,spellCheck:n,disabled:i,"data-testid":u})}qe.propTypes={value:g.string.isRequired,onChange:g.func.isRequired,className:g.string,placeholder:g.string,spellCheck:g.bool,disabled:g.bool,delimiter:g.string,id:g.string,"data-testid":g.string};qe.defaultProps={className:"",id:"",placeholder:"",disabled:!1,spellCheck:!1,delimiter:"","data-testid":void 0};function fe(s){const{children:t,className:e,style:n,"data-testid":o}=s;return a.jsx("div",{className:O("btn-group",e),style:n,role:"group","data-testid":o,children:t})}fe.displayName="ButtonGroup";fe.propTypes={children:g.node.isRequired,className:g.string,style:g.object,"data-testid":g.string};fe.defaultProps={className:null,style:{},"data-testid":void 0};function de(s){let t=s;s instanceof CustomEvent&&(t=s.detail);let e="";if(t instanceof Error?e=t.message:t!=null&&(e=`${t}`),e=e.trim(),e.length>0)return e}function Gs(s){s.preventDefault()}function Ks(s=!1){const t=r.useMemo(()=>`useSubmitButtonRef-${he()}`,[]),e=r.useCallback(i=>{i==null||i.UNSAFE_getDOMNode().setAttribute("form",t)},[t]),n=r.useMemo(()=>({id:t,onSubmit:s?void 0:Gs}),[t,s]),o=r.useMemo(()=>({form:t,ref:e}),[t,e]);return{formProps:n,submitButtonProps:o}}function At(s,t,{autoLoad:e=!0}={}){const[n,o]=r.useState(null),[i,l]=r.useState(null),[c,u]=r.useState(!1),d=r.useCallback(async()=>{u(!0);try{const h=await s(...t);o(h),l(null)}catch(h){o(null),l(h)}finally{u(!1)}},[s,...t]);return r.useEffect(()=>{e&&d()},[e,d]),{data:n,error:i,isError:i!=null,isLoading:c,reload:d}}function Pt(s,t){const[e,n]=r.useState(s);return r.useEffect(()=>{const o=setTimeout(()=>{n(s)},t);return()=>{clearTimeout(o)}},[s,t]),e}const zs=Object.freeze(Object.defineProperty({__proto__:null,useContextOrThrow:Nt,useCopyToClipboard:Hn,useDebouncedValue:Pt,useFormWithDetachedSubmitButton:Ks,useForwardedRef:Wn,usePrevious:St,usePromiseFactory:At},Symbol.toStringTag,{value:"Module"}));function qs({blockInteraction:s=!0,children:t,debounceMs:e,isOpen:n=!1}){const o=Pt(n,e);return a.jsxs(a.Fragment,{children:[s&&n&&a.jsx("div",{className:"modal-backdrop",style:{backgroundColor:"transparent"},"data-testid":"debounced-modal-backdrop"}),D.cloneElement(t,{isOpen:n&&o})]})}function Ys({className:s,icon:t,isOpen:e=!1,subtitle:n,title:o}){return a.jsx(Be,{isOpen:e,className:s,children:a.jsx(He,{children:a.jsxs("div",{className:"info-modal",children:[t!=null&&a.jsx("div",{className:"message-icon",children:a.jsx(Y,{icon:t})}),a.jsx("div",{className:"message-header",children:o}),n!=null&&a.jsx("div",{className:"message-content",children:n})]})})})}function Dt({className:s="modal-footer",children:t,"data-testid":e}){return a.jsx("div",{className:s,"data-testid":e,children:t})}function Ye(s){const{isOpen:t,headerText:e,bodyText:n,onCancel:o,onConfirm:i,onDiscard:l,onModalDisable:c,cancelButtonText:u="Cancel",confirmButtonText:d="Okay",discardButtonText:h="Discard",isConfirmDanger:p=!1,children:f,"data-testid":m}=s,b=r.useRef(null),T=r.useRef(null),C=r.useCallback(()=>{T.current!==null&&T.current.checked&&c&&c(),i()},[i,c]),M=r.useCallback(()=>{var v;(v=b.current)==null||v.focus()},[]);let P="";return t&&(P=typeof n=="function"?n():n),a.jsxs(Be,{isOpen:t,className:"theme-bg-light",onOpened:M,children:[a.jsx(Et,{closeButton:!1,children:e}),a.jsx(He,{children:P}),a.jsxs(Dt,{children:[c&&a.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[a.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:T,"data-testid":m!==void 0?`${m}-checkbox-confirm`:void 0}),a.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),l&&a.jsx(H,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:l,"data-testid":m!==void 0?`${m}-btn-discard`:void 0,children:h}),o&&a.jsx(H,{kind:"secondary","data-dismiss":"modal",onClick:o,"data-testid":m!==void 0?`${m}-btn-cancel`:void 0,children:u}),a.jsxs(fe,{children:[a.jsx(H,{kind:p?"danger":"primary",onClick:C,ref:b,"data-testid":m!==void 0?`${m}-btn-confirm`:void 0,children:d}),f]})]})]})}Ye.propTypes={isOpen:g.bool.isRequired,headerText:g.string.isRequired,bodyText:g.oneOfType([g.string,g.func]).isRequired,onCancel:g.func,onConfirm:g.func.isRequired,onDiscard:g.func,onModalDisable:g.func,cancelButtonText:g.string,confirmButtonText:g.string,discardButtonText:g.string,children:g.node,"data-testid":g.string};Ye.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};const Ne=D.forwardRef((s,t)=>{const{children:e,className:n,disabled:o,onClick:i,style:l,id:c}=s;return a.jsx("button",{ref:t,type:"button",className:O("btn",n),onClick:i,style:l,disabled:o,id:c,children:e})});Ne.displayName="Button";Ne.propTypes={children:g.node,className:g.string,disabled:g.bool,onClick:g.func,style:g.shape({}),id:g.string};Ne.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Zs=Ne;function Js({className:s,isFlipped:t,children:e,"data-testid":n}){const o=u=>{if(e.length!==2)throw new Error("CardFlip requires 2 children to function");return e[u]},i=r.useRef(null),l=r.useCallback(u=>{u.target===u.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),c=r.useCallback(u=>{u.target===u.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return r.useEffect(function(){if(!i.current)throw Error("ref undefined");i.current.addEventListener("transitionstart",l);const d=i.current;return function(){if(d!=null)return d.removeEventListener("transitionstart",l)}},[l]),a.jsxs("div",{className:O(s,{"card-flip--show-front":t,"card-flip--show-back":!t}),"data-testid":n,children:[a.jsx("div",{className:"card-flip--back",children:o(0)}),a.jsx("div",{ref:i,className:"card-flip--front",onTransitionEnd:c,children:o(1)})]})}const z=class extends r.Component{static handleEnter(t){const e=t;e.style.height="0"}static handleEntering(t){const e=t;e.style.height=`${z.getHeight(e)}px`}static handleExiting(t){const e=t;e.style.height="0"}static handleExit(t){const e=t;e.style.height=`${z.getHeight(e)}px`}static getHeight(t){const e=t.scrollWidth-t.clientWidth;return t.scrollHeight-e}constructor(t){super(t),this.handleEntered=this.handleEntered.bind(this)}handleEntered(t){const e=t;e.style.height="";const{autoFocusOnShow:n}=this.props;if(n!==void 0&&n){const o=e.querySelector("input, select, textarea");o!=null&&o.focus()}}render(){const{children:t,className:e,in:n,"data-testid":o}=this.props;return a.jsx(Ee,{in:n,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:z.handleEnter,onEntering:z.handleEntering,onEntered:this.handleEntered,onExit:z.handleExit,onExiting:z.handleExiting,timeout:350,children:i=>a.jsx("div",{className:O({collapse:i==="exited"},e),"data-testid":o,children:t})})}};let le=z;E(le,"propTypes",{className:g.string,in:g.bool.isRequired,children:g.node.isRequired,autoFocusOnShow:g.bool,"data-testid":g.string}),E(le,"defaultProps",{className:"",autoFocusOnShow:!1,"data-testid":void 0});const Qs=le,Xs=A.module("TimeInput"),eo="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",to=["00:00:00","12:34:56","23:59:59"],Lt=D.forwardRef((s,t)=>{const{allowValueWrapping:e=!0,className:n="",onChange:o=()=>!1,value:i=0,onFocus:l=()=>!1,onBlur:c=()=>!1,onSelect:u=()=>!1,"data-testid":d}=s,[h,p]=r.useState(re.formatTime(i)),[f,m]=r.useState(),b=r.useRef(null);r.useImperativeHandle(t,()=>({focus:()=>{var v;(v=b.current)==null||v.focus()},setSelection:v=>{var y;(y=b.current)==null||y.focus(),m(v)}}),[]),r.useEffect(function(){p(re.formatTime(i))},[i]);function T(v,y,S){const x=v.selectionStart===0?24:60;let I=parseInt(S,10)-y;return Number.isNaN(I)?I=0:e?I=(I%x+x)%x:I=Math.min(Math.max(0,I),x-1),`${I}`.padStart(2,"0")}function C(v,y,S,x,I){return x===0&&I===2&&y===1&&parseInt(S,10)>1?`0${S}${v.substring(2)}`:It(v,y,S)}function M(v){Xs.debug("handleChange",v),p(v),re.isTimeString(v)&&o(re.parseTime(v))}const P=r.useCallback(v=>{m(v),u(v)},[u]);return a.jsx(Ge,{ref:b,className:n,example:to,getNextSegmentValue:T,getPreferredReplacementString:C,onChange:M,onSelect:P,pattern:eo,selection:f,value:h,onFocus:l,onBlur:c,"data-testid":d})});Lt.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const ye=Lt;const ut=-1;var _t=(s=>(s.UP="UP",s.DOWN="DOWN",s))(_t||{});const V=class extends r.Component{constructor(e){super(e);E(this,"csContainer");E(this,"menuContainer");E(this,"button");E(this,"input");const{value:n,valueToTime:o}=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=D.createRef(),this.menuContainer=D.createRef(),this.button=D.createRef(),this.input=D.createRef(),this.state={keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,customTime:o(n),inputFocused:!1}}getSelectedText(){const{options:e,value:n,placeholder:o}=this.props,{customTime:i}=this.state;if(n===null)return o;for(let l=0;l<e.length;l+=1){const c=e[l];if(c.value===n)return c.title}return re.formatTime(i)}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:n}=this.props;n(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var l;const{keyboardOptionIndex:n,inputFocused:o}=this.state,{options:i}=this.props;switch(e.key){case"Enter":case" ":o?this.updateFromCustom():this.updateInputValue(i[n].value),this.closeMenu(),(l=this.button.current)==null||l.focus(),e.stopPropagation(),e.preventDefault();break;case"Tab":e.shiftKey?this.handleMenuNavigation(V.MENU_NAVIGATION_DIRECTION.UP):this.handleMenuNavigation(V.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(V.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(V.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":this.closeMenu();break}}handleMenuNavigation(e){const{keyboardOptionIndex:n,inputFocused:o}=this.state,{options:i}=this.props,l=i.length;let c=n;switch(e){case V.MENU_NAVIGATION_DIRECTION.UP:if(!o&&n===0){this.focusInput();break}else o&&this.focusOption(n);n>0&&!o?(c=(c-1)%l,this.setState({keyboardOptionIndex:c})):n===0&&(c=l-1,this.setState({keyboardOptionIndex:c})),this.scrollOptionIntoView(c);break;case V.MENU_NAVIGATION_DIRECTION.DOWN:if(!o&&n===l-1){this.focusInput();break}else o&&this.focusOption(n);n<l&&!(o&&n===0)&&(c=(c+1)%l,this.setState({keyboardOptionIndex:c})),this.scrollOptionIntoView(c);break}}handleOptionClick(e){const n=Number(e.currentTarget.value),{options:o,timeToValue:i}=this.props,{customTime:l}=this.state;if(n===ut){const c=i(l);this.updateAndClose(c)}else this.updateAndClose(o[n].value)}updateAndClose(e){var n;this.updateInputValue(e),this.closeMenu(),(n=this.button.current)==null||n.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleMenuOpened(){var c;const{options:e,value:n}=this.props,{keyboardOptionIndex:o}=this.state;this.scrollOptionIntoView(o);const i=(c=this.menuContainer.current)==null?void 0:c.querySelector(".cs-option-btn.keyboard-active");if(i instanceof HTMLElement&&i.focus(),n===null)return;e.map(u=>u.value).indexOf(n)<0&&this.focusInput()}focusInput(){var e;(e=this.input.current)==null||e.focus()}focusOption(e){var o;const n=(o=this.menuContainer.current)==null?void 0:o.querySelector(".cs-options");if(n&&n.children!=null){const i=n.children.item(e);i instanceof HTMLElement&&i.focus()}}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}handleCustomInput(e){const{timeToValue:n}=this.props,o=n(e);this.updateInputValue(o),this.setState({customTime:e})}updateFromCustom(){const{timeToValue:e}=this.props,{customTime:n}=this.state,o=e(n);this.updateInputValue(o)}toggleMenu(e){const{menuIsOpen:n}=this.state;n?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0})}closeMenu(e=!0){var n;this.setState({menuIsOpen:!1}),e&&((n=this.button.current)==null||n.focus())}updateKeyboardIndex(){const{options:e,value:n}=this.props;if(n===null)return;const o=e.map(i=>i.value).indexOf(n);o>0&&this.setState({keyboardOptionIndex:o})}scrollOptionIntoView(e){var o;const n=(o=this.menuContainer.current)==null?void 0:o.querySelector(".cs-options");if(n&&n.children!=null){const i=n.children.item(e);i instanceof HTMLElement&&i.offsetTop>V.DROP_DOWN_MENU_HEIGHT?n.scrollTop=i.offsetTop-V.DROP_DOWN_MENU_HEIGHT:(i instanceof HTMLElement&&i.offsetTop<0||e===0)&&(n.scrollTop=0)}}renderMenuElement(){const{inputWidth:e}=this.state;return a.jsx("div",{className:"cs-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:n=>{n.stopPropagation()},style:{width:e},children:a.jsx("div",{className:"cs-options-container",children:a.jsx("div",{className:"cs-options",children:this.renderOptions()})})})}renderOptions(){const{options:e,value:n,icon:o,customText:i}=this.props,{keyboardOptionIndex:l,customTime:c,inputFocused:u}=this.state;let d=!1;const h=[];for(let p=0;p<e.length;p+=1){const f=e[p],m=`option-${p}-${f.value}`;d=d||f.value===n,h.push(a.jsxs("button",{type:"button",value:p,className:O("cs-option-btn",{"keyboard-active":l===p&&!u}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[f.value===n&&a.jsx(Y,{icon:o,className:"mr-2"}),f.value!==n&&a.jsx("span",{className:"mr-4"}),f.title]},m))}return h.push(a.jsx("hr",{className:"cs-divider"},"option-divider")),h.push(a.jsxs("button",{type:"button",value:ut,className:O("cs-option-btn",{"keyboard-active":u}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!d&&n!==null?a.jsx(Y,{icon:o,className:"mr-2"}):a.jsx("span",{className:"mr-4"}),i]},"option-custom-label")),h.push(a.jsxs("div",{className:"cs-custom-container",children:[a.jsx("span",{className:"mr-2"}),a.jsx(ye,{ref:this.input,onChange:this.handleCustomInput,value:c,onFocus:()=>this.setState({inputFocused:!0}),onBlur:()=>this.setState({inputFocused:!1})},"option-input"),a.jsx("span",{className:"ml-2"})]},"cs-custom-container")),h.push(a.jsx("hr",{className:"mb-2"},"option-end")),h}render(){const{disabled:e,invalid:n,value:o,"data-testid":i}=this.props,{menuIsOpen:l}=this.state;let{popperOptions:c}=this.props;return c={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...c},a.jsx("div",{className:"input-group cs-container context-menu",ref:this.csContainer,"data-testid":i,children:a.jsx("div",{className:O("input-group-append cs-dropdown",{"cs-dropdown-invalid":n}),children:a.jsxs("button",{type:"button",className:O("btn cs-btn form-control",{"cs-btn-invalid":n}),ref:this.button,onClick:this.toggleMenu,disabled:e,children:[a.jsx("span",{className:O({"text-muted":o===null}),children:this.getSelectedText()}),a.jsx("span",{children:a.jsx(Y,{icon:Tt,className:"cs-caret"})}),a.jsx(wt,{isShown:l,actions:{menuElement:this.renderMenuElement()},popperOptions:c,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}};let te=V;E(te,"MENU_NAVIGATION_DIRECTION",_t),E(te,"DROP_DOWN_MENU_HEIGHT",125),E(te,"defaultProps",{onChange(){},value:null,disabled:!1,popperOptions:{},icon:Ln,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 no=te,so=A.module("DateInput"),oo="[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"],ao="YYYY-MM-DD",Ze=D.forwardRef((s,t)=>{const{className:e="",onChange:n=()=>{},defaultValue:o="",onFocus:i=()=>{},onBlur:l=()=>{},"data-testid":c}=s,[u,d]=r.useState(o),[h,p]=r.useState(),f=r.useCallback(m=>{so.debug("handleChange",m),d(m),n(m)},[n]);return a.jsx("div",{className:"d-flex flex-row align-items-center",children:a.jsx(Ge,{ref:t,className:O(e),example:io,getNextSegmentValue:Gn,onChange:f,onSelect:p,pattern:oo,placeholder:ao,selection:h,value:u,onFocus:i,onBlur:l,"data-testid":c})})});Ze.displayName="DateInput";Ze.defaultProps={className:"",onChange:()=>!1,defaultValue:"",onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const ro=Ze;class Ft extends r.PureComponent{constructor(e){super(e);E(this,"searchInput");this.searchInput=D.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=ue(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){const{value:n}=this.props;e.value!==n&&this.setState({value:n})}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:n}=this.state;e(n)}render(){const{placeholder:e,className:n,matchCount:o,id:i,"data-testid":l}=this.props,{value:c}=this.state;return a.jsx(Ke,{value:c,placeholder:e,onChange:this.handleChange,className:n,matchCount:o,ref:this.searchInput,id:i,"data-testid":l})}}E(Ft,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});const lo=Ft;function co(s){const{isInvalid:t=!1,items:e,onAdd:n=()=>{},onDelete:o=()=>{},validate:i=()=>null}=s,[l,c]=r.useState(null),[u,d]=r.useState([]),[h,p]=r.useState(""),f=r.useCallback(v=>{d(v)},[]),m=r.useCallback(()=>{o(lt.getItemsInRanges(e,u)),d([])},[e,u,o]),b=r.useCallback(()=>{if(h==="")return;const v=i(h);v==null?(n(h),p("")):c(v)},[h,n,i]),T=r.useCallback(v=>{const{value:y}=v.target;p(y),c(y===""?null:i(y))},[i]),C=r.useCallback(()=>{d([])},[]),M=r.useCallback(v=>{v.key==="Enter"&&b()},[b]),P=r.useMemo(()=>14+Pe(e.length,1,6)*De.DEFAULT_ROW_HEIGHT,[e.length]);return a.jsxs("div",{className:O("editable-item-list-container",{"is-invalid":t}),children:[a.jsx("div",{style:{height:P},children:a.jsx(De,{itemCount:e.length,items:e.map((v,y)=>({value:v,isSelected:lt.isSelected(u,y)})),offset:0,selectedRanges:u,onSelectionChange:f,isMultiSelect:!0})}),a.jsxs("div",{className:"d-flex flex-row pt-2",children:[a.jsx("div",{className:"d-flex flex-grow-1",children:a.jsx("input",{className:O("form-control",{"is-invalid":l!=null}),placeholder:"Enter value",type:"text",value:h,onChange:T,onFocus:C,onKeyDown:M})}),a.jsxs("div",{className:"d-flex align-items-start mt-1 ml-2",children:[a.jsx(H,{kind:"ghost",onClick:b,disabled:l!=null||h==="",icon:_n,tooltip:"Add new item","data-testid":"add-item-button"}),a.jsx(H,{kind:"ghost",onClick:m,disabled:u.length===0,icon:Fn,tooltip:"Delete selected items","data-testid":"delete-item-button"})]})]})]})}const ce=class extends r.Component{static isParentSelected(t,e){const n=e.get(t);if(n===void 0)return!1;if(typeof n=="boolean")return n;const o=Array.from(n.values()).includes(!0),i=Array.from(n.values()).includes(!1);return o&&i?null:o}constructor(t){super(t),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(t){t.stopPropagation(),t.preventDefault(),this.setState(e=>{const{menuIsOpen:n}=e;return{menuIsOpen:!n}})}toggleValueFor(t,e){const{valueMap:n,onUpdateValueMap:o}=this.props,i=new Map(n),l=i.get(t);if(l instanceof Map){const u=new Map(l);if(e!=null)u.set(e,l.get(e)===void 0);else{const d=ce.isParentSelected(t,i),h=d==null||!d;l.forEach((p,f)=>u.set(f,h))}i.set(t,u)}else i.set(t,l==null||!l);const c=i.get(t);if(e===void 0&&c!==void 0&&typeof c!="boolean"){const u=ce.isParentSelected(t,n);u!=null&&u?c.forEach((d,h)=>c.set(h,!1)):c.forEach((d,h)=>c.set(h,!0))}o(i)}setAllValues(t){const{valueMap:e,onUpdateValueMap:n}=this.props,o=new Map;e.forEach((i,l)=>{if(typeof i=="boolean")o.set(l,t);else{const c=new Map;i.forEach((u,d)=>c.set(d,t)),o.set(l,c)}}),n(o)}selectAll(){this.setAllValues(!0)}clear(){this.setAllValues(!1)}renderMenuElement(){const{valueMap:t,"data-testid":e}=this.props;return a.jsxs("div",{className:"hcm-menu-container",children:[Array.from(t.entries()).map(([n,o])=>a.jsxs("div",{children:[a.jsx(Le,{className:"hcm-parent",checked:ce.isParentSelected(n,t),onChange:()=>this.toggleValueFor(n),children:n}),o!==void 0&&typeof o!="boolean"&&Array.from(o.entries()).map(([i,l])=>a.jsx(Le,{className:"hcm-child",checked:l,onChange:()=>this.toggleValueFor(n,i),children:i},i))]},n)),a.jsx(H,{kind:"ghost",onClick:this.selectAll,"data-testid":e!==void 0?`${e}-btn-select-all`:void 0,children:"Select All"}),a.jsx(H,{kind:"ghost",onClick:this.clear,"data-testid":e!==void 0?`${e}-btn-clear`:void 0,children:"Clear"})]})}render(){const{menuText:t,className:e,icon:n,id:o,"data-testid":i}=this.props,{menuIsOpen:l}=this.state;return a.jsxs("button",{type:"button",className:O("btn hcm-btn",e),onClick:this.toggleMenu,id:o,"data-testid":i,children:[a.jsxs("span",{children:[n&&a.jsx(Y,{icon:n,className:"hcm-icon mr-1"}),t]}),a.jsx(Y,{icon:Tt,className:"hcm-icon ml-1"}),a.jsx(We,{options:{placement:"bottom"},isShown:l,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}};let xe=ce;E(xe,"defaultProps",{className:"",icon:null,id:"","data-testid":void 0});const uo=xe;const ho=.025,po=.9,fo=.1,mo=.618,je=Q["primary-dark"],dt=80,go=Q["gray-800"],vo=Q["gray-900"],J={SIZE:8,DOT_SIZE:2,FILL_OPACITY:.25},G=18,bo=250,Co=60*1e3,xo=D.memo(()=>{const s=r.useRef(null),t=r.useRef(null),[e,n]=r.useState(!1),o=window.devicePixelRatio;let i,l,c,u,d,h=null,p=[];function f(){t.current!=null&&(c=t.current.offsetWidth,u=t.current.offsetHeight),s.current!=null&&(s.current.style.width=`${c}px`,s.current.style.height=`${u}px`,s.current.width=c*o,s.current.height=u*o),i==null||i.scale(o,o)}function m(){const k=document.createElement("canvas");k.width=J.SIZE,k.height=J.SIZE;const N=k.getContext("2d");return N!=null&&(N.fillStyle=je,N.fillRect(0,0,J.DOT_SIZE,J.DOT_SIZE),N.fillStyle=je+Math.round(255*J.FILL_OPACITY).toString(16).padStart(2,"0"),N.fillRect(0,0,J.SIZE,J.SIZE)),N==null?void 0:N.createPattern(k,"repeat")}function b(k){const N=Math.random()-.5;let _=ho*N;return k<fo?_=Math.abs(_):k>po&&(_=-Math.abs(_)),k+_}function T(){const k=[];let N=mo;for(let _=0;_<c+G;_+=1)N=b(N),k.push(N);return k}function C(){for(;p.length>=c+G;)p.pop();for(;p.length<c+G;)p.push(b(p[p.length-1]))}function M(k,N){N.beginPath(),N.moveTo(-1,u+1),N.lineTo(-1,u*k[0]);for(let _=0;_<k.length;_+=1)N.lineTo(_,u*k[_]);N.lineTo(c+G,u*k[k.length-1]),N.lineTo(c+G,u+1),N.closePath()}function P(k){k.beginPath();for(let N=1;N<c;N+=dt)k.moveTo(N,0),k.lineTo(N,u);for(let N=1;N<u;N+=dt)k.moveTo(0,N),k.lineTo(c,N)}function v(k){h=h??k,Kn(i),i.fillStyle=vo,i.fillRect(0,0,c,u),P(i),i.lineWidth=1,i.strokeStyle=go,i.stroke();const N=((h??0)-(k??0))/(1e3/G);if(i.translate(N,0),M(p,i),i.lineWidth=2,i.strokeStyle=je,i.stroke(),i.translate(-N,0),l!=null&&(i.fillStyle=l),i.fill(),i.setTransform(o,0,0,o,0,0),(k??0)-(h??0)>1e3/G){const _=Math.floor(((k??0)-(h??0))/(1e3/G));for(let me=0;me<_;me+=1)p.shift(),p.push(b(p[p.length-1]));h=k}d!=null&&cancelAnimationFrame(d),d=requestAnimationFrame(v)}const y=ue(()=>{d=requestAnimationFrame(k=>{f(),C(),n(!1),v(k)})},bo,{leading:!0});function S(){n(!0),d!=null&&cancelAnimationFrame(d),d=null,h=null}const x=ue(()=>{S()},Co);function I(){d==null&&(n(!1),f(),C(),d=requestAnimationFrame(v)),x()}function L(){document.hasFocus()&&I()}function Z(){d!=null&&cancelAnimationFrame(d),x(),y()}return r.useEffect(()=>{var k;return i=(k=s.current)==null?void 0:k.getContext("2d",{alpha:!1}),f(),p=T(),l=m(),v(),x(),window.addEventListener("resize",Z),window.addEventListener("focus",I),window.addEventListener("blur",S),window.addEventListener("mousemove",L),window.addEventListener("keydown",L),()=>{d!=null&&cancelAnimationFrame(d),window.removeEventListener("resize",Z),window.removeEventListener("focus",I),window.removeEventListener("blur",S),window.removeEventListener("mousemove",L),window.removeEventListener("keydown",L),x.cancel(),y.cancel()}},[]),a.jsx("div",{className:"random-area-plot-animation-container",ref:t,children:a.jsx("canvas",{ref:s,className:e?"shade":""})})}),Ut=xo;const Je=D.forwardRef((s,t)=>{const{children:e,className:n,disabled:o,id:i,isLinked:l,isLinkedSource:c,isInvalid:u,onClick:d,onMouseEnter:h,onMouseLeave:p,style:f,"data-testid":m}=s;return a.jsxs("button",{ref:t,type:"button",className:O("btn-socketed",{"btn-socketed-linked":l!==void 0&&l||c},{"btn-socketed-linked-source":c},{"is-invalid":u},n),id:i,onClick:d,onMouseEnter:h,onMouseLeave:p,style:f,disabled:o,"data-testid":m,children:[e,a.jsx(Y,{icon:Un,className:"linked btn-socketed-icon",transform:"down-1"}),a.jsx(Y,{icon:$n,className:"is-invalid btn-socketed-icon"})]})});Je.displayName="SocketedButton";Je.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 Eo=Je,To={"dh-spectrum-theme--dark":"_dh-spectrum-theme--dark_i6xja_5"},yo={"dh-spectrum-theme--light":"_dh-spectrum-theme--light_16vb7_5"},{global:ko,light:No,dark:So,medium:Io,large:wo}=In,Oo={global:ko,light:{...No,...yo},dark:{...So,...To},medium:Io,large:wo},jo="_track_535ju_30",Mo="_handle_535ju_13",Ro="_ticks_535ju_98",$t={"handle-size":"15px","popover-width":"90px","time-slider":"_time-slider_535ju_3","time-slider-popovers":"_time-slider-popovers_535ju_8","handle-popper":"_handle-popper_535ju_13","flex-spacer":"_flex-spacer_535ju_26",track:jo,"track-fills":"_track-fills_535ju_37","track-fill":"_track-fill_535ju_37","track-fill-start":"_track-fill-start_535ju_55","track-fill-middle":"_track-fill-middle_535ju_56","track-fill-end":"_track-fill-end_535ju_59","handle-track":"_handle-track_535ju_62",handle:Mo,ticks:Ro,"tick-labels":"_tick-labels_535ju_116","tick-label":"_tick-label_535ju_116","tick-label-wrapper":"_tick-label-wrapper_535ju_132"};const be=parseInt($t["handle-size"],10),ht=parseInt($t["popover-width"],10),U=24*60*60-1,pt=5*60;function Ao({startTime:s,endTime:t,onChange:e,isStartModified:n=!1,isEndModified:o=!1,"data-testid":i}){const[l,c]=r.useState(s),[u,d]=r.useState(t),h=r.useRef(null);r.useEffect(function(){c(s),d(t)},[s,t]);const p=r.useCallback((b,T)=>{let C=b,M=T;C===M&&(M<U?M+=1:C-=1),c(C),d(M),e({startTime:C,endTime:M})},[c,d,e]),f=r.useCallback(b=>{p(b,u)},[p,u]),m=r.useCallback(b=>{p(l,b)},[p,l]);return a.jsxs("div",{className:"time-slider","data-testid":i,children:[a.jsx(Po,{startTime:l,endTime:u,onStartTimeChange:f,onEndTimeChange:m,isStartModified:n,isEndModified:o}),a.jsxs("div",{className:"track",ref:h,children:[a.jsx(Do,{startTime:l,endTime:u}),a.jsx("div",{className:"ticks",children:Array(24).fill(null).map((b,T)=>a.jsx("div",{className:"tick"},T))}),a.jsx(ft,{track:h,time:l,setTime:f}),a.jsx(ft,{track:h,time:u,setTime:m})]}),a.jsxs("div",{className:"tick-labels",children:[a.jsx("div",{className:"tick-label",children:"0:00"}),a.jsx("div",{className:"tick-label-wrapper",children:Array(24).fill(null).map((b,T)=>a.jsx("div",{className:"tick-label",children:`${T+1}:00`},T))})]})]})}function Po(s){const{startTime:t,endTime:e,onStartTimeChange:n,onEndTimeChange:o,isStartModified:i,isEndModified:l,"data-testid":c}=s,u=t>e,[d,h]=r.useState(u?e:t),[p,f]=r.useState(u?t:e),m=r.useRef(null),b=r.useRef(null),T=r.useRef(null),C=r.useRef(null);r.useEffect(function(){h(t>e?e:t),f(t>e?t:e)},[t,e]),r.useEffect(function(){var x,I;T.current!==null&&((x=b.current)==null||x.setSelection(T.current)),C.current!==null&&((I=m.current)==null||I.setSelection(C.current))},[u]);function M(S){t<=e?n(S):o(S)}function P(S){t<=e?o(S):n(S)}const v=r.useCallback(S=>{T.current=S,C.current=null},[]),y=r.useCallback(S=>{T.current=null,C.current=S},[]);return a.jsxs("div",{className:"time-slider-popovers",children:[a.jsx("div",{className:"flex",style:{flexBasis:`calc(${d/U*100}% - ${ht/2}px)`}}),a.jsxs("div",{className:"handle-popper",children:[a.jsx("label",{className:O({modified:u?l:i}),children:u?"End Time":"Start Time"}),a.jsx(ye,{ref:m,allowValueWrapping:!1,value:d,onChange:M,onSelect:v,"data-testid":c!==void 0?`${c}-input-1`:void 0})]}),a.jsx("div",{className:"flex-spacer"}),a.jsxs("div",{className:"handle-popper",children:[a.jsx("label",{className:O({modified:u?i:l}),children:u?"Start Time":"End Time"}),a.jsx(ye,{ref:b,allowValueWrapping:!1,value:p,onChange:P,onSelect:y,"data-testid":c!==void 0?`${c}-input-2`:void 0})]}),a.jsx("div",{className:"flex",style:{flexBasis:`calc(${(U-p)/U*100}% - ${ht/2}px)`}})]})}function Do(s){const{startTime:t,endTime:e,"data-testid":n}=s;return a.jsxs("div",{className:"track-fills","data-testid":n,children:[t>e&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"track-fill track-fill-start",style:{transform:`scaleX(${e/U})`}}),a.jsx("div",{className:"track-fill track-fill-end",style:{transform:`scaleX(${(U-t)/U})`}})]}),t<e&&a.jsx("div",{className:"track-fill track-fill-middle",style:{transform:`translateX(${t/U*100}%) scaleX(${(e-t)/U})`}})]})}function ft(s){const{track:t,time:e,setTime:n,"data-testid":o}=s,i=r.useMemo(()=>{let m=be/2;return e<3600?m=e/3600*(be/2):e>23*3600&&(m=be/2+1/(U-23*3600)*(e-23*3600)*(be/2)),`translateX(calc(${e/U*100}% - ${m}px))`},[e]),l=r.useCallback(f=>{if(!t.current)return 0;const m=t.current.getBoundingClientRect(),b=Math.max(f-m.left,0),T=U*Math.min(1,b/m.width),C=pt*Math.round(T/pt);return Math.min(U,C)},[t]),c=r.useCallback(({clientX:f})=>{n(l(f))},[n,l]),u=r.useCallback(({clientX:f})=>{n(l(f)),window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",u),document.documentElement.classList.remove("drag-pointer-events-none")},[n,l,c]),d=r.useCallback(()=>{window.addEventListener("mousemove",c),window.addEventListener("mouseup",u),document.documentElement.classList.add("drag-pointer-events-none")},[c,u]),h=r.useCallback(()=>{window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",u),document.documentElement.classList.remove("drag-pointer-events-none")},[c,u]),p=r.useCallback(()=>{d()},[d]);return r.useEffect(function(){return()=>{h()}},[h]),a.jsx("div",{className:"handle-track",style:{transform:i},children:a.jsx("button",{className:"handle",type:"button","aria-label":"Change time",onMouseDown:p,"data-testid":o})})}function Vt({buttons:s,isShown:t=!1,classNames:e,message:n,type:o,onClick:i,onDismiss:l,"data-testid":c}){const u=s&&s.length!==0;return a.jsx(Ee,{in:t,timeout:Q.transitionMs,classNames:"toast-notification-slide-up",mountOnEnter:!0,unmountOnExit:!0,children:a.jsxs("div",{className:O("toast-notification",e,o),role:"presentation",onClick:i,onKeyPress:i,"data-testid":c,children:[a.jsx("div",{className:"message-container",children:a.jsx("span",{className:"message",children:n})}),a.jsx(Ee,{in:u,timeout:Q.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:a.jsx("div",{className:"buttons-container",children:s})}),l&&a.jsx(H,{kind:"ghost",icon:Vn,tooltip:"Close notification",className:"my-2",onClick:l})]})})}Vt.TYPE=Object.freeze({ERROR:"error"});function Lo(s){const{children:t,className:e,labelText:n,hintText:o,isModified:i,validationError:l,showValidationError:c=!0,"data-testid":u,id:d}=s,{current:h}=r.useRef(d??he());return a.jsxs(a.Fragment,{children:[a.jsx("label",{className:O("validate-label",e,{modified:i}),htmlFor:h,"data-testid":u,children:n}),D.Children.toArray(t).map(p=>D.isValidElement(p)?D.cloneElement(p,{className:O(p.props.className,{"is-invalid":l})}):a.jsx("div",{className:O(e),children:p})),o!==void 0&&a.jsx("small",{className:"form-text text-muted",children:o}),l!==void 0&&c&&a.jsx("p",{className:"validate-label-error text-danger",children:l})]})}const _o=Object.freeze(Object.defineProperty({__proto__:null,AutoCompleteInput:Ws,AutoResizeTextarea:qe,BasicModal:Ye,Button:H,ButtonGroup:fe,ButtonOld:Zs,CardFlip:Js,Checkbox:Le,Collapse:Qs,ComboBox:zn,ContextActionUtils:qn,ContextActions:Yn,ContextMenuItem:Zn,ContextMenuRoot:Jn,CopyButton:Qn,CustomTimeSelect:no,DEFAULT_GET_PREFERRED_REPLACEMENT_STRING:It,DateInput:ro,DateTimeInput:Xn,DebouncedModal:qs,DebouncedSearchInput:lo,DragUtils:es,DraggableItemList:ts,DropdownMenu:wt,EditableItemList:co,GLOBAL_SHORTCUTS:ns,HierarchicalCheckboxMenu:uo,InfoModal:Ys,ItemList:De,ItemListItem:ss,KEY:os,LoadingOverlay:ae,LoadingSpinner:yt,MODIFIER:is,MaskedInput:Ge,Menu:as,MenuItem:rs,Modal:Be,ModalBody:He,ModalFooter:Dt,ModalHeader:Et,Option:ls,Page:cs,Popper:We,RadioGroup:us,RadioItem:ds,RandomAreaPlotAnimation:Ut,SearchInput:Ke,Select:hs,SelectValueList:Ot,Shortcut:ps,ShortcutRegistry:fs,SocketedButton:Eo,Stack:ms,ThemeExport:Q,TimeInput:ye,TimeSlider:Ao,ToastNotification:Vt,Tooltip:gs,UISwitch:vs,ValidateLabelInput:Lo,fillToLength:bs,themeDHDefault:Oo,trimTrailingMask:Cs},Symbol.toStringTag,{value:"Module"})),Fo=Object.freeze(Object.defineProperty({__proto__:null,ApiBootstrap:Bn,ApiContext:kt,ClientBootstrap:jt,ClientContext:xs,useApi:W,useClient:pe},Symbol.toStringTag,{value:"Module"}));function Uo(s){return function({children:e}){return a.jsx(kt.Provider,{value:s,children:e})}}const Me=A.module("MessageUtils"),Bt="io.deephaven.message.LoginOptions.request",Ht="io.deephaven.message.SessionDetails.request",Wt="io.deephaven.broadcast",Qe="io.deephaven.broadcast.Login",Gt="io.deephaven.broadcast.Logout";function Se(s){const t=s;return t!=null&&typeof t.id=="string"&&typeof t.message=="string"}function Kt(s){return Se(s)&&s.message===Qe}function zt(s){return Se(s)&&s.message===Gt}function qt(s){const t=s;return t!=null&&typeof t.id=="string"}function Xe(s,t=he(),e){return{message:s,id:t,payload:e}}function $o(s,t){return{id:s,payload:t}}async function et(s,t=3e4){if(window.opener==null)throw new Error("window.opener is null, unable to send request.");return new Promise((e,n)=>{let o;const i=he(),l=c=>{const{data:u}=c;if(!qt(u)){Me.debug("Ignoring non-deephaven response",u);return}if(Me.debug("Received message",u),(u==null?void 0:u.id)!==i){Me.debug("Ignore message, id doesn't match",u);return}window.clearTimeout(o),window.removeEventListener("message",l),e(u.payload)};window.addEventListener("message",l),o=window.setTimeout(()=>{window.removeEventListener("message",l),n(new Es("Request timed out"))},t),window.opener.postMessage(Xe(s,i),"*")})}class Yt extends Error{constructor(){super(...arguments);E(this,"isNoConsolesError",!0)}}function Zt(s){return s.isNoConsolesError}const ne=A.module("SessionUtils");function Vo(s,t){return ne.info(`Starting connection to '${t}'...`),new s.IdeConnection(t)}async function Jt(s,t,e){ne.info("Getting console types...");const n=await t.getConsoleTypes();if(n.length===0)throw new Yt("No console types available");ne.info("Available types:",n);const o=n[0];ne.info("Starting session with type",o);const i=await t.startSession(o),l={type:o,id:he.generate()};return ne.info("Console session established",l),{session:i,config:l,connection:t,details:e,dh:s}}function Bo(s,t,e){return ne.info("createCoreClient",t),new s.CoreClient(t,e)}function Ho(s){return s!=null&&typeof s=="object"}async function Wo(){const s=await et(Ht);if(!Ho(s))throw new Error(`Unexpected session details response: ${s}`);return s}async function Go(){switch(new URLSearchParams(window.location.search).get("authProvider")){case"parent":return Wo()}return{}}async function Ko(s,t,e){let n;try{n=await Jt(s,t,e)}catch(o){if(!Zt(o))throw o}return n}const zo=A.module("ViewportDataUtils");function Qt(s,t){return String(s.offsetInSnapshot+t)}function Xt(s,t){return function(n){const{columns:o,offset:i,rows:l}=n.detail;zo.debug("table updated",n.detail),l.forEach(c=>{const u=t(c,o),d={key:Qt(c,i),item:u};s.getItem(d.key)!=null?s.update(d.key,d):s.append(d)})}}function en(s,t){return t.reduce((e,n)=>(e[n.name]=s.get(n),e),{})}function*tn(s,t){for(let e=s;e<=t;++e)yield{key:String(e)}}function qo(s,...t){return t.map(e=>s.getItem(e))}function tt(s){return s==null||Ie(s)?0:s.size}function Ie(s){return"isClosed"in s?s.isClosed:!1}function nn(s,t,e,n){const o=s+t-1,[i,l]=[0,n-1],c=Pe(s-e,i,l),u=Pe(o+e,i,l);return[c,u]}const Yo=Object.freeze(Object.defineProperty({__proto__:null,BROADCAST_CHANNEL_NAME:Wt,BROADCAST_LOGIN_MESSAGE:Qe,BROADCAST_LOGOUT_MESSAGE:Gt,BooleanColumnFormatter:Ts,CharColumnFormatter:ys,DateTimeColumnFormatter:ks,DateUtils:Ns,DecimalColumnFormatter:Ss,DefaultColumnFormatter:Is,FETCH_TIMEOUT:ws,Formatter:Mt,FormatterUtils:_e,IntegerColumnFormatter:Os,LOGIN_OPTIONS_REQUEST:Bt,NoConsolesError:Yt,SESSION_DETAILS_REQUEST:Ht,StringColumnFormatter:js,TableColumnFormatter:Ms,TableUtils:ze,createConnection:Vo,createCoreClient:Bo,createKeyFromOffsetRow:Qt,createOnTableUpdatedHandler:Xt,createSessionWrapper:Jt,defaultRowDeserializer:en,fetchVariableDefinition:Rs,generateEmptyKeyedItems:tn,getColumnFormats:As,getDateTimeFormatterOptions:Ps,getItemsFromListData:qo,getSessionDetails:Go,getSize:tt,isBroadcastLoginMessage:Kt,isBroadcastLogoutMessage:zt,isClosed:Ie,isCustomColumnFormatDefined:Ds,isMessage:Se,isNoConsolesError:Zt,isResponse:qt,loadSessionWrapper:Ko,makeMessage:Xe,makeResponse:$o,padFirstAndLastRow:nn,requestParentResponse:et},Symbol.toStringTag,{value:"Module"})),mt=A.module("useTableListener"),Zo=(s,t,e)=>r.useEffect(function(){if(s==null){mt.debug2("Emitter undefined, skipping addEventListener",t);return}return mt.debug2("Adding listener",t),s.addEventListener(t,e)},[s,t,e]),oe=Zo;class Jo extends Error{constructor(){super(...arguments);E(this,"isColumnNameError",!0)}}const Qo=Jo;class Xo extends Error{constructor(){super(...arguments);E(this,"isTableDisconnectError",!0)}}const ei=Xo,Ce=A.module("useTable"),ti=(s,t,e,n)=>{const o=W(),[i,l]=r.useState(void 0),[c,u]=r.useState([]),[d,h]=r.useState(null),[p,f]=r.useState(null);r.useEffect(()=>{if(n===void 0){l(s==null?void 0:s.columns),h(null);return}try{l(s==null?void 0:s.findColumns(n)),h(null)}catch(C){Ce.error("Column not found",C,n),h(new Qo("Invalid columnNames argument"))}},[s,n]),r.useEffect(()=>{if(!i||!s){Ce.debug2("Table or column not initialized, skip viewport update.");return}Ce.debug2("Setting viewport",t,e),s.setViewport(t,e,i)},[i,s,t,e]);const m=r.useCallback(({detail:C})=>{if(!i){Ce.error("Columns not initialized.");return}const M=i.map(P=>C.rows.map(v=>v.get(P)));u(M)},[i]),b=r.useCallback(()=>{f(new ei("Table disconnected"))},[]),T=r.useCallback(()=>{f(null)},[]);return oe(s,o.Table.EVENT_UPDATED,m),oe(s,o.Table.EVENT_DISCONNECT,b),oe(s,o.Table.EVENT_RECONNECT,T),{columns:i,data:c,error:p??d}},sn=ti,ni=(s,t,e,n)=>{const o=r.useMemo(()=>[n],[n]),{columns:i=[],data:l=[],error:c}=sn(s,t,e,o);return{column:i[0],data:l[0],error:c}},on=ni;const B=A.module("TableInput"),Re=250;function nt(s){const{className:t=void 0,columnName:e,settings:n,defaultValue:o=[],isInvalid:i=!1,onChange:l=()=>!1,onBlur:c=()=>!1,table:u}=s,d=r.useRef(null),h=W(),p=r.useMemo(()=>{const j=_e.getColumnFormats(n),w=_e.getDateTimeFormatterOptions(n),{defaultDecimalFormatOptions:R={},defaultIntegerFormatOptions:$={}}=n;return new Mt(h,j,w,R,$)},[h,n]),[f,m]=r.useState(""),[b,T]=r.useState(new Set(o)),[C,M]=r.useState(),P=r.useRef(null),v=Math.min((C==null?void 0:C.size)??0,Re),{column:y,data:S,error:x}=on(C,0,Re-1,e),I=r.useCallback(j=>y?p.getFormattedString(j,y.type,y.name):`${j}`,[y,p]),[L,Z]=r.useMemo(()=>{const j=new Set(b),w=[];if(S==null)return[w,null];if(S.forEach(R=>{const $=`${R}`,ve=b.has($);ve&&j.delete($),w.push({value:$,displayValue:I(R),isSelected:ve})}),j.size>0){B.debug2("Selection has items that are missing from the viewport");const R=new Set(b);return Array.from(j).forEach($=>{R.delete($)}),[w,R]}return[w,null]},[S,b,I]);r.useEffect(()=>{Z!==null&&(T(Z),l(Array.from(Z)))},[l,Z]);const k=r.useCallback(async j=>{try{const w=await j;B.debug("Table resolved",w),M(w)}catch(w){if(ct.isCanceled(w))return;B.error(w)}},[]);r.useEffect(()=>{const j=ct.makeCancelable(u);return k(j),()=>{B.debug2("Cancel table promise"),j.cancel()}},[u,k]);const N=r.useCallback(j=>{var $;const{value:w}=j.target;m(w);const R=L.findIndex(ve=>ve.displayValue.includes(w));R>-1?(B.debug2(`Found ${w} at index ${R}`),($=P.current)==null||$.scrollIntoView(R)):B.debug2(`${w} not found`)},[L,P]),_=r.useCallback(j=>{if(B.debug("handleSelect",j),j>=L.length){B.error("Invalid index",j);return}const w=L[j].value,R=new Set(b);L[j].isSelected?R.delete(w):R.add(w),T(R),l(Array.from(R))},[l,L,b]),me=r.useCallback(()=>{const j=L.map(R=>R.value),w=new Set(j);T(w),l(j)},[L,l]),En=r.useCallback(()=>{T(new Set),l([])},[l]),Tn=r.useCallback(()=>{},[]),ge=r.useCallback(j=>{var R;const{relatedTarget:w}=j;B.debug("handleChildBlur",w,w instanceof HTMLElement,d.current,(R=d.current)==null?void 0:R.contains(w)),(!w||d.current&&w instanceof HTMLElement&&!d.current.contains(w))&&c()},[c]),Oe=L.length===0;return a.jsxs("div",{ref:d,className:O("table-input-container d-flex flex-column position-relative",t),children:[a.jsx(Ke,{disabled:!!x||Oe,value:f,placeholder:"Search",onChange:N,className:"mb-2 d-flex",onBlur:ge}),a.jsx(Ot,{className:"table-input-list",disabled:C===void 0||Oe,isInvalid:i,items:Oe?[{value:"Empty",isSelected:!1}]:L,itemCount:v,offset:0,onSelect:_,onViewportChange:Tn,ref:P,onBlur:ge}),C&&a.jsxs("div",{className:"meta-row",children:[a.jsx("div",{className:"d-flex align-items-center text-muted small",children:C!=null&&C.size>v&&a.jsxs(a.Fragment,{children:["Table is too large, showing the first ",Re," items."]})}),a.jsxs("div",{children:[a.jsx("button",{type:"button",className:"btn btn-link",onBlur:ge,onClick:me,children:"Select All"}),a.jsx("button",{type:"button",className:"btn btn-link mr-a",onBlur:ge,onClick:En,children:"Clear"})]})]}),C==null||x&&a.jsx("div",{className:"h-100 w-100 position-absolute",children:a.jsx(ae,{isLoaded:C!=null,isLoading:C==null&&x==null,errorMessage:(x==null?void 0:x.message)??null})})]})}nt.displayName="TableInput";nt.defaultProps={isInvalid:!1,className:void 0};const gt=A.module("useBroadcastChannel");function st(s=Ls,t=Wt){const e=r.useMemo(()=>new BroadcastChannel(t),[t]);return r.useEffect(()=>()=>{e.close()},[e]),r.useEffect(()=>{function n(o){const{data:i}=o;if(!Se(i)){gt.debug("Ignoring non-deephaven message",i);return}gt.debug("event received",i),s(o)}return e.addEventListener("message",n),()=>{e.removeEventListener("message",n)}},[e,s]),e}function we(s,t){const e=r.useCallback(n=>{Kt(n.data)?s==null||s(n.data):zt(n.data)&&(t==null||t(n.data))},[s,t]);st(e)}const ke="io.deephaven.web.client.auth.refreshToken",an=r.createContext(null),si=A.module("RefreshTokenUtils");function Fe(){const s=ie.get(ke);try{if(s!=null)return JSON.parse(s)}catch(t){si.error("Error parsing refresh token",s,t)}return null}function Ue(s){if(s==null){ie.remove(ke);return}const t=JSON.stringify({bytes:s.bytes,expiry:s.expiry}),e=new Date(s.expiry);ie.set(ke,t,{secure:!0,sameSite:"strict",expires:e})}function rn({children:s}){const t=W(),e=pe(),[n,o]=r.useState(Fe());r.useEffect(function(){return e.addEventListener(t.CoreClient.EVENT_REFRESH_TOKEN_UPDATED,d=>{const{detail:h}=d;Ue(h),o(h)})},[t,e,n]);const i=r.useCallback(()=>{o(Fe())},[]),l=r.useCallback(()=>{Ue(null),o(null)},[]);return we(i,l),a.jsx(an.Provider,{value:n,children:s})}const vt=A.module("useDebouncedViewportSearch"),oi=200;function ii(s,t,e=oi){const n=W(),o=r.useMemo(()=>new ze(n),[n]),{table:i,applyFiltersAndRefresh:l}=s,c=r.useMemo(()=>ue(u=>{if(vt.debug(`Applying debounced searchText '${u}'`),i==null)return;const d=u.trim();if(d===""){l([]);return}const h=i.findColumn(t),p=o.makeFilterValue(h.type,d),f=[h.filter().contains(p)];l(f)},e),[l,t,e,i,o]);return r.useEffect(()=>()=>{vt.debug("Cancelling debounced search function"),c.cancel()},[c]),c}function ot(s){const[,t]=r.useState(0),e=W();return oe(s,e.Table.EVENT_SIZECHANGED,()=>{t(n=>n+1)}),tt(s)}function ln(s){const t=wn({}),e=St(s),n=Math.max(0,ot(s));return r.useEffect(()=>{let o=t.items.length;if(s!==e&&o&&(t.remove(...t.items.map(({key:i})=>i)),o=0),!!s){if(n>o)t.insert(o,...tn(o,n-1));else if(n<o){const i=t.items.slice(n).map(({key:l})=>l);t.remove(...i)}}},[n,s]),t}function ai(s,...t){const e=r.useCallback(async()=>(s==null?void 0:s.selectDistinct(s.findColumns(t)))??null,[s,...t]),{data:n,error:o,isError:i,isLoading:l}=At(e,[]);return r.useEffect(()=>()=>{n==null||n.close()},[n]),{distinctTable:n,error:o,isError:i,isLoading:l}}function cn(s,t,e){return r.useCallback(function(o){const[i,l]=nn(o,t,e,tt(s));s==null||s.setViewport(i,l)},[s,e,t])}function ri(s){r.useEffect(()=>()=>{s!=null&&(Ie(s)||s.close())},[s])}function li(){const s=W();return r.useMemo(()=>new ze(s),[s])}function ci({table:s,viewportSize:t=10,viewportPadding:e=50,deserializeRow:n=en}){const o=ln(s),i=cn(s,t,e),l=r.useCallback(d=>{s==null||s.applyFilter(d),i(0)},[i,s]),c=W();oe(s,c.Table.EVENT_UPDATED,Xt(o,n));const u=ot(s);return r.useEffect(()=>{s&&!Ie(s)&&i(0)},[s,i,u]),{viewportData:o,size:u,table:s,applyFiltersAndRefresh:l,setViewport:i}}const ui=Object.freeze(Object.defineProperty({__proto__:null,REFRESH_TOKEN_KEY:ke,RefreshTokenBootstrap:rn,RefreshTokenContext:an,TableInput:nt,makeApiContextWrapper:Uo,readRefreshToken:Fe,storeRefreshToken:Ue,useBroadcastChannel:st,useBroadcastLoginListener:we,useDebouncedViewportSearch:ii,useInitializeViewportData:ln,useSelectDistinctTable:ai,useSetPaddedViewportCallback:cn,useTable:sn,useTableClose:ri,useTableColumn:on,useTableListener:oe,useTableSize:ot,useTableUtils:li,useViewportData:ci},Symbol.toStringTag,{value:"Module"})),un=r.createContext(!1);function di({fontClassNames:s=["fira-sans-regular","fira-sans-bold","fira-mono"],children:t}){const[e,n]=r.useState(!1);return r.useEffect(function(){document.fonts.ready.then(()=>{n(!0)})},[]),a.jsxs(a.Fragment,{children:[a.jsx(un.Provider,{value:e,children:t}),a.jsx("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:s.map(o=>a.jsx("p",{className:o,children:"preload"},o))})]})}function dn(s){if(s==null)return!1;const t=s;return t.Component!==void 0&&typeof t.isAvailable=="function"}const hn="io.deephaven.auth.AnonymousAuthenticationHandler",hi="io.deephaven.authentication.psk.PskAuthenticationHandler";class pi extends Error{constructor(){super(...arguments);E(this,"name","AuthenticationError");E(this,"isAuthenticationError",!0)}}const pn=pi,bt=A.module("AuthPluginBase");function it({children:s,getLoginOptions:t}){const e=pe(),[n,o]=r.useState(),[i,l]=r.useState(!1);return r.useEffect(()=>{let c=!1;function u(){if(c)throw new _s("Login canceled.")}async function d(){try{const h=await t();u(),bt.info("Logging in..."),await e.login(h),u(),l(!0)}catch(h){if(!c){bt.error("Unable to login:",h);const p=de(h)??"Unable to login. Verify credentials.";o(new pn(p)),l(!1)}}}return d(),()=>{c=!0}},[e,t]),i?a.jsx(a.Fragment,{children:s}):a.jsx(ae,{"data-testid":"auth-base-loading",isLoading:n==null,isLoaded:!1,errorMessage:de(n)})}const fi=r.createContext({}),at=r.createContext({}),mi={canLogout:!1};function gi({children:s}){const t=W(),e=r.useCallback(()=>({type:t.CoreClient.LOGIN_TYPE_ANONYMOUS}),[t]);return a.jsx(it,{getLoginOptions:e,children:a.jsx(at.Provider,{value:mi,children:s})})}const vi={Component:gi,isAvailable:s=>s.includes(hn)},fn=vi,bi=A.module("AuthPluginParent"),Ci={canLogout:!1};function xi(s){return s!=null&&typeof s.type=="string"}async function Ei(){bi.info("Logging in by delegating to parent window...");const s=await et(Bt);if(!xi(s))throw new Error(`Unexpected login options response: ${s}`);return s}function Ti(){return new URLSearchParams(window.location.search).get("authProvider")??""}function yi({children:s}){return a.jsx(it,{getLoginOptions:Ei,children:a.jsx(at.Provider,{value:Ci,children:s})})}const ki={Component:yi,isAvailable:()=>window.opener!=null&&Ti()==="parent"},mn=ki;function gn({children:s,errorMessage:t,isLoggingIn:e=!1,onSubmit:n}){return a.jsxs("form",{className:"login-form",onSubmit:o=>{o.preventDefault(),o.stopPropagation(),n==null||n(o)},children:[a.jsx("div",{className:"flex-spacer"}),a.jsxs("div",{className:"flex-wrapper",children:[a.jsx("fieldset",{disabled:e,className:"container-fluid",children:s}),a.jsx("div",{className:"form-group d-flex justify-content-end align-items-center mb-0",children:a.jsxs("button",{type:"submit",className:O("btn btn-primary",{"btn-spinner":e},{"btn-cancelable":e}),"data-testid":"btn-login",children:[e&&a.jsxs("span",{children:[a.jsx(yt,{}),a.jsx("span",{className:"btn-normal-content",children:"Logging in"}),a.jsx("span",{className:"btn-hover-content",children:"Cancel"})]}),!e&&"Login"]})})]}),a.jsx("div",{className:"flex-spacer",children:t!=null&&a.jsx("p",{className:"error-message mb-0",role:"alert",children:`${t}`})})]})}function vn({children:s,logoPath:t="./logo.png"}){return a.jsxs("div",{className:"login-container",children:[a.jsx(Ut,{}),a.jsxs("div",{className:"login-box",children:[a.jsx("div",{className:"logo",children:a.jsx("img",{src:t,alt:"Deephaven Data Labs"})}),s,a.jsxs("p",{className:"footer",children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})}const $e="io.deephaven.authentication.psk.PskAuthenticationHandler",bn="psk",Ve="io.deephaven.web.client.auth.psk.token",se=A.module("AuthPluginPsk");function Ni(){return new URLSearchParams(window.location.search).get(bn)}function Si(){se.debug2("clearWindowToken");const s=new URL(window.location.href);s.searchParams.delete(bn),window.history.replaceState(null,"",s.href)}function Ct(){return ie.get(Ve)??null}function Ae(s){se.debug2("Storing token in cookie",s),s!=null?ie.set(Ve,s,{secure:!0,sameSite:"strict"}):ie.remove(Ve)}function Ii({children:s,logoPath:t}){const e=pe(),n=r.useRef(null),o=r.useRef(null),[i,l]=r.useState(),[c,u]=r.useState(!1),[d,h]=r.useState(!1),[p,f]=r.useState(!1),[m,b]=r.useState(""),T=r.useCallback(async(y,S=!0)=>{se.info("Logging in..."),f(!0);let x=null;try{if(x=e.login({type:$e,token:y}),o.current=x,await x,se.info("Logged in successfully"),o.current!==x)return;Ae(y),h(!0)}catch(I){if(o.current!==x)return;if(u(!0),S){se.error("Unable to login",I);const L=de(I)??"Unable to login: Verify credentials.";l(new pn(L))}}f(!1)},[e]),C=r.useCallback(()=>{o.current=null,f(!1)},[]),M=r.useCallback(async()=>{se.debug("onLogin");const y=Ct();d||p||y==null||T(y,!1)},[d,p,T]),P=r.useCallback(()=>{Ae(null)},[]);we(M,P),r.useEffect(()=>{let y=!1;async function S(){const x=Ni()??Ct();if(Si(),x==null){u(!0);return}f(!0);try{await e.login({type:$e,token:x}),y||(Ae(x),h(!0),f(!1))}catch{y||(u(!0),f(!1))}}return S(),()=>{y=!0}},[e]);const v=r.useCallback(()=>{p?C():T(m)},[C,p,T,m]);return r.useEffect(function(){var S;(S=n.current)==null||S.focus()},[n,c]),a.jsxs(a.Fragment,{children:[d&&s,c&&a.jsx(Ee,{in:!d,timeout:Q.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:a.jsx(vn,{logoPath:t,children:a.jsx(gn,{errorMessage:de(i),isLoggingIn:p,onSubmit:v,children:a.jsxs("div",{className:"form-group",children:[a.jsx("label",{htmlFor:"auth-psk-token-input",children:"Token"}),a.jsx("input",{id:"auth-psk-token-input",name:"token",className:"input-token form-control",type:"text",autoComplete:"username",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",ref:n,value:m,onChange:y=>{l(void 0),b(y.target.value)}})]})})})}),a.jsx(ae,{"data-testid":"auth-psk-loading",isLoaded:d||c,isLoading:!d&&!c})]})}const wi={Component:Ii,isAvailable:s=>s.includes($e)},Cn=wi,Oi=Object.freeze(Object.defineProperty({__proto__:null,AUTH_HANDLER_TYPE_ANONYMOUS:hn,AUTH_HANDLER_TYPE_PSK:hi,AuthPluginAnonymous:fn,AuthPluginBase:it,AuthPluginParent:mn,AuthPluginPsk:Cn,Login:vn,LoginForm:gn,UserOverrideContext:fi,UserPermissionsOverrideContext:at,isAuthPlugin:dn},Symbol.toStringTag,{value:"Module"})),xn={react:D,"react-dom":On,redux:jn,"react-redux":Mn,"@deephaven/auth-plugins":Oi,"@deephaven/components":_o,"@deephaven/jsapi-bootstrap":Fo,"@deephaven/jsapi-components":ui,"@deephaven/jsapi-utils":Yo,"@deephaven/log":Bs,"@deephaven/react-hooks":zs},ji=xt.createRequires(()=>xn),Mi=xt.createRemoteComponent({requires:ji}),Ri=Mi,Ai=Rn.createRequires(xn),Pi=An({requires:Ai}),Di=Pi,q=A.module("@deephaven/app-utils.PluginUtils");function ea(s,t){const e=new URL(`${t}.js`,s),n=D.forwardRef((o,i)=>a.jsx(Ri,{url:e.href,render:({err:l,Component:c})=>{if(l!=null&&l!==""){const u=`Error loading plugin ${t} from ${e} due to ${l}`;return q.error(u),a.jsx("div",{className:"error-message",children:`${u}`})}return a.jsx(c,{ref:i,...o})}}));return n.pluginName=t,n.displayName="Plugin",n}async function Li(s){return await Di(s)}async function _i(s){const t=await fetch(s);if(!t.ok)throw new Error(t.statusText);try{return await t.json()}catch{throw new Error("Could not be parsed as JSON")}}async function Fi(s){q.debug("Loading plugins...");try{const t=await _i(`${s}/manifest.json`);if(!Array.isArray(t.plugins))throw new Error("Plugin manifest JSON does not contain plugins array");q.debug("Plugin manifest loaded:",t);const e=[];for(let i=0;i<t.plugins.length;i+=1){const{name:l,main:c}=t.plugins[i],u=`${s}/${l}/${c}`;e.push(Li(u))}const n=await Promise.allSettled(e),o=new Map;for(let i=0;i<n.length;i+=1){const l=n[i],{name:c}=t.plugins[i];l.status==="fulfilled"?o.set(c,l.value):q.error(`Unable to load plugin ${c}`,l.reason)}return q.info("Plugins loaded:",o),o}catch(t){return q.error("Unable to load plugins:",t),new Map}}function Ui(s){var t;return((t=s.get("AuthHandlers"))==null?void 0:t.split(","))??[]}function $i(s,t,e){const n=Ui(t),o=[...s.entries()].filter(([,u])=>dn(u.AuthPlugin)).map(([u,d])=>[u,d.AuthPlugin]);o.push(...e??[]);const i=o.filter(([u,d])=>d.isAvailable(n,t));if(i.length===0)throw new Error(`No login plugins found, please register a login plugin for auth handlers: ${n}`);i.length>1&&q.warn("More than one login plugin available, will use the first one: ",i.map(([u])=>u).join(", "));const[l,c]=i[0];return q.info("Using LoginPlugin",l),c.Component}const rt=r.createContext(null);function Vi({pluginsUrl:s,children:t}){const[e,n]=r.useState(null);return r.useEffect(function(){let i=!1;async function l(){const c=await Fi(s);i||n(c)}return l(),()=>{i=!0}},[s]),a.jsx(rt.Provider,{value:e,children:t})}function Bi(){const s=st();return r.useEffect(function(){s.postMessage(Xe(Qe))},[s]),null}const Hi=new Map([["@deephaven/auth-plugins.AuthPluginPsk",Cn],["@deephaven/auth-plugins.AuthPluginParent",mn],["@deephaven/auth-plugins.AuthPluginAnonymous",fn]]);function Wi({children:s}){const t=pe(),e=r.useContext(rt),[n,o]=r.useState(),[i,l]=r.useState();r.useEffect(function(){let h=!1;async function p(){try{const f=await t.getAuthConfigValues();h||o(new Map(f))}catch(f){h||l(f)}}return p(),()=>{h=!0}},[t]);const c=r.useMemo(()=>{if(!(e==null||n==null))try{return $i(e,n,Hi)}catch(d){l(d)}},[n,e]),u=c==null||n==null;return u||i!=null?a.jsx(ae,{isLoading:u&&i==null,errorMessage:de(i)}):a.jsx(c,{authConfigValues:n,children:a.jsxs(a.Fragment,{children:[a.jsx(Bi,{}),s]})})}function ta(s){return new URL(s,`${window.location}`)}function Gi(){return new URLSearchParams(window.location.search).get("envoyPrefix")}function Ki(){const s=Gi();return s!=null?{headers:{"envoy-prefix":s}}:{headers:{}}}function zi({children:s}){return r.useContext(un)?a.jsx(a.Fragment,{children:s}):a.jsx(ae,{"data-testid":"fonts-loaded-loading"})}function na({fontClassNames:s,pluginsUrl:t,serverUrl:e,children:n}){const o=r.useMemo(()=>Ki(),[]),[i,l]=r.useState(0),c=r.useCallback(()=>{},[]),u=r.useCallback(()=>{l(d=>d+1)},[]);return we(c,u),a.jsx(di,{fontClassNames:s,children:a.jsx(Vi,{pluginsUrl:t,children:a.jsx(jt,{serverUrl:e,options:o,children:a.jsx(rn,{children:a.jsx(Wi,{children:a.jsx(Fs,{children:a.jsx(zi,{children:n})})})})},i)})})}function sa(){return Nt(rt,"No Plugins available in usePlugins. Was code wrapped in PluginsBootstrap or PluginsContext.Provider?")}export{na as AppBootstrap,Wi as AuthBootstrap,Fs as ConnectionBootstrap,aa as ConnectionContext,di as FontBootstrap,zi as FontsLoaded,un as FontsLoadedContext,Vi as PluginsBootstrap,rt as PluginsContext,Ri as RemoteComponent,Ui as getAuthHandlers,$i as getAuthPluginComponent,ta as getBaseUrl,Ki as getConnectOptions,Gi as getEnvoyPrefix,ea as loadComponentPlugin,_i as loadJson,Li as loadModulePlugin,Fi as loadModulePlugins,ra as useConnection,sa as usePlugins};
|
|
8
|
-
//# sourceMappingURL=index-
|
|
7
|
+
`).map(I=>I.trim()).join(" ")}function C(){if(!m.current)return;m.current.style.height="0";const x=m.current.scrollHeight+(m.current.offsetHeight-m.current.clientHeight);x>0&&(m.current.style.height=`${x}px`)}function M(x){let I=x.target.value;p&&(l&&(I=b(I)),f(!1)),h(I),e(I)}function P(){m.current&&(l&&(h(b(d)),C()),m.current.scrollLeft=0)}function v(){m.current&&document.activeElement!==m.current&&m.current.focus()}function y(){l&&(h(T(d)),e(T(d)))}function S(){f(!0)}return r.useEffect(function(){C()},[d]),a.jsx("textarea",{ref:m,id:c,className:O(s,"auto-resize-textarea form-control"),placeholder:o,value:d,rows:1,onChange:M,onFocus:P,onMouseDown:v,onBlur:y,onPaste:S,spellCheck:n,disabled:i,"data-testid":u})}qe.propTypes={value:g.string.isRequired,onChange:g.func.isRequired,className:g.string,placeholder:g.string,spellCheck:g.bool,disabled:g.bool,delimiter:g.string,id:g.string,"data-testid":g.string};qe.defaultProps={className:"",id:"",placeholder:"",disabled:!1,spellCheck:!1,delimiter:"","data-testid":void 0};function fe(s){const{children:t,className:e,style:n,"data-testid":o}=s;return a.jsx("div",{className:O("btn-group",e),style:n,role:"group","data-testid":o,children:t})}fe.displayName="ButtonGroup";fe.propTypes={children:g.node.isRequired,className:g.string,style:g.object,"data-testid":g.string};fe.defaultProps={className:null,style:{},"data-testid":void 0};function de(s){let t=s;s instanceof CustomEvent&&(t=s.detail);let e="";if(t instanceof Error?e=t.message:t!=null&&(e=`${t}`),e=e.trim(),e.length>0)return e}function Gs(s){s.preventDefault()}function Ks(s=!1){const t=r.useMemo(()=>`useSubmitButtonRef-${he()}`,[]),e=r.useCallback(i=>{i==null||i.UNSAFE_getDOMNode().setAttribute("form",t)},[t]),n=r.useMemo(()=>({id:t,onSubmit:s?void 0:Gs}),[t,s]),o=r.useMemo(()=>({form:t,ref:e}),[t,e]);return{formProps:n,submitButtonProps:o}}function At(s,t,{autoLoad:e=!0}={}){const[n,o]=r.useState(null),[i,l]=r.useState(null),[c,u]=r.useState(!1),d=r.useCallback(async()=>{u(!0);try{const h=await s(...t);o(h),l(null)}catch(h){o(null),l(h)}finally{u(!1)}},[s,...t]);return r.useEffect(()=>{e&&d()},[e,d]),{data:n,error:i,isError:i!=null,isLoading:c,reload:d}}function Pt(s,t){const[e,n]=r.useState(s);return r.useEffect(()=>{const o=setTimeout(()=>{n(s)},t);return()=>{clearTimeout(o)}},[s,t]),e}const zs=Object.freeze(Object.defineProperty({__proto__:null,useContextOrThrow:Nt,useCopyToClipboard:Hn,useDebouncedValue:Pt,useFormWithDetachedSubmitButton:Ks,useForwardedRef:Wn,usePrevious:St,usePromiseFactory:At},Symbol.toStringTag,{value:"Module"}));function qs({blockInteraction:s=!0,children:t,debounceMs:e,isOpen:n=!1}){const o=Pt(n,e);return a.jsxs(a.Fragment,{children:[s&&n&&a.jsx("div",{className:"modal-backdrop",style:{backgroundColor:"transparent"},"data-testid":"debounced-modal-backdrop"}),D.cloneElement(t,{isOpen:n&&o})]})}function Ys({className:s,icon:t,isOpen:e=!1,subtitle:n,title:o}){return a.jsx(Be,{isOpen:e,className:s,children:a.jsx(He,{children:a.jsxs("div",{className:"info-modal",children:[t!=null&&a.jsx("div",{className:"message-icon",children:a.jsx(Y,{icon:t})}),a.jsx("div",{className:"message-header",children:o}),n!=null&&a.jsx("div",{className:"message-content",children:n})]})})})}function Dt({className:s="modal-footer",children:t,"data-testid":e}){return a.jsx("div",{className:s,"data-testid":e,children:t})}function Ye(s){const{isOpen:t,headerText:e,bodyText:n,onCancel:o,onConfirm:i,onDiscard:l,onModalDisable:c,cancelButtonText:u="Cancel",confirmButtonText:d="Okay",discardButtonText:h="Discard",isConfirmDanger:p=!1,children:f,"data-testid":m}=s,b=r.useRef(null),T=r.useRef(null),C=r.useCallback(()=>{T.current!==null&&T.current.checked&&c&&c(),i()},[i,c]),M=r.useCallback(()=>{var v;(v=b.current)==null||v.focus()},[]);let P="";return t&&(P=typeof n=="function"?n():n),a.jsxs(Be,{isOpen:t,className:"theme-bg-light",onOpened:M,children:[a.jsx(Et,{closeButton:!1,children:e}),a.jsx(He,{children:P}),a.jsxs(Dt,{children:[c&&a.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[a.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:T,"data-testid":m!==void 0?`${m}-checkbox-confirm`:void 0}),a.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),l&&a.jsx(H,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:l,"data-testid":m!==void 0?`${m}-btn-discard`:void 0,children:h}),o&&a.jsx(H,{kind:"secondary","data-dismiss":"modal",onClick:o,"data-testid":m!==void 0?`${m}-btn-cancel`:void 0,children:u}),a.jsxs(fe,{children:[a.jsx(H,{kind:p?"danger":"primary",onClick:C,ref:b,"data-testid":m!==void 0?`${m}-btn-confirm`:void 0,children:d}),f]})]})]})}Ye.propTypes={isOpen:g.bool.isRequired,headerText:g.string.isRequired,bodyText:g.oneOfType([g.string,g.func]).isRequired,onCancel:g.func,onConfirm:g.func.isRequired,onDiscard:g.func,onModalDisable:g.func,cancelButtonText:g.string,confirmButtonText:g.string,discardButtonText:g.string,children:g.node,"data-testid":g.string};Ye.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};const Ne=D.forwardRef((s,t)=>{const{children:e,className:n,disabled:o,onClick:i,style:l,id:c}=s;return a.jsx("button",{ref:t,type:"button",className:O("btn",n),onClick:i,style:l,disabled:o,id:c,children:e})});Ne.displayName="Button";Ne.propTypes={children:g.node,className:g.string,disabled:g.bool,onClick:g.func,style:g.shape({}),id:g.string};Ne.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Zs=Ne;function Js({className:s,isFlipped:t,children:e,"data-testid":n}){const o=u=>{if(e.length!==2)throw new Error("CardFlip requires 2 children to function");return e[u]},i=r.useRef(null),l=r.useCallback(u=>{u.target===u.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),c=r.useCallback(u=>{u.target===u.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return r.useEffect(function(){if(!i.current)throw Error("ref undefined");i.current.addEventListener("transitionstart",l);const d=i.current;return function(){if(d!=null)return d.removeEventListener("transitionstart",l)}},[l]),a.jsxs("div",{className:O(s,{"card-flip--show-front":t,"card-flip--show-back":!t}),"data-testid":n,children:[a.jsx("div",{className:"card-flip--back",children:o(0)}),a.jsx("div",{ref:i,className:"card-flip--front",onTransitionEnd:c,children:o(1)})]})}const z=class extends r.Component{static handleEnter(t){const e=t;e.style.height="0"}static handleEntering(t){const e=t;e.style.height=`${z.getHeight(e)}px`}static handleExiting(t){const e=t;e.style.height="0"}static handleExit(t){const e=t;e.style.height=`${z.getHeight(e)}px`}static getHeight(t){const e=t.scrollWidth-t.clientWidth;return t.scrollHeight-e}constructor(t){super(t),this.handleEntered=this.handleEntered.bind(this)}handleEntered(t){const e=t;e.style.height="";const{autoFocusOnShow:n}=this.props;if(n!==void 0&&n){const o=e.querySelector("input, select, textarea");o!=null&&o.focus()}}render(){const{children:t,className:e,in:n,"data-testid":o}=this.props;return a.jsx(Ee,{in:n,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:z.handleEnter,onEntering:z.handleEntering,onEntered:this.handleEntered,onExit:z.handleExit,onExiting:z.handleExiting,timeout:350,children:i=>a.jsx("div",{className:O({collapse:i==="exited"},e),"data-testid":o,children:t})})}};let le=z;E(le,"propTypes",{className:g.string,in:g.bool.isRequired,children:g.node.isRequired,autoFocusOnShow:g.bool,"data-testid":g.string}),E(le,"defaultProps",{className:"",autoFocusOnShow:!1,"data-testid":void 0});const Qs=le,Xs=A.module("TimeInput"),eo="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",to=["00:00:00","12:34:56","23:59:59"],Lt=D.forwardRef((s,t)=>{const{allowValueWrapping:e=!0,className:n="",onChange:o=()=>!1,value:i=0,onFocus:l=()=>!1,onBlur:c=()=>!1,onSelect:u=()=>!1,"data-testid":d}=s,[h,p]=r.useState(re.formatTime(i)),[f,m]=r.useState(),b=r.useRef(null);r.useImperativeHandle(t,()=>({focus:()=>{var v;(v=b.current)==null||v.focus()},setSelection:v=>{var y;(y=b.current)==null||y.focus(),m(v)}}),[]),r.useEffect(function(){p(re.formatTime(i))},[i]);function T(v,y,S){const x=v.selectionStart===0?24:60;let I=parseInt(S,10)-y;return Number.isNaN(I)?I=0:e?I=(I%x+x)%x:I=Math.min(Math.max(0,I),x-1),`${I}`.padStart(2,"0")}function C(v,y,S,x,I){return x===0&&I===2&&y===1&&parseInt(S,10)>1?`0${S}${v.substring(2)}`:It(v,y,S)}function M(v){Xs.debug("handleChange",v),p(v),re.isTimeString(v)&&o(re.parseTime(v))}const P=r.useCallback(v=>{m(v),u(v)},[u]);return a.jsx(Ge,{ref:b,className:n,example:to,getNextSegmentValue:T,getPreferredReplacementString:C,onChange:M,onSelect:P,pattern:eo,selection:f,value:h,onFocus:l,onBlur:c,"data-testid":d})});Lt.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const ye=Lt;const ut=-1;var _t=(s=>(s.UP="UP",s.DOWN="DOWN",s))(_t||{});const V=class extends r.Component{constructor(e){super(e);E(this,"csContainer");E(this,"menuContainer");E(this,"button");E(this,"input");const{value:n,valueToTime:o}=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=D.createRef(),this.menuContainer=D.createRef(),this.button=D.createRef(),this.input=D.createRef(),this.state={keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,customTime:o(n),inputFocused:!1}}getSelectedText(){const{options:e,value:n,placeholder:o}=this.props,{customTime:i}=this.state;if(n===null)return o;for(let l=0;l<e.length;l+=1){const c=e[l];if(c.value===n)return c.title}return re.formatTime(i)}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:n}=this.props;n(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var l;const{keyboardOptionIndex:n,inputFocused:o}=this.state,{options:i}=this.props;switch(e.key){case"Enter":case" ":o?this.updateFromCustom():this.updateInputValue(i[n].value),this.closeMenu(),(l=this.button.current)==null||l.focus(),e.stopPropagation(),e.preventDefault();break;case"Tab":e.shiftKey?this.handleMenuNavigation(V.MENU_NAVIGATION_DIRECTION.UP):this.handleMenuNavigation(V.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(V.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(V.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":this.closeMenu();break}}handleMenuNavigation(e){const{keyboardOptionIndex:n,inputFocused:o}=this.state,{options:i}=this.props,l=i.length;let c=n;switch(e){case V.MENU_NAVIGATION_DIRECTION.UP:if(!o&&n===0){this.focusInput();break}else o&&this.focusOption(n);n>0&&!o?(c=(c-1)%l,this.setState({keyboardOptionIndex:c})):n===0&&(c=l-1,this.setState({keyboardOptionIndex:c})),this.scrollOptionIntoView(c);break;case V.MENU_NAVIGATION_DIRECTION.DOWN:if(!o&&n===l-1){this.focusInput();break}else o&&this.focusOption(n);n<l&&!(o&&n===0)&&(c=(c+1)%l,this.setState({keyboardOptionIndex:c})),this.scrollOptionIntoView(c);break}}handleOptionClick(e){const n=Number(e.currentTarget.value),{options:o,timeToValue:i}=this.props,{customTime:l}=this.state;if(n===ut){const c=i(l);this.updateAndClose(c)}else this.updateAndClose(o[n].value)}updateAndClose(e){var n;this.updateInputValue(e),this.closeMenu(),(n=this.button.current)==null||n.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleMenuOpened(){var c;const{options:e,value:n}=this.props,{keyboardOptionIndex:o}=this.state;this.scrollOptionIntoView(o);const i=(c=this.menuContainer.current)==null?void 0:c.querySelector(".cs-option-btn.keyboard-active");if(i instanceof HTMLElement&&i.focus(),n===null)return;e.map(u=>u.value).indexOf(n)<0&&this.focusInput()}focusInput(){var e;(e=this.input.current)==null||e.focus()}focusOption(e){var o;const n=(o=this.menuContainer.current)==null?void 0:o.querySelector(".cs-options");if(n&&n.children!=null){const i=n.children.item(e);i instanceof HTMLElement&&i.focus()}}handleMenuExited(){const{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}handleCustomInput(e){const{timeToValue:n}=this.props,o=n(e);this.updateInputValue(o),this.setState({customTime:e})}updateFromCustom(){const{timeToValue:e}=this.props,{customTime:n}=this.state,o=e(n);this.updateInputValue(o)}toggleMenu(e){const{menuIsOpen:n}=this.state;n?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0})}closeMenu(e=!0){var n;this.setState({menuIsOpen:!1}),e&&((n=this.button.current)==null||n.focus())}updateKeyboardIndex(){const{options:e,value:n}=this.props;if(n===null)return;const o=e.map(i=>i.value).indexOf(n);o>0&&this.setState({keyboardOptionIndex:o})}scrollOptionIntoView(e){var o;const n=(o=this.menuContainer.current)==null?void 0:o.querySelector(".cs-options");if(n&&n.children!=null){const i=n.children.item(e);i instanceof HTMLElement&&i.offsetTop>V.DROP_DOWN_MENU_HEIGHT?n.scrollTop=i.offsetTop-V.DROP_DOWN_MENU_HEIGHT:(i instanceof HTMLElement&&i.offsetTop<0||e===0)&&(n.scrollTop=0)}}renderMenuElement(){const{inputWidth:e}=this.state;return a.jsx("div",{className:"cs-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:n=>{n.stopPropagation()},style:{width:e},children:a.jsx("div",{className:"cs-options-container",children:a.jsx("div",{className:"cs-options",children:this.renderOptions()})})})}renderOptions(){const{options:e,value:n,icon:o,customText:i}=this.props,{keyboardOptionIndex:l,customTime:c,inputFocused:u}=this.state;let d=!1;const h=[];for(let p=0;p<e.length;p+=1){const f=e[p],m=`option-${p}-${f.value}`;d=d||f.value===n,h.push(a.jsxs("button",{type:"button",value:p,className:O("cs-option-btn",{"keyboard-active":l===p&&!u}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[f.value===n&&a.jsx(Y,{icon:o,className:"mr-2"}),f.value!==n&&a.jsx("span",{className:"mr-4"}),f.title]},m))}return h.push(a.jsx("hr",{className:"cs-divider"},"option-divider")),h.push(a.jsxs("button",{type:"button",value:ut,className:O("cs-option-btn",{"keyboard-active":u}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!d&&n!==null?a.jsx(Y,{icon:o,className:"mr-2"}):a.jsx("span",{className:"mr-4"}),i]},"option-custom-label")),h.push(a.jsxs("div",{className:"cs-custom-container",children:[a.jsx("span",{className:"mr-2"}),a.jsx(ye,{ref:this.input,onChange:this.handleCustomInput,value:c,onFocus:()=>this.setState({inputFocused:!0}),onBlur:()=>this.setState({inputFocused:!1})},"option-input"),a.jsx("span",{className:"ml-2"})]},"cs-custom-container")),h.push(a.jsx("hr",{className:"mb-2"},"option-end")),h}render(){const{disabled:e,invalid:n,value:o,"data-testid":i}=this.props,{menuIsOpen:l}=this.state;let{popperOptions:c}=this.props;return c={placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}},...c},a.jsx("div",{className:"input-group cs-container context-menu",ref:this.csContainer,"data-testid":i,children:a.jsx("div",{className:O("input-group-append cs-dropdown",{"cs-dropdown-invalid":n}),children:a.jsxs("button",{type:"button",className:O("btn cs-btn form-control",{"cs-btn-invalid":n}),ref:this.button,onClick:this.toggleMenu,disabled:e,children:[a.jsx("span",{className:O({"text-muted":o===null}),children:this.getSelectedText()}),a.jsx("span",{children:a.jsx(Y,{icon:Tt,className:"cs-caret"})}),a.jsx(wt,{isShown:l,actions:{menuElement:this.renderMenuElement()},popperOptions:c,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}};let te=V;E(te,"MENU_NAVIGATION_DIRECTION",_t),E(te,"DROP_DOWN_MENU_HEIGHT",125),E(te,"defaultProps",{onChange(){},value:null,disabled:!1,popperOptions:{},icon:Ln,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 no=te,so=A.module("DateInput"),oo="[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"],ao="YYYY-MM-DD",Ze=D.forwardRef((s,t)=>{const{className:e="",onChange:n=()=>{},defaultValue:o="",onFocus:i=()=>{},onBlur:l=()=>{},"data-testid":c}=s,[u,d]=r.useState(o),[h,p]=r.useState(),f=r.useCallback(m=>{so.debug("handleChange",m),d(m),n(m)},[n]);return a.jsx("div",{className:"d-flex flex-row align-items-center",children:a.jsx(Ge,{ref:t,className:O(e),example:io,getNextSegmentValue:Gn,onChange:f,onSelect:p,pattern:oo,placeholder:ao,selection:h,value:u,onFocus:i,onBlur:l,"data-testid":c})})});Ze.displayName="DateInput";Ze.defaultProps={className:"",onChange:()=>!1,defaultValue:"",onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const ro=Ze;class Ft extends r.PureComponent{constructor(e){super(e);E(this,"searchInput");this.searchInput=D.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=ue(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){const{value:n}=this.props;e.value!==n&&this.setState({value:n})}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:n}=this.state;e(n)}render(){const{placeholder:e,className:n,matchCount:o,id:i,"data-testid":l}=this.props,{value:c}=this.state;return a.jsx(Ke,{value:c,placeholder:e,onChange:this.handleChange,className:n,matchCount:o,ref:this.searchInput,id:i,"data-testid":l})}}E(Ft,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});const lo=Ft;function co(s){const{isInvalid:t=!1,items:e,onAdd:n=()=>{},onDelete:o=()=>{},validate:i=()=>null}=s,[l,c]=r.useState(null),[u,d]=r.useState([]),[h,p]=r.useState(""),f=r.useCallback(v=>{d(v)},[]),m=r.useCallback(()=>{o(lt.getItemsInRanges(e,u)),d([])},[e,u,o]),b=r.useCallback(()=>{if(h==="")return;const v=i(h);v==null?(n(h),p("")):c(v)},[h,n,i]),T=r.useCallback(v=>{const{value:y}=v.target;p(y),c(y===""?null:i(y))},[i]),C=r.useCallback(()=>{d([])},[]),M=r.useCallback(v=>{v.key==="Enter"&&b()},[b]),P=r.useMemo(()=>14+Pe(e.length,1,6)*De.DEFAULT_ROW_HEIGHT,[e.length]);return a.jsxs("div",{className:O("editable-item-list-container",{"is-invalid":t}),children:[a.jsx("div",{style:{height:P},children:a.jsx(De,{itemCount:e.length,items:e.map((v,y)=>({value:v,isSelected:lt.isSelected(u,y)})),offset:0,selectedRanges:u,onSelectionChange:f,isMultiSelect:!0})}),a.jsxs("div",{className:"d-flex flex-row pt-2",children:[a.jsx("div",{className:"d-flex flex-grow-1",children:a.jsx("input",{className:O("form-control",{"is-invalid":l!=null}),placeholder:"Enter value",type:"text",value:h,onChange:T,onFocus:C,onKeyDown:M})}),a.jsxs("div",{className:"d-flex align-items-start mt-1 ml-2",children:[a.jsx(H,{kind:"ghost",onClick:b,disabled:l!=null||h==="",icon:_n,tooltip:"Add new item","data-testid":"add-item-button"}),a.jsx(H,{kind:"ghost",onClick:m,disabled:u.length===0,icon:Fn,tooltip:"Delete selected items","data-testid":"delete-item-button"})]})]})]})}const ce=class extends r.Component{static isParentSelected(t,e){const n=e.get(t);if(n===void 0)return!1;if(typeof n=="boolean")return n;const o=Array.from(n.values()).includes(!0),i=Array.from(n.values()).includes(!1);return o&&i?null:o}constructor(t){super(t),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(t){t.stopPropagation(),t.preventDefault(),this.setState(e=>{const{menuIsOpen:n}=e;return{menuIsOpen:!n}})}toggleValueFor(t,e){const{valueMap:n,onUpdateValueMap:o}=this.props,i=new Map(n),l=i.get(t);if(l instanceof Map){const u=new Map(l);if(e!=null)u.set(e,l.get(e)===void 0);else{const d=ce.isParentSelected(t,i),h=d==null||!d;l.forEach((p,f)=>u.set(f,h))}i.set(t,u)}else i.set(t,l==null||!l);const c=i.get(t);if(e===void 0&&c!==void 0&&typeof c!="boolean"){const u=ce.isParentSelected(t,n);u!=null&&u?c.forEach((d,h)=>c.set(h,!1)):c.forEach((d,h)=>c.set(h,!0))}o(i)}setAllValues(t){const{valueMap:e,onUpdateValueMap:n}=this.props,o=new Map;e.forEach((i,l)=>{if(typeof i=="boolean")o.set(l,t);else{const c=new Map;i.forEach((u,d)=>c.set(d,t)),o.set(l,c)}}),n(o)}selectAll(){this.setAllValues(!0)}clear(){this.setAllValues(!1)}renderMenuElement(){const{valueMap:t,"data-testid":e}=this.props;return a.jsxs("div",{className:"hcm-menu-container",children:[Array.from(t.entries()).map(([n,o])=>a.jsxs("div",{children:[a.jsx(Le,{className:"hcm-parent",checked:ce.isParentSelected(n,t),onChange:()=>this.toggleValueFor(n),children:n}),o!==void 0&&typeof o!="boolean"&&Array.from(o.entries()).map(([i,l])=>a.jsx(Le,{className:"hcm-child",checked:l,onChange:()=>this.toggleValueFor(n,i),children:i},i))]},n)),a.jsx(H,{kind:"ghost",onClick:this.selectAll,"data-testid":e!==void 0?`${e}-btn-select-all`:void 0,children:"Select All"}),a.jsx(H,{kind:"ghost",onClick:this.clear,"data-testid":e!==void 0?`${e}-btn-clear`:void 0,children:"Clear"})]})}render(){const{menuText:t,className:e,icon:n,id:o,"data-testid":i}=this.props,{menuIsOpen:l}=this.state;return a.jsxs("button",{type:"button",className:O("btn hcm-btn",e),onClick:this.toggleMenu,id:o,"data-testid":i,children:[a.jsxs("span",{children:[n&&a.jsx(Y,{icon:n,className:"hcm-icon mr-1"}),t]}),a.jsx(Y,{icon:Tt,className:"hcm-icon ml-1"}),a.jsx(We,{options:{placement:"bottom"},isShown:l,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}};let xe=ce;E(xe,"defaultProps",{className:"",icon:null,id:"","data-testid":void 0});const uo=xe;const ho=.025,po=.9,fo=.1,mo=.618,je=Q["primary-dark"],dt=80,go=Q["gray-800"],vo=Q["gray-900"],J={SIZE:8,DOT_SIZE:2,FILL_OPACITY:.25},G=18,bo=250,Co=60*1e3,xo=D.memo(()=>{const s=r.useRef(null),t=r.useRef(null),[e,n]=r.useState(!1),o=window.devicePixelRatio;let i,l,c,u,d,h=null,p=[];function f(){t.current!=null&&(c=t.current.offsetWidth,u=t.current.offsetHeight),s.current!=null&&(s.current.style.width=`${c}px`,s.current.style.height=`${u}px`,s.current.width=c*o,s.current.height=u*o),i==null||i.scale(o,o)}function m(){const k=document.createElement("canvas");k.width=J.SIZE,k.height=J.SIZE;const N=k.getContext("2d");return N!=null&&(N.fillStyle=je,N.fillRect(0,0,J.DOT_SIZE,J.DOT_SIZE),N.fillStyle=je+Math.round(255*J.FILL_OPACITY).toString(16).padStart(2,"0"),N.fillRect(0,0,J.SIZE,J.SIZE)),N==null?void 0:N.createPattern(k,"repeat")}function b(k){const N=Math.random()-.5;let _=ho*N;return k<fo?_=Math.abs(_):k>po&&(_=-Math.abs(_)),k+_}function T(){const k=[];let N=mo;for(let _=0;_<c+G;_+=1)N=b(N),k.push(N);return k}function C(){for(;p.length>=c+G;)p.pop();for(;p.length<c+G;)p.push(b(p[p.length-1]))}function M(k,N){N.beginPath(),N.moveTo(-1,u+1),N.lineTo(-1,u*k[0]);for(let _=0;_<k.length;_+=1)N.lineTo(_,u*k[_]);N.lineTo(c+G,u*k[k.length-1]),N.lineTo(c+G,u+1),N.closePath()}function P(k){k.beginPath();for(let N=1;N<c;N+=dt)k.moveTo(N,0),k.lineTo(N,u);for(let N=1;N<u;N+=dt)k.moveTo(0,N),k.lineTo(c,N)}function v(k){h=h??k,Kn(i),i.fillStyle=vo,i.fillRect(0,0,c,u),P(i),i.lineWidth=1,i.strokeStyle=go,i.stroke();const N=((h??0)-(k??0))/(1e3/G);if(i.translate(N,0),M(p,i),i.lineWidth=2,i.strokeStyle=je,i.stroke(),i.translate(-N,0),l!=null&&(i.fillStyle=l),i.fill(),i.setTransform(o,0,0,o,0,0),(k??0)-(h??0)>1e3/G){const _=Math.floor(((k??0)-(h??0))/(1e3/G));for(let me=0;me<_;me+=1)p.shift(),p.push(b(p[p.length-1]));h=k}d!=null&&cancelAnimationFrame(d),d=requestAnimationFrame(v)}const y=ue(()=>{d=requestAnimationFrame(k=>{f(),C(),n(!1),v(k)})},bo,{leading:!0});function S(){n(!0),d!=null&&cancelAnimationFrame(d),d=null,h=null}const x=ue(()=>{S()},Co);function I(){d==null&&(n(!1),f(),C(),d=requestAnimationFrame(v)),x()}function L(){document.hasFocus()&&I()}function Z(){d!=null&&cancelAnimationFrame(d),x(),y()}return r.useEffect(()=>{var k;return i=(k=s.current)==null?void 0:k.getContext("2d",{alpha:!1}),f(),p=T(),l=m(),v(),x(),window.addEventListener("resize",Z),window.addEventListener("focus",I),window.addEventListener("blur",S),window.addEventListener("mousemove",L),window.addEventListener("keydown",L),()=>{d!=null&&cancelAnimationFrame(d),window.removeEventListener("resize",Z),window.removeEventListener("focus",I),window.removeEventListener("blur",S),window.removeEventListener("mousemove",L),window.removeEventListener("keydown",L),x.cancel(),y.cancel()}},[]),a.jsx("div",{className:"random-area-plot-animation-container",ref:t,children:a.jsx("canvas",{ref:s,className:e?"shade":""})})}),Ut=xo;const Je=D.forwardRef((s,t)=>{const{children:e,className:n,disabled:o,id:i,isLinked:l,isLinkedSource:c,isInvalid:u,onClick:d,onMouseEnter:h,onMouseLeave:p,style:f,"data-testid":m}=s;return a.jsxs("button",{ref:t,type:"button",className:O("btn-socketed",{"btn-socketed-linked":l!==void 0&&l||c},{"btn-socketed-linked-source":c},{"is-invalid":u},n),id:i,onClick:d,onMouseEnter:h,onMouseLeave:p,style:f,disabled:o,"data-testid":m,children:[e,a.jsx(Y,{icon:Un,className:"linked btn-socketed-icon",transform:"down-1"}),a.jsx(Y,{icon:$n,className:"is-invalid btn-socketed-icon"})]})});Je.displayName="SocketedButton";Je.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 Eo=Je,To={"dh-spectrum-theme--dark":"_dh-spectrum-theme--dark_i6xja_5"},yo={"dh-spectrum-theme--light":"_dh-spectrum-theme--light_16vb7_5"},{global:ko,light:No,dark:So,medium:Io,large:wo}=In,Oo={global:ko,light:{...No,...yo},dark:{...So,...To},medium:Io,large:wo},jo="_track_535ju_30",Mo="_handle_535ju_13",Ro="_ticks_535ju_98",$t={"handle-size":"15px","popover-width":"90px","time-slider":"_time-slider_535ju_3","time-slider-popovers":"_time-slider-popovers_535ju_8","handle-popper":"_handle-popper_535ju_13","flex-spacer":"_flex-spacer_535ju_26",track:jo,"track-fills":"_track-fills_535ju_37","track-fill":"_track-fill_535ju_37","track-fill-start":"_track-fill-start_535ju_55","track-fill-middle":"_track-fill-middle_535ju_56","track-fill-end":"_track-fill-end_535ju_59","handle-track":"_handle-track_535ju_62",handle:Mo,ticks:Ro,"tick-labels":"_tick-labels_535ju_116","tick-label":"_tick-label_535ju_116","tick-label-wrapper":"_tick-label-wrapper_535ju_132"};const be=parseInt($t["handle-size"],10),ht=parseInt($t["popover-width"],10),U=24*60*60-1,pt=5*60;function Ao({startTime:s,endTime:t,onChange:e,isStartModified:n=!1,isEndModified:o=!1,"data-testid":i}){const[l,c]=r.useState(s),[u,d]=r.useState(t),h=r.useRef(null);r.useEffect(function(){c(s),d(t)},[s,t]);const p=r.useCallback((b,T)=>{let C=b,M=T;C===M&&(M<U?M+=1:C-=1),c(C),d(M),e({startTime:C,endTime:M})},[c,d,e]),f=r.useCallback(b=>{p(b,u)},[p,u]),m=r.useCallback(b=>{p(l,b)},[p,l]);return a.jsxs("div",{className:"time-slider","data-testid":i,children:[a.jsx(Po,{startTime:l,endTime:u,onStartTimeChange:f,onEndTimeChange:m,isStartModified:n,isEndModified:o}),a.jsxs("div",{className:"track",ref:h,children:[a.jsx(Do,{startTime:l,endTime:u}),a.jsx("div",{className:"ticks",children:Array(24).fill(null).map((b,T)=>a.jsx("div",{className:"tick"},T))}),a.jsx(ft,{track:h,time:l,setTime:f}),a.jsx(ft,{track:h,time:u,setTime:m})]}),a.jsxs("div",{className:"tick-labels",children:[a.jsx("div",{className:"tick-label",children:"0:00"}),a.jsx("div",{className:"tick-label-wrapper",children:Array(24).fill(null).map((b,T)=>a.jsx("div",{className:"tick-label",children:`${T+1}:00`},T))})]})]})}function Po(s){const{startTime:t,endTime:e,onStartTimeChange:n,onEndTimeChange:o,isStartModified:i,isEndModified:l,"data-testid":c}=s,u=t>e,[d,h]=r.useState(u?e:t),[p,f]=r.useState(u?t:e),m=r.useRef(null),b=r.useRef(null),T=r.useRef(null),C=r.useRef(null);r.useEffect(function(){h(t>e?e:t),f(t>e?t:e)},[t,e]),r.useEffect(function(){var x,I;T.current!==null&&((x=b.current)==null||x.setSelection(T.current)),C.current!==null&&((I=m.current)==null||I.setSelection(C.current))},[u]);function M(S){t<=e?n(S):o(S)}function P(S){t<=e?o(S):n(S)}const v=r.useCallback(S=>{T.current=S,C.current=null},[]),y=r.useCallback(S=>{T.current=null,C.current=S},[]);return a.jsxs("div",{className:"time-slider-popovers",children:[a.jsx("div",{className:"flex",style:{flexBasis:`calc(${d/U*100}% - ${ht/2}px)`}}),a.jsxs("div",{className:"handle-popper",children:[a.jsx("label",{className:O({modified:u?l:i}),children:u?"End Time":"Start Time"}),a.jsx(ye,{ref:m,allowValueWrapping:!1,value:d,onChange:M,onSelect:v,"data-testid":c!==void 0?`${c}-input-1`:void 0})]}),a.jsx("div",{className:"flex-spacer"}),a.jsxs("div",{className:"handle-popper",children:[a.jsx("label",{className:O({modified:u?i:l}),children:u?"Start Time":"End Time"}),a.jsx(ye,{ref:b,allowValueWrapping:!1,value:p,onChange:P,onSelect:y,"data-testid":c!==void 0?`${c}-input-2`:void 0})]}),a.jsx("div",{className:"flex",style:{flexBasis:`calc(${(U-p)/U*100}% - ${ht/2}px)`}})]})}function Do(s){const{startTime:t,endTime:e,"data-testid":n}=s;return a.jsxs("div",{className:"track-fills","data-testid":n,children:[t>e&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"track-fill track-fill-start",style:{transform:`scaleX(${e/U})`}}),a.jsx("div",{className:"track-fill track-fill-end",style:{transform:`scaleX(${(U-t)/U})`}})]}),t<e&&a.jsx("div",{className:"track-fill track-fill-middle",style:{transform:`translateX(${t/U*100}%) scaleX(${(e-t)/U})`}})]})}function ft(s){const{track:t,time:e,setTime:n,"data-testid":o}=s,i=r.useMemo(()=>{let m=be/2;return e<3600?m=e/3600*(be/2):e>23*3600&&(m=be/2+1/(U-23*3600)*(e-23*3600)*(be/2)),`translateX(calc(${e/U*100}% - ${m}px))`},[e]),l=r.useCallback(f=>{if(!t.current)return 0;const m=t.current.getBoundingClientRect(),b=Math.max(f-m.left,0),T=U*Math.min(1,b/m.width),C=pt*Math.round(T/pt);return Math.min(U,C)},[t]),c=r.useCallback(({clientX:f})=>{n(l(f))},[n,l]),u=r.useCallback(({clientX:f})=>{n(l(f)),window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",u),document.documentElement.classList.remove("drag-pointer-events-none")},[n,l,c]),d=r.useCallback(()=>{window.addEventListener("mousemove",c),window.addEventListener("mouseup",u),document.documentElement.classList.add("drag-pointer-events-none")},[c,u]),h=r.useCallback(()=>{window.removeEventListener("mousemove",c),window.removeEventListener("mouseup",u),document.documentElement.classList.remove("drag-pointer-events-none")},[c,u]),p=r.useCallback(()=>{d()},[d]);return r.useEffect(function(){return()=>{h()}},[h]),a.jsx("div",{className:"handle-track",style:{transform:i},children:a.jsx("button",{className:"handle",type:"button","aria-label":"Change time",onMouseDown:p,"data-testid":o})})}function Vt({buttons:s,isShown:t=!1,classNames:e,message:n,type:o,onClick:i,onDismiss:l,"data-testid":c}){const u=s&&s.length!==0;return a.jsx(Ee,{in:t,timeout:Q.transitionMs,classNames:"toast-notification-slide-up",mountOnEnter:!0,unmountOnExit:!0,children:a.jsxs("div",{className:O("toast-notification",e,o),role:"presentation",onClick:i,onKeyPress:i,"data-testid":c,children:[a.jsx("div",{className:"message-container",children:a.jsx("span",{className:"message",children:n})}),a.jsx(Ee,{in:u,timeout:Q.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:a.jsx("div",{className:"buttons-container",children:s})}),l&&a.jsx(H,{kind:"ghost",icon:Vn,tooltip:"Close notification",className:"my-2",onClick:l})]})})}Vt.TYPE=Object.freeze({ERROR:"error"});function Lo(s){const{children:t,className:e,labelText:n,hintText:o,isModified:i,validationError:l,showValidationError:c=!0,"data-testid":u,id:d}=s,{current:h}=r.useRef(d??he());return a.jsxs(a.Fragment,{children:[a.jsx("label",{className:O("validate-label",e,{modified:i}),htmlFor:h,"data-testid":u,children:n}),D.Children.toArray(t).map(p=>D.isValidElement(p)?D.cloneElement(p,{className:O(p.props.className,{"is-invalid":l})}):a.jsx("div",{className:O(e),children:p})),o!==void 0&&a.jsx("small",{className:"form-text text-muted",children:o}),l!==void 0&&c&&a.jsx("p",{className:"validate-label-error text-danger",children:l})]})}const _o=Object.freeze(Object.defineProperty({__proto__:null,AutoCompleteInput:Ws,AutoResizeTextarea:qe,BasicModal:Ye,Button:H,ButtonGroup:fe,ButtonOld:Zs,CardFlip:Js,Checkbox:Le,Collapse:Qs,ComboBox:zn,ContextActionUtils:qn,ContextActions:Yn,ContextMenuItem:Zn,ContextMenuRoot:Jn,CopyButton:Qn,CustomTimeSelect:no,DEFAULT_GET_PREFERRED_REPLACEMENT_STRING:It,DateInput:ro,DateTimeInput:Xn,DebouncedModal:qs,DebouncedSearchInput:lo,DragUtils:es,DraggableItemList:ts,DropdownMenu:wt,EditableItemList:co,GLOBAL_SHORTCUTS:ns,HierarchicalCheckboxMenu:uo,InfoModal:Ys,ItemList:De,ItemListItem:ss,KEY:os,LoadingOverlay:ae,LoadingSpinner:yt,MODIFIER:is,MaskedInput:Ge,Menu:as,MenuItem:rs,Modal:Be,ModalBody:He,ModalFooter:Dt,ModalHeader:Et,Option:ls,Page:cs,Popper:We,RadioGroup:us,RadioItem:ds,RandomAreaPlotAnimation:Ut,SearchInput:Ke,Select:hs,SelectValueList:Ot,Shortcut:ps,ShortcutRegistry:fs,SocketedButton:Eo,Stack:ms,ThemeExport:Q,TimeInput:ye,TimeSlider:Ao,ToastNotification:Vt,Tooltip:gs,UISwitch:vs,ValidateLabelInput:Lo,fillToLength:bs,themeDHDefault:Oo,trimTrailingMask:Cs},Symbol.toStringTag,{value:"Module"})),Fo=Object.freeze(Object.defineProperty({__proto__:null,ApiBootstrap:Bn,ApiContext:kt,ClientBootstrap:jt,ClientContext:xs,useApi:W,useClient:pe},Symbol.toStringTag,{value:"Module"}));function Uo(s){return function({children:e}){return a.jsx(kt.Provider,{value:s,children:e})}}const Me=A.module("MessageUtils"),Bt="io.deephaven.message.LoginOptions.request",Ht="io.deephaven.message.SessionDetails.request",Wt="io.deephaven.broadcast",Qe="io.deephaven.broadcast.Login",Gt="io.deephaven.broadcast.Logout";function Se(s){const t=s;return t!=null&&typeof t.id=="string"&&typeof t.message=="string"}function Kt(s){return Se(s)&&s.message===Qe}function zt(s){return Se(s)&&s.message===Gt}function qt(s){const t=s;return t!=null&&typeof t.id=="string"}function Xe(s,t=he(),e){return{message:s,id:t,payload:e}}function $o(s,t){return{id:s,payload:t}}async function et(s,t=3e4){if(window.opener==null)throw new Error("window.opener is null, unable to send request.");return new Promise((e,n)=>{let o;const i=he(),l=c=>{const{data:u}=c;if(!qt(u)){Me.debug("Ignoring non-deephaven response",u);return}if(Me.debug("Received message",u),(u==null?void 0:u.id)!==i){Me.debug("Ignore message, id doesn't match",u);return}window.clearTimeout(o),window.removeEventListener("message",l),e(u.payload)};window.addEventListener("message",l),o=window.setTimeout(()=>{window.removeEventListener("message",l),n(new Es("Request timed out"))},t),window.opener.postMessage(Xe(s,i),"*")})}class Yt extends Error{constructor(){super(...arguments);E(this,"isNoConsolesError",!0)}}function Zt(s){return s.isNoConsolesError}const ne=A.module("SessionUtils");function Vo(s,t){return ne.info(`Starting connection to '${t}'...`),new s.IdeConnection(t)}async function Jt(s,t,e){ne.info("Getting console types...");const n=await t.getConsoleTypes();if(n.length===0)throw new Yt("No console types available");ne.info("Available types:",n);const o=n[0];ne.info("Starting session with type",o);const i=await t.startSession(o),l={type:o,id:he.generate()};return ne.info("Console session established",l),{session:i,config:l,connection:t,details:e,dh:s}}function Bo(s,t,e){return ne.info("createCoreClient",t),new s.CoreClient(t,e)}function Ho(s){return s!=null&&typeof s=="object"}async function Wo(){const s=await et(Ht);if(!Ho(s))throw new Error(`Unexpected session details response: ${s}`);return s}async function Go(){switch(new URLSearchParams(window.location.search).get("authProvider")){case"parent":return Wo()}return{}}async function Ko(s,t,e){let n;try{n=await Jt(s,t,e)}catch(o){if(!Zt(o))throw o}return n}const zo=A.module("ViewportDataUtils");function Qt(s,t){return String(s.offsetInSnapshot+t)}function Xt(s,t){return function(n){const{columns:o,offset:i,rows:l}=n.detail;zo.debug("table updated",n.detail),l.forEach(c=>{const u=t(c,o),d={key:Qt(c,i),item:u};s.getItem(d.key)!=null?s.update(d.key,d):s.append(d)})}}function en(s,t){return t.reduce((e,n)=>(e[n.name]=s.get(n),e),{})}function*tn(s,t){for(let e=s;e<=t;++e)yield{key:String(e)}}function qo(s,...t){return t.map(e=>s.getItem(e))}function tt(s){return s==null||Ie(s)?0:s.size}function Ie(s){return"isClosed"in s?s.isClosed:!1}function nn(s,t,e,n){const o=s+t-1,[i,l]=[0,n-1],c=Pe(s-e,i,l),u=Pe(o+e,i,l);return[c,u]}const Yo=Object.freeze(Object.defineProperty({__proto__:null,BROADCAST_CHANNEL_NAME:Wt,BROADCAST_LOGIN_MESSAGE:Qe,BROADCAST_LOGOUT_MESSAGE:Gt,BooleanColumnFormatter:Ts,CharColumnFormatter:ys,DateTimeColumnFormatter:ks,DateUtils:Ns,DecimalColumnFormatter:Ss,DefaultColumnFormatter:Is,FETCH_TIMEOUT:ws,Formatter:Mt,FormatterUtils:_e,IntegerColumnFormatter:Os,LOGIN_OPTIONS_REQUEST:Bt,NoConsolesError:Yt,SESSION_DETAILS_REQUEST:Ht,StringColumnFormatter:js,TableColumnFormatter:Ms,TableUtils:ze,createConnection:Vo,createCoreClient:Bo,createKeyFromOffsetRow:Qt,createOnTableUpdatedHandler:Xt,createSessionWrapper:Jt,defaultRowDeserializer:en,fetchVariableDefinition:Rs,generateEmptyKeyedItems:tn,getColumnFormats:As,getDateTimeFormatterOptions:Ps,getItemsFromListData:qo,getSessionDetails:Go,getSize:tt,isBroadcastLoginMessage:Kt,isBroadcastLogoutMessage:zt,isClosed:Ie,isCustomColumnFormatDefined:Ds,isMessage:Se,isNoConsolesError:Zt,isResponse:qt,loadSessionWrapper:Ko,makeMessage:Xe,makeResponse:$o,padFirstAndLastRow:nn,requestParentResponse:et},Symbol.toStringTag,{value:"Module"})),mt=A.module("useTableListener"),Zo=(s,t,e)=>r.useEffect(function(){if(s==null){mt.debug2("Emitter undefined, skipping addEventListener",t);return}return mt.debug2("Adding listener",t),s.addEventListener(t,e)},[s,t,e]),oe=Zo;class Jo extends Error{constructor(){super(...arguments);E(this,"isColumnNameError",!0)}}const Qo=Jo;class Xo extends Error{constructor(){super(...arguments);E(this,"isTableDisconnectError",!0)}}const ei=Xo,Ce=A.module("useTable"),ti=(s,t,e,n)=>{const o=W(),[i,l]=r.useState(void 0),[c,u]=r.useState([]),[d,h]=r.useState(null),[p,f]=r.useState(null);r.useEffect(()=>{if(n===void 0){l(s==null?void 0:s.columns),h(null);return}try{l(s==null?void 0:s.findColumns(n)),h(null)}catch(C){Ce.error("Column not found",C,n),h(new Qo("Invalid columnNames argument"))}},[s,n]),r.useEffect(()=>{if(!i||!s){Ce.debug2("Table or column not initialized, skip viewport update.");return}Ce.debug2("Setting viewport",t,e),s.setViewport(t,e,i)},[i,s,t,e]);const m=r.useCallback(({detail:C})=>{if(!i){Ce.error("Columns not initialized.");return}const M=i.map(P=>C.rows.map(v=>v.get(P)));u(M)},[i]),b=r.useCallback(()=>{f(new ei("Table disconnected"))},[]),T=r.useCallback(()=>{f(null)},[]);return oe(s,o.Table.EVENT_UPDATED,m),oe(s,o.Table.EVENT_DISCONNECT,b),oe(s,o.Table.EVENT_RECONNECT,T),{columns:i,data:c,error:p??d}},sn=ti,ni=(s,t,e,n)=>{const o=r.useMemo(()=>[n],[n]),{columns:i=[],data:l=[],error:c}=sn(s,t,e,o);return{column:i[0],data:l[0],error:c}},on=ni;const B=A.module("TableInput"),Re=250;function nt(s){const{className:t=void 0,columnName:e,settings:n,defaultValue:o=[],isInvalid:i=!1,onChange:l=()=>!1,onBlur:c=()=>!1,table:u}=s,d=r.useRef(null),h=W(),p=r.useMemo(()=>{const j=_e.getColumnFormats(n),w=_e.getDateTimeFormatterOptions(n),{defaultDecimalFormatOptions:R={},defaultIntegerFormatOptions:$={}}=n;return new Mt(h,j,w,R,$)},[h,n]),[f,m]=r.useState(""),[b,T]=r.useState(new Set(o)),[C,M]=r.useState(),P=r.useRef(null),v=Math.min((C==null?void 0:C.size)??0,Re),{column:y,data:S,error:x}=on(C,0,Re-1,e),I=r.useCallback(j=>y?p.getFormattedString(j,y.type,y.name):`${j}`,[y,p]),[L,Z]=r.useMemo(()=>{const j=new Set(b),w=[];if(S==null)return[w,null];if(S.forEach(R=>{const $=`${R}`,ve=b.has($);ve&&j.delete($),w.push({value:$,displayValue:I(R),isSelected:ve})}),j.size>0){B.debug2("Selection has items that are missing from the viewport");const R=new Set(b);return Array.from(j).forEach($=>{R.delete($)}),[w,R]}return[w,null]},[S,b,I]);r.useEffect(()=>{Z!==null&&(T(Z),l(Array.from(Z)))},[l,Z]);const k=r.useCallback(async j=>{try{const w=await j;B.debug("Table resolved",w),M(w)}catch(w){if(ct.isCanceled(w))return;B.error(w)}},[]);r.useEffect(()=>{const j=ct.makeCancelable(u);return k(j),()=>{B.debug2("Cancel table promise"),j.cancel()}},[u,k]);const N=r.useCallback(j=>{var $;const{value:w}=j.target;m(w);const R=L.findIndex(ve=>ve.displayValue.includes(w));R>-1?(B.debug2(`Found ${w} at index ${R}`),($=P.current)==null||$.scrollIntoView(R)):B.debug2(`${w} not found`)},[L,P]),_=r.useCallback(j=>{if(B.debug("handleSelect",j),j>=L.length){B.error("Invalid index",j);return}const w=L[j].value,R=new Set(b);L[j].isSelected?R.delete(w):R.add(w),T(R),l(Array.from(R))},[l,L,b]),me=r.useCallback(()=>{const j=L.map(R=>R.value),w=new Set(j);T(w),l(j)},[L,l]),En=r.useCallback(()=>{T(new Set),l([])},[l]),Tn=r.useCallback(()=>{},[]),ge=r.useCallback(j=>{var R;const{relatedTarget:w}=j;B.debug("handleChildBlur",w,w instanceof HTMLElement,d.current,(R=d.current)==null?void 0:R.contains(w)),(!w||d.current&&w instanceof HTMLElement&&!d.current.contains(w))&&c()},[c]),Oe=L.length===0;return a.jsxs("div",{ref:d,className:O("table-input-container d-flex flex-column position-relative",t),children:[a.jsx(Ke,{disabled:!!x||Oe,value:f,placeholder:"Search",onChange:N,className:"mb-2 d-flex",onBlur:ge}),a.jsx(Ot,{className:"table-input-list",disabled:C===void 0||Oe,isInvalid:i,items:Oe?[{value:"Empty",isSelected:!1}]:L,itemCount:v,offset:0,onSelect:_,onViewportChange:Tn,ref:P,onBlur:ge}),C&&a.jsxs("div",{className:"meta-row",children:[a.jsx("div",{className:"d-flex align-items-center text-muted small",children:C!=null&&C.size>v&&a.jsxs(a.Fragment,{children:["Table is too large, showing the first ",Re," items."]})}),a.jsxs("div",{children:[a.jsx("button",{type:"button",className:"btn btn-link",onBlur:ge,onClick:me,children:"Select All"}),a.jsx("button",{type:"button",className:"btn btn-link mr-a",onBlur:ge,onClick:En,children:"Clear"})]})]}),C==null||x&&a.jsx("div",{className:"h-100 w-100 position-absolute",children:a.jsx(ae,{isLoaded:C!=null,isLoading:C==null&&x==null,errorMessage:(x==null?void 0:x.message)??null})})]})}nt.displayName="TableInput";nt.defaultProps={isInvalid:!1,className:void 0};const gt=A.module("useBroadcastChannel");function st(s=Ls,t=Wt){const e=r.useMemo(()=>new BroadcastChannel(t),[t]);return r.useEffect(()=>()=>{e.close()},[e]),r.useEffect(()=>{function n(o){const{data:i}=o;if(!Se(i)){gt.debug("Ignoring non-deephaven message",i);return}gt.debug("event received",i),s(o)}return e.addEventListener("message",n),()=>{e.removeEventListener("message",n)}},[e,s]),e}function we(s,t){const e=r.useCallback(n=>{Kt(n.data)?s==null||s(n.data):zt(n.data)&&(t==null||t(n.data))},[s,t]);st(e)}const ke="io.deephaven.web.client.auth.refreshToken",an=r.createContext(null),si=A.module("RefreshTokenUtils");function Fe(){const s=ie.get(ke);try{if(s!=null)return JSON.parse(s)}catch(t){si.error("Error parsing refresh token",s,t)}return null}function Ue(s){if(s==null){ie.remove(ke);return}const t=JSON.stringify({bytes:s.bytes,expiry:s.expiry}),e=new Date(s.expiry);ie.set(ke,t,{secure:!0,sameSite:"strict",expires:e})}function rn({children:s}){const t=W(),e=pe(),[n,o]=r.useState(Fe());r.useEffect(function(){return e.addEventListener(t.CoreClient.EVENT_REFRESH_TOKEN_UPDATED,d=>{const{detail:h}=d;Ue(h),o(h)})},[t,e,n]);const i=r.useCallback(()=>{o(Fe())},[]),l=r.useCallback(()=>{Ue(null),o(null)},[]);return we(i,l),a.jsx(an.Provider,{value:n,children:s})}const vt=A.module("useDebouncedViewportSearch"),oi=200;function ii(s,t,e=oi){const n=W(),o=r.useMemo(()=>new ze(n),[n]),{table:i,applyFiltersAndRefresh:l}=s,c=r.useMemo(()=>ue(u=>{if(vt.debug(`Applying debounced searchText '${u}'`),i==null)return;const d=u.trim();if(d===""){l([]);return}const h=i.findColumn(t),p=o.makeFilterValue(h.type,d),f=[h.filter().contains(p)];l(f)},e),[l,t,e,i,o]);return r.useEffect(()=>()=>{vt.debug("Cancelling debounced search function"),c.cancel()},[c]),c}function ot(s){const[,t]=r.useState(0),e=W();return oe(s,e.Table.EVENT_SIZECHANGED,()=>{t(n=>n+1)}),tt(s)}function ln(s){const t=wn({}),e=St(s),n=Math.max(0,ot(s));return r.useEffect(()=>{let o=t.items.length;if(s!==e&&o&&(t.remove(...t.items.map(({key:i})=>i)),o=0),!!s){if(n>o)t.insert(o,...tn(o,n-1));else if(n<o){const i=t.items.slice(n).map(({key:l})=>l);t.remove(...i)}}},[n,s]),t}function ai(s,...t){const e=r.useCallback(async()=>(s==null?void 0:s.selectDistinct(s.findColumns(t)))??null,[s,...t]),{data:n,error:o,isError:i,isLoading:l}=At(e,[]);return r.useEffect(()=>()=>{n==null||n.close()},[n]),{distinctTable:n,error:o,isError:i,isLoading:l}}function cn(s,t,e){return r.useCallback(function(o){const[i,l]=nn(o,t,e,tt(s));s==null||s.setViewport(i,l)},[s,e,t])}function ri(s){r.useEffect(()=>()=>{s!=null&&(Ie(s)||s.close())},[s])}function li(){const s=W();return r.useMemo(()=>new ze(s),[s])}function ci({table:s,viewportSize:t=10,viewportPadding:e=50,deserializeRow:n=en}){const o=ln(s),i=cn(s,t,e),l=r.useCallback(d=>{s==null||s.applyFilter(d),i(0)},[i,s]),c=W();oe(s,c.Table.EVENT_UPDATED,Xt(o,n));const u=ot(s);return r.useEffect(()=>{s&&!Ie(s)&&i(0)},[s,i,u]),{viewportData:o,size:u,table:s,applyFiltersAndRefresh:l,setViewport:i}}const ui=Object.freeze(Object.defineProperty({__proto__:null,REFRESH_TOKEN_KEY:ke,RefreshTokenBootstrap:rn,RefreshTokenContext:an,TableInput:nt,makeApiContextWrapper:Uo,readRefreshToken:Fe,storeRefreshToken:Ue,useBroadcastChannel:st,useBroadcastLoginListener:we,useDebouncedViewportSearch:ii,useInitializeViewportData:ln,useSelectDistinctTable:ai,useSetPaddedViewportCallback:cn,useTable:sn,useTableClose:ri,useTableColumn:on,useTableListener:oe,useTableSize:ot,useTableUtils:li,useViewportData:ci},Symbol.toStringTag,{value:"Module"})),un=r.createContext(!1);function di({fontClassNames:s=["fira-sans-regular","fira-sans-semibold","fira-mono"],children:t}){const[e,n]=r.useState(!1);return r.useEffect(function(){document.fonts.ready.then(()=>{n(!0)})},[]),a.jsxs(a.Fragment,{children:[a.jsx(un.Provider,{value:e,children:t}),a.jsx("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:s.map(o=>a.jsx("p",{className:o,children:"preload"},o))})]})}function dn(s){if(s==null)return!1;const t=s;return t.Component!==void 0&&typeof t.isAvailable=="function"}const hn="io.deephaven.auth.AnonymousAuthenticationHandler",hi="io.deephaven.authentication.psk.PskAuthenticationHandler";class pi extends Error{constructor(){super(...arguments);E(this,"name","AuthenticationError");E(this,"isAuthenticationError",!0)}}const pn=pi,bt=A.module("AuthPluginBase");function it({children:s,getLoginOptions:t}){const e=pe(),[n,o]=r.useState(),[i,l]=r.useState(!1);return r.useEffect(()=>{let c=!1;function u(){if(c)throw new _s("Login canceled.")}async function d(){try{const h=await t();u(),bt.info("Logging in..."),await e.login(h),u(),l(!0)}catch(h){if(!c){bt.error("Unable to login:",h);const p=de(h)??"Unable to login. Verify credentials.";o(new pn(p)),l(!1)}}}return d(),()=>{c=!0}},[e,t]),i?a.jsx(a.Fragment,{children:s}):a.jsx(ae,{"data-testid":"auth-base-loading",isLoading:n==null,isLoaded:!1,errorMessage:de(n)})}const fi=r.createContext({}),at=r.createContext({}),mi={canLogout:!1};function gi({children:s}){const t=W(),e=r.useCallback(()=>({type:t.CoreClient.LOGIN_TYPE_ANONYMOUS}),[t]);return a.jsx(it,{getLoginOptions:e,children:a.jsx(at.Provider,{value:mi,children:s})})}const vi={Component:gi,isAvailable:s=>s.includes(hn)},fn=vi,bi=A.module("AuthPluginParent"),Ci={canLogout:!1};function xi(s){return s!=null&&typeof s.type=="string"}async function Ei(){bi.info("Logging in by delegating to parent window...");const s=await et(Bt);if(!xi(s))throw new Error(`Unexpected login options response: ${s}`);return s}function Ti(){return new URLSearchParams(window.location.search).get("authProvider")??""}function yi({children:s}){return a.jsx(it,{getLoginOptions:Ei,children:a.jsx(at.Provider,{value:Ci,children:s})})}const ki={Component:yi,isAvailable:()=>window.opener!=null&&Ti()==="parent"},mn=ki;function gn({children:s,errorMessage:t,isLoggingIn:e=!1,onSubmit:n}){return a.jsxs("form",{className:"login-form",onSubmit:o=>{o.preventDefault(),o.stopPropagation(),n==null||n(o)},children:[a.jsx("div",{className:"flex-spacer"}),a.jsxs("div",{className:"flex-wrapper",children:[a.jsx("fieldset",{disabled:e,className:"container-fluid",children:s}),a.jsx("div",{className:"form-group d-flex justify-content-end align-items-center mb-0",children:a.jsxs("button",{type:"submit",className:O("btn btn-primary",{"btn-spinner":e},{"btn-cancelable":e}),"data-testid":"btn-login",children:[e&&a.jsxs("span",{children:[a.jsx(yt,{}),a.jsx("span",{className:"btn-normal-content",children:"Logging in"}),a.jsx("span",{className:"btn-hover-content",children:"Cancel"})]}),!e&&"Login"]})})]}),a.jsx("div",{className:"flex-spacer",children:t!=null&&a.jsx("p",{className:"error-message mb-0",role:"alert",children:`${t}`})})]})}function vn({children:s,logoPath:t="./logo.png"}){return a.jsxs("div",{className:"login-container",children:[a.jsx(Ut,{}),a.jsxs("div",{className:"login-box",children:[a.jsx("div",{className:"logo",children:a.jsx("img",{src:t,alt:"Deephaven Data Labs"})}),s,a.jsxs("p",{className:"footer",children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})}const $e="io.deephaven.authentication.psk.PskAuthenticationHandler",bn="psk",Ve="io.deephaven.web.client.auth.psk.token",se=A.module("AuthPluginPsk");function Ni(){return new URLSearchParams(window.location.search).get(bn)}function Si(){se.debug2("clearWindowToken");const s=new URL(window.location.href);s.searchParams.delete(bn),window.history.replaceState(null,"",s.href)}function Ct(){return ie.get(Ve)??null}function Ae(s){se.debug2("Storing token in cookie",s),s!=null?ie.set(Ve,s,{secure:!0,sameSite:"strict"}):ie.remove(Ve)}function Ii({children:s,logoPath:t}){const e=pe(),n=r.useRef(null),o=r.useRef(null),[i,l]=r.useState(),[c,u]=r.useState(!1),[d,h]=r.useState(!1),[p,f]=r.useState(!1),[m,b]=r.useState(""),T=r.useCallback(async(y,S=!0)=>{se.info("Logging in..."),f(!0);let x=null;try{if(x=e.login({type:$e,token:y}),o.current=x,await x,se.info("Logged in successfully"),o.current!==x)return;Ae(y),h(!0)}catch(I){if(o.current!==x)return;if(u(!0),S){se.error("Unable to login",I);const L=de(I)??"Unable to login: Verify credentials.";l(new pn(L))}}f(!1)},[e]),C=r.useCallback(()=>{o.current=null,f(!1)},[]),M=r.useCallback(async()=>{se.debug("onLogin");const y=Ct();d||p||y==null||T(y,!1)},[d,p,T]),P=r.useCallback(()=>{Ae(null)},[]);we(M,P),r.useEffect(()=>{let y=!1;async function S(){const x=Ni()??Ct();if(Si(),x==null){u(!0);return}f(!0);try{await e.login({type:$e,token:x}),y||(Ae(x),h(!0),f(!1))}catch{y||(u(!0),f(!1))}}return S(),()=>{y=!0}},[e]);const v=r.useCallback(()=>{p?C():T(m)},[C,p,T,m]);return r.useEffect(function(){var S;(S=n.current)==null||S.focus()},[n,c]),a.jsxs(a.Fragment,{children:[d&&s,c&&a.jsx(Ee,{in:!d,timeout:Q.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:a.jsx(vn,{logoPath:t,children:a.jsx(gn,{errorMessage:de(i),isLoggingIn:p,onSubmit:v,children:a.jsxs("div",{className:"form-group",children:[a.jsx("label",{htmlFor:"auth-psk-token-input",children:"Token"}),a.jsx("input",{id:"auth-psk-token-input",name:"token",className:"input-token form-control",type:"text",autoComplete:"username",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",ref:n,value:m,onChange:y=>{l(void 0),b(y.target.value)}})]})})})}),a.jsx(ae,{"data-testid":"auth-psk-loading",isLoaded:d||c,isLoading:!d&&!c})]})}const wi={Component:Ii,isAvailable:s=>s.includes($e)},Cn=wi,Oi=Object.freeze(Object.defineProperty({__proto__:null,AUTH_HANDLER_TYPE_ANONYMOUS:hn,AUTH_HANDLER_TYPE_PSK:hi,AuthPluginAnonymous:fn,AuthPluginBase:it,AuthPluginParent:mn,AuthPluginPsk:Cn,Login:vn,LoginForm:gn,UserOverrideContext:fi,UserPermissionsOverrideContext:at,isAuthPlugin:dn},Symbol.toStringTag,{value:"Module"})),xn={react:D,"react-dom":On,redux:jn,"react-redux":Mn,"@deephaven/auth-plugins":Oi,"@deephaven/components":_o,"@deephaven/jsapi-bootstrap":Fo,"@deephaven/jsapi-components":ui,"@deephaven/jsapi-utils":Yo,"@deephaven/log":Bs,"@deephaven/react-hooks":zs},ji=xt.createRequires(()=>xn),Mi=xt.createRemoteComponent({requires:ji}),Ri=Mi,Ai=Rn.createRequires(xn),Pi=An({requires:Ai}),Di=Pi,q=A.module("@deephaven/app-utils.PluginUtils");function ea(s,t){const e=new URL(`${t}.js`,s),n=D.forwardRef((o,i)=>a.jsx(Ri,{url:e.href,render:({err:l,Component:c})=>{if(l!=null&&l!==""){const u=`Error loading plugin ${t} from ${e} due to ${l}`;return q.error(u),a.jsx("div",{className:"error-message",children:`${u}`})}return a.jsx(c,{ref:i,...o})}}));return n.pluginName=t,n.displayName="Plugin",n}async function Li(s){return await Di(s)}async function _i(s){const t=await fetch(s);if(!t.ok)throw new Error(t.statusText);try{return await t.json()}catch{throw new Error("Could not be parsed as JSON")}}async function Fi(s){q.debug("Loading plugins...");try{const t=await _i(`${s}/manifest.json`);if(!Array.isArray(t.plugins))throw new Error("Plugin manifest JSON does not contain plugins array");q.debug("Plugin manifest loaded:",t);const e=[];for(let i=0;i<t.plugins.length;i+=1){const{name:l,main:c}=t.plugins[i],u=`${s}/${l}/${c}`;e.push(Li(u))}const n=await Promise.allSettled(e),o=new Map;for(let i=0;i<n.length;i+=1){const l=n[i],{name:c}=t.plugins[i];l.status==="fulfilled"?o.set(c,l.value):q.error(`Unable to load plugin ${c}`,l.reason)}return q.info("Plugins loaded:",o),o}catch(t){return q.error("Unable to load plugins:",t),new Map}}function Ui(s){var t;return((t=s.get("AuthHandlers"))==null?void 0:t.split(","))??[]}function $i(s,t,e){const n=Ui(t),o=[...s.entries()].filter(([,u])=>dn(u.AuthPlugin)).map(([u,d])=>[u,d.AuthPlugin]);o.push(...e??[]);const i=o.filter(([u,d])=>d.isAvailable(n,t));if(i.length===0)throw new Error(`No login plugins found, please register a login plugin for auth handlers: ${n}`);i.length>1&&q.warn("More than one login plugin available, will use the first one: ",i.map(([u])=>u).join(", "));const[l,c]=i[0];return q.info("Using LoginPlugin",l),c.Component}const rt=r.createContext(null);function Vi({pluginsUrl:s,children:t}){const[e,n]=r.useState(null);return r.useEffect(function(){let i=!1;async function l(){const c=await Fi(s);i||n(c)}return l(),()=>{i=!0}},[s]),a.jsx(rt.Provider,{value:e,children:t})}function Bi(){const s=st();return r.useEffect(function(){s.postMessage(Xe(Qe))},[s]),null}const Hi=new Map([["@deephaven/auth-plugins.AuthPluginPsk",Cn],["@deephaven/auth-plugins.AuthPluginParent",mn],["@deephaven/auth-plugins.AuthPluginAnonymous",fn]]);function Wi({children:s}){const t=pe(),e=r.useContext(rt),[n,o]=r.useState(),[i,l]=r.useState();r.useEffect(function(){let h=!1;async function p(){try{const f=await t.getAuthConfigValues();h||o(new Map(f))}catch(f){h||l(f)}}return p(),()=>{h=!0}},[t]);const c=r.useMemo(()=>{if(!(e==null||n==null))try{return $i(e,n,Hi)}catch(d){l(d)}},[n,e]),u=c==null||n==null;return u||i!=null?a.jsx(ae,{isLoading:u&&i==null,errorMessage:de(i)}):a.jsx(c,{authConfigValues:n,children:a.jsxs(a.Fragment,{children:[a.jsx(Bi,{}),s]})})}function ta(s){return new URL(s,`${window.location}`)}function Gi(){return new URLSearchParams(window.location.search).get("envoyPrefix")}function Ki(){const s=Gi();return s!=null?{headers:{"envoy-prefix":s}}:{headers:{}}}function zi({children:s}){return r.useContext(un)?a.jsx(a.Fragment,{children:s}):a.jsx(ae,{"data-testid":"fonts-loaded-loading"})}function na({fontClassNames:s,pluginsUrl:t,serverUrl:e,children:n}){const o=r.useMemo(()=>Ki(),[]),[i,l]=r.useState(0),c=r.useCallback(()=>{},[]),u=r.useCallback(()=>{l(d=>d+1)},[]);return we(c,u),a.jsx(di,{fontClassNames:s,children:a.jsx(Vi,{pluginsUrl:t,children:a.jsx(jt,{serverUrl:e,options:o,children:a.jsx(rn,{children:a.jsx(Wi,{children:a.jsx(Fs,{children:a.jsx(zi,{children:n})})})})},i)})})}function sa(){return Nt(rt,"No Plugins available in usePlugins. Was code wrapped in PluginsBootstrap or PluginsContext.Provider?")}export{na as AppBootstrap,Wi as AuthBootstrap,Fs as ConnectionBootstrap,aa as ConnectionContext,di as FontBootstrap,zi as FontsLoaded,un as FontsLoadedContext,Vi as PluginsBootstrap,rt as PluginsContext,Ri as RemoteComponent,Ui as getAuthHandlers,$i as getAuthPluginComponent,ta as getBaseUrl,Ki as getConnectOptions,Gi as getEnvoyPrefix,ea as loadComponentPlugin,_i as loadJson,Li as loadModulePlugin,Fi as loadModulePlugins,ra as useConnection,sa as usePlugins};
|
|
8
|
+
//# sourceMappingURL=index-2c897ff6.js.map
|