@deephaven/embed-grid 0.67.0 → 0.67.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/assets/{App-f0a83160.js → App-0903d1ea.js} +2 -2
- package/build/assets/App-0903d1ea.js.map +1 -0
- package/build/assets/{Chart-065a0fa4.js → Chart-2f1506c1.js} +2 -2
- package/build/assets/{Chart-065a0fa4.js.map → Chart-2f1506c1.js.map} +1 -1
- package/build/assets/{IrisGrid-bc329491.js → IrisGrid-a8e74a25.js} +5 -5
- package/build/assets/IrisGrid-a8e74a25.js.map +1 -0
- package/build/assets/{IrisGridThemeProvider-68c9a06b.js → IrisGridThemeProvider-fb501222.js} +2 -2
- package/build/assets/{IrisGridThemeProvider-68c9a06b.js.map → IrisGridThemeProvider-fb501222.js.map} +1 -1
- package/build/assets/{MarkdownEditor-52464698.js → MarkdownEditor-6ffb4f23.js} +2 -2
- package/build/assets/{MarkdownEditor-52464698.js.map → MarkdownEditor-6ffb4f23.js.map} +1 -1
- package/build/assets/{MarkdownNotebook-9742e374.js → MarkdownNotebook-52e14d92.js} +2 -2
- package/build/assets/{MarkdownNotebook-9742e374.js.map → MarkdownNotebook-52e14d92.js.map} +1 -1
- package/build/assets/index-4cb59416.js +29 -0
- package/build/assets/index-4cb59416.js.map +1 -0
- package/build/assets/{index-ea353fc2.js → index-c9408b8e.js} +2 -2
- package/build/assets/{index-ea353fc2.js.map → index-c9408b8e.js.map} +1 -1
- package/build/assets/useUser-ae22a8dc.js +3 -0
- package/build/assets/useUser-ae22a8dc.js.map +1 -0
- package/build/index.html +1 -1
- package/package.json +14 -14
- package/build/assets/App-f0a83160.js.map +0 -1
- package/build/assets/IrisGrid-bc329491.js.map +0 -1
- package/build/assets/index-4a8d2f58.js +0 -29
- package/build/assets/index-4a8d2f58.js.map +0 -1
- package/build/assets/useUser-99234a48.js +0 -3
- package/build/assets/useUser-99234a48.js.map +0 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import{D as u,$ as qm,I as cc,J as Eo,G as ne,K as wo,r as c,L as Le,M as ye,N as Ym,O as fc,P as Xm,Q as vc,S as Zm,T as Qm,U as Yl,V as st,H as X,F as Y,W as _,X as Jm,E as Fn,Y as Jn,Z as eg,_ as tg,a0 as ng,a1 as pc,a2 as vi,a3 as rg,a4 as Po,a5 as ig,a6 as pr,a7 as mc,a8 as Z,R as Ta,a9 as Xl,aa as mr,ab as ag,ac as _o,ad as sg,ae as og,af as lg,ag as dg,ah as pi,ai as gc,aj as mi,ak as ug,al as se,am as Jr,an as Et,ao as hg,ap as cg,aq as fg,ar as vg,as as pg,at as bc}from"./vendor-f46f78b9.js";import{L as W,i as mg,v as kn,M as gi,b as bi,c as Oa,d as ar,e as gg,a as Ne,f as To,g as bg,h as Cg,r as Oo,j as z,k as Sg,l as yg,m as Eg,T as jn,C as wg,D as Pg,n as _g,o as Tg,p as Og,q as Da,N as Dg,S as Ig,s as xg,t as Ng,W as Mg,u as Lg,w as Ag,x as Fg,y as jg,z as Rg,A as kg,B as Cc,E as Sc,F as $g,G as Ug,H as Hg,I as Vg,J as Bg,K as Wg,O as Gg,P as zg,Q as Ia,R as Kg,U as yc,V as qg,X as Ec,Y as Do,Z as Io,_ as er,$ as Yg,a0 as Zl,a1 as Xg,a2 as Zg,a3 as Qg,a4 as Jg,a5 as xo,a6 as wc,a7 as Fs,a8 as eb,a9 as tb,aa as Ql,ab as Pc,ac as Jl,ad as _c,ae as nb,af as xa,ag as rb,ah as ib,ai as ab,aj as sb,ak as ob,al as lb,am as db,an as Tc,ao as ub,ap as Oc,aq as Dc,ar as ed,as as hb,at as cb,au as fb,av as vb,aw as pb,ax as mb,ay as gb,az as bb}from"./index-c9408b8e.js";import{c as Ir,d as Cb,e as Sb,C as Ic,T as yb,B as Eb,g as wb,D as No,h as xc,i as Pb,j as _b,F as Tb,k as ai,l as si,m as Ob,S as Db,n as Ib,o as xe,p as xb,q as Mo,r as Nb,s as Nc,t as Mc,v as Lo,w as Ao,x as Lc,y as Ac,z as Fc,f as Mb,A as jc,E as Lb,G as Ab,H as Fo,J as sa,K as Fb,L as jb,M as Rc,P as Se,N as Rb,O as kb,Q as kc,U as Na,R as $c,V as Uc,W as $b,X as _t,Y as Ub,Z as Hb,I as gr,_ as Hc,$ as Vb,a0 as Bb,a1 as Wb,a2 as zt,b as Ma,a3 as Gb,a4 as Vc,a5 as zb,a6 as Kb,a7 as Xe,a8 as ta,a9 as qb,aa as Yb,ab as Xb,ac as Zb,ad as zr,ae as Bc,u as Qb,a as Jb}from"./useUser-ae22a8dc.js";import{T as mt,g as eC,u as tC,a as nC,b as Wc,P as La,B as K,c as sr,M as jo,D as Gc,d as gn,e as rC,S as Ci,R as oa,I as br,C as la,f as ae,h as js,i as xr,j as iC,k as zc,l as aC,m as sC,G as Cr,n as oC,K as ve,o as pe,p as lC,q as dC,O as uC,r as hC,s as Kc,t as Rs,v as Rn,w as qc,x as cC,y as Ke,z as fC,A as vC,E as Yc,U as Xc,F as pC,H as mC,J as gC,L as Ve,N as bC,Q as ct,V as CC,W as Zc,X as Sn,Y as SC,Z as Qc,_ as yC,$ as EC,a0 as wC,a1 as PC,a2 as _C,a3 as TC,a4 as OC,a5 as DC,a6 as IC,a7 as xC,a8 as NC,a9 as MC,aa as LC,ab as Jc,ac as AC,ad as FC,ae as jC,af as RC,ag as kC,ah as $C,ai as UC,aj as HC,ak as VC,al as BC,am as ei,an as WC,ao as GC,ap as zC}from"./IrisGridThemeProvider-fb501222.js";import{_ as Aa,e as Ro,l as Ai,K as ti,a as ef}from"./monaco-0b69f16f.js";function Sr(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 tf=24,KC=32,qC=33,YC=150,ks=200,nf=500,rf=250,XC={spellCheck:!1},ZC=["ariaLabel","icon","isQuiet","labelText","children","onOpenChange","tooltip"];function td(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 nd(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?td(Object(t),!0).forEach(function(r){QC(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):td(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function QC(n,e,t){return e=JC(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function JC(n){var e=eS(n,"string");return typeof e=="symbol"?e:String(e)}function eS(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 tS(n,e){if(n==null)return{};var t=nS(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 nS(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 af(n){var{ariaLabel:e,icon:t,isQuiet:r,labelText:i,children:a,onOpenChange:s,tooltip:o}=n,l=tS(n,ZC),d=i==null&&o!=null?"action-button-icon-with-tooltip":void 0;return u.jsxs(qm,{type:"popover",onOpenChange:s,children:[u.jsxs(cc,nd(nd({},l),{},{"aria-label":e??i,isQuiet:r,children:[u.jsx(Eo,{UNSAFE_className:d,children:u.jsx(ne,{icon:t})}),i==null?null:u.jsx(wo,{children:i}),o==null?null:u.jsx(mt,{children:o})]})),a]})}function rS(n,e){return n===0?0:e==="all"||n===e.size?"all":e.size}function sf(n,e){return n===e?!0:n==="all"||e==="all"||n.size!==e.size?!1:[...n.keys()].every(t=>e.has(t))}function of(n,e){return n.isInverted===e.isInverted&&sf(n.selection,e.selection)}function lf(n,e,t){if(n==="all")return"all";var r=[...n.keys()];return new Set(r.map(i=>t(e(i))))}function df(n,e){var t=n==="all"||n.size>e/2,r=n;return t&&(r=n==="all"?new Set:new Set([...eC(0,e-1)].filter(i=>!n.has(String(i))).map(i=>String(i)))),{selection:r,isInverted:t}}function iS(n,e){return n?{}:{errorMessage:e,validationState:"invalid"}}function uf(n){var e;return(e=n==null?void 0:n.UNSAFE_getDOMNode())!==null&&e!==void 0?e:null}function aS(n){var e=n==null?void 0:n.UNSAFE_getDOMNode().lastElementChild;return hf(e)}function sS(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 hf(n){return n instanceof HTMLElement?n:null}function ko(){var n=c.useRef(!1);return c.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[]),n}function rd(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function oS(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){rd(a,r,i,s,o,"next",l)}function o(l){rd(a,r,i,s,o,"throw",l)}s(void 0)})}}var lS=W.module("useAsyncInterval");function cf(n,e){var t=ko(),r=c.useRef(0),i=c.useRef(0),a=c.useRef(null),s=c.useCallback(oS(function*(){var o=Date.now();i.current+=1;var l=a.current==null?e:o-a.current;a.current=o;try{yield n()}catch(f){lS.error("A tick error occurred:",f)}if(t.current){l+=Date.now()-a.current;var d=Math.max(0,l-e),h=Math.max(0,e-d);r.current=window.setTimeout(s,h)}}),[n,t,e]);c.useEffect(()=>(a.current=null,s(),()=>{window.clearTimeout(r.current)}),[e,s])}function dS(n,e){return c.useCallback(function(){var t=n(...arguments);return e(),t},[e,n])}function da(n,e){var t=c.useMemo(()=>Le(n,e),[n,e]);return c.useEffect(()=>()=>t.cancel(),[t]),t}function uS(n){var[e,t]=c.useState(!0);return c.useEffect(()=>{var r=setTimeout(()=>{t(!1)},n);return()=>{clearTimeout(r)}},[n]),e}function hS(n){var[e,t]=c.useState(n);return c.useEffect(()=>{t(n)},[n]),[e,t]}function cS(n,e,t,r){var i=c.useRef(0);c.useEffect(()=>{i.current>=t||r&&(i.current+=1,n())},[t,r,...e])}function ff(n,e){var t=c.useRef(n),r=e(t.current,n)?t.current:n;return t.current=r,r}function fS(n){n.preventDefault()}function vf(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=c.useMemo(()=>"useSubmitButtonRef-".concat(ye()),[]),t=c.useCallback(a=>{a==null||a.UNSAFE_getDOMNode().setAttribute("form",e)},[e]),r=c.useMemo(()=>({id:e,onSubmit:n?void 0:fS}),[e,n]),i=c.useMemo(()=>({form:e,ref:t}),[e,t]);return{formProps:r,submitButtonProps:i}}function pf(n,e){return c.useCallback(t=>{typeof n=="function"?n(e(t)):n.current=e(t)},[e,n])}function mf(n,e){var{getItem:t,selectedKeys:r,items:i}=n;return c.useMemo(()=>{var{selection:a,isInverted:s}=df(r,i.length);return{selection:lf(a,t,e),isInverted:s}},[r,i.length,t,e])}function vS(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:mg,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 id(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function pS(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){id(a,r,i,s,o,"next",l)}function o(l){id(a,r,i,s,o,"throw",l)}s(void 0)})}}function mS(n,e,t){var r=c.useRef(null),[i,a]=c.useState(null),s=c.useCallback(pS(function*(){if(!(i==null||t==null)){var l=yield t();i.scroll(0,l)}}),[t,i]);c.useEffect(()=>(i==null||i.addEventListener("scroll",e),s(),()=>{i==null||i.removeEventListener("scroll",e)}),[e,i,s]);var o=c.useCallback(l=>{l&&setTimeout(()=>{a(n(r.current))},0)},[n]);return{ref:r,onOpenChange:o}}function ad(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function gS(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){ad(a,r,i,s,o,"next",l)}function o(l){ad(a,r,i,s,o,"throw",l)}s(void 0)})}}function oi(n,e){var{autoLoad:t=!0}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},[r,i]=c.useState(null),[a,s]=c.useState(null),[o,l]=c.useState(!1),d=c.useCallback(gS(function*(){l(!0);try{var h=yield n(...e);i(h),s(null)}catch(f){i(null),s(f)}finally{l(!1)}}),[n,...e]);return c.useEffect(()=>{t&&d()},[t,d]),{data:r,error:a,isError:a!=null,isLoading:o,reload:d}}function sd(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 od(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?sd(Object(t),!0).forEach(function(r){bS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):sd(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function bS(n,e,t){return e=CS(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function CS(n){var e=SS(n,"string");return typeof e=="symbol"?e:String(e)}function SS(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 yS(n,e,t,r){var i=arguments.length===4;return c.useCallback(a=>{var s=i?a??r:a;t(od(od({},n),{},{[e]:s}))},[t,n,e,i,r])}function gf(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 s=Math.floor(a.target.scrollTop/n);i.current!==s&&(i.current=s,e(s))},t)},[t,n,e])}function Si(n,e){var[t,r]=c.useState(!0),[i,a]=c.useState(n),[s,o]=c.useState(n),[l,d]=c.useState(e);return(n!==s||e!==l)&&(r(!0),o(n),d(e)),c.useEffect(()=>{var h=!1,f=setTimeout(()=>{h||(r(!1),a(n))},e);return()=>{h=!0,clearTimeout(f)}},[n,e]),{isDebouncing:t,value:i}}function bf(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[s,o]=a;i.setAttribute(s,o)})})}},[n,e])}function ES(n){var e=bf(XC,n);return pf(e,uf)}function Cf(){var{getKey:n=Sf}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},[e,t]=c.useState([]),[r,i]=c.useState(()=>new Set),a=c.useCallback(m=>b=>n(b)===m,[n]),s=c.useCallback(m=>{var b;return(b=e.find(a(m)))!==null&&b!==void 0?b:null},[e,a]),o=c.useCallback(m=>{var b=s(m);if(b==null)throw new Error("No item found matching key: ".concat(m));return b},[s]),l=c.useCallback(m=>{t(b=>[...b,...m])},[]),d=c.useCallback((m,b)=>{t(g=>[...g.slice(0,m),...b,...g.slice(m)])},[]),h=c.useCallback(m=>{var b=new Set(m);t(g=>g.filter(C=>!b.has(n(C))))},[n]),f=c.useCallback((m,b)=>{var g=e.findIndex(a(m));g!==-1&&t(C=>[...C.slice(0,g),b,...C.slice(g+1)])},[e,a]),v=c.useCallback(m=>{if(m.size!==0){var b=[],g=new Map;for(var C of m.keys()){var S=e.findIndex(a(C));b.push(S),g.set(S,C)}b.sort((w,E)=>w-E);var y=[];e.forEach((w,E)=>{if(b[0]===E){var D=g.get(b.shift()),T=m.get(D);y.push(T)}else y.push(w)}),t(y)}},[e,a]),p=c.useMemo(()=>({items:e,selectedKeys:r,append:l,bulkUpdate:v,findItem:s,getItem:o,insert:d,remove:h,setItems:t,setSelectedKeys:i,update:f}),[l,v,s,o,d,e,h,t,r,f]);return p}function Sf(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 $o(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 wS=Object.freeze(Object.defineProperty({__proto__:null,createValidationProps:iS,defaultGetKey:Sf,extractSpectrumHTMLElement:uf,extractSpectrumLastChildHTMLElement:aS,findSpectrumComboBoxScrollArea:sS,getSelectedItemCountOrAll:rS,identityExtractHTMLElement:hf,isSelectionEqual:sf,isSelectionMaybeInvertedEqual:of,mapSelection:lf,optimizeSelection:df,useAsyncInterval:cf,useCallbackWithAction:dS,useContextOrThrow:Ir,useCopyToClipboard:tC,useDebouncedCallback:da,useDebouncedValue:Si,useDelay:uS,useDependentState:hS,useEffectNTimesWhen:cS,useFormWithDetachedSubmitButton:vf,useForwardedRef:nC,useIsEqualMemo:ff,useIsMountedRef:ko,useMappedRef:pf,useMappedSelection:mf,useOnScrollOffsetChangeCallback:gf,useOnScrollRef:vS,usePopoverOnScrollRef:mS,usePrevious:Wc,usePromiseFactory:oi,usePropChangeCallback:yS,useResizeObserver:$o,useSetAttributesCallback:bf,useSpectrumDisableSpellcheckRef:ES,useWindowedListData:Cf},Symbol.toStringTag,{value:"Module"})),PS="_spectrumActionBar_1ji6m_5",_S="_spectrumDialogComponentHeading_1ji6m_9",TS="_spectrumEllipsis_1ji6m_14",Fa={spectrumActionBar:PS,spectrumDialogComponentHeading:_S,spectrumEllipsis:TS};function ld(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 Fi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ld(Object(t),!0).forEach(function(r){OS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ld(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function OS(n,e,t){return e=DS(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function DS(n){var e=IS(n,"string");return typeof e=="symbol"?e:String(e)}function IS(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 yf(n){var{heading:e,confirmationButtonLabel:t,children:r,onCancel:i,onConfirm:a}=n,{formProps:s,submitButtonProps:o}=vf();return u.jsxs(Ym,{children:[u.jsx(fc,{level:3,UNSAFE_className:Fa.spectrumDialogComponentHeading,children:e}),u.jsx(Xm,{}),u.jsx(vc,{children:u.jsx(Zm,Fi(Fi({},s),{},{children:r}))}),u.jsxs(Qm,{children:[u.jsx(Yl,{variant:"secondary",onPress:i,children:"Cancel"}),u.jsx(Yl,Fi(Fi({},o),{},{style:"fill",variant:"negative",onPress:a,type:"submit",children:t}))]})]})}function xS(n){var{ariaLabel:e,heading:t,confirmationButtonLabel:r,isHidden:i,children:a,tooltip:s,onConfirm:o}=n,l=c.useCallback(d=>u.jsx(yf,{heading:t,confirmationButtonLabel:r,onCancel:d,onConfirm:()=>{d(),o()},children:a}),[a,r,t,o]);return u.jsx(af,{ariaLabel:e,icon:kn,isHidden:i,isQuiet:!0,height:tf,tooltip:s,children:l})}var NS=["icon","label","tooltip"];function dd(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 ud(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?dd(Object(t),!0).forEach(function(r){MS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):dd(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function MS(n,e,t){return e=LS(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function LS(n){var e=AS(n,"string");return typeof e=="symbol"?e:String(e)}function AS(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 FS(n,e){if(n==null)return{};var t=jS(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 jS(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 Ef(n){var{icon:e,label:t,tooltip:r}=n,i=FS(n,NS);return u.jsxs(cc,ud(ud({},i),{},{"aria-label":t,isQuiet:!0,height:tf,children:[u.jsx(Eo,{UNSAFE_className:r==null?void 0:"action-button-icon-with-tooltip",children:u.jsx(ne,{icon:e})}),r==null?null:u.jsx(mt,{children:r})]}))}Ef.displayName="IconActionButton";function hd(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 RS(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?hd(Object(t),!0).forEach(function(r){Yt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):hd(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Yt(n,e,t){return e=kS(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function kS(n){var e=$S(n,"string");return typeof e=="symbol"?e:String(e)}function $S(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 US=100,$s;(function(n){n.UP="UP",n.DOWN="DOWN"})($s||($s={}));class Dt extends c.Component{constructor(e){super(e),Yt(this,"popper",void 0),Yt(this,"cbContainer",void 0),Yt(this,"menuContainer",void 0),Yt(this,"input",void 0),Yt(this,"getCachedFilteredOptions",st((r,i)=>r.filter(a=>a.title.toLowerCase().indexOf(i.toLowerCase())>=0)));var{popperOptions:t}=this.props;t=RS({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=Le(this.updateInputValue,US),this.handleOptionClick=this.handleOptionClick.bind(this),this.handleMenuOpened=this.handleMenuOpened.bind(this),this.handleMenuExited=this.handleMenuExited.bind(this),this.popper=X.createRef(),this.cbContainer=X.createRef(),this.menuContainer=X.createRef(),this.input=X.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,s=a.length===1&&a[0].title===e;if(this.setState({filteredOptions:a,keyboardOptionIndex:0}),s&&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(Dt.MENU_NAVIGATION_DIRECTION.UP);break;case"ArrowDown":e.stopPropagation(),e.preventDefault(),this.navigateMenu(Dt.MENU_NAVIGATION_DIRECTION.DOWN);break;case"Tab":if(e.stopPropagation(),e.preventDefault(),e.shiftKey){this.navigateMenu(Dt.MENU_NAVIGATION_DIRECTION.UP);break}this.navigateMenu(Dt.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===Dt.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===Dt.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 u.jsx("div",{className:Y("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?u.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 u.jsx("button",{type:"button",className:Y("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:s,"data-testid":o}=this.props,{title:l,menuIsOpen:d,popperOptions:h,invalid:f}=this.state;return u.jsxs("div",{className:"aci-container",ref:this.cbContainer,children:[u.jsx("input",{value:l||a,className:Y("form-control",i,"aci-input",{"is-invalid":f&&!d}),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:s,"data-testid":o}),u.jsx(La,{ref:this.popper,options:h,className:Y("aci-options-popper interactive"),onEntered:this.handleMenuOpened,onExited:this.handleMenuExited,children:this.renderMenuElement()})]})}}Yt(Dt,"propTypes",{options:_.arrayOf(_.shape({title:_.string.isRequired,value:_.string.isRequired})).isRequired,popperOptions:_.shape({}),onChange:_.func,inputPlaceholder:_.string,disabled:_.bool,className:_.string,defaultTitle:_.string,spellCheck:_.bool,onEnter:_.func,noMatchText:_.string,"data-testid":_.string});Yt(Dt,"defaultProps",{onChange(){},inputPlaceholder:"",disabled:!1,className:"",defaultTitle:"",popperOptions:null,spellCheck:!0,onEnter(){},noMatchText:"No matching items found","data-testid":void 0});Yt(Dt,"MENU_NAVIGATION_DIRECTION",$s);const HS=Dt;function Uo(n){var{className:e="",value:t,onChange:r,spellCheck:i=!1,placeholder:a="",disabled:s=!1,delimiter:o="",id:l="","data-testid":d}=n,[h,f]=c.useState(t),[v,p]=c.useState(!1),m=c.useRef(null);c.useEffect(function(){f(t)},[t]);function b(T){return T.trim().split(o).filter(O=>O).join(`
|
|
2
|
+
`.concat(o.trim()))}function g(T){return T.split(`
|
|
3
|
+
`).map(O=>O.trim()).join(" ")}function C(){if(m.current){m.current.style.height="0";var T=m.current.scrollHeight+(m.current.offsetHeight-m.current.clientHeight);T>0&&(m.current.style.height="".concat(T,"px"))}}function S(T){var O=T.target.value;v&&(o&&(O=b(O)),p(!1)),f(O),r(O)}function y(){m.current&&(o&&(f(b(h)),C()),m.current.scrollLeft=0)}function w(){m.current&&document.activeElement!==m.current&&m.current.focus()}function E(){o&&(f(g(h)),r(g(h)))}function D(){p(!0)}return c.useEffect(function(){C()},[h]),u.jsx("textarea",{ref:m,id:l,className:Y(e,"auto-resize-textarea form-control"),placeholder:a,value:h,rows:1,onChange:S,onFocus:y,onMouseDown:w,onBlur:E,onPaste:D,spellCheck:i,disabled:s,"data-testid":d})}Uo.propTypes={value:_.string.isRequired,onChange:_.func.isRequired,className:_.string,placeholder:_.string,spellCheck:_.bool,disabled:_.bool,delimiter:_.string,id:_.string,"data-testid":_.string};Uo.defaultProps={className:"",id:"",placeholder:"",disabled:!1,spellCheck:!1,delimiter:"","data-testid":void 0};function yi(n){var{children:e,className:t,style:r,"data-testid":i}=n;return u.jsx("div",{className:Y("btn-group",t),style:r,role:"group","data-testid":i,children:e})}yi.displayName="ButtonGroup";yi.propTypes={children:_.node.isRequired,className:_.string,style:_.object,"data-testid":_.string};yi.defaultProps={className:null,style:{},"data-testid":void 0};function VS(n){var{blockInteraction:e=!0,children:t,debounceMs:r,isOpen:i=!1}=n,{value:a}=Si(i,r);return u.jsxs(u.Fragment,{children:[e&&i&&u.jsx("div",{className:"modal-backdrop",style:{backgroundColor:"transparent"},"data-testid":"debounced-modal-backdrop"}),X.cloneElement(t,{isOpen:i&&a})]})}function BS(n){var{className:e,icon:t,isOpen:r=!1,subtitle:i,title:a}=n;return u.jsx(gi,{isOpen:r,className:e,children:u.jsx(bi,{children:u.jsxs("div",{className:"info-modal",children:[t!=null&&u.jsx("div",{className:"message-icon",children:u.jsx(ne,{icon:t})}),u.jsx("div",{className:"message-header",children:a}),i!=null&&u.jsx("div",{className:"message-content",children:i})]})})})}function ja(n){var{className:e="modal-footer",children:t,"data-testid":r}=n;return u.jsx("div",{className:e,"data-testid":r,children:t})}function Cn(n){var{isOpen:e,headerText:t,bodyText:r,onCancel:i,onConfirm:a,onDiscard:s,onModalDisable:o,cancelButtonText:l="Cancel",confirmButtonText:d="Okay",discardButtonText:h="Discard",isConfirmDanger:f=!1,children:v,"data-testid":p}=n,m=c.useRef(null),b=c.useRef(null),g=c.useCallback(()=>{b.current!==null&&b.current.checked&&o&&o(),a()},[a,o]),C=c.useCallback(()=>{var y;(y=m.current)===null||y===void 0||y.focus()},[]),S="";return e&&(S=typeof r=="function"?r():r),u.jsxs(gi,{isOpen:e,onOpened:C,children:[u.jsx(Oa,{closeButton:!1,children:t}),u.jsx(bi,{children:S}),u.jsxs(ja,{children:[o&&u.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[u.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:b,"data-testid":p!==void 0?"".concat(p,"-checkbox-confirm"):void 0}),u.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),s&&u.jsx(K,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:s,"data-testid":p!==void 0?"".concat(p,"-btn-discard"):void 0,children:h}),i&&u.jsx(K,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":p!==void 0?"".concat(p,"-btn-cancel"):void 0,children:l}),u.jsxs(yi,{children:[u.jsx(K,{kind:f?"danger":"primary",onClick:g,ref:m,"data-testid":p!==void 0?"".concat(p,"-btn-confirm"):void 0,children:d}),v]})]})]})}Cn.propTypes={isOpen:_.bool.isRequired,headerText:_.string.isRequired,bodyText:_.oneOfType([_.string,_.func]).isRequired,onCancel:_.func,onConfirm:_.func.isRequired,onDiscard:_.func,onModalDisable:_.func,cancelButtonText:_.string,confirmButtonText:_.string,discardButtonText:_.string,children:_.node,"data-testid":_.string};Cn.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};var Ra=X.forwardRef((n,e)=>{var{children:t,className:r,disabled:i,onClick:a,style:s,id:o}=n;return u.jsx("button",{ref:e,type:"button",className:Y("btn",r),onClick:a,style:s,disabled:i,id:o,children:t})});Ra.displayName="Button";Ra.propTypes={children:_.node,className:_.string,disabled:_.bool,onClick:_.func,style:_.shape({}),id:_.string};Ra.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Us=Ra;function cd(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 fd(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?cd(Object(t),!0).forEach(function(r){WS(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):cd(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function WS(n,e,t){return e=GS(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function GS(n){var e=zS(n,"string");return typeof e=="symbol"?e:String(e)}function zS(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 KS(n){var{styleProps:e,selectedItemCount:t,onClearSelection:r}=n;return u.jsx(Jm,fd(fd({UNSAFE_className:Fa.spectrumActionBar},e),{},{isEmphasized:!0,selectedItemCount:t,onClearSelection:r}))}function ka(n){var{className:e,isFlipped:t,children:r,"data-testid":i}=n,a=d=>{if(r.length!==2)throw new Error("CardFlip requires 2 children to function");return r[d]},s=c.useRef(null),o=c.useCallback(d=>{d.target===d.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),l=c.useCallback(d=>{d.target===d.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return c.useEffect(function(){if(!s.current)throw Error("ref undefined");s.current.addEventListener("transitionstart",o);var h=s.current;return function(){if(h!=null)return h.removeEventListener("transitionstart",o)}},[o]),u.jsxs("div",{className:Y(e,{"card-flip--show-front":t,"card-flip--show-back":!t}),"data-testid":i,children:[u.jsx("div",{className:"card-flip--back",children:a(0)}),u.jsx("div",{ref:s,className:"card-flip--front",onTransitionEnd:l,children:a(1)})]})}function wf(n,e,t){return e=qS(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qS(n){var e=YS(n,"string");return typeof e=="symbol"?e:String(e)}function YS(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 Rt extends c.Component{static handleEnter(e){var t=e;t.style.height="0"}static handleEntering(e){var t=e;t.style.height="".concat(Rt.getHeight(t),"px")}static handleExiting(e){var t=e;t.style.height="0"}static handleExit(e){var t=e;t.style.height="".concat(Rt.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 u.jsx(Fn,{in:r,classNames:{enterActive:"collapsing",enterDone:"collapse show",exitActive:"collapsing",exitDone:"collapse"},onEnter:Rt.handleEnter,onEntering:Rt.handleEntering,onEntered:this.handleEntered,onExit:Rt.handleExit,onExiting:Rt.handleExiting,timeout:350,children:a=>u.jsx("div",{className:Y({collapse:a==="exited"},t),"data-testid":i,children:e})})}}wf(Rt,"propTypes",{className:_.string,in:_.bool.isRequired,children:_.node.isRequired,autoFocusOnShow:_.bool,"data-testid":_.string});wf(Rt,"defaultProps",{className:"",autoFocusOnShow:!1,"data-testid":void 0});const XS=Rt;var ZS=W.module("TimeInput"),QS="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]",JS=["00:00:00","12:34:56","23:59:59"];function vd(n){return n!=null?"".concat(n.substring(0,8).replace(/\u2007/g,"0")).concat("00:00:00".substring(n.length)):n}var Pf=X.forwardRef((n,e)=>{var{allowValueWrapping:t=!0,className:r="",onChange:i=()=>!1,value:a=0,onFocus:s=()=>!1,onBlur:o=()=>!1,onSelect:l=()=>!1,"data-testid":d}=n,[h,f]=c.useState(sr.formatTime(a)),v=c.useRef(a),[p,m]=c.useState(),b=c.useRef(null);c.useImperativeHandle(e,()=>({focus:()=>{var E;(E=b.current)===null||E===void 0||E.focus()},setSelection:E=>{var D;(D=b.current)===null||D===void 0||D.focus(),m(E)}}),[]),c.useEffect(function(){v.current!==a&&(f(sr.formatTime(a)),v.current=a)},[v,a]);function g(E,D,T){var O=E.selectionStart===0?24:60,M=parseInt(T,10)-D;return Number.isNaN(M)?M=0:t?M=(M%O+O)%O:M=Math.min(Math.max(0,M),O-1),"".concat(M).padStart(2,"0")}function C(E,D,T,O,M){return O===0&&M===2&&D===1&&parseInt(T,10)>1?"0".concat(T).concat(E.substring(2)):Gc(E,D,T)}var S=c.useCallback(E=>{ZS.debug("handleChange",E),f(E),v.current=sr.parseTime(vd(E)),i(v.current)},[i]),y=c.useCallback(()=>{var E=vd(h);E!==h&&f(E),o()},[h,o]),w=c.useCallback(E=>{m(E),l(E)},[l]);return u.jsx(jo,{ref:b,className:r,example:JS,getNextSegmentValue:g,getPreferredReplacementString:C,onChange:S,onSelect:w,pattern:QS,selection:p,value:h,onFocus:s,onBlur:y,"data-testid":d})});Pf.defaultProps={allowValueWrapping:!0,className:"",onChange:()=>!1,onSelect:()=>!1,value:0,onFocus:()=>!1,onBlur:()=>!1,"data-testid":void 0};const ua=Pf;function pd(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 ey(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?pd(Object(t),!0).forEach(function(r){pn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):pd(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function pn(n,e,t){return e=ty(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ty(n){var e=ny(n,"string");return typeof e=="symbol"?e:String(e)}function ny(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 md=-1,Hs;(function(n){n.UP="UP",n.DOWN="DOWN"})(Hs||(Hs={}));class dt extends c.Component{constructor(e){super(e),pn(this,"csContainer",void 0),pn(this,"menuContainer",void 0),pn(this,"button",void 0),pn(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=X.createRef(),this.menuContainer=X.createRef(),this.button=X.createRef(),this.input=X.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 s=e[a];if(s.value===t)return s.title}return sr.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(dt.MENU_NAVIGATION_DIRECTION.UP):this.handleMenuNavigation(dt.MENU_NAVIGATION_DIRECTION.DOWN),e.stopPropagation(),e.preventDefault();break;case"ArrowUp":this.handleMenuNavigation(dt.MENU_NAVIGATION_DIRECTION.UP),e.stopPropagation(),e.preventDefault();break;case"ArrowDown":this.handleMenuNavigation(dt.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,s=t;switch(e){case dt.MENU_NAVIGATION_DIRECTION.UP:if(!r&&t===0){this.focusInput();break}else r&&this.focusOption(t);t>0&&!r?(s=(s-1)%a,this.setState({keyboardOptionIndex:s})):t===0&&(s=a-1,this.setState({keyboardOptionIndex:s})),this.scrollOptionIntoView(s);break;case dt.MENU_NAVIGATION_DIRECTION.DOWN:if(!r&&t===a-1){this.focusInput();break}else r&&this.focusOption(t);t<a&&!(r&&t===0)&&(s=(s+1)%a,this.setState({keyboardOptionIndex:s})),this.scrollOptionIntoView(s);break}}handleOptionClick(e){var t=Number(e.currentTarget.value),{options:r,timeToValue:i}=this.props,{customTime:a}=this.state;if(t===md){var s=i(a);this.updateAndClose(s)}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 s=t.map(o=>o.value).indexOf(r);s<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>dt.DROP_DOWN_MENU_HEIGHT?r.scrollTop=i.offsetTop-dt.DROP_DOWN_MENU_HEIGHT:(i instanceof HTMLElement&&i.offsetTop<0||e===0)&&(r.scrollTop=0)}}renderMenuElement(){var{inputWidth:e}=this.state;return u.jsx("div",{className:"cs-menu-container",ref:this.menuContainer,role:"presentation",onKeyDown:this.handleMenuKeyDown,onClick:t=>{t.stopPropagation()},style:{width:e},children:u.jsx("div",{className:"cs-options-container",children:u.jsx("div",{className:"cs-options",children:this.renderOptions()})})})}renderOptions(){for(var{options:e,value:t,icon:r,customText:i}=this.props,{keyboardOptionIndex:a,customTime:s,inputFocused:o}=this.state,l=!1,d=[],h=0;h<e.length;h+=1){var f=e[h],v="option-".concat(h,"-").concat(f.value);l=l||f.value===t,d.push(u.jsxs("button",{type:"button",value:h,className:Y("cs-option-btn",{"keyboard-active":a===h&&!o}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[f.value===t&&u.jsx(ne,{icon:r,className:"mr-2"}),f.value!==t&&u.jsx("span",{className:"mr-4"}),f.title]},v))}return d.push(u.jsx("hr",{className:"cs-divider"},"option-divider")),d.push(u.jsxs("button",{type:"button",value:md,className:Y("cs-option-btn",{"keyboard-active":o}),onClick:this.handleOptionClick,onFocus:this.handleOptionFocus,children:[!l&&t!==null?u.jsx(ne,{icon:r,className:"mr-2"}):u.jsx("span",{className:"mr-4"}),i]},"option-custom-label")),d.push(u.jsxs("div",{className:"cs-custom-container",children:[u.jsx("span",{className:"mr-2"}),u.jsx(ua,{ref:this.input,onChange:this.handleCustomInput,value:s,onFocus:()=>this.setState({inputFocused:!0}),onBlur:()=>this.setState({inputFocused:!1})},"option-input"),u.jsx("span",{className:"ml-2"})]},"cs-custom-container")),d.push(u.jsx("hr",{className:"mb-2"},"option-end")),d}render(){var{disabled:e,invalid:t,value:r,"data-testid":i}=this.props,{menuIsOpen:a}=this.state,{popperOptions:s}=this.props;return s=ey({placement:"bottom-end",modifiers:{preventOverflow:{enabled:!1}}},s),u.jsx("div",{className:"input-group cs-container context-menu",ref:this.csContainer,"data-testid":i,children:u.jsx("div",{className:Y("input-group-append cs-dropdown",{"cs-dropdown-invalid":t}),children:u.jsxs("button",{type:"button",className:Y("btn cs-btn form-control",{"cs-btn-invalid":t}),ref:this.button,onClick:this.toggleMenu,disabled:e,children:[u.jsx("span",{className:Y({"text-muted":r===null}),children:this.getSelectedText()}),u.jsx("span",{className:"cs-caret"}),u.jsx(gn,{isShown:a,actions:{menuElement:this.renderMenuElement()},popperOptions:s,popperClassName:"CustomTimeSelect",onMenuOpened:this.handleMenuOpened,onMenuClosed:this.handleMenuExited,menuStyle:{maxWidth:"100rem"}})]})})})}}pn(dt,"MENU_NAVIGATION_DIRECTION",Hs);pn(dt,"DROP_DOWN_MENU_HEIGHT",125);pn(dt,"defaultProps",{onChange(){},value:null,disabled:!1,popperOptions:{},icon:ar,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 ry=dt;var iy=W.module("DateInput"),ay="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",sy=["2000-01-01","2022-12-31"],oy="YYYY-MM-DD",_f=X.forwardRef((n,e)=>{var{className:t="",onChange:r=()=>{},defaultValue:i="",onFocus:a=()=>{},onBlur:s=()=>{},"data-testid":o}=n,[l,d]=c.useState(i),[h,f]=c.useState(),v=c.useCallback(p=>{iy.debug("handleChange",p),d(p),r(p)},[r]);return u.jsx("div",{className:"d-flex flex-row align-items-center",children:u.jsx(jo,{ref:e,className:Y(t),example:sy,getNextSegmentValue:rC,onChange:v,onSelect:f,pattern:ay,placeholder:oy,selection:h,value:l,onFocus:a,onBlur:s,"data-testid":o})})});_f.displayName="DateInput";const ly=_f;function Tf(n,e,t){return e=dy(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function dy(n){var e=uy(n,"string");return typeof e=="symbol"?e:String(e)}function uy(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 Of extends c.PureComponent{constructor(e){super(e),Tf(this,"searchInput",void 0),this.searchInput=X.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=Le(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:s}=this.state;return u.jsx(Ci,{value:s,placeholder:e,onChange:this.handleChange,className:t,matchCount:r,ref:this.searchInput,id:i,"data-testid":a})}}Tf(Of,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});const Df=Of;function hy(n){var{isInvalid:e=!1,items:t,onAdd:r=()=>{},onDelete:i=()=>{},validate:a=()=>null}=n,[s,o]=c.useState(null),[l,d]=c.useState([]),[h,f]=c.useState(""),v=c.useCallback(y=>{d(y)},[]),p=c.useCallback(()=>{i(oa.getItemsInRanges(t,l)),d([])},[t,l,i]),m=c.useCallback(()=>{if(h!==""){var y=a(h);y==null?(r(h),f("")):o(y)}},[h,r,a]),b=c.useCallback(y=>{var{value:w}=y.target;f(w),o(w===""?null:a(w))},[a]),g=c.useCallback(()=>{d([])},[]),C=c.useCallback(y=>{y.key==="Enter"&&m()},[m]),S=c.useMemo(()=>14+Jn(t.length,1,6)*br.DEFAULT_ROW_HEIGHT,[t.length]);return u.jsxs("div",{className:Y("editable-item-list-container",{"is-invalid":e}),children:[u.jsx("div",{style:{height:S},children:u.jsx(br,{itemCount:t.length,items:t.map((y,w)=>({value:y,isSelected:oa.isSelected(l,w)})),offset:0,selectedRanges:l,onSelectionChange:v,isMultiSelect:!0})}),u.jsxs("div",{className:"d-flex flex-row pt-2",children:[u.jsx("div",{className:"d-flex flex-grow-1",children:u.jsx("input",{className:Y("form-control",{"is-invalid":s!=null}),placeholder:"Enter value",type:"text",value:h,onChange:b,onFocus:g,onKeyDown:C})}),u.jsxs("div",{className:"d-flex align-items-start mt-1 ml-2",children:[u.jsx(K,{kind:"ghost",onClick:m,disabled:s!=null||h==="",icon:gg,tooltip:"Add new item","data-testid":"add-item-button"}),u.jsx(K,{kind:"ghost",onClick:p,disabled:l.length===0,icon:kn,tooltip:"Delete selected items","data-testid":"delete-item-button"})]})]})]})}var cy=W.module("ErrorBoundary");class fy extends c.Component{static getDerivedStateFromError(e){return{error:e}}constructor(e){super(e),this.state={error:void 0}}componentDidCatch(e,t){var{onError:r}=this.props;cy.error("Error caught by ErrorBoundary",e,t),r==null||r(e,t)}render(){var{children:e,className:t,fallback:r}=this.props,{error:i}=this.state;return i!=null?r??u.jsx("div",{className:t,children:u.jsx(Ne,{errorMessage:"".concat(i),isLoading:!1,isLoaded:!1})}):e}}function vy(n,e,t){return e=py(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function py(n){var e=my(n,"string");return typeof e=="symbol"?e:String(e)}function my(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 or 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),s=a.get(e);if(s instanceof Map){var o=new Map(s);if(t!=null)o.set(t,s.get(t)===void 0);else{var l=or.isParentSelected(e,a),d=l==null||!l;s.forEach((v,p)=>o.set(p,d))}a.set(e,o)}else a.set(e,s==null||!s);var h=a.get(e);if(t===void 0&&h!==void 0&&typeof h!="boolean"){var f=or.isParentSelected(e,r);f!=null&&f?h.forEach((v,p)=>h.set(p,!1)):h.forEach((v,p)=>h.set(p,!0))}i(a)}setAllValues(e){var{valueMap:t,onUpdateValueMap:r}=this.props,i=new Map;t.forEach((a,s)=>{if(typeof a=="boolean")i.set(s,e);else{var o=new Map;a.forEach((l,d)=>o.set(d,e)),i.set(s,o)}}),r(i)}selectAll(){this.setAllValues(!0)}clear(){this.setAllValues(!1)}renderMenuElement(){var{valueMap:e,"data-testid":t}=this.props;return u.jsxs("div",{className:"hcm-menu-container",children:[Array.from(e.entries()).map(r=>{var[i,a]=r;return u.jsxs("div",{children:[u.jsx(la,{className:"hcm-parent",checked:or.isParentSelected(i,e),onChange:()=>this.toggleValueFor(i),children:i}),a!==void 0&&typeof a!="boolean"&&Array.from(a.entries()).map(s=>{var[o,l]=s;return u.jsx(la,{className:"hcm-child",checked:l,onChange:()=>this.toggleValueFor(i,o),children:o},o)})]},i)}),u.jsx(K,{kind:"ghost",onClick:this.selectAll,"data-testid":t!==void 0?"".concat(t,"-btn-select-all"):void 0,children:"Select All"}),u.jsx(K,{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:s}=this.state;return u.jsxs("button",{type:"button",className:Y("btn hcm-btn",t),onClick:this.toggleMenu,id:i,"data-testid":a,children:[u.jsxs("span",{children:[r&&u.jsx(ne,{icon:r,className:"hcm-icon mr-1"}),e]}),u.jsx("span",{className:"cs-caret"}),u.jsx(La,{options:{placement:"bottom"},isShown:s,onExited:()=>{this.setState({menuIsOpen:!1})},closeOnBlur:!0,interactive:!0,children:this.renderMenuElement()})]})}}vy(or,"defaultProps",{className:"",icon:null,id:"","data-testid":void 0});const gy=or;function gd(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 ps(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?gd(Object(t),!0).forEach(function(r){by(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):gd(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function by(n,e,t){return e=Cy(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cy(n){var e=Sy(n,"string");return typeof e=="symbol"?e:String(e)}function Sy(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 If=c.memo(n=>{var{tab:e,onClose:t,onSelect:r,isActive:i,activeRef:a,index:s,isDraggable:o,contextActions:l}=n,{key:d,isClosable:h=t!=null,title:f}=e;return u.jsx(eg,{draggableId:d,index:s,isDragDisabled:!o,children:(v,p)=>u.jsxs("div",{className:"context-menu-wrapper",ref:i?a:null,children:[u.jsxs("div",ps(ps(ps({ref:v.innerRef},v.draggableProps),v.dragHandleProps),{},{className:Y("btn btn-link btn-nav-tab",{active:i},{dragging:p.isDragging}),"data-testid":"btn-nav-tab-".concat(f),role:"tab",tabIndex:0,onClick:m=>{m.target.focus(),r(d)},onKeyPress:m=>{m.key==="Enter"&&r(d)},children:[f,h&&u.jsx(K,{kind:"ghost",className:"btn-nav-tab-close",onClick:m=>{t==null||t(d),m.stopPropagation(),m.preventDefault()},icon:To,tooltip:"Close"})]})),u.jsx(ae,{actions:l})]})},d)});If.displayName="NavTab";const yy=If;function bd(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 Cd(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bd(Object(t),!0).forEach(function(r){Ey(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):bd(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ey(n,e,t){return e=wy(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wy(n){var e=Py(n,"string");return typeof e=="symbol"?e:String(e)}function Py(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 _y=500,Ty=.01,Oy=5e-4;function Sd(n){return n.scrollLeft===0}function yd(n){return n.scrollLeft+n.clientWidth===n.scrollWidth||n.scrollWidth===0}function Dy(n,e,t){var{isClosable:r=!1,key:i}=n,a=[];if(r&&t!=null){a.push({title:"Close",order:10,group:20,action:()=>{t(i)}});for(var s=!0,o=e.length-1;o>0&&e[o].key!==n.key;o-=1)if(e[o].isClosable===!0){s=!1;break}a.push({title:"Close to the Right",order:20,group:20,action:()=>{for(var l=e.length-1;l>0&&e[l].key!==i;l-=1)e[l].isClosable===!0&&t(e[l].key)},disabled:s}),a.push({title:"Close All",order:30,group:20,action:()=>{e.forEach(l=>{l.isClosable===!0&&t(l.key)})}})}return a}function Iy(n){var{activeKey:e,tabs:t,onSelect:r,onReorder:i,onClose:a,makeContextActions:s}=n,o=c.useRef(),[l,d]=c.useState(!0),[h,f]=c.useState(!0),[v,p]=c.useState(!0),m=c.useCallback(()=>{o.current!=null&&(o.current.clientWidth<o.current.scrollWidth&&t.length>0?d(!0):d(!1),f(Sd(o.current)),p(yd(o.current)))},[t]);$o(o.current,m);var b=c.useCallback(I=>{js.stopDragging(),I.destination&&(i==null||i(I.source.index,I.destination.index))},[i]),g=c.useCallback(()=>{if(o.current!=null){var I=Sd(o.current);I!==h&&f(I);var N=yd(o.current);N!==v&&p(N)}},[h,v]),C=c.useRef({cancelClick:!1}),S=c.useCallback(()=>{if(!(o.current==null||C.current.cancelClick))for(var{children:I}=o.current,N=I.length-1;N>=0;N-=1){var A=I[N];if(A.offsetLeft<o.current.scrollLeft-5){A.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"});return}}},[]),y=c.useCallback(()=>{if(!(o.current==null||C.current.cancelClick))for(var{children:I}=o.current,N=0;N<I.length;N+=1){var A=I[N];if(A.offsetLeft+5>o.current.scrollLeft+o.current.offsetWidth){A.scrollIntoView({behavior:"smooth",block:"nearest",inline:"end"});return}}},[]),w=c.useCallback(function(I,N){var A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,k=arguments.length>3?arguments[3]:void 0,V=o.current;V!=null&&(C.current.cancelClick=!0,I==="left"?V.scrollLeft=N-A:I==="right"&&(V.scrollLeft=N+A),C.current.rAF=requestAnimationFrame(q=>{var re=k??q,B=q-re,x=Ty*B+.5*Oy*B**2;x=Math.min(x,V.scrollWidth),w(I,N,x,re)}))},[]),E=c.useCallback(()=>{var{holdTimer:I,rAF:N}=C.current;I!=null&&(clearTimeout(I),C.current.holdTimer=void 0),N!=null&&(cancelAnimationFrame(N),C.current.rAF=void 0),window.removeEventListener("mouseup",E)},[]);c.useEffect(()=>()=>window.removeEventListener("mouseup",E),[E]);var D=c.useCallback(I=>{o.current!=null&&(C.current.holdTimer=window.setTimeout(w,_y,I,o.current.scrollLeft)),C.current.cancelClick=!1,window.addEventListener("mouseup",E)},[E,w]),T=c.useCallback(()=>{D("left")},[D]),O=c.useCallback(()=>{D("right")},[D]);c.useEffect(function(){var N,A=k=>{k.stopPropagation(),k.preventDefault();var V=k.currentTarget,q=Math.abs(k.deltaY)>Math.abs(k.deltaX)?k.deltaY:k.deltaX;V.scrollLeft+=Jn(q,-30,30)};return(N=o.current)===null||N===void 0||N.addEventListener("wheel",A),()=>{var k;(k=o.current)===null||k===void 0||k.removeEventListener("wheel",A)}},[]);var M=c.useMemo(()=>{var I=new Map;return t.forEach(N=>{var{key:A}=N,k=[()=>Dy(N,t,a),()=>{var V;return(V=s==null?void 0:s(N))!==null&&V!==void 0?V:[]}];I.set(A,k)}),I},[s,t,a]),j=c.useRef(null),H=t.find(I=>I.key===e),L=t.map((I,N)=>{var{key:A}=I,k=I===H;return u.jsx(yy,{tab:I,index:N,isActive:k,activeRef:j,onSelect:r,onClose:a,isDraggable:i!=null,contextActions:M.get(A)},A)});return c.useEffect(function(){j.current!=null&&j.current.scrollIntoView({block:"nearest",inline:"nearest"})},[e]),u.jsxs("nav",{className:"nav-container",children:[l&&u.jsx(K,{kind:"ghost",icon:u.jsx(ne,{icon:bg,transform:"grow-4"}),className:"tab-controls-btn tab-controls-btn-left",tooltip:"Scroll left",onClick:S,onMouseDown:T,disabled:h}),u.jsx(tg,{onDragStart:js.startDragging,onDragEnd:b,children:u.jsx(ng,{droppableId:"droppable-tab-navigation",direction:"horizontal",children:(I,N)=>u.jsxs("div",Cd(Cd({ref:A=>{A!=null&&(o.current=A,I.innerRef(A))}},I.droppableProps),{},{className:Y("nav nav-tabs",{dragging:N.draggingFromThisWith}),role:"tablist",onScroll:g,children:[L,I.placeholder]}))})}),l&&u.jsx(K,{kind:"ghost",icon:u.jsx(ne,{icon:Cg,transform:"grow-4"}),className:"tab-controls-btn tab-controls-btn-right",tooltip:"Scroll right",onClick:y,onMouseDown:O,disabled:v})]})}function xy(){var{selectedThemeKey:n,setSelectedThemeKey:e,themes:t}=xr(),r=c.useCallback(i=>{e(i)},[e]);return u.jsx(pc,{label:"Pick a color scheme",items:t,selectedKey:n,onSelectionChange:r,children:i=>u.jsx(vi,{children:i.name},i.themeKey)})}function Ny(n){var{className:e,style:t}=n;return u.jsx("div",{className:Y("dh-logo",e),style:t})}var My=.025,Ly=.9,Ay=.1,Fy=.618,Ed=80,Kn={SIZE:8,DOT_SIZE:2},nn=18,jy=250,Ry=60*1e3,ky={background:"var(--dh-color-random-area-plot-animation-bg)",foregroundFill:"var(--dh-color-random-area-plot-animation-fg-fill)",foregroundStroke:"var(--dh-color-random-area-plot-animation-fg-stroke)",gridColor:"var(--dh-color-random-area-plot-animation-grid)"};function $y(){return Oo(ky)}var Uy=X.memo(()=>{var{activeThemes:n}=xr(),e=c.useMemo($y,[n]),t=c.useRef(null),r=c.useRef(null),[i,a]=c.useState(!1),s=window.devicePixelRatio,o,l,d,h,f,v=null,p=[];function m(){var L;r.current!=null&&(d=r.current.offsetWidth,h=r.current.offsetHeight),t.current!=null&&(t.current.style.width="".concat(d,"px"),t.current.style.height="".concat(h,"px"),t.current.width=d*s,t.current.height=h*s),(L=o)===null||L===void 0||L.scale(s,s)}function b(){var{foregroundFill:L,foregroundStroke:I}=e,N=document.createElement("canvas");N.width=Kn.SIZE,N.height=Kn.SIZE;var A=N.getContext("2d");return A!=null&&(A.fillStyle=I,A.fillRect(0,0,Kn.DOT_SIZE,Kn.DOT_SIZE),A.fillStyle=L,A.fillRect(0,0,Kn.SIZE,Kn.SIZE)),A==null?void 0:A.createPattern(N,"repeat")}function g(L){var I=Math.random()-.5,N=My*I;return L<Ay?N=Math.abs(N):L>Ly&&(N=-Math.abs(N)),L+N}function C(){for(var L=[],I=Fy,N=0;N<d+nn;N+=1)I=g(I),L.push(I);return L}function S(){for(;p.length>=d+nn;)p.pop();for(;p.length<d+nn;)p.push(g(p[p.length-1]))}function y(L,I){I.beginPath(),I.moveTo(-1,h+1),I.lineTo(-1,h*L[0]);for(var N=0;N<L.length;N+=1)I.lineTo(N,h*L[N]);I.lineTo(d+nn,h*L[L.length-1]),I.lineTo(d+nn,h+1),I.closePath()}function w(L){L.beginPath();for(var I=1;I<d;I+=Ed)L.moveTo(I,0),L.lineTo(I,h);for(var N=1;N<h;N+=Ed)L.moveTo(0,N),L.lineTo(d,N)}function E(L){var I,N,A;v=(I=v)!==null&&I!==void 0?I:L;var{background:k,foregroundStroke:V,gridColor:q}=e;z(o),o.fillStyle=k,o.fillRect(0,0,d,h),w(o),o.lineWidth=1,o.strokeStyle=q,o.stroke();var re=(((N=v)!==null&&N!==void 0?N:0)-(L??0))/(1e3/nn);if(o.translate(re,0),y(p,o),o.lineWidth=2,o.strokeStyle=V,o.stroke(),o.translate(-re,0),l!=null&&(o.fillStyle=l),o.fill(),o.setTransform(s,0,0,s,0,0),(L??0)-((A=v)!==null&&A!==void 0?A:0)>1e3/nn){for(var B,x=Math.floor(((L??0)-((B=v)!==null&&B!==void 0?B:0))/(1e3/nn)),P=0;P<x;P+=1)p.shift(),p.push(g(p[p.length-1]));v=L}f!=null&&cancelAnimationFrame(f),f=requestAnimationFrame(E)}var D=Le(()=>{f=requestAnimationFrame(L=>{m(),S(),a(!1),E(L)})},jy,{leading:!0});function T(){a(!0),f!=null&&cancelAnimationFrame(f),f=null,v=null}var O=Le(()=>{T()},Ry);function M(){f==null&&(a(!1),m(),S(),f=requestAnimationFrame(E)),O()}function j(){document.hasFocus()&&M()}function H(){f!=null&&cancelAnimationFrame(f),O(),D()}return c.useEffect(()=>{var L;return o=(L=t.current)===null||L===void 0?void 0:L.getContext("2d",{alpha:!1}),m(),p=C(),l=b(),E(),O(),window.addEventListener("resize",H),window.addEventListener("focus",M),window.addEventListener("blur",T),window.addEventListener("mousemove",j),window.addEventListener("keydown",j),()=>{f!=null&&cancelAnimationFrame(f),window.removeEventListener("resize",H),window.removeEventListener("focus",M),window.removeEventListener("blur",T),window.removeEventListener("mousemove",j),window.removeEventListener("keydown",j),O.cancel(),D.cancel()}},[e]),u.jsx("div",{className:"random-area-plot-animation-container",ref:r,children:u.jsx("canvas",{ref:t,className:i?"shade":""})})});const xf=Uy;function Nf(n){var{text:e,placement:t="top-start"}=n,r=c.useMemo(()=>({placement:t}),[t]);return u.jsxs(u.Fragment,{children:[u.jsx(wo,{UNSAFE_className:Fa.spectrumEllipsis,children:e??u.jsx(u.Fragment,{children:" "})}),e==null||e===""?null:u.jsx(mt,{options:r,children:e})]})}var Hy=["scrollRef","getItemDisplayText","getKey"];function wd(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 Pd(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wd(Object(t),!0).forEach(function(r){Vy(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):wd(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Vy(n,e,t){return e=By(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function By(n){var e=Wy(n,"string");return typeof e=="symbol"?e:String(e)}function Wy(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 Gy(n,e){if(n==null)return{};var t=zy(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 zy(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 Ky(n){var{scrollRef:e,getItemDisplayText:t,getKey:r}=n,i=Gy(n,Hy),a=c.useCallback(s=>{var o=r(s),l=t(s);return u.jsx(vi,{textValue:l??String(o),children:u.jsx(Nf,{text:l})},o)},[t,r]);return u.jsx(rg,Pd(Pd({},i),{},{ref:e,menuTrigger:"focus",onSelectionChange:i.onSelectionChange,children:a}))}var Ho=X.forwardRef((n,e)=>{var{children:t,className:r,disabled:i,id:a,isLinked:s,isLinkedSource:o,isInvalid:l,onClick:d,onMouseEnter:h,onMouseLeave:f,style:v,"data-testid":p}=n;return u.jsxs("button",{ref:e,type:"button",className:Y("btn-socketed",{"btn-socketed-linked":s!==void 0&&s||o},{"btn-socketed-linked-source":o},{"is-invalid":l},r),id:a,onClick:d,onMouseEnter:h,onMouseLeave:f,style:v,disabled:i,"data-testid":p,children:[t,u.jsx(ne,{icon:Sg,className:"linked btn-socketed-icon",transform:"down-1"}),u.jsx(ne,{icon:yg,className:"is-invalid btn-socketed-icon"})]})});Ho.displayName="SocketedButton";Ho.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 Vo=Ho;var qy=W.module("PickerUtils"),Vs="Picker items must be strings, numbers, booleans, <Item> or <Section> elements:";function li(n){return c.isValidElement(n)&&n.type===Po}function Bo(n){return c.isValidElement(n)&&n.type===vi}function Mf(n){return typeof n=="string"||typeof n=="number"||typeof n=="boolean"||Bo(n)||li(n)}function Lf(n){return"items"in n}function _d(n){var e;return typeof n!="object"?n:n.key!=null?n.key:li(n)?typeof n.props.title=="string"?n.props.title:"":(e=n.props.textValue)!==null&&e!==void 0?e:typeof n.props.children=="string"?n.props.children:""}function Yy(n){return typeof n!="object"?String(n):n.props.textValue!=null?n.props.textValue:typeof n.props.children=="string"?n.props.children:""}function Xy(n){if(!Mf(n))throw qy.debug(Vs,n),new Error(Vs);if(li(n)){var e=_d(n),{title:t}=n.props,r=Wo(n.props.children).filter(o=>!li(o));return{key:e,title:t,items:r}}var i=_d(n),a=Bo(n)?n.props.children:n,s=Yy(n);return{key:i,content:a,textValue:s}}function Wo(n){var e=Array.isArray(n)?n:[n];return e.map(Xy)}function Af(n){return n==null||n===!1?null:n===!0?{placement:"top-start"}:n}function Zy(n){var{children:e}=n;return c.isValidElement(e)?e:(e===""&&(e=u.jsx(u.Fragment,{children:" "})),typeof e=="boolean"&&(e=String(e)),u.jsx(wo,{UNSAFE_className:Fa.spectrumEllipsis,children:e}))}var Qy=["children","tooltip","defaultSelectedKey","selectedKey","onChange","onSelectionChange","UNSAFE_className"];function Td(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 Od(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Td(Object(t),!0).forEach(function(r){Jy(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Td(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Jy(n,e,t){return e=eE(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function eE(n){var e=tE(n,"string");return typeof e=="symbol"?e:String(e)}function tE(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 nE(n,e){if(n==null)return{};var t=rE(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 rE(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 iE(n){var{children:e,tooltip:t=!0,defaultSelectedKey:r,selectedKey:i,onChange:a,onSelectionChange:s,UNSAFE_className:o}=n,l=nE(n,Qy),d=c.useMemo(()=>Wo(e),[e]),h=c.useMemo(()=>Af(t),[t]),f=c.useCallback(v=>{var{key:p,content:m,textValue:b}=v;return u.jsxs(vi,{textValue:b===""?"Empty":b,children:[u.jsx(Zy,{children:m}),h==null||m===""?null:u.jsx(mt,{options:h,children:typeof m=="boolean"?String(m):m})]},p)},[h]);return u.jsx(pc,Od(Od({},l),{},{UNSAFE_className:Y("dh-picker",o),items:d,selectedKey:i,defaultSelectedKey:r,onSelectionChange:a??s,children:v=>Lf(v)?u.jsx(Po,{title:v.title,items:v.items,children:f},v.key):f(v)}))}var aE=500;function sE(n){var{heading:e,content:t,delayMs:r=aE}=n,[i,a]=c.useState(!1);return c.useEffect(()=>{window.setTimeout(()=>{a(!0)},r)},[r]),i?u.jsxs(ig,{children:[u.jsx(Eo,{size:"XXL",children:u.jsx(ne,{icon:Eg})}),u.jsx(fc,{children:e}),t==null?null:u.jsx(vc,{children:t})]}):null}const oE="_modified_5rbci_24",lE="_track_5rbci_35",dE="_handle_5rbci_15",uE="_ticks_5rbci_103",Ff={"handle-size":"15px","popover-width":"90px","time-slider":"_time-slider_5rbci_5","time-slider-popovers":"_time-slider-popovers_5rbci_10","handle-popper":"_handle-popper_5rbci_15",modified:oE,"flex-spacer":"_flex-spacer_5rbci_31",track:lE,"track-fills":"_track-fills_5rbci_42","track-fill":"_track-fill_5rbci_42","track-fill-start":"_track-fill-start_5rbci_60","track-fill-middle":"_track-fill-middle_5rbci_61","track-fill-end":"_track-fill-end_5rbci_64","handle-track":"_handle-track_5rbci_67",handle:dE,ticks:uE,"tick-labels":"_tick-labels_5rbci_121","tick-label":"_tick-label_5rbci_121","tick-label-wrapper":"_tick-label-wrapper_5rbci_137"};var ji=parseInt(Ff["handle-size"],10),Dd=parseInt(Ff["popover-width"],10),ft=24*60*60-1,Id=5*60;function hE(n){var{startTime:e,endTime:t,onChange:r,isStartModified:i=!1,isEndModified:a=!1,"data-testid":s}=n,[o,l]=c.useState(e),[d,h]=c.useState(t),f=c.useRef(null);c.useEffect(function(){l(e),h(t)},[e,t]);var v=c.useCallback((b,g)=>{var C=b,S=g;C===S&&(S<ft?S+=1:C-=1),l(C),h(S),r({startTime:C,endTime:S})},[l,h,r]),p=c.useCallback(b=>{v(b,d)},[v,d]),m=c.useCallback(b=>{v(o,b)},[v,o]);return u.jsxs("div",{className:"time-slider","data-testid":s,children:[u.jsx(cE,{startTime:o,endTime:d,onStartTimeChange:p,onEndTimeChange:m,isStartModified:i,isEndModified:a}),u.jsxs("div",{className:"track",ref:f,children:[u.jsx(fE,{startTime:o,endTime:d}),u.jsx("div",{className:"ticks",children:Array(24).fill(null).map((b,g)=>u.jsx("div",{className:"tick"},g))}),u.jsx(xd,{track:f,time:o,setTime:p}),u.jsx(xd,{track:f,time:d,setTime:m})]}),u.jsxs("div",{className:"tick-labels",children:[u.jsx("div",{className:"tick-label",children:"0:00"}),u.jsx("div",{className:"tick-label-wrapper",children:Array(24).fill(null).map((b,g)=>u.jsx("div",{className:"tick-label",children:"".concat(g+1,":00")},g))})]})]})}function cE(n){var{startTime:e,endTime:t,onStartTimeChange:r,onEndTimeChange:i,isStartModified:a,isEndModified:s,"data-testid":o}=n,l=e>t,[d,h]=c.useState(l?t:e),[f,v]=c.useState(l?e:t),p=c.useRef(null),m=c.useRef(null),b=c.useRef(null),g=c.useRef(null);c.useEffect(function(){h(e>t?t:e),v(e>t?e:t)},[e,t]),c.useEffect(function(){if(b.current!==null){var D;(D=m.current)===null||D===void 0||D.setSelection(b.current)}if(g.current!==null){var T;(T=p.current)===null||T===void 0||T.setSelection(g.current)}},[l]);function C(E){e<=t?r(E):i(E)}function S(E){e<=t?i(E):r(E)}var y=c.useCallback(E=>{b.current=E,g.current=null},[]),w=c.useCallback(E=>{b.current=null,g.current=E},[]);return u.jsxs("div",{className:"time-slider-popovers",children:[u.jsx("div",{className:"flex",style:{flexBasis:"calc(".concat(d/ft*100,"% - ").concat(Dd/2,"px)")}}),u.jsxs("div",{className:"handle-popper",children:[u.jsx("label",{className:Y({modified:l?s:a}),children:l?"End Time":"Start Time"}),u.jsx(ua,{ref:p,allowValueWrapping:!1,value:d,onChange:C,onSelect:y,"data-testid":o!==void 0?"".concat(o,"-input-1"):void 0})]}),u.jsx("div",{className:"flex-spacer"}),u.jsxs("div",{className:"handle-popper",children:[u.jsx("label",{className:Y({modified:l?a:s}),children:l?"Start Time":"End Time"}),u.jsx(ua,{ref:m,allowValueWrapping:!1,value:f,onChange:S,onSelect:w,"data-testid":o!==void 0?"".concat(o,"-input-2"):void 0})]}),u.jsx("div",{className:"flex",style:{flexBasis:"calc(".concat((ft-f)/ft*100,"% - ").concat(Dd/2,"px)")}})]})}function fE(n){var{startTime:e,endTime:t,"data-testid":r}=n;return u.jsxs("div",{className:"track-fills","data-testid":r,children:[e>t&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"track-fill track-fill-start",style:{transform:"scaleX(".concat(t/ft,")")}}),u.jsx("div",{className:"track-fill track-fill-end",style:{transform:"scaleX(".concat((ft-e)/ft,")")}})]}),e<t&&u.jsx("div",{className:"track-fill track-fill-middle",style:{transform:"translateX(".concat(e/ft*100,"%) scaleX(").concat((t-e)/ft,")")}})]})}function xd(n){var{track:e,time:t,setTime:r,"data-testid":i}=n,a=c.useMemo(()=>{var v=3600,p=ji/2;return t<v?p=t/v*(ji/2):t>23*v&&(p=ji/2+1/(ft-23*v)*(t-23*v)*(ji/2)),"translateX(calc(".concat(t/ft*100,"% - ").concat(p,"px))")},[t]),s=c.useCallback(v=>{if(!e.current)return 0;var p=e.current.getBoundingClientRect(),m=Math.max(v-p.left,0),b=ft*Math.min(1,m/p.width),g=Id*Math.round(b/Id),C=Math.min(ft,g);return C},[e]),o=c.useCallback(v=>{var{clientX:p}=v;r(s(p))},[r,s]),l=c.useCallback(v=>{var{clientX:p}=v;r(s(p)),window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",l),document.documentElement.classList.remove("drag-pointer-events-none")},[r,s,o]),d=c.useCallback(()=>{window.addEventListener("mousemove",o),window.addEventListener("mouseup",l),document.documentElement.classList.add("drag-pointer-events-none")},[o,l]),h=c.useCallback(()=>{window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",l),document.documentElement.classList.remove("drag-pointer-events-none")},[o,l]),f=c.useCallback(()=>{d()},[d]);return c.useEffect(function(){return()=>{h()}},[h]),u.jsx("div",{className:"handle-track",style:{transform:a},children:u.jsx("button",{className:"handle",type:"button","aria-label":"Change time",onMouseDown:f,"data-testid":i})})}function jf(n){var{buttons:e,isShown:t=!1,classNames:r,message:i,type:a,onClick:s,onDismiss:o,"data-testid":l}=n,d=e&&e.length!==0;return u.jsx(Fn,{in:t,timeout:jn.transitionMs,classNames:"toast-notification-slide-up",mountOnEnter:!0,unmountOnExit:!0,children:u.jsxs("div",{className:Y("toast-notification",r,a),role:"presentation",onClick:s,onKeyPress:s,"data-testid":l,children:[u.jsx("div",{className:"message-container",children:u.jsx("span",{className:"message",children:i})}),u.jsx(Fn,{in:d,timeout:jn.transitionSlowMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:u.jsx("div",{className:"buttons-container",children:e})}),o&&u.jsx(K,{kind:"ghost",icon:To,tooltip:"Close notification",className:"my-2",onClick:o})]})})}jf.TYPE=Object.freeze({ERROR:"error"});function vE(n){var{children:e,className:t,labelText:r,hintText:i,isModified:a,validationError:s,showValidationError:o=!0,"data-testid":l,id:d}=n,{current:h}=c.useRef(d??ye());return u.jsxs(u.Fragment,{children:[u.jsx("label",{className:Y("validate-label",t,{modified:a}),htmlFor:h,"data-testid":l,children:r}),X.Children.toArray(e).map(f=>X.isValidElement(f)?X.cloneElement(f,{className:Y(f.props.className,{"is-invalid":s})}):u.jsx("div",{className:Y(t),children:f})),i!==void 0&&u.jsx("small",{className:"form-text text-muted",children:i}),s!==void 0&&o&&u.jsx("p",{className:"validate-label-error text-danger",children:s})]})}const pE=Object.freeze(Object.defineProperty({__proto__:null,ActionButtonDialogTrigger:af,AutoCompleteInput:HS,AutoResizeTextarea:Uo,BasicModal:Cn,BulkActionBar:KS,Button:K,ButtonGroup:yi,ButtonOld:Us,CSS_VAR_EXPRESSION_PREFIX:wg,CardFlip:ka,Checkbox:la,Collapse:XS,ComboBox:iC,ConfirmActionButton:xS,ConfirmationDialog:yf,ContextActionUtils:Cb,ContextActions:ae,ContextMenuItem:Sb,ContextMenuRoot:Ic,CopyButton:zc,CustomTimeSelect:ry,DEFAULT_DARK_THEME_KEY:Pg,DEFAULT_DARK_THEME_PALETTE:_g,DEFAULT_GET_PREFERRED_REPLACEMENT_STRING:Gc,DEFAULT_LIGHT_THEME_KEY:Tg,DEFAULT_PRELOAD_DATA_VARIABLES:Og,DateInput:ly,DateTimeInput:aC,DebouncedModal:VS,DebouncedSearchInput:Df,DragUtils:js,DraggableItemList:sC,DropdownMenu:gn,EditableItemList:hy,ErrorBoundary:fy,GLOBAL_SHORTCUTS:Cr,HierarchicalCheckboxMenu:gy,INVALID_PICKER_ITEM_ERROR_MESSAGE:Vs,IconActionButton:Ef,InfoModal:BS,Item:vi,ItemList:br,ItemListItem:oC,get KEY(){return ve},LoadingOverlay:Ne,LoadingSpinner:Da,Logo:Ny,get MODIFIER(){return pe},MaskedInput:jo,Menu:lC,MenuItem:dC,Modal:gi,ModalBody:bi,ModalFooter:ja,ModalHeader:Oa,NON_WHITESPACE_REGEX:Dg,NavTabList:Iy,Option:uC,Page:hC,Picker:iE,Popper:La,RadioGroup:Kc,RadioItem:Rs,RandomAreaPlotAnimation:xf,SVG_ICON_MANUAL_COLOR_MAP:Ig,SearchInput:Ci,SearchableCombobox:Ky,Section:Po,Select:Rn,SelectValueList:qc,Shortcut:cC,ShortcutRegistry:Ke,SocketedButton:Vo,Stack:fC,THEME_CACHE_LOCAL_STORAGE_KEY:xg,TMP_CSS_PROP_PREFIX:Ng,TableViewEmptyState:sE,TextWithTooltip:Nf,ThemeContext:vC,ThemeExport:jn,ThemePicker:xy,ThemeProvider:Yc,TimeInput:ua,TimeSlider:hE,ToastNotification:jf,Tooltip:mt,UISwitch:Xc,ValidateLabelInput:vE,WHITESPACE_REGEX:Mg,calculatePreloadStyleContent:Lg,createCssVariableResolver:Ag,createPreloadStyleElement:Fg,extractDistinctCssVariableExpressions:jg,fillToLength:pC,getActiveThemes:Rg,getDefaultBaseThemes:kg,getExpressionRanges:Cc,getThemeKey:Sc,getThemePreloadData:$g,isItemElement:Bo,isNormalizedPickerSection:Lf,isPickerItemOrSection:Mf,isSectionElement:li,normalizePickerItemList:Wo,normalizeTooltipOptions:Af,overrideSVGFillColors:Ug,preloadTheme:Hg,replaceSVGFillColor:Vg,resolveCssVariablesInRecord:Oo,resolveCssVariablesInString:Bg,setThemePreloadData:Wg,themeDHDefault:mC,themeDark:Gg,themeLight:zg,trimTrailingMask:gC,useTheme:xr},Symbol.toStringTag,{value:"Module"}));function mE(n,e){var t=Ve(),r=c.useMemo(()=>new t.CoreClient(n,e),[t,n,e]);return c.useEffect(()=>()=>{r.disconnect()},[r]),r}var Go=c.createContext(null);function Rf(n){var{serverUrl:e,options:t,children:r}=n,i=mE(e,t);return u.jsx(Go.Provider,{value:i,children:r})}function Nd(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function gE(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){Nd(a,r,i,s,o,"next",l)}function o(l){Nd(a,r,i,s,o,"throw",l)}s(void 0)})}}var kf=c.createContext(null);function $f(n){var[e,t]=c.useState(null),[r,i]=c.useState(null),a=c.useContext(kf),s=c.useContext(Ia);return c.useEffect(()=>{if(a==null){if(s!=null){t(s),i(null);return}t(null),i(new Error("No API available in useDeferredApi. Was code wrapped in ApiBootstrap or DeferredApiContext.Provider?"));return}var o=!1;function l(){return d.apply(this,arguments)}function d(){return d=gE(function*(){if(typeof a=="function")try{var h=yield a(n);o||(t(h),i(null))}catch(f){o||(t(null),i(f))}else t(a)}),d.apply(this,arguments)}return l(),()=>{o=!0}},[s,a,n]),[e,r]}var Uf=X.memo(n=>{var{children:e,onError:t,widget:r}=n,[i,a]=$f(r);return a!=null?(t==null||t(a),null):i==null?null:u.jsx(Ia.Provider,{value:i,children:e})});Uf.displayName="DeferredApiBootstrap";function $n(){return Ir(Go,"No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?")}function zo(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.name!=null}function Ko(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.id!=null}function bE(n){return zo(n)||Ko(n)}var qo=c.createContext(null);function Hf(n){if(Ko(n))return{id:n.id,type:n.type};if(zo(n)){var e;return{name:(e=n.name)!==null&&e!==void 0?e:"",type:n.type}}throw new Error("Invalid descriptor: ".concat(n))}function Vf(n){var e,t;return{type:(e=n.type)!==null&&e!==void 0?e:"",name:(t=n.title)!==null&&t!==void 0?t:n.name,id:n.id}}function Bf(){return Ir(qo,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}const CE=Object.freeze(Object.defineProperty({__proto__:null,ApiBootstrap:Kg,ApiContext:Ia,ClientBootstrap:Rf,ClientContext:Go,DeferredApiBootstrap:Uf,DeferredApiContext:kf,ObjectFetcherContext:qo,getVariableDescriptor:Vf,isIdVariableDescriptor:Ko,isNameVariableDescriptor:zo,isVariableDescriptor:bE,sanitizeVariableDescriptor:Hf,useApi:Ve,useClient:$n,useDeferredApi:$f,useObjectFetcher:Bf},Symbol.toStringTag,{value:"Module"}));function SE(n){return function(t){var{children:r}=t;return u.jsx(Ia.Provider,{value:n,children:r})}}function Md(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function yE(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){Md(a,r,i,s,o,"next",l)}function o(l){Md(a,r,i,s,o,"throw",l)}s(void 0)})}}var ms=W.module("MessageUtils"),Wf="io.deephaven.message.LoginOptions.request",Gf="io.deephaven.message.SessionDetails.request",zf="io.deephaven.broadcast",Yo="io.deephaven.broadcast.Login",Kf="io.deephaven.broadcast.Logout";function $a(n){var e=n;return e!=null&&typeof e.id=="string"&&typeof e.message=="string"}function qf(n){return $a(n)&&n.message===Yo}function Yf(n){return $a(n)&&n.message===Kf}function Xf(n){var e=n;return e!=null&&typeof e.id=="string"}function Xo(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ye(),t=arguments.length>2?arguments[2]:void 0;return{message:n,id:e,payload:t}}function EE(n,e){return{id:n,payload:e}}function Zo(){return window.opener!=null?window.opener:window.parent!=null&&window.parent!==window?window.parent:null}function Qo(n){return Bs.apply(this,arguments)}function Bs(){return Bs=yE(function*(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3e4,t=Zo();if(t==null)throw new Error("window parent is null, unable to send request.");return new Promise((r,i)=>{var a,s=ye(),o=l=>{var{data:d}=l;if(!Xf(d)){ms.debug("Ignoring non-deephaven response",d);return}if(ms.debug("Received message",d),(d==null?void 0:d.id)!==s){ms.debug("Ignore message, id doesn't match",d);return}window.clearTimeout(a),window.removeEventListener("message",o),r(d.payload)};window.addEventListener("message",o),a=window.setTimeout(()=>{window.removeEventListener("message",o),i(new yb("Request timed out"))},e),t.postMessage(Xo(n,s),"*")})}),Bs.apply(this,arguments)}function wE(n,e,t){return e=PE(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function PE(n){var e=_E(n,"string");return typeof e=="symbol"?e:String(e)}function _E(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 Zf extends Error{constructor(){super(...arguments),wE(this,"isNoConsolesError",!0)}}function Qf(n){return n.isNoConsolesError}function Ld(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function Ua(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){Ld(a,r,i,s,o,"next",l)}function o(l){Ld(a,r,i,s,o,"throw",l)}s(void 0)})}}var tr=W.module("SessionUtils");function TE(n,e){return tr.info("Starting connection to '".concat(e,"'...")),new n.IdeConnection(e)}function Jf(n,e,t){return Ws.apply(this,arguments)}function Ws(){return Ws=Ua(function*(n,e,t){tr.info("Getting console types...");var r=yield e.getConsoleTypes();if(r.length===0)throw new Zf("No console types available");tr.info("Available types:",r);var i=r[0];tr.info("Starting session with type",i);var a=yield e.startSession(i),s={type:i,id:ye.generate()};return tr.info("Console session established",s),{session:a,config:s,connection:e,details:t,dh:n}}),Ws.apply(this,arguments)}function OE(n,e,t){return tr.info("createCoreClient",e),new n.CoreClient(e,t)}function DE(n){return n!=null&&typeof n=="object"}function IE(){return Gs.apply(this,arguments)}function Gs(){return Gs=Ua(function*(){var n=yield Qo(Gf);if(!DE(n))throw new Error("Unexpected session details response: ".concat(n));return n}),Gs.apply(this,arguments)}function xE(){return zs.apply(this,arguments)}function zs(){return zs=Ua(function*(){var n=new URLSearchParams(window.location.search);switch(n.get("authProvider")){case"parent":return IE()}return{}}),zs.apply(this,arguments)}function NE(n,e,t){return Ks.apply(this,arguments)}function Ks(){return Ks=Ua(function*(n,e,t){var r;try{r=yield Jf(n,e,t)}catch(i){if(!Qf(i))throw i}return r}),Ks.apply(this,arguments)}const ME=Object.freeze(Object.defineProperty({__proto__:null,BROADCAST_CHANNEL_NAME:zf,BROADCAST_LOGIN_MESSAGE:Yo,BROADCAST_LOGOUT_MESSAGE:Kf,BooleanColumnFormatter:Eb,CharColumnFormatter:wb,DateTimeColumnFormatter:No,DateUtils:xc,DecimalColumnFormatter:Pb,DefaultColumnFormatter:_b,FETCH_TIMEOUT:Tb,Formatter:ai,FormatterUtils:si,IntegerColumnFormatter:Ob,LOGIN_OPTIONS_REQUEST:Wf,NoConsolesError:Zf,SESSION_DETAILS_REQUEST:Gf,StringColumnFormatter:Db,TableColumnFormatter:Ib,TableUtils:xe,createComboboxFilterArgs:xb,createConnection:TE,createCoreClient:OE,createFilterConditionFactory:Mo,createKeyFromOffsetRow:Nb,createNotNullOrEmptyFilterCondition:Nc,createOnTableUpdatedHandler:Mc,createSearchTextFilter:Lo,createSelectedValuesFilter:Ao,createSessionWrapper:Jf,createShowOnlyEmptyFilterCondition:Lc,createValueFilter:Ac,defaultRowDeserializer:Fc,fetchVariableDefinition:Mb,generateEmptyKeyedItems:jc,getColumnFormats:Lb,getDateTimeFormatterOptions:Ab,getSessionDetails:xE,getSize:Fo,getWindowParent:Zo,isBroadcastLoginMessage:qf,isBroadcastLogoutMessage:Yf,isClosed:sa,isCustomColumnFormatDefined:Fb,isMessage:$a,isNoConsolesError:Qf,isResponse:Xf,isSortDirection:jb,loadSessionWrapper:NE,makeMessage:Xo,makeResponse:EE,padFirstAndLastRow:Rc,requestParentResponse:Qo},Symbol.toStringTag,{value:"Module"}));var Ad=W.module("useTableListener"),LE=(n,e,t)=>c.useEffect(function(){if(n==null){Ad.debug2("Emitter undefined, skipping addEventListener",e);return}return Ad.debug2("Adding listener",e),n.addEventListener(e,t)},[n,e,t]);const lr=LE;function AE(n,e,t){return e=FE(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function FE(n){var e=jE(n,"string");return typeof e=="symbol"?e:String(e)}function jE(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 RE extends Error{constructor(){super(...arguments),AE(this,"isColumnNameError",!0)}}const kE=RE;function $E(n,e,t){return e=UE(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function UE(n){var e=HE(n,"string");return typeof e=="symbol"?e:String(e)}function HE(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 VE extends Error{constructor(){super(...arguments),$E(this,"isTableDisconnectError",!0)}}const BE=VE;var Ri=W.module("useTable"),WE=(n,e,t,r)=>{var i=Ve(),[a,s]=c.useState(void 0),[o,l]=c.useState([]),[d,h]=c.useState(null),[f,v]=c.useState(null);c.useEffect(()=>{if(r===void 0){s(n==null?void 0:n.columns),h(null);return}try{s(n==null?void 0:n.findColumns(r)),h(null)}catch(g){Ri.error("Column not found",g,r),h(new kE("Invalid columnNames argument"))}},[n,r]),c.useEffect(()=>{if(!a||!n){Ri.debug2("Table or column not initialized, skip viewport update.");return}Ri.debug2("Setting viewport",e,t),n.setViewport(e,t,a)},[a,n,e,t]);var p=c.useCallback(g=>{var{detail:C}=g;if(!a){Ri.error("Columns not initialized.");return}var S=a.map(y=>C.rows.map(w=>w.get(y)));l(S)},[a]),m=c.useCallback(()=>{v(new BE("Table disconnected"))},[]),b=c.useCallback(()=>{v(null)},[]);return lr(n,i.Table.EVENT_UPDATED,p),lr(n,i.Table.EVENT_DISCONNECT,m),lr(n,i.Table.EVENT_RECONNECT,b),{columns:a,data:o,error:f??d}};const ev=WE;var GE=(n,e,t,r)=>{var i=c.useMemo(()=>[r],[r]),{columns:a=[],data:s=[],error:o}=ev(n,e,t,i);return{column:a[0],data:s[0],error:o}};const tv=GE;function Fd(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function zE(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){Fd(a,r,i,s,o,"next",l)}function o(l){Fd(a,r,i,s,o,"throw",l)}s(void 0)})}}var Vt=W.module("TableInput"),gs=250;function Jo(n){var e,t,{className:r=void 0,columnName:i,settings:a,defaultValue:s=[],isInvalid:o=!1,onChange:l=()=>!1,onBlur:d=()=>!1,table:h}=n,f=c.useRef(null),v=Ve(),p=c.useMemo(()=>{var B=si.getColumnFormats(a),x=si.getDateTimeFormatterOptions(a),{defaultDecimalFormatOptions:P={},defaultIntegerFormatOptions:R={}}=a;return new ai(v,B,x,P,R)},[v,a]),[m,b]=c.useState(""),[g,C]=c.useState(new Set(s)),[S,y]=c.useState(),w=c.useRef(null),E=Math.min((e=S==null?void 0:S.size)!==null&&e!==void 0?e:0,gs),{column:D,data:T,error:O}=tv(S,0,gs-1,i),M=c.useCallback(B=>D?p.getFormattedString(B,D.type,D.name):"".concat(B),[D,p]),[j,H]=c.useMemo(()=>{var B=new Set(g),x=[];if(T==null)return[x,null];if(T.forEach(R=>{var U="".concat(R),Q=g.has(U);Q&&B.delete(U),x.push({value:U,displayValue:M(R),isSelected:Q})}),B.size>0){Vt.debug2("Selection has items that are missing from the viewport");var P=new Set(g);return Array.from(B).forEach(R=>{P.delete(R)}),[x,P]}return[x,null]},[T,g,M]);c.useEffect(()=>{H!==null&&(C(H),l(Array.from(H)))},[l,H]);var L=c.useCallback(function(){var B=zE(function*(x){try{var P=yield x;Vt.debug("Table resolved",P),y(P)}catch(R){if(Se.isCanceled(R))return;Vt.error(R)}});return function(x){return B.apply(this,arguments)}}(),[]);c.useEffect(()=>{var B=Se.makeCancelable(h);return L(B),()=>{Vt.debug2("Cancel table promise"),B.cancel()}},[h,L]);var I=c.useCallback(B=>{var{value:x}=B.target;b(x);var P=j.findIndex(U=>U.displayValue.includes(x));if(P>-1){var R;Vt.debug2("Found ".concat(x," at index ").concat(P)),(R=w.current)===null||R===void 0||R.scrollIntoView(P)}else Vt.debug2("".concat(x," not found"))},[j,w]),N=c.useCallback(B=>{if(Vt.debug("handleSelect",B),B>=j.length){Vt.error("Invalid index",B);return}var x=j[B].value,P=new Set(g);j[B].isSelected?P.delete(x):P.add(x),C(P),l(Array.from(P))},[l,j,g]),A=c.useCallback(()=>{var B=j.map(P=>P.value),x=new Set(B);C(x),l(B)},[j,l]),k=c.useCallback(()=>{C(new Set),l([])},[l]),V=c.useCallback(()=>{},[]),q=c.useCallback(B=>{var x,{relatedTarget:P}=B;Vt.debug("handleChildBlur",P,P instanceof HTMLElement,f.current,(x=f.current)===null||x===void 0?void 0:x.contains(P)),(!P||f.current&&P instanceof HTMLElement&&!f.current.contains(P))&&d()},[d]),re=j.length===0;return u.jsxs("div",{ref:f,className:Y("table-input-container d-flex flex-column position-relative",r),children:[u.jsx(Ci,{disabled:!!O||re,value:m,placeholder:"Search",onChange:I,className:"mb-2 d-flex",onBlur:q}),u.jsx(qc,{className:"table-input-list",disabled:S===void 0||re,isInvalid:o,items:re?[{value:"Empty",isSelected:!1}]:j,itemCount:E,offset:0,onSelect:N,onViewportChange:V,ref:w,onBlur:q}),S&&u.jsxs("div",{className:"meta-row",children:[u.jsx("div",{className:"d-flex align-items-center text-muted small",children:S!=null&&S.size>E&&u.jsxs(u.Fragment,{children:["Table is too large, showing the first ",gs," items."]})}),u.jsxs("div",{children:[u.jsx("button",{type:"button",className:"btn btn-link",onBlur:q,onClick:A,children:"Select All"}),u.jsx("button",{type:"button",className:"btn btn-link mr-a",onBlur:q,onClick:k,children:"Clear"})]})]}),S==null||O&&u.jsx("div",{className:"h-100 w-100 position-absolute",children:u.jsx(Ne,{isLoaded:S!=null,isLoading:S==null&&O==null,errorMessage:(t=O==null?void 0:O.message)!==null&&t!==void 0?t:null})})]})}Jo.displayName="TableInput";Jo.defaultProps={isInvalid:!1,className:void 0};var jd=W.module("useBroadcastChannel");function el(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Rb,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:zf,t=c.useMemo(()=>new BroadcastChannel(e),[e]);return c.useEffect(()=>()=>{t.close()},[t]),c.useEffect(()=>{function r(i){var{data:a}=i;if(!$a(a)){jd.debug("Ignoring non-deephaven message",a);return}jd.debug("event received",a),n(i)}return t.addEventListener("message",r),()=>{t.removeEventListener("message",r)}},[t,n]),t}function Ha(n,e){var t=c.useCallback(r=>{qf(r.data)?n==null||n(r.data):Yf(r.data)&&(e==null||e(r.data))},[n,e]);el(t)}var ha="io.deephaven.web.client.auth.refreshToken",nv=c.createContext(null),KE=W.module("RefreshTokenUtils");function qs(){var n=pr.get(ha);try{if(n!=null)return JSON.parse(n)}catch(e){KE.error("Error parsing refresh token",n,e)}return null}function Ys(n){if(n==null){pr.remove(ha);return}var e=JSON.stringify({bytes:n.bytes,expiry:n.expiry}),t=new Date(n.expiry);pr.set(ha,e,{secure:!0,sameSite:"strict",expires:t})}function rv(n){var{children:e}=n,t=Ve(),r=$n(),[i,a]=c.useState(qs());c.useEffect(function(){var d=r.addEventListener(t.CoreClient.EVENT_REFRESH_TOKEN_UPDATED,h=>{var{detail:f}=h;Ys(f),a(f)});return d},[t,r,i]);var s=c.useCallback(()=>{a(qs())},[]),o=c.useCallback(()=>{Ys(null),a(null)},[]);return Ha(s,o),u.jsx(nv.Provider,{value:i,children:e})}function Jt(){var n=Ve();return c.useMemo(()=>new xe(n),[n])}function qE(n,e,t,r){var i=Jt(),[a,s]=c.useState(""),{value:o}=Si(a,t),l=c.useCallback(v=>{s(v.trim())},[]),{data:d,isLoading:h}=oi(i.doesColumnValueExist,[n,e,o,r]),f=h||a!==o?null:d;return{valueTrimmed:a,valueTrimmedDebounced:o,valueExists:f,trimAndUpdateValue:l}}var Rd=W.module("useDebouncedViewportSearch"),YE=200;function XE(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:YE,r=Jt(),{table:i,applyFiltersAndRefresh:a}=n,s=c.useMemo(()=>Le(o=>{if(Rd.debug("Applying debounced searchText '".concat(o,"'")),i!=null){var l=o.trim();if(l===""){a([]);return}var d=i.findColumn(e),h=r.makeFilterValue(d.type,l),f=[d.filter().contains(h)];a(f)}},t),[a,e,t,i,r]);return c.useEffect(()=>()=>{Rd.debug("Cancelling debounced search function"),s.cancel()},[s]),s}var iv=300;function ZE(n){var{viewportData:e,columnName:t,shouldSelectAllOnNoSelection:r,mapItemToValue:i}=n,a=Jt(),s=mf(e,i),{value:o}=Si(s,iv),l=ff(o,of);return c.useMemo(()=>Ao(a,t,l.selection,r,l.isInverted),[t,l,r,a])}function tl(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(()=>kb(...t.map(i=>i(n))),[n,...t])}function QE(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 kd(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function JE(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){kd(a,r,i,s,o,"next",l)}function o(l){kd(a,r,i,s,o,"throw",l)}s(void 0)})}}function ew(n){var{table:e,columnName:t,defaultValue:r,itemHeight:i,topOffset:a=0,value:s}=n;return c.useCallback(JE(function*(){if(e==null||s===""||s===r)return a;var o=e.findColumn(t),l=yield e.seekRow(0,o,"String",s),d=r==null?0:1;return(l+d)*i+a}),[t,r,i,e,a,s])}function nl(n){var[,e]=c.useState(0),t=Ve();return lr(n,t.Table.EVENT_SIZECHANGED,()=>{e(r=>r+1)}),Fo(n)}var tw=W.module("useInitializeViewportData");function av(n){var e=Cf({}),t=Math.max(0,nl(n));return c.useEffect(()=>{var r=e.items.length;t!==r&&(tw.debug("size changed:",{currentSize:r,targetSize:t}),e.setItems(Array.from(jc(0,t-1))))},[t,n]),e}function sv(n,e,t){return c.useCallback(function(i){var[a,s]=Rc(i,e,t,Fo(n));n==null||n.setViewport(a,s)},[n,t,e])}var $d=W.module("useViewportData");function rl(n){var{table:e,itemHeight:t=1,scrollDebounce:r=YC,viewportSize:i=10,viewportPadding:a=50,deserializeRow:s=Fc}=n,o=av(e),l=sv(e,i,a),d=c.useCallback(b=>{e&&!sa(e)?l(b):$d.debug("setViewport called on closed table.",e)},[e,l]),h=c.useCallback(b=>{e&&!sa(e)?(e.applyFilter(b),d(0)):$d.debug("applyFiltersAndRefresh called on closed table.",e)},[d,e]),f=Ve(),v=c.useMemo(()=>Mc(o,s),[s,o]);lr(e,f.Table.EVENT_UPDATED,v);var p=nl(e);c.useEffect(()=>{d(0)},[e,d,p]);var m=gf(t,d,r);return c.useMemo(()=>({viewportData:o,size:p,table:e,applyFiltersAndRefresh:h,setViewport:d,onScroll:m}),[h,m,d,p,e,o])}function il(n,e){var{applyFiltersAndRefresh:t}=n;c.useEffect(()=>{t(e)},[t,e])}function nw(n,e){for(var t=Jt(),[r,i]=c.useState(""),a=c.useMemo(()=>Lo(t,e,r),[e,r,t]),s=da(i,ks),o=rl({table:n,itemHeight:qC,viewportSize:nf,viewportPadding:rf}),l=arguments.length,d=new Array(l>2?l-2:0),h=2;h<l;h++)d[h-2]=arguments[h];var f=tl(o.table,a,...d);return il(o,f),{list:o,onSearchTextChange:s}}function rw(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"or",t=Jt(),r=c.useMemo(()=>Nc(t),[t]);return c.useMemo(()=>Mo(n,r,e),[n,e,r])}function ov(n){c.useEffect(()=>()=>{n!=null&&(sa(n)||n.close())},[n])}function iw(n){var{maybeTable:e,columnName:t,mapItemToValue:r,filterConditionFactories:i=[],trimSearchText:a=!1}=n,s=Jt(),[o,l]=c.useState(""),[d,h]=c.useState(""),f=c.useCallback(q=>{h(a?q.trim():q)},[a]),v=c.useMemo(()=>a?o.trim():o,[o,a]),[p,m]=c.useState(null),[b,g]=c.useState(()=>new Map),{data:C,isLoading:S}=oi(s.doesColumnValueExist,[e,t,d,!1]),{isDebouncing:y}=Si(d,ks),w=y||S?null:C,E=c.useMemo(()=>Lo(s,t,d),[d,t,s]),D=c.useMemo(()=>Ao(s,t,new Set(b.keys()),!1,!0),[t,b,s]),{data:T}=oi(s.createDistinctSortedColumnTable,[e,t,"asc",...i]);ov(T);var O=rl({table:T,itemHeight:KC,viewportSize:nf,viewportPadding:rf}),M=v.length>0&&O.size===0,j=b.has(v),H=da(f,ks),L=c.useCallback(q=>{l(q),H(q)},[H]),I=da(m,0),N=c.useCallback(q=>{if(l(""),f(""),m(q),I(null),q!=null){var re=O.viewportData.findItem(q);if(re!=null){var B=r(re);g(x=>{var P=new Map(x);return P.set(B,{value:B}),P})}}},[f,I,O.viewportData,r]),A=c.useCallback(q=>{g(re=>{if(q.size===0)return re;var B=new Map(re);for(var x of q)B.set(x,{value:x});return B})},[]),k=c.useCallback(q=>{g(re=>{if(q==="all")return new Map;var B=new Map(re);for(var x of q)B.delete(x);return B})},[]),V=tl(O.table,E,D);return il(O,V),c.useMemo(()=>({list:O,hasSearchTextWithZeroResults:M,searchText:o,searchTextExists:w,searchTextIsInSelectedValues:j,selectedKey:p,selectedValueMap:b,onSearchTextChange:L,onSelectKey:N,onAddValues:A,onRemoveValues:k}),[M,O,A,k,L,N,o,w,j,p,b])}function Ud(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function aw(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){Ud(a,r,i,s,o,"next",l)}function o(l){Ud(a,r,i,s,o,"throw",l)}s(void 0)})}}function sw(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(aw(function*(){var d;return(d=n==null?void 0:n.selectDistinct(n.findColumns(t)))!==null&&d!==void 0?d:null}),[n,...t]),{data:a,error:s,isError:o,isLoading:l}=oi(i,[]);return c.useEffect(()=>()=>{a==null||a.close()},[a]),{distinctTable:a,error:s,isError:o,isLoading:l}}function ow(n,e){var t=Jt(),r=c.useMemo(()=>Lc(t,n),[n,t]);return c.useMemo(()=>Mo(e,r),[e,r])}function lw(n,e,t){var r=Jt();return c.useMemo(()=>Ac(r,n,e,t),[n,t,r,e])}const dw=Object.freeze(Object.defineProperty({__proto__:null,DEBOUNCE_MS:iv,REFRESH_TOKEN_KEY:ha,RefreshTokenBootstrap:rv,RefreshTokenContext:nv,TableDropdown:bC,TableInput:Jo,makeApiContextWrapper:SE,readRefreshToken:qs,storeRefreshToken:Ys,useBroadcastChannel:el,useBroadcastLoginListener:Ha,useCheckIfExistsValue:qE,useDebouncedViewportSearch:XE,useDebouncedViewportSelectionFilter:ZE,useFilterConditionFactories:tl,useFilteredItemsWithDefaultValue:QE,useGetItemPosition:ew,useInitializeViewportData:av,useNotNullOrEmptyFilter:rw,usePickerWithSelectedValues:iw,useSearchableViewportData:nw,useSelectDistinctTable:sw,useSetPaddedViewportCallback:sv,useShowOnlyEmptyFilter:ow,useTable:ev,useTableClose:ov,useTableColumn:tv,useTableListener:lr,useTableSize:nl,useTableUtils:Jt,useValueFilter:lw,useViewportData:rl,useViewportFilter:il},Symbol.toStringTag,{value:"Module"}));var al=c.createContext(!1);function lv(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)})},[]),u.jsxs(u.Fragment,{children:[u.jsx(al.Provider,{value:r,children:t}),u.jsx("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:e.map(a=>u.jsx("p",{className:a,children:"preload"},a))})]})}var Ei=c.createContext(null),tt=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin"});function dv(n){return"DashboardPlugin"in n}function ca(n){return"AuthPlugin"in n}function sl(n){return"TablePlugin"in n}function uv(n){return dv(n)||ca(n)||sl(n)}function hv(n){return"type"in n&&n.type===tt.DASHBOARD_PLUGIN}function Nr(n){return"type"in n&&n.type===tt.WIDGET_PLUGIN}function ol(n){return"type"in n&&n.type===tt.TABLE_PLUGIN}function ll(n){return"type"in n&&n.type===tt.AUTH_PLUGIN}function dl(n){return"type"in n&&n.type===tt.THEME_PLUGIN}function Xs(n){return hv(n)||ll(n)||ol(n)||dl(n)||Nr(n)}var uw=W.module("@deephaven/plugin.PluginUtils");function Zs(n,e){return n==null||!Nr(n)?!1:[n.supportedTypes].flat().some(t=>t===e)}function cv(n){var e=u.jsx(ne,{icon:yc});if(!Nr(n))return e;var{icon:t}=n;return t==null?e:c.isValidElement(t)?t:u.jsx(ne,{icon:t})}function fv(n){var e=[...n.entries()].filter(t=>dl(t[1]));return uw.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(s=>{var{name:o,baseTheme:l,styleContent:d}=s;return{baseThemeKey:"default-".concat(l??"dark"),themeKey:Sc(r,o),name:o,styleContent:d}})}).flat()}function Va(){return Ir(Ei,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}function hw(n){var{fetch:e,type:t}=n,r=Va(),i=c.useMemo(()=>[...r.values()].filter(Nr).find(s=>[s.supportedTypes].flat().includes(t)),[r,t]);if(i!=null){var a=i.component;return u.jsx(a,{fetch:e})}throw new Error("Unknown widget type '".concat(t,"'"))}const cw=Object.freeze(Object.defineProperty({__proto__:null,PluginType:tt,PluginsContext:Ei,WidgetView:hw,getIconForPlugin:cv,getThemeDataFromPlugins:fv,isAuthPlugin:ll,isDashboardPlugin:hv,isLegacyAuthPlugin:ca,isLegacyDashboardPlugin:dv,isLegacyPlugin:uv,isLegacyTablePlugin:sl,isPlugin:Xs,isTablePlugin:ol,isThemePlugin:dl,isWidgetPlugin:Nr,pluginSupportsType:Zs,usePlugins:Va},Symbol.toStringTag,{value:"Module"}));function fw(n){if(n==null)return!1;var e=n;return e.Component!==void 0&&typeof e.isAvailable=="function"}var vv="io.deephaven.auth.AnonymousAuthenticationHandler",vw="io.deephaven.authentication.psk.PskAuthenticationHandler";function Hd(n,e,t){return e=pw(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pw(n){var e=mw(n,"string");return typeof e=="symbol"?e:String(e)}function mw(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 gw extends Error{constructor(){super(...arguments),Hd(this,"name","AuthenticationError"),Hd(this,"isAuthenticationError",!0)}}const pv=gw;function Vd(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function bw(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){Vd(a,r,i,s,o,"next",l)}function o(l){Vd(a,r,i,s,o,"throw",l)}s(void 0)})}}var Bd=W.module("AuthPluginBase");function ul(n){var{children:e,getLoginOptions:t}=n,r=$n(),[i,a]=c.useState(),[s,o]=c.useState(!1);return c.useEffect(()=>{var l=!1;function d(){if(l)throw new kc("Login canceled.")}function h(){return f.apply(this,arguments)}function f(){return f=bw(function*(){try{var v=yield t();d(),Bd.info("Logging in..."),yield r.login(v),d(),o(!0)}catch(b){if(!l){var p;Bd.error("Unable to login:",b);var m=(p=Sr(b))!==null&&p!==void 0?p:"Unable to login. Verify credentials.";a(new pv(m)),o(!1)}}}),f.apply(this,arguments)}return h(),()=>{l=!0}},[r,t]),s?u.jsx(u.Fragment,{children:e}):u.jsx(Ne,{"data-testid":"auth-base-loading",isLoading:i==null,isLoaded:!1,errorMessage:Sr(i)})}var Cw={canLogout:!1};function Sw(n){var{children:e}=n,t=Ve(),r=c.useCallback(()=>({type:t.CoreClient.LOGIN_TYPE_ANONYMOUS}),[t]);return u.jsx(ul,{getLoginOptions:r,children:u.jsx(Na.Provider,{value:Cw,children:e})})}var yw={Component:Sw,isAvailable:n=>n.includes(vv)};const mv=yw;function Wd(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function Ew(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){Wd(a,r,i,s,o,"next",l)}function o(l){Wd(a,r,i,s,o,"throw",l)}s(void 0)})}}var ww=W.module("AuthPluginParent"),Pw={canLogout:!1};function _w(n){return n!=null&&typeof n.type=="string"}function Tw(){return Qs.apply(this,arguments)}function Qs(){return Qs=Ew(function*(){ww.info("Logging in by delegating to parent window...");var n=yield Qo(Wf);if(!_w(n))throw new Error("Unexpected login options response: ".concat(n));return n}),Qs.apply(this,arguments)}function Ow(){var n;return(n=new URLSearchParams(window.location.search).get("authProvider"))!==null&&n!==void 0?n:""}function Dw(n){var{children:e}=n;return u.jsx(ul,{getLoginOptions:Tw,children:u.jsx(Na.Provider,{value:Pw,children:e})})}var Iw={Component:Dw,isAvailable:()=>Zo()!=null&&Ow()==="parent"};const gv=Iw;function bv(n){var{children:e,errorMessage:t,isLoggingIn:r=!1,onSubmit:i}=n;return u.jsxs("form",{className:"login-form",onSubmit:a=>{a.preventDefault(),a.stopPropagation(),i==null||i(a)},children:[u.jsx("div",{className:"flex-spacer"}),u.jsxs("div",{className:"flex-wrapper",children:[u.jsx("fieldset",{disabled:r,className:"container-fluid",children:e}),u.jsx("div",{className:"form-group d-flex justify-content-end align-items-center mb-0",children:u.jsxs("button",{type:"submit",className:Y("btn btn-primary",{"btn-spinner":r},{"btn-cancelable":r}),"data-testid":"btn-login",children:[r&&u.jsxs("span",{children:[u.jsx(Da,{className:"mr-2 loading-spinner-vertical-align"}),u.jsx("span",{className:"btn-normal-content",children:"Logging in"}),u.jsx("span",{className:"btn-hover-content",children:"Cancel"})]}),!r&&"Login"]})})]}),u.jsx("div",{className:"flex-spacer",children:t!=null&&u.jsx("p",{className:"error-message mb-0",role:"alert",children:"".concat(t)})})]})}function Cv(n){var{children:e,logoPath:t="./logo.png"}=n;return u.jsxs("div",{className:"login-container",children:[u.jsx(xf,{}),u.jsxs("div",{className:"login-box",children:[u.jsx("div",{className:"logo",children:u.jsx("img",{src:t,alt:"Deephaven Data Labs"})}),e,u.jsxs("p",{className:"footer",children:["© 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})}function Gd(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function bs(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){Gd(a,r,i,s,o,"next",l)}function o(l){Gd(a,r,i,s,o,"throw",l)}s(void 0)})}}var Js="io.deephaven.authentication.psk.PskAuthenticationHandler",Sv="psk",eo="io.deephaven.web.client.auth.psk.token",nr=W.module("AuthPluginPsk");function xw(){return new URLSearchParams(window.location.search).get(Sv)}function Nw(){nr.debug2("clearWindowToken");var n=new URL(window.location.href);n.searchParams.delete(Sv),window.history.replaceState(null,"",n.href)}function zd(){var n;return(n=pr.get(eo))!==null&&n!==void 0?n:null}function Cs(n){nr.debug2("Storing token in cookie",n),n!=null?pr.set(eo,n,{secure:!0,sameSite:"strict"}):pr.remove(eo)}function Mw(n){var{children:e,logoPath:t}=n,r=$n(),i=c.useRef(null),a=c.useRef(null),[s,o]=c.useState(),[l,d]=c.useState(!1),[h,f]=c.useState(!1),[v,p]=c.useState(!1),[m,b]=c.useState(""),g=c.useCallback(function(){var E=bs(function*(D){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;nr.info("Logging in..."),p(!0);var O=null;try{if(O=r.login({type:Js,token:D}),a.current=O,yield O,nr.info("Logged in successfully"),a.current!==O)return;Cs(D),f(!0)}catch(H){if(a.current!==O)return;if(d(!0),T){var M;nr.error("Unable to login",H);var j=(M=Sr(H))!==null&&M!==void 0?M:"Unable to login: Verify credentials.";o(new pv(j))}}p(!1)});return function(D){return E.apply(this,arguments)}}(),[r]),C=c.useCallback(()=>{a.current=null,p(!1)},[]),S=c.useCallback(bs(function*(){nr.debug("onLogin");var E=zd();h||v||E==null||g(E,!1)}),[h,v,g]),y=c.useCallback(()=>{Cs(null)},[]);Ha(S,y),c.useEffect(()=>{var E=!1;function D(){return T.apply(this,arguments)}function T(){return T=bs(function*(){var O,M=(O=xw())!==null&&O!==void 0?O:zd();if(Nw(),M==null){d(!0);return}p(!0);try{yield r.login({type:Js,token:M}),E||(Cs(M),f(!0),p(!1))}catch{E||(d(!0),p(!1))}}),T.apply(this,arguments)}return D(),()=>{E=!0}},[r]);var w=c.useCallback(()=>{v?C():g(m)},[C,v,g,m]);return c.useEffect(function(){var D;(D=i.current)===null||D===void 0||D.focus()},[i,l]),u.jsxs(u.Fragment,{children:[h&&e,l&&u.jsx(Fn,{in:!h,timeout:jn.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:u.jsx(Cv,{logoPath:t,children:u.jsx(bv,{errorMessage:Sr(s),isLoggingIn:v,onSubmit:w,children:u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"auth-psk-token-input",children:"Token"}),u.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:m,onChange:E=>{o(void 0),b(E.target.value)}})]})})})}),u.jsx(Ne,{"data-testid":"auth-psk-loading",isLoaded:h||l,isLoading:!h&&!l})]})}var Lw={Component:Mw,isAvailable:n=>n.includes(Js)};const yv=Lw;function Kd(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 Ss(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Kd(Object(t),!0).forEach(function(r){Aw(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Kd(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Aw(n,e,t){return e=Fw(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fw(n){var e=jw(n,"string");return typeof e=="symbol"?e:String(e)}function jw(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 Rw=W.module("UserUtils");function Ev(n,e){return n.get("internal.webClient.appInit.".concat(e))}function wv(n){var e,t,r,i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};function o(g){return Ev(n,g)}function l(g,C){var S=o(g);return S==="true"?!0:S==="false"?!1:(S!==void 0&&Rw.warn("Unexpected value for ".concat(g,": ").concat(S)),C)}var d=(e=o("name"))!==null&&e!==void 0?e:"",h=(t=o("operateAs"))!==null&&t!==void 0?t:d,f=(r=(i=o("groups"))===null||i===void 0?void 0:i.split(","))!==null&&r!==void 0?r:[],v=l("canCopy",!0),p=l("canDownloadCsv",!0),m=l("canUsePanels",!0),b=l("canLogout",!0);return Ss(Ss({name:d,operateAs:h,groups:f},a),{},{permissions:Ss({canUsePanels:m,canCopy:v,canDownloadCsv:p,canLogout:b},s)})}const kw=Object.freeze(Object.defineProperty({__proto__:null,AUTH_HANDLER_TYPE_ANONYMOUS:vv,AUTH_HANDLER_TYPE_PSK:vw,AuthPluginAnonymous:mv,AuthPluginBase:ul,AuthPluginParent:gv,AuthPluginPsk:yv,Login:Cv,LoginForm:bv,UserContext:$c,UserOverrideContext:Uc,UserPermissionsOverrideContext:Na,getAppInitValue:Ev,getUserFromConfig:wv,isAuthPlugin:fw},Symbol.toStringTag,{value:"Module"}));function qd(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 $w(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qd(Object(t),!0).forEach(function(r){Uw(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):qd(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Uw(n,e,t){return e=Hw(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hw(n){var e=Vw(n,"string");return typeof e=="symbol"?e:String(e)}function Vw(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 Bw=c.lazy(()=>Aa(()=>import("./Chart-2f1506c1.js"),["./Chart-2f1506c1.js","./vendor-f46f78b9.js","./helpers-de833af9.js","./vendor-35ea25e0.css","./index-c9408b8e.js","./monaco-0b69f16f.js","./monaco-0e9455f6.css","./index-b9c423a0.css","./Plotly-f3032a0a.js","./plotly-bfeeb2d3.js","./useUser-ae22a8dc.js","./IrisGridThemeProvider-fb501222.js","./IrisGridThemeProvider-17c81a68.css","./Chart-b27697ef.css"],import.meta.url));function hl(n){return u.jsx(c.Suspense,{fallback:u.jsx(Ne,{}),children:u.jsx(Bw,$w({},n))})}function Yd(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 ki(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Yd(Object(t),!0).forEach(function(r){He(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Yd(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function He(n,e,t){return e=Ww(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ww(n){var e=Gw(n,"string");return typeof e=="symbol"?e:String(e)}function Gw(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 kr=W.module("ChartUtils"),Xd="io.deephaven.time.DateTime",zw=36e5,Kw=1e6;function qw(n){return n.asDate!==void 0}function Yw(n){return n.asNumber!==void 0}function Zd(n){return n.dhTimeZone!==void 0}function Xw(n){return n!=null&&n.range!=null&&(n.autorange===!1||n.autorange===void 0)}function Zw(){var n=document.createElement("canvas"),e=n.getContext("webgl")||n.getContext("experimental-webgl");return e!=null&&e instanceof WebGLRenderingContext}var Qw=Zw();class G{static getPlotlyErrorBars(e,t,r){var i=r.map((s,o)=>s-e[o]),a=t.map((s,o)=>e[o]-s);return{type:"data",symmetric:!1,array:i,arrayminus:a}}static convertNumberPrefix(e){return e.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(e,t,r){if(r==null||r==="")return null;var i=r.split(";"),a=i[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);z(a);var[,s,o,l,,d,h,f,v,p]=a,m=l.replace(",","").length,b=o.indexOf(",")>=0||l.indexOf(",")>=0,g=b?",":"",C=f!=null&&f!==""?"e":"f",S=v!==""?v:C,y=d.length+h.length,w="",E="0".concat(m).concat(g,".").concat(y).concat(w).concat(S),D=G.convertNumberPrefix(s),T=G.convertNumberPrefix(p);return{tickformat:E,tickprefix:D,ticksuffix:T,automargin:!0}}static addTickSpacing(e,t,r){var{gapBetweenMajorTicks:i}=t;if(i!=null&&i>0){var a=e||{},s=i;return r&&(s=i/Kw),t.log&&(s=Math.log(s)),a.tickmode="linear",a.dtick=s,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 s=i.sources[a];if(s.axis===t)return s}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]:G.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 getAxisTypeMap(e){var t=G.getAllAxes(e);return G.groupArray(t,"type")}static getChartForSeries(e,t){for(var{charts:r}=e,i=0;i<r.length;i+=1)for(var a=r[i],s=0;s<a.series.length;s+=1)if(t===a.series[s])return a;return null}static getLayoutRanges(e){for(var t={},r=Object.keys(e).filter(o=>o.indexOf("axis")>=0),i=0;i<r.length;i+=1){var a=r[i],s=e[a];Xw(s)&&(t[a]=[...s.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,s=i[t],o=(a=r.get(s))!==null&&a!==void 0?a:[];return o.push(i),r.set(s,o),r},new Map)}static normalizeColorway(e){if(e!=null){if(Array.isArray(e))return e;if(typeof e=="string")return e.split(" ");kr.warn("Unexpected colorway format: ".concat(e))}}static titleFromSettings(e){var{series:t,xAxis:r,title:i="".concat((t??[]).join(", ")," by ").concat(r)}=e;return i}constructor(e){He(this,"dh",void 0),He(this,"daysOfWeek",void 0),this.dh=e,this.daysOfWeek=Object.freeze(e.calendar.DayOfWeek.values()),$b(this)}getAxisFormats(e,t){for(var r=this,i=new Map,a={tickformat:null,ticksuffix:null},s=G.getAllAxes(e),o=G.groupArray(s,"type"),{charts:l}=e,d=0;d<l.length;d+=1)for(var h=l[d],f=0;f<h.series.length;f+=1)for(var v=h.series[f],{sources:p}=v,m=p.filter(S=>S.axis),b=function(){var y=m[g],{axis:w}=y,{type:E}=w,D=o.get(E);z(D);var T=D.indexOf(w),O=r.getAxisPropertyName(E);if(O!=null){var M=G.getAxisLayoutProperty(O,T);if(i.has(M))kr.debug("".concat(M," already added."));else{kr.debug("Adding ".concat(M," to axisFormats."));var j=r.getPlotlyAxisFormat(y,t);if(j===null)i.set(M,a);else{i.set(M,j);var{businessCalendar:H}=w;if(H!=null){var L=[],{businessPeriods:I,businessDays:N,holidays:A,timeZone:k}=H,V=t==null?void 0:t.getColumnTypeFormatter(Xd),q;Zd(V)&&(q=V.dhTimeZone);var re=q?(k.standardOffset-q.standardOffset)/60:0;A.length>0&&L.push(...r.createRangeBreakValuesFromHolidays(A,k,q)),I.forEach(B=>L.push({pattern:"hour",bounds:[G.periodToDecimal(B.close)+re,G.periodToDecimal(B.open)+re]})),N.length<r.daysOfWeek.length&&r.createBoundsFromDays(N).forEach(B=>L.push({pattern:"day of week",bounds:B})),j.rangebreaks=L}if(i.size===h.axes.length)return{v:i}}}}},g=0;g<m.length;g+=1){var C=b();if(typeof C=="object")return C.v}return i}getPlotlyChartType(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.SCATTER:case r.plot.SeriesPlotStyle.LINE:return!t&&Qw?"scattergl":"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(G.MODE_LINES),(r??!0)&&a.add(G.MODE_MARKERS);break;case i.plot.SeriesPlotStyle.LINE:(t??!0)&&a.add(G.MODE_LINES),(r??!1)&&a.add(G.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?G.ORIENTATION.HORIZONTAL:G.ORIENTATION.VERTICAL}makeSeriesDataFromSeries(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,{name:a,isLinesVisible:s,isShapesVisible:o,plotStyle:l,lineColor:d,shapeColor:h,sources:f,shape:v,shapeSize:p}=e,m=f.some(y=>{var w;return(w=y.axis)===null||w===void 0?void 0:w.businessCalendar}),b=this.getChartType(l,m),g=this.getPlotlyChartMode(l,s??void 0,o??void 0),C=this.getPlotlySeriesOrientation(e),S=G.makeSeriesData(b,g,a,i,C);return this.addSourcesToSeriesData(S,l,f,t),this.addStylingToSeriesData(S,l,d,h,v,p,r),S}addSourcesToSeriesData(e,t,r,i){for(var a=e,s=0;s<r.length;s+=1){var o=r[s],{axis:l,type:d}=o,h=this.getPlotlyProperty(t,d);mc(a,h,[]);var f=l!=null?this.getAxisPropertyName(l.type):null;if(f!=null){var v=i.get(l.type);if(v){var p=v.indexOf(l),m=p>0?"".concat(p+1):"";a["".concat(f,"axis")]="".concat(f).concat(m)}}}}addStylingToSeriesData(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,{dh:l}=this,d=e;if(d.marker={line:{}},d.line={width:1},t===l.plot.SeriesPlotStyle.AREA?d.fill="tozeroy":t===l.plot.SeriesPlotStyle.STACKED_AREA?d.stackgroup="stack":t===l.plot.SeriesPlotStyle.STEP?d.line.shape="hv":t===l.plot.SeriesPlotStyle.HISTOGRAM?d.width=[]:t===l.plot.SeriesPlotStyle.PIE?d.textinfo="label+percent":t===l.plot.SeriesPlotStyle.TREEMAP&&(d.hoverinfo="text",d.textinfo="label+text",d.tiling={packing:"squarify",pad:0},d.textposition="middle center"),r!=null&&(t===l.plot.SeriesPlotStyle.BAR?d.marker.color=r:d.line.color=r),i!=null&&(d.marker.color=i),a!=null&&a.length>0)try{d.marker.symbol=G.getMarkerSymbol(a)}catch(h){kr.warn("Unable to handle shape",a,":",h)}s!=null&&(d.marker.size=s*G.DEFAULT_MARKER_SIZE),o!=null&&t!==l.plot.SeriesPlotStyle.PIE&&(d.visible=o)}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){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,s=e,o=G.getAllAxes(t),l=0;l<t.charts.length;l+=1){var d=t.charts[l],h=r==null?void 0:r(d),f=this.getChartBounds(t,d,i,a);this.updateLayoutAxes(s,d.axes,o,i,a,f,h)}this.removeStaleAxes(s,o)}getChartBounds(e,t,r,i){var a,{dh:s}=this,{cols:o,rows:l}=e,{column:d,colspan:h,row:f,rowspan:v}=t,p=d+h,m=f+v,b=1/o,g=1/l,C=G.AXIS_SIZE_PX/r,S=G.AXIS_SIZE_PX/i,y={bottom:(l-m)*g+(m<l?S/2:0),top:(l-f)*g-(f>0?S/2:0),left:d*b+(d>0?C/2:0),right:p*b-(p<o?C/2:0)},w=G.groupArray(t.axes,"position"),E=(a=w.get(s.plot.AxisPosition.RIGHT))!==null&&a!==void 0?a:[];return E.length>0&&(r>0?y.right-=(y.right-y.left)*Math.max(0,Math.min(G.LEGEND_WIDTH_PX/r,G.MAX_LEGEND_SIZE)):y.right-=(y.right-y.left)*G.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",""),s,o=e==null?void 0:e.getColumnTypeFormatter(t);return o!=null&&Zd(o)&&o.dhTimeZone!=null&&o.showTimeZone&&(s=i.i18n.DateTimeFormat.format(" z",new Date,o.dhTimeZone)),{tickformat:a,ticksuffix:s,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:s}=i,o=null;return xe.isDateType(a)?(o=this.getPlotlyDateFormat(t,a,s),o=G.addTickSpacing(o,i,!0)):xe.isNumberType(a)&&(o=G.getPlotlyNumberFormat(t,a,s),o=G.addTickSpacing(o,i,!1)),i.formatType===r.plot.AxisFormatType.CATEGORY&&(o?o.type="category":o={type:"category",tickformat:void 0,ticksuffix:void 0}),o}updateLayoutAxes(e,t,r){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{left:0,top:0,right:1,bottom:1},o=arguments.length>6?arguments[6]:void 0,{dh:l}=this,d=i>0?Math.max(G.MIN_AXIS_SIZE,Math.min(G.AXIS_SIZE_PX/a,G.MAX_AXIS_SIZE)):G.DEFAULT_AXIS_SIZE,h=a>0?Math.max(G.MIN_AXIS_SIZE,Math.min(G.AXIS_SIZE_PX/i,G.MAX_AXIS_SIZE)):G.DEFAULT_AXIS_SIZE,f=e,v=G.groupArray(t,"position"),p=G.groupArray(t,"type"),m=[...p.keys()],b=G.groupArray(r,"type"),g=0;g<m.length;g+=1){var C=m[g],S=this.getAxisPropertyName(C);if(S!=null){var y=p.get(C),w=b.get(C),E=C===l.plot.AxisType.Y,D=E?a:i;z(y),z(w);for(var T=0;T<y.length;T+=1){var O=y[T],M=w.indexOf(O),j=G.getAxisLayoutProperty(S,M);f[j]==null&&(f[j]={});var H=f[j];if(H!=null){this.updateLayoutAxis(H,O,T,v,d,h,s);var{range:L,autorange:I}=H;if(o!=null&&L!==void 0&&(I===void 0||I===!1)){var N=o(O),[A,k]=N(L);kr.debug("Setting downsample range",D,A,k),O.range(D,A,k)}else O.range(D)}}}}}removeStaleAxes(e,t){for(var r=e,i=G.groupArray(t,"type"),a=[...i.keys()],s=0;s<a.length;s+=1){var o=a[s],l=i.get(o);z(l);var d=l.length,h=this.getAxisPropertyName(o);if(h!=null)for(var f=G.getAxisLayoutProperty(h,d);r[f]!=null;)delete r[f],d+=1,f=G.getAxisLayoutProperty(h,d)}}updateLayoutAxis(e,t,r,i,a,s,o){var l,{dh:d}=this,h=t.type===d.plot.AxisType.Y,f=h?s:a,v=e,p=(l=t.label)!==null&&l!==void 0?l:"";if(v.title!==void 0&&typeof v.title!="string"?v.title.text=p:v.title={text:p},t.log&&(v.type="log"),v.side=this.getAxisSide(t.position),r>0){var m,b;v.overlaying=(m=this.getAxisPropertyName(t.type))!==null&&m!==void 0?m:void 0;var g=(b=i.get(t.position))!==null&&b!==void 0?b:[],C=g.indexOf(t);C>0&&(v.anchor="free",t.position===d.plot.AxisPosition.RIGHT?v.position=o.right+(C-g.length+1)*f:t.position===d.plot.AxisPosition.TOP?v.position=o.top+(C-g.length+1)*f:t.position===d.plot.AxisPosition.BOTTOM?v.position=o.bottom+(g.length-C+1)*f:t.position===d.plot.AxisPosition.LEFT&&(v.position=o.left+(g.length-C+1)*f))}else if(t.type===d.plot.AxisType.X){var S=i.get(d.plot.AxisPosition.LEFT)||[],y=i.get(d.plot.AxisPosition.RIGHT)||[],w=Math.max(o.left,o.left+(S.length-1)*s),E=Math.min(o.right-(y.length-1)*s,o.right);v.domain=[w,E]}else if(t.type===d.plot.AxisType.Y){var D=i.get(d.plot.AxisPosition.BOTTOM)||[],T=i.get(d.plot.AxisPosition.TOP)||[],O=Math.max(o.bottom,o.bottom+(D.length-1)*a),M=Math.min(o.top-(T.length-1)*a,o.top);v.domain=[O,M]}}createBoundsFromDays(e){var t=e.map(s=>this.daysOfWeek.indexOf(s)),r=this.daysOfWeek.filter(s=>!e.includes(s)).map(s=>this.daysOfWeek.indexOf(s)),i=new Set;r.forEach(s=>{for(var o=s+1;o<s+this.daysOfWeek.length;o+=1){var l=o%this.daysOfWeek.length;if(t.includes(l)){i.add(l);break}}});var a=[];return i.forEach(s=>{for(var o=s-1;o>s-this.daysOfWeek.length;o-=1){var l=o<0?o+this.daysOfWeek.length:o;if(t.includes(l)){var d=(l+1)%7;a.push([d,s]);break}}}),a}createRangeBreakValuesFromHolidays(e,t,r){var i=[],a=[];return e.forEach(s=>{s.businessPeriods.length>0?a.push(...this.createPartialHoliday(s,t,r)):i.push(this.createFullHoliday(s,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(v=>{a.push(v.open),a.push(v.close)}),a.push("24:00");for(var s=[],o=0;o<a.length;o+=2){var l=a[o],d=a[o+1];if(l!==d){var h=[this.adjustDateForTimeZone("".concat(i," ").concat(l,":00.000000"),t,r)],f=zw*(G.periodToDecimal(d)-G.periodToDecimal(l));s.push({values:h,dvalue:f})}}return s}adjustDateForTimeZone(e,t,r){return r&&r.standardOffset!==t.standardOffset?this.unwrapValue(this.wrapValue(e,Xd,t),r):e}makeFigureSettings(e,t){var{dh:r}=this,{series:i,xAxis:a,type:s}=e,o=G.titleFromSettings(e),l={formatType:"".concat(r.plot.AxisFormatType.NUMBER),type:"".concat(r.plot.AxisType.X),position:"".concat(r.plot.AxisPosition.BOTTOM)},d={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,d],series:(i??[]).map(h=>({plotStyle:"".concat(s),name:h,dataSources:[{type:"".concat(r.plot.SourceType.X),columnName:a??"",axis:l,table:t},{type:"".concat(r.plot.SourceType.Y),columnName:h,axis:d,table:t}]}))}],title:o}}unwrapValue(e,t){var{dh:r}=this;if(e!=null){if(qw(e))return r.i18n.DateTimeFormat.format(G.DATE_FORMAT,e,t);if(Yw(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(xe.isDateType(t)&&typeof e=="string"){var a=e,s=G.DATE_FORMAT.substr(0,e.length),o=i.i18n.DateTimeFormat.parse(s,a);if(!r)return o;var l="".concat(s," Z"),d=i.i18n.DateTimeFormat.format("Z",o,r),h=i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(d)),f=i.i18n.DateTimeFormat.format("Z",h,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,ticks:"outside",ticklen:5,tickcolor:t.paper_bgcolor,tickfont:{color:t.zerolinecolor},title:{font:{color:t.title_color}},legend:{font:{color:t.legend_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}makeDefaultTemplate(e){var{error_band_line_color:t,ohlc_increasing:r,ohlc_decreasing:i,title_color:a}=e;return{data:{bar:[{marker:{line:{color:"transparent"}}}],scatter:[{error_x:{color:t},error_y:{color:t}}],ohlc:[{increasing:{line:{color:r}},decreasing:{line:{color:i}}}],pie:[{outsidetextfont:{color:a}}],treemap:[{outsidetextfont:{color:a}}]},layout:this.makeDefaultLayout(e)}}makeDefaultLayout(e){var{dh:t}=this,{paper_bgcolor:r,plot_bgcolor:i,title_color:a,coastline_color:s,land_color:o,ocean_color:l,lake_color:d,river_color:h}=e,f={paper_bgcolor:r,plot_bgcolor:i,autosize:!0,colorway:G.normalizeColorway(e==null?void 0:e.colorway),font:{family:"'Fira Sans', sans-serif",color:a},title:{font:{color:a},xanchor:"center",xref:"paper",yanchor:"top",pad:ki({},G.DEFAULT_TITLE_PADDING),y:1},legend:{font:{color:a}},margin:ki({},G.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(null,e)},geo:{showcoastlines:!0,showframe:!1,showland:!0,showocean:!0,showlakes:!0,showrivers:!0,bgcolor:r,coastlinecolor:s,landcolor:o,oceancolor:l,lakecolor:d,rivercolor:h}};return f.datarevision=0,f}hydrateSettings(e){var{dh:t}=this;return ki(ki({},e),{},{type:e.type!=null?t.plot.SeriesPlotStyle[e.type]:void 0})}}He(G,"DEFAULT_AXIS_SIZE",.15);He(G,"MIN_AXIS_SIZE",.025);He(G,"MAX_AXIS_SIZE",.2);He(G,"AXIS_SIZE_PX",75);He(G,"LEGEND_WIDTH_PX",50);He(G,"MAX_LEGEND_SIZE",.25);He(G,"ORIENTATION",Object.freeze({HORIZONTAL:"h",VERTICAL:"v"}));He(G,"DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSS");He(G,"DEFAULT_MARGIN",Object.freeze({l:60,r:50,t:30,b:60,pad:0}));He(G,"DEFAULT_TITLE_PADDING",Object.freeze({t:8}));He(G,"SUBTITLE_LINE_HEIGHT",25);He(G,"DEFAULT_MARKER_SIZE",6);He(G,"MODE_MARKERS","markers");He(G,"MODE_LINES","lines");const Re=G;function et(n,e,t){return e=Jw(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Jw(n){var e=eP(n,"string");return typeof e=="symbol"?e:String(e)}function eP(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 De{constructor(e){et(this,"dh",void 0),et(this,"listeners",void 0),et(this,"formatter",void 0),et(this,"rect",void 0),et(this,"isDownsamplingDisabled",void 0),et(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(De.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(De.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(De.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(De.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(De.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(De.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(De.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(De.EVENT_LOADFINISHED))}fireError(e){this.fireEvent(new CustomEvent(De.EVENT_ERROR,{detail:e}))}}et(De,"EVENT_UPDATED","ChartModel.EVENT_UPDATED");et(De,"EVENT_DISCONNECT","ChartModel.EVENT_DISCONNECT");et(De,"EVENT_RECONNECT","ChartModel.EVENT_RECONNECT");et(De,"EVENT_DOWNSAMPLESTARTED","ChartModel.EVENT_DOWNSAMPLESTARTED");et(De,"EVENT_DOWNSAMPLEFINISHED","ChartModel.EVENT_DOWNSAMPLEFINISHED");et(De,"EVENT_DOWNSAMPLEFAILED","ChartModel.EVENT_DOWNSAMPLEFAILED");et(De,"EVENT_DOWNSAMPLENEEDED","ChartModel.EVENT_DOWNSAMPLENEEDED");et(De,"EVENT_LOADFINISHED","ChartModel.EVENT_LOADFINISHED");et(De,"EVENT_ERROR","ChartModel.EVENT_ERROR");const cl=De;function Qd(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 Jd(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qd(Object(t),!0).forEach(function(r){Pe(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Qd(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Pe(n,e,t){return e=tP(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tP(n){var e=nP(n,"string");return typeof e=="symbol"?e:String(e)}function nP(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 Ae=W.module("FigureChartModel");class Ba extends cl{constructor(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(e),r=this,Pe(this,"chartUtils",void 0),Pe(this,"dh",void 0),Pe(this,"figure",void 0),Pe(this,"settings",void 0),Pe(this,"data",void 0),Pe(this,"layout",void 0),Pe(this,"seriesDataMap",void 0),Pe(this,"pendingSeries",void 0),Pe(this,"oneClicks",void 0),Pe(this,"filterColumnMap",void 0),Pe(this,"lastFilter",void 0),Pe(this,"isConnected",void 0),Pe(this,"seriesToProcess",void 0),Pe(this,"addPendingSeries",Le(()=>{for(var a=Re.getAxisTypeMap(this.figure),{pendingSeries:s}=this,o=function(){var h,f=s[l],v=r.figure.charts.find(p=>p.series.includes(f));r.addSeries(f,a,(h=v==null?void 0:v.showLegend)!==null&&h!==void 0?h:null),f.subscribe()},l=0;l<s.length;l+=1)o();this.pendingSeries=[]},Ba.ADD_SERIES_DEBOUNCE)),Pe(this,"getTimeZone",st((a,s)=>{if(s!=null){var o=s.getColumnTypeFormatter(a);if(o!=null)return o.dhTimeZone}})),Pe(this,"getValueTranslator",st((a,s)=>{var o=this.getTimeZone(a,s);return l=>this.chartUtils.unwrapValue(l,o)})),Pe(this,"getValueParser",st((a,s)=>{var o=this.getTimeZone(a,s);return l=>this.chartUtils.wrapValue(l,a,o)})),Pe(this,"getRangeParser",st((a,s)=>o=>{var[l,d]=o,h=this.getValueParser(a,s);return l=h(l),d=h(d),[l,d]})),Pe(this,"getAxisRangeParser",st((a,s)=>o=>{var l=Re.getSourceForAxis(a,o);return l!=null?this.getRangeParser(l.columnType,s):d=>d})),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=i,this.data=[],this.layout={grid:{rows:t.rows,columns:t.cols,pattern:"independent"}},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.title!=null&&this.figure.title.length>0)return this.figure.title;if(this.figure.charts.length===1){var e;return(e=this.figure.charts[0].title)!==null&&e!==void 0?e:""}return""}initAllSeries(){var e=this;this.oneClicks=[],this.filterColumnMap.clear();var{charts:t}=this.figure,r=Re.getAxisTypeMap(this.figure),i=[];this.seriesToProcess=new Set;for(var a=function(){for(var v=t[s],p=0;p<v.series.length;p+=1){var m=v.series[p];i.push(m.name),e.addSeries(m,r,v.showLegend)}var{axes:b,title:g}=v;if(g!=null&&g.length>0&&(t.length>1||e.figure.title!=null)){var C=b.find(j=>j.type===e.dh.plot.AxisType.X),S=b.find(j=>j.type===e.dh.plot.AxisType.Y);if(C==null||S==null)Ae.warn("Chart title provided, but unknown how to map to the correct axes for this chart type",v);else{var y,w,E,D,T=((y=(w=r.get(C.type))===null||w===void 0?void 0:w.findIndex(j=>j===C))!==null&&y!==void 0?y:0)+1,O=((E=(D=r.get(S.type))===null||D===void 0?void 0:D.findIndex(j=>j===S))!==null&&E!==void 0?E:0)+1,M={align:"center",x:.5,y:1,yshift:17,text:g,showarrow:!1,xref:"x".concat(T," domain"),yref:"y".concat(O," domain")};e.layout.annotations==null?e.layout.annotations=[M]:e.layout.annotations.push(M)}}},s=0;s<t.length;s+=1)a();for(var o=[...this.seriesDataMap.keys()],l=o.filter(f=>i.indexOf(f)<0),d=0;d<l.length;d+=1){var h=l[d];this.seriesDataMap.delete(h)}}addSeries(e,t,r){var{dh:i}=this,a=this.chartUtils.makeSeriesDataFromSeries(e,t,Re.getSeriesVisibility(e.name,this.settings),r);if(this.seriesDataMap.set(e.name,a),this.seriesToProcess.add(e.name),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:o}=s,l=0;l<o.length;l+=1)this.filterColumnMap.set(o[l].name,o[l]);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){Ae.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&&(Ae.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){Ae.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){Ae.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){Ae.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){Ae.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){var{detail:t}=e,{series:r}=t;Ae.debug2("handleFigureUpdated",r);for(var i=0;i<r.length;i+=1){var a=r[i];Ae.debug2("handleFigureUpdated updating series",a.name);for(var{sources:s}=a,o=0;o<s.length;o+=1){var l=s[o],{columnType:d,type:h}=l,f=this.getValueTranslator(d,this.formatter),v=t.getArray(a,h,f);this.setDataArrayForSeries(a,h,v)}this.seriesToProcess.delete(a.name),this.cleanSeries(a)}this.seriesToProcess.size===0&&this.fireLoadFinished();var{data:p}=this;this.fireUpdate(p)}handleRequestFailed(e){Ae.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){Ae.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){Ae.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){var{detail:t}=e;Ae.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=Jd({},this.layout.title),this.layout.title.text=e,this.layout.title.pad=Jd({},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,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)=>{Ae.debug("Assigning ".concat(r),this.layout[r],t);var i=this.layout[r];i!=null?Object.assign(i,t):Ae.debug("Ignoring null layout.".concat(r))})}}setDataArrayForSeries(e,t,r){var{name:i,plotStyle:a}=e,s=this.seriesDataMap.get(i),o=this.chartUtils.getPlotlyProperty(a,t);s&&mc(s,o,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:s,xHigh:o}=a;if(s&&o&&s.length===o.length){for(var l=[],d=0;d<s.length;d+=1)l.push(o[d]-s[d]);a.width=l}}else if(i===t.plot.SeriesPlotStyle.LINE||i===t.plot.SeriesPlotStyle.ERROR_BAR||i===t.plot.SeriesPlotStyle.BAR){var{x:h,xLow:f,xHigh:v,y:p,yLow:m,yHigh:b}=a;f&&v&&f!==h&&(a.error_x=Re.getPlotlyErrorBars(h,f,v)),m&&b&&m!==p&&(a.error_y=Re.getPlotlyErrorBars(p,m,b))}else if(i===t.plot.SeriesPlotStyle.TREEMAP){var{ids:g,labels:C}=a;g!==void 0&&C===void 0&&(a.labels=g)}}}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){Ae.warn("Trying to set a filter, but no one click!");return}Ae.debug("setFilter",e);for(var r=function(){var s=t.oneClicks[i],{columns:o}=s,l=new Set([...e.keys(),...t.lastFilter.keys()]);l.forEach(d=>{var h=e.get(d);t.lastFilter.get(d)!==h&&o.find(f=>f.name===d)!=null&&s.setValueForColumn(d,h)})},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}}Pe(Ba,"ADD_SERIES_DEBOUNCE",50);const to=Ba;function eu(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function ys(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){eu(a,r,i,s,o,"next",l)}function o(l){eu(a,r,i,s,o,"throw",l)}s(void 0)})}}class fl{static makeModelFromSettings(e,t,r){return ys(function*(){var i=yield fl.makeFigureFromSettings(e,t,r);return new to(e,i,t)})()}static makeFigureFromSettings(e,t,r){return ys(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){return ys(function*(){return new to(e,r,t)})()}}const dr=fl;function rP(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 sP extends Error{constructor(){super(...arguments),rP(this,"isDownsamplingError",!0)}}const oP="var(--dh-color-chart-colorway)",lP="var(--dh-color-chart-grid)",dP="var(--dh-color-chart-axis-line)",uP="var(--dh-color-chart-axis-line-zero)",tu={"paper-bgcolor":"var(--dh-color-chart-bg)","plot-bgcolor":"var(--dh-color-chart-plot-bg)","title-color":"var(--dh-color-chart-title)","legend-color":"var(--dh-color-chart-legend-fg)",colorway:oP,gridcolor:lP,linecolor:dP,zerolinecolor:uP,"error-band-line-color":"var(--dh-color-chart-error-band-line)","ohlc-increasing":"var(--dh-color-chart-ohlc-increase)","ohlc-decreasing":"var(--dh-color-chart-ohlc-decrease)","coastline-color":"var(--dh-color-chart-geo-coastline)","land-color":"var(--dh-color-chart-geo-land)","ocean-color":"var(--dh-color-chart-geo-ocean)","lake-color":"var(--dh-color-chart-geo-lake)","river-color":"var(--dh-color-chart-geo-river)"};var nu=W.module("ChartTheme");function vl(){var n,e=Oo(tu);return e.colorway=Cc((n=e.colorway)!==null&&n!==void 0?n:"").map(t=>{var[r,i]=t;return qg.normalizeCssColor(e.colorway.substring(r,i+1))}).join(" "),nu.debug2("Chart theme:",tu),nu.debug2("Chart theme derived:",e),Object.freeze({paper_bgcolor:e["paper-bgcolor"],plot_bgcolor:e["plot-bgcolor"],title_color:e["title-color"],legend_color:e["legend-color"],colorway:e.colorway,gridcolor:e.gridcolor,linecolor:e.linecolor,zerolinecolor:e.zerolinecolor,error_band_line_color:e["error-band-line-color"],ohlc_increasing:e["ohlc-increasing"],ohlc_decreasing:e["ohlc-decreasing"],coastline_color:e["coastline-color"],land_color:e["land-color"],ocean_color:e["ocean-color"],lake_color:e["lake-color"],river_color:e["river-color"]})}function ur(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=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 be extends cl{static get theme(){return be._theme==null&&(be._theme=vl()),be._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=[],s=[],o=[],l=new Date("2018-06-01"),d=0;d<r;d+=1){var h=new Date(l.getFullYear(),l.getMonth(),l.getDate()+d-r);i.push("".concat(h.getFullYear(),"-").concat(h.getMonth()+1,"-").concat(h.getDate()));var f=(Math.sin(d/r*e)*r/3+Math.cos(d*.2)*r/6+Math.sin(d*.5)*r/10+be.random()*r/5+d*be.smoothing)*t;f=Math.round(f*100)/100,a.push(f),o.push(40+d*be.smoothing),s.push(Math.sin(d/r*e)*r/3+be.random()*r/10+d*be.smoothing)}return{x:i,y:a,s,l:o}}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:{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"}}}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 s=t.concat(r.reverse());return{name:"error",x:e.x.concat(e.x.slice().reverse()),y:s,type:"scatter",mode:"line",hoverinfo:"skip",fill:"toself",line:{width:0,color:be.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:{width:3}}}static makeRandomData(){var e=be.makeRandomSeries(6),t=be.makeArea(e),r=be.makeTrendline(e),i=be.makeRandomSeries(2),a=be.makeLine(i),s=be.makeErrorBand(i);return[t,r,a,s]}static makeDefaultLayout(e){var t={template:new Re(e).makeDefaultTemplate(be.theme)};return t.title="Chart",t.xaxis={title:"Datestamp"},t.yaxis={title:"Price"},t}constructor(e){var{data:t=be.makeRandomData(),layout:r=be.makeDefaultLayout(e),filterFields:i=[]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(e),ur(this,"data",void 0),ur(this,"filterFields",void 0),ur(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)}}ur(be,"random",Math.random.bind(Math));ur(be,"smoothing",1.5);ur(be,"_theme",void 0);const fP=be;function ru(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 vP(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ru(Object(t),!0).forEach(function(r){pP(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ru(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function pP(n,e,t){return e=mP(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mP(n){var e=gP(n,"string");return typeof e=="symbol"?e:String(e)}function gP(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 bP=c.lazy(()=>Aa(()=>import("./Plot-967e3bd4.js"),["./Plot-967e3bd4.js","./Plotly-f3032a0a.js","./plotly-bfeeb2d3.js","./helpers-de833af9.js","./vendor-f46f78b9.js","./vendor-35ea25e0.css"],import.meta.url));function Pv(n){return u.jsx(c.Suspense,{fallback:u.jsx(Ne,{}),children:u.jsx(bP,vP({},n))})}var pl=c.createContext(null);function _v(n){var{children:e}=n,{activeThemes:t}=xr(),r=c.useMemo(vl,[t]);return u.jsx(pl.Provider,{value:r,children:e})}function no(n){return n.setFigure!==void 0}function Tv(){return Ir(pl,"No ChartThemeContext value found.")}const CP=Object.freeze(Object.defineProperty({__proto__:null,Chart:hl,ChartModel:cl,ChartModelFactory:dr,ChartThemeContext:pl,ChartThemeProvider:_v,ChartUtils:Re,DownsamplingError:sP,FigureChartModel:to,MockChartModel:fP,Plot:Pv,defaultChartTheme:vl,isFigureChartModel:no,useChartTheme:Tv},Symbol.toStringTag,{value:"Module"}));var Ov=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 Dv(n){return n.componentName!==void 0}function SP(n){return n.component!==void 0}var Iv=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const yP=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:Ov,isGLComponentConfig:Dv,isReactComponentConfig:SP,itemDefaultConfig:Iv},Symbol.toStringTag,{value:"Module"}));function na(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=wP(n,"string");return typeof e=="symbol"?e:String(e)}function wP(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 di{constructor(){na(this,"_mSubscriptions",void 0),na(this,"off",this.unbind),na(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[di.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 s=0;s<t.length;s++){var o=t[s].ctx||{};try{t[s].fn.apply(o,i)}catch(f){console.error("Error while emitting event:",f)}}i.unshift(e);for(var l=this._mSubscriptions[di.ALL_EVENT],d=0;d<l.length;d++){var h=l[d].ctx||{};try{l[d].fn.apply(h,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)}}na(di,"ALL_EVENT","__all");const Nt=di;function wt(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=_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)}class ro extends Nt{constructor(e,t,r){super(),wt(this,"width",void 0),wt(this,"height",void 0),wt(this,"title",void 0),wt(this,"parent",void 0),wt(this,"layoutManager",void 0),wt(this,"tab",void 0),wt(this,"_config",void 0),wt(this,"isHidden",!1),wt(this,"beforeCloseHandler",void 0),wt(this,"_element",Z(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),wt(this,"_contentElement",void 0),this.title=Dv(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,s=this.parent,o=null;s&&!s.isColumn&&!s.isRow;){var l;if(o=s,s=s.parent,(l=s)!==null&&l!==void 0&&l.isRoot)return!1}if(!s||!o)return!1;for(var d=s.isColumn?"height":"width",h=d==="height"?t:e,f=((r=this[d])!==null&&r!==void 0?r:0)*(1/(((i=o.config[d])!==null&&i!==void 0?i:0)/100)),v=h/f*100,p=(((a=o.config[d])!==null&&a!==void 0?a:0)-v)/(s.contentItems.length-1),m=0;m<s.contentItems.length;m++)if(s.contentItems[m]===o)s.contentItems[m].config[d]=v;else{var b;s.contentItems[m].config[d]=((b=s.contentItems[m].config[d])!==null&&b!==void 0?b:0)+p}return s.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(Z.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 TP=Object.freeze(Object.defineProperty({__proto__:null,Container:ro,ItemContainer:ro},Symbol.toStringTag,{value:"Module"}));function xv(n){var e=location.hash.match(new RegExp(n+"=([^&]*)"));return e?e[1]:null}function Nv(n){if(window.location.hash)return xv(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 ml(n){return window.requestAnimationFrame(n)}function OP(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 gl(){return(Math.random()*1e15).toString(36).replace(".","")}function DP(n,e){var t=n.replace(/javascript/gi,"javascript").replace(/expression/gi,"expression").replace(/onload/gi,"onload").replace(/script/gi,"script").replace(/onerror/gi,"onerror");return e===!0?t:t.replace(/>/g,">").replace(/</g,"<")}function bl(n){return Z.trim(n.replace(/(<([^>]+)>)/gi,""))}function ot(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=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 NP extends Nt{constructor(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super(),ot(this,"_eElement",void 0),ot(this,"_oDocument",void 0),ot(this,"_eBody",void 0),ot(this,"_destroyAfterMouseUp",void 0),ot(this,"_nDelay",400),ot(this,"_timeout",void 0),ot(this,"timeout",void 0),ot(this,"_nDistance",10),ot(this,"_nX",0),ot(this,"_nY",0),ot(this,"_nOriginalX",0),ot(this,"_nOriginalY",0),ot(this,"_bDragging",!1),this._eElement=e,this._oDocument=Z(document),this._eBody=Z(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,s=this._getCoordinates(e);this._nOriginalX=(t=s.x)!==null&&t!==void 0?t:0,this._nOriginalY=(r=s.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,s;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)),(s=this._eBody)===null||s===void 0||s.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var o;(o=this._eElement)===null||o===void 0||o.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 wi=NP;function qn(n,e,t){return e=MP(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function MP(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 Mv{constructor(e,t){qn(this,"_container",void 0),qn(this,"_reactComponent",null),qn(this,"_portalComponent",null),qn(this,"_originalComponentWillUpdate",null),qn(this,"_initialState",void 0),qn(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=Z.extend(e,this._container._config.props);return X.createElement(this._reactClass,t)}}var fa=["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"],AP=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function Cl(n){if(fa.length>36)throw new Error("Too many keys in config minifier map");var e={};return Sl(n,e,"_min"),e}function io(n){if(fa.length>36)throw new Error("Too many keys in config minifier map");var e={};return Sl(n,e,"_max"),e}function Sl(n,e,t){var r=t==="_min"?FP:jP;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 s=a instanceof Array?[]:{};if(Array.isArray(e))e[Number.parseInt(i,10)]=s;else{var o=r(i,fa);e[o]=s}Sl(a,s,t)}else{var l=r(a,AP);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var d=r(i,fa);e[d]=l}}}}function FP(n,e){if(typeof n=="string"&&n.length===1)return"___"+n;var t=e.indexOf(n);return t===-1?n:t.toString(36)}function jP(n,e){return typeof n=="string"&&n.length===1?e[parseInt(n,36)]:typeof n=="string"&&n.substr(0,3)==="___"?n[3]:n}function Es(n,e,t){return e=RP(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function RP(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 ao{constructor(e,t){Es(this,"name",void 0),Es(this,"origin",void 0),Es(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function $i(n,e,t){return e=$P(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $P(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)}let HP=class extends Nt{constructor(e){super(),$i(this,"_layoutManager",void 0),$i(this,"_dontPropagateToParent",void 0),$i(this,"_childEventSource",void 0),$i(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Nt.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),Z(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(){Z(window).off("gl_child_event",this._boundOnEventFromChild)}};const Lv=HP,VP=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:ao,DragListener:wi,EventEmitter:Nt,EventHub:Lv,ReactComponentHandler:Mv,animFrame:ml,filterXss:DP,getHashValue:xv,getQueryStringParam:Nv,getUniqueId:gl,minifyConfig:Cl,removeFromArray:OP,stripTags:bl,unminifyConfig:io},Symbol.toStringTag,{value:"Module"}));function rn(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=WP(n,"string");return typeof e=="symbol"?e:String(e)}function WP(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 Av extends Nt{constructor(e,t,r,i,a){super(),rn(this,"isInitialised",!1),rn(this,"_config",void 0),rn(this,"_dimensions",void 0),rn(this,"_parentId",void 0),rn(this,"_indexInParent",void 0),rn(this,"_layoutManager",void 0),rn(this,"_popoutWindow",null),rn(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,s,o,l,d,h,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:(s=this._popoutWindow)===null||s===void 0?void 0:s.screenLeft)!==null&&r!==void 0?r:0,top:(o=(l=(d=this._popoutWindow)===null||d===void 0?void 0:d.screenY)!==null&&l!==void 0?l:(h=this._popoutWindow)===null||h===void 0?void 0:h.screenTop)!==null&&o!==void 0?o: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=Z.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;Z(this._popoutWindow).on("load",this._positionWindow.bind(this)).on("unload beforeunload",this._onClose.bind(this));var a=window.setInterval(()=>{var s;(s=this._popoutWindow)!==null&&s!==void 0&&s.__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-"+gl();e=Cl(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 je(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=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 Un extends Nt{constructor(e,t,r,i,a,s){var o,l,d,h,f,v,p,m;if(super(),je(this,"_dragListener",void 0),je(this,"_layoutManager",void 0),je(this,"_contentItem",void 0),je(this,"_originalParent",void 0),je(this,"_area",null),je(this,"_lastValidArea",null),je(this,"_minX",void 0),je(this,"_maxX",void 0),je(this,"_minY",void 0),je(this,"_maxY",void 0),je(this,"_width",void 0),je(this,"_height",void 0),je(this,"_sided",void 0),je(this,"element",void 0),je(this,"childElementContainer",void 0),je(this,"_proxyTab",void 0),this._dragListener=r,this._layoutManager=i,this._contentItem=a,this._originalParent=s,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var b,g;this._layoutManager.tabDropPlaceholder.width((b=this._contentItem.tab.element.outerWidth(!0))!==null&&b!==void 0?b:0),this._layoutManager.tabDropPlaceholder.height((g=this._contentItem.tab.element.outerHeight(!0))!==null&&g!==void 0?g:0)}if(this.element=Z(Un._template),s&&s._side&&(this._sided=s._sided,this.element.addClass("lm_"+s._side),["right","bottom"].indexOf(s._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",bl((o=this._contentItem.config.title)!==null&&o!==void 0?o:"")),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(),Z(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var C,S;this._layoutManager.tabDropPlaceholder.width((C=this._proxyTab.outerWidth(!0))!==null&&C!==void 0?C:0),this._layoutManager.tabDropPlaceholder.height((S=this._proxyTab.outerHeight(!0))!==null&&S!==void 0?S:0)}var y=this._layoutManager.container.offset();this._minX=(d=y==null?void 0:y.left)!==null&&d!==void 0?d:0,this._minY=(h=y==null?void 0:y.top)!==null&&h!==void 0?h:0,this._maxX=((f=this._layoutManager.container.width())!==null&&f!==void 0?f:0)+this._minX,this._maxY=((v=this._layoutManager.container.height())!==null&&v!==void 0?v:0)+this._minY,this._width=(p=this.element.width())!==null&&p!==void 0?p:0,this._height=(m=this.element.height())!==null&&m!==void 0?m:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,r){var i,a,s=(i=r.pageX)!==null&&i!==void 0?i:0,o=(a=r.pageY)!==null&&a!==void 0?a:0,l=s>this._minX&&s<this._maxX&&o>this._minY&&o<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(s,o)}_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")}}je(Un,"_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 Ui(n,e,t){return e=KP(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function KP(n){var e=qP(n,"string");return typeof e=="symbol"?e:String(e)}function qP(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 Fv{constructor(e,t,r){Ui(this,"_element",void 0),Ui(this,"_itemConfig",void 0),Ui(this,"_layoutManager",void 0),Ui(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=r,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new wi(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(Z.extend(!0,{},r));new Un(e,t,this._dragListener,this._layoutManager,i,null)}}function Hi(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=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 jv{constructor(e,t,r){Hi(this,"_element",Z(window)),Hi(this,"_itemConfig",void 0),Hi(this,"_layoutManager",void 0),Hi(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 wi(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(Z.extend(!0,{},r));new Un(e,t,this._dragListener,this._layoutManager,i,null)}}}function Rv(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=QP(n,"string");return typeof e=="symbol"?e:String(e)}function QP(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 Pi{constructor(){Rv(this,"element",Z(Pi._template)),Z(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()}}Rv(Pi,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function ws(n,e,t){return e=JP(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function JP(n){var e=e0(n,"string");return typeof e=="symbol"?e:String(e)}function e0(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 Kr{constructor(e,t,r,i){ws(this,"element",void 0),ws(this,"_header",void 0),ws(this,"_action",void 0),this._header=e,this.element=Z('<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 t0(n,e,t){return e=n0(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function n0(n){var e=r0(n,"string");return typeof e=="symbol"?e:String(e)}function r0(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 i0 extends Error{constructor(e,t){super(),t0(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const Nn=i0,a0=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:Nn},Symbol.toStringTag,{value:"Module"}));function Me(n,e,t){return e=s0(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function s0(n){var e=o0(n,"string");return typeof e=="symbol"?e:String(e)}function o0(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 ui(n){return n.isStack}function ut(n){return n.isComponent}function kv(n){return n.isRoot}class Ue extends Nt{constructor(e,t,r,i){super(),Me(this,"config",void 0),Me(this,"type",void 0),Me(this,"contentItems",void 0),Me(this,"parent",void 0),Me(this,"layoutManager",void 0),Me(this,"element",void 0),Me(this,"childElementContainer",void 0),Me(this,"componentName",void 0),Me(this,"isInitialised",!1),Me(this,"isMaximised",!1),Me(this,"isRoot",!1),Me(this,"isRow",!1),Me(this,"isColumn",!1),Me(this,"isStack",!1),Me(this,"isComponent",!1),Me(this,"tab",void 0),Me(this,"_pendingEventPropagations",void 0),Me(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(Nt.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,ui(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 s=0;s<a.contentItems.length;s++)e(a.contentItems[s])===!0&&t.push(a.contentItems[s]),i(a.contentItems[s])};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&&ut(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},s=(r=e.width())!==null&&r!==void 0?r:0,o=(i=e.height())!==null&&i!==void 0?i:0;return{x1:a.left,y1:a.top,x2:a.left+s,y2:a.top+o,surface:s*o,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 ao(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new Nn("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(Iv)){var i=t;e[i]===void 0&&(e[i]=r)}return e}_propagateEvent(e,t){t instanceof ao&&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,ml(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function $r(n,e,t){return e=l0(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function l0(n){var e=d0(n,"string");return typeof e=="symbol"?e:String(e)}function d0(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 $v extends Ue{constructor(e,t,r){super(e,t,r,Z()),$r(this,"config",void 0),$r(this,"componentName",void 0),$r(this,"container",void 0),$r(this,"parent",void 0),$r(this,"instance",void 0),this.config=t,this.parent=r;var i=e.getComponent(this.config.componentName)||e.getFallbackComponent(),a=Z.extend(!0,{},this.config.componentState||{});if(i==null)throw new Nn('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 ro(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(){Ue.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),Ue.prototype._$hide.call(this)}_$show(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),Ue.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),Ue.prototype._$destroy.call(this)}_$getArea(){return null}}function gt(n,e,t){return e=u0(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function u0(n){var e=h0(n,"string");return typeof e=="symbol"?e:String(e)}function h0(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 va extends Ue{constructor(e,t,r,i){super(t,r,i,Z('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),gt(this,"isRow",void 0),gt(this,"isColumn",void 0),gt(this,"childElementContainer",void 0),gt(this,"parent",void 0),gt(this,"_splitter",[]),gt(this,"_splitterSize",void 0),gt(this,"_splitterGrabSize",void 0),gt(this,"_isColumn",void 0),gt(this,"_dimension",void 0),gt(this,"_splitterPosition",null),gt(this,"_splitterMinPosition",null),gt(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,s,o;if(e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.length>0?(o=this._createSplitter(Math.max(0,t-1)).element,t>0?(this.contentItems[t-1].element.after(o),o.after(e.element)):(this.contentItems[0].element.before(o),o.before(e.element))):this.childElementContainer.append(e.element),Ue.prototype.addChild.call(this,e,t),i=1/this.contentItems.length*100,r===!0){this.emitBubblingEvent("stateChanged");return}for(s=0;s<this.contentItems.length;s++)if(this.contentItems[s]===e)e.config[this._dimension]=i;else{var l;a=((l=this.contentItems[s].config[this._dimension])!==null&&l!==void 0?l:0)*(100-i)/100,this.contentItems[s].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),s=Math.max(a-1,0),o,l;if(a===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[s]&&(this._splitter[s]._$destroy(),this._splitter.splice(s,1)),o=0;o<this.contentItems.length;o++)if(this.contentItems[o]!==e){var d;this.contentItems[o].config[this._dimension]=((d=this.contentItems[o].config[this._dimension])!==null&&d!==void 0?d:0)+i/(this.contentItems.length-1)}Ue.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(Ue.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,s=0,o=[];this._isColumn?a-=r:i-=r;for(var l=0;l<this.contentItems.length;l++){var d,h,f=this._isColumn?Math.floor(a*(((d=this.contentItems[l].config.height)!==null&&d!==void 0?d:0)/100)):Math.floor(i*(((h=this.contentItems[l].config.width)!==null&&h!==void 0?h:0)/100));s+=f,o.push(f)}var v=Math.floor((this._isColumn?a:i)-s);return{itemSizes:o,additionalPixel:v,totalWidth:i,totalHeight:a}}_calculateRelativeSizes(){for(var e=0,t=[],r=this._isColumn?"height":"width",i=0;i<this.contentItems.length;i++){var a=this.contentItems[i].config[r];a!=null?e+=a:t.push(this.contentItems[i])}if(Math.round(e)===100){this._respectMinItemWidth();return}if(Math.round(e)<100&&t.length>0){for(var s=0;s<t.length;s++)t[s].config[r]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var o=0;o<t.length;o++)t[o].config[r]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var d;this.contentItems[l].config[r]=((d=this.contentItems[l].config[r])!==null&&d!==void 0?d: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,s=0,o=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var d=this._calculateAbsoluteSizes(),h=0;h<this.contentItems.length;h++){this.contentItems[h];var f=d.itemSizes[h];f<t?(a+=t-f,l={width:t}):(i+=f-t,l={width:f},r.push(l)),o.push(l)}if(!(a===0||a>i)){var v=a/i;s=a;for(var p=0;p<r.length;p++){l=r[p];var m=Math.round((l.width-t)*v);s-=m,l.width-=m}s!==0&&(o[o.length-1].width-=s);for(var b=0;b<this.contentItems.length;b++)this.contentItems[b].config.width=o[b].width/d.totalWidth*100}}}_createSplitter(e){var t;return t=new Uv(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,s;t=Math.max((a=e[i].minWidth)!==null&&a!==void 0?a:0,t),r=Math.max((s=e[i].minHeight)!==null&&s!==void 0?s:0,r)}return{horizontal:t,vertical:r}}_onSplitterDragStart(e){var t,r,i,a,s=this._getItemsForSplitter(e),o=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=s.before.config.content)!==null&&t!==void 0?t:[]),d=this._isColumn?l.vertical:l.horizontal,h=this._getMinimumDimensions((r=s.after.config.content)!==null&&r!==void 0?r:[]),f=this._isColumn?h.vertical:h.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((i=s.before.element[this._dimension]())!==null&&i!==void 0?i:0)-(d||o)),this._splitterMaxPosition=((a=s.after.element[this._dimension]())!==null&&a!==void 0?a:0)-(f||o)}_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,s,o=this._getItemsForSplitter(e),l=(t=o.before.element[this._dimension]())!==null&&t!==void 0?t:0,d=(r=o.after.element[this._dimension]())!==null&&r!==void 0?r:0,h=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+d),f=((a=o.before.config[this._dimension])!==null&&a!==void 0?a:0)+((s=o.after.config[this._dimension])!==null&&s!==void 0?s:0);o.before.config[this._dimension]=h*f,o.after.config[this._dimension]=(1-h)*f,e.element.css({top:0,left:0}),ml(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function iu(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 au(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?iu(Object(t),!0).forEach(function(r){so(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):iu(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function so(n,e,t){return e=c0(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function c0(n){var e=f0(n,"string");return typeof e=="symbol"?e:String(e)}function f0(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 oo extends Ue{constructor(e,t,r){super(e,au(au({},t),{},{type:"root"}),null,Z('<div class="lm_goldenlayout lm_item lm_root"></div>')),so(this,"childElementContainer",void 0),so(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(ut(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",s=i==="left"||i==="right"?"width":"height",o=i==="left"||i==="top",l=this.contentItems[0];if(!(l instanceof va)||l.type!=a){var d=this.layoutManager.createContentItem({type:a},this);this.replaceChild(l,d),d.addChild(e,o?0:void 0,!0),d.addChild(l,o?void 0:0,!0),l.config[s]=50,e.config[s]=50,d.callDownwards("setSize")}else{var h,f=l.contentItems[o?0:l.contentItems.length-1];l.addChild(e,o?0:void 0,!0),f.config[s]=((h=f.config[s])!==null&&h!==void 0?h:0)*.5,e.config[s]=f.config[s],l.callDownwards("setSize")}}}}function su(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 Yn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?su(Object(t),!0).forEach(function(r){at(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):su(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function at(n,e,t){return e=v0(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function v0(n){var e=p0(n,"string");return typeof e=="symbol"?e:String(e)}function p0(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 lo extends Ue{constructor(e,t,r){var i,a,s,o,l,d,h,f,v;super(e,t,r,Z('<div class="lm_item lm_stack"></div>')),at(this,"_activeContentItem",null),at(this,"_header",void 0),at(this,"childElementContainer",Z('<div class="lm_items"></div>')),at(this,"header",void 0),at(this,"parent",void 0),at(this,"isStack",!0),at(this,"_dropZones",{}),at(this,"_dropSegment",null),at(this,"_contentAreaDimensions",null),at(this,"_dropIndex",void 0),at(this,"_side",void 0),at(this,"_sided",!1),at(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?(s=p.labels)===null||s===void 0?void 0:s.popout:void 0,maximise:(o=p.settings)!==null&&o!==void 0&&o.showMaximiseIcon?(l=p.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(d=p.settings)!==null&&d!==void 0&&d.showCloseIcon?(h=p.labels)===null||h===void 0?void 0:h.close:void 0,minimise:(f=(v=p.labels)===null||v===void 0?void 0:v.minimise)!==null&&f!==void 0?f:void 0},p.header&&(this._header=Yn(Yn({},this._header),p.header)),t.header&&(this._header=Yn(Yn({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=Yn(Yn({},this._header),t.content[0].header)),this.header=new Zt(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,r,i,a,s=this._header.show&&(e=(t=this.layoutManager.config.dimensions)===null||t===void 0?void 0:t.headerHeight)!==null&&e!==void 0?e:0,o=((r=this.element.width())!==null&&r!==void 0?r:0)-(this._sided?s:0),l=((i=this.element.height())!==null&&i!==void 0?i:0)-(this._sided?0:s);for(this.childElementContainer.width(o),this.childElementContainer.height(l),a=0;a<this.contentItems.length;a++)this.contentItems[a].element.width(o).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(){Ue.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,s=t?"column":"row",o=t?"height":"width";if(ut(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(a){var d,h=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?h:h+1,!0),this.config[o]=((d=this.config[o])!==null&&d!==void 0?d:0)*.5,e.config[o]=this.config[o],this.parent.callDownwards("setSize")}else{var f=this.layoutManager.createContentItem({type:s},this);this.parent.replaceChild(this,f),f.addChild(e,i?0:void 0,!0),f.addChild(this,i?void 0:0,!0),this.config[o]=50,e.config[o]=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,s,o,l,d,h,f,v,p,m,b,g,C,S=this.header.tabs.length;if(S===0){var y,w,E,D,T,O,M,j,H=this.header.element.offset();(y=this.layoutManager.dropTargetIndicator)===null||y===void 0||y.highlightArea({x1:(w=H==null?void 0:H.left)!==null&&w!==void 0?w:0,x2:((E=H==null?void 0:H.left)!==null&&E!==void 0?E:0)+100,y1:(D=(T=this.header.element.offset())===null||T===void 0?void 0:T.top)!==null&&D!==void 0?D:0,y2:((O=(M=this.header.element.offset())===null||M===void 0?void 0:M.top)!==null&&O!==void 0?O:0)+((j=this.header.element.innerHeight())!==null&&j!==void 0?j:0)});return}var L=this.header.tabsContainer,I=(t=L.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),N=(r=this.layoutManager.tabDropPlaceholder.get(0))===null||r===void 0?void 0:r.getBoundingClientRect();if(!(!I||!N)){e<I.left?e=I.left+1:e>I.right&&(e=I.right-1);var A,k;if(!(N.left<e&&e<N.right)){for(var V=0;V<S;V++){var q;if(A=this.header.tabs[V].element,k=(q=A.get(0))===null||q===void 0?void 0:q.getBoundingClientRect(),k&&k.left<e&&e<k.right){this._dropIndex=V;break}}if(A&&k&&e<k.left+k.width*.5)A.before(this.layoutManager.tabDropPlaceholder);else if(A){var re;this._dropIndex=Math.min(((re=this._dropIndex)!==null&&re!==void 0?re:0)+1,S),A.after(this.layoutManager.tabDropPlaceholder)}}var B=(i=(a=this.layoutManager.tabDropPlaceholder.offset())===null||a===void 0?void 0:a.left)!==null&&i!==void 0?i:0;B=Math.max(B,(s=(o=this.header.tabsContainer.offset())===null||o===void 0?void 0:o.left)!==null&&s!==void 0?s:0);var x=B+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);x=Math.min(x,((d=(h=this.header.tabsContainer.offset())===null||h===void 0?void 0:h.left)!==null&&d!==void 0?d:0)+((f=this.header.tabsContainer.innerWidth())!==null&&f!==void 0?f:0)),(v=this.layoutManager.dropTargetIndicator)===null||v===void 0||v.highlightArea({x1:B,x2:x,y1:(p=(m=this.header.element.offset())===null||m===void 0?void 0:m.top)!==null&&p!==void 0?p:0,y2:((b=(g=this.header.element.offset())===null||g===void 0?void 0:g.top)!==null&&b!==void 0?b:0)+((C=this.header.element.innerHeight())!==null&&C!==void 0?C: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 m0=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:Ue,Component:$v,ContentItem:Ue,Root:oo,RowOrColumn:va,Stack:lo,isComponent:ut,isRoot:kv,isStack:ui},Symbol.toStringTag,{value:"Module"}));function Kt(n,e,t){return e=g0(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function g0(n){var e=b0(n,"string");return typeof e=="symbol"?e:String(e)}function b0(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 _i{constructor(e,t){var r;Kt(this,"header",void 0),Kt(this,"contentItem",void 0),Kt(this,"element",Z(_i._template)),Kt(this,"titleElement",void 0),Kt(this,"closeElement",void 0),Kt(this,"isActive",!1),Kt(this,"_layoutManager",void 0),Kt(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 wi(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),ut(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),ut(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 Un(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(){Z(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin")}_onTabContentFocusOut(){ut(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&&ut(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):ut(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),ut(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(),ut(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onCloseMousedown(e){e.stopPropagation()}}Kt(_i,"_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 le(n,e,t){return e=C0(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function C0(n){var e=S0(n,"string");return typeof e=="symbol"?e:String(e)}function S0(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 Zt extends Nt{constructor(e,t){var r,i;super(),le(this,"layoutManager",void 0),le(this,"element",Z(Zt._template)),le(this,"tabsContainer",void 0),le(this,"tabDropdownContainer",void 0),le(this,"tabDropdownSearch",void 0),le(this,"tabDropdownList",null),le(this,"controlsContainer",void 0),le(this,"parent",void 0),le(this,"tabs",[]),le(this,"activeContentItem",null),le(this,"closeButton",null),le(this,"tabDropdownButton",null),le(this,"tabNextButton",Z(Zt._nextButtonTemplate)),le(this,"tabPreviousButton",Z(Zt._previousButtonTemplate)),le(this,"holdTimer",null),le(this,"rAF",null),le(this,"CLICK_TIMEOUT",500),le(this,"START_SPEED",.01),le(this,"ACCELERATION",5e-4),le(this,"PADDING",10),le(this,"SCROLL_LEFT","left"),le(this,"SCROLL_RIGHT","right"),le(this,"isDraggingTab",!1),le(this,"isOverflowing",!1),le(this,"isDropdownShown",!1),le(this,"dropdownKeyIndex",0),le(this,"_lastVisibleTabIndex",-1),le(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 _i(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,s=0;s<this.tabs.length;s++)a=this.tabs[s].contentItem===e,this.tabs[s].setActive(a),a===!0&&(this.activeContentItem=e,this.parent.config.activeItemIndex=s);(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,s,o;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r:0)>((a=(s=this.tabsContainer.get(0))===null||s===void 0?void 0:s.offsetWidth)!==null&&a!==void 0?a:0)+((o=this.tabsContainer.scrollLeft())!==null&&o!==void 0?o: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 d,h;l.scrollLeft=(d=(h=this.tabsContainer.get(0))===null||h===void 0?void 0:h.scrollWidth)!==null&&d!==void 0?d: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 s=this.tabsContainer.get(0);s&&(s.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,s=this.tabsContainer.get(0);if(s){var o=s.getBoundingClientRect();if(e===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(t-i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(o.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(e===this.SCROLL_RIGHT){var l,d;if(this.tabsContainer.scrollLeft(t+i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(o.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((d=this.tabsContainer.innerWidth())!==null&&d!==void 0?d:0)===s.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((r=this.rAF)!==null&&r!==void 0?r:-1),this.rAF=window.requestAnimationFrame(h=>{var f,v,p=a||h,m=h-p,b=this.START_SPEED*m+.5*this.ACCELERATION*(m*m);b=Math.min(b,(f=(v=this.tabsContainer.get(0))===null||v===void 0?void 0:v.scrollWidth)!==null&&f!==void 0?f:1/0),this._handleScrollRepeat(e,t,b,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(),Z(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 Kr(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 Kr(this,r,"lm_popout",t)),this._getHeaderSetting("maximise")){i=this.parent.toggleMaximise.bind(this.parent);var s=this._getHeaderSetting("maximise"),o=this._getHeaderSetting("minimise"),l=new Kr(this,s,"lm_maximise",i);this.parent.on("maximised",function(){l.element.attr("title",o??"")}),this.parent.on("minimised",function(){l.element.attr("title",s??"")})}this._isClosable()&&(e=this.parent.remove.bind(this.parent),r=this._getHeaderSetting("close"),this.closeButton=new Kr(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"),Z(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"),Z(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(o,l,d){if(d==null||d.length<2)return-1;for(var h=(o+l+d.length)%d.length;h!==o;){if(d.eq(h).css("display")!=="none")return h;h=(h+l+d.length)%d.length}return o}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,s;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),(s=this.tabDropdownList)===null||s===void 0||s.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(),Z(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 s=this.tabDropdownContainer[0].getBoundingClientRect(),o=(r=Z(window).height())!==null&&r!==void 0?r:0,l=(i=Z(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var d=this.tabDropdownButton.element[0].getBoundingClientRect(),h=a<o-d.bottom,f=!h&&d.bottom>o*.6,v=Math.min(d.left+(f?d.width:0),l-s.width-this.PADDING),p=f?Math.max(d.top-a,this.PADDING):d.bottom,m=o-p-this.PADDING;this.tabDropdownContainer.css({"max-height":m,top:p,left:v})}}}}_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()}}}}le(Zt,"_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(""));le(Zt,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));le(Zt,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function Ur(n,e,t){return e=y0(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function y0(n){var e=E0(n,"string");return typeof e=="symbol"?e:String(e)}function E0(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 Uv{constructor(e,t,r){Ur(this,"_isVertical",void 0),Ur(this,"_size",void 0),Ur(this,"_grabSize",void 0),Ur(this,"_dragListener",void 0),Ur(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=r<t?t:r,this.element=this._createElement(),this._dragListener=new wi(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=Z('<div class="lm_drag_handle"></div>'),t=Z('<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 w0=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:Av,DragProxy:Un,DragSource:Fv,DragSourceFromEvent:jv,DropTargetIndicator:Pi,Header:Zt,HeaderButton:Kr,Splitter:Uv,Tab:_i},Symbol.toStringTag,{value:"Module"}));var P0={config:yP,container:TP,controls:w0,errors:a0,items:m0,utils:VP};const _0=P0;function ou(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 nt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ou(Object(t),!0).forEach(function(r){ue(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ou(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ue(n,e,t){return e=T0(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function T0(n){var e=O0(n,"string");return typeof e=="symbol"?e:String(e)}function O0(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 Hv extends Nt{static minifyConfig(e){return Cl(e)}static unminifyConfig(e){return io(e)}constructor(e,t){super(),ue(this,"isInitialised",!1),ue(this,"_isFullPage",!1),ue(this,"_resizeTimeoutId",void 0),ue(this,"_components",{"lm-react-component":Mv}),ue(this,"_fallbackComponent",void 0),ue(this,"_itemAreas",[]),ue(this,"_maximisedItem",null),ue(this,"_maximisePlaceholder",Z('<div class="lm_maximise_place"></div>')),ue(this,"_creationTimeoutPassed",!1),ue(this,"_subWindowsCreated",!1),ue(this,"_dragSources",[]),ue(this,"_updatingColumnsResponsive",!1),ue(this,"_firstLoad",!0),ue(this,"_reactChildMap",new Map),ue(this,"_reactChildren",null),ue(this,"width",null),ue(this,"height",null),ue(this,"root",void 0),ue(this,"openPopouts",[]),ue(this,"selectedItem",null),ue(this,"isSubWindow",!1),ue(this,"eventHub",new Lv(this)),ue(this,"config",void 0),ue(this,"container",void 0),ue(this,"_originalContainer",void 0),ue(this,"dropTargetIndicator",null),ue(this,"tabDropPlaceholder",Z('<div class="lm_drop_tab_placeholder"></div>')),ue(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&&Z("body").css("visibility","hidden"),this._typeToItem={column:va.bind(this,!0),row:va.bind(this,!1),stack:lo,component:$v}}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 Ue))throw new Error("Root must be a ContentItem");var t={settings:nt({},this.config.settings),dimensions:nt({},this.config.dimensions),labels:nt({},this.config.labels),content:[]},r=function a(s,o){for(var l in o.config)l!=="content"&&(s[l]=o.config[l]);if(s.componentName==="lm-react-component"&&(s.type="react-component"),o.contentItems.length){s.content=[];for(var d=0;d<o.contentItems.length;d++)s.content[d]={},a(s.content[d],o.contentItems[d])}};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){Z(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 Pi,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,s;this._maximisedItem.element.width((a=this.container.width())!==null&&a!==void 0?a:0),this._maximisedItem.element.height((s=this.container.height())!==null&&s!==void 0?s:0),this._maximisedItem.callDownwards("setSize")}this._adjustColumnsResponsive()}}destroy(){var e;this.isInitialised===!1||!this.root||(this._onUnload(),Z(window).off("resize",this._onResize),Z(window).off("unload beforeunload",this._onUnload),Z(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 Nn("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 Nn(r);return e.type==="component"&&!(t instanceof lo)&&t&&!(this.isSubWindow===!0&&t instanceof oo)&&(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=[],s=e instanceof Ue,o=this;if(s){var l;a=this.toConfig(e).content,r=gl();for(var d=e.parent,h=e;((f=d)===null||f===void 0?void 0:f.contentItems.length)===1&&!d.isRoot;){var f;h=d,d=d.parent}if((l=d)===null||l===void 0||l.addId(r),i==null||Number.isNaN(i)){var v;i=(v=d)===null||v===void 0?void 0:v.contentItems.indexOf(h)}}else e instanceof Array?a=e:a=[e];if(!t&&s){var p,m,b,g=window.screenX||window.screenLeft,C=window.screenY||window.screenTop,S=(p=e.element.offset())!==null&&p!==void 0?p:{left:0,top:0};t={left:g+S.left,top:C+S.top,width:(m=e.element.width())!==null&&m!==void 0?m:0,height:(b=e.element.height())!==null&&b!==void 0?b:0}}if(!t&&!s&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),s&&e.remove(),!(!t||!r||i===void 0)){var y=new Av(a,t,r,i,this);return y.on("initialised",function(){o.emit("windowOpened",y)}),y.on("closed",function(){o._$reconcilePopoutWindows()}),this.openPopouts.push(y),y}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var r=new Fv(e,t,this);return this._dragSources.push(r),r}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new jv(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 s=this._itemAreas[a];e>s.x1&&e<s.x2&&t>s.y1&&t<s.y2&&r>s.surface&&(r=s.surface,i=s)}return i}_$createRootItemAreas(){var e=50,t=nt({},this.root._$getArea()),r=[nt(nt({},t),{},{side:"left",x2:t.x1+e}),nt(nt({},t),{},{side:"right",x1:t.x2-e}),nt(nt({},t),{},{side:"top",y2:t.y1+e}),nt(nt({},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(ui(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 s=nt(nt({},i),(a=i.contentItem._contentAreaDimensions)===null||a===void 0?void 0:a.header.highlightArea);s.surface=(s.x2-s.x1)*(s.y2-s.y1),this._itemAreas.push(s)}}}}_$normalizeContentItem(e,t){if(!e)throw new Error("No content item defined");if(typeof e=="function"&&(e=e()),e instanceof Ue)return e;if(Z.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&&Z(window).resize(this._onResize),Z(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=Nv("gl-window");r&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(r)||"{}"),e=io(e),localStorage.removeItem(r)),e=Z.extend(!0,{},Ov,e);var i=function a(s){for(var o in s){var l=s[o];o!=="props"&&typeof l=="object"&&l!=null?a(l):o==="type"&&l==="react-component"&&(s.type="component",s.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=Z('<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=bl((e=this.config.content[0].title)!==null&&e!==void 0?e:""),Z("head").append(Z("body link, body style, template, .gl_keep")),this.container=Z("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?Z(this._originalContainer):Z("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,Z("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 Nn(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new Nn(t,e);this.root=new oo(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,s=this.root.contentItems[0],o=this._findAllStackContainers()[0],l=0;l<a;l++){var d=s.contentItems[s.contentItems.length-1];this._addChildContentItemsToContainer(o,d)}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=>{ui(r)?e.push(r):r.isComponent||this._findAllStackContainersRecursive(e,r)})}}ue(Hv,"__lm",_0);const Vv=Hv,D0="_lm_dragging_k4a5m_1",I0="_lm_goldenlayout_k4a5m_1",x0="_lm_header_k4a5m_1",N0="_lm_controls_k4a5m_1",M0="_lm_tabpreviousbutton_k4a5m_1",L0="_lm_tabnextbutton_k4a5m_1",A0="_lm_tab_k4a5m_1",F0="_lm_active_k4a5m_1",j0="_lm_close_tab_k4a5m_1",R0="_lm_content_k4a5m_1",k0="_lm_dragProxy_k4a5m_1",$0="_lm_dropTargetIndicator_k4a5m_1",U0="_march_k4a5m_1",H0="_lm_inner_k4a5m_1",V0="_lm_splitter_k4a5m_1",B0="_lm_selectable_k4a5m_1",W0="_lm_tabdropdown_list_k4a5m_1",G0="_lm_title_k4a5m_1",z0="_lm_title_before_k4a5m_1",K0="_lm_selected_k4a5m_1",q0="_lm_focusin_k4a5m_1",Y0="_lm_window_blur_k4a5m_1",X0="_lm_popout_k4a5m_1",Z0="_lm_maximise_k4a5m_1",Q0="_lm_tabdropdown_k4a5m_1",J0="_lm_close_k4a5m_1",e_="_lm_tabdropdown_search_k4a5m_1",t_="_lm_tabs_k4a5m_1",n_="_lm_keyboard_active_k4a5m_1",r_="_lm_maximised_k4a5m_1",i_="_lm_items_k4a5m_1",lu={"tab-height":"28px","drag-border-width":"5px",lm_dragging:D0,lm_goldenlayout:I0,lm_header:x0,lm_controls:N0,lm_tabpreviousbutton:M0,lm_tabnextbutton:L0,lm_tab:A0,lm_active:F0,lm_close_tab:j0,lm_content:R0,lm_dragProxy:k0,lm_dropTargetIndicator:$0,march:U0,lm_inner:H0,lm_splitter:V0,lm_selectable:B0,lm_tabdropdown_list:W0,lm_title:G0,lm_title_before:z0,lm_selected:K0,lm_focusin:q0,lm_window_blur:Y0,lm_popout:X0,lm_maximise:Z0,lm_tabdropdown:Q0,lm_close:J0,lm_tabdropdown_search:e_,lm_tabs:t_,lm_keyboard_active:n_,lm_maximised:r_,lm_items:i_},du=Object.freeze({tabHeight:parseInt(lu["tab-height"],10),dragBorderWidth:parseInt(lu["drag-border-width"],10)});function uu(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 Bt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?uu(Object(t),!0).forEach(function(r){Bv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):uu(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Bv(n,e,t){return e=a_(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function a_(n){var e=s_(n,"string");return typeof e=="symbol"?e:String(e)}function s_(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 an=W.module("LayoutUtils");function Wv(n){return n.componentName!==void 0}function rr(n){var e=n;return(Wv(n)&&n.componentName==="lm-react-component"||n.type==="react-component")&&e.component!==void 0}function Vi(n){return n.focus!==void 0}function hu(n){return n.type==="stack"}class F{static activateTab(e,t){var r=F.getStackForRoot(e,t,!1);if(!r){an.error("Could not find stack for config",t);return}var i=F.getContentItemInStack(r,t);i&&r.setActiveContentItem(i)}static isActiveTab(e,t){var r=F.getStackForRoot(e,t,!1);if(!r)return an.error("Could not find stack for config",t),!1;var i=F.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(kv(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 s=document.activeElement;e.contentItems[0].addChild(i),s&&s.focus!=null&&s.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 o=e.contentItems[e.contentItems.length-1],l=t?o.isRow:o.isColumn;return l||(e.addChild({type:t?"row":"column"}),e.removeChild(o,!0),e.contentItems[e.contentItems.length-1].addChild(o),o=e.contentItems[e.contentItems.length-1]),this.addStack(o,!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&&ui(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&&Xl(a.config,t))return e;var s=this.getStackForConfig(a,t,r);if(s)return s}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,s=this.getStackForConfig(e,t);return!s&&i&&(s=this.getStackForConfig(e,{component:t.component},a)),!s&&r&&(s=this.addStack(e)),s}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,s=0;s<t.length;s+=1){var o=t[s],l=s===t.length-1,d=F.getStackForRoot(e,{component:o},r&&l,i,a);if(d)return d}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&&Xl(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:s,content:o}=a;if(s){var l=t(s,a);l!=null?r.push(l):an.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(s,'"'))}else if(o){var d=Bt(Bt({},a),{},{content:F.dehydrateLayoutConfig(o,t)});r.push(d)}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?(hu(r)&&delete r.activeItemIndex,F.dropLayoutMinorChange(i)):rr(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,i=F.cloneLayout(e),a=F.cloneLayout(t);return r?(F.dropLayoutMinorChange(i),F.dropLayoutMinorChange(a),mr(i,a)):mr(i,a)}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(rr(a)){var s,{component:o,props:l={}}=a;r.push(Bt(Bt({},a),{},{id:(s=a==null?void 0:a.id)!==null&&s!==void 0?s:ye(),props:t(o,l)}))}else if(a.content!==void 0){var d=F.hydrateLayoutConfig(a.content,t);hu(a)&&a.activeItemIndex!=null&&a.activeItemIndex>=d.length&&(an.warn("Fixing bad activeItemIndex!",a.activeItemIndex,a),a.activeItemIndex=0),r.push(Bt(Bt({},a),{},{content:d}))}else r.push(a)}return r}static openComponent(){var{root:e,config:t,replaceExisting:r=!0,replaceConfig:i=void 0,createNewStack:a=!1,focusElement:s=void 0,dragEvent:o=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},l=document.activeElement,d=Bt({},t);if(d.id==null&&(d.id=ye.generate()),o!=null){e==null||e.layoutManager.createDragSourceFromEvent(d,o);return}var h=i||{id:d.id,component:d.component};z(e);var f=a?F.addStack(e):F.getStackForRoot(e,h);z(f);var v=F.getContentItemInStack(f,h);if(s!=null){var p=b=>{an.debug("Component created, focusing element",s),f.off("componentCreated",p);var{element:g}=b.origin;requestAnimationFrame(()=>{F.focusElement(g[0],s)})};f.on("componentCreated",p)}if(r&&v){var m=f.contentItems.indexOf(v);f.addChild(d,m+1),f.removeChild(v),f.setActiveContentItem(f.contentItems[m])}else f.addChild(d);s==null&&l&&Vi(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},s=F.getContentItemInStack(e,a);if(r&&s&&e){var o=e==null?void 0:e.contentItems.indexOf(s);e.addChild(t,o+1),e.removeChild(s),e.setActiveContentItem(e.contentItems[o])}else e==null||e.addChild(t);i&&Vi(i)&&i.focus()}static closeComponent(e,t,r){var i=F.getStackForRoot(e,t,!1,!1,!1);if(!i){an.warn("Cannot find stack for component, ignoring close",t);return}var a=F.getContentItemInStack(i,t),s=document.activeElement;a&&(ut(a)?a.container.close(r):i.removeChild(a)),s&&document.contains(s)&&Vi(s)&&s.focus()}static renameComponent(e,t,r){var i=F.getStackForRoot(e,t,!1);if(!i){an.error("Could not find stack for config",t);return}var a=F.getContentItemInStack(i,t);a&&a.setTitle(r)}static cloneComponent(e,t){var r=F.getStackForRoot(e,t,!1);if(!r)return an.error("Could not find stack for config",t),null;var{props:i={}}=t,a=F.getPanelComponentState(t),s={type:"react-component",component:t.component,props:Bt(Bt({},i),{},{panelState:a}),title:"".concat(t.title," Copy"),id:ye.generate()};return F.openComponentInStack(r,s),s}static getPanelComponentState(e){if(Wv(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(rr(e)){var r;return(r=e.props)===null||r===void 0?void 0:r.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:du.tabHeight,borderWidth:du.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=F.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return F.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,r=F.getComponentConfigFromContainer(t);if(r&&rr(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]:F.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var r=e.querySelector(t);return r==null?null:(Vi(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)})}}Bv(F,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var Gv=X.forwardRef((n,e)=>{var t=F.getComponentNameFromPanel({props:n});return u.jsx("div",{ref:e,className:"panel-placeholder",children:u.jsxs("div",{children:['Component "',t,'" is not registered.']})})});Gv.displayName="PanelPlaceholder";const te=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 hi(n){return(n==null?void 0:n.WrappedComponent)!==void 0}function zv(n){return typeof n.id=="string"&&n.layout instanceof Vv&&n.panelManager instanceof Wa&&typeof n.registerComponent=="function"}function Hn(n){if(!zv(n))throw new Error("Expected dashboard plugin props, but instead received ".concat(n))}function cu(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 fu(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?cu(Object(t),!0).forEach(function(r){hn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):cu(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function hn(n,e,t){return e=o_(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function o_(n){var e=l_(n,"string");return typeof e=="symbol"?e:String(e)}function l_(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=W.module("PanelManager");class Wa{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(o,l)=>l,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(o,l)=>l,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:new Map,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:()=>{};hn(this,"layout",void 0),hn(this,"hydrateComponent",void 0),hn(this,"dehydrateComponent",void 0),hn(this,"onPanelsUpdated",void 0),hn(this,"closed",void 0),hn(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=s,this.openedMap=new Map(i),this.closed=[...a],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(te.FOCUS,this.handleFocus),e.on(te.MOUNT,this.handleMount),e.on(te.UNMOUNT,this.handleUnmount),e.on(te.REOPEN,this.handleReopen),e.on(te.DELETE,this.handleDeleted),e.on(te.CLOSED,this.handleClosed),e.on(te.CLOSE,this.handleControlClose)}stopListening(){var{eventHub:e}=this.layout;e.off(te.FOCUS,this.handleFocus),e.off(te.MOUNT,this.handleMount),e.off(te.UNMOUNT,this.handleUnmount),e.off(te.REOPEN,this.handleReopen),e.off(te.DELETE,this.handleDeleted),e.off(te.CLOSED,this.handleClosed),e.off(te.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 F.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&rr(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,r=F.getStackForConfig(this.layout.root,{id:e});return(t=r&&F.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=>hi(r)&&t instanceof r.WrappedComponent||!hi(r)&&t instanceof r))}updatePanel(e){var t=F.getIdFromPanel(e);if(t==null){bt.error("updatePanel Panel did not have an ID",e);return}bt.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=F.getIdFromPanel(e);if(t==null){bt.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){bt.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){bt.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}bt.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){bt.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){bt.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){bt.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}handleReopen(e,t){bt.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:r}=e,{props:i}=e;i=this.hydrateComponent(r,i);var a=fu(fu({},e),{},{props:i}),{root:s}=this.layout;F.openComponent({root:s,config:a,replaceConfig:t})}handleDeleted(e){bt.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){bt.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:r}=this.layout;F.closeComponent(r,t)}addClosedPanel(e){var t=F.getComponentConfigFromContainer(e);if(t&&rr(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)})}}hn(Wa,"MAX_CLOSED_PANEL_COUNT",100);var d_=W.module("PanelErrorBoundary");class Kv 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=F.getIdFromContainer(e);d_.debug("componentWillUnmount",r),t.emit(te.CLOSED,r,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?u.jsx("div",{className:"panel-error-boundary",children:u.jsx(Ne,{errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e}}function vu(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 pa(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vu(Object(t),!0).forEach(function(r){u_(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):vu(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function u_(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=c_(n,"string");return typeof e=="symbol"?e:String(e)}function c_(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 Ga(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),pa(pa({},n),{},{componentState:null,props:a,type:"react-component"})}function za(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return pa(pa({},n),{},{localDashboardId:e})}function yl(n){var e=hi(n)&&n.WrappedComponent.prototype!=null&&n.WrappedComponent.prototype.isReactComponent!=null||n.prototype!=null&&n.prototype.isReactComponent!=null,t=!hi(n)&&"$$typeof"in n&&n.$$typeof===ag.ForwardRef;return e||t}const qv={dehydrate:Ga,hydrate:za};var Ka=X.createContext(void 0),f_=_.shape({on:_.func,off:_.func,isHidden:_.bool,tab:_.shape({header:_.shape({tabs:_.arrayOf(_.shape({contentItem:_.shape({})}))})}),title:_.string,setTitle:_.func,close:_.func}),Yv=_.shape({on:_.func,off:_.func,emit:_.func}),v_=_.shape({registerComponent:_.func,root:_.shape({addChild:_.func}),on:_.func,off:_.func,eventHub:Yv}),qa=Object.freeze({Container:f_,EventHub:Yv,Layout:v_});function ce(n,e,t){c.useEffect(function(){return n.on(e,t),()=>{n.off(e,t)}},[n,e,t])}function In(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.");X.useEffect(()=>{var s=n(a,e,t,r);return()=>{s()}},[e,r,t,a,n])}function p_(n){var{dashboardProps:e,componentName:t,component:r,supportedTypes:i,hydrate:a,dehydrate:s}=n,{id:o,layout:l,registerComponent:d}=e,h=c.useCallback(f=>{var{dragEvent:v,panelId:p=ye.generate(),widget:m}=f,{name:b,type:g}=m,C=g!=null&&(Array.isArray(i)&&i.includes(g)||g===i);if(C){var S={localDashboardId:o,metadata:m};a!=null&&(S=a(S,o));var y={type:"react-component",component:t,props:S,title:b??void 0,id:p},{root:w}=l;F.openComponent({root:w,config:y,dragEvent:v})}},[t,a,o,l,i]);In(d,r,a,s),ce(l.eventHub,te.OPEN,h)}function m_(){var n=c.useContext(Ka);if(n==null)throw new Error("LayoutManager not available, did you add a LayoutManagerContext.Provider to the tree?");return n}function pu(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 g_(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?pu(Object(t),!0).forEach(function(r){b_(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):pu(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function b_(n,e,t){return e=C_(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function C_(n){var e=S_(n,"string");return typeof e=="symbol"?e:String(e)}function S_(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 y_=Object.freeze({}),E_=new Map,Xv=n=>n.api,w_=n=>n.user,Zv=n=>n.storage,Qv=n=>Zv(n).commandHistoryStorage,Jv=n=>Zv(n).fileStorage,P_=n=>n.defaultWorkspaceSettings,ep=n=>{var{workspace:e}=n;return e},Ti=n=>{for(var e=ep(n).data.settings,t=g_({},P_(n)),r=Object.keys(e),i=0;i<r.length;i+=1){var a=r[i];e[a]!==void 0&&(t[a]=e[a])}return t},El=n=>Ti(n).timeZone,__=n=>{var e;return(e=Ti(n).defaultNotebookSettings)!==null&&e!==void 0?e:y_},wl=n=>n.activeTool,T_=n=>{var e;return(e=n.plugins)!==null&&e!==void 0?e:E_},tp="SET_ACTIVE_TOOL",O_="SET_API",D_="SET_COMMAND_HISTORY_STORAGE",I_="SET_FILE_STORAGE",x_="SET_PLUGINS",N_="SET_USER",np="SET_WORKSPACE",M_="SET_DEFAULT_WORKSPACE_SETTINGS",L_="SET_WORKSPACE_STORAGE",A_="SET_SERVER_CONFIG_VALUES";function mu(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 _n(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?mu(Object(t),!0).forEach(function(r){F_(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):mu(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function F_(n,e,t){return e=j_(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function j_(n){var e=R_(n,"string");return typeof e=="symbol"?e:String(e)}function R_(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 k_=n=>({type:np,payload:n}),$_=n=>(e,t)=>{e(k_(n));var{storage:r}=t(),{workspaceStorage:i}=r;return i.save(n)},rp=n=>(e,t)=>{var{workspace:r}=t(),{data:i}=r,a=_n(_n({},r),{},{data:_n(_n(_n({},i),n),{},{settings:_n(_n({},i.settings),n.settings)})});return e($_(a))},U_=n=>e=>e(rp({settings:n})),ip=n=>({type:tp,payload:n});function gu(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 Ps(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?gu(Object(t),!0).forEach(function(r){H_(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):gu(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function H_(n,e,t){return e=V_(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function V_(n){var e=B_(n,"string");return typeof e=="symbol"?e:String(e)}function B_(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 ap(n,e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,r=arguments.length>1?arguments[1]:void 0;switch(r.type){case n:{var i=r.payload;return i==null?null:t!=null?Ps(Ps({},t),i):Ps({},i)}default:return t}}}function bu(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 Cu(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bu(Object(t),!0).forEach(function(r){W_(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):bu(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function W_(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=z_(n,"string");return typeof e=="symbol"?e:String(e)}function z_(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 K_(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:s}=i;return t&&mr({payload:s},{payload:r[a]})?r:Cu(Cu({},r),{},{[a]:s})}default:return r}}}function yn(n,e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,r=arguments.length>1?arguments[1]:void 0;switch(r.type){case n:return r.payload;default:return t}}}const q_=yn(O_,null),Y_=yn(tp,null),X_=yn(x_,null),Z_=yn(D_,null),Q_=yn(I_,null),J_=yn(L_,null),eT=_o({commandHistoryStorage:Z_,fileStorage:Q_,workspaceStorage:J_}),tT=ap(N_,null),nT=ap(np,null),rT=yn(M_,null),iT=yn(A_,null);var aT={activeTool:Y_,api:q_,plugins:X_,storage:eT,user:tT,workspace:nT,defaultWorkspaceSettings:rT,serverConfigValues:iT};const sT=aT;function Su(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 yu(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Su(Object(t),!0).forEach(function(r){uo(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Su(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function uo(n,e,t){return e=oT(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function oT(n){var e=lT(n,"string");return typeof e=="symbol"?e:String(e)}function lT(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 dT{constructor(){uo(this,"reducers",{}),uo(this,"listener",null)}register(e,t){var r;this.reducers=yu(yu({},this.reducers),{},{[e]:t}),(r=this.listener)===null||r===void 0||r.call(this,this.reducers)}setListener(e){this.listener=e}}var uT=new dT;const Ya=uT;var Eu=W.module("redux-logger"),hT=n=>e=>t=>{Eu.debug("dispatching",t);var r=e(t);return Eu.debug("next state",n.getState()),r};const cT=hT;var fT=W.module("redux-crashReporter"),vT=n=>e=>t=>{try{return e(t)}catch(r){throw fT.error("Error executing",t," with state ",n.getState(),":",r),r}};const pT=vT,mT=[cT,pT,sg];var _s;Object.entries(sT).map(n=>{var[e,t]=n;return Ya.register(e,t)});var gT=(_s=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__)!==null&&_s!==void 0?_s:dg,sp=og(_o(Ya.reducers),gT(lg(...mT)));Ya.setListener(n=>{sp.replaceReducer(_o(n))});const bT=sp;var Pl="SET_DASHBOARD_DATA";const CT=K_(Pl,{},!1),op={dashboardData:CT};var ST=new Map,lp=Object.freeze({}),yT=Object.freeze([]),dp=n=>n.dashboardData,Be=(n,e)=>{var t;return(t=dp(n)[e])!==null&&t!==void 0?t:lp},up=(n,e)=>{var t;return(t=Be(n,e).closed)!==null&&t!==void 0?t:yT},_l=(n,e)=>{var t;return(t=Be(n,e).openedMap)!==null&&t!==void 0?t:ST},Tl=(n,e)=>{var t;return(t=Be(n,e).pluginDataMap)!==null&&t!==void 0?t:lp},hp=(n,e,t)=>Tl(n,e)[t];function wu(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 ir(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wu(Object(t),!0).forEach(function(r){ET(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):wu(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ET(n,e,t){return e=wT(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wT(n){var e=PT(n,"string");return typeof e=="symbol"?e:String(e)}function PT(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 Ol=(n,e)=>({type:Pl,id:n,payload:e}),Mt=(n,e)=>(t,r)=>t(Ol(n,ir(ir({},Be(r(),n)),e))),cp=(n,e,t)=>(r,i)=>r(Ol(n,ir(ir({},Be(i(),n)),{},{pluginDataMap:ir(ir({},Tl(i(),n)),{},{[e]:t})})));function _T(n,e){var t=pi(),r=gc(a=>hp(a,n,e)),i=c.useCallback(a=>t(cp(n,e,a)),[n,e,t]);return[r,i]}Object.entries(op).map(n=>{var[e,t]=n;return Ya.register(e,t)});function TT(n){var{children:e}=n;return u.jsx(u.Fragment,{children:e})}function Pu(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 Hr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Pu(Object(t),!0).forEach(function(r){OT(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Pu(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function OT(n,e,t){return e=DT(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function DT(n){var e=IT(n,"string");return typeof e=="symbol"?e:String(e)}function IT(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 Bi=W.module("DashboardLayout"),xT=Object.freeze({}),NT=[],_u=()=>{},Tu=n=>n;function Dl(n){var e,t,{id:r,children:i,emptyDashboard:a=u.jsx("div",{children:"Dashboard is empty."}),layout:s,layoutConfig:o=NT,onLayoutChange:l=_u,onLayoutInitialized:d=_u,hydrate:h=za,dehydrate:f=Ga,panelWrapper:v=TT}=n,p=pi(),m=(e=gc(P=>Be(P,r)))!==null&&e!==void 0?e:xT,[b,g]=c.useState(!1),[C,S]=c.useState(!1),[y,w]=c.useState(),[E]=c.useState((t=m==null?void 0:m.closed)!==null&&t!==void 0?t:[]),[D,T]=c.useState(!1),[O,M]=c.useState(s.getReactChildren()),j=c.useMemo(()=>new Map,[]),H=c.useMemo(()=>new Map,[]),L=c.useCallback(function(P,R){var U,Q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:h,me=arguments.length>3&&arguments[3]!==void 0?arguments[3]:f;Bi.debug2("registerComponent",P,R,Q,me);function $(ie,fe){var Ee=R,jr=v,zn=yl(Ee),{glContainer:Rr,glEventHub:Pn}=ie;return u.jsx(Kv,{glContainer:Rr,glEventHub:Pn,children:u.jsx(jr,Hr(Hr({},ie),{},{children:zn?u.jsx(Ee,Hr(Hr({},ie),{},{ref:fe})):u.jsx(Ee,Hr({},ie))}))})}$.displayName="DashboardWrapper(".concat((U=R.displayName)!==null&&U!==void 0?U:P,")");var J=s.registerComponent(P,X.forwardRef($));return j.set(P,Q),H.set(P,me),J},[h,f,j,H,s,v]),I=c.useCallback((P,R)=>{var U;return((U=j.get(P))!==null&&U!==void 0?U:Tu)(R,r)},[j,r]),N=c.useCallback((P,R)=>{var U;return((U=H.get(P))!==null&&U!==void 0?U:Tu)(R,r)},[H,r]),A=c.useMemo(()=>new Wa(s,I,N,new Map,E,P=>{var{closed:R,openedMap:U}=P;p(Mt(r,{closed:R,openedMap:U}))}),[N,p,I,r,E,s]),k=c.useCallback(()=>{if(!C){D||(d(),T(!0));var P=s.toConfig(),R=P.content,U=F.dehydrateLayoutConfig(R,N),Q=y==null||!F.isEqual(y,U);Bi.debug("handleLayoutStateChanged",Q,R,U),Q&&(g(s.root.contentItems.length===0),w(U),l(U),M(s.getReactChildren()))}},[N,D,C,y,s,l,d]),V=c.useCallback(P=>{var R=F.getIdFromContainer(P);s.eventHub.emit(te.DRAGGING,R),S(!0)},[s.eventHub]),q=c.useCallback(P=>{var R=F.getIdFromContainer(P);s.eventHub.emit(te.DROPPED,R),S(!1)},[s.eventHub]),re=c.useCallback(P=>{if(Bi.debug2("handleComponentCreated",P),!(P==null||P.config==null||P.config.component==null||P.element==null)){var R=P.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),U="".concat(R,"-component");P.element.addClass(U)}},[]),B=c.useCallback(()=>{M(s.getReactChildren())},[s]);ce(s,"stateChanged",k),ce(s,"itemPickedUp",V),ce(s,"itemDropped",q),ce(s,"componentCreated",re),ce(s.eventHub,te.TITLE_CHANGED,k),ce(s,"reactChildrenChanged",B);var x=Wc(o);return c.useEffect(function(){if(x!==o&&o!==y){Bi.debug("Setting new layout content...");for(var R=F.hydrateLayoutConfig(o,I);s.root.contentItems.length>0;)s.root.contentItems[0].remove();for(var U=0;U<R.length;U+=1)s.root.addChild(R[U]);g(s.root.contentItems.length===0)}},[I,s,o,y,A,x]),u.jsxs(u.Fragment,{children:[b&&a,O,X.Children.map(i,P=>P!=null?X.cloneElement(P,{id:r,layout:s,panelManager:A,registerComponent:L}):null)]})}Dl.propTypes={id:_.string.isRequired,children:_.node,data:_.shape({}),emptyDashboard:_.node,layout:qa.Layout.isRequired,layoutConfig:_.arrayOf(_.shape({})),onLayoutChange:_.func,onLayoutInitialized:_.func};function Ou(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 MT(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ou(Object(t),!0).forEach(function(r){LT(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ou(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function LT(n,e,t){return e=AT(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function AT(n){var e=FT(n,"string");return typeof e=="symbol"?e:String(e)}function FT(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 jT=100,Ts=()=>{},RT=Object.freeze({});function ho(n){var{id:e="default",children:t,emptyDashboard:r,layoutConfig:i,layoutSettings:a=RT,onLayoutConfigChange:s=Ts,onGoldenLayoutChange:o=Ts,onLayoutInitialized:l=Ts,fallbackComponent:d=Gv,hydrate:h,dehydrate:f,panelWrapper:v}=n,p=c.useRef(null),[m,b]=c.useState(!1),[g,C]=c.useState();c.useEffect(function(){if(!p.current){C(void 0);return}var w=MT({},F.makeDefaultLayout());w.settings===void 0&&(w.settings={}),Object.assign(w.settings,a),w.content=[];var E=new Vv(w,p.current),D=()=>{E.off("initialised",D),b(!0)};return E.on("initialised",D),d!=null&&E.setFallbackComponent(d),E.init(),C(E),o(E),()=>{E.destroy()}},[a,d,o,b,C]);var S=c.useMemo(()=>mi(()=>{g!=null&&g.isInitialised&&(g==null||g.updateSize())},jT),[g]);return $o(p.current,S),u.jsxs("div",{className:"dashboard-container w-100 h-100",children:[u.jsx("div",{className:"w-100 h-100",ref:p}),m&&g&&u.jsx(Ka.Provider,{value:g,children:u.jsx(Dl,{emptyDashboard:r,id:e,layout:g,layoutConfig:i,onLayoutChange:s,onLayoutInitialized:l,hydrate:h,dehydrate:f,panelWrapper:v,children:t})})]})}var Il="default",Xa="CREATE_DASHBOARD";function fp(n,e){n.off(Xa,e)}function kT(n,e){return n.on(Xa,e),()=>fp(n,e)}function $T(n,e){n.emit(Xa,e)}var UT=["id","isActive","plugins"];function Du(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 Iu(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Du(Object(t),!0).forEach(function(r){HT(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Du(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function HT(n,e,t){return e=VT(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function VT(n){var e=BT(n,"string");return typeof e=="symbol"?e:String(e)}function BT(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 WT(n,e){if(n==null)return{};var t=GT(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 GT(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 zT(n){var{id:e,isActive:t,plugins:r}=n,i=WT(n,UT),[a,s]=c.useState(t),o=pi(),l=c.useCallback(d=>{o(e===Il?rp({layoutConfig:d}):Mt(e,{layoutConfig:d}))},[e,o]);return!a&&t&&s(!0),a?u.jsx(ho,Iu(Iu({id:e,onLayoutConfigChange:l},i),{},{children:r})):u.jsx(Ne,{})}const KT=Object.freeze(Object.defineProperty({__proto__:null,CREATE_DASHBOARD:Xa,DEFAULT_DASHBOARD_ID:Il,Dashboard:ho,DashboardLayout:Dl,DashboardUtils:qv,GLPropTypes:qa,LayoutManagerContext:Ka,LayoutUtils:F,LazyDashboard:zT,PanelErrorBoundary:Kv,PanelEvent:te,PanelManager:Wa,SET_DASHBOARD_DATA:Pl,assertIsDashboardPluginProps:Hn,canHaveRef:yl,default:ho,dehydrate:Ga,emitCreateDashboard:$T,getAllDashboardsData:dp,getClosedPanelsForDashboard:up,getDashboardData:Be,getOpenedPanelMapForDashboard:_l,getPluginDataForDashboard:hp,getPluginDataMapForDashboard:Tl,hydrate:za,isDashboardPluginProps:zv,isWrappedComponent:hi,listenForCreateDashboard:kT,reducers:op,setDashboardData:Ol,setDashboardPluginData:cp,stopListenForCreateDashboard:fp,updateDashboardData:Mt,useDashboardPanel:p_,useDashboardPluginData:_T,useLayoutManager:m_,useListener:ce,usePanelRegistration:In},Symbol.toStringTag,{value:"Module"}));function qT(n){var{type:e}=n,t=Ve();switch(e){case t.VariableType.TABLE:case t.VariableType.TABLEMAP:case t.VariableType.TREETABLE:case t.VariableType.HIERARCHICALTABLE:case t.VariableType.PARTITIONEDTABLE:return u.jsx(ne,{icon:Io});case t.VariableType.FIGURE:return u.jsx(ne,{icon:Do});case t.VariableType.PANDAS:return u.jsx(ne,{icon:Ec});default:return u.jsx(ne,{icon:yc})}}function xu(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function YT(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){xu(a,r,i,s,o,"next",l)}function o(l){xu(a,r,i,s,o,"throw",l)}s(void 0)})}}function vp(n){var{children:e,language:t}=n,[r,i]=c.useState(null),{activeThemes:a}=xr();return c.useEffect(()=>{var s=!1;function o(){return l.apply(this,arguments)}function l(){return l=YT(function*(){if(e!=null&&a!=null){var d=yield Ro.colorize(e.toString(),t,{});s||i(d)}}),l.apply(this,arguments)}return o(),()=>{s=!0}},[a,e,t]),u.jsx("div",{style:{pointerEvents:"none"},dangerouslySetInnerHTML:r!=null?{__html:r}:void 0})}class XT{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}const pp=XT;class ma{static hasComment(e){return e.comment!==void 0}static hasPattern(e){return e.pattern!==void 0}static hasOp(e){return e.op!==void 0}static parseArguments(e){return e==null||!(typeof e=="string"||e instanceof String)?[]:ug.parse(e).filter(t=>!this.hasComment(t)).map(t=>this.hasPattern(t)?t.pattern:this.hasOp(t)?t.op:"".concat(t))}static formatTimestamp(e){if(e==null||!(e instanceof Date))return null;var t="".concat(e.getHours()).padStart(2,"0"),r="".concat(e.getMinutes()).padStart(2,"0"),i="".concat(e.getSeconds()).padStart(2,"0"),a="".concat(e.getMilliseconds()).padStart(3,"0");return"".concat(t,":").concat(r,":").concat(i,".").concat(a)}static isTableType(e,t){return t===e.VariableType.TABLE||t===e.VariableType.TREETABLE||t===e.VariableType.HIERARCHICALTABLE||t===e.VariableType.PARTITIONEDTABLE}static isWidgetType(e,t){return t===e.VariableType.FIGURE||t===e.VariableType.OTHERWIDGET||t===e.VariableType.PANDAS}static isOpenableType(e,t){return ma.isTableType(e,t)||ma.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}const co=ma;function mp(n){var{children:e}=n;return u.jsxs("div",{className:"console-history-item-result",children:[u.jsx("div",{className:"console-history-gutter",children:"-"}),u.jsx("div",{className:"console-history-content",children:e})]})}mp.propTypes={children:_.node.isRequired};function fo(n,e,t){return e=ZT(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ZT(n){var e=QT(n,"string");return typeof e=="symbol"?e:String(e)}function QT(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 gp extends c.Component{constructor(e){super(e),fo(this,"timer",void 0),fo(this,"startTime",void 0),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer&&clearInterval(this.timer),this.timer=void 0}updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){var{disabled:e,onCancelClick:t}=this.props,{elapsed:r}=this.state;return u.jsx("div",{className:Y("console-history-result-in-progress",{disabled:e}),children:u.jsxs("span",{className:"badge",children:[u.jsx(Da,{className:"ml-2"}),"Running... ",sr.formatElapsedTime(r)," ",u.jsx(K,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:To,tooltip:"Cancel",onClick:t,disabled:e})]})})}}fo(gp,"defaultProps",{disabled:!1});const JT=gp;function ni(n,e,t){return e=eO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function eO(n){var e=tO(n,"string");return typeof e=="symbol"?e:String(e)}function tO(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 yr extends c.PureComponent{constructor(e){super(e),ni(this,"mouseX",void 0),ni(this,"mouseY",void 0),ni(this,"isClicking",void 0),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleToggleError=this.handleToggleError.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.mouseX=null,this.mouseY=null,this.isClicking=!1,this.state={isExpanded:!1,isTriggerHovered:!1}}handleKeyPress(e){switch(e.key){case"Enter":case" ":this.handleToggleError(),e.stopPropagation(),e.preventDefault();break}}handleMouseDown(e){this.mouseX=e.clientX,this.mouseY=e.clientY,this.isClicking=!0}handleMouseMove(e){this.mouseX!=null&&this.mouseY!=null?(Math.abs(e.clientX-this.mouseX)>=yr.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=yr.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(e){this.isClicking&&!e.shiftKey&&!e.metaKey&&!e.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(e=>({isExpanded:!e.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){var{isExpanded:e,isTriggerHovered:t}=this.state,{message:r}=this.props;z(r);var i=r.indexOf(`
|
|
4
|
+
`),a=i>-1,s=r;a&&(s=r.slice(0,i));var o=r.slice(i),l=t?"error-btn-link error-btn-link--active":"error-btn-link";return u.jsxs("div",{className:Y("error-message",{expanded:e}),children:[a&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"error-gutter",children:u.jsx("button",{type:"button",onClick:this.handleToggleError,className:l,tabIndex:-1,children:u.jsx(ne,{icon:e?er:Yg,transform:"left-3"})})}),u.jsxs("div",{className:"error-content",children:[u.jsx("div",{className:"console-error-text-trigger",role:"button",tabIndex:0,onKeyPress:this.handleKeyPress,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onMouseUp:this.handleMouseUp,children:s}),e?o:""]})]}),!a&&u.jsx("div",{className:"error-content",children:u.jsx("div",{className:"console-error-text",children:s})})]},"error")}}ni(yr,"defaultProps",{message:""});ni(yr,"mouseDragThreshold",5);const nO=yr;function rO(n,e,t){return e=iO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function iO(n){var e=aO(n,"string");return typeof e=="symbol"?e:String(e)}function aO(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 Nu=W.module("ConsoleHistoryItem");class bp extends c.PureComponent{constructor(e){super(e),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){Nu.debug("handleObjectClick",e);var{openObject:t}=this.props;t(e)}handleCancelClick(){var{item:e}=this.props;e!=null&&e.cancelResult&&(Nu.debug("Cancelling command: ".concat(e.command)),e.cancelResult())}render(){var{disabled:e,item:t,language:r,iconForType:i}=this.props,{disabledObjects:a,result:s}=t,o=t.command!=null&&t.command!=="",l=null;o&&(l=u.jsxs("div",{className:"console-history-item-command",children:[u.jsx("div",{className:"console-history-gutter",children:">"}),u.jsx("div",{className:"console-history-content",children:u.jsx(vp,{language:r,children:t.command})})]}));var d=[],h=!1;if(s){var{error:f,message:v,changes:p}=s;if(p){var{created:m,updated:b}=p;[...m,...b].forEach(D=>{h=!0;var{title:T}=D,O="".concat(T),M=e===void 0||e||(a??[]).indexOf(O)>=0,j=u.jsx(K,{kind:"primary",onClick:()=>this.handleObjectClick(D),className:"btn-console-object",disabled:M,icon:i(D.type),children:T},O);d.push(j)})}if(f!=null&&!o){var g,C="".concat((g=f.message)!==null&&g!==void 0?g:f);C||(C=f);var S=u.jsx(nO,{message:C},"result-error");d.push(S)}if(v!==void 0&&v!==""){var y=u.jsx("div",{className:"log-message",children:v},"log-message");d.push(y)}}else{h=!0;var w=u.jsx(JT,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");d.push(w)}var E=null;return d.length>0&&(E=u.jsx(mp,{children:d})),u.jsxs("div",{className:Y("console-command-result",{"console-result-buttons":h}),children:[l,E]})}}rO(bp,"defaultProps",{disabled:!1});const sO=bp;function oO(n,e){return"".concat(n,".").concat(e.command,".").concat(e.result&&e.result.message,".").concat(e.result&&e.result.error)}function lO(n){for(var{disabled:e=!1,items:t,language:r,openObject:i,supportsType:a,iconForType:s}=n,o=[],l=0;l<t.length;l+=1){var d=t[l],h=u.jsx(sO,{disabled:e,item:d,openObject:i,language:r,supportsType:a,iconForType:s},oO(l,d));o.push(h)}return u.jsx("div",{className:"container-fluid console-history",children:o})}var dO={name:"Console",CLEAR:Ke.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[pe.CTRL,ve.L],macShortcut:[pe.CTRL,ve.C]}),FOCUS_HISTORY:Ke.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[pe.CTRL,ve.H],macShortcut:[pe.CTRL,pe.OPTION,ve.H]})},uO={name:"Command History",FOCUS_HISTORY:Ke.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[pe.CTRL,ve.H],macShortcut:[pe.CTRL,pe.OPTION,ve.H]}),SEND_TO_CONSOLE:Ke.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[ve.ENTER],macShortcut:[ve.ENTER]}),SEND_TO_NOTEBOOK:Ke.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[pe.CTRL,ve.ENTER],macShortcut:[pe.CMD,ve.ENTER]}),RUN:Ke.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[pe.ALT,ve.R],macShortcut:[pe.OPTION,ve.R]})},hO={name:"Notebook",RUN:Ke.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[pe.ALT,ve.R],macShortcut:[pe.OPTION,ve.R]}),RUN_SELECTED:Ke.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[pe.ALT,pe.SHIFT,ve.R],macShortcut:[pe.OPTION,pe.SHIFT,ve.R]}),FIND:Ke.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[pe.CTRL,ve.F],macShortcut:[pe.CMD,ve.F],isEditable:!1}),MINIMAP:Ke.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[pe.ALT,ve.M],macShortcut:[pe.OPTION,ve.M]}),WORDWRAP:Ke.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[pe.ALT,ve.Z],macShortcut:[pe.OPTION,ve.Z]})},cO={CONSOLE:dO,COMMAND_HISTORY:uO,NOTEBOOK:hO};const Je=cO,$e=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"});function Os(n,e,t){return e=fO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fO(n){var e=vO(n,"string");return typeof e=="symbol"?e:String(e)}function vO(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 Wt=W.module("MonacoCompletionProvider");class xn extends c.PureComponent{static lspToMonacoKind(e){var t=Ai.CompletionItemKind;switch(e){case 1:return t.Text;case 2:return t.Method;case 3:return t.Function;case 4:return t.Constructor;case 5:return t.Field;case 6:return t.Variable;case 7:return t.Class;case 8:return t.Interface;case 9:return t.Module;case 10:return t.Property;case 11:return t.Unit;case 12:return t.Value;case 13:return t.Enum;case 14:return t.Keyword;case 15:return t.Snippet;case 16:return t.Color;case 17:return t.File;case 18:return t.Reference;case 19:return t.Folder;case 20:return t.EnumMember;case 21:return t.Constant;case 22:return t.Struct;case 23:return t.Event;case 24:return t.Operator;case 25:return t.TypeParameter;default:return t.Variable}}static lspToMonacoRange(e){var{start:t,end:r}=e;return{startLineNumber:t.line+1,startColumn:t.character+1,endLineNumber:r.line+1,endColumn:r.character+1}}static monacoToLspPosition(e){return{line:e.lineNumber-1,character:e.column-1}}constructor(e){super(e),Os(this,"registeredCompletionProvider",void 0),Os(this,"registeredSignatureProvider",void 0),Os(this,"registeredHoverProvider",void 0),this.handleCompletionRequest=this.handleCompletionRequest.bind(this),this.handleSignatureRequest=this.handleSignatureRequest.bind(this),this.handleHoverRequest=this.handleHoverRequest.bind(this)}componentDidMount(){var{language:e,session:t}=this.props;this.registeredCompletionProvider=Ai.registerCompletionItemProvider(e,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),t.getSignatureHelp!=null&&(this.registeredSignatureProvider=Ai.registerSignatureHelpProvider(e,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),t.getHover!=null&&(this.registeredHoverProvider=Ai.registerHoverProvider(e,{provideHover:this.handleHoverRequest}))}componentWillUnmount(){var e,t,r;(e=this.registeredCompletionProvider)===null||e===void 0||e.dispose(),(t=this.registeredSignatureProvider)===null||t===void 0||t.dispose(),(r=this.registeredHoverProvider)===null||r===void 0||r.dispose()}handleCompletionRequest(e,t,r){var{model:i,session:a}=this.props;if(e!==i)return null;var s={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:xn.monacoToLspPosition(t),context:r},o=a.getCompletionItems(s);Wt.debug("Requested completion items",s);var l=o.then(d=>{Wt.debug("Completion items received: ",s,d);var h=d.map(f=>{var{label:v,kind:p,detail:m,documentation:b,sortText:g,filterText:C,textEdit:S,insertTextFormat:y}=f;return{label:v,kind:xn.lspToMonacoKind(p),detail:m,documentation:(b==null?void 0:b.kind)==="markdown"?b:b==null?void 0:b.value,sortText:g,filterText:C,insertText:S.text,insertTextRules:y===2?4:y,range:xn.lspToMonacoRange(S.range)}});return{incomplete:!0,suggestions:h}}).catch(d=>(Wt.error("There was an error retrieving completion items",d),{suggestions:[]}));return l}handleSignatureRequest(e,t,r,i){var a={value:{signatures:[],activeSignature:0,activeParameter:0},dispose:()=>{}},{model:s,session:o}=this.props;if(e!==s||o.getSignatureHelp==null)return null;var l={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:xn.monacoToLspPosition(t),context:i},d=o.getSignatureHelp(l);Wt.debug("Requested signature help",l);var h=d.then(f=>{Wt.debug("Signatures received: ",l,d);var v=f.map(m=>{var{label:b,documentation:g,parameters:C}=m;return{documentation:(g==null?void 0:g.kind)==="markdown"?g:g==null?void 0:g.value,label:b,parameters:C??[]}});if(v.length===0)return a;var p=0;return{value:{signatures:v,activeSignature:p,activeParameter:f[p].activeParameter},dispose:()=>{}}}).catch(f=>(Wt.error("There was an error retrieving completion items",f),a));return h}handleHoverRequest(e,t){var{model:r,session:i}=this.props;if(e!==r||i.getHover==null)return null;var a={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:xn.monacoToLspPosition(t)},s=i.getHover(a);Wt.debug("Requested hover",a);var o=s.then(l=>{Wt.debug("Hover received: ",a,l);var{contents:d}=l;return{contents:d!=null?[d]:[]}}).catch(l=>(Wt.error("There was an error retrieving hover",l),{contents:[]}));return o}render(){return null}}const Cp=xn;function pO(n){var{children:e}=n,{activeThemes:t}=xr();return c.useEffect(function(){t!=null&&ct.initTheme()},[t]),u.jsx(u.Fragment,{children:e})}function Mu(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function mO(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){Mu(a,r,i,s,o,"next",l)}function o(l){Mu(a,r,i,s,o,"throw",l)}s(void 0)})}}function lt(n,e,t){return e=gO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function gO(n){var e=bO(n,"string");return typeof e=="symbol"?e:String(e)}function bO(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 Ds=W.module("ConsoleInput"),ga=parseInt(CC["line-height"],10),Sp=6,yp=6,CO=ga+Sp+yp,Is=100;class Oi extends c.PureComponent{constructor(e){super(e),lt(this,"cancelListener",void 0),lt(this,"resizeObserver",void 0),lt(this,"commandContainer",void 0),lt(this,"commandEditor",void 0),lt(this,"commandHistoryIndex",void 0),lt(this,"commandSuggestionContainer",void 0),lt(this,"loadingPromise",void 0),lt(this,"timestamp",void 0),lt(this,"bufferIndex",void 0),lt(this,"history",void 0),lt(this,"modifiedCommands",void 0),this.handleResize=this.handleResize.bind(this),this.commandContainer=X.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.resizeObserver=new window.ResizeObserver(this.handleResize),this.state={commandEditorHeight:ga,isFocused:!1,model:null}}componentDidMount(){this.initCommandEditor(),this.loadMoreHistory()}componentDidUpdate(){this.layoutEditor()}componentWillUnmount(){this.resizeObserver.disconnect(),this.loadingPromise!=null&&this.loadingPromise.cancel(),this.destroyCommandEditor()}setConsoleText(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(e){if(Ds.debug("Command received: ",e),!r){var i;this.commandHistoryIndex=null,(i=this.commandEditor)===null||i===void 0||i.setValue(e)}t&&this.focusEnd(),this.updateDimensions(),r&&this.processCommand(e)}}initCommandEditor(){var{language:e,session:t}=this.props,r={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:ga,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:Sp,bottom:yp},value:"",wordWrap:"on"},i=this.commandContainer.current;z(i),this.commandEditor=Ro.create(i,r),ct.setEOL(this.commandEditor),ct.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{var a,s=(a=this.commandEditor)===null||a===void 0?void 0:a.getValue();this.modifiedCommands.set(this.commandHistoryIndex,s??null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(a=>{var{commandEditor:s,commandHistoryIndex:o}=this,l=s==null?void 0:s.getPosition();z(l);var{lineNumber:d}=l,h=s==null?void 0:s.getModel();if(a.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&d===1){o!=null?this.loadCommand(o+1):this.loadCommand(0),this.focusStart(),a.stopPropagation(),a.preventDefault();return}if(a.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&d===(h==null?void 0:h.getLineCount())){o!=null&&o>0?this.loadCommand(o-1):this.loadCommand(null),this.focusEnd(),a.stopPropagation(),a.preventDefault();return}if(!a.altKey&&!a.shiftKey&&!a.metaKey&&a.keyCode===ti.Enter&&!this.isSuggestionMenuPopulated()){var f;a.stopPropagation(),a.preventDefault();var v=(f=this.commandEditor)===null||f===void 0?void 0:f.getValue().trim();if(v!==void 0){var p;this.processCommand(v),(p=this.commandEditor)===null||p===void 0||p.setValue("")}}}),ct.disableKeyBindings(this.commandEditor,[ef.CtrlCmd|ti.KeyF]),ct.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.resizeObserver.observe(i),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){var{session:e}=this.props;this.commandEditor&&(ct.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleResize(){this.updateDimensions()}isSuggestionMenuActive(){var e;if(!this.commandSuggestionContainer){var t,r;this.commandSuggestionContainer=(t=this.commandEditor)===null||t===void 0||(r=t.getDomNode())===null||r===void 0?void 0:r.querySelector(".suggest-widget")}return(e=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!==null&&e!==void 0?e:!1}isSuggestionMenuPopulated(){var e,t,r;return this.isSuggestionMenuActive()&&((e=(t=this.commandSuggestionContainer)===null||t===void 0||(r=t.querySelector(".monaco-list-rows"))===null||r===void 0?void 0:r.childElementCount)!==null&&e!==void 0?e:0)>0}focus(){var e;(e=this.commandEditor)===null||e===void 0||e.focus()}focusStart(){var e,t,r,i,a,s=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();z(s);var o=s.getLineLength(1)+1,l=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(1,o);z(l),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:1,column:o}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(l),(a=this.commandEditor)===null||a===void 0||a.focus()}focusEnd(){var e,t,r,i,a,s=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();z(s);var o=s.getLineCount(),l=s.getLineLength(o)+1,d=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(o,l);z(d),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:o,column:l}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(d),(a=this.commandEditor)===null||a===void 0||a.focus()}clear(){var e,t,r;(e=this.commandEditor)===null||e===void 0||e.focus(),(t=this.commandEditor)===null||t===void 0||(r=t.getModel())===null||r===void 0||r.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var t,r;if(!(e!==null&&e>=this.history.length)){var i=this.modifiedCommands.get(e),a=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,(t=this.commandEditor)===null||t===void 0||(r=t.getModel())===null||r===void 0||r.setValue(i??a),e!==null&&e>this.history.length-Is&&this.loadMoreHistory()}}loadMoreHistory(){var e=this;return mO(function*(){try{if(e.loadingPromise!=null||e.bufferIndex==null)return;var{commandHistoryStorage:t,language:r,scope:i}=e.props;e.loadingPromise=Se.makeCancelable(t.getTable(r,i??"",e.timestamp),o=>o.close());var a=yield e.loadingPromise;a.setReversed(!0),a.setViewport({top:e.bufferIndex,bottom:e.bufferIndex+Is-1}),e.loadingPromise=Se.makeCancelable(a.getViewportData(),()=>a.close());var s=yield e.loadingPromise;e.bufferIndex+=Is,e.bufferIndex>=a.size&&(e.bufferIndex=null),e.history=[...s.items.filter((o,l,d)=>{var{name:h}=o;return l===0||h!==d[l-1].name}).map(o=>{var{name:l}=o;return l}).reverse(),...e.history],e.loadingPromise=void 0,a.close()}catch(o){if(e.loadingPromise=void 0,Se.isCanceled(o)){Ds.debug2("Promise canceled, not loading history");return}Ds.error("Error fetching history",o)}})()}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),z(e),e!==""&&(this.history.length===0||e!==this.history[this.history.length-1])&&this.history.push(e),this.updateDimensions();var{onSubmit:t}=this.props;t(e)}updateDimensions(){if(this.commandEditor){var{maxHeight:e}=this.props;z(e);var t=this.commandEditor.getContentHeight(),r=Math.max(Math.min(t,e),CO),i=t>r,a={overviewRulerLanes:i?void 0:0};this.setState({commandEditorHeight:r},()=>{var s,o;(s=this.commandEditor)===null||s===void 0||s.updateOptions(a),(o=this.commandEditor)===null||o===void 0||o.layout()})}}render(){var{disabled:e,language:t,session:r}=this.props,{commandEditorHeight:i,isFocused:a,model:s}=this.state;return u.jsx("div",{className:Y("console-input-wrapper",{disabled:e}),children:u.jsxs("div",{className:Y("console-input-inner-wrapper",{focus:a}),children:[u.jsx("div",{className:Oi.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:i}}),s&&u.jsx(Cp,{model:s,language:t,session:r})]})})}}lt(Oi,"defaultProps",{maxHeight:ga*10,scope:null,disabled:!1});lt(Oi,"INPUT_CLASS_NAME","console-input");const Lu=Oi;function vn(n,e,t){return e=SO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function SO(n){var e=yO(n,"string");return typeof e=="symbol"?e:String(e)}function yO(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 Au="pasted values",EO=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],xs=[".csv",".tsv",".tab",".psv",".dsv",".txt"],Fu=[".zip"];class $t extends c.Component{static isValidDropItem(e){return e!=null&&e.kind==="file"&&!EO.find(t=>t.test(e.type))}static isValidExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return xs.some(r=>e.endsWith(r))||t&&Fu.some(r=>e.endsWith(r))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===Au?Zl:e.endsWith(".csv")?Xg:e.endsWith(".zip")?Zg:Qg}constructor(e){super(e),vn(this,"fileElem",void 0),vn(this,"divElem",void 0),vn(this,"getValidExtensions",se(t=>t?[...xs,...Fu]:[...xs])),vn(this,"getAcceptString",se(t=>this.getValidExtensions(t).join(", "))),vn(this,"getFileTypeErrorString",se(t=>_t.join(this.getValidExtensions(t),"or"))),this.handleSelectFile=this.handleSelectFile.bind(this),this.handleFiles=this.handleFiles.bind(this),this.handleDrop=this.handleDrop.bind(this),this.unstageFile=this.unstageFile.bind(this),this.handleMenuPaste=this.handleMenuPaste.bind(this),this.handlePasteEvent=this.handlePasteEvent.bind(this),this.fileElem=X.createRef(),this.divElem=X.createRef(),this.state={selectedFileName:""}}componentDidMount(){var e,t;(e=this.divElem.current)===null||e===void 0||e.addEventListener("paste",this.handlePasteEvent),(t=this.divElem.current)===null||t===void 0||t.focus()}componentWillUnmount(){var e;(e=this.divElem.current)===null||e===void 0||e.removeEventListener("paste",this.handlePasteEvent)}handleSelectFile(){if(this.fileElem.current){var e;this.fileElem.current.value="",(e=this.fileElem.current)===null||e===void 0||e.click()}}handleFiles(e){e.stopPropagation(),e.preventDefault();var{files:t}=e.target;t!=null&&this.handleFile(t[0])}handleDrop(e){var{allowZip:t,clearDragError:r,dragError:i}=this.props;if(e.preventDefault(),e.stopPropagation(),i!=null){r();return}if(!(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)){var a=e.dataTransfer.items[0].getAsFile();z(a),$t.isValidExtension(a.name,t)?this.handleFile(a):this.setState({dropError:$t.FILE_TYPE_ERROR})}}unstageFile(e){var{onCancel:t}=this.props;e.stopPropagation(),e.preventDefault(),t(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(e){var{onFileOpened:t}=this.props;t(e),this.setState({selectedFileName:e.name,dropError:void 0})}handleMenuPaste(){var{onPaste:e,onError:t,uploadInProgress:r}=this.props;r||navigator.clipboard.readText().then(i=>{e(i),this.setState({selectedFileName:Au,dropError:void 0})}).catch(i=>t(i))}handlePasteEvent(e){e.stopPropagation(),e.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){var{uploadInProgress:e}=this.props;return[{title:"Paste",icon:Zl,action:this.handleMenuPaste,shortcut:Cr.PASTE,disabled:e}]}render(){var{allowZip:e,dragError:t,uploadInProgress:r}=this.props,{selectedFileName:i,dropError:a}=this.state,s=t??a,o=this.makeContextMenuItems();return u.jsxs("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:$t.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[u.jsx(ae,{actions:o}),u.jsx("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!i&&(s===void 0||s==="")&&u.jsxs("div",{className:"message-content",children:[u.jsx("div",{className:"message-icon",children:u.jsx(ne,{icon:Jg})}),u.jsx("label",{children:"Drop file (or paste values) here to import"}),u.jsx("div",{className:"message-small",children:u.jsx("label",{children:"or"})}),u.jsx(K,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),i&&(s===void 0||s==="")&&u.jsxs("div",{className:"selected-content",children:[u.jsx("div",{className:"selected-icon",children:u.jsx(ne,{icon:$t.getIcon(i)})}),u.jsxs("div",{className:"selected-text",children:[u.jsx("label",{children:"Selected File"}),u.jsxs("label",{className:"selected-name",children:[i,!r&&u.jsx(K,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:kn,tooltip:"Remove"})]})]})]}),!!s&&u.jsxs("div",{className:"message-content",children:[u.jsx("div",{className:"message-icon",children:u.jsx(ne,{icon:xo})}),u.jsx("label",{children:s}),s===$t.FILE_TYPE_ERROR&&u.jsx("div",{className:"message-small",children:u.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}vn($t,"defaultProps",{allowZip:!1,dragError:null});vn($t,"MULTIPLE_FILE_ERROR","Please select only one file");vn($t,"FILE_TYPE_ERROR","Filetype not supported.");const Zn=$t;function Vn(n,e,t){return e=wO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wO(n){var e=PO(n,"string");return typeof e=="symbol"?e:String(e)}function PO(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 En{}Vn(En,"INTEGER","int");Vn(En,"LONG","long");Vn(En,"DOUBLE","double");Vn(En,"BOOLEAN","bool");Vn(En,"STRING","string");Vn(En,"DATE_TIME","datetime");Vn(En,"LOCAL_TIME","localtime");const de=En;function Ep(n,e){var t=n.internalStream("string");return t.readable=!0,t.read=()=>!1,t.removeListener=()=>!1,t.on("data",(r,i)=>e(i)),t}function ju(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 Ru(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ju(Object(t),!0).forEach(function(r){Ye(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ju(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ye(n,e,t){return e=_O(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _O(n){var e=TO(n,"string");return typeof e=="symbol"?e:String(e)}function TO(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 ku="unknown",OO=2147483647,DO=-2147483648,$u=/^[0-9]{4}-[0-1][0-9]-[0-3][0-9][ T][0-2][0-9]:[0-5][0-9]:[0-6][0-9](?:\.[0-9]{1,9})?(?: [a-zA-Z]+)?$/,Uu=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class Ge{static determineType(e,t,r){if(!e||e===r)return t;switch(t){case de.STRING:return de.STRING;case de.INTEGER:return Ge.checkInteger(e);case de.LONG:return Ge.checkLong(e);case de.DOUBLE:return Ge.checkDouble(e);case de.BOOLEAN:return Ge.checkBoolean(e);case de.DATE_TIME:return Ge.checkDateTime(e);case de.LOCAL_TIME:return Ge.checkLocalTime(e);default:return Ge.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){var t=e.replace(/,/g,"");return Ge.isNotParsableNumber(t)?de.STRING:Ge.getNumberType(t)}static checkLong(e){var t=e.replace(/,/g,"");return Ge.isNotParsableNumber(t)?de.STRING:t.includes(".")?de.DOUBLE:de.LONG}static checkDouble(e){var t=e.replace(/,/g,"");return Ge.isNotParsableNumber(t)?de.STRING:de.DOUBLE}static checkBoolean(e){var t=e.toLowerCase();return t==="true"||t==="false"?de.BOOLEAN:de.STRING}static checkDateTime(e){return $u.test(e)?de.DATE_TIME:de.STRING}static checkLocalTime(e){return Uu.test(e)?de.LOCAL_TIME:de.STRING}static getTypeFromUnknown(e){var t=e.replace(/,/g,"");if(Ge.isNotParsableNumber(t)){var r=e.toLowerCase();return r==="true"||r==="false"?de.BOOLEAN:$u.test(e)&&e.includes(":")?de.DATE_TIME:Uu.test(e)?de.LOCAL_TIME:de.STRING}return Ge.getNumberType(t)}static getNumberType(e){if(e.includes("."))return de.DOUBLE;var t=e.startsWith("-")?11:10;if(e.length>t)return de.LONG;var r=parseInt(e,10);return r>OO||r<DO?de.LONG:de.INTEGER}constructor(e,t,r,i,a,s,o,l,d,h){Ye(this,"onFileCompleted",void 0),Ye(this,"file",void 0),Ye(this,"readHeaders",void 0),Ye(this,"nullString",void 0),Ye(this,"onProgress",void 0),Ye(this,"onError",void 0),Ye(this,"types",void 0),Ye(this,"chunks",void 0),Ye(this,"totalChunks",void 0),Ye(this,"rowCount",void 0),Ye(this,"isZip",void 0),Ye(this,"shouldTrim",void 0),Ye(this,"zipProgress",void 0),Ye(this,"config",void 0),this.onFileCompleted=e,this.file=t,this.readHeaders=r,this.nullString=a,this.onProgress=s,this.onError=o,this.chunks=0,this.totalChunks=l,this.rowCount=0,this.isZip=d,this.shouldTrim=h,this.zipProgress=0,this.handleChunk=this.handleChunk.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.config=Ru(Ru({},i),{},{error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete})}parse(){if(this.file instanceof File||this.file instanceof Blob)Jr.parse(this.file,this.config);else{var e=Ep(this.file,this.handleNodeUpdate);Jr.parse(e,this.config),e.resume()}}handleChunk(e,t){var{data:r}=e;if(!this.types){if(r==null||r.length===0){t.abort(),this.onError("Error parsing CSV: no data in file.");return}this.types=new Array(r[0].length).fill(ku),this.readHeaders&&(r=r.slice(1))}this.rowCount+=r.length,z(this.types);var i=[...this.types];r.forEach(o=>{if(o.length>=i.length){for(var l=0;l<i.length;l+=1)i[l]=Ge.determineType(this.shouldTrim?o[l].trim():o[l],i[l],this.nullString);this.types=i}else t.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
|
|
5
|
+
Expected length `.concat(i.length," but found ").concat(o.length,`.
|
|
6
|
+
Row = `).concat(o))}),this.chunks+=1;var a=0;this.totalChunks>0?a=Math.round(this.chunks/this.totalChunks*50):a=Math.round(this.zipProgress/2);var s=this.onProgress(a);s&&t.abort()}handleComplete(e){var{types:t,onFileCompleted:r}=this;z(t),(e==null||!e.meta.aborted)&&r(t.map(i=>i===ku||i===de.LOCAL_TIME?de.STRING:i),this.rowCount)}handleError(e){var{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}const IO=Ge;function ge(n,e,t){return e=xO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xO(n){var e=NO(n,"string");return typeof e=="symbol"?e:String(e)}function NO(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 Wi=W.module("CsvParser"),MO=650;class Er{static generateHeaderRecursive(e){var t="",r=e;return e>=26&&(t=t.concat(Er.generateHeaderRecursive(Math.floor(e/26)-1)),r=e%26),t.concat(String.fromCharCode(65+r))}constructor(e){var{onFileCompleted:t,session:r,file:i,type:a,readHeaders:s=!0,onProgress:o,onError:l,timeZone:d,isZip:h}=e;ge(this,"onFileCompleted",void 0),ge(this,"session",void 0),ge(this,"file",void 0),ge(this,"isZip",void 0),ge(this,"type",void 0),ge(this,"readHeaders",void 0),ge(this,"timeZone",void 0),ge(this,"onProgress",void 0),ge(this,"onError",void 0),ge(this,"tables",void 0),ge(this,"headers",void 0),ge(this,"types",void 0),ge(this,"rowCount",void 0),ge(this,"rowsProcessed",void 0),ge(this,"chunks",void 0),ge(this,"totalChunks",void 0),ge(this,"isComplete",void 0),ge(this,"zipProgress",void 0),ge(this,"consolidatedChunks",void 0),ge(this,"numConsolidated",void 0),ge(this,"isCancelled",void 0),ge(this,"config",void 0),this.onFileCompleted=t,this.session=r,this.file=i,this.isZip=h,this.type=a,this.readHeaders=s,this.timeZone=d,this.onProgress=o,this.onError=l,this.tables=[],this.rowCount=0,this.rowsProcessed=0,this.chunks=0,this.totalChunks=h?0:Math.ceil(i.size/Jr.LocalChunkSize),this.isComplete=!1,this.zipProgress=0,this.numConsolidated=0,this.isCancelled=!1,this.handleChunk=this.handleChunk.bind(this),this.handleError=this.handleError.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.handleCreateTable=this.handleCreateTable.bind(this),this.config={delimiter:a.delimiter,newline:a.newline,escapeChar:a.escapeChar,dynamicTyping:!1,error:this.handleError,skipEmptyLines:a.skipEmptyLines,chunk:this.handleChunk,complete:this.handleComplete,fastMode:!1}}cancel(){this.isCancelled=!0}transpose(e,t){for(var r=t.length,i=new Array(e).fill(null).map(()=>new Array(r)),a=0;a<r;a+=1){var s=t[a];if(s.length<e)throw new Error("Insufficient columns. Expected ".concat(e," but found ").concat(s.length,`
|
|
7
|
+
`).concat(s));for(var o=0;o<e;o+=1){var l=this.type.shouldTrim?t[a][o].trim():t[a][o];i[o][a]=this.nullCheck(l)}}return i}nullCheck(e){return e===this.type.nullString?"":e}parse(){var e=(r,i)=>{if(this.types=r,this.rowCount=i,this.file instanceof File||this.file instanceof Blob)Jr.parse(this.file,this.config);else{var a=Ep(this.file,this.handleNodeUpdate);Jr.parse(a,this.config),a.resume()}},t=new IO(e,this.file,this.readHeaders,this.config,this.type.nullString,this.onProgress,this.onError,this.totalChunks,this.isZip,this.type.shouldTrim);t.parse()}handleChunk(e,t){var{readHeaders:r,onError:i,handleCreateTable:a,isZip:s,tables:o}=this;if(this.isCancelled){Wi.debug2("CSV parser cancelled."),t.abort(),o.forEach(f=>f.close());return}var{data:l}=e;this.headers||(r?(this.headers=Zc.legalizeColumnNames(l[0]),l=l.slice(1)):this.headers=Er.generateHeaders(l[0].length));var d=[];try{if(d=this.transpose(this.headers.length,l),s)this.consolidateChunks(d,t);else{var h=this.chunks;this.chunks+=1,a(h,d,t)}}catch(f){i(f)}}consolidateChunks(e,t){if(!this.consolidatedChunks)this.consolidatedChunks=e.slice();else for(var r=0;r<e.length;r+=1)this.consolidatedChunks[r]=this.consolidatedChunks[r].concat(e[r]);this.numConsolidated+=1,(this.numConsolidated>=MO||this.isComplete)&&this.uploadConsolidatedChunks(t)}uploadConsolidatedChunks(e){var t,{handleCreateTable:r}=this,i=this.chunks;this.chunks+=1;var a=(t=this.consolidatedChunks)===null||t===void 0?void 0:t.slice();this.consolidatedChunks=void 0,this.numConsolidated=0,z(a),r(i,a,e)}handleCreateTable(e,t,r){var{session:i,tables:a,onFileCompleted:s,totalChunks:o,types:l,onProgress:d,onError:h}=this;r&&r.pause(),z(this.headers),z(l),this.rowsProcessed+=t[0].length,i.newTable(this.headers,l,t,this.timeZone).then(f=>{if(this.isCancelled){Wi.debug2("CSV parser cancelled."),r&&r.abort(),a.forEach(p=>p.close());return}r&&r.resume(),a[e]=f;var v=0;o>0?v=Math.round(a.length/o*50)+50:v=Math.round(this.rowsProcessed/this.rowCount*50)+50,Wi.debug2("CSV parser progress ".concat(v)),d(v),this.isComplete&&a.length===this.chunks&&(Wi.debug2("CSV parser complete."),s(a))}).catch(f=>{!this.isComplete&&r&&r.abort(),h(f)})}handleComplete(e){(e==null||e.meta.aborted==null)&&(this.isComplete=!0,this.consolidatedChunks&&this.uploadConsolidatedChunks(null))}handleError(e){var{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}ge(Er,"generateHeaders",n=>{for(var e=[],t=0;t<n;t+=1)e.push(Er.generateHeaderRecursive(t));return e});const LO=Er;function xl(n,e,t){return e=AO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function AO(n){var e=FO(n,"string");return typeof e=="symbol"?e:String(e)}function FO(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 Za{static fromExtension(e){return e.endsWith(".csv")?"DEFAULT_CSV":e.endsWith(".tsv")||e.endsWith(".tab")?"TSV":e.endsWith(".psv")?"PIPE_SV":"AUTODETECT"}}xl(Za,"DEFAULT_TYPE","DEFAULT_CSV");xl(Za,"AUTO","AUTODETECT");xl(Za,"TYPES",Object.freeze({DEFAULT_CSV:{name:"Default csv (trimmed)",delimiter:",",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},TSV:{name:"Tab seperated (tsv)",delimiter:" ",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},APACHE_COMMON_CSV:{name:"Apache Common csv",delimiter:",",newline:`\r
|
|
8
|
+
`,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:null},EXCEL_CSV:{name:"Excel csv (strict)",delimiter:",",newline:`\r
|
|
9
|
+
`,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},MY_SQL_CSV:{name:"MySQL csv",delimiter:" ",newline:`
|
|
10
|
+
`,escapeChar:"\\",shouldTrim:!0,skipEmptyLines:!1,nullString:"\\N"},RFC4180_CSV:{name:"RFC4180 csv",delimiter:",",newline:`\r
|
|
11
|
+
`,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},COLON_SV:{name:": colon sv",delimiter:":",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},SEMI_COLON_SV:{name:"; semi-colon sv",delimiter:";",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},PIPE_SV:{name:"| pipe separated (psv)",delimiter:"|",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},SPACE_SV:{name:'" " space sv',delimiter:" ",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},AUTODETECT:{name:"autodetect",delimiter:void 0,newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"}}));const qr=Za;function wp(n,e,t){return e=jO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jO(n){var e=RO(n,"string");return typeof e=="symbol"?e:String(e)}function RO(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 Hu=W.module("CsvInputBar"),kO=Object.entries(qr.TYPES).map(n=>{var[e,t]=n;return u.jsx("option",{value:e,children:t.name},e)});class Pp extends c.Component{constructor(e){super(e),wp(this,"inputRef",void 0),this.handleUpload=this.handleUpload.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleError=this.handleError.bind(this),this.handleTableName=this.handleTableName.bind(this),this.toggleFirstRowHeaders=this.toggleFirstRowHeaders.bind(this),this.handleProgress=this.handleProgress.bind(this),this.handleCancelInProgress=this.handleCancelInProgress.bind(this),this.handleQueryTypeChange=this.handleQueryTypeChange.bind(this),this.inputRef=X.createRef(),this.state={tableName:"",tableNameSet:!1,isFirstRowHeaders:!0,showProgress:!1,progressValue:0,type:qr.DEFAULT_TYPE,parser:null}}componentDidUpdate(e){var{file:t,paste:r}=this.props,{tableName:i,tableNameSet:a}=this.state;if(!a&&t!=null&&!i){var s,o=t.name.lastIndexOf("."),l=Zc.legalizeTableName(t.name.substring(0,o));this.setState({tableName:l,tableNameSet:!0}),(s=this.inputRef.current)===null||s===void 0||s.focus()}else(t==null&&e.file!=null||r==null&&e.paste!=null)&&this.setState({tableName:"",tableNameSet:!1});r!=null&&r!==""&&!i&&this.inputRef.current&&this.inputRef.current.focus(),t!=null&&t!==e.file?this.setState({type:qr.fromExtension(t.name)}):r!=null&&r!==""&&(e.paste===void 0||e.paste==="")&&this.setState({type:qr.AUTO})}componentWillUnmount(){var{parser:e}=this.state;e&&e.cancel()}handleCancel(){var{onClose:e}=this.props;e()}handleError(e){var{onClose:t,onError:r}=this.props;Hu.error(e),r(e),t()}handleTableName(e){this.setState({tableName:e.target.value,tableNameSet:!0})}toggleFirstRowHeaders(){var{isFirstRowHeaders:e}=this.state;this.setState({isFirstRowHeaders:!e})}handleUpload(e){e.stopPropagation(),e.preventDefault();var{file:t,paste:r}=this.props;t!=null?t.name.endsWith(".zip")?this.handleZipFile(t):this.handleFile(t):r!==void 0&&r!==""&&this.handleFile(new Blob([r],{type:"text/plain"}))}handleFile(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;Hu.info("Starting CSV parser for ".concat(e instanceof File?e.name:"pasted values"," ").concat(t?"":e.size," bytes"));var{session:r,timeZone:i,onInProgress:a}=this.props,{tableName:s,isFirstRowHeaders:o,type:l}=this.state,d=f=>{f.length===1?r.bindTableToVariable(f[0],s).then(()=>this.openTable()).catch(v=>this.handleError(v)):r.mergeTables(f).then(v=>{r.bindTableToVariable(v,s).then(()=>this.openTable()).catch(p=>this.handleError(p)),f.forEach(p=>p.close())}).catch(v=>this.handleError(v))},h=new LO({onFileCompleted:d,session:r,file:e,type:qr.TYPES[l],readHeaders:o,onProgress:this.handleProgress,onError:this.handleError,timeZone:i,isZip:t});h.parse(),this.setState({showProgress:!0,parser:h}),a(!0)}handleZipFile(e){var{onUpdate:t,unzip:r}=this.props;if(r==null){this.handleError(new Error("No support for zip files available."));return}r(e).then(i=>{for(var a=!1,s=0;s<i.length;s+=1){var o=i[s];if(Zn.isValidExtension(o.name)){t("Loading ".concat(o.name," as csv from ").concat(e.name)),a=!0,this.handleFile(o,!0);break}}if(!a)throw new Error("No csv file found in ".concat(e.name))}).catch(i=>this.handleError(i))}handleProgress(e){var{showProgress:t}=this.state;return t&&this.setState({progressValue:e}),!t}handleCancelInProgress(){var{onInProgress:e}=this.props,{parser:t}=this.state;t&&t.cancel(),this.setState({showProgress:!1,progressValue:0}),e(!1)}openTable(){var{onOpenTable:e,onClose:t}=this.props,{tableName:r}=this.state;e(r),t()}handleQueryTypeChange(e){this.setState({type:e})}render(){var{file:e,paste:t}=this.props,{tableName:r,isFirstRowHeaders:i,showProgress:a,progressValue:s,type:o}=this.state,l=!!t&&!r;return u.jsxs("div",{className:"csv-input-bar",children:[!a&&u.jsxs("form",{onSubmit:this.handleUpload,className:"csv-input-bar-container form-inline",children:[u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"tableNameInput",children:"Table name"}),u.jsx("input",{ref:this.inputRef,id:"tableNameInput",type:"text",className:Y("form-control",{"is-invalid":l}),value:r,onChange:this.handleTableName})]}),u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"formatSelect",children:"File format"}),u.jsx(Rn,{id:"formatSelect",className:"custom-select",value:o,onChange:this.handleQueryTypeChange,children:kO})]}),u.jsx(la,{className:"firstRowHeaders",checked:i,onChange:this.toggleFirstRowHeaders,children:"First row is column headers"}),u.jsxs("div",{className:"csv-input-buttons form-group",children:[u.jsx(K,{kind:"secondary",onClick:this.handleCancel,children:"Cancel"}),u.jsx(K,{kind:"primary",type:"submit",disabled:!(e!==null||t!==void 0&&t!=="")||!r,children:"Upload"})]})]}),a&&u.jsxs("div",{className:"csv-progress-container",children:[u.jsx("label",{children:"Uploading Table"}),u.jsx("div",{className:"progress",children:u.jsx("div",{className:"progress-bar bg-primary",style:{width:"".concat(s,"%")},"aria-valuenow":s,"aria-valuemin":0,"aria-valuemax":100})}),u.jsxs("label",{children:[s,"%"]}),u.jsx(K,{kind:"primary",onClick:this.handleCancelInProgress,children:"Cancel"})]})]})}}wp(Pp,"defaultProps",{file:null,paste:null,unzip:null});const $O=Pp;function Gi(n,e,t){return e=UO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function UO(n){var e=HO(n,"string");return typeof e=="symbol"?e:String(e)}function HO(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 Vu=W.module("ConsoleMenu");class ba extends c.PureComponent{static makeItemActions(e,t,r,i,a){if(e.length===0)return[];var s={menuElement:u.jsx(Ci,{value:t,onChange:i,className:"console-menu",ref:r})},o=e;t&&(o=o.filter(d=>{var{title:h}=d;return h!=null&&h.toLowerCase().indexOf(t.toLowerCase())>=0}));var l=o.map(d=>({title:d.title,action:()=>{a(d)}}));return[s,...l]}constructor(e){super(e),Gi(this,"tableSearchField",void 0),Gi(this,"widgetSearchField",void 0),Gi(this,"makeTableActions",se((t,r,i)=>{var{dh:a}=this.props,s=t.filter(o=>co.isTableType(a,o.type));return ba.makeItemActions(s,r,o=>{this.tableSearchField=o},this.handleTableFilterChange,i)})),Gi(this,"makeWidgetActions",se((t,r,i)=>{var{dh:a}=this.props,s=t.filter(o=>co.isWidgetType(a,o.type));return ba.makeItemActions(s,r,o=>{this.widgetSearchField=o},this.handleWidgetFilterChange,i)})),this.handleTableFilterChange=this.handleTableFilterChange.bind(this),this.handleTableMenuClosed=this.handleTableMenuClosed.bind(this),this.handleTableMenuOpened=this.handleTableMenuOpened.bind(this),this.handleWidgetFilterChange=this.handleWidgetFilterChange.bind(this),this.handleWidgetMenuClosed=this.handleWidgetMenuClosed.bind(this),this.handleWidgetMenuOpened=this.handleWidgetMenuOpened.bind(this),this.state={tableFilterText:"",widgetFilterText:""}}handleTableFilterChange(e){Vu.debug("filtering tables..."),this.setState({tableFilterText:e.target.value})}handleTableMenuClosed(){this.setState({tableFilterText:""})}handleTableMenuOpened(){var e;(e=this.tableSearchField)===null||e===void 0||e.focus()}handleWidgetFilterChange(e){Vu.debug("filtering widgets..."),this.setState({widgetFilterText:e.target.value})}handleWidgetMenuClosed(){this.setState({widgetFilterText:""})}handleWidgetMenuOpened(){var e;(e=this.widgetSearchField)===null||e===void 0||e.focus()}render(){var{overflowActions:e,objects:t,openObject:r}=this.props,{tableFilterText:i,widgetFilterText:a}=this.state,s=this.makeTableActions(t,i,r),o=this.makeWidgetActions(t,a,r),l={placement:"bottom-end"},d=s.length===0,h=o.length===0;return u.jsxs(u.Fragment,{children:[u.jsx(K,{"aria-label":"Tables",kind:"ghost",disabled:d,onClick:()=>{},icon:u.jsxs("div",{className:"fa-md fa-layers",children:[u.jsx(ne,{mask:Io,icon:er,transform:"right-5 down-5"}),u.jsx(ne,{icon:er,transform:"right-8 down-6"})]}),tooltip:d?"No tables available":"Tables",children:u.jsx(gn,{actions:s,onMenuOpened:this.handleTableMenuOpened,onMenuClosed:this.handleTableMenuClosed,options:{initialKeyboardIndex:1},popperOptions:l},"table-actions ")}),u.jsx(K,{"aria-label":"Widgets",kind:"ghost",disabled:o.length===0,onClick:()=>{},icon:u.jsxs("div",{className:"fa-md fa-layers",children:[u.jsx(ne,{mask:Do,icon:er,transform:"right-5 down-5"}),u.jsx(ne,{icon:er,transform:"right-8 down-6"})]}),tooltip:h?"No widgets available":"Widgets",children:u.jsx(gn,{actions:o,onMenuOpened:this.handleWidgetMenuOpened,onMenuClosed:this.handleWidgetMenuClosed,options:{initialKeyboardIndex:1},popperOptions:l},"table-actions")}),u.jsx(K,{kind:"ghost",icon:wc,tooltip:"More Actions...","aria-label":"More Actions...",onClick:()=>{},children:u.jsx(gn,{actions:e,popperOptions:l})})]})}}const VO=ba;function _p(n,e,t){return e=BO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function BO(n){var e=WO(n,"string");return typeof e=="symbol"?e:String(e)}function WO(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 Tp extends c.PureComponent{constructor(e){super(e),_p(this,"pending",void 0),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandCompleted=this.handleCommandCompleted.bind(this),this.pending=new Sn,this.state={isDisconnected:!1,isCommandRunning:!1}}componentDidMount(){this.startListening()}componentWillUnmount(){this.stopListening(),this.cancelPendingPromises()}startListening(){var{dh:e,session:t}=this.props;t.addEventListener(e.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted)}stopListening(){var{dh:e,session:t}=this.props;t.removeEventListener(e.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted)}cancelPendingPromises(){this.pending.cancel()}handleCommandStarted(e){var{result:t}=e.detail;this.pending.add(t).then(()=>this.handleCommandCompleted(null)).catch(r=>this.handleCommandCompleted(r)),this.setState({isCommandRunning:!0})}handleCommandCompleted(e){e instanceof kc||this.setState({isCommandRunning:this.pending.pending.length>0})}render(){var{children:e,dh:t,openObject:r,overflowActions:i,objects:a}=this.props,{isDisconnected:s,isCommandRunning:o}=this.state,l=null,d=null;return s?(l="console-status-icon-disconnected",d="Worker is disconnected"):o?(l="console-status-icon-pending",d="Worker is busy"):(l="console-status-icon-idle",d="Worker is idle"),u.jsxs("div",{className:"console-pane-status-bar",children:[u.jsxs("div",{children:[u.jsx("div",{className:Y("console-status-icon",l)}),u.jsx(mt,{children:d})]}),e,u.jsx(VO,{dh:t,overflowActions:i,openObject:r,objects:a})]})}}_p(Tp,"defaultProps",{children:null});const GO=Tp;function Bu(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 Pt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Bu(Object(t),!0).forEach(function(r){St(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Bu(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function St(n,e,t){return e=zO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zO(n){var e=KO(n,"string");return typeof e=="symbol"?e:String(e)}function KO(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 Lt=W.module("Console"),Wu={isAutoLaunchPanelsEnabled:!0,isPrintStdOutEnabled:!0,isClosePanelsOnDisconnectEnabled:!0};function qO(){return!0}function YO(n){return u.jsx(u.Fragment,{})}class mn extends c.PureComponent{static isErrorLevel(e){return e===$e.STDERR||e===$e.ERROR||e===$e.FATAL}static isOutputLevel(e){return e===$e.STDOUT||mn.isErrorLevel(e)}constructor(e){super(e),St(this,"cancelListener",void 0),St(this,"consolePane",void 0),St(this,"consoleInput",void 0),St(this,"consoleHistoryScrollPane",void 0),St(this,"pending",void 0),St(this,"queuedLogMessages",void 0),St(this,"processLogMessageQueue",mi(()=>{this.scrollConsoleHistoryToBottom(),this.setState(i=>{Lt.debug2("processLogMessageQueue",this.queuedLogMessages.length," items");var{consoleHistory:a}=i;return a=a.concat(this.queuedLogMessages),this.queuedLogMessages=[],{consoleHistory:a}})},mn.LOG_THROTTLE)),St(this,"getObjects",se(i=>[...i.values()])),St(this,"getContextActions",se(i=>[...i,{action:this.handleClearShortcut,shortcut:Je.CONSOLE.CLEAR},{action:this.handleFocusHistory,shortcut:Je.CONSOLE.FOCUS_HISTORY}])),this.handleCommandResult=this.handleCommandResult.bind(this),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandSubmit=this.handleCommandSubmit.bind(this),this.handleClearShortcut=this.handleClearShortcut.bind(this),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleLogMessage=this.handleLogMessage.bind(this),this.handleOverflowActions=this.handleOverflowActions.bind(this),this.handleScrollPaneScroll=this.handleScrollPaneScroll.bind(this),this.handleToggleAutoLaunchPanels=this.handleToggleAutoLaunchPanels.bind(this),this.handleToggleClosePanelsOnDisconnect=this.handleToggleClosePanelsOnDisconnect.bind(this),this.handleTogglePrintStdout=this.handleTogglePrintStdout.bind(this),this.handleUploadCsv=this.handleUploadCsv.bind(this),this.handleHideCsv=this.handleHideCsv.bind(this),this.handleCsvFileCanceled=this.handleCsvFileCanceled.bind(this),this.handleCsvFileOpened=this.handleCsvFileOpened.bind(this),this.handleCsvPaste=this.handleCsvPaste.bind(this),this.handleDragEnter=this.handleDragEnter.bind(this),this.handleDragLeave=this.handleDragLeave.bind(this),this.handleClearDragError=this.handleClearDragError.bind(this),this.handleOpenCsvTable=this.handleOpenCsvTable.bind(this),this.handleCsvUpdate=this.handleCsvUpdate.bind(this),this.handleCsvError=this.handleCsvError.bind(this),this.handleCsvInProgress=this.handleCsvInProgress.bind(this),this.consolePane=X.createRef(),this.consoleInput=X.createRef(),this.consoleHistoryScrollPane=X.createRef(),this.pending=new Sn,this.queuedLogMessages=[];var{objectMap:t,settings:r}=this.props;this.state=Pt(Pt({consoleHistory:[],consoleHeight:0,isScrollDecorationShown:!1,objectHistoryMap:new Map,objectMap:new Map(t),showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1},Wu),r)}componentDidMount(){this.initConsoleLogging();var{dh:e,session:t}=this.props;t.addEventListener(e.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.updateDimensions()}componentDidUpdate(e,t){var{props:r,state:i}=this;this.sendSettingsChange(t,i),r.objectMap!==e.objectMap&&this.updateObjectMap()}componentWillUnmount(){var{dh:e,session:t}=this.props;t.removeEventListener(e.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.pending.cancel(),this.processLogMessageQueue.cancel(),this.deinitConsoleLogging()}initConsoleLogging(){var{session:e}=this.props;this.cancelListener=e.onLogMessage(this.handleLogMessage)}deinitConsoleLogging(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}handleClearShortcut(e){var t;e.preventDefault(),e.stopPropagation(),(t=this.consoleInput.current)===null||t===void 0||t.clear()}handleCommandStarted(e){var{code:t,result:r}=e.detail,i=this.pending.add(r),a={command:t,disabledObjects:[],startTime:Date.now(),cancelResult:()=>{r.cancel()},wrappedResult:i},{commandHistoryStorage:s,language:o,scope:l}=this.props,d=s.addItem(o,l,t,{command:t,startTime:new Date().toJSON()});d.catch(h=>{Lt.debug("Error adding workspace item",h)}),this.setState(h=>({consoleHistory:h.consoleHistory.concat(a)}),()=>{this.scrollConsoleHistoryToBottom(!0)}),i.then(h=>{this.handleCommandResult(h,a,d)}).catch(h=>{this.handleCommandError(h,a,d)})}handleCommandResult(e,t,r){var i=Pt(Pt({},t),{},{wrappedResult:void 0,cancelResult:void 0,result:e??t.result});this.setState(a=>{var{consoleHistory:s}=a,o=s.lastIndexOf(t);if(o<0)return Lt.error("historyItem not found in consoleHistory"),null;var l=s.concat();return l[o]=i,{consoleHistory:l}}),e&&(this.updateHistory(e,i),this.updateKnownObjects(i),this.updateWorkspaceHistoryItem({error:e.error},r),this.closeRemovedItems(e.changes),this.openUpdatedItems(e.changes))}handleCommandError(e,t,r){if(Se.isCanceled(e)){Lt.debug("Called handleCommandError on a cancelled promise result");return}this.updateWorkspaceHistoryItem({error:"".concat(e)},r),this.setState(i=>{var a=i.consoleHistory.concat(),s=a.lastIndexOf(t),o=Pt({},t);return o.wrappedResult=void 0,o.cancelResult=void 0,o.endTime=Date.now(),o.result={error:e},a[s]=o,{consoleHistory:a}})}handleFocusHistory(e){e.preventDefault(),e.stopPropagation();var{focusCommandHistory:t}=this.props;t()}handleLogMessage(e){var{isPrintStdOutEnabled:t}=this.state;t&&mn.isOutputLevel(e.logLevel)&&this.queueLogMessage(e.message,e.logLevel)}queueLogMessage(e,t){var r={};mn.isErrorLevel(t)?r.error=e:r.message=e;var i={command:void 0,result:r};this.queuedLogMessages.push(i),this.processLogMessageQueue()}openUpdatedItems(e){Lt.debug("openUpdatedItems",e);var{isAutoLaunchPanelsEnabled:t}=this.state;if(e!=null){var{openObject:r}=this.props;[...e.created,...e.updated].forEach(i=>r(i,t&&(i.title===void 0||!i.title.startsWith("_"))))}}closeRemovedItems(e){if(!(e==null||e.removed==null||e.removed.length===0)){var{closeObject:t}=this.props,{removed:r}=e;r.forEach(i=>t(i))}}updateHistory(e,t){var r=t;e==null||e.changes==null||r==null||(r.endTime=Date.now(),this.scrollConsoleHistoryToBottom(),this.setState(i=>{var a=i.consoleHistory.concat();return{consoleHistory:a}}))}updateKnownObjects(e){var t;if(e.result&&(t=e.result.changes),!t||(t.created==null||t.created.length===0)&&(t.updated==null||t.updated.length===0)&&(t.removed==null||t.removed.length===0)){Lt.debug2("updateKnownObjects no changes");return}this.setState(r=>{var i,a,s,{consoleHistory:o}=r,l=o.lastIndexOf(e);if(l<0)return Lt.error("historyItem not found in state.consoleHistory"),null;var d=new Map(r.objectHistoryMap),h=new Map(r.objectMap),f=function(p){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{title:b}=p;z(b);var g=d.get(b);if(g!=null&&g>=0){var C;o===r.consoleHistory&&(o=o.concat());var S=Pt(Pt({},o[g]),{},{disabledObjects:[...(C=o[g].disabledObjects)!==null&&C!==void 0?C:[],b]});o[g]=S}d.set(b,l),m?h.delete(b):h.set(b,p)};return(i=t)===null||i===void 0||i.updated.forEach(v=>f(v)),(a=t)===null||a===void 0||a.removed.forEach(v=>f(v,!0)),(s=t)===null||s===void 0||s.created.forEach(v=>{var{title:p}=v;z(p),d.set(p,l),h.set(p,v)}),{objectHistoryMap:d,objectMap:h,consoleHistory:o}})}updateObjectMap(){var{objectMap:e}=this.props;this.setState({objectMap:e})}updateWorkspaceHistoryItem(e,t){var r=this.pending.add(t),i=new Date().toJSON();r.then(a=>{var s=Pt(Pt({},a),{},{data:Pt(Pt({},a.data),{},{endTime:i,result:e})}),{commandHistoryStorage:o,language:l}=this.props;o.updateItem(l,s).catch(d=>{Lt.warn("Error updating command history storage",d)})}).catch(a=>{Lt.debug("Error updating workspace history item",a)})}scrollConsoleHistoryToBottom(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.consoleHistoryScrollPane.current;z(t),!(!e&&Math.abs(t.scrollHeight-t.clientHeight-t.scrollTop)>=1)&&window.requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight})}handleScrollPaneScroll(){var e=this.consoleHistoryScrollPane.current;z(e),e.scrollTop>0&&e.scrollHeight>e.clientHeight?this.setState({isScrollDecorationShown:!0}):this.setState({isScrollDecorationShown:!1})}handleToggleAutoLaunchPanels(){this.setState(e=>({isAutoLaunchPanelsEnabled:!e.isAutoLaunchPanelsEnabled}))}handleToggleClosePanelsOnDisconnect(){this.setState(e=>({isClosePanelsOnDisconnectEnabled:!e.isClosePanelsOnDisconnectEnabled}))}handleTogglePrintStdout(){this.setState(e=>({isPrintStdOutEnabled:!e.isPrintStdOutEnabled}))}handleUploadCsv(){this.setState({showCsvOverlay:!0,dragError:null,csvUploadInProgress:!1})}handleHideCsv(){this.setState({showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1})}handleCsvFileCanceled(){this.setState({csvFile:null,csvPaste:null})}handleCsvFileOpened(e){this.setState({csvFile:e,csvPaste:null})}handleCsvPaste(e){this.setState({csvFile:null,csvPaste:e})}handleDragEnter(e){if(!(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0||e.dataTransfer.items[0].kind==="string")){e.preventDefault(),e.stopPropagation(),this.setState({showCsvOverlay:!0});var{items:t}=e.dataTransfer;if(t.length>1){this.setState({dragError:Zn.MULTIPLE_FILE_ERROR});return}var r=t[0];Zn.isValidDropItem(r)?this.setState({dragError:null}):this.setState({dragError:Zn.FILE_TYPE_ERROR})}}handleDragLeave(e){e.currentTarget==null||e.currentTarget instanceof Element&&e.relatedTarget instanceof Element&&e.currentTarget.contains(e.relatedTarget)||(e.preventDefault(),e.stopPropagation(),this.setState({showCsvOverlay:!1,dragError:null}))}handleClearDragError(){this.setState({dragError:null})}handleOpenCsvTable(e){var{dh:t,openObject:r,commandHistoryStorage:i,language:a,scope:s}=this.props,{consoleHistory:o,objectMap:l}=this.state,d={name:e,title:e,type:t.VariableType.TABLE},h=l.has(e),f={startTime:Date.now(),endTime:Date.now(),disabledObjects:[],result:{changes:{created:[],updated:[],removed:[],[h?"updated":"created"]:[d]}}},v=o.concat(f);this.setState({consoleHistory:v}),this.scrollConsoleHistoryToBottom(!0),this.updateKnownObjects(f),r({name:e,type:t.VariableType.TABLE}),i.addItem(a,s,e,{command:e,startTime:new Date().toJSON(),endTime:new Date().toJSON()})}addConsoleHistoryMessage(e,t){var{consoleHistory:r}=this.state,i={startTime:Date.now(),endTime:Date.now(),result:{message:e,error:t}},a=r.concat(i);this.setState({consoleHistory:a})}handleCsvUpdate(e){this.addConsoleHistoryMessage(e)}handleCsvError(e){this.addConsoleHistoryMessage(void 0,e!=null?"".concat(e):void 0)}handleCsvInProgress(e){this.setState({csvUploadInProgress:e})}handleOverflowActions(){var{isAutoLaunchPanelsEnabled:e,isClosePanelsOnDisconnectEnabled:t,isPrintStdOutEnabled:r}=this.state,{actions:i}=this.props;return[...i,{title:"Print Stdout",action:this.handleTogglePrintStdout,group:ae.groups.high,icon:r?ar:void 0,order:10},{title:"Auto Launch Panels",action:this.handleToggleAutoLaunchPanels,group:ae.groups.high,icon:e?ar:void 0,order:20},{title:"Close Panels on Disconnect",action:this.handleToggleClosePanelsOnDisconnect,group:ae.groups.high,icon:t?ar:void 0,order:30},{title:"Upload Table from File",action:this.handleUploadCsv,group:ae.groups.high+10,order:40}]}handleCommandSubmit(e){if(e==="clear"||e==="cls")this.clearConsoleHistory();else if(e.length>0){var{session:t}=this.props;t.runCode(e).catch(i=>{Lt.error("There was an error initiating the command",i)})}else{var r={command:" ",result:{},startTime:Date.now(),endTime:Date.now()};this.scrollConsoleHistoryToBottom(!0),this.setState(i=>({consoleHistory:i.consoleHistory.concat(r)}))}}clearConsoleHistory(){this.pending.cancel(),this.setState(e=>{var t=new Map([...e.objectHistoryMap.keys()].map(r=>[r,-1]));return{consoleHistory:[],objectHistoryMap:t}})}addCommand(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.consoleInput.current&&(this.consoleInput.current.setConsoleText(e,t,r),t&&this.scrollConsoleHistoryToBottom(!0))}focus(){var e;(e=this.consoleInput.current)===null||e===void 0||e.focus()}sendSettingsChange(e,t){for(var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=Object.keys(Wu),a={},s=!1,o=0;o<i.length;o+=1){var l=i[o],{[l]:d}=t,{[l]:h}=e;d!==h&&(s=!0),a[l]=d}if(!(r&&!s)){var{onSettingsChange:f}=this.props;f(a)}}updateDimensions(){this.consolePane.current&&this.setState({consoleHeight:this.consolePane.current.clientHeight}),this.consoleInput.current&&this.consoleInput.current.updateDimensions()}render(){var{actions:e,dh:t,historyChildren:r,language:i,statusBarChildren:a,openObject:s,session:o,scope:l,commandHistoryStorage:d,timeZone:h,disabled:f,unzip:v,supportsType:p,iconForType:m}=this.props,{consoleHeight:b,consoleHistory:g,isScrollDecorationShown:C,objectMap:S,showCsvOverlay:y,csvFile:w,csvPaste:E,dragError:D,csvUploadInProgress:T}=this.state,O=this.getObjects(S),M=Math.round(b*.7),j=this.getContextActions(e);return u.jsxs("div",{role:"presentation",className:Y("iris-console","h-100","w-100",{disabled:f}),children:[u.jsxs("div",{className:"console-pane",ref:this.consolePane,children:[u.jsx(GO,{dh:t,session:o,overflowActions:this.handleOverflowActions,openObject:s,objects:O,children:a}),u.jsxs("div",{className:"console-csv-container",onDragOver:Zn.handleDragOver,onDragEnter:this.handleDragEnter,onDragLeave:this.handleDragLeave,children:[y&&u.jsx(Zn,{onCancel:this.handleCsvFileCanceled,onFileOpened:this.handleCsvFileOpened,onPaste:this.handleCsvPaste,clearDragError:this.handleClearDragError,dragError:D,onError:this.handleCsvError,uploadInProgress:T,allowZip:v!=null}),u.jsxs("div",{role:"presentation",className:Y("scroll-pane no-scroll-x",{"scroll-decoration":C}),onScroll:this.handleScrollPaneScroll,ref:this.consoleHistoryScrollPane,children:[u.jsx(lO,{items:g,openObject:s,language:i,disabled:f,supportsType:p,iconForType:m}),r]})]}),!y&&u.jsx(Lu,{ref:this.consoleInput,session:o,language:i,scope:l,onSubmit:this.handleCommandSubmit,maxHeight:M,commandHistoryStorage:d}),y&&u.jsx($O,{session:o,onOpenTable:this.handleOpenCsvTable,onClose:this.handleHideCsv,onUpdate:this.handleCsvUpdate,onError:this.handleCsvError,file:w??void 0,paste:E??void 0,onInProgress:this.handleCsvInProgress,timeZone:h,unzip:v})]}),u.jsx(ae,{actions:j,ignoreClassNames:[Lu.INPUT_CLASS_NAME]})]})}}St(mn,"defaultProps",{statusBarChildren:null,settings:{},onSettingsChange:()=>{},scope:null,actions:[],historyChildren:null,timeZone:"America/New_York",objectMap:new Map,disabled:!1,unzip:null,supportsType:qO,iconForType:YO});St(mn,"LOG_THROTTLE",500);const XO=mn;var ZO={groovy:"Groovy",python:"Python",scala:"Scala"};class QO{static normalizeScriptLanguage(e){return ZO[e]||null}static getDisabledRunTooltip(e,t,r,i){return e?t?null:"".concat(r," doesn't match the session language – ").concat(i," disabled"):"Console session not connected – ".concat(i," disabled")}static outdentCode(e){var t=e.split(`
|
|
12
|
+
`),r=t.reduce((i,a)=>{var s=a.length-a.trimStart().length;return s===a.length?i:s<i?s:i},Number.MAX_SAFE_INTEGER);return t.map(i=>i.slice(r)).join(`
|
|
13
|
+
`)}}const vo=QO;function Yr(n,e,t){return e=JO(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function JO(n){var e=eD(n,"string");return typeof e=="symbol"?e:String(e)}function eD(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 Ct=W.module("ScriptEditor");class Op extends c.Component{constructor(e){super(e),Yr(this,"contextActionCleanups",void 0),Yr(this,"completionCleanup",void 0),Yr(this,"editor",void 0),Yr(this,"editorComponent",void 0),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleRun=this.handleRun.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.updateShortcuts=this.updateShortcuts.bind(this),this.contextActionCleanups=[],this.editorComponent=X.createRef(),this.state={model:null}}componentDidMount(){Ke.addEventListener("onUpdate",this.updateShortcuts)}componentDidUpdate(e){var t,r,{sessionLanguage:i,settings:a}=this.props,s=a==null?void 0:a.language,o=s!==((t=e.settings)===null||t===void 0?void 0:t.language);o&&(Ct.debug("Set language",s),this.setLanguage(s));var l=i==null&&e.sessionLanguage!=null,d=s===i,h=((r=e.settings)===null||r===void 0?void 0:r.language)===e.sessionLanguage;(l||i!==void 0&&h&&!d)&&(Ct.debug("De-init completion and context actions"),this.deInitContextActions(),this.deInitCodeCompletion());var f=i!=null&&e.sessionLanguage==null;(f&&d||i!==void 0&&!h&&d)&&(Ct.debug("Init completion and context actions"),this.initContextActions(),this.initCodeCompletion())}componentWillUnmount(){Ke.removeEventListener("onUpdate",this.updateShortcuts)}getValue(){return this.editor?this.editor.getValue():(Ct.error("Editor not initialized"),null)}getSelectedCommand(){var e,t,r=(e=this.editor)===null||e===void 0?void 0:e.getSelection();z(r);var i=(t=this.editor)===null||t===void 0?void 0:t.getModel();z(i);var{startLineNumber:a,endColumn:s}=r,{endLineNumber:o}=r;s===1&&o>a&&(o-=1);var l=i.getLineMinColumn(a),d=i.getLineMaxColumn(o),h=r.setStartPosition(a,l).setEndPosition(o,d);return vo.outdentCode(i.getValueInRange(h))}handleEditorInitialized(e){var{focusOnMount:t,onChange:r,onEditorInitialized:i,settings:a,session:s,sessionLanguage:o}=this.props;Ct.debug("handleEditorInitialized",o,s,a),this.editor=e,this.setState({model:this.editor.getModel()}),ct.setEOL(e),ct.registerPasteHandler(e),s!=null&&a&&o===a.language&&(this.initContextActions(),this.initCodeCompletion()),e.onDidChangeModelContent(r),t!=null&&t&&e.focus(),i(this.editor)}handleEditorWillDestroy(e){Ct.debug("handleEditorWillDestroy");var{onEditorWillDestroy:t}=this.props;t(e),this.deInitContextActions(),this.deInitCodeCompletion(),this.setState({model:null}),this.editor=void 0}handleRun(){var{onRunCommand:e}=this.props,t=this.getValue();t!=null&&e(t)}handleRunSelected(){var{onRunCommand:e}=this.props,t=this.getSelectedCommand();e(t)}initContextActions(){if(this.contextActionCleanups.length>0){Ct.error("Context actions already initialized.");return}if(this.editor){var e=[];e.push(this.editor.addAction({id:"run-code",label:"Run",keybindings:[ct.getMonacoKeyCodeFromShortcut(Je.NOTEBOOK.RUN)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRun()}})),e.push(this.editor.addAction({id:"run-selected-code",label:"Run Selected",keybindings:[ct.getMonacoKeyCodeFromShortcut(Je.NOTEBOOK.RUN_SELECTED)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRunSelected()}})),this.contextActionCleanups=e}}deInitContextActions(){this.contextActionCleanups.length>0&&(this.contextActionCleanups.forEach(e=>e.dispose()),this.contextActionCleanups=[])}updateShortcuts(){this.deInitContextActions(),this.initContextActions()}initCodeCompletion(){if(this.completionCleanup!=null){Ct.error("Code completion already initialized.");return}var{session:e}=this.props;Ct.debug("initCodeCompletion",this.editor,e),this.editor&&e!=null&&(this.completionCleanup=ct.openDocument(this.editor,e))}deInitCodeCompletion(){var{session:e}=this.props;Ct.debug("deInitCodeCompletion",this.editor,e),this.completionCleanup&&(this.completionCleanup.dispose(),this.completionCleanup=void 0,this.editor&&e!=null&&ct.closeDocument(this.editor,e))}append(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;z(this.editor);var r=this.editor.getModel();z(r);var i=r.getValue();i?r.setValue("".concat(i,`
|
|
14
|
+
`).concat(e)):r.setValue("".concat(e));var a=r.getLineCount(),s=r.getLineLength(a)+1;this.editor.setPosition({lineNumber:a,column:s}),t&&this.editor.focus()}updateDimensions(){Ct.debug("updateDimensions"),this.editor&&this.editor.layout()}focus(){Ct.debug("focus"),this.editor&&this.editor.focus()}toggleFind(){this.editorComponent.current&&this.editorComponent.current.toggleFind()}setLanguage(e){this.editorComponent.current&&e!==void 0&&this.editorComponent.current.setLanguage(e)}render(){var e,{error:t,isLoaded:r,isLoading:i,session:a,sessionLanguage:s,settings:o}=this.props,{model:l}=this.state,d=t?"Unable to open document. ".concat(t):null,h=o&&(e=o.language)!==null&&e!==void 0?e:null,f=l&&a&&h===s;return u.jsxs(u.Fragment,{children:[(t||i)&&u.jsx("div",{className:"h-100 w-100 position-relative",children:u.jsx(Ne,{errorMessage:d,isLoading:i,isLoaded:r})}),r&&u.jsx("div",{className:"h-100 w-100 script-editor",children:o&&u.jsxs(u.Fragment,{children:[u.jsx(SC,{ref:this.editorComponent,settings:o,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy}),f!=null&&f&&u.jsx(Cp,{model:l,language:h,session:a})]})})]})}}Yr(Op,"defaultProps",{error:null,isLoading:!1,isLoaded:!1,focusOnMount:!0,onChange:()=>{},onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},session:null});const tD=Op;function Xr(n,e,t){return e=nD(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function nD(n){var e=rD(n,"string");return typeof e=="symbol"?e:String(e)}function rD(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 iD=250,aD=2500;class Qa extends c.Component{static getTimeString(e,t){if(e==null||t===""||t===0)return null;var r=Math.round((new Date(t).valueOf()-new Date(e).valueOf())/1e3);return r<1?"<1s":sr.formatElapsedTime(r)}constructor(e){super(e),Xr(this,"timer",void 0),Xr(this,"cleanup",void 0),Xr(this,"loadData",Le(()=>{var{commandHistoryStorage:t,item:r,language:i}=this.props,{id:a}=r;this.cleanup=t.listenItem(i,a,this.handleUpdate,this.handleError)},iD)),Xr(this,"getPreviewText",st(t=>t.split(`
|
|
15
|
+
`,aD).join(`
|
|
16
|
+
`),{max:1})),this.handleUpdate=this.handleUpdate.bind(this),this.handleError=this.handleError.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.state={currentTime:Date.now()}}componentDidMount(){this.loadData()}componentDidUpdate(e,t){var r,{data:i}=this.state;this.timer==null&&!(i!=null&&i.result)&&(i!=null&&i.startTime)&&!(i==null||i.endTime===void 0)?this.startTimer():(i!=null&&i.result&&!((r=t.data)!==null&&r!==void 0&&r.result)||i!=null&&i.endTime&&!(t.data==null||t.data.endTime===void 0))&&this.stopTimer()}componentWillUnmount(){this.loadData.cancel(),this.cleanup!=null&&this.cleanup(),this.stopTimer()}startTimer(){this.stopTimer(),this.timer=setInterval(this.handleTimeout,1e3)}stopTimer(){this.timer&&(clearInterval(this.timer),this.timer=void 0)}updateTime(){this.setState({currentTime:Date.now()})}handleError(e){this.setState({error:"".concat(e)})}handleUpdate(e){var{data:t}=e??{};this.setState({data:t});var{onUpdate:r}=this.props;r==null||r(t)}handleTimeout(){this.updateTime()}render(){var e,{item:{name:t},language:r}=this.props,{currentTime:i,data:a,error:s}=this.state,{result:o,startTime:l,endTime:d}=a??{},h=(e=o==null?void 0:o.error)!==null&&e!==void 0?e:s,f=Qa.getTimeString(l,d??i),v=this.getPreviewText(t),p=!!f;return u.jsxs("div",{className:"command-history-item-tooltip",children:[u.jsxs("div",{className:"scroll-container",children:[u.jsx(vp,{language:r,children:v}),v.length<t.length&&u.jsx("p",{children:"Preview Truncated..."})]}),u.jsxs("div",{className:"result-info",children:[u.jsxs("div",{className:"d-flex justify-content-between",children:[!!h&&u.jsxs("div",{className:"text-danger mr-1",children:[u.jsx(ne,{icon:xo})," Executed with errors"]}),u.jsxs("div",{className:"time-wrapper",children:["Elapsed time:"," ",p?u.jsx("span",{className:"time-string",children:f}):u.jsx(Da,{className:"loading-spinner-vertical-align"})]})]}),!!h&&u.jsx("div",{className:"error-message",children:h})]})]})}}Xr(Qa,"defaultProps",{onUpdate:()=>{}});const sD=Qa;var oD=512;function Dp(n){var{item:e,language:t,isSelected:r,commandHistoryStorage:i}=n,a=e.name.substring(0,oD),s=c.useRef(null),o=c.useCallback(()=>{var l;(l=s.current)===null||l===void 0||l.update()},[s]);return u.jsxs("div",{className:Y("command-history-item",{selected:r}),children:[a,u.jsx(mt,{ref:s,interactive:!0,options:{placement:"left",modifiers:{preventOverflow:{enabled:!0,boundariesElement:"viewport",order:825}}},popperClassName:"command-history-item-popper",children:u.jsx(sD,{item:e,language:t,onUpdate:o,commandHistoryStorage:i})})]})}Dp.defaultProps={isSelected:!1};class Ca extends c.Component{static itemKey(e,t){return"".concat(t.title)}static renderContent(e){return e.selectionRequired!==void 0&&e.selectionRequired?u.jsxs("div",{className:"fa-md fa-layers",children:[u.jsx(ne,{icon:Fs,mask:e.icon,transform:"right-5 down-5 shrink-4"}),u.jsx(ne,{icon:eb,transform:"shrink-3 right-7 down-6"})]}):u.jsx(ne,{icon:e.icon})}render(){var{actions:e,hasSelection:t}=this.props;return u.jsx("div",{className:"command-history-actions",children:e.map((r,i)=>u.jsx(K,{kind:"inline",className:Y(r.className),onClick:r.action,tooltip:r.description,disabled:r.selectionRequired!==void 0&&r.selectionRequired&&!t,icon:Ca.renderContent(r)},Ca.itemKey(i,r)))})}}const lD=Ca;var dD=150,Gu=3,zu=W.module("CommandHistoryViewportUpdater");function uD(n){var{table:e,columns:t,top:r=0,bottom:i=0,search:a,isReversed:s=!1,onUpdate:o}=n,l=c.useMemo(()=>mi(d=>{var h=d.bottom-d.top,f=Math.max(0,d.top-h*Gu),v=d.bottom+h*Gu;e.setViewport({top:f,bottom:v,columns:d.columns})},dD),[e]);return c.useEffect(function(){var h=e.onUpdate(f=>{var v,p;o({items:(v=f.items)!==null&&v!==void 0?v:[],offset:(p=f.offset)!==null&&p!==void 0?p:0})});return()=>{zu.debug("onUpdate cleanup"),h()}},[e,o]),c.useEffect(function(){e.setSearch(a??"")},[e,a]),c.useEffect(function(){l({top:r,bottom:i,columns:t})},[l,r,i,t,a,s]),c.useEffect(()=>()=>{zu.debug2("Cancel throttledUpdateViewport"),l.cancel()},[l]),null}function Ku(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function qu(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){Ku(a,r,i,s,o,"next",l)}function o(l){Ku(a,r,i,s,o,"throw",l)}s(void 0)})}}function kt(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=cD(n,"string");return typeof e=="symbol"?e:String(e)}function cD(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 sn=W.module("CommandHistory");class Qe extends c.Component{static getCommandsFromViewport(e,t,r){for(var i=[],a=0;a<r.length;a+=1)for(var s=r[a],o=s[0];o<=s[1];o+=1)if(o>=t&&o<t+e.length){var{name:l}=e[o-t];i.push(l)}return i}static getCommandsFromSnapshot(e,t){return qu(function*(){var r=yield e.getSnapshot(t);return[...r.values()].map(i=>i.name)})()}constructor(e){super(e),kt(this,"itemActions",void 0),kt(this,"historyActions",void 0),kt(this,"pending",void 0),kt(this,"searchInputRef",void 0),kt(this,"itemListRef",void 0),kt(this,"debouncedSearchChange",Le(()=>{this.setState(r=>{var{searchText:i}=r;return{debouncedSearchText:i,selectedRanges:[]}})},Qe.SET_SEARCH_DEBOUNCE_MS)),this.copySelectedCommands=this.copySelectedCommands.bind(this),this.createNotebook=this.createNotebook.bind(this),this.sendToConsole=this.sendToConsole.bind(this),this.renderItem=this.renderItem.bind(this),this.runInConsole=this.runInConsole.bind(this),this.sendToNotebook=this.sendToNotebook.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.handleViewportUpdate=this.handleViewportUpdate.bind(this),this.itemActions=[{title:"Copy Selection",description:"Copy selected commands to clipboard",icon:tb,shortcut:Cr.COPY,action:this.copySelectedCommands,group:ae.groups.edit},{title:"Send to Console",description:"Open selected commands in the console",icon:Ql,shortcut:Je.COMMAND_HISTORY.SEND_TO_CONSOLE,action:this.sendToConsole,group:Qe.menuGroups.send,order:10},{title:"Run in Console",description:"Run selected commands in the console",icon:Pc,shortcut:Je.COMMAND_HISTORY.RUN,action:this.runInConsole,group:Qe.menuGroups.send,order:10},{title:"Send to Active Notebook",description:"Open selected commands in a notebook",icon:Jl,shortcut:Je.COMMAND_HISTORY.SEND_TO_NOTEBOOK,action:this.sendToNotebook,group:Qe.menuGroups.send,order:20},{title:"Send to New Notebook",description:"Open selected commands in a new notebook",icon:_c,action:this.createNotebook,group:Qe.menuGroups.send,order:30}],this.historyActions=[{title:"Send to Console",icon:Ql,selectionRequired:!0,description:"Open selected commands in the console",action:this.sendToConsole},{title:"Send to Notebook",icon:Jl,selectionRequired:!0,description:"Open selected commands in a notebook",action:this.sendToNotebook}],this.pending=new Sn,this.searchInputRef=X.createRef(),this.itemListRef=X.createRef();var{table:t}=e;this.state={actions:[],historyActions:this.historyActions,top:0,bottom:0,itemCount:t.size,items:[],offset:0,selectedRanges:[],searchText:"",debouncedSearchText:""}}componentWillUnmount(){this.debouncedSearchChange.cancel(),this.pending.cancel()}getSelectedCommands(){var e=this;return qu(function*(){var{items:t,offset:r,selectedRanges:i}=e.state,a=i.slice().sort((o,l)=>o[0]-l[0]);if(a.length===0)return[];if(a[0][0]>=r&&a[a.length-1][1]<r+t.length)return Qe.getCommandsFromViewport(t,r,a);var{table:s}=e.props;return e.pending.add(Qe.getCommandsFromSnapshot(s,a))})()}getSelectedCommandText(){return this.getSelectedCommands().then(e=>e.join(`
|
|
17
|
+
`))}updateActions(){this.setState(e=>{var{selectedRanges:t}=e,r=t.reduce((i,a)=>i+a[1]-a[0]+1,0);return r>0&&r<Qe.MAX_SELECTION_COUNT?(sn.debug("Updating actions",this.itemActions),{actions:this.itemActions}):(sn.debug("Disabling actions",r),{actions:[]})})}copySelectedCommands(){this.getSelectedCommandText().then(Qc).catch(sn.error)}createNotebook(){this.getSelectedCommandText().then(e=>{var{language:t,sendToNotebook:r}=this.props;r({value:e,language:t},!0)}).catch(sn.error)}sendToNotebook(){this.getSelectedCommandText().then(e=>{var{language:t,sendToNotebook:r}=this.props;r({value:e,language:t})}).catch(sn.error)}sendToConsole(){var{sendToConsole:e}=this.props;this.getSelectedCommandText().then(e).catch(sn.error)}runInConsole(){this.getSelectedCommandText().then(e=>{var{sendToConsole:t}=this.props;t(e,!0,!0)}).catch(sn.error)}handleSelect(e){var{sendToConsole:t}=this.props,{items:r,offset:i}=this.state;if(e<i||e>=i+r.length){sn.error("Invalid index!",e);return}var{name:a}=r[e-i];t(a)}handleSelectionChange(e){this.setState({selectedRanges:e}),this.updateActions()}handleViewportChange(e,t){this.setState({top:e,bottom:t})}handleSearchChange(e){this.setState({searchText:e.target.value}),this.debouncedSearchChange()}handleViewportUpdate(e){var{items:t,offset:r}=e,{table:i}=this.props,a=i.size;this.setState({items:t,itemCount:a,offset:r})}renderItem(e){var{item:t,itemIndex:r,isSelected:i}=e,{language:a,commandHistoryStorage:s}=this.props;return u.jsx(Dp,{isSelected:i,item:t,language:a,commandHistoryStorage:s})}focus(){this.searchInputRef.current&&this.searchInputRef.current.focus()}restoreScrollPosition(){var e;(e=this.itemListRef.current)===null||e===void 0||e.restoreScrollPosition()}render(){var e,{language:t,table:r}=this.props,{actions:i,historyActions:a,searchText:s,debouncedSearchText:o,top:l,bottom:d,items:h,itemCount:f,offset:v,selectedRanges:p}=this.state,m=(e=pp.LANGUAGE_MAP.get(t))!==null&&e!==void 0?e:"";return u.jsxs("div",{className:"command-history",children:[u.jsxs("div",{className:"command-history-search-bar",children:[u.jsx(Ci,{ref:this.searchInputRef,value:s,placeholder:"".concat(m," Command History"),onChange:this.handleSearchChange}),u.jsx(lD,{actions:a,hasSelection:p.length>0})]}),u.jsxs("div",{className:"command-history-list",children:[u.jsx(br,{ref:this.itemListRef,itemCount:f,items:h,offset:v,selectedRanges:p,onSelect:this.handleSelect,onSelectionChange:this.handleSelectionChange,onViewportChange:this.handleViewportChange,renderItem:this.renderItem,rowHeight:Qe.ITEM_HEIGHT,isDoubleClickSelect:!0,isMultiSelect:!0,isStickyBottom:!0}),u.jsx(uD,{table:r,top:l,bottom:d,search:o,onUpdate:this.handleViewportUpdate}),u.jsx(ae,{actions:i})]})]})}}kt(Qe,"ITEM_HEIGHT",29);kt(Qe,"MAX_SELECTION_COUNT",1e4);kt(Qe,"SET_SEARCH_DEBOUNCE_MS",150);kt(Qe,"menuGroups",{send:ae.groups.medium+100});const fD=Qe;class vD extends c.PureComponent{constructor(e){super(e),this.handleSwitchClick=this.handleSwitchClick.bind(this)}handleSwitchClick(){var{logLevel:e,onClick:t}=this.props;t(e)}render(){var{logLevel:e,on:t}=this.props;return u.jsxs("div",{className:Y("log-level-menu-item",e),children:[u.jsx(Xc,{on:t,onClick:this.handleSwitchClick}),e]})}}const pD=vD;function Yu(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 Xu(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Yu(Object(t),!0).forEach(function(r){ht(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Yu(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ht(n,e,t){return e=mD(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mD(n){var e=gD(n,"string");return typeof e=="symbol"?e:String(e)}function gD(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 _e extends c.PureComponent{static getLogText(e){var t=new Date(e.micros/1e3),r=co.formatTimestamp(t);return"".concat(r," ").concat(e.logLevel," ").concat(e.message)}constructor(e){super(e),ht(this,"cancelListener",void 0),ht(this,"editor",void 0),ht(this,"editorContainer",void 0),ht(this,"logLevelMenuItems",void 0),ht(this,"flushTimer",void 0),ht(this,"bufferedMessages",void 0),ht(this,"messages",void 0),this.handleClearClick=this.handleClearClick.bind(this),this.handleFlushTimeout=this.handleFlushTimeout.bind(this),this.handleLogMessage=this.handleLogMessage.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleResetClick=this.handleResetClick.bind(this),this.handleResize=this.handleResize.bind(this),this.handleToggleAllClick=this.handleToggleAllClick.bind(this),this.logLevelMenuItems={},this.editorContainer=null,this.bufferedMessages=[],this.messages=[],this.state={shownLogLevels:{}}}componentDidMount(){this.resetLogLevels(),this.initMonaco(),this.startListening(),window.addEventListener("resize",this.handleResize)}componentDidUpdate(e,t){this.updateDimensions();var{shownLogLevels:r}=this.state;t.shownLogLevels!==r&&this.refreshLogText();var{session:i}=this.props;e.session!==i&&(this.stopListening(),this.startListening(),this.clearLogs())}componentWillUnmount(){this.stopFlushTimer(),this.stopListening(),this.destroyMonaco(),window.removeEventListener("resize",this.handleResize)}getMenuActions(e){var t=this,r=[];r.push({menuElement:u.jsx("div",{className:"log-level-menu-title",children:"Display Log Levels"}),group:1,order:10});for(var i=function(){var o=_e.AllLogLevels[a],l=e[o]!=null?e[o]:!1;r.push({title:o,group:1,order:a+100,menuElement:u.jsx(pD,{logLevel:o,on:l,onClick:t.handleMenuItemClick,ref:d=>{d!=null&&(t.logLevelMenuItems[o]=d)}})})},a=0;a<_e.AllLogLevels.length;a+=1)i();return r.push({group:1,order:1e3,menuElement:u.jsxs("div",{className:"log-level-menu-controls",children:[u.jsx(K,{kind:"ghost",className:"log-level-toggle-all",onClick:this.handleToggleAllClick,children:"Toggle All"}),u.jsx(K,{kind:"ghost",onClick:this.handleResetClick,children:"Reset"})]})}),r}resetLogLevels(){for(var e={},t=function(){var a=_e.AllLogLevels[r],s=_e.DefaultLogLevels.some(o=>o===a);e[a]=s},r=0;r<_e.AllLogLevels.length;r+=1)t();this.setState({shownLogLevels:e})}startListening(){var{session:e}=this.props;this.cancelListener=e.onLogMessage(this.handleLogMessage)}stopListening(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}initMonaco(){z(this.editorContainer),this.editor=Ro.create(this.editorContainer,{copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"log",lineDecorationsWidth:0,lineNumbers:"off",lineNumbersMinChars:0,minimap:{enabled:!1},readOnly:!0,renderLineHighlight:"none",scrollBeyondLastLine:!1,value:"",wordWrap:"on"}),[[ti.Escape],[ef.Shift|ti.Escape]].forEach(e=>{z(this.editor),ct.disableKeyBindings(this.editor,e),this.editor.addAction({id:"clear-selection-on-escape",label:"",keybindings:[ti.Escape],keybindingContext:"findWidgetVisible && editorTextFocus",run:()=>{var t,r,i=(t=this.editor)===null||t===void 0?void 0:t.getPosition();z(i),(r=this.editor)===null||r===void 0||r.setPosition(i)}})})}destroyMonaco(){this.editor&&(this.editor.dispose(),this.editor=void 0)}triggerFindWidget(){var e,t;(e=this.editor)===null||e===void 0||e.focus(),(t=this.editor)===null||t===void 0||t.trigger("keyboard","actions.find",void 0)}toggleAll(){for(var{shownLogLevels:e}=this.state,t=!0,r=0;r<_e.AllLogLevels.length;r+=1){var i=_e.AllLogLevels[r];if(!e[i]){t=!1;break}}if(t)this.setState({shownLogLevels:{}});else{for(var a={},s=0;s<_e.AllLogLevels.length;s+=1){var o=_e.AllLogLevels[s];a[o]=!0}this.setState({shownLogLevels:a})}}toggleLogLevel(e){var{shownLogLevels:t}=this.state,r=t[e],i={};i[e]=!r,this.updateLogLevels(i)}updateLogLevels(e){var{shownLogLevels:t}=this.state;t=Xu(Xu({},t),e),this.setState({shownLogLevels:t})}appendLogText(e){if(this.editor){var t=this.editor.getModel(),r=t==null?void 0:t.getLineCount();z(r);var i=t==null?void 0:t.getLineLength(r);z(i);var a=this.isBottomVisible(),s=[];if(i>0&&(s.push({range:{startLineNumber:r,startColumn:i+1,endLineNumber:r,endColumn:i+1},text:`
|
|
18
|
+
`,forceMoveMarkers:!0}),r+=1,i=0),s.push({range:{startLineNumber:r,startColumn:i,endLineNumber:r,endColumn:i},text:e,forceMoveMarkers:!0}),t==null||t.applyEdits(s),a){var o=t==null?void 0:t.getLineCount();z(o),this.editor.revealLine(o,1)}}}refreshLogText(){if(this.editor){this.truncateLogIfNecessary();for(var{shownLogLevels:e}=this.state,t=this.isBottomVisible(),r="",i=0;i<this.messages.length;i+=1){var a=this.messages[i];if(e[a.logLevel]){var s=_e.getLogText(a);s.length>0&&(r+=s,s.charAt(s.length-1)!==`
|
|
19
|
+
`&&(r+=`
|
|
20
|
+
`))}}if(r=r.trimRight(),this.editor.setValue(r),t){var o,l=(o=this.editor.getModel())===null||o===void 0?void 0:o.getLineCount();z(l),this.editor.revealLine(l,1)}this.stopFlushTimer(),this.bufferedMessages=[]}}truncateLogIfNecessary(){this.messages.length>_e.maxLogSize&&(this.messages=this.messages.splice(this.messages.length-_e.truncateSize))}scrollToBottom(){var e,t,r;if(this.editor){var i=(e=this.editor)===null||e===void 0||(t=e.getModel)===null||t===void 0||(r=t.call(e))===null||r===void 0?void 0:r.getLineCount();z(i),this.editor.revealLine(i,1)}}isBottomVisible(){if(!this.editor)return!0;var e=this.editor.getModel(),t=e==null?void 0:e.getLineCount();return z(t),this.isLineVisible(t)}isLineVisible(e){var t,r=(t=this.editor)===null||t===void 0?void 0:t.getVisibleRanges();if(r==null||r.length===0)return!1;for(var i=0;i<r.length;i+=1){var a=r[i];if(a.startLineNumber<=e&&e<=a.endLineNumber)return!0}return!1}isLogItemVisible(e){var{shownLogLevels:t}=this.state;return t[e.logLevel]}flush(){for(var e="",t=0;t<this.bufferedMessages.length;t+=1){var r=this.bufferedMessages[t],i=_e.getLogText(r);e+=i,i.charAt(i.length-1)!==`
|
|
21
|
+
`&&(e+=`
|
|
22
|
+
`)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,_e.bufferTimeout))}stopFlushTimer(){this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=void 0)}updateDimensions(){this.editor&&this.editor.layout()}handleClearClick(){this.clearLogs()}clearLogs(){this.messages=[],this.refreshLogText()}handleFlushTimeout(){this.stopFlushTimer(),this.flush()}handleLogMessage(e){this.messages.push(e),this.editor&&this.isLogItemVisible(e)&&this.queue(e)}handleMenuItemClick(e){this.toggleLogLevel(e)}handleResetClick(){this.resetLogLevels()}handleResize(){this.updateDimensions()}handleToggleAllClick(){this.toggleAll()}render(){var e={placement:"bottom-end"},{shownLogLevels:t}=this.state,r=this.getMenuActions(t);return u.jsxs("div",{className:"log-pane h-100 w-100",children:[u.jsxs("div",{className:"log-pane-menu",children:[u.jsx(K,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:nb,tooltip:"Clear log"}),u.jsx(K,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:xa,tooltip:"Log Settings",onClick:()=>{},children:u.jsx(gn,{actions:r,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),u.jsx("div",{className:"log-pane-editor h-100 w-100",ref:i=>{this.editorContainer=i}})]})}}ht(_e,"DefaultLogLevels",[$e.STDOUT,$e.ERROR,$e.FATAL,$e.STDERR,$e.WARN]);ht(_e,"AllLogLevels",[$e.INFO,$e.STDOUT,$e.ERROR,$e.FATAL,$e.STDERR,$e.WARN,$e.DEBUG,$e.TRACE]);ht(_e,"bufferTimeout",16);ht(_e,"maxLogSize",131072);ht(_e,"truncateSize",65536);const bD=_e;function Zu(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function CD(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){Zu(a,r,i,s,o,"next",l)}function o(l){Zu(a,r,i,s,o,"throw",l)}s(void 0)})}}var SD=W.module("HeapUsage");function yD(n){var e,{connection:t,defaultUpdateInterval:r,hoverUpdateInterval:i,bgMonitoring:a=!0,monitorDuration:s}=n,o=Tv(),[l,d]=c.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[h,f]=c.useState(!1),v=c.useRef({timestamps:[],usages:[]}),p=ko(),m=c.useCallback(CD(function*(){try{var A=yield t.getWorkerHeapInfo();if(!p.current)return;if(d(A),a||h){for(var k=(A.totalHeapSize-A.freeMemory)/A.maximumHeapSize,V=Date.now(),{timestamps:q,usages:re}=v.current;q.length!==0&&V-q[0]>s*1.5;)q.shift(),re.shift();q.push(V),re.push(k)}else v.current={timestamps:[],usages:[]}}catch(B){SD.warn("Unable to get heap usage",B)}}),[t,p,a,h,s]);cf(m,h?i:r);var b=(A,k)=>Math.round(A*10**k)/10**k,g=2,C=1024**3,{freeMemory:S,totalHeapSize:y,maximumHeapSize:w}=l,E=b(S/C,g),D=b(y/C,g),T=b(w/C,g),O=D-E,M=function(k,V){var q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return u.jsxs("div",{className:Y("heap-usage-info-row",{"heading-bottom-border":q}),children:[u.jsx("div",{className:"font-weight-bold",children:k}),u.jsx("div",{children:V})]})},{timestamps:j,usages:H}=v.current,L=(e=j[j.length-1])!==null&&e!==void 0?e:0,I=y/w,N=(y-S)/w;return u.jsxs("div",{className:"max-memory",children:[u.jsx("div",{className:"total-memory",style:{width:"calc(".concat(I*100,"% - ").concat(I*2,"px")}}),u.jsx("div",{className:Y("used-memory",{"heap-overflow":(y-S)/w>.95}),style:{width:"calc(".concat(N*100,"% - ").concat(N*2,"px")}}),u.jsxs("div",{className:"memory-text",children:[T.toFixed(1)," GB"]}),u.jsx(mt,{onEntered:()=>f(!0),onExited:()=>f(!1),interactive:!0,children:u.jsxs("div",{className:"heap-tooltip",children:[M("In use:","".concat(O.toFixed(g)," of ").concat(T.toFixed(g)," GB"),!0),M("Free:","".concat(E.toFixed(g)," GB")),M("Total:","".concat(D.toFixed(g)," GB")),M("Max:","".concat(T.toFixed(g)," GB")),u.jsx("div",{className:"heap-plot",children:u.jsx(Pv,{data:[{x:[...j],y:[...H],type:"scatter",mode:"lines"}],config:{staticPlot:!0,responsive:!0},style:{width:"196px",height:"100px"},layout:{margin:{l:2,t:2,r:2,b:2},plot_bgcolor:"transparent",paper_bgcolor:"transparent",colorway:["#4878ea"],xaxis:{dtick:Math.round(s/6),gridcolor:o.linecolor,range:[L-s,L],linecolor:o.linecolor,linewidth:2,mirror:!0},yaxis:{dtick:.2,gridcolor:o.linecolor,range:[0,1],linecolor:o.linecolor,linewidth:2,mirror:!0}}})}),u.jsxs("div",{className:"heap-utilisation-text",children:["% utilization over ",Math.round(s/1e3/60)," min."]})]})})]})}function Ip(n,e,t){return e=ED(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ED(n){var e=wD(n,"string");return typeof e=="symbol"?e:String(e)}function wD(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 hr{static valueForCell(e,t,r){var i="".concat(e,",").concat(t);return r!==void 0&&r&&(i="(".concat(i,")")),i}constructor(e){Ip(this,"dh",void 0),this.dh=e}makeColumn(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:hr.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),hr.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=>hr.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]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e9,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:[],a=new this.dh.TreeTable({columns:e,groupedColumns:t,size:r,sort:i});return a.copy=jest.fn(()=>Promise.resolve(a)),a}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 Ub(i,e,t??new ai(i),r)}}Ip(hr,"DEFAULT_TYPE","java.lang.String");const PD=hr;function Mn(n,e,t){return e=_D(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _D(n){var e=TD(n,"string");return typeof e=="symbol"?e:String(e)}function TD(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 Gt=W.module("TableViewportUpdater"),OD=150;class Xt extends c.PureComponent{constructor(){super(...arguments),Mn(this,"subscription",void 0),Mn(this,"getViewportRowRange",se((e,t,r)=>{var i=r-t,a=Math.max(0,t-i*Xt.ROW_BUFFER_PAGES),s=r+i*Xt.ROW_BUFFER_PAGES;return[a,s]})),Mn(this,"getViewportColumns",se((e,t,r,i)=>{if(t==null||r==null)return null;for(var a=r-t,s=Math.max(0,t-a*Xt.COLUMN_BUFFER_PAGES),o=Math.min(r+a*Xt.COLUMN_BUFFER_PAGES,e.columns.length-1),l=[],d=s;d<=o;d+=1){var h=Hb.getModelIndex(d,i);l.push(e.columns[h])}return l})),Mn(this,"updateViewport",mi((e,t,r,i,a)=>{if(t<e){Gt.error("Invalid viewport",e,t);return}if(e===0&&t===0){Gt.debug2("Ignoring 0-0 viewport");return}var{movedColumns:s,table:o}=this.props,[l,d]=this.getViewportRowRange(o,e,t),h=a??this.getViewportColumns(o,r,i,s);if(Gt.debug2("Setting Viewport Top:",l,"Bottom:",d,"Columns:",h),this.subscription==null){Gt.debug2("updateViewport creating new subscription"),this.subscription=o.setViewport(l,d,h);var{onSubscription:f}=this.props;f(this.subscription)}else Gt.debug2("updateViewport using existing subscription"),this.subscription.setViewport(l,d,h)},OD))}componentDidMount(){var{top:e,bottom:t,left:r,right:i,table:a,filters:s,sorts:o,columns:l,customColumns:d}=this.props;a.applyFilter(s),a.applySort(o),a.applyCustomColumns(d),this.updateViewport(e,t,r,i,l)}componentDidUpdate(e){var{top:t,bottom:r,left:i,right:a,table:s,filters:o,sorts:l,customColumns:d,columns:h}=this.props,f=o!==e.filters,v=l!==e.sorts,p=d!==e.customColumns,m=s!==e.table;(f||v||p||m)&&this.closeSubscription(),(f||m)&&(Gt.debug("update table filter",o),s.applyFilter(o)),(v||m)&&(Gt.debug("update table sort",l),s.applySort(l)),(p||m)&&(Gt.debug("update table custom columns",d),s.applyCustomColumns(d)),this.updateViewport(t,r,i,a,h)}componentWillUnmount(){this.closeSubscription()}closeSubscription(){if(Gt.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}}Mn(Xt,"ROW_BUFFER_PAGES",3);Mn(Xt,"COLUMN_BUFFER_PAGES",1);Mn(Xt,"defaultProps",{top:0,bottom:0,left:null,right:null,columns:null,onSubscription:()=>{},filters:[],sorts:[],customColumns:[],movedColumns:[]});const DD=Xt;function Sa(n,e,t){return e=ID(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ID(n){var e=xD(n,"string");return typeof e=="symbol"?e:String(e)}function xD(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 Xn=W.module("TreeTableViewportUpdater"),ND=150;class ya extends c.PureComponent{constructor(e){super(e),Sa(this,"listenerCleanup",void 0),Sa(this,"updateViewport",mi((t,r)=>{if(r<t){Xn.error("Invalid viewport",t,r);return}if(t===0&&r===0){Xn.debug2("Ignoring 0-0 viewport");return}var{table:i,updateInterval:a}=this.props,s=r-t,o=Math.max(0,t-s*3),l=r+s*3+1;if(Xn.debug2("Setting Viewport Top:",o,"Bottom:",l,i),!this.listenerCleanup){var{dh:d,onViewportUpdate:h}=this.props;this.listenerCleanup=i.addEventListener(d.TreeTable.EVENT_UPDATED,h)}i.setViewport(o,l,void 0,a)},ND)),this.listenerCleanup=null}componentDidMount(){var{top:e,bottom:t,table:r,filters:i,sorts:a}=this.props;Xn.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:s}=this.props;a!==e.filters&&(Xn.debug("update table filter",a),i.applyFilter(a)),s!==e.sorts&&(Xn.debug("update table sort",s),i.applySort(s)),this.updateViewport(t,r)}componentWillUnmount(){this.updateViewport.cancel(),this.listenerCleanup&&this.listenerCleanup()}render(){return null}}Sa(ya,"UPDATE_INTERVAL",1e3);Sa(ya,"defaultProps",{top:0,bottom:0,onViewportUpdate:()=>{},filters:[],sorts:[],updateInterval:ya.UPDATE_INTERVAL});const MD=ya,LD=Object.freeze(Object.defineProperty({__proto__:null,AdvancedSettings:Hc,AdvancedSettingsType:Vb,AggregationEdit:yC,AggregationUtils:Bb,Aggregations:EC,BarIcon:wC,ChartBuilder:PC,ColumnHeaderGroup:Wb,CustomColumnBuilder:_C,DownloadServiceWorkerUtils:TC,FormatColumnWhereIcon:OC,FormatRowWhereIcon:DC,HistogramIcon:IC,InputEditor:xC,IrisGrid:gr,IrisGridMetricCalculator:NC,IrisGridModel:zt,IrisGridModelFactory:Ma,IrisGridPartitionedTableModel:Gb,IrisGridRenderer:MC,IrisGridTableModel:Vc,IrisGridTableModelTemplate:zb,IrisGridTestUtils:PD,IrisGridThemeContext:LC,IrisGridThemeProvider:Jc,IrisGridTreeTableModel:Kb,IrisGridUtils:Xe,LineIcon:AC,OptionType:FC,PieIcon:jC,RollupRows:RC,SHORTCUTS:kC,ScatterIcon:$C,TableCsvExporter:UC,TableSaver:HC,TableViewportUpdater:DD,TreeTableViewportUpdater:MD,VisibilityOrderingBuilder:VC,createDefaultIrisGridTheme:BC,default:gr,isIrisGridTableModelTemplate:ta,isPanelStateV1:qb,isPanelStateV2:Yb,isPartitionedGridModel:Xb,isPartitionedGridModelProvider:Zb},Symbol.toStringTag,{value:"Module"}));function Nl(n,e,t){return e=AD(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function AD(n){var e=FD(n,"string");return typeof e=="symbol"?e:String(e)}function FD(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 Ja{}Nl(Ja,"OPEN","ChartEvent.OPEN");Nl(Ja,"CLOSE","ChartEvent.CLOSE");Nl(Ja,"COLUMN_SELECTED","ChartEvent.COLUMN_SELECTED");const Ea=Ja;function Di(n,e,t){return e=jD(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jD(n){var e=RD(n,"string");return typeof e=="symbol"?e:String(e)}function RD(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 Mr{}Di(Mr,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");Di(Mr,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");Di(Mr,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");Di(Mr,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");Di(Mr,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");const vt=Mr;function wn(n,e,t){return e=kD(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function kD(n){var e=$D(n,"string");return typeof e=="symbol"?e:String(e)}function $D(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 en{}wn(en,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");wn(en,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");wn(en,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");wn(en,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");wn(en,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");wn(en,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");wn(en,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");wn(en,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");const Te=en;function Lr(n,e,t){return e=UD(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function UD(n){var e=HD(n,"string");return typeof e=="symbol"?e:String(e)}function HD(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 Bn{}Lr(Bn,"OPEN_GRID","IrisGridEvent.OPEN_GRID");Lr(Bn,"CLOSE_GRID","IrisGridEvent.CLOSE_GRID");Lr(Bn,"DATA_SELECTED","IrisGridEvent.DATA_SELECTED");Lr(Bn,"COLUMN_SELECTED","IrisGridEvent.COLUMN_SELECTED");Lr(Bn,"STATE_CHANGED","IrisGridEvent.STATE_CHANGED");Lr(Bn,"CREATE_CHART","IrisGridevent.CREATE_CHART");const yt=Bn,xp=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function tn(n,e,t){return e=VD(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function VD(n){var e=BD(n,"string");return typeof e=="symbol"?e:String(e)}function BD(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 Ut{}tn(Ut,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");tn(Ut,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");tn(Ut,"CLOSE_FILE","NotebookEvent.closeFile");tn(Ut,"RENAME","NotebookEvent.rename");tn(Ut,"RENAME_FILE","NotebookEvent.renameFile");tn(Ut,"REGISTER_FILE","NotebookEvent.registerFile");tn(Ut,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");tn(Ut,"UNREGISTER_FILE","NotebookEvent.unregisterFile");tn(Ut,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");const he=Ut;function Np(n,e,t){return e=WD(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function WD(n){var e=GD(n,"string");return typeof e=="symbol"?e:String(e)}function GD(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 Ml{}Np(Ml,"OPEN","PandasEvent.OPEN");Np(Ml,"CLOSE","PandasEvent.CLOSE");const zD=Ml;function Ar(n,e,t){return e=KD(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function KD(n){var e=qD(n,"string");return typeof e=="symbol"?e:String(e)}function qD(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 Wn{}Ar(Wn,"focus","TabEvent.focus");Ar(Wn,"blur","TabEvent.blur");Ar(Wn,"openPQObject","TabEvent.openPQObject");Ar(Wn,"openControl","TabEvent.openControl");Ar(Wn,"reload","TabEvent.reload");Ar(Wn,"clearAllFilters","TabEvent.clearAllFilters");const Zr=Wn;function YD(n,e,t){return e=XD(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function XD(n){var e=ZD(n,"string");return typeof e=="symbol"?e:String(e)}function ZD(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 Mp extends c.PureComponent{constructor(e){super(e),this.handleCloseTab=this.handleCloseTab.bind(this),this.handleCloseTabsRight=this.handleCloseTabsRight.bind(this),this.handleCloseTabsAll=this.handleCloseTabsAll.bind(this)}getAllTabs(){var e,t,r,{glContainer:i}=this.props;return[...(e=i==null||(t=i.tab)===null||t===void 0||(r=t.header)===null||r===void 0?void 0:r.tabs)!==null&&e!==void 0?e:[]]}handleCloseTab(){var{glContainer:e}=this.props;e.close()}handleCloseTabsAll(){var e=this.getAllTabs();e.forEach(t=>{var r;return(r=(t==null?void 0:t.contentItem).container)===null||r===void 0?void 0:r.close()})}handleCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),r=t.length-1;r>0;r-=1){var i,a,s,o,l,d,h;if(((i=t[r].contentItem)===null||i===void 0||(a=i.config)===null||a===void 0?void 0:a.id)===((s=e.tab)===null||s===void 0||(o=s.contentItem)===null||o===void 0||(l=o.config)===null||l===void 0?void 0:l.id))break;(d=((h=t[r])===null||h===void 0?void 0:h.contentItem).container)===null||d===void 0||d.close()}}canCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),r=!0,i=t.length-1;i>0;i-=1){var a,s,o,l,d,h,f,v;if(((a=t[i].contentItem)===null||a===void 0||(s=a.config)===null||s===void 0?void 0:s.id)===((o=e.tab)===null||o===void 0||(l=o.contentItem)===null||l===void 0||(d=l.config)===null||d===void 0?void 0:d.id))break;var p=!!(!((h=t[i])===null||h===void 0||(f=h.contentItem)===null||f===void 0||(v=f.config)===null||v===void 0)&&v.isClosable);if(p){r=!1;break}}return r}canCloseAny(){for(var e=this.getAllTabs(),t=!0,r=e.length-1;r>0;r-=1){var i,a,s,o=!!(!((i=e[r])===null||i===void 0||(a=i.contentItem)===null||a===void 0||(s=a.config)===null||s===void 0)&&s.isClosable);if(o){t=!1;break}}return t}render(){var e,t,r,{additionalActions:i,glContainer:a}=this.props,s=[...i],o=(e=a.tab)===null||e===void 0||(t=e.contentItem)===null||t===void 0||(r=t.config)===null||r===void 0?void 0:r.isClosable;return s.push({title:"Close",order:10,group:ae.groups.low,action:this.handleCloseTab,disabled:o===void 0||!o}),s.push(()=>({title:"Close Tabs to Right",order:20,group:ae.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),s.push(()=>({title:"Close All",order:30,group:ae.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),u.jsx(ae,{actions:s})}}YD(Mp,"defaultProps",{additionalActions:[]});const QD=Mp;function Lp(n,e,t){return e=JD(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function JD(n){var e=eI(n,"string");return typeof e=="symbol"?e:String(e)}function eI(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 Ap extends c.PureComponent{constructor(e){super(e),Lp(this,"renameInputRef",void 0),this.handleRenameDialogOpened=this.handleRenameDialogOpened.bind(this),this.handleRenameInputChange=this.handleRenameInputChange.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.renameInputRef=X.createRef();var{value:t}=e;this.state={value:t,valueWasValidated:!1}}componentDidUpdate(e){var{isShown:t}=e,{isShown:r}=this.props;r&&!t&&this.resetState()}resetState(){var{value:e}=this.props;this.setState({value:e,valueWasValidated:!1})}handleRenameDialogOpened(){var e,t;(e=this.renameInputRef)===null||e===void 0||(t=e.current)===null||t===void 0||t.focus()}handleRenameInputChange(e){this.setState({value:e.target.value})}handleRenameCancel(){var{onCancel:e}=this.props;e()}handleRenameSubmit(e){e.stopPropagation(),e.preventDefault();var{value:t}=this.state,r=t==null?void 0:t.trim();if(r!==void 0&&r!==""){var{onSubmit:i}=this.props;i(r)}else this.setState({value:r,valueWasValidated:!0})}renderRenameDialog(){var{isShared:e,isOwner:t,itemType:r}=this.props,{value:i,valueWasValidated:a}=this.state;return u.jsxs("form",{className:Y("p-3",{"was-validated":a}),onSubmit:this.handleRenameSubmit,noValidate:!0,role:"presentation",onMouseDown:s=>{s.stopPropagation()},onMouseUp:s=>{s.stopPropagation()},children:[u.jsxs("div",{className:"form-group",children:[u.jsxs("label",{htmlFor:"rename-dialog-".concat(r,"-input"),children:["Rename ",r]}),u.jsx("input",{type:"text",className:"form-control",id:"rename-dialog-".concat(r,"-input"),value:i??void 0,ref:this.renameInputRef,onChange:this.handleRenameInputChange,required:!0}),u.jsxs("div",{className:"invalid-feedback",children:[r," name cannot be empty"]}),(e||!t)&&u.jsxs("div",{className:"pt-2",children:["Renaming this ",r," will rename for all users."]})]}),u.jsxs("div",{className:"text-right",children:[u.jsx(K,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),u.jsx(K,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var{isShown:e,onCancel:t}=this.props;return u.jsx(La,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}Lp(Ap,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});function po(n,e,t){return e=tI(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tI(n){var e=nI(n,"string");return typeof e=="symbol"?e:String(e)}function nI(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 rI=W.module("Panel");let Fp=class extends c.PureComponent{constructor(e){super(e),po(this,"ref",void 0),po(this,"getAdditionActions",se((r,i,a)=>{var s=[];return i&&s.push(this.getCloneAction()),a&&s.push(this.getRenameAction()),[...s,...r]})),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleCopyPanel=this.handleCopyPanel.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleHide=this.handleHide.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleBeforeShow=this.handleBeforeShow.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.handleShowRenameDialog=this.handleShowRenameDialog.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleTab=this.handleTab.bind(this),this.ref=X.createRef();var{glContainer:t}=this.props;this.state={title:F.getTitleFromContainer(t),showRenameDialog:!1,isWithinPanel:!0}}componentDidMount(){var e,t,{componentPanel:r,glContainer:i,glEventHub:a}=this.props;i.on("resize",this.handleResize),i.on("show",this.handleBeforeShow),i.on("shown",this.handleShow),i.on("hide",this.handleHide),i.on("tab",this.handleTab),i.on("tabClicked",this.handleTabClicked),a.on(vt.SESSION_CLOSED,this.handleSessionClosed),a.on(vt.SESSION_OPENED,this.handleSessionOpened),a.on(Zr.focus,this.handleTabFocus),a.on(Zr.blur,this.handleTabBlur),a.on(Te.CLEAR_ALL_FILTERS,this.handleClearAllFilters),a.emit(te.MOUNT,r??this),this.setState({isWithinPanel:((e=this.ref.current)===null||e===void 0||(t=e.parentElement)===null||t===void 0?void 0:t.closest(".dh-panel"))!=null})}componentWillUnmount(){var{componentPanel:e,glContainer:t,glEventHub:r}=this.props;t.off("resize",this.handleResize),t.off("show",this.handleBeforeShow),t.off("shown",this.handleShow),t.off("hide",this.handleHide),t.off("tab",this.handleTab),t.off("tabClicked",this.handleTabClicked),r.off(vt.SESSION_CLOSED,this.handleSessionClosed),r.off(vt.SESSION_OPENED,this.handleSessionOpened),r.off(Zr.focus,this.handleTabFocus),r.off(Zr.blur,this.handleTabBlur),r.off(Te.CLEAR_ALL_FILTERS,this.handleClearAllFilters),r.emit(te.UNMOUNT,e??this)}handleTab(e){e!=null&&this.setState({title:F.getTitleFromTab(e)}),this.forceUpdate();var{onTab:t}=this.props;t(e)}handleTabClicked(e){var{onTabClicked:t}=this.props;t(e)}handleClearAllFilters(){var{onClearAllFilters:e}=this.props;e(...arguments)}handleFocus(e){var{componentPanel:t,glEventHub:r}=this.props;r.emit(te.FOCUS,t??this);var{onFocus:i}=this.props;i(e)}handleBlur(e){var{onBlur:t}=this.props;t(e)}handleHide(){var{onHide:e}=this.props;e(...arguments)}handleResize(){var{onResize:e}=this.props;e(...arguments)}handleSessionClosed(e){var{onSessionClose:t}=this.props;t(e)}handleSessionOpened(e,t){var{onSessionOpen:r}=this.props;r(e,t)}handleBeforeShow(){var{onBeforeShow:e}=this.props;e(...arguments)}handleShow(){var{onShow:e}=this.props;e(...arguments)}handleTabBlur(){var{onTabBlur:e}=this.props;e(...arguments)}handleTabFocus(){var{onTabFocus:e}=this.props;e(...arguments)}handleRenameCancel(){this.setState({showRenameDialog:!1})}handleShowRenameDialog(){this.setState({showRenameDialog:!0})}handleRenameSubmit(e){var{glContainer:t}=this.props;this.setState({showRenameDialog:!1,title:e});var r=F.getRootFromContainer(t),i=F.getComponentConfigFromContainer(t);z(i),F.renameComponent(r,i,e)}handleCopyPanel(){var{glContainer:e,glEventHub:t}=this.props,r=F.getRootFromContainer(e),i=F.getComponentConfigFromContainer(e);if(i==null){rI.error("Could not get component config from container",e);return}var a=F.cloneComponent(r,i);a!==null&&t.emit(te.CLONED,this,a)}getCloneAction(){return{title:"Copy Panel",order:10,group:ae.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:ae.groups.medium,action:this.handleShowRenameDialog}}render(){var{children:e,className:t,renderTabTooltip:r,glContainer:i,additionalActions:a,errorMessage:s,isLoaded:o,isLoading:l,isClonable:d,isRenamable:h}=this.props,{tab:f}=i,{showRenameDialog:v,title:p,isWithinPanel:m}=this.state;return u.jsxs("div",{className:Y("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,u.jsx(Ne,{errorMessage:s,isLoaded:o,isLoading:l}),!m&&f!=null&&Ta.createPortal(u.jsxs(u.Fragment,{children:[u.jsx(QD,{glContainer:i,additionalActions:this.getAdditionActions(a,d,h)}),h&&u.jsx(Ap,{isShown:v,value:p,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),r!=null&&u.jsx(mt,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:r()})]}),f.element[0])]})}};po(Fp,"defaultProps",{className:"",onTab:()=>{},onTabClicked:()=>{},onClearAllFilters:()=>{},onFocus:()=>{},onBlur:()=>{},onHide:()=>{},onResize:()=>{},onSessionClose:()=>{},onSessionOpen:()=>{},onBeforeShow:()=>{},onShow:()=>{},onTabBlur:()=>{},onTabFocus:()=>{},renderTabTooltip:null,additionalActions:[],errorMessage:null,isLoading:!1,isLoaded:!0,isClonable:!1,isRenamable:!1});const Ht=Fp;function Ii(n){var{widgetType:e,widgetName:t,glContainer:r,description:i,children:a}=n,s=F.getTitleFromContainer(r);return u.jsxs("div",{className:"tab-tooltip-grid-container",children:[u.jsxs("span",{className:"tab-tooltip-title",children:[e," Name"]}),u.jsxs("div",{className:"tab-tooltip-name-wrapper",children:[u.jsx("span",{className:"tab-tooltip-name",children:t}),u.jsx(zc,{className:"tab-tooltip-copy",tooltip:"Copy name",copy:t})]}),t!==s&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"tab-tooltip-title",children:"Display Name"}),u.jsx("span",{className:"tab-tooltip-name",children:s})]}),i&&u.jsx("div",{className:"tab-tooltip-description",children:i}),a]})}Ii.propTypes={glContainer:qa.Container.isRequired,widgetType:_.string,widgetName:_.string,description:_.string,children:_.node};Ii.defaultProps={widgetType:"",widgetName:"",description:null,children:null};function jp(n,e,t){return e=iI(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function iI(n){var e=aI(n,"string");return typeof e=="symbol"?e:String(e)}function aI(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 Rp extends c.PureComponent{constructor(e){super(e),jp(this,"getCachedRenderTabTooltip",se((t,r,i,a,s)=>t?()=>u.jsx(Ii,{glContainer:r,widgetType:i,widgetName:a,description:s}):null)),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleCopyName=this.handleCopyName.bind(this),this.state={isClientDisconnected:!1,isPanelDisconnected:!1,isWidgetDisconnected:!1,isWaitingForReconnect:!1,isPanelInactive:!1}}handleCopyName(){var{widgetName:e}=this.props;Qc(e)}getErrorMessage(){var{errorMessage:e}=this.props,{isClientDisconnected:t,isPanelDisconnected:r,isWidgetDisconnected:i,isWaitingForReconnect:a}=this.state;if(e)return"".concat(e);if(t&&r&&a)return`Disconnected from server.
|
|
23
|
+
Check your internet connection.`;if(t&&r)return"Disconnected from server.";if(r){var{widgetName:s,widgetType:o}=this.props;return'Variable "'.concat(s,`" not set.
|
|
24
|
+
`).concat(o," does not exist yet.")}if(i){var{widgetName:l}=this.props;return"".concat(l," is unavailable.")}}handleSessionClosed(){var{onSessionClose:e}=this.props;this.setState({isPanelDisconnected:!0,isWaitingForReconnect:!1}),e(...arguments)}handleSessionOpened(){var{onSessionOpen:e}=this.props;e(...arguments)}render(){var{children:e,className:t,componentPanel:r,isLoaded:i,isLoading:a,glContainer:s,glEventHub:o,isDisconnected:l,isClonable:d,isRenamable:h,showTabTooltip:f,renderTabTooltip:v,widgetType:p,widgetName:m,description:b,onClearAllFilters:g,onHide:C,onFocus:S,onBlur:y,onResize:w,onShow:E,onTabBlur:D,onTabFocus:T,onTabClicked:O}=this.props,{isPanelDisconnected:M,isWidgetDisconnected:j,isPanelInactive:H}=this.state,L=this.getErrorMessage(),I=v??this.getCachedRenderTabTooltip(f,s,p,m,b),N=[{title:"Copy ".concat(p," Name"),group:ae.groups.medium,order:20,action:this.handleCopyName}];return u.jsxs(Ht,{className:Y(t,{disconnected:M||j||l,inactive:H}),componentPanel:r,glContainer:s,glEventHub:o,onClearAllFilters:g,onHide:C,onFocus:S,onBlur:y,onResize:w,onShow:E,onSessionClose:this.handleSessionClosed,onSessionOpen:this.handleSessionOpened,onTabBlur:D,onTabFocus:T,onTabClicked:O,renderTabTooltip:I,errorMessage:L,isLoaded:i,isLoading:a,isClonable:d,isRenamable:h,additionalActions:N,children:[e,H&&u.jsx("div",{className:"fill-parent-absolute"})]})}}jp(Rp,"defaultProps",{className:"",errorMessage:null,isClonable:!0,isDisconnected:!1,isLoading:!1,isLoaded:!0,isRenamable:!0,showTabTooltip:!0,widgetName:"Widget",widgetType:"Widget",renderTabTooltip:null,description:"",onFocus:()=>{},onBlur:()=>{},onHide:()=>{},onClearAllFilters:()=>{},onResize:()=>{},onSessionClose:()=>{},onSessionOpen:()=>{},onShow:()=>{},onTabBlur:()=>{},onTabFocus:()=>{},onTabClicked:()=>{}});const xi=Rp,It=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var sI=Object.freeze({}),oI=new Map,es=Object.freeze([]),Ll=(n,e)=>{var t;return(t=Be(n,e).columns)!==null&&t!==void 0?t:es},kp=(n,e)=>{var t;return(t=Be(n,e).filterSets)!==null&&t!==void 0?t:es},ts=(n,e)=>{var t;return(t=Be(n,e).filters)!==null&&t!==void 0?t:es},ns=(n,e)=>{var t;return(t=Be(n,e).tableMap)!==null&&t!==void 0?t:oI},rs=(n,e)=>Be(n,e).isolatedLinkerPanelId,Gn=(n,e)=>{var t;return(t=Be(n,e).links)!==null&&t!==void 0?t:es},is=(n,e)=>Be(n,e).columnSelectionValidator,lI=(n,e)=>{var t;return(t=Be(n,e).consoleSettings)!==null&&t!==void 0?t:sI},dI=(n,e)=>Be(n,e).connection,Fr=(n,e)=>Be(n,e).sessionWrapper,uI=(n,e)=>t=>t(Mt(n,{connection:e})),hI=(n,e)=>t=>t(Mt(n,{sessionWrapper:e})),as=(n,e)=>t=>t(Mt(n,{links:e})),$p=(n,e)=>(t,r)=>{var i=Gn(r(),n),a=e.filter(s=>i.findIndex(o=>mr(o.start,s.start)&&mr(o.end,s.end))<0);return t(as(n,i.concat(a)))},Up=(n,e)=>(t,r)=>{var i=Gn(r(),n),a=i.filter(s=>!e.includes(s.id));return t(as(n,a))},Al=(n,e)=>t=>t(Mt(n,{isolatedLinkerPanelId:e})),Hp=(n,e)=>t=>t(Mt(n,{columnSelectionValidator:e})),Vp=(n,e)=>t=>t(Mt(n,{consoleSettings:e})),Bp=(n,e)=>t=>t(Mt(n,{filterSets:e}));function Wp(n){var{columnMap:e,inputFilterMap:t,linkedColumnMap:r,onAdd:i,onOpenLinker:a,waitingFilterMap:s,waitingInputMap:o}=n,l=c.useMemo(()=>{var m=Array.from(o.keys()),b=m.find(S=>t.get(S)!=null),g=m.find(S=>r.get(S)!=null),C=_t.join(m.map(S=>'"'.concat(S,'"')));return b!=null&&b&&g!=null&&g?"Use a filter control or linked table to set a value for ".concat(C):b!=null&&b?"Set a filter control value for ".concat(C):"Double click a row in a linked table to set a value for ".concat(C)},[t,r,o]),d=c.useMemo(()=>Array.from(e.values()),[e]),h=c.useCallback(m=>{m.stopPropagation(),m.preventDefault(),i(Array.from(s.values()))},[i,s]),f=c.useCallback(m=>{m.stopPropagation(),m.preventDefault(),a()},[a]),v=s.size>0,p=!v&&o.size>0;return u.jsx("div",{className:"chart-panel-overlay chart-filter-overlay",children:u.jsxs("div",{className:Y("chart-panel-overlay-content chart-filter-overlay-content",{"chart-filter-waiting-filter":v},{"chart-filter-waiting-input":p}),children:[v&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"info-message",children:"This plot requires a filter control to be added to the layout or a table link to be created on the following columns:"}),u.jsx("div",{className:"waiting-filter-list",children:d.map(m=>{var b=s.has(m.name),g=b?xo:rb;return u.jsxs("div",{className:Y("waiting-filter-item",{"is-invalid":b}),children:[u.jsx(ne,{icon:g}),m.name]},m.name)})}),u.jsxs("div",{children:[u.jsx(Us,{onClick:h,className:"btn-primary",children:"Add Input Filters"}),u.jsx(Us,{onClick:f,className:"btn-primary",children:"Open Linker Tool"})]})]}),p&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"info-message",children:"Waiting for User Input"}),u.jsx("div",{className:"",children:l})]})]})})}Wp.propTypes={columnMap:_.instanceOf(Map).isRequired,inputFilterMap:_.instanceOf(Map).isRequired,linkedColumnMap:_.instanceOf(Map).isRequired,onAdd:_.func.isRequired,onOpenLinker:_.func.isRequired,waitingFilterMap:_.instanceOf(Map).isRequired,waitingInputMap:_.instanceOf(Map).isRequired};function ci(n){var{columns:e,onColumnSelected:t,onMouseEnter:r,onMouseLeave:i}=n;return u.jsx("div",{className:"chart-panel-overlay chart-column-selector-overlay",children:u.jsxs("div",{className:Y("chart-panel-overlay-content"),children:[u.jsx("div",{className:"info-message",children:"This plot requires a filter control to be added to the layout or a table link to be created on the following columns:"}),u.jsx("div",{className:"waiting-column-select-list",children:e.map(a=>u.jsx(Vo,{className:Y("btn-chart-column-selector",ci.makeButtonClassName(a.name)),onClick:()=>t(a.name),onMouseEnter:()=>{r&&r(a)},onMouseLeave:i,disabled:!a.isValid,isLinked:a.isActive,children:a.name},a.name))})]})})}ci.makeButtonClassName=n=>"btn-chart-column-selector-".concat(n);ci.defaultProps={onMouseEnter:()=>{},onMouseLeave:()=>{}};function cr(n){return n.settings!==void 0}function Fl(n){return n.figure!==void 0}function Gp(n){if(n==null)return!1;var{settings:e,tableSettings:t}=n;return typeof e=="object"&&typeof t=="object"}function zp(n){return n!=null&&Gp(n.panelState)}function Qu(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 Ju(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qu(Object(t),!0).forEach(function(r){Tt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Qu(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Tt(n,e,t){return e=cI(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cI(n){var e=fI(n,"string");return typeof e=="symbol"?e:String(e)}function fI(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 rt=W.module("ChartPanel"),vI=150;function pI(n){return n.inputFilters!=null}function mI(n){return n.panelState!=null}class ss extends c.Component{constructor(e){super(e),Tt(this,"panelContainer",void 0),Tt(this,"pending",void 0),Tt(this,"getWaitingInputMap",se((s,o,l)=>{if(!s)return new Map;var d=new Map(o);return l.forEach((h,f)=>{d.delete(f)}),d})),Tt(this,"getWaitingFilterMap",se((s,o,l,d,h)=>{if(!s)return new Map;var f=new Map(o);return l.forEach((v,p)=>{f.delete(p)}),h.forEach((v,p)=>{f.delete(p)}),d.forEach((v,p)=>{f.delete(p)}),f})),Tt(this,"getInputFilterColumnMap",se((s,o)=>{for(var l=new Map,d=0;d<o.length;d+=1){var h=o[d],{name:f,type:v}=h,p=s.get(f);p!=null&&p.type===v&&l.set(f,h)}return l})),Tt(this,"getLinkedColumnMap",se((s,o)=>{for(var l=new Map,d=F.getIdFromPanel(this),h=0;h<o.length;h+=1){var f=o[h],v=null;if(f.start!=null&&f.start.panelId===d&&s.has(f.start.columnName)?v=f.start.columnName:f.end&&f.end.panelId===d&&s.has(f.end.columnName)&&(v=f.end.columnName),v!=null&&s.has(v)){var p=s.get(v);z(p),l.set(v,p)}}return l})),Tt(this,"getSelectorColumns",se((s,o,l)=>Array.from(s.values()).map(d=>({name:d.name,type:d.type,isValid:l?l(this,d):!1,isActive:o.has(d.name)})))),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleColumnMouseEnter=this.handleColumnMouseEnter.bind(this),this.handleColumnMouseLeave=this.handleColumnMouseLeave.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleFilterAdd=this.handleFilterAdd.bind(this),this.handleHide=this.handleHide.bind(this),this.handleError=this.handleError.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleSettingsChanged=this.handleSettingsChanged.bind(this),this.handleOpenLinker=this.handleOpenLinker.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSourceColumnChange=this.handleSourceColumnChange.bind(this),this.handleSourceFilterChange=this.handleSourceFilterChange.bind(this),this.handleSourceSortChange=this.handleSourceSortChange.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleUpdate=this.handleUpdate.bind(this),this.updateModelFromSource=Le(this.updateModelFromSource.bind(this),vI),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.panelContainer=X.createRef(),this.pending=new Sn;var{metadata:t,panelState:r}=e,{filterValueMap:i=[],settings:a={}}=r??{};this.state={settings:a,error:void 0,isActive:!1,isDisconnected:!1,isLoading:!1,isLoaded:!1,isLinked:t!=null&&cr(t)&&t.settings.isLinked,filterMap:new Map(i),filterValueMap:new Map(i),model:void 0,columnMap:new Map,panelState:r}}componentDidMount(){this.isHidden()||(this.setState({isActive:!0}),this.initModel())}componentDidUpdate(e,t){var{inputFilters:r,source:i,makeModel:a}=this.props,{columnMap:s,model:o,filterMap:l,filterValueMap:d,isLinked:h,settings:f}=this.state;o&&(a!==e.makeModel&&this.initModel(),s!==t.columnMap&&this.pruneFilterMaps(),r!==e.inputFilters&&this.updateChangedInputFilters(r,e.inputFilters),l!==t.filterMap?this.updateFilters():d!==t.filterValueMap&&this.updatePanelState(),f!==t.settings&&no(o)&&(o.updateSettings(f),this.updatePanelState()),h!==t.isLinked?i&&(h?(this.startListeningToSource(i),this.updateModelFromSource()):this.stopListeningToSource(i)):h&&i!==e.source&&(e.source&&this.stopListeningToSource(e.source),i&&(this.startListeningToSource(i),this.updateModelFromSource())))}componentWillUnmount(){this.pending.cancel();var{model:e}=this.state,{source:t}=this.props;e!=null&&t&&this.stopListeningToSource(t)}initModel(){this.setState({isLoading:!0,isLoaded:!1,error:void 0});var{makeModel:e}=this.props;this.pending.add(e(),t=>{t.close()}).then(this.handleLoadSuccess,this.handleLoadError)}startListeningToSource(e){rt.debug("startListeningToSource",e);var{model:t}=this.state;z(t);var{dh:r}=t;e.addEventListener(r.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleSourceColumnChange),e.addEventListener(r.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.addEventListener(r.Table.EVENT_SORTCHANGED,this.handleSourceSortChange)}stopListeningToSource(e){rt.debug("stopListeningToSource",e);var{model:t}=this.state;z(t);var{dh:r}=t;e.removeEventListener(r.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleSourceColumnChange),e.removeEventListener(r.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.removeEventListener(r.Table.EVENT_SORTCHANGED,this.handleSourceSortChange)}loadModelIfNecessary(){var{isActive:e,isLoaded:t,isLoading:r}=this.state;e&&!t&&!r&&this.initModel()}isHidden(){var{glContainer:e}=this.props,{isHidden:t}=e;return t}handleColumnSelected(e){var{glEventHub:t}=this.props,{columnMap:r}=this.state;t.emit(Ea.COLUMN_SELECTED,this,r.get(e))}handleColumnMouseEnter(e){var{type:t,name:r}=e,{columnSelectionValidator:i}=this.props;rt.debug("handleColumnMouseEnter",i,t,r),i&&i(this,{type:t,name:r})}handleColumnMouseLeave(){var{columnSelectionValidator:e}=this.props;rt.debug("handleColumnMouseLeave",e),e&&e(this,void 0)}handleDisconnect(){this.setState({error:new Error("Figure disconnected"),isDisconnected:!0})}handleFilterAdd(e){for(var t=0;t<e.length;t+=1)this.openInputFilter(e[t])}handleOpenLinker(){var{localDashboardId:e,setActiveTool:t,setDashboardIsolatedLinkerPanelId:r}=this.props;r(e,void 0),t(It.LINKER)}handleReconnect(){this.setState({isDisconnected:!1,error:void 0}),this.sendColumnChange(),this.updateColumnFilters()}handleLoadSuccess(e){rt.debug("handleLoadSuccess");var{model:t}=this.state;this.setState({model:e,isLoaded:!0},()=>{var{inputFilters:r,source:i}=this.props,{filterMap:a,isLinked:s}=this.state;e!==t&&(this.sendColumnChange(),this.updateColumnFilters(),this.updateInputFilters(r,a.size>0||e.isFilterRequired()),i&&s&&(this.startListeningToSource(i),this.updateModelFromSource()))})}handleLoadError(e){Se.isCanceled(e)||(rt.error("handleLoadError",e),this.setState({error:e,isLoading:!1}))}handleSourceColumnChange(){this.updateModelFromSource()}handleSourceFilterChange(){this.updateModelFromSource()}handleSourceSortChange(){this.updateModelFromSource()}updateModelFromSource(){var{metadata:e,source:t}=this.props,{isLinked:r,model:i}=this.state;if(!r||!i||!t){rt.debug2("updateModelFromSource ignoring",r,i,t);return}var{dh:a}=i;if(this.pending.cancel(),cr(e)){var{settings:s}=e;this.pending.add(a.plot.Figure.create(new Re(a).makeFigureSettings(s,t))).then(o=>{no(i)&&i.setFigure(o)}).catch(this.handleLoadError)}this.updatePanelState()}updatePanelState(){var{sourcePanel:e}=this.props,{panelState:t,filterValueMap:r,settings:i}=this.state,{tableSettings:a}=t??{};if(e&&pI(e.props)&&mI(e.state)){var{inputFilters:s}=e.props,{panelState:o}=e.state;o!=null&&(a=Xe.extractTableSettings(o,s))}this.setState({panelState:{settings:i,tableSettings:a,filterValueMap:Array.from(r)}})}handleError(){this.setState({isLoading:!1})}handleSettingsChanged(e){this.setState(t=>{var{settings:r}=t,i=Ju(Ju({},r),e);return rt.debug("Updated settings",i),{settings:i}})}handleHide(){this.setActive(!1)}handleShow(){this.setActive(!0)}handleTabBlur(){this.setActive(!1)}handleTabFocus(){var e=this.isHidden();this.setActive(!e)}handleUpdate(e){var{isLoading:t}=e;this.setState({isLoading:t})}handleClearAllFilters(){this.setState({filterValueMap:new Map,filterMap:new Map}),this.updatePanelState()}openInputFilter(e){var{glEventHub:t}=this.props,{name:r,type:i}=e;t.emit(Te.OPEN_INPUT,{title:"".concat(r," Filter"),panelState:{name:r,type:i,isValueShown:!0},createNewStack:!0,focusElement:"input"})}setActive(e){this.setState({isActive:e},()=>{e&&this.loadModelIfNecessary()})}sendColumnChange(){var{model:e}=this.state;if(e){var{glEventHub:t}=this.props;t.emit(Te.COLUMNS_CHANGED,this,Array.from(e.getFilterColumnMap().values()))}}getCoordinateForColumn(e){var t,r=ci.makeButtonClassName(e);if(!this.panelContainer.current)return null;var i=this.panelContainer.current.querySelector(".".concat(r)),a=(t=i==null?void 0:i.getBoundingClientRect())!==null&&t!==void 0?t:null;if(a==null||a.width<=0||a.height<=0)return null;var s=a.left+a.width/2,o=a.bottom;return[s,o]}setFilterMap(e){rt.debug("setFilterMap",e),this.setState(t=>{var r,{columnMap:i,filterMap:a}=t,s=null,o=new Map(t.filterValueMap);return e.forEach((l,d)=>{var{columnType:h,filterList:f}=l,v=i.get(d);if(!(v==null||v.type!==h)){if(f.length<1){rt.debug("Ignoring empty filterList for column",d);return}var{value:p}=f[0];o.set(d,p),a.get(d)!==p&&(s===null&&(s=new Map(a)),s.set(d,p))}}),{filterValueMap:o,filterMap:(r=s)!==null&&r!==void 0?r:a}})}unsetFilterValue(e){this.setState(t=>{var{inputFilters:r}=this.props,{columnMap:i}=t,{filterMap:a,filterValueMap:s}=t;if(!s.has(e))return null;s=new Map(t.filterValueMap),s.delete(e);var o=this.getInputFilterColumnMap(i,r);if(o.has(e)){var l,d=a.get(e),h=(l=o.get(e))===null||l===void 0?void 0:l.value;h!=null&&d!==h&&(a=new Map(t.filterMap),h.length>0?a.set(e,h):a.delete(e))}else a=new Map(t.filterMap),a.delete(e);return{filterMap:a,filterValueMap:s}})}updateChangedInputFilters(e,t){var r=t.filter(a=>e.find(s=>s.name===a.name&&s.type===a.type)===void 0);r.length>0&&this.deleteInputFilters(r);var i=e.filter(a=>!t.includes(a));i.length>0&&this.updateInputFilters(i)}updateInputFilters(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.setState(r=>{for(var{columnMap:i}=r,a=new Map(r.filterValueMap),s=new Map(r.filterMap),o=t?{filterMap:s,filterValueMap:a}:{},l=0;l<e.length;l+=1){var{name:d,type:h,value:f}=e[l],v=i.get(d);v!=null&&v.type===h&&(f!=null&&s.get(d)!==f&&(f===""?s.delete(d):s.set(d,f),o.filterMap=s),a.has(d)&&(a.delete(d),o.filterValueMap=a))}return rt.debug("updateInputFilters",o),o})}deleteInputFilters(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.setState(r=>{for(var{columnMap:i,filterValueMap:a}=r,s=new Map(r.filterMap),o=t,l=0;l<e.length;l+=1){var{name:d,type:h}=e[l],f=i.get(d);if(f!=null&&f.type===h&&s.has(d)){var v=s.get(d);if(a.has(d)){var p=a.get(d);p!==v&&p!=null&&(o=!0,s.set(d,p))}else o=!0,s.delete(d)}}return rt.debug("deleteInputFilters",o),o?{filterMap:s}:null})}updateColumnFilters(){this.setState(e=>{var{model:t}=e;return t?{columnMap:t.getFilterColumnMap()}:null})}updateFilters(){var{columnMap:e,filterMap:t,model:r}=this.state;z(r);var i=this.getWaitingInputMap(r.isFilterRequired(),e,t);if(r.setFilter(t),t.size>0&&i.size===0){var a=r.getDefaultTitle(),s=_t.join(Array.from(t.entries()).map(o=>{var[l,d]=o;return"".concat(l,": ").concat(d)}));a?r.setTitle("".concat(a,'<br><span style="font-size: smaller">').concat(s,"</span>")):r.setTitle(s),rt.debug2("updateFilters filters set",t),this.setState({isLoading:!0})}else rt.debug2("updateFilters waiting on inputs",i),r.setTitle(r.getDefaultTitle()),this.setState({isLoading:!1});this.updatePanelState()}pruneFilterMaps(){this.setState(e=>{var{columnMap:t}=e,r=new Map(e.filterMap),i=new Map(e.filterValueMap),a={};return e.filterValueMap.forEach((s,o)=>{t.has(o)||(i.delete(o),a.filterValueMap=i)}),e.filterMap.forEach((s,o)=>{t.has(o)||(r.delete(o),a.filterMap=r)}),a})}render(){var e,{columnSelectionValidator:t,glContainer:r,glEventHub:i,inputFilters:a,isLinkerActive:s,links:o,metadata:l,settings:d,Plotly:h,containerRef:f}=this.props,{columnMap:v,filterMap:p,error:m,model:b,isActive:g,isDisconnected:C,isLoaded:S,isLoading:y}=this.state,w;cr(l)?w=l.table:Fl(l)?w=l.figure:w=l.name;var E=this.getInputFilterColumnMap(v,a),D=this.getLinkedColumnMap(v,o),T=b!=null?this.getWaitingInputMap(b.isFilterRequired(),v,p):new Map,O=b!=null?this.getWaitingFilterMap(b.isFilterRequired(),v,p,D,E):new Map,M=m!=null?"Unable to open chart. ".concat(m):void 0,j=T.size>0,H=v.size>0&&s;return u.jsx(xi,{className:Y("iris-chart-panel",{"input-required":j}),componentPanel:this,glContainer:r,glEventHub:i,onHide:this.handleHide,onClearAllFilters:this.handleClearAllFilters,onShow:this.handleShow,onTabBlur:this.handleTabBlur,onTabFocus:this.handleTabFocus,errorMessage:M,isDisconnected:C,isLoading:y,isLoaded:S,widgetName:(e=w)!==null&&e!==void 0?e:void 0,widgetType:"Chart",children:u.jsxs("div",{ref:this.panelContainer,className:"chart-panel-container h-100 w-100",children:[u.jsx("div",{className:"chart-container h-100 w-100",children:S&&b&&u.jsx(hl,{isActive:g,model:b,settings:d,onDisconnect:this.handleDisconnect,onReconnect:this.handleReconnect,onUpdate:this.handleUpdate,onError:this.handleError,onSettingsChanged:this.handleSettingsChanged,Plotly:h,containerRef:f})}),u.jsx(Fn,{in:j&&!H&&!y,timeout:jn.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:u.jsx(Wp,{inputFilterMap:E,linkedColumnMap:D,onAdd:this.handleFilterAdd,onOpenLinker:this.handleOpenLinker,columnMap:v,waitingFilterMap:O,waitingInputMap:T})}),u.jsx(Fn,{in:H,timeout:jn.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:u.jsx(ci,{columns:this.getSelectorColumns(v,D,t),onColumnSelected:this.handleColumnSelected,onMouseEnter:this.handleColumnMouseEnter,onMouseLeave:this.handleColumnMouseLeave})})]})})}}Tt(ss,"defaultProps",{columnSelectionValidator:null,isLinkerActive:!1,source:null,sourcePanel:null,panelState:null,settings:{},containerRef:null});Tt(ss,"displayName","ChartPanel");Tt(ss,"COMPONENT","ChartPanel");var gI=(n,e)=>{var{localDashboardId:t,metadata:r}=e,i;r!=null&&cr(r)&&(i=r.sourcePanelId);var a=ns(n,t),s=_l(n,t),o=wl(n),l=rs(n,t),d=o===It.LINKER&&l===void 0;return{columnSelectionValidator:is(n,t),isLinkerActive:d,inputFilters:ts(n,t),links:Gn(n,t),source:i!=null?a.get(i):void 0,sourcePanel:i!=null?s.get(i):void 0,settings:Ti(n)}},bI=Et(gI,{setActiveTool:ip,setDashboardIsolatedLinkerPanelId:Al},null,{forwardRef:!0})(ss);const Ni=bI;function wa(n,e,t){return e=CI(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function CI(n){var e=SI(n,"string");return typeof e=="symbol"?e:String(e)}function SI(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 zi=W.module("CommandHistoryPanel");class Mi extends c.Component{static handleError(e){zi.error(e)}constructor(e){super(e),wa(this,"container",void 0),wa(this,"pending",void 0),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSendToConsole=this.handleSendToConsole.bind(this),this.handleSendToNotebook=this.handleSendToNotebook.bind(this),this.container=X.createRef(),this.pending=new Sn;var{session:t,sessionId:r,language:i}=e;this.state={panelState:{},session:t,sessionId:r,language:i,contextActions:[{action:this.handleFocusHistory,shortcut:Je.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){var{glEventHub:e,session:t}=this.props;e.on(vt.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(vt.FOCUS_HISTORY,this.handleFocusHistory),this.pending.cancel()}handleFocusHistory(){this.container.current&&this.container.current.focus()}handleShow(){var e;(e=this.container.current)===null||e===void 0||e.restoreScrollPosition()}handleSessionOpened(e,t){var{language:r,sessionId:i}=t;this.setState({session:e,sessionId:i,language:r},()=>{this.loadTable()})}handleSessionClosed(){this.pending.cancel(),this.setState({session:void 0,language:void 0,table:void 0})}handleSendToNotebook(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{session:r,language:i}=this.state;if(zi.debug("handleSendToNotebook",r,e),!r){zi.error("Session is not connected.");return}var{glEventHub:a}=this.props;a.emit(t?he.CREATE_NOTEBOOK:he.SEND_TO_NOTEBOOK,r,i,e)}handleSendToConsole(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;zi.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(vt.SEND_COMMAND,e,t,r)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:r}=this.state;z(t),z(r),this.pending.add(e.getTable(t,r,Date.now()),i=>i.close()).then(i=>{this.setState({table:i})}).catch(Mi.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:r}=this.props,{language:i,contextActions:a,table:s}=this.state;return u.jsxs(Ht,{className:"command-history-pane",componentPanel:this,glContainer:e,glEventHub:t,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[!s&&u.jsx("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),s&&i!=null&&u.jsxs(u.Fragment,{children:[u.jsx(fD,{ref:this.container,language:i,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:s,commandHistoryStorage:r}),u.jsx(ae,{actions:a})]})]})}}wa(Mi,"COMPONENT","CommandHistoryPanel");wa(Mi,"TITLE","Command History");var yI=(n,e)=>{var t=Qv(n),r=Fr(n,e.localDashboardId),{session:i,config:a}=r??{},{type:s,id:o}=a??{};return{commandHistoryStorage:t,language:s,session:i,sessionId:o}},EI=Et(yI,null,null,{forwardRef:!0})(Mi);const Kp=EI;function eh(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 Ki(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?eh(Object(t),!0).forEach(function(r){Ln(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):eh(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ln(n,e,t){return e=wI(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wI(n){var e=PI(n,"string");return typeof e=="symbol"?e:String(e)}function PI(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 qi=W.module("ConsolePanel"),_I=500,TI=Object.freeze({consoleSettings:{},itemIds:[]});class os extends c.PureComponent{constructor(e){super(e),Ln(this,"consoleRef",void 0),Ln(this,"objectSubscriptionCleanup",void 0),Ln(this,"savePanelState",Le(()=>{var{consoleSettings:s,itemIds:o}=this.state,l={consoleSettings:s,itemIds:[...o]};qi.debug("Saving panel state",l),this.setState({panelState:l})},_I)),this.handleFocusCommandHistory=this.handleFocusCommandHistory.bind(this),this.handleOpenObject=this.handleOpenObject.bind(this),this.handleCloseObject=this.handleCloseObject.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSettingsChange=this.handleSettingsChange.bind(this),this.handleShow=this.handleShow.bind(this),this.handlePanelMount=this.handlePanelMount.bind(this),this.supportsType=this.supportsType.bind(this),this.iconForType=this.iconForType.bind(this),this.consoleRef=X.createRef();var{panelState:t}=e,r=Ki(Ki({},TI),t||{}),{consoleSettings:i,itemIds:a}=r;this.state={consoleSettings:i,itemIds:new Map(a),objectMap:new Map,error:void 0,panelState:r}}componentDidMount(){var{glEventHub:e}=this.props;this.closeDisconnectedPanels(),e.on(te.MOUNT,this.handlePanelMount),this.subscribeToFieldUpdates()}componentDidUpdate(e,t){var{consoleSettings:r,itemIds:i}=this.state;(t.consoleSettings!==r||t.itemIds!==i)&&this.savePanelState()}componentWillUnmount(){var e,{glEventHub:t}=this.props;this.savePanelState.flush(),t.off(te.MOUNT,this.handlePanelMount),(e=this.objectSubscriptionCleanup)===null||e===void 0||e.call(this)}subscribeToFieldUpdates(){var{sessionWrapper:e}=this.props;if(e!=null){var{session:t}=e;this.objectSubscriptionCleanup=t.subscribeToFieldUpdates(r=>{qi.debug("Got updates",r),this.setState(i=>{var{objectMap:a}=i,{updated:s,created:o,removed:l}=r,d=[...s,...l],h=new Map(a);d.forEach(v=>{var{title:p}=v;p!==void 0&&h.delete(p)});var f=[...s,...o];return f.forEach(v=>{v.title!==void 0&&h.set(v.title,v)}),{objectMap:h}})})}}setItemId(e,t){this.setState(r=>{var{itemIds:i}=r,a=new Map(i);return a.set(e,t),{itemIds:a}})}getItemId(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{itemIds:r}=this.state,i=r.get(e);return i==null&&t&&(i=ye.generate(),this.setItemId(e,i)),i}handleTabFocus(){var e;(e=this.consoleRef.current)===null||e===void 0||e.focus()}handlePanelMount(e){var t,r,i,{itemIds:a}=this.state,s=e==null||(t=e.props)===null||t===void 0?void 0:t.id,o=e==null||(r=e.props)===null||r===void 0||(i=r.metadata)===null||i===void 0?void 0:i.sourcePanelId;if(s&&o){var l=new Set(a.values());l.has(o)&&this.setItemId(s,s)}}handleFocusCommandHistory(){var{glEventHub:e}=this.props;e.emit(vt.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{root:r}=this.context,i=e.title!=null?this.getItemId(e.title,!1):null;(t||i!=null&&F.getStackForRoot(r,{id:i},!1,!1,!1)!=null)&&this.openWidget(e)}handleCloseObject(e){var{title:t}=e;if(t!==void 0){var r=this.getItemId(t,!1);if(r!=null){var{glEventHub:i}=this.props;i.emit(te.CLOSE,r)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;qi.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(vt.SETTINGS_CHANGED,e)}openWidget(e){var{glEventHub:t,sessionWrapper:r}=this.props;z(r);var{config:i,session:a}=r,{title:s}=e;z(s);var o=this.getItemId(s),l={fetch:()=>a.getObject(e),panelId:o,widget:Ki(Ki({},Vf(e)),{},{sessionId:i.id})};qi.debug("openWidget",l),t.emit(te.OPEN,l)}addCommand(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;(t=this.consoleRef.current)===null||t===void 0||t.addCommand(e,r,i)}closeDisconnectedPanels(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{consoleSettings:t,itemIds:r}=this.state,{isClosePanelsOnDisconnectEnabled:i=!0}=t;if(!(!i&&!e)){var a=[...r.values()],{glEventHub:s}=this.props;a.forEach(o=>{s.emit(te.CLOSE,o)}),this.setState({itemIds:new Map})}}updateDimensions(){var e;(e=this.consoleRef.current)===null||e===void 0||e.updateDimensions()}supportsType(e){var{plugins:t}=this.props;return[...t.values()].some(r=>Zs(r,e))}iconForType(e){var{plugins:t}=this.props,r=[...t.values()].find(i=>Zs(i,e));return r!=null?cv(r):u.jsx(qT,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:r,sessionWrapper:i,timeZone:a,unzip:s}=this.props;if(i==null)return u.jsx(Ne,{isLoading:!1,errorMessage:"Console is disabled."});var{consoleSettings:o,error:l,objectMap:d}=this.state,{config:h,session:f,connection:v,details:p={},dh:m}=i,{workerName:b,processInfoId:g}=p,{id:C,type:S}=h;return u.jsx(Ht,{className:"iris-panel-console",componentPanel:this,glContainer:t,glEventHub:r,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,errorMessage:l!=null?"".concat(l):void 0,children:f!=null&&u.jsx(XO,{dh:m,ref:this.consoleRef,settings:o,session:f,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:S,statusBarChildren:u.jsxs(u.Fragment,{children:[u.jsx("div",{children:pp.LANGUAGE_MAP.get(S)}),b!=null&&u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"•"}),b]}),g!=null&&u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"•"}),g,u.jsx("div",{children:"•"})]}),u.jsx(yD,{connection:v,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})]}),scope:C,timeZone:a,objectMap:d,unzip:s,supportsType:this.supportsType,iconForType:this.iconForType})})}}Ln(os,"COMPONENT","ConsolePanel");Ln(os,"TITLE","Console");Ln(os,"contextType",Ka);var OI=(n,e)=>({commandHistoryStorage:Qv(n),sessionWrapper:Fr(n,e.localDashboardId),timeZone:El(n),plugins:T_(n)}),DI=Et(OI,null,null,{forwardRef:!0})(os);const ra=DI;function Ot(n,e,t){return e=II(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function II(n){var e=xI(n,"string");return typeof e=="symbol"?e:String(e)}function xI(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 Yi=W.module("DropdownFilter"),NI=150;class Qt extends c.Component{constructor(e){super(e),Ot(this,"dropdownRef",void 0),Ot(this,"getCompatibleColumns",se((a,s)=>a!=null?s.filter(o=>{var{type:l}=o;return l!==void 0&&xe.isCompatibleType(l,a.columnType)}):[])),Ot(this,"getColumnOptions",se((a,s)=>{var o=-1,l=[];return l.push(u.jsx("option",{value:"-1",children:"Select a column"},"placeholder")),a.forEach((d,h)=>{l.push(u.jsx("option",{value:h,children:this.getItemLabel(a,h)},"".concat(d.name,"/").concat(d.type))),s!==null&&d.name===s.name&&d.type===s.type&&(o=h)}),[l,o]})),Ot(this,"getSelectedOptionIndex",se((a,s)=>a.indexOf(s))),Ot(this,"getValueOptions",se(a=>[u.jsx("option",{value:"-1",children:Qt.PLACEHOLDER},"-1"),...a.map((s,o)=>u.jsx("option",{value:o,children:s??"(null)"},"".concat(o,"/").concat(s)))])),Ot(this,"getItemLabel",st((a,s)=>{var{name:o,type:l}=a[s];if(s>0&&a[s-1].name===o||s<a.length-1&&a[s+1].name===o){var d=l.substring(l.lastIndexOf(".")+1);return"".concat(o," (").concat(d,")")}return o})),Ot(this,"sendUpdate",Le(()=>{var{onChange:a}=this.props,{column:s,value:o,isValueShown:l}=this.state;a({column:s,isValueShown:l,value:o??void 0})},NI)),this.handleColumnChange=this.handleColumnChange.bind(this),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.handleDropdownKeyPress=this.handleDropdownKeyPress.bind(this),this.handleValueChange=this.handleValueChange.bind(this),this.dropdownRef=X.createRef();var{column:t,isValueShown:r,value:i}=e;this.state={column:t,id:ye(),selectedColumn:t,disableCancel:!r,isValueShown:r,value:i}}componentDidUpdate(e,t){var{source:r,values:i,isLoaded:a}=this.props,{column:s,value:o,isValueShown:l}=this.state;a&&(r!==e.source&&this.sourceUpdated(),i!==e.values&&o!==""&&!i.includes(o)&&this.resetValue(),l!==t.isValueShown&&l&&this.focusInput(),(s!==t.column||o!==t.value||l!==t.isValueShown)&&this.sendUpdate())}componentWillUnmount(){this.sendUpdate.flush()}handleColumnChange(e){var t=e;if(Yi.debug2("handleColumnChange",t),t!=null&&parseInt(t,10)<0){this.setState({selectedColumn:null});return}var{columns:r,source:i}=this.props,a=this.getCompatibleColumns(i,r);this.setState({selectedColumn:a[parseInt(t,10)]})}handleDropdownKeyPress(e){e.key==="Enter"&&(e.preventDefault(),e.stopPropagation(),Yi.debug2("handleDropdownKeyPress"),this.sendUpdate(),this.sendUpdate.flush())}handleValueChange(e){var t=e,r=parseInt(t,10),i="",{values:a}=this.props;r>=0&&r<a.length?i=a[r]:Yi.debug2("Selected default item"),Yi.debug2("handleValueChange",i),this.setState({value:i})}handleSettingsCancel(){this.setState(e=>{var{column:t}=e;return{selectedColumn:t,isValueShown:!0}})}handleSettingsSave(){this.setState(e=>{var{column:t,selectedColumn:r,value:i}=e;return{column:r,value:t===r?i:"",isValueShown:!0,disableCancel:!1}})}handleSettingsClick(e){e.stopPropagation(),this.showSettings()}handleBackgroundClick(e){e.target!==this.dropdownRef.current&&this.focusInput()}sourceUpdated(){this.setState({column:null,selectedColumn:null,isValueShown:!1,disableCancel:!0,value:""})}showSettings(){var{column:e}=this.state;this.setState({selectedColumn:e,isValueShown:!1})}focusInput(){var e;(e=this.dropdownRef.current)===null||e===void 0||e.focus()}resetValue(){this.setState({value:""})}clearFilter(){this.resetValue()}setFilterState(e){var{name:t,type:r,value:i,isValueShown:a}=e,s=t!=null&&r!=null?{name:t,type:r}:null;this.setState(o=>{var{value:l,isValueShown:d}=o;return{column:s,value:i??l,isValueShown:a??d}})}render(){var e,{columns:t,disableLinking:r,isLinkerActive:i,isLoaded:a,source:s,onColumnSelected:o,onSourceMouseEnter:l,onSourceMouseLeave:d,values:h,settingsError:f}=this.props,{column:v,disableCancel:p,id:m,isValueShown:b,selectedColumn:g,value:C}=this.state,S=s===null,y=this.getCompatibleColumns(s,t),w=s!=null,E=(e=s==null?void 0:s.columnName)!==null&&e!==void 0?e:Qt.SOURCE_BUTTON_PLACEHOLDER,D=v!=null?"".concat(v.name," Filter"):null,[T,O]=this.getColumnOptions(y,g),M=this.getValueOptions(h),j=this.getSelectedOptionIndex(h,C),H=!w||g==null,L=b&&!i,I="source-column-btn-".concat(m),N="filter-column-select-".concat(m);return u.jsxs(ka,{className:"dropdown-filter fill-parent-absolute",isFlipped:L,children:[u.jsx("div",{className:"dropdown-filter-settings-card",children:u.jsxs("div",{className:"dropdown-filter-card-content",children:[u.jsxs("div",{className:"dropdown-filter-settings-grid",children:[u.jsx("label",{htmlFor:I,children:"Source Column"}),u.jsx(Vo,{id:I,isLinked:w,onClick:o,onMouseEnter:l,onMouseLeave:d,className:Qt.SOURCE_BUTTON_CLASS_NAME,disabled:r,children:E}),u.jsx("div",{className:"text-muted small",children:"Select a source column for the list by linking to a table."}),u.jsx("label",{htmlFor:N,children:"Filter Column"}),u.jsx(Rn,{id:N,value:String(O),className:"custom-select",onChange:this.handleColumnChange,disabled:S,children:T}),u.jsx("div",{className:"text-muted small",children:"Dropdown filter control will apply its filter to all columns matching this name in this dashboard."})]}),f&&u.jsx("div",{className:"error-message text-center",children:f}),w&&u.jsxs("div",{className:"dropdown-filter-settings-buttons",children:[u.jsx(K,{kind:"secondary",type:"button",onClick:this.handleSettingsCancel,disabled:p||b||i,tooltip:i?"Cancel disabled while linker open":void 0,children:"Cancel"}),u.jsx(K,{kind:"primary",type:"button",className:"ml-2",onClick:this.handleSettingsSave,disabled:H||b||i,tooltip:i?"Save disabled while linker open":void 0,children:"Save"})]})]})}),u.jsx("div",{className:"dropdown-filter-value-card",onClick:this.handleBackgroundClick,"data-testid":"dropdown-filter-value-background",children:a&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"dropdown-filter-column",children:u.jsx("div",{className:"dropdown-filter-column-title",children:D})}),u.jsxs("div",{className:"dropdown-filter-card-content",children:[u.jsx("div",{className:"dropdown-filter-value-input d-flex flex-column justify-content-center",children:u.jsx(Rn,{className:"custom-select",value:String(j),ref:this.dropdownRef,onChange:this.handleValueChange,onKeyDown:this.handleDropdownKeyPress,title:"Select Value",children:M})}),f&&u.jsx("div",{className:"error-message mt-3 text-center",children:f})]}),u.jsx("div",{className:"dropdown-filter-menu",children:u.jsx(K,{kind:"ghost",className:"m-2 px-2",onClick:this.handleSettingsClick,icon:u.jsx(ne,{icon:xa,transform:"grow-4"}),tooltip:"Dropdown Filter Settings"})})]})})]})}}Ot(Qt,"defaultProps",{column:null,disableLinking:!1,isLinkerActive:!1,isLoaded:!1,isValueShown:!1,settingsError:null,source:null,value:"",values:[],onColumnSelected:()=>{},onSourceMouseEnter:()=>{},onSourceMouseLeave:()=>{}});Ot(Qt,"PLACEHOLDER","Select a value...");Ot(Qt,"SOURCE_BUTTON_CLASS_NAME","btn-dropdown-filter-selector");Ot(Qt,"SOURCE_BUTTON_PLACEHOLDER","Select a column");const th=Qt;function Ze(n,e,t){return e=MI(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function MI(n){var e=LI(n,"string");return typeof e=="symbol"?e:String(e)}function LI(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 Ce=W.module("DropdownFilterPanel"),AI=250,FI=(n,e)=>{var{localDashboardId:t}=e,r=F.getIdFromPanel({props:e}),i=ns(n,t),a=Gn(n,t),s=wl(n),o=rs(n,t),l=s===It.LINKER&&(o===void 0||o===r),d=s===It.LINKER&&o!==void 0&&o!==r;return{columns:Ll(n,t),columnSelectionValidator:is(n,t),dh:Xv(n),isLinkerActive:l,disableLinking:d,settings:Ti(n),panelTableMap:i,dashboardLinks:a}},jI=Et(FI,null,null,{forwardRef:!0});class xt extends c.Component{constructor(e){super(e),Ze(this,"dateTimeFormatter",void 0),Ze(this,"dropdownFilterRef",void 0),Ze(this,"panelContainer",void 0),Ze(this,"pending",void 0),Ze(this,"cleanup",void 0),Ze(this,"columnFormats",void 0),Ze(this,"getCachedValues",st((f,v,p)=>{var{type:m,name:b}=v;return m!==void 0&&xe.isDateType(m)?f.map(g=>this.dateTimeFormatter.format(g)):f.map(g=>g!=null&&m!=null?p.getFormattedString(g,m,b):null)})),Ze(this,"getCachedPanelLinks",st((f,v)=>{var p=F.getIdFromPanel(v);return Ce.debug("getCachedPanelLinks",f,p),f.filter(m=>{var b;return((b=m.end)===null||b===void 0?void 0:b.panelId)===p})})),Ze(this,"getCachedSource",st(f=>{Ce.debug("getCachedSource",f);var v;if(f.length>0){var[p]=f;v=p.start,f.length>1&&Ce.error("Filter has more that one link",f)}return v})),Ze(this,"getCachedSourceTable",st((f,v)=>{var p;if(Ce.debug("getCachedSourceTable",f,v),v==null)return null;var{panelId:m}=v;return(p=f.get(m))!==null&&p!==void 0?p:null})),Ze(this,"getCachedSourceColumn",st((f,v)=>{var p;return Ce.debug("getCachedSourceColumn",f,v),f==null||v==null?null:(p=f.columns.find(m=>{var{name:b,type:g}=m;return b===v.columnName&&g===v.columnType}))!==null&&p!==void 0?p:null})),this.handleChange=Le(this.handleChange.bind(this),AI),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleSourceFilterChange=this.handleSourceFilterChange.bind(this),this.handleSourceSortChange=this.handleSourceSortChange.bind(this),this.handleSourceSizeChange=this.handleSourceSizeChange.bind(this),this.handleSourceMouseEnter=this.handleSourceMouseEnter.bind(this),this.handleSourceMouseLeave=this.handleSourceMouseLeave.bind(this),this.handleValuesTableUpdate=this.handleValuesTableUpdate.bind(this),this.dropdownFilterRef=X.createRef(),this.panelContainer=X.createRef(),this.pending=new Sn;var{dh:t,panelState:r,settings:i}=e;this.columnFormats=si.getColumnFormats(i),this.dateTimeFormatter=new No(t,{showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:"yyyy-MM-dd HH:mm:ss.SSSSSSSSS"});var{value:a="",isValueShown:s=!1,name:o,type:l,timestamp:d}=r??{},h=o!=null&&l!=null?{name:o,type:l}:void 0;this.state={column:h,formatter:new ai(t,this.columnFormats),valuesTable:void 0,valuesColumn:void 0,sourceSize:0,value:a,timestamp:d,values:[],isValueShown:s,wasFlipped:!1,skipUpdate:!1,panelState:r,isDisconnected:!1,isLoading:!1,isLoaded:!1,error:null}}componentDidMount(){this.updateValuesTable();var{dashboardLinks:e,panelTableMap:t}=this.props,{column:r,value:i,timestamp:a}=this.state,s=this.getSourceTable(t,e);if(s!==null&&this.startListeningToSource(s),r!=null){var{name:o,type:l}=r;this.sendUpdate(o,l,i,a)}}componentDidUpdate(e,t){var{dashboardLinks:r,panelTableMap:i,settings:a}=this.props,{valuesTable:s}=this.state,o=this.getSource(r),l=this.getSourceTable(i,r),d=this.getSource(e.dashboardLinks),h=this.getSourceTable(e.panelTableMap,e.dashboardLinks);a!==e.settings&&a!==void 0&&this.updateFormatterSettings(a),s!==t.valuesTable&&t.valuesTable!=null&&(Ce.debug("Table in state modified, closing the old table."),t.valuesTable.close()),(l!==h||o!==d)&&this.updateValuesTable(),l!==h&&(h!==null&&this.stopListeningToSource(h),l!==null&&this.startListeningToSource(l))}componentWillUnmount(){var{dashboardLinks:e,panelTableMap:t}=this.props,{valuesTable:r}=this.state,i=this.getSourceTable(t,e);this.pending.cancel(),i!==null&&this.stopListeningToSource(i),this.cleanup&&this.cleanup(),r!=null&&r.close()}getCoordinateForColumn(){var e;if(this.panelContainer.current==null)return null;var t=this.panelContainer.current.querySelector(".".concat(th.SOURCE_BUTTON_CLASS_NAME)),r=(e=t==null?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:null;if(r==null||r.width<=0||r.height<=0)return null;var i=r.left+r.width/2,a=r.bottom;return[i,a]}getSettingsErrorMessage(){var{sourceSize:e}=this.state;if(e>xt.MAX_TABLE_SIZE)return"Table too large, must have fewer than ".concat(xt.MAX_TABLE_SIZE," options.")}getPanelErrorMessage(){var{error:e}=this.state;return e!=null?"".concat(e):void 0}getSource(e){var t=this.getCachedPanelLinks(e,this);return this.getCachedSource(t)}getSourceTable(e,t){var r=this.getSource(t);return this.getCachedSourceTable(e,r)}getValuesColumn(e,t){var r=this.getSource(t);return this.getCachedSourceColumn(e,r)}startListeningToSource(e){var{dh:t}=this.props;Ce.debug("startListeningToSource"),e.addEventListener(t.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.addEventListener(t.Table.EVENT_SORTCHANGED,this.handleSourceSortChange),e.addEventListener(t.Table.EVENT_SIZECHANGED,this.handleSourceSizeChange),e.addEventListener(t.Table.EVENT_DISCONNECT,this.handleDisconnect),e.addEventListener(t.Table.EVENT_RECONNECT,this.handleReconnect)}stopListeningToSource(e){var{dh:t}=this.props;Ce.debug("stopListeningToSource"),e.removeEventListener(t.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.removeEventListener(t.Table.EVENT_SORTCHANGED,this.handleSourceSortChange),e.removeEventListener(t.Table.EVENT_SIZECHANGED,this.handleSourceSizeChange),e.removeEventListener(t.Table.EVENT_DISCONNECT,this.handleDisconnect),e.removeEventListener(t.Table.EVENT_RECONNECT,this.handleReconnect)}handleChange(e){var{column:t,isValueShown:r=!1,value:i}=e,{name:a=void 0,type:s=void 0}=t??{},o=!0,l=Date.now();this.setState(d=>{var h,f,{panelState:v,timestamp:p,wasFlipped:m,skipUpdate:b}=d,g=v!=null&&r!==v.isValueShown&&a===v.name&&s===v.type&&i===v.value;return o=(h=!b&&r&&(!g||!m))!==null&&h!==void 0?h:!1,o||(l=p),{panelState:{isValueShown:r,name:a,type:s,value:i,timestamp:(f=l)!==null&&f!==void 0?f:void 0},timestamp:l,wasFlipped:g,skipUpdate:!1}},()=>{o&&this.sendUpdate(a??null,s,i,l)})}handleDisconnect(){this.setState({error:new Error("Table disconnected"),isDisconnected:!0,isLoading:!1})}handleReconnect(){this.setState({isDisconnected:!1,error:null})}handleSourceFilterChange(){this.applySourceFilters()}handleSourceSortChange(){this.applySourceSorts()}handleSourceSizeChange(e){var{detail:t}=e;this.setState({sourceSize:t})}handleColumnSelected(){Ce.debug("handleColumnSelected");var{glEventHub:e}=this.props;e.emit(Te.COLUMN_SELECTED,this,xt.SOURCE_COLUMN)}handleClearAllFilters(){var e,t;(e=this.dropdownFilterRef)===null||e===void 0||(t=e.current)===null||t===void 0||t.clearFilter()}setPanelState(e){var t,r,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{dashboardLinks:a}=this.props;if(this.getSource(a)==null){Ce.debug("Ignore state update for unlinked filter",e);return}this.setState({skipUpdate:!i}),(t=this.dropdownFilterRef)===null||t===void 0||(r=t.current)===null||r===void 0||r.setFilterState(e)}sendUpdate(e,t,r,i){var a,{dashboardLinks:s,glEventHub:o}=this.props,l=(a=this.getSource(s))===null||a===void 0?void 0:a.panelId,d=l===null?[]:[l];Ce.debug("sendUpdate",{name:e,type:t,value:r,timestamp:i,excludePanelIds:d}),o.emit(Te.FILTERS_CHANGED,this,{name:e,type:t,value:r??"=null",timestamp:i,excludePanelIds:d})}updateValuesTable(){var{dashboardLinks:e,panelTableMap:t}=this.props,r=this.getSource(e),i=this.getSourceTable(t,e);if(Ce.debug("updateValuesTable",r,i),this.setState({values:[],valuesTable:void 0,error:null}),r==null){Ce.debug("Filter unlinked."),this.setState({isLoading:!1,isLoaded:!0,isValueShown:!1,sourceSize:0});return}this.setState({isLoading:!0}),i!=null&&(this.setState({isLoaded:!1,sourceSize:i.size}),this.pending.add(i.copy(),a=>a.close()).then(a=>{this.updateViewportListener(a),this.setState({valuesTable:a})}).catch(a=>{Se.isCanceled(a)||(Ce.error(a),this.setState({isLoading:!1,error:a}))}))}applySourceSorts(){var{dashboardLinks:e,panelTableMap:t}=this.props,{valuesTable:r}=this.state,i=this.getSourceTable(t,e);if(Ce.debug("applySourceSorts",i==null?void 0:i.sort),r==null||i==null){Ce.debug("Table not initialized");return}var a=[...i.sort];r.applySort(a),this.setViewport(r)}applySourceFilters(){var{dashboardLinks:e,panelTableMap:t}=this.props,{valuesTable:r}=this.state,i=this.getSourceTable(t,e);if(Ce.debug("applySourceFilters",i==null?void 0:i.filter),r==null||i==null){Ce.debug("Table not initialized");return}var a=[...i.filter];r.applyFilter(a),this.setViewport(r)}updateViewportListener(e){var{dh:t}=this.props;if(Ce.debug("updateViewportListener",e==null?void 0:e.size),this.cleanup&&this.cleanup(),e==null){this.cleanup=void 0;return}this.cleanup=e.addEventListener(t.Table.EVENT_UPDATED,this.handleValuesTableUpdate),this.setViewport(e)}setViewport(e){var{dashboardLinks:t}=this.props,r=this.getValuesColumn(e,t);if(!r){Ce.error("values column is null");return}e.setViewport(0,xt.MAX_TABLE_SIZE-1,[r])}updateFormatterSettings(e){var{dh:t}=this.props,r=si.getColumnFormats(e);mr(this.columnFormats,r)||(this.columnFormats=r,this.setState({formatter:new ai(t,r)}))}handleValuesTableUpdate(e){var{detail:t}=e,{rows:r}=t,{dashboardLinks:i}=this.props,{valuesTable:a}=this.state;if(!a){Ce.error("valuesTable is null");return}var s=this.getValuesColumn(a,i);if(!s){Ce.error("Values column not found");return}var o=r.map(l=>l.get(s));this.setState({values:o,isLoading:!1,isLoaded:!0,valuesColumn:s})}handleSourceMouseEnter(){var{columnSelectionValidator:e}=this.props;e&&e(this,xt.SOURCE_COLUMN)}handleSourceMouseLeave(){var{columnSelectionValidator:e}=this.props;e&&e(this,void 0)}render(){var{columns:e,dashboardLinks:t,disableLinking:r,glContainer:i,glEventHub:a,isLinkerActive:s}=this.props,{column:o,formatter:l,isDisconnected:d,isValueShown:h,value:f,values:v,valuesColumn:p,isLoading:m,isLoaded:b}=this.state,g=this.getSource(t),C=this.getSettingsErrorMessage(),S=this.getPanelErrorMessage(),y=b&&p!=null?this.getCachedValues(v,p,l):[];return u.jsx(xi,{errorMessage:S,isLoading:m,isLoaded:b,isDisconnected:d,className:"iris-dropdown-filter-panel",componentPanel:this,glContainer:i,glEventHub:a,onClearAllFilters:this.handleClearAllFilters,widgetName:"Dropdown Filter",widgetType:"DropdownFilter",children:u.jsx("div",{ref:this.panelContainer,className:"dropdown-filter-container h-100 w-100 container",children:u.jsx(th,{ref:this.dropdownFilterRef,column:o,columns:e,isValueShown:h,isLinkerActive:s,disableLinking:r,isLoaded:b,settingsError:C,source:g,value:f,values:y,onChange:this.handleChange,onColumnSelected:this.handleColumnSelected,onSourceMouseEnter:this.handleSourceMouseEnter,onSourceMouseLeave:this.handleSourceMouseLeave})})})}}Ze(xt,"displayName","DropdownFilterPanel");Ze(xt,"COMPONENT","DropdownFilterPanel");Ze(xt,"MAX_TABLE_SIZE",256);Ze(xt,"SOURCE_COLUMN",Object.freeze({name:"FilterSource",type:null}));var RI=jI(xt);const bn=RI;function pt(n){return n.type==="directory"}function kI(n,e,t){return e=$I(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $I(n){var e=UI(n,"string");return typeof e=="symbol"?e:String(e)}function UI(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 HI extends Error{constructor(){super("No file exists at the path specified"),kI(this,"isFileNotFound",!0)}}const ls=HI;function nh(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function rh(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){nh(a,r,i,s,o,"next",l)}function o(l){nh(a,r,i,s,o,"throw",l)}s(void 0)})}}var qt;(function(n){n.GROOVY="text/x-groovy",n.PLAIN_TEXT="text/plain",n.PYTHON="text/x-python",n.PYTHON_COMPILED="application/x-python-code",n.SCALA="text/x-scala",n.UNKNOWN=""})(qt||(qt={}));class jt{static fileExists(e,t){return rh(function*(){try{return yield e.info(t),!0}catch(r){if(!(r instanceof ls))throw r;return!1}})()}static fileExtensionToString(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return e.length===0?"":".".concat(e)}static getDepth(e){var t;if(!jt.hasPath(e))throw new Error("Invalid path provided: ".concat(e));var r=(t=e.match(/\//g))!==null&&t!==void 0?t:[];return r.length-1}static getExtension(e){var t=this.getBaseName(e).split(".");if(t.length>1){var r;return(r=t.pop())!==null&&r!==void 0?r:""}return""}static getBaseName(e){var t;return(t=e.split("/").pop())!==null&&t!==void 0?t:""}static getCopyFileName(e){var t=e.lastIndexOf("."),r=null,i=null;t<0?i=e:(i=e.substring(0,t),r=e.substring(t+1));var a=i?"".concat(i,"-copy"):"Copy";return r!==null?"".concat(a,".").concat(r):a}static getUniqueCopyFileName(e,t){return rh(function*(){for(var r=jt.getCopyFileName(t);yield jt.fileExists(e,r);)r=jt.getCopyFileName(r);return r})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return qt.GROOVY;case"py":return qt.PYTHON;case"pyc":return qt.PYTHON_COMPILED;case"scala":return qt.SCALA;case"txt":return qt.PLAIN_TEXT;default:return qt.UNKNOWN}}static getParent(e){if(!jt.hasPath(e))throw new Error("Invalid name provided: ".concat(e));for(var t=e.split("/");t.pop()==="";);if(t.length===0)throw new Error("No parent for path provided: ".concat(e));return"".concat(t.join("/"),"/")}static getPath(e){if(!jt.hasPath(e))throw new Error("Invalid filename provided: ".concat(e));var t=e.split("/");return t.pop(),"".concat(t.join("/"),"/")}static hasPath(e){return e.startsWith("/")}static isPath(e){return e.startsWith("/")&&e.endsWith("/")}static makePath(e){return e.endsWith("/")?e:"".concat(e,"/")}static replaceExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=e.lastIndexOf("."),i=r>-1?e.substring(0,r):e,a=jt.fileExtensionToString(t);return"".concat(i).concat(a)}static validateName(e){var t=[".",".."],r=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new ei("Name cannot be empty");if(t.includes(e))throw new ei('"'.concat(e,'" is a reserved name'));if(r.test(e)){var a,s;throw new ei('Invalid characters in name: "'.concat((a=(s=e.match(r))===null||s===void 0?void 0:s.reduce((o,l)=>o.includes(l)?o:[...o,l],[]).map(o=>i.has(o)?i.get(o):o).join('", "'))!==null&&a!==void 0?a:"",'"'))}}static reducePaths(e){var t=e.filter(r=>jt.isPath(r));return e.filter(r=>!t.some(i=>r!==i&&r.startsWith(i)))}static removeRoot(e,t){if(e.length===0)return t;if(!t.startsWith(e))throw new Error("Filename ".concat(t," does not start with expected root ").concat(e));return t.substring(e.length)}static addRoot(e,t){return"".concat(e).concat(t)}}const ee=jt;var jl=26;function mo(n){return pt(n)?ee.makePath(n.filename):ee.getPath(n.filename)}function ih(n,e){if(n.length===0||e==null)throw new Error("No items to move");var t=mo(e);if(n.some(r=>{var{filename:i}=r;return ee.getPath(i)===t}))throw new Error("File already in the destination folder");if(n.some(r=>pt(r)&&t.startsWith(ee.makePath(r.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:n,targetPath:t}}function VI(n){if(pt(n))return n.isExpanded?ib:ab;var e=ee.getMimeType(n.basename);switch(e){case qt.PYTHON:return ob;default:return sb}}function go(n){var e,{children:t,draggedItems:r,isDragInProgress:i,isDropTargetValid:a,isSelected:s,item:o,itemIndex:l,dropTargetItem:d,onDragStart:h,onDragOver:f,onDragEnd:v,onDrop:p}=n,m=(e=r==null?void 0:r.some(T=>T.id===o.id))!==null&&e!==void 0?e:!1,b=mo(o),g=i&&d?mo(d):null,C=i&&a&&pt(o)&&g===b,S=i&&a&&g===b,y=i&&!a&&g===b,w=VI(o),E=ee.getDepth(o.filename),D=Array(E).fill(null).map((T,O)=>u.jsx("span",{className:"file-list-depth-line"},O));return u.jsxs("div",{className:Y("d-flex w-100 align-items-center","file-list-item",{"is-dragged":m,"is-exact-drop-target":C,"is-in-drop-target":S,"is-invalid-drop-target":y,"is-selected":s}),onDragStart:T=>h(l,T),onDragOver:T=>f(l,T),onDragEnd:T=>v(l,T),onDrop:T=>p(l,T),draggable:!0,role:"presentation","aria-label":o.basename,children:[D," ",u.jsx(ne,{icon:w,className:"item-icon",fixedWidth:!0})," ",u.jsx("span",{className:"truncation-wrapper",children:t??u.jsxs(u.Fragment,{children:[o.basename,u.jsx(mt,{children:o.basename})]})})]})}function ah(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 Xi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ah(Object(t),!0).forEach(function(r){BI(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ah(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function BI(n,e,t){return e=WI(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function WI(n){var e=GI(n,"string");return typeof e=="symbol"?e:String(e)}function GI(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 qe=W.module("FileList"),zI=500,sh="item-list-scroll-pane";function KI(n){var{isMultiSelect:e=!1,table:t,onFocusChange:r=()=>{},onMove:i,onSelect:a,onSelectionChange:s=()=>{},renderItem:o=go,rowHeight:l=jl,overscanCount:d=br.DEFAULT_OVERSCAN}=n,[h,f]=c.useState(()=>({items:[],offset:0,itemCount:0})),[v,p]=c.useState({top:0,bottom:0}),[m,b]=c.useState(),[g,C]=c.useState(),[S,y]=c.useState(),[w,E]=c.useState([]),D=c.useRef(),T=c.useRef(null),O=c.useRef(null),M=c.useCallback($=>{if($.length===0||h==null)return[];for(var J=[],ie=0;ie<$.length;ie+=1)for(var fe=$[ie],Ee=fe[0];Ee<=fe[1];Ee+=1)Ee>=h.offset&&Ee<h.offset+h.items.length&&J.push(h.items[Ee-h.offset]);return J},[h]),j=c.useCallback($=>{var J=M([[$,$]]);if(J.length>0)return J[0]},[M]),H=c.useCallback(()=>{var $=oa.count(w);if($===0)return null;if($===1){var J=w[0][0],ie=j(J);if(ie!=null)return ie.filename}return"".concat($," items")},[j,w]),L=c.useCallback($=>{if(!(!g||!m)){qe.debug("dropItems",g,"to",$);try{var{files:J,targetPath:ie}=ih(g,m);if(i==null||i(J,ie),$!=null){var fe;E([[$,$]]),(fe=T.current)===null||fe===void 0||fe.focusItem($)}}catch(Ee){qe.error("Unable to complete move",Ee)}}},[g,m,i]),I=c.useCallback(($,J)=>{var ie=h.items[$-h.offset];ie!==void 0&&(qe.debug("handleItemClick",ie),a(ie,J),pt(ie)&&(t==null||t.setExpanded(ie.filename,!ie.isExpanded)))},[h,a,t]),N=c.useCallback(($,J)=>{var ie;qe.debug2("handleItemDragStart",$,w);var fe=w;oa.isSelected(w,$)||(fe=[[$,$]],E(fe)),C(M(fe)),(ie=T.current)===null||ie===void 0||ie.resetMouseState();var Ee=document.createElement("div");Ee.innerHTML='<div class="dnd-placeholder-content">'.concat(H(),"</div>"),Ee.className="file-list-dnd-placeholder",document.body.appendChild(Ee),J.dataTransfer.setDragImage(Ee,0,0),J.dataTransfer.effectAllowed="move",y(Ee)},[H,M,w]),A=c.useCallback(($,J)=>{J.preventDefault(),qe.debug2("handleItemDragOver",J),b(j($))},[j]),k=c.useCallback(($,J)=>{qe.debug("handleItemDragEnd",$),S==null||S.remove(),C(void 0),b(void 0),y(void 0)},[S]),V=c.useCallback(($,J)=>{L($)},[L]),q=c.useCallback(()=>{qe.debug2("handleItemDragExit"),b(void 0)},[]),re=c.useCallback($=>{$.target instanceof Element&&$.target.classList.contains(sh)&&($.preventDefault(),qe.debug2("handleListDragOver",$),b({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),B=c.useCallback($=>{$.target instanceof Element&&$.target.classList.contains(sh)&&(qe.debug("handleListDrop"),L())},[L]),x=c.useCallback(function($){var J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(qe.debug2("handleSelectionChange",$),J===!0||$!==w){E($);var ie=M($);s(ie)}},[M,s,w]),P=c.useCallback($=>{if(qe.debug2("handleFocusChange",$),$!=null){var[J]=M([[$,$]]);r(J)}else r();D.current=$},[M,r]),R=c.useCallback(($,J)=>{qe.debug("handleViewportChange",$,J),($!==v.top||J!==v.bottom)&&p({top:$,bottom:J})},[v]),U=c.useMemo(()=>{if(!g||!m)return!1;try{return ih(g,m),qe.debug("handleValidateDropTarget true"),!0}catch{return qe.debug("handleValidateDropTarget false"),!1}},[g,m]),{focusedPath:Q}=n;c.useEffect(()=>{Q!==void 0&&(Q==="/"?t.collapseAll():(t.setExpanded(Q,!1),t.setExpanded(Q,!0)))},[t,Q]),c.useEffect(function(){qe.debug("updating table viewport",v),t==null||t.setViewport({top:Math.max(0,v.top-d),bottom:v.bottom+d})},[d,t,v]),c.useEffect(function(){var J=t.onUpdate(ie=>{f({items:ie.items.map(fe=>Xi(Xi({},fe),{},{itemName:fe.basename})),offset:ie.offset,itemCount:t.size})});return()=>{J()}},[t]),c.useEffect(function(){D.current!=null&&P(D.current),w.length>0&&x(w,!0)},[h,P,x,w]),c.useEffect(function(){if(m!=null&&pt(m)&&m.filename!=="/"){var J=setTimeout(()=>{m.isExpanded||t==null||t.setExpanded(m.filename,!0)},zI);return()=>clearTimeout(J)}},[m,t]);var me=c.useCallback($=>o(Xi(Xi({},$),{},{isDragInProgress:g!=null,dropTargetItem:m,draggedItems:g,isDropTargetValid:U,onDragStart:N,onDragEnd:k,onDragOver:A,onDragExit:q,onDrop:V})),[k,q,A,N,V,g,m,U,o]);return u.jsx("div",{ref:O,className:Y("file-list",{"is-dragging":g!=null}),onDragOver:re,onDrop:B,children:u.jsx(br,{ref:T,items:h.items,itemCount:h.itemCount,offset:h.offset,onFocusChange:P,onSelect:I,onSelectionChange:x,onViewportChange:R,selectedRanges:w,renderItem:me,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var qI={name:"File Explorer",DELETE:Ke.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[ve.DELETE],macShortcut:[pe.CMD,ve.BACKSPACE]}),RENAME:Ke.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[ve.ENTER],macShortcut:[ve.ENTER]})};const oh={FILE_EXPLORER:qI};var lh=W.module("FileListItemEditor"),YI=()=>Promise.resolve();function XI(n){var{item:e,onCancel:t,onSubmit:r,validate:i=YI}=n,a=c.useRef(null),[s,o]=c.useState(e.basename),[l,d]=c.useState(),[h,f]=c.useState(Promise.resolve()),v=c.useCallback(()=>{var S;(S=a.current)===null||S===void 0||S.focus()},[a]),p=c.useCallback(S=>S.stopPropagation(),[]),m=c.useCallback(()=>{h.then(()=>{r(s)}).catch(S=>lh.info("Unable to validate name",S))},[r,s,h]);c.useEffect(function(){var y=Se.makeCancelable(i(s));return y.then(()=>d(void 0)).catch(w=>{Se.isCanceled(w)||d(w)}),f(y),()=>y.cancel()},[i,s]),c.useEffect(function(){v()},[v]);var b=c.useCallback(()=>{lh.debug2("handleBlur"),m()},[m]),g=c.useCallback(S=>{var{value:y}=S.target;o(y)},[]),C=c.useCallback(S=>{S.stopPropagation();var{key:y}=S;switch(y){case"Enter":{m();break}case"Escape":{t();break}}},[t,m]);return u.jsxs("div",{className:"file-list-item-editor",children:[u.jsx("input",{type:"text",className:Y("form-control file-list-item-editor-input",{"is-invalid":l}),value:s,ref:a,onBlur:b,onKeyDown:C,onChange:g,onClick:p,onDoubleClick:p,onMouseDown:p}),l&&u.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}function dh(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 Ns(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?dh(Object(t),!0).forEach(function(r){ZI(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):dh(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ZI(n,e,t){return e=QI(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function QI(n){var e=JI(n,"string");return typeof e=="symbol"?e:String(e)}function JI(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 qp(n){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:r=!1,onCreateFile:i,onCreateFolder:a,onCopy:s,onDelete:o,onMove:l,onRename:d,onSelect:h,onSelectionChange:f,table:v,rowHeight:p=jl,validateRename:m=()=>Promise.resolve()}=n,[b,g]=c.useState(),[C,S]=c.useState([]),[y,w]=c.useState(),E=c.useCallback(V=>{S(V),f==null||f(V)},[f]),D=c.useCallback(V=>{w(V)},[]),T=c.useCallback(()=>{y&&(s==null||s(y))},[y,s]),O=c.useCallback(()=>{C.length>0&&(o==null||o(C))},[o,C]),M=c.useCallback(()=>{i==null||i()},[i]),j=c.useCallback(()=>{y&&(a==null||a(ee.getPath(y.filename)))},[y,a]),H=c.useCallback(()=>{y&&g(y)},[y]),L=c.useCallback(()=>{g(void 0)},[]),I=c.useCallback(V=>{b&&(d==null||d(b,V),g(void 0))},[d,b]),N=c.useMemo(()=>{if(b)return[];var V=[];return i&&V.push({title:"New File",description:"Create new file",action:M,group:ae.groups.medium}),a&&V.push({title:"New Folder",description:"Create new folder",action:j,group:ae.groups.medium}),s&&V.push({title:"Copy File",description:"Copy the selected file",action:T,group:ae.groups.low,disabled:y==null||pt(y)}),o&&C.length>0&&V.push({title:"Delete",description:"Delete",shortcut:oh.FILE_EXPLORER.DELETE,action:O,group:ae.groups.low}),d&&V.push({title:"Rename",description:"Rename",shortcut:oh.FILE_EXPLORER.RENAME,action:H,group:ae.groups.low,disabled:y==null}),V},[T,O,M,j,H,y,s,i,a,o,d,C,b]),A=c.useCallback(V=>(z(b),m(b,V)),[b,m]),k=c.useCallback(V=>{var{item:q}=V;return b&&b.filename===q.filename?u.jsx(go,Ns(Ns({},V),{},{children:u.jsx(XI,{item:q,validate:A,onSubmit:I,onCancel:L})})):u.jsx(go,Ns({},V))},[L,I,b,A]);return u.jsxs("div",{className:"file-list-container",children:[v!=null&&u.jsx(KI,{onMove:l,onSelect:h,onSelectionChange:E,onFocusChange:D,renderItem:k,rowHeight:p,table:v,isMultiSelect:e,focusedPath:t}),r&&u.jsx(ae,{actions:N})]})}qp.displayName="FileListContainer";function uh(n,e,t){return e=ex(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ex(n){var e=tx(n,"string");return typeof e=="symbol"?e:String(e)}function tx(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 nx extends ei{constructor(e){super("Name already exists"),uh(this,"isExistingFile",!0),uh(this,"info",void 0),this.info=e}}const ia=nx;function hh(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function ch(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){hh(a,r,i,s,o,"next",l)}function o(l){hh(a,r,i,s,o,"throw",l)}s(void 0)})}}var At=W.module("FileExplorer");function Rl(n){var{storage:e,isMultiSelect:t=!1,focusedPath:r,onCopy:i=()=>{},onDelete:a=()=>{},onRename:s=()=>{},onCreateFile:o=()=>{},onCreateFolder:l=()=>{},onSelect:d,onSelectionChange:h,rowHeight:f=jl}=n,[v,p]=c.useState([]),[m,b]=c.useState();c.useEffect(function(){var I;function N(){return A.apply(this,arguments)}function A(){return A=ch(function*(){At.debug("initTable"),I=Se.makeCancelable(e.getTable(),k=>k.close());try{b(yield I)}catch(k){Se.isCanceled(k)||At.error("Unable to initialize table",k)}}),A.apply(this,arguments)}return N(),()=>{I.cancel()}},[e]);var g=c.useCallback(L=>{Se.isCanceled(L)||At.error(L)},[]),C=c.useCallback(()=>{At.debug("handleCreateFile"),o()},[o]),S=c.useCallback(()=>{At.debug("handleCreateFolder"),l()},[l]),y=c.useCallback(L=>{At.debug("handleCopyFile",L.filename),i(L)},[i]),w=c.useCallback(L=>{At.debug("handleDelete, pending confirmation",L),p(L)},[]),E=c.useCallback(()=>{At.debug("handleDeleteConfirm",v),v.forEach(L=>e.deleteFile(pt(L)?ee.makePath(L.filename):L.filename)),a(v),p([])},[v,a,e]),D=c.useCallback(()=>{At.debug("handleDeleteCancel"),p([])},[]),T=c.useCallback((L,I)=>{var N=ee.reducePaths(L.map(A=>pt(A)?ee.makePath(A.filename):A.filename));N.forEach(A=>{var k=ee.isPath(A)?"".concat(I).concat(ee.getBaseName(A.substring(0,A.length-1)),"/"):"".concat(I).concat(ee.getBaseName(A));e.moveFile(A,k).then(()=>{s(A,k)}).catch(g)})},[g,s,e]),O=c.useCallback((L,I)=>{var N=L.filename,A=pt(L);A&&!N.endsWith("/")&&(N="".concat(N,"/"));var k="".concat(ee.getParent(N)).concat(I);A&&!k.endsWith("/")&&(k="".concat(k,"/")),At.debug2("handleRename",N,k),e.moveFile(N,k).catch(g),s(N,k)},[g,s,e]),M=c.useCallback(function(){var L=ch(function*(I,N){if(N!==I.basename){ee.validateName(N);var A="".concat(ee.getPath(I.filename)).concat(N);try{var k=yield e.info(A);throw new ia(k)}catch(V){if(!(V instanceof ls))throw V}}});return function(I,N){return L.apply(this,arguments)}}(),[e]),j=v.length>0,H=c.useMemo(()=>v.length===1?'Are you sure you want to delete "'.concat(v[0].filename,'"?'):"Are you sure you want to delete the selected files?",[v]);return u.jsxs("div",{className:"file-explorer",children:[m&&u.jsx(qp,{isMultiSelect:t,focusedPath:r,showContextMenu:!0,onCopy:y,onCreateFolder:S,onCreateFile:C,onMove:T,onDelete:w,onRename:O,onSelect:d,onSelectionChange:h,rowHeight:f,table:m,validateRename:M}),u.jsx(Cn,{isOpen:j,headerText:H,bodyText:"You cannot undo this action.",onCancel:D,onConfirm:E,confirmButtonText:"Delete"})]})}Rl.displayName="FileExplorer";function fh(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function rx(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){fh(a,r,i,s,o,"next",l)}function o(l){fh(a,r,i,s,o,"throw",l)}s(void 0)})}}function cn(n,e,t){return e=ix(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ix(n){var e=ax(n,"string");return typeof e=="symbol"?e:String(e)}function ax(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 Tn=W.module("NewItemModal");class An extends c.PureComponent{static getValidationMessage(e){return e instanceof ia&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){Se.isCanceled(e)||Tn.error(e)}constructor(e){super(e),cn(this,"inputRef",X.createRef()),cn(this,"cancelableValidatePromise",void 0),cn(this,"cancelableExistingItemPromise",void 0),cn(this,"pending",new Sn),cn(this,"pathMap",new Map),cn(this,"isInitialLoad",!0),this.handleModalSubmit=this.handleModalSubmit.bind(this),this.handleModalOpened=this.handleModalOpened.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleChange=this.handleChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleValidationError=this.handleValidationError.bind(this),this.handleOverwriteCancel=this.handleOverwriteCancel.bind(this),this.handleOverwriteConfirm=this.handleOverwriteConfirm.bind(this),this.handleExtensionChangeCancel=this.handleExtensionChangeCancel.bind(this),this.handleExtensionChangeConfirm=this.handleExtensionChangeConfirm.bind(this),this.handleBreadcrumbSelect=this.handleBreadcrumbSelect.bind(this);var{defaultValue:t}=e,r=ee.hasPath(t)?ee.getPath(t):"/";this.state={isSubmitting:!1,path:r,prevExtension:ee.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:ee.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:r}=this.props,{isOpen:i}=e,{value:a,path:s}=this.state;!i&&r&&(this.resetValue(),this.isInitialLoad=!0),i&&r&&(!this.isInitialLoad&&(s!==t.path||a!==t.value)&&this.updateValidationStatus(s,a),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){var{defaultValue:e}=this.props,t=ee.hasPath(e)?ee.getPath(e):"/";this.setState({path:t,value:ee.getBaseName(e),validationError:void 0,prevExtension:ee.getExtension(e),isSubmitting:!1})}getValidationPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=Se.makeCancelable(this.validateName(e,t,r)),this.cancelableValidatePromise}validateName(e,t,r){var i=this;return rx(function*(){ee.validateName(t);var{defaultValue:a,storage:s}=i.props;if(r){var o="".concat(e).concat(t);if(o!==a)try{var l=yield s.info(o);throw new ia(l)}catch(d){if(!(d instanceof ls))throw d}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(An.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var{value:t}=e.target;this.setState({value:t})}handleSelect(e){if(Tn.debug("handleSelect",e),e.type==="directory")this.setState({path:ee.makePath(e.filename)});else{var t=e.basename,r=ee.getPath(e.filename);this.setState({value:t,path:r},()=>{this.focusRenameInput()})}}handleKeyDown(e){var{key:t}=e;switch(e.stopPropagation(),t){case"Enter":{e.preventDefault(),this.submitModal();break}case"Escape":{e.preventDefault();var{onCancel:r}=this.props;r();break}}}handleValidationError(e){if(!(e instanceof ei))throw e;Tn.debug("Validation error",e),this.setState({validationError:e})}handleOverwriteCancel(){this.setState({showOverwriteModal:!1,isSubmitting:!1})}handleOverwriteConfirm(){this.setState({showOverwriteModal:!1});var{onSubmit:e}=this.props,{path:t,value:r}=this.state;Tn.debug("handleOverwriteConfirm",t,r),e("".concat(t).concat(r),!0)}handleExtensionChangeCancel(){Tn.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:r}=e,i=ee.replaceExtension(t,r);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){Tn.debug("handleExtensionChangeConfirm"),this.setState({showExtensionChangeModal:!1}),this.submitModal(!0)}focusRenameInput(){var e=this.inputRef.current;if(e){var{type:t}=this.props,{value:r}=e,i=t==="directory"?r.length:r.lastIndexOf(".");e.focus(),e.setSelectionRange(0,i>0?i:r.length)}}submitModal(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.setState(t=>{var{prevExtension:r,value:i,path:a}=t,{notifyOnExtensionChange:s,type:o}=this.props;Tn.debug("submitModal",r,i);var l=ee.getExtension(i);return s&&!e&&r!==null&&r!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(a,i,!0).then(d=>{var{onSubmit:h}=this.props;h("".concat(a).concat(i))}).catch(d=>{if(d instanceof ia&&o!=="directory"&&d.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw d}).catch(d=>{throw Se.isCanceled(d)&&this.setState({isSubmitting:!1}),d}).catch(this.handleValidationError).catch(An.handleError),{isSubmitting:!0,showExtensionChangeModal:!1,newExtension:void 0})})}handleBreadcrumbSelect(e){this.setState({path:e})}renderPathButtons(e){var t=e.split("/");return t.pop(),t.map((r,i)=>{for(var a="",s=0;s<i;s+=1)a+="".concat(t[s],"/");return a+="".concat(r,"/"),u.jsxs(X.Fragment,{children:[u.jsx(K,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(a),"aria-label":i===0?"Home":void 0,icon:i===0?u.jsx(ne,{icon:lb,transform:"right-1.6"}):void 0,tooltip:i===0?"Home":void 0,children:r}),"/"]},a)})}render(){var{storage:e,isOpen:t,onCancel:r,placeholder:i,title:a,type:s}=this.props,{isSubmitting:o,path:l,showExtensionChangeModal:d,showOverwriteModal:h,validationError:f,value:v,prevExtension:p,newExtension:m}=this.state,b=s==="directory",g=ee.fileExtensionToString(p),C=ee.fileExtensionToString(m),S=b?"Create":"Save",y=b?"New folder name":"Save file as";return u.jsxs(u.Fragment,{children:[u.jsxs(gi,{isOpen:t,toggle:r,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[u.jsx(Oa,{toggle:r,children:a}),u.jsx(bi,{children:u.jsx("form",{children:u.jsxs("div",{className:"d-flex flex-column new-file-modal-content",children:[u.jsxs("div",{className:"flex-grow-0 mb-4",children:[u.jsx("label",{htmlFor:"file-name-input",children:y}),u.jsx("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:Y("form-control",{"is-invalid":f}),value:v,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),f&&u.jsx("div",{className:"invalid-feedback",children:An.getValidationMessage(f)})]}),u.jsxs("div",{className:"flex-grow-0",children:[u.jsx("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),u.jsx("div",{className:"flex-grow-1 file-explorer-container",children:u.jsx(Rl,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),u.jsxs(ja,{children:[u.jsx(K,{kind:"secondary",onClick:r,children:"Cancel"}),u.jsx(K,{kind:"primary",disabled:o,onClick:this.handleModalSubmit,children:S})]})]}),u.jsx(Cn,{isOpen:h,headerText:"Confirm overwrite",bodyText:"File with this name already exists, are you sure you want to overwrite it?",onCancel:this.handleOverwriteCancel,onConfirm:this.handleOverwriteConfirm,cancelButtonText:"Cancel",confirmButtonText:"Overwrite"}),u.jsx(Cn,{isOpen:d,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(g,'" to "').concat(C,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(g,'"'),confirmButtonText:'Use "'.concat(C,'"')})]})}}cn(An,"propTypes",{isOpen:_.bool,title:_.string.isRequired,defaultValue:_.string,type:_.oneOf(["file","directory"]).isRequired,onSubmit:_.func,onCancel:_.func,placeholder:_.string,storage:_.shape({}).isRequired,notifyOnExtensionChange:_.bool});cn(An,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(n,e)=>{},onCancel:()=>{}});const Yp=An;function sx(n){var{createFile:e,createFolder:t,onSearchChange:r,defaultSearchText:i=""}=n;return u.jsxs("div",{className:"file-explorer-toolbar",children:[u.jsxs("div",{className:"file-explorer-toolbar-buttons",children:[u.jsx(K,{kind:"ghost",icon:_c,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),u.jsx(K,{kind:"ghost",icon:db,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),r&&u.jsx("div",{className:"file-explorer-toolbar-search",children:u.jsx(Df,{value:i,onChange:r,placeholder:"Search by name"})})]})}function vh(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function ox(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){vh(a,r,i,s,o,"next",l)}function o(l){vh(a,r,i,s,o,"throw",l)}s(void 0)})}}function Xp(n,e,t){return e=lx(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lx(n){var e=dx(n,"string");return typeof e=="symbol"?e:String(e)}function dx(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 On=W.module("FileExplorerPanel"),ux=(n,e)=>{var t=Jv(n),r=Fr(n,e.localDashboardId),{session:i,config:a}=r??{},s=a==null?void 0:a.type;return{fileStorage:t,language:s,session:i}},hx=Et(ux,null,null,{forwardRef:!0});function cx(n){var e=n;return e!=null&&typeof e.button=="number"}class wr extends X.Component{static handleError(e){On.error(e)}static isFocusEvent(e){return cx(e)?e.detail>=2:!0}constructor(e){super(e),this.handleFileSelect=this.handleFileSelect.bind(this),this.handleCopyFile=this.handleCopyFile.bind(this),this.handleCreateFile=this.handleCreateFile.bind(this),this.handleCreateDirectory=this.handleCreateDirectory.bind(this),this.handleCreateDirectoryCancel=this.handleCreateDirectoryCancel.bind(this),this.handleCreateDirectorySubmit=this.handleCreateDirectorySubmit.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleRename=this.handleRename.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this);var{session:t,language:r}=e;this.state={isShown:!1,language:r,session:t,showCreateFolder:!1,focusedFilePath:"/"}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){var{glEventHub:e}=this.props,{session:t,language:r}=this.state,i={language:r,value:""};On.debug("handleCreateFile",t,r,i),e.emit(he.CREATE_NOTEBOOK,t,r,i)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){On.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){On.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(wr.handleError)}handleCopyFile(e){var t=this;return ox(function*(){var{fileStorage:r}=t.props;if(pt(e)){On.error("Invalid item in handleCopyItem",e);return}var i=yield ee.getUniqueCopyFileName(r,e.filename);yield r.copyFile(e.filename,i)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(r=>{t.emit(he.CLOSE_FILE,{id:r.filename,itemName:r.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=ee.makePath(e[0].filename):t=ee.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(On.debug("fileSelect",e),e.type!=="directory"){var r=wr.isFocusEvent(t),i={id:e.filename,itemName:e.filename},{glEventHub:a}=this.props,{session:s,language:o}=this.state,l={value:null,language:o};a.emit(he.SELECT_NOTEBOOK,s,o,l,i,r)}}handleRename(e,t){var{glEventHub:r}=this.props;On.debug("handleRename",e,t),r.emit(he.RENAME_FILE,e,t)}handleSessionOpened(e,t){var{language:r}=t;this.setState({session:e,language:r})}handleSessionClosed(){this.setState({session:void 0,language:void 0})}handleShow(){this.setState({isShown:!0})}isHidden(){var{glContainer:e}=this.props,{isHidden:t}=e;return t}render(){var{fileStorage:e,glContainer:t,glEventHub:r}=this.props,{isShown:i,showCreateFolder:a,focusedFilePath:s}=this.state;return u.jsxs(Ht,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:r,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[u.jsx(sx,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&u.jsx(Rl,{isMultiSelect:!0,storage:e,onCopy:this.handleCopyFile,onCreateFile:this.handleCreateFile,onCreateFolder:this.handleCreateDirectory,onDelete:this.handleDelete,onRename:this.handleRename,onSelect:this.handleFileSelect,onSelectionChange:this.handleSelectionChange}),u.jsx(Yp,{isOpen:a,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:s})]})}}Xp(wr,"COMPONENT","FileExplorerPanel");Xp(wr,"TITLE","File Explorer");var fx=hx(wr);const Zp=fx;function ph(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 Zi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ph(Object(t),!0).forEach(function(r){Qr(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ph(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Qr(n,e,t){return e=vx(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function vx(n){var e=px(n,"string");return typeof e=="symbol"?e:String(e)}function px(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 we=W.module("FilterSetManager"),mx="Enter name...",mh="No Available Filter Sets";class Pa extends c.Component{static animateScreenFlash(){var e,t=document.createElement("div");t.classList.add("screen-flash-overlay"),t.addEventListener("animationend",()=>{t.remove()}),(e=document.querySelector("body"))===null||e===void 0||e.appendChild(t)}constructor(e){super(e),Qr(this,"renameInputRef",X.createRef()),Qr(this,"dropdownRef",X.createRef()),Qr(this,"editDropdownRef",X.createRef()),Qr(this,"isRenamingExistingSet",se((t,r)=>r!==void 0&&t.some(i=>{var{id:a}=i;return a===r.id}))),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.handleEditDropdownChange=this.handleEditDropdownChange.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleFilterApply=this.handleFilterApply.bind(this),this.handleCaptureNewSet=this.handleCaptureNewSet.bind(this),this.handleNameInputChange=this.handleNameInputChange.bind(this),this.handleNameInputKeyPress=this.handleNameInputKeyPress.bind(this),this.handleRenameConfirm=this.handleRenameConfirm.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRestoreFullStateChange=this.handleRestoreFullStateChange.bind(this),this.handleSetDelete=this.handleSetDelete.bind(this),this.handleSetEdit=this.handleSetEdit.bind(this),this.handleSetUpdate=this.handleSetUpdate.bind(this),this.state={editId:void 0,renameSet:void 0,nameInputValue:"",nameInputError:void 0,modifiedFilterSets:[],restoreFullState:!1}}componentDidMount(){var{isValueShown:e}=this.props;e?this.updateSelectedId():this.initSettingsScreen()}componentDidUpdate(e,t){var{isValueShown:r,filterSets:i}=this.props,{modifiedFilterSets:a}=this.state;if(e.isValueShown&&!r&&this.initSettingsScreen(),this.isNameInputScreen()&&!this.isNameInputScreen(t)&&this.focusRenameInput(),i!==e.filterSets)if(!r&&i.length>0&&e.filterSets.length===0&&a.length===0){var{onChange:s}=this.props;s({isValueShown:!0,selectedId:i[0].id})}else this.updateSelectedId()}initSettingsScreen(){var{filterSets:e,selectedId:t}=this.props;we.debug("initSettingsScreen",e,t),this.setState({modifiedFilterSets:[...e],editId:t})}updateSelectedId(){var{isValueShown:e,filterSets:t,selectedId:r,onChange:i}=this.props;if(we.debug("updateSelectedId",t,r),!!e&&!t.some(s=>{var{id:o}=s;return o===r})){var a=t.length===0;i({isValueShown:!a,selectedId:a?void 0:t[0].id})}}handleEditDropdownChange(e){this.setState({editId:e})}handleFilterChange(e){var t=e,{isValueShown:r,onChange:i}=this.props;this.applyFilterSet(t),i({isValueShown:r,selectedId:t})}handleFilterApply(){var{selectedId:e}=this.props;this.applyFilterSet(e)}handleSettingsCancel(){var{onChange:e,selectedId:t,filterSets:r}=this.props;this.setState({modifiedFilterSets:[]}),r.length>0&&e({isValueShown:!0,selectedId:t})}handleSettingsSave(){var{onChange:e,onUpdateSets:t}=this.props,{modifiedFilterSets:r,editId:i}=this.state;this.setState({modifiedFilterSets:[]}),we.debug("Update sets",r,i),t(r),r.length>0&&e({isValueShown:!0,selectedId:i})}handleCaptureNewSet(){var{getFilterState:e}=this.props;Pa.animateScreenFlash();var t=ye(),r=e(),i={id:t,title:"",panels:r};we.debug("handleSetCreate",i),this.setState({nameInputValue:"",nameInputError:void 0,renameSet:i})}handleRenameCancel(){this.setState({renameSet:void 0})}handleRestoreFullStateChange(e){this.setState({restoreFullState:e.target.value==="true"})}getNameError(e){var t,{renameSet:r,modifiedFilterSets:i}=this.state,a=(t=e==null?void 0:e.trim())!==null&&t!==void 0?t:"";if(a.length===0)return we.debug("Name cannot be empty",a),"Name cannot be empty";if(r!==void 0&&i.some(s=>{var{title:o,id:l}=s;return o===a&&l!==r.id}))return we.debug("Set with this name already exists",a),"Set with this name already exists"}handleRenameConfirm(){var e,{nameInputValue:t,renameSet:r,modifiedFilterSets:i,restoreFullState:a}=this.state;if(r===void 0){we.error("Renamed set undefined.");return}var s=this.getNameError(t);if(we.debug("handleRenameConfirm",t,s),s!==void 0){this.setState({nameInputError:s});return}var o=(e=t==null?void 0:t.trim())!==null&&e!==void 0?e:"",l=Zi(Zi({},r),{},{title:o,restoreFullState:a}),d=i.findIndex(f=>{var{id:v}=f;return v===r.id}),h=[...i];d>=0?(h[d]=l,we.debug("Renamed existing set",h)):(h.push(l),we.debug("Added new set to modified sets",h)),this.setState({editId:l.id,modifiedFilterSets:h,renameSet:void 0})}handleSetDelete(){this.setState(e=>{var{editId:t,modifiedFilterSets:r}=e,i=r.findIndex(l=>{var{id:d}=l;return d===t});if(i<0)return we.error("Unable to find selected filterSet index",r,t),null;var a=r.filter(l=>{var{id:d}=l;return d!==t}),s=Math.max(0,Math.min(a.length-1,i-1)),o=a.length>0?a[s].id:void 0;return we.debug("Deleted selected set",t,r,a),we.debug("New selection",s,o),{modifiedFilterSets:a,editId:o}})}handleSetUpdate(){var{getFilterState:e}=this.props;Pa.animateScreenFlash();var t=e();this.setState(r=>{var{modifiedFilterSets:i,editId:a}=r;if(a===void 0)return we.error("Filter for update not selected."),null;var s=[...i],o=s.findIndex(l=>{var{id:d}=l;return d===a});return o<0?(we.error("Selected set for update not found."),null):(s[o]=Zi(Zi({},s[o]),{},{panels:t}),we.debug("Update set",s,t),{modifiedFilterSets:s})})}handleSetEdit(){this.setState(e=>{var{editId:t,modifiedFilterSets:r}=e,i=r.find(o=>{var{id:l}=o;return l===t});if(i===void 0)return we.error("Could not find selected set",t,r),null;var{title:a,restoreFullState:s=!1}=i;return{nameInputValue:a,nameInputError:void 0,renameSet:i,restoreFullState:s}})}handleSettingsClick(e){e.stopPropagation();var{onChange:t,selectedId:r}=this.props;t({isValueShown:!1,selectedId:r})}handleBackgroundClick(e){we.debug("handleBackgroundClick"),e.target!==this.dropdownRef.current&&this.focusInput()}handleNameInputChange(e){var{value:t}=e.target,r=this.getNameError(t);this.setState({nameInputValue:t,nameInputError:r})}handleNameInputKeyPress(e){var{key:t}=e;t==="Enter"&&(e.preventDefault(),this.handleRenameConfirm())}isNameInputScreen(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.state,{renameSet:t}=e;return t!==void 0}applyFilterSet(e){var{onApply:t,filterSets:r}=this.props;if(e===void 0){we.debug("No filter selected");return}var i=r.find(a=>{var{id:s}=a;return s===e});if(i===void 0){we.debug("Selected id not found in filterSets",e,r);return}we.debug("Apply filterSet",i),t(i)}focusInput(){var e;(e=this.dropdownRef.current)===null||e===void 0||e.focus()}focusRenameInput(){var e;(e=this.renameInputRef.current)===null||e===void 0||e.focus()}render(){var{nameInputValue:e,nameInputError:t,editId:r,renameSet:i,modifiedFilterSets:a,restoreFullState:s}=this.state,{isValueShown:o,filterSets:l,selectedId:d}=this.props,h=this.isNameInputScreen(),f=this.isRenamingExistingSet(a,i),v=a.length===0,p=!h&&v&&l.length===0,m=!h&&!p,b=u.jsxs("div",{className:"fa-layers mr-3",children:[u.jsx(ne,{icon:Fs,mask:ed,transform:"shrink-1 down-5 right-7"}),u.jsx(ne,{icon:hb,className:"text-primary",transform:"shrink-6 down-5 right-7"})]}),g=u.jsxs("div",{className:"fa-layers",children:[u.jsx(ne,{icon:Fs,mask:ed,transform:"shrink-1 down-5 right-7"}),u.jsx(ne,{icon:cb,transform:"shrink-1 down-5 right-7"})]});return u.jsx("div",{className:"filter-set-manager fill-parent-absolute",children:u.jsxs(ka,{className:"w-100 h-100",isFlipped:o,children:[u.jsx("div",{className:"filter-set-manager-settings-card fill-parent-absolute",children:u.jsxs("div",{className:"filter-set-manager-card-content",children:[p&&u.jsxs("div",{children:[u.jsx(K,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:b,children:"Capture filter set"}),u.jsx("div",{className:"py-3 text-muted small",children:"Takes a snapshot of the currently applied filters on all panels, allowing you to restore saved filter sets later."})]}),h&&u.jsxs("div",{className:"d-flex flex-column justify-content-center","data-testid":"edit-filter-set-container",children:[u.jsxs("div",{className:"form-group",children:[u.jsx("label",{children:f?"Edit set":"Name captured set"}),u.jsxs("div",{className:"name-input-container",children:[u.jsx("input",{type:"text",className:"input-set-name form-control",placeholder:mx,value:e,ref:this.renameInputRef,onChange:this.handleNameInputChange,onKeyPress:this.handleNameInputKeyPress,spellCheck:"false"}),u.jsx(K,{"data-testid":"rename-confirm-button",kind:"ghost",className:"btn btn-link no-underline pt-2 pb-2",onClick:this.handleRenameConfirm,tooltip:"Save","test-id":"button-save",icon:Tc}),u.jsx(K,{"data-testid":"rename-cancel-button",kind:"ghost",className:"btn btn-link no-underline pt-2 pb-2",onClick:this.handleRenameCancel,tooltip:"Cancel",icon:ub})]}),t!==void 0&&u.jsx("div",{className:"error-message",children:t})]}),u.jsx("div",{className:"form-group",children:u.jsxs(Kc,{onChange:this.handleRestoreFullStateChange,value:"".concat(s),children:[u.jsx(Rs,{value:"false",children:"Restore only filters"}),u.jsx(Rs,{value:"true",children:"Restore full table state"})]})})]}),m&&u.jsxs("div",{className:"filter-set-manager-settings-grid-1",children:[u.jsxs("div",{className:"form-group",children:[u.jsx("label",{children:"Edit filter sets"}),u.jsxs("div",{className:"filter-select-container",children:[u.jsxs(Rn,{"data-testid":"settings-card-filter-select",ref:this.editDropdownRef,value:r??"-1",className:"custom-select filter-value-select",onChange:this.handleEditDropdownChange,disabled:v,children:[v&&u.jsx("option",{value:"-1",disabled:!0,children:mh}),a.map(C=>{var{id:S,title:y}=C;return u.jsx("option",{value:S,children:y},S)})]}),u.jsx(K,{kind:"ghost",onClick:this.handleSetUpdate,disabled:v,icon:g,tooltip:"Update"}),u.jsx(K,{kind:"ghost",onClick:this.handleSetEdit,disabled:v,icon:Oc,tooltip:"Edit"}),u.jsx(K,{kind:"ghost",onClick:this.handleSetDelete,disabled:v,icon:kn,tooltip:"Delete"})]})]}),u.jsx("div",{children:u.jsx(K,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:b,children:"Capture new filter set"})}),u.jsxs("div",{className:"py-3 text-right",children:[u.jsx(K,{kind:"secondary",onClick:this.handleSettingsCancel,children:"Cancel"})," ",u.jsx(K,{kind:"primary",onClick:this.handleSettingsSave,children:"Save"})]})]})]})},"front"),u.jsxs("div",{className:"filter-set-manager-value-card fill-parent-absolute",onClick:this.handleBackgroundClick,children:[u.jsx("div",{className:"filter-set-manager-column",children:u.jsx("div",{className:"filter-set-manager-column-title",children:"Filter sets"})}),u.jsx("div",{className:"filter-set-manager-card-content",children:u.jsx("div",{className:"filter-set-manager-value-input",children:u.jsxs("div",{className:"filter-select-container",children:[u.jsxs(Rn,{"data-testid":"value-card-filter-select",ref:this.dropdownRef,value:d??"-1",className:"custom-select filter-value-select",onChange:this.handleFilterChange,children:[l.length===0&&u.jsx("option",{value:"-1",disabled:!0,children:mh}),l.map(C=>{var{id:S,title:y}=C;return u.jsx("option",{value:S,children:y},S)})]}),u.jsx(K,{"data-testid":"filter-apply-button",kind:"ghost",onClick:this.handleFilterApply,icon:Dc,tooltip:"Apply Filter Set"})]})})}),u.jsx("div",{className:"filter-set-manager-menu",children:u.jsx(K,{kind:"ghost",className:"btn btn-link btn-link-icon m-2 px-2",onClick:this.handleSettingsClick,tooltip:"Settings",icon:u.jsx(ne,{icon:xa,transform:"grow-4"})})})]},"back")]})})}}const Qp=Pa;function kl(n){var e,t,r,i,a,{model:s,widgetName:o,glContainer:l,description:d}=n,h=((e=s==null?void 0:s.rowCount)!==null&&e!==void 0?e:0)-((t=s==null?void 0:s.pendingRowCount)!==null&&t!==void 0?t:0)-((r=s==null?void 0:s.floatingBottomRowCount)!==null&&r!==void 0?r:0)-((i=s==null?void 0:s.floatingTopRowCount)!==null&&i!==void 0?i:0),f=s==null?void 0:s.displayString(h,"long"),v=(a=s==null?void 0:s.columnCount)!==null&&a!==void 0?a:0,p=s==null?void 0:s.displayString(v,"long");return u.jsxs(Ii,{widgetType:"Table",widgetName:o,glContainer:l,description:d,children:[u.jsx("hr",{className:"tab-tooltip-divider"}),u.jsx("span",{children:"Number of Columns"}),u.jsx("span",{className:"tab-tooltip-statistic-value",children:p}),u.jsx("span",{children:"Number of Rows"}),u.jsx("span",{className:"tab-tooltip-statistic-value",children:f})]})}kl.propTypes={glContainer:qa.Container.isRequired,widgetName:_.string.isRequired,description:_.string};kl.defaultProps={description:null};function Jp(n){if(n==null)return!1;var e=n;return typeof e.table=="string"}function em(n){if(n==null)return!1;var e=n;return typeof e.name=="string"}function gh(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 on(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?gh(Object(t),!0).forEach(function(r){Ie(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):gh(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ie(n,e,t){return e=gx(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function gx(n){var e=bx(n,"string");return typeof e=="symbol"?e:String(e)}function bx(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 Ft=W.module("IrisGridPanel"),Cx=500,Sx={IrisGrid:gr,IrisGridTableModel:Vc,ContextMenuRoot:Ic};function bh(n){if(n==null)throw new Error("No metadata provided");if(em(n))return n.name;if(Jp(n))return n.table;throw new Error("Unable to determine table name from metadata: ".concat(JSON.stringify(n)))}class Pr extends c.PureComponent{constructor(e){super(e),Ie(this,"irisGrid",void 0),Ie(this,"pluginRef",void 0),Ie(this,"modelPromise",void 0),Ie(this,"irisGridState",void 0),Ie(this,"gridState",void 0),Ie(this,"pluginState",void 0),Ie(this,"irisGridUtils",void 0),Ie(this,"getGridInputFilters",se((r,i)=>Xe.getInputFiltersForColumns(r,i.filter(a=>{var{value:s,excludePanelIds:o}=a,l=F.getIdFromPanel(this);return s!=null&&(o==null||l!=null&&!o.includes(l))})))),Ie(this,"getAlwaysFetchColumns",se((r,i)=>{for(var a=F.getIdFromPanel(this),s=new Set(i),o=0;o<r.length;o+=1){var{start:l}=r[o];l!=null&&l.panelId===a&&s.add(l.columnName)}return[...s]})),Ie(this,"getPluginContent",se((r,i,a,s,o)=>{if(!i||!ta(i)||r==null||i.table==null)return null;var l={panel:this,onFilter:this.handlePluginFilter,onFetchColumns:this.handlePluginFetchColumns,user:a,workspace:s,components:Sx};return u.jsx("div",{className:"iris-grid-plugin",children:u.jsx(r,on({ref:this.pluginRef,filter:this.handlePluginFilter,fetchColumns:this.handlePluginFetchColumns,model:i,table:i.table,onStateChange:this.handlePluginStateChange,pluginState:o},l))})})),Ie(this,"getDehydratedIrisGridPanelState",se((r,i,a,s)=>Xe.dehydrateIrisGridPanelState(r,{isSelectingPartition:i,partitions:a,advancedSettings:s}))),Ie(this,"getDehydratedIrisGridState",se((r,i,a,s,o,l,d,h,f,v,p,m,b,g,C,S,y,w,E,D,T,O)=>(z(this.irisGridUtils),this.irisGridUtils.dehydrateIrisGridState(r,{advancedFilters:a,aggregationSettings:y,customColumnFormatMap:s,isFilterBarShown:o,metrics:{userColumnWidths:C,userRowHeights:S},quickFilters:l,customColumns:d,reverseType:h,rollupConfig:f,showSearchBar:v,searchValue:p,selectDistinctColumns:m,selectedSearchColumns:b,sorts:i,invertSearchColumns:g,pendingDataMap:w,frozenColumns:E,conditionalFormats:D,columnHeaderGroups:T,partitionConfig:O})))),Ie(this,"getDehydratedGridState",se((r,i,a,s,o)=>Xe.dehydrateGridState(r,{isStuckToBottom:s,isStuckToRight:o,movedColumns:i,movedRows:a}))),Ie(this,"getCachedPanelState",se((r,i,a,s)=>({irisGridPanelState:r,irisGridState:i,gridState:a,pluginState:s}))),Ie(this,"savePanelState",Le(()=>{var{irisGridState:r,gridState:i,pluginState:a}=this;z(r);var{onPanelStateUpdate:s}=this.props,{model:o,panelState:l,isSelectingPartition:d,partitions:h,advancedSettings:f}=this.state,{advancedFilters:v,aggregationSettings:p,customColumnFormatMap:m,isFilterBarShown:b,quickFilters:g,customColumns:C,reverseType:S,rollupConfig:y,showSearchBar:w,searchValue:E,selectDistinctColumns:D,selectedSearchColumns:T,sorts:O,invertSearchColumns:M,metrics:j,pendingDataMap:H,frozenColumns:L,conditionalFormats:I,columnHeaderGroups:N,partitionConfig:A}=r;z(o),z(j);var{userColumnWidths:k,userRowHeights:V}=j;z(i);var{isStuckToBottom:q,isStuckToRight:re,movedColumns:B,movedRows:x}=i,P=this.getCachedPanelState(this.getDehydratedIrisGridPanelState(o,d,h,f),this.getDehydratedIrisGridState(o,O,v,m,b,g,C,S,y,w,E,D,T,M,k,V,p,H,L,I,N,A),this.getDehydratedGridState(o,B,x,q,re),a);P!==l&&(Ft.debug("Saving panel state",this,P),this.setState({panelState:P}),s==null||s(P))},Cx)),this.handleAdvancedSettingsChange=this.handleAdvancedSettingsChange.bind(this),this.handleColumnsChanged=this.handleColumnsChanged.bind(this),this.handleTableChanged=this.handleTableChanged.bind(this),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleDataSelected=this.handleDataSelected.bind(this),this.handleError=this.handleError.bind(this),this.handleGridStateChange=this.handleGridStateChange.bind(this),this.handlePluginStateChange=this.handlePluginStateChange.bind(this),this.handleCreateChart=this.handleCreateChart.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.isColumnSelectionValid=this.isColumnSelectionValid.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handlePluginFilter=this.handlePluginFilter.bind(this),this.handlePluginFetchColumns=this.handlePluginFetchColumns.bind(this),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.irisGrid=X.createRef(),this.pluginRef=X.createRef();var{panelState:t}=e;this.pluginState=null,this.irisGridUtils=null,this.state={error:null,isDisconnected:!1,isLoaded:!1,isLoading:!0,isModelReady:!1,model:void 0,advancedFilters:new Map,aggregationSettings:{aggregations:[],showOnTop:!1},advancedSettings:new Map(Hc.DEFAULTS),customColumns:[],customColumnFormatMap:new Map,isFilterBarShown:!1,quickFilters:new Map,sorts:[],userColumnWidths:new Map,userRowHeights:new Map,reverseType:xe.REVERSE_TYPE.NONE,movedColumns:[],movedRows:[],isSelectingPartition:!1,partitions:[],rollupConfig:void 0,showSearchBar:!1,searchValue:"",selectedSearchColumns:void 0,invertSearchColumns:!0,Plugin:void 0,pluginFilters:[],pluginFetchColumns:[],modelQueue:[],pendingDataMap:new Map,frozenColumns:void 0,panelState:t,irisGridStateOverrides:{},gridStateOverrides:{},isStuckToBottom:!1,isStuckToRight:!1,conditionalFormats:[],selectDistinctColumns:[]}}componentDidMount(){this.initModel()}componentDidUpdate(e,t){var{model:r}=this.state,{makeModel:i}=this.props;r!==t.model&&(t.model!=null&&(this.stopModelListening(t.model),t.model.close()),r!=null&&this.startModelListening(r)),i!==e.makeModel&&this.initModel()}componentWillUnmount(){this.savePanelState.cancel(),this.modelPromise!=null&&(this.modelPromise.cancel(),this.modelPromise=void 0);var{model:e}=this.state;e&&(this.stopModelListening(e),e.close())}getTableName(){var{metadata:e}=this.props;return bh(e)}initModel(){this.setState({isModelReady:!1,isLoading:!0,error:null});var{makeModel:e}=this.props;this.modelPromise!=null&&this.modelPromise.cancel(),this.modelPromise=Se.makeCancelable(e(),t=>t.close()),this.modelPromise.then(this.handleLoadSuccess).catch(this.handleLoadError)}handleLoadSuccess(e){var t=e,{panelState:r,irisGridStateOverrides:i}=this.state,a=[];if(this.irisGridUtils=new Xe(t.dh),r!=null){var{irisGridState:s}=r,{aggregationSettings:o,customColumns:l,selectDistinctColumns:d=[],rollupConfig:h}=on(on({},s),i);l.length>0&&a.push(f=>{f.customColumns=l}),h!=null&&h.columns.length>0&&a.push(f=>{f.rollupConfig=Xe.getModelRollupConfig(f.originalColumns,h,o)}),d.length>0&&a.push(f=>{f.selectDistinctColumns=d})}this.setState({model:t,modelQueue:a}),this.initModelQueue(t,a)}initModelQueue(e,t){var r=e;if(t.length===0){this.modelInitialized(r);return}var i=t.shift();Ft.debug("initModelQueue",i),i&&i(r),this.setState({modelQueue:t})}handleAdvancedSettingsChange(e,t){Ft.debug("handleAdvancedSettingsChange",e,t),this.setState(r=>{var{advancedSettings:i}=r;return i.get(e)===t?null:{advancedSettings:new Map(i).set(e,t)}})}handlePluginFilter(e){var t,r,{model:i}=this.state;z(i);var{columns:a,formatter:s}=i,o=(t=(r=this.irisGridUtils)===null||r===void 0?void 0:r.getFiltersFromInputFilters(a,e,s.timeZone))!==null&&t!==void 0?t:[];this.setState({pluginFilters:o})}handlePluginFetchColumns(e){this.setState({pluginFetchColumns:e})}handleContextMenu(e){var t,r,i;return(t=(r=this.pluginRef.current)===null||r===void 0||(i=r.getMenu)===null||i===void 0?void 0:i.call(r,e))!==null&&t!==void 0?t:[]}isColumnSelectionValid(e){var{columnSelectionValidator:t}=this.props;return t&&e?t(this,e):!1}handleGridStateChange(e,t){this.irisGridState=e,this.gridState=t,this.setState({isLoaded:!0,isLoading:!1}),this.savePanelState();var{glEventHub:r,onStateChange:i}=this.props;r.emit(yt.STATE_CHANGED,this),i==null||i(e,t)}handlePluginStateChange(e){var{irisGridState:t,gridState:r}=this;this.pluginState=e,t!==null&&r!==null&&this.savePanelState()}handleColumnsChanged(e){var{isModelReady:t,model:r,modelQueue:i}=this.state;t?this.sendColumnsChange(e.detail):(z(r),this.initModelQueue(r,i))}handleTableChanged(e){Ft.debug("handleTableChanged",e);var{glEventHub:t}=this.props,{detail:r}=e;t.emit(Te.TABLE_CHANGED,this,r)}handleCreateChart(e,t){this.savePanelState.flush(),this.setState(()=>null,()=>{var{glEventHub:r,inputFilters:i}=this.props,a=this.getTableName(),{panelState:s}=this.state,o=F.getIdFromPanel(this),l;s&&(l=Xe.extractTableSettings(s,i)),r.emit(yt.CREATE_CHART,{metadata:{settings:e,sourcePanelId:o,table:a,tableSettings:l},table:ta(t)?t.table:void 0})})}handleColumnSelected(e){var{glEventHub:t}=this.props;t.emit(yt.COLUMN_SELECTED,this,e)}handleDataSelected(e,t){var{glEventHub:r}=this.props;r.emit(yt.DATA_SELECTED,this,t)}handleShow(){this.updateGrid()}handleTabClicked(){this.irisGrid.current&&this.irisGrid.current.focus()}handleError(e){Ft.error(e),this.setState({error:e,isLoading:!1})}handleDisconnect(){this.setState({error:new Error("Table disconnected"),isDisconnected:!0,isLoading:!1})}handleReconnect(){this.setState({isDisconnected:!1,error:null})}handleLoadError(e){Se.isCanceled(e)||this.handleError(e)}modelInitialized(e){var{glEventHub:t,loadPlugin:r}=this.props;if(this.modelPromise=void 0,this.loadPanelState(e),this.setState({isModelReady:!0}),ta(e)){var{table:i}=e,{pluginName:a}=i;if(a!==""&&r!=null&&a!=null){var s=r(a);this.setState({Plugin:s})}t.emit(Te.TABLE_CHANGED,this,i)}this.sendColumnsChange(e.columns)}handleClearAllFilters(){var e=this.irisGrid.current,{isDisconnected:t}=this.state;e!=null&&!t&&e.clearAllFilters()}sendColumnsChange(e){Ft.debug2("sendColumnsChange",e);var{glEventHub:t}=this.props;t.emit(Te.COLUMNS_CHANGED,this,e)}startModelListening(e){e.addEventListener(zt.EVENT.DISCONNECT,this.handleDisconnect),e.addEventListener(zt.EVENT.RECONNECT,this.handleReconnect),e.addEventListener(zt.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.addEventListener(zt.EVENT.TABLE_CHANGED,this.handleTableChanged)}stopModelListening(e){e.removeEventListener(zt.EVENT.DISCONNECT,this.handleDisconnect),e.removeEventListener(zt.EVENT.RECONNECT,this.handleReconnect),e.removeEventListener(zt.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.removeEventListener(zt.EVENT.TABLE_CHANGED,this.handleTableChanged)}getCoordinateForColumn(e){var t,r,i,{model:a}=this.state;if(!a)return null;var s=this.irisGrid.current,{gridWrapper:o}=s||{},l=(t=o==null?void 0:o.getBoundingClientRect())!==null&&t!==void 0?t:null;if(l==null||l.width<=0||l.height<=0)return null;z(s);var{metrics:d}=s.state;z(d);var{columnHeaderHeight:h,allColumnXs:f,allColumnWidths:v,right:p,columnHeaderMaxDepth:m}=d,b=a.getColumnIndexByName(e);z(b);var g=s.getVisibleColumn(b),C=(r=f.get(g))!==null&&r!==void 0?r:0,S=(i=v.get(g))!==null&&i!==void 0?i:0,y=Math.max(l.left,Math.min(g>p?l.right:l.left+C+S*.5,l.right)),w=l.top+h*m;return[y,w]}setFilterMap(e){var t=this.irisGrid.current;t!=null&&t.setFilterMap(e)}setAdvancedFilterMap(e){var t=this.irisGrid.current;t!=null&&t.setAdvancedFilterMap(e)}setFilters(e){var{quickFilters:t,advancedFilters:r}=e;Ft.debug("setFilters",t,r);var{model:i,isDisconnected:a}=this.state,s=this.irisGrid.current;if(s==null||a){Ft.debug("Ignore setFilters, model disconnected");return}z(i);var{columns:o,formatter:l}=i,d=Xe.changeFilterColumnNamesToIndexes(i.columns,t).filter(f=>{var[v]=f;return i.isFilterable(v)}),h=Xe.changeFilterColumnNamesToIndexes(i.columns,r).filter(f=>{var[v]=f;return i.isFilterable(v)});z(this.irisGridUtils),s.clearAllFilters(),s.setFilters({quickFilters:this.irisGridUtils.hydrateQuickFilters(o,d,l.timeZone),advancedFilters:this.irisGridUtils.hydrateAdvancedFilters(o,h,l.timeZone)})}setStateOverrides(e){Ft.debug("setStateOverrides",e);var{irisGridState:t,gridState:r}=e;this.setState({irisGridStateOverrides:t,gridStateOverrides:r},()=>{this.initModel()})}unsetFilterValue(){}loadPanelState(e){var{panelState:t,irisGridStateOverrides:r,gridStateOverrides:i}=this.state;if(t!=null)try{var{gridState:a,irisGridState:s,irisGridPanelState:o}=t,l=on({},r),{quickFilters:d,advancedFilters:h}=l;d&&(l.quickFilters=Xe.changeFilterColumnNamesToIndexes(e.columns,d)),h&&(l.advancedFilters=Xe.changeFilterColumnNamesToIndexes(e.columns,h));var{isSelectingPartition:f,partitions:v,advancedSettings:p}=Xe.hydrateIrisGridPanelState(e,o);z(this.irisGridUtils);var{advancedFilters:m,customColumns:b,customColumnFormatMap:g,isFilterBarShown:C,quickFilters:S,reverseType:y,rollupConfig:w,aggregationSettings:E,sorts:D,userColumnWidths:T,userRowHeights:O,showSearchBar:M,searchValue:j,selectDistinctColumns:H,selectedSearchColumns:L,invertSearchColumns:I,pendingDataMap:N,frozenColumns:A,conditionalFormats:k,columnHeaderGroups:V,partitionConfig:q}=this.irisGridUtils.hydrateIrisGridState(e,on(on({},s),l)),{isStuckToBottom:re,isStuckToRight:B,movedColumns:x,movedRows:P}=Xe.hydrateGridState(e,on(on({},a),i),s.customColumns);this.setState({advancedFilters:m,advancedSettings:p,conditionalFormats:k,customColumns:b,customColumnFormatMap:g,isFilterBarShown:C,isSelectingPartition:f,movedColumns:x,movedRows:P,partitions:v,quickFilters:S,reverseType:y,rollupConfig:w,aggregationSettings:E,sorts:D,userColumnWidths:T,userRowHeights:O,showSearchBar:M,searchValue:j,selectDistinctColumns:H,selectedSearchColumns:L,invertSearchColumns:I,pendingDataMap:N,frozenColumns:A,isStuckToBottom:re,isStuckToRight:B,columnHeaderGroups:V,partitionConfig:q})}catch(R){Ft.error("loadPanelState failed to load panelState",t,R)}}updateGrid(){var e,t,r=(e=(t=this.irisGrid.current)===null||t===void 0?void 0:t.grid)!==null&&e!==void 0?e:null;r&&r.handleResize()}render(){var e,t,{children:r,glContainer:i,glEventHub:a,columnSelectionValidator:s,getDownloadWorker:o,inputFilters:l,links:d,metadata:h,panelState:f,user:v,workspace:p,settings:m,theme:b}=this.props,{advancedFilters:g,aggregationSettings:C,advancedSettings:S,conditionalFormats:y,customColumns:w,customColumnFormatMap:E,error:D,isDisconnected:T,isFilterBarShown:O,isSelectingPartition:M,isStuckToBottom:j,isStuckToRight:H,isLoaded:L,isLoading:I,isModelReady:N,model:A,movedColumns:k,movedRows:V,partitions:q,partitionConfig:re,quickFilters:B,reverseType:x,rollupConfig:P,sorts:R,userColumnWidths:U,userRowHeights:Q,showSearchBar:me,searchValue:$,selectDistinctColumns:J,selectedSearchColumns:ie,invertSearchColumns:fe,Plugin:Ee,pluginFilters:jr,pluginFetchColumns:zn,pendingDataMap:Rr,frozenColumns:Pn,columnHeaderGroups:Hm}=this.state,Vm=D!=null?"Unable to open table. ".concat(D):void 0,Kl=bh(h),ql=(e=A==null?void 0:A.description)!==null&&e!==void 0?e:void 0,Bm=(t=f==null?void 0:f.pluginState)!==null&&t!==void 0?t:null,Wm=r??this.getPluginContent(Ee,A,v,p,Bm),{permissions:Gm}=v,{canCopy:zm,canDownloadCsv:Km}=Gm;return u.jsx(xi,{errorMessage:Vm,isDisconnected:T,isLoading:I,isLoaded:L,className:"iris-grid-panel",glContainer:i,glEventHub:a,onClearAllFilters:this.handleClearAllFilters,onShow:this.handleShow,onTabFocus:this.handleShow,onTabClicked:this.handleTabClicked,widgetName:Kl,widgetType:"Table",description:ql,componentPanel:this,renderTabTooltip:()=>u.jsx(kl,{model:A,widgetName:Kl,glContainer:i,description:ql}),children:N&&A&&u.jsx(gr,{advancedFilters:g,aggregationSettings:C,advancedSettings:S,alwaysFetchColumns:this.getAlwaysFetchColumns(d,zn),columnAllowedCursor:"linker",columnNotAllowedCursor:"linker-not-allowed",copyCursor:"copy",customColumns:w,customColumnFormatMap:E,columnSelectionValidator:this.isColumnSelectionValid,conditionalFormats:y,inputFilters:this.getGridInputFilters(A.columns,l),applyInputFiltersOnInit:f==null,isFilterBarShown:O,isSelectingColumn:s!=null,isSelectingPartition:M,isStuckToBottom:j,isStuckToRight:H,movedColumns:k,movedRows:V,partitions:q,partitionConfig:re,quickFilters:B,reverseType:x,rollupConfig:P,settings:m,sorts:R,userColumnWidths:U,userRowHeights:Q,model:A,showSearchBar:me,searchValue:$,selectedSearchColumns:ie,selectDistinctColumns:J,invertSearchColumns:fe,onColumnSelected:this.handleColumnSelected,onCreateChart:this.handleCreateChart,onDataSelected:this.handleDataSelected,onError:this.handleError,onStateChange:this.handleGridStateChange,onContextMenu:this.handleContextMenu,onAdvancedSettingsChange:this.handleAdvancedSettingsChange,customFilters:jr,pendingDataMap:Rr,canCopy:zm,canDownloadCsv:Km,ref:this.irisGrid,getDownloadWorker:o,frozenColumns:Pn,theme:b,columnHeaderGroups:Hm,children:Wm})})}}Ie(Pr,"defaultProps",{onStateChange:()=>{},onPanelStateUpdate:()=>{}});Ie(Pr,"displayName","IrisGridPanel");Ie(Pr,"COMPONENT","IrisGridPanel");var yx=(n,e)=>{var{localDashboardId:t=Il}=e;return{inputFilters:ts(n,t),links:Gn(n,t),columnSelectionValidator:is(n,t),user:w_(n),workspace:ep(n),settings:Ti(n)}},Ex=Et(yx,null,null,{forwardRef:!0})(Pr);const _r=Ex;function ri(n,e,t){return e=wx(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wx(n){var e=Px(n,"string");return typeof e=="symbol"?e:String(e)}function Px(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 Ch=W.module("InputFilter"),_x=150;class Tr extends c.Component{constructor(e){super(e),ri(this,"inputRef",void 0),ri(this,"getItemLabel",st((a,s)=>{var{name:o,type:l}=a[s];if(s>0&&a[s-1].name===o||s<a.length-1&&a[s+1].name===o){var d=l.substring(l.lastIndexOf(".")+1);return"".concat(o," (").concat(d,")")}return o})),ri(this,"sendUpdate",Le(()=>{var{onChange:a}=this.props,{column:s,value:o,isValueShown:l}=this.state;a({column:s,isValueShown:l,value:o})},_x)),this.handleColumnChange=this.handleColumnChange.bind(this),this.handleInputKeyPress=this.handleInputKeyPress.bind(this),this.handleValueChange=this.handleValueChange.bind(this),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.inputRef=X.createRef();var{column:t,isValueShown:r,value:i}=e;this.state={column:t,selectedColumn:t,value:i,isValueShown:r}}componentDidUpdate(e,t){var{column:r}=this.props,{column:i,value:a,isValueShown:s}=this.state;r!==e.column&&this.setState({column:r,selectedColumn:r}),s!==void 0&&s&&s!==t.isValueShown&&this.focusInput(),(i!==t.column||a!==t.value||s!==t.isValueShown)&&this.sendUpdate()}componentWillUnmount(){this.sendUpdate.flush()}handleColumnChange(e){var{columns:t}=this.props,r=t[parseInt(e,10)];Ch.debug2("handleColumnChange",r),this.setState({selectedColumn:r,value:void 0})}handleInputKeyPress(e){e.key==="Enter"&&(e.preventDefault(),e.stopPropagation(),this.setState(t=>{var{value:r}=t;return r==null?{value:""}:null},()=>{this.sendUpdate(),this.sendUpdate.flush()}))}handleValueChange(e){var{value:t}=e.target;Ch.debug2("handleValueChange",t),this.setState({value:t})}handleSettingsCancel(){var{column:e}=this.state;this.setState({selectedColumn:e,isValueShown:!0})}handleSettingsSave(){var{selectedColumn:e}=this.state;this.setState({column:e,isValueShown:!0})}handleSettingsClick(e){var{column:t}=this.state;this.setState({selectedColumn:t,isValueShown:!1}),e.stopPropagation()}handleBackgroundClick(e){e.target!==this.inputRef.current&&this.focusInput()}focusInput(){this.inputRef.current!==null&&(this.inputRef.current.select(),this.inputRef.current.focus())}clearFilter(){this.setState({value:""})}setFilterState(e){var{name:t,type:r,value:i,isValueShown:a}=e,s=t!=null&&r!=null?{name:t,type:r}:void 0,o=a===void 0?{column:s,value:i}:{column:s,value:i,isValueShown:a};this.setState(o)}render(){var{columns:e}=this.props,{column:t,isValueShown:r,selectedColumn:i,value:a}=this.state,s=a==null||a.length===0?Tr.PLACEHOLDER.length:a.length,o=null;if(t!=null){var l=e.findIndex(d=>d.name===t.name&&d.type===t.type);o=l>=0?this.getItemLabel(e,l):t.name}return u.jsxs(ka,{className:"input-filter fill-parent-absolute",isFlipped:r??!1,children:[u.jsx("div",{className:"input-filter-settings-card",children:u.jsxs("div",{className:"input-filter-settings-content",children:[u.jsxs("div",{className:"input-filter-settings-grid",children:[u.jsx("label",{children:"Filter Column"}),u.jsxs(Rn,{value:String(e.findIndex(d=>d.name===(i==null?void 0:i.name)&&d.type===(i==null?void 0:i.type))),className:"custom-select",onChange:this.handleColumnChange,children:[e.map((d,h)=>u.jsx("option",{value:h,children:this.getItemLabel(e,h)},"".concat(d.name,"/").concat(d.type))),e.length===0&&u.jsx("option",{value:"-1",disabled:!0,children:"No Available Columns"})]}),u.jsx("div",{className:"text-muted small",children:"Input filter control will apply its filter to all columns matching this name in this dashboard."})]}),u.jsxs("div",{className:"input-filter-settings-buttons",children:[u.jsx(K,{kind:"secondary",onClick:this.handleSettingsCancel,disabled:t==null,children:"Cancel"}),u.jsx(K,{kind:"primary",className:"ml-2",onClick:this.handleSettingsSave,disabled:i==null,children:"Save"})]})]})}),u.jsxs("div",{className:"input-filter-value-card",onClick:this.handleBackgroundClick,children:[u.jsx("div",{className:"input-filter-column",children:u.jsxs("div",{className:"input-filter-column-title",children:[o," Filter"]})}),u.jsx("div",{className:"d-flex justify-content-center align-items-center h-100 w-100",children:u.jsx("div",{className:"input-filter-value-input d-flex flex-column justify-content-center",children:u.jsx("input",{type:"text",ref:this.inputRef,placeholder:Tr.PLACEHOLDER,value:a??"",onChange:this.handleValueChange,onKeyPress:this.handleInputKeyPress,style:{width:"".concat(s+3,"ch")},spellCheck:"false"})})}),u.jsx("div",{className:"input-filter-menu",children:u.jsx(K,{kind:"ghost",className:"m-2 px-2",onClick:this.handleSettingsClick,icon:u.jsx(ne,{icon:xa,transform:"grow-4"}),tooltip:"Input Filter Settings"})})]})]})}}ri(Tr,"PLACEHOLDER","Enter value...");ri(Tr,"defaultProps",{column:null,isValueShown:!1,value:null});const Tx=Tr;function ds(n,e,t){return e=Ox(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ox(n){var e=Dx(n,"string");return typeof e=="symbol"?e:String(e)}function Dx(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 Ix=250;class us extends c.Component{constructor(e){super(e),ds(this,"inputFilterRef",void 0),this.handleChange=Le(this.handleChange.bind(this),Ix),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.inputFilterRef=X.createRef();var{panelState:t}=e,{value:r,isValueShown:i=!1,name:a,type:s,timestamp:o}=t??{};this.state={columns:[],column:a!=null&&s!=null?{name:a,type:s}:void 0,value:r,timestamp:o,isValueShown:i,wasFlipped:!1,skipUpdate:!1,panelState:t}}componentDidMount(){this.updateColumns();var{column:e,value:t,timestamp:r}=this.state;if(e!=null){var{name:i,type:a}=e;this.sendUpdate(i,a,t,r)}}componentDidUpdate(e){var{columns:t}=this.props;t!==e.columns&&this.updateColumns()}handleChange(e){var{column:t,isValueShown:r=!1,value:i}=e,a,s;t!=null&&({name:a,type:s}=t);var o=!0,l=Date.now();this.setState(d=>{var h,{panelState:f,timestamp:v,wasFlipped:p,skipUpdate:m}=d,b=f!=null&&r!==f.isValueShown&&a===f.name&&s===f.type&&i===f.value;return o=(h=!m&&r&&(!b||!p))!==null&&h!==void 0?h:!1,o||(l=v),{panelState:{isValueShown:r,name:a,type:s,value:i,timestamp:l},timestamp:l,wasFlipped:b,skipUpdate:!1}},()=>{o&&this.sendUpdate(a,s,i,l)})}handleClearAllFilters(){var e;(e=this.inputFilterRef.current)===null||e===void 0||e.clearFilter()}sendUpdate(e,t,r,i){var{glEventHub:a}=this.props;a.emit(Te.FILTERS_CHANGED,this,{name:e,type:t,value:r,timestamp:i})}setPanelState(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.setState({skipUpdate:!r}),(t=this.inputFilterRef.current)===null||t===void 0||t.setFilterState(e)}updateColumns(){var{columns:e}=this.props;e!=null&&this.setState(t=>{var{column:r}=t;return r==null&&e.length>0?{columns:[...e],column:e[0]}:r!=null&&!e.find(i=>{var{name:a,type:s}=i;return r.name===a&&r.type===s})?{columns:[...e,r]}:{columns:[...e]}})}render(){var{glContainer:e,glEventHub:t}=this.props,{column:r,columns:i,isValueShown:a,value:s}=this.state;return u.jsx(Ht,{className:"iris-input-filter-panel",componentPanel:this,glContainer:e,glEventHub:t,onClearAllFilters:this.handleClearAllFilters,isClonable:!0,isRenamable:!0,children:u.jsx(Tx,{ref:this.inputFilterRef,column:r,columns:i,onChange:this.handleChange,isValueShown:a,value:s})})}}ds(us,"defaultProps",{panelState:null});ds(us,"COMPONENT","InputFilterPanel");ds(us,"displayName","InputFilterPanel");var xx=(n,e)=>{var{localDashboardId:t}=e;return{columns:Ll(n,t)}},Nx=Et(xx,null,null,{forwardRef:!0})(us);const fr=Nx;function Sh(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 Qi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Sh(Object(t),!0).forEach(function(r){$l(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Sh(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function $l(n,e,t){return e=Mx(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mx(n){var e=Lx(n,"string");return typeof e=="symbol"?e:String(e)}function Lx(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 We=W.module("FilterSetManagerPanel");function Ax(n){return n.setPanelState!=null}class Or extends c.Component{static changeFilterIndexesToColumnNames(e,t){return t.map(r=>{var[i,a]=r;if(i>=e.columns.length)return null;var{name:s}=e.columns[i];return{name:s,filter:a}}).filter(r=>r!=null)}constructor(e){super(e),this.handleChange=this.handleChange.bind(this),this.handleFilterApply=this.handleFilterApply.bind(this),this.handleSetsUpdate=this.handleSetsUpdate.bind(this),this.handleGetFilterState=this.handleGetFilterState.bind(this);var{panelState:t,filterSets:r}=e,{selectedId:i=r.length>0?r[0].id:void 0,isValueShown:a=!1}=t??{};this.state={selectedId:i,isValueShown:a,panelState:t}}getFilterState(){var{dashboardOpenedPanelMap:e}=this.props,t=[];return[...e.keys()].forEach(r=>{var i=e.get(r);if(i===void 0){We.error("Could not get panel",i);return}var a=F.getComponentNameFromPanel(i),s=F.getIdFromPanel(i);We.debug("Panel:",i,a);var{glContainer:o=null}=i.props;if(o==null){We.error("Could not get panel container",i);return}var l=F.getComponentConfigFromContainer(o);if(l==null){We.error("Could not get component config from container",o);return}var d=F.getPanelComponentState(l);if(d==null){We.debug("Panel state is null ".concat(s));return}switch(a){case F.getComponentName(Pr):{var h;s!=null&&(h=this.getIrisGridPanelFilters(s,d)),h!=null&&t.push({panelId:s,type:a,state:h});break}case F.getComponentName(fr):case F.getComponentName(bn):{var{isValueShown:f,name:v,type:p,value:m}=d;t.push({panelId:s,type:a,state:{isValueShown:f,name:v,type:p,value:m}});break}}}),t}getIrisGridPanelFilters(e,t){var{panelTableMap:r}=this.props,i=r.get(e);if(i==null)return We.error("Unable to get table for panel ".concat(e,".")),null;var{irisGridState:a={advancedFilters:void 0,quickFilters:void 0},gridState:s={}}=t,{advancedFilters:o,quickFilters:l}=a,d;o&&(d=Or.changeFilterIndexesToColumnNames(i,o));var h;return l&&(h=Or.changeFilterIndexesToColumnNames(i,l)),{irisGridState:Qi(Qi({},a),{},{advancedFilters:d,quickFilters:h}),gridState:Qi({},s)}}handleGetFilterState(){return this.getFilterState()}handleChange(e){var{isValueShown:t,selectedId:r}=e;We.debug("handleChange",t,r),this.setState({isValueShown:t,selectedId:r}),this.updatePanelState()}handleFilterApply(e){var{dashboardOpenedPanelMap:t}=this.props,{panels:r,restoreFullState:i=!1}=e;We.debug("Apply filters from filter set",e),r.forEach(a=>{var{panelId:s,type:o,state:l}=a;if(s==null){We.debug("panel is null",s);return}if(!t.has(s)){We.debug("Ignore closed panel",s);return}We.debug("Apply panel filters",s,o,l);var d=t.get(s);switch(o){case F.getComponentName(Pr):this.restoreIrisGridFilters(d,l,i);break;case F.getComponentName(fr):case F.getComponentName(bn):this.restoreInputFilterState(d,l);break}})}handleSetsUpdate(e){var{setDashboardFilterSets:t,localDashboardId:r}=this.props;We.debug("Saving updated sets",e),t(r,[...e])}updatePanelState(){this.setState(e=>{var{selectedId:t,isValueShown:r}=e;return{panelState:{selectedId:t,isValueShown:r}}})}restoreIrisGridFilters(e,t,r){var{irisGridState:i={},advancedFilters:a=[],quickFilters:s=[]}=t,{advancedFilters:o=a,quickFilters:l=s}=i,{panelTableMap:d}=this.props,h=F.getIdFromPanel(e);if(h==null){We.error("Panel Id is null.");return}var f=d.get(h);if(f==null){We.error("Unable to get table for panel ".concat(h,"."));return}We.debug("restoreIrisGridFilters",h,t,r),r?e.setStateOverrides(t):e.setFilters({quickFilters:l,advancedFilters:o})}restoreInputFilterState(e,t){var r=Qi({},t);delete r.isValueShown,We.debug("restoreInputFilterState",e,r),e&&Ax(e)&&e.setPanelState(r)}render(){var{glContainer:e,glEventHub:t,filterSets:r}=this.props,{isValueShown:i,selectedId:a}=this.state;return u.jsx(Ht,{className:"filter-set-manager-panel",componentPanel:this,glContainer:e,glEventHub:t,isClonable:!0,isRenamable:!0,children:u.jsx("div",{className:"input-filter-container h-100 w-100 container",children:u.jsx(Qp,{onChange:this.handleChange,onApply:this.handleFilterApply,onUpdateSets:this.handleSetsUpdate,isValueShown:i,filterSets:r,selectedId:a,getFilterState:this.handleGetFilterState})})})}}$l(Or,"defaultProps",{panelState:null});$l(Or,"COMPONENT","FilterSetManagerPanel");var Fx=(n,e)=>{var{localDashboardId:t}=e;return{filterSets:kp(n,t),dashboardOpenedPanelMap:_l(n,t),dashboardInputFilters:ts(n,t),panelTableMap:ns(n,t)}},jx=Et(Fx,{setDashboardFilterSets:Bp},null,{forwardRef:!0})(Or);const aa=jx;function fi(n,e,t){return e=Rx(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Rx(n){var e=kx(n,"string");return typeof e=="symbol"?e:String(e)}function kx(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 yh=W.module("LogPanel");class hs extends c.PureComponent{constructor(e){super(e),fi(this,"isBottomVisible",void 0),fi(this,"logView",void 0),this.handleResize=this.handleResize.bind(this),this.handleShow=this.handleShow.bind(this),this.handleHide=this.handleHide.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.isBottomVisible=!0,this.logView=null;var{session:t}=this.props;this.state={session:t}}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions(),this.logView&&(this.logView.triggerFindWidget(),this.isBottomVisible&&this.logView.scrollToBottom())}handleHide(){this.logView&&(this.isBottomVisible=this.logView.isBottomVisible())}handleSessionOpened(e){yh.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){yh.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){var{glContainer:e,glEventHub:t}=this.props,{session:r}=this.state;return u.jsxs(Ht,{componentPanel:this,glContainer:e,glEventHub:t,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[r==null&&u.jsx("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),r!=null&&u.jsx(bD,{session:r,ref:i=>{this.logView=i}})]})}}fi(hs,"defaultProps",{session:null});fi(hs,"COMPONENT","LogPanel");fi(hs,"TITLE","Log");var $x=(n,e)=>{var t;return{session:(t=Fr(n,e.localDashboardId))===null||t===void 0?void 0:t.session}},Ux=Et($x,null,null,{forwardRef:!0})(hs);const tm=Ux;function Hx(n,e,t){return e=Vx(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Vx(n){var e=Bx(n,"string");return typeof e=="symbol"?e:String(e)}function Bx(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 nm extends c.PureComponent{render(){var{isEditing:e,children:t,onDoubleClick:r}=this.props;return u.jsxs("div",{className:"markdown-editor-container h-100 w-100",onDoubleClick:r,children:[u.jsx("div",{className:Y("text-muted","edit-hint",{viewing:e===void 0||!e}),children:u.jsxs("span",{children:["double-click to edit ",u.jsx(ne,{icon:Oc})]})}),t]})}}Hx(nm,"defaultProps",{isEditing:!1});function Wx(n,e,t){return e=Gx(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gx(n){var e=zx(n,"string");return typeof e=="symbol"?e:String(e)}function zx(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 Kx=W.module("MarkdownStartPage");class rm extends c.PureComponent{constructor(e){super(e),this.handleDeleteButtonClick=this.handleDeleteButtonClick.bind(this),this.handleDeleteModalClose=this.handleDeleteModalClose.bind(this),this.state={isDeleteModalShown:!1}}handleDeleteButtonClick(e){this.setState({isDeleteModalShown:!0,toBeDeleted:e})}handleDeleteModalClose(){this.setState({isDeleteModalShown:!1,toBeDeleted:void 0})}handleDeleteMarkdown(e){if(Kx.debug("delete markdown: ",e),e!==void 0){var{onDelete:t}=this.props;t(e)}this.setState({isDeleteModalShown:!1,toBeDeleted:void 0})}render(){var{closedMarkdowns:e,onOpen:t,onCreate:r}=this.props,{isDeleteModalShown:i,toBeDeleted:a}=this.state;return u.jsx("div",{className:"markdown-panel-start-page h-100 w-100",children:u.jsxs("div",{className:"markdown-panel-start-page-container",children:[u.jsxs("div",{className:"markdown-panel-start-list",children:[u.jsx("h3",{className:"list-title",children:"Start"}),u.jsx("div",{className:"list-item",children:u.jsx(K,{kind:"ghost",className:"title",onClick:r,children:"New Markdown Note"})})]}),u.jsxs("div",{className:"markdown-panel-start-list",children:[u.jsx("h3",{className:"list-title",children:"Recently Closed from Dashboard"}),e.map(s=>u.jsxs("div",{className:"list-item",children:[u.jsx(K,{kind:"ghost",className:"title",onClick:()=>t(s),children:s.title}),u.jsx("button",{className:"btn-link icon",type:"button",onClick:()=>{this.handleDeleteButtonClick(s)},children:u.jsx(ne,{icon:kn})})]},s.id)),u.jsxs(gi,{isOpen:i,toggle:this.handleDeleteModalClose,className:"modal-dialog-centered markdown-delete-modal",children:[u.jsx(Oa,{children:"Are you sure you want to permanently delete this note?"}),u.jsx(bi,{children:"You can't undo this action."}),u.jsxs(ja,{children:[u.jsx(K,{kind:"secondary",onClick:this.handleDeleteModalClose,children:"Cancel"}),u.jsx(K,{kind:"danger",onClick:()=>{this.handleDeleteMarkdown(a)},children:"Delete"})]})]})]})]})})}}Wx(rm,"defaultProps",{closedMarkdowns:[],onOpen:()=>{},onCreate:()=>{},onDelete:()=>{}});const qx=rm;function ii(n,e,t){return e=Yx(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yx(n){var e=Xx(n,"string");return typeof e=="symbol"?e:String(e)}function Xx(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 Zx=c.lazy(()=>Aa(()=>import("./MarkdownEditor-6ffb4f23.js"),["./MarkdownEditor-6ffb4f23.js","./vendor-f46f78b9.js","./helpers-de833af9.js","./vendor-35ea25e0.css","./IrisGridThemeProvider-fb501222.js","./useUser-ae22a8dc.js","./index-c9408b8e.js","./monaco-0b69f16f.js","./monaco-0e9455f6.css","./index-b9c423a0.css","./IrisGridThemeProvider-17c81a68.css"],import.meta.url)),Ji=W.module("MarkdownPanel");class Ul extends c.Component{constructor(e){super(e),ii(this,"markdownEditor",void 0),ii(this,"editor",void 0),ii(this,"getClosedMarkdowns",se(i=>i.filter(a=>a.component==="MarkdownPanel").reverse())),this.handleContainerDoubleClick=this.handleContainerDoubleClick.bind(this),this.handleCreateMarkdown=this.handleCreateMarkdown.bind(this),this.handleDeleteMarkdown=this.handleDeleteMarkdown.bind(this),this.handleOpenMarkdown=this.handleOpenMarkdown.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorBlur=this.handleEditorBlur.bind(this),this.handleEditorResize=this.handleEditorResize.bind(this);var{panelState:t}=e,r=null;t!=null&&t.content!=null&&({content:r}=t),this.state={isStartPageShown:r==null,isEditing:!1,content:r,panelState:t},this.markdownEditor=null}setEditorPosition(e){z(this.markdownEditor);var{container:t}=this.markdownEditor;if(this.editor&&t!=null){var r,i,a=t.getBoundingClientRect().top,s=t.scrollTop,o=t.scrollHeight,l=(r=(i=this.editor.getModel())===null||i===void 0?void 0:i.getLineCount())!==null&&r!==void 0?r:0,d=Math.round((s+e-a)/o*l);d>l&&(d=l),this.editor.revealLine(d),this.editor.setPosition({lineNumber:d,column:1}),this.editor.focus()}}handleContainerDoubleClick(e){var{isEditing:t}=this.state,r=e.clientY;t||this.setState({isEditing:!0},()=>{this.setEditorPosition(r)})}handleEditorInitialized(e){Ji.debug("Markdown Editor Initialized..."),this.editor=e}handleCreateMarkdown(){Ji.debug("create markdown..."),this.setState({isStartPageShown:!1,content:"",isEditing:!0,panelState:{content:""}},()=>{this.editor!=null&&this.editor.focus!=null&&this.editor.focus()})}handleOpenMarkdown(e){Ji.debug("open markdown...",e);var{glContainer:t,glEventHub:r}=this.props,i=F.getComponentConfigFromContainer(t);r.emit(te.REOPEN,e,i)}handleDeleteMarkdown(e){var{glEventHub:t}=this.props;t.emit(te.DELETE,e)}handleEditorBlur(e){var t;Ji.debug("markdown content changed, saving...");var{isEditing:r}=this.state;if(!(!r||this.markdownEditor!=null&&this.markdownEditor.container!=null&&this.markdownEditor.container.contains(e.relatedTarget))){var i=(t=this.editor)===null||t===void 0?void 0:t.getValue();this.setState({content:i,isEditing:!1,panelState:{content:i}})}}handleEditorResize(){var{isEditing:e}=this.state;e&&this.editor&&this.editor.layout()}render(){var{glContainer:e,glEventHub:t,closedPanels:r}=this.props,{isEditing:i,isStartPageShown:a,content:s}=this.state,o=this.getClosedMarkdowns(r);return u.jsx(Ht,{glContainer:e,glEventHub:t,className:"markdown-panel",componentPanel:this,onResize:this.handleEditorResize,onBlur:this.handleEditorBlur,isClonable:!0,isRenamable:!0,children:a?u.jsx(qx,{closedMarkdowns:o,onCreate:this.handleCreateMarkdown,onOpen:this.handleOpenMarkdown,onDelete:this.handleDeleteMarkdown}):u.jsx(nm,{isEditing:i,onDoubleClick:this.handleContainerDoubleClick,children:u.jsx(c.Suspense,{fallback:u.jsx(Ne,{}),children:u.jsx(Zx,{ref:l=>{this.markdownEditor=l},isEditing:i,content:s??void 0,onEditorInitialized:this.handleEditorInitialized})})})})}}ii(Ul,"defaultProps",{panelState:null});ii(Ul,"COMPONENT","MarkdownPanel");var Qx=(n,e)=>{var{localDashboardId:t}=e;return{closedPanels:up(n,t)}},Jx=Et(Qx,null,null,{forwardRef:!0})(Ul);const Qn=Jx;function Eh(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function wh(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){Eh(a,r,i,s,o,"next",l)}function o(l){Eh(a,r,i,s,o,"throw",l)}s(void 0)})}}function Ph(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 it(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ph(Object(t),!0).forEach(function(r){ze(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ph(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ze(n,e,t){return e=eN(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function eN(n){var e=tN(n,"string");return typeof e=="symbol"?e:String(e)}function tN(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 nN=c.lazy(()=>Aa(()=>import("./MarkdownNotebook-52e14d92.js"),["./MarkdownNotebook-52e14d92.js","./vendor-f46f78b9.js","./helpers-de833af9.js","./vendor-35ea25e0.css","./index-c9408b8e.js","./monaco-0b69f16f.js","./monaco-0e9455f6.css","./index-b9c423a0.css","./IrisGridThemeProvider-fb501222.js","./useUser-ae22a8dc.js","./IrisGridThemeProvider-17c81a68.css","./MarkdownNotebook-9207e775.css"],import.meta.url)),oe=W.module("NotebookPanel"),_h=400;class ke extends c.Component{static handleError(e){Se.isCanceled(e)||oe.error(e)}static unsavedNotebookCount(){return document.querySelectorAll(".".concat(ke.UNSAVED_INDICATOR_CLASS_NAME,".").concat(ke.UNSAVED_STATUS_CLASS_NAME)).length}static languageFromFileName(e){var t=ee.getExtension(e).toLowerCase();switch(t){case"py":case"python":return"python";case"groovy":return"groovy";case"scala":return"scala";default:return null}}constructor(e){super(e),ze(this,"pending",void 0),ze(this,"debouncedSavePanelState",void 0),ze(this,"debouncedLoad",void 0),ze(this,"notebook",void 0),ze(this,"tabTitleElement",void 0),ze(this,"tabInitOnce",void 0),ze(this,"editor",void 0),ze(this,"getSettings",se((v,p)=>it(it({},v),{},{minimap:{enabled:p}}))),ze(this,"getOverflowActions",se((v,p)=>[{title:"Find",icon:vb,action:this.handleFind,group:ae.groups.high,shortcut:Je.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:pb,action:this.handleCopy,group:ae.groups.medium,order:20},{title:"Rename File",icon:mb,action:this.handleShowRename,group:ae.groups.medium,order:30},{title:"Delete File",icon:kn,action:this.handleDelete,group:ae.groups.medium,order:40},{title:"Show Minimap",icon:v?ar:void 0,action:this.handleMinimapChange,group:ae.groups.low,shortcut:Je.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:p?ar:void 0,action:this.handleWordWrapChange,group:ae.groups.low,shortcut:Je.NOTEBOOK.WORDWRAP,order:30}])),this.handleBlur=this.handleBlur.bind(this),this.handleCloseCancel=this.handleCloseCancel.bind(this),this.handleCloseDiscard=this.handleCloseDiscard.bind(this),this.handleCloseSave=this.handleCloseSave.bind(this),this.handleCopy=this.handleCopy.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleDeleteConfirm=this.handleDeleteConfirm.bind(this),this.handleDeleteCancel=this.handleDeleteCancel.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleEditorChange=this.handleEditorChange.bind(this),this.handleFind=this.handleFind.bind(this),this.handleMinimapChange=this.handleMinimapChange.bind(this),this.handleWordWrapChange=this.handleWordWrapChange.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleLinkClick=this.handleLinkClick.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handlePanelDropped=this.handlePanelDropped.bind(this),this.handleRenameFile=this.handleRenameFile.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRunCommand=this.handleRunCommand.bind(this),this.handleRunAll=this.handleRunAll.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.handleSave=this.handleSave.bind(this),this.handleSaveAsCancel=this.handleSaveAsCancel.bind(this),this.handleSaveAsSubmit=this.handleSaveAsSubmit.bind(this),this.handleSaveError=this.handleSaveError.bind(this),this.handleSaveSuccess=this.handleSaveSuccess.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleShowRename=this.handleShowRename.bind(this),this.handleTab=this.handleTab.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabClick=this.handleTabClick.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleTransformLinkUri=this.handleTransformLinkUri.bind(this),this.handleOverwrite=this.handleOverwrite.bind(this),this.handlePreviewPromotion=this.handlePreviewPromotion.bind(this),this.getDropdownOverflowActions=this.getDropdownOverflowActions.bind(this),this.pending=new Sn,this.debouncedSavePanelState=Le(this.savePanelState.bind(this),_h),this.debouncedLoad=Le(this.load.bind(this),_h),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;var{isDashboardActive:t,session:r,sessionLanguage:i,panelState:a}=e,s={value:"",language:"",wordWrap:"off"},o=null,{isPreview:l}=e;a!=null&&({fileMetadata:o=o,isPreview:l=l,settings:s=s}=a);var d=o!=null&&ee.hasPath(o.itemName),h=d===!0&&s.value!=null||!d&&s.value!=null&&s.value.length>0,f=h?1:0;this.state={error:void 0,isDashboardActive:t,isFocused:!1,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:f,fileMetadata:o,settings:s,session:r,sessionLanguage:i,panelState:{fileMetadata:o,settings:s},showCloseModal:!1,showDeleteModal:!1,showSaveAsModal:!1,scriptCode:""},oe.debug("constructor",e,this.state)}componentDidMount(){var{glContainer:e,glEventHub:t}=this.props,{tab:r}=e;r!=null&&this.initTab(r),this.initNotebookContent(),t.on(he.RENAME_FILE,this.handleRenameFile),t.on(te.DROPPED,this.handlePanelDropped),e.on(he.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion)}componentDidUpdate(e,t){var{isPreview:r,settings:i}=this.state,{wordWrap:a}=i,{defaultNotebookSettings:s}=this.props;r!==t.isPreview&&this.setPreviewStatus(),a!==t.settings.wordWrap&&(this.updateEditorWordWrap(),this.debouncedSavePanelState()),s.isMinimapEnabled!==e.defaultNotebookSettings.isMinimapEnabled&&this.updateEditorMinimap()}componentWillUnmount(){this.debouncedSavePanelState.flush(),this.pending.cancel();var{glEventHub:e,glContainer:t}=this.props,{fileMetadata:r,isPreview:i}=this.state;e.off(he.RENAME_FILE,this.handleRenameFile),e.off(te.DROPPED,this.handlePanelDropped),t.off(he.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion),e.emit(he.UNREGISTER_FILE,r,i)}initTab(e){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(e)}initTabCloseOverride(){var{glContainer:e}=this.props;e.beforeClose(t=>{if((t==null?void 0:t.force)===!0)return!0;var{changeCount:r,savedChangeCount:i}=this.state;return r!==i?(this.setState({showCloseModal:!0}),!1):!0})}initTabClasses(e){var t=e.element.get(0);z(t);var r=t.querySelector(".lm_title");this.tabTitleElement=r,r==null||r.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){var{changeCount:e,savedChangeCount:t,settings:r}=this.state,{value:i}=r;if(e!==t&&this.notebook){var a=this.notebook.getValue();return a??i}return i}initNotebookContent(){var{fileMetadata:e,settings:t,isPreview:r}=this.state;if(e&&e.id){oe.debug("Init content from file"),this.registerFileMetadata(e,r),this.load();return}if(t.value!=null){oe.debug("Use content passed in the settings prop"),this.handleLoadSuccess();return}this.handleLoadError(new Error("Missing file metadata"))}closeFileTabById(e){var{glEventHub:t}=this.props;t.emit(he.CLOSE_FILE,{id:e})}registerFileMetadata(e,t){var{glEventHub:r,metadata:i}=this.props,{id:a}=i;r.emit(he.REGISTER_FILE,a,e,t)}renameTab(e,t){var{glEventHub:r}=this.props;r.emit(he.RENAME,e,t)}load(){var{fileMetadata:e,settings:t}=this.state;z(e);var{id:r}=e,{fileStorage:i}=this.props;this.pending.add(i.loadFile(r)).then(a=>{var s;oe.debug("Loaded file",a);var{filename:o}=a,{itemName:l}=this.state;if(o!==l){var{metadata:d}=this.props,{id:h}=d;this.renameTab(h,ee.getBaseName(o))}var f=it(it({},t),{},{language:(s=ke.languageFromFileName(o))!==null&&s!==void 0?s:""});t.value==null&&(f.value=a.content),t.wordWrap===void 0&&(t.wordWrap="off"),this.setState({fileMetadata:{id:o,itemName:o},settings:f}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){var{fileMetadata:e}=this.state;if(e&&ee.hasPath(e.itemName)){var t=this.getNotebookValue();return t!==void 0?(this.saveContent(e.itemName,t),!0):!1}return this.setState({showSaveAsModal:!0}),!1}saveContent(e,t){oe.debug("saveContent",e,t),this.updateSavedChangeCount();var{fileStorage:r}=this.props;this.pending.add(r.saveFile({filename:e,content:t,basename:e})).then(this.handleSaveSuccess).catch(this.handleSaveError)}updateSavedChangeCount(){this.setState(e=>{var{changeCount:t}=e;return{savedChangeCount:t}})}setPreviewStatus(){if(this.tabTitleElement){var{isPreview:e}=this.state;oe.debug("setPreviewStatus",this.tabTitleElement,e),e?this.tabTitleElement.classList.add("is-preview"):this.tabTitleElement.classList.remove("is-preview")}}handlePreviewPromotion(){this.removePreviewStatus()}savePanelState(){this.setState(e=>{var{changeCount:t,savedChangeCount:r,fileMetadata:i,isPreview:a,settings:s}=e,o=this.getNotebookValue(),l=t!==r?o:void 0,d=it(it({},s),{},{value:o}),h=it(it({},s),{},{value:l}),f={settings:h,fileMetadata:i,isPreview:a};return oe.debug("Saving panel state",f),{settings:d,panelState:f}})}handleCloseDiscard(){this.setState({showCloseModal:!1});var{glContainer:e}=this.props;e.close({force:!0})}handleCloseSave(){if(this.setState({showCloseModal:!1}),this.save()){var{glContainer:e}=this.props;e.close({force:!0})}}handleCloseCancel(){this.setState({showCloseModal:!1})}handleOverwrite(e){var{glEventHub:t}=this.props;t.emit(he.CLOSE_FILE,{id:e,itemName:e},{force:!0}),this.focus()}handleCopy(){var e=this;return wh(function*(){var{fileStorage:t,glEventHub:r,session:i}=e.props,{fileMetadata:a,settings:s}=e.state;z(a);var{language:o}=s,{itemName:l}=a,d=yield ee.getUniqueCopyFileName(t,l);oe.debug("handleCopy",a,l,d),yield t.copyFile(l,d);var h={id:d,itemName:d},f={value:null,language:o};r.emit(he.SELECT_NOTEBOOK,i,o,f,h,!0)})()}handleDelete(){oe.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var e=this;return wh(function*(){var{fileStorage:t,glContainer:r,glEventHub:i}=e.props,{fileMetadata:a}=e.state;oe.debug("handleDeleteConfirm",a==null?void 0:a.itemName),e.setState({showDeleteModal:!1}),a&&(ee.hasPath(a.itemName)&&(yield ee.fileExists(t,a.itemName))?(i.emit(he.CLOSE_FILE,a,{force:!0}),t.deleteFile(a.itemName)):r.close({force:!0}))})()}handleDeleteCancel(){this.setState({showDeleteModal:!1})}handleEditorInitialized(e){this.editor=e}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(e){oe.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(t=>{var{changeCount:r,savedChangeCount:i}=t,{isUndoing:a,isRedoing:s}=e;return a?{changeCount:r-1,savedChangeCount:i}:!s&&r<i?{changeCount:r+1,savedChangeCount:0}:{changeCount:r+1,savedChangeCount:i}}),this.debouncedSavePanelState()}handleFind(){this.notebook&&this.notebook.toggleFind()}updateEditorMinimap(){if(this.editor){var{defaultNotebookSettings:e}=this.props;this.editor.updateOptions({minimap:{enabled:e.isMinimapEnabled}})}}handleMinimapChange(){var e,{defaultNotebookSettings:t,updateSettings:r}=this.props,i={defaultNotebookSettings:{isMinimapEnabled:!((e=t.isMinimapEnabled)!==null&&e!==void 0&&e)}};r(i)}updateEditorWordWrap(){if(this.editor){var{settings:e}=this.state,{wordWrap:t}=e;this.editor.updateOptions({wordWrap:t})}}handleWordWrapChange(){this.editor&&this.setState(e=>{var{settings:t}=e,r=t.wordWrap==="on"?"off":"on";return{settings:it(it({},t),{},{wordWrap:r})}})}handleBlur(){oe.debug("handleBlur"),this.setState({isFocused:!1})}handleFocus(){oe.debug("handleFocus"),this.setState({isFocused:!0})}handleLinkClick(e){var{notebooksUrl:t,session:r,sessionLanguage:i}=this.props,{href:a}=e.currentTarget;if(!(!a||!a.startsWith(t))){e.stopPropagation(),e.preventDefault();var s="/".concat(a.substring(t.length)).replace(/%20/g," ");if(s==="/"){oe.debug("Ignoring invalid notebook link",s);return}oe.debug("Notebook link clicked, opening",s);var{glEventHub:o}=this.props,l={value:null,language:i},d={id:s,itemName:s};o.emit(he.SELECT_NOTEBOOK,r,i,l,d)}}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(e){var t=e;Se.isCanceled(t)||(Se.isTimedOut(t)&&(t=new Error("File not found.")),oe.error(t),this.setState({error:t,isLoading:!1}))}handleSave(){oe.debug("handleSave"),this.save()}handleSaveSuccess(e){var t,{fileStorage:r}=this.props,i={id:e.filename,itemName:e.filename},a=(t=ke.languageFromFileName(e.filename))!==null&&t!==void 0?t:"";this.setState(s=>{var{fileMetadata:o}=s,l=it(it({},s.settings),{},{language:a});return oe.debug("handleSaveSuccess",i,o,l),o&&ee.hasPath(o.itemName)&&o.itemName!==i.itemName&&(oe.debug("handleSaveSuccess deleting old file",o.itemName),r.deleteFile(o.itemName).catch(ke.handleError)),{fileMetadata:i,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(i,!1)}handleSaveError(e){Se.isCanceled(e)||(this.setState({savedChangeCount:0}),oe.error(e))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;r&&this.handleOverwrite(e),oe.debug("handleSaveAsSubmit",e);var{fileMetadata:i}=this.state;if(i){var{itemName:a}=i,s=(t=this.getNotebookValue())!==null&&t!==void 0?t:"";if(this.setState({showSaveAsModal:!1}),ee.getBaseName(a)!==ee.getBaseName(e)){var{metadata:o}=this.props,{id:l}=o;this.renameTab(l,ee.getBaseName(e))}this.saveContent(e,s)}}handleRenameFile(e,t,r){var{fileMetadata:i,panelState:a}=this.state,{glContainer:s}=this.props;if((i==null?void 0:i.itemName)==="/".concat(t)&&r&&JSON.stringify(a)!==JSON.stringify(r)){s.close();return}i&&i.id===e&&(this.setState({fileMetadata:{id:t,itemName:t}}),this.debouncedSavePanelState())}handleResize(){var e;(e=this.notebook)===null||e===void 0||e.updateDimensions()}handleRunCommand(e){this.runCommand(e)}handleRunAll(){var e;if(!this.notebook){oe.error("Editor is not initialized.");return}this.runCommand((e=this.notebook.getValue())!==null&&e!==void 0?e:void 0)}handleRunSelected(){if(!this.notebook){oe.error("Editor is not initialized.");return}this.runCommand(this.notebook.getSelectedCommand())}handleSessionOpened(e,t){var{language:r}=t;this.setState({session:e,sessionLanguage:r})}handleSessionClosed(){this.setState({session:void 0,sessionLanguage:void 0})}handleShow(){var e;oe.debug("handleShow"),(e=this.notebook)===null||e===void 0||e.updateDimensions()}handlePanelDropped(e){var{metadata:{id:t}}=this.props;e===t&&this.forceUpdate()}handleShowRename(){this.setState({showSaveAsModal:!0})}handleTab(e){oe.debug("NotebookPanel tab event",e),this.initTab(e)}handleTabFocus(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];oe.debug("handleTabFocus",...t);var{glContainer:i}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!i.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){oe.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handleTabClick(e){oe.debug("handle NotebookPanel tab click"),this.focus(),e.detail===2&&this.removePreviewStatus()}handleTransformLinkUri(e){var{notebooksUrl:t}=this.props,{fileMetadata:r}=this.state;if(e.endsWith("/"))return e;if(e.startsWith("/"))return"".concat(t).concat(e.substring(1));var i=r==null?void 0:r.itemName;if(i===void 0)return e;i.charAt(0)==="/"&&(i=i.substring(1));var a=new URL(i,t);return new URL(e,a).href}focus(){requestAnimationFrame(()=>{this.notebook&&this.notebook.focus()})}createNotebook(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{glEventHub:i}=this.props,{session:a,sessionLanguage:s,settings:o}=this.state,l=it(it({},o),{},{language:t,value:r}),d={id:null,itemName:e};oe.debug("handleCreateNotebook",a,s,l,d),i.emit(he.CREATE_NOTEBOOK,a,s,l,d)}runCommand(e){if(e===void 0||e===""){oe.debug("Ignoring empty command.");return}this.removePreviewStatus();var{glEventHub:t}=this.props;t.emit(vt.SEND_COMMAND,e,!1,!0)}removePreviewStatus(){this.setState(e=>{var{isPreview:t}=e;if(t){var{fileMetadata:r}=this.state;return r&&this.registerFileMetadata(r,!1),{isPreview:!1}}return null})}getDropdownOverflowActions(){var e,t,{defaultNotebookSettings:r}=this.props,{settings:i}=this.state;return this.getOverflowActions((e=r.isMinimapEnabled)!==null&&e!==void 0?e:!1,this.getSettings(i,(t=r.isMinimapEnabled)!==null&&t!==void 0?t:!1).wordWrap==="on")}render(){var e,t,r,{fileStorage:i,glContainer:a,glContainer:{tab:s},glEventHub:o,defaultNotebookSettings:l}=this.props,{changeCount:d,savedChangeCount:h,error:f,isDashboardActive:v,isLoaded:p,isLoading:m,isPreview:b,fileMetadata:g,session:C,sessionLanguage:S,settings:y,showCloseModal:w,showDeleteModal:E,showSaveAsModal:D}=this.state,T=v&&!a.isHidden&&!b,O=(e=g==null?void 0:g.itemName)!==null&&e!==void 0?e:ke.DEFAULT_NAME,M=O.endsWith(".md"),j=(g==null?void 0:g.id)!=null,H=this.getSettings(y,(t=l.isMinimapEnabled)!==null&&t!==void 0?t:!1),L=C!=null,I=S===H.language,N=!p||!L||!I,A=!p,k=[{action:this.handleSave,shortcut:Cr.SAVE},{action:this.handleMinimapChange,shortcut:Je.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:Je.NOTEBOOK.WORDWRAP}],V=vo.getDisabledRunTooltip(L,I,"Notebook extension","Run"),q=vo.getDisabledRunTooltip(L,I,"Notebook extension","Run Selected"),re=[{title:j?"Rename":"Save As…",order:10,group:ae.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:ae.groups.high,order:20}],B=s==null?void 0:s.element.find(".lm_title_before").get(0);return u.jsxs(u.Fragment,{children:[B!=null&&Ta.createPortal(u.jsx("span",{className:Y(ke.UNSAVED_INDICATOR_CLASS_NAME,{[ke.UNSAVED_STATUS_CLASS_NAME]:d!==h})}),B),u.jsxs(Ht,{className:"notebook-container",componentPanel:this,glContainer:a,glEventHub:o,onTab:this.handleTab,onResize:this.handleResize,onShow:this.handleShow,onTabClicked:this.handleTabClick,onTabFocus:this.handleTabFocus,onTabBlur:this.handleTabBlur,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onFocus:this.handleFocus,onBlur:this.handleBlur,additionalActions:re,renderTabTooltip:()=>O,children:[!M&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"notebook-toolbar",children:[u.jsxs("span",{children:[u.jsx(K,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:N,icon:u.jsx(ne,{icon:Pc,transform:"grow-4"}),tooltip:"Run ".concat(Je.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),V!=null&&u.jsx(mt,{children:V})]}),u.jsxs("span",{children:[u.jsx(K,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:N,icon:u.jsx(ne,{icon:fb,transform:"grow-4"}),tooltip:"Run Selected ".concat(Je.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),q!=null&&u.jsx(mt,{children:q})]}),u.jsx(K,{kind:"ghost",className:"mr-auto",disabled:A,onClick:this.handleSave,icon:Tc,tooltip:"Save ".concat(Cr.SAVE.getDisplayText()),"aria-label":"Save"}),u.jsx(K,{kind:"ghost",className:"btn-overflow",disabled:A,icon:wc,tooltip:"More Actions...",onClick:()=>{},children:u.jsx(gn,{actions:this.getDropdownOverflowActions,popperOptions:ke.POPPER_OPTIONS})})]}),u.jsx(tD,{isLoaded:p,isLoading:m,error:f,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:C,sessionLanguage:S,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:H,focusOnMount:T,ref:x=>{this.notebook=x}})]}),M&&u.jsx(c.Suspense,{fallback:u.jsx(Ne,{}),children:u.jsx(nN,{content:(r=H.value)!==null&&r!==void 0?r:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri})}),u.jsx(Yp,{isOpen:D,type:"file",defaultValue:O,title:j?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:i}),u.jsx(Cn,{isOpen:E,headerText:'Are you sure you want to delete "'.concat(O,'"?'),bodyText:"You cannot undo this action.",onCancel:this.handleDeleteCancel,onConfirm:this.handleDeleteConfirm,confirmButtonText:"Delete"}),u.jsx(Cn,{isOpen:w,headerText:"Do you want to save the changes you made to ".concat(O,"?"),bodyText:"Your changes will be lost if you don't save them.",onCancel:this.handleCloseCancel,onDiscard:this.handleCloseDiscard,onConfirm:this.handleCloseSave,discardButtonText:"Discard Changes",confirmButtonText:"Save"}),u.jsx(ae,{actions:k})]})]})}}ze(ke,"COMPONENT","NotebookPanel");ze(ke,"POPPER_OPTIONS",{placement:"bottom-end"});ze(ke,"DEFAULT_NAME","Untitled");ze(ke,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");ze(ke,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");ze(ke,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,defaultNotebookSettings:{isMinimapEnabled:!0}});var rN=(n,e)=>{var t=Jv(n),r=__(n),i=Fr(n,e.localDashboardId),{session:a,config:s}=i??{},{type:o}=s??{};return{fileStorage:t,defaultNotebookSettings:r,session:a,sessionLanguage:o}},iN=Et(rN,{updateSettings:U_},null,{forwardRef:!0})(ke);const un=iN;function im(n){var{onClick:e}=n,t=c.useRef(null),r=c.useCallback(i=>{var a;(a=t.current)===null||a===void 0||a.blur(),e(i)},[e]);return u.jsxs(K,{ref:t,kind:"primary",className:"btn-pandas",onClick:r,tooltip:"Click to refresh pandas dataframe, updates do not occur automatically.",children:["pandas dataframe",u.jsxs("span",{children:[u.jsx(ne,{icon:Dc,transform:"shrink-1",className:"mr-1"}),"Reload"]})]})}function Th(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 Oh(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Th(Object(t),!0).forEach(function(r){cs(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Th(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function cs(n,e,t){return e=aN(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function aN(n){var e=sN(n,"string");return typeof e=="symbol"?e:String(e)}function sN(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 Hl extends c.Component{constructor(e){super(e),cs(this,"irisGridRef",void 0),this.irisGridRef=X.createRef(),this.handleReload=this.handleReload.bind(this),this.handleGridStateChange=this.handleGridStateChange.bind(this),this.handlePanelStateUpdate=this.handlePanelStateUpdate.bind(this);var{panelState:t}=e;this.state={shouldFocusGrid:!1,panelState:t}}handleReload(){var e;(e=this.irisGridRef.current)===null||e===void 0||e.initModel(),this.setState({shouldFocusGrid:!0})}handleGridStateChange(){var e,t,r,{shouldFocusGrid:i}=this.state;i&&(e=this.irisGridRef.current)!==null&&e!==void 0&&(t=e.irisGrid)!==null&&t!==void 0&&(r=t.current)!==null&&r!==void 0&&r.grid&&(this.irisGridRef.current.irisGrid.current.grid.focus(),this.setState({shouldFocusGrid:!1}))}handlePanelStateUpdate(e){this.setState({panelState:e})}render(){return u.jsx(_r,Oh(Oh({ref:this.irisGridRef,onStateChange:this.handleGridStateChange,onPanelStateUpdate:this.handlePanelStateUpdate},this.props),{},{children:u.jsx(im,{onClick:this.handleReload})}))}}cs(Hl,"defaultProps",{panelState:null});cs(Hl,"COMPONENT","PandasPanel");const am=Hl;function Dh(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function Ih(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){Dh(a,r,i,s,o,"next",l)}function o(l){Dh(a,r,i,s,o,"throw",l)}s(void 0)})}}function xh(n,e,t){return e=oN(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function oN(n){var e=lN(n,"string");return typeof e=="symbol"?e:String(e)}function lN(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 dN{constructor(e){xh(this,"items",void 0),xh(this,"onUpdateCallback",void 0),this.items=e}setSearch(e){}setExpanded(e,t){if(e.charAt(e.length-1)==="/")for(var r=0;r<this.items.length;r+=1){var i=this.items[r];pt(i)&&("".concat(i.filename,"/")===e||i.filename===e)&&(i.isExpanded=t)}return Promise.resolve()}collapseAll(){for(var e=0;e<this.items.length;e+=1){var t=this.items[e];pt(t)&&(t.isExpanded=!1)}return Promise.resolve()}getViewportData(){return Promise.resolve({items:this.items,offset:0})}getSnapshot(e){return Ih(function*(){throw new Error("Method not implemented.")})()}setViewport(e){var t=this;return Ih(function*(){var r,i=yield t.getViewportData();(r=t.onUpdateCallback)===null||r===void 0||r.call(t,i)})()}setFilters(e){}setSorts(e){}setReversed(e){}close(){}onUpdate(e){return this.onUpdateCallback=e,jest.fn()}get size(){return this.items.length}}const uN=dN;function Nh(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function Vr(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){Nh(a,r,i,s,o,"next",l)}function o(l){Nh(a,r,i,s,o,"throw",l)}s(void 0)})}}function hN(n,e,t){return e=cN(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cN(n){var e=fN(n,"string");return typeof e=="symbol"?e:String(e)}function fN(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 vN{constructor(e){hN(this,"items",void 0),this.items=e}getTable(){var e=this;return Vr(function*(){return new uN(e.items)})()}saveFile(e){throw new Error("Method not implemented.")}loadFile(e){throw new Error("Method not implemented.")}copyFile(e,t){return Vr(function*(){throw new Error("Method not implemented.")})()}deleteFile(e){var t=this;return Vr(function*(){t.items=t.items.filter(r=>r.filename!==e)})()}moveFile(e,t){var r=this;return Vr(function*(){for(var i=0;i<r.items.length;i+=1)if(r.items[i].filename===e){r.items[i].filename=t,r.items[i].basename=ee.getBaseName(t),r.items[i].id=t;break}})()}info(e){var t=this;return Vr(function*(){var r=t.items.filter(a=>a.filename===e);if(r.length===0)throw new ls;if(r.length>1)throw new Error("More than one matching file found");var i=r[0];return{filename:i.filename,basename:i.basename,id:i.filename,type:i.type}})()}createDirectory(e){throw new Error("Method not implemented.")}}const pN=vN;function Mh(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 _a(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Mh(Object(t),!0).forEach(function(r){mN(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Mh(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function mN(n,e,t){return e=gN(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function gN(n){var e=bN(n,"string");return typeof e=="symbol"?e:String(e)}function bN(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 Lh(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function CN(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){Lh(a,r,i,s,o,"next",l)}function o(l){Lh(a,r,i,s,o,"throw",l)}s(void 0)})}}function SN(n,e,t,r,i){return bo.apply(this,arguments)}function bo(){return bo=CN(function*(n,e,t,r,i){var a,s,o,l;if(cr(t)?(a=t.settings,s=t.table,o=void 0,l=t.tableSettings):(a={},s="",o=Fl(t)?t.figure:t.name,l={}),i!=null&&(i.tableSettings!=null&&(l=i.tableSettings),i.table!=null&&(s=i.table),i.figure!=null&&(o=i.figure),i.settings!=null&&(a=_a(_a({},a),i.settings))),o==null&&s==null){var d=yield r();return dr.makeModel(n,a,d)}if(o!=null){var h;if(t.type===n.VariableType.FIGURE){var f={name:o,type:n.VariableType.FIGURE};h=yield e(f)}else h=yield r();return dr.makeModel(n,a,h)}var v={name:s,type:n.VariableType.TABLE},p=yield e(v);return new Xe(n).applyTableSettings(p,l,El(bT.getState())),dr.makeModelFromSettings(n,a,p)}),bo.apply(this,arguments)}var Vl=c.forwardRef((n,e)=>{var t=Ve(),r=Bf(),i=zp(n)?n.panelState:void 0,{fetch:a,metadata:s,localDashboardId:o}=n,l=c.useMemo(()=>({metadata:s,localDashboardId:o,makeModel:()=>{if(s==null)throw new Error("Metadata is required for chart panel");return SN(t,r,s,a,i)}}),[s,o,t,r,a,i]);return u.jsx(Ni,_a(_a({ref:e},n),l))});Vl.displayName="ChartPanelPlugin";const yN=Vl;function Ah(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.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 s(l){Ah(a,r,i,s,o,"next",l)}function o(l){Ah(a,r,i,s,o,"throw",l)}s(void 0)})}}function sm(n){var e=Ve(),[t,r]=c.useState(),{fetch:i}=n;return c.useEffect(()=>{var a=!1;function s(){return o.apply(this,arguments)}function o(){return o=EN(function*(){var l=yield i(),d=yield dr.makeModel(e,void 0,l);a||r(d)}),o.apply(this,arguments)}return s(),()=>{a=!0}},[e,i]),t?u.jsx(hl,{model:t}):null}var wN={name:"ChartPanel",title:"Chart",type:tt.WIDGET_PLUGIN,component:sm,panelComponent:Vl,supportedTypes:"Figure",icon:Do};const PN=wN;function om(n){Hn(n);var{id:e,layout:t}=n,r=Ve(),i=c.useCallback(a=>{var{metadata:s,panelId:o=ye.generate(),table:l}=a,{settings:d}=s,h=()=>dr.makeModelFromSettings(r,d,l),f=Re.titleFromSettings(d),v={type:"react-component",component:Ni.COMPONENT,props:{localDashboardId:e,id:o,metadata:s,makeModel:h},title:f,id:o},{root:p}=t;F.openComponent({root:p,config:v})},[r,e,t]);return ce(t.eventHub,yt.CREATE_CHART,i),null}var _N={name:"ChartBuilderPlugin",type:tt.DASHBOARD_PLUGIN,component:om};const TN=_N;function Fh(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 jh(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fh(Object(t),!0).forEach(function(r){ON(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Fh(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ON(n,e,t){return e=DN(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function DN(n){var e=IN(n,"string");return typeof e=="symbol"?e:String(e)}function IN(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=W.module("ConsolePlugin");function Rh(n){return n.notebook!==void 0}function xN(n){Hn(n)}function NN(n){xN(n);var{id:e,hydrateConsole:t,layout:r,panelManager:i,registerComponent:a,notebooksUrl:s}=n,o=c.useRef(0),[l,d]=c.useState(new Map),[h,f]=c.useState(new Map),v=pi(),p=c.useCallback(()=>i.getLastUsedPanelOfType(ra),[i]),m=c.useCallback((x,P)=>{d(R=>new Map(R.set(x,P)))},[d]),b=c.useCallback(x=>{d(P=>(P.delete(x),new Map(P)))},[d]),g=c.useCallback((x,P)=>{f(R=>new Map(R.set(x,P)))},[f]),C=c.useCallback(x=>{f(P=>(P.delete(x),new Map(P)))},[f]),S=c.useCallback(function(x){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,U=x&&x.trim();if(!U)Oe.info("Ignoring empty code");else{var Q=p();if(!Q||!(Q instanceof ra.WrappedComponent)){Oe.error("Console panel not found");return}Oe.debug("Send command: ",x,P,R),Q.addCommand(x,P,R)}},[p]),y=c.useCallback(x=>{v(Vp(e,x))},[v,e]),w=c.useCallback(x=>{var{language:P}=x,R=P==="python"?"py":P,U=null;return R==null?(Oe.debug("No extension for language",P),U="Untitled-".concat(o.current)):U="Untitled-".concat(o.current,".").concat(R),o.current+=1,U},[]),E=c.useCallback(function(x){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{id:R}=x;if(R!=null&&l.has(R))return l.get(R);if(R!=null&&h.has(R))return h.get(R);if(P)return ye.generate()},[l,h]),D=c.useCallback((x,P)=>{F.renameComponent(r.root,{id:x},P)},[r.root]),T=c.useCallback((x,P)=>{Oe.debug("Rename file panel",x,P);var R;if(l.has(x)&&(R=l.get(x),b(x),R!=null&&m(P,R)),h.has(x)&&(R=h.get(x),C(x),R!=null&&g(P,R)),R===void 0){Oe.debug2("File ".concat(x," isn't open, no need to rename the tab"));return}D(R,ee.getBaseName(P))},[l,h,D,m,g,b,C]),O=c.useCallback(x=>{var P=E(x,!1);if(P==null){Oe.error("Could not find panel id for file metadata",x);return}F.activateTab(r.root,{id:P})},[E,r.root]),M=c.useCallback((x,P,R)=>{if(Oe.debug("registerFilePanel",x,P,R),P==null||P.id==null){Oe.debug("Ignore empty file id",P);return}var{id:U}=P;if(R){g(U,x);return}if(l.has(U)){var Q=l.get(U);if(x===Q){Oe.debug("Update tab title for file ".concat(U));var{itemName:me}=P;T(U,me)}else Oe.error("File ".concat(U," already associated with a different tab ").concat(Q));return}m(U,x),h.has(U)&&C(U)},[l,h,T,m,g,C]),j=c.useCallback((x,P)=>{if(Oe.debug("unregisterFileTab",x,P),x==null||x.id==null){Oe.debug("Ignore empty file id",x);return}var{id:R}=x;if(P){C(R);return}b(R)},[b,C]),H=c.useCallback((x,P)=>{Oe.debug("closeFilePanel",x);var{id:R}=x,U=null,Q=!1;if(l.has(R))U=l.get(R);else if(h.has(R))U=h.get(R),Q=!0;else{Oe.debug("File ".concat(R," isn't open, ignore close event"));return}j(x,Q),F.closeComponent(r.root,{id:U},P)},[r.root,l,h,j]),L=c.useCallback(x=>{var{itemName:P}=x;return ee.getBaseName(P)},[]),I=c.useCallback(x=>{var{id:P}=x;return Oe.debug("fileIsOpen",x,P,l),P!=null&&l.has(P)},[l]),N=c.useCallback(x=>{var{id:P}=x;return Oe.debug("fileIsOpenAsPreview",x,P,h),P!=null&&h.has(P)},[h]),A=c.useCallback(x=>{if(x!=null){var P=i.getOpenedPanelById(x);P&&Rh(P)&&P.focus()}},[i]),k=c.useCallback(x=>{var{id:P,settings:R,fileMetadata:U,session:Q,sessionLanguage:me,isPreview:$=!1}=x,J={settings:R,fileMetadata:U},ie=L(U);return{type:"react-component",component:un.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:P},session:Q,sessionLanguage:me,panelState:J,isPreview:$,notebooksUrl:s},title:ie,id:P}},[L,e,s]),V=c.useCallback(function(x,P,R){var U=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{id:null,itemName:w(R)},Q=E(U);if(I(U)&&Q!=null){Oe.debug("File is already open, focus panel"),O(U),A(Q);return}var me=F.getStackForComponentTypes(r.root,[un.COMPONENT]),$=k({id:Q,settings:R,fileMetadata:U,session:x,sessionLanguage:P});Oe.debug("createNotebook",$,l),F.openComponentInStack(me,$)},[I,A,w,E,r.root,k,l,O]),q=c.useCallback(function(x,P,R,U){var Q=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;Oe.debug("selectNotebook",U,Q);var me=I(U),$=N(U),[J]=[...h.values()],ie=!Q,fe=ie&&J?J:E(U);if(fe==null||fe==="")throw new Error("Unable to retrieve or create panelId for metadata",U);if(me||$)O(U);else{var Ee=F.getStackForComponentTypes(r.root,[un.COMPONENT]),jr=k({id:fe,settings:R,fileMetadata:U,session:x,sessionLanguage:P,isPreview:ie});F.openComponentInStack(Ee,jr)}if($&&Q){var zn=U.id,Rr=F.getStackForConfig(r.root,{component:un.COMPONENT,id:fe}),Pn=F.getContentItemInStack(Rr,{component:un.COMPONENT,id:fe});Pn&&ut(Pn)&&(Pn.container.emit(he.PROMOTE_FROM_PREVIEW),C(zn),m(zn,fe))}Q&&A(fe)},[O,I,N,A,E,r.root,k,h,C,m]),re=c.useCallback(function(x,P){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},U=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,Q=i.getLastUsedPanelOfType(un);Q&&Rh(Q)?R!=null&&R.value!=null&&Q.notebook!=null&&Q.notebook.append(R.value):U&&V(x,P,R)},[V,i]),B=c.useCallback((x,P)=>qv.hydrate(jh(jh({},x),{},{notebooksUrl:s}),P),[s]);return In(a,ra,t),In(a,Kp),In(a,Zp),In(a,tm),In(a,un,B),ce(r.eventHub,vt.SEND_COMMAND,S),ce(r.eventHub,vt.SETTINGS_CHANGED,y),ce(r.eventHub,he.CLOSE_FILE,H),ce(r.eventHub,he.CREATE_NOTEBOOK,V),ce(r.eventHub,he.SELECT_NOTEBOOK,q),ce(r.eventHub,he.RENAME,D),ce(r.eventHub,he.RENAME_FILE,T),ce(r.eventHub,he.SEND_TO_NOTEBOOK,re),ce(r.eventHub,he.REGISTER_FILE,M),ce(r.eventHub,he.UNREGISTER_FILE,j),null}var Br=W.module("FilterPlugin");function kh(n,e){return n.concat(e)}function lm(n){Hn(n);var{id:e,layout:t,registerComponent:r}=n,i=pi(),[a]=c.useState(()=>new Map),[s]=c.useState(()=>new Map),[o]=c.useState(()=>new Map),l=c.useCallback(()=>{var g=Array.from(a.values()).reduce(kh,[]).sort((y,w)=>{var E=_t.toLower(y.name),D=_t.toLower(w.name);if(E!==D)return E>D?1:-1;var T=_t.toLower(y.type),O=_t.toLower(w.type);return T!==O?T>O?1:-1:0}).reduce((y,w)=>((y.length===0||_t.toLower(y[y.length-1].name)!==_t.toLower(w.name)||_t.toLower(y[y.length-1].type)!==_t.toLower(w.type))&&y.push(w),y),[]),C=Array.from(s.values()).reduce(kh,[]).sort((y,w)=>y.timestamp-w.timestamp),S=new Map(o);Br.debug("sendUpdate",{columns:g,filters:C,tableMap:S}),i(Mt(e,{columns:g,filters:C,tableMap:S}))},[i,e,a,s,o]),d=c.useCallback((g,C)=>{Br.debug2("handleColumnsChanged",g,C),a.set(g,[].concat(C)),l()},[a,l]),h=c.useCallback((g,C)=>{Br.debug2("handleFiltersChanged",g,C),s.set(g,[].concat(C)),l()},[s,l]),f=c.useCallback((g,C)=>{Br.debug2("handleTableChanged",g,C),o.set(F.getIdFromPanel(g),C),l()},[o,l]),v=c.useCallback(g=>{Br.debug2("handlePanelUnmount",g),a.delete(g),s.delete(g),o.delete(F.getIdFromPanel(g)),l()},[a,s,o,l]),p=c.useCallback(g=>{var{title:C="DropdownFilter",metadata:S={},panelState:y=null,id:w=ye.generate(),focusElement:E=F.DEFAULT_FOCUS_SELECTOR,createNewStack:D=!1,dragEvent:T=null}=g,O={type:"react-component",component:bn.COMPONENT,props:{id:w,metadata:S,panelState:y,localDashboardId:e},title:C,id:w},{root:M}=t;F.openComponent({root:M,config:O,focusElement:E,createNewStack:D,dragEvent:T})},[t,e]),m=c.useCallback(g=>{var{title:C="InputFilter",metadata:S={},panelState:y=null,id:w=ye.generate(),focusElement:E=F.DEFAULT_FOCUS_SELECTOR,createNewStack:D=!1,dragEvent:T=void 0}=g,O={type:"react-component",component:fr.COMPONENT,props:{id:w,metadata:S,panelState:y,localDashboardId:e},title:C,id:w},{root:M}=t;F.openComponent({root:M,config:O,focusElement:E,createNewStack:D,dragEvent:T})},[t,e]),b=c.useCallback(g=>{var{title:C="FilterSets",metadata:S={},panelState:y=null,id:w=ye.generate(),focusElement:E=F.DEFAULT_FOCUS_SELECTOR,createNewStack:D=!1,dragEvent:T=null}=g,O={type:"react-component",component:aa.COMPONENT,props:{id:w,metadata:S,panelState:y,localDashboardId:e},title:C,id:w},{root:M}=t;F.openComponent({root:M,config:O,focusElement:E,createNewStack:D,dragEvent:T})},[t,e]);return c.useEffect(function(){var C=[r(bn.COMPONENT,bn),r(fr.COMPONENT,fr),r(aa.COMPONENT,aa)];return()=>{C.forEach(S=>S())}},[r]),ce(t.eventHub,Te.COLUMNS_CHANGED,d),ce(t.eventHub,Te.FILTERS_CHANGED,h),ce(t.eventHub,Te.TABLE_CHANGED,f),ce(t.eventHub,Te.OPEN_DROPDOWN,p),ce(t.eventHub,Te.OPEN_INPUT,m),ce(t.eventHub,Te.OPEN_FILTER_SET_MANAGER,b),ce(t.eventHub,te.UNMOUNT,v),null}var MN={name:"FilterPlugin",type:tt.DASHBOARD_PLUGIN,component:lm};const LN=MN;var AN=W.module("@deephaven/app-utils/useTablePlugin");function dm(){var n=Va(),e=c.useCallback(t=>{var r=n.get(t);if(r!=null){if(ol(r))return r.component;if(sl(r))return r.TablePlugin}var i="Unable to find table plugin ".concat(t,".");throw AN.error(i),new Error(i)},[n]);return e}function $h(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function FN(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){$h(a,r,i,s,o,"next",l)}function o(l){$h(a,r,i,s,o,"throw",l)}s(void 0)})}}function um(n,e,t){var r=Ve(),i=dm(),a=c.useMemo(()=>({loadPlugin:i,localDashboardId:e,makeModel:function(){var s=FN(function*(){var l=yield n();return Ma.makeModel(r,l)});function o(){return s.apply(this,arguments)}return o}(),metadata:t}),[r,n,e,i,t]);return a}function Uh(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 Hh(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Uh(Object(t),!0).forEach(function(r){jN(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Uh(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function jN(n,e,t){return e=RN(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function RN(n){var e=kN(n,"string");return typeof e=="symbol"?e:String(e)}function kN(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 Bl=c.forwardRef((n,e)=>{var{localDashboardId:t,fetch:r,metadata:i}=n,a=um(r,t,i);return u.jsx(_r,Hh(Hh({ref:e},n),a))});Bl.displayName="GridPanelPlugin";const $N=Bl;function Vh(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function UN(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){Vh(a,r,i,s,o,"next",l)}function o(l){Vh(a,r,i,s,o,"throw",l)}s(void 0)})}}function hm(n){var e=Ve(),[t,r]=c.useState(),{fetch:i}=n;return c.useEffect(()=>{var a=!1;function s(){return o.apply(this,arguments)}function o(){return o=UN(function*(){var l=yield i(),d=yield Ma.makeModel(e,l);a||r(d)}),o.apply(this,arguments)}return s(),()=>{a=!0}},[e,i]),t?u.jsx(gr,{model:t}):null}var HN={name:"IrisGridPanel",title:"Table",type:tt.WIDGET_PLUGIN,component:hm,panelComponent:Bl,supportedTypes:["Table","TreeTable","HierarchicalTable","PartitionedTable"],icon:Io};const VN=HN;function Bh(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 ln(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Bh(Object(t),!0).forEach(function(r){cm(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Bh(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function cm(n,e,t){return e=BN(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function BN(n){var e=WN(n,"string");return typeof e=="symbol"?e:String(e)}function WN(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 fm(n){var e=n;return typeof e.getCoordinateForColumn=="function"}function Wh(n){var e=n;return fm(n)&&typeof e.setFilterMap=="function"&&typeof e.unsetFilterValue=="function"}function Gh(n){return n.description==null||!n.description.startsWith("Preview of type: ")}var Wr=W.module("LinkerUtils");class fs{static getLinkType(e,t,r){var i;if((e==null?void 0:e.panelId)==null||(t==null?void 0:t.panelId)==null||e.panelId===t.panelId||r!=null&&r!==e.panelId&&r!==t.panelId)return Wr.debug2("Incompatible panel ids",e,t,r),"invalid";if(e.panelComponent==null||t.panelComponent==null)return Wr.error("PanelComponent should not be null",e,t),"invalid";var a=(i=fs.ALLOWED_LINKS.get(e.panelComponent))===null||i===void 0?void 0:i.includes(t.panelComponent);if(a===void 0||!a)return Wr.debug2("Incompatible panel components",e,t),"invalid";var{columnType:s}=e,{columnType:o}=t,l=o===null||xe.isCompatibleType(s,o);if(!l)return Wr.debug2("Incompatible type",s,o),"invalid";switch(t.panelComponent){case F.getComponentName(Ni):return"chartLink";case F.getComponentName(_r):return"tableLink";case F.getComponentName(bn):return"filterSource"}return Wr.debug2("Incompatible target panel component",t.panelComponent),"invalid"}static findColumn(e,t){var{columnName:r,columnType:i}=t;return e.find(a=>{var{name:s,type:o}=a;return s===r&&o===i})}static cloneLinksForPanel(e,t,r){var i=[];return e.forEach(a=>{var s;a.start.panelId===t&&a.type!=="filterSource"?i.push(ln(ln({},a),{},{id:ye.generate(),start:ln(ln({},a.start),{},{panelId:r})})):((s=a.end)===null||s===void 0?void 0:s.panelId)===t&&i.push(ln(ln({},a),{},{id:ye.generate(),end:ln(ln({},a.end),{},{panelId:r})}))}),i}}cm(fs,"ALLOWED_LINKS",new Map([[F.getComponentName(_r),[F.getComponentName(_r),F.getComponentName(Ni),F.getComponentName(bn)]]]));const Dn=fs;function vm(n,e,t){return e=GN(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function GN(n){var e=zN(n,"string");return typeof e=="symbol"?e:String(e)}function zN(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 KN=W.module("LinkerLink"),zh=.015,Kh=1.5,pm=12,mm=12,qh=2,ea=Math.sqrt((mm*.5)**2+pm**2),Yh=Math.asin(mm*.5/pm),Xh=15,dn=Math.PI*.5;class vr extends c.Component{static makeCirclePath(e,t,r){return"M ".concat(e," ").concat(t," m -").concat(r,",0 a ").concat(r,",").concat(r," 0 1,0 ").concat(r*2,",0 a ").concat(r,",").concat(r," 0 1,0 -").concat(r*2,",0 z")}static getLabelForLinkFilter(e,t){try{if(xe.isNumberType(e)||xe.isCharType(e))return WC(t);if(xe.isTextType(e))return GC(t);if(xe.isDateType(e))return zC(t);if(xe.isBooleanType(e)){if(t===zr.eq)return"is equal to";if(t===zr.notEq)return"is not equal to"}throw new Error("Unrecognized column type: ".concat(e))}catch(r){return KN.warn(r),""}}constructor(e){super(e),vm(this,"getOperators",se((t,r)=>{var{onOperatorChanged:i}=this.props,a=xe.getFilterTypes(r);return xe.isBooleanType(r)&&(a=[zr.eq,zr.notEq]),a.flatMap((s,o)=>{if(s==="eqIgnoreCase"||s==="notEqIgnoreCase")return[];var l="";return s==="startsWith"?l="a*":s==="endsWith"?l="*z":l=xe.getFilterOperatorString(s),[{title:vr.getLabelForLinkFilter(r,s),icon:u.jsx("b",{children:l}),action:()=>i(t,s),order:o}]})})),this.handleClick=this.handleClick.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleDelete=this.handleDelete.bind(this),this.getDropdownActions=this.getDropdownActions.bind(this),this.state={isHovering:void 0}}handleClick(e){e.stopPropagation(),e.preventDefault();var{id:t,onClick:r,onDelete:i}=this.props;e.altKey?i(t):r(t)}handleMouseEnter(){this.setState({isHovering:!0})}handleMouseLeave(){this.setState({isHovering:!1})}handleDelete(){var{id:e,onDelete:t}=this.props;t(e)}getDropdownActions(){var{id:e,startColumnType:t}=this.props;return t!=null?this.getOperators(e,t):[]}render(){var{className:e,operator:t,isSelected:r,x1:i,y1:a,x2:s,y2:o,id:l,startColumnType:d,type:h}=this.props,{isHovering:f}=this.state,v=Math.sqrt((i-s)**2+(a-o)**2),p=Math.atan2(o-a,s-i),m=Math.sin(p),b=Math.cos(p)+2,g=window.innerWidth,C=window.innerHeight,S=0,y=0,w=Math.max(S,Math.min(i+(s-i)/2+m*(v*zh)**Kh,g)),E=Math.max(y,Math.min(a+(o-a)/2+b*(v*zh)**Kh,C)),D="M ".concat(i," ").concat(a," Q ").concat(w," ").concat(E," ").concat(s," ").concat(o),T="M ".concat(S," ").concat(y," L ").concat(S," ").concat(C," L ").concat(g," ").concat(C," L ").concat(g," ").concat(y,` z
|
|
25
|
+
`).concat(vr.makeCirclePath(i,a,Xh),`
|
|
26
|
+
`).concat(vr.makeCirclePath(s,o,Xh)),O="link-select-clip-".concat(l),M=Math.atan2(o-E,s-w),j=M-Yh+Math.PI,H=M+Yh+Math.PI,L=s+Math.cos(M)*qh,I=o+Math.sin(M)*qh,N=L+Math.cos(j)*ea,A=I+Math.sin(j)*ea,k=L+Math.cos(H)*ea,V=I+Math.sin(H)*ea,q="".concat(L,",").concat(I," ").concat(N,",").concat(A," ").concat(k,",").concat(V),re=.25*i+.5*w+.25*s,B=.25*a+.5*E+.25*o,x=w-i+(s-w),P=E-a+(o-E),R=P/x,U=20,Q=U/Math.sqrt(1+R**2),me=Q*R,$=Q*-1,J=me*-1;Number.isFinite(R)?R>0?(Q*=-1,me*=-1,$*=-1,J*=-1,$-=50-10*(Math.abs(p)%dn),J+=10*(Math.abs(p)%dn),Q-=50-10*(Math.abs(p)%dn),me+=10*(Math.abs(p)%dn)):R<0?($+=10*(Math.abs(p)%dn),J+=10*(Math.abs(p)%dn),Q+=10*(Math.abs(p)%dn),me+=10*(Math.abs(p)%dn)):($=15,J=10,Q=-25,me=10):($=10,J=5,Q=10,me=-35);var ie="";t!==void 0&&(t==="startsWith"?ie="a*":t==="endsWith"?ie="*z":ie=xe.getFilterOperatorString(t));var fe=h!=="chartLink"&&h!=="filterSource";return u.jsxs(u.Fragment,{children:[u.jsxs("svg",{className:Y(e,{hovering:f}),children:[u.jsx("clipPath",{id:O,children:u.jsx("path",{d:T,clipRule:"evenodd"})}),u.jsx("path",{className:"link-select",d:D,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,clipPath:"url(#".concat(O,")"),"data-testid":"link-select"}),u.jsx("path",{className:"link-background",d:D}),u.jsx("path",{className:"link-foreground",d:D}),u.jsx("circle",{className:"link-dot",cx:i,cy:a,r:"5"}),u.jsx("polygon",{className:"link-triangle",points:q})]}),d!=null&&r&&u.jsxs(u.Fragment,{children:[fe&&u.jsx(K,{kind:"primary",className:"btn-fab btn-operator",style:{top:B+(R>=0?me:J),left:re+(R>=0?Q:$)},onClick:()=>{},icon:u.jsxs("div",{className:"fa-md fa-layers",children:[u.jsx("b",{children:ie}),u.jsx(ne,{icon:er,transform:"right-8 down-9 shrink-5"})]}),tooltip:"Change comparison operator",children:u.jsx(gn,{actions:this.getDropdownActions,popperOptions:{placement:"bottom-start"}})}),u.jsx(K,{kind:"primary",className:"btn-fab btn-delete",style:{top:B+(R<0?me:J),left:re+(R<0?Q:$)},onClick:this.handleDelete,icon:kn,tooltip:"Delete"})]})]})}}vm(vr,"defaultProps",{className:"",isSelected:!1,onClick(){},onDelete(){}});const qN=vr;function Zh(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 Qh(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Zh(Object(t),!0).forEach(function(r){Wl(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Zh(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Wl(n,e,t){return e=YN(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function YN(n){var e=XN(n,"string");return typeof e=="symbol"?e:String(e)}function XN(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 Ms=W.module("LinkerOverlayContent");class gm extends c.Component{constructor(e){super(e),Wl(this,"dialogRef",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleResize=this.handleResize.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleKeyUp=this.handleKeyUp.bind(this),this.handleEscapePressed=this.handleEscapePressed.bind(this),this.handleOperatorChanged=this.handleOperatorChanged.bind(this),this.dialogRef=X.createRef(),this.state={mouse:void 0,dialog:void 0,offset:{x:0,y:0},isDragging:!1,mode:"select"}}componentDidMount(){window.addEventListener("blur",this.handleBlur,!0),window.addEventListener("mousemove",this.handleMouseMove,!0),window.addEventListener("mouseup",this.handleMouseUp,!0),window.addEventListener("keydown",this.handleKeyDown,!0),window.addEventListener("keyup",this.handleKeyUp,!0),window.addEventListener("resize",this.handleResize,!0)}componentDidCatch(e,t){Ms.error("componentDidCatch",e,t)}componentWillUnmount(){window.removeEventListener("blur",this.handleBlur,!0),window.removeEventListener("mousemove",this.handleMouseMove,!0),window.removeEventListener("mouseup",this.handleMouseUp,!0),window.removeEventListener("keydown",this.handleKeyDown,!0),window.removeEventListener("keyup",this.handleKeyUp,!0),window.removeEventListener("resize",this.handleResize,!0)}getPointFromLinkPoint(e){var{panelManager:t}=this.props,{panelId:r,columnName:i}=e,a=t.getOpenedPanelById(r);if(a!=null){if(!fm(a))throw new Error("Panel does not have getCoordinateForColumn method: ".concat(r));try{var s=a.getCoordinateForColumn(i);if(s!=null)return s}catch{Ms.error("Could not get coordinate for column",i,a)}}var o=t.getContainerByPanelId(r);if(o==null)throw new Error("Unable to find panel container for id: ".concat(r));return F.getTabPoint(o)}handleOperatorChanged(e,t){var{links:r,onLinksUpdated:i}=this.props,a=r.map(s=>s.id===e?Qh(Qh({},s),{},{operator:t}):s);i(a)}handleBlur(){this.setState({mode:"select"})}handleResize(){var{dialog:e}=this.state;if(e&&this.dialogRef.current){var t=this.dialogRef.current.getBoundingClientRect(),r=Jn(e.x,0,window.innerWidth-t.width),i=Jn(e.y,0,window.innerHeight-t.height);this.setState({dialog:{x:r,y:i}})}}handleMouseMove(e){var{offset:t,isDragging:r}=this.state;if(this.setState({mouse:{x:e.clientX,y:e.clientY}}),r&&this.dialogRef.current){var i=this.dialogRef.current.getBoundingClientRect(),a=Jn(window.innerWidth-(e.clientX+i.width+t.x),0,window.innerWidth-i.width),s=Jn(window.innerHeight-(e.clientY+i.height+t.y),0,window.innerHeight-i.height);this.setState({dialog:{x:a,y:s}})}}handleMouseDown(e){e.preventDefault();var t={x:0,y:0};if(this.dialogRef.current){var r=this.dialogRef.current.getBoundingClientRect();t.x=r.right-(r.width+e.clientX),t.y=r.bottom-(r.height+e.clientY)}this.setState({isDragging:!0,offset:t})}handleMouseUp(){this.setState({isDragging:!1})}handleKeyDown(e){if(e.key==="Alt")e.preventDefault(),this.setState({mode:"delete"});else if(e.key==="Delete"||e.key==="Backspace"){var{selectedIds:t,onLinkDeleted:r}=this.props;e.preventDefault(),t.forEach(i=>r(i))}}handleKeyUp(e){e.key==="Alt"&&(e.preventDefault(),this.setState({mode:"select"}))}handleEscapePressed(){var{onCancel:e}=this.props;e()}render(){var{disabled:e,links:t,selectedIds:r,messageText:i,onLinkSelected:a,onLinkDeleted:s,onAllLinksDeleted:o,onDone:l}=this.props,{mouse:d,dialog:h,isDragging:f,mode:v}=this.state,p=t.map(m=>{try{var b,g,{id:C,type:S,isReversed:y,start:w,end:E,operator:D}=m,T=w.columnType,[O,M]=this.getPointFromLinkPoint(w),j=(b=d==null?void 0:d.x)!==null&&b!==void 0?b:O,H=(g=d==null?void 0:d.y)!==null&&g!==void 0?g:M;if(E!=null&&([j,H]=this.getPointFromLinkPoint(E)),y!=null&&y){var[L,I]=[O,M];[O,M]=[j,H],[j,H]=[L,I]}var N=Y("linker-link",{disabled:e},{"link-filter-source":S==="filterSource"},{"link-invalid":S==="invalid"},{interactive:m.end==null},{"link-is-selected":r.has(C)},{"danger-delete":v==="delete"});return{x1:O,y1:M,x2:j,y2:H,id:C,className:N,operator:D,startColumnType:T,type:S}}catch(A){return Ms.warn("Unable to get point for link",m,A),null}}).filter(m=>m!=null);return u.jsxs("div",{className:Y("linker-overlay",{"danger-delete":v==="delete"}),children:[p.map(m=>{var{x1:b,y1:g,x2:C,y2:S,id:y,className:w,operator:E,startColumnType:D,type:T}=m;return u.jsx(qN,{className:w,id:y,x1:b,y1:g,x2:C,y2:S,onClick:a,onDelete:s,isSelected:r.has(y),operator:E,startColumnType:D,type:T,onOperatorChanged:this.handleOperatorChanged},y)}),u.jsxs("div",{className:Y("linker-toast-dialog",{dragging:f}),ref:this.dialogRef,style:{bottom:h==null?void 0:h.y,right:h==null?void 0:h.x},"data-testid":"linker-toast-dialog",children:[u.jsx(K,{draggable:!0,kind:"inline",className:"btn-drag-handle",icon:gb,onClick:()=>{},onMouseDown:this.handleMouseDown,children:!f&&u.jsx(mt,{children:"Drag to reposition"})}),u.jsx("div",{className:"toast-body",children:i}),u.jsxs("div",{className:"toast-footer",children:[u.jsx(K,{kind:"secondary",onClick:o,children:"Clear All"}),u.jsx(K,{kind:"primary",onClick:l,children:"Done"})]})]}),u.jsx(ae,{actions:[{action:this.handleEscapePressed,shortcut:Cr.LINKER_CLOSE,isGlobal:!0}]})]})}}Wl(gm,"defaultProps",{disabled:"false"});const ZN=gm;function Jh(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 ec(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Jh(Object(t),!0).forEach(function(r){bm(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Jh(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function bm(n,e,t){return e=QN(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function QN(n){var e=JN(n,"string");return typeof e=="symbol"?e:String(e)}function JN(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 Fe=W.module("Linker"),eM=(n,e)=>({activeTool:wl(n),dh:Xv(n),isolatedLinkerPanelId:rs(n,e.localDashboardId),links:Gn(n,e.localDashboardId),timeZone:El(n)}),tM=Et(eM,{setActiveTool:ip,setDashboardLinks:as,addDashboardLinks:$p,deleteDashboardLinks:Up,setDashboardIsolatedLinkerPanelId:Al,setDashboardColumnSelectionValidator:Hp});class nM extends c.Component{constructor(e){super(e),bm(this,"getCachedLinks",se((t,r,i)=>{var a=[...t];return r!=null&&r.start!=null&&a.push(r),i!==void 0?a.filter(s=>{var o,l;return(s==null||(o=s.start)===null||o===void 0?void 0:o.panelId)===i||(s==null||(l=s.end)===null||l===void 0?void 0:l.panelId)===i||(s==null?void 0:s.end)==null}):a})),this.handleCancel=this.handleCancel.bind(this),this.handleDone=this.handleDone.bind(this),this.handlePanelCloned=this.handlePanelCloned.bind(this),this.handleFilterColumnSelect=this.handleFilterColumnSelect.bind(this),this.handleColumnsChanged=this.handleColumnsChanged.bind(this),this.handlePanelClosed=this.handlePanelClosed.bind(this),this.handleLayoutStateChanged=this.handleLayoutStateChanged.bind(this),this.handleAllLinksDeleted=this.handleAllLinksDeleted.bind(this),this.handleLinkDeleted=this.handleLinkDeleted.bind(this),this.handleLinksUpdated=this.handleLinksUpdated.bind(this),this.handleChartColumnSelect=this.handleChartColumnSelect.bind(this),this.handleGridColumnSelect=this.handleGridColumnSelect.bind(this),this.handleUpdateValues=this.handleUpdateValues.bind(this),this.handleStateChange=this.handleStateChange.bind(this),this.handleExited=this.handleExited.bind(this),this.handleLinkSelected=this.handleLinkSelected.bind(this),this.handlePanelDragging=this.handlePanelDragging.bind(this),this.handlePanelDropped=this.handlePanelDropped.bind(this),this.isColumnSelectionValid=this.isColumnSelectionValid.bind(this),this.state={linkInProgress:void 0,selectedIds:new Set,isDraggingPanel:!1}}componentDidMount(){var{layout:e}=this.props;this.startListening(e),this.updateSelectionValidators()}componentDidUpdate(e){var{activeTool:t,layout:r}=this.props;r!==e.layout&&(this.stopListening(e.layout),this.startListening(r)),t!==e.activeTool&&(this.updateSelectionValidators(),t===It.DEFAULT&&this.reset())}componentDidCatch(e,t){Fe.error("componentDidCatch",e,t)}componentWillUnmount(){var{layout:e}=this.props;this.stopListening(e)}startListening(e){e.on("stateChanged",this.handleLayoutStateChanged);var{eventHub:t}=e;t.on(yt.COLUMN_SELECTED,this.handleGridColumnSelect),t.on(yt.DATA_SELECTED,this.handleUpdateValues),t.on(yt.STATE_CHANGED,this.handleStateChange),t.on(Ea.COLUMN_SELECTED,this.handleChartColumnSelect),t.on(te.CLONED,this.handlePanelCloned),t.on(Te.COLUMN_SELECTED,this.handleFilterColumnSelect),t.on(Te.COLUMNS_CHANGED,this.handleColumnsChanged),t.on(te.CLOSE,this.handlePanelClosed),t.on(te.CLOSED,this.handlePanelClosed),t.on(te.DRAGGING,this.handlePanelDragging),t.on(te.DROPPED,this.handlePanelDropped)}stopListening(e){e.off("stateChanged",this.handleLayoutStateChanged);var{eventHub:t}=e;t.off(yt.COLUMN_SELECTED,this.handleGridColumnSelect),t.off(yt.DATA_SELECTED,this.handleUpdateValues),t.off(yt.STATE_CHANGED,this.handleStateChange),t.off(Ea.COLUMN_SELECTED,this.handleChartColumnSelect),t.off(te.CLONED,this.handlePanelCloned),t.off(Te.COLUMN_SELECTED,this.handleFilterColumnSelect),t.off(Te.COLUMNS_CHANGED,this.handleColumnsChanged),t.off(te.CLOSE,this.handlePanelClosed),t.off(te.CLOSED,this.handlePanelClosed),t.off(te.DRAGGING,this.handlePanelDragging),t.off(te.DROPPED,this.handlePanelDropped)}reset(){this.setState({linkInProgress:void 0,selectedIds:new Set})}handleCancel(){var{linkInProgress:e}=this.state;if(e==null){var{setActiveTool:t}=this.props;t(It.DEFAULT)}this.setState({linkInProgress:void 0})}handleDone(){var{setActiveTool:e}=this.props;e(It.DEFAULT)}handleChartColumnSelect(e,t){this.columnSelected(e,t,!0)}handleFilterColumnSelect(e,t){Fe.debug("handleFilterColumnSelect",this.isOverlayShown());var{links:r,localDashboardId:i,setActiveTool:a,setDashboardIsolatedLinkerPanelId:s}=this.props,o=F.getIdFromPanel(e),l=r.filter(d=>{var h,f;return((h=d.start)===null||h===void 0?void 0:h.panelId)===o||((f=d.end)===null||f===void 0?void 0:f.panelId)===o});if(!this.isOverlayShown()&&o!=null){a(It.LINKER),s(i,o),l.length===0&&this.columnSelected(e,t,!0,o);return}this.columnSelected(e,t,!0)}handleColumnsChanged(e,t){Fe.debug("handleColumnsChanged",e,t);var{links:r}=this.props,i=F.getIdFromPanel(e);if(i==null){Fe.error("Invalid panelId",e);return}var a=r.filter(s=>{var{start:o,end:l}=s;return o.panelId===i&&Dn.findColumn(t,o)==null||l!=null&&l.panelId===i&&Dn.findColumn(t,l)==null});this.deleteLinks(a)}handleGridColumnSelect(e,t){if(!Gh(t)){Fe.debug2("Column is not filterable");return}this.columnSelected(e,t)}columnSelected(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3?arguments[3]:void 0;if(!(i===void 0&&!this.isOverlayShown())){var{isolatedLinkerPanelId:a}=this.props,{linkInProgress:s}=this.state,o=F.getIdFromPanel(e);if(o!=null){var l=F.getComponentNameFromPanel(e),{name:d,type:h}=t;if(s==null||s.start==null){var f={id:ye.generate(),start:{panelId:o,panelComponent:l,columnName:d,columnType:h},type:"invalid",isReversed:r};Fe.debug("starting link",f),this.setState({linkInProgress:f})}else{var{links:v}=this.props,{start:p,id:m,isReversed:b}=s,g={panelId:o,panelComponent:l,columnName:d,columnType:h},C=Dn.getLinkType(b!==void 0&&b?g:p,b!==void 0&&b?p:g,i??a);switch(C){case"invalid":Fe.debug("Ignore invalid link connection",s,g);return;case"filterSource":{var S=b!==void 0&&b?p.panelId:g.panelId,y=v.filter(O=>{var{end:M}=O;return(M==null?void 0:M.panelId)===S});this.deleteLinks(y);break}case"chartLink":{var w=b===!0?p:g,E=b===!0?g:p;Fe.debug("creating chartlink",{existingLinkEnd:w,start:p,end:g});var D=v.filter(O=>{var{end:M,start:j}=O;return(j==null?void 0:j.panelId)===E.panelId&&(M==null?void 0:M.panelId)===w.panelId&&(M==null?void 0:M.columnName)===w.columnName&&(M==null?void 0:M.columnType)===w.columnType});this.deleteLinks(D);break}}var T={start:b!==void 0&&b?g:p,end:b!==void 0&&b?p:g,id:m,type:C,operator:zr.eq};Fe.info("creating link",T),this.setState({linkInProgress:void 0,selectedIds:new Set([m])},()=>{this.addLinks([T])})}}}}unsetFilterValueForLink(e){var{panelManager:t}=this.props;if(e.end){var{end:r}=e,{panelId:i,columnName:a,columnType:s}=r,o=t.getOpenedPanelById(i);o?Wh(o)?o.unsetFilterValue(a,s):Fe.debug("endPanel.unsetFilterValue not implemented",o):Fe.debug("endPanel no longer exists, ignoring unsetFilterValue",i)}}setPanelFilterMap(e,t){Fe.debug("Set filter data for panel:",e,t);var{panelManager:r}=this.props,i=r.getOpenedPanelById(e);i?Wh(i)?i.setFilterMap(t):Fe.debug("panel.setFilterMap not implemented",e,i):Fe.debug("panel no longer exists, ignoring setFilterMap",e)}addLinks(e){var{addDashboardLinks:t,localDashboardId:r}=this.props;t(r,e)}deleteLinks(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{localDashboardId:r}=this.props;if(e.forEach(s=>this.unsetFilterValueForLink(s)),t){var{setDashboardLinks:i}=this.props;i(r,[])}else if(e.length>0){var{deleteDashboardLinks:a}=this.props;a(r,e.map(s=>{var{id:o}=s;return o}))}}handleAllLinksDeleted(){var{links:e,isolatedLinkerPanelId:t}=this.props;if(t===void 0)this.deleteLinks(e,!0);else{var r=e.filter(i=>{var a,s;return(i==null||(a=i.start)===null||a===void 0?void 0:a.panelId)===t||(i==null||(s=i.end)===null||s===void 0?void 0:s.panelId)===t});this.deleteLinks(r)}this.reset()}handleLinkDeleted(e){var{links:t}=this.props,r=t.find(i=>i.id===e);r?this.deleteLinks([r]):Fe.error("Unable to find link to delete",e)}handleUpdateValues(e,t){for(var r=F.getIdFromPanel(e),{dh:i,links:a,timeZone:s}=this.props,o=new Map,l=0;l<a.length;l+=1){var{start:d,end:h,operator:f}=a[l];if(d.panelId===r&&h!=null){var{panelId:v,columnName:p,columnType:m}=h,b=o.has(v)?o.get(v):new Map,g=b.has(p)===!0?b.get(p).filterList:[],{visibleIndex:C,isExpandable:S,isGrouped:y}=t[d.columnName],{value:w}=t[d.columnName],E="".concat(w);if(w===null&&S&&y&&(w=void 0),m!=null&&xe.isDateType(m)){var D=new No(i,{timeZone:s,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:xc.FULL_DATE_FORMAT});E=D.format(w)}var T={operator:f,text:E,value:w,startColumnIndex:C};g.push(T),b.set(p,{columnType:m,filterList:g}),o.set(v,b)}}o.forEach((O,M)=>{this.setPanelFilterMap(M,O)})}handlePanelCloned(e,t){var{links:r}=this.props,i=F.getIdFromPanel(e),a=t.id;if(i!=null){var s=Dn.cloneLinksForPanel(r,i,a);this.addLinks(s)}}handlePanelDragging(e){for(var{links:t}=this.props,r=0;r<t.length;r+=1){var i=t[r],{start:a,end:s}=i;if(a.panelId===e||(s==null?void 0:s.panelId)===e){this.setState({isDraggingPanel:!0});return}}}handlePanelDropped(){this.setState({isDraggingPanel:!1})}handlePanelClosed(e){Fe.debug("Panel ".concat(e," closed, deleting links.")),this.deleteLinksForPanelId(e)}handleLinkSelected(e){this.setState({selectedIds:new Set([e])})}handleLinksUpdated(e){var{localDashboardId:t,setDashboardLinks:r}=this.props;r(t,e)}handleLayoutStateChanged(){this.forceUpdate()}handleStateChange(){this.forceUpdate()}handleExited(){var{localDashboardId:e,setDashboardIsolatedLinkerPanelId:t}=this.props;t(e,void 0)}deleteLinksForPanelId(e){for(var{links:t}=this.props,r=0;r<t.length;r+=1){var i=t[r],{start:a,end:s,id:o}=i;(a.panelId===e||(s==null?void 0:s.panelId)===e)&&this.handleLinkDeleted(o)}}isOverlayShown(){var{activeTool:e}=this.props;return e===It.LINKER}updateSelectionValidators(){var{activeTool:e,setDashboardColumnSelectionValidator:t,localDashboardId:r}=this.props;switch(e){case It.LINKER:t(r,this.isColumnSelectionValid);break;default:t(r,void 0);break}}updateLinkInProgressType(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"invalid";this.setState(t=>{var{linkInProgress:r}=t;return r!==void 0?{linkInProgress:ec(ec({},r),{},{type:e})}:null})}isColumnSelectionValid(e,t){var{linkInProgress:r}=this.state,{isolatedLinkerPanelId:i}=this.props;if(t==null)return(r==null?void 0:r.start)!=null&&this.updateLinkInProgressType(),!1;if(!Gh(t))return Fe.debug2("Column is not filterable",t.description),(r==null?void 0:r.start)!=null&&this.updateLinkInProgressType("invalid"),!1;if((r==null?void 0:r.start)==null)return!0;var{isReversed:a,start:s}=r,o=F.getIdFromPanel(e);if(o==null)return!1;var l={panelId:o,panelComponent:F.getComponentNameFromPanel(e),columnName:t.name,columnType:t.type},d=a!==void 0&&a?Dn.getLinkType(l,s,i):Dn.getLinkType(s,l,i);return this.updateLinkInProgressType(d),d!=="invalid"}render(){var{links:e,isolatedLinkerPanelId:t,panelManager:r}=this.props,{linkInProgress:i,selectedIds:a,isDraggingPanel:s}=this.state,o=this.isOverlayShown(),l=i!=null&&i.start!=null,d=t===void 0?"Click a column source, then click a column target to create a filter link. The filter comparison operator used by a selected link can be changed. Delete a filter link by clicking the delete button or with alt+click. Click done when finished.":"Create a link between the source column button and a table column by clicking on one, then the other. Delete a filter link by clicking the delete button or with alt+click. Click done when finished.";return s?null:u.jsx(Fn,{in:o,timeout:jn.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,onExited:this.handleExited,children:u.jsx(ZN,{disabled:l,panelManager:r,links:this.getCachedLinks(e,i,t),selectedIds:a,messageText:d,onLinkSelected:this.handleLinkSelected,onLinkDeleted:this.handleLinkDeleted,onAllLinksDeleted:this.handleAllLinksDeleted,onLinksUpdated:this.handleLinksUpdated,onDone:this.handleDone,onCancel:this.handleCancel})})}}var rM=tM(nM);const iM=rM;function Cm(n){Hn(n);var{id:e,layout:t,panelManager:r}=n;return u.jsx(iM,{layout:t,localDashboardId:e,panelManager:r})}var aM={name:"LinkerPlugin",type:tt.DASHBOARD_PLUGIN,component:Cm};const sM=aM;function Sm(n,e,t){return e=oM(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function oM(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 Dr{static getNewMarkdownTitle(e){for(var t="".concat(Dr.DEFAULT_TITLE),r=0;e.indexOf(t)>=0;)r+=1,t="".concat(Dr.DEFAULT_TITLE,"-").concat(r);return t}}Sm(Dr,"DEFAULT_TITLE","Note");Sm(Dr,"DEFAULT_CONTENT",`# Markdown Note
|
|
27
|
+
|
|
28
|
+
This note can be edited using **markdown** for styling.`);const Ls=Dr;function ym(n){Hn(n);var{id:e,layout:t,panelManager:r,registerComponent:i}=n,a=c.useCallback(o=>{var{title:l,componentState:d,props:h}=o,{panelState:f=null}=h;return d!=null&&({panelState:f=null}=d),l==null||f==null||f.content==null||f.content.length===0||f.content===Ls.DEFAULT_CONTENT?null:Ga(o)},[]),s=c.useCallback(function(){var{title:o="",metadata:l={},id:d=ye.generate(),focusElement:h=F.DEFAULT_FOCUS_SELECTOR,createNewStack:f=!1,dragEvent:v=null}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},p=r.getOpenedPanelConfigsOfType(Qn.COMPONENT),m=r.getClosedPanelConfigsOfType(Qn.COMPONENT),b=p.map(w=>{var E;return(E=w.title)!==null&&E!==void 0?E:""}),g=o!=null&&o!==""?o:Ls.getNewMarkdownTitle(b),C=m.length>0?null:Ls.DEFAULT_CONTENT,S={type:"react-component",component:Qn.COMPONENT,props:{id:d,metadata:l,panelState:{content:C},localDashboardId:e},title:g,id:d},{root:y}=t;F.openComponent({root:y,config:S,focusElement:h,createNewStack:f,dragEvent:v})},[e,t,r]);return c.useEffect(function(){var l=[i(Qn.COMPONENT,Qn,za,a)];return()=>{l.forEach(d=>d())}},[a,i]),ce(t.eventHub,xp.OPEN,s),null}var dM={name:"MarkdownPlugin",type:tt.DASHBOARD_PLUGIN,component:ym};const uM=dM;function tc(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 nc(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?tc(Object(t),!0).forEach(function(r){hM(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):tc(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function hM(n,e,t){return e=cM(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cM(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 Gl=c.forwardRef((n,e)=>{var{localDashboardId:t,fetch:r,metadata:i}=n,a=um(r,t,i);return u.jsx(am,nc(nc({ref:e},n),a))});Gl.displayName="PandasPanelPlugin";const vM=Gl;function rc(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function As(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){rc(a,r,i,s,o,"next",l)}function o(l){rc(a,r,i,s,o,"throw",l)}s(void 0)})}}function Em(n){var e=Ve(),[t,r]=c.useState(),[i,a]=c.useState(!0),[s,o]=c.useState(!1),{fetch:l}=n,d=c.useCallback(As(function*(){var f=yield l();return Ma.makeModel(e,f)}),[e,l]),h=c.useCallback(As(function*(){a(!0);var f=yield d();r(f),a(!1)}),[d]);return c.useEffect(()=>{var f=!1;function v(){return p.apply(this,arguments)}function p(){return p=As(function*(){var m=yield d();f||(r(m),o(!0),a(!1))}),p.apply(this,arguments)}return v(),a(!0),()=>{f=!0}},[d]),u.jsxs(u.Fragment,{children:[u.jsx(Ne,{isLoaded:s,isLoading:i}),t&&u.jsx(gr,{model:t,children:u.jsx(im,{onClick:h})})]})}var pM={name:"PandasPanel",title:"Pandas",type:tt.WIDGET_PLUGIN,component:Em,panelComponent:Gl,supportedTypes:"pandas.DataFrame",icon:Ec};const mM=pM;function ic(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 Gr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ic(Object(t),!0).forEach(function(r){gM(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ic(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function gM(n,e,t){return e=bM(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bM(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)}var SM=W.module("WidgetLoaderPlugin");function yM(n){var e;function t(r,i){var a,s=n.component,{metadata:o}=r,l=yl(s);return u.jsx(xi,Gr(Gr({widgetName:(a=o==null?void 0:o.name)!==null&&a!==void 0?a:void 0,widgetType:n.title},r),{},{children:l?u.jsx(s,Gr(Gr({},r),{},{ref:i})):u.jsx(s,Gr({},r))}))}return t.displayName="WidgetLoaderPlugin(".concat((e=n.component.displayName)!==null&&e!==void 0?e:n.name,")"),c.forwardRef(t)}function wm(n){var e=Va(),t=c.useMemo(()=>{var o=new Map;return e.forEach(l=>{Nr(l)&&[l.supportedTypes].flat().forEach(d=>{if(d!=null&&d!==""){if(o.has(d)){var h;SM.warn("Multiple WidgetPlugins handling type ".concat(d,". Replacing ").concat((h=o.get(d))===null||h===void 0?void 0:h.name," with ").concat(l.name," to handle ").concat(d))}o.set(d,l)}})}),o},[e]);Hn(n);var{id:r,layout:i,registerComponent:a}=n,s=c.useCallback(o=>{var l,{dragEvent:d,panelId:h=ye.generate(),fetch:f,widget:v}=o,{type:p}=v,m=p!=null?t.get(p):null;if(m!=null){var b=(l=v.name)!==null&&l!==void 0?l:p,g={localDashboardId:r,metadata:v,fetch:f},C={type:"react-component",component:m.name,props:g,title:b,id:h},{root:S}=i;F.openComponent({root:S,config:C,dragEvent:d})}},[r,i,t]);return c.useEffect(()=>{var o=[...new Set(t.values())].map(l=>{var{panelComponent:d}=l;return d==null?a(l.name,yM(l)):a(l.name,d)});return()=>{o.forEach(l=>l())}},[a,t]),ce(i.eventHub,te.OPEN,s),null}var EM={name:"WidgetLoaderPlugin",type:tt.DASHBOARD_PLUGIN,component:wm};const wM=EM;function vs(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=_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)}class Li{}vs(Li,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");vs(Li,"INPUT_FILTER","ControlType.INPUT_FILTER");vs(Li,"MARKDOWN","ControlType.MARKDOWN");vs(Li,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");const TM=Li;var OM=_.shape({state:_.shape({panelState:_.shape({})})}),DM=_.shape({panelId:_.string.isRequired,columnName:_.string.isRequired,columnType:_.string.isRequired}),ac=_.shape({panelId:_.string.isRequired,columnName:_.string.isRequired}),Pm=_.shape({start:ac,end:ac,id:_.string,isReversed:_.bool}),IM=_.arrayOf(Pm),xM=_.shape({name:_.string.isRequired,operateAs:_.string.isRequired,groups:_.arrayOf(_.string).isRequired,permissions:_.shape({canUsePanels:_.bool.isRequired,canCopy:_.bool.isRequired,canDownloadCsv:_.bool.isRequired,canLogout:_.bool.isRequired}).isRequired}),NM=Object.freeze({LinkPoint:DM,Link:Pm,Links:IM,Panel:OM,User:xM});const MM=NM;var LM=(n,e)=>n[e]===null?null:_.bool,AM=(n,e)=>n[e]===null?null:_.string,FM=Object.freeze({nullableBoolean:LM,nullableString:AM});const jM=FM,RM=Object.freeze(Object.defineProperty({__proto__:null,ChartBuilderPlugin:om,ChartBuilderPluginConfig:TN,ChartEvent:Ea,ChartPanel:Ni,ChartPanelPlugin:yN,ChartPluginConfig:PN,ChartWidgetPlugin:sm,CommandHistoryPanel:Kp,CommonPropTypes:jM,ConsoleEvent:vt,ConsolePanel:ra,ConsolePlugin:NN,ControlType:TM,DropdownFilterPanel:bn,FileExplorerPanel:Zp,FilterPlugin:lm,FilterPluginConfig:LN,FilterSetManager:Qp,FilterSetManagerPanel:aa,GridPanelPlugin:$N,GridPluginConfig:VN,GridWidgetPlugin:hm,InputFilterEvent:Te,InputFilterPanel:fr,IrisGridEvent:yt,IrisGridPanel:_r,LinkerPlugin:Cm,LinkerPluginConfig:sM,LinkerUtils:Dn,LogPanel:tm,MarkdownEvent:xp,MarkdownPanel:Qn,MarkdownPlugin:ym,MarkdownPluginConfig:uM,MockFileStorage:pN,NotebookEvent:he,NotebookPanel:un,PandasEvent:zD,PandasPanel:am,PandasPanelPlugin:vM,PandasPluginConfig:mM,PandasWidgetPlugin:Em,Panel:Ht,TabEvent:Zr,ToolType:It,UIPropTypes:MM,WidgetLoaderPlugin:wm,WidgetLoaderPluginConfig:wM,WidgetPanel:xi,WidgetPanelTooltip:Ii,addDashboardLinks:$p,deleteDashboardLinks:Up,getColumnSelectionValidatorForDashboard:is,getColumnsForDashboard:Ll,getDashboardConnection:dI,getDashboardConsoleSettings:lI,getDashboardSessionWrapper:Fr,getFilterSetsForDashboard:kp,getInputFiltersForDashboard:ts,getIsolatedLinkerPanelIdForDashboard:rs,getLinksForDashboard:Gn,getTableMapForDashboard:ns,isChartPanelDehydratedProps:zp,isChartPanelFigureMetadata:Fl,isChartPanelTableMetadata:cr,isGLChartPanelState:Gp,isIrisGridPanelMetadata:em,isLegacyIrisGridPanelMetadata:Jp,setDashboardColumnSelectionValidator:Hp,setDashboardConnection:uI,setDashboardConsoleSettings:Vp,setDashboardFilterSets:Bp,setDashboardIsolatedLinkerPanelId:Al,setDashboardLinks:as,setDashboardSessionWrapper:hI,useLoadTablePlugin:dm},Symbol.toStringTag,{value:"Module"}));var _m={react:X,"react-dom":Ta,redux:hg,"react-redux":cg,"@adobe/react-spectrum":fg,"@deephaven/auth-plugins":kw,"@deephaven/chart":CP,"@deephaven/components":pE,"@deephaven/dashboard":KT,"@deephaven/dashboard-core-plugins":RM,"@deephaven/icons":bb,"@deephaven/iris-grid":LD,"@deephaven/jsapi-bootstrap":CE,"@deephaven/jsapi-components":dw,"@deephaven/jsapi-utils":ME,"@deephaven/log":W,"@deephaven/plugin":cw,"@deephaven/react-hooks":wS},kM=vg.createRequires(_m),$M=pg({requires:kM});const UM=$M;function sc(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function zl(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){sc(a,r,i,s,o,"next",l)}function o(l){sc(a,r,i,s,o,"throw",l)}s(void 0)})}}var fn=W.module("@deephaven/app-utils.PluginUtils");function Tm(n){return Co.apply(this,arguments)}function Co(){return Co=zl(function*(n){var e=yield UM(n);return e}),Co.apply(this,arguments)}function Om(n){return So.apply(this,arguments)}function So(){return So=zl(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")}}),So.apply(this,arguments)}function HM(n){return typeof n=="object"&&n!=null&&typeof n.default=="object"}function Dm(n){return Xs(n)?n:HM(n)&&Xs(n.default)?n.default:uv(n)?n:null}function Im(n){return yo.apply(this,arguments)}function yo(){return yo=zl(function*(n){fn.debug("Loading plugins...");try{var e=yield Om("".concat(n,"/manifest.json"));if(!Array.isArray(e.plugins))throw new Error("Plugin manifest JSON does not contain plugins array");fn.debug("Plugin manifest loaded:",e);for(var t=[],r=0;r<e.plugins.length;r+=1){var{name:i,main:a}=e.plugins[r],s="".concat(n,"/").concat(i,"/").concat(a);t.push(Tm(s))}for(var o=yield Promise.allSettled(t),l=new Map,d=0;d<o.length;d+=1){var h=o[d],{name:f}=e.plugins[d];if(h.status==="fulfilled"){var v=Dm(h.value);v==null?fn.error("Plugin '".concat(f,"' is missing an exported value.")):l.set(f,v)}else fn.error("Unable to load plugin '".concat(f,"'"),h.reason)}return fn.info("Plugins loaded:",l),l}catch(p){return fn.error("Unable to load plugins:",p),new Map}}),yo.apply(this,arguments)}function xm(n){var e,t;return(e=(t=n.get("AuthHandlers"))===null||t===void 0?void 0:t.split(","))!==null&&e!==void 0?e:[]}function Nm(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Map,r=xm(e),i=[...n.entries(),...t.entries()].filter(l=>{var[,d]=l;return ll(d)||ca(d)}).map(l=>{var[d,h]=l;return ca(h)?{type:tt.AUTH_PLUGIN,name:d,component:h.AuthPlugin.Component,isAvailable:h.AuthPlugin.isAvailable}:h}),a=i.filter(l=>{var{isAvailable:d}=l;return d(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&&fn.warn("More than one login plugin available, will use the first one: ",a.map(l=>{var{name:d}=l;return d}).join(", "));var{name:s,component:o}=a[0];return fn.info("Using LoginPlugin",s),o}var VM=bc.createRequires(()=>_m),BM=bc.createRemoteComponent({requires:VM});const WM=BM;function oc(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function GM(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){oc(a,r,i,s,o,"next",l)}function o(l){oc(a,r,i,s,o,"throw",l)}s(void 0)})}}function Mm(n){var{pluginsUrl:e,getCorePlugins:t,children:r}=n,[i,a]=c.useState(null);return c.useEffect(function(){var o=!1;function l(){return d.apply(this,arguments)}function d(){return d=GM(function*(){var h,f=(h=yield t==null?void 0:t())!==null&&h!==void 0?h:[],v=yield Im(e);if(!o){var p=f.map(m=>[m.name,m]);a(new Map([...p,...v]))}}),d.apply(this,arguments)}return l(),()=>{o=!0}},[e,t]),u.jsx(Ei.Provider,{value:i,children:r})}function zM(){var n=el();return c.useEffect(function(){n.postMessage(Xo(Yo))},[n]),null}function lc(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function KM(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){lc(a,r,i,s,o,"next",l)}function o(l){lc(a,r,i,s,o,"throw",l)}s(void 0)})}}var qM=new Map([["@deephaven/auth-plugins.AuthPluginParent",{AuthPlugin:gv}],["@deephaven/auth-plugins.AuthPluginPsk",{AuthPlugin:yv}],["@deephaven/auth-plugins.AuthPluginAnonymous",{AuthPlugin:mv}]]);function Lm(n){var{children:e}=n,t=$n(),r=c.useContext(Ei),[i,a]=c.useState(),[s,o]=c.useState();c.useEffect(function(){var f=!1;function v(){return p.apply(this,arguments)}function p(){return p=KM(function*(){try{var m=yield t.getAuthConfigValues();f||a(new Map(m))}catch(b){f||o(b)}}),p.apply(this,arguments)}return v(),()=>{f=!0}},[t]);var l=c.useMemo(()=>{if(!(r==null||i==null))try{return Nm(r,i,qM)}catch(h){o(h)}},[i,r]),d=l==null||i==null;return d||s!=null?u.jsx(Ne,{isLoading:d&&s==null,errorMessage:Sr(s)}):u.jsx(l,{authConfigValues:i,children:u.jsxs(u.Fragment,{children:[u.jsx(zM,{}),e]})})}function dc(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function uc(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){dc(a,r,i,s,o,"next",l)}function o(l){dc(a,r,i,s,o,"throw",l)}s(void 0)})}}var YM=W.module("@deephaven/app-utils.ConnectionBootstrap");function Am(n){var{children:e}=n,t=Ve(),r=$n(),[i,a]=c.useState(),[s,o]=c.useState();c.useEffect(function(){var h=!1;function f(){return v.apply(this,arguments)}function v(){return v=uc(function*(){try{var p=yield r.getAsIdeConnection();if(h)return;o(p)}catch(m){if(h)return;a(m)}}),v.apply(this,arguments)}return f(),()=>{h=!0}},[t,r]),c.useEffect(function(){if(s==null)return;function h(v){var{detail:p}=v;YM.info("Shutdown","".concat(JSON.stringify(p))),a("Server shutdown: ".concat(p??"Unknown reason"))}var f=s.addEventListener(t.IdeConnection.EVENT_SHUTDOWN,h);return f},[t,s]);var l=c.useCallback(function(){var d=uc(function*(h){return z(s,"No connection available to fetch object with"),s.getObject(Hf(h))});return function(h){return d.apply(this,arguments)}}(),[s]);return s==null||i!=null?u.jsx(Ne,{"data-testid":"connection-bootstrap-loading",isLoading:s==null,errorMessage:i!=null?"".concat(i):void 0}):u.jsx(Bc.Provider,{value:s,children:u.jsx(qo.Provider,{value:l,children:e})})}function XM(n){return new URL(n,"".concat(window.location))}function Fm(){var n=new URLSearchParams(window.location.search);return n.get("envoyPrefix")}function jm(){var n=Fm();return n!=null?{headers:{"envoy-prefix":n}}:{headers:{}}}function Rm(n){var{children:e}=n,t=c.useContext(al);return t?u.jsx(u.Fragment,{children:e}):u.jsx(Ne,{"data-testid":"fonts-loaded-loading"})}function hc(n,e,t,r,i,a,s){try{var o=n[a](s),l=o.value}catch(d){t(d);return}o.done?e(l):Promise.resolve(l).then(r,i)}function ZM(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=n.apply(e,t);function s(l){hc(a,r,i,s,o,"next",l)}function o(l){hc(a,r,i,s,o,"throw",l)}s(void 0)})}}var km=c.createContext(null);function QM(n){var{children:e}=n,t=$n(),[r,i]=c.useState(),[a,s]=c.useState();c.useEffect(function(){var d=!1;function h(){return f.apply(this,arguments)}function f(){return f=ZM(function*(){try{var v=yield t.getServerConfigValues();d||i(new Map(v))}catch(p){d||s(p)}}),f.apply(this,arguments)}return h(),()=>{d=!0}},[t]);var o=r==null;return o||a!=null?u.jsx(Ne,{isLoading:o&&a==null,errorMessage:Sr(a)}):u.jsx(km.Provider,{value:r,children:e})}function $m(){return Ir(km,"No server config available in useServerConfig. Was code wrapped in ServerConfigBootstrap or ServerConfigContext.Provider?")}function JM(n){var{children:e}=n,t=$m(),r=c.useContext(Uc),i=c.useContext(Na),a=wv(t,r,i);return u.jsx($c.Provider,{value:a,children:e})}function Um(n){var{children:e}=n,t=c.useContext(Ei),r=c.useMemo(()=>t==null?null:fv(t),[t]);return u.jsx(Yc,{themes:r,children:u.jsx(_v,{children:u.jsx(pO,{children:u.jsx(Jc,{children:e})})})})}function eL(n){var{fontClassNames:e,pluginsUrl:t,getCorePlugins:r,serverUrl:i,children:a}=n,s=c.useMemo(()=>jm(),[]),[o,l]=c.useState(0),d=c.useCallback(()=>{},[]),h=c.useCallback(()=>{l(f=>f+1)},[]);return Ha(d,h),u.jsx(lv,{fontClassNames:e,children:u.jsx(Mm,{getCorePlugins:r,pluginsUrl:t,children:u.jsx(Um,{children:u.jsx(Rf,{serverUrl:i,options:s,children:u.jsx(rv,{children:u.jsx(Lm,{children:u.jsx(QM,{children:u.jsx(JM,{children:u.jsx(Am,{children:u.jsx(Rm,{children:a})})})})})})},o)})})})}const lL=Object.freeze(Object.defineProperty({__proto__:null,AppBootstrap:eL,AuthBootstrap:Lm,ConnectionBootstrap:Am,ConnectionContext:Bc,FontBootstrap:lv,FontsLoaded:Rm,FontsLoadedContext:al,PluginsBootstrap:Mm,RemoteComponent:WM,ThemeBootstrap:Um,getAuthHandlers:xm,getAuthPluginComponent:Nm,getBaseUrl:XM,getConnectOptions:jm,getEnvoyPrefix:Fm,getPluginModuleValue:Dm,loadJson:Om,loadModulePlugin:Tm,loadModulePlugins:Im,useConnection:Qb,useServerConfig:$m,useUser:Jb},Symbol.toStringTag,{value:"Module"}));export{cl as C,sP as D,Re as a,vp as b,lL as i,Tv as u};
|
|
29
|
+
//# sourceMappingURL=index-4cb59416.js.map
|