@deephaven/embed-widget 1.27.2 → 1.27.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/build/assets/{App-COs_rr-K.js → App-2l80ggOj.js} +2 -2
  2. package/build/assets/{App-COs_rr-K.js.map → App-2l80ggOj.js.map} +1 -1
  3. package/build/assets/{Chart-kx7A9pGx.js → Chart-DPcchpDA.js} +2 -2
  4. package/build/assets/{Chart-kx7A9pGx.js.map → Chart-DPcchpDA.js.map} +1 -1
  5. package/build/assets/{IrisGrid-DGHw55uV.js → IrisGrid-BWBMT9kS.js} +17 -17
  6. package/build/assets/IrisGrid-BWBMT9kS.js.map +1 -0
  7. package/build/assets/{IrisGrid-CS05lwoE.css → IrisGrid-Bki4N1kL.css} +1 -1
  8. package/build/assets/{IrisGridContextProvider-aegOeW48.js → IrisGridContextProvider-w99fOPzy.js} +2 -2
  9. package/build/assets/{IrisGridContextProvider-aegOeW48.js.map → IrisGridContextProvider-w99fOPzy.js.map} +1 -1
  10. package/build/assets/{LocalWorkspaceStorage-DugffMo7.js → LocalWorkspaceStorage-CrYV87zj.js} +2 -2
  11. package/build/assets/{LocalWorkspaceStorage-DugffMo7.js.map → LocalWorkspaceStorage-CrYV87zj.js.map} +1 -1
  12. package/build/assets/{LogPanel-DiUK_LSv.js → LogPanel-C_z4zUw7.js} +13 -13
  13. package/build/assets/LogPanel-C_z4zUw7.js.map +1 -0
  14. package/build/assets/{MarkdownEditor-CzCRZyP5.js → MarkdownEditor-qSlV6xJo.js} +2 -2
  15. package/build/assets/{MarkdownEditor-CzCRZyP5.js.map → MarkdownEditor-qSlV6xJo.js.map} +1 -1
  16. package/build/assets/{MarkdownNotebook-DcT9dvUy.js → MarkdownNotebook-BJ0ZoorZ.js} +2 -2
  17. package/build/assets/{MarkdownNotebook-DcT9dvUy.js.map → MarkdownNotebook-BJ0ZoorZ.js.map} +1 -1
  18. package/build/assets/Plot-qZjcmc4S.js +2 -0
  19. package/build/assets/{Plot-CGXK1vWp.js.map → Plot-qZjcmc4S.js.map} +1 -1
  20. package/build/assets/{Plotly-BGfu4vLW.js → Plotly-Dd5V5Hnd.js} +2 -2
  21. package/build/assets/{Plotly-BGfu4vLW.js.map → Plotly-Dd5V5Hnd.js.map} +1 -1
  22. package/build/assets/{index-D9xTCrzD.js → index-B4UF2WoJ.js} +29 -29
  23. package/build/assets/index-B4UF2WoJ.js.map +1 -0
  24. package/build/assets/{index-CIYsBd0T.js → index-Cay9nogS.js} +3 -3
  25. package/build/assets/{index-CIYsBd0T.js.map → index-Cay9nogS.js.map} +1 -1
  26. package/build/assets/{index-B7fHL9sV.js → index-DI0Yu_IY.js} +2 -2
  27. package/build/assets/{index-B7fHL9sV.js.map → index-DI0Yu_IY.js.map} +1 -1
  28. package/build/assets/plotly-CMy5UhTh.js +7 -0
  29. package/build/assets/{plotly-OIrYaxcG.js.map → plotly-CMy5UhTh.js.map} +1 -1
  30. package/build/index.html +2 -2
  31. package/package.json +5 -5
  32. package/build/assets/IrisGrid-DGHw55uV.js.map +0 -1
  33. package/build/assets/LogPanel-DiUK_LSv.js.map +0 -1
  34. package/build/assets/Plot-CGXK1vWp.js +0 -2
  35. package/build/assets/index-D9xTCrzD.js.map +0 -1
  36. package/build/assets/plotly-OIrYaxcG.js +0 -7
@@ -1,25 +1,25 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Plot-CGXK1vWp.js","./Plotly-BGfu4vLW.js","./plotly-OIrYaxcG.js","./helpers-BosuxZz1.js","./vendor-yMTyZX60.js","./vendor-BSYTbjlr.css"])))=>i.map(i=>d[i]);
2
- import{ao as Mu,a as B,aO as As,T as ju,X as Au,Y as ku,V as Nu,a4 as Lu,O as Ru,z as $u,a8 as Fu,d as ks,G as Ns,e as Ls,q as Hu,aP as Uu,aH as Bu,aQ as Rs,aR as Wu,aS as Ku,L as Kn,ac as zu,_ as Vu,aT as $s,u as W,t as Fs,Z as Gu,aU as Xu,aN as qu,aJ as Hs,aK as Zu,f as Us,n as Yu,aL as ai,aV as Ju,aW as Qu,aX as to,aY as ed,aZ as td,a_ as nd,a$ as rd,v as id,k as Bs,aF as od,h as Gr,aA as ad,b0 as sd,b1 as no,aD as ld,b2 as ro,b3 as Ws,b4 as ud,au as dd,b5 as cd,b6 as hd,b7 as md,b8 as pd,b9 as fd,ba as vd}from"./index-CIYsBd0T.js";import{r as m,ag as zn,bt as Mr,D as c,bJ as gd,J as k,G as U,bK as Ks,bL as si,H as bd,R as xi,bM as yd,bN as Sd,bv as Cd,I as me,C as Pt,bO as _d,a7 as wd,a8 as Ed,E as zs,af as vn,bP as Pd,bQ as Td,bR as Od,bS as Id,bG as li,bT as O,bU as io,bI as pe,L as Vs,N as Gs,bV as xd,bH as Vn,bD as _n,_ as Dd,be as Re,bW as Md,ab as jd,av as Ad,bh as oo,bX as kd,bY as ao,bg as rt,bZ as Xs,b_ as Nd,bE as nt,bF as tn,b$ as so,bf as Ld,bC as Rd,c0 as Fn}from"./vendor-yMTyZX60.js";var $d=Object.freeze([]),ES=new Map,qs=()=>{};function PS(n){return Array.isArray(n)?n:[n]}function TS(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return e.filter(r=>r!=null)}function Fd(n,e,t){return(e=Hd(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hd(n){var e=Ud(n,"string");return typeof e=="symbol"?e:e+""}function Ud(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class lo extends Error{constructor(){super(...arguments),Fd(this,"isCanceled",!0)}}function Bd(n,e,t){return(e=Wd(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wd(n){var e=Kd(n,"string");return typeof e=="symbol"?e:e+""}function Kd(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class zd extends Error{constructor(){super(...arguments),Bd(this,"isClipboardPermissionsDeniedError",!0)}}function Vd(n,e,t){return(e=Gd(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gd(n){var e=Xd(n,"string");return typeof e=="symbol"?e:e+""}function Xd(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Xr extends Error{constructor(){super(...arguments),Vd(this,"isClipboardUnavailableError",!0)}}function qd(n,e,t){return(e=Zd(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Zd(n){var e=Yd(n,"string");return typeof e=="symbol"?e:e+""}function Yd(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Zs extends Error{constructor(){super(...arguments),qd(this,"isPermissionUnsupported",!0)}}function uo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Jd(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){uo(o,r,i,a,s,"next",l)}function s(l){uo(o,r,i,a,s,"throw",l)}a(void 0)})}}function co(n){return ui.apply(this,arguments)}function ui(){return ui=Jd(function*(n){try{var e=n;return(yield navigator.permissions.query({name:e})).state}catch(t){throw t instanceof TypeError?new Zs:t}}),ui.apply(this,arguments)}function ho(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.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 o=n.apply(e,t);function a(l){ho(o,r,i,a,s,"next",l)}function s(l){ho(o,r,i,a,s,"throw",l)}a(void 0)})}}function Js(n){return di.apply(this,arguments)}function di(){return di=Ys(function*(n){var e=navigator,t=e.clipboard;if(t!==void 0)try{return yield navigator.clipboard.writeText(n)}catch{}Qd(n)}),di.apply(this,arguments)}function Qd(n){var e=document.activeElement,t=document.createElement("textarea");t.value=n,document.body.appendChild(t),t.focus(),t.select();var r=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!r)throw new Error("Unable to execute copy command")}function OS(){return ci.apply(this,arguments)}function ci(){return ci=Ys(function*(){try{var n=navigator,e=n.clipboard;if(e===void 0)throw new Xr;var t=yield co("clipboard-read");if(t==="granted"){var r=yield e.readText();return r}if(t==="prompt"){try{yield e.readText()}catch{}if(t=yield co("clipboard-read"),t==="granted"){var i=yield e.readText();return i}}if(t==="prompt"||t==="denied")throw new zd}catch(o){throw o instanceof Zs?new Xr:o}throw new Xr}),ci.apply(this,arguments)}var Mn;function on(n,e,t){return(e=ec(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ec(n){var e=tc(n,"string");return typeof e=="symbol"?e:e+""}function tc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var nc="table_",Qs="column_",rc=new Set(["in","not","i","ii","k"]),ic=new Set(["abstract","continue","for","new","switch","assert","default","if","package","synchronized","boolean","do","goto","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","null","true","false"]),oc=/[^a-zA-Z0-9_$\-+@]/g,ac=/[^A-Za-z0-9_$]/g,sc=/^[a-zA-Z_$][a-zA-Z0-9_$\-+@]*$/,lc=/[^a-zA-Z0-9_]/g;function uc(n){return n.replace(/[ -]/g,"_")}function dc(n){return n.replace(/\s/g,"_")}class gt{}Mn=gt;on(gt,"legalize",(n,e,t,r,i,o)=>{var a=e(n.trim());return i&&(rc.has(a)||ic.has(a))&&(a=t+a),a=a.replace(r,""),a?(/^[0-9-]/.test(a)&&(a=t+a),a):t+o});on(gt,"legalizeTableName",n=>Mn.legalize(n,dc,nc,oc,!1,0));on(gt,"makeVariableName",n=>Mn.legalizeTableName(n).replace(lc,"_"));on(gt,"legalizeColumnNames",n=>{var e=[];return n.forEach((t,r)=>{var i=Mn.legalizeColumnName(t,r);e.includes(i)&&(i=Qs+r),e.push(i)}),e});on(gt,"legalizeColumnName",function(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return Mn.legalize(n,uc,Qs,ac,!0,e)});on(gt,"isValidTableName",n=>sc.test(n));on(gt,"isValidColumnName",n=>Mn.legalizeColumnName(n)===n);class el extends CustomEvent{constructor(e,t){super(e,t)}}class Je{static makeCancelable(e,t){var r=!1,i,o,a=new Promise((s,l)=>{o=l,Promise.resolve(e).then(u=>{r?t&&t(u):(i=u,s(u))}).catch(u=>l(u))});return a.cancel=()=>{r=!0,o(new lo),i!=null&&t&&t(i)},a}static isCanceled(e){return e instanceof lo}static isTimedOut(e){return e instanceof Mu}static withTimeout(e,t){return new Promise((r,i)=>{setTimeout(()=>{try{r(t())}catch(o){i(o)}},e)})}}function mo(n,e,t){return(e=cc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cc(n){var e=hc(n,"string");return typeof e=="symbol"?e:e+""}function hc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class jr{constructor(){mo(this,"pending",[]),mo(this,"resolved",[])}add(e,t){var r=Je.makeCancelable(e,t);return this.pending.push(r),r.then(()=>{this.resolve(r)},()=>{this.resolve(r)}),r}remove(e){for(var t=0;t<this.pending.length;t+=1)if(this.pending[t]===e){this.pending.splice(t,1);return}}resolve(e){this.remove(e),this.resolved.push(e)}cancel(){for(var e=[...this.pending,...this.resolved],t=0;t<e.length;t+=1)e[t].cancel();this.pending=[],this.resolved=[]}}function IS(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}function po(n,e){return vc(n)||fc(n,e)||pc(n,e)||mc()}function mc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Plot-qZjcmc4S.js","./Plotly-Dd5V5Hnd.js","./plotly-CMy5UhTh.js","./helpers-BosuxZz1.js","./vendor-yMTyZX60.js","./vendor-BSYTbjlr.css"])))=>i.map(i=>d[i]);
2
+ import{ao as Mu,a as B,aO as As,T as ju,X as Au,Y as ku,V as Nu,a4 as Lu,O as Ru,z as $u,a8 as Fu,d as ks,G as Ns,e as Ls,q as Hu,aP as Uu,aH as Bu,aQ as Rs,aR as Wu,aS as Ku,L as Kn,ac as zu,_ as Vu,aT as $s,u as W,t as Fs,Z as Gu,aU as Xu,aN as qu,aJ as Hs,aK as Zu,f as Us,n as Yu,aL as ai,aV as Ju,aW as Qu,aX as to,aY as ed,aZ as td,a_ as nd,a$ as rd,v as id,k as Bs,aF as od,h as Gr,aA as ad,b0 as sd,b1 as no,aD as ld,b2 as ro,b3 as Ws,b4 as ud,au as dd,b5 as cd,b6 as hd,b7 as md,b8 as pd,b9 as fd,ba as vd}from"./index-Cay9nogS.js";import{r as m,ag as zn,bt as Mr,D as c,bJ as gd,J as k,G as U,bK as Ks,bL as si,H as bd,R as xi,bM as yd,bN as Sd,bv as Cd,I as me,C as Pt,bO as _d,a7 as wd,a8 as Ed,E as zs,af as vn,bP as Pd,bQ as Td,bR as Od,bS as Id,bG as li,bT as O,bU as io,bI as pe,L as Vs,N as Gs,bV as xd,bH as Vn,bD as _n,_ as Dd,be as Re,bW as Md,ab as jd,av as Ad,bh as oo,bX as kd,bY as ao,bg as rt,bZ as Xs,b_ as Nd,bE as nt,bF as tn,b$ as so,bf as Ld,bC as Rd,c0 as Fn}from"./vendor-yMTyZX60.js";var $d=Object.freeze([]),ES=new Map,qs=()=>{};function PS(n){return Array.isArray(n)?n:[n]}function TS(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return e.filter(r=>r!=null)}function Fd(n,e,t){return(e=Hd(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hd(n){var e=Ud(n,"string");return typeof e=="symbol"?e:e+""}function Ud(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class lo extends Error{constructor(){super(...arguments),Fd(this,"isCanceled",!0)}}function Bd(n,e,t){return(e=Wd(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wd(n){var e=Kd(n,"string");return typeof e=="symbol"?e:e+""}function Kd(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class zd extends Error{constructor(){super(...arguments),Bd(this,"isClipboardPermissionsDeniedError",!0)}}function Vd(n,e,t){return(e=Gd(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gd(n){var e=Xd(n,"string");return typeof e=="symbol"?e:e+""}function Xd(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Xr extends Error{constructor(){super(...arguments),Vd(this,"isClipboardUnavailableError",!0)}}function qd(n,e,t){return(e=Zd(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Zd(n){var e=Yd(n,"string");return typeof e=="symbol"?e:e+""}function Yd(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Zs extends Error{constructor(){super(...arguments),qd(this,"isPermissionUnsupported",!0)}}function uo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Jd(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){uo(o,r,i,a,s,"next",l)}function s(l){uo(o,r,i,a,s,"throw",l)}a(void 0)})}}function co(n){return ui.apply(this,arguments)}function ui(){return ui=Jd(function*(n){try{var e=n;return(yield navigator.permissions.query({name:e})).state}catch(t){throw t instanceof TypeError?new Zs:t}}),ui.apply(this,arguments)}function ho(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.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 o=n.apply(e,t);function a(l){ho(o,r,i,a,s,"next",l)}function s(l){ho(o,r,i,a,s,"throw",l)}a(void 0)})}}function Js(n){return di.apply(this,arguments)}function di(){return di=Ys(function*(n){var e=navigator,t=e.clipboard;if(t!==void 0)try{return yield navigator.clipboard.writeText(n)}catch{}Qd(n)}),di.apply(this,arguments)}function Qd(n){var e=document.activeElement,t=document.createElement("textarea");t.value=n,document.body.appendChild(t),t.focus(),t.select();var r=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!r)throw new Error("Unable to execute copy command")}function OS(){return ci.apply(this,arguments)}function ci(){return ci=Ys(function*(){try{var n=navigator,e=n.clipboard;if(e===void 0)throw new Xr;var t=yield co("clipboard-read");if(t==="granted"){var r=yield e.readText();return r}if(t==="prompt"){try{yield e.readText()}catch{}if(t=yield co("clipboard-read"),t==="granted"){var i=yield e.readText();return i}}if(t==="prompt"||t==="denied")throw new zd}catch(o){throw o instanceof Zs?new Xr:o}throw new Xr}),ci.apply(this,arguments)}var Mn;function on(n,e,t){return(e=ec(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ec(n){var e=tc(n,"string");return typeof e=="symbol"?e:e+""}function tc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var nc="table_",Qs="column_",rc=new Set(["in","not","i","ii","k"]),ic=new Set(["abstract","continue","for","new","switch","assert","default","if","package","synchronized","boolean","do","goto","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","null","true","false"]),oc=/[^a-zA-Z0-9_$\-+@]/g,ac=/[^A-Za-z0-9_$]/g,sc=/^[a-zA-Z_$][a-zA-Z0-9_$\-+@]*$/,lc=/[^a-zA-Z0-9_]/g;function uc(n){return n.replace(/[ -]/g,"_")}function dc(n){return n.replace(/\s/g,"_")}class gt{}Mn=gt;on(gt,"legalize",(n,e,t,r,i,o)=>{var a=e(n.trim());return i&&(rc.has(a)||ic.has(a))&&(a=t+a),a=a.replace(r,""),a?(/^[0-9-]/.test(a)&&(a=t+a),a):t+o});on(gt,"legalizeTableName",n=>Mn.legalize(n,dc,nc,oc,!1,0));on(gt,"makeVariableName",n=>Mn.legalizeTableName(n).replace(lc,"_"));on(gt,"legalizeColumnNames",n=>{var e=[];return n.forEach((t,r)=>{var i=Mn.legalizeColumnName(t,r);e.includes(i)&&(i=Qs+r),e.push(i)}),e});on(gt,"legalizeColumnName",function(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return Mn.legalize(n,uc,Qs,ac,!0,e)});on(gt,"isValidTableName",n=>sc.test(n));on(gt,"isValidColumnName",n=>Mn.legalizeColumnName(n)===n);class el extends CustomEvent{constructor(e,t){super(e,t)}}class Je{static makeCancelable(e,t){var r=!1,i,o,a=new Promise((s,l)=>{o=l,Promise.resolve(e).then(u=>{r?t&&t(u):(i=u,s(u))}).catch(u=>l(u))});return a.cancel=()=>{r=!0,o(new lo),i!=null&&t&&t(i)},a}static isCanceled(e){return e instanceof lo}static isTimedOut(e){return e instanceof Mu}static withTimeout(e,t){return new Promise((r,i)=>{setTimeout(()=>{try{r(t())}catch(o){i(o)}},e)})}}function mo(n,e,t){return(e=cc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cc(n){var e=hc(n,"string");return typeof e=="symbol"?e:e+""}function hc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class jr{constructor(){mo(this,"pending",[]),mo(this,"resolved",[])}add(e,t){var r=Je.makeCancelable(e,t);return this.pending.push(r),r.then(()=>{this.resolve(r)},()=>{this.resolve(r)}),r}remove(e){for(var t=0;t<this.pending.length;t+=1)if(this.pending[t]===e){this.pending.splice(t,1);return}}resolve(e){this.remove(e),this.resolved.push(e)}cancel(){for(var e=[...this.pending,...this.resolved],t=0;t<e.length;t+=1)e[t].cancel();this.pending=[],this.resolved=[]}}function IS(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}function po(n,e){return vc(n)||fc(n,e)||pc(n,e)||mc()}function mc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3
3
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pc(n,e){if(n){if(typeof n=="string")return fo(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?fo(n,e):void 0}}function fo(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function fc(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function vc(n){if(Array.isArray(n))return n}class lt{static isValidRange(e){return e!=null&&e.length===2&&Number.isInteger(e[0])&&Number.isInteger(e[1])&&e[0]<=e[1]}static validateRange(e){if(!lt.isValidRange(e))throw new Error("Invalid range! ".concat(e))}static isSelected(e,t){for(var r=0;r<e.length;r+=1){var i=e[r],o=i[0],a=i[1];if(o<=t&&t<=a)return!0}return!1}static selectRange(e,t){for(var r=po(t,2),i=r[0],o=r[1],a=[...e],s=a.length-1;s>=0;s-=1){var l=a[s],u=l[0],d=l[1];if(u<=i&&o<=d)return a;i<=d&&u<=o&&(i=Math.min(i,u),o=Math.max(o,d),a.splice(s,1))}return a.push([i,o]),a}static deselectRange(e,t){for(var r=po(t,2),i=r[0],o=r[1],a=[...e],s=a.length-1;s>=0;s-=1){var l=a[s],u=l[0],d=l[1];if(!(o<u||d<i))if(u<i&&o<d){a[s]=[u,i-1],a.splice(s+1,0,[o+1,d]);break}else i<=u&&d<=o?a.splice(s,1):u<i?a[s]=[u,i-1]:a[s]=[o+1,d]}return a}static count(e){return e.reduce((t,r)=>t+(r[1]-r[0]+1),0)}static getItemsInRanges(e,t){return t.reduce((r,i)=>{for(var o=[...r],a=i[0];a<=i[1];a+=1)o.push(e[a]);return o},[])}}function*xS(n,e){for(var t=n;t<=e;++t)yield t}var DS=" ";class gc{static join(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"and";if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return"".concat(e[0]," ").concat(t," ").concat(e[1]);var r=e.slice(0,e.length-1).join(", "),i=e[e.length-1];return"".concat(r,", ").concat(t," ").concat(i)}static toLower(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e==null){if(t)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return e<t?r?-1:1:e>t?r?1:-1:0}static pluralize(e,t,r){return e===1?t:r??"".concat(t,"s")}}var Gn;function Wt(n,e,t){return(e=bc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bc(n){var e=yc(n,"string");return typeof e=="symbol"?e:e+""}function yc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class He{static formatElapsedTime(e){if(typeof e!="number"||!Number.isInteger(e))throw new Error("".concat(e," is not a number that can be expressed as a formatted time"));var t=Math.floor(e/3600),r=Math.floor(e%3600/60),i=e%60;return"".concat(t>0?"".concat(t,"h "):"")+"".concat(r>0||t>0?"".concat(r,"m "):"")+"".concat(e>=60?"".concat(i,"s").padStart(3,"0"):"".concat(i,"s"))}static formatTime(e){if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error("".concat(e," is not a number that can be expressed as a formatted time"));var t=String(Math.floor(e/(60*60))).padStart(2,"0"),r=e%(60*60),i=String(Math.floor(r/60)).padStart(2,"0"),o=r%60,a=String(Math.ceil(o)).padStart(2,"0");return"".concat(t,":").concat(i,":").concat(a)}static isTimeString(e){return new RegExp(He.TIME_PATTERN).test(e)}static parseTime(e){if(e==null||typeof e!="string")throw new Error("".concat(e," is not a valid string"));var t=e.split(":");if(t.length!==3)throw new Error("".concat(e," is not a time string that can be parsed"));return Number(t[0])*60*60+Number(t[1])*60+Number(t[2])}static formatDuration(e){var t=Math.floor(e/3600),r=Math.floor(e%3600/60),i=e%60;return t>0?"".concat(t,"h ").concat(r,"m ").concat(i,"s"):r>0?"".concat(r,"m ").concat(i.toFixed(1),"s"):"".concat(i.toFixed(2),"s")}static formatConvertedDuration(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"ms";if(e==null||t===""||t===0||t==null)return null;var i=1,o=null,a=null;if(r==="ms")i=1e3,o=new Date(e).valueOf(),a=new Date(t).valueOf();else if(r==="ns")i=1e9,o=Number(e),a=Number(t);else return null;var s=(a-o)/i;return this.formatDuration(s)}}Gn=He;Wt(He,"TIME_PATTERN","([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]");Wt(He,"MILLIS_PER_SECOND",1e3);Wt(He,"NANOS_PER_SECOND",1e9);Wt(He,"NANOS_PER_MIN",60*Gn.NANOS_PER_SECOND);Wt(He,"NANOS_PER_HOUR",60*Gn.NANOS_PER_MIN);Wt(He,"MILLIS_PER_MIN",60*Gn.MILLIS_PER_SECOND);Wt(He,"MILLIS_PER_HOUR",60*Gn.MILLIS_PER_MIN);Wt(He,"TIME_ZONES",Object.freeze([{label:"Tokyo UTC+9 No DST",value:"Asia/Tokyo"},{label:"Seoul UTC+9 No DST",value:"Asia/Seoul"},{label:"Hong Kong UTC+8 No DST",value:"Asia/Hong_Kong"},{label:"Singapore UTC+8 No DST",value:"Asia/Singapore"},{label:"Kolkata UTC+5:30 No DST",value:"Asia/Kolkata"},{label:"Berlin UTC+1",value:"Europe/Berlin"},{label:"UTC UTC±0 No DST",value:"UTC"},{label:"London UTC±0",value:"Europe/London"},{label:"Sao Paulo UTC-2",value:"America/Sao_Paulo"},{label:"Newfoundland UTC-3:30",value:"America/St_Johns"},{label:"Halifax UTC-4",value:"America/Halifax"},{label:"New York UTC−5",value:"America/New_York"},{label:"Chicago UTC-6",value:"America/Chicago"},{label:"Denver UTC-7",value:"America/Denver"},{label:"Los Angeles UTC-8",value:"America/Los_Angeles"},{label:"Anchorage UTC-9",value:"America/Anchorage"},{label:"Honolulu UTC-10 No DST",value:"Pacific/Honolulu"},{label:"Zurich UTC+1",value:"Europe/Zurich"},{label:"Amsterdam UTC+1",value:"Europe/Amsterdam"},{label:"Taipei UTC+8 No DST",value:"Asia/Taipei"},{label:"Sydney UTC+10",value:"Australia/Sydney"}]));function Sc(n,e,t){return(e=Cc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cc(n){var e=_c(n,"string");return typeof e=="symbol"?e:e+""}function _c(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Hn extends Error{constructor(){super(...arguments),Sc(this,"isInvalid",!0)}}function tl(){var n=m.useRef(!1);return m.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[]),n}function vo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function wc(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){vo(o,r,i,a,s,"next",l)}function s(l){vo(o,r,i,a,s,"throw",l)}a(void 0)})}}var Ec=B.module("useAsyncInterval");function Pc(n,e){var t=tl(),r=m.useRef(0),i=m.useRef(0),o=m.useRef(null),a=m.useCallback(wc(function*(){var s=Date.now();i.current+=1;var l=o.current==null?e:s-o.current;o.current=s;try{yield n()}catch(h){Ec.error("A tick error occurred:",h)}if(t.current){l+=Date.now()-o.current;var u=Math.max(0,l-e),d=Math.max(0,e-u);r.current=window.setTimeout(a,d)}}),[n,t,e]);m.useEffect(()=>(o.current=null,a(),()=>{window.clearTimeout(r.current)}),[e,a])}function Xn(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"No value available in context. Was code wrapped in a provider?",t=m.useContext(n);if(t==null)throw new Error(e);return t}function Tc(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=t.leading,i=r===void 0?!1:r,o=t.trailing,a=o===void 0?!0:o,s=t.maxWait,l=m.useMemo(()=>zn(n,e,s!=null?{leading:i,trailing:a,maxWait:s}:{leading:i,trailing:a}),[n,e,i,a,s]);return m.useEffect(()=>()=>l.cancel(),[l]),l}function Oc(n){var e=m.useRef();return m.useEffect(function(){e.current=n}),e.current}function Ic(n,e,t){var r=m.useRef(t),i=m.useRef(n);i.current=n;var o=m.useMemo(()=>Mr(function(){return i.current(...arguments)},e,r.current),[e]);return m.useEffect(()=>()=>{var a,s;(a=(s=r.current)===null||s===void 0?void 0:s.flushOnUnmount)!==null&&a!==void 0&&a?o.flush():o.cancel()},[o]),o}function nl(n){var e=m.useRef(null);return m.useEffect(function(){n&&(typeof n=="function"?n(e.current):n.current=e.current)}),e}function xc(n,e){return Ac(n)||jc(n,e)||Mc(n,e)||Dc()}function Dc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
4
4
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mc(n,e){if(n){if(typeof n=="string")return go(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?go(n,e):void 0}}function go(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function jc(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function Ac(n){if(Array.isArray(n))return n}var kc=3500,Nc=B.module("useCopyToClipboard");function Lc(){var n=m.useState(!1),e=xc(n,2),t=e[0],r=e[1],i=m.useRef(null),o=m.useCallback(a=>{Js(a).then(()=>{r(!0)}).catch(s=>Nc.error("Unable to copy ".concat(a),`
5
5
  `,s))},[]);return m.useEffect(()=>(i.current&&clearTimeout(i.current),t&&(i.current=setTimeout(()=>{r(!1)},kc)),()=>{i.current&&clearTimeout(i.current)}),[t]),[t,o]}var Rc=["gray-50","gray-75","gray-100","gray-200","gray-300","gray-400","gray-500","gray-600","gray-700","gray-800","gray-900","red-100","red-200","red-300","red-400","red-500","red-600","red-700","red-800","red-900","red-1000","red-1100","red-1200","red-1300","red-1400","orange-100","orange-200","orange-300","orange-400","orange-500","orange-600","orange-700","orange-800","orange-900","orange-1000","orange-1100","orange-1200","orange-1300","orange-1400","yellow-100","yellow-200","yellow-300","yellow-400","yellow-500","yellow-600","yellow-700","yellow-800","yellow-900","yellow-1000","yellow-1100","yellow-1200","yellow-1300","yellow-1400","chartreuse-100","chartreuse-200","chartreuse-300","chartreuse-400","chartreuse-500","chartreuse-600","chartreuse-700","chartreuse-800","chartreuse-900","chartreuse-1000","chartreuse-1100","chartreuse-1200","chartreuse-1300","chartreuse-1400","celery-100","celery-200","celery-300","celery-400","celery-500","celery-600","celery-700","celery-800","celery-900","celery-1000","celery-1100","celery-1200","celery-1300","celery-1400","green-100","green-200","green-300","green-400","green-500","green-600","green-700","green-800","green-900","green-1000","green-1100","green-1200","green-1300","green-1400","seafoam-100","seafoam-200","seafoam-300","seafoam-400","seafoam-500","seafoam-600","seafoam-700","seafoam-800","seafoam-900","seafoam-1000","seafoam-1100","seafoam-1200","seafoam-1300","seafoam-1400","cyan-100","cyan-200","cyan-300","cyan-400","cyan-500","cyan-600","cyan-700","cyan-800","cyan-900","cyan-1000","cyan-1100","cyan-1200","cyan-1300","cyan-1400","blue-100","blue-200","blue-300","blue-400","blue-500","blue-600","blue-700","blue-800","blue-900","blue-1000","blue-1100","blue-1200","blue-1300","blue-1400","indigo-100","indigo-200","indigo-300","indigo-400","indigo-500","indigo-600","indigo-700","indigo-800","indigo-900","indigo-1000","indigo-1100","indigo-1200","indigo-1300","indigo-1400","purple-100","purple-200","purple-300","purple-400","purple-500","purple-600","purple-700","purple-800","purple-900","purple-1000","purple-1100","purple-1200","purple-1300","purple-1400","fuchsia-100","fuchsia-200","fuchsia-300","fuchsia-400","fuchsia-500","fuchsia-600","fuchsia-700","fuchsia-800","fuchsia-900","fuchsia-1000","fuchsia-1100","fuchsia-1200","fuchsia-1300","fuchsia-1400","magenta-100","magenta-200","magenta-300","magenta-400","magenta-500","magenta-600","magenta-700","magenta-800","magenta-900","magenta-1000","magenta-1100","magenta-1200","magenta-1300","magenta-1400","negative","notice","positive","info","accent","accent-100","accent-200","accent-300","accent-400","accent-500","accent-600","accent-700","accent-800","accent-900","accent-1000","accent-1100","accent-1200","accent-1300","accent-1400","bg","content-bg","subdued-content-bg","surface-bg","fg"];function $c(n){return typeof n=="string"&&Rc.includes(n)}function rl(n){return n!=null&&$c(n)?"var(--dh-color-".concat(n,")"):n}var Fc=["color","UNSAFE_style"];function bo(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 ar(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bo(Object(t),!0).forEach(function(r){Hc(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):bo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Hc(n,e,t){return(e=Uc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Uc(n){var e=Bc(n,"string");return typeof e=="symbol"?e:e+""}function Bc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Wc(n,e){if(n==null)return{};var t,r,i=Kc(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function Kc(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}var il=m.forwardRef((n,e)=>{var t=n.color,r=n.UNSAFE_style,i=Wc(n,Fc),o=m.useMemo(()=>ar(ar({},r),{},{color:rl(t)}),[t,r]);return c.jsx(gd,ar(ar({},i),{},{ref:e,UNSAFE_style:o}))});il.displayName="Text";function yo(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 jt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?yo(Object(t),!0).forEach(function(r){gn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):yo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function gn(n,e,t){return(e=zc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zc(n){var e=Vc(n,"string");return typeof e=="symbol"?e:e+""}function Vc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var So="popper",Gc="popper-container",Xc={placement:"bottom-end",modifiers:{preventOverflow:{boundariesElement:"scrollParent",fn:(n,e)=>{var t,r,i=(t=Ks.Defaults.modifiers)===null||t===void 0||(t=t.preventOverflow)===null||t===void 0||(r=t.fn)===null||r===void 0?void 0:r.call(t,n,e);return i==null?n:(i.styles.maxHeight="".concat(document.documentElement.clientHeight-n.offsets.popper.top-2*e.padding,"px"),i??n)}},flip:{enabled:!1}}};class Ar extends m.Component{constructor(e){super(e),gn(this,"element",void 0),gn(this,"container",void 0),gn(this,"nodeRef",k.createRef()),gn(this,"rAF",void 0),this.handleEnter=this.handleEnter.bind(this),this.handleExit=this.handleExit.bind(this),this.handleBlur=this.handleBlur.bind(this),this.element=document.createElement("div"),this.updateContainerClassName(e.containerClassName,e.isMaximized),this.container=k.createRef(),this.rAF=0;var t=this.props.isShown;this.state={show:t,popper:null}}componentDidUpdate(e){var t=this.props,r=t.isShown,i=t.containerClassName,o=t.isMaximized,a=this.state.popper;(e.containerClassName!==i||e.isMaximized!==o)&&this.updateContainerClassName(i,o),e.isShown!==r&&(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{r?this.show():this.hide()})),a&&a.scheduleUpdate()}componentWillUnmount(){this.destroyPopper(!1)}updateContainerClassName(e,t){this.element.className=U(Gc,e,{maximized:t})}getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){var e,t,r=this.state.popper,i=this.props,o=i.closeOnBlur,a=i.referenceObject;if(!r&&this.container.current!==null){var s=this.props,l=s.options,u=s.keepInParent,d=u?Xc:{placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}}},h=jt(jt(jt({},d),l),{},{modifiers:jt(jt(jt({},d.modifiers),l.modifiers),{},{preventOverflow:jt(jt({},(e=d.modifiers)===null||e===void 0?void 0:e.preventOverflow),(t=l.modifiers)===null||t===void 0?void 0:t.preventOverflow)})});document.body.appendChild(this.element);var p=this.getVisibleElement(this.container.current);p==null&&(p=this.container.current);var f=new Ks(a||p,this.element,h);f.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(o){var v=this.element.querySelector(".".concat(So));v instanceof HTMLElement&&!v.contains(document.activeElement)&&v.focus()}}),si.flushSync(()=>{this.setState({popper:f})})}}destroyPopper(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;cancelAnimationFrame(this.rAF);var t=this.state.popper;t&&(t.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),si.flushSync(()=>{this.setState({show:!0})})}hide(){this.setState({show:!1})}scheduleUpdate(){var e=this.state.popper;e&&e.scheduleUpdate()}handleBlur(e){var t=this.props,r=t.closeOnBlur,i=t.onBlur;e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||(i==null||i(e),r&&this.hide()))}handleEnter(){var e=this.props.onEntered;e()}handleExit(){var e=this.props.onExited,t=this.state.show;t||this.destroyPopper(),e()}renderContent(){var e=this.props,t=e.className,r=e.children,i=e.timeout,o=e.interactive,a=e.closeOnBlur,s=e.containPortals,l=this.state.show,u=s?c.jsx(yd,{getContainer:()=>this.element,children:r}):r;return c.jsx(As,{isPortal:!0,children:c.jsx(bd,{in:l,timeout:i,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,nodeRef:this.nodeRef,children:c.jsx("div",{ref:this.nodeRef,onClick:d=>{d.stopPropagation()},onKeyDown:d=>{d.key==="Escape"&&this.hide()},className:U(So,{interactive:o},t),onBlur:this.handleBlur,tabIndex:a?-1:void 0,role:"presentation",children:c.jsxs("div",{className:U("popper-content",{"popper-content--contain-portals":s}),children:[u,c.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})})}render(){var e=this.state.popper,t=this.props["data-testid"];return c.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&xi.createPortal(this.renderContent(),this.element)})}}gn(Ar,"defaultProps",{options:{},className:"",containerClassName:"",isMaximized:!1,timeout:ju.transitionMs,onEntered(){},onExited(){},onBlur(){},isShown:!1,interactive:!1,closeOnBlur:!1,keepInParent:!1,containPortals:!1,referenceObject:null,"data-testid":void 0});var hi;function Co(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 qc(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Co(Object(t),!0).forEach(function(r){ut(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Co(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ut(n,e,t){return(e=Zc(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Zc(n){var e=Yc(n,"string");return typeof e=="symbol"?e:e+""}function Yc(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Jc=B.module("Tooltip");class ue extends m.Component{static handleHidden(){ue.shownTooltipCount-=1,ue.shownTooltipCount===0&&(ue.lastHiddenTime=Date.now())}static handleShown(){ue.shownTooltipCount+=1}constructor(e){super(e),ut(this,"container",void 0),ut(this,"popper",void 0),ut(this,"parent",void 0),ut(this,"timer",void 0),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowMouseMove=this.handleWindowMouseMove.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.handleExited=this.handleExited.bind(this),this.stopShowingTooltip=this.stopShowingTooltip.bind(this),this.container=k.createRef(),this.popper=k.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();var e=this.props.timeout;e===0&&this.show()}componentDidUpdate(e,t){var r=t.isShown,i=this.state.isShown;i!==r&&(i?ue.handleShown():ue.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();var e=this.state.isShown;e&&ue.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){Jc.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){this.parent&&(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){var e=this.state.isShown;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){var e=this.state.isShown;this.stopTimer();var t=this.props.interactive;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){var t=e.clientX,r=e.clientY,i=this.state.isShown;if(!(!this.popper.current||!this.parent)){var o=this.popper.current.element.getBoundingClientRect(),a=this.parent.getBoundingClientRect();t>=o.left&&t<=o.left+o.width&&r>=o.top&&r<=o.top+o.height?this.handleMouseMove():t>=a.left&&t<=a.left+a.width&&r>=a.top&&r<=a.top+a.height?this.handleMouseMove():i&&(this.stopTimer(),this.hide())}}startTimer(){this.stopTimer();var e=this.props,t=e.timeout,r=e.reshowTimeout,i=t;(ue.shownTooltipCount>0||Date.now()-ue.lastHiddenTime<ue.triggerReshowThreshold)&&(i=r),this.timer=window.setTimeout(this.handleTimeout,i)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var e=this.state.isShown;if(this.stopTimer(),!e){var t;(t=this.popper.current)===null||t===void 0||t.show(),si.flushSync(()=>{this.setState({isShown:!0})});var r=this.props.interactive;r&&this.startListeningWindow()}}hide(){var e;(e=this.popper.current)===null||e===void 0||e.hide(),this.stopListeningWindow()}update(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleExited(){this.setState({isShown:!1});var e=this.props.onExited;e()}stopShowingTooltip(){var e=this.state.isShown;this.stopTimer(),e&&this.hide()}render(){var e=this.props,t=e.interactive,r=e.children,i=e.referenceObject,o=e.popperClassName,a=e["data-testid"],s=e.onEntered,l=this.state.isShown,u=this.props.options;return u=qc({placement:"bottom"},u),c.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":a,children:c.jsx(Ar,{className:U(o,"popper-tooltip"),options:u,ref:this.popper,onEntered:s,onExited:this.handleExited,interactive:t,referenceObject:i,children:c.jsxs("div",{className:"tooltip-content",children:[" ",l&&r]})})})}}hi=ue;ut(ue,"defaultTimeout",500);ut(ue,"defaultReshowTimeout",100);ut(ue,"triggerReshowThreshold",300);ut(ue,"shownTooltipCount",0);ut(ue,"lastHiddenTime",Date.now());ut(ue,"defaultProps",{interactive:!1,options:{},popperClassName:"",reshowTimeout:hi.defaultReshowTimeout,timeout:hi.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});function _o(n,e){return nh(n)||th(n,e)||eh(n,e)||Qc()}function Qc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
6
6
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function eh(n,e){if(n){if(typeof n=="string")return wo(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?wo(n,e):void 0}}function wo(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function th(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function nh(n){if(Array.isArray(n))return n}var rh=B.module("ThemeProvider"),Di=m.createContext(null);Di.displayName="ThemeContext";function MS(n){var e=n.themes,t=n.waitForActivation,r=t===void 0?!1:t,i=n.defaultPreloadValues,o=i===void 0?$u:i,a=n.children,s=m.useMemo(()=>Au(),[]),l=m.useState(null),u=_o(l,2),d=u[0],h=u[1],p=m.useState(ku),f=_o(p,2),v=f[0],g=f[1],b=m.useMemo(()=>e==null?null:Nu(v,{base:s,custom:e??[]}),[s,v,e]),y=m.useMemo(()=>[...s,...e??[]],[s,e]);return m.useEffect(function(){if(!(b==null||e==null)){Lu(o);var C=Ru(o);rh.debug2("updateThemePreloadData:",{active:b.map(_=>_.themeKey),custom:e.map(_=>_.themeKey),preloadStyleContent:C,selectedThemeKey:v}),Fu({themeKey:v,preloadStyleContent:C})}},[b,v,e,o]),m.useEffect(()=>{h({activeThemes:b,selectedThemeKey:v,themes:y,setSelectedThemeKey:g})},[b,v,y]),r&&b==null?null:c.jsxs(c.Fragment,{children:[b==null?null:c.jsx(c.Fragment,{children:b.map(S=>c.jsx("style",{"data-theme-key":S.themeKey,children:S.styleContent},S.themeKey))}),d==null?null:c.jsx(Di.Provider,{value:d,children:c.jsx(As,{children:a})})]})}function ol(){return Xn(Di,"No ThemeContext value found. Component must be wrapped in a ThemeContext.Provider")}var ih=["color","UNSAFE_style"];function Eo(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 sr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Eo(Object(t),!0).forEach(function(r){oh(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Eo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function oh(n,e,t){return(e=ah(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ah(n){var e=sh(n,"string");return typeof e=="symbol"?e:e+""}function sh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);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){if(n==null)return{};var t,r,i=uh(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function uh(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}var al=m.forwardRef((n,e)=>{var t=n.color,r=n.UNSAFE_style,i=lh(n,ih),o=m.useMemo(()=>sr(sr({},r),{},{color:rl(t)}),[t,r]);return c.jsx(Sd,sr(sr({},i),{},{ref:e,UNSAFE_style:o}))});al.displayName="Heading";function dh(n){var e=n.children,t=n.className,r=n.style,i=n["data-testid"];return c.jsx("div",{className:U("btn-group",t),style:r,role:"group","data-testid":i,children:e})}var ch=["kind","variant","type","tooltip","icon","disabled","active","onClick","onContextMenu","onMouseDown","onMouseUp","onMouseEnter","onMouseLeave","onKeyDown","className","style","children","tabIndex","data-testid","aria-label"];function Po(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 To(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Po(Object(t),!0).forEach(function(r){hh(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Po(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function hh(n,e,t){return(e=mh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mh(n){var e=ph(n,"string");return typeof e=="symbol"?e:e+""}function ph(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function fh(n,e){if(n==null)return{};var t,r,i=vh(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function vh(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}function gh(n,e){switch(n){case"primary":return"btn-primary";case"secondary":return"btn-outline-primary";case"tertiary":return"btn-secondary";case"success":return"btn-success";case"danger":return"btn-danger";case"inline":return"btn-inline";case"ghost":return U("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function bh(n){switch(n){case"group-end":return U("pl-2","pr-3")}}var ne=k.forwardRef((n,e)=>{var t=n.kind,r=n.variant,i=n.type,o=i===void 0?"button":i,a=n.tooltip,s=n.icon,l=n.disabled,u=l===void 0?!1:l,d=n.active,h=n.onClick,p=n.onContextMenu,f=n.onMouseDown,v=n.onMouseUp,g=n.onMouseEnter,b=n.onMouseLeave,y=n.onKeyDown,S=n.className,C=n.style,_=n.children,w=n.tabIndex,D=n["data-testid"],F=n["aria-label"],N=fh(n,ch),x=Cd({},"button"),j=x.UNSAFE_className,L;r&&(L=bh(r));var re;s&&(re=k.isValidElement(s)?s:c.jsx(me,{icon:s}));var A=re!=null&&_==null,X=gh(t,A),ie;a!==void 0&&(ie=typeof a=="string"?c.jsx(ue,{children:a}):a);var oe=F;F===void 0&&A&&a!=null&&typeof a=="string"&&(oe=a);var be=c.jsxs("button",To(To({"data-testid":D,ref:e,type:o,className:U("btn",X,L,{active:d},S,j),onClick:h,onContextMenu:p,onMouseUp:v,onMouseDown:f,onMouseEnter:g,onMouseLeave:b,onKeyDown:y,style:C,disabled:u,tabIndex:w,"aria-label":oe},N),{},{children:[s&&re,_,a!=null&&!u&&ie]}));return u&&a!=null?c.jsxs("span",{className:"btn-disabled-wrapper",children:[be,ie]}):be});ne.displayName="Button";function sl(n){var e=n.className,t=n.children,r=n["data-testid"];return c.jsx("div",{className:U("modal-footer",e),"data-testid":r,children:t})}function mi(n){var e=n.isOpen,t=n.headerText,r=n.bodyText,i=n.onCancel,o=n.onConfirm,a=n.onDiscard,s=n.onModalDisable,l=n.cancelButtonText,u=l===void 0?"Cancel":l,d=n.confirmButtonText,h=d===void 0?"Okay":d,p=n.discardButtonText,f=p===void 0?"Discard":p,v=n.isConfirmDanger,g=v===void 0?!1:v,b=n.children,y=n["data-testid"],S=m.useRef(null),C=m.useRef(null),_=m.useCallback(()=>{C.current!==null&&C.current.checked&&s&&s(),o()},[o,s]),w=m.useCallback(()=>{var F;(F=S.current)===null||F===void 0||F.focus()},[]),D="";return e&&(D=typeof r=="function"?r():r),c.jsxs(ks,{isOpen:e,onOpened:w,children:[c.jsx(Ns,{closeButton:!1,children:t}),c.jsx(Ls,{children:D}),c.jsxs(sl,{children:[s&&c.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[c.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:C,"data-testid":y!==void 0?"".concat(y,"-checkbox-confirm"):void 0}),c.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),a&&c.jsx(ne,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:a,"data-testid":y!==void 0?"".concat(y,"-btn-discard"):void 0,children:f}),i&&c.jsx(ne,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":y!==void 0?"".concat(y,"-btn-cancel"):void 0,children:u}),c.jsxs(dh,{children:[c.jsx(ne,{kind:g?"danger":"primary",onClick:_,ref:S,"data-testid":y!==void 0?"".concat(y,"-btn-confirm"):void 0,children:h}),b]})]})]})}function yh(n,e,t){return(e=Sh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sh(n){var e=Ch(n,"string");return typeof e=="symbol"?e:e+""}function Ch(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function qr(n){return n.then!==void 0}class ge{static disableAllActions(){ge.actionsDisabled=!0}static enableAllActions(){ge.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){if(e.group!==t.group){var r,i;return((r=e.group)!==null&&r!==void 0?r:0)>((i=t.group)!==null&&i!==void 0?i:0)?1:-1}if(e.order!==t.order){var o,a;return((o=e.order)!==null&&o!==void 0?o:0)>((a=t.order)!==null&&a!==void 0?a:0)?1:-1}if(e.title!==t.title){var s,l;return((s=e.title)!==null&&s!==void 0?s:"")>((l=t.title)!==null&&l!==void 0?l:"")?1:-1}return e!==t?e>t?1:-1:0}static sortActions(e){if(e==null||!Array.isArray(e))return[];var t=e.slice();return t.sort(ge.compareActions),t}static isMacPlatform(){var e=window.navigator.platform;return e.startsWith("Mac")}static getModifierKey(){return ge.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){var t=ge.getModifierKey();return e[t]}static getMenuItems(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=[],i=e;Array.isArray(i)||(i=[i]);for(var o=0;o<i.length;o+=1){var a=i[o],s=void 0;typeof a=="function"?s=a():s=a,s!=null&&(s instanceof Promise?t&&r.push(s):Array.isArray(s)?r=r.concat(s):r.push(s))}return r=r.filter(l=>l.title!==void 0||l.then!=null||l.menuElement),r}static getNextMenuItem(e,t,r){var i=e;i<0&&t<0&&(i=r.length);for(var o=1;o<r.length+1;o+=1){var a=(i+t*o+r.length)%r.length,s=r[a];if(!(s instanceof Promise)&&s.disabled!==!0)return a}return e}}yh(ge,"actionsDisabled",!1);var Oo=B.module("GlobalContextAction");class _h extends m.Component{constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentDidMount(){document.body.addEventListener("contextmenu",this.handleContextMenu),document.body.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.body.removeEventListener("contextmenu",this.handleContextMenu),document.body.removeEventListener("keydown",this.handleKeyDown)}handleContextMenu(e){var t=e;t.contextActions==null&&(t.contextActions=[]);var r=this.props.action;r.title==null&&!r.menuElement||(t.contextActions==null&&(t.contextActions=[]),t.contextActions.push(r),Oo.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){var t=this.props.action;if(!ge.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)){var r;Oo.debug("Global hotkey matched!",e),(r=t.action)===null||r===void 0||r.call(t,e),e.preventDefault(),e.stopPropagation()}}render(){return null}}class wh extends m.Component{render(){for(var e=this.props,t=e.actions,r=e["data-testid"],i=[],o=0;o<t.length;o+=1){var a=t[o],s=a.shortcut;if(a.title!=null||a.menuElement||s){var l=c.jsx(_h,{action:a,"data-testid":r},"".concat(a.title,".").concat(s==null?void 0:s.id));i.push(l)}}return i}}function ll(n,e,t){return(e=Eh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Eh(n){var e=Ph(n,"string");return typeof e=="symbol"?e:e+""}function Ph(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var lr=B.module("ContextActions");class de extends m.Component{static triggerMenu(e,t,r,i){if(i.length!==0){var o=new MouseEvent("contextmenu",{clientX:t,clientY:r,bubbles:!0,cancelable:!0});o.contextActions=i,e.dispatchEvent(o)}}constructor(e){super(e),ll(this,"container",void 0),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=k.createRef(),this.state={globalActions:[],keyboardActions:[]}}static getDerivedStateFromProps(e){if(e.actions==null||!Array.isArray(e.actions))return{globalActions:[],keyboardActions:[]};var t=e.actions.filter(i=>!qr(i)&&typeof i!="function"&&i.isGlobal),r=e.actions.filter(i=>!qr(i)&&typeof i!="function"&&(i.isGlobal===void 0||!i.isGlobal)&&i.shortcut!=null);return{globalActions:t,keyboardActions:r}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}handleContextMenu(e){var t=this.props.ignoreClassNames,r=t===void 0?[]:t;if(r.length>0){for(var i=e.target,o=function(){var d=i,h=d.classList,p=r.find(f=>h.contains(f));if(p!==void 0)return lr.debug2('Contextmenu event ignored based on the target className "'.concat(p,'"')),{v:void 0};i=i.parentElement},a;i!=null;)if(a=o(),a)return a.v}if(ge.isContextActionEvent(e)||(e.contextActions=[]),!!ge.isContextActionEvent(e)){var s=this.props.actions;if(s!=null){var l=s;Array.isArray(l)&&(l=l.filter(u=>qr(u)||typeof u=="function"||u.isGlobal===void 0||!u.isGlobal)),e.contextActions=e.contextActions.concat(l)}lr.debug("Received context menu event! Menu items are now: ",e.contextActions)}}handleKeyDown(e){for(var t=this.state.keyboardActions,r=0;r<t.length;r+=1){var i=t[r];if(!ge.actionsDisabled&&i.shortcut!=null&&i.shortcut.matchesEvent(e)){var o;lr.debug("Context hotkey matched!",e),(o=i.action)===null||o===void 0||o.call(i,e),e.stopPropagation(),e.preventDefault(),lr.debug2("Matched hotkey returned false, key event not consumed")}}}render(){var e=this.props["data-testid"],t=this.state.globalActions;return c.jsx("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:c.jsx(wh,{actions:t})})}}ll(de,"groups",{default:void 0,high:100,medium:5e3,low:1e4,global:1e5,edit:100});var ul=k.forwardRef((n,e)=>{var t,r,i=n.closeMenu,o=n.children,a=n.menuItem,s=n.onMenuItemClick,l=n.onMenuItemMouseMove,u=n.onMenuItemContextMenu,d=n.isKeyboardSelected,h=d===void 0?!1:d,p=n.isMouseSelected,f=p===void 0?!1:p,v=n["data-testid"],g=m.useCallback(A=>{s(a,A)},[a,s]),b=m.useCallback(A=>{l(a,A)},[a,l]),y=m.useCallback(A=>{u(a,A)},[a,u]);function S(A,X,ie){if(typeof A.type=="string")return A;var oe={menuItem:a,closeMenu:i,isKeyboardSelected:h,isMouseSelected:f,iconElement:X,displayShortcut:ie,"data-testid":v};return k.cloneElement(A,{forwardedProps:oe})}var C=(t=a.shortcutText)!==null&&t!==void 0?t:(r=a.shortcut)===null||r===void 0?void 0:r.getDisplayText(),_=null;if(a.icon){var w=a.icon;if(k.isValidElement(w))_=w;else{var D;a.iconColor!=null&&(a.disabled===void 0||!a.disabled)&&(D={color:a.iconColor}),_=c.jsx(me,{icon:w,style:D})}}var F=null,N=!!o;a.actions&&(F=c.jsx(me,{icon:Hu}));var x=null;if(a.menuElement)x=c.jsx("div",{className:"custom-menu-item",onMouseMove:b,children:S(a.menuElement,_,C)});else{var j,L=a.disabled,re=a.iconOutline;x=c.jsx("button",{type:"button",className:U("btn-context-menu",{disabled:L},{active:(N||f)&&(L===void 0||!L)},{"keyboard-active":h&&(L===void 0||!L)}),onClick:g,onMouseMove:b,onContextMenu:y,title:(j=a.description)!==null&&j!==void 0?j:"",children:c.jsxs("div",{className:"btn-context-menu-wrapper",children:[c.jsx("span",{className:U("icon",{outline:re}),children:_}),c.jsx("span",{className:"title",children:a.title}),C!==void 0&&c.jsx("span",{className:"shortcut",children:C}),F&&c.jsx("span",{className:U("submenu-indicator",{disabled:L}),children:F})]})})}return c.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":v,children:[o,x]})});ul.displayName="ContextMenuItem";function Th(n,e){return Dh(n)||xh(n,e)||Ih(n,e)||Oh()}function Oh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
7
7
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ih(n,e){if(n){if(typeof n=="string")return Io(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Io(n,e):void 0}}function Io(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function xh(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function Dh(n){if(Array.isArray(n))return n}var dl=k.forwardRef((n,e)=>{var t=n.checked,r=t===void 0?!1:t,i=n.children,o=n.className,a=n.disabled,s=a===void 0?!1:a,l=n.inputClassName,u=n.isInvalid,d=u===void 0?!1:u,h=n.labelClassName,p=n.name,f=n.onChange,v=n["data-testid"],g=m.useState(Pt()),b=Th(g,1),y=b[0],S=nl(e);m.useEffect(function(){S.current&&(S.current.indeterminate=r===null)},[S,r]);var C=m.useCallback(_=>{S.current&&(S.current.indeterminate=r===null),f&&f(_)},[S,r,f]);return c.jsxs("div",{className:U("custom-control custom-checkbox",o),children:[c.jsx("input",{type:"checkbox",ref:S,checked:r??!1,className:U("custom-control-input",l,{"is-invalid":d}),disabled:s,id:y,name:p,onChange:C,"data-testid":v}),c.jsx("label",{className:U("custom-control-label",h),htmlFor:y,children:i})]})});dl.displayName="Checkbox";function wr(n){return(n==null?void 0:n.WrappedComponent)!==void 0}function cl(n){return wr(n)&&cl(n.WrappedComponent)?!0:n.prototype!=null&&n.prototype.isReactComponent!=null}function Mh(n){return!wr(n)&&"$$typeof"in n&&n.$$typeof===_d.ForwardRef}function hl(n){return cl(n)||Mh(n)}var jh=["copy","tooltip","children"];function xo(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 Do(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xo(Object(t),!0).forEach(function(r){Ah(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):xo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ah(n,e,t){return(e=kh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function kh(n){var e=Nh(n,"string");return typeof e=="symbol"?e:e+""}function Nh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);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){return Hh(n)||Fh(n,e)||$h(n,e)||Rh()}function Rh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
8
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $h(n,e){if(n){if(typeof n=="string")return Mo(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Mo(n,e):void 0}}function Mo(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function Fh(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function Hh(n){if(Array.isArray(n))return n}function Uh(n,e){if(n==null)return{};var t,r,i=Bh(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function Bh(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}var jo="Copy";function ml(n){var e=n.copy,t=n.tooltip,r=t===void 0?jo:t,i=n.children,o=Uh(n,jh),a=Lc(),s=Lh(a,2),l=s[0],u=s[1],d=l?"Copied":r;return c.jsxs(wd,Do(Do({},o),{},{"aria-label":d,onPress:()=>{u(typeof e=="function"?e():e)},children:[c.jsx(Ed,{UNSAFE_className:i==null?"action-button-icon-with-tooltip":void 0,children:c.jsx(me,{icon:l?Uu:Bu})}),i!=null&&c.jsx(il,{children:i}),(i==null||d!==jo)&&c.jsx(ue,{children:d})]}))}ml.displayName="CopyButton";function Ao(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 Wh(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ao(Object(t),!0).forEach(function(r){Un(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ao(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Un(n,e,t){return(e=Kh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kh(n){var e=zh(n,"string");return typeof e=="symbol"?e:e+""}function zh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class pl extends m.PureComponent{constructor(e){var t;super(e),Un(this,"container",void 0),Un(this,"oldFocus",void 0),Un(this,"rAF",void 0),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.container=k.createRef(),this.oldFocus=document.activeElement,this.rAF=0;var r=e.options,i=(t=r.initialKeyboardIndex)!==null&&t!==void 0?t:-1;this.state={menuItems:[],keyboardIndex:i,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)===null||e===void 0||e.focus();var t=this.props.onMenuOpened;t(this)})}componentDidUpdate(e){var t=this.props.actions;e.actions!==t&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}getKeyboardIndex(){var e=this.props.options;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){var t=this.state.keyboardIndex;return t}return this.getMouseIndex()}setKeyboardIndex(e){var t=this.props.options;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){var e=this.state.mouseIndex;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});var e=this.props.actions,t=ge.getMenuItems(e,!1);t.length>0&&this.setState(r=>({menuItems:ge.sortActions(r.menuItems.concat(t))}))}handleKeyDown(e){var t=this.state.menuItems,r=this.getKeyboardIndex(),i=r;if(e.key==="Enter"||e.key===" "){r!=null&&r>=0&&r<t.length&&this.handleMenuItemClick(t[r],e);return}e.key==="Escape"?i=null:e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0?i=ge.getNextMenuItem(i??0,-1,t):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(i=ge.getNextMenuItem(i??0,1,t)),r!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.props,r=t.closeMenu,i=t.onMenuClosed;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{r(e),i(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation(),e!=null&&(e.disabled===void 0||!e.disabled)&&e.action!=null&&(e.action(t.nativeEvent),this.closeMenu(!0))}handleMenuItemMouseMove(e){var t=this.state.menuItems,r=t.indexOf(e);this.setMouseIndex(r)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],t=this.props["data-testid"],r=this.state,i=r.keyboardIndex,o=r.menuItems,a=r.mouseIndex,s=0;s<o.length;s+=1){var l=o[s];s>0&&l.group!==o[s-1].group&&e.push(c.jsx("hr",{},"".concat(s,".separator")));var u=c.jsx(ul,{isKeyboardSelected:i===s,isMouseSelected:a===s,menuItem:l,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},s);e.push(u)}var d=this.props.menuStyle;return c.jsx("div",{className:"context-menu-container",style:Wh({},d),ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}}Un(pl,"defaultProps",{closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});function ko(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 No(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ko(Object(t),!0).forEach(function(r){bn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ko(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function bn(n,e,t){return(e=Vh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Vh(n){var e=Gh(n,"string");return typeof e=="symbol"?e:e+""}function Gh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class kr extends m.PureComponent{constructor(e){super(e),bn(this,"container",void 0),bn(this,"parent",void 0),bn(this,"popper",void 0),bn(this,"isOpen",void 0),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=k.createRef(),this.parent=null,this.popper=k.createRef(),this.isOpen=!1}componentDidMount(){var e=this.props.isShown;if(e===null){var t;(t=this.container.current)!==null&&t!==void 0&&t.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick))}else e&&this.openMenu()}componentDidUpdate(e){var t=this.props.isShown;e.isShown!==t&&(t!==null&&t?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}closeMenu(){var e;(e=this.popper.current)===null||e===void 0||e.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleClick(e){e.preventDefault(),e.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;var e=this.props.onMenuClosed;e()}render(){var e=this.props,t=e.actions,r=e.onMenuOpened,i=e.popperClassName,o=e["data-testid"],a=this.props.menuStyle,s=this.props,l=s.options,u=s.popperOptions;return u=No({placement:"bottom"},u),l=No({separateKeyboardMouse:!0},l),c.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":o,children:c.jsx(Ar,{ref:this.popper,options:u,className:U("menu-popper",i),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:c.jsx(pl,{actions:t,closeMenu:this.handleCloseMenu,onMenuOpened:r,options:l,menuStyle:a})})})}}bn(kr,"defaultProps",{isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0});function Lt(n,e,t){return(e=Xh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xh(n){var e=qh(n,"string");return typeof e=="symbol"?e:e+""}function qh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Lo=B.module("Shortcut"),P=function(n){return n.CTRL="MODIFIER_CTRL",n.CMD="MODIFIER_CMD",n.ALT="MODIFIER_ALT",n.OPTION="MODIFIER_OPTION",n.SHIFT="MODIFIER_SHIFT",n}({}),E=function(n){return n.A="A",n.B="B",n.C="C",n.D="D",n.E="E",n.F="F",n.G="G",n.H="H",n.I="I",n.J="J",n.K="K",n.L="L",n.M="M",n.N="N",n.O="O",n.P="P",n.Q="Q",n.R="R",n.S="S",n.T="T",n.U="U",n.V="V",n.W="W",n.X="X",n.Y="Y",n.Z="Z",n.ZERO="0",n.ONE="1",n.TWO="2",n.THREE="3",n.FOUR="4",n.FIVE="5",n.SIX="6",n.SEVEN="7",n.EIGHT="8",n.NINE="9",n.BACKSPACE="Backspace",n.ESCAPE="Escape",n.ENTER="Enter",n.DELETE="Delete",n.SLASH="/",n.QUESTION_MARK="?",n.BACKSLASH="\\",n.PIPE="|",n.MINUS="-",n.UNDERSCORE="_",n.EQUALS="=",n.PLUS="+",n.BACKTICK="`",n.TILDE="~",n.COMMA=",",n.LEFT_CHEVRON="<",n.PERIOD=".",n.RIGHT_CHEVRON=">",n.SEMICOLON=";",n.COLON=":",n.SINGLE_QUOTE="'",n.DOUBLE_QUOTE='"',n.LEFT_BRACKET="[",n.RIGHT_BRACKET="]",n.LEFT_CURLY="{",n.RIGHT_CURLY="}",n.F1="F1",n.F2="F2",n.F3="F3",n.F4="F4",n.F5="F5",n.F6="F6",n.F7="F7",n.F8="F8",n.F9="F9",n.F10="F10",n.F11="F11",n.F12="F12",n}({}),Zh=new Set([E.ENTER,E.DELETE,E.F1,E.F2,E.F3,E.F4,E.F5,E.F6,E.F7,E.F8,E.F9,E.F10,E.F11,E.F12]);class fe extends zs{static isAllowedKey(e){return Object.values(E).includes(e)}static isValidKeyState(e){var t=e.keyValue;if(t===null)return!0;if(!fe.isMacPlatform&&e.metaKey||!fe.isAllowedKey(t))return!1;var r=!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey;return!r||Zh.has(t)}static createKeyState(e){var t={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:e[e.length-1]};return e.forEach(r=>{switch(r){case P.CTRL:t.ctrlKey=!0;break;case P.ALT:case P.OPTION:t.altKey=!0;break;case P.CMD:t.metaKey=!0;break;case P.SHIFT:t.shiftKey=!0;break}}),t}static getKeyStateFromEvent(e){var t=e.key,r=e.keyCode,i="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?i="":!fe.isAllowedKey(t)&&fe.isAllowedKey(String.fromCharCode(r))?i=String.fromCharCode(r):i=t,{keyValue:i,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey}}static getWindowsDisplayText(e){var t="";return e.ctrlKey&&(t+="Ctrl+"),e.altKey&&(t+="Alt+"),e.shiftKey&&(t+="Shift+"),e.keyValue===E.ESCAPE?t+="Esc":e.keyValue!==null&&(t+=e.keyValue),t}static getMacDisplayText(e){var t="";switch(e.ctrlKey&&(t+="⌃"),e.altKey&&(t+="⌥"),e.shiftKey&&(t+="⇧"),e.metaKey&&(t+="⌘"),e.keyValue){case E.ENTER:t+="⏎";break;case E.ESCAPE:t+="⎋";break;case E.BACKSPACE:t+="⌫";break;case E.DELETE:t+="⌦";break;case null:break;default:t+=e.keyValue}return t}static doKeyStatesMatch(e,t){var r,i;return((r=e.keyValue)===null||r===void 0?void 0:r.toUpperCase())===((i=t.keyValue)===null||i===void 0?void 0:i.toUpperCase())&&e.altKey===t.altKey&&e.ctrlKey===t.ctrlKey&&e.metaKey===t.metaKey&&e.shiftKey===t.shiftKey}static getDisplayText(e){return e.keyValue===null?"":fe.isMacPlatform?fe.getMacDisplayText(e):fe.getWindowsDisplayText(e)}constructor(e){var t=e.id,r=e.shortcut,i=e.macShortcut,o=e.isEditable,a=o===void 0?!0:o,s=e.name,l=e.tooltip;super(),Lt(this,"id",void 0),Lt(this,"name",void 0),Lt(this,"tooltip",void 0),Lt(this,"isEditable",void 0),Lt(this,"defaultKeyState",void 0),Lt(this,"keyState",void 0),this.id=t,this.name=s,this.tooltip=l,this.isEditable=a;var u=fe.isMacPlatform,d=u?i:r;this.defaultKeyState=fe.createKeyState(d),this.keyState=this.defaultKeyState}getDisplayText(){return fe.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){fe.isValidKeyState(e)?(Lo.debug2("Shortcut ".concat(this.id," updated to ").concat(JSON.stringify(e))),this.keyState=e,this.dispatchEvent(new el("onUpdate",{detail:this}))):Lo.debug2("Shortcut ".concat(this.id," tried to update to invalid keyState ").concat(JSON.stringify(e)))}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return fe.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(fe.NULL_KEY_STATE)}isNull(){return fe.doKeyStatesMatch(this.keyState,fe.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return fe.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(fe.getKeyStateFromEvent(e))}}Lt(fe,"NULL_KEY_STATE",{metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null});Lt(fe,"isMacPlatform",ge.isMacPlatform());function Ro(n,e,t){return(e=Yh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yh(n){var e=Jh(n,"string");return typeof e=="symbol"?e:e+""}function Jh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var $o=B.module("ShortcutRegistry");class Qh extends zs{constructor(){super(...arguments),Ro(this,"shortcutMap",new Map),Ro(this,"shortcutsByCategory",new Map)}createAndAdd(e){var t=new fe(e);return this.add(t)}add(e){var t=this.shortcutMap.get(e.id);if(t)return $o.warn("Skipping attempt to add duplicate shortcut ID to registry: ".concat(e.id)),t;$o.debug2("Adding shortcut to registry: ".concat(e.id)),e.addEventListener("onUpdate",o=>{var a=o.detail;return this.dispatchEvent(new el("onUpdate",{detail:a}))});var r=e.id.split(".")[0];if(this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(r)){var i;(i=this.shortcutsByCategory.get(r))===null||i===void 0||i.push(e)}else this.shortcutsByCategory.set(r,[e]);return e}get(e){return this.shortcutMap.get(e)}getConflictingShortcuts(e){return Array.from(this.shortcutMap.values()).filter(t=>!t.isNull()&&t.matchesKeyState(e))}}var le=Object.freeze(new Qh),yn={COPY:le.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[P.CTRL,E.C],macShortcut:[P.CMD,E.C],isEditable:!1}),PASTE:le.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[P.CTRL,E.V],macShortcut:[P.CMD,E.V],isEditable:!1}),SAVE:le.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[P.CTRL,E.S],macShortcut:[P.CMD,E.S],isEditable:!1}),SELECT_ALL:le.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[P.CTRL,E.A],macShortcut:[P.CMD,E.A],isEditable:!1}),REOPEN_CLOSED_PANEL:le.createAndAdd({id:"GLOBAL.REOPEN_CLOSED_PANEL",name:"Re-open Closed Panel",shortcut:[P.ALT,P.SHIFT,E.T],macShortcut:[P.OPTION,P.SHIFT,E.T],isEditable:!0}),LINKER:le.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[P.CTRL,E.L],macShortcut:[P.CMD,E.L]}),LINKER_CLOSE:le.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[E.ESCAPE],macShortcut:[E.ESCAPE],isEditable:!1}),COPY_VERSION_INFO:le.createAndAdd({id:"GLOBAL.COPY_VERSION_INFO",name:"Copy Version Info",shortcut:[P.CTRL,P.ALT,E.I],macShortcut:[P.CMD,P.SHIFT,E.I],isEditable:!0}),EXPORT_LOGS:le.createAndAdd({id:"GLOBAL.EXPORT_LOGS",name:"Export Logs",shortcut:[P.CTRL,P.ALT,P.SHIFT,E.L],macShortcut:[P.CMD,P.OPTION,P.SHIFT,E.L],isEditable:!0}),OPEN_DASHBOARD_LIST:le.createAndAdd({id:"GLOBAL.OPEN_DASHBOARD_LIST",name:"Open Dashboard List",shortcut:[P.ALT,P.SHIFT,E.D],macShortcut:[P.OPTION,P.SHIFT,E.D],isEditable:!0}),NEXT:le.createAndAdd({id:"GLOBAL.NEXT",name:"Next",shortcut:[E.ENTER],macShortcut:[E.ENTER],isEditable:!1}),PREVIOUS:le.createAndAdd({id:"GLOBAL.PREVIOUS",name:"Previous",shortcut:[P.SHIFT,E.ENTER],macShortcut:[P.SHIFT,E.ENTER],isEditable:!1}),UNDO:le.createAndAdd({id:"GLOBAL.UNDO",name:"Undo",shortcut:[P.CTRL,E.Z],macShortcut:[P.CMD,E.Z],isEditable:!1}),REDO:le.createAndAdd({id:"GLOBAL.REDO",name:"Redo",shortcut:[P.CTRL,P.SHIFT,E.Z],macShortcut:[P.CMD,P.SHIFT,E.Z],isEditable:!1})};function pi(n,e,t){return(e=em(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function em(n){var e=tm(n,"string");return typeof e=="symbol"?e:e+""}function tm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Nr extends m.PureComponent{constructor(e){super(e),pi(this,"inputField",void 0),pi(this,"searchChangeSelection",void 0),this.inputField=k.createRef(),this.searchChangeSelection=k.createRef()}componentDidMount(){this.setInputPaddingRight()}componentDidUpdate(){this.setInputPaddingRight()}focus(){var e;(e=this.inputField.current)===null||e===void 0||e.focus()}select(){var e;(e=this.inputField.current)===null||e===void 0||e.select()}setInputPaddingRight(){var e=this.inputField.current,t=this.searchChangeSelection.current;if(e&&t){var r=t.getBoundingClientRect().width;e.style.paddingRight="".concat(r,"px")}}render(){var e=this.props,t=e.value,r=e.placeholder,i=e.endPlaceholder,o=e.onBlur,a=e.onChange,s=e.className,l=e.disabled,u=e.matchCount,d=e.id,h=e.onKeyDown,p=e["data-testid"],f=e.cursor,v,g=[{action:()=>f==null?void 0:f.next("forward"),shortcut:yn.NEXT},{action:()=>f==null?void 0:f.next("back"),shortcut:yn.PREVIOUS}];return f&&u>1?v=c.jsxs(c.Fragment,{children:[c.jsx(ne,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{f.next("back")},icon:Rs,tooltip:"Previous match (".concat(yn.PREVIOUS.getDisplayText(),")")}),c.jsxs("span",{className:"search-change-text",children:[f.index!==void 0&&"".concat(f.index+1," of "),u]}),c.jsx(ne,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{f.next("forward")},icon:Wu,tooltip:"Next match (".concat(yn.NEXT.getDisplayText(),")")})]}):v=u>0&&c.jsx("span",{className:"search-match",children:u}),c.jsxs("div",{className:U("search-group",s),children:[c.jsx("input",{type:"search",value:t,onBlur:o,onChange:a,onKeyDown:h,className:"form-control",disabled:l,placeholder:r,ref:this.inputField,id:d,"data-testid":p}),u!=null?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"search-change-selection",ref:this.searchChangeSelection,children:v}),c.jsx(de,{actions:g})]}):c.jsxs("span",{className:"search-end-content",children:[(i??"")!==""&&t===""&&c.jsx("span",{className:"search-end-placeholder",children:i}),c.jsx(me,{icon:Ku})]})]})}}pi(Nr,"defaultProps",{placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0,cursor:void 0});function fl(n,e,t){return(e=nm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function nm(n){var e=rm(n,"string");return typeof e=="symbol"?e:e+""}function rm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class vl extends m.PureComponent{constructor(e){super(e),fl(this,"searchInput",void 0),this.searchInput=k.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=zn(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){var t=this.props.value;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 e=this.props.onChange,t=this.state.value;e(t)}render(){var e=this.props,t=e.placeholder,r=e.className,i=e.matchCount,o=e.id,a=e["data-testid"],s=this.state.value;return c.jsx(Nr,{value:s,placeholder:t,onChange:this.handleChange,className:r,matchCount:i,ref:this.searchInput,id:o,"data-testid":a})}}fl(vl,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});function gl(n,e,t){return(e=im(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function im(n){var e=om(n,"string");return typeof e=="symbol"?e:e+""}function om(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var am=B.module("ItemListItem");class Lr extends m.Component{static handleKeyDown(){return am.log("ItemListItem.handleKeyDown false"),!1}constructor(e){super(e),gl(this,"itemRef",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDrag=this.handleDrag.bind(this),this.handleDragOver=this.handleDragOver.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.itemRef=k.createRef()}handleBlur(e){var t=this.props,r=t.itemIndex,i=t.onBlur;i(r,e)}handleFocus(e){var t=this.props,r=t.itemIndex,i=t.onFocus;i(r,e)}handleClick(e){var t=this.props,r=t.itemIndex,i=t.onClick;i(r,e)}handleContextMenu(e){var t=this.props,r=t.itemIndex,i=t.onContextMenu;i(r,e)}handleDragStart(e){var t=this.props,r=t.itemIndex,i=t.onDragStart;i(r,e)}handleDrag(e){var t=this.props,r=t.itemIndex,i=t.onDrag;i(r,e)}handleDragOver(e){e.preventDefault();var t=this.props,r=t.itemIndex,i=t.onDragOver;i(r,e)}handleDragEnd(e){var t=this.props,r=t.itemIndex,i=t.onDragEnd;i(r,e)}handleDrop(e){var t=this.props,r=t.itemIndex,i=t.onDrop;i(r,e)}handleDoubleClick(e){var t=this.props,r=t.itemIndex,i=t.onDoubleClick;i(r,e)}handleMouseMove(e){var t=this.props,r=t.itemIndex,i=t.onMouseMove;i(r,e)}handleMouseDown(e){var t=this.props,r=t.itemIndex,i=t.onMouseDown;i(r,e)}handleMouseUp(e){var t=this.props,r=t.itemIndex,i=t.onMouseUp;i(r,e)}render(){var e=this.props,t=e.isDraggable,r=e.isFocused,i=e.isSelected,o=e.style,a=e.children,s=e["data-testid"];return c.jsx("div",{className:U("item-list-item",{active:i},{"is-focused":r},{"is-draggable":t}),onKeyDown:Lr.handleKeyDown,onContextMenuCapture:this.handleContextMenu,onClick:this.handleClick,onDrag:this.handleDrag,onDragStart:this.handleDragStart,onDragOver:this.handleDragOver,onDragEnd:this.handleDragEnd,onDrop:this.handleDrop,onDoubleClick:this.handleDoubleClick,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,tabIndex:-1,ref:this.itemRef,role:"listitem",style:o,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:t,"data-testid":s,children:a})}}gl(Lr,"defaultProps",{children:null,isDraggable:!1,isFocused:!1,isSelected:!1,itemIndex:0,"data-testid":void 0,onBlur(){},onClick(){},onContextMenu(){},onDragStart(){},onDrag(){},onDragOver(){},onDragEnd(){},onDrop(){},onDoubleClick(){},onFocus(){},onMouseDown(){},onMouseMove(){},onMouseUp(){},style:{}});var Sr;function Fo(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 Ho(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fo(Object(t),!0).forEach(function(r){it(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Fo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function it(n,e,t){return(e=sm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sm(n){var e=lm(n,"string");return typeof e=="symbol"?e:e+""}function lm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Uo=B.module("ItemList"),Bo=5;class ct extends m.PureComponent{static renderItem(e){var t,r,i=e.item;return c.jsx("div",{className:"item-list-item-content",children:i!=null&&((t=(r=i.displayValue)!==null&&r!==void 0?r:i.value)!==null&&t!==void 0?t:"".concat(i))})}constructor(e){super(e),it(this,"list",void 0),it(this,"listContainer",void 0),it(this,"getItemSelected",vn((i,o)=>lt.isSelected(o,i),{max:ct.CACHE_SIZE})),it(this,"getCachedItem",vn((i,o,a,s,l,u,d,h)=>{var p=u({item:a,itemIndex:i,isFocused:s,isSelected:l,style:d});return c.jsx(Lr,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:h,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:s,isSelected:l,itemIndex:i,style:d,children:p},o)},{max:ct.CACHE_SIZE})),it(this,"getOuterElement",vn(i=>{var o=k.forwardRef((a,s)=>c.jsx("div",Ho({ref:s,tabIndex:-1,onKeyDown:i,role:"presentation"},a)));return o.displayName="ItemListOuterElement",o},{max:1e3})),it(this,"getInnerElement",vn(()=>{var i=k.forwardRef((o,a)=>c.jsx("div",Ho({className:"item-list-inner-element",ref:a},o)));return i.displayName="ItemListInnerElement",i},{max:1e3})),it(this,"getItemData",vn((i,o,a)=>({items:i,selectedRanges:o,renderItem:a}),{max:1e3})),this.handleItemBlur=this.handleItemBlur.bind(this),this.handleItemContextMenu=this.handleItemContextMenu.bind(this),this.handleItemFocus=this.handleItemFocus.bind(this),this.handleItemDoubleClick=this.handleItemDoubleClick.bind(this),this.handleItemMouseDown=this.handleItemMouseDown.bind(this),this.handleItemMouseMove=this.handleItemMouseMove.bind(this),this.handleItemMouseUp=this.handleItemMouseUp.bind(this),this.handleItemsRendered=this.handleItemsRendered.bind(this),this.handleWindowMouseUp=this.handleWindowMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleResize=this.handleResize.bind(this),this.renderInnerElement=this.renderInnerElement.bind(this),this.list=k.createRef(),this.listContainer=k.createRef();var t=e.isStickyBottom,r=e.selectedRanges;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:r,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null,mouseX:null,mouseY:null}}componentDidUpdate(e,t){var r=this.props,i=r.selectedRanges,o=r.itemCount,a=this.state,s=a.focusIndex,l=a.isStuckToBottom,u=a.scrollOffset,d=a.height,h=a.selectedRanges;if(l&&!this.isListAtBottom()&&o>0&&this.scrollToBottom(),(u!==t.scrollOffset||d!==t.height)&&this.sendViewportUpdate(),i!==e.selectedRanges&&i!==h)this.setSelectedRanges(i);else if(h!==t.selectedRanges){var p=this.props.onSelectionChange;p(h)}if(s!==t.focusIndex){var f=this.props.onFocusChange;f(s)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var e;(e=this.listContainer.current)===null||e===void 0||e.focus()}restoreScrollPosition(){var e=this.listContainer.current;if(e!=null){var t=this.state.scrollOffset;if(t!=null){var r=this.props,i=r.itemCount,o=r.rowHeight,a=this.state,s=a.height,l=a.isStuckToBottom,u=Math.max(0,i*o-(s??0)),d=l?u:Math.min(Math.max(t,0),u);e.scrollTo(0,d)}}}getElement(e){if(this.listContainer.current==null)return null;var t=this.props.focusSelector,r=this.state.overscanStartIndex,i=this.listContainer.current.querySelectorAll(t),o=e-r;return i[o]}focusItem(e){var t=this.props.disableSelect;if(!t){this.setState({focusIndex:e});var r=this.getElement(e);r instanceof HTMLElement&&r.focus()}}scrollToItem(e){var t=this.getElement(e);t!=null&&t.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){this.setState({focusIndex:e});var r=this.state.selectedRanges,i=lt.isSelected(r,e),o=i||ge.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,o,!1)}handleItemDoubleClick(e,t){var r=this.props,i=r.isDoubleClickSelect,o=r.onSelect;i&&this.setState(a=>{var s=a.selectedRanges;return{selectedRanges:lt.selectRange(s,[e,e])}},()=>{o(e,t)})}handleItemMouseDown(e,t){var r=this.state.selectedRanges;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&r.length===0){this.focusItem(e),this.selectItem(e);return}t.button!=null&&t.button!==0||(this.setState({mouseDownIndex:e,mouseX:t.clientX,mouseY:t.clientY}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(e,t){Uo.debug2("item blur",e,t.currentTarget,t.relatedTarget),(!t.relatedTarget||this.listContainer.current&&t.relatedTarget instanceof HTMLElement&&!this.listContainer.current.contains(t.relatedTarget))&&this.setState({focusIndex:null})}handleItemFocus(e,t){Uo.debug2("item focus",e,t.target),this.setState(r=>{var i=r.focusIndex;return i!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){var r=this.props,i=r.isDragSelect,o=r.isMultiSelect,a=r.disableSelect,s=this.state,l=s.mouseDownIndex,u=s.selectedRanges,d=s.mouseX,h=s.mouseY;if(!(l==null||a)){var p=Math.abs(t.clientX-(d??0)),f=Math.abs(t.clientY-(h??0));p>Bo&&f>Bo&&this.setState({isDragging:!0}),(i||l===e)&&(this.focusItem(e),o?(!i&&!this.getItemSelected(e,u)&&!ge.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(l,e),Math.max(l,e)])):this.toggleSelect(e,t.shiftKey,ge.isModifierKeyDown(t),!1))}}handleItemMouseUp(e,t){var r=this.props,i=r.isDeselectOnClick,o=r.isDoubleClickSelect,a=r.onSelect,s=this.state,l=s.mouseDownIndex,u=s.isDragging;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(l===e&&!u){var d=t.shiftKey,h=ge.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,d,h,i),!o&&!d&&!h&&a(e,t)}this.resetMouseState()}}handleItemsRendered(e){var t=e.overscanStartIndex;this.setState({overscanStartIndex:t})}handleResize(e){var t=e.height;this.setState({height:t},()=>{this.restoreScrollPosition()})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(e){var t=this.props,r=t.isMultiSelect,i=t.itemCount,o=t.onSelect,a=this.state.focusIndex,s=a;if(e.key==="Enter"||e.key===" "){!r&&s!=null&&this.setState({selectedRanges:[[s,s]]},()=>{s!=null&&o(s,e)});return}if(e.key==="ArrowUp")s!=null&&s>=0?s=Math.max(0,s-1):s=i-1;else if(e.key==="ArrowDown")s!=null&&s>=0?s=Math.min(s+1,i-1):s=0;else return;if(a!==s){e.stopPropagation(),e.preventDefault(),this.focusItem(s);var l=this.state.selectedRanges;if(e.shiftKey&&l.length>0){var u=l[l.length-1];this.selectRange([Math.min(s,u[0]),Math.max(s,u[1])])}else if(this.deselectAll(),s!==null)this.selectItem(s);else{var d;(d=this.listContainer.current)===null||d===void 0||d.focus()}this.scrollIntoView(s)}}handleScroll(e){var t=e.scrollUpdateWasRequested,r=e.scrollOffset;this.setState(i=>{if(t)return{scrollOffset:r};var o=this.props.isStickyBottom,a=i.height,s=o&&this.isListAtBottom({scrollOffset:r,height:a});return{isStuckToBottom:s,scrollOffset:r}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){var e=this.props.itemCount;this.list.current&&this.list.current.scrollToItem(e)}scrollIntoView(e){this.list.current&&this.list.current.scrollToItem(e)}toggleSelect(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=this.props.isMultiSelect,a=this.state.selectedRanges;if(o&&t&&a.length>0){var s=a[a.length-1];this.selectRange([Math.min(s[0],e),Math.max(e,s[1])])}else o&&a.length===1&&a[0][0]===e&&a[0][1]===e?i&&this.deselectItem(e):o&&r?this.getItemSelected(e,a)?i&&this.deselectItem(e):this.selectItem(e):(this.deselectAll(),this.selectItem(e))}deselectAll(){var e=this.props.itemCount;this.deselectRange([0,e])}deselectItem(e){this.deselectRange([e,e])}deselectRange(e){lt.validateRange(e),this.setState(t=>{var r=t.selectedRanges;return{selectedRanges:lt.deselectRange(r,e)}})}selectItem(e){var t=this.props.disableSelect;t||this.selectRange([e,e])}selectRange(e){lt.validateRange(e),this.setState(t=>{var r=t.selectedRanges;return{selectedRanges:lt.selectRange(r,e)}})}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){var e=this.state,t=e.scrollOffset,r=e.height;if(t!=null&&r!=null){var i=this.props,o=i.onViewportChange,a=i.rowHeight,s=Math.floor(t/a),l=s+Math.ceil(r/a);o(s,l)}}isListAtBottom(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.state,t=e.scrollOffset,r=e.height;if(r==null||t==null)return!1;var i=this.props,o=i.itemCount,a=i.rowHeight;return t+r>=o*a-1}renderInnerElement(e){var t=e.index,r=e.style,i=this.props,o=i.items,a=i.offset,s=i.renderItem,l=i.disableSelect,u=this.state,d=u.focusIndex,h=u.selectedRanges;if(t<a||t>=a+o.length)return null;var p=o[t-a];return this.getCachedItem(t,t,p,t===d&&!l,this.getItemSelected(t,h),s,r,l)}render(){var e=this.props,t=e.items,r=e.itemCount,i=e.overscanCount,o=e.renderItem,a=e.rowHeight,s=e["data-testid"],l=this.state,u=l.selectedRanges,d=l.isStuckToBottom;return c.jsx(Pd,{className:"item-list-auto-sizer",onResize:this.handleResize,children:h=>{var p=h.width,f=h.height;return c.jsx(Td,{className:"item-list-scroll-pane",height:f,width:p,initialScrollOffset:d?r*a:0,itemCount:r,itemSize:a,itemData:this.getItemData(t,u,o),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:i,"data-testid":s,children:this.renderInnerElement})}})}}Sr=ct;it(ct,"CACHE_SIZE",1e3);it(ct,"DEFAULT_ROW_HEIGHT",20);it(ct,"DEFAULT_OVERSCAN",10);it(ct,"defaultProps",{offset:0,items:[],rowHeight:Sr.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Sr.DEFAULT_OVERSCAN,renderItem:Sr.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0});var um=B.module("ErrorBoundary");class dm extends m.Component{static getDerivedStateFromError(e){return{error:e}}constructor(e){super(e),this.state={error:void 0}}componentDidCatch(e,t){var r=this.props.onError;um.error("Error caught by ErrorBoundary",e,t),r==null||r(e,t)}render(){var e=this.props,t=e.children,r=e.className,i=e.fallback,o=this.state.error;return o!=null?i??c.jsx("div",{className:r,children:c.jsx(Kn,{errorMessage:"".concat(o),isLoading:!1,isLoaded:!1,"data-testid":"error-boundary-loading"})}):t??null}}function cm(n){var e=n.on,t=n.id,r=n.className,i=n.isInvalid,o=n.disabled,a=o===void 0?!1:o,s=n.onClick,l=n["data-testid"];return c.jsx("button",{type:"button",className:U("btn","btn-switch",r,{active:e},{"is-invalid":i}),id:t,onClick:s,disabled:a,"data-testid":l,children:c.jsx("div",{className:"handle"})})}var hm=["children","className","isInvalid","onChange","data-testid"];function Wo(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 Ko(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Wo(Object(t),!0).forEach(function(r){mm(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Wo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function mm(n,e,t){return(e=pm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pm(n){var e=fm(n,"string");return typeof e=="symbol"?e:e+""}function fm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function vm(n,e){if(n==null)return{};var t,r,i=gm(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function gm(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}var bl=k.forwardRef((n,e)=>{var t=n.children,r=n.className,i=n.isInvalid,o=n.onChange,a=n["data-testid"],s=vm(n,hm),l=nl(e),u=m.useCallback(d=>{o(d.target.value)},[o]);return c.jsx("select",Ko(Ko({ref:l,className:U("custom-select",r,{"is-invalid":i}),onChange:u,"data-testid":a},s),{},{children:t}))});bl.displayName="Select";var Mi=k.createContext(new Map);Mi.displayName="XComponentMapContext";var jS=Mi.Provider;function bm(n){var e,t=m.useContext(Mi);return(e=t.get(n))!==null&&e!==void 0?e:n.Original}function zo(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 Zr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?zo(Object(t),!0).forEach(function(r){ym(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):zo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ym(n,e,t){return(e=Sm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sm(n){var e=Cm(n,"string");return typeof e=="symbol"?e:e+""}function Cm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function yl(n){var e,t;function r(i,o){var a=bm(t);return hl(n)?c.jsx(a,Zr(Zr({},i),{},{ref:o})):c.jsx(a,Zr({},i))}return r.displayName="XComponent(".concat((e=n.displayName)!==null&&e!==void 0?e:n.name,")"),t=m.forwardRef(r),t.Original=n,t.isXComponent=!0,t}function _m(){return Xn(zu,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function Sl(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.name!=null}function Cl(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.id!=null}function AS(n){return Sl(n)||Cl(n)}var _l=m.createContext(null);_l.displayName="ObjectFetcherContext";function kS(n){if(Cl(n))return{id:n.id,type:n.type};if(Sl(n)){var e;return{name:(e=n.name)!==null&&e!==void 0?e:"",type:n.type}}throw new Error("Invalid descriptor: ".concat(n))}function wm(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 NS(){return Xn(_l,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}function ji(n,e,t){return(e=Em(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Em(n){var e=Pm(n,"string");return typeof e=="symbol"?e:e+""}function Pm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ye{static isValid(e,t){return!0}static isSameFormat(e,t){throw new Error("isSameFormat not implemented")}static makeFormat(e,t,r){return{label:e,formatString:t,type:r}}format(e,t){return""}}ji(Ye,"TYPE_GLOBAL","type-global");ji(Ye,"TYPE_CONTEXT_PRESET","type-context-preset");ji(Ye,"TYPE_CONTEXT_CUSTOM","type-context-custom");function Rt(n,e,t){return(e=Tm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Tm(n){var e=Om(n,"string");return typeof e=="symbol"?e:e+""}function Om(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Vo=B.module("DateTimeColumnFormatter");class Et extends Ye{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.DateTimeFormat.format(t.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ye.TYPE_CONTEXT_PRESET;return{label:e,formatString:t,type:r}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static makeGlobalFormatStringMap(e,t){var r=t?"'T'":" ",i=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getGlobalFormats(e,t){var r=Et.makeGlobalFormatStringMap(e,t);return[...r.keys()]}static makeFormatStringMap(e,t){var r=t!==void 0&&t?"'T'":" ",i=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd","yyyy-MM-dd".concat(i)],["MM-dd-yyyy","MM-dd-yyyy".concat(i)],["HH:mm:ss","HH:mm:ss".concat(i)],["HH:mm:ss.SSS","HH:mm:ss.SSS".concat(i)],["HH:mm:ss.SSSSSSSSS","HH:mm:ss.SSSSSSSSS".concat(i)],["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getFormats(e,t){var r=Et.makeFormatStringMap(e,t);return[...r.keys()]}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.timeZone,i=r===void 0?"":r,o=t.showTimeZone,a=o===void 0?!0:o,s=t.showTSeparator,l=s===void 0?!1:s,u=t.defaultDateTimeFormatString,d=u===void 0?Et.DEFAULT_DATETIME_FORMAT_STRING:u;super(),Rt(this,"dh",void 0),Rt(this,"dhTimeZone",void 0),Rt(this,"defaultDateTimeFormatString",void 0),Rt(this,"showTimeZone",void 0),Rt(this,"showTSeparator",void 0),Rt(this,"formatStringMap",void 0);var h=i||Et.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(h)}catch{Vo.error("Unsupported time zone id",h),this.dhTimeZone=e.i18n.TimeZone.getTimeZone(Et.DEFAULT_TIME_ZONE_ID)}this.dh=e,this.defaultDateTimeFormatString=d,this.showTimeZone=a,this.showTSeparator=l,this.formatStringMap=Et.makeFormatStringMap(a,l)}getEffectiveFormatString(e){var t;return(t=this.formatStringMap.get(e))!==null&&t!==void 0?t:e}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,i=this.getEffectiveFormatString(r);try{return this.dh.i18n.DateTimeFormat.format(i,e,this.dhTimeZone)}catch{Vo.error("Invalid format arguments")}return""}}Rt(Et,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");Rt(Et,"DEFAULT_TIME_ZONE_ID","America/New_York");var xt;function ht(n,e,t){return(e=Im(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Im(n){var e=xm(n,"string");return typeof e=="symbol"?e:e+""}function xm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Dm=B.module("DecimalColumnFormatter");class Ve extends Ye{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ye.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return Ve.makeFormat(e,t,Ye.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return Ve.makeFormat("Custom Format",e,Ye.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.defaultFormatString,i=r===void 0?Ve.DEFAULT_FORMAT_STRING:r;super(),ht(this,"defaultFormatString",void 0),ht(this,"dh",void 0),this.dh=e,this.defaultFormatString=i}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,i)}catch{Dm.error("Invalid format arguments")}return""}}xt=Ve;ht(Ve,"DEFAULT_FORMAT_STRING","###,##0.0000");ht(Ve,"FORMAT_PERCENT",xt.makePresetFormat("Percent","##0.00%"));ht(Ve,"FORMAT_BASIS_POINTS",xt.makePresetFormat("Basis Points","###,##0 bp",1e4));ht(Ve,"FORMAT_THOUSANDS",xt.makePresetFormat("Thousands","##0.000 k",.001));ht(Ve,"FORMAT_MILLIONS",xt.makePresetFormat("Millions","###,##0.000 mm",1e-6));ht(Ve,"FORMAT_SCIENTIFIC_NOTATION",xt.makePresetFormat("Scientific Notation","0.0000E0"));ht(Ve,"FORMAT_ROUND",xt.makePresetFormat("Round","###,##0"));ht(Ve,"FORMAT_ROUND_TWO_DECIMALS",xt.makePresetFormat("0.00","###,##0.00"));ht(Ve,"FORMAT_ROUND_FOUR_DECIMALS",xt.makePresetFormat("0.0000","###,##0.0000"));var Rr;function Tn(n,e,t){return(e=Mm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mm(n){var e=jm(n,"string");return typeof e=="symbol"?e:e+""}function jm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Am=B.module("IntegerColumnFormatter");class Tt extends Ye{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ye.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return Tt.makeFormat(e,t,Ye.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return Tt.makeFormat("Custom Format",e,Ye.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.defaultFormatString,i=r===void 0?Tt.DEFAULT_FORMAT_STRING:r;super(),Tn(this,"dh",void 0),Tn(this,"defaultFormatString",void 0),this.dh=e,this.defaultFormatString=i}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,i)}catch{Am.error("Invalid format arguments")}return""}}Rr=Tt;Tn(Tt,"DEFAULT_FORMAT_STRING","###,##0");Tn(Tt,"FORMAT_THOUSANDS",Rr.makePresetFormat("Thousands","##0.000 k",.001));Tn(Tt,"FORMAT_MILLIONS",Rr.makePresetFormat("Millions","###,##0.000 mm",1e-6));Tn(Tt,"FORMAT_SCIENTIFIC_NOTATION",Rr.makePresetFormat("Scientific Notation","0.0000E0"));function an(n,e,t){return(e=km(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function km(n){var e=Nm(n,"string");return typeof e=="symbol"?e:e+""}function Nm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class K{}an(K,"INTEGER","int");an(K,"LONG","long");an(K,"DOUBLE","double");an(K,"BOOLEAN","bool");an(K,"STRING","string");an(K,"DATE_TIME","datetime");an(K,"LOCAL_TIME","localtime");var Lm=Object.freeze({}),Rm=new Map,LS=n=>n.api,RS=n=>n.user,wl=n=>n.storage,El=n=>wl(n).commandHistoryStorage,$m=n=>wl(n).fileStorage,Fm=n=>n.defaultWorkspaceSettings,Pl=n=>{var e=n.workspace;return e},Ai=Od(n=>{var e,t,r=(e=(t=Pl(n))===null||t===void 0?void 0:t.data.settings)!==null&&e!==void 0?e:{},i=Fm(n),o=Id({},i,r,(a,s)=>{if(Array.isArray(a)&&Array.isArray(s))return s});return o}),Hm=n=>Ai(n).timeZone,$S=n=>{var e;return(e=Ai(n).notebookSettings)!==null&&e!==void 0?e:Lm},FS=n=>n.activeTool,Um=n=>{var e;return(e=n.plugins)!==null&&e!==void 0?e:Rm},Bm="SET_ACTIVE_TOOL",Wm="SET_API",HS="SET_COMMAND_HISTORY_STORAGE",US="SET_FILE_STORAGE",BS="SET_PLUGINS",Km="SET_USER",zm="SET_WORKSPACE",Vm="SET_DEFAULT_WORKSPACE_SETTINGS",WS="SET_WORKSPACE_STORAGE",Gm="SET_SERVER_CONFIG_VALUES";function Go(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 _t(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Go(Object(t),!0).forEach(function(r){Xm(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Go(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Xm(n,e,t){return(e=qm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qm(n){var e=Zm(n,"string");return typeof e=="symbol"?e:e+""}function Zm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var KS=n=>({type:Km,payload:n}),zS=n=>({type:Wm,payload:n}),Tl=n=>({type:zm,payload:n}),VS=n=>({type:Vm,payload:n}),Ym=n=>(e,t)=>{e(Tl(n));var r=t(),i=r.storage,o=i.workspaceStorage;return o==null?void 0:o.save(n)},Jm=n=>(e,t)=>{var r=t(),i=r.workspace,o=i??{},a=o.data,s=_t(_t({},i),{},{data:_t(_t(_t({},a),n),{},{settings:_t(_t({},a==null?void 0:a.settings),n.settings)})});return e(Ym(s))},GS=n=>(e,t)=>{var r=Ai(t()),i=r.notebookSettings,o=_t(_t({},i),n);return e(Qm({notebookSettings:o}))},Qm=n=>e=>e(Jm({settings:n})),XS=n=>({type:Bm,payload:n}),qS=n=>({type:Gm,payload:n});function Xo(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 qo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Xo(Object(t),!0).forEach(function(r){ep(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Xo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ep(n,e,t){return(e=tp(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:e+""}function np(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function rp(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==null?void 0:i.type){case n:{var o=i.id,a=i.payload;return t&&li({payload:a},{payload:r[o]})?r:qo(qo({},r),{},{[o]:a})}default:return r}}}function Zo(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 Yo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Zo(Object(t),!0).forEach(function(r){fi(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Zo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function fi(n,e,t){return(e=ip(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ip(n){var e=op(n,"string");return typeof e=="symbol"?e:e+""}function op(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ap{constructor(){fi(this,"reducers",{}),fi(this,"listener",null)}register(e,t){var r;this.reducers=Yo(Yo({},this.reducers),{},{[e]:t}),(r=this.listener)===null||r===void 0||r.call(this,this.reducers)}setListener(e){this.listener=e}}var sp=new ap,Ol=m.createContext(null);Ol.displayName="PluginsContext";var Kt=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",ELEMENT_PLUGIN:"ElementPlugin",MIDDLEWARE_PLUGIN:"MiddlewarePlugin",MULTI_PLUGIN:"MultiPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin",WIDGET_PLUGIN:"WidgetPlugin"});function lp(n){return"DashboardPlugin"in n}function up(n){return"AuthPlugin"in n}function dp(n){return"TablePlugin"in n}function cp(n){return lp(n)||up(n)||dp(n)}function hp(n){return"type"in n&&n.type===Kt.DASHBOARD_PLUGIN}function vi(n){return"type"in n&&n.type===Kt.MIDDLEWARE_PLUGIN}function qn(n){return"type"in n&&n.type===Kt.WIDGET_PLUGIN}function Il(n){return qn(n)&&"dashboardTypes"in n&&n.dashboardTypes!=null}function mp(n){return"type"in n&&n.type===Kt.TABLE_PLUGIN}function pp(n){return"type"in n&&n.type===Kt.AUTH_PLUGIN}function xl(n){return"type"in n&&n.type===Kt.THEME_PLUGIN}function Dl(n){return"type"in n&&n.type===Kt.ELEMENT_PLUGIN}function Ml(n){return"type"in n&&n.type===Kt.MULTI_PLUGIN}function gi(n){return hp(n)||pp(n)||Dl(n)||Ml(n)||mp(n)||xl(n)||qn(n)||vi(n)}var fp=["metadata"],vp=["metadata"],gp=["Component"],bp=["Component"];function Jo(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 xe(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Jo(Object(t),!0).forEach(function(r){yp(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Jo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function yp(n,e,t){return(e=Sp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sp(n){var e=Cp(n,"string");return typeof e=="symbol"?e:e+""}function Cp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function $r(n,e){if(n==null)return{};var t,r,i=_p(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function _p(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}function jl(n,e){return Tp(n)||Pp(n,e)||Ep(n,e)||wp()}function wp(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
9
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ep(n,e){if(n){if(typeof n=="string")return Qo(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Qo(n,e):void 0}}function Qo(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function Pp(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function Tp(n){if(Array.isArray(n))return n}var ze=B.module("@deephaven/plugin.PluginUtils");function wn(n){var e,t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Component";return(e=(t=n.displayName)!==null&&t!==void 0?t:n.name)!==null&&e!==void 0?e:r}function ea(n,e){return n==null||!qn(n)?!1:[n.supportedTypes].flat().some(t=>t===e)}function ZS(n,e){return n==null||!Il(n)?!1:[n.dashboardTypes].flat().some(t=>t===e)}function Op(n){var e=c.jsx(me,{icon:$s});if(!qn(n))return e;var t=n.icon;return t==null?e:m.isValidElement(t)?t:c.jsx(me,{icon:t})}function YS(n){var e=[...n.entries()].filter(t=>xl(t[1]));return ze.debug("Getting theme data from plugins",e),e.map(t=>{var r=jl(t,2),i=r[0],o=r[1],a=Array.isArray(o.themes)?o.themes:[o.themes];return a.map(s=>{var l=s.name,u=s.baseTheme,d=s.styleContent;return{baseThemeKey:"default-".concat(u??"dark"),themeKey:Vu(i,l),name:l,styleContent:d}})}).flat()}function JS(n){var e=[...n.entries()].filter(t=>Dl(t[1])&&t[1].mapping!=null);return ze.debug("Getting element plugin mapping",e),new Map(e.flatMap(t=>{var r=jl(t,2),i=r[1];return Object.entries(i.mapping)}))}function Ip(n,e){return e.length===0?(ze.debug("No middleware to chain for component",wn(n)),n):(ze.debug("Chaining component middleware",wn(n),e.map(t=>t.name)),[...e].reverse().reduce((t,r)=>{var i=r.component,o=[r.supportedTypes].flat();function a(s){var l=s.metadata,u=$r(s,fp);return(l==null?void 0:l.type)!=null&&!o.includes(l.type)?c.jsx(t,xe(xe({},u),{},{metadata:l})):c.jsx(i,xe(xe({},u),{},{metadata:l,Component:t}))}return a.displayName="".concat(r.name,"(").concat(wn(t),")"),a},n))}function QS(n,e){var t=e.filter(r=>r.panelComponent!=null);return t.length===0?(ze.debug("No panel middleware to chain for panel component",wn(n)),n):(ze.debug("Chaining panel middleware",wn(n),t.map(r=>r.name)),[...t].reverse().reduce((r,i)=>{var o=i.panelComponent,a=[i.supportedTypes].flat(),s=k.forwardRef((l,u)=>{var d=l.metadata,h=$r(l,vp),p=u!=null?{ref:u}:{};return(d==null?void 0:d.type)!=null&&!a.includes(d.type)?c.jsx(r,xe(xe(xe({},p),h),{},{metadata:d})):c.jsx(o,xe(xe(xe({},p),h),{},{metadata:d,Component:r}))});return s.displayName="".concat(i.name,"Panel(").concat(wn(r,"Panel"),")"),s},n))}function eC(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"PanelMiddleware",t=k.forwardRef((r,i)=>{var o=r.Component,a=$r(r,gp),s=n(a),l=s.inject,u=s.wrap,d=o,h=c.jsx(d,xe(xe({ref:i},a),l));return u!=null?u(h):h});return t.displayName=e,t}function tC(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"WidgetMiddleware";function t(r){var i=r.Component,o=$r(r,bp),a=n(o),s=a.inject,l=a.wrap,u=i,d=c.jsx(u,xe(xe({},o),s));return l!=null?l(d):d}return t.displayName=e,t}function xp(n){return typeof n=="object"&&n!=null&&n.default!=null&&typeof n.default=="object"}function Dp(n){return gi(n)?n:xp(n)&&gi(n.default)?n.default:cp(n)?n:null}function ta(n,e,t,r){if(n.has(e)){ze.warn("Plugin '".concat(e,"' is already registered. Skipping duplicate."));return}n.set(e,xe(xe({},t),{},{version:r}))}function nC(n,e,t,r,i,o){i!=null&&(e[i]=t,ze.debug("Registered plugin '".concat(i,"' in module resolve map")));var a=Dp(t);if(a==null){ze.error("Plugin '".concat(r,"' is missing an exported value."));return}Ml(a)?(ze.debug("MultiPlugin '".concat(r,"' contains ").concat(a.plugins.length," plugins")),a.plugins.forEach(s=>{if(!gi(s)){ze.warn("Skipping invalid inner plugin from MultiPlugin '".concat(r,"'"),s);return}var l=typeof s.name=="string"?s.name.trim():"";if(l.length===0){ze.warn("Skipping unnamed inner plugin from MultiPlugin '".concat(r,"'"),s);return}ta(n,l,s,o)})):ta(n,r,a,o)}function rC(n){var e=new Map;n.forEach(s=>{var l;((l=s.loader)===null||l===void 0?void 0:l.package)!=null&&e.set(s.loader.package,s)});var t=new Map;n.forEach(s=>{var l,u=new Set;((l=s.loader)===null||l===void 0?void 0:l.dependencies)!=null&&s.loader.dependencies.forEach(d=>{var h=e.get(d);h!=null?u.add(h):ze.warn("Plugin '".concat(s.name,"' depends on '").concat(d,"' which is not in the manifest"))}),t.set(s,u)});for(var r=[],i=new Set(n),o=new Set,a=function(){var l=[];if(i.forEach(d=>{var h=t.get(d);if(h==null||h.size===0){l.push(d);return}var p=!0;h.forEach(f=>{o.has(f)||(p=!1)}),p&&l.push(d)}),l.length===0){var u=[...i].map(d=>d.name);return ze.error("Circular plugin dependency detected among: ".concat(u.join(", "),". Loading remaining plugins together.")),r.push([...i]),1}r.push(l),l.forEach(d=>{i.delete(d),o.add(d)})};i.size>0&&!a(););return r}function Mp(n,e){var t;return(t=[...n.values()].find(r=>Il(r)&&[r.dashboardTypes].flat().some(i=>i===e)))!==null&&t!==void 0?t:null}function jp(){return Xn(Ol,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}var na=B.module("@deephaven/plugin.WidgetView");function iC(n){var e=n.fetch,t=n.type,r=jp(),i=m.useMemo(()=>{var l,u=[];return r.forEach(d=>{if(!(!qn(d)&&!vi(d))){var h=[d.supportedTypes].flat().includes(t);h&&(vi(d)?u.push(d):(l!=null&&na.warn("Multiple base plugins for type ".concat(t,". Replacing ").concat(l.name," with ").concat(d.name)),l=d))}}),{basePlugin:l,middleware:u}},[r,t]),o=i.basePlugin,a=i.middleware,s=m.useMemo(()=>o==null?(na.debug("No base plugin found for widget type ".concat(t)),null):Ip(o.component,a),[o,a,t]);if(s!=null)return c.jsx(s,{fetch:e});throw new Error("Unknown widget type '".concat(t,"'"))}var Al=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 kl(n){return n.componentName!==void 0}function Ap(n){return n.component!==void 0}var Nl=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const kp=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:Al,isGLComponentConfig:kl,isReactComponentConfig:Ap,itemDefaultConfig:Nl},Symbol.toStringTag,{value:"Module"}));function Cr(n,e,t){return(e=Np(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Np(n){var e=Lp(n,"string");return typeof e=="symbol"?e:e+""}function Lp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ue{constructor(){Cr(this,"_mSubscriptions",void 0),Cr(this,"off",this.unbind),Cr(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[Ue.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),o=1;o<r;o++)i[o-1]=arguments[o];if(t)for(var a=0;a<t.length;a++){var s=t[a].ctx||{};try{t[a].fn.apply(s,i)}catch(h){console.error("Error while emitting event:",h)}}i.unshift(e);for(var l=this._mSubscriptions[Ue.ALL_EVENT],u=0;u<l.length;u++){var d=l[u].ctx||{};try{l[u].fn.apply(d,i)}catch(h){console.error("Error while emitting event to allEventSubs:",h)}}}unbind(e,t,r){if(!this._mSubscriptions[e])throw new Error("No subscriptions to unsubscribe for event "+e);for(var i=!1,o=0;o<this._mSubscriptions[e].length;o++)(!t||this._mSubscriptions[e][o].fn===t)&&(!r||r===this._mSubscriptions[e][o].ctx)&&(this._mSubscriptions[e].splice(o,1),i=!0);if(i===!1)throw new Error("Nothing to unbind for "+e)}}Cr(Ue,"ALL_EVENT","__all");function at(n,e,t){return(e=Rp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Rp(n){var e=$p(n,"string");return typeof e=="symbol"?e:e+""}function $p(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class bi extends Ue{constructor(e,t,r){super(),at(this,"width",void 0),at(this,"height",void 0),at(this,"title",void 0),at(this,"parent",void 0),at(this,"layoutManager",void 0),at(this,"tab",void 0),at(this,"_config",void 0),at(this,"isHidden",!1),at(this,"beforeCloseHandler",void 0),at(this,"_element",O(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),at(this,"_contentElement",void 0),this.title=kl(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,o,a=this.parent,s=null;a&&!a.isColumn&&!a.isRow;){var l;if(s=a,a=a.parent,(l=a)!==null&&l!==void 0&&l.isRoot)return!1}if(!a||!s)return!1;for(var u=a.isColumn?"height":"width",d=u==="height"?t:e,h=((r=this[u])!==null&&r!==void 0?r:0)*(1/(((i=s.config[u])!==null&&i!==void 0?i:0)/100)),p=d/h*100,f=(((o=s.config[u])!==null&&o!==void 0?o:0)-p)/(a.contentItems.length-1),v=0;v<a.contentItems.length;v++)if(a.contentItems[v]===s)a.contentItems[v].config[u]=p;else{var g;a.contentItems[v].config[u]=((g=a.contentItems[v].config[u])!==null&&g!==void 0?g:0)+f}return a.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}getConfig(){return this._config}setState(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")}setPersistedState(e){this._config.persistedState=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,o=r.offsetHeight-r.clientHeight;this._contentElement.width(this.width-i).height(this.height-o),this.emit("resize")}}}const Fp=Object.freeze(Object.defineProperty({__proto__:null,Container:bi,ItemContainer:bi},Symbol.toStringTag,{value:"Module"}));function Ll(n){var e=location.hash.match(new RegExp(n+"=([^&]*)"));return e?e[1]:null}function Rl(n){if(window.location.hash)return Ll(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 Sn(n){return window.requestAnimationFrame(n)}function Hp(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 Er(){return Pt()}function Up(n,e){var t=n.replace(/javascript/gi,"j&#97;vascript").replace(/expression/gi,"expr&#101;ssion").replace(/onload/gi,"onlo&#97;d").replace(/script/gi,"&#115;cript").replace(/onerror/gi,"on&#101;rror");return e===!0?t:t.replace(/>/g,"&gt;").replace(/</g,"&lt;")}function ki(n){return O.trim(n.replace(/(<([^>]+)>)/gi,""))}function Be(n,e,t){return(e=Bp(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:e+""}function Wp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class jn extends Ue{constructor(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;super(),Be(this,"_eElement",void 0),Be(this,"_oDocument",void 0),Be(this,"_eBody",void 0),Be(this,"_root",void 0),Be(this,"_destroyAfterMouseUp",void 0),Be(this,"_nDelay",400),Be(this,"_timeout",void 0),Be(this,"timeout",void 0),Be(this,"_nDistance",10),Be(this,"_nX",0),Be(this,"_nY",0),Be(this,"_nOriginalX",0),Be(this,"_nOriginalY",0),Be(this,"_bDragging",!1),this._eElement=e,this._oDocument=O(document),this._eBody=O(document.body),this._root=t,this._destroyAfterMouseUp=i,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this._startDrag=this._startDrag.bind(this),(r=this._eElement)===null||r===void 0||r.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,o,a=this._getCoordinates(e);this._nOriginalX=(t=a.x)!==null&&t!==void 0?t:0,this._nOriginalY=(r=a.y)!==null&&r!==void 0?r:0,(i=this._oDocument)===null||i===void 0||i.on("mousemove",this.onMouseMove),(o=this._oDocument)===null||o===void 0||o.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,o,a;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||(i=i.find("iframe"))===null||i===void 0||i.css("pointer-events",""),this._bDragging===!0&&(this._bDragging=!1,this.emit("dragStop",e,this._nOriginalX+this._nX)),(o=this._eBody)===null||o===void 0||o.removeClass("lm_dragging"),(a=this._root)===null||a===void 0||a.childElementContainer.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var s;(s=this._eElement)===null||s===void 0||s.removeClass("lm_dragging")}this._destroyAfterMouseUp&&this.destroy()}}_startDrag(){var e,t,r,i;window.clearTimeout(this._timeout),this._bDragging=!0,(e=this._eBody)===null||e===void 0||e.addClass("lm_dragging"),(t=this._eElement)===null||t===void 0||t.addClass("lm_dragging"),(r=this._root)===null||r===void 0||r.childElementContainer.addClass("lm_dragging"),(i=this._oDocument)===null||i===void 0||(i=i.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}}}function cn(n,e,t){return(e=Kp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kp(n){var e=zp(n,"string");return typeof e=="symbol"?e:e+""}function zp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class $l{constructor(e,t){cn(this,"_container",void 0),cn(this,"_reactComponent",null),cn(this,"_portalComponent",null),cn(this,"_originalComponentWillUpdate",void 0),cn(this,"_initialState",void 0),cn(this,"_reactClass",void 0),this._reactComponent=null,this._portalComponent=null,this._originalComponentWillUpdate=void 0,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=xi.createPortal(this._getReactComponent(),this._container.getElement()[0],e),this._container.layoutManager.addReactChild(e,this._portalComponent)}_gotReactComponent(e){if(e&&(this._reactComponent=e,this._reactComponent instanceof m.Component)){this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate,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,void 0)}_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=O.extend(e,this._container._config.props);return k.createElement(this._reactClass,t)}}var Pr=["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"],Vp=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function Ni(n){if(Pr.length>36)throw new Error("Too many keys in config minifier map");var e={};return Li(n,e,"_min"),e}function yi(n){if(Pr.length>36)throw new Error("Too many keys in config minifier map");var e={};return Li(n,e,"_max"),e}function Li(n,e,t){var r=t==="_min"?Gp:Xp;for(var i in n)if(n.hasOwnProperty(i)){var o=Array.isArray(n)?n[Number.parseInt(i,10)]:n[i];if(typeof o=="object"&&o!=null){var a=o instanceof Array?[]:{};if(Array.isArray(e))e[Number.parseInt(i,10)]=a;else{var s=r(i,Pr);e[s]=a}Li(o,a,t)}else{var l=r(o,Vp);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var u=r(i,Pr);e[u]=l}}}}function Gp(n,e){if(typeof n=="string"&&n.length===1)return"___"+n;var t=e.indexOf(n);return t===-1?n:t.toString(36)}function Xp(n,e){return typeof n=="string"&&n.length===1?e[parseInt(n,36)]:typeof n=="string"&&n.substr(0,3)==="___"?n[3]:n}function Yr(n,e,t){return(e=qp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qp(n){var e=Zp(n,"string");return typeof e=="symbol"?e:e+""}function Zp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Si{constructor(e,t){Yr(this,"name",void 0),Yr(this,"origin",void 0),Yr(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function ur(n,e,t){return(e=Yp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yp(n){var e=Jp(n,"string");return typeof e=="symbol"?e:e+""}function Jp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}let Fl=class extends Ue{constructor(e){super(),ur(this,"_layoutManager",void 0),ur(this,"_dontPropagateToParent",void 0),ur(this,"_childEventSource",void 0),ur(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Ue.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),O(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(){O(window).off("gl_child_event",this._boundOnEventFromChild)}};function Hl(n,e,t){return n.on(e,t),()=>{n.off(e,t)}}function Ul(n){return(e,t)=>Hl(e,n,t)}function Bl(n){return function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];e.emit(n,...r)}}function Wl(n){return(e,t)=>{var r=m.useRef(null),i=m.useRef(()=>!1);if(r.current!=e||i.current!=t){var o;(o=r.current)===null||o===void 0||o.off(n,i.current),e==null||e.on(n,t)}r.current=e,i.current=t,m.useEffect(()=>()=>{var a;return(a=r.current)===null||a===void 0?void 0:a.off(n,i.current)},[])}}function mt(n){return{listen:Ul(n),emit:Bl(n),useListener:Wl(n)}}const Qp=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:Si,DragListener:jn,EventEmitter:Ue,EventHub:Fl,ReactComponentHandler:$l,animFrame:Sn,filterXss:Up,getHashValue:Ll,getQueryStringParam:Rl,getUniqueId:Er,listenForEvent:Hl,makeEmitFunction:Bl,makeEventFunctions:mt,makeListenFunction:Ul,makeUseListenerFunction:Wl,minifyConfig:Ni,removeFromArray:Hp,stripTags:ki,unminifyConfig:yi},Symbol.toStringTag,{value:"Module"}));function At(n,e,t){return(e=ef(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ef(n){var e=tf(n,"string");return typeof e=="symbol"?e:e+""}function tf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Kl extends Ue{constructor(e,t,r,i,o){super(),At(this,"isInitialised",!1),At(this,"_config",void 0),At(this,"_dimensions",void 0),At(this,"_parentId",void 0),At(this,"_indexInParent",void 0),At(this,"_layoutManager",void 0),At(this,"_popoutWindow",null),At(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=r,this._indexInParent=i,this._layoutManager=o,this._createWindow()}toConfig(){var e,t,r,i,o,a,s,l,u,d,h;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=(o=this._popoutWindow)===null||o===void 0?void 0:o.screenX)!==null&&i!==void 0?i:(a=this._popoutWindow)===null||a===void 0?void 0:a.screenLeft)!==null&&r!==void 0?r:0,top:(s=(l=(u=this._popoutWindow)===null||u===void 0?void 0:u.screenY)!==null&&l!==void 0?l:(d=this._popoutWindow)===null||d===void 0?void 0:d.screenTop)!==null&&s!==void 0?s:0},content:(h=this.getGlInstance())===null||h===void 0?void 0:h.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=O.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 o;((o=this._layoutManager.root.contentItems.length)!==null&&o!==void 0?o: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;O(this._popoutWindow).on("load",this._positionWindow.bind(this)).on("unload beforeunload",this._onClose.bind(this));var o=window.setInterval(()=>{var a;(a=this._popoutWindow)!==null&&a!==void 0&&a.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),window.clearInterval(o))},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-"+Er();e=Ni(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 Ee(n,e,t){return(e=nf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function nf(n){var e=rf(n,"string");return typeof e=="symbol"?e:e+""}function rf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class sn extends Ue{constructor(e,t,r,i,o,a){var s,l,u,d,h,p,f,v;if(super(),Ee(this,"_dragListener",void 0),Ee(this,"_layoutManager",void 0),Ee(this,"_contentItem",void 0),Ee(this,"_originalParent",void 0),Ee(this,"_area",null),Ee(this,"_lastValidArea",null),Ee(this,"_minX",void 0),Ee(this,"_maxX",void 0),Ee(this,"_minY",void 0),Ee(this,"_maxY",void 0),Ee(this,"_width",void 0),Ee(this,"_height",void 0),Ee(this,"_sided",void 0),Ee(this,"element",void 0),Ee(this,"childElementContainer",void 0),Ee(this,"_proxyTab",void 0),this._dragListener=r,this._layoutManager=i,this._contentItem=o,this._originalParent=a,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var g,b;this._layoutManager.tabDropPlaceholder.width((g=this._contentItem.tab.element.outerWidth(!0))!==null&&g!==void 0?g:0),this._layoutManager.tabDropPlaceholder.height((b=this._contentItem.tab.element.outerHeight(!0))!==null&&b!==void 0?b:0)}if(this.element=O(sn._template),a&&a._side&&(this._sided=a._sided,this.element.addClass("lm_"+a._side),["right","bottom"].indexOf(a._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",ki((s=this._contentItem.config.title)!==null&&s!==void 0?s:"")),this.element.find(".lm_title").text((l=this._contentItem.config.title)!==null&&l!==void 0?l:""),this.childElementContainer=this.element.find(".lm_content"),this.childElementContainer.append(o.element),this._updateTree(),this._layoutManager._$calculateItemAreas(),O(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var y,S;this._layoutManager.tabDropPlaceholder.width((y=this._proxyTab.outerWidth(!0))!==null&&y!==void 0?y:0),this._layoutManager.tabDropPlaceholder.height((S=this._proxyTab.outerHeight(!0))!==null&&S!==void 0?S:0)}var C=this._layoutManager.container.offset();this._minX=(u=C==null?void 0:C.left)!==null&&u!==void 0?u:0,this._minY=(d=C==null?void 0:C.top)!==null&&d!==void 0?d:0,this._maxX=((h=this._layoutManager.container.width())!==null&&h!==void 0?h:0)+this._minX,this._maxY=((p=this._layoutManager.container.height())!==null&&p!==void 0?p:0)+this._minY,this._width=(f=this.element.width())!==null&&f!==void 0?f:0,this._height=(v=this.element.height())!==null&&v!==void 0?v:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,r){var i,o,a=(i=r.pageX)!==null&&i!==void 0?i:0,s=(o=r.pageY)!==null&&o!==void 0?o:0,l=a>this._minX&&a<this._maxX&&s>this._minY&&s<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(a,s)}_setDropPosition(e,t){this.element.css({left:e,top:t}),this._area=this._layoutManager._$getArea(e,t),this._area!==null&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(e,t,this._area))}_onDrop(){var e;(e=this._layoutManager.dropTargetIndicator)===null||e===void 0||e.hide(),this._area!==null?this._area.contentItem._$onDrop(this._contentItem,this._area):this._lastValidArea!==null?this._lastValidArea.contentItem._$onDrop(this._contentItem,this._lastValidArea):this._originalParent?this._originalParent.addChild(this._contentItem):this._contentItem._$destroy(),this._dragListener.off("drag",this._onDrag,this),this._dragListener.off("dragStop",this._onDrop,this),this.element.remove(),this._layoutManager.emit("itemDropped",this._contentItem)}_updateTree(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(null)}_setDimensions(){var e=this._layoutManager.config.dimensions,t=e.dragProxyWidth,r=e.dragProxyHeight;this.element.width(t),this.element.height(r),t-=this._sided?e.headerHeight:0,r-=this._sided?0:e.headerHeight,this.childElementContainer.width(t),this.childElementContainer.height(r),this._contentItem.element.width(t),this._contentItem.element.height(r),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}Ee(sn,"_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 dr(n,e,t){return(e=of(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function of(n){var e=af(n,"string");return typeof e=="symbol"?e:e+""}function af(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class zl{constructor(e,t,r){dr(this,"_element",void 0),dr(this,"_itemConfig",void 0),dr(this,"_layoutManager",void 0),dr(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=r,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new jn(this._element,this._layoutManager.root,!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(O.extend(!0,{},r));new sn(e,t,this._dragListener,this._layoutManager,i,null)}}function cr(n,e,t){return(e=sf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sf(n){var e=lf(n,"string");return typeof e=="symbol"?e:e+""}function lf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Vl{constructor(e,t,r){cr(this,"_element",O(window)),cr(this,"_itemConfig",void 0),cr(this,"_layoutManager",void 0),cr(this,"_dragListener",void 0),this._itemConfig=e,this._layoutManager=t,this._createDragListener(r)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&this._layoutManager&&(this._dragListener=new jn(this._element,this._layoutManager.root,!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(O.extend(!0,{},r));new sn(e,t,this._dragListener,this._layoutManager,i,null)}}}function Gl(n,e,t){return(e=uf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function uf(n){var e=df(n,"string");return typeof e=="symbol"?e:e+""}function df(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Zn{constructor(){Gl(this,"element",O(Zn._template)),O(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()}}Gl(Zn,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function Jr(n,e,t){return(e=cf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cf(n){var e=hf(n,"string");return typeof e=="symbol"?e:e+""}function hf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Rn{constructor(e,t,r,i){Jr(this,"element",void 0),Jr(this,"_header",void 0),Jr(this,"_action",void 0),this._header=e,this.element=O('<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 mf(n,e,t){return(e=pf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pf(n){var e=ff(n,"string");return typeof e=="symbol"?e:e+""}function ff(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class en extends Error{constructor(e,t){super(),mf(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const vf=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:en},Symbol.toStringTag,{value:"Module"}));function gf(n,e){return Cf(n)||Sf(n,e)||yf(n,e)||bf()}function bf(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
8
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $h(n,e){if(n){if(typeof n=="string")return Mo(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Mo(n,e):void 0}}function Mo(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function Fh(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function Hh(n){if(Array.isArray(n))return n}function Uh(n,e){if(n==null)return{};var t,r,i=Bh(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function Bh(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}var jo="Copy";function ml(n){var e=n.copy,t=n.tooltip,r=t===void 0?jo:t,i=n.children,o=Uh(n,jh),a=Lc(),s=Lh(a,2),l=s[0],u=s[1],d=l?"Copied":r;return c.jsxs(wd,Do(Do({},o),{},{"aria-label":d,onPress:()=>{u(typeof e=="function"?e():e)},children:[c.jsx(Ed,{UNSAFE_className:i==null?"action-button-icon-with-tooltip":void 0,children:c.jsx(me,{icon:l?Uu:Bu})}),i!=null&&c.jsx(il,{children:i}),(i==null||d!==jo)&&c.jsx(ue,{children:d})]}))}ml.displayName="CopyButton";function Ao(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 Wh(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ao(Object(t),!0).forEach(function(r){Un(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ao(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Un(n,e,t){return(e=Kh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kh(n){var e=zh(n,"string");return typeof e=="symbol"?e:e+""}function zh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class pl extends m.PureComponent{constructor(e){var t;super(e),Un(this,"container",void 0),Un(this,"oldFocus",void 0),Un(this,"rAF",void 0),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.container=k.createRef(),this.oldFocus=document.activeElement,this.rAF=0;var r=e.options,i=(t=r.initialKeyboardIndex)!==null&&t!==void 0?t:-1;this.state={menuItems:[],keyboardIndex:i,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)===null||e===void 0||e.focus();var t=this.props.onMenuOpened;t(this)})}componentDidUpdate(e){var t=this.props.actions;e.actions!==t&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}getKeyboardIndex(){var e=this.props.options;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){var t=this.state.keyboardIndex;return t}return this.getMouseIndex()}setKeyboardIndex(e){var t=this.props.options;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){var e=this.state.mouseIndex;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});var e=this.props.actions,t=ge.getMenuItems(e,!1);t.length>0&&this.setState(r=>({menuItems:ge.sortActions(r.menuItems.concat(t))}))}handleKeyDown(e){var t=this.state.menuItems,r=this.getKeyboardIndex(),i=r;if(e.key==="Enter"||e.key===" "){r!=null&&r>=0&&r<t.length&&this.handleMenuItemClick(t[r],e);return}e.key==="Escape"?i=null:e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0?i=ge.getNextMenuItem(i??0,-1,t):(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1)&&(i=ge.getNextMenuItem(i??0,1,t)),r!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.props,r=t.closeMenu,i=t.onMenuClosed;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{r(e),i(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation(),e!=null&&(e.disabled===void 0||!e.disabled)&&e.action!=null&&(e.action(t.nativeEvent),this.closeMenu(!0))}handleMenuItemMouseMove(e){var t=this.state.menuItems,r=t.indexOf(e);this.setMouseIndex(r)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],t=this.props["data-testid"],r=this.state,i=r.keyboardIndex,o=r.menuItems,a=r.mouseIndex,s=0;s<o.length;s+=1){var l=o[s];s>0&&l.group!==o[s-1].group&&e.push(c.jsx("hr",{},"".concat(s,".separator")));var u=c.jsx(ul,{isKeyboardSelected:i===s,isMouseSelected:a===s,menuItem:l,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},s);e.push(u)}var d=this.props.menuStyle;return c.jsx("div",{className:"context-menu-container",style:Wh({},d),ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}}Un(pl,"defaultProps",{closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});function ko(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 No(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ko(Object(t),!0).forEach(function(r){bn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ko(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function bn(n,e,t){return(e=Vh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Vh(n){var e=Gh(n,"string");return typeof e=="symbol"?e:e+""}function Gh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class kr extends m.PureComponent{constructor(e){super(e),bn(this,"container",void 0),bn(this,"parent",void 0),bn(this,"popper",void 0),bn(this,"isOpen",void 0),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=k.createRef(),this.parent=null,this.popper=k.createRef(),this.isOpen=!1}componentDidMount(){var e=this.props.isShown;if(e===null){var t;(t=this.container.current)!==null&&t!==void 0&&t.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick))}else e&&this.openMenu()}componentDidUpdate(e){var t=this.props.isShown;e.isShown!==t&&(t!==null&&t?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}closeMenu(){var e;(e=this.popper.current)===null||e===void 0||e.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleClick(e){e.preventDefault(),e.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;var e=this.props.onMenuClosed;e()}render(){var e=this.props,t=e.actions,r=e.onMenuOpened,i=e.popperClassName,o=e["data-testid"],a=this.props.menuStyle,s=this.props,l=s.options,u=s.popperOptions;return u=No({placement:"bottom"},u),l=No({separateKeyboardMouse:!0},l),c.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":o,children:c.jsx(Ar,{ref:this.popper,options:u,className:U("menu-popper",i),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:c.jsx(pl,{actions:t,closeMenu:this.handleCloseMenu,onMenuOpened:r,options:l,menuStyle:a})})})}}bn(kr,"defaultProps",{isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0});function Lt(n,e,t){return(e=Xh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xh(n){var e=qh(n,"string");return typeof e=="symbol"?e:e+""}function qh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Lo=B.module("Shortcut"),P=function(n){return n.CTRL="MODIFIER_CTRL",n.CMD="MODIFIER_CMD",n.ALT="MODIFIER_ALT",n.OPTION="MODIFIER_OPTION",n.SHIFT="MODIFIER_SHIFT",n}({}),E=function(n){return n.A="A",n.B="B",n.C="C",n.D="D",n.E="E",n.F="F",n.G="G",n.H="H",n.I="I",n.J="J",n.K="K",n.L="L",n.M="M",n.N="N",n.O="O",n.P="P",n.Q="Q",n.R="R",n.S="S",n.T="T",n.U="U",n.V="V",n.W="W",n.X="X",n.Y="Y",n.Z="Z",n.ZERO="0",n.ONE="1",n.TWO="2",n.THREE="3",n.FOUR="4",n.FIVE="5",n.SIX="6",n.SEVEN="7",n.EIGHT="8",n.NINE="9",n.BACKSPACE="Backspace",n.ESCAPE="Escape",n.ENTER="Enter",n.DELETE="Delete",n.SLASH="/",n.QUESTION_MARK="?",n.BACKSLASH="\\",n.PIPE="|",n.MINUS="-",n.UNDERSCORE="_",n.EQUALS="=",n.PLUS="+",n.BACKTICK="`",n.TILDE="~",n.COMMA=",",n.LEFT_CHEVRON="<",n.PERIOD=".",n.RIGHT_CHEVRON=">",n.SEMICOLON=";",n.COLON=":",n.SINGLE_QUOTE="'",n.DOUBLE_QUOTE='"',n.LEFT_BRACKET="[",n.RIGHT_BRACKET="]",n.LEFT_CURLY="{",n.RIGHT_CURLY="}",n.F1="F1",n.F2="F2",n.F3="F3",n.F4="F4",n.F5="F5",n.F6="F6",n.F7="F7",n.F8="F8",n.F9="F9",n.F10="F10",n.F11="F11",n.F12="F12",n}({}),Zh=new Set([E.ENTER,E.DELETE,E.F1,E.F2,E.F3,E.F4,E.F5,E.F6,E.F7,E.F8,E.F9,E.F10,E.F11,E.F12]);class fe extends zs{static isAllowedKey(e){return Object.values(E).includes(e)}static isValidKeyState(e){var t=e.keyValue;if(t===null)return!0;if(!fe.isMacPlatform&&e.metaKey||!fe.isAllowedKey(t))return!1;var r=!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey;return!r||Zh.has(t)}static createKeyState(e){var t={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:e[e.length-1]};return e.forEach(r=>{switch(r){case P.CTRL:t.ctrlKey=!0;break;case P.ALT:case P.OPTION:t.altKey=!0;break;case P.CMD:t.metaKey=!0;break;case P.SHIFT:t.shiftKey=!0;break}}),t}static getKeyStateFromEvent(e){var t=e.key,r=e.keyCode,i="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?i="":!fe.isAllowedKey(t)&&fe.isAllowedKey(String.fromCharCode(r))?i=String.fromCharCode(r):i=t,{keyValue:i,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey}}static getWindowsDisplayText(e){var t="";return e.ctrlKey&&(t+="Ctrl+"),e.altKey&&(t+="Alt+"),e.shiftKey&&(t+="Shift+"),e.keyValue===E.ESCAPE?t+="Esc":e.keyValue!==null&&(t+=e.keyValue),t}static getMacDisplayText(e){var t="";switch(e.ctrlKey&&(t+="⌃"),e.altKey&&(t+="⌥"),e.shiftKey&&(t+="⇧"),e.metaKey&&(t+="⌘"),e.keyValue){case E.ENTER:t+="⏎";break;case E.ESCAPE:t+="⎋";break;case E.BACKSPACE:t+="⌫";break;case E.DELETE:t+="⌦";break;case null:break;default:t+=e.keyValue}return t}static doKeyStatesMatch(e,t){var r,i;return((r=e.keyValue)===null||r===void 0?void 0:r.toUpperCase())===((i=t.keyValue)===null||i===void 0?void 0:i.toUpperCase())&&e.altKey===t.altKey&&e.ctrlKey===t.ctrlKey&&e.metaKey===t.metaKey&&e.shiftKey===t.shiftKey}static getDisplayText(e){return e.keyValue===null?"":fe.isMacPlatform?fe.getMacDisplayText(e):fe.getWindowsDisplayText(e)}constructor(e){var t=e.id,r=e.shortcut,i=e.macShortcut,o=e.isEditable,a=o===void 0?!0:o,s=e.name,l=e.tooltip;super(),Lt(this,"id",void 0),Lt(this,"name",void 0),Lt(this,"tooltip",void 0),Lt(this,"isEditable",void 0),Lt(this,"defaultKeyState",void 0),Lt(this,"keyState",void 0),this.id=t,this.name=s,this.tooltip=l,this.isEditable=a;var u=fe.isMacPlatform,d=u?i:r;this.defaultKeyState=fe.createKeyState(d),this.keyState=this.defaultKeyState}getDisplayText(){return fe.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){fe.isValidKeyState(e)?(Lo.debug2("Shortcut ".concat(this.id," updated to ").concat(JSON.stringify(e))),this.keyState=e,this.dispatchEvent(new el("onUpdate",{detail:this}))):Lo.debug2("Shortcut ".concat(this.id," tried to update to invalid keyState ").concat(JSON.stringify(e)))}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return fe.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(fe.NULL_KEY_STATE)}isNull(){return fe.doKeyStatesMatch(this.keyState,fe.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return fe.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(fe.getKeyStateFromEvent(e))}}Lt(fe,"NULL_KEY_STATE",{metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null});Lt(fe,"isMacPlatform",ge.isMacPlatform());function Ro(n,e,t){return(e=Yh(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yh(n){var e=Jh(n,"string");return typeof e=="symbol"?e:e+""}function Jh(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var $o=B.module("ShortcutRegistry");class Qh extends zs{constructor(){super(...arguments),Ro(this,"shortcutMap",new Map),Ro(this,"shortcutsByCategory",new Map)}createAndAdd(e){var t=new fe(e);return this.add(t)}add(e){var t=this.shortcutMap.get(e.id);if(t)return $o.warn("Skipping attempt to add duplicate shortcut ID to registry: ".concat(e.id)),t;$o.debug2("Adding shortcut to registry: ".concat(e.id)),e.addEventListener("onUpdate",o=>{var a=o.detail;return this.dispatchEvent(new el("onUpdate",{detail:a}))});var r=e.id.split(".")[0];if(this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(r)){var i;(i=this.shortcutsByCategory.get(r))===null||i===void 0||i.push(e)}else this.shortcutsByCategory.set(r,[e]);return e}get(e){return this.shortcutMap.get(e)}getConflictingShortcuts(e){return Array.from(this.shortcutMap.values()).filter(t=>!t.isNull()&&t.matchesKeyState(e))}}var le=Object.freeze(new Qh),yn={COPY:le.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[P.CTRL,E.C],macShortcut:[P.CMD,E.C],isEditable:!1}),PASTE:le.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[P.CTRL,E.V],macShortcut:[P.CMD,E.V],isEditable:!1}),SAVE:le.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[P.CTRL,E.S],macShortcut:[P.CMD,E.S],isEditable:!1}),SELECT_ALL:le.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[P.CTRL,E.A],macShortcut:[P.CMD,E.A],isEditable:!1}),REOPEN_CLOSED_PANEL:le.createAndAdd({id:"GLOBAL.REOPEN_CLOSED_PANEL",name:"Re-open Closed Panel",shortcut:[P.ALT,P.SHIFT,E.T],macShortcut:[P.OPTION,P.SHIFT,E.T],isEditable:!0}),LINKER:le.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[P.CTRL,E.L],macShortcut:[P.CMD,E.L]}),LINKER_CLOSE:le.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[E.ESCAPE],macShortcut:[E.ESCAPE],isEditable:!1}),COPY_VERSION_INFO:le.createAndAdd({id:"GLOBAL.COPY_VERSION_INFO",name:"Copy Version Info",shortcut:[P.CTRL,P.ALT,E.I],macShortcut:[P.CMD,P.SHIFT,E.I],isEditable:!0}),EXPORT_LOGS:le.createAndAdd({id:"GLOBAL.EXPORT_LOGS",name:"Export Logs",shortcut:[P.CTRL,P.ALT,P.SHIFT,E.L],macShortcut:[P.CMD,P.OPTION,P.SHIFT,E.L],isEditable:!0}),OPEN_DASHBOARD_LIST:le.createAndAdd({id:"GLOBAL.OPEN_DASHBOARD_LIST",name:"Open Dashboard List",shortcut:[P.ALT,P.SHIFT,E.D],macShortcut:[P.OPTION,P.SHIFT,E.D],isEditable:!0}),NEXT:le.createAndAdd({id:"GLOBAL.NEXT",name:"Next",shortcut:[E.ENTER],macShortcut:[E.ENTER],isEditable:!1}),PREVIOUS:le.createAndAdd({id:"GLOBAL.PREVIOUS",name:"Previous",shortcut:[P.SHIFT,E.ENTER],macShortcut:[P.SHIFT,E.ENTER],isEditable:!1}),UNDO:le.createAndAdd({id:"GLOBAL.UNDO",name:"Undo",shortcut:[P.CTRL,E.Z],macShortcut:[P.CMD,E.Z],isEditable:!1}),REDO:le.createAndAdd({id:"GLOBAL.REDO",name:"Redo",shortcut:[P.CTRL,P.SHIFT,E.Z],macShortcut:[P.CMD,P.SHIFT,E.Z],isEditable:!1})};function pi(n,e,t){return(e=em(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function em(n){var e=tm(n,"string");return typeof e=="symbol"?e:e+""}function tm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Nr extends m.PureComponent{constructor(e){super(e),pi(this,"inputField",void 0),pi(this,"searchChangeSelection",void 0),this.inputField=k.createRef(),this.searchChangeSelection=k.createRef()}componentDidMount(){this.setInputPaddingRight()}componentDidUpdate(){this.setInputPaddingRight()}focus(){var e;(e=this.inputField.current)===null||e===void 0||e.focus()}select(){var e;(e=this.inputField.current)===null||e===void 0||e.select()}setInputPaddingRight(){var e=this.inputField.current,t=this.searchChangeSelection.current;if(e&&t){var r=t.getBoundingClientRect().width;e.style.paddingRight="".concat(r,"px")}}render(){var e=this.props,t=e.value,r=e.placeholder,i=e.endPlaceholder,o=e.onBlur,a=e.onChange,s=e.className,l=e.disabled,u=e.matchCount,d=e.id,h=e.onKeyDown,p=e["data-testid"],f=e.cursor,v,g=[{action:()=>f==null?void 0:f.next("forward"),shortcut:yn.NEXT},{action:()=>f==null?void 0:f.next("back"),shortcut:yn.PREVIOUS}];return f&&u>1?v=c.jsxs(c.Fragment,{children:[c.jsx(ne,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{f.next("back")},icon:Rs,tooltip:"Previous match (".concat(yn.PREVIOUS.getDisplayText(),")")}),c.jsxs("span",{className:"search-change-text",children:[f.index!==void 0&&"".concat(f.index+1," of "),u]}),c.jsx(ne,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{f.next("forward")},icon:Wu,tooltip:"Next match (".concat(yn.NEXT.getDisplayText(),")")})]}):v=u>0&&c.jsx("span",{className:"search-match",children:u}),c.jsxs("div",{className:U("search-group",s),children:[c.jsx("input",{type:"search",value:t,onBlur:o,onChange:a,onKeyDown:h,className:"form-control",disabled:l,placeholder:r,ref:this.inputField,id:d,"data-testid":p}),u!=null?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"search-change-selection",ref:this.searchChangeSelection,children:v}),c.jsx(de,{actions:g})]}):c.jsxs("span",{className:"search-end-content",children:[(i??"")!==""&&t===""&&c.jsx("span",{className:"search-end-placeholder",children:i}),c.jsx(me,{icon:Ku})]})]})}}pi(Nr,"defaultProps",{placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0,cursor:void 0});function fl(n,e,t){return(e=nm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function nm(n){var e=rm(n,"string");return typeof e=="symbol"?e:e+""}function rm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class vl extends m.PureComponent{constructor(e){super(e),fl(this,"searchInput",void 0),this.searchInput=k.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=zn(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){var t=this.props.value;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 e=this.props.onChange,t=this.state.value;e(t)}render(){var e=this.props,t=e.placeholder,r=e.className,i=e.matchCount,o=e.id,a=e["data-testid"],s=this.state.value;return c.jsx(Nr,{value:s,placeholder:t,onChange:this.handleChange,className:r,matchCount:i,ref:this.searchInput,id:o,"data-testid":a})}}fl(vl,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});function gl(n,e,t){return(e=im(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function im(n){var e=om(n,"string");return typeof e=="symbol"?e:e+""}function om(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var am=B.module("ItemListItem");class Lr extends m.Component{static handleKeyDown(){return am.log("ItemListItem.handleKeyDown false"),!1}constructor(e){super(e),gl(this,"itemRef",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDrag=this.handleDrag.bind(this),this.handleDragOver=this.handleDragOver.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.itemRef=k.createRef()}handleBlur(e){var t=this.props,r=t.itemIndex,i=t.onBlur;i(r,e)}handleFocus(e){var t=this.props,r=t.itemIndex,i=t.onFocus;i(r,e)}handleClick(e){var t=this.props,r=t.itemIndex,i=t.onClick;i(r,e)}handleContextMenu(e){var t=this.props,r=t.itemIndex,i=t.onContextMenu;i(r,e)}handleDragStart(e){var t=this.props,r=t.itemIndex,i=t.onDragStart;i(r,e)}handleDrag(e){var t=this.props,r=t.itemIndex,i=t.onDrag;i(r,e)}handleDragOver(e){e.preventDefault();var t=this.props,r=t.itemIndex,i=t.onDragOver;i(r,e)}handleDragEnd(e){var t=this.props,r=t.itemIndex,i=t.onDragEnd;i(r,e)}handleDrop(e){var t=this.props,r=t.itemIndex,i=t.onDrop;i(r,e)}handleDoubleClick(e){var t=this.props,r=t.itemIndex,i=t.onDoubleClick;i(r,e)}handleMouseMove(e){var t=this.props,r=t.itemIndex,i=t.onMouseMove;i(r,e)}handleMouseDown(e){var t=this.props,r=t.itemIndex,i=t.onMouseDown;i(r,e)}handleMouseUp(e){var t=this.props,r=t.itemIndex,i=t.onMouseUp;i(r,e)}render(){var e=this.props,t=e.isDraggable,r=e.isFocused,i=e.isSelected,o=e.style,a=e.children,s=e["data-testid"];return c.jsx("div",{className:U("item-list-item",{active:i},{"is-focused":r},{"is-draggable":t}),onKeyDown:Lr.handleKeyDown,onContextMenuCapture:this.handleContextMenu,onClick:this.handleClick,onDrag:this.handleDrag,onDragStart:this.handleDragStart,onDragOver:this.handleDragOver,onDragEnd:this.handleDragEnd,onDrop:this.handleDrop,onDoubleClick:this.handleDoubleClick,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,tabIndex:-1,ref:this.itemRef,role:"listitem",style:o,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:t,"data-testid":s,children:a})}}gl(Lr,"defaultProps",{children:null,isDraggable:!1,isFocused:!1,isSelected:!1,itemIndex:0,"data-testid":void 0,onBlur(){},onClick(){},onContextMenu(){},onDragStart(){},onDrag(){},onDragOver(){},onDragEnd(){},onDrop(){},onDoubleClick(){},onFocus(){},onMouseDown(){},onMouseMove(){},onMouseUp(){},style:{}});var Sr;function Fo(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 Ho(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fo(Object(t),!0).forEach(function(r){it(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Fo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function it(n,e,t){return(e=sm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sm(n){var e=lm(n,"string");return typeof e=="symbol"?e:e+""}function lm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Uo=B.module("ItemList"),Bo=5;class ct extends m.PureComponent{static renderItem(e){var t,r,i=e.item;return c.jsx("div",{className:"item-list-item-content",children:i!=null&&((t=(r=i.displayValue)!==null&&r!==void 0?r:i.value)!==null&&t!==void 0?t:"".concat(i))})}constructor(e){super(e),it(this,"list",void 0),it(this,"listContainer",void 0),it(this,"getItemSelected",vn((i,o)=>lt.isSelected(o,i),{max:ct.CACHE_SIZE})),it(this,"getCachedItem",vn((i,o,a,s,l,u,d,h)=>{var p=u({item:a,itemIndex:i,isFocused:s,isSelected:l,style:d});return c.jsx(Lr,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:h,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:s,isSelected:l,itemIndex:i,style:d,children:p},o)},{max:ct.CACHE_SIZE})),it(this,"getOuterElement",vn(i=>{var o=k.forwardRef((a,s)=>c.jsx("div",Ho({ref:s,tabIndex:-1,onKeyDown:i,role:"presentation"},a)));return o.displayName="ItemListOuterElement",o},{max:1e3})),it(this,"getInnerElement",vn(()=>{var i=k.forwardRef((o,a)=>c.jsx("div",Ho({className:"item-list-inner-element",ref:a},o)));return i.displayName="ItemListInnerElement",i},{max:1e3})),it(this,"getItemData",vn((i,o,a)=>({items:i,selectedRanges:o,renderItem:a}),{max:1e3})),this.handleItemBlur=this.handleItemBlur.bind(this),this.handleItemContextMenu=this.handleItemContextMenu.bind(this),this.handleItemFocus=this.handleItemFocus.bind(this),this.handleItemDoubleClick=this.handleItemDoubleClick.bind(this),this.handleItemMouseDown=this.handleItemMouseDown.bind(this),this.handleItemMouseMove=this.handleItemMouseMove.bind(this),this.handleItemMouseUp=this.handleItemMouseUp.bind(this),this.handleItemsRendered=this.handleItemsRendered.bind(this),this.handleWindowMouseUp=this.handleWindowMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleResize=this.handleResize.bind(this),this.renderInnerElement=this.renderInnerElement.bind(this),this.list=k.createRef(),this.listContainer=k.createRef();var t=e.isStickyBottom,r=e.selectedRanges;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:r,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null,mouseX:null,mouseY:null}}componentDidUpdate(e,t){var r=this.props,i=r.selectedRanges,o=r.itemCount,a=this.state,s=a.focusIndex,l=a.isStuckToBottom,u=a.scrollOffset,d=a.height,h=a.selectedRanges;if(l&&!this.isListAtBottom()&&o>0&&this.scrollToBottom(),(u!==t.scrollOffset||d!==t.height)&&this.sendViewportUpdate(),i!==e.selectedRanges&&i!==h)this.setSelectedRanges(i);else if(h!==t.selectedRanges){var p=this.props.onSelectionChange;p(h)}if(s!==t.focusIndex){var f=this.props.onFocusChange;f(s)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var e;(e=this.listContainer.current)===null||e===void 0||e.focus()}restoreScrollPosition(){var e=this.listContainer.current;if(e!=null){var t=this.state.scrollOffset;if(t!=null){var r=this.props,i=r.itemCount,o=r.rowHeight,a=this.state,s=a.height,l=a.isStuckToBottom,u=Math.max(0,i*o-(s??0)),d=l?u:Math.min(Math.max(t,0),u);e.scrollTo(0,d)}}}getElement(e){if(this.listContainer.current==null)return null;var t=this.props.focusSelector,r=this.state.overscanStartIndex,i=this.listContainer.current.querySelectorAll(t),o=e-r;return i[o]}focusItem(e){var t=this.props.disableSelect;if(!t){this.setState({focusIndex:e});var r=this.getElement(e);r instanceof HTMLElement&&r.focus()}}scrollToItem(e){var t=this.getElement(e);t!=null&&t.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){this.setState({focusIndex:e});var r=this.state.selectedRanges,i=lt.isSelected(r,e),o=i||ge.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,o,!1)}handleItemDoubleClick(e,t){var r=this.props,i=r.isDoubleClickSelect,o=r.onSelect;i&&this.setState(a=>{var s=a.selectedRanges;return{selectedRanges:lt.selectRange(s,[e,e])}},()=>{o(e,t)})}handleItemMouseDown(e,t){var r=this.state.selectedRanges;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&r.length===0){this.focusItem(e),this.selectItem(e);return}t.button!=null&&t.button!==0||(this.setState({mouseDownIndex:e,mouseX:t.clientX,mouseY:t.clientY}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(e,t){Uo.debug2("item blur",e,t.currentTarget,t.relatedTarget),(!t.relatedTarget||this.listContainer.current&&t.relatedTarget instanceof HTMLElement&&!this.listContainer.current.contains(t.relatedTarget))&&this.setState({focusIndex:null})}handleItemFocus(e,t){Uo.debug2("item focus",e,t.target),this.setState(r=>{var i=r.focusIndex;return i!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){var r=this.props,i=r.isDragSelect,o=r.isMultiSelect,a=r.disableSelect,s=this.state,l=s.mouseDownIndex,u=s.selectedRanges,d=s.mouseX,h=s.mouseY;if(!(l==null||a)){var p=Math.abs(t.clientX-(d??0)),f=Math.abs(t.clientY-(h??0));p>Bo&&f>Bo&&this.setState({isDragging:!0}),(i||l===e)&&(this.focusItem(e),o?(!i&&!this.getItemSelected(e,u)&&!ge.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(l,e),Math.max(l,e)])):this.toggleSelect(e,t.shiftKey,ge.isModifierKeyDown(t),!1))}}handleItemMouseUp(e,t){var r=this.props,i=r.isDeselectOnClick,o=r.isDoubleClickSelect,a=r.onSelect,s=this.state,l=s.mouseDownIndex,u=s.isDragging;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(l===e&&!u){var d=t.shiftKey,h=ge.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,d,h,i),!o&&!d&&!h&&a(e,t)}this.resetMouseState()}}handleItemsRendered(e){var t=e.overscanStartIndex;this.setState({overscanStartIndex:t})}handleResize(e){var t=e.height;this.setState({height:t},()=>{this.restoreScrollPosition()})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(e){var t=this.props,r=t.isMultiSelect,i=t.itemCount,o=t.onSelect,a=this.state.focusIndex,s=a;if(e.key==="Enter"||e.key===" "){!r&&s!=null&&this.setState({selectedRanges:[[s,s]]},()=>{s!=null&&o(s,e)});return}if(e.key==="ArrowUp")s!=null&&s>=0?s=Math.max(0,s-1):s=i-1;else if(e.key==="ArrowDown")s!=null&&s>=0?s=Math.min(s+1,i-1):s=0;else return;if(a!==s){e.stopPropagation(),e.preventDefault(),this.focusItem(s);var l=this.state.selectedRanges;if(e.shiftKey&&l.length>0){var u=l[l.length-1];this.selectRange([Math.min(s,u[0]),Math.max(s,u[1])])}else if(this.deselectAll(),s!==null)this.selectItem(s);else{var d;(d=this.listContainer.current)===null||d===void 0||d.focus()}this.scrollIntoView(s)}}handleScroll(e){var t=e.scrollUpdateWasRequested,r=e.scrollOffset;this.setState(i=>{if(t)return{scrollOffset:r};var o=this.props.isStickyBottom,a=i.height,s=o&&this.isListAtBottom({scrollOffset:r,height:a});return{isStuckToBottom:s,scrollOffset:r}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){var e=this.props.itemCount;this.list.current&&this.list.current.scrollToItem(e)}scrollIntoView(e){this.list.current&&this.list.current.scrollToItem(e)}toggleSelect(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=this.props.isMultiSelect,a=this.state.selectedRanges;if(o&&t&&a.length>0){var s=a[a.length-1];this.selectRange([Math.min(s[0],e),Math.max(e,s[1])])}else o&&a.length===1&&a[0][0]===e&&a[0][1]===e?i&&this.deselectItem(e):o&&r?this.getItemSelected(e,a)?i&&this.deselectItem(e):this.selectItem(e):(this.deselectAll(),this.selectItem(e))}deselectAll(){var e=this.props.itemCount;this.deselectRange([0,e])}deselectItem(e){this.deselectRange([e,e])}deselectRange(e){lt.validateRange(e),this.setState(t=>{var r=t.selectedRanges;return{selectedRanges:lt.deselectRange(r,e)}})}selectItem(e){var t=this.props.disableSelect;t||this.selectRange([e,e])}selectRange(e){lt.validateRange(e),this.setState(t=>{var r=t.selectedRanges;return{selectedRanges:lt.selectRange(r,e)}})}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){var e=this.state,t=e.scrollOffset,r=e.height;if(t!=null&&r!=null){var i=this.props,o=i.onViewportChange,a=i.rowHeight,s=Math.floor(t/a),l=s+Math.ceil(r/a);o(s,l)}}isListAtBottom(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.state,t=e.scrollOffset,r=e.height;if(r==null||t==null)return!1;var i=this.props,o=i.itemCount,a=i.rowHeight;return t+r>=o*a-1}renderInnerElement(e){var t=e.index,r=e.style,i=this.props,o=i.items,a=i.offset,s=i.renderItem,l=i.disableSelect,u=this.state,d=u.focusIndex,h=u.selectedRanges;if(t<a||t>=a+o.length)return null;var p=o[t-a];return this.getCachedItem(t,t,p,t===d&&!l,this.getItemSelected(t,h),s,r,l)}render(){var e=this.props,t=e.items,r=e.itemCount,i=e.overscanCount,o=e.renderItem,a=e.rowHeight,s=e["data-testid"],l=this.state,u=l.selectedRanges,d=l.isStuckToBottom;return c.jsx(Pd,{className:"item-list-auto-sizer",onResize:this.handleResize,children:h=>{var p=h.width,f=h.height;return c.jsx(Td,{className:"item-list-scroll-pane",height:f,width:p,initialScrollOffset:d?r*a:0,itemCount:r,itemSize:a,itemData:this.getItemData(t,u,o),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:i,"data-testid":s,children:this.renderInnerElement})}})}}Sr=ct;it(ct,"CACHE_SIZE",1e3);it(ct,"DEFAULT_ROW_HEIGHT",20);it(ct,"DEFAULT_OVERSCAN",10);it(ct,"defaultProps",{offset:0,items:[],rowHeight:Sr.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Sr.DEFAULT_OVERSCAN,renderItem:Sr.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0});var um=B.module("ErrorBoundary");class dm extends m.Component{static getDerivedStateFromError(e){return{error:e}}constructor(e){super(e),this.state={error:void 0}}componentDidCatch(e,t){var r=this.props.onError;um.error("Error caught by ErrorBoundary",e,t),r==null||r(e,t)}render(){var e=this.props,t=e.children,r=e.className,i=e.fallback,o=this.state.error;return o!=null?i??c.jsx("div",{className:r,children:c.jsx(Kn,{errorMessage:"".concat(o),isLoading:!1,isLoaded:!1,"data-testid":"error-boundary-loading"})}):t??null}}function cm(n){var e=n.on,t=n.id,r=n.className,i=n.isInvalid,o=n.disabled,a=o===void 0?!1:o,s=n.onClick,l=n["data-testid"];return c.jsx("button",{type:"button",className:U("btn","btn-switch",r,{active:e},{"is-invalid":i}),id:t,onClick:s,disabled:a,"data-testid":l,children:c.jsx("div",{className:"handle"})})}var hm=["children","className","isInvalid","onChange","data-testid"];function Wo(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 Ko(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Wo(Object(t),!0).forEach(function(r){mm(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Wo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function mm(n,e,t){return(e=pm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pm(n){var e=fm(n,"string");return typeof e=="symbol"?e:e+""}function fm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function vm(n,e){if(n==null)return{};var t,r,i=gm(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function gm(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}var bl=k.forwardRef((n,e)=>{var t=n.children,r=n.className,i=n.isInvalid,o=n.onChange,a=n["data-testid"],s=vm(n,hm),l=nl(e),u=m.useCallback(d=>{o(d.target.value)},[o]);return c.jsx("select",Ko(Ko({ref:l,className:U("custom-select",r,{"is-invalid":i}),onChange:u,"data-testid":a},s),{},{children:t}))});bl.displayName="Select";var Mi=k.createContext(new Map);Mi.displayName="XComponentMapContext";var jS=Mi.Provider;function bm(n){var e,t=m.useContext(Mi);return(e=t.get(n))!==null&&e!==void 0?e:n.Original}function zo(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 Zr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?zo(Object(t),!0).forEach(function(r){ym(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):zo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ym(n,e,t){return(e=Sm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sm(n){var e=Cm(n,"string");return typeof e=="symbol"?e:e+""}function Cm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function yl(n){var e,t;function r(i,o){var a=bm(t);return hl(n)?c.jsx(a,Zr(Zr({},i),{},{ref:o})):c.jsx(a,Zr({},i))}return r.displayName="XComponent(".concat((e=n.displayName)!==null&&e!==void 0?e:n.name,")"),t=m.forwardRef(r),t.Original=n,t.isXComponent=!0,t}function _m(){return Xn(zu,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function Sl(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.name!=null}function Cl(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.id!=null}function AS(n){return Sl(n)||Cl(n)}var _l=m.createContext(null);_l.displayName="ObjectFetcherContext";function kS(n){if(Cl(n))return{id:n.id,type:n.type};if(Sl(n)){var e;return{name:(e=n.name)!==null&&e!==void 0?e:"",type:n.type}}throw new Error("Invalid descriptor: ".concat(n))}function wm(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 NS(){return Xn(_l,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}function ji(n,e,t){return(e=Em(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Em(n){var e=Pm(n,"string");return typeof e=="symbol"?e:e+""}function Pm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ye{static isValid(e,t){return!0}static isSameFormat(e,t){throw new Error("isSameFormat not implemented")}static makeFormat(e,t,r){return{label:e,formatString:t,type:r}}format(e,t){return""}}ji(Ye,"TYPE_GLOBAL","type-global");ji(Ye,"TYPE_CONTEXT_PRESET","type-context-preset");ji(Ye,"TYPE_CONTEXT_CUSTOM","type-context-custom");function Rt(n,e,t){return(e=Tm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Tm(n){var e=Om(n,"string");return typeof e=="symbol"?e:e+""}function Om(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Vo=B.module("DateTimeColumnFormatter");class Et extends Ye{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.DateTimeFormat.format(t.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ye.TYPE_CONTEXT_PRESET;return{label:e,formatString:t,type:r}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static makeGlobalFormatStringMap(e,t){var r=t?"'T'":" ",i=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getGlobalFormats(e,t){var r=Et.makeGlobalFormatStringMap(e,t);return[...r.keys()]}static makeFormatStringMap(e,t){var r=t!==void 0&&t?"'T'":" ",i=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd","yyyy-MM-dd".concat(i)],["MM-dd-yyyy","MM-dd-yyyy".concat(i)],["HH:mm:ss","HH:mm:ss".concat(i)],["HH:mm:ss.SSS","HH:mm:ss.SSS".concat(i)],["HH:mm:ss.SSSSSSSSS","HH:mm:ss.SSSSSSSSS".concat(i)],["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getFormats(e,t){var r=Et.makeFormatStringMap(e,t);return[...r.keys()]}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.timeZone,i=r===void 0?"":r,o=t.showTimeZone,a=o===void 0?!0:o,s=t.showTSeparator,l=s===void 0?!1:s,u=t.defaultDateTimeFormatString,d=u===void 0?Et.DEFAULT_DATETIME_FORMAT_STRING:u;super(),Rt(this,"dh",void 0),Rt(this,"dhTimeZone",void 0),Rt(this,"defaultDateTimeFormatString",void 0),Rt(this,"showTimeZone",void 0),Rt(this,"showTSeparator",void 0),Rt(this,"formatStringMap",void 0);var h=i||Et.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(h)}catch{Vo.error("Unsupported time zone id",h),this.dhTimeZone=e.i18n.TimeZone.getTimeZone(Et.DEFAULT_TIME_ZONE_ID)}this.dh=e,this.defaultDateTimeFormatString=d,this.showTimeZone=a,this.showTSeparator=l,this.formatStringMap=Et.makeFormatStringMap(a,l)}getEffectiveFormatString(e){var t;return(t=this.formatStringMap.get(e))!==null&&t!==void 0?t:e}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,i=this.getEffectiveFormatString(r);try{return this.dh.i18n.DateTimeFormat.format(i,e,this.dhTimeZone)}catch{Vo.error("Invalid format arguments")}return""}}Rt(Et,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");Rt(Et,"DEFAULT_TIME_ZONE_ID","America/New_York");var xt;function ht(n,e,t){return(e=Im(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Im(n){var e=xm(n,"string");return typeof e=="symbol"?e:e+""}function xm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Dm=B.module("DecimalColumnFormatter");class Ge extends Ye{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ye.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return Ge.makeFormat(e,t,Ye.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return Ge.makeFormat("Custom Format",e,Ye.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.defaultFormatString,i=r===void 0?Ge.DEFAULT_FORMAT_STRING:r;super(),ht(this,"defaultFormatString",void 0),ht(this,"dh",void 0),this.dh=e,this.defaultFormatString=i}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,i)}catch{Dm.error("Invalid format arguments")}return""}}xt=Ge;ht(Ge,"DEFAULT_FORMAT_STRING","###,##0.0000");ht(Ge,"FORMAT_PERCENT",xt.makePresetFormat("Percent","##0.00%"));ht(Ge,"FORMAT_BASIS_POINTS",xt.makePresetFormat("Basis Points","###,##0 bp",1e4));ht(Ge,"FORMAT_THOUSANDS",xt.makePresetFormat("Thousands","##0.000 k",.001));ht(Ge,"FORMAT_MILLIONS",xt.makePresetFormat("Millions","###,##0.000 mm",1e-6));ht(Ge,"FORMAT_SCIENTIFIC_NOTATION",xt.makePresetFormat("Scientific Notation","0.0000E0"));ht(Ge,"FORMAT_ROUND",xt.makePresetFormat("Round","###,##0"));ht(Ge,"FORMAT_ROUND_TWO_DECIMALS",xt.makePresetFormat("0.00","###,##0.00"));ht(Ge,"FORMAT_ROUND_FOUR_DECIMALS",xt.makePresetFormat("0.0000","###,##0.0000"));var Rr;function Tn(n,e,t){return(e=Mm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mm(n){var e=jm(n,"string");return typeof e=="symbol"?e:e+""}function jm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Am=B.module("IntegerColumnFormatter");class Tt extends Ye{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ye.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return Tt.makeFormat(e,t,Ye.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return Tt.makeFormat("Custom Format",e,Ye.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.defaultFormatString,i=r===void 0?Tt.DEFAULT_FORMAT_STRING:r;super(),Tn(this,"dh",void 0),Tn(this,"defaultFormatString",void 0),this.dh=e,this.defaultFormatString=i}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,i)}catch{Am.error("Invalid format arguments")}return""}}Rr=Tt;Tn(Tt,"DEFAULT_FORMAT_STRING","###,##0");Tn(Tt,"FORMAT_THOUSANDS",Rr.makePresetFormat("Thousands","##0.000 k",.001));Tn(Tt,"FORMAT_MILLIONS",Rr.makePresetFormat("Millions","###,##0.000 mm",1e-6));Tn(Tt,"FORMAT_SCIENTIFIC_NOTATION",Rr.makePresetFormat("Scientific Notation","0.0000E0"));function an(n,e,t){return(e=km(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function km(n){var e=Nm(n,"string");return typeof e=="symbol"?e:e+""}function Nm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class K{}an(K,"INTEGER","int");an(K,"LONG","long");an(K,"DOUBLE","double");an(K,"BOOLEAN","bool");an(K,"STRING","string");an(K,"DATE_TIME","datetime");an(K,"LOCAL_TIME","localtime");var Lm=Object.freeze({}),Rm=new Map,LS=n=>n.api,RS=n=>n.user,wl=n=>n.storage,El=n=>wl(n).commandHistoryStorage,$m=n=>wl(n).fileStorage,Fm=n=>n.defaultWorkspaceSettings,Pl=n=>{var e=n.workspace;return e},Ai=Od(n=>{var e,t,r=(e=(t=Pl(n))===null||t===void 0?void 0:t.data.settings)!==null&&e!==void 0?e:{},i=Fm(n),o=Id({},i,r,(a,s)=>{if(Array.isArray(a)&&Array.isArray(s))return s});return o}),Hm=n=>Ai(n).timeZone,$S=n=>{var e;return(e=Ai(n).notebookSettings)!==null&&e!==void 0?e:Lm},FS=n=>n.activeTool,Um=n=>{var e;return(e=n.plugins)!==null&&e!==void 0?e:Rm},Bm="SET_ACTIVE_TOOL",Wm="SET_API",HS="SET_COMMAND_HISTORY_STORAGE",US="SET_FILE_STORAGE",BS="SET_PLUGINS",Km="SET_USER",zm="SET_WORKSPACE",Vm="SET_DEFAULT_WORKSPACE_SETTINGS",WS="SET_WORKSPACE_STORAGE",Gm="SET_SERVER_CONFIG_VALUES";function Go(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 _t(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Go(Object(t),!0).forEach(function(r){Xm(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Go(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Xm(n,e,t){return(e=qm(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qm(n){var e=Zm(n,"string");return typeof e=="symbol"?e:e+""}function Zm(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var KS=n=>({type:Km,payload:n}),zS=n=>({type:Wm,payload:n}),Tl=n=>({type:zm,payload:n}),VS=n=>({type:Vm,payload:n}),Ym=n=>(e,t)=>{e(Tl(n));var r=t(),i=r.storage,o=i.workspaceStorage;return o==null?void 0:o.save(n)},Jm=n=>(e,t)=>{var r=t(),i=r.workspace,o=i??{},a=o.data,s=_t(_t({},i),{},{data:_t(_t(_t({},a),n),{},{settings:_t(_t({},a==null?void 0:a.settings),n.settings)})});return e(Ym(s))},GS=n=>(e,t)=>{var r=Ai(t()),i=r.notebookSettings,o=_t(_t({},i),n);return e(Qm({notebookSettings:o}))},Qm=n=>e=>e(Jm({settings:n})),XS=n=>({type:Bm,payload:n}),qS=n=>({type:Gm,payload:n});function Xo(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 qo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Xo(Object(t),!0).forEach(function(r){ep(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Xo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ep(n,e,t){return(e=tp(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:e+""}function np(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function rp(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==null?void 0:i.type){case n:{var o=i.id,a=i.payload;return t&&li({payload:a},{payload:r[o]})?r:qo(qo({},r),{},{[o]:a})}default:return r}}}function Zo(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 Yo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Zo(Object(t),!0).forEach(function(r){fi(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Zo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function fi(n,e,t){return(e=ip(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ip(n){var e=op(n,"string");return typeof e=="symbol"?e:e+""}function op(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ap{constructor(){fi(this,"reducers",{}),fi(this,"listener",null)}register(e,t){var r;this.reducers=Yo(Yo({},this.reducers),{},{[e]:t}),(r=this.listener)===null||r===void 0||r.call(this,this.reducers)}setListener(e){this.listener=e}}var sp=new ap,Ol=m.createContext(null);Ol.displayName="PluginsContext";var Kt=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",ELEMENT_PLUGIN:"ElementPlugin",MIDDLEWARE_PLUGIN:"MiddlewarePlugin",MULTI_PLUGIN:"MultiPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin",WIDGET_PLUGIN:"WidgetPlugin"});function lp(n){return"DashboardPlugin"in n}function up(n){return"AuthPlugin"in n}function dp(n){return"TablePlugin"in n}function cp(n){return lp(n)||up(n)||dp(n)}function hp(n){return"type"in n&&n.type===Kt.DASHBOARD_PLUGIN}function vi(n){return"type"in n&&n.type===Kt.MIDDLEWARE_PLUGIN}function qn(n){return"type"in n&&n.type===Kt.WIDGET_PLUGIN}function Il(n){return qn(n)&&"dashboardTypes"in n&&n.dashboardTypes!=null}function mp(n){return"type"in n&&n.type===Kt.TABLE_PLUGIN}function pp(n){return"type"in n&&n.type===Kt.AUTH_PLUGIN}function xl(n){return"type"in n&&n.type===Kt.THEME_PLUGIN}function Dl(n){return"type"in n&&n.type===Kt.ELEMENT_PLUGIN}function Ml(n){return"type"in n&&n.type===Kt.MULTI_PLUGIN}function gi(n){return hp(n)||pp(n)||Dl(n)||Ml(n)||mp(n)||xl(n)||qn(n)||vi(n)}var fp=["metadata"],vp=["metadata"],gp=["Component"],bp=["Component"];function Jo(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 xe(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Jo(Object(t),!0).forEach(function(r){yp(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Jo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function yp(n,e,t){return(e=Sp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sp(n){var e=Cp(n,"string");return typeof e=="symbol"?e:e+""}function Cp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function $r(n,e){if(n==null)return{};var t,r,i=_p(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function _p(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}function jl(n,e){return Tp(n)||Pp(n,e)||Ep(n,e)||wp()}function wp(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
9
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ep(n,e){if(n){if(typeof n=="string")return Qo(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Qo(n,e):void 0}}function Qo(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function Pp(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function Tp(n){if(Array.isArray(n))return n}var Ve=B.module("@deephaven/plugin.PluginUtils");function wn(n){var e,t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Component";return(e=(t=n.displayName)!==null&&t!==void 0?t:n.name)!==null&&e!==void 0?e:r}function ea(n,e){return n==null||!qn(n)?!1:[n.supportedTypes].flat().some(t=>t===e)}function ZS(n,e){return n==null||!Il(n)?!1:[n.dashboardTypes].flat().some(t=>t===e)}function Op(n){var e=c.jsx(me,{icon:$s});if(!qn(n))return e;var t=n.icon;return t==null?e:m.isValidElement(t)?t:c.jsx(me,{icon:t})}function YS(n){var e=[...n.entries()].filter(t=>xl(t[1]));return Ve.debug("Getting theme data from plugins",e),e.map(t=>{var r=jl(t,2),i=r[0],o=r[1],a=Array.isArray(o.themes)?o.themes:[o.themes];return a.map(s=>{var l=s.name,u=s.baseTheme,d=s.styleContent;return{baseThemeKey:"default-".concat(u??"dark"),themeKey:Vu(i,l),name:l,styleContent:d}})}).flat()}function JS(n){var e=[...n.entries()].filter(t=>Dl(t[1])&&t[1].mapping!=null);return Ve.debug("Getting element plugin mapping",e),new Map(e.flatMap(t=>{var r=jl(t,2),i=r[1];return Object.entries(i.mapping)}))}function Ip(n,e){return e.length===0?(Ve.debug("No middleware to chain for component",wn(n)),n):(Ve.debug("Chaining component middleware",wn(n),e.map(t=>t.name)),[...e].reverse().reduce((t,r)=>{var i=r.component,o=[r.supportedTypes].flat();function a(s){var l=s.metadata,u=$r(s,fp);return(l==null?void 0:l.type)!=null&&!o.includes(l.type)?c.jsx(t,xe(xe({},u),{},{metadata:l})):c.jsx(i,xe(xe({},u),{},{metadata:l,Component:t}))}return a.displayName="".concat(r.name,"(").concat(wn(t),")"),a},n))}function QS(n,e){var t=e.filter(r=>r.panelComponent!=null);return t.length===0?(Ve.debug("No panel middleware to chain for panel component",wn(n)),n):(Ve.debug("Chaining panel middleware",wn(n),t.map(r=>r.name)),[...t].reverse().reduce((r,i)=>{var o=i.panelComponent,a=[i.supportedTypes].flat(),s=k.forwardRef((l,u)=>{var d=l.metadata,h=$r(l,vp),p=u!=null?{ref:u}:{};return(d==null?void 0:d.type)!=null&&!a.includes(d.type)?c.jsx(r,xe(xe(xe({},p),h),{},{metadata:d})):c.jsx(o,xe(xe(xe({},p),h),{},{metadata:d,Component:r}))});return s.displayName="".concat(i.name,"Panel(").concat(wn(r,"Panel"),")"),s},n))}function eC(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"PanelMiddleware",t=k.forwardRef((r,i)=>{var o=r.Component,a=$r(r,gp),s=n(a),l=s.inject,u=s.wrap,d=o,h=c.jsx(d,xe(xe({ref:i},a),l));return u!=null?u(h):h});return t.displayName=e,t}function tC(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"WidgetMiddleware";function t(r){var i=r.Component,o=$r(r,bp),a=n(o),s=a.inject,l=a.wrap,u=i,d=c.jsx(u,xe(xe({},o),s));return l!=null?l(d):d}return t.displayName=e,t}function xp(n){return typeof n=="object"&&n!=null&&n.default!=null&&typeof n.default=="object"}function Dp(n){return gi(n)?n:xp(n)&&gi(n.default)?n.default:cp(n)?n:null}function ta(n,e,t,r){if(n.has(e)){Ve.warn("Plugin '".concat(e,"' is already registered. Skipping duplicate."));return}n.set(e,xe(xe({},t),{},{version:r}))}function nC(n,e,t,r,i,o){i!=null&&(e[i]=t,Ve.debug("Registered plugin '".concat(i,"' in module resolve map")));var a=Dp(t);if(a==null){Ve.error("Plugin '".concat(r,"' is missing an exported value."));return}Ml(a)?(Ve.debug("MultiPlugin '".concat(r,"' contains ").concat(a.plugins.length," plugins")),a.plugins.forEach(s=>{if(!gi(s)){Ve.warn("Skipping invalid inner plugin from MultiPlugin '".concat(r,"'"),s);return}var l=typeof s.name=="string"?s.name.trim():"";if(l.length===0){Ve.warn("Skipping unnamed inner plugin from MultiPlugin '".concat(r,"'"),s);return}ta(n,l,s,o)})):ta(n,r,a,o)}function rC(n){var e=new Map;n.forEach(s=>{var l;((l=s.loader)===null||l===void 0?void 0:l.package)!=null&&e.set(s.loader.package,s)});var t=new Map;n.forEach(s=>{var l,u=new Set;((l=s.loader)===null||l===void 0?void 0:l.dependencies)!=null&&s.loader.dependencies.forEach(d=>{var h=e.get(d);h!=null?u.add(h):Ve.warn("Plugin '".concat(s.name,"' depends on '").concat(d,"' which is not in the manifest"))}),t.set(s,u)});for(var r=[],i=new Set(n),o=new Set,a=function(){var l=[];if(i.forEach(d=>{var h=t.get(d);if(h==null||h.size===0){l.push(d);return}var p=!0;h.forEach(f=>{o.has(f)||(p=!1)}),p&&l.push(d)}),l.length===0){var u=[...i].map(d=>d.name);return Ve.error("Circular plugin dependency detected among: ".concat(u.join(", "),". Loading remaining plugins together.")),r.push([...i]),1}r.push(l),l.forEach(d=>{i.delete(d),o.add(d)})};i.size>0&&!a(););return r}function Mp(n,e){var t;return(t=[...n.values()].find(r=>Il(r)&&[r.dashboardTypes].flat().some(i=>i===e)))!==null&&t!==void 0?t:null}function jp(){return Xn(Ol,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}var na=B.module("@deephaven/plugin.WidgetView");function iC(n){var e=n.fetch,t=n.type,r=jp(),i=m.useMemo(()=>{var l,u=[];return r.forEach(d=>{if(!(!qn(d)&&!vi(d))){var h=[d.supportedTypes].flat().includes(t);h&&(vi(d)?u.push(d):(l!=null&&na.warn("Multiple base plugins for type ".concat(t,". Replacing ").concat(l.name," with ").concat(d.name)),l=d))}}),{basePlugin:l,middleware:u}},[r,t]),o=i.basePlugin,a=i.middleware,s=m.useMemo(()=>o==null?(na.debug("No base plugin found for widget type ".concat(t)),null):Ip(o.component,a),[o,a,t]);if(s!=null)return c.jsx(s,{fetch:e});throw new Error("Unknown widget type '".concat(t,"'"))}var Al=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 kl(n){return n.componentName!==void 0}function Ap(n){return n.component!==void 0}var Nl=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const kp=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:Al,isGLComponentConfig:kl,isReactComponentConfig:Ap,itemDefaultConfig:Nl},Symbol.toStringTag,{value:"Module"}));function Cr(n,e,t){return(e=Np(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Np(n){var e=Lp(n,"string");return typeof e=="symbol"?e:e+""}function Lp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ue{constructor(){Cr(this,"_mSubscriptions",void 0),Cr(this,"off",this.unbind),Cr(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[Ue.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),o=1;o<r;o++)i[o-1]=arguments[o];if(t)for(var a=0;a<t.length;a++){var s=t[a].ctx||{};try{t[a].fn.apply(s,i)}catch(h){console.error("Error while emitting event:",h)}}i.unshift(e);for(var l=this._mSubscriptions[Ue.ALL_EVENT],u=0;u<l.length;u++){var d=l[u].ctx||{};try{l[u].fn.apply(d,i)}catch(h){console.error("Error while emitting event to allEventSubs:",h)}}}unbind(e,t,r){if(!this._mSubscriptions[e])throw new Error("No subscriptions to unsubscribe for event "+e);for(var i=!1,o=0;o<this._mSubscriptions[e].length;o++)(!t||this._mSubscriptions[e][o].fn===t)&&(!r||r===this._mSubscriptions[e][o].ctx)&&(this._mSubscriptions[e].splice(o,1),i=!0);if(i===!1)throw new Error("Nothing to unbind for "+e)}}Cr(Ue,"ALL_EVENT","__all");function at(n,e,t){return(e=Rp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Rp(n){var e=$p(n,"string");return typeof e=="symbol"?e:e+""}function $p(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class bi extends Ue{constructor(e,t,r){super(),at(this,"width",void 0),at(this,"height",void 0),at(this,"title",void 0),at(this,"parent",void 0),at(this,"layoutManager",void 0),at(this,"tab",void 0),at(this,"_config",void 0),at(this,"isHidden",!1),at(this,"beforeCloseHandler",void 0),at(this,"_element",O(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),at(this,"_contentElement",void 0),this.title=kl(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,o,a=this.parent,s=null;a&&!a.isColumn&&!a.isRow;){var l;if(s=a,a=a.parent,(l=a)!==null&&l!==void 0&&l.isRoot)return!1}if(!a||!s)return!1;for(var u=a.isColumn?"height":"width",d=u==="height"?t:e,h=((r=this[u])!==null&&r!==void 0?r:0)*(1/(((i=s.config[u])!==null&&i!==void 0?i:0)/100)),p=d/h*100,f=(((o=s.config[u])!==null&&o!==void 0?o:0)-p)/(a.contentItems.length-1),v=0;v<a.contentItems.length;v++)if(a.contentItems[v]===s)a.contentItems[v].config[u]=p;else{var g;a.contentItems[v].config[u]=((g=a.contentItems[v].config[u])!==null&&g!==void 0?g:0)+f}return a.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}getConfig(){return this._config}setState(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")}setPersistedState(e){this._config.persistedState=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,o=r.offsetHeight-r.clientHeight;this._contentElement.width(this.width-i).height(this.height-o),this.emit("resize")}}}const Fp=Object.freeze(Object.defineProperty({__proto__:null,Container:bi,ItemContainer:bi},Symbol.toStringTag,{value:"Module"}));function Ll(n){var e=location.hash.match(new RegExp(n+"=([^&]*)"));return e?e[1]:null}function Rl(n){if(window.location.hash)return Ll(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 Sn(n){return window.requestAnimationFrame(n)}function Hp(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 Er(){return Pt()}function Up(n,e){var t=n.replace(/javascript/gi,"j&#97;vascript").replace(/expression/gi,"expr&#101;ssion").replace(/onload/gi,"onlo&#97;d").replace(/script/gi,"&#115;cript").replace(/onerror/gi,"on&#101;rror");return e===!0?t:t.replace(/>/g,"&gt;").replace(/</g,"&lt;")}function ki(n){return O.trim(n.replace(/(<([^>]+)>)/gi,""))}function Be(n,e,t){return(e=Bp(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:e+""}function Wp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class jn extends Ue{constructor(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;super(),Be(this,"_eElement",void 0),Be(this,"_oDocument",void 0),Be(this,"_eBody",void 0),Be(this,"_root",void 0),Be(this,"_destroyAfterMouseUp",void 0),Be(this,"_nDelay",400),Be(this,"_timeout",void 0),Be(this,"timeout",void 0),Be(this,"_nDistance",10),Be(this,"_nX",0),Be(this,"_nY",0),Be(this,"_nOriginalX",0),Be(this,"_nOriginalY",0),Be(this,"_bDragging",!1),this._eElement=e,this._oDocument=O(document),this._eBody=O(document.body),this._root=t,this._destroyAfterMouseUp=i,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this._startDrag=this._startDrag.bind(this),(r=this._eElement)===null||r===void 0||r.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,o,a=this._getCoordinates(e);this._nOriginalX=(t=a.x)!==null&&t!==void 0?t:0,this._nOriginalY=(r=a.y)!==null&&r!==void 0?r:0,(i=this._oDocument)===null||i===void 0||i.on("mousemove",this.onMouseMove),(o=this._oDocument)===null||o===void 0||o.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,o,a;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||(i=i.find("iframe"))===null||i===void 0||i.css("pointer-events",""),this._bDragging===!0&&(this._bDragging=!1,this.emit("dragStop",e,this._nOriginalX+this._nX)),(o=this._eBody)===null||o===void 0||o.removeClass("lm_dragging"),(a=this._root)===null||a===void 0||a.childElementContainer.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var s;(s=this._eElement)===null||s===void 0||s.removeClass("lm_dragging")}this._destroyAfterMouseUp&&this.destroy()}}_startDrag(){var e,t,r,i;window.clearTimeout(this._timeout),this._bDragging=!0,(e=this._eBody)===null||e===void 0||e.addClass("lm_dragging"),(t=this._eElement)===null||t===void 0||t.addClass("lm_dragging"),(r=this._root)===null||r===void 0||r.childElementContainer.addClass("lm_dragging"),(i=this._oDocument)===null||i===void 0||(i=i.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}}}function cn(n,e,t){return(e=Kp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kp(n){var e=zp(n,"string");return typeof e=="symbol"?e:e+""}function zp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class $l{constructor(e,t){cn(this,"_container",void 0),cn(this,"_reactComponent",null),cn(this,"_portalComponent",null),cn(this,"_originalComponentWillUpdate",void 0),cn(this,"_initialState",void 0),cn(this,"_reactClass",void 0),this._reactComponent=null,this._portalComponent=null,this._originalComponentWillUpdate=void 0,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=xi.createPortal(this._getReactComponent(),this._container.getElement()[0],e),this._container.layoutManager.addReactChild(e,this._portalComponent)}_gotReactComponent(e){if(e&&(this._reactComponent=e,this._reactComponent instanceof m.Component)){this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate,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,void 0)}_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=O.extend(e,this._container._config.props);return k.createElement(this._reactClass,t)}}var Pr=["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"],Vp=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function Ni(n){if(Pr.length>36)throw new Error("Too many keys in config minifier map");var e={};return Li(n,e,"_min"),e}function yi(n){if(Pr.length>36)throw new Error("Too many keys in config minifier map");var e={};return Li(n,e,"_max"),e}function Li(n,e,t){var r=t==="_min"?Gp:Xp;for(var i in n)if(n.hasOwnProperty(i)){var o=Array.isArray(n)?n[Number.parseInt(i,10)]:n[i];if(typeof o=="object"&&o!=null){var a=o instanceof Array?[]:{};if(Array.isArray(e))e[Number.parseInt(i,10)]=a;else{var s=r(i,Pr);e[s]=a}Li(o,a,t)}else{var l=r(o,Vp);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var u=r(i,Pr);e[u]=l}}}}function Gp(n,e){if(typeof n=="string"&&n.length===1)return"___"+n;var t=e.indexOf(n);return t===-1?n:t.toString(36)}function Xp(n,e){return typeof n=="string"&&n.length===1?e[parseInt(n,36)]:typeof n=="string"&&n.substr(0,3)==="___"?n[3]:n}function Yr(n,e,t){return(e=qp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qp(n){var e=Zp(n,"string");return typeof e=="symbol"?e:e+""}function Zp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Si{constructor(e,t){Yr(this,"name",void 0),Yr(this,"origin",void 0),Yr(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function ur(n,e,t){return(e=Yp(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yp(n){var e=Jp(n,"string");return typeof e=="symbol"?e:e+""}function Jp(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}let Fl=class extends Ue{constructor(e){super(),ur(this,"_layoutManager",void 0),ur(this,"_dontPropagateToParent",void 0),ur(this,"_childEventSource",void 0),ur(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Ue.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),O(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(){O(window).off("gl_child_event",this._boundOnEventFromChild)}};function Hl(n,e,t){return n.on(e,t),()=>{n.off(e,t)}}function Ul(n){return(e,t)=>Hl(e,n,t)}function Bl(n){return function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];e.emit(n,...r)}}function Wl(n){return(e,t)=>{var r=m.useRef(null),i=m.useRef(()=>!1);if(r.current!=e||i.current!=t){var o;(o=r.current)===null||o===void 0||o.off(n,i.current),e==null||e.on(n,t)}r.current=e,i.current=t,m.useEffect(()=>()=>{var a;return(a=r.current)===null||a===void 0?void 0:a.off(n,i.current)},[])}}function mt(n){return{listen:Ul(n),emit:Bl(n),useListener:Wl(n)}}const Qp=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:Si,DragListener:jn,EventEmitter:Ue,EventHub:Fl,ReactComponentHandler:$l,animFrame:Sn,filterXss:Up,getHashValue:Ll,getQueryStringParam:Rl,getUniqueId:Er,listenForEvent:Hl,makeEmitFunction:Bl,makeEventFunctions:mt,makeListenFunction:Ul,makeUseListenerFunction:Wl,minifyConfig:Ni,removeFromArray:Hp,stripTags:ki,unminifyConfig:yi},Symbol.toStringTag,{value:"Module"}));function At(n,e,t){return(e=ef(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ef(n){var e=tf(n,"string");return typeof e=="symbol"?e:e+""}function tf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Kl extends Ue{constructor(e,t,r,i,o){super(),At(this,"isInitialised",!1),At(this,"_config",void 0),At(this,"_dimensions",void 0),At(this,"_parentId",void 0),At(this,"_indexInParent",void 0),At(this,"_layoutManager",void 0),At(this,"_popoutWindow",null),At(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=r,this._indexInParent=i,this._layoutManager=o,this._createWindow()}toConfig(){var e,t,r,i,o,a,s,l,u,d,h;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=(o=this._popoutWindow)===null||o===void 0?void 0:o.screenX)!==null&&i!==void 0?i:(a=this._popoutWindow)===null||a===void 0?void 0:a.screenLeft)!==null&&r!==void 0?r:0,top:(s=(l=(u=this._popoutWindow)===null||u===void 0?void 0:u.screenY)!==null&&l!==void 0?l:(d=this._popoutWindow)===null||d===void 0?void 0:d.screenTop)!==null&&s!==void 0?s:0},content:(h=this.getGlInstance())===null||h===void 0?void 0:h.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=O.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 o;((o=this._layoutManager.root.contentItems.length)!==null&&o!==void 0?o: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;O(this._popoutWindow).on("load",this._positionWindow.bind(this)).on("unload beforeunload",this._onClose.bind(this));var o=window.setInterval(()=>{var a;(a=this._popoutWindow)!==null&&a!==void 0&&a.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),window.clearInterval(o))},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-"+Er();e=Ni(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 Ee(n,e,t){return(e=nf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function nf(n){var e=rf(n,"string");return typeof e=="symbol"?e:e+""}function rf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class sn extends Ue{constructor(e,t,r,i,o,a){var s,l,u,d,h,p,f,v;if(super(),Ee(this,"_dragListener",void 0),Ee(this,"_layoutManager",void 0),Ee(this,"_contentItem",void 0),Ee(this,"_originalParent",void 0),Ee(this,"_area",null),Ee(this,"_lastValidArea",null),Ee(this,"_minX",void 0),Ee(this,"_maxX",void 0),Ee(this,"_minY",void 0),Ee(this,"_maxY",void 0),Ee(this,"_width",void 0),Ee(this,"_height",void 0),Ee(this,"_sided",void 0),Ee(this,"element",void 0),Ee(this,"childElementContainer",void 0),Ee(this,"_proxyTab",void 0),this._dragListener=r,this._layoutManager=i,this._contentItem=o,this._originalParent=a,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var g,b;this._layoutManager.tabDropPlaceholder.width((g=this._contentItem.tab.element.outerWidth(!0))!==null&&g!==void 0?g:0),this._layoutManager.tabDropPlaceholder.height((b=this._contentItem.tab.element.outerHeight(!0))!==null&&b!==void 0?b:0)}if(this.element=O(sn._template),a&&a._side&&(this._sided=a._sided,this.element.addClass("lm_"+a._side),["right","bottom"].indexOf(a._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",ki((s=this._contentItem.config.title)!==null&&s!==void 0?s:"")),this.element.find(".lm_title").text((l=this._contentItem.config.title)!==null&&l!==void 0?l:""),this.childElementContainer=this.element.find(".lm_content"),this.childElementContainer.append(o.element),this._updateTree(),this._layoutManager._$calculateItemAreas(),O(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var y,S;this._layoutManager.tabDropPlaceholder.width((y=this._proxyTab.outerWidth(!0))!==null&&y!==void 0?y:0),this._layoutManager.tabDropPlaceholder.height((S=this._proxyTab.outerHeight(!0))!==null&&S!==void 0?S:0)}var C=this._layoutManager.container.offset();this._minX=(u=C==null?void 0:C.left)!==null&&u!==void 0?u:0,this._minY=(d=C==null?void 0:C.top)!==null&&d!==void 0?d:0,this._maxX=((h=this._layoutManager.container.width())!==null&&h!==void 0?h:0)+this._minX,this._maxY=((p=this._layoutManager.container.height())!==null&&p!==void 0?p:0)+this._minY,this._width=(f=this.element.width())!==null&&f!==void 0?f:0,this._height=(v=this.element.height())!==null&&v!==void 0?v:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,r){var i,o,a=(i=r.pageX)!==null&&i!==void 0?i:0,s=(o=r.pageY)!==null&&o!==void 0?o:0,l=a>this._minX&&a<this._maxX&&s>this._minY&&s<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(a,s)}_setDropPosition(e,t){this.element.css({left:e,top:t}),this._area=this._layoutManager._$getArea(e,t),this._area!==null&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(e,t,this._area))}_onDrop(){var e;(e=this._layoutManager.dropTargetIndicator)===null||e===void 0||e.hide(),this._area!==null?this._area.contentItem._$onDrop(this._contentItem,this._area):this._lastValidArea!==null?this._lastValidArea.contentItem._$onDrop(this._contentItem,this._lastValidArea):this._originalParent?this._originalParent.addChild(this._contentItem):this._contentItem._$destroy(),this._dragListener.off("drag",this._onDrag,this),this._dragListener.off("dragStop",this._onDrop,this),this.element.remove(),this._layoutManager.emit("itemDropped",this._contentItem)}_updateTree(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(null)}_setDimensions(){var e=this._layoutManager.config.dimensions,t=e.dragProxyWidth,r=e.dragProxyHeight;this.element.width(t),this.element.height(r),t-=this._sided?e.headerHeight:0,r-=this._sided?0:e.headerHeight,this.childElementContainer.width(t),this.childElementContainer.height(r),this._contentItem.element.width(t),this._contentItem.element.height(r),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}Ee(sn,"_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 dr(n,e,t){return(e=of(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function of(n){var e=af(n,"string");return typeof e=="symbol"?e:e+""}function af(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class zl{constructor(e,t,r){dr(this,"_element",void 0),dr(this,"_itemConfig",void 0),dr(this,"_layoutManager",void 0),dr(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=r,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new jn(this._element,this._layoutManager.root,!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(O.extend(!0,{},r));new sn(e,t,this._dragListener,this._layoutManager,i,null)}}function cr(n,e,t){return(e=sf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sf(n){var e=lf(n,"string");return typeof e=="symbol"?e:e+""}function lf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Vl{constructor(e,t,r){cr(this,"_element",O(window)),cr(this,"_itemConfig",void 0),cr(this,"_layoutManager",void 0),cr(this,"_dragListener",void 0),this._itemConfig=e,this._layoutManager=t,this._createDragListener(r)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&this._layoutManager&&(this._dragListener=new jn(this._element,this._layoutManager.root,!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(O.extend(!0,{},r));new sn(e,t,this._dragListener,this._layoutManager,i,null)}}}function Gl(n,e,t){return(e=uf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function uf(n){var e=df(n,"string");return typeof e=="symbol"?e:e+""}function df(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Zn{constructor(){Gl(this,"element",O(Zn._template)),O(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()}}Gl(Zn,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function Jr(n,e,t){return(e=cf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cf(n){var e=hf(n,"string");return typeof e=="symbol"?e:e+""}function hf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Rn{constructor(e,t,r,i){Jr(this,"element",void 0),Jr(this,"_header",void 0),Jr(this,"_action",void 0),this._header=e,this.element=O('<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 mf(n,e,t){return(e=pf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pf(n){var e=ff(n,"string");return typeof e=="symbol"?e:e+""}function ff(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class en extends Error{constructor(e,t){super(),mf(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const vf=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:en},Symbol.toStringTag,{value:"Module"}));function gf(n,e){return Cf(n)||Sf(n,e)||yf(n,e)||bf()}function bf(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
10
10
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yf(n,e){if(n){if(typeof n=="string")return ra(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ra(n,e):void 0}}function ra(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function Sf(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function Cf(n){if(Array.isArray(n))return n}function Ce(n,e,t){return(e=_f(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _f(n){var e=wf(n,"string");return typeof e=="symbol"?e:e+""}function wf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function nn(n){return n.isStack}function Ne(n){return n.isComponent}function Xl(n){return n.isRoot}class _e extends Ue{constructor(e,t,r,i){super(),Ce(this,"config",void 0),Ce(this,"type",void 0),Ce(this,"contentItems",void 0),Ce(this,"parent",void 0),Ce(this,"layoutManager",void 0),Ce(this,"element",void 0),Ce(this,"childElementContainer",void 0),Ce(this,"componentName",void 0),Ce(this,"isInitialised",!1),Ce(this,"isMaximised",!1),Ce(this,"isRoot",!1),Ce(this,"isRow",!1),Ce(this,"isColumn",!1),Ce(this,"isStack",!1),Ce(this,"isComponent",!1),Ce(this,"tab",void 0),Ce(this,"_pendingEventPropagations",void 0),Ce(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(Ue.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 o=0;o<this.contentItems.length;o++)this.contentItems[o].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 o;(o=this.parent)===null||o===void 0||o.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),o=e.element[0].parentNode;if(i===-1)throw new Error("Can't replace child. oldChild is not child of this");o==null||o.replaceChild(t.element[0],e.element[0]),r===!0&&(e.parent=null,e._$destroy()),this.contentItems[i]=t,t.parent=this,nn(this)&&this.header.tabs[i].setContentItem(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(o){for(var a=0;a<o.contentItems.length;a++)e(o.contentItems[a])===!0&&t.push(o.contentItems[a]),r(o.contentItems[a])};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&&Ne(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 o=(t=e.offset())!==null&&t!==void 0?t:{left:0,top:0},a=(r=e.width())!==null&&r!==void 0?r:0,s=(i=e.height())!==null&&i!==void 0?i:0;return{x1:o.left,y1:o.top,x2:o.left+a,y2:o.top+s,surface:a*s,contentItem:this,side:""}}_$init(){this.setSize();for(var e=0;e<this.contentItems.length;e++){var t;(t=this.childElementContainer)===null||t===void 0||t.append(this.contentItems[e].element)}this.isInitialised=!0,this.emitBubblingEvent("itemCreated"),this.emitBubblingEvent(this.type+"Created")}emitBubblingEvent(e){var t=new Si(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new en("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 of Object.entries(Nl)){var r=gf(t,2),i=r[0],o=r[1],a=i;e[a]===void 0&&(e[a]=o)}return e}_propagateEvent(e,t){t instanceof Si&&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,Sn(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function Ef(n,e){return If(n)||Of(n,e)||Tf(n,e)||Pf()}function Pf(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
11
11
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tf(n,e){if(n){if(typeof n=="string")return ia(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ia(n,e):void 0}}function ia(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function Of(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function If(n){if(Array.isArray(n))return n}function kn(n,e,t){return(e=xf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xf(n){var e=Df(n,"string");return typeof e=="symbol"?e:e+""}function Df(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ql extends _e{constructor(e,t,r){var i;Object.entries((i=e.config.settings.defaultComponentConfig)!==null&&i!==void 0?i:{}).forEach(s=>{var l=Ef(s,2),u=l[0],d=l[1];t[u]===void 0&&(t[u]=d)}),super(e,t,r,O()),kn(this,"config",void 0),kn(this,"componentName",void 0),kn(this,"container",void 0),kn(this,"parent",void 0),kn(this,"instance",void 0),this.config=t,this.parent=r;var o=e.getComponent(this.config.componentName)||e.getFallbackComponent(),a=O.extend(!0,{},this.config.componentState||{});if(o==null)throw new en('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 bi(this.config,this,e),this.instance=new o(this.container,a),this.element=this.container._element}close(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}setSize(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())}_$init(){_e.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),_e.prototype._$hide.call(this)}_$show(e){this.container.show(),(this.container._config.isFocusOnShow||e)&&this.container._contentElement[0].focus({preventScroll:!0}),_e.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),_e.prototype._$destroy.call(this)}_$getArea(){return null}}function Se(n,e,t){return(e=Mf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mf(n){var e=jf(n,"string");return typeof e=="symbol"?e:e+""}function jf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ot extends _e{constructor(e,t,r,i){super(t,r,i,O('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),Se(this,"isRow",void 0),Se(this,"isColumn",void 0),Se(this,"childElementContainer",void 0),Se(this,"parent",void 0),Se(this,"_splitter",[]),Se(this,"_intersectionSplitter",[]),Se(this,"_splitterSize",void 0),Se(this,"_splitterGrabSize",void 0),Se(this,"_isColumn",void 0),Se(this,"_dimension",void 0),Se(this,"_splitterPosition",null),Se(this,"_splitterMinPosition",null),Se(this,"_splitterMaxPosition",null),Se(this,"_isIntersectionDragging",!1),Se(this,"_activeFourWayPartner",null),Se(this,"_activeFourWaySharedCenterMin",null),Se(this,"_activeFourWaySharedCenterMax",null),Se(this,"_activeFourWayBaseCenter",null),Se(this,"_activeFourWayPartnerBaseCenter",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,o,a,s;if(e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.length>0?(s=this._createSplitter(Math.max(0,t-1)).element,t>0?(this.contentItems[t-1].element.after(s),s.after(e.element)):(this.contentItems[0].element.before(s),s.before(e.element))):this.childElementContainer.append(e.element),_e.prototype.addChild.call(this,e,t),i=1/this.contentItems.length*100,r===!0){this.emitBubblingEvent("stateChanged");return}for(a=0;a<this.contentItems.length;a++)if(this.contentItems[a]===e)e.config[this._dimension]=i;else{var l;o=((l=this.contentItems[a].config[this._dimension])!==null&&l!==void 0?l:0)*(100-i)/100,this.contentItems[a].config[this._dimension]=o}this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}removeChild(e,t){var r,i=(r=e.config[this._dimension])!==null&&r!==void 0?r:0,o=this.contentItems.indexOf(e),a=Math.max(o-1,0),s,l;if(o===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[a]&&(this._splitter[a]._$destroy(),this._splitter.splice(a,1)),s=0;s<this.contentItems.length;s++)if(this.contentItems[s]!==e){var u;this.contentItems[s].config[this._dimension]=((u=this.contentItems[s].config[this._dimension])!==null&&u!==void 0?u:0)+i/(this.contentItems.length-1)}if(_e.prototype.removeChild.call(this,e,t),this.contentItems.length===1&&this.config.isClosable===!0){var d;l=this.contentItems[0],this.contentItems=[],(d=this.parent)===null||d===void 0||d.replaceChild(this,l,!0)}else this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}replaceChild(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=e.config[this._dimension];t.config[this._dimension]=i,super.replaceChild(e,t,r),this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(){this.contentItems.length>0&&(this._calculateRelativeSizes(),this._setAbsoluteSizes(),this._scheduleIntersectionRefresh()),this.emitBubblingEvent("stateChanged"),this.emit("resize")}_$init(){if(this.isInitialised!==!0){var e;for(_e.prototype._$init.call(this),e=0;e<this.contentItems.length-1;e++)this.contentItems[e].element.after(this._createSplitter(e).element);for(e=0;e<this.contentItems.length;e++)this.contentItems[e].isInitialised!==!0&&this.contentItems[e]._$init();this._refreshIntersectionSplitters()}}_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,o=(t=this.element.height())!==null&&t!==void 0?t:0,a=0,s=[];this._isColumn?o-=r:i-=r;for(var l=0;l<this.contentItems.length;l++){var u,d,h=this._isColumn?Math.floor(o*(((u=this.contentItems[l].config.height)!==null&&u!==void 0?u:0)/100)):Math.floor(i*(((d=this.contentItems[l].config.width)!==null&&d!==void 0?d:0)/100));a+=h,s.push(h)}var p=Math.floor((this._isColumn?o:i)-a);return{itemSizes:s,additionalPixel:p,totalWidth:i,totalHeight:o}}_calculateRelativeSizes(){for(var e=0,t=[],r=this._isColumn?"height":"width",i=0;i<this.contentItems.length;i++){var o=this.contentItems[i].config[r];o!=null?e+=o:t.push(this.contentItems[i])}if(Math.round(e)===100){this._respectMinItemWidth();return}if(Math.round(e)<100&&t.length>0){for(var a=0;a<t.length;a++)t[a].config[r]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var s=0;s<t.length;s++)t[s].config[r]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var u;this.contentItems[l].config[r]=((u=this.contentItems[l].config[r])!==null&&u!==void 0?u:0)/e*100}this._respectMinItemWidth()}_respectMinItemWidth(){var e,t=this.layoutManager.config.dimensions&&(e=this.layoutManager.config.dimensions.minItemWidth)!==null&&e!==void 0?e:0,r=[],i=0,o=0,a=0,s=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var u=this._calculateAbsoluteSizes(),d=0;d<this.contentItems.length;d++){this.contentItems[d];var h=u.itemSizes[d];h<t?(o+=t-h,l={width:t}):(i+=h-t,l={width:h},r.push(l)),s.push(l)}if(!(o===0||o>i)){var p=o/i;a=o;for(var f=0;f<r.length;f++){l=r[f];var v=Math.round((l.width-t)*p);a-=v,l.width-=v}a!==0&&(s[s.length-1].width-=a);for(var g=0;g<this.contentItems.length;g++)this.contentItems[g].config.width=s[g].width/u.totalWidth*100}}}_createSplitter(e){var t;return t=new Yl(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 o,a;t=Math.max((o=e[i].minWidth)!==null&&o!==void 0?o:0,t),r=Math.max((a=e[i].minHeight)!==null&&a!==void 0?a:0,r)}return{horizontal:t,vertical:r}}_onSplitterDragStart(e){var t,r,i,o,a=this._getItemsForSplitter(e),s=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=a.before.config.content)!==null&&t!==void 0?t:[]),u=this._isColumn?l.vertical:l.horizontal,d=this._getMinimumDimensions((r=a.after.config.content)!==null&&r!==void 0?r:[]),h=this._isColumn?d.vertical:d.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((i=a.before.element[this._dimension]())!==null&&i!==void 0?i:0)-(u||s)),this._splitterMaxPosition=((o=a.after.element[this._dimension]())!==null&&o!==void 0?o:0)-(h||s)}_onSplitterDrag(e,t,r){var i=this._isColumn?r:t;this._splitterMaxPosition==null||this._splitterMinPosition==null||i>this._splitterMinPosition&&i<this._splitterMaxPosition&&(this._splitterPosition=i,e.element.css(this._isColumn?"top":"left",i))}_onSplitterDragStop(e){this._applySplitterDragStop(e),this._scheduleSetSize()}_applySplitterDragStop(e){var t,r,i,o,a,s=this._getItemsForSplitter(e),l=(t=s.before.element[this._dimension]())!==null&&t!==void 0?t:0,u=(r=s.after.element[this._dimension]())!==null&&r!==void 0?r:0,d=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+u),h=((o=s.before.config[this._dimension])!==null&&o!==void 0?o:0)+((a=s.after.config[this._dimension])!==null&&a!==void 0?a:0);s.before.config[this._dimension]=d*h,s.after.config[this._dimension]=(1-d)*h,e.element.css({top:0,left:0})}_scheduleSetSize(){Sn(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0)),this._scheduleAncestorIntersectionRefresh()}_scheduleIntersectionRefresh(){Sn(()=>{Sn(this._refreshIntersectionSplitters.bind(this))})}_scheduleAncestorIntersectionRefresh(){for(var e=this.parent;e!=null;)e instanceof Ot&&e._scheduleIntersectionRefresh(),e=e.parent}_createIntersectionSplitters(){this.childElementContainer.css("position","relative");for(var e=new Set,t=0;t<this._splitter.length;t++)for(var r=this.contentItems[t],i=this.contentItems[t+1],o=[...this._collectEdgeStemSplitters(r,!1,"b"),...this._collectEdgeStemSplitters(i,!0,"a")],a=0;a<o.length;a++){var s=o[a],l=t+":"+s.path;e.add(l),this._ensureIntersectionSplitter(l,t,s.stemOwner,s.stemSplitterIndex,s.junctionAtNearEdge)}return e}_collectEdgeStemSplitters(e,t,r){if(!(e instanceof Ot))return[];if(e._isColumn!==this._isColumn){for(var i=[],o=0;o<e._splitter.length;o++)i.push({stemOwner:e,stemSplitterIndex:o,junctionAtNearEdge:t,path:r+":"+o});for(var a=0;a<e.contentItems.length;a++)i.push(...this._collectEdgeStemSplitters(e.contentItems[a],t,r+"."+a));return i}var s=t?0:e.contentItems.length-1;return this._collectEdgeStemSplitters(e.contentItems[s],t,r+"."+s)}_refreshIntersectionSplitters(){var e=this._intersectionSplitter.length,t=this._createIntersectionSplitters();this._intersectionSplitter=this._intersectionSplitter.filter(i=>t.has(i.key)?!0:(i.splitter._$destroy(),!1));for(var r=0;r<this._intersectionSplitter.length;r++)this._positionIntersectionSplitter(this._intersectionSplitter[r]);this._intersectionSplitter.length!==e&&Sn(()=>{for(var i=0;i<this._intersectionSplitter.length;i++)this._positionIntersectionSplitter(this._intersectionSplitter[i])})}_destroyIntersectionSplitters(){for(var e=0;e<this._intersectionSplitter.length;e++)this._intersectionSplitter[e].splitter._$destroy();this._intersectionSplitter=[]}_$destroy(){this._destroyIntersectionSplitters();for(var e=0;e<this._splitter.length;e++)this._splitter[e]._$destroy();this._splitter=[],_e.prototype._$destroy.call(this)}static _isAnyDragInProgress(){return O(document.body).hasClass("lm_dragging")||O(document.body).hasClass("lm_intersection_dragging")}_ensureIntersectionSplitter(e,t,r,i,o){var a=this._intersectionSplitter.find(d=>d.key===e);if(a!=null){a.parentSplitterIndex=t,a.stemOwner=r,a.stemSplitterIndex=i,a.junctionAtNearEdge=o;return}var s=new Zl(this._splitterSize,this._splitterGrabSize),l={splitter:s,key:e,parentSplitterIndex:t,stemOwner:r,stemSplitterIndex:i,junctionAtNearEdge:o};s.on("dragStart",()=>this._onIntersectionSplitterDragStart(l)),s.on("drag",(d,h)=>this._onIntersectionSplitterDrag(l,d,h)),s.on("dragStop",()=>this._onIntersectionSplitterDragStop(l));var u=null;s.element.on("mouseenter",()=>{this._isIntersectionDragging||Ot._isAnyDragInProgress()||(this._setIntersectionHighlight(l,!0),u=this._findNearFourWayPartner(l),u!=null&&this._setIntersectionHighlight(u,!0))}),s.element.on("mouseleave",()=>{this._isIntersectionDragging||O(document.body).hasClass("lm_intersection_dragging")||(this._setIntersectionHighlight(l,!1),u!=null&&(this._setIntersectionHighlight(u,!1),u=null))}),s.element.css({position:"absolute",left:0,top:0,transform:"translate(-50%, -50%)",zIndex:60}),this.childElementContainer.append(s.element),this._intersectionSplitter.push(l)}_positionIntersectionSplitter(e){var t=this._getIntersectionPosition(e);t!=null&&e.splitter.element.css({left:t.left,top:t.top})}_getIntersectionPosition(e){var t,r=this._splitter[e.parentSplitterIndex],i=(t=e.stemOwner)===null||t===void 0?void 0:t._splitter[e.stemSplitterIndex],o=this.childElementContainer[0],a=r==null?void 0:r.element[0],s=i==null?void 0:i.element[0];if(o==null||a==null||s==null)return null;var l=o.getBoundingClientRect(),u=a.getBoundingClientRect(),d=s.getBoundingClientRect(),h=u.left+u.width/2-l.left,p=u.top+u.height/2-l.top,f=d.left+d.width/2-l.left,v=d.top+d.height/2-l.top;return this._isColumn?{left:f,top:p}:{left:h,top:v}}_setIntersectionHighlight(e,t){var r,i=this._splitter[e.parentSplitterIndex],o=(r=e.stemOwner)===null||r===void 0?void 0:r._splitter[e.stemSplitterIndex];i==null||i.element.toggleClass("lm_dragging",t),i==null||i.element.toggleClass("lm_intersection_line",t),o==null||o.element.toggleClass("lm_dragging",t),o==null||o.element.toggleClass("lm_intersection_line",t)}_findNearFourWayPartner(e){var t=this.childElementContainer[0],r=t==null?void 0:t.getBoundingClientRect();if(r==null||r.width===0&&r.height===0)return null;var i=this._getIntersectionPosition(e);if(i==null)return null;for(var o=8,a=null,s=Number.POSITIVE_INFINITY,l=0;l<this._intersectionSplitter.length;l++){var u=this._intersectionSplitter[l];if(!(u.key===e.key||u.parentSplitterIndex!==e.parentSplitterIndex)){var d=this._getIntersectionPosition(u);if(d!=null){var h=Math.abs(d.left-i.left),p=Math.abs(d.top-i.top);if(!(h>o||p>o)){var f=h+p;f<s&&(s=f,a=u)}}}}return a}_setSplitterDragOffset(e,t,r){var i=e._splitterMinPosition,o=e._splitterMaxPosition;if(!(i==null||o==null)){var a=Math.max(i,Math.min(o,r));e._splitterPosition=a,t.element.css(e._isColumn?"top":"left",a)}}_getSplitterAxisCenter(e,t){var r=t.element[0];if(r==null)return null;var i=r.getBoundingClientRect();return e._isColumn?i.top+i.height/2:i.left+i.width/2}_onIntersectionSplitterDragStart(e){var t=this._splitter[e.parentSplitterIndex],r=e.stemOwner._splitter[e.stemSplitterIndex],i=this._findNearFourWayPartner(e),o=i?i.stemOwner._splitter[i.stemSplitterIndex]:null;if(this._onSplitterDragStart(t),e.stemOwner._onSplitterDragStart(r),this._activeFourWaySharedCenterMin=null,this._activeFourWaySharedCenterMax=null,this._activeFourWayBaseCenter=null,this._activeFourWayPartnerBaseCenter=null,i!=null&&o!=null){i.stemOwner._onSplitterDragStart(o);var a=this._getSplitterAxisCenter(e.stemOwner,r),s=this._getSplitterAxisCenter(i.stemOwner,o),l=e.stemOwner._splitterMinPosition,u=e.stemOwner._splitterMaxPosition,d=i.stemOwner._splitterMinPosition,h=i.stemOwner._splitterMaxPosition;if(l!=null&&u!=null&&d!=null&&h!=null&&a!=null&&s!=null){var p=a+l,f=a+u,v=s+d,g=s+h,b=Math.max(p,v),y=Math.min(f,g);b<=y?(this._activeFourWayPartner=i,this._activeFourWaySharedCenterMin=b,this._activeFourWaySharedCenterMax=y,this._activeFourWayBaseCenter=a,this._activeFourWayPartnerBaseCenter=s):this._activeFourWayPartner=null}else this._activeFourWayPartner=null}else this._activeFourWayPartner=null;this._isIntersectionDragging=!0,this._setIntersectionHighlight(e,!0),this._activeFourWayPartner!=null&&this._setIntersectionHighlight(this._activeFourWayPartner,!0),O(document.body).addClass("lm_intersection_dragging")}_onIntersectionSplitterDrag(e,t,r){var i,o,a=this._splitter[e.parentSplitterIndex],s=e.stemOwner._splitter[e.stemSplitterIndex],l=this._activeFourWayPartner,u=l?l.stemOwner._splitter[l.stemSplitterIndex]:null;if(this._onSplitterDrag(a,t,r),l!=null&&u!=null){var d=e.stemOwner._isColumn?r:t,h=this._activeFourWaySharedCenterMin,p=this._activeFourWaySharedCenterMax,f=this._activeFourWayBaseCenter,v=this._activeFourWayPartnerBaseCenter;if(h!=null&&p!=null&&f!=null&&v!=null){var g=f+d,b=Math.max(h,Math.min(p,g));this._setSplitterDragOffset(e.stemOwner,s,b-f),this._setSplitterDragOffset(l.stemOwner,u,b-v)}}else e.stemOwner._onSplitterDrag(s,t,r);var y=(i=this._splitterPosition)!==null&&i!==void 0?i:0,S=(o=e.stemOwner.element[this._dimension]())!==null&&o!==void 0?o:0,C=e.junctionAtNearEdge?S-y:S+y,_=Math.max(this._splitterSize,1),w=Math.max(C,_),D=S>0?w/S:1,F=e.junctionAtNearEdge?this._isColumn?"bottom":"right":this._isColumn?"top":"left";if(s.element.css({"transform-origin":F,transform:this._isColumn?"scaleY(".concat(D,")"):"scaleX(".concat(D,")")}),l!=null&&u!=null){var N,x,j=(N=this._splitterPosition)!==null&&N!==void 0?N:0,L=(x=l.stemOwner.element[this._dimension]())!==null&&x!==void 0?x:0,re=l.junctionAtNearEdge?L-j:L+j,A=Math.max(this._splitterSize,1),X=Math.max(re,A),ie=L>0?X/L:1,oe=l.junctionAtNearEdge?this._isColumn?"bottom":"right":this._isColumn?"top":"left";u.element.css({"transform-origin":oe,transform:this._isColumn?"scaleY(".concat(ie,")"):"scaleX(".concat(ie,")")})}}_onIntersectionSplitterDragStop(e){var t=this._splitter[e.parentSplitterIndex],r=e.stemOwner._splitter[e.stemSplitterIndex],i=this._activeFourWayPartner,o=i?i.stemOwner._splitter[i.stemSplitterIndex]:null;if(this._applySplitterDragStop(t),i!=null&&o!=null&&this._activeFourWaySharedCenterMin!=null&&this._activeFourWaySharedCenterMax!=null&&this._activeFourWayBaseCenter!=null&&this._activeFourWayPartnerBaseCenter!=null){var a,s=(a=e.stemOwner._splitterPosition)!==null&&a!==void 0?a:0,l=this._activeFourWayBaseCenter+s,u=Math.max(this._activeFourWaySharedCenterMin,Math.min(this._activeFourWaySharedCenterMax,l));this._setSplitterDragOffset(e.stemOwner,r,u-this._activeFourWayBaseCenter),this._setSplitterDragOffset(i.stemOwner,o,u-this._activeFourWayPartnerBaseCenter)}e.stemOwner._applySplitterDragStop(r),i!=null&&o!=null&&i.stemOwner._applySplitterDragStop(o),r.element.css({transform:"","transform-origin":""}),o!=null&&o.element.css({transform:"","transform-origin":""}),this._isIntersectionDragging=!1,this._setIntersectionHighlight(e,!1),i!=null&&this._setIntersectionHighlight(i,!1),this._activeFourWayPartner=null,this._activeFourWaySharedCenterMin=null,this._activeFourWaySharedCenterMax=null,this._activeFourWayBaseCenter=null,this._activeFourWayPartnerBaseCenter=null,O(document.body).removeClass("lm_intersection_dragging"),this._scheduleSetSize()}}function oa(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 aa(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?oa(Object(t),!0).forEach(function(r){Ci(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):oa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ci(n,e,t){return(e=Af(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Af(n){var e=kf(n,"string");return typeof e=="symbol"?e:e+""}function kf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class _i extends _e{constructor(e,t,r){super(e,aa(aa({},t),{},{type:"root"}),null,O('<div class="lm_goldenlayout lm_item lm_root"></div>')),Ci(this,"childElementContainer",void 0),Ci(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(Ne(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 i=t.side,o=i==="left"||i==="right"?"row":"column",a=i==="left"||i==="right"?"width":"height",s=i==="left"||i==="top",l=this.contentItems[0];if(!(l instanceof Ot)||l.type!=o){var u=this.layoutManager.createContentItem({type:o},this);this.replaceChild(l,u),u.addChild(e,s?0:void 0,!0),u.addChild(l,s?void 0:0,!0),l.config[a]=50,e.config[a]=50,u.callDownwards("setSize")}else{var d,h=l.contentItems[s?0:l.contentItems.length-1];l.addChild(e,s?0:void 0,!0),h.config[a]=((d=h.config[a])!==null&&d!==void 0?d:0)*.5,e.config[a]=h.config[a],l.callDownwards("setSize")}}}}function Nf(n,e){return Ff(n)||$f(n,e)||Rf(n,e)||Lf()}function Lf(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
12
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rf(n,e){if(n){if(typeof n=="string")return sa(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?sa(n,e):void 0}}function sa(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function $f(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function Ff(n){if(Array.isArray(n))return n}function la(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 hn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?la(Object(t),!0).forEach(function(r){Xe(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):la(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Xe(n,e,t){return(e=Hf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hf(n){var e=Uf(n,"string");return typeof e=="symbol"?e:e+""}function Uf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class wi extends _e{constructor(e,t,r){var i,o,a,s,l,u,d,h,p;super(e,t,r,O('<div class="lm_item lm_stack"></div>')),Xe(this,"_activeContentItem",null),Xe(this,"_header",void 0),Xe(this,"childElementContainer",O('<div class="lm_items"></div>')),Xe(this,"header",void 0),Xe(this,"parent",void 0),Xe(this,"isStack",!0),Xe(this,"_dropSegment",null),Xe(this,"_contentAreaDimensions",null),Xe(this,"_dropIndex",void 0),Xe(this,"_side",void 0),Xe(this,"_sided",!1),Xe(this,"config",void 0),this.parent=r,this.config=t;var f=e.config;this._side=!1,this._header={show:((i=f.settings)===null||i===void 0?void 0:i.hasHeaders)&&t.hasHeaders!==!1,popout:(o=f.settings)!==null&&o!==void 0&&o.showPopoutIcon?(a=f.labels)===null||a===void 0?void 0:a.popout:void 0,maximise:(s=f.settings)!==null&&s!==void 0&&s.showMaximiseIcon?(l=f.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(u=f.settings)!==null&&u!==void 0&&u.showCloseIcon?(d=f.labels)===null||d===void 0?void 0:d.close:void 0,minimise:(h=(p=f.labels)===null||p===void 0?void 0:p.minimise)!==null&&h!==void 0?h:void 0},f.header&&(this._header=hn(hn({},this._header),f.header)),t.header&&(this._header=hn(hn({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=hn(hn({},this._header),t.content[0].header)),this.header=new It(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,r,i,o,a=this._header.show&&(e=(t=this.layoutManager.config.dimensions)===null||t===void 0?void 0:t.headerHeight)!==null&&e!==void 0?e:0,s=((r=this.element.width())!==null&&r!==void 0?r:0)-(this._sided?a:0),l=((i=this.element.height())!==null&&i!==void 0?i:0)-(this._sided?0:a);for(this.childElementContainer.width(s),this.childElementContainer.height(l),o=0;o<this.contentItems.length;o++)this.contentItems[o].element.width(s).height(l);this.emit("resize"),this.emitBubblingEvent("stateChanged")}_$init(){if(this.isInitialised!==!0){this.header._attachWheelListener(),super._$init();for(var e=0;e<this.contentItems.length;e++)this.header.createTab(this.contentItems[e]),this.contentItems[e]._$hide();if(this.contentItems.length>0){var t=this.contentItems[this.config.activeItemIndex||0];if(!t)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(t)}}}setActiveContentItem(e,t){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),Ne(e)?e._$show(t):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(){_e.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",o=this.parent instanceof Ot&&(t&&this.parent.isColumn||r&&this.parent.isRow),a=t?"column":"row",s=t?"height":"width";if(Ne(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(o){var u,d=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?d:d+1,!0),this.config[s]=((u=this.config[s])!==null&&u!==void 0?u:0)*.5,e.config[s]=this.config[s],this.parent.callDownwards("setSize")}else{var h,p=this.layoutManager.createContentItem({type:a},this);(h=this.parent)===null||h===void 0||h.replaceChild(this,p),p.addChild(e,i?0:void 0,!0),p.addChild(this,i?void 0:0,!0),this.config[s]=50,e.config[s]=50,p.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var r of Object.entries(this._contentAreaDimensions)){var i=Nf(r,2),o=i[0],a=i[1],s=a.hoverArea;if(s.x1<e&&s.x2>e&&s.y1<t&&s.y2>t){o==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(o));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,o,a,s,l,u,d,h,p,f,v,g,b,y,S=this.header.tabs.length;if(S===0){var C,_,w,D,F,N,x,j,L=this.header.element.offset();(C=this.layoutManager.dropTargetIndicator)===null||C===void 0||C.highlightArea({x1:(_=L==null?void 0:L.left)!==null&&_!==void 0?_:0,x2:((w=L==null?void 0:L.left)!==null&&w!==void 0?w:0)+100,y1:(D=(F=this.header.element.offset())===null||F===void 0?void 0:F.top)!==null&&D!==void 0?D:0,y2:((N=(x=this.header.element.offset())===null||x===void 0?void 0:x.top)!==null&&N!==void 0?N:0)+((j=this.header.element.innerHeight())!==null&&j!==void 0?j:0)});return}var re=this.header.tabsContainer,A=(t=re.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),X=(r=this.layoutManager.tabDropPlaceholder.get(0))===null||r===void 0?void 0:r.getBoundingClientRect();if(!(!A||!X)){e<A.left?e=A.left+1:e>A.right&&(e=A.right-1);var ie,oe;if(!(X.left<e&&e<X.right)){for(var be=0;be<S;be++){var ye;if(ie=this.header.tabs[be].element,oe=(ye=ie.get(0))===null||ye===void 0?void 0:ye.getBoundingClientRect(),oe&&oe.left<e&&e<oe.right){this._dropIndex=be;break}}if(ie&&oe&&e<oe.left+oe.width*.5)ie.before(this.layoutManager.tabDropPlaceholder);else if(ie){var Oe;this._dropIndex=Math.min(((Oe=this._dropIndex)!==null&&Oe!==void 0?Oe:0)+1,S),ie.after(this.layoutManager.tabDropPlaceholder)}}var we=(i=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&i!==void 0?i:0;we=Math.max(we,(a=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&a!==void 0?a:0);var ce=we+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);ce=Math.min(ce,((u=(d=this.header.tabsContainer.offset())===null||d===void 0?void 0:d.left)!==null&&u!==void 0?u:0)+((h=this.header.tabsContainer.innerWidth())!==null&&h!==void 0?h:0)),(p=this.layoutManager.dropTargetIndicator)===null||p===void 0||p.highlightArea({x1:we,x2:ce,y1:(f=(v=this.header.element.offset())===null||v===void 0?void 0:v.top)!==null&&f!==void 0?f:0,y2:((g=(b=this.header.element.offset())===null||b===void 0?void 0:b.top)!==null&&g!==void 0?g:0)+((y=this.header.element.innerHeight())!==null&&y!==void 0?y: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=(t=this._contentAreaDimensions)===null||t===void 0||(t=t[e])===null||t===void 0?void 0:t.highlightArea;if(r){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(r)}this._dropSegment=e}}const Bf=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:_e,Component:ql,ContentItem:_e,Root:_i,RowOrColumn:Ot,Stack:wi,isComponent:Ne,isRoot:Xl,isStack:nn},Symbol.toStringTag,{value:"Module"}));function Ct(n,e,t){return(e=Wf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wf(n){var e=Kf(n,"string");return typeof e=="symbol"?e:e+""}function Kf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Yn{constructor(e,t){var r;Ct(this,"header",void 0),Ct(this,"contentItem",void 0),Ct(this,"element",O(Yn._template)),Ct(this,"titleElement",void 0),Ct(this,"closeElement",void 0),Ct(this,"isActive",!1),Ct(this,"_layoutManager",void 0),Ct(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 jn(this.element,this._layoutManager.root),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.element.on("mouseup",this._onMouseUp),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),Ne(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.text(e)}setContentItem(e){var t=this.contentItem;this._dragListener&&(t.off("destroy",this._dragListener.destroy,this._dragListener),e.on("destroy",this._dragListener.destroy,this._dragListener)),t.off("titleChanged",this.setTitle,this),e.on("titleChanged",this.setTitle,this),this.contentItem=e,e.tab=this,this.setTitle(e.config.title)}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.element.off("mouseup",this._onMouseUp),this.closeElement.off("click",this._onCloseClick),Ne(this.contentItem)&&this.contentItem.container._contentElement.off(),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 sn(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(e){Ne(this.contentItem)&&(e==null?void 0:e.target)instanceof Element&&this._isInNestedLayout(e.target)||(O(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin"))}_onTabContentFocusOut(){Ne(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&&Ne(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):Ne(this.contentItem)&&!this._isFocusDirectlyInContainer()&&this.contentItem.container._contentElement.focus(),Ne(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(),Ne(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onMouseUp(e){e.button===1&&(e.preventDefault(),e.stopPropagation())}_onCloseMousedown(e){e.stopPropagation()}_isInNestedLayout(e){var t=O(e).closest(".lm_goldenlayout")[0],r=this._layoutManager.root.element[0];return t!=null&&t!==r}_isFocusDirectlyInContainer(){if(!Ne(this.contentItem))return!1;var e=document.activeElement;return e==null||!this.contentItem.container._contentElement[0].contains(e)?!1:!this._isInNestedLayout(e)}}Ct(Yn,"_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 q(n,e,t){return(e=zf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zf(n){var e=Vf(n,"string");return typeof e=="symbol"?e:e+""}function Vf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class It extends Ue{constructor(e,t){var r,i;super(),q(this,"layoutManager",void 0),q(this,"element",O(It._template)),q(this,"tabsContainer",void 0),q(this,"tabDropdownContainer",void 0),q(this,"tabDropdownSearch",void 0),q(this,"tabDropdownList",null),q(this,"controlsContainer",void 0),q(this,"parent",void 0),q(this,"tabs",[]),q(this,"activeContentItem",null),q(this,"closeButton",null),q(this,"tabDropdownButton",null),q(this,"tabNextButton",O(It._nextButtonTemplate)),q(this,"tabPreviousButton",O(It._previousButtonTemplate)),q(this,"holdTimer",null),q(this,"rAF",null),q(this,"CLICK_TIMEOUT",500),q(this,"START_SPEED",.01),q(this,"ACCELERATION",5e-4),q(this,"PADDING",10),q(this,"SCROLL_LEFT","left"),q(this,"SCROLL_RIGHT","right"),q(this,"isDraggingTab",!1),q(this,"isOverflowing",!1),q(this,"isDropdownShown",!1),q(this,"dropdownKeyIndex",0),q(this,"_lastVisibleTabIndex",-1),q(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 Yn(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,o,a=0;a<this.tabs.length;a++)o=this.tabs[a].contentItem===e,this.tabs[a].setActive(o),o===!0&&(this.activeContentItem=e,this.parent.config.activeItemIndex=a);(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,o,a,s;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r:0)>((o=(a=this.tabsContainer.get(0))===null||a===void 0?void 0:a.offsetWidth)!==null&&o!==void 0?o:0)+((s=this.tabsContainer.scrollLeft())!==null&&s!==void 0?s:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT);else{var l=this.tabsContainer.get(0);if(l){var u,d;l.scrollLeft=(u=(d=this.tabsContainer.get(0))===null||d===void 0?void 0:d.scrollWidth)!==null&&u!==void 0?u:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var r,i,o;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r: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:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT);else{var a=this.tabsContainer.get(0);a&&(a.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,o=arguments.length>3?arguments[3]:void 0,a=this.tabsContainer.get(0);if(a){var s=a.getBoundingClientRect();if(e===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(t-i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(e===this.SCROLL_RIGHT){var l,u;if(this.tabsContainer.scrollLeft(t+i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((u=this.tabsContainer.innerWidth())!==null&&u!==void 0?u:0)===a.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((r=this.rAF)!==null&&r!==void 0?r:-1),this.rAF=window.requestAnimationFrame(d=>{var h,p,f=o||d,v=d-f,g=this.START_SPEED*v+.5*this.ACCELERATION*(v*v);g=Math.min(g,(h=(p=this.tabsContainer.get(0))===null||p===void 0?void 0:p.scrollWidth)!==null&&h!==void 0?h:1/0),this._handleScrollRepeat(e,t,g,f)})}}_$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(),O(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,o;if(o=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new Rn(this,o,"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 Rn(this,r,"lm_popout",t)),this._getHeaderSetting("maximise")){i=this.parent.toggleMaximise.bind(this.parent);var a=this._getHeaderSetting("maximise"),s=this._getHeaderSetting("minimise"),l=new Rn(this,a,"lm_maximise",i);this.parent.on("maximised",function(){l.element.attr("title",s??"")}),this.parent.on("minimised",function(){l.element.attr("title",a??"")})}this._isClosable()&&(e=this.parent.remove.bind(this.parent),r=this._getHeaderSetting("close"),this.closeButton=new Rn(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"),O(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"),O(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown()}_handleFilterKeydown(e){if(e.key==="Escape"){this._hideAdditionalTabsDropdown();return}if(this.dropdownKeyIndex===-1)return;if(e.key==="Enter"||e.key===" "){this._hideAdditionalTabsDropdown(),this.tabs[this.dropdownKeyIndex]._onTabClick();return}function t(s,l,u){if(u==null||u.length<2)return-1;for(var d=(s+l+u.length)%u.length;d!==s;){if(u.eq(d).css("display")!=="none")return d;d=(d+l+u.length)%u.length}return s}if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var r,i;e.preventDefault(),(r=this.tabDropdownList)===null||r===void 0||r.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,1,this.tabDropdownList),(i=this.tabDropdownList)===null||i===void 0||i.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}else if(e.key==="ArrowUp"||e.key==="Tab"){var o,a;e.preventDefault(),(o=this.tabDropdownList)===null||o===void 0||o.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,-1,this.tabDropdownList),(a=this.tabDropdownList)===null||a===void 0||a.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(),O(document).off("mousedown",this._hideAdditionalTabsDropdown)))}_updateAdditionalTabsDropdown(){var e,t,r,i;if(this.isDropdownShown&&!(!this.tabDropdownList||this.tabDropdownList.length==0)){var o=(e=(t=this.tabDropdownContainer.get(0))===null||t===void 0?void 0:t.scrollHeight)!==null&&e!==void 0?e:0;if(o!==0){var a=this.tabDropdownContainer[0].getBoundingClientRect(),s=(r=O(window).height())!==null&&r!==void 0?r:0,l=(i=O(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var u=this.tabDropdownButton.element[0].getBoundingClientRect(),d=o<s-u.bottom,h=!d&&u.bottom>s*.6,p=Math.min(u.left+(h?u.width:0),l-a.width-this.PADDING),f=h?Math.max(u.top-o,this.PADDING):u.bottom,v=s-f-this.PADDING;this.tabDropdownContainer.css({"max-height":v,top:f,left:p})}}}}_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()}}}}q(It,"_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(""));q(It,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));q(It,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function Nn(n,e,t){return(e=Gf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gf(n){var e=Xf(n,"string");return typeof e=="symbol"?e:e+""}function Xf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Zl{constructor(e,t){Nn(this,"_size",void 0),Nn(this,"_grabSize",void 0),Nn(this,"_hitAreaSize",void 0),Nn(this,"_dragListener",void 0),Nn(this,"element",void 0),this._size=e,this._grabSize=t<e?e:t,this._hitAreaSize=Math.max(this._grabSize,14),this.element=this._createElement(),this._dragListener=new jn(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=O('<div class="lm_drag_handle"></div>'),t=O('<div class="lm_intersection_splitter"></div>');return t.append(e),t.css({width:this._hitAreaSize,height:this._hitAreaSize}),t.on("mousedown touchstart",r=>{r.stopPropagation()}),t}}function Ln(n,e,t){return(e=qf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qf(n){var e=Zf(n,"string");return typeof e=="symbol"?e:e+""}function Zf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Yl{constructor(e,t,r){Ln(this,"_isVertical",void 0),Ln(this,"_size",void 0),Ln(this,"_grabSize",void 0),Ln(this,"_dragListener",void 0),Ln(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=r<t?t:r,this.element=this._createElement(),this._dragListener=new jn(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=O('<div class="lm_drag_handle"></div>'),t=O('<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 Yf=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:Kl,DragProxy:sn,DragSource:zl,DragSourceFromEvent:Vl,DropTargetIndicator:Zn,Header:It,HeaderButton:Rn,IntersectionSplitter:Zl,Splitter:Yl,Tab:Yn},Symbol.toStringTag,{value:"Module"}));var Jf={config:kp,container:Fp,controls:Yf,errors:vf,items:Bf,utils:Qp};function ua(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function We(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ua(Object(t),!0).forEach(function(r){Y(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ua(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Y(n,e,t){return(e=Qf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Qf(n){var e=ev(n,"string");return typeof e=="symbol"?e:e+""}function ev(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var da=["column","row","stack","component"];class Ri extends Ue{static isLayoutItemConfig(e){return da.includes(e.type)}static minifyConfig(e){return Ni(e)}static unminifyConfig(e){return yi(e)}constructor(e,t){super(),Y(this,"isInitialised",!1),Y(this,"_isFullPage",!1),Y(this,"_resizeTimeoutId",void 0),Y(this,"_components",{"lm-react-component":$l}),Y(this,"_fallbackComponent",void 0),Y(this,"_itemAreas",[]),Y(this,"_maximisedItem",null),Y(this,"_maximisePlaceholder",O('<div class="lm_maximise_place"></div>')),Y(this,"_creationTimeoutPassed",!1),Y(this,"_subWindowsCreated",!1),Y(this,"_dragSources",[]),Y(this,"_updatingColumnsResponsive",!1),Y(this,"_firstLoad",!0),Y(this,"_reactChildMap",new Map),Y(this,"_reactChildren",null),Y(this,"_initialHeaderHeight",void 0),Y(this,"width",null),Y(this,"height",null),Y(this,"root",void 0),Y(this,"openPopouts",[]),Y(this,"selectedItem",null),Y(this,"isSubWindow",!1),Y(this,"eventHub",new Fl(this)),Y(this,"config",void 0),Y(this,"container",void 0),Y(this,"_originalContainer",void 0),Y(this,"dropTargetIndicator",null),Y(this,"tabDropPlaceholder",O('<div class="lm_drop_tab_placeholder"></div>')),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._windowKeydown=this._windowKeydown.bind(this),this.config=this._createConfig(e),this._originalContainer=t,this.container=this._getContainer(),this._initialHeaderHeight=this.config.dimensions.headerHeight,this.isSubWindow&&O("body").css("visibility","hidden")}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 _e))throw new Error("Root must be a ContentItem");var t={settings:We({},this.config.settings),dimensions:We({},this.config.dimensions),labels:We({},this.config.labels),content:[]},r=function(a,s){for(var l in s.config)l!=="content"&&(a[l]=s.config[l]);if(a.componentName==="lm-react-component"&&(a.type="react-component"),s.contentItems.length){a.content=[];for(var u=0;u<s.contentItems.length;u++)a.content[u]={},r(a.content[u],s.contentItems[u])}};e?r(t,{contentItems:[e]}):r(t,this.root),this._$reconcilePopoutWindows(),t.openPopouts=[];for(var i=0;i<this.openPopouts.length;i++)t.openPopouts.push(this.openPopouts[i].toConfig());return t.maximisedItemId=this._maximisedItem?"__glMaximised":void 0,t}getComponent(e){return this._components[e]}getFallbackComponent(){return this._fallbackComponent}init(){if(this._subWindowsCreated===!1&&(this._createSubWindows(),this._subWindowsCreated=!0),document.readyState==="loading"||document.body===null){O(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 Zn,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}enableHeaders(){this.config.settings.hasHeaders=!0,this.config.dimensions.headerHeight=this._initialHeaderHeight,this._findAllStackContainers().forEach(e=>{e._header.show=!0,e.header.element.toggle(!0)}),this.updateSize()}disableHeaders(){this.config.settings.hasHeaders=!1,this.config.dimensions.headerHeight=0,this._findAllStackContainers().forEach(e=>{e._header.show=!1,e.header.element.toggle(!1)}),this.updateSize()}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 o,a;this._maximisedItem.element.width((o=this.container.width())!==null&&o!==void 0?o:0),this._maximisedItem.element.height((a=this.container.height())!==null&&a!==void 0?a:0),this._maximisedItem.callDownwards("setSize")}this._adjustColumnsResponsive()}}destroy(){var e;this.isInitialised===!1||!this.root||(this._onUnload(),O(window).off("resize",this._onResize),O(window).off("unload beforeunload",this._onUnload),O(window).off("blur.lm").off("focus.lm"),O(window).off("keydown",this._windowKeydown),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 en("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!Ri.isLayoutItemConfig(e))throw i="Unknown type '"+e.type+"'. Valid types are "+da.join(","),new en(i);return e.type==="component"&&!(t instanceof wi)&&t&&!(this.isSubWindow===!0&&t instanceof _i)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),e.id=(r=e.id)!==null&&r!==void 0?r:Er(),e.type==="stack"?new wi(this,e,t):e.type==="row"?new Ot(!1,this,e,t):e.type==="column"?new Ot(!0,this,e,t):new ql(this,e,t)}createPopout(e,t,r,i){var o=[],a=e instanceof _e,s=this;if(a){var l;o=this.toConfig(e).content,r=Er();for(var u=e.parent,d=e;((h=u)===null||h===void 0?void 0:h.contentItems.length)===1&&!u.isRoot;){var h;d=u,u=u.parent}if((l=u)===null||l===void 0||l.addId(r),i==null||Number.isNaN(i)){var p;i=(p=u)===null||p===void 0?void 0:p.contentItems.indexOf(d)}}else e instanceof Array?o=e:o=[e];if(!t&&a){var f,v,g,b=window.screenX||window.screenLeft,y=window.screenY||window.screenTop,S=(f=e.element.offset())!==null&&f!==void 0?f:{left:0,top:0};t={left:b+S.left,top:y+S.top,width:(v=e.element.width())!==null&&v!==void 0?v:0,height:(g=e.element.height())!==null&&g!==void 0?g:0}}if(!t&&!a&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),a&&e.remove(),!(!t||!r||i===void 0)){var C=new Kl(o,t,r,i,this);return C.on("initialised",function(){s.emit("windowOpened",C)}),C.on("closed",function(){s._$reconcilePopoutWindows()}),this.openPopouts.push(C),C}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var r=new zl(e,t,this);return this._dragSources.push(r),r}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new Vl(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,o=0;o<this._itemAreas.length;o++){var a=this._itemAreas[o];e>a.x1&&e<a.x2&&t>a.y1&&t<a.y2&&r>a.surface&&(r=a.surface,i=a)}return i}_$createRootItemAreas(){var e=50,t=We({},this.root._$getArea()),r=[We(We({},t),{},{side:"left",x2:t.x1+e}),We(We({},t),{},{side:"right",x1:t.x2-e}),We(We({},t),{},{side:"top",y2:t.y1+e}),We(We({},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(nn(r)){var i=r._$getArea();if(i!==null)if(i instanceof Array)this._itemAreas=this._itemAreas.concat(i);else{var o;this._itemAreas.push(i);var a=We(We({},i),(o=i.contentItem._contentAreaDimensions)===null||o===void 0?void 0:o.header.highlightArea);a.surface=(a.x2-a.x1)*(a.y2-a.y1),this._itemAreas.push(a)}}}}_$normalizeContentItem(e,t){if(!e)throw new Error("No content item defined");if(typeof e=="function"&&(e=e()),e instanceof _e)return e;if(O.isPlainObject(e)&&e.type){var r=this.createContentItem(e,t??null);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&&O(window).resize(this._onResize),O(window).on("unload beforeunload",this._onUnload).on("blur.lm",this._windowBlur).on("focus.lm",this._windowFocus).on("keydown",this._windowKeydown)}_windowBlur(){this.root.element.addClass("lm_window_blur")}_windowFocus(){this.root.element.removeClass("lm_window_blur")}_windowKeydown(e){if(e.key==="Escape"&&this._maximisedItem!==null){var t=document.activeElement;if(t&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT"||t.isContentEditable))return;this._maximisedItem.toggleMaximise()}}_onResize(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(this.updateSize.bind(this),100)}_createConfig(e){var t,r=Rl("gl-window");r&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(r)||"{}"),e=yi(e),localStorage.removeItem(r));var i=O.extend(!0,{},Al,e),o=function(s){for(var l in s){var u=s[l];l!=="props"&&typeof u=="object"&&u!=null?o(u):l==="type"&&u==="react-component"&&(s.type="component",s.componentName="lm-react-component")}};return o(i),((t=i.settings)===null||t===void 0?void 0:t.hasHeaders)===!1&&(i.dimensions.headerHeight=0),i}_adjustToWindowMode(){var e,t=O('<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=ki((e=this.config.content[0].title)!==null&&e!==void 0?e:""),O("head").append(O("body link, body style, template, .gl_keep")),this.container=O("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?O(this._originalContainer):O("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,O("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 en(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new en(t,e);this.root=new _i(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),o=e-i,a=this.root.contentItems[0],s=this._findAllStackContainers()[0],l=0;l<o;l++){var u=a.contentItems[a.contentItems.length-1];this._addChildContentItemsToContainer(s,u)}this._updatingColumnsResponsive=!1}}}_useResponsiveLayout(){return this.config.settings&&(this.config.settings.responsiveMode=="always"||this.config.settings.responsiveMode=="onload"&&this._firstLoad)}_addChildContentItemsToContainer(e,t){t.type==="stack"?t.contentItems.forEach(function(r){e.addChild(r),t.removeChild(r,!0)}):t.contentItems.forEach(r=>{this._addChildContentItemsToContainer(e,r)})}_findAllStackContainers(){var e=[];return this._findAllStackContainersRecursive(e,this.root),e}_findAllStackContainersRecursive(e,t){t.contentItems.forEach(r=>{nn(r)?e.push(r):r.isComponent||this._findAllStackContainersRecursive(e,r)})}}Y(Ri,"__lm",Jf);const ca={"tab-height":"28px","drag-border-width":"5px"},ha=Object.freeze({tabHeight:parseInt(ca["tab-height"],10),dragBorderWidth:parseInt(ca["drag-border-width"],10)});function ma(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function yt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ma(Object(t),!0).forEach(function(r){Jl(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ma(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Jl(n,e,t){return(e=tv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tv(n){var e=nv(n,"string");return typeof e=="symbol"?e:e+""}function nv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var kt=B.module("LayoutUtils");function Ql(n){return n.componentName!==void 0}function $t(n){var e=n;return(Ql(n)&&n.componentName==="lm-react-component"||n.type==="react-component")&&e.component!==void 0}function hr(n){return n.focus!==void 0}function pa(n){return n.type==="stack"}class T{static activateTab(e,t){var r=T.getStackForRoot(e,t,!1);if(!r){kt.error("Could not find stack for config",t);return}var i=T.getContentItemInStack(r,t);i&&r.setActiveContentItem(i)}static isActiveTab(e,t){var r=T.getStackForRoot(e,t,!1);if(!r)return kt.error("Could not find stack for config",t),!1;var i=T.getContentItemInStack(r,t),o=r.getActiveContentItem();return o===i}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(Xl(e)){var r={type:t?"column":"row"};(e.contentItems==null||e.contentItems.length===0)&&e.addChild(r);var i=e.contentItems[0],o=t?i.isColumn:i.isRow;if(!o){e.removeChild(i,!0),e.addChild(r);var a=document.activeElement;e.contentItems[0].addChild(i),a&&a.focus!=null&&a.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var s=e.contentItems[e.contentItems.length-1],l=t?s.isRow:s.isColumn;if(!l){var u,d,h=e.layoutManager.createContentItem({type:t?"row":"column",height:(u=s.config)===null||u===void 0?void 0:u.height,width:(d=s.config)===null||d===void 0?void 0:d.width},e);e.replaceChild(s,h),e.contentItems[e.contentItems.length-1].addChild(s),s=e.contentItems[e.contentItems.length-1]}return this.addStack(s,!t)}static getAllStackContainers(e){return e._findAllStackContainers()}static getFocusedStackIndex(e){return e.findIndex(t=>t.header.tabs.some(r=>r.element[0].classList.contains("lm_focusin")))}static getFocusedStack(e){var t=T.getAllStackContainers(e),r=T.getFocusedStackIndex(t);return t[r]}static getStackById(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(i&&nn(e)&&e.contentItems.length===0)return e;if(t===((r=e.config)===null||r===void 0?void 0:r.id)){if(nn(e))return e;throw new Error("Item with ID ".concat(t," is not a stack"))}if(e.contentItems==null)return null;for(var o=0;o<e.contentItems.length;o+=1){var a=this.getStackById(e.contentItems[o],t,i);if(a)return a}return null}static getContentItemById(e,t){var r;if(((r=e.config)===null||r===void 0?void 0:r.id)===t)return e;if(e.contentItems==null)return null;for(var i=0;i<e.contentItems.length;i+=1){var o=this.getContentItemById(e.contentItems[i],t);if(o)return o}return null}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&&nn(e)&&e.contentItems.length===0)return e;if(e.contentItems==null)return null;for(var i=0;i<e.contentItems.length;i+=1){var o=e.contentItems[i];if(o.isComponent&&o.config!=null&&io(o.config,t))return e;var a=this.getStackForConfig(o,t,r);if(a)return a}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,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=this.getStackForConfig(e,t);return!a&&i&&(a=this.getStackForConfig(e,{component:t.component},o)),!a&&r&&(a=this.addStack(e)),a}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,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=0;a<t.length;a+=1){var s=t[a],l=a===t.length-1,u=T.getStackForRoot(e,{component:s},r&&l,i,o);if(u)return u}return null}static getContentItemInStack(e,t){if(!e)return null;for(var r=0;r<e.contentItems.length;r+=1){var i=e.contentItems[r];if(i.isComponent&&i.config!=null&&io(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 o=e[i],a=o.content;if($t(o)){var s=t(o.component,o);s!=null?r.push(s):kt.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(o.component,'"'))}else if(a){var l=yt(yt({},o),{},{content:T.dehydrateLayoutConfig(a,t)});r.push(l)}else r.push(o)}return r}static getTabPoint(e){var t=e.tab;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],i=r.content;i!==void 0?(pa(r)&&delete r.activeItemIndex,T.dropLayoutMinorChange(i)):$t(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=T.cloneLayout(e),o=T.cloneLayout(t);return r?(T.dropLayoutMinorChange(i),T.dropLayoutMinorChange(o),li(i,o)):li(i,o)}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 o=e[i];if($t(o)){var a,s=o.component,l=o.props,u=l===void 0?{}:l;r.push(yt(yt({},o),{},{id:(a=o==null?void 0:o.id)!==null&&a!==void 0?a:Pt(),props:t(s,u)}))}else if(o.content!==void 0){var d=T.hydrateLayoutConfig(o.content,t);pa(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=d.length&&(kt.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),r.push(yt(yt({},o),{},{content:d}))}else r.push(o)}return r}static openComponent(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.root,r=e.config,i=e.stack,o=i===void 0?void 0:i,a=e.replaceExisting,s=a===void 0?!0:a,l=e.replaceConfig,u=l===void 0?void 0:l,d=e.createNewStack,h=d===void 0?!1:d,p=e.focusElement,f=p===void 0?void 0:p,v=e.dragEvent,g=v===void 0?void 0:v,b=document.activeElement,y=yt({},r);if(y.id==null&&(y.id=Pt()),g!=null){t==null||t.layoutManager.createDragSourceFromEvent(y,g);return}var S=u||{id:y.id,component:y.component};W(t);var C=o??(h?T.addStack(t):T.getStackForRoot(t,S));W(C);var _=T.getContentItemInStack(C,S);if(f!=null){var w=F=>{kt.debug("Component created, focusing element",f),C.off("componentCreated",w);var N=F.origin.element;requestAnimationFrame(()=>{T.focusElement(N[0],f)})};C.on("componentCreated",w)}if(s&&_){var D=C.contentItems.indexOf(_);C.addChild(y,D+1),C.removeChild(_),C.setActiveContentItem(C.contentItems[D])}else C.addChild(y);f==null&&b&&hr(b)&&b.focus()}static openComponentInStack(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=document.activeElement,o={id:t.id},a=T.getContentItemInStack(e,o);if(r&&a&&e){var s=e==null?void 0:e.contentItems.indexOf(a);e.addChild(t,s+1),e.removeChild(a),e.setActiveContentItem(e.contentItems[s])}else e==null||e.addChild(t);i&&hr(i)&&i.focus()}static closeComponent(e,t,r){var i=T.getStackForRoot(e,t,!1,!1,!1);if(!i){kt.warn("Cannot find stack for component, ignoring close",t);return}var o=T.getContentItemInStack(i,t),a=document.activeElement;o&&(Ne(o)?o.container.close(r):i.removeChild(o)),a&&document.contains(a)&&hr(a)&&a.focus()}static renameComponent(e,t,r){var i=T.getStackForRoot(e,t,!1);if(!i){kt.error("Could not find stack for config",t);return}var o=T.getContentItemInStack(i,t);o&&o.setTitle(r)}static cloneComponent(e,t){var r=T.getStackForRoot(e,t,!1);if(!r)return kt.error("Could not find stack for config",t),null;var i=t.props,o=i===void 0?{}:i,a=T.getPanelComponentState(t),s={type:"react-component",component:t.component,props:yt(yt({},o),{},{panelState:a}),title:"".concat(t.title," Copy"),id:Pt()};return T.openComponentInStack(r,s),s}static getPanelComponentState(e){if(Ql(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if($t(e)){var r;return(r=e.props)===null||r===void 0?void 0:r.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:ha.tabHeight,borderWidth:ha.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=T.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var t=e.props.glContainer;return T.getIdFromContainer(t)}static getComponentNameFromPanel(e){var t=e.props.glContainer,r=T.getComponentConfigFromContainer(t);if(r&&$t(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]:T.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var r=e.querySelector(t);return r==null?null:(hr(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)})}}Jl(T,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var rv=k.forwardRef((n,e)=>{var t=T.getComponentNameFromPanel({props:n});return c.jsx("div",{ref:e,className:"panel-placeholder",children:c.jsxs("div",{children:['Component "',t,'" is not registered.']})})});rv.displayName="PanelPlaceholder";var ee=Object.freeze({FOCUS:"PanelEvent.FOCUS",MOUNT:"PanelEvent.MOUNT",UNMOUNT:"PanelEvent.UNMOUNT",TITLE_CHANGED:"PanelEvent.TITLE_CHANGED",REOPEN:"PanelEvent.REOPEN",REOPEN_LAST:"PanelEvent.REOPEN_LAST",DELETE:"PanelEvent.DELETE",CLONED:"PanelEvent.CLONED",CLOSED:"PanelEvent.CLOSED",OPEN:"PanelEvent.OPEN",CLOSE:"PanelEvent.CLOSE",DRAGGING:"PanelEvent.DRAGGING",DROPPED:"PanelEvent.DROPPED"}),$i=mt(ee.OPEN),aC=$i.listen,iv=$i.emit,sC=$i.useListener,Fi=mt(ee.CLOSE),lC=Fi.listen,fa=Fi.emit,uC=Fi.useListener,Fr=Object.freeze({CYCLE_TO_NEXT_STACK:"NavigationEvent.CYCLE_TO_NEXT_STACK",CYCLE_TO_PREVIOUS_STACK:"NavigationEvent.CYCLE_TO_PREVIOUS_STACK",CYCLE_TO_NEXT_TAB:"NavigationEvent.CYCLE_TO_NEXT_TAB",CYCLE_TO_PREVIOUS_TAB:"NavigationEvent.CYCLE_TO_PREVIOUS_TAB"}),Hi=mt(Fr.CYCLE_TO_NEXT_STACK),ov=Hi.listen,dC=Hi.emit,cC=Hi.useListener,Ui=mt(Fr.CYCLE_TO_PREVIOUS_STACK),av=Ui.listen,hC=Ui.emit,mC=Ui.useListener,Bi=mt(Fr.CYCLE_TO_NEXT_TAB),sv=Bi.listen,pC=Bi.emit,fC=Bi.useListener,Wi=mt(Fr.CYCLE_TO_PREVIOUS_TAB),lv=Wi.listen,vC=Wi.emit,gC=Wi.useListener;function va(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 ga(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?va(Object(t),!0).forEach(function(r){wt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):va(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function wt(n,e,t){return(e=uv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function uv(n){var e=dv(n,"string");return typeof e=="symbol"?e:e+""}function dv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Qe=B.module("PanelManager"),Yt=function(n){return n[n.Next=0]="Next",n[n.Previous=1]="Previous",n}(Yt||{});class eu{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(s,l)=>l,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(s,l)=>l,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:new Map,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:()=>{};wt(this,"layout",void 0),wt(this,"hydrateComponent",void 0),wt(this,"dehydrateComponent",void 0),wt(this,"onPanelsUpdated",void 0),wt(this,"closed",void 0),wt(this,"openedMap",void 0),wt(this,"navigationEventListenerRemovers",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.handleReopenLast=this.handleReopenLast.bind(this),this.handleCycleToNextStack=this.handleCycleToNextStack.bind(this),this.handleCycleToPreviousStack=this.handleCycleToPreviousStack.bind(this),this.handleCycleToNextTab=this.handleCycleToNextTab.bind(this),this.handleCycleToPreviousTab=this.handleCycleToPreviousTab.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=a,this.openedMap=new Map(i),this.closed=[...o],this.navigationEventListenerRemovers=[],this.startListening()}startListening(){var e=this.layout.eventHub;e.on(ee.FOCUS,this.handleFocus),e.on(ee.MOUNT,this.handleMount),e.on(ee.UNMOUNT,this.handleUnmount),e.on(ee.REOPEN,this.handleReopen),e.on(ee.REOPEN_LAST,this.handleReopenLast),e.on(ee.DELETE,this.handleDeleted),e.on(ee.CLOSED,this.handleClosed),e.on(ee.CLOSE,this.handleControlClose),this.navigationEventListenerRemovers.push(ov(e,this.handleCycleToNextStack)),this.navigationEventListenerRemovers.push(av(e,this.handleCycleToPreviousStack)),this.navigationEventListenerRemovers.push(sv(e,this.handleCycleToNextTab)),this.navigationEventListenerRemovers.push(lv(e,this.handleCycleToPreviousTab))}stopListening(){var e=this.layout.eventHub;e.off(ee.FOCUS,this.handleFocus),e.off(ee.MOUNT,this.handleMount),e.off(ee.UNMOUNT,this.handleUnmount),e.off(ee.REOPEN,this.handleReopen),e.off(ee.REOPEN_LAST,this.handleReopenLast),e.off(ee.DELETE,this.handleDeleted),e.off(ee.CLOSED,this.handleClosed),e.off(ee.CLOSE,this.handleControlClose),this.navigationEventListenerRemovers.forEach(t=>t()),this.navigationEventListenerRemovers=[]}getClosedPanelConfigsOfType(e){return this.closed.filter(t=>t.component===e)}getOpenedPanels(){return Array.from(this.openedMap.values())}getOpenedPanelConfigs(){return this.getOpenedPanels().map(e=>{var t=e.props.glContainer;return T.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&$t(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,r=T.getStackForConfig(this.layout.root,{id:e});return(t=r&&T.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=>wr(r)&&t instanceof r.WrappedComponent||!wr(r)&&t instanceof r))}updatePanel(e){var t=T.getIdFromPanel(e);if(t==null){Qe.error("updatePanel Panel did not have an ID",e);return}Qe.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=T.getIdFromPanel(e);if(t==null){Qe.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){Qe.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){Qe.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}Qe.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){Qe.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){Qe.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){Qe.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}cycleStack(e){var t=T.getAllStackContainers(this.layout);if(!(t.length<=1)){var r=T.getFocusedStackIndex(t);if(r===-1){var i=t[0],o=i.config.activeItemIndex,a=o!=null?i.contentItems[o]:i.contentItems[0];i.setActiveContentItem(a,!0);return}var s=e===Yt.Next?(r+1)%t.length:(r-1+t.length)%t.length,l=t[s],u=l.config.activeItemIndex,d=u!=null?l.contentItems[u]:l.contentItems[0];l.setActiveContentItem(d,!0)}}handleCycleToNextStack(){this.cycleStack(Yt.Next)}handleCycleToPreviousStack(){this.cycleStack(Yt.Previous)}cycleTab(e){var t,r=T.getFocusedStack(this.layout);if(r!==void 0){var i=r.contentItems;if(!(i.length<=1)){var o=(t=r.config.activeItemIndex)!==null&&t!==void 0?t:0,a=e===Yt.Next?(o+1)%i.length:(o-1+i.length)%i.length,s=i[a];r.setActiveContentItem(s,!0)}}}handleCycleToNextTab(){this.cycleTab(Yt.Next)}handleCycleToPreviousTab(){this.cycleTab(Yt.Previous)}handleReopen(e,t){Qe.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var r=e.component,i=e.props;i=this.hydrateComponent(r,i);var o=ga(ga({},e),{},{props:i}),a=this.layout.root,s=e.parentStackId===void 0?void 0:T.getStackById(a,e.parentStackId);T.openComponent({root:a,config:o,replaceConfig:t,stack:s??void 0})}handleReopenLast(e){var t;if(this.closed.length!==0){if(e===void 0){this.handleReopen(this.closed[this.closed.length-1]);return}for(var r=(t=T.getStackForConfig(this.layout.root,e.getConfig()))===null||t===void 0?void 0:t.config.id,i=this.closed.length-1;i>=0;i-=1){var o=this.closed[i];if(o.parentStackId===r){this.handleReopen(o);return}}}}handleDeleted(e){Qe.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){Qe.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},r=this.layout.root;T.closeComponent(r,t)}addClosedPanel(e){var t=T.getComponentConfigFromContainer(e);if(t&&$t(t)){var r=this.dehydrateComponent(t.component,t);if(r!=null){var i;r.parentStackId=(i=e.tab)===null||i===void 0?void 0:i.header.parent.config.id,this.closed.push(r)}}}sendUpdate(){var e=this.closed,t=this.openedMap;this.onPanelsUpdated({closed:[...e],openedMap:new Map(t)})}}wt(eu,"MAX_CLOSED_PANEL_COUNT",100);var cv=B.module("PanelErrorBoundary");class hv extends m.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}componentWillUnmount(){var e=this.props,t=e.glContainer,r=e.glEventHub,i=T.getIdFromContainer(t);cv.debug("componentWillUnmount",i),r.emit(ee.CLOSED,i,t)}render(){var e=this.props.children,t=this.state.error;return t!=null?c.jsx("div",{className:"panel-error-boundary",children:c.jsx(Kn,{"data-testid":"panel-error-boundary-loading-error",errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e??null}}function ba(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 Tr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ba(Object(t),!0).forEach(function(r){mv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ba(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function mv(n,e,t){return(e=pv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pv(n){var e=fv(n,"string");return typeof e=="symbol"?e:e+""}function fv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function tu(n){var e=n.props,t=n.componentState,r=e.metadata,i=e.panelState,o=i===void 0?null:i;t&&(o=t.panelState);var a={};return r!=null&&(a.metadata=r),o!=null&&(a.panelState=o),Tr(Tr({},n),{},{componentState:null,props:a,type:"react-component"})}function nu(n,e){return Tr(Tr({},n),{},{localDashboardId:e})}const bC={dehydrate:tu,hydrate:nu};var ru=k.createContext(void 0);ru.displayName="LayoutManagerContext";var vv=pe.shape({on:pe.func,off:pe.func,isHidden:pe.bool,tab:pe.shape({header:pe.shape({tabs:pe.arrayOf(pe.shape({contentItem:pe.shape({})}))})}),title:pe.string,setTitle:pe.func,close:pe.func}),iu=pe.shape({on:pe.func,off:pe.func,emit:pe.func}),gv=pe.shape({registerComponent:pe.func,root:pe.shape({addChild:pe.func}),on:pe.func,off:pe.func,eventHub:iu}),yC=Object.freeze({Container:vv,EventHub:iu,Layout:gv});function mn(n,e,t){m.useEffect(function(){return n.on(e,t),()=>{n.off(e,t)}},[n,e,t])}var ou="SET_DASHBOARD_DATA";const bv=rp(ou,{},!1),yv={dashboardData:bv};var Sv=new Map,au=Object.freeze({}),Cv=Object.freeze([]),SC=Vs,CC=Gs,_C=xd,_v=n=>n.dashboardData,De=(n,e)=>{var t;return(t=_v(n)[e])!==null&&t!==void 0?t:au},wC=(n,e)=>{var t;return(t=De(n,e).closed)!==null&&t!==void 0?t:Cv},EC=(n,e)=>{var t;return(t=De(n,e).openedMap)!==null&&t!==void 0?t:Sv},su=(n,e)=>{var t;return(t=De(n,e).pluginDataMap)!==null&&t!==void 0?t:au},PC=(n,e,t)=>su(n,e)[t];function ya(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 Cn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ya(Object(t),!0).forEach(function(r){wv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ya(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function wv(n,e,t){return(e=Ev(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ev(n){var e=Pv(n,"string");return typeof e=="symbol"?e:e+""}function Pv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var lu=(n,e)=>({type:ou,id:n,payload:e}),Tv=(n,e)=>(t,r)=>t(lu(n,Cn(Cn({},De(r(),n)),e))),TC=(n,e,t)=>(r,i)=>r(lu(n,Cn(Cn({},De(i(),n)),{},{pluginDataMap:Cn(Cn({},su(i(),n)),{},{[e]:t})})));function Ov(n,e){return Mv(n)||Dv(n,e)||xv(n,e)||Iv()}function Iv(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
12
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rf(n,e){if(n){if(typeof n=="string")return sa(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?sa(n,e):void 0}}function sa(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function $f(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function Ff(n){if(Array.isArray(n))return n}function la(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 hn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?la(Object(t),!0).forEach(function(r){qe(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):la(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function qe(n,e,t){return(e=Hf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hf(n){var e=Uf(n,"string");return typeof e=="symbol"?e:e+""}function Uf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class wi extends _e{constructor(e,t,r){var i,o,a,s,l,u,d,h,p;super(e,t,r,O('<div class="lm_item lm_stack"></div>')),qe(this,"_activeContentItem",null),qe(this,"_header",void 0),qe(this,"childElementContainer",O('<div class="lm_items"></div>')),qe(this,"header",void 0),qe(this,"parent",void 0),qe(this,"isStack",!0),qe(this,"_dropSegment",null),qe(this,"_contentAreaDimensions",null),qe(this,"_dropIndex",void 0),qe(this,"_side",void 0),qe(this,"_sided",!1),qe(this,"config",void 0),this.parent=r,this.config=t;var f=e.config;this._side=!1,this._header={show:((i=f.settings)===null||i===void 0?void 0:i.hasHeaders)&&t.hasHeaders!==!1,popout:(o=f.settings)!==null&&o!==void 0&&o.showPopoutIcon?(a=f.labels)===null||a===void 0?void 0:a.popout:void 0,maximise:(s=f.settings)!==null&&s!==void 0&&s.showMaximiseIcon?(l=f.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(u=f.settings)!==null&&u!==void 0&&u.showCloseIcon?(d=f.labels)===null||d===void 0?void 0:d.close:void 0,minimise:(h=(p=f.labels)===null||p===void 0?void 0:p.minimise)!==null&&h!==void 0?h:void 0},f.header&&(this._header=hn(hn({},this._header),f.header)),t.header&&(this._header=hn(hn({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=hn(hn({},this._header),t.content[0].header)),this.header=new It(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,r,i,o,a=this._header.show&&(e=(t=this.layoutManager.config.dimensions)===null||t===void 0?void 0:t.headerHeight)!==null&&e!==void 0?e:0,s=((r=this.element.width())!==null&&r!==void 0?r:0)-(this._sided?a:0),l=((i=this.element.height())!==null&&i!==void 0?i:0)-(this._sided?0:a);for(this.childElementContainer.width(s),this.childElementContainer.height(l),o=0;o<this.contentItems.length;o++)this.contentItems[o].element.width(s).height(l);this.emit("resize"),this.emitBubblingEvent("stateChanged")}_$init(){if(this.isInitialised!==!0){this.header._attachWheelListener(),super._$init();for(var e=0;e<this.contentItems.length;e++)this.header.createTab(this.contentItems[e]),this.contentItems[e]._$hide();if(this.contentItems.length>0){var t=this.contentItems[this.config.activeItemIndex||0];if(!t)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(t)}}}setActiveContentItem(e,t){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),Ne(e)?e._$show(t):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(){_e.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",o=this.parent instanceof Ot&&(t&&this.parent.isColumn||r&&this.parent.isRow),a=t?"column":"row",s=t?"height":"width";if(Ne(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(o){var u,d=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?d:d+1,!0),this.config[s]=((u=this.config[s])!==null&&u!==void 0?u:0)*.5,e.config[s]=this.config[s],this.parent.callDownwards("setSize")}else{var h,p=this.layoutManager.createContentItem({type:a},this);(h=this.parent)===null||h===void 0||h.replaceChild(this,p),p.addChild(e,i?0:void 0,!0),p.addChild(this,i?void 0:0,!0),this.config[s]=50,e.config[s]=50,p.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var r of Object.entries(this._contentAreaDimensions)){var i=Nf(r,2),o=i[0],a=i[1],s=a.hoverArea;if(s.x1<e&&s.x2>e&&s.y1<t&&s.y2>t){o==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(o));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,o,a,s,l,u,d,h,p,f,v,g,b,y,S=this.header.tabs.length;if(S===0){var C,_,w,D,F,N,x,j,L=this.header.element.offset();(C=this.layoutManager.dropTargetIndicator)===null||C===void 0||C.highlightArea({x1:(_=L==null?void 0:L.left)!==null&&_!==void 0?_:0,x2:((w=L==null?void 0:L.left)!==null&&w!==void 0?w:0)+100,y1:(D=(F=this.header.element.offset())===null||F===void 0?void 0:F.top)!==null&&D!==void 0?D:0,y2:((N=(x=this.header.element.offset())===null||x===void 0?void 0:x.top)!==null&&N!==void 0?N:0)+((j=this.header.element.innerHeight())!==null&&j!==void 0?j:0)});return}var re=this.header.tabsContainer,A=(t=re.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),X=(r=this.layoutManager.tabDropPlaceholder.get(0))===null||r===void 0?void 0:r.getBoundingClientRect();if(!(!A||!X)){e<A.left?e=A.left+1:e>A.right&&(e=A.right-1);var ie,oe;if(!(X.left<e&&e<X.right)){for(var be=0;be<S;be++){var ye;if(ie=this.header.tabs[be].element,oe=(ye=ie.get(0))===null||ye===void 0?void 0:ye.getBoundingClientRect(),oe&&oe.left<e&&e<oe.right){this._dropIndex=be;break}}if(ie&&oe&&e<oe.left+oe.width*.5)ie.before(this.layoutManager.tabDropPlaceholder);else if(ie){var Oe;this._dropIndex=Math.min(((Oe=this._dropIndex)!==null&&Oe!==void 0?Oe:0)+1,S),ie.after(this.layoutManager.tabDropPlaceholder)}}var we=(i=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&i!==void 0?i:0;we=Math.max(we,(a=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&a!==void 0?a:0);var ce=we+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);ce=Math.min(ce,((u=(d=this.header.tabsContainer.offset())===null||d===void 0?void 0:d.left)!==null&&u!==void 0?u:0)+((h=this.header.tabsContainer.innerWidth())!==null&&h!==void 0?h:0)),(p=this.layoutManager.dropTargetIndicator)===null||p===void 0||p.highlightArea({x1:we,x2:ce,y1:(f=(v=this.header.element.offset())===null||v===void 0?void 0:v.top)!==null&&f!==void 0?f:0,y2:((g=(b=this.header.element.offset())===null||b===void 0?void 0:b.top)!==null&&g!==void 0?g:0)+((y=this.header.element.innerHeight())!==null&&y!==void 0?y: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=(t=this._contentAreaDimensions)===null||t===void 0||(t=t[e])===null||t===void 0?void 0:t.highlightArea;if(r){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(r)}this._dropSegment=e}}const Bf=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:_e,Component:ql,ContentItem:_e,Root:_i,RowOrColumn:Ot,Stack:wi,isComponent:Ne,isRoot:Xl,isStack:nn},Symbol.toStringTag,{value:"Module"}));function Ct(n,e,t){return(e=Wf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wf(n){var e=Kf(n,"string");return typeof e=="symbol"?e:e+""}function Kf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Yn{constructor(e,t){var r;Ct(this,"header",void 0),Ct(this,"contentItem",void 0),Ct(this,"element",O(Yn._template)),Ct(this,"titleElement",void 0),Ct(this,"closeElement",void 0),Ct(this,"isActive",!1),Ct(this,"_layoutManager",void 0),Ct(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 jn(this.element,this._layoutManager.root),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.element.on("mouseup",this._onMouseUp),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),Ne(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.text(e)}setContentItem(e){var t=this.contentItem;this._dragListener&&(t.off("destroy",this._dragListener.destroy,this._dragListener),e.on("destroy",this._dragListener.destroy,this._dragListener)),t.off("titleChanged",this.setTitle,this),e.on("titleChanged",this.setTitle,this),this.contentItem=e,e.tab=this,this.setTitle(e.config.title)}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.element.off("mouseup",this._onMouseUp),this.closeElement.off("click",this._onCloseClick),Ne(this.contentItem)&&this.contentItem.container._contentElement.off(),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 sn(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(e){Ne(this.contentItem)&&(e==null?void 0:e.target)instanceof Element&&this._isInNestedLayout(e.target)||(O(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin"))}_onTabContentFocusOut(){Ne(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&&Ne(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):Ne(this.contentItem)&&!this._isFocusDirectlyInContainer()&&this.contentItem.container._contentElement.focus(),Ne(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(),Ne(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onMouseUp(e){e.button===1&&(e.preventDefault(),e.stopPropagation())}_onCloseMousedown(e){e.stopPropagation()}_isInNestedLayout(e){var t=O(e).closest(".lm_goldenlayout")[0],r=this._layoutManager.root.element[0];return t!=null&&t!==r}_isFocusDirectlyInContainer(){if(!Ne(this.contentItem))return!1;var e=document.activeElement;return e==null||!this.contentItem.container._contentElement[0].contains(e)?!1:!this._isInNestedLayout(e)}}Ct(Yn,"_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 q(n,e,t){return(e=zf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zf(n){var e=Vf(n,"string");return typeof e=="symbol"?e:e+""}function Vf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class It extends Ue{constructor(e,t){var r,i;super(),q(this,"layoutManager",void 0),q(this,"element",O(It._template)),q(this,"tabsContainer",void 0),q(this,"tabDropdownContainer",void 0),q(this,"tabDropdownSearch",void 0),q(this,"tabDropdownList",null),q(this,"controlsContainer",void 0),q(this,"parent",void 0),q(this,"tabs",[]),q(this,"activeContentItem",null),q(this,"closeButton",null),q(this,"tabDropdownButton",null),q(this,"tabNextButton",O(It._nextButtonTemplate)),q(this,"tabPreviousButton",O(It._previousButtonTemplate)),q(this,"holdTimer",null),q(this,"rAF",null),q(this,"CLICK_TIMEOUT",500),q(this,"START_SPEED",.01),q(this,"ACCELERATION",5e-4),q(this,"PADDING",10),q(this,"SCROLL_LEFT","left"),q(this,"SCROLL_RIGHT","right"),q(this,"isDraggingTab",!1),q(this,"isOverflowing",!1),q(this,"isDropdownShown",!1),q(this,"dropdownKeyIndex",0),q(this,"_lastVisibleTabIndex",-1),q(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 Yn(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,o,a=0;a<this.tabs.length;a++)o=this.tabs[a].contentItem===e,this.tabs[a].setActive(o),o===!0&&(this.activeContentItem=e,this.parent.config.activeItemIndex=a);(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,o,a,s;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r:0)>((o=(a=this.tabsContainer.get(0))===null||a===void 0?void 0:a.offsetWidth)!==null&&o!==void 0?o:0)+((s=this.tabsContainer.scrollLeft())!==null&&s!==void 0?s:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT);else{var l=this.tabsContainer.get(0);if(l){var u,d;l.scrollLeft=(u=(d=this.tabsContainer.get(0))===null||d===void 0?void 0:d.scrollWidth)!==null&&u!==void 0?u:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var r,i,o;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r: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:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT);else{var a=this.tabsContainer.get(0);a&&(a.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,o=arguments.length>3?arguments[3]:void 0,a=this.tabsContainer.get(0);if(a){var s=a.getBoundingClientRect();if(e===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(t-i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(e===this.SCROLL_RIGHT){var l,u;if(this.tabsContainer.scrollLeft(t+i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((u=this.tabsContainer.innerWidth())!==null&&u!==void 0?u:0)===a.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((r=this.rAF)!==null&&r!==void 0?r:-1),this.rAF=window.requestAnimationFrame(d=>{var h,p,f=o||d,v=d-f,g=this.START_SPEED*v+.5*this.ACCELERATION*(v*v);g=Math.min(g,(h=(p=this.tabsContainer.get(0))===null||p===void 0?void 0:p.scrollWidth)!==null&&h!==void 0?h:1/0),this._handleScrollRepeat(e,t,g,f)})}}_$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(),O(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,o;if(o=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new Rn(this,o,"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 Rn(this,r,"lm_popout",t)),this._getHeaderSetting("maximise")){i=this.parent.toggleMaximise.bind(this.parent);var a=this._getHeaderSetting("maximise"),s=this._getHeaderSetting("minimise"),l=new Rn(this,a,"lm_maximise",i);this.parent.on("maximised",function(){l.element.attr("title",s??"")}),this.parent.on("minimised",function(){l.element.attr("title",a??"")})}this._isClosable()&&(e=this.parent.remove.bind(this.parent),r=this._getHeaderSetting("close"),this.closeButton=new Rn(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"),O(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"),O(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown()}_handleFilterKeydown(e){if(e.key==="Escape"){this._hideAdditionalTabsDropdown();return}if(this.dropdownKeyIndex===-1)return;if(e.key==="Enter"||e.key===" "){this._hideAdditionalTabsDropdown(),this.tabs[this.dropdownKeyIndex]._onTabClick();return}function t(s,l,u){if(u==null||u.length<2)return-1;for(var d=(s+l+u.length)%u.length;d!==s;){if(u.eq(d).css("display")!=="none")return d;d=(d+l+u.length)%u.length}return s}if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var r,i;e.preventDefault(),(r=this.tabDropdownList)===null||r===void 0||r.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,1,this.tabDropdownList),(i=this.tabDropdownList)===null||i===void 0||i.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}else if(e.key==="ArrowUp"||e.key==="Tab"){var o,a;e.preventDefault(),(o=this.tabDropdownList)===null||o===void 0||o.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,-1,this.tabDropdownList),(a=this.tabDropdownList)===null||a===void 0||a.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(),O(document).off("mousedown",this._hideAdditionalTabsDropdown)))}_updateAdditionalTabsDropdown(){var e,t,r,i;if(this.isDropdownShown&&!(!this.tabDropdownList||this.tabDropdownList.length==0)){var o=(e=(t=this.tabDropdownContainer.get(0))===null||t===void 0?void 0:t.scrollHeight)!==null&&e!==void 0?e:0;if(o!==0){var a=this.tabDropdownContainer[0].getBoundingClientRect(),s=(r=O(window).height())!==null&&r!==void 0?r:0,l=(i=O(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var u=this.tabDropdownButton.element[0].getBoundingClientRect(),d=o<s-u.bottom,h=!d&&u.bottom>s*.6,p=Math.min(u.left+(h?u.width:0),l-a.width-this.PADDING),f=h?Math.max(u.top-o,this.PADDING):u.bottom,v=s-f-this.PADDING;this.tabDropdownContainer.css({"max-height":v,top:f,left:p})}}}}_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()}}}}q(It,"_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(""));q(It,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));q(It,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function Nn(n,e,t){return(e=Gf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gf(n){var e=Xf(n,"string");return typeof e=="symbol"?e:e+""}function Xf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Zl{constructor(e,t){Nn(this,"_size",void 0),Nn(this,"_grabSize",void 0),Nn(this,"_hitAreaSize",void 0),Nn(this,"_dragListener",void 0),Nn(this,"element",void 0),this._size=e,this._grabSize=t<e?e:t,this._hitAreaSize=Math.max(this._grabSize,14),this.element=this._createElement(),this._dragListener=new jn(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=O('<div class="lm_drag_handle"></div>'),t=O('<div class="lm_intersection_splitter"></div>');return t.append(e),t.css({width:this._hitAreaSize,height:this._hitAreaSize}),t.on("mousedown touchstart",r=>{r.stopPropagation()}),t}}function Ln(n,e,t){return(e=qf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qf(n){var e=Zf(n,"string");return typeof e=="symbol"?e:e+""}function Zf(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Yl{constructor(e,t,r){Ln(this,"_isVertical",void 0),Ln(this,"_size",void 0),Ln(this,"_grabSize",void 0),Ln(this,"_dragListener",void 0),Ln(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=r<t?t:r,this.element=this._createElement(),this._dragListener=new jn(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=O('<div class="lm_drag_handle"></div>'),t=O('<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 Yf=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:Kl,DragProxy:sn,DragSource:zl,DragSourceFromEvent:Vl,DropTargetIndicator:Zn,Header:It,HeaderButton:Rn,IntersectionSplitter:Zl,Splitter:Yl,Tab:Yn},Symbol.toStringTag,{value:"Module"}));var Jf={config:kp,container:Fp,controls:Yf,errors:vf,items:Bf,utils:Qp};function ua(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function We(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ua(Object(t),!0).forEach(function(r){Y(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ua(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Y(n,e,t){return(e=Qf(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Qf(n){var e=ev(n,"string");return typeof e=="symbol"?e:e+""}function ev(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var da=["column","row","stack","component"];class Ri extends Ue{static isLayoutItemConfig(e){return da.includes(e.type)}static minifyConfig(e){return Ni(e)}static unminifyConfig(e){return yi(e)}constructor(e,t){super(),Y(this,"isInitialised",!1),Y(this,"_isFullPage",!1),Y(this,"_resizeTimeoutId",void 0),Y(this,"_components",{"lm-react-component":$l}),Y(this,"_fallbackComponent",void 0),Y(this,"_itemAreas",[]),Y(this,"_maximisedItem",null),Y(this,"_maximisePlaceholder",O('<div class="lm_maximise_place"></div>')),Y(this,"_creationTimeoutPassed",!1),Y(this,"_subWindowsCreated",!1),Y(this,"_dragSources",[]),Y(this,"_updatingColumnsResponsive",!1),Y(this,"_firstLoad",!0),Y(this,"_reactChildMap",new Map),Y(this,"_reactChildren",null),Y(this,"_initialHeaderHeight",void 0),Y(this,"width",null),Y(this,"height",null),Y(this,"root",void 0),Y(this,"openPopouts",[]),Y(this,"selectedItem",null),Y(this,"isSubWindow",!1),Y(this,"eventHub",new Fl(this)),Y(this,"config",void 0),Y(this,"container",void 0),Y(this,"_originalContainer",void 0),Y(this,"dropTargetIndicator",null),Y(this,"tabDropPlaceholder",O('<div class="lm_drop_tab_placeholder"></div>')),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._windowKeydown=this._windowKeydown.bind(this),this.config=this._createConfig(e),this._originalContainer=t,this.container=this._getContainer(),this._initialHeaderHeight=this.config.dimensions.headerHeight,this.isSubWindow&&O("body").css("visibility","hidden")}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 _e))throw new Error("Root must be a ContentItem");var t={settings:We({},this.config.settings),dimensions:We({},this.config.dimensions),labels:We({},this.config.labels),content:[]},r=function(a,s){for(var l in s.config)l!=="content"&&(a[l]=s.config[l]);if(a.componentName==="lm-react-component"&&(a.type="react-component"),s.contentItems.length){a.content=[];for(var u=0;u<s.contentItems.length;u++)a.content[u]={},r(a.content[u],s.contentItems[u])}};e?r(t,{contentItems:[e]}):r(t,this.root),this._$reconcilePopoutWindows(),t.openPopouts=[];for(var i=0;i<this.openPopouts.length;i++)t.openPopouts.push(this.openPopouts[i].toConfig());return t.maximisedItemId=this._maximisedItem?"__glMaximised":void 0,t}getComponent(e){return this._components[e]}getFallbackComponent(){return this._fallbackComponent}init(){if(this._subWindowsCreated===!1&&(this._createSubWindows(),this._subWindowsCreated=!0),document.readyState==="loading"||document.body===null){O(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 Zn,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}enableHeaders(){this.config.settings.hasHeaders=!0,this.config.dimensions.headerHeight=this._initialHeaderHeight,this._findAllStackContainers().forEach(e=>{e._header.show=!0,e.header.element.toggle(!0)}),this.updateSize()}disableHeaders(){this.config.settings.hasHeaders=!1,this.config.dimensions.headerHeight=0,this._findAllStackContainers().forEach(e=>{e._header.show=!1,e.header.element.toggle(!1)}),this.updateSize()}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 o,a;this._maximisedItem.element.width((o=this.container.width())!==null&&o!==void 0?o:0),this._maximisedItem.element.height((a=this.container.height())!==null&&a!==void 0?a:0),this._maximisedItem.callDownwards("setSize")}this._adjustColumnsResponsive()}}destroy(){var e;this.isInitialised===!1||!this.root||(this._onUnload(),O(window).off("resize",this._onResize),O(window).off("unload beforeunload",this._onUnload),O(window).off("blur.lm").off("focus.lm"),O(window).off("keydown",this._windowKeydown),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 en("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!Ri.isLayoutItemConfig(e))throw i="Unknown type '"+e.type+"'. Valid types are "+da.join(","),new en(i);return e.type==="component"&&!(t instanceof wi)&&t&&!(this.isSubWindow===!0&&t instanceof _i)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),e.id=(r=e.id)!==null&&r!==void 0?r:Er(),e.type==="stack"?new wi(this,e,t):e.type==="row"?new Ot(!1,this,e,t):e.type==="column"?new Ot(!0,this,e,t):new ql(this,e,t)}createPopout(e,t,r,i){var o=[],a=e instanceof _e,s=this;if(a){var l;o=this.toConfig(e).content,r=Er();for(var u=e.parent,d=e;((h=u)===null||h===void 0?void 0:h.contentItems.length)===1&&!u.isRoot;){var h;d=u,u=u.parent}if((l=u)===null||l===void 0||l.addId(r),i==null||Number.isNaN(i)){var p;i=(p=u)===null||p===void 0?void 0:p.contentItems.indexOf(d)}}else e instanceof Array?o=e:o=[e];if(!t&&a){var f,v,g,b=window.screenX||window.screenLeft,y=window.screenY||window.screenTop,S=(f=e.element.offset())!==null&&f!==void 0?f:{left:0,top:0};t={left:b+S.left,top:y+S.top,width:(v=e.element.width())!==null&&v!==void 0?v:0,height:(g=e.element.height())!==null&&g!==void 0?g:0}}if(!t&&!a&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),a&&e.remove(),!(!t||!r||i===void 0)){var C=new Kl(o,t,r,i,this);return C.on("initialised",function(){s.emit("windowOpened",C)}),C.on("closed",function(){s._$reconcilePopoutWindows()}),this.openPopouts.push(C),C}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var r=new zl(e,t,this);return this._dragSources.push(r),r}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new Vl(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,o=0;o<this._itemAreas.length;o++){var a=this._itemAreas[o];e>a.x1&&e<a.x2&&t>a.y1&&t<a.y2&&r>a.surface&&(r=a.surface,i=a)}return i}_$createRootItemAreas(){var e=50,t=We({},this.root._$getArea()),r=[We(We({},t),{},{side:"left",x2:t.x1+e}),We(We({},t),{},{side:"right",x1:t.x2-e}),We(We({},t),{},{side:"top",y2:t.y1+e}),We(We({},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(nn(r)){var i=r._$getArea();if(i!==null)if(i instanceof Array)this._itemAreas=this._itemAreas.concat(i);else{var o;this._itemAreas.push(i);var a=We(We({},i),(o=i.contentItem._contentAreaDimensions)===null||o===void 0?void 0:o.header.highlightArea);a.surface=(a.x2-a.x1)*(a.y2-a.y1),this._itemAreas.push(a)}}}}_$normalizeContentItem(e,t){if(!e)throw new Error("No content item defined");if(typeof e=="function"&&(e=e()),e instanceof _e)return e;if(O.isPlainObject(e)&&e.type){var r=this.createContentItem(e,t??null);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&&O(window).resize(this._onResize),O(window).on("unload beforeunload",this._onUnload).on("blur.lm",this._windowBlur).on("focus.lm",this._windowFocus).on("keydown",this._windowKeydown)}_windowBlur(){this.root.element.addClass("lm_window_blur")}_windowFocus(){this.root.element.removeClass("lm_window_blur")}_windowKeydown(e){if(e.key==="Escape"&&this._maximisedItem!==null){var t=document.activeElement;if(t&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT"||t.isContentEditable))return;this._maximisedItem.toggleMaximise()}}_onResize(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(this.updateSize.bind(this),100)}_createConfig(e){var t,r=Rl("gl-window");r&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(r)||"{}"),e=yi(e),localStorage.removeItem(r));var i=O.extend(!0,{},Al,e),o=function(s){for(var l in s){var u=s[l];l!=="props"&&typeof u=="object"&&u!=null?o(u):l==="type"&&u==="react-component"&&(s.type="component",s.componentName="lm-react-component")}};return o(i),((t=i.settings)===null||t===void 0?void 0:t.hasHeaders)===!1&&(i.dimensions.headerHeight=0),i}_adjustToWindowMode(){var e,t=O('<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=ki((e=this.config.content[0].title)!==null&&e!==void 0?e:""),O("head").append(O("body link, body style, template, .gl_keep")),this.container=O("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?O(this._originalContainer):O("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,O("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 en(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new en(t,e);this.root=new _i(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),o=e-i,a=this.root.contentItems[0],s=this._findAllStackContainers()[0],l=0;l<o;l++){var u=a.contentItems[a.contentItems.length-1];this._addChildContentItemsToContainer(s,u)}this._updatingColumnsResponsive=!1}}}_useResponsiveLayout(){return this.config.settings&&(this.config.settings.responsiveMode=="always"||this.config.settings.responsiveMode=="onload"&&this._firstLoad)}_addChildContentItemsToContainer(e,t){t.type==="stack"?t.contentItems.forEach(function(r){e.addChild(r),t.removeChild(r,!0)}):t.contentItems.forEach(r=>{this._addChildContentItemsToContainer(e,r)})}_findAllStackContainers(){var e=[];return this._findAllStackContainersRecursive(e,this.root),e}_findAllStackContainersRecursive(e,t){t.contentItems.forEach(r=>{nn(r)?e.push(r):r.isComponent||this._findAllStackContainersRecursive(e,r)})}}Y(Ri,"__lm",Jf);const ca={"tab-height":"28px","drag-border-width":"5px"},ha=Object.freeze({tabHeight:parseInt(ca["tab-height"],10),dragBorderWidth:parseInt(ca["drag-border-width"],10)});function ma(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function yt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ma(Object(t),!0).forEach(function(r){Jl(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ma(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Jl(n,e,t){return(e=tv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tv(n){var e=nv(n,"string");return typeof e=="symbol"?e:e+""}function nv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var kt=B.module("LayoutUtils");function Ql(n){return n.componentName!==void 0}function $t(n){var e=n;return(Ql(n)&&n.componentName==="lm-react-component"||n.type==="react-component")&&e.component!==void 0}function hr(n){return n.focus!==void 0}function pa(n){return n.type==="stack"}class T{static activateTab(e,t){var r=T.getStackForRoot(e,t,!1);if(!r){kt.error("Could not find stack for config",t);return}var i=T.getContentItemInStack(r,t);i&&r.setActiveContentItem(i)}static isActiveTab(e,t){var r=T.getStackForRoot(e,t,!1);if(!r)return kt.error("Could not find stack for config",t),!1;var i=T.getContentItemInStack(r,t),o=r.getActiveContentItem();return o===i}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(Xl(e)){var r={type:t?"column":"row"};(e.contentItems==null||e.contentItems.length===0)&&e.addChild(r);var i=e.contentItems[0],o=t?i.isColumn:i.isRow;if(!o){e.removeChild(i,!0),e.addChild(r);var a=document.activeElement;e.contentItems[0].addChild(i),a&&a.focus!=null&&a.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var s=e.contentItems[e.contentItems.length-1],l=t?s.isRow:s.isColumn;if(!l){var u,d,h=e.layoutManager.createContentItem({type:t?"row":"column",height:(u=s.config)===null||u===void 0?void 0:u.height,width:(d=s.config)===null||d===void 0?void 0:d.width},e);e.replaceChild(s,h),e.contentItems[e.contentItems.length-1].addChild(s),s=e.contentItems[e.contentItems.length-1]}return this.addStack(s,!t)}static getAllStackContainers(e){return e._findAllStackContainers()}static getFocusedStackIndex(e){return e.findIndex(t=>t.header.tabs.some(r=>r.element[0].classList.contains("lm_focusin")))}static getFocusedStack(e){var t=T.getAllStackContainers(e),r=T.getFocusedStackIndex(t);return t[r]}static getStackById(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(i&&nn(e)&&e.contentItems.length===0)return e;if(t===((r=e.config)===null||r===void 0?void 0:r.id)){if(nn(e))return e;throw new Error("Item with ID ".concat(t," is not a stack"))}if(e.contentItems==null)return null;for(var o=0;o<e.contentItems.length;o+=1){var a=this.getStackById(e.contentItems[o],t,i);if(a)return a}return null}static getContentItemById(e,t){var r;if(((r=e.config)===null||r===void 0?void 0:r.id)===t)return e;if(e.contentItems==null)return null;for(var i=0;i<e.contentItems.length;i+=1){var o=this.getContentItemById(e.contentItems[i],t);if(o)return o}return null}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&&nn(e)&&e.contentItems.length===0)return e;if(e.contentItems==null)return null;for(var i=0;i<e.contentItems.length;i+=1){var o=e.contentItems[i];if(o.isComponent&&o.config!=null&&io(o.config,t))return e;var a=this.getStackForConfig(o,t,r);if(a)return a}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,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=this.getStackForConfig(e,t);return!a&&i&&(a=this.getStackForConfig(e,{component:t.component},o)),!a&&r&&(a=this.addStack(e)),a}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,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=0;a<t.length;a+=1){var s=t[a],l=a===t.length-1,u=T.getStackForRoot(e,{component:s},r&&l,i,o);if(u)return u}return null}static getContentItemInStack(e,t){if(!e)return null;for(var r=0;r<e.contentItems.length;r+=1){var i=e.contentItems[r];if(i.isComponent&&i.config!=null&&io(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 o=e[i],a=o.content;if($t(o)){var s=t(o.component,o);s!=null?r.push(s):kt.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(o.component,'"'))}else if(a){var l=yt(yt({},o),{},{content:T.dehydrateLayoutConfig(a,t)});r.push(l)}else r.push(o)}return r}static getTabPoint(e){var t=e.tab;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],i=r.content;i!==void 0?(pa(r)&&delete r.activeItemIndex,T.dropLayoutMinorChange(i)):$t(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=T.cloneLayout(e),o=T.cloneLayout(t);return r?(T.dropLayoutMinorChange(i),T.dropLayoutMinorChange(o),li(i,o)):li(i,o)}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 o=e[i];if($t(o)){var a,s=o.component,l=o.props,u=l===void 0?{}:l;r.push(yt(yt({},o),{},{id:(a=o==null?void 0:o.id)!==null&&a!==void 0?a:Pt(),props:t(s,u)}))}else if(o.content!==void 0){var d=T.hydrateLayoutConfig(o.content,t);pa(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=d.length&&(kt.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),r.push(yt(yt({},o),{},{content:d}))}else r.push(o)}return r}static openComponent(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.root,r=e.config,i=e.stack,o=i===void 0?void 0:i,a=e.replaceExisting,s=a===void 0?!0:a,l=e.replaceConfig,u=l===void 0?void 0:l,d=e.createNewStack,h=d===void 0?!1:d,p=e.focusElement,f=p===void 0?void 0:p,v=e.dragEvent,g=v===void 0?void 0:v,b=document.activeElement,y=yt({},r);if(y.id==null&&(y.id=Pt()),g!=null){t==null||t.layoutManager.createDragSourceFromEvent(y,g);return}var S=u||{id:y.id,component:y.component};W(t);var C=o??(h?T.addStack(t):T.getStackForRoot(t,S));W(C);var _=T.getContentItemInStack(C,S);if(f!=null){var w=F=>{kt.debug("Component created, focusing element",f),C.off("componentCreated",w);var N=F.origin.element;requestAnimationFrame(()=>{T.focusElement(N[0],f)})};C.on("componentCreated",w)}if(s&&_){var D=C.contentItems.indexOf(_);C.addChild(y,D+1),C.removeChild(_),C.setActiveContentItem(C.contentItems[D])}else C.addChild(y);f==null&&b&&hr(b)&&b.focus()}static openComponentInStack(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=document.activeElement,o={id:t.id},a=T.getContentItemInStack(e,o);if(r&&a&&e){var s=e==null?void 0:e.contentItems.indexOf(a);e.addChild(t,s+1),e.removeChild(a),e.setActiveContentItem(e.contentItems[s])}else e==null||e.addChild(t);i&&hr(i)&&i.focus()}static closeComponent(e,t,r){var i=T.getStackForRoot(e,t,!1,!1,!1);if(!i){kt.warn("Cannot find stack for component, ignoring close",t);return}var o=T.getContentItemInStack(i,t),a=document.activeElement;o&&(Ne(o)?o.container.close(r):i.removeChild(o)),a&&document.contains(a)&&hr(a)&&a.focus()}static renameComponent(e,t,r){var i=T.getStackForRoot(e,t,!1);if(!i){kt.error("Could not find stack for config",t);return}var o=T.getContentItemInStack(i,t);o&&o.setTitle(r)}static cloneComponent(e,t){var r=T.getStackForRoot(e,t,!1);if(!r)return kt.error("Could not find stack for config",t),null;var i=t.props,o=i===void 0?{}:i,a=T.getPanelComponentState(t),s={type:"react-component",component:t.component,props:yt(yt({},o),{},{panelState:a}),title:"".concat(t.title," Copy"),id:Pt()};return T.openComponentInStack(r,s),s}static getPanelComponentState(e){if(Ql(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if($t(e)){var r;return(r=e.props)===null||r===void 0?void 0:r.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:ha.tabHeight,borderWidth:ha.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=T.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var t=e.props.glContainer;return T.getIdFromContainer(t)}static getComponentNameFromPanel(e){var t=e.props.glContainer,r=T.getComponentConfigFromContainer(t);if(r&&$t(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]:T.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var r=e.querySelector(t);return r==null?null:(hr(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)})}}Jl(T,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var rv=k.forwardRef((n,e)=>{var t=T.getComponentNameFromPanel({props:n});return c.jsx("div",{ref:e,className:"panel-placeholder",children:c.jsxs("div",{children:['Component "',t,'" is not registered.']})})});rv.displayName="PanelPlaceholder";var ee=Object.freeze({FOCUS:"PanelEvent.FOCUS",MOUNT:"PanelEvent.MOUNT",UNMOUNT:"PanelEvent.UNMOUNT",TITLE_CHANGED:"PanelEvent.TITLE_CHANGED",REOPEN:"PanelEvent.REOPEN",REOPEN_LAST:"PanelEvent.REOPEN_LAST",DELETE:"PanelEvent.DELETE",CLONED:"PanelEvent.CLONED",CLOSED:"PanelEvent.CLOSED",OPEN:"PanelEvent.OPEN",CLOSE:"PanelEvent.CLOSE",DRAGGING:"PanelEvent.DRAGGING",DROPPED:"PanelEvent.DROPPED"}),$i=mt(ee.OPEN),aC=$i.listen,iv=$i.emit,sC=$i.useListener,Fi=mt(ee.CLOSE),lC=Fi.listen,fa=Fi.emit,uC=Fi.useListener,Fr=Object.freeze({CYCLE_TO_NEXT_STACK:"NavigationEvent.CYCLE_TO_NEXT_STACK",CYCLE_TO_PREVIOUS_STACK:"NavigationEvent.CYCLE_TO_PREVIOUS_STACK",CYCLE_TO_NEXT_TAB:"NavigationEvent.CYCLE_TO_NEXT_TAB",CYCLE_TO_PREVIOUS_TAB:"NavigationEvent.CYCLE_TO_PREVIOUS_TAB"}),Hi=mt(Fr.CYCLE_TO_NEXT_STACK),ov=Hi.listen,dC=Hi.emit,cC=Hi.useListener,Ui=mt(Fr.CYCLE_TO_PREVIOUS_STACK),av=Ui.listen,hC=Ui.emit,mC=Ui.useListener,Bi=mt(Fr.CYCLE_TO_NEXT_TAB),sv=Bi.listen,pC=Bi.emit,fC=Bi.useListener,Wi=mt(Fr.CYCLE_TO_PREVIOUS_TAB),lv=Wi.listen,vC=Wi.emit,gC=Wi.useListener;function va(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 ga(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?va(Object(t),!0).forEach(function(r){wt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):va(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function wt(n,e,t){return(e=uv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function uv(n){var e=dv(n,"string");return typeof e=="symbol"?e:e+""}function dv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Qe=B.module("PanelManager"),Yt=function(n){return n[n.Next=0]="Next",n[n.Previous=1]="Previous",n}(Yt||{});class eu{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(s,l)=>l,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(s,l)=>l,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:new Map,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:()=>{};wt(this,"layout",void 0),wt(this,"hydrateComponent",void 0),wt(this,"dehydrateComponent",void 0),wt(this,"onPanelsUpdated",void 0),wt(this,"closed",void 0),wt(this,"openedMap",void 0),wt(this,"navigationEventListenerRemovers",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.handleReopenLast=this.handleReopenLast.bind(this),this.handleCycleToNextStack=this.handleCycleToNextStack.bind(this),this.handleCycleToPreviousStack=this.handleCycleToPreviousStack.bind(this),this.handleCycleToNextTab=this.handleCycleToNextTab.bind(this),this.handleCycleToPreviousTab=this.handleCycleToPreviousTab.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=a,this.openedMap=new Map(i),this.closed=[...o],this.navigationEventListenerRemovers=[],this.startListening()}startListening(){var e=this.layout.eventHub;e.on(ee.FOCUS,this.handleFocus),e.on(ee.MOUNT,this.handleMount),e.on(ee.UNMOUNT,this.handleUnmount),e.on(ee.REOPEN,this.handleReopen),e.on(ee.REOPEN_LAST,this.handleReopenLast),e.on(ee.DELETE,this.handleDeleted),e.on(ee.CLOSED,this.handleClosed),e.on(ee.CLOSE,this.handleControlClose),this.navigationEventListenerRemovers.push(ov(e,this.handleCycleToNextStack)),this.navigationEventListenerRemovers.push(av(e,this.handleCycleToPreviousStack)),this.navigationEventListenerRemovers.push(sv(e,this.handleCycleToNextTab)),this.navigationEventListenerRemovers.push(lv(e,this.handleCycleToPreviousTab))}stopListening(){var e=this.layout.eventHub;e.off(ee.FOCUS,this.handleFocus),e.off(ee.MOUNT,this.handleMount),e.off(ee.UNMOUNT,this.handleUnmount),e.off(ee.REOPEN,this.handleReopen),e.off(ee.REOPEN_LAST,this.handleReopenLast),e.off(ee.DELETE,this.handleDeleted),e.off(ee.CLOSED,this.handleClosed),e.off(ee.CLOSE,this.handleControlClose),this.navigationEventListenerRemovers.forEach(t=>t()),this.navigationEventListenerRemovers=[]}getClosedPanelConfigsOfType(e){return this.closed.filter(t=>t.component===e)}getOpenedPanels(){return Array.from(this.openedMap.values())}getOpenedPanelConfigs(){return this.getOpenedPanels().map(e=>{var t=e.props.glContainer;return T.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&$t(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,r=T.getStackForConfig(this.layout.root,{id:e});return(t=r&&T.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=>wr(r)&&t instanceof r.WrappedComponent||!wr(r)&&t instanceof r))}updatePanel(e){var t=T.getIdFromPanel(e);if(t==null){Qe.error("updatePanel Panel did not have an ID",e);return}Qe.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=T.getIdFromPanel(e);if(t==null){Qe.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){Qe.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){Qe.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}Qe.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){Qe.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){Qe.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){Qe.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}cycleStack(e){var t=T.getAllStackContainers(this.layout);if(!(t.length<=1)){var r=T.getFocusedStackIndex(t);if(r===-1){var i=t[0],o=i.config.activeItemIndex,a=o!=null?i.contentItems[o]:i.contentItems[0];i.setActiveContentItem(a,!0);return}var s=e===Yt.Next?(r+1)%t.length:(r-1+t.length)%t.length,l=t[s],u=l.config.activeItemIndex,d=u!=null?l.contentItems[u]:l.contentItems[0];l.setActiveContentItem(d,!0)}}handleCycleToNextStack(){this.cycleStack(Yt.Next)}handleCycleToPreviousStack(){this.cycleStack(Yt.Previous)}cycleTab(e){var t,r=T.getFocusedStack(this.layout);if(r!==void 0){var i=r.contentItems;if(!(i.length<=1)){var o=(t=r.config.activeItemIndex)!==null&&t!==void 0?t:0,a=e===Yt.Next?(o+1)%i.length:(o-1+i.length)%i.length,s=i[a];r.setActiveContentItem(s,!0)}}}handleCycleToNextTab(){this.cycleTab(Yt.Next)}handleCycleToPreviousTab(){this.cycleTab(Yt.Previous)}handleReopen(e,t){Qe.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var r=e.component,i=e.props;i=this.hydrateComponent(r,i);var o=ga(ga({},e),{},{props:i}),a=this.layout.root,s=e.parentStackId===void 0?void 0:T.getStackById(a,e.parentStackId);T.openComponent({root:a,config:o,replaceConfig:t,stack:s??void 0})}handleReopenLast(e){var t;if(this.closed.length!==0){if(e===void 0){this.handleReopen(this.closed[this.closed.length-1]);return}for(var r=(t=T.getStackForConfig(this.layout.root,e.getConfig()))===null||t===void 0?void 0:t.config.id,i=this.closed.length-1;i>=0;i-=1){var o=this.closed[i];if(o.parentStackId===r){this.handleReopen(o);return}}}}handleDeleted(e){Qe.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){Qe.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},r=this.layout.root;T.closeComponent(r,t)}addClosedPanel(e){var t=T.getComponentConfigFromContainer(e);if(t&&$t(t)){var r=this.dehydrateComponent(t.component,t);if(r!=null){var i;r.parentStackId=(i=e.tab)===null||i===void 0?void 0:i.header.parent.config.id,this.closed.push(r)}}}sendUpdate(){var e=this.closed,t=this.openedMap;this.onPanelsUpdated({closed:[...e],openedMap:new Map(t)})}}wt(eu,"MAX_CLOSED_PANEL_COUNT",100);var cv=B.module("PanelErrorBoundary");class hv extends m.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}componentWillUnmount(){var e=this.props,t=e.glContainer,r=e.glEventHub,i=T.getIdFromContainer(t);cv.debug("componentWillUnmount",i),r.emit(ee.CLOSED,i,t)}render(){var e=this.props.children,t=this.state.error;return t!=null?c.jsx("div",{className:"panel-error-boundary",children:c.jsx(Kn,{"data-testid":"panel-error-boundary-loading-error",errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e??null}}function ba(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 Tr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ba(Object(t),!0).forEach(function(r){mv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ba(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function mv(n,e,t){return(e=pv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pv(n){var e=fv(n,"string");return typeof e=="symbol"?e:e+""}function fv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function tu(n){var e=n.props,t=n.componentState,r=e.metadata,i=e.panelState,o=i===void 0?null:i;t&&(o=t.panelState);var a={};return r!=null&&(a.metadata=r),o!=null&&(a.panelState=o),Tr(Tr({},n),{},{componentState:null,props:a,type:"react-component"})}function nu(n,e){return Tr(Tr({},n),{},{localDashboardId:e})}const bC={dehydrate:tu,hydrate:nu};var ru=k.createContext(void 0);ru.displayName="LayoutManagerContext";var vv=pe.shape({on:pe.func,off:pe.func,isHidden:pe.bool,tab:pe.shape({header:pe.shape({tabs:pe.arrayOf(pe.shape({contentItem:pe.shape({})}))})}),title:pe.string,setTitle:pe.func,close:pe.func}),iu=pe.shape({on:pe.func,off:pe.func,emit:pe.func}),gv=pe.shape({registerComponent:pe.func,root:pe.shape({addChild:pe.func}),on:pe.func,off:pe.func,eventHub:iu}),yC=Object.freeze({Container:vv,EventHub:iu,Layout:gv});function mn(n,e,t){m.useEffect(function(){return n.on(e,t),()=>{n.off(e,t)}},[n,e,t])}var ou="SET_DASHBOARD_DATA";const bv=rp(ou,{},!1),yv={dashboardData:bv};var Sv=new Map,au=Object.freeze({}),Cv=Object.freeze([]),SC=Vs,CC=Gs,_C=xd,_v=n=>n.dashboardData,De=(n,e)=>{var t;return(t=_v(n)[e])!==null&&t!==void 0?t:au},wC=(n,e)=>{var t;return(t=De(n,e).closed)!==null&&t!==void 0?t:Cv},EC=(n,e)=>{var t;return(t=De(n,e).openedMap)!==null&&t!==void 0?t:Sv},su=(n,e)=>{var t;return(t=De(n,e).pluginDataMap)!==null&&t!==void 0?t:au},PC=(n,e,t)=>su(n,e)[t];function ya(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 Cn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ya(Object(t),!0).forEach(function(r){wv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ya(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function wv(n,e,t){return(e=Ev(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ev(n){var e=Pv(n,"string");return typeof e=="symbol"?e:e+""}function Pv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var lu=(n,e)=>({type:ou,id:n,payload:e}),Tv=(n,e)=>(t,r)=>t(lu(n,Cn(Cn({},De(r(),n)),e))),TC=(n,e,t)=>(r,i)=>r(lu(n,Cn(Cn({},De(i(),n)),{},{pluginDataMap:Cn(Cn({},su(i(),n)),{},{[e]:t})})));function Ov(n,e){return Mv(n)||Dv(n,e)||xv(n,e)||Iv()}function Iv(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
13
13
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xv(n,e){if(n){if(typeof n=="string")return Sa(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Sa(n,e):void 0}}function Sa(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function Dv(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function Mv(n){if(Array.isArray(n))return n}Object.entries(yv).map(n=>{var e=Ov(n,2),t=e[0],r=e[1];return sp.register(t,r)});function jv(n,e){return Lv(n)||Nv(n,e)||kv(n,e)||Av()}function Av(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
14
14
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kv(n,e){if(n){if(typeof n=="string")return Ca(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ca(n,e):void 0}}function Ca(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function Nv(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function Lv(n){if(Array.isArray(n))return n}var uu=m.createContext(null);uu.displayName="PersistentStateContext";function mr(n,e){return"".concat(n,"::").concat(e)}function Rv(n){var e=n.initialState,t=n.onChange,r=n.children,i=m.useRef(!0);m.useEffect(()=>()=>{i.current=!1},[]);var o=m.useRef(!1),a=m.useState(()=>Array.isArray(e)&&e.flat().length===2*e.length?new Map(e):(o.current=!0,new Map)),s=jv(a,1),l=s[0],u=m.useRef(new Map),d=m.useCallback((b,y,S)=>{var C=S.type,_=mr(y,C),w=u.current.get(_);if(w!=null&&w!==b)throw new Error("Detected multiple persistent states of type ".concat(C," for dhId ").concat(y,". Only one state per (dhId, type) pair is allowed."));u.current.set(_,b),i.current&&l.get(_)!==S&&(l.set(_,S),t([...l.entries()]))},[i,t,l]),h=m.useRef(e[Symbol.iterator]()),p=m.useCallback((b,y)=>{var S=mr(b,y),C=l.get(S);if(C==null&&o.current){var _=h.current.next(),w=_.value,D=w;return l.set(S,D),D}return C},[l]),f=m.useCallback((b,y,S)=>{var C=mr(y,S),_=u.current.get(C);_===b&&(l.delete(C),u.current.delete(C),i.current&&t([...l.entries()]))},[i,t,l]),v=m.useCallback((b,y,S)=>{var C=mr(y,S),_=u.current.get(C);_===b&&u.current.delete(C)},[]),g=m.useMemo(()=>({addState:d,removeState:f,deregisterHook:v,getState:p}),[d,p,f,v]);return c.jsx(uu.Provider,{value:g,children:r})}function $v(n,e){return Bv(n)||Uv(n,e)||Hv(n,e)||Fv()}function Fv(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
15
15
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Hv(n,e){if(n){if(typeof n=="string")return _a(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_a(n,e):void 0}}function _a(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function Uv(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function Bv(n){if(Array.isArray(n))return n}var Wv=B.module("DashboardPanelWrapper");function Kv(n){var e=n.glContainer,t=n.children,r=m.useCallback(u=>{e.setPersistedState(u)},[e]),i=e.getConfig(),o=i.persistedState,a=m.useState(()=>o!=null&&!Array.isArray(o)?(Wv.warn("Persisted state is type ".concat(typeof o,". Expected array. Setting to empty array.")),[]):o??[]),s=$v(a,1),l=s[0];return c.jsx(Rv,{initialState:l,onChange:r,children:t})}var Ki=m.createContext(null);Ki.displayName="PanelIdContext";function zv(){return m.useContext(Ki)}function wa(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 Gt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wa(Object(t),!0).forEach(function(r){Vv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):wa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Vv(n,e,t){return(e=Gv(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gv(n){var e=Xv(n,"string");return typeof e=="symbol"?e:e+""}function Xv(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function pr(n,e){return Jv(n)||Yv(n,e)||Zv(n,e)||qv()}function qv(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
16
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zv(n,e){if(n){if(typeof n=="string")return Ea(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ea(n,e):void 0}}function Ea(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function Yv(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function Jv(n){if(Array.isArray(n))return n}var pn=B.module("DashboardLayout"),Qv=Object.freeze({}),eg=[],Pa=()=>{},tg=1e3,Ta=n=>n;function OC(n){var e,t,r=n.id,i=n.children,o=n.emptyDashboard,a=o===void 0?c.jsx("div",{className:"dashboard-empty",children:"Dashboard is empty."}):o,s=n.layout,l=n.layoutConfig,u=l===void 0?eg:l,d=n.onLayoutChange,h=d===void 0?Pa:d,p=n.onLayoutInitialized,f=p===void 0?Pa:p,v=n.hydrate,g=v===void 0?nu:v,b=n.dehydrate,y=b===void 0?tu:b,S=n.panelWrapper,C=Vs(),_=(e=Gs(H=>De(H,r)))!==null&&e!==void 0?e:Qv,w=m.useState(!1),D=pr(w,2),F=D[0],N=D[1],x=m.useState(!1),j=pr(x,2),L=j[0],re=j[1],A=m.useRef(),X=m.useState((t=_==null?void 0:_.closed)!==null&&t!==void 0?t:[]),ie=pr(X,1),oe=ie[0],be=m.useState(s.getReactChildren()),ye=pr(be,2),Oe=ye[0],we=ye[1],ce=m.useMemo(()=>new Map,[]),Z=m.useMemo(()=>new Map,[]),V=m.useCallback(function(H,ae){var se,nr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:g,rr=arguments.length>3&&arguments[3]!==void 0?arguments[3]:y;pn.debug2("registerComponent",H,ae,nr,rr);function dn(Mt,ir){var bt=ae,or=S,I=hl(bt),z=I?c.jsx(bt,Gt(Gt({},Mt),{},{ref:ir})):c.jsx(bt,Gt({},Mt)),Q=Mt.glContainer,Me=Mt.glEventHub,je=T.getIdFromContainer(Q);return c.jsx(hv,{glContainer:Q,glEventHub:Me,children:c.jsx(Ki.Provider,{value:je,children:c.jsx(Kv,Gt(Gt({},Mt),{},{children:or==null?z:c.jsx(or,Gt(Gt({},Mt),{},{children:z}))}))})})}dn.displayName="DashboardWrapper(".concat((se=ae.displayName)!==null&&se!==void 0?se:H,")");var An=s.registerComponent(H,k.forwardRef(dn));return ce.set(H,nr),Z.set(H,rr),An},[g,y,ce,Z,s,S]),te=m.useCallback((H,ae)=>{var se;return((se=ce.get(H))!==null&&se!==void 0?se:Ta)(ae,r)},[ce,r]),G=m.useCallback((H,ae)=>{var se;return((se=Z.get(H))!==null&&se!==void 0?se:Ta)(ae,r)},[Z,r]),J=m.useMemo(()=>new eu(s,te,G,new Map,oe,H=>{var ae=H.closed,se=H.openedMap;C(Tv(r,{closed:ae,openedMap:se}))}),[G,C,te,r,oe,s]),M=Ic(H=>{var ae=A.current,se=ae==null||!T.isEqual(ae,H);pn.debug("handleLayoutStateChanged",se,H),se&&(pn.debug("Layout config has changed","lastConfig",ae,"dehydratedLayoutConfig",H),N(s.root.contentItems.length===0),A.current=H,h(H),we(s.getReactChildren()))},tg,{flushOnUnmount:!0});m.useEffect(()=>()=>M.flush(),[M]);var Ge=m.useCallback(()=>{if(!L){var H=s.toConfig(),ae=H.content,se=T.dehydrateLayoutConfig(ae,G);M(se)}},[G,L,s,M]),er=m.useCallback(H=>{var ae=T.getIdFromContainer(H);s.eventHub.emit(ee.DRAGGING,ae),re(!0)},[s.eventHub]),ln=m.useCallback(H=>{var ae=T.getIdFromContainer(H);s.eventHub.emit(ee.DROPPED,ae),re(!1)},[s.eventHub]),zr=m.useCallback(H=>{if(pn.debug2("handleComponentCreated",H),!(H==null||H.config==null||!$t(H.config)||H.config.component==null||H.element==null)){var ae=H.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),se="".concat(ae,"-component");H.element.addClass(se)}},[]),tr=m.useCallback(()=>{we(s.getReactChildren())},[s]);mn(s,"stateChanged",Ge),mn(s,"itemPickedUp",er),mn(s,"itemDropped",ln),mn(s,"componentCreated",zr),mn(s.eventHub,ee.TITLE_CHANGED,Ge),mn(s,"reactChildrenChanged",tr);var un=Oc(u);return m.useEffect(function(){if(un!==u&&u!==A.current){pn.debug("loadNewConfig effect triggered. previousLayoutConfig",un,"layoutConfig",u,"lastConfig",A.current),pn.debug("Setting new layout content...");for(var ae=T.hydrateLayoutConfig(u,te);s.root.contentItems.length>0;)s.root.contentItems[0].remove();for(var se=0;se<ae.length;se+=1)s.root.addChild(ae[se]);N(s.root.contentItems.length===0)}},[te,s,u,J,un]),m.useEffect(()=>f(),[]),c.jsxs(c.Fragment,{children:[F&&a,Oe,k.Children.map(i,H=>H!=null?c.jsx(dm,{fallback:[],children:k.cloneElement(H,{id:r,layout:s,panelManager:J,registerComponent:V})}):null)]})}var du=m.createContext(null);du.displayName="DashboardIdContext";function IC(){var n=m.useContext(du);if(n==null)throw new Error("useDashboardId must be used within a DashboardIdContext provider");return n}function ng(n,e){return ag(n)||og(n,e)||ig(n,e)||rg()}function rg(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
16
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zv(n,e){if(n){if(typeof n=="string")return Ea(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ea(n,e):void 0}}function Ea(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function Yv(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function Jv(n){if(Array.isArray(n))return n}var pn=B.module("DashboardLayout"),Qv=Object.freeze({}),eg=[],Pa=()=>{},tg=1e3,Ta=n=>n;function OC(n){var e,t,r=n.id,i=n.children,o=n.emptyDashboard,a=o===void 0?c.jsx("div",{className:"dashboard-empty",children:"Dashboard is empty."}):o,s=n.layout,l=n.layoutConfig,u=l===void 0?eg:l,d=n.onLayoutChange,h=d===void 0?Pa:d,p=n.onLayoutInitialized,f=p===void 0?Pa:p,v=n.hydrate,g=v===void 0?nu:v,b=n.dehydrate,y=b===void 0?tu:b,S=n.panelWrapper,C=Vs(),_=(e=Gs(H=>De(H,r)))!==null&&e!==void 0?e:Qv,w=m.useState(!1),D=pr(w,2),F=D[0],N=D[1],x=m.useState(!1),j=pr(x,2),L=j[0],re=j[1],A=m.useRef(),X=m.useState((t=_==null?void 0:_.closed)!==null&&t!==void 0?t:[]),ie=pr(X,1),oe=ie[0],be=m.useState(s.getReactChildren()),ye=pr(be,2),Oe=ye[0],we=ye[1],ce=m.useMemo(()=>new Map,[]),Z=m.useMemo(()=>new Map,[]),V=m.useCallback(function(H,ae){var se,nr=arguments.length>2&&arguments[2]!==void 0?arguments[2]:g,rr=arguments.length>3&&arguments[3]!==void 0?arguments[3]:y;pn.debug2("registerComponent",H,ae,nr,rr);function dn(Mt,ir){var bt=ae,or=S,I=hl(bt),z=I?c.jsx(bt,Gt(Gt({},Mt),{},{ref:ir})):c.jsx(bt,Gt({},Mt)),Q=Mt.glContainer,Me=Mt.glEventHub,je=T.getIdFromContainer(Q);return c.jsx(hv,{glContainer:Q,glEventHub:Me,children:c.jsx(Ki.Provider,{value:je,children:c.jsx(Kv,Gt(Gt({},Mt),{},{children:or==null?z:c.jsx(or,Gt(Gt({},Mt),{},{children:z}))}))})})}dn.displayName="DashboardWrapper(".concat((se=ae.displayName)!==null&&se!==void 0?se:H,")");var An=s.registerComponent(H,k.forwardRef(dn));return ce.set(H,nr),Z.set(H,rr),An},[g,y,ce,Z,s,S]),te=m.useCallback((H,ae)=>{var se;return((se=ce.get(H))!==null&&se!==void 0?se:Ta)(ae,r)},[ce,r]),G=m.useCallback((H,ae)=>{var se;return((se=Z.get(H))!==null&&se!==void 0?se:Ta)(ae,r)},[Z,r]),J=m.useMemo(()=>new eu(s,te,G,new Map,oe,H=>{var ae=H.closed,se=H.openedMap;C(Tv(r,{closed:ae,openedMap:se}))}),[G,C,te,r,oe,s]),M=Ic(H=>{var ae=A.current,se=ae==null||!T.isEqual(ae,H);pn.debug("handleLayoutStateChanged",se,H),se&&(pn.debug("Layout config has changed","lastConfig",ae,"dehydratedLayoutConfig",H),N(s.root.contentItems.length===0),A.current=H,h(H),we(s.getReactChildren()))},tg,{flushOnUnmount:!0});m.useEffect(()=>()=>M.flush(),[M]);var Xe=m.useCallback(()=>{if(!L){var H=s.toConfig(),ae=H.content,se=T.dehydrateLayoutConfig(ae,G);M(se)}},[G,L,s,M]),er=m.useCallback(H=>{var ae=T.getIdFromContainer(H);s.eventHub.emit(ee.DRAGGING,ae),re(!0)},[s.eventHub]),ln=m.useCallback(H=>{var ae=T.getIdFromContainer(H);s.eventHub.emit(ee.DROPPED,ae),re(!1)},[s.eventHub]),zr=m.useCallback(H=>{if(pn.debug2("handleComponentCreated",H),!(H==null||H.config==null||!$t(H.config)||H.config.component==null||H.element==null)){var ae=H.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),se="".concat(ae,"-component");H.element.addClass(se)}},[]),tr=m.useCallback(()=>{we(s.getReactChildren())},[s]);mn(s,"stateChanged",Xe),mn(s,"itemPickedUp",er),mn(s,"itemDropped",ln),mn(s,"componentCreated",zr),mn(s.eventHub,ee.TITLE_CHANGED,Xe),mn(s,"reactChildrenChanged",tr);var un=Oc(u);return m.useEffect(function(){if(un!==u&&u!==A.current){pn.debug("loadNewConfig effect triggered. previousLayoutConfig",un,"layoutConfig",u,"lastConfig",A.current),pn.debug("Setting new layout content...");for(var ae=T.hydrateLayoutConfig(u,te);s.root.contentItems.length>0;)s.root.contentItems[0].remove();for(var se=0;se<ae.length;se+=1)s.root.addChild(ae[se]);N(s.root.contentItems.length===0)}},[te,s,u,J,un]),m.useEffect(()=>f(),[]),c.jsxs(c.Fragment,{children:[F&&a,Oe,k.Children.map(i,H=>H!=null?c.jsx(dm,{fallback:[],children:k.cloneElement(H,{id:r,layout:s,panelManager:J,registerComponent:V})}):null)]})}var du=m.createContext(null);du.displayName="DashboardIdContext";function IC(){var n=m.useContext(du);if(n==null)throw new Error("useDashboardId must be used within a DashboardIdContext provider");return n}function ng(n,e){return ag(n)||og(n,e)||ig(n,e)||rg()}function rg(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
17
17
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ig(n,e){if(n){if(typeof n=="string")return Oa(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Oa(n,e):void 0}}function Oa(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function og(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function ag(n){if(Array.isArray(n))return n}function sg(n,e,t){return(e=lg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lg(n){var e=ug(n,"string");return typeof e=="symbol"?e:e+""}function ug(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function cu(n,e,t){if(n){if(t(n)===!0)return n;for(var r=n.child;r;){var i=cu(r,e,t);if(i)return i;r=r.sibling}}}function dg(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}var zi=dg(m.createContext(null));zi.displayName="FiberContext";class xC extends m.Component{constructor(){super(...arguments),sg(this,"_reactInternals",void 0)}render(){var e=this.props.children;return c.jsx(zi.Provider,{value:this._reactInternals,children:e})}}function cg(){var n=m.useContext(zi);if(n===null)throw new Error("useFiber must be called within a <FiberProvider />!");var e=m.useState(()=>Pt()),t=ng(e,1),r=t[0],i=m.useMemo(()=>{for(var o of[n,n==null?void 0:n.alternate].filter(s=>s!=null)){var a=cu(o,!1,s=>{for(var l=s.memoizedState;l!=null;){if(l.memoizedState===r)return!0;l=l.next}});if(a)return a}},[n,r]);return i}var DC="default",hg="CREATE_DASHBOARD",mg="CLOSE_DASHBOARD",Vi=mt(hg),MC=Vi.listen,pg=Vi.emit,jC=Vi.useListener,Gi=mt(mg),AC=Gi.listen,fg=Gi.emit,kC=Gi.useListener;function vg(n,e,t){return(e=gg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function gg(n){var e=bg(n,"string");return typeof e=="symbol"?e:e+""}function bg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class hu extends m.PureComponent{constructor(e){super(e),this.handleCloseTab=this.handleCloseTab.bind(this),this.handleCloseTabsRight=this.handleCloseTabsRight.bind(this),this.handleCloseTabsAll=this.handleCloseTabsAll.bind(this),this.handleReopenLast=this.handleReopenLast.bind(this)}getAllTabs(){var e,t,r=this.props.glContainer;return[...(e=r==null||(t=r.tab)===null||t===void 0||(t=t.header)===null||t===void 0?void 0:t.tabs)!==null&&e!==void 0?e:[]]}handleCloseTab(){var e=this.props.glContainer;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 e=this.props.glContainer,t=this.getAllTabs(),r=t.length-1;r>0;r-=1){var i,o,a,s;if(((i=t[r].contentItem)===null||i===void 0||(i=i.config)===null||i===void 0?void 0:i.id)===((o=e.tab)===null||o===void 0||(o=o.contentItem)===null||o===void 0||(o=o.config)===null||o===void 0?void 0:o.id))break;(a=((s=t[r])===null||s===void 0?void 0:s.contentItem).container)===null||a===void 0||a.close()}}handleReopenLast(){var e=this.props,t=e.glContainer,r=e.glEventHub;r.emit(ee.REOPEN_LAST,t)}canCloseTabsRight(){for(var e=this.props.glContainer,t=this.getAllTabs(),r=!0,i=t.length-1;i>0;i-=1){var o,a,s;if(((o=t[i].contentItem)===null||o===void 0||(o=o.config)===null||o===void 0?void 0:o.id)===((a=e.tab)===null||a===void 0||(a=a.contentItem)===null||a===void 0||(a=a.config)===null||a===void 0?void 0:a.id))break;var l=!!(!((s=t[i])===null||s===void 0||(s=s.contentItem)===null||s===void 0||(s=s.config)===null||s===void 0)&&s.isClosable);if(l){r=!1;break}}return r}canCloseAny(){for(var e=this.getAllTabs(),t=!0,r=e.length-1;r>0;r-=1){var i,o=!!(!((i=e[r])===null||i===void 0||(i=i.contentItem)===null||i===void 0||(i=i.config)===null||i===void 0)&&i.isClosable);if(o){t=!1;break}}return t}canReopenLast(){var e,t,r=this.props,i=r.workspace,o=r.glContainer,a=(e=T.getStackForConfig(o.layoutManager.root,o.getConfig()))===null||e===void 0?void 0:e.config.id;return!((t=i.data.closed)!==null&&t!==void 0&&t.some(s=>s.parentStackId===a))}render(){var e,t=this.props,r=t.additionalActions,i=t.glContainer,o=[...r];o.push(()=>({title:"Re-open closed panel",group:de.groups.medium+2004,action:this.handleReopenLast,disabled:this.canReopenLast()}));var a=(e=i.tab)===null||e===void 0||(e=e.contentItem)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.isClosable;return o.push({title:"Close",order:10,group:de.groups.low,action:this.handleCloseTab,disabled:a===void 0||!a}),o.push(()=>({title:"Close Tabs to Right",order:20,group:de.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),o.push(()=>({title:"Close All",order:30,group:de.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),c.jsx(de,{actions:o})}}vg(hu,"defaultProps",{additionalActions:[]});var yg=n=>({workspace:Pl(n)}),Sg=Vn(yg,{setWorkspace:Tl})(hu);function mu(n,e,t){return(e=Cg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cg(n){var e=_g(n,"string");return typeof e=="symbol"?e:e+""}function _g(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class pu extends m.PureComponent{constructor(e){super(e),mu(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=k.createRef();var t=e.value;this.state={value:t,valueWasValidated:!1}}componentDidUpdate(e){var t=e.isShown,r=this.props.isShown;r&&!t&&this.resetState()}resetState(){var e=this.props.value;this.setState({value:e,valueWasValidated:!1})}handleRenameDialogOpened(){var e;(e=this.renameInputRef)===null||e===void 0||(e=e.current)===null||e===void 0||e.focus()}handleRenameInputChange(e){this.setState({value:e.target.value})}handleRenameCancel(){var e=this.props.onCancel;e()}handleRenameSubmit(e){e.stopPropagation(),e.preventDefault();var t=this.state.value,r=t==null?void 0:t.trim();if(r!==void 0&&r!==""){var i=this.props.onSubmit;i(r)}else this.setState({value:r,valueWasValidated:!0})}renderRenameDialog(){var e=this.props,t=e.isShared,r=e.isOwner,i=e.itemType,o=this.state,a=o.value,s=o.valueWasValidated;return c.jsxs("form",{className:U("p-3",{"was-validated":s}),onSubmit:this.handleRenameSubmit,noValidate:!0,role:"presentation",onMouseDown:l=>{l.stopPropagation()},onMouseUp:l=>{l.stopPropagation()},children:[c.jsxs("div",{className:"form-group",children:[c.jsxs("label",{htmlFor:"rename-dialog-".concat(i,"-input"),children:["Rename ",i]}),c.jsx("input",{type:"text",className:"form-control",id:"rename-dialog-".concat(i,"-input"),value:a??void 0,ref:this.renameInputRef,onChange:this.handleRenameInputChange,required:!0}),c.jsxs("div",{className:"invalid-feedback",children:[i," name cannot be empty"]}),(t||!r)&&c.jsxs("div",{className:"pt-2",children:["Renaming this ",i," will rename for all users."]})]}),c.jsxs("div",{className:"text-right",children:[c.jsx(ne,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),c.jsx(ne,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var e=this.props,t=e.isShown,r=e.onCancel;return c.jsx(Ar,{isShown:t,onEntered:this.handleRenameDialogOpened,onExited:r,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}mu(pu,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});var fr=Object.freeze({focus:"TabEvent.focus",blur:"TabEvent.blur"});function Ia(n,e,t){return(e=wg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wg(n){var e=Eg(n,"string");return typeof e=="symbol"?e:e+""}function Eg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Pg=B.module("Panel");class Tg extends m.PureComponent{constructor(e){super(e),Ia(this,"ref",void 0),Ia(this,"getAdditionalActions",_n((r,i,o)=>{var a=[];return i&&a.push(this.getCloneAction()),o&&a.push(this.getRenameAction()),[...a,...r]})),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.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=k.createRef();var t=this.props.glContainer;this.state={title:T.getTitleFromContainer(t),showRenameDialog:!1,isWithinPanel:!0}}componentDidMount(){var e,t=this.props,r=t.componentPanel,i=t.glContainer,o=t.glEventHub;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),o.on(fr.focus,this.handleTabFocus),o.on(fr.blur,this.handleTabBlur),o.emit(ee.MOUNT,r??this),this.setState({isWithinPanel:((e=this.ref.current)===null||e===void 0||(e=e.parentElement)===null||e===void 0?void 0:e.closest(".dh-panel"))!=null})}componentWillUnmount(){var e=this.props,t=e.componentPanel,r=e.glContainer,i=e.glEventHub;r.off("resize",this.handleResize),r.off("show",this.handleBeforeShow),r.off("shown",this.handleShow),r.off("hide",this.handleHide),r.off("tab",this.handleTab),r.off("tabClicked",this.handleTabClicked),i.off(fr.focus,this.handleTabFocus),i.off(fr.blur,this.handleTabBlur),i.emit(ee.UNMOUNT,t??this)}handleTab(e){e!=null&&this.setState({title:T.getTitleFromTab(e)}),this.forceUpdate();var t=this.props.onTab;t==null||t(e)}handleTabClicked(e){var t=this.props.onTabClicked;t==null||t(e)}handleFocus(e){var t=this.props,r=t.componentPanel,i=t.glEventHub;i.emit(ee.FOCUS,r??this);var o=this.props.onFocus;o==null||o(e)}handleBlur(e){var t=this.props.onBlur;t==null||t(e)}handleHide(){for(var e=this.props.onHide,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleResize(){for(var e=this.props.onResize,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleBeforeShow(){for(var e=this.props.onBeforeShow,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleShow(){for(var e=this.props.onShow,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleTabBlur(){for(var e=this.props.onTabBlur,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleTabFocus(){for(var e=this.props.onTabFocus,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleRenameCancel(){this.setState({showRenameDialog:!1})}handleShowRenameDialog(){this.setState({showRenameDialog:!0})}handleRenameSubmit(e){var t=this.props.glContainer;this.setState({showRenameDialog:!1,title:e});var r=T.getRootFromContainer(t),i=T.getComponentConfigFromContainer(t);W(i),T.renameComponent(r,i,e)}handleCopyPanel(){var e=this.props,t=e.glContainer,r=e.glEventHub,i=T.getRootFromContainer(t),o=T.getComponentConfigFromContainer(t);if(o==null){Pg.error("Could not get component config from container",t);return}var a=T.cloneComponent(i,o);a!==null&&r.emit(ee.CLONED,this,a)}getCloneAction(){return{title:"Copy Panel",order:10,group:de.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:de.groups.medium,action:this.handleShowRenameDialog}}render(){var e=this.props,t=e.children,r=e.className,i=e.renderTabTooltip,o=e.glContainer,a=e.glEventHub,s=e.additionalActions,l=s===void 0?$d:s,u=e.errorMessage,d=e.isLoaded,h=d===void 0?!0:d,p=e.isLoading,f=p===void 0?!1:p,v=e.isClonable,g=v===void 0?!1:v,b=e.isRenamable,y=b===void 0?!1:b,S=e.onErrorAction,C=o.tab,_=this.state,w=_.showRenameDialog,D=_.title,F=_.isWithinPanel;return c.jsxs("div",{className:U("h-100 w-100 dh-panel",r),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[t,c.jsx(Kn,{"data-testid":"base-panel-loading",errorMessage:u,isLoaded:h,isLoading:f,onErrorAction:S}),!F&&C!=null&&xi.createPortal(c.jsxs(c.Fragment,{children:[c.jsx(Sg,{glContainer:o,glEventHub:a,additionalActions:this.getAdditionalActions(l,g,y)}),y&&c.jsx(pu,{isShown:w,value:D,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),i!=null&&c.jsx(ue,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:i()})]}),C.element[0])]})}}var Og=yl(Tg),Ig=B.module("useDhId"),Qr="__dhId";function NC(){var n,e,t=(n=(e=cg())===null||e===void 0?void 0:e.pendingProps)!==null&&n!==void 0?n:{},r=t[Qr],i=zv();if(r!=null){if(typeof r!="string")throw new Error("useDhId expected prop ".concat(Qr," to be a string, but got ").concat(typeof r));return r}return i??(Ig.warn("useDhId must be used within a PanelIdContext provider if there is no ".concat(Qr," prop. Defaulting to null.")),null)}const xg="var(--dh-color-chart-colorway)",Dg="var(--dh-color-chart-grid)",Mg="var(--dh-color-chart-axis-line)",jg="var(--dh-color-chart-axis-line-zero)",xa={"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:xg,gridcolor:Dg,linecolor:Mg,zerolinecolor:jg,"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)","indicator-increasing":"var(--dh-color-chart-indicator-increase)","indicator-decreasing":"var(--dh-color-chart-indicator-decrease)","indicator-gauge":"var(--dh-color-chart-indicator-gauge)","map-style":"var(--dh-color-chart-map-style)"};function Ag(n,e){return Rg(n)||Lg(n,e)||Ng(n,e)||kg()}function kg(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
18
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ng(n,e){if(n){if(typeof n=="string")return Da(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Da(n,e):void 0}}function Da(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function Lg(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function Rg(n){if(Array.isArray(n))return n}var Ma=B.module("ChartTheme");function $g(){var n,e=Fs(xa);return e.colorway=Gu((n=e.colorway)!==null&&n!==void 0?n:"").map(t=>{var r=Ag(t,2),i=r[0],o=r[1];return Xu.normalizeCssColor(e.colorway.substring(i,o+1))}).join(" "),Ma.debug2("Chart theme:",xa),Ma.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"],indicator_increasing:e["indicator-increasing"],indicator_decreasing:e["indicator-decreasing"],indicator_gauge:e["indicator-gauge"],map_style:e["map-style"]})}function ja(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 Fg(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ja(Object(t),!0).forEach(function(r){Hg(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ja(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Hg(n,e,t){return(e=Ug(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ug(n){var e=Bg(n,"string");return typeof e=="symbol"?e:e+""}function Bg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Wg=m.lazy(()=>Dd(()=>import("./Plot-CGXK1vWp.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url));function Kg(n){return c.jsx(m.Suspense,{fallback:c.jsx(Kn,{"data-testid":"lazy-plot-loading"}),children:c.jsx(Wg,Fg({},n))})}var Xi=m.createContext(null);Xi.displayName="ChartThemeContext";function LC(n){var e=n.children,t=ol(),r=t.activeThemes,i=m.useMemo($g,[r]);return c.jsx(Xi.Provider,{value:i,children:e})}function zg(){return Xn(Xi,"No ChartThemeContext value found.")}function fu(n){var e=n.type,t=_m();switch(e){case t.VariableType.TABLE:case t.VariableType.TABLEMAP:case t.VariableType.TREETABLE:case t.VariableType.HIERARCHICALTABLE:case t.VariableType.PARTITIONEDTABLE:return c.jsx(me,{icon:Zu});case t.VariableType.FIGURE:return c.jsx(me,{icon:Hs});case t.VariableType.PANDAS:return c.jsx(me,{icon:qu});default:return c.jsx(me,{icon:$s})}}function Aa(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Vg(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Aa(o,r,i,a,s,"next",l)}function s(l){Aa(o,r,i,a,s,"throw",l)}a(void 0)})}}function Gg(n,e){return Yg(n)||Zg(n,e)||qg(n,e)||Xg()}function Xg(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
18
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ng(n,e){if(n){if(typeof n=="string")return Da(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Da(n,e):void 0}}function Da(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function Lg(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function Rg(n){if(Array.isArray(n))return n}var Ma=B.module("ChartTheme");function $g(){var n,e=Fs(xa);return e.colorway=Gu((n=e.colorway)!==null&&n!==void 0?n:"").map(t=>{var r=Ag(t,2),i=r[0],o=r[1];return Xu.normalizeCssColor(e.colorway.substring(i,o+1))}).join(" "),Ma.debug2("Chart theme:",xa),Ma.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"],indicator_increasing:e["indicator-increasing"],indicator_decreasing:e["indicator-decreasing"],indicator_gauge:e["indicator-gauge"],map_style:e["map-style"]})}function ja(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 Fg(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ja(Object(t),!0).forEach(function(r){Hg(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ja(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Hg(n,e,t){return(e=Ug(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ug(n){var e=Bg(n,"string");return typeof e=="symbol"?e:e+""}function Bg(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Wg=m.lazy(()=>Dd(()=>import("./Plot-qZjcmc4S.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url));function Kg(n){return c.jsx(m.Suspense,{fallback:c.jsx(Kn,{"data-testid":"lazy-plot-loading"}),children:c.jsx(Wg,Fg({},n))})}var Xi=m.createContext(null);Xi.displayName="ChartThemeContext";function LC(n){var e=n.children,t=ol(),r=t.activeThemes,i=m.useMemo($g,[r]);return c.jsx(Xi.Provider,{value:i,children:e})}function zg(){return Xn(Xi,"No ChartThemeContext value found.")}function fu(n){var e=n.type,t=_m();switch(e){case t.VariableType.TABLE:case t.VariableType.TABLEMAP:case t.VariableType.TREETABLE:case t.VariableType.HIERARCHICALTABLE:case t.VariableType.PARTITIONEDTABLE:return c.jsx(me,{icon:Zu});case t.VariableType.FIGURE:return c.jsx(me,{icon:Hs});case t.VariableType.PANDAS:return c.jsx(me,{icon:qu});default:return c.jsx(me,{icon:$s})}}function Aa(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Vg(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Aa(o,r,i,a,s,"next",l)}function s(l){Aa(o,r,i,a,s,"throw",l)}a(void 0)})}}function Gg(n,e){return Yg(n)||Zg(n,e)||qg(n,e)||Xg()}function Xg(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
19
19
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qg(n,e){if(n){if(typeof n=="string")return ka(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ka(n,e):void 0}}function ka(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function Zg(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function Yg(n){if(Array.isArray(n))return n}function vu(n){var e=n.children,t=n.language,r=m.useState(null),i=Gg(r,2),o=i[0],a=i[1],s=ol(),l=s.activeThemes;return m.useEffect(()=>{var u=!1;function d(){return h.apply(this,arguments)}function h(){return h=Vg(function*(){if(e!=null&&l!=null){var p=yield Re.colorize(e.toString(),t,{});u||a(p)}}),h.apply(this,arguments)}return d(),()=>{u=!0}},[l,e,t]),c.jsx("div",{style:{pointerEvents:"none"},dangerouslySetInnerHTML:o!=null?{__html:o}:void 0})}class gu{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}class Or{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)?[]:Md.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"),o="".concat(e.getMilliseconds()).padStart(3,"0");return"".concat(t,":").concat(r,":").concat(i,".").concat(o)}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 Or.isTableType(e,t)||Or.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}function Jg(n){var e=n.children;return c.jsxs("div",{className:"console-history-item-result",children:[c.jsx("div",{className:"console-history-gutter",children:"-"}),c.jsx("div",{className:"console-history-content",children:e})]})}function Ei(n,e,t){return(e=Qg(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Qg(n){var e=eb(n,"string");return typeof e=="symbol"?e:e+""}function eb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class bu extends m.Component{constructor(e){super(e),Ei(this,"timer",void 0),Ei(this,"startTime",void 0),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=window.setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer!=null&&clearInterval(this.timer),this.timer=void 0}updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){var e=this.props,t=e.disabled,r=e.onCancelClick,i=this.state.elapsed;return c.jsx("div",{className:U("console-history-result-in-progress",{disabled:t}),children:c.jsxs("span",{className:"badge",children:[c.jsx(Us,{className:"ml-2"}),"Running... ",He.formatElapsedTime(i)," ",c.jsx(ne,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:Yu,tooltip:"Cancel",onClick:r,disabled:t})]})})}}Ei(bu,"defaultProps",{disabled:!1});function Bn(n,e,t){return(e=tb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tb(n){var e=nb(n,"string");return typeof e=="symbol"?e:e+""}function nb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class On extends m.PureComponent{constructor(e){super(e),Bn(this,"mouseX",void 0),Bn(this,"mouseY",void 0),Bn(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)>=On.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=On.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 e=this.state,t=e.isExpanded,r=e.isTriggerHovered,i=this.props.message;W(i);var o=i.trimEnd(),a=o.indexOf(`
20
20
  `),s=a>-1,l=o;s&&(l=o.slice(0,a));var u=o.slice(a),d=r?"error-btn-link error-btn-link--active":"error-btn-link";return c.jsxs("div",{className:U("error-message",{expanded:t}),children:[s&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"error-gutter",children:c.jsx("button",{type:"button",onClick:this.handleToggleError,className:d,tabIndex:-1,children:c.jsx(me,{icon:t?ai:Ju,transform:"left-3"})})}),c.jsxs("div",{className:"error-content",children:[c.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:l}),t?u:""]})]}),!s&&c.jsx("div",{className:"error-content",children:c.jsx("div",{className:"console-error-text",children:l})})]},"error")}}Bn(On,"defaultProps",{message:""});Bn(On,"mouseDragThreshold",5);var yu=m.memo(n=>{var e=n.item,t=e.startTime,r=e.serverStartTime,i=e.serverEndTime,o=m.useMemo(()=>{var d;return(d=e.endTime)!==null&&d!==void 0?d:Date.now()},[e.endTime]),a=He.formatConvertedDuration(t,o),s=!!a,l=null;r!=null&&i!=null&&(l=He.formatConvertedDuration(r,i,"ns"));var u=!!l;return c.jsxs(c.Fragment,{children:[c.jsx(al,{children:"Execution Info"}),c.jsx(jd,{children:c.jsxs("div",{className:"console-history-item-contextual-help-content",children:[s&&c.jsxs(c.Fragment,{children:[c.jsx("div",{children:"Elapsed time"}),c.jsx("div",{children:a})]}),u&&c.jsxs(c.Fragment,{children:[c.jsx("div",{children:"Server query time"}),c.jsx("div",{children:l})]})]})})]})});yu.displayName="ConsoleHistoryItemTooltip";var rb=n=>{if((n==null?void 0:n.command)==null)return null;var e=n.command?n.command.split(`
21
21
  `).length:0;return e>2?null:"console-history-actions-".concat(e)},Su=m.memo(n=>{var e=n.item,t=n.onCommandSubmit,r=n.handleTooltipVisible,i=m.useMemo(()=>rb(e),[e]);return c.jsxs("div",{className:U("console-history-actions",i),children:[e.command!=null&&c.jsx(ml,{copy:e.command}),c.jsx(ne,{icon:Qu,kind:"inline",onClick:()=>{var o;return t((o=e.command)!==null&&o!==void 0?o:"")},tooltip:"Rerun",children:null}),c.jsx(Ad,{variant:"info",onOpenChange:r,UNSAFE_className:"console-history-item-contextual-help",children:c.jsx(yu,{item:e})})]})});Su.displayName="ConsoleHistoryItemActions";function ib(n,e,t){return(e=ob(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ob(n){var e=ab(n,"string");return typeof e=="symbol"?e:e+""}function ab(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Na=B.module("ConsoleHistoryItem");class Cu extends m.PureComponent{constructor(e){super(e),this.state={isTooltipVisible:!1},this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){Na.debug("handleObjectClick",e);var t=this.props.openObject;t(e)}handleCancelClick(){var e=this.props.item;e!=null&&e.cancelResult&&(Na.debug("Cancelling command: ".concat(e.command)),e.cancelResult())}render(){var e=this.state.isTooltipVisible,t=this.props,r=t.disabled,i=t.item,o=t.language,a=t.iconForType,s=t.onCommandSubmit,l=i.disabledObjects,u=i.result,d=i.command!=null&&i.command!=="",h=null;d&&(h=c.jsxs("div",{className:U("console-history-item-command",{"console-history-item-command-tooltip-active":e}),children:[c.jsx("div",{className:"console-history-gutter",children:">"}),c.jsxs("div",{className:"console-history-content",children:[c.jsx(vu,{language:o,children:i.command}),c.jsx(Su,{item:i,onCommandSubmit:s,handleTooltipVisible:x=>this.setState({isTooltipVisible:x})})]})]}));var p=[],f=!1;if(u){var v=u.error,g=u.message,b=u.changes;if(b){var y=b.created,S=b.updated;[...y,...S].forEach(x=>{f=!0;var j=x.title,L="".concat(j),re=r===void 0||r||(l??[]).indexOf(L)>=0,A=c.jsx(ne,{kind:"primary",onClick:()=>this.handleObjectClick(x),className:"btn-console-object",disabled:re,icon:a(x.type),children:j},L);p.push(A)})}if(v!=null&&!d){var C,_="".concat((C=v.message)!==null&&C!==void 0?C:v);_||(_=v);var w=c.jsx(On,{message:_},"result-error");p.push(w)}if(g!==void 0&&g!==""){var D=c.jsx("div",{className:"log-message",children:g},"log-message");p.push(D)}}else{f=!0;var F=c.jsx(bu,{onCancelClick:this.handleCancelClick,disabled:r},"in_progress");p.push(F)}var N=null;return p.length>0&&(N=c.jsx(Jg,{children:p})),c.jsxs("div",{className:U("console-command-result",{"console-result-buttons":f}),children:[h,N]})}}ib(Cu,"defaultProps",{disabled:!1});function sb(n,e){return"".concat(n,".").concat(e.command,".").concat(e.result&&e.result.message,".").concat(e.result&&e.result.error)}var lb=k.forwardRef(function(e,t){for(var r=e.disabled,i=r===void 0?!1:r,o=e.items,a=e.language,s=e.openObject,l=e.supportsType,u=e.iconForType,d=e.onCommandSubmit,h=[],p=0;p<o.length;p+=1){var f=o[p],v=c.jsx(Cu,{disabled:i,item:f,openObject:s,language:a,supportsType:l,iconForType:u,onCommandSubmit:d},sb(p,f));h.push(v)}return c.jsx("div",{ref:t,className:"container-fluid console-history",children:h})}),ub={name:"Console",CLEAR:le.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[P.CTRL,E.L],macShortcut:[P.CTRL,E.C]}),FOCUS_HISTORY:le.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[P.CTRL,E.H],macShortcut:[P.CTRL,P.OPTION,E.H]})},db={name:"Command History",FOCUS_HISTORY:le.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[P.CTRL,E.H],macShortcut:[P.CTRL,P.OPTION,E.H]}),SEND_TO_CONSOLE:le.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[E.ENTER],macShortcut:[E.ENTER]}),SEND_TO_NOTEBOOK:le.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[P.CTRL,E.ENTER],macShortcut:[P.CMD,E.ENTER]}),RUN:le.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[P.ALT,E.R],macShortcut:[P.OPTION,E.R]})},cb={name:"Notebook",RUN:le.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[P.ALT,E.R],macShortcut:[P.OPTION,E.R]}),RUN_SELECTED:le.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[P.ALT,P.SHIFT,E.R],macShortcut:[P.OPTION,P.SHIFT,E.R]}),FIND:le.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[P.CTRL,E.F],macShortcut:[P.CMD,E.F],isEditable:!1}),MINIMAP:le.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[P.ALT,E.M],macShortcut:[P.OPTION,E.M]}),WORDWRAP:le.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[P.ALT,E.Z],macShortcut:[P.OPTION,E.Z]})},En={CONSOLE:ub,COMMAND_HISTORY:db,NOTEBOOK:cb};const Pe=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),hb="var(--dh-color-editor-bg)",mb="var(--dh-color-editor-fg)",pb="var(--dh-color-editor-string)",fb="var(--dh-color-editor-delimiter)",vb="var(--dh-color-editor-predefined)",gb="var(--dh-color-editor-keyword)",bb="var(--dh-color-editor-storage)",yb="var(--dh-color-editor-number)",Sb="var(--dh-color-editor-operator)",Cb="var(--dh-color-editor-identifier)",_b="var(--dh-color-editor-comment)",Pi={"error-foreground":"var(--dh-color-editor-error-fg)",background:hb,foreground:mb,"line-height":"19px",string:pb,"string-delim":"var(--dh-color-editor-string-delim)",delimiter:fb,predefined:vb,keyword:gb,storage:bb,number:yb,operator:Sb,identifier:Cb,"namespace-identifier":"var(--dh-color-editor-identifier-namespace)","identifier-js":"var(--dh-color-editor-identifier-js)",comment:_b,"editor-bracket-foreground1":"var(--dh-color-editor-bracket-fg1)","editor-bracket-foreground2":"var(--dh-color-editor-bracket-fg2)","editor-bracket-foreground3":"var(--dh-color-editor-bracket-fg3)","editor-bracket-foreground4":"var(--dh-color-editor-bracket-fg4)","editor-bracket-foreground5":"var(--dh-color-editor-bracket-fg5)","editor-bracket-foreground6":"var(--dh-color-editor-bracket-fg6)","editor-unexpected-bracket-foreground":"var(--dh-color-editor-unexpected-bracket-fg)","input-option-active-border":"var(--dh-color-editor-input-option-active-border)","focus-border":"var(--dh-color-editor-focus-border)","input-background":"var(--dh-color-editor-input-bg)","input-foreground":"var(--dh-color-editor-input-fg)","input-border":"var(--dh-color-editor-input-border)","editor-line-number-foreground":"var(--dh-color-editor-line-number-fg)","editor-line-number-active-foreground":"var(--dh-color-editor-line-number-active-fg)","editor-selection-background":"var(--dh-color-editor-selection-bg)","editor-inactive-selection-background":"var(--dh-color-editor-inactive-selection-bg)","editor-selection-highlight-background":"var(--dh-color-editor-selection-highlight-bg)","editor-line-highlight-background":"var(--dh-color-editor-line-highlight-bg)","editor-word-highlight-background":"var(--dh-color-editor-word-highlight-bg)","context-menu-background":"var(--dh-color-editor-context-menu-bg)","context-menu-foreground":"var(--dh-color-editor-context-menu-fg)","menu-selection-background":"var(--dh-color-editor-menu-selection-bg)","menu-selection-foreground":"var(--dh-color-editor-menu-selection-fg)","log-date":"var(--dh-color-editor-log-date)","log-error":"var(--dh-color-editor-log-error)","log-info":"var(--dh-color-editor-log-info)","log-stdout":"var(--dh-color-editor-log-stdout)","log-warn":"var(--dh-color-editor-log-warn)","log-debug":"var(--dh-color-editor-log-debug)","log-trace":"var(--dh-color-editor-log-trace)","editor-find-match-background":"var(--dh-color-editor-find-match-bg)","editor-find-match-highlight-background":"var(--dh-color-editor-find-match-highlight-bg)","editor-widget-background":"var(--dh-color-editor-find-bg)","input-option-active-background":"var(--dh-color-editor-find-option-active-bg)","input-option-active-foreground":"var(--dh-color-editor-find-option-active-fg)","editor-suggest-widget-background":"var(--dh-color-editor-suggest-bg)","editor-suggest-widget-border":"var(--dh-color-editor-suggest-border)","editor-suggest-widget-foreground":"var(--dh-color-editor-suggest-fg)","editor-suggest-widget-selected-background":"var(--dh-color-editor-suggest-selected-bg)","editor-suggest-widget-selected-foreground":"var(--dh-color-editor-suggest-selected-fg)","editor-suggest-widget-highlightForeground":"var(--dh-color-editor-suggest-highlight-fg)","editor-suggest-widget-focus-highlight-foreground":"var(--dh-color-editor-suggest-focus-highlight-fg)","list-hover-background":"var(--dh-color-editor-suggest-hover-bg)","text-link-foreground":"var(--dh-color-editor-link-foreground)","text-link-active-foreground":"var(--dh-color-editor-link-active-fg)","editor-link-active-foreground":"var(--dh-color-editor-link-active-fg)","diff-editor-inserted-text-background":"var(--dh-color-editor-diff-inserted-text-bg)","diff-editor-removed-text-background":"var(--dh-color-editor-diff-removed-text-bg)","diff-editor-inserted-line-background":"var(--dh-color-editor-diff-inserted-line-bg)","diff-editor-removed-line-background":"var(--dh-color-editor-diff-removed-line-bg)"};var wb="python",Eb={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},Pb={keywords:["and","del","from","not","while","as","elif","global","or","with","assert","else","if","pass","yield","break","except","import","print","exec","in","raise","continue","finally","is","return","for","try",":","=","isinstance","__debug__"],storage:["class","def","async","lambda"],operators:["+","-","*","**","/","//","%","<<",">>","&","|","^","~","<",">","<=",">=","==","!=","<>","+=","-=","*=","/","//=","%=","&=","|=","^=",">>=","<<=","**="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[=><!~&|+\-*/^%]+/,delimiters:/[;=.@:,`]/,escapes:/\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/,rawpre:/(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/,strpre:/(?:[buBU])/,tokenizer:{root:[[/@strpre?("""|''')/,{token:"string.delim",bracket:"@open",next:"@mstring.$1"}],[/@strpre?"([^"\\]|\\.)*$/,"string.invalid"],[/@strpre?'([^'\\]|\\.)*$/,"string.invalid"],[/@strpre?(["])/,{token:"string.delim",bracket:"@open",next:"@sstring.$1",nextEmbedded:"deephavenDb"}],[/@strpre?(["'])/,{token:"string.delim",bracket:"@open",next:"@string.$1"}],[/@rawpre("""|''')/,{token:"string.delim",bracket:"@open",next:"@mrawstring.$1"}],[/@rawpre"([^"\\]|\\.)*$/,"string.invalid"],[/@rawpre'([^'\\]|\\.)*$/,"string.invalid"],[/@rawpre(["'])/,{token:"string.delim",bracket:"@open",next:"@rawstring.$1"}],[/__[\w$]*/,"predefined"],[/[a-z_$][\w$]*/,{cases:{"@keywords":"keyword","@storage":"storage","@default":"identifier"}}],[/[A-Z][\w]*/,{cases:{"~[A-Z0-9_]+":"constructor.identifier","@default":"namespace.identifier"}}],{include:"@whitespace"},[/[{}()[\]]/,"@brackets"],[/@symbols/,{cases:{"@keywords":"keyword","@operators":"operator","@default":""}}],[/\d*\.\d+([eE][-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F]+[lL]?/,"number.hex"],[/0[bB][0-1]+[lL]?/,"number.binary"],[/(0[oO][0-7]+|0[0-7]+)[lL]?/,"number.octal"],[/(0|[1-9]\d*)[lL]?/,"number"],[":",{token:"keyword",bracket:"@open"}],[/@delimiters/,{cases:{"@keywords":"keyword","@default":"delimiter"}}]],comment:[[/[^/*]+/,"comment"],[/\/\*/,"comment","@push"],["\\*/","comment","@pop"],[/[/*]/,"comment"]],mstring:[{include:"@strcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],sstring:[{include:"@strcontent"},[/["]/,{token:"string.delim",bracket:"@close",next:"@pop",nextEmbedded:"@pop"}],[/./,"string.invalid"]],string:[{include:"@strcontent"},[/[']/,{token:"string.delim",bracket:"@close",next:"@pop"}],[/./,"string.invalid"]],strcontent:[[/[^\\"']+/,"string"],[/\\$/,"string.escape"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"]],mrawstring:[{include:"@rawstrcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],rawstring:[{include:"@rawstrcontent"},[/["']/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/./,"string.invalid"]],rawstrcontent:[[/[^\\"']+/,"string"],[/\\["']/,"string"],[/\\u[0-9A-Fa-f]{4}/,"string.escape"],[/\\/,"string"]],whitespace:[[/\s+/,"white"],[/(^#.*$)/,"comment"],[/'''/,"string","@endDocString"],[/"""/,"string","@endDblDocString"]],endDocString:[[/[^']+/,"string"],[/\\'/,"string"],[/'''/,"string","@popall"],[/'/,"string"]],endDblDocString:[[/[^"]+/,"string"],[/\\"/,"string"],[/"""/,"string","@popall"],[/"/,"string"]]}},Tb={id:wb,conf:Eb,language:Pb},Ob="groovy",Ib={comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},xb={keywords:["and","del","from","not","while","as","elif","global","or","with","assert","else","if","pass","yield","break","except","import","print","println","class","exec","in","raise","continue","finally","is","return","def","for","lambda","try",":","=","isinstance","__debug__"],operators:["+","-","*","**","/","//","%","<<",">>","&","|","^","~","<",">","<=",">=","==","!=","<>","+=","-=","*=","/","//=","%=","&=","|=","^=",">>=","<<=","**="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[=><!~&|+\-*/^%]+/,delimiters:/[;=.@:,`]/,escapes:/\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/,rawpre:/(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/,strpre:/(?:[buBU])/,tokenizer:{root:[[/@strpre?("""|''')/,{token:"string.delim",bracket:"@open",next:"@mstring.$1"}],[/@strpre?"([^"\\]|\\.)*$/,"string.invalid"],[/@strpre?'([^'\\]|\\.)*$/,"string.invalid"],[/@strpre?(["])/,{token:"string.delim",bracket:"@open",next:"@sstring.$1",nextEmbedded:"deephavenDb"}],[/@strpre?(["'])/,{token:"string.delim",bracket:"@open",next:"@string.$1"}],[/@rawpre("""|''')/,{token:"string.delim",bracket:"@open",next:"@mrawstring.$1"}],[/@rawpre"([^"\\]|\\.)*$/,"string.invalid"],[/@rawpre'([^'\\]|\\.)*$/,"string.invalid"],[/@rawpre(["'])/,{token:"string.delim",bracket:"@open",next:"@rawstring.$1"}],[/__[\w$]*/,"predefined"],[/[a-z_$][\w$]*/,{cases:{"@keywords":"keyword","@default":"identifier"}}],[/[A-Z][\w]*/,{cases:{"~[A-Z0-9_]+":"constructor.identifier","@default":"namespace.identifier"}}],{include:"@whitespace"},[/[{}()[\]]/,"@brackets"],[/@symbols/,{cases:{"@keywords":"keyword","@operators":"operator","@default":""}}],[/\d*\.\d+([eE][-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F]+[lL]?/,"number.hex"],[/0[bB][0-1]+[lL]?/,"number.binary"],[/(0[oO][0-7]+|0[0-7]+)[lL]?/,"number.octal"],[/(0|[1-9]\d*)[lL]?/,"number"],[":",{token:"keyword",bracket:"@open"}],[/@delimiters/,{cases:{"@keywords":"keyword","@default":"delimiter"}}]],mstring:[{include:"@strcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],sstring:[{include:"@strcontent"},[/["]/,{token:"string.delim",bracket:"@close",next:"@pop",nextEmbedded:"@pop"}],[/./,"string.invalid"]],string:[{include:"@strcontent"},[/[']/,{token:"string.delim",bracket:"@close",next:"@pop"}],[/./,"string.invalid"]],strcontent:[[/[^\\"']+/,"string"],[/\\$/,"string.escape"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"]],mrawstring:[{include:"@rawstrcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],rawstring:[{include:"@rawstrcontent"},[/["']/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/./,"string.invalid"]],rawstrcontent:[[/[^\\"']+/,"string"],[/\\["']/,"string"],[/\\u[0-9A-Fa-f]{4}/,"string.escape"],[/\\/,"string"]],whitespace:[[/[ \t\r\n]+/,""],[/\/\*\*(?!\/)/,"comment.doc","@doccomment"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^/*]+/,"comment"],[/\*\//,"comment","@pop"],[/[/*]/,"comment"]],doccomment:[[/[^/*]+/,"comment.doc"],[/\*\//,"comment.doc","@pop"],[/[/*]/,"comment.doc"]]}},Db={id:Ob,conf:Ib,language:xb},Mb="scala",jb={wordPattern:/(unary_[@~!#%^&*()\-=+\\|:<>/?]+)|([a-zA-Z_$][\w$]*?_=)|(`[^`]+`)|([a-zA-Z_$][\w$]*)/g,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],folding:{markers:{start:/^\s*\/\/\s*(?:(?:#?region\b)|(?:<editor-fold\b))/,end:/^\s*\/\/\s*(?:(?:#?endregion\b)|(?:<\/editor-fold>))/}}},Ab={keywords:["asInstanceOf","catch","class","classOf","def","do","else","extends","finally","for","foreach","forSome","if","import","isInstanceOf","macro","match","new","object","package","return","throw","trait","try","type","until","val","var","while","with","yield","given","enum","then"],softKeywords:["as","export","extension","end","derives","on"],constants:["true","false","null","this","super"],modifiers:["abstract","final","implicit","lazy","override","private","protected","sealed"],softModifiers:["inline","opaque","open","transparent","using"],name:/(?:[a-z_$][\w$]*|`[^`]+`)/,type:/(?:[A-Z][\w$]*)/,symbols:/[=><!~?:&|+\-*/^\\%@#]+/,digits:/\d+(_+\d+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,escapes:/\\(?:[btnfr\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,fstring_conv:/[bBhHsScCdoxXeEfgGaAt]|[Tn](?:[HIklMSLNpzZsQ]|[BbhAaCYyjmde]|[RTrDFC])/,tokenizer:{root:[[/\braw"""/,{token:"string.quote",bracket:"@open",next:"@rawstringt"}],[/\braw"/,{token:"string.quote",bracket:"@open",next:"@rawstring"}],[/\bs"""/,{token:"string.quote",bracket:"@open",next:"@sstringt"}],[/\bs"/,{token:"string.quote",bracket:"@open",next:"@sstring"}],[/\bf""""/,{token:"string.quote",bracket:"@open",next:"@fstringt"}],[/\bf"/,{token:"string.quote",bracket:"@open",next:"@fstring"}],[/"""/,{token:"string.quote",bracket:"@open",next:"@stringt"}],[/"/,{token:"string.quote",bracket:"@open",next:"@string"}],[/(@digits)[eE]([-+]?(@digits))?[fFdD]?/,"number.float","@allowMethod"],[/(@digits)\.(@digits)([eE][-+]?(@digits))?[fFdD]?/,"number.float","@allowMethod"],[/0[xX](@hexdigits)[Ll]?/,"number.hex","@allowMethod"],[/(@digits)[fFdD]/,"number.float","@allowMethod"],[/(@digits)[lL]?/,"number","@allowMethod"],[/\b_\*/,"key"],[/\b(_)\b/,"keyword","@allowMethod"],[/\bimport\b/,"keyword","@import"],[/\b(case)([ \t]+)(class)\b/,["keyword.modifier","white","keyword"]],[/\bcase\b/,"keyword","@case"],[/\bva[lr]\b/,"keyword","@vardef"],[/\b(def)([ \t]+)((?:unary_)?@symbols|@name(?:_=)|@name)/,["keyword","white","identifier"]],[/@name(?=[ \t]*:(?!:))/,"variable"],[/(\.)(@name|@symbols)/,[{token:"operator"},{token:"@rematch",next:"@allowMethod"}]],[/([{(])(\s*)(@name(?=\s*=>))/,["@brackets","white","variable"]],[/@name/,{cases:{"@keywords":"keyword","@softKeywords":"keyword","@modifiers":"keyword.modifier","@softModifiers":"keyword.modifier","@constants":{token:"constant",next:"@allowMethod"},"@default":{token:"identifier",next:"@allowMethod"}}}],[/@type/,"type","@allowMethod"],{include:"@whitespace"},[/@[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*/,"annotation"],[/[{(]/,"@brackets"],[/[})]/,"@brackets","@allowMethod"],[/\[/,"operator.square"],[/](?!\s*(?:va[rl]|def|type)\b)/,"operator.square","@allowMethod"],[/]/,"operator.square"],[/([=-]>|<-|>:|<:|:>|<%)(?=[\s\w()[\]{},."'`])/,"keyword"],[/@symbols/,"operator"],[/[;,.]/,"delimiter"],[/'[a-zA-Z$][\w$]*(?!')/,"attribute.name"],[/'[^\\']'/,"string","@allowMethod"],[/(')(@escapes)(')/,[{token:"string"},{token:"string.escape"},{token:"string",next:"@allowMethod"}]],[/'/,"string.invalid"]],import:[[/;/,"delimiter","@pop"],[/^|$/,"","@pop"],[/[ \t]+/,"white"],[/[\n\r]+/,"white","@pop"],[/\/\*/,"comment","@comment"],[/@name|@type/,"type"],[/[(){}]/,"@brackets"],[/[[\]]/,"operator.square"],[/[.,]/,"delimiter"]],allowMethod:[[/^|$/,"","@pop"],[/[ \t]+/,"white"],[/[\n\r]+/,"white","@pop"],[/\/\*/,"comment","@comment"],[/(?==>[\s\w([{])/,"keyword","@pop"],[/(@name|@symbols)(?=[ \t]*[[({"'`]|[ \t]+(?:[+-]?\.?\d|\w))/,{cases:{"@keywords":{token:"keyword",next:"@pop"},"->|<-|>:|<:|<%":{token:"keyword",next:"@pop"},"@default":{token:"@rematch",next:"@pop"}}}],["","","@pop"]],comment:[[/[^/*]+/,"comment"],[/\/\*/,"comment","@push"],[/\*\//,"comment","@pop"],[/[/*]/,"comment"]],case:[[/\b_\*/,"key"],[/\b(_|true|false|null|this|super)\b/,"keyword","@allowMethod"],[/\bif\b|=>/,"keyword","@pop"],[/`[^`]+`/,"identifier","@allowMethod"],[/@name/,"variable","@allowMethod"],[/:::?|\||@(?![a-z_$])/,"keyword"],{include:"@root"}],vardef:[[/\b_\*/,"key"],[/\b(_|true|false|null|this|super)\b/,"keyword"],[/@name/,"variable"],[/:::?|\||@(?![a-z_$])/,"keyword"],[/=|:(?!:)/,"operator","@pop"],[/$/,"white","@pop"],{include:"@root"}],string:[[/[^\\"\n\r]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}]],stringt:[[/[^\\"\n\r]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/"/,"string"]],fstring:[[/@escapes/,"string.escape"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/%%/,"string"],[/(%)([-#+ 0,(])(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","keyword.modifier","number","metatag"]],[/(%)(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","number","metatag"]],[/(%)([-#+ 0,(])(@fstring_conv)/,["metatag","keyword.modifier","metatag"]],[/(%)(@fstring_conv)/,["metatag","metatag"]],[/./,"string"]],fstringt:[[/@escapes/,"string.escape"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/%%/,"string"],[/(%)([-#+ 0,(])(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","keyword.modifier","number","metatag"]],[/(%)(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","number","metatag"]],[/(%)([-#+ 0,(])(@fstring_conv)/,["metatag","keyword.modifier","metatag"]],[/(%)(@fstring_conv)/,["metatag","metatag"]],[/./,"string"]],sstring:[[/@escapes/,"string.escape"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/./,"string"]],sstringt:[[/@escapes/,"string.escape"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/./,"string"]],interp:[[/{/,"operator","@push"],[/}/,"operator","@pop"],{include:"@root"}],rawstring:[[/[^"]/,"string"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}]],rawstringt:[[/[^"]/,"string"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/"/,"string"]],whitespace:[[/[ \t\r\n]+/,"white"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]]}},kb={id:Mb,conf:jb,language:Ab},Nb="deephavenDb",Lb={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},Rb={tokenPostfix:".js",keywords:["boolean","break","byte","case","catch","char","class","const","continue","debugger","default","delete","do","double","else","enum","export","extends","false","final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient","true","try","typeof","var","void","volatile","while","with"],builtins:["define","require","window","document","undefined"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.bracket"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[~!@#%\^&*-+=|\\:`<>.?\/]+/,escapes:/\\(?:[btnfr\\"']|[0-7][0-7]?|[0-3][0-7]{2})/,exponent:/[eE][\-+]?[0-9]+/,regexpctl:/[(){}\[\]\$\^|\-*+?\.]/,regexpesc:/\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,tokenizer:{root:[[/([a-zA-Z_\$][\w\$]*)(\s*)(:?)/,{cases:{"$1@keywords":["keyword","white","delimiter"],$3:["key.identifier","white","delimiter"],"$1@builtins":["predefined.identifier","white","delimiter"],"@default":["identifier","white","delimiter"]}}],{include:"@whitespace"},[/\/(?=([^\\\/]|\\.)+\/)/,{token:"regexp.slash",bracket:"@open",next:"@regexp"}],[/[{}()\[\]]/,"@brackets"],[/[;,.]/,"delimiter"],[/@symbols/,{cases:{"@operators":"operator","@default":""}}],[/\d+\.\d*(@exponent)?/,"number.float"],[/\.\d+(@exponent)?/,"number.float"],[/\d+@exponent/,"number.float"],[/0[xX][\da-fA-F]+/,"number.hex"],[/0[0-7]+/,"number.octal"],[/\d+/,"number"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/"/,"string",'@string."'],[/'/,"string","@string.'"]],whitespace:[[/[ \t\r\n]+/,"white"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^\/*]+/,"comment"],[/\/\*/,"comment.invalid"],["\\*/","comment","@pop"],[/[\/*]/,"comment"]],string:[[/[^\\"']+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/["']/,{cases:{"$#==$S2":{token:"string",next:"@pop"},"@default":"string"}}]],regexp:[[/(\{)(\d+(?:,\d*)?)(\})/,["@brackets.regexp.escape.control","regexp.escape.control","@brackets.regexp.escape.control"]],[/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,[{token:"@brackets.regexp.escape.control"},{token:"regexp.escape.control",next:"@regexrange"}]],[/(\()(\?:|\?=|\?!)/,["@brackets.regexp.escape.control","regexp.escape.control"]],[/[()]/,"@brackets.regexp.escape.control"],[/@regexpctl/,"regexp.escape.control"],[/[^\\\/]/,"regexp"],[/@regexpesc/,"regexp.escape"],[/\\\./,"regexp.invalid"],["/",{token:"regexp.slash",bracket:"@close"},"@pop"]],regexrange:[[/-/,"regexp.escape.control"],[/\^/,"regexp.invalid"],[/@regexpesc/,"regexp.escape"],[/[^\]]/,"regexp"],[/\]/,"@brackets.regexp.escape.control","@pop"]]}},$b={id:Nb,conf:Lb,language:Rb},Fb="log",Hb={},Ub={tokenizer:{root:[[/ FATAL[\s\S]*/,{token:"error",next:"@error"}],[/ ERROR[\s\S]*/,{token:"error",next:"@error"}],[/ STDERR[\s\S]*/,{token:"error",next:"@error"}],[/ STDOUT.*/,{token:"stdout",next:"@stdout"}],[/ INFO[\s\S]*/,{token:"info",next:"@info"}],[/ WARN.*/,{token:"warn",next:"@warn"}],[/ TRACE[\s\S]*/,{token:"trace",next:"@trace"}],[/ DEBUG[.\s\S]*/,{token:"debug",next:"@debug"}],[/^\d{2}:\d{2}:\d{2}.\d{3}/,"date"]],error:[{include:"@body"}],info:[{include:"@body"}],warn:[{include:"@body"}],stdout:[{include:"@body"}],trace:[{include:"@body"}],debug:[{include:"@body"}],body:[[/^\d{2}:\d{2}:\d{2}.\d{3}/,{token:"date",next:"@pop"}],[/[\s\S]*/,{token:"$S0"}]]}},Bb={id:Fb,conf:Hb,language:Ub},Wb={preview:!0,"target-version":"py38","line-length":88,"indent-width":4,format:{"indent-style":"space","quote-style":"double"},lint:{"flake8-implicit-str-concat":{"allow-multiline":!1},ignore:["ISC003"],select:["F","E1","E9","E711","W291","W293","W605","B","A","COM818","ISC","PLE","RUF001","RUF021","RUF027","PLR1704","LOG","ASYNC","RET501","RET502","RET503","PLC2401","PLC2403","NPY","PERF","C4"]}};function La(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Kb(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){La(o,r,i,a,s,"next",l)}function s(l){La(o,r,i,a,s,"throw",l)}a(void 0)})}}function Bt(n,e,t){return(e=zb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zb(n){var e=Vb(n,"string");return typeof e=="symbol"?e:e+""}function Vb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var et=B.module("MonacoCompletionProvider");class R extends m.PureComponent{static initRuff(){return Kb(function*(){if(R.isRuffEnabled)return R.initRuffPromise||(R.initRuffPromise=Nd({}).then(()=>{et.debug("Initialized Ruff",oo.version()),R.isRuffInitialized=!0,R.updateRuffWorkspace()})),R.initRuffPromise})()}static updateRuffWorkspace(){if(R.isRuffInitialized){var e=console.log;try{console.log=()=>{},R.ruffWorkspace=new oo(R.ruffSettings)}finally{console.log=e}R.lintAllPython()}}static setRuffSettings(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:R.ruffSettings;if(R.ruffSettings=e,!R.isRuffInitialized){R.initRuff();return}R.updateRuffWorkspace()}static getDiagnostics(e){if(!R.ruffWorkspace)return[];var t=R.ruffWorkspace.check(e.getValue());return Te.isConsoleModel(e)?t.filter(r=>r.code==null):t}static lintAllPython(){if(!R.isRuffEnabled){Re.removeAllMarkers("ruff");return}Re.getModels().filter(e=>e.getLanguageId()==="python").forEach(R.lintPython)}static lintPython(e){if(R.isRuffEnabled&&R.ruffWorkspace){var t=R.getDiagnostics(e);et.debug("Linting Python document: ".concat(e.uri.toString()),t),Re.setModelMarkers(e,"ruff",t.map(r=>{var i=r.code==="F401"||r.code==="F841",o=r.code==null;return{startLineNumber:r.location.row,startColumn:r.location.column,endLineNumber:r.end_location.row,endColumn:r.end_location.column,message:o?r.message:"".concat(r.code,": ").concat(r.message),severity:o?ao.Error:ao.Warning,tags:i?[kd.Unnecessary]:[]}}))}}static lspToMonacoKind(e){var t=rt.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 t=e.start,r=e.end;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}}static handlePythonCodeActionRequest(e,t){if(!R.isRuffEnabled||!R.ruffWorkspace)return{actions:[],dispose:()=>{}};var r=R.getDiagnostics(e).filter(u=>{var d=new Xs(u.location.row,u.location.column,u.end_location.row,u.end_location.column);return u.code!=null&&d.intersectRanges(t)}),i=r.filter(u=>{var d=u.fix;return d!=null}).map(u=>{var d="Fix";return u.fix!=null&&(u.fix.message!=null&&u.fix.message!==""?d="".concat(u.code,": ").concat(u.fix.message):d="Fix ".concat(u.code)),{title:d,id:"fix-".concat(u.code),kind:"quickfix",edit:u.fix?{edits:u.fix.edits.map(h=>{var p;return{resource:e.uri,versionId:e.getVersionId(),textEdit:{range:{startLineNumber:h.location.row,startColumn:h.location.column,endLineNumber:h.end_location.row,endColumn:h.end_location.column},text:(p=h.content)!==null&&p!==void 0?p:""}}})}:void 0}}),o=new Set,a=new Set;r.forEach(u=>{u.code!=null&&(o.has(u.code)&&a.add(u.code),o.add(u.code))});var s=r.map(u=>{if(u.code==null)return[];var d=e.getLineContent(u.location.row),h=Re.tokenize(d,e.getLanguageId())[0].at(-1),p={range:{startLineNumber:u.location.row,startColumn:d.length+1,endLineNumber:u.location.row,endColumn:d.length+1},text:" # noqa: ".concat(u.code)};return h!=null&&h.type.startsWith("comment")&&(p.text="# noqa: ".concat(u.code," "),d.startsWith("# noqa:",h.offset)?(p.range.startColumn=h.offset+1,p.range.endColumn=h.offset+9):(p.range.startColumn=h.offset+1,p.range.endColumn=d.startsWith("# ",h.offset)?h.offset+3:h.offset+2)),[{title:"Disable ".concat(u.code," for ").concat(a.has(u.code)?"line ".concat(u.location.row):"this line"),kind:"quickfix",edit:{edits:[{resource:e.uri,versionId:e.getVersionId(),textEdit:p}]}}]}).flat().filter((u,d,h)=>h.find(p=>p.title===u.title)===u),l=[...o].map(u=>({title:"Disable ".concat(u," for this file"),kind:"quickfix",edit:{edits:[{resource:e.uri,versionId:e.getVersionId(),textEdit:{range:{startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:1},text:"# ruff: noqa: ".concat(u,`
22
- `)}}]}}));return{actions:[...i,...s,...l],dispose:()=>{}}}static handlePythonFormatRequest(e,t,r){if(R.ruffWorkspace)return et.debug("Formatting Python document: ".concat(e.uri.toString)),[{range:e.getFullModelRange(),text:R.ruffWorkspace.format(e.getValue())}]}constructor(e){super(e),Bt(this,"registeredCompletionProvider",void 0),Bt(this,"registeredSignatureProvider",void 0),Bt(this,"registeredHoverProvider",void 0),this.handleCompletionRequest=this.handleCompletionRequest.bind(this),this.handleSignatureRequest=this.handleSignatureRequest.bind(this),this.handleHoverRequest=this.handleHoverRequest.bind(this)}componentDidMount(){var e=this.props,t=e.language,r=e.session;this.registeredCompletionProvider=rt.registerCompletionItemProvider(t,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),r.getSignatureHelp!=null&&(this.registeredSignatureProvider=rt.registerSignatureHelpProvider(t,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),r.getHover!=null&&(this.registeredHoverProvider=rt.registerHoverProvider(t,{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 i=this.props,o=i.model,a=i.session;if(e!==o)return null;var s={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:R.monacoToLspPosition(t),context:r},l=a.getCompletionItems(s);et.debug("Requested completion items",s);var u=l.then(d=>{et.debug("Completion items received: ",s,d);var h=d.map(p=>{var f=p.label,v=p.kind,g=p.detail,b=p.documentation,y=p.sortText,S=p.filterText,C=p.textEdit,_=p.insertTextFormat;return{label:f,kind:R.lspToMonacoKind(v),detail:g,documentation:(b==null?void 0:b.kind)==="markdown"?b:b==null?void 0:b.value,sortText:y,filterText:S,insertText:C.text,insertTextRules:_===2?4:_,range:R.lspToMonacoRange(C.range)}});return{incomplete:!0,suggestions:h}}).catch(d=>(et.error("There was an error retrieving completion items",d),{suggestions:[]}));return u}handleSignatureRequest(e,t,r,i){var o={value:{signatures:[],activeSignature:0,activeParameter:0},dispose:()=>{}},a=this.props,s=a.model,l=a.session;if(e!==s||l.getSignatureHelp==null)return null;var u={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:R.monacoToLspPosition(t),context:i},d=l.getSignatureHelp(u);et.debug("Requested signature help",u);var h=d.then(p=>{et.debug("Signatures received: ",u,d);var f=p.map(g=>{var b=g.label,y=g.documentation,S=g.parameters;return{documentation:(y==null?void 0:y.kind)==="markdown"?y:y==null?void 0:y.value,label:b,parameters:S??[]}});if(f.length===0)return o;var v=0;return{value:{signatures:f,activeSignature:v,activeParameter:p[v].activeParameter},dispose:()=>{}}}).catch(p=>(et.error("There was an error retrieving completion items",p),o));return h}handleHoverRequest(e,t){var r=this.props,i=r.model,o=r.session;if(e!==i||o.getHover==null)return null;var a={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:R.monacoToLspPosition(t)},s=o.getHover(a);et.debug("Requested hover",a);var l=s.then(u=>{et.debug("Hover received: ",a,u);var d=u.contents;return{contents:d!=null?[d]:[]}}).catch(u=>(et.error("There was an error retrieving hover",u),{contents:[]}));return l}render(){return null}}Bt(R,"ruffWorkspace",void 0);Bt(R,"initRuffPromise",void 0);Bt(R,"isRuffInitialized",!1);Bt(R,"isRuffEnabled",!0);Bt(R,"ruffSettings",Wb);function Ra(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Gb(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Ra(o,r,i,a,s,"next",l)}function s(l){Ra(o,r,i,a,s,"throw",l)}a(void 0)})}}function $a(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 Fa(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?$a(Object(t),!0).forEach(function(r){Xb(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):$a(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Xb(n,e,t){return(e=qb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qb(n){var e=Zb(n,"string");return typeof e=="symbol"?e:e+""}function Zb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var St=B.module("MonacoUtils"),Ha="inmemory://dh-console/";class Te{static init(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.getWorker;St.debug("Initializing Monaco..."),t!==void 0&&Te.registerGetWorker(t);var r=Te.initTheme,i=Te.registerLanguages;r(),i([$b,Tb,Db,Bb,kb]),rt.onLanguage("python",()=>{rt.registerCodeActionProvider("python",{provideCodeActions:R.handlePythonCodeActionRequest},{providedCodeActionKinds:["quickfix"]}),rt.registerDocumentFormattingEditProvider("python",{provideDocumentFormattingEdits:R.handlePythonFormatRequest})}),Re.onDidCreateModel(o=>{if(o.getLanguageId()==="python"){R.ruffWorkspace!=null&&R.lintPython(o);var a=Mr(s=>R.lintPython(s),250);o.onDidChangeContent(()=>{a(o)})}}),Te.removeConflictingKeybindings(),St.debug("Monaco initialized.")}static initTheme(){var e,t,r=Te.removeHashtag,i=Fs(Pi);St.debug2("Monaco theme:",Pi),St.debug2("Monaco theme derived:",i);var o=[{token:"",foreground:r(i.foreground)},{token:"string",foreground:r(i.string)},{token:"string.delim",foreground:r(i["string-delim"])},{token:"keyword",foreground:r(i.keyword)},{token:"identifier.js",foreground:r(i["identifier-js"])},{token:"delimiter",foreground:r(i.delimiter)},{token:"comment",foreground:r(i.comment)},{token:"number",foreground:r(i.number)},{token:"storage",foreground:r(i.storage)},{token:"identifier",foreground:r(i.identifier)},{token:"namespace.identifier",foreground:r(i["namespace-identifier"])},{token:"operator",foreground:r(i.operator)},{token:"predefined",foreground:r(i.predefined)},{token:"error.log",foreground:(e=(t=i["log-error"])===null||t===void 0?void 0:t.substring(1))!==null&&e!==void 0?e:""},{token:"warn.log",foreground:r(i["log-warn"])},{token:"info.log",foreground:r(i["log-info"])},{token:"stdout.log",foreground:r(i["log-stdout"])},{token:"trace.log",foreground:r(i["log-trace"])},{token:"debug.log",foreground:r(i["log-debug"])},{token:"date.log",foreground:r(i["log-date"])}],a={foreground:i.foreground,errorForeground:i["error-foreground"],"inputOption.activeBorder":i["input-option-active-border"],"editor.background":i.background,"editor.foreground":i.foreground,"editor.lineHighlightBackground":i["editor-line-highlight-background"],"editorLineNumber.foreground":i["editor-line-number-foreground"],"editorLineNumber.activeForeground":i["editor-line-number-active-foreground"],"editor.selectionBackground":i["editor-selection-background"],"editor.inactiveSelectionBackground":i["editor-inactive-selection-background"],"editor.selectionHighlightBackground":i["editor-selection-highlight-background"],"editor.wordHighlightBackground":i["editor-word-highlight-background"],"editor.findMatchBackground":i["editor-find-match-background"],"editor.findMatchHighlightBackground":i["editor-find-match-highlight-background"],"editorSuggestWidget.background":i["editor-suggest-widget-background"],"editorSuggestWidget.border":i["editor-suggest-widget-border"],"editorSuggestWidget.foreground":i["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":i["editor-suggest-widget-selected-background"],"list.activeSelectionBackground":i["editor-suggest-widget-selected-background"],"editorSuggestWidget.selectedForeground":i["editor-suggest-widget-selected-foreground"],"list.activeSelectionForeground":i["editor-suggest-widget-selected-foreground"],"editorSuggestWidget.highlightForeground":i["editor-suggest-widget-highlightForeground"],"editorSuggestWidget.focusHighlightForeground":i["editor-suggest-widget-focus-highlight-foreground"],"list.hoverBackground":i["list-hover-background"],"dropdown.background":i["context-menu-background"],"dropdown.foreground":i["context-menu-foreground"],"menu.selectionBackground":i["menu-selection-background"],"menu.selectionForeground":i["menu-selection-foreground"],"keybindingLabel.foreground":i["menu-selection-foreground"],"list.focusBackground":i["menu-selection-background"],"editorWidget.background":i["editor-widget-background"],"inputOption.activeBackground":i["input-option-active-background"],"inputOption.activeForeground":i["input-option-active-foreground"],focusBorder:i["focus-border"],"input.background":i["input-background"],"input.foreground":i["input-foreground"],"input.border":i["input-border"],"textLink.foreground":i["text-link-foreground"],"textLink.activeForeground":i["text-link-active-foreground"],"editorLink.activeForeground":i["editor-link-active-foreground"],"editorBracketHighlight.foreground1":i["editor-bracket-foreground1"],"editorBracketHighlight.foreground2":i["editor-bracket-foreground2"],"editorBracketHighlight.foreground3":i["editor-bracket-foreground3"],"editorBracketHighlight.foreground4":i["editor-bracket-foreground4"],"editorBracketHighlight.foreground5":i["editor-bracket-foreground5"],"editorBracketHighlight.foreground6":i["editor-bracket-foreground6"],"editorBracketHighlight.unexpectedBracket.foreground":i["editor-unexpected-bracket-foreground"],"diffEditor.insertedTextBackground":i["diff-editor-inserted-text-background"],"diffEditor.removedTextBackground":i["diff-editor-removed-text-background"],"diffEditor.insertedLineBackground":i["diff-editor-inserted-line-background"],"diffEditor.removedLineBackground":i["diff-editor-removed-line-background"]};Re.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:o,colors:a});try{Re.setTheme("dh-dark")}catch(s){St.error("Failed to set 'dh-dark' Monaco theme, falling back to vs-dark",s),Re.setTheme("vs-dark")}}static registerGetWorker(e){window.MonacoEnvironment=Fa(Fa({},window.MonacoEnvironment),{},{getWorker:e})}static removeHashtag(e){var t;return(t=e==null?void 0:e.substring(1))!==null&&t!==void 0?t:""}static registerLanguages(e){var t=e.map(r=>{var i=r.id;return i});rt.getLanguages().filter(r=>{var i=r.id;return t.includes(i)}).forEach(r=>{var i=r;St.debug2("Overriding default language loader:",i.id)}),e.forEach(r=>{Te.registerLanguage(r)})}static registerLanguage(e){St.debug2("Registering language: ",e.id),rt.register(e),rt.onLanguage(e.id,()=>{rt.setLanguageConfiguration(e.id,e.conf),rt.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Re.EndOfLineSequence.LF;(t=e.getModel())===null||t===void 0||t.setEOL(r)}static openDocument(e,t){var r=e.getModel();W(r);var i={textDocument:{uri:"".concat(r.uri),languageId:r.getLanguageId(),version:r.getVersionId(),text:r.getValue()}};St.debug2("didOpenDocumentParams: ",i),t.openDocument(i);var o=e.onDidChangeModelContent(a=>{for(var s=a.changes,l=a.versionId,u=[],d=0;d<s.length;d+=1){var h=s[d],p=h.range,f=h.rangeLength,v=h.text,g={range:{start:{line:p.startLineNumber-1,character:p.startColumn-1},end:{line:p.endLineNumber-1,character:p.endColumn-1}},rangeLength:f,text:v};u.push(g)}if(u.length>0){var b={textDocument:{version:l,uri:"".concat(r.uri)},contentChanges:u};St.debug2("didChangeDocumentParams",b),t.changeDocument(b)}});return o}static closeDocument(e,t){var r=e.getModel();W(r);var i={textDocument:{uri:"".concat(r.uri)}};t.closeDocument(i)}static registerPasteHandler(e){e.onDidPaste(t=>{var r=/“|”/g,i=/\u200b/g,o=/\u00A0/g,a=e.getModel();W(a);var s=a.getValueInRange(t.range);(r.test(s)||i.test(s)||o.test(s))&&a.applyEdits([{range:t.range,text:s.replace(r,'"').replace(i,"").replace(o," ")}])})}static isMacPlatform(){var e=window.navigator.platform;return e.startsWith("Mac")}static removeConflictingKeybindings(){Re.addKeybindingRule({keybinding:nt.CtrlCmd|tn.KeyD,command:null}),Te.isMacPlatform()||Re.addKeybindingRule({keybinding:nt.CtrlCmd|tn.KeyH,command:null})}static disableKeyBindings(e,t){e.addAction({id:"disable-keybindings-".concat(Pt()),label:"",keybindings:t,run:()=>{}})}static getMonacoKeyCodeFromShortcut(e){var t=e.keyState,r=t.keyValue;if(r===null)return 0;var i=Te.isMacPlatform();return i?(t.metaKey?nt.CtrlCmd:0)|(t.shiftKey?nt.Shift:0)|(t.altKey?nt.Alt:0)|(t.ctrlKey?nt.WinCtrl:0)|so.fromString(r):(t.ctrlKey?nt.CtrlCmd:0)|(t.shiftKey?nt.Shift:0)|(t.altKey?nt.Alt:0)|(t.metaKey?nt.WinCtrl:0)|so.fromString(r)}static provideLinks(e){for(var t=[],r=function(a){var s=e.getLineContent(a),l=Rd(s),u=l.filter(d=>d.type==="url"?/^https?:\/\//.test(d.value):!0);u.forEach(d=>{t.push({url:d.href,range:new Xs(a,d.start+1,a,d.end+1)})})},i=1;i<=e.getLineCount();i+=1)r(i);return{links:t}}static generateConsoleUri(){return Ld.parse("".concat(Ha).concat(Pt()))}static isConsoleModel(e){return e.uri.toString().startsWith(Ha)}static canFormat(e){var t;return((t=e.getAction("editor.action.formatDocument"))===null||t===void 0?void 0:t.isSupported())===!0}static formatDocument(e){return Gb(function*(){var t;yield(t=e.getAction("editor.action.formatDocument"))===null||t===void 0?void 0:t.run()})()}}function Ua(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Yb(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Ua(o,r,i,a,s,"next",l)}function s(l){Ua(o,r,i,a,s,"throw",l)}a(void 0)})}}function qe(n,e,t){return(e=Jb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Jb(n){var e=Qb(n,"string");return typeof e=="symbol"?e:e+""}function Qb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ei=B.module("ConsoleInput"),Ir=parseInt(Pi["line-height"],10),_u=6,wu=6,ey=Ir+_u+wu,ti=100;class In extends m.PureComponent{constructor(e){super(e),qe(this,"cancelListener",void 0),qe(this,"resizeObserver",void 0),qe(this,"commandContainer",void 0),qe(this,"commandEditor",void 0),qe(this,"commandHistoryIndex",void 0),qe(this,"commandSuggestionContainer",void 0),qe(this,"loadingPromise",void 0),qe(this,"timestamp",void 0),qe(this,"bufferIndex",void 0),qe(this,"history",void 0),qe(this,"modifiedCommands",void 0),this.handleResize=this.handleResize.bind(this),this.commandContainer=k.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:Ir,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(ei.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 e=this.props,t=e.language,r=e.session,i=Re.createModel("",t,Te.generateConsoleUri()),o={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:t,lineHeight:Ir,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:_u,bottom:wu},value:"",wordWrap:"on",autoClosingBrackets:"beforeWhitespace",model:i},a=this.commandContainer.current;W(a),this.commandEditor=Re.create(a,o),Te.setEOL(this.commandEditor),Te.openDocument(this.commandEditor,r),this.commandEditor.onDidChangeModelContent(()=>{var s,l=(s=this.commandEditor)===null||s===void 0?void 0:s.getValue();this.modifiedCommands.set(this.commandHistoryIndex,l??null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(s=>{var l=this.commandEditor,u=this.commandHistoryIndex,d=l==null?void 0:l.getPosition();W(d);var h=d.lineNumber;if(!s.altKey&&!s.shiftKey&&!s.metaKey){if(s.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&h===1){u!=null?this.loadCommand(u+1):this.loadCommand(0),this.focusStart(),s.stopPropagation(),s.preventDefault();return}if(s.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&h===(i==null?void 0:i.getLineCount())){u!=null&&u>0?this.loadCommand(u-1):this.loadCommand(null),this.focusEnd(),s.stopPropagation(),s.preventDefault();return}if(s.keyCode===tn.Enter&&!this.isSuggestionMenuPopulated()){var p;s.stopPropagation(),s.preventDefault();var f=(p=this.commandEditor)===null||p===void 0?void 0:p.getValue().trim();if(f!==void 0){var v;this.processCommand(f),(v=this.commandEditor)===null||v===void 0||v.setValue("")}}}}),Te.disableKeyBindings(this.commandEditor,[nt.CtrlCmd|tn.KeyF]),Te.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.resizeObserver.observe(a),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){var e=this.props.session;this.commandEditor&&(Te.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleResize(){this.updateDimensions()}isSuggestionMenuActive(){var e;if(!this.commandSuggestionContainer){var t;this.commandSuggestionContainer=(t=this.commandEditor)===null||t===void 0||(t=t.getDomNode())===null||t===void 0?void 0:t.querySelector(".suggest-widget")}return(e=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!==null&&e!==void 0?e:!1}isSuggestionMenuPopulated(){var e,t;return this.isSuggestionMenuActive()&&((e=(t=this.commandSuggestionContainer)===null||t===void 0||(t=t.querySelector(".monaco-list-rows"))===null||t===void 0?void 0:t.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,o,a=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();W(a);var s=a.getLineLength(1)+1,l=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(1,s);W(l),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:1,column:s}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(l),(o=this.commandEditor)===null||o===void 0||o.focus()}focusEnd(){var e,t,r,i,o,a=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();W(a);var s=a.getLineCount(),l=a.getLineLength(s)+1,u=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(s,l);W(u),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:s,column:l}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(u),(o=this.commandEditor)===null||o===void 0||o.focus()}clear(){var e,t;(e=this.commandEditor)===null||e===void 0||e.focus(),(t=this.commandEditor)===null||t===void 0||(t=t.getModel())===null||t===void 0||t.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var t;if(!(e!==null&&e>=this.history.length)){var r=this.modifiedCommands.get(e),i=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,(t=this.commandEditor)===null||t===void 0||(t=t.getModel())===null||t===void 0||t.setValue(r??i),e!==null&&e>this.history.length-ti&&this.loadMoreHistory()}}loadMoreHistory(){var e=this;return Yb(function*(){try{if(e.loadingPromise!=null||e.bufferIndex==null)return;var t=e.props,r=t.commandHistoryStorage,i=t.language,o=t.scope;e.loadingPromise=Je.makeCancelable(r.getTable(i,o??"",e.timestamp),l=>l.close());var a=yield e.loadingPromise;a.setReversed(!0),a.setViewport({top:e.bufferIndex,bottom:e.bufferIndex+ti-1}),e.loadingPromise=Je.makeCancelable(a.getViewportData(),()=>a.close());var s=yield e.loadingPromise;e.bufferIndex+=ti,e.bufferIndex>=a.size&&(e.bufferIndex=null),e.history=[...s.items.filter((l,u,d)=>{var h=l.name;return u===0||h!==d[u-1].name}).map(l=>{var u=l.name;return u}).reverse(),...e.history],e.loadingPromise=void 0,a.close()}catch(l){if(e.loadingPromise=void 0,Je.isCanceled(l)){ei.debug2("Promise canceled, not loading history");return}ei.error("Error fetching history",l)}})()}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),W(e),e!==""&&(this.history.length===0||e!==this.history[this.history.length-1])&&this.history.push(e),this.updateDimensions();var t=this.props.onSubmit;t(e)}updateDimensions(){if(this.commandEditor){var e=this.props.maxHeight;W(e);var t=this.commandEditor.getContentHeight(),r=Math.max(Math.min(t,e),ey),i=t>r,o={overviewRulerLanes:i?void 0:0};this.setState({commandEditorHeight:r},()=>{var a,s;(a=this.commandEditor)===null||a===void 0||a.updateOptions(o),(s=this.commandEditor)===null||s===void 0||s.layout()})}}render(){var e=this.props,t=e.disabled,r=e.language,i=e.session,o=this.state,a=o.commandEditorHeight,s=o.isFocused,l=o.model;return c.jsx("div",{className:U("console-input-wrapper",{disabled:t}),children:c.jsxs("div",{className:U("console-input-inner-wrapper",{focus:s}),children:[c.jsx("div",{className:In.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:a}}),l&&c.jsx(R,{model:l,language:r,session:i})]})})}}qe(In,"defaultProps",{maxHeight:Ir*10,scope:null,disabled:!1});qe(In,"INPUT_CLASS_NAME","console-input");function Ft(n,e,t){return(e=ty(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:e+""}function ny(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ba="pasted values",ry=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],ni=[".csv",".tsv",".tab",".psv",".dsv",".txt"],Wa=[".zip"];class $e extends m.Component{static isValidDropItem(e){return e!=null&&e.kind==="file"&&!ry.find(t=>t.test(e.type))}static isValidExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return ni.some(r=>e.endsWith(r))||t&&Wa.some(r=>e.endsWith(r))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===Ba?to:e.endsWith(".csv")?ed:e.endsWith(".zip")?td:nd}constructor(e){super(e),Ft(this,"fileElem",void 0),Ft(this,"divElem",void 0),Ft(this,"getValidExtensions",_n(t=>t?[...ni,...Wa]:[...ni])),Ft(this,"getAcceptString",_n(t=>this.getValidExtensions(t).join(", "))),Ft(this,"getFileTypeErrorString",_n(t=>gc.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=k.createRef(),this.divElem=k.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 t=e.target.files;t!=null&&this.handleFile(t[0])}handleDrop(e){var t=this.props,r=t.allowZip,i=t.clearDragError,o=t.dragError;if(e.preventDefault(),e.stopPropagation(),o!=null){i();return}if(!(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)){var a=e.dataTransfer.items[0].getAsFile();W(a),$e.isValidExtension(a.name,r)?this.handleFile(a):this.setState({dropError:$e.FILE_TYPE_ERROR})}}unstageFile(e){var t=this.props.onCancel;e.stopPropagation(),e.preventDefault(),t(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(e){var t=this.props.onFileOpened;t(e),this.setState({selectedFileName:e.name,dropError:void 0})}handleMenuPaste(){var e=this.props,t=e.onPaste,r=e.onError,i=e.uploadInProgress;i||navigator.clipboard.readText().then(o=>{t(o),this.setState({selectedFileName:Ba,dropError:void 0})}).catch(o=>r(o))}handlePasteEvent(e){e.stopPropagation(),e.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){var e=this.props.uploadInProgress;return[{title:"Paste",icon:to,action:this.handleMenuPaste,shortcut:yn.PASTE,disabled:e}]}render(){var e=this.props,t=e.allowZip,r=e.dragError,i=e.uploadInProgress,o=this.state,a=o.selectedFileName,s=o.dropError,l=r??s,u=this.makeContextMenuItems();return c.jsxs("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:$e.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[c.jsx(de,{actions:u}),c.jsx("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(t),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!a&&(l===void 0||l==="")&&c.jsxs("div",{className:"message-content",children:[c.jsx("div",{className:"message-icon",children:c.jsx(me,{icon:rd})}),c.jsx("label",{children:"Drop file (or paste values) here to import"}),c.jsx("div",{className:"message-small",children:c.jsx("label",{children:"or"})}),c.jsx(ne,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),a&&(l===void 0||l==="")&&c.jsxs("div",{className:"selected-content",children:[c.jsx("div",{className:"selected-icon",children:c.jsx(me,{icon:$e.getIcon(a)})}),c.jsxs("div",{className:"selected-text",children:[c.jsx("label",{children:"Selected File"}),c.jsxs("label",{className:"selected-name",children:[a,!i&&c.jsx(ne,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:id,tooltip:"Remove"})]})]})]}),!!l&&c.jsxs("div",{className:"message-content",children:[c.jsx("div",{className:"message-icon",children:c.jsx(me,{icon:Bs})}),c.jsx("label",{children:l}),l===$e.FILE_TYPE_ERROR&&c.jsx("div",{className:"message-small",children:c.jsx("label",{children:this.getFileTypeErrorString(t)})})]})]})}}Ft($e,"defaultProps",{allowZip:!1,dragError:null});Ft($e,"MULTIPLE_FILE_ERROR","Please select only one file");Ft($e,"FILE_TYPE_ERROR","Filetype not supported.");function Eu(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 Ka(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 za(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ka(Object(t),!0).forEach(function(r){ke(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ka(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ke(n,e,t){return(e=iy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function iy(n){var e=oy(n,"string");return typeof e=="symbol"?e:e+""}function oy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Va="unknown",ay=2147483647,sy=-2147483648,Ga=/^[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]+)?$/,Xa=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class Ie{static determineType(e,t,r){if(!e||e===r)return t;switch(t){case K.STRING:return K.STRING;case K.INTEGER:return Ie.checkInteger(e);case K.LONG:return Ie.checkLong(e);case K.DOUBLE:return Ie.checkDouble(e);case K.BOOLEAN:return Ie.checkBoolean(e);case K.DATE_TIME:return Ie.checkDateTime(e);case K.LOCAL_TIME:return Ie.checkLocalTime(e);default:return Ie.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){var t=e.replace(/,/g,"");return Ie.isNotParsableNumber(t)?K.STRING:Ie.getNumberType(t)}static checkLong(e){var t=e.replace(/,/g,"");return Ie.isNotParsableNumber(t)?K.STRING:t.includes(".")?K.DOUBLE:K.LONG}static checkDouble(e){var t=e.replace(/,/g,"");return Ie.isNotParsableNumber(t)?K.STRING:K.DOUBLE}static checkBoolean(e){var t=e.toLowerCase();return t==="true"||t==="false"?K.BOOLEAN:K.STRING}static checkDateTime(e){return Ga.test(e)?K.DATE_TIME:K.STRING}static checkLocalTime(e){return Xa.test(e)?K.LOCAL_TIME:K.STRING}static getTypeFromUnknown(e){var t=e.replace(/,/g,"");if(Ie.isNotParsableNumber(t)){var r=e.toLowerCase();return r==="true"||r==="false"?K.BOOLEAN:Ga.test(e)&&e.includes(":")?K.DATE_TIME:Xa.test(e)?K.LOCAL_TIME:K.STRING}return Ie.getNumberType(t)}static getNumberType(e){if(e.includes("."))return K.DOUBLE;var t=e.startsWith("-")?11:10;if(e.length>t)return K.LONG;var r=parseInt(e,10);return r>ay||r<sy?K.LONG:K.INTEGER}constructor(e,t,r,i,o,a,s,l,u,d){ke(this,"onFileCompleted",void 0),ke(this,"file",void 0),ke(this,"readHeaders",void 0),ke(this,"nullString",void 0),ke(this,"onProgress",void 0),ke(this,"onError",void 0),ke(this,"types",void 0),ke(this,"chunks",void 0),ke(this,"totalChunks",void 0),ke(this,"rowCount",void 0),ke(this,"isZip",void 0),ke(this,"shouldTrim",void 0),ke(this,"zipProgress",void 0),ke(this,"config",void 0),this.onFileCompleted=e,this.file=t,this.readHeaders=r,this.nullString=o,this.onProgress=a,this.onError=s,this.chunks=0,this.totalChunks=l,this.rowCount=0,this.isZip=u,this.shouldTrim=d,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=za(za({},i),{},{error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete})}parse(){if(this.file instanceof File||this.file instanceof Blob)Fn.parse(this.file,this.config);else{var e=Eu(this.file,this.handleNodeUpdate);Fn.parse(e,this.config),e.resume()}}handleChunk(e,t){var r=e.data;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(Va),this.readHeaders&&(r=r.slice(1))}this.rowCount+=r.length,W(this.types);var i=[...this.types];r.forEach(s=>{if(s.length>=i.length){for(var l=0;l<i.length;l+=1)i[l]=Ie.determineType(this.shouldTrim?s[l].trim():s[l],i[l],this.nullString);this.types=i}else t.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
22
+ `)}}]}}));return{actions:[...i,...s,...l],dispose:()=>{}}}static handlePythonFormatRequest(e,t,r){if(R.ruffWorkspace)return et.debug("Formatting Python document: ".concat(e.uri.toString)),[{range:e.getFullModelRange(),text:R.ruffWorkspace.format(e.getValue())}]}constructor(e){super(e),Bt(this,"registeredCompletionProvider",void 0),Bt(this,"registeredSignatureProvider",void 0),Bt(this,"registeredHoverProvider",void 0),this.handleCompletionRequest=this.handleCompletionRequest.bind(this),this.handleSignatureRequest=this.handleSignatureRequest.bind(this),this.handleHoverRequest=this.handleHoverRequest.bind(this)}componentDidMount(){var e=this.props,t=e.language,r=e.session;this.registeredCompletionProvider=rt.registerCompletionItemProvider(t,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),r.getSignatureHelp!=null&&(this.registeredSignatureProvider=rt.registerSignatureHelpProvider(t,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),r.getHover!=null&&(this.registeredHoverProvider=rt.registerHoverProvider(t,{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 i=this.props,o=i.model,a=i.session;if(e!==o)return null;var s={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:R.monacoToLspPosition(t),context:r},l=a.getCompletionItems(s);et.debug("Requested completion items",s);var u=l.then(d=>{et.debug("Completion items received: ",s,d);var h=d.map(p=>{var f=p.label,v=p.kind,g=p.detail,b=p.documentation,y=p.sortText,S=p.filterText,C=p.textEdit,_=p.insertTextFormat;return{label:f,kind:R.lspToMonacoKind(v),detail:g,documentation:(b==null?void 0:b.kind)==="markdown"?b:b==null?void 0:b.value,sortText:y,filterText:S,insertText:C.text,insertTextRules:_===2?4:_,range:R.lspToMonacoRange(C.range)}});return{incomplete:!0,suggestions:h}}).catch(d=>(et.error("There was an error retrieving completion items",d),{suggestions:[]}));return u}handleSignatureRequest(e,t,r,i){var o={value:{signatures:[],activeSignature:0,activeParameter:0},dispose:()=>{}},a=this.props,s=a.model,l=a.session;if(e!==s||l.getSignatureHelp==null)return null;var u={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:R.monacoToLspPosition(t),context:i},d=l.getSignatureHelp(u);et.debug("Requested signature help",u);var h=d.then(p=>{et.debug("Signatures received: ",u,d);var f=p.map(g=>{var b=g.label,y=g.documentation,S=g.parameters;return{documentation:(y==null?void 0:y.kind)==="markdown"?y:y==null?void 0:y.value,label:b,parameters:S??[]}});if(f.length===0)return o;var v=0;return{value:{signatures:f,activeSignature:v,activeParameter:p[v].activeParameter},dispose:()=>{}}}).catch(p=>(et.error("There was an error retrieving completion items",p),o));return h}handleHoverRequest(e,t){var r=this.props,i=r.model,o=r.session;if(e!==i||o.getHover==null)return null;var a={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:R.monacoToLspPosition(t)},s=o.getHover(a);et.debug("Requested hover",a);var l=s.then(u=>{et.debug("Hover received: ",a,u);var d=u.contents;return{contents:d!=null?[d]:[]}}).catch(u=>(et.error("There was an error retrieving hover",u),{contents:[]}));return l}render(){return null}}Bt(R,"ruffWorkspace",void 0);Bt(R,"initRuffPromise",void 0);Bt(R,"isRuffInitialized",!1);Bt(R,"isRuffEnabled",!0);Bt(R,"ruffSettings",Wb);function Ra(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Gb(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Ra(o,r,i,a,s,"next",l)}function s(l){Ra(o,r,i,a,s,"throw",l)}a(void 0)})}}function $a(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 Fa(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?$a(Object(t),!0).forEach(function(r){Xb(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):$a(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Xb(n,e,t){return(e=qb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qb(n){var e=Zb(n,"string");return typeof e=="symbol"?e:e+""}function Zb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var St=B.module("MonacoUtils"),Ha="inmemory://dh-console/";class Te{static init(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.getWorker;St.debug("Initializing Monaco..."),t!==void 0&&Te.registerGetWorker(t);var r=Te.initTheme,i=Te.registerLanguages;r(),i([$b,Tb,Db,Bb,kb]),rt.onLanguage("python",()=>{rt.registerCodeActionProvider("python",{provideCodeActions:R.handlePythonCodeActionRequest},{providedCodeActionKinds:["quickfix"]}),rt.registerDocumentFormattingEditProvider("python",{provideDocumentFormattingEdits:R.handlePythonFormatRequest})}),Re.onDidCreateModel(o=>{if(o.getLanguageId()==="python"){R.ruffWorkspace!=null&&R.lintPython(o);var a=Mr(s=>R.lintPython(s),250);o.onDidChangeContent(()=>{a(o)})}}),Te.removeConflictingKeybindings(),St.debug("Monaco initialized.")}static initTheme(){var e,t,r=Te.removeHashtag,i=Fs(Pi);St.debug2("Monaco theme:",Pi),St.debug2("Monaco theme derived:",i);var o=[{token:"",foreground:r(i.foreground)},{token:"string",foreground:r(i.string)},{token:"string.delim",foreground:r(i["string-delim"])},{token:"keyword",foreground:r(i.keyword)},{token:"identifier.js",foreground:r(i["identifier-js"])},{token:"delimiter",foreground:r(i.delimiter)},{token:"comment",foreground:r(i.comment)},{token:"number",foreground:r(i.number)},{token:"storage",foreground:r(i.storage)},{token:"identifier",foreground:r(i.identifier)},{token:"namespace.identifier",foreground:r(i["namespace-identifier"])},{token:"operator",foreground:r(i.operator)},{token:"predefined",foreground:r(i.predefined)},{token:"error.log",foreground:(e=(t=i["log-error"])===null||t===void 0?void 0:t.substring(1))!==null&&e!==void 0?e:""},{token:"warn.log",foreground:r(i["log-warn"])},{token:"info.log",foreground:r(i["log-info"])},{token:"stdout.log",foreground:r(i["log-stdout"])},{token:"trace.log",foreground:r(i["log-trace"])},{token:"debug.log",foreground:r(i["log-debug"])},{token:"date.log",foreground:r(i["log-date"])}],a={foreground:i.foreground,errorForeground:i["error-foreground"],"inputOption.activeBorder":i["input-option-active-border"],"editor.background":i.background,"editor.foreground":i.foreground,"editor.lineHighlightBackground":i["editor-line-highlight-background"],"editorLineNumber.foreground":i["editor-line-number-foreground"],"editorLineNumber.activeForeground":i["editor-line-number-active-foreground"],"editor.selectionBackground":i["editor-selection-background"],"editor.inactiveSelectionBackground":i["editor-inactive-selection-background"],"editor.selectionHighlightBackground":i["editor-selection-highlight-background"],"editor.wordHighlightBackground":i["editor-word-highlight-background"],"editor.findMatchBackground":i["editor-find-match-background"],"editor.findMatchHighlightBackground":i["editor-find-match-highlight-background"],"editorSuggestWidget.background":i["editor-suggest-widget-background"],"editorSuggestWidget.border":i["editor-suggest-widget-border"],"editorSuggestWidget.foreground":i["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":i["editor-suggest-widget-selected-background"],"list.activeSelectionBackground":i["editor-suggest-widget-selected-background"],"editorSuggestWidget.selectedForeground":i["editor-suggest-widget-selected-foreground"],"list.activeSelectionForeground":i["editor-suggest-widget-selected-foreground"],"editorSuggestWidget.highlightForeground":i["editor-suggest-widget-highlightForeground"],"editorSuggestWidget.focusHighlightForeground":i["editor-suggest-widget-focus-highlight-foreground"],"list.hoverBackground":i["list-hover-background"],"dropdown.background":i["context-menu-background"],"dropdown.foreground":i["context-menu-foreground"],"menu.selectionBackground":i["menu-selection-background"],"menu.selectionForeground":i["menu-selection-foreground"],"keybindingLabel.foreground":i["menu-selection-foreground"],"list.focusBackground":i["menu-selection-background"],"editorWidget.background":i["editor-widget-background"],"inputOption.activeBackground":i["input-option-active-background"],"inputOption.activeForeground":i["input-option-active-foreground"],focusBorder:i["focus-border"],"input.background":i["input-background"],"input.foreground":i["input-foreground"],"input.border":i["input-border"],"textLink.foreground":i["text-link-foreground"],"textLink.activeForeground":i["text-link-active-foreground"],"editorLink.activeForeground":i["editor-link-active-foreground"],"editorBracketHighlight.foreground1":i["editor-bracket-foreground1"],"editorBracketHighlight.foreground2":i["editor-bracket-foreground2"],"editorBracketHighlight.foreground3":i["editor-bracket-foreground3"],"editorBracketHighlight.foreground4":i["editor-bracket-foreground4"],"editorBracketHighlight.foreground5":i["editor-bracket-foreground5"],"editorBracketHighlight.foreground6":i["editor-bracket-foreground6"],"editorBracketHighlight.unexpectedBracket.foreground":i["editor-unexpected-bracket-foreground"],"diffEditor.insertedTextBackground":i["diff-editor-inserted-text-background"],"diffEditor.removedTextBackground":i["diff-editor-removed-text-background"],"diffEditor.insertedLineBackground":i["diff-editor-inserted-line-background"],"diffEditor.removedLineBackground":i["diff-editor-removed-line-background"]};Re.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:o,colors:a});try{Re.setTheme("dh-dark")}catch(s){St.error("Failed to set 'dh-dark' Monaco theme, falling back to vs-dark",s),Re.setTheme("vs-dark")}}static registerGetWorker(e){window.MonacoEnvironment=Fa(Fa({},window.MonacoEnvironment),{},{getWorker:e})}static removeHashtag(e){var t;return(t=e==null?void 0:e.substring(1))!==null&&t!==void 0?t:""}static registerLanguages(e){var t=e.map(r=>{var i=r.id;return i});rt.getLanguages().filter(r=>{var i=r.id;return t.includes(i)}).forEach(r=>{var i=r;St.debug2("Overriding default language loader:",i.id)}),e.forEach(r=>{Te.registerLanguage(r)})}static registerLanguage(e){St.debug2("Registering language: ",e.id),rt.register(e),rt.onLanguage(e.id,()=>{rt.setLanguageConfiguration(e.id,e.conf),rt.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Re.EndOfLineSequence.LF;(t=e.getModel())===null||t===void 0||t.setEOL(r)}static openDocument(e,t){var r=e.getModel();W(r);var i={textDocument:{uri:"".concat(r.uri),languageId:r.getLanguageId(),version:r.getVersionId(),text:r.getValue()}};St.debug2("didOpenDocumentParams: ",i),t.openDocument(i);var o=e.onDidChangeModelContent(a=>{for(var s=a.changes,l=a.versionId,u=[],d=0;d<s.length;d+=1){var h=s[d],p=h.range,f=h.rangeLength,v=h.text,g={range:{start:{line:p.startLineNumber-1,character:p.startColumn-1},end:{line:p.endLineNumber-1,character:p.endColumn-1}},rangeLength:f,text:v};u.push(g)}if(u.length>0){var b={textDocument:{version:l,uri:"".concat(r.uri)},contentChanges:u};St.debug2("didChangeDocumentParams",b),t.changeDocument(b)}});return o}static closeDocument(e,t){var r=e.getModel();W(r);var i={textDocument:{uri:"".concat(r.uri)}};t.closeDocument(i)}static registerPasteHandler(e){e.onDidPaste(t=>{var r=/“|”/g,i=/\u200b/g,o=/\u00A0/g,a=e.getModel();W(a);var s=a.getValueInRange(t.range);(r.test(s)||i.test(s)||o.test(s))&&a.applyEdits([{range:t.range,text:s.replace(r,'"').replace(i,"").replace(o," ")}])})}static isMacPlatform(){var e=window.navigator.platform;return e.startsWith("Mac")}static removeConflictingKeybindings(){Re.addKeybindingRule({keybinding:nt.CtrlCmd|tn.KeyD,command:null}),Te.isMacPlatform()||Re.addKeybindingRule({keybinding:nt.CtrlCmd|tn.KeyH,command:null})}static disableKeyBindings(e,t){e.addAction({id:"disable-keybindings-".concat(Pt()),label:"",keybindings:t,run:()=>{}})}static getMonacoKeyCodeFromShortcut(e){var t=e.keyState,r=t.keyValue;if(r===null)return 0;var i=Te.isMacPlatform();return i?(t.metaKey?nt.CtrlCmd:0)|(t.shiftKey?nt.Shift:0)|(t.altKey?nt.Alt:0)|(t.ctrlKey?nt.WinCtrl:0)|so.fromString(r):(t.ctrlKey?nt.CtrlCmd:0)|(t.shiftKey?nt.Shift:0)|(t.altKey?nt.Alt:0)|(t.metaKey?nt.WinCtrl:0)|so.fromString(r)}static provideLinks(e){for(var t=[],r=function(a){var s=e.getLineContent(a),l=Rd(s),u=l.filter(d=>d.type==="url"?/^https?:\/\//.test(d.value):!0);u.forEach(d=>{t.push({url:d.href,range:new Xs(a,d.start+1,a,d.end+1)})})},i=1;i<=e.getLineCount();i+=1)r(i);return{links:t}}static generateConsoleUri(){return Ld.parse("".concat(Ha).concat(Pt()))}static isConsoleModel(e){return e.uri.toString().startsWith(Ha)}static canFormat(e){var t;return((t=e.getAction("editor.action.formatDocument"))===null||t===void 0?void 0:t.isSupported())===!0}static formatDocument(e){return Gb(function*(){var t;yield(t=e.getAction("editor.action.formatDocument"))===null||t===void 0?void 0:t.run()})()}}function Ua(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Yb(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Ua(o,r,i,a,s,"next",l)}function s(l){Ua(o,r,i,a,s,"throw",l)}a(void 0)})}}function Ke(n,e,t){return(e=Jb(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Jb(n){var e=Qb(n,"string");return typeof e=="symbol"?e:e+""}function Qb(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ei=B.module("ConsoleInput"),Ir=parseInt(Pi["line-height"],10),_u=6,wu=6,ey=Ir+_u+wu,ti=100;class In extends m.PureComponent{constructor(e){super(e),Ke(this,"cancelListener",void 0),Ke(this,"openDocumentCleanup",void 0),Ke(this,"resizeObserver",void 0),Ke(this,"commandContainer",void 0),Ke(this,"commandEditor",void 0),Ke(this,"commandHistoryIndex",void 0),Ke(this,"commandSuggestionContainer",void 0),Ke(this,"loadingPromise",void 0),Ke(this,"timestamp",void 0),Ke(this,"bufferIndex",void 0),Ke(this,"history",void 0),Ke(this,"modifiedCommands",void 0),this.handleResize=this.handleResize.bind(this),this.commandContainer=k.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:Ir,isFocused:!1,model:null}}componentDidMount(){this.initCommandEditor(),this.loadMoreHistory()}componentDidUpdate(e){var t=this.props.session;this.layoutEditor(),e.session!==t&&(this.destroyCommandEditor(e.session),this.initCommandEditor())}componentWillUnmount(){this.resizeObserver.disconnect(),this.loadingPromise!=null&&this.loadingPromise.cancel();var e=this.props.session;this.destroyCommandEditor(e)}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(ei.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 e=this.props,t=e.language,r=e.session,i=Re.createModel("",t,Te.generateConsoleUri()),o={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:t,lineHeight:Ir,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:_u,bottom:wu},value:"",wordWrap:"on",autoClosingBrackets:"beforeWhitespace",model:i},a=this.commandContainer.current;W(a),this.commandEditor=Re.create(a,o),Te.setEOL(this.commandEditor),this.openDocumentCleanup=Te.openDocument(this.commandEditor,r),this.commandEditor.onDidChangeModelContent(()=>{var s,l=(s=this.commandEditor)===null||s===void 0?void 0:s.getValue();this.modifiedCommands.set(this.commandHistoryIndex,l??null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(s=>{var l=this.commandEditor,u=this.commandHistoryIndex,d=l==null?void 0:l.getPosition();W(d);var h=d.lineNumber;if(!s.altKey&&!s.shiftKey&&!s.metaKey){if(s.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&h===1){u!=null?this.loadCommand(u+1):this.loadCommand(0),this.focusStart(),s.stopPropagation(),s.preventDefault();return}if(s.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&h===(i==null?void 0:i.getLineCount())){u!=null&&u>0?this.loadCommand(u-1):this.loadCommand(null),this.focusEnd(),s.stopPropagation(),s.preventDefault();return}if(s.keyCode===tn.Enter&&!this.isSuggestionMenuPopulated()){var p;s.stopPropagation(),s.preventDefault();var f=(p=this.commandEditor)===null||p===void 0?void 0:p.getValue().trim();if(f!==void 0){var v;this.processCommand(f),(v=this.commandEditor)===null||v===void 0||v.setValue("")}}}}),Te.disableKeyBindings(this.commandEditor,[nt.CtrlCmd|tn.KeyF]),Te.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.resizeObserver.observe(a),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(e){if(this.commandEditor){var t;(t=this.openDocumentCleanup)===null||t===void 0||t.dispose(),this.openDocumentCleanup=void 0,Te.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0}}handleResize(){this.updateDimensions()}isSuggestionMenuActive(){var e;if(!this.commandSuggestionContainer){var t;this.commandSuggestionContainer=(t=this.commandEditor)===null||t===void 0||(t=t.getDomNode())===null||t===void 0?void 0:t.querySelector(".suggest-widget")}return(e=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!==null&&e!==void 0?e:!1}isSuggestionMenuPopulated(){var e,t;return this.isSuggestionMenuActive()&&((e=(t=this.commandSuggestionContainer)===null||t===void 0||(t=t.querySelector(".monaco-list-rows"))===null||t===void 0?void 0:t.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,o,a=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();W(a);var s=a.getLineLength(1)+1,l=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(1,s);W(l),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:1,column:s}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(l),(o=this.commandEditor)===null||o===void 0||o.focus()}focusEnd(){var e,t,r,i,o,a=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();W(a);var s=a.getLineCount(),l=a.getLineLength(s)+1,u=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(s,l);W(u),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:s,column:l}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(u),(o=this.commandEditor)===null||o===void 0||o.focus()}clear(){var e,t;(e=this.commandEditor)===null||e===void 0||e.focus(),(t=this.commandEditor)===null||t===void 0||(t=t.getModel())===null||t===void 0||t.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var t;if(!(e!==null&&e>=this.history.length)){var r=this.modifiedCommands.get(e),i=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,(t=this.commandEditor)===null||t===void 0||(t=t.getModel())===null||t===void 0||t.setValue(r??i),e!==null&&e>this.history.length-ti&&this.loadMoreHistory()}}loadMoreHistory(){var e=this;return Yb(function*(){try{if(e.loadingPromise!=null||e.bufferIndex==null)return;var t=e.props,r=t.commandHistoryStorage,i=t.language,o=t.scope;e.loadingPromise=Je.makeCancelable(r.getTable(i,o??"",e.timestamp),l=>l.close());var a=yield e.loadingPromise;a.setReversed(!0),a.setViewport({top:e.bufferIndex,bottom:e.bufferIndex+ti-1}),e.loadingPromise=Je.makeCancelable(a.getViewportData(),()=>a.close());var s=yield e.loadingPromise;e.bufferIndex+=ti,e.bufferIndex>=a.size&&(e.bufferIndex=null),e.history=[...s.items.filter((l,u,d)=>{var h=l.name;return u===0||h!==d[u-1].name}).map(l=>{var u=l.name;return u}).reverse(),...e.history],e.loadingPromise=void 0,a.close()}catch(l){if(e.loadingPromise=void 0,Je.isCanceled(l)){ei.debug2("Promise canceled, not loading history");return}ei.error("Error fetching history",l)}})()}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),W(e),e!==""&&(this.history.length===0||e!==this.history[this.history.length-1])&&this.history.push(e),this.updateDimensions();var t=this.props.onSubmit;t(e)}updateDimensions(){if(this.commandEditor){var e=this.props.maxHeight;W(e);var t=this.commandEditor.getContentHeight(),r=Math.max(Math.min(t,e),ey),i=t>r,o={overviewRulerLanes:i?void 0:0};this.setState({commandEditorHeight:r},()=>{var a,s;(a=this.commandEditor)===null||a===void 0||a.updateOptions(o),(s=this.commandEditor)===null||s===void 0||s.layout()})}}render(){var e=this.props,t=e.disabled,r=e.language,i=e.session,o=this.state,a=o.commandEditorHeight,s=o.isFocused,l=o.model;return c.jsx("div",{className:U("console-input-wrapper",{disabled:t}),children:c.jsxs("div",{className:U("console-input-inner-wrapper",{focus:s}),children:[c.jsx("div",{className:In.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:a}}),l&&c.jsx(R,{model:l,language:r,session:i})]})})}}Ke(In,"defaultProps",{maxHeight:Ir*10,scope:null,disabled:!1});Ke(In,"INPUT_CLASS_NAME","console-input");function Ft(n,e,t){return(e=ty(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:e+""}function ny(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ba="pasted values",ry=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],ni=[".csv",".tsv",".tab",".psv",".dsv",".txt"],Wa=[".zip"];class $e extends m.Component{static isValidDropItem(e){return e!=null&&e.kind==="file"&&!ry.find(t=>t.test(e.type))}static isValidExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return ni.some(r=>e.endsWith(r))||t&&Wa.some(r=>e.endsWith(r))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===Ba?to:e.endsWith(".csv")?ed:e.endsWith(".zip")?td:nd}constructor(e){super(e),Ft(this,"fileElem",void 0),Ft(this,"divElem",void 0),Ft(this,"getValidExtensions",_n(t=>t?[...ni,...Wa]:[...ni])),Ft(this,"getAcceptString",_n(t=>this.getValidExtensions(t).join(", "))),Ft(this,"getFileTypeErrorString",_n(t=>gc.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=k.createRef(),this.divElem=k.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 t=e.target.files;t!=null&&this.handleFile(t[0])}handleDrop(e){var t=this.props,r=t.allowZip,i=t.clearDragError,o=t.dragError;if(e.preventDefault(),e.stopPropagation(),o!=null){i();return}if(!(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)){var a=e.dataTransfer.items[0].getAsFile();W(a),$e.isValidExtension(a.name,r)?this.handleFile(a):this.setState({dropError:$e.FILE_TYPE_ERROR})}}unstageFile(e){var t=this.props.onCancel;e.stopPropagation(),e.preventDefault(),t(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(e){var t=this.props.onFileOpened;t(e),this.setState({selectedFileName:e.name,dropError:void 0})}handleMenuPaste(){var e=this.props,t=e.onPaste,r=e.onError,i=e.uploadInProgress;i||navigator.clipboard.readText().then(o=>{t(o),this.setState({selectedFileName:Ba,dropError:void 0})}).catch(o=>r(o))}handlePasteEvent(e){e.stopPropagation(),e.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){var e=this.props.uploadInProgress;return[{title:"Paste",icon:to,action:this.handleMenuPaste,shortcut:yn.PASTE,disabled:e}]}render(){var e=this.props,t=e.allowZip,r=e.dragError,i=e.uploadInProgress,o=this.state,a=o.selectedFileName,s=o.dropError,l=r??s,u=this.makeContextMenuItems();return c.jsxs("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:$e.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[c.jsx(de,{actions:u}),c.jsx("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(t),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!a&&(l===void 0||l==="")&&c.jsxs("div",{className:"message-content",children:[c.jsx("div",{className:"message-icon",children:c.jsx(me,{icon:rd})}),c.jsx("label",{children:"Drop file (or paste values) here to import"}),c.jsx("div",{className:"message-small",children:c.jsx("label",{children:"or"})}),c.jsx(ne,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),a&&(l===void 0||l==="")&&c.jsxs("div",{className:"selected-content",children:[c.jsx("div",{className:"selected-icon",children:c.jsx(me,{icon:$e.getIcon(a)})}),c.jsxs("div",{className:"selected-text",children:[c.jsx("label",{children:"Selected File"}),c.jsxs("label",{className:"selected-name",children:[a,!i&&c.jsx(ne,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:id,tooltip:"Remove"})]})]})]}),!!l&&c.jsxs("div",{className:"message-content",children:[c.jsx("div",{className:"message-icon",children:c.jsx(me,{icon:Bs})}),c.jsx("label",{children:l}),l===$e.FILE_TYPE_ERROR&&c.jsx("div",{className:"message-small",children:c.jsx("label",{children:this.getFileTypeErrorString(t)})})]})]})}}Ft($e,"defaultProps",{allowZip:!1,dragError:null});Ft($e,"MULTIPLE_FILE_ERROR","Please select only one file");Ft($e,"FILE_TYPE_ERROR","Filetype not supported.");function Eu(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 Ka(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 za(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ka(Object(t),!0).forEach(function(r){ke(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ka(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ke(n,e,t){return(e=iy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function iy(n){var e=oy(n,"string");return typeof e=="symbol"?e:e+""}function oy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Va="unknown",ay=2147483647,sy=-2147483648,Ga=/^[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]+)?$/,Xa=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class Ie{static determineType(e,t,r){if(!e||e===r)return t;switch(t){case K.STRING:return K.STRING;case K.INTEGER:return Ie.checkInteger(e);case K.LONG:return Ie.checkLong(e);case K.DOUBLE:return Ie.checkDouble(e);case K.BOOLEAN:return Ie.checkBoolean(e);case K.DATE_TIME:return Ie.checkDateTime(e);case K.LOCAL_TIME:return Ie.checkLocalTime(e);default:return Ie.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){var t=e.replace(/,/g,"");return Ie.isNotParsableNumber(t)?K.STRING:Ie.getNumberType(t)}static checkLong(e){var t=e.replace(/,/g,"");return Ie.isNotParsableNumber(t)?K.STRING:t.includes(".")?K.DOUBLE:K.LONG}static checkDouble(e){var t=e.replace(/,/g,"");return Ie.isNotParsableNumber(t)?K.STRING:K.DOUBLE}static checkBoolean(e){var t=e.toLowerCase();return t==="true"||t==="false"?K.BOOLEAN:K.STRING}static checkDateTime(e){return Ga.test(e)?K.DATE_TIME:K.STRING}static checkLocalTime(e){return Xa.test(e)?K.LOCAL_TIME:K.STRING}static getTypeFromUnknown(e){var t=e.replace(/,/g,"");if(Ie.isNotParsableNumber(t)){var r=e.toLowerCase();return r==="true"||r==="false"?K.BOOLEAN:Ga.test(e)&&e.includes(":")?K.DATE_TIME:Xa.test(e)?K.LOCAL_TIME:K.STRING}return Ie.getNumberType(t)}static getNumberType(e){if(e.includes("."))return K.DOUBLE;var t=e.startsWith("-")?11:10;if(e.length>t)return K.LONG;var r=parseInt(e,10);return r>ay||r<sy?K.LONG:K.INTEGER}constructor(e,t,r,i,o,a,s,l,u,d){ke(this,"onFileCompleted",void 0),ke(this,"file",void 0),ke(this,"readHeaders",void 0),ke(this,"nullString",void 0),ke(this,"onProgress",void 0),ke(this,"onError",void 0),ke(this,"types",void 0),ke(this,"chunks",void 0),ke(this,"totalChunks",void 0),ke(this,"rowCount",void 0),ke(this,"isZip",void 0),ke(this,"shouldTrim",void 0),ke(this,"zipProgress",void 0),ke(this,"config",void 0),this.onFileCompleted=e,this.file=t,this.readHeaders=r,this.nullString=o,this.onProgress=a,this.onError=s,this.chunks=0,this.totalChunks=l,this.rowCount=0,this.isZip=u,this.shouldTrim=d,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=za(za({},i),{},{error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete})}parse(){if(this.file instanceof File||this.file instanceof Blob)Fn.parse(this.file,this.config);else{var e=Eu(this.file,this.handleNodeUpdate);Fn.parse(e,this.config),e.resume()}}handleChunk(e,t){var r=e.data;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(Va),this.readHeaders&&(r=r.slice(1))}this.rowCount+=r.length,W(this.types);var i=[...this.types];r.forEach(s=>{if(s.length>=i.length){for(var l=0;l<i.length;l+=1)i[l]=Ie.determineType(this.shouldTrim?s[l].trim():s[l],i[l],this.nullString);this.types=i}else t.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
23
23
  Expected length `.concat(i.length," but found ").concat(s.length,`.
24
24
  Row = `).concat(s))}),this.chunks+=1;var o=0;this.totalChunks>0?o=Math.round(this.chunks/this.totalChunks*50):o=Math.round(this.zipProgress/2);var a=this.onProgress(o);a&&t.abort()}handleComplete(e){var t=this.types,r=this.onFileCompleted;W(t),(e==null||!e.meta.aborted)&&r(t.map(i=>i===Va||i===K.LOCAL_TIME?K.STRING:i),this.rowCount)}handleError(e){var t=this.onError;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}var Pu;function he(n,e,t){return(e=ly(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ly(n){var e=uy(n,"string");return typeof e=="symbol"?e:e+""}function uy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var vr=B.module("CsvParser"),dy=650;class xn{static generateHeaderRecursive(e){var t="",r=e;return e>=26&&(t=t.concat(xn.generateHeaderRecursive(Math.floor(e/26)-1)),r=e%26),t.concat(String.fromCharCode(65+r))}constructor(e){var t=e.onFileCompleted,r=e.session,i=e.file,o=e.type,a=e.readHeaders,s=a===void 0?!0:a,l=e.onProgress,u=e.onError,d=e.timeZone,h=e.isZip;he(this,"onFileCompleted",void 0),he(this,"session",void 0),he(this,"file",void 0),he(this,"isZip",void 0),he(this,"type",void 0),he(this,"readHeaders",void 0),he(this,"timeZone",void 0),he(this,"onProgress",void 0),he(this,"onError",void 0),he(this,"tables",void 0),he(this,"headers",void 0),he(this,"types",void 0),he(this,"rowCount",void 0),he(this,"rowsProcessed",void 0),he(this,"chunks",void 0),he(this,"totalChunks",void 0),he(this,"isComplete",void 0),he(this,"zipProgress",void 0),he(this,"consolidatedChunks",void 0),he(this,"numConsolidated",void 0),he(this,"isCancelled",void 0),he(this,"config",void 0),this.onFileCompleted=t,this.session=r,this.file=i,this.isZip=h,this.type=o,this.readHeaders=s,this.timeZone=d,this.onProgress=l,this.onError=u,this.tables=[],this.rowCount=0,this.rowsProcessed=0,this.chunks=0,this.totalChunks=h?0:Math.ceil(i.size/Fn.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:o.delimiter,newline:o.newline,escapeChar:o.escapeChar,dynamicTyping:!1,error:this.handleError,skipEmptyLines:o.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)),o=0;o<r;o+=1){var a=t[o];if(a.length<e)throw new Error("Insufficient columns. Expected ".concat(e," but found ").concat(a.length,`
25
25
  `).concat(a));for(var s=0;s<e;s+=1){var l=this.type.shouldTrim?t[o][s].trim():t[o][s];i[s][o]=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)Fn.parse(this.file,this.config);else{var o=Eu(this.file,this.handleNodeUpdate);Fn.parse(o,this.config),o.resume()}},t=new Ie(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 r=this.readHeaders,i=this.onError,o=this.handleCreateTable,a=this.isZip,s=this.tables;if(this.isCancelled){vr.debug2("CSV parser cancelled."),t.abort(),s.forEach(h=>h.close());return}var l=e.data;this.headers||(r?(this.headers=gt.legalizeColumnNames(l[0]),l=l.slice(1)):this.headers=xn.generateHeaders(l[0].length));var u=[];try{if(u=this.transpose(this.headers.length,l),a)this.consolidateChunks(u,t);else{var d=this.chunks;this.chunks+=1,o(d,u,t)}}catch(h){i(h)}}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>=dy||this.isComplete)&&this.uploadConsolidatedChunks(t)}uploadConsolidatedChunks(e){var t,r=this.handleCreateTable,i=this.chunks;this.chunks+=1;var o=(t=this.consolidatedChunks)===null||t===void 0?void 0:t.slice();this.consolidatedChunks=void 0,this.numConsolidated=0,W(o),r(i,o,e)}handleCreateTable(e,t,r){var i=this.session,o=this.tables,a=this.onFileCompleted,s=this.totalChunks,l=this.types,u=this.onProgress,d=this.onError;r&&r.pause(),W(this.headers),W(l),this.rowsProcessed+=t[0].length,i.newTable(this.headers,l,t,this.timeZone).then(h=>{if(this.isCancelled){vr.debug2("CSV parser cancelled."),r&&r.abort(),o.forEach(f=>f.close());return}r&&r.resume(),o[e]=h;var p=0;s>0?p=Math.round(o.length/s*50)+50:p=Math.round(this.rowsProcessed/this.rowCount*50)+50,vr.debug2("CSV parser progress ".concat(p)),u(p),this.isComplete&&o.length===this.chunks&&(vr.debug2("CSV parser complete."),a(o))}).catch(h=>{!this.isComplete&&r&&r.abort(),d(h)})}handleComplete(e){(e==null||e.meta.aborted==null)&&(this.isComplete=!0,this.consolidatedChunks&&this.uploadConsolidatedChunks(null))}handleError(e){var t=this.onError;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}Pu=xn;he(xn,"generateHeaders",n=>{for(var e=[],t=0;t<n;t+=1)e.push(Pu.generateHeaderRecursive(t));return e});function qi(n,e,t){return(e=cy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cy(n){var e=hy(n,"string");return typeof e=="symbol"?e:e+""}function hy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ht{static fromExtension(e){return e.endsWith(".csv")?"DEFAULT_CSV":e.endsWith(".tsv")||e.endsWith(".tab")?"TSV":e.endsWith(".psv")?"PIPE_SV":"AUTODETECT"}}qi(Ht,"DEFAULT_TYPE","DEFAULT_CSV");qi(Ht,"AUTO","AUTODETECT");qi(Ht,"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
@@ -29,7 +29,7 @@ Row = `).concat(s))}),this.chunks+=1;var o=0;this.totalChunks>0?o=Math.round(thi
29
29
  `,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)"}}));function Tu(n,e,t){return(e=my(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function my(n){var e=py(n,"string");return typeof e=="symbol"?e:e+""}function py(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function fy(n,e){return yy(n)||by(n,e)||gy(n,e)||vy()}function vy(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
30
30
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gy(n,e){if(n){if(typeof n=="string")return qa(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?qa(n,e):void 0}}function qa(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function by(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function yy(n){if(Array.isArray(n))return n}var Za=B.module("CsvInputBar"),Sy=Object.entries(Ht.TYPES).map(n=>{var e=fy(n,2),t=e[0],r=e[1];return c.jsx("option",{value:t,children:r.name},t)});class Ou extends m.Component{constructor(e){super(e),Tu(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=k.createRef(),this.state={tableName:"",tableNameSet:!1,isFirstRowHeaders:!0,showProgress:!1,progressValue:0,type:Ht.DEFAULT_TYPE,parser:null}}componentDidUpdate(e){var t=this.props,r=t.file,i=t.paste,o=this.state,a=o.tableName,s=o.tableNameSet;if(!s&&r!=null&&!a){var l,u=r.name.lastIndexOf("."),d=gt.makeVariableName(r.name.substring(0,u));this.setState({tableName:d,tableNameSet:!0}),(l=this.inputRef.current)===null||l===void 0||l.focus()}else(r==null&&e.file!=null||i==null&&e.paste!=null)&&this.setState({tableName:"",tableNameSet:!1});i!=null&&i!==""&&!a&&this.inputRef.current&&this.inputRef.current.focus(),r!=null&&r!==e.file?this.setState({type:Ht.fromExtension(r.name)}):i!=null&&i!==""&&(e.paste===void 0||e.paste==="")&&this.setState({type:Ht.AUTO})}componentWillUnmount(){var e=this.state.parser;e&&e.cancel()}handleCancel(){var e=this.props.onClose;e()}handleError(e){var t=this.props,r=t.onClose,i=t.onError;Za.error(e),i(e),r()}handleTableName(e){this.setState({tableName:e.target.value,tableNameSet:!0})}toggleFirstRowHeaders(){var e=this.state.isFirstRowHeaders;this.setState({isFirstRowHeaders:!e})}handleUpload(e){e.stopPropagation(),e.preventDefault();var t=this.props,r=t.file,i=t.paste;r!=null?r.name.endsWith(".zip")?this.handleZipFile(r):this.handleFile(r):i!==void 0&&i!==""&&this.handleFile(new Blob([i],{type:"text/plain"}))}handleFile(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;Za.info("Starting CSV parser for ".concat(e instanceof File?e.name:"pasted values"," ").concat(t?"":e.size," bytes"));var r=this.props,i=r.session,o=r.timeZone,a=r.onInProgress,s=this.state,l=s.tableName,u=s.isFirstRowHeaders,d=s.type,h=f=>{f.length===1?i.bindTableToVariable(f[0],l).then(()=>this.openTable()).catch(v=>this.handleError(v)):i.mergeTables(f).then(v=>{i.bindTableToVariable(v,l).then(()=>this.openTable()).catch(g=>this.handleError(g)),f.forEach(g=>g.close())}).catch(v=>this.handleError(v))},p=new xn({onFileCompleted:h,session:i,file:e,type:Ht.TYPES[d],readHeaders:u,onProgress:this.handleProgress,onError:this.handleError,timeZone:o,isZip:t});p.parse(),this.setState({showProgress:!0,parser:p}),a(!0)}handleZipFile(e){var t=this.props,r=t.onUpdate,i=t.unzip;if(i==null){this.handleError(new Error("No support for zip files available."));return}i(e).then(o=>{for(var a=!1,s=0;s<o.length;s+=1){var l=o[s];if($e.isValidExtension(l.name)){r("Loading ".concat(l.name," as csv from ").concat(e.name)),a=!0,this.handleFile(l,!0);break}}if(!a)throw new Error("No csv file found in ".concat(e.name))}).catch(o=>this.handleError(o))}handleProgress(e){var t=this.state.showProgress;return t&&this.setState({progressValue:e}),!t}handleCancelInProgress(){var e=this.props.onInProgress,t=this.state.parser;t&&t.cancel(),this.setState({showProgress:!1,progressValue:0}),e(!1)}openTable(){var e=this.props,t=e.onOpenTable,r=e.onClose,i=this.state.tableName;t(i),r()}handleQueryTypeChange(e){this.setState({type:e})}render(){var e=this.props,t=e.file,r=e.paste,i=this.state,o=i.tableName,a=i.isFirstRowHeaders,s=i.showProgress,l=i.progressValue,u=i.type,d=!!r&&!o;return c.jsxs("div",{className:"csv-input-bar",children:[!s&&c.jsxs("form",{onSubmit:this.handleUpload,className:"csv-input-bar-container form-inline",children:[c.jsxs("div",{className:"form-group",children:[c.jsx("label",{htmlFor:"tableNameInput",children:"Table name"}),c.jsx("input",{ref:this.inputRef,id:"tableNameInput",type:"text",className:U("form-control",{"is-invalid":d}),value:o,onChange:this.handleTableName})]}),c.jsxs("div",{className:"form-group",children:[c.jsx("label",{htmlFor:"formatSelect",children:"File format"}),c.jsx(bl,{id:"formatSelect",className:"custom-select",value:u,onChange:this.handleQueryTypeChange,children:Sy})]}),c.jsx(dl,{className:"firstRowHeaders",checked:a,onChange:this.toggleFirstRowHeaders,children:"First row is column headers"}),c.jsxs("div",{className:"csv-input-buttons form-group",children:[c.jsx(ne,{kind:"secondary",onClick:this.handleCancel,children:"Cancel"}),c.jsx(ne,{kind:"primary",type:"submit",disabled:!(t!==null||r!==void 0&&r!=="")||!o,children:"Upload"})]})]}),s&&c.jsxs("div",{className:"csv-progress-container",children:[c.jsx("label",{children:"Uploading Table"}),c.jsx("div",{className:"progress",children:c.jsx("div",{className:"progress-bar bg-primary",style:{width:"".concat(l,"%")},"aria-valuenow":l,"aria-valuemin":0,"aria-valuemax":100})}),c.jsxs("label",{children:[l,"%"]}),c.jsx(ne,{kind:"primary",onClick:this.handleCancelInProgress,children:"Cancel"})]})]})}}Tu(Ou,"defaultProps",{file:null,paste:null,unzip:null});function Ya(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Cy(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Ya(o,r,i,a,s,"next",l)}function s(l){Ya(o,r,i,a,s,"throw",l)}a(void 0)})}}function _y(n,e){return Ty(n)||Py(n,e)||Ey(n,e)||wy()}function wy(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
31
31
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ey(n,e){if(n){if(typeof n=="string")return Ja(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ja(n,e):void 0}}function Ja(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function Py(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function Ty(n){if(Array.isArray(n))return n}var Oy={placement:"bottom-end"};function Iy(n){var e=n.children,t=n.dh,r=n.session,i=n.overflowActions,o=m.useState(0),a=_y(o,2),s=a[0],l=a[1],u=m.useCallback(function(){var f=Cy(function*(v){l(b=>b+1);try{var g=v.detail.result;yield g}catch{}l(b=>b-1)});return function(v){return f.apply(this,arguments)}}(),[]);m.useEffect(function(){return r.addEventListener(t.IdeSession.EVENT_COMMANDSTARTED,u)},[t,u,r]);var d=null,h=null;s>0?(d="console-status-icon-pending",h="Worker is busy"):(d="console-status-icon-idle",h="Worker is idle");var p=i!=null&&(!Array.isArray(i)||i.length>0);return c.jsxs("div",{className:"console-pane-status-bar",children:[c.jsxs("div",{children:[c.jsx("div",{className:U("console-status-icon",d)}),c.jsx(ue,{children:h})]}),e,p&&c.jsx(ne,{kind:"ghost",icon:od,tooltip:"More Actions...","aria-label":"More Actions...",onClick:qs,children:c.jsx(kr,{actions:i,popperOptions:Oy})})]})}function xy(n,e){return Ay(n)||jy(n,e)||My(n,e)||Dy()}function Dy(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
32
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function My(n,e){if(n){if(typeof n=="string")return Qa(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Qa(n,e):void 0}}function Qa(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function jy(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function Ay(n){if(Array.isArray(n))return n}var ky=5e3;function Ny(n){var e=n.openObject,t=n.objects,r=m.useState(""),i=xy(r,2),o=i[0],a=i[1],s=m.useRef(null),l=Tc(()=>{a("")},ky),u=m.useCallback(()=>{var p;l.cancel(),(p=s.current)===null||p===void 0||p.select()},[l]),d=m.useCallback(()=>{l()},[l]),h=m.useMemo(()=>{if(t.length===0)return[];var p={menuElement:c.jsx(Nr,{value:o,onChange:g=>{a(g.target.value)},className:"console-menu",ref:s})},f=o?t.filter(g=>{var b=g.title;return b!=null&&b.toLowerCase().includes(o.toLowerCase())}):t,v=f.map(g=>({title:g.title,action:()=>{e(g)},icon:c.jsx(fu,{type:g.type})}));return[p,...v]},[t,o,e]);return c.jsx(ne,{"aria-label":"Objects",kind:"ghost",disabled:t.length===0,onClick:qs,tooltip:t.length===0?"No objects available":"Objects",icon:c.jsxs("div",{className:"fa-md fa-layers",children:[c.jsx(me,{mask:Hs,icon:ai,transform:"right-5 down-5"}),c.jsx(me,{icon:ai,transform:"right-8 down-6"})]}),children:c.jsx(kr,{actions:h,onMenuOpened:u,onMenuClosed:d,options:{initialKeyboardIndex:1},popperOptions:{placement:"bottom-end"}})})}function es(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 st(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?es(Object(t),!0).forEach(function(r){Ke(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):es(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ke(n,e,t){return(e=Ly(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ly(n){var e=Ry(n,"string");return typeof e=="symbol"?e:e+""}function Ry(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var tt=B.module("Console"),ts={isAutoLaunchPanelsEnabled:!0,isPrintStdOutEnabled:!0,isClosePanelsOnDisconnectEnabled:!0};function $y(){return!0}function Fy(n){return c.jsx(c.Fragment,{})}class Ut extends m.PureComponent{static isErrorLevel(e){return e===Pe.STDERR||e===Pe.ERROR||e===Pe.FATAL}static isOutputLevel(e){return e===Pe.STDOUT||Ut.isErrorLevel(e)}constructor(e){super(e),Ke(this,"cancelListener",void 0),Ke(this,"consolePane",void 0),Ke(this,"consoleInput",void 0),Ke(this,"consoleHistoryScrollPane",void 0),Ke(this,"consoleHistoryContent",void 0),Ke(this,"pending",void 0),Ke(this,"queuedLogMessages",void 0),Ke(this,"resizeObserver",void 0),Ke(this,"processLogMessageQueue",Mr(()=>{this.setState(o=>{tt.debug2("processLogMessageQueue",this.queuedLogMessages.length," items");var a=o.consoleHistory;return a=a.concat(this.queuedLogMessages),this.queuedLogMessages=[],{consoleHistory:a}})},Ut.LOG_THROTTLE)),Ke(this,"getObjects",_n(o=>Array.from(o.values()))),Ke(this,"getContextActions",_n(o=>[...o,{action:this.handleClearShortcut,shortcut:En.CONSOLE.CLEAR},{action:this.handleFocusHistory,shortcut:En.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.handleHistoryResize=this.handleHistoryResize.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=k.createRef(),this.consoleInput=k.createRef(),this.consoleHistoryScrollPane=k.createRef(),this.consoleHistoryContent=k.createRef(),this.pending=new jr,this.queuedLogMessages=[],this.resizeObserver=new window.ResizeObserver(this.handleHistoryResize);var t=this.props,r=t.objectMap,i=t.settings;this.state=st(st({consoleHistory:[],consoleHeight:0,isScrollDecorationShown:!1,objectHistoryMap:new Map,objectMap:new Map(r),showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1,isStuckToBottom:!0},ts),i)}componentDidMount(){this.initConsoleLogging();var e=this.props,t=e.dh,r=e.session;r.addEventListener(t.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.updateDimensions(),this.consoleHistoryScrollPane.current&&this.consoleHistoryContent.current&&(this.resizeObserver.observe(this.consoleHistoryScrollPane.current),this.resizeObserver.observe(this.consoleHistoryContent.current))}componentDidUpdate(e,t){var r=this.props,i=this.state;this.sendSettingsChange(t,i),r.objectMap!==e.objectMap&&this.updateObjectMap(),i.isStuckToBottom&&!this.isAtBottom()&&this.scrollConsoleHistoryToBottom()}componentWillUnmount(){var e=this.props,t=e.dh,r=e.session;r.removeEventListener(t.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.pending.cancel(),this.processLogMessageQueue.cancel(),this.deinitConsoleLogging(),this.resizeObserver.disconnect()}initConsoleLogging(){var e=this.props.session;this.cancelListener=e.onLogMessage(this.handleLogMessage)}deinitConsoleLogging(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}isAtBottom(){if(this.consoleHistoryScrollPane.current==null)return!1;var e=this.consoleHistoryScrollPane.current,t=e.scrollHeight,r=e.clientHeight,i=e.scrollTop;return Math.abs(t-r-i)<=1}handleClearShortcut(e){var t;e.preventDefault(),e.stopPropagation(),(t=this.consoleInput.current)===null||t===void 0||t.clear()}handleCommandStarted(e){var t=e.detail,r=t.code,i=t.result,o=this.pending.add(i),a={command:r,disabledObjects:[],startTime:Date.now(),cancelResult:()=>{i.cancel()},wrappedResult:o},s=this.props,l=s.commandHistoryStorage,u=s.language,d=s.scope,h=l.addItem(u,d,r,{command:r,startTime:new Date().toJSON()});h.catch(p=>{tt.debug("Error adding workspace item",p)}),this.setState(p=>({consoleHistory:p.consoleHistory.concat(a)}),()=>{this.scrollConsoleHistoryToBottom()}),o.then(p=>{this.handleCommandResult(p,a,h)}).catch(p=>{this.handleCommandError(p,a,h)})}handleCommandResult(e,t,r){var i,o,a=e==null||(i=e.startTimestamp)===null||i===void 0?void 0:i.asNumber(),s=e==null||(o=e.endTimestamp)===null||o===void 0?void 0:o.asNumber(),l=st(st({},t),{},{wrappedResult:void 0,cancelResult:void 0,result:e??t.result,serverStartTime:a,serverEndTime:s});this.setState(u=>{var d=u.consoleHistory,h=d.lastIndexOf(t);if(h<0)return tt.error("historyItem not found in consoleHistory"),null;var p=d.concat();return p[h]=l,{consoleHistory:p}}),e&&(this.scrollConsoleHistoryToBottom(),this.updateHistory(e,l),this.updateKnownObjects(l),this.updateWorkspaceHistoryItem({error:e.error,serverStartTime:a,serverEndTime:s},r),this.closeRemovedItems(e.changes),this.openUpdatedItems(e.changes))}handleCommandError(e,t,r){if(Je.isCanceled(e)){tt.debug("Called handleCommandError on a cancelled promise result");return}this.updateWorkspaceHistoryItem({error:"".concat(e)},r),this.setState(i=>{var o=i.consoleHistory.concat(),a=o.lastIndexOf(t),s=st({},t);return s.wrappedResult=void 0,s.cancelResult=void 0,s.endTime=Date.now(),s.result={error:e},o[a]=s,{consoleHistory:o}})}handleFocusHistory(e){e.preventDefault(),e.stopPropagation();var t=this.props.focusCommandHistory;t()}handleLogMessage(e){var t=this.state.isPrintStdOutEnabled;t&&Ut.isOutputLevel(e.logLevel)&&this.queueLogMessage(e.message,e.logLevel)}queueLogMessage(e,t){var r={};Ut.isErrorLevel(t)?r.error=e:r.message=e;var i={command:void 0,result:r};this.queuedLogMessages.push(i),this.processLogMessageQueue()}openUpdatedItems(e){tt.debug("openUpdatedItems",e);var t=this.state.isAutoLaunchPanelsEnabled;if(e!=null){var r=this.props.openObject;[...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 t=this.props.closeObject,r=e.removed;r.forEach(i=>t(i))}}updateHistory(e,t){var r=t;e==null||e.changes==null||r==null||(r.endTime=Date.now(),this.setState(i=>{var o=i.consoleHistory.concat();return{consoleHistory:o}}))}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)){tt.debug2("updateKnownObjects no changes");return}this.setState(r=>{var i,o,a,s=r.consoleHistory,l=s.lastIndexOf(e);if(l<0)return tt.error("historyItem not found in state.consoleHistory"),null;var u=new Map(r.objectHistoryMap),d=new Map(r.objectMap),h=function(f){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,g=f.title;W(g);var b=u.get(g);if(b!=null&&b>=0){var y;s===r.consoleHistory&&(s=s.concat());var S=st(st({},s[b]),{},{disabledObjects:[...(y=s[b].disabledObjects)!==null&&y!==void 0?y:[],g]});s[b]=S}u.set(g,l),v?d.delete(g):d.set(g,f)};return(i=t)===null||i===void 0||i.updated.forEach(p=>h(p)),(o=t)===null||o===void 0||o.removed.forEach(p=>h(p,!0)),(a=t)===null||a===void 0||a.created.forEach(p=>{var f=p.title;W(f),u.set(f,l),d.set(f,p)}),{objectHistoryMap:u,objectMap:d,consoleHistory:s}})}updateObjectMap(){var e=this.props.objectMap;this.setState({objectMap:e})}updateWorkspaceHistoryItem(e,t){var r=this.pending.add(t),i=new Date().toJSON();r.then(o=>{var a=st(st({},o),{},{data:st(st({},o.data),{},{endTime:i,result:e})}),s=this.props,l=s.commandHistoryStorage,u=s.language;l.updateItem(u,a).catch(d=>{tt.warn("Error updating command history storage",d)})}).catch(o=>{tt.debug("Error updating workspace history item",o)})}scrollConsoleHistoryToBottom(){var e=this.consoleHistoryScrollPane.current;e!=null&&window.requestAnimationFrame(()=>{e.scrollTo({top:e.scrollHeight,behavior:"instant"})})}handleScrollPaneScroll(e){tt.debug("handleScrollPaneScroll",e);var t=this.consoleHistoryScrollPane.current;W(t),this.setState({isScrollDecorationShown:t.scrollTop>0&&t.scrollHeight>t.clientHeight,isStuckToBottom:this.isAtBottom()})}handleHistoryResize(e){tt.debug("handleHistoryResize",e);var t=e[0];if(t.contentRect.height>0&&t.contentRect.width>0){var r=this.state.isStuckToBottom;r&&!this.isAtBottom()&&this.scrollConsoleHistoryToBottom()}}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 t=e.dataTransfer.items;if(t.length>1){this.setState({dragError:$e.MULTIPLE_FILE_ERROR});return}var r=t[0];$e.isValidDropItem(r)?this.setState({dragError:null}):this.setState({dragError:$e.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 t=this.props,r=t.dh,i=t.openObject,o=t.commandHistoryStorage,a=t.language,s=t.scope,l=this.state,u=l.consoleHistory,d=l.objectMap,h={name:e,title:e,type:r.VariableType.TABLE},p=d.has(e),f={startTime:Date.now(),endTime:Date.now(),disabledObjects:[],result:{changes:{created:[],updated:[],removed:[],[p?"updated":"created"]:[h]}}},v=u.concat(f);this.setState({consoleHistory:v}),this.scrollConsoleHistoryToBottom(),this.updateKnownObjects(f),i({name:e,type:r.VariableType.TABLE}),o.addItem(a,s,e,{command:e,startTime:new Date().toJSON(),endTime:new Date().toJSON()})}addConsoleHistoryMessage(e,t){var r=this.state.consoleHistory,i={startTime:Date.now(),endTime:Date.now(),result:{message:e,error:t}},o=r.concat(i);this.setState({consoleHistory:o})}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 e=this.state,t=e.isAutoLaunchPanelsEnabled,r=e.isClosePanelsOnDisconnectEnabled,i=e.isPrintStdOutEnabled,o=this.props.actions;return[...o,{title:"Print Stdout",action:this.handleTogglePrintStdout,group:de.groups.high,icon:i?Gr:void 0,order:10},{title:"Auto Launch Panels",action:this.handleToggleAutoLaunchPanels,group:de.groups.high,icon:t?Gr:void 0,order:20},{title:"Close Panels on Disconnect",action:this.handleToggleClosePanelsOnDisconnect,group:de.groups.high,icon:r?Gr:void 0,order:30},{title:"Upload Table from File",action:this.handleUploadCsv,group:de.groups.high+10,order:40}]}handleCommandSubmit(e){if(e==="clear"||e==="cls")this.clearConsoleHistory();else if(e.length>0){var t=this.props.session;t.runCode(e).catch(i=>{tt.error("There was an error initiating the command",i)})}else{var r={command:" ",result:{},startTime:Date.now(),endTime:Date.now()};this.scrollConsoleHistoryToBottom(),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())}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(ts),o={},a=!1,s=0;s<i.length;s+=1){var l=i[s],u=t[l],d=e[l];u!==d&&(a=!0),o[l]=u}if(!(r&&!a)){var h=this.props.onSettingsChange;h(o)}}updateDimensions(){this.consolePane.current&&this.setState({consoleHeight:this.consolePane.current.clientHeight}),this.consoleInput.current&&this.consoleInput.current.updateDimensions()}render(){var e=this.props,t=e.actions,r=e.dh,i=e.historyChildren,o=e.language,a=e.statusBarChildren,s=e.openObject,l=e.session,u=e.scope,d=e.commandHistoryStorage,h=e.timeZone,p=e.disabled,f=e.unzip,v=e.supportsType,g=e.iconForType,b=e.showObjectsMenu,y=this.state,S=y.consoleHeight,C=y.consoleHistory,_=y.isScrollDecorationShown,w=y.objectMap,D=y.showCsvOverlay,F=y.csvFile,N=y.csvPaste,x=y.dragError,j=y.csvUploadInProgress,L=this.getObjects(w),re=Math.round(S*.7),A=this.getContextActions(t);return c.jsxs("div",{role:"presentation",className:U("iris-console","h-100","w-100",{disabled:p}),children:[c.jsxs("div",{className:"console-pane",ref:this.consolePane,children:[c.jsxs(Iy,{dh:r,session:l,overflowActions:this.handleOverflowActions,children:[a,b===!0&&c.jsx(Ny,{openObject:s,objects:L})]}),c.jsxs("div",{className:"console-csv-container",onDragOver:$e.handleDragOver,onDragEnter:this.handleDragEnter,onDragLeave:this.handleDragLeave,children:[c.jsxs("div",{role:"presentation",className:U("scroll-pane no-scroll-x",{"scroll-decoration":_}),onScroll:this.handleScrollPaneScroll,ref:this.consoleHistoryScrollPane,children:[c.jsx(lb,{items:C,openObject:s,language:o,disabled:p,supportsType:v,iconForType:g,ref:this.consoleHistoryContent,onCommandSubmit:this.handleCommandSubmit}),i]}),D&&c.jsx($e,{onCancel:this.handleCsvFileCanceled,onFileOpened:this.handleCsvFileOpened,onPaste:this.handleCsvPaste,clearDragError:this.handleClearDragError,dragError:x,onError:this.handleCsvError,uploadInProgress:j,allowZip:f!=null})]}),!D&&c.jsx(In,{ref:this.consoleInput,session:l,language:o,scope:u,onSubmit:this.handleCommandSubmit,maxHeight:re,commandHistoryStorage:d}),D&&c.jsx(Ou,{session:l,onOpenTable:this.handleOpenCsvTable,onClose:this.handleHideCsv,onUpdate:this.handleCsvUpdate,onError:this.handleCsvError,file:F??void 0,paste:N??void 0,onInProgress:this.handleCsvInProgress,timeZone:h,unzip:f})]}),c.jsx(de,{actions:A,ignoreClassNames:[In.INPUT_CLASS_NAME]})]})}}Ke(Ut,"defaultProps",{statusBarChildren:null,settings:{},onSettingsChange:()=>{},scope:null,actions:[],historyChildren:null,timeZone:"America/New_York",objectMap:new Map,disabled:!1,unzip:null,supportsType:$y,iconForType:Fy,showObjectsMenu:!0});Ke(Ut,"LOG_THROTTLE",500);function $n(n,e,t){return(e=Hy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hy(n){var e=Uy(n,"string");return typeof e=="symbol"?e:e+""}function Uy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var By=250,Wy=2500;class Iu extends m.Component{constructor(e){super(e),$n(this,"timer",void 0),$n(this,"cleanup",void 0),$n(this,"loadData",zn(()=>{var t=this.props,r=t.commandHistoryStorage,i=t.item,o=t.language,a=i.id;this.cleanup=r.listenItem(o,a,this.handleUpdate,this.handleError)},By)),$n(this,"getPreviewText",vn(t=>t.split(`
32
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function My(n,e){if(n){if(typeof n=="string")return Qa(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Qa(n,e):void 0}}function Qa(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function jy(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function Ay(n){if(Array.isArray(n))return n}var ky=5e3;function Ny(n){var e=n.openObject,t=n.objects,r=m.useState(""),i=xy(r,2),o=i[0],a=i[1],s=m.useRef(null),l=Tc(()=>{a("")},ky),u=m.useCallback(()=>{var p;l.cancel(),(p=s.current)===null||p===void 0||p.select()},[l]),d=m.useCallback(()=>{l()},[l]),h=m.useMemo(()=>{if(t.length===0)return[];var p={menuElement:c.jsx(Nr,{value:o,onChange:g=>{a(g.target.value)},className:"console-menu",ref:s})},f=o?t.filter(g=>{var b=g.title;return b!=null&&b.toLowerCase().includes(o.toLowerCase())}):t,v=f.map(g=>({title:g.title,action:()=>{e(g)},icon:c.jsx(fu,{type:g.type})}));return[p,...v]},[t,o,e]);return c.jsx(ne,{"aria-label":"Objects",kind:"ghost",disabled:t.length===0,onClick:qs,tooltip:t.length===0?"No objects available":"Objects",icon:c.jsxs("div",{className:"fa-md fa-layers",children:[c.jsx(me,{mask:Hs,icon:ai,transform:"right-5 down-5"}),c.jsx(me,{icon:ai,transform:"right-8 down-6"})]}),children:c.jsx(kr,{actions:h,onMenuOpened:u,onMenuClosed:d,options:{initialKeyboardIndex:1},popperOptions:{placement:"bottom-end"}})})}function es(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 st(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?es(Object(t),!0).forEach(function(r){ze(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):es(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ze(n,e,t){return(e=Ly(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ly(n){var e=Ry(n,"string");return typeof e=="symbol"?e:e+""}function Ry(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var tt=B.module("Console"),ts={isAutoLaunchPanelsEnabled:!0,isPrintStdOutEnabled:!0,isClosePanelsOnDisconnectEnabled:!0};function $y(){return!0}function Fy(n){return c.jsx(c.Fragment,{})}class Ut extends m.PureComponent{static isErrorLevel(e){return e===Pe.STDERR||e===Pe.ERROR||e===Pe.FATAL}static isOutputLevel(e){return e===Pe.STDOUT||Ut.isErrorLevel(e)}constructor(e){super(e),ze(this,"cancelListener",void 0),ze(this,"consolePane",void 0),ze(this,"consoleInput",void 0),ze(this,"consoleHistoryScrollPane",void 0),ze(this,"consoleHistoryContent",void 0),ze(this,"pending",void 0),ze(this,"queuedLogMessages",void 0),ze(this,"resizeObserver",void 0),ze(this,"processLogMessageQueue",Mr(()=>{this.setState(o=>{tt.debug2("processLogMessageQueue",this.queuedLogMessages.length," items");var a=o.consoleHistory;return a=a.concat(this.queuedLogMessages),this.queuedLogMessages=[],{consoleHistory:a}})},Ut.LOG_THROTTLE)),ze(this,"getObjects",_n(o=>Array.from(o.values()))),ze(this,"getContextActions",_n(o=>[...o,{action:this.handleClearShortcut,shortcut:En.CONSOLE.CLEAR},{action:this.handleFocusHistory,shortcut:En.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.handleHistoryResize=this.handleHistoryResize.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=k.createRef(),this.consoleInput=k.createRef(),this.consoleHistoryScrollPane=k.createRef(),this.consoleHistoryContent=k.createRef(),this.pending=new jr,this.queuedLogMessages=[],this.resizeObserver=new window.ResizeObserver(this.handleHistoryResize);var t=this.props,r=t.objectMap,i=t.settings;this.state=st(st({consoleHistory:[],consoleHeight:0,isScrollDecorationShown:!1,objectHistoryMap:new Map,objectMap:new Map(r),showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1,isStuckToBottom:!0},ts),i)}componentDidMount(){this.initConsoleLogging();var e=this.props,t=e.dh,r=e.session;r.addEventListener(t.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.updateDimensions(),this.consoleHistoryScrollPane.current&&this.consoleHistoryContent.current&&(this.resizeObserver.observe(this.consoleHistoryScrollPane.current),this.resizeObserver.observe(this.consoleHistoryContent.current))}componentDidUpdate(e,t){var r=this.props,i=this.state;this.sendSettingsChange(t,i),r.objectMap!==e.objectMap&&this.updateObjectMap(),i.isStuckToBottom&&!this.isAtBottom()&&this.scrollConsoleHistoryToBottom()}componentWillUnmount(){var e=this.props,t=e.dh,r=e.session;r.removeEventListener(t.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.pending.cancel(),this.processLogMessageQueue.cancel(),this.deinitConsoleLogging(),this.resizeObserver.disconnect()}initConsoleLogging(){var e=this.props.session;this.cancelListener=e.onLogMessage(this.handleLogMessage)}deinitConsoleLogging(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}isAtBottom(){if(this.consoleHistoryScrollPane.current==null)return!1;var e=this.consoleHistoryScrollPane.current,t=e.scrollHeight,r=e.clientHeight,i=e.scrollTop;return Math.abs(t-r-i)<=1}handleClearShortcut(e){var t;e.preventDefault(),e.stopPropagation(),(t=this.consoleInput.current)===null||t===void 0||t.clear()}handleCommandStarted(e){var t=e.detail,r=t.code,i=t.result,o=this.pending.add(i),a={command:r,disabledObjects:[],startTime:Date.now(),cancelResult:()=>{i.cancel()},wrappedResult:o},s=this.props,l=s.commandHistoryStorage,u=s.language,d=s.scope,h=l.addItem(u,d,r,{command:r,startTime:new Date().toJSON()});h.catch(p=>{tt.debug("Error adding workspace item",p)}),this.setState(p=>({consoleHistory:p.consoleHistory.concat(a)}),()=>{this.scrollConsoleHistoryToBottom()}),o.then(p=>{this.handleCommandResult(p,a,h)}).catch(p=>{this.handleCommandError(p,a,h)})}handleCommandResult(e,t,r){var i,o,a=e==null||(i=e.startTimestamp)===null||i===void 0?void 0:i.asNumber(),s=e==null||(o=e.endTimestamp)===null||o===void 0?void 0:o.asNumber(),l=st(st({},t),{},{wrappedResult:void 0,cancelResult:void 0,result:e??t.result,serverStartTime:a,serverEndTime:s});this.setState(u=>{var d=u.consoleHistory,h=d.lastIndexOf(t);if(h<0)return tt.error("historyItem not found in consoleHistory"),null;var p=d.concat();return p[h]=l,{consoleHistory:p}}),e&&(this.scrollConsoleHistoryToBottom(),this.updateHistory(e,l),this.updateKnownObjects(l),this.updateWorkspaceHistoryItem({error:e.error,serverStartTime:a,serverEndTime:s},r),this.closeRemovedItems(e.changes),this.openUpdatedItems(e.changes))}handleCommandError(e,t,r){if(Je.isCanceled(e)){tt.debug("Called handleCommandError on a cancelled promise result");return}this.updateWorkspaceHistoryItem({error:"".concat(e)},r),this.setState(i=>{var o=i.consoleHistory.concat(),a=o.lastIndexOf(t),s=st({},t);return s.wrappedResult=void 0,s.cancelResult=void 0,s.endTime=Date.now(),s.result={error:e},o[a]=s,{consoleHistory:o}})}handleFocusHistory(e){e.preventDefault(),e.stopPropagation();var t=this.props.focusCommandHistory;t()}handleLogMessage(e){var t=this.state.isPrintStdOutEnabled;t&&Ut.isOutputLevel(e.logLevel)&&this.queueLogMessage(e.message,e.logLevel)}queueLogMessage(e,t){var r={};Ut.isErrorLevel(t)?r.error=e:r.message=e;var i={command:void 0,result:r};this.queuedLogMessages.push(i),this.processLogMessageQueue()}openUpdatedItems(e){tt.debug("openUpdatedItems",e);var t=this.state.isAutoLaunchPanelsEnabled;if(e!=null){var r=this.props.openObject;[...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 t=this.props.closeObject,r=e.removed;r.forEach(i=>t(i))}}updateHistory(e,t){var r=t;e==null||e.changes==null||r==null||(r.endTime=Date.now(),this.setState(i=>{var o=i.consoleHistory.concat();return{consoleHistory:o}}))}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)){tt.debug2("updateKnownObjects no changes");return}this.setState(r=>{var i,o,a,s=r.consoleHistory,l=s.lastIndexOf(e);if(l<0)return tt.error("historyItem not found in state.consoleHistory"),null;var u=new Map(r.objectHistoryMap),d=new Map(r.objectMap),h=function(f){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,g=f.title;W(g);var b=u.get(g);if(b!=null&&b>=0){var y;s===r.consoleHistory&&(s=s.concat());var S=st(st({},s[b]),{},{disabledObjects:[...(y=s[b].disabledObjects)!==null&&y!==void 0?y:[],g]});s[b]=S}u.set(g,l),v?d.delete(g):d.set(g,f)};return(i=t)===null||i===void 0||i.updated.forEach(p=>h(p)),(o=t)===null||o===void 0||o.removed.forEach(p=>h(p,!0)),(a=t)===null||a===void 0||a.created.forEach(p=>{var f=p.title;W(f),u.set(f,l),d.set(f,p)}),{objectHistoryMap:u,objectMap:d,consoleHistory:s}})}updateObjectMap(){var e=this.props.objectMap;this.setState({objectMap:e})}updateWorkspaceHistoryItem(e,t){var r=this.pending.add(t),i=new Date().toJSON();r.then(o=>{var a=st(st({},o),{},{data:st(st({},o.data),{},{endTime:i,result:e})}),s=this.props,l=s.commandHistoryStorage,u=s.language;l.updateItem(u,a).catch(d=>{tt.warn("Error updating command history storage",d)})}).catch(o=>{tt.debug("Error updating workspace history item",o)})}scrollConsoleHistoryToBottom(){var e=this.consoleHistoryScrollPane.current;e!=null&&window.requestAnimationFrame(()=>{e.scrollTo({top:e.scrollHeight,behavior:"instant"})})}handleScrollPaneScroll(e){tt.debug("handleScrollPaneScroll",e);var t=this.consoleHistoryScrollPane.current;W(t),this.setState({isScrollDecorationShown:t.scrollTop>0&&t.scrollHeight>t.clientHeight,isStuckToBottom:this.isAtBottom()})}handleHistoryResize(e){tt.debug("handleHistoryResize",e);var t=e[0];if(t.contentRect.height>0&&t.contentRect.width>0){var r=this.state.isStuckToBottom;r&&!this.isAtBottom()&&this.scrollConsoleHistoryToBottom()}}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 t=e.dataTransfer.items;if(t.length>1){this.setState({dragError:$e.MULTIPLE_FILE_ERROR});return}var r=t[0];$e.isValidDropItem(r)?this.setState({dragError:null}):this.setState({dragError:$e.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 t=this.props,r=t.dh,i=t.openObject,o=t.commandHistoryStorage,a=t.language,s=t.scope,l=this.state,u=l.consoleHistory,d=l.objectMap,h={name:e,title:e,type:r.VariableType.TABLE},p=d.has(e),f={startTime:Date.now(),endTime:Date.now(),disabledObjects:[],result:{changes:{created:[],updated:[],removed:[],[p?"updated":"created"]:[h]}}},v=u.concat(f);this.setState({consoleHistory:v}),this.scrollConsoleHistoryToBottom(),this.updateKnownObjects(f),i({name:e,type:r.VariableType.TABLE}),o.addItem(a,s,e,{command:e,startTime:new Date().toJSON(),endTime:new Date().toJSON()})}addConsoleHistoryMessage(e,t){var r=this.state.consoleHistory,i={startTime:Date.now(),endTime:Date.now(),result:{message:e,error:t}},o=r.concat(i);this.setState({consoleHistory:o})}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 e=this.state,t=e.isAutoLaunchPanelsEnabled,r=e.isClosePanelsOnDisconnectEnabled,i=e.isPrintStdOutEnabled,o=this.props.actions;return[...o,{title:"Print Stdout",action:this.handleTogglePrintStdout,group:de.groups.high,icon:i?Gr:void 0,order:10},{title:"Auto Launch Panels",action:this.handleToggleAutoLaunchPanels,group:de.groups.high,icon:t?Gr:void 0,order:20},{title:"Close Panels on Disconnect",action:this.handleToggleClosePanelsOnDisconnect,group:de.groups.high,icon:r?Gr:void 0,order:30},{title:"Upload Table from File",action:this.handleUploadCsv,group:de.groups.high+10,order:40}]}handleCommandSubmit(e){if(e==="clear"||e==="cls")this.clearConsoleHistory();else if(e.length>0){var t=this.props.session;t.runCode(e).catch(i=>{tt.error("There was an error initiating the command",i)})}else{var r={command:" ",result:{},startTime:Date.now(),endTime:Date.now()};this.scrollConsoleHistoryToBottom(),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())}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(ts),o={},a=!1,s=0;s<i.length;s+=1){var l=i[s],u=t[l],d=e[l];u!==d&&(a=!0),o[l]=u}if(!(r&&!a)){var h=this.props.onSettingsChange;h(o)}}updateDimensions(){this.consolePane.current&&this.setState({consoleHeight:this.consolePane.current.clientHeight}),this.consoleInput.current&&this.consoleInput.current.updateDimensions()}render(){var e=this.props,t=e.actions,r=e.dh,i=e.historyChildren,o=e.language,a=e.statusBarChildren,s=e.openObject,l=e.session,u=e.scope,d=e.commandHistoryStorage,h=e.timeZone,p=e.disabled,f=e.unzip,v=e.supportsType,g=e.iconForType,b=e.showObjectsMenu,y=this.state,S=y.consoleHeight,C=y.consoleHistory,_=y.isScrollDecorationShown,w=y.objectMap,D=y.showCsvOverlay,F=y.csvFile,N=y.csvPaste,x=y.dragError,j=y.csvUploadInProgress,L=this.getObjects(w),re=Math.round(S*.7),A=this.getContextActions(t);return c.jsxs("div",{role:"presentation",className:U("iris-console","h-100","w-100",{disabled:p}),children:[c.jsxs("div",{className:"console-pane",ref:this.consolePane,children:[c.jsxs(Iy,{dh:r,session:l,overflowActions:this.handleOverflowActions,children:[a,b===!0&&c.jsx(Ny,{openObject:s,objects:L})]}),c.jsxs("div",{className:"console-csv-container",onDragOver:$e.handleDragOver,onDragEnter:this.handleDragEnter,onDragLeave:this.handleDragLeave,children:[c.jsxs("div",{role:"presentation",className:U("scroll-pane no-scroll-x",{"scroll-decoration":_}),onScroll:this.handleScrollPaneScroll,ref:this.consoleHistoryScrollPane,children:[c.jsx(lb,{items:C,openObject:s,language:o,disabled:p,supportsType:v,iconForType:g,ref:this.consoleHistoryContent,onCommandSubmit:this.handleCommandSubmit}),i]}),D&&c.jsx($e,{onCancel:this.handleCsvFileCanceled,onFileOpened:this.handleCsvFileOpened,onPaste:this.handleCsvPaste,clearDragError:this.handleClearDragError,dragError:x,onError:this.handleCsvError,uploadInProgress:j,allowZip:f!=null})]}),!D&&c.jsx(In,{ref:this.consoleInput,session:l,language:o,scope:u,onSubmit:this.handleCommandSubmit,maxHeight:re,commandHistoryStorage:d}),D&&c.jsx(Ou,{session:l,onOpenTable:this.handleOpenCsvTable,onClose:this.handleHideCsv,onUpdate:this.handleCsvUpdate,onError:this.handleCsvError,file:F??void 0,paste:N??void 0,onInProgress:this.handleCsvInProgress,timeZone:h,unzip:f})]}),c.jsx(de,{actions:A,ignoreClassNames:[In.INPUT_CLASS_NAME]})]})}}ze(Ut,"defaultProps",{statusBarChildren:null,settings:{},onSettingsChange:()=>{},scope:null,actions:[],historyChildren:null,timeZone:"America/New_York",objectMap:new Map,disabled:!1,unzip:null,supportsType:$y,iconForType:Fy,showObjectsMenu:!0});ze(Ut,"LOG_THROTTLE",500);function $n(n,e,t){return(e=Hy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hy(n){var e=Uy(n,"string");return typeof e=="symbol"?e:e+""}function Uy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var By=250,Wy=2500;class Iu extends m.Component{constructor(e){super(e),$n(this,"timer",void 0),$n(this,"cleanup",void 0),$n(this,"loadData",zn(()=>{var t=this.props,r=t.commandHistoryStorage,i=t.item,o=t.language,a=i.id;this.cleanup=r.listenItem(o,a,this.handleUpdate,this.handleError)},By)),$n(this,"getPreviewText",vn(t=>t.split(`
33
33
  `,Wy).join(`
34
34
  `),{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,i=this.state.data;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=window.setInterval(this.handleTimeout,1e3)}stopTimer(){this.timer!=null&&(clearInterval(this.timer),this.timer=void 0)}updateTime(){this.setState({currentTime:Date.now()})}handleError(e){this.setState({error:"".concat(e)})}handleUpdate(e){var t=e??{},r=t.data;this.setState({data:r});var i=this.props.onUpdate;i==null||i(r)}handleTimeout(){this.updateTime()}render(){var e,t=this.props,r=t.item.name,i=t.language,o=this.state,a=o.currentTime,s=o.data,l=o.error,u=s??{},d=u.result,h=u.startTime,p=u.endTime,f=(e=d==null?void 0:d.error)!==null&&e!==void 0?e:l,v=He.formatConvertedDuration(h,p??a),g=this.getPreviewText(r),b=!!v;return c.jsxs("div",{className:"command-history-item-tooltip",children:[c.jsxs("div",{className:"scroll-container",children:[c.jsx(vu,{language:i,children:g}),g.length<r.length&&c.jsx("p",{children:"Preview Truncated..."})]}),c.jsxs("div",{className:"result-info",children:[c.jsxs("div",{className:"d-flex justify-content-between",children:[!!f&&c.jsxs("div",{className:"text-danger mr-1",children:[c.jsx(me,{icon:Bs})," Executed with errors"]}),c.jsxs("div",{className:"time-wrapper",children:["Elapsed time:"," ",b?c.jsx("span",{className:"time-string",children:v}):c.jsx(Us,{className:"loading-spinner-vertical-align"})]})]}),!!f&&c.jsx("div",{className:"error-message",children:f})]})]})}}$n(Iu,"defaultProps",{onUpdate:()=>{}});var Ky=512;function zy(n){var e=n.item,t=n.language,r=n.isSelected,i=r===void 0?!1:r,o=n.commandHistoryStorage,a=e.name.substring(0,Ky),s=m.useRef(null),l=m.useCallback(()=>{var u;(u=s.current)===null||u===void 0||u.update()},[s]);return c.jsxs("div",{className:U("command-history-item",{selected:i}),children:[a,c.jsx(ue,{ref:s,interactive:!0,options:{placement:"left",modifiers:{preventOverflow:{enabled:!0,boundariesElement:"viewport",order:825}}},popperClassName:"command-history-item-popper",children:c.jsx(Iu,{item:e,language:t,onUpdate:l,commandHistoryStorage:o})})]})}class xr extends m.Component{static itemKey(e,t){return"".concat(t.title)}static renderContent(e){return e.selectionRequired!==void 0&&e.selectionRequired?c.jsxs("div",{className:"fa-md fa-layers",children:[c.jsx(me,{icon:ad,mask:e.icon,transform:"right-5 down-5 shrink-4"}),c.jsx(me,{icon:Rs,transform:"shrink-3 right-7 down-6"})]}):c.jsx(me,{icon:e.icon})}render(){var e=this.props,t=e.actions,r=e.hasSelection;return c.jsx("div",{className:"command-history-actions",children:t.map((i,o)=>c.jsx(ne,{kind:"inline",className:U(i.className),onClick:i.action,tooltip:i.description,disabled:i.selectionRequired!==void 0&&i.selectionRequired&&!r,icon:xr.renderContent(i)},xr.itemKey(o,i)))})}}var Vy=150,ns=3,rs=B.module("CommandHistoryViewportUpdater");function Gy(n){var e=n.table,t=n.columns,r=n.top,i=r===void 0?0:r,o=n.bottom,a=o===void 0?0:o,s=n.search,l=n.isReversed,u=l===void 0?!1:l,d=n.onUpdate,h=m.useMemo(()=>Mr(p=>{var f=p.bottom-p.top,v=Math.max(0,p.top-f*ns),g=p.bottom+f*ns;e.setViewport({top:v,bottom:g,columns:p.columns})},Vy),[e]);return m.useEffect(function(){var f=e.onUpdate(v=>{var g,b;d({items:(g=v.items)!==null&&g!==void 0?g:[],offset:(b=v.offset)!==null&&b!==void 0?b:0})});return()=>{rs.debug("onUpdate cleanup"),f()}},[e,d]),m.useEffect(function(){e.setSearch(s??"")},[e,s]),m.useEffect(function(){h({top:i,bottom:a,columns:t})},[h,i,a,t,s,u]),m.useEffect(()=>()=>{rs.debug2("Cancel throttledUpdateViewport"),h.cancel()},[h]),null}function is(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.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 o=n.apply(e,t);function a(l){is(o,r,i,a,s,"next",l)}function s(l){is(o,r,i,a,s,"throw",l)}a(void 0)})}}function ft(n,e,t){return(e=Xy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xy(n){var e=qy(n,"string");return typeof e=="symbol"?e:e+""}function qy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Nt=B.module("CommandHistory");class Le extends m.Component{static getCommandsFromViewport(e,t,r){for(var i=[],o=0;o<r.length;o+=1)for(var a=r[o],s=a[0];s<=a[1];s+=1)if(s>=t&&s<t+e.length){var l=e[s-t].name;i.push(l)}return i}static getCommandsFromSnapshot(e,t){return os(function*(){var r=yield e.getSnapshot(t);return[...r.values()].map(i=>i.name)})()}constructor(e){super(e),ft(this,"itemActions",void 0),ft(this,"historyActions",void 0),ft(this,"pending",void 0),ft(this,"searchInputRef",void 0),ft(this,"itemListRef",void 0),ft(this,"debouncedSearchChange",zn(()=>{this.setState(r=>{var i=r.searchText;return{debouncedSearchText:i,selectedRanges:[]}})},Le.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:sd,shortcut:yn.COPY,action:this.copySelectedCommands,group:de.groups.edit},{title:"Send to Console",description:"Open selected commands in the console",icon:no,shortcut:En.COMMAND_HISTORY.SEND_TO_CONSOLE,action:this.sendToConsole,group:Le.menuGroups.send,order:10},{title:"Run in Console",description:"Run selected commands in the console",icon:ld,shortcut:En.COMMAND_HISTORY.RUN,action:this.runInConsole,group:Le.menuGroups.send,order:10},{title:"Send to Active Notebook",description:"Open selected commands in a notebook",icon:ro,shortcut:En.COMMAND_HISTORY.SEND_TO_NOTEBOOK,action:this.sendToNotebook,group:Le.menuGroups.send,order:20},{title:"Send to New Notebook",description:"Open selected commands in a new notebook",icon:Ws,action:this.createNotebook,group:Le.menuGroups.send,order:30}],this.historyActions=[{title:"Send to Console",icon:no,selectionRequired:!0,description:"Open selected commands in the console",action:this.sendToConsole},{title:"Send to Notebook",icon:ro,selectionRequired:!0,description:"Open selected commands in a notebook",action:this.sendToNotebook}],this.pending=new jr,this.searchInputRef=k.createRef(),this.itemListRef=k.createRef();var t=e.table;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 os(function*(){var t=e.state,r=t.items,i=t.offset,o=t.selectedRanges,a=o.slice().sort((l,u)=>l[0]-u[0]);if(a.length===0)return[];if(a[0][0]>=i&&a[a.length-1][1]<i+r.length)return Le.getCommandsFromViewport(r,i,a);var s=e.props.table;return e.pending.add(Le.getCommandsFromSnapshot(s,a))})()}getSelectedCommandText(){return this.getSelectedCommands().then(e=>e.join(`
35
35
  `))}updateActions(){this.setState(e=>{var t=e.selectedRanges,r=t.reduce((i,o)=>i+o[1]-o[0]+1,0);return r>0&&r<Le.MAX_SELECTION_COUNT?(Nt.debug("Updating actions",this.itemActions),{actions:this.itemActions}):(Nt.debug("Disabling actions",r),{actions:[]})})}copySelectedCommands(){this.getSelectedCommandText().then(Js).catch(Nt.error)}createNotebook(){this.getSelectedCommandText().then(e=>{var t=this.props,r=t.language,i=t.sendToNotebook;i({value:e,language:r},!0)}).catch(Nt.error)}sendToNotebook(){this.getSelectedCommandText().then(e=>{var t=this.props,r=t.language,i=t.sendToNotebook;i({value:e,language:r})}).catch(Nt.error)}sendToConsole(){var e=this.props.sendToConsole;this.getSelectedCommandText().then(e).catch(Nt.error)}runInConsole(){this.getSelectedCommandText().then(e=>{var t=this.props.sendToConsole;t(e,!0,!0)}).catch(Nt.error)}handleSelect(e){var t=this.props.sendToConsole,r=this.state,i=r.items,o=r.offset;if(e<o||e>=o+i.length){Nt.error("Invalid index!",e);return}var a=i[e-o].name;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 t=e.items,r=e.offset,i=this.props.table,o=i.size;this.setState({items:t,itemCount:o,offset:r})}renderItem(e){var t=e.item;e.itemIndex;var r=e.isSelected,i=this.props,o=i.language,a=i.commandHistoryStorage;return c.jsx(zy,{isSelected:r,item:t,language:o,commandHistoryStorage:a})}focus(){this.searchInputRef.current&&this.searchInputRef.current.focus()}restoreScrollPosition(){var e;(e=this.itemListRef.current)===null||e===void 0||e.restoreScrollPosition()}render(){var e,t=this.props,r=t.language,i=t.table,o=this.state,a=o.actions,s=o.historyActions,l=o.searchText,u=o.debouncedSearchText,d=o.top,h=o.bottom,p=o.items,f=o.itemCount,v=o.offset,g=o.selectedRanges,b=(e=gu.LANGUAGE_MAP.get(r))!==null&&e!==void 0?e:"";return c.jsxs("div",{className:"command-history",children:[c.jsxs("div",{className:"command-history-search-bar",children:[c.jsx(Nr,{ref:this.searchInputRef,value:l,placeholder:"".concat(b," Command History"),onChange:this.handleSearchChange}),c.jsx(xr,{actions:s,hasSelection:g.length>0})]}),c.jsxs("div",{className:"command-history-list",children:[c.jsx(ct,{ref:this.itemListRef,itemCount:f,items:p,offset:v,selectedRanges:g,onSelect:this.handleSelect,onSelectionChange:this.handleSelectionChange,onViewportChange:this.handleViewportChange,renderItem:this.renderItem,rowHeight:Le.ITEM_HEIGHT,isDoubleClickSelect:!0,isMultiSelect:!0,isStickyBottom:!0}),c.jsx(Gy,{table:i,top:d,bottom:h,search:u,onUpdate:this.handleViewportUpdate}),c.jsx(de,{actions:a})]})]})}}ft(Le,"ITEM_HEIGHT",29);ft(Le,"MAX_SELECTION_COUNT",1e4);ft(Le,"SET_SEARCH_DEBOUNCE_MS",150);ft(Le,"menuGroups",{send:de.groups.medium+100});class Zy extends m.PureComponent{constructor(e){super(e),this.handleSwitchClick=this.handleSwitchClick.bind(this)}handleSwitchClick(){var e=this.props,t=e.logLevel,r=e.onClick;r(t)}render(){var e=this.props,t=e.logLevel,r=e.on;return c.jsxs("div",{className:U("log-level-menu-item",t),children:[c.jsx(cm,{on:r,onClick:this.handleSwitchClick}),t]})}}function as(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?as(Object(t),!0).forEach(function(r){Ze(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):as(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ze(n,e,t){return(e=Yy(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yy(n){var e=Jy(n,"string");return typeof e=="symbol"?e:e+""}function Jy(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ve extends m.PureComponent{static getLogText(e){var t=new Date(e.micros/1e3),r=Or.formatTimestamp(t);return"".concat(r," ").concat(e.logLevel," ").concat(e.message)}constructor(e){super(e),Ze(this,"cancelListener",void 0),Ze(this,"editor",void 0),Ze(this,"editorContainer",void 0),Ze(this,"logLevelMenuItems",void 0),Ze(this,"flushTimer",void 0),Ze(this,"bufferedMessages",void 0),Ze(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 r=this.state.shownLogLevels;t.shownLogLevels!==r&&this.refreshLogText();var i=this.props.session;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:c.jsx("div",{className:"log-level-menu-title",children:"Display Log Levels"}),group:1,order:10});for(var i=function(){var s=ve.AllLogLevels[o],l=e[s]!=null?e[s]:!1;r.push({title:s,group:1,order:o+100,menuElement:c.jsx(Zy,{logLevel:s,on:l,onClick:t.handleMenuItemClick,ref:u=>{u!=null&&(t.logLevelMenuItems[s]=u)}})})},o=0;o<ve.AllLogLevels.length;o+=1)i();return r.push({group:1,order:1e3,menuElement:c.jsxs("div",{className:"log-level-menu-controls",children:[c.jsx(ne,{kind:"ghost",className:"log-level-toggle-all",onClick:this.handleToggleAllClick,children:"Toggle All"}),c.jsx(ne,{kind:"ghost",onClick:this.handleResetClick,children:"Reset"})]})}),r}resetLogLevels(){for(var e={},t=function(){var o=ve.AllLogLevels[r],a=ve.DefaultLogLevels.some(s=>s===o);e[o]=a},r=0;r<ve.AllLogLevels.length;r+=1)t();this.setState({shownLogLevels:e})}startListening(){var e=this.props.session;this.cancelListener=e.onLogMessage(this.handleLogMessage)}stopListening(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}initMonaco(){W(this.editorContainer),this.editor=Re.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"}),[[tn.Escape],[nt.Shift|tn.Escape]].forEach(e=>{W(this.editor),Te.disableKeyBindings(this.editor,e),this.editor.addAction({id:"clear-selection-on-escape",label:"",keybindings:[tn.Escape],keybindingContext:"findWidgetVisible && editorTextFocus",run:()=>{var t,r,i=(t=this.editor)===null||t===void 0?void 0:t.getPosition();W(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 e=this.state.shownLogLevels,t=!0,r=0;r<ve.AllLogLevels.length;r+=1){var i=ve.AllLogLevels[r];if(!e[i]){t=!1;break}}if(t)this.setState({shownLogLevels:{}});else{for(var o={},a=0;a<ve.AllLogLevels.length;a+=1){var s=ve.AllLogLevels[a];o[s]=!0}this.setState({shownLogLevels:o})}}toggleLogLevel(e){var t=this.state.shownLogLevels,r=t[e],i={};i[e]=!r,this.updateLogLevels(i)}updateLogLevels(e){var t=this.state.shownLogLevels;t=ss(ss({},t),e),this.setState({shownLogLevels:t})}appendLogText(e){if(this.editor){var t=this.editor.getModel(),r=t==null?void 0:t.getLineCount();W(r);var i=t==null?void 0:t.getLineLength(r);W(i);var o=this.isBottomVisible(),a=[];if(i>0&&(a.push({range:{startLineNumber:r,startColumn:i+1,endLineNumber:r,endColumn:i+1},text:`
@@ -39,8 +39,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
39
39
  `&&(e+=`
40
40
  `)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,ve.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"},t=this.state.shownLogLevels,r=this.getMenuActions(t);return c.jsxs("div",{className:"log-pane h-100 w-100",children:[c.jsxs("div",{className:"log-pane-menu",children:[c.jsx(ne,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:ud,tooltip:"Clear log"}),c.jsx(ne,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:dd,tooltip:"Log Settings",onClick:()=>{},children:c.jsx(kr,{actions:r,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),c.jsx("div",{className:"log-pane-editor h-100 w-100",ref:i=>{this.editorContainer=i}})]})}}Ze(ve,"DefaultLogLevels",[Pe.STDOUT,Pe.ERROR,Pe.FATAL,Pe.STDERR,Pe.WARN]);Ze(ve,"AllLogLevels",[Pe.INFO,Pe.STDOUT,Pe.ERROR,Pe.FATAL,Pe.STDERR,Pe.WARN,Pe.DEBUG,Pe.TRACE]);Ze(ve,"bufferTimeout",16);Ze(ve,"maxLogSize",131072);Ze(ve,"truncateSize",65536);function ls(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function Qy(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ls(o,r,i,a,s,"next",l)}function s(l){ls(o,r,i,a,s,"throw",l)}a(void 0)})}}function us(n,e){return r0(n)||n0(n,e)||t0(n,e)||e0()}function e0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
41
41
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function t0(n,e){if(n){if(typeof n=="string")return ds(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ds(n,e):void 0}}function ds(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function n0(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function r0(n){if(Array.isArray(n))return n}var i0=B.module("HeapUsage");function o0(n){var e,t=n.connection,r=n.defaultUpdateInterval,i=n.hoverUpdateInterval,o=n.bgMonitoring,a=o===void 0?!0:o,s=n.monitorDuration,l=zg(),u=m.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),d=us(u,2),h=d[0],p=d[1],f=m.useState(!1),v=us(f,2),g=v[0],b=v[1],y=m.useRef({timestamps:[],usages:[]}),S=tl(),C=m.useCallback(Qy(function*(){try{var ce=yield t.getWorkerHeapInfo();if(!S.current)return;if(p(ce),a||g){for(var Z=(ce.totalHeapSize-ce.freeMemory)/ce.maximumHeapSize,V=Date.now(),te=y.current,G=te.timestamps,J=te.usages;G.length!==0&&V-G[0]>s*1.5;)G.shift(),J.shift();G.push(V),J.push(Z)}else y.current={timestamps:[],usages:[]}}catch(M){i0.warn("Unable to get heap usage",M)}}),[t,S,a,g,s]);Pc(C,g?i:r);var _=(ce,Z)=>Math.round(ce*10**Z)/10**Z,w=2,D=1024**3,F=h.freeMemory,N=h.totalHeapSize,x=h.maximumHeapSize,j=_(F/D,w),L=_(N/D,w),re=_(x/D,w),A=L-j,X=function(Z,V){var te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return c.jsxs("div",{className:U("heap-usage-info-row",{"heading-bottom-border":te}),children:[c.jsx("div",{className:"font-weight-bold",children:Z}),c.jsx("div",{children:V})]})},ie=y.current,oe=ie.timestamps,be=ie.usages,ye=(e=oe[oe.length-1])!==null&&e!==void 0?e:0,Oe=N/x,we=(N-F)/x;return c.jsxs("div",{className:"max-memory",children:[c.jsx("div",{className:"total-memory",style:{width:"calc(".concat(Oe*100,"% - ").concat(Oe*2,"px")}}),c.jsx("div",{className:U("used-memory",{"heap-overflow":(N-F)/x>.95}),style:{width:"calc(".concat(we*100,"% - ").concat(we*2,"px")}}),c.jsxs("div",{className:"memory-text",children:[re.toFixed(1)," GB"]}),c.jsx(ue,{onEntered:()=>b(!0),onExited:()=>b(!1),interactive:!0,children:c.jsxs("div",{className:"heap-tooltip",children:[X("In use:","".concat(A.toFixed(w)," of ").concat(re.toFixed(w)," GB"),!0),X("Free:","".concat(j.toFixed(w)," GB")),X("Total:","".concat(L.toFixed(w)," GB")),X("Max:","".concat(re.toFixed(w)," GB")),c.jsx("div",{className:"heap-plot",children:c.jsx(Kg,{data:[{x:[...oe],y:[...be],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:l.linecolor,range:[ye-s,ye],linecolor:l.linecolor,linewidth:2,mirror:!0},yaxis:{dtick:.2,gridcolor:l.linecolor,range:[0,1],linecolor:l.linecolor,linewidth:2,mirror:!0}}})}),c.jsxs("div",{className:"heap-utilisation-text",children:["% utilization over ",Math.round(s/1e3/60)," min."]})]})})]})}function Jn(n,e,t){return(e=a0(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function a0(n){var e=s0(n,"string");return typeof e=="symbol"?e:e+""}function s0(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ot{}Jn(ot,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");Jn(ot,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");Jn(ot,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");Jn(ot,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");Jn(ot,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");function zt(n,e,t){return(e=l0(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function l0(n){var e=u0(n,"string");return typeof e=="symbol"?e:e+""}function u0(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class vt{}zt(vt,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");zt(vt,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");zt(vt,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");zt(vt,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");zt(vt,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");zt(vt,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");zt(vt,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");zt(vt,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");function Dt(n,e,t){return(e=d0(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function d0(n){var e=c0(n,"string");return typeof e=="symbol"?e:e+""}function c0(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Fe{}Dt(Fe,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");Dt(Fe,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");Dt(Fe,"CLOSE_FILE","NotebookEvent.closeFile");Dt(Fe,"RENAME","NotebookEvent.rename");Dt(Fe,"RENAME_FILE","NotebookEvent.renameFile");Dt(Fe,"REGISTER_FILE","NotebookEvent.registerFile");Dt(Fe,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");Dt(Fe,"UNREGISTER_FILE","NotebookEvent.unregisterFile");Dt(Fe,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");var Zi=mt(ot.SESSION_OPENED),h0=Zi.listen,RC=Zi.emit,$C=Zi.useListener,Yi=mt(ot.SESSION_CLOSED),m0=Yi.listen,FC=Yi.emit,HC=Yi.useListener,p0=["children"];function cs(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 hs(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?cs(Object(t),!0).forEach(function(r){Ti(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):cs(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function f0(n,e){if(n==null)return{};var t,r,i=v0(n,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(r=0;r<o.length;r++)t=o[r],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(n,t)&&(i[t]=n[t])}return i}function v0(n,e){if(n==null)return{};var t={};for(var r in n)if({}.hasOwnProperty.call(n,r)){if(e.indexOf(r)!==-1)continue;t[r]=n[r]}return t}function Ti(n,e,t){return(e=g0(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:e+""}function b0(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class y0 extends m.PureComponent{constructor(e){super(e),Ti(this,"stopListenForSessionClosed",void 0),Ti(this,"stopListenForSessionOpened",void 0),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this)}componentDidMount(){var e=this.props.glEventHub;this.stopListenForSessionClosed=m0(e,this.handleSessionClosed),this.stopListenForSessionOpened=h0(e,this.handleSessionOpened),e.on(vt.CLEAR_ALL_FILTERS,this.handleClearAllFilters)}componentWillUnmount(){var e,t,r=this.props.glEventHub;(e=this.stopListenForSessionClosed)===null||e===void 0||e.call(this),(t=this.stopListenForSessionOpened)===null||t===void 0||t.call(this),r.off(vt.CLEAR_ALL_FILTERS,this.handleClearAllFilters)}handleClearAllFilters(){for(var e=this.props.onClearAllFilters,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];e==null||e(...r)}handleSessionClosed(e){var t=this.props.onSessionClose;t==null||t(e)}handleSessionOpened(e){var t=this.props.onSessionOpen;t==null||t(e)}render(){var e=this.props,t=e.children,r=f0(e,p0);return c.jsx(Og,hs(hs({},r),{},{children:t}))}}var Hr=yl(y0),S0=Object.freeze({}),C0=new Map,Ur=Object.freeze([]),UC=(n,e)=>{var t;return(t=De(n,e).columns)!==null&&t!==void 0?t:Ur},BC=(n,e)=>{var t;return(t=De(n,e).filterSets)!==null&&t!==void 0?t:Ur},WC=(n,e)=>{var t;return(t=De(n,e).filters)!==null&&t!==void 0?t:Ur},KC=(n,e)=>{var t;return(t=De(n,e).tableMap)!==null&&t!==void 0?t:C0},zC=(n,e)=>De(n,e).isolatedLinkerPanelId,VC=(n,e)=>{var t;return(t=De(n,e).links)!==null&&t!==void 0?t:Ur},GC=(n,e)=>De(n,e).columnSelectionValidator,XC=(n,e)=>{var t;return(t=De(n,e).consoleSettings)!==null&&t!==void 0?t:S0},qC=(n,e)=>De(n,e).connection,Br=(n,e)=>De(n,e).sessionWrapper;function Dr(n,e,t){return(e=_0(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _0(n){var e=w0(n,"string");return typeof e=="symbol"?e:e+""}function w0(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var gr=B.module("CommandHistoryPanel");class Qn extends m.Component{static handleError(e){gr.error(e)}constructor(e){super(e),Dr(this,"container",void 0),Dr(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=k.createRef(),this.pending=new jr;var t=e.session,r=e.sessionId,i=e.language;this.state={panelState:{},session:t,sessionId:r,language:i,contextActions:[{action:this.handleFocusHistory,shortcut:En.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){var e=this.props,t=e.glEventHub,r=e.session;t.on(ot.FOCUS_HISTORY,this.handleFocusHistory),r!=null&&this.loadTable()}componentWillUnmount(){var e=this.props.glEventHub;e.off(ot.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){var t=e.session,r=e.language,i=e.sessionId;this.setState({session:t,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,r=this.state,i=r.session,o=r.language;if(gr.debug("handleSendToNotebook",i,e),!i){gr.error("Session is not connected.");return}var a=this.props.glEventHub;a.emit(t?Fe.CREATE_NOTEBOOK:Fe.SEND_TO_NOTEBOOK,i,o,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;gr.debug("handleSendToConsole",e);var i=this.props.glEventHub;i.emit(ot.SEND_COMMAND,e,t,r)}loadTable(){var e=this.props.commandHistoryStorage,t=this.state,r=t.language,i=t.sessionId;W(r),W(i),this.pending.add(e.getTable(r,i,Date.now()),o=>o.close()).then(o=>{this.setState({table:o})}).catch(Qn.handleError)}render(){var e=this.props,t=e.glContainer,r=e.glEventHub,i=e.commandHistoryStorage,o=this.state,a=o.language,s=o.contextActions,l=o.table;return c.jsxs(Hr,{className:"command-history-pane",componentPanel:this,glContainer:t,glEventHub:r,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[!l&&c.jsx("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),l&&a!=null&&c.jsxs(c.Fragment,{children:[c.jsx(Le,{ref:this.container,language:a,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:l,commandHistoryStorage:i}),c.jsx(de,{actions:s})]})]})}}Dr(Qn,"COMPONENT","CommandHistoryPanel");Dr(Qn,"TITLE","Command History");var E0=(n,e)=>{var t=El(n),r=Br(n,e.localDashboardId),i=r??{},o=i.session,a=i.config,s=a??{},l=s.type,u=s.id;return{commandHistoryStorage:t,language:l,session:o,sessionId:u}},ZC=Vn(E0,null,null,{forwardRef:!0})(Qn);function ms(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 br(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ms(Object(t),!0).forEach(function(r){rn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ms(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function rn(n,e,t){return(e=P0(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function P0(n){var e=T0(n,"string");return typeof e=="symbol"?e:e+""}function T0(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var fn=B.module("ConsolePanel"),O0=500,I0=Object.freeze({consoleSettings:{},itemIds:[]});class Wr extends m.PureComponent{constructor(e){super(e),rn(this,"consoleRef",void 0),rn(this,"objectSubscriptionCleanup",void 0),rn(this,"savePanelState",zn(()=>{var a=this.state,s=a.consoleSettings,l=a.itemIds,u={consoleSettings:s,itemIds:[...l]};fn.debug("Saving panel state",u),this.setState({panelState:u})},O0)),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=k.createRef();var t=e.panelState,r=br(br({},I0),t||{}),i=r.consoleSettings,o=r.itemIds;this.state={consoleSettings:i,itemIds:new Map(o),objectMap:new Map,error:void 0,panelState:r}}componentDidMount(){var e=this.props.glEventHub;this.closeDisconnectedPanels(),e.on(ee.MOUNT,this.handlePanelMount),this.subscribeToFieldUpdates()}componentDidUpdate(e,t){var r=this.state,i=r.consoleSettings,o=r.itemIds;(t.consoleSettings!==i||t.itemIds!==o)&&this.savePanelState()}componentWillUnmount(){var e,t=this.props.glEventHub;this.savePanelState.flush(),t.off(ee.MOUNT,this.handlePanelMount),(e=this.objectSubscriptionCleanup)===null||e===void 0||e.call(this)}subscribeToFieldUpdates(){var e=this.props.sessionWrapper;if(e!=null){var t=e.session;this.objectSubscriptionCleanup=t.subscribeToFieldUpdates(r=>{fn.debug("Got updates",r),this.setState(i=>{var o=i.objectMap,a=r.updated,s=r.created,l=r.removed,u=[...a,...l],d=new Map(o);u.forEach(p=>{var f=p.title;f!==void 0&&d.delete(f)});var h=[...a,...s];return h.forEach(p=>{p.title!==void 0&&d.set(p.title,p)}),{objectMap:d}})})}}setItemId(e,t){this.setState(r=>{var i=r.itemIds,o=new Map(i);return o.set(e,t),{itemIds:o}})}getItemId(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this.state.itemIds,i=r.get(e);return i==null&&t&&(i=Pt(),this.setItemId(e,i)),i}deleteItemId(e){this.setState(t=>{var r=t.itemIds;fn.debug("Delete item",e,r);var i=[...r.keys()].find(a=>r.get(a)===e);if(i===void 0)return null;var o=new Map(r);return o.delete(i),{itemIds:o}})}handleTabFocus(){var e;(e=this.consoleRef.current)===null||e===void 0||e.focus()}handlePanelMount(e){var t,r,i=this.state.itemIds,o=e==null||(t=e.props)===null||t===void 0?void 0:t.id,a=e==null||(r=e.props)===null||r===void 0||(r=r.metadata)===null||r===void 0?void 0:r.sourcePanelId;if(o&&a){var s=new Set(i.values());s.has(a)&&this.setItemId(o,o)}}handlePanelClosed(e){var t=this.props.glContainer,r=T.getRootFromContainer(t),i=T.getStackForConfig(r,{id:e});i!==null&&T.getContentItemInStack(i,{id:e})!==null||this.deleteItemId(e)}handleFocusCommandHistory(){var e=this.props.glEventHub;e.emit(ot.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;W(this.context);var r=this.context.root,i=e.title!=null?this.getItemId(e.title,!1):null;(t||i!=null&&T.getStackForRoot(r,{id:i},!1,!1,!1)!=null)&&this.openWidget(e)}handleCloseObject(e){var t=e.title;if(t!==void 0){var r=this.getItemId(t,!1);if(r!=null){var i=this.props.glEventHub;fa(i,r),fg(i,t)}}}handleSettingsChange(e){var t=this.props.glEventHub;fn.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(ot.SETTINGS_CHANGED,e)}openWidget(e){var t=this.props,r=t.glEventHub,i=t.plugins,o=e.type,a=Mp(i,o);if(a!=null){var s=a.createDashboardPayload(e);fn.debug("openDashboardWidget",s),pg(r,s)}else this.openPanelWidget(e)}openPanelWidget(e){var t=this.props,r=t.glEventHub,i=t.sessionWrapper;W(i);var o=i.config,a=i.session,s=e.title,l=s===void 0?e.name:s;W(l);var u=this.getItemId(l);W(u);var d={fetch:()=>a.getObject(e),panelId:u,widget:br(br({},wm(e)),{},{sessionId:o.id})};fn.debug("openPanelWidget",d),iv(r,d)}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,t=this.state,r=t.consoleSettings,i=t.itemIds,o=r.isClosePanelsOnDisconnectEnabled,a=o===void 0?!0:o;if(!(!a&&!e)){var s=[...i.values()],l=this.props.glEventHub;s.forEach(u=>{fa(l,u)}),this.setState({itemIds:new Map})}}updateDimensions(){var e;(e=this.consoleRef.current)===null||e===void 0||e.updateDimensions()}supportsType(e){var t=this.props.plugins;return[...t.values()].some(r=>ea(r,e))}iconForType(e){var t=this.props.plugins,r=[...t.values()].find(i=>ea(i,e));return r!=null?Op(r):c.jsx(fu,{type:e})}render(){var e=this.props,t=e.commandHistoryStorage,r=e.glContainer,i=e.glEventHub,o=e.sessionWrapper,a=e.timeZone,s=e.unzip;if(o==null)return c.jsx(Kn,{isLoading:!1,errorMessage:"Console is disabled.","data-testid":"console-panel-loading-error"});var l=this.state,u=l.consoleSettings,d=l.error,h=l.objectMap,p=o.config,f=o.session,v=o.connection,g=o.details,b=g===void 0?{}:g,y=o.dh,S=b.workerName,C=b.processInfoId,_=p.id,w=p.type;return c.jsx(Hr,{className:"iris-panel-console",componentPanel:this,glContainer:r,glEventHub:i,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,errorMessage:d!=null?"".concat(d):void 0,children:f!=null&&c.jsx(Ut,{dh:y,ref:this.consoleRef,settings:u,session:f,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:t,onSettingsChange:this.handleSettingsChange,language:w,statusBarChildren:c.jsxs(c.Fragment,{children:[c.jsx("div",{children:gu.LANGUAGE_MAP.get(w)}),S!=null&&c.jsxs(c.Fragment,{children:[c.jsx("div",{children:"•"}),S]}),C!=null&&c.jsxs(c.Fragment,{children:[c.jsx("div",{children:"•"}),C,c.jsx("div",{children:"•"})]}),c.jsx(o0,{connection:v,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})]}),showObjectsMenu:!1,scope:_,timeZone:a,objectMap:h,unzip:s,supportsType:this.supportsType,iconForType:this.iconForType})})}}rn(Wr,"COMPONENT","ConsolePanel");rn(Wr,"TITLE","Console");rn(Wr,"contextType",ru);var x0=(n,e)=>({commandHistoryStorage:El(n),sessionWrapper:Br(n,e.localDashboardId),timeZone:Hm(n),plugins:Um(n)}),YC=Vn(x0,null,null,{forwardRef:!0})(Wr);function JC(n){return n==="file"||n==="directory"}function dt(n){return n.type==="directory"}function D0(n,e,t){return(e=M0(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function M0(n){var e=j0(n,"string");return typeof e=="symbol"?e:e+""}function j0(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ji extends Error{constructor(){super("No file exists at the path specified"),D0(this,"isFileNotFound",!0)}}function ps(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function fs(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ps(o,r,i,a,s,"next",l)}function s(l){ps(o,r,i,a,s,"throw",l)}a(void 0)})}}var Jt=function(n){return 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="",n}({});class ${static fileExists(e,t){return fs(function*(){try{return yield e.info(t),!0}catch(r){if(!(r instanceof Ji))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(!$.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 o=i?"".concat(i,"-copy"):"Copy";return r!==null?"".concat(o,".").concat(r):o}static getUniqueCopyFileName(e,t){return fs(function*(){for(var r=$.getCopyFileName(t);yield $.fileExists(e,r);)r=$.getCopyFileName(r);return r})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return Jt.GROOVY;case"py":return Jt.PYTHON;case"pyc":return Jt.PYTHON_COMPILED;case"scala":return Jt.SCALA;case"txt":return Jt.PLAIN_TEXT;default:return Jt.UNKNOWN}}static getParent(e){if(!$.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(!$.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,o=$.fileExtensionToString(t);return"".concat(i).concat(o)}static validateName(e){var t=[".",".."],r=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new Hn("Name cannot be empty");if(t.includes(e))throw new Hn('"'.concat(e,'" is a reserved name'));if(r.test(e)){var o,a;throw new Hn('Invalid characters in name: "'.concat((o=(a=e.match(r))===null||a===void 0?void 0:a.reduce((s,l)=>s.includes(l)?s:[...s,l],[]).map(s=>i.has(s)?i.get(s):s).join('", "'))!==null&&o!==void 0?o:"",'"'))}}static reducePaths(e){var t=e.filter(r=>$.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)}}var Qi=26;function Oi(n){return dt(n)?$.makePath(n.filename):$.getPath(n.filename)}function vs(n,e){if(n.length===0||e==null)throw new Error("No items to move");var t=Oi(e);if(n.some(r=>{var i=r.filename;return $.getPath(i)===t}))throw new Error("File already in the destination folder");if(n.some(r=>dt(r)&&t.startsWith($.makePath(r.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:n,targetPath:t}}function A0(n){if(dt(n))return n.isExpanded?cd:hd;var e=$.getMimeType(n.basename);switch(e){case Jt.PYTHON:return pd;default:return md}}function Ii(n){var e,t=n.children,r=n.draggedItems,i=n.isDragInProgress,o=n.isDropTargetValid,a=n.isSelected,s=n.item,l=n.itemIndex,u=n.dropTargetItem,d=n.onDragStart,h=n.onDragOver,p=n.onDragEnd,f=n.onDragExit,v=n.onDrop,g=(e=r==null?void 0:r.some(N=>N.id===s.id))!==null&&e!==void 0?e:!1,b=Oi(s),y=i&&u?Oi(u):null,S=i&&o&&dt(s)&&y===b,C=i&&o&&y===b,_=i&&!o&&y===b,w=A0(s),D=$.getDepth(s.filename),F=Array(D).fill(null).map((N,x)=>c.jsx("span",{className:"file-list-depth-line"},x));return c.jsxs("div",{className:U("d-flex w-100 align-items-center","file-list-item",{"is-dragged":g,"is-exact-drop-target":S,"is-in-drop-target":C,"is-invalid-drop-target":_,"is-selected":a}),onDragStart:N=>d(l,N),onDragOver:N=>h(l,N),onDragEnd:N=>p(l,N),onDragExit:f,onDrop:N=>v(l,N),draggable:!0,role:"presentation","aria-label":s.basename,children:[F," ",c.jsx(me,{icon:w,className:"item-icon",fixedWidth:!0})," ",c.jsx("span",{className:"truncation-wrapper",children:t??c.jsxs(c.Fragment,{children:[s.basename,c.jsx(ue,{children:s.basename})]})})]})}function gs(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 yr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?gs(Object(t),!0).forEach(function(r){k0(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):gs(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function k0(n,e,t){return(e=N0(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function N0(n){var e=L0(n,"string");return typeof e=="symbol"?e:e+""}function L0(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Xt(n,e){return H0(n)||F0(n,e)||$0(n,e)||R0()}function R0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
42
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $0(n,e){if(n){if(typeof n=="string")return bs(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?bs(n,e):void 0}}function bs(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function F0(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function H0(n){if(Array.isArray(n))return n}var Ae=B.module("FileList"),U0=500,ys="item-list-scroll-pane";function B0(n){var e=n.isMultiSelect,t=e===void 0?!1:e,r=n.table,i=n.onFocusChange,o=i===void 0?()=>{}:i,a=n.onMove,s=n.onSelect,l=n.onSelectionChange,u=l===void 0?()=>{}:l,d=n.renderItem,h=d===void 0?Ii:d,p=n.rowHeight,f=p===void 0?Qi:p,v=n.overscanCount,g=v===void 0?ct.DEFAULT_OVERSCAN:v,b=m.useState(()=>({items:[],offset:0,itemCount:0})),y=Xt(b,2),S=y[0],C=y[1],_=m.useState({top:0,bottom:0}),w=Xt(_,2),D=w[0],F=w[1],N=m.useState(),x=Xt(N,2),j=x[0],L=x[1],re=m.useState(),A=Xt(re,2),X=A[0],ie=A[1],oe=m.useState(),be=Xt(oe,2),ye=be[0],Oe=be[1],we=m.useState([]),ce=Xt(we,2),Z=ce[0],V=ce[1],te=m.useRef(),G=m.useRef(null),J=m.useRef(null),M=m.useCallback(I=>{if(I.length===0||S==null)return[];for(var z=[],Q=0;Q<I.length;Q+=1)for(var Me=I[Q],je=Me[0];je<=Me[1];je+=1)je>=S.offset&&je<S.offset+S.items.length&&z.push(S.items[je-S.offset]);return z},[S]),Ge=m.useCallback(I=>{var z=M([[I,I]]);if(z.length>0)return z[0]},[M]),er=m.useCallback(()=>{var I=lt.count(Z);if(I===0)return null;if(I===1){var z=Z[0][0],Q=Ge(z);if(Q!=null)return Q.filename}return"".concat(I," items")},[Ge,Z]),ln=m.useCallback(I=>{if(!(!X||!j)){Ae.debug("dropItems",X,"to",I);try{var z=vs(X,j),Q=z.files,Me=z.targetPath;if(a==null||a(Q,Me),I!=null){var je;V([[I,I]]),(je=G.current)===null||je===void 0||je.focusItem(I)}}catch(Vt){Ae.error("Unable to complete move",Vt)}}},[X,j,a]),zr=m.useCallback((I,z)=>{var Q=S.items[I-S.offset];Q!==void 0&&(Ae.debug("handleItemClick",Q),s(Q,z),dt(Q)&&(r==null||r.setExpanded(Q.filename,!Q.isExpanded)))},[S,s,r]),tr=m.useCallback((I,z)=>{var Q,Me;Ae.debug2("handleItemDragStart",I,Z);var je=Z;lt.isSelected(Z,I)||(je=[[I,I]],V(je)),ie(M(je)),(Q=G.current)===null||Q===void 0||Q.resetMouseState();var Vt=document.createElement("div"),Vr=document.createElement("div");Vr.className="dnd-placeholder-content",Vr.innerText=(Me=er())!==null&&Me!==void 0?Me:"",Vt.appendChild(Vr),Vt.className="file-list-dnd-placeholder",document.body.appendChild(Vt),z.dataTransfer.setDragImage(Vt,0,0),z.dataTransfer.effectAllowed="move",Oe(Vt)},[er,M,Z]),un=m.useCallback((I,z)=>{z.preventDefault(),Ae.debug2("handleItemDragOver",z),L(Ge(I))},[Ge]),H=m.useCallback((I,z)=>{Ae.debug("handleItemDragEnd",I),ye==null||ye.remove(),ie(void 0),L(void 0),Oe(void 0)},[ye]),ae=m.useCallback((I,z)=>{ln(I)},[ln]),se=m.useCallback(()=>{Ae.debug2("handleItemDragExit"),L(void 0)},[]),nr=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains(ys)&&(I.preventDefault(),Ae.debug2("handleListDragOver",I),L({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),rr=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains(ys)&&(Ae.debug("handleListDrop"),ln())},[ln]),dn=m.useCallback(function(I){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(Ae.debug2("handleSelectionChange",I),z===!0||I!==Z){V(I);var Q=M(I);u(Q)}},[M,u,Z]),An=m.useCallback(I=>{if(Ae.debug2("handleFocusChange",I),I!=null){var z=M([[I,I]]),Q=Xt(z,1),Me=Q[0];o(Me)}else o();te.current=I},[M,o]),Mt=m.useCallback((I,z)=>{Ae.debug("handleViewportChange",I,z),(I!==D.top||z!==D.bottom)&&F({top:I,bottom:z})},[D]),ir=m.useMemo(()=>{if(!X||!j)return!1;try{return vs(X,j),Ae.debug("handleValidateDropTarget true"),!0}catch{return Ae.debug("handleValidateDropTarget false"),!1}},[X,j]),bt=n.focusedPath;m.useEffect(()=>{bt!==void 0&&(bt==="/"?r.collapseAll():(r.setExpanded(bt,!1),r.setExpanded(bt,!0)))},[r,bt]),m.useEffect(function(){Ae.debug("updating table viewport",D),r==null||r.setViewport({top:Math.max(0,D.top-g),bottom:D.bottom+g})},[g,r,D]),m.useEffect(function(){var z=r.onUpdate(Q=>{C({items:Q.items.map(Me=>yr(yr({},Me),{},{itemName:Me.basename})),offset:Q.offset,itemCount:r.size})});return()=>{z()}},[r]),m.useEffect(function(){te.current!=null&&An(te.current),Z.length>0&&dn(Z,!0)},[S,An,dn,Z]),m.useEffect(function(){if(j!=null&&dt(j)&&j.filename!=="/"){var z=setTimeout(()=>{j.isExpanded||r==null||r.setExpanded(j.filename,!0)},U0);return()=>clearTimeout(z)}},[j,r]);var or=m.useCallback(I=>h(yr(yr({},I),{},{isDragInProgress:X!=null,dropTargetItem:j,draggedItems:X,isDropTargetValid:ir,onDragStart:tr,onDragEnd:H,onDragOver:un,onDragExit:se,onDrop:ae})),[H,se,un,tr,ae,X,j,ir,h]);return c.jsx("div",{ref:J,className:U("file-list",{"is-dragging":X!=null}),onDragOver:nr,onDrop:rr,children:c.jsx(ct,{ref:G,items:S.items,itemCount:S.itemCount,offset:S.offset,onFocusChange:An,onSelect:zr,onSelectionChange:dn,onViewportChange:Mt,selectedRanges:Z,renderItem:or,rowHeight:f,isMultiSelect:t,isDragSelect:!1,isDeselectOnClick:!1})})}var W0={DELETE:le.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[E.DELETE],macShortcut:[P.CMD,E.BACKSPACE]}),RENAME:le.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[E.ENTER],macShortcut:[E.ENTER]})};const Ss={FILE_EXPLORER:W0};function ri(n,e){return G0(n)||V0(n,e)||z0(n,e)||K0()}function K0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
42
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $0(n,e){if(n){if(typeof n=="string")return bs(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?bs(n,e):void 0}}function bs(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function F0(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function H0(n){if(Array.isArray(n))return n}var Ae=B.module("FileList"),U0=500,ys="item-list-scroll-pane";function B0(n){var e=n.isMultiSelect,t=e===void 0?!1:e,r=n.table,i=n.onFocusChange,o=i===void 0?()=>{}:i,a=n.onMove,s=n.onSelect,l=n.onSelectionChange,u=l===void 0?()=>{}:l,d=n.renderItem,h=d===void 0?Ii:d,p=n.rowHeight,f=p===void 0?Qi:p,v=n.overscanCount,g=v===void 0?ct.DEFAULT_OVERSCAN:v,b=m.useState(()=>({items:[],offset:0,itemCount:0})),y=Xt(b,2),S=y[0],C=y[1],_=m.useState({top:0,bottom:0}),w=Xt(_,2),D=w[0],F=w[1],N=m.useState(),x=Xt(N,2),j=x[0],L=x[1],re=m.useState(),A=Xt(re,2),X=A[0],ie=A[1],oe=m.useState(),be=Xt(oe,2),ye=be[0],Oe=be[1],we=m.useState([]),ce=Xt(we,2),Z=ce[0],V=ce[1],te=m.useRef(),G=m.useRef(null),J=m.useRef(null),M=m.useCallback(I=>{if(I.length===0||S==null)return[];for(var z=[],Q=0;Q<I.length;Q+=1)for(var Me=I[Q],je=Me[0];je<=Me[1];je+=1)je>=S.offset&&je<S.offset+S.items.length&&z.push(S.items[je-S.offset]);return z},[S]),Xe=m.useCallback(I=>{var z=M([[I,I]]);if(z.length>0)return z[0]},[M]),er=m.useCallback(()=>{var I=lt.count(Z);if(I===0)return null;if(I===1){var z=Z[0][0],Q=Xe(z);if(Q!=null)return Q.filename}return"".concat(I," items")},[Xe,Z]),ln=m.useCallback(I=>{if(!(!X||!j)){Ae.debug("dropItems",X,"to",I);try{var z=vs(X,j),Q=z.files,Me=z.targetPath;if(a==null||a(Q,Me),I!=null){var je;V([[I,I]]),(je=G.current)===null||je===void 0||je.focusItem(I)}}catch(Vt){Ae.error("Unable to complete move",Vt)}}},[X,j,a]),zr=m.useCallback((I,z)=>{var Q=S.items[I-S.offset];Q!==void 0&&(Ae.debug("handleItemClick",Q),s(Q,z),dt(Q)&&(r==null||r.setExpanded(Q.filename,!Q.isExpanded)))},[S,s,r]),tr=m.useCallback((I,z)=>{var Q,Me;Ae.debug2("handleItemDragStart",I,Z);var je=Z;lt.isSelected(Z,I)||(je=[[I,I]],V(je)),ie(M(je)),(Q=G.current)===null||Q===void 0||Q.resetMouseState();var Vt=document.createElement("div"),Vr=document.createElement("div");Vr.className="dnd-placeholder-content",Vr.innerText=(Me=er())!==null&&Me!==void 0?Me:"",Vt.appendChild(Vr),Vt.className="file-list-dnd-placeholder",document.body.appendChild(Vt),z.dataTransfer.setDragImage(Vt,0,0),z.dataTransfer.effectAllowed="move",Oe(Vt)},[er,M,Z]),un=m.useCallback((I,z)=>{z.preventDefault(),Ae.debug2("handleItemDragOver",z),L(Xe(I))},[Xe]),H=m.useCallback((I,z)=>{Ae.debug("handleItemDragEnd",I),ye==null||ye.remove(),ie(void 0),L(void 0),Oe(void 0)},[ye]),ae=m.useCallback((I,z)=>{ln(I)},[ln]),se=m.useCallback(()=>{Ae.debug2("handleItemDragExit"),L(void 0)},[]),nr=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains(ys)&&(I.preventDefault(),Ae.debug2("handleListDragOver",I),L({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),rr=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains(ys)&&(Ae.debug("handleListDrop"),ln())},[ln]),dn=m.useCallback(function(I){var z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(Ae.debug2("handleSelectionChange",I),z===!0||I!==Z){V(I);var Q=M(I);u(Q)}},[M,u,Z]),An=m.useCallback(I=>{if(Ae.debug2("handleFocusChange",I),I!=null){var z=M([[I,I]]),Q=Xt(z,1),Me=Q[0];o(Me)}else o();te.current=I},[M,o]),Mt=m.useCallback((I,z)=>{Ae.debug("handleViewportChange",I,z),(I!==D.top||z!==D.bottom)&&F({top:I,bottom:z})},[D]),ir=m.useMemo(()=>{if(!X||!j)return!1;try{return vs(X,j),Ae.debug("handleValidateDropTarget true"),!0}catch{return Ae.debug("handleValidateDropTarget false"),!1}},[X,j]),bt=n.focusedPath;m.useEffect(()=>{bt!==void 0&&(bt==="/"?r.collapseAll():(r.setExpanded(bt,!1),r.setExpanded(bt,!0)))},[r,bt]),m.useEffect(function(){Ae.debug("updating table viewport",D),r==null||r.setViewport({top:Math.max(0,D.top-g),bottom:D.bottom+g})},[g,r,D]),m.useEffect(function(){var z=r.onUpdate(Q=>{C({items:Q.items.map(Me=>yr(yr({},Me),{},{itemName:Me.basename})),offset:Q.offset,itemCount:r.size})});return()=>{z()}},[r]),m.useEffect(function(){te.current!=null&&An(te.current),Z.length>0&&dn(Z,!0)},[S,An,dn,Z]),m.useEffect(function(){if(j!=null&&dt(j)&&j.filename!=="/"){var z=setTimeout(()=>{j.isExpanded||r==null||r.setExpanded(j.filename,!0)},U0);return()=>clearTimeout(z)}},[j,r]);var or=m.useCallback(I=>h(yr(yr({},I),{},{isDragInProgress:X!=null,dropTargetItem:j,draggedItems:X,isDropTargetValid:ir,onDragStart:tr,onDragEnd:H,onDragOver:un,onDragExit:se,onDrop:ae})),[H,se,un,tr,ae,X,j,ir,h]);return c.jsx("div",{ref:J,className:U("file-list",{"is-dragging":X!=null}),onDragOver:nr,onDrop:rr,children:c.jsx(ct,{ref:G,items:S.items,itemCount:S.itemCount,offset:S.offset,onFocusChange:An,onSelect:zr,onSelectionChange:dn,onViewportChange:Mt,selectedRanges:Z,renderItem:or,rowHeight:f,isMultiSelect:t,isDragSelect:!1,isDeselectOnClick:!1})})}var W0={DELETE:le.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[E.DELETE],macShortcut:[P.CMD,E.BACKSPACE]}),RENAME:le.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[E.ENTER],macShortcut:[E.ENTER]})};const Ss={FILE_EXPLORER:W0};function ri(n,e){return G0(n)||V0(n,e)||z0(n,e)||K0()}function K0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
43
43
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function z0(n,e){if(n){if(typeof n=="string")return Cs(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Cs(n,e):void 0}}function Cs(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function V0(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function G0(n){if(Array.isArray(n))return n}var _s=B.module("FileListItemEditor"),X0=()=>Promise.resolve();function q0(n){var e=n.item,t=n.onCancel,r=n.onSubmit,i=n.validate,o=i===void 0?X0:i,a=m.useRef(null),s=m.useState(e.basename),l=ri(s,2),u=l[0],d=l[1],h=m.useState(),p=ri(h,2),f=p[0],v=p[1],g=m.useState(Promise.resolve()),b=ri(g,2),y=b[0],S=b[1],C=m.useCallback(()=>{var x;(x=a.current)===null||x===void 0||x.focus()},[a]),_=m.useCallback(x=>x.stopPropagation(),[]),w=m.useCallback(()=>{y.then(()=>{r(u)}).catch(x=>_s.info("Unable to validate name",x))},[r,u,y]);m.useEffect(function(){var j=Je.makeCancelable(o(u));return j.then(()=>v(void 0)).catch(L=>{Je.isCanceled(L)||v(L)}),S(j),()=>j.cancel()},[o,u]),m.useEffect(function(){C()},[C]);var D=m.useCallback(()=>{_s.debug2("handleBlur"),w()},[w]),F=m.useCallback(x=>{var j=x.target.value;d(j)},[]),N=m.useCallback(x=>{x.stopPropagation();var j=x.key;switch(j){case"Enter":{w();break}case"Escape":{t();break}}},[t,w]);return c.jsxs("div",{className:"file-list-item-editor",children:[c.jsx("input",{type:"text",className:U("form-control file-list-item-editor-input",{"is-invalid":f}),value:u,ref:a,onBlur:D,onKeyDown:N,onChange:F,onClick:_,onDoubleClick:_,onMouseDown:_}),f&&c.jsx("div",{className:"invalid-feedback",children:"".concat(f)})]})}function ws(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 ii(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ws(Object(t),!0).forEach(function(r){Z0(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ws(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Z0(n,e,t){return(e=Y0(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Y0(n){var e=J0(n,"string");return typeof e=="symbol"?e:e+""}function J0(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function oi(n,e){return nS(n)||tS(n,e)||eS(n,e)||Q0()}function Q0(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
44
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function eS(n,e){if(n){if(typeof n=="string")return Es(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Es(n,e):void 0}}function Es(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function tS(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function nS(n){if(Array.isArray(n))return n}function xu(n){var e=n.isMultiSelect,t=e===void 0?!1:e,r=n.focusedPath,i=n.showContextMenu,o=i===void 0?!1:i,a=n.onCreateFile,s=n.onCreateFolder,l=n.onCopy,u=n.onDelete,d=n.onMove,h=n.onRename,p=n.onSelect,f=n.onSelectionChange,v=n.table,g=n.rowHeight,b=g===void 0?Qi:g,y=n.validateRename,S=y===void 0?()=>Promise.resolve():y,C=m.useState(),_=oi(C,2),w=_[0],D=_[1],F=m.useState([]),N=oi(F,2),x=N[0],j=N[1],L=m.useState(),re=oi(L,2),A=re[0],X=re[1],ie=m.useCallback(M=>{j(M),f==null||f(M)},[f]),oe=m.useCallback(M=>{X(M)},[]),be=m.useCallback(()=>{A&&(l==null||l(A))},[A,l]),ye=m.useCallback(()=>{x.length>0&&(u==null||u(x))},[u,x]),Oe=m.useCallback(()=>{a==null||a()},[a]),we=m.useCallback(()=>{A&&(s==null||s($.getPath(A.filename)))},[A,s]),ce=m.useCallback(()=>{A&&D(A)},[A]),Z=m.useCallback(()=>{D(void 0)},[]),V=m.useCallback(M=>{w&&(h==null||h(w,M),D(void 0))},[h,w]),te=m.useMemo(()=>{if(w)return[];var M=[];return a&&M.push({title:"New File",description:"Create new file",action:Oe,group:de.groups.medium}),s&&M.push({title:"New Folder",description:"Create new folder",action:we,group:de.groups.medium}),l&&M.push({title:"Copy File",description:"Copy the selected file",action:be,group:de.groups.low,disabled:A==null||dt(A)}),u&&x.length>0&&M.push({title:"Delete",description:"Delete",shortcut:Ss.FILE_EXPLORER.DELETE,action:ye,group:de.groups.low}),h&&M.push({title:"Rename",description:"Rename",shortcut:Ss.FILE_EXPLORER.RENAME,action:ce,group:de.groups.low,disabled:A==null}),M},[be,ye,Oe,we,ce,A,l,a,s,u,h,x,w]),G=m.useCallback(M=>(W(w),S(w,M)),[w,S]),J=m.useCallback(M=>{var Ge=M.item;return w&&w.filename===Ge.filename?c.jsx(Ii,ii(ii({},M),{},{children:c.jsx(q0,{item:Ge,validate:G,onSubmit:V,onCancel:Z})})):c.jsx(Ii,ii({},M))},[Z,V,w,G]);return c.jsxs("div",{className:"file-list-container",children:[v!=null&&c.jsx(B0,{onMove:d,onSelect:p,onSelectionChange:ie,onFocusChange:oe,renderItem:J,rowHeight:b,table:v,isMultiSelect:t,focusedPath:r}),o&&c.jsx(de,{actions:te})]})}xu.displayName="FileListContainer";function Ps(n,e,t){return(e=rS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function rS(n){var e=iS(n,"string");return typeof e=="symbol"?e:e+""}function iS(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class _r extends Hn{constructor(e){super("Name already exists"),Ps(this,"isExistingFile",!0),Ps(this,"info",void 0),this.info=e}}function Ts(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.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 o=n.apply(e,t);function a(l){Ts(o,r,i,a,s,"next",l)}function s(l){Ts(o,r,i,a,s,"throw",l)}a(void 0)})}}function Is(n,e){return lS(n)||sS(n,e)||aS(n,e)||oS()}function oS(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
45
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aS(n,e){if(n){if(typeof n=="string")return xs(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?xs(n,e):void 0}}function xs(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function sS(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function lS(n){if(Array.isArray(n))return n}var pt=B.module("FileExplorer");function eo(n){var e=n.storage,t=n.isMultiSelect,r=t===void 0?!1:t,i=n.focusedPath,o=n.onCopy,a=o===void 0?()=>{}:o,s=n.onDelete,l=s===void 0?()=>{}:s,u=n.onRename,d=u===void 0?()=>{}:u,h=n.onCreateFile,p=h===void 0?()=>{}:h,f=n.onCreateFolder,v=f===void 0?()=>{}:f,g=n.onSelect,b=n.onSelectionChange,y=n.rowHeight,S=y===void 0?Qi:y,C=m.useState([]),_=Is(C,2),w=_[0],D=_[1],F=m.useState(),N=Is(F,2),x=N[0],j=N[1];m.useEffect(function(){var te;function G(){return J.apply(this,arguments)}function J(){return J=Os(function*(){pt.debug("initTable"),te=Je.makeCancelable(e.getTable(),M=>M.close());try{j(yield te)}catch(M){Je.isCanceled(M)||pt.error("Unable to initialize table",M)}}),J.apply(this,arguments)}return G(),()=>{te.cancel()}},[e]);var L=m.useCallback(V=>{Je.isCanceled(V)||pt.error(V)},[]),re=m.useCallback(()=>{pt.debug("handleCreateFile"),p()},[p]),A=m.useCallback(()=>{pt.debug("handleCreateFolder"),v()},[v]),X=m.useCallback(V=>{pt.debug("handleCopyFile",V.filename),a(V)},[a]),ie=m.useCallback(V=>{pt.debug("handleDelete, pending confirmation",V),D(V)},[]),oe=m.useCallback(()=>{pt.debug("handleDeleteConfirm",w),w.forEach(V=>e.deleteFile(dt(V)?$.makePath(V.filename):V.filename)),l(w),D([])},[w,l,e]),be=m.useCallback(()=>{pt.debug("handleDeleteCancel"),D([])},[]),ye=m.useCallback((V,te)=>{var G=$.reducePaths(V.map(J=>dt(J)?$.makePath(J.filename):J.filename));G.forEach(J=>{var M=$.isPath(J)?"".concat(te).concat($.getBaseName(J.substring(0,J.length-1)),"/"):"".concat(te).concat($.getBaseName(J));e.moveFile(J,M).then(()=>{d(J,M)}).catch(L)})},[L,d,e]),Oe=m.useCallback((V,te)=>{var G=V.filename,J=dt(V);J&&!G.endsWith("/")&&(G="".concat(G,"/"));var M="".concat($.getParent(G)).concat(te);J&&!M.endsWith("/")&&(M="".concat(M,"/")),pt.debug2("handleRename",G,M),e.moveFile(G,M).catch(L),d(G,M)},[L,d,e]),we=m.useCallback(function(){var V=Os(function*(te,G){if(G!==te.basename){$.validateName(G);var J="".concat($.getPath(te.filename)).concat(G);try{var M=yield e.info(J);throw new _r(M)}catch(Ge){if(!(Ge instanceof Ji))throw Ge}}});return function(te,G){return V.apply(this,arguments)}}(),[e]),ce=w.length>0,Z=m.useMemo(()=>w.length===1?'Are you sure you want to delete "'.concat(w[0].filename,'"?'):"Are you sure you want to delete the selected files?",[w]);return c.jsxs("div",{className:"file-explorer",children:[x&&c.jsx(xu,{isMultiSelect:r,focusedPath:i,showContextMenu:!0,onCopy:X,onCreateFolder:A,onCreateFile:re,onMove:ye,onDelete:ie,onRename:Oe,onSelect:g,onSelectionChange:b,rowHeight:S,table:x,validateRename:we}),c.jsx(mi,{isOpen:ce,headerText:Z,bodyText:"You cannot undo this action.",onCancel:be,onConfirm:oe,confirmButtonText:"Delete"})]})}eo.displayName="FileExplorer";function Ds(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function uS(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Ds(o,r,i,a,s,"next",l)}function s(l){Ds(o,r,i,a,s,"throw",l)}a(void 0)})}}function Qt(n,e,t){return(e=dS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function dS(n){var e=cS(n,"string");return typeof e=="symbol"?e:e+""}function cS(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var qt=B.module("NewItemModal");class Pn extends m.PureComponent{static getValidationMessage(e){return e instanceof _r&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){Je.isCanceled(e)||qt.error(e)}constructor(e){super(e),Qt(this,"inputRef",k.createRef()),Qt(this,"cancelableValidatePromise",void 0),Qt(this,"cancelableExistingItemPromise",void 0),Qt(this,"pending",new jr),Qt(this,"pathMap",new Map),Qt(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 t=e.defaultValue,r=$.hasPath(t)?$.getPath(t):"/";this.state={isSubmitting:!1,path:r,prevExtension:$.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:$.getBaseName(t)}}componentDidUpdate(e,t){var r=this.props.isOpen,i=e.isOpen,o=this.state,a=o.value,s=o.path;!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 e=this.props,t=e.defaultValue,r=$.hasPath(t)?$.getPath(t):"/";this.setState({path:r,value:$.getBaseName(t),validationError:void 0,prevExtension:$.getExtension(t),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=Je.makeCancelable(this.validateName(e,t,r)),this.cancelableValidatePromise}validateName(e,t,r){var i=this;return uS(function*(){$.validateName(t);var o=i.props,a=o.defaultValue,s=o.storage;if(r){var l="".concat(e).concat(t);if(l!==a)try{var u=yield s.info(l);throw new _r(u)}catch(d){if(!(d instanceof Ji))throw d}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(Pn.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var t=e.target.value;this.setState({value:t})}handleSelect(e){if(qt.debug("handleSelect",e),e.type==="directory")this.setState({path:$.makePath(e.filename)});else{var t=e.basename,r=$.getPath(e.filename);this.setState({value:t,path:r},()=>{this.focusRenameInput()})}}handleKeyDown(e){var t=e.key;switch(e.stopPropagation(),t){case"Enter":{e.preventDefault(),this.submitModal();break}case"Escape":{e.preventDefault();var r=this.props.onCancel;r();break}}}handleValidationError(e){if(!(e instanceof Hn))throw e;qt.debug("Validation error",e),this.setState({validationError:e})}handleOverwriteCancel(){this.setState({showOverwriteModal:!1,isSubmitting:!1})}handleOverwriteConfirm(){this.setState({showOverwriteModal:!1});var e=this.props.onSubmit,t=this.state,r=t.path,i=t.value;qt.debug("handleOverwriteConfirm",r,i),e("".concat(r).concat(i),!0)}handleExtensionChangeCancel(){qt.debug("handleExtensionChangeCancel"),this.setState(e=>{var t=e.value,r=e.prevExtension,i=$.replaceExtension(t,r);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){qt.debug("handleExtensionChangeConfirm"),this.setState({showExtensionChangeModal:!1}),this.submitModal(!0)}focusRenameInput(){var e=this.inputRef.current;if(e){var t=this.props.type,r=e.value,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 r=t.prevExtension,i=t.value,o=t.path,a=this.props,s=a.notifyOnExtensionChange,l=a.type;qt.debug("submitModal",r,i);var u=$.getExtension(i);return s&&!e&&r!==null&&r!==u?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:u}:(this.getValidationPromise(o,i,!0).then(d=>{var h=this.props.onSubmit;h("".concat(o).concat(i))}).catch(d=>{if(d instanceof _r&&l!=="directory"&&d.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw d}).catch(d=>{throw Je.isCanceled(d)&&this.setState({isSubmitting:!1}),d}).catch(this.handleValidationError).catch(Pn.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 o="",a=0;a<i;a+=1)o+="".concat(t[a],"/");return o+="".concat(r,"/"),c.jsxs(k.Fragment,{children:[c.jsx(ne,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(o),"aria-label":i===0?"Home":void 0,icon:i===0?c.jsx(me,{icon:fd,transform:"right-1.6"}):void 0,tooltip:i===0?"Home":void 0,children:r}),"/"]},o)})}render(){var e=this.props,t=e.storage,r=e.isOpen,i=e.onCancel,o=e.placeholder,a=e.title,s=e.type,l=this.state,u=l.isSubmitting,d=l.path,h=l.showExtensionChangeModal,p=l.showOverwriteModal,f=l.validationError,v=l.value,g=l.prevExtension,b=l.newExtension,y=s==="directory",S=$.fileExtensionToString(g),C=$.fileExtensionToString(b),_=y?"Create":"Save",w=y?"New folder name":"Save file as";return c.jsxs(c.Fragment,{children:[c.jsxs(ks,{isOpen:r,toggle:i,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[c.jsx(Ns,{toggle:i,children:a}),c.jsx(Ls,{children:c.jsx("form",{children:c.jsxs("div",{className:"d-flex flex-column new-file-modal-content",children:[c.jsxs("div",{className:"flex-grow-0 mb-4",children:[c.jsx("label",{htmlFor:"file-name-input",children:w}),c.jsx("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:U("form-control",{"is-invalid":f}),value:v,placeholder:o,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),f&&c.jsx("div",{className:"invalid-feedback",children:Pn.getValidationMessage(f)})]}),c.jsxs("div",{className:"flex-grow-0",children:[c.jsx("label",{children:"Directory: /"}),this.renderPathButtons(d)]}),c.jsx("div",{className:"flex-grow-1 file-explorer-container",children:c.jsx(eo,{onSelect:this.handleSelect,storage:t,focusedPath:d})})]})})}),c.jsxs(sl,{children:[c.jsx(ne,{kind:"secondary",onClick:i,children:"Cancel"}),c.jsx(ne,{kind:"primary",disabled:u,onClick:this.handleModalSubmit,children:_})]})]}),c.jsx(mi,{isOpen:p,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"}),c.jsx(mi,{isOpen:h,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(S,'" to "').concat(C,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(S,'"'),confirmButtonText:'Use "'.concat(C,'"')})]})}}Qt(Pn,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(n,e)=>{},onCancel:()=>{}});function hS(n){var e=n.createFile,t=n.createFolder,r=n.onSearchChange,i=n.defaultSearchText,o=i===void 0?"":i;return c.jsxs("div",{className:"file-explorer-toolbar",children:[c.jsxs("div",{className:"file-explorer-toolbar-buttons",children:[c.jsx(ne,{kind:"ghost",icon:Ws,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),c.jsx(ne,{kind:"ghost",icon:vd,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),r&&c.jsx("div",{className:"file-explorer-toolbar-search",children:c.jsx(vl,{value:o,onChange:r,placeholder:"Search by name"})})]})}function Ms(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function mS(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Ms(o,r,i,a,s,"next",l)}function s(l){Ms(o,r,i,a,s,"throw",l)}a(void 0)})}}function Du(n,e,t){return(e=pS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pS(n){var e=fS(n,"string");return typeof e=="symbol"?e:e+""}function fS(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Zt=B.module("FileExplorerPanel"),vS=(n,e)=>{var t=$m(n),r=Br(n,e.localDashboardId),i=r??{},o=i.session,a=i.config,s=a==null?void 0:a.type;return{fileStorage:t,language:s,session:o}},gS=Vn(vS,null,null,{forwardRef:!0});function bS(n){var e=n;return e!=null&&typeof e.button=="number"}class Dn extends k.Component{static handleError(e){Zt.error(e)}static isFocusEvent(e){return bS(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 t=e.session,r=e.language;this.state={isShown:!1,language:r,session:t,showCreateFolder:!1,focusedFilePath:"/"}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){var e=this.props.glEventHub,t=this.state,r=t.session,i=t.language,o={language:i,value:""};Zt.debug("handleCreateFile",r,i,o),e.emit(Fe.CREATE_NOTEBOOK,r,i,o)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){Zt.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){Zt.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var t=this.props.fileStorage;t.createDirectory(e).catch(Dn.handleError)}handleCopyFile(e){var t=this;return mS(function*(){var r=t.props.fileStorage;if(dt(e)){Zt.error("Invalid item in handleCopyItem",e);return}var i=yield $.getUniqueCopyFileName(r,e.filename);yield r.copyFile(e.filename,i)})()}handleDelete(e){var t=this.props.glEventHub;e.forEach(r=>{t.emit(Fe.CLOSE_FILE,{id:r.filename,itemName:r.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=$.makePath(e[0].filename):t=$.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(Zt.debug("fileSelect",e),e.type!=="directory"){var r=Dn.isFocusEvent(t),i={id:e.filename,itemName:e.filename},o=this.props.glEventHub,a=this.state,s=a.session,l=a.language,u={value:null,language:l};o.emit(Fe.SELECT_NOTEBOOK,s,l,u,i,r)}}handleRename(e,t){var r=this.props.glEventHub;Zt.debug("handleRename",e,t),r.emit(Fe.RENAME_FILE,e,t)}handleSessionOpened(e){var t=e.session,r=e.language;this.setState({session:t,language:r})}handleSessionClosed(){this.setState({session:void 0,language:void 0})}handleShow(){this.setState({isShown:!0})}isHidden(){var e=this.props.glContainer,t=e.isHidden;return t}render(){var e=this.props,t=e.fileStorage,r=e.glContainer,i=e.glEventHub,o=this.state,a=o.isShown,s=o.showCreateFolder,l=o.focusedFilePath;return c.jsxs(Hr,{className:"file-explorer-panel",componentPanel:this,glContainer:r,glEventHub:i,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[c.jsx(hS,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),a&&c.jsx(eo,{isMultiSelect:!0,storage:t,onCopy:this.handleCopyFile,onCreateFile:this.handleCreateFile,onCreateFolder:this.handleCreateDirectory,onDelete:this.handleDelete,onRename:this.handleRename,onSelect:this.handleFileSelect,onSelectionChange:this.handleSelectionChange}),c.jsx(Pn,{isOpen:s,type:"directory",title:"Create New Folder",storage:t,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:l})]})}}Du(Dn,"COMPONENT","FileExplorerPanel");Du(Dn,"TITLE","File Explorer");var QC=gS(Dn);function Wn(n,e,t){return(e=yS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yS(n){var e=SS(n,"string");return typeof e=="symbol"?e:e+""}function SS(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var js=B.module("LogPanel");class Kr extends m.PureComponent{constructor(e){super(e),Wn(this,"isBottomVisible",void 0),Wn(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 t=this.props.session;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){var t=e.session;js.debug("Session opened",[t]),this.setState({session:t})}handleSessionClosed(e){js.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){var e=this.props,t=e.glContainer,r=e.glEventHub,i=this.state.session;return c.jsxs(Hr,{componentPanel:this,glContainer:t,glEventHub:r,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[i==null&&c.jsx("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),i!=null&&c.jsx(ve,{session:i,ref:o=>{this.logView=o}})]})}}Wn(Kr,"defaultProps",{session:null});Wn(Kr,"COMPONENT","LogPanel");Wn(Kr,"TITLE","Log");var CS=(n,e)=>{var t;return{session:(t=Br(n,e.localDashboardId))===null||t===void 0?void 0:t.session}},e_=Vn(CS,null,null,{forwardRef:!0})(Kr);export{dh as $,ue as A,Je as B,ge as C,ul as D,$d as E,He as F,kr as G,al as H,ct as I,ne as J,E as K,ml as L,P as M,dl as N,de as O,Ar as P,Nr as Q,lt as R,fe as S,il as T,yn as U,mi as V,Rc as W,vl as X,Lr as Y,sl as Z,bl as _,jC as a,lv as a$,Di as a0,MS as a1,cm as a2,Mi as a3,jS as a4,hl as a5,yl as a6,cl as a7,$c as a8,Mh as a9,ru as aA,hv as aB,ee as aC,Ki as aD,eu as aE,uu as aF,Rv as aG,ou as aH,fr as aI,tu as aJ,fg as aK,pg as aL,dC as aM,pC as aN,hC as aO,vC as aP,fa as aQ,wC as aR,De as aS,EC as aT,su as aU,nu as aV,AC as aW,MC as aX,ov as aY,sv as aZ,av as a_,wr as aa,bm as ab,Et as ac,Ve as ad,Tt as ae,K as af,Ye as ag,_l as ah,Cl as ai,Sl as aj,AS as ak,kS as al,NS as am,YS as an,T as ao,sC as ap,PC as aq,Og as ar,mg as as,hg as at,DC as au,Qr as av,du as aw,OC as ax,bC as ay,yC as az,_v as b,zy as b$,lC as b0,aC as b1,yv as b2,lu as b3,Tv as b4,SC as b5,CC as b6,_C as b7,kC as b8,cC as b9,cp as bA,dp as bB,Ml as bC,gi as bD,mp as bE,xl as bF,Il as bG,vi as bH,qn as bI,ea as bJ,ZS as bK,nC as bL,ta as bM,IS as bN,lo as bO,$g as bP,Xi as bQ,LC as bR,Kg as bS,zg as bT,Te as bU,Wb as bV,R as bW,Ut as bX,vu as bY,Le as bZ,xr as b_,fC as ba,mC as bb,gC as bc,IC as bd,NC as be,mn as bf,uC as bg,zv as bh,jp as bi,JS as bj,Kt as bk,Ol as bl,iC as bm,Ip as bn,QS as bo,eC as bp,tC as bq,Op as br,Dp as bs,Mp as bt,rC as bu,pp as bv,hp as bw,Dl as bx,up as by,lp as bz,dm as c,ot as c$,Iu as c0,gu as c1,lb as c2,Cu as c3,Jg as c4,On as c5,bu as c6,In as c7,Iy as c8,Or as c9,zm as cA,Vm as cB,Gm as cC,sp as cD,el as cE,ES as cF,Js as cG,Hr as cH,VC as cI,mt as cJ,vt as cK,XS as cL,KC as cM,FS as cN,zC as cO,WC as cP,GC as cQ,jr as cR,LS as cS,UC as cT,RS as cU,BC as cV,GS as cW,$m as cX,$S as cY,Br as cZ,Fe as c_,o0 as ca,ve as cb,Pi as cc,fu as cd,En as ce,Ai as cf,$ as cg,Ji as ch,JC as ci,Ri as cj,rv as ck,xC as cl,Jm as cm,YC as cn,e_ as co,ZC as cp,QC as cq,gc as cr,TS as cs,Wm as ct,Bm as cu,BS as cv,HS as cw,US as cx,WS as cy,Km as cz,zS as d,Pn as d0,dt as d1,Hm as d2,Ne as d3,FC as d4,RC as d5,qC as d6,XC as d7,m0 as d8,h0 as d9,HC as da,$C as db,DS as dc,gt as dd,OS as de,Xr as df,zd as dg,Hn as dh,iv as e,qS as f,wm as g,KS as h,Tl as i,VS as j,xS as k,Pc as l,Xn as m,Lc as n,Tc as o,nl as p,tl as q,le as r,TC as s,Oc as t,_m as u,Ic as v,ol as w,qs as x,rl as y,PS as z};
46
- //# sourceMappingURL=LogPanel-DiUK_LSv.js.map
44
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function eS(n,e){if(n){if(typeof n=="string")return Es(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Es(n,e):void 0}}function Es(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function tS(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function nS(n){if(Array.isArray(n))return n}function xu(n){var e=n.isMultiSelect,t=e===void 0?!1:e,r=n.focusedPath,i=n.showContextMenu,o=i===void 0?!1:i,a=n.onCreateFile,s=n.onCreateFolder,l=n.onCopy,u=n.onDelete,d=n.onMove,h=n.onRename,p=n.onSelect,f=n.onSelectionChange,v=n.table,g=n.rowHeight,b=g===void 0?Qi:g,y=n.validateRename,S=y===void 0?()=>Promise.resolve():y,C=m.useState(),_=oi(C,2),w=_[0],D=_[1],F=m.useState([]),N=oi(F,2),x=N[0],j=N[1],L=m.useState(),re=oi(L,2),A=re[0],X=re[1],ie=m.useCallback(M=>{j(M),f==null||f(M)},[f]),oe=m.useCallback(M=>{X(M)},[]),be=m.useCallback(()=>{A&&(l==null||l(A))},[A,l]),ye=m.useCallback(()=>{x.length>0&&(u==null||u(x))},[u,x]),Oe=m.useCallback(()=>{a==null||a()},[a]),we=m.useCallback(()=>{A&&(s==null||s($.getPath(A.filename)))},[A,s]),ce=m.useCallback(()=>{A&&D(A)},[A]),Z=m.useCallback(()=>{D(void 0)},[]),V=m.useCallback(M=>{w&&(h==null||h(w,M),D(void 0))},[h,w]),te=m.useMemo(()=>{if(w)return[];var M=[];return a&&M.push({title:"New File",description:"Create new file",action:Oe,group:de.groups.medium}),s&&M.push({title:"New Folder",description:"Create new folder",action:we,group:de.groups.medium}),l&&M.push({title:"Copy File",description:"Copy the selected file",action:be,group:de.groups.low,disabled:A==null||dt(A)}),u&&x.length>0&&M.push({title:"Delete",description:"Delete",shortcut:Ss.FILE_EXPLORER.DELETE,action:ye,group:de.groups.low}),h&&M.push({title:"Rename",description:"Rename",shortcut:Ss.FILE_EXPLORER.RENAME,action:ce,group:de.groups.low,disabled:A==null}),M},[be,ye,Oe,we,ce,A,l,a,s,u,h,x,w]),G=m.useCallback(M=>(W(w),S(w,M)),[w,S]),J=m.useCallback(M=>{var Xe=M.item;return w&&w.filename===Xe.filename?c.jsx(Ii,ii(ii({},M),{},{children:c.jsx(q0,{item:Xe,validate:G,onSubmit:V,onCancel:Z})})):c.jsx(Ii,ii({},M))},[Z,V,w,G]);return c.jsxs("div",{className:"file-list-container",children:[v!=null&&c.jsx(B0,{onMove:d,onSelect:p,onSelectionChange:ie,onFocusChange:oe,renderItem:J,rowHeight:b,table:v,isMultiSelect:t,focusedPath:r}),o&&c.jsx(de,{actions:te})]})}xu.displayName="FileListContainer";function Ps(n,e,t){return(e=rS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function rS(n){var e=iS(n,"string");return typeof e=="symbol"?e:e+""}function iS(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class _r extends Hn{constructor(e){super("Name already exists"),Ps(this,"isExistingFile",!0),Ps(this,"info",void 0),this.info=e}}function Ts(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.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 o=n.apply(e,t);function a(l){Ts(o,r,i,a,s,"next",l)}function s(l){Ts(o,r,i,a,s,"throw",l)}a(void 0)})}}function Is(n,e){return lS(n)||sS(n,e)||aS(n,e)||oS()}function oS(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
45
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aS(n,e){if(n){if(typeof n=="string")return xs(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?xs(n,e):void 0}}function xs(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=Array(e);t<e;t++)r[t]=n[t];return r}function sS(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,o,a,s=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(r=o.call(t)).done)&&(s.push(r.value),s.length!==e);l=!0);}catch(d){u=!0,i=d}finally{try{if(!l&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}function lS(n){if(Array.isArray(n))return n}var pt=B.module("FileExplorer");function eo(n){var e=n.storage,t=n.isMultiSelect,r=t===void 0?!1:t,i=n.focusedPath,o=n.onCopy,a=o===void 0?()=>{}:o,s=n.onDelete,l=s===void 0?()=>{}:s,u=n.onRename,d=u===void 0?()=>{}:u,h=n.onCreateFile,p=h===void 0?()=>{}:h,f=n.onCreateFolder,v=f===void 0?()=>{}:f,g=n.onSelect,b=n.onSelectionChange,y=n.rowHeight,S=y===void 0?Qi:y,C=m.useState([]),_=Is(C,2),w=_[0],D=_[1],F=m.useState(),N=Is(F,2),x=N[0],j=N[1];m.useEffect(function(){var te;function G(){return J.apply(this,arguments)}function J(){return J=Os(function*(){pt.debug("initTable"),te=Je.makeCancelable(e.getTable(),M=>M.close());try{j(yield te)}catch(M){Je.isCanceled(M)||pt.error("Unable to initialize table",M)}}),J.apply(this,arguments)}return G(),()=>{te.cancel()}},[e]);var L=m.useCallback(V=>{Je.isCanceled(V)||pt.error(V)},[]),re=m.useCallback(()=>{pt.debug("handleCreateFile"),p()},[p]),A=m.useCallback(()=>{pt.debug("handleCreateFolder"),v()},[v]),X=m.useCallback(V=>{pt.debug("handleCopyFile",V.filename),a(V)},[a]),ie=m.useCallback(V=>{pt.debug("handleDelete, pending confirmation",V),D(V)},[]),oe=m.useCallback(()=>{pt.debug("handleDeleteConfirm",w),w.forEach(V=>e.deleteFile(dt(V)?$.makePath(V.filename):V.filename)),l(w),D([])},[w,l,e]),be=m.useCallback(()=>{pt.debug("handleDeleteCancel"),D([])},[]),ye=m.useCallback((V,te)=>{var G=$.reducePaths(V.map(J=>dt(J)?$.makePath(J.filename):J.filename));G.forEach(J=>{var M=$.isPath(J)?"".concat(te).concat($.getBaseName(J.substring(0,J.length-1)),"/"):"".concat(te).concat($.getBaseName(J));e.moveFile(J,M).then(()=>{d(J,M)}).catch(L)})},[L,d,e]),Oe=m.useCallback((V,te)=>{var G=V.filename,J=dt(V);J&&!G.endsWith("/")&&(G="".concat(G,"/"));var M="".concat($.getParent(G)).concat(te);J&&!M.endsWith("/")&&(M="".concat(M,"/")),pt.debug2("handleRename",G,M),e.moveFile(G,M).catch(L),d(G,M)},[L,d,e]),we=m.useCallback(function(){var V=Os(function*(te,G){if(G!==te.basename){$.validateName(G);var J="".concat($.getPath(te.filename)).concat(G);try{var M=yield e.info(J);throw new _r(M)}catch(Xe){if(!(Xe instanceof Ji))throw Xe}}});return function(te,G){return V.apply(this,arguments)}}(),[e]),ce=w.length>0,Z=m.useMemo(()=>w.length===1?'Are you sure you want to delete "'.concat(w[0].filename,'"?'):"Are you sure you want to delete the selected files?",[w]);return c.jsxs("div",{className:"file-explorer",children:[x&&c.jsx(xu,{isMultiSelect:r,focusedPath:i,showContextMenu:!0,onCopy:X,onCreateFolder:A,onCreateFile:re,onMove:ye,onDelete:ie,onRename:Oe,onSelect:g,onSelectionChange:b,rowHeight:S,table:x,validateRename:we}),c.jsx(mi,{isOpen:ce,headerText:Z,bodyText:"You cannot undo this action.",onCancel:be,onConfirm:oe,confirmButtonText:"Delete"})]})}eo.displayName="FileExplorer";function Ds(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function uS(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Ds(o,r,i,a,s,"next",l)}function s(l){Ds(o,r,i,a,s,"throw",l)}a(void 0)})}}function Qt(n,e,t){return(e=dS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function dS(n){var e=cS(n,"string");return typeof e=="symbol"?e:e+""}function cS(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var qt=B.module("NewItemModal");class Pn extends m.PureComponent{static getValidationMessage(e){return e instanceof _r&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){Je.isCanceled(e)||qt.error(e)}constructor(e){super(e),Qt(this,"inputRef",k.createRef()),Qt(this,"cancelableValidatePromise",void 0),Qt(this,"cancelableExistingItemPromise",void 0),Qt(this,"pending",new jr),Qt(this,"pathMap",new Map),Qt(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 t=e.defaultValue,r=$.hasPath(t)?$.getPath(t):"/";this.state={isSubmitting:!1,path:r,prevExtension:$.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:$.getBaseName(t)}}componentDidUpdate(e,t){var r=this.props.isOpen,i=e.isOpen,o=this.state,a=o.value,s=o.path;!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 e=this.props,t=e.defaultValue,r=$.hasPath(t)?$.getPath(t):"/";this.setState({path:r,value:$.getBaseName(t),validationError:void 0,prevExtension:$.getExtension(t),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=Je.makeCancelable(this.validateName(e,t,r)),this.cancelableValidatePromise}validateName(e,t,r){var i=this;return uS(function*(){$.validateName(t);var o=i.props,a=o.defaultValue,s=o.storage;if(r){var l="".concat(e).concat(t);if(l!==a)try{var u=yield s.info(l);throw new _r(u)}catch(d){if(!(d instanceof Ji))throw d}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(Pn.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var t=e.target.value;this.setState({value:t})}handleSelect(e){if(qt.debug("handleSelect",e),e.type==="directory")this.setState({path:$.makePath(e.filename)});else{var t=e.basename,r=$.getPath(e.filename);this.setState({value:t,path:r},()=>{this.focusRenameInput()})}}handleKeyDown(e){var t=e.key;switch(e.stopPropagation(),t){case"Enter":{e.preventDefault(),this.submitModal();break}case"Escape":{e.preventDefault();var r=this.props.onCancel;r();break}}}handleValidationError(e){if(!(e instanceof Hn))throw e;qt.debug("Validation error",e),this.setState({validationError:e})}handleOverwriteCancel(){this.setState({showOverwriteModal:!1,isSubmitting:!1})}handleOverwriteConfirm(){this.setState({showOverwriteModal:!1});var e=this.props.onSubmit,t=this.state,r=t.path,i=t.value;qt.debug("handleOverwriteConfirm",r,i),e("".concat(r).concat(i),!0)}handleExtensionChangeCancel(){qt.debug("handleExtensionChangeCancel"),this.setState(e=>{var t=e.value,r=e.prevExtension,i=$.replaceExtension(t,r);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){qt.debug("handleExtensionChangeConfirm"),this.setState({showExtensionChangeModal:!1}),this.submitModal(!0)}focusRenameInput(){var e=this.inputRef.current;if(e){var t=this.props.type,r=e.value,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 r=t.prevExtension,i=t.value,o=t.path,a=this.props,s=a.notifyOnExtensionChange,l=a.type;qt.debug("submitModal",r,i);var u=$.getExtension(i);return s&&!e&&r!==null&&r!==u?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:u}:(this.getValidationPromise(o,i,!0).then(d=>{var h=this.props.onSubmit;h("".concat(o).concat(i))}).catch(d=>{if(d instanceof _r&&l!=="directory"&&d.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw d}).catch(d=>{throw Je.isCanceled(d)&&this.setState({isSubmitting:!1}),d}).catch(this.handleValidationError).catch(Pn.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 o="",a=0;a<i;a+=1)o+="".concat(t[a],"/");return o+="".concat(r,"/"),c.jsxs(k.Fragment,{children:[c.jsx(ne,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(o),"aria-label":i===0?"Home":void 0,icon:i===0?c.jsx(me,{icon:fd,transform:"right-1.6"}):void 0,tooltip:i===0?"Home":void 0,children:r}),"/"]},o)})}render(){var e=this.props,t=e.storage,r=e.isOpen,i=e.onCancel,o=e.placeholder,a=e.title,s=e.type,l=this.state,u=l.isSubmitting,d=l.path,h=l.showExtensionChangeModal,p=l.showOverwriteModal,f=l.validationError,v=l.value,g=l.prevExtension,b=l.newExtension,y=s==="directory",S=$.fileExtensionToString(g),C=$.fileExtensionToString(b),_=y?"Create":"Save",w=y?"New folder name":"Save file as";return c.jsxs(c.Fragment,{children:[c.jsxs(ks,{isOpen:r,toggle:i,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[c.jsx(Ns,{toggle:i,children:a}),c.jsx(Ls,{children:c.jsx("form",{children:c.jsxs("div",{className:"d-flex flex-column new-file-modal-content",children:[c.jsxs("div",{className:"flex-grow-0 mb-4",children:[c.jsx("label",{htmlFor:"file-name-input",children:w}),c.jsx("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:U("form-control",{"is-invalid":f}),value:v,placeholder:o,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),f&&c.jsx("div",{className:"invalid-feedback",children:Pn.getValidationMessage(f)})]}),c.jsxs("div",{className:"flex-grow-0",children:[c.jsx("label",{children:"Directory: /"}),this.renderPathButtons(d)]}),c.jsx("div",{className:"flex-grow-1 file-explorer-container",children:c.jsx(eo,{onSelect:this.handleSelect,storage:t,focusedPath:d})})]})})}),c.jsxs(sl,{children:[c.jsx(ne,{kind:"secondary",onClick:i,children:"Cancel"}),c.jsx(ne,{kind:"primary",disabled:u,onClick:this.handleModalSubmit,children:_})]})]}),c.jsx(mi,{isOpen:p,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"}),c.jsx(mi,{isOpen:h,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(S,'" to "').concat(C,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(S,'"'),confirmButtonText:'Use "'.concat(C,'"')})]})}}Qt(Pn,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(n,e)=>{},onCancel:()=>{}});function hS(n){var e=n.createFile,t=n.createFolder,r=n.onSearchChange,i=n.defaultSearchText,o=i===void 0?"":i;return c.jsxs("div",{className:"file-explorer-toolbar",children:[c.jsxs("div",{className:"file-explorer-toolbar-buttons",children:[c.jsx(ne,{kind:"ghost",icon:Ws,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),c.jsx(ne,{kind:"ghost",icon:vd,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),r&&c.jsx("div",{className:"file-explorer-toolbar-search",children:c.jsx(vl,{value:o,onChange:r,placeholder:"Search by name"})})]})}function Ms(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(u){return void t(u)}s.done?e(l):Promise.resolve(l).then(r,i)}function mS(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Ms(o,r,i,a,s,"next",l)}function s(l){Ms(o,r,i,a,s,"throw",l)}a(void 0)})}}function Du(n,e,t){return(e=pS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pS(n){var e=fS(n,"string");return typeof e=="symbol"?e:e+""}function fS(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Zt=B.module("FileExplorerPanel"),vS=(n,e)=>{var t=$m(n),r=Br(n,e.localDashboardId),i=r??{},o=i.session,a=i.config,s=a==null?void 0:a.type;return{fileStorage:t,language:s,session:o}},gS=Vn(vS,null,null,{forwardRef:!0});function bS(n){var e=n;return e!=null&&typeof e.button=="number"}class Dn extends k.Component{static handleError(e){Zt.error(e)}static isFocusEvent(e){return bS(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 t=e.session,r=e.language;this.state={isShown:!1,language:r,session:t,showCreateFolder:!1,focusedFilePath:"/"}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){var e=this.props.glEventHub,t=this.state,r=t.session,i=t.language,o={language:i,value:""};Zt.debug("handleCreateFile",r,i,o),e.emit(Fe.CREATE_NOTEBOOK,r,i,o)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){Zt.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){Zt.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var t=this.props.fileStorage;t.createDirectory(e).catch(Dn.handleError)}handleCopyFile(e){var t=this;return mS(function*(){var r=t.props.fileStorage;if(dt(e)){Zt.error("Invalid item in handleCopyItem",e);return}var i=yield $.getUniqueCopyFileName(r,e.filename);yield r.copyFile(e.filename,i)})()}handleDelete(e){var t=this.props.glEventHub;e.forEach(r=>{t.emit(Fe.CLOSE_FILE,{id:r.filename,itemName:r.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=$.makePath(e[0].filename):t=$.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(Zt.debug("fileSelect",e),e.type!=="directory"){var r=Dn.isFocusEvent(t),i={id:e.filename,itemName:e.filename},o=this.props.glEventHub,a=this.state,s=a.session,l=a.language,u={value:null,language:l};o.emit(Fe.SELECT_NOTEBOOK,s,l,u,i,r)}}handleRename(e,t){var r=this.props.glEventHub;Zt.debug("handleRename",e,t),r.emit(Fe.RENAME_FILE,e,t)}handleSessionOpened(e){var t=e.session,r=e.language;this.setState({session:t,language:r})}handleSessionClosed(){this.setState({session:void 0,language:void 0})}handleShow(){this.setState({isShown:!0})}isHidden(){var e=this.props.glContainer,t=e.isHidden;return t}render(){var e=this.props,t=e.fileStorage,r=e.glContainer,i=e.glEventHub,o=this.state,a=o.isShown,s=o.showCreateFolder,l=o.focusedFilePath;return c.jsxs(Hr,{className:"file-explorer-panel",componentPanel:this,glContainer:r,glEventHub:i,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[c.jsx(hS,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),a&&c.jsx(eo,{isMultiSelect:!0,storage:t,onCopy:this.handleCopyFile,onCreateFile:this.handleCreateFile,onCreateFolder:this.handleCreateDirectory,onDelete:this.handleDelete,onRename:this.handleRename,onSelect:this.handleFileSelect,onSelectionChange:this.handleSelectionChange}),c.jsx(Pn,{isOpen:s,type:"directory",title:"Create New Folder",storage:t,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:l})]})}}Du(Dn,"COMPONENT","FileExplorerPanel");Du(Dn,"TITLE","File Explorer");var QC=gS(Dn);function Wn(n,e,t){return(e=yS(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yS(n){var e=SS(n,"string");return typeof e=="symbol"?e:e+""}function SS(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var js=B.module("LogPanel");class Kr extends m.PureComponent{constructor(e){super(e),Wn(this,"isBottomVisible",void 0),Wn(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 t=this.props.session;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){var t=e.session;js.debug("Session opened",[t]),this.setState({session:t})}handleSessionClosed(e){js.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){var e=this.props,t=e.glContainer,r=e.glEventHub,i=this.state.session;return c.jsxs(Hr,{componentPanel:this,glContainer:t,glEventHub:r,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[i==null&&c.jsx("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),i!=null&&c.jsx(ve,{session:i,ref:o=>{this.logView=o}})]})}}Wn(Kr,"defaultProps",{session:null});Wn(Kr,"COMPONENT","LogPanel");Wn(Kr,"TITLE","Log");var CS=(n,e)=>{var t;return{session:(t=Br(n,e.localDashboardId))===null||t===void 0?void 0:t.session}},e_=Vn(CS,null,null,{forwardRef:!0})(Kr);export{dh as $,ue as A,Je as B,ge as C,ul as D,$d as E,He as F,kr as G,al as H,ct as I,ne as J,E as K,ml as L,P as M,dl as N,de as O,Ar as P,Nr as Q,lt as R,fe as S,il as T,yn as U,mi as V,Rc as W,vl as X,Lr as Y,sl as Z,bl as _,jC as a,lv as a$,Di as a0,MS as a1,cm as a2,Mi as a3,jS as a4,hl as a5,yl as a6,cl as a7,$c as a8,Mh as a9,ru as aA,hv as aB,ee as aC,Ki as aD,eu as aE,uu as aF,Rv as aG,ou as aH,fr as aI,tu as aJ,fg as aK,pg as aL,dC as aM,pC as aN,hC as aO,vC as aP,fa as aQ,wC as aR,De as aS,EC as aT,su as aU,nu as aV,AC as aW,MC as aX,ov as aY,sv as aZ,av as a_,wr as aa,bm as ab,Et as ac,Ge as ad,Tt as ae,K as af,Ye as ag,_l as ah,Cl as ai,Sl as aj,AS as ak,kS as al,NS as am,YS as an,T as ao,sC as ap,PC as aq,Og as ar,mg as as,hg as at,DC as au,Qr as av,du as aw,OC as ax,bC as ay,yC as az,_v as b,zy as b$,lC as b0,aC as b1,yv as b2,lu as b3,Tv as b4,SC as b5,CC as b6,_C as b7,kC as b8,cC as b9,cp as bA,dp as bB,Ml as bC,gi as bD,mp as bE,xl as bF,Il as bG,vi as bH,qn as bI,ea as bJ,ZS as bK,nC as bL,ta as bM,IS as bN,lo as bO,$g as bP,Xi as bQ,LC as bR,Kg as bS,zg as bT,Te as bU,Wb as bV,R as bW,Ut as bX,vu as bY,Le as bZ,xr as b_,fC as ba,mC as bb,gC as bc,IC as bd,NC as be,mn as bf,uC as bg,zv as bh,jp as bi,JS as bj,Kt as bk,Ol as bl,iC as bm,Ip as bn,QS as bo,eC as bp,tC as bq,Op as br,Dp as bs,Mp as bt,rC as bu,pp as bv,hp as bw,Dl as bx,up as by,lp as bz,dm as c,ot as c$,Iu as c0,gu as c1,lb as c2,Cu as c3,Jg as c4,On as c5,bu as c6,In as c7,Iy as c8,Or as c9,zm as cA,Vm as cB,Gm as cC,sp as cD,el as cE,ES as cF,Js as cG,Hr as cH,VC as cI,mt as cJ,vt as cK,XS as cL,KC as cM,FS as cN,zC as cO,WC as cP,GC as cQ,jr as cR,LS as cS,UC as cT,RS as cU,BC as cV,GS as cW,$m as cX,$S as cY,Br as cZ,Fe as c_,o0 as ca,ve as cb,Pi as cc,fu as cd,En as ce,Ai as cf,$ as cg,Ji as ch,JC as ci,Ri as cj,rv as ck,xC as cl,Jm as cm,YC as cn,e_ as co,ZC as cp,QC as cq,gc as cr,TS as cs,Wm as ct,Bm as cu,BS as cv,HS as cw,US as cx,WS as cy,Km as cz,zS as d,Pn as d0,dt as d1,Hm as d2,Ne as d3,FC as d4,RC as d5,qC as d6,XC as d7,m0 as d8,h0 as d9,HC as da,$C as db,DS as dc,gt as dd,OS as de,Xr as df,zd as dg,Hn as dh,iv as e,qS as f,wm as g,KS as h,Tl as i,VS as j,xS as k,Pc as l,Xn as m,Lc as n,Tc as o,nl as p,tl as q,le as r,TC as s,Oc as t,_m as u,Ic as v,ol as w,qs as x,rl as y,PS as z};
46
+ //# sourceMappingURL=LogPanel-C_z4zUw7.js.map