@deephaven/embed-grid 0.55.1-beta.6 → 0.55.1-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +0,0 @@
1
- import{C as h,$ as ll,H as wa,I as Qn,F as pe,J as Sa,r as c,K as Ze,L as Ce,M as ul,N as Ea,O as dl,P as Ca,Q as cl,S as hl,T as zr,U as st,G as z,E as K,V as E,W as fl,D as Gt,X as ml,Y as pl,Z as vl,_ as gl,a0 as bl,a1 as yl,a2 as vt,a3 as Pa,a4 as Ve,a5 as On,a6 as A,R as Ta,a7 as Gr,a8 as _l,a9 as wl,aa as Sl,ab as er,ac as El,ad as Cl,ae as Pl,af as Tl,ag as Ol,ah as Oa}from"./vendor-08550792.js";import{L as B,i as Il,v as Ia,M as tr,b as nr,c as Da,d as xa,e as Dl,f as xl,T as Je,g as ze,h as Al,j as Ml,k as Nl,l as Aa,m as Ma,D as Na,n as La,o as ja,s as Fa,p as Ll,C as jl,q as Fl,r as Rl,a as je,t as Ra,N as $l,u as kl,w as Bl,W as Ul,x as Wl,y as $a,z as ka,A as Hl,B as Ba,E as Vl,F as zl,G as Gl,H as rr,I as Kl,J as Xl,K as Kr,O as Yl,P as ql,Q as Zl,R as Jl}from"./index-c0c87455.js";import{g as Ql,c as Qe,d as eu,e as tu,h as Ua,P as rn,B as Ne,T as St,M as ir,D as Wa,i as Ha,j as nu,S as ar,R as Xr,k as In,l as Dn,m as Va,n as ru,o as iu,p as au,q as ou,C as su,r as za,s as lu,t as uu,v as du,G as cu,w as hu,K as fu,x as mu,y as pu,z as vu,O as gu,A as bu,E as yu,F as _u,H as wu,J as Ga,L as Su,N as Eu,Q as Cu,U as Pu,V as Tu,W as Ou,X as Iu,Y as Du,Z as xu,_ as Au,$ as Ka,a0 as Mu,a1 as Nu,a2 as Lu,a3 as an,a4 as ct,a5 as ju,a6 as Fu,a7 as Ru,a8 as Ct,a9 as $u,aa as or,ab as ku,ac as Xa,ad as Ya,ae as sr,af as lr,ag as qa,ah as Za,ai as Ja,f as Bu,aj as Qa,ak as Uu,al as Wu,am as ur,an as Kt,ao as Hu,ap as eo,aq as Yr,ar as Vu,as as zu,at as to,u as Gu,au as Ku,av as on,aw as no,ax as ro,ay as Xu,az as Yu,I as qr,aA as qu,aB as Zu,aC as Ju,aD as Qu,aE as ed,aF as td,aG as nd,aH as rd,aI as id,aJ as ad,aK as od,aL as sd,aM as ld,aN as ud,aO as dd,aP as cd,b as hd,aQ as fd,aR as md,aS as pd,aT as vd,aU as gd,aV as bd,aW as yd,aX as _d,aY as wd,aZ as Sd,a_ as Ed,a$ as Cd,b0 as Pd,b1 as Td,b2 as Od,b3 as Id,b4 as Dd,b5 as xd}from"./useUser-292ec6f4.js";import{a as Db}from"./useUser-292ec6f4.js";import{c as pn,P as dr,b as Ad,h as Md,p as Nd,o as Ld,s as jd,t as Fd}from"./plotly-251c118a.js";import"./helpers-042e6b4d.js";import"./monaco-9eb7d7d5.js";function gt(n){var e=n;n instanceof CustomEvent&&(e=n.detail);var t="";if(e instanceof Error?t=e.message:e!=null&&(t="".concat(e)),t=t.trim(),t.length>0)return t}var io=24,Rd=32,$d=33,kd=150,ao=200,oo=500,so=250,Bd={spellCheck:!1},Ud=["ariaLabel","icon","isQuiet","labelText","children","onOpenChange"];function Zr(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Jr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Zr(Object(t),!0).forEach(function(r){Wd(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Zr(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Wd(n,e,t){return e=Hd(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hd(n){var e=Vd(n,"string");return typeof e=="symbol"?e:String(e)}function Vd(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function zd(n,e){if(n==null)return{};var t=Gd(n,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function Gd(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function lo(n){var{ariaLabel:e,icon:t,isQuiet:r,labelText:i,children:a,onOpenChange:o}=n,s=zd(n,Ud);return h.jsxs(ll,{type:"popover",onOpenChange:o,children:[h.jsxs(wa,Jr(Jr({},s),{},{"aria-label":e??i,isQuiet:r,children:[h.jsx(Qn,{children:h.jsx(pe,{icon:t})}),i==null?null:h.jsx(Sa,{children:i})]})),a]})}function Kd(n,e){return n===0?0:e==="all"||n===e.size?"all":e.size}function uo(n,e){return n===e?!0:n==="all"||e==="all"||n.size!==e.size?!1:[...n.keys()].every(t=>e.has(t))}function co(n,e){return n.isInverted===e.isInverted&&uo(n.selection,e.selection)}function ho(n,e,t){if(n==="all")return"all";var r=[...n.keys()];return new Set(r.map(i=>t(e(i))))}function fo(n,e){var t=n==="all"||n.size>e/2,r=n;return t&&(r=n==="all"?new Set:new Set([...Ql(0,e-1)].filter(i=>!n.has(String(i))).map(i=>String(i)))),{selection:r,isInverted:t}}function Xd(n,e){return n?{}:{errorMessage:e,validationState:"invalid"}}function mo(n){var e;return(e=n==null?void 0:n.UNSAFE_getDOMNode())!==null&&e!==void 0?e:null}function Yd(n){var e=n==null?void 0:n.UNSAFE_getDOMNode().lastElementChild;return po(e)}function qd(n){var e=n==null?void 0:n.UNSAFE_getDOMNode(),t=e==null?void 0:e.querySelector("input"),r=t==null?void 0:t.getAttribute("aria-controls"),i=r==null?null:document.getElementById(r);return i}function po(n){return n instanceof HTMLElement?n:null}function vo(){var n=c.useRef(!1);return c.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[]),n}function Qr(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Zd(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Qr(a,r,i,o,s,"next",l)}function s(l){Qr(a,r,i,o,s,"throw",l)}o(void 0)})}}var vn=B.module("useAsyncInterval");function Jd(n,e){var t=vo(),r=c.useRef(0),i=c.useRef(0),a=c.useRef(null),o=c.useCallback(Zd(function*(){var s=Date.now();i.current+=1;var l=a.current==null?e:s-a.current;if(vn.debug("tick #".concat(i.current,"."),l,"ms elapsed since last tick."),a.current=s,yield n(),!!t.current){l+=Date.now()-a.current;var u=Math.max(0,l-e),d=Math.max(0,e-u);vn.debug("Next tick target:",e,", overage",u,", adjusted:",d),r.current=window.setTimeout(o,d)}}),[n,t,e]);c.useEffect(()=>(vn.debug("Setting target interval:",e),a.current=null,o(),()=>{window.clearTimeout(r.current)}),[e,o])}function Qd(n,e){return c.useCallback(function(){var t=n(...arguments);return e(),t},[e,n])}function Xt(n,e){var t=c.useMemo(()=>Ze(n,e),[n,e]);return c.useEffect(()=>()=>t.cancel(),[t]),t}function ec(n){var[e,t]=c.useState(n);return c.useEffect(()=>{t(n)},[n]),[e,t]}function tc(n,e,t,r){var i=c.useRef(0);c.useEffect(()=>{i.current>=t||r&&(i.current+=1,n())},[t,r,...e])}function go(n,e){var t=c.useRef(n),r=e(t.current,n)?t.current:n;return t.current=r,r}function nc(n){n.preventDefault()}function bo(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=c.useMemo(()=>"useSubmitButtonRef-".concat(Ce()),[]),t=c.useCallback(a=>{a==null||a.UNSAFE_getDOMNode().setAttribute("form",e)},[e]),r=c.useMemo(()=>({id:e,onSubmit:n?void 0:nc}),[e,n]),i=c.useMemo(()=>({form:e,ref:t}),[e,t]);return{formProps:r,submitButtonProps:i}}function yo(n,e){return c.useCallback(t=>{typeof n=="function"?n(e(t)):n.current=e(t)},[e,n])}function _o(n,e){var{getItem:t,selectedKeys:r,items:i}=n;return c.useMemo(()=>{var{selection:a,isInverted:o}=fo(r,i.length);return{selection:ho(a,t,e),isInverted:o}},[r,i.length,t,e])}function rc(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Il,t=c.useRef();return c.useEffect(()=>()=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t)},[]),c.useCallback(r=>{var i;(i=t.current)===null||i===void 0||i.call(t);var a=e(r);a&&(a.addEventListener("scroll",n),t.current=()=>{a.removeEventListener("scroll",n),t.current=void 0})},[e,n])}function ei(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function ic(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){ei(a,r,i,o,s,"next",l)}function s(l){ei(a,r,i,o,s,"throw",l)}o(void 0)})}}function ac(n,e,t){var r=c.useRef(null),[i,a]=c.useState(null),o=c.useCallback(ic(function*(){if(!(i==null||t==null)){var l=yield t();i.scroll(0,l)}}),[t,i]);c.useEffect(()=>(i==null||i.addEventListener("scroll",e),o(),()=>{i==null||i.removeEventListener("scroll",e)}),[e,i,o]);var s=c.useCallback(l=>{l&&setTimeout(()=>{a(n(r.current))},0)},[n]);return{ref:r,onOpenChange:s}}function ti(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function oc(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){ti(a,r,i,o,s,"next",l)}function s(l){ti(a,r,i,o,s,"throw",l)}o(void 0)})}}function Pt(n,e){var{autoLoad:t=!0}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},[r,i]=c.useState(null),[a,o]=c.useState(null),[s,l]=c.useState(!1),u=c.useCallback(oc(function*(){l(!0);try{var d=yield n(...e);i(d),o(null)}catch(f){i(null),o(f)}finally{l(!1)}}),[n,...e]);return c.useEffect(()=>{t&&u()},[t,u]),{data:r,error:a,isError:a!=null,isLoading:s,reload:u}}function ni(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ri(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ni(Object(t),!0).forEach(function(r){sc(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ni(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function sc(n,e,t){return e=lc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lc(n){var e=uc(n,"string");return typeof e=="symbol"?e:String(e)}function uc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function dc(n,e,t,r){var i=arguments.length===4;return c.useCallback(a=>{var o=i?a??r:a;t(ri(ri({},n),{},{[e]:o}))},[t,n,e,i,r])}function wo(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=c.useRef(),i=c.useRef(0);return c.useCallback(a=>{window.clearTimeout(r.current),r.current=window.setTimeout(()=>{var o=Math.floor(a.target.scrollTop/n);i.current!==o&&(i.current=o,e(o))},t)},[t,n,e])}function sn(n,e){var[t,r]=c.useState(n);return c.useEffect(()=>{var i=setTimeout(()=>{r(n)},e);return()=>{clearTimeout(i)}},[n,e]),t}function So(n,e){return c.useCallback(t=>{if(t!=null){var r=e==null?[t]:t.querySelectorAll(e);r.forEach(i=>{Object.entries(n).forEach(a=>{var[o,s]=a;i.setAttribute(o,s)})})}},[n,e])}function cc(n){var e=So(Bd,n);return yo(e,mo)}function Eo(){var{getKey:n=Co}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},[e,t]=c.useState([]),[r,i]=c.useState(()=>new Set),a=c.useCallback(v=>g=>n(g)===v,[n]),o=c.useCallback(v=>{var g;return(g=e.find(a(v)))!==null&&g!==void 0?g:null},[e,a]),s=c.useCallback(v=>{var g=o(v);if(g==null)throw new Error("No item found matching key: ".concat(v));return g},[o]),l=c.useCallback(v=>{t(g=>[...g,...v])},[]),u=c.useCallback((v,g)=>{t(b=>[...b.slice(0,v),...g,...b.slice(v)])},[]),d=c.useCallback(v=>{var g=new Set(v);t(b=>b.filter(w=>!g.has(n(w))))},[n]),f=c.useCallback((v,g)=>{var b=e.findIndex(a(v));b!==-1&&t(w=>[...w.slice(0,b),g,...w.slice(b+1)])},[e,a]),m=c.useCallback(v=>{if(v.size!==0){var g=[],b=new Map;for(var w of v.keys()){var _=e.findIndex(a(w));g.push(_),b.set(_,w)}g.sort((P,S)=>P-S);var y=[];e.forEach((P,S)=>{if(g[0]===S){var D=b.get(g.shift()),O=v.get(D);y.push(O)}else y.push(P)}),t(y)}},[e,a]),p=c.useMemo(()=>({items:e,selectedKeys:r,append:l,bulkUpdate:m,findItem:o,getItem:s,insert:u,remove:d,setItems:t,setSelectedKeys:i,update:f}),[l,m,o,s,u,e,d,t,r,f]);return p}function Co(n){var e=n!=null&&typeof n=="object"&&"key"in n;if(!e)throw new Error("Item does not have a `key` prop.");return n.key}function hc(n,e){c.useEffect(()=>{if(n!=null){var t=new window.ResizeObserver(e);return t.observe(n),()=>{n!=null&&t.unobserve(n)}}},[n,e])}const fc=Object.freeze(Object.defineProperty({__proto__:null,createValidationProps:Xd,defaultGetKey:Co,extractSpectrumHTMLElement:mo,extractSpectrumLastChildHTMLElement:Yd,findSpectrumComboBoxScrollArea:qd,getSelectedItemCountOrAll:Kd,identityExtractHTMLElement:po,isSelectionEqual:uo,isSelectionMaybeInvertedEqual:co,mapSelection:ho,optimizeSelection:fo,useAsyncInterval:Jd,useCallbackWithAction:Qd,useContextOrThrow:Qe,useCopyToClipboard:eu,useDebouncedCallback:Xt,useDebouncedValue:sn,useDependentState:ec,useEffectNTimesWhen:tc,useFormWithDetachedSubmitButton:bo,useForwardedRef:tu,useIsEqualMemo:go,useIsMountedRef:vo,useMappedRef:yo,useMappedSelection:_o,useOnScrollOffsetChangeCallback:wo,useOnScrollRef:rc,usePopoverOnScrollRef:ac,usePrevious:Ua,usePromiseFactory:Pt,usePropChangeCallback:dc,useResizeObserver:hc,useSetAttributesCallback:So,useSpectrumDisableSpellcheckRef:cc,useWindowedListData:Eo},Symbol.toStringTag,{value:"Module"})),mc="_spectrumActionBar_tmmkp_5",pc="_spectrumDialogComponentHeading_tmmkp_9",vc="_spectrumEllipsis_tmmkp_14",cr={spectrumActionBar:mc,spectrumDialogComponentHeading:pc,spectrumEllipsis:vc};function ii(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ft(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ii(Object(t),!0).forEach(function(r){gc(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ii(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function gc(n,e,t){return e=bc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bc(n){var e=yc(n,"string");return typeof e=="symbol"?e:String(e)}function yc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Po(n){var{heading:e,confirmationButtonLabel:t,children:r,onCancel:i,onConfirm:a}=n,{formProps:o,submitButtonProps:s}=bo();return h.jsxs(ul,{children:[h.jsx(Ea,{level:3,UNSAFE_className:cr.spectrumDialogComponentHeading,children:e}),h.jsx(dl,{}),h.jsx(Ca,{children:h.jsx(cl,Ft(Ft({},o),{},{children:r}))}),h.jsxs(hl,{children:[h.jsx(zr,{variant:"secondary",onPress:i,children:"Cancel"}),h.jsx(zr,Ft(Ft({},s),{},{style:"fill",variant:"negative",onPress:a,type:"submit",children:t}))]})]})}function _c(n){var{ariaLabel:e,heading:t,confirmationButtonLabel:r,isHidden:i,children:a,onConfirm:o}=n,s=c.useCallback(l=>h.jsx(Po,{heading:t,confirmationButtonLabel:r,onCancel:l,onConfirm:()=>{l(),o()},children:a}),[a,r,t,o]);return h.jsx(lo,{ariaLabel:e,icon:Ia,isHidden:i,isQuiet:!0,height:io,children:s})}var wc=["icon","label"];function ai(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function oi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ai(Object(t),!0).forEach(function(r){Sc(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ai(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Sc(n,e,t){return e=Ec(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ec(n){var e=Cc(n,"string");return typeof e=="symbol"?e:String(e)}function Cc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Pc(n,e){if(n==null)return{};var t=Tc(n,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function Tc(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function To(n){var{icon:e,label:t}=n,r=Pc(n,wc);return h.jsx(wa,oi(oi({},r),{},{"aria-label":t,isQuiet:!0,height:io,children:h.jsx(Qn,{children:h.jsx(pe,{icon:e})})}))}To.displayName="IconActionButton";function si(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Oc(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?si(Object(t),!0).forEach(function(r){Ae(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):si(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ae(n,e,t){return e=Ic(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ic(n){var e=Dc(n,"string");return typeof e=="symbol"?e:String(e)}function Dc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var xc=100,xn;(function(n){n.UP="UP",n.DOWN="DOWN"})(xn||(xn={}));class we extends c.Component{constructor(e){super(e),Ae(this,"popper",void 0),Ae(this,"cbContainer",void 0),Ae(this,"menuContainer",void 0),Ae(this,"input",void 0),Ae(this,"getCachedFilteredOptions",st((r,i)=>r.filter(a=>a.title.toLowerCase().indexOf(i.toLowerCase())>=0)));var{popperOptions:t}=this.props;t=Oc({placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}}},t),this.state={title:"",filteredOptions:[],keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,invalid:!1,popperOptions:t},this.handleMenuKeyDown=this.handleMenuKeyDown.bind(this),this.handleMenuBlur=this.handleMenuBlur.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleInputKeyDown=this.handleInputKeyDown.bind(this),this.handleInputBlur=this.handleInputBlur.bind(this),this.handelInputFocus=this.handelInputFocus.bind(this),this.handleInputClick=this.handleInputClick.bind(this),this.updateInputValue=Ze(this.updateInputValue,xc),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=z.createRef(),this.cbContainer=z.createRef(),this.menuContainer=z.createRef(),this.input=z.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};var{options:t}=this.props,r=t.filter(i=>i.title.toLowerCase()===e.toLowerCase());return r.length<1?(this.setState({invalid:!0}),{value:e,isValid:!1}):(this.setState({invalid:!1}),{value:r[0].value,isValid:!0})}updateInputValue(e){var{menuIsOpen:t}=this.state,{value:r,isValid:i}=this.getValueAndValidate(e);t&&this.processFilterChange(e),this.fireOnChange(r,i)}fireOnChange(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{onChange:r}=this.props;r(e,t)}processFilterChange(e){var t,{options:r}=this.props,{menuIsOpen:i}=this.state,a=e?this.getCachedFilteredOptions(r,e):r,o=a.length===1&&a[0].title===e;if(this.setState({filteredOptions:a,keyboardOptionIndex:0}),o&&i){this.closeMenu();return}(t=this.popper.current)===null||t===void 0||t.scheduleUpdate()}resetValue(){this.setState({title:""}),this.fireOnChange("")}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var t,{filteredOptions:r,keyboardOptionIndex:i}=this.state,a=r[i];switch(e.key){case"Enter":case"ArrowRight":e.stopPropagation(),e.preventDefault(),a!=null&&(this.setState({title:a.title,invalid:!1}),this.fireOnChange(a.value)),this.closeMenu(),(t=this.input.current)===null||t===void 0||t.focus();break;case"ArrowUp":e.stopPropagation(),e.preventDefault(),this.navigateMenu(we.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":e.stopPropagation(),e.preventDefault(),this.navigateMenu(we.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(e.stopPropagation(),e.preventDefault(),e.shiftKey){this.navigateMenu(we.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(we.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.closeMenu();break}}navigateMenu(e){var{filteredOptions:t,keyboardOptionIndex:r}=this.state,i=r;e===we.MENU_NAVIGATION_DIRECTION.UP?r>0?(i=(i-1)%t.length,this.setState({keyboardOptionIndex:i})):r===0&&(i=t.length-1,this.setState({keyboardOptionIndex:i})):e===we.MENU_NAVIGATION_DIRECTION.DOWN&&r<t.length&&(i=(i+1)%t.length,this.setState({keyboardOptionIndex:i})),this.scrollOptionIntoView(i)}handleInputKeyDown(e){var{onEnter:t}=this.props,{menuIsOpen:r}=this.state;r?this.handleMenuKeyDown(e):e.key==="Enter"?t():e.key==="Escape"?(this.resetValue(),e.preventDefault(),e.stopPropagation()):e.key==="ArrowRight"||e.key==="ArrowLeft"||e.key==="Tab"||e.key==="Shift"||this.openMenu()}handleInputChange(e){this.setState({title:e.target.value}),this.updateInputValue(e.target.value)}handleOptionClick(e){var t;this.setState({title:e.title,invalid:!1}),this.fireOnChange(e.value),this.closeMenu(),(t=this.input.current)===null||t===void 0||t.focus()}handelInputFocus(){var{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputClick(){var{menuIsOpen:e}=this.state;e||this.openMenu()}handleInputBlur(e){var{menuIsOpen:t}=this.state;t&&e.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuBlur(e){e.relatedTarget===this.input.current||e.relatedTarget instanceof Element&&this.popper.current!==null&&this.popper.current.element.contains(e.relatedTarget)||this.closeMenu(!1)}handleMenuOpened(){var e;(e=this.input.current)===null||e===void 0||e.focus()}handleMenuExited(){var{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}openMenu(){var{title:e}=this.state;this.processFilterChange(e),this.setInputWidth(),this.setState({menuIsOpen:!0}),window.requestAnimationFrame(()=>{var t;(t=this.popper.current)===null||t===void 0||t.show()})}closeMenu(){var e,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;if(this.setState({menuIsOpen:!1,keyboardOptionIndex:0}),t){var r;(r=this.input.current)===null||r===void 0||r.focus()}(e=this.popper.current)===null||e===void 0||e.hide()}scrollOptionIntoView(e){if(this.menuContainer.current){var t;(t=this.menuContainer.current.children.item(e))===null||t===void 0||t.scrollIntoView({behavior:"smooth",block:"nearest"})}}renderMenuElement(){var{inputWidth:e}=this.state;return h.jsx("div",{className:K("aci-options"),ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,style:{width:e},onBlur:this.handleMenuBlur,children:this.renderOptions()})}renderOptions(){var{noMatchText:e}=this.props,{title:t,filteredOptions:r}=this.state;return t&&r.length===0?h.jsx("div",{className:"no-match",children:e}):r.map((i,a)=>this.renderOption(i,a))}renderOption(e,t){var{keyboardOptionIndex:r}=this.state,i="option-".concat(t,"-").concat(e.value);return h.jsx("button",{type:"button",className:K("aci-option-btn",{"keyboard-active":r===t}),onClick:()=>this.handleOptionClick(e),onFocus:()=>this.setState({keyboardOptionIndex:t}),children:e.title},i)}render(){var{options:e,inputPlaceholder:t,disabled:r,className:i,defaultTitle:a,spellCheck:o,"data-testid":s}=this.props,{title:l,menuIsOpen:u,popperOptions:d,invalid:f}=this.state;return h.jsxs("div",{className:"aci-container",ref:this.cbContainer,children:[h.jsx("input",{value:l||a,className:K("form-control",i,"aci-input",{"is-invalid":f&&!u}),ref:this.input,onChange:this.handleInputChange,placeholder:t||e[0].title,disabled:r,onFocus:this.handelInputFocus,onClick:this.handleInputClick,onBlur:this.handleInputBlur,onKeyDown:this.handleInputKeyDown,spellCheck:o,"data-testid":s}),h.jsx(rn,{ref:this.popper,options:d,className:K("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}}Ae(we,"propTypes",{options:E.arrayOf(E.shape({title:E.string.isRequired,value:E.string.isRequired})).isRequired,popperOptions:E.shape({}),onChange:E.func,inputPlaceholder:E.string,disabled:E.bool,className:E.string,defaultTitle:E.string,spellCheck:E.bool,onEnter:E.func,noMatchText:E.string,"data-testid":E.string});Ae(we,"defaultProps",{onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0});Ae(we,"MENU_NAVIGATION_DIRECTION",xn);const Ac=we;function hr(n){var{className:e="",value:t,onChange:r,spellCheck:i=!1,placeholder:a="",disabled:o=!1,delimiter:s="",id:l="","data-testid":u}=n,[d,f]=c.useState(t),[m,p]=c.useState(!1),v=c.useRef(null);c.useEffect(function(){f(t)},[t]);function g(O){return O.trim().split(s).filter(M=>M).join(`
2
- `.concat(s.trim()))}function b(O){return O.split(`
3
- `).map(M=>M.trim()).join(" ")}function w(){if(v.current){v.current.style.height="0";var O=v.current.scrollHeight+(v.current.offsetHeight-v.current.clientHeight);O>0&&(v.current.style.height="".concat(O,"px"))}}function _(O){var M=O.target.value;m&&(s&&(M=g(M)),p(!1)),f(M),r(M)}function y(){v.current&&(s&&(f(g(d)),w()),v.current.scrollLeft=0)}function P(){v.current&&document.activeElement!==v.current&&v.current.focus()}function S(){s&&(f(b(d)),r(b(d)))}function D(){p(!0)}return c.useEffect(function(){w()},[d]),h.jsx("textarea",{ref:v,id:l,className:K(e,"auto-resize-textarea form-control"),placeholder:a,value:d,rows:1,onChange:_,onFocus:y,onMouseDown:P,onBlur:S,onPaste:D,spellCheck:i,disabled:o,"data-testid":u})}hr.propTypes={value:E.string.isRequired,onChange:E.func.isRequired,className:E.string,placeholder:E.string,spellCheck:E.bool,disabled:E.bool,delimiter:E.string,id:E.string,"data-testid":E.string};hr.defaultProps={className:"",id:"",placeholder:"",disabled:!1,spellCheck:!1,delimiter:"","data-testid":void 0};function Dt(n){var{children:e,className:t,style:r,"data-testid":i}=n;return h.jsx("div",{className:K("btn-group",t),style:r,role:"group","data-testid":i,children:e})}Dt.displayName="ButtonGroup";Dt.propTypes={children:E.node.isRequired,className:E.string,style:E.object,"data-testid":E.string};Dt.defaultProps={className:null,style:{},"data-testid":void 0};function Mc(n){var{blockInteraction:e=!0,children:t,debounceMs:r,isOpen:i=!1}=n,a=sn(i,r);return h.jsxs(h.Fragment,{children:[e&&i&&h.jsx("div",{className:"modal-backdrop",style:{backgroundColor:"transparent"},"data-testid":"debounced-modal-backdrop"}),z.cloneElement(t,{isOpen:i&&a})]})}function Nc(n){var{className:e,icon:t,isOpen:r=!1,subtitle:i,title:a}=n;return h.jsx(tr,{isOpen:r,className:e,children:h.jsx(nr,{children:h.jsxs("div",{className:"info-modal",children:[t!=null&&h.jsx("div",{className:"message-icon",children:h.jsx(pe,{icon:t})}),h.jsx("div",{className:"message-header",children:a}),i!=null&&h.jsx("div",{className:"message-content",children:i})]})})})}function Oo(n){var{className:e="modal-footer",children:t,"data-testid":r}=n;return h.jsx("div",{className:e,"data-testid":r,children:t})}function fr(n){var{isOpen:e,headerText:t,bodyText:r,onCancel:i,onConfirm:a,onDiscard:o,onModalDisable:s,cancelButtonText:l="Cancel",confirmButtonText:u="Okay",discardButtonText:d="Discard",isConfirmDanger:f=!1,children:m,"data-testid":p}=n,v=c.useRef(null),g=c.useRef(null),b=c.useCallback(()=>{g.current!==null&&g.current.checked&&s&&s(),a()},[a,s]),w=c.useCallback(()=>{var y;(y=v.current)===null||y===void 0||y.focus()},[]),_="";return e&&(_=typeof r=="function"?r():r),h.jsxs(tr,{isOpen:e,className:"theme-bg-light",onOpened:w,children:[h.jsx(Da,{closeButton:!1,children:t}),h.jsx(nr,{children:_}),h.jsxs(Oo,{children:[s&&h.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[h.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:g,"data-testid":p!==void 0?"".concat(p,"-checkbox-confirm"):void 0}),h.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),o&&h.jsx(Ne,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:o,"data-testid":p!==void 0?"".concat(p,"-btn-discard"):void 0,children:d}),i&&h.jsx(Ne,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":p!==void 0?"".concat(p,"-btn-cancel"):void 0,children:l}),h.jsxs(Dt,{children:[h.jsx(Ne,{kind:f?"danger":"primary",onClick:b,ref:v,"data-testid":p!==void 0?"".concat(p,"-btn-confirm"):void 0,children:u}),m]})]})]})}fr.propTypes={isOpen:E.bool.isRequired,headerText:E.string.isRequired,bodyText:E.oneOfType([E.string,E.func]).isRequired,onCancel:E.func,onConfirm:E.func.isRequired,onDiscard:E.func,onModalDisable:E.func,cancelButtonText:E.string,confirmButtonText:E.string,discardButtonText:E.string,children:E.node,"data-testid":E.string};fr.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};var ln=z.forwardRef((n,e)=>{var{children:t,className:r,disabled:i,onClick:a,style:o,id:s}=n;return h.jsx("button",{ref:e,type:"button",className:K("btn",r),onClick:a,style:o,disabled:i,id:s,children:t})});ln.displayName="Button";ln.propTypes={children:E.node,className:E.string,disabled:E.bool,onClick:E.func,style:E.shape({}),id:E.string};ln.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Lc=ln;function li(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ui(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?li(Object(t),!0).forEach(function(r){jc(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):li(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function jc(n,e,t){return e=Fc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fc(n){var e=Rc(n,"string");return typeof e=="symbol"?e:String(e)}function Rc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function $c(n){var{styleProps:e,selectedItemCount:t,onClearSelection:r}=n;return h.jsx(fl,ui(ui({UNSAFE_className:cr.spectrumActionBar},e),{},{isEmphasized:!0,selectedItemCount:t,onClearSelection:r}))}function kc(n){var{className:e,isFlipped:t,children:r,"data-testid":i}=n,a=u=>{if(r.length!==2)throw new Error("CardFlip requires 2 children to function");return r[u]},o=c.useRef(null),s=c.useCallback(u=>{u.target===u.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),l=c.useCallback(u=>{u.target===u.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return c.useEffect(function(){if(!o.current)throw Error("ref undefined");o.current.addEventListener("transitionstart",s);var d=o.current;return function(){if(d!=null)return d.removeEventListener("transitionstart",s)}},[s]),h.jsxs("div",{className:K(e,{"card-flip--show-front":t,"card-flip--show-back":!t}),"data-testid":i,children:[h.jsx("div",{className:"card-flip--back",children:a(0)}),h.jsx("div",{ref:o,className:"card-flip--front",onTransitionEnd:l,children:a(1)})]})}function Io(n,e,t){return e=Bc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Bc(n){var e=Uc(n,"string");return typeof e=="symbol"?e:String(e)}function Uc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ee extends c.Component{static handleEnter(e){var t=e;t.style.height="0"}static handleEntering(e){var t=e;t.style.height="".concat(Ee.getHeight(t),"px")}static handleExiting(e){var t=e;t.style.height="0"}static handleExit(e){var t=e;t.style.height="".concat(Ee.getHeight(t),"px")}static getHeight(e){var t=e.scrollWidth-e.clientWidth;return e.scrollHeight-t}constructor(e){super(e),this.handleEntered=this.handleEntered.bind(this)}handleEntered(e){var t=e;t.style.height="";var{autoFocusOnShow:r}=this.props;if(r!==void 0&&r){var i=t.querySelector("input, select, textarea");i!=null&&i.focus()}}render(){var{children:e,className:t,in:r,"data-testid":i}=this.props;return h.jsx(Gt,{in:r,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:Ee.handleEnter,onEntering:Ee.handleEntering,onEntered:this.handleEntered,onExit:Ee.handleExit,onExiting:Ee.handleExiting,timeout:350,children:a=>h.jsx("div",{className:K({collapse:a==="exited"},t),"data-testid":i,children:e})})}}Io(Ee,"propTypes",{className:E.string,in:E.bool.isRequired,children:E.node.isRequired,autoFocusOnShow:E.bool,"data-testid":E.string});Io(Ee,"defaultProps",{className:"",autoFocusOnShow:!1,"data-testid":void 0});const Wc=Ee;var Hc=B.module("TimeInput"),Vc="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",zc=["00:00:00","12:34:56","23:59:59"],Do=z.forwardRef((n,e)=>{var{allowValueWrapping:t=!0,className:r="",onChange:i=()=>!1,value:a=0,onFocus:o=()=>!1,onBlur:s=()=>!1,onSelect:l=()=>!1,"data-testid":u}=n,[d,f]=c.useState(St.formatTime(a)),[m,p]=c.useState(),v=c.useRef(null);c.useImperativeHandle(e,()=>({focus:()=>{var y;(y=v.current)===null||y===void 0||y.focus()},setSelection:y=>{var P;(P=v.current)===null||P===void 0||P.focus(),p(y)}}),[]),c.useEffect(function(){f(St.formatTime(a))},[a]);function g(y,P,S){var D=y.selectionStart===0?24:60,O=parseInt(S,10)-P;return Number.isNaN(O)?O=0:t?O=(O%D+D)%D:O=Math.min(Math.max(0,O),D-1),"".concat(O).padStart(2,"0")}function b(y,P,S,D,O){return D===0&&O===2&&P===1&&parseInt(S,10)>1?"0".concat(S).concat(y.substring(2)):Wa(y,P,S)}function w(y){Hc.debug("handleChange",y),f(y),St.isTimeString(y)&&i(St.parseTime(y))}var _=c.useCallback(y=>{p(y),l(y)},[l]);return h.jsx(ir,{ref:v,className:r,example:zc,getNextSegmentValue:g,getPreferredReplacementString:b,onChange:w,onSelect:_,pattern:Vc,selection:m,value:d,onFocus:o,onBlur:s,"data-testid":u})});Do.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const Yt=Do;function di(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Gc(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?di(Object(t),!0).forEach(function(r){Ke(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):di(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ke(n,e,t){return e=Kc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kc(n){var e=Xc(n,"string");return typeof e=="symbol"?e:String(e)}function Xc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ci=-1,An;(function(n){n.UP="UP",n.DOWN="DOWN"})(An||(An={}));class fe extends c.Component{constructor(e){super(e),Ke(this,"csContainer",void 0),Ke(this,"menuContainer",void 0),Ke(this,"button",void 0),Ke(this,"input",void 0);var{value:t,valueToTime:r}=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=z.createRef(),this.menuContainer=z.createRef(),this.button=z.createRef(),this.input=z.createRef(),this.state={keyboardOptionIndex:0,menuIsOpen:!1,inputWidth:100,customTime:r(t),inputFocused:!1}}getSelectedText(){var{options:e,value:t,placeholder:r}=this.props,{customTime:i}=this.state;if(t===null)return r;for(var a=0;a<e.length;a+=1){var o=e[a];if(o.value===t)return o.title}return St.formatTime(i)}setInputWidth(){this.csContainer.current&&this.setState({inputWidth:this.csContainer.current.getBoundingClientRect().width})}focus(){var e;(e=this.button.current)===null||e===void 0||e.focus()}updateInputValue(e){var{onChange:t}=this.props;t(e)}handleResize(){this.setInputWidth()}handleMenuKeyDown(e){var t,{keyboardOptionIndex:r,inputFocused:i}=this.state,{options:a}=this.props;switch(e.key){case"Enter":case" ":i?this.updateFromCustom():this.updateInputValue(a[r].value),this.closeMenu(),(t=this.button.current)===null||t===void 0||t.focus(),e.stopPropagation(),e.preventDefault();break;case"Tab":e.shiftKey?this.handleMenuNavigation(fe.MENU_NAVIGATION_DIRECTION.UP):this.handleMenuNavigation(fe.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(fe.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(fe.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"Escape":this.closeMenu();break}}handleMenuNavigation(e){var{keyboardOptionIndex:t,inputFocused:r}=this.state,{options:i}=this.props,a=i.length,o=t;switch(e){case fe.MENU_NAVIGATION_DIRECTION.UP:if(!r&&t===0){this.focusInput();break}else r&&this.focusOption(t);t>0&&!r?(o=(o-1)%a,this.setState({keyboardOptionIndex:o})):t===0&&(o=a-1,this.setState({keyboardOptionIndex:o})),this.scrollOptionIntoView(o);break;case fe.MENU_NAVIGATION_DIRECTION.DOWN:if(!r&&t===a-1){this.focusInput();break}else r&&this.focusOption(t);t<a&&!(r&&t===0)&&(o=(o+1)%a,this.setState({keyboardOptionIndex:o})),this.scrollOptionIntoView(o);break}}handleOptionClick(e){var t=Number(e.currentTarget.value),{options:r,timeToValue:i}=this.props,{customTime:a}=this.state;if(t===ci){var o=i(a);this.updateAndClose(o)}else this.updateAndClose(r[t].value)}updateAndClose(e){var t;this.updateInputValue(e),this.closeMenu(),(t=this.button.current)===null||t===void 0||t.focus()}handleOptionFocus(e){this.setState({keyboardOptionIndex:Number(e.target.value)})}handleMenuOpened(){var e,{options:t,value:r}=this.props,{keyboardOptionIndex:i}=this.state;this.scrollOptionIntoView(i);var a=(e=this.menuContainer.current)===null||e===void 0?void 0:e.querySelector(".cs-option-btn.keyboard-active");if(a instanceof HTMLElement&&a.focus(),r!==null){var o=t.map(s=>s.value).indexOf(r);o<0&&this.focusInput()}}focusInput(){var e;(e=this.input.current)===null||e===void 0||e.focus()}focusOption(e){var t,r=(t=this.menuContainer.current)===null||t===void 0?void 0:t.querySelector(".cs-options");if(r&&r.children!=null){var i=r.children.item(e);i instanceof HTMLElement&&i.focus()}}handleMenuExited(){var{menuIsOpen:e}=this.state;e&&this.setState({menuIsOpen:!1,keyboardOptionIndex:0})}handleCustomInput(e){var{timeToValue:t}=this.props,r=t(e);this.updateInputValue(r),this.setState({customTime:e})}updateFromCustom(){var{timeToValue:e}=this.props,{customTime:t}=this.state,r=e(t);this.updateInputValue(r)}toggleMenu(e){var{menuIsOpen:t}=this.state;t?this.closeMenu():this.openMenu(),e.stopPropagation()}openMenu(){this.updateKeyboardIndex(),this.setInputWidth(),this.setState({menuIsOpen:!0})}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;if(this.setState({menuIsOpen:!1}),e){var t;(t=this.button.current)===null||t===void 0||t.focus()}}updateKeyboardIndex(){var{options:e,value:t}=this.props;if(t!==null){var r=e.map(i=>i.value).indexOf(t);r>0&&this.setState({keyboardOptionIndex:r})}}scrollOptionIntoView(e){var t,r=(t=this.menuContainer.current)===null||t===void 0?void 0:t.querySelector(".cs-options");if(r&&r.children!=null){var i=r.children.item(e);i instanceof HTMLElement&&i.offsetTop>fe.DROP_DOWN_MENU_HEIGHT?r.scrollTop=i.offsetTop-fe.DROP_DOWN_MENU_HEIGHT:(i instanceof HTMLElement&&i.offsetTop<0||e===0)&&(r.scrollTop=0)}}renderMenuElement(){var{inputWidth:e}=this.state;return h.jsx("div",{className:"cs-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:t=>{t.stopPropagation()},style:{width:e},children:h.jsx("div",{className:"cs-options-container",children:h.jsx("div",{className:"cs-options",children:this.renderOptions()})})})}renderOptions(){for(var{options:e,value:t,icon:r,customText:i}=this.props,{keyboardOptionIndex:a,customTime:o,inputFocused:s}=this.state,l=!1,u=[],d=0;d<e.length;d+=1){var f=e[d],m="option-".concat(d,"-").concat(f.value);l=l||f.value===t,u.push(h.jsxs("button",{type:"button",value:d,className:K("cs-option-btn",{"keyboard-active":a===d&&!s}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[f.value===t&&h.jsx(pe,{icon:r,className:"mr-2"}),f.value!==t&&h.jsx("span",{className:"mr-4"}),f.title]},m))}return u.push(h.jsx("hr",{className:"cs-divider"},"option-divider")),u.push(h.jsxs("button",{type:"button",value:ci,className:K("cs-option-btn",{"keyboard-active":s}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!l&&t!==null?h.jsx(pe,{icon:r,className:"mr-2"}):h.jsx("span",{className:"mr-4"}),i]},"option-custom-label")),u.push(h.jsxs("div",{className:"cs-custom-container",children:[h.jsx("span",{className:"mr-2"}),h.jsx(Yt,{ref:this.input,onChange:this.handleCustomInput,value:o,onFocus:()=>this.setState({inputFocused:!0}),onBlur:()=>this.setState({inputFocused:!1})},"option-input"),h.jsx("span",{className:"ml-2"})]},"cs-custom-container")),u.push(h.jsx("hr",{className:"mb-2"},"option-end")),u}render(){var{disabled:e,invalid:t,value:r,"data-testid":i}=this.props,{menuIsOpen:a}=this.state,{popperOptions:o}=this.props;return o=Gc({placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}}},o),h.jsx("div",{className:"input-group cs-container context-menu",ref:this.csContainer,"data-testid":i,children:h.jsx("div",{className:K("input-group-append cs-dropdown",{"cs-dropdown-invalid":t}),children:h.jsxs("button",{type:"button",className:K("btn cs-btn form-control",{"cs-btn-invalid":t}),ref:this.button,onClick:this.toggleMenu,disabled:e,children:[h.jsx("span",{className:K({"text-muted":r===null}),children:this.getSelectedText()}),h.jsx("span",{children:h.jsx(pe,{icon:xa,className:"cs-caret"})}),h.jsx(Ha,{isShown:a,actions:{menuElement:this.renderMenuElement()},popperOptions:o,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}}Ke(fe,"MENU_NAVIGATION_DIRECTION",An);Ke(fe,"DROP_DOWN_MENU_HEIGHT",125);Ke(fe,"defaultProps",{onChange(){},value:null,disabled:!1,popperOptions:{},icon:Dl,customText:"Custom",placeholder:"Select a time",valueToTime:n=>n===null?0:Math.round(n/1e3),timeToValue:n=>n*1e3,invalid:!1,"data-testid":void 0});const Yc=fe;var qc=B.module("DateInput"),Zc="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",Jc=["2000-01-01","2022-12-31"],Qc="YYYY-MM-DD",xo=z.forwardRef((n,e)=>{var{className:t="",onChange:r=()=>{},defaultValue:i="",onFocus:a=()=>{},onBlur:o=()=>{},"data-testid":s}=n,[l,u]=c.useState(i),[d,f]=c.useState(),m=c.useCallback(p=>{qc.debug("handleChange",p),u(p),r(p)},[r]);return h.jsx("div",{className:"d-flex flex-row align-items-center",children:h.jsx(ir,{ref:e,className:K(t),example:Jc,getNextSegmentValue:nu,onChange:m,onSelect:f,pattern:Zc,placeholder:Qc,selection:d,value:l,onFocus:a,onBlur:o,"data-testid":s})})});xo.displayName="DateInput";const eh=xo;function Ao(n,e,t){return e=th(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function th(n){var e=nh(n,"string");return typeof e=="symbol"?e:String(e)}function nh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Mo extends c.PureComponent{constructor(e){super(e),Ao(this,"searchInput",void 0),this.searchInput=z.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=Ze(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){var{value:t}=this.props;e.value!==t&&this.setState({value:t})}focus(){var e;(e=this.searchInput.current)===null||e===void 0||e.focus()}handleChange(e){this.setState({value:e.target.value},this.sendUpdate)}sendUpdate(){var{onChange:e}=this.props,{value:t}=this.state;e(t)}render(){var{placeholder:e,className:t,matchCount:r,id:i,"data-testid":a}=this.props,{value:o}=this.state;return h.jsx(ar,{value:o,placeholder:e,onChange:this.handleChange,className:t,matchCount:r,ref:this.searchInput,id:i,"data-testid":a})}}Ao(Mo,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});const rh=Mo;function ih(n){var{isInvalid:e=!1,items:t,onAdd:r=()=>{},onDelete:i=()=>{},validate:a=()=>null}=n,[o,s]=c.useState(null),[l,u]=c.useState([]),[d,f]=c.useState(""),m=c.useCallback(y=>{u(y)},[]),p=c.useCallback(()=>{i(Xr.getItemsInRanges(t,l)),u([])},[t,l,i]),v=c.useCallback(()=>{if(d!==""){var y=a(d);y==null?(r(d),f("")):s(y)}},[d,r,a]),g=c.useCallback(y=>{var{value:P}=y.target;f(P),s(P===""?null:a(P))},[a]),b=c.useCallback(()=>{u([])},[]),w=c.useCallback(y=>{y.key==="Enter"&&v()},[v]),_=c.useMemo(()=>14+ml(t.length,1,6)*In.DEFAULT_ROW_HEIGHT,[t.length]);return h.jsxs("div",{className:K("editable-item-list-container",{"is-invalid":e}),children:[h.jsx("div",{style:{height:_},children:h.jsx(In,{itemCount:t.length,items:t.map((y,P)=>({value:y,isSelected:Xr.isSelected(l,P)})),offset:0,selectedRanges:l,onSelectionChange:m,isMultiSelect:!0})}),h.jsxs("div",{className:"d-flex flex-row pt-2",children:[h.jsx("div",{className:"d-flex flex-grow-1",children:h.jsx("input",{className:K("form-control",{"is-invalid":o!=null}),placeholder:"Enter value",type:"text",value:d,onChange:g,onFocus:b,onKeyDown:w})}),h.jsxs("div",{className:"d-flex align-items-start mt-1 ml-2",children:[h.jsx(Ne,{kind:"ghost",onClick:v,disabled:o!=null||d==="",icon:xl,tooltip:"Add new item","data-testid":"add-item-button"}),h.jsx(Ne,{kind:"ghost",onClick:p,disabled:l.length===0,icon:Ia,tooltip:"Delete selected items","data-testid":"delete-item-button"})]})]})]})}function ah(n,e,t){return e=oh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function oh(n){var e=sh(n,"string");return typeof e=="symbol"?e:String(e)}function sh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ht extends c.Component{static isParentSelected(e,t){var r=t.get(e);if(r===void 0)return!1;if(typeof r=="boolean")return r;var i=Array.from(r.values()).includes(!0),a=Array.from(r.values()).includes(!1);return i&&a?null:i}constructor(e){super(e),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(e){e.stopPropagation(),e.preventDefault(),this.setState(t=>{var{menuIsOpen:r}=t;return{menuIsOpen:!r}})}toggleValueFor(e,t){var{valueMap:r,onUpdateValueMap:i}=this.props,a=new Map(r),o=a.get(e);if(o instanceof Map){var s=new Map(o);if(t!=null)s.set(t,o.get(t)===void 0);else{var l=ht.isParentSelected(e,a),u=l==null||!l;o.forEach((m,p)=>s.set(p,u))}a.set(e,s)}else a.set(e,o==null||!o);var d=a.get(e);if(t===void 0&&d!==void 0&&typeof d!="boolean"){var f=ht.isParentSelected(e,r);f!=null&&f?d.forEach((m,p)=>d.set(p,!1)):d.forEach((m,p)=>d.set(p,!0))}i(a)}setAllValues(e){var{valueMap:t,onUpdateValueMap:r}=this.props,i=new Map;t.forEach((a,o)=>{if(typeof a=="boolean")i.set(o,e);else{var s=new Map;a.forEach((l,u)=>s.set(u,e)),i.set(o,s)}}),r(i)}selectAll(){this.setAllValues(!0)}clear(){this.setAllValues(!1)}renderMenuElement(){var{valueMap:e,"data-testid":t}=this.props;return h.jsxs("div",{className:"hcm-menu-container",children:[Array.from(e.entries()).map(r=>{var[i,a]=r;return h.jsxs("div",{children:[h.jsx(Dn,{className:"hcm-parent",checked:ht.isParentSelected(i,e),onChange:()=>this.toggleValueFor(i),children:i}),a!==void 0&&typeof a!="boolean"&&Array.from(a.entries()).map(o=>{var[s,l]=o;return h.jsx(Dn,{className:"hcm-child",checked:l,onChange:()=>this.toggleValueFor(i,s),children:s},s)})]},i)}),h.jsx(Ne,{kind:"ghost",onClick:this.selectAll,"data-testid":t!==void 0?"".concat(t,"-btn-select-all"):void 0,children:"Select All"}),h.jsx(Ne,{kind:"ghost",onClick:this.clear,"data-testid":t!==void 0?"".concat(t,"-btn-clear"):void 0,children:"Clear"})]})}render(){var{menuText:e,className:t,icon:r,id:i,"data-testid":a}=this.props,{menuIsOpen:o}=this.state;return h.jsxs("button",{type:"button",className:K("btn hcm-btn",t),onClick:this.toggleMenu,id:i,"data-testid":a,children:[h.jsxs("span",{children:[r&&h.jsx(pe,{icon:r,className:"hcm-icon mr-1"}),e]}),h.jsx(pe,{icon:xa,className:"hcm-icon ml-1"}),h.jsx(rn,{options:{placement:"bottom"},isShown:o,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}}ah(ht,"defaultProps",{className:"",icon:null,id:"","data-testid":void 0});const lh=ht;var uh=.025,dh=.9,ch=.1,hh=.618,gn=Je["primary-dark"],hi=80,fh=Je["gray-800"],mh=Je["gray-900"],Xe={SIZE:8,DOT_SIZE:2,FILL_OPACITY:.25},$e=18,ph=250,vh=60*1e3,gh=z.memo(()=>{var n=c.useRef(null),e=c.useRef(null),[t,r]=c.useState(!1),i=window.devicePixelRatio,a,o,s,l,u,d=null,f=[];function m(){var C;e.current!=null&&(s=e.current.offsetWidth,l=e.current.offsetHeight),n.current!=null&&(n.current.style.width="".concat(s,"px"),n.current.style.height="".concat(l,"px"),n.current.width=s*i,n.current.height=l*i),(C=a)===null||C===void 0||C.scale(i,i)}function p(){var C=document.createElement("canvas");C.width=Xe.SIZE,C.height=Xe.SIZE;var I=C.getContext("2d");return I!=null&&(I.fillStyle=gn,I.fillRect(0,0,Xe.DOT_SIZE,Xe.DOT_SIZE),I.fillStyle=gn+Math.round(255*Xe.FILL_OPACITY).toString(16).padStart(2,"0"),I.fillRect(0,0,Xe.SIZE,Xe.SIZE)),I==null?void 0:I.createPattern(C,"repeat")}function v(C){var I=Math.random()-.5,L=uh*I;return C<ch?L=Math.abs(L):C>dh&&(L=-Math.abs(L)),C+L}function g(){for(var C=[],I=hh,L=0;L<s+$e;L+=1)I=v(I),C.push(I);return C}function b(){for(;f.length>=s+$e;)f.pop();for(;f.length<s+$e;)f.push(v(f[f.length-1]))}function w(C,I){I.beginPath(),I.moveTo(-1,l+1),I.lineTo(-1,l*C[0]);for(var L=0;L<C.length;L+=1)I.lineTo(L,l*C[L]);I.lineTo(s+$e,l*C[C.length-1]),I.lineTo(s+$e,l+1),I.closePath()}function _(C){C.beginPath();for(var I=1;I<s;I+=hi)C.moveTo(I,0),C.lineTo(I,l);for(var L=1;L<l;L+=hi)C.moveTo(0,L),C.lineTo(s,L)}function y(C){var I,L,Y;d=(I=d)!==null&&I!==void 0?I:C,ze(a),a.fillStyle=mh,a.fillRect(0,0,s,l),_(a),a.lineWidth=1,a.strokeStyle=fh,a.stroke();var J=(((L=d)!==null&&L!==void 0?L:0)-(C??0))/(1e3/$e);if(a.translate(J,0),w(f,a),a.lineWidth=2,a.strokeStyle=gn,a.stroke(),a.translate(-J,0),o!=null&&(a.fillStyle=o),a.fill(),a.setTransform(i,0,0,i,0,0),(C??0)-((Y=d)!==null&&Y!==void 0?Y:0)>1e3/$e){for(var $,V=Math.floor(((C??0)-(($=d)!==null&&$!==void 0?$:0))/(1e3/$e)),X=0;X<V;X+=1)f.shift(),f.push(v(f[f.length-1]));d=C}u!=null&&cancelAnimationFrame(u),u=requestAnimationFrame(y)}var P=Ze(()=>{u=requestAnimationFrame(C=>{m(),b(),r(!1),y(C)})},ph,{leading:!0});function S(){r(!0),u!=null&&cancelAnimationFrame(u),u=null,d=null}var D=Ze(()=>{S()},vh);function O(){u==null&&(r(!1),m(),b(),u=requestAnimationFrame(y)),D()}function M(){document.hasFocus()&&O()}function F(){u!=null&&cancelAnimationFrame(u),D(),P()}return c.useEffect(()=>{var C;return a=(C=n.current)===null||C===void 0?void 0:C.getContext("2d",{alpha:!1}),m(),f=g(),o=p(),y(),D(),window.addEventListener("resize",F),window.addEventListener("focus",O),window.addEventListener("blur",S),window.addEventListener("mousemove",M),window.addEventListener("keydown",M),()=>{u!=null&&cancelAnimationFrame(u),window.removeEventListener("resize",F),window.removeEventListener("focus",O),window.removeEventListener("blur",S),window.removeEventListener("mousemove",M),window.removeEventListener("keydown",M),D.cancel(),P.cancel()}},[]),h.jsx("div",{className:"random-area-plot-animation-container",ref:e,children:h.jsx("canvas",{ref:n,className:t?"shade":""})})});const No=gh;function Lo(n){var{text:e,placement:t="top-start"}=n,r=c.useMemo(()=>({placement:t}),[t]);return h.jsxs(h.Fragment,{children:[h.jsx(Sa,{UNSAFE_className:cr.spectrumEllipsis,children:e??h.jsx(h.Fragment,{children:" "})}),e==null||e===""?null:h.jsx(Va,{options:r,children:e})]})}var bh=["scrollRef","getItemDisplayText","getKey"];function fi(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function mi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fi(Object(t),!0).forEach(function(r){yh(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):fi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function yh(n,e,t){return e=_h(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _h(n){var e=wh(n,"string");return typeof e=="symbol"?e:String(e)}function wh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Sh(n,e){if(n==null)return{};var t=Eh(n,e),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);for(i=0;i<a.length;i++)r=a[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function Eh(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,a;for(a=0;a<r.length;a++)i=r[a],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function Ch(n){var{scrollRef:e,getItemDisplayText:t,getKey:r}=n,i=Sh(n,bh),a=c.useCallback(o=>{var s=r(o),l=t(o);return h.jsx(pl,{textValue:l??String(s),children:h.jsx(Lo,{text:l})},s)},[t,r]);return h.jsx(vl,mi(mi({},i),{},{ref:e,menuTrigger:"focus",onSelectionChange:i.onSelectionChange,children:a}))}var mr=z.forwardRef((n,e)=>{var{children:t,className:r,disabled:i,id:a,isLinked:o,isLinkedSource:s,isInvalid:l,onClick:u,onMouseEnter:d,onMouseLeave:f,style:m,"data-testid":p}=n;return h.jsxs("button",{ref:e,type:"button",className:K("btn-socketed",{"btn-socketed-linked":o!==void 0&&o||s},{"btn-socketed-linked-source":s},{"is-invalid":l},r),id:a,onClick:u,onMouseEnter:d,onMouseLeave:f,style:m,disabled:i,"data-testid":p,children:[t,h.jsx(pe,{icon:Al,className:"linked btn-socketed-icon",transform:"down-1"}),h.jsx(pe,{icon:Ml,className:"is-invalid btn-socketed-icon"})]})});mr.displayName="SocketedButton";mr.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 Ph=mr,Th={"dh-spectrum-palette":"_dh-spectrum-palette_1mcqx_1"},Oh={"dh-spectrum-alias":"_dh-spectrum-alias_83lrx_1"};function pi(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function vi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?pi(Object(t),!0).forEach(function(r){Ih(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):pi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ih(n,e,t){return e=Dh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Dh(n){var e=xh(n,"string");return typeof e=="symbol"?e:String(e)}function xh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var gi=vi(vi({},Th),Oh);function bi(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Rt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bi(Object(t),!0).forEach(function(r){Ah(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):bi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ah(n,e,t){return e=Mh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mh(n){var e=Nh(n,"string");return typeof e=="symbol"?e:String(e)}function Nh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var{global:Lh,light:jh,dark:Fh,medium:Rh,large:$h}=gl,jo={global:Lh,light:Rt(Rt({},jh),gi),dark:Rt(Rt({},Fh),gi),medium:Rh,large:$h},kh=500;function Bh(n){var{heading:e,content:t,delayMs:r=kh}=n,[i,a]=c.useState(!1);return c.useEffect(()=>{window.setTimeout(()=>{a(!0)},r)},[r]),i?h.jsxs(bl,{children:[h.jsx(Qn,{size:"XXL",children:h.jsx(pe,{icon:Nl})}),h.jsx(Ea,{children:e}),t==null?null:h.jsx(Ca,{children:t})]}):null}function Uh(n){var{children:e,isPortal:t=!1,theme:r=jo,colorScheme:i}=n,[a]=c.useState(t?Ce():null);return h.jsx(yl,{theme:r,colorScheme:i,"data-unique-id":a,children:e})}var Wh=B.module("ThemeProvider"),pr=c.createContext(null);function Fo(n){var{themes:e,children:t}=n,r=c.useMemo(()=>Aa(),[]),[i,a]=c.useState(()=>{var l,u;return(l=(u=Ma())===null||u===void 0?void 0:u.themeKey)!==null&&l!==void 0?l:Na}),o=c.useMemo(()=>e==null?null:La(i,{base:r,custom:e??[]}),[r,i,e]);c.useEffect(function(){if(!(o==null||e==null)){var u=ja();Wh.debug2("updateThemePreloadData:",{active:o.map(d=>d.themeKey),all:e.map(d=>d.themeKey),preloadStyleContent:u,selectedThemeKey:i}),Fa({themeKey:i,preloadStyleContent:u})}},[o,i,e]);var s=c.useMemo(()=>({activeThemes:o,selectedThemeKey:i,setSelectedThemeKey:a}),[o,i]);return h.jsxs(pr.Provider,{value:s,children:[o==null?null:h.jsx(h.Fragment,{children:o.map(l=>h.jsx("style",{"data-theme-key":l.themeKey,children:l.styleContent},l.themeKey))}),h.jsx(Uh,{children:t})]})}function Ro(){return Qe(pr,"No ThemeContext value found. Component must be wrapped in a ThemeContext.Provider")}const Hh="_track_1ermw_30",Vh="_handle_1ermw_13",zh="_ticks_1ermw_98",$o={"handle-size":"15px","popover-width":"90px","time-slider":"_time-slider_1ermw_3","time-slider-popovers":"_time-slider-popovers_1ermw_8","handle-popper":"_handle-popper_1ermw_13","flex-spacer":"_flex-spacer_1ermw_26",track:Hh,"track-fills":"_track-fills_1ermw_37","track-fill":"_track-fill_1ermw_37","track-fill-start":"_track-fill-start_1ermw_55","track-fill-middle":"_track-fill-middle_1ermw_56","track-fill-end":"_track-fill-end_1ermw_59","handle-track":"_handle-track_1ermw_62",handle:Vh,ticks:zh,"tick-labels":"_tick-labels_1ermw_116","tick-label":"_tick-label_1ermw_116","tick-label-wrapper":"_tick-label-wrapper_1ermw_132"};var $t=parseInt($o["handle-size"],10),yi=parseInt($o["popover-width"],10),me=24*60*60-1,_i=5*60;function Gh(n){var{startTime:e,endTime:t,onChange:r,isStartModified:i=!1,isEndModified:a=!1,"data-testid":o}=n,[s,l]=c.useState(e),[u,d]=c.useState(t),f=c.useRef(null);c.useEffect(function(){l(e),d(t)},[e,t]);var m=c.useCallback((g,b)=>{var w=g,_=b;w===_&&(_<me?_+=1:w-=1),l(w),d(_),r({startTime:w,endTime:_})},[l,d,r]),p=c.useCallback(g=>{m(g,u)},[m,u]),v=c.useCallback(g=>{m(s,g)},[m,s]);return h.jsxs("div",{className:"time-slider","data-testid":o,children:[h.jsx(Kh,{startTime:s,endTime:u,onStartTimeChange:p,onEndTimeChange:v,isStartModified:i,isEndModified:a}),h.jsxs("div",{className:"track",ref:f,children:[h.jsx(Xh,{startTime:s,endTime:u}),h.jsx("div",{className:"ticks",children:Array(24).fill(null).map((g,b)=>h.jsx("div",{className:"tick"},b))}),h.jsx(wi,{track:f,time:s,setTime:p}),h.jsx(wi,{track:f,time:u,setTime:v})]}),h.jsxs("div",{className:"tick-labels",children:[h.jsx("div",{className:"tick-label",children:"0:00"}),h.jsx("div",{className:"tick-label-wrapper",children:Array(24).fill(null).map((g,b)=>h.jsx("div",{className:"tick-label",children:"".concat(b+1,":00")},b))})]})]})}function Kh(n){var{startTime:e,endTime:t,onStartTimeChange:r,onEndTimeChange:i,isStartModified:a,isEndModified:o,"data-testid":s}=n,l=e>t,[u,d]=c.useState(l?t:e),[f,m]=c.useState(l?e:t),p=c.useRef(null),v=c.useRef(null),g=c.useRef(null),b=c.useRef(null);c.useEffect(function(){d(e>t?t:e),m(e>t?e:t)},[e,t]),c.useEffect(function(){if(g.current!==null){var D;(D=v.current)===null||D===void 0||D.setSelection(g.current)}if(b.current!==null){var O;(O=p.current)===null||O===void 0||O.setSelection(b.current)}},[l]);function w(S){e<=t?r(S):i(S)}function _(S){e<=t?i(S):r(S)}var y=c.useCallback(S=>{g.current=S,b.current=null},[]),P=c.useCallback(S=>{g.current=null,b.current=S},[]);return h.jsxs("div",{className:"time-slider-popovers",children:[h.jsx("div",{className:"flex",style:{flexBasis:"calc(".concat(u/me*100,"% - ").concat(yi/2,"px)")}}),h.jsxs("div",{className:"handle-popper",children:[h.jsx("label",{className:K({modified:l?o:a}),children:l?"End Time":"Start Time"}),h.jsx(Yt,{ref:p,allowValueWrapping:!1,value:u,onChange:w,onSelect:y,"data-testid":s!==void 0?"".concat(s,"-input-1"):void 0})]}),h.jsx("div",{className:"flex-spacer"}),h.jsxs("div",{className:"handle-popper",children:[h.jsx("label",{className:K({modified:l?a:o}),children:l?"Start Time":"End Time"}),h.jsx(Yt,{ref:v,allowValueWrapping:!1,value:f,onChange:_,onSelect:P,"data-testid":s!==void 0?"".concat(s,"-input-2"):void 0})]}),h.jsx("div",{className:"flex",style:{flexBasis:"calc(".concat((me-f)/me*100,"% - ").concat(yi/2,"px)")}})]})}function Xh(n){var{startTime:e,endTime:t,"data-testid":r}=n;return h.jsxs("div",{className:"track-fills","data-testid":r,children:[e>t&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"track-fill track-fill-start",style:{transform:"scaleX(".concat(t/me,")")}}),h.jsx("div",{className:"track-fill track-fill-end",style:{transform:"scaleX(".concat((me-e)/me,")")}})]}),e<t&&h.jsx("div",{className:"track-fill track-fill-middle",style:{transform:"translateX(".concat(e/me*100,"%) scaleX(").concat((t-e)/me,")")}})]})}function wi(n){var{track:e,time:t,setTime:r,"data-testid":i}=n,a=c.useMemo(()=>{var m=3600,p=$t/2;return t<m?p=t/m*($t/2):t>23*m&&(p=$t/2+1/(me-23*m)*(t-23*m)*($t/2)),"translateX(calc(".concat(t/me*100,"% - ").concat(p,"px))")},[t]),o=c.useCallback(m=>{if(!e.current)return 0;var p=e.current.getBoundingClientRect(),v=Math.max(m-p.left,0),g=me*Math.min(1,v/p.width),b=_i*Math.round(g/_i),w=Math.min(me,b);return w},[e]),s=c.useCallback(m=>{var{clientX:p}=m;r(o(p))},[r,o]),l=c.useCallback(m=>{var{clientX:p}=m;r(o(p)),window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",l),document.documentElement.classList.remove("drag-pointer-events-none")},[r,o,s]),u=c.useCallback(()=>{window.addEventListener("mousemove",s),window.addEventListener("mouseup",l),document.documentElement.classList.add("drag-pointer-events-none")},[s,l]),d=c.useCallback(()=>{window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",l),document.documentElement.classList.remove("drag-pointer-events-none")},[s,l]),f=c.useCallback(()=>{u()},[u]);return c.useEffect(function(){return()=>{d()}},[d]),h.jsx("div",{className:"handle-track",style:{transform:a},children:h.jsx("button",{className:"handle",type:"button","aria-label":"Change time",onMouseDown:f,"data-testid":i})})}function ko(n){var{buttons:e,isShown:t=!1,classNames:r,message:i,type:a,onClick:o,onDismiss:s,"data-testid":l}=n,u=e&&e.length!==0;return h.jsx(Gt,{in:t,timeout:Je.transitionMs,classNames:"toast-notification-slide-up",mountOnEnter:!0,unmountOnExit:!0,children:h.jsxs("div",{className:K("toast-notification",r,a),role:"presentation",onClick:o,onKeyPress:o,"data-testid":l,children:[h.jsx("div",{className:"message-container",children:h.jsx("span",{className:"message",children:i})}),h.jsx(Gt,{in:u,timeout:Je.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h.jsx("div",{className:"buttons-container",children:e})}),s&&h.jsx(Ne,{kind:"ghost",icon:Ll,tooltip:"Close notification",className:"my-2",onClick:s})]})})}ko.TYPE=Object.freeze({ERROR:"error"});function Yh(n){var{children:e,className:t,labelText:r,hintText:i,isModified:a,validationError:o,showValidationError:s=!0,"data-testid":l,id:u}=n,{current:d}=c.useRef(u??Ce());return h.jsxs(h.Fragment,{children:[h.jsx("label",{className:K("validate-label",t,{modified:a}),htmlFor:d,"data-testid":l,children:r}),z.Children.toArray(e).map(f=>z.isValidElement(f)?z.cloneElement(f,{className:K(f.props.className,{"is-invalid":o})}):h.jsx("div",{className:K(t),children:f})),i!==void 0&&h.jsx("small",{className:"form-text text-muted",children:i}),o!==void 0&&s&&h.jsx("p",{className:"validate-label-error text-danger",children:o})]})}const qh=Object.freeze(Object.defineProperty({__proto__:null,ActionButtonDialogTrigger:lo,AutoCompleteInput:Ac,AutoResizeTextarea:hr,BasicModal:fr,BulkActionBar:$c,Button:Ne,ButtonGroup:Dt,ButtonOld:Lc,CSS_VAR_EXPRESSION_PREFIX:jl,CardFlip:kc,Checkbox:Dn,Collapse:Wc,ComboBox:ru,ConfirmActionButton:_c,ConfirmationDialog:Po,ContextActionUtils:iu,ContextActions:au,ContextMenuItem:ou,ContextMenuRoot:su,CopyButton:za,CustomTimeSelect:Yc,DEFAULT_DARK_THEME_KEY:Na,DEFAULT_GET_PREFERRED_REPLACEMENT_STRING:Wa,DEFAULT_LIGHT_THEME_KEY:Fl,DEFAULT_PRELOAD_DATA_VARIABLES:Rl,DateInput:eh,DateTimeInput:lu,DebouncedModal:Mc,DebouncedSearchInput:rh,DragUtils:uu,DraggableItemList:du,DropdownMenu:Ha,EditableItemList:ih,GLOBAL_SHORTCUTS:cu,HierarchicalCheckboxMenu:lh,IconActionButton:To,InfoModal:Nc,ItemList:In,ItemListItem:hu,get KEY(){return fu},LoadingOverlay:je,LoadingSpinner:Ra,get MODIFIER(){return mu},MaskedInput:ir,Menu:pu,MenuItem:vu,Modal:tr,ModalBody:nr,ModalFooter:Oo,ModalHeader:Da,NON_WHITESPACE_REGEX:$l,Option:gu,Page:bu,Popper:rn,RadioGroup:yu,RadioItem:_u,RandomAreaPlotAnimation:No,SearchInput:ar,SearchableCombobox:Ch,Select:wu,SelectValueList:Ga,Shortcut:Su,ShortcutRegistry:Eu,SocketedButton:Ph,Stack:Cu,THEME_CACHE_LOCAL_STORAGE_KEY:kl,TMP_CSS_PROP_PREFIX:Bl,TableViewEmptyState:Bh,TextWithTooltip:Lo,ThemeContext:pr,ThemeExport:Je,ThemeProvider:Fo,TimeInput:Yt,TimeSlider:Gh,ToastNotification:ko,Tooltip:Va,UISwitch:Pu,ValidateLabelInput:Yh,WHITESPACE_REGEX:Ul,calculatePreloadStyleContent:ja,extractDistinctCssVariableExpressions:Wl,fillToLength:Tu,getActiveThemes:La,getDefaultBaseThemes:Aa,getExpressionRanges:$a,getThemeKey:ka,getThemePreloadData:Ma,preloadTheme:Hl,resolveCssVariablesInRecord:Ba,resolveCssVariablesInString:Vl,setThemePreloadData:Fa,themeDHDefault:jo,themeDark:zl,themeLight:Gl,trimTrailingMask:Ou,useTheme:Ro},Symbol.toStringTag,{value:"Module"}));function Pe(){return Qe(rr,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function Zh(n,e){var t=Pe(),r=c.useMemo(()=>new t.CoreClient(n,e),[t,n,e]);return c.useEffect(()=>()=>{r.disconnect()},[r]),r}var vr=c.createContext(null);function Bo(n){var{serverUrl:e,options:t,children:r}=n,i=Zh(e,t);return h.jsx(vr.Provider,{value:i,children:r})}function et(){return Qe(vr,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}const Jh=Object.freeze(Object.defineProperty({__proto__:null,ApiBootstrap:Kl,ApiContext:rr,ClientBootstrap:Bo,ClientContext:vr,useApi:Pe,useClient:et},Symbol.toStringTag,{value:"Module"}));function Qh(n){return function(t){var{children:r}=t;return h.jsx(rr.Provider,{value:n,children:r})}}function Si(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function ef(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Si(a,r,i,o,s,"next",l)}function s(l){Si(a,r,i,o,s,"throw",l)}o(void 0)})}}var bn=B.module("MessageUtils"),Uo="io.deephaven.message.LoginOptions.request",Wo="io.deephaven.message.SessionDetails.request",Ho="io.deephaven.broadcast",gr="io.deephaven.broadcast.Login",Vo="io.deephaven.broadcast.Logout";function un(n){var e=n;return e!=null&&typeof e.id=="string"&&typeof e.message=="string"}function zo(n){return un(n)&&n.message===gr}function Go(n){return un(n)&&n.message===Vo}function Ko(n){var e=n;return e!=null&&typeof e.id=="string"}function br(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ce(),t=arguments.length>2?arguments[2]:void 0;return{message:n,id:e,payload:t}}function tf(n,e){return{id:n,payload:e}}function yr(){return window.opener!=null?window.opener:window.parent!=null&&window.parent!==window?window.parent:null}function _r(n){return Mn.apply(this,arguments)}function Mn(){return Mn=ef(function*(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3e4,t=yr();if(t==null)throw new Error("window parent is null, unable to send request.");return new Promise((r,i)=>{var a,o=Ce(),s=l=>{var{data:u}=l;if(!Ko(u)){bn.debug("Ignoring non-deephaven response",u);return}if(bn.debug("Received message",u),(u==null?void 0:u.id)!==o){bn.debug("Ignore message, id doesn't match",u);return}window.clearTimeout(a),window.removeEventListener("message",s),r(u.payload)};window.addEventListener("message",s),a=window.setTimeout(()=>{window.removeEventListener("message",s),i(new Iu("Request timed out"))},e),t.postMessage(br(n,o),"*")})}),Mn.apply(this,arguments)}function nf(n,e,t){return e=rf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function rf(n){var e=af(n,"string");return typeof e=="symbol"?e:String(e)}function af(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Xo extends Error{constructor(){super(...arguments),nf(this,"isNoConsolesError",!0)}}function Yo(n){return n.isNoConsolesError}function Ei(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function dn(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Ei(a,r,i,o,s,"next",l)}function s(l){Ei(a,r,i,o,s,"throw",l)}o(void 0)})}}var lt=B.module("SessionUtils");function of(n,e){return lt.info("Starting connection to '".concat(e,"'...")),new n.IdeConnection(e)}function qo(n,e,t){return Nn.apply(this,arguments)}function Nn(){return Nn=dn(function*(n,e,t){lt.info("Getting console types...");var r=yield e.getConsoleTypes();if(r.length===0)throw new Xo("No console types available");lt.info("Available types:",r);var i=r[0];lt.info("Starting session with type",i);var a=yield e.startSession(i),o={type:i,id:Ce.generate()};return lt.info("Console session established",o),{session:a,config:o,connection:e,details:t,dh:n}}),Nn.apply(this,arguments)}function sf(n,e,t){return lt.info("createCoreClient",e),new n.CoreClient(e,t)}function lf(n){return n!=null&&typeof n=="object"}function uf(){return Ln.apply(this,arguments)}function Ln(){return Ln=dn(function*(){var n=yield _r(Wo);if(!lf(n))throw new Error("Unexpected session details response: ".concat(n));return n}),Ln.apply(this,arguments)}function df(){return jn.apply(this,arguments)}function jn(){return jn=dn(function*(){var n=new URLSearchParams(window.location.search);switch(n.get("authProvider")){case"parent":return uf()}return{}}),jn.apply(this,arguments)}function cf(n,e,t){return Fn.apply(this,arguments)}function Fn(){return Fn=dn(function*(n,e,t){var r;try{r=yield qo(n,e,t)}catch(i){if(!Yo(i))throw i}return r}),Fn.apply(this,arguments)}const hf=Object.freeze(Object.defineProperty({__proto__:null,BROADCAST_CHANNEL_NAME:Ho,BROADCAST_LOGIN_MESSAGE:gr,BROADCAST_LOGOUT_MESSAGE:Vo,BooleanColumnFormatter:Du,CharColumnFormatter:xu,DateTimeColumnFormatter:Au,DateUtils:Ka,DecimalColumnFormatter:Mu,DefaultColumnFormatter:Nu,FETCH_TIMEOUT:Lu,Formatter:an,FormatterUtils:ct,IntegerColumnFormatter:ju,LOGIN_OPTIONS_REQUEST:Uo,NoConsolesError:Xo,SESSION_DETAILS_REQUEST:Wo,StringColumnFormatter:Fu,TableColumnFormatter:Ru,TableUtils:Ct,createComboboxFilterArgs:$u,createConnection:of,createCoreClient:sf,createFilterConditionFactory:or,createKeyFromOffsetRow:ku,createNotNullOrEmptyFilterCondition:Xa,createOnTableUpdatedHandler:Ya,createSearchTextFilter:sr,createSelectedValuesFilter:lr,createSessionWrapper:qo,createShowOnlyEmptyFilterCondition:qa,createValueFilter:Za,defaultRowDeserializer:Ja,fetchVariableDefinition:Bu,generateEmptyKeyedItems:Qa,getColumnFormats:Uu,getDateTimeFormatterOptions:Wu,getSessionDetails:df,getSize:ur,getWindowParent:yr,isBroadcastLoginMessage:zo,isBroadcastLogoutMessage:Go,isClosed:Kt,isCustomColumnFormatDefined:Hu,isMessage:un,isNoConsolesError:Yo,isResponse:Ko,loadSessionWrapper:cf,makeMessage:br,makeResponse:tf,padFirstAndLastRow:eo,requestParentResponse:_r},Symbol.toStringTag,{value:"Module"}));var Ci=B.module("useTableListener"),ff=(n,e,t)=>c.useEffect(function(){if(n==null){Ci.debug2("Emitter undefined, skipping addEventListener",e);return}return Ci.debug2("Adding listener",e),n.addEventListener(e,t)},[n,e,t]);const ft=ff;function mf(n,e,t){return e=pf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pf(n){var e=vf(n,"string");return typeof e=="symbol"?e:String(e)}function vf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class gf extends Error{constructor(){super(...arguments),mf(this,"isColumnNameError",!0)}}const bf=gf;function yf(n,e,t){return e=_f(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _f(n){var e=wf(n,"string");return typeof e=="symbol"?e:String(e)}function wf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Sf extends Error{constructor(){super(...arguments),yf(this,"isTableDisconnectError",!0)}}const Ef=Sf;var kt=B.module("useTable"),Cf=(n,e,t,r)=>{var i=Pe(),[a,o]=c.useState(void 0),[s,l]=c.useState([]),[u,d]=c.useState(null),[f,m]=c.useState(null);c.useEffect(()=>{if(r===void 0){o(n==null?void 0:n.columns),d(null);return}try{o(n==null?void 0:n.findColumns(r)),d(null)}catch(b){kt.error("Column not found",b,r),d(new bf("Invalid columnNames argument"))}},[n,r]),c.useEffect(()=>{if(!a||!n){kt.debug2("Table or column not initialized, skip viewport update.");return}kt.debug2("Setting viewport",e,t),n.setViewport(e,t,a)},[a,n,e,t]);var p=c.useCallback(b=>{var{detail:w}=b;if(!a){kt.error("Columns not initialized.");return}var _=a.map(y=>w.rows.map(P=>P.get(y)));l(_)},[a]),v=c.useCallback(()=>{m(new Ef("Table disconnected"))},[]),g=c.useCallback(()=>{m(null)},[]);return ft(n,i.Table.EVENT_UPDATED,p),ft(n,i.Table.EVENT_DISCONNECT,v),ft(n,i.Table.EVENT_RECONNECT,g),{columns:a,data:s,error:f??u}};const Zo=Cf;var Pf=(n,e,t,r)=>{var i=c.useMemo(()=>[r],[r]),{columns:a=[],data:o=[],error:s}=Zo(n,e,t,i);return{column:a[0],data:o[0],error:s}};const Jo=Pf;function Pi(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Tf(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Pi(a,r,i,o,s,"next",l)}function s(l){Pi(a,r,i,o,s,"throw",l)}o(void 0)})}}var Te=B.module("TableInput"),yn=250;function wr(n){var e,t,{className:r=void 0,columnName:i,settings:a,defaultValue:o=[],isInvalid:s=!1,onChange:l=()=>!1,onBlur:u=()=>!1,table:d}=n,f=c.useRef(null),m=Pe(),p=c.useMemo(()=>{var j=ct.getColumnFormats(a),U=ct.getDateTimeFormatterOptions(a),{defaultDecimalFormatOptions:x={},defaultIntegerFormatOptions:R={}}=a;return new an(m,j,U,x,R)},[m,a]),[v,g]=c.useState(""),[b,w]=c.useState(new Set(o)),[_,y]=c.useState(),P=c.useRef(null),S=Math.min((e=_==null?void 0:_.size)!==null&&e!==void 0?e:0,yn),{column:D,data:O,error:M}=Jo(_,0,yn-1,i),F=c.useCallback(j=>D?p.getFormattedString(j,D.type,D.name):"".concat(j),[D,p]),[C,I]=c.useMemo(()=>{var j=new Set(b),U=[];if(O==null)return[U,null];if(O.forEach(R=>{var W="".concat(R),Re=b.has(W);Re&&j.delete(W),U.push({value:W,displayValue:F(R),isSelected:Re})}),j.size>0){Te.debug2("Selection has items that are missing from the viewport");var x=new Set(b);return Array.from(j).forEach(R=>{x.delete(R)}),[U,x]}return[U,null]},[O,b,F]);c.useEffect(()=>{I!==null&&(w(I),l(Array.from(I)))},[l,I]);var L=c.useCallback(function(){var j=Tf(function*(U){try{var x=yield U;Te.debug("Table resolved",x),y(x)}catch(R){if(Yr.isCanceled(R))return;Te.error(R)}});return function(U){return j.apply(this,arguments)}}(),[]);c.useEffect(()=>{var j=Yr.makeCancelable(d);return L(j),()=>{Te.debug2("Cancel table promise"),j.cancel()}},[d,L]);var Y=c.useCallback(j=>{var{value:U}=j.target;g(U);var x=C.findIndex(W=>W.displayValue.includes(U));if(x>-1){var R;Te.debug2("Found ".concat(U," at index ").concat(x)),(R=P.current)===null||R===void 0||R.scrollIntoView(x)}else Te.debug2("".concat(U," not found"))},[C,P]),J=c.useCallback(j=>{if(Te.debug("handleSelect",j),j>=C.length){Te.error("Invalid index",j);return}var U=C[j].value,x=new Set(b);C[j].isSelected?x.delete(U):x.add(U),w(x),l(Array.from(x))},[l,C,b]),$=c.useCallback(()=>{var j=C.map(x=>x.value),U=new Set(j);w(U),l(j)},[C,l]),V=c.useCallback(()=>{w(new Set),l([])},[l]),X=c.useCallback(()=>{},[]),q=c.useCallback(j=>{var U,{relatedTarget:x}=j;Te.debug("handleChildBlur",x,x instanceof HTMLElement,f.current,(U=f.current)===null||U===void 0?void 0:U.contains(x)),(!x||f.current&&x instanceof HTMLElement&&!f.current.contains(x))&&u()},[u]),le=C.length===0;return h.jsxs("div",{ref:f,className:K("table-input-container d-flex flex-column position-relative",r),children:[h.jsx(ar,{disabled:!!M||le,value:v,placeholder:"Search",onChange:Y,className:"mb-2 d-flex",onBlur:q}),h.jsx(Ga,{className:"table-input-list",disabled:_===void 0||le,isInvalid:s,items:le?[{value:"Empty",isSelected:!1}]:C,itemCount:S,offset:0,onSelect:J,onViewportChange:X,ref:P,onBlur:q}),_&&h.jsxs("div",{className:"meta-row",children:[h.jsx("div",{className:"d-flex align-items-center text-muted small",children:_!=null&&_.size>S&&h.jsxs(h.Fragment,{children:["Table is too large, showing the first ",yn," items."]})}),h.jsxs("div",{children:[h.jsx("button",{type:"button",className:"btn btn-link",onBlur:q,onClick:$,children:"Select All"}),h.jsx("button",{type:"button",className:"btn btn-link mr-a",onBlur:q,onClick:V,children:"Clear"})]})]}),_==null||M&&h.jsx("div",{className:"h-100 w-100 position-absolute",children:h.jsx(je,{isLoaded:_!=null,isLoading:_==null&&M==null,errorMessage:(t=M==null?void 0:M.message)!==null&&t!==void 0?t:null})})]})}wr.displayName="TableInput";wr.defaultProps={isInvalid:!1,className:void 0};var Ti=B.module("useBroadcastChannel");function Sr(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Vu,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ho,t=c.useMemo(()=>new BroadcastChannel(e),[e]);return c.useEffect(()=>()=>{t.close()},[t]),c.useEffect(()=>{function r(i){var{data:a}=i;if(!un(a)){Ti.debug("Ignoring non-deephaven message",a);return}Ti.debug("event received",a),n(i)}return t.addEventListener("message",r),()=>{t.removeEventListener("message",r)}},[t,n]),t}function cn(n,e){var t=c.useCallback(r=>{zo(r.data)?n==null||n(r.data):Go(r.data)&&(e==null||e(r.data))},[n,e]);Sr(t)}var qt="io.deephaven.web.client.auth.refreshToken",Qo=c.createContext(null),Of=B.module("RefreshTokenUtils");function Rn(){var n=vt.get(qt);try{if(n!=null)return JSON.parse(n)}catch(e){Of.error("Error parsing refresh token",n,e)}return null}function $n(n){if(n==null){vt.remove(qt);return}var e=JSON.stringify({bytes:n.bytes,expiry:n.expiry}),t=new Date(n.expiry);vt.set(qt,e,{secure:!0,sameSite:"strict",expires:t})}function es(n){var{children:e}=n,t=Pe(),r=et(),[i,a]=c.useState(Rn());c.useEffect(function(){var u=r.addEventListener(t.CoreClient.EVENT_REFRESH_TOKEN_UPDATED,d=>{var{detail:f}=d;$n(f),a(f)});return u},[t,r,i]);var o=c.useCallback(()=>{a(Rn())},[]),s=c.useCallback(()=>{$n(null),a(null)},[]);return cn(o,s),h.jsx(Qo.Provider,{value:i,children:e})}function Fe(){var n=Pe();return c.useMemo(()=>new Ct(n),[n])}function If(n,e,t,r){var i=Fe(),[a,o]=c.useState(""),s=sn(a,t),l=c.useCallback(m=>{o(m.trim())},[]),{data:u,isLoading:d}=Pt(i.doesColumnValueExist,[n,e,s,r]),f=d||a!==s?null:u;return{valueTrimmed:a,valueTrimmedDebounced:s,valueExists:f,trimAndUpdateValue:l}}var Oi=B.module("useDebouncedViewportSearch"),Df=200;function xf(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Df,r=Fe(),{table:i,applyFiltersAndRefresh:a}=n,o=c.useMemo(()=>Ze(s=>{if(Oi.debug("Applying debounced searchText '".concat(s,"'")),i!=null){var l=s.trim();if(l===""){a([]);return}var u=i.findColumn(e),d=r.makeFilterValue(u.type,l),f=[u.filter().contains(d)];a(f)}},t),[a,e,t,i,r]);return c.useEffect(()=>()=>{Oi.debug("Cancelling debounced search function"),o.cancel()},[o]),o}var ts=300;function Af(n){var{viewportData:e,columnName:t,shouldSelectAllOnNoSelection:r,mapItemToValue:i}=n,a=Fe(),o=_o(e,i),s=sn(o,ts),l=go(s,co);return c.useMemo(()=>lr(a,t,l.selection,r,l.isInverted),[t,l,r,a])}function Er(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return c.useMemo(()=>zu(...t.map(i=>i(n))),[n,...t])}function Mf(n,e,t,r){var i=c.useRef("");return i.current=t,c.useMemo(()=>{var a=n.length>0&&n[0].item==null;return!a&&r!=null&&(i.current===""||r.toLowerCase().includes(i.current.toLowerCase()))?[{key:r,item:{[e]:r}},...n]:n},[r,e,n])}function Ii(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Nf(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Ii(a,r,i,o,s,"next",l)}function s(l){Ii(a,r,i,o,s,"throw",l)}o(void 0)})}}function Lf(n){var{table:e,columnName:t,defaultValue:r,itemHeight:i,topOffset:a=0,value:o}=n;return c.useCallback(Nf(function*(){if(e==null||o===""||o===r)return a;var s=e.findColumn(t),l=yield e.seekRow(0,s,"String",o),u=r==null?0:1;return(l+u)*i+a}),[t,r,i,e,a,o])}function Cr(n){var[,e]=c.useState(0),t=Pe();return ft(n,t.Table.EVENT_SIZECHANGED,()=>{e(r=>r+1)}),ur(n)}var jf=B.module("useInitializeViewportData");function ns(n){var e=Eo({}),t=Math.max(0,Cr(n));return c.useEffect(()=>{var r=e.items.length;t!==r&&(jf.debug("size changed:",{currentSize:r,targetSize:t}),e.setItems(Array.from(Qa(0,t-1))))},[t,n]),e}function rs(n,e,t){return c.useCallback(function(i){var[a,o]=eo(i,e,t,ur(n));n==null||n.setViewport(a,o)},[n,t,e])}var Di=B.module("useViewportData");function Pr(n){var{table:e,itemHeight:t=1,scrollDebounce:r=kd,viewportSize:i=10,viewportPadding:a=50,deserializeRow:o=Ja}=n,s=ns(e),l=rs(e,i,a),u=c.useCallback(g=>{e&&!Kt(e)?l(g):Di.debug("setViewport called on closed table.",e)},[e,l]),d=c.useCallback(g=>{e&&!Kt(e)?(e.applyFilter(g),u(0)):Di.debug("applyFiltersAndRefresh called on closed table.",e)},[u,e]),f=Pe(),m=c.useMemo(()=>Ya(s,o),[o,s]);ft(e,f.Table.EVENT_UPDATED,m);var p=Cr(e);c.useEffect(()=>{u(0)},[e,u,p]);var v=wo(t,u,r);return c.useMemo(()=>({viewportData:s,size:p,table:e,applyFiltersAndRefresh:d,setViewport:u,onScroll:v}),[d,v,u,p,e,s])}function Tr(n,e){var{applyFiltersAndRefresh:t}=n;c.useEffect(()=>{t(e)},[t,e])}function Ff(n,e){for(var t=Fe(),[r,i]=c.useState(""),a=c.useMemo(()=>sr(t,e,r),[e,r,t]),o=Xt(i,ao),s=Pr({table:n,itemHeight:$d,viewportSize:oo,viewportPadding:so}),l=arguments.length,u=new Array(l>2?l-2:0),d=2;d<l;d++)u[d-2]=arguments[d];var f=Er(s.table,a,...u);return Tr(s,f),{list:s,onSearchTextChange:o}}function Rf(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"or",t=Fe(),r=c.useMemo(()=>Xa(t),[t]);return c.useMemo(()=>or(n,r,e),[n,e,r])}function is(n){c.useEffect(()=>()=>{n!=null&&(Kt(n)||n.close())},[n])}function $f(n,e,t){for(var r=Fe(),[i,a]=c.useState(""),[o,s]=c.useState(""),[l,u]=c.useState(null),[d,f]=c.useState(()=>new Map),{data:m,isLoading:p}=Pt(r.doesColumnValueExist,[n,e,o,!1]),v=p||o!==i?null:m,g=c.useMemo(()=>sr(r,e,o),[e,o,r]),b=c.useMemo(()=>lr(r,e,new Set(d.keys()),!1,!0),[e,d,r]),w=arguments.length,_=new Array(w>3?w-3:0),y=3;y<w;y++)_[y-3]=arguments[y];var{data:P}=Pt(r.createDistinctSortedColumnTable,[n,e,"asc",..._]);is(P);var S=Pr({table:P,itemHeight:Rd,viewportSize:oo,viewportPadding:so}),D=i.length>0&&S.size===0,O=d.has(i),M=Xt(s,ao),F=c.useCallback($=>{a($),M($)},[M]),C=Xt(u,0),I=c.useCallback($=>{if(a(""),s(""),u($),C(null),$!=null){var V=S.viewportData.findItem($);if(V!=null){var X=t(V);f(q=>{var le=new Map(q);return le.set(X,{value:X}),le})}}},[C,S.viewportData,t]),L=c.useCallback($=>{f(V=>{if($.size===0)return V;var X=new Map(V);for(var q of $)X.set(q,{value:q});return X})},[]),Y=c.useCallback($=>{f(V=>{if($==="all")return new Map;var X=new Map(V);for(var q of $)X.delete(q);return X})},[]),J=Er(S.table,g,b);return Tr(S,J),c.useMemo(()=>({list:S,hasSearchTextWithZeroResults:D,searchText:i,searchTextExists:v,searchTextIsInSelectedValues:O,selectedKey:l,selectedValueMap:d,onSearchTextChange:F,onSelectKey:I,onAddValues:L,onRemoveValues:Y}),[D,S,L,Y,F,I,i,v,O,l,d])}function xi(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function kf(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){xi(a,r,i,o,s,"next",l)}function s(l){xi(a,r,i,o,s,"throw",l)}o(void 0)})}}function Bf(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];var i=c.useCallback(kf(function*(){var u;return(u=n==null?void 0:n.selectDistinct(n.findColumns(t)))!==null&&u!==void 0?u:null}),[n,...t]),{data:a,error:o,isError:s,isLoading:l}=Pt(i,[]);return c.useEffect(()=>()=>{a==null||a.close()},[a]),{distinctTable:a,error:o,isError:s,isLoading:l}}function Uf(n,e){var t=Fe(),r=c.useMemo(()=>qa(t,n),[n,t]);return c.useMemo(()=>or(e,r),[e,r])}function Wf(n,e,t){var r=Fe();return c.useMemo(()=>Za(r,n,e,t),[n,t,r,e])}const Hf=Object.freeze(Object.defineProperty({__proto__:null,ConnectionContext:to,DEBOUNCE_MS:ts,REFRESH_TOKEN_KEY:qt,RefreshTokenBootstrap:es,RefreshTokenContext:Qo,TableInput:wr,makeApiContextWrapper:Qh,readRefreshToken:Rn,storeRefreshToken:$n,useBroadcastChannel:Sr,useBroadcastLoginListener:cn,useCheckIfExistsValue:If,useConnection:Gu,useDebouncedViewportSearch:xf,useDebouncedViewportSelectionFilter:Af,useFilterConditionFactories:Er,useFilteredItemsWithDefaultValue:Mf,useGetItemPosition:Lf,useInitializeViewportData:ns,useNotNullOrEmptyFilter:Rf,usePickerWithSelectedValues:$f,useSearchableViewportData:Ff,useSelectDistinctTable:Bf,useSetPaddedViewportCallback:rs,useShowOnlyEmptyFilter:Uf,useTable:Zo,useTableClose:is,useTableColumn:Jo,useTableListener:ft,useTableSize:Cr,useTableUtils:Fe,useValueFilter:Wf,useViewportData:Pr,useViewportFilter:Tr},Symbol.toStringTag,{value:"Module"}));var as=c.createContext(!1);function Vf(n){var{fontClassNames:e=["fira-sans-regular","fira-sans-semibold","fira-mono"],children:t}=n,[r,i]=c.useState(!1);return c.useEffect(function(){document.fonts.ready.then(()=>{i(!0)})},[]),h.jsxs(h.Fragment,{children:[h.jsx(as.Provider,{value:r,children:t}),h.jsx("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:e.map(a=>h.jsx("p",{className:a,children:"preload"},a))})]})}var xt=c.createContext(null),tt=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin"});function os(n){return"DashboardPlugin"in n}function Zt(n){return"AuthPlugin"in n}function ss(n){return"TablePlugin"in n}function ls(n){return os(n)||Zt(n)||ss(n)}function zf(n){return"type"in n&&n.type===tt.DASHBOARD_PLUGIN}function Or(n){return"type"in n&&n.type===tt.WIDGET_PLUGIN}function Gf(n){return"type"in n&&n.type===tt.TABLE_PLUGIN}function us(n){return"type"in n&&n.type===tt.AUTH_PLUGIN}function ds(n){return"type"in n&&n.type===tt.THEME_PLUGIN}function Kf(n,e){return n==null||!Or(n)?!1:[n.supportedTypes].flat().some(t=>t===e)}function Xf(n){var e=h.jsx(pe,{icon:Xl});if(!Or(n))return e;var{icon:t}=n;return t==null?e:c.isValidElement(t)?t:h.jsx(pe,{icon:t})}function Yf(){return Qe(xt,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}const qf=Object.freeze(Object.defineProperty({__proto__:null,PluginType:tt,PluginsContext:xt,getIconForPlugin:Xf,isAuthPlugin:us,isDashboardPlugin:zf,isLegacyAuthPlugin:Zt,isLegacyDashboardPlugin:os,isLegacyPlugin:ls,isLegacyTablePlugin:ss,isTablePlugin:Gf,isThemePlugin:ds,isWidgetPlugin:Or,pluginSupportsType:Kf,usePlugins:Yf},Symbol.toStringTag,{value:"Module"}));function Zf(n){if(n==null)return!1;var e=n;return e.Component!==void 0&&typeof e.isAvailable=="function"}var cs="io.deephaven.auth.AnonymousAuthenticationHandler",Jf="io.deephaven.authentication.psk.PskAuthenticationHandler";function Ai(n,e,t){return e=Qf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Qf(n){var e=em(n,"string");return typeof e=="symbol"?e:String(e)}function em(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class tm extends Error{constructor(){super(...arguments),Ai(this,"name","AuthenticationError"),Ai(this,"isAuthenticationError",!0)}}const hs=tm;function Mi(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function nm(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Mi(a,r,i,o,s,"next",l)}function s(l){Mi(a,r,i,o,s,"throw",l)}o(void 0)})}}var Ni=B.module("AuthPluginBase");function Ir(n){var{children:e,getLoginOptions:t}=n,r=et(),[i,a]=c.useState(),[o,s]=c.useState(!1);return c.useEffect(()=>{var l=!1;function u(){if(l)throw new Ku("Login canceled.")}function d(){return f.apply(this,arguments)}function f(){return f=nm(function*(){try{var m=yield t();u(),Ni.info("Logging in..."),yield r.login(m),u(),s(!0)}catch(g){if(!l){var p;Ni.error("Unable to login:",g);var v=(p=gt(g))!==null&&p!==void 0?p:"Unable to login. Verify credentials.";a(new hs(v)),s(!1)}}}),f.apply(this,arguments)}return d(),()=>{l=!0}},[r,t]),o?h.jsx(h.Fragment,{children:e}):h.jsx(je,{"data-testid":"auth-base-loading",isLoading:i==null,isLoaded:!1,errorMessage:gt(i)})}var rm={canLogout:!1};function im(n){var{children:e}=n,t=Pe(),r=c.useCallback(()=>({type:t.CoreClient.LOGIN_TYPE_ANONYMOUS}),[t]);return h.jsx(Ir,{getLoginOptions:r,children:h.jsx(on.Provider,{value:rm,children:e})})}var am={Component:im,isAvailable:n=>n.includes(cs)};const fs=am;function Li(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function om(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){Li(a,r,i,o,s,"next",l)}function s(l){Li(a,r,i,o,s,"throw",l)}o(void 0)})}}var sm=B.module("AuthPluginParent"),lm={canLogout:!1};function um(n){return n!=null&&typeof n.type=="string"}function dm(){return kn.apply(this,arguments)}function kn(){return kn=om(function*(){sm.info("Logging in by delegating to parent window...");var n=yield _r(Uo);if(!um(n))throw new Error("Unexpected login options response: ".concat(n));return n}),kn.apply(this,arguments)}function cm(){var n;return(n=new URLSearchParams(window.location.search).get("authProvider"))!==null&&n!==void 0?n:""}function hm(n){var{children:e}=n;return h.jsx(Ir,{getLoginOptions:dm,children:h.jsx(on.Provider,{value:lm,children:e})})}var fm={Component:hm,isAvailable:()=>yr()!=null&&cm()==="parent"};const ms=fm;function ps(n){var{children:e,errorMessage:t,isLoggingIn:r=!1,onSubmit:i}=n;return h.jsxs("form",{className:"login-form",onSubmit:a=>{a.preventDefault(),a.stopPropagation(),i==null||i(a)},children:[h.jsx("div",{className:"flex-spacer"}),h.jsxs("div",{className:"flex-wrapper",children:[h.jsx("fieldset",{disabled:r,className:"container-fluid",children:e}),h.jsx("div",{className:"form-group d-flex justify-content-end align-items-center mb-0",children:h.jsxs("button",{type:"submit",className:K("btn btn-primary",{"btn-spinner":r},{"btn-cancelable":r}),"data-testid":"btn-login",children:[r&&h.jsxs("span",{children:[h.jsx(Ra,{className:"loading-spinner-vertical-align"}),h.jsx("span",{className:"btn-normal-content",children:"Logging in"}),h.jsx("span",{className:"btn-hover-content",children:"Cancel"})]}),!r&&"Login"]})})]}),h.jsx("div",{className:"flex-spacer",children:t!=null&&h.jsx("p",{className:"error-message mb-0",role:"alert",children:"".concat(t)})})]})}function vs(n){var{children:e,logoPath:t="./logo.png"}=n;return h.jsxs("div",{className:"login-container",children:[h.jsx(No,{}),h.jsxs("div",{className:"login-box",children:[h.jsx("div",{className:"logo",children:h.jsx("img",{src:t,alt:"Deephaven Data Labs"})}),e,h.jsxs("p",{className:"footer",children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})}function ji(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function _n(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){ji(a,r,i,o,s,"next",l)}function s(l){ji(a,r,i,o,s,"throw",l)}o(void 0)})}}var Bn="io.deephaven.authentication.psk.PskAuthenticationHandler",gs="psk",Un="io.deephaven.web.client.auth.psk.token",ut=B.module("AuthPluginPsk");function mm(){return new URLSearchParams(window.location.search).get(gs)}function pm(){ut.debug2("clearWindowToken");var n=new URL(window.location.href);n.searchParams.delete(gs),window.history.replaceState(null,"",n.href)}function Fi(){var n;return(n=vt.get(Un))!==null&&n!==void 0?n:null}function wn(n){ut.debug2("Storing token in cookie",n),n!=null?vt.set(Un,n,{secure:!0,sameSite:"strict"}):vt.remove(Un)}function vm(n){var{children:e,logoPath:t}=n,r=et(),i=c.useRef(null),a=c.useRef(null),[o,s]=c.useState(),[l,u]=c.useState(!1),[d,f]=c.useState(!1),[m,p]=c.useState(!1),[v,g]=c.useState(""),b=c.useCallback(function(){var S=_n(function*(D){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;ut.info("Logging in..."),p(!0);var M=null;try{if(M=r.login({type:Bn,token:D}),a.current=M,yield M,ut.info("Logged in successfully"),a.current!==M)return;wn(D),f(!0)}catch(I){if(a.current!==M)return;if(u(!0),O){var F;ut.error("Unable to login",I);var C=(F=gt(I))!==null&&F!==void 0?F:"Unable to login: Verify credentials.";s(new hs(C))}}p(!1)});return function(D){return S.apply(this,arguments)}}(),[r]),w=c.useCallback(()=>{a.current=null,p(!1)},[]),_=c.useCallback(_n(function*(){ut.debug("onLogin");var S=Fi();d||m||S==null||b(S,!1)}),[d,m,b]),y=c.useCallback(()=>{wn(null)},[]);cn(_,y),c.useEffect(()=>{var S=!1;function D(){return O.apply(this,arguments)}function O(){return O=_n(function*(){var M,F=(M=mm())!==null&&M!==void 0?M:Fi();if(pm(),F==null){u(!0);return}p(!0);try{yield r.login({type:Bn,token:F}),S||(wn(F),f(!0),p(!1))}catch{S||(u(!0),p(!1))}}),O.apply(this,arguments)}return D(),()=>{S=!0}},[r]);var P=c.useCallback(()=>{m?w():b(v)},[w,m,b,v]);return c.useEffect(function(){var D;(D=i.current)===null||D===void 0||D.focus()},[i,l]),h.jsxs(h.Fragment,{children:[d&&e,l&&h.jsx(Gt,{in:!d,timeout:Je.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h.jsx(vs,{logoPath:t,children:h.jsx(ps,{errorMessage:gt(o),isLoggingIn:m,onSubmit:P,children:h.jsxs("div",{className:"form-group",children:[h.jsx("label",{htmlFor:"auth-psk-token-input",children:"Token"}),h.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:i,value:v,onChange:S=>{s(void 0),g(S.target.value)}})]})})})}),h.jsx(je,{"data-testid":"auth-psk-loading",isLoaded:d||l,isLoading:!d&&!l})]})}var gm={Component:vm,isAvailable:n=>n.includes(Bn)};const bs=gm;function Ri(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Sn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ri(Object(t),!0).forEach(function(r){bm(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ri(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function bm(n,e,t){return e=ym(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ym(n){var e=_m(n,"string");return typeof e=="symbol"?e:String(e)}function _m(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var wm=B.module("UserUtils");function ys(n,e){return n.get("internal.webClient.appInit.".concat(e))}function _s(n){var e,t,r,i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};function s(b){return ys(n,b)}function l(b,w){var _=s(b);return _==="true"?!0:_==="false"?!1:(_!==void 0&&wm.warn("Unexpected value for ".concat(b,": ").concat(_)),w)}var u=(e=s("name"))!==null&&e!==void 0?e:"",d=(t=s("operateAs"))!==null&&t!==void 0?t:u,f=(r=(i=s("groups"))===null||i===void 0?void 0:i.split(","))!==null&&r!==void 0?r:[],m=l("canCopy",!0),p=l("canDownloadCsv",!0),v=l("canUsePanels",!0),g=l("canLogout",!0);return Sn(Sn({name:u,operateAs:d,groups:f},a),{},{permissions:Sn({canUsePanels:v,canCopy:m,canDownloadCsv:p,canLogout:g},o)})}const Sm=Object.freeze(Object.defineProperty({__proto__:null,AUTH_HANDLER_TYPE_ANONYMOUS:cs,AUTH_HANDLER_TYPE_PSK:Jf,AuthPluginAnonymous:fs,AuthPluginBase:Ir,AuthPluginParent:ms,AuthPluginPsk:bs,Login:vs,LoginForm:ps,UserContext:no,UserOverrideContext:ro,UserPermissionsOverrideContext:on,getAppInitValue:ys,getUserFromConfig:_s,isAuthPlugin:Zf},Symbol.toStringTag,{value:"Module"})),ws=typeof pn=="function"?pn:pn.default;dr.register([Ad,Md,Nd,Ld,jd,Fd]);function ue(n,e,t){return e=Em(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Em(n){var e=Cm(n,"string");return typeof e=="symbol"?e:String(e)}function Cm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ee{constructor(e){ue(this,"dh",void 0),ue(this,"listeners",void 0),ue(this,"formatter",void 0),ue(this,"rect",void 0),ue(this,"isDownsamplingDisabled",void 0),ue(this,"title",void 0),this.dh=e,this.listeners=[],this.isDownsamplingDisabled=!1}getData(){return[]}getDefaultTitle(){return""}getLayout(){return{}}getFilterColumnMap(){return new Map}isFilterRequired(){return!1}setFilter(e){}close(){}setFormatter(e){this.formatter=e}setDownsamplingDisabled(e){this.isDownsamplingDisabled=e}setDimensions(e){this.rect=e}setTitle(e){this.title=e}subscribe(e){this.listeners.push(e)}unsubscribe(e){this.listeners=this.listeners.filter(t=>t!==e)}fireEvent(e){for(var t=0;t<this.listeners.length;t+=1)this.listeners[t](e)}fireUpdate(e){this.fireEvent(new CustomEvent(ee.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(ee.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(ee.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(ee.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(ee.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(ee.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(ee.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(ee.EVENT_LOADFINISHED))}fireError(e){this.fireEvent(new CustomEvent(ee.EVENT_ERROR,{detail:e}))}}ue(ee,"EVENT_UPDATED","ChartModel.EVENT_UPDATED");ue(ee,"EVENT_DISCONNECT","ChartModel.EVENT_DISCONNECT");ue(ee,"EVENT_RECONNECT","ChartModel.EVENT_RECONNECT");ue(ee,"EVENT_DOWNSAMPLESTARTED","ChartModel.EVENT_DOWNSAMPLESTARTED");ue(ee,"EVENT_DOWNSAMPLEFINISHED","ChartModel.EVENT_DOWNSAMPLEFINISHED");ue(ee,"EVENT_DOWNSAMPLEFAILED","ChartModel.EVENT_DOWNSAMPLEFAILED");ue(ee,"EVENT_DOWNSAMPLENEEDED","ChartModel.EVENT_DOWNSAMPLENEEDED");ue(ee,"EVENT_LOADFINISHED","ChartModel.EVENT_LOADFINISHED");ue(ee,"EVENT_ERROR","ChartModel.EVENT_ERROR");const be=ee;function $i(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function rt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?$i(Object(t),!0).forEach(function(r){ae(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):$i(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ae(n,e,t){return e=Pm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Pm(n){var e=Tm(n,"string");return typeof e=="symbol"?e:String(e)}function Tm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var bt=B.module("ChartUtils"),ki="io.deephaven.time.DateTime",Om=36e5,Im=1e6;function Dm(n){return n.asDate!==void 0}function xm(n){return n.asNumber!==void 0}function Bi(n){return n.dhTimeZone!==void 0}function Am(n){return n!=null&&n.range!=null&&(n.autorange===!1||n.autorange===void 0)}class T{static getPlotlyErrorBars(e,t,r,i){var a=r.map((s,l)=>s-e[l]),o=t.map((s,l)=>e[l]-s);return{type:"data",symmetric:!1,array:a,arrayminus:o,color:i.error_band_line_color}}static convertNumberPrefix(e){return e.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(e,t,r){if(!r)return null;var i=r.split(";"),a=i[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);ze(a);var[,o,s,l,,u,d,f,m,p]=a,v=l.replace(",","").length,g=s.indexOf(",")>=0||l.indexOf(",")>=0,b=g?",":"",w=f!=null&&f!==""?"e":"f",_=m!==""?m:w,y=u.length+d.length,P="",S="0".concat(v).concat(b,".").concat(y).concat(P).concat(_),D=T.convertNumberPrefix(o),O=T.convertNumberPrefix(p);return{tickformat:S,tickprefix:D,ticksuffix:O,automargin:!0}}static addTickSpacing(e,t,r){var{gapBetweenMajorTicks:i}=t;if(i>0){var a=e||{},o=i;return r&&(o=i/Im),t.log&&(o=Math.log(o)),a.tickmode="linear",a.dtick=o,a}return e}static getSourceForAxis(e,t){for(var r=0;r<e.series.length;r+=1)for(var i=e.series[r],a=0;a<i.sources.length;a+=1){var o=i.sources[a];if(o.axis===t)return o}return null}static getSeriesVisibility(e,t){return t!=null&&t.hiddenSeries!=null&&t.hiddenSeries.includes(e)?"legendonly":!0}static getHiddenLabels(e){return e!=null&&e.hiddenSeries?[...e.hiddenSeries]:[]}static makeSeriesData(e,t,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:T.ORIENTATION.VERTICAL;return{type:e,mode:t,name:r,orientation:a,showlegend:i??void 0}}static getMarkerSymbol(e){switch(e){case"SQUARE":return"square";case"CIRCLE":return"circle";case"DIAMOND":return"diamond";case"UP_TRIANGLE":return"triangle-up";case"DOWN_TRIANGLE":return"triangle-down";case"RIGHT_TRIANGLE":return"triangle-right";case"LEFT_TRIANGLE":return"triangle-left";case"ELLIPSE":case"HORIZONTAL_RECTANGLE":case"VERTICAL_RECTANGLE":default:throw new Error("Unrecognized shape ".concat(e))}}static getAllAxes(e){return e.charts.reduce((t,r)=>[...t,...r.axes],[])}static getChartForSeries(e,t){for(var{charts:r}=e,i=0;i<r.length;i+=1)for(var a=r[i],o=0;o<a.series.length;o+=1)if(t===a.series[o])return a;return null}static getLayoutRanges(e){for(var t={},r=Object.keys(e).filter(s=>s.indexOf("axis")>=0),i=0;i<r.length;i+=1){var a=r[i],o=e[a];Am(o)&&(t[a]=[...o.range])}return t}static getAxisLayoutProperty(e,t){var r=t>0?"".concat(t+1):"";return"".concat(e??"","axis").concat(r)}static periodToDecimal(e){var t=e.split(":");return Number(t[0])+Number(t[1])/60}static groupArray(e,t){return e.reduce((r,i)=>{var a,o=i[t],s=(a=r.get(o))!==null&&a!==void 0?a:[];return s.push(i),r.set(o,s),r},new Map)}static getColorwayFromTheme(e){var t=[];return e.colorway&&(Array.isArray(e.colorway)?t=e.colorway:typeof e.colorway=="string"?t=e.colorway.split(" "):bt.warn("Unable to handle colorway property: ".concat(e.colorway))),t}static titleFromSettings(e){var{series:t,xAxis:r,title:i="".concat((t??[]).join(", ")," by ").concat(r)}=e;return i}constructor(e){ae(this,"dh",void 0),ae(this,"daysOfWeek",void 0),this.dh=e,this.daysOfWeek=Object.freeze(e.calendar.DayOfWeek.values())}getAxisFormats(e,t){for(var r=this,i=new Map,a={tickformat:null,ticksuffix:null},o=T.getAllAxes(e),s=T.groupArray(o,"type"),{charts:l}=e,u=0;u<l.length;u+=1)for(var d=l[u],f=0;f<d.series.length;f+=1)for(var m=d.series[f],{sources:p}=m,v=p.filter(_=>_.axis),g=function(){var y=v[b],{axis:P}=y,{type:S}=P,D=s.get(S);ze(D);var O=D.indexOf(P),M=r.getAxisPropertyName(S);if(M!=null){var F=T.getAxisLayoutProperty(M,O);if(i.has(F))bt.debug("".concat(F," already added."));else{bt.debug("Adding ".concat(F," to axisFormats."));var C=r.getPlotlyAxisFormat(y,t);if(C===null)i.set(F,a);else{i.set(F,C);var{businessCalendar:I}=P;if(I!=null){var L=[],{businessPeriods:Y,businessDays:J,holidays:$,timeZone:V}=I,X=t==null?void 0:t.getColumnTypeFormatter(ki),q;Bi(X)&&(q=X.dhTimeZone);var le=q?(V.standardOffset-q.standardOffset)/60:0;$.length>0&&L.push(...r.createRangeBreakValuesFromHolidays($,V,q)),Y.forEach(j=>L.push({pattern:"hour",bounds:[T.periodToDecimal(j.close)+le,T.periodToDecimal(j.open)+le]})),J.length<r.daysOfWeek.length&&r.createBoundsFromDays(J).forEach(j=>L.push({pattern:"day of week",bounds:j})),C.rangebreaks=L}if(i.size===d.axes.length)return{v:i}}}}},b=0;b<v.length;b+=1){var w=g();if(typeof w=="object")return w.v}return i}getPlotlyChartType(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.SCATTER:return t?"scatter":"scattergl";case r.plot.SeriesPlotStyle.LINE:return"scatter";case r.plot.SeriesPlotStyle.BAR:case r.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case r.plot.SeriesPlotStyle.PIE:return"pie";case r.plot.SeriesPlotStyle.TREEMAP:return"treemap";case r.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case r.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return}}getPlotlyChartMode(e,t,r){var{dh:i}=this,a=new Set;switch(e){case i.plot.SeriesPlotStyle.SCATTER:(t??!1)&&a.add(T.MODE_LINES),(r??!0)&&a.add(T.MODE_MARKERS);break;case i.plot.SeriesPlotStyle.LINE:(t??!0)&&a.add(T.MODE_LINES),(r??!1)&&a.add(T.MODE_MARKERS);break}return a.size>0?[...a].join("+"):void 0}getPlotlyProperty(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.PIE:switch(t){case r.plot.SourceType.X:return"labels";case r.plot.SourceType.Y:return"values"}break;case r.plot.SeriesPlotStyle.OHLC:switch(t){case r.plot.SourceType.TIME:return"x"}break;case r.plot.SeriesPlotStyle.TREEMAP:switch(t){case r.plot.SourceType.X:return"ids";case r.plot.SourceType.Y:return"values";case r.plot.SourceType.LABEL:return"labels";case r.plot.SourceType.PARENT:return"parents";case r.plot.SourceType.COLOR:return"marker.colors"}break}switch(t){case r.plot.SourceType.X:return"x";case r.plot.SourceType.Y:return"y";case r.plot.SourceType.Z:return"z";case r.plot.SourceType.X_LOW:return"xLow";case r.plot.SourceType.X_HIGH:return"xHigh";case r.plot.SourceType.Y_LOW:return"yLow";case r.plot.SourceType.Y_HIGH:return"yHigh";case r.plot.SourceType.TIME:return"time";case r.plot.SourceType.OPEN:return"open";case r.plot.SourceType.HIGH:return"high";case r.plot.SourceType.LOW:return"low";case r.plot.SourceType.CLOSE:return"close";case r.plot.SourceType.SHAPE:return"shape";case r.plot.SourceType.SIZE:return"size";case r.plot.SourceType.LABEL:return"label";case r.plot.SourceType.COLOR:return"color";case r.plot.SourceType.PARENT:return"parent";case r.plot.SourceType.HOVER_TEXT:return"hovertext";case r.plot.SourceType.TEXT:return"text";default:throw new Error("Unrecognized source type: ".concat(t))}}getPlotlySeriesOrientation(e){var t,r,{dh:i}=this,{sources:a}=e;return a.length===2&&((t=a[0])===null||t===void 0||(r=t.axis)===null||r===void 0?void 0:r.type)===i.plot.AxisType.Y?T.ORIENTATION.HORIZONTAL:T.ORIENTATION.VERTICAL}makeSeriesDataFromSeries(e,t,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,{name:o,isLinesVisible:s,isShapesVisible:l,plotStyle:u,lineColor:d,shapeColor:f,sources:m,shape:p,shapeSize:v}=e,g=m.some(P=>{var S;return(S=P.axis)===null||S===void 0?void 0:S.businessCalendar}),b=this.getChartType(u,g),w=this.getPlotlyChartMode(u,s??void 0,l??void 0),_=this.getPlotlySeriesOrientation(e),y=T.makeSeriesData(b,w,o,a,_);return this.addSourcesToSeriesData(y,u,m,t),this.addStylingToSeriesData(y,u,i,d,f,p,v,r),y}addSourcesToSeriesData(e,t,r,i){for(var a=e,o=0;o<r.length;o+=1){var s=r[o],{axis:l,type:u}=s,d=this.getPlotlyProperty(t,u);Pa(a,d,[]);var f=l!=null?this.getAxisPropertyName(l.type):null;if(f!=null){var m=i.get(l.type);if(m){var p=m.indexOf(l),v=p>0?"".concat(p+1):"";a["".concat(f,"axis")]="".concat(f).concat(v)}}}}addStylingToSeriesData(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:null,{dh:u}=this,d=e;if(d.marker={line:{}},d.line={width:1},t===u.plot.SeriesPlotStyle.AREA?d.fill="tozeroy":t===u.plot.SeriesPlotStyle.STACKED_AREA?d.stackgroup="stack":t===u.plot.SeriesPlotStyle.STEP?d.line.shape="hv":t===u.plot.SeriesPlotStyle.HISTOGRAM?(d.width=[],d.marker.line!==void 0&&Object.assign(d.marker.line,{color:r.paper_bgcolor,width:1})):t===u.plot.SeriesPlotStyle.OHLC?(d.increasing={line:{color:r.ohlc_increasing}},d.decreasing={line:{color:r.ohlc_decreasing}}):t===u.plot.SeriesPlotStyle.PIE?(d.textinfo="label+percent",d.outsidetextfont={color:r.title_color}):t===u.plot.SeriesPlotStyle.TREEMAP&&(d.hoverinfo="text",d.textinfo="label+text",d.tiling={packing:"squarify",pad:0},d.textposition="middle center",d.outsidetextfont={color:r.title_color}),i!=null&&(t===u.plot.SeriesPlotStyle.BAR?d.marker.color=i:d.line.color=i),a!=null&&(d.marker.color=a),o!=null&&o.length>0)try{d.marker.symbol=T.getMarkerSymbol(o)}catch(f){bt.warn("Unable to handle shape",o,":",f)}s!=null&&(d.marker.size=s*T.DEFAULT_MARKER_SIZE),l!=null&&t!==u.plot.SeriesPlotStyle.PIE&&(d.visible=l)}getChartType(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.HISTOGRAM:return"bar";default:return this.getPlotlyChartType(e,t)}}getAxisPropertyName(e){var{dh:t}=this;switch(e){case t.plot.AxisType.X:return"x";case t.plot.AxisType.Y:return"y";default:return null}}getAxisSide(e){var{dh:t}=this;switch(e){case t.plot.AxisPosition.BOTTOM:return"bottom";case t.plot.AxisPosition.TOP:return"top";case t.plot.AxisPosition.LEFT:return"left";case t.plot.AxisPosition.RIGHT:return"right";default:return}}updateFigureAxes(e,t,r,i){for(var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=e,l=T.getAllAxes(t),u=0;u<t.charts.length;u+=1){var d=t.charts[u],f=i==null?void 0:i(d),m=this.getChartBounds(t,d,a,o);this.updateLayoutAxes(s,d.axes,l,r,a,o,m,f)}this.removeStaleAxes(s,l)}getChartBounds(e,t,r,i){var a,{dh:o}=this,{cols:s,rows:l}=e,{column:u,colspan:d,row:f,rowspan:m}=t,p=u+d,v=f+m,g=1/s,b=1/l,w=T.AXIS_SIZE_PX/r,_=T.AXIS_SIZE_PX/i,y={bottom:(l-v)*b+(v<l?_/2:0),top:(l-f)*b-(f>0?_/2:0),left:u*g+(u>0?w/2:0),right:p*g-(p<s?w/2:0)},P=T.groupArray(t.axes,"position"),S=(a=P.get(o.plot.AxisPosition.RIGHT))!==null&&a!==void 0?a:[];return S.length>0&&(r>0?y.right-=(y.right-y.left)*Math.max(0,Math.min(T.LEGEND_WIDTH_PX/r,T.MAX_LEGEND_SIZE)):y.right-=(y.right-y.left)*T.DEFAULT_AXIS_SIZE),y}getPlotlyDateFormat(e,t,r){var{dh:i}=this,a=r==null?void 0:r.replace("%","%%").replace(/S{9}/g,"%9f").replace(/S{8}/g,"%8f").replace(/S{7}/g,"%7f").replace(/S{6}/g,"%6f").replace(/S{5}/g,"%5f").replace(/S{4}/g,"%4f").replace(/S{3}/g,"%3f").replace(/S{2}/g,"%2f").replace(/S{1}/g,"%1f").replace(/y{4}/g,"%Y").replace(/y{2}/g,"%y").replace(/M{4}/g,"%B").replace(/M{3}/g,"%b").replace(/M{2}/g,"%m").replace(/M{1}/g,"%-m").replace(/E{4,}/g,"%A").replace(/E{1,}/g,"%a").replace(/d{2}/g,"%d").replace(/([^%]|^)d{1}/g,"$1%-d").replace(/H{2}/g,"%H").replace(/h{2}/g,"%I").replace(/h{1}/g,"%-I").replace(/m{2}/g,"%M").replace(/s{2}/g,"%S").replace("'T'","T").replace(" z",""),o,s=e==null?void 0:e.getColumnTypeFormatter(t);return s!=null&&Bi(s)&&s.dhTimeZone!=null&&s.showTimeZone&&(o=i.i18n.DateTimeFormat.format(" z",new Date,s.dhTimeZone)),{tickformat:a,ticksuffix:o,automargin:!0}}getPlotlyAxisFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,{dh:r}=this,{axis:i,columnType:a}=e,{formatPattern:o}=i,s=null;return Ct.isDateType(a)?(s=this.getPlotlyDateFormat(t,a,o),s=T.addTickSpacing(s,i,!0)):Ct.isNumberType(a)&&(s=T.getPlotlyNumberFormat(t,a,o),s=T.addTickSpacing(s,i,!1)),i.formatType===r.plot.AxisFormatType.CATEGORY&&(s?s.type="category":s={type:"category",tickformat:void 0,ticksuffix:void 0}),s}updateLayoutAxes(e,t,r,i){for(var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:{left:0,top:0,right:1,bottom:1},l=arguments.length>7?arguments[7]:void 0,{dh:u}=this,d=a>0?Math.max(T.MIN_AXIS_SIZE,Math.min(T.AXIS_SIZE_PX/o,T.MAX_AXIS_SIZE)):T.DEFAULT_AXIS_SIZE,f=o>0?Math.max(T.MIN_AXIS_SIZE,Math.min(T.AXIS_SIZE_PX/a,T.MAX_AXIS_SIZE)):T.DEFAULT_AXIS_SIZE,m=e,p=T.groupArray(t,"position"),v=T.groupArray(t,"type"),g=[...v.keys()],b=T.groupArray(r,"type"),w=0;w<g.length;w+=1){var _=g[w],y=this.getAxisPropertyName(_);if(y!=null){var P=v.get(_),S=b.get(_),D=_===u.plot.AxisType.Y,O=D?o:a;ze(P),ze(S);for(var M=0;M<P.length;M+=1){var F=P[M],C=S.indexOf(F),I=T.getAxisLayoutProperty(y,C);m[I]==null&&(m[I]=this.makeLayoutAxis(_,i));var L=m[I];if(L!=null){this.updateLayoutAxis(L,F,M,p,d,f,s);var{range:Y,autorange:J}=L;if(l!=null&&Y!==void 0&&(J===void 0||J===!1)){var $=l(F),[V,X]=$(Y);bt.debug("Setting downsample range",O,V,X),F.range(O,V,X)}else F.range(O)}}}}}removeStaleAxes(e,t){for(var r=e,i=T.groupArray(t,"type"),a=[...i.keys()],o=0;o<a.length;o+=1){var s=a[o],l=i.get(s);ze(l);var u=l.length,d=this.getAxisPropertyName(s);if(d!=null)for(var f=T.getAxisLayoutProperty(d,u);r[f]!=null;)delete r[f],u+=1,f=T.getAxisLayoutProperty(d,u)}}updateLayoutAxis(e,t,r,i,a,o,s){var l,{dh:u}=this,d=t.type===u.plot.AxisType.Y,f=d?o:a,m=e,p=(l=t.label)!==null&&l!==void 0?l:"";if(m.title!==void 0&&typeof m.title!="string"?m.title.text=p:m.title={text:p},t.log&&(m.type="log"),m.side=this.getAxisSide(t.position),r>0){var v,g;m.overlaying=(v=this.getAxisPropertyName(t.type))!==null&&v!==void 0?v:void 0;var b=(g=i.get(t.position))!==null&&g!==void 0?g:[],w=b.indexOf(t);w>0&&(m.anchor="free",t.position===u.plot.AxisPosition.RIGHT?m.position=s.right+(w-b.length+1)*f:t.position===u.plot.AxisPosition.TOP?m.position=s.top+(w-b.length+1)*f:t.position===u.plot.AxisPosition.BOTTOM?m.position=s.bottom+(b.length-w+1)*f:t.position===u.plot.AxisPosition.LEFT&&(m.position=s.left+(b.length-w+1)*f))}else if(t.type===u.plot.AxisType.X){var _=i.get(u.plot.AxisPosition.LEFT)||[],y=i.get(u.plot.AxisPosition.RIGHT)||[],P=Math.max(s.left,s.left+(_.length-1)*o),S=Math.min(s.right-(y.length-1)*o,s.right);m.domain=[P,S]}else if(t.type===u.plot.AxisType.Y){var D=i.get(u.plot.AxisPosition.BOTTOM)||[],O=i.get(u.plot.AxisPosition.TOP)||[],M=Math.max(s.bottom,s.bottom+(D.length-1)*a),F=Math.min(s.top-(O.length-1)*a,s.top);m.domain=[M,F]}}createBoundsFromDays(e){var t=e.map(o=>this.daysOfWeek.indexOf(o)),r=this.daysOfWeek.filter(o=>!e.includes(o)).map(o=>this.daysOfWeek.indexOf(o)),i=new Set;r.forEach(o=>{for(var s=o+1;s<o+this.daysOfWeek.length;s+=1){var l=s%this.daysOfWeek.length;if(t.includes(l)){i.add(l);break}}});var a=[];return i.forEach(o=>{for(var s=o-1;s>o-this.daysOfWeek.length;s-=1){var l=s<0?s+this.daysOfWeek.length:s;if(t.includes(l)){var u=(l+1)%7;a.push([u,o]);break}}}),a}createRangeBreakValuesFromHolidays(e,t,r){var i=[],a=[];return e.forEach(o=>{o.businessPeriods.length>0?a.push(...this.createPartialHoliday(o,t,r)):i.push(this.createFullHoliday(o,t,r))}),[{values:i},...a]}createFullHoliday(e,t,r){return this.adjustDateForTimeZone("".concat(e.date.toString()," 00:00:00.000000"),t,r)}createPartialHoliday(e,t,r){var i=e.date.toString(),a=["00:00"];e.businessPeriods.forEach(m=>{a.push(m.open),a.push(m.close)}),a.push("24:00");for(var o=[],s=0;s<a.length;s+=2){var l=a[s],u=a[s+1];if(l!==u){var d=[this.adjustDateForTimeZone("".concat(i," ").concat(l,":00.000000"),t,r)],f=Om*(T.periodToDecimal(u)-T.periodToDecimal(l));o.push({values:d,dvalue:f})}}return o}adjustDateForTimeZone(e,t,r){return r&&r.standardOffset!==t.standardOffset?this.unwrapValue(this.wrapValue(e,ki,t),r):e}makeFigureSettings(e,t){var{dh:r}=this,{series:i,xAxis:a,type:o}=e,s=T.titleFromSettings(e),l={formatType:"".concat(r.plot.AxisFormatType.NUMBER),type:"".concat(r.plot.AxisType.X),position:"".concat(r.plot.AxisPosition.BOTTOM)},u={formatType:"".concat(r.plot.AxisFormatType.NUMBER),type:"".concat(r.plot.AxisType.Y),position:"".concat(r.plot.AxisPosition.LEFT)};return{charts:[{chartType:"".concat(r.plot.ChartType.XY),axes:[l,u],series:(i??[]).map(d=>({plotStyle:"".concat(o),name:d,dataSources:[{type:"".concat(r.plot.SourceType.X),columnName:a??"",axis:l,table:t},{type:"".concat(r.plot.SourceType.Y),columnName:d,axis:u,table:t}]}))}],title:s}}unwrapValue(e,t){var{dh:r}=this;if(e!=null){if(Dm(e))return r.i18n.DateTimeFormat.format(T.DATE_FORMAT,e,t);if(xm(e))return e.asNumber()}return e}wrapValue(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,{dh:i}=this;if(Ct.isDateType(t)&&typeof e=="string"){var a=e,o=T.DATE_FORMAT.substr(0,e.length),s=i.i18n.DateTimeFormat.parse(o,a);if(!r)return s;var l="".concat(o," Z"),u=i.i18n.DateTimeFormat.format("Z",s,r),d=i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(u)),f=i.i18n.DateTimeFormat.format("Z",d,r);return i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(f))}return e}makeLayoutAxis(e,t){var{dh:r}=this,i={automargin:!0,gridcolor:t.gridcolor,linecolor:t.linecolor,rangeslider:{visible:!1},showline:!0,ticklen:5,tickcolor:t.paper_bgcolor,tickfont:{color:t.zerolinecolor},title:{font:{color:t.title_color}}};return e===r.plot.AxisType.X?Object.assign(i,{showgrid:!0}):e===r.plot.AxisType.Y&&Object.assign(i,{zerolinecolor:t.zerolinecolor,zerolinewidth:2}),i}makeDefaultLayout(e){var{dh:t}=this,r=rt(rt({},e),{},{autosize:!0,colorway:T.getColorwayFromTheme(e),font:{family:"'Fira Sans', sans-serif",color:e.title_color},title:{font:{color:e.title_color},yanchor:"top",pad:rt({},T.DEFAULT_TITLE_PADDING),y:1},legend:{font:{color:e.title_color}},margin:rt({},T.DEFAULT_MARGIN),xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),polar:{angularaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),radialaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),bgcolor:e.plot_bgcolor},scene:{xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),zaxis:this.makeLayoutAxis(t.plot.AxisType.Z,e)}});return r.datarevision=0,r}hydrateSettings(e){var{dh:t}=this;return rt(rt({},e),{},{type:e.type!=null?t.plot.SeriesPlotStyle[e.type]:void 0})}}ae(T,"DEFAULT_AXIS_SIZE",.15);ae(T,"MIN_AXIS_SIZE",.025);ae(T,"MAX_AXIS_SIZE",.2);ae(T,"AXIS_SIZE_PX",75);ae(T,"LEGEND_WIDTH_PX",50);ae(T,"MAX_LEGEND_SIZE",.25);ae(T,"ORIENTATION",Object.freeze({HORIZONTAL:"h",VERTICAL:"v"}));ae(T,"DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSS");ae(T,"DEFAULT_MARGIN",Object.freeze({l:60,r:50,t:30,b:60,pad:0}));ae(T,"DEFAULT_TITLE_PADDING",Object.freeze({t:8}));ae(T,"SUBTITLE_LINE_HEIGHT",25);ae(T,"DEFAULT_MARKER_SIZE",6);ae(T,"MODE_MARKERS","markers");ae(T,"MODE_LINES","lines");const re=T;function Mm(n,e,t){return e=Nm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Nm(n){var e=Lm(n,"string");return typeof e=="symbol"?e:String(e)}function Lm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ss extends Error{constructor(){super(...arguments),Mm(this,"isDownsamplingError",!0)}}function Ui(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Wi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ui(Object(t),!0).forEach(function(r){se(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ui(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function se(n,e,t){return e=jm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jm(n){var e=Fm(n,"string");return typeof e=="symbol"?e:String(e)}function Fm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ke=B.module("Chart");class Ge extends c.Component{static convertIcon(e){var[t,,,,r]=e.icon,i="".concat(r);return{width:t,path:i,ascent:t,descent:0,transform:"matrix(1, 0, 0, 1, 0, 0)"}}static downsampleButtonTitle(e,t){return e?"Downsampling in progress...":t?"Downsampling disabled, click to enable":"Downsampling enabled, click to disable"}static downsampleButtonAttr(e,t){return e?"animation-spin":t?void 0:"fill-active"}constructor(e){var t;super(e),se(this,"currentSeries",void 0),se(this,"PlotComponent",void 0),se(this,"plot",void 0),se(this,"plotWrapper",void 0),se(this,"columnFormats",void 0),se(this,"dateTimeFormatterOptions",void 0),se(this,"decimalFormatOptions",void 0),se(this,"integerFormatOptions",void 0),se(this,"rect",void 0),se(this,"ranges",void 0),se(this,"isSubscribed",void 0),se(this,"isLoadedFired",void 0),se(this,"resizeObserver",void 0),se(this,"getCachedConfig",On((r,i,a,o,s,l)=>{var u=[],d=!!r;d&&u.push({name:"Downsampling failed: ".concat(r),title:"Downsampling failed",click:()=>{this.toggleErrorMessage("".concat(r))},icon:Ge.convertIcon(Kr),attr:"fill-warning"});var f=!!l;if(f&&u.push({name:"Error: ".concat(l),title:"Error",click:()=>{this.toggleErrorMessage("".concat(l))},icon:Ge.convertIcon(Kr),attr:"fill-warning"}),i||a||o||d){var m=Ge.downsampleButtonTitle(a,o),p=Ge.downsampleButtonAttr(a,o),v=a?Yl:ql;u.push({name:m,title:"Downsampling status",icon:Ge.convertIcon(v),click:this.handleDownsampleClick,attr:p})}var g=s.some(y=>{var{type:P}=y;return P!=null&&!P.includes("3d")}),b=s.some(y=>{var{type:P}=y;return P!=null&&P.includes("3d")}),w=["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"],_=["orbitRotation","tableRotation","resetCameraDefault3d"];return{displaylogo:!1,displayModeBar:a||d||f?!0:"hover",modeBarButtons:[u,["toImage"],["zoom2d","pan2d"],[...g?w:[],...b?_:[]]]}})),this.handleAfterPlot=this.handleAfterPlot.bind(this),this.handleDownsampleClick=this.handleDownsampleClick.bind(this),this.handleErrorClose=this.handleErrorClose.bind(this),this.handleModelEvent=this.handleModelEvent.bind(this),this.handlePlotUpdate=this.handlePlotUpdate.bind(this),this.handleRelayout=this.handleRelayout.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRestyle=this.handleRestyle.bind(this),this.PlotComponent=ws(e.Plotly),this.plot=z.createRef(),this.plotWrapper=(t=e.containerRef)!==null&&t!==void 0?t:z.createRef(),this.columnFormats=[],this.dateTimeFormatterOptions={},this.decimalFormatOptions={},this.integerFormatOptions={},this.isSubscribed=!1,this.isLoadedFired=!1,this.currentSeries=0,this.resizeObserver=new window.ResizeObserver(this.handleResize),this.state={data:null,downsamplingError:null,isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,error:null,shownError:null,layout:{datarevision:0},revision:0}}componentDidMount(){this.updateDimensions(),this.updateModelDimensions(),this.initData(),this.initFormatter();var{isActive:e,model:t}=this.props;e&&this.subscribe(t),this.plotWrapper.current!=null&&this.resizeObserver.observe(this.plotWrapper.current)}componentDidUpdate(e){var{isActive:t,model:r,settings:i}=this.props;this.updateFormatterSettings(i),r!==e.model&&(this.unsubscribe(e.model),this.subscribe(r)),t!==e.isActive&&(t?(this.updateDimensions(),this.subscribe(r)):this.unsubscribe(r))}componentWillUnmount(){var{model:e}=this.props;this.unsubscribe(e),this.resizeObserver.disconnect()}getPlotRect(){var e,t;return(e=(t=this.plotWrapper.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:null}initData(){var{model:e}=this.props,{layout:t}=this.state;this.setState({data:e.getData(),layout:Wi(Wi({},t),e.getLayout())})}subscribe(e){if(!this.isSubscribed){if(!this.rect||this.rect.width===0||this.rect.height===0){ke.debug2("Delaying subscription until model dimensions are set");return}e.subscribe(this.handleModelEvent),this.isSubscribed=!0}}unsubscribe(e){this.isSubscribed&&(e.unsubscribe(this.handleModelEvent),this.isSubscribed=!1)}handleAfterPlot(){this.plot.current!=null}handleDownsampleClick(){this.setState(e=>{var{isDownsamplingDisabled:t}=e;return{downsamplingError:null,isDownsampleInProgress:!1,isDownsampleFinished:!1,isDownsamplingDisabled:!t}},()=>{var{model:e}=this.props,{isDownsamplingDisabled:t}=this.state;e.setDownsamplingDisabled(t)})}handleErrorClose(){this.setState({shownError:null})}handleModelEvent(e){var{type:t,detail:r}=e;switch(ke.debug2("Received data update",t,r),t){case be.EVENT_UPDATED:{this.currentSeries+=1,this.setState(p=>{var{layout:v,revision:g}=p;return typeof v.datarevision=="number"&&(v.datarevision+=1),{data:r,layout:v,revision:g+1}});var{onUpdate:i}=this.props;i({isLoading:!this.isLoadedFired});break}case be.EVENT_LOADFINISHED:{var{onUpdate:a}=this.props;this.isLoadedFired=!0,a({isLoading:!1});break}case be.EVENT_DISCONNECT:{var{onDisconnect:o}=this.props;o();break}case be.EVENT_RECONNECT:{var{onReconnect:s}=this.props;s();break}case be.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case be.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case be.EVENT_DOWNSAMPLENEEDED:case be.EVENT_DOWNSAMPLEFAILED:{var l,u=(l=r.message)!==null&&l!==void 0?l:r;this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,downsamplingError:u});var{onError:d}=this.props;d(new Ss(u));break}case be.EVENT_ERROR:{var f="".concat(r);this.setState({error:f});var{onError:m}=this.props;m(new Error(f));break}default:ke.debug("Unknown event type",t,e)}}handlePlotUpdate(e){var{layout:t}=e,r=re.getLayoutRanges(t),i=!Ve(r,this.ranges);i&&(this.ranges=r,this.updateModelDimensions(!0))}handleRelayout(e){if(ke.debug("handleRelayout",e),e.hiddenlabels!=null){var{onSettingsChanged:t}=this.props,r=[...e.hiddenlabels];t({hiddenSeries:r})}this.updateModelDimensions()}handleResize(){this.updateDimensions()}handleRestyle(e){var[t,r]=e;if(ke.debug("handleRestyle",t,r),Object.keys(t).includes("visible")){var{data:i}=this.state,{onSettingsChanged:a}=this.props;if(i!=null){var o=i.reduce((s,l)=>{var{name:u,visible:d}=l;return u!=null&&d==="legendonly"?[...s,u]:s},[]);a({hiddenSeries:o})}}}toggleErrorMessage(e){this.setState(t=>{var{shownError:r}=t;return{shownError:r===e?null:e}})}updateModelDimensions(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.getPlotRect();if(!t){ke.warn("Unable to get plotting rect");return}var r=!this.rect||this.rect.width!==t.width||this.rect.height!==t.height;if(r||e){this.rect=t;var{isActive:i,model:a}=this.props;a.setDimensions(t),i&&this.subscribe(a)}}initFormatter(){var{settings:e}=this.props;this.updateFormatterSettings(e)}updateFormatterSettings(e){var t=ct.getColumnFormats(e),r=ct.getDateTimeFormatterOptions(e),{decimalFormatOptions:i={},integerFormatOptions:a={}}=e;(!Ve(this.columnFormats,t)||!Ve(this.dateTimeFormatterOptions,r)||!Ve(this.decimalFormatOptions,i)||!Ve(this.integerFormatOptions,a))&&(this.columnFormats=ct.getColumnFormats(e),this.dateTimeFormatterOptions=r,this.decimalFormatOptions=i,this.integerFormatOptions=a,this.updateFormatter())}updateFormatter(){var{model:e}=this.props,t=new an(e.dh,this.columnFormats,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions);e.setFormatter(t)}updateDimensions(){var e=this.getPlotRect(),{Plotly:t}=this.props;this.plot.current!=null&&e!=null&&e.width>0&&e.height>0&&t.relayout(this.plot.current.el,{autosize:!0}).catch(r=>{ke.debug("Unable to resize, promise rejected",r)})}render(){var{PlotComponent:e}=this,{data:t,downsamplingError:r,isDownsampleFinished:i,isDownsampleInProgress:a,isDownsamplingDisabled:o,error:s,shownError:l,layout:u,revision:d}=this.state,f=this.getCachedConfig(r,i,a,o,t??[],s),m=t!=null;return h.jsxs("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:[m&&h.jsx(e,{ref:this.plot,data:t,layout:u,revision:d,config:f,onAfterPlot:this.handleAfterPlot,onError:ke.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}}),h.jsx(rn,{className:"chart-error-popper",options:{placement:"top"},isShown:l!=null,onExited:this.handleErrorClose,closeOnBlur:!0,interactive:!0,children:l!=null&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"chart-error",children:l}),h.jsx(za,{tooltip:"Copy Error",copy:l,children:"Copy Error"})]})})]})}}se(Ge,"defaultProps",{isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:Ka.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},Plotly:dr,onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}});const Rm=Ge;function Hi(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Vi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Hi(Object(t),!0).forEach(function(r){Z(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Hi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Z(n,e,t){return e=$m(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $m(n){var e=km(n,"string");return typeof e=="symbol"?e:String(e)}function km(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var oe=B.module("FigureChartModel");class hn extends be{constructor(e,t,r){var i,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(e),i=this,Z(this,"chartUtils",void 0),Z(this,"dh",void 0),Z(this,"figure",void 0),Z(this,"settings",void 0),Z(this,"theme",void 0),Z(this,"data",void 0),Z(this,"layout",void 0),Z(this,"seriesDataMap",void 0),Z(this,"pendingSeries",void 0),Z(this,"oneClicks",void 0),Z(this,"filterColumnMap",void 0),Z(this,"lastFilter",void 0),Z(this,"isConnected",void 0),Z(this,"seriesToProcess",void 0),Z(this,"addPendingSeries",Ze(()=>{for(var s=re.getAllAxes(this.figure),{pendingSeries:l}=this,u=function(){var m,p=l[d],v=i.figure.charts.find(g=>g.series.includes(p));i.addSeries(p,s,(m=v==null?void 0:v.showLegend)!==null&&m!==void 0?m:null),p.subscribe()},d=0;d<l.length;d+=1)u();this.pendingSeries=[]},hn.ADD_SERIES_DEBOUNCE)),Z(this,"getTimeZone",st((s,l)=>{if(l!=null){var u=l.getColumnTypeFormatter(s);if(u!=null)return u.dhTimeZone}})),Z(this,"getValueTranslator",st((s,l)=>{var u=this.getTimeZone(s,l);return d=>this.chartUtils.unwrapValue(d,u)})),Z(this,"getValueParser",st((s,l)=>{var u=this.getTimeZone(s,l);return d=>this.chartUtils.wrapValue(d,s,u)})),Z(this,"getRangeParser",st((s,l)=>u=>{var[d,f]=u,m=this.getValueParser(s,l);return d=m(d),f=m(f),[d,f]})),Z(this,"getAxisRangeParser",st((s,l)=>u=>{var d=re.getSourceForAxis(s,u);return d!=null?this.getRangeParser(d.columnType,l):f=>f})),this.handleFigureUpdated=this.handleFigureUpdated.bind(this),this.handleFigureDisconnected=this.handleFigureDisconnected.bind(this),this.handleFigureReconnected=this.handleFigureReconnected.bind(this),this.handleFigureSeriesAdded=this.handleFigureSeriesAdded.bind(this),this.handleDownsampleStart=this.handleDownsampleStart.bind(this),this.handleDownsampleFinish=this.handleDownsampleFinish.bind(this),this.handleDownsampleFail=this.handleDownsampleFail.bind(this),this.handleDownsampleNeeded=this.handleDownsampleNeeded.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.dh=e,this.chartUtils=new re(e),this.figure=t,this.settings=a,this.theme=r,this.data=[];var o={data:{},layout:this.chartUtils.makeDefaultLayout(r)};this.layout={grid:{rows:t.rows,columns:t.cols,pattern:"independent"},template:o},this.seriesDataMap=new Map,this.pendingSeries=[],this.oneClicks=[],this.filterColumnMap=new Map,this.lastFilter=new Map,this.isConnected=!0,this.seriesToProcess=new Set,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure()}close(){this.figure.close(),this.addPendingSeries.cancel(),this.stopListeningFigure()}getDefaultTitle(){if(this.figure.charts.length>0){var e=this.figure.charts[0];return e.title}return""}initAllSeries(){this.oneClicks=[],this.filterColumnMap.clear();for(var{charts:e}=this.figure,t=re.getAllAxes(this.figure),r=[],i=0;i<e.length;i+=1)for(var a=e[i],o=0;o<a.series.length;o+=1){var s=a.series[o];r.push(s.name),this.addSeries(s,t,a.showLegend)}for(var l=[...this.seriesDataMap.keys()],u=l.filter(m=>r.indexOf(m)<0),d=0;d<u.length;d+=1){var f=u[d];this.seriesDataMap.delete(f)}this.seriesToProcess=new Set([...this.seriesDataMap.keys()])}addSeries(e,t,r){var{dh:i}=this,a=re.groupArray(t,"type"),o=this.chartUtils.makeSeriesDataFromSeries(e,a,re.getSeriesVisibility(e.name,this.settings),this.theme,r);if(this.seriesDataMap.set(e.name,o),this.data=[...this.seriesDataMap.values()],e.plotStyle===i.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":e.plotStyle===i.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=re.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===i.plot.SeriesPlotStyle.PIE?r??void 0:!1,e.oneClick!=null){for(var{oneClick:s}=e,{columns:l}=s,u=0;u<l.length;u+=1)this.filterColumnMap.set(l[u].name,l[u]);this.oneClicks.push(s)}this.updateLayoutFormats()}subscribe(e){super.subscribe(e),this.listeners.length===1&&(this.initAllSeries(),this.subscribeFigure())}unsubscribe(e){super.unsubscribe(e),this.listeners.length===0&&this.unsubscribeFigure()}subscribeFigure(){if(!this.isConnected){oe.debug("Ignoring subscribe when figure in disconnected state");return}this.figure.subscribe(this.isDownsamplingDisabled?this.dh.plot.DownsampleOptions.DISABLE:this.dh.plot.DownsampleOptions.DEFAULT),this.figure.errors.length>0&&(oe.error("Errors in figure",this.figure.errors),this.fireError(this.figure.errors))}unsubscribeFigure(){this.figure.unsubscribe()}startListeningFigure(){var{dh:e}=this;this.figure.addEventListener(e.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.addEventListener(e.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.addEventListener(e.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.addEventListener(e.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.addEventListener(e.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}stopListeningFigure(){var{dh:e}=this;this.figure.removeEventListener(e.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.removeEventListener(e.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.removeEventListener(e.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.removeEventListener(e.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.removeEventListener(e.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}handleDownsampleStart(e){oe.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){oe.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){oe.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){oe.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){var{detail:t}=e,{series:r}=t;oe.debug2("handleFigureUpdated",r);for(var i=0;i<r.length;i+=1){var a=r[i];oe.debug2("handleFigureUpdated updating series",a.name);for(var{sources:o}=a,s=0;s<o.length;s+=1){var l=o[s],{columnType:u,type:d}=l,f=this.getValueTranslator(u,this.formatter),m=t.getArray(a,d,f);this.setDataArrayForSeries(a,d,m)}this.seriesToProcess.delete(a.name),this.cleanSeries(a)}this.seriesToProcess.size===0&&this.fireLoadFinished();var{data:p}=this;this.fireUpdate(p)}handleRequestFailed(e){oe.error("Request failed",e),this.fireError(["".concat(e.detail)])}resubscribe(){this.listeners.length>0&&(this.unsubscribeFigure(),this.subscribeFigure())}setFormatter(e){super.setFormatter(e),this.updateLayoutFormats(),this.resubscribe()}setDownsamplingDisabled(e){super.setDownsamplingDisabled(e),this.resubscribe()}handleFigureDisconnected(e){oe.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){oe.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){var{detail:t}=e;oe.debug("handleFigureSeriesAdded",t),this.pendingSeries.push(t),this.addPendingSeries()}setDimensions(e){super.setDimensions(e),this.updateAxisPositions()}setTitle(e){var t,r;super.setTitle(e);var i=(t=(r=(e??"").match(/<br>/g))===null||r===void 0?void 0:r.length)!==null&&t!==void 0?t:0,a=re.DEFAULT_MARGIN.t+i*re.SUBTITLE_LINE_HEIGHT;this.layout.margin?this.layout.margin.t=a:this.layout.margin={t:a},typeof this.layout.title=="string"?this.layout.title=e:(this.layout.title=Vi({},this.layout.title),this.layout.title.text=e,this.layout.title.pad=Vi({},this.layout.title.pad),this.layout.title.pad.t=re.DEFAULT_TITLE_PADDING.t+i*re.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var e,t,r,i;return!this.rect||!this.rect.width?0:Math.max(this.rect.width-((e=(t=this.layout.margin)===null||t===void 0?void 0:t.l)!==null&&e!==void 0?e:0)-((r=(i=this.layout.margin)===null||i===void 0?void 0:i.r)!==null&&r!==void 0?r:0),0)}getPlotHeight(){var e,t,r,i;return!this.rect||!this.rect.height?0:Math.max(this.rect.height-((e=(t=this.layout.margin)===null||t===void 0?void 0:t.t)!==null&&e!==void 0?e:0)-((r=(i=this.layout.margin)===null||i===void 0?void 0:i.b)!==null&&r!==void 0?r:0),0)}updateAxisPositions(){var e=this.getPlotWidth(),t=this.getPlotHeight();this.chartUtils.updateFigureAxes(this.layout,this.figure,this.theme,r=>this.getAxisRangeParser(r,this.formatter),e,t)}updateLayoutFormats(){if(this.formatter){var e=this.chartUtils.getAxisFormats(this.figure,this.formatter);e.forEach((t,r)=>{oe.debug("Assigning ".concat(r),this.layout[r],t);var i=this.layout[r];i!=null?Object.assign(i,t):oe.debug("Ignoring null layout.".concat(r))})}}setDataArrayForSeries(e,t,r){var{name:i,plotStyle:a}=e,o=this.seriesDataMap.get(i),s=this.chartUtils.getPlotlyProperty(a,t);o&&Pa(o,s,r)}cleanSeries(e){var{dh:t}=this,{name:r,plotStyle:i}=e,a=this.seriesDataMap.get(r);if(a!=null){if(i===t.plot.SeriesPlotStyle.HISTOGRAM){var{xLow:o,xHigh:s}=a;if(o&&s&&o.length===s.length){for(var l=[],u=0;u<o.length;u+=1)l.push(s[u]-o[u]);a.width=l}}else if(i===t.plot.SeriesPlotStyle.LINE||i===t.plot.SeriesPlotStyle.ERROR_BAR||i===t.plot.SeriesPlotStyle.BAR){var{x:d,xLow:f,xHigh:m,y:p,yLow:v,yHigh:g}=a;f&&m&&f!==d&&(a.error_x=re.getPlotlyErrorBars(d,f,m,this.theme)),v&&g&&v!==p&&(a.error_y=re.getPlotlyErrorBars(p,v,g,this.theme))}else if(i===t.plot.SeriesPlotStyle.TREEMAP){var{ids:b,labels:w}=a;b!==void 0&&w===void 0&&(a.labels=b)}}}getData(){return this.data}getLayout(){return this.layout}getFilterColumnMap(){return new Map(this.filterColumnMap)}isFilterRequired(){return this.oneClicks.find(e=>e.requireAllFiltersToDisplay)!=null}setFilter(e){var t=this;if(this.oneClicks.length===0){oe.warn("Trying to set a filter, but no one click!");return}oe.debug("setFilter",e);for(var r=function(){var o=t.oneClicks[i],{columns:s}=o,l=new Set([...e.keys(),...t.lastFilter.keys()]);l.forEach(u=>{var d=e.get(u);t.lastFilter.get(u)!==d&&s.find(f=>f.name===u)!=null&&o.setValueForColumn(u,d)})},i=0;i<this.oneClicks.length;i+=1)r();this.lastFilter=new Map(e)}setFigure(e){this.close(),this.figure=e,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure(),this.listeners.length>0&&this.subscribeFigure()}updateSettings(e){this.settings=e}}Z(hn,"ADD_SERIES_DEBOUNCE",50);const Wn=hn;function zi(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function En(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){zi(a,r,i,o,s,"next",l)}function s(l){zi(a,r,i,o,s,"throw",l)}o(void 0)})}}class Dr{static makeModelFromSettings(e,t,r,i){return En(function*(){var a=yield Dr.makeFigureFromSettings(e,t,r);return new Wn(e,a,i,t)})()}static makeFigureFromSettings(e,t,r){return En(function*(){var i=yield r.copy();return i.applyCustomColumns(r.customColumns),i.applyFilter(r.filter),i.applySort(r.sort),e.plot.Figure.create(new re(e).makeFigureSettings(t,i))})()}static makeModel(e,t,r,i){return En(function*(){return new Wn(e,r,i,t)})()}}const Bm=Dr,Um="var(--dh-color-chart-colorway)",Wm="var(--dh-color-chart-grid)",Hm="var(--dh-color-chart-axis-line)",Vm="var(--dh-color-chart-axis-line-zero)",zm="var(--dh-color-chart-active)",Gm="var(--dh-color-chart-range-bg)",Gi={"paper-bgcolor":"var(--dh-color-chart-bg)","plot-bgcolor":"var(--dh-color-chart-plot-bg)","title-color":"var(--dh-color-chart-title)",colorway:Um,gridcolor:Wm,linecolor:Hm,zerolinecolor:Vm,activecolor:zm,rangebgcolor:Gm,"area-color":"var(--dh-color-chart-area)","trend-color":"var(--dh-color-chart-trend)","line-color":"var(--dh-color-chart-line-deprecated)","error-band-line-color":"var(--dh-color-chart-error-band-line)","error-band-fill-color":"var(--dh-color-chart-error-band-fill)","ohlc-increasing":"var(--dh-color-chart-ohlc-increase)","ohlc-decreasing":"var(--dh-color-chart-ohlc-decrease)"};var Ki=B.module("ChartTheme");function xr(){var n,e=Ba(Gi);return e.colorway=$a((n=e.colorway)!==null&&n!==void 0?n:"").map(t=>{var[r,i]=t;return Zl.normalizeCssColor(e.colorway.substring(r,i+1))}).join(" "),Ki.debug2("Chart theme:",Gi),Ki.debug2("Chart theme derived:",e),Object.freeze({paper_bgcolor:e["paper-bgcolor"],plot_bgcolor:e["plot-bgcolor"],title_color:e["title-color"],colorway:e.colorway,gridcolor:e.gridcolor,linecolor:e.linecolor,zerolinecolor:e.zerolinecolor,activecolor:e.activecolor,rangebgcolor:e.rangebgcolor,area_color:e["area-color"],trend_color:e["trend-color"],line_color:e["line-color"],error_band_line_color:e["error-band-line-color"],error_band_fill_color:e["error-band-fill-color"],ohlc_increasing:e["ohlc-increasing"],ohlc_decreasing:e["ohlc-decreasing"]})}function mt(n,e,t){return e=Km(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Km(n){var e=Xm(n,"string");return typeof e=="symbol"?e:String(e)}function Xm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class G extends be{static get theme(){return G._theme==null&&(G._theme=xr()),G._theme}static makeRandomSeries(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:100,i=[],a=[],o=[],s=[],l=new Date("2018-06-01"),u=0;u<r;u+=1){var d=new Date(l.getFullYear(),l.getMonth(),l.getDate()+u-r);i.push("".concat(d.getFullYear(),"-").concat(d.getMonth()+1,"-").concat(d.getDate()));var f=(Math.sin(u/r*e)*r/3+Math.cos(u*.2)*r/6+Math.sin(u*.5)*r/10+G.random()*r/5+u*G.smoothing)*t;f=Math.round(f*100)/100,a.push(f),s.push(40+u*G.smoothing),o.push(Math.sin(u/r*e)*r/3+G.random()*r/10+u*G.smoothing)}return{x:i,y:a,s:o,l:s}}static makeScatter(e){return{name:"SCTR",x:e.x,y:e.y,type:"scatter",mode:"markers",hoverinfo:"skip",marker:{size:5}}}static makeArea(e){return{name:"AREA",x:e.x,y:e.s,type:"scatter",mode:"line",fill:"tozeroy",hoverinfo:"all",line:{color:G.theme.area_color,width:3}}}static makeTrendline(e){return{name:"Trendline <br>R<sup>2</sup> = 0.91",x:e.x,y:e.l,type:"scatter",mode:"line",hoverinfo:"skip",line:{width:3,dash:"dot",color:G.theme.trend_color}}}static makeErrorBand(e){for(var t=[],r=[],i=0;i<e.y.length;i+=1){var a=e.y[i];t[i]=Math.round((a+18)*100)/100,r[i]=Math.round((a-18)*100)/100}var o=t.concat(r.reverse());return{name:"error",x:e.x.concat(e.x.slice().reverse()),y:o,type:"scatter",mode:"line",hoverinfo:"skip",fill:"toself",fillcolor:G.theme.error_band_fill_color,line:{width:0,color:G.theme.error_band_line_color,shape:"spline"}}}static makeLine(e){return{name:"LINE",x:e.x,y:e.y,type:"scatter",mode:"line",hoverinfo:"x+y+text+name",line:{color:G.theme.line_color,width:3}}}static makeRandomData(){var e=G.makeRandomSeries(6),t=G.makeArea(e),r=G.makeTrendline(e),i=G.makeRandomSeries(2),a=G.makeLine(i),o=G.makeErrorBand(i);return[t,r,a,o]}static makeDefaultLayout(e){var t=new re(e).makeDefaultLayout(G.theme);return t.title="Chart",t.xaxis&&(t.xaxis.title="Datestamp"),t.yaxis&&(t.yaxis.title="Price"),t}constructor(e){var{data:t=G.makeRandomData(),layout:r=G.makeDefaultLayout(e),filterFields:i=[]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(e),mt(this,"data",void 0),mt(this,"filterFields",void 0),mt(this,"layout",void 0),this.data=t,this.layout=r,this.filterFields=i}getData(){return this.data}getLayout(){return this.layout}getFilterColumnMap(){for(var e=new Map,t=0;t<this.filterFields.length;t+=1){var r=this.filterFields[t],i="java.lang.String";e.set(r,{name:r,type:i})}return e}isFilterRequired(){return this.filterFields.length>0}setFilter(){this.fireUpdate(this.data)}}mt(G,"random",Math.random.bind(Math));mt(G,"smoothing",1.5);mt(G,"_theme",void 0);const Ym=G,qm=ws(dr);var Ar=c.createContext(null);function Es(n){var{children:e}=n,{activeThemes:t}=Ro(),[r,i]=c.useState(null);return c.useEffect(()=>{t!=null&&i(xr())},[t]),h.jsx(Ar.Provider,{value:r,children:e})}function Zm(n){return n.setFigure!==void 0}function Jm(){return Qe(Ar,"No ChartThemeContext value found.")}const Qm=Object.freeze(Object.defineProperty({__proto__:null,Chart:Rm,ChartModel:be,ChartModelFactory:Bm,ChartThemeContext:Ar,ChartThemeProvider:Es,ChartUtils:re,DownsamplingError:Ss,FigureChartModel:Wn,MockChartModel:Ym,Plot:qm,defaultChartTheme:xr,isFigureChartModel:Zm,useChartTheme:Jm},Symbol.toStringTag,{value:"Module"}));var Cs=Object.freeze({openPopouts:[],settings:{hasHeaders:!0,constrainDragToContainer:!0,reorderEnabled:!0,selectionEnabled:!1,popoutWholeStack:!1,blockedPopoutsThrowError:!0,closePopoutsOnUnload:!0,showPopoutIcon:!0,showMaximiseIcon:!0,showCloseIcon:!0,responsiveMode:"onload",tabOverlapAllowance:0,tabControlOffset:10},dimensions:{borderWidth:5,borderGrabWidth:10,minItemHeight:10,minItemWidth:10,headerHeight:20,dragProxyWidth:300,dragProxyHeight:200},labels:{close:"Close",maximise:"Maximize",minimise:"Minimize",popout:"Open in new window",popin:"Pop in",tabDropdown:"Additional tabs",tabNextLabel:"Next",tabPreviousLabel:"Previous"},content:[]});function Ps(n){return n.componentName!==void 0}function ep(n){return n.component!==void 0}var Ts=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const tp=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:Cs,isGLComponentConfig:Ps,isReactComponentConfig:ep,itemDefaultConfig:Ts},Symbol.toStringTag,{value:"Module"}));function zt(n,e,t){return e=np(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function np(n){var e=rp(n,"string");return typeof e=="symbol"?e:String(e)}function rp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Tt{constructor(){zt(this,"_mSubscriptions",void 0),zt(this,"off",this.unbind),zt(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[Tt.ALL_EVENT]=[]}on(e,t,r){if(typeof t!="function")throw new Error("Tried to listen to event "+e+" with non-function callback "+t);this._mSubscriptions[e]||(this._mSubscriptions[e]=[]),this._mSubscriptions[e].push({fn:t,ctx:r})}emit(e){for(var t=this._mSubscriptions[e],r=arguments.length,i=new Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];if(t)for(var o=0;o<t.length;o++){var s=t[o].ctx||{};try{t[o].fn.apply(s,i)}catch(f){console.error("Error while emitting event:",f)}}i.unshift(e);for(var l=this._mSubscriptions[Tt.ALL_EVENT],u=0;u<l.length;u++){var d=l[u].ctx||{};try{l[u].fn.apply(d,i)}catch(f){console.error("Error while emitting event to allEventSubs:",f)}}}unbind(e,t,r){if(!this._mSubscriptions[e])throw new Error("No subscriptions to unsubscribe for event "+e);for(var i=!1,a=0;a<this._mSubscriptions[e].length;a++)(!t||this._mSubscriptions[e][a].fn===t)&&(!r||r===this._mSubscriptions[e][a].ctx)&&(this._mSubscriptions[e].splice(a,1),i=!0);if(i===!1)throw new Error("Nothing to unbind for "+e)}}zt(Tt,"ALL_EVENT","__all");const Se=Tt;function _e(n,e,t){return e=ip(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ip(n){var e=ap(n,"string");return typeof e=="symbol"?e:String(e)}function ap(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Hn extends Se{constructor(e,t,r){super(),_e(this,"width",void 0),_e(this,"height",void 0),_e(this,"title",void 0),_e(this,"parent",void 0),_e(this,"layoutManager",void 0),_e(this,"tab",void 0),_e(this,"_config",void 0),_e(this,"isHidden",!1),_e(this,"beforeCloseHandler",void 0),_e(this,"_element",A(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),_e(this,"_contentElement",void 0),this.title=Ps(e)?e.componentName:"",this.parent=t,this.layoutManager=r,this._config=e,this._contentElement=this._element.find(".lm_content"),this.beforeCloseHandler=null}getElement(){return this._contentElement}hide(){this.emit("hide"),this.isHidden=!0,this._element.hide()}show(){this.emit("show"),this.isHidden=!1,this._element.show(),(this.height!=0||this.width!=0)&&this.emit("shown")}setSize(e,t){for(var r,i,a,o=this.parent,s=null;o&&!o.isColumn&&!o.isRow;){var l;if(s=o,o=o.parent,(l=o)!==null&&l!==void 0&&l.isRoot)return!1}if(!o||!s)return!1;for(var u=o.isColumn?"height":"width",d=u==="height"?t:e,f=((r=this[u])!==null&&r!==void 0?r:0)*(1/(((i=s.config[u])!==null&&i!==void 0?i:0)/100)),m=d/f*100,p=(((a=s.config[u])!==null&&a!==void 0?a:0)-m)/(o.contentItems.length-1),v=0;v<o.contentItems.length;v++)if(o.contentItems[v]===s)o.contentItems[v].config[u]=m;else{var g;o.contentItems[v].config[u]=((g=o.contentItems[v].config[u])!==null&&g!==void 0?g:0)+p}return o.callDownwards("setSize"),!0}close(e){var t,r;this._config.isClosable&&(!((t=(r=this.beforeCloseHandler)===null||r===void 0?void 0:r.call(this,e))!==null&&t!==void 0)||t)&&(this.emit("close"),this.parent.close())}beforeClose(e){this.beforeCloseHandler=e}getState(){return this._config.componentState}extendState(e){this.setState(A.extend(!0,this.getState(),e))}setState(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")}setTitle(e){this.parent.setTitle(e)}_$setSize(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(e!==this.width||t!==this.height){this.width=e,this.height=t;var r=this._contentElement[0],i=r.offsetWidth-r.clientWidth,a=r.offsetHeight-r.clientHeight;this._contentElement.width(this.width-i).height(this.height-a),this.emit("resize")}}}const op=Object.freeze(Object.defineProperty({__proto__:null,Container:Hn,ItemContainer:Hn},Symbol.toStringTag,{value:"Module"}));function Os(n){var e=location.hash.match(new RegExp(n+"=([^&]*)"));return e?e[1]:null}function Is(n){if(window.location.hash)return Os(n);if(!window.location.search)return null;var e=window.location.search.substr(1).split("&"),t={},r,i;for(i=0;i<e.length;i++)r=e[i].split("="),t[r[0]]=r[1];return t[n]||null}function Mr(n){return window.requestAnimationFrame(n)}function sp(n,e){var t=e.indexOf(n);if(t===-1)throw new Error("Can't remove item from array. Item is not in the array");e.splice(t,1)}function Nr(){return(Math.random()*1e15).toString(36).replace(".","")}function lp(n,e){var t=n.replace(/javascript/gi,"j&#97;vascript").replace(/expression/gi,"expr&#101;ssion").replace(/onload/gi,"onlo&#97;d").replace(/script/gi,"&#115;cript").replace(/onerror/gi,"on&#101;rror");return e===!0?t:t.replace(/>/g,"&gt;").replace(/</g,"&lt;")}function Lr(n){return A.trim(n.replace(/(<([^>]+)>)/gi,""))}function he(n,e,t){return e=up(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function up(n){var e=dp(n,"string");return typeof e=="symbol"?e:String(e)}function dp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class cp extends Se{constructor(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super(),he(this,"_eElement",void 0),he(this,"_oDocument",void 0),he(this,"_eBody",void 0),he(this,"_destroyAfterMouseUp",void 0),he(this,"_nDelay",400),he(this,"_timeout",void 0),he(this,"timeout",void 0),he(this,"_nDistance",10),he(this,"_nX",0),he(this,"_nY",0),he(this,"_nOriginalX",0),he(this,"_nOriginalY",0),he(this,"_bDragging",!1),this._eElement=e,this._oDocument=A(document),this._eBody=A(document.body),this._destroyAfterMouseUp=r,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this._startDrag=this._startDrag.bind(this),(t=this._eElement)===null||t===void 0||t.on("mousedown",this.onMouseDown)}destroy(){var e,t;(e=this._eElement)===null||e===void 0||e.unbind("mousedown",this.onMouseDown),(t=this._oDocument)===null||t===void 0||t.unbind("mouseup",this.onMouseUp),this._eElement=void 0,this._oDocument=void 0,this._eBody=void 0,clearTimeout(this._timeout),this._timeout=void 0}onMouseDown(e){if(e.preventDefault(),e.button===0){var t,r,i,a,o=this._getCoordinates(e);this._nOriginalX=(t=o.x)!==null&&t!==void 0?t:0,this._nOriginalY=(r=o.y)!==null&&r!==void 0?r:0,(i=this._oDocument)===null||i===void 0||i.on("mousemove",this.onMouseMove),(a=this._oDocument)===null||a===void 0||a.on("mouseup",this.onMouseUp),this._timeout=window.setTimeout(this._startDrag,this._nDelay)}}onMouseMove(e){if(this._timeout!=null){var t,r;e.preventDefault();var i=this._getCoordinates(e);this._nX=((t=i.x)!==null&&t!==void 0?t:0)-this._nOriginalX,this._nY=((r=i.y)!==null&&r!==void 0?r:0)-this._nOriginalY,this._bDragging===!1&&(Math.abs(this._nX)>this._nDistance||Math.abs(this._nY)>this._nDistance)&&this._startDrag(),this._bDragging&&this.emit("drag",this._nX,this._nY,e)}}onMouseUp(e){if(this._timeout!=null){var t,r,i,a,o;if(clearTimeout(this._timeout),(t=this._oDocument)===null||t===void 0||t.unbind("mousemove",this.onMouseMove),(r=this._oDocument)===null||r===void 0||r.unbind("mouseup",this.onMouseUp),(i=this._oDocument)===null||i===void 0||(a=i.find("iframe"))===null||a===void 0||a.css("pointer-events",""),this._bDragging===!0&&(this._bDragging=!1,this.emit("dragStop",e,this._nOriginalX+this._nX)),(o=this._eBody)===null||o===void 0||o.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var s;(s=this._eElement)===null||s===void 0||s.removeClass("lm_dragging")}this._destroyAfterMouseUp&&this.destroy()}}_startDrag(){var e,t,r,i;window.clearTimeout(this._timeout),this._bDragging=!0,(e=this._eBody)===null||e===void 0||e.addClass("lm_dragging"),(t=this._eElement)===null||t===void 0||t.addClass("lm_dragging"),(r=this._oDocument)===null||r===void 0||(i=r.find("iframe"))===null||i===void 0||i.css("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)}_getCoordinates(e){var t,r;return{x:(t=e.pageX)!==null&&t!==void 0?t:0,y:(r=e.pageY)!==null&&r!==void 0?r:0}}}const At=cp;function it(n,e,t){return e=hp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function hp(n){var e=fp(n,"string");return typeof e=="symbol"?e:String(e)}function fp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ds{constructor(e,t){it(this,"_container",void 0),it(this,"_reactComponent",null),it(this,"_portalComponent",null),it(this,"_originalComponentWillUpdate",null),it(this,"_initialState",void 0),it(this,"_reactClass",void 0),this._reactComponent=null,this._portalComponent=null,this._originalComponentWillUpdate=null,this._container=e,this._initialState=t,this._reactClass=this._getReactClass(),this._container.on("open",this._render,this),this._container.on("destroy",this._destroy,this)}_key(){var e=this._container._config.id;if(!e)throw new Error("Cannot mount panel without id");return Array.isArray(e)?e.join(","):e}_render(){var e=this._key();this._portalComponent=Ta.createPortal(this._getReactComponent(),this._container.getElement()[0],e),this._container.layoutManager.addReactChild(e,this._portalComponent)}_gotReactComponent(e){if(e){this._reactComponent=e,this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate||function(){},this._reactComponent.componentWillUpdate=this._onUpdate.bind(this);var t=this._container.getState();t&&this._reactComponent.setState(t)}}_destroy(){this._container.layoutManager.removeReactChild(this._key(),this._portalComponent),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)}_onUpdate(e,t){var r;this._container.setState(t),(r=this._originalComponentWillUpdate)===null||r===void 0||r.call(this._reactComponent,e,t)}_getReactClass(){var e=this._container._config.component;if(!e)throw new Error("No react component name. type: react-component needs a field `component`");var t=this._container.layoutManager.getComponent(e)||this._container.layoutManager.getFallbackComponent();if(!t)throw new Error('React component "'+e+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return t}_getReactComponent(){var e={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},t=A.extend(e,this._container._config.props);return z.createElement(this._reactClass,t)}}var Jt=["settings","hasHeaders","constrainDragToContainer","selectionEnabled","dimensions","borderWidth","minItemHeight","minItemWidth","headerHeight","dragProxyWidth","dragProxyHeight","labels","close","maximise","minimise","popout","content","componentName","componentState","id","width","type","height","isClosable","title","popoutWholeStack","openPopouts","parentId","activeItemIndex","reorderEnabled","borderGrabWidth"],mp=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function jr(n){if(Jt.length>36)throw new Error("Too many keys in config minifier map");var e={};return Fr(n,e,"_min"),e}function Vn(n){if(Jt.length>36)throw new Error("Too many keys in config minifier map");var e={};return Fr(n,e,"_max"),e}function Fr(n,e,t){var r=t==="_min"?pp:vp;for(var i in n)if(n.hasOwnProperty(i)){var a=Array.isArray(n)?n[Number.parseInt(i,10)]:n[i];if(typeof a=="object"&&a!=null){var o=a instanceof Array?[]:{};if(Array.isArray(e))e[Number.parseInt(i,10)]=o;else{var s=r(i,Jt);e[s]=o}Fr(a,o,t)}else{var l=r(a,mp);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var u=r(i,Jt);e[u]=l}}}}function pp(n,e){if(typeof n=="string"&&n.length===1)return"___"+n;var t=e.indexOf(n);return t===-1?n:t.toString(36)}function vp(n,e){return typeof n=="string"&&n.length===1?e[parseInt(n,36)]:typeof n=="string"&&n.substr(0,3)==="___"?n[3]:n}function Cn(n,e,t){return e=gp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function gp(n){var e=bp(n,"string");return typeof e=="symbol"?e:String(e)}function bp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class zn{constructor(e,t){Cn(this,"name",void 0),Cn(this,"origin",void 0),Cn(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function Bt(n,e,t){return e=yp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yp(n){var e=_p(n,"string");return typeof e=="symbol"?e:String(e)}function _p(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}let wp=class extends Se{constructor(e){super(),Bt(this,"_layoutManager",void 0),Bt(this,"_dontPropagateToParent",void 0),Bt(this,"_childEventSource",void 0),Bt(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Se.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),A(window).on("gl_child_event",this._boundOnEventFromChild)}_onEventFromThis(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this._layoutManager.isSubWindow&&t[0]!==this._dontPropagateToParent&&this._propagateToParent(t),this._propagateToChildren(t),this._dontPropagateToParent=null,this._childEventSource=null}_$onEventFromParent(e){this._dontPropagateToParent=e[0],this.emit.apply(this,e)}_onEventFromChild(e){this._childEventSource=e.originalEvent.__gl,this.emit.apply(this,e.originalEvent.__glArgs)}_propagateToParent(e){var t,r="gl_child_event",i=(t=window.opener)===null||t===void 0?void 0:t.document.createEvent("HTMLEvents");i.initEvent(r,!0,!0),i.eventName=r,i.__glArgs=e,i.__gl=this._layoutManager,window.opener.dispatchEvent(i)}_propagateToChildren(e){for(var t=0;t<this._layoutManager.openPopouts.length;t++){var r=this._layoutManager.openPopouts[t].getGlInstance();r&&r!==this._childEventSource&&r.eventHub._$onEventFromParent(e)}}destroy(){A(window).off("gl_child_event",this._boundOnEventFromChild)}};const xs=wp,Sp=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:zn,DragListener:At,EventEmitter:Se,EventHub:xs,ReactComponentHandler:Ds,animFrame:Mr,filterXss:lp,getHashValue:Os,getQueryStringParam:Is,getUniqueId:Nr,minifyConfig:jr,removeFromArray:sp,stripTags:Lr,unminifyConfig:Vn},Symbol.toStringTag,{value:"Module"}));function Be(n,e,t){return e=Ep(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ep(n){var e=Cp(n,"string");return typeof e=="symbol"?e:String(e)}function Cp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class As extends Se{constructor(e,t,r,i,a){super(),Be(this,"isInitialised",!1),Be(this,"_config",void 0),Be(this,"_dimensions",void 0),Be(this,"_parentId",void 0),Be(this,"_indexInParent",void 0),Be(this,"_layoutManager",void 0),Be(this,"_popoutWindow",null),Be(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=r,this._indexInParent=i,this._layoutManager=a,this._createWindow()}toConfig(){var e,t,r,i,a,o,s,l,u,d,f;if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");return{dimensions:{width:(e=this.getGlInstance())===null||e===void 0?void 0:e.width,height:(t=this.getGlInstance())===null||t===void 0?void 0:t.height,left:(r=(i=(a=this._popoutWindow)===null||a===void 0?void 0:a.screenX)!==null&&i!==void 0?i:(o=this._popoutWindow)===null||o===void 0?void 0:o.screenLeft)!==null&&r!==void 0?r:0,top:(s=(l=(u=this._popoutWindow)===null||u===void 0?void 0:u.screenY)!==null&&l!==void 0?l:(d=this._popoutWindow)===null||d===void 0?void 0:d.screenTop)!==null&&s!==void 0?s:0},content:(f=this.getGlInstance())===null||f===void 0?void 0:f.toConfig().content,parentId:this._parentId,indexInParent:this._indexInParent}}getGlInstance(){var e;return(e=this._popoutWindow)===null||e===void 0?void 0:e.__glInstance}getWindow(){return this._popoutWindow}close(){if(this.getGlInstance()){var e;(e=this.getGlInstance())===null||e===void 0||e._$closeWindow()}else try{var t;(t=this.getWindow())===null||t===void 0||t.close()}catch{}}popIn(){var e;this._indexInParent;var t=null,r=null;if(this._parentId){var i;if(t=A.extend(!0,{},(i=this.getGlInstance())===null||i===void 0?void 0:i.toConfig()).content[0],r=this._layoutManager.root.getItemsById(this._parentId)[0],!r){var a;((a=this._layoutManager.root.contentItems.length)!==null&&a!==void 0?a:0)>0?r=this._layoutManager.root.contentItems[0]:r=this._layoutManager.root}}t&&((e=r)===null||e===void 0||e.addChild(t,this._indexInParent),this.close())}_createWindow(){var e=this._createUrl(),t=Math.floor(Math.random()*1e6).toString(36),r=this._serializeWindowOptions({width:this._dimensions.width,height:this._dimensions.height,innerWidth:this._dimensions.width,innerHeight:this._dimensions.height,menubar:"no",toolbar:"no",location:"no",personalbar:"no",resizable:"yes",scrollbars:"no",status:"no"});if(this._popoutWindow=window.open(e,t,r),!this._popoutWindow)if(this._layoutManager.config.settings.blockedPopoutsThrowError===!0){var i=new Error("Popout blocked");throw i.type="popoutBlocked",i}else return;A(this._popoutWindow).on("load",this._positionWindow.bind(this)).on("unload beforeunload",this._onClose.bind(this));var a=window.setInterval(()=>{var o;(o=this._popoutWindow)!==null&&o!==void 0&&o.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),window.clearInterval(a))},10)}_serializeWindowOptions(e){var t=[],r;for(r in e)t.push(r+"="+e[r]);return t.join(",")}_createUrl(){var e={content:this._config},t="gl-window-config-"+Nr();e=jr(e);try{localStorage.setItem(t,JSON.stringify(e))}catch(i){throw new Error("Error while writing to localStorage "+i.toString())}var r=document.location.href.split("?");return r.length===1?r[0]+"?gl-window="+t:document.location.href+"&gl-window="+t}_positionWindow(){var e,t;(e=this._popoutWindow)===null||e===void 0||e.moveTo(this._dimensions.left,this._dimensions.top),(t=this._popoutWindow)===null||t===void 0||t.focus()}_onInitialised(){var e;this.isInitialised=!0,(e=this.getGlInstance())===null||e===void 0||e.on("popIn",this.popIn,this),this.emit("initialised")}_onClose(){setTimeout(this.emit.bind(this,"closed"),50)}}function ne(n,e,t){return e=Pp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Pp(n){var e=Tp(n,"string");return typeof e=="symbol"?e:String(e)}function Tp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class nt extends Se{constructor(e,t,r,i,a,o){var s,l,u,d,f,m,p,v;if(super(),ne(this,"_dragListener",void 0),ne(this,"_layoutManager",void 0),ne(this,"_contentItem",void 0),ne(this,"_originalParent",void 0),ne(this,"_area",null),ne(this,"_lastValidArea",null),ne(this,"_minX",void 0),ne(this,"_maxX",void 0),ne(this,"_minY",void 0),ne(this,"_maxY",void 0),ne(this,"_width",void 0),ne(this,"_height",void 0),ne(this,"_sided",void 0),ne(this,"element",void 0),ne(this,"childElementContainer",void 0),ne(this,"_proxyTab",void 0),this._dragListener=r,this._layoutManager=i,this._contentItem=a,this._originalParent=o,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var g,b;this._layoutManager.tabDropPlaceholder.width((g=this._contentItem.tab.element.outerWidth(!0))!==null&&g!==void 0?g:0),this._layoutManager.tabDropPlaceholder.height((b=this._contentItem.tab.element.outerHeight(!0))!==null&&b!==void 0?b:0)}if(this.element=A(nt._template),o&&o._side&&(this._sided=o._sided,this.element.addClass("lm_"+o._side),["right","bottom"].indexOf(o._side.toString())>=0&&this.element.find(".lm_content").after(this.element.find(".lm_header"))),this.element.css({left:e,top:t}),this._proxyTab=this.element.find(".lm_tab"),this._proxyTab.attr("title",Lr((s=this._contentItem.config.title)!==null&&s!==void 0?s:"")),this.element.find(".lm_title").html((l=this._contentItem.config.title)!==null&&l!==void 0?l:""),this.childElementContainer=this.element.find(".lm_content"),this.childElementContainer.append(a.element),this._updateTree(),this._layoutManager._$calculateItemAreas(),A(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var w,_;this._layoutManager.tabDropPlaceholder.width((w=this._proxyTab.outerWidth(!0))!==null&&w!==void 0?w:0),this._layoutManager.tabDropPlaceholder.height((_=this._proxyTab.outerHeight(!0))!==null&&_!==void 0?_:0)}var y=this._layoutManager.container.offset();this._minX=(u=y==null?void 0:y.left)!==null&&u!==void 0?u:0,this._minY=(d=y==null?void 0:y.top)!==null&&d!==void 0?d:0,this._maxX=((f=this._layoutManager.container.width())!==null&&f!==void 0?f:0)+this._minX,this._maxY=((m=this._layoutManager.container.height())!==null&&m!==void 0?m:0)+this._minY,this._width=(p=this.element.width())!==null&&p!==void 0?p:0,this._height=(v=this.element.height())!==null&&v!==void 0?v:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,r){var i,a,o=(i=r.pageX)!==null&&i!==void 0?i:0,s=(a=r.pageY)!==null&&a!==void 0?a:0,l=o>this._minX&&o<this._maxX&&s>this._minY&&s<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(o,s)}_setDropPosition(e,t){this.element.css({left:e,top:t}),this._area=this._layoutManager._$getArea(e,t),this._area!==null&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(e,t,this._area))}_onDrop(){var e;(e=this._layoutManager.dropTargetIndicator)===null||e===void 0||e.hide(),this._area!==null?this._area.contentItem._$onDrop(this._contentItem,this._area):this._lastValidArea!==null?this._lastValidArea.contentItem._$onDrop(this._contentItem,this._lastValidArea):this._originalParent?this._originalParent.addChild(this._contentItem):this._contentItem._$destroy(),this._dragListener.off("drag",this._onDrag,this),this._dragListener.off("dragStop",this._onDrop,this),this.element.remove(),this._layoutManager.emit("itemDropped",this._contentItem)}_updateTree(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(null)}_setDimensions(){var e=this._layoutManager.config.dimensions,t=e.dragProxyWidth,r=e.dragProxyHeight;this.element.width(t),this.element.height(r),t-=this._sided?e.headerHeight:0,r-=this._sided?0:e.headerHeight,this.childElementContainer.width(t),this.childElementContainer.height(r),this._contentItem.element.width(t),this._contentItem.element.height(r),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}ne(nt,"_template",'<div class="lm_dragProxy"><div class="lm_header"><ul class="lm_tabs"><li class="lm_tab lm_active"><i class="lm_left"></i><span class="lm_title"></span><i class="lm_right"></i></li></ul></div><div class="lm_content"></div></div>');function Ut(n,e,t){return e=Op(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Op(n){var e=Ip(n,"string");return typeof e=="symbol"?e:String(e)}function Ip(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ms{constructor(e,t,r){Ut(this,"_element",void 0),Ut(this,"_itemConfig",void 0),Ut(this,"_layoutManager",void 0),Ut(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=r,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new At(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this),this._dragListener}_onDragStart(e,t){var r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(A.extend(!0,{},r));new nt(e,t,this._dragListener,this._layoutManager,i,null)}}function Wt(n,e,t){return e=Dp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Dp(n){var e=xp(n,"string");return typeof e=="symbol"?e:String(e)}function xp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ns{constructor(e,t,r){Wt(this,"_element",A(window)),Wt(this,"_itemConfig",void 0),Wt(this,"_layoutManager",void 0),Wt(this,"_dragListener",void 0),this._itemConfig=e,this._layoutManager=t,this._createDragListener(r)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&(this._dragListener=new At(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._destroy,this),this._dragListener.onMouseDown(e),this._dragListener._startDrag())}_destroy(){this._dragListener=void 0,this._element=void 0,this._itemConfig=void 0,this._layoutManager=void 0}_onDragStart(e,t){if(!(!this._dragListener||!this._layoutManager)){var r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(A.extend(!0,{},r));new nt(e,t,this._dragListener,this._layoutManager,i,null)}}}function Ls(n,e,t){return e=Ap(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ap(n){var e=Mp(n,"string");return typeof e=="symbol"?e:String(e)}function Mp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Mt{constructor(){Ls(this,"element",A(Mt._template)),A(document.body).append(this.element)}destroy(){this.element.remove()}highlightArea(e){this.element.css({left:e.x1,top:e.y1,width:Math.floor(e.x2-e.x1),height:Math.floor(e.y2-e.y1)}).show()}hide(){this.element.hide()}}Ls(Mt,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function Pn(n,e,t){return e=Np(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Np(n){var e=Lp(n,"string");return typeof e=="symbol"?e:String(e)}function Lp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Et{constructor(e,t,r,i){Pn(this,"element",void 0),Pn(this,"_header",void 0),Pn(this,"_action",void 0),this._header=e,this.element=A('<li class="'+r+'" title="'+t+'"></li>'),this._header.on("destroy",this._$destroy,this),this._action=i,this.element.on("click",this._action),this._header.controlsContainer.append(this.element)}_$destroy(){this.element.off(),this.element.remove()}}function jp(n,e,t){return e=Fp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fp(n){var e=Rp(n,"string");return typeof e=="symbol"?e:String(e)}function Rp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class $p extends Error{constructor(e,t){super(),jp(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const Ye=$p,kp=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:Ye},Symbol.toStringTag,{value:"Module"}));function te(n,e,t){return e=Bp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Bp(n){var e=Up(n,"string");return typeof e=="symbol"?e:String(e)}function Up(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Ot(n){return n.isStack}function ye(n){return n.isComponent}function js(n){return n.isRoot}class ie extends Se{constructor(e,t,r,i){super(),te(this,"config",void 0),te(this,"type",void 0),te(this,"contentItems",void 0),te(this,"parent",void 0),te(this,"layoutManager",void 0),te(this,"element",void 0),te(this,"childElementContainer",void 0),te(this,"componentName",void 0),te(this,"isInitialised",!1),te(this,"isMaximised",!1),te(this,"isRoot",!1),te(this,"isRow",!1),te(this,"isColumn",!1),te(this,"isStack",!1),te(this,"isComponent",!1),te(this,"tab",void 0),te(this,"_pendingEventPropagations",void 0),te(this,"_throttledEvents",void 0),this.element=i,this.config=this._extendItemNode(t),this.type=t.type,this.contentItems=[],this.parent=r,this.layoutManager=e,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(Se.ALL_EVENT,this._propagateEvent,this),t.content&&this._createContentItems(t)}callDownwards(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;r!==!0&&i!==!0&&this[e].apply(this,t);for(var a=0;a<this.contentItems.length;a++)this.contentItems[a].callDownwards(e,t,r);r===!0&&i!==!0&&this[e].apply(this,t)}removeChild(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=this.contentItems.indexOf(e);if(i===-1)throw new Error("Can't remove child item. Unknown content item");if(r!==!0&&this.contentItems[i]._$destroy(),this.contentItems.splice(i,1),(t=this.config.content)===null||t===void 0||t.splice(i,1),this.contentItems.length>0)this.callDownwards("setSize");else if(this.type!=="root"&&this.config.isClosable){var a;(a=this.parent)===null||a===void 0||a.removeChild(this)}}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.splice(t,0,e),this.config.content===void 0&&(this.config.content=[]),this.config.content.splice(t,0,e.config),e.parent=this,e.parent.isInitialised===!0&&e.isInitialised===!1&&e._$init()}replaceChild(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;t=this.layoutManager._$normalizeContentItem(t);var i=this.contentItems.indexOf(e),a=e.element[0].parentNode;if(i===-1)throw new Error("Can't replace child. oldChild is not child of this");a==null||a.replaceChild(t.element[0],e.element[0]),r===!0&&(e.parent=null,e._$destroy()),this.contentItems[i]=t,t.parent=this,Ot(this)&&(this.header.tabs[i].contentItem=t),t.parent.isInitialised===!0&&t.isInitialised===!1&&t._$init(),this.callDownwards("setSize")}remove(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}popout(){var e=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),e}toggleMaximise(e){e&&e.preventDefault(),this.isMaximised===!0?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximised=!this.isMaximised,this.emitBubblingEvent("stateChanged")}select(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))}deselect(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))}setTitle(e){this.config.title=e,this.emit("titleChanged",e),this.emitBubblingEvent("stateChanged")}hasId(e){if(this.config.id){if(typeof this.config.id=="string")return this.config.id===e;if(this.config.id instanceof Array)return this.config.id.indexOf(e)!==-1}else return!1}addId(e){this.hasId(e)||(this.config.id?typeof this.config.id=="string"?this.config.id=[this.config.id,e]:this.config.id instanceof Array&&this.config.id.push(e):this.config.id=e)}removeId(e){if(!this.hasId(e))throw new Error("Id not found");if(typeof this.config.id=="string")delete this.config.id;else if(this.config.id instanceof Array){var t=this.config.id.indexOf(e);this.config.id.splice(t,1)}}getItemsByFilter(e){var t=[],r=function i(a){for(var o=0;o<a.contentItems.length;o++)e(a.contentItems[o])===!0&&t.push(a.contentItems[o]),i(a.contentItems[o])};return r(this),t}getItemsById(e){return this.getItemsByFilter(function(t){return t.config.id instanceof Array?t.config.id.indexOf(e)!==-1:t.config.id===e})}getItemsByType(e){return this._$getItemsByProperty("type",e)}getComponentsByName(e){for(var t=this._$getItemsByProperty("componentName",e),r=[],i=0;i<t.length;i++)r.push(t[i].instance);return r}_$getItemsByProperty(e,t){return this.getItemsByFilter(function(r){return r[e]===t})}_$setParent(e){this.parent=e}_$highlightDropZone(e,t,r){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(r)}_$onDrop(e,t){this.addChild(e)}_$hide(){this._callOnActiveComponents("hide"),this.element.hide(),this.layoutManager.updateSize()}_$show(){this._callOnActiveComponents("show"),this.element.show(),this.layoutManager.updateSize()}_callOnActiveComponents(e){for(var t=this.getItemsByType("stack"),r=null,i=0;i<t.length;i++)r=t[i].getActiveContentItem(),r&&ye(r)&&r.container[e]()}_$destroy(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")}_$getArea(e){var t,r,i;e=e||this.element;var a=(t=e.offset())!==null&&t!==void 0?t:{left:0,top:0},o=(r=e.width())!==null&&r!==void 0?r:0,s=(i=e.height())!==null&&i!==void 0?i:0;return{x1:a.left,y1:a.top,x2:a.left+o,y2:a.top+s,surface:o*s,contentItem:this,side:""}}_$init(){this.setSize();for(var e=0;e<this.contentItems.length;e++){var t;(t=this.childElementContainer)===null||t===void 0||t.append(this.contentItems[e].element)}this.isInitialised=!0,this.emitBubblingEvent("itemCreated"),this.emitBubblingEvent(this.type+"Created")}emitBubblingEvent(e){var t=new zn(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new Ye("content must be an Array",e);for(var r=0;r<e.content.length;r++)t=this.layoutManager.createContentItem(e.content[r],this),this.contentItems.push(t)}_extendItemNode(e){for(var[t,r]of Object.entries(Ts)){var i=t;e[i]===void 0&&(e[i]=r)}return e}_propagateEvent(e,t){t instanceof zn&&t.isPropagationStopped===!1&&this.isInitialised===!0&&(this.isRoot===!1&&this.parent?this.parent.emit.apply(this.parent,[e,t]):this._scheduleEventPropagationToLayoutManager(e,t))}_scheduleEventPropagationToLayoutManager(e,t){this._throttledEvents.indexOf(e)===-1?this.layoutManager.emit(e,t.origin):this._pendingEventPropagations[e]!==!0&&(this._pendingEventPropagations[e]=!0,Mr(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function yt(n,e,t){return e=Wp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wp(n){var e=Hp(n,"string");return typeof e=="symbol"?e:String(e)}function Hp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Fs extends ie{constructor(e,t,r){super(e,t,r,A()),yt(this,"config",void 0),yt(this,"componentName",void 0),yt(this,"container",void 0),yt(this,"parent",void 0),yt(this,"instance",void 0),this.config=t,this.parent=r;var i=e.getComponent(this.config.componentName)||e.getFallbackComponent(),a=A.extend(!0,{},this.config.componentState||{});if(i==null)throw new Ye('Unknown component "'+this.config.componentName+'"');a.componentName=this.config.componentName,this.componentName=this.config.componentName,this.config.title===""&&(this.config.title=this.config.componentName),this.isComponent=!0,this.container=new Hn(this.config,this,e),this.instance=new i(this.container,a),this.element=this.container._element}close(){this.parent.removeChild(this)}setSize(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())}_$init(){ie.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),ie.prototype._$hide.call(this)}_$show(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),ie.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),ie.prototype._$destroy.call(this)}_$getArea(){return null}}function ve(n,e,t){return e=Vp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Vp(n){var e=zp(n,"string");return typeof e=="symbol"?e:String(e)}function zp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Qt extends ie{constructor(e,t,r,i){super(t,r,i,A('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),ve(this,"isRow",void 0),ve(this,"isColumn",void 0),ve(this,"childElementContainer",void 0),ve(this,"parent",void 0),ve(this,"_splitter",[]),ve(this,"_splitterSize",void 0),ve(this,"_splitterGrabSize",void 0),ve(this,"_isColumn",void 0),ve(this,"_dimension",void 0),ve(this,"_splitterPosition",null),ve(this,"_splitterMinPosition",null),ve(this,"_splitterMaxPosition",null),this.parent=i,this.isRow=!e,this.isColumn=e,this.childElementContainer=this.element,this._splitterSize=t.config.dimensions.borderWidth,this._splitterGrabSize=t.config.dimensions.borderGrabWidth,this._isColumn=e,this._dimension=e?"height":"width",this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null}addChild(e,t,r){var i,a,o,s;if(e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.length>0?(s=this._createSplitter(Math.max(0,t-1)).element,t>0?(this.contentItems[t-1].element.after(s),s.after(e.element)):(this.contentItems[0].element.before(s),s.before(e.element))):this.childElementContainer.append(e.element),ie.prototype.addChild.call(this,e,t),i=1/this.contentItems.length*100,r===!0){this.emitBubblingEvent("stateChanged");return}for(o=0;o<this.contentItems.length;o++)if(this.contentItems[o]===e)e.config[this._dimension]=i;else{var l;a=((l=this.contentItems[o].config[this._dimension])!==null&&l!==void 0?l:0)*(100-i)/100,this.contentItems[o].config[this._dimension]=a}this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}removeChild(e,t){var r,i=(r=e.config[this._dimension])!==null&&r!==void 0?r:0,a=this.contentItems.indexOf(e),o=Math.max(a-1,0),s,l;if(a===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[o]&&(this._splitter[o]._$destroy(),this._splitter.splice(o,1)),s=0;s<this.contentItems.length;s++)if(this.contentItems[s]!==e){var u;this.contentItems[s].config[this._dimension]=((u=this.contentItems[s].config[this._dimension])!==null&&u!==void 0?u:0)+i/(this.contentItems.length-1)}ie.prototype.removeChild.call(this,e,t),this.contentItems.length===1&&this.config.isClosable===!0?(l=this.contentItems[0],this.contentItems=[],this.parent.replaceChild(this,l,!0)):(this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged"))}replaceChild(e,t){var r=e.config[this._dimension];super.replaceChild(e,t),t.config[this._dimension]=r,this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(){this.contentItems.length>0&&(this._calculateRelativeSizes(),this._setAbsoluteSizes()),this.emitBubblingEvent("stateChanged"),this.emit("resize")}_$init(){if(this.isInitialised!==!0){var e;for(ie.prototype._$init.call(this),e=0;e<this.contentItems.length-1;e++)this.contentItems[e].element.after(this._createSplitter(e).element)}}_setAbsoluteSizes(){var e,t=this._calculateAbsoluteSizes();for(e=0;e<this.contentItems.length;e++)t.additionalPixel-e>0&&t.itemSizes[e]++,this._isColumn?(this.contentItems[e].element.width(t.totalWidth),this.contentItems[e].element.height(t.itemSizes[e])):(this.contentItems[e].element.width(t.itemSizes[e]),this.contentItems[e].element.height(t.totalHeight))}_calculateAbsoluteSizes(){var e,t,r=(this.contentItems.length-1)*this._splitterSize,i=(e=this.element.width())!==null&&e!==void 0?e:0,a=(t=this.element.height())!==null&&t!==void 0?t:0,o=0,s=[];this._isColumn?a-=r:i-=r;for(var l=0;l<this.contentItems.length;l++){var u,d,f=this._isColumn?Math.floor(a*(((u=this.contentItems[l].config.height)!==null&&u!==void 0?u:0)/100)):Math.floor(i*(((d=this.contentItems[l].config.width)!==null&&d!==void 0?d:0)/100));o+=f,s.push(f)}var m=Math.floor((this._isColumn?a:i)-o);return{itemSizes:s,additionalPixel:m,totalWidth:i,totalHeight:a}}_calculateRelativeSizes(){for(var e=0,t=[],r=this._isColumn?"height":"width",i=0;i<this.contentItems.length;i++)if(this.contentItems[i].config[r]!==void 0){var a;e+=(a=this.contentItems[i].config[r])!==null&&a!==void 0?a:0}else t.push(this.contentItems[i]);if(Math.round(e)===100){this._respectMinItemWidth();return}if(Math.round(e)<100&&t.length>0){for(var o=0;o<t.length;o++)t[o].config[r]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var s=0;s<t.length;s++)t[s].config[r]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var u;this.contentItems[l].config[r]=((u=this.contentItems[l].config[r])!==null&&u!==void 0?u:0)/e*100}this._respectMinItemWidth()}_respectMinItemWidth(){var e,t=this.layoutManager.config.dimensions&&(e=this.layoutManager.config.dimensions.minItemWidth)!==null&&e!==void 0?e:0,r=[],i=0,a=0,o=0,s=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var u=this._calculateAbsoluteSizes(),d=0;d<this.contentItems.length;d++){this.contentItems[d];var f=u.itemSizes[d];f<t?(a+=t-f,l={width:t}):(i+=f-t,l={width:f},r.push(l)),s.push(l)}if(!(a===0||a>i)){var m=a/i;o=a;for(var p=0;p<r.length;p++){l=r[p];var v=Math.round((l.width-t)*m);o-=v,l.width-=v}o!==0&&(s[s.length-1].width-=o);for(var g=0;g<this.contentItems.length;g++)this.contentItems[g].config.width=s[g].width/u.totalWidth*100}}}_createSplitter(e){var t;return t=new Rs(this._isColumn,this._splitterSize,this._splitterGrabSize),t.on("drag",this._onSplitterDrag.bind(this,t),this),t.on("dragStop",this._onSplitterDragStop.bind(this,t),this),t.on("dragStart",this._onSplitterDragStart.bind(this,t),this),this._splitter.splice(e,0,t),t}_getItemsForSplitter(e){var t=this._splitter.indexOf(e);if(t<0)throw new Error("Splitter not found in RowOrColumn");return{before:this.contentItems[t],after:this.contentItems[t+1]}}_getMinimumDimensions(e){for(var t=0,r=0,i=0;i<e.length;++i){var a,o;t=Math.max((a=e[i].minWidth)!==null&&a!==void 0?a:0,t),r=Math.max((o=e[i].minHeight)!==null&&o!==void 0?o:0,r)}return{horizontal:t,vertical:r}}_onSplitterDragStart(e){var t,r,i,a,o=this._getItemsForSplitter(e),s=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=o.before.config.content)!==null&&t!==void 0?t:[]),u=this._isColumn?l.vertical:l.horizontal,d=this._getMinimumDimensions((r=o.after.config.content)!==null&&r!==void 0?r:[]),f=this._isColumn?d.vertical:d.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((i=o.before.element[this._dimension]())!==null&&i!==void 0?i:0)-(u||s)),this._splitterMaxPosition=((a=o.after.element[this._dimension]())!==null&&a!==void 0?a:0)-(f||s)}_onSplitterDrag(e,t,r){var i=this._isColumn?r:t;this._splitterMaxPosition==null||this._splitterMinPosition==null||i>this._splitterMinPosition&&i<this._splitterMaxPosition&&(this._splitterPosition=i,e.element.css(this._isColumn?"top":"left",i))}_onSplitterDragStop(e){var t,r,i,a,o,s=this._getItemsForSplitter(e),l=(t=s.before.element[this._dimension]())!==null&&t!==void 0?t:0,u=(r=s.after.element[this._dimension]())!==null&&r!==void 0?r:0,d=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+u),f=((a=s.before.config[this._dimension])!==null&&a!==void 0?a:0)+((o=s.after.config[this._dimension])!==null&&o!==void 0?o:0);s.before.config[this._dimension]=d*f,s.after.config[this._dimension]=(1-d)*f,e.element.css({top:0,left:0}),Mr(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function Xi(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Yi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Xi(Object(t),!0).forEach(function(r){Gn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Xi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Gn(n,e,t){return e=Gp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gp(n){var e=Kp(n,"string");return typeof e=="symbol"?e:String(e)}function Kp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Kn extends ie{constructor(e,t,r){super(e,Yi(Yi({},t),{},{type:"root"}),null,A('<div class="lm_goldenlayout lm_item lm_root"></div>')),Gn(this,"childElementContainer",void 0),Gn(this,"_containerElement",void 0),this.isRoot=!0,this.type="root",this.childElementContainer=this.element,this._containerElement=r,this._containerElement.append(this.element)}addChild(e,t){if(this.contentItems.length>0)throw new Error("Root node can only have a single child");e=this.layoutManager._$normalizeContentItem(e,this),this.childElementContainer.append(e.element),super.addChild(e,t),this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(e,t){var r,i;e=typeof e>"u"?(r=this._containerElement.width())!==null&&r!==void 0?r:0:e,t=typeof t>"u"?(i=this._containerElement.height())!==null&&i!==void 0?i:0:t,this.element.width(e),this.element.height(t),this.contentItems[0]&&(this.contentItems[0].element.width(e),this.contentItems[0].element.height(t))}_$getArea(){var e=super._$getArea();if(e==null)throw new Error("Unable to get root area");return e}_$highlightDropZone(e,t,r){this.layoutManager.tabDropPlaceholder.remove(),super._$highlightDropZone(e,t,r)}_$onDrop(e,t){var r;if(ye(e)&&(r=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this),r._$init(),r.addChild(e),e=r),!this.contentItems.length)this.addChild(e);else{var{side:i}=t,a=i==="left"||i==="right"?"row":"column",o=i==="left"||i==="right"?"width":"height",s=i==="left"||i==="top",l=this.contentItems[0];if(!(l instanceof Qt)||l.type!=a){var u=this.layoutManager.createContentItem({type:a},this);this.replaceChild(l,u),u.addChild(e,s?0:void 0,!0),u.addChild(l,s?void 0:0,!0),l.config[o]=50,e.config[o]=50,u.callDownwards("setSize")}else{var d,f=l.contentItems[s?0:l.contentItems.length-1];l.addChild(e,s?0:void 0,!0),f.config[o]=((d=f.config[o])!==null&&d!==void 0?d:0)*.5,e.config[o]=f.config[o],l.callDownwards("setSize")}}}}function qi(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function at(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qi(Object(t),!0).forEach(function(r){ce(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):qi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ce(n,e,t){return e=Xp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xp(n){var e=Yp(n,"string");return typeof e=="symbol"?e:String(e)}function Yp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Xn extends ie{constructor(e,t,r){var i,a,o,s,l,u,d,f,m;super(e,t,r,A('<div class="lm_item lm_stack"></div>')),ce(this,"_activeContentItem",null),ce(this,"_header",void 0),ce(this,"childElementContainer",A('<div class="lm_items"></div>')),ce(this,"header",void 0),ce(this,"parent",void 0),ce(this,"isStack",!0),ce(this,"_dropZones",{}),ce(this,"_dropSegment",null),ce(this,"_contentAreaDimensions",null),ce(this,"_dropIndex",void 0),ce(this,"_side",void 0),ce(this,"_sided",!1),ce(this,"config",void 0),this.parent=r,this.config=t;var p=e.config;this._side=!1,this._header={show:((i=p.settings)===null||i===void 0?void 0:i.hasHeaders)&&t.hasHeaders!==!1,popout:(a=p.settings)!==null&&a!==void 0&&a.showPopoutIcon?(o=p.labels)===null||o===void 0?void 0:o.popout:void 0,maximise:(s=p.settings)!==null&&s!==void 0&&s.showMaximiseIcon?(l=p.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(u=p.settings)!==null&&u!==void 0&&u.showCloseIcon?(d=p.labels)===null||d===void 0?void 0:d.close:void 0,minimise:(f=(m=p.labels)===null||m===void 0?void 0:m.minimise)!==null&&f!==void 0?f:void 0},p.header&&(this._header=at(at({},this._header),p.header)),t.header&&(this._header=at(at({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=at(at({},this._header),t.content[0].header)),this.header=new Le(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,r,i,a,o=this._header.show&&(e=(t=this.layoutManager.config.dimensions)===null||t===void 0?void 0:t.headerHeight)!==null&&e!==void 0?e:0,s=((r=this.element.width())!==null&&r!==void 0?r:0)-(this._sided?o:0),l=((i=this.element.height())!==null&&i!==void 0?i:0)-(this._sided?0:o);for(this.childElementContainer.width(s),this.childElementContainer.height(l),a=0;a<this.contentItems.length;a++)this.contentItems[a].element.width(s).height(l);this.emit("resize"),this.emitBubblingEvent("stateChanged")}_$init(){if(this.isInitialised!==!0){this.header._attachWheelListener(),super._$init();for(var e=0;e<this.contentItems.length;e++)this.header.createTab(this.contentItems[e]),this.contentItems[e]._$hide();if(this.contentItems.length>0){var t=this.contentItems[this.config.activeItemIndex||0];if(!t)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(t)}}}setActiveContentItem(e){if(this.contentItems.indexOf(e)===-1)throw new Error("contentItem is not a child of this stack");this._activeContentItem!==null&&this._activeContentItem._$hide(),this._activeContentItem=e,this.header.setActiveContentItem(e),e._$show(),this.emit("activeContentItemChanged",e),this.layoutManager.emit("activeContentItemChanged",e),this.emitBubblingEvent("stateChanged")}getActiveContentItem(){return this.header.activeContentItem}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),super.addChild(e,t),this.childElementContainer.append(e.element),this.header.createTab(e,t),this.setActiveContentItem(e),this.callDownwards("setSize"),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}removeChild(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=this.contentItems.indexOf(e);super.removeChild(e,t),this.header.removeTab(e),this.header.activeContentItem===e&&(this.contentItems.length>0?this.setActiveContentItem(this.contentItems[Math.max(r-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}_$validateClosability(){for(var e=this.header._isClosable(),t=0,r=this.contentItems.length;t<r;t++){var i;if(!e)break;e=(i=this.contentItems[t].config.isClosable)!==null&&i!==void 0?i:!1}this.header._$setClosable(e)}_$destroy(){ie.prototype._$destroy.call(this),this.header._$destroy()}_$onDrop(e){if(this._dropSegment==="header"){this._resetHeaderDropZone(),this.addChild(e,this._dropIndex);return}if(this._dropSegment==="body"){this.addChild(e);return}var t=this._dropSegment==="top"||this._dropSegment==="bottom",r=this._dropSegment==="left"||this._dropSegment==="right",i=this._dropSegment==="top"||this._dropSegment==="left",a=t&&this.parent.isColumn||r&&this.parent.isRow,o=t?"column":"row",s=t?"height":"width";if(ye(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(a){var u,d=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?d:d+1,!0),this.config[s]=((u=this.config[s])!==null&&u!==void 0?u:0)*.5,e.config[s]=this.config[s],this.parent.callDownwards("setSize")}else{var f=this.layoutManager.createContentItem({type:o},this);this.parent.replaceChild(this,f),f.addChild(e,i?0:void 0,!0),f.addChild(this,i?void 0:0,!0),this.config[s]=50,e.config[s]=50,f.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[r,i]of Object.entries(this._contentAreaDimensions)){var a=i.hoverArea;if(a.x1<e&&a.x2>e&&a.y1<t&&a.y2>t){r==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(r));return}}}_$getArea(){if(this.element.is(":visible")===!1)return null;var e=super._$getArea(this.header.element),t=super._$getArea(this.childElementContainer);if(e==null||t==null)return null;var r=t.x2-t.x1,i=t.y2-t.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}},this._activeContentItem&&this._activeContentItem.isComponent===!1?e:this.contentItems.length===0?(this._contentAreaDimensions.body={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}},super._$getArea(this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x1+r*.25,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x1+r*.5,y2:t.y2}},this._contentAreaDimensions.top={hoverArea:{x1:t.x1+r*.25,y1:t.y1,x2:t.x1+r*.75,y2:t.y1+i*.5},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y1+i*.5}},this._contentAreaDimensions.right={hoverArea:{x1:t.x1+r*.75,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1+r*.5,y1:t.y1,x2:t.x2,y2:t.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:t.x1+r*.25,y1:t.y1+i*.5,x2:t.x1+r*.75,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1+i*.5,x2:t.x2,y2:t.y2}},super._$getArea(this.element))}_highlightHeaderDropZone(e){var t,r,i,a,o,s,l,u,d,f,m,p,v,g,b,w,_=this.header.tabs.length;if(_===0){var y,P,S,D,O,M,F,C,I=this.header.element.offset();(y=this.layoutManager.dropTargetIndicator)===null||y===void 0||y.highlightArea({x1:(P=I==null?void 0:I.left)!==null&&P!==void 0?P:0,x2:((S=I==null?void 0:I.left)!==null&&S!==void 0?S:0)+100,y1:(D=(O=this.header.element.offset())===null||O===void 0?void 0:O.top)!==null&&D!==void 0?D:0,y2:((M=(F=this.header.element.offset())===null||F===void 0?void 0:F.top)!==null&&M!==void 0?M:0)+((C=this.header.element.innerHeight())!==null&&C!==void 0?C:0)});return}var L=this.header.tabsContainer,Y=(t=L.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),J=(r=this.layoutManager.tabDropPlaceholder.get(0))===null||r===void 0?void 0:r.getBoundingClientRect();if(!(!Y||!J)){e<Y.left?e=Y.left+1:e>Y.right&&(e=Y.right-1);var $,V;if(!(J.left<e&&e<J.right)){for(var X=0;X<_;X++){var q;if($=this.header.tabs[X].element,V=(q=$.get(0))===null||q===void 0?void 0:q.getBoundingClientRect(),V&&V.left<e&&e<V.right){this._dropIndex=X;break}}if($&&V&&e<V.left+V.width*.5)$.before(this.layoutManager.tabDropPlaceholder);else if($){var le;this._dropIndex=Math.min(((le=this._dropIndex)!==null&&le!==void 0?le:0)+1,_),$.after(this.layoutManager.tabDropPlaceholder)}}var j=(i=(a=this.layoutManager.tabDropPlaceholder.offset())===null||a===void 0?void 0:a.left)!==null&&i!==void 0?i:0;j=Math.max(j,(o=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&o!==void 0?o:0);var U=j+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);U=Math.min(U,((u=(d=this.header.tabsContainer.offset())===null||d===void 0?void 0:d.left)!==null&&u!==void 0?u:0)+((f=this.header.tabsContainer.innerWidth())!==null&&f!==void 0?f:0)),(m=this.layoutManager.dropTargetIndicator)===null||m===void 0||m.highlightArea({x1:j,x2:U,y1:(p=(v=this.header.element.offset())===null||v===void 0?void 0:v.top)!==null&&p!==void 0?p:0,y2:((g=(b=this.header.element.offset())===null||b===void 0?void 0:b.top)!==null&&g!==void 0?g:0)+((w=this.header.element.innerHeight())!==null&&w!==void 0?w:0)})}}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){var e=["right","left","bottom"].some(r=>r===this._header.show)?this._header.show:void 0;if(this.header.element.toggle(!!this._header.show),!!e&&(this._side=e,this._sided=["right","left"].indexOf(this._side.toString())>=0,this.element.removeClass("lm_left lm_right lm_bottom"),this._side&&this.element.addClass("lm_"+this._side),this.element.find(".lm_header").length&&this.childElementContainer)){var t=["right","bottom"].indexOf(this._side.toString())>=0?"before":"after";this.header.element[t](this.childElementContainer),this.callDownwards("setSize")}}_highlightBodyDropZone(e){var t,r,i=(t=this._contentAreaDimensions)===null||t===void 0||(r=t[e])===null||r===void 0?void 0:r.highlightArea;if(i){var a;(a=this.layoutManager.dropTargetIndicator)===null||a===void 0||a.highlightArea(i)}this._dropSegment=e}}const qp=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:ie,Component:Fs,ContentItem:ie,Root:Kn,RowOrColumn:Qt,Stack:Xn,isComponent:ye,isRoot:js,isStack:Ot},Symbol.toStringTag,{value:"Module"}));function De(n,e,t){return e=Zp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Zp(n){var e=Jp(n,"string");return typeof e=="symbol"?e:String(e)}function Jp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Nt{constructor(e,t){var r;De(this,"header",void 0),De(this,"contentItem",void 0),De(this,"element",A(Nt._template)),De(this,"titleElement",void 0),De(this,"closeElement",void 0),De(this,"isActive",!1),De(this,"_layoutManager",void 0),De(this,"_dragListener",void 0),this.header=e,this.contentItem=t,this.titleElement=this.element.find(".lm_title"),this.closeElement=this.element.find(".lm_close_tab"),this.closeElement[t.config.isClosable?"show":"hide"](),this.setTitle(t.config.title),this.contentItem.on("titleChanged",this.setTitle,this),this._layoutManager=this.contentItem.layoutManager,(r=this._layoutManager.config.settings)!==null&&r!==void 0&&r.reorderEnabled&&t.config.reorderEnabled&&(this._dragListener=new At(this.element),this._dragListener.on("dragStart",this._onDragStart,this),this.contentItem.on("destroy",this._dragListener.destroy,this._dragListener)),this._onTabClick=this._onTabClick.bind(this),this._onCloseClick=this._onCloseClick.bind(this),this._onTabContentFocusIn=this._onTabContentFocusIn.bind(this),this._onTabContentFocusOut=this._onTabContentFocusOut.bind(this),this.element.on("click",this._onTabClick),this.element.on("auxclick",this._onTabClick),this.contentItem.config.isClosable?(this.closeElement.on("click",this._onCloseClick),this.closeElement.on("mousedown",this._onCloseMousedown)):this.closeElement.remove(),this.contentItem.tab=this,this.contentItem.emit("tab",this),this.contentItem.layoutManager.emit("tabCreated",this),ye(this.contentItem)&&(this.contentItem.container._contentElement.on("focusin",this._onTabContentFocusIn).on("focusout",this._onTabContentFocusOut),this.contentItem.container.tab=this,this.contentItem.container.emit("tab",this))}setTitle(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";this.titleElement.html(e)}setActive(e){e!==this.isActive&&(this.isActive=e,e?this.element.addClass("lm_active"):this.element.removeClass("lm_active"))}_$destroy(){this.element.off("click",this._onTabClick),this.element.off("auxclick",this._onTabClick),this.closeElement.off("click",this._onCloseClick),ye(this.contentItem)&&(this.contentItem.container._contentElement.off(),this.contentItem.container._contentElement[0].removeEventListener("click",this._onTabContentFocusIn,!0)),this._dragListener&&(this.contentItem.off("destroy",this._dragListener.destroy,this._dragListener),this._dragListener.off("dragStart",this._onDragStart),this._dragListener=void 0),this.element.remove()}_onDragStart(e,t){var r;(r=this.contentItem.parent)!==null&&r!==void 0&&r.isMaximised&&this.contentItem.parent.toggleMaximise(),this._dragListener&&new nt(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(){A(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin")}_onTabContentFocusOut(){ye(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.element.removeClass("lm_focusin")}_onTabClick(e){if(!e||e.button===0){var t,r=this.header.parent.getActiveContentItem();this.contentItem!==r&&ye(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):ye(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),ye(this.contentItem)&&this.contentItem.container.emit("tabClicked",e),this.header._hideAdditionalTabsDropdown(),(t=this.element.get(0))===null||t===void 0||t.scrollIntoView({inline:"nearest"})}else e.button===1&&this.contentItem.config.isClosable&&this._onCloseClick(e)}_onCloseClick(e){e.stopPropagation(),ye(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onCloseMousedown(e){e.stopPropagation()}}De(Nt,"_template",['<li class="lm_tab">','<span class="lm_title_before"></span>','<span class="lm_title"></span>','<div class="lm_close_tab" aria-label="Close tab"></div>',"</li>"].join(""));function k(n,e,t){return e=Qp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Qp(n){var e=ev(n,"string");return typeof e=="symbol"?e:String(e)}function ev(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Le extends Se{constructor(e,t){var r,i;super(),k(this,"layoutManager",void 0),k(this,"element",A(Le._template)),k(this,"tabsContainer",void 0),k(this,"tabDropdownContainer",void 0),k(this,"tabDropdownSearch",void 0),k(this,"tabDropdownList",null),k(this,"controlsContainer",void 0),k(this,"parent",void 0),k(this,"tabs",[]),k(this,"activeContentItem",null),k(this,"closeButton",null),k(this,"tabDropdownButton",null),k(this,"tabNextButton",A(Le._nextButtonTemplate)),k(this,"tabPreviousButton",A(Le._previousButtonTemplate)),k(this,"holdTimer",null),k(this,"rAF",null),k(this,"CLICK_TIMEOUT",500),k(this,"START_SPEED",.01),k(this,"ACCELERATION",5e-4),k(this,"PADDING",10),k(this,"SCROLL_LEFT","left"),k(this,"SCROLL_RIGHT","right"),k(this,"isDraggingTab",!1),k(this,"isOverflowing",!1),k(this,"isDropdownShown",!1),k(this,"dropdownKeyIndex",0),k(this,"_lastVisibleTabIndex",-1),k(this,"_tabControlOffset",void 0),this.layoutManager=e,(r=this.layoutManager.config.settings)!==null&&r!==void 0&&r.selectionEnabled&&(this.element.addClass("lm_selectable"),this.element.on("click",this._onHeaderClick.bind(this))),this.tabsContainer=this.element.find(".lm_tabs"),this.tabDropdownContainer=this.element.find(".lm_tabdropdown_list"),this.tabDropdownContainer.hide(),this.tabDropdownSearch=this.element.find(".lm_tabdropdown_search input"),this._handleFilterInput=this._handleFilterInput.bind(this),this._handleFilterKeydown=this._handleFilterKeydown.bind(this),this.tabDropdownSearch.on("input",this._handleFilterInput),this.tabDropdownSearch.on("keydown",this._handleFilterKeydown),this.controlsContainer=this.element.find(".lm_controls"),this.parent=t,this.parent.on("resize",this._updateTabSizes,this),this._handleItemPickedUp=this._handleItemPickedUp.bind(this),this._handleItemDropped=this._handleItemDropped.bind(this),this._handleNextMouseEnter=this._handleNextMouseEnter.bind(this),this._handleNextMouseLeave=this._handleNextMouseLeave.bind(this),this._handlePreviousMouseEnter=this._handlePreviousMouseEnter.bind(this),this._handlePreviousMouseLeave=this._handlePreviousMouseLeave.bind(this),this._handleScrollRepeat=this._handleScrollRepeat.bind(this),this._handleNextButtonMouseDown=this._handleNextButtonMouseDown.bind(this),this._handlePreviousButtonMouseDown=this._handlePreviousButtonMouseDown.bind(this),this._handleScrollButtonMouseDown=this._handleScrollButtonMouseDown.bind(this),this._handleScrollButtonMouseUp=this._handleScrollButtonMouseUp.bind(this),this._handleScrollEvent=this._handleScrollEvent.bind(this),this.tabNextButton.on("mousedown",this._handleNextButtonMouseDown),this.tabPreviousButton.on("mousedown",this._handlePreviousButtonMouseDown),this.tabsContainer.on("scroll",this._handleScrollEvent),this.layoutManager.on("itemPickedUp",this._handleItemPickedUp),this.layoutManager.on("itemDropped",this._handleItemDropped),this.tabsContainer.before(this.tabPreviousButton),this.tabPreviousButton=this.tabPreviousButton.find(">:first-child"),this.tabPreviousButton.hide(),this._showAdditionalTabsDropdown=this._showAdditionalTabsDropdown.bind(this),this._hideAdditionalTabsDropdown=this._hideAdditionalTabsDropdown.bind(this),this._tabControlOffset=(i=this.layoutManager.config.settings)===null||i===void 0?void 0:i.tabControlOffset,this._createControls()}createTab(e,t){for(var r=0;r<this.tabs.length;r++)if(this.tabs[r].contentItem===e)return;var i=new Nt(this,e);if(this.tabs.length===0){this.tabs.push(i),this.tabsContainer.append(i.element);return}t===void 0&&(t=this.tabs.length),t>0?this.tabs[t-1].element.after(i.element):this.tabs[0].element.before(i.element),this.tabs.splice(t,0,i),this._updateTabSizes()}removeTab(e){for(var t=0;t<this.tabs.length;t++)if(this.tabs[t].contentItem===e){this.tabs[t]._$destroy(),this.tabs.splice(t,1);return}throw new Error("contentItem is not controlled by this header")}setActiveContentItem(e){for(var t,r,i,a,o=0;o<this.tabs.length;o++)a=this.tabs[o].contentItem===e,this.tabs[o].setActive(a),a===!0&&(this.activeContentItem=e,this.parent.config.activeItemIndex=o);(t=this.tabs[(i=this.parent.config.activeItemIndex)!==null&&i!==void 0?i:0].element.get(0))===null||t===void 0||(r=t.scrollIntoView)===null||r===void 0||r.call(t,{inline:"nearest"}),this._hideAdditionalTabsDropdown(),this._updateTabSizes(),this.parent.emitBubblingEvent("stateChanged")}position(e){var t=this.parent._header.show;return t&&!this.parent._side&&(t="top"),e!==void 0&&this.parent._header.show!==e&&(this.parent._header.show=e,this.parent._setupHeaderPosition()),t}_attachWheelListener(){var e;(e=this.tabsContainer.get(0))===null||e===void 0||e.addEventListener("wheel",this._handleWheelEvent,{passive:!0})}_detachWheelListener(){var e;(e=this.tabsContainer.get(0))===null||e===void 0||e.removeEventListener("wheel",this._handleWheelEvent)}_handleWheelEvent(e){var t=e.currentTarget;if(t instanceof HTMLElement){var r=Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX;if(e.deltaMode===WheelEvent.DOM_DELTA_PAGE){var i;r*=(i=this.tabsContainer.innerWidth())!==null&&i!==void 0?i:1}else e.deltaMode===WheelEvent.DOM_DELTA_LINE&&(r*=100/3);t.scrollLeft+=Math.round(r)}}_handleScrollEvent(){this._checkScrollArrows()}_handleItemPickedUp(){this.isDraggingTab=!0,this.isDropdownShown&&this._hideAdditionalTabsDropdown(),this.controlsContainer.on("mouseenter",this._handleNextMouseEnter),this.tabPreviousButton.on("mouseenter",this._handlePreviousMouseEnter)}_handleItemDropped(){var e;this.isDraggingTab=!1,window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.controlsContainer.off("mouseenter",this._handleNextMouseEnter),this.controlsContainer.off("mouseleave",this._handleNextMouseLeave),this.tabPreviousButton.off("mouseenter",this._handlePreviousMouseEnter),this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextMouseEnter(){var e;this.controlsContainer.on("mouseleave",this._handleNextMouseLeave),this._handleScrollRepeat(this.SCROLL_RIGHT,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)}_handlePreviousMouseEnter(){var e;this.tabPreviousButton.on("mouseleave",this._handlePreviousMouseLeave),this._handleScrollRepeat(this.SCROLL_LEFT,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)}_handleNextMouseLeave(){var e;window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.controlsContainer.off("mouseleave",this._handleNextMouseLeave)}_handlePreviousMouseLeave(){var e;window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextButtonMouseDown(){for(var e,t=0;t<this.tabs.length;t+=1){var r,i,a,o,s;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r:0)>((a=(o=this.tabsContainer.get(0))===null||o===void 0?void 0:o.offsetWidth)!==null&&a!==void 0?a:0)+((s=this.tabsContainer.scrollLeft())!==null&&s!==void 0?s:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT);else{var l=this.tabsContainer.get(0);if(l){var u,d;l.scrollLeft=(u=(d=this.tabsContainer.get(0))===null||d===void 0?void 0:d.scrollWidth)!==null&&u!==void 0?u:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var r,i,a;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r:0)<((a=this.tabsContainer.scrollLeft())!==null&&a!==void 0?a:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT);else{var o=this.tabsContainer.get(0);o&&(o.scrollLeft=0)}}_handleScrollButtonMouseDown(e){this.holdTimer=window.setTimeout(()=>{var t;this._handleScrollRepeat(e,(t=this.tabsContainer.scrollLeft())!==null&&t!==void 0?t:0,100)},this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)}_handleScrollButtonMouseUp(){var e,t;clearTimeout((e=this.holdTimer)!==null&&e!==void 0?e:-1),this.holdTimer=null,cancelAnimationFrame((t=this.rAF)!==null&&t!==void 0?t:-1),this.rAF=null,window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)}_checkScrollArrows(){var e,t,r;this.tabsContainer.scrollLeft()===0?this.tabPreviousButton.first().prop("disabled",!0):((e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)+((t=this.tabsContainer.innerWidth())!==null&&t!==void 0?t:0)===((r=this.tabsContainer.get(0))===null||r===void 0?void 0:r.scrollWidth)?this.tabNextButton.prop("disabled",!0):(this.tabNextButton.prop("disabled",!1),this.tabPreviousButton.first().prop("disabled",!1))}_handleScrollRepeat(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3?arguments[3]:void 0,o=this.tabsContainer.get(0);if(o){var s=o.getBoundingClientRect();if(e===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(t-i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(e===this.SCROLL_RIGHT){var l,u;if(this.tabsContainer.scrollLeft(t+i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((u=this.tabsContainer.innerWidth())!==null&&u!==void 0?u:0)===o.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((r=this.rAF)!==null&&r!==void 0?r:-1),this.rAF=window.requestAnimationFrame(d=>{var f,m,p=a||d,v=d-p,g=this.START_SPEED*v+.5*this.ACCELERATION*(v*v);g=Math.min(g,(f=(m=this.tabsContainer.get(0))===null||m===void 0?void 0:m.scrollWidth)!==null&&f!==void 0?f:1/0),this._handleScrollRepeat(e,t,g,p)})}}_$setClosable(e){return this.closeButton&&this._isClosable()?(this.closeButton.element[e?"show":"hide"](),!0):!1}_$destroy(){this.emit("destroy",this);for(var e=0;e<this.tabs.length;e++)this.tabs[e]._$destroy();this._detachWheelListener(),this._handleItemDropped(),A(document).off("mouseup",this._hideAdditionalTabsDropdown),this.tabDropdownSearch.off("input",this._handleFilterInput),this.tabDropdownSearch.off("keydown",this._handleFilterKeydown),this.element.remove()}_getHeaderSetting(e){if(e in this.parent._header)return this.parent._header[e]}_createControls(){var e,t,r,i,a;if(a=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new Et(this,a,"lm_tabdropdown",this._showAdditionalTabsDropdown),this.tabDropdownButton.element.hide(),this.controlsContainer.prepend(this.tabNextButton),this.tabNextButton.hide(),this._getHeaderSetting("popout")&&(t=this._onPopoutClick.bind(this),r=this._getHeaderSetting("popout"),new Et(this,r,"lm_popout",t)),this._getHeaderSetting("maximise")){i=this.parent.toggleMaximise.bind(this.parent);var o=this._getHeaderSetting("maximise"),s=this._getHeaderSetting("minimise"),l=new Et(this,o,"lm_maximise",i);this.parent.on("maximised",function(){l.element.attr("title",s??"")}),this.parent.on("minimised",function(){l.element.attr("title",o??"")})}this._isClosable()&&(e=this.parent.remove.bind(this.parent),r=this._getHeaderSetting("close"),this.closeButton=new Et(this,r,"lm_close",e))}_showAdditionalTabsDropdown(){if(this.isDropdownShown){this._hideAdditionalTabsDropdown();return}this.tabDropdownList=this.tabsContainer.clone(!0).appendTo(this.tabDropdownContainer).children().removeClass("lm_active"),A(document.body).append(this.tabDropdownContainer),this.tabDropdownContainer.show(),this.isDropdownShown=!0,this.element.addClass("lm_dropdown_open"),this.tabDropdownSearch.val("").focus(),this.dropdownKeyIndex=0,this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active"),A(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown()}_handleFilterKeydown(e){if(e.key==="Escape"){this._hideAdditionalTabsDropdown();return}if(this.dropdownKeyIndex===-1)return;if(e.key==="Enter"||e.key===" "){this._hideAdditionalTabsDropdown(),this.tabs[this.dropdownKeyIndex]._onTabClick();return}function t(s,l,u){if(u==null||u.length<2)return-1;for(var d=(s+l+u.length)%u.length;d!==s;){if(u.eq(d).css("display")!=="none")return d;d=(d+l+u.length)%u.length}return s}if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var r,i;e.preventDefault(),(r=this.tabDropdownList)===null||r===void 0||r.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,1,this.tabDropdownList),(i=this.tabDropdownList)===null||i===void 0||i.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}else if(e.key==="ArrowUp"||e.key==="Tab"){var a,o;e.preventDefault(),(a=this.tabDropdownList)===null||a===void 0||a.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,-1,this.tabDropdownList),(o=this.tabDropdownList)===null||o===void 0||o.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_handleFilterInput(e){if(this.tabDropdownList!=null){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var t=0;t<this.tabDropdownList.length;t++){var r,i;((r=(i=this.tabs[t].contentItem.config.title)===null||i===void 0?void 0:i.toLowerCase().indexOf(e.target.value.toLowerCase()))!==null&&r!==void 0?r:-1)!==-1?(this.tabDropdownList.eq(t).css("display",""),this.dropdownKeyIndex===-1&&(this.dropdownKeyIndex=t)):this.tabDropdownList.eq(t).css("display","none")}this.dropdownKeyIndex!==-1&&this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_hideAdditionalTabsDropdown(e){var t,r;this.isDropdownShown&&(e&&(t=this.tabDropdownContainer.get(0))!==null&&t!==void 0&&t.contains(e.target)||e&&((r=this.tabDropdownButton)===null||r===void 0?void 0:r.element.get(0))===e.target||(this.element.removeClass("lm_dropdown_open"),this.tabDropdownContainer.hide(),this.isDropdownShown=!1,this.element.append(this.tabDropdownContainer),this.tabDropdownContainer.find(".lm_tabs").remove(),A(document).off("mousedown",this._hideAdditionalTabsDropdown)))}_updateAdditionalTabsDropdown(){var e,t,r,i;if(this.isDropdownShown&&!(!this.tabDropdownList||this.tabDropdownList.length==0)){var a=(e=(t=this.tabDropdownContainer.get(0))===null||t===void 0?void 0:t.scrollHeight)!==null&&e!==void 0?e:0;if(a!==0){var o=this.tabDropdownContainer[0].getBoundingClientRect(),s=(r=A(window).height())!==null&&r!==void 0?r:0,l=(i=A(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var u=this.tabDropdownButton.element[0].getBoundingClientRect(),d=a<s-u.bottom,f=!d&&u.bottom>s*.6,m=Math.min(u.left+(f?u.width:0),l-o.width-this.PADDING),p=f?Math.max(u.top-a,this.PADDING):u.bottom,v=s-p-this.PADDING;this.tabDropdownContainer.css({"max-height":v,top:p,left:m})}}}}_isClosable(){return!!(this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon)}_onPopoutClick(){if(this.layoutManager.config.settings.popoutWholeStack===!0)this.parent.popout();else{var e;(e=this.activeContentItem)===null||e===void 0||e.popout()}}_onHeaderClick(e){e.target===this.element[0]&&this.parent.select()}_updateTabSizes(){if(this.tabs.length!==0){var e=this.tabsContainer.get(0);if(this.isDropdownShown&&this._updateAdditionalTabsDropdown(),!!e){if(!this.isOverflowing&&e.scrollWidth>e.clientWidth){var t;(t=this.tabDropdownButton)===null||t===void 0||t.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0}else if(this.isOverflowing&&e.scrollWidth<=e.clientWidth){var r;(r=this.tabDropdownButton)===null||r===void 0||r.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1}this.isOverflowing&&this._checkScrollArrows()}}}}k(Le,"_template",['<div class="lm_header">','<ul class="lm_tabs"></ul>','<ul class="lm_controls"></ul>','<ul class="lm_tabdropdown_list">','<li class="lm_tabdropdown_search"><input type="text" placeholder="Find tab..."></li>',"</ul>","</div>"].join(""));k(Le,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));k(Le,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function _t(n,e,t){return e=tv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tv(n){var e=nv(n,"string");return typeof e=="symbol"?e:String(e)}function nv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Rs{constructor(e,t,r){_t(this,"_isVertical",void 0),_t(this,"_size",void 0),_t(this,"_grabSize",void 0),_t(this,"_dragListener",void 0),_t(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=r<t?t:r,this.element=this._createElement(),this._dragListener=new At(this.element)}on(e,t,r){var i;(i=this._dragListener)===null||i===void 0||i.on(e,t,r)}_$destroy(){var e;(e=this._dragListener)===null||e===void 0||e.destroy(),this._dragListener=null,this.element.remove()}_createElement(){var e=A('<div class="lm_drag_handle"></div>'),t=A('<div class="lm_splitter"></div>');t.append(e);var r=this._grabSize-this._size,i=r/2;return this._isVertical?(e.css("top",-i),e.css("height",this._size+r),t.addClass("lm_vertical"),t.height(this._size)):(e.css("left",-i),e.css("width",this._size+r),t.addClass("lm_horizontal"),t.width(this._size)),t}}const rv=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:As,DragProxy:nt,DragSource:Ms,DragSourceFromEvent:Ns,DropTargetIndicator:Mt,Header:Le,HeaderButton:Et,Splitter:Rs,Tab:Nt},Symbol.toStringTag,{value:"Module"}));var iv={config:tp,container:op,controls:rv,errors:kp,items:qp,utils:Sp};const av=iv;function Zi(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function de(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Zi(Object(t),!0).forEach(function(r){H(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Zi(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function H(n,e,t){return e=ov(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ov(n){var e=sv(n,"string");return typeof e=="symbol"?e:String(e)}function sv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class $s extends Se{static minifyConfig(e){return jr(e)}static unminifyConfig(e){return Vn(e)}constructor(e,t){super(),H(this,"isInitialised",!1),H(this,"_isFullPage",!1),H(this,"_resizeTimeoutId",void 0),H(this,"_components",{"lm-react-component":Ds}),H(this,"_fallbackComponent",void 0),H(this,"_itemAreas",[]),H(this,"_maximisedItem",null),H(this,"_maximisePlaceholder",A('<div class="lm_maximise_place"></div>')),H(this,"_creationTimeoutPassed",!1),H(this,"_subWindowsCreated",!1),H(this,"_dragSources",[]),H(this,"_updatingColumnsResponsive",!1),H(this,"_firstLoad",!0),H(this,"_reactChildMap",new Map),H(this,"_reactChildren",null),H(this,"width",null),H(this,"height",null),H(this,"root",void 0),H(this,"openPopouts",[]),H(this,"selectedItem",null),H(this,"isSubWindow",!1),H(this,"eventHub",new xs(this)),H(this,"config",void 0),H(this,"container",void 0),H(this,"_originalContainer",void 0),H(this,"dropTargetIndicator",null),H(this,"tabDropPlaceholder",A('<div class="lm_drop_tab_placeholder"></div>')),H(this,"_typeToItem",void 0),this._onResize=this._onResize.bind(this),this._onUnload=this._onUnload.bind(this),this._windowBlur=this._windowBlur.bind(this),this._windowFocus=this._windowFocus.bind(this),this.config=this._createConfig(e),this._originalContainer=t,this.container=this._getContainer(),this.isSubWindow&&A("body").css("visibility","hidden"),this._typeToItem={column:Qt.bind(this,!0),row:Qt.bind(this,!1),stack:Xn,component:Fs}}registerComponent(e,t){if(typeof t!="function"&&(t==null||t.render==null||typeof t.render!="function"))throw new Error("Please register a constructor function");if(this._components[e]!==void 0)throw new Error("Component "+e+" is already registered");this._components[e]=t;var r=()=>{if(this._components[e]===void 0)throw new Error("Component "+e+" is not registered");delete this._components[e]};return r}setFallbackComponent(e){this._fallbackComponent=e}toConfig(e){if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");if(e&&!(e instanceof ie))throw new Error("Root must be a ContentItem");var t={settings:de({},this.config.settings),dimensions:de({},this.config.dimensions),labels:de({},this.config.labels),content:[]},r=function a(o,s){for(var l in s.config)l!=="content"&&(o[l]=s.config[l]);if(o.componentName==="lm-react-component"&&(o.type="react-component"),s.contentItems.length){o.content=[];for(var u=0;u<s.contentItems.length;u++)o.content[u]={},a(o.content[u],s.contentItems[u])}};e?r(t,{contentItems:[e]}):r(t,this.root),this._$reconcilePopoutWindows(),t.openPopouts=[];for(var i=0;i<this.openPopouts.length;i++)t.openPopouts.push(this.openPopouts[i].toConfig());return t.maximisedItemId=this._maximisedItem?"__glMaximised":void 0,t}getComponent(e){return this._components[e]}getFallbackComponent(){return this._fallbackComponent}init(){if(this._subWindowsCreated===!1&&(this._createSubWindows(),this._subWindowsCreated=!0),document.readyState==="loading"||document.body===null){A(document).ready(this.init.bind(this));return}if(this.isSubWindow===!0&&this._creationTimeoutPassed===!1){setTimeout(this.init.bind(this),7),this._creationTimeoutPassed=!0;return}this.isSubWindow===!0&&this._adjustToWindowMode(),this._setContainer(),this.dropTargetIndicator=new Mt,this.updateSize(),this._create(this.config),this._bindEvents(),this.isInitialised=!0,this._adjustColumnsResponsive(),this.emit("initialised")}addReactChild(e,t){this._reactChildMap.set(e,t),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged")}removeReactChild(e,t){var r=this._reactChildMap.get(e);r===t&&(this._reactChildMap.delete(e),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged"))}getReactChildren(){return this._reactChildren}updateSize(e,t){var r,i;if(this.width=(r=e??this.container.width())!==null&&r!==void 0?r:0,this.height=(i=t??this.container.height())!==null&&i!==void 0?i:0,this.isInitialised===!0){if(this.root.callDownwards("setSize",[this.width,this.height]),this._maximisedItem){var a,o;this._maximisedItem.element.width((a=this.container.width())!==null&&a!==void 0?a:0),this._maximisedItem.element.height((o=this.container.height())!==null&&o!==void 0?o:0),this._maximisedItem.callDownwards("setSize")}this._adjustColumnsResponsive()}}destroy(){var e;this.isInitialised===!1||!this.root||(this._onUnload(),A(window).off("resize",this._onResize),A(window).off("unload beforeunload",this._onUnload),A(window).off("blur.lm").off("focus.lm"),this.root.callDownwards("_$destroy",[],!0),this.root.contentItems=[],this.tabDropPlaceholder.remove(),(e=this.dropTargetIndicator)===null||e===void 0||e.destroy(),this.eventHub.destroy(),this._dragSources.forEach(function(t){t._dragListener.destroy()}),this._dragSources=[])}createContentItem(e,t){var r,i;if(typeof e.type!="string")throw new Ye("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!this._typeToItem[e.type])throw r="Unknown type '"+e.type+"'. Valid types are "+Object.keys(this._typeToItem).join(","),new Ye(r);return e.type==="component"&&!(t instanceof Xn)&&t&&!(this.isSubWindow===!0&&t instanceof Kn)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),i=new this._typeToItem[e.type](this,e,t),i}createPopout(e,t,r,i){var a=[],o=e instanceof ie,s=this;if(o){var l;a=this.toConfig(e).content,r=Nr();for(var u=e.parent,d=e;((f=u)===null||f===void 0?void 0:f.contentItems.length)===1&&!u.isRoot;){var f;d=u,u=u.parent}if((l=u)===null||l===void 0||l.addId(r),i==null||Number.isNaN(i)){var m;i=(m=u)===null||m===void 0?void 0:m.contentItems.indexOf(d)}}else e instanceof Array?a=e:a=[e];if(!t&&o){var p,v,g,b=window.screenX||window.screenLeft,w=window.screenY||window.screenTop,_=(p=e.element.offset())!==null&&p!==void 0?p:{left:0,top:0};t={left:b+_.left,top:w+_.top,width:(v=e.element.width())!==null&&v!==void 0?v:0,height:(g=e.element.height())!==null&&g!==void 0?g:0}}if(!t&&!o&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),o&&e.remove(),!(!t||!r||i===void 0)){var y=new As(a,t,r,i,this);return y.on("initialised",function(){s.emit("windowOpened",y)}),y.on("closed",function(){s._$reconcilePopoutWindows()}),this.openPopouts.push(y),y}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var r=new Ms(e,t,this);return this._dragSources.push(r),r}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new Ns(e,this,t)}selectItem(e,t){if(this.config.settings.selectionEnabled!==!0)throw new Error("Please set selectionEnabled to true to use this feature");e!==this.selectedItem&&(this.selectedItem!==null&&this.selectedItem.deselect(),e&&t!==!0&&e.select(),this.selectedItem=e,this.emit("selectionChanged",e))}_$maximiseItem(e){var t,r;this._maximisedItem!==null&&this._$minimiseItem(this._maximisedItem),this._maximisedItem=e,this._maximisedItem.addId("__glMaximised"),e.element.addClass("lm_maximised"),e.element.after(this._maximisePlaceholder),this.root.element.prepend(e.element),e.element.width((t=this.container.width())!==null&&t!==void 0?t:0),e.element.height((r=this.container.height())!==null&&r!==void 0?r:0),e.callDownwards("setSize"),this._maximisedItem.emit("maximised"),this.emit("stateChanged")}_$minimiseItem(e){var t;e.element.removeClass("lm_maximised"),e.removeId("__glMaximised"),this._maximisePlaceholder.after(e.element),this._maximisePlaceholder.remove(),(t=e.parent)===null||t===void 0||t.callDownwards("setSize"),this._maximisedItem=null,e.emit("minimised"),this.emit("stateChanged")}_$closeWindow(){window.setTimeout(function(){window.close()},1)}_$getArea(e,t){for(var r=1/0,i=null,a=0;a<this._itemAreas.length;a++){var o=this._itemAreas[a];e>o.x1&&e<o.x2&&t>o.y1&&t<o.y2&&r>o.surface&&(r=o.surface,i=o)}return i}_$createRootItemAreas(){var e=50,t=de({},this.root._$getArea()),r=[de(de({},t),{},{side:"left",x2:t.x1+e}),de(de({},t),{},{side:"right",x1:t.x2-e}),de(de({},t),{},{side:"top",y2:t.y1+e}),de(de({},t),{},{side:"bottom",y1:t.y2-e})];r.forEach(i=>{i.surface=(i.x2-i.x1)*(i.y2-i.y1)}),this._itemAreas.push(...r)}_$calculateItemAreas(){var e=this._getAllContentItems();if(this._itemAreas=[],e.length===1){this._itemAreas.push(this.root._$getArea());return}this._$createRootItemAreas();for(var t=0;t<e.length;t++){var r=e[t];if(Ot(r)){var i=r._$getArea();if(i!==null)if(i instanceof Array)this._itemAreas=this._itemAreas.concat(i);else{var a;this._itemAreas.push(i);var o=de(de({},i),(a=i.contentItem._contentAreaDimensions)===null||a===void 0?void 0:a.header.highlightArea);o.surface=(o.x2-o.x1)*(o.y2-o.y1),this._itemAreas.push(o)}}}}_$normalizeContentItem(e,t){if(!e)throw new Error("No content item defined");if(typeof e=="function"&&(e=e()),e instanceof ie)return e;if(A.isPlainObject(e)&&e.type){var r=this.createContentItem(e,t);return r.callDownwards("_$init"),r}else throw new Error("Invalid contentItem")}_$reconcilePopoutWindows(){for(var e=[],t=0;t<this.openPopouts.length;t++){var r;((r=this.openPopouts[t].getWindow())===null||r===void 0?void 0:r.closed)===!1?e.push(this.openPopouts[t]):this.emit("windowClosed",this.openPopouts[t])}this.openPopouts.length!==e.length&&(this.emit("stateChanged"),this.openPopouts=e)}_getAllContentItems(){var e=[],t=r=>{if(e.push(r),r.contentItems instanceof Array)for(var i=0;i<r.contentItems.length;i++)t(r.contentItems[i])};return t(this.root),e}_bindEvents(){this._isFullPage&&A(window).resize(this._onResize),A(window).on("unload beforeunload",this._onUnload).on("blur.lm",this._windowBlur).on("focus.lm",this._windowFocus)}_windowBlur(){this.root.element.addClass("lm_window_blur")}_windowFocus(){this.root.element.removeClass("lm_window_blur")}_onResize(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(this.updateSize.bind(this),100)}_createConfig(e){var t,r=Is("gl-window");r&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(r)||"{}"),e=Vn(e),localStorage.removeItem(r)),e=A.extend(!0,{},Cs,e);var i=function a(o){for(var s in o){var l=o[s];s!=="props"&&typeof l=="object"&&l!=null?a(l):s==="type"&&l==="react-component"&&(o.type="component",o.componentName="lm-react-component")}};return i(e),((t=e.settings)===null||t===void 0?void 0:t.hasHeaders)===!1&&(e.dimensions.headerHeight=0),e}_adjustToWindowMode(){var e,t=A('<div class="lm_popin" title="'+this.config.labels.popin+'"><div class="lm_icon"></div><div class="lm_bg"></div></div>');t.click(()=>{this.emit("popIn")}),document.title=Lr((e=this.config.content[0].title)!==null&&e!==void 0?e:""),A("head").append(A("body link, body style, template, .gl_keep")),this.container=A("body").html("").css("visibility","visible").append(t),document.body.offsetHeight,window.__glInstance=this}_createSubWindows(){if(this.config.openPopouts)for(var e=0;e<this.config.openPopouts.length;e++){var t=this.config.openPopouts[e];this.createPopout(t.content,t.dimensions,t.parentId,t.indexInParent)}}_getContainer(){var e=this._originalContainer?A(this._originalContainer):A("body");if(e.length===0)throw new Error("GoldenLayout container not found");if(e.length>1)throw new Error("GoldenLayout more than one container element specified");return e}_setContainer(){var e=this._getContainer();e[0]===document.body&&(this._isFullPage=!0,A("html, body").css({height:"100%",margin:0,padding:0,overflow:"hidden"})),this.container=e}_create(e){var t;if(!(e.content instanceof Array))throw e.content===void 0?t="Missing setting 'content' on top level of configuration":t="Configuration parameter 'content' must be an array",new Ye(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new Ye(t,e);this.root=new Kn(this,{content:e.content},this.container),this.root.callDownwards("_$init"),e.maximisedItemId==="__glMaximised"&&this.root.getItemsById(e.maximisedItemId)[0].toggleMaximise()}_onUnload(){if(this.config.settings.closePopoutsOnUnload===!0)for(var e=0;e<this.openPopouts.length;e++)this.openPopouts[e].close()}_adjustColumnsResponsive(){if(!this._useResponsiveLayout()||this._updatingColumnsResponsive||!this.config.dimensions||!this.config.dimensions.minItemWidth||this.root.contentItems.length===0||!this.root.contentItems[0].isRow){this._firstLoad=!1;return}this._firstLoad=!1;var e=this.root.contentItems[0].contentItems.length;if(!(e<=1)){var t=this.config.dimensions.minItemWidth,r=e*t;if(!(this.width==null||r<=this.width)){this._updatingColumnsResponsive=!0;for(var i=Math.max(Math.floor(this.width/t),1),a=e-i,o=this.root.contentItems[0],s=this._findAllStackContainers()[0],l=0;l<a;l++){var u=o.contentItems[o.contentItems.length-1];this._addChildContentItemsToContainer(s,u)}this._updatingColumnsResponsive=!1}}}_useResponsiveLayout(){return this.config.settings&&(this.config.settings.responsiveMode=="always"||this.config.settings.responsiveMode=="onload"&&this._firstLoad)}_addChildContentItemsToContainer(e,t){t.type==="stack"?t.contentItems.forEach(function(r){e.addChild(r),t.removeChild(r,!0)}):t.contentItems.forEach(r=>{this._addChildContentItemsToContainer(e,r)})}_findAllStackContainers(){var e=[];return this._findAllStackContainersRecursive(e,this.root),e}_findAllStackContainersRecursive(e,t){t.contentItems.forEach(r=>{Ot(r)?e.push(r):r.isComponent||this._findAllStackContainersRecursive(e,r)})}}H($s,"__lm",av);const ks=$s,lv="_lm_dragging_27ejx_1",uv="_lm_goldenlayout_27ejx_1",dv="_lm_header_27ejx_1",cv="_lm_controls_27ejx_1",hv="_lm_tabpreviousbutton_27ejx_1",fv="_lm_tabnextbutton_27ejx_1",mv="_lm_tab_27ejx_1",pv="_lm_active_27ejx_1",vv="_lm_close_tab_27ejx_1",gv="_lm_content_27ejx_1",bv="_lm_dragProxy_27ejx_1",yv="_lm_dropTargetIndicator_27ejx_1",_v="_march_27ejx_1",wv="_lm_inner_27ejx_1",Sv="_lm_splitter_27ejx_1",Ev="_lm_selectable_27ejx_1",Cv="_lm_tabdropdown_list_27ejx_1",Pv="_lm_title_27ejx_1",Tv="_lm_title_before_27ejx_1",Ov="_lm_selected_27ejx_1",Iv="_lm_focusin_27ejx_1",Dv="_lm_window_blur_27ejx_1",xv="_lm_popout_27ejx_1",Av="_lm_maximise_27ejx_1",Mv="_lm_tabdropdown_27ejx_1",Nv="_lm_close_27ejx_1",Lv="_lm_tabdropdown_search_27ejx_1",jv="_lm_tabs_27ejx_1",Fv="_lm_keyboard_active_27ejx_1",Rv="_lm_maximised_27ejx_1",$v="_lm_items_27ejx_1",Ji={"tab-height":"28px","drag-border-width":"5px",lm_dragging:lv,lm_goldenlayout:uv,lm_header:dv,lm_controls:cv,lm_tabpreviousbutton:hv,lm_tabnextbutton:fv,lm_tab:mv,lm_active:pv,lm_close_tab:vv,lm_content:gv,lm_dragProxy:bv,lm_dropTargetIndicator:yv,march:_v,lm_inner:wv,lm_splitter:Sv,lm_selectable:Ev,lm_tabdropdown_list:Cv,lm_title:Pv,lm_title_before:Tv,lm_selected:Ov,lm_focusin:Iv,lm_window_blur:Dv,lm_popout:xv,lm_maximise:Av,lm_tabdropdown:Mv,lm_close:Nv,lm_tabdropdown_search:Lv,lm_tabs:jv,lm_keyboard_active:Fv,lm_maximised:Rv,lm_items:$v},Qi=Object.freeze({tabHeight:parseInt(Ji["tab-height"],10),dragBorderWidth:parseInt(Ji["drag-border-width"],10)});function ea(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Oe(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ea(Object(t),!0).forEach(function(r){Bs(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ea(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Bs(n,e,t){return e=kv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function kv(n){var e=Bv(n,"string");return typeof e=="symbol"?e:String(e)}function Bv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ue=B.module("LayoutUtils");function Us(n){return n.componentName!==void 0}function dt(n){var e=n;return(Us(n)&&n.componentName==="lm-react-component"||n.type==="react-component")&&e.component!==void 0}function Ht(n){return n.focus!==void 0}function ta(n){return n.type==="stack"}class N{static activateTab(e,t){var r=N.getStackForRoot(e,t,!1);if(!r){Ue.error("Could not find stack for config",t);return}var i=N.getContentItemInStack(r,t);i&&r.setActiveContentItem(i)}static isActiveTab(e,t){var r=N.getStackForRoot(e,t,!1);if(!r)return Ue.error("Could not find stack for config",t),!1;var i=N.getContentItemInStack(r,t),a=r.getActiveContentItem();return a===i}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=t?"column":"row";if(js(e)){(e.contentItems==null||e.contentItems.length===0)&&e.addChild({type:r});var i=e.contentItems[0],a=t?i.isColumn:i.isRow;if(!a){e.removeChild(i,!0),e.addChild({type:r});var o=document.activeElement;e.contentItems[0].addChild(i),o&&o.focus!=null&&o.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var s=e.contentItems[e.contentItems.length-1],l=t?s.isRow:s.isColumn;return l||(e.addChild({type:t?"row":"column"}),e.removeChild(s,!0),e.contentItems[e.contentItems.length-1].addChild(s),s=e.contentItems[e.contentItems.length-1]),this.addStack(s,!t)}static getStackForConfig(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(r&&Ot(e)&&e.contentItems.length===0)return e;if(e.contentItems==null)return null;for(var i=0;i<e.contentItems.length;i+=1){var a=e.contentItems[i];if(a.isComponent&&a.config!=null&&Gr(a.config,t))return e;var o=this.getStackForConfig(a,t,r);if(o)return o}return null}static getStackForRoot(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=this.getStackForConfig(e,t);return!o&&i&&(o=this.getStackForConfig(e,{component:t.component},a)),!o&&r&&(o=this.addStack(e)),o}static getStackForComponentTypes(e,t){for(var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=0;o<t.length;o+=1){var s=t[o],l=o===t.length-1,u=N.getStackForRoot(e,{component:s},r&&l,i,a);if(u)return u}return null}static getContentItemInStack(e,t){if(!e)return null;for(var r=0;r<e.contentItems.length;r+=1){var i=e.contentItems[r];if(i.isComponent&&i.config!=null&&Gr(i.config,t))return i}return null}static dehydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var r=[],i=0;i<e.length;i+=1){var a=e[i],{component:o,content:s}=a;if(o){var l=t(o,a);l!=null?r.push(l):Ue.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(o,'"'))}else if(s){var u=Oe(Oe({},a),{},{content:N.dehydrateLayoutConfig(s,t)});r.push(u)}else r.push(a)}return r}static getTabPoint(e){var{tab:t}=e;if(t==null)throw new Error("Cannot get tab for panel container ".concat(e));var r=t.element[0].getBoundingClientRect();return[r.left+r.width*.5,r.bottom-8]}static dropLayoutMinorChange(e){for(var t=0;t<e.length;t+=1){var r=e[t],{content:i}=r;i!==void 0?(ta(r)&&delete r.activeItemIndex,N.dropLayoutMinorChange(i)):dt(r)&&r.component==="IrisGridPanel"&&r.props.panelState!=null&&(delete r.id,r.props.panelState.irisGridState.sorts=[],r.props.panelState.irisGridState.quickFilters=[],r.props.panelState.gridState.isStuckToBottom=!1,r.props.panelState.gridState.isStuckToRight=!1)}}static isEqual(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(r){var i=N.cloneLayout(e),a=N.cloneLayout(t);return N.dropLayoutMinorChange(i),N.dropLayoutMinorChange(a),Ve(i,a)}return Ve(e,t)}static cloneLayout(e){return JSON.parse(JSON.stringify(e))}static hydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var r=[],i=0;i<e.length;i+=1){var a=e[i];if(dt(a)){var o,{component:s,props:l={}}=a;r.push(Oe(Oe({},a),{},{id:(o=a==null?void 0:a.id)!==null&&o!==void 0?o:Ce(),props:t(s,l)}))}else if(a.content!==void 0){var u=N.hydrateLayoutConfig(a.content,t);ta(a)&&a.activeItemIndex!=null&&a.activeItemIndex>=u.length&&(Ue.warn("Fixing bad activeItemIndex!",a.activeItemIndex,a),a.activeItemIndex=0),r.push(Oe(Oe({},a),{},{content:u}))}else r.push(a)}return r}static openComponent(){var{root:e,config:t,replaceExisting:r=!0,replaceConfig:i=void 0,createNewStack:a=!1,focusElement:o=void 0,dragEvent:s=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},l=document.activeElement,u=Oe({},t);if(u.id==null&&(u.id=Ce.generate()),s!=null){e==null||e.layoutManager.createDragSourceFromEvent(u,s);return}var d=i||{id:u.id,component:u.component};ze(e);var f=a?N.addStack(e):N.getStackForRoot(e,d);ze(f);var m=N.getContentItemInStack(f,d);if(o!=null){var p=g=>{Ue.debug("Component created, focusing element",o),f.off("componentCreated",p);var{element:b}=g.origin;requestAnimationFrame(()=>{N.focusElement(b[0],o)})};f.on("componentCreated",p)}if(r&&m){var v=f.contentItems.indexOf(m);f.addChild(u,v+1),f.removeChild(m),f.setActiveContentItem(f.contentItems[v])}else f.addChild(u);o==null&&l&&Ht(l)&&l.focus()}static openComponentInStack(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=document.activeElement,a={id:t.id},o=N.getContentItemInStack(e,a);if(r&&o&&e){var s=e==null?void 0:e.contentItems.indexOf(o);e.addChild(t,s+1),e.removeChild(o),e.setActiveContentItem(e.contentItems[s])}else e==null||e.addChild(t);i&&Ht(i)&&i.focus()}static closeComponent(e,t,r){var i=N.getStackForRoot(e,t,!1,!1,!1);if(!i){Ue.warn("Cannot find stack for component, ignoring close",t);return}var a=N.getContentItemInStack(i,t),o=document.activeElement;a&&(ye(a)?a.container.close(r):i.removeChild(a)),o&&document.contains(o)&&Ht(o)&&o.focus()}static renameComponent(e,t,r){var i=N.getStackForRoot(e,t,!1);if(!i){Ue.error("Could not find stack for config",t);return}var a=N.getContentItemInStack(i,t);a&&a.setTitle(r)}static cloneComponent(e,t){var r=N.getStackForRoot(e,t,!1);if(!r)return Ue.error("Could not find stack for config",t),null;var{props:i={}}=t,a=N.getPanelComponentState(t),o={type:"react-component",component:t.component,props:Oe(Oe({},i),{},{panelState:a}),title:"".concat(t.title," Copy"),id:Ce.generate()};return N.openComponentInStack(r,o),o}static getPanelComponentState(e){if(Us(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(dt(e)){var r;return(r=e.props)===null||r===void 0?void 0:r.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:Qi.tabHeight,borderWidth:Qi.dragBorderWidth,borderGrabWidth:10},settings:{showPopoutIcon:!1,showCloseIcon:!1,constrainDragToContainer:!1}}}static getRootFromContainer(e){return e.layoutManager.root}static getComponentConfigFromContainer(e){return e?e.tab!=null&&e.tab.contentItem!=null?e.tab.contentItem.config:e._config:null}static getTitleFromContainer(e){return e!=null&&e.tab!=null&&e.tab.contentItem!=null?e.tab.contentItem.config.title:null}static getTitleFromTab(e){return e!=null&&e.contentItem!=null?e.contentItem.config.title:null}static getIdFromContainer(e){var t=N.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return N.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,r=N.getComponentConfigFromContainer(t);if(r&&dt(r)){var i;return(i=r.component)!==null&&i!==void 0?i:null}return null}static getComponentName(e){var t,r,i=(t=(r=e.WrappedComponent)===null||r===void 0?void 0:r.displayName)!==null&&t!==void 0?t:e.displayName;if(i==null)throw new Error("Component displayName not defined ".concat(e));return i}static focusElement(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:N.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var r=e.querySelector(t);return r==null?null:(Ht(r)&&r.focus(),r)}static onInitialized(e){return new Promise(t=>{if(e.isInitialised){t();return}var r=()=>{e.off("initialised",r),t()};e.on("initialised",r)})}}Bs(N,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var Ws=z.forwardRef((n,e)=>{var t=N.getComponentNameFromPanel({props:n});return h.jsx("div",{ref:e,className:"panel-placeholder",children:h.jsxs("div",{children:['Component "',t,'" is not registered.']})})});Ws.displayName="PanelPlaceholder";const Q=Object.freeze({FOCUS:"PanelEvent.FOCUS",MOUNT:"PanelEvent.MOUNT",UNMOUNT:"PanelEvent.UNMOUNT",TITLE_CHANGED:"PanelEvent.TITLE_CHANGED",REOPEN:"PanelEvent.REOPEN",DELETE:"PanelEvent.DELETE",CLONED:"PanelEvent.CLONED",CLOSED:"PanelEvent.CLOSED",OPEN:"PanelEvent.OPEN",CLOSE:"PanelEvent.CLOSE",DRAGGING:"PanelEvent.DRAGGING",DROPPED:"PanelEvent.DROPPED"});function It(n){return(n==null?void 0:n.WrappedComponent)!==void 0}function Hs(n){return typeof n.id=="string"&&n.layout instanceof ks&&n.panelManager instanceof fn&&typeof n.registerComponent=="function"}function Uv(n){if(!Hs(n))throw new Error("Expected dashboard plugin props, but instead received ".concat(n))}function na(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ra(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?na(Object(t),!0).forEach(function(r){We(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):na(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function We(n,e,t){return e=Wv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wv(n){var e=Hv(n,"string");return typeof e=="symbol"?e:String(e)}function Hv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ge=B.module("PanelManager");class fn{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(s,l)=>l,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(s,l)=>l,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:new Map,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:()=>{};We(this,"layout",void 0),We(this,"hydrateComponent",void 0),We(this,"dehydrateComponent",void 0),We(this,"onPanelsUpdated",void 0),We(this,"closed",void 0),We(this,"openedMap",void 0),this.handleFocus=this.handleFocus.bind(this),this.handleMount=this.handleMount.bind(this),this.handleUnmount=this.handleUnmount.bind(this),this.handleReopen=this.handleReopen.bind(this),this.handleDeleted=this.handleDeleted.bind(this),this.handleClosed=this.handleClosed.bind(this),this.handleControlClose=this.handleControlClose.bind(this),this.layout=e,this.hydrateComponent=t,this.dehydrateComponent=r,this.onPanelsUpdated=o,this.openedMap=new Map(i),this.closed=[...a],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(Q.FOCUS,this.handleFocus),e.on(Q.MOUNT,this.handleMount),e.on(Q.UNMOUNT,this.handleUnmount),e.on(Q.REOPEN,this.handleReopen),e.on(Q.DELETE,this.handleDeleted),e.on(Q.CLOSED,this.handleClosed),e.on(Q.CLOSE,this.handleControlClose)}stopListening(){var{eventHub:e}=this.layout;e.off(Q.FOCUS,this.handleFocus),e.off(Q.MOUNT,this.handleMount),e.off(Q.UNMOUNT,this.handleUnmount),e.off(Q.REOPEN,this.handleReopen),e.off(Q.DELETE,this.handleDeleted),e.off(Q.CLOSED,this.handleClosed),e.off(Q.CLOSE,this.handleControlClose)}getClosedPanelConfigsOfType(e){return this.closed.filter(t=>t.component===e)}getOpenedPanels(){return Array.from(this.openedMap.values())}getOpenedPanelConfigs(){return this.getOpenedPanels().map(e=>{var{glContainer:t}=e.props;return N.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&dt(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,r=N.getStackForConfig(this.layout.root,{id:e});return(t=r&&N.getContentItemInStack(r,{id:e}))!==null&&t!==void 0?t:null}getLastUsedPanel(e){for(var t=this.getOpenedPanels(),r=t.length-1;r>=0;r-=1){var i=t[r];if(e==null||e(i))return i}}getLastUsedPanelOfType(e){return this.getLastUsedPanelOfTypes([e])}getLastUsedPanelOfTypes(e){return this.getLastUsedPanel(t=>e.some(r=>It(r)&&t instanceof r.WrappedComponent||!It(r)&&t instanceof r))}updatePanel(e){var t=N.getIdFromPanel(e);if(t==null){ge.error("updatePanel Panel did not have an ID",e);return}ge.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=N.getIdFromPanel(e);if(t==null){ge.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){ge.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){ge.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}ge.debug2("Removing panel ID ".concat(t," from open panels map")),this.openedMap.delete(t)}removeClosedPanelConfig(e){var t=this.closed.findIndex(r=>r===e||r.id!=null&&e.id!=null&&r.id===e.id);t>=0&&this.closed.splice(t,1)}handleFocus(e){ge.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){ge.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){ge.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}handleReopen(e,t){ge.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:r}=e,{props:i}=e;i=this.hydrateComponent(r,i);var a=ra(ra({},e),{},{props:i}),{root:o}=this.layout;N.openComponent({root:o,config:a,replaceConfig:t})}handleDeleted(e){ge.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){ge.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:r}=this.layout;N.closeComponent(r,t)}addClosedPanel(e){var t=N.getComponentConfigFromContainer(e);if(t&&dt(t)){var r=this.dehydrateComponent(t.component,t);r!=null&&this.closed.push(r)}}sendUpdate(){var{closed:e,openedMap:t}=this;this.onPanelsUpdated({closed:[...e],openedMap:new Map(t)})}}We(fn,"MAX_CLOSED_PANEL_COUNT",100);var Vv=B.module("PanelErrorBoundary");class Vs extends c.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}componentWillUnmount(){var{glContainer:e,glEventHub:t}=this.props,r=N.getIdFromContainer(e);Vv.debug("componentWillUnmount",r),t.emit(Q.CLOSED,r,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?h.jsx("div",{className:"panel-error-boundary",children:h.jsx(je,{errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e}}function ia(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function en(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ia(Object(t),!0).forEach(function(r){zv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ia(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function zv(n,e,t){return e=Gv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gv(n){var e=Kv(n,"string");return typeof e=="symbol"?e:String(e)}function Kv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Rr(n){var{props:e,componentState:t}=n,{metadata:r}=e,{panelState:i=null}=e;t&&({panelState:i}=t);var a={};return r!=null&&(a.metadata=r),i!=null&&(a.panelState=i),en(en({},n),{},{componentState:null,props:a,type:"react-component"})}function $r(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return en(en({metadata:{}},n),{},{localDashboardId:e})}function zs(n){var e=It(n)&&n.WrappedComponent.prototype!=null&&n.WrappedComponent.prototype.isReactComponent!=null||n.prototype!=null&&n.prototype.isReactComponent!=null,t=!It(n)&&"$$typeof"in n&&n.$$typeof===_l.ForwardRef;return e||t}const Xv={dehydrate:Rr,hydrate:$r};var kr=z.createContext(void 0),Yv=E.shape({on:E.func,off:E.func,isHidden:E.bool,tab:E.shape({header:E.shape({tabs:E.arrayOf(E.shape({contentItem:E.shape({})}))})}),title:E.string,setTitle:E.func,close:E.func}),Gs=E.shape({on:E.func,off:E.func,emit:E.func}),qv=E.shape({registerComponent:E.func,root:E.shape({addChild:E.func}),on:E.func,off:E.func,eventHub:Gs}),Ks=Object.freeze({Container:Yv,EventHub:Gs,Layout:qv});function He(n,e,t){c.useEffect(function(){return n.on(e,t),()=>{n.off(e,t)}},[n,e,t])}function Xs(n,e,t,r){var i,a=(i=e.COMPONENT)!==null&&i!==void 0?i:e.displayName;if(a==null)throw new Error("ComponentType must have a `COMPONENT` or `displayName` attribute.");z.useEffect(()=>{var o=n(a,e,t,r);return()=>{o()}},[e,r,t,a,n])}function Zv(n){var{dashboardProps:e,componentName:t,component:r,supportedTypes:i,hydrate:a,dehydrate:o}=n,{id:s,layout:l,registerComponent:u}=e,d=c.useCallback(f=>{var m,{dragEvent:p,fetch:v,panelId:g=Ce.generate(),widget:b}=f,{id:w,type:_}=b,y=(m=b.title)!==null&&m!==void 0?m:b.name,P=Array.isArray(i)&&i.includes(_)||_===i;if(P){var S={id:w,name:y,type:_},D={localDashboardId:s,metadata:S,fetch:v};a!=null&&(D=a(D,s));var O={type:"react-component",component:t,props:D,title:y,id:g},{root:M}=l;N.openComponent({root:M,config:O,dragEvent:p})}},[t,a,s,l,i]);Xs(u,r,a,o),He(l.eventHub,Q.OPEN,d)}function Jv(){var n=c.useContext(kr);if(n==null)throw new Error("LayoutManager not available, did you add a LayoutManagerContext.Provider to the tree?");return n}function aa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function oa(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?aa(Object(t),!0).forEach(function(r){Qv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):aa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Qv(n,e,t){return e=eg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function eg(n){var e=tg(n,"string");return typeof e=="symbol"?e:String(e)}function tg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function ng(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,i=arguments.length>1?arguments[1]:void 0;switch(i.type){case n:{var{id:a,payload:o}=i;return t&&Ve({payload:o},{payload:r[a]})?r:oa(oa({},r),{},{[a]:o})}default:return r}}}function sa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function la(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?sa(Object(t),!0).forEach(function(r){Yn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):sa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Yn(n,e,t){return e=rg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function rg(n){var e=ig(n,"string");return typeof e=="symbol"?e:String(e)}function ig(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ag{constructor(){Yn(this,"reducers",{}),Yn(this,"listener",null)}register(e,t){var r;this.reducers=la(la({},this.reducers),{},{[e]:t}),(r=this.listener)===null||r===void 0||r.call(this,this.reducers)}setListener(e){this.listener=e}}var og=new ag;const sg=og;var Br="SET_DASHBOARD_DATA";const lg=ng(Br,{},!1),Ys={dashboardData:lg};var ug=new Map,dg=Object.freeze({}),cg=Object.freeze([]),qs=n=>n.dashboardData,Lt=(n,e)=>{var t;return(t=qs(n)[e])!==null&&t!==void 0?t:dg},hg=(n,e)=>{var t;return(t=Lt(n,e).closed)!==null&&t!==void 0?t:cg},fg=(n,e)=>{var t;return(t=Lt(n,e).openedMap)!==null&&t!==void 0?t:ug};function ua(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function da(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ua(Object(t),!0).forEach(function(r){mg(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ua(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function mg(n,e,t){return e=pg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pg(n){var e=vg(n,"string");return typeof e=="symbol"?e:String(e)}function vg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Zs=(n,e)=>({type:Br,id:n,payload:e}),Js=(n,e)=>(t,r)=>t(Zs(n,da(da({},Lt(r(),n)),e)));Object.entries(Ys).map(n=>{var[e,t]=n;return sg.register(e,t)});function gg(n){var{children:e}=n;return h.jsx(h.Fragment,{children:e})}function ca(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function wt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ca(Object(t),!0).forEach(function(r){bg(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ca(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function bg(n,e,t){return e=yg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yg(n){var e=_g(n,"string");return typeof e=="symbol"?e:String(e)}function _g(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Vt=B.module("DashboardLayout"),wg=Object.freeze({}),Sg=[],ha=()=>{},fa=n=>n;function Ur(n){var e,t,{id:r,children:i,emptyDashboard:a=h.jsx("div",{children:"Dashboard is empty."}),layout:o,layoutConfig:s=Sg,onLayoutChange:l=ha,onLayoutInitialized:u=ha,hydrate:d=$r,dehydrate:f=Rr,panelWrapper:m=gg}=n,p=wl(),v=(e=Sl(x=>Lt(x,r)))!==null&&e!==void 0?e:wg,[g,b]=c.useState(!1),[w,_]=c.useState(!1),[y,P]=c.useState(),[S]=c.useState((t=v==null?void 0:v.closed)!==null&&t!==void 0?t:[]),[D,O]=c.useState(!1),[M,F]=c.useState(o.getReactChildren()),C=c.useMemo(()=>new Map,[]),I=c.useMemo(()=>new Map,[]),L=c.useCallback(function(x,R){var W,Re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:d,Hr=arguments.length>3&&arguments[3]!==void 0?arguments[3]:f;Vt.debug2("registerComponent",x,R,Re,Hr);function Vr(jt,rl){var mn=R,il=m,al=zs(mn),{glContainer:ol,glEventHub:sl}=jt;return h.jsx(Vs,{glContainer:ol,glEventHub:sl,children:h.jsx(il,wt(wt({},jt),{},{children:al?h.jsx(mn,wt(wt({},jt),{},{ref:rl})):h.jsx(mn,wt({},jt))}))})}Vr.displayName="DashboardWrapper(".concat((W=R.displayName)!==null&&W!==void 0?W:x,")");var nl=o.registerComponent(x,z.forwardRef(Vr));return C.set(x,Re),I.set(x,Hr),nl},[d,f,C,I,o,m]),Y=c.useCallback((x,R)=>{var W;return((W=C.get(x))!==null&&W!==void 0?W:fa)(R,r)},[C,r]),J=c.useCallback((x,R)=>{var W;return((W=I.get(x))!==null&&W!==void 0?W:fa)(R,r)},[I,r]),$=c.useMemo(()=>new fn(o,Y,J,new Map,S,x=>{var{closed:R,openedMap:W}=x;p(Js(r,{closed:R,openedMap:W}))}),[J,p,Y,r,S,o]),V=c.useCallback(()=>{if(!w){D||(u(),O(!0));var x=o.toConfig(),R=x.content,W=N.dehydrateLayoutConfig(R,J),Re=y==null||!N.isEqual(y,W);Vt.debug("handleLayoutStateChanged",Re,R,W),Re&&(b(o.root.contentItems.length===0),P(W),l(W),F(o.getReactChildren()))}},[J,D,w,y,o,l,u]),X=c.useCallback(x=>{var R=N.getIdFromContainer(x);o.eventHub.emit(Q.DRAGGING,R),_(!0)},[o.eventHub]),q=c.useCallback(x=>{var R=N.getIdFromContainer(x);o.eventHub.emit(Q.DROPPED,R),_(!1)},[o.eventHub]),le=c.useCallback(x=>{if(Vt.debug2("handleComponentCreated",x),!(x==null||x.config==null||x.config.component==null||x.element==null)){var R=x.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),W="".concat(R,"-component");x.element.addClass(W)}},[]),j=c.useCallback(()=>{F(o.getReactChildren())},[o]);He(o,"stateChanged",V),He(o,"itemPickedUp",X),He(o,"itemDropped",q),He(o,"componentCreated",le),He(o.eventHub,Q.TITLE_CHANGED,V),He(o,"reactChildrenChanged",j);var U=Ua(s);return c.useEffect(function(){if(U!==s&&s!==y){Vt.debug("Setting new layout content...");for(var R=N.hydrateLayoutConfig(s,Y);o.root.contentItems.length>0;)o.root.contentItems[0].remove();for(var W=0;W<R.length;W+=1)o.root.addChild(R[W]);b(o.root.contentItems.length===0)}},[Y,o,s,y,$,U]),h.jsxs(h.Fragment,{children:[g&&a,M,z.Children.map(i,x=>x!=null?z.cloneElement(x,{id:r,layout:o,panelManager:$,registerComponent:L}):null)]})}Ur.propTypes={id:E.string.isRequired,children:E.node,data:E.shape({}),emptyDashboard:E.node,layout:Ks.Layout.isRequired,layoutConfig:E.arrayOf(E.shape({})),onLayoutChange:E.func,onLayoutInitialized:E.func};function ma(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Eg(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ma(Object(t),!0).forEach(function(r){Cg(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ma(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Cg(n,e,t){return e=Pg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Pg(n){var e=Tg(n,"string");return typeof e=="symbol"?e:String(e)}function Tg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Og=100,Tn=()=>{},Ig=Object.freeze({});function pa(n){var{id:e="default",children:t,emptyDashboard:r,layoutConfig:i,layoutSettings:a=Ig,onLayoutConfigChange:o=Tn,onGoldenLayoutChange:s=Tn,onLayoutInitialized:l=Tn,fallbackComponent:u=Ws,hydrate:d,dehydrate:f,panelWrapper:m}=n,p=c.useRef(null),[v,g]=c.useState(!1),[b,w]=c.useState();c.useEffect(function(){if(!p.current){w(void 0);return}var P=Eg({},N.makeDefaultLayout());P.settings===void 0&&(P.settings={}),Object.assign(P.settings,a),P.content=[];var S=new ks(P,p.current),D=()=>{S.off("initialised",D),g(!0)};return S.on("initialised",D),u!=null&&S.setFallbackComponent(u),S.init(),w(S),s(S),()=>{S.destroy()}},[a,u,s,g,w]);var _=c.useMemo(()=>er(()=>{b!=null&&b.isInitialised&&(b==null||b.updateSize())},Og),[b]);return c.useEffect(function(){return window.addEventListener("resize",_),()=>{window.removeEventListener("resize",_)}},[_]),h.jsxs("div",{className:"dashboard-container w-100 h-100",children:[h.jsx("div",{className:"w-100 h-100",ref:p}),v&&b&&h.jsx(kr.Provider,{value:b,children:h.jsx(Ur,{emptyDashboard:r,id:e,layout:b,layoutConfig:i,onLayoutChange:o,onLayoutInitialized:l,hydrate:d,dehydrate:f,panelWrapper:m,children:t})})]})}var Dg="default";const xg=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_DASHBOARD_ID:Dg,Dashboard:pa,DashboardLayout:Ur,DashboardUtils:Xv,GLPropTypes:Ks,LayoutManagerContext:kr,LayoutUtils:N,PanelErrorBoundary:Vs,PanelEvent:Q,PanelManager:fn,SET_DASHBOARD_DATA:Br,assertIsDashboardPluginProps:Uv,canHaveRef:zs,default:pa,dehydrate:Rr,getAllDashboardsData:qs,getClosedPanelsForDashboard:hg,getDashboardData:Lt,getOpenedPanelMapForDashboard:fg,hydrate:$r,isDashboardPluginProps:Hs,isWrappedComponent:It,reducers:Ys,setDashboardData:Zs,updateDashboardData:Js,useDashboardPanel:Zv,useLayoutManager:Jv,useListener:He,usePanelRegistration:Xs},Symbol.toStringTag,{value:"Module"}));function Qs(n,e,t){return e=Ag(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ag(n){var e=Mg(n,"string");return typeof e=="symbol"?e:String(e)}function Mg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class pt{static valueForCell(e,t,r){var i="".concat(e,",").concat(t);return r!==void 0&&r&&(i="(".concat(i,")")),i}constructor(e){Qs(this,"dh",void 0),this.dh=e}makeColumn(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:pt.DEFAULT_TYPE,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return new this.dh.Column({index:r,name:e,type:t})}makeRollupTableConfig(){return new this.dh.RollupTableConfig}makeColumns(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:5,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=[],i=0;i<e;i+=1)r.push(this.makeColumn("".concat(t).concat(i),pt.DEFAULT_TYPE,i));return r}static makeUserColumnWidths(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:5,t=new Map,r=0;r<e;r+=1)t.set(r.toString(),100);return t}makeRow(e){var t=new this.dh.Row({index:e,name:"".concat(e)});return t.get=jest.fn(r=>pt.valueForCell(e,r.index)),t}makeFilter(){return new this.dh.FilterCondition}makeSort(){return new this.dh.Sort}makeTable(){var{columns:e=this.makeColumns(),size:t=1e9,sort:r=[],layoutHints:i={}}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=new this.dh.Table({columns:e,size:t,sort:r});return a.copy=jest.fn(()=>Promise.resolve(a)),a.freeze=jest.fn(()=>Promise.resolve(a)),a.layoutHints=i,a}makeTreeTable(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.makeColumns(),t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e9,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],i=new this.dh.TreeTable({columns:e,size:t,sort:r});return i.copy=jest.fn(()=>Promise.resolve(i)),i}makeInputTable(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return new this.dh.InputTable(e)}makeSubscription(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.makeTable();return new this.dh.TableViewportSubscription({table:e})}makeModel(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.makeTable(),t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,{dh:i}=this;return new Xu(i,e,t??new an(i),r)}}Qs(pt,"DEFAULT_TYPE","java.lang.String");const Ng=pt;function qe(n,e,t){return e=Lg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Lg(n){var e=jg(n,"string");return typeof e=="symbol"?e:String(e)}function jg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ie=B.module("TableViewportUpdater"),Fg=150;class Me extends c.PureComponent{constructor(){super(...arguments),qe(this,"subscription",void 0),qe(this,"getViewportRowRange",On((e,t,r)=>{var i=r-t,a=Math.max(0,t-i*Me.ROW_BUFFER_PAGES),o=r+i*Me.ROW_BUFFER_PAGES;return[a,o]})),qe(this,"getViewportColumns",On((e,t,r,i)=>{if(t==null||r==null)return null;for(var a=r-t,o=Math.max(0,t-a*Me.COLUMN_BUFFER_PAGES),s=Math.min(r+a*Me.COLUMN_BUFFER_PAGES,e.columns.length-1),l=[],u=o;u<=s;u+=1){var d=Yu.getModelIndex(u,i);l.push(e.columns[d])}return l})),qe(this,"updateViewport",er((e,t,r,i,a)=>{if(t<e){Ie.error("Invalid viewport",e,t);return}if(e===0&&t===0){Ie.debug2("Ignoring 0-0 viewport");return}var{movedColumns:o,table:s}=this.props,[l,u]=this.getViewportRowRange(s,e,t),d=a??this.getViewportColumns(s,r,i,o);if(Ie.debug2("Setting Viewport Top:",l,"Bottom:",u,"Columns:",d),this.subscription==null){Ie.debug2("updateViewport creating new subscription"),this.subscription=s.setViewport(l,u,d);var{onSubscription:f}=this.props;f(this.subscription)}else Ie.debug2("updateViewport using existing subscription"),this.subscription.setViewport(l,u,d)},Fg))}componentDidMount(){var{top:e,bottom:t,left:r,right:i,table:a,filters:o,sorts:s,columns:l,customColumns:u}=this.props;a.applyFilter(o),a.applySort(s),a.applyCustomColumns(u),this.updateViewport(e,t,r,i,l)}componentDidUpdate(e){var{top:t,bottom:r,left:i,right:a,table:o,filters:s,sorts:l,customColumns:u,columns:d}=this.props,f=s!==e.filters,m=l!==e.sorts,p=u!==e.customColumns,v=o!==e.table;(f||m||p||v)&&this.closeSubscription(),(f||v)&&(Ie.debug("update table filter",s),o.applyFilter(s)),(m||v)&&(Ie.debug("update table sort",l),o.applySort(l)),(p||v)&&(Ie.debug("update table custom columns",u),o.applyCustomColumns(u)),this.updateViewport(t,r,i,a,d)}componentWillUnmount(){this.closeSubscription()}closeSubscription(){if(Ie.debug2("closeSubscription",this.subscription),this.subscription){this.subscription.close(),this.subscription=void 0;var{onSubscription:e}=this.props;e()}this.updateViewport.cancel()}render(){return null}}qe(Me,"ROW_BUFFER_PAGES",3);qe(Me,"COLUMN_BUFFER_PAGES",1);qe(Me,"defaultProps",{top:0,bottom:0,left:null,right:null,columns:null,onSubscription:()=>{},filters:[],sorts:[],customColumns:[],movedColumns:[]});const Rg=Me;function tn(n,e,t){return e=$g(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $g(n){var e=kg(n,"string");return typeof e=="symbol"?e:String(e)}function kg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ot=B.module("TreeTableViewportUpdater"),Bg=150;class nn extends c.PureComponent{constructor(e){super(e),tn(this,"listenerCleanup",void 0),tn(this,"updateViewport",er((t,r)=>{if(r<t){ot.error("Invalid viewport",t,r);return}if(t===0&&r===0){ot.debug2("Ignoring 0-0 viewport");return}var{table:i,updateInterval:a}=this.props,o=r-t,s=Math.max(0,t-o*3),l=r+o*3+1;if(ot.debug2("Setting Viewport Top:",s,"Bottom:",l,i),!this.listenerCleanup){var{dh:u,onViewportUpdate:d}=this.props;this.listenerCleanup=i.addEventListener(u.TreeTable.EVENT_UPDATED,d)}i.setViewport(s,l,void 0,a)},Bg)),this.listenerCleanup=null}componentDidMount(){var{top:e,bottom:t,table:r,filters:i,sorts:a}=this.props;ot.debug("componentDidMount",this.props),r.applyFilter(i),r.applySort(a),this.updateViewport(e,t)}componentDidUpdate(e){var{top:t,bottom:r,table:i,filters:a,sorts:o}=this.props;a!==e.filters&&(ot.debug("update table filter",a),i.applyFilter(a)),o!==e.sorts&&(ot.debug("update table sort",o),i.applySort(o)),this.updateViewport(t,r)}componentWillUnmount(){this.updateViewport.cancel(),this.listenerCleanup&&this.listenerCleanup()}render(){return null}}tn(nn,"UPDATE_INTERVAL",1e3);tn(nn,"defaultProps",{top:0,bottom:0,onViewportUpdate:()=>{},filters:[],sorts:[],updateInterval:nn.UPDATE_INTERVAL});const Ug=nn,Wg=Object.freeze(Object.defineProperty({__proto__:null,AdvancedSettings:qu,AdvancedSettingsType:Zu,AggregationEdit:Ju,AggregationUtils:Qu,Aggregations:ed,BarIcon:td,ChartBuilder:nd,ColumnHeaderGroup:rd,CustomColumnBuilder:id,DownloadServiceWorkerUtils:ad,FormatColumnWhereIcon:od,FormatRowWhereIcon:sd,HistogramIcon:ld,InputEditor:ud,IrisGrid:qr,IrisGridMetricCalculator:dd,IrisGridModel:cd,IrisGridModelFactory:hd,IrisGridRenderer:fd,IrisGridTableModel:md,IrisGridTableModelTemplate:pd,IrisGridTestUtils:Ng,IrisGridTreeTableModel:vd,IrisGridUtils:gd,LineIcon:bd,OptionType:yd,PieIcon:_d,RollupRows:wd,SHORTCUTS:Sd,ScatterIcon:Ed,TableCsvExporter:Cd,TableSaver:Pd,TableViewportUpdater:Rg,TreeTableViewportUpdater:Ug,VisibilityOrderingBuilder:Td,createDefaultIrisGridTheme:Od,default:qr,isIrisGridTableModelTemplate:Id,isPanelStateV1:Dd,isPanelStateV2:xd},Symbol.toStringTag,{value:"Module"}));var el={react:z,"react-dom":Ta,redux:El,"react-redux":Cl,"@adobe/react-spectrum":Pl,"@deephaven/auth-plugins":Sm,"@deephaven/chart":Qm,"@deephaven/components":qh,"@deephaven/dashboard":xg,"@deephaven/icons":Jl,"@deephaven/iris-grid":Wg,"@deephaven/jsapi-bootstrap":Jh,"@deephaven/jsapi-components":Hf,"@deephaven/jsapi-utils":hf,"@deephaven/log":B,"@deephaven/plugin":qf,"@deephaven/react-hooks":fc},Hg=Tl.createRequires(el),Vg=Ol({requires:Hg});const zg=Vg;function va(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Wr(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){va(a,r,i,o,s,"next",l)}function s(l){va(a,r,i,o,s,"throw",l)}o(void 0)})}}var xe=B.module("@deephaven/app-utils.PluginUtils");function Gg(n){return qn.apply(this,arguments)}function qn(){return qn=Wr(function*(n){var e=yield zg(n);return e}),qn.apply(this,arguments)}function Kg(n){return Zn.apply(this,arguments)}function Zn(){return Zn=Wr(function*(n){var e=yield fetch(n);if(!e.ok)throw new Error(e.statusText);try{return yield e.json()}catch{throw new Error("Could not be parsed as JSON")}}),Zn.apply(this,arguments)}function Xg(n){return Jn.apply(this,arguments)}function Jn(){return Jn=Wr(function*(n){xe.debug("Loading plugins...");try{var e=yield Kg("".concat(n,"/manifest.json"));if(!Array.isArray(e.plugins))throw new Error("Plugin manifest JSON does not contain plugins array");xe.debug("Plugin manifest loaded:",e);for(var t=[],r=0;r<e.plugins.length;r+=1){var{name:i,main:a}=e.plugins[r],o="".concat(n,"/").concat(i,"/").concat(a);t.push(Gg(o))}for(var s=yield Promise.allSettled(t),l=new Map,u=0;u<s.length;u+=1){var d=s[u],{name:f}=e.plugins[u];if(d.status==="fulfilled"){var m,p=ls(d.value)?d.value:(m=d.value.default)!==null&&m!==void 0?m:d.value;p==null?xe.error("Plugin '".concat(f,"' is missing an exported value.")):l.set(f,p)}else xe.error("Unable to load plugin '".concat(f,"'"),d.reason)}return xe.info("Plugins loaded:",l),l}catch(v){return xe.error("Unable to load plugins:",v),new Map}}),Jn.apply(this,arguments)}function Yg(n){var e,t;return(e=(t=n.get("AuthHandlers"))===null||t===void 0?void 0:t.split(","))!==null&&e!==void 0?e:[]}function qg(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Map,r=Yg(e),i=[...n.entries(),...t.entries()].filter(l=>{var[,u]=l;return us(u)||Zt(u)}).map(l=>{var[u,d]=l;return Zt(d)?{type:tt.AUTH_PLUGIN,name:u,component:d.AuthPlugin.Component,isAvailable:d.AuthPlugin.isAvailable}:d}),a=i.filter(l=>{var{isAvailable:u}=l;return u(r,e)});if(a.length===0)throw new Error("No login plugins found, please register a login plugin for auth handlers: ".concat(r));a.length>1&&xe.warn("More than one login plugin available, will use the first one: ",a.map(l=>{var{name:u}=l;return u}).join(", "));var{name:o,component:s}=a[0];return xe.info("Using LoginPlugin",o),s}function Zg(n){var e=[...n.entries()].filter(t=>ds(t[1]));return xe.debug("Getting theme data from plugins",e),e.map(t=>{var[r,i]=t,a=Array.isArray(i.themes)?i.themes:[i.themes];return a.map(o=>{var{name:s,baseTheme:l,styleContent:u}=o;return{baseThemeKey:"default-".concat(l??"dark"),themeKey:ka(r,s),name:s,styleContent:u}})}).flat()}var Jg=Oa.createRequires(()=>el),Qg=Oa.createRemoteComponent({requires:Jg});const Cb=Qg;function ga(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function eb(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){ga(a,r,i,o,s,"next",l)}function s(l){ga(a,r,i,o,s,"throw",l)}o(void 0)})}}function tb(n){var{pluginsUrl:e,getCorePlugins:t,children:r}=n,[i,a]=c.useState(null);return c.useEffect(function(){var s=!1;function l(){return u.apply(this,arguments)}function u(){return u=eb(function*(){var d,f=(d=yield t==null?void 0:t())!==null&&d!==void 0?d:[],m=yield Xg(e);if(!s){var p=f.map(v=>[v.name,v]);a(new Map([...p,...m]))}}),u.apply(this,arguments)}return l(),()=>{s=!0}},[e,t]),h.jsx(xt.Provider,{value:i,children:r})}function nb(){var n=Sr();return c.useEffect(function(){n.postMessage(br(gr))},[n]),null}function ba(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function rb(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){ba(a,r,i,o,s,"next",l)}function s(l){ba(a,r,i,o,s,"throw",l)}o(void 0)})}}var ib=new Map([["@deephaven/auth-plugins.AuthPluginParent",{AuthPlugin:ms}],["@deephaven/auth-plugins.AuthPluginPsk",{AuthPlugin:bs}],["@deephaven/auth-plugins.AuthPluginAnonymous",{AuthPlugin:fs}]]);function ab(n){var{children:e}=n,t=et(),r=c.useContext(xt),[i,a]=c.useState(),[o,s]=c.useState();c.useEffect(function(){var f=!1;function m(){return p.apply(this,arguments)}function p(){return p=rb(function*(){try{var v=yield t.getAuthConfigValues();f||a(new Map(v))}catch(g){f||s(g)}}),p.apply(this,arguments)}return m(),()=>{f=!0}},[t]);var l=c.useMemo(()=>{if(!(r==null||i==null))try{return qg(r,i,ib)}catch(d){s(d)}},[i,r]),u=l==null||i==null;return u||o!=null?h.jsx(je,{isLoading:u&&o==null,errorMessage:gt(o)}):h.jsx(l,{authConfigValues:i,children:h.jsxs(h.Fragment,{children:[h.jsx(nb,{}),e]})})}function ya(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function ob(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){ya(a,r,i,o,s,"next",l)}function s(l){ya(a,r,i,o,s,"throw",l)}o(void 0)})}}var sb=B.module("@deephaven/app-utils.ConnectionBootstrap");function lb(n){var{children:e}=n,t=Pe(),r=et(),[i,a]=c.useState(),[o,s]=c.useState();return c.useEffect(function(){var u=!1;function d(){return f.apply(this,arguments)}function f(){return f=ob(function*(){try{var m=yield r.getAsIdeConnection();if(u)return;s(m)}catch(p){if(u)return;a(p)}}),f.apply(this,arguments)}return d(),()=>{u=!0}},[t,r]),c.useEffect(function(){if(o==null)return;function u(f){var{detail:m}=f;sb.info("Shutdown","".concat(JSON.stringify(m))),a("Server shutdown: ".concat(m??"Unknown reason"))}var d=o.addEventListener(t.IdeConnection.EVENT_SHUTDOWN,u);return d},[t,o]),o==null||i!=null?h.jsx(je,{"data-testid":"connection-bootstrap-loading",isLoading:o==null,errorMessage:i!=null?"".concat(i):void 0}):h.jsx(to.Provider,{value:o,children:e})}function Pb(n){return new URL(n,"".concat(window.location))}function ub(){var n=new URLSearchParams(window.location.search);return n.get("envoyPrefix")}function db(){var n=ub();return n!=null?{headers:{"envoy-prefix":n}}:{headers:{}}}function cb(n){var{children:e}=n,t=c.useContext(as);return t?h.jsx(h.Fragment,{children:e}):h.jsx(je,{"data-testid":"fonts-loaded-loading"})}function _a(n,e,t,r,i,a,o){try{var s=n[a](o),l=s.value}catch(u){t(u);return}s.done?e(l):Promise.resolve(l).then(r,i)}function hb(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function o(l){_a(a,r,i,o,s,"next",l)}function s(l){_a(a,r,i,o,s,"throw",l)}o(void 0)})}}var tl=c.createContext(null);function fb(n){var{children:e}=n,t=et(),[r,i]=c.useState(),[a,o]=c.useState();c.useEffect(function(){var u=!1;function d(){return f.apply(this,arguments)}function f(){return f=hb(function*(){try{var m=yield t.getServerConfigValues();u||i(new Map(m))}catch(p){u||o(p)}}),f.apply(this,arguments)}return d(),()=>{u=!0}},[t]);var s=r==null;return s||a!=null?h.jsx(je,{isLoading:s&&a==null,errorMessage:gt(a)}):h.jsx(tl.Provider,{value:r,children:e})}function mb(){return Qe(tl,"No server config available in useServerConfig. Was code wrapped in ServerConfigBootstrap or ServerConfigContext.Provider?")}function pb(n){var{children:e}=n,t=mb(),r=c.useContext(ro),i=c.useContext(on),a=_s(t,r,i);return h.jsx(no.Provider,{value:a,children:e})}function vb(n){var{children:e}=n,t=c.useContext(xt),r=c.useMemo(()=>t==null?null:Zg(t),[t]);return h.jsx(Fo,{themes:r,children:h.jsx(Es,{children:e})})}function Tb(n){var{fontClassNames:e,pluginsUrl:t,getCorePlugins:r,serverUrl:i,children:a}=n,o=c.useMemo(()=>db(),[]),[s,l]=c.useState(0),u=c.useCallback(()=>{},[]),d=c.useCallback(()=>{l(f=>f+1)},[]);return cn(u,d),h.jsx(Vf,{fontClassNames:e,children:h.jsx(tb,{getCorePlugins:r,pluginsUrl:t,children:h.jsx(vb,{children:h.jsx(Bo,{serverUrl:i,options:o,children:h.jsx(es,{children:h.jsx(ab,{children:h.jsx(fb,{children:h.jsx(pb,{children:h.jsx(lb,{children:h.jsx(cb,{children:a})})})})})})},s)})})})}export{Tb as AppBootstrap,ab as AuthBootstrap,lb as ConnectionBootstrap,Vf as FontBootstrap,cb as FontsLoaded,as as FontsLoadedContext,tb as PluginsBootstrap,Cb as RemoteComponent,vb as ThemeBootstrap,Yg as getAuthHandlers,qg as getAuthPluginComponent,Pb as getBaseUrl,db as getConnectOptions,ub as getEnvoyPrefix,Zg as getThemeDataFromPlugins,Kg as loadJson,Gg as loadModulePlugin,Xg as loadModulePlugins,mb as useServerConfig,Db as useUser};
4
- //# sourceMappingURL=index-3d9ebdae.js.map