@deephaven/code-studio 0.85.32 → 0.85.33

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 (49) hide show
  1. package/build/assets/{AppRoot-ebba7f82.js → AppRoot-bed32720.js} +4 -4
  2. package/build/assets/{AppRoot-ebba7f82.js.map → AppRoot-bed32720.js.map} +1 -1
  3. package/build/assets/{Chart-31b98bdf.js → Chart-a1dfd1ef.js} +2 -2
  4. package/build/assets/{Chart-31b98bdf.js.map → Chart-a1dfd1ef.js.map} +1 -1
  5. package/build/assets/{ControlType-7a644160.js → ControlType-5a46b9ec.js} +3 -3
  6. package/build/assets/{ControlType-7a644160.js.map → ControlType-5a46b9ec.js.map} +1 -1
  7. package/build/assets/{FontBootstrap-5e60bb4e.js → FontBootstrap-e9a033a8.js} +2 -2
  8. package/build/assets/{FontBootstrap-5e60bb4e.js.map → FontBootstrap-e9a033a8.js.map} +1 -1
  9. package/build/assets/{FormatterUtils-baed1012.js → FormatterUtils-9c215187.js} +2 -2
  10. package/build/assets/{FormatterUtils-baed1012.js.map → FormatterUtils-9c215187.js.map} +1 -1
  11. package/build/assets/{Grid-860a9c16.js → Grid-ba17eb43.js} +2 -2
  12. package/build/assets/{Grid-860a9c16.js.map → Grid-ba17eb43.js.map} +1 -1
  13. package/build/assets/{IrisGrid-d45b017b.js → IrisGrid-21aaf906.js} +2 -2
  14. package/build/assets/{IrisGrid-d45b017b.js.map → IrisGrid-21aaf906.js.map} +1 -1
  15. package/build/assets/{IrisGridModel-0fc1dc91.js → IrisGridModel-34172040.js} +2 -2
  16. package/build/assets/{IrisGridModel-0fc1dc91.js.map → IrisGridModel-34172040.js.map} +1 -1
  17. package/build/assets/IrisGridShortcuts-a78631df.js +2 -0
  18. package/build/assets/IrisGridShortcuts-a78631df.js.map +1 -0
  19. package/build/assets/IrisGridThemeProvider-ab7ef621.js +11 -0
  20. package/build/assets/IrisGridThemeProvider-ab7ef621.js.map +1 -0
  21. package/build/assets/{IrisGridThemeProvider-15ce00be.css → IrisGridThemeProvider-fc06ae47.css} +1 -1
  22. package/build/assets/LocalWorkspaceStorage-3ef91e62.js +2 -0
  23. package/build/assets/LocalWorkspaceStorage-3ef91e62.js.map +1 -0
  24. package/build/assets/{MarkdownEditor-a32a9c3a.js → MarkdownEditor-7bf0580c.js} +2 -2
  25. package/build/assets/{MarkdownEditor-a32a9c3a.js.map → MarkdownEditor-7bf0580c.js.map} +1 -1
  26. package/build/assets/{MarkdownNotebook-dcf83e5c.js → MarkdownNotebook-bffb6319.js} +2 -2
  27. package/build/assets/{MarkdownNotebook-dcf83e5c.js.map → MarkdownNotebook-bffb6319.js.map} +1 -1
  28. package/build/assets/{MissingPartitionError-24250c44.js → MissingPartitionError-bfeab33a.js} +2 -2
  29. package/build/assets/{MissingPartitionError-24250c44.js.map → MissingPartitionError-bfeab33a.js.map} +1 -1
  30. package/build/assets/{StyleGuideRoot-3d1f4fac.js → StyleGuideRoot-703080bb.js} +2 -2
  31. package/build/assets/{StyleGuideRoot-3d1f4fac.js.map → StyleGuideRoot-703080bb.js.map} +1 -1
  32. package/build/assets/{TokenBoxCellRenderer-9d709524.js → TokenBoxCellRenderer-c83747e0.js} +2 -2
  33. package/build/assets/{TokenBoxCellRenderer-9d709524.js.map → TokenBoxCellRenderer-c83747e0.js.map} +1 -1
  34. package/build/assets/{index-dd7f33be.js → index-1e463a44.js} +2 -2
  35. package/build/assets/{index-dd7f33be.js.map → index-1e463a44.js.map} +1 -1
  36. package/build/assets/{index-6b74db9b.js → index-6241cdd1.js} +3 -3
  37. package/build/assets/{index-6b74db9b.js.map → index-6241cdd1.js.map} +1 -1
  38. package/build/assets/index-c213d4db.js +2 -0
  39. package/build/assets/index-c213d4db.js.map +1 -0
  40. package/build/index.html +2 -2
  41. package/package.json +10 -10
  42. package/build/assets/IrisGridShortcuts-c4b59c54.js +0 -2
  43. package/build/assets/IrisGridShortcuts-c4b59c54.js.map +0 -1
  44. package/build/assets/IrisGridThemeProvider-e0fb6177.js +0 -11
  45. package/build/assets/IrisGridThemeProvider-e0fb6177.js.map +0 -1
  46. package/build/assets/LocalWorkspaceStorage-9fc16a93.js +0 -2
  47. package/build/assets/LocalWorkspaceStorage-9fc16a93.js.map +0 -1
  48. package/build/assets/index-6ed3511b.js +0 -2
  49. package/build/assets/index-6ed3511b.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import{r as m,by as Ti,V as j,bB as ql,J as u,L as Ka,M as X,R as Hr,a3 as S,bC as Zl,N as ue,I as At,H as za,a1 as On,a2 as Cn,bD as Xl,bE as Yl,bF as Ql,bA as Qn,bG as Jl,bH as ed,ab as St,bI as zn,av as Gi,bJ as M,bK as qi,bL as td,ad as Ga,a5 as Oi,bM as nd,a0 as Nn}from"./vendor-3e5e4180.js";import{L as W,ax as qa,T as Za,a3 as rd,a6 as id,P as od,a2 as ad,a7 as sd,_ as ld,ac as dd,S as ud,M as Xa,b as Ya,c as Qa,al as hd,ay as cd,az as Ja,aA as es,aB as md,aC as fd,J as hn,ag as vd,aD as gd,aE as pd,aF as bd,aG as yd,aH as Cd,aI as Sd,aJ as wd,aK as Ed,aL as _d,aM as Pd,B as ts,aw as Td,at as ns,au as rs,U as is,j as Od,e as k,d as Bn,aN as Id,aa as os,aO as Zi,aP as Dd,aQ as xd,aR as Md,aS as Nd,f as as,am as ss,aT as ls,aU as Gn,as as Ad,aV as Ld,F as Xi,aW as ds,aX as Yi,aY as us,aZ as Fd,I as Rd,a_ as kd,a4 as jd,a$ as $d,A as Hd,a5 as Bd,b0 as Wd,b1 as Ud,b2 as Vd,b3 as Kd,b4 as zd,b5 as Gd,b6 as qd,ao as Zd,b7 as Xd,b8 as Yd}from"./index-dd7f33be.js";import{e as ut,l as yt,K as Ge,a as Zt,b as Qi,R as Qd,_ as hs}from"./monaco-b5248072.js";var Vy=Object.freeze([]),Ky=new Map,zy=()=>{};function Gy(n){return Array.isArray(n)?n:[n]}function Qr(){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 Jd(n,e,t){return e=eu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function eu(n){var e=tu(n,"string");return typeof e=="symbol"?e:String(e)}function tu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class nu extends Error{constructor(){super(...arguments),Jd(this,"isCanceled",!0)}}const ui=nu;function ru(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=iu(n,e);t.forEach(r=>{n[r]=n[r].bind(n)})}function iu(n,e){for(var t=new Set,r=n,i=0;r!=null&&r!==Object.prototype&&(i<=1||e);){for(var o of Object.getOwnPropertyNames(r)){var a;o!=="constructor"&&typeof((a=Object.getOwnPropertyDescriptor(r,o))===null||a===void 0?void 0:a.value)=="function"&&t.add(o)}r=Object.getPrototypeOf(r),i+=1}return[...t.keys()]}function Ji(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function ou(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Ji(o,r,i,a,s,"next",l)}function s(l){Ji(o,r,i,a,s,"throw",l)}a(void 0)})}}function cs(n){return hi.apply(this,arguments)}function hi(){return hi=ou(function*(n){var{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(n)}catch{return eo(n)}eo(n)}),hi.apply(this,arguments)}function eo(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 cn(n,e,t){return e=au(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function au(n){var e=su(n,"string");return typeof e=="symbol"?e:String(e)}function su(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var lu="table_",ms="column_",du=new Set(["in","not","i","ii","k"]),uu=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"]),hu=/[^a-zA-Z0-9_$\-+@]/g,cu=/[^A-Za-z0-9_$]/g,mu=/^[a-zA-Z_$][a-zA-Z0-9_$\-+@]*$/,fu=/[^a-zA-Z0-9_]/g;function vu(n){return n.replace(/[ -]/g,"_")}function gu(n){return n.replace(/\s/g,"_")}class Je{}cn(Je,"legalize",(n,e,t,r,i,o)=>{var a=e(n.trim());return i&&(du.has(a)||uu.has(a))&&(a=t+a),a=a.replace(r,""),a?(/^[0-9-]/.test(a)&&(a=t+a),a):t+o});cn(Je,"legalizeTableName",n=>Je.legalize(n,gu,lu,hu,!1,0));cn(Je,"makeVariableName",n=>Je.legalizeTableName(n).replace(fu,"_"));cn(Je,"legalizeColumnNames",n=>{var e=[];return n.forEach((t,r)=>{var i=Je.legalizeColumnName(t,r);e.includes(i)&&(i=ms+r),e.push(i)}),e});cn(Je,"legalizeColumnName",function(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return Je.legalize(n,vu,ms,cu,!0,e)});cn(Je,"isValidTableName",n=>mu.test(n));cn(Je,"isValidColumnName",n=>Je.legalizeColumnName(n)===n);const fs=Je;class vs extends CustomEvent{constructor(e,t){super(e,t)}}function pu(n,e,t){return e=bu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bu(n){var e=yu(n,"string");return typeof e=="symbol"?e:String(e)}function yu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Cu extends Error{constructor(){super(...arguments),pu(this,"isTimeout",!0)}}const gs=Cu;class Ee{static makeCancelable(e,t){var r=!1,i,o,a=new Promise((s,l)=>{o=l,Promise.resolve(e).then(d=>{r?t&&t(d):(i=d,s(d))}).catch(d=>l(d))});return a.cancel=()=>{r=!0,o(new ui),i!=null&&t&&t(i)},a}static isCanceled(e){return e instanceof ui}static isTimedOut(e){return e instanceof gs}static withTimeout(e,t){return new Promise((r,i)=>{setTimeout(()=>{try{r(t())}catch(o){i(o)}},e)})}}function to(n,e,t){return e=Su(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Su(n){var e=wu(n,"string");return typeof e=="symbol"?e:String(e)}function wu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Eu{constructor(){to(this,"pending",[]),to(this,"resolved",[])}add(e,t){var r=Ee.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=[]}}const An=Eu;function qy(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}class Ii{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(!Ii.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,i]=t,o=[...e],a=o.length-1;a>=0;a-=1){var s=o[a],l=s[0],d=s[1];if(l<=r&&i<=d)return o;r<=d&&l<=i&&(r=Math.min(r,l),i=Math.max(i,d),o.splice(a,1))}return o.push([r,i]),o}static deselectRange(e,t){for(var[r,i]=t,o=[...e],a=o.length-1;a>=0;a-=1){var s=o[a],l=s[0],d=s[1];if(!(i<l||d<r))if(l<r&&i<d){o[a]=[l,r-1],o.splice(a+1,0,[i+1,d]);break}else r<=l&&d<=i?o.splice(a,1):l<r?o[a]=[l,r-1]:o[a]=[i+1,d]}return o}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},[])}}const xt=Ii;function*Zy(n,e){for(var t=n;t<=e;++t)yield t}var Xy=" ";class ps{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}}function bs(n,e,t){return e=_u(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _u(n){var e=Pu(n,"string");return typeof e=="symbol"?e:String(e)}function Pu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class nr{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(nr.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])}}bs(nr,"TIME_PATTERN","([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]");bs(nr,"TIME_ZONES",Object.freeze([{label:"Tokyo UTC+9 No DST",value:"Asia/Tokyo"},{label:"Seoul UTC+9 No DST",value:"Asia/Seoul"},{label:"Hong Kong UTC+8 No DST",value:"Asia/Hong_Kong"},{label:"Singapore UTC+8 No DST",value:"Asia/Singapore"},{label:"Kolkata UTC+5:30 No DST",value:"Asia/Kolkata"},{label:"Berlin UTC+1",value:"Europe/Berlin"},{label:"UTC UTC±0 No DST",value:"UTC"},{label:"London UTC±0",value:"Europe/London"},{label:"Sao Paulo UTC-2",value:"America/Sao_Paulo"},{label:"Newfoundland UTC-3:30",value:"America/St_Johns"},{label:"Halifax UTC-4",value:"America/Halifax"},{label:"New York UTC−5",value:"America/New_York"},{label:"Chicago UTC-6",value:"America/Chicago"},{label:"Denver UTC-7",value:"America/Denver"},{label:"Los Angeles UTC-8",value:"America/Los_Angeles"},{label:"Anchorage UTC-9",value:"America/Anchorage"},{label:"Honolulu UTC-10 No DST",value:"Pacific/Honolulu"},{label:"Zurich UTC+1",value:"Europe/Zurich"},{label:"Amsterdam UTC+1",value:"Europe/Amsterdam"},{label:"Taipei UTC+8 No DST",value:"Asia/Taipei"},{label:"Sydney UTC+10",value:"Australia/Sydney"}]));const ys=nr;function Tu(n,e,t){return e=Ou(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ou(n){var e=Iu(n,"string");return typeof e=="symbol"?e:String(e)}function Iu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Du extends Error{constructor(){super(...arguments),Tu(this,"isInvalid",!0)}}const qn=Du;function Cs(){var n=m.useRef(!1);return m.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[]),n}function no(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function xu(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){no(o,r,i,a,s,"next",l)}function s(l){no(o,r,i,a,s,"throw",l)}a(void 0)})}}var Mu=W.module("useAsyncInterval");function Nu(n,e){var t=Cs(),r=m.useRef(0),i=m.useRef(0),o=m.useRef(null),a=m.useCallback(xu(function*(){var s=Date.now();i.current+=1;var l=o.current==null?e:s-o.current;o.current=s;try{yield n()}catch(c){Mu.error("A tick error occurred:",c)}if(t.current){l+=Date.now()-o.current;var d=Math.max(0,l-e),h=Math.max(0,e-d);r.current=window.setTimeout(a,h)}}),[n,t,e]);m.useEffect(()=>(o.current=null,a(),()=>{window.clearTimeout(r.current)}),[e,a])}function rr(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 Au(n,e,t){var r=m.useRef(t),i=m.useRef(n);i.current=n;var o=m.useMemo(()=>Ti(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 Lu(n){var e=m.useRef();return m.useEffect(function(){e.current=n}),e.current}function Ss(n){var e=m.useRef(null);return m.useEffect(function(){n&&(typeof n=="function"?n(e.current):n.current=e.current)}),e}var Fu=3500,Ru=W.module("useCopyToClipboard");function ku(){var[n,e]=m.useState(!1),t=m.useRef(null),r=m.useCallback(i=>{cs(i).then(()=>{e(!0)}).catch(o=>Ru.error("Unable to copy ".concat(i),`
1
+ import{r as m,by as Ti,V as j,bB as ql,J as u,L as Ka,M as X,R as Hr,a3 as S,bC as Zl,N as ue,I as At,H as za,a1 as On,a2 as Cn,bD as Xl,bE as Yl,bF as Ql,bA as Qn,bG as Jl,bH as ed,ab as St,bI as zn,av as Gi,bJ as M,bK as qi,bL as td,ad as Ga,a5 as Oi,bM as nd,a0 as Nn}from"./vendor-3e5e4180.js";import{L as W,ax as qa,T as Za,a3 as rd,a6 as id,P as od,a2 as ad,a7 as sd,_ as ld,ac as dd,S as ud,M as Xa,b as Ya,c as Qa,al as hd,ay as cd,az as Ja,aA as es,aB as md,aC as fd,J as hn,ag as vd,aD as gd,aE as pd,aF as bd,aG as yd,aH as Cd,aI as Sd,aJ as wd,aK as Ed,aL as _d,aM as Pd,B as ts,aw as Td,at as ns,au as rs,U as is,j as Od,e as k,d as Bn,aN as Id,aa as os,aO as Zi,aP as Dd,aQ as xd,aR as Md,aS as Nd,f as as,am as ss,aT as ls,aU as Gn,as as Ad,aV as Ld,F as Xi,aW as ds,aX as Yi,aY as us,aZ as Fd,I as Rd,a_ as kd,a4 as jd,a$ as $d,A as Hd,a5 as Bd,b0 as Wd,b1 as Ud,b2 as Vd,b3 as Kd,b4 as zd,b5 as Gd,b6 as qd,ao as Zd,b7 as Xd,b8 as Yd}from"./index-1e463a44.js";import{e as ut,l as yt,K as Ge,a as Zt,b as Qi,R as Qd,_ as hs}from"./monaco-b5248072.js";var Vy=Object.freeze([]),Ky=new Map,zy=()=>{};function Gy(n){return Array.isArray(n)?n:[n]}function Qr(){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 Jd(n,e,t){return e=eu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function eu(n){var e=tu(n,"string");return typeof e=="symbol"?e:String(e)}function tu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class nu extends Error{constructor(){super(...arguments),Jd(this,"isCanceled",!0)}}const ui=nu;function ru(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=iu(n,e);t.forEach(r=>{n[r]=n[r].bind(n)})}function iu(n,e){for(var t=new Set,r=n,i=0;r!=null&&r!==Object.prototype&&(i<=1||e);){for(var o of Object.getOwnPropertyNames(r)){var a;o!=="constructor"&&typeof((a=Object.getOwnPropertyDescriptor(r,o))===null||a===void 0?void 0:a.value)=="function"&&t.add(o)}r=Object.getPrototypeOf(r),i+=1}return[...t.keys()]}function Ji(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function ou(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Ji(o,r,i,a,s,"next",l)}function s(l){Ji(o,r,i,a,s,"throw",l)}a(void 0)})}}function cs(n){return hi.apply(this,arguments)}function hi(){return hi=ou(function*(n){var{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(n)}catch{return eo(n)}eo(n)}),hi.apply(this,arguments)}function eo(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 cn(n,e,t){return e=au(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function au(n){var e=su(n,"string");return typeof e=="symbol"?e:String(e)}function su(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var lu="table_",ms="column_",du=new Set(["in","not","i","ii","k"]),uu=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"]),hu=/[^a-zA-Z0-9_$\-+@]/g,cu=/[^A-Za-z0-9_$]/g,mu=/^[a-zA-Z_$][a-zA-Z0-9_$\-+@]*$/,fu=/[^a-zA-Z0-9_]/g;function vu(n){return n.replace(/[ -]/g,"_")}function gu(n){return n.replace(/\s/g,"_")}class Je{}cn(Je,"legalize",(n,e,t,r,i,o)=>{var a=e(n.trim());return i&&(du.has(a)||uu.has(a))&&(a=t+a),a=a.replace(r,""),a?(/^[0-9-]/.test(a)&&(a=t+a),a):t+o});cn(Je,"legalizeTableName",n=>Je.legalize(n,gu,lu,hu,!1,0));cn(Je,"makeVariableName",n=>Je.legalizeTableName(n).replace(fu,"_"));cn(Je,"legalizeColumnNames",n=>{var e=[];return n.forEach((t,r)=>{var i=Je.legalizeColumnName(t,r);e.includes(i)&&(i=ms+r),e.push(i)}),e});cn(Je,"legalizeColumnName",function(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return Je.legalize(n,vu,ms,cu,!0,e)});cn(Je,"isValidTableName",n=>mu.test(n));cn(Je,"isValidColumnName",n=>Je.legalizeColumnName(n)===n);const fs=Je;class vs extends CustomEvent{constructor(e,t){super(e,t)}}function pu(n,e,t){return e=bu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bu(n){var e=yu(n,"string");return typeof e=="symbol"?e:String(e)}function yu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Cu extends Error{constructor(){super(...arguments),pu(this,"isTimeout",!0)}}const gs=Cu;class Ee{static makeCancelable(e,t){var r=!1,i,o,a=new Promise((s,l)=>{o=l,Promise.resolve(e).then(d=>{r?t&&t(d):(i=d,s(d))}).catch(d=>l(d))});return a.cancel=()=>{r=!0,o(new ui),i!=null&&t&&t(i)},a}static isCanceled(e){return e instanceof ui}static isTimedOut(e){return e instanceof gs}static withTimeout(e,t){return new Promise((r,i)=>{setTimeout(()=>{try{r(t())}catch(o){i(o)}},e)})}}function to(n,e,t){return e=Su(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Su(n){var e=wu(n,"string");return typeof e=="symbol"?e:String(e)}function wu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Eu{constructor(){to(this,"pending",[]),to(this,"resolved",[])}add(e,t){var r=Ee.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=[]}}const An=Eu;function qy(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}class Ii{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(!Ii.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,i]=t,o=[...e],a=o.length-1;a>=0;a-=1){var s=o[a],l=s[0],d=s[1];if(l<=r&&i<=d)return o;r<=d&&l<=i&&(r=Math.min(r,l),i=Math.max(i,d),o.splice(a,1))}return o.push([r,i]),o}static deselectRange(e,t){for(var[r,i]=t,o=[...e],a=o.length-1;a>=0;a-=1){var s=o[a],l=s[0],d=s[1];if(!(i<l||d<r))if(l<r&&i<d){o[a]=[l,r-1],o.splice(a+1,0,[i+1,d]);break}else r<=l&&d<=i?o.splice(a,1):l<r?o[a]=[l,r-1]:o[a]=[i+1,d]}return o}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},[])}}const xt=Ii;function*Zy(n,e){for(var t=n;t<=e;++t)yield t}var Xy=" ";class ps{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}}function bs(n,e,t){return e=_u(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _u(n){var e=Pu(n,"string");return typeof e=="symbol"?e:String(e)}function Pu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class nr{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(nr.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])}}bs(nr,"TIME_PATTERN","([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]");bs(nr,"TIME_ZONES",Object.freeze([{label:"Tokyo UTC+9 No DST",value:"Asia/Tokyo"},{label:"Seoul UTC+9 No DST",value:"Asia/Seoul"},{label:"Hong Kong UTC+8 No DST",value:"Asia/Hong_Kong"},{label:"Singapore UTC+8 No DST",value:"Asia/Singapore"},{label:"Kolkata UTC+5:30 No DST",value:"Asia/Kolkata"},{label:"Berlin UTC+1",value:"Europe/Berlin"},{label:"UTC UTC±0 No DST",value:"UTC"},{label:"London UTC±0",value:"Europe/London"},{label:"Sao Paulo UTC-2",value:"America/Sao_Paulo"},{label:"Newfoundland UTC-3:30",value:"America/St_Johns"},{label:"Halifax UTC-4",value:"America/Halifax"},{label:"New York UTC−5",value:"America/New_York"},{label:"Chicago UTC-6",value:"America/Chicago"},{label:"Denver UTC-7",value:"America/Denver"},{label:"Los Angeles UTC-8",value:"America/Los_Angeles"},{label:"Anchorage UTC-9",value:"America/Anchorage"},{label:"Honolulu UTC-10 No DST",value:"Pacific/Honolulu"},{label:"Zurich UTC+1",value:"Europe/Zurich"},{label:"Amsterdam UTC+1",value:"Europe/Amsterdam"},{label:"Taipei UTC+8 No DST",value:"Asia/Taipei"},{label:"Sydney UTC+10",value:"Australia/Sydney"}]));const ys=nr;function Tu(n,e,t){return e=Ou(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ou(n){var e=Iu(n,"string");return typeof e=="symbol"?e:String(e)}function Iu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Du extends Error{constructor(){super(...arguments),Tu(this,"isInvalid",!0)}}const qn=Du;function Cs(){var n=m.useRef(!1);return m.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[]),n}function no(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function xu(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){no(o,r,i,a,s,"next",l)}function s(l){no(o,r,i,a,s,"throw",l)}a(void 0)})}}var Mu=W.module("useAsyncInterval");function Nu(n,e){var t=Cs(),r=m.useRef(0),i=m.useRef(0),o=m.useRef(null),a=m.useCallback(xu(function*(){var s=Date.now();i.current+=1;var l=o.current==null?e:s-o.current;o.current=s;try{yield n()}catch(c){Mu.error("A tick error occurred:",c)}if(t.current){l+=Date.now()-o.current;var d=Math.max(0,l-e),h=Math.max(0,e-d);r.current=window.setTimeout(a,h)}}),[n,t,e]);m.useEffect(()=>(o.current=null,a(),()=>{window.clearTimeout(r.current)}),[e,a])}function rr(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 Au(n,e,t){var r=m.useRef(t),i=m.useRef(n);i.current=n;var o=m.useMemo(()=>Ti(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 Lu(n){var e=m.useRef();return m.useEffect(function(){e.current=n}),e.current}function Ss(n){var e=m.useRef(null);return m.useEffect(function(){n&&(typeof n=="function"?n(e.current):n.current=e.current)}),e}var Fu=3500,Ru=W.module("useCopyToClipboard");function ku(){var[n,e]=m.useState(!1),t=m.useRef(null),r=m.useCallback(i=>{cs(i).then(()=>{e(!0)}).catch(o=>Ru.error("Unable to copy ".concat(i),`
2
2
  `,o))},[]);return m.useEffect(()=>(t.current&&clearTimeout(t.current),n&&(t.current=setTimeout(()=>{e(!1)},Fu)),()=>{t.current&&clearTimeout(t.current)}),[n]),[n,r]}function ro(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ju(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ro(Object(t),!0).forEach(function(r){Pn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ro(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Pn(n,e,t){return e=$u(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $u(n){var e=Hu(n,"string");return typeof e=="symbol"?e:String(e)}function Hu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var io="popper";class Di extends m.Component{constructor(e){super(e),Pn(this,"element",void 0),Pn(this,"container",void 0),Pn(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.element.className="popper-container",this.container=j.createRef(),this.rAF=0;var{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){var{isShown:t}=this.props;e.isShown!==t&&(t?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){var{popper:e}=this.state,{closeOnBlur:t,referenceObject:r}=this.props;if(!e&&this.container.current!==null){var{options:i}=this.props;i=ju({placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}}},i),document.body.appendChild(this.element);var o=this.getVisibleElement(this.container.current);o==null&&(o=this.container.current),e=new ql(r||o,this.element,i),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t){var a=this.element.querySelector(".".concat(io));a instanceof HTMLElement&&!a.contains(document.activeElement)&&a.focus()}}),this.setState({popper:e})}}destroyPopper(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;cancelAnimationFrame(this.rAF);var{popper:t}=this.state;t&&(t.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),this.setState({show:!0})}hide(){this.setState({show:!1})}scheduleUpdate(){var{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){var{onEntered:e}=this.props;e()}handleExit(){var{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){var{className:e,children:t,timeout:r,interactive:i,closeOnBlur:o}=this.props,{show:a}=this.state;return u.jsx(qa,{isPortal:!0,children:u.jsx(Ka,{in:a,timeout:r,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:u.jsx("div",{onClick:s=>{s.stopPropagation()},onKeyDown:s=>{s.key==="Escape"&&this.hide()},className:X(io,{interactive:i},e),onBlur:o?this.handleBlur:void 0,tabIndex:o?-1:void 0,role:"presentation",children:u.jsxs("div",{className:"popper-content",children:[t,u.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})})}render(){var{popper:e}=this.state,{"data-testid":t}=this.props;return u.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&Hr.createPortal(this.renderContent(),this.element)})}}Pn(Di,"propTypes",{children:S.node.isRequired,options:S.shape({}),className:S.string,timeout:S.number,onEntered:S.func,onExited:S.func,isShown:S.bool,closeOnBlur:S.bool,interactive:S.bool,referenceObject:S.shape({}),"data-testid":S.string});Pn(Di,"defaultProps",{options:{},className:"",timeout:Za.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0});const xi=Di;function oo(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 Bu(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?oo(Object(t),!0).forEach(function(r){ct(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):oo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ct(n,e,t){return e=Wu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wu(n){var e=Uu(n,"string");return typeof e=="symbol"?e:String(e)}function Uu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Vu=W.module("Tooltip");class Ce extends m.Component{static handleHidden(){Ce.shownTooltipCount-=1,Ce.shownTooltipCount===0&&(Ce.lastHiddenTime=Date.now())}static handleShown(){Ce.shownTooltipCount+=1}constructor(e){super(e),ct(this,"container",void 0),ct(this,"popper",void 0),ct(this,"parent",void 0),ct(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=j.createRef(),this.popper=j.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();var{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){var{isShown:r}=t,{isShown:i}=this.state;i!==r&&(i?Ce.handleShown():Ce.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();var{isShown:e}=this.state;e&&Ce.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){Vu.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{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){var{isShown:e}=this.state;this.stopTimer();var{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){var t=e.clientX,r=e.clientY,{isShown:i}=this.state;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{timeout:e,reshowTimeout:t}=this.props,r=e;(Ce.shownTooltipCount>0||Date.now()-Ce.lastHiddenTime<Ce.triggerReshowThreshold)&&(r=t),this.timer=window.setTimeout(this.handleTimeout,r)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var{isShown:e}=this.state;if(this.stopTimer(),!e){var t;(t=this.popper.current)===null||t===void 0||t.show(),this.setState({isShown:!0});var{interactive:r}=this.props;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{onExited:e}=this.props;e()}stopShowingTooltip(){var{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){var{interactive:e,children:t,referenceObject:r,popperClassName:i,"data-testid":o,onEntered:a}=this.props,{isShown:s}=this.state,{options:l}=this.props;return l=Bu({placement:"bottom"},l),u.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":o,children:u.jsx(xi,{className:X(i,"popper-tooltip"),options:l,ref:this.popper,onEntered:a,onExited:this.handleExited,interactive:e,referenceObject:r,children:u.jsxs("div",{className:"tooltip-content",children:[" ",s&&t]})})})}}ct(Ce,"defaultTimeout",500);ct(Ce,"defaultReshowTimeout",100);ct(Ce,"triggerReshowThreshold",300);ct(Ce,"shownTooltipCount",0);ct(Ce,"lastHiddenTime",Date.now());ct(Ce,"defaultProps",{interactive:!1,options:{},popperClassName:"",reshowTimeout:Ce.defaultReshowTimeout,timeout:Ce.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});const Xt=Ce;var Ku=W.module("ThemeProvider"),ws=m.createContext(null);function Yy(n){var{themes:e,defaultPreloadValues:t=ud,children:r}=n,i=m.useMemo(()=>rd(),[]),[o,a]=m.useState(null),[s,l]=m.useState(()=>{var c,f;return(c=(f=id())===null||f===void 0?void 0:f.themeKey)!==null&&c!==void 0?c:od}),d=m.useMemo(()=>e==null?null:ad(s,{base:i,custom:e??[]}),[i,s,e]),h=m.useMemo(()=>[...i,...e??[]],[i,e]);return m.useEffect(function(){if(!(d==null||e==null)){sd(t);var f=ld(t);Ku.debug2("updateThemePreloadData:",{active:d.map(v=>v.themeKey),custom:e.map(v=>v.themeKey),preloadStyleContent:f,selectedThemeKey:s}),dd({themeKey:s,preloadStyleContent:f})}},[d,s,e,t]),m.useEffect(()=>{a({activeThemes:d,selectedThemeKey:s,themes:h,setSelectedThemeKey:l})},[d,s,h]),u.jsxs(u.Fragment,{children:[d==null?null:u.jsx(u.Fragment,{children:d.map(c=>u.jsx("style",{"data-theme-key":c.themeKey,children:c.styleContent},c.themeKey))}),o==null?null:u.jsx(ws.Provider,{value:o,children:u.jsx(qa,{children:r})})]})}function Es(){return rr(ws,"No ThemeContext value found. Component must be wrapped in a ThemeContext.Provider")}function Br(n){var{children:e,className:t,style:r,"data-testid":i}=n;return u.jsx("div",{className:X("btn-group",t),style:r,role:"group","data-testid":i,children:e})}Br.displayName="SplitButtonGroup";Br.propTypes={children:S.node.isRequired,className:S.string,style:S.object,"data-testid":S.string};Br.defaultProps={className:null,style:{},"data-testid":void 0};var zu=["kind","variant","type","tooltip","icon","disabled","active","onClick","onContextMenu","onMouseDown","onMouseUp","onMouseEnter","onMouseLeave","onKeyDown","className","style","children","tabIndex","data-testid","aria-label"];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 so(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){Gu(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 Gu(n,e,t){return e=qu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qu(n){var e=Zu(n,"string");return typeof e=="symbol"?e:String(e)}function Zu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Xu(n,e){if(n==null)return{};var t=Yu(n,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function Yu(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var Qu=["primary","secondary","tertiary","success","danger","inline","ghost"],Ju=["group-end"];function eh(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 X("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function th(n){switch(n){case"group-end":return X("pl-2","pr-3")}}var se=j.forwardRef((n,e)=>{var{kind:t,variant:r,type:i,tooltip:o,icon:a,disabled:s=!1,active:l,onClick:d,onContextMenu:h,onMouseDown:c,onMouseUp:f,onMouseEnter:v,onMouseLeave:p,onKeyDown:g,className:y,style:P,children:O,tabIndex:_,"data-testid":R,"aria-label":U}=n,Q=Xu(n,zu),{UNSAFE_className:N}=Zl({},"button"),B;r&&(B=th(r));var $;a&&($=j.isValidElement(a)?a:u.jsx(ue,{icon:a}));var Y=$!=null&&O==null,ne=eh(t,Y),F;o!==void 0&&(F=typeof o=="string"?u.jsx(Xt,{children:o}):o);var q=U;U===void 0&&Y&&o!=null&&typeof o=="string"&&(q=o);var K=u.jsxs("button",so(so({"data-testid":R,ref:e,type:i,className:X("btn",ne,B,{active:l},y,N),onClick:d,onContextMenu:h,onMouseUp:f,onMouseDown:c,onMouseEnter:v,onMouseLeave:p,onKeyDown:g,style:P,disabled:s,tabIndex:_,"aria-label":q},Q),{},{children:[a&&$,O,o!=null&&!s&&F]}));return s&&o!=null?u.jsxs("span",{className:"btn-disabled-wrapper",children:[K,F]}):K});se.displayName="Button";se.propTypes={kind:S.oneOf(Qu).isRequired,variant:S.oneOf(Ju),type:S.oneOf(["submit","reset","button"]),tooltip(n){var{tooltip:e,icon:t,children:r}=n;return e===void 0&&t!=null&&r==null?new Error("Tooltip is required for icon only buttons"):null},icon(n){var{children:e,icon:t}=n;return t==null&&e==null?new Error("Icon is required if no children are provided"):e==null&&!j.isValidElement(t)&&(t==null||t.iconName===""||t.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:S.bool,active:S.bool,onClick(n){var{onClick:e,type:t}=n;return t==="button"&&typeof e!="function"?new Error("type button requires an onClick function"):e!==void 0&&typeof e!="function"?new Error("onClick must be a function"):null},onContextMenu:S.func,onMouseUp:S.func,onMouseDown:S.func,onMouseEnter:S.func,onMouseLeave:S.func,onKeyDown:S.func,tabIndex:S.number,children:S.node,className:S.string,style:S.object,"data-testid":S.string};se.defaultProps={type:"button",onClick:void 0,onContextMenu:void 0,onMouseUp:void 0,onMouseDown:void 0,onMouseEnter:void 0,onMouseLeave:void 0,onKeyDown:void 0,variant:void 0,tooltip:void 0,icon:void 0,disabled:!1,active:void 0,tabIndex:void 0,children:void 0,className:void 0,style:{},"data-testid":void 0};const Tn=se;function _s(n){var{className:e,children:t,"data-testid":r}=n;return u.jsx("div",{className:X("modal-footer",e),"data-testid":r,children:t})}function un(n){var{isOpen:e,headerText:t,bodyText:r,onCancel:i,onConfirm:o,onDiscard:a,onModalDisable:s,cancelButtonText:l="Cancel",confirmButtonText:d="Okay",discardButtonText:h="Discard",isConfirmDanger:c=!1,children:f,"data-testid":v}=n,p=m.useRef(null),g=m.useRef(null),y=m.useCallback(()=>{g.current!==null&&g.current.checked&&s&&s(),o()},[o,s]),P=m.useCallback(()=>{var _;(_=p.current)===null||_===void 0||_.focus()},[]),O="";return e&&(O=typeof r=="function"?r():r),u.jsxs(Xa,{isOpen:e,onOpened:P,children:[u.jsx(Ya,{closeButton:!1,children:t}),u.jsx(Qa,{children:O}),u.jsxs(_s,{children:[s&&u.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[u.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:g,"data-testid":v!==void 0?"".concat(v,"-checkbox-confirm"):void 0}),u.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),a&&u.jsx(Tn,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:a,"data-testid":v!==void 0?"".concat(v,"-btn-discard"):void 0,children:h}),i&&u.jsx(Tn,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":v!==void 0?"".concat(v,"-btn-cancel"):void 0,children:l}),u.jsxs(Br,{children:[u.jsx(Tn,{kind:c?"danger":"primary",onClick:y,ref:p,"data-testid":v!==void 0?"".concat(v,"-btn-confirm"):void 0,children:d}),f]})]})]})}un.propTypes={isOpen:S.bool.isRequired,headerText:S.string.isRequired,bodyText:S.oneOfType([S.string,S.func]).isRequired,onCancel:S.func,onConfirm:S.func.isRequired,onDiscard:S.func,onModalDisable:S.func,cancelButtonText:S.string,confirmButtonText:S.string,discardButtonText:S.string,children:S.node,"data-testid":S.string};un.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};function nh(n,e,t){return e=rh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function rh(n){var e=ih(n,"string");return typeof e=="symbol"?e:String(e)}function ih(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Jr(n){return n.then!==void 0}class Kt{static disableAllActions(){Kt.actionsDisabled=!0}static enableAllActions(){Kt.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(Kt.compareActions),t}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return Kt.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){var t=Kt.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}}nh(Kt,"actionsDisabled",!1);const Ye=Kt;var lo=W.module("GlobalContextAction");class oh 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{action:r}=this.props;r.title==null&&!r.menuElement||(t.contextActions==null&&(t.contextActions=[]),t.contextActions.push(r),lo.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){var{action:t}=this.props;if(!Ye.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)){var r;lo.debug("Global hotkey matched!",e),(r=t.action)===null||r===void 0||r.call(t,e),e.preventDefault(),e.stopPropagation()}}render(){return null}}const ah=oh;class sh extends m.Component{render(){for(var{actions:e,"data-testid":t}=this.props,r=[],i=0;i<e.length;i+=1){var o=e[i],{shortcut:a}=o;if(o.title!=null||o.menuElement||a){var s=u.jsx(ah,{action:o,"data-testid":t},"".concat(o.title,".").concat(a?.id));r.push(s)}}return r}}const lh=sh;function Ps(n,e,t){return e=dh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function dh(n){var e=uh(n,"string");return typeof e=="symbol"?e:String(e)}function uh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var fr=W.module("ContextActions");class Ts 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),Ps(this,"container",void 0),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=j.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=>!Jr(i)&&typeof i!="function"&&i.isGlobal),r=e.actions.filter(i=>!Jr(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{ignoreClassNames:t=[]}=this.props;if(t.length>0)for(var r=e.target,i=function(){var{classList:d}=r,h=t.find(c=>d.contains(c));if(h!==void 0)return fr.debug2('Contextmenu event ignored based on the target className "'.concat(h,'"')),{v:void 0};r=r.parentElement};r!=null;){var o=i();if(typeof o=="object")return o.v}if(Ye.isContextActionEvent(e)||(e.contextActions=[]),!!Ye.isContextActionEvent(e)){var{actions:a}=this.props;if(a!=null){var s=a;Array.isArray(s)&&(s=s.filter(l=>Jr(l)||typeof l=="function"||l.isGlobal===void 0||!l.isGlobal)),e.contextActions=e.contextActions.concat(s)}fr.debug("Received context menu event! Menu items are now: ",e.contextActions)}}handleKeyDown(e){for(var{keyboardActions:t}=this.state,r=0;r<t.length;r+=1){var i=t[r];if(!Ye.actionsDisabled&&i.shortcut!=null&&i.shortcut.matchesEvent(e)){var o;fr.debug("Context hotkey matched!",e),(o=i.action)===null||o===void 0||o.call(i,e),e.stopPropagation(),e.preventDefault(),fr.debug2("Matched hotkey returned false, key event not consumed")}}}render(){var{"data-testid":e}=this.props,{globalActions:t}=this.state;return u.jsx("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:u.jsx(lh,{actions:t})})}}Ps(Ts,"groups",{default:void 0,high:100,medium:5e3,low:1e4,global:1e5,edit:100});const ee=Ts;var Mi=j.forwardRef((n,e)=>{var t,r;function i(N){var{menuItem:B,onMenuItemClick:$}=n;$(B,N)}function o(N){var{menuItem:B,onMenuItemMouseMove:$}=n;$(B,N)}function a(N){var{menuItem:B,onMenuItemContextMenu:$}=n;$(B,N)}function s(N,B,$){if(typeof N.type=="string")return N;var{closeMenu:Y,menuItem:ne,isKeyboardSelected:F,isMouseSelected:q,"data-testid":K}=n,A={menuItem:ne,closeMenu:Y,isKeyboardSelected:F,isMouseSelected:q,iconElement:B,displayShortcut:$,"data-testid":K};return j.cloneElement(N,{forwardedProps:A})}var{children:l,menuItem:d,isKeyboardSelected:h=!1,isMouseSelected:c=!1,"data-testid":f}=n,v=(t=d.shortcutText)!==null&&t!==void 0?t:(r=d.shortcut)===null||r===void 0?void 0:r.getDisplayText(),p=null;if(d.icon){var g=d.icon;if(j.isValidElement(g))p=g;else{var y;d.iconColor!=null&&(d.disabled===void 0||!d.disabled)&&(y={color:d.iconColor}),p=u.jsx(ue,{icon:g,style:y})}}var P=null,O=!!l;d.actions&&(P=u.jsx(ue,{icon:hd}));var _=null;if(d.menuElement)_=u.jsx("div",{className:"custom-menu-item",onMouseMove:o,children:s(d.menuElement,p,v)});else{var R,U=d.disabled,Q=d.iconOutline;_=u.jsx("button",{type:"button",className:X("btn-context-menu",{disabled:U},{active:(O||c)&&(U===void 0||!U)},{"keyboard-active":h&&(U===void 0||!U)}),onClick:i,onMouseMove:o,onContextMenu:a,title:(R=d.description)!==null&&R!==void 0?R:"",children:u.jsxs("div",{className:"btn-context-menu-wrapper",children:[u.jsx("span",{className:X("icon",{outline:Q}),children:p}),u.jsx("span",{className:"title",children:d.title}),v!==void 0&&u.jsx("span",{className:"shortcut",children:v}),P&&u.jsx("span",{className:X("submenu-indicator",{disabled:U}),children:P})]})})}return u.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":f,children:[l,_]})});Mi.displayName="ContextMenuItem";Mi.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const hh=Mi;var Wr=j.forwardRef((n,e)=>{var{checked:t=!1,children:r,className:i,disabled:o,inputClassName:a,isInvalid:s,labelClassName:l,name:d,onChange:h,"data-testid":c}=n,[f]=m.useState(At()),v=Ss(e);m.useEffect(function(){v.current&&(v.current.indeterminate=t===null)},[v,t]);var p=m.useCallback(g=>{v.current&&(v.current.indeterminate=t===null),h&&h(g)},[v,t,h]);return u.jsxs("div",{className:X("custom-control custom-checkbox",i),children:[u.jsx("input",{type:"checkbox",ref:v,checked:t??!1,className:X("custom-control-input",a,{"is-invalid":s}),disabled:o,id:f,name:d,onChange:p,"data-testid":c}),u.jsx("label",{className:X("custom-control-label",l),htmlFor:f,children:r})]})});Wr.displayName="Checkbox";Wr.propTypes={checked:(n,e)=>{var{[e]:t}=n;return t!==null&&typeof t!="boolean"?new Error("Checked must be a boolean or null for indeterminate"):null},children:S.node.isRequired,className:S.string,disabled:S.bool,inputClassName:S.string,isInvalid:S.bool,labelClassName:S.string,name:S.string,onChange:S.func,"data-testid":S.string};Wr.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const ch=Wr;function Qy(n){var{copy:e,kind:t="ghost",tooltip:r="Copy",className:i,style:o,"data-testid":a,children:s}=n,[l,d]=ku();return u.jsx(Tn,{kind:t,className:i,style:o,"data-testid":a,icon:l?cd:Ja,tooltip:l?"Copied":r,onClick:()=>{d(typeof e=="function"?e():e)},children:s})}function uo(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 mh(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?uo(Object(t),!0).forEach(function(r){Zn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):uo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Zn(n,e,t){return e=fh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fh(n){var e=vh(n,"string");return typeof e=="symbol"?e:String(e)}function vh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Os extends m.PureComponent{constructor(e){var t;super(e),Zn(this,"container",void 0),Zn(this,"oldFocus",void 0),Zn(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=j.createRef(),this.oldFocus=document.activeElement,this.rAF=0;var{options:r}=e,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{onMenuOpened:t}=this.props;t(this)})}componentDidUpdate(e){var{actions:t}=this.props;e.actions!==t&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}getKeyboardIndex(){var{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){var{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){var{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){var{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});var{actions:e}=this.props,t=Ye.getMenuItems(e,!1);t.length>0&&this.setState(r=>({menuItems:Ye.sortActions(r.menuItems.concat(t))}))}handleKeyDown(e){var{menuItems:t}=this.state,r=this.getKeyboardIndex(),i=r;if(e.key==="Enter"||e.key===" "){r!=null&&r>=0&&r<t.length&&this.handleMenuItemClick(t[r],e);return}if(e.key==="Escape")i=null;else if(e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0){var o;i=Ye.getNextMenuItem((o=i)!==null&&o!==void 0?o:0,-1,t)}else if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var a;i=Ye.getNextMenuItem((a=i)!==null&&a!==void 0?a: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,{closeMenu:t,onMenuClosed:r}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),r(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{menuItems:t}=this.state,r=t.indexOf(e);this.setMouseIndex(r)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{"data-testid":t}=this.props,{keyboardIndex:r,menuItems:i,mouseIndex:o}=this.state,a=0;a<i.length;a+=1){var s=i[a];a>0&&s.group!==i[a-1].group&&e.push(u.jsx("hr",{},"".concat(a,".separator")));var l=u.jsx(hh,{isKeyboardSelected:r===a,isMouseSelected:o===a,menuItem:s,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},a);e.push(l)}var{menuStyle:d}=this.props;return u.jsx("div",{className:"context-menu-container",style:mh({},d),ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}}Zn(Os,"defaultProps",{closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});const gh=Os;function ho(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 co(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ho(Object(t),!0).forEach(function(r){wn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ho(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function wn(n,e,t){return e=ph(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ph(n){var e=bh(n,"string");return typeof e=="symbol"?e:String(e)}function bh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Is extends m.PureComponent{constructor(e){super(e),wn(this,"container",void 0),wn(this,"parent",void 0),wn(this,"popper",void 0),wn(this,"isOpen",void 0),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=j.createRef(),this.parent=null,this.popper=j.createRef(),this.isOpen=!1}componentDidMount(){var{isShown:e}=this.props;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{isShown:t}=this.props;e.isShown!==t&&(t!==null&&t?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}closeMenu(){var e;(e=this.popper.current)===null||e===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{onMenuClosed:e}=this.props;e()}render(){var{actions:e,onMenuOpened:t,popperClassName:r,"data-testid":i}=this.props,{menuStyle:o}=this.props,{options:a,popperOptions:s}=this.props;return s=co({placement:"bottom"},s),a=co({separateKeyboardMouse:!0},a),u.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":i,children:u.jsx(xi,{ref:this.popper,options:s,className:X("menu-popper",r),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:u.jsx(gh,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:a,menuStyle:o})})})}}wn(Is,"defaultProps",{isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0});const Xn=Is;function Bt(n,e,t){return e=yh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yh(n){var e=Ch(n,"string");return typeof e=="symbol"?e:String(e)}function Ch(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var mo=W.module("Shortcut"),L;(function(n){n.CTRL="MODIFIER_CTRL",n.CMD="MODIFIER_CMD",n.ALT="MODIFIER_ALT",n.OPTION="MODIFIER_OPTION",n.SHIFT="MODIFIER_SHIFT"})(L||(L={}));var x;(function(n){n.A="A",n.B="B",n.C="C",n.D="D",n.E="E",n.F="F",n.G="G",n.H="H",n.I="I",n.J="J",n.K="K",n.L="L",n.M="M",n.N="N",n.O="O",n.P="P",n.Q="Q",n.R="R",n.S="S",n.T="T",n.U="U",n.V="V",n.W="W",n.X="X",n.Y="Y",n.Z="Z",n.ZERO="0",n.ONE="1",n.TWO="2",n.THREE="3",n.FOUR="4",n.FIVE="5",n.SIX="6",n.SEVEN="7",n.EIGHT="8",n.NINE="9",n.BACKSPACE="Backspace",n.ESCAPE="Escape",n.ENTER="Enter",n.DELETE="Delete",n.SLASH="/",n.QUESTION_MARK="?",n.BACKSLASH="\\",n.PIPE="|",n.MINUS="-",n.UNDERSCORE="_",n.EQUALS="=",n.PLUS="+",n.BACKTICK="`",n.TILDE="~",n.COMMA=",",n.LEFT_CHEVRON="<",n.PERIOD=".",n.RIGHT_CHEVRON=">",n.SEMICOLON=";",n.COLON=":",n.SINGLE_QUOTE="'",n.DOUBLE_QUOTE='"',n.LEFT_BRACKET="[",n.RIGHT_BRACKET="]",n.LEFT_CURLY="{",n.RIGHT_CURLY="}",n.F1="F1",n.F2="F2",n.F3="F3",n.F4="F4",n.F5="F5",n.F6="F6",n.F7="F7",n.F8="F8",n.F9="F9",n.F10="F10",n.F11="F11",n.F12="F12"})(x||(x={}));var Sh=new Set([x.ENTER,x.DELETE,x.F1,x.F2,x.F3,x.F4,x.F5,x.F6,x.F7,x.F8,x.F9,x.F10,x.F11,x.F12]);class pe extends za{static isAllowedKey(e){return Object.values(x).includes(e)}static isValidKeyState(e){var{keyValue:t}=e;if(t===null)return!0;if(!pe.isMacPlatform&&e.metaKey||!pe.isAllowedKey(t))return!1;var r=!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey;return!r||Sh.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 L.CTRL:t.ctrlKey=!0;break;case L.ALT:case L.OPTION:t.altKey=!0;break;case L.CMD:t.metaKey=!0;break;case L.SHIFT:t.shiftKey=!0;break}}),t}static getKeyStateFromEvent(e){var{key:t,keyCode:r}=e,i="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?i="":!pe.isAllowedKey(t)&&pe.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===x.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 x.ENTER:t+="⏎";break;case x.ESCAPE:t+="⎋";break;case x.BACKSPACE:t+="⌫";break;case x.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?"":pe.isMacPlatform?pe.getMacDisplayText(e):pe.getWindowsDisplayText(e)}constructor(e){var{id:t,shortcut:r,macShortcut:i,isEditable:o=!0,name:a,tooltip:s}=e;super(),Bt(this,"id",void 0),Bt(this,"name",void 0),Bt(this,"tooltip",void 0),Bt(this,"isEditable",void 0),Bt(this,"defaultKeyState",void 0),Bt(this,"keyState",void 0),this.id=t,this.name=a,this.tooltip=s,this.isEditable=o;var l=pe.isMacPlatform,d=l?i:r;this.defaultKeyState=pe.createKeyState(d),this.keyState=this.defaultKeyState}getDisplayText(){return pe.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){pe.isValidKeyState(e)?(mo.debug2("Shortcut ".concat(this.id," updated to ").concat(JSON.stringify(e))),this.keyState=e,this.dispatchEvent(new vs("onUpdate",{detail:this}))):mo.debug2("Shortcut ".concat(this.id," tried to update to invalid keyState ").concat(JSON.stringify(e)))}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return pe.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(pe.NULL_KEY_STATE)}isNull(){return pe.doKeyStatesMatch(this.keyState,pe.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return pe.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(pe.getKeyStateFromEvent(e))}}Bt(pe,"NULL_KEY_STATE",{metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null});Bt(pe,"isMacPlatform",Ye.isMacPlatform());function fo(n,e,t){return e=wh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wh(n){var e=Eh(n,"string");return typeof e=="symbol"?e:String(e)}function Eh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var vo=W.module("ShortcutRegistry");class _h extends za{constructor(){super(...arguments),fo(this,"shortcutMap",new Map),fo(this,"shortcutsByCategory",new Map)}createAndAdd(e){var t=new pe(e);return this.add(t)}add(e){var t=this.shortcutMap.get(e.id);if(t)return vo.warn("Skipping attempt to add duplicate shortcut ID to registry: ".concat(e.id)),t;vo.debug2("Adding shortcut to registry: ".concat(e.id)),e.addEventListener("onUpdate",o=>{var{detail:a}=o;return this.dispatchEvent(new vs("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 Ph=Object.freeze(new _h);const ce=Ph;var Th={COPY:ce.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[L.CTRL,x.C],macShortcut:[L.CMD,x.C],isEditable:!1}),PASTE:ce.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[L.CTRL,x.V],macShortcut:[L.CMD,x.V],isEditable:!1}),SAVE:ce.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[L.CTRL,x.S],macShortcut:[L.CMD,x.S],isEditable:!1}),SELECT_ALL:ce.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[L.CTRL,x.A],macShortcut:[L.CMD,x.A],isEditable:!1}),REOPEN_CLOSED_PANEL:ce.createAndAdd({id:"GLOBAL.REOPEN_CLOSED_PANEL",name:"Re-open Closed Panel",shortcut:[L.ALT,L.SHIFT,x.T],macShortcut:[L.OPTION,L.SHIFT,x.T],isEditable:!0}),LINKER:ce.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[L.CTRL,x.L],macShortcut:[L.CMD,x.L]}),LINKER_CLOSE:ce.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[x.ESCAPE],macShortcut:[x.ESCAPE],isEditable:!1}),COPY_VERSION_INFO:ce.createAndAdd({id:"GLOBAL.COPY_VERSION_INFO",name:"Copy Version Info",shortcut:[L.CTRL,L.ALT,x.I],macShortcut:[L.CMD,L.SHIFT,x.I],isEditable:!0}),NEXT:ce.createAndAdd({id:"GLOBAL.NEXT",name:"Next",shortcut:[x.ENTER],macShortcut:[x.ENTER],isEditable:!1}),PREVIOUS:ce.createAndAdd({id:"GLOBAL.PREVIOUS",name:"Previous",shortcut:[L.SHIFT,x.ENTER],macShortcut:[L.SHIFT,x.ENTER],isEditable:!1})};const Gt=Th;function ci(n,e,t){return e=Oh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Oh(n){var e=Ih(n,"string");return typeof e=="symbol"?e:String(e)}function Ih(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ds extends m.PureComponent{constructor(e){super(e),ci(this,"inputField",void 0),ci(this,"searchChangeSelection",void 0),this.inputField=j.createRef(),this.searchChangeSelection=j.createRef()}componentDidMount(){this.setInputPaddingRight()}componentDidUpdate(){this.setInputPaddingRight()}focus(){var e;(e=this.inputField.current)===null||e===void 0||e.focus()}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{value:e,placeholder:t,onBlur:r,onChange:i,className:o,disabled:a,matchCount:s,id:l,onKeyDown:d,"data-testid":h,cursor:c}=this.props,f,v=[{action:()=>c?.next("forward"),shortcut:Gt.NEXT},{action:()=>c?.next("back"),shortcut:Gt.PREVIOUS}];return c&&s>1?f=u.jsxs(u.Fragment,{children:[u.jsx(Tn,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{c.next("back")},icon:es,tooltip:"Previous match (".concat(Gt.PREVIOUS.getDisplayText(),")")}),u.jsxs("span",{className:"search-change-text",children:[c.index!==void 0&&"".concat(c.index+1," of "),s]}),u.jsx(Tn,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{c.next("forward")},icon:md,tooltip:"Next match (".concat(Gt.NEXT.getDisplayText(),")")})]}):f=s>0&&u.jsx("span",{className:"search-match",children:s}),u.jsxs("div",{className:X("search-group",o),children:[u.jsx("input",{type:"search",value:e,onBlur:r,onChange:i,onKeyDown:d,className:"form-control",disabled:a,placeholder:t,ref:this.inputField,id:l,"data-testid":h}),s!=null?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"search-change-selection",ref:this.searchChangeSelection,children:f}),u.jsx(ee,{actions:v})]}):u.jsx("span",{className:"search-icon",children:u.jsx(ue,{icon:fd})})]})}}ci(Ds,"defaultProps",{placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0,cursor:void 0});const Ni=Ds;function xs(n,e,t){return e=Dh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Dh(n){var e=xh(n,"string");return typeof e=="symbol"?e:String(e)}function xh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ms extends m.PureComponent{constructor(e){super(e),xs(this,"searchInput",void 0),this.searchInput=j.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=On(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){var{value:t}=this.props;e.value!==t&&this.setState({value:t})}focus(){var e;(e=this.searchInput.current)===null||e===void 0||e.focus()}handleChange(e){this.setState({value:e.target.value},this.sendUpdate)}sendUpdate(){var{onChange:e}=this.props,{value:t}=this.state;e(t)}render(){var{placeholder:e,className:t,matchCount:r,id:i,"data-testid":o}=this.props,{value:a}=this.state;return u.jsx(Ni,{value:a,placeholder:e,onChange:this.handleChange,className:t,matchCount:r,ref:this.searchInput,id:i,"data-testid":o})}}xs(Ms,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});const Mh=Ms;function Ns(n,e,t){return e=Nh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Nh(n){var e=Ah(n,"string");return typeof e=="symbol"?e:String(e)}function Ah(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Lh=W.module("ItemListItem");class Ur extends m.Component{static handleKeyDown(){return Lh.log("ItemListItem.handleKeyDown false"),!1}constructor(e){super(e),Ns(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=j.createRef()}handleBlur(e){var{itemIndex:t,onBlur:r}=this.props;r(t,e)}handleFocus(e){var{itemIndex:t,onFocus:r}=this.props;r(t,e)}handleClick(e){var{itemIndex:t,onClick:r}=this.props;r(t,e)}handleContextMenu(e){var{itemIndex:t,onContextMenu:r}=this.props;r(t,e)}handleDragStart(e){var{itemIndex:t,onDragStart:r}=this.props;r(t,e)}handleDrag(e){var{itemIndex:t,onDrag:r}=this.props;r(t,e)}handleDragOver(e){e.preventDefault();var{itemIndex:t,onDragOver:r}=this.props;r(t,e)}handleDragEnd(e){var{itemIndex:t,onDragEnd:r}=this.props;r(t,e)}handleDrop(e){var{itemIndex:t,onDrop:r}=this.props;r(t,e)}handleDoubleClick(e){var{itemIndex:t,onDoubleClick:r}=this.props;r(t,e)}handleMouseMove(e){var{itemIndex:t,onMouseMove:r}=this.props;r(t,e)}handleMouseDown(e){var{itemIndex:t,onMouseDown:r}=this.props;r(t,e)}handleMouseUp(e){var{itemIndex:t,onMouseUp:r}=this.props;r(t,e)}render(){var{isDraggable:e,isFocused:t,isSelected:r,style:i,children:o,"data-testid":a}=this.props;return u.jsx("div",{className:X("item-list-item",{active:r},{"is-focused":t},{"is-draggable":e}),onKeyDown:Ur.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:i,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:e,"data-testid":a,children:o})}}Ns(Ur,"defaultProps",{children:null,isDraggable:!1,isFocused:!1,isSelected:!1,itemIndex:0,"data-testid":void 0,onBlur(){},onClick(){},onContextMenu(){},onDragStart(){},onDrag(){},onDragOver(){},onDragEnd(){},onDrop(){},onDoubleClick(){},onFocus(){},onMouseDown(){},onMouseMove(){},onMouseUp(){},style:{}});const Fh=Ur;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 po(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){ot(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 ot(n,e,t){return e=Rh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Rh(n){var e=kh(n,"string");return typeof e=="symbol"?e:String(e)}function kh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var bo=W.module("ItemList"),yo=5;class Qe extends m.PureComponent{static renderItem(e){var t,r,{item:i}=e;return u.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),ot(this,"list",void 0),ot(this,"listContainer",void 0),ot(this,"getItemSelected",Cn((i,o)=>xt.isSelected(o,i),{max:Qe.CACHE_SIZE})),ot(this,"getCachedItem",Cn((i,o,a,s,l,d,h,c)=>{var f=d({item:a,itemIndex:i,isFocused:s,isSelected:l,style:h});return u.jsx(Fh,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:c,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:s,isSelected:l,itemIndex:i,style:h,children:f},o)},{max:Qe.CACHE_SIZE})),ot(this,"getOuterElement",Cn(i=>{var o=j.forwardRef((a,s)=>u.jsx("div",po({ref:s,tabIndex:-1,onKeyDown:i,role:"presentation"},a)));return o.displayName="ItemListOuterElement",o})),ot(this,"getInnerElement",Cn(()=>{var i=j.forwardRef((o,a)=>u.jsx("div",po({className:"item-list-inner-element",ref:a},o)));return i.displayName="ItemListInnerElement",i})),ot(this,"getItemData",Cn((i,o,a)=>({items:i,selectedRanges:o,renderItem:a}))),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=j.createRef(),this.listContainer=j.createRef();var{isStickyBottom:t,selectedRanges:r}=e;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{selectedRanges:r,itemCount:i}=this.props,{focusIndex:o,isStuckToBottom:a,scrollOffset:s,height:l,selectedRanges:d}=this.state;if(a&&!this.isListAtBottom()&&i>0&&this.scrollToBottom(),(s!==t.scrollOffset||l!==t.height)&&this.sendViewportUpdate(),r!==e.selectedRanges&&r!==d)this.setSelectedRanges(r);else if(d!==t.selectedRanges){var{onSelectionChange:h}=this.props;h(d)}if(o!==t.focusIndex){var{onFocusChange:c}=this.props;c(o)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var e;(e=this.listContainer.current)===null||e===void 0||e.focus()}restoreScrollPosition(){var{scrollOffset:e}=this.state;if(e!=null){var t;(t=this.listContainer.current)===null||t===void 0||t.scrollTo(0,e)}}getElement(e){if(this.listContainer.current==null)return null;var{focusSelector:t}=this.props,{overscanStartIndex:r}=this.state,i=this.listContainer.current.querySelectorAll(t),o=e-r;return i[o]}focusItem(e){var{disableSelect:t}=this.props;if(!t){this.setState({focusIndex:e});var r=this.getElement(e);r instanceof HTMLElement&&r.focus()}}scrollToItem(e){var t=this.getElement(e);t?.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){this.setState({focusIndex:e});var{selectedRanges:r}=this.state,i=xt.isSelected(r,e),o=i||Ye.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,o,!1)}handleItemDoubleClick(e,t){var{isDoubleClickSelect:r,onSelect:i}=this.props;r&&this.setState(o=>{var{selectedRanges:a}=o;return{selectedRanges:xt.selectRange(a,[e,e])}},()=>{i(e,t)})}handleItemMouseDown(e,t){var{selectedRanges:r}=this.state;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){bo.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){bo.debug2("item focus",e,t.target),this.setState(r=>{var{focusIndex:i}=r;return i!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){var{isDragSelect:r,isMultiSelect:i,disableSelect:o}=this.props,{mouseDownIndex:a,selectedRanges:s,mouseX:l,mouseY:d}=this.state;if(!(a==null||o)){var h=Math.abs(t.clientX-(l??0)),c=Math.abs(t.clientY-(d??0));h>yo&&c>yo&&this.setState({isDragging:!0}),(r||a===e)&&(this.focusItem(e),i?(!r&&!this.getItemSelected(e,s)&&!Ye.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(a,e),Math.max(a,e)])):this.toggleSelect(e,t.shiftKey,Ye.isModifierKeyDown(t),!1))}}handleItemMouseUp(e,t){var{isDeselectOnClick:r,isDoubleClickSelect:i,onSelect:o}=this.props,{mouseDownIndex:a,isDragging:s}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(a===e&&!s){var l=t.shiftKey,d=Ye.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,l,d,r),!i&&!l&&!d&&o(e,t)}this.resetMouseState()}}handleItemsRendered(e){var{overscanStartIndex:t}=e;this.setState({overscanStartIndex:t})}handleResize(e){var{height:t}=e;this.setState({height:t})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(e){var{isMultiSelect:t,itemCount:r,onSelect:i}=this.props,{focusIndex:o}=this.state,a=o;if(e.key==="Enter"||e.key===" "){!t&&a!=null&&this.setState({selectedRanges:[[a,a]]},()=>{a!=null&&i(a,e)});return}if(e.key==="ArrowUp")a!=null&&a>=0?a=Math.max(0,a-1):a=r-1;else if(e.key==="ArrowDown")a!=null&&a>=0?a=Math.min(a+1,r-1):a=0;else return;if(o!==a){e.stopPropagation(),e.preventDefault(),this.focusItem(a);var{selectedRanges:s}=this.state;if(e.shiftKey&&s.length>0){var l=s[s.length-1];this.selectRange([Math.min(a,l[0]),Math.max(a,l[1])])}else if(this.deselectAll(),a!==null)this.selectItem(a);else{var d;(d=this.listContainer.current)===null||d===void 0||d.focus()}this.scrollIntoView(a)}}handleScroll(e){var{scrollUpdateWasRequested:t,scrollOffset:r}=e;this.setState(i=>{if(t)return{scrollOffset:r};var{isStickyBottom:o}=this.props,{height:a}=i,s=o&&this.isListAtBottom({scrollOffset:r,height:a});return{isStuckToBottom:s,scrollOffset:r}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){var{itemCount:e}=this.props;this.list.current&&this.list.current.scrollToItem(e)}scrollIntoView(e){this.list.current&&this.list.current.scrollToItem(e)}toggleSelect(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,{isMultiSelect:o}=this.props,{selectedRanges:a}=this.state;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{itemCount:e}=this.props;this.deselectRange([0,e])}deselectItem(e){this.deselectRange([e,e])}deselectRange(e){xt.validateRange(e),this.setState(t=>{var{selectedRanges:r}=t;return{selectedRanges:xt.deselectRange(r,e)}})}selectItem(e){var{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){xt.validateRange(e),this.setState(t=>{var{selectedRanges:r}=t;return{selectedRanges:xt.selectRange(r,e)}})}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){var{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){var{onViewportChange:r,rowHeight:i}=this.props,o=Math.floor(e/i),a=o+Math.ceil(t/i);r(o,a)}}isListAtBottom(){var{scrollOffset:e,height:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.state;if(t==null||e==null)return!1;var{itemCount:r,rowHeight:i}=this.props;return e+t>=r*i}renderInnerElement(e){var{index:t,style:r}=e,{items:i,offset:o,renderItem:a,disableSelect:s}=this.props,{focusIndex:l,selectedRanges:d}=this.state;if(t<o||t>=o+i.length)return null;var h=i[t-o];return this.getCachedItem(t,t,h,t===l&&!s,this.getItemSelected(t,d),a,r,s)}render(){var{items:e,itemCount:t,overscanCount:r,renderItem:i,rowHeight:o,"data-testid":a}=this.props,{selectedRanges:s,isStuckToBottom:l}=this.state;return u.jsx(Xl,{className:"item-list-auto-sizer",onResize:this.handleResize,children:d=>{var{width:h,height:c}=d;return u.jsx(Yl,{className:"item-list-scroll-pane",height:c,width:h,initialScrollOffset:l?t*o:0,itemCount:t,itemSize:o,itemData:this.getItemData(e,s,i),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:r,"data-testid":a,children:this.renderInnerElement})}})}}ot(Qe,"CACHE_SIZE",1e3);ot(Qe,"DEFAULT_ROW_HEIGHT",20);ot(Qe,"DEFAULT_OVERSCAN",10);ot(Qe,"defaultProps",{offset:0,items:[],rowHeight:Qe.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Qe.DEFAULT_OVERSCAN,renderItem:Qe.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0});var jh=W.module("ErrorBoundary");class $h extends m.Component{static getDerivedStateFromError(e){return{error:e}}constructor(e){super(e),this.state={error:void 0}}componentDidCatch(e,t){var{onError:r}=this.props;jh.error("Error caught by ErrorBoundary",e,t),r?.(e,t)}render(){var{children:e,className:t,fallback:r}=this.props,{error:i}=this.state;return i!=null?r??u.jsx("div",{className:t,children:u.jsx(hn,{errorMessage:"".concat(i),isLoading:!1,isLoaded:!1})}):e}}function Hh(n){var{on:e,id:t,className:r,isInvalid:i,disabled:o=!1,onClick:a,"data-testid":s}=n;return u.jsx("button",{type:"button",className:X("btn","btn-switch",r,{active:e},{"is-invalid":i}),id:t,onClick:a,disabled:o,"data-testid":s,children:u.jsx("div",{className:"handle"})})}var Bh=["className","timeout"];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 Wh(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){Uh(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 Uh(n,e,t){return e=Vh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Vh(n){var e=Kh(n,"string");return typeof e=="symbol"?e:String(e)}function Kh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function zh(n,e){if(n==null)return{};var t=Gh(n,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function Gh(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function Jy(n){var{className:e,timeout:t=Za.transitionMs}=n,r=zh(n,Bh);return u.jsx(Ka,Wh({timeout:t,classNames:X("fade",e)},r))}var qh=["children","className","isInvalid","onChange","data-testid"];function So(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 wo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?So(Object(t),!0).forEach(function(r){Zh(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):So(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Zh(n,e,t){return e=Xh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xh(n){var e=Yh(n,"string");return typeof e=="symbol"?e:String(e)}function Yh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Qh(n,e){if(n==null)return{};var t=Jh(n,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function Jh(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var As=j.forwardRef((n,e)=>{var{children:t,className:r,isInvalid:i,onChange:o,"data-testid":a}=n,s=Qh(n,qh),l=Ss(e),d=m.useCallback(h=>{o(h.target.value)},[o]);return u.jsx("select",wo(wo({ref:l,className:X("custom-select",r,{"is-invalid":i}),onChange:d,"data-testid":a},s),{},{children:t}))});As.displayName="Select";const ec=As;function tc(){return rr(vd,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function Ls(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.name!=null}function Fs(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.id!=null}function eC(n){return Ls(n)||Fs(n)}var nc=m.createContext(null);function tC(n){if(Fs(n))return{id:n.id,type:n.type};if(Ls(n)){var e;return{name:(e=n.name)!==null&&e!==void 0?e:"",type:n.type}}throw new Error("Invalid descriptor: ".concat(n))}function rc(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 nC(){return rr(nc,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}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 ic(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){oc(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 oc(n,e,t){return e=ac(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ac(n){var e=sc(n,"string");return typeof e=="symbol"?e:String(e)}function sc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ai=Object.freeze({}),lc=new Map,rC=n=>n.api,iC=n=>n.user,Rs=n=>n.storage,ks=n=>Rs(n).commandHistoryStorage,js=n=>Rs(n).fileStorage,dc=n=>n.defaultWorkspaceSettings,$s=n=>{var{workspace:e}=n;return e},Ve=Ql(n=>{for(var e,t,r=(e=(t=$s(n))===null||t===void 0?void 0:t.data.settings)!==null&&e!==void 0?e:{},i=ic({},dc(n)),o=Object.keys(r),a=0;a<o.length;a+=1){var s=o[a];r[s]!==void 0&&(i[s]=r[s])}return i}),oC=n=>n.defaultWorkspaceSettings,aC=n=>Ve(n).defaultDateTimeFormat,sC=n=>{var e;return(e=Ve(n).defaultDecimalFormatOptions)!==null&&e!==void 0?e:Ai},lC=n=>{var e;return(e=Ve(n).defaultIntegerFormatOptions)!==null&&e!==void 0?e:Ai},dC=n=>{var e;return(e=Ve(n).formatter)!==null&&e!==void 0?e:[]},uc=n=>Ve(n).timeZone,uC=n=>Ve(n).showTimeZone,hC=n=>Ve(n).showTSeparator,cC=n=>Ve(n).truncateNumbersWithPound,mC=n=>Ve(n).showEmptyStrings,fC=n=>Ve(n).showNullStrings,vC=n=>Ve(n).shortcutOverrides,gC=n=>Ve(n).webgl,pC=n=>Ve(n).webglEditable,hc=n=>{var e;return(e=Ve(n).defaultNotebookSettings)!==null&&e!==void 0?e:Ai},bC=n=>n.activeTool,cc=n=>{var e;return(e=n.plugins)!==null&&e!==void 0?e:lc};function _o(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function en(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_o(Object(t),!0).forEach(function(r){mc(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):_o(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function mc(n,e,t){return e=fc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fc(n){var e=vc(n,"string");return typeof e=="symbol"?e:String(e)}function vc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var yC=n=>({type:yd,payload:n}),CC=n=>({type:Cd,payload:n}),Hs=n=>({type:gd,payload:n}),SC=n=>({type:Sd,payload:n}),wC=n=>({type:wd,payload:n}),EC=n=>({type:Ed,payload:n}),_C=n=>({type:_d,payload:n}),gc=n=>(e,t)=>{e(Hs(n));var{storage:r}=t(),{workspaceStorage:i}=r;return i?.save(n)},pc=n=>(e,t)=>{var{workspace:r}=t(),{data:i}=r??{},o=en(en({},r),{},{data:en(en(en({},i),n),{},{settings:en(en({},i?.settings),n.settings)})});return e(gc(o))},bc=n=>e=>e(pc({settings:n})),PC=n=>({type:pd,payload:n}),TC=n=>({type:bd,payload:n}),OC=n=>({type:Pd,payload:n});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){yc(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 yc(n,e,t){return e=Cc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cc(n){var e=Sc(n,"string");return typeof e=="symbol"?e:String(e)}function Sc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function wc(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,i=arguments.length>1?arguments[1]:void 0;switch(i.type){case n:{var{id:o,payload:a}=i;return t&&Qn({payload:a},{payload:r[o]})?r:To(To({},r),{},{[o]:a})}default:return r}}}function Ec(n){var{type:e}=n,t=tc();switch(e){case t.VariableType.TABLE:case t.VariableType.TABLEMAP:case t.VariableType.TREETABLE:case t.VariableType.HIERARCHICALTABLE:case t.VariableType.PARTITIONEDTABLE:return u.jsx(ue,{icon:rs});case t.VariableType.FIGURE:return u.jsx(ue,{icon:ns});case t.VariableType.PANDAS:return u.jsx(ue,{icon:Td});default:return u.jsx(ue,{icon:ts})}}function Oo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function _c(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Oo(o,r,i,a,s,"next",l)}function s(l){Oo(o,r,i,a,s,"throw",l)}a(void 0)})}}function Bs(n){var{children:e,language:t}=n,[r,i]=m.useState(null),{activeThemes:o}=Es();return m.useEffect(()=>{var a=!1;function s(){return l.apply(this,arguments)}function l(){return l=_c(function*(){if(e!=null&&o!=null){var d=yield ut.colorize(e.toString(),t,{});a||i(d)}}),l.apply(this,arguments)}return s(),()=>{a=!0}},[o,e,t]),u.jsx("div",{style:{pointerEvents:"none"},dangerouslySetInnerHTML:r!=null?{__html:r}:void 0})}class Pc{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}const Ws=Pc;class Dr{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)?[]:Jl.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 Dr.isTableType(e,t)||Dr.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}const mi=Dr;function Us(n){var{children:e}=n;return u.jsxs("div",{className:"console-history-item-result",children:[u.jsx("div",{className:"console-history-gutter",children:"-"}),u.jsx("div",{className:"console-history-content",children:e})]})}Us.propTypes={children:S.node.isRequired};function fi(n,e,t){return e=Tc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Tc(n){var e=Oc(n,"string");return typeof e=="symbol"?e:String(e)}function Oc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Vs extends m.Component{constructor(e){super(e),fi(this,"timer",void 0),fi(this,"startTime",void 0),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer&&clearInterval(this.timer),this.timer=void 0}updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){var{disabled:e,onCancelClick:t}=this.props,{elapsed:r}=this.state;return u.jsx("div",{className:X("console-history-result-in-progress",{disabled:e}),children:u.jsxs("span",{className:"badge",children:[u.jsx(is,{className:"ml-2"}),"Running... ",ys.formatElapsedTime(r)," ",u.jsx(se,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:Od,tooltip:"Cancel",onClick:t,disabled:e})]})})}}fi(Vs,"defaultProps",{disabled:!1});const Ic=Vs;function Yn(n,e,t){return e=Dc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Dc(n){var e=xc(n,"string");return typeof e=="symbol"?e:String(e)}function xc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class In extends m.PureComponent{constructor(e){super(e),Yn(this,"mouseX",void 0),Yn(this,"mouseY",void 0),Yn(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)>=In.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=In.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(e){this.isClicking&&!e.shiftKey&&!e.metaKey&&!e.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(e=>({isExpanded:!e.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){var{isExpanded:e,isTriggerHovered:t}=this.state,{message:r}=this.props;k(r);var i=r.trimEnd(),o=i.indexOf(`
3
3
  `),a=o>-1,s=i;a&&(s=i.slice(0,o));var l=i.slice(o),d=t?"error-btn-link error-btn-link--active":"error-btn-link";return u.jsxs("div",{className:X("error-message",{expanded:e}),children:[a&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"error-gutter",children:u.jsx("button",{type:"button",onClick:this.handleToggleError,className:d,tabIndex:-1,children:u.jsx(ue,{icon:e?Bn:Id,transform:"left-3"})})}),u.jsxs("div",{className:"error-content",children:[u.jsx("div",{className:"console-error-text-trigger",role:"button",tabIndex:0,onKeyPress:this.handleKeyPress,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onMouseUp:this.handleMouseUp,children:s}),e?l:""]})]}),!a&&u.jsx("div",{className:"error-content",children:u.jsx("div",{className:"console-error-text",children:s})})]},"error")}}Yn(In,"defaultProps",{message:""});Yn(In,"mouseDragThreshold",5);const Mc=In;function Nc(n,e,t){return e=Ac(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ac(n){var e=Lc(n,"string");return typeof e=="symbol"?e:String(e)}function Lc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Io=W.module("ConsoleHistoryItem");class Ks extends m.PureComponent{constructor(e){super(e),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){Io.debug("handleObjectClick",e);var{openObject:t}=this.props;t(e)}handleCancelClick(){var{item:e}=this.props;e!=null&&e.cancelResult&&(Io.debug("Cancelling command: ".concat(e.command)),e.cancelResult())}render(){var{disabled:e,item:t,language:r,iconForType:i}=this.props,{disabledObjects:o,result:a}=t,s=t.command!=null&&t.command!=="",l=null;s&&(l=u.jsxs("div",{className:"console-history-item-command",children:[u.jsx("div",{className:"console-history-gutter",children:">"}),u.jsx("div",{className:"console-history-content",children:u.jsx(Bs,{language:r,children:t.command})})]}));var d=[],h=!1;if(a){var{error:c,message:f,changes:v}=a;if(v){var{created:p,updated:g}=v;[...p,...g].forEach(Q=>{h=!0;var{title:N}=Q,B="".concat(N),$=e===void 0||e||(o??[]).indexOf(B)>=0,Y=u.jsx(se,{kind:"primary",onClick:()=>this.handleObjectClick(Q),className:"btn-console-object",disabled:$,icon:i(Q.type),children:N},B);d.push(Y)})}if(c!=null&&!s){var y,P="".concat((y=c.message)!==null&&y!==void 0?y:c);P||(P=c);var O=u.jsx(Mc,{message:P},"result-error");d.push(O)}if(f!==void 0&&f!==""){var _=u.jsx("div",{className:"log-message",children:f},"log-message");d.push(_)}}else{h=!0;var R=u.jsx(Ic,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");d.push(R)}var U=null;return d.length>0&&(U=u.jsx(Us,{children:d})),u.jsxs("div",{className:X("console-command-result",{"console-result-buttons":h}),children:[l,U]})}}Nc(Ks,"defaultProps",{disabled:!1});const Fc=Ks;function Rc(n,e){return"".concat(n,".").concat(e.command,".").concat(e.result&&e.result.message,".").concat(e.result&&e.result.error)}var kc=j.forwardRef(function(e,t){for(var{disabled:r=!1,items:i,language:o,openObject:a,supportsType:s,iconForType:l}=e,d=[],h=0;h<i.length;h+=1){var c=i[h],f=u.jsx(Fc,{disabled:r,item:c,openObject:a,language:o,supportsType:s,iconForType:l},Rc(h,c));d.push(f)}return u.jsx("div",{ref:t,className:"container-fluid console-history",children:d})});const jc=kc;var $c={name:"Console",CLEAR:ce.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[L.CTRL,x.L],macShortcut:[L.CTRL,x.C]}),FOCUS_HISTORY:ce.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[L.CTRL,x.H],macShortcut:[L.CTRL,L.OPTION,x.H]})},Hc={name:"Command History",FOCUS_HISTORY:ce.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[L.CTRL,x.H],macShortcut:[L.CTRL,L.OPTION,x.H]}),SEND_TO_CONSOLE:ce.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[x.ENTER],macShortcut:[x.ENTER]}),SEND_TO_NOTEBOOK:ce.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[L.CTRL,x.ENTER],macShortcut:[L.CMD,x.ENTER]}),RUN:ce.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[L.ALT,x.R],macShortcut:[L.OPTION,x.R]})},Bc={name:"Notebook",RUN:ce.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[L.ALT,x.R],macShortcut:[L.OPTION,x.R]}),RUN_SELECTED:ce.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[L.ALT,L.SHIFT,x.R],macShortcut:[L.OPTION,L.SHIFT,x.R]}),FIND:ce.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[L.CTRL,x.F],macShortcut:[L.CMD,x.F],isEditable:!1}),MINIMAP:ce.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[L.ALT,x.M],macShortcut:[L.OPTION,x.M]}),WORDWRAP:ce.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[L.ALT,x.Z],macShortcut:[L.OPTION,x.Z]})},Wc={CONSOLE:$c,COMMAND_HISTORY:Hc,NOTEBOOK:Bc};const ke=Wc,Te=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),Uc="var(--dh-color-editor-bg)",Vc="var(--dh-color-editor-fg)",Kc="var(--dh-color-editor-string)",zc="var(--dh-color-editor-delimiter)",Gc="var(--dh-color-editor-predefined)",qc="var(--dh-color-editor-keyword)",Zc="var(--dh-color-editor-storage)",Xc="var(--dh-color-editor-number)",Yc="var(--dh-color-editor-operator)",Qc="var(--dh-color-editor-identifier)",Jc="var(--dh-color-editor-comment)",vi={"error-foreground":"var(--dh-color-editor-error-fg)",background:Uc,foreground:Vc,"line-height":"19px",string:Kc,"string-delim":"var(--dh-color-editor-string-delim)",delimiter:zc,predefined:Gc,keyword:qc,storage:Zc,number:Xc,operator:Yc,identifier:Qc,"namespace-identifier":"var(--dh-color-editor-identifier-namespace)","identifier-js":"var(--dh-color-editor-identifier-js)",comment:Jc,"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)"};var em="python",tm={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/}}},nm={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"]]}},rm={id:em,conf:tm,language:nm};const im=rm;var om="groovy",am={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/}}},sm={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"]]}},lm={id:om,conf:am,language:sm};const dm=lm;var um="scala",hm={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>))/}}},cm={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"]]}},mm={id:um,conf:hm,language:cm};const fm=mm;var vm="deephavenDb",gm={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/}}},pm={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"]]}},bm={id:vm,conf:gm,language:pm};const ym=bm;var Cm="log",Sm={},wm={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"}]]}},Em={id:Cm,conf:Sm,language:wm};const _m=Em;function Do(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 xo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Do(Object(t),!0).forEach(function(r){Pm(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Do(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Pm(n,e,t){return e=Tm(e),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:String(e)}function Om(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Pt=W.module("MonacoUtils");class Mt{static init(){var{getWorker:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Pt.debug("Initializing Monaco..."),e!==void 0&&Mt.registerGetWorker(e);var{initTheme:t,registerLanguages:r}=Mt;t(),r([ym,im,dm,_m,fm]),Mt.removeConflictingKeybindings(),Pt.debug("Monaco initialized.")}static initTheme(){var e,t,{removeHashtag:r}=Mt,i=os(vi);Pt.debug2("Monaco theme:",vi),Pt.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"]};ut.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:o,colors:a});try{ut.setTheme("dh-dark")}catch(s){Pt.error("Failed to set 'dh-dark' Monaco theme, falling back to vs-dark",s),ut.setTheme("vs-dark")}}static registerGetWorker(e){window.MonacoEnvironment=xo(xo({},window.MonacoEnvironment),{},{getWorker:e})}static removeHashtag(e){var t;return(t=e?.substring(1))!==null&&t!==void 0?t:""}static registerLanguages(e){var t=e.map(r=>{var{id:i}=r;return i});yt.getLanguages().filter(r=>{var{id:i}=r;return t.includes(i)}).forEach(r=>{var i=r;Pt.debug2("Overriding default language loader:",i.id)}),e.forEach(r=>{Mt.registerLanguage(r)})}static registerLanguage(e){Pt.debug2("Registering language: ",e.id),yt.register(e),yt.onLanguage(e.id,()=>{yt.setLanguageConfiguration(e.id,e.conf),yt.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ut.EndOfLineSequence.LF;(t=e.getModel())===null||t===void 0||t.setEOL(r)}static openDocument(e,t){var r=e.getModel();k(r);var i={textDocument:{uri:"".concat(r.uri),languageId:r.getLanguageId(),version:r.getVersionId(),text:r.getValue()}};Pt.debug2("didOpenDocumentParams: ",i),t.openDocument(i);var o=e.onDidChangeModelContent(a=>{for(var{changes:s,versionId:l}=a,d=[],h=0;h<s.length;h+=1){var c=s[h],{range:f,rangeLength:v,text:p}=c,g={range:{start:{line:f.startLineNumber-1,character:f.startColumn-1},end:{line:f.endLineNumber-1,character:f.endColumn-1}},rangeLength:v,text:p};d.push(g)}if(d.length>0){var y={textDocument:{version:l,uri:"".concat(r.uri)},contentChanges:d};Pt.debug2("didChangeDocumentParams",y),t.changeDocument(y)}});return o}static closeDocument(e,t){var r=e.getModel();k(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();k(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{platform:e}=window.navigator;return e.startsWith("Mac")}static removeConflictingKeybindings(){ut.addKeybindingRule({keybinding:Ge.CtrlCmd|Zt.KeyD,command:null}),Mt.isMacPlatform()||ut.addKeybindingRule({keybinding:Ge.CtrlCmd|Zt.KeyH,command:null})}static disableKeyBindings(e,t){e.addAction({id:"disable-keybindings-".concat(At()),label:"",keybindings:t,run:()=>{}})}static getMonacoKeyCodeFromShortcut(e){var{keyState:t}=e,{keyValue:r}=t;if(r===null)return 0;var i=Mt.isMacPlatform();return i?(t.metaKey?Ge.CtrlCmd:0)|(t.shiftKey?Ge.Shift:0)|(t.altKey?Ge.Alt:0)|(t.ctrlKey?Ge.WinCtrl:0)|Qi.fromString(r):(t.ctrlKey?Ge.CtrlCmd:0)|(t.shiftKey?Ge.Shift:0)|(t.altKey?Ge.Alt:0)|(t.metaKey?Ge.WinCtrl:0)|Qi.fromString(r)}static provideLinks(e){for(var t=[],r=function(a){var s=e.getLineContent(a),l=ed(s),d=l.filter(h=>h.type==="url"?/^https?:\/\//.test(h.value):!0);d.forEach(h=>{t.push({url:h.href,range:new Qd(a,h.start+1,a,h.end+1)})})},i=1;i<=e.getLineCount();i+=1)r(i);return{links:t}}}const Xe=Mt;function ei(n,e,t){return e=Im(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Im(n){var e=Dm(n,"string");return typeof e=="symbol"?e:String(e)}function Dm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Tt=W.module("MonacoCompletionProvider");class on extends m.PureComponent{static lspToMonacoKind(e){var t=yt.CompletionItemKind;switch(e){case 1:return t.Text;case 2:return t.Method;case 3:return t.Function;case 4:return t.Constructor;case 5:return t.Field;case 6:return t.Variable;case 7:return t.Class;case 8:return t.Interface;case 9:return t.Module;case 10:return t.Property;case 11:return t.Unit;case 12:return t.Value;case 13:return t.Enum;case 14:return t.Keyword;case 15:return t.Snippet;case 16:return t.Color;case 17:return t.File;case 18:return t.Reference;case 19:return t.Folder;case 20:return t.EnumMember;case 21:return t.Constant;case 22:return t.Struct;case 23:return t.Event;case 24:return t.Operator;case 25:return t.TypeParameter;default:return t.Variable}}static lspToMonacoRange(e){var{start:t,end:r}=e;return{startLineNumber:t.line+1,startColumn:t.character+1,endLineNumber:r.line+1,endColumn:r.character+1}}static monacoToLspPosition(e){return{line:e.lineNumber-1,character:e.column-1}}constructor(e){super(e),ei(this,"registeredCompletionProvider",void 0),ei(this,"registeredSignatureProvider",void 0),ei(this,"registeredHoverProvider",void 0),this.handleCompletionRequest=this.handleCompletionRequest.bind(this),this.handleSignatureRequest=this.handleSignatureRequest.bind(this),this.handleHoverRequest=this.handleHoverRequest.bind(this)}componentDidMount(){var{language:e,session:t}=this.props;this.registeredCompletionProvider=yt.registerCompletionItemProvider(e,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),t.getSignatureHelp!=null&&(this.registeredSignatureProvider=yt.registerSignatureHelpProvider(e,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),t.getHover!=null&&(this.registeredHoverProvider=yt.registerHoverProvider(e,{provideHover:this.handleHoverRequest}))}componentWillUnmount(){var e,t,r;(e=this.registeredCompletionProvider)===null||e===void 0||e.dispose(),(t=this.registeredSignatureProvider)===null||t===void 0||t.dispose(),(r=this.registeredHoverProvider)===null||r===void 0||r.dispose()}handleCompletionRequest(e,t,r){var{model:i,session:o}=this.props;if(e!==i)return null;var a={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:on.monacoToLspPosition(t),context:r},s=o.getCompletionItems(a);Tt.debug("Requested completion items",a);var l=s.then(d=>{Tt.debug("Completion items received: ",a,d);var h=d.map(c=>{var{label:f,kind:v,detail:p,documentation:g,sortText:y,filterText:P,textEdit:O,insertTextFormat:_}=c;return{label:f,kind:on.lspToMonacoKind(v),detail:p,documentation:g?.kind==="markdown"?g:g?.value,sortText:y,filterText:P,insertText:O.text,insertTextRules:_===2?4:_,range:on.lspToMonacoRange(O.range)}});return{incomplete:!0,suggestions:h}}).catch(d=>(Tt.error("There was an error retrieving completion items",d),{suggestions:[]}));return l}handleSignatureRequest(e,t,r,i){var o={value:{signatures:[],activeSignature:0,activeParameter:0},dispose:()=>{}},{model:a,session:s}=this.props;if(e!==a||s.getSignatureHelp==null)return null;var l={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:on.monacoToLspPosition(t),context:i},d=s.getSignatureHelp(l);Tt.debug("Requested signature help",l);var h=d.then(c=>{Tt.debug("Signatures received: ",l,d);var f=c.map(p=>{var{label:g,documentation:y,parameters:P}=p;return{documentation:y?.kind==="markdown"?y:y?.value,label:g,parameters:P??[]}});if(f.length===0)return o;var v=0;return{value:{signatures:f,activeSignature:v,activeParameter:c[v].activeParameter},dispose:()=>{}}}).catch(c=>(Tt.error("There was an error retrieving completion items",c),o));return h}handleHoverRequest(e,t){var{model:r,session:i}=this.props;if(e!==r||i.getHover==null)return null;var o={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:on.monacoToLspPosition(t)},a=i.getHover(o);Tt.debug("Requested hover",o);var s=a.then(l=>{Tt.debug("Hover received: ",o,l);var{contents:d}=l;return{contents:d!=null?[d]:[]}}).catch(l=>(Tt.error("There was an error retrieving hover",l),{contents:[]}));return s}render(){return null}}const zs=on;function Mo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function xm(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Mo(o,r,i,a,s,"next",l)}function s(l){Mo(o,r,i,a,s,"throw",l)}a(void 0)})}}function ze(n,e,t){return e=Mm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mm(n){var e=Nm(n,"string");return typeof e=="symbol"?e:String(e)}function Nm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ti=W.module("ConsoleInput"),xr=parseInt(vi["line-height"],10),Gs=6,qs=6,Am=xr+Gs+qs,ni=100;class ir extends m.PureComponent{constructor(e){super(e),ze(this,"cancelListener",void 0),ze(this,"resizeObserver",void 0),ze(this,"commandContainer",void 0),ze(this,"commandEditor",void 0),ze(this,"commandHistoryIndex",void 0),ze(this,"commandSuggestionContainer",void 0),ze(this,"loadingPromise",void 0),ze(this,"timestamp",void 0),ze(this,"bufferIndex",void 0),ze(this,"history",void 0),ze(this,"modifiedCommands",void 0),this.handleResize=this.handleResize.bind(this),this.commandContainer=j.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:xr,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(ti.debug("Command received: ",e),!r){var i;this.commandHistoryIndex=null,(i=this.commandEditor)===null||i===void 0||i.setValue(e)}t&&this.focusEnd(),this.updateDimensions(),r&&this.processCommand(e)}}initCommandEditor(){var{language:e,session:t}=this.props,r={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:xr,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:Gs,bottom:qs},value:"",wordWrap:"on",autoClosingBrackets:"beforeWhitespace"},i=this.commandContainer.current;k(i),this.commandEditor=ut.create(i,r),Xe.setEOL(this.commandEditor),Xe.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{var o,a=(o=this.commandEditor)===null||o===void 0?void 0:o.getValue();this.modifiedCommands.set(this.commandHistoryIndex,a??null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(o=>{var{commandEditor:a,commandHistoryIndex:s}=this,l=a?.getPosition();k(l);var{lineNumber:d}=l,h=a?.getModel();if(o.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&d===1){s!=null?this.loadCommand(s+1):this.loadCommand(0),this.focusStart(),o.stopPropagation(),o.preventDefault();return}if(o.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&d===h?.getLineCount()){s!=null&&s>0?this.loadCommand(s-1):this.loadCommand(null),this.focusEnd(),o.stopPropagation(),o.preventDefault();return}if(!o.altKey&&!o.shiftKey&&!o.metaKey&&o.keyCode===Zt.Enter&&!this.isSuggestionMenuPopulated()){var c;o.stopPropagation(),o.preventDefault();var f=(c=this.commandEditor)===null||c===void 0?void 0:c.getValue().trim();if(f!==void 0){var v;this.processCommand(f),(v=this.commandEditor)===null||v===void 0||v.setValue("")}}}),Xe.disableKeyBindings(this.commandEditor,[Ge.CtrlCmd|Zt.KeyF]),Xe.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.resizeObserver.observe(i),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){var{session:e}=this.props;this.commandEditor&&(Xe.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleResize(){this.updateDimensions()}isSuggestionMenuActive(){var e;if(!this.commandSuggestionContainer){var t,r;this.commandSuggestionContainer=(t=this.commandEditor)===null||t===void 0||(r=t.getDomNode())===null||r===void 0?void 0:r.querySelector(".suggest-widget")}return(e=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!==null&&e!==void 0?e:!1}isSuggestionMenuPopulated(){var e,t,r;return this.isSuggestionMenuActive()&&((e=(t=this.commandSuggestionContainer)===null||t===void 0||(r=t.querySelector(".monaco-list-rows"))===null||r===void 0?void 0:r.childElementCount)!==null&&e!==void 0?e:0)>0}focus(){var e;(e=this.commandEditor)===null||e===void 0||e.focus()}focusStart(){var e,t,r,i,o,a=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();k(a);var s=a.getLineLength(1)+1,l=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(1,s);k(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();k(a);var s=a.getLineCount(),l=a.getLineLength(s)+1,d=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(s,l);k(d),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:s,column:l}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(d),(o=this.commandEditor)===null||o===void 0||o.focus()}clear(){var e,t,r;(e=this.commandEditor)===null||e===void 0||e.focus(),(t=this.commandEditor)===null||t===void 0||(r=t.getModel())===null||r===void 0||r.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var t,r;if(!(e!==null&&e>=this.history.length)){var i=this.modifiedCommands.get(e),o=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,(t=this.commandEditor)===null||t===void 0||(r=t.getModel())===null||r===void 0||r.setValue(i??o),e!==null&&e>this.history.length-ni&&this.loadMoreHistory()}}loadMoreHistory(){var e=this;return xm(function*(){try{if(e.loadingPromise!=null||e.bufferIndex==null)return;var{commandHistoryStorage:t,language:r,scope:i}=e.props;e.loadingPromise=Ee.makeCancelable(t.getTable(r,i??"",e.timestamp),s=>s.close());var o=yield e.loadingPromise;o.setReversed(!0),o.setViewport({top:e.bufferIndex,bottom:e.bufferIndex+ni-1}),e.loadingPromise=Ee.makeCancelable(o.getViewportData(),()=>o.close());var a=yield e.loadingPromise;e.bufferIndex+=ni,e.bufferIndex>=o.size&&(e.bufferIndex=null),e.history=[...a.items.filter((s,l,d)=>{var{name:h}=s;return l===0||h!==d[l-1].name}).map(s=>{var{name:l}=s;return l}).reverse(),...e.history],e.loadingPromise=void 0,o.close()}catch(s){if(e.loadingPromise=void 0,Ee.isCanceled(s)){ti.debug2("Promise canceled, not loading history");return}ti.error("Error fetching history",s)}})()}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),k(e),e!==""&&(this.history.length===0||e!==this.history[this.history.length-1])&&this.history.push(e),this.updateDimensions();var{onSubmit:t}=this.props;t(e)}updateDimensions(){if(this.commandEditor){var{maxHeight:e}=this.props;k(e);var t=this.commandEditor.getContentHeight(),r=Math.max(Math.min(t,e),Am),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{disabled:e,language:t,session:r}=this.props,{commandEditorHeight:i,isFocused:o,model:a}=this.state;return u.jsx("div",{className:X("console-input-wrapper",{disabled:e}),children:u.jsxs("div",{className:X("console-input-inner-wrapper",{focus:o}),children:[u.jsx("div",{className:ir.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:i}}),a&&u.jsx(zs,{model:a,language:t,session:r})]})})}}ze(ir,"defaultProps",{maxHeight:xr*10,scope:null,disabled:!1});ze(ir,"INPUT_CLASS_NAME","console-input");const No=ir;function zt(n,e,t){return e=Lm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Lm(n){var e=Fm(n,"string");return typeof e=="symbol"?e:String(e)}function Fm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ao="pasted values",Rm=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],ri=[".csv",".tsv",".tab",".psv",".dsv",".txt"],Lo=[".zip"];class Ct extends m.Component{static isValidDropItem(e){return e!=null&&e.kind==="file"&&!Rm.find(t=>t.test(e.type))}static isValidExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return ri.some(r=>e.endsWith(r))||t&&Lo.some(r=>e.endsWith(r))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===Ao?Zi:e.endsWith(".csv")?Dd:e.endsWith(".zip")?xd:Md}constructor(e){super(e),zt(this,"fileElem",void 0),zt(this,"divElem",void 0),zt(this,"getValidExtensions",St(t=>t?[...ri,...Lo]:[...ri])),zt(this,"getAcceptString",St(t=>this.getValidExtensions(t).join(", "))),zt(this,"getFileTypeErrorString",St(t=>ps.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=j.createRef(),this.divElem=j.createRef(),this.state={selectedFileName:""}}componentDidMount(){var e,t;(e=this.divElem.current)===null||e===void 0||e.addEventListener("paste",this.handlePasteEvent),(t=this.divElem.current)===null||t===void 0||t.focus()}componentWillUnmount(){var e;(e=this.divElem.current)===null||e===void 0||e.removeEventListener("paste",this.handlePasteEvent)}handleSelectFile(){if(this.fileElem.current){var e;this.fileElem.current.value="",(e=this.fileElem.current)===null||e===void 0||e.click()}}handleFiles(e){e.stopPropagation(),e.preventDefault();var{files:t}=e.target;t!=null&&this.handleFile(t[0])}handleDrop(e){var{allowZip:t,clearDragError:r,dragError:i}=this.props;if(e.preventDefault(),e.stopPropagation(),i!=null){r();return}if(!(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)){var o=e.dataTransfer.items[0].getAsFile();k(o),Ct.isValidExtension(o.name,t)?this.handleFile(o):this.setState({dropError:Ct.FILE_TYPE_ERROR})}}unstageFile(e){var{onCancel:t}=this.props;e.stopPropagation(),e.preventDefault(),t(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(e){var{onFileOpened:t}=this.props;t(e),this.setState({selectedFileName:e.name,dropError:void 0})}handleMenuPaste(){var{onPaste:e,onError:t,uploadInProgress:r}=this.props;r||navigator.clipboard.readText().then(i=>{e(i),this.setState({selectedFileName:Ao,dropError:void 0})}).catch(i=>t(i))}handlePasteEvent(e){e.stopPropagation(),e.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){var{uploadInProgress:e}=this.props;return[{title:"Paste",icon:Zi,action:this.handleMenuPaste,shortcut:Gt.PASTE,disabled:e}]}render(){var{allowZip:e,dragError:t,uploadInProgress:r}=this.props,{selectedFileName:i,dropError:o}=this.state,a=t??o,s=this.makeContextMenuItems();return u.jsxs("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:Ct.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[u.jsx(ee,{actions:s}),u.jsx("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!i&&(a===void 0||a==="")&&u.jsxs("div",{className:"message-content",children:[u.jsx("div",{className:"message-icon",children:u.jsx(ue,{icon:Nd})}),u.jsx("label",{children:"Drop file (or paste values) here to import"}),u.jsx("div",{className:"message-small",children:u.jsx("label",{children:"or"})}),u.jsx(se,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),i&&(a===void 0||a==="")&&u.jsxs("div",{className:"selected-content",children:[u.jsx("div",{className:"selected-icon",children:u.jsx(ue,{icon:Ct.getIcon(i)})}),u.jsxs("div",{className:"selected-text",children:[u.jsx("label",{children:"Selected File"}),u.jsxs("label",{className:"selected-name",children:[i,!r&&u.jsx(se,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:as,tooltip:"Remove"})]})]})]}),!!a&&u.jsxs("div",{className:"message-content",children:[u.jsx("div",{className:"message-icon",children:u.jsx(ue,{icon:ss})}),u.jsx("label",{children:a}),a===Ct.FILE_TYPE_ERROR&&u.jsx("div",{className:"message-small",children:u.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}zt(Ct,"defaultProps",{allowZip:!1,dragError:null});zt(Ct,"MULTIPLE_FILE_ERROR","Please select only one file");zt(Ct,"FILE_TYPE_ERROR","Filetype not supported.");const Sn=Ct;function mn(n,e,t){return e=km(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function km(n){var e=jm(n,"string");return typeof e=="symbol"?e:String(e)}function jm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Yt{}mn(Yt,"INTEGER","int");mn(Yt,"LONG","long");mn(Yt,"DOUBLE","double");mn(Yt,"BOOLEAN","bool");mn(Yt,"STRING","string");mn(Yt,"DATE_TIME","datetime");mn(Yt,"LOCAL_TIME","localtime");const ae=Yt;function Zs(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 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 Ro(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){Fe(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 Fe(n,e,t){return e=$m(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $m(n){var e=Hm(n,"string");return typeof e=="symbol"?e:String(e)}function Hm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ko="unknown",Bm=2147483647,Wm=-2147483648,jo=/^[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]+)?$/,$o=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class De{static determineType(e,t,r){if(!e||e===r)return t;switch(t){case ae.STRING:return ae.STRING;case ae.INTEGER:return De.checkInteger(e);case ae.LONG:return De.checkLong(e);case ae.DOUBLE:return De.checkDouble(e);case ae.BOOLEAN:return De.checkBoolean(e);case ae.DATE_TIME:return De.checkDateTime(e);case ae.LOCAL_TIME:return De.checkLocalTime(e);default:return De.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){var t=e.replace(/,/g,"");return De.isNotParsableNumber(t)?ae.STRING:De.getNumberType(t)}static checkLong(e){var t=e.replace(/,/g,"");return De.isNotParsableNumber(t)?ae.STRING:t.includes(".")?ae.DOUBLE:ae.LONG}static checkDouble(e){var t=e.replace(/,/g,"");return De.isNotParsableNumber(t)?ae.STRING:ae.DOUBLE}static checkBoolean(e){var t=e.toLowerCase();return t==="true"||t==="false"?ae.BOOLEAN:ae.STRING}static checkDateTime(e){return jo.test(e)?ae.DATE_TIME:ae.STRING}static checkLocalTime(e){return $o.test(e)?ae.LOCAL_TIME:ae.STRING}static getTypeFromUnknown(e){var t=e.replace(/,/g,"");if(De.isNotParsableNumber(t)){var r=e.toLowerCase();return r==="true"||r==="false"?ae.BOOLEAN:jo.test(e)&&e.includes(":")?ae.DATE_TIME:$o.test(e)?ae.LOCAL_TIME:ae.STRING}return De.getNumberType(t)}static getNumberType(e){if(e.includes("."))return ae.DOUBLE;var t=e.startsWith("-")?11:10;if(e.length>t)return ae.LONG;var r=parseInt(e,10);return r>Bm||r<Wm?ae.LONG:ae.INTEGER}constructor(e,t,r,i,o,a,s,l,d,h){Fe(this,"onFileCompleted",void 0),Fe(this,"file",void 0),Fe(this,"readHeaders",void 0),Fe(this,"nullString",void 0),Fe(this,"onProgress",void 0),Fe(this,"onError",void 0),Fe(this,"types",void 0),Fe(this,"chunks",void 0),Fe(this,"totalChunks",void 0),Fe(this,"rowCount",void 0),Fe(this,"isZip",void 0),Fe(this,"shouldTrim",void 0),Fe(this,"zipProgress",void 0),Fe(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=d,this.shouldTrim=h,this.zipProgress=0,this.handleChunk=this.handleChunk.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.config=Ro(Ro({},i),{},{error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete})}parse(){if(this.file instanceof File||this.file instanceof Blob)zn.parse(this.file,this.config);else{var e=Zs(this.file,this.handleNodeUpdate);zn.parse(e,this.config),e.resume()}}handleChunk(e,t){var{data:r}=e;if(!this.types){if(r==null||r.length===0){t.abort(),this.onError("Error parsing CSV: no data in file.");return}this.types=new Array(r[0].length).fill(ko),this.readHeaders&&(r=r.slice(1))}this.rowCount+=r.length,k(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]=De.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.
4
4
  Expected length `.concat(i.length," but found ").concat(s.length,`.
@@ -18,5 +18,5 @@ Row = `).concat(s))}),this.chunks+=1;var o=0;this.totalChunks>0?o=Math.round(thi
18
18
  `&&(r+=`
19
19
  `))}}if(r=r.trimRight(),this.editor.setValue(r),t){var s,l=(s=this.editor.getModel())===null||s===void 0?void 0:s.getLineCount();k(l),this.editor.revealLine(l,1)}this.stopFlushTimer(),this.bufferedMessages=[]}}truncateLogIfNecessary(){this.messages.length>be.maxLogSize&&(this.messages=this.messages.splice(this.messages.length-be.truncateSize))}scrollToBottom(){var e,t,r;if(this.editor){var i=(e=this.editor)===null||e===void 0||(t=e.getModel)===null||t===void 0||(r=t.call(e))===null||r===void 0?void 0:r.getLineCount();k(i),this.editor.revealLine(i,1)}}isBottomVisible(){if(!this.editor)return!0;var e=this.editor.getModel(),t=e?.getLineCount();return k(t),this.isLineVisible(t)}isLineVisible(e){var t,r=(t=this.editor)===null||t===void 0?void 0:t.getVisibleRanges();if(r==null||r.length===0)return!1;for(var i=0;i<r.length;i+=1){var o=r[i];if(o.startLineNumber<=e&&e<=o.endLineNumber)return!0}return!1}isLogItemVisible(e){var{shownLogLevels:t}=this.state;return t[e.logLevel]}flush(){for(var e="",t=0;t<this.bufferedMessages.length;t+=1){var r=this.bufferedMessages[t],i=be.getLogText(r);e+=i,i.charAt(i.length-1)!==`
20
20
  `&&(e+=`
21
- `)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,be.bufferTimeout))}stopFlushTimer(){this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=void 0)}updateDimensions(){this.editor&&this.editor.layout()}handleClearClick(){this.clearLogs()}clearLogs(){this.messages=[],this.refreshLogText()}handleFlushTimeout(){this.stopFlushTimer(),this.flush()}handleLogMessage(e){this.messages.push(e),this.editor&&this.isLogItemVisible(e)&&this.queue(e)}handleMenuItemClick(e){this.toggleLogLevel(e)}handleResetClick(){this.resetLogLevels()}handleResize(){this.updateDimensions()}handleToggleAllClick(){this.toggleAll()}render(){var e={placement:"bottom-end"},{shownLogLevels:t}=this.state,r=this.getMenuActions(t);return u.jsxs("div",{className:"log-pane h-100 w-100",children:[u.jsxs("div",{className:"log-pane-menu",children:[u.jsx(se,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:Fd,tooltip:"Clear log"}),u.jsx(se,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:Rd,tooltip:"Log Settings",onClick:()=>{},children:u.jsx(Xn,{actions:r,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),u.jsx("div",{className:"log-pane-editor h-100 w-100",ref:i=>{this.editorContainer=i}})]})}}qe(be,"DefaultLogLevels",[Te.STDOUT,Te.ERROR,Te.FATAL,Te.STDERR,Te.WARN]);qe(be,"AllLogLevels",[Te.INFO,Te.STDOUT,Te.ERROR,Te.FATAL,Te.STDERR,Te.WARN,Te.DEBUG,Te.TRACE]);qe(be,"bufferTimeout",16);qe(be,"maxLogSize",131072);qe(be,"truncateSize",65536);const kf=be;function Fi(n,e,t){return e=jf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jf(n){var e=$f(n,"string");return typeof e=="symbol"?e:String(e)}function $f(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class zr{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""}}Fi(zr,"TYPE_GLOBAL","type-global");Fi(zr,"TYPE_CONTEXT_PRESET","type-context-preset");Fi(zr,"TYPE_CONTEXT_CUSTOM","type-context-custom");const Ue=zr;class Hf extends Ue{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}const Bf=Hf;class Wf extends Ue{format(e){return String.fromCharCode(e)}}const Uf=Wf;function Wt(n,e,t){return e=Vf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Vf(n){var e=Kf(n,"string");return typeof e=="symbol"?e:String(e)}function Kf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Yo=W.module("DateTimeColumnFormatter");class ht extends Ue{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]:Ue.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=ht.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=ht.makeFormatStringMap(e,t);return[...r.keys()]}constructor(e){var{timeZone:t="",showTimeZone:r=!0,showTSeparator:i=!1,defaultDateTimeFormatString:o=ht.DEFAULT_DATETIME_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Wt(this,"dh",void 0),Wt(this,"dhTimeZone",void 0),Wt(this,"defaultDateTimeFormatString",void 0),Wt(this,"showTimeZone",void 0),Wt(this,"showTSeparator",void 0),Wt(this,"formatStringMap",void 0);var a=t||ht.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(a)}catch{Yo.error("Unsupported time zone id",a),this.dhTimeZone=e.i18n.TimeZone.getTimeZone(ht.DEFAULT_TIME_ZONE_ID)}this.dh=e,this.defaultDateTimeFormatString=o,this.showTimeZone=r,this.showTSeparator=i,this.formatStringMap=ht.makeFormatStringMap(r,i)}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{Yo.error("Invalid format arguments")}return""}}Wt(ht,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");Wt(ht,"DEFAULT_TIME_ZONE_ID","America/New_York");function ft(n,e,t){return e=zf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zf(n){var e=Gf(n,"string");return typeof e=="symbol"?e:String(e)}function Gf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var qf=W.module("DecimalColumnFormatter");class ve extends Ue{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]:Ue.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,Ue.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,Ue.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{defaultFormatString:t=ve.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),ft(this,"defaultFormatString",void 0),ft(this,"dh",void 0),this.dh=e,this.defaultFormatString=t}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{qf.error("Invalid format arguments")}return""}}ft(ve,"DEFAULT_FORMAT_STRING","###,##0.0000");ft(ve,"FORMAT_PERCENT",ve.makePresetFormat("Percent","##0.00%"));ft(ve,"FORMAT_BASIS_POINTS",ve.makePresetFormat("Basis Points","###,##0 bp",1e4));ft(ve,"FORMAT_THOUSANDS",ve.makePresetFormat("Thousands","##0.000 k",.001));ft(ve,"FORMAT_MILLIONS",ve.makePresetFormat("Millions","###,##0.000 mm",1e-6));ft(ve,"FORMAT_SCIENTIFIC_NOTATION",ve.makePresetFormat("Scientific Notation","0.0000E0"));ft(ve,"FORMAT_ROUND",ve.makePresetFormat("Round","###,##0"));ft(ve,"FORMAT_ROUND_TWO_DECIMALS",ve.makePresetFormat("0.00","###,##0.00"));ft(ve,"FORMAT_ROUND_FOUR_DECIMALS",ve.makePresetFormat("0.0000","###,##0.0000"));class Zf extends Ue{format(e){return"".concat(e)}}const Xf=Zf;function xn(n,e,t){return e=Yf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yf(n){var e=Qf(n,"string");return typeof e=="symbol"?e:String(e)}function Qf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Jf=W.module("IntegerColumnFormatter");class st extends Ue{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]:Ue.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 st.makeFormat(e,t,Ue.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 st.makeFormat("Custom Format",e,Ue.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{defaultFormatString:t=st.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),xn(this,"dh",void 0),xn(this,"defaultFormatString",void 0),this.dh=e,this.defaultFormatString=t}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{Jf.error("Invalid format arguments")}return""}}xn(st,"DEFAULT_FORMAT_STRING","###,##0");xn(st,"FORMAT_THOUSANDS",st.makePresetFormat("Thousands","##0.000 k",.001));xn(st,"FORMAT_MILLIONS",st.makePresetFormat("Millions","###,##0.000 mm",1e-6));xn(st,"FORMAT_SCIENTIFIC_NOTATION",st.makePresetFormat("Scientific Notation","0.0000E0"));class ev extends Ue{format(e){return e}}function Qo(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 Jo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qo(Object(t),!0).forEach(function(r){Ri(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Qo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ri(n,e,t){return e=tv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tv(n){var e=nv(n,"string");return typeof e=="symbol"?e:String(e)}function nv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var rv=/\s*(\d{4})([-./](\d{1,2}|[a-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/;class we{static makeDateWrapper(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:0,d=arguments.length>8&&arguments[8]!==void 0?arguments[8]:0;if(!t)throw new Error("No timezone provided");var h="".concat(r).padStart(4,"0"),c="".concat(i+1).padStart(2,"0"),f="".concat(o).padStart(2,"0"),v="".concat(a).padStart(2,"0"),p="".concat(s).padStart(2,"0"),g="".concat(l).padStart(2,"0"),y="".concat(d).padStart(9,"0"),P="".concat(h,"-").concat(c,"-").concat(f," ").concat(v,":").concat(p,":").concat(g,".").concat(y);return e.i18n.DateTimeFormat.parse(we.FULL_DATE_FORMAT,P,e.i18n.TimeZone.getTimeZone(t))}static getNextNanos(e){var t=parseInt(e,10),r="0".repeat(9-e.length),i="".concat(t+1).concat(r);return parseInt(i,10)}static getNextDate(e,t,r,i){var{year:o,month:a,date:s,hours:l,minutes:d,seconds:h,nanos:c}=r;if(t.nanos!=null){if(t.nanos.length===9)return null;c=we.getNextNanos(t.nanos),c>999999999&&(h+=1,c=0)}else t.seconds!=null?h+=1:t.minutes!=null?d+=1:t.hours!=null?l+=1:t.date!=null?s+=1:t.month!=null?a+=1:o+=1;var f=new Date(o,a,s,l,d,h);return we.makeDateWrapper(e,i,f.getFullYear(),f.getMonth(),f.getDate(),f.getHours(),f.getMinutes(),f.getSeconds(),c)}static parseMonth(e){var t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;var r=e.trim().toLowerCase();if(r.length>=3){for(var i=0;i<we.months.length;i+=1)if(we.months[i].startsWith(r))return i}return NaN}static parseDateValues(e,t,r,i,o,a,s){var l=parseInt(e,10),d=t!=null?this.parseMonth(t):0,h=r!=null?parseInt(r,10):1,c=i!=null?parseInt(i,10):0,f=o!=null?parseInt(o,10):0,v=a!=null?parseInt(a,10):0,p=s!=null?parseInt(s.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(d)||Number.isNaN(h)||Number.isNaN(c)||Number.isNaN(f)||Number.isNaN(v)||Number.isNaN(p)?null:{year:l,month:d,date:h,hours:c,minutes:f,seconds:v,nanos:p}}static parseDateTimeString(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=rv.exec(e);if(r==null)throw new Error("Unexpected date string: ".concat(e));var[,i,,o,,a,,s,,l,,d,,h,c]=r;if(!t&&c!=null&&c.length>0)throw new Error("Unexpected characters after date string '".concat(e,"': ").concat(c));var f={year:i,month:o,date:a,hours:s,minutes:l,seconds:d,nanos:h};return t?Jo(Jo({},f),{},{overflow:c}):f}static parseDateRange(e,t,r){var i=t.trim().toLowerCase();if(i.length===0)throw new Error("Cannot parse date range from empty string");if(i==="null")return[null,null];if(i==="today"){var o=new Date(Date.now()),a=we.makeDateWrapper(e,r,o.getFullYear(),o.getMonth(),o.getDate()),s=new Date(o.getFullYear(),o.getMonth(),o.getDate()+1),l=we.makeDateWrapper(e,r,s.getFullYear(),s.getMonth(),s.getDate());return[a,l]}if(i==="yesterday"){var d=new Date(Date.now()),h=new Date(d.getFullYear(),d.getMonth(),d.getDate()-1),c=we.makeDateWrapper(e,r,h.getFullYear(),h.getMonth(),h.getDate()),f=we.makeDateWrapper(e,r,d.getFullYear(),d.getMonth(),d.getDate());return[c,f]}if(i==="now"){var v=new Date(Date.now()),p=e.DateWrapper.ofJsDate(v);return[p,null]}var g=we.parseDateTimeString(i);if(g.year==null&&g.month==null&&g.date==null)throw new Error("Unable to extract year, month, or day ".concat(i));var y=we.parseDateValues(g.year,g.month,g.date,g.hours,g.minutes,g.seconds,g.nanos);if(y==null)throw new Error("Unable to extract date values from ".concat(g));var P=we.makeDateWrapper(e,r,y.year,y.month,y.date,y.hours,y.minutes,y.seconds,y.nanos),O=we.getNextDate(e,g,y,r);return[P,O]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}static trimDateTimeStringTimeZone(e){var{overflow:t=""}=we.parseDateTimeString(e,!0);if(t==="")return e;if(!/^\s[A-Za-z]+/.test(t))throw new Error("Unexpected timezone format in overflow: '".concat(e,"'"));return e.slice(0,-t.length)}}Ri(we,"FULL_DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSSSSS");Ri(we,"months",["january","february","march","april","may","june","july","august","september","october","november","december"]);const ii=we;function IC(n,e){return n===e?{operator:"notEq",value:""}:{operator:"eq",value:n}}function DC(n,e,t,r){return function(o){var a=t.trim();if(a==="")return null;var s=rl(e,l=>n.makeSearchTextFilter(l,a,r),"or");return s(o)}}function rl(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"or";return function(i){var o=i?.findColumns(typeof n=="string"?[n]:n);if(o==null||o.length===0)return null;var a=o.map(e);return a.reduce((s,l)=>s[t](l))}}function iv(n,e,t,r){return rl(e,i=>i.filter()[r](n.makeFilterValue(i.type,t)),"or")}function xC(n,e,t,r,i){return function(a){var s=a?.findColumn(e),l=t==="all"||r&&t.size===0;return s==null||l?null:n.makeSelectValueFilter(s,[...t.keys()],i)}}function MC(n){return function(t){return t.filter().isNull().not().and(t.filter().notEq(n.makeFilterValue(t.type,"")))}}function NC(n,e){return function(r){var i=r.filter(),o=n.makeFilterValue(r.type,""),a=i.eq(o);return e?i.isNull().or(a):a.or(i.notEq(o))}}function ki(n,e,t){return e=ov(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ov(n){var e=av(n,"string");return typeof e=="symbol"?e:String(e)}function av(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Jn{}ki(Jn,"not","not");ki(Jn,"and","and");ki(Jn,"or","or");function AC(n){if(!(n==="not"||n==="and"||n==="or"))throw new Error("operator is not a valid FilterOperatorValue")}function ge(n,e,t){return e=sv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sv(n){var e=lv(n,"string");return typeof e=="symbol"?e:String(e)}function lv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class E{}ge(E,"eq","eq");ge(E,"eqIgnoreCase","eqIgnoreCase");ge(E,"notEq","notEq");ge(E,"notEqIgnoreCase","notEqIgnoreCase");ge(E,"greaterThan","greaterThan");ge(E,"greaterThanOrEqualTo","greaterThanOrEqualTo");ge(E,"lessThan","lessThan");ge(E,"lessThanOrEqualTo","lessThanOrEqualTo");ge(E,"in","in");ge(E,"inIgnoreCase","inIgnoreCase");ge(E,"notIn","notIn");ge(E,"notInIgnoreCase","notInIgnoreCase");ge(E,"isTrue","isTrue");ge(E,"isFalse","isFalse");ge(E,"isNull","isNull");ge(E,"invoke","invoke");ge(E,"contains","contains");ge(E,"notContains","notContains");ge(E,"containsIgnoreCase","containsIgnoreCase");ge(E,"startsWith","startsWith");ge(E,"endsWith","endsWith");ge(E,"containsAny","containsAny");var dv="DH_ITEM_KEY",ea=W.module("ViewportDataUtils");function il(n){return"".concat(dv,"_").concat(n)}function LC(n,e){var{bulkUpdate:t}=n;return function(i){var{columns:o,offset:a,rows:s}=i.detail;ea.debug("table updated",i.detail);var l=new Map;s.forEach((d,h)=>{var c=e(d,o),f=il(a+h);l.set(f,{key:f,item:c})}),ea.debug("update keys",l),t(l)}}function FC(n,e){return e.reduce((t,r)=>(t[r.name]=n.get(r),t),{})}function*RC(n,e){for(var t=n;t<=e;++t)yield{key:il(t)}}function uv(n){return n==null||hv(n)?0:n.size}function hv(n){return"isClosed"in n?n.isClosed:!1}function kC(n,e,t,r){var i=n+e-1,[o,a]=[0,r-1],s=Gi(n-t,o,a),l=Gi(i+t,o,a);return[s,l]}function ta(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Ht(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ta(o,r,i,a,s,"next",l)}function s(l){ta(o,r,i,a,s,"throw",l)}a(void 0)})}}function fn(n,e,t){return e=cv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cv(n){var e=mv(n,"string");return typeof e=="symbol"?e:String(e)}function mv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ot=W.module("TableUtils");function jC(n){return n===C.sortDirection.ascending||n===C.sortDirection.descending||n===C.sortDirection.reverse||n===C.sortDirection.none}class C{static copyTableAndApplyFilters(e){var t=arguments;return Ht(function*(){if(e==null)return null;for(var r=yield e.copy(),i=t.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=t[a];return r.applyFilter(Qr(...o.map(s=>s(r)))),r})()}static getSortIndex(e,t){for(var r=0;r<e.length;r+=1){var i,o=e[r];if(((i=o.column)===null||i===void 0?void 0:i.name)===t)return r}return null}static getSortForColumn(e,t){var r=C.getSortIndex(e,t);return r!=null?e[r]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return C.isBooleanType(e)?[E.isTrue,E.isFalse,E.isNull]:C.isCharType(e)||C.isNumberType(e)||C.isDateType(e)?[E.eq,E.notEq,E.greaterThan,E.greaterThanOrEqualTo,E.lessThan,E.lessThanOrEqualTo]:C.isTextType(e)?[E.eq,E.eqIgnoreCase,E.notEq,E.notEqIgnoreCase,E.contains,E.notContains,E.startsWith,E.endsWith]:[]}static getNextSort(e,t,r){if(r<0||r>=e.length)return null;var i=C.getSortForColumn(t,e[r].name);return i===null?e[r].sort().asc():i.direction===C.sortDirection.ascending?i.desc():null}static makeColumnSort(e,t,r,i){if(t<0||t>=e.length||r===C.sortDirection.none)return null;var o=e[t].sort();switch(r){case C.sortDirection.ascending:o=o.asc();break;case C.sortDirection.descending:o=o.desc();break}return i&&(o=o.abs()),o}static toggleSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(r<0||r>=t.length)return[];var o=C.getNextSort(t,e,r);return C.setSortForColumn(e,t[r].name,o,i)}static sortColumn(e,t,r,i,o,a){if(r<0||r>=t.length)return[];var s=C.makeColumnSort(t,r,i,o);return C.setSortForColumn(e,t[r].name,s,a)}static setSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=C.getSortIndex(e,t),a=[];return i&&(a=a.concat(e.filter(s=>{var{direction:l}=s;return l!==C.sortDirection.reverse})),o!==null&&a.splice(o,1)),r!==null&&a.push(r),a}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case C.dataType.BOOLEAN:return C.dataType.BOOLEAN;case"char":case"java.lang.Character":case C.dataType.CHAR:return C.dataType.CHAR;case"java.lang.String":case C.dataType.STRING:return C.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case C.dataType.DATETIME:return C.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case C.dataType.DECIMAL:return C.dataType.DECIMAL;case"int":case"java.lang.Integer":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":case"java.math.BigInteger":case C.dataType.INT:return C.dataType.INT;default:return C.dataType.UNKNOWN}}static isLongType(e){switch(e){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(e){switch(e){case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(e){return C.isIntegerType(e)||C.isDecimalType(e)}static isIntegerType(e){switch(e){case"int":case"java.lang.Integer":case"java.math.BigInteger":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":return!0;default:return!1}}static isDecimalType(e){switch(e){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBigDecimalType(e){switch(e){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(e){switch(e){case"java.math.BigInteger":return!0;default:return!1}}static isBooleanType(e){switch(e){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(e){switch(e){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(e){switch(e){case"java.lang.String":return!0;default:return!1}}static isTextType(e){return this.isStringType(e)||this.isCharType(e)}static getBaseType(e){return e.split("[]")[0]}static isCompatibleType(e,t){return C.getNormalizedType(e)===C.getNormalizedType(t)}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:'"'.concat(e,'"')}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeRangeFilterWithOperation(e,t,r){switch(t){case"=":return e.eq(r);case"<":return e.lessThan(r);case"<=":case"=<":return e.lessThanOrEqualTo(r);case">":return e.greaterThan(r);case">=":case"=>":return e.greaterThanOrEqualTo(r);case"!=":case"!":return e.notEq(r);default:return null}}static makeCancelableTablePromise(e){return Ee.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,o,a,s=!0,l=new Promise((d,h)=>{a=setTimeout(()=>{o(),s=!1,h(new gs('Event "'.concat(t,'" timed out.')))},r),o=e.addEventListener(t,c=>{if(i!=null&&!i(c)){Ot.debug2("Event triggered, but matcher returned false.");return}Ot.debug2("Event triggered, resolving."),o(),clearTimeout(a),s=!1,d(c)})});return l.cancel=()=>{if(s){Ot.debug2("Pending promise cleanup."),o(),clearTimeout(a),s=!1;return}Ot.debug2("Ignoring non-pending promise cancel.")},l}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeBooleanValue(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e===""&&t)return null;switch(e?.toLowerCase()){case"null":return null;case"0":case"f":case"fa":case"fal":case"fals":case"false":case"n":case"no":return!1;case"1":case"t":case"tr":case"tru":case"true":case"y":case"ye":case"yes":return!0;default:throw new Error("Invalid boolean '".concat(e,"'"))}}static makeNumberValue(e){if(e==="null"||e==="")return null;var t=e.toLowerCase().trim();if(t==="∞"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-∞"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;var r=C.removeCommas(t);if(C.NUMBER_REGEX.test(r))return parseFloat(r);throw new Error("Invalid number '".concat(e,"'"))}static getFilterOperatorString(e){switch(e){case E.eq:return"=";case E.notEq:return"!=";case E.greaterThan:return">";case E.greaterThanOrEqualTo:return">=";case E.lessThan:return"<";case E.lessThanOrEqualTo:return"<=";case E.contains:return"~";case E.notContains:return"!~";default:throw new Error("Unexpected filter type ".concat(e))}}static isPartitionedTable(e){return e!=null&&e.getMergedTable!==void 0&&e.getKeyTable!==void 0&&e.getKeys!==void 0}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return[...e].sort((r,i)=>{var o=r.name.toUpperCase(),a=i.name.toUpperCase();return ps.sort(o,a,t)})}constructor(e){fn(this,"dh",void 0),this.dh=e,ru(this)}createDistinctSortedColumnTable(e,t,r){var i=arguments,o=this;return Ht(function*(){if(e==null)return null;for(var a=e,s=i.length,l=new Array(s>3?s-3:0),d=3;d<s;d++)l[d-3]=i[d];l.length>0&&(a=yield e.copy(),yield a.applyFilter(Qr(...l.map(v=>v(a)))));var h=a.findColumn(t),c=yield a.selectDistinct([h]);a!==e&&a.close();var f=c.findColumn(t).sort()[r]();return o.applySort(c,[f])})()}doesColumnValueExist(e,t,r,i){var o=this;return Ht(function*(){if(e==null)return null;var a=iv(o,t,r,i?"eq":"eqIgnoreCase"),s=yield e.copy();yield o.applyFilter(s,Qr(a(s)));var l=uv(s);return s.close(),l>0})()}getValueType(e){if(e==null)return this.dh.ValueType.STRING;var t=C.getNormalizedType(e);switch(t){case C.dataType.BOOLEAN:return this.dh.ValueType.BOOLEAN;case C.dataType.CHAR:case C.dataType.STRING:return this.dh.ValueType.STRING;case C.dataType.DATETIME:return this.dh.ValueType.DATETIME;case C.dataType.DECIMAL:case C.dataType.INT:return C.isBigDecimalType(e)||C.isBigIntegerType(e)?this.dh.ValueType.STRING:this.dh.ValueType.NUMBER;default:return this.dh.ValueType.STRING}}makeQuickFilter(e,t,r){for(var i=t.split("||"),o=null,a=0;a<i.length;a+=1){for(var s=i[a],l=s.split("&&"),d=null,h=0;h<l.length;h+=1){var c=l[h].trim();if(c.length>0){var f=this.makeQuickFilterFromComponent(e,c,r);if(f)d?d=d.and(f):d=f;else throw new Error("Unable to parse quick filter from text ".concat(t))}}o&&d?o=o.or(d):o=d}return o}makeQuickFilterFromComponent(e,t,r){var{type:i}=e;return C.isNumberType(i)?this.makeQuickNumberFilter(e,t):C.isBooleanType(i)?this.makeQuickBooleanFilter(e,t):r!=null&&C.isDateType(i)?this.makeQuickDateFilter(e,t,r):C.isCharType(i)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}makeQuickNumberFilter(e,t){var r=e.filter(),{dh:i}=this,o=null,a=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i,s=a.exec(t),l=null,d=null,h=null,c=null,f=null;if(s!==null&&s.length>3&&([,l,d,h,c,f]=s),f!=null&&f.trim().length>0)return null;if(l==null&&(l="="),c!=null){if(!(l==="="||l==="!"||l==="!="))return null;switch(c=c.trim().toLowerCase(),c){case"null":o=r.isNull();break;case"nan":o=i.FilterCondition.invoke("isNaN",r);break;case"infinity":case"inf":case"∞":d!=null?o=i.FilterCondition.invoke("isInf",r).and(r.lessThan(i.FilterValue.ofNumber(0))):o=i.FilterCondition.invoke("isInf",r).and(r.greaterThan(i.FilterValue.ofNumber(0)));break}return o!==null&&(l==="!"||l==="!=")&&(o=o.not()),o}if(h==null)return null;if(h=C.removeCommas(h),C.isLongType(e.type))try{h=i.FilterValue.ofNumber(i.LongWrapper.ofString("".concat(d!=null?"-":"").concat(h)))}catch(v){return Ot.warn("Unable to create long filter",v),null}else{if(h=parseFloat(h),h==null||Number.isNaN(h))return null;h=i.FilterValue.ofNumber(d!=null?0-h:h)}return o=e.filter(),C.makeRangeFilterWithOperation(o,l,h)}static escapeQuickTextFilter(e){var t,r;if(e==null)return null;var i=/^(!~|!=|~|=|!)?(.*)/,o=/^\\*null$/,a=i.exec(e),s=null,l=null;if(a!==null&&a.length>2&&([,s,l]=a),s!=null){var d;return"\\".concat(s).concat((d=l)!==null&&d!==void 0?d:"")}return l!=null&&o.test(l.toLowerCase())||l!=null&&l.startsWith("*")?"\\".concat(l):l!=null&&l.endsWith("*")&&!l.endsWith("\\*")?(l=l.substring(0,l.length-1),"".concat(l,"\\*")):"".concat((t=s)!==null&&t!==void 0?t:"").concat((r=l)!==null&&r!==void 0?r:"")}static unescapeQuickTextFilter(e){var t,r,i=/^(\\!~|\\!=|\\~|\\=|\\!)?(.*)/,o=/^\\*null$/,a=i.exec(e),s=null,l=null;return a!==null&&a.length>2&&([,s,l]=a),s!=null&&(s=s.replace("\\","")),l!=null&&o.test(l.toLowerCase())&&(l=l.replace("\\","")),s==null&&l!=null&&l.startsWith("\\*")&&(l=l.substring(1)),s==null&&l!=null&&l.endsWith("\\*")?(l=l.substring(0,l.length-2),"".concat(l,"*")):"".concat((t=s)!==null&&t!==void 0?t:"").concat((r=l)!==null&&r!==void 0?r:"")}makeQuickTextFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),o=/^(!~|!=|~|=|!)?(.*)/,a=o.exec(i),s=null,l=null;if(a!==null&&a.length>2&&([,s,l]=a,l!=null&&(l=l.trim())),l==null||l.length===0&&!(s==="="||s==="!="))return null;s==null&&(s="=");var d=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return d.isNull();case"!=":case"!":return d.isNull().not()}var h=null,c=null;switch(l.startsWith("*")?(h="*",l=l.substring(1)):l.endsWith("*")&&!l.endsWith("\\*")&&(c="*",l=l.substring(0,l.length-1)),l=C.unescapeQuickTextFilter(l),s){case"~":return d.isNull().not().and(d.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))));case"!~":return d.isNull().or(d.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))).not());case"!=":return h==="*"?d.isNull().or(d.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$"))).not()):c==="*"?d.isNull().or(d.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*"))).not()):d.notEqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()));case"=":return h==="*"?d.isNull().not().and(d.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$")))):c==="*"?d.isNull().not().and(d.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*")))):d.eqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()))}return null}makeQuickBooleanFilter(e,t){var r=/^(!=|=|!)?(.*)/,i=r.exec("".concat(t).trim());if(i===null)return null;var[,o,a]=i,s=o==="!"||o==="!=",l=a.trim().toLowerCase(),d=e.filter();try{var h=C.makeBooleanValue(l);return h!=null&&h?d=d.isTrue():h===null?d=d.isNull():d=d.isFalse(),s?d.not():d}catch{return null}}makeQuickDateFilter(e,t,r){var i=t.trim(),o=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/,a=o.exec(i);if(a==null||a.length<=2)throw new Error("Unable to parse date filter: ".concat(t));var s=null,l=null;[,s,l]=a;var d=E.eq;switch(s){case"<":d=E.lessThan;break;case"<=":case"=<":d=E.lessThanOrEqualTo;break;case">":d=E.greaterThan;break;case">=":case"=>":d=E.greaterThanOrEqualTo;break;case"!=":case"!":d=E.notEq;break;case"=":case"==":default:d=E.eq;break}return this.makeQuickDateFilterWithOperation(e,l,d,r)}makeQuickDateFilterWithOperation(e,t,r,i){var{dh:o}=this,[a,s]=ii.parseDateRange(o,t,i),l=a!=null?o.FilterValue.ofNumber(a):null,d=s!=null?o.FilterValue.ofNumber(s):null,h=e.filter();if(l==null)return r===E.notEq?h.isNull().not():h.isNull();switch(r){case E.eq:{if(d!=null){var c=h.greaterThanOrEqualTo(l),f=h.lessThan(d);return c.and(f)}return h.eq(l)}case E.lessThan:return h.lessThan(l);case E.lessThanOrEqualTo:return d!=null?h.lessThan(d):h.lessThanOrEqualTo(l);case E.greaterThan:return d!=null?h.greaterThanOrEqualTo(d):h.greaterThan(l);case E.greaterThanOrEqualTo:return h.greaterThanOrEqualTo(l);case E.notEq:{if(d!=null){var v=h.lessThan(l),p=h.greaterThanOrEqualTo(d);return v.or(p)}return h.notEq(l)}default:throw new Error("Invalid operator: ".concat(r))}}makeQuickCharFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),o=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/,a=o.exec(i),s=null,l=null,d=null;if(a!==null&&a.length>3&&([,s,l,d]=a),d!=null&&d.trim().length>0||l==null||l.length===0)return null;s==null&&(s="=");var h=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return h.isNull();case"!=":case"!":return h.isNull().not();default:return null}var c=r.FilterValue.ofString(C.isRangeOperation(s)?C.quoteValue(l):l);return C.makeRangeFilterWithOperation(h,s,c)}makeAdvancedFilter(e,t,r){for(var{filterItems:i,filterOperators:o,invertSelection:a,selectedValues:s}=t,l=null,d=0;d<i.length;d+=1){var h=i[d],{selectedType:c,value:f}=h;if(c!=null&&c.length>0&&f!=null&&f.length>0)try{var v=this.makeAdvancedValueFilter(e,c,f,r);if(v!=null){if(d===0)l=v;else if(l!==null&&d-1<o.length){var p=o[d-1];if(p===Jn.and)l=l.and(v);else if(p===Jn.or)l=l.or(v);else{Ot.error("Unexpected filter operator",p,v),l=null;break}}}else Ot.debug2("Empty filter ignored for",c,f)}catch(y){Ot.error("Unable to create filter",y),l=null;break}}var g=this.makeSelectValueFilter(e,s,a);return g!=null&&(l!=null?l=l.and(g):l=g),l}makeAdvancedValueFilter(e,t,r,i){var{dh:o}=this;if(C.isDateType(e.type))return this.makeQuickDateFilterWithOperation(e,r,t,i);if(C.isNumberType(e.type)||C.isCharType(e.type))return this.makeQuickFilter(e,"".concat(C.getFilterOperatorString(t)).concat(r));var a=this.makeFilterValue(e.type,r),s=e.filter();switch(t){case E.eq:return s.eq(a);case E.eqIgnoreCase:return s.eqIgnoreCase(a);case E.notEq:return s.notEq(a);case E.notEqIgnoreCase:return s.notEqIgnoreCase(a);case E.greaterThan:return s.greaterThan(a);case E.greaterThanOrEqualTo:return s.greaterThanOrEqualTo(a);case E.lessThan:return s.lessThan(a);case E.lessThanOrEqualTo:return s.lessThanOrEqualTo(a);case E.isTrue:return s.isTrue();case E.isFalse:return s.isFalse();case E.isNull:return s.isNull();case E.contains:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))));case E.notContains:return s.isNull().or(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))).not());case E.startsWith:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i)^\\Q".concat(r,"\\E.*"))));case E.endsWith:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E$"))));case E.in:case E.inIgnoreCase:case E.notIn:case E.notInIgnoreCase:case E.invoke:default:throw new Error("Unexpected filter operation: ".concat(t))}}makeSearchTextFilter(e,t,r){var i=this.getValueType(e.type);try{if(i===this.dh.ValueType.BOOLEAN){var o=this.makeQuickBooleanFilter(e,t);return k(o),o}if(i===this.dh.ValueType.DATETIME)return this.makeQuickDateFilterWithOperation(e,ii.trimDateTimeStringTimeZone(t),"eq",r);if(i===this.dh.ValueType.NUMBER){var a=this.makeQuickNumberFilter(e,t);return k(a),a}return C.isBigDecimalType(e.type)||C.isBigIntegerType(e.type)?e.filter().eq(this.makeFilterValue(e.type,t)):e.filter().containsIgnoreCase(this.makeFilterValue(e.type,t))}catch{return this.makeNeverFilter(e)}}applyNeverFilter(e,t){var r=arguments,i=this;return Ht(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(e==null)return null;var a=e.findColumn(t),s=[i.makeNeverFilter(a)];return yield i.applyFilter(e,s,o),e})()}applyCustomColumns(e,t){var r=arguments,i=this;return Ht(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return C.executeAndWaitForEvent(s=>s?.applyCustomColumns(t),e,a.Table.EVENT_CUSTOMCOLUMNSCHANGED,o)})()}applyFilter(e,t){var r=arguments,i=this;return Ht(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return C.executeAndWaitForEvent(s=>s?.applyFilter(t),e,a.Table.EVENT_FILTERCHANGED,o)})()}applySort(e,t){var r=arguments,i=this;return Ht(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return C.executeAndWaitForEvent(s=>s?.applySort(t),e,a.Table.EVENT_SORTCHANGED,o)})()}makeNeverFilter(e){var{dh:t}=this,r=null;C.isTextType(e.type)?r=t.FilterValue.ofString("a"):C.isBooleanType(e.type)?r=t.FilterValue.ofBoolean(!0):C.isDateType(e.type)?r=t.FilterValue.ofNumber(t.DateWrapper.ofJsDate(new Date)):r=t.FilterValue.ofNumber(0);var i=e.filter().eq(r),o=e.filter().notEq(r);return i.and(o)}makeFilterValue(e,t){var{dh:r}=this,i=C.getBaseType(e);return C.isTextType(i)?r.FilterValue.ofString(t):C.isLongType(i)?r.FilterValue.ofNumber(r.LongWrapper.ofString(C.removeCommas(t))):r.FilterValue.ofNumber(C.removeCommas(t))}makeFilterRawValue(e,t){var{dh:r}=this;return C.isCharType(e)?r.FilterValue.ofString(typeof t=="number"?String.fromCharCode(t):t):C.isTextType(e)?r.FilterValue.ofString(t):C.isBooleanType(e)?r.FilterValue.ofBoolean(t):r.FilterValue.ofNumber(t)}makeNullableEqFilter(e,t){return t==null?e.filter().isNull():e.filter().eq(this.makeFilterRawValue(e.type,t))}makeValue(e,t,r){var{dh:i}=this;if(t==="null")return null;if(C.isTextType(e))return t;if(C.isLongType(e))return i.LongWrapper.ofString(C.removeCommas(t));if(C.isBooleanType(e))return C.makeBooleanValue(t,!0);if(C.isDateType(e)){var[o]=ii.parseDateRange(i,t,r);return o}return C.isNumberType(e)?C.makeNumberValue(t):(Ot.error("Unexpected column type",e),null)}makeSelectValueFilter(e,t,r){var{dh:i}=this;if(t.length===0)return r?null:this.makeNeverFilter(e);for(var o=[],a=!1,s=0;s<t.length;s+=1){var l=t[s];l==null?a=!0:C.isTextType(e.type)?o.push(i.FilterValue.ofString(typeof l=="number"?String.fromCharCode(l):l)):C.isBooleanType(e.type)?o.push(i.FilterValue.ofBoolean(!!l)):o.push(i.FilterValue.ofNumber(l))}return a?o.length>0?r?e.filter().isNull().not().and(e.filter().notIn(o)):e.filter().isNull().or(e.filter().in(o)):r?e.filter().isNull().not():e.filter().isNull():r?e.filter().notIn(o):e.filter().in(o)}}fn(C,"dataType",{BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"});fn(C,"sortDirection",{ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null});fn(C,"APPLY_TABLE_CHANGE_TIMEOUT_MS",3e4);fn(C,"REVERSE_TYPE",Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"}));fn(C,"NUMBER_REGEX",/^-?\d+(\.\d+)?$/);fn(C,"executeAndWaitForEvent",function(){var n=Ht(function*(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(t==null)return null;var o=C.makeCancelableTableEventPromise(t,r,i);return e(t),yield o,t});return function(e,t,r){return n.apply(this,arguments)}}());function pn(n,e,t){return e=fv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fv(n){var e=vv(n,"string");return typeof e=="symbol"?e:String(e)}function vv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ol{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((t,r)=>{var i=C.getNormalizedType(r.columnType);if(i===null)return t;t.has(i)||t.set(i,new Map);var o=t.get(i);return o?.set(r.columnName,r.format),t},new Map)}static makeColumnFormattingRule(e,t,r){return{columnType:e,columnName:t,format:r}}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:!0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!0;pn(this,"defaultColumnFormatter",void 0),pn(this,"typeFormatterMap",void 0),pn(this,"columnFormatMap",void 0),pn(this,"truncateNumbersWithPound",void 0),pn(this,"showEmptyStrings",void 0),pn(this,"showNullStrings",void 0),this.defaultColumnFormatter=new Xf,this.typeFormatterMap=new Map([[C.dataType.BOOLEAN,new Bf],[C.dataType.CHAR,new Uf],[C.dataType.DATETIME,new ht(e,r)],[C.dataType.DECIMAL,new ve(e,i)],[C.dataType.INT,new st(e,o)],[C.dataType.STRING,new ev]]),this.columnFormatMap=ol.makeColumnFormatMap(t),this.truncateNumbersWithPound=a,this.showEmptyStrings=s,this.showNullStrings=l}getColumnFormatMapForType(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=C.getNormalizedType(e);if(r!==null)return t&&!this.columnFormatMap.has(r)&&this.columnFormatMap.set(r,new Map),this.columnFormatMap.get(r)}getColumnFormat(e,t){var r,i=this.getColumnFormatMapForType(e);return(r=i?.get(t))!==null&&r!==void 0?r:null}getColumnTypeFormatter(e){var t=C.getNormalizedType(e),r=this.defaultColumnFormatter;if(t){var i;r=(i=this.typeFormatterMap.get(t))!==null&&i!==void 0?i:r}return r}getFormattedString(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",i=arguments.length>3?arguments[3]:void 0;if(e==null)return"";var o=this.getColumnTypeFormatter(t),a=i||this.getColumnFormat(t,r);return o.format(e,a??void 0)}get timeZone(){var e=this.typeFormatterMap.get(C.dataType.DATETIME);return kd(e,ht),e.dhTimeZone.id}}const gv="var(--dh-color-chart-colorway)",pv="var(--dh-color-chart-grid)",bv="var(--dh-color-chart-axis-line)",yv="var(--dh-color-chart-axis-line-zero)",na={"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:gv,gridcolor:pv,linecolor:bv,zerolinecolor:yv,"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)"};var ra=W.module("ChartTheme");function Cv(){var n,e=os(na);return e.colorway=jd((n=e.colorway)!==null&&n!==void 0?n:"").map(t=>{var[r,i]=t;return $d.normalizeCssColor(e.colorway.substring(r,i+1))}).join(" "),ra.debug2("Chart theme:",na),ra.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"]})}function ia(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Sv(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ia(Object(t),!0).forEach(function(r){wv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ia(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function wv(n,e,t){return e=Ev(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ev(n){var e=_v(n,"string");return typeof e=="symbol"?e:String(e)}function _v(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Pv=m.lazy(()=>hs(()=>import("./Plot-20e6708f.js"),["./Plot-20e6708f.js","./Plotly-24fcb6c1.js","./plotly-6e7c1c9f.js","./helpers-de833af9.js","./vendor-3e5e4180.js","./vendor-7509d17c.css"],import.meta.url));function Tv(n){return u.jsx(m.Suspense,{fallback:u.jsx(hn,{}),children:u.jsx(Pv,Sv({},n))})}var al=m.createContext(null);function $C(n){var{children:e}=n,{activeThemes:t}=Es(),r=m.useMemo(Cv,[t]);return u.jsx(al.Provider,{value:r,children:e})}function Ov(){return rr(al,"No ChartThemeContext value found.")}function oa(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Iv(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){oa(o,r,i,a,s,"next",l)}function s(l){oa(o,r,i,a,s,"throw",l)}a(void 0)})}}var Dv=W.module("HeapUsage");function xv(n){var e,{connection:t,defaultUpdateInterval:r,hoverUpdateInterval:i,bgMonitoring:o=!0,monitorDuration:a}=n,s=Ov(),[l,d]=m.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[h,c]=m.useState(!1),f=m.useRef({timestamps:[],usages:[]}),v=Cs(),p=m.useCallback(Iv(function*(){try{var A=yield t.getWorkerHeapInfo();if(!v.current)return;if(d(A),o||h){for(var V=(A.totalHeapSize-A.freeMemory)/A.maximumHeapSize,z=Date.now(),{timestamps:me,usages:je}=f.current;me.length!==0&&z-me[0]>a*1.5;)me.shift(),je.shift();me.push(z),je.push(V)}else f.current={timestamps:[],usages:[]}}catch(Ie){Dv.warn("Unable to get heap usage",Ie)}}),[t,v,o,h,a]);Nu(p,h?i:r);var g=(A,V)=>Math.round(A*10**V)/10**V,y=2,P=1024**3,{freeMemory:O,totalHeapSize:_,maximumHeapSize:R}=l,U=g(O/P,y),Q=g(_/P,y),N=g(R/P,y),B=Q-U,$=function(V,z){var me=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return u.jsxs("div",{className:X("heap-usage-info-row",{"heading-bottom-border":me}),children:[u.jsx("div",{className:"font-weight-bold",children:V}),u.jsx("div",{children:z})]})},{timestamps:Y,usages:ne}=f.current,F=(e=Y[Y.length-1])!==null&&e!==void 0?e:0,q=_/R,K=(_-O)/R;return u.jsxs("div",{className:"max-memory",children:[u.jsx("div",{className:"total-memory",style:{width:"calc(".concat(q*100,"% - ").concat(q*2,"px")}}),u.jsx("div",{className:X("used-memory",{"heap-overflow":(_-O)/R>.95}),style:{width:"calc(".concat(K*100,"% - ").concat(K*2,"px")}}),u.jsxs("div",{className:"memory-text",children:[N.toFixed(1)," GB"]}),u.jsx(Xt,{onEntered:()=>c(!0),onExited:()=>c(!1),interactive:!0,children:u.jsxs("div",{className:"heap-tooltip",children:[$("In use:","".concat(B.toFixed(y)," of ").concat(N.toFixed(y)," GB"),!0),$("Free:","".concat(U.toFixed(y)," GB")),$("Total:","".concat(Q.toFixed(y)," GB")),$("Max:","".concat(N.toFixed(y)," GB")),u.jsx("div",{className:"heap-plot",children:u.jsx(Tv,{data:[{x:[...Y],y:[...ne],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(a/6),gridcolor:s.linecolor,range:[F-a,F],linecolor:s.linecolor,linewidth:2,mirror:!0},yaxis:{dtick:.2,gridcolor:s.linecolor,range:[0,1],linecolor:s.linecolor,linewidth:2,mirror:!0}}})}),u.jsxs("div",{className:"heap-utilisation-text",children:["% utilization over ",Math.round(a/1e3/60)," min."]})]})})]})}var sl=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 ll(n){return n.componentName!==void 0}function Mv(n){return n.component!==void 0}var dl=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const Nv=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:sl,isGLComponentConfig:ll,isReactComponentConfig:Mv,itemDefaultConfig:dl},Symbol.toStringTag,{value:"Module"}));function Or(n,e,t){return e=Av(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Av(n){var e=Lv(n,"string");return typeof e=="symbol"?e:String(e)}function Lv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class er{constructor(){Or(this,"_mSubscriptions",void 0),Or(this,"off",this.unbind),Or(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[er.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(c){console.error("Error while emitting event:",c)}}i.unshift(e);for(var l=this._mSubscriptions[er.ALL_EVENT],d=0;d<l.length;d++){var h=l[d].ctx||{};try{l[d].fn.apply(h,i)}catch(c){console.error("Error while emitting event to allEventSubs:",c)}}}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)}}Or(er,"ALL_EVENT","__all");const vt=er;function dt(n,e,t){return e=Fv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fv(n){var e=Rv(n,"string");return typeof e=="symbol"?e:String(e)}function Rv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class pi extends vt{constructor(e,t,r){super(),dt(this,"width",void 0),dt(this,"height",void 0),dt(this,"title",void 0),dt(this,"parent",void 0),dt(this,"layoutManager",void 0),dt(this,"tab",void 0),dt(this,"_config",void 0),dt(this,"isHidden",!1),dt(this,"beforeCloseHandler",void 0),dt(this,"_element",M(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),dt(this,"_contentElement",void 0),this.title=ll(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 d=a.isColumn?"height":"width",h=d==="height"?t:e,c=((r=this[d])!==null&&r!==void 0?r:0)*(1/(((i=s.config[d])!==null&&i!==void 0?i:0)/100)),f=h/c*100,v=(((o=s.config[d])!==null&&o!==void 0?o:0)-f)/(a.contentItems.length-1),p=0;p<a.contentItems.length;p++)if(a.contentItems[p]===s)a.contentItems[p].config[d]=f;else{var g;a.contentItems[p].config[d]=((g=a.contentItems[p].config[d])!==null&&g!==void 0?g:0)+v}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}extendState(e){this.setState(M.extend(!0,this.getState(),e))}setState(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")}setTitle(e){this.parent.setTitle(e)}_$setSize(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(e!==this.width||t!==this.height){this.width=e,this.height=t;var r=this._contentElement[0],i=r.offsetWidth-r.clientWidth,o=r.offsetHeight-r.clientHeight;this._contentElement.width(this.width-i).height(this.height-o),this.emit("resize")}}}const kv=Object.freeze(Object.defineProperty({__proto__:null,Container:pi,ItemContainer:pi},Symbol.toStringTag,{value:"Module"}));function ul(n){var e=location.hash.match(new RegExp(n+"=([^&]*)"));return e?e[1]:null}function hl(n){if(window.location.hash)return ul(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 ji(n){return window.requestAnimationFrame(n)}function jv(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 Lr(){return At()}function $v(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 $i(n){return M.trim(n.replace(/(<([^>]+)>)/gi,""))}function Ke(n,e,t){return e=Hv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hv(n){var e=Bv(n,"string");return typeof e=="symbol"?e:String(e)}function Bv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Wv extends vt{constructor(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super(),Ke(this,"_eElement",void 0),Ke(this,"_oDocument",void 0),Ke(this,"_eBody",void 0),Ke(this,"_destroyAfterMouseUp",void 0),Ke(this,"_nDelay",400),Ke(this,"_timeout",void 0),Ke(this,"timeout",void 0),Ke(this,"_nDistance",10),Ke(this,"_nX",0),Ke(this,"_nY",0),Ke(this,"_nOriginalX",0),Ke(this,"_nOriginalY",0),Ke(this,"_bDragging",!1),this._eElement=e,this._oDocument=M(document),this._eBody=M(document.body),this._destroyAfterMouseUp=r,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this._startDrag=this._startDrag.bind(this),(t=this._eElement)===null||t===void 0||t.on("mousedown",this.onMouseDown)}destroy(){var e,t;(e=this._eElement)===null||e===void 0||e.unbind("mousedown",this.onMouseDown),(t=this._oDocument)===null||t===void 0||t.unbind("mouseup",this.onMouseUp),this._eElement=void 0,this._oDocument=void 0,this._eBody=void 0,clearTimeout(this._timeout),this._timeout=void 0}onMouseDown(e){if(e.preventDefault(),e.button===0){var t,r,i,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||(o=i.find("iframe"))===null||o===void 0||o.css("pointer-events",""),this._bDragging===!0&&(this._bDragging=!1,this.emit("dragStop",e,this._nOriginalX+this._nX)),(a=this._eBody)===null||a===void 0||a.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var s;(s=this._eElement)===null||s===void 0||s.removeClass("lm_dragging")}this._destroyAfterMouseUp&&this.destroy()}}_startDrag(){var e,t,r,i;window.clearTimeout(this._timeout),this._bDragging=!0,(e=this._eBody)===null||e===void 0||e.addClass("lm_dragging"),(t=this._eElement)===null||t===void 0||t.addClass("lm_dragging"),(r=this._oDocument)===null||r===void 0||(i=r.find("iframe"))===null||i===void 0||i.css("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)}_getCoordinates(e){var t,r;return{x:(t=e.pageX)!==null&&t!==void 0?t:0,y:(r=e.pageY)!==null&&r!==void 0?r:0}}}const or=Wv;function bn(n,e,t){return e=Uv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Uv(n){var e=Vv(n,"string");return typeof e=="symbol"?e:String(e)}function Vv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class cl{constructor(e,t){bn(this,"_container",void 0),bn(this,"_reactComponent",null),bn(this,"_portalComponent",null),bn(this,"_originalComponentWillUpdate",null),bn(this,"_initialState",void 0),bn(this,"_reactClass",void 0),this._reactComponent=null,this._portalComponent=null,this._originalComponentWillUpdate=null,this._container=e,this._initialState=t,this._reactClass=this._getReactClass(),this._container.on("open",this._render,this),this._container.on("destroy",this._destroy,this)}_key(){var e=this._container._config.id;if(!e)throw new Error("Cannot mount panel without id");return Array.isArray(e)?e.join(","):e}_render(){var e=this._key();this._portalComponent=Hr.createPortal(this._getReactComponent(),this._container.getElement()[0],e),this._container.layoutManager.addReactChild(e,this._portalComponent)}_gotReactComponent(e){if(e){this._reactComponent=e,this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate||function(){},this._reactComponent.componentWillUpdate=this._onUpdate.bind(this);var t=this._container.getState();t&&this._reactComponent.setState(t)}}_destroy(){this._container.layoutManager.removeReactChild(this._key(),this._portalComponent),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)}_onUpdate(e,t){var r;this._container.setState(t),(r=this._originalComponentWillUpdate)===null||r===void 0||r.call(this._reactComponent,e,t)}_getReactClass(){var e=this._container._config.component;if(!e)throw new Error("No react component name. type: react-component needs a field `component`");var t=this._container.layoutManager.getComponent(e)||this._container.layoutManager.getFallbackComponent();if(!t)throw new Error('React component "'+e+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return t}_getReactComponent(){var e={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},t=M.extend(e,this._container._config.props);return j.createElement(this._reactClass,t)}}var Fr=["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"],Kv=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function Hi(n){if(Fr.length>36)throw new Error("Too many keys in config minifier map");var e={};return Bi(n,e,"_min"),e}function bi(n){if(Fr.length>36)throw new Error("Too many keys in config minifier map");var e={};return Bi(n,e,"_max"),e}function Bi(n,e,t){var r=t==="_min"?zv:Gv;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,Fr);e[s]=a}Bi(o,a,t)}else{var l=r(o,Kv);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var d=r(i,Fr);e[d]=l}}}}function zv(n,e){if(typeof n=="string"&&n.length===1)return"___"+n;var t=e.indexOf(n);return t===-1?n:t.toString(36)}function Gv(n,e){return typeof n=="string"&&n.length===1?e[parseInt(n,36)]:typeof n=="string"&&n.substr(0,3)==="___"?n[3]:n}function oi(n,e,t){return e=qv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qv(n){var e=Zv(n,"string");return typeof e=="symbol"?e:String(e)}function Zv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class yi{constructor(e,t){oi(this,"name",void 0),oi(this,"origin",void 0),oi(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function pr(n,e,t){return e=Xv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xv(n){var e=Yv(n,"string");return typeof e=="symbol"?e:String(e)}function Yv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}let Qv=class extends vt{constructor(e){super(),pr(this,"_layoutManager",void 0),pr(this,"_dontPropagateToParent",void 0),pr(this,"_childEventSource",void 0),pr(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(vt.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),M(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(){M(window).off("gl_child_event",this._boundOnEventFromChild)}};const ml=Qv;function fl(n,e,t){return n.on(e,t),()=>{n.off(e,t)}}function vl(n){return(e,t)=>fl(e,n,t)}function gl(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 pl(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?.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 Jv(n){return{listen:vl(n),emit:gl(n),useListener:pl(n)}}const eg=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:yi,DragListener:or,EventEmitter:vt,EventHub:ml,ReactComponentHandler:cl,animFrame:ji,filterXss:$v,getHashValue:ul,getQueryStringParam:hl,getUniqueId:Lr,listenForEvent:fl,makeEmitFunction:gl,makeEventFunctions:Jv,makeListenFunction:vl,makeUseListenerFunction:pl,minifyConfig:Hi,removeFromArray:jv,stripTags:$i,unminifyConfig:bi},Symbol.toStringTag,{value:"Module"}));function jt(n,e,t){return e=tg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tg(n){var e=ng(n,"string");return typeof e=="symbol"?e:String(e)}function ng(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class bl extends vt{constructor(e,t,r,i,o){super(),jt(this,"isInitialised",!1),jt(this,"_config",void 0),jt(this,"_dimensions",void 0),jt(this,"_parentId",void 0),jt(this,"_indexInParent",void 0),jt(this,"_layoutManager",void 0),jt(this,"_popoutWindow",null),jt(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,d,h,c;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=(d=this._popoutWindow)===null||d===void 0?void 0:d.screenY)!==null&&l!==void 0?l:(h=this._popoutWindow)===null||h===void 0?void 0:h.screenTop)!==null&&s!==void 0?s:0},content:(c=this.getGlInstance())===null||c===void 0?void 0:c.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=M.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;M(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-"+Lr();e=Hi(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 _e(n,e,t){return e=rg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function rg(n){var e=ig(n,"string");return typeof e=="symbol"?e:String(e)}function ig(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class vn extends vt{constructor(e,t,r,i,o,a){var s,l,d,h,c,f,v,p;if(super(),_e(this,"_dragListener",void 0),_e(this,"_layoutManager",void 0),_e(this,"_contentItem",void 0),_e(this,"_originalParent",void 0),_e(this,"_area",null),_e(this,"_lastValidArea",null),_e(this,"_minX",void 0),_e(this,"_maxX",void 0),_e(this,"_minY",void 0),_e(this,"_maxY",void 0),_e(this,"_width",void 0),_e(this,"_height",void 0),_e(this,"_sided",void 0),_e(this,"element",void 0),_e(this,"childElementContainer",void 0),_e(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,y;this._layoutManager.tabDropPlaceholder.width((g=this._contentItem.tab.element.outerWidth(!0))!==null&&g!==void 0?g:0),this._layoutManager.tabDropPlaceholder.height((y=this._contentItem.tab.element.outerHeight(!0))!==null&&y!==void 0?y:0)}if(this.element=M(vn._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",$i((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(),M(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var P,O;this._layoutManager.tabDropPlaceholder.width((P=this._proxyTab.outerWidth(!0))!==null&&P!==void 0?P:0),this._layoutManager.tabDropPlaceholder.height((O=this._proxyTab.outerHeight(!0))!==null&&O!==void 0?O:0)}var _=this._layoutManager.container.offset();this._minX=(d=_?.left)!==null&&d!==void 0?d:0,this._minY=(h=_?.top)!==null&&h!==void 0?h:0,this._maxX=((c=this._layoutManager.container.width())!==null&&c!==void 0?c:0)+this._minX,this._maxY=((f=this._layoutManager.container.height())!==null&&f!==void 0?f:0)+this._minY,this._width=(v=this.element.width())!==null&&v!==void 0?v:0,this._height=(p=this.element.height())!==null&&p!==void 0?p: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")}}_e(vn,"_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 br(n,e,t){return e=og(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function og(n){var e=ag(n,"string");return typeof e=="symbol"?e:String(e)}function ag(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class yl{constructor(e,t,r){br(this,"_element",void 0),br(this,"_itemConfig",void 0),br(this,"_layoutManager",void 0),br(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=r,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new or(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this),this._dragListener}_onDragStart(e,t){var r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(M.extend(!0,{},r));new vn(e,t,this._dragListener,this._layoutManager,i,null)}}function yr(n,e,t){return e=sg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sg(n){var e=lg(n,"string");return typeof e=="symbol"?e:String(e)}function lg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Cl{constructor(e,t,r){yr(this,"_element",M(window)),yr(this,"_itemConfig",void 0),yr(this,"_layoutManager",void 0),yr(this,"_dragListener",void 0),this._itemConfig=e,this._layoutManager=t,this._createDragListener(r)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&(this._dragListener=new or(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._destroy,this),this._dragListener.onMouseDown(e),this._dragListener._startDrag())}_destroy(){this._dragListener=void 0,this._element=void 0,this._itemConfig=void 0,this._layoutManager=void 0}_onDragStart(e,t){if(!(!this._dragListener||!this._layoutManager)){var r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(M.extend(!0,{},r));new vn(e,t,this._dragListener,this._layoutManager,i,null)}}}function Sl(n,e,t){return e=dg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function dg(n){var e=ug(n,"string");return typeof e=="symbol"?e:String(e)}function ug(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ar{constructor(){Sl(this,"element",M(ar._template)),M(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()}}Sl(ar,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function ai(n,e,t){return e=hg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function hg(n){var e=cg(n,"string");return typeof e=="symbol"?e:String(e)}function cg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Kn{constructor(e,t,r,i){ai(this,"element",void 0),ai(this,"_header",void 0),ai(this,"_action",void 0),this._header=e,this.element=M('<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 mg(n,e,t){return e=fg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fg(n){var e=vg(n,"string");return typeof e=="symbol"?e:String(e)}function vg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class gg extends Error{constructor(e,t){super(),mg(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const an=gg,pg=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:an},Symbol.toStringTag,{value:"Module"}));function Se(n,e,t){return e=bg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bg(n){var e=yg(n,"string");return typeof e=="symbol"?e:String(e)}function yg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function sn(n){return n.isStack}function Ze(n){return n.isComponent}function wl(n){return n.isRoot}class Oe extends vt{constructor(e,t,r,i){super(),Se(this,"config",void 0),Se(this,"type",void 0),Se(this,"contentItems",void 0),Se(this,"parent",void 0),Se(this,"layoutManager",void 0),Se(this,"element",void 0),Se(this,"childElementContainer",void 0),Se(this,"componentName",void 0),Se(this,"isInitialised",!1),Se(this,"isMaximised",!1),Se(this,"isRoot",!1),Se(this,"isRow",!1),Se(this,"isColumn",!1),Se(this,"isStack",!1),Se(this,"isComponent",!1),Se(this,"tab",void 0),Se(this,"_pendingEventPropagations",void 0),Se(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(vt.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?.replaceChild(t.element[0],e.element[0]),r===!0&&(e.parent=null,e._$destroy()),this.contentItems[i]=t,t.parent=this,sn(this)&&(this.header.tabs[i].contentItem=t),t.parent.isInitialised===!0&&t.isInitialised===!1&&t._$init(),this.callDownwards("setSize")}remove(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}popout(){var e=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),e}toggleMaximise(e){e&&e.preventDefault(),this.isMaximised===!0?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximised=!this.isMaximised,this.emitBubblingEvent("stateChanged")}select(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))}deselect(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))}setTitle(e){this.config.title=e,this.emit("titleChanged",e),this.emitBubblingEvent("stateChanged")}hasId(e){if(this.config.id){if(typeof this.config.id=="string")return this.config.id===e;if(this.config.id instanceof Array)return this.config.id.indexOf(e)!==-1}else return!1}addId(e){this.hasId(e)||(this.config.id?typeof this.config.id=="string"?this.config.id=[this.config.id,e]:this.config.id instanceof Array&&this.config.id.push(e):this.config.id=e)}removeId(e){if(!this.hasId(e))throw new Error("Id not found");if(typeof this.config.id=="string")delete this.config.id;else if(this.config.id instanceof Array){var t=this.config.id.indexOf(e);this.config.id.splice(t,1)}}getItemsByFilter(e){var t=[],r=function i(o){for(var a=0;a<o.contentItems.length;a++)e(o.contentItems[a])===!0&&t.push(o.contentItems[a]),i(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&&Ze(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 yi(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new an("content must be an Array",e);for(var r=0;r<e.content.length;r++)t=this.layoutManager.createContentItem(e.content[r],this),this.contentItems.push(t)}_extendItemNode(e){for(var[t,r]of Object.entries(dl)){var i=t;e[i]===void 0&&(e[i]=r)}return e}_propagateEvent(e,t){t instanceof yi&&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,ji(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function kn(n,e,t){return e=Cg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cg(n){var e=Sg(n,"string");return typeof e=="symbol"?e:String(e)}function Sg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class El extends Oe{constructor(e,t,r){var i;Object.entries((i=e.config.settings.defaultComponentConfig)!==null&&i!==void 0?i:{}).forEach(s=>{var[l,d]=s;t[l]===void 0&&(t[l]=d)}),super(e,t,r,M()),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=M.extend(!0,{},this.config.componentState||{});if(o==null)throw new an('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 pi(this.config,this,e),this.instance=new o(this.container,a),this.element=this.container._element}close(){this.parent.removeChild(this)}setSize(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())}_$init(){Oe.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),Oe.prototype._$hide.call(this)}_$show(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),Oe.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),Oe.prototype._$destroy.call(this)}_$getArea(){return null}}function rt(n,e,t){return e=wg(e),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:String(e)}function Eg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Rr extends Oe{constructor(e,t,r,i){super(t,r,i,M('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),rt(this,"isRow",void 0),rt(this,"isColumn",void 0),rt(this,"childElementContainer",void 0),rt(this,"parent",void 0),rt(this,"_splitter",[]),rt(this,"_splitterSize",void 0),rt(this,"_splitterGrabSize",void 0),rt(this,"_isColumn",void 0),rt(this,"_dimension",void 0),rt(this,"_splitterPosition",null),rt(this,"_splitterMinPosition",null),rt(this,"_splitterMaxPosition",null),this.parent=i,this.isRow=!e,this.isColumn=e,this.childElementContainer=this.element,this._splitterSize=t.config.dimensions.borderWidth,this._splitterGrabSize=t.config.dimensions.borderGrabWidth,this._isColumn=e,this._dimension=e?"height":"width",this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null}addChild(e,t,r){var i,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),Oe.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 d;this.contentItems[s].config[this._dimension]=((d=this.contentItems[s].config[this._dimension])!==null&&d!==void 0?d:0)+i/(this.contentItems.length-1)}Oe.prototype.removeChild.call(this,e,t),this.contentItems.length===1&&this.config.isClosable===!0?(l=this.contentItems[0],this.contentItems=[],this.parent.replaceChild(this,l,!0)):(this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged"))}replaceChild(e,t){var r=e.config[this._dimension];super.replaceChild(e,t),t.config[this._dimension]=r,this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(){this.contentItems.length>0&&(this._calculateRelativeSizes(),this._setAbsoluteSizes()),this.emitBubblingEvent("stateChanged"),this.emit("resize")}_$init(){if(this.isInitialised!==!0){var e;for(Oe.prototype._$init.call(this),e=0;e<this.contentItems.length-1;e++)this.contentItems[e].element.after(this._createSplitter(e).element)}}_setAbsoluteSizes(){var e,t=this._calculateAbsoluteSizes();for(e=0;e<this.contentItems.length;e++)t.additionalPixel-e>0&&t.itemSizes[e]++,this._isColumn?(this.contentItems[e].element.width(t.totalWidth),this.contentItems[e].element.height(t.itemSizes[e])):(this.contentItems[e].element.width(t.itemSizes[e]),this.contentItems[e].element.height(t.totalHeight))}_calculateAbsoluteSizes(){var e,t,r=(this.contentItems.length-1)*this._splitterSize,i=(e=this.element.width())!==null&&e!==void 0?e:0,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 d,h,c=this._isColumn?Math.floor(o*(((d=this.contentItems[l].config.height)!==null&&d!==void 0?d:0)/100)):Math.floor(i*(((h=this.contentItems[l].config.width)!==null&&h!==void 0?h:0)/100));a+=c,s.push(c)}var f=Math.floor((this._isColumn?o:i)-a);return{itemSizes:s,additionalPixel:f,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 d;this.contentItems[l].config[r]=((d=this.contentItems[l].config[r])!==null&&d!==void 0?d:0)/e*100}this._respectMinItemWidth()}_respectMinItemWidth(){var e,t=this.layoutManager.config.dimensions&&(e=this.layoutManager.config.dimensions.minItemWidth)!==null&&e!==void 0?e:0,r=[],i=0,o=0,a=0,s=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var d=this._calculateAbsoluteSizes(),h=0;h<this.contentItems.length;h++){this.contentItems[h];var c=d.itemSizes[h];c<t?(o+=t-c,l={width:t}):(i+=c-t,l={width:c},r.push(l)),s.push(l)}if(!(o===0||o>i)){var f=o/i;a=o;for(var v=0;v<r.length;v++){l=r[v];var p=Math.round((l.width-t)*f);a-=p,l.width-=p}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/d.totalWidth*100}}}_createSplitter(e){var t;return t=new _l(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:[]),d=this._isColumn?l.vertical:l.horizontal,h=this._getMinimumDimensions((r=a.after.config.content)!==null&&r!==void 0?r:[]),c=this._isColumn?h.vertical:h.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((i=a.before.element[this._dimension]())!==null&&i!==void 0?i:0)-(d||s)),this._splitterMaxPosition=((o=a.after.element[this._dimension]())!==null&&o!==void 0?o:0)-(c||s)}_onSplitterDrag(e,t,r){var i=this._isColumn?r:t;this._splitterMaxPosition==null||this._splitterMinPosition==null||i>this._splitterMinPosition&&i<this._splitterMaxPosition&&(this._splitterPosition=i,e.element.css(this._isColumn?"top":"left",i))}_onSplitterDragStop(e){var t,r,i,o,a,s=this._getItemsForSplitter(e),l=(t=s.before.element[this._dimension]())!==null&&t!==void 0?t:0,d=(r=s.after.element[this._dimension]())!==null&&r!==void 0?r:0,h=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+d),c=((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]=h*c,s.after.config[this._dimension]=(1-h)*c,e.element.css({top:0,left:0}),ji(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function aa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function sa(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?aa(Object(t),!0).forEach(function(r){Ci(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):aa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ci(n,e,t){return e=_g(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _g(n){var e=Pg(n,"string");return typeof e=="symbol"?e:String(e)}function Pg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Si extends Oe{constructor(e,t,r){super(e,sa(sa({},t),{},{type:"root"}),null,M('<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(Ze(e)&&(r=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this),r._$init(),r.addChild(e),e=r),!this.contentItems.length)this.addChild(e);else{var{side:i}=t,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 Rr)||l.type!=o){var d=this.layoutManager.createContentItem({type:o},this);this.replaceChild(l,d),d.addChild(e,s?0:void 0,!0),d.addChild(l,s?void 0:0,!0),l.config[a]=50,e.config[a]=50,d.callDownwards("setSize")}else{var h,c=l.contentItems[s?0:l.contentItems.length-1];l.addChild(e,s?0:void 0,!0),c.config[a]=((h=c.config[a])!==null&&h!==void 0?h:0)*.5,e.config[a]=c.config[a],l.callDownwards("setSize")}}}}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 yn(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){Be(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 Be(n,e,t){return e=Tg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Tg(n){var e=Og(n,"string");return typeof e=="symbol"?e:String(e)}function Og(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class wi extends Oe{constructor(e,t,r){var i,o,a,s,l,d,h,c,f;super(e,t,r,M('<div class="lm_item lm_stack"></div>')),Be(this,"_activeContentItem",null),Be(this,"_header",void 0),Be(this,"childElementContainer",M('<div class="lm_items"></div>')),Be(this,"header",void 0),Be(this,"parent",void 0),Be(this,"isStack",!0),Be(this,"_dropZones",{}),Be(this,"_dropSegment",null),Be(this,"_contentAreaDimensions",null),Be(this,"_dropIndex",void 0),Be(this,"_side",void 0),Be(this,"_sided",!1),Be(this,"config",void 0),this.parent=r,this.config=t;var v=e.config;this._side=!1,this._header={show:((i=v.settings)===null||i===void 0?void 0:i.hasHeaders)&&t.hasHeaders!==!1,popout:(o=v.settings)!==null&&o!==void 0&&o.showPopoutIcon?(a=v.labels)===null||a===void 0?void 0:a.popout:void 0,maximise:(s=v.settings)!==null&&s!==void 0&&s.showMaximiseIcon?(l=v.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(d=v.settings)!==null&&d!==void 0&&d.showCloseIcon?(h=v.labels)===null||h===void 0?void 0:h.close:void 0,minimise:(c=(f=v.labels)===null||f===void 0?void 0:f.minimise)!==null&&c!==void 0?c:void 0},v.header&&(this._header=yn(yn({},this._header),v.header)),t.header&&(this._header=yn(yn({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=yn(yn({},this._header),t.content[0].header)),this.header=new Lt(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){if(this.contentItems.indexOf(e)===-1)throw new Error("contentItem is not a child of this stack");this._activeContentItem!==null&&this._activeContentItem._$hide(),this._activeContentItem=e,this.header.setActiveContentItem(e),e._$show(),this.emit("activeContentItemChanged",e),this.layoutManager.emit("activeContentItemChanged",e),this.emitBubblingEvent("stateChanged")}getActiveContentItem(){return this.header.activeContentItem}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),super.addChild(e,t),this.childElementContainer.append(e.element),this.header.createTab(e,t),this.setActiveContentItem(e),this.callDownwards("setSize"),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}removeChild(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=this.contentItems.indexOf(e);super.removeChild(e,t),this.header.removeTab(e),this.header.activeContentItem===e&&(this.contentItems.length>0?this.setActiveContentItem(this.contentItems[Math.max(r-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}_$validateClosability(){for(var e=this.header._isClosable(),t=0,r=this.contentItems.length;t<r;t++){var i;if(!e)break;e=(i=this.contentItems[t].config.isClosable)!==null&&i!==void 0?i:!1}this.header._$setClosable(e)}_$destroy(){Oe.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=t&&this.parent.isColumn||r&&this.parent.isRow,a=t?"column":"row",s=t?"height":"width";if(Ze(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(o){var d,h=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?h:h+1,!0),this.config[s]=((d=this.config[s])!==null&&d!==void 0?d:0)*.5,e.config[s]=this.config[s],this.parent.callDownwards("setSize")}else{var c=this.layoutManager.createContentItem({type:a},this);this.parent.replaceChild(this,c),c.addChild(e,i?0:void 0,!0),c.addChild(this,i?void 0:0,!0),this.config[s]=50,e.config[s]=50,c.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[r,i]of Object.entries(this._contentAreaDimensions)){var o=i.hoverArea;if(o.x1<e&&o.x2>e&&o.y1<t&&o.y2>t){r==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(r));return}}}_$getArea(){if(this.element.is(":visible")===!1)return null;var e=super._$getArea(this.header.element),t=super._$getArea(this.childElementContainer);if(e==null||t==null)return null;var r=t.x2-t.x1,i=t.y2-t.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}},this._activeContentItem&&this._activeContentItem.isComponent===!1?e:this.contentItems.length===0?(this._contentAreaDimensions.body={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}},super._$getArea(this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x1+r*.25,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x1+r*.5,y2:t.y2}},this._contentAreaDimensions.top={hoverArea:{x1:t.x1+r*.25,y1:t.y1,x2:t.x1+r*.75,y2:t.y1+i*.5},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y1+i*.5}},this._contentAreaDimensions.right={hoverArea:{x1:t.x1+r*.75,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1+r*.5,y1:t.y1,x2:t.x2,y2:t.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:t.x1+r*.25,y1:t.y1+i*.5,x2:t.x1+r*.75,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1+i*.5,x2:t.x2,y2:t.y2}},super._$getArea(this.element))}_highlightHeaderDropZone(e){var t,r,i,o,a,s,l,d,h,c,f,v,p,g,y,P,O=this.header.tabs.length;if(O===0){var _,R,U,Q,N,B,$,Y,ne=this.header.element.offset();(_=this.layoutManager.dropTargetIndicator)===null||_===void 0||_.highlightArea({x1:(R=ne?.left)!==null&&R!==void 0?R:0,x2:((U=ne?.left)!==null&&U!==void 0?U:0)+100,y1:(Q=(N=this.header.element.offset())===null||N===void 0?void 0:N.top)!==null&&Q!==void 0?Q:0,y2:((B=($=this.header.element.offset())===null||$===void 0?void 0:$.top)!==null&&B!==void 0?B:0)+((Y=this.header.element.innerHeight())!==null&&Y!==void 0?Y:0)});return}var F=this.header.tabsContainer,q=(t=F.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),K=(r=this.layoutManager.tabDropPlaceholder.get(0))===null||r===void 0?void 0:r.getBoundingClientRect();if(!(!q||!K)){e<q.left?e=q.left+1:e>q.right&&(e=q.right-1);var A,V;if(!(K.left<e&&e<K.right)){for(var z=0;z<O;z++){var me;if(A=this.header.tabs[z].element,V=(me=A.get(0))===null||me===void 0?void 0:me.getBoundingClientRect(),V&&V.left<e&&e<V.right){this._dropIndex=z;break}}if(A&&V&&e<V.left+V.width*.5)A.before(this.layoutManager.tabDropPlaceholder);else if(A){var je;this._dropIndex=Math.min(((je=this._dropIndex)!==null&&je!==void 0?je:0)+1,O),A.after(this.layoutManager.tabDropPlaceholder)}}var Ie=(i=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&i!==void 0?i:0;Ie=Math.max(Ie,(a=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&a!==void 0?a:0);var b=Ie+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);b=Math.min(b,((d=(h=this.header.tabsContainer.offset())===null||h===void 0?void 0:h.left)!==null&&d!==void 0?d:0)+((c=this.header.tabsContainer.innerWidth())!==null&&c!==void 0?c:0)),(f=this.layoutManager.dropTargetIndicator)===null||f===void 0||f.highlightArea({x1:Ie,x2:b,y1:(v=(p=this.header.element.offset())===null||p===void 0?void 0:p.top)!==null&&v!==void 0?v:0,y2:((g=(y=this.header.element.offset())===null||y===void 0?void 0:y.top)!==null&&g!==void 0?g:0)+((P=this.header.element.innerHeight())!==null&&P!==void 0?P:0)})}}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){var e=["right","left","bottom"].some(r=>r===this._header.show)?this._header.show:void 0;if(this.header.element.toggle(!!this._header.show),!!e&&(this._side=e,this._sided=["right","left"].indexOf(this._side.toString())>=0,this.element.removeClass("lm_left lm_right lm_bottom"),this._side&&this.element.addClass("lm_"+this._side),this.element.find(".lm_header").length&&this.childElementContainer)){var t=["right","bottom"].indexOf(this._side.toString())>=0?"before":"after";this.header.element[t](this.childElementContainer),this.callDownwards("setSize")}}_highlightBodyDropZone(e){var t,r,i=(t=this._contentAreaDimensions)===null||t===void 0||(r=t[e])===null||r===void 0?void 0:r.highlightArea;if(i){var o;(o=this.layoutManager.dropTargetIndicator)===null||o===void 0||o.highlightArea(i)}this._dropSegment=e}}const Ig=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:Oe,Component:El,ContentItem:Oe,Root:Si,RowOrColumn:Rr,Stack:wi,isComponent:Ze,isRoot:wl,isStack:sn},Symbol.toStringTag,{value:"Module"}));function Dt(n,e,t){return e=Dg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Dg(n){var e=xg(n,"string");return typeof e=="symbol"?e:String(e)}function xg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class sr{constructor(e,t){var r;Dt(this,"header",void 0),Dt(this,"contentItem",void 0),Dt(this,"element",M(sr._template)),Dt(this,"titleElement",void 0),Dt(this,"closeElement",void 0),Dt(this,"isActive",!1),Dt(this,"_layoutManager",void 0),Dt(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 or(this.element),this._dragListener.on("dragStart",this._onDragStart,this),this.contentItem.on("destroy",this._dragListener.destroy,this._dragListener)),this._onTabClick=this._onTabClick.bind(this),this._onCloseClick=this._onCloseClick.bind(this),this._onTabContentFocusIn=this._onTabContentFocusIn.bind(this),this._onTabContentFocusOut=this._onTabContentFocusOut.bind(this),this.element.on("click",this._onTabClick),this.element.on("auxclick",this._onTabClick),this.contentItem.config.isClosable?(this.closeElement.on("click",this._onCloseClick),this.closeElement.on("mousedown",this._onCloseMousedown)):this.closeElement.remove(),this.contentItem.tab=this,this.contentItem.emit("tab",this),this.contentItem.layoutManager.emit("tabCreated",this),Ze(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)}setActive(e){e!==this.isActive&&(this.isActive=e,e?this.element.addClass("lm_active"):this.element.removeClass("lm_active"))}_$destroy(){this.element.off("click",this._onTabClick),this.element.off("auxclick",this._onTabClick),this.closeElement.off("click",this._onCloseClick),Ze(this.contentItem)&&(this.contentItem.container._contentElement.off(),this.contentItem.container._contentElement[0].removeEventListener("click",this._onTabContentFocusIn,!0)),this._dragListener&&(this.contentItem.off("destroy",this._dragListener.destroy,this._dragListener),this._dragListener.off("dragStart",this._onDragStart),this._dragListener=void 0),this.element.remove()}_onDragStart(e,t){var r;(r=this.contentItem.parent)!==null&&r!==void 0&&r.isMaximised&&this.contentItem.parent.toggleMaximise(),this._dragListener&&new vn(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(){M(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin")}_onTabContentFocusOut(){Ze(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&&Ze(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):Ze(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),Ze(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(),Ze(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onCloseMousedown(e){e.stopPropagation()}}Dt(sr,"_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 oe(n,e,t){return e=Mg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mg(n){var e=Ng(n,"string");return typeof e=="symbol"?e:String(e)}function Ng(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Lt extends vt{constructor(e,t){var r,i;super(),oe(this,"layoutManager",void 0),oe(this,"element",M(Lt._template)),oe(this,"tabsContainer",void 0),oe(this,"tabDropdownContainer",void 0),oe(this,"tabDropdownSearch",void 0),oe(this,"tabDropdownList",null),oe(this,"controlsContainer",void 0),oe(this,"parent",void 0),oe(this,"tabs",[]),oe(this,"activeContentItem",null),oe(this,"closeButton",null),oe(this,"tabDropdownButton",null),oe(this,"tabNextButton",M(Lt._nextButtonTemplate)),oe(this,"tabPreviousButton",M(Lt._previousButtonTemplate)),oe(this,"holdTimer",null),oe(this,"rAF",null),oe(this,"CLICK_TIMEOUT",500),oe(this,"START_SPEED",.01),oe(this,"ACCELERATION",5e-4),oe(this,"PADDING",10),oe(this,"SCROLL_LEFT","left"),oe(this,"SCROLL_RIGHT","right"),oe(this,"isDraggingTab",!1),oe(this,"isOverflowing",!1),oe(this,"isDropdownShown",!1),oe(this,"dropdownKeyIndex",0),oe(this,"_lastVisibleTabIndex",-1),oe(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 sr(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 d,h;l.scrollLeft=(d=(h=this.tabsContainer.get(0))===null||h===void 0?void 0:h.scrollWidth)!==null&&d!==void 0?d:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var r,i,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,d;if(this.tabsContainer.scrollLeft(t+i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((d=this.tabsContainer.innerWidth())!==null&&d!==void 0?d:0)===a.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((r=this.rAF)!==null&&r!==void 0?r:-1),this.rAF=window.requestAnimationFrame(h=>{var c,f,v=o||h,p=h-v,g=this.START_SPEED*p+.5*this.ACCELERATION*(p*p);g=Math.min(g,(c=(f=this.tabsContainer.get(0))===null||f===void 0?void 0:f.scrollWidth)!==null&&c!==void 0?c:1/0),this._handleScrollRepeat(e,t,g,v)})}}_$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(),M(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 Kn(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 Kn(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 Kn(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 Kn(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"),M(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"),M(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,d){if(d==null||d.length<2)return-1;for(var h=(s+l+d.length)%d.length;h!==s;){if(d.eq(h).css("display")!=="none")return h;h=(h+l+d.length)%d.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(),M(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=M(window).height())!==null&&r!==void 0?r:0,l=(i=M(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var d=this.tabDropdownButton.element[0].getBoundingClientRect(),h=o<s-d.bottom,c=!h&&d.bottom>s*.6,f=Math.min(d.left+(c?d.width:0),l-a.width-this.PADDING),v=c?Math.max(d.top-o,this.PADDING):d.bottom,p=s-v-this.PADDING;this.tabDropdownContainer.css({"max-height":p,top:v,left:f})}}}}_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()}}}}oe(Lt,"_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(""));oe(Lt,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));oe(Lt,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function jn(n,e,t){return e=Ag(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ag(n){var e=Lg(n,"string");return typeof e=="symbol"?e:String(e)}function Lg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class _l{constructor(e,t,r){jn(this,"_isVertical",void 0),jn(this,"_size",void 0),jn(this,"_grabSize",void 0),jn(this,"_dragListener",void 0),jn(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=r<t?t:r,this.element=this._createElement(),this._dragListener=new or(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=M('<div class="lm_drag_handle"></div>'),t=M('<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 Fg=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:bl,DragProxy:vn,DragSource:yl,DragSourceFromEvent:Cl,DropTargetIndicator:ar,Header:Lt,HeaderButton:Kn,Splitter:_l,Tab:sr},Symbol.toStringTag,{value:"Module"}));var Rg={config:Nv,container:kv,controls:Fg,errors:pg,items:Ig,utils:eg};const kg=Rg;function da(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 $e(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?da(Object(t),!0).forEach(function(r){ie(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):da(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ie(n,e,t){return e=jg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jg(n){var e=$g(n,"string");return typeof e=="symbol"?e:String(e)}function $g(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Pl extends vt{static minifyConfig(e){return Hi(e)}static unminifyConfig(e){return bi(e)}constructor(e,t){super(),ie(this,"isInitialised",!1),ie(this,"_isFullPage",!1),ie(this,"_resizeTimeoutId",void 0),ie(this,"_components",{"lm-react-component":cl}),ie(this,"_fallbackComponent",void 0),ie(this,"_itemAreas",[]),ie(this,"_maximisedItem",null),ie(this,"_maximisePlaceholder",M('<div class="lm_maximise_place"></div>')),ie(this,"_creationTimeoutPassed",!1),ie(this,"_subWindowsCreated",!1),ie(this,"_dragSources",[]),ie(this,"_updatingColumnsResponsive",!1),ie(this,"_firstLoad",!0),ie(this,"_reactChildMap",new Map),ie(this,"_reactChildren",null),ie(this,"_initialHeaderHeight",void 0),ie(this,"width",null),ie(this,"height",null),ie(this,"root",void 0),ie(this,"openPopouts",[]),ie(this,"selectedItem",null),ie(this,"isSubWindow",!1),ie(this,"eventHub",new ml(this)),ie(this,"config",void 0),ie(this,"container",void 0),ie(this,"_originalContainer",void 0),ie(this,"dropTargetIndicator",null),ie(this,"tabDropPlaceholder",M('<div class="lm_drop_tab_placeholder"></div>')),ie(this,"_typeToItem",void 0),this._onResize=this._onResize.bind(this),this._onUnload=this._onUnload.bind(this),this._windowBlur=this._windowBlur.bind(this),this._windowFocus=this._windowFocus.bind(this),this.config=this._createConfig(e),this._originalContainer=t,this.container=this._getContainer(),this._initialHeaderHeight=this.config.dimensions.headerHeight,this.isSubWindow&&M("body").css("visibility","hidden"),this._typeToItem={column:Rr.bind(this,!0),row:Rr.bind(this,!1),stack:wi,component:El}}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 Oe))throw new Error("Root must be a ContentItem");var t={settings:$e({},this.config.settings),dimensions:$e({},this.config.dimensions),labels:$e({},this.config.labels),content:[]},r=function o(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 d=0;d<s.contentItems.length;d++)a.content[d]={},o(a.content[d],s.contentItems[d])}};e?r(t,{contentItems:[e]}):r(t,this.root),this._$reconcilePopoutWindows(),t.openPopouts=[];for(var i=0;i<this.openPopouts.length;i++)t.openPopouts.push(this.openPopouts[i].toConfig());return t.maximisedItemId=this._maximisedItem?"__glMaximised":void 0,t}getComponent(e){return this._components[e]}getFallbackComponent(){return this._fallbackComponent}init(){if(this._subWindowsCreated===!1&&(this._createSubWindows(),this._subWindowsCreated=!0),document.readyState==="loading"||document.body===null){M(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 ar,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(),M(window).off("resize",this._onResize),M(window).off("unload beforeunload",this._onUnload),M(window).off("blur.lm").off("focus.lm"),this.root.callDownwards("_$destroy",[],!0),this.root.contentItems=[],this.tabDropPlaceholder.remove(),(e=this.dropTargetIndicator)===null||e===void 0||e.destroy(),this.eventHub.destroy(),this._dragSources.forEach(function(t){t._dragListener.destroy()}),this._dragSources=[])}createContentItem(e,t){var r,i,o;if(typeof e.type!="string")throw new an("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!this._typeToItem[e.type])throw i="Unknown type '"+e.type+"'. Valid types are "+Object.keys(this._typeToItem).join(","),new an(i);return e.type==="component"&&!(t instanceof wi)&&t&&!(this.isSubWindow===!0&&t instanceof Si)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),e.id=(r=e.id)!==null&&r!==void 0?r:Lr(),o=new this._typeToItem[e.type](this,e,t),o}createPopout(e,t,r,i){var o=[],a=e instanceof Oe,s=this;if(a){var l;o=this.toConfig(e).content,r=Lr();for(var d=e.parent,h=e;((c=d)===null||c===void 0?void 0:c.contentItems.length)===1&&!d.isRoot;){var c;h=d,d=d.parent}if((l=d)===null||l===void 0||l.addId(r),i==null||Number.isNaN(i)){var f;i=(f=d)===null||f===void 0?void 0:f.contentItems.indexOf(h)}}else e instanceof Array?o=e:o=[e];if(!t&&a){var v,p,g,y=window.screenX||window.screenLeft,P=window.screenY||window.screenTop,O=(v=e.element.offset())!==null&&v!==void 0?v:{left:0,top:0};t={left:y+O.left,top:P+O.top,width:(p=e.element.width())!==null&&p!==void 0?p: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 _=new bl(o,t,r,i,this);return _.on("initialised",function(){s.emit("windowOpened",_)}),_.on("closed",function(){s._$reconcilePopoutWindows()}),this.openPopouts.push(_),_}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var r=new yl(e,t,this);return this._dragSources.push(r),r}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new Cl(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=$e({},this.root._$getArea()),r=[$e($e({},t),{},{side:"left",x2:t.x1+e}),$e($e({},t),{},{side:"right",x1:t.x2-e}),$e($e({},t),{},{side:"top",y2:t.y1+e}),$e($e({},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(sn(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=$e($e({},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 Oe)return e;if(M.isPlainObject(e)&&e.type){var r=this.createContentItem(e,t);return r.callDownwards("_$init"),r}else throw new Error("Invalid contentItem")}_$reconcilePopoutWindows(){for(var e=[],t=0;t<this.openPopouts.length;t++){var r;((r=this.openPopouts[t].getWindow())===null||r===void 0?void 0:r.closed)===!1?e.push(this.openPopouts[t]):this.emit("windowClosed",this.openPopouts[t])}this.openPopouts.length!==e.length&&(this.emit("stateChanged"),this.openPopouts=e)}_getAllContentItems(){var e=[],t=r=>{if(e.push(r),r.contentItems instanceof Array)for(var i=0;i<r.contentItems.length;i++)t(r.contentItems[i])};return t(this.root),e}_bindEvents(){this._isFullPage&&M(window).resize(this._onResize),M(window).on("unload beforeunload",this._onUnload).on("blur.lm",this._windowBlur).on("focus.lm",this._windowFocus)}_windowBlur(){this.root.element.addClass("lm_window_blur")}_windowFocus(){this.root.element.removeClass("lm_window_blur")}_onResize(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(this.updateSize.bind(this),100)}_createConfig(e){var t,r=hl("gl-window");r&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(r)||"{}"),e=bi(e),localStorage.removeItem(r)),e=M.extend(!0,{},sl,e);var i=function o(a){for(var s in a){var l=a[s];s!=="props"&&typeof l=="object"&&l!=null?o(l):s==="type"&&l==="react-component"&&(a.type="component",a.componentName="lm-react-component")}};return i(e),((t=e.settings)===null||t===void 0?void 0:t.hasHeaders)===!1&&(e.dimensions.headerHeight=0),e}_adjustToWindowMode(){var e,t=M('<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=$i((e=this.config.content[0].title)!==null&&e!==void 0?e:""),M("head").append(M("body link, body style, template, .gl_keep")),this.container=M("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?M(this._originalContainer):M("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,M("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 an(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new an(t,e);this.root=new Si(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 d=a.contentItems[a.contentItems.length-1];this._addChildContentItemsToContainer(s,d)}this._updatingColumnsResponsive=!1}}}_useResponsiveLayout(){return this.config.settings&&(this.config.settings.responsiveMode=="always"||this.config.settings.responsiveMode=="onload"&&this._firstLoad)}_addChildContentItemsToContainer(e,t){t.type==="stack"?t.contentItems.forEach(function(r){e.addChild(r),t.removeChild(r,!0)}):t.contentItems.forEach(r=>{this._addChildContentItemsToContainer(e,r)})}_findAllStackContainers(){var e=[];return this._findAllStackContainersRecursive(e,this.root),e}_findAllStackContainersRecursive(e,t){t.contentItems.forEach(r=>{sn(r)?e.push(r):r.isComponent||this._findAllStackContainersRecursive(e,r)})}}ie(Pl,"__lm",kg);const Hg=Pl,Bg="_lm_dragging_k4a5m_1",Wg="_lm_goldenlayout_k4a5m_1",Ug="_lm_header_k4a5m_1",Vg="_lm_controls_k4a5m_1",Kg="_lm_tabpreviousbutton_k4a5m_1",zg="_lm_tabnextbutton_k4a5m_1",Gg="_lm_tab_k4a5m_1",qg="_lm_active_k4a5m_1",Zg="_lm_close_tab_k4a5m_1",Xg="_lm_content_k4a5m_1",Yg="_lm_dragProxy_k4a5m_1",Qg="_lm_dropTargetIndicator_k4a5m_1",Jg="_march_k4a5m_1",ep="_lm_inner_k4a5m_1",tp="_lm_splitter_k4a5m_1",np="_lm_selectable_k4a5m_1",rp="_lm_tabdropdown_list_k4a5m_1",ip="_lm_title_k4a5m_1",op="_lm_title_before_k4a5m_1",ap="_lm_selected_k4a5m_1",sp="_lm_focusin_k4a5m_1",lp="_lm_window_blur_k4a5m_1",dp="_lm_popout_k4a5m_1",up="_lm_maximise_k4a5m_1",hp="_lm_tabdropdown_k4a5m_1",cp="_lm_close_k4a5m_1",mp="_lm_tabdropdown_search_k4a5m_1",fp="_lm_tabs_k4a5m_1",vp="_lm_keyboard_active_k4a5m_1",gp="_lm_maximised_k4a5m_1",pp="_lm_items_k4a5m_1",ua={"tab-height":"28px","drag-border-width":"5px",lm_dragging:Bg,lm_goldenlayout:Wg,lm_header:Ug,lm_controls:Vg,lm_tabpreviousbutton:Kg,lm_tabnextbutton:zg,lm_tab:Gg,lm_active:qg,lm_close_tab:Zg,lm_content:Xg,lm_dragProxy:Yg,lm_dropTargetIndicator:Qg,march:Jg,lm_inner:ep,lm_splitter:tp,lm_selectable:np,lm_tabdropdown_list:rp,lm_title:ip,lm_title_before:op,lm_selected:ap,lm_focusin:sp,lm_window_blur:lp,lm_popout:dp,lm_maximise:up,lm_tabdropdown:hp,lm_close:cp,lm_tabdropdown_search:mp,lm_tabs:fp,lm_keyboard_active:vp,lm_maximised:gp,lm_items:pp},ha=Object.freeze({tabHeight:parseInt(ua["tab-height"],10),dragBorderWidth:parseInt(ua["drag-border-width"],10)});function ca(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function It(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ca(Object(t),!0).forEach(function(r){Tl(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ca(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Tl(n,e,t){return e=bp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bp(n){var e=yp(n,"string");return typeof e=="symbol"?e:String(e)}function yp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var $t=W.module("LayoutUtils");function Ol(n){return n.componentName!==void 0}function En(n){var e=n;return(Ol(n)&&n.componentName==="lm-react-component"||n.type==="react-component")&&e.component!==void 0}function Cr(n){return n.focus!==void 0}function ma(n){return n.type==="stack"}class D{static activateTab(e,t){var r=D.getStackForRoot(e,t,!1);if(!r){$t.error("Could not find stack for config",t);return}var i=D.getContentItemInStack(r,t);i&&r.setActiveContentItem(i)}static isActiveTab(e,t){var r=D.getStackForRoot(e,t,!1);if(!r)return $t.error("Could not find stack for config",t),!1;var i=D.getContentItemInStack(r,t),o=r.getActiveContentItem();return o===i}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=t?"column":"row";if(wl(e)){(e.contentItems==null||e.contentItems.length===0)&&e.addChild({type:r});var i=e.contentItems[0],o=t?i.isColumn:i.isRow;if(!o){e.removeChild(i,!0),e.addChild({type: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;return l||(e.addChild({type:t?"row":"column"}),e.removeChild(s,!0),e.contentItems[e.contentItems.length-1].addChild(s),s=e.contentItems[e.contentItems.length-1]),this.addStack(s,!t)}static getStackById(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(i&&sn(e)&&e.contentItems.length===0)return e;if(t===((r=e.config)===null||r===void 0?void 0:r.id)){if(sn(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 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&&sn(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&&qi(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,d=D.getStackForRoot(e,{component:s},r&&l,i,o);if(d)return d}return null}static getContentItemInStack(e,t){if(!e)return null;for(var r=0;r<e.contentItems.length;r+=1){var i=e.contentItems[r];if(i.isComponent&&i.config!=null&&qi(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],{component:a,content:s}=o;if(a){var l=t(a,o);l!=null?r.push(l):$t.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(a,'"'))}else if(s){var d=It(It({},o),{},{content:D.dehydrateLayoutConfig(s,t)});r.push(d)}else r.push(o)}return r}static getTabPoint(e){var{tab:t}=e;if(t==null)throw new Error("Cannot get tab for panel container ".concat(e));var r=t.element[0].getBoundingClientRect();return[r.left+r.width*.5,r.bottom-8]}static dropLayoutMinorChange(e){for(var t=0;t<e.length;t+=1){var r=e[t],{content:i}=r;i!==void 0?(ma(r)&&delete r.activeItemIndex,D.dropLayoutMinorChange(i)):En(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=D.cloneLayout(e),o=D.cloneLayout(t);return r?(D.dropLayoutMinorChange(i),D.dropLayoutMinorChange(o),Qn(i,o)):Qn(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(En(o)){var a,{component:s,props:l={}}=o;r.push(It(It({},o),{},{id:(a=o?.id)!==null&&a!==void 0?a:At(),props:t(s,l)}))}else if(o.content!==void 0){var d=D.hydrateLayoutConfig(o.content,t);ma(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=d.length&&($t.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),r.push(It(It({},o),{},{content:d}))}else r.push(o)}return r}static openComponent(){var{root:e,config:t,stack:r=void 0,replaceExisting:i=!0,replaceConfig:o=void 0,createNewStack:a=!1,focusElement:s=void 0,dragEvent:l=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},d=document.activeElement,h=It({},t);if(h.id==null&&(h.id=At()),l!=null){e?.layoutManager.createDragSourceFromEvent(h,l);return}var c=o||{id:h.id,component:h.component};k(e);var f=r??(a?D.addStack(e):D.getStackForRoot(e,c));k(f);var v=D.getContentItemInStack(f,c);if(s!=null){var p=y=>{$t.debug("Component created, focusing element",s),f.off("componentCreated",p);var{element:P}=y.origin;requestAnimationFrame(()=>{D.focusElement(P[0],s)})};f.on("componentCreated",p)}if(i&&v){var g=f.contentItems.indexOf(v);f.addChild(h,g+1),f.removeChild(v),f.setActiveContentItem(f.contentItems[g])}else f.addChild(h);s==null&&d&&Cr(d)&&d.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=D.getContentItemInStack(e,o);if(r&&a&&e){var s=e?.contentItems.indexOf(a);e.addChild(t,s+1),e.removeChild(a),e.setActiveContentItem(e.contentItems[s])}else e?.addChild(t);i&&Cr(i)&&i.focus()}static closeComponent(e,t,r){var i=D.getStackForRoot(e,t,!1,!1,!1);if(!i){$t.warn("Cannot find stack for component, ignoring close",t);return}var o=D.getContentItemInStack(i,t),a=document.activeElement;o&&(Ze(o)?o.container.close(r):i.removeChild(o)),a&&document.contains(a)&&Cr(a)&&a.focus()}static renameComponent(e,t,r){var i=D.getStackForRoot(e,t,!1);if(!i){$t.error("Could not find stack for config",t);return}var o=D.getContentItemInStack(i,t);o&&o.setTitle(r)}static cloneComponent(e,t){var r=D.getStackForRoot(e,t,!1);if(!r)return $t.error("Could not find stack for config",t),null;var{props:i={}}=t,o=D.getPanelComponentState(t),a={type:"react-component",component:t.component,props:It(It({},i),{},{panelState:o}),title:"".concat(t.title," Copy"),id:At()};return D.openComponentInStack(r,a),a}static getPanelComponentState(e){if(Ol(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(En(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=D.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return D.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,r=D.getComponentConfigFromContainer(t);if(r&&En(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]:D.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var r=e.querySelector(t);return r==null?null:(Cr(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)})}}Tl(D,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var Cp=j.forwardRef((n,e)=>{var t=D.getComponentNameFromPanel({props:n});return u.jsx("div",{ref:e,className:"panel-placeholder",children:u.jsxs("div",{children:['Component "',t,'" is not registered.']})})});Cp.displayName="PanelPlaceholder";const te=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"});function kr(n){return n?.WrappedComponent!==void 0}function Sp(n){return typeof n.id=="string"&&n.layout instanceof Hg&&n.panelManager instanceof Wi&&typeof n.registerComponent=="function"}function wp(n){if(!Sp(n))throw new Error("Expected dashboard plugin props, but instead received ".concat(n))}function fa(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 va(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fa(Object(t),!0).forEach(function(r){Ut(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):fa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ut(n,e,t){return e=Ep(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ep(n){var e=_p(n,"string");return typeof e=="symbol"?e:String(e)}function _p(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var it=W.module("PanelManager");class Wi{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]:()=>{};Ut(this,"layout",void 0),Ut(this,"hydrateComponent",void 0),Ut(this,"dehydrateComponent",void 0),Ut(this,"onPanelsUpdated",void 0),Ut(this,"closed",void 0),Ut(this,"openedMap",void 0),this.handleFocus=this.handleFocus.bind(this),this.handleMount=this.handleMount.bind(this),this.handleUnmount=this.handleUnmount.bind(this),this.handleReopen=this.handleReopen.bind(this),this.handleReopenLast=this.handleReopenLast.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.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(te.FOCUS,this.handleFocus),e.on(te.MOUNT,this.handleMount),e.on(te.UNMOUNT,this.handleUnmount),e.on(te.REOPEN,this.handleReopen),e.on(te.REOPEN_LAST,this.handleReopenLast),e.on(te.DELETE,this.handleDeleted),e.on(te.CLOSED,this.handleClosed),e.on(te.CLOSE,this.handleControlClose)}stopListening(){var{eventHub:e}=this.layout;e.off(te.FOCUS,this.handleFocus),e.off(te.MOUNT,this.handleMount),e.off(te.UNMOUNT,this.handleUnmount),e.off(te.REOPEN,this.handleReopen),e.off(te.REOPEN_LAST,this.handleReopenLast),e.off(te.DELETE,this.handleDeleted),e.off(te.CLOSED,this.handleClosed),e.off(te.CLOSE,this.handleControlClose)}getClosedPanelConfigsOfType(e){return this.closed.filter(t=>t.component===e)}getOpenedPanels(){return Array.from(this.openedMap.values())}getOpenedPanelConfigs(){return this.getOpenedPanels().map(e=>{var{glContainer:t}=e.props;return D.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&En(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,r=D.getStackForConfig(this.layout.root,{id:e});return(t=r&&D.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=>kr(r)&&t instanceof r.WrappedComponent||!kr(r)&&t instanceof r))}updatePanel(e){var t=D.getIdFromPanel(e);if(t==null){it.error("updatePanel Panel did not have an ID",e);return}it.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=D.getIdFromPanel(e);if(t==null){it.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){it.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){it.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}it.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){it.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){it.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){it.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}handleReopen(e,t){it.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:r}=e,{props:i}=e;i=this.hydrateComponent(r,i);var o=va(va({},e),{},{props:i}),{root:a}=this.layout,s=e.parentStackId===void 0?void 0:D.getStackById(a,e.parentStackId);D.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=D.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){it.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){it.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:r}=this.layout;D.closeComponent(r,t)}addClosedPanel(e){var{root:t}=this.layout,r=D.getComponentConfigFromContainer(e);if(r&&En(r)){var i=this.dehydrateComponent(r.component,r);if(i!=null){var o;i.parentStackId=(o=D.getStackForConfig(t,r))===null||o===void 0?void 0:o.config.id,this.closed.push(i)}}}sendUpdate(){var{closed:e,openedMap:t}=this;this.onPanelsUpdated({closed:[...e],openedMap:new Map(t)})}}Ut(Wi,"MAX_CLOSED_PANEL_COUNT",100);var Pp=W.module("PanelErrorBoundary");class Tp extends m.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}componentWillUnmount(){var{glContainer:e,glEventHub:t}=this.props,r=D.getIdFromContainer(e);Pp.debug("componentWillUnmount",r),t.emit(te.CLOSED,r,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?u.jsx("div",{className:"panel-error-boundary",children:u.jsx(hn,{errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e}}function ga(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function jr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ga(Object(t),!0).forEach(function(r){Op(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ga(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Op(n,e,t){return e=Ip(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ip(n){var e=Dp(n,"string");return typeof e=="symbol"?e:String(e)}function Dp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Il(n){var{props:e,componentState:t}=n,{metadata:r}=e,{panelState:i=null}=e;t&&({panelState:i}=t);var o={};return r!=null&&(o.metadata=r),i!=null&&(o.panelState=i),jr(jr({},n),{},{componentState:null,props:o,type:"react-component"})}function Dl(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return jr(jr({},n),{},{localDashboardId:e})}function xp(n){var e=kr(n)&&n.WrappedComponent.prototype!=null&&n.WrappedComponent.prototype.isReactComponent!=null||n.prototype!=null&&n.prototype.isReactComponent!=null,t=!kr(n)&&"$$typeof"in n&&n.$$typeof===td.ForwardRef;return e||t}const Mp={dehydrate:Il,hydrate:Dl};var Np=j.createContext(void 0),Ap=S.shape({on:S.func,off:S.func,isHidden:S.bool,tab:S.shape({header:S.shape({tabs:S.arrayOf(S.shape({contentItem:S.shape({})}))})}),title:S.string,setTitle:S.func,close:S.func}),xl=S.shape({on:S.func,off:S.func,emit:S.func}),Lp=S.shape({registerComponent:S.func,root:S.shape({addChild:S.func}),on:S.func,off:S.func,eventHub:xl}),Fp=Object.freeze({Container:Ap,EventHub:xl,Layout:Lp});function xe(n,e,t){m.useEffect(function(){return n.on(e,t),()=>{n.off(e,t)}},[n,e,t])}function $n(n,e,t,r){var i,o=(i=e.COMPONENT)!==null&&i!==void 0?i:e.displayName;if(o==null)throw new Error("ComponentType must have a `COMPONENT` or `displayName` attribute.");j.useEffect(()=>{var a=n(o,e,t,r);return()=>{a()}},[e,r,t,o,n])}var Ml="SET_DASHBOARD_DATA";const Rp=wc(Ml,{},!1),kp={dashboardData:Rp};var jp=new Map,Nl=Object.freeze({}),$p=Object.freeze([]),BC=Oi,WC=Ga,UC=nd,Hp=n=>n.dashboardData,Ne=(n,e)=>{var t;return(t=Hp(n)[e])!==null&&t!==void 0?t:Nl},VC=(n,e)=>{var t;return(t=Ne(n,e).closed)!==null&&t!==void 0?t:$p},KC=(n,e)=>{var t;return(t=Ne(n,e).openedMap)!==null&&t!==void 0?t:jp},Al=(n,e)=>{var t;return(t=Ne(n,e).pluginDataMap)!==null&&t!==void 0?t:Nl},zC=(n,e,t)=>Al(n,e)[t];function pa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function _n(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?pa(Object(t),!0).forEach(function(r){Bp(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):pa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Bp(n,e,t){return e=Wp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wp(n){var e=Up(n,"string");return typeof e=="symbol"?e:String(e)}function Up(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ll=(n,e)=>({type:Ml,id:n,payload:e}),Qt=(n,e)=>(t,r)=>t(Ll(n,_n(_n({},Ne(r(),n)),e))),GC=(n,e,t)=>(r,i)=>r(Ll(n,_n(_n({},Ne(i(),n)),{},{pluginDataMap:_n(_n({},Al(i(),n)),{},{[e]:t})})));Object.entries(kp).map(n=>{var[e,t]=n;return Hd.register(e,t)});function Vp(n){var{children:e}=n;return u.jsx(u.Fragment,{children:e})}var Fl=m.createContext(null);function Kp(){return m.useContext(Fl)}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 Hn(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){zp(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 zp(n,e,t){return e=Gp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gp(n){var e=qp(n,"string");return typeof e=="symbol"?e:String(e)}function qp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Sr=W.module("DashboardLayout"),Zp=Object.freeze({}),Xp=[],ya=()=>{},Yp=1e3,Ca=n=>n;function Qp(n){var e,t,{id:r,children:i,emptyDashboard:o=u.jsx("div",{children:"Dashboard is empty."}),layout:a,layoutConfig:s=Xp,onLayoutChange:l=ya,onLayoutInitialized:d=ya,hydrate:h=Dl,dehydrate:c=Il,panelWrapper:f=Vp}=n,v=Oi(),p=(e=Ga(b=>Ne(b,r)))!==null&&e!==void 0?e:Zp,[g,y]=m.useState(!1),[P,O]=m.useState(!1),[_,R]=m.useState(),[U]=m.useState((t=p?.closed)!==null&&t!==void 0?t:[]),[Q,N]=m.useState(a.getReactChildren()),B=m.useMemo(()=>new Map,[]),$=m.useMemo(()=>new Map,[]),Y=m.useCallback(function(b,w){var T,G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:h,J=arguments.length>3&&arguments[3]!==void 0?arguments[3]:c;Sr.debug2("registerComponent",b,w,G,J);function et(Z,re){var he=w,Ae=f,Et=xp(he),{glContainer:_t,glEventHub:Yr}=Z,Rn=D.getIdFromContainer(_t);return u.jsx(Tp,{glContainer:_t,glEventHub:Yr,children:u.jsx(Fl.Provider,{value:Rn,children:u.jsx(Ae,Hn(Hn({},Z),{},{children:Et?u.jsx(he,Hn(Hn({},Z),{},{ref:re})):u.jsx(he,Hn({},Z))}))})})}et.displayName="DashboardWrapper(".concat((T=w.displayName)!==null&&T!==void 0?T:b,")");var I=a.registerComponent(b,j.forwardRef(et));return B.set(b,G),$.set(b,J),I},[h,c,B,$,a,f]),ne=m.useCallback((b,w)=>{var T;return((T=B.get(b))!==null&&T!==void 0?T:Ca)(w,r)},[B,r]),F=m.useCallback((b,w)=>{var T;return((T=$.get(b))!==null&&T!==void 0?T:Ca)(w,r)},[$,r]),q=m.useMemo(()=>new Wi(a,ne,F,new Map,U,b=>{var{closed:w,openedMap:T}=b;v(Qt(r,{closed:w,openedMap:T}))}),[F,v,ne,r,U,a]),K=Au(b=>{var w=_==null||!D.isEqual(_,b);Sr.debug("handleLayoutStateChanged",w,b),w&&(y(a.root.contentItems.length===0),R(b),l(b),N(a.getReactChildren()))},Yp,{flushOnUnmount:!0});m.useEffect(()=>()=>K.flush(),[K]);var A=m.useCallback(()=>{if(!P){var b=a.toConfig(),w=b.content,T=D.dehydrateLayoutConfig(w,F);K(T)}},[F,P,a,K]),V=m.useCallback(b=>{var w=D.getIdFromContainer(b);a.eventHub.emit(te.DRAGGING,w),O(!0)},[a.eventHub]),z=m.useCallback(b=>{var w=D.getIdFromContainer(b);a.eventHub.emit(te.DROPPED,w),O(!1)},[a.eventHub]),me=m.useCallback(b=>{if(Sr.debug2("handleComponentCreated",b),!(b==null||b.config==null||b.config.component==null||b.element==null)){var w=b.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),T="".concat(w,"-component");b.element.addClass(T)}},[]),je=m.useCallback(()=>{N(a.getReactChildren())},[a]);xe(a,"stateChanged",A),xe(a,"itemPickedUp",V),xe(a,"itemDropped",z),xe(a,"componentCreated",me),xe(a.eventHub,te.TITLE_CHANGED,A),xe(a,"reactChildrenChanged",je);var Ie=Lu(s);return m.useEffect(function(){if(Ie!==s&&s!==_){Sr.debug("Setting new layout content...");for(var w=D.hydrateLayoutConfig(s,ne);a.root.contentItems.length>0;)a.root.contentItems[0].remove();for(var T=0;T<w.length;T+=1)a.root.addChild(w[T]);y(a.root.contentItems.length===0)}},[ne,a,s,_,q,Ie]),m.useEffect(()=>d(),[]),u.jsxs(u.Fragment,{children:[g&&o,Q,j.Children.map(i,b=>b!=null?u.jsx($h,{fallback:[],children:j.cloneElement(b,{id:r,layout:a,panelManager:q,registerComponent:Y})}):null)]})}Qp.propTypes={id:S.string.isRequired,children:S.node,data:S.shape({}),emptyDashboard:S.node,layout:Fp.Layout.isRequired,layoutConfig:S.arrayOf(S.shape({})),onLayoutChange:S.func,onLayoutInitialized:S.func};var Jp=m.createContext(null);function qC(){var n=m.useContext(Jp);if(n==null)throw new Error("useDashboardId must be used within a DashboardIdContext provider");return n}function eb(n,e,t){return e=tb(e),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:String(e)}function nb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Rl(n,e,t){if(n){if(t(n)===!0)return n;for(var r=e?n.return:n.child;r;){var i=Rl(r,e,t);if(i)return i;r=e?null:r.sibling}}}function rb(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}var kl=rb(m.createContext(null));class ZC extends m.Component{constructor(){super(...arguments),eb(this,"_reactInternals",void 0)}render(){var{children:e}=this.props;return u.jsx(kl.Provider,{value:this._reactInternals,children:e})}}function ib(){var n=m.useContext(kl);if(n===null)throw new Error("useFiber must be called within a <FiberProvider />!");var[e]=m.useState(()=>At()),t=m.useMemo(()=>{for(var r of[n,n?.alternate].filter(o=>o!=null)){var i=Rl(r,!1,o=>{for(var a=o.memoizedState;a!=null;){if(a.memoizedState===e)return!0;a=a.next}});if(i)return i}},[n,e]);return t}var XC="default",ob=W.module("useDhId"),si="__dhId";function YC(){var n,e,t=(n=(e=ib())===null||e===void 0?void 0:e.pendingProps)!==null&&n!==void 0?n:{},r=t[si],i=Kp();if(r!=null){if(typeof r!="string")throw new Error("useDhId expected prop ".concat(si," to be a string, but got ").concat(typeof r));return r}return i??(ob.warn("useDhId must be used within a PanelIdContext provider if there is no ".concat(si," prop. Defaulting to null.")),null)}function lr(n,e,t){return e=ab(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ab(n){var e=sb(n,"string");return typeof e=="symbol"?e:String(e)}function sb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ln{}lr(Ln,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");lr(Ln,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");lr(Ln,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");lr(Ln,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");lr(Ln,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");const at=Ln;function Jt(n,e,t){return e=lb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lb(n){var e=db(n,"string");return typeof e=="symbol"?e:String(e)}function db(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ft{}Jt(Ft,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");Jt(Ft,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");Jt(Ft,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");Jt(Ft,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");Jt(Ft,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");Jt(Ft,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");Jt(Ft,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");Jt(Ft,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");const Sa=Ft,QC=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function Rt(n,e,t){return e=ub(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ub(n){var e=hb(n,"string");return typeof e=="symbol"?e:String(e)}function hb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class wt{}Rt(wt,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");Rt(wt,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");Rt(wt,"CLOSE_FILE","NotebookEvent.closeFile");Rt(wt,"RENAME","NotebookEvent.rename");Rt(wt,"RENAME_FILE","NotebookEvent.renameFile");Rt(wt,"REGISTER_FILE","NotebookEvent.registerFile");Rt(wt,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");Rt(wt,"UNREGISTER_FILE","NotebookEvent.unregisterFile");Rt(wt,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");const de=wt;function Fn(n,e,t){return e=cb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cb(n){var e=mb(n,"string");return typeof e=="symbol"?e:String(e)}function mb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class gn{}Fn(gn,"focus","TabEvent.focus");Fn(gn,"blur","TabEvent.blur");Fn(gn,"openPQObject","TabEvent.openPQObject");Fn(gn,"openControl","TabEvent.openControl");Fn(gn,"reload","TabEvent.reload");Fn(gn,"clearAllFilters","TabEvent.clearAllFilters");const wr=gn;function fb(n,e,t){return e=vb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function vb(n){var e=gb(n,"string");return typeof e=="symbol"?e:String(e)}function gb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class jl 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,{glContainer:i}=this.props;return[...(e=i==null||(t=i.tab)===null||t===void 0||(r=t.header)===null||r===void 0?void 0:r.tabs)!==null&&e!==void 0?e:[]]}handleCloseTab(){var{glContainer:e}=this.props;e.close()}handleCloseTabsAll(){var e=this.getAllTabs();e.forEach(t=>{var r;return(r=(t?.contentItem).container)===null||r===void 0?void 0:r.close()})}handleCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),r=t.length-1;r>0;r-=1){var i,o,a,s,l,d,h;if(((i=t[r].contentItem)===null||i===void 0||(o=i.config)===null||o===void 0?void 0:o.id)===((a=e.tab)===null||a===void 0||(s=a.contentItem)===null||s===void 0||(l=s.config)===null||l===void 0?void 0:l.id))break;(d=((h=t[r])===null||h===void 0?void 0:h.contentItem).container)===null||d===void 0||d.close()}}handleReopenLast(){var{glContainer:e,glEventHub:t}=this.props;t.emit(te.REOPEN_LAST,e)}canCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),r=!0,i=t.length-1;i>0;i-=1){var o,a,s,l,d,h,c,f;if(((o=t[i].contentItem)===null||o===void 0||(a=o.config)===null||a===void 0?void 0:a.id)===((s=e.tab)===null||s===void 0||(l=s.contentItem)===null||l===void 0||(d=l.config)===null||d===void 0?void 0:d.id))break;var v=!!(!((h=t[i])===null||h===void 0||(c=h.contentItem)===null||c===void 0||(f=c.config)===null||f===void 0)&&f.isClosable);if(v){r=!1;break}}return r}canCloseAny(){for(var e=this.getAllTabs(),t=!0,r=e.length-1;r>0;r-=1){var i,o,a,s=!!(!((i=e[r])===null||i===void 0||(o=i.contentItem)===null||o===void 0||(a=o.config)===null||a===void 0)&&a.isClosable);if(s){t=!1;break}}return t}canReopenLast(){var e,t,{workspace:r,glContainer:i}=this.props,o=(e=D.getStackForConfig(i.layoutManager.root,i.getConfig()))===null||e===void 0?void 0:e.config.id;return!((t=r.data.closed)!==null&&t!==void 0&&t.some(a=>a.parentStackId===o))}render(){var e,t,r,{additionalActions:i,glContainer:o}=this.props,a=[...i];a.push(()=>({title:"Re-open closed panel",group:ee.groups.medium+2004,action:this.handleReopenLast,disabled:this.canReopenLast()}));var s=(e=o.tab)===null||e===void 0||(t=e.contentItem)===null||t===void 0||(r=t.config)===null||r===void 0?void 0:r.isClosable;return a.push({title:"Close",order:10,group:ee.groups.low,action:this.handleCloseTab,disabled:s===void 0||!s}),a.push(()=>({title:"Close Tabs to Right",order:20,group:ee.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),a.push(()=>({title:"Close All",order:30,group:ee.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),u.jsx(ee,{actions:a})}}fb(jl,"defaultProps",{additionalActions:[]});var pb=n=>({workspace:$s(n)}),bb=Nn(pb,{setWorkspace:Hs})(jl);const yb=bb;function $l(n,e,t){return e=Cb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cb(n){var e=Sb(n,"string");return typeof e=="symbol"?e:String(e)}function Sb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Hl extends m.PureComponent{constructor(e){super(e),$l(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=j.createRef();var{value:t}=e;this.state={value:t,valueWasValidated:!1}}componentDidUpdate(e){var{isShown:t}=e,{isShown:r}=this.props;r&&!t&&this.resetState()}resetState(){var{value:e}=this.props;this.setState({value:e,valueWasValidated:!1})}handleRenameDialogOpened(){var e,t;(e=this.renameInputRef)===null||e===void 0||(t=e.current)===null||t===void 0||t.focus()}handleRenameInputChange(e){this.setState({value:e.target.value})}handleRenameCancel(){var{onCancel:e}=this.props;e()}handleRenameSubmit(e){e.stopPropagation(),e.preventDefault();var{value:t}=this.state,r=t?.trim();if(r!==void 0&&r!==""){var{onSubmit:i}=this.props;i(r)}else this.setState({value:r,valueWasValidated:!0})}renderRenameDialog(){var{isShared:e,isOwner:t,itemType:r}=this.props,{value:i,valueWasValidated:o}=this.state;return u.jsxs("form",{className:X("p-3",{"was-validated":o}),onSubmit:this.handleRenameSubmit,noValidate:!0,role:"presentation",onMouseDown:a=>{a.stopPropagation()},onMouseUp:a=>{a.stopPropagation()},children:[u.jsxs("div",{className:"form-group",children:[u.jsxs("label",{htmlFor:"rename-dialog-".concat(r,"-input"),children:["Rename ",r]}),u.jsx("input",{type:"text",className:"form-control",id:"rename-dialog-".concat(r,"-input"),value:i??void 0,ref:this.renameInputRef,onChange:this.handleRenameInputChange,required:!0}),u.jsxs("div",{className:"invalid-feedback",children:[r," name cannot be empty"]}),(e||!t)&&u.jsxs("div",{className:"pt-2",children:["Renaming this ",r," will rename for all users."]})]}),u.jsxs("div",{className:"text-right",children:[u.jsx(se,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),u.jsx(se,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var{isShown:e,onCancel:t}=this.props;return u.jsx(xi,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}$l(Hl,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});function Ei(n,e,t){return e=wb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wb(n){var e=Eb(n,"string");return typeof e=="symbol"?e:String(e)}function Eb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var _b=W.module("Panel");class Bl extends m.PureComponent{constructor(e){super(e),Ei(this,"ref",void 0),Ei(this,"getAdditionActions",St((r,i,o)=>{var a=[];return i&&a.push(this.getCloneAction()),o&&a.push(this.getRenameAction()),[...a,...r]})),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleCopyPanel=this.handleCopyPanel.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleHide=this.handleHide.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleBeforeShow=this.handleBeforeShow.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.handleShowRenameDialog=this.handleShowRenameDialog.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleTab=this.handleTab.bind(this),this.ref=j.createRef();var{glContainer:t}=this.props;this.state={title:D.getTitleFromContainer(t),showRenameDialog:!1,isWithinPanel:!0}}componentDidMount(){var e,t,{componentPanel:r,glContainer:i,glEventHub:o}=this.props;i.on("resize",this.handleResize),i.on("show",this.handleBeforeShow),i.on("shown",this.handleShow),i.on("hide",this.handleHide),i.on("tab",this.handleTab),i.on("tabClicked",this.handleTabClicked),o.on(at.SESSION_CLOSED,this.handleSessionClosed),o.on(at.SESSION_OPENED,this.handleSessionOpened),o.on(wr.focus,this.handleTabFocus),o.on(wr.blur,this.handleTabBlur),o.on(Sa.CLEAR_ALL_FILTERS,this.handleClearAllFilters),o.emit(te.MOUNT,r??this),this.setState({isWithinPanel:((e=this.ref.current)===null||e===void 0||(t=e.parentElement)===null||t===void 0?void 0:t.closest(".dh-panel"))!=null})}componentWillUnmount(){var{componentPanel:e,glContainer:t,glEventHub:r}=this.props;t.off("resize",this.handleResize),t.off("show",this.handleBeforeShow),t.off("shown",this.handleShow),t.off("hide",this.handleHide),t.off("tab",this.handleTab),t.off("tabClicked",this.handleTabClicked),r.off(at.SESSION_CLOSED,this.handleSessionClosed),r.off(at.SESSION_OPENED,this.handleSessionOpened),r.off(wr.focus,this.handleTabFocus),r.off(wr.blur,this.handleTabBlur),r.off(Sa.CLEAR_ALL_FILTERS,this.handleClearAllFilters),r.emit(te.UNMOUNT,e??this)}handleTab(e){e!=null&&this.setState({title:D.getTitleFromTab(e)}),this.forceUpdate();var{onTab:t}=this.props;t(e)}handleTabClicked(e){var{onTabClicked:t}=this.props;t(e)}handleClearAllFilters(){var{onClearAllFilters:e}=this.props;e(...arguments)}handleFocus(e){var{componentPanel:t,glEventHub:r}=this.props;r.emit(te.FOCUS,t??this);var{onFocus:i}=this.props;i(e)}handleBlur(e){var{onBlur:t}=this.props;t(e)}handleHide(){var{onHide:e}=this.props;e(...arguments)}handleResize(){var{onResize:e}=this.props;e(...arguments)}handleSessionClosed(e){var{onSessionClose:t}=this.props;t(e)}handleSessionOpened(e,t){var{onSessionOpen:r}=this.props;r(e,t)}handleBeforeShow(){var{onBeforeShow:e}=this.props;e(...arguments)}handleShow(){var{onShow:e}=this.props;e(...arguments)}handleTabBlur(){var{onTabBlur:e}=this.props;e(...arguments)}handleTabFocus(){var{onTabFocus:e}=this.props;e(...arguments)}handleRenameCancel(){this.setState({showRenameDialog:!1})}handleShowRenameDialog(){this.setState({showRenameDialog:!0})}handleRenameSubmit(e){var{glContainer:t}=this.props;this.setState({showRenameDialog:!1,title:e});var r=D.getRootFromContainer(t),i=D.getComponentConfigFromContainer(t);k(i),D.renameComponent(r,i,e)}handleCopyPanel(){var{glContainer:e,glEventHub:t}=this.props,r=D.getRootFromContainer(e),i=D.getComponentConfigFromContainer(e);if(i==null){_b.error("Could not get component config from container",e);return}var o=D.cloneComponent(r,i);o!==null&&t.emit(te.CLONED,this,o)}getCloneAction(){return{title:"Copy Panel",order:10,group:ee.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:ee.groups.medium,action:this.handleShowRenameDialog}}render(){var{children:e,className:t,renderTabTooltip:r,glContainer:i,glEventHub:o,additionalActions:a,errorMessage:s,isLoaded:l,isLoading:d,isClonable:h,isRenamable:c}=this.props,{tab:f}=i,{showRenameDialog:v,title:p,isWithinPanel:g}=this.state;return u.jsxs("div",{className:X("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,u.jsx(hn,{errorMessage:s,isLoaded:l,isLoading:d}),!g&&f!=null&&Hr.createPortal(u.jsxs(u.Fragment,{children:[u.jsx(yb,{glContainer:i,glEventHub:o,additionalActions:this.getAdditionActions(a,h,c)}),c&&u.jsx(Hl,{isShown:v,value:p,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),r!=null&&u.jsx(Xt,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:r()})]}),f.element[0])]})}}Ei(Bl,"defaultProps",{className:"",onTab:()=>{},onTabClicked:()=>{},onClearAllFilters:()=>{},onFocus:()=>{},onBlur:()=>{},onHide:()=>{},onResize:()=>{},onSessionClose:()=>{},onSessionOpen:()=>{},onBeforeShow:()=>{},onShow:()=>{},onTabBlur:()=>{},onTabFocus:()=>{},renderTabTooltip:null,additionalActions:[],errorMessage:null,isLoading:!1,isLoaded:!0,isClonable:!1,isRenamable:!1});const dr=Bl,JC=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var Pb=Object.freeze({}),Tb=new Map,Gr=Object.freeze([]),eS=(n,e)=>{var t;return(t=Ne(n,e).columns)!==null&&t!==void 0?t:Gr},tS=(n,e)=>{var t;return(t=Ne(n,e).filterSets)!==null&&t!==void 0?t:Gr},nS=(n,e)=>{var t;return(t=Ne(n,e).filters)!==null&&t!==void 0?t:Gr},rS=(n,e)=>{var t;return(t=Ne(n,e).tableMap)!==null&&t!==void 0?t:Tb},iS=(n,e)=>Ne(n,e).isolatedLinkerPanelId,Wl=(n,e)=>{var t;return(t=Ne(n,e).links)!==null&&t!==void 0?t:Gr},oS=(n,e)=>Ne(n,e).columnSelectionValidator,aS=(n,e)=>{var t;return(t=Ne(n,e).consoleSettings)!==null&&t!==void 0?t:Pb},sS=(n,e)=>Ne(n,e).connection,ur=(n,e)=>Ne(n,e).sessionWrapper,lS=(n,e)=>t=>t(Qt(n,{connection:e})),dS=(n,e)=>t=>t(Qt(n,{sessionWrapper:e})),Ul=(n,e)=>t=>t(Qt(n,{links:e})),uS=(n,e)=>(t,r)=>{var i=Wl(r(),n),o=e.filter(a=>i.findIndex(s=>Qn(s.start,a.start)&&Qn(s.end,a.end))<0);return t(Ul(n,i.concat(o)))},hS=(n,e)=>(t,r)=>{var i=Wl(r(),n),o=i.filter(a=>!e.includes(a.id));return t(Ul(n,o))},cS=(n,e)=>t=>t(Qt(n,{isolatedLinkerPanelId:e})),mS=(n,e)=>t=>t(Qt(n,{columnSelectionValidator:e})),Ob=(n,e)=>t=>t(Qt(n,{consoleSettings:e})),fS=(n,e)=>t=>t(Qt(n,{filterSets:e}));function $r(n,e,t){return e=Ib(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ib(n){var e=Db(n,"string");return typeof e=="symbol"?e:String(e)}function Db(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Er=W.module("CommandHistoryPanel");class hr extends m.Component{static handleError(e){Er.error(e)}constructor(e){super(e),$r(this,"container",void 0),$r(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=j.createRef(),this.pending=new An;var{session:t,sessionId:r,language:i}=e;this.state={panelState:{},session:t,sessionId:r,language:i,contextActions:[{action:this.handleFocusHistory,shortcut:ke.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){var{glEventHub:e,session:t}=this.props;e.on(at.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(at.FOCUS_HISTORY,this.handleFocusHistory),this.pending.cancel()}handleFocusHistory(){this.container.current&&this.container.current.focus()}handleShow(){var e;(e=this.container.current)===null||e===void 0||e.restoreScrollPosition()}handleSessionOpened(e,t){var{language:r,sessionId:i}=t;this.setState({session:e,sessionId:i,language:r},()=>{this.loadTable()})}handleSessionClosed(){this.pending.cancel(),this.setState({session:void 0,language:void 0,table:void 0})}handleSendToNotebook(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{session:r,language:i}=this.state;if(Er.debug("handleSendToNotebook",r,e),!r){Er.error("Session is not connected.");return}var{glEventHub:o}=this.props;o.emit(t?de.CREATE_NOTEBOOK:de.SEND_TO_NOTEBOOK,r,i,e)}handleSendToConsole(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;Er.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(at.SEND_COMMAND,e,t,r)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:r}=this.state;k(t),k(r),this.pending.add(e.getTable(t,r,Date.now()),i=>i.close()).then(i=>{this.setState({table:i})}).catch(hr.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:r}=this.props,{language:i,contextActions:o,table:a}=this.state;return u.jsxs(dr,{className:"command-history-pane",componentPanel:this,glContainer:e,glEventHub:t,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[!a&&u.jsx("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),a&&i!=null&&u.jsxs(u.Fragment,{children:[u.jsx(Nf,{ref:this.container,language:i,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:a,commandHistoryStorage:r}),u.jsx(ee,{actions:o})]})]})}}$r(hr,"COMPONENT","CommandHistoryPanel");$r(hr,"TITLE","Command History");var xb=(n,e)=>{var t=ks(n),r=ur(n,e.localDashboardId),{session:i,config:o}=r??{},{type:a,id:s}=o??{};return{commandHistoryStorage:t,language:a,session:i,sessionId:s}},Mb=Nn(xb,null,null,{forwardRef:!0})(hr);const Nb=Mb;var Ab=m.createContext(null),cr=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin"});function Lb(n){return"DashboardPlugin"in n}function Fb(n){return"AuthPlugin"in n}function Rb(n){return"TablePlugin"in n}function vS(n){return Lb(n)||Fb(n)||Rb(n)}function kb(n){return"type"in n&&n.type===cr.DASHBOARD_PLUGIN}function Ui(n){return"type"in n&&n.type===cr.WIDGET_PLUGIN}function jb(n){return"type"in n&&n.type===cr.TABLE_PLUGIN}function $b(n){return"type"in n&&n.type===cr.AUTH_PLUGIN}function Vl(n){return"type"in n&&n.type===cr.THEME_PLUGIN}function gS(n){return kb(n)||$b(n)||jb(n)||Vl(n)||Ui(n)}var Hb=W.module("@deephaven/plugin.PluginUtils");function wa(n,e){return n==null||!Ui(n)?!1:[n.supportedTypes].flat().some(t=>t===e)}function Bb(n){var e=u.jsx(ue,{icon:ts});if(!Ui(n))return e;var{icon:t}=n;return t==null?e:m.isValidElement(t)?t:u.jsx(ue,{icon:t})}function pS(n){var e=[...n.entries()].filter(t=>Vl(t[1]));return Hb.debug("Getting theme data from plugins",e),e.map(t=>{var[r,i]=t,o=Array.isArray(i.themes)?i.themes:[i.themes];return o.map(a=>{var{name:s,baseTheme:l,styleContent:d}=a;return{baseThemeKey:"default-".concat(l??"dark"),themeKey:Bd(r,s),name:s,styleContent:d}})}).flat()}function bS(){return rr(Ab,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}function Ea(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function _r(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ea(Object(t),!0).forEach(function(r){ln(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ea(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ln(n,e,t){return e=Wb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wb(n){var e=Ub(n,"string");return typeof e=="symbol"?e:String(e)}function Ub(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Pr=W.module("ConsolePanel"),Vb=500,Kb=Object.freeze({consoleSettings:{},itemIds:[]});class qr extends m.PureComponent{constructor(e){super(e),ln(this,"consoleRef",void 0),ln(this,"objectSubscriptionCleanup",void 0),ln(this,"savePanelState",On(()=>{var{consoleSettings:a,itemIds:s}=this.state,l={consoleSettings:a,itemIds:[...s]};Pr.debug("Saving panel state",l),this.setState({panelState:l})},Vb)),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=j.createRef();var{panelState:t}=e,r=_r(_r({},Kb),t||{}),{consoleSettings:i,itemIds:o}=r;this.state={consoleSettings:i,itemIds:new Map(o),objectMap:new Map,error:void 0,panelState:r}}componentDidMount(){var{glEventHub:e}=this.props;this.closeDisconnectedPanels(),e.on(te.MOUNT,this.handlePanelMount),this.subscribeToFieldUpdates()}componentDidUpdate(e,t){var{consoleSettings:r,itemIds:i}=this.state;(t.consoleSettings!==r||t.itemIds!==i)&&this.savePanelState()}componentWillUnmount(){var e,{glEventHub:t}=this.props;this.savePanelState.flush(),t.off(te.MOUNT,this.handlePanelMount),(e=this.objectSubscriptionCleanup)===null||e===void 0||e.call(this)}subscribeToFieldUpdates(){var{sessionWrapper:e}=this.props;if(e!=null){var{session:t}=e;this.objectSubscriptionCleanup=t.subscribeToFieldUpdates(r=>{Pr.debug("Got updates",r),this.setState(i=>{var{objectMap:o}=i,{updated:a,created:s,removed:l}=r,d=[...a,...l],h=new Map(o);d.forEach(f=>{var{title:v}=f;v!==void 0&&h.delete(v)});var c=[...a,...s];return c.forEach(f=>{f.title!==void 0&&h.set(f.title,f)}),{objectMap:h}})})}}setItemId(e,t){this.setState(r=>{var{itemIds:i}=r,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,{itemIds:r}=this.state,i=r.get(e);return i==null&&t&&(i=At(),this.setItemId(e,i)),i}handleTabFocus(){var e;(e=this.consoleRef.current)===null||e===void 0||e.focus()}handlePanelMount(e){var t,r,i,{itemIds:o}=this.state,a=e==null||(t=e.props)===null||t===void 0?void 0:t.id,s=e==null||(r=e.props)===null||r===void 0||(i=r.metadata)===null||i===void 0?void 0:i.sourcePanelId;if(a&&s){var l=new Set(o.values());l.has(s)&&this.setItemId(a,a)}}handleFocusCommandHistory(){var{glEventHub:e}=this.props;e.emit(at.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{root:r}=this.context,i=e.title!=null?this.getItemId(e.title,!1):null;(t||i!=null&&D.getStackForRoot(r,{id:i},!1,!1,!1)!=null)&&this.openWidget(e)}handleCloseObject(e){var{title:t}=e;if(t!==void 0){var r=this.getItemId(t,!1);if(r!=null){var{glEventHub:i}=this.props;i.emit(te.CLOSE,r)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;Pr.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(at.SETTINGS_CHANGED,e)}openWidget(e){var{glEventHub:t,sessionWrapper:r}=this.props;k(r);var{config:i,session:o}=r,{title:a=e.name}=e;k(a);var s=this.getItemId(a),l={fetch:()=>o.getObject(e),panelId:s,widget:_r(_r({},rc(e)),{},{sessionId:i.id})};Pr.debug("openWidget",l),t.emit(te.OPEN,l)}addCommand(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;(t=this.consoleRef.current)===null||t===void 0||t.addCommand(e,r,i)}closeDisconnectedPanels(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{consoleSettings:t,itemIds:r}=this.state,{isClosePanelsOnDisconnectEnabled:i=!0}=t;if(!(!i&&!e)){var o=[...r.values()],{glEventHub:a}=this.props;o.forEach(s=>{a.emit(te.CLOSE,s)}),this.setState({itemIds:new Map})}}updateDimensions(){var e;(e=this.consoleRef.current)===null||e===void 0||e.updateDimensions()}supportsType(e){var{plugins:t}=this.props;return[...t.values()].some(r=>wa(r,e))}iconForType(e){var{plugins:t}=this.props,r=[...t.values()].find(i=>wa(i,e));return r!=null?Bb(r):u.jsx(Ec,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:r,sessionWrapper:i,timeZone:o,unzip:a}=this.props;if(i==null)return u.jsx(hn,{isLoading:!1,errorMessage:"Console is disabled."});var{consoleSettings:s,error:l,objectMap:d}=this.state,{config:h,session:c,connection:f,details:v={},dh:p}=i,{workerName:g,processInfoId:y}=v,{id:P,type:O}=h;return u.jsx(dr,{className:"iris-panel-console",componentPanel:this,glContainer:t,glEventHub:r,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,errorMessage:l!=null?"".concat(l):void 0,children:c!=null&&u.jsx(hf,{dh:p,ref:this.consoleRef,settings:s,session:c,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:O,statusBarChildren:u.jsxs(u.Fragment,{children:[u.jsx("div",{children:Ws.LANGUAGE_MAP.get(O)}),g!=null&&u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"•"}),g]}),y!=null&&u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"•"}),y,u.jsx("div",{children:"•"})]}),u.jsx(xv,{connection:f,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})]}),scope:P,timeZone:o,objectMap:d,unzip:a,supportsType:this.supportsType,iconForType:this.iconForType})})}}ln(qr,"COMPONENT","ConsolePanel");ln(qr,"TITLE","Console");ln(qr,"contextType",Np);var zb=(n,e)=>({commandHistoryStorage:ks(n),sessionWrapper:ur(n,e.localDashboardId),timeZone:uc(n),plugins:cc(n)}),Gb=Nn(zb,null,null,{forwardRef:!0})(qr);const li=Gb;function yS(n){return n==="file"||n==="directory"}function mt(n){return n.type==="directory"}function qb(n,e,t){return e=Zb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Zb(n){var e=Xb(n,"string");return typeof e=="symbol"?e:String(e)}function Xb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Yb extends Error{constructor(){super("No file exists at the path specified"),qb(this,"isFileNotFound",!0)}}const Vi=Yb;function _a(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Pa(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){_a(o,r,i,a,s,"next",l)}function s(l){_a(o,r,i,a,s,"throw",l)}a(void 0)})}}var Nt;(function(n){n.GROOVY="text/x-groovy",n.PLAIN_TEXT="text/plain",n.PYTHON="text/x-python",n.PYTHON_COMPILED="application/x-python-code",n.SCALA="text/x-scala",n.UNKNOWN=""})(Nt||(Nt={}));class pt{static fileExists(e,t){return Pa(function*(){try{return yield e.info(t),!0}catch(r){if(!(r instanceof Vi))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(!pt.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 Pa(function*(){for(var r=pt.getCopyFileName(t);yield pt.fileExists(e,r);)r=pt.getCopyFileName(r);return r})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return Nt.GROOVY;case"py":return Nt.PYTHON;case"pyc":return Nt.PYTHON_COMPILED;case"scala":return Nt.SCALA;case"txt":return Nt.PLAIN_TEXT;default:return Nt.UNKNOWN}}static getParent(e){if(!pt.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(!pt.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=pt.fileExtensionToString(t);return"".concat(i).concat(o)}static validateName(e){var t=[".",".."],r=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new qn("Name cannot be empty");if(t.includes(e))throw new qn('"'.concat(e,'" is a reserved name'));if(r.test(e)){var o,a;throw new qn('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=>pt.isPath(r));return e.filter(r=>!t.some(i=>r!==i&&r.startsWith(i)))}static removeRoot(e,t){if(e.length===0)return t;if(!t.startsWith(e))throw new Error("Filename ".concat(t," does not start with expected root ").concat(e));return t.substring(e.length)}static addRoot(e,t){return"".concat(e).concat(t)}}const H=pt;var Ki=26;function _i(n){return mt(n)?H.makePath(n.filename):H.getPath(n.filename)}function Ta(n,e){if(n.length===0||e==null)throw new Error("No items to move");var t=_i(e);if(n.some(r=>{var{filename:i}=r;return H.getPath(i)===t}))throw new Error("File already in the destination folder");if(n.some(r=>mt(r)&&t.startsWith(H.makePath(r.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:n,targetPath:t}}function Qb(n){if(mt(n))return n.isExpanded?Wd:Ud;var e=H.getMimeType(n.basename);switch(e){case Nt.PYTHON:return Kd;default:return Vd}}function Pi(n){var e,{children:t,draggedItems:r,isDragInProgress:i,isDropTargetValid:o,isSelected:a,item:s,itemIndex:l,dropTargetItem:d,onDragStart:h,onDragOver:c,onDragEnd:f,onDrop:v}=n,p=(e=r?.some(N=>N.id===s.id))!==null&&e!==void 0?e:!1,g=_i(s),y=i&&d?_i(d):null,P=i&&o&&mt(s)&&y===g,O=i&&o&&y===g,_=i&&!o&&y===g,R=Qb(s),U=H.getDepth(s.filename),Q=Array(U).fill(null).map((N,B)=>u.jsx("span",{className:"file-list-depth-line"},B));return u.jsxs("div",{className:X("d-flex w-100 align-items-center","file-list-item",{"is-dragged":p,"is-exact-drop-target":P,"is-in-drop-target":O,"is-invalid-drop-target":_,"is-selected":a}),onDragStart:N=>h(l,N),onDragOver:N=>c(l,N),onDragEnd:N=>f(l,N),onDrop:N=>v(l,N),draggable:!0,role:"presentation","aria-label":s.basename,children:[Q," ",u.jsx(ue,{icon:R,className:"item-icon",fixedWidth:!0})," ",u.jsx("span",{className:"truncation-wrapper",children:t??u.jsxs(u.Fragment,{children:[s.basename,u.jsx(Xt,{children:s.basename})]})})]})}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 Tr(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){Jb(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 Jb(n,e,t){return e=ey(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ey(n){var e=ty(n,"string");return typeof e=="symbol"?e:String(e)}function ty(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Le=W.module("FileList"),ny=500,Ia="item-list-scroll-pane";function ry(n){var{isMultiSelect:e=!1,table:t,onFocusChange:r=()=>{},onMove:i,onSelect:o,onSelectionChange:a=()=>{},renderItem:s=Pi,rowHeight:l=Ki,overscanCount:d=Qe.DEFAULT_OVERSCAN}=n,[h,c]=m.useState(()=>({items:[],offset:0,itemCount:0})),[f,v]=m.useState({top:0,bottom:0}),[p,g]=m.useState(),[y,P]=m.useState(),[O,_]=m.useState(),[R,U]=m.useState([]),Q=m.useRef(),N=m.useRef(null),B=m.useRef(null),$=m.useCallback(I=>{if(I.length===0||h==null)return[];for(var Z=[],re=0;re<I.length;re+=1)for(var he=I[re],Ae=he[0];Ae<=he[1];Ae+=1)Ae>=h.offset&&Ae<h.offset+h.items.length&&Z.push(h.items[Ae-h.offset]);return Z},[h]),Y=m.useCallback(I=>{var Z=$([[I,I]]);if(Z.length>0)return Z[0]},[$]),ne=m.useCallback(()=>{var I=xt.count(R);if(I===0)return null;if(I===1){var Z=R[0][0],re=Y(Z);if(re!=null)return re.filename}return"".concat(I," items")},[Y,R]),F=m.useCallback(I=>{if(!(!y||!p)){Le.debug("dropItems",y,"to",I);try{var{files:Z,targetPath:re}=Ta(y,p);if(i?.(Z,re),I!=null){var he;U([[I,I]]),(he=N.current)===null||he===void 0||he.focusItem(I)}}catch(Ae){Le.error("Unable to complete move",Ae)}}},[y,p,i]),q=m.useCallback((I,Z)=>{var re=h.items[I-h.offset];re!==void 0&&(Le.debug("handleItemClick",re),o(re,Z),mt(re)&&t?.setExpanded(re.filename,!re.isExpanded))},[h,o,t]),K=m.useCallback((I,Z)=>{var re,he;Le.debug2("handleItemDragStart",I,R);var Ae=R;xt.isSelected(R,I)||(Ae=[[I,I]],U(Ae)),P($(Ae)),(re=N.current)===null||re===void 0||re.resetMouseState();var Et=document.createElement("div"),_t=document.createElement("div");_t.className="dnd-placeholder-content",_t.innerText=(he=ne())!==null&&he!==void 0?he:"",Et.appendChild(_t),Et.className="file-list-dnd-placeholder",document.body.appendChild(Et),Z.dataTransfer.setDragImage(Et,0,0),Z.dataTransfer.effectAllowed="move",_(Et)},[ne,$,R]),A=m.useCallback((I,Z)=>{Z.preventDefault(),Le.debug2("handleItemDragOver",Z),g(Y(I))},[Y]),V=m.useCallback((I,Z)=>{Le.debug("handleItemDragEnd",I),O?.remove(),P(void 0),g(void 0),_(void 0)},[O]),z=m.useCallback((I,Z)=>{F(I)},[F]),me=m.useCallback(()=>{Le.debug2("handleItemDragExit"),g(void 0)},[]),je=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains(Ia)&&(I.preventDefault(),Le.debug2("handleListDragOver",I),g({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),Ie=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains(Ia)&&(Le.debug("handleListDrop"),F())},[F]),b=m.useCallback(function(I){var Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(Le.debug2("handleSelectionChange",I),Z===!0||I!==R){U(I);var re=$(I);a(re)}},[$,a,R]),w=m.useCallback(I=>{if(Le.debug2("handleFocusChange",I),I!=null){var[Z]=$([[I,I]]);r(Z)}else r();Q.current=I},[$,r]),T=m.useCallback((I,Z)=>{Le.debug("handleViewportChange",I,Z),(I!==f.top||Z!==f.bottom)&&v({top:I,bottom:Z})},[f]),G=m.useMemo(()=>{if(!y||!p)return!1;try{return Ta(y,p),Le.debug("handleValidateDropTarget true"),!0}catch{return Le.debug("handleValidateDropTarget false"),!1}},[y,p]),{focusedPath:J}=n;m.useEffect(()=>{J!==void 0&&(J==="/"?t.collapseAll():(t.setExpanded(J,!1),t.setExpanded(J,!0)))},[t,J]),m.useEffect(function(){Le.debug("updating table viewport",f),t?.setViewport({top:Math.max(0,f.top-d),bottom:f.bottom+d})},[d,t,f]),m.useEffect(function(){var Z=t.onUpdate(re=>{c({items:re.items.map(he=>Tr(Tr({},he),{},{itemName:he.basename})),offset:re.offset,itemCount:t.size})});return()=>{Z()}},[t]),m.useEffect(function(){Q.current!=null&&w(Q.current),R.length>0&&b(R,!0)},[h,w,b,R]),m.useEffect(function(){if(p!=null&&mt(p)&&p.filename!=="/"){var Z=setTimeout(()=>{p.isExpanded||t?.setExpanded(p.filename,!0)},ny);return()=>clearTimeout(Z)}},[p,t]);var et=m.useCallback(I=>s(Tr(Tr({},I),{},{isDragInProgress:y!=null,dropTargetItem:p,draggedItems:y,isDropTargetValid:G,onDragStart:K,onDragEnd:V,onDragOver:A,onDragExit:me,onDrop:z})),[V,me,A,K,z,y,p,G,s]);return u.jsx("div",{ref:B,className:X("file-list",{"is-dragging":y!=null}),onDragOver:je,onDrop:Ie,children:u.jsx(Qe,{ref:N,items:h.items,itemCount:h.itemCount,offset:h.offset,onFocusChange:w,onSelect:q,onSelectionChange:b,onViewportChange:T,selectedRanges:R,renderItem:et,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var iy={name:"File Explorer",DELETE:ce.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[x.DELETE],macShortcut:[L.CMD,x.BACKSPACE]}),RENAME:ce.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[x.ENTER],macShortcut:[x.ENTER]})};const Da={FILE_EXPLORER:iy};var xa=W.module("FileListItemEditor"),oy=()=>Promise.resolve();function ay(n){var{item:e,onCancel:t,onSubmit:r,validate:i=oy}=n,o=m.useRef(null),[a,s]=m.useState(e.basename),[l,d]=m.useState(),[h,c]=m.useState(Promise.resolve()),f=m.useCallback(()=>{var O;(O=o.current)===null||O===void 0||O.focus()},[o]),v=m.useCallback(O=>O.stopPropagation(),[]),p=m.useCallback(()=>{h.then(()=>{r(a)}).catch(O=>xa.info("Unable to validate name",O))},[r,a,h]);m.useEffect(function(){var _=Ee.makeCancelable(i(a));return _.then(()=>d(void 0)).catch(R=>{Ee.isCanceled(R)||d(R)}),c(_),()=>_.cancel()},[i,a]),m.useEffect(function(){f()},[f]);var g=m.useCallback(()=>{xa.debug2("handleBlur"),p()},[p]),y=m.useCallback(O=>{var{value:_}=O.target;s(_)},[]),P=m.useCallback(O=>{O.stopPropagation();var{key:_}=O;switch(_){case"Enter":{p();break}case"Escape":{t();break}}},[t,p]);return u.jsxs("div",{className:"file-list-item-editor",children:[u.jsx("input",{type:"text",className:X("form-control file-list-item-editor-input",{"is-invalid":l}),value:a,ref:o,onBlur:g,onKeyDown:P,onChange:y,onClick:v,onDoubleClick:v,onMouseDown:v}),l&&u.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}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 di(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){sy(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 sy(n,e,t){return e=ly(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ly(n){var e=dy(n,"string");return typeof e=="symbol"?e:String(e)}function dy(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Kl(n){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:r=!1,onCreateFile:i,onCreateFolder:o,onCopy:a,onDelete:s,onMove:l,onRename:d,onSelect:h,onSelectionChange:c,table:f,rowHeight:v=Ki,validateRename:p=()=>Promise.resolve()}=n,[g,y]=m.useState(),[P,O]=m.useState([]),[_,R]=m.useState(),U=m.useCallback(z=>{O(z),c?.(z)},[c]),Q=m.useCallback(z=>{R(z)},[]),N=m.useCallback(()=>{_&&a?.(_)},[_,a]),B=m.useCallback(()=>{P.length>0&&s?.(P)},[s,P]),$=m.useCallback(()=>{i?.()},[i]),Y=m.useCallback(()=>{_&&o?.(H.getPath(_.filename))},[_,o]),ne=m.useCallback(()=>{_&&y(_)},[_]),F=m.useCallback(()=>{y(void 0)},[]),q=m.useCallback(z=>{g&&(d?.(g,z),y(void 0))},[d,g]),K=m.useMemo(()=>{if(g)return[];var z=[];return i&&z.push({title:"New File",description:"Create new file",action:$,group:ee.groups.medium}),o&&z.push({title:"New Folder",description:"Create new folder",action:Y,group:ee.groups.medium}),a&&z.push({title:"Copy File",description:"Copy the selected file",action:N,group:ee.groups.low,disabled:_==null||mt(_)}),s&&P.length>0&&z.push({title:"Delete",description:"Delete",shortcut:Da.FILE_EXPLORER.DELETE,action:B,group:ee.groups.low}),d&&z.push({title:"Rename",description:"Rename",shortcut:Da.FILE_EXPLORER.RENAME,action:ne,group:ee.groups.low,disabled:_==null}),z},[N,B,$,Y,ne,_,a,i,o,s,d,P,g]),A=m.useCallback(z=>(k(g),p(g,z)),[g,p]),V=m.useCallback(z=>{var{item:me}=z;return g&&g.filename===me.filename?u.jsx(Pi,di(di({},z),{},{children:u.jsx(ay,{item:me,validate:A,onSubmit:q,onCancel:F})})):u.jsx(Pi,di({},z))},[F,q,g,A]);return u.jsxs("div",{className:"file-list-container",children:[f!=null&&u.jsx(ry,{onMove:l,onSelect:h,onSelectionChange:U,onFocusChange:Q,renderItem:V,rowHeight:v,table:f,isMultiSelect:e,focusedPath:t}),r&&u.jsx(ee,{actions:K})]})}Kl.displayName="FileListContainer";function Na(n,e,t){return e=uy(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function uy(n){var e=hy(n,"string");return typeof e=="symbol"?e:String(e)}function hy(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class cy extends qn{constructor(e){super("Name already exists"),Na(this,"isExistingFile",!0),Na(this,"info",void 0),this.info=e}}const Ir=cy;function Aa(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function La(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)})}}var gt=W.module("FileExplorer");function zi(n){var{storage:e,isMultiSelect:t=!1,focusedPath:r,onCopy:i=()=>{},onDelete:o=()=>{},onRename:a=()=>{},onCreateFile:s=()=>{},onCreateFolder:l=()=>{},onSelect:d,onSelectionChange:h,rowHeight:c=Ki}=n,[f,v]=m.useState([]),[p,g]=m.useState();m.useEffect(function(){var q;function K(){return A.apply(this,arguments)}function A(){return A=La(function*(){gt.debug("initTable"),q=Ee.makeCancelable(e.getTable(),V=>V.close());try{g(yield q)}catch(V){Ee.isCanceled(V)||gt.error("Unable to initialize table",V)}}),A.apply(this,arguments)}return K(),()=>{q.cancel()}},[e]);var y=m.useCallback(F=>{Ee.isCanceled(F)||gt.error(F)},[]),P=m.useCallback(()=>{gt.debug("handleCreateFile"),s()},[s]),O=m.useCallback(()=>{gt.debug("handleCreateFolder"),l()},[l]),_=m.useCallback(F=>{gt.debug("handleCopyFile",F.filename),i(F)},[i]),R=m.useCallback(F=>{gt.debug("handleDelete, pending confirmation",F),v(F)},[]),U=m.useCallback(()=>{gt.debug("handleDeleteConfirm",f),f.forEach(F=>e.deleteFile(mt(F)?H.makePath(F.filename):F.filename)),o(f),v([])},[f,o,e]),Q=m.useCallback(()=>{gt.debug("handleDeleteCancel"),v([])},[]),N=m.useCallback((F,q)=>{var K=H.reducePaths(F.map(A=>mt(A)?H.makePath(A.filename):A.filename));K.forEach(A=>{var V=H.isPath(A)?"".concat(q).concat(H.getBaseName(A.substring(0,A.length-1)),"/"):"".concat(q).concat(H.getBaseName(A));e.moveFile(A,V).then(()=>{a(A,V)}).catch(y)})},[y,a,e]),B=m.useCallback((F,q)=>{var K=F.filename,A=mt(F);A&&!K.endsWith("/")&&(K="".concat(K,"/"));var V="".concat(H.getParent(K)).concat(q);A&&!V.endsWith("/")&&(V="".concat(V,"/")),gt.debug2("handleRename",K,V),e.moveFile(K,V).catch(y),a(K,V)},[y,a,e]),$=m.useCallback(function(){var F=La(function*(q,K){if(K!==q.basename){H.validateName(K);var A="".concat(H.getPath(q.filename)).concat(K);try{var V=yield e.info(A);throw new Ir(V)}catch(z){if(!(z instanceof Vi))throw z}}});return function(q,K){return F.apply(this,arguments)}}(),[e]),Y=f.length>0,ne=m.useMemo(()=>f.length===1?'Are you sure you want to delete "'.concat(f[0].filename,'"?'):"Are you sure you want to delete the selected files?",[f]);return u.jsxs("div",{className:"file-explorer",children:[p&&u.jsx(Kl,{isMultiSelect:t,focusedPath:r,showContextMenu:!0,onCopy:_,onCreateFolder:O,onCreateFile:P,onMove:N,onDelete:R,onRename:B,onSelect:d,onSelectionChange:h,rowHeight:c,table:p,validateRename:$}),u.jsx(un,{isOpen:Y,headerText:ne,bodyText:"You cannot undo this action.",onCancel:Q,onConfirm:U,confirmButtonText:"Delete"})]})}zi.displayName="FileExplorer";function Fa(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function my(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Fa(o,r,i,a,s,"next",l)}function s(l){Fa(o,r,i,a,s,"throw",l)}a(void 0)})}}function Vt(n,e,t){return e=fy(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fy(n){var e=vy(n,"string");return typeof e=="symbol"?e:String(e)}function vy(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var tn=W.module("NewItemModal");class dn extends m.PureComponent{static getValidationMessage(e){return e instanceof Ir&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){Ee.isCanceled(e)||tn.error(e)}constructor(e){super(e),Vt(this,"inputRef",j.createRef()),Vt(this,"cancelableValidatePromise",void 0),Vt(this,"cancelableExistingItemPromise",void 0),Vt(this,"pending",new An),Vt(this,"pathMap",new Map),Vt(this,"isInitialLoad",!0),this.handleModalSubmit=this.handleModalSubmit.bind(this),this.handleModalOpened=this.handleModalOpened.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleChange=this.handleChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleValidationError=this.handleValidationError.bind(this),this.handleOverwriteCancel=this.handleOverwriteCancel.bind(this),this.handleOverwriteConfirm=this.handleOverwriteConfirm.bind(this),this.handleExtensionChangeCancel=this.handleExtensionChangeCancel.bind(this),this.handleExtensionChangeConfirm=this.handleExtensionChangeConfirm.bind(this),this.handleBreadcrumbSelect=this.handleBreadcrumbSelect.bind(this);var{defaultValue:t}=e,r=H.hasPath(t)?H.getPath(t):"/";this.state={isSubmitting:!1,path:r,prevExtension:H.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:H.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:r}=this.props,{isOpen:i}=e,{value:o,path:a}=this.state;!i&&r&&(this.resetValue(),this.isInitialLoad=!0),i&&r&&(!this.isInitialLoad&&(a!==t.path||o!==t.value)&&this.updateValidationStatus(a,o),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){var{defaultValue:e}=this.props,t=H.hasPath(e)?H.getPath(e):"/";this.setState({path:t,value:H.getBaseName(e),validationError:void 0,prevExtension:H.getExtension(e),isSubmitting:!1})}getValidationPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=Ee.makeCancelable(this.validateName(e,t,r)),this.cancelableValidatePromise}validateName(e,t,r){var i=this;return my(function*(){H.validateName(t);var{defaultValue:o,storage:a}=i.props;if(r){var s="".concat(e).concat(t);if(s!==o)try{var l=yield a.info(s);throw new Ir(l)}catch(d){if(!(d instanceof Vi))throw d}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(dn.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var{value:t}=e.target;this.setState({value:t})}handleSelect(e){if(tn.debug("handleSelect",e),e.type==="directory")this.setState({path:H.makePath(e.filename)});else{var t=e.basename,r=H.getPath(e.filename);this.setState({value:t,path:r},()=>{this.focusRenameInput()})}}handleKeyDown(e){var{key:t}=e;switch(e.stopPropagation(),t){case"Enter":{e.preventDefault(),this.submitModal();break}case"Escape":{e.preventDefault();var{onCancel:r}=this.props;r();break}}}handleValidationError(e){if(!(e instanceof qn))throw e;tn.debug("Validation error",e),this.setState({validationError:e})}handleOverwriteCancel(){this.setState({showOverwriteModal:!1,isSubmitting:!1})}handleOverwriteConfirm(){this.setState({showOverwriteModal:!1});var{onSubmit:e}=this.props,{path:t,value:r}=this.state;tn.debug("handleOverwriteConfirm",t,r),e("".concat(t).concat(r),!0)}handleExtensionChangeCancel(){tn.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:r}=e,i=H.replaceExtension(t,r);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){tn.debug("handleExtensionChangeConfirm"),this.setState({showExtensionChangeModal:!1}),this.submitModal(!0)}focusRenameInput(){var e=this.inputRef.current;if(e){var{type:t}=this.props,{value:r}=e,i=t==="directory"?r.length:r.lastIndexOf(".");e.focus(),e.setSelectionRange(0,i>0?i:r.length)}}submitModal(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.setState(t=>{var{prevExtension:r,value:i,path:o}=t,{notifyOnExtensionChange:a,type:s}=this.props;tn.debug("submitModal",r,i);var l=H.getExtension(i);return a&&!e&&r!==null&&r!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(o,i,!0).then(d=>{var{onSubmit:h}=this.props;h("".concat(o).concat(i))}).catch(d=>{if(d instanceof Ir&&s!=="directory"&&d.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw d}).catch(d=>{throw Ee.isCanceled(d)&&this.setState({isSubmitting:!1}),d}).catch(this.handleValidationError).catch(dn.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,"/"),u.jsxs(j.Fragment,{children:[u.jsx(se,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(o),"aria-label":i===0?"Home":void 0,icon:i===0?u.jsx(ue,{icon:zd,transform:"right-1.6"}):void 0,tooltip:i===0?"Home":void 0,children:r}),"/"]},o)})}render(){var{storage:e,isOpen:t,onCancel:r,placeholder:i,title:o,type:a}=this.props,{isSubmitting:s,path:l,showExtensionChangeModal:d,showOverwriteModal:h,validationError:c,value:f,prevExtension:v,newExtension:p}=this.state,g=a==="directory",y=H.fileExtensionToString(v),P=H.fileExtensionToString(p),O=g?"Create":"Save",_=g?"New folder name":"Save file as";return u.jsxs(u.Fragment,{children:[u.jsxs(Xa,{isOpen:t,toggle:r,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[u.jsx(Ya,{toggle:r,children:o}),u.jsx(Qa,{children:u.jsx("form",{children:u.jsxs("div",{className:"d-flex flex-column new-file-modal-content",children:[u.jsxs("div",{className:"flex-grow-0 mb-4",children:[u.jsx("label",{htmlFor:"file-name-input",children:_}),u.jsx("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:X("form-control",{"is-invalid":c}),value:f,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),c&&u.jsx("div",{className:"invalid-feedback",children:dn.getValidationMessage(c)})]}),u.jsxs("div",{className:"flex-grow-0",children:[u.jsx("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),u.jsx("div",{className:"flex-grow-1 file-explorer-container",children:u.jsx(zi,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),u.jsxs(_s,{children:[u.jsx(se,{kind:"secondary",onClick:r,children:"Cancel"}),u.jsx(se,{kind:"primary",disabled:s,onClick:this.handleModalSubmit,children:O})]})]}),u.jsx(un,{isOpen:h,headerText:"Confirm overwrite",bodyText:"File with this name already exists, are you sure you want to overwrite it?",onCancel:this.handleOverwriteCancel,onConfirm:this.handleOverwriteConfirm,cancelButtonText:"Cancel",confirmButtonText:"Overwrite"}),u.jsx(un,{isOpen:d,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(y,'" to "').concat(P,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(y,'"'),confirmButtonText:'Use "'.concat(P,'"')})]})}}Vt(dn,"propTypes",{isOpen:S.bool,title:S.string.isRequired,defaultValue:S.string,type:S.oneOf(["file","directory"]).isRequired,onSubmit:S.func,onCancel:S.func,placeholder:S.string,storage:S.shape({}).isRequired,notifyOnExtensionChange:S.bool});Vt(dn,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(n,e)=>{},onCancel:()=>{}});const zl=dn;function gy(n){var{createFile:e,createFolder:t,onSearchChange:r,defaultSearchText:i=""}=n;return u.jsxs("div",{className:"file-explorer-toolbar",children:[u.jsxs("div",{className:"file-explorer-toolbar-buttons",children:[u.jsx(se,{kind:"ghost",icon:us,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),u.jsx(se,{kind:"ghost",icon:Gd,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),r&&u.jsx("div",{className:"file-explorer-toolbar-search",children:u.jsx(Mh,{value:i,onChange:r,placeholder:"Search by name"})})]})}function Ra(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function py(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 Gl(n,e,t){return e=by(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function by(n){var e=yy(n,"string");return typeof e=="symbol"?e:String(e)}function yy(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var nn=W.module("FileExplorerPanel"),Cy=(n,e)=>{var t=js(n),r=ur(n,e.localDashboardId),{session:i,config:o}=r??{},a=o?.type;return{fileStorage:t,language:a,session:i}},Sy=Nn(Cy,null,null,{forwardRef:!0});function wy(n){var e=n;return e!=null&&typeof e.button=="number"}class Mn extends j.Component{static handleError(e){nn.error(e)}static isFocusEvent(e){return wy(e)?e.detail>=2:!0}constructor(e){super(e),this.handleFileSelect=this.handleFileSelect.bind(this),this.handleCopyFile=this.handleCopyFile.bind(this),this.handleCreateFile=this.handleCreateFile.bind(this),this.handleCreateDirectory=this.handleCreateDirectory.bind(this),this.handleCreateDirectoryCancel=this.handleCreateDirectoryCancel.bind(this),this.handleCreateDirectorySubmit=this.handleCreateDirectorySubmit.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleRename=this.handleRename.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this);var{session:t,language:r}=e;this.state={isShown:!1,language:r,session:t,showCreateFolder:!1,focusedFilePath:"/"}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){var{glEventHub:e}=this.props,{session:t,language:r}=this.state,i={language:r,value:""};nn.debug("handleCreateFile",t,r,i),e.emit(de.CREATE_NOTEBOOK,t,r,i)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){nn.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){nn.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(Mn.handleError)}handleCopyFile(e){var t=this;return py(function*(){var{fileStorage:r}=t.props;if(mt(e)){nn.error("Invalid item in handleCopyItem",e);return}var i=yield H.getUniqueCopyFileName(r,e.filename);yield r.copyFile(e.filename,i)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(r=>{t.emit(de.CLOSE_FILE,{id:r.filename,itemName:r.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=H.makePath(e[0].filename):t=H.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(nn.debug("fileSelect",e),e.type!=="directory"){var r=Mn.isFocusEvent(t),i={id:e.filename,itemName:e.filename},{glEventHub:o}=this.props,{session:a,language:s}=this.state,l={value:null,language:s};o.emit(de.SELECT_NOTEBOOK,a,s,l,i,r)}}handleRename(e,t){var{glEventHub:r}=this.props;nn.debug("handleRename",e,t),r.emit(de.RENAME_FILE,e,t)}handleSessionOpened(e,t){var{language:r}=t;this.setState({session:e,language:r})}handleSessionClosed(){this.setState({session:void 0,language:void 0})}handleShow(){this.setState({isShown:!0})}isHidden(){var{glContainer:e}=this.props,{isHidden:t}=e;return t}render(){var{fileStorage:e,glContainer:t,glEventHub:r}=this.props,{isShown:i,showCreateFolder:o,focusedFilePath:a}=this.state;return u.jsxs(dr,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:r,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[u.jsx(gy,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&u.jsx(zi,{isMultiSelect:!0,storage:e,onCopy:this.handleCopyFile,onCreateFile:this.handleCreateFile,onCreateFolder:this.handleCreateDirectory,onDelete:this.handleDelete,onRename:this.handleRename,onSelect:this.handleFileSelect,onSelectionChange:this.handleSelectionChange}),u.jsx(zl,{isOpen:o,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:a})]})}}Gl(Mn,"COMPONENT","FileExplorerPanel");Gl(Mn,"TITLE","File Explorer");var Ey=Sy(Mn);const _y=Ey;function tr(n,e,t){return e=Py(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Py(n){var e=Ty(n,"string");return typeof e=="symbol"?e:String(e)}function Ty(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ka=W.module("LogPanel");class Zr extends m.PureComponent{constructor(e){super(e),tr(this,"isBottomVisible",void 0),tr(this,"logView",void 0),this.handleResize=this.handleResize.bind(this),this.handleShow=this.handleShow.bind(this),this.handleHide=this.handleHide.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.isBottomVisible=!0,this.logView=null;var{session:t}=this.props;this.state={session:t}}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions(),this.logView&&(this.logView.triggerFindWidget(),this.isBottomVisible&&this.logView.scrollToBottom())}handleHide(){this.logView&&(this.isBottomVisible=this.logView.isBottomVisible())}handleSessionOpened(e){ka.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){ka.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){var{glContainer:e,glEventHub:t}=this.props,{session:r}=this.state;return u.jsxs(dr,{componentPanel:this,glContainer:e,glEventHub:t,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[r==null&&u.jsx("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),r!=null&&u.jsx(kf,{session:r,ref:i=>{this.logView=i}})]})}}tr(Zr,"defaultProps",{session:null});tr(Zr,"COMPONENT","LogPanel");tr(Zr,"TITLE","Log");var Oy=(n,e)=>{var t;return{session:(t=ur(n,e.localDashboardId))===null||t===void 0?void 0:t.session}},Iy=Nn(Oy,null,null,{forwardRef:!0})(Zr);const Dy=Iy;function ja(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function $a(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ja(o,r,i,a,s,"next",l)}function s(l){ja(o,r,i,a,s,"throw",l)}a(void 0)})}}function Ha(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 He(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ha(Object(t),!0).forEach(function(r){Me(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ha(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Me(n,e,t){return e=xy(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xy(n){var e=My(n,"string");return typeof e=="symbol"?e:String(e)}function My(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ny=m.lazy(()=>hs(()=>import("./MarkdownNotebook-dcf83e5c.js"),["./MarkdownNotebook-dcf83e5c.js","./vendor-3e5e4180.js","./helpers-de833af9.js","./vendor-7509d17c.css","./index-dd7f33be.js","./monaco-b5248072.js","./monaco-f18fde03.css","./index-7d08f7c0.css","./mathjax-d42af1a5.js","./MarkdownNotebook-9207e775.css"],import.meta.url)),le=W.module("NotebookPanel"),Ba=400;class Pe extends m.Component{static handleError(e){Ee.isCanceled(e)||le.error(e)}static unsavedNotebookCount(){return document.querySelectorAll(".".concat(Pe.UNSAVED_INDICATOR_CLASS_NAME,".").concat(Pe.UNSAVED_STATUS_CLASS_NAME)).length}static languageFromFileName(e){var t=H.getExtension(e).toLowerCase();switch(t){case"py":case"python":return"python";case"groovy":return"groovy";case"scala":return"scala";default:return null}}constructor(e){super(e),Me(this,"pending",void 0),Me(this,"debouncedSavePanelState",void 0),Me(this,"debouncedLoad",void 0),Me(this,"notebook",void 0),Me(this,"tabTitleElement",void 0),Me(this,"tabInitOnce",void 0),Me(this,"editor",void 0),Me(this,"getSettings",St((f,v)=>He(He({},f),{},{minimap:{enabled:v}}))),Me(this,"getOverflowActions",St((f,v)=>[{title:"Find",icon:Xd,action:this.handleFind,group:ee.groups.high,shortcut:ke.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:Ja,action:this.handleCopy,group:ee.groups.medium,order:20},{title:"Rename File",icon:Yd,action:this.handleShowRename,group:ee.groups.medium,order:30},{title:"Delete File",icon:as,action:this.handleDelete,group:ee.groups.medium,order:40},{title:"Show Minimap",icon:f?Gn:void 0,action:this.handleMinimapChange,group:ee.groups.low,shortcut:ke.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:v?Gn:void 0,action:this.handleWordWrapChange,group:ee.groups.low,shortcut:ke.NOTEBOOK.WORDWRAP,order:30}])),this.handleCloseCancel=this.handleCloseCancel.bind(this),this.handleCloseDiscard=this.handleCloseDiscard.bind(this),this.handleCloseSave=this.handleCloseSave.bind(this),this.handleCopy=this.handleCopy.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleDeleteConfirm=this.handleDeleteConfirm.bind(this),this.handleDeleteCancel=this.handleDeleteCancel.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleEditorChange=this.handleEditorChange.bind(this),this.handleFind=this.handleFind.bind(this),this.handleMinimapChange=this.handleMinimapChange.bind(this),this.handleWordWrapChange=this.handleWordWrapChange.bind(this),this.handleLinkClick=this.handleLinkClick.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handlePanelDropped=this.handlePanelDropped.bind(this),this.handleRenameFile=this.handleRenameFile.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRunCommand=this.handleRunCommand.bind(this),this.handleRunAll=this.handleRunAll.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.handleSave=this.handleSave.bind(this),this.handleSaveAsCancel=this.handleSaveAsCancel.bind(this),this.handleSaveAsSubmit=this.handleSaveAsSubmit.bind(this),this.handleSaveError=this.handleSaveError.bind(this),this.handleSaveSuccess=this.handleSaveSuccess.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleShowRename=this.handleShowRename.bind(this),this.handleTab=this.handleTab.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabClick=this.handleTabClick.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleTransformLinkUri=this.handleTransformLinkUri.bind(this),this.handleOverwrite=this.handleOverwrite.bind(this),this.handlePreviewPromotion=this.handlePreviewPromotion.bind(this),this.getDropdownOverflowActions=this.getDropdownOverflowActions.bind(this),this.pending=new An,this.debouncedSavePanelState=On(this.savePanelState.bind(this),Ba),this.debouncedLoad=On(this.load.bind(this),Ba),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;var{isDashboardActive:t,session:r,sessionLanguage:i,panelState:o}=e,a={value:"",language:"",wordWrap:"off"},s=null,{isPreview:l}=e;o!=null&&({fileMetadata:s=s,isPreview:l=l,settings:a=a}=o);var d=s!=null&&H.hasPath(s.itemName),h=d===!0&&a.value!=null||!d&&a.value!=null&&a.value.length>0,c=h?1:0;this.state={error:void 0,isDashboardActive:t,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:c,fileMetadata:s,settings:a,session:r,sessionLanguage:i,panelState:{fileMetadata:s,settings:a},showCloseModal:!1,showDeleteModal:!1,showSaveAsModal:!1,scriptCode:""},le.debug("constructor",e,this.state)}componentDidMount(){var{glContainer:e,glEventHub:t}=this.props,{tab:r}=e;r!=null&&this.initTab(r),this.initNotebookContent(),t.on(de.RENAME_FILE,this.handleRenameFile),t.on(te.DROPPED,this.handlePanelDropped),e.on(de.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion)}componentDidUpdate(e,t){var{isPreview:r,settings:i}=this.state,{wordWrap:o}=i,{defaultNotebookSettings:a}=this.props;r!==t.isPreview&&this.setPreviewStatus(),o!==t.settings.wordWrap&&(this.updateEditorWordWrap(),this.debouncedSavePanelState()),a.isMinimapEnabled!==e.defaultNotebookSettings.isMinimapEnabled&&this.updateEditorMinimap()}componentWillUnmount(){this.debouncedSavePanelState.flush(),this.pending.cancel();var{glEventHub:e,glContainer:t}=this.props,{fileMetadata:r,isPreview:i}=this.state;e.off(de.RENAME_FILE,this.handleRenameFile),e.off(te.DROPPED,this.handlePanelDropped),t.off(de.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion),e.emit(de.UNREGISTER_FILE,r,i)}initTab(e){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(e)}initTabCloseOverride(){var{glContainer:e}=this.props;e.beforeClose(t=>{if(t?.force===!0)return!0;var{changeCount:r,savedChangeCount:i}=this.state;return r!==i?(this.setState({showCloseModal:!0}),!1):!0})}initTabClasses(e){var t=e.element.get(0);k(t);var r=t.querySelector(".lm_title");this.tabTitleElement=r,r?.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){var{changeCount:e,savedChangeCount:t,settings:r}=this.state,{value:i}=r;if(e!==t&&this.notebook){var o=this.notebook.getValue();return o??i}return i}initNotebookContent(){var{fileMetadata:e,settings:t,isPreview:r}=this.state;if(e&&e.id){le.debug("Init content from file"),this.registerFileMetadata(e,r),this.load();return}if(t.value!=null){le.debug("Use content passed in the settings prop"),this.handleLoadSuccess();return}this.handleLoadError(new Error("Missing file metadata"))}closeFileTabById(e){var{glEventHub:t}=this.props;t.emit(de.CLOSE_FILE,{id:e})}registerFileMetadata(e,t){var{glEventHub:r,metadata:i}=this.props,{id:o}=i;r.emit(de.REGISTER_FILE,o,e,t)}renameTab(e,t){var{glEventHub:r}=this.props;r.emit(de.RENAME,e,t)}load(){var{fileMetadata:e,settings:t}=this.state;k(e);var{id:r}=e,{fileStorage:i}=this.props;this.pending.add(i.loadFile(r)).then(o=>{var a;le.debug("Loaded file",o);var{filename:s}=o,{itemName:l}=this.state;if(s!==l){var{metadata:d}=this.props,{id:h}=d;this.renameTab(h,H.getBaseName(s))}var c=He(He({},t),{},{language:(a=Pe.languageFromFileName(s))!==null&&a!==void 0?a:""});t.value==null&&(c.value=o.content),t.wordWrap===void 0&&(t.wordWrap="off"),this.setState({fileMetadata:{id:s,itemName:s},settings:c}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){var{fileMetadata:e}=this.state;if(e&&H.hasPath(e.itemName)){var t=this.getNotebookValue();return t!==void 0?(this.saveContent(e.itemName,t),!0):!1}return this.setState({showSaveAsModal:!0}),!1}saveContent(e,t){le.debug("saveContent",e,t),this.updateSavedChangeCount();var{fileStorage:r}=this.props;this.pending.add(r.saveFile({filename:e,content:t,basename:e})).then(this.handleSaveSuccess).catch(this.handleSaveError)}updateSavedChangeCount(){this.setState(e=>{var{changeCount:t}=e;return{savedChangeCount:t}})}setPreviewStatus(){if(this.tabTitleElement){var{isPreview:e}=this.state;le.debug("setPreviewStatus",this.tabTitleElement,e),e?this.tabTitleElement.classList.add("is-preview"):this.tabTitleElement.classList.remove("is-preview")}}handlePreviewPromotion(){this.removePreviewStatus()}savePanelState(){this.setState(e=>{var{changeCount:t,savedChangeCount:r,fileMetadata:i,isPreview:o,settings:a}=e,s=this.getNotebookValue(),l=t!==r?s:void 0,d=He(He({},a),{},{value:s}),h=He(He({},a),{},{value:l}),c={settings:h,fileMetadata:i,isPreview:o};return le.debug("Saving panel state",c),{settings:d,panelState:c}})}handleCloseDiscard(){this.setState({showCloseModal:!1});var{glContainer:e}=this.props;e.close({force:!0})}handleCloseSave(){if(this.setState({showCloseModal:!1}),this.save()){var{glContainer:e}=this.props;e.close({force:!0})}}handleCloseCancel(){this.setState({showCloseModal:!1})}handleOverwrite(e){var{glEventHub:t}=this.props;t.emit(de.CLOSE_FILE,{id:e,itemName:e},{force:!0}),this.focus()}handleCopy(){var e=this;return $a(function*(){var{fileStorage:t,glEventHub:r,session:i}=e.props,{fileMetadata:o,settings:a}=e.state;k(o);var{language:s}=a,{itemName:l}=o,d=yield H.getUniqueCopyFileName(t,l);le.debug("handleCopy",o,l,d),yield t.copyFile(l,d);var h={id:d,itemName:d},c={value:null,language:s};r.emit(de.SELECT_NOTEBOOK,i,s,c,h,!0)})()}handleDelete(){le.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var e=this;return $a(function*(){var{fileStorage:t,glContainer:r,glEventHub:i}=e.props,{fileMetadata:o}=e.state;le.debug("handleDeleteConfirm",o?.itemName),e.setState({showDeleteModal:!1}),o&&(H.hasPath(o.itemName)&&(yield H.fileExists(t,o.itemName))?(i.emit(de.CLOSE_FILE,o,{force:!0}),t.deleteFile(o.itemName)):r.close({force:!0}))})()}handleDeleteCancel(){this.setState({showDeleteModal:!1})}handleEditorInitialized(e){this.editor=e}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(e){le.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(t=>{var{changeCount:r,savedChangeCount:i}=t,{isUndoing:o,isRedoing:a}=e;return o?{changeCount:r-1,savedChangeCount:i}:!a&&r<i?{changeCount:r+1,savedChangeCount:0}:{changeCount:r+1,savedChangeCount:i}}),this.debouncedSavePanelState()}handleFind(){this.notebook&&this.notebook.toggleFind()}updateEditorMinimap(){if(this.editor){var{defaultNotebookSettings:e}=this.props;this.editor.updateOptions({minimap:{enabled:e.isMinimapEnabled}})}}handleMinimapChange(){var e,{defaultNotebookSettings:t,updateSettings:r}=this.props,i={defaultNotebookSettings:{isMinimapEnabled:!((e=t.isMinimapEnabled)!==null&&e!==void 0&&e)}};r(i)}updateEditorWordWrap(){if(this.editor){var{settings:e}=this.state,{wordWrap:t}=e;this.editor.updateOptions({wordWrap:t})}}handleWordWrapChange(){this.editor&&this.setState(e=>{var{settings:t}=e,r=t.wordWrap==="on"?"off":"on";return{settings:He(He({},t),{},{wordWrap:r})}})}handleLinkClick(e){var{notebooksUrl:t,session:r,sessionLanguage:i}=this.props,{href:o}=e.currentTarget;if(!(!o||!o.startsWith(t))){e.stopPropagation(),e.preventDefault();var a="/".concat(o.substring(t.length)).replace(/%20/g," ");if(a==="/"){le.debug("Ignoring invalid notebook link",a);return}le.debug("Notebook link clicked, opening",a);var{glEventHub:s}=this.props,l={value:null,language:i},d={id:a,itemName:a};s.emit(de.SELECT_NOTEBOOK,r,i,l,d)}}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(e){var t=e;Ee.isCanceled(t)||(Ee.isTimedOut(t)&&(t=new Error("File not found.")),le.error(t),this.setState({error:t,isLoading:!1}))}handleSave(){le.debug("handleSave"),this.save()}handleSaveSuccess(e){var t,{fileStorage:r}=this.props,i={id:e.filename,itemName:e.filename},o=(t=Pe.languageFromFileName(e.filename))!==null&&t!==void 0?t:"";this.setState(a=>{var{fileMetadata:s}=a,l=He(He({},a.settings),{},{language:o});return le.debug("handleSaveSuccess",i,s,l),s&&H.hasPath(s.itemName)&&s.itemName!==i.itemName&&(le.debug("handleSaveSuccess deleting old file",s.itemName),r.deleteFile(s.itemName).catch(Pe.handleError)),{fileMetadata:i,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(i,!1)}handleSaveError(e){Ee.isCanceled(e)||(this.setState({savedChangeCount:0}),le.error(e))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;r&&this.handleOverwrite(e),le.debug("handleSaveAsSubmit",e);var{fileMetadata:i}=this.state;if(i){var{itemName:o}=i,a=(t=this.getNotebookValue())!==null&&t!==void 0?t:"";if(this.setState({showSaveAsModal:!1}),H.getBaseName(o)!==H.getBaseName(e)){var{metadata:s}=this.props,{id:l}=s;this.renameTab(l,H.getBaseName(e))}this.saveContent(e,a)}}handleRenameFile(e,t,r){var{fileMetadata:i,panelState:o}=this.state,{glContainer:a}=this.props;if(i?.itemName==="/".concat(t)&&r&&JSON.stringify(o)!==JSON.stringify(r)){a.close();return}i&&i.id===e&&(this.setState({fileMetadata:{id:t,itemName:t}}),this.debouncedSavePanelState())}handleResize(){var e;(e=this.notebook)===null||e===void 0||e.updateDimensions()}handleRunCommand(e){this.runCommand(e)}handleRunAll(){var e;if(!this.notebook){le.error("Editor is not initialized.");return}this.runCommand((e=this.notebook.getValue())!==null&&e!==void 0?e:void 0)}handleRunSelected(){if(!this.notebook){le.error("Editor is not initialized.");return}this.runCommand(this.notebook.getSelectedCommand())}handleSessionOpened(e,t){var{language:r}=t;this.setState({session:e,sessionLanguage:r})}handleSessionClosed(){this.setState({session:void 0,sessionLanguage:void 0})}handleShow(){var e;le.debug("handleShow"),(e=this.notebook)===null||e===void 0||e.updateDimensions()}handlePanelDropped(e){var{metadata:{id:t}}=this.props;e===t&&this.forceUpdate()}handleShowRename(){this.setState({showSaveAsModal:!0})}handleTab(e){le.debug("NotebookPanel tab event",e),this.initTab(e)}handleTabFocus(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];le.debug("handleTabFocus",...t);var{glContainer:i}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!i.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){le.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handleTabClick(e){le.debug("handle NotebookPanel tab click"),this.focus(),e.detail===2&&this.removePreviewStatus()}handleTransformLinkUri(e){var{notebooksUrl:t}=this.props,{fileMetadata:r}=this.state;if(e.endsWith("/"))return e;if(e.startsWith("/"))return"".concat(t).concat(e.substring(1));var i=r?.itemName;if(i===void 0)return e;i.charAt(0)==="/"&&(i=i.substring(1));var o=new URL(i,t);return new URL(e,o).href}focus(){requestAnimationFrame(()=>{this.notebook&&this.notebook.focus()})}createNotebook(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{glEventHub:i}=this.props,{session:o,sessionLanguage:a,settings:s}=this.state,l=He(He({},s),{},{language:t,value:r}),d={id:null,itemName:e};le.debug("handleCreateNotebook",o,a,l,d),i.emit(de.CREATE_NOTEBOOK,o,a,l,d)}runCommand(e){if(e===void 0||e===""){le.debug("Ignoring empty command.");return}this.removePreviewStatus();var{glEventHub:t}=this.props;t.emit(at.SEND_COMMAND,e,!1,!0)}removePreviewStatus(){this.setState(e=>{var{isPreview:t}=e;if(t){var{fileMetadata:r}=this.state;return r&&this.registerFileMetadata(r,!1),{isPreview:!1}}return null})}getDropdownOverflowActions(){var e,t,{defaultNotebookSettings:r}=this.props,{settings:i}=this.state;return this.getOverflowActions((e=r.isMinimapEnabled)!==null&&e!==void 0?e:!1,this.getSettings(i,(t=r.isMinimapEnabled)!==null&&t!==void 0?t:!1).wordWrap==="on")}render(){var e,t,r,{fileStorage:i,glContainer:o,glContainer:{tab:a},glEventHub:s,defaultNotebookSettings:l}=this.props,{changeCount:d,savedChangeCount:h,error:c,isDashboardActive:f,isLoaded:v,isLoading:p,isPreview:g,fileMetadata:y,session:P,sessionLanguage:O,settings:_,showCloseModal:R,showDeleteModal:U,showSaveAsModal:Q}=this.state,N=f&&!o.isHidden&&!g,B=(e=y?.itemName)!==null&&e!==void 0?e:Pe.DEFAULT_NAME,$=B.endsWith(".md"),Y=y?.id!=null,ne=this.getSettings(_,(t=l.isMinimapEnabled)!==null&&t!==void 0?t:!1),F=P!=null,q=O===ne.language,K=!v||!F||!q,A=!v,V=[{action:this.handleSave,shortcut:Gt.SAVE},{action:this.handleMinimapChange,shortcut:ke.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:ke.NOTEBOOK.WORDWRAP}],z=gi.getDisabledRunTooltip(F,q,"Notebook extension","Run"),me=gi.getDisabledRunTooltip(F,q,"Notebook extension","Run Selected"),je=[{title:Y?"Rename":"Save As…",order:10,group:ee.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:ee.groups.high,order:20}],Ie=a?.element.find(".lm_title_before").get(0);return u.jsxs(u.Fragment,{children:[Ie!=null&&Hr.createPortal(u.jsx("span",{className:X(Pe.UNSAVED_INDICATOR_CLASS_NAME,{[Pe.UNSAVED_STATUS_CLASS_NAME]:d!==h})}),Ie),u.jsxs(dr,{className:"notebook-container",componentPanel:this,glContainer:o,glEventHub:s,onTab:this.handleTab,onResize:this.handleResize,onShow:this.handleShow,onTabClicked:this.handleTabClick,onTabFocus:this.handleTabFocus,onTabBlur:this.handleTabBlur,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,additionalActions:je,renderTabTooltip:()=>B,children:[!$&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"notebook-toolbar",children:[u.jsxs("span",{children:[u.jsx(se,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:K,icon:u.jsx(ue,{icon:ds,transform:"grow-4"}),tooltip:"Run ".concat(ke.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),z!=null&&u.jsx(Xt,{children:z})]}),u.jsxs("span",{children:[u.jsx(se,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:K,icon:u.jsx(ue,{icon:qd,transform:"grow-4"}),tooltip:"Run Selected ".concat(ke.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),me!=null&&u.jsx(Xt,{children:me})]}),u.jsx(se,{kind:"ghost",className:"mr-auto",disabled:A,onClick:this.handleSave,icon:Zd,tooltip:"Save ".concat(Gt.SAVE.getDisplayText()),"aria-label":"Save"}),u.jsx(se,{kind:"ghost",className:"btn-overflow",disabled:A,icon:ls,tooltip:"More Actions...",onClick:()=>{},children:u.jsx(Xn,{actions:this.getDropdownOverflowActions,popperOptions:Pe.POPPER_OPTIONS})})]}),u.jsx(Cf,{isLoaded:v,isLoading:p,error:c,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:P,sessionLanguage:O,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:ne,focusOnMount:N,ref:b=>{this.notebook=b}})]}),$&&u.jsx(m.Suspense,{fallback:u.jsx(hn,{}),children:u.jsx(Ny,{content:(r=ne.value)!==null&&r!==void 0?r:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri})}),u.jsx(zl,{isOpen:Q,type:"file",defaultValue:B,title:Y?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:i}),u.jsx(un,{isOpen:U,headerText:'Are you sure you want to delete "'.concat(B,'"?'),bodyText:"You cannot undo this action.",onCancel:this.handleDeleteCancel,onConfirm:this.handleDeleteConfirm,confirmButtonText:"Delete"}),u.jsx(un,{isOpen:R,headerText:"Do you want to save the changes you made to ".concat(B,"?"),bodyText:"Your changes will be lost if you don't save them.",onCancel:this.handleCloseCancel,onDiscard:this.handleCloseDiscard,onConfirm:this.handleCloseSave,discardButtonText:"Discard Changes",confirmButtonText:"Save"}),u.jsx(ee,{actions:V})]})]})}}Me(Pe,"COMPONENT","NotebookPanel");Me(Pe,"POPPER_OPTIONS",{placement:"bottom-end"});Me(Pe,"DEFAULT_NAME","Untitled");Me(Pe,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");Me(Pe,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");Me(Pe,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,defaultNotebookSettings:{isMinimapEnabled:!0}});var Ay=(n,e)=>{var t=js(n),r=hc(n),i=ur(n,e.localDashboardId),{session:o,config:a}=i??{},{type:s}=a??{};return{fileStorage:t,defaultNotebookSettings:r,session:o,sessionLanguage:s}},Ly=Nn(Ay,{updateSettings:bc},null,{forwardRef:!0})(Pe);const rn=Ly;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 Ua(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){Fy(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 Fy(n,e,t){return e=Ry(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ry(n){var e=ky(n,"string");return typeof e=="symbol"?e:String(e)}function ky(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ye=W.module("ConsolePlugin");function Va(n){return n.notebook!==void 0}function jy(n){wp(n)}function CS(n){jy(n);var{id:e,hydrateConsole:t,layout:r,panelManager:i,registerComponent:o,notebooksUrl:a}=n,s=m.useRef(0),[l,d]=m.useState(new Map),[h,c]=m.useState(new Map),f=Oi(),v=m.useCallback(()=>i.getLastUsedPanelOfType(li),[i]),p=m.useCallback((b,w)=>{d(T=>new Map(T.set(b,w)))},[d]),g=m.useCallback(b=>{d(w=>(w.delete(b),new Map(w)))},[d]),y=m.useCallback((b,w)=>{c(T=>new Map(T.set(b,w)))},[c]),P=m.useCallback(b=>{c(w=>(w.delete(b),new Map(w)))},[c]),O=m.useCallback(function(b){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,T=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,G=b&&b.trim();if(!G)ye.info("Ignoring empty code");else{var J=v();if(!J||!(J instanceof li.WrappedComponent)){ye.error("Console panel not found");return}ye.debug("Send command: ",b,w,T),J.addCommand(b,w,T)}},[v]),_=m.useCallback(b=>{f(Ob(e,b))},[f,e]),R=m.useCallback(b=>{var{language:w}=b,T=w==="python"?"py":w,G=null;return T==null?(ye.debug("No extension for language",w),G="Untitled-".concat(s.current)):G="Untitled-".concat(s.current,".").concat(T),s.current+=1,G},[]),U=m.useCallback(function(b){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{id:T}=b;if(T!=null&&l.has(T))return l.get(T);if(T!=null&&h.has(T))return h.get(T);if(w)return At()},[l,h]),Q=m.useCallback((b,w)=>{D.renameComponent(r.root,{id:b},w)},[r.root]),N=m.useCallback((b,w)=>{ye.debug("Rename file panel",b,w);var T;if(l.has(b)&&(T=l.get(b),g(b),T!=null&&p(w,T)),h.has(b)&&(T=h.get(b),P(b),T!=null&&y(w,T)),T===void 0){ye.debug2("File ".concat(b," isn't open, no need to rename the tab"));return}Q(T,H.getBaseName(w))},[l,h,Q,p,y,g,P]),B=m.useCallback(b=>{var w=U(b,!1);if(w==null){ye.error("Could not find panel id for file metadata",b);return}D.activateTab(r.root,{id:w})},[U,r.root]),$=m.useCallback((b,w,T)=>{if(ye.debug("registerFilePanel",b,w,T),w==null||w.id==null){ye.debug("Ignore empty file id",w);return}var{id:G}=w;if(T){y(G,b);return}if(l.has(G)){var J=l.get(G);if(b===J){ye.debug("Update tab title for file ".concat(G));var{itemName:et}=w;N(G,et)}else ye.error("File ".concat(G," already associated with a different tab ").concat(J));return}p(G,b),h.has(G)&&P(G)},[l,h,N,p,y,P]),Y=m.useCallback((b,w)=>{if(ye.debug("unregisterFileTab",b,w),b==null||b.id==null){ye.debug("Ignore empty file id",b);return}var{id:T}=b;if(w){P(T);return}g(T)},[g,P]),ne=m.useCallback((b,w)=>{ye.debug("closeFilePanel",b);var{id:T}=b,G=null,J=!1;if(l.has(T))G=l.get(T);else if(h.has(T))G=h.get(T),J=!0;else{ye.debug("File ".concat(T," isn't open, ignore close event"));return}Y(b,J),D.closeComponent(r.root,{id:G},w)},[r.root,l,h,Y]),F=m.useCallback(b=>{var{itemName:w}=b;return H.getBaseName(w)},[]),q=m.useCallback(b=>{var{id:w}=b;return ye.debug("fileIsOpen",b,w,l),w!=null&&l.has(w)},[l]),K=m.useCallback(b=>{var{id:w}=b;return ye.debug("fileIsOpenAsPreview",b,w,h),w!=null&&h.has(w)},[h]),A=m.useCallback(b=>{if(b!=null){var w=i.getOpenedPanelById(b);w&&Va(w)&&w.focus()}},[i]),V=m.useCallback(b=>{var{id:w,settings:T,fileMetadata:G,session:J,sessionLanguage:et,isPreview:I=!1}=b,Z={settings:T,fileMetadata:G},re=F(G);return{type:"react-component",component:rn.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:w},session:J,sessionLanguage:et,panelState:Z,isPreview:I,notebooksUrl:a},title:re,id:w}},[F,e,a]),z=m.useCallback(function(b,w,T){var G=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{id:null,itemName:R(T)},J=U(G);if(q(G)&&J!=null){ye.debug("File is already open, focus panel"),B(G),A(J);return}var et=D.getStackForComponentTypes(r.root,[rn.COMPONENT]),I=V({id:J,settings:T,fileMetadata:G,session:b,sessionLanguage:w});ye.debug("createNotebook",I,l),D.openComponentInStack(et,I)},[q,A,R,U,r.root,V,l,B]),me=m.useCallback(function(b,w,T,G){var J=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;ye.debug("selectNotebook",G,J);var et=q(G),I=K(G),[Z]=[...h.values()],re=!J,he=re&&Z?Z:U(G);if(he==null||he==="")throw new Error("Unable to retrieve or create panelId for metadata",G);if(et||I)B(G);else{var Ae=D.getStackForComponentTypes(r.root,[rn.COMPONENT]),Et=V({id:he,settings:T,fileMetadata:G,session:b,sessionLanguage:w,isPreview:re});D.openComponentInStack(Ae,Et)}if(I&&J){var _t=G.id,Yr=D.getStackForConfig(r.root,{component:rn.COMPONENT,id:he}),Rn=D.getContentItemInStack(Yr,{component:rn.COMPONENT,id:he});Rn&&Ze(Rn)&&(Rn.container.emit(de.PROMOTE_FROM_PREVIEW),P(_t),p(_t,he))}J&&A(he)},[B,q,K,A,U,r.root,V,h,P,p]),je=m.useCallback(function(b,w){var T=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},G=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,J=i.getLastUsedPanelOfType(rn);J&&Va(J)?T!=null&&T.value!=null&&J.notebook!=null&&J.notebook.append(T.value):G&&z(b,w,T)},[z,i]),Ie=m.useCallback((b,w)=>Mp.hydrate(Ua(Ua({},b),{},{notebooksUrl:a}),w),[a]);return $n(o,li,t),$n(o,Nb),$n(o,_y),$n(o,Dy),$n(o,rn,Ie),xe(r.eventHub,at.SEND_COMMAND,O),xe(r.eventHub,at.SETTINGS_CHANGED,_),xe(r.eventHub,de.CLOSE_FILE,ne),xe(r.eventHub,de.CREATE_NOTEBOOK,z),xe(r.eventHub,de.SELECT_NOTEBOOK,me),xe(r.eventHub,de.RENAME,Q),xe(r.eventHub,de.RENAME_FILE,N),xe(r.eventHub,de.SEND_TO_NOTEBOOK,je),xe(r.eventHub,de.REGISTER_FILE,$),xe(r.eventHub,de.UNREGISTER_FILE,Y),null}function Xr(n,e,t){return e=$y(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $y(n){var e=Hy(n,"string");return typeof e=="symbol"?e:String(e)}function Hy(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class mr{}Xr(mr,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");Xr(mr,"INPUT_FILTER","ControlType.INPUT_FILTER");Xr(mr,"MARKDOWN","ControlType.MARKDOWN");Xr(mr,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");const SS=mr;export{Ne as $,pC as A,se as B,ch as C,fs as D,Es as E,ol as F,Ve as G,Gt as H,st as I,Qy as J,x as K,SS as L,JC as M,Xn as N,Jn as O,Ee as P,Ec as Q,Ni as R,ec as S,E as T,PC as U,Ll as V,GC as W,Qt as X,pc as Y,bC as Z,Hp as _,ve as a,we as a$,cc as a0,sS as a1,ur as a2,iC as a3,$s as a4,Mp as a5,ru as a6,cs as a7,XC as a8,de as a9,ku as aA,Ss as aB,Cs as aC,Lu as aD,Au as aE,xt as aF,Qe as aG,Tn as aH,hh as aI,Mh as aJ,$h as aK,Fh as aL,L as aM,_s as aN,Br as aO,ws as aP,Yy as aQ,Hh as aR,nc as aS,Fs as aT,Ls as aU,eC as aV,tC as aW,nC as aX,gs as aY,Bf as aZ,Uf as a_,Sa as aa,te as ab,QC as ac,rn as ad,rc as ae,Vy as af,xi as ag,CS as ah,ee as ai,un as aj,bS as ak,TC as al,CC as am,OC as an,EC as ao,_C as ap,lS as aq,dS as ar,yC as as,wC as at,Hs as au,SC as av,Xe as aw,Zy as ax,Nu as ay,rr as az,ht as b,Il as b$,Xf as b0,dv as b1,ev as b2,Ue as b3,IC as b4,rl as b5,il as b6,MC as b7,LC as b8,DC as b9,No as bA,nf as bB,af as bC,mi as bD,vf as bE,xv as bF,kf as bG,ae as bH,ke as bI,Cf as bJ,gi as bK,zy as bL,D as bM,$n as bN,xe as bO,zC as bP,si as bQ,Jp as bR,Qp as bS,Fp as bT,Np as bU,Tp as bV,Fl as bW,Wi as bX,Ml as bY,wp as bZ,xp as b_,xC as ba,NC as bb,iv as bc,FC as bd,RC as be,uv as bf,hv as bg,jC as bh,kC as bi,al as bj,$C as bk,Tv as bl,Cv as bm,Ov as bn,hf as bo,Bs as bp,Nf as bq,Of as br,nl as bs,Pf as bt,Ws as bu,jc as bv,Fc as bw,Us as bx,Mc as by,Ic as bz,C as c,Gy as c$,VC as c0,KC as c1,Al as c2,Dl as c3,Sp as c4,kr as c5,kp as c6,BC as c7,UC as c8,qC as c9,Dy as cA,Nb as cB,_y as cC,vs as cD,Ky as cE,dr as cF,ps as cG,Jv as cH,cS as cI,An as cJ,rS as cK,iS as cL,oS as cM,nS as cN,Wl as cO,eS as cP,fS as cQ,tS as cR,mt as cS,Ul as cT,uS as cU,hS as cV,mS as cW,at as cX,wr as cY,aS as cZ,Ob as c_,YC as ca,Kp as cb,Ui as cc,cr as cd,Ab as ce,Bb as cf,pS as cg,$b as ch,kb as ci,Fb as cj,Lb as ck,vS as cl,Rb as cm,gS as cn,jb as co,Vl as cp,wa as cq,qy as cr,ui as cs,Hg as ct,ZC as cu,Cp as cv,H as cw,Vi as cx,yS as cy,li as cz,ys as d,Xy as d0,Qr as d1,AC as d2,qn as d3,bc as e,sC as f,aC as g,lC as h,rC as i,uC as j,hC as k,cC as l,mC as m,fC as n,uc as o,oC as p,pe as q,ce as r,Xt as s,Ye as t,tc as u,vC as v,Jy as w,dC as x,WC as y,gC as z};
22
- //# sourceMappingURL=ControlType-7a644160.js.map
21
+ `)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,be.bufferTimeout))}stopFlushTimer(){this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=void 0)}updateDimensions(){this.editor&&this.editor.layout()}handleClearClick(){this.clearLogs()}clearLogs(){this.messages=[],this.refreshLogText()}handleFlushTimeout(){this.stopFlushTimer(),this.flush()}handleLogMessage(e){this.messages.push(e),this.editor&&this.isLogItemVisible(e)&&this.queue(e)}handleMenuItemClick(e){this.toggleLogLevel(e)}handleResetClick(){this.resetLogLevels()}handleResize(){this.updateDimensions()}handleToggleAllClick(){this.toggleAll()}render(){var e={placement:"bottom-end"},{shownLogLevels:t}=this.state,r=this.getMenuActions(t);return u.jsxs("div",{className:"log-pane h-100 w-100",children:[u.jsxs("div",{className:"log-pane-menu",children:[u.jsx(se,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:Fd,tooltip:"Clear log"}),u.jsx(se,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:Rd,tooltip:"Log Settings",onClick:()=>{},children:u.jsx(Xn,{actions:r,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),u.jsx("div",{className:"log-pane-editor h-100 w-100",ref:i=>{this.editorContainer=i}})]})}}qe(be,"DefaultLogLevels",[Te.STDOUT,Te.ERROR,Te.FATAL,Te.STDERR,Te.WARN]);qe(be,"AllLogLevels",[Te.INFO,Te.STDOUT,Te.ERROR,Te.FATAL,Te.STDERR,Te.WARN,Te.DEBUG,Te.TRACE]);qe(be,"bufferTimeout",16);qe(be,"maxLogSize",131072);qe(be,"truncateSize",65536);const kf=be;function Fi(n,e,t){return e=jf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jf(n){var e=$f(n,"string");return typeof e=="symbol"?e:String(e)}function $f(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class zr{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""}}Fi(zr,"TYPE_GLOBAL","type-global");Fi(zr,"TYPE_CONTEXT_PRESET","type-context-preset");Fi(zr,"TYPE_CONTEXT_CUSTOM","type-context-custom");const Ue=zr;class Hf extends Ue{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}const Bf=Hf;class Wf extends Ue{format(e){return String.fromCharCode(e)}}const Uf=Wf;function Wt(n,e,t){return e=Vf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Vf(n){var e=Kf(n,"string");return typeof e=="symbol"?e:String(e)}function Kf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Yo=W.module("DateTimeColumnFormatter");class ht extends Ue{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]:Ue.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=ht.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=ht.makeFormatStringMap(e,t);return[...r.keys()]}constructor(e){var{timeZone:t="",showTimeZone:r=!0,showTSeparator:i=!1,defaultDateTimeFormatString:o=ht.DEFAULT_DATETIME_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Wt(this,"dh",void 0),Wt(this,"dhTimeZone",void 0),Wt(this,"defaultDateTimeFormatString",void 0),Wt(this,"showTimeZone",void 0),Wt(this,"showTSeparator",void 0),Wt(this,"formatStringMap",void 0);var a=t||ht.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(a)}catch{Yo.error("Unsupported time zone id",a),this.dhTimeZone=e.i18n.TimeZone.getTimeZone(ht.DEFAULT_TIME_ZONE_ID)}this.dh=e,this.defaultDateTimeFormatString=o,this.showTimeZone=r,this.showTSeparator=i,this.formatStringMap=ht.makeFormatStringMap(r,i)}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{Yo.error("Invalid format arguments")}return""}}Wt(ht,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");Wt(ht,"DEFAULT_TIME_ZONE_ID","America/New_York");function ft(n,e,t){return e=zf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zf(n){var e=Gf(n,"string");return typeof e=="symbol"?e:String(e)}function Gf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var qf=W.module("DecimalColumnFormatter");class ve extends Ue{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]:Ue.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,Ue.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,Ue.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{defaultFormatString:t=ve.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),ft(this,"defaultFormatString",void 0),ft(this,"dh",void 0),this.dh=e,this.defaultFormatString=t}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{qf.error("Invalid format arguments")}return""}}ft(ve,"DEFAULT_FORMAT_STRING","###,##0.0000");ft(ve,"FORMAT_PERCENT",ve.makePresetFormat("Percent","##0.00%"));ft(ve,"FORMAT_BASIS_POINTS",ve.makePresetFormat("Basis Points","###,##0 bp",1e4));ft(ve,"FORMAT_THOUSANDS",ve.makePresetFormat("Thousands","##0.000 k",.001));ft(ve,"FORMAT_MILLIONS",ve.makePresetFormat("Millions","###,##0.000 mm",1e-6));ft(ve,"FORMAT_SCIENTIFIC_NOTATION",ve.makePresetFormat("Scientific Notation","0.0000E0"));ft(ve,"FORMAT_ROUND",ve.makePresetFormat("Round","###,##0"));ft(ve,"FORMAT_ROUND_TWO_DECIMALS",ve.makePresetFormat("0.00","###,##0.00"));ft(ve,"FORMAT_ROUND_FOUR_DECIMALS",ve.makePresetFormat("0.0000","###,##0.0000"));class Zf extends Ue{format(e){return"".concat(e)}}const Xf=Zf;function xn(n,e,t){return e=Yf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yf(n){var e=Qf(n,"string");return typeof e=="symbol"?e:String(e)}function Qf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Jf=W.module("IntegerColumnFormatter");class st extends Ue{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]:Ue.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 st.makeFormat(e,t,Ue.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 st.makeFormat("Custom Format",e,Ue.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{defaultFormatString:t=st.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),xn(this,"dh",void 0),xn(this,"defaultFormatString",void 0),this.dh=e,this.defaultFormatString=t}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{Jf.error("Invalid format arguments")}return""}}xn(st,"DEFAULT_FORMAT_STRING","###,##0");xn(st,"FORMAT_THOUSANDS",st.makePresetFormat("Thousands","##0.000 k",.001));xn(st,"FORMAT_MILLIONS",st.makePresetFormat("Millions","###,##0.000 mm",1e-6));xn(st,"FORMAT_SCIENTIFIC_NOTATION",st.makePresetFormat("Scientific Notation","0.0000E0"));class ev extends Ue{format(e){return e}}function Qo(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 Jo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qo(Object(t),!0).forEach(function(r){Ri(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Qo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ri(n,e,t){return e=tv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tv(n){var e=nv(n,"string");return typeof e=="symbol"?e:String(e)}function nv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var rv=/\s*(\d{4})([-./](\d{1,2}|[a-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/;class we{static makeDateWrapper(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:0,d=arguments.length>8&&arguments[8]!==void 0?arguments[8]:0;if(!t)throw new Error("No timezone provided");var h="".concat(r).padStart(4,"0"),c="".concat(i+1).padStart(2,"0"),f="".concat(o).padStart(2,"0"),v="".concat(a).padStart(2,"0"),p="".concat(s).padStart(2,"0"),g="".concat(l).padStart(2,"0"),y="".concat(d).padStart(9,"0"),P="".concat(h,"-").concat(c,"-").concat(f," ").concat(v,":").concat(p,":").concat(g,".").concat(y);return e.i18n.DateTimeFormat.parse(we.FULL_DATE_FORMAT,P,e.i18n.TimeZone.getTimeZone(t))}static getNextNanos(e){var t=parseInt(e,10),r="0".repeat(9-e.length),i="".concat(t+1).concat(r);return parseInt(i,10)}static getNextDate(e,t,r,i){var{year:o,month:a,date:s,hours:l,minutes:d,seconds:h,nanos:c}=r;if(t.nanos!=null){if(t.nanos.length===9)return null;c=we.getNextNanos(t.nanos),c>999999999&&(h+=1,c=0)}else t.seconds!=null?h+=1:t.minutes!=null?d+=1:t.hours!=null?l+=1:t.date!=null?s+=1:t.month!=null?a+=1:o+=1;var f=new Date(o,a,s,l,d,h);return we.makeDateWrapper(e,i,f.getFullYear(),f.getMonth(),f.getDate(),f.getHours(),f.getMinutes(),f.getSeconds(),c)}static parseMonth(e){var t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;var r=e.trim().toLowerCase();if(r.length>=3){for(var i=0;i<we.months.length;i+=1)if(we.months[i].startsWith(r))return i}return NaN}static parseDateValues(e,t,r,i,o,a,s){var l=parseInt(e,10),d=t!=null?this.parseMonth(t):0,h=r!=null?parseInt(r,10):1,c=i!=null?parseInt(i,10):0,f=o!=null?parseInt(o,10):0,v=a!=null?parseInt(a,10):0,p=s!=null?parseInt(s.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(d)||Number.isNaN(h)||Number.isNaN(c)||Number.isNaN(f)||Number.isNaN(v)||Number.isNaN(p)?null:{year:l,month:d,date:h,hours:c,minutes:f,seconds:v,nanos:p}}static parseDateTimeString(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=rv.exec(e);if(r==null)throw new Error("Unexpected date string: ".concat(e));var[,i,,o,,a,,s,,l,,d,,h,c]=r;if(!t&&c!=null&&c.length>0)throw new Error("Unexpected characters after date string '".concat(e,"': ").concat(c));var f={year:i,month:o,date:a,hours:s,minutes:l,seconds:d,nanos:h};return t?Jo(Jo({},f),{},{overflow:c}):f}static parseDateRange(e,t,r){var i=t.trim().toLowerCase();if(i.length===0)throw new Error("Cannot parse date range from empty string");if(i==="null")return[null,null];if(i==="today"){var o=new Date(Date.now()),a=we.makeDateWrapper(e,r,o.getFullYear(),o.getMonth(),o.getDate()),s=new Date(o.getFullYear(),o.getMonth(),o.getDate()+1),l=we.makeDateWrapper(e,r,s.getFullYear(),s.getMonth(),s.getDate());return[a,l]}if(i==="yesterday"){var d=new Date(Date.now()),h=new Date(d.getFullYear(),d.getMonth(),d.getDate()-1),c=we.makeDateWrapper(e,r,h.getFullYear(),h.getMonth(),h.getDate()),f=we.makeDateWrapper(e,r,d.getFullYear(),d.getMonth(),d.getDate());return[c,f]}if(i==="now"){var v=new Date(Date.now()),p=e.DateWrapper.ofJsDate(v);return[p,null]}var g=we.parseDateTimeString(i);if(g.year==null&&g.month==null&&g.date==null)throw new Error("Unable to extract year, month, or day ".concat(i));var y=we.parseDateValues(g.year,g.month,g.date,g.hours,g.minutes,g.seconds,g.nanos);if(y==null)throw new Error("Unable to extract date values from ".concat(g));var P=we.makeDateWrapper(e,r,y.year,y.month,y.date,y.hours,y.minutes,y.seconds,y.nanos),O=we.getNextDate(e,g,y,r);return[P,O]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}static trimDateTimeStringTimeZone(e){var{overflow:t=""}=we.parseDateTimeString(e,!0);if(t==="")return e;if(!/^\s[A-Za-z]+/.test(t))throw new Error("Unexpected timezone format in overflow: '".concat(e,"'"));return e.slice(0,-t.length)}}Ri(we,"FULL_DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSSSSS");Ri(we,"months",["january","february","march","april","may","june","july","august","september","october","november","december"]);const ii=we;function IC(n,e){return n===e?{operator:"notEq",value:""}:{operator:"eq",value:n}}function DC(n,e,t,r){return function(o){var a=t.trim();if(a==="")return null;var s=rl(e,l=>n.makeSearchTextFilter(l,a,r),"or");return s(o)}}function rl(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"or";return function(i){var o=i?.findColumns(typeof n=="string"?[n]:n);if(o==null||o.length===0)return null;var a=o.map(e);return a.reduce((s,l)=>s[t](l))}}function iv(n,e,t,r){return rl(e,i=>i.filter()[r](n.makeFilterValue(i.type,t)),"or")}function xC(n,e,t,r,i){return function(a){var s=a?.findColumn(e),l=t==="all"||r&&t.size===0;return s==null||l?null:n.makeSelectValueFilter(s,[...t.keys()],i)}}function MC(n){return function(t){return t.filter().isNull().not().and(t.filter().notEq(n.makeFilterValue(t.type,"")))}}function NC(n,e){return function(r){var i=r.filter(),o=n.makeFilterValue(r.type,""),a=i.eq(o);return e?i.isNull().or(a):a.or(i.notEq(o))}}function ki(n,e,t){return e=ov(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ov(n){var e=av(n,"string");return typeof e=="symbol"?e:String(e)}function av(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Jn{}ki(Jn,"not","not");ki(Jn,"and","and");ki(Jn,"or","or");function AC(n){if(!(n==="not"||n==="and"||n==="or"))throw new Error("operator is not a valid FilterOperatorValue")}function ge(n,e,t){return e=sv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sv(n){var e=lv(n,"string");return typeof e=="symbol"?e:String(e)}function lv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class E{}ge(E,"eq","eq");ge(E,"eqIgnoreCase","eqIgnoreCase");ge(E,"notEq","notEq");ge(E,"notEqIgnoreCase","notEqIgnoreCase");ge(E,"greaterThan","greaterThan");ge(E,"greaterThanOrEqualTo","greaterThanOrEqualTo");ge(E,"lessThan","lessThan");ge(E,"lessThanOrEqualTo","lessThanOrEqualTo");ge(E,"in","in");ge(E,"inIgnoreCase","inIgnoreCase");ge(E,"notIn","notIn");ge(E,"notInIgnoreCase","notInIgnoreCase");ge(E,"isTrue","isTrue");ge(E,"isFalse","isFalse");ge(E,"isNull","isNull");ge(E,"invoke","invoke");ge(E,"contains","contains");ge(E,"notContains","notContains");ge(E,"containsIgnoreCase","containsIgnoreCase");ge(E,"startsWith","startsWith");ge(E,"endsWith","endsWith");ge(E,"containsAny","containsAny");var dv="DH_ITEM_KEY",ea=W.module("ViewportDataUtils");function il(n){return"".concat(dv,"_").concat(n)}function LC(n,e){var{bulkUpdate:t}=n;return function(i){var{columns:o,offset:a,rows:s}=i.detail;ea.debug("table updated",i.detail);var l=new Map;s.forEach((d,h)=>{var c=e(d,o),f=il(a+h);l.set(f,{key:f,item:c})}),ea.debug("update keys",l),t(l)}}function FC(n,e){return e.reduce((t,r)=>(t[r.name]=n.get(r),t),{})}function*RC(n,e){for(var t=n;t<=e;++t)yield{key:il(t)}}function uv(n){return n==null||hv(n)?0:n.size}function hv(n){return"isClosed"in n?n.isClosed:!1}function kC(n,e,t,r){var i=n+e-1,[o,a]=[0,r-1],s=Gi(n-t,o,a),l=Gi(i+t,o,a);return[s,l]}function ta(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Ht(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ta(o,r,i,a,s,"next",l)}function s(l){ta(o,r,i,a,s,"throw",l)}a(void 0)})}}function fn(n,e,t){return e=cv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cv(n){var e=mv(n,"string");return typeof e=="symbol"?e:String(e)}function mv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ot=W.module("TableUtils");function jC(n){return n===C.sortDirection.ascending||n===C.sortDirection.descending||n===C.sortDirection.reverse||n===C.sortDirection.none}class C{static copyTableAndApplyFilters(e){var t=arguments;return Ht(function*(){if(e==null)return null;for(var r=yield e.copy(),i=t.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=t[a];return r.applyFilter(Qr(...o.map(s=>s(r)))),r})()}static getSortIndex(e,t){for(var r=0;r<e.length;r+=1){var i,o=e[r];if(((i=o.column)===null||i===void 0?void 0:i.name)===t)return r}return null}static getSortForColumn(e,t){var r=C.getSortIndex(e,t);return r!=null?e[r]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return C.isBooleanType(e)?[E.isTrue,E.isFalse,E.isNull]:C.isCharType(e)||C.isNumberType(e)||C.isDateType(e)?[E.eq,E.notEq,E.greaterThan,E.greaterThanOrEqualTo,E.lessThan,E.lessThanOrEqualTo]:C.isTextType(e)?[E.eq,E.eqIgnoreCase,E.notEq,E.notEqIgnoreCase,E.contains,E.notContains,E.startsWith,E.endsWith]:[]}static getNextSort(e,t,r){if(r<0||r>=e.length)return null;var i=C.getSortForColumn(t,e[r].name);return i===null?e[r].sort().asc():i.direction===C.sortDirection.ascending?i.desc():null}static makeColumnSort(e,t,r,i){if(t<0||t>=e.length||r===C.sortDirection.none)return null;var o=e[t].sort();switch(r){case C.sortDirection.ascending:o=o.asc();break;case C.sortDirection.descending:o=o.desc();break}return i&&(o=o.abs()),o}static toggleSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(r<0||r>=t.length)return[];var o=C.getNextSort(t,e,r);return C.setSortForColumn(e,t[r].name,o,i)}static sortColumn(e,t,r,i,o,a){if(r<0||r>=t.length)return[];var s=C.makeColumnSort(t,r,i,o);return C.setSortForColumn(e,t[r].name,s,a)}static setSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=C.getSortIndex(e,t),a=[];return i&&(a=a.concat(e.filter(s=>{var{direction:l}=s;return l!==C.sortDirection.reverse})),o!==null&&a.splice(o,1)),r!==null&&a.push(r),a}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case C.dataType.BOOLEAN:return C.dataType.BOOLEAN;case"char":case"java.lang.Character":case C.dataType.CHAR:return C.dataType.CHAR;case"java.lang.String":case C.dataType.STRING:return C.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case C.dataType.DATETIME:return C.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case C.dataType.DECIMAL:return C.dataType.DECIMAL;case"int":case"java.lang.Integer":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":case"java.math.BigInteger":case C.dataType.INT:return C.dataType.INT;default:return C.dataType.UNKNOWN}}static isLongType(e){switch(e){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(e){switch(e){case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(e){return C.isIntegerType(e)||C.isDecimalType(e)}static isIntegerType(e){switch(e){case"int":case"java.lang.Integer":case"java.math.BigInteger":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":return!0;default:return!1}}static isDecimalType(e){switch(e){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBigDecimalType(e){switch(e){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(e){switch(e){case"java.math.BigInteger":return!0;default:return!1}}static isBooleanType(e){switch(e){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(e){switch(e){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(e){switch(e){case"java.lang.String":return!0;default:return!1}}static isTextType(e){return this.isStringType(e)||this.isCharType(e)}static getBaseType(e){return e.split("[]")[0]}static isCompatibleType(e,t){return C.getNormalizedType(e)===C.getNormalizedType(t)}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:'"'.concat(e,'"')}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeRangeFilterWithOperation(e,t,r){switch(t){case"=":return e.eq(r);case"<":return e.lessThan(r);case"<=":case"=<":return e.lessThanOrEqualTo(r);case">":return e.greaterThan(r);case">=":case"=>":return e.greaterThanOrEqualTo(r);case"!=":case"!":return e.notEq(r);default:return null}}static makeCancelableTablePromise(e){return Ee.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,o,a,s=!0,l=new Promise((d,h)=>{a=setTimeout(()=>{o(),s=!1,h(new gs('Event "'.concat(t,'" timed out.')))},r),o=e.addEventListener(t,c=>{if(i!=null&&!i(c)){Ot.debug2("Event triggered, but matcher returned false.");return}Ot.debug2("Event triggered, resolving."),o(),clearTimeout(a),s=!1,d(c)})});return l.cancel=()=>{if(s){Ot.debug2("Pending promise cleanup."),o(),clearTimeout(a),s=!1;return}Ot.debug2("Ignoring non-pending promise cancel.")},l}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeBooleanValue(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e===""&&t)return null;switch(e?.toLowerCase()){case"null":return null;case"0":case"f":case"fa":case"fal":case"fals":case"false":case"n":case"no":return!1;case"1":case"t":case"tr":case"tru":case"true":case"y":case"ye":case"yes":return!0;default:throw new Error("Invalid boolean '".concat(e,"'"))}}static makeNumberValue(e){if(e==="null"||e==="")return null;var t=e.toLowerCase().trim();if(t==="∞"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-∞"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;var r=C.removeCommas(t);if(C.NUMBER_REGEX.test(r))return parseFloat(r);throw new Error("Invalid number '".concat(e,"'"))}static getFilterOperatorString(e){switch(e){case E.eq:return"=";case E.notEq:return"!=";case E.greaterThan:return">";case E.greaterThanOrEqualTo:return">=";case E.lessThan:return"<";case E.lessThanOrEqualTo:return"<=";case E.contains:return"~";case E.notContains:return"!~";default:throw new Error("Unexpected filter type ".concat(e))}}static isPartitionedTable(e){return e!=null&&e.getMergedTable!==void 0&&e.getKeyTable!==void 0&&e.getKeys!==void 0}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return[...e].sort((r,i)=>{var o=r.name.toUpperCase(),a=i.name.toUpperCase();return ps.sort(o,a,t)})}constructor(e){fn(this,"dh",void 0),this.dh=e,ru(this)}createDistinctSortedColumnTable(e,t,r){var i=arguments,o=this;return Ht(function*(){if(e==null)return null;for(var a=e,s=i.length,l=new Array(s>3?s-3:0),d=3;d<s;d++)l[d-3]=i[d];l.length>0&&(a=yield e.copy(),yield a.applyFilter(Qr(...l.map(v=>v(a)))));var h=a.findColumn(t),c=yield a.selectDistinct([h]);a!==e&&a.close();var f=c.findColumn(t).sort()[r]();return o.applySort(c,[f])})()}doesColumnValueExist(e,t,r,i){var o=this;return Ht(function*(){if(e==null)return null;var a=iv(o,t,r,i?"eq":"eqIgnoreCase"),s=yield e.copy();yield o.applyFilter(s,Qr(a(s)));var l=uv(s);return s.close(),l>0})()}getValueType(e){if(e==null)return this.dh.ValueType.STRING;var t=C.getNormalizedType(e);switch(t){case C.dataType.BOOLEAN:return this.dh.ValueType.BOOLEAN;case C.dataType.CHAR:case C.dataType.STRING:return this.dh.ValueType.STRING;case C.dataType.DATETIME:return this.dh.ValueType.DATETIME;case C.dataType.DECIMAL:case C.dataType.INT:return C.isBigDecimalType(e)||C.isBigIntegerType(e)?this.dh.ValueType.STRING:this.dh.ValueType.NUMBER;default:return this.dh.ValueType.STRING}}makeQuickFilter(e,t,r){for(var i=t.split("||"),o=null,a=0;a<i.length;a+=1){for(var s=i[a],l=s.split("&&"),d=null,h=0;h<l.length;h+=1){var c=l[h].trim();if(c.length>0){var f=this.makeQuickFilterFromComponent(e,c,r);if(f)d?d=d.and(f):d=f;else throw new Error("Unable to parse quick filter from text ".concat(t))}}o&&d?o=o.or(d):o=d}return o}makeQuickFilterFromComponent(e,t,r){var{type:i}=e;return C.isNumberType(i)?this.makeQuickNumberFilter(e,t):C.isBooleanType(i)?this.makeQuickBooleanFilter(e,t):r!=null&&C.isDateType(i)?this.makeQuickDateFilter(e,t,r):C.isCharType(i)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}makeQuickNumberFilter(e,t){var r=e.filter(),{dh:i}=this,o=null,a=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i,s=a.exec(t),l=null,d=null,h=null,c=null,f=null;if(s!==null&&s.length>3&&([,l,d,h,c,f]=s),f!=null&&f.trim().length>0)return null;if(l==null&&(l="="),c!=null){if(!(l==="="||l==="!"||l==="!="))return null;switch(c=c.trim().toLowerCase(),c){case"null":o=r.isNull();break;case"nan":o=i.FilterCondition.invoke("isNaN",r);break;case"infinity":case"inf":case"∞":d!=null?o=i.FilterCondition.invoke("isInf",r).and(r.lessThan(i.FilterValue.ofNumber(0))):o=i.FilterCondition.invoke("isInf",r).and(r.greaterThan(i.FilterValue.ofNumber(0)));break}return o!==null&&(l==="!"||l==="!=")&&(o=o.not()),o}if(h==null)return null;if(h=C.removeCommas(h),C.isLongType(e.type))try{h=i.FilterValue.ofNumber(i.LongWrapper.ofString("".concat(d!=null?"-":"").concat(h)))}catch(v){return Ot.warn("Unable to create long filter",v),null}else{if(h=parseFloat(h),h==null||Number.isNaN(h))return null;h=i.FilterValue.ofNumber(d!=null?0-h:h)}return o=e.filter(),C.makeRangeFilterWithOperation(o,l,h)}static escapeQuickTextFilter(e){var t,r;if(e==null)return null;var i=/^(!~|!=|~|=|!)?(.*)/,o=/^\\*null$/,a=i.exec(e),s=null,l=null;if(a!==null&&a.length>2&&([,s,l]=a),s!=null){var d;return"\\".concat(s).concat((d=l)!==null&&d!==void 0?d:"")}return l!=null&&o.test(l.toLowerCase())||l!=null&&l.startsWith("*")?"\\".concat(l):l!=null&&l.endsWith("*")&&!l.endsWith("\\*")?(l=l.substring(0,l.length-1),"".concat(l,"\\*")):"".concat((t=s)!==null&&t!==void 0?t:"").concat((r=l)!==null&&r!==void 0?r:"")}static unescapeQuickTextFilter(e){var t,r,i=/^(\\!~|\\!=|\\~|\\=|\\!)?(.*)/,o=/^\\*null$/,a=i.exec(e),s=null,l=null;return a!==null&&a.length>2&&([,s,l]=a),s!=null&&(s=s.replace("\\","")),l!=null&&o.test(l.toLowerCase())&&(l=l.replace("\\","")),s==null&&l!=null&&l.startsWith("\\*")&&(l=l.substring(1)),s==null&&l!=null&&l.endsWith("\\*")?(l=l.substring(0,l.length-2),"".concat(l,"*")):"".concat((t=s)!==null&&t!==void 0?t:"").concat((r=l)!==null&&r!==void 0?r:"")}makeQuickTextFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),o=/^(!~|!=|~|=|!)?(.*)/,a=o.exec(i),s=null,l=null;if(a!==null&&a.length>2&&([,s,l]=a,l!=null&&(l=l.trim())),l==null||l.length===0&&!(s==="="||s==="!="))return null;s==null&&(s="=");var d=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return d.isNull();case"!=":case"!":return d.isNull().not()}var h=null,c=null;switch(l.startsWith("*")?(h="*",l=l.substring(1)):l.endsWith("*")&&!l.endsWith("\\*")&&(c="*",l=l.substring(0,l.length-1)),l=C.unescapeQuickTextFilter(l),s){case"~":return d.isNull().not().and(d.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))));case"!~":return d.isNull().or(d.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))).not());case"!=":return h==="*"?d.isNull().or(d.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$"))).not()):c==="*"?d.isNull().or(d.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*"))).not()):d.notEqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()));case"=":return h==="*"?d.isNull().not().and(d.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$")))):c==="*"?d.isNull().not().and(d.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*")))):d.eqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()))}return null}makeQuickBooleanFilter(e,t){var r=/^(!=|=|!)?(.*)/,i=r.exec("".concat(t).trim());if(i===null)return null;var[,o,a]=i,s=o==="!"||o==="!=",l=a.trim().toLowerCase(),d=e.filter();try{var h=C.makeBooleanValue(l);return h!=null&&h?d=d.isTrue():h===null?d=d.isNull():d=d.isFalse(),s?d.not():d}catch{return null}}makeQuickDateFilter(e,t,r){var i=t.trim(),o=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/,a=o.exec(i);if(a==null||a.length<=2)throw new Error("Unable to parse date filter: ".concat(t));var s=null,l=null;[,s,l]=a;var d=E.eq;switch(s){case"<":d=E.lessThan;break;case"<=":case"=<":d=E.lessThanOrEqualTo;break;case">":d=E.greaterThan;break;case">=":case"=>":d=E.greaterThanOrEqualTo;break;case"!=":case"!":d=E.notEq;break;case"=":case"==":default:d=E.eq;break}return this.makeQuickDateFilterWithOperation(e,l,d,r)}makeQuickDateFilterWithOperation(e,t,r,i){var{dh:o}=this,[a,s]=ii.parseDateRange(o,t,i),l=a!=null?o.FilterValue.ofNumber(a):null,d=s!=null?o.FilterValue.ofNumber(s):null,h=e.filter();if(l==null)return r===E.notEq?h.isNull().not():h.isNull();switch(r){case E.eq:{if(d!=null){var c=h.greaterThanOrEqualTo(l),f=h.lessThan(d);return c.and(f)}return h.eq(l)}case E.lessThan:return h.lessThan(l);case E.lessThanOrEqualTo:return d!=null?h.lessThan(d):h.lessThanOrEqualTo(l);case E.greaterThan:return d!=null?h.greaterThanOrEqualTo(d):h.greaterThan(l);case E.greaterThanOrEqualTo:return h.greaterThanOrEqualTo(l);case E.notEq:{if(d!=null){var v=h.lessThan(l),p=h.greaterThanOrEqualTo(d);return v.or(p)}return h.notEq(l)}default:throw new Error("Invalid operator: ".concat(r))}}makeQuickCharFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),o=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/,a=o.exec(i),s=null,l=null,d=null;if(a!==null&&a.length>3&&([,s,l,d]=a),d!=null&&d.trim().length>0||l==null||l.length===0)return null;s==null&&(s="=");var h=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return h.isNull();case"!=":case"!":return h.isNull().not();default:return null}var c=r.FilterValue.ofString(C.isRangeOperation(s)?C.quoteValue(l):l);return C.makeRangeFilterWithOperation(h,s,c)}makeAdvancedFilter(e,t,r){for(var{filterItems:i,filterOperators:o,invertSelection:a,selectedValues:s}=t,l=null,d=0;d<i.length;d+=1){var h=i[d],{selectedType:c,value:f}=h;if(c!=null&&c.length>0&&f!=null&&f.length>0)try{var v=this.makeAdvancedValueFilter(e,c,f,r);if(v!=null){if(d===0)l=v;else if(l!==null&&d-1<o.length){var p=o[d-1];if(p===Jn.and)l=l.and(v);else if(p===Jn.or)l=l.or(v);else{Ot.error("Unexpected filter operator",p,v),l=null;break}}}else Ot.debug2("Empty filter ignored for",c,f)}catch(y){Ot.error("Unable to create filter",y),l=null;break}}var g=this.makeSelectValueFilter(e,s,a);return g!=null&&(l!=null?l=l.and(g):l=g),l}makeAdvancedValueFilter(e,t,r,i){var{dh:o}=this;if(C.isDateType(e.type))return this.makeQuickDateFilterWithOperation(e,r,t,i);if(C.isNumberType(e.type)||C.isCharType(e.type))return this.makeQuickFilter(e,"".concat(C.getFilterOperatorString(t)).concat(r));var a=this.makeFilterValue(e.type,r),s=e.filter();switch(t){case E.eq:return s.eq(a);case E.eqIgnoreCase:return s.eqIgnoreCase(a);case E.notEq:return s.notEq(a);case E.notEqIgnoreCase:return s.notEqIgnoreCase(a);case E.greaterThan:return s.greaterThan(a);case E.greaterThanOrEqualTo:return s.greaterThanOrEqualTo(a);case E.lessThan:return s.lessThan(a);case E.lessThanOrEqualTo:return s.lessThanOrEqualTo(a);case E.isTrue:return s.isTrue();case E.isFalse:return s.isFalse();case E.isNull:return s.isNull();case E.contains:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))));case E.notContains:return s.isNull().or(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))).not());case E.startsWith:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i)^\\Q".concat(r,"\\E.*"))));case E.endsWith:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E$"))));case E.in:case E.inIgnoreCase:case E.notIn:case E.notInIgnoreCase:case E.invoke:default:throw new Error("Unexpected filter operation: ".concat(t))}}makeSearchTextFilter(e,t,r){var i=this.getValueType(e.type);try{if(i===this.dh.ValueType.BOOLEAN){var o=this.makeQuickBooleanFilter(e,t);return k(o),o}if(i===this.dh.ValueType.DATETIME)return this.makeQuickDateFilterWithOperation(e,ii.trimDateTimeStringTimeZone(t),"eq",r);if(i===this.dh.ValueType.NUMBER){var a=this.makeQuickNumberFilter(e,t);return k(a),a}return C.isBigDecimalType(e.type)||C.isBigIntegerType(e.type)?e.filter().eq(this.makeFilterValue(e.type,t)):e.filter().containsIgnoreCase(this.makeFilterValue(e.type,t))}catch{return this.makeNeverFilter(e)}}applyNeverFilter(e,t){var r=arguments,i=this;return Ht(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(e==null)return null;var a=e.findColumn(t),s=[i.makeNeverFilter(a)];return yield i.applyFilter(e,s,o),e})()}applyCustomColumns(e,t){var r=arguments,i=this;return Ht(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return C.executeAndWaitForEvent(s=>s?.applyCustomColumns(t),e,a.Table.EVENT_CUSTOMCOLUMNSCHANGED,o)})()}applyFilter(e,t){var r=arguments,i=this;return Ht(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return C.executeAndWaitForEvent(s=>s?.applyFilter(t),e,a.Table.EVENT_FILTERCHANGED,o)})()}applySort(e,t){var r=arguments,i=this;return Ht(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return C.executeAndWaitForEvent(s=>s?.applySort(t),e,a.Table.EVENT_SORTCHANGED,o)})()}makeNeverFilter(e){var{dh:t}=this,r=null;C.isTextType(e.type)?r=t.FilterValue.ofString("a"):C.isBooleanType(e.type)?r=t.FilterValue.ofBoolean(!0):C.isDateType(e.type)?r=t.FilterValue.ofNumber(t.DateWrapper.ofJsDate(new Date)):r=t.FilterValue.ofNumber(0);var i=e.filter().eq(r),o=e.filter().notEq(r);return i.and(o)}makeFilterValue(e,t){var{dh:r}=this,i=C.getBaseType(e);return C.isTextType(i)?r.FilterValue.ofString(t):C.isLongType(i)?r.FilterValue.ofNumber(r.LongWrapper.ofString(C.removeCommas(t))):r.FilterValue.ofNumber(C.removeCommas(t))}makeFilterRawValue(e,t){var{dh:r}=this;return C.isCharType(e)?r.FilterValue.ofString(typeof t=="number"?String.fromCharCode(t):t):C.isTextType(e)?r.FilterValue.ofString(t):C.isBooleanType(e)?r.FilterValue.ofBoolean(t):r.FilterValue.ofNumber(t)}makeNullableEqFilter(e,t){return t==null?e.filter().isNull():e.filter().eq(this.makeFilterRawValue(e.type,t))}makeValue(e,t,r){var{dh:i}=this;if(t==="null")return null;if(C.isTextType(e))return t;if(C.isLongType(e))return i.LongWrapper.ofString(C.removeCommas(t));if(C.isBooleanType(e))return C.makeBooleanValue(t,!0);if(C.isDateType(e)){var[o]=ii.parseDateRange(i,t,r);return o}return C.isNumberType(e)?C.makeNumberValue(t):(Ot.error("Unexpected column type",e),null)}makeSelectValueFilter(e,t,r){var{dh:i}=this;if(t.length===0)return r?null:this.makeNeverFilter(e);for(var o=[],a=!1,s=0;s<t.length;s+=1){var l=t[s];l==null?a=!0:C.isTextType(e.type)?o.push(i.FilterValue.ofString(typeof l=="number"?String.fromCharCode(l):l)):C.isBooleanType(e.type)?o.push(i.FilterValue.ofBoolean(!!l)):o.push(i.FilterValue.ofNumber(l))}return a?o.length>0?r?e.filter().isNull().not().and(e.filter().notIn(o)):e.filter().isNull().or(e.filter().in(o)):r?e.filter().isNull().not():e.filter().isNull():r?e.filter().notIn(o):e.filter().in(o)}}fn(C,"dataType",{BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"});fn(C,"sortDirection",{ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null});fn(C,"APPLY_TABLE_CHANGE_TIMEOUT_MS",3e4);fn(C,"REVERSE_TYPE",Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"}));fn(C,"NUMBER_REGEX",/^-?\d+(\.\d+)?$/);fn(C,"executeAndWaitForEvent",function(){var n=Ht(function*(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(t==null)return null;var o=C.makeCancelableTableEventPromise(t,r,i);return e(t),yield o,t});return function(e,t,r){return n.apply(this,arguments)}}());function pn(n,e,t){return e=fv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fv(n){var e=vv(n,"string");return typeof e=="symbol"?e:String(e)}function vv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ol{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((t,r)=>{var i=C.getNormalizedType(r.columnType);if(i===null)return t;t.has(i)||t.set(i,new Map);var o=t.get(i);return o?.set(r.columnName,r.format),t},new Map)}static makeColumnFormattingRule(e,t,r){return{columnType:e,columnName:t,format:r}}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:!0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!0;pn(this,"defaultColumnFormatter",void 0),pn(this,"typeFormatterMap",void 0),pn(this,"columnFormatMap",void 0),pn(this,"truncateNumbersWithPound",void 0),pn(this,"showEmptyStrings",void 0),pn(this,"showNullStrings",void 0),this.defaultColumnFormatter=new Xf,this.typeFormatterMap=new Map([[C.dataType.BOOLEAN,new Bf],[C.dataType.CHAR,new Uf],[C.dataType.DATETIME,new ht(e,r)],[C.dataType.DECIMAL,new ve(e,i)],[C.dataType.INT,new st(e,o)],[C.dataType.STRING,new ev]]),this.columnFormatMap=ol.makeColumnFormatMap(t),this.truncateNumbersWithPound=a,this.showEmptyStrings=s,this.showNullStrings=l}getColumnFormatMapForType(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=C.getNormalizedType(e);if(r!==null)return t&&!this.columnFormatMap.has(r)&&this.columnFormatMap.set(r,new Map),this.columnFormatMap.get(r)}getColumnFormat(e,t){var r,i=this.getColumnFormatMapForType(e);return(r=i?.get(t))!==null&&r!==void 0?r:null}getColumnTypeFormatter(e){var t=C.getNormalizedType(e),r=this.defaultColumnFormatter;if(t){var i;r=(i=this.typeFormatterMap.get(t))!==null&&i!==void 0?i:r}return r}getFormattedString(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",i=arguments.length>3?arguments[3]:void 0;if(e==null)return"";var o=this.getColumnTypeFormatter(t),a=i||this.getColumnFormat(t,r);return o.format(e,a??void 0)}get timeZone(){var e=this.typeFormatterMap.get(C.dataType.DATETIME);return kd(e,ht),e.dhTimeZone.id}}const gv="var(--dh-color-chart-colorway)",pv="var(--dh-color-chart-grid)",bv="var(--dh-color-chart-axis-line)",yv="var(--dh-color-chart-axis-line-zero)",na={"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:gv,gridcolor:pv,linecolor:bv,zerolinecolor:yv,"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)"};var ra=W.module("ChartTheme");function Cv(){var n,e=os(na);return e.colorway=jd((n=e.colorway)!==null&&n!==void 0?n:"").map(t=>{var[r,i]=t;return $d.normalizeCssColor(e.colorway.substring(r,i+1))}).join(" "),ra.debug2("Chart theme:",na),ra.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"]})}function ia(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Sv(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ia(Object(t),!0).forEach(function(r){wv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ia(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function wv(n,e,t){return e=Ev(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ev(n){var e=_v(n,"string");return typeof e=="symbol"?e:String(e)}function _v(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Pv=m.lazy(()=>hs(()=>import("./Plot-20e6708f.js"),["./Plot-20e6708f.js","./Plotly-24fcb6c1.js","./plotly-6e7c1c9f.js","./helpers-de833af9.js","./vendor-3e5e4180.js","./vendor-7509d17c.css"],import.meta.url));function Tv(n){return u.jsx(m.Suspense,{fallback:u.jsx(hn,{}),children:u.jsx(Pv,Sv({},n))})}var al=m.createContext(null);function $C(n){var{children:e}=n,{activeThemes:t}=Es(),r=m.useMemo(Cv,[t]);return u.jsx(al.Provider,{value:r,children:e})}function Ov(){return rr(al,"No ChartThemeContext value found.")}function oa(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Iv(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){oa(o,r,i,a,s,"next",l)}function s(l){oa(o,r,i,a,s,"throw",l)}a(void 0)})}}var Dv=W.module("HeapUsage");function xv(n){var e,{connection:t,defaultUpdateInterval:r,hoverUpdateInterval:i,bgMonitoring:o=!0,monitorDuration:a}=n,s=Ov(),[l,d]=m.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[h,c]=m.useState(!1),f=m.useRef({timestamps:[],usages:[]}),v=Cs(),p=m.useCallback(Iv(function*(){try{var A=yield t.getWorkerHeapInfo();if(!v.current)return;if(d(A),o||h){for(var V=(A.totalHeapSize-A.freeMemory)/A.maximumHeapSize,z=Date.now(),{timestamps:me,usages:je}=f.current;me.length!==0&&z-me[0]>a*1.5;)me.shift(),je.shift();me.push(z),je.push(V)}else f.current={timestamps:[],usages:[]}}catch(Ie){Dv.warn("Unable to get heap usage",Ie)}}),[t,v,o,h,a]);Nu(p,h?i:r);var g=(A,V)=>Math.round(A*10**V)/10**V,y=2,P=1024**3,{freeMemory:O,totalHeapSize:_,maximumHeapSize:R}=l,U=g(O/P,y),Q=g(_/P,y),N=g(R/P,y),B=Q-U,$=function(V,z){var me=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return u.jsxs("div",{className:X("heap-usage-info-row",{"heading-bottom-border":me}),children:[u.jsx("div",{className:"font-weight-bold",children:V}),u.jsx("div",{children:z})]})},{timestamps:Y,usages:ne}=f.current,F=(e=Y[Y.length-1])!==null&&e!==void 0?e:0,q=_/R,K=(_-O)/R;return u.jsxs("div",{className:"max-memory",children:[u.jsx("div",{className:"total-memory",style:{width:"calc(".concat(q*100,"% - ").concat(q*2,"px")}}),u.jsx("div",{className:X("used-memory",{"heap-overflow":(_-O)/R>.95}),style:{width:"calc(".concat(K*100,"% - ").concat(K*2,"px")}}),u.jsxs("div",{className:"memory-text",children:[N.toFixed(1)," GB"]}),u.jsx(Xt,{onEntered:()=>c(!0),onExited:()=>c(!1),interactive:!0,children:u.jsxs("div",{className:"heap-tooltip",children:[$("In use:","".concat(B.toFixed(y)," of ").concat(N.toFixed(y)," GB"),!0),$("Free:","".concat(U.toFixed(y)," GB")),$("Total:","".concat(Q.toFixed(y)," GB")),$("Max:","".concat(N.toFixed(y)," GB")),u.jsx("div",{className:"heap-plot",children:u.jsx(Tv,{data:[{x:[...Y],y:[...ne],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(a/6),gridcolor:s.linecolor,range:[F-a,F],linecolor:s.linecolor,linewidth:2,mirror:!0},yaxis:{dtick:.2,gridcolor:s.linecolor,range:[0,1],linecolor:s.linecolor,linewidth:2,mirror:!0}}})}),u.jsxs("div",{className:"heap-utilisation-text",children:["% utilization over ",Math.round(a/1e3/60)," min."]})]})})]})}var sl=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 ll(n){return n.componentName!==void 0}function Mv(n){return n.component!==void 0}var dl=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const Nv=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:sl,isGLComponentConfig:ll,isReactComponentConfig:Mv,itemDefaultConfig:dl},Symbol.toStringTag,{value:"Module"}));function Or(n,e,t){return e=Av(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Av(n){var e=Lv(n,"string");return typeof e=="symbol"?e:String(e)}function Lv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class er{constructor(){Or(this,"_mSubscriptions",void 0),Or(this,"off",this.unbind),Or(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[er.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(c){console.error("Error while emitting event:",c)}}i.unshift(e);for(var l=this._mSubscriptions[er.ALL_EVENT],d=0;d<l.length;d++){var h=l[d].ctx||{};try{l[d].fn.apply(h,i)}catch(c){console.error("Error while emitting event to allEventSubs:",c)}}}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)}}Or(er,"ALL_EVENT","__all");const vt=er;function dt(n,e,t){return e=Fv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fv(n){var e=Rv(n,"string");return typeof e=="symbol"?e:String(e)}function Rv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class pi extends vt{constructor(e,t,r){super(),dt(this,"width",void 0),dt(this,"height",void 0),dt(this,"title",void 0),dt(this,"parent",void 0),dt(this,"layoutManager",void 0),dt(this,"tab",void 0),dt(this,"_config",void 0),dt(this,"isHidden",!1),dt(this,"beforeCloseHandler",void 0),dt(this,"_element",M(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),dt(this,"_contentElement",void 0),this.title=ll(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 d=a.isColumn?"height":"width",h=d==="height"?t:e,c=((r=this[d])!==null&&r!==void 0?r:0)*(1/(((i=s.config[d])!==null&&i!==void 0?i:0)/100)),f=h/c*100,v=(((o=s.config[d])!==null&&o!==void 0?o:0)-f)/(a.contentItems.length-1),p=0;p<a.contentItems.length;p++)if(a.contentItems[p]===s)a.contentItems[p].config[d]=f;else{var g;a.contentItems[p].config[d]=((g=a.contentItems[p].config[d])!==null&&g!==void 0?g:0)+v}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}extendState(e){this.setState(M.extend(!0,this.getState(),e))}setState(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")}setTitle(e){this.parent.setTitle(e)}_$setSize(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(e!==this.width||t!==this.height){this.width=e,this.height=t;var r=this._contentElement[0],i=r.offsetWidth-r.clientWidth,o=r.offsetHeight-r.clientHeight;this._contentElement.width(this.width-i).height(this.height-o),this.emit("resize")}}}const kv=Object.freeze(Object.defineProperty({__proto__:null,Container:pi,ItemContainer:pi},Symbol.toStringTag,{value:"Module"}));function ul(n){var e=location.hash.match(new RegExp(n+"=([^&]*)"));return e?e[1]:null}function hl(n){if(window.location.hash)return ul(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 ji(n){return window.requestAnimationFrame(n)}function jv(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 Lr(){return At()}function $v(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 $i(n){return M.trim(n.replace(/(<([^>]+)>)/gi,""))}function Ke(n,e,t){return e=Hv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hv(n){var e=Bv(n,"string");return typeof e=="symbol"?e:String(e)}function Bv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Wv extends vt{constructor(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super(),Ke(this,"_eElement",void 0),Ke(this,"_oDocument",void 0),Ke(this,"_eBody",void 0),Ke(this,"_destroyAfterMouseUp",void 0),Ke(this,"_nDelay",400),Ke(this,"_timeout",void 0),Ke(this,"timeout",void 0),Ke(this,"_nDistance",10),Ke(this,"_nX",0),Ke(this,"_nY",0),Ke(this,"_nOriginalX",0),Ke(this,"_nOriginalY",0),Ke(this,"_bDragging",!1),this._eElement=e,this._oDocument=M(document),this._eBody=M(document.body),this._destroyAfterMouseUp=r,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this._startDrag=this._startDrag.bind(this),(t=this._eElement)===null||t===void 0||t.on("mousedown",this.onMouseDown)}destroy(){var e,t;(e=this._eElement)===null||e===void 0||e.unbind("mousedown",this.onMouseDown),(t=this._oDocument)===null||t===void 0||t.unbind("mouseup",this.onMouseUp),this._eElement=void 0,this._oDocument=void 0,this._eBody=void 0,clearTimeout(this._timeout),this._timeout=void 0}onMouseDown(e){if(e.preventDefault(),e.button===0){var t,r,i,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||(o=i.find("iframe"))===null||o===void 0||o.css("pointer-events",""),this._bDragging===!0&&(this._bDragging=!1,this.emit("dragStop",e,this._nOriginalX+this._nX)),(a=this._eBody)===null||a===void 0||a.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var s;(s=this._eElement)===null||s===void 0||s.removeClass("lm_dragging")}this._destroyAfterMouseUp&&this.destroy()}}_startDrag(){var e,t,r,i;window.clearTimeout(this._timeout),this._bDragging=!0,(e=this._eBody)===null||e===void 0||e.addClass("lm_dragging"),(t=this._eElement)===null||t===void 0||t.addClass("lm_dragging"),(r=this._oDocument)===null||r===void 0||(i=r.find("iframe"))===null||i===void 0||i.css("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)}_getCoordinates(e){var t,r;return{x:(t=e.pageX)!==null&&t!==void 0?t:0,y:(r=e.pageY)!==null&&r!==void 0?r:0}}}const or=Wv;function bn(n,e,t){return e=Uv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Uv(n){var e=Vv(n,"string");return typeof e=="symbol"?e:String(e)}function Vv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class cl{constructor(e,t){bn(this,"_container",void 0),bn(this,"_reactComponent",null),bn(this,"_portalComponent",null),bn(this,"_originalComponentWillUpdate",null),bn(this,"_initialState",void 0),bn(this,"_reactClass",void 0),this._reactComponent=null,this._portalComponent=null,this._originalComponentWillUpdate=null,this._container=e,this._initialState=t,this._reactClass=this._getReactClass(),this._container.on("open",this._render,this),this._container.on("destroy",this._destroy,this)}_key(){var e=this._container._config.id;if(!e)throw new Error("Cannot mount panel without id");return Array.isArray(e)?e.join(","):e}_render(){var e=this._key();this._portalComponent=Hr.createPortal(this._getReactComponent(),this._container.getElement()[0],e),this._container.layoutManager.addReactChild(e,this._portalComponent)}_gotReactComponent(e){if(e){this._reactComponent=e,this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate||function(){},this._reactComponent.componentWillUpdate=this._onUpdate.bind(this);var t=this._container.getState();t&&this._reactComponent.setState(t)}}_destroy(){this._container.layoutManager.removeReactChild(this._key(),this._portalComponent),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)}_onUpdate(e,t){var r;this._container.setState(t),(r=this._originalComponentWillUpdate)===null||r===void 0||r.call(this._reactComponent,e,t)}_getReactClass(){var e=this._container._config.component;if(!e)throw new Error("No react component name. type: react-component needs a field `component`");var t=this._container.layoutManager.getComponent(e)||this._container.layoutManager.getFallbackComponent();if(!t)throw new Error('React component "'+e+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return t}_getReactComponent(){var e={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},t=M.extend(e,this._container._config.props);return j.createElement(this._reactClass,t)}}var Fr=["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"],Kv=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function Hi(n){if(Fr.length>36)throw new Error("Too many keys in config minifier map");var e={};return Bi(n,e,"_min"),e}function bi(n){if(Fr.length>36)throw new Error("Too many keys in config minifier map");var e={};return Bi(n,e,"_max"),e}function Bi(n,e,t){var r=t==="_min"?zv:Gv;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,Fr);e[s]=a}Bi(o,a,t)}else{var l=r(o,Kv);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var d=r(i,Fr);e[d]=l}}}}function zv(n,e){if(typeof n=="string"&&n.length===1)return"___"+n;var t=e.indexOf(n);return t===-1?n:t.toString(36)}function Gv(n,e){return typeof n=="string"&&n.length===1?e[parseInt(n,36)]:typeof n=="string"&&n.substr(0,3)==="___"?n[3]:n}function oi(n,e,t){return e=qv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qv(n){var e=Zv(n,"string");return typeof e=="symbol"?e:String(e)}function Zv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class yi{constructor(e,t){oi(this,"name",void 0),oi(this,"origin",void 0),oi(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function pr(n,e,t){return e=Xv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xv(n){var e=Yv(n,"string");return typeof e=="symbol"?e:String(e)}function Yv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}let Qv=class extends vt{constructor(e){super(),pr(this,"_layoutManager",void 0),pr(this,"_dontPropagateToParent",void 0),pr(this,"_childEventSource",void 0),pr(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(vt.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),M(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(){M(window).off("gl_child_event",this._boundOnEventFromChild)}};const ml=Qv;function fl(n,e,t){return n.on(e,t),()=>{n.off(e,t)}}function vl(n){return(e,t)=>fl(e,n,t)}function gl(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 pl(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?.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 Jv(n){return{listen:vl(n),emit:gl(n),useListener:pl(n)}}const eg=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:yi,DragListener:or,EventEmitter:vt,EventHub:ml,ReactComponentHandler:cl,animFrame:ji,filterXss:$v,getHashValue:ul,getQueryStringParam:hl,getUniqueId:Lr,listenForEvent:fl,makeEmitFunction:gl,makeEventFunctions:Jv,makeListenFunction:vl,makeUseListenerFunction:pl,minifyConfig:Hi,removeFromArray:jv,stripTags:$i,unminifyConfig:bi},Symbol.toStringTag,{value:"Module"}));function jt(n,e,t){return e=tg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tg(n){var e=ng(n,"string");return typeof e=="symbol"?e:String(e)}function ng(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class bl extends vt{constructor(e,t,r,i,o){super(),jt(this,"isInitialised",!1),jt(this,"_config",void 0),jt(this,"_dimensions",void 0),jt(this,"_parentId",void 0),jt(this,"_indexInParent",void 0),jt(this,"_layoutManager",void 0),jt(this,"_popoutWindow",null),jt(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,d,h,c;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=(d=this._popoutWindow)===null||d===void 0?void 0:d.screenY)!==null&&l!==void 0?l:(h=this._popoutWindow)===null||h===void 0?void 0:h.screenTop)!==null&&s!==void 0?s:0},content:(c=this.getGlInstance())===null||c===void 0?void 0:c.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=M.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;M(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-"+Lr();e=Hi(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 _e(n,e,t){return e=rg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function rg(n){var e=ig(n,"string");return typeof e=="symbol"?e:String(e)}function ig(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class vn extends vt{constructor(e,t,r,i,o,a){var s,l,d,h,c,f,v,p;if(super(),_e(this,"_dragListener",void 0),_e(this,"_layoutManager",void 0),_e(this,"_contentItem",void 0),_e(this,"_originalParent",void 0),_e(this,"_area",null),_e(this,"_lastValidArea",null),_e(this,"_minX",void 0),_e(this,"_maxX",void 0),_e(this,"_minY",void 0),_e(this,"_maxY",void 0),_e(this,"_width",void 0),_e(this,"_height",void 0),_e(this,"_sided",void 0),_e(this,"element",void 0),_e(this,"childElementContainer",void 0),_e(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,y;this._layoutManager.tabDropPlaceholder.width((g=this._contentItem.tab.element.outerWidth(!0))!==null&&g!==void 0?g:0),this._layoutManager.tabDropPlaceholder.height((y=this._contentItem.tab.element.outerHeight(!0))!==null&&y!==void 0?y:0)}if(this.element=M(vn._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",$i((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(),M(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var P,O;this._layoutManager.tabDropPlaceholder.width((P=this._proxyTab.outerWidth(!0))!==null&&P!==void 0?P:0),this._layoutManager.tabDropPlaceholder.height((O=this._proxyTab.outerHeight(!0))!==null&&O!==void 0?O:0)}var _=this._layoutManager.container.offset();this._minX=(d=_?.left)!==null&&d!==void 0?d:0,this._minY=(h=_?.top)!==null&&h!==void 0?h:0,this._maxX=((c=this._layoutManager.container.width())!==null&&c!==void 0?c:0)+this._minX,this._maxY=((f=this._layoutManager.container.height())!==null&&f!==void 0?f:0)+this._minY,this._width=(v=this.element.width())!==null&&v!==void 0?v:0,this._height=(p=this.element.height())!==null&&p!==void 0?p: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")}}_e(vn,"_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 br(n,e,t){return e=og(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function og(n){var e=ag(n,"string");return typeof e=="symbol"?e:String(e)}function ag(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class yl{constructor(e,t,r){br(this,"_element",void 0),br(this,"_itemConfig",void 0),br(this,"_layoutManager",void 0),br(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=r,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new or(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this),this._dragListener}_onDragStart(e,t){var r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(M.extend(!0,{},r));new vn(e,t,this._dragListener,this._layoutManager,i,null)}}function yr(n,e,t){return e=sg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sg(n){var e=lg(n,"string");return typeof e=="symbol"?e:String(e)}function lg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Cl{constructor(e,t,r){yr(this,"_element",M(window)),yr(this,"_itemConfig",void 0),yr(this,"_layoutManager",void 0),yr(this,"_dragListener",void 0),this._itemConfig=e,this._layoutManager=t,this._createDragListener(r)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&(this._dragListener=new or(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._destroy,this),this._dragListener.onMouseDown(e),this._dragListener._startDrag())}_destroy(){this._dragListener=void 0,this._element=void 0,this._itemConfig=void 0,this._layoutManager=void 0}_onDragStart(e,t){if(!(!this._dragListener||!this._layoutManager)){var r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(M.extend(!0,{},r));new vn(e,t,this._dragListener,this._layoutManager,i,null)}}}function Sl(n,e,t){return e=dg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function dg(n){var e=ug(n,"string");return typeof e=="symbol"?e:String(e)}function ug(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ar{constructor(){Sl(this,"element",M(ar._template)),M(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()}}Sl(ar,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function ai(n,e,t){return e=hg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function hg(n){var e=cg(n,"string");return typeof e=="symbol"?e:String(e)}function cg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Kn{constructor(e,t,r,i){ai(this,"element",void 0),ai(this,"_header",void 0),ai(this,"_action",void 0),this._header=e,this.element=M('<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 mg(n,e,t){return e=fg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fg(n){var e=vg(n,"string");return typeof e=="symbol"?e:String(e)}function vg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class gg extends Error{constructor(e,t){super(),mg(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const an=gg,pg=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:an},Symbol.toStringTag,{value:"Module"}));function Se(n,e,t){return e=bg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bg(n){var e=yg(n,"string");return typeof e=="symbol"?e:String(e)}function yg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function sn(n){return n.isStack}function Ze(n){return n.isComponent}function wl(n){return n.isRoot}class Oe extends vt{constructor(e,t,r,i){super(),Se(this,"config",void 0),Se(this,"type",void 0),Se(this,"contentItems",void 0),Se(this,"parent",void 0),Se(this,"layoutManager",void 0),Se(this,"element",void 0),Se(this,"childElementContainer",void 0),Se(this,"componentName",void 0),Se(this,"isInitialised",!1),Se(this,"isMaximised",!1),Se(this,"isRoot",!1),Se(this,"isRow",!1),Se(this,"isColumn",!1),Se(this,"isStack",!1),Se(this,"isComponent",!1),Se(this,"tab",void 0),Se(this,"_pendingEventPropagations",void 0),Se(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(vt.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?.replaceChild(t.element[0],e.element[0]),r===!0&&(e.parent=null,e._$destroy()),this.contentItems[i]=t,t.parent=this,sn(this)&&(this.header.tabs[i].contentItem=t),t.parent.isInitialised===!0&&t.isInitialised===!1&&t._$init(),this.callDownwards("setSize")}remove(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}popout(){var e=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),e}toggleMaximise(e){e&&e.preventDefault(),this.isMaximised===!0?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximised=!this.isMaximised,this.emitBubblingEvent("stateChanged")}select(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))}deselect(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))}setTitle(e){this.config.title=e,this.emit("titleChanged",e),this.emitBubblingEvent("stateChanged")}hasId(e){if(this.config.id){if(typeof this.config.id=="string")return this.config.id===e;if(this.config.id instanceof Array)return this.config.id.indexOf(e)!==-1}else return!1}addId(e){this.hasId(e)||(this.config.id?typeof this.config.id=="string"?this.config.id=[this.config.id,e]:this.config.id instanceof Array&&this.config.id.push(e):this.config.id=e)}removeId(e){if(!this.hasId(e))throw new Error("Id not found");if(typeof this.config.id=="string")delete this.config.id;else if(this.config.id instanceof Array){var t=this.config.id.indexOf(e);this.config.id.splice(t,1)}}getItemsByFilter(e){var t=[],r=function i(o){for(var a=0;a<o.contentItems.length;a++)e(o.contentItems[a])===!0&&t.push(o.contentItems[a]),i(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&&Ze(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 yi(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new an("content must be an Array",e);for(var r=0;r<e.content.length;r++)t=this.layoutManager.createContentItem(e.content[r],this),this.contentItems.push(t)}_extendItemNode(e){for(var[t,r]of Object.entries(dl)){var i=t;e[i]===void 0&&(e[i]=r)}return e}_propagateEvent(e,t){t instanceof yi&&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,ji(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function kn(n,e,t){return e=Cg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cg(n){var e=Sg(n,"string");return typeof e=="symbol"?e:String(e)}function Sg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class El extends Oe{constructor(e,t,r){var i;Object.entries((i=e.config.settings.defaultComponentConfig)!==null&&i!==void 0?i:{}).forEach(s=>{var[l,d]=s;t[l]===void 0&&(t[l]=d)}),super(e,t,r,M()),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=M.extend(!0,{},this.config.componentState||{});if(o==null)throw new an('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 pi(this.config,this,e),this.instance=new o(this.container,a),this.element=this.container._element}close(){this.parent.removeChild(this)}setSize(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())}_$init(){Oe.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),Oe.prototype._$hide.call(this)}_$show(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),Oe.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),Oe.prototype._$destroy.call(this)}_$getArea(){return null}}function rt(n,e,t){return e=wg(e),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:String(e)}function Eg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Rr extends Oe{constructor(e,t,r,i){super(t,r,i,M('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),rt(this,"isRow",void 0),rt(this,"isColumn",void 0),rt(this,"childElementContainer",void 0),rt(this,"parent",void 0),rt(this,"_splitter",[]),rt(this,"_splitterSize",void 0),rt(this,"_splitterGrabSize",void 0),rt(this,"_isColumn",void 0),rt(this,"_dimension",void 0),rt(this,"_splitterPosition",null),rt(this,"_splitterMinPosition",null),rt(this,"_splitterMaxPosition",null),this.parent=i,this.isRow=!e,this.isColumn=e,this.childElementContainer=this.element,this._splitterSize=t.config.dimensions.borderWidth,this._splitterGrabSize=t.config.dimensions.borderGrabWidth,this._isColumn=e,this._dimension=e?"height":"width",this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null}addChild(e,t,r){var i,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),Oe.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 d;this.contentItems[s].config[this._dimension]=((d=this.contentItems[s].config[this._dimension])!==null&&d!==void 0?d:0)+i/(this.contentItems.length-1)}Oe.prototype.removeChild.call(this,e,t),this.contentItems.length===1&&this.config.isClosable===!0?(l=this.contentItems[0],this.contentItems=[],this.parent.replaceChild(this,l,!0)):(this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged"))}replaceChild(e,t){var r=e.config[this._dimension];super.replaceChild(e,t),t.config[this._dimension]=r,this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(){this.contentItems.length>0&&(this._calculateRelativeSizes(),this._setAbsoluteSizes()),this.emitBubblingEvent("stateChanged"),this.emit("resize")}_$init(){if(this.isInitialised!==!0){var e;for(Oe.prototype._$init.call(this),e=0;e<this.contentItems.length-1;e++)this.contentItems[e].element.after(this._createSplitter(e).element)}}_setAbsoluteSizes(){var e,t=this._calculateAbsoluteSizes();for(e=0;e<this.contentItems.length;e++)t.additionalPixel-e>0&&t.itemSizes[e]++,this._isColumn?(this.contentItems[e].element.width(t.totalWidth),this.contentItems[e].element.height(t.itemSizes[e])):(this.contentItems[e].element.width(t.itemSizes[e]),this.contentItems[e].element.height(t.totalHeight))}_calculateAbsoluteSizes(){var e,t,r=(this.contentItems.length-1)*this._splitterSize,i=(e=this.element.width())!==null&&e!==void 0?e:0,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 d,h,c=this._isColumn?Math.floor(o*(((d=this.contentItems[l].config.height)!==null&&d!==void 0?d:0)/100)):Math.floor(i*(((h=this.contentItems[l].config.width)!==null&&h!==void 0?h:0)/100));a+=c,s.push(c)}var f=Math.floor((this._isColumn?o:i)-a);return{itemSizes:s,additionalPixel:f,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 d;this.contentItems[l].config[r]=((d=this.contentItems[l].config[r])!==null&&d!==void 0?d:0)/e*100}this._respectMinItemWidth()}_respectMinItemWidth(){var e,t=this.layoutManager.config.dimensions&&(e=this.layoutManager.config.dimensions.minItemWidth)!==null&&e!==void 0?e:0,r=[],i=0,o=0,a=0,s=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var d=this._calculateAbsoluteSizes(),h=0;h<this.contentItems.length;h++){this.contentItems[h];var c=d.itemSizes[h];c<t?(o+=t-c,l={width:t}):(i+=c-t,l={width:c},r.push(l)),s.push(l)}if(!(o===0||o>i)){var f=o/i;a=o;for(var v=0;v<r.length;v++){l=r[v];var p=Math.round((l.width-t)*f);a-=p,l.width-=p}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/d.totalWidth*100}}}_createSplitter(e){var t;return t=new _l(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:[]),d=this._isColumn?l.vertical:l.horizontal,h=this._getMinimumDimensions((r=a.after.config.content)!==null&&r!==void 0?r:[]),c=this._isColumn?h.vertical:h.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((i=a.before.element[this._dimension]())!==null&&i!==void 0?i:0)-(d||s)),this._splitterMaxPosition=((o=a.after.element[this._dimension]())!==null&&o!==void 0?o:0)-(c||s)}_onSplitterDrag(e,t,r){var i=this._isColumn?r:t;this._splitterMaxPosition==null||this._splitterMinPosition==null||i>this._splitterMinPosition&&i<this._splitterMaxPosition&&(this._splitterPosition=i,e.element.css(this._isColumn?"top":"left",i))}_onSplitterDragStop(e){var t,r,i,o,a,s=this._getItemsForSplitter(e),l=(t=s.before.element[this._dimension]())!==null&&t!==void 0?t:0,d=(r=s.after.element[this._dimension]())!==null&&r!==void 0?r:0,h=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+d),c=((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]=h*c,s.after.config[this._dimension]=(1-h)*c,e.element.css({top:0,left:0}),ji(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function aa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function sa(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?aa(Object(t),!0).forEach(function(r){Ci(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):aa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ci(n,e,t){return e=_g(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _g(n){var e=Pg(n,"string");return typeof e=="symbol"?e:String(e)}function Pg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Si extends Oe{constructor(e,t,r){super(e,sa(sa({},t),{},{type:"root"}),null,M('<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(Ze(e)&&(r=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this),r._$init(),r.addChild(e),e=r),!this.contentItems.length)this.addChild(e);else{var{side:i}=t,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 Rr)||l.type!=o){var d=this.layoutManager.createContentItem({type:o},this);this.replaceChild(l,d),d.addChild(e,s?0:void 0,!0),d.addChild(l,s?void 0:0,!0),l.config[a]=50,e.config[a]=50,d.callDownwards("setSize")}else{var h,c=l.contentItems[s?0:l.contentItems.length-1];l.addChild(e,s?0:void 0,!0),c.config[a]=((h=c.config[a])!==null&&h!==void 0?h:0)*.5,e.config[a]=c.config[a],l.callDownwards("setSize")}}}}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 yn(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){Be(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 Be(n,e,t){return e=Tg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Tg(n){var e=Og(n,"string");return typeof e=="symbol"?e:String(e)}function Og(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class wi extends Oe{constructor(e,t,r){var i,o,a,s,l,d,h,c,f;super(e,t,r,M('<div class="lm_item lm_stack"></div>')),Be(this,"_activeContentItem",null),Be(this,"_header",void 0),Be(this,"childElementContainer",M('<div class="lm_items"></div>')),Be(this,"header",void 0),Be(this,"parent",void 0),Be(this,"isStack",!0),Be(this,"_dropZones",{}),Be(this,"_dropSegment",null),Be(this,"_contentAreaDimensions",null),Be(this,"_dropIndex",void 0),Be(this,"_side",void 0),Be(this,"_sided",!1),Be(this,"config",void 0),this.parent=r,this.config=t;var v=e.config;this._side=!1,this._header={show:((i=v.settings)===null||i===void 0?void 0:i.hasHeaders)&&t.hasHeaders!==!1,popout:(o=v.settings)!==null&&o!==void 0&&o.showPopoutIcon?(a=v.labels)===null||a===void 0?void 0:a.popout:void 0,maximise:(s=v.settings)!==null&&s!==void 0&&s.showMaximiseIcon?(l=v.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(d=v.settings)!==null&&d!==void 0&&d.showCloseIcon?(h=v.labels)===null||h===void 0?void 0:h.close:void 0,minimise:(c=(f=v.labels)===null||f===void 0?void 0:f.minimise)!==null&&c!==void 0?c:void 0},v.header&&(this._header=yn(yn({},this._header),v.header)),t.header&&(this._header=yn(yn({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=yn(yn({},this._header),t.content[0].header)),this.header=new Lt(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){if(this.contentItems.indexOf(e)===-1)throw new Error("contentItem is not a child of this stack");this._activeContentItem!==null&&this._activeContentItem._$hide(),this._activeContentItem=e,this.header.setActiveContentItem(e),e._$show(),this.emit("activeContentItemChanged",e),this.layoutManager.emit("activeContentItemChanged",e),this.emitBubblingEvent("stateChanged")}getActiveContentItem(){return this.header.activeContentItem}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),super.addChild(e,t),this.childElementContainer.append(e.element),this.header.createTab(e,t),this.setActiveContentItem(e),this.callDownwards("setSize"),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}removeChild(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=this.contentItems.indexOf(e);super.removeChild(e,t),this.header.removeTab(e),this.header.activeContentItem===e&&(this.contentItems.length>0?this.setActiveContentItem(this.contentItems[Math.max(r-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}_$validateClosability(){for(var e=this.header._isClosable(),t=0,r=this.contentItems.length;t<r;t++){var i;if(!e)break;e=(i=this.contentItems[t].config.isClosable)!==null&&i!==void 0?i:!1}this.header._$setClosable(e)}_$destroy(){Oe.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=t&&this.parent.isColumn||r&&this.parent.isRow,a=t?"column":"row",s=t?"height":"width";if(Ze(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(o){var d,h=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?h:h+1,!0),this.config[s]=((d=this.config[s])!==null&&d!==void 0?d:0)*.5,e.config[s]=this.config[s],this.parent.callDownwards("setSize")}else{var c=this.layoutManager.createContentItem({type:a},this);this.parent.replaceChild(this,c),c.addChild(e,i?0:void 0,!0),c.addChild(this,i?void 0:0,!0),this.config[s]=50,e.config[s]=50,c.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[r,i]of Object.entries(this._contentAreaDimensions)){var o=i.hoverArea;if(o.x1<e&&o.x2>e&&o.y1<t&&o.y2>t){r==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(r));return}}}_$getArea(){if(this.element.is(":visible")===!1)return null;var e=super._$getArea(this.header.element),t=super._$getArea(this.childElementContainer);if(e==null||t==null)return null;var r=t.x2-t.x1,i=t.y2-t.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}},this._activeContentItem&&this._activeContentItem.isComponent===!1?e:this.contentItems.length===0?(this._contentAreaDimensions.body={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}},super._$getArea(this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x1+r*.25,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x1+r*.5,y2:t.y2}},this._contentAreaDimensions.top={hoverArea:{x1:t.x1+r*.25,y1:t.y1,x2:t.x1+r*.75,y2:t.y1+i*.5},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y1+i*.5}},this._contentAreaDimensions.right={hoverArea:{x1:t.x1+r*.75,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1+r*.5,y1:t.y1,x2:t.x2,y2:t.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:t.x1+r*.25,y1:t.y1+i*.5,x2:t.x1+r*.75,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1+i*.5,x2:t.x2,y2:t.y2}},super._$getArea(this.element))}_highlightHeaderDropZone(e){var t,r,i,o,a,s,l,d,h,c,f,v,p,g,y,P,O=this.header.tabs.length;if(O===0){var _,R,U,Q,N,B,$,Y,ne=this.header.element.offset();(_=this.layoutManager.dropTargetIndicator)===null||_===void 0||_.highlightArea({x1:(R=ne?.left)!==null&&R!==void 0?R:0,x2:((U=ne?.left)!==null&&U!==void 0?U:0)+100,y1:(Q=(N=this.header.element.offset())===null||N===void 0?void 0:N.top)!==null&&Q!==void 0?Q:0,y2:((B=($=this.header.element.offset())===null||$===void 0?void 0:$.top)!==null&&B!==void 0?B:0)+((Y=this.header.element.innerHeight())!==null&&Y!==void 0?Y:0)});return}var F=this.header.tabsContainer,q=(t=F.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),K=(r=this.layoutManager.tabDropPlaceholder.get(0))===null||r===void 0?void 0:r.getBoundingClientRect();if(!(!q||!K)){e<q.left?e=q.left+1:e>q.right&&(e=q.right-1);var A,V;if(!(K.left<e&&e<K.right)){for(var z=0;z<O;z++){var me;if(A=this.header.tabs[z].element,V=(me=A.get(0))===null||me===void 0?void 0:me.getBoundingClientRect(),V&&V.left<e&&e<V.right){this._dropIndex=z;break}}if(A&&V&&e<V.left+V.width*.5)A.before(this.layoutManager.tabDropPlaceholder);else if(A){var je;this._dropIndex=Math.min(((je=this._dropIndex)!==null&&je!==void 0?je:0)+1,O),A.after(this.layoutManager.tabDropPlaceholder)}}var Ie=(i=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&i!==void 0?i:0;Ie=Math.max(Ie,(a=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&a!==void 0?a:0);var b=Ie+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);b=Math.min(b,((d=(h=this.header.tabsContainer.offset())===null||h===void 0?void 0:h.left)!==null&&d!==void 0?d:0)+((c=this.header.tabsContainer.innerWidth())!==null&&c!==void 0?c:0)),(f=this.layoutManager.dropTargetIndicator)===null||f===void 0||f.highlightArea({x1:Ie,x2:b,y1:(v=(p=this.header.element.offset())===null||p===void 0?void 0:p.top)!==null&&v!==void 0?v:0,y2:((g=(y=this.header.element.offset())===null||y===void 0?void 0:y.top)!==null&&g!==void 0?g:0)+((P=this.header.element.innerHeight())!==null&&P!==void 0?P:0)})}}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){var e=["right","left","bottom"].some(r=>r===this._header.show)?this._header.show:void 0;if(this.header.element.toggle(!!this._header.show),!!e&&(this._side=e,this._sided=["right","left"].indexOf(this._side.toString())>=0,this.element.removeClass("lm_left lm_right lm_bottom"),this._side&&this.element.addClass("lm_"+this._side),this.element.find(".lm_header").length&&this.childElementContainer)){var t=["right","bottom"].indexOf(this._side.toString())>=0?"before":"after";this.header.element[t](this.childElementContainer),this.callDownwards("setSize")}}_highlightBodyDropZone(e){var t,r,i=(t=this._contentAreaDimensions)===null||t===void 0||(r=t[e])===null||r===void 0?void 0:r.highlightArea;if(i){var o;(o=this.layoutManager.dropTargetIndicator)===null||o===void 0||o.highlightArea(i)}this._dropSegment=e}}const Ig=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:Oe,Component:El,ContentItem:Oe,Root:Si,RowOrColumn:Rr,Stack:wi,isComponent:Ze,isRoot:wl,isStack:sn},Symbol.toStringTag,{value:"Module"}));function Dt(n,e,t){return e=Dg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Dg(n){var e=xg(n,"string");return typeof e=="symbol"?e:String(e)}function xg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class sr{constructor(e,t){var r;Dt(this,"header",void 0),Dt(this,"contentItem",void 0),Dt(this,"element",M(sr._template)),Dt(this,"titleElement",void 0),Dt(this,"closeElement",void 0),Dt(this,"isActive",!1),Dt(this,"_layoutManager",void 0),Dt(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 or(this.element),this._dragListener.on("dragStart",this._onDragStart,this),this.contentItem.on("destroy",this._dragListener.destroy,this._dragListener)),this._onTabClick=this._onTabClick.bind(this),this._onCloseClick=this._onCloseClick.bind(this),this._onTabContentFocusIn=this._onTabContentFocusIn.bind(this),this._onTabContentFocusOut=this._onTabContentFocusOut.bind(this),this.element.on("click",this._onTabClick),this.element.on("auxclick",this._onTabClick),this.contentItem.config.isClosable?(this.closeElement.on("click",this._onCloseClick),this.closeElement.on("mousedown",this._onCloseMousedown)):this.closeElement.remove(),this.contentItem.tab=this,this.contentItem.emit("tab",this),this.contentItem.layoutManager.emit("tabCreated",this),Ze(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)}setActive(e){e!==this.isActive&&(this.isActive=e,e?this.element.addClass("lm_active"):this.element.removeClass("lm_active"))}_$destroy(){this.element.off("click",this._onTabClick),this.element.off("auxclick",this._onTabClick),this.closeElement.off("click",this._onCloseClick),Ze(this.contentItem)&&(this.contentItem.container._contentElement.off(),this.contentItem.container._contentElement[0].removeEventListener("click",this._onTabContentFocusIn,!0)),this._dragListener&&(this.contentItem.off("destroy",this._dragListener.destroy,this._dragListener),this._dragListener.off("dragStart",this._onDragStart),this._dragListener=void 0),this.element.remove()}_onDragStart(e,t){var r;(r=this.contentItem.parent)!==null&&r!==void 0&&r.isMaximised&&this.contentItem.parent.toggleMaximise(),this._dragListener&&new vn(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(){M(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin")}_onTabContentFocusOut(){Ze(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&&Ze(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):Ze(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),Ze(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(),Ze(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onCloseMousedown(e){e.stopPropagation()}}Dt(sr,"_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 oe(n,e,t){return e=Mg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mg(n){var e=Ng(n,"string");return typeof e=="symbol"?e:String(e)}function Ng(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Lt extends vt{constructor(e,t){var r,i;super(),oe(this,"layoutManager",void 0),oe(this,"element",M(Lt._template)),oe(this,"tabsContainer",void 0),oe(this,"tabDropdownContainer",void 0),oe(this,"tabDropdownSearch",void 0),oe(this,"tabDropdownList",null),oe(this,"controlsContainer",void 0),oe(this,"parent",void 0),oe(this,"tabs",[]),oe(this,"activeContentItem",null),oe(this,"closeButton",null),oe(this,"tabDropdownButton",null),oe(this,"tabNextButton",M(Lt._nextButtonTemplate)),oe(this,"tabPreviousButton",M(Lt._previousButtonTemplate)),oe(this,"holdTimer",null),oe(this,"rAF",null),oe(this,"CLICK_TIMEOUT",500),oe(this,"START_SPEED",.01),oe(this,"ACCELERATION",5e-4),oe(this,"PADDING",10),oe(this,"SCROLL_LEFT","left"),oe(this,"SCROLL_RIGHT","right"),oe(this,"isDraggingTab",!1),oe(this,"isOverflowing",!1),oe(this,"isDropdownShown",!1),oe(this,"dropdownKeyIndex",0),oe(this,"_lastVisibleTabIndex",-1),oe(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 sr(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 d,h;l.scrollLeft=(d=(h=this.tabsContainer.get(0))===null||h===void 0?void 0:h.scrollWidth)!==null&&d!==void 0?d:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var r,i,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,d;if(this.tabsContainer.scrollLeft(t+i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((d=this.tabsContainer.innerWidth())!==null&&d!==void 0?d:0)===a.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((r=this.rAF)!==null&&r!==void 0?r:-1),this.rAF=window.requestAnimationFrame(h=>{var c,f,v=o||h,p=h-v,g=this.START_SPEED*p+.5*this.ACCELERATION*(p*p);g=Math.min(g,(c=(f=this.tabsContainer.get(0))===null||f===void 0?void 0:f.scrollWidth)!==null&&c!==void 0?c:1/0),this._handleScrollRepeat(e,t,g,v)})}}_$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(),M(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 Kn(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 Kn(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 Kn(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 Kn(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"),M(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"),M(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,d){if(d==null||d.length<2)return-1;for(var h=(s+l+d.length)%d.length;h!==s;){if(d.eq(h).css("display")!=="none")return h;h=(h+l+d.length)%d.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(),M(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=M(window).height())!==null&&r!==void 0?r:0,l=(i=M(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var d=this.tabDropdownButton.element[0].getBoundingClientRect(),h=o<s-d.bottom,c=!h&&d.bottom>s*.6,f=Math.min(d.left+(c?d.width:0),l-a.width-this.PADDING),v=c?Math.max(d.top-o,this.PADDING):d.bottom,p=s-v-this.PADDING;this.tabDropdownContainer.css({"max-height":p,top:v,left:f})}}}}_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()}}}}oe(Lt,"_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(""));oe(Lt,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));oe(Lt,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function jn(n,e,t){return e=Ag(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ag(n){var e=Lg(n,"string");return typeof e=="symbol"?e:String(e)}function Lg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class _l{constructor(e,t,r){jn(this,"_isVertical",void 0),jn(this,"_size",void 0),jn(this,"_grabSize",void 0),jn(this,"_dragListener",void 0),jn(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=r<t?t:r,this.element=this._createElement(),this._dragListener=new or(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=M('<div class="lm_drag_handle"></div>'),t=M('<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 Fg=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:bl,DragProxy:vn,DragSource:yl,DragSourceFromEvent:Cl,DropTargetIndicator:ar,Header:Lt,HeaderButton:Kn,Splitter:_l,Tab:sr},Symbol.toStringTag,{value:"Module"}));var Rg={config:Nv,container:kv,controls:Fg,errors:pg,items:Ig,utils:eg};const kg=Rg;function da(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 $e(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?da(Object(t),!0).forEach(function(r){ie(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):da(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ie(n,e,t){return e=jg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jg(n){var e=$g(n,"string");return typeof e=="symbol"?e:String(e)}function $g(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Pl extends vt{static minifyConfig(e){return Hi(e)}static unminifyConfig(e){return bi(e)}constructor(e,t){super(),ie(this,"isInitialised",!1),ie(this,"_isFullPage",!1),ie(this,"_resizeTimeoutId",void 0),ie(this,"_components",{"lm-react-component":cl}),ie(this,"_fallbackComponent",void 0),ie(this,"_itemAreas",[]),ie(this,"_maximisedItem",null),ie(this,"_maximisePlaceholder",M('<div class="lm_maximise_place"></div>')),ie(this,"_creationTimeoutPassed",!1),ie(this,"_subWindowsCreated",!1),ie(this,"_dragSources",[]),ie(this,"_updatingColumnsResponsive",!1),ie(this,"_firstLoad",!0),ie(this,"_reactChildMap",new Map),ie(this,"_reactChildren",null),ie(this,"_initialHeaderHeight",void 0),ie(this,"width",null),ie(this,"height",null),ie(this,"root",void 0),ie(this,"openPopouts",[]),ie(this,"selectedItem",null),ie(this,"isSubWindow",!1),ie(this,"eventHub",new ml(this)),ie(this,"config",void 0),ie(this,"container",void 0),ie(this,"_originalContainer",void 0),ie(this,"dropTargetIndicator",null),ie(this,"tabDropPlaceholder",M('<div class="lm_drop_tab_placeholder"></div>')),ie(this,"_typeToItem",void 0),this._onResize=this._onResize.bind(this),this._onUnload=this._onUnload.bind(this),this._windowBlur=this._windowBlur.bind(this),this._windowFocus=this._windowFocus.bind(this),this.config=this._createConfig(e),this._originalContainer=t,this.container=this._getContainer(),this._initialHeaderHeight=this.config.dimensions.headerHeight,this.isSubWindow&&M("body").css("visibility","hidden"),this._typeToItem={column:Rr.bind(this,!0),row:Rr.bind(this,!1),stack:wi,component:El}}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 Oe))throw new Error("Root must be a ContentItem");var t={settings:$e({},this.config.settings),dimensions:$e({},this.config.dimensions),labels:$e({},this.config.labels),content:[]},r=function o(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 d=0;d<s.contentItems.length;d++)a.content[d]={},o(a.content[d],s.contentItems[d])}};e?r(t,{contentItems:[e]}):r(t,this.root),this._$reconcilePopoutWindows(),t.openPopouts=[];for(var i=0;i<this.openPopouts.length;i++)t.openPopouts.push(this.openPopouts[i].toConfig());return t.maximisedItemId=this._maximisedItem?"__glMaximised":void 0,t}getComponent(e){return this._components[e]}getFallbackComponent(){return this._fallbackComponent}init(){if(this._subWindowsCreated===!1&&(this._createSubWindows(),this._subWindowsCreated=!0),document.readyState==="loading"||document.body===null){M(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 ar,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(),M(window).off("resize",this._onResize),M(window).off("unload beforeunload",this._onUnload),M(window).off("blur.lm").off("focus.lm"),this.root.callDownwards("_$destroy",[],!0),this.root.contentItems=[],this.tabDropPlaceholder.remove(),(e=this.dropTargetIndicator)===null||e===void 0||e.destroy(),this.eventHub.destroy(),this._dragSources.forEach(function(t){t._dragListener.destroy()}),this._dragSources=[])}createContentItem(e,t){var r,i,o;if(typeof e.type!="string")throw new an("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!this._typeToItem[e.type])throw i="Unknown type '"+e.type+"'. Valid types are "+Object.keys(this._typeToItem).join(","),new an(i);return e.type==="component"&&!(t instanceof wi)&&t&&!(this.isSubWindow===!0&&t instanceof Si)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),e.id=(r=e.id)!==null&&r!==void 0?r:Lr(),o=new this._typeToItem[e.type](this,e,t),o}createPopout(e,t,r,i){var o=[],a=e instanceof Oe,s=this;if(a){var l;o=this.toConfig(e).content,r=Lr();for(var d=e.parent,h=e;((c=d)===null||c===void 0?void 0:c.contentItems.length)===1&&!d.isRoot;){var c;h=d,d=d.parent}if((l=d)===null||l===void 0||l.addId(r),i==null||Number.isNaN(i)){var f;i=(f=d)===null||f===void 0?void 0:f.contentItems.indexOf(h)}}else e instanceof Array?o=e:o=[e];if(!t&&a){var v,p,g,y=window.screenX||window.screenLeft,P=window.screenY||window.screenTop,O=(v=e.element.offset())!==null&&v!==void 0?v:{left:0,top:0};t={left:y+O.left,top:P+O.top,width:(p=e.element.width())!==null&&p!==void 0?p: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 _=new bl(o,t,r,i,this);return _.on("initialised",function(){s.emit("windowOpened",_)}),_.on("closed",function(){s._$reconcilePopoutWindows()}),this.openPopouts.push(_),_}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var r=new yl(e,t,this);return this._dragSources.push(r),r}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new Cl(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=$e({},this.root._$getArea()),r=[$e($e({},t),{},{side:"left",x2:t.x1+e}),$e($e({},t),{},{side:"right",x1:t.x2-e}),$e($e({},t),{},{side:"top",y2:t.y1+e}),$e($e({},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(sn(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=$e($e({},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 Oe)return e;if(M.isPlainObject(e)&&e.type){var r=this.createContentItem(e,t);return r.callDownwards("_$init"),r}else throw new Error("Invalid contentItem")}_$reconcilePopoutWindows(){for(var e=[],t=0;t<this.openPopouts.length;t++){var r;((r=this.openPopouts[t].getWindow())===null||r===void 0?void 0:r.closed)===!1?e.push(this.openPopouts[t]):this.emit("windowClosed",this.openPopouts[t])}this.openPopouts.length!==e.length&&(this.emit("stateChanged"),this.openPopouts=e)}_getAllContentItems(){var e=[],t=r=>{if(e.push(r),r.contentItems instanceof Array)for(var i=0;i<r.contentItems.length;i++)t(r.contentItems[i])};return t(this.root),e}_bindEvents(){this._isFullPage&&M(window).resize(this._onResize),M(window).on("unload beforeunload",this._onUnload).on("blur.lm",this._windowBlur).on("focus.lm",this._windowFocus)}_windowBlur(){this.root.element.addClass("lm_window_blur")}_windowFocus(){this.root.element.removeClass("lm_window_blur")}_onResize(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(this.updateSize.bind(this),100)}_createConfig(e){var t,r=hl("gl-window");r&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(r)||"{}"),e=bi(e),localStorage.removeItem(r)),e=M.extend(!0,{},sl,e);var i=function o(a){for(var s in a){var l=a[s];s!=="props"&&typeof l=="object"&&l!=null?o(l):s==="type"&&l==="react-component"&&(a.type="component",a.componentName="lm-react-component")}};return i(e),((t=e.settings)===null||t===void 0?void 0:t.hasHeaders)===!1&&(e.dimensions.headerHeight=0),e}_adjustToWindowMode(){var e,t=M('<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=$i((e=this.config.content[0].title)!==null&&e!==void 0?e:""),M("head").append(M("body link, body style, template, .gl_keep")),this.container=M("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?M(this._originalContainer):M("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,M("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 an(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new an(t,e);this.root=new Si(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 d=a.contentItems[a.contentItems.length-1];this._addChildContentItemsToContainer(s,d)}this._updatingColumnsResponsive=!1}}}_useResponsiveLayout(){return this.config.settings&&(this.config.settings.responsiveMode=="always"||this.config.settings.responsiveMode=="onload"&&this._firstLoad)}_addChildContentItemsToContainer(e,t){t.type==="stack"?t.contentItems.forEach(function(r){e.addChild(r),t.removeChild(r,!0)}):t.contentItems.forEach(r=>{this._addChildContentItemsToContainer(e,r)})}_findAllStackContainers(){var e=[];return this._findAllStackContainersRecursive(e,this.root),e}_findAllStackContainersRecursive(e,t){t.contentItems.forEach(r=>{sn(r)?e.push(r):r.isComponent||this._findAllStackContainersRecursive(e,r)})}}ie(Pl,"__lm",kg);const Hg=Pl,Bg="_lm_dragging_k4a5m_1",Wg="_lm_goldenlayout_k4a5m_1",Ug="_lm_header_k4a5m_1",Vg="_lm_controls_k4a5m_1",Kg="_lm_tabpreviousbutton_k4a5m_1",zg="_lm_tabnextbutton_k4a5m_1",Gg="_lm_tab_k4a5m_1",qg="_lm_active_k4a5m_1",Zg="_lm_close_tab_k4a5m_1",Xg="_lm_content_k4a5m_1",Yg="_lm_dragProxy_k4a5m_1",Qg="_lm_dropTargetIndicator_k4a5m_1",Jg="_march_k4a5m_1",ep="_lm_inner_k4a5m_1",tp="_lm_splitter_k4a5m_1",np="_lm_selectable_k4a5m_1",rp="_lm_tabdropdown_list_k4a5m_1",ip="_lm_title_k4a5m_1",op="_lm_title_before_k4a5m_1",ap="_lm_selected_k4a5m_1",sp="_lm_focusin_k4a5m_1",lp="_lm_window_blur_k4a5m_1",dp="_lm_popout_k4a5m_1",up="_lm_maximise_k4a5m_1",hp="_lm_tabdropdown_k4a5m_1",cp="_lm_close_k4a5m_1",mp="_lm_tabdropdown_search_k4a5m_1",fp="_lm_tabs_k4a5m_1",vp="_lm_keyboard_active_k4a5m_1",gp="_lm_maximised_k4a5m_1",pp="_lm_items_k4a5m_1",ua={"tab-height":"28px","drag-border-width":"5px",lm_dragging:Bg,lm_goldenlayout:Wg,lm_header:Ug,lm_controls:Vg,lm_tabpreviousbutton:Kg,lm_tabnextbutton:zg,lm_tab:Gg,lm_active:qg,lm_close_tab:Zg,lm_content:Xg,lm_dragProxy:Yg,lm_dropTargetIndicator:Qg,march:Jg,lm_inner:ep,lm_splitter:tp,lm_selectable:np,lm_tabdropdown_list:rp,lm_title:ip,lm_title_before:op,lm_selected:ap,lm_focusin:sp,lm_window_blur:lp,lm_popout:dp,lm_maximise:up,lm_tabdropdown:hp,lm_close:cp,lm_tabdropdown_search:mp,lm_tabs:fp,lm_keyboard_active:vp,lm_maximised:gp,lm_items:pp},ha=Object.freeze({tabHeight:parseInt(ua["tab-height"],10),dragBorderWidth:parseInt(ua["drag-border-width"],10)});function ca(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function It(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ca(Object(t),!0).forEach(function(r){Tl(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ca(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Tl(n,e,t){return e=bp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bp(n){var e=yp(n,"string");return typeof e=="symbol"?e:String(e)}function yp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var $t=W.module("LayoutUtils");function Ol(n){return n.componentName!==void 0}function En(n){var e=n;return(Ol(n)&&n.componentName==="lm-react-component"||n.type==="react-component")&&e.component!==void 0}function Cr(n){return n.focus!==void 0}function ma(n){return n.type==="stack"}class D{static activateTab(e,t){var r=D.getStackForRoot(e,t,!1);if(!r){$t.error("Could not find stack for config",t);return}var i=D.getContentItemInStack(r,t);i&&r.setActiveContentItem(i)}static isActiveTab(e,t){var r=D.getStackForRoot(e,t,!1);if(!r)return $t.error("Could not find stack for config",t),!1;var i=D.getContentItemInStack(r,t),o=r.getActiveContentItem();return o===i}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=t?"column":"row";if(wl(e)){(e.contentItems==null||e.contentItems.length===0)&&e.addChild({type:r});var i=e.contentItems[0],o=t?i.isColumn:i.isRow;if(!o){e.removeChild(i,!0),e.addChild({type: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;return l||(e.addChild({type:t?"row":"column"}),e.removeChild(s,!0),e.contentItems[e.contentItems.length-1].addChild(s),s=e.contentItems[e.contentItems.length-1]),this.addStack(s,!t)}static getStackById(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(i&&sn(e)&&e.contentItems.length===0)return e;if(t===((r=e.config)===null||r===void 0?void 0:r.id)){if(sn(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 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&&sn(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&&qi(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,d=D.getStackForRoot(e,{component:s},r&&l,i,o);if(d)return d}return null}static getContentItemInStack(e,t){if(!e)return null;for(var r=0;r<e.contentItems.length;r+=1){var i=e.contentItems[r];if(i.isComponent&&i.config!=null&&qi(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],{component:a,content:s}=o;if(a){var l=t(a,o);l!=null?r.push(l):$t.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(a,'"'))}else if(s){var d=It(It({},o),{},{content:D.dehydrateLayoutConfig(s,t)});r.push(d)}else r.push(o)}return r}static getTabPoint(e){var{tab:t}=e;if(t==null)throw new Error("Cannot get tab for panel container ".concat(e));var r=t.element[0].getBoundingClientRect();return[r.left+r.width*.5,r.bottom-8]}static dropLayoutMinorChange(e){for(var t=0;t<e.length;t+=1){var r=e[t],{content:i}=r;i!==void 0?(ma(r)&&delete r.activeItemIndex,D.dropLayoutMinorChange(i)):En(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=D.cloneLayout(e),o=D.cloneLayout(t);return r?(D.dropLayoutMinorChange(i),D.dropLayoutMinorChange(o),Qn(i,o)):Qn(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(En(o)){var a,{component:s,props:l={}}=o;r.push(It(It({},o),{},{id:(a=o?.id)!==null&&a!==void 0?a:At(),props:t(s,l)}))}else if(o.content!==void 0){var d=D.hydrateLayoutConfig(o.content,t);ma(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=d.length&&($t.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),r.push(It(It({},o),{},{content:d}))}else r.push(o)}return r}static openComponent(){var{root:e,config:t,stack:r=void 0,replaceExisting:i=!0,replaceConfig:o=void 0,createNewStack:a=!1,focusElement:s=void 0,dragEvent:l=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},d=document.activeElement,h=It({},t);if(h.id==null&&(h.id=At()),l!=null){e?.layoutManager.createDragSourceFromEvent(h,l);return}var c=o||{id:h.id,component:h.component};k(e);var f=r??(a?D.addStack(e):D.getStackForRoot(e,c));k(f);var v=D.getContentItemInStack(f,c);if(s!=null){var p=y=>{$t.debug("Component created, focusing element",s),f.off("componentCreated",p);var{element:P}=y.origin;requestAnimationFrame(()=>{D.focusElement(P[0],s)})};f.on("componentCreated",p)}if(i&&v){var g=f.contentItems.indexOf(v);f.addChild(h,g+1),f.removeChild(v),f.setActiveContentItem(f.contentItems[g])}else f.addChild(h);s==null&&d&&Cr(d)&&d.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=D.getContentItemInStack(e,o);if(r&&a&&e){var s=e?.contentItems.indexOf(a);e.addChild(t,s+1),e.removeChild(a),e.setActiveContentItem(e.contentItems[s])}else e?.addChild(t);i&&Cr(i)&&i.focus()}static closeComponent(e,t,r){var i=D.getStackForRoot(e,t,!1,!1,!1);if(!i){$t.warn("Cannot find stack for component, ignoring close",t);return}var o=D.getContentItemInStack(i,t),a=document.activeElement;o&&(Ze(o)?o.container.close(r):i.removeChild(o)),a&&document.contains(a)&&Cr(a)&&a.focus()}static renameComponent(e,t,r){var i=D.getStackForRoot(e,t,!1);if(!i){$t.error("Could not find stack for config",t);return}var o=D.getContentItemInStack(i,t);o&&o.setTitle(r)}static cloneComponent(e,t){var r=D.getStackForRoot(e,t,!1);if(!r)return $t.error("Could not find stack for config",t),null;var{props:i={}}=t,o=D.getPanelComponentState(t),a={type:"react-component",component:t.component,props:It(It({},i),{},{panelState:o}),title:"".concat(t.title," Copy"),id:At()};return D.openComponentInStack(r,a),a}static getPanelComponentState(e){if(Ol(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(En(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=D.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return D.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,r=D.getComponentConfigFromContainer(t);if(r&&En(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]:D.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var r=e.querySelector(t);return r==null?null:(Cr(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)})}}Tl(D,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var Cp=j.forwardRef((n,e)=>{var t=D.getComponentNameFromPanel({props:n});return u.jsx("div",{ref:e,className:"panel-placeholder",children:u.jsxs("div",{children:['Component "',t,'" is not registered.']})})});Cp.displayName="PanelPlaceholder";const te=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"});function kr(n){return n?.WrappedComponent!==void 0}function Sp(n){return typeof n.id=="string"&&n.layout instanceof Hg&&n.panelManager instanceof Wi&&typeof n.registerComponent=="function"}function wp(n){if(!Sp(n))throw new Error("Expected dashboard plugin props, but instead received ".concat(n))}function fa(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 va(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fa(Object(t),!0).forEach(function(r){Ut(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):fa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ut(n,e,t){return e=Ep(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ep(n){var e=_p(n,"string");return typeof e=="symbol"?e:String(e)}function _p(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var it=W.module("PanelManager");class Wi{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]:()=>{};Ut(this,"layout",void 0),Ut(this,"hydrateComponent",void 0),Ut(this,"dehydrateComponent",void 0),Ut(this,"onPanelsUpdated",void 0),Ut(this,"closed",void 0),Ut(this,"openedMap",void 0),this.handleFocus=this.handleFocus.bind(this),this.handleMount=this.handleMount.bind(this),this.handleUnmount=this.handleUnmount.bind(this),this.handleReopen=this.handleReopen.bind(this),this.handleReopenLast=this.handleReopenLast.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.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(te.FOCUS,this.handleFocus),e.on(te.MOUNT,this.handleMount),e.on(te.UNMOUNT,this.handleUnmount),e.on(te.REOPEN,this.handleReopen),e.on(te.REOPEN_LAST,this.handleReopenLast),e.on(te.DELETE,this.handleDeleted),e.on(te.CLOSED,this.handleClosed),e.on(te.CLOSE,this.handleControlClose)}stopListening(){var{eventHub:e}=this.layout;e.off(te.FOCUS,this.handleFocus),e.off(te.MOUNT,this.handleMount),e.off(te.UNMOUNT,this.handleUnmount),e.off(te.REOPEN,this.handleReopen),e.off(te.REOPEN_LAST,this.handleReopenLast),e.off(te.DELETE,this.handleDeleted),e.off(te.CLOSED,this.handleClosed),e.off(te.CLOSE,this.handleControlClose)}getClosedPanelConfigsOfType(e){return this.closed.filter(t=>t.component===e)}getOpenedPanels(){return Array.from(this.openedMap.values())}getOpenedPanelConfigs(){return this.getOpenedPanels().map(e=>{var{glContainer:t}=e.props;return D.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&En(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,r=D.getStackForConfig(this.layout.root,{id:e});return(t=r&&D.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=>kr(r)&&t instanceof r.WrappedComponent||!kr(r)&&t instanceof r))}updatePanel(e){var t=D.getIdFromPanel(e);if(t==null){it.error("updatePanel Panel did not have an ID",e);return}it.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=D.getIdFromPanel(e);if(t==null){it.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){it.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){it.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}it.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){it.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){it.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){it.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}handleReopen(e,t){it.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:r}=e,{props:i}=e;i=this.hydrateComponent(r,i);var o=va(va({},e),{},{props:i}),{root:a}=this.layout,s=e.parentStackId===void 0?void 0:D.getStackById(a,e.parentStackId);D.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=D.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){it.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){it.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:r}=this.layout;D.closeComponent(r,t)}addClosedPanel(e){var{root:t}=this.layout,r=D.getComponentConfigFromContainer(e);if(r&&En(r)){var i=this.dehydrateComponent(r.component,r);if(i!=null){var o;i.parentStackId=(o=D.getStackForConfig(t,r))===null||o===void 0?void 0:o.config.id,this.closed.push(i)}}}sendUpdate(){var{closed:e,openedMap:t}=this;this.onPanelsUpdated({closed:[...e],openedMap:new Map(t)})}}Ut(Wi,"MAX_CLOSED_PANEL_COUNT",100);var Pp=W.module("PanelErrorBoundary");class Tp extends m.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}componentWillUnmount(){var{glContainer:e,glEventHub:t}=this.props,r=D.getIdFromContainer(e);Pp.debug("componentWillUnmount",r),t.emit(te.CLOSED,r,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?u.jsx("div",{className:"panel-error-boundary",children:u.jsx(hn,{errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e}}function ga(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function jr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ga(Object(t),!0).forEach(function(r){Op(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ga(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Op(n,e,t){return e=Ip(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ip(n){var e=Dp(n,"string");return typeof e=="symbol"?e:String(e)}function Dp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Il(n){var{props:e,componentState:t}=n,{metadata:r}=e,{panelState:i=null}=e;t&&({panelState:i}=t);var o={};return r!=null&&(o.metadata=r),i!=null&&(o.panelState=i),jr(jr({},n),{},{componentState:null,props:o,type:"react-component"})}function Dl(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return jr(jr({},n),{},{localDashboardId:e})}function xp(n){var e=kr(n)&&n.WrappedComponent.prototype!=null&&n.WrappedComponent.prototype.isReactComponent!=null||n.prototype!=null&&n.prototype.isReactComponent!=null,t=!kr(n)&&"$$typeof"in n&&n.$$typeof===td.ForwardRef;return e||t}const Mp={dehydrate:Il,hydrate:Dl};var Np=j.createContext(void 0),Ap=S.shape({on:S.func,off:S.func,isHidden:S.bool,tab:S.shape({header:S.shape({tabs:S.arrayOf(S.shape({contentItem:S.shape({})}))})}),title:S.string,setTitle:S.func,close:S.func}),xl=S.shape({on:S.func,off:S.func,emit:S.func}),Lp=S.shape({registerComponent:S.func,root:S.shape({addChild:S.func}),on:S.func,off:S.func,eventHub:xl}),Fp=Object.freeze({Container:Ap,EventHub:xl,Layout:Lp});function xe(n,e,t){m.useEffect(function(){return n.on(e,t),()=>{n.off(e,t)}},[n,e,t])}function $n(n,e,t,r){var i,o=(i=e.COMPONENT)!==null&&i!==void 0?i:e.displayName;if(o==null)throw new Error("ComponentType must have a `COMPONENT` or `displayName` attribute.");j.useEffect(()=>{var a=n(o,e,t,r);return()=>{a()}},[e,r,t,o,n])}var Ml="SET_DASHBOARD_DATA";const Rp=wc(Ml,{},!1),kp={dashboardData:Rp};var jp=new Map,Nl=Object.freeze({}),$p=Object.freeze([]),BC=Oi,WC=Ga,UC=nd,Hp=n=>n.dashboardData,Ne=(n,e)=>{var t;return(t=Hp(n)[e])!==null&&t!==void 0?t:Nl},VC=(n,e)=>{var t;return(t=Ne(n,e).closed)!==null&&t!==void 0?t:$p},KC=(n,e)=>{var t;return(t=Ne(n,e).openedMap)!==null&&t!==void 0?t:jp},Al=(n,e)=>{var t;return(t=Ne(n,e).pluginDataMap)!==null&&t!==void 0?t:Nl},zC=(n,e,t)=>Al(n,e)[t];function pa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function _n(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?pa(Object(t),!0).forEach(function(r){Bp(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):pa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Bp(n,e,t){return e=Wp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wp(n){var e=Up(n,"string");return typeof e=="symbol"?e:String(e)}function Up(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ll=(n,e)=>({type:Ml,id:n,payload:e}),Qt=(n,e)=>(t,r)=>t(Ll(n,_n(_n({},Ne(r(),n)),e))),GC=(n,e,t)=>(r,i)=>r(Ll(n,_n(_n({},Ne(i(),n)),{},{pluginDataMap:_n(_n({},Al(i(),n)),{},{[e]:t})})));Object.entries(kp).map(n=>{var[e,t]=n;return Hd.register(e,t)});function Vp(n){var{children:e}=n;return u.jsx(u.Fragment,{children:e})}var Fl=m.createContext(null);function Kp(){return m.useContext(Fl)}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 Hn(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){zp(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 zp(n,e,t){return e=Gp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gp(n){var e=qp(n,"string");return typeof e=="symbol"?e:String(e)}function qp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Sr=W.module("DashboardLayout"),Zp=Object.freeze({}),Xp=[],ya=()=>{},Yp=1e3,Ca=n=>n;function Qp(n){var e,t,{id:r,children:i,emptyDashboard:o=u.jsx("div",{children:"Dashboard is empty."}),layout:a,layoutConfig:s=Xp,onLayoutChange:l=ya,onLayoutInitialized:d=ya,hydrate:h=Dl,dehydrate:c=Il,panelWrapper:f=Vp}=n,v=Oi(),p=(e=Ga(b=>Ne(b,r)))!==null&&e!==void 0?e:Zp,[g,y]=m.useState(!1),[P,O]=m.useState(!1),[_,R]=m.useState(),[U]=m.useState((t=p?.closed)!==null&&t!==void 0?t:[]),[Q,N]=m.useState(a.getReactChildren()),B=m.useMemo(()=>new Map,[]),$=m.useMemo(()=>new Map,[]),Y=m.useCallback(function(b,w){var T,G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:h,J=arguments.length>3&&arguments[3]!==void 0?arguments[3]:c;Sr.debug2("registerComponent",b,w,G,J);function et(Z,re){var he=w,Ae=f,Et=xp(he),{glContainer:_t,glEventHub:Yr}=Z,Rn=D.getIdFromContainer(_t);return u.jsx(Tp,{glContainer:_t,glEventHub:Yr,children:u.jsx(Fl.Provider,{value:Rn,children:u.jsx(Ae,Hn(Hn({},Z),{},{children:Et?u.jsx(he,Hn(Hn({},Z),{},{ref:re})):u.jsx(he,Hn({},Z))}))})})}et.displayName="DashboardWrapper(".concat((T=w.displayName)!==null&&T!==void 0?T:b,")");var I=a.registerComponent(b,j.forwardRef(et));return B.set(b,G),$.set(b,J),I},[h,c,B,$,a,f]),ne=m.useCallback((b,w)=>{var T;return((T=B.get(b))!==null&&T!==void 0?T:Ca)(w,r)},[B,r]),F=m.useCallback((b,w)=>{var T;return((T=$.get(b))!==null&&T!==void 0?T:Ca)(w,r)},[$,r]),q=m.useMemo(()=>new Wi(a,ne,F,new Map,U,b=>{var{closed:w,openedMap:T}=b;v(Qt(r,{closed:w,openedMap:T}))}),[F,v,ne,r,U,a]),K=Au(b=>{var w=_==null||!D.isEqual(_,b);Sr.debug("handleLayoutStateChanged",w,b),w&&(y(a.root.contentItems.length===0),R(b),l(b),N(a.getReactChildren()))},Yp,{flushOnUnmount:!0});m.useEffect(()=>()=>K.flush(),[K]);var A=m.useCallback(()=>{if(!P){var b=a.toConfig(),w=b.content,T=D.dehydrateLayoutConfig(w,F);K(T)}},[F,P,a,K]),V=m.useCallback(b=>{var w=D.getIdFromContainer(b);a.eventHub.emit(te.DRAGGING,w),O(!0)},[a.eventHub]),z=m.useCallback(b=>{var w=D.getIdFromContainer(b);a.eventHub.emit(te.DROPPED,w),O(!1)},[a.eventHub]),me=m.useCallback(b=>{if(Sr.debug2("handleComponentCreated",b),!(b==null||b.config==null||b.config.component==null||b.element==null)){var w=b.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),T="".concat(w,"-component");b.element.addClass(T)}},[]),je=m.useCallback(()=>{N(a.getReactChildren())},[a]);xe(a,"stateChanged",A),xe(a,"itemPickedUp",V),xe(a,"itemDropped",z),xe(a,"componentCreated",me),xe(a.eventHub,te.TITLE_CHANGED,A),xe(a,"reactChildrenChanged",je);var Ie=Lu(s);return m.useEffect(function(){if(Ie!==s&&s!==_){Sr.debug("Setting new layout content...");for(var w=D.hydrateLayoutConfig(s,ne);a.root.contentItems.length>0;)a.root.contentItems[0].remove();for(var T=0;T<w.length;T+=1)a.root.addChild(w[T]);y(a.root.contentItems.length===0)}},[ne,a,s,_,q,Ie]),m.useEffect(()=>d(),[]),u.jsxs(u.Fragment,{children:[g&&o,Q,j.Children.map(i,b=>b!=null?u.jsx($h,{fallback:[],children:j.cloneElement(b,{id:r,layout:a,panelManager:q,registerComponent:Y})}):null)]})}Qp.propTypes={id:S.string.isRequired,children:S.node,data:S.shape({}),emptyDashboard:S.node,layout:Fp.Layout.isRequired,layoutConfig:S.arrayOf(S.shape({})),onLayoutChange:S.func,onLayoutInitialized:S.func};var Jp=m.createContext(null);function qC(){var n=m.useContext(Jp);if(n==null)throw new Error("useDashboardId must be used within a DashboardIdContext provider");return n}function eb(n,e,t){return e=tb(e),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:String(e)}function nb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Rl(n,e,t){if(n){if(t(n)===!0)return n;for(var r=e?n.return:n.child;r;){var i=Rl(r,e,t);if(i)return i;r=e?null:r.sibling}}}function rb(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}var kl=rb(m.createContext(null));class ZC extends m.Component{constructor(){super(...arguments),eb(this,"_reactInternals",void 0)}render(){var{children:e}=this.props;return u.jsx(kl.Provider,{value:this._reactInternals,children:e})}}function ib(){var n=m.useContext(kl);if(n===null)throw new Error("useFiber must be called within a <FiberProvider />!");var[e]=m.useState(()=>At()),t=m.useMemo(()=>{for(var r of[n,n?.alternate].filter(o=>o!=null)){var i=Rl(r,!1,o=>{for(var a=o.memoizedState;a!=null;){if(a.memoizedState===e)return!0;a=a.next}});if(i)return i}},[n,e]);return t}var XC="default",ob=W.module("useDhId"),si="__dhId";function YC(){var n,e,t=(n=(e=ib())===null||e===void 0?void 0:e.pendingProps)!==null&&n!==void 0?n:{},r=t[si],i=Kp();if(r!=null){if(typeof r!="string")throw new Error("useDhId expected prop ".concat(si," to be a string, but got ").concat(typeof r));return r}return i??(ob.warn("useDhId must be used within a PanelIdContext provider if there is no ".concat(si," prop. Defaulting to null.")),null)}function lr(n,e,t){return e=ab(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ab(n){var e=sb(n,"string");return typeof e=="symbol"?e:String(e)}function sb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ln{}lr(Ln,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");lr(Ln,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");lr(Ln,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");lr(Ln,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");lr(Ln,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");const at=Ln;function Jt(n,e,t){return e=lb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lb(n){var e=db(n,"string");return typeof e=="symbol"?e:String(e)}function db(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ft{}Jt(Ft,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");Jt(Ft,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");Jt(Ft,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");Jt(Ft,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");Jt(Ft,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");Jt(Ft,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");Jt(Ft,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");Jt(Ft,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");const Sa=Ft,QC=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function Rt(n,e,t){return e=ub(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ub(n){var e=hb(n,"string");return typeof e=="symbol"?e:String(e)}function hb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class wt{}Rt(wt,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");Rt(wt,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");Rt(wt,"CLOSE_FILE","NotebookEvent.closeFile");Rt(wt,"RENAME","NotebookEvent.rename");Rt(wt,"RENAME_FILE","NotebookEvent.renameFile");Rt(wt,"REGISTER_FILE","NotebookEvent.registerFile");Rt(wt,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");Rt(wt,"UNREGISTER_FILE","NotebookEvent.unregisterFile");Rt(wt,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");const de=wt;function Fn(n,e,t){return e=cb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cb(n){var e=mb(n,"string");return typeof e=="symbol"?e:String(e)}function mb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class gn{}Fn(gn,"focus","TabEvent.focus");Fn(gn,"blur","TabEvent.blur");Fn(gn,"openPQObject","TabEvent.openPQObject");Fn(gn,"openControl","TabEvent.openControl");Fn(gn,"reload","TabEvent.reload");Fn(gn,"clearAllFilters","TabEvent.clearAllFilters");const wr=gn;function fb(n,e,t){return e=vb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function vb(n){var e=gb(n,"string");return typeof e=="symbol"?e:String(e)}function gb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class jl 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,{glContainer:i}=this.props;return[...(e=i==null||(t=i.tab)===null||t===void 0||(r=t.header)===null||r===void 0?void 0:r.tabs)!==null&&e!==void 0?e:[]]}handleCloseTab(){var{glContainer:e}=this.props;e.close()}handleCloseTabsAll(){var e=this.getAllTabs();e.forEach(t=>{var r;return(r=(t?.contentItem).container)===null||r===void 0?void 0:r.close()})}handleCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),r=t.length-1;r>0;r-=1){var i,o,a,s,l,d,h;if(((i=t[r].contentItem)===null||i===void 0||(o=i.config)===null||o===void 0?void 0:o.id)===((a=e.tab)===null||a===void 0||(s=a.contentItem)===null||s===void 0||(l=s.config)===null||l===void 0?void 0:l.id))break;(d=((h=t[r])===null||h===void 0?void 0:h.contentItem).container)===null||d===void 0||d.close()}}handleReopenLast(){var{glContainer:e,glEventHub:t}=this.props;t.emit(te.REOPEN_LAST,e)}canCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),r=!0,i=t.length-1;i>0;i-=1){var o,a,s,l,d,h,c,f;if(((o=t[i].contentItem)===null||o===void 0||(a=o.config)===null||a===void 0?void 0:a.id)===((s=e.tab)===null||s===void 0||(l=s.contentItem)===null||l===void 0||(d=l.config)===null||d===void 0?void 0:d.id))break;var v=!!(!((h=t[i])===null||h===void 0||(c=h.contentItem)===null||c===void 0||(f=c.config)===null||f===void 0)&&f.isClosable);if(v){r=!1;break}}return r}canCloseAny(){for(var e=this.getAllTabs(),t=!0,r=e.length-1;r>0;r-=1){var i,o,a,s=!!(!((i=e[r])===null||i===void 0||(o=i.contentItem)===null||o===void 0||(a=o.config)===null||a===void 0)&&a.isClosable);if(s){t=!1;break}}return t}canReopenLast(){var e,t,{workspace:r,glContainer:i}=this.props,o=(e=D.getStackForConfig(i.layoutManager.root,i.getConfig()))===null||e===void 0?void 0:e.config.id;return!((t=r.data.closed)!==null&&t!==void 0&&t.some(a=>a.parentStackId===o))}render(){var e,t,r,{additionalActions:i,glContainer:o}=this.props,a=[...i];a.push(()=>({title:"Re-open closed panel",group:ee.groups.medium+2004,action:this.handleReopenLast,disabled:this.canReopenLast()}));var s=(e=o.tab)===null||e===void 0||(t=e.contentItem)===null||t===void 0||(r=t.config)===null||r===void 0?void 0:r.isClosable;return a.push({title:"Close",order:10,group:ee.groups.low,action:this.handleCloseTab,disabled:s===void 0||!s}),a.push(()=>({title:"Close Tabs to Right",order:20,group:ee.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),a.push(()=>({title:"Close All",order:30,group:ee.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),u.jsx(ee,{actions:a})}}fb(jl,"defaultProps",{additionalActions:[]});var pb=n=>({workspace:$s(n)}),bb=Nn(pb,{setWorkspace:Hs})(jl);const yb=bb;function $l(n,e,t){return e=Cb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cb(n){var e=Sb(n,"string");return typeof e=="symbol"?e:String(e)}function Sb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Hl extends m.PureComponent{constructor(e){super(e),$l(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=j.createRef();var{value:t}=e;this.state={value:t,valueWasValidated:!1}}componentDidUpdate(e){var{isShown:t}=e,{isShown:r}=this.props;r&&!t&&this.resetState()}resetState(){var{value:e}=this.props;this.setState({value:e,valueWasValidated:!1})}handleRenameDialogOpened(){var e,t;(e=this.renameInputRef)===null||e===void 0||(t=e.current)===null||t===void 0||t.focus()}handleRenameInputChange(e){this.setState({value:e.target.value})}handleRenameCancel(){var{onCancel:e}=this.props;e()}handleRenameSubmit(e){e.stopPropagation(),e.preventDefault();var{value:t}=this.state,r=t?.trim();if(r!==void 0&&r!==""){var{onSubmit:i}=this.props;i(r)}else this.setState({value:r,valueWasValidated:!0})}renderRenameDialog(){var{isShared:e,isOwner:t,itemType:r}=this.props,{value:i,valueWasValidated:o}=this.state;return u.jsxs("form",{className:X("p-3",{"was-validated":o}),onSubmit:this.handleRenameSubmit,noValidate:!0,role:"presentation",onMouseDown:a=>{a.stopPropagation()},onMouseUp:a=>{a.stopPropagation()},children:[u.jsxs("div",{className:"form-group",children:[u.jsxs("label",{htmlFor:"rename-dialog-".concat(r,"-input"),children:["Rename ",r]}),u.jsx("input",{type:"text",className:"form-control",id:"rename-dialog-".concat(r,"-input"),value:i??void 0,ref:this.renameInputRef,onChange:this.handleRenameInputChange,required:!0}),u.jsxs("div",{className:"invalid-feedback",children:[r," name cannot be empty"]}),(e||!t)&&u.jsxs("div",{className:"pt-2",children:["Renaming this ",r," will rename for all users."]})]}),u.jsxs("div",{className:"text-right",children:[u.jsx(se,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),u.jsx(se,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var{isShown:e,onCancel:t}=this.props;return u.jsx(xi,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}$l(Hl,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});function Ei(n,e,t){return e=wb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wb(n){var e=Eb(n,"string");return typeof e=="symbol"?e:String(e)}function Eb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var _b=W.module("Panel");class Bl extends m.PureComponent{constructor(e){super(e),Ei(this,"ref",void 0),Ei(this,"getAdditionActions",St((r,i,o)=>{var a=[];return i&&a.push(this.getCloneAction()),o&&a.push(this.getRenameAction()),[...a,...r]})),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleCopyPanel=this.handleCopyPanel.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleHide=this.handleHide.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleBeforeShow=this.handleBeforeShow.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.handleShowRenameDialog=this.handleShowRenameDialog.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleTab=this.handleTab.bind(this),this.ref=j.createRef();var{glContainer:t}=this.props;this.state={title:D.getTitleFromContainer(t),showRenameDialog:!1,isWithinPanel:!0}}componentDidMount(){var e,t,{componentPanel:r,glContainer:i,glEventHub:o}=this.props;i.on("resize",this.handleResize),i.on("show",this.handleBeforeShow),i.on("shown",this.handleShow),i.on("hide",this.handleHide),i.on("tab",this.handleTab),i.on("tabClicked",this.handleTabClicked),o.on(at.SESSION_CLOSED,this.handleSessionClosed),o.on(at.SESSION_OPENED,this.handleSessionOpened),o.on(wr.focus,this.handleTabFocus),o.on(wr.blur,this.handleTabBlur),o.on(Sa.CLEAR_ALL_FILTERS,this.handleClearAllFilters),o.emit(te.MOUNT,r??this),this.setState({isWithinPanel:((e=this.ref.current)===null||e===void 0||(t=e.parentElement)===null||t===void 0?void 0:t.closest(".dh-panel"))!=null})}componentWillUnmount(){var{componentPanel:e,glContainer:t,glEventHub:r}=this.props;t.off("resize",this.handleResize),t.off("show",this.handleBeforeShow),t.off("shown",this.handleShow),t.off("hide",this.handleHide),t.off("tab",this.handleTab),t.off("tabClicked",this.handleTabClicked),r.off(at.SESSION_CLOSED,this.handleSessionClosed),r.off(at.SESSION_OPENED,this.handleSessionOpened),r.off(wr.focus,this.handleTabFocus),r.off(wr.blur,this.handleTabBlur),r.off(Sa.CLEAR_ALL_FILTERS,this.handleClearAllFilters),r.emit(te.UNMOUNT,e??this)}handleTab(e){e!=null&&this.setState({title:D.getTitleFromTab(e)}),this.forceUpdate();var{onTab:t}=this.props;t(e)}handleTabClicked(e){var{onTabClicked:t}=this.props;t(e)}handleClearAllFilters(){var{onClearAllFilters:e}=this.props;e(...arguments)}handleFocus(e){var{componentPanel:t,glEventHub:r}=this.props;r.emit(te.FOCUS,t??this);var{onFocus:i}=this.props;i(e)}handleBlur(e){var{onBlur:t}=this.props;t(e)}handleHide(){var{onHide:e}=this.props;e(...arguments)}handleResize(){var{onResize:e}=this.props;e(...arguments)}handleSessionClosed(e){var{onSessionClose:t}=this.props;t(e)}handleSessionOpened(e,t){var{onSessionOpen:r}=this.props;r(e,t)}handleBeforeShow(){var{onBeforeShow:e}=this.props;e(...arguments)}handleShow(){var{onShow:e}=this.props;e(...arguments)}handleTabBlur(){var{onTabBlur:e}=this.props;e(...arguments)}handleTabFocus(){var{onTabFocus:e}=this.props;e(...arguments)}handleRenameCancel(){this.setState({showRenameDialog:!1})}handleShowRenameDialog(){this.setState({showRenameDialog:!0})}handleRenameSubmit(e){var{glContainer:t}=this.props;this.setState({showRenameDialog:!1,title:e});var r=D.getRootFromContainer(t),i=D.getComponentConfigFromContainer(t);k(i),D.renameComponent(r,i,e)}handleCopyPanel(){var{glContainer:e,glEventHub:t}=this.props,r=D.getRootFromContainer(e),i=D.getComponentConfigFromContainer(e);if(i==null){_b.error("Could not get component config from container",e);return}var o=D.cloneComponent(r,i);o!==null&&t.emit(te.CLONED,this,o)}getCloneAction(){return{title:"Copy Panel",order:10,group:ee.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:ee.groups.medium,action:this.handleShowRenameDialog}}render(){var{children:e,className:t,renderTabTooltip:r,glContainer:i,glEventHub:o,additionalActions:a,errorMessage:s,isLoaded:l,isLoading:d,isClonable:h,isRenamable:c}=this.props,{tab:f}=i,{showRenameDialog:v,title:p,isWithinPanel:g}=this.state;return u.jsxs("div",{className:X("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,u.jsx(hn,{errorMessage:s,isLoaded:l,isLoading:d}),!g&&f!=null&&Hr.createPortal(u.jsxs(u.Fragment,{children:[u.jsx(yb,{glContainer:i,glEventHub:o,additionalActions:this.getAdditionActions(a,h,c)}),c&&u.jsx(Hl,{isShown:v,value:p,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),r!=null&&u.jsx(Xt,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:r()})]}),f.element[0])]})}}Ei(Bl,"defaultProps",{className:"",onTab:()=>{},onTabClicked:()=>{},onClearAllFilters:()=>{},onFocus:()=>{},onBlur:()=>{},onHide:()=>{},onResize:()=>{},onSessionClose:()=>{},onSessionOpen:()=>{},onBeforeShow:()=>{},onShow:()=>{},onTabBlur:()=>{},onTabFocus:()=>{},renderTabTooltip:null,additionalActions:[],errorMessage:null,isLoading:!1,isLoaded:!0,isClonable:!1,isRenamable:!1});const dr=Bl,JC=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var Pb=Object.freeze({}),Tb=new Map,Gr=Object.freeze([]),eS=(n,e)=>{var t;return(t=Ne(n,e).columns)!==null&&t!==void 0?t:Gr},tS=(n,e)=>{var t;return(t=Ne(n,e).filterSets)!==null&&t!==void 0?t:Gr},nS=(n,e)=>{var t;return(t=Ne(n,e).filters)!==null&&t!==void 0?t:Gr},rS=(n,e)=>{var t;return(t=Ne(n,e).tableMap)!==null&&t!==void 0?t:Tb},iS=(n,e)=>Ne(n,e).isolatedLinkerPanelId,Wl=(n,e)=>{var t;return(t=Ne(n,e).links)!==null&&t!==void 0?t:Gr},oS=(n,e)=>Ne(n,e).columnSelectionValidator,aS=(n,e)=>{var t;return(t=Ne(n,e).consoleSettings)!==null&&t!==void 0?t:Pb},sS=(n,e)=>Ne(n,e).connection,ur=(n,e)=>Ne(n,e).sessionWrapper,lS=(n,e)=>t=>t(Qt(n,{connection:e})),dS=(n,e)=>t=>t(Qt(n,{sessionWrapper:e})),Ul=(n,e)=>t=>t(Qt(n,{links:e})),uS=(n,e)=>(t,r)=>{var i=Wl(r(),n),o=e.filter(a=>i.findIndex(s=>Qn(s.start,a.start)&&Qn(s.end,a.end))<0);return t(Ul(n,i.concat(o)))},hS=(n,e)=>(t,r)=>{var i=Wl(r(),n),o=i.filter(a=>!e.includes(a.id));return t(Ul(n,o))},cS=(n,e)=>t=>t(Qt(n,{isolatedLinkerPanelId:e})),mS=(n,e)=>t=>t(Qt(n,{columnSelectionValidator:e})),Ob=(n,e)=>t=>t(Qt(n,{consoleSettings:e})),fS=(n,e)=>t=>t(Qt(n,{filterSets:e}));function $r(n,e,t){return e=Ib(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ib(n){var e=Db(n,"string");return typeof e=="symbol"?e:String(e)}function Db(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Er=W.module("CommandHistoryPanel");class hr extends m.Component{static handleError(e){Er.error(e)}constructor(e){super(e),$r(this,"container",void 0),$r(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=j.createRef(),this.pending=new An;var{session:t,sessionId:r,language:i}=e;this.state={panelState:{},session:t,sessionId:r,language:i,contextActions:[{action:this.handleFocusHistory,shortcut:ke.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){var{glEventHub:e,session:t}=this.props;e.on(at.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(at.FOCUS_HISTORY,this.handleFocusHistory),this.pending.cancel()}handleFocusHistory(){this.container.current&&this.container.current.focus()}handleShow(){var e;(e=this.container.current)===null||e===void 0||e.restoreScrollPosition()}handleSessionOpened(e,t){var{language:r,sessionId:i}=t;this.setState({session:e,sessionId:i,language:r},()=>{this.loadTable()})}handleSessionClosed(){this.pending.cancel(),this.setState({session:void 0,language:void 0,table:void 0})}handleSendToNotebook(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{session:r,language:i}=this.state;if(Er.debug("handleSendToNotebook",r,e),!r){Er.error("Session is not connected.");return}var{glEventHub:o}=this.props;o.emit(t?de.CREATE_NOTEBOOK:de.SEND_TO_NOTEBOOK,r,i,e)}handleSendToConsole(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;Er.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(at.SEND_COMMAND,e,t,r)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:r}=this.state;k(t),k(r),this.pending.add(e.getTable(t,r,Date.now()),i=>i.close()).then(i=>{this.setState({table:i})}).catch(hr.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:r}=this.props,{language:i,contextActions:o,table:a}=this.state;return u.jsxs(dr,{className:"command-history-pane",componentPanel:this,glContainer:e,glEventHub:t,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[!a&&u.jsx("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),a&&i!=null&&u.jsxs(u.Fragment,{children:[u.jsx(Nf,{ref:this.container,language:i,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:a,commandHistoryStorage:r}),u.jsx(ee,{actions:o})]})]})}}$r(hr,"COMPONENT","CommandHistoryPanel");$r(hr,"TITLE","Command History");var xb=(n,e)=>{var t=ks(n),r=ur(n,e.localDashboardId),{session:i,config:o}=r??{},{type:a,id:s}=o??{};return{commandHistoryStorage:t,language:a,session:i,sessionId:s}},Mb=Nn(xb,null,null,{forwardRef:!0})(hr);const Nb=Mb;var Ab=m.createContext(null),cr=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin"});function Lb(n){return"DashboardPlugin"in n}function Fb(n){return"AuthPlugin"in n}function Rb(n){return"TablePlugin"in n}function vS(n){return Lb(n)||Fb(n)||Rb(n)}function kb(n){return"type"in n&&n.type===cr.DASHBOARD_PLUGIN}function Ui(n){return"type"in n&&n.type===cr.WIDGET_PLUGIN}function jb(n){return"type"in n&&n.type===cr.TABLE_PLUGIN}function $b(n){return"type"in n&&n.type===cr.AUTH_PLUGIN}function Vl(n){return"type"in n&&n.type===cr.THEME_PLUGIN}function gS(n){return kb(n)||$b(n)||jb(n)||Vl(n)||Ui(n)}var Hb=W.module("@deephaven/plugin.PluginUtils");function wa(n,e){return n==null||!Ui(n)?!1:[n.supportedTypes].flat().some(t=>t===e)}function Bb(n){var e=u.jsx(ue,{icon:ts});if(!Ui(n))return e;var{icon:t}=n;return t==null?e:m.isValidElement(t)?t:u.jsx(ue,{icon:t})}function pS(n){var e=[...n.entries()].filter(t=>Vl(t[1]));return Hb.debug("Getting theme data from plugins",e),e.map(t=>{var[r,i]=t,o=Array.isArray(i.themes)?i.themes:[i.themes];return o.map(a=>{var{name:s,baseTheme:l,styleContent:d}=a;return{baseThemeKey:"default-".concat(l??"dark"),themeKey:Bd(r,s),name:s,styleContent:d}})}).flat()}function bS(){return rr(Ab,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}function Ea(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function _r(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ea(Object(t),!0).forEach(function(r){ln(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ea(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ln(n,e,t){return e=Wb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wb(n){var e=Ub(n,"string");return typeof e=="symbol"?e:String(e)}function Ub(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Pr=W.module("ConsolePanel"),Vb=500,Kb=Object.freeze({consoleSettings:{},itemIds:[]});class qr extends m.PureComponent{constructor(e){super(e),ln(this,"consoleRef",void 0),ln(this,"objectSubscriptionCleanup",void 0),ln(this,"savePanelState",On(()=>{var{consoleSettings:a,itemIds:s}=this.state,l={consoleSettings:a,itemIds:[...s]};Pr.debug("Saving panel state",l),this.setState({panelState:l})},Vb)),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=j.createRef();var{panelState:t}=e,r=_r(_r({},Kb),t||{}),{consoleSettings:i,itemIds:o}=r;this.state={consoleSettings:i,itemIds:new Map(o),objectMap:new Map,error:void 0,panelState:r}}componentDidMount(){var{glEventHub:e}=this.props;this.closeDisconnectedPanels(),e.on(te.MOUNT,this.handlePanelMount),this.subscribeToFieldUpdates()}componentDidUpdate(e,t){var{consoleSettings:r,itemIds:i}=this.state;(t.consoleSettings!==r||t.itemIds!==i)&&this.savePanelState()}componentWillUnmount(){var e,{glEventHub:t}=this.props;this.savePanelState.flush(),t.off(te.MOUNT,this.handlePanelMount),(e=this.objectSubscriptionCleanup)===null||e===void 0||e.call(this)}subscribeToFieldUpdates(){var{sessionWrapper:e}=this.props;if(e!=null){var{session:t}=e;this.objectSubscriptionCleanup=t.subscribeToFieldUpdates(r=>{Pr.debug("Got updates",r),this.setState(i=>{var{objectMap:o}=i,{updated:a,created:s,removed:l}=r,d=[...a,...l],h=new Map(o);d.forEach(f=>{var{title:v}=f;v!==void 0&&h.delete(v)});var c=[...a,...s];return c.forEach(f=>{f.title!==void 0&&h.set(f.title,f)}),{objectMap:h}})})}}setItemId(e,t){this.setState(r=>{var{itemIds:i}=r,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,{itemIds:r}=this.state,i=r.get(e);return i==null&&t&&(i=At(),this.setItemId(e,i)),i}handleTabFocus(){var e;(e=this.consoleRef.current)===null||e===void 0||e.focus()}handlePanelMount(e){var t,r,i,{itemIds:o}=this.state,a=e==null||(t=e.props)===null||t===void 0?void 0:t.id,s=e==null||(r=e.props)===null||r===void 0||(i=r.metadata)===null||i===void 0?void 0:i.sourcePanelId;if(a&&s){var l=new Set(o.values());l.has(s)&&this.setItemId(a,a)}}handleFocusCommandHistory(){var{glEventHub:e}=this.props;e.emit(at.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{root:r}=this.context,i=e.title!=null?this.getItemId(e.title,!1):null;(t||i!=null&&D.getStackForRoot(r,{id:i},!1,!1,!1)!=null)&&this.openWidget(e)}handleCloseObject(e){var{title:t}=e;if(t!==void 0){var r=this.getItemId(t,!1);if(r!=null){var{glEventHub:i}=this.props;i.emit(te.CLOSE,r)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;Pr.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(at.SETTINGS_CHANGED,e)}openWidget(e){var{glEventHub:t,sessionWrapper:r}=this.props;k(r);var{config:i,session:o}=r,{title:a=e.name}=e;k(a);var s=this.getItemId(a),l={fetch:()=>o.getObject(e),panelId:s,widget:_r(_r({},rc(e)),{},{sessionId:i.id})};Pr.debug("openWidget",l),t.emit(te.OPEN,l)}addCommand(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;(t=this.consoleRef.current)===null||t===void 0||t.addCommand(e,r,i)}closeDisconnectedPanels(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{consoleSettings:t,itemIds:r}=this.state,{isClosePanelsOnDisconnectEnabled:i=!0}=t;if(!(!i&&!e)){var o=[...r.values()],{glEventHub:a}=this.props;o.forEach(s=>{a.emit(te.CLOSE,s)}),this.setState({itemIds:new Map})}}updateDimensions(){var e;(e=this.consoleRef.current)===null||e===void 0||e.updateDimensions()}supportsType(e){var{plugins:t}=this.props;return[...t.values()].some(r=>wa(r,e))}iconForType(e){var{plugins:t}=this.props,r=[...t.values()].find(i=>wa(i,e));return r!=null?Bb(r):u.jsx(Ec,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:r,sessionWrapper:i,timeZone:o,unzip:a}=this.props;if(i==null)return u.jsx(hn,{isLoading:!1,errorMessage:"Console is disabled."});var{consoleSettings:s,error:l,objectMap:d}=this.state,{config:h,session:c,connection:f,details:v={},dh:p}=i,{workerName:g,processInfoId:y}=v,{id:P,type:O}=h;return u.jsx(dr,{className:"iris-panel-console",componentPanel:this,glContainer:t,glEventHub:r,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,errorMessage:l!=null?"".concat(l):void 0,children:c!=null&&u.jsx(hf,{dh:p,ref:this.consoleRef,settings:s,session:c,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:O,statusBarChildren:u.jsxs(u.Fragment,{children:[u.jsx("div",{children:Ws.LANGUAGE_MAP.get(O)}),g!=null&&u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"•"}),g]}),y!=null&&u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"•"}),y,u.jsx("div",{children:"•"})]}),u.jsx(xv,{connection:f,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})]}),scope:P,timeZone:o,objectMap:d,unzip:a,supportsType:this.supportsType,iconForType:this.iconForType})})}}ln(qr,"COMPONENT","ConsolePanel");ln(qr,"TITLE","Console");ln(qr,"contextType",Np);var zb=(n,e)=>({commandHistoryStorage:ks(n),sessionWrapper:ur(n,e.localDashboardId),timeZone:uc(n),plugins:cc(n)}),Gb=Nn(zb,null,null,{forwardRef:!0})(qr);const li=Gb;function yS(n){return n==="file"||n==="directory"}function mt(n){return n.type==="directory"}function qb(n,e,t){return e=Zb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Zb(n){var e=Xb(n,"string");return typeof e=="symbol"?e:String(e)}function Xb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Yb extends Error{constructor(){super("No file exists at the path specified"),qb(this,"isFileNotFound",!0)}}const Vi=Yb;function _a(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Pa(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){_a(o,r,i,a,s,"next",l)}function s(l){_a(o,r,i,a,s,"throw",l)}a(void 0)})}}var Nt;(function(n){n.GROOVY="text/x-groovy",n.PLAIN_TEXT="text/plain",n.PYTHON="text/x-python",n.PYTHON_COMPILED="application/x-python-code",n.SCALA="text/x-scala",n.UNKNOWN=""})(Nt||(Nt={}));class pt{static fileExists(e,t){return Pa(function*(){try{return yield e.info(t),!0}catch(r){if(!(r instanceof Vi))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(!pt.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 Pa(function*(){for(var r=pt.getCopyFileName(t);yield pt.fileExists(e,r);)r=pt.getCopyFileName(r);return r})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return Nt.GROOVY;case"py":return Nt.PYTHON;case"pyc":return Nt.PYTHON_COMPILED;case"scala":return Nt.SCALA;case"txt":return Nt.PLAIN_TEXT;default:return Nt.UNKNOWN}}static getParent(e){if(!pt.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(!pt.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=pt.fileExtensionToString(t);return"".concat(i).concat(o)}static validateName(e){var t=[".",".."],r=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new qn("Name cannot be empty");if(t.includes(e))throw new qn('"'.concat(e,'" is a reserved name'));if(r.test(e)){var o,a;throw new qn('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=>pt.isPath(r));return e.filter(r=>!t.some(i=>r!==i&&r.startsWith(i)))}static removeRoot(e,t){if(e.length===0)return t;if(!t.startsWith(e))throw new Error("Filename ".concat(t," does not start with expected root ").concat(e));return t.substring(e.length)}static addRoot(e,t){return"".concat(e).concat(t)}}const H=pt;var Ki=26;function _i(n){return mt(n)?H.makePath(n.filename):H.getPath(n.filename)}function Ta(n,e){if(n.length===0||e==null)throw new Error("No items to move");var t=_i(e);if(n.some(r=>{var{filename:i}=r;return H.getPath(i)===t}))throw new Error("File already in the destination folder");if(n.some(r=>mt(r)&&t.startsWith(H.makePath(r.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:n,targetPath:t}}function Qb(n){if(mt(n))return n.isExpanded?Wd:Ud;var e=H.getMimeType(n.basename);switch(e){case Nt.PYTHON:return Kd;default:return Vd}}function Pi(n){var e,{children:t,draggedItems:r,isDragInProgress:i,isDropTargetValid:o,isSelected:a,item:s,itemIndex:l,dropTargetItem:d,onDragStart:h,onDragOver:c,onDragEnd:f,onDrop:v}=n,p=(e=r?.some(N=>N.id===s.id))!==null&&e!==void 0?e:!1,g=_i(s),y=i&&d?_i(d):null,P=i&&o&&mt(s)&&y===g,O=i&&o&&y===g,_=i&&!o&&y===g,R=Qb(s),U=H.getDepth(s.filename),Q=Array(U).fill(null).map((N,B)=>u.jsx("span",{className:"file-list-depth-line"},B));return u.jsxs("div",{className:X("d-flex w-100 align-items-center","file-list-item",{"is-dragged":p,"is-exact-drop-target":P,"is-in-drop-target":O,"is-invalid-drop-target":_,"is-selected":a}),onDragStart:N=>h(l,N),onDragOver:N=>c(l,N),onDragEnd:N=>f(l,N),onDrop:N=>v(l,N),draggable:!0,role:"presentation","aria-label":s.basename,children:[Q," ",u.jsx(ue,{icon:R,className:"item-icon",fixedWidth:!0})," ",u.jsx("span",{className:"truncation-wrapper",children:t??u.jsxs(u.Fragment,{children:[s.basename,u.jsx(Xt,{children:s.basename})]})})]})}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 Tr(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){Jb(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 Jb(n,e,t){return e=ey(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ey(n){var e=ty(n,"string");return typeof e=="symbol"?e:String(e)}function ty(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Le=W.module("FileList"),ny=500,Ia="item-list-scroll-pane";function ry(n){var{isMultiSelect:e=!1,table:t,onFocusChange:r=()=>{},onMove:i,onSelect:o,onSelectionChange:a=()=>{},renderItem:s=Pi,rowHeight:l=Ki,overscanCount:d=Qe.DEFAULT_OVERSCAN}=n,[h,c]=m.useState(()=>({items:[],offset:0,itemCount:0})),[f,v]=m.useState({top:0,bottom:0}),[p,g]=m.useState(),[y,P]=m.useState(),[O,_]=m.useState(),[R,U]=m.useState([]),Q=m.useRef(),N=m.useRef(null),B=m.useRef(null),$=m.useCallback(I=>{if(I.length===0||h==null)return[];for(var Z=[],re=0;re<I.length;re+=1)for(var he=I[re],Ae=he[0];Ae<=he[1];Ae+=1)Ae>=h.offset&&Ae<h.offset+h.items.length&&Z.push(h.items[Ae-h.offset]);return Z},[h]),Y=m.useCallback(I=>{var Z=$([[I,I]]);if(Z.length>0)return Z[0]},[$]),ne=m.useCallback(()=>{var I=xt.count(R);if(I===0)return null;if(I===1){var Z=R[0][0],re=Y(Z);if(re!=null)return re.filename}return"".concat(I," items")},[Y,R]),F=m.useCallback(I=>{if(!(!y||!p)){Le.debug("dropItems",y,"to",I);try{var{files:Z,targetPath:re}=Ta(y,p);if(i?.(Z,re),I!=null){var he;U([[I,I]]),(he=N.current)===null||he===void 0||he.focusItem(I)}}catch(Ae){Le.error("Unable to complete move",Ae)}}},[y,p,i]),q=m.useCallback((I,Z)=>{var re=h.items[I-h.offset];re!==void 0&&(Le.debug("handleItemClick",re),o(re,Z),mt(re)&&t?.setExpanded(re.filename,!re.isExpanded))},[h,o,t]),K=m.useCallback((I,Z)=>{var re,he;Le.debug2("handleItemDragStart",I,R);var Ae=R;xt.isSelected(R,I)||(Ae=[[I,I]],U(Ae)),P($(Ae)),(re=N.current)===null||re===void 0||re.resetMouseState();var Et=document.createElement("div"),_t=document.createElement("div");_t.className="dnd-placeholder-content",_t.innerText=(he=ne())!==null&&he!==void 0?he:"",Et.appendChild(_t),Et.className="file-list-dnd-placeholder",document.body.appendChild(Et),Z.dataTransfer.setDragImage(Et,0,0),Z.dataTransfer.effectAllowed="move",_(Et)},[ne,$,R]),A=m.useCallback((I,Z)=>{Z.preventDefault(),Le.debug2("handleItemDragOver",Z),g(Y(I))},[Y]),V=m.useCallback((I,Z)=>{Le.debug("handleItemDragEnd",I),O?.remove(),P(void 0),g(void 0),_(void 0)},[O]),z=m.useCallback((I,Z)=>{F(I)},[F]),me=m.useCallback(()=>{Le.debug2("handleItemDragExit"),g(void 0)},[]),je=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains(Ia)&&(I.preventDefault(),Le.debug2("handleListDragOver",I),g({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),Ie=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains(Ia)&&(Le.debug("handleListDrop"),F())},[F]),b=m.useCallback(function(I){var Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(Le.debug2("handleSelectionChange",I),Z===!0||I!==R){U(I);var re=$(I);a(re)}},[$,a,R]),w=m.useCallback(I=>{if(Le.debug2("handleFocusChange",I),I!=null){var[Z]=$([[I,I]]);r(Z)}else r();Q.current=I},[$,r]),T=m.useCallback((I,Z)=>{Le.debug("handleViewportChange",I,Z),(I!==f.top||Z!==f.bottom)&&v({top:I,bottom:Z})},[f]),G=m.useMemo(()=>{if(!y||!p)return!1;try{return Ta(y,p),Le.debug("handleValidateDropTarget true"),!0}catch{return Le.debug("handleValidateDropTarget false"),!1}},[y,p]),{focusedPath:J}=n;m.useEffect(()=>{J!==void 0&&(J==="/"?t.collapseAll():(t.setExpanded(J,!1),t.setExpanded(J,!0)))},[t,J]),m.useEffect(function(){Le.debug("updating table viewport",f),t?.setViewport({top:Math.max(0,f.top-d),bottom:f.bottom+d})},[d,t,f]),m.useEffect(function(){var Z=t.onUpdate(re=>{c({items:re.items.map(he=>Tr(Tr({},he),{},{itemName:he.basename})),offset:re.offset,itemCount:t.size})});return()=>{Z()}},[t]),m.useEffect(function(){Q.current!=null&&w(Q.current),R.length>0&&b(R,!0)},[h,w,b,R]),m.useEffect(function(){if(p!=null&&mt(p)&&p.filename!=="/"){var Z=setTimeout(()=>{p.isExpanded||t?.setExpanded(p.filename,!0)},ny);return()=>clearTimeout(Z)}},[p,t]);var et=m.useCallback(I=>s(Tr(Tr({},I),{},{isDragInProgress:y!=null,dropTargetItem:p,draggedItems:y,isDropTargetValid:G,onDragStart:K,onDragEnd:V,onDragOver:A,onDragExit:me,onDrop:z})),[V,me,A,K,z,y,p,G,s]);return u.jsx("div",{ref:B,className:X("file-list",{"is-dragging":y!=null}),onDragOver:je,onDrop:Ie,children:u.jsx(Qe,{ref:N,items:h.items,itemCount:h.itemCount,offset:h.offset,onFocusChange:w,onSelect:q,onSelectionChange:b,onViewportChange:T,selectedRanges:R,renderItem:et,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var iy={name:"File Explorer",DELETE:ce.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[x.DELETE],macShortcut:[L.CMD,x.BACKSPACE]}),RENAME:ce.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[x.ENTER],macShortcut:[x.ENTER]})};const Da={FILE_EXPLORER:iy};var xa=W.module("FileListItemEditor"),oy=()=>Promise.resolve();function ay(n){var{item:e,onCancel:t,onSubmit:r,validate:i=oy}=n,o=m.useRef(null),[a,s]=m.useState(e.basename),[l,d]=m.useState(),[h,c]=m.useState(Promise.resolve()),f=m.useCallback(()=>{var O;(O=o.current)===null||O===void 0||O.focus()},[o]),v=m.useCallback(O=>O.stopPropagation(),[]),p=m.useCallback(()=>{h.then(()=>{r(a)}).catch(O=>xa.info("Unable to validate name",O))},[r,a,h]);m.useEffect(function(){var _=Ee.makeCancelable(i(a));return _.then(()=>d(void 0)).catch(R=>{Ee.isCanceled(R)||d(R)}),c(_),()=>_.cancel()},[i,a]),m.useEffect(function(){f()},[f]);var g=m.useCallback(()=>{xa.debug2("handleBlur"),p()},[p]),y=m.useCallback(O=>{var{value:_}=O.target;s(_)},[]),P=m.useCallback(O=>{O.stopPropagation();var{key:_}=O;switch(_){case"Enter":{p();break}case"Escape":{t();break}}},[t,p]);return u.jsxs("div",{className:"file-list-item-editor",children:[u.jsx("input",{type:"text",className:X("form-control file-list-item-editor-input",{"is-invalid":l}),value:a,ref:o,onBlur:g,onKeyDown:P,onChange:y,onClick:v,onDoubleClick:v,onMouseDown:v}),l&&u.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}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 di(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){sy(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 sy(n,e,t){return e=ly(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ly(n){var e=dy(n,"string");return typeof e=="symbol"?e:String(e)}function dy(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Kl(n){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:r=!1,onCreateFile:i,onCreateFolder:o,onCopy:a,onDelete:s,onMove:l,onRename:d,onSelect:h,onSelectionChange:c,table:f,rowHeight:v=Ki,validateRename:p=()=>Promise.resolve()}=n,[g,y]=m.useState(),[P,O]=m.useState([]),[_,R]=m.useState(),U=m.useCallback(z=>{O(z),c?.(z)},[c]),Q=m.useCallback(z=>{R(z)},[]),N=m.useCallback(()=>{_&&a?.(_)},[_,a]),B=m.useCallback(()=>{P.length>0&&s?.(P)},[s,P]),$=m.useCallback(()=>{i?.()},[i]),Y=m.useCallback(()=>{_&&o?.(H.getPath(_.filename))},[_,o]),ne=m.useCallback(()=>{_&&y(_)},[_]),F=m.useCallback(()=>{y(void 0)},[]),q=m.useCallback(z=>{g&&(d?.(g,z),y(void 0))},[d,g]),K=m.useMemo(()=>{if(g)return[];var z=[];return i&&z.push({title:"New File",description:"Create new file",action:$,group:ee.groups.medium}),o&&z.push({title:"New Folder",description:"Create new folder",action:Y,group:ee.groups.medium}),a&&z.push({title:"Copy File",description:"Copy the selected file",action:N,group:ee.groups.low,disabled:_==null||mt(_)}),s&&P.length>0&&z.push({title:"Delete",description:"Delete",shortcut:Da.FILE_EXPLORER.DELETE,action:B,group:ee.groups.low}),d&&z.push({title:"Rename",description:"Rename",shortcut:Da.FILE_EXPLORER.RENAME,action:ne,group:ee.groups.low,disabled:_==null}),z},[N,B,$,Y,ne,_,a,i,o,s,d,P,g]),A=m.useCallback(z=>(k(g),p(g,z)),[g,p]),V=m.useCallback(z=>{var{item:me}=z;return g&&g.filename===me.filename?u.jsx(Pi,di(di({},z),{},{children:u.jsx(ay,{item:me,validate:A,onSubmit:q,onCancel:F})})):u.jsx(Pi,di({},z))},[F,q,g,A]);return u.jsxs("div",{className:"file-list-container",children:[f!=null&&u.jsx(ry,{onMove:l,onSelect:h,onSelectionChange:U,onFocusChange:Q,renderItem:V,rowHeight:v,table:f,isMultiSelect:e,focusedPath:t}),r&&u.jsx(ee,{actions:K})]})}Kl.displayName="FileListContainer";function Na(n,e,t){return e=uy(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function uy(n){var e=hy(n,"string");return typeof e=="symbol"?e:String(e)}function hy(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class cy extends qn{constructor(e){super("Name already exists"),Na(this,"isExistingFile",!0),Na(this,"info",void 0),this.info=e}}const Ir=cy;function Aa(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function La(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)})}}var gt=W.module("FileExplorer");function zi(n){var{storage:e,isMultiSelect:t=!1,focusedPath:r,onCopy:i=()=>{},onDelete:o=()=>{},onRename:a=()=>{},onCreateFile:s=()=>{},onCreateFolder:l=()=>{},onSelect:d,onSelectionChange:h,rowHeight:c=Ki}=n,[f,v]=m.useState([]),[p,g]=m.useState();m.useEffect(function(){var q;function K(){return A.apply(this,arguments)}function A(){return A=La(function*(){gt.debug("initTable"),q=Ee.makeCancelable(e.getTable(),V=>V.close());try{g(yield q)}catch(V){Ee.isCanceled(V)||gt.error("Unable to initialize table",V)}}),A.apply(this,arguments)}return K(),()=>{q.cancel()}},[e]);var y=m.useCallback(F=>{Ee.isCanceled(F)||gt.error(F)},[]),P=m.useCallback(()=>{gt.debug("handleCreateFile"),s()},[s]),O=m.useCallback(()=>{gt.debug("handleCreateFolder"),l()},[l]),_=m.useCallback(F=>{gt.debug("handleCopyFile",F.filename),i(F)},[i]),R=m.useCallback(F=>{gt.debug("handleDelete, pending confirmation",F),v(F)},[]),U=m.useCallback(()=>{gt.debug("handleDeleteConfirm",f),f.forEach(F=>e.deleteFile(mt(F)?H.makePath(F.filename):F.filename)),o(f),v([])},[f,o,e]),Q=m.useCallback(()=>{gt.debug("handleDeleteCancel"),v([])},[]),N=m.useCallback((F,q)=>{var K=H.reducePaths(F.map(A=>mt(A)?H.makePath(A.filename):A.filename));K.forEach(A=>{var V=H.isPath(A)?"".concat(q).concat(H.getBaseName(A.substring(0,A.length-1)),"/"):"".concat(q).concat(H.getBaseName(A));e.moveFile(A,V).then(()=>{a(A,V)}).catch(y)})},[y,a,e]),B=m.useCallback((F,q)=>{var K=F.filename,A=mt(F);A&&!K.endsWith("/")&&(K="".concat(K,"/"));var V="".concat(H.getParent(K)).concat(q);A&&!V.endsWith("/")&&(V="".concat(V,"/")),gt.debug2("handleRename",K,V),e.moveFile(K,V).catch(y),a(K,V)},[y,a,e]),$=m.useCallback(function(){var F=La(function*(q,K){if(K!==q.basename){H.validateName(K);var A="".concat(H.getPath(q.filename)).concat(K);try{var V=yield e.info(A);throw new Ir(V)}catch(z){if(!(z instanceof Vi))throw z}}});return function(q,K){return F.apply(this,arguments)}}(),[e]),Y=f.length>0,ne=m.useMemo(()=>f.length===1?'Are you sure you want to delete "'.concat(f[0].filename,'"?'):"Are you sure you want to delete the selected files?",[f]);return u.jsxs("div",{className:"file-explorer",children:[p&&u.jsx(Kl,{isMultiSelect:t,focusedPath:r,showContextMenu:!0,onCopy:_,onCreateFolder:O,onCreateFile:P,onMove:N,onDelete:R,onRename:B,onSelect:d,onSelectionChange:h,rowHeight:c,table:p,validateRename:$}),u.jsx(un,{isOpen:Y,headerText:ne,bodyText:"You cannot undo this action.",onCancel:Q,onConfirm:U,confirmButtonText:"Delete"})]})}zi.displayName="FileExplorer";function Fa(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function my(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Fa(o,r,i,a,s,"next",l)}function s(l){Fa(o,r,i,a,s,"throw",l)}a(void 0)})}}function Vt(n,e,t){return e=fy(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fy(n){var e=vy(n,"string");return typeof e=="symbol"?e:String(e)}function vy(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var tn=W.module("NewItemModal");class dn extends m.PureComponent{static getValidationMessage(e){return e instanceof Ir&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){Ee.isCanceled(e)||tn.error(e)}constructor(e){super(e),Vt(this,"inputRef",j.createRef()),Vt(this,"cancelableValidatePromise",void 0),Vt(this,"cancelableExistingItemPromise",void 0),Vt(this,"pending",new An),Vt(this,"pathMap",new Map),Vt(this,"isInitialLoad",!0),this.handleModalSubmit=this.handleModalSubmit.bind(this),this.handleModalOpened=this.handleModalOpened.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleChange=this.handleChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleValidationError=this.handleValidationError.bind(this),this.handleOverwriteCancel=this.handleOverwriteCancel.bind(this),this.handleOverwriteConfirm=this.handleOverwriteConfirm.bind(this),this.handleExtensionChangeCancel=this.handleExtensionChangeCancel.bind(this),this.handleExtensionChangeConfirm=this.handleExtensionChangeConfirm.bind(this),this.handleBreadcrumbSelect=this.handleBreadcrumbSelect.bind(this);var{defaultValue:t}=e,r=H.hasPath(t)?H.getPath(t):"/";this.state={isSubmitting:!1,path:r,prevExtension:H.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:H.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:r}=this.props,{isOpen:i}=e,{value:o,path:a}=this.state;!i&&r&&(this.resetValue(),this.isInitialLoad=!0),i&&r&&(!this.isInitialLoad&&(a!==t.path||o!==t.value)&&this.updateValidationStatus(a,o),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){var{defaultValue:e}=this.props,t=H.hasPath(e)?H.getPath(e):"/";this.setState({path:t,value:H.getBaseName(e),validationError:void 0,prevExtension:H.getExtension(e),isSubmitting:!1})}getValidationPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=Ee.makeCancelable(this.validateName(e,t,r)),this.cancelableValidatePromise}validateName(e,t,r){var i=this;return my(function*(){H.validateName(t);var{defaultValue:o,storage:a}=i.props;if(r){var s="".concat(e).concat(t);if(s!==o)try{var l=yield a.info(s);throw new Ir(l)}catch(d){if(!(d instanceof Vi))throw d}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(dn.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var{value:t}=e.target;this.setState({value:t})}handleSelect(e){if(tn.debug("handleSelect",e),e.type==="directory")this.setState({path:H.makePath(e.filename)});else{var t=e.basename,r=H.getPath(e.filename);this.setState({value:t,path:r},()=>{this.focusRenameInput()})}}handleKeyDown(e){var{key:t}=e;switch(e.stopPropagation(),t){case"Enter":{e.preventDefault(),this.submitModal();break}case"Escape":{e.preventDefault();var{onCancel:r}=this.props;r();break}}}handleValidationError(e){if(!(e instanceof qn))throw e;tn.debug("Validation error",e),this.setState({validationError:e})}handleOverwriteCancel(){this.setState({showOverwriteModal:!1,isSubmitting:!1})}handleOverwriteConfirm(){this.setState({showOverwriteModal:!1});var{onSubmit:e}=this.props,{path:t,value:r}=this.state;tn.debug("handleOverwriteConfirm",t,r),e("".concat(t).concat(r),!0)}handleExtensionChangeCancel(){tn.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:r}=e,i=H.replaceExtension(t,r);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){tn.debug("handleExtensionChangeConfirm"),this.setState({showExtensionChangeModal:!1}),this.submitModal(!0)}focusRenameInput(){var e=this.inputRef.current;if(e){var{type:t}=this.props,{value:r}=e,i=t==="directory"?r.length:r.lastIndexOf(".");e.focus(),e.setSelectionRange(0,i>0?i:r.length)}}submitModal(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.setState(t=>{var{prevExtension:r,value:i,path:o}=t,{notifyOnExtensionChange:a,type:s}=this.props;tn.debug("submitModal",r,i);var l=H.getExtension(i);return a&&!e&&r!==null&&r!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(o,i,!0).then(d=>{var{onSubmit:h}=this.props;h("".concat(o).concat(i))}).catch(d=>{if(d instanceof Ir&&s!=="directory"&&d.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw d}).catch(d=>{throw Ee.isCanceled(d)&&this.setState({isSubmitting:!1}),d}).catch(this.handleValidationError).catch(dn.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,"/"),u.jsxs(j.Fragment,{children:[u.jsx(se,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(o),"aria-label":i===0?"Home":void 0,icon:i===0?u.jsx(ue,{icon:zd,transform:"right-1.6"}):void 0,tooltip:i===0?"Home":void 0,children:r}),"/"]},o)})}render(){var{storage:e,isOpen:t,onCancel:r,placeholder:i,title:o,type:a}=this.props,{isSubmitting:s,path:l,showExtensionChangeModal:d,showOverwriteModal:h,validationError:c,value:f,prevExtension:v,newExtension:p}=this.state,g=a==="directory",y=H.fileExtensionToString(v),P=H.fileExtensionToString(p),O=g?"Create":"Save",_=g?"New folder name":"Save file as";return u.jsxs(u.Fragment,{children:[u.jsxs(Xa,{isOpen:t,toggle:r,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[u.jsx(Ya,{toggle:r,children:o}),u.jsx(Qa,{children:u.jsx("form",{children:u.jsxs("div",{className:"d-flex flex-column new-file-modal-content",children:[u.jsxs("div",{className:"flex-grow-0 mb-4",children:[u.jsx("label",{htmlFor:"file-name-input",children:_}),u.jsx("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:X("form-control",{"is-invalid":c}),value:f,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),c&&u.jsx("div",{className:"invalid-feedback",children:dn.getValidationMessage(c)})]}),u.jsxs("div",{className:"flex-grow-0",children:[u.jsx("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),u.jsx("div",{className:"flex-grow-1 file-explorer-container",children:u.jsx(zi,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),u.jsxs(_s,{children:[u.jsx(se,{kind:"secondary",onClick:r,children:"Cancel"}),u.jsx(se,{kind:"primary",disabled:s,onClick:this.handleModalSubmit,children:O})]})]}),u.jsx(un,{isOpen:h,headerText:"Confirm overwrite",bodyText:"File with this name already exists, are you sure you want to overwrite it?",onCancel:this.handleOverwriteCancel,onConfirm:this.handleOverwriteConfirm,cancelButtonText:"Cancel",confirmButtonText:"Overwrite"}),u.jsx(un,{isOpen:d,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(y,'" to "').concat(P,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(y,'"'),confirmButtonText:'Use "'.concat(P,'"')})]})}}Vt(dn,"propTypes",{isOpen:S.bool,title:S.string.isRequired,defaultValue:S.string,type:S.oneOf(["file","directory"]).isRequired,onSubmit:S.func,onCancel:S.func,placeholder:S.string,storage:S.shape({}).isRequired,notifyOnExtensionChange:S.bool});Vt(dn,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(n,e)=>{},onCancel:()=>{}});const zl=dn;function gy(n){var{createFile:e,createFolder:t,onSearchChange:r,defaultSearchText:i=""}=n;return u.jsxs("div",{className:"file-explorer-toolbar",children:[u.jsxs("div",{className:"file-explorer-toolbar-buttons",children:[u.jsx(se,{kind:"ghost",icon:us,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),u.jsx(se,{kind:"ghost",icon:Gd,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),r&&u.jsx("div",{className:"file-explorer-toolbar-search",children:u.jsx(Mh,{value:i,onChange:r,placeholder:"Search by name"})})]})}function Ra(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function py(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 Gl(n,e,t){return e=by(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function by(n){var e=yy(n,"string");return typeof e=="symbol"?e:String(e)}function yy(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var nn=W.module("FileExplorerPanel"),Cy=(n,e)=>{var t=js(n),r=ur(n,e.localDashboardId),{session:i,config:o}=r??{},a=o?.type;return{fileStorage:t,language:a,session:i}},Sy=Nn(Cy,null,null,{forwardRef:!0});function wy(n){var e=n;return e!=null&&typeof e.button=="number"}class Mn extends j.Component{static handleError(e){nn.error(e)}static isFocusEvent(e){return wy(e)?e.detail>=2:!0}constructor(e){super(e),this.handleFileSelect=this.handleFileSelect.bind(this),this.handleCopyFile=this.handleCopyFile.bind(this),this.handleCreateFile=this.handleCreateFile.bind(this),this.handleCreateDirectory=this.handleCreateDirectory.bind(this),this.handleCreateDirectoryCancel=this.handleCreateDirectoryCancel.bind(this),this.handleCreateDirectorySubmit=this.handleCreateDirectorySubmit.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleRename=this.handleRename.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this);var{session:t,language:r}=e;this.state={isShown:!1,language:r,session:t,showCreateFolder:!1,focusedFilePath:"/"}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){var{glEventHub:e}=this.props,{session:t,language:r}=this.state,i={language:r,value:""};nn.debug("handleCreateFile",t,r,i),e.emit(de.CREATE_NOTEBOOK,t,r,i)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){nn.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){nn.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(Mn.handleError)}handleCopyFile(e){var t=this;return py(function*(){var{fileStorage:r}=t.props;if(mt(e)){nn.error("Invalid item in handleCopyItem",e);return}var i=yield H.getUniqueCopyFileName(r,e.filename);yield r.copyFile(e.filename,i)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(r=>{t.emit(de.CLOSE_FILE,{id:r.filename,itemName:r.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=H.makePath(e[0].filename):t=H.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(nn.debug("fileSelect",e),e.type!=="directory"){var r=Mn.isFocusEvent(t),i={id:e.filename,itemName:e.filename},{glEventHub:o}=this.props,{session:a,language:s}=this.state,l={value:null,language:s};o.emit(de.SELECT_NOTEBOOK,a,s,l,i,r)}}handleRename(e,t){var{glEventHub:r}=this.props;nn.debug("handleRename",e,t),r.emit(de.RENAME_FILE,e,t)}handleSessionOpened(e,t){var{language:r}=t;this.setState({session:e,language:r})}handleSessionClosed(){this.setState({session:void 0,language:void 0})}handleShow(){this.setState({isShown:!0})}isHidden(){var{glContainer:e}=this.props,{isHidden:t}=e;return t}render(){var{fileStorage:e,glContainer:t,glEventHub:r}=this.props,{isShown:i,showCreateFolder:o,focusedFilePath:a}=this.state;return u.jsxs(dr,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:r,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[u.jsx(gy,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&u.jsx(zi,{isMultiSelect:!0,storage:e,onCopy:this.handleCopyFile,onCreateFile:this.handleCreateFile,onCreateFolder:this.handleCreateDirectory,onDelete:this.handleDelete,onRename:this.handleRename,onSelect:this.handleFileSelect,onSelectionChange:this.handleSelectionChange}),u.jsx(zl,{isOpen:o,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:a})]})}}Gl(Mn,"COMPONENT","FileExplorerPanel");Gl(Mn,"TITLE","File Explorer");var Ey=Sy(Mn);const _y=Ey;function tr(n,e,t){return e=Py(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Py(n){var e=Ty(n,"string");return typeof e=="symbol"?e:String(e)}function Ty(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ka=W.module("LogPanel");class Zr extends m.PureComponent{constructor(e){super(e),tr(this,"isBottomVisible",void 0),tr(this,"logView",void 0),this.handleResize=this.handleResize.bind(this),this.handleShow=this.handleShow.bind(this),this.handleHide=this.handleHide.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.isBottomVisible=!0,this.logView=null;var{session:t}=this.props;this.state={session:t}}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions(),this.logView&&(this.logView.triggerFindWidget(),this.isBottomVisible&&this.logView.scrollToBottom())}handleHide(){this.logView&&(this.isBottomVisible=this.logView.isBottomVisible())}handleSessionOpened(e){ka.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){ka.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){var{glContainer:e,glEventHub:t}=this.props,{session:r}=this.state;return u.jsxs(dr,{componentPanel:this,glContainer:e,glEventHub:t,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[r==null&&u.jsx("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),r!=null&&u.jsx(kf,{session:r,ref:i=>{this.logView=i}})]})}}tr(Zr,"defaultProps",{session:null});tr(Zr,"COMPONENT","LogPanel");tr(Zr,"TITLE","Log");var Oy=(n,e)=>{var t;return{session:(t=ur(n,e.localDashboardId))===null||t===void 0?void 0:t.session}},Iy=Nn(Oy,null,null,{forwardRef:!0})(Zr);const Dy=Iy;function ja(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function $a(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ja(o,r,i,a,s,"next",l)}function s(l){ja(o,r,i,a,s,"throw",l)}a(void 0)})}}function Ha(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 He(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ha(Object(t),!0).forEach(function(r){Me(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ha(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Me(n,e,t){return e=xy(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xy(n){var e=My(n,"string");return typeof e=="symbol"?e:String(e)}function My(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ny=m.lazy(()=>hs(()=>import("./MarkdownNotebook-bffb6319.js"),["./MarkdownNotebook-bffb6319.js","./vendor-3e5e4180.js","./helpers-de833af9.js","./vendor-7509d17c.css","./index-1e463a44.js","./monaco-b5248072.js","./monaco-f18fde03.css","./index-7d08f7c0.css","./mathjax-d42af1a5.js","./MarkdownNotebook-9207e775.css"],import.meta.url)),le=W.module("NotebookPanel"),Ba=400;class Pe extends m.Component{static handleError(e){Ee.isCanceled(e)||le.error(e)}static unsavedNotebookCount(){return document.querySelectorAll(".".concat(Pe.UNSAVED_INDICATOR_CLASS_NAME,".").concat(Pe.UNSAVED_STATUS_CLASS_NAME)).length}static languageFromFileName(e){var t=H.getExtension(e).toLowerCase();switch(t){case"py":case"python":return"python";case"groovy":return"groovy";case"scala":return"scala";default:return null}}constructor(e){super(e),Me(this,"pending",void 0),Me(this,"debouncedSavePanelState",void 0),Me(this,"debouncedLoad",void 0),Me(this,"notebook",void 0),Me(this,"tabTitleElement",void 0),Me(this,"tabInitOnce",void 0),Me(this,"editor",void 0),Me(this,"getSettings",St((f,v)=>He(He({},f),{},{minimap:{enabled:v}}))),Me(this,"getOverflowActions",St((f,v)=>[{title:"Find",icon:Xd,action:this.handleFind,group:ee.groups.high,shortcut:ke.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:Ja,action:this.handleCopy,group:ee.groups.medium,order:20},{title:"Rename File",icon:Yd,action:this.handleShowRename,group:ee.groups.medium,order:30},{title:"Delete File",icon:as,action:this.handleDelete,group:ee.groups.medium,order:40},{title:"Show Minimap",icon:f?Gn:void 0,action:this.handleMinimapChange,group:ee.groups.low,shortcut:ke.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:v?Gn:void 0,action:this.handleWordWrapChange,group:ee.groups.low,shortcut:ke.NOTEBOOK.WORDWRAP,order:30}])),this.handleCloseCancel=this.handleCloseCancel.bind(this),this.handleCloseDiscard=this.handleCloseDiscard.bind(this),this.handleCloseSave=this.handleCloseSave.bind(this),this.handleCopy=this.handleCopy.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleDeleteConfirm=this.handleDeleteConfirm.bind(this),this.handleDeleteCancel=this.handleDeleteCancel.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleEditorChange=this.handleEditorChange.bind(this),this.handleFind=this.handleFind.bind(this),this.handleMinimapChange=this.handleMinimapChange.bind(this),this.handleWordWrapChange=this.handleWordWrapChange.bind(this),this.handleLinkClick=this.handleLinkClick.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handlePanelDropped=this.handlePanelDropped.bind(this),this.handleRenameFile=this.handleRenameFile.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRunCommand=this.handleRunCommand.bind(this),this.handleRunAll=this.handleRunAll.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.handleSave=this.handleSave.bind(this),this.handleSaveAsCancel=this.handleSaveAsCancel.bind(this),this.handleSaveAsSubmit=this.handleSaveAsSubmit.bind(this),this.handleSaveError=this.handleSaveError.bind(this),this.handleSaveSuccess=this.handleSaveSuccess.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleShowRename=this.handleShowRename.bind(this),this.handleTab=this.handleTab.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabClick=this.handleTabClick.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleTransformLinkUri=this.handleTransformLinkUri.bind(this),this.handleOverwrite=this.handleOverwrite.bind(this),this.handlePreviewPromotion=this.handlePreviewPromotion.bind(this),this.getDropdownOverflowActions=this.getDropdownOverflowActions.bind(this),this.pending=new An,this.debouncedSavePanelState=On(this.savePanelState.bind(this),Ba),this.debouncedLoad=On(this.load.bind(this),Ba),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;var{isDashboardActive:t,session:r,sessionLanguage:i,panelState:o}=e,a={value:"",language:"",wordWrap:"off"},s=null,{isPreview:l}=e;o!=null&&({fileMetadata:s=s,isPreview:l=l,settings:a=a}=o);var d=s!=null&&H.hasPath(s.itemName),h=d===!0&&a.value!=null||!d&&a.value!=null&&a.value.length>0,c=h?1:0;this.state={error:void 0,isDashboardActive:t,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:c,fileMetadata:s,settings:a,session:r,sessionLanguage:i,panelState:{fileMetadata:s,settings:a},showCloseModal:!1,showDeleteModal:!1,showSaveAsModal:!1,scriptCode:""},le.debug("constructor",e,this.state)}componentDidMount(){var{glContainer:e,glEventHub:t}=this.props,{tab:r}=e;r!=null&&this.initTab(r),this.initNotebookContent(),t.on(de.RENAME_FILE,this.handleRenameFile),t.on(te.DROPPED,this.handlePanelDropped),e.on(de.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion)}componentDidUpdate(e,t){var{isPreview:r,settings:i}=this.state,{wordWrap:o}=i,{defaultNotebookSettings:a}=this.props;r!==t.isPreview&&this.setPreviewStatus(),o!==t.settings.wordWrap&&(this.updateEditorWordWrap(),this.debouncedSavePanelState()),a.isMinimapEnabled!==e.defaultNotebookSettings.isMinimapEnabled&&this.updateEditorMinimap()}componentWillUnmount(){this.debouncedSavePanelState.flush(),this.pending.cancel();var{glEventHub:e,glContainer:t}=this.props,{fileMetadata:r,isPreview:i}=this.state;e.off(de.RENAME_FILE,this.handleRenameFile),e.off(te.DROPPED,this.handlePanelDropped),t.off(de.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion),e.emit(de.UNREGISTER_FILE,r,i)}initTab(e){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(e)}initTabCloseOverride(){var{glContainer:e}=this.props;e.beforeClose(t=>{if(t?.force===!0)return!0;var{changeCount:r,savedChangeCount:i}=this.state;return r!==i?(this.setState({showCloseModal:!0}),!1):!0})}initTabClasses(e){var t=e.element.get(0);k(t);var r=t.querySelector(".lm_title");this.tabTitleElement=r,r?.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){var{changeCount:e,savedChangeCount:t,settings:r}=this.state,{value:i}=r;if(e!==t&&this.notebook){var o=this.notebook.getValue();return o??i}return i}initNotebookContent(){var{fileMetadata:e,settings:t,isPreview:r}=this.state;if(e&&e.id){le.debug("Init content from file"),this.registerFileMetadata(e,r),this.load();return}if(t.value!=null){le.debug("Use content passed in the settings prop"),this.handleLoadSuccess();return}this.handleLoadError(new Error("Missing file metadata"))}closeFileTabById(e){var{glEventHub:t}=this.props;t.emit(de.CLOSE_FILE,{id:e})}registerFileMetadata(e,t){var{glEventHub:r,metadata:i}=this.props,{id:o}=i;r.emit(de.REGISTER_FILE,o,e,t)}renameTab(e,t){var{glEventHub:r}=this.props;r.emit(de.RENAME,e,t)}load(){var{fileMetadata:e,settings:t}=this.state;k(e);var{id:r}=e,{fileStorage:i}=this.props;this.pending.add(i.loadFile(r)).then(o=>{var a;le.debug("Loaded file",o);var{filename:s}=o,{itemName:l}=this.state;if(s!==l){var{metadata:d}=this.props,{id:h}=d;this.renameTab(h,H.getBaseName(s))}var c=He(He({},t),{},{language:(a=Pe.languageFromFileName(s))!==null&&a!==void 0?a:""});t.value==null&&(c.value=o.content),t.wordWrap===void 0&&(t.wordWrap="off"),this.setState({fileMetadata:{id:s,itemName:s},settings:c}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){var{fileMetadata:e}=this.state;if(e&&H.hasPath(e.itemName)){var t=this.getNotebookValue();return t!==void 0?(this.saveContent(e.itemName,t),!0):!1}return this.setState({showSaveAsModal:!0}),!1}saveContent(e,t){le.debug("saveContent",e,t),this.updateSavedChangeCount();var{fileStorage:r}=this.props;this.pending.add(r.saveFile({filename:e,content:t,basename:e})).then(this.handleSaveSuccess).catch(this.handleSaveError)}updateSavedChangeCount(){this.setState(e=>{var{changeCount:t}=e;return{savedChangeCount:t}})}setPreviewStatus(){if(this.tabTitleElement){var{isPreview:e}=this.state;le.debug("setPreviewStatus",this.tabTitleElement,e),e?this.tabTitleElement.classList.add("is-preview"):this.tabTitleElement.classList.remove("is-preview")}}handlePreviewPromotion(){this.removePreviewStatus()}savePanelState(){this.setState(e=>{var{changeCount:t,savedChangeCount:r,fileMetadata:i,isPreview:o,settings:a}=e,s=this.getNotebookValue(),l=t!==r?s:void 0,d=He(He({},a),{},{value:s}),h=He(He({},a),{},{value:l}),c={settings:h,fileMetadata:i,isPreview:o};return le.debug("Saving panel state",c),{settings:d,panelState:c}})}handleCloseDiscard(){this.setState({showCloseModal:!1});var{glContainer:e}=this.props;e.close({force:!0})}handleCloseSave(){if(this.setState({showCloseModal:!1}),this.save()){var{glContainer:e}=this.props;e.close({force:!0})}}handleCloseCancel(){this.setState({showCloseModal:!1})}handleOverwrite(e){var{glEventHub:t}=this.props;t.emit(de.CLOSE_FILE,{id:e,itemName:e},{force:!0}),this.focus()}handleCopy(){var e=this;return $a(function*(){var{fileStorage:t,glEventHub:r,session:i}=e.props,{fileMetadata:o,settings:a}=e.state;k(o);var{language:s}=a,{itemName:l}=o,d=yield H.getUniqueCopyFileName(t,l);le.debug("handleCopy",o,l,d),yield t.copyFile(l,d);var h={id:d,itemName:d},c={value:null,language:s};r.emit(de.SELECT_NOTEBOOK,i,s,c,h,!0)})()}handleDelete(){le.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var e=this;return $a(function*(){var{fileStorage:t,glContainer:r,glEventHub:i}=e.props,{fileMetadata:o}=e.state;le.debug("handleDeleteConfirm",o?.itemName),e.setState({showDeleteModal:!1}),o&&(H.hasPath(o.itemName)&&(yield H.fileExists(t,o.itemName))?(i.emit(de.CLOSE_FILE,o,{force:!0}),t.deleteFile(o.itemName)):r.close({force:!0}))})()}handleDeleteCancel(){this.setState({showDeleteModal:!1})}handleEditorInitialized(e){this.editor=e}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(e){le.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(t=>{var{changeCount:r,savedChangeCount:i}=t,{isUndoing:o,isRedoing:a}=e;return o?{changeCount:r-1,savedChangeCount:i}:!a&&r<i?{changeCount:r+1,savedChangeCount:0}:{changeCount:r+1,savedChangeCount:i}}),this.debouncedSavePanelState()}handleFind(){this.notebook&&this.notebook.toggleFind()}updateEditorMinimap(){if(this.editor){var{defaultNotebookSettings:e}=this.props;this.editor.updateOptions({minimap:{enabled:e.isMinimapEnabled}})}}handleMinimapChange(){var e,{defaultNotebookSettings:t,updateSettings:r}=this.props,i={defaultNotebookSettings:{isMinimapEnabled:!((e=t.isMinimapEnabled)!==null&&e!==void 0&&e)}};r(i)}updateEditorWordWrap(){if(this.editor){var{settings:e}=this.state,{wordWrap:t}=e;this.editor.updateOptions({wordWrap:t})}}handleWordWrapChange(){this.editor&&this.setState(e=>{var{settings:t}=e,r=t.wordWrap==="on"?"off":"on";return{settings:He(He({},t),{},{wordWrap:r})}})}handleLinkClick(e){var{notebooksUrl:t,session:r,sessionLanguage:i}=this.props,{href:o}=e.currentTarget;if(!(!o||!o.startsWith(t))){e.stopPropagation(),e.preventDefault();var a="/".concat(o.substring(t.length)).replace(/%20/g," ");if(a==="/"){le.debug("Ignoring invalid notebook link",a);return}le.debug("Notebook link clicked, opening",a);var{glEventHub:s}=this.props,l={value:null,language:i},d={id:a,itemName:a};s.emit(de.SELECT_NOTEBOOK,r,i,l,d)}}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(e){var t=e;Ee.isCanceled(t)||(Ee.isTimedOut(t)&&(t=new Error("File not found.")),le.error(t),this.setState({error:t,isLoading:!1}))}handleSave(){le.debug("handleSave"),this.save()}handleSaveSuccess(e){var t,{fileStorage:r}=this.props,i={id:e.filename,itemName:e.filename},o=(t=Pe.languageFromFileName(e.filename))!==null&&t!==void 0?t:"";this.setState(a=>{var{fileMetadata:s}=a,l=He(He({},a.settings),{},{language:o});return le.debug("handleSaveSuccess",i,s,l),s&&H.hasPath(s.itemName)&&s.itemName!==i.itemName&&(le.debug("handleSaveSuccess deleting old file",s.itemName),r.deleteFile(s.itemName).catch(Pe.handleError)),{fileMetadata:i,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(i,!1)}handleSaveError(e){Ee.isCanceled(e)||(this.setState({savedChangeCount:0}),le.error(e))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;r&&this.handleOverwrite(e),le.debug("handleSaveAsSubmit",e);var{fileMetadata:i}=this.state;if(i){var{itemName:o}=i,a=(t=this.getNotebookValue())!==null&&t!==void 0?t:"";if(this.setState({showSaveAsModal:!1}),H.getBaseName(o)!==H.getBaseName(e)){var{metadata:s}=this.props,{id:l}=s;this.renameTab(l,H.getBaseName(e))}this.saveContent(e,a)}}handleRenameFile(e,t,r){var{fileMetadata:i,panelState:o}=this.state,{glContainer:a}=this.props;if(i?.itemName==="/".concat(t)&&r&&JSON.stringify(o)!==JSON.stringify(r)){a.close();return}i&&i.id===e&&(this.setState({fileMetadata:{id:t,itemName:t}}),this.debouncedSavePanelState())}handleResize(){var e;(e=this.notebook)===null||e===void 0||e.updateDimensions()}handleRunCommand(e){this.runCommand(e)}handleRunAll(){var e;if(!this.notebook){le.error("Editor is not initialized.");return}this.runCommand((e=this.notebook.getValue())!==null&&e!==void 0?e:void 0)}handleRunSelected(){if(!this.notebook){le.error("Editor is not initialized.");return}this.runCommand(this.notebook.getSelectedCommand())}handleSessionOpened(e,t){var{language:r}=t;this.setState({session:e,sessionLanguage:r})}handleSessionClosed(){this.setState({session:void 0,sessionLanguage:void 0})}handleShow(){var e;le.debug("handleShow"),(e=this.notebook)===null||e===void 0||e.updateDimensions()}handlePanelDropped(e){var{metadata:{id:t}}=this.props;e===t&&this.forceUpdate()}handleShowRename(){this.setState({showSaveAsModal:!0})}handleTab(e){le.debug("NotebookPanel tab event",e),this.initTab(e)}handleTabFocus(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];le.debug("handleTabFocus",...t);var{glContainer:i}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!i.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){le.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handleTabClick(e){le.debug("handle NotebookPanel tab click"),this.focus(),e.detail===2&&this.removePreviewStatus()}handleTransformLinkUri(e){var{notebooksUrl:t}=this.props,{fileMetadata:r}=this.state;if(e.endsWith("/"))return e;if(e.startsWith("/"))return"".concat(t).concat(e.substring(1));var i=r?.itemName;if(i===void 0)return e;i.charAt(0)==="/"&&(i=i.substring(1));var o=new URL(i,t);return new URL(e,o).href}focus(){requestAnimationFrame(()=>{this.notebook&&this.notebook.focus()})}createNotebook(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{glEventHub:i}=this.props,{session:o,sessionLanguage:a,settings:s}=this.state,l=He(He({},s),{},{language:t,value:r}),d={id:null,itemName:e};le.debug("handleCreateNotebook",o,a,l,d),i.emit(de.CREATE_NOTEBOOK,o,a,l,d)}runCommand(e){if(e===void 0||e===""){le.debug("Ignoring empty command.");return}this.removePreviewStatus();var{glEventHub:t}=this.props;t.emit(at.SEND_COMMAND,e,!1,!0)}removePreviewStatus(){this.setState(e=>{var{isPreview:t}=e;if(t){var{fileMetadata:r}=this.state;return r&&this.registerFileMetadata(r,!1),{isPreview:!1}}return null})}getDropdownOverflowActions(){var e,t,{defaultNotebookSettings:r}=this.props,{settings:i}=this.state;return this.getOverflowActions((e=r.isMinimapEnabled)!==null&&e!==void 0?e:!1,this.getSettings(i,(t=r.isMinimapEnabled)!==null&&t!==void 0?t:!1).wordWrap==="on")}render(){var e,t,r,{fileStorage:i,glContainer:o,glContainer:{tab:a},glEventHub:s,defaultNotebookSettings:l}=this.props,{changeCount:d,savedChangeCount:h,error:c,isDashboardActive:f,isLoaded:v,isLoading:p,isPreview:g,fileMetadata:y,session:P,sessionLanguage:O,settings:_,showCloseModal:R,showDeleteModal:U,showSaveAsModal:Q}=this.state,N=f&&!o.isHidden&&!g,B=(e=y?.itemName)!==null&&e!==void 0?e:Pe.DEFAULT_NAME,$=B.endsWith(".md"),Y=y?.id!=null,ne=this.getSettings(_,(t=l.isMinimapEnabled)!==null&&t!==void 0?t:!1),F=P!=null,q=O===ne.language,K=!v||!F||!q,A=!v,V=[{action:this.handleSave,shortcut:Gt.SAVE},{action:this.handleMinimapChange,shortcut:ke.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:ke.NOTEBOOK.WORDWRAP}],z=gi.getDisabledRunTooltip(F,q,"Notebook extension","Run"),me=gi.getDisabledRunTooltip(F,q,"Notebook extension","Run Selected"),je=[{title:Y?"Rename":"Save As…",order:10,group:ee.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:ee.groups.high,order:20}],Ie=a?.element.find(".lm_title_before").get(0);return u.jsxs(u.Fragment,{children:[Ie!=null&&Hr.createPortal(u.jsx("span",{className:X(Pe.UNSAVED_INDICATOR_CLASS_NAME,{[Pe.UNSAVED_STATUS_CLASS_NAME]:d!==h})}),Ie),u.jsxs(dr,{className:"notebook-container",componentPanel:this,glContainer:o,glEventHub:s,onTab:this.handleTab,onResize:this.handleResize,onShow:this.handleShow,onTabClicked:this.handleTabClick,onTabFocus:this.handleTabFocus,onTabBlur:this.handleTabBlur,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,additionalActions:je,renderTabTooltip:()=>B,children:[!$&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"notebook-toolbar",children:[u.jsxs("span",{children:[u.jsx(se,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:K,icon:u.jsx(ue,{icon:ds,transform:"grow-4"}),tooltip:"Run ".concat(ke.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),z!=null&&u.jsx(Xt,{children:z})]}),u.jsxs("span",{children:[u.jsx(se,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:K,icon:u.jsx(ue,{icon:qd,transform:"grow-4"}),tooltip:"Run Selected ".concat(ke.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),me!=null&&u.jsx(Xt,{children:me})]}),u.jsx(se,{kind:"ghost",className:"mr-auto",disabled:A,onClick:this.handleSave,icon:Zd,tooltip:"Save ".concat(Gt.SAVE.getDisplayText()),"aria-label":"Save"}),u.jsx(se,{kind:"ghost",className:"btn-overflow",disabled:A,icon:ls,tooltip:"More Actions...",onClick:()=>{},children:u.jsx(Xn,{actions:this.getDropdownOverflowActions,popperOptions:Pe.POPPER_OPTIONS})})]}),u.jsx(Cf,{isLoaded:v,isLoading:p,error:c,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:P,sessionLanguage:O,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:ne,focusOnMount:N,ref:b=>{this.notebook=b}})]}),$&&u.jsx(m.Suspense,{fallback:u.jsx(hn,{}),children:u.jsx(Ny,{content:(r=ne.value)!==null&&r!==void 0?r:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri})}),u.jsx(zl,{isOpen:Q,type:"file",defaultValue:B,title:Y?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:i}),u.jsx(un,{isOpen:U,headerText:'Are you sure you want to delete "'.concat(B,'"?'),bodyText:"You cannot undo this action.",onCancel:this.handleDeleteCancel,onConfirm:this.handleDeleteConfirm,confirmButtonText:"Delete"}),u.jsx(un,{isOpen:R,headerText:"Do you want to save the changes you made to ".concat(B,"?"),bodyText:"Your changes will be lost if you don't save them.",onCancel:this.handleCloseCancel,onDiscard:this.handleCloseDiscard,onConfirm:this.handleCloseSave,discardButtonText:"Discard Changes",confirmButtonText:"Save"}),u.jsx(ee,{actions:V})]})]})}}Me(Pe,"COMPONENT","NotebookPanel");Me(Pe,"POPPER_OPTIONS",{placement:"bottom-end"});Me(Pe,"DEFAULT_NAME","Untitled");Me(Pe,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");Me(Pe,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");Me(Pe,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,defaultNotebookSettings:{isMinimapEnabled:!0}});var Ay=(n,e)=>{var t=js(n),r=hc(n),i=ur(n,e.localDashboardId),{session:o,config:a}=i??{},{type:s}=a??{};return{fileStorage:t,defaultNotebookSettings:r,session:o,sessionLanguage:s}},Ly=Nn(Ay,{updateSettings:bc},null,{forwardRef:!0})(Pe);const rn=Ly;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 Ua(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){Fy(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 Fy(n,e,t){return e=Ry(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ry(n){var e=ky(n,"string");return typeof e=="symbol"?e:String(e)}function ky(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ye=W.module("ConsolePlugin");function Va(n){return n.notebook!==void 0}function jy(n){wp(n)}function CS(n){jy(n);var{id:e,hydrateConsole:t,layout:r,panelManager:i,registerComponent:o,notebooksUrl:a}=n,s=m.useRef(0),[l,d]=m.useState(new Map),[h,c]=m.useState(new Map),f=Oi(),v=m.useCallback(()=>i.getLastUsedPanelOfType(li),[i]),p=m.useCallback((b,w)=>{d(T=>new Map(T.set(b,w)))},[d]),g=m.useCallback(b=>{d(w=>(w.delete(b),new Map(w)))},[d]),y=m.useCallback((b,w)=>{c(T=>new Map(T.set(b,w)))},[c]),P=m.useCallback(b=>{c(w=>(w.delete(b),new Map(w)))},[c]),O=m.useCallback(function(b){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,T=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,G=b&&b.trim();if(!G)ye.info("Ignoring empty code");else{var J=v();if(!J||!(J instanceof li.WrappedComponent)){ye.error("Console panel not found");return}ye.debug("Send command: ",b,w,T),J.addCommand(b,w,T)}},[v]),_=m.useCallback(b=>{f(Ob(e,b))},[f,e]),R=m.useCallback(b=>{var{language:w}=b,T=w==="python"?"py":w,G=null;return T==null?(ye.debug("No extension for language",w),G="Untitled-".concat(s.current)):G="Untitled-".concat(s.current,".").concat(T),s.current+=1,G},[]),U=m.useCallback(function(b){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{id:T}=b;if(T!=null&&l.has(T))return l.get(T);if(T!=null&&h.has(T))return h.get(T);if(w)return At()},[l,h]),Q=m.useCallback((b,w)=>{D.renameComponent(r.root,{id:b},w)},[r.root]),N=m.useCallback((b,w)=>{ye.debug("Rename file panel",b,w);var T;if(l.has(b)&&(T=l.get(b),g(b),T!=null&&p(w,T)),h.has(b)&&(T=h.get(b),P(b),T!=null&&y(w,T)),T===void 0){ye.debug2("File ".concat(b," isn't open, no need to rename the tab"));return}Q(T,H.getBaseName(w))},[l,h,Q,p,y,g,P]),B=m.useCallback(b=>{var w=U(b,!1);if(w==null){ye.error("Could not find panel id for file metadata",b);return}D.activateTab(r.root,{id:w})},[U,r.root]),$=m.useCallback((b,w,T)=>{if(ye.debug("registerFilePanel",b,w,T),w==null||w.id==null){ye.debug("Ignore empty file id",w);return}var{id:G}=w;if(T){y(G,b);return}if(l.has(G)){var J=l.get(G);if(b===J){ye.debug("Update tab title for file ".concat(G));var{itemName:et}=w;N(G,et)}else ye.error("File ".concat(G," already associated with a different tab ").concat(J));return}p(G,b),h.has(G)&&P(G)},[l,h,N,p,y,P]),Y=m.useCallback((b,w)=>{if(ye.debug("unregisterFileTab",b,w),b==null||b.id==null){ye.debug("Ignore empty file id",b);return}var{id:T}=b;if(w){P(T);return}g(T)},[g,P]),ne=m.useCallback((b,w)=>{ye.debug("closeFilePanel",b);var{id:T}=b,G=null,J=!1;if(l.has(T))G=l.get(T);else if(h.has(T))G=h.get(T),J=!0;else{ye.debug("File ".concat(T," isn't open, ignore close event"));return}Y(b,J),D.closeComponent(r.root,{id:G},w)},[r.root,l,h,Y]),F=m.useCallback(b=>{var{itemName:w}=b;return H.getBaseName(w)},[]),q=m.useCallback(b=>{var{id:w}=b;return ye.debug("fileIsOpen",b,w,l),w!=null&&l.has(w)},[l]),K=m.useCallback(b=>{var{id:w}=b;return ye.debug("fileIsOpenAsPreview",b,w,h),w!=null&&h.has(w)},[h]),A=m.useCallback(b=>{if(b!=null){var w=i.getOpenedPanelById(b);w&&Va(w)&&w.focus()}},[i]),V=m.useCallback(b=>{var{id:w,settings:T,fileMetadata:G,session:J,sessionLanguage:et,isPreview:I=!1}=b,Z={settings:T,fileMetadata:G},re=F(G);return{type:"react-component",component:rn.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:w},session:J,sessionLanguage:et,panelState:Z,isPreview:I,notebooksUrl:a},title:re,id:w}},[F,e,a]),z=m.useCallback(function(b,w,T){var G=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{id:null,itemName:R(T)},J=U(G);if(q(G)&&J!=null){ye.debug("File is already open, focus panel"),B(G),A(J);return}var et=D.getStackForComponentTypes(r.root,[rn.COMPONENT]),I=V({id:J,settings:T,fileMetadata:G,session:b,sessionLanguage:w});ye.debug("createNotebook",I,l),D.openComponentInStack(et,I)},[q,A,R,U,r.root,V,l,B]),me=m.useCallback(function(b,w,T,G){var J=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;ye.debug("selectNotebook",G,J);var et=q(G),I=K(G),[Z]=[...h.values()],re=!J,he=re&&Z?Z:U(G);if(he==null||he==="")throw new Error("Unable to retrieve or create panelId for metadata",G);if(et||I)B(G);else{var Ae=D.getStackForComponentTypes(r.root,[rn.COMPONENT]),Et=V({id:he,settings:T,fileMetadata:G,session:b,sessionLanguage:w,isPreview:re});D.openComponentInStack(Ae,Et)}if(I&&J){var _t=G.id,Yr=D.getStackForConfig(r.root,{component:rn.COMPONENT,id:he}),Rn=D.getContentItemInStack(Yr,{component:rn.COMPONENT,id:he});Rn&&Ze(Rn)&&(Rn.container.emit(de.PROMOTE_FROM_PREVIEW),P(_t),p(_t,he))}J&&A(he)},[B,q,K,A,U,r.root,V,h,P,p]),je=m.useCallback(function(b,w){var T=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},G=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,J=i.getLastUsedPanelOfType(rn);J&&Va(J)?T!=null&&T.value!=null&&J.notebook!=null&&J.notebook.append(T.value):G&&z(b,w,T)},[z,i]),Ie=m.useCallback((b,w)=>Mp.hydrate(Ua(Ua({},b),{},{notebooksUrl:a}),w),[a]);return $n(o,li,t),$n(o,Nb),$n(o,_y),$n(o,Dy),$n(o,rn,Ie),xe(r.eventHub,at.SEND_COMMAND,O),xe(r.eventHub,at.SETTINGS_CHANGED,_),xe(r.eventHub,de.CLOSE_FILE,ne),xe(r.eventHub,de.CREATE_NOTEBOOK,z),xe(r.eventHub,de.SELECT_NOTEBOOK,me),xe(r.eventHub,de.RENAME,Q),xe(r.eventHub,de.RENAME_FILE,N),xe(r.eventHub,de.SEND_TO_NOTEBOOK,je),xe(r.eventHub,de.REGISTER_FILE,$),xe(r.eventHub,de.UNREGISTER_FILE,Y),null}function Xr(n,e,t){return e=$y(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $y(n){var e=Hy(n,"string");return typeof e=="symbol"?e:String(e)}function Hy(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class mr{}Xr(mr,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");Xr(mr,"INPUT_FILTER","ControlType.INPUT_FILTER");Xr(mr,"MARKDOWN","ControlType.MARKDOWN");Xr(mr,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");const SS=mr;export{Ne as $,pC as A,se as B,ch as C,fs as D,Es as E,ol as F,Ve as G,Gt as H,st as I,Qy as J,x as K,SS as L,JC as M,Xn as N,Jn as O,Ee as P,Ec as Q,Ni as R,ec as S,E as T,PC as U,Ll as V,GC as W,Qt as X,pc as Y,bC as Z,Hp as _,ve as a,we as a$,cc as a0,sS as a1,ur as a2,iC as a3,$s as a4,Mp as a5,ru as a6,cs as a7,XC as a8,de as a9,ku as aA,Ss as aB,Cs as aC,Lu as aD,Au as aE,xt as aF,Qe as aG,Tn as aH,hh as aI,Mh as aJ,$h as aK,Fh as aL,L as aM,_s as aN,Br as aO,ws as aP,Yy as aQ,Hh as aR,nc as aS,Fs as aT,Ls as aU,eC as aV,tC as aW,nC as aX,gs as aY,Bf as aZ,Uf as a_,Sa as aa,te as ab,QC as ac,rn as ad,rc as ae,Vy as af,xi as ag,CS as ah,ee as ai,un as aj,bS as ak,TC as al,CC as am,OC as an,EC as ao,_C as ap,lS as aq,dS as ar,yC as as,wC as at,Hs as au,SC as av,Xe as aw,Zy as ax,Nu as ay,rr as az,ht as b,Il as b$,Xf as b0,dv as b1,ev as b2,Ue as b3,IC as b4,rl as b5,il as b6,MC as b7,LC as b8,DC as b9,No as bA,nf as bB,af as bC,mi as bD,vf as bE,xv as bF,kf as bG,ae as bH,ke as bI,Cf as bJ,gi as bK,zy as bL,D as bM,$n as bN,xe as bO,zC as bP,si as bQ,Jp as bR,Qp as bS,Fp as bT,Np as bU,Tp as bV,Fl as bW,Wi as bX,Ml as bY,wp as bZ,xp as b_,xC as ba,NC as bb,iv as bc,FC as bd,RC as be,uv as bf,hv as bg,jC as bh,kC as bi,al as bj,$C as bk,Tv as bl,Cv as bm,Ov as bn,hf as bo,Bs as bp,Nf as bq,Of as br,nl as bs,Pf as bt,Ws as bu,jc as bv,Fc as bw,Us as bx,Mc as by,Ic as bz,C as c,Gy as c$,VC as c0,KC as c1,Al as c2,Dl as c3,Sp as c4,kr as c5,kp as c6,BC as c7,UC as c8,qC as c9,Dy as cA,Nb as cB,_y as cC,vs as cD,Ky as cE,dr as cF,ps as cG,Jv as cH,cS as cI,An as cJ,rS as cK,iS as cL,oS as cM,nS as cN,Wl as cO,eS as cP,fS as cQ,tS as cR,mt as cS,Ul as cT,uS as cU,hS as cV,mS as cW,at as cX,wr as cY,aS as cZ,Ob as c_,YC as ca,Kp as cb,Ui as cc,cr as cd,Ab as ce,Bb as cf,pS as cg,$b as ch,kb as ci,Fb as cj,Lb as ck,vS as cl,Rb as cm,gS as cn,jb as co,Vl as cp,wa as cq,qy as cr,ui as cs,Hg as ct,ZC as cu,Cp as cv,H as cw,Vi as cx,yS as cy,li as cz,ys as d,Xy as d0,Qr as d1,AC as d2,qn as d3,bc as e,sC as f,aC as g,lC as h,rC as i,uC as j,hC as k,cC as l,mC as m,fC as n,uc as o,oC as p,pe as q,ce as r,Xt as s,Ye as t,tc as u,vC as v,Jy as w,dC as x,WC as y,gC as z};
22
+ //# sourceMappingURL=ControlType-5a46b9ec.js.map