@deephaven/code-studio 1.7.1 → 1.7.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/assets/{AppRoot-CNhNUhkS.js → AppRoot-CXGPiLCM.js} +4 -4
- package/build/assets/{AppRoot-CNhNUhkS.js.map → AppRoot-CXGPiLCM.js.map} +1 -1
- package/build/assets/{Chart-3Ra0gsWu.js → Chart-WP_xQpc2.js} +2 -2
- package/build/assets/{Chart-3Ra0gsWu.js.map → Chart-WP_xQpc2.js.map} +1 -1
- package/build/assets/{ControlType-D6O14O4V.js → ControlType-FC3HoMsR.js} +4 -4
- package/build/assets/{ControlType-D6O14O4V.js.map → ControlType-FC3HoMsR.js.map} +1 -1
- package/build/assets/{FontBootstrap-I2w5NdCr.js → FontBootstrap-C1f9wma1.js} +2 -2
- package/build/assets/{FontBootstrap-I2w5NdCr.js.map → FontBootstrap-C1f9wma1.js.map} +1 -1
- package/build/assets/{FormatterUtils-CLS-I992.js → FormatterUtils-1XkIgt1n.js} +2 -2
- package/build/assets/{FormatterUtils-CLS-I992.js.map → FormatterUtils-1XkIgt1n.js.map} +1 -1
- package/build/assets/{Grid-C8Ab062Y.js → Grid-D_SXGtNm.js} +2 -2
- package/build/assets/{Grid-C8Ab062Y.js.map → Grid-D_SXGtNm.js.map} +1 -1
- package/build/assets/{GridTokenMouseHandler-aMWGusnN.js → GridTokenMouseHandler-Bw3mhhm-.js} +2 -2
- package/build/assets/{GridTokenMouseHandler-aMWGusnN.js.map → GridTokenMouseHandler-Bw3mhhm-.js.map} +1 -1
- package/build/assets/IrisGrid-rYNH6T-a.js +3 -0
- package/build/assets/IrisGrid-rYNH6T-a.js.map +1 -0
- package/build/assets/{IrisGridModel-DqsDFiwJ.js → IrisGridModel-CNCNyN6j.js} +3 -3
- package/build/assets/{IrisGridModel-DqsDFiwJ.js.map → IrisGridModel-CNCNyN6j.js.map} +1 -1
- package/build/assets/{IrisGridShortcuts-B5JJa2_P.js → IrisGridShortcuts-Cf0TBYXa.js} +2 -2
- package/build/assets/{IrisGridShortcuts-B5JJa2_P.js.map → IrisGridShortcuts-Cf0TBYXa.js.map} +1 -1
- package/build/assets/{IrisGridThemeProvider-D01JmaJT.js → IrisGridThemeProvider-C5GvPzDd.js} +2 -2
- package/build/assets/{IrisGridThemeProvider-D01JmaJT.js.map → IrisGridThemeProvider-C5GvPzDd.js.map} +1 -1
- package/build/assets/{LocalWorkspaceStorage-C_BT0Hxh.js → LocalWorkspaceStorage-DkMvQcC2.js} +2 -2
- package/build/assets/{LocalWorkspaceStorage-C_BT0Hxh.js.map → LocalWorkspaceStorage-DkMvQcC2.js.map} +1 -1
- package/build/assets/{MarkdownEditor-DSOUgIyA.js → MarkdownEditor-CE4fGSaM.js} +2 -2
- package/build/assets/{MarkdownEditor-DSOUgIyA.js.map → MarkdownEditor-CE4fGSaM.js.map} +1 -1
- package/build/assets/{MarkdownNotebook-8EvnYtx2.js → MarkdownNotebook-brf_5ixw.js} +2 -2
- package/build/assets/{MarkdownNotebook-8EvnYtx2.js.map → MarkdownNotebook-brf_5ixw.js.map} +1 -1
- package/build/assets/{MissingPartitionError-1wyspnDf.js → MissingPartitionError-ZcuoviIf.js} +2 -2
- package/build/assets/{MissingPartitionError-1wyspnDf.js.map → MissingPartitionError-ZcuoviIf.js.map} +1 -1
- package/build/assets/{StyleGuideRoot-DK01A7zt.js → StyleGuideRoot-CIEgYW64.js} +2 -2
- package/build/assets/{StyleGuideRoot-DK01A7zt.js.map → StyleGuideRoot-CIEgYW64.js.map} +1 -1
- package/build/assets/{index-C78oYqio.js → index-CEVzUeKL.js} +2 -2
- package/build/assets/{index-C78oYqio.js.map → index-CEVzUeKL.js.map} +1 -1
- package/build/assets/{index-BA2F4BL4.js → index-CKZ1MUPY.js} +3 -3
- package/build/assets/{index-BA2F4BL4.js.map → index-CKZ1MUPY.js.map} +1 -1
- package/build/assets/{index-DnDDOUJ_.js → index-DRJmhk_7.js} +7 -7
- package/build/assets/index-DRJmhk_7.js.map +1 -0
- package/build/index.html +1 -1
- package/package.json +31 -31
- package/build/assets/IrisGrid-DfRbLOE0.js +0 -3
- package/build/assets/IrisGrid-DfRbLOE0.js.map +0 -1
- package/build/assets/index-DnDDOUJ_.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Plot-B3JS6Jui.js","./Plotly-BpejLJpj.js","./plotly-D5TAZRdQ.js","./helpers-BosuxZz1.js","./vendor-BtbW3F2w.js","./vendor-vyKkiikc.css","./MarkdownNotebook-
|
|
2
|
-
import{r as m,_ as ln,bA as Ir,U as R,bE as Xl,I as u,K as za,L as Y,R as Dr,a1 as S,bF as Zl,M as fe,H as Et,bG as Yl,G as Ga,a0 as bn,bH as Ql,bI as Jl,bJ as ed,bD as Vn,bK as td,bz as $i,bL as nd,bM as rd,ac as qt,au as Hi,bN as Hn,bO as M,bP as Bi,ae as qa,a3 as bi,bQ as id,Z as In}from"./vendor-BtbW3F2w.js";import{aC as Xa,L as K,aZ as Za,W as Ya,ai as od,aj as ad,ah as sd,ar as ld,ad as dd,aw as ud,$ as hd,M as Qa,b as Ja,c as es,aK as cd,a_ as md,a$ as ts,b0 as ns,b1 as vd,b2 as fd,N as un,aA as pd,b3 as gd,b4 as bd,b5 as yd,b6 as Cd,b7 as Sd,b8 as wd,b9 as Ed,ba as _d,bb as Pd,bc as Td,D as rs,aY as Od,aV as is,aW as xd,a3 as os,k as Id,e as $,d as ni,bd as Dd,au as as,be as Wi,bf as kd,bg as Md,bh as Nd,bi as jd,f as ss,aO as ls,bj as Ad,bk as ds,bl as wn,aU as Ld,bm as Rd,H as Ui,bn as us,q as Vi,bo as hs,bp as Fd,K as $d,ak as Hd,bq as Bd,C as Wd,al as Ud,br as Vd,bs as Kd,bt as zd,bu as Gd,bv as qd,bw as Xd,bx as Zd,aQ as Yd,by as Qd,bz as Jd}from"./index-BA2F4BL4.js";import{e as De,M as Ki,b as eu,l as it,R as cs,K as rt,c as Xt,d as zi,U as tu,_ as ms}from"./monaco-CsU3t3B1.js";var nu=Object.freeze([]),Cy=new Map,vs=()=>{};function Sy(r){return Array.isArray(r)?r:[r]}function Vr(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return e.filter(n=>n!=null)}function ru(r,e,t){return(e=iu(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function iu(r){var e=ou(r,"string");return typeof e=="symbol"?e:e+""}function ou(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Gi extends Error{constructor(){super(...arguments),ru(this,"isCanceled",!0)}}function au(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=su(r,e);t.forEach(n=>{r[n]=r[n].bind(r)})}function su(r,e){for(var t=new Set,n=r,i=0;n!=null&&n!==Object.prototype&&(i<=1||e);){for(var o of Object.getOwnPropertyNames(n)){var a;o!=="constructor"&&typeof((a=Object.getOwnPropertyDescriptor(n,o))===null||a===void 0?void 0:a.value)=="function"&&t.add(o)}n=Object.getPrototypeOf(n),i+=1}return[...t.keys()]}function lu(r,e,t){return(e=du(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function du(r){var e=uu(r,"string");return typeof e=="symbol"?e:e+""}function uu(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class hu extends Error{constructor(){super(...arguments),lu(this,"isClipboardPermissionsDeniedError",!0)}}function cu(r,e,t){return(e=mu(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mu(r){var e=vu(r,"string");return typeof e=="symbol"?e:e+""}function vu(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Kr extends Error{constructor(){super(...arguments),cu(this,"isClipboardUnavailableError",!0)}}function fu(r,e,t){return(e=pu(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function pu(r){var e=gu(r,"string");return typeof e=="symbol"?e:e+""}function gu(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class fs extends Error{constructor(){super(...arguments),fu(this,"isPermissionUnsupported",!0)}}function qi(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function bu(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){qi(o,n,i,a,s,"next",l)}function s(l){qi(o,n,i,a,s,"throw",l)}a(void 0)})}}function Xi(r){return ri.apply(this,arguments)}function ri(){return ri=bu(function*(r){try{var e=r;return(yield navigator.permissions.query({name:e})).state}catch(t){throw t instanceof TypeError?new fs:t}}),ri.apply(this,arguments)}function Zi(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function ps(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Zi(o,n,i,a,s,"next",l)}function s(l){Zi(o,n,i,a,s,"throw",l)}a(void 0)})}}function gs(r){return ii.apply(this,arguments)}function ii(){return ii=ps(function*(r){var{clipboard:e}=navigator;if(e!==void 0)try{return yield navigator.clipboard.writeText(r)}catch{}yu(r)}),ii.apply(this,arguments)}function yu(r){var e=document.activeElement,t=document.createElement("textarea");t.value=r,document.body.appendChild(t),t.focus(),t.select();var n=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!n)throw new Error("Unable to execute copy command")}function wy(){return oi.apply(this,arguments)}function oi(){return oi=ps(function*(){try{var{clipboard:r}=navigator;if(r===void 0)throw new Kr;var e=yield Xi("clipboard-read");if(e==="granted"){var t=yield r.readText();return t}if(e==="prompt"){try{yield r.readText()}catch{}if(e=yield Xi("clipboard-read"),e==="granted"){var n=yield r.readText();return n}}if(e==="prompt"||e==="denied")throw new hu}catch(i){throw i instanceof fs?new Kr:i}throw new Kr}),oi.apply(this,arguments)}function hn(r,e,t){return(e=Cu(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Cu(r){var e=Su(r,"string");return typeof e=="symbol"?e:e+""}function Su(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var wu="table_",bs="column_",Eu=new Set(["in","not","i","ii","k"]),_u=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"]),Pu=/[^a-zA-Z0-9_$\-+@]/g,Tu=/[^A-Za-z0-9_$]/g,Ou=/^[a-zA-Z_$][a-zA-Z0-9_$\-+@]*$/,xu=/[^a-zA-Z0-9_]/g;function Iu(r){return r.replace(/[ -]/g,"_")}function Du(r){return r.replace(/\s/g,"_")}class Je{}hn(Je,"legalize",(r,e,t,n,i,o)=>{var a=e(r.trim());return i&&(Eu.has(a)||_u.has(a))&&(a=t+a),a=a.replace(n,""),a?(/^[0-9-]/.test(a)&&(a=t+a),a):t+o});hn(Je,"legalizeTableName",r=>Je.legalize(r,Du,wu,Pu,!1,0));hn(Je,"makeVariableName",r=>Je.legalizeTableName(r).replace(xu,"_"));hn(Je,"legalizeColumnNames",r=>{var e=[];return r.forEach((t,n)=>{var i=Je.legalizeColumnName(t,n);e.includes(i)&&(i=bs+n),e.push(i)}),e});hn(Je,"legalizeColumnName",function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return Je.legalize(r,Iu,bs,Tu,!0,e)});hn(Je,"isValidTableName",r=>Ou.test(r));hn(Je,"isValidColumnName",r=>Je.legalizeColumnName(r)===r);class ys extends CustomEvent{constructor(e,t){super(e,t)}}class Te{static makeCancelable(e,t){var n=!1,i,o,a=new Promise((s,l)=>{o=l,Promise.resolve(e).then(d=>{n?t&&t(d):(i=d,s(d))}).catch(d=>l(d))});return a.cancel=()=>{n=!0,o(new Gi),i!=null&&t&&t(i)},a}static isCanceled(e){return e instanceof Gi}static isTimedOut(e){return e instanceof Xa}static withTimeout(e,t){return new Promise((n,i)=>{setTimeout(()=>{try{n(t())}catch(o){i(o)}},e)})}}function Yi(r,e,t){return(e=ku(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ku(r){var e=Mu(r,"string");return typeof e=="symbol"?e:e+""}function Mu(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class qn{constructor(){Yi(this,"pending",[]),Yi(this,"resolved",[])}add(e,t){var n=Te.makeCancelable(e,t);return this.pending.push(n),n.then(()=>{this.resolve(n)},()=>{this.resolve(n)}),n}remove(e){for(var t=0;t<this.pending.length;t+=1)if(this.pending[t]===e){this.pending.splice(t,1);return}}resolve(e){this.remove(e),this.resolved.push(e)}cancel(){for(var e=[...this.pending,...this.resolved],t=0;t<e.length;t+=1)e[t].cancel();this.pending=[],this.resolved=[]}}function Ey(r){var e=r;r instanceof CustomEvent&&(e=r.detail);var t="";if(e instanceof Error?t=e.message:e!=null&&(t="".concat(e)),t=t.trim(),t.length>0)return t}class pt{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(!pt.isValidRange(e))throw new Error("Invalid range! ".concat(e))}static isSelected(e,t){for(var n=0;n<e.length;n+=1){var i=e[n],o=i[0],a=i[1];if(o<=t&&t<=a)return!0}return!1}static selectRange(e,t){for(var[n,i]=t,o=[...e],a=o.length-1;a>=0;a-=1){var s=o[a],l=s[0],d=s[1];if(l<=n&&i<=d)return o;n<=d&&l<=i&&(n=Math.min(n,l),i=Math.max(i,d),o.splice(a,1))}return o.push([n,i]),o}static deselectRange(e,t){for(var[n,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<n))if(l<n&&i<d){o[a]=[l,n-1],o.splice(a+1,0,[i+1,d]);break}else n<=l&&d<=i?o.splice(a,1):l<n?o[a]=[l,n-1]:o[a]=[i+1,d]}return o}static count(e){return e.reduce((t,n)=>t+(n[1]-n[0]+1),0)}static getItemsInRanges(e,t){return t.reduce((n,i)=>{for(var o=[...n],a=i[0];a<=i[1];a+=1)o.push(e[a]);return o},[])}}function*_y(r,e){for(var t=r;t<=e;++t)yield t}var Py=" ";class Cs{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 n=e.slice(0,e.length-1).join(", "),i=e[e.length-1];return"".concat(n,", ").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 n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return e<t?n?-1:1:e>t?n?1:-1:0}static pluralize(e,t,n){return e===1?t:n??"".concat(t,"s")}}function Ss(r,e,t){return(e=Nu(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Nu(r){var e=ju(r,"string");return typeof e=="symbol"?e:e+""}function ju(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Dn{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),n=Math.floor(e%3600/60),i=e%60;return"".concat(t>0?"".concat(t,"h "):"")+"".concat(n>0||t>0?"".concat(n,"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"),n=e%(60*60),i=String(Math.floor(n/60)).padStart(2,"0"),o=n%60,a=String(Math.ceil(o)).padStart(2,"0");return"".concat(t,":").concat(i,":").concat(a)}static isTimeString(e){return new RegExp(Dn.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])}}Ss(Dn,"TIME_PATTERN","([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]");Ss(Dn,"TIME_ZONES",Object.freeze([{label:"Tokyo UTC+9 No DST",value:"Asia/Tokyo"},{label:"Seoul UTC+9 No DST",value:"Asia/Seoul"},{label:"Hong Kong UTC+8 No DST",value:"Asia/Hong_Kong"},{label:"Singapore UTC+8 No DST",value:"Asia/Singapore"},{label:"Kolkata UTC+5:30 No DST",value:"Asia/Kolkata"},{label:"Berlin UTC+1",value:"Europe/Berlin"},{label:"UTC UTC±0 No DST",value:"UTC"},{label:"London UTC±0",value:"Europe/London"},{label:"Sao Paulo UTC-2",value:"America/Sao_Paulo"},{label:"Newfoundland UTC-3:30",value:"America/St_Johns"},{label:"Halifax UTC-4",value:"America/Halifax"},{label:"New York UTC−5",value:"America/New_York"},{label:"Chicago UTC-6",value:"America/Chicago"},{label:"Denver UTC-7",value:"America/Denver"},{label:"Los Angeles UTC-8",value:"America/Los_Angeles"},{label:"Anchorage UTC-9",value:"America/Anchorage"},{label:"Honolulu UTC-10 No DST",value:"Pacific/Honolulu"},{label:"Zurich UTC+1",value:"Europe/Zurich"},{label:"Amsterdam UTC+1",value:"Europe/Amsterdam"},{label:"Taipei UTC+8 No DST",value:"Asia/Taipei"},{label:"Sydney UTC+10",value:"Australia/Sydney"}]));function Au(r,e,t){return(e=Lu(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Lu(r){var e=Ru(r,"string");return typeof e=="symbol"?e:e+""}function Ru(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Bn extends Error{constructor(){super(...arguments),Au(this,"isInvalid",!0)}}function ws(){var r=m.useRef(!1);return m.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[]),r}function Qi(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function Fu(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Qi(o,n,i,a,s,"next",l)}function s(l){Qi(o,n,i,a,s,"throw",l)}a(void 0)})}}var $u=K.module("useAsyncInterval");function Hu(r,e){var t=ws(),n=m.useRef(0),i=m.useRef(0),o=m.useRef(null),a=m.useCallback(Fu(function*(){var s=Date.now();i.current+=1;var l=o.current==null?e:s-o.current;o.current=s;try{yield r()}catch(c){$u.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);n.current=window.setTimeout(a,h)}}),[r,t,e]);m.useEffect(()=>(o.current=null,a(),()=>{window.clearTimeout(n.current)}),[e,a])}function Xn(r){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(r);if(t==null)throw new Error(e);return t}function Bu(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{leading:n=!1,trailing:i=!0,maxWait:o}=t,a=m.useMemo(()=>ln(r,e,o!=null?{leading:n,trailing:i,maxWait:o}:{leading:n,trailing:i}),[r,e,n,i,o]);return m.useEffect(()=>()=>a.cancel(),[a]),a}function Wu(r){var e=m.useRef();return m.useEffect(function(){e.current=r}),e.current}function Uu(r,e,t){var n=m.useRef(t),i=m.useRef(r);i.current=r;var o=m.useMemo(()=>Ir(function(){return i.current(...arguments)},e,n.current),[e]);return m.useEffect(()=>()=>{var a,s;(a=(s=n.current)===null||s===void 0?void 0:s.flushOnUnmount)!==null&&a!==void 0&&a?o.flush():o.cancel()},[o]),o}function Es(r){var e=m.useRef(null);return m.useEffect(function(){r&&(typeof r=="function"?r(e.current):r.current=e.current)}),e}var Vu=3500,Ku=K.module("useCopyToClipboard");function zu(){var[r,e]=m.useState(!1),t=m.useRef(null),n=m.useCallback(i=>{gs(i).then(()=>{e(!0)}).catch(o=>Ku.error("Unable to copy ".concat(i),`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Plot-B3JS6Jui.js","./Plotly-BpejLJpj.js","./plotly-D5TAZRdQ.js","./helpers-BosuxZz1.js","./vendor-BtbW3F2w.js","./vendor-vyKkiikc.css","./MarkdownNotebook-brf_5ixw.js","./index-CKZ1MUPY.js","./monaco-CsU3t3B1.js","./monaco-CgHo24-M.css","./index-CwMW8ik0.css","./mathjax-xrAzSGe3.js","./MarkdownNotebook-CmpkKxys.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as m,_ as ln,bA as Ir,U as R,bE as Xl,I as u,K as za,L as Y,R as Dr,a1 as S,bF as Zl,M as fe,H as Et,bG as Yl,G as Ga,a0 as bn,bH as Ql,bI as Jl,bJ as ed,bD as Vn,bK as td,bz as $i,bL as nd,bM as rd,ac as qt,au as Hi,bN as Hn,bO as M,bP as Bi,ae as qa,a3 as bi,bQ as id,Z as In}from"./vendor-BtbW3F2w.js";import{aC as Xa,L as K,aZ as Za,W as Ya,ai as od,aj as ad,ah as sd,ar as ld,ad as dd,aw as ud,$ as hd,M as Qa,b as Ja,c as es,aK as cd,a_ as md,a$ as ts,b0 as ns,b1 as vd,b2 as fd,N as un,aA as pd,b3 as gd,b4 as bd,b5 as yd,b6 as Cd,b7 as Sd,b8 as wd,b9 as Ed,ba as _d,bb as Pd,bc as Td,D as rs,aY as Od,aV as is,aW as xd,a3 as os,k as Id,e as $,d as ni,bd as Dd,au as as,be as Wi,bf as kd,bg as Md,bh as Nd,bi as jd,f as ss,aO as ls,bj as Ad,bk as ds,bl as wn,aU as Ld,bm as Rd,H as Ui,bn as us,q as Vi,bo as hs,bp as Fd,K as $d,ak as Hd,bq as Bd,C as Wd,al as Ud,br as Vd,bs as Kd,bt as zd,bu as Gd,bv as qd,bw as Xd,bx as Zd,aQ as Yd,by as Qd,bz as Jd}from"./index-CKZ1MUPY.js";import{e as De,M as Ki,b as eu,l as it,R as cs,K as rt,c as Xt,d as zi,U as tu,_ as ms}from"./monaco-CsU3t3B1.js";var nu=Object.freeze([]),Cy=new Map,vs=()=>{};function Sy(r){return Array.isArray(r)?r:[r]}function Vr(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return e.filter(n=>n!=null)}function ru(r,e,t){return(e=iu(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function iu(r){var e=ou(r,"string");return typeof e=="symbol"?e:e+""}function ou(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Gi extends Error{constructor(){super(...arguments),ru(this,"isCanceled",!0)}}function au(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=su(r,e);t.forEach(n=>{r[n]=r[n].bind(r)})}function su(r,e){for(var t=new Set,n=r,i=0;n!=null&&n!==Object.prototype&&(i<=1||e);){for(var o of Object.getOwnPropertyNames(n)){var a;o!=="constructor"&&typeof((a=Object.getOwnPropertyDescriptor(n,o))===null||a===void 0?void 0:a.value)=="function"&&t.add(o)}n=Object.getPrototypeOf(n),i+=1}return[...t.keys()]}function lu(r,e,t){return(e=du(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function du(r){var e=uu(r,"string");return typeof e=="symbol"?e:e+""}function uu(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class hu extends Error{constructor(){super(...arguments),lu(this,"isClipboardPermissionsDeniedError",!0)}}function cu(r,e,t){return(e=mu(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mu(r){var e=vu(r,"string");return typeof e=="symbol"?e:e+""}function vu(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Kr extends Error{constructor(){super(...arguments),cu(this,"isClipboardUnavailableError",!0)}}function fu(r,e,t){return(e=pu(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function pu(r){var e=gu(r,"string");return typeof e=="symbol"?e:e+""}function gu(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class fs extends Error{constructor(){super(...arguments),fu(this,"isPermissionUnsupported",!0)}}function qi(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function bu(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){qi(o,n,i,a,s,"next",l)}function s(l){qi(o,n,i,a,s,"throw",l)}a(void 0)})}}function Xi(r){return ri.apply(this,arguments)}function ri(){return ri=bu(function*(r){try{var e=r;return(yield navigator.permissions.query({name:e})).state}catch(t){throw t instanceof TypeError?new fs:t}}),ri.apply(this,arguments)}function Zi(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function ps(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Zi(o,n,i,a,s,"next",l)}function s(l){Zi(o,n,i,a,s,"throw",l)}a(void 0)})}}function gs(r){return ii.apply(this,arguments)}function ii(){return ii=ps(function*(r){var{clipboard:e}=navigator;if(e!==void 0)try{return yield navigator.clipboard.writeText(r)}catch{}yu(r)}),ii.apply(this,arguments)}function yu(r){var e=document.activeElement,t=document.createElement("textarea");t.value=r,document.body.appendChild(t),t.focus(),t.select();var n=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!n)throw new Error("Unable to execute copy command")}function wy(){return oi.apply(this,arguments)}function oi(){return oi=ps(function*(){try{var{clipboard:r}=navigator;if(r===void 0)throw new Kr;var e=yield Xi("clipboard-read");if(e==="granted"){var t=yield r.readText();return t}if(e==="prompt"){try{yield r.readText()}catch{}if(e=yield Xi("clipboard-read"),e==="granted"){var n=yield r.readText();return n}}if(e==="prompt"||e==="denied")throw new hu}catch(i){throw i instanceof fs?new Kr:i}throw new Kr}),oi.apply(this,arguments)}function hn(r,e,t){return(e=Cu(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Cu(r){var e=Su(r,"string");return typeof e=="symbol"?e:e+""}function Su(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var wu="table_",bs="column_",Eu=new Set(["in","not","i","ii","k"]),_u=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"]),Pu=/[^a-zA-Z0-9_$\-+@]/g,Tu=/[^A-Za-z0-9_$]/g,Ou=/^[a-zA-Z_$][a-zA-Z0-9_$\-+@]*$/,xu=/[^a-zA-Z0-9_]/g;function Iu(r){return r.replace(/[ -]/g,"_")}function Du(r){return r.replace(/\s/g,"_")}class Je{}hn(Je,"legalize",(r,e,t,n,i,o)=>{var a=e(r.trim());return i&&(Eu.has(a)||_u.has(a))&&(a=t+a),a=a.replace(n,""),a?(/^[0-9-]/.test(a)&&(a=t+a),a):t+o});hn(Je,"legalizeTableName",r=>Je.legalize(r,Du,wu,Pu,!1,0));hn(Je,"makeVariableName",r=>Je.legalizeTableName(r).replace(xu,"_"));hn(Je,"legalizeColumnNames",r=>{var e=[];return r.forEach((t,n)=>{var i=Je.legalizeColumnName(t,n);e.includes(i)&&(i=bs+n),e.push(i)}),e});hn(Je,"legalizeColumnName",function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return Je.legalize(r,Iu,bs,Tu,!0,e)});hn(Je,"isValidTableName",r=>Ou.test(r));hn(Je,"isValidColumnName",r=>Je.legalizeColumnName(r)===r);class ys extends CustomEvent{constructor(e,t){super(e,t)}}class Te{static makeCancelable(e,t){var n=!1,i,o,a=new Promise((s,l)=>{o=l,Promise.resolve(e).then(d=>{n?t&&t(d):(i=d,s(d))}).catch(d=>l(d))});return a.cancel=()=>{n=!0,o(new Gi),i!=null&&t&&t(i)},a}static isCanceled(e){return e instanceof Gi}static isTimedOut(e){return e instanceof Xa}static withTimeout(e,t){return new Promise((n,i)=>{setTimeout(()=>{try{n(t())}catch(o){i(o)}},e)})}}function Yi(r,e,t){return(e=ku(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ku(r){var e=Mu(r,"string");return typeof e=="symbol"?e:e+""}function Mu(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class qn{constructor(){Yi(this,"pending",[]),Yi(this,"resolved",[])}add(e,t){var n=Te.makeCancelable(e,t);return this.pending.push(n),n.then(()=>{this.resolve(n)},()=>{this.resolve(n)}),n}remove(e){for(var t=0;t<this.pending.length;t+=1)if(this.pending[t]===e){this.pending.splice(t,1);return}}resolve(e){this.remove(e),this.resolved.push(e)}cancel(){for(var e=[...this.pending,...this.resolved],t=0;t<e.length;t+=1)e[t].cancel();this.pending=[],this.resolved=[]}}function Ey(r){var e=r;r instanceof CustomEvent&&(e=r.detail);var t="";if(e instanceof Error?t=e.message:e!=null&&(t="".concat(e)),t=t.trim(),t.length>0)return t}class pt{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(!pt.isValidRange(e))throw new Error("Invalid range! ".concat(e))}static isSelected(e,t){for(var n=0;n<e.length;n+=1){var i=e[n],o=i[0],a=i[1];if(o<=t&&t<=a)return!0}return!1}static selectRange(e,t){for(var[n,i]=t,o=[...e],a=o.length-1;a>=0;a-=1){var s=o[a],l=s[0],d=s[1];if(l<=n&&i<=d)return o;n<=d&&l<=i&&(n=Math.min(n,l),i=Math.max(i,d),o.splice(a,1))}return o.push([n,i]),o}static deselectRange(e,t){for(var[n,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<n))if(l<n&&i<d){o[a]=[l,n-1],o.splice(a+1,0,[i+1,d]);break}else n<=l&&d<=i?o.splice(a,1):l<n?o[a]=[l,n-1]:o[a]=[i+1,d]}return o}static count(e){return e.reduce((t,n)=>t+(n[1]-n[0]+1),0)}static getItemsInRanges(e,t){return t.reduce((n,i)=>{for(var o=[...n],a=i[0];a<=i[1];a+=1)o.push(e[a]);return o},[])}}function*_y(r,e){for(var t=r;t<=e;++t)yield t}var Py=" ";class Cs{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 n=e.slice(0,e.length-1).join(", "),i=e[e.length-1];return"".concat(n,", ").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 n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return e<t?n?-1:1:e>t?n?1:-1:0}static pluralize(e,t,n){return e===1?t:n??"".concat(t,"s")}}function Ss(r,e,t){return(e=Nu(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Nu(r){var e=ju(r,"string");return typeof e=="symbol"?e:e+""}function ju(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Dn{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),n=Math.floor(e%3600/60),i=e%60;return"".concat(t>0?"".concat(t,"h "):"")+"".concat(n>0||t>0?"".concat(n,"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"),n=e%(60*60),i=String(Math.floor(n/60)).padStart(2,"0"),o=n%60,a=String(Math.ceil(o)).padStart(2,"0");return"".concat(t,":").concat(i,":").concat(a)}static isTimeString(e){return new RegExp(Dn.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])}}Ss(Dn,"TIME_PATTERN","([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]");Ss(Dn,"TIME_ZONES",Object.freeze([{label:"Tokyo UTC+9 No DST",value:"Asia/Tokyo"},{label:"Seoul UTC+9 No DST",value:"Asia/Seoul"},{label:"Hong Kong UTC+8 No DST",value:"Asia/Hong_Kong"},{label:"Singapore UTC+8 No DST",value:"Asia/Singapore"},{label:"Kolkata UTC+5:30 No DST",value:"Asia/Kolkata"},{label:"Berlin UTC+1",value:"Europe/Berlin"},{label:"UTC UTC±0 No DST",value:"UTC"},{label:"London UTC±0",value:"Europe/London"},{label:"Sao Paulo UTC-2",value:"America/Sao_Paulo"},{label:"Newfoundland UTC-3:30",value:"America/St_Johns"},{label:"Halifax UTC-4",value:"America/Halifax"},{label:"New York UTC−5",value:"America/New_York"},{label:"Chicago UTC-6",value:"America/Chicago"},{label:"Denver UTC-7",value:"America/Denver"},{label:"Los Angeles UTC-8",value:"America/Los_Angeles"},{label:"Anchorage UTC-9",value:"America/Anchorage"},{label:"Honolulu UTC-10 No DST",value:"Pacific/Honolulu"},{label:"Zurich UTC+1",value:"Europe/Zurich"},{label:"Amsterdam UTC+1",value:"Europe/Amsterdam"},{label:"Taipei UTC+8 No DST",value:"Asia/Taipei"},{label:"Sydney UTC+10",value:"Australia/Sydney"}]));function Au(r,e,t){return(e=Lu(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Lu(r){var e=Ru(r,"string");return typeof e=="symbol"?e:e+""}function Ru(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Bn extends Error{constructor(){super(...arguments),Au(this,"isInvalid",!0)}}function ws(){var r=m.useRef(!1);return m.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[]),r}function Qi(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function Fu(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Qi(o,n,i,a,s,"next",l)}function s(l){Qi(o,n,i,a,s,"throw",l)}a(void 0)})}}var $u=K.module("useAsyncInterval");function Hu(r,e){var t=ws(),n=m.useRef(0),i=m.useRef(0),o=m.useRef(null),a=m.useCallback(Fu(function*(){var s=Date.now();i.current+=1;var l=o.current==null?e:s-o.current;o.current=s;try{yield r()}catch(c){$u.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);n.current=window.setTimeout(a,h)}}),[r,t,e]);m.useEffect(()=>(o.current=null,a(),()=>{window.clearTimeout(n.current)}),[e,a])}function Xn(r){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(r);if(t==null)throw new Error(e);return t}function Bu(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{leading:n=!1,trailing:i=!0,maxWait:o}=t,a=m.useMemo(()=>ln(r,e,o!=null?{leading:n,trailing:i,maxWait:o}:{leading:n,trailing:i}),[r,e,n,i,o]);return m.useEffect(()=>()=>a.cancel(),[a]),a}function Wu(r){var e=m.useRef();return m.useEffect(function(){e.current=r}),e.current}function Uu(r,e,t){var n=m.useRef(t),i=m.useRef(r);i.current=r;var o=m.useMemo(()=>Ir(function(){return i.current(...arguments)},e,n.current),[e]);return m.useEffect(()=>()=>{var a,s;(a=(s=n.current)===null||s===void 0?void 0:s.flushOnUnmount)!==null&&a!==void 0&&a?o.flush():o.cancel()},[o]),o}function Es(r){var e=m.useRef(null);return m.useEffect(function(){r&&(typeof r=="function"?r(e.current):r.current=e.current)}),e}var Vu=3500,Ku=K.module("useCopyToClipboard");function zu(){var[r,e]=m.useState(!1),t=m.useRef(null),n=m.useCallback(i=>{gs(i).then(()=>{e(!0)}).catch(o=>Ku.error("Unable to copy ".concat(i),`
|
|
3
3
|
`,o))},[]);return m.useEffect(()=>(t.current&&clearTimeout(t.current),r&&(t.current=setTimeout(()=>{e(!1)},Vu)),()=>{t.current&&clearTimeout(t.current)}),[r]),[r,n]}function Ji(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Gu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ji(Object(t),!0).forEach(function(n){En(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ji(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function En(r,e,t){return(e=qu(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function qu(r){var e=Xu(r,"string");return typeof e=="symbol"?e:e+""}function Xu(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var eo="popper";class Zn extends m.Component{constructor(e){super(e),En(this,"element",void 0),En(this,"container",void 0),En(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=R.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:n}=this.props;if(!e&&this.container.current!==null){var{options:i}=this.props;i=Gu({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 Xl(n||o,this.element,i),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t){var a=this.element.querySelector(".".concat(eo));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:n,interactive:i,closeOnBlur:o}=this.props,{show:a}=this.state;return u.jsx(Za,{isPortal:!0,children:u.jsx(za,{in:a,timeout:n,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:Y(eo,{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&&Dr.createPortal(this.renderContent(),this.element)})}}En(Zn,"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});En(Zn,"defaultProps",{options:{},className:"",timeout:Ya.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0});function to(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Zu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?to(Object(t),!0).forEach(function(n){bt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):to(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function bt(r,e,t){return(e=Yu(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Yu(r){var e=Qu(r,"string");return typeof e=="symbol"?e:e+""}function Qu(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ju=K.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),bt(this,"container",void 0),bt(this,"popper",void 0),bt(this,"parent",void 0),bt(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=R.createRef(),this.popper=R.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:n}=t,{isShown:i}=this.state;i!==n&&(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){Ju.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,n=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&&n>=o.top&&n<=o.top+o.height?this.handleMouseMove():t>=a.left&&t<=a.left+a.width&&n>=a.top&&n<=a.top+a.height?this.handleMouseMove():i&&(this.stopTimer(),this.hide())}}startTimer(){this.stopTimer();var{timeout:e,reshowTimeout:t}=this.props,n=e;(ce.shownTooltipCount>0||Date.now()-ce.lastHiddenTime<ce.triggerReshowThreshold)&&(n=t),this.timer=window.setTimeout(this.handleTimeout,n)}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:n}=this.props;n&&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:n,popperClassName:i,"data-testid":o,onEntered:a}=this.props,{isShown:s}=this.state,{options:l}=this.props;return l=Zu({placement:"bottom"},l),u.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":o,children:u.jsx(Zn,{className:Y(i,"popper-tooltip"),options:l,ref:this.popper,onEntered:a,onExited:this.handleExited,interactive:e,referenceObject:n,children:u.jsxs("div",{className:"tooltip-content",children:[" ",s&&t]})})})}}bt(ce,"defaultTimeout",500);bt(ce,"defaultReshowTimeout",100);bt(ce,"triggerReshowThreshold",300);bt(ce,"shownTooltipCount",0);bt(ce,"lastHiddenTime",Date.now());bt(ce,"defaultProps",{interactive:!1,options:{},popperClassName:"",reshowTimeout:ce.defaultReshowTimeout,timeout:ce.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});var eh=K.module("ThemeProvider"),yi=m.createContext(null);yi.displayName="ThemeContext";function Ty(r){var{themes:e,waitForActivation:t=!1,defaultPreloadValues:n=hd,children:i}=r,o=m.useMemo(()=>od(),[]),[a,s]=m.useState(null),[l,d]=m.useState(ad),h=m.useMemo(()=>e==null?null:sd(l,{base:o,custom:e??[]}),[o,l,e]),c=m.useMemo(()=>[...o,...e??[]],[o,e]);return m.useEffect(function(){if(!(h==null||e==null)){ld(n);var f=dd(n);eh.debug2("updateThemePreloadData:",{active:h.map(p=>p.themeKey),custom:e.map(p=>p.themeKey),preloadStyleContent:f,selectedThemeKey:l}),ud({themeKey:l,preloadStyleContent:f})}},[h,l,e,n]),m.useEffect(()=>{s({activeThemes:h,selectedThemeKey:l,themes:c,setSelectedThemeKey:d})},[h,l,c]),t&&h==null?null:u.jsxs(u.Fragment,{children:[h==null?null:u.jsx(u.Fragment,{children:h.map(v=>u.jsx("style",{"data-theme-key":v.themeKey,children:v.styleContent},v.themeKey))}),a==null?null:u.jsx(yi.Provider,{value:a,children:u.jsx(Za,{children:i})})]})}function _s(){return Xn(yi,"No ThemeContext value found. Component must be wrapped in a ThemeContext.Provider")}function kr(r){var{children:e,className:t,style:n,"data-testid":i}=r;return u.jsx("div",{className:Y("btn-group",t),style:n,role:"group","data-testid":i,children:e})}kr.displayName="SplitButtonGroup";kr.propTypes={children:S.node.isRequired,className:S.string,style:S.object,"data-testid":S.string};kr.defaultProps={className:null,style:{},"data-testid":void 0};var th=["kind","variant","type","tooltip","icon","disabled","active","onClick","onContextMenu","onMouseDown","onMouseUp","onMouseEnter","onMouseLeave","onKeyDown","className","style","children","tabIndex","data-testid","aria-label"];function no(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ro(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?no(Object(t),!0).forEach(function(n){nh(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):no(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function nh(r,e,t){return(e=rh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function rh(r){var e=ih(r,"string");return typeof e=="symbol"?e:e+""}function ih(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function oh(r,e){if(r==null)return{};var t,n,i=ah(r,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(n=0;n<o.length;n++)t=o[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(r,t)&&(i[t]=r[t])}return i}function ah(r,e){if(r==null)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.indexOf(n)!==-1)continue;t[n]=r[n]}return t}var sh=["primary","secondary","tertiary","success","danger","inline","ghost"],lh=["group-end"];function dh(r,e){switch(r){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 Y("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function uh(r){switch(r){case"group-end":return Y("pl-2","pr-3")}}var ie=R.forwardRef((r,e)=>{var{kind:t,variant:n,type:i,tooltip:o,icon:a,disabled:s=!1,active:l,onClick:d,onContextMenu:h,onMouseDown:c,onMouseUp:v,onMouseEnter:f,onMouseLeave:p,onKeyDown:g,className:b,style:E,children:x,tabIndex:P,"data-testid":F,"aria-label":U}=r,ee=oh(r,th),{UNSAFE_className:j}=Zl({},"button"),W;n&&(W=uh(n));var H;a&&(H=R.isValidElement(a)?a:u.jsx(fe,{icon:a}));var ne=H!=null&&x==null,oe=dh(t,ne),L;o!==void 0&&(L=typeof o=="string"?u.jsx(ce,{children:o}):o);var X=U;U===void 0&&ne&&o!=null&&typeof o=="string"&&(X=o);var z=u.jsxs("button",ro(ro({"data-testid":F,ref:e,type:i,className:Y("btn",oe,W,{active:l},b,j),onClick:d,onContextMenu:h,onMouseUp:v,onMouseDown:c,onMouseEnter:f,onMouseLeave:p,onKeyDown:g,style:E,disabled:s,tabIndex:P,"aria-label":X},ee),{},{children:[a&&H,x,o!=null&&!s&&L]}));return s&&o!=null?u.jsxs("span",{className:"btn-disabled-wrapper",children:[z,L]}):z});ie.displayName="Button";ie.propTypes={kind:S.oneOf(sh).isRequired,variant:S.oneOf(lh),type:S.oneOf(["submit","reset","button"]),tooltip(r){var{tooltip:e,icon:t,children:n}=r;return e===void 0&&t!=null&&n==null?new Error("Tooltip is required for icon only buttons"):null},icon(r){var{children:e,icon:t}=r;return t==null&&e==null?new Error("Icon is required if no children are provided"):e==null&&!R.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(r){var{onClick:e,type:t}=r;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};ie.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};function Ps(r){var{className:e,children:t,"data-testid":n}=r;return u.jsx("div",{className:Y("modal-footer",e),"data-testid":n,children:t})}function dn(r){var{isOpen:e,headerText:t,bodyText:n,onCancel:i,onConfirm:o,onDiscard:a,onModalDisable:s,cancelButtonText:l="Cancel",confirmButtonText:d="Okay",discardButtonText:h="Discard",isConfirmDanger:c=!1,children:v,"data-testid":f}=r,p=m.useRef(null),g=m.useRef(null),b=m.useCallback(()=>{g.current!==null&&g.current.checked&&s&&s(),o()},[o,s]),E=m.useCallback(()=>{var P;(P=p.current)===null||P===void 0||P.focus()},[]),x="";return e&&(x=typeof n=="function"?n():n),u.jsxs(Qa,{isOpen:e,onOpened:E,children:[u.jsx(Ja,{closeButton:!1,children:t}),u.jsx(es,{children:x}),u.jsxs(Ps,{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":f!==void 0?"".concat(f,"-checkbox-confirm"):void 0}),u.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),a&&u.jsx(ie,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:a,"data-testid":f!==void 0?"".concat(f,"-btn-discard"):void 0,children:h}),i&&u.jsx(ie,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":f!==void 0?"".concat(f,"-btn-cancel"):void 0,children:l}),u.jsxs(kr,{children:[u.jsx(ie,{kind:c?"danger":"primary",onClick:b,ref:p,"data-testid":f!==void 0?"".concat(f,"-btn-confirm"):void 0,children:d}),v]})]})]})}dn.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};dn.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};function hh(r,e,t){return(e=ch(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ch(r){var e=mh(r,"string");return typeof e=="symbol"?e:e+""}function mh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function zr(r){return r.then!==void 0}class _e{static disableAllActions(){_e.actionsDisabled=!0}static enableAllActions(){_e.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){if(e.group!==t.group){var n,i;return((n=e.group)!==null&&n!==void 0?n: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(_e.compareActions),t}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return _e.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){var t=_e.getModifierKey();return e[t]}static getMenuItems(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=[],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&&n.push(s):Array.isArray(s)?n=n.concat(s):n.push(s))}return n=n.filter(l=>l.title!==void 0||l.then!=null||l.menuElement),n}static getNextMenuItem(e,t,n){var i=e;i<0&&t<0&&(i=n.length);for(var o=1;o<n.length+1;o+=1){var a=(i+t*o+n.length)%n.length,s=n[a];if(!(s instanceof Promise)&&s.disabled!==!0)return a}return e}}hh(_e,"actionsDisabled",!1);var io=K.module("GlobalContextAction");class vh 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:n}=this.props;n.title==null&&!n.menuElement||(t.contextActions==null&&(t.contextActions=[]),t.contextActions.push(n),io.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){var{action:t}=this.props;if(!_e.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)){var n;io.debug("Global hotkey matched!",e),(n=t.action)===null||n===void 0||n.call(t,e),e.preventDefault(),e.stopPropagation()}}render(){return null}}class fh extends m.Component{render(){for(var{actions:e,"data-testid":t}=this.props,n=[],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(vh,{action:o,"data-testid":t},"".concat(o.title,".").concat(a==null?void 0:a.id));n.push(s)}}return n}}function Ts(r,e,t){return(e=ph(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ph(r){var e=gh(r,"string");return typeof e=="symbol"?e:e+""}function gh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var or=K.module("ContextActions");class te extends m.Component{static triggerMenu(e,t,n,i){if(i.length!==0){var o=new MouseEvent("contextmenu",{clientX:t,clientY:n,bubbles:!0,cancelable:!0});o.contextActions=i,e.dispatchEvent(o)}}constructor(e){super(e),Ts(this,"container",void 0),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=R.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=>!zr(i)&&typeof i!="function"&&i.isGlobal),n=e.actions.filter(i=>!zr(i)&&typeof i!="function"&&(i.isGlobal===void 0||!i.isGlobal)&&i.shortcut!=null);return{globalActions:t,keyboardActions:n}}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 n=e.target,i=function(){var{classList:d}=n,h=t.find(c=>d.contains(c));if(h!==void 0)return or.debug2('Contextmenu event ignored based on the target className "'.concat(h,'"')),{v:void 0};n=n.parentElement};n!=null;){var o=i();if(typeof o=="object")return o.v}if(_e.isContextActionEvent(e)||(e.contextActions=[]),!!_e.isContextActionEvent(e)){var{actions:a}=this.props;if(a!=null){var s=a;Array.isArray(s)&&(s=s.filter(l=>zr(l)||typeof l=="function"||l.isGlobal===void 0||!l.isGlobal)),e.contextActions=e.contextActions.concat(s)}or.debug("Received context menu event! Menu items are now: ",e.contextActions)}}handleKeyDown(e){for(var{keyboardActions:t}=this.state,n=0;n<t.length;n+=1){var i=t[n];if(!_e.actionsDisabled&&i.shortcut!=null&&i.shortcut.matchesEvent(e)){var o;or.debug("Context hotkey matched!",e),(o=i.action)===null||o===void 0||o.call(i,e),e.stopPropagation(),e.preventDefault(),or.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(fh,{actions:t})})}}Ts(te,"groups",{default:void 0,high:100,medium:5e3,low:1e4,global:1e5,edit:100});var Ci=R.forwardRef((r,e)=>{var t,n;function i(j){var{menuItem:W,onMenuItemClick:H}=r;H(W,j)}function o(j){var{menuItem:W,onMenuItemMouseMove:H}=r;H(W,j)}function a(j){var{menuItem:W,onMenuItemContextMenu:H}=r;H(W,j)}function s(j,W,H){if(typeof j.type=="string")return j;var{closeMenu:ne,menuItem:oe,isKeyboardSelected:L,isMouseSelected:X,"data-testid":z}=r,A={menuItem:oe,closeMenu:ne,isKeyboardSelected:L,isMouseSelected:X,iconElement:W,displayShortcut:H,"data-testid":z};return R.cloneElement(j,{forwardedProps:A})}var{children:l,menuItem:d,isKeyboardSelected:h=!1,isMouseSelected:c=!1,"data-testid":v}=r,f=(t=d.shortcutText)!==null&&t!==void 0?t:(n=d.shortcut)===null||n===void 0?void 0:n.getDisplayText(),p=null;if(d.icon){var g=d.icon;if(R.isValidElement(g))p=g;else{var b;d.iconColor!=null&&(d.disabled===void 0||!d.disabled)&&(b={color:d.iconColor}),p=u.jsx(fe,{icon:g,style:b})}}var E=null,x=!!l;d.actions&&(E=u.jsx(fe,{icon:cd}));var P=null;if(d.menuElement)P=u.jsx("div",{className:"custom-menu-item",onMouseMove:o,children:s(d.menuElement,p,f)});else{var F,U=d.disabled,ee=d.iconOutline;P=u.jsx("button",{type:"button",className:Y("btn-context-menu",{disabled:U},{active:(x||c)&&(U===void 0||!U)},{"keyboard-active":h&&(U===void 0||!U)}),onClick:i,onMouseMove:o,onContextMenu:a,title:(F=d.description)!==null&&F!==void 0?F:"",children:u.jsxs("div",{className:"btn-context-menu-wrapper",children:[u.jsx("span",{className:Y("icon",{outline:ee}),children:p}),u.jsx("span",{className:"title",children:d.title}),f!==void 0&&u.jsx("span",{className:"shortcut",children:f}),E&&u.jsx("span",{className:Y("submenu-indicator",{disabled:U}),children:E})]})})}return u.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":v,children:[l,P]})});Ci.displayName="ContextMenuItem";Ci.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};var Mr=R.forwardRef((r,e)=>{var{checked:t=!1,children:n,className:i,disabled:o,inputClassName:a,isInvalid:s,labelClassName:l,name:d,onChange:h,"data-testid":c}=r,[v]=m.useState(Et()),f=Es(e);m.useEffect(function(){f.current&&(f.current.indeterminate=t===null)},[f,t]);var p=m.useCallback(g=>{f.current&&(f.current.indeterminate=t===null),h&&h(g)},[f,t,h]);return u.jsxs("div",{className:Y("custom-control custom-checkbox",i),children:[u.jsx("input",{type:"checkbox",ref:f,checked:t??!1,className:Y("custom-control-input",a,{"is-invalid":s}),disabled:o,id:v,name:d,onChange:p,"data-testid":c}),u.jsx("label",{className:Y("custom-control-label",l),htmlFor:v,children:n})]})});Mr.displayName="Checkbox";Mr.propTypes={checked:(r,e)=>{var{[e]:t}=r;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};Mr.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};function Cr(r){return(r==null?void 0:r.WrappedComponent)!==void 0}function Os(r){return Cr(r)&&Os(r.WrappedComponent)?!0:r.prototype!=null&&r.prototype.isReactComponent!=null}function bh(r){return!Cr(r)&&"$$typeof"in r&&r.$$typeof===Yl.ForwardRef}function xs(r){return Os(r)||bh(r)}function Oy(r){var{copy:e,kind:t="ghost",tooltip:n="Copy",className:i,style:o,"data-testid":a,children:s}=r,[l,d]=zu();return u.jsx(ie,{kind:t,className:i,style:o,"data-testid":a,icon:l?md:ts,tooltip:l?"Copied":n,onClick:()=>{d(typeof e=="function"?e():e)},children:s})}function oo(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function yh(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?oo(Object(t),!0).forEach(function(n){Wn(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):oo(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Wn(r,e,t){return(e=Ch(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ch(r){var e=Sh(r,"string");return typeof e=="symbol"?e:e+""}function Sh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Is extends m.PureComponent{constructor(e){var t;super(e),Wn(this,"container",void 0),Wn(this,"oldFocus",void 0),Wn(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=R.createRef(),this.oldFocus=document.activeElement,this.rAF=0;var{options:n}=e,i=(t=n.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=_e.getMenuItems(e,!1);t.length>0&&this.setState(n=>({menuItems:_e.sortActions(n.menuItems.concat(t))}))}handleKeyDown(e){var{menuItems:t}=this.state,n=this.getKeyboardIndex(),i=n;if(e.key==="Enter"||e.key===" "){n!=null&&n>=0&&n<t.length&&this.handleMenuItemClick(t[n],e);return}if(e.key==="Escape")i=null;else if(e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0){var o;i=_e.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=_e.getNextMenuItem((a=i)!==null&&a!==void 0?a:0,1,t)}n!==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:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),n(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,n=t.indexOf(e);this.setMouseIndex(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{"data-testid":t}=this.props,{keyboardIndex:n,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(Ci,{isKeyboardSelected:n===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:yh({},d),ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}}Wn(Is,"defaultProps",{closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});function ao(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function so(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ao(Object(t),!0).forEach(function(n){yn(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ao(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function yn(r,e,t){return(e=wh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function wh(r){var e=Eh(r,"string");return typeof e=="symbol"?e:e+""}function Eh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Yn extends m.PureComponent{constructor(e){super(e),yn(this,"container",void 0),yn(this,"parent",void 0),yn(this,"popper",void 0),yn(this,"isOpen",void 0),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=R.createRef(),this.parent=null,this.popper=R.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:n,"data-testid":i}=this.props,{menuStyle:o}=this.props,{options:a,popperOptions:s}=this.props;return s=so({placement:"bottom"},s),a=so({separateKeyboardMouse:!0},a),u.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":i,children:u.jsx(Zn,{ref:this.popper,options:s,className:Y("menu-popper",n),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:u.jsx(Is,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:a,menuStyle:o})})})}}yn(Yn,"defaultProps",{isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0});function Ht(r,e,t){return(e=_h(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function _h(r){var e=Ph(r,"string");return typeof e=="symbol"?e:e+""}function Ph(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var lo=K.module("Shortcut"),k;(function(r){r.CTRL="MODIFIER_CTRL",r.CMD="MODIFIER_CMD",r.ALT="MODIFIER_ALT",r.OPTION="MODIFIER_OPTION",r.SHIFT="MODIFIER_SHIFT"})(k||(k={}));var I;(function(r){r.A="A",r.B="B",r.C="C",r.D="D",r.E="E",r.F="F",r.G="G",r.H="H",r.I="I",r.J="J",r.K="K",r.L="L",r.M="M",r.N="N",r.O="O",r.P="P",r.Q="Q",r.R="R",r.S="S",r.T="T",r.U="U",r.V="V",r.W="W",r.X="X",r.Y="Y",r.Z="Z",r.ZERO="0",r.ONE="1",r.TWO="2",r.THREE="3",r.FOUR="4",r.FIVE="5",r.SIX="6",r.SEVEN="7",r.EIGHT="8",r.NINE="9",r.BACKSPACE="Backspace",r.ESCAPE="Escape",r.ENTER="Enter",r.DELETE="Delete",r.SLASH="/",r.QUESTION_MARK="?",r.BACKSLASH="\\",r.PIPE="|",r.MINUS="-",r.UNDERSCORE="_",r.EQUALS="=",r.PLUS="+",r.BACKTICK="`",r.TILDE="~",r.COMMA=",",r.LEFT_CHEVRON="<",r.PERIOD=".",r.RIGHT_CHEVRON=">",r.SEMICOLON=";",r.COLON=":",r.SINGLE_QUOTE="'",r.DOUBLE_QUOTE='"',r.LEFT_BRACKET="[",r.RIGHT_BRACKET="]",r.LEFT_CURLY="{",r.RIGHT_CURLY="}",r.F1="F1",r.F2="F2",r.F3="F3",r.F4="F4",r.F5="F5",r.F6="F6",r.F7="F7",r.F8="F8",r.F9="F9",r.F10="F10",r.F11="F11",r.F12="F12"})(I||(I={}));var Th=new Set([I.ENTER,I.DELETE,I.F1,I.F2,I.F3,I.F4,I.F5,I.F6,I.F7,I.F8,I.F9,I.F10,I.F11,I.F12]);class Ce extends Ga{static isAllowedKey(e){return Object.values(I).includes(e)}static isValidKeyState(e){var{keyValue:t}=e;if(t===null)return!0;if(!Ce.isMacPlatform&&e.metaKey||!Ce.isAllowedKey(t))return!1;var n=!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey;return!n||Th.has(t)}static createKeyState(e){var t={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:e[e.length-1]};return e.forEach(n=>{switch(n){case k.CTRL:t.ctrlKey=!0;break;case k.ALT:case k.OPTION:t.altKey=!0;break;case k.CMD:t.metaKey=!0;break;case k.SHIFT:t.shiftKey=!0;break}}),t}static getKeyStateFromEvent(e){var{key:t,keyCode:n}=e,i="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?i="":!Ce.isAllowedKey(t)&&Ce.isAllowedKey(String.fromCharCode(n))?i=String.fromCharCode(n):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===I.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 I.ENTER:t+="⏎";break;case I.ESCAPE:t+="⎋";break;case I.BACKSPACE:t+="⌫";break;case I.DELETE:t+="⌦";break;case null:break;default:t+=e.keyValue}return t}static doKeyStatesMatch(e,t){var n,i;return((n=e.keyValue)===null||n===void 0?void 0:n.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?"":Ce.isMacPlatform?Ce.getMacDisplayText(e):Ce.getWindowsDisplayText(e)}constructor(e){var{id:t,shortcut:n,macShortcut:i,isEditable:o=!0,name:a,tooltip:s}=e;super(),Ht(this,"id",void 0),Ht(this,"name",void 0),Ht(this,"tooltip",void 0),Ht(this,"isEditable",void 0),Ht(this,"defaultKeyState",void 0),Ht(this,"keyState",void 0),this.id=t,this.name=a,this.tooltip=s,this.isEditable=o;var l=Ce.isMacPlatform,d=l?i:n;this.defaultKeyState=Ce.createKeyState(d),this.keyState=this.defaultKeyState}getDisplayText(){return Ce.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){Ce.isValidKeyState(e)?(lo.debug2("Shortcut ".concat(this.id," updated to ").concat(JSON.stringify(e))),this.keyState=e,this.dispatchEvent(new ys("onUpdate",{detail:this}))):lo.debug2("Shortcut ".concat(this.id," tried to update to invalid keyState ").concat(JSON.stringify(e)))}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return Ce.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(Ce.NULL_KEY_STATE)}isNull(){return Ce.doKeyStatesMatch(this.keyState,Ce.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return Ce.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(Ce.getKeyStateFromEvent(e))}}Ht(Ce,"NULL_KEY_STATE",{metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null});Ht(Ce,"isMacPlatform",_e.isMacPlatform());function uo(r,e,t){return(e=Oh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Oh(r){var e=xh(r,"string");return typeof e=="symbol"?e:e+""}function xh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ho=K.module("ShortcutRegistry");class Ih extends Ga{constructor(){super(...arguments),uo(this,"shortcutMap",new Map),uo(this,"shortcutsByCategory",new Map)}createAndAdd(e){var t=new Ce(e);return this.add(t)}add(e){var t=this.shortcutMap.get(e.id);if(t)return ho.warn("Skipping attempt to add duplicate shortcut ID to registry: ".concat(e.id)),t;ho.debug2("Adding shortcut to registry: ".concat(e.id)),e.addEventListener("onUpdate",o=>{var{detail:a}=o;return this.dispatchEvent(new ys("onUpdate",{detail:a}))});var n=e.id.split(".")[0];if(this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(n)){var i;(i=this.shortcutsByCategory.get(n))===null||i===void 0||i.push(e)}else this.shortcutsByCategory.set(n,[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 he=Object.freeze(new Ih),Kt={COPY:he.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[k.CTRL,I.C],macShortcut:[k.CMD,I.C],isEditable:!1}),PASTE:he.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[k.CTRL,I.V],macShortcut:[k.CMD,I.V],isEditable:!1}),SAVE:he.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[k.CTRL,I.S],macShortcut:[k.CMD,I.S],isEditable:!1}),SELECT_ALL:he.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[k.CTRL,I.A],macShortcut:[k.CMD,I.A],isEditable:!1}),REOPEN_CLOSED_PANEL:he.createAndAdd({id:"GLOBAL.REOPEN_CLOSED_PANEL",name:"Re-open Closed Panel",shortcut:[k.ALT,k.SHIFT,I.T],macShortcut:[k.OPTION,k.SHIFT,I.T],isEditable:!0}),LINKER:he.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[k.CTRL,I.L],macShortcut:[k.CMD,I.L]}),LINKER_CLOSE:he.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[I.ESCAPE],macShortcut:[I.ESCAPE],isEditable:!1}),COPY_VERSION_INFO:he.createAndAdd({id:"GLOBAL.COPY_VERSION_INFO",name:"Copy Version Info",shortcut:[k.CTRL,k.ALT,I.I],macShortcut:[k.CMD,k.SHIFT,I.I],isEditable:!0}),EXPORT_LOGS:he.createAndAdd({id:"GLOBAL.EXPORT_LOGS",name:"Export Logs",shortcut:[k.CTRL,k.ALT,k.SHIFT,I.L],macShortcut:[k.CMD,k.OPTION,k.SHIFT,I.L],isEditable:!0}),OPEN_DASHBOARD_LIST:he.createAndAdd({id:"GLOBAL.OPEN_DASHBOARD_LIST",name:"Open Dashboard List",shortcut:[k.CTRL,k.SHIFT,I.D],macShortcut:[k.CMD,k.SHIFT,I.D],isEditable:!0}),NEXT:he.createAndAdd({id:"GLOBAL.NEXT",name:"Next",shortcut:[I.ENTER],macShortcut:[I.ENTER],isEditable:!1}),PREVIOUS:he.createAndAdd({id:"GLOBAL.PREVIOUS",name:"Previous",shortcut:[k.SHIFT,I.ENTER],macShortcut:[k.SHIFT,I.ENTER],isEditable:!1})};function ai(r,e,t){return(e=Dh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Dh(r){var e=kh(r,"string");return typeof e=="symbol"?e:e+""}function kh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Nr extends m.PureComponent{constructor(e){super(e),ai(this,"inputField",void 0),ai(this,"searchChangeSelection",void 0),this.inputField=R.createRef(),this.searchChangeSelection=R.createRef()}componentDidMount(){this.setInputPaddingRight()}componentDidUpdate(){this.setInputPaddingRight()}focus(){var e;(e=this.inputField.current)===null||e===void 0||e.focus()}select(){var e;(e=this.inputField.current)===null||e===void 0||e.select()}setInputPaddingRight(){var e=this.inputField.current,t=this.searchChangeSelection.current;if(e&&t){var n=t.getBoundingClientRect().width;e.style.paddingRight="".concat(n,"px")}}render(){var{value:e,placeholder:t,endPlaceholder:n,onBlur:i,onChange:o,className:a,disabled:s,matchCount:l,id:d,onKeyDown:h,"data-testid":c,cursor:v}=this.props,f,p=[{action:()=>v==null?void 0:v.next("forward"),shortcut:Kt.NEXT},{action:()=>v==null?void 0:v.next("back"),shortcut:Kt.PREVIOUS}];return v&&l>1?f=u.jsxs(u.Fragment,{children:[u.jsx(ie,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{v.next("back")},icon:ns,tooltip:"Previous match (".concat(Kt.PREVIOUS.getDisplayText(),")")}),u.jsxs("span",{className:"search-change-text",children:[v.index!==void 0&&"".concat(v.index+1," of "),l]}),u.jsx(ie,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{v.next("forward")},icon:vd,tooltip:"Next match (".concat(Kt.NEXT.getDisplayText(),")")})]}):f=l>0&&u.jsx("span",{className:"search-match",children:l}),u.jsxs("div",{className:Y("search-group",a),children:[u.jsx("input",{type:"search",value:e,onBlur:i,onChange:o,onKeyDown:h,className:"form-control",disabled:s,placeholder:t,ref:this.inputField,id:d,"data-testid":c}),l!=null?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"search-change-selection",ref:this.searchChangeSelection,children:f}),u.jsx(te,{actions:p})]}):u.jsxs("span",{className:"search-end-content",children:[(n??"")!==""&&e===""&&u.jsx("span",{className:"search-end-placeholder",children:n}),u.jsx(fe,{icon:fd})]})]})}}ai(Nr,"defaultProps",{placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0,cursor:void 0});function Ds(r,e,t){return(e=Mh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Mh(r){var e=Nh(r,"string");return typeof e=="symbol"?e:e+""}function Nh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class ks extends m.PureComponent{constructor(e){super(e),Ds(this,"searchInput",void 0),this.searchInput=R.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=ln(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:n,id:i,"data-testid":o}=this.props,{value:a}=this.state;return u.jsx(Nr,{value:a,placeholder:e,onChange:this.handleChange,className:t,matchCount:n,ref:this.searchInput,id:i,"data-testid":o})}}Ds(ks,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});function Ms(r,e,t){return(e=jh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jh(r){var e=Ah(r,"string");return typeof e=="symbol"?e:e+""}function Ah(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Lh=K.module("ItemListItem");class jr extends m.Component{static handleKeyDown(){return Lh.log("ItemListItem.handleKeyDown false"),!1}constructor(e){super(e),Ms(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=R.createRef()}handleBlur(e){var{itemIndex:t,onBlur:n}=this.props;n(t,e)}handleFocus(e){var{itemIndex:t,onFocus:n}=this.props;n(t,e)}handleClick(e){var{itemIndex:t,onClick:n}=this.props;n(t,e)}handleContextMenu(e){var{itemIndex:t,onContextMenu:n}=this.props;n(t,e)}handleDragStart(e){var{itemIndex:t,onDragStart:n}=this.props;n(t,e)}handleDrag(e){var{itemIndex:t,onDrag:n}=this.props;n(t,e)}handleDragOver(e){e.preventDefault();var{itemIndex:t,onDragOver:n}=this.props;n(t,e)}handleDragEnd(e){var{itemIndex:t,onDragEnd:n}=this.props;n(t,e)}handleDrop(e){var{itemIndex:t,onDrop:n}=this.props;n(t,e)}handleDoubleClick(e){var{itemIndex:t,onDoubleClick:n}=this.props;n(t,e)}handleMouseMove(e){var{itemIndex:t,onMouseMove:n}=this.props;n(t,e)}handleMouseDown(e){var{itemIndex:t,onMouseDown:n}=this.props;n(t,e)}handleMouseUp(e){var{itemIndex:t,onMouseUp:n}=this.props;n(t,e)}render(){var{isDraggable:e,isFocused:t,isSelected:n,style:i,children:o,"data-testid":a}=this.props;return u.jsx("div",{className:Y("item-list-item",{active:n},{"is-focused":t},{"is-draggable":e}),onKeyDown:jr.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})}}Ms(jr,"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:{}});function co(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function mo(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?co(Object(t),!0).forEach(function(n){ct(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):co(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ct(r,e,t){return(e=Rh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Rh(r){var e=Fh(r,"string");return typeof e=="symbol"?e:e+""}function Fh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var vo=K.module("ItemList"),fo=5;class at extends m.PureComponent{static renderItem(e){var t,n,{item:i}=e;return u.jsx("div",{className:"item-list-item-content",children:i!=null&&((t=(n=i.displayValue)!==null&&n!==void 0?n:i.value)!==null&&t!==void 0?t:"".concat(i))})}constructor(e){super(e),ct(this,"list",void 0),ct(this,"listContainer",void 0),ct(this,"getItemSelected",bn((i,o)=>pt.isSelected(o,i),{max:at.CACHE_SIZE})),ct(this,"getCachedItem",bn((i,o,a,s,l,d,h,c)=>{var v=d({item:a,itemIndex:i,isFocused:s,isSelected:l,style:h});return u.jsx(jr,{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:v},o)},{max:at.CACHE_SIZE})),ct(this,"getOuterElement",bn(i=>{var o=R.forwardRef((a,s)=>u.jsx("div",mo({ref:s,tabIndex:-1,onKeyDown:i,role:"presentation"},a)));return o.displayName="ItemListOuterElement",o},{max:1e3})),ct(this,"getInnerElement",bn(()=>{var i=R.forwardRef((o,a)=>u.jsx("div",mo({className:"item-list-inner-element",ref:a},o)));return i.displayName="ItemListInnerElement",i},{max:1e3})),ct(this,"getItemData",bn((i,o,a)=>({items:i,selectedRanges:o,renderItem:a}),{max:1e3})),this.handleItemBlur=this.handleItemBlur.bind(this),this.handleItemContextMenu=this.handleItemContextMenu.bind(this),this.handleItemFocus=this.handleItemFocus.bind(this),this.handleItemDoubleClick=this.handleItemDoubleClick.bind(this),this.handleItemMouseDown=this.handleItemMouseDown.bind(this),this.handleItemMouseMove=this.handleItemMouseMove.bind(this),this.handleItemMouseUp=this.handleItemMouseUp.bind(this),this.handleItemsRendered=this.handleItemsRendered.bind(this),this.handleWindowMouseUp=this.handleWindowMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleResize=this.handleResize.bind(this),this.renderInnerElement=this.renderInnerElement.bind(this),this.list=R.createRef(),this.listContainer=R.createRef();var{isStickyBottom:t,selectedRanges:n}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:n,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null,mouseX:null,mouseY:null}}componentDidUpdate(e,t){var{selectedRanges:n,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(),n!==e.selectedRanges&&n!==d)this.setSelectedRanges(n);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:n}=this.state,i=this.listContainer.current.querySelectorAll(t),o=e-n;return i[o]}focusItem(e){var{disableSelect:t}=this.props;if(!t){this.setState({focusIndex:e});var n=this.getElement(e);n instanceof HTMLElement&&n.focus()}}scrollToItem(e){var t=this.getElement(e);t!=null&&t.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){this.setState({focusIndex:e});var{selectedRanges:n}=this.state,i=pt.isSelected(n,e),o=i||_e.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,o,!1)}handleItemDoubleClick(e,t){var{isDoubleClickSelect:n,onSelect:i}=this.props;n&&this.setState(o=>{var{selectedRanges:a}=o;return{selectedRanges:pt.selectRange(a,[e,e])}},()=>{i(e,t)})}handleItemMouseDown(e,t){var{selectedRanges:n}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&n.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){vo.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){vo.debug2("item focus",e,t.target),this.setState(n=>{var{focusIndex:i}=n;return i!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){var{isDragSelect:n,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>fo&&c>fo&&this.setState({isDragging:!0}),(n||a===e)&&(this.focusItem(e),i?(!n&&!this.getItemSelected(e,s)&&!_e.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(a,e),Math.max(a,e)])):this.toggleSelect(e,t.shiftKey,_e.isModifierKeyDown(t),!1))}}handleItemMouseUp(e,t){var{isDeselectOnClick:n,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=_e.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,l,d,n),!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:n,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=n-1;else if(e.key==="ArrowDown")a!=null&&a>=0?a=Math.min(a+1,n-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:n}=e;this.setState(i=>{if(t)return{scrollOffset:n};var{isStickyBottom:o}=this.props,{height:a}=i,s=o&&this.isListAtBottom({scrollOffset:n,height:a});return{isStuckToBottom:s,scrollOffset:n}})}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,n){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&&n?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){pt.validateRange(e),this.setState(t=>{var{selectedRanges:n}=t;return{selectedRanges:pt.deselectRange(n,e)}})}selectItem(e){var{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){pt.validateRange(e),this.setState(t=>{var{selectedRanges:n}=t;return{selectedRanges:pt.selectRange(n,e)}})}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){var{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){var{onViewportChange:n,rowHeight:i}=this.props,o=Math.floor(e/i),a=o+Math.ceil(t/i);n(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:n,rowHeight:i}=this.props;return e+t>=n*i}renderInnerElement(e){var{index:t,style:n}=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,n,s)}render(){var{items:e,itemCount:t,overscanCount:n,renderItem:i,rowHeight:o,"data-testid":a}=this.props,{selectedRanges:s,isStuckToBottom:l}=this.state;return u.jsx(Ql,{className:"item-list-auto-sizer",onResize:this.handleResize,children:d=>{var{width:h,height:c}=d;return u.jsx(Jl,{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:n,"data-testid":a,children:this.renderInnerElement})}})}}ct(at,"CACHE_SIZE",1e3);ct(at,"DEFAULT_ROW_HEIGHT",20);ct(at,"DEFAULT_OVERSCAN",10);ct(at,"defaultProps",{offset:0,items:[],rowHeight:at.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:at.DEFAULT_OVERSCAN,renderItem:at.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0});var $h=K.module("ErrorBoundary");class Hh extends m.Component{static getDerivedStateFromError(e){return{error:e}}constructor(e){super(e),this.state={error:void 0}}componentDidCatch(e,t){var{onError:n}=this.props;$h.error("Error caught by ErrorBoundary",e,t),n==null||n(e,t)}render(){var{children:e,className:t,fallback:n}=this.props,{error:i}=this.state;return i!=null?n??u.jsx("div",{className:t,children:u.jsx(un,{errorMessage:"".concat(i),isLoading:!1,isLoaded:!1,"data-testid":"error-boundary-loading"})}):e??null}}function Bh(r){var{on:e,id:t,className:n,isInvalid:i,disabled:o=!1,onClick:a,"data-testid":s}=r;return u.jsx("button",{type:"button",className:Y("btn","btn-switch",n,{active:e},{"is-invalid":i}),id:t,onClick:a,disabled:o,"data-testid":s,children:u.jsx("div",{className:"handle"})})}var Wh=["className","timeout"];function po(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Uh(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?po(Object(t),!0).forEach(function(n){Vh(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):po(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Vh(r,e,t){return(e=Kh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Kh(r){var e=zh(r,"string");return typeof e=="symbol"?e:e+""}function zh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Gh(r,e){if(r==null)return{};var t,n,i=qh(r,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(n=0;n<o.length;n++)t=o[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(r,t)&&(i[t]=r[t])}return i}function qh(r,e){if(r==null)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.indexOf(n)!==-1)continue;t[n]=r[n]}return t}function xy(r){var{className:e,timeout:t=Ya.transitionMs}=r,n=Gh(r,Wh);return u.jsx(za,Uh({timeout:t,classNames:Y("fade",e)},n))}var Xh=["children","className","isInvalid","onChange","data-testid"];function go(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function bo(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?go(Object(t),!0).forEach(function(n){Zh(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):go(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Zh(r,e,t){return(e=Yh(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Yh(r){var e=Qh(r,"string");return typeof e=="symbol"?e:e+""}function Qh(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Jh(r,e){if(r==null)return{};var t,n,i=ec(r,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(n=0;n<o.length;n++)t=o[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(r,t)&&(i[t]=r[t])}return i}function ec(r,e){if(r==null)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.indexOf(n)!==-1)continue;t[n]=r[n]}return t}var Ns=R.forwardRef((r,e)=>{var{children:t,className:n,isInvalid:i,onChange:o,"data-testid":a}=r,s=Jh(r,Xh),l=Es(e),d=m.useCallback(h=>{o(h.target.value)},[o]);return u.jsx("select",bo(bo({ref:l,className:Y("custom-select",n,{"is-invalid":i}),onChange:d,"data-testid":a},s),{},{children:t}))});Ns.displayName="Select";var Si=R.createContext(new Map);Si.displayName="XComponentMapContext";var Iy=Si.Provider;function tc(r){var e,t=m.useContext(Si);return(e=t.get(r))!==null&&e!==void 0?e:r.Original}function yo(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Gr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?yo(Object(t),!0).forEach(function(n){nc(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):yo(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function nc(r,e,t){return(e=rc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function rc(r){var e=ic(r,"string");return typeof e=="symbol"?e:e+""}function ic(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function js(r){var e,t;function n(i,o){var a=tc(t);return xs(r)?u.jsx(a,Gr(Gr({},i),{},{ref:o})):u.jsx(a,Gr({},i))}return n.displayName="XComponent(".concat((e=r.displayName)!==null&&e!==void 0?e:r.name,")"),t=m.forwardRef(n),t.Original=r,t.isXComponent=!0,t}function oc(){return Xn(pd,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function As(r){return typeof r=="object"&&r!=null&&typeof r.type=="string"&&r.name!=null}function Ls(r){return typeof r=="object"&&r!=null&&typeof r.type=="string"&&r.id!=null}function Dy(r){return As(r)||Ls(r)}var Rs=m.createContext(null);Rs.displayName="ObjectFetcherContext";function ky(r){if(Ls(r))return{id:r.id,type:r.type};if(As(r)){var e;return{name:(e=r.name)!==null&&e!==void 0?e:"",type:r.type}}throw new Error("Invalid descriptor: ".concat(r))}function ac(r){var e,t;return{type:(e=r.type)!==null&&e!==void 0?e:"",name:(t=r.title)!==null&&t!==void 0?t:r.name,id:r.id}}function My(){return Xn(Rs,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}function Co(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function sc(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Co(Object(t),!0).forEach(function(n){lc(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Co(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function lc(r,e,t){return(e=dc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function dc(r){var e=uc(r,"string");return typeof e=="symbol"?e:e+""}function uc(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var wi=Object.freeze({}),hc=new Map,Ny=r=>r.api,jy=r=>r.user,Fs=r=>r.storage,$s=r=>Fs(r).commandHistoryStorage,Hs=r=>Fs(r).fileStorage,cc=r=>r.defaultWorkspaceSettings,Bs=r=>{var{workspace:e}=r;return e},Fe=ed(r=>{for(var e,t,n=(e=(t=Bs(r))===null||t===void 0?void 0:t.data.settings)!==null&&e!==void 0?e:{},i=sc({},cc(r)),o=Object.keys(n),a=0;a<o.length;a+=1){var s=o[a];n[s]!==void 0&&(i[s]=n[s])}return i}),Ay=r=>r.defaultWorkspaceSettings,Ly=r=>Fe(r).defaultDateTimeFormat,Ry=r=>{var e;return(e=Fe(r).defaultDecimalFormatOptions)!==null&&e!==void 0?e:wi},Fy=r=>{var e;return(e=Fe(r).defaultIntegerFormatOptions)!==null&&e!==void 0?e:wi},$y=r=>{var e;return(e=Fe(r).formatter)!==null&&e!==void 0?e:[]},mc=r=>Fe(r).timeZone,Hy=r=>Fe(r).showTimeZone,By=r=>Fe(r).showTSeparator,Wy=r=>Fe(r).truncateNumbersWithPound,Uy=r=>Fe(r).showEmptyStrings,Vy=r=>Fe(r).showNullStrings,Ky=r=>Fe(r).showExtraGroupColumn,zy=r=>Fe(r).shortcutOverrides,Gy=r=>Fe(r).webgl,qy=r=>Fe(r).webglEditable,Ws=r=>{var e;return(e=Fe(r).notebookSettings)!==null&&e!==void 0?e:wi},Xy=r=>r.activeTool,vc=r=>{var e;return(e=r.plugins)!==null&&e!==void 0?e:hc};function So(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function kt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?So(Object(t),!0).forEach(function(n){fc(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):So(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function fc(r,e,t){return(e=pc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function pc(r){var e=gc(r,"string");return typeof e=="symbol"?e:e+""}function gc(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Zy=r=>({type:Cd,payload:r}),Yy=r=>({type:Sd,payload:r}),Us=r=>({type:gd,payload:r}),Qy=r=>({type:wd,payload:r}),Jy=r=>({type:Ed,payload:r}),eC=r=>({type:_d,payload:r}),tC=r=>({type:Pd,payload:r}),bc=r=>(e,t)=>{e(Us(r));var{storage:n}=t(),{workspaceStorage:i}=n;return i==null?void 0:i.save(r)},yc=r=>(e,t)=>{var{workspace:n}=t(),{data:i}=n??{},o=kt(kt({},n),{},{data:kt(kt(kt({},i),r),{},{settings:kt(kt({},i==null?void 0:i.settings),r.settings)})});return e(bc(o))},Cc=r=>(e,t)=>{var{notebookSettings:n}=Fe(t()),i=kt(kt({},n),r);return e(Sc({notebookSettings:i}))},Sc=r=>e=>e(yc({settings:r})),nC=r=>({type:bd,payload:r}),rC=r=>({type:yd,payload:r}),iC=r=>({type:Td,payload:r});function wo(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Eo(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wo(Object(t),!0).forEach(function(n){wc(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):wo(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function wc(r,e,t){return(e=Ec(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ec(r){var e=_c(r,"string");return typeof e=="symbol"?e:e+""}function _c(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Pc(r){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 n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,i=arguments.length>1?arguments[1]:void 0;switch(i==null?void 0:i.type){case r:{var{id:o,payload:a}=i;return t&&Vn({payload:a},{payload:n[o]})?n:Eo(Eo({},n),{},{[o]:a})}default:return n}}}function Vs(r){var{type:e}=r,t=oc();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(fe,{icon:xd});case t.VariableType.FIGURE:return u.jsx(fe,{icon:is});case t.VariableType.PANDAS:return u.jsx(fe,{icon:Od});default:return u.jsx(fe,{icon:rs})}}function _o(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function Tc(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){_o(o,n,i,a,s,"next",l)}function s(l){_o(o,n,i,a,s,"throw",l)}a(void 0)})}}function Ks(r){var{children:e,language:t}=r,[n,i]=m.useState(null),{activeThemes:o}=_s();return m.useEffect(()=>{var a=!1;function s(){return l.apply(this,arguments)}function l(){return l=Tc(function*(){if(e!=null&&o!=null){var d=yield De.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:n!=null?{__html:n}:void 0})}class zs{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}class Sr{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)?[]:td.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"),n="".concat(e.getMinutes()).padStart(2,"0"),i="".concat(e.getSeconds()).padStart(2,"0"),o="".concat(e.getMilliseconds()).padStart(3,"0");return"".concat(t,":").concat(n,":").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 Sr.isTableType(e,t)||Sr.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}function Gs(r){var{children:e}=r;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})]})}Gs.propTypes={children:S.node.isRequired};function si(r,e,t){return(e=Oc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Oc(r){var e=xc(r,"string");return typeof e=="symbol"?e:e+""}function xc(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class qs extends m.Component{constructor(e){super(e),si(this,"timer",void 0),si(this,"startTime",void 0),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=window.setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer!=null&&clearInterval(this.timer),this.timer=void 0}updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){var{disabled:e,onCancelClick:t}=this.props,{elapsed:n}=this.state;return u.jsx("div",{className:Y("console-history-result-in-progress",{disabled:e}),children:u.jsxs("span",{className:"badge",children:[u.jsx(os,{className:"ml-2"}),"Running... ",Dn.formatElapsedTime(n)," ",u.jsx(ie,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:Id,tooltip:"Cancel",onClick:t,disabled:e})]})})}}si(qs,"defaultProps",{disabled:!1});function Un(r,e,t){return(e=Ic(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ic(r){var e=Dc(r,"string");return typeof e=="symbol"?e:e+""}function Dc(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class _n extends m.PureComponent{constructor(e){super(e),Un(this,"mouseX",void 0),Un(this,"mouseY",void 0),Un(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)>=_n.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=_n.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:n}=this.props;$(n);var i=n.trimEnd(),o=i.indexOf(`
|
|
4
4
|
`),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:Y("error-message",{expanded:e}),children:[a&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"error-gutter",children:u.jsx("button",{type:"button",onClick:this.handleToggleError,className:d,tabIndex:-1,children:u.jsx(fe,{icon:e?ni:Dd,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")}}Un(_n,"defaultProps",{message:""});Un(_n,"mouseDragThreshold",5);function kc(r,e,t){return(e=Mc(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Mc(r){var e=Nc(r,"string");return typeof e=="symbol"?e:e+""}function Nc(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Po=K.module("ConsoleHistoryItem");class Xs extends m.PureComponent{constructor(e){super(e),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){Po.debug("handleObjectClick",e);var{openObject:t}=this.props;t(e)}handleCancelClick(){var{item:e}=this.props;e!=null&&e.cancelResult&&(Po.debug("Cancelling command: ".concat(e.command)),e.cancelResult())}render(){var{disabled:e,item:t,language:n,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(Ks,{language:n,children:t.command})})]}));var d=[],h=!1;if(a){var{error:c,message:v,changes:f}=a;if(f){var{created:p,updated:g}=f;[...p,...g].forEach(ee=>{h=!0;var{title:j}=ee,W="".concat(j),H=e===void 0||e||(o??[]).indexOf(W)>=0,ne=u.jsx(ie,{kind:"primary",onClick:()=>this.handleObjectClick(ee),className:"btn-console-object",disabled:H,icon:i(ee.type),children:j},W);d.push(ne)})}if(c!=null&&!s){var b,E="".concat((b=c.message)!==null&&b!==void 0?b:c);E||(E=c);var x=u.jsx(_n,{message:E},"result-error");d.push(x)}if(v!==void 0&&v!==""){var P=u.jsx("div",{className:"log-message",children:v},"log-message");d.push(P)}}else{h=!0;var F=u.jsx(qs,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");d.push(F)}var U=null;return d.length>0&&(U=u.jsx(Gs,{children:d})),u.jsxs("div",{className:Y("console-command-result",{"console-result-buttons":h}),children:[l,U]})}}kc(Xs,"defaultProps",{disabled:!1});function jc(r,e){return"".concat(r,".").concat(e.command,".").concat(e.result&&e.result.message,".").concat(e.result&&e.result.error)}var Ac=R.forwardRef(function(e,t){for(var{disabled:n=!1,items:i,language:o,openObject:a,supportsType:s,iconForType:l}=e,d=[],h=0;h<i.length;h+=1){var c=i[h],v=u.jsx(Xs,{disabled:n,item:c,openObject:a,language:o,supportsType:s,iconForType:l},jc(h,c));d.push(v)}return u.jsx("div",{ref:t,className:"container-fluid console-history",children:d})}),Lc={name:"Console",CLEAR:he.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[k.CTRL,I.L],macShortcut:[k.CTRL,I.C]}),FOCUS_HISTORY:he.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[k.CTRL,I.H],macShortcut:[k.CTRL,k.OPTION,I.H]})},Rc={name:"Command History",FOCUS_HISTORY:he.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[k.CTRL,I.H],macShortcut:[k.CTRL,k.OPTION,I.H]}),SEND_TO_CONSOLE:he.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[I.ENTER],macShortcut:[I.ENTER]}),SEND_TO_NOTEBOOK:he.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[k.CTRL,I.ENTER],macShortcut:[k.CMD,I.ENTER]}),RUN:he.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[k.ALT,I.R],macShortcut:[k.OPTION,I.R]})},Fc={name:"Notebook",RUN:he.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[k.ALT,I.R],macShortcut:[k.OPTION,I.R]}),RUN_SELECTED:he.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[k.ALT,k.SHIFT,I.R],macShortcut:[k.OPTION,k.SHIFT,I.R]}),FIND:he.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[k.CTRL,I.F],macShortcut:[k.CMD,I.F],isEditable:!1}),MINIMAP:he.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[k.ALT,I.M],macShortcut:[k.OPTION,I.M]}),WORDWRAP:he.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[k.ALT,I.Z],macShortcut:[k.OPTION,I.Z]})},Ve={CONSOLE:Lc,COMMAND_HISTORY:Rc,NOTEBOOK:Fc};const Ie=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),$c="var(--dh-color-editor-bg)",Hc="var(--dh-color-editor-fg)",Bc="var(--dh-color-editor-string)",Wc="var(--dh-color-editor-delimiter)",Uc="var(--dh-color-editor-predefined)",Vc="var(--dh-color-editor-keyword)",Kc="var(--dh-color-editor-storage)",zc="var(--dh-color-editor-number)",Gc="var(--dh-color-editor-operator)",qc="var(--dh-color-editor-identifier)",Xc="var(--dh-color-editor-comment)",li={"error-foreground":"var(--dh-color-editor-error-fg)",background:$c,foreground:Hc,"line-height":"19px",string:Bc,"string-delim":"var(--dh-color-editor-string-delim)",delimiter:Wc,predefined:Uc,keyword:Vc,storage:Kc,number:zc,operator:Gc,identifier:qc,"namespace-identifier":"var(--dh-color-editor-identifier-namespace)","identifier-js":"var(--dh-color-editor-identifier-js)",comment:Xc,"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 Zc="python",Yc={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/}}},Qc={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"]]}},Jc={id:Zc,conf:Yc,language:Qc},em="groovy",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","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"]]}},rm={id:em,conf:tm,language:nm},im="scala",om={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>))/}}},am={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"]]}},sm={id:im,conf:om,language:am},lm="deephavenDb",dm={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/}}},um={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"]]}},hm={id:lm,conf:dm,language:um},cm="log",mm={},vm={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"}]]}},fm={id:cm,conf:mm,language:vm},pm={preview:!0,"target-version":"py38","line-length":88,"indent-width":4,format:{"indent-style":"space","quote-style":"double"},lint:{"flake8-implicit-str-concat":{"allow-multiline":!1},ignore:["ISC003"],select:["F","E1","E9","E711","W291","W293","W605","B","A","COM818","ISC","PLE","RUF001","RUF021","RUF027","PLR1704","LOG","ASYNC","RET501","RET502","RET503","PLC2401","PLC2403","NPY","PERF","C4"]}};function To(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function gm(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){To(o,n,i,a,s,"next",l)}function s(l){To(o,n,i,a,s,"throw",l)}a(void 0)})}}function Zt(r,e,t){return(e=bm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bm(r){var e=ym(r,"string");return typeof e=="symbol"?e:e+""}function ym(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var lt=K.module("MonacoCompletionProvider");class B extends m.PureComponent{static initRuff(){return gm(function*(){if(B.isRuffEnabled)return B.initRuffPromise||(B.initRuffPromise=nd({}).then(()=>{lt.debug("Initialized Ruff",$i.version()),B.isRuffInitialized=!0,B.updateRuffWorkspace()})),B.initRuffPromise})()}static updateRuffWorkspace(){if(B.isRuffInitialized){var e=console.log;try{console.log=()=>{},B.ruffWorkspace=new $i(B.ruffSettings)}finally{console.log=e}B.lintAllPython()}}static setRuffSettings(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:B.ruffSettings;if(B.ruffSettings=e,!B.isRuffInitialized){B.initRuff();return}B.updateRuffWorkspace()}static getDiagnostics(e){if(!B.ruffWorkspace)return[];var t=B.ruffWorkspace.check(e.getValue());return ve.isConsoleModel(e)?t.filter(n=>n.code==null):t}static lintAllPython(){if(!B.isRuffEnabled){De.removeAllMarkers("ruff");return}De.getModels().filter(e=>e.getLanguageId()==="python").forEach(B.lintPython)}static lintPython(e){if(B.isRuffEnabled&&B.ruffWorkspace){var t=B.getDiagnostics(e);lt.debug("Linting Python document: ".concat(e.uri.toString()),t),De.setModelMarkers(e,"ruff",t.map(n=>{var i=n.code==="F401"||n.code==="F841",o=n.code==null;return{startLineNumber:n.location.row,startColumn:n.location.column,endLineNumber:n.end_location.row,endColumn:n.end_location.column,message:o?n.message:"".concat(n.code,": ").concat(n.message),severity:o?Ki.Error:Ki.Warning,tags:i?[eu.Unnecessary]:[]}}))}}static lspToMonacoKind(e){var t=it.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:n}=e;return{startLineNumber:t.line+1,startColumn:t.character+1,endLineNumber:n.line+1,endColumn:n.character+1}}static monacoToLspPosition(e){return{line:e.lineNumber-1,character:e.column-1}}static handlePythonCodeActionRequest(e,t){if(!B.isRuffEnabled||!B.ruffWorkspace)return{actions:[],dispose:()=>{}};var n=B.getDiagnostics(e).filter(d=>{var h=new cs(d.location.row,d.location.column,d.end_location.row,d.end_location.column);return d.code!=null&&h.intersectRanges(t)}),i=n.filter(d=>{var{fix:h}=d;return h!=null}).map(d=>{var h="Fix";return d.fix!=null&&(d.fix.message!=null&&d.fix.message!==""?h="".concat(d.code,": ").concat(d.fix.message):h="Fix ".concat(d.code)),{title:h,id:"fix-".concat(d.code),kind:"quickfix",edit:d.fix?{edits:d.fix.edits.map(c=>{var v;return{resource:e.uri,versionId:e.getVersionId(),textEdit:{range:{startLineNumber:c.location.row,startColumn:c.location.column,endLineNumber:c.end_location.row,endColumn:c.end_location.column},text:(v=c.content)!==null&&v!==void 0?v:""}}})}:void 0}}),o=new Set,a=new Set;n.forEach(d=>{d.code!=null&&(o.has(d.code)&&a.add(d.code),o.add(d.code))});var s=n.map(d=>{if(d.code==null)return[];var h=e.getLineContent(d.location.row),c=De.tokenize(h,e.getLanguageId())[0].at(-1),v={range:{startLineNumber:d.location.row,startColumn:h.length+1,endLineNumber:d.location.row,endColumn:h.length+1},text:" # noqa: ".concat(d.code)};return c!=null&&c.type.startsWith("comment")&&(v.text="# noqa: ".concat(d.code," "),h.startsWith("# noqa:",c.offset)?(v.range.startColumn=c.offset+1,v.range.endColumn=c.offset+9):(v.range.startColumn=c.offset+1,v.range.endColumn=h.startsWith("# ",c.offset)?c.offset+3:c.offset+2)),[{title:"Disable ".concat(d.code," for ").concat(a.has(d.code)?"line ".concat(d.location.row):"this line"),kind:"quickfix",edit:{edits:[{resource:e.uri,versionId:e.getVersionId(),textEdit:v}]}}]}).flat().filter((d,h,c)=>c.find(v=>v.title===d.title)===d),l=[...o].map(d=>({title:"Disable ".concat(d," for this file"),kind:"quickfix",edit:{edits:[{resource:e.uri,versionId:e.getVersionId(),textEdit:{range:{startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:1},text:"# ruff: noqa: ".concat(d,`
|
|
5
5
|
`)}}]}}));return{actions:[...i,...s,...l],dispose:()=>{}}}static handlePythonFormatRequest(e,t,n){if(B.ruffWorkspace)return lt.debug("Formatting Python document: ".concat(e.uri.toString)),[{range:e.getFullModelRange(),text:B.ruffWorkspace.format(e.getValue())}]}constructor(e){super(e),Zt(this,"registeredCompletionProvider",void 0),Zt(this,"registeredSignatureProvider",void 0),Zt(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=it.registerCompletionItemProvider(e,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),t.getSignatureHelp!=null&&(this.registeredSignatureProvider=it.registerSignatureHelpProvider(e,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),t.getHover!=null&&(this.registeredHoverProvider=it.registerHoverProvider(e,{provideHover:this.handleHoverRequest}))}componentWillUnmount(){var e,t,n;(e=this.registeredCompletionProvider)===null||e===void 0||e.dispose(),(t=this.registeredSignatureProvider)===null||t===void 0||t.dispose(),(n=this.registeredHoverProvider)===null||n===void 0||n.dispose()}handleCompletionRequest(e,t,n){var{model:i,session:o}=this.props;if(e!==i)return null;var a={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:B.monacoToLspPosition(t),context:n},s=o.getCompletionItems(a);lt.debug("Requested completion items",a);var l=s.then(d=>{lt.debug("Completion items received: ",a,d);var h=d.map(c=>{var{label:v,kind:f,detail:p,documentation:g,sortText:b,filterText:E,textEdit:x,insertTextFormat:P}=c;return{label:v,kind:B.lspToMonacoKind(f),detail:p,documentation:(g==null?void 0:g.kind)==="markdown"?g:g==null?void 0:g.value,sortText:b,filterText:E,insertText:x.text,insertTextRules:P===2?4:P,range:B.lspToMonacoRange(x.range)}});return{incomplete:!0,suggestions:h}}).catch(d=>(lt.error("There was an error retrieving completion items",d),{suggestions:[]}));return l}handleSignatureRequest(e,t,n,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:B.monacoToLspPosition(t),context:i},d=s.getSignatureHelp(l);lt.debug("Requested signature help",l);var h=d.then(c=>{lt.debug("Signatures received: ",l,d);var v=c.map(p=>{var{label:g,documentation:b,parameters:E}=p;return{documentation:(b==null?void 0:b.kind)==="markdown"?b:b==null?void 0:b.value,label:g,parameters:E??[]}});if(v.length===0)return o;var f=0;return{value:{signatures:v,activeSignature:f,activeParameter:c[f].activeParameter},dispose:()=>{}}}).catch(c=>(lt.error("There was an error retrieving completion items",c),o));return h}handleHoverRequest(e,t){var{model:n,session:i}=this.props;if(e!==n||i.getHover==null)return null;var o={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:B.monacoToLspPosition(t)},a=i.getHover(o);lt.debug("Requested hover",o);var s=a.then(l=>{lt.debug("Hover received: ",o,l);var{contents:d}=l;return{contents:d!=null?[d]:[]}}).catch(l=>(lt.error("There was an error retrieving hover",l),{contents:[]}));return s}render(){return null}}Zt(B,"ruffWorkspace",void 0);Zt(B,"initRuffPromise",void 0);Zt(B,"isRuffInitialized",!1);Zt(B,"isRuffEnabled",!0);Zt(B,"ruffSettings",pm);function Oo(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function Cm(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Oo(o,n,i,a,s,"next",l)}function s(l){Oo(o,n,i,a,s,"throw",l)}a(void 0)})}}function xo(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Io(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xo(Object(t),!0).forEach(function(n){Sm(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):xo(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Sm(r,e,t){return(e=wm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function wm(r){var e=Em(r,"string");return typeof e=="symbol"?e:e+""}function Em(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ot=K.module("MonacoUtils"),Do="inmemory://dh-console/";class ve{static init(){var{getWorker:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ot.debug("Initializing Monaco..."),e!==void 0&&ve.registerGetWorker(e);var{initTheme:t,registerLanguages:n}=ve;t(),n([hm,Jc,rm,fm,sm]),it.onLanguage("python",()=>{it.registerCodeActionProvider("python",{provideCodeActions:B.handlePythonCodeActionRequest},{providedCodeActionKinds:["quickfix"]}),it.registerDocumentFormattingEditProvider("python",{provideDocumentFormattingEdits:B.handlePythonFormatRequest})}),De.onDidCreateModel(i=>{if(i.getLanguageId()==="python"){B.ruffWorkspace!=null&&B.lintPython(i);var o=Ir(a=>B.lintPython(a),250);i.onDidChangeContent(()=>{o(i)})}}),ve.removeConflictingKeybindings(),Ot.debug("Monaco initialized.")}static initTheme(){var e,t,{removeHashtag:n}=ve,i=as(li);Ot.debug2("Monaco theme:",li),Ot.debug2("Monaco theme derived:",i);var o=[{token:"",foreground:n(i.foreground)},{token:"string",foreground:n(i.string)},{token:"string.delim",foreground:n(i["string-delim"])},{token:"keyword",foreground:n(i.keyword)},{token:"identifier.js",foreground:n(i["identifier-js"])},{token:"delimiter",foreground:n(i.delimiter)},{token:"comment",foreground:n(i.comment)},{token:"number",foreground:n(i.number)},{token:"storage",foreground:n(i.storage)},{token:"identifier",foreground:n(i.identifier)},{token:"namespace.identifier",foreground:n(i["namespace-identifier"])},{token:"operator",foreground:n(i.operator)},{token:"predefined",foreground:n(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:n(i["log-warn"])},{token:"info.log",foreground:n(i["log-info"])},{token:"stdout.log",foreground:n(i["log-stdout"])},{token:"trace.log",foreground:n(i["log-trace"])},{token:"debug.log",foreground:n(i["log-debug"])},{token:"date.log",foreground:n(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"]};De.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:o,colors:a});try{De.setTheme("dh-dark")}catch(s){Ot.error("Failed to set 'dh-dark' Monaco theme, falling back to vs-dark",s),De.setTheme("vs-dark")}}static registerGetWorker(e){window.MonacoEnvironment=Io(Io({},window.MonacoEnvironment),{},{getWorker:e})}static removeHashtag(e){var t;return(t=e==null?void 0:e.substring(1))!==null&&t!==void 0?t:""}static registerLanguages(e){var t=e.map(n=>{var{id:i}=n;return i});it.getLanguages().filter(n=>{var{id:i}=n;return t.includes(i)}).forEach(n=>{var i=n;Ot.debug2("Overriding default language loader:",i.id)}),e.forEach(n=>{ve.registerLanguage(n)})}static registerLanguage(e){Ot.debug2("Registering language: ",e.id),it.register(e),it.onLanguage(e.id,()=>{it.setLanguageConfiguration(e.id,e.conf),it.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:De.EndOfLineSequence.LF;(t=e.getModel())===null||t===void 0||t.setEOL(n)}static openDocument(e,t){var n=e.getModel();$(n);var i={textDocument:{uri:"".concat(n.uri),languageId:n.getLanguageId(),version:n.getVersionId(),text:n.getValue()}};Ot.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:v,rangeLength:f,text:p}=c,g={range:{start:{line:v.startLineNumber-1,character:v.startColumn-1},end:{line:v.endLineNumber-1,character:v.endColumn-1}},rangeLength:f,text:p};d.push(g)}if(d.length>0){var b={textDocument:{version:l,uri:"".concat(n.uri)},contentChanges:d};Ot.debug2("didChangeDocumentParams",b),t.changeDocument(b)}});return o}static closeDocument(e,t){var n=e.getModel();$(n);var i={textDocument:{uri:"".concat(n.uri)}};t.closeDocument(i)}static registerPasteHandler(e){e.onDidPaste(t=>{var n=/“|”/g,i=/\u200b/g,o=/\u00A0/g,a=e.getModel();$(a);var s=a.getValueInRange(t.range);(n.test(s)||i.test(s)||o.test(s))&&a.applyEdits([{range:t.range,text:s.replace(n,'"').replace(i,"").replace(o," ")}])})}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static removeConflictingKeybindings(){De.addKeybindingRule({keybinding:rt.CtrlCmd|Xt.KeyD,command:null}),ve.isMacPlatform()||De.addKeybindingRule({keybinding:rt.CtrlCmd|Xt.KeyH,command:null})}static disableKeyBindings(e,t){e.addAction({id:"disable-keybindings-".concat(Et()),label:"",keybindings:t,run:()=>{}})}static getMonacoKeyCodeFromShortcut(e){var{keyState:t}=e,{keyValue:n}=t;if(n===null)return 0;var i=ve.isMacPlatform();return i?(t.metaKey?rt.CtrlCmd:0)|(t.shiftKey?rt.Shift:0)|(t.altKey?rt.Alt:0)|(t.ctrlKey?rt.WinCtrl:0)|zi.fromString(n):(t.ctrlKey?rt.CtrlCmd:0)|(t.shiftKey?rt.Shift:0)|(t.altKey?rt.Alt:0)|(t.metaKey?rt.WinCtrl:0)|zi.fromString(n)}static provideLinks(e){for(var t=[],n=function(a){var s=e.getLineContent(a),l=rd(s),d=l.filter(h=>h.type==="url"?/^https?:\/\//.test(h.value):!0);d.forEach(h=>{t.push({url:h.href,range:new cs(a,h.start+1,a,h.end+1)})})},i=1;i<=e.getLineCount();i+=1)n(i);return{links:t}}static generateConsoleUri(){return tu.parse("".concat(Do).concat(Et()))}static isConsoleModel(e){return e.uri.toString().startsWith(Do)}static canFormat(e){var t;return((t=e.getAction("editor.action.formatDocument"))===null||t===void 0?void 0:t.isSupported())===!0}static formatDocument(e){return Cm(function*(){var t;yield(t=e.getAction("editor.action.formatDocument"))===null||t===void 0?void 0:t.run()})()}}function ko(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function _m(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ko(Object(t),!0).forEach(function(n){wr(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ko(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function wr(r,e,t){return(e=Pm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Pm(r){var e=Tm(r,"string");return typeof e=="symbol"?e:e+""}function Tm(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Zs extends m.Component{constructor(e){super(e),wr(this,"container",void 0),wr(this,"editor",void 0),this.handleResize=this.handleResize.bind(this),this.container=null,this.state={}}componentDidMount(){this.initEditor(),window.addEventListener("resize",this.handleResize)}componentWillUnmount(){window.removeEventListener("resize",this.handleResize),this.destroyEditor()}setLanguage(e){if(this.editor){var t=this.editor.getModel();$(t),De.setModelLanguage(t,e)}}handleResize(){this.updateDimensions()}toggleFind(){this.editor&&(this.editor.focus(),this.editor.trigger("toggleFind","actions.find",void 0))}updateDimensions(){var e;(e=this.editor)===null||e===void 0||e.layout()}initEditor(){var{onEditorInitialized:e}=this.props,{settings:t}=this.props;t=_m({copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"python",lineNumbersMinChars:3,minimap:{enabled:!1},scrollBeyondLastLine:!1,tabCompletion:"on",value:"",wordWrap:"off",links:!0,autoClosingBrackets:"beforeWhitespace"},t),$(this.container),this.editor=De.create(this.container,t),this.editor.addAction({id:"find",label:"Find",keybindings:[rt.CtrlCmd|Xt.KeyF],precondition:void 0,keybindingContext:void 0,contextMenuGroupId:"navigation",contextMenuOrder:1,run:()=>{this.toggleFind()}}),this.editor.layout(),it.registerLinkProvider("plaintext",{provideLinks:ve.provideLinks}),e(this.editor)}destroyEditor(){var{onEditorWillDestroy:e}=this.props;$(this.editor),e(this.editor),this.editor.dispose(),this.editor=void 0}render(){var{className:e}=this.props;return u.jsx("div",{className:Y("editor-container",e),ref:t=>{this.container=t}})}}wr(Zs,"defaultProps",{className:"fill-parent-absolute",onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},settings:{}});function Mo(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function Om(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Mo(o,n,i,a,s,"next",l)}function s(l){Mo(o,n,i,a,s,"throw",l)}a(void 0)})}}function nt(r,e,t){return(e=xm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function xm(r){var e=Im(r,"string");return typeof e=="symbol"?e:e+""}function Im(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var qr=K.module("ConsoleInput"),Er=parseInt(li["line-height"],10),Ys=6,Qs=6,Dm=Er+Ys+Qs,Xr=100;class Pn extends m.PureComponent{constructor(e){super(e),nt(this,"cancelListener",void 0),nt(this,"resizeObserver",void 0),nt(this,"commandContainer",void 0),nt(this,"commandEditor",void 0),nt(this,"commandHistoryIndex",void 0),nt(this,"commandSuggestionContainer",void 0),nt(this,"loadingPromise",void 0),nt(this,"timestamp",void 0),nt(this,"bufferIndex",void 0),nt(this,"history",void 0),nt(this,"modifiedCommands",void 0),this.handleResize=this.handleResize.bind(this),this.commandContainer=R.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:Er,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,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(e){if(qr.debug("Command received: ",e),!n){var i;this.commandHistoryIndex=null,(i=this.commandEditor)===null||i===void 0||i.setValue(e)}t&&this.focusEnd(),this.updateDimensions(),n&&this.processCommand(e)}}initCommandEditor(){var{language:e,session:t}=this.props,n=De.createModel("",e,ve.generateConsoleUri()),i={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:Er,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:Ys,bottom:Qs},value:"",wordWrap:"on",autoClosingBrackets:"beforeWhitespace",model:n},o=this.commandContainer.current;$(o),this.commandEditor=De.create(o,i),ve.setEOL(this.commandEditor),ve.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{var a,s=(a=this.commandEditor)===null||a===void 0?void 0:a.getValue();this.modifiedCommands.set(this.commandHistoryIndex,s??null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(a=>{var{commandEditor:s,commandHistoryIndex:l}=this,d=s==null?void 0:s.getPosition();$(d);var{lineNumber:h}=d;if(!a.altKey&&!a.shiftKey&&!a.metaKey){if(a.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&h===1){l!=null?this.loadCommand(l+1):this.loadCommand(0),this.focusStart(),a.stopPropagation(),a.preventDefault();return}if(a.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&h===(n==null?void 0:n.getLineCount())){l!=null&&l>0?this.loadCommand(l-1):this.loadCommand(null),this.focusEnd(),a.stopPropagation(),a.preventDefault();return}if(a.keyCode===Xt.Enter&&!this.isSuggestionMenuPopulated()){var c;a.stopPropagation(),a.preventDefault();var v=(c=this.commandEditor)===null||c===void 0?void 0:c.getValue().trim();if(v!==void 0){var f;this.processCommand(v),(f=this.commandEditor)===null||f===void 0||f.setValue("")}}}}),ve.disableKeyBindings(this.commandEditor,[rt.CtrlCmd|Xt.KeyF]),ve.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.resizeObserver.observe(o),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){var{session:e}=this.props;this.commandEditor&&(ve.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleResize(){this.updateDimensions()}isSuggestionMenuActive(){var e;if(!this.commandSuggestionContainer){var t,n;this.commandSuggestionContainer=(t=this.commandEditor)===null||t===void 0||(n=t.getDomNode())===null||n===void 0?void 0:n.querySelector(".suggest-widget")}return(e=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!==null&&e!==void 0?e:!1}isSuggestionMenuPopulated(){var e,t,n;return this.isSuggestionMenuActive()&&((e=(t=this.commandSuggestionContainer)===null||t===void 0||(n=t.querySelector(".monaco-list-rows"))===null||n===void 0?void 0:n.childElementCount)!==null&&e!==void 0?e:0)>0}focus(){var e;(e=this.commandEditor)===null||e===void 0||e.focus()}focusStart(){var e,t,n,i,o,a=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();$(a);var s=a.getLineLength(1)+1,l=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(1,s);$(l),(n=this.commandEditor)===null||n===void 0||n.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,n,i,o,a=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();$(a);var s=a.getLineCount(),l=a.getLineLength(s)+1,d=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(s,l);$(d),(n=this.commandEditor)===null||n===void 0||n.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,n;(e=this.commandEditor)===null||e===void 0||e.focus(),(t=this.commandEditor)===null||t===void 0||(n=t.getModel())===null||n===void 0||n.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var t,n;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||(n=t.getModel())===null||n===void 0||n.setValue(i??o),e!==null&&e>this.history.length-Xr&&this.loadMoreHistory()}}loadMoreHistory(){var e=this;return Om(function*(){try{if(e.loadingPromise!=null||e.bufferIndex==null)return;var{commandHistoryStorage:t,language:n,scope:i}=e.props;e.loadingPromise=Te.makeCancelable(t.getTable(n,i??"",e.timestamp),s=>s.close());var o=yield e.loadingPromise;o.setReversed(!0),o.setViewport({top:e.bufferIndex,bottom:e.bufferIndex+Xr-1}),e.loadingPromise=Te.makeCancelable(o.getViewportData(),()=>o.close());var a=yield e.loadingPromise;e.bufferIndex+=Xr,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,Te.isCanceled(s)){qr.debug2("Promise canceled, not loading history");return}qr.error("Error fetching history",s)}})()}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),$(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;$(e);var t=this.commandEditor.getContentHeight(),n=Math.max(Math.min(t,e),Dm),i=t>n,o={overviewRulerLanes:i?void 0:0};this.setState({commandEditorHeight:n},()=>{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:n}=this.props,{commandEditorHeight:i,isFocused:o,model:a}=this.state;return u.jsx("div",{className:Y("console-input-wrapper",{disabled:e}),children:u.jsxs("div",{className:Y("console-input-inner-wrapper",{focus:o}),children:[u.jsx("div",{className:Pn.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:i}}),a&&u.jsx(B,{model:a,language:t,session:n})]})})}}nt(Pn,"defaultProps",{maxHeight:Er*10,scope:null,disabled:!1});nt(Pn,"INPUT_CLASS_NAME","console-input");function Vt(r,e,t){return(e=km(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function km(r){var e=Mm(r,"string");return typeof e=="symbol"?e:e+""}function Mm(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var No="pasted values",Nm=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],Zr=[".csv",".tsv",".tab",".psv",".dsv",".txt"],jo=[".zip"];class Ke extends m.Component{static isValidDropItem(e){return e!=null&&e.kind==="file"&&!Nm.find(t=>t.test(e.type))}static isValidExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Zr.some(n=>e.endsWith(n))||t&&jo.some(n=>e.endsWith(n))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===No?Wi:e.endsWith(".csv")?kd:e.endsWith(".zip")?Md:Nd}constructor(e){super(e),Vt(this,"fileElem",void 0),Vt(this,"divElem",void 0),Vt(this,"getValidExtensions",qt(t=>t?[...Zr,...jo]:[...Zr])),Vt(this,"getAcceptString",qt(t=>this.getValidExtensions(t).join(", "))),Vt(this,"getFileTypeErrorString",qt(t=>Cs.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=R.createRef(),this.divElem=R.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:n,dragError:i}=this.props;if(e.preventDefault(),e.stopPropagation(),i!=null){n();return}if(!(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)){var o=e.dataTransfer.items[0].getAsFile();$(o),Ke.isValidExtension(o.name,t)?this.handleFile(o):this.setState({dropError:Ke.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:n}=this.props;n||navigator.clipboard.readText().then(i=>{e(i),this.setState({selectedFileName:No,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:Wi,action:this.handleMenuPaste,shortcut:Kt.PASTE,disabled:e}]}render(){var{allowZip:e,dragError:t,uploadInProgress:n}=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:Ke.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[u.jsx(te,{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(fe,{icon:jd})}),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(ie,{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(fe,{icon:Ke.getIcon(i)})}),u.jsxs("div",{className:"selected-text",children:[u.jsx("label",{children:"Selected File"}),u.jsxs("label",{className:"selected-name",children:[i,!n&&u.jsx(ie,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:ss,tooltip:"Remove"})]})]})]}),!!a&&u.jsxs("div",{className:"message-content",children:[u.jsx("div",{className:"message-icon",children:u.jsx(fe,{icon:ls})}),u.jsx("label",{children:a}),a===Ke.FILE_TYPE_ERROR&&u.jsx("div",{className:"message-small",children:u.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}Vt(Ke,"defaultProps",{allowZip:!1,dragError:null});Vt(Ke,"MULTIPLE_FILE_ERROR","Please select only one file");Vt(Ke,"FILE_TYPE_ERROR","Filetype not supported.");function Ei(r,e,t){return(e=jm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jm(r){var e=Am(r,"string");return typeof e=="symbol"?e:e+""}function Am(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Me{static isValid(e,t){return!0}static isSameFormat(e,t){throw new Error("isSameFormat not implemented")}static makeFormat(e,t,n){return{label:e,formatString:t,type:n}}format(e,t){return""}}Ei(Me,"TYPE_GLOBAL","type-global");Ei(Me,"TYPE_CONTEXT_PRESET","type-context-preset");Ei(Me,"TYPE_CONTEXT_CUSTOM","type-context-custom");class Lm extends Me{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}class Rm extends Me{format(e){return String.fromCharCode(e)}}function Bt(r,e,t){return(e=Fm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Fm(r){var e=$m(r,"string");return typeof e=="symbol"?e:e+""}function $m(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ao=K.module("DateTimeColumnFormatter");class gt extends Me{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 n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Me.TYPE_CONTEXT_PRESET;return{label:e,formatString:t,type:n}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static makeGlobalFormatStringMap(e,t){var n=t?"'T'":" ",i=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(n,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(n,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(n,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getGlobalFormats(e,t){var n=gt.makeGlobalFormatStringMap(e,t);return[...n.keys()]}static makeFormatStringMap(e,t){var n=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(n,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(n,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(n,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getFormats(e,t){var n=gt.makeFormatStringMap(e,t);return[...n.keys()]}constructor(e){var{timeZone:t="",showTimeZone:n=!0,showTSeparator:i=!1,defaultDateTimeFormatString:o=gt.DEFAULT_DATETIME_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Bt(this,"dh",void 0),Bt(this,"dhTimeZone",void 0),Bt(this,"defaultDateTimeFormatString",void 0),Bt(this,"showTimeZone",void 0),Bt(this,"showTSeparator",void 0),Bt(this,"formatStringMap",void 0);var a=t||gt.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(a)}catch{Ao.error("Unsupported time zone id",a),this.dhTimeZone=e.i18n.TimeZone.getTimeZone(gt.DEFAULT_TIME_ZONE_ID)}this.dh=e,this.defaultDateTimeFormatString=o,this.showTimeZone=n,this.showTSeparator=i,this.formatStringMap=gt.makeFormatStringMap(n,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]:{},n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,i=this.getEffectiveFormatString(n);try{return this.dh.i18n.DateTimeFormat.format(i,e,this.dhTimeZone)}catch{Ao.error("Invalid format arguments")}return""}}Bt(gt,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");Bt(gt,"DEFAULT_TIME_ZONE_ID","America/New_York");function Ct(r,e,t){return(e=Hm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Hm(r){var e=Bm(r,"string");return typeof e=="symbol"?e:e+""}function Bm(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Wm=K.module("DecimalColumnFormatter");class be extends Me{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 n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Me.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:n,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0;return be.makeFormat(e,t,Me.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return be.makeFormat("Custom Format",e,Me.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=be.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Ct(this,"defaultFormatString",void 0),Ct(this,"dh",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=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(n,i)}catch{Wm.error("Invalid format arguments")}return""}}Ct(be,"DEFAULT_FORMAT_STRING","###,##0.0000");Ct(be,"FORMAT_PERCENT",be.makePresetFormat("Percent","##0.00%"));Ct(be,"FORMAT_BASIS_POINTS",be.makePresetFormat("Basis Points","###,##0 bp",1e4));Ct(be,"FORMAT_THOUSANDS",be.makePresetFormat("Thousands","##0.000 k",.001));Ct(be,"FORMAT_MILLIONS",be.makePresetFormat("Millions","###,##0.000 mm",1e-6));Ct(be,"FORMAT_SCIENTIFIC_NOTATION",be.makePresetFormat("Scientific Notation","0.0000E0"));Ct(be,"FORMAT_ROUND",be.makePresetFormat("Round","###,##0"));Ct(be,"FORMAT_ROUND_TWO_DECIMALS",be.makePresetFormat("0.00","###,##0.00"));Ct(be,"FORMAT_ROUND_FOUR_DECIMALS",be.makePresetFormat("0.0000","###,##0.0000"));class Um extends Me{format(e){return"".concat(e)}}function Tn(r,e,t){return(e=Vm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Vm(r){var e=Km(r,"string");return typeof e=="symbol"?e:e+""}function Km(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var zm=K.module("IntegerColumnFormatter");class mt extends Me{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 n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Me.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:n,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0;return mt.makeFormat(e,t,Me.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return mt.makeFormat("Custom Format",e,Me.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=mt.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Tn(this,"dh",void 0),Tn(this,"defaultFormatString",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=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(n,i)}catch{zm.error("Invalid format arguments")}return""}}Tn(mt,"DEFAULT_FORMAT_STRING","###,##0");Tn(mt,"FORMAT_THOUSANDS",mt.makePresetFormat("Thousands","##0.000 k",.001));Tn(mt,"FORMAT_MILLIONS",mt.makePresetFormat("Millions","###,##0.000 mm",1e-6));Tn(mt,"FORMAT_SCIENTIFIC_NOTATION",mt.makePresetFormat("Scientific Notation","0.0000E0"));class Gm extends Me{format(e){return e}}function Lo(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ro(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Lo(Object(t),!0).forEach(function(n){_i(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Lo(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function _i(r,e,t){return(e=qm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function qm(r){var e=Xm(r,"string");return typeof e=="symbol"?e:e+""}function Xm(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Zm=/\s*(\d{4})([-./](\d{1,2}|[a-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/;class Ee{static makeDateWrapper(e,t,n){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(n).padStart(4,"0"),c="".concat(i+1).padStart(2,"0"),v="".concat(o).padStart(2,"0"),f="".concat(a).padStart(2,"0"),p="".concat(s).padStart(2,"0"),g="".concat(l).padStart(2,"0"),b="".concat(d).padStart(9,"0"),E="".concat(h,"-").concat(c,"-").concat(v," ").concat(f,":").concat(p,":").concat(g,".").concat(b);return e.i18n.DateTimeFormat.parse(Ee.FULL_DATE_FORMAT,E,e.i18n.TimeZone.getTimeZone(t))}static getNextNanos(e){var t=parseInt(e,10),n="0".repeat(9-e.length),i="".concat(t+1).concat(n);return parseInt(i,10)}static getNextDate(e,t,n,i){var{year:o,month:a,date:s,hours:l,minutes:d,seconds:h,nanos:c}=n;if(t.nanos!=null){if(t.nanos.length===9)return null;c=Ee.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 v=new Date(o,a,s,l,d,h);return Ee.makeDateWrapper(e,i,v.getFullYear(),v.getMonth(),v.getDate(),v.getHours(),v.getMinutes(),v.getSeconds(),c)}static parseMonth(e){var t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;var n=e.trim().toLowerCase();if(n.length>=3){for(var i=0;i<Ee.months.length;i+=1)if(Ee.months[i].startsWith(n))return i}return NaN}static parseDateValues(e,t,n,i,o,a,s){var l=parseInt(e,10),d=t!=null?this.parseMonth(t):0,h=n!=null?parseInt(n,10):1,c=i!=null?parseInt(i,10):0,v=o!=null?parseInt(o,10):0,f=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(v)||Number.isNaN(f)||Number.isNaN(p)?null:{year:l,month:d,date:h,hours:c,minutes:v,seconds:f,nanos:p}}static parseDateTimeString(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=Zm.exec(e);if(n==null)throw new Error("Unexpected date string: ".concat(e));var[,i,,o,,a,,s,,l,,d,,h,c]=n;if(!t&&c!=null&&c.length>0)throw new Error("Unexpected characters after date string '".concat(e,"': ").concat(c));var v={year:i,month:o,date:a,hours:s,minutes:l,seconds:d,nanos:h};return t?Ro(Ro({},v),{},{overflow:c}):v}static parseDateRange(e,t,n){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=Ee.makeDateWrapper(e,n,o.getFullYear(),o.getMonth(),o.getDate()),s=new Date(o.getFullYear(),o.getMonth(),o.getDate()+1),l=Ee.makeDateWrapper(e,n,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=Ee.makeDateWrapper(e,n,h.getFullYear(),h.getMonth(),h.getDate()),v=Ee.makeDateWrapper(e,n,d.getFullYear(),d.getMonth(),d.getDate());return[c,v]}if(i==="now"){var f=new Date(Date.now()),p=e.DateWrapper.ofJsDate(f);return[p,null]}var g=Ee.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 b=Ee.parseDateValues(g.year,g.month,g.date,g.hours,g.minutes,g.seconds,g.nanos);if(b==null)throw new Error("Unable to extract date values from ".concat(g));var E=Ee.makeDateWrapper(e,n,b.year,b.month,b.date,b.hours,b.minutes,b.seconds,b.nanos),x=Ee.getNextDate(e,g,b,n);return[E,x]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}static trimDateTimeStringTimeZone(e){var{overflow:t=""}=Ee.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)}}_i(Ee,"FULL_DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSSSSS");_i(Ee,"months",["january","february","march","april","may","june","july","august","september","october","november","december"]);function oC(r,e){return r===e?{operator:"notEq",value:""}:{operator:"eq",value:r}}function aC(r,e,t,n){return function(o){var a=t.trim();if(a==="")return null;var s=Js(e,l=>r.makeSearchTextFilter(l,a,n),"or");return s(o)}}function Js(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"or";return function(i){var o=i==null?void 0:i.findColumns(typeof r=="string"?[r]:r);if(o==null||o.length===0)return null;var a=o.map(e);return a.reduce((s,l)=>s[t](l))}}function Ym(r,e,t,n){return Js(e,i=>i.filter()[n](r.makeFilterValue(i.type,t)),"or")}function sC(r,e,t,n,i){return function(a){var s=a==null?void 0:a.findColumn(e),l=t==="all"||n&&t.size===0;return s==null||l?null:r.makeSelectValueFilter(s,[...t.keys()],i)}}function lC(r){return function(t){return t.filter().isNull().not().and(t.filter().notEq(r.makeFilterValue(t.type,"")))}}function dC(r,e){return function(n){var i=n.filter(),o=r.makeFilterValue(n.type,""),a=i.eq(o);return e?i.isNull().or(a):a.or(i.notEq(o))}}function Pi(r,e,t){return(e=Qm(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Qm(r){var e=Jm(r,"string");return typeof e=="symbol"?e:e+""}function Jm(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Kn{}Pi(Kn,"not","not");Pi(Kn,"and","and");Pi(Kn,"or","or");function uC(r){if(!(r==="not"||r==="and"||r==="or"))throw new Error("operator is not a valid FilterOperatorValue")}function ye(r,e,t){return(e=ev(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ev(r){var e=tv(r,"string");return typeof e=="symbol"?e:e+""}function tv(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class _{}ye(_,"eq","eq");ye(_,"eqIgnoreCase","eqIgnoreCase");ye(_,"notEq","notEq");ye(_,"notEqIgnoreCase","notEqIgnoreCase");ye(_,"greaterThan","greaterThan");ye(_,"greaterThanOrEqualTo","greaterThanOrEqualTo");ye(_,"lessThan","lessThan");ye(_,"lessThanOrEqualTo","lessThanOrEqualTo");ye(_,"in","in");ye(_,"inIgnoreCase","inIgnoreCase");ye(_,"notIn","notIn");ye(_,"notInIgnoreCase","notInIgnoreCase");ye(_,"isTrue","isTrue");ye(_,"isFalse","isFalse");ye(_,"isNull","isNull");ye(_,"invoke","invoke");ye(_,"contains","contains");ye(_,"notContains","notContains");ye(_,"containsIgnoreCase","containsIgnoreCase");ye(_,"startsWith","startsWith");ye(_,"endsWith","endsWith");ye(_,"containsAny","containsAny");var nv="DH_ITEM_KEY",Fo=K.module("ViewportDataUtils");function el(r){return"".concat(nv,"_").concat(r)}function hC(r,e){var{bulkUpdate:t}=r;return function(i){var{columns:o,offset:a,rows:s}=i.detail;Fo.debug("table updated",i.detail);var l=new Map;s.forEach((d,h)=>{var c=e(d,o),v=el(a+h);l.set(v,{key:v,item:c})}),Fo.debug("update keys",l),t(l)}}function cC(r,e){return e.reduce((t,n)=>(t[n.name]=r.get(n),t),{})}function*mC(r,e){for(var t=r;t<=e;++t)yield{key:el(t)}}function rv(r){return r==null||iv(r)?0:r.size}function iv(r){return r!=null&&typeof r=="object"&&"isClosed"in r&&typeof r.isClosed=="boolean"?r.isClosed:!1}function vC(r,e,t,n){var i=r+e-1,[o,a]=[0,n-1],s=Hi(r-t,o,a),l=Hi(i+t,o,a);return[s,l]}function $o(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function $t(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){$o(o,n,i,a,s,"next",l)}function s(l){$o(o,n,i,a,s,"throw",l)}a(void 0)})}}function cn(r,e,t){return(e=ov(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ov(r){var e=av(r,"string");return typeof e=="symbol"?e:e+""}function av(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var xt=K.module("TableUtils");function fC(r){return r===C.sortDirection.ascending||r===C.sortDirection.descending||r===C.sortDirection.reverse||r===C.sortDirection.none}class C{static copyTableAndApplyFilters(e){var t=arguments;return $t(function*(){if(e==null)return null;for(var n=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 n.applyFilter(Vr(...o.map(s=>s(n)))),n})()}static getSortIndex(e,t){for(var n=0;n<e.length;n+=1){var i,o=e[n];if(((i=o.column)===null||i===void 0?void 0:i.name)===t)return n}return null}static getSortForColumn(e,t){var n=C.getSortIndex(e,t);return n!=null?e[n]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return C.isBooleanType(e)?[_.isTrue,_.isFalse,_.isNull]:C.isCharType(e)||C.isNumberType(e)||C.isDateType(e)?[_.eq,_.notEq,_.greaterThan,_.greaterThanOrEqualTo,_.lessThan,_.lessThanOrEqualTo]:C.isTextType(e)?[_.eq,_.eqIgnoreCase,_.notEq,_.notEqIgnoreCase,_.contains,_.notContains,_.startsWith,_.endsWith]:[]}static getNextSort(e,t,n){if(n<0||n>=e.length)return null;var i=C.getSortForColumn(t,e[n].name);return i===null?e[n].sort().asc():i.direction===C.sortDirection.ascending?i.desc():null}static makeColumnSort(e,t,n,i){if(t<0||t>=e.length||n===C.sortDirection.none)return null;var o=e[t].sort();switch(n){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,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(n<0||n>=t.length)return[];var o=C.getNextSort(t,e,n);return C.setSortForColumn(e,t[n].name,o,i)}static sortColumn(e,t,n,i,o,a){if(n<0||n>=t.length)return[];var s=C.makeColumnSort(t,n,i,o);return C.setSortForColumn(e,t[n].name,s,a)}static setSortForColumn(e,t,n){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)),n!==null&&a.push(n),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,n){switch(t){case"=":return e.eq(n);case"<":return e.lessThan(n);case"<=":case"=<":return e.lessThanOrEqualTo(n);case">":return e.greaterThan(n);case">=":case"=>":return e.greaterThanOrEqualTo(n);case"!=":case"!":return e.notEq(n);default:return null}}static makeCancelableTablePromise(e){return Te.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t){var n=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 Xa('Event "'.concat(t,'" timed out.')))},n),o=e.addEventListener(t,c=>{if(i!=null&&!i(c)){xt.debug2("Event triggered, but matcher returned false.");return}xt.debug2("Event triggered, resolving."),o(),clearTimeout(a),s=!1,d(c)})});return l.cancel=()=>{if(s){xt.debug2("Pending promise cleanup."),o(),clearTimeout(a),s=!1;return}xt.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==null?void 0: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 n=C.removeCommas(t);if(C.NUMBER_REGEX.test(n))return parseFloat(n);throw new Error("Invalid number '".concat(e,"'"))}static getFilterOperatorString(e){switch(e){case _.eq:return"=";case _.notEq:return"!=";case _.greaterThan:return">";case _.greaterThanOrEqualTo:return">=";case _.lessThan:return"<";case _.lessThanOrEqualTo:return"<=";case _.contains:return"~";case _.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((n,i)=>{var o=n.name.toUpperCase(),a=i.name.toUpperCase();return Cs.sort(o,a,t)})}constructor(e){cn(this,"dh",void 0),this.dh=e,au(this)}createDistinctSortedColumnTable(e,t,n){var i=arguments,o=this;return $t(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(Vr(...l.map(f=>f(a)))));var h=a.findColumn(t),c=yield a.selectDistinct([h]);a!==e&&a.close();var v=c.findColumn(t).sort()[n]();return o.applySort(c,[v])})()}doesColumnValueExist(e,t,n,i){var o=this;return $t(function*(){if(e==null)return null;var a=Ym(o,t,n,i?"eq":"eqIgnoreCase"),s=yield e.copy();yield o.applyFilter(s,Vr(a(s)));var l=rv(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,n){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 v=this.makeQuickFilterFromComponent(e,c,n);if(v)d?d=d.and(v):d=v;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,n){var{type:i}=e;return C.isNumberType(i)?this.makeQuickNumberFilter(e,t):C.isBooleanType(i)?this.makeQuickBooleanFilter(e,t):n!=null&&C.isDateType(i)?this.makeQuickDateFilter(e,t,n):C.isCharType(i)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}makeQuickNumberFilter(e,t){var n=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,v=null;if(s!==null&&s.length>3&&([,l,d,h,c,v]=s),v!=null&&v.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=n.isNull();break;case"nan":o=i.FilterCondition.invoke("isNaN",n);break;case"infinity":case"inf":case"∞":d!=null?o=i.FilterCondition.invoke("isInf",n).and(n.lessThan(i.FilterValue.ofNumber(0))):o=i.FilterCondition.invoke("isInf",n).and(n.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(f){return xt.warn("Unable to create long filter",f),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,n;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((n=l)!==null&&n!==void 0?n:"")}static unescapeQuickTextFilter(e){var t,n,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((n=l)!==null&&n!==void 0?n:"")}makeQuickTextFilter(e,t){var{dh:n}=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",n.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))));case"!~":return d.isNull().or(d.invoke("matches",n.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))).not());case"!=":return h==="*"?d.isNull().or(d.invoke("matches",n.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$"))).not()):c==="*"?d.isNull().or(d.invoke("matches",n.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*"))).not()):d.notEqIgnoreCase(n.FilterValue.ofString(l.toLowerCase()));case"=":return h==="*"?d.isNull().not().and(d.invoke("matches",n.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$")))):c==="*"?d.isNull().not().and(d.invoke("matches",n.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*")))):d.eqIgnoreCase(n.FilterValue.ofString(l.toLowerCase()))}return null}makeQuickBooleanFilter(e,t){var n=/^(!=|=|!)?(.*)/,i=n.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,n){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=_.eq;switch(s){case"<":d=_.lessThan;break;case"<=":case"=<":d=_.lessThanOrEqualTo;break;case">":d=_.greaterThan;break;case">=":case"=>":d=_.greaterThanOrEqualTo;break;case"!=":case"!":d=_.notEq;break;case"=":case"==":default:d=_.eq;break}return this.makeQuickDateFilterWithOperation(e,l,d,n)}makeQuickDateFilterWithOperation(e,t,n,i){var{dh:o}=this,[a,s]=Ee.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 n===_.notEq?h.isNull().not():h.isNull();switch(n){case _.eq:{if(d!=null){var c=h.greaterThanOrEqualTo(l),v=h.lessThan(d);return c.and(v)}return h.eq(l)}case _.lessThan:return h.lessThan(l);case _.lessThanOrEqualTo:return d!=null?h.lessThan(d):h.lessThanOrEqualTo(l);case _.greaterThan:return d!=null?h.greaterThanOrEqualTo(d):h.greaterThan(l);case _.greaterThanOrEqualTo:return h.greaterThanOrEqualTo(l);case _.notEq:{if(d!=null){var f=h.lessThan(l),p=h.greaterThanOrEqualTo(d);return f.or(p)}return h.notEq(l)}default:throw new Error("Invalid operator: ".concat(n))}}makeQuickCharFilter(e,t){var{dh:n}=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=n.FilterValue.ofString(C.isRangeOperation(s)?C.quoteValue(l):l);return C.makeRangeFilterWithOperation(h,s,c)}makeAdvancedFilter(e,t,n){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:v}=h;if(c!=null&&c.length>0&&v!=null&&v.length>0)try{var f=this.makeAdvancedValueFilter(e,c,v,n);if(f!=null){if(d===0)l=f;else if(l!==null&&d-1<o.length){var p=o[d-1];if(p===Kn.and)l=l.and(f);else if(p===Kn.or)l=l.or(f);else{xt.error("Unexpected filter operator",p,f),l=null;break}}}else xt.debug2("Empty filter ignored for",c,v)}catch(b){xt.error("Unable to create filter",b),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,n,i){var{dh:o}=this;if(C.isDateType(e.type))return this.makeQuickDateFilterWithOperation(e,n,t,i);if(C.isNumberType(e.type)||C.isCharType(e.type))return this.makeQuickFilter(e,"".concat(C.getFilterOperatorString(t)).concat(n));var a=this.makeFilterValue(e.type,n),s=e.filter();switch(t){case _.eq:return s.eq(a);case _.eqIgnoreCase:return s.eqIgnoreCase(a);case _.notEq:return s.notEq(a);case _.notEqIgnoreCase:return s.notEqIgnoreCase(a);case _.greaterThan:return s.greaterThan(a);case _.greaterThanOrEqualTo:return s.greaterThanOrEqualTo(a);case _.lessThan:return s.lessThan(a);case _.lessThanOrEqualTo:return s.lessThanOrEqualTo(a);case _.isTrue:return s.isTrue();case _.isFalse:return s.isFalse();case _.isNull:return s.isNull();case _.contains:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(n,"\\E.*"))));case _.notContains:return s.isNull().or(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(n,"\\E.*"))).not());case _.startsWith:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i)^\\Q".concat(n,"\\E.*"))));case _.endsWith:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(n,"\\E$"))));case _.in:case _.inIgnoreCase:case _.notIn:case _.notInIgnoreCase:case _.invoke:default:throw new Error("Unexpected filter operation: ".concat(t))}}makeSearchTextFilter(e,t,n){var i=this.getValueType(e.type);try{if(i===this.dh.ValueType.BOOLEAN){var o=this.makeQuickBooleanFilter(e,t);return $(o),o}if(i===this.dh.ValueType.DATETIME)return this.makeQuickDateFilterWithOperation(e,Ee.trimDateTimeStringTimeZone(t),"eq",n);if(i===this.dh.ValueType.NUMBER){var a=this.makeQuickNumberFilter(e,t);return $(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 n=arguments,i=this;return $t(function*(){var o=n.length>2&&n[2]!==void 0?n[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 n=arguments,i=this;return $t(function*(){var o=n.length>2&&n[2]!==void 0?n[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return C.executeAndWaitForEvent(s=>s==null?void 0:s.applyCustomColumns(t),e,a.Table.EVENT_CUSTOMCOLUMNSCHANGED,o)})()}applyFilter(e,t){var n=arguments,i=this;return $t(function*(){var o=n.length>2&&n[2]!==void 0?n[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return C.executeAndWaitForEvent(s=>s==null?void 0:s.applyFilter(t),e,a.Table.EVENT_FILTERCHANGED,o)})()}applySort(e,t){var n=arguments,i=this;return $t(function*(){var o=n.length>2&&n[2]!==void 0?n[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return C.executeAndWaitForEvent(s=>s==null?void 0:s.applySort(t),e,a.Table.EVENT_SORTCHANGED,o)})()}makeNeverFilter(e){var{dh:t}=this,n=null;C.isTextType(e.type)?n=t.FilterValue.ofString("a"):C.isBooleanType(e.type)?n=t.FilterValue.ofBoolean(!0):C.isDateType(e.type)?n=t.FilterValue.ofNumber(t.DateWrapper.ofJsDate(new Date)):n=t.FilterValue.ofNumber(0);var i=e.filter().eq(n),o=e.filter().notEq(n);return i.and(o)}makeFilterValue(e,t){var{dh:n}=this,i=C.getBaseType(e);return C.isTextType(i)?n.FilterValue.ofString(t):C.isLongType(i)?n.FilterValue.ofNumber(n.LongWrapper.ofString(C.removeCommas(t))):n.FilterValue.ofNumber(C.removeCommas(t))}makeFilterRawValue(e,t){var{dh:n}=this;return C.isCharType(e)?n.FilterValue.ofString(typeof t=="number"?String.fromCharCode(t):t):C.isTextType(e)?n.FilterValue.ofString(t):C.isBooleanType(e)?n.FilterValue.ofBoolean(t):n.FilterValue.ofNumber(t)}makeNullableEqFilter(e,t){return t==null?e.filter().isNull():e.filter().eq(this.makeFilterRawValue(e.type,t))}makeValue(e,t,n){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]=Ee.parseDateRange(i,t,n);return o}return C.isNumberType(e)?C.makeNumberValue(t):(xt.error("Unexpected column type",e),null)}makeSelectValueFilter(e,t,n){var{dh:i}=this;if(t.length===0)return n?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?n?e.filter().isNull().not().and(e.filter().notIn(o)):e.filter().isNull().or(e.filter().in(o)):n?e.filter().isNull().not():e.filter().isNull():n?e.filter().notIn(o):e.filter().in(o)}}cn(C,"dataType",{BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"});cn(C,"sortDirection",{ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null});cn(C,"APPLY_TABLE_CHANGE_TIMEOUT_MS",3e4);cn(C,"REVERSE_TYPE",Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"}));cn(C,"NUMBER_REGEX",/^-?\d+(\.\d+)?$/);cn(C,"executeAndWaitForEvent",function(){var r=$t(function*(e,t,n){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,n,i);return e(t),yield o,t});return function(e,t,n){return r.apply(this,arguments)}}());function fn(r,e,t){return(e=sv(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sv(r){var e=lv(r,"string");return typeof e=="symbol"?e:e+""}function lv(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class tl{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((t,n)=>{var i=C.getNormalizedType(n.columnType);if(i===null)return t;t.has(i)||t.set(i,new Map);var o=t.get(i);return o==null||o.set(n.columnName,n.format),t},new Map)}static makeColumnFormattingRule(e,t,n){return{columnType:e,columnName:t,format:n}}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=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;fn(this,"defaultColumnFormatter",void 0),fn(this,"typeFormatterMap",void 0),fn(this,"columnFormatMap",void 0),fn(this,"truncateNumbersWithPound",void 0),fn(this,"showEmptyStrings",void 0),fn(this,"showNullStrings",void 0),this.defaultColumnFormatter=new Um,this.typeFormatterMap=new Map([[C.dataType.BOOLEAN,new Lm],[C.dataType.CHAR,new Rm],[C.dataType.DATETIME,new gt(e,n)],[C.dataType.DECIMAL,new be(e,i)],[C.dataType.INT,new mt(e,o)],[C.dataType.STRING,new Gm]]),this.columnFormatMap=tl.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,n=C.getNormalizedType(e);if(n!==null)return t&&!this.columnFormatMap.has(n)&&this.columnFormatMap.set(n,new Map),this.columnFormatMap.get(n)}getColumnFormat(e,t){var n,i=this.getColumnFormatMapForType(e);return(n=i==null?void 0:i.get(t))!==null&&n!==void 0?n:null}getColumnTypeFormatter(e){var t=C.getNormalizedType(e),n=this.defaultColumnFormatter;if(t){var i;n=(i=this.typeFormatterMap.get(t))!==null&&i!==void 0?i:n}return n}getFormattedString(e,t){var n=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,n);return o.format(e,a??void 0)}get timeZone(){var e=this.typeFormatterMap.get(C.dataType.DATETIME);return Ad(e,gt),e.dhTimeZone.id}}function mn(r,e,t){return(e=dv(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function dv(r){var e=uv(r,"string");return typeof e=="symbol"?e:e+""}function uv(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Q{}mn(Q,"INTEGER","int");mn(Q,"LONG","long");mn(Q,"DOUBLE","double");mn(Q,"BOOLEAN","bool");mn(Q,"STRING","string");mn(Q,"DATE_TIME","datetime");mn(Q,"LOCAL_TIME","localtime");function nl(r,e){var t=r.internalStream("string");return t.readable=!0,t.read=()=>!1,t.removeListener=()=>!1,t.on("data",(n,i)=>e(i)),t}function Ho(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Bo(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ho(Object(t),!0).forEach(function(n){We(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ho(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function We(r,e,t){return(e=hv(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function hv(r){var e=cv(r,"string");return typeof e=="symbol"?e:e+""}function cv(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Wo="unknown",mv=2147483647,vv=-2147483648,Uo=/^[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]+)?$/,Vo=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class Ae{static determineType(e,t,n){if(!e||e===n)return t;switch(t){case Q.STRING:return Q.STRING;case Q.INTEGER:return Ae.checkInteger(e);case Q.LONG:return Ae.checkLong(e);case Q.DOUBLE:return Ae.checkDouble(e);case Q.BOOLEAN:return Ae.checkBoolean(e);case Q.DATE_TIME:return Ae.checkDateTime(e);case Q.LOCAL_TIME:return Ae.checkLocalTime(e);default:return Ae.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){var t=e.replace(/,/g,"");return Ae.isNotParsableNumber(t)?Q.STRING:Ae.getNumberType(t)}static checkLong(e){var t=e.replace(/,/g,"");return Ae.isNotParsableNumber(t)?Q.STRING:t.includes(".")?Q.DOUBLE:Q.LONG}static checkDouble(e){var t=e.replace(/,/g,"");return Ae.isNotParsableNumber(t)?Q.STRING:Q.DOUBLE}static checkBoolean(e){var t=e.toLowerCase();return t==="true"||t==="false"?Q.BOOLEAN:Q.STRING}static checkDateTime(e){return Uo.test(e)?Q.DATE_TIME:Q.STRING}static checkLocalTime(e){return Vo.test(e)?Q.LOCAL_TIME:Q.STRING}static getTypeFromUnknown(e){var t=e.replace(/,/g,"");if(Ae.isNotParsableNumber(t)){var n=e.toLowerCase();return n==="true"||n==="false"?Q.BOOLEAN:Uo.test(e)&&e.includes(":")?Q.DATE_TIME:Vo.test(e)?Q.LOCAL_TIME:Q.STRING}return Ae.getNumberType(t)}static getNumberType(e){if(e.includes("."))return Q.DOUBLE;var t=e.startsWith("-")?11:10;if(e.length>t)return Q.LONG;var n=parseInt(e,10);return n>mv||n<vv?Q.LONG:Q.INTEGER}constructor(e,t,n,i,o,a,s,l,d,h){We(this,"onFileCompleted",void 0),We(this,"file",void 0),We(this,"readHeaders",void 0),We(this,"nullString",void 0),We(this,"onProgress",void 0),We(this,"onError",void 0),We(this,"types",void 0),We(this,"chunks",void 0),We(this,"totalChunks",void 0),We(this,"rowCount",void 0),We(this,"isZip",void 0),We(this,"shouldTrim",void 0),We(this,"zipProgress",void 0),We(this,"config",void 0),this.onFileCompleted=e,this.file=t,this.readHeaders=n,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=Bo(Bo({},i),{},{error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete})}parse(){if(this.file instanceof File||this.file instanceof Blob)Hn.parse(this.file,this.config);else{var e=nl(this.file,this.handleNodeUpdate);Hn.parse(e,this.config),e.resume()}}handleChunk(e,t){var{data:n}=e;if(!this.types){if(n==null||n.length===0){t.abort(),this.onError("Error parsing CSV: no data in file.");return}this.types=new Array(n[0].length).fill(Wo),this.readHeaders&&(n=n.slice(1))}this.rowCount+=n.length,$(this.types);var i=[...this.types];n.forEach(s=>{if(s.length>=i.length){for(var l=0;l<i.length;l+=1)i[l]=Ae.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.
|
|
@@ -20,5 +20,5 @@ Row = `).concat(s))}),this.chunks+=1;var o=0;this.totalChunks>0?o=Math.round(thi
|
|
|
20
20
|
`&&(n+=`
|
|
21
21
|
`))}}if(n=n.trimRight(),this.editor.setValue(n),t){var s,l=(s=this.editor.getModel())===null||s===void 0?void 0:s.getLineCount();$(l),this.editor.revealLine(l,1)}this.stopFlushTimer(),this.bufferedMessages=[]}}truncateLogIfNecessary(){this.messages.length>Se.maxLogSize&&(this.messages=this.messages.splice(this.messages.length-Se.truncateSize))}scrollToBottom(){var e,t,n;if(this.editor){var i=(e=this.editor)===null||e===void 0||(t=e.getModel)===null||t===void 0||(n=t.call(e))===null||n===void 0?void 0:n.getLineCount();$(i),this.editor.revealLine(i,1)}}isBottomVisible(){if(!this.editor)return!0;var e=this.editor.getModel(),t=e==null?void 0:e.getLineCount();return $(t),this.isLineVisible(t)}isLineVisible(e){var t,n=(t=this.editor)===null||t===void 0?void 0:t.getVisibleRanges();if(n==null||n.length===0)return!1;for(var i=0;i<n.length;i+=1){var o=n[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 n=this.bufferedMessages[t],i=Se.getLogText(n);e+=i,i.charAt(i.length-1)!==`
|
|
22
22
|
`&&(e+=`
|
|
23
|
-
`)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,Se.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,n=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(ie,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:Fd,tooltip:"Clear log"}),u.jsx(ie,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:$d,tooltip:"Log Settings",onClick:()=>{},children:u.jsx(Yn,{actions:n,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),u.jsx("div",{className:"log-pane-editor h-100 w-100",ref:i=>{this.editorContainer=i}})]})}}ot(Se,"DefaultLogLevels",[Ie.STDOUT,Ie.ERROR,Ie.FATAL,Ie.STDERR,Ie.WARN]);ot(Se,"AllLogLevels",[Ie.INFO,Ie.STDOUT,Ie.ERROR,Ie.FATAL,Ie.STDERR,Ie.WARN,Ie.DEBUG,Ie.TRACE]);ot(Se,"bufferTimeout",16);ot(Se,"maxLogSize",131072);ot(Se,"truncateSize",65536);const Gv="var(--dh-color-chart-colorway)",qv="var(--dh-color-chart-grid)",Xv="var(--dh-color-chart-axis-line)",Zv="var(--dh-color-chart-axis-line-zero)",ta={"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:qv,linecolor:Xv,zerolinecolor:Zv,"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 na=K.module("ChartTheme");function Yv(){var r,e=as(ta);return e.colorway=Hd((r=e.colorway)!==null&&r!==void 0?r:"").map(t=>{var[n,i]=t;return Bd.normalizeCssColor(e.colorway.substring(n,i+1))}).join(" "),na.debug2("Chart theme:",ta),na.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 ra(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Qv(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ra(Object(t),!0).forEach(function(n){Jv(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ra(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Jv(r,e,t){return(e=ef(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ef(r){var e=tf(r,"string");return typeof e=="symbol"?e:e+""}function tf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var nf=m.lazy(()=>ms(()=>import("./Plot-B3JS6Jui.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url));function rf(r){return u.jsx(m.Suspense,{fallback:u.jsx(un,{"data-testid":"lazy-plot-loading"}),children:u.jsx(nf,Qv({},r))})}var Oi=m.createContext(null);Oi.displayName="ChartThemeContext";function pC(r){var{children:e}=r,{activeThemes:t}=_s(),n=m.useMemo(Yv,[t]);return u.jsx(Oi.Provider,{value:n,children:e})}function of(){return Xn(Oi,"No ChartThemeContext value found.")}function ia(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function af(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){ia(o,n,i,a,s,"next",l)}function s(l){ia(o,n,i,a,s,"throw",l)}a(void 0)})}}var sf=K.module("HeapUsage");function lf(r){var e,{connection:t,defaultUpdateInterval:n,hoverUpdateInterval:i,bgMonitoring:o=!0,monitorDuration:a}=r,s=of(),[l,d]=m.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[h,c]=m.useState(!1),v=m.useRef({timestamps:[],usages:[]}),f=ws(),p=m.useCallback(af(function*(){try{var A=yield t.getWorkerHeapInfo();if(!f.current)return;if(d(A),o||h){for(var V=(A.totalHeapSize-A.freeMemory)/A.maximumHeapSize,G=Date.now(),{timestamps:pe,usages:Ge}=v.current;pe.length!==0&&G-pe[0]>a*1.5;)pe.shift(),Ge.shift();pe.push(G),Ge.push(V)}else v.current={timestamps:[],usages:[]}}catch(je){sf.warn("Unable to get heap usage",je)}}),[t,f,o,h,a]);Hu(p,h?i:n);var g=(A,V)=>Math.round(A*10**V)/10**V,b=2,E=1024**3,{freeMemory:x,totalHeapSize:P,maximumHeapSize:F}=l,U=g(x/E,b),ee=g(P/E,b),j=g(F/E,b),W=ee-U,H=function(V,G){var pe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return u.jsxs("div",{className:Y("heap-usage-info-row",{"heading-bottom-border":pe}),children:[u.jsx("div",{className:"font-weight-bold",children:V}),u.jsx("div",{children:G})]})},{timestamps:ne,usages:oe}=v.current,L=(e=ne[ne.length-1])!==null&&e!==void 0?e:0,X=P/F,z=(P-x)/F;return u.jsxs("div",{className:"max-memory",children:[u.jsx("div",{className:"total-memory",style:{width:"calc(".concat(X*100,"% - ").concat(X*2,"px")}}),u.jsx("div",{className:Y("used-memory",{"heap-overflow":(P-x)/F>.95}),style:{width:"calc(".concat(z*100,"% - ").concat(z*2,"px")}}),u.jsxs("div",{className:"memory-text",children:[j.toFixed(1)," GB"]}),u.jsx(ce,{onEntered:()=>c(!0),onExited:()=>c(!1),interactive:!0,children:u.jsxs("div",{className:"heap-tooltip",children:[H("In use:","".concat(W.toFixed(b)," of ").concat(j.toFixed(b)," GB"),!0),H("Free:","".concat(U.toFixed(b)," GB")),H("Total:","".concat(ee.toFixed(b)," GB")),H("Max:","".concat(j.toFixed(b)," GB")),u.jsx("div",{className:"heap-plot",children:u.jsx(rf,{data:[{x:[...ne],y:[...oe],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:[L-a,L],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(r){return r.componentName!==void 0}function df(r){return r.component!==void 0}var dl=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const uf=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:sl,isGLComponentConfig:ll,isReactComponentConfig:df,itemDefaultConfig:dl},Symbol.toStringTag,{value:"Module"}));function br(r,e,t){return(e=hf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function hf(r){var e=cf(r,"string");return typeof e=="symbol"?e:e+""}function cf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class ze{constructor(){br(this,"_mSubscriptions",void 0),br(this,"off",this.unbind),br(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[ze.ALL_EVENT]=[]}on(e,t,n){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:n})}emit(e){for(var t=this._mSubscriptions[e],n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;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[ze.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,n){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)&&(!n||n===this._mSubscriptions[e][o].ctx)&&(this._mSubscriptions[e].splice(o,1),i=!0);if(i===!1)throw new Error("Nothing to unbind for "+e)}}br(ze,"ALL_EVENT","__all");function ft(r,e,t){return(e=mf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mf(r){var e=vf(r,"string");return typeof e=="symbol"?e:e+""}function vf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class ui extends ze{constructor(e,t,n){super(),ft(this,"width",void 0),ft(this,"height",void 0),ft(this,"title",void 0),ft(this,"parent",void 0),ft(this,"layoutManager",void 0),ft(this,"tab",void 0),ft(this,"_config",void 0),ft(this,"isHidden",!1),ft(this,"beforeCloseHandler",void 0),ft(this,"_element",M(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),ft(this,"_contentElement",void 0),this.title=ll(e)?e.componentName:"",this.parent=t,this.layoutManager=n,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 n,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=((n=this[d])!==null&&n!==void 0?n:0)*(1/(((i=s.config[d])!==null&&i!==void 0?i:0)/100)),v=h/c*100,f=(((o=s.config[d])!==null&&o!==void 0?o:0)-v)/(a.contentItems.length-1),p=0;p<a.contentItems.length;p++)if(a.contentItems[p]===s)a.contentItems[p].config[d]=v;else{var g;a.contentItems[p].config[d]=((g=a.contentItems[p].config[d])!==null&&g!==void 0?g:0)+f}return a.callDownwards("setSize"),!0}close(e){var t,n;this._config.isClosable&&(!((t=(n=this.beforeCloseHandler)===null||n===void 0?void 0:n.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 n=this._contentElement[0],i=n.offsetWidth-n.clientWidth,o=n.offsetHeight-n.clientHeight;this._contentElement.width(this.width-i).height(this.height-o),this.emit("resize")}}}const ff=Object.freeze(Object.defineProperty({__proto__:null,Container:ui,ItemContainer:ui},Symbol.toStringTag,{value:"Module"}));function ul(r){var e=location.hash.match(new RegExp(r+"=([^&]*)"));return e?e[1]:null}function hl(r){if(window.location.hash)return ul(r);if(!window.location.search)return null;var e=window.location.search.substr(1).split("&"),t={},n,i;for(i=0;i<e.length;i++)n=e[i].split("="),t[n[0]]=n[1];return t[r]||null}function xi(r){return window.requestAnimationFrame(r)}function pf(r,e){var t=e.indexOf(r);if(t===-1)throw new Error("Can't remove item from array. Item is not in the array");e.splice(t,1)}function Pr(){return Et()}function gf(r,e){var t=r.replace(/javascript/gi,"javascript").replace(/expression/gi,"expression").replace(/onload/gi,"onload").replace(/script/gi,"script").replace(/onerror/gi,"onerror");return e===!0?t:t.replace(/>/g,">").replace(/</g,"<")}function Ii(r){return M.trim(r.replace(/(<([^>]+)>)/gi,""))}function et(r,e,t){return(e=bf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bf(r){var e=yf(r,"string");return typeof e=="symbol"?e:e+""}function yf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Qn extends ze{constructor(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super(),et(this,"_eElement",void 0),et(this,"_oDocument",void 0),et(this,"_eBody",void 0),et(this,"_destroyAfterMouseUp",void 0),et(this,"_nDelay",400),et(this,"_timeout",void 0),et(this,"timeout",void 0),et(this,"_nDistance",10),et(this,"_nX",0),et(this,"_nY",0),et(this,"_nOriginalX",0),et(this,"_nOriginalY",0),et(this,"_bDragging",!1),this._eElement=e,this._oDocument=M(document),this._eBody=M(document.body),this._destroyAfterMouseUp=n,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,n,i,o,a=this._getCoordinates(e);this._nOriginalX=(t=a.x)!==null&&t!==void 0?t:0,this._nOriginalY=(n=a.y)!==null&&n!==void 0?n: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,n;e.preventDefault();var i=this._getCoordinates(e);this._nX=((t=i.x)!==null&&t!==void 0?t:0)-this._nOriginalX,this._nY=((n=i.y)!==null&&n!==void 0?n: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,n,i,o,a;if(clearTimeout(this._timeout),(t=this._oDocument)===null||t===void 0||t.unbind("mousemove",this.onMouseMove),(n=this._oDocument)===null||n===void 0||n.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,n,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"),(n=this._oDocument)===null||n===void 0||(i=n.find("iframe"))===null||i===void 0||i.css("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)}_getCoordinates(e){var t,n;return{x:(t=e.pageX)!==null&&t!==void 0?t:0,y:(n=e.pageY)!==null&&n!==void 0?n:0}}}function pn(r,e,t){return(e=Cf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Cf(r){var e=Sf(r,"string");return typeof e=="symbol"?e:e+""}function Sf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class cl{constructor(e,t){pn(this,"_container",void 0),pn(this,"_reactComponent",null),pn(this,"_portalComponent",null),pn(this,"_originalComponentWillUpdate",null),pn(this,"_initialState",void 0),pn(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=Dr.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 n;this._container.setState(t),(n=this._originalComponentWillUpdate)===null||n===void 0||n.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 R.createElement(this._reactClass,t)}}var Tr=["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"],wf=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function Di(r){if(Tr.length>36)throw new Error("Too many keys in config minifier map");var e={};return ki(r,e,"_min"),e}function hi(r){if(Tr.length>36)throw new Error("Too many keys in config minifier map");var e={};return ki(r,e,"_max"),e}function ki(r,e,t){var n=t==="_min"?Ef:_f;for(var i in r)if(r.hasOwnProperty(i)){var o=Array.isArray(r)?r[Number.parseInt(i,10)]:r[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=n(i,Tr);e[s]=a}ki(o,a,t)}else{var l=n(o,wf);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var d=n(i,Tr);e[d]=l}}}}function Ef(r,e){if(typeof r=="string"&&r.length===1)return"___"+r;var t=e.indexOf(r);return t===-1?r:t.toString(36)}function _f(r,e){return typeof r=="string"&&r.length===1?e[parseInt(r,36)]:typeof r=="string"&&r.substr(0,3)==="___"?r[3]:r}function Yr(r,e,t){return(e=Pf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Pf(r){var e=Tf(r,"string");return typeof e=="symbol"?e:e+""}function Tf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class ci{constructor(e,t){Yr(this,"name",void 0),Yr(this,"origin",void 0),Yr(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function sr(r,e,t){return(e=Of(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Of(r){var e=xf(r,"string");return typeof e=="symbol"?e:e+""}function xf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}let ml=class extends ze{constructor(e){super(),sr(this,"_layoutManager",void 0),sr(this,"_dontPropagateToParent",void 0),sr(this,"_childEventSource",void 0),sr(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(ze.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),n=0;n<e;n++)t[n]=arguments[n];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,n="gl_child_event",i=(t=window.opener)===null||t===void 0?void 0:t.document.createEvent("HTMLEvents");i.initEvent(n,!0,!0),i.eventName=n,i.__glArgs=e,i.__gl=this._layoutManager,window.opener.dispatchEvent(i)}_propagateToChildren(e){for(var t=0;t<this._layoutManager.openPopouts.length;t++){var n=this._layoutManager.openPopouts[t].getGlInstance();n&&n!==this._childEventSource&&n.eventHub._$onEventFromParent(e)}}destroy(){M(window).off("gl_child_event",this._boundOnEventFromChild)}};function vl(r,e,t){return r.on(e,t),()=>{r.off(e,t)}}function fl(r){return(e,t)=>vl(e,r,t)}function pl(r){return function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];e.emit(r,...n)}}function gl(r){return(e,t)=>{var n=m.useRef(null),i=m.useRef(()=>!1);if(n.current!=e||i.current!=t){var o;(o=n.current)===null||o===void 0||o.off(r,i.current),e==null||e.on(r,t)}n.current=e,i.current=t,m.useEffect(()=>()=>{var a;return(a=n.current)===null||a===void 0?void 0:a.off(r,i.current)},[])}}function Qt(r){return{listen:fl(r),emit:pl(r),useListener:gl(r)}}const If=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:ci,DragListener:Qn,EventEmitter:ze,EventHub:ml,ReactComponentHandler:cl,animFrame:xi,filterXss:gf,getHashValue:ul,getQueryStringParam:hl,getUniqueId:Pr,listenForEvent:vl,makeEmitFunction:pl,makeEventFunctions:Qt,makeListenFunction:fl,makeUseListenerFunction:gl,minifyConfig:Di,removeFromArray:pf,stripTags:Ii,unminifyConfig:hi},Symbol.toStringTag,{value:"Module"}));function Rt(r,e,t){return(e=Df(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Df(r){var e=kf(r,"string");return typeof e=="symbol"?e:e+""}function kf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class bl extends ze{constructor(e,t,n,i,o){super(),Rt(this,"isInitialised",!1),Rt(this,"_config",void 0),Rt(this,"_dimensions",void 0),Rt(this,"_parentId",void 0),Rt(this,"_indexInParent",void 0),Rt(this,"_layoutManager",void 0),Rt(this,"_popoutWindow",null),Rt(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=n,this._indexInParent=i,this._layoutManager=o,this._createWindow()}toConfig(){var e,t,n,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:(n=(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&&n!==void 0?n: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,n=null;if(this._parentId){var i;if(t=M.extend(!0,{},(i=this.getGlInstance())===null||i===void 0?void 0:i.toConfig()).content[0],n=this._layoutManager.root.getItemsById(this._parentId)[0],!n){var o;((o=this._layoutManager.root.contentItems.length)!==null&&o!==void 0?o:0)>0?n=this._layoutManager.root.contentItems[0]:n=this._layoutManager.root}}t&&((e=n)===null||e===void 0||e.addChild(t,this._indexInParent),this.close())}_createWindow(){var e=this._createUrl(),t=Math.floor(Math.random()*1e6).toString(36),n=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,n),!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=[],n;for(n in e)t.push(n+"="+e[n]);return t.join(",")}_createUrl(){var e={content:this._config},t="gl-window-config-"+Pr();e=Di(e);try{localStorage.setItem(t,JSON.stringify(e))}catch(i){throw new Error("Error while writing to localStorage "+i.toString())}var n=document.location.href.split("?");return n.length===1?n[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 Oe(r,e,t){return(e=Mf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Mf(r){var e=Nf(r,"string");return typeof e=="symbol"?e:e+""}function Nf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class vn extends ze{constructor(e,t,n,i,o,a){var s,l,d,h,c,v,f,p;if(super(),Oe(this,"_dragListener",void 0),Oe(this,"_layoutManager",void 0),Oe(this,"_contentItem",void 0),Oe(this,"_originalParent",void 0),Oe(this,"_area",null),Oe(this,"_lastValidArea",null),Oe(this,"_minX",void 0),Oe(this,"_maxX",void 0),Oe(this,"_minY",void 0),Oe(this,"_maxY",void 0),Oe(this,"_width",void 0),Oe(this,"_height",void 0),Oe(this,"_sided",void 0),Oe(this,"element",void 0),Oe(this,"childElementContainer",void 0),Oe(this,"_proxyTab",void 0),this._dragListener=n,this._layoutManager=i,this._contentItem=o,this._originalParent=a,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var g,b;this._layoutManager.tabDropPlaceholder.width((g=this._contentItem.tab.element.outerWidth(!0))!==null&&g!==void 0?g:0),this._layoutManager.tabDropPlaceholder.height((b=this._contentItem.tab.element.outerHeight(!0))!==null&&b!==void 0?b:0)}if(this.element=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",Ii((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 E,x;this._layoutManager.tabDropPlaceholder.width((E=this._proxyTab.outerWidth(!0))!==null&&E!==void 0?E:0),this._layoutManager.tabDropPlaceholder.height((x=this._proxyTab.outerHeight(!0))!==null&&x!==void 0?x:0)}var P=this._layoutManager.container.offset();this._minX=(d=P==null?void 0:P.left)!==null&&d!==void 0?d:0,this._minY=(h=P==null?void 0:P.top)!==null&&h!==void 0?h:0,this._maxX=((c=this._layoutManager.container.width())!==null&&c!==void 0?c:0)+this._minX,this._maxY=((v=this._layoutManager.container.height())!==null&&v!==void 0?v:0)+this._minY,this._width=(f=this.element.width())!==null&&f!==void 0?f: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,n){var i,o,a=(i=n.pageX)!==null&&i!==void 0?i:0,s=(o=n.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,n=e.dragProxyHeight;this.element.width(t),this.element.height(n),t-=this._sided?e.headerHeight:0,n-=this._sided?0:e.headerHeight,this.childElementContainer.width(t),this.childElementContainer.height(n),this._contentItem.element.width(t),this._contentItem.element.height(n),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}Oe(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 lr(r,e,t){return(e=jf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jf(r){var e=Af(r,"string");return typeof e=="symbol"?e:e+""}function Af(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class yl{constructor(e,t,n){lr(this,"_element",void 0),lr(this,"_itemConfig",void 0),lr(this,"_layoutManager",void 0),lr(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=n,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new Qn(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this),this._dragListener}_onDragStart(e,t){var n=this._itemConfig;typeof n=="function"&&(n=n());var i=this._layoutManager._$normalizeContentItem(M.extend(!0,{},n));new vn(e,t,this._dragListener,this._layoutManager,i,null)}}function dr(r,e,t){return(e=Lf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Lf(r){var e=Rf(r,"string");return typeof e=="symbol"?e:e+""}function Rf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Cl{constructor(e,t,n){dr(this,"_element",M(window)),dr(this,"_itemConfig",void 0),dr(this,"_layoutManager",void 0),dr(this,"_dragListener",void 0),this._itemConfig=e,this._layoutManager=t,this._createDragListener(n)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&(this._dragListener=new Qn(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 n=this._itemConfig;typeof n=="function"&&(n=n());var i=this._layoutManager._$normalizeContentItem(M.extend(!0,{},n));new vn(e,t,this._dragListener,this._layoutManager,i,null)}}}function Sl(r,e,t){return(e=Ff(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ff(r){var e=$f(r,"string");return typeof e=="symbol"?e:e+""}function $f(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Jn{constructor(){Sl(this,"element",M(Jn._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(Jn,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function Qr(r,e,t){return(e=Hf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Hf(r){var e=Bf(r,"string");return typeof e=="symbol"?e:e+""}function Bf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class $n{constructor(e,t,n,i){Qr(this,"element",void 0),Qr(this,"_header",void 0),Qr(this,"_action",void 0),this._header=e,this.element=M('<li class="'+n+'" 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 Wf(r,e,t){return(e=Uf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Uf(r){var e=Vf(r,"string");return typeof e=="symbol"?e:e+""}function Vf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class on extends Error{constructor(e,t){super(),Wf(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const Kf=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:on},Symbol.toStringTag,{value:"Module"}));function Pe(r,e,t){return(e=zf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zf(r){var e=Gf(r,"string");return typeof e=="symbol"?e:e+""}function Gf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function an(r){return r.isStack}function Qe(r){return r.isComponent}function wl(r){return r.isRoot}class ke extends ze{constructor(e,t,n,i){super(),Pe(this,"config",void 0),Pe(this,"type",void 0),Pe(this,"contentItems",void 0),Pe(this,"parent",void 0),Pe(this,"layoutManager",void 0),Pe(this,"element",void 0),Pe(this,"childElementContainer",void 0),Pe(this,"componentName",void 0),Pe(this,"isInitialised",!1),Pe(this,"isMaximised",!1),Pe(this,"isRoot",!1),Pe(this,"isRow",!1),Pe(this,"isColumn",!1),Pe(this,"isStack",!1),Pe(this,"isComponent",!1),Pe(this,"tab",void 0),Pe(this,"_pendingEventPropagations",void 0),Pe(this,"_throttledEvents",void 0),this.element=i,this.config=this._extendItemNode(t),this.type=t.type,this.contentItems=[],this.parent=n,this.layoutManager=e,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(ze.ALL_EVENT,this._propagateEvent,this),t.content&&this._createContentItems(t)}callDownwards(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;n!==!0&&i!==!0&&this[e].apply(this,t);for(var o=0;o<this.contentItems.length;o++)this.contentItems[o].callDownwards(e,t,n);n===!0&&i!==!0&&this[e].apply(this,t)}removeChild(e){var t,n=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(n!==!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 n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;t=this.layoutManager._$normalizeContentItem(t);var i=this.contentItems.indexOf(e),o=e.element[0].parentNode;if(i===-1)throw new Error("Can't replace child. oldChild is not child of this");o==null||o.replaceChild(t.element[0],e.element[0]),n===!0&&(e.parent=null,e._$destroy()),this.contentItems[i]=t,t.parent=this,an(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=[],n=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 n(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),n=[],i=0;i<t.length;i++)n.push(t[i].instance);return n}_$getItemsByProperty(e,t){return this.getItemsByFilter(function(n){return n[e]===t})}_$setParent(e){this.parent=e}_$highlightDropZone(e,t,n){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(n)}_$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"),n=null,i=0;i<t.length;i++)n=t[i].getActiveContentItem(),n&&Qe(n)&&n.container[e]()}_$destroy(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")}_$getArea(e){var t,n,i;e=e||this.element;var o=(t=e.offset())!==null&&t!==void 0?t:{left:0,top:0},a=(n=e.width())!==null&&n!==void 0?n: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 ci(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new on("content must be an Array",e);for(var n=0;n<e.content.length;n++)t=this.layoutManager.createContentItem(e.content[n],this),this.contentItems.push(t)}_extendItemNode(e){for(var[t,n]of Object.entries(dl)){var i=t;e[i]===void 0&&(e[i]=n)}return e}_propagateEvent(e,t){t instanceof ci&&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,xi(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function Nn(r,e,t){return(e=qf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function qf(r){var e=Xf(r,"string");return typeof e=="symbol"?e:e+""}function Xf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class El extends ke{constructor(e,t,n){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,n,M()),Nn(this,"config",void 0),Nn(this,"componentName",void 0),Nn(this,"container",void 0),Nn(this,"parent",void 0),Nn(this,"instance",void 0),this.config=t,this.parent=n;var o=e.getComponent(this.config.componentName)||e.getFallbackComponent(),a=M.extend(!0,{},this.config.componentState||{});if(o==null)throw new on('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 ui(this.config,this,e),this.instance=new o(this.container,a),this.element=this.container._element}close(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}setSize(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())}_$init(){ke.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),ke.prototype._$hide.call(this)}_$show(e){this.container.show(),(this.container._config.isFocusOnShow||e)&&this.container._contentElement[0].focus({preventScroll:!0}),ke.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),ke.prototype._$destroy.call(this)}_$getArea(){return null}}function ut(r,e,t){return(e=Zf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Zf(r){var e=Yf(r,"string");return typeof e=="symbol"?e:e+""}function Yf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class zn extends ke{constructor(e,t,n,i){super(t,n,i,M('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),ut(this,"isRow",void 0),ut(this,"isColumn",void 0),ut(this,"childElementContainer",void 0),ut(this,"parent",void 0),ut(this,"_splitter",[]),ut(this,"_splitterSize",void 0),ut(this,"_splitterGrabSize",void 0),ut(this,"_isColumn",void 0),ut(this,"_dimension",void 0),ut(this,"_splitterPosition",null),ut(this,"_splitterMinPosition",null),ut(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,n){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),ke.prototype.addChild.call(this,e,t),i=1/this.contentItems.length*100,n===!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 n,i=(n=e.config[this._dimension])!==null&&n!==void 0?n: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)}if(ke.prototype.removeChild.call(this,e,t),this.contentItems.length===1&&this.config.isClosable===!0){var h;l=this.contentItems[0],this.contentItems=[],(h=this.parent)===null||h===void 0||h.replaceChild(this,l,!0)}else this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}replaceChild(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=e.config[this._dimension];t.config[this._dimension]=i,super.replaceChild(e,t,n),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(ke.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,n=(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-=n:i-=n;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 v=Math.floor((this._isColumn?o:i)-a);return{itemSizes:s,additionalPixel:v,totalWidth:i,totalHeight:o}}_calculateRelativeSizes(){for(var e=0,t=[],n=this._isColumn?"height":"width",i=0;i<this.contentItems.length;i++){var o=this.contentItems[i].config[n];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[n]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var s=0;s<t.length;s++)t[s].config[n]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var d;this.contentItems[l].config[n]=((d=this.contentItems[l].config[n])!==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,n=[],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},n.push(l)),s.push(l)}if(!(o===0||o>i)){var v=o/i;a=o;for(var f=0;f<n.length;f++){l=n[f];var p=Math.round((l.width-t)*v);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,n=0,i=0;i<e.length;++i){var o,a;t=Math.max((o=e[i].minWidth)!==null&&o!==void 0?o:0,t),n=Math.max((a=e[i].minHeight)!==null&&a!==void 0?a:0,n)}return{horizontal:t,vertical:n}}_onSplitterDragStart(e){var t,n,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((n=a.after.config.content)!==null&&n!==void 0?n:[]),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,n){var i=this._isColumn?n: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,n,i,o,a,s=this._getItemsForSplitter(e),l=(t=s.before.element[this._dimension]())!==null&&t!==void 0?t:0,d=(n=s.after.element[this._dimension]())!==null&&n!==void 0?n: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}),xi(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function oa(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function aa(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?oa(Object(t),!0).forEach(function(n){mi(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):oa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function mi(r,e,t){return(e=Qf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Qf(r){var e=Jf(r,"string");return typeof e=="symbol"?e:e+""}function Jf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class vi extends ke{constructor(e,t,n){super(e,aa(aa({},t),{},{type:"root"}),null,M('<div class="lm_goldenlayout lm_item lm_root"></div>')),mi(this,"childElementContainer",void 0),mi(this,"_containerElement",void 0),this.isRoot=!0,this.type="root",this.childElementContainer=this.element,this._containerElement=n,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 n,i;e=typeof e>"u"?(n=this._containerElement.width())!==null&&n!==void 0?n: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,n){this.layoutManager.tabDropPlaceholder.remove(),super._$highlightDropZone(e,t,n)}_$onDrop(e,t){var n;if(Qe(e)&&(n=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this),n._$init(),n.addChild(e),e=n),!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 zn)||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 sa(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function gn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?sa(Object(t),!0).forEach(function(n){tt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):sa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function tt(r,e,t){return(e=ep(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ep(r){var e=tp(r,"string");return typeof e=="symbol"?e:e+""}function tp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class fi extends ke{constructor(e,t,n){var i,o,a,s,l,d,h,c,v;super(e,t,n,M('<div class="lm_item lm_stack"></div>')),tt(this,"_activeContentItem",null),tt(this,"_header",void 0),tt(this,"childElementContainer",M('<div class="lm_items"></div>')),tt(this,"header",void 0),tt(this,"parent",void 0),tt(this,"isStack",!0),tt(this,"_dropSegment",null),tt(this,"_contentAreaDimensions",null),tt(this,"_dropIndex",void 0),tt(this,"_side",void 0),tt(this,"_sided",!1),tt(this,"config",void 0),this.parent=n,this.config=t;var f=e.config;this._side=!1,this._header={show:((i=f.settings)===null||i===void 0?void 0:i.hasHeaders)&&t.hasHeaders!==!1,popout:(o=f.settings)!==null&&o!==void 0&&o.showPopoutIcon?(a=f.labels)===null||a===void 0?void 0:a.popout:void 0,maximise:(s=f.settings)!==null&&s!==void 0&&s.showMaximiseIcon?(l=f.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(d=f.settings)!==null&&d!==void 0&&d.showCloseIcon?(h=f.labels)===null||h===void 0?void 0:h.close:void 0,minimise:(c=(v=f.labels)===null||v===void 0?void 0:v.minimise)!==null&&c!==void 0?c:void 0},f.header&&(this._header=gn(gn({},this._header),f.header)),t.header&&(this._header=gn(gn({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=gn(gn({},this._header),t.content[0].header)),this.header=new jt(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,n,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=((n=this.element.width())!==null&&n!==void 0?n:0)-(this._sided?a:0),l=((i=this.element.height())!==null&&i!==void 0?i:0)-(this._sided?0:a);for(this.childElementContainer.width(s),this.childElementContainer.height(l),o=0;o<this.contentItems.length;o++)this.contentItems[o].element.width(s).height(l);this.emit("resize"),this.emitBubblingEvent("stateChanged")}_$init(){if(this.isInitialised!==!0){this.header._attachWheelListener(),super._$init();for(var e=0;e<this.contentItems.length;e++)this.header.createTab(this.contentItems[e]),this.contentItems[e]._$hide();if(this.contentItems.length>0){var t=this.contentItems[this.config.activeItemIndex||0];if(!t)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(t)}}}setActiveContentItem(e,t){if(this.contentItems.indexOf(e)===-1)throw new Error("contentItem is not a child of this stack");this._activeContentItem!==null&&this._activeContentItem._$hide(),this._activeContentItem=e,this.header.setActiveContentItem(e),Qe(e)?e._$show(t):e._$show(),this.emit("activeContentItemChanged",e),this.layoutManager.emit("activeContentItemChanged",e),this.emitBubblingEvent("stateChanged")}getActiveContentItem(){return this.header.activeContentItem}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),super.addChild(e,t),this.childElementContainer.append(e.element),this.header.createTab(e,t),this.setActiveContentItem(e),this.callDownwards("setSize"),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}removeChild(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=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(n-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}_$validateClosability(){for(var e=this.header._isClosable(),t=0,n=this.contentItems.length;t<n;t++){var i;if(!e)break;e=(i=this.contentItems[t].config.isClosable)!==null&&i!==void 0?i:!1}this.header._$setClosable(e)}_$destroy(){ke.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",n=this._dropSegment==="left"||this._dropSegment==="right",i=this._dropSegment==="top"||this._dropSegment==="left",o=this.parent instanceof zn&&(t&&this.parent.isColumn||n&&this.parent.isRow),a=t?"column":"row",s=t?"height":"width";if(Qe(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,v=this.layoutManager.createContentItem({type:a},this);(c=this.parent)===null||c===void 0||c.replaceChild(this,v),v.addChild(e,i?0:void 0,!0),v.addChild(this,i?void 0:0,!0),this.config[s]=50,e.config[s]=50,v.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[n,i]of Object.entries(this._contentAreaDimensions)){var o=i.hoverArea;if(o.x1<e&&o.x2>e&&o.y1<t&&o.y2>t){n==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(n));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 n=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+n*.25,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x1+n*.5,y2:t.y2}},this._contentAreaDimensions.top={hoverArea:{x1:t.x1+n*.25,y1:t.y1,x2:t.x1+n*.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+n*.75,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1+n*.5,y1:t.y1,x2:t.x2,y2:t.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:t.x1+n*.25,y1:t.y1+i*.5,x2:t.x1+n*.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,n,i,o,a,s,l,d,h,c,v,f,p,g,b,E,x=this.header.tabs.length;if(x===0){var P,F,U,ee,j,W,H,ne,oe=this.header.element.offset();(P=this.layoutManager.dropTargetIndicator)===null||P===void 0||P.highlightArea({x1:(F=oe==null?void 0:oe.left)!==null&&F!==void 0?F:0,x2:((U=oe==null?void 0:oe.left)!==null&&U!==void 0?U:0)+100,y1:(ee=(j=this.header.element.offset())===null||j===void 0?void 0:j.top)!==null&&ee!==void 0?ee:0,y2:((W=(H=this.header.element.offset())===null||H===void 0?void 0:H.top)!==null&&W!==void 0?W:0)+((ne=this.header.element.innerHeight())!==null&&ne!==void 0?ne:0)});return}var L=this.header.tabsContainer,X=(t=L.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),z=(n=this.layoutManager.tabDropPlaceholder.get(0))===null||n===void 0?void 0:n.getBoundingClientRect();if(!(!X||!z)){e<X.left?e=X.left+1:e>X.right&&(e=X.right-1);var A,V;if(!(z.left<e&&e<z.right)){for(var G=0;G<x;G++){var pe;if(A=this.header.tabs[G].element,V=(pe=A.get(0))===null||pe===void 0?void 0:pe.getBoundingClientRect(),V&&V.left<e&&e<V.right){this._dropIndex=G;break}}if(A&&V&&e<V.left+V.width*.5)A.before(this.layoutManager.tabDropPlaceholder);else if(A){var Ge;this._dropIndex=Math.min(((Ge=this._dropIndex)!==null&&Ge!==void 0?Ge:0)+1,x),A.after(this.layoutManager.tabDropPlaceholder)}}var je=(i=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&i!==void 0?i:0;je=Math.max(je,(a=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&a!==void 0?a:0);var y=je+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);y=Math.min(y,((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)),(v=this.layoutManager.dropTargetIndicator)===null||v===void 0||v.highlightArea({x1:je,x2:y,y1:(f=(p=this.header.element.offset())===null||p===void 0?void 0:p.top)!==null&&f!==void 0?f:0,y2:((g=(b=this.header.element.offset())===null||b===void 0?void 0:b.top)!==null&&g!==void 0?g:0)+((E=this.header.element.innerHeight())!==null&&E!==void 0?E:0)})}}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){var e=["right","left","bottom"].some(n=>n===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,n,i=(t=this._contentAreaDimensions)===null||t===void 0||(n=t[e])===null||n===void 0?void 0:n.highlightArea;if(i){var o;(o=this.layoutManager.dropTargetIndicator)===null||o===void 0||o.highlightArea(i)}this._dropSegment=e}}const np=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:ke,Component:El,ContentItem:ke,Root:vi,RowOrColumn:zn,Stack:fi,isComponent:Qe,isRoot:wl,isStack:an},Symbol.toStringTag,{value:"Module"}));function Dt(r,e,t){return(e=rp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function rp(r){var e=ip(r,"string");return typeof e=="symbol"?e:e+""}function ip(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class er{constructor(e,t){var n;Dt(this,"header",void 0),Dt(this,"contentItem",void 0),Dt(this,"element",M(er._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,(n=this._layoutManager.config.settings)!==null&&n!==void 0&&n.reorderEnabled&&t.config.reorderEnabled&&(this._dragListener=new Qn(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.element.on("mouseup",this._onMouseUp),this.contentItem.config.isClosable?(this.closeElement.on("click",this._onCloseClick),this.closeElement.on("mousedown",this._onCloseMousedown)):this.closeElement.remove(),this.contentItem.tab=this,this.contentItem.emit("tab",this),this.contentItem.layoutManager.emit("tabCreated",this),Qe(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.element.off("mouseup",this._onMouseUp),this.closeElement.off("click",this._onCloseClick),Qe(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 n;(n=this.contentItem.parent)!==null&&n!==void 0&&n.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(){Qe(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.element.removeClass("lm_focusin")}_onTabClick(e){if(!e||e.button===0){var t,n=this.header.parent.getActiveContentItem();this.contentItem!==n&&Qe(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):Qe(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),Qe(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(),Qe(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onMouseUp(e){e.button===1&&(e.preventDefault(),e.stopPropagation())}_onCloseMousedown(e){e.stopPropagation()}}Dt(er,"_template",['<li class="lm_tab">','<span class="lm_title_before"></span>','<span class="lm_title"></span>','<div class="lm_close_tab" aria-label="Close tab"></div>',"</li>"].join(""));function le(r,e,t){return(e=op(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function op(r){var e=ap(r,"string");return typeof e=="symbol"?e:e+""}function ap(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class jt extends ze{constructor(e,t){var n,i;super(),le(this,"layoutManager",void 0),le(this,"element",M(jt._template)),le(this,"tabsContainer",void 0),le(this,"tabDropdownContainer",void 0),le(this,"tabDropdownSearch",void 0),le(this,"tabDropdownList",null),le(this,"controlsContainer",void 0),le(this,"parent",void 0),le(this,"tabs",[]),le(this,"activeContentItem",null),le(this,"closeButton",null),le(this,"tabDropdownButton",null),le(this,"tabNextButton",M(jt._nextButtonTemplate)),le(this,"tabPreviousButton",M(jt._previousButtonTemplate)),le(this,"holdTimer",null),le(this,"rAF",null),le(this,"CLICK_TIMEOUT",500),le(this,"START_SPEED",.01),le(this,"ACCELERATION",5e-4),le(this,"PADDING",10),le(this,"SCROLL_LEFT","left"),le(this,"SCROLL_RIGHT","right"),le(this,"isDraggingTab",!1),le(this,"isOverflowing",!1),le(this,"isDropdownShown",!1),le(this,"dropdownKeyIndex",0),le(this,"_lastVisibleTabIndex",-1),le(this,"_tabControlOffset",void 0),this.layoutManager=e,(n=this.layoutManager.config.settings)!==null&&n!==void 0&&n.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 n=0;n<this.tabs.length;n++)if(this.tabs[n].contentItem===e)return;var i=new er(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,n,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||(n=t.scrollIntoView)===null||n===void 0||n.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 n=Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX;if(e.deltaMode===WheelEvent.DOM_DELTA_PAGE){var i;n*=(i=this.tabsContainer.innerWidth())!==null&&i!==void 0?i:1}else e.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=100/3);t.scrollLeft+=Math.round(n)}}_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 n,i,o,a,s;if(((n=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&n!==void 0?n: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 n,i,o;if(((n=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&n!==void 0?n: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,n;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)===((n=this.tabsContainer.get(0))===null||n===void 0?void 0:n.scrollWidth)?this.tabNextButton.prop("disabled",!0):(this.tabNextButton.prop("disabled",!1),this.tabPreviousButton.first().prop("disabled",!1))}_handleScrollRepeat(e,t){var n,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((n=this.rAF)!==null&&n!==void 0?n:-1),this.rAF=window.requestAnimationFrame(h=>{var c,v,f=o||h,p=h-f,g=this.START_SPEED*p+.5*this.ACCELERATION*(p*p);g=Math.min(g,(c=(v=this.tabsContainer.get(0))===null||v===void 0?void 0:v.scrollWidth)!==null&&c!==void 0?c:1/0),this._handleScrollRepeat(e,t,g,f)})}}_$setClosable(e){return this.closeButton&&this._isClosable()?(this.closeButton.element[e?"show":"hide"](),!0):!1}_$destroy(){this.emit("destroy",this);for(var e=0;e<this.tabs.length;e++)this.tabs[e]._$destroy();this._detachWheelListener(),this._handleItemDropped(),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,n,i,o;if(o=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new $n(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),n=this._getHeaderSetting("popout"),new $n(this,n,"lm_popout",t)),this._getHeaderSetting("maximise")){i=this.parent.toggleMaximise.bind(this.parent);var a=this._getHeaderSetting("maximise"),s=this._getHeaderSetting("minimise"),l=new $n(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),n=this._getHeaderSetting("close"),this.closeButton=new $n(this,n,"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 n,i;e.preventDefault(),(n=this.tabDropdownList)===null||n===void 0||n.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 n,i;((n=(i=this.tabs[t].contentItem.config.title)===null||i===void 0?void 0:i.toLowerCase().indexOf(e.target.value.toLowerCase()))!==null&&n!==void 0?n:-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,n;this.isDropdownShown&&(e&&(t=this.tabDropdownContainer.get(0))!==null&&t!==void 0&&t.contains(e.target)||e&&((n=this.tabDropdownButton)===null||n===void 0?void 0:n.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,n,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=(n=M(window).height())!==null&&n!==void 0?n: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,v=Math.min(d.left+(c?d.width:0),l-a.width-this.PADDING),f=c?Math.max(d.top-o,this.PADDING):d.bottom,p=s-f-this.PADDING;this.tabDropdownContainer.css({"max-height":p,top:f,left:v})}}}}_isClosable(){return!!(this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon)}_onPopoutClick(){if(this.layoutManager.config.settings.popoutWholeStack===!0)this.parent.popout();else{var e;(e=this.activeContentItem)===null||e===void 0||e.popout()}}_onHeaderClick(e){e.target===this.element[0]&&this.parent.select()}_updateTabSizes(){if(this.tabs.length!==0){var e=this.tabsContainer.get(0);if(this.isDropdownShown&&this._updateAdditionalTabsDropdown(),!!e){if(!this.isOverflowing&&e.scrollWidth>e.clientWidth){var t;(t=this.tabDropdownButton)===null||t===void 0||t.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0}else if(this.isOverflowing&&e.scrollWidth<=e.clientWidth){var n;(n=this.tabDropdownButton)===null||n===void 0||n.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1}this.isOverflowing&&this._checkScrollArrows()}}}}le(jt,"_template",['<div class="lm_header">','<ul class="lm_tabs"></ul>','<ul class="lm_controls"></ul>','<ul class="lm_tabdropdown_list">','<li class="lm_tabdropdown_search"><input type="text" placeholder="Find tab..."></li>',"</ul>","</div>"].join(""));le(jt,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));le(jt,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function jn(r,e,t){return(e=sp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sp(r){var e=lp(r,"string");return typeof e=="symbol"?e:e+""}function lp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class _l{constructor(e,t,n){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=n<t?t:n,this.element=this._createElement(),this._dragListener=new Qn(this.element)}on(e,t,n){var i;(i=this._dragListener)===null||i===void 0||i.on(e,t,n)}_$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 n=this._grabSize-this._size,i=n/2;return this._isVertical?(e.css("top",-i),e.css("height",this._size+n),t.addClass("lm_vertical"),t.height(this._size)):(e.css("left",-i),e.css("width",this._size+n),t.addClass("lm_horizontal"),t.width(this._size)),t}}const dp=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:bl,DragProxy:vn,DragSource:yl,DragSourceFromEvent:Cl,DropTargetIndicator:Jn,Header:jt,HeaderButton:$n,Splitter:_l,Tab:er},Symbol.toStringTag,{value:"Module"}));var up={config:uf,container:ff,controls:dp,errors:Kf,items:np,utils:If};function la(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Xe(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?la(Object(t),!0).forEach(function(n){de(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):la(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function de(r,e,t){return(e=hp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function hp(r){var e=cp(r,"string");return typeof e=="symbol"?e:e+""}function cp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var da=["column","row","stack","component"];class Lr extends ze{static isLayoutItemConfig(e){return da.includes(e.type)}static minifyConfig(e){return Di(e)}static unminifyConfig(e){return hi(e)}constructor(e,t){super(),de(this,"isInitialised",!1),de(this,"_isFullPage",!1),de(this,"_resizeTimeoutId",void 0),de(this,"_components",{"lm-react-component":cl}),de(this,"_fallbackComponent",void 0),de(this,"_itemAreas",[]),de(this,"_maximisedItem",null),de(this,"_maximisePlaceholder",M('<div class="lm_maximise_place"></div>')),de(this,"_creationTimeoutPassed",!1),de(this,"_subWindowsCreated",!1),de(this,"_dragSources",[]),de(this,"_updatingColumnsResponsive",!1),de(this,"_firstLoad",!0),de(this,"_reactChildMap",new Map),de(this,"_reactChildren",null),de(this,"_initialHeaderHeight",void 0),de(this,"width",null),de(this,"height",null),de(this,"root",void 0),de(this,"openPopouts",[]),de(this,"selectedItem",null),de(this,"isSubWindow",!1),de(this,"eventHub",new ml(this)),de(this,"config",void 0),de(this,"container",void 0),de(this,"_originalContainer",void 0),de(this,"dropTargetIndicator",null),de(this,"tabDropPlaceholder",M('<div class="lm_drop_tab_placeholder"></div>')),this._onResize=this._onResize.bind(this),this._onUnload=this._onUnload.bind(this),this._windowBlur=this._windowBlur.bind(this),this._windowFocus=this._windowFocus.bind(this),this._windowKeydown=this._windowKeydown.bind(this),this.config=this._createConfig(e),this._originalContainer=t,this.container=this._getContainer(),this._initialHeaderHeight=this.config.dimensions.headerHeight,this.isSubWindow&&M("body").css("visibility","hidden")}registerComponent(e,t){if(typeof t!="function"&&(t==null||t.render==null||typeof t.render!="function"))throw new Error("Please register a constructor function");if(this._components[e]!==void 0)throw new Error("Component "+e+" is already registered");this._components[e]=t;var n=()=>{if(this._components[e]===void 0)throw new Error("Component "+e+" is not registered");delete this._components[e]};return n}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 ke))throw new Error("Root must be a ContentItem");var t={settings:Xe({},this.config.settings),dimensions:Xe({},this.config.dimensions),labels:Xe({},this.config.labels),content:[]},n=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?n(t,{contentItems:[e]}):n(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 Jn,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 n=this._reactChildMap.get(e);n===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 n,i;if(this.width=(n=e??this.container.width())!==null&&n!==void 0?n: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"),M(window).off("keydown",this._windowKeydown),this.root.callDownwards("_$destroy",[],!0),this.root.contentItems=[],this.tabDropPlaceholder.remove(),(e=this.dropTargetIndicator)===null||e===void 0||e.destroy(),this.eventHub.destroy(),this._dragSources.forEach(function(t){t._dragListener.destroy()}),this._dragSources=[])}createContentItem(e,t){var n,i;if(typeof e.type!="string")throw new on("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!Lr.isLayoutItemConfig(e))throw i="Unknown type '"+e.type+"'. Valid types are "+da.join(","),new on(i);return e.type==="component"&&!(t instanceof fi)&&t&&!(this.isSubWindow===!0&&t instanceof vi)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),e.id=(n=e.id)!==null&&n!==void 0?n:Pr(),e.type==="stack"?new fi(this,e,t):e.type==="row"?new zn(!1,this,e,t):e.type==="column"?new zn(!0,this,e,t):new El(this,e,t)}createPopout(e,t,n,i){var o=[],a=e instanceof ke,s=this;if(a){var l;o=this.toConfig(e).content,n=Pr();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(n),i==null||Number.isNaN(i)){var v;i=(v=d)===null||v===void 0?void 0:v.contentItems.indexOf(h)}}else e instanceof Array?o=e:o=[e];if(!t&&a){var f,p,g,b=window.screenX||window.screenLeft,E=window.screenY||window.screenTop,x=(f=e.element.offset())!==null&&f!==void 0?f:{left:0,top:0};t={left:b+x.left,top:E+x.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||!n||i===void 0)){var P=new bl(o,t,n,i,this);return P.on("initialised",function(){s.emit("windowOpened",P)}),P.on("closed",function(){s._$reconcilePopoutWindows()}),this.openPopouts.push(P),P}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var n=new yl(e,t,this);return this._dragSources.push(n),n}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,n;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((n=this.container.height())!==null&&n!==void 0?n: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 n=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&&n>a.surface&&(n=a.surface,i=a)}return i}_$createRootItemAreas(){var e=50,t=Xe({},this.root._$getArea()),n=[Xe(Xe({},t),{},{side:"left",x2:t.x1+e}),Xe(Xe({},t),{},{side:"right",x1:t.x2-e}),Xe(Xe({},t),{},{side:"top",y2:t.y1+e}),Xe(Xe({},t),{},{side:"bottom",y1:t.y2-e})];n.forEach(i=>{i.surface=(i.x2-i.x1)*(i.y2-i.y1)}),this._itemAreas.push(...n)}_$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 n=e[t];if(an(n)){var i=n._$getArea();if(i!==null)if(i instanceof Array)this._itemAreas=this._itemAreas.concat(i);else{var o;this._itemAreas.push(i);var a=Xe(Xe({},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 ke)return e;if(M.isPlainObject(e)&&e.type){var n=this.createContentItem(e,t??null);return n.callDownwards("_$init"),n}else throw new Error("Invalid contentItem")}_$reconcilePopoutWindows(){for(var e=[],t=0;t<this.openPopouts.length;t++){var n;((n=this.openPopouts[t].getWindow())===null||n===void 0?void 0:n.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=n=>{if(e.push(n),n.contentItems instanceof Array)for(var i=0;i<n.contentItems.length;i++)t(n.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).on("keydown",this._windowKeydown)}_windowBlur(){this.root.element.addClass("lm_window_blur")}_windowFocus(){this.root.element.removeClass("lm_window_blur")}_windowKeydown(e){if(e.key==="Escape"&&this._maximisedItem!==null){var t=document.activeElement;if(t&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT"||t.isContentEditable))return;this._maximisedItem.toggleMaximise()}}_onResize(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(this.updateSize.bind(this),100)}_createConfig(e){var t,n=hl("gl-window");n&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(n)||"{}"),e=hi(e),localStorage.removeItem(n)),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=Ii((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 on(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new on(t,e);this.root=new vi(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,n=e*t;if(!(this.width==null||n<=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(n){e.addChild(n),t.removeChild(n,!0)}):t.contentItems.forEach(n=>{this._addChildContentItemsToContainer(e,n)})}_findAllStackContainers(){var e=[];return this._findAllStackContainersRecursive(e,this.root),e}_findAllStackContainersRecursive(e,t){t.contentItems.forEach(n=>{an(n)?e.push(n):n.isComponent||this._findAllStackContainersRecursive(e,n)})}}de(Lr,"__lm",up);const mp="_lm_dragging_k4a5m_1",vp="_lm_goldenlayout_k4a5m_1",fp="_lm_header_k4a5m_1",pp="_lm_controls_k4a5m_1",gp="_lm_tabpreviousbutton_k4a5m_1",bp="_lm_tabnextbutton_k4a5m_1",yp="_lm_tab_k4a5m_1",Cp="_lm_active_k4a5m_1",Sp="_lm_close_tab_k4a5m_1",wp="_lm_content_k4a5m_1",Ep="_lm_dragProxy_k4a5m_1",_p="_lm_dropTargetIndicator_k4a5m_1",Pp="_march_k4a5m_1",Tp="_lm_inner_k4a5m_1",Op="_lm_splitter_k4a5m_1",xp="_lm_selectable_k4a5m_1",Ip="_lm_tabdropdown_list_k4a5m_1",Dp="_lm_title_k4a5m_1",kp="_lm_title_before_k4a5m_1",Mp="_lm_selected_k4a5m_1",Np="_lm_focusin_k4a5m_1",jp="_lm_window_blur_k4a5m_1",Ap="_lm_popout_k4a5m_1",Lp="_lm_maximise_k4a5m_1",Rp="_lm_tabdropdown_k4a5m_1",Fp="_lm_close_k4a5m_1",$p="_lm_tabdropdown_search_k4a5m_1",Hp="_lm_tabs_k4a5m_1",Bp="_lm_keyboard_active_k4a5m_1",Wp="_lm_maximised_k4a5m_1",Up="_lm_items_k4a5m_1",ua={"tab-height":"28px","drag-border-width":"5px",lm_dragging:mp,lm_goldenlayout:vp,lm_header:fp,lm_controls:pp,lm_tabpreviousbutton:gp,lm_tabnextbutton:bp,lm_tab:yp,lm_active:Cp,lm_close_tab:Sp,lm_content:wp,lm_dragProxy:Ep,lm_dropTargetIndicator:_p,march:Pp,lm_inner:Tp,lm_splitter:Op,lm_selectable:xp,lm_tabdropdown_list:Ip,lm_title:Dp,lm_title_before:kp,lm_selected:Mp,lm_focusin:Np,lm_window_blur:jp,lm_popout:Ap,lm_maximise:Lp,lm_tabdropdown:Rp,lm_close:Fp,lm_tabdropdown_search:$p,lm_tabs:Hp,lm_keyboard_active:Bp,lm_maximised:Wp,lm_items:Up},ha=Object.freeze({tabHeight:parseInt(ua["tab-height"],10),dragBorderWidth:parseInt(ua["drag-border-width"],10)});function ca(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function It(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ca(Object(t),!0).forEach(function(n){Pl(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ca(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Pl(r,e,t){return(e=Vp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Vp(r){var e=Kp(r,"string");return typeof e=="symbol"?e:e+""}function Kp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ft=K.module("LayoutUtils");function Tl(r){return r.componentName!==void 0}function Cn(r){var e=r;return(Tl(r)&&r.componentName==="lm-react-component"||r.type==="react-component")&&e.component!==void 0}function ur(r){return r.focus!==void 0}function ma(r){return r.type==="stack"}class O{static activateTab(e,t){var n=O.getStackForRoot(e,t,!1);if(!n){Ft.error("Could not find stack for config",t);return}var i=O.getContentItemInStack(n,t);i&&n.setActiveContentItem(i)}static isActiveTab(e,t){var n=O.getStackForRoot(e,t,!1);if(!n)return Ft.error("Could not find stack for config",t),!1;var i=O.getContentItemInStack(n,t),o=n.getActiveContentItem();return o===i}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(wl(e)){var n={type:t?"column":"row"};(e.contentItems==null||e.contentItems.length===0)&&e.addChild(n);var i=e.contentItems[0],o=t?i.isColumn:i.isRow;if(!o){e.removeChild(i,!0),e.addChild(n);var a=document.activeElement;e.contentItems[0].addChild(i),a&&a.focus!=null&&a.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var s=e.contentItems[e.contentItems.length-1],l=t?s.isRow:s.isColumn;if(!l){var d,h,c=e.layoutManager.createContentItem({type:t?"row":"column",height:(d=s.config)===null||d===void 0?void 0:d.height,width:(h=s.config)===null||h===void 0?void 0:h.width},e);e.replaceChild(s,c),e.contentItems[e.contentItems.length-1].addChild(s),s=e.contentItems[e.contentItems.length-1]}return this.addStack(s,!t)}static getAllStackContainers(e){return e._findAllStackContainers()}static getFocusedStackIndex(e){return e.findIndex(t=>t.header.tabs.some(n=>n.element[0].classList.contains("lm_focusin")))}static getFocusedStack(e){var t=O.getAllStackContainers(e),n=O.getFocusedStackIndex(t);return t[n]}static getStackById(e,t){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(i&&an(e)&&e.contentItems.length===0)return e;if(t===((n=e.config)===null||n===void 0?void 0:n.id)){if(an(e))return e;throw new Error("Item with ID ".concat(t," is not a stack"))}if(e.contentItems==null)return null;for(var o=0;o<e.contentItems.length;o+=1){var a=this.getStackById(e.contentItems[o],t,i);if(a)return a}return null}static getContentItemById(e,t){var n;if(((n=e.config)===null||n===void 0?void 0:n.id)===t)return e;if(e.contentItems==null)return null;for(var i=0;i<e.contentItems.length;i+=1){var o=this.getContentItemById(e.contentItems[i],t);if(o)return o}return null}static getStackForConfig(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(n&&an(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&&Bi(o.config,t))return e;var a=this.getStackForConfig(o,t,n);if(a)return a}return null}static getStackForRoot(e,t){var n=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&&n&&(a=this.addStack(e)),a}static getStackForComponentTypes(e,t){for(var n=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=O.getStackForRoot(e,{component:s},n&&l,i,o);if(d)return d}return null}static getContentItemInStack(e,t){if(!e)return null;for(var n=0;n<e.contentItems.length;n+=1){var i=e.contentItems[n];if(i.isComponent&&i.config!=null&&Bi(i.config,t))return i}return null}static dehydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var n=[],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?n.push(l):Ft.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(a,'"'))}else if(s){var d=It(It({},o),{},{content:O.dehydrateLayoutConfig(s,t)});n.push(d)}else n.push(o)}return n}static getTabPoint(e){var{tab:t}=e;if(t==null)throw new Error("Cannot get tab for panel container ".concat(e));var n=t.element[0].getBoundingClientRect();return[n.left+n.width*.5,n.bottom-8]}static dropLayoutMinorChange(e){for(var t=0;t<e.length;t+=1){var n=e[t],{content:i}=n;i!==void 0?(ma(n)&&delete n.activeItemIndex,O.dropLayoutMinorChange(i)):Cn(n)&&n.component==="IrisGridPanel"&&n.props.panelState!=null&&(delete n.id,n.props.panelState.irisGridState.sorts=[],n.props.panelState.irisGridState.quickFilters=[],n.props.panelState.gridState.isStuckToBottom=!1,n.props.panelState.gridState.isStuckToRight=!1)}}static isEqual(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=O.cloneLayout(e),o=O.cloneLayout(t);return n?(O.dropLayoutMinorChange(i),O.dropLayoutMinorChange(o),Vn(i,o)):Vn(i,o)}static cloneLayout(e){return JSON.parse(JSON.stringify(e))}static hydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var n=[],i=0;i<e.length;i+=1){var o=e[i];if(Cn(o)){var a,{component:s,props:l={}}=o;n.push(It(It({},o),{},{id:(a=o==null?void 0:o.id)!==null&&a!==void 0?a:Et(),props:t(s,l)}))}else if(o.content!==void 0){var d=O.hydrateLayoutConfig(o.content,t);ma(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=d.length&&(Ft.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),n.push(It(It({},o),{},{content:d}))}else n.push(o)}return n}static openComponent(){var{root:e,config:t,stack:n=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=Et()),l!=null){e==null||e.layoutManager.createDragSourceFromEvent(h,l);return}var c=o||{id:h.id,component:h.component};$(e);var v=n??(a?O.addStack(e):O.getStackForRoot(e,c));$(v);var f=O.getContentItemInStack(v,c);if(s!=null){var p=b=>{Ft.debug("Component created, focusing element",s),v.off("componentCreated",p);var{element:E}=b.origin;requestAnimationFrame(()=>{O.focusElement(E[0],s)})};v.on("componentCreated",p)}if(i&&f){var g=v.contentItems.indexOf(f);v.addChild(h,g+1),v.removeChild(f),v.setActiveContentItem(v.contentItems[g])}else v.addChild(h);s==null&&d&&ur(d)&&d.focus()}static openComponentInStack(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=document.activeElement,o={id:t.id},a=O.getContentItemInStack(e,o);if(n&&a&&e){var s=e==null?void 0:e.contentItems.indexOf(a);e.addChild(t,s+1),e.removeChild(a),e.setActiveContentItem(e.contentItems[s])}else e==null||e.addChild(t);i&&ur(i)&&i.focus()}static closeComponent(e,t,n){var i=O.getStackForRoot(e,t,!1,!1,!1);if(!i){Ft.warn("Cannot find stack for component, ignoring close",t);return}var o=O.getContentItemInStack(i,t),a=document.activeElement;o&&(Qe(o)?o.container.close(n):i.removeChild(o)),a&&document.contains(a)&&ur(a)&&a.focus()}static renameComponent(e,t,n){var i=O.getStackForRoot(e,t,!1);if(!i){Ft.error("Could not find stack for config",t);return}var o=O.getContentItemInStack(i,t);o&&o.setTitle(n)}static cloneComponent(e,t){var n=O.getStackForRoot(e,t,!1);if(!n)return Ft.error("Could not find stack for config",t),null;var{props:i={}}=t,o=O.getPanelComponentState(t),a={type:"react-component",component:t.component,props:It(It({},i),{},{panelState:o}),title:"".concat(t.title," Copy"),id:Et()};return O.openComponentInStack(n,a),a}static getPanelComponentState(e){if(Tl(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(Cn(e)){var n;return(n=e.props)===null||n===void 0?void 0:n.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=O.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return O.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,n=O.getComponentConfigFromContainer(t);if(n&&Cn(n)){var i;return(i=n.component)!==null&&i!==void 0?i:null}return null}static getComponentName(e){var t,n,i=(t=(n=e.WrappedComponent)===null||n===void 0?void 0:n.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]:O.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var n=e.querySelector(t);return n==null?null:(ur(n)&&n.focus(),n)}static onInitialized(e){return new Promise(t=>{if(e.isInitialised){t();return}var n=()=>{e.off("initialised",n),t()};e.on("initialised",n)})}}Pl(O,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var zp=R.forwardRef((r,e)=>{var t=O.getComponentNameFromPanel({props:r});return u.jsx("div",{ref:e,className:"panel-placeholder",children:u.jsxs("div",{children:['Component "',t,'" is not registered.']})})});zp.displayName="PanelPlaceholder";var ae=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"}),{listen:bC,emit:Gp,useListener:yC}=Qt(ae.OPEN),Rr=Object.freeze({CYCLE_TO_NEXT_STACK:"NavigationEvent.CYCLE_TO_NEXT_STACK",CYCLE_TO_PREVIOUS_STACK:"NavigationEvent.CYCLE_TO_PREVIOUS_STACK",CYCLE_TO_NEXT_TAB:"NavigationEvent.CYCLE_TO_NEXT_TAB",CYCLE_TO_PREVIOUS_TAB:"NavigationEvent.CYCLE_TO_PREVIOUS_TAB"}),{listen:qp,emit:CC,useListener:SC}=Qt(Rr.CYCLE_TO_NEXT_STACK),{listen:Xp,emit:wC,useListener:EC}=Qt(Rr.CYCLE_TO_PREVIOUS_STACK),{listen:Zp,emit:_C,useListener:PC}=Qt(Rr.CYCLE_TO_NEXT_TAB),{listen:Yp,emit:TC,useListener:OC}=Qt(Rr.CYCLE_TO_PREVIOUS_TAB);function Qp(r){return typeof r.id=="string"&&r.layout instanceof Lr&&r.panelManager instanceof Mi&&typeof r.registerComponent=="function"}function Jp(r){if(!Qp(r))throw new Error("Expected dashboard plugin props, but instead received ".concat(r))}function va(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function fa(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?va(Object(t),!0).forEach(function(n){Mt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):va(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Mt(r,e,t){return(e=eg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function eg(r){var e=tg(r,"string");return typeof e=="symbol"?e:e+""}function tg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ht=K.module("PanelManager"),Wt;(function(r){r[r.Next=0]="Next",r[r.Previous=1]="Previous"})(Wt||(Wt={}));class Mi{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(s,l)=>l,n=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]:()=>{};Mt(this,"layout",void 0),Mt(this,"hydrateComponent",void 0),Mt(this,"dehydrateComponent",void 0),Mt(this,"onPanelsUpdated",void 0),Mt(this,"closed",void 0),Mt(this,"openedMap",void 0),Mt(this,"navigationEventListenerRemovers",void 0),this.handleFocus=this.handleFocus.bind(this),this.handleMount=this.handleMount.bind(this),this.handleUnmount=this.handleUnmount.bind(this),this.handleReopen=this.handleReopen.bind(this),this.handleReopenLast=this.handleReopenLast.bind(this),this.handleCycleToNextStack=this.handleCycleToNextStack.bind(this),this.handleCycleToPreviousStack=this.handleCycleToPreviousStack.bind(this),this.handleCycleToNextTab=this.handleCycleToNextTab.bind(this),this.handleCycleToPreviousTab=this.handleCycleToPreviousTab.bind(this),this.handleDeleted=this.handleDeleted.bind(this),this.handleClosed=this.handleClosed.bind(this),this.handleControlClose=this.handleControlClose.bind(this),this.layout=e,this.hydrateComponent=t,this.dehydrateComponent=n,this.onPanelsUpdated=a,this.openedMap=new Map(i),this.closed=[...o],this.navigationEventListenerRemovers=[],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(ae.FOCUS,this.handleFocus),e.on(ae.MOUNT,this.handleMount),e.on(ae.UNMOUNT,this.handleUnmount),e.on(ae.REOPEN,this.handleReopen),e.on(ae.REOPEN_LAST,this.handleReopenLast),e.on(ae.DELETE,this.handleDeleted),e.on(ae.CLOSED,this.handleClosed),e.on(ae.CLOSE,this.handleControlClose),this.navigationEventListenerRemovers.push(qp(e,this.handleCycleToNextStack)),this.navigationEventListenerRemovers.push(Xp(e,this.handleCycleToPreviousStack)),this.navigationEventListenerRemovers.push(Zp(e,this.handleCycleToNextTab)),this.navigationEventListenerRemovers.push(Yp(e,this.handleCycleToPreviousTab))}stopListening(){var{eventHub:e}=this.layout;e.off(ae.FOCUS,this.handleFocus),e.off(ae.MOUNT,this.handleMount),e.off(ae.UNMOUNT,this.handleUnmount),e.off(ae.REOPEN,this.handleReopen),e.off(ae.REOPEN_LAST,this.handleReopenLast),e.off(ae.DELETE,this.handleDeleted),e.off(ae.CLOSED,this.handleClosed),e.off(ae.CLOSE,this.handleControlClose),this.navigationEventListenerRemovers.forEach(t=>t()),this.navigationEventListenerRemovers=[]}getClosedPanelConfigsOfType(e){return this.closed.filter(t=>t.component===e)}getOpenedPanels(){return Array.from(this.openedMap.values())}getOpenedPanelConfigs(){return this.getOpenedPanels().map(e=>{var{glContainer:t}=e.props;return O.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&Cn(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,n=O.getStackForConfig(this.layout.root,{id:e});return(t=n&&O.getContentItemInStack(n,{id:e}))!==null&&t!==void 0?t:null}getLastUsedPanel(e){for(var t=this.getOpenedPanels(),n=t.length-1;n>=0;n-=1){var i=t[n];if(e==null||e(i))return i}}getLastUsedPanelOfType(e){return this.getLastUsedPanelOfTypes([e])}getLastUsedPanelOfTypes(e){return this.getLastUsedPanel(t=>e.some(n=>Cr(n)&&t instanceof n.WrappedComponent||!Cr(n)&&t instanceof n))}updatePanel(e){var t=O.getIdFromPanel(e);if(t==null){ht.error("updatePanel Panel did not have an ID",e);return}ht.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=O.getIdFromPanel(e);if(t==null){ht.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){ht.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){ht.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}ht.debug2("Removing panel ID ".concat(t," from open panels map")),this.openedMap.delete(t)}removeClosedPanelConfig(e){var t=this.closed.findIndex(n=>n===e||n.id!=null&&e.id!=null&&n.id===e.id);t>=0&&this.closed.splice(t,1)}handleFocus(e){ht.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){ht.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){ht.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}cycleStack(e){var t=O.getAllStackContainers(this.layout);if(!(t.length<=1)){var n=O.getFocusedStackIndex(t);if(n===-1){var i=t[0],o=i.config.activeItemIndex,a=o!=null?i.contentItems[o]:i.contentItems[0];i.setActiveContentItem(a,!0);return}var s=e===Wt.Next?(n+1)%t.length:(n-1+t.length)%t.length,l=t[s],d=l.config.activeItemIndex,h=d!=null?l.contentItems[d]:l.contentItems[0];l.setActiveContentItem(h,!0)}}handleCycleToNextStack(){this.cycleStack(Wt.Next)}handleCycleToPreviousStack(){this.cycleStack(Wt.Previous)}cycleTab(e){var t,n=O.getFocusedStack(this.layout);if(n!==void 0){var{contentItems:i}=n;if(!(i.length<=1)){var o=(t=n.config.activeItemIndex)!==null&&t!==void 0?t:0,a=e===Wt.Next?(o+1)%i.length:(o-1+i.length)%i.length,s=i[a];n.setActiveContentItem(s,!0)}}}handleCycleToNextTab(){this.cycleTab(Wt.Next)}handleCycleToPreviousTab(){this.cycleTab(Wt.Previous)}handleReopen(e,t){ht.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:n}=e,{props:i}=e;i=this.hydrateComponent(n,i);var o=fa(fa({},e),{},{props:i}),{root:a}=this.layout,s=e.parentStackId===void 0?void 0:O.getStackById(a,e.parentStackId);O.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 n=(t=O.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===n){this.handleReopen(o);return}}}}handleDeleted(e){ht.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){ht.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:n}=this.layout;O.closeComponent(n,t)}addClosedPanel(e){var{root:t}=this.layout,n=O.getComponentConfigFromContainer(e);if(n&&Cn(n)){var i=this.dehydrateComponent(n.component,n);if(i!=null){var o;i.parentStackId=(o=O.getStackForConfig(t,n))===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)})}}Mt(Mi,"MAX_CLOSED_PANEL_COUNT",100);var ng=K.module("PanelErrorBoundary");class rg 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,n=O.getIdFromContainer(e);ng.debug("componentWillUnmount",n),t.emit(ae.CLOSED,n,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?u.jsx("div",{className:"panel-error-boundary",children:u.jsx(un,{"data-testid":"panel-error-boundary-loading-error",errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e??null}}function pa(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Or(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?pa(Object(t),!0).forEach(function(n){ig(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):pa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ig(r,e,t){return(e=og(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function og(r){var e=ag(r,"string");return typeof e=="symbol"?e:e+""}function ag(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Ol(r){var{props:e,componentState:t}=r,{metadata:n}=e,{panelState:i=null}=e;t&&({panelState:i}=t);var o={};return n!=null&&(o.metadata=n),i!=null&&(o.panelState=i),Or(Or({},r),{},{componentState:null,props:o,type:"react-component"})}function xl(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return Or(Or({},r),{},{localDashboardId:e})}const sg={dehydrate:Ol,hydrate:xl};var Il=R.createContext(void 0);Il.displayName="LayoutManagerContext";var lg=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}),Dl=S.shape({on:S.func,off:S.func,emit:S.func}),dg=S.shape({registerComponent:S.func,root:S.shape({addChild:S.func}),on:S.func,off:S.func,eventHub:Dl}),ug=Object.freeze({Container:lg,EventHub:Dl,Layout:dg});function An(r,e,t,n){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.");R.useEffect(()=>{var a=r(o,e,t,n);return()=>{a()}},[e,n,t,o,r])}function Le(r,e,t){m.useEffect(function(){return r.on(e,t),()=>{r.off(e,t)}},[r,e,t])}var kl="SET_DASHBOARD_DATA";const hg=Pc(kl,{},!1),cg={dashboardData:hg};var mg=new Map,Ml=Object.freeze({}),vg=Object.freeze([]),xC=bi,fg=qa,IC=id,pg=r=>r.dashboardData,$e=(r,e)=>{var t;return(t=pg(r)[e])!==null&&t!==void 0?t:Ml},DC=(r,e)=>{var t;return(t=$e(r,e).closed)!==null&&t!==void 0?t:vg},kC=(r,e)=>{var t;return(t=$e(r,e).openedMap)!==null&&t!==void 0?t:mg},Nl=(r,e)=>{var t;return(t=$e(r,e).pluginDataMap)!==null&&t!==void 0?t:Ml},MC=(r,e,t)=>Nl(r,e)[t];function ga(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Sn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ga(Object(t),!0).forEach(function(n){gg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ga(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function gg(r,e,t){return(e=bg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bg(r){var e=yg(r,"string");return typeof e=="symbol"?e:e+""}function yg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var jl=(r,e)=>({type:kl,id:r,payload:e}),Jt=(r,e)=>(t,n)=>t(jl(r,Sn(Sn({},$e(n(),r)),e))),NC=(r,e,t)=>(n,i)=>n(jl(r,Sn(Sn({},$e(i(),r)),{},{pluginDataMap:Sn(Sn({},Nl(i(),r)),{},{[e]:t})})));Object.entries(cg).map(r=>{var[e,t]=r;return Wd.register(e,t)});function Cg(r){var{children:e}=r;return u.jsx(u.Fragment,{children:e})}var Ni=m.createContext(null);Ni.displayName="PanelIdContext";function Sg(){return m.useContext(Ni)}function ba(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ln(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ba(Object(t),!0).forEach(function(n){wg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ba(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function wg(r,e,t){return(e=Eg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Eg(r){var e=_g(r,"string");return typeof e=="symbol"?e:e+""}function _g(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var hr=K.module("DashboardLayout"),Pg=Object.freeze({}),Tg=[],ya=()=>{},Og=1e3,Ca=r=>r;function xg(r){var e,t,{id:n,children:i,emptyDashboard:o=u.jsx("div",{children:"Dashboard is empty."}),layout:a,layoutConfig:s=Tg,onLayoutChange:l=ya,onLayoutInitialized:d=ya,hydrate:h=xl,dehydrate:c=Ol,panelWrapper:v=Cg}=r,f=bi(),p=(e=qa(y=>$e(y,n)))!==null&&e!==void 0?e:Pg,[g,b]=m.useState(!1),[E,x]=m.useState(!1),[P,F]=m.useState(),[U]=m.useState((t=p==null?void 0:p.closed)!==null&&t!==void 0?t:[]),[ee,j]=m.useState(a.getReactChildren()),W=m.useMemo(()=>new Map,[]),H=m.useMemo(()=>new Map,[]),ne=m.useCallback(function(y,w){var T,q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:h,re=arguments.length>3&&arguments[3]!==void 0?arguments[3]:c;hr.debug2("registerComponent",y,w,q,re);function st(Z,se){var me=w,He=v,Pt=xs(me),{glContainer:Tt,glEventHub:Ur}=Z,Mn=O.getIdFromContainer(Tt);return u.jsx(rg,{glContainer:Tt,glEventHub:Ur,children:u.jsx(Ni.Provider,{value:Mn,children:u.jsx(He,Ln(Ln({},Z),{},{children:Pt?u.jsx(me,Ln(Ln({},Z),{},{ref:se})):u.jsx(me,Ln({},Z))}))})})}st.displayName="DashboardWrapper(".concat((T=w.displayName)!==null&&T!==void 0?T:y,")");var D=a.registerComponent(y,R.forwardRef(st));return W.set(y,q),H.set(y,re),D},[h,c,W,H,a,v]),oe=m.useCallback((y,w)=>{var T;return((T=W.get(y))!==null&&T!==void 0?T:Ca)(w,n)},[W,n]),L=m.useCallback((y,w)=>{var T;return((T=H.get(y))!==null&&T!==void 0?T:Ca)(w,n)},[H,n]),X=m.useMemo(()=>new Mi(a,oe,L,new Map,U,y=>{var{closed:w,openedMap:T}=y;f(Jt(n,{closed:w,openedMap:T}))}),[L,f,oe,n,U,a]),z=Uu(y=>{var w=P==null||!O.isEqual(P,y);hr.debug("handleLayoutStateChanged",w,y),w&&(b(a.root.contentItems.length===0),F(y),l(y),j(a.getReactChildren()))},Og,{flushOnUnmount:!0});m.useEffect(()=>()=>z.flush(),[z]);var A=m.useCallback(()=>{if(!E){var y=a.toConfig(),w=y.content,T=O.dehydrateLayoutConfig(w,L);z(T)}},[L,E,a,z]),V=m.useCallback(y=>{var w=O.getIdFromContainer(y);a.eventHub.emit(ae.DRAGGING,w),x(!0)},[a.eventHub]),G=m.useCallback(y=>{var w=O.getIdFromContainer(y);a.eventHub.emit(ae.DROPPED,w),x(!1)},[a.eventHub]),pe=m.useCallback(y=>{if(hr.debug2("handleComponentCreated",y),!(y==null||y.config==null||y.config.component==null||y.element==null)){var w=y.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),T="".concat(w,"-component");y.element.addClass(T)}},[]),Ge=m.useCallback(()=>{j(a.getReactChildren())},[a]);Le(a,"stateChanged",A),Le(a,"itemPickedUp",V),Le(a,"itemDropped",G),Le(a,"componentCreated",pe),Le(a.eventHub,ae.TITLE_CHANGED,A),Le(a,"reactChildrenChanged",Ge);var je=Wu(s);return m.useEffect(function(){if(je!==s&&s!==P){hr.debug("Setting new layout content...");for(var w=O.hydrateLayoutConfig(s,oe);a.root.contentItems.length>0;)a.root.contentItems[0].remove();for(var T=0;T<w.length;T+=1)a.root.addChild(w[T]);b(a.root.contentItems.length===0)}},[oe,a,s,P,X,je]),m.useEffect(()=>d(),[]),u.jsxs(u.Fragment,{children:[g&&o,ee,R.Children.map(i,y=>y!=null?u.jsx(Hh,{fallback:[],children:R.cloneElement(y,{id:n,layout:a,panelManager:X,registerComponent:ne})}):null)]})}xg.propTypes={id:S.string.isRequired,children:S.node,data:S.shape({}),emptyDashboard:S.node,layout:ug.Layout.isRequired,layoutConfig:S.arrayOf(S.shape({})),onLayoutChange:S.func,onLayoutInitialized:S.func};var Al=m.createContext(null);Al.displayName="DashboardIdContext";function jC(){var r=m.useContext(Al);if(r==null)throw new Error("useDashboardId must be used within a DashboardIdContext provider");return r}function Ig(r,e,t){return(e=Dg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Dg(r){var e=kg(r,"string");return typeof e=="symbol"?e:e+""}function kg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Ll(r,e,t){if(r){if(t(r)===!0)return r;for(var n=r.child;n;){var i=Ll(n,e,t);if(i)return i;n=n.sibling}}}function Mg(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}var ji=Mg(m.createContext(null));ji.displayName="FiberContext";class AC extends m.Component{constructor(){super(...arguments),Ig(this,"_reactInternals",void 0)}render(){var{children:e}=this.props;return u.jsx(ji.Provider,{value:this._reactInternals,children:e})}}function Ng(){var r=m.useContext(ji);if(r===null)throw new Error("useFiber must be called within a <FiberProvider />!");var[e]=m.useState(()=>Et()),t=m.useMemo(()=>{for(var n of[r,r==null?void 0:r.alternate].filter(o=>o!=null)){var i=Ll(n,!1,o=>{for(var a=o.memoizedState;a!=null;){if(a.memoizedState===e)return!0;a=a.next}});if(i)return i}},[r,e]);return t}var LC="default",jg="CREATE_DASHBOARD",Ag="CLOSE_DASHBOARD",{listen:RC,emit:FC,useListener:$C}=Qt(jg),{listen:HC,emit:Lg,useListener:BC}=Qt(Ag);function Rg(r,e,t){return(e=Fg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Fg(r){var e=$g(r,"string");return typeof e=="symbol"?e:e+""}function $g(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Rl 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,n,{glContainer:i}=this.props;return[...(e=i==null||(t=i.tab)===null||t===void 0||(n=t.header)===null||n===void 0?void 0:n.tabs)!==null&&e!==void 0?e:[]]}handleCloseTab(){var{glContainer:e}=this.props;e.close()}handleCloseTabsAll(){var e=this.getAllTabs();e.forEach(t=>{var n;return(n=(t==null?void 0:t.contentItem).container)===null||n===void 0?void 0:n.close()})}handleCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),n=t.length-1;n>0;n-=1){var i,o,a,s,l,d,h;if(((i=t[n].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[n])===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(ae.REOPEN_LAST,e)}canCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),n=!0,i=t.length-1;i>0;i-=1){var o,a,s,l,d,h,c,v;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 f=!!(!((h=t[i])===null||h===void 0||(c=h.contentItem)===null||c===void 0||(v=c.config)===null||v===void 0)&&v.isClosable);if(f){n=!1;break}}return n}canCloseAny(){for(var e=this.getAllTabs(),t=!0,n=e.length-1;n>0;n-=1){var i,o,a,s=!!(!((i=e[n])===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:n,glContainer:i}=this.props,o=(e=O.getStackForConfig(i.layoutManager.root,i.getConfig()))===null||e===void 0?void 0:e.config.id;return!((t=n.data.closed)!==null&&t!==void 0&&t.some(a=>a.parentStackId===o))}render(){var e,t,n,{additionalActions:i,glContainer:o}=this.props,a=[...i];a.push(()=>({title:"Re-open closed panel",group:te.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||(n=t.config)===null||n===void 0?void 0:n.isClosable;return a.push({title:"Close",order:10,group:te.groups.low,action:this.handleCloseTab,disabled:s===void 0||!s}),a.push(()=>({title:"Close Tabs to Right",order:20,group:te.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),a.push(()=>({title:"Close All",order:30,group:te.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),u.jsx(te,{actions:a})}}Rg(Rl,"defaultProps",{additionalActions:[]});var Hg=r=>({workspace:Bs(r)}),Bg=In(Hg,{setWorkspace:Us})(Rl);function Fl(r,e,t){return(e=Wg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Wg(r){var e=Ug(r,"string");return typeof e=="symbol"?e:e+""}function Ug(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class $l extends m.PureComponent{constructor(e){super(e),Fl(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=R.createRef();var{value:t}=e;this.state={value:t,valueWasValidated:!1}}componentDidUpdate(e){var{isShown:t}=e,{isShown:n}=this.props;n&&!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,n=t==null?void 0:t.trim();if(n!==void 0&&n!==""){var{onSubmit:i}=this.props;i(n)}else this.setState({value:n,valueWasValidated:!0})}renderRenameDialog(){var{isShared:e,isOwner:t,itemType:n}=this.props,{value:i,valueWasValidated:o}=this.state;return u.jsxs("form",{className:Y("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(n,"-input"),children:["Rename ",n]}),u.jsx("input",{type:"text",className:"form-control",id:"rename-dialog-".concat(n,"-input"),value:i??void 0,ref:this.renameInputRef,onChange:this.handleRenameInputChange,required:!0}),u.jsxs("div",{className:"invalid-feedback",children:[n," name cannot be empty"]}),(e||!t)&&u.jsxs("div",{className:"pt-2",children:["Renaming this ",n," will rename for all users."]})]}),u.jsxs("div",{className:"text-right",children:[u.jsx(ie,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),u.jsx(ie,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var{isShown:e,onCancel:t}=this.props;return u.jsx(Zn,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}Fl($l,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});var cr=Object.freeze({focus:"TabEvent.focus",blur:"TabEvent.blur"});function Sa(r,e,t){return(e=Vg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Vg(r){var e=Kg(r,"string");return typeof e=="symbol"?e:e+""}function Kg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var zg=K.module("Panel");class Gg extends m.PureComponent{constructor(e){super(e),Sa(this,"ref",void 0),Sa(this,"getAdditionalActions",qt((n,i,o)=>{var a=[];return i&&a.push(this.getCloneAction()),o&&a.push(this.getRenameAction()),[...a,...n]})),this.handleCopyPanel=this.handleCopyPanel.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleHide=this.handleHide.bind(this),this.handleResize=this.handleResize.bind(this),this.handleBeforeShow=this.handleBeforeShow.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.handleShowRenameDialog=this.handleShowRenameDialog.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleTab=this.handleTab.bind(this),this.ref=R.createRef();var{glContainer:t}=this.props;this.state={title:O.getTitleFromContainer(t),showRenameDialog:!1,isWithinPanel:!0}}componentDidMount(){var e,t,{componentPanel:n,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(cr.focus,this.handleTabFocus),o.on(cr.blur,this.handleTabBlur),o.emit(ae.MOUNT,n??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:n}=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),n.off(cr.focus,this.handleTabFocus),n.off(cr.blur,this.handleTabBlur),n.emit(ae.UNMOUNT,e??this)}handleTab(e){e!=null&&this.setState({title:O.getTitleFromTab(e)}),this.forceUpdate();var{onTab:t}=this.props;t==null||t(e)}handleTabClicked(e){var{onTabClicked:t}=this.props;t==null||t(e)}handleFocus(e){var{componentPanel:t,glEventHub:n}=this.props;n.emit(ae.FOCUS,t??this);var{onFocus:i}=this.props;i==null||i(e)}handleBlur(e){var{onBlur:t}=this.props;t==null||t(e)}handleHide(){for(var{onHide:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleResize(){for(var{onResize:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleBeforeShow(){for(var{onBeforeShow:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleShow(){for(var{onShow:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleTabBlur(){for(var{onTabBlur:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleTabFocus(){for(var{onTabFocus:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleRenameCancel(){this.setState({showRenameDialog:!1})}handleShowRenameDialog(){this.setState({showRenameDialog:!0})}handleRenameSubmit(e){var{glContainer:t}=this.props;this.setState({showRenameDialog:!1,title:e});var n=O.getRootFromContainer(t),i=O.getComponentConfigFromContainer(t);$(i),O.renameComponent(n,i,e)}handleCopyPanel(){var{glContainer:e,glEventHub:t}=this.props,n=O.getRootFromContainer(e),i=O.getComponentConfigFromContainer(e);if(i==null){zg.error("Could not get component config from container",e);return}var o=O.cloneComponent(n,i);o!==null&&t.emit(ae.CLONED,this,o)}getCloneAction(){return{title:"Copy Panel",order:10,group:te.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:te.groups.medium,action:this.handleShowRenameDialog}}render(){var{children:e,className:t,renderTabTooltip:n,glContainer:i,glEventHub:o,additionalActions:a=nu,errorMessage:s,isLoaded:l=!0,isLoading:d=!1,isClonable:h=!1,isRenamable:c=!1}=this.props,{tab:v}=i,{showRenameDialog:f,title:p,isWithinPanel:g}=this.state;return u.jsxs("div",{className:Y("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,u.jsx(un,{"data-testid":"base-panel-loading",errorMessage:s,isLoaded:l,isLoading:d}),!g&&v!=null&&Dr.createPortal(u.jsxs(u.Fragment,{children:[u.jsx(Bg,{glContainer:i,glEventHub:o,additionalActions:this.getAdditionalActions(a,h,c)}),c&&u.jsx($l,{isShown:f,value:p,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),n!=null&&u.jsx(ce,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:n()})]}),v.element[0])]})}}var qg=js(Gg),Xg=K.module("useDhId"),Jr="__dhId";function WC(){var r,e,t=(r=(e=Ng())===null||e===void 0?void 0:e.pendingProps)!==null&&r!==void 0?r:{},n=t[Jr],i=Sg();if(n!=null){if(typeof n!="string")throw new Error("useDhId expected prop ".concat(Jr," to be a string, but got ").concat(typeof n));return n}return i??(Xg.warn("useDhId must be used within a PanelIdContext provider if there is no ".concat(Jr," prop. Defaulting to null.")),null)}function tr(r,e,t){return(e=Zg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Zg(r){var e=Yg(r,"string");return typeof e=="symbol"?e:e+""}function Yg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ne{}tr(Ne,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");tr(Ne,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");tr(Ne,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");tr(Ne,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");tr(Ne,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");function en(r,e,t){return(e=Qg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Qg(r){var e=Jg(r,"string");return typeof e=="symbol"?e:e+""}function Jg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class _t{}en(_t,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");en(_t,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");en(_t,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");en(_t,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");en(_t,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");en(_t,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");en(_t,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");en(_t,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");const UC=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function At(r,e,t){return(e=eb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function eb(r){var e=tb(r,"string");return typeof e=="symbol"?e:e+""}function tb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class J{}At(J,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");At(J,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");At(J,"CLOSE_FILE","NotebookEvent.closeFile");At(J,"RENAME","NotebookEvent.rename");At(J,"RENAME_FILE","NotebookEvent.renameFile");At(J,"REGISTER_FILE","NotebookEvent.registerFile");At(J,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");At(J,"UNREGISTER_FILE","NotebookEvent.unregisterFile");At(J,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");var nb=["children"];function wa(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ea(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wa(Object(t),!0).forEach(function(n){rb(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):wa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function rb(r,e,t){return(e=ib(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ib(r){var e=ob(r,"string");return typeof e=="symbol"?e:e+""}function ob(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function ab(r,e){if(r==null)return{};var t,n,i=sb(r,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(n=0;n<o.length;n++)t=o[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(r,t)&&(i[t]=r[t])}return i}function sb(r,e){if(r==null)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.indexOf(n)!==-1)continue;t[n]=r[n]}return t}class lb extends m.PureComponent{constructor(e){super(e),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this)}componentDidMount(){var{glEventHub:e}=this.props;e.on(Ne.SESSION_CLOSED,this.handleSessionClosed),e.on(Ne.SESSION_OPENED,this.handleSessionOpened),e.on(_t.CLEAR_ALL_FILTERS,this.handleClearAllFilters)}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(Ne.SESSION_CLOSED,this.handleSessionClosed),e.off(Ne.SESSION_OPENED,this.handleSessionOpened),e.off(_t.CLEAR_ALL_FILTERS,this.handleClearAllFilters)}handleClearAllFilters(){for(var{onClearAllFilters:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleSessionClosed(e){var{onSessionClose:t}=this.props;t==null||t(e)}handleSessionOpened(e,t){var{onSessionOpen:n}=this.props;n==null||n(e,t)}render(){var e=this.props,{children:t}=e,n=ab(e,nb);return u.jsx(qg,Ea(Ea({},n),{},{children:t}))}}var nr=js(lb);const VC=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var db=Object.freeze({}),ub=new Map,Fr=Object.freeze([]),KC=(r,e)=>{var t;return(t=$e(r,e).columns)!==null&&t!==void 0?t:Fr},zC=(r,e)=>{var t;return(t=$e(r,e).filterSets)!==null&&t!==void 0?t:Fr},GC=(r,e)=>{var t;return(t=$e(r,e).filters)!==null&&t!==void 0?t:Fr},qC=(r,e)=>{var t;return(t=$e(r,e).tableMap)!==null&&t!==void 0?t:ub},XC=(r,e)=>$e(r,e).isolatedLinkerPanelId,Hl=(r,e)=>{var t;return(t=$e(r,e).links)!==null&&t!==void 0?t:Fr},ZC=(r,e)=>$e(r,e).columnSelectionValidator,YC=(r,e)=>{var t;return(t=$e(r,e).consoleSettings)!==null&&t!==void 0?t:db},QC=(r,e)=>$e(r,e).connection,rr=(r,e)=>$e(r,e).sessionWrapper,JC=(r,e)=>t=>t(Jt(r,{connection:e})),e0=(r,e)=>t=>t(Jt(r,{sessionWrapper:e})),Bl=(r,e)=>t=>t(Jt(r,{links:e})),t0=(r,e)=>(t,n)=>{var i=Hl(n(),r),o=e.filter(a=>i.findIndex(s=>Vn(s.start,a.start)&&Vn(s.end,a.end))<0);return t(Bl(r,i.concat(o)))},n0=(r,e)=>(t,n)=>{var i=Hl(n(),r),o=i.filter(a=>!e.includes(a.id));return t(Bl(r,o))},r0=(r,e)=>t=>t(Jt(r,{isolatedLinkerPanelId:e})),i0=(r,e)=>t=>t(Jt(r,{columnSelectionValidator:e})),hb=(r,e)=>t=>t(Jt(r,{consoleSettings:e})),o0=(r,e)=>t=>t(Jt(r,{filterSets:e}));function xr(r,e,t){return(e=cb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function cb(r){var e=mb(r,"string");return typeof e=="symbol"?e:e+""}function mb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var mr=K.module("CommandHistoryPanel");class ir extends m.Component{static handleError(e){mr.error(e)}constructor(e){super(e),xr(this,"container",void 0),xr(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=R.createRef(),this.pending=new qn;var{session:t,sessionId:n,language:i}=e;this.state={panelState:{},session:t,sessionId:n,language:i,contextActions:[{action:this.handleFocusHistory,shortcut:Ve.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){var{glEventHub:e,session:t}=this.props;e.on(Ne.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(Ne.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:n,sessionId:i}=t;this.setState({session:e,sessionId:i,language:n},()=>{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:n,language:i}=this.state;if(mr.debug("handleSendToNotebook",n,e),!n){mr.error("Session is not connected.");return}var{glEventHub:o}=this.props;o.emit(t?J.CREATE_NOTEBOOK:J.SEND_TO_NOTEBOOK,n,i,e)}handleSendToConsole(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;mr.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(Ne.SEND_COMMAND,e,t,n)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:n}=this.state;$(t),$(n),this.pending.add(e.getTable(t,n,Date.now()),i=>i.close()).then(i=>{this.setState({table:i})}).catch(ir.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:n}=this.props,{language:i,contextActions:o,table:a}=this.state;return u.jsxs(nr,{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(Ue,{ref:this.container,language:i,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:a,commandHistoryStorage:n}),u.jsx(te,{actions:o})]})]})}}xr(ir,"COMPONENT","CommandHistoryPanel");xr(ir,"TITLE","Command History");var vb=(r,e)=>{var t=$s(r),n=rr(r,e.localDashboardId),{session:i,config:o}=n??{},{type:a,id:s}=o??{};return{commandHistoryStorage:t,language:a,session:i,sessionId:s}},fb=In(vb,null,null,{forwardRef:!0})(ir),Wl=m.createContext(null);Wl.displayName="PluginsContext";var kn=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin",ELEMENT_PLUGIN:"ElementPlugin"});function pb(r){return"DashboardPlugin"in r}function gb(r){return"AuthPlugin"in r}function bb(r){return"TablePlugin"in r}function a0(r){return pb(r)||gb(r)||bb(r)}function yb(r){return"type"in r&&r.type===kn.DASHBOARD_PLUGIN}function Ai(r){return"type"in r&&r.type===kn.WIDGET_PLUGIN}function Cb(r){return"type"in r&&r.type===kn.TABLE_PLUGIN}function Sb(r){return"type"in r&&r.type===kn.AUTH_PLUGIN}function Ul(r){return"type"in r&&r.type===kn.THEME_PLUGIN}function Vl(r){return"type"in r&&r.type===kn.ELEMENT_PLUGIN}function s0(r){return yb(r)||Sb(r)||Cb(r)||Ul(r)||Ai(r)||Vl(r)}var Kl=K.module("@deephaven/plugin.PluginUtils");function _a(r,e){return r==null||!Ai(r)?!1:[r.supportedTypes].flat().some(t=>t===e)}function wb(r){var e=u.jsx(fe,{icon:rs});if(!Ai(r))return e;var{icon:t}=r;return t==null?e:m.isValidElement(t)?t:u.jsx(fe,{icon:t})}function l0(r){var e=[...r.entries()].filter(t=>Ul(t[1]));return Kl.debug("Getting theme data from plugins",e),e.map(t=>{var[n,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:Ud(n,s),name:s,styleContent:d}})}).flat()}function d0(r){var e=[...r.entries()].filter(t=>Vl(t[1])&&t[1].mapping!=null);return Kl.debug("Getting element plugin mapping",e),new Map(e.flatMap(t=>{var[,n]=t;return Object.entries(n.mapping)}))}function u0(){return Xn(Wl,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}var zl=m.createContext(null);zl.displayName="PersistentStateContext";function h0(r){var{initialState:e,onChange:t,children:n}=r,[i,o]=R.useState(0),a=m.useRef({initial:e,initialStateMap:new Map,state:new Map,isTracking:!0}),s=m.useCallback((v,f)=>{a.current.isTracking&&a.current.state.set(v,f)},[]),l=m.useCallback(()=>{a.current.isTracking||(a.current.isTracking=!0,a.current.state=new Map,o(v=>v+1))},[]),d=m.useRef(a.current.initial[Symbol.iterator]()),h=m.useCallback(function(f){var p=a.current.initialStateMap.get(f);if(p)return p;var{value:g,done:b}=d.current.next(),E={value:g,done:b??!1};return a.current.initialStateMap.set(f,E),E},[]);m.useEffect(function(){a.current.isTracking&&(t([...a.current.state.values()]),a.current.isTracking=!1)},[i,t]);var c=m.useMemo(()=>({addState:s,scheduleStateUpdate:l,getInitialState:h,updateId:i}),[s,h,l,i]);return u.jsx(zl.Provider,{value:c,children:n})}function Pa(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function vr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Pa(Object(t),!0).forEach(function(n){sn(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Pa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function sn(r,e,t){return(e=Eb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Eb(r){var e=_b(r,"string");return typeof e=="symbol"?e:e+""}function _b(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var fr=K.module("ConsolePanel"),Pb=500,Tb=Object.freeze({consoleSettings:{},itemIds:[]});class $r extends m.PureComponent{constructor(e){super(e),sn(this,"consoleRef",void 0),sn(this,"objectSubscriptionCleanup",void 0),sn(this,"savePanelState",ln(()=>{var{consoleSettings:a,itemIds:s}=this.state,l={consoleSettings:a,itemIds:[...s]};fr.debug("Saving panel state",l),this.setState({panelState:l})},Pb)),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=R.createRef();var{panelState:t}=e,n=vr(vr({},Tb),t||{}),{consoleSettings:i,itemIds:o}=n;this.state={consoleSettings:i,itemIds:new Map(o),objectMap:new Map,error:void 0,panelState:n}}componentDidMount(){var{glEventHub:e}=this.props;this.closeDisconnectedPanels(),e.on(ae.MOUNT,this.handlePanelMount),this.subscribeToFieldUpdates()}componentDidUpdate(e,t){var{consoleSettings:n,itemIds:i}=this.state;(t.consoleSettings!==n||t.itemIds!==i)&&this.savePanelState()}componentWillUnmount(){var e,{glEventHub:t}=this.props;this.savePanelState.flush(),t.off(ae.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(n=>{fr.debug("Got updates",n),this.setState(i=>{var{objectMap:o}=i,{updated:a,created:s,removed:l}=n,d=[...a,...l],h=new Map(o);d.forEach(v=>{var{title:f}=v;f!==void 0&&h.delete(f)});var c=[...a,...s];return c.forEach(v=>{v.title!==void 0&&h.set(v.title,v)}),{objectMap:h}})})}}setItemId(e,t){this.setState(n=>{var{itemIds:i}=n,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:n}=this.state,i=n.get(e);return i==null&&t&&(i=Et(),this.setItemId(e,i)),i}handleTabFocus(){var e;(e=this.consoleRef.current)===null||e===void 0||e.focus()}handlePanelMount(e){var t,n,i,{itemIds:o}=this.state,a=e==null||(t=e.props)===null||t===void 0?void 0:t.id,s=e==null||(n=e.props)===null||n===void 0||(i=n.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(Ne.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{root:n}=this.context,i=e.title!=null?this.getItemId(e.title,!1):null;(t||i!=null&&O.getStackForRoot(n,{id:i},!1,!1,!1)!=null)&&this.openWidget(e)}handleCloseObject(e){var{title:t}=e;if(t!==void 0){var n=this.getItemId(t,!1);if(n!=null){var{glEventHub:i}=this.props;i.emit(ae.CLOSE,n),Lg(i,t)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;fr.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(Ne.SETTINGS_CHANGED,e)}openWidget(e){var{glEventHub:t,sessionWrapper:n}=this.props;$(n);var{config:i,session:o}=n,{title:a=e.name}=e;$(a);var s=this.getItemId(a),l={fetch:()=>o.getObject(e),panelId:s,widget:vr(vr({},ac(e)),{},{sessionId:i.id})};fr.debug("openWidget",l),Gp(t,l)}addCommand(e){var t,n=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,n,i)}closeDisconnectedPanels(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{consoleSettings:t,itemIds:n}=this.state,{isClosePanelsOnDisconnectEnabled:i=!0}=t;if(!(!i&&!e)){var o=[...n.values()],{glEventHub:a}=this.props;o.forEach(s=>{a.emit(ae.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(n=>_a(n,e))}iconForType(e){var{plugins:t}=this.props,n=[...t.values()].find(i=>_a(i,e));return n!=null?wb(n):u.jsx(Vs,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:n,sessionWrapper:i,timeZone:o,unzip:a}=this.props;if(i==null)return u.jsx(un,{isLoading:!1,errorMessage:"Console is disabled.","data-testid":"console-panel-loading-error"});var{consoleSettings:s,error:l,objectMap:d}=this.state,{config:h,session:c,connection:v,details:f={},dh:p}=i,{workerName:g,processInfoId:b}=f,{id:E,type:x}=h;return u.jsx(nr,{className:"iris-panel-console",componentPanel:this,glContainer:t,glEventHub:n,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,errorMessage:l!=null?"".concat(l):void 0,children:c!=null&&u.jsx(Gt,{dh:p,ref:this.consoleRef,settings:s,session:c,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:x,statusBarChildren:u.jsxs(u.Fragment,{children:[u.jsx("div",{children:zs.LANGUAGE_MAP.get(x)}),g!=null&&u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"•"}),g]}),b!=null&&u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"•"}),b,u.jsx("div",{children:"•"})]}),u.jsx(lf,{connection:v,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})]}),showObjectsMenu:!1,scope:E,timeZone:o,objectMap:d,unzip:a,supportsType:this.supportsType,iconForType:this.iconForType})})}}sn($r,"COMPONENT","ConsolePanel");sn($r,"TITLE","Console");sn($r,"contextType",Il);var Ob=(r,e)=>({commandHistoryStorage:$s(r),sessionWrapper:rr(r,e.localDashboardId),timeZone:mc(r),plugins:vc(r)}),ei=In(Ob,null,null,{forwardRef:!0})($r);function c0(r){return r==="file"||r==="directory"}function yt(r){return r.type==="directory"}function xb(r,e,t){return(e=Ib(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ib(r){var e=Db(r,"string");return typeof e=="symbol"?e:e+""}function Db(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Li extends Error{constructor(){super("No file exists at the path specified"),xb(this,"isFileNotFound",!0)}}function Ta(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function Oa(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Ta(o,n,i,a,s,"next",l)}function s(l){Ta(o,n,i,a,s,"throw",l)}a(void 0)})}}var Nt;(function(r){r.GROOVY="text/x-groovy",r.PLAIN_TEXT="text/plain",r.PYTHON="text/x-python",r.PYTHON_COMPILED="application/x-python-code",r.SCALA="text/x-scala",r.UNKNOWN=""})(Nt||(Nt={}));class N{static fileExists(e,t){return Oa(function*(){try{return yield e.info(t),!0}catch(n){if(!(n instanceof Li))throw n;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(!N.hasPath(e))throw new Error("Invalid path provided: ".concat(e));var n=(t=e.match(/\//g))!==null&&t!==void 0?t:[];return n.length-1}static getExtension(e){var t=this.getBaseName(e).split(".");if(t.length>1){var n;return(n=t.pop())!==null&&n!==void 0?n:""}return""}static getBaseName(e){var t;return(t=e.split("/").pop())!==null&&t!==void 0?t:""}static getCopyFileName(e){var t=e.lastIndexOf("."),n=null,i=null;t<0?i=e:(i=e.substring(0,t),n=e.substring(t+1));var o=i?"".concat(i,"-copy"):"Copy";return n!==null?"".concat(o,".").concat(n):o}static getUniqueCopyFileName(e,t){return Oa(function*(){for(var n=N.getCopyFileName(t);yield N.fileExists(e,n);)n=N.getCopyFileName(n);return n})()}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(!N.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(!N.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]:"",n=e.lastIndexOf("."),i=n>-1?e.substring(0,n):e,o=N.fileExtensionToString(t);return"".concat(i).concat(o)}static validateName(e){var t=[".",".."],n=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new Bn("Name cannot be empty");if(t.includes(e))throw new Bn('"'.concat(e,'" is a reserved name'));if(n.test(e)){var o,a;throw new Bn('Invalid characters in name: "'.concat((o=(a=e.match(n))===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(n=>N.isPath(n));return e.filter(n=>!t.some(i=>n!==i&&n.startsWith(i)))}static removeRoot(e,t){if(e.length===0)return t;if(!t.startsWith(e))throw new Error("Filename ".concat(t," does not start with expected root ").concat(e));return t.substring(e.length)}static addRoot(e,t){return"".concat(e).concat(t)}}var Ri=26;function pi(r){return yt(r)?N.makePath(r.filename):N.getPath(r.filename)}function xa(r,e){if(r.length===0||e==null)throw new Error("No items to move");var t=pi(e);if(r.some(n=>{var{filename:i}=n;return N.getPath(i)===t}))throw new Error("File already in the destination folder");if(r.some(n=>yt(n)&&t.startsWith(N.makePath(n.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:r,targetPath:t}}function kb(r){if(yt(r))return r.isExpanded?Vd:Kd;var e=N.getMimeType(r.basename);switch(e){case Nt.PYTHON:return Gd;default:return zd}}function gi(r){var e,{children:t,draggedItems:n,isDragInProgress:i,isDropTargetValid:o,isSelected:a,item:s,itemIndex:l,dropTargetItem:d,onDragStart:h,onDragOver:c,onDragEnd:v,onDrop:f}=r,p=(e=n==null?void 0:n.some(j=>j.id===s.id))!==null&&e!==void 0?e:!1,g=pi(s),b=i&&d?pi(d):null,E=i&&o&&yt(s)&&b===g,x=i&&o&&b===g,P=i&&!o&&b===g,F=kb(s),U=N.getDepth(s.filename),ee=Array(U).fill(null).map((j,W)=>u.jsx("span",{className:"file-list-depth-line"},W));return u.jsxs("div",{className:Y("d-flex w-100 align-items-center","file-list-item",{"is-dragged":p,"is-exact-drop-target":E,"is-in-drop-target":x,"is-invalid-drop-target":P,"is-selected":a}),onDragStart:j=>h(l,j),onDragOver:j=>c(l,j),onDragEnd:j=>v(l,j),onDrop:j=>f(l,j),draggable:!0,role:"presentation","aria-label":s.basename,children:[ee," ",u.jsx(fe,{icon:F,className:"item-icon",fixedWidth:!0})," ",u.jsx("span",{className:"truncation-wrapper",children:t??u.jsxs(u.Fragment,{children:[s.basename,u.jsx(ce,{children:s.basename})]})})]})}function Ia(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function pr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ia(Object(t),!0).forEach(function(n){Mb(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ia(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Mb(r,e,t){return(e=Nb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Nb(r){var e=jb(r,"string");return typeof e=="symbol"?e:e+""}function jb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Be=K.module("FileList"),Ab=500,Da="item-list-scroll-pane";function Lb(r){var{isMultiSelect:e=!1,table:t,onFocusChange:n=()=>{},onMove:i,onSelect:o,onSelectionChange:a=()=>{},renderItem:s=gi,rowHeight:l=Ri,overscanCount:d=at.DEFAULT_OVERSCAN}=r,[h,c]=m.useState(()=>({items:[],offset:0,itemCount:0})),[v,f]=m.useState({top:0,bottom:0}),[p,g]=m.useState(),[b,E]=m.useState(),[x,P]=m.useState(),[F,U]=m.useState([]),ee=m.useRef(),j=m.useRef(null),W=m.useRef(null),H=m.useCallback(D=>{if(D.length===0||h==null)return[];for(var Z=[],se=0;se<D.length;se+=1)for(var me=D[se],He=me[0];He<=me[1];He+=1)He>=h.offset&&He<h.offset+h.items.length&&Z.push(h.items[He-h.offset]);return Z},[h]),ne=m.useCallback(D=>{var Z=H([[D,D]]);if(Z.length>0)return Z[0]},[H]),oe=m.useCallback(()=>{var D=pt.count(F);if(D===0)return null;if(D===1){var Z=F[0][0],se=ne(Z);if(se!=null)return se.filename}return"".concat(D," items")},[ne,F]),L=m.useCallback(D=>{if(!(!b||!p)){Be.debug("dropItems",b,"to",D);try{var{files:Z,targetPath:se}=xa(b,p);if(i==null||i(Z,se),D!=null){var me;U([[D,D]]),(me=j.current)===null||me===void 0||me.focusItem(D)}}catch(He){Be.error("Unable to complete move",He)}}},[b,p,i]),X=m.useCallback((D,Z)=>{var se=h.items[D-h.offset];se!==void 0&&(Be.debug("handleItemClick",se),o(se,Z),yt(se)&&(t==null||t.setExpanded(se.filename,!se.isExpanded)))},[h,o,t]),z=m.useCallback((D,Z)=>{var se,me;Be.debug2("handleItemDragStart",D,F);var He=F;pt.isSelected(F,D)||(He=[[D,D]],U(He)),E(H(He)),(se=j.current)===null||se===void 0||se.resetMouseState();var Pt=document.createElement("div"),Tt=document.createElement("div");Tt.className="dnd-placeholder-content",Tt.innerText=(me=oe())!==null&&me!==void 0?me:"",Pt.appendChild(Tt),Pt.className="file-list-dnd-placeholder",document.body.appendChild(Pt),Z.dataTransfer.setDragImage(Pt,0,0),Z.dataTransfer.effectAllowed="move",P(Pt)},[oe,H,F]),A=m.useCallback((D,Z)=>{Z.preventDefault(),Be.debug2("handleItemDragOver",Z),g(ne(D))},[ne]),V=m.useCallback((D,Z)=>{Be.debug("handleItemDragEnd",D),x==null||x.remove(),E(void 0),g(void 0),P(void 0)},[x]),G=m.useCallback((D,Z)=>{L(D)},[L]),pe=m.useCallback(()=>{Be.debug2("handleItemDragExit"),g(void 0)},[]),Ge=m.useCallback(D=>{D.target instanceof Element&&D.target.classList.contains(Da)&&(D.preventDefault(),Be.debug2("handleListDragOver",D),g({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),je=m.useCallback(D=>{D.target instanceof Element&&D.target.classList.contains(Da)&&(Be.debug("handleListDrop"),L())},[L]),y=m.useCallback(function(D){var Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(Be.debug2("handleSelectionChange",D),Z===!0||D!==F){U(D);var se=H(D);a(se)}},[H,a,F]),w=m.useCallback(D=>{if(Be.debug2("handleFocusChange",D),D!=null){var[Z]=H([[D,D]]);n(Z)}else n();ee.current=D},[H,n]),T=m.useCallback((D,Z)=>{Be.debug("handleViewportChange",D,Z),(D!==v.top||Z!==v.bottom)&&f({top:D,bottom:Z})},[v]),q=m.useMemo(()=>{if(!b||!p)return!1;try{return xa(b,p),Be.debug("handleValidateDropTarget true"),!0}catch{return Be.debug("handleValidateDropTarget false"),!1}},[b,p]),{focusedPath:re}=r;m.useEffect(()=>{re!==void 0&&(re==="/"?t.collapseAll():(t.setExpanded(re,!1),t.setExpanded(re,!0)))},[t,re]),m.useEffect(function(){Be.debug("updating table viewport",v),t==null||t.setViewport({top:Math.max(0,v.top-d),bottom:v.bottom+d})},[d,t,v]),m.useEffect(function(){var Z=t.onUpdate(se=>{c({items:se.items.map(me=>pr(pr({},me),{},{itemName:me.basename})),offset:se.offset,itemCount:t.size})});return()=>{Z()}},[t]),m.useEffect(function(){ee.current!=null&&w(ee.current),F.length>0&&y(F,!0)},[h,w,y,F]),m.useEffect(function(){if(p!=null&&yt(p)&&p.filename!=="/"){var Z=setTimeout(()=>{p.isExpanded||t==null||t.setExpanded(p.filename,!0)},Ab);return()=>clearTimeout(Z)}},[p,t]);var st=m.useCallback(D=>s(pr(pr({},D),{},{isDragInProgress:b!=null,dropTargetItem:p,draggedItems:b,isDropTargetValid:q,onDragStart:z,onDragEnd:V,onDragOver:A,onDragExit:pe,onDrop:G})),[V,pe,A,z,G,b,p,q,s]);return u.jsx("div",{ref:W,className:Y("file-list",{"is-dragging":b!=null}),onDragOver:Ge,onDrop:je,children:u.jsx(at,{ref:j,items:h.items,itemCount:h.itemCount,offset:h.offset,onFocusChange:w,onSelect:X,onSelectionChange:y,onViewportChange:T,selectedRanges:F,renderItem:st,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var Rb={name:"File Explorer",DELETE:he.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[I.DELETE],macShortcut:[k.CMD,I.BACKSPACE]}),RENAME:he.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[I.ENTER],macShortcut:[I.ENTER]})};const ka={FILE_EXPLORER:Rb};var Ma=K.module("FileListItemEditor"),Fb=()=>Promise.resolve();function $b(r){var{item:e,onCancel:t,onSubmit:n,validate:i=Fb}=r,o=m.useRef(null),[a,s]=m.useState(e.basename),[l,d]=m.useState(),[h,c]=m.useState(Promise.resolve()),v=m.useCallback(()=>{var x;(x=o.current)===null||x===void 0||x.focus()},[o]),f=m.useCallback(x=>x.stopPropagation(),[]),p=m.useCallback(()=>{h.then(()=>{n(a)}).catch(x=>Ma.info("Unable to validate name",x))},[n,a,h]);m.useEffect(function(){var P=Te.makeCancelable(i(a));return P.then(()=>d(void 0)).catch(F=>{Te.isCanceled(F)||d(F)}),c(P),()=>P.cancel()},[i,a]),m.useEffect(function(){v()},[v]);var g=m.useCallback(()=>{Ma.debug2("handleBlur"),p()},[p]),b=m.useCallback(x=>{var{value:P}=x.target;s(P)},[]),E=m.useCallback(x=>{x.stopPropagation();var{key:P}=x;switch(P){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:Y("form-control file-list-item-editor-input",{"is-invalid":l}),value:a,ref:o,onBlur:g,onKeyDown:E,onChange:b,onClick:f,onDoubleClick:f,onMouseDown:f}),l&&u.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}function Na(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ti(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Na(Object(t),!0).forEach(function(n){Hb(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Na(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Hb(r,e,t){return(e=Bb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Bb(r){var e=Wb(r,"string");return typeof e=="symbol"?e:e+""}function Wb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Gl(r){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:n=!1,onCreateFile:i,onCreateFolder:o,onCopy:a,onDelete:s,onMove:l,onRename:d,onSelect:h,onSelectionChange:c,table:v,rowHeight:f=Ri,validateRename:p=()=>Promise.resolve()}=r,[g,b]=m.useState(),[E,x]=m.useState([]),[P,F]=m.useState(),U=m.useCallback(G=>{x(G),c==null||c(G)},[c]),ee=m.useCallback(G=>{F(G)},[]),j=m.useCallback(()=>{P&&(a==null||a(P))},[P,a]),W=m.useCallback(()=>{E.length>0&&(s==null||s(E))},[s,E]),H=m.useCallback(()=>{i==null||i()},[i]),ne=m.useCallback(()=>{P&&(o==null||o(N.getPath(P.filename)))},[P,o]),oe=m.useCallback(()=>{P&&b(P)},[P]),L=m.useCallback(()=>{b(void 0)},[]),X=m.useCallback(G=>{g&&(d==null||d(g,G),b(void 0))},[d,g]),z=m.useMemo(()=>{if(g)return[];var G=[];return i&&G.push({title:"New File",description:"Create new file",action:H,group:te.groups.medium}),o&&G.push({title:"New Folder",description:"Create new folder",action:ne,group:te.groups.medium}),a&&G.push({title:"Copy File",description:"Copy the selected file",action:j,group:te.groups.low,disabled:P==null||yt(P)}),s&&E.length>0&&G.push({title:"Delete",description:"Delete",shortcut:ka.FILE_EXPLORER.DELETE,action:W,group:te.groups.low}),d&&G.push({title:"Rename",description:"Rename",shortcut:ka.FILE_EXPLORER.RENAME,action:oe,group:te.groups.low,disabled:P==null}),G},[j,W,H,ne,oe,P,a,i,o,s,d,E,g]),A=m.useCallback(G=>($(g),p(g,G)),[g,p]),V=m.useCallback(G=>{var{item:pe}=G;return g&&g.filename===pe.filename?u.jsx(gi,ti(ti({},G),{},{children:u.jsx($b,{item:pe,validate:A,onSubmit:X,onCancel:L})})):u.jsx(gi,ti({},G))},[L,X,g,A]);return u.jsxs("div",{className:"file-list-container",children:[v!=null&&u.jsx(Lb,{onMove:l,onSelect:h,onSelectionChange:U,onFocusChange:ee,renderItem:V,rowHeight:f,table:v,isMultiSelect:e,focusedPath:t}),n&&u.jsx(te,{actions:z})]})}Gl.displayName="FileListContainer";function ja(r,e,t){return(e=Ub(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ub(r){var e=Vb(r,"string");return typeof e=="symbol"?e:e+""}function Vb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class yr extends Bn{constructor(e){super("Name already exists"),ja(this,"isExistingFile",!0),ja(this,"info",void 0),this.info=e}}function Aa(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function La(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Aa(o,n,i,a,s,"next",l)}function s(l){Aa(o,n,i,a,s,"throw",l)}a(void 0)})}}var St=K.module("FileExplorer");function Fi(r){var{storage:e,isMultiSelect:t=!1,focusedPath:n,onCopy:i=()=>{},onDelete:o=()=>{},onRename:a=()=>{},onCreateFile:s=()=>{},onCreateFolder:l=()=>{},onSelect:d,onSelectionChange:h,rowHeight:c=Ri}=r,[v,f]=m.useState([]),[p,g]=m.useState();m.useEffect(function(){var X;function z(){return A.apply(this,arguments)}function A(){return A=La(function*(){St.debug("initTable"),X=Te.makeCancelable(e.getTable(),V=>V.close());try{g(yield X)}catch(V){Te.isCanceled(V)||St.error("Unable to initialize table",V)}}),A.apply(this,arguments)}return z(),()=>{X.cancel()}},[e]);var b=m.useCallback(L=>{Te.isCanceled(L)||St.error(L)},[]),E=m.useCallback(()=>{St.debug("handleCreateFile"),s()},[s]),x=m.useCallback(()=>{St.debug("handleCreateFolder"),l()},[l]),P=m.useCallback(L=>{St.debug("handleCopyFile",L.filename),i(L)},[i]),F=m.useCallback(L=>{St.debug("handleDelete, pending confirmation",L),f(L)},[]),U=m.useCallback(()=>{St.debug("handleDeleteConfirm",v),v.forEach(L=>e.deleteFile(yt(L)?N.makePath(L.filename):L.filename)),o(v),f([])},[v,o,e]),ee=m.useCallback(()=>{St.debug("handleDeleteCancel"),f([])},[]),j=m.useCallback((L,X)=>{var z=N.reducePaths(L.map(A=>yt(A)?N.makePath(A.filename):A.filename));z.forEach(A=>{var V=N.isPath(A)?"".concat(X).concat(N.getBaseName(A.substring(0,A.length-1)),"/"):"".concat(X).concat(N.getBaseName(A));e.moveFile(A,V).then(()=>{a(A,V)}).catch(b)})},[b,a,e]),W=m.useCallback((L,X)=>{var z=L.filename,A=yt(L);A&&!z.endsWith("/")&&(z="".concat(z,"/"));var V="".concat(N.getParent(z)).concat(X);A&&!V.endsWith("/")&&(V="".concat(V,"/")),St.debug2("handleRename",z,V),e.moveFile(z,V).catch(b),a(z,V)},[b,a,e]),H=m.useCallback(function(){var L=La(function*(X,z){if(z!==X.basename){N.validateName(z);var A="".concat(N.getPath(X.filename)).concat(z);try{var V=yield e.info(A);throw new yr(V)}catch(G){if(!(G instanceof Li))throw G}}});return function(X,z){return L.apply(this,arguments)}}(),[e]),ne=v.length>0,oe=m.useMemo(()=>v.length===1?'Are you sure you want to delete "'.concat(v[0].filename,'"?'):"Are you sure you want to delete the selected files?",[v]);return u.jsxs("div",{className:"file-explorer",children:[p&&u.jsx(Gl,{isMultiSelect:t,focusedPath:n,showContextMenu:!0,onCopy:P,onCreateFolder:x,onCreateFile:E,onMove:j,onDelete:F,onRename:W,onSelect:d,onSelectionChange:h,rowHeight:c,table:p,validateRename:H}),u.jsx(dn,{isOpen:ne,headerText:oe,bodyText:"You cannot undo this action.",onCancel:ee,onConfirm:U,confirmButtonText:"Delete"})]})}Fi.displayName="FileExplorer";function Ra(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function Kb(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Ra(o,n,i,a,s,"next",l)}function s(l){Ra(o,n,i,a,s,"throw",l)}a(void 0)})}}function Ut(r,e,t){return(e=zb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zb(r){var e=Gb(r,"string");return typeof e=="symbol"?e:e+""}function Gb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var tn=K.module("NewItemModal");class Yt extends m.PureComponent{static getValidationMessage(e){return e instanceof yr&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){Te.isCanceled(e)||tn.error(e)}constructor(e){super(e),Ut(this,"inputRef",R.createRef()),Ut(this,"cancelableValidatePromise",void 0),Ut(this,"cancelableExistingItemPromise",void 0),Ut(this,"pending",new qn),Ut(this,"pathMap",new Map),Ut(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,n=N.hasPath(t)?N.getPath(t):"/";this.state={isSubmitting:!1,path:n,prevExtension:N.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:N.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:n}=this.props,{isOpen:i}=e,{value:o,path:a}=this.state;!i&&n&&(this.resetValue(),this.isInitialLoad=!0),i&&n&&(!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=N.hasPath(e)?N.getPath(e):"/";this.setState({path:t,value:N.getBaseName(e),validationError:void 0,prevExtension:N.getExtension(e),isSubmitting:!1})}getValidationPromise(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=Te.makeCancelable(this.validateName(e,t,n)),this.cancelableValidatePromise}validateName(e,t,n){var i=this;return Kb(function*(){N.validateName(t);var{defaultValue:o,storage:a}=i.props;if(n){var s="".concat(e).concat(t);if(s!==o)try{var l=yield a.info(s);throw new yr(l)}catch(d){if(!(d instanceof Li))throw d}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(Yt.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:N.makePath(e.filename)});else{var t=e.basename,n=N.getPath(e.filename);this.setState({value:t,path:n},()=>{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:n}=this.props;n();break}}}handleValidationError(e){if(!(e instanceof Bn))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:n}=this.state;tn.debug("handleOverwriteConfirm",t,n),e("".concat(t).concat(n),!0)}handleExtensionChangeCancel(){tn.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:n}=e,i=N.replaceExtension(t,n);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:n}=e,i=t==="directory"?n.length:n.lastIndexOf(".");e.focus(),e.setSelectionRange(0,i>0?i:n.length)}}submitModal(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.setState(t=>{var{prevExtension:n,value:i,path:o}=t,{notifyOnExtensionChange:a,type:s}=this.props;tn.debug("submitModal",n,i);var l=N.getExtension(i);return a&&!e&&n!==null&&n!==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 yr&&s!=="directory"&&d.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw d}).catch(d=>{throw Te.isCanceled(d)&&this.setState({isSubmitting:!1}),d}).catch(this.handleValidationError).catch(Yt.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((n,i)=>{for(var o="",a=0;a<i;a+=1)o+="".concat(t[a],"/");return o+="".concat(n,"/"),u.jsxs(R.Fragment,{children:[u.jsx(ie,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(o),"aria-label":i===0?"Home":void 0,icon:i===0?u.jsx(fe,{icon:qd,transform:"right-1.6"}):void 0,tooltip:i===0?"Home":void 0,children:n}),"/"]},o)})}render(){var{storage:e,isOpen:t,onCancel:n,placeholder:i,title:o,type:a}=this.props,{isSubmitting:s,path:l,showExtensionChangeModal:d,showOverwriteModal:h,validationError:c,value:v,prevExtension:f,newExtension:p}=this.state,g=a==="directory",b=N.fileExtensionToString(f),E=N.fileExtensionToString(p),x=g?"Create":"Save",P=g?"New folder name":"Save file as";return u.jsxs(u.Fragment,{children:[u.jsxs(Qa,{isOpen:t,toggle:n,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[u.jsx(Ja,{toggle:n,children:o}),u.jsx(es,{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:P}),u.jsx("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:Y("form-control",{"is-invalid":c}),value:v,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),c&&u.jsx("div",{className:"invalid-feedback",children:Yt.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(Fi,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),u.jsxs(Ps,{children:[u.jsx(ie,{kind:"secondary",onClick:n,children:"Cancel"}),u.jsx(ie,{kind:"primary",disabled:s,onClick:this.handleModalSubmit,children:x})]})]}),u.jsx(dn,{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(dn,{isOpen:d,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(b,'" to "').concat(E,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(b,'"'),confirmButtonText:'Use "'.concat(E,'"')})]})}}Ut(Yt,"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});Ut(Yt,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(r,e)=>{},onCancel:()=>{}});function qb(r){var{createFile:e,createFolder:t,onSearchChange:n,defaultSearchText:i=""}=r;return u.jsxs("div",{className:"file-explorer-toolbar",children:[u.jsxs("div",{className:"file-explorer-toolbar-buttons",children:[u.jsx(ie,{kind:"ghost",icon:hs,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),u.jsx(ie,{kind:"ghost",icon:Xd,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),n&&u.jsx("div",{className:"file-explorer-toolbar-search",children:u.jsx(ks,{value:i,onChange:n,placeholder:"Search by name"})})]})}function Fa(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function Xb(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Fa(o,n,i,a,s,"next",l)}function s(l){Fa(o,n,i,a,s,"throw",l)}a(void 0)})}}function ql(r,e,t){return(e=Zb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Zb(r){var e=Yb(r,"string");return typeof e=="symbol"?e:e+""}function Yb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var nn=K.module("FileExplorerPanel"),Qb=(r,e)=>{var t=Hs(r),n=rr(r,e.localDashboardId),{session:i,config:o}=n??{},a=o==null?void 0:o.type;return{fileStorage:t,language:a,session:i}},Jb=In(Qb,null,null,{forwardRef:!0});function ey(r){var e=r;return e!=null&&typeof e.button=="number"}class xn extends R.Component{static handleError(e){nn.error(e)}static isFocusEvent(e){return ey(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:n}=e;this.state={isShown:!1,language:n,session:t,showCreateFolder:!1,focusedFilePath:"/"}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){var{glEventHub:e}=this.props,{session:t,language:n}=this.state,i={language:n,value:""};nn.debug("handleCreateFile",t,n,i),e.emit(J.CREATE_NOTEBOOK,t,n,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(xn.handleError)}handleCopyFile(e){var t=this;return Xb(function*(){var{fileStorage:n}=t.props;if(yt(e)){nn.error("Invalid item in handleCopyItem",e);return}var i=yield N.getUniqueCopyFileName(n,e.filename);yield n.copyFile(e.filename,i)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(n=>{t.emit(J.CLOSE_FILE,{id:n.filename,itemName:n.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=N.makePath(e[0].filename):t=N.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(nn.debug("fileSelect",e),e.type!=="directory"){var n=xn.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(J.SELECT_NOTEBOOK,a,s,l,i,n)}}handleRename(e,t){var{glEventHub:n}=this.props;nn.debug("handleRename",e,t),n.emit(J.RENAME_FILE,e,t)}handleSessionOpened(e,t){var{language:n}=t;this.setState({session:e,language:n})}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:n}=this.props,{isShown:i,showCreateFolder:o,focusedFilePath:a}=this.state;return u.jsxs(nr,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:n,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[u.jsx(qb,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&u.jsx(Fi,{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(Yt,{isOpen:o,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:a})]})}}ql(xn,"COMPONENT","FileExplorerPanel");ql(xn,"TITLE","File Explorer");var ty=Jb(xn);function Gn(r,e,t){return(e=ny(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ny(r){var e=ry(r,"string");return typeof e=="symbol"?e:e+""}function ry(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var $a=K.module("LogPanel");class Hr extends m.PureComponent{constructor(e){super(e),Gn(this,"isBottomVisible",void 0),Gn(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){$a.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){$a.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){var{glContainer:e,glEventHub:t}=this.props,{session:n}=this.state;return u.jsxs(nr,{componentPanel:this,glContainer:e,glEventHub:t,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[n==null&&u.jsx("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),n!=null&&u.jsx(Se,{session:n,ref:i=>{this.logView=i}})]})}}Gn(Hr,"defaultProps",{session:null});Gn(Hr,"COMPONENT","LogPanel");Gn(Hr,"TITLE","Log");var iy=(r,e)=>{var t;return{session:(t=rr(r,e.localDashboardId))===null||t===void 0?void 0:t.session}},oy=In(iy,null,null,{forwardRef:!0})(Hr);function Ha(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function gr(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Ha(o,n,i,a,s,"next",l)}function s(l){Ha(o,n,i,a,s,"throw",l)}a(void 0)})}}function Ba(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ze(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ba(Object(t),!0).forEach(function(n){Re(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ba(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Re(r,e,t){return(e=ay(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ay(r){var e=sy(r,"string");return typeof e=="symbol"?e:e+""}function sy(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ly=m.lazy(()=>ms(()=>import("./MarkdownNotebook-8EvnYtx2.js"),__vite__mapDeps([6,4,3,5,7,8,9,10,11,12]),import.meta.url)),ue=K.module("NotebookPanel"),Wa=400;class xe extends m.Component{static handleError(e){Te.isCanceled(e)||ue.error(e)}static unsavedNotebookCount(){return document.querySelectorAll(".".concat(xe.UNSAVED_INDICATOR_CLASS_NAME,".").concat(xe.UNSAVED_STATUS_CLASS_NAME)).length}static languageFromFileName(e){var t=N.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),Re(this,"pending",void 0),Re(this,"debouncedSavePanelState",void 0),Re(this,"debouncedLoad",void 0),Re(this,"notebook",void 0),Re(this,"tabTitleElement",void 0),Re(this,"tabInitOnce",void 0),Re(this,"editor",void 0),Re(this,"getSettings",qt((v,f)=>Ze(Ze({},v),{},{minimap:{enabled:f}}))),Re(this,"getOverflowActions",qt((v,f,p)=>{var g=[{title:"Find",icon:Qd,action:this.handleFind,group:te.groups.high,shortcut:Ve.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:ts,action:this.handleCopy,group:te.groups.medium,order:20},{title:"Rename File",icon:Jd,action:this.handleShowRename,group:te.groups.medium,order:30},{title:"Delete File",icon:ss,action:this.handleDelete,group:te.groups.medium,order:40},{title:"Show Minimap",icon:v?wn:void 0,action:this.handleMinimapChange,group:te.groups.low,shortcut:Ve.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:f?wn:void 0,action:this.handleWordWrapChange,group:te.groups.low,shortcut:Ve.NOTEBOOK.WORDWRAP,order:30}];return this.canFormat()&&(g.push({title:"Format Document",action:this.handleFormat,group:te.groups.low,order:10}),g.push({title:"Format on Save",icon:p?wn:void 0,action:this.handleFormatOnSaveChange,group:te.groups.low,order:15})),g})),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.handleFormatOnSaveChange=this.handleFormatOnSaveChange.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.handleFormat=this.handleFormat.bind(this),this.canFormat=this.canFormat.bind(this),this.getDropdownOverflowActions=this.getDropdownOverflowActions.bind(this),this.pending=new qn,this.debouncedSavePanelState=ln(this.savePanelState.bind(this),Wa),this.debouncedLoad=ln(this.load.bind(this),Wa),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;var{isDashboardActive:t,session:n,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&&N.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:n,sessionLanguage:i,panelState:{fileMetadata:s,settings:a},showCloseModal:!1,showDeleteModal:!1,showSaveAsModal:!1,scriptCode:"",formatOnSave:!1},ue.debug("constructor",e,this.state)}componentDidMount(){var{glContainer:e,glEventHub:t}=this.props,{tab:n}=e;n!=null&&this.initTab(n),this.initNotebookContent(),t.on(J.RENAME_FILE,this.handleRenameFile),t.on(ae.DROPPED,this.handlePanelDropped),e.on(J.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion)}componentDidUpdate(e,t){var{isPreview:n,settings:i}=this.state,{wordWrap:o}=i,{notebookSettings:a}=this.props;n!==t.isPreview&&this.setPreviewStatus(),o!==t.settings.wordWrap&&(this.updateEditorWordWrap(),this.debouncedSavePanelState()),a.isMinimapEnabled!==e.notebookSettings.isMinimapEnabled&&this.updateEditorMinimap()}componentWillUnmount(){this.debouncedSavePanelState.flush(),this.pending.cancel();var{glEventHub:e,glContainer:t}=this.props,{fileMetadata:n,isPreview:i}=this.state;e.off(J.RENAME_FILE,this.handleRenameFile),e.off(ae.DROPPED,this.handlePanelDropped),t.off(J.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion),e.emit(J.UNREGISTER_FILE,n,i)}initTab(e){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(e)}initTabCloseOverride(){var{glContainer:e}=this.props;e.beforeClose(t=>{if((t==null?void 0:t.force)===!0)return!0;var{changeCount:n,savedChangeCount:i}=this.state;return n!==i?(this.setState({showCloseModal:!0}),!1):!0})}initTabClasses(e){var t=e.element.get(0);$(t);var n=t.querySelector(".lm_title");this.tabTitleElement=n,n==null||n.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){var{changeCount:e,savedChangeCount:t,settings:n}=this.state,{value:i}=n;if(e!==t&&this.notebook){var o=this.notebook.getValue();return o??i}return i}initNotebookContent(){var{fileMetadata:e,settings:t,isPreview:n}=this.state;if(e&&e.id){ue.debug("Init content from file"),this.registerFileMetadata(e,n),this.load();return}if(t.value!=null){ue.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(J.CLOSE_FILE,{id:e})}registerFileMetadata(e,t){var{glEventHub:n,metadata:i}=this.props,{id:o}=i;n.emit(J.REGISTER_FILE,o,e,t)}renameTab(e,t){var{glEventHub:n}=this.props;n.emit(J.RENAME,e,t)}load(){var{fileMetadata:e,settings:t}=this.state;$(e);var{id:n}=e,{fileStorage:i}=this.props;this.pending.add(i.loadFile(n)).then(o=>{var a;ue.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,N.getBaseName(s))}var c=Ze(Ze({},t),{},{language:(a=xe.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&&N.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){ue.debug("saveContent",e,t),this.updateSavedChangeCount();var{fileStorage:n}=this.props;this.pending.add(n.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;ue.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:n,fileMetadata:i,isPreview:o,settings:a}=e,s=this.getNotebookValue(),l=t!==n?s:void 0,d=Ze(Ze({},a),{},{value:s}),h=Ze(Ze({},a),{},{value:l}),c={settings:h,fileMetadata:i,isPreview:o};return ue.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(J.CLOSE_FILE,{id:e,itemName:e},{force:!0}),this.focus()}handleCopy(){var e=this;return gr(function*(){var{fileStorage:t,glEventHub:n,session:i}=e.props,{fileMetadata:o,settings:a}=e.state;$(o);var{language:s}=a,{itemName:l}=o,d=yield N.getUniqueCopyFileName(t,l);ue.debug("handleCopy",o,l,d),yield t.copyFile(l,d);var h={id:d,itemName:d},c={value:null,language:s};n.emit(J.SELECT_NOTEBOOK,i,s,c,h,!0)})()}handleDelete(){ue.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var e=this;return gr(function*(){var{fileStorage:t,glContainer:n,glEventHub:i}=e.props,{fileMetadata:o}=e.state;ue.debug("handleDeleteConfirm",o==null?void 0:o.itemName),e.setState({showDeleteModal:!1}),o&&(N.hasPath(o.itemName)&&(yield N.fileExists(t,o.itemName))?(i.emit(J.CLOSE_FILE,o,{force:!0}),t.deleteFile(o.itemName)):n.close({force:!0}))})()}handleDeleteCancel(){this.setState({showDeleteModal:!1})}handleEditorInitialized(e){this.editor=e}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(e){ue.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(t=>{var{changeCount:n,savedChangeCount:i}=t,{isUndoing:o,isRedoing:a}=e;return o?{changeCount:n-1,savedChangeCount:i}:!a&&n<i?{changeCount:n+1,savedChangeCount:0}:{changeCount:n+1,savedChangeCount:i}}),this.debouncedSavePanelState()}handleFind(){this.notebook&&this.notebook.toggleFind()}updateEditorMinimap(){if(this.editor){var{notebookSettings:e}=this.props;this.editor.updateOptions({minimap:{enabled:e.isMinimapEnabled}})}}handleMinimapChange(){var e,{notebookSettings:t,updateNotebookSettings:n}=this.props,i={isMinimapEnabled:!((e=t.isMinimapEnabled)!==null&&e!==void 0&&e)};n(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,n=t.wordWrap==="on"?"off":"on";return{settings:Ze(Ze({},t),{},{wordWrap:n})}})}handleFormatOnSaveChange(){var e,{notebookSettings:t,updateNotebookSettings:n}=this.props,i={formatOnSave:!((e=t.formatOnSave)!==null&&e!==void 0&&e)};n(i)}handleLinkClick(e){var{notebooksUrl:t,session:n,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==="/"){ue.debug("Ignoring invalid notebook link",a);return}ue.debug("Notebook link clicked, opening",a);var{glEventHub:s}=this.props,l={value:null,language:i},d={id:a,itemName:a};s.emit(J.SELECT_NOTEBOOK,n,i,l,d)}}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(e){var t=e;Te.isCanceled(t)||(Te.isTimedOut(t)&&(t=new Error("File not found.")),ue.error(t),this.setState({error:t,isLoading:!1}))}handleSave(){var e=this;return gr(function*(){ue.debug("handleSave");var{notebookSettings:t}=e.props,{formatOnSave:n=!1}=t;n&&(yield e.handleFormat()),e.save()})()}handleSaveSuccess(e){var t,{fileStorage:n}=this.props,i={id:e.filename,itemName:e.filename},o=(t=xe.languageFromFileName(e.filename))!==null&&t!==void 0?t:"";this.setState(a=>{var{fileMetadata:s}=a,l=Ze(Ze({},a.settings),{},{language:o});return ue.debug("handleSaveSuccess",i,s,l),s&&N.hasPath(s.itemName)&&s.itemName!==i.itemName&&(ue.debug("handleSaveSuccess deleting old file",s.itemName),n.deleteFile(s.itemName).catch(xe.handleError)),{fileMetadata:i,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(i,!1)}handleSaveError(e){Te.isCanceled(e)||(this.setState({savedChangeCount:0}),ue.error(e))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;n&&this.handleOverwrite(e),ue.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}),N.getBaseName(o)!==N.getBaseName(e)){var{metadata:s}=this.props,{id:l}=s;this.renameTab(l,N.getBaseName(e))}this.saveContent(e,a)}}canFormat(){var e;return((e=this.notebook)===null||e===void 0?void 0:e.editor)!=null?ve.canFormat(this.notebook.editor):!1}handleFormat(){var e=this;return gr(function*(){var t;((t=e.notebook)===null||t===void 0?void 0:t.editor)!=null&&(yield ve.formatDocument(e.notebook.editor))})()}handleRenameFile(e,t,n){var{fileMetadata:i,panelState:o}=this.state,{glContainer:a}=this.props;if((i==null?void 0:i.itemName)==="/".concat(t)&&n&&JSON.stringify(o)!==JSON.stringify(n)){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){ue.error("Editor is not initialized.");return}this.runCommand((e=this.notebook.getValue())!==null&&e!==void 0?e:void 0)}handleRunSelected(){if(!this.notebook){ue.error("Editor is not initialized.");return}this.runCommand(this.notebook.getSelectedCommand())}handleSessionOpened(e,t){var{language:n}=t;this.setState({session:e,sessionLanguage:n})}handleSessionClosed(){this.setState({session:void 0,sessionLanguage:void 0})}handleShow(){var e;ue.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){ue.debug("NotebookPanel tab event",e),this.initTab(e)}handleTabFocus(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];ue.debug("handleTabFocus",...t);var{glContainer:i}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!i.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){ue.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handleTabClick(e){ue.debug("handle NotebookPanel tab click"),this.focus(),e.detail===2&&this.removePreviewStatus()}handleTransformLinkUri(e){var{notebooksUrl:t}=this.props,{fileMetadata:n}=this.state;if(e.endsWith("/"))return e;if(e.startsWith("/"))return"".concat(t).concat(e.substring(1));var i=n==null?void 0:n.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 n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{glEventHub:i}=this.props,{session:o,sessionLanguage:a,settings:s}=this.state,l=Ze(Ze({},s),{},{language:t,value:n}),d={id:null,itemName:e};ue.debug("handleCreateNotebook",o,a,l,d),i.emit(J.CREATE_NOTEBOOK,o,a,l,d)}runCommand(e){if(e===void 0||e===""){ue.debug("Ignoring empty command.");return}this.removePreviewStatus();var{glEventHub:t}=this.props;t.emit(Ne.SEND_COMMAND,e,!1,!0)}removePreviewStatus(){this.setState(e=>{var{isPreview:t}=e;if(t){var{fileMetadata:n}=this.state;return n&&this.registerFileMetadata(n,!1),{isPreview:!1}}return null})}getDropdownOverflowActions(){var{notebookSettings:e}=this.props,{isMinimapEnabled:t,formatOnSave:n}=e,{settings:i}=this.state;return this.getOverflowActions(t??!1,this.getSettings(i,t??!1).wordWrap==="on",n??!1)}render(){var e,t,n,{fileStorage:i,glContainer:o,glContainer:{tab:a},glEventHub:s,notebookSettings:l}=this.props,{changeCount:d,savedChangeCount:h,error:c,isDashboardActive:v,isLoaded:f,isLoading:p,isPreview:g,fileMetadata:b,session:E,sessionLanguage:x,settings:P,showCloseModal:F,showDeleteModal:U,showSaveAsModal:ee}=this.state,j=v&&!o.isHidden&&!g,W=(e=b==null?void 0:b.itemName)!==null&&e!==void 0?e:xe.DEFAULT_NAME,H=W.endsWith(".md"),ne=(b==null?void 0:b.id)!=null,oe=this.getSettings(P,(t=l.isMinimapEnabled)!==null&&t!==void 0?t:!1),L=E!=null,X=x===oe.language,z=!f||!L||!X,A=!f,V=[{action:this.handleSave,shortcut:Kt.SAVE},{action:this.handleMinimapChange,shortcut:Ve.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:Ve.NOTEBOOK.WORDWRAP}],G=di.getDisabledRunTooltip(L,X,"Notebook extension","Run"),pe=di.getDisabledRunTooltip(L,X,"Notebook extension","Run Selected"),Ge=[{title:ne?"Rename":"Save As…",order:10,group:te.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:te.groups.high,order:20}],je=a==null?void 0:a.element.find(".lm_title_before").get(0);return u.jsxs(u.Fragment,{children:[je!=null&&Dr.createPortal(u.jsx("span",{className:Y(xe.UNSAVED_INDICATOR_CLASS_NAME,{[xe.UNSAVED_STATUS_CLASS_NAME]:d!==h})}),je),u.jsxs(nr,{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:Ge,renderTabTooltip:()=>W,children:[!H&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"notebook-toolbar",children:[u.jsxs("span",{children:[u.jsx(ie,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:z,icon:u.jsx(fe,{icon:us,transform:"grow-4"}),tooltip:"Run ".concat(Ve.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),G!=null&&u.jsx(ce,{children:G})]}),u.jsxs("span",{children:[u.jsx(ie,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:z,icon:u.jsx(fe,{icon:Zd,transform:"grow-4"}),tooltip:"Run Selected ".concat(Ve.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),pe!=null&&u.jsx(ce,{children:pe})]}),u.jsx(ie,{kind:"ghost",className:"mr-auto",disabled:A,onClick:this.handleSave,icon:Yd,tooltip:"Save ".concat(Kt.SAVE.getDisplayText()),"aria-label":"Save"}),u.jsx(ie,{kind:"ghost",className:"btn-overflow",disabled:A,icon:ds,tooltip:"More Actions...",onClick:()=>{},children:u.jsx(Yn,{actions:this.getDropdownOverflowActions,popperOptions:xe.POPPER_OPTIONS})})]}),u.jsx(ol,{isLoaded:f,isLoading:p,error:c,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:E,sessionLanguage:x,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:oe,focusOnMount:j,ref:y=>{this.notebook=y}})]}),H&&u.jsx(m.Suspense,{fallback:u.jsx(un,{"data-testid":"notebook-panel-loading"}),children:u.jsx(ly,{content:(n=oe.value)!==null&&n!==void 0?n:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri})}),u.jsx(Yt,{isOpen:ee,type:"file",defaultValue:W,title:ne?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:i}),u.jsx(dn,{isOpen:U,headerText:'Are you sure you want to delete "'.concat(W,'"?'),bodyText:"You cannot undo this action.",onCancel:this.handleDeleteCancel,onConfirm:this.handleDeleteConfirm,confirmButtonText:"Delete"}),u.jsx(dn,{isOpen:F,headerText:"Do you want to save the changes you made to ".concat(W,"?"),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(te,{actions:V})]})]})}}Re(xe,"COMPONENT","NotebookPanel");Re(xe,"POPPER_OPTIONS",{placement:"bottom-end"});Re(xe,"DEFAULT_NAME","Untitled");Re(xe,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");Re(xe,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");Re(xe,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,notebookSettings:{isMinimapEnabled:!0}});var dy=(r,e)=>{var t=Hs(r),n=Ws(r),i=rr(r,e.localDashboardId),{session:o,config:a}=i??{},{type:s}=a??{};return{fileStorage:t,notebookSettings:n,session:o,sessionLanguage:s}},rn=In(dy,{updateNotebookSettings:Cc},null,{forwardRef:!0})(xe);function uy(){var{python:{linter:r={}}={}}=fg(Ws),{isEnabled:e=!1,config:t}=r;m.useEffect(function(){B.isRuffEnabled=e,B.setRuffSettings(t)},[e,t])}function Ua(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Va(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ua(Object(t),!0).forEach(function(n){hy(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ua(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function hy(r,e,t){return(e=cy(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function cy(r){var e=my(r,"string");return typeof e=="symbol"?e:e+""}function my(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var we=K.module("ConsolePlugin");function Ka(r){return r.notebook!==void 0}function vy(r){Jp(r)}function m0(r){vy(r);var{id:e,hydrateConsole:t,layout:n,panelManager:i,registerComponent:o,notebooksUrl:a}=r,s=m.useRef(0),[l,d]=m.useState(new Map),[h,c]=m.useState(new Map);uy();var v=bi(),f=m.useCallback(()=>i.getLastUsedPanelOfType(ei),[i]),p=m.useCallback((y,w)=>{d(T=>new Map(T.set(y,w)))},[d]),g=m.useCallback(y=>{d(w=>(w.delete(y),new Map(w)))},[d]),b=m.useCallback((y,w)=>{c(T=>new Map(T.set(y,w)))},[c]),E=m.useCallback(y=>{c(w=>(w.delete(y),new Map(w)))},[c]),x=m.useCallback(function(y){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,T=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,q=y&&y.trim();if(!q)we.info("Ignoring empty code");else{var re=f();if(!re||!(re instanceof ei.WrappedComponent)){we.error("Console panel not found");return}we.debug("Send command: ",y,w,T),re.addCommand(y,w,T)}},[f]),P=m.useCallback(y=>{v(hb(e,y))},[v,e]),F=m.useCallback(y=>{var{language:w}=y,T=w==="python"?"py":w,q=null;return T==null?(we.debug("No extension for language",w),q="Untitled-".concat(s.current)):q="Untitled-".concat(s.current,".").concat(T),s.current+=1,q},[]),U=m.useCallback(function(y){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{id:T}=y;if(T!=null&&l.has(T))return l.get(T);if(T!=null&&h.has(T))return h.get(T);if(w)return Et()},[l,h]),ee=m.useCallback((y,w)=>{O.renameComponent(n.root,{id:y},w)},[n.root]),j=m.useCallback((y,w)=>{we.debug("Rename file panel",y,w);var T;if(l.has(y)&&(T=l.get(y),g(y),T!=null&&p(w,T)),h.has(y)&&(T=h.get(y),E(y),T!=null&&b(w,T)),T===void 0){we.debug2("File ".concat(y," isn't open, no need to rename the tab"));return}ee(T,N.getBaseName(w))},[l,h,ee,p,b,g,E]),W=m.useCallback(y=>{var w=U(y,!1);if(w==null){we.error("Could not find panel id for file metadata",y);return}O.activateTab(n.root,{id:w})},[U,n.root]),H=m.useCallback((y,w,T)=>{if(we.debug("registerFilePanel",y,w,T),w==null||w.id==null){we.debug("Ignore empty file id",w);return}var{id:q}=w;if(T){b(q,y);return}if(l.has(q)){var re=l.get(q);if(y===re){we.debug("Update tab title for file ".concat(q));var{itemName:st}=w;j(q,st)}else we.error("File ".concat(q," already associated with a different tab ").concat(re));return}p(q,y),h.has(q)&&E(q)},[l,h,j,p,b,E]),ne=m.useCallback((y,w)=>{if(we.debug("unregisterFileTab",y,w),y==null||y.id==null){we.debug("Ignore empty file id",y);return}var{id:T}=y;if(w){E(T);return}g(T)},[g,E]),oe=m.useCallback((y,w)=>{we.debug("closeFilePanel",y);var{id:T}=y,q=null,re=!1;if(l.has(T))q=l.get(T);else if(h.has(T))q=h.get(T),re=!0;else{we.debug("File ".concat(T," isn't open, ignore close event"));return}ne(y,re),O.closeComponent(n.root,{id:q},w)},[n.root,l,h,ne]),L=m.useCallback(y=>{var{itemName:w}=y;return N.getBaseName(w)},[]),X=m.useCallback(y=>{var{id:w}=y;return we.debug("fileIsOpen",y,w,l),w!=null&&l.has(w)},[l]),z=m.useCallback(y=>{var{id:w}=y;return we.debug("fileIsOpenAsPreview",y,w,h),w!=null&&h.has(w)},[h]),A=m.useCallback(y=>{if(y!=null){var w=i.getOpenedPanelById(y);w&&Ka(w)&&w.focus()}},[i]),V=m.useCallback(y=>{var{id:w,settings:T,fileMetadata:q,session:re,sessionLanguage:st,isPreview:D=!1}=y,Z={settings:T,fileMetadata:q},se=L(q);return{type:"react-component",component:rn.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:w},session:re,sessionLanguage:st,panelState:Z,isPreview:D,notebooksUrl:a},title:se,id:w}},[L,e,a]),G=m.useCallback(function(y,w,T){var q=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{id:null,itemName:F(T)},re=U(q);if(X(q)&&re!=null){we.debug("File is already open, focus panel"),W(q),A(re);return}var st=O.getStackForComponentTypes(n.root,[rn.COMPONENT]),D=V({id:re,settings:T,fileMetadata:q,session:y,sessionLanguage:w});we.debug("createNotebook",D,l),O.openComponentInStack(st,D)},[X,A,F,U,n.root,V,l,W]),pe=m.useCallback(function(y,w,T,q){var re=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;we.debug("selectNotebook",q,re);var st=X(q),D=z(q),[Z]=[...h.values()],se=!re,me=se&&Z?Z:U(q);if(me==null||me==="")throw new Error("Unable to retrieve or create panelId for metadata",q);if(st||D)W(q);else{var He=O.getStackForComponentTypes(n.root,[rn.COMPONENT]),Pt=V({id:me,settings:T,fileMetadata:q,session:y,sessionLanguage:w,isPreview:se});O.openComponentInStack(He,Pt)}if(D&&re){var Tt=q.id,Ur=O.getStackForConfig(n.root,{component:rn.COMPONENT,id:me}),Mn=O.getContentItemInStack(Ur,{component:rn.COMPONENT,id:me});Mn&&Qe(Mn)&&(Mn.container.emit(J.PROMOTE_FROM_PREVIEW),E(Tt),p(Tt,me))}re&&A(me)},[W,X,z,A,U,n.root,V,h,E,p]),Ge=m.useCallback(function(y,w){var T=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},q=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,re=i.getLastUsedPanelOfType(rn);re&&Ka(re)?T!=null&&T.value!=null&&re.notebook!=null&&re.notebook.append(T.value):q&&G(y,w,T)},[G,i]),je=m.useCallback((y,w)=>sg.hydrate(Va(Va({},y),{},{notebooksUrl:a}),w),[a]);return An(o,ei,t),An(o,fb),An(o,ty),An(o,oy),An(o,rn,je),Le(n.eventHub,Ne.SEND_COMMAND,x),Le(n.eventHub,Ne.SETTINGS_CHANGED,P),Le(n.eventHub,J.CLOSE_FILE,oe),Le(n.eventHub,J.CREATE_NOTEBOOK,G),Le(n.eventHub,J.SELECT_NOTEBOOK,pe),Le(n.eventHub,J.RENAME,ee),Le(n.eventHub,J.RENAME_FILE,j),Le(n.eventHub,J.SEND_TO_NOTEBOOK,Ge),Le(n.eventHub,J.REGISTER_FILE,H),Le(n.eventHub,J.UNREGISTER_FILE,ne),null}function Br(r,e,t){return(e=fy(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function fy(r){var e=py(r,"string");return typeof e=="symbol"?e:e+""}function py(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Wr{}Br(Wr,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");Br(Wr,"INPUT_FILTER","ControlType.INPUT_FILTER");Br(Wr,"MARKDOWN","ControlType.MARKDOWN");Br(Wr,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");export{NC as $,Gy as A,ie as B,Mr as C,Je as D,qy as E,tl as F,_s as G,Fe as H,mt as I,Ws as J,I as K,Cc as L,B as M,Kt as N,Kn as O,Te as P,Oy as Q,pm as R,Ns as S,_ as T,Wr as U,VC as V,Yn as W,Vs as X,Nr as Y,nC as Z,jl as _,be as a,yi as a$,Jt as a0,yc as a1,Xy as a2,pg as a3,$e as a4,vc as a5,QC as a6,rr as a7,jy as a8,Bs as a9,eC as aA,tC as aB,JC as aC,e0 as aD,Zy as aE,Jy as aF,Us as aG,Qy as aH,ve as aI,_y as aJ,Hu as aK,Xn as aL,zu as aM,Bu as aN,Es as aO,ws as aP,Wu as aQ,Uu as aR,pt as aS,at as aT,Ci as aU,ks as aV,Hh as aW,jr as aX,k as aY,Ps as aZ,kr as a_,sg as aa,au as ab,gs as ac,LC as ad,J as ae,_t as af,CC as ag,wC as ah,_C as ai,TC as aj,ae as ak,UC as al,RC as am,HC as an,rn as ao,Gp as ap,ac as aq,nu as ar,Zn as as,m0 as at,te as au,dn as av,u0 as aw,rC as ax,Yy as ay,iC as az,gt as b,Ve as b$,Ty as b0,Bh as b1,Si as b2,Iy as b3,xs as b4,js as b5,Os as b6,bh as b7,Cr as b8,tc as b9,iv as bA,fC as bB,vC as bC,Oi as bD,pC as bE,rf as bF,Yv as bG,of as bH,Gt as bI,Ks as bJ,Ue as bK,_r as bL,al as bM,Ar as bN,zs as bO,Ac as bP,Xs as bQ,Gs as bR,_n as bS,qs as bT,Pn as bU,Pv as bV,Sr as bW,Zs as bX,lf as bY,Se as bZ,li as b_,Rs as ba,Ls as bb,As as bc,Dy as bd,ky as be,My as bf,Lm as bg,Rm as bh,Ee as bi,Um as bj,nv as bk,Q as bl,Gm as bm,Me as bn,oC as bo,Js as bp,el as bq,lC as br,hC as bs,aC as bt,sC as bu,dC as bv,Ym as bw,cC as bx,mC as by,rv as bz,C as c,Cb as c$,ol as c0,di as c1,vs as c2,O as c3,An as c4,yC as c5,MC as c6,qg as c7,Ag as c8,jg as c9,IC as cA,BC as cB,$C as cC,SC as cD,PC as cE,EC as cF,OC as cG,jC as cH,WC as cI,Le as cJ,Sg as cK,l0 as cL,Ai as cM,d0 as cN,zl as cO,h0 as cP,kn as cQ,Wl as cR,wb as cS,Sb as cT,yb as cU,Vl as cV,gb as cW,pb as cX,a0 as cY,bb as cZ,s0 as c_,Jr as ca,Al as cb,xg as cc,ug as cd,Il as ce,rg as cf,Ni as cg,Mi as ch,kl as ci,cr as cj,Jp as ck,Ol as cl,Lg as cm,FC as cn,DC as co,kC as cp,Nl as cq,xl as cr,Qp as cs,qp as ct,Zp as cu,Xp as cv,Yp as cw,bC as cx,cg as cy,xC as cz,Dn as d,Ul as d0,_a as d1,Ey as d2,Gi as d3,Lr as d4,AC as d5,zp as d6,N as d7,Li as d8,c0 as d9,YC as dA,hb as dB,uy as dC,Sy as dD,Py as dE,wy as dF,Kr as dG,hu as dH,Vr as dI,uC as dJ,Bn as dK,ei as da,oy as db,fb as dc,ty as dd,ys as de,Cy as df,nr as dg,Cs as dh,Qt as di,r0 as dj,qn as dk,qC as dl,XC as dm,ZC as dn,GC as dp,Hl as dq,KC as dr,o0 as ds,zC as dt,yt as du,Bl as dv,t0 as dw,n0 as dx,i0 as dy,Ne as dz,Sc as e,Ry as f,Ly as g,Fy as h,Ny as i,Hy as j,By as k,Wy as l,Uy as m,Vy as n,Ky as o,mc as p,Ay as q,Ce as r,he as s,ce as t,oc as u,_e as v,zy as w,xy as x,$y as y,fg as z};
|
|
24
|
-
//# sourceMappingURL=ControlType-
|
|
23
|
+
`)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,Se.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,n=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(ie,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:Fd,tooltip:"Clear log"}),u.jsx(ie,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:$d,tooltip:"Log Settings",onClick:()=>{},children:u.jsx(Yn,{actions:n,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),u.jsx("div",{className:"log-pane-editor h-100 w-100",ref:i=>{this.editorContainer=i}})]})}}ot(Se,"DefaultLogLevels",[Ie.STDOUT,Ie.ERROR,Ie.FATAL,Ie.STDERR,Ie.WARN]);ot(Se,"AllLogLevels",[Ie.INFO,Ie.STDOUT,Ie.ERROR,Ie.FATAL,Ie.STDERR,Ie.WARN,Ie.DEBUG,Ie.TRACE]);ot(Se,"bufferTimeout",16);ot(Se,"maxLogSize",131072);ot(Se,"truncateSize",65536);const Gv="var(--dh-color-chart-colorway)",qv="var(--dh-color-chart-grid)",Xv="var(--dh-color-chart-axis-line)",Zv="var(--dh-color-chart-axis-line-zero)",ta={"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:qv,linecolor:Xv,zerolinecolor:Zv,"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 na=K.module("ChartTheme");function Yv(){var r,e=as(ta);return e.colorway=Hd((r=e.colorway)!==null&&r!==void 0?r:"").map(t=>{var[n,i]=t;return Bd.normalizeCssColor(e.colorway.substring(n,i+1))}).join(" "),na.debug2("Chart theme:",ta),na.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 ra(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Qv(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ra(Object(t),!0).forEach(function(n){Jv(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ra(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Jv(r,e,t){return(e=ef(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ef(r){var e=tf(r,"string");return typeof e=="symbol"?e:e+""}function tf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var nf=m.lazy(()=>ms(()=>import("./Plot-B3JS6Jui.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url));function rf(r){return u.jsx(m.Suspense,{fallback:u.jsx(un,{"data-testid":"lazy-plot-loading"}),children:u.jsx(nf,Qv({},r))})}var Oi=m.createContext(null);Oi.displayName="ChartThemeContext";function pC(r){var{children:e}=r,{activeThemes:t}=_s(),n=m.useMemo(Yv,[t]);return u.jsx(Oi.Provider,{value:n,children:e})}function of(){return Xn(Oi,"No ChartThemeContext value found.")}function ia(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function af(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){ia(o,n,i,a,s,"next",l)}function s(l){ia(o,n,i,a,s,"throw",l)}a(void 0)})}}var sf=K.module("HeapUsage");function lf(r){var e,{connection:t,defaultUpdateInterval:n,hoverUpdateInterval:i,bgMonitoring:o=!0,monitorDuration:a}=r,s=of(),[l,d]=m.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[h,c]=m.useState(!1),v=m.useRef({timestamps:[],usages:[]}),f=ws(),p=m.useCallback(af(function*(){try{var A=yield t.getWorkerHeapInfo();if(!f.current)return;if(d(A),o||h){for(var V=(A.totalHeapSize-A.freeMemory)/A.maximumHeapSize,G=Date.now(),{timestamps:pe,usages:Ge}=v.current;pe.length!==0&&G-pe[0]>a*1.5;)pe.shift(),Ge.shift();pe.push(G),Ge.push(V)}else v.current={timestamps:[],usages:[]}}catch(je){sf.warn("Unable to get heap usage",je)}}),[t,f,o,h,a]);Hu(p,h?i:n);var g=(A,V)=>Math.round(A*10**V)/10**V,b=2,E=1024**3,{freeMemory:x,totalHeapSize:P,maximumHeapSize:F}=l,U=g(x/E,b),ee=g(P/E,b),j=g(F/E,b),W=ee-U,H=function(V,G){var pe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return u.jsxs("div",{className:Y("heap-usage-info-row",{"heading-bottom-border":pe}),children:[u.jsx("div",{className:"font-weight-bold",children:V}),u.jsx("div",{children:G})]})},{timestamps:ne,usages:oe}=v.current,L=(e=ne[ne.length-1])!==null&&e!==void 0?e:0,X=P/F,z=(P-x)/F;return u.jsxs("div",{className:"max-memory",children:[u.jsx("div",{className:"total-memory",style:{width:"calc(".concat(X*100,"% - ").concat(X*2,"px")}}),u.jsx("div",{className:Y("used-memory",{"heap-overflow":(P-x)/F>.95}),style:{width:"calc(".concat(z*100,"% - ").concat(z*2,"px")}}),u.jsxs("div",{className:"memory-text",children:[j.toFixed(1)," GB"]}),u.jsx(ce,{onEntered:()=>c(!0),onExited:()=>c(!1),interactive:!0,children:u.jsxs("div",{className:"heap-tooltip",children:[H("In use:","".concat(W.toFixed(b)," of ").concat(j.toFixed(b)," GB"),!0),H("Free:","".concat(U.toFixed(b)," GB")),H("Total:","".concat(ee.toFixed(b)," GB")),H("Max:","".concat(j.toFixed(b)," GB")),u.jsx("div",{className:"heap-plot",children:u.jsx(rf,{data:[{x:[...ne],y:[...oe],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:[L-a,L],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(r){return r.componentName!==void 0}function df(r){return r.component!==void 0}var dl=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const uf=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:sl,isGLComponentConfig:ll,isReactComponentConfig:df,itemDefaultConfig:dl},Symbol.toStringTag,{value:"Module"}));function br(r,e,t){return(e=hf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function hf(r){var e=cf(r,"string");return typeof e=="symbol"?e:e+""}function cf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class ze{constructor(){br(this,"_mSubscriptions",void 0),br(this,"off",this.unbind),br(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[ze.ALL_EVENT]=[]}on(e,t,n){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:n})}emit(e){for(var t=this._mSubscriptions[e],n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;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[ze.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,n){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)&&(!n||n===this._mSubscriptions[e][o].ctx)&&(this._mSubscriptions[e].splice(o,1),i=!0);if(i===!1)throw new Error("Nothing to unbind for "+e)}}br(ze,"ALL_EVENT","__all");function ft(r,e,t){return(e=mf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mf(r){var e=vf(r,"string");return typeof e=="symbol"?e:e+""}function vf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class ui extends ze{constructor(e,t,n){super(),ft(this,"width",void 0),ft(this,"height",void 0),ft(this,"title",void 0),ft(this,"parent",void 0),ft(this,"layoutManager",void 0),ft(this,"tab",void 0),ft(this,"_config",void 0),ft(this,"isHidden",!1),ft(this,"beforeCloseHandler",void 0),ft(this,"_element",M(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),ft(this,"_contentElement",void 0),this.title=ll(e)?e.componentName:"",this.parent=t,this.layoutManager=n,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 n,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=((n=this[d])!==null&&n!==void 0?n:0)*(1/(((i=s.config[d])!==null&&i!==void 0?i:0)/100)),v=h/c*100,f=(((o=s.config[d])!==null&&o!==void 0?o:0)-v)/(a.contentItems.length-1),p=0;p<a.contentItems.length;p++)if(a.contentItems[p]===s)a.contentItems[p].config[d]=v;else{var g;a.contentItems[p].config[d]=((g=a.contentItems[p].config[d])!==null&&g!==void 0?g:0)+f}return a.callDownwards("setSize"),!0}close(e){var t,n;this._config.isClosable&&(!((t=(n=this.beforeCloseHandler)===null||n===void 0?void 0:n.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 n=this._contentElement[0],i=n.offsetWidth-n.clientWidth,o=n.offsetHeight-n.clientHeight;this._contentElement.width(this.width-i).height(this.height-o),this.emit("resize")}}}const ff=Object.freeze(Object.defineProperty({__proto__:null,Container:ui,ItemContainer:ui},Symbol.toStringTag,{value:"Module"}));function ul(r){var e=location.hash.match(new RegExp(r+"=([^&]*)"));return e?e[1]:null}function hl(r){if(window.location.hash)return ul(r);if(!window.location.search)return null;var e=window.location.search.substr(1).split("&"),t={},n,i;for(i=0;i<e.length;i++)n=e[i].split("="),t[n[0]]=n[1];return t[r]||null}function xi(r){return window.requestAnimationFrame(r)}function pf(r,e){var t=e.indexOf(r);if(t===-1)throw new Error("Can't remove item from array. Item is not in the array");e.splice(t,1)}function Pr(){return Et()}function gf(r,e){var t=r.replace(/javascript/gi,"javascript").replace(/expression/gi,"expression").replace(/onload/gi,"onload").replace(/script/gi,"script").replace(/onerror/gi,"onerror");return e===!0?t:t.replace(/>/g,">").replace(/</g,"<")}function Ii(r){return M.trim(r.replace(/(<([^>]+)>)/gi,""))}function et(r,e,t){return(e=bf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bf(r){var e=yf(r,"string");return typeof e=="symbol"?e:e+""}function yf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Qn extends ze{constructor(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super(),et(this,"_eElement",void 0),et(this,"_oDocument",void 0),et(this,"_eBody",void 0),et(this,"_destroyAfterMouseUp",void 0),et(this,"_nDelay",400),et(this,"_timeout",void 0),et(this,"timeout",void 0),et(this,"_nDistance",10),et(this,"_nX",0),et(this,"_nY",0),et(this,"_nOriginalX",0),et(this,"_nOriginalY",0),et(this,"_bDragging",!1),this._eElement=e,this._oDocument=M(document),this._eBody=M(document.body),this._destroyAfterMouseUp=n,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,n,i,o,a=this._getCoordinates(e);this._nOriginalX=(t=a.x)!==null&&t!==void 0?t:0,this._nOriginalY=(n=a.y)!==null&&n!==void 0?n: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,n;e.preventDefault();var i=this._getCoordinates(e);this._nX=((t=i.x)!==null&&t!==void 0?t:0)-this._nOriginalX,this._nY=((n=i.y)!==null&&n!==void 0?n: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,n,i,o,a;if(clearTimeout(this._timeout),(t=this._oDocument)===null||t===void 0||t.unbind("mousemove",this.onMouseMove),(n=this._oDocument)===null||n===void 0||n.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,n,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"),(n=this._oDocument)===null||n===void 0||(i=n.find("iframe"))===null||i===void 0||i.css("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)}_getCoordinates(e){var t,n;return{x:(t=e.pageX)!==null&&t!==void 0?t:0,y:(n=e.pageY)!==null&&n!==void 0?n:0}}}function pn(r,e,t){return(e=Cf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Cf(r){var e=Sf(r,"string");return typeof e=="symbol"?e:e+""}function Sf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class cl{constructor(e,t){pn(this,"_container",void 0),pn(this,"_reactComponent",null),pn(this,"_portalComponent",null),pn(this,"_originalComponentWillUpdate",null),pn(this,"_initialState",void 0),pn(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=Dr.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 n;this._container.setState(t),(n=this._originalComponentWillUpdate)===null||n===void 0||n.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 R.createElement(this._reactClass,t)}}var Tr=["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"],wf=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function Di(r){if(Tr.length>36)throw new Error("Too many keys in config minifier map");var e={};return ki(r,e,"_min"),e}function hi(r){if(Tr.length>36)throw new Error("Too many keys in config minifier map");var e={};return ki(r,e,"_max"),e}function ki(r,e,t){var n=t==="_min"?Ef:_f;for(var i in r)if(r.hasOwnProperty(i)){var o=Array.isArray(r)?r[Number.parseInt(i,10)]:r[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=n(i,Tr);e[s]=a}ki(o,a,t)}else{var l=n(o,wf);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var d=n(i,Tr);e[d]=l}}}}function Ef(r,e){if(typeof r=="string"&&r.length===1)return"___"+r;var t=e.indexOf(r);return t===-1?r:t.toString(36)}function _f(r,e){return typeof r=="string"&&r.length===1?e[parseInt(r,36)]:typeof r=="string"&&r.substr(0,3)==="___"?r[3]:r}function Yr(r,e,t){return(e=Pf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Pf(r){var e=Tf(r,"string");return typeof e=="symbol"?e:e+""}function Tf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class ci{constructor(e,t){Yr(this,"name",void 0),Yr(this,"origin",void 0),Yr(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function sr(r,e,t){return(e=Of(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Of(r){var e=xf(r,"string");return typeof e=="symbol"?e:e+""}function xf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}let ml=class extends ze{constructor(e){super(),sr(this,"_layoutManager",void 0),sr(this,"_dontPropagateToParent",void 0),sr(this,"_childEventSource",void 0),sr(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(ze.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),n=0;n<e;n++)t[n]=arguments[n];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,n="gl_child_event",i=(t=window.opener)===null||t===void 0?void 0:t.document.createEvent("HTMLEvents");i.initEvent(n,!0,!0),i.eventName=n,i.__glArgs=e,i.__gl=this._layoutManager,window.opener.dispatchEvent(i)}_propagateToChildren(e){for(var t=0;t<this._layoutManager.openPopouts.length;t++){var n=this._layoutManager.openPopouts[t].getGlInstance();n&&n!==this._childEventSource&&n.eventHub._$onEventFromParent(e)}}destroy(){M(window).off("gl_child_event",this._boundOnEventFromChild)}};function vl(r,e,t){return r.on(e,t),()=>{r.off(e,t)}}function fl(r){return(e,t)=>vl(e,r,t)}function pl(r){return function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];e.emit(r,...n)}}function gl(r){return(e,t)=>{var n=m.useRef(null),i=m.useRef(()=>!1);if(n.current!=e||i.current!=t){var o;(o=n.current)===null||o===void 0||o.off(r,i.current),e==null||e.on(r,t)}n.current=e,i.current=t,m.useEffect(()=>()=>{var a;return(a=n.current)===null||a===void 0?void 0:a.off(r,i.current)},[])}}function Qt(r){return{listen:fl(r),emit:pl(r),useListener:gl(r)}}const If=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:ci,DragListener:Qn,EventEmitter:ze,EventHub:ml,ReactComponentHandler:cl,animFrame:xi,filterXss:gf,getHashValue:ul,getQueryStringParam:hl,getUniqueId:Pr,listenForEvent:vl,makeEmitFunction:pl,makeEventFunctions:Qt,makeListenFunction:fl,makeUseListenerFunction:gl,minifyConfig:Di,removeFromArray:pf,stripTags:Ii,unminifyConfig:hi},Symbol.toStringTag,{value:"Module"}));function Rt(r,e,t){return(e=Df(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Df(r){var e=kf(r,"string");return typeof e=="symbol"?e:e+""}function kf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class bl extends ze{constructor(e,t,n,i,o){super(),Rt(this,"isInitialised",!1),Rt(this,"_config",void 0),Rt(this,"_dimensions",void 0),Rt(this,"_parentId",void 0),Rt(this,"_indexInParent",void 0),Rt(this,"_layoutManager",void 0),Rt(this,"_popoutWindow",null),Rt(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=n,this._indexInParent=i,this._layoutManager=o,this._createWindow()}toConfig(){var e,t,n,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:(n=(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&&n!==void 0?n: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,n=null;if(this._parentId){var i;if(t=M.extend(!0,{},(i=this.getGlInstance())===null||i===void 0?void 0:i.toConfig()).content[0],n=this._layoutManager.root.getItemsById(this._parentId)[0],!n){var o;((o=this._layoutManager.root.contentItems.length)!==null&&o!==void 0?o:0)>0?n=this._layoutManager.root.contentItems[0]:n=this._layoutManager.root}}t&&((e=n)===null||e===void 0||e.addChild(t,this._indexInParent),this.close())}_createWindow(){var e=this._createUrl(),t=Math.floor(Math.random()*1e6).toString(36),n=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,n),!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=[],n;for(n in e)t.push(n+"="+e[n]);return t.join(",")}_createUrl(){var e={content:this._config},t="gl-window-config-"+Pr();e=Di(e);try{localStorage.setItem(t,JSON.stringify(e))}catch(i){throw new Error("Error while writing to localStorage "+i.toString())}var n=document.location.href.split("?");return n.length===1?n[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 Oe(r,e,t){return(e=Mf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Mf(r){var e=Nf(r,"string");return typeof e=="symbol"?e:e+""}function Nf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class vn extends ze{constructor(e,t,n,i,o,a){var s,l,d,h,c,v,f,p;if(super(),Oe(this,"_dragListener",void 0),Oe(this,"_layoutManager",void 0),Oe(this,"_contentItem",void 0),Oe(this,"_originalParent",void 0),Oe(this,"_area",null),Oe(this,"_lastValidArea",null),Oe(this,"_minX",void 0),Oe(this,"_maxX",void 0),Oe(this,"_minY",void 0),Oe(this,"_maxY",void 0),Oe(this,"_width",void 0),Oe(this,"_height",void 0),Oe(this,"_sided",void 0),Oe(this,"element",void 0),Oe(this,"childElementContainer",void 0),Oe(this,"_proxyTab",void 0),this._dragListener=n,this._layoutManager=i,this._contentItem=o,this._originalParent=a,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var g,b;this._layoutManager.tabDropPlaceholder.width((g=this._contentItem.tab.element.outerWidth(!0))!==null&&g!==void 0?g:0),this._layoutManager.tabDropPlaceholder.height((b=this._contentItem.tab.element.outerHeight(!0))!==null&&b!==void 0?b:0)}if(this.element=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",Ii((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 E,x;this._layoutManager.tabDropPlaceholder.width((E=this._proxyTab.outerWidth(!0))!==null&&E!==void 0?E:0),this._layoutManager.tabDropPlaceholder.height((x=this._proxyTab.outerHeight(!0))!==null&&x!==void 0?x:0)}var P=this._layoutManager.container.offset();this._minX=(d=P==null?void 0:P.left)!==null&&d!==void 0?d:0,this._minY=(h=P==null?void 0:P.top)!==null&&h!==void 0?h:0,this._maxX=((c=this._layoutManager.container.width())!==null&&c!==void 0?c:0)+this._minX,this._maxY=((v=this._layoutManager.container.height())!==null&&v!==void 0?v:0)+this._minY,this._width=(f=this.element.width())!==null&&f!==void 0?f: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,n){var i,o,a=(i=n.pageX)!==null&&i!==void 0?i:0,s=(o=n.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,n=e.dragProxyHeight;this.element.width(t),this.element.height(n),t-=this._sided?e.headerHeight:0,n-=this._sided?0:e.headerHeight,this.childElementContainer.width(t),this.childElementContainer.height(n),this._contentItem.element.width(t),this._contentItem.element.height(n),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}Oe(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 lr(r,e,t){return(e=jf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jf(r){var e=Af(r,"string");return typeof e=="symbol"?e:e+""}function Af(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class yl{constructor(e,t,n){lr(this,"_element",void 0),lr(this,"_itemConfig",void 0),lr(this,"_layoutManager",void 0),lr(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=n,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new Qn(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this),this._dragListener}_onDragStart(e,t){var n=this._itemConfig;typeof n=="function"&&(n=n());var i=this._layoutManager._$normalizeContentItem(M.extend(!0,{},n));new vn(e,t,this._dragListener,this._layoutManager,i,null)}}function dr(r,e,t){return(e=Lf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Lf(r){var e=Rf(r,"string");return typeof e=="symbol"?e:e+""}function Rf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Cl{constructor(e,t,n){dr(this,"_element",M(window)),dr(this,"_itemConfig",void 0),dr(this,"_layoutManager",void 0),dr(this,"_dragListener",void 0),this._itemConfig=e,this._layoutManager=t,this._createDragListener(n)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&(this._dragListener=new Qn(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 n=this._itemConfig;typeof n=="function"&&(n=n());var i=this._layoutManager._$normalizeContentItem(M.extend(!0,{},n));new vn(e,t,this._dragListener,this._layoutManager,i,null)}}}function Sl(r,e,t){return(e=Ff(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ff(r){var e=$f(r,"string");return typeof e=="symbol"?e:e+""}function $f(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Jn{constructor(){Sl(this,"element",M(Jn._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(Jn,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function Qr(r,e,t){return(e=Hf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Hf(r){var e=Bf(r,"string");return typeof e=="symbol"?e:e+""}function Bf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class $n{constructor(e,t,n,i){Qr(this,"element",void 0),Qr(this,"_header",void 0),Qr(this,"_action",void 0),this._header=e,this.element=M('<li class="'+n+'" 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 Wf(r,e,t){return(e=Uf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Uf(r){var e=Vf(r,"string");return typeof e=="symbol"?e:e+""}function Vf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class on extends Error{constructor(e,t){super(),Wf(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const Kf=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:on},Symbol.toStringTag,{value:"Module"}));function Pe(r,e,t){return(e=zf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zf(r){var e=Gf(r,"string");return typeof e=="symbol"?e:e+""}function Gf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function an(r){return r.isStack}function Qe(r){return r.isComponent}function wl(r){return r.isRoot}class ke extends ze{constructor(e,t,n,i){super(),Pe(this,"config",void 0),Pe(this,"type",void 0),Pe(this,"contentItems",void 0),Pe(this,"parent",void 0),Pe(this,"layoutManager",void 0),Pe(this,"element",void 0),Pe(this,"childElementContainer",void 0),Pe(this,"componentName",void 0),Pe(this,"isInitialised",!1),Pe(this,"isMaximised",!1),Pe(this,"isRoot",!1),Pe(this,"isRow",!1),Pe(this,"isColumn",!1),Pe(this,"isStack",!1),Pe(this,"isComponent",!1),Pe(this,"tab",void 0),Pe(this,"_pendingEventPropagations",void 0),Pe(this,"_throttledEvents",void 0),this.element=i,this.config=this._extendItemNode(t),this.type=t.type,this.contentItems=[],this.parent=n,this.layoutManager=e,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(ze.ALL_EVENT,this._propagateEvent,this),t.content&&this._createContentItems(t)}callDownwards(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;n!==!0&&i!==!0&&this[e].apply(this,t);for(var o=0;o<this.contentItems.length;o++)this.contentItems[o].callDownwards(e,t,n);n===!0&&i!==!0&&this[e].apply(this,t)}removeChild(e){var t,n=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(n!==!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 n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;t=this.layoutManager._$normalizeContentItem(t);var i=this.contentItems.indexOf(e),o=e.element[0].parentNode;if(i===-1)throw new Error("Can't replace child. oldChild is not child of this");o==null||o.replaceChild(t.element[0],e.element[0]),n===!0&&(e.parent=null,e._$destroy()),this.contentItems[i]=t,t.parent=this,an(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=[],n=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 n(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),n=[],i=0;i<t.length;i++)n.push(t[i].instance);return n}_$getItemsByProperty(e,t){return this.getItemsByFilter(function(n){return n[e]===t})}_$setParent(e){this.parent=e}_$highlightDropZone(e,t,n){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(n)}_$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"),n=null,i=0;i<t.length;i++)n=t[i].getActiveContentItem(),n&&Qe(n)&&n.container[e]()}_$destroy(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")}_$getArea(e){var t,n,i;e=e||this.element;var o=(t=e.offset())!==null&&t!==void 0?t:{left:0,top:0},a=(n=e.width())!==null&&n!==void 0?n: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 ci(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new on("content must be an Array",e);for(var n=0;n<e.content.length;n++)t=this.layoutManager.createContentItem(e.content[n],this),this.contentItems.push(t)}_extendItemNode(e){for(var[t,n]of Object.entries(dl)){var i=t;e[i]===void 0&&(e[i]=n)}return e}_propagateEvent(e,t){t instanceof ci&&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,xi(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function Nn(r,e,t){return(e=qf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function qf(r){var e=Xf(r,"string");return typeof e=="symbol"?e:e+""}function Xf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class El extends ke{constructor(e,t,n){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,n,M()),Nn(this,"config",void 0),Nn(this,"componentName",void 0),Nn(this,"container",void 0),Nn(this,"parent",void 0),Nn(this,"instance",void 0),this.config=t,this.parent=n;var o=e.getComponent(this.config.componentName)||e.getFallbackComponent(),a=M.extend(!0,{},this.config.componentState||{});if(o==null)throw new on('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 ui(this.config,this,e),this.instance=new o(this.container,a),this.element=this.container._element}close(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}setSize(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())}_$init(){ke.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),ke.prototype._$hide.call(this)}_$show(e){this.container.show(),(this.container._config.isFocusOnShow||e)&&this.container._contentElement[0].focus({preventScroll:!0}),ke.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),ke.prototype._$destroy.call(this)}_$getArea(){return null}}function ut(r,e,t){return(e=Zf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Zf(r){var e=Yf(r,"string");return typeof e=="symbol"?e:e+""}function Yf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class zn extends ke{constructor(e,t,n,i){super(t,n,i,M('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),ut(this,"isRow",void 0),ut(this,"isColumn",void 0),ut(this,"childElementContainer",void 0),ut(this,"parent",void 0),ut(this,"_splitter",[]),ut(this,"_splitterSize",void 0),ut(this,"_splitterGrabSize",void 0),ut(this,"_isColumn",void 0),ut(this,"_dimension",void 0),ut(this,"_splitterPosition",null),ut(this,"_splitterMinPosition",null),ut(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,n){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),ke.prototype.addChild.call(this,e,t),i=1/this.contentItems.length*100,n===!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 n,i=(n=e.config[this._dimension])!==null&&n!==void 0?n: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)}if(ke.prototype.removeChild.call(this,e,t),this.contentItems.length===1&&this.config.isClosable===!0){var h;l=this.contentItems[0],this.contentItems=[],(h=this.parent)===null||h===void 0||h.replaceChild(this,l,!0)}else this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}replaceChild(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=e.config[this._dimension];t.config[this._dimension]=i,super.replaceChild(e,t,n),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(ke.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,n=(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-=n:i-=n;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 v=Math.floor((this._isColumn?o:i)-a);return{itemSizes:s,additionalPixel:v,totalWidth:i,totalHeight:o}}_calculateRelativeSizes(){for(var e=0,t=[],n=this._isColumn?"height":"width",i=0;i<this.contentItems.length;i++){var o=this.contentItems[i].config[n];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[n]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var s=0;s<t.length;s++)t[s].config[n]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var d;this.contentItems[l].config[n]=((d=this.contentItems[l].config[n])!==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,n=[],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},n.push(l)),s.push(l)}if(!(o===0||o>i)){var v=o/i;a=o;for(var f=0;f<n.length;f++){l=n[f];var p=Math.round((l.width-t)*v);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,n=0,i=0;i<e.length;++i){var o,a;t=Math.max((o=e[i].minWidth)!==null&&o!==void 0?o:0,t),n=Math.max((a=e[i].minHeight)!==null&&a!==void 0?a:0,n)}return{horizontal:t,vertical:n}}_onSplitterDragStart(e){var t,n,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((n=a.after.config.content)!==null&&n!==void 0?n:[]),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,n){var i=this._isColumn?n: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,n,i,o,a,s=this._getItemsForSplitter(e),l=(t=s.before.element[this._dimension]())!==null&&t!==void 0?t:0,d=(n=s.after.element[this._dimension]())!==null&&n!==void 0?n: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}),xi(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function oa(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function aa(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?oa(Object(t),!0).forEach(function(n){mi(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):oa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function mi(r,e,t){return(e=Qf(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Qf(r){var e=Jf(r,"string");return typeof e=="symbol"?e:e+""}function Jf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class vi extends ke{constructor(e,t,n){super(e,aa(aa({},t),{},{type:"root"}),null,M('<div class="lm_goldenlayout lm_item lm_root"></div>')),mi(this,"childElementContainer",void 0),mi(this,"_containerElement",void 0),this.isRoot=!0,this.type="root",this.childElementContainer=this.element,this._containerElement=n,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 n,i;e=typeof e>"u"?(n=this._containerElement.width())!==null&&n!==void 0?n: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,n){this.layoutManager.tabDropPlaceholder.remove(),super._$highlightDropZone(e,t,n)}_$onDrop(e,t){var n;if(Qe(e)&&(n=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this),n._$init(),n.addChild(e),e=n),!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 zn)||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 sa(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function gn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?sa(Object(t),!0).forEach(function(n){tt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):sa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function tt(r,e,t){return(e=ep(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ep(r){var e=tp(r,"string");return typeof e=="symbol"?e:e+""}function tp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class fi extends ke{constructor(e,t,n){var i,o,a,s,l,d,h,c,v;super(e,t,n,M('<div class="lm_item lm_stack"></div>')),tt(this,"_activeContentItem",null),tt(this,"_header",void 0),tt(this,"childElementContainer",M('<div class="lm_items"></div>')),tt(this,"header",void 0),tt(this,"parent",void 0),tt(this,"isStack",!0),tt(this,"_dropSegment",null),tt(this,"_contentAreaDimensions",null),tt(this,"_dropIndex",void 0),tt(this,"_side",void 0),tt(this,"_sided",!1),tt(this,"config",void 0),this.parent=n,this.config=t;var f=e.config;this._side=!1,this._header={show:((i=f.settings)===null||i===void 0?void 0:i.hasHeaders)&&t.hasHeaders!==!1,popout:(o=f.settings)!==null&&o!==void 0&&o.showPopoutIcon?(a=f.labels)===null||a===void 0?void 0:a.popout:void 0,maximise:(s=f.settings)!==null&&s!==void 0&&s.showMaximiseIcon?(l=f.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(d=f.settings)!==null&&d!==void 0&&d.showCloseIcon?(h=f.labels)===null||h===void 0?void 0:h.close:void 0,minimise:(c=(v=f.labels)===null||v===void 0?void 0:v.minimise)!==null&&c!==void 0?c:void 0},f.header&&(this._header=gn(gn({},this._header),f.header)),t.header&&(this._header=gn(gn({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=gn(gn({},this._header),t.content[0].header)),this.header=new jt(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,n,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=((n=this.element.width())!==null&&n!==void 0?n:0)-(this._sided?a:0),l=((i=this.element.height())!==null&&i!==void 0?i:0)-(this._sided?0:a);for(this.childElementContainer.width(s),this.childElementContainer.height(l),o=0;o<this.contentItems.length;o++)this.contentItems[o].element.width(s).height(l);this.emit("resize"),this.emitBubblingEvent("stateChanged")}_$init(){if(this.isInitialised!==!0){this.header._attachWheelListener(),super._$init();for(var e=0;e<this.contentItems.length;e++)this.header.createTab(this.contentItems[e]),this.contentItems[e]._$hide();if(this.contentItems.length>0){var t=this.contentItems[this.config.activeItemIndex||0];if(!t)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(t)}}}setActiveContentItem(e,t){if(this.contentItems.indexOf(e)===-1)throw new Error("contentItem is not a child of this stack");this._activeContentItem!==null&&this._activeContentItem._$hide(),this._activeContentItem=e,this.header.setActiveContentItem(e),Qe(e)?e._$show(t):e._$show(),this.emit("activeContentItemChanged",e),this.layoutManager.emit("activeContentItemChanged",e),this.emitBubblingEvent("stateChanged")}getActiveContentItem(){return this.header.activeContentItem}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),super.addChild(e,t),this.childElementContainer.append(e.element),this.header.createTab(e,t),this.setActiveContentItem(e),this.callDownwards("setSize"),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}removeChild(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=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(n-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}_$validateClosability(){for(var e=this.header._isClosable(),t=0,n=this.contentItems.length;t<n;t++){var i;if(!e)break;e=(i=this.contentItems[t].config.isClosable)!==null&&i!==void 0?i:!1}this.header._$setClosable(e)}_$destroy(){ke.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",n=this._dropSegment==="left"||this._dropSegment==="right",i=this._dropSegment==="top"||this._dropSegment==="left",o=this.parent instanceof zn&&(t&&this.parent.isColumn||n&&this.parent.isRow),a=t?"column":"row",s=t?"height":"width";if(Qe(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,v=this.layoutManager.createContentItem({type:a},this);(c=this.parent)===null||c===void 0||c.replaceChild(this,v),v.addChild(e,i?0:void 0,!0),v.addChild(this,i?void 0:0,!0),this.config[s]=50,e.config[s]=50,v.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[n,i]of Object.entries(this._contentAreaDimensions)){var o=i.hoverArea;if(o.x1<e&&o.x2>e&&o.y1<t&&o.y2>t){n==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(n));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 n=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+n*.25,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x1+n*.5,y2:t.y2}},this._contentAreaDimensions.top={hoverArea:{x1:t.x1+n*.25,y1:t.y1,x2:t.x1+n*.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+n*.75,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1+n*.5,y1:t.y1,x2:t.x2,y2:t.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:t.x1+n*.25,y1:t.y1+i*.5,x2:t.x1+n*.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,n,i,o,a,s,l,d,h,c,v,f,p,g,b,E,x=this.header.tabs.length;if(x===0){var P,F,U,ee,j,W,H,ne,oe=this.header.element.offset();(P=this.layoutManager.dropTargetIndicator)===null||P===void 0||P.highlightArea({x1:(F=oe==null?void 0:oe.left)!==null&&F!==void 0?F:0,x2:((U=oe==null?void 0:oe.left)!==null&&U!==void 0?U:0)+100,y1:(ee=(j=this.header.element.offset())===null||j===void 0?void 0:j.top)!==null&&ee!==void 0?ee:0,y2:((W=(H=this.header.element.offset())===null||H===void 0?void 0:H.top)!==null&&W!==void 0?W:0)+((ne=this.header.element.innerHeight())!==null&&ne!==void 0?ne:0)});return}var L=this.header.tabsContainer,X=(t=L.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),z=(n=this.layoutManager.tabDropPlaceholder.get(0))===null||n===void 0?void 0:n.getBoundingClientRect();if(!(!X||!z)){e<X.left?e=X.left+1:e>X.right&&(e=X.right-1);var A,V;if(!(z.left<e&&e<z.right)){for(var G=0;G<x;G++){var pe;if(A=this.header.tabs[G].element,V=(pe=A.get(0))===null||pe===void 0?void 0:pe.getBoundingClientRect(),V&&V.left<e&&e<V.right){this._dropIndex=G;break}}if(A&&V&&e<V.left+V.width*.5)A.before(this.layoutManager.tabDropPlaceholder);else if(A){var Ge;this._dropIndex=Math.min(((Ge=this._dropIndex)!==null&&Ge!==void 0?Ge:0)+1,x),A.after(this.layoutManager.tabDropPlaceholder)}}var je=(i=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&i!==void 0?i:0;je=Math.max(je,(a=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&a!==void 0?a:0);var y=je+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);y=Math.min(y,((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)),(v=this.layoutManager.dropTargetIndicator)===null||v===void 0||v.highlightArea({x1:je,x2:y,y1:(f=(p=this.header.element.offset())===null||p===void 0?void 0:p.top)!==null&&f!==void 0?f:0,y2:((g=(b=this.header.element.offset())===null||b===void 0?void 0:b.top)!==null&&g!==void 0?g:0)+((E=this.header.element.innerHeight())!==null&&E!==void 0?E:0)})}}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){var e=["right","left","bottom"].some(n=>n===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,n,i=(t=this._contentAreaDimensions)===null||t===void 0||(n=t[e])===null||n===void 0?void 0:n.highlightArea;if(i){var o;(o=this.layoutManager.dropTargetIndicator)===null||o===void 0||o.highlightArea(i)}this._dropSegment=e}}const np=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:ke,Component:El,ContentItem:ke,Root:vi,RowOrColumn:zn,Stack:fi,isComponent:Qe,isRoot:wl,isStack:an},Symbol.toStringTag,{value:"Module"}));function Dt(r,e,t){return(e=rp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function rp(r){var e=ip(r,"string");return typeof e=="symbol"?e:e+""}function ip(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class er{constructor(e,t){var n;Dt(this,"header",void 0),Dt(this,"contentItem",void 0),Dt(this,"element",M(er._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,(n=this._layoutManager.config.settings)!==null&&n!==void 0&&n.reorderEnabled&&t.config.reorderEnabled&&(this._dragListener=new Qn(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.element.on("mouseup",this._onMouseUp),this.contentItem.config.isClosable?(this.closeElement.on("click",this._onCloseClick),this.closeElement.on("mousedown",this._onCloseMousedown)):this.closeElement.remove(),this.contentItem.tab=this,this.contentItem.emit("tab",this),this.contentItem.layoutManager.emit("tabCreated",this),Qe(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.element.off("mouseup",this._onMouseUp),this.closeElement.off("click",this._onCloseClick),Qe(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 n;(n=this.contentItem.parent)!==null&&n!==void 0&&n.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(){Qe(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.element.removeClass("lm_focusin")}_onTabClick(e){if(!e||e.button===0){var t,n=this.header.parent.getActiveContentItem();this.contentItem!==n&&Qe(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):Qe(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),Qe(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(),Qe(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onMouseUp(e){e.button===1&&(e.preventDefault(),e.stopPropagation())}_onCloseMousedown(e){e.stopPropagation()}}Dt(er,"_template",['<li class="lm_tab">','<span class="lm_title_before"></span>','<span class="lm_title"></span>','<div class="lm_close_tab" aria-label="Close tab"></div>',"</li>"].join(""));function le(r,e,t){return(e=op(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function op(r){var e=ap(r,"string");return typeof e=="symbol"?e:e+""}function ap(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class jt extends ze{constructor(e,t){var n,i;super(),le(this,"layoutManager",void 0),le(this,"element",M(jt._template)),le(this,"tabsContainer",void 0),le(this,"tabDropdownContainer",void 0),le(this,"tabDropdownSearch",void 0),le(this,"tabDropdownList",null),le(this,"controlsContainer",void 0),le(this,"parent",void 0),le(this,"tabs",[]),le(this,"activeContentItem",null),le(this,"closeButton",null),le(this,"tabDropdownButton",null),le(this,"tabNextButton",M(jt._nextButtonTemplate)),le(this,"tabPreviousButton",M(jt._previousButtonTemplate)),le(this,"holdTimer",null),le(this,"rAF",null),le(this,"CLICK_TIMEOUT",500),le(this,"START_SPEED",.01),le(this,"ACCELERATION",5e-4),le(this,"PADDING",10),le(this,"SCROLL_LEFT","left"),le(this,"SCROLL_RIGHT","right"),le(this,"isDraggingTab",!1),le(this,"isOverflowing",!1),le(this,"isDropdownShown",!1),le(this,"dropdownKeyIndex",0),le(this,"_lastVisibleTabIndex",-1),le(this,"_tabControlOffset",void 0),this.layoutManager=e,(n=this.layoutManager.config.settings)!==null&&n!==void 0&&n.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 n=0;n<this.tabs.length;n++)if(this.tabs[n].contentItem===e)return;var i=new er(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,n,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||(n=t.scrollIntoView)===null||n===void 0||n.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 n=Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX;if(e.deltaMode===WheelEvent.DOM_DELTA_PAGE){var i;n*=(i=this.tabsContainer.innerWidth())!==null&&i!==void 0?i:1}else e.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=100/3);t.scrollLeft+=Math.round(n)}}_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 n,i,o,a,s;if(((n=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&n!==void 0?n: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 n,i,o;if(((n=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&n!==void 0?n: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,n;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)===((n=this.tabsContainer.get(0))===null||n===void 0?void 0:n.scrollWidth)?this.tabNextButton.prop("disabled",!0):(this.tabNextButton.prop("disabled",!1),this.tabPreviousButton.first().prop("disabled",!1))}_handleScrollRepeat(e,t){var n,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((n=this.rAF)!==null&&n!==void 0?n:-1),this.rAF=window.requestAnimationFrame(h=>{var c,v,f=o||h,p=h-f,g=this.START_SPEED*p+.5*this.ACCELERATION*(p*p);g=Math.min(g,(c=(v=this.tabsContainer.get(0))===null||v===void 0?void 0:v.scrollWidth)!==null&&c!==void 0?c:1/0),this._handleScrollRepeat(e,t,g,f)})}}_$setClosable(e){return this.closeButton&&this._isClosable()?(this.closeButton.element[e?"show":"hide"](),!0):!1}_$destroy(){this.emit("destroy",this);for(var e=0;e<this.tabs.length;e++)this.tabs[e]._$destroy();this._detachWheelListener(),this._handleItemDropped(),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,n,i,o;if(o=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new $n(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),n=this._getHeaderSetting("popout"),new $n(this,n,"lm_popout",t)),this._getHeaderSetting("maximise")){i=this.parent.toggleMaximise.bind(this.parent);var a=this._getHeaderSetting("maximise"),s=this._getHeaderSetting("minimise"),l=new $n(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),n=this._getHeaderSetting("close"),this.closeButton=new $n(this,n,"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 n,i;e.preventDefault(),(n=this.tabDropdownList)===null||n===void 0||n.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 n,i;((n=(i=this.tabs[t].contentItem.config.title)===null||i===void 0?void 0:i.toLowerCase().indexOf(e.target.value.toLowerCase()))!==null&&n!==void 0?n:-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,n;this.isDropdownShown&&(e&&(t=this.tabDropdownContainer.get(0))!==null&&t!==void 0&&t.contains(e.target)||e&&((n=this.tabDropdownButton)===null||n===void 0?void 0:n.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,n,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=(n=M(window).height())!==null&&n!==void 0?n: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,v=Math.min(d.left+(c?d.width:0),l-a.width-this.PADDING),f=c?Math.max(d.top-o,this.PADDING):d.bottom,p=s-f-this.PADDING;this.tabDropdownContainer.css({"max-height":p,top:f,left:v})}}}}_isClosable(){return!!(this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon)}_onPopoutClick(){if(this.layoutManager.config.settings.popoutWholeStack===!0)this.parent.popout();else{var e;(e=this.activeContentItem)===null||e===void 0||e.popout()}}_onHeaderClick(e){e.target===this.element[0]&&this.parent.select()}_updateTabSizes(){if(this.tabs.length!==0){var e=this.tabsContainer.get(0);if(this.isDropdownShown&&this._updateAdditionalTabsDropdown(),!!e){if(!this.isOverflowing&&e.scrollWidth>e.clientWidth){var t;(t=this.tabDropdownButton)===null||t===void 0||t.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0}else if(this.isOverflowing&&e.scrollWidth<=e.clientWidth){var n;(n=this.tabDropdownButton)===null||n===void 0||n.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1}this.isOverflowing&&this._checkScrollArrows()}}}}le(jt,"_template",['<div class="lm_header">','<ul class="lm_tabs"></ul>','<ul class="lm_controls"></ul>','<ul class="lm_tabdropdown_list">','<li class="lm_tabdropdown_search"><input type="text" placeholder="Find tab..."></li>',"</ul>","</div>"].join(""));le(jt,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));le(jt,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function jn(r,e,t){return(e=sp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sp(r){var e=lp(r,"string");return typeof e=="symbol"?e:e+""}function lp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class _l{constructor(e,t,n){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=n<t?t:n,this.element=this._createElement(),this._dragListener=new Qn(this.element)}on(e,t,n){var i;(i=this._dragListener)===null||i===void 0||i.on(e,t,n)}_$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 n=this._grabSize-this._size,i=n/2;return this._isVertical?(e.css("top",-i),e.css("height",this._size+n),t.addClass("lm_vertical"),t.height(this._size)):(e.css("left",-i),e.css("width",this._size+n),t.addClass("lm_horizontal"),t.width(this._size)),t}}const dp=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:bl,DragProxy:vn,DragSource:yl,DragSourceFromEvent:Cl,DropTargetIndicator:Jn,Header:jt,HeaderButton:$n,Splitter:_l,Tab:er},Symbol.toStringTag,{value:"Module"}));var up={config:uf,container:ff,controls:dp,errors:Kf,items:np,utils:If};function la(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Xe(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?la(Object(t),!0).forEach(function(n){de(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):la(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function de(r,e,t){return(e=hp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function hp(r){var e=cp(r,"string");return typeof e=="symbol"?e:e+""}function cp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var da=["column","row","stack","component"];class Lr extends ze{static isLayoutItemConfig(e){return da.includes(e.type)}static minifyConfig(e){return Di(e)}static unminifyConfig(e){return hi(e)}constructor(e,t){super(),de(this,"isInitialised",!1),de(this,"_isFullPage",!1),de(this,"_resizeTimeoutId",void 0),de(this,"_components",{"lm-react-component":cl}),de(this,"_fallbackComponent",void 0),de(this,"_itemAreas",[]),de(this,"_maximisedItem",null),de(this,"_maximisePlaceholder",M('<div class="lm_maximise_place"></div>')),de(this,"_creationTimeoutPassed",!1),de(this,"_subWindowsCreated",!1),de(this,"_dragSources",[]),de(this,"_updatingColumnsResponsive",!1),de(this,"_firstLoad",!0),de(this,"_reactChildMap",new Map),de(this,"_reactChildren",null),de(this,"_initialHeaderHeight",void 0),de(this,"width",null),de(this,"height",null),de(this,"root",void 0),de(this,"openPopouts",[]),de(this,"selectedItem",null),de(this,"isSubWindow",!1),de(this,"eventHub",new ml(this)),de(this,"config",void 0),de(this,"container",void 0),de(this,"_originalContainer",void 0),de(this,"dropTargetIndicator",null),de(this,"tabDropPlaceholder",M('<div class="lm_drop_tab_placeholder"></div>')),this._onResize=this._onResize.bind(this),this._onUnload=this._onUnload.bind(this),this._windowBlur=this._windowBlur.bind(this),this._windowFocus=this._windowFocus.bind(this),this._windowKeydown=this._windowKeydown.bind(this),this.config=this._createConfig(e),this._originalContainer=t,this.container=this._getContainer(),this._initialHeaderHeight=this.config.dimensions.headerHeight,this.isSubWindow&&M("body").css("visibility","hidden")}registerComponent(e,t){if(typeof t!="function"&&(t==null||t.render==null||typeof t.render!="function"))throw new Error("Please register a constructor function");if(this._components[e]!==void 0)throw new Error("Component "+e+" is already registered");this._components[e]=t;var n=()=>{if(this._components[e]===void 0)throw new Error("Component "+e+" is not registered");delete this._components[e]};return n}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 ke))throw new Error("Root must be a ContentItem");var t={settings:Xe({},this.config.settings),dimensions:Xe({},this.config.dimensions),labels:Xe({},this.config.labels),content:[]},n=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?n(t,{contentItems:[e]}):n(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 Jn,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 n=this._reactChildMap.get(e);n===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 n,i;if(this.width=(n=e??this.container.width())!==null&&n!==void 0?n: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"),M(window).off("keydown",this._windowKeydown),this.root.callDownwards("_$destroy",[],!0),this.root.contentItems=[],this.tabDropPlaceholder.remove(),(e=this.dropTargetIndicator)===null||e===void 0||e.destroy(),this.eventHub.destroy(),this._dragSources.forEach(function(t){t._dragListener.destroy()}),this._dragSources=[])}createContentItem(e,t){var n,i;if(typeof e.type!="string")throw new on("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!Lr.isLayoutItemConfig(e))throw i="Unknown type '"+e.type+"'. Valid types are "+da.join(","),new on(i);return e.type==="component"&&!(t instanceof fi)&&t&&!(this.isSubWindow===!0&&t instanceof vi)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),e.id=(n=e.id)!==null&&n!==void 0?n:Pr(),e.type==="stack"?new fi(this,e,t):e.type==="row"?new zn(!1,this,e,t):e.type==="column"?new zn(!0,this,e,t):new El(this,e,t)}createPopout(e,t,n,i){var o=[],a=e instanceof ke,s=this;if(a){var l;o=this.toConfig(e).content,n=Pr();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(n),i==null||Number.isNaN(i)){var v;i=(v=d)===null||v===void 0?void 0:v.contentItems.indexOf(h)}}else e instanceof Array?o=e:o=[e];if(!t&&a){var f,p,g,b=window.screenX||window.screenLeft,E=window.screenY||window.screenTop,x=(f=e.element.offset())!==null&&f!==void 0?f:{left:0,top:0};t={left:b+x.left,top:E+x.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||!n||i===void 0)){var P=new bl(o,t,n,i,this);return P.on("initialised",function(){s.emit("windowOpened",P)}),P.on("closed",function(){s._$reconcilePopoutWindows()}),this.openPopouts.push(P),P}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var n=new yl(e,t,this);return this._dragSources.push(n),n}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,n;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((n=this.container.height())!==null&&n!==void 0?n: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 n=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&&n>a.surface&&(n=a.surface,i=a)}return i}_$createRootItemAreas(){var e=50,t=Xe({},this.root._$getArea()),n=[Xe(Xe({},t),{},{side:"left",x2:t.x1+e}),Xe(Xe({},t),{},{side:"right",x1:t.x2-e}),Xe(Xe({},t),{},{side:"top",y2:t.y1+e}),Xe(Xe({},t),{},{side:"bottom",y1:t.y2-e})];n.forEach(i=>{i.surface=(i.x2-i.x1)*(i.y2-i.y1)}),this._itemAreas.push(...n)}_$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 n=e[t];if(an(n)){var i=n._$getArea();if(i!==null)if(i instanceof Array)this._itemAreas=this._itemAreas.concat(i);else{var o;this._itemAreas.push(i);var a=Xe(Xe({},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 ke)return e;if(M.isPlainObject(e)&&e.type){var n=this.createContentItem(e,t??null);return n.callDownwards("_$init"),n}else throw new Error("Invalid contentItem")}_$reconcilePopoutWindows(){for(var e=[],t=0;t<this.openPopouts.length;t++){var n;((n=this.openPopouts[t].getWindow())===null||n===void 0?void 0:n.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=n=>{if(e.push(n),n.contentItems instanceof Array)for(var i=0;i<n.contentItems.length;i++)t(n.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).on("keydown",this._windowKeydown)}_windowBlur(){this.root.element.addClass("lm_window_blur")}_windowFocus(){this.root.element.removeClass("lm_window_blur")}_windowKeydown(e){if(e.key==="Escape"&&this._maximisedItem!==null){var t=document.activeElement;if(t&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT"||t.isContentEditable))return;this._maximisedItem.toggleMaximise()}}_onResize(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(this.updateSize.bind(this),100)}_createConfig(e){var t,n=hl("gl-window");n&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(n)||"{}"),e=hi(e),localStorage.removeItem(n)),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=Ii((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 on(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new on(t,e);this.root=new vi(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,n=e*t;if(!(this.width==null||n<=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(n){e.addChild(n),t.removeChild(n,!0)}):t.contentItems.forEach(n=>{this._addChildContentItemsToContainer(e,n)})}_findAllStackContainers(){var e=[];return this._findAllStackContainersRecursive(e,this.root),e}_findAllStackContainersRecursive(e,t){t.contentItems.forEach(n=>{an(n)?e.push(n):n.isComponent||this._findAllStackContainersRecursive(e,n)})}}de(Lr,"__lm",up);const mp="_lm_dragging_k4a5m_1",vp="_lm_goldenlayout_k4a5m_1",fp="_lm_header_k4a5m_1",pp="_lm_controls_k4a5m_1",gp="_lm_tabpreviousbutton_k4a5m_1",bp="_lm_tabnextbutton_k4a5m_1",yp="_lm_tab_k4a5m_1",Cp="_lm_active_k4a5m_1",Sp="_lm_close_tab_k4a5m_1",wp="_lm_content_k4a5m_1",Ep="_lm_dragProxy_k4a5m_1",_p="_lm_dropTargetIndicator_k4a5m_1",Pp="_march_k4a5m_1",Tp="_lm_inner_k4a5m_1",Op="_lm_splitter_k4a5m_1",xp="_lm_selectable_k4a5m_1",Ip="_lm_tabdropdown_list_k4a5m_1",Dp="_lm_title_k4a5m_1",kp="_lm_title_before_k4a5m_1",Mp="_lm_selected_k4a5m_1",Np="_lm_focusin_k4a5m_1",jp="_lm_window_blur_k4a5m_1",Ap="_lm_popout_k4a5m_1",Lp="_lm_maximise_k4a5m_1",Rp="_lm_tabdropdown_k4a5m_1",Fp="_lm_close_k4a5m_1",$p="_lm_tabdropdown_search_k4a5m_1",Hp="_lm_tabs_k4a5m_1",Bp="_lm_keyboard_active_k4a5m_1",Wp="_lm_maximised_k4a5m_1",Up="_lm_items_k4a5m_1",ua={"tab-height":"28px","drag-border-width":"5px",lm_dragging:mp,lm_goldenlayout:vp,lm_header:fp,lm_controls:pp,lm_tabpreviousbutton:gp,lm_tabnextbutton:bp,lm_tab:yp,lm_active:Cp,lm_close_tab:Sp,lm_content:wp,lm_dragProxy:Ep,lm_dropTargetIndicator:_p,march:Pp,lm_inner:Tp,lm_splitter:Op,lm_selectable:xp,lm_tabdropdown_list:Ip,lm_title:Dp,lm_title_before:kp,lm_selected:Mp,lm_focusin:Np,lm_window_blur:jp,lm_popout:Ap,lm_maximise:Lp,lm_tabdropdown:Rp,lm_close:Fp,lm_tabdropdown_search:$p,lm_tabs:Hp,lm_keyboard_active:Bp,lm_maximised:Wp,lm_items:Up},ha=Object.freeze({tabHeight:parseInt(ua["tab-height"],10),dragBorderWidth:parseInt(ua["drag-border-width"],10)});function ca(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function It(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ca(Object(t),!0).forEach(function(n){Pl(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ca(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Pl(r,e,t){return(e=Vp(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Vp(r){var e=Kp(r,"string");return typeof e=="symbol"?e:e+""}function Kp(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ft=K.module("LayoutUtils");function Tl(r){return r.componentName!==void 0}function Cn(r){var e=r;return(Tl(r)&&r.componentName==="lm-react-component"||r.type==="react-component")&&e.component!==void 0}function ur(r){return r.focus!==void 0}function ma(r){return r.type==="stack"}class O{static activateTab(e,t){var n=O.getStackForRoot(e,t,!1);if(!n){Ft.error("Could not find stack for config",t);return}var i=O.getContentItemInStack(n,t);i&&n.setActiveContentItem(i)}static isActiveTab(e,t){var n=O.getStackForRoot(e,t,!1);if(!n)return Ft.error("Could not find stack for config",t),!1;var i=O.getContentItemInStack(n,t),o=n.getActiveContentItem();return o===i}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(wl(e)){var n={type:t?"column":"row"};(e.contentItems==null||e.contentItems.length===0)&&e.addChild(n);var i=e.contentItems[0],o=t?i.isColumn:i.isRow;if(!o){e.removeChild(i,!0),e.addChild(n);var a=document.activeElement;e.contentItems[0].addChild(i),a&&a.focus!=null&&a.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var s=e.contentItems[e.contentItems.length-1],l=t?s.isRow:s.isColumn;if(!l){var d,h,c=e.layoutManager.createContentItem({type:t?"row":"column",height:(d=s.config)===null||d===void 0?void 0:d.height,width:(h=s.config)===null||h===void 0?void 0:h.width},e);e.replaceChild(s,c),e.contentItems[e.contentItems.length-1].addChild(s),s=e.contentItems[e.contentItems.length-1]}return this.addStack(s,!t)}static getAllStackContainers(e){return e._findAllStackContainers()}static getFocusedStackIndex(e){return e.findIndex(t=>t.header.tabs.some(n=>n.element[0].classList.contains("lm_focusin")))}static getFocusedStack(e){var t=O.getAllStackContainers(e),n=O.getFocusedStackIndex(t);return t[n]}static getStackById(e,t){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(i&&an(e)&&e.contentItems.length===0)return e;if(t===((n=e.config)===null||n===void 0?void 0:n.id)){if(an(e))return e;throw new Error("Item with ID ".concat(t," is not a stack"))}if(e.contentItems==null)return null;for(var o=0;o<e.contentItems.length;o+=1){var a=this.getStackById(e.contentItems[o],t,i);if(a)return a}return null}static getContentItemById(e,t){var n;if(((n=e.config)===null||n===void 0?void 0:n.id)===t)return e;if(e.contentItems==null)return null;for(var i=0;i<e.contentItems.length;i+=1){var o=this.getContentItemById(e.contentItems[i],t);if(o)return o}return null}static getStackForConfig(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(n&&an(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&&Bi(o.config,t))return e;var a=this.getStackForConfig(o,t,n);if(a)return a}return null}static getStackForRoot(e,t){var n=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&&n&&(a=this.addStack(e)),a}static getStackForComponentTypes(e,t){for(var n=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=O.getStackForRoot(e,{component:s},n&&l,i,o);if(d)return d}return null}static getContentItemInStack(e,t){if(!e)return null;for(var n=0;n<e.contentItems.length;n+=1){var i=e.contentItems[n];if(i.isComponent&&i.config!=null&&Bi(i.config,t))return i}return null}static dehydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var n=[],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?n.push(l):Ft.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(a,'"'))}else if(s){var d=It(It({},o),{},{content:O.dehydrateLayoutConfig(s,t)});n.push(d)}else n.push(o)}return n}static getTabPoint(e){var{tab:t}=e;if(t==null)throw new Error("Cannot get tab for panel container ".concat(e));var n=t.element[0].getBoundingClientRect();return[n.left+n.width*.5,n.bottom-8]}static dropLayoutMinorChange(e){for(var t=0;t<e.length;t+=1){var n=e[t],{content:i}=n;i!==void 0?(ma(n)&&delete n.activeItemIndex,O.dropLayoutMinorChange(i)):Cn(n)&&n.component==="IrisGridPanel"&&n.props.panelState!=null&&(delete n.id,n.props.panelState.irisGridState.sorts=[],n.props.panelState.irisGridState.quickFilters=[],n.props.panelState.gridState.isStuckToBottom=!1,n.props.panelState.gridState.isStuckToRight=!1)}}static isEqual(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=O.cloneLayout(e),o=O.cloneLayout(t);return n?(O.dropLayoutMinorChange(i),O.dropLayoutMinorChange(o),Vn(i,o)):Vn(i,o)}static cloneLayout(e){return JSON.parse(JSON.stringify(e))}static hydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var n=[],i=0;i<e.length;i+=1){var o=e[i];if(Cn(o)){var a,{component:s,props:l={}}=o;n.push(It(It({},o),{},{id:(a=o==null?void 0:o.id)!==null&&a!==void 0?a:Et(),props:t(s,l)}))}else if(o.content!==void 0){var d=O.hydrateLayoutConfig(o.content,t);ma(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=d.length&&(Ft.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),n.push(It(It({},o),{},{content:d}))}else n.push(o)}return n}static openComponent(){var{root:e,config:t,stack:n=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=Et()),l!=null){e==null||e.layoutManager.createDragSourceFromEvent(h,l);return}var c=o||{id:h.id,component:h.component};$(e);var v=n??(a?O.addStack(e):O.getStackForRoot(e,c));$(v);var f=O.getContentItemInStack(v,c);if(s!=null){var p=b=>{Ft.debug("Component created, focusing element",s),v.off("componentCreated",p);var{element:E}=b.origin;requestAnimationFrame(()=>{O.focusElement(E[0],s)})};v.on("componentCreated",p)}if(i&&f){var g=v.contentItems.indexOf(f);v.addChild(h,g+1),v.removeChild(f),v.setActiveContentItem(v.contentItems[g])}else v.addChild(h);s==null&&d&&ur(d)&&d.focus()}static openComponentInStack(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=document.activeElement,o={id:t.id},a=O.getContentItemInStack(e,o);if(n&&a&&e){var s=e==null?void 0:e.contentItems.indexOf(a);e.addChild(t,s+1),e.removeChild(a),e.setActiveContentItem(e.contentItems[s])}else e==null||e.addChild(t);i&&ur(i)&&i.focus()}static closeComponent(e,t,n){var i=O.getStackForRoot(e,t,!1,!1,!1);if(!i){Ft.warn("Cannot find stack for component, ignoring close",t);return}var o=O.getContentItemInStack(i,t),a=document.activeElement;o&&(Qe(o)?o.container.close(n):i.removeChild(o)),a&&document.contains(a)&&ur(a)&&a.focus()}static renameComponent(e,t,n){var i=O.getStackForRoot(e,t,!1);if(!i){Ft.error("Could not find stack for config",t);return}var o=O.getContentItemInStack(i,t);o&&o.setTitle(n)}static cloneComponent(e,t){var n=O.getStackForRoot(e,t,!1);if(!n)return Ft.error("Could not find stack for config",t),null;var{props:i={}}=t,o=O.getPanelComponentState(t),a={type:"react-component",component:t.component,props:It(It({},i),{},{panelState:o}),title:"".concat(t.title," Copy"),id:Et()};return O.openComponentInStack(n,a),a}static getPanelComponentState(e){if(Tl(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(Cn(e)){var n;return(n=e.props)===null||n===void 0?void 0:n.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=O.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return O.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,n=O.getComponentConfigFromContainer(t);if(n&&Cn(n)){var i;return(i=n.component)!==null&&i!==void 0?i:null}return null}static getComponentName(e){var t,n,i=(t=(n=e.WrappedComponent)===null||n===void 0?void 0:n.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]:O.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var n=e.querySelector(t);return n==null?null:(ur(n)&&n.focus(),n)}static onInitialized(e){return new Promise(t=>{if(e.isInitialised){t();return}var n=()=>{e.off("initialised",n),t()};e.on("initialised",n)})}}Pl(O,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var zp=R.forwardRef((r,e)=>{var t=O.getComponentNameFromPanel({props:r});return u.jsx("div",{ref:e,className:"panel-placeholder",children:u.jsxs("div",{children:['Component "',t,'" is not registered.']})})});zp.displayName="PanelPlaceholder";var ae=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"}),{listen:bC,emit:Gp,useListener:yC}=Qt(ae.OPEN),Rr=Object.freeze({CYCLE_TO_NEXT_STACK:"NavigationEvent.CYCLE_TO_NEXT_STACK",CYCLE_TO_PREVIOUS_STACK:"NavigationEvent.CYCLE_TO_PREVIOUS_STACK",CYCLE_TO_NEXT_TAB:"NavigationEvent.CYCLE_TO_NEXT_TAB",CYCLE_TO_PREVIOUS_TAB:"NavigationEvent.CYCLE_TO_PREVIOUS_TAB"}),{listen:qp,emit:CC,useListener:SC}=Qt(Rr.CYCLE_TO_NEXT_STACK),{listen:Xp,emit:wC,useListener:EC}=Qt(Rr.CYCLE_TO_PREVIOUS_STACK),{listen:Zp,emit:_C,useListener:PC}=Qt(Rr.CYCLE_TO_NEXT_TAB),{listen:Yp,emit:TC,useListener:OC}=Qt(Rr.CYCLE_TO_PREVIOUS_TAB);function Qp(r){return typeof r.id=="string"&&r.layout instanceof Lr&&r.panelManager instanceof Mi&&typeof r.registerComponent=="function"}function Jp(r){if(!Qp(r))throw new Error("Expected dashboard plugin props, but instead received ".concat(r))}function va(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function fa(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?va(Object(t),!0).forEach(function(n){Mt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):va(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Mt(r,e,t){return(e=eg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function eg(r){var e=tg(r,"string");return typeof e=="symbol"?e:e+""}function tg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ht=K.module("PanelManager"),Wt;(function(r){r[r.Next=0]="Next",r[r.Previous=1]="Previous"})(Wt||(Wt={}));class Mi{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(s,l)=>l,n=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]:()=>{};Mt(this,"layout",void 0),Mt(this,"hydrateComponent",void 0),Mt(this,"dehydrateComponent",void 0),Mt(this,"onPanelsUpdated",void 0),Mt(this,"closed",void 0),Mt(this,"openedMap",void 0),Mt(this,"navigationEventListenerRemovers",void 0),this.handleFocus=this.handleFocus.bind(this),this.handleMount=this.handleMount.bind(this),this.handleUnmount=this.handleUnmount.bind(this),this.handleReopen=this.handleReopen.bind(this),this.handleReopenLast=this.handleReopenLast.bind(this),this.handleCycleToNextStack=this.handleCycleToNextStack.bind(this),this.handleCycleToPreviousStack=this.handleCycleToPreviousStack.bind(this),this.handleCycleToNextTab=this.handleCycleToNextTab.bind(this),this.handleCycleToPreviousTab=this.handleCycleToPreviousTab.bind(this),this.handleDeleted=this.handleDeleted.bind(this),this.handleClosed=this.handleClosed.bind(this),this.handleControlClose=this.handleControlClose.bind(this),this.layout=e,this.hydrateComponent=t,this.dehydrateComponent=n,this.onPanelsUpdated=a,this.openedMap=new Map(i),this.closed=[...o],this.navigationEventListenerRemovers=[],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(ae.FOCUS,this.handleFocus),e.on(ae.MOUNT,this.handleMount),e.on(ae.UNMOUNT,this.handleUnmount),e.on(ae.REOPEN,this.handleReopen),e.on(ae.REOPEN_LAST,this.handleReopenLast),e.on(ae.DELETE,this.handleDeleted),e.on(ae.CLOSED,this.handleClosed),e.on(ae.CLOSE,this.handleControlClose),this.navigationEventListenerRemovers.push(qp(e,this.handleCycleToNextStack)),this.navigationEventListenerRemovers.push(Xp(e,this.handleCycleToPreviousStack)),this.navigationEventListenerRemovers.push(Zp(e,this.handleCycleToNextTab)),this.navigationEventListenerRemovers.push(Yp(e,this.handleCycleToPreviousTab))}stopListening(){var{eventHub:e}=this.layout;e.off(ae.FOCUS,this.handleFocus),e.off(ae.MOUNT,this.handleMount),e.off(ae.UNMOUNT,this.handleUnmount),e.off(ae.REOPEN,this.handleReopen),e.off(ae.REOPEN_LAST,this.handleReopenLast),e.off(ae.DELETE,this.handleDeleted),e.off(ae.CLOSED,this.handleClosed),e.off(ae.CLOSE,this.handleControlClose),this.navigationEventListenerRemovers.forEach(t=>t()),this.navigationEventListenerRemovers=[]}getClosedPanelConfigsOfType(e){return this.closed.filter(t=>t.component===e)}getOpenedPanels(){return Array.from(this.openedMap.values())}getOpenedPanelConfigs(){return this.getOpenedPanels().map(e=>{var{glContainer:t}=e.props;return O.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&Cn(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,n=O.getStackForConfig(this.layout.root,{id:e});return(t=n&&O.getContentItemInStack(n,{id:e}))!==null&&t!==void 0?t:null}getLastUsedPanel(e){for(var t=this.getOpenedPanels(),n=t.length-1;n>=0;n-=1){var i=t[n];if(e==null||e(i))return i}}getLastUsedPanelOfType(e){return this.getLastUsedPanelOfTypes([e])}getLastUsedPanelOfTypes(e){return this.getLastUsedPanel(t=>e.some(n=>Cr(n)&&t instanceof n.WrappedComponent||!Cr(n)&&t instanceof n))}updatePanel(e){var t=O.getIdFromPanel(e);if(t==null){ht.error("updatePanel Panel did not have an ID",e);return}ht.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=O.getIdFromPanel(e);if(t==null){ht.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){ht.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){ht.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}ht.debug2("Removing panel ID ".concat(t," from open panels map")),this.openedMap.delete(t)}removeClosedPanelConfig(e){var t=this.closed.findIndex(n=>n===e||n.id!=null&&e.id!=null&&n.id===e.id);t>=0&&this.closed.splice(t,1)}handleFocus(e){ht.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){ht.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){ht.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}cycleStack(e){var t=O.getAllStackContainers(this.layout);if(!(t.length<=1)){var n=O.getFocusedStackIndex(t);if(n===-1){var i=t[0],o=i.config.activeItemIndex,a=o!=null?i.contentItems[o]:i.contentItems[0];i.setActiveContentItem(a,!0);return}var s=e===Wt.Next?(n+1)%t.length:(n-1+t.length)%t.length,l=t[s],d=l.config.activeItemIndex,h=d!=null?l.contentItems[d]:l.contentItems[0];l.setActiveContentItem(h,!0)}}handleCycleToNextStack(){this.cycleStack(Wt.Next)}handleCycleToPreviousStack(){this.cycleStack(Wt.Previous)}cycleTab(e){var t,n=O.getFocusedStack(this.layout);if(n!==void 0){var{contentItems:i}=n;if(!(i.length<=1)){var o=(t=n.config.activeItemIndex)!==null&&t!==void 0?t:0,a=e===Wt.Next?(o+1)%i.length:(o-1+i.length)%i.length,s=i[a];n.setActiveContentItem(s,!0)}}}handleCycleToNextTab(){this.cycleTab(Wt.Next)}handleCycleToPreviousTab(){this.cycleTab(Wt.Previous)}handleReopen(e,t){ht.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:n}=e,{props:i}=e;i=this.hydrateComponent(n,i);var o=fa(fa({},e),{},{props:i}),{root:a}=this.layout,s=e.parentStackId===void 0?void 0:O.getStackById(a,e.parentStackId);O.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 n=(t=O.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===n){this.handleReopen(o);return}}}}handleDeleted(e){ht.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){ht.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:n}=this.layout;O.closeComponent(n,t)}addClosedPanel(e){var{root:t}=this.layout,n=O.getComponentConfigFromContainer(e);if(n&&Cn(n)){var i=this.dehydrateComponent(n.component,n);if(i!=null){var o;i.parentStackId=(o=O.getStackForConfig(t,n))===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)})}}Mt(Mi,"MAX_CLOSED_PANEL_COUNT",100);var ng=K.module("PanelErrorBoundary");class rg 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,n=O.getIdFromContainer(e);ng.debug("componentWillUnmount",n),t.emit(ae.CLOSED,n,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?u.jsx("div",{className:"panel-error-boundary",children:u.jsx(un,{"data-testid":"panel-error-boundary-loading-error",errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e??null}}function pa(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Or(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?pa(Object(t),!0).forEach(function(n){ig(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):pa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ig(r,e,t){return(e=og(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function og(r){var e=ag(r,"string");return typeof e=="symbol"?e:e+""}function ag(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Ol(r){var{props:e,componentState:t}=r,{metadata:n}=e,{panelState:i=null}=e;t&&({panelState:i}=t);var o={};return n!=null&&(o.metadata=n),i!=null&&(o.panelState=i),Or(Or({},r),{},{componentState:null,props:o,type:"react-component"})}function xl(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return Or(Or({},r),{},{localDashboardId:e})}const sg={dehydrate:Ol,hydrate:xl};var Il=R.createContext(void 0);Il.displayName="LayoutManagerContext";var lg=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}),Dl=S.shape({on:S.func,off:S.func,emit:S.func}),dg=S.shape({registerComponent:S.func,root:S.shape({addChild:S.func}),on:S.func,off:S.func,eventHub:Dl}),ug=Object.freeze({Container:lg,EventHub:Dl,Layout:dg});function An(r,e,t,n){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.");R.useEffect(()=>{var a=r(o,e,t,n);return()=>{a()}},[e,n,t,o,r])}function Le(r,e,t){m.useEffect(function(){return r.on(e,t),()=>{r.off(e,t)}},[r,e,t])}var kl="SET_DASHBOARD_DATA";const hg=Pc(kl,{},!1),cg={dashboardData:hg};var mg=new Map,Ml=Object.freeze({}),vg=Object.freeze([]),xC=bi,fg=qa,IC=id,pg=r=>r.dashboardData,$e=(r,e)=>{var t;return(t=pg(r)[e])!==null&&t!==void 0?t:Ml},DC=(r,e)=>{var t;return(t=$e(r,e).closed)!==null&&t!==void 0?t:vg},kC=(r,e)=>{var t;return(t=$e(r,e).openedMap)!==null&&t!==void 0?t:mg},Nl=(r,e)=>{var t;return(t=$e(r,e).pluginDataMap)!==null&&t!==void 0?t:Ml},MC=(r,e,t)=>Nl(r,e)[t];function ga(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Sn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ga(Object(t),!0).forEach(function(n){gg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ga(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function gg(r,e,t){return(e=bg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bg(r){var e=yg(r,"string");return typeof e=="symbol"?e:e+""}function yg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var jl=(r,e)=>({type:kl,id:r,payload:e}),Jt=(r,e)=>(t,n)=>t(jl(r,Sn(Sn({},$e(n(),r)),e))),NC=(r,e,t)=>(n,i)=>n(jl(r,Sn(Sn({},$e(i(),r)),{},{pluginDataMap:Sn(Sn({},Nl(i(),r)),{},{[e]:t})})));Object.entries(cg).map(r=>{var[e,t]=r;return Wd.register(e,t)});function Cg(r){var{children:e}=r;return u.jsx(u.Fragment,{children:e})}var Ni=m.createContext(null);Ni.displayName="PanelIdContext";function Sg(){return m.useContext(Ni)}function ba(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ln(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ba(Object(t),!0).forEach(function(n){wg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ba(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function wg(r,e,t){return(e=Eg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Eg(r){var e=_g(r,"string");return typeof e=="symbol"?e:e+""}function _g(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var hr=K.module("DashboardLayout"),Pg=Object.freeze({}),Tg=[],ya=()=>{},Og=1e3,Ca=r=>r;function xg(r){var e,t,{id:n,children:i,emptyDashboard:o=u.jsx("div",{children:"Dashboard is empty."}),layout:a,layoutConfig:s=Tg,onLayoutChange:l=ya,onLayoutInitialized:d=ya,hydrate:h=xl,dehydrate:c=Ol,panelWrapper:v=Cg}=r,f=bi(),p=(e=qa(y=>$e(y,n)))!==null&&e!==void 0?e:Pg,[g,b]=m.useState(!1),[E,x]=m.useState(!1),[P,F]=m.useState(),[U]=m.useState((t=p==null?void 0:p.closed)!==null&&t!==void 0?t:[]),[ee,j]=m.useState(a.getReactChildren()),W=m.useMemo(()=>new Map,[]),H=m.useMemo(()=>new Map,[]),ne=m.useCallback(function(y,w){var T,q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:h,re=arguments.length>3&&arguments[3]!==void 0?arguments[3]:c;hr.debug2("registerComponent",y,w,q,re);function st(Z,se){var me=w,He=v,Pt=xs(me),{glContainer:Tt,glEventHub:Ur}=Z,Mn=O.getIdFromContainer(Tt);return u.jsx(rg,{glContainer:Tt,glEventHub:Ur,children:u.jsx(Ni.Provider,{value:Mn,children:u.jsx(He,Ln(Ln({},Z),{},{children:Pt?u.jsx(me,Ln(Ln({},Z),{},{ref:se})):u.jsx(me,Ln({},Z))}))})})}st.displayName="DashboardWrapper(".concat((T=w.displayName)!==null&&T!==void 0?T:y,")");var D=a.registerComponent(y,R.forwardRef(st));return W.set(y,q),H.set(y,re),D},[h,c,W,H,a,v]),oe=m.useCallback((y,w)=>{var T;return((T=W.get(y))!==null&&T!==void 0?T:Ca)(w,n)},[W,n]),L=m.useCallback((y,w)=>{var T;return((T=H.get(y))!==null&&T!==void 0?T:Ca)(w,n)},[H,n]),X=m.useMemo(()=>new Mi(a,oe,L,new Map,U,y=>{var{closed:w,openedMap:T}=y;f(Jt(n,{closed:w,openedMap:T}))}),[L,f,oe,n,U,a]),z=Uu(y=>{var w=P==null||!O.isEqual(P,y);hr.debug("handleLayoutStateChanged",w,y),w&&(b(a.root.contentItems.length===0),F(y),l(y),j(a.getReactChildren()))},Og,{flushOnUnmount:!0});m.useEffect(()=>()=>z.flush(),[z]);var A=m.useCallback(()=>{if(!E){var y=a.toConfig(),w=y.content,T=O.dehydrateLayoutConfig(w,L);z(T)}},[L,E,a,z]),V=m.useCallback(y=>{var w=O.getIdFromContainer(y);a.eventHub.emit(ae.DRAGGING,w),x(!0)},[a.eventHub]),G=m.useCallback(y=>{var w=O.getIdFromContainer(y);a.eventHub.emit(ae.DROPPED,w),x(!1)},[a.eventHub]),pe=m.useCallback(y=>{if(hr.debug2("handleComponentCreated",y),!(y==null||y.config==null||y.config.component==null||y.element==null)){var w=y.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),T="".concat(w,"-component");y.element.addClass(T)}},[]),Ge=m.useCallback(()=>{j(a.getReactChildren())},[a]);Le(a,"stateChanged",A),Le(a,"itemPickedUp",V),Le(a,"itemDropped",G),Le(a,"componentCreated",pe),Le(a.eventHub,ae.TITLE_CHANGED,A),Le(a,"reactChildrenChanged",Ge);var je=Wu(s);return m.useEffect(function(){if(je!==s&&s!==P){hr.debug("Setting new layout content...");for(var w=O.hydrateLayoutConfig(s,oe);a.root.contentItems.length>0;)a.root.contentItems[0].remove();for(var T=0;T<w.length;T+=1)a.root.addChild(w[T]);b(a.root.contentItems.length===0)}},[oe,a,s,P,X,je]),m.useEffect(()=>d(),[]),u.jsxs(u.Fragment,{children:[g&&o,ee,R.Children.map(i,y=>y!=null?u.jsx(Hh,{fallback:[],children:R.cloneElement(y,{id:n,layout:a,panelManager:X,registerComponent:ne})}):null)]})}xg.propTypes={id:S.string.isRequired,children:S.node,data:S.shape({}),emptyDashboard:S.node,layout:ug.Layout.isRequired,layoutConfig:S.arrayOf(S.shape({})),onLayoutChange:S.func,onLayoutInitialized:S.func};var Al=m.createContext(null);Al.displayName="DashboardIdContext";function jC(){var r=m.useContext(Al);if(r==null)throw new Error("useDashboardId must be used within a DashboardIdContext provider");return r}function Ig(r,e,t){return(e=Dg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Dg(r){var e=kg(r,"string");return typeof e=="symbol"?e:e+""}function kg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Ll(r,e,t){if(r){if(t(r)===!0)return r;for(var n=r.child;n;){var i=Ll(n,e,t);if(i)return i;n=n.sibling}}}function Mg(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}var ji=Mg(m.createContext(null));ji.displayName="FiberContext";class AC extends m.Component{constructor(){super(...arguments),Ig(this,"_reactInternals",void 0)}render(){var{children:e}=this.props;return u.jsx(ji.Provider,{value:this._reactInternals,children:e})}}function Ng(){var r=m.useContext(ji);if(r===null)throw new Error("useFiber must be called within a <FiberProvider />!");var[e]=m.useState(()=>Et()),t=m.useMemo(()=>{for(var n of[r,r==null?void 0:r.alternate].filter(o=>o!=null)){var i=Ll(n,!1,o=>{for(var a=o.memoizedState;a!=null;){if(a.memoizedState===e)return!0;a=a.next}});if(i)return i}},[r,e]);return t}var LC="default",jg="CREATE_DASHBOARD",Ag="CLOSE_DASHBOARD",{listen:RC,emit:FC,useListener:$C}=Qt(jg),{listen:HC,emit:Lg,useListener:BC}=Qt(Ag);function Rg(r,e,t){return(e=Fg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Fg(r){var e=$g(r,"string");return typeof e=="symbol"?e:e+""}function $g(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Rl 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,n,{glContainer:i}=this.props;return[...(e=i==null||(t=i.tab)===null||t===void 0||(n=t.header)===null||n===void 0?void 0:n.tabs)!==null&&e!==void 0?e:[]]}handleCloseTab(){var{glContainer:e}=this.props;e.close()}handleCloseTabsAll(){var e=this.getAllTabs();e.forEach(t=>{var n;return(n=(t==null?void 0:t.contentItem).container)===null||n===void 0?void 0:n.close()})}handleCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),n=t.length-1;n>0;n-=1){var i,o,a,s,l,d,h;if(((i=t[n].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[n])===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(ae.REOPEN_LAST,e)}canCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),n=!0,i=t.length-1;i>0;i-=1){var o,a,s,l,d,h,c,v;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 f=!!(!((h=t[i])===null||h===void 0||(c=h.contentItem)===null||c===void 0||(v=c.config)===null||v===void 0)&&v.isClosable);if(f){n=!1;break}}return n}canCloseAny(){for(var e=this.getAllTabs(),t=!0,n=e.length-1;n>0;n-=1){var i,o,a,s=!!(!((i=e[n])===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:n,glContainer:i}=this.props,o=(e=O.getStackForConfig(i.layoutManager.root,i.getConfig()))===null||e===void 0?void 0:e.config.id;return!((t=n.data.closed)!==null&&t!==void 0&&t.some(a=>a.parentStackId===o))}render(){var e,t,n,{additionalActions:i,glContainer:o}=this.props,a=[...i];a.push(()=>({title:"Re-open closed panel",group:te.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||(n=t.config)===null||n===void 0?void 0:n.isClosable;return a.push({title:"Close",order:10,group:te.groups.low,action:this.handleCloseTab,disabled:s===void 0||!s}),a.push(()=>({title:"Close Tabs to Right",order:20,group:te.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),a.push(()=>({title:"Close All",order:30,group:te.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),u.jsx(te,{actions:a})}}Rg(Rl,"defaultProps",{additionalActions:[]});var Hg=r=>({workspace:Bs(r)}),Bg=In(Hg,{setWorkspace:Us})(Rl);function Fl(r,e,t){return(e=Wg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Wg(r){var e=Ug(r,"string");return typeof e=="symbol"?e:e+""}function Ug(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class $l extends m.PureComponent{constructor(e){super(e),Fl(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=R.createRef();var{value:t}=e;this.state={value:t,valueWasValidated:!1}}componentDidUpdate(e){var{isShown:t}=e,{isShown:n}=this.props;n&&!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,n=t==null?void 0:t.trim();if(n!==void 0&&n!==""){var{onSubmit:i}=this.props;i(n)}else this.setState({value:n,valueWasValidated:!0})}renderRenameDialog(){var{isShared:e,isOwner:t,itemType:n}=this.props,{value:i,valueWasValidated:o}=this.state;return u.jsxs("form",{className:Y("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(n,"-input"),children:["Rename ",n]}),u.jsx("input",{type:"text",className:"form-control",id:"rename-dialog-".concat(n,"-input"),value:i??void 0,ref:this.renameInputRef,onChange:this.handleRenameInputChange,required:!0}),u.jsxs("div",{className:"invalid-feedback",children:[n," name cannot be empty"]}),(e||!t)&&u.jsxs("div",{className:"pt-2",children:["Renaming this ",n," will rename for all users."]})]}),u.jsxs("div",{className:"text-right",children:[u.jsx(ie,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),u.jsx(ie,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var{isShown:e,onCancel:t}=this.props;return u.jsx(Zn,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}Fl($l,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});var cr=Object.freeze({focus:"TabEvent.focus",blur:"TabEvent.blur"});function Sa(r,e,t){return(e=Vg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Vg(r){var e=Kg(r,"string");return typeof e=="symbol"?e:e+""}function Kg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var zg=K.module("Panel");class Gg extends m.PureComponent{constructor(e){super(e),Sa(this,"ref",void 0),Sa(this,"getAdditionalActions",qt((n,i,o)=>{var a=[];return i&&a.push(this.getCloneAction()),o&&a.push(this.getRenameAction()),[...a,...n]})),this.handleCopyPanel=this.handleCopyPanel.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleHide=this.handleHide.bind(this),this.handleResize=this.handleResize.bind(this),this.handleBeforeShow=this.handleBeforeShow.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.handleShowRenameDialog=this.handleShowRenameDialog.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleTab=this.handleTab.bind(this),this.ref=R.createRef();var{glContainer:t}=this.props;this.state={title:O.getTitleFromContainer(t),showRenameDialog:!1,isWithinPanel:!0}}componentDidMount(){var e,t,{componentPanel:n,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(cr.focus,this.handleTabFocus),o.on(cr.blur,this.handleTabBlur),o.emit(ae.MOUNT,n??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:n}=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),n.off(cr.focus,this.handleTabFocus),n.off(cr.blur,this.handleTabBlur),n.emit(ae.UNMOUNT,e??this)}handleTab(e){e!=null&&this.setState({title:O.getTitleFromTab(e)}),this.forceUpdate();var{onTab:t}=this.props;t==null||t(e)}handleTabClicked(e){var{onTabClicked:t}=this.props;t==null||t(e)}handleFocus(e){var{componentPanel:t,glEventHub:n}=this.props;n.emit(ae.FOCUS,t??this);var{onFocus:i}=this.props;i==null||i(e)}handleBlur(e){var{onBlur:t}=this.props;t==null||t(e)}handleHide(){for(var{onHide:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleResize(){for(var{onResize:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleBeforeShow(){for(var{onBeforeShow:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleShow(){for(var{onShow:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleTabBlur(){for(var{onTabBlur:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleTabFocus(){for(var{onTabFocus:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleRenameCancel(){this.setState({showRenameDialog:!1})}handleShowRenameDialog(){this.setState({showRenameDialog:!0})}handleRenameSubmit(e){var{glContainer:t}=this.props;this.setState({showRenameDialog:!1,title:e});var n=O.getRootFromContainer(t),i=O.getComponentConfigFromContainer(t);$(i),O.renameComponent(n,i,e)}handleCopyPanel(){var{glContainer:e,glEventHub:t}=this.props,n=O.getRootFromContainer(e),i=O.getComponentConfigFromContainer(e);if(i==null){zg.error("Could not get component config from container",e);return}var o=O.cloneComponent(n,i);o!==null&&t.emit(ae.CLONED,this,o)}getCloneAction(){return{title:"Copy Panel",order:10,group:te.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:te.groups.medium,action:this.handleShowRenameDialog}}render(){var{children:e,className:t,renderTabTooltip:n,glContainer:i,glEventHub:o,additionalActions:a=nu,errorMessage:s,isLoaded:l=!0,isLoading:d=!1,isClonable:h=!1,isRenamable:c=!1}=this.props,{tab:v}=i,{showRenameDialog:f,title:p,isWithinPanel:g}=this.state;return u.jsxs("div",{className:Y("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,u.jsx(un,{"data-testid":"base-panel-loading",errorMessage:s,isLoaded:l,isLoading:d}),!g&&v!=null&&Dr.createPortal(u.jsxs(u.Fragment,{children:[u.jsx(Bg,{glContainer:i,glEventHub:o,additionalActions:this.getAdditionalActions(a,h,c)}),c&&u.jsx($l,{isShown:f,value:p,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),n!=null&&u.jsx(ce,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:n()})]}),v.element[0])]})}}var qg=js(Gg),Xg=K.module("useDhId"),Jr="__dhId";function WC(){var r,e,t=(r=(e=Ng())===null||e===void 0?void 0:e.pendingProps)!==null&&r!==void 0?r:{},n=t[Jr],i=Sg();if(n!=null){if(typeof n!="string")throw new Error("useDhId expected prop ".concat(Jr," to be a string, but got ").concat(typeof n));return n}return i??(Xg.warn("useDhId must be used within a PanelIdContext provider if there is no ".concat(Jr," prop. Defaulting to null.")),null)}function tr(r,e,t){return(e=Zg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Zg(r){var e=Yg(r,"string");return typeof e=="symbol"?e:e+""}function Yg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ne{}tr(Ne,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");tr(Ne,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");tr(Ne,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");tr(Ne,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");tr(Ne,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");function en(r,e,t){return(e=Qg(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Qg(r){var e=Jg(r,"string");return typeof e=="symbol"?e:e+""}function Jg(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class _t{}en(_t,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");en(_t,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");en(_t,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");en(_t,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");en(_t,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");en(_t,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");en(_t,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");en(_t,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");const UC=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function At(r,e,t){return(e=eb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function eb(r){var e=tb(r,"string");return typeof e=="symbol"?e:e+""}function tb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class J{}At(J,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");At(J,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");At(J,"CLOSE_FILE","NotebookEvent.closeFile");At(J,"RENAME","NotebookEvent.rename");At(J,"RENAME_FILE","NotebookEvent.renameFile");At(J,"REGISTER_FILE","NotebookEvent.registerFile");At(J,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");At(J,"UNREGISTER_FILE","NotebookEvent.unregisterFile");At(J,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");var nb=["children"];function wa(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ea(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wa(Object(t),!0).forEach(function(n){rb(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):wa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function rb(r,e,t){return(e=ib(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ib(r){var e=ob(r,"string");return typeof e=="symbol"?e:e+""}function ob(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function ab(r,e){if(r==null)return{};var t,n,i=sb(r,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(n=0;n<o.length;n++)t=o[n],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(r,t)&&(i[t]=r[t])}return i}function sb(r,e){if(r==null)return{};var t={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(e.indexOf(n)!==-1)continue;t[n]=r[n]}return t}class lb extends m.PureComponent{constructor(e){super(e),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this)}componentDidMount(){var{glEventHub:e}=this.props;e.on(Ne.SESSION_CLOSED,this.handleSessionClosed),e.on(Ne.SESSION_OPENED,this.handleSessionOpened),e.on(_t.CLEAR_ALL_FILTERS,this.handleClearAllFilters)}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(Ne.SESSION_CLOSED,this.handleSessionClosed),e.off(Ne.SESSION_OPENED,this.handleSessionOpened),e.off(_t.CLEAR_ALL_FILTERS,this.handleClearAllFilters)}handleClearAllFilters(){for(var{onClearAllFilters:e}=this.props,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];e==null||e(...n)}handleSessionClosed(e){var{onSessionClose:t}=this.props;t==null||t(e)}handleSessionOpened(e,t){var{onSessionOpen:n}=this.props;n==null||n(e,t)}render(){var e=this.props,{children:t}=e,n=ab(e,nb);return u.jsx(qg,Ea(Ea({},n),{},{children:t}))}}var nr=js(lb);const VC=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var db=Object.freeze({}),ub=new Map,Fr=Object.freeze([]),KC=(r,e)=>{var t;return(t=$e(r,e).columns)!==null&&t!==void 0?t:Fr},zC=(r,e)=>{var t;return(t=$e(r,e).filterSets)!==null&&t!==void 0?t:Fr},GC=(r,e)=>{var t;return(t=$e(r,e).filters)!==null&&t!==void 0?t:Fr},qC=(r,e)=>{var t;return(t=$e(r,e).tableMap)!==null&&t!==void 0?t:ub},XC=(r,e)=>$e(r,e).isolatedLinkerPanelId,Hl=(r,e)=>{var t;return(t=$e(r,e).links)!==null&&t!==void 0?t:Fr},ZC=(r,e)=>$e(r,e).columnSelectionValidator,YC=(r,e)=>{var t;return(t=$e(r,e).consoleSettings)!==null&&t!==void 0?t:db},QC=(r,e)=>$e(r,e).connection,rr=(r,e)=>$e(r,e).sessionWrapper,JC=(r,e)=>t=>t(Jt(r,{connection:e})),e0=(r,e)=>t=>t(Jt(r,{sessionWrapper:e})),Bl=(r,e)=>t=>t(Jt(r,{links:e})),t0=(r,e)=>(t,n)=>{var i=Hl(n(),r),o=e.filter(a=>i.findIndex(s=>Vn(s.start,a.start)&&Vn(s.end,a.end))<0);return t(Bl(r,i.concat(o)))},n0=(r,e)=>(t,n)=>{var i=Hl(n(),r),o=i.filter(a=>!e.includes(a.id));return t(Bl(r,o))},r0=(r,e)=>t=>t(Jt(r,{isolatedLinkerPanelId:e})),i0=(r,e)=>t=>t(Jt(r,{columnSelectionValidator:e})),hb=(r,e)=>t=>t(Jt(r,{consoleSettings:e})),o0=(r,e)=>t=>t(Jt(r,{filterSets:e}));function xr(r,e,t){return(e=cb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function cb(r){var e=mb(r,"string");return typeof e=="symbol"?e:e+""}function mb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var mr=K.module("CommandHistoryPanel");class ir extends m.Component{static handleError(e){mr.error(e)}constructor(e){super(e),xr(this,"container",void 0),xr(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=R.createRef(),this.pending=new qn;var{session:t,sessionId:n,language:i}=e;this.state={panelState:{},session:t,sessionId:n,language:i,contextActions:[{action:this.handleFocusHistory,shortcut:Ve.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){var{glEventHub:e,session:t}=this.props;e.on(Ne.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(Ne.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:n,sessionId:i}=t;this.setState({session:e,sessionId:i,language:n},()=>{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:n,language:i}=this.state;if(mr.debug("handleSendToNotebook",n,e),!n){mr.error("Session is not connected.");return}var{glEventHub:o}=this.props;o.emit(t?J.CREATE_NOTEBOOK:J.SEND_TO_NOTEBOOK,n,i,e)}handleSendToConsole(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;mr.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(Ne.SEND_COMMAND,e,t,n)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:n}=this.state;$(t),$(n),this.pending.add(e.getTable(t,n,Date.now()),i=>i.close()).then(i=>{this.setState({table:i})}).catch(ir.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:n}=this.props,{language:i,contextActions:o,table:a}=this.state;return u.jsxs(nr,{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(Ue,{ref:this.container,language:i,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:a,commandHistoryStorage:n}),u.jsx(te,{actions:o})]})]})}}xr(ir,"COMPONENT","CommandHistoryPanel");xr(ir,"TITLE","Command History");var vb=(r,e)=>{var t=$s(r),n=rr(r,e.localDashboardId),{session:i,config:o}=n??{},{type:a,id:s}=o??{};return{commandHistoryStorage:t,language:a,session:i,sessionId:s}},fb=In(vb,null,null,{forwardRef:!0})(ir),Wl=m.createContext(null);Wl.displayName="PluginsContext";var kn=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin",ELEMENT_PLUGIN:"ElementPlugin"});function pb(r){return"DashboardPlugin"in r}function gb(r){return"AuthPlugin"in r}function bb(r){return"TablePlugin"in r}function a0(r){return pb(r)||gb(r)||bb(r)}function yb(r){return"type"in r&&r.type===kn.DASHBOARD_PLUGIN}function Ai(r){return"type"in r&&r.type===kn.WIDGET_PLUGIN}function Cb(r){return"type"in r&&r.type===kn.TABLE_PLUGIN}function Sb(r){return"type"in r&&r.type===kn.AUTH_PLUGIN}function Ul(r){return"type"in r&&r.type===kn.THEME_PLUGIN}function Vl(r){return"type"in r&&r.type===kn.ELEMENT_PLUGIN}function s0(r){return yb(r)||Sb(r)||Cb(r)||Ul(r)||Ai(r)||Vl(r)}var Kl=K.module("@deephaven/plugin.PluginUtils");function _a(r,e){return r==null||!Ai(r)?!1:[r.supportedTypes].flat().some(t=>t===e)}function wb(r){var e=u.jsx(fe,{icon:rs});if(!Ai(r))return e;var{icon:t}=r;return t==null?e:m.isValidElement(t)?t:u.jsx(fe,{icon:t})}function l0(r){var e=[...r.entries()].filter(t=>Ul(t[1]));return Kl.debug("Getting theme data from plugins",e),e.map(t=>{var[n,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:Ud(n,s),name:s,styleContent:d}})}).flat()}function d0(r){var e=[...r.entries()].filter(t=>Vl(t[1])&&t[1].mapping!=null);return Kl.debug("Getting element plugin mapping",e),new Map(e.flatMap(t=>{var[,n]=t;return Object.entries(n.mapping)}))}function u0(){return Xn(Wl,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}var zl=m.createContext(null);zl.displayName="PersistentStateContext";function h0(r){var{initialState:e,onChange:t,children:n}=r,[i,o]=R.useState(0),a=m.useRef({initial:e,initialStateMap:new Map,state:new Map,isTracking:!0}),s=m.useCallback((v,f)=>{a.current.isTracking&&a.current.state.set(v,f)},[]),l=m.useCallback(()=>{a.current.isTracking||(a.current.isTracking=!0,a.current.state=new Map,o(v=>v+1))},[]),d=m.useRef(a.current.initial[Symbol.iterator]()),h=m.useCallback(function(f){var p=a.current.initialStateMap.get(f);if(p)return p;var{value:g,done:b}=d.current.next(),E={value:g,done:b??!1};return a.current.initialStateMap.set(f,E),E},[]);m.useEffect(function(){a.current.isTracking&&(t([...a.current.state.values()]),a.current.isTracking=!1)},[i,t]);var c=m.useMemo(()=>({addState:s,scheduleStateUpdate:l,getInitialState:h,updateId:i}),[s,h,l,i]);return u.jsx(zl.Provider,{value:c,children:n})}function Pa(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function vr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Pa(Object(t),!0).forEach(function(n){sn(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Pa(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function sn(r,e,t){return(e=Eb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Eb(r){var e=_b(r,"string");return typeof e=="symbol"?e:e+""}function _b(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var fr=K.module("ConsolePanel"),Pb=500,Tb=Object.freeze({consoleSettings:{},itemIds:[]});class $r extends m.PureComponent{constructor(e){super(e),sn(this,"consoleRef",void 0),sn(this,"objectSubscriptionCleanup",void 0),sn(this,"savePanelState",ln(()=>{var{consoleSettings:a,itemIds:s}=this.state,l={consoleSettings:a,itemIds:[...s]};fr.debug("Saving panel state",l),this.setState({panelState:l})},Pb)),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=R.createRef();var{panelState:t}=e,n=vr(vr({},Tb),t||{}),{consoleSettings:i,itemIds:o}=n;this.state={consoleSettings:i,itemIds:new Map(o),objectMap:new Map,error:void 0,panelState:n}}componentDidMount(){var{glEventHub:e}=this.props;this.closeDisconnectedPanels(),e.on(ae.MOUNT,this.handlePanelMount),this.subscribeToFieldUpdates()}componentDidUpdate(e,t){var{consoleSettings:n,itemIds:i}=this.state;(t.consoleSettings!==n||t.itemIds!==i)&&this.savePanelState()}componentWillUnmount(){var e,{glEventHub:t}=this.props;this.savePanelState.flush(),t.off(ae.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(n=>{fr.debug("Got updates",n),this.setState(i=>{var{objectMap:o}=i,{updated:a,created:s,removed:l}=n,d=[...a,...l],h=new Map(o);d.forEach(v=>{var{title:f}=v;f!==void 0&&h.delete(f)});var c=[...a,...s];return c.forEach(v=>{v.title!==void 0&&h.set(v.title,v)}),{objectMap:h}})})}}setItemId(e,t){this.setState(n=>{var{itemIds:i}=n,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:n}=this.state,i=n.get(e);return i==null&&t&&(i=Et(),this.setItemId(e,i)),i}handleTabFocus(){var e;(e=this.consoleRef.current)===null||e===void 0||e.focus()}handlePanelMount(e){var t,n,i,{itemIds:o}=this.state,a=e==null||(t=e.props)===null||t===void 0?void 0:t.id,s=e==null||(n=e.props)===null||n===void 0||(i=n.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(Ne.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{root:n}=this.context,i=e.title!=null?this.getItemId(e.title,!1):null;(t||i!=null&&O.getStackForRoot(n,{id:i},!1,!1,!1)!=null)&&this.openWidget(e)}handleCloseObject(e){var{title:t}=e;if(t!==void 0){var n=this.getItemId(t,!1);if(n!=null){var{glEventHub:i}=this.props;i.emit(ae.CLOSE,n),Lg(i,t)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;fr.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(Ne.SETTINGS_CHANGED,e)}openWidget(e){var{glEventHub:t,sessionWrapper:n}=this.props;$(n);var{config:i,session:o}=n,{title:a=e.name}=e;$(a);var s=this.getItemId(a),l={fetch:()=>o.getObject(e),panelId:s,widget:vr(vr({},ac(e)),{},{sessionId:i.id})};fr.debug("openWidget",l),Gp(t,l)}addCommand(e){var t,n=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,n,i)}closeDisconnectedPanels(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{consoleSettings:t,itemIds:n}=this.state,{isClosePanelsOnDisconnectEnabled:i=!0}=t;if(!(!i&&!e)){var o=[...n.values()],{glEventHub:a}=this.props;o.forEach(s=>{a.emit(ae.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(n=>_a(n,e))}iconForType(e){var{plugins:t}=this.props,n=[...t.values()].find(i=>_a(i,e));return n!=null?wb(n):u.jsx(Vs,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:n,sessionWrapper:i,timeZone:o,unzip:a}=this.props;if(i==null)return u.jsx(un,{isLoading:!1,errorMessage:"Console is disabled.","data-testid":"console-panel-loading-error"});var{consoleSettings:s,error:l,objectMap:d}=this.state,{config:h,session:c,connection:v,details:f={},dh:p}=i,{workerName:g,processInfoId:b}=f,{id:E,type:x}=h;return u.jsx(nr,{className:"iris-panel-console",componentPanel:this,glContainer:t,glEventHub:n,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,errorMessage:l!=null?"".concat(l):void 0,children:c!=null&&u.jsx(Gt,{dh:p,ref:this.consoleRef,settings:s,session:c,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:x,statusBarChildren:u.jsxs(u.Fragment,{children:[u.jsx("div",{children:zs.LANGUAGE_MAP.get(x)}),g!=null&&u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"•"}),g]}),b!=null&&u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"•"}),b,u.jsx("div",{children:"•"})]}),u.jsx(lf,{connection:v,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})]}),showObjectsMenu:!1,scope:E,timeZone:o,objectMap:d,unzip:a,supportsType:this.supportsType,iconForType:this.iconForType})})}}sn($r,"COMPONENT","ConsolePanel");sn($r,"TITLE","Console");sn($r,"contextType",Il);var Ob=(r,e)=>({commandHistoryStorage:$s(r),sessionWrapper:rr(r,e.localDashboardId),timeZone:mc(r),plugins:vc(r)}),ei=In(Ob,null,null,{forwardRef:!0})($r);function c0(r){return r==="file"||r==="directory"}function yt(r){return r.type==="directory"}function xb(r,e,t){return(e=Ib(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ib(r){var e=Db(r,"string");return typeof e=="symbol"?e:e+""}function Db(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Li extends Error{constructor(){super("No file exists at the path specified"),xb(this,"isFileNotFound",!0)}}function Ta(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function Oa(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Ta(o,n,i,a,s,"next",l)}function s(l){Ta(o,n,i,a,s,"throw",l)}a(void 0)})}}var Nt;(function(r){r.GROOVY="text/x-groovy",r.PLAIN_TEXT="text/plain",r.PYTHON="text/x-python",r.PYTHON_COMPILED="application/x-python-code",r.SCALA="text/x-scala",r.UNKNOWN=""})(Nt||(Nt={}));class N{static fileExists(e,t){return Oa(function*(){try{return yield e.info(t),!0}catch(n){if(!(n instanceof Li))throw n;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(!N.hasPath(e))throw new Error("Invalid path provided: ".concat(e));var n=(t=e.match(/\//g))!==null&&t!==void 0?t:[];return n.length-1}static getExtension(e){var t=this.getBaseName(e).split(".");if(t.length>1){var n;return(n=t.pop())!==null&&n!==void 0?n:""}return""}static getBaseName(e){var t;return(t=e.split("/").pop())!==null&&t!==void 0?t:""}static getCopyFileName(e){var t=e.lastIndexOf("."),n=null,i=null;t<0?i=e:(i=e.substring(0,t),n=e.substring(t+1));var o=i?"".concat(i,"-copy"):"Copy";return n!==null?"".concat(o,".").concat(n):o}static getUniqueCopyFileName(e,t){return Oa(function*(){for(var n=N.getCopyFileName(t);yield N.fileExists(e,n);)n=N.getCopyFileName(n);return n})()}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(!N.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(!N.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]:"",n=e.lastIndexOf("."),i=n>-1?e.substring(0,n):e,o=N.fileExtensionToString(t);return"".concat(i).concat(o)}static validateName(e){var t=[".",".."],n=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new Bn("Name cannot be empty");if(t.includes(e))throw new Bn('"'.concat(e,'" is a reserved name'));if(n.test(e)){var o,a;throw new Bn('Invalid characters in name: "'.concat((o=(a=e.match(n))===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(n=>N.isPath(n));return e.filter(n=>!t.some(i=>n!==i&&n.startsWith(i)))}static removeRoot(e,t){if(e.length===0)return t;if(!t.startsWith(e))throw new Error("Filename ".concat(t," does not start with expected root ").concat(e));return t.substring(e.length)}static addRoot(e,t){return"".concat(e).concat(t)}}var Ri=26;function pi(r){return yt(r)?N.makePath(r.filename):N.getPath(r.filename)}function xa(r,e){if(r.length===0||e==null)throw new Error("No items to move");var t=pi(e);if(r.some(n=>{var{filename:i}=n;return N.getPath(i)===t}))throw new Error("File already in the destination folder");if(r.some(n=>yt(n)&&t.startsWith(N.makePath(n.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:r,targetPath:t}}function kb(r){if(yt(r))return r.isExpanded?Vd:Kd;var e=N.getMimeType(r.basename);switch(e){case Nt.PYTHON:return Gd;default:return zd}}function gi(r){var e,{children:t,draggedItems:n,isDragInProgress:i,isDropTargetValid:o,isSelected:a,item:s,itemIndex:l,dropTargetItem:d,onDragStart:h,onDragOver:c,onDragEnd:v,onDrop:f}=r,p=(e=n==null?void 0:n.some(j=>j.id===s.id))!==null&&e!==void 0?e:!1,g=pi(s),b=i&&d?pi(d):null,E=i&&o&&yt(s)&&b===g,x=i&&o&&b===g,P=i&&!o&&b===g,F=kb(s),U=N.getDepth(s.filename),ee=Array(U).fill(null).map((j,W)=>u.jsx("span",{className:"file-list-depth-line"},W));return u.jsxs("div",{className:Y("d-flex w-100 align-items-center","file-list-item",{"is-dragged":p,"is-exact-drop-target":E,"is-in-drop-target":x,"is-invalid-drop-target":P,"is-selected":a}),onDragStart:j=>h(l,j),onDragOver:j=>c(l,j),onDragEnd:j=>v(l,j),onDrop:j=>f(l,j),draggable:!0,role:"presentation","aria-label":s.basename,children:[ee," ",u.jsx(fe,{icon:F,className:"item-icon",fixedWidth:!0})," ",u.jsx("span",{className:"truncation-wrapper",children:t??u.jsxs(u.Fragment,{children:[s.basename,u.jsx(ce,{children:s.basename})]})})]})}function Ia(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function pr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ia(Object(t),!0).forEach(function(n){Mb(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ia(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Mb(r,e,t){return(e=Nb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Nb(r){var e=jb(r,"string");return typeof e=="symbol"?e:e+""}function jb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Be=K.module("FileList"),Ab=500,Da="item-list-scroll-pane";function Lb(r){var{isMultiSelect:e=!1,table:t,onFocusChange:n=()=>{},onMove:i,onSelect:o,onSelectionChange:a=()=>{},renderItem:s=gi,rowHeight:l=Ri,overscanCount:d=at.DEFAULT_OVERSCAN}=r,[h,c]=m.useState(()=>({items:[],offset:0,itemCount:0})),[v,f]=m.useState({top:0,bottom:0}),[p,g]=m.useState(),[b,E]=m.useState(),[x,P]=m.useState(),[F,U]=m.useState([]),ee=m.useRef(),j=m.useRef(null),W=m.useRef(null),H=m.useCallback(D=>{if(D.length===0||h==null)return[];for(var Z=[],se=0;se<D.length;se+=1)for(var me=D[se],He=me[0];He<=me[1];He+=1)He>=h.offset&&He<h.offset+h.items.length&&Z.push(h.items[He-h.offset]);return Z},[h]),ne=m.useCallback(D=>{var Z=H([[D,D]]);if(Z.length>0)return Z[0]},[H]),oe=m.useCallback(()=>{var D=pt.count(F);if(D===0)return null;if(D===1){var Z=F[0][0],se=ne(Z);if(se!=null)return se.filename}return"".concat(D," items")},[ne,F]),L=m.useCallback(D=>{if(!(!b||!p)){Be.debug("dropItems",b,"to",D);try{var{files:Z,targetPath:se}=xa(b,p);if(i==null||i(Z,se),D!=null){var me;U([[D,D]]),(me=j.current)===null||me===void 0||me.focusItem(D)}}catch(He){Be.error("Unable to complete move",He)}}},[b,p,i]),X=m.useCallback((D,Z)=>{var se=h.items[D-h.offset];se!==void 0&&(Be.debug("handleItemClick",se),o(se,Z),yt(se)&&(t==null||t.setExpanded(se.filename,!se.isExpanded)))},[h,o,t]),z=m.useCallback((D,Z)=>{var se,me;Be.debug2("handleItemDragStart",D,F);var He=F;pt.isSelected(F,D)||(He=[[D,D]],U(He)),E(H(He)),(se=j.current)===null||se===void 0||se.resetMouseState();var Pt=document.createElement("div"),Tt=document.createElement("div");Tt.className="dnd-placeholder-content",Tt.innerText=(me=oe())!==null&&me!==void 0?me:"",Pt.appendChild(Tt),Pt.className="file-list-dnd-placeholder",document.body.appendChild(Pt),Z.dataTransfer.setDragImage(Pt,0,0),Z.dataTransfer.effectAllowed="move",P(Pt)},[oe,H,F]),A=m.useCallback((D,Z)=>{Z.preventDefault(),Be.debug2("handleItemDragOver",Z),g(ne(D))},[ne]),V=m.useCallback((D,Z)=>{Be.debug("handleItemDragEnd",D),x==null||x.remove(),E(void 0),g(void 0),P(void 0)},[x]),G=m.useCallback((D,Z)=>{L(D)},[L]),pe=m.useCallback(()=>{Be.debug2("handleItemDragExit"),g(void 0)},[]),Ge=m.useCallback(D=>{D.target instanceof Element&&D.target.classList.contains(Da)&&(D.preventDefault(),Be.debug2("handleListDragOver",D),g({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),je=m.useCallback(D=>{D.target instanceof Element&&D.target.classList.contains(Da)&&(Be.debug("handleListDrop"),L())},[L]),y=m.useCallback(function(D){var Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(Be.debug2("handleSelectionChange",D),Z===!0||D!==F){U(D);var se=H(D);a(se)}},[H,a,F]),w=m.useCallback(D=>{if(Be.debug2("handleFocusChange",D),D!=null){var[Z]=H([[D,D]]);n(Z)}else n();ee.current=D},[H,n]),T=m.useCallback((D,Z)=>{Be.debug("handleViewportChange",D,Z),(D!==v.top||Z!==v.bottom)&&f({top:D,bottom:Z})},[v]),q=m.useMemo(()=>{if(!b||!p)return!1;try{return xa(b,p),Be.debug("handleValidateDropTarget true"),!0}catch{return Be.debug("handleValidateDropTarget false"),!1}},[b,p]),{focusedPath:re}=r;m.useEffect(()=>{re!==void 0&&(re==="/"?t.collapseAll():(t.setExpanded(re,!1),t.setExpanded(re,!0)))},[t,re]),m.useEffect(function(){Be.debug("updating table viewport",v),t==null||t.setViewport({top:Math.max(0,v.top-d),bottom:v.bottom+d})},[d,t,v]),m.useEffect(function(){var Z=t.onUpdate(se=>{c({items:se.items.map(me=>pr(pr({},me),{},{itemName:me.basename})),offset:se.offset,itemCount:t.size})});return()=>{Z()}},[t]),m.useEffect(function(){ee.current!=null&&w(ee.current),F.length>0&&y(F,!0)},[h,w,y,F]),m.useEffect(function(){if(p!=null&&yt(p)&&p.filename!=="/"){var Z=setTimeout(()=>{p.isExpanded||t==null||t.setExpanded(p.filename,!0)},Ab);return()=>clearTimeout(Z)}},[p,t]);var st=m.useCallback(D=>s(pr(pr({},D),{},{isDragInProgress:b!=null,dropTargetItem:p,draggedItems:b,isDropTargetValid:q,onDragStart:z,onDragEnd:V,onDragOver:A,onDragExit:pe,onDrop:G})),[V,pe,A,z,G,b,p,q,s]);return u.jsx("div",{ref:W,className:Y("file-list",{"is-dragging":b!=null}),onDragOver:Ge,onDrop:je,children:u.jsx(at,{ref:j,items:h.items,itemCount:h.itemCount,offset:h.offset,onFocusChange:w,onSelect:X,onSelectionChange:y,onViewportChange:T,selectedRanges:F,renderItem:st,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var Rb={name:"File Explorer",DELETE:he.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[I.DELETE],macShortcut:[k.CMD,I.BACKSPACE]}),RENAME:he.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[I.ENTER],macShortcut:[I.ENTER]})};const ka={FILE_EXPLORER:Rb};var Ma=K.module("FileListItemEditor"),Fb=()=>Promise.resolve();function $b(r){var{item:e,onCancel:t,onSubmit:n,validate:i=Fb}=r,o=m.useRef(null),[a,s]=m.useState(e.basename),[l,d]=m.useState(),[h,c]=m.useState(Promise.resolve()),v=m.useCallback(()=>{var x;(x=o.current)===null||x===void 0||x.focus()},[o]),f=m.useCallback(x=>x.stopPropagation(),[]),p=m.useCallback(()=>{h.then(()=>{n(a)}).catch(x=>Ma.info("Unable to validate name",x))},[n,a,h]);m.useEffect(function(){var P=Te.makeCancelable(i(a));return P.then(()=>d(void 0)).catch(F=>{Te.isCanceled(F)||d(F)}),c(P),()=>P.cancel()},[i,a]),m.useEffect(function(){v()},[v]);var g=m.useCallback(()=>{Ma.debug2("handleBlur"),p()},[p]),b=m.useCallback(x=>{var{value:P}=x.target;s(P)},[]),E=m.useCallback(x=>{x.stopPropagation();var{key:P}=x;switch(P){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:Y("form-control file-list-item-editor-input",{"is-invalid":l}),value:a,ref:o,onBlur:g,onKeyDown:E,onChange:b,onClick:f,onDoubleClick:f,onMouseDown:f}),l&&u.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}function Na(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ti(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Na(Object(t),!0).forEach(function(n){Hb(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Na(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Hb(r,e,t){return(e=Bb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Bb(r){var e=Wb(r,"string");return typeof e=="symbol"?e:e+""}function Wb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Gl(r){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:n=!1,onCreateFile:i,onCreateFolder:o,onCopy:a,onDelete:s,onMove:l,onRename:d,onSelect:h,onSelectionChange:c,table:v,rowHeight:f=Ri,validateRename:p=()=>Promise.resolve()}=r,[g,b]=m.useState(),[E,x]=m.useState([]),[P,F]=m.useState(),U=m.useCallback(G=>{x(G),c==null||c(G)},[c]),ee=m.useCallback(G=>{F(G)},[]),j=m.useCallback(()=>{P&&(a==null||a(P))},[P,a]),W=m.useCallback(()=>{E.length>0&&(s==null||s(E))},[s,E]),H=m.useCallback(()=>{i==null||i()},[i]),ne=m.useCallback(()=>{P&&(o==null||o(N.getPath(P.filename)))},[P,o]),oe=m.useCallback(()=>{P&&b(P)},[P]),L=m.useCallback(()=>{b(void 0)},[]),X=m.useCallback(G=>{g&&(d==null||d(g,G),b(void 0))},[d,g]),z=m.useMemo(()=>{if(g)return[];var G=[];return i&&G.push({title:"New File",description:"Create new file",action:H,group:te.groups.medium}),o&&G.push({title:"New Folder",description:"Create new folder",action:ne,group:te.groups.medium}),a&&G.push({title:"Copy File",description:"Copy the selected file",action:j,group:te.groups.low,disabled:P==null||yt(P)}),s&&E.length>0&&G.push({title:"Delete",description:"Delete",shortcut:ka.FILE_EXPLORER.DELETE,action:W,group:te.groups.low}),d&&G.push({title:"Rename",description:"Rename",shortcut:ka.FILE_EXPLORER.RENAME,action:oe,group:te.groups.low,disabled:P==null}),G},[j,W,H,ne,oe,P,a,i,o,s,d,E,g]),A=m.useCallback(G=>($(g),p(g,G)),[g,p]),V=m.useCallback(G=>{var{item:pe}=G;return g&&g.filename===pe.filename?u.jsx(gi,ti(ti({},G),{},{children:u.jsx($b,{item:pe,validate:A,onSubmit:X,onCancel:L})})):u.jsx(gi,ti({},G))},[L,X,g,A]);return u.jsxs("div",{className:"file-list-container",children:[v!=null&&u.jsx(Lb,{onMove:l,onSelect:h,onSelectionChange:U,onFocusChange:ee,renderItem:V,rowHeight:f,table:v,isMultiSelect:e,focusedPath:t}),n&&u.jsx(te,{actions:z})]})}Gl.displayName="FileListContainer";function ja(r,e,t){return(e=Ub(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ub(r){var e=Vb(r,"string");return typeof e=="symbol"?e:e+""}function Vb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class yr extends Bn{constructor(e){super("Name already exists"),ja(this,"isExistingFile",!0),ja(this,"info",void 0),this.info=e}}function Aa(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function La(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Aa(o,n,i,a,s,"next",l)}function s(l){Aa(o,n,i,a,s,"throw",l)}a(void 0)})}}var St=K.module("FileExplorer");function Fi(r){var{storage:e,isMultiSelect:t=!1,focusedPath:n,onCopy:i=()=>{},onDelete:o=()=>{},onRename:a=()=>{},onCreateFile:s=()=>{},onCreateFolder:l=()=>{},onSelect:d,onSelectionChange:h,rowHeight:c=Ri}=r,[v,f]=m.useState([]),[p,g]=m.useState();m.useEffect(function(){var X;function z(){return A.apply(this,arguments)}function A(){return A=La(function*(){St.debug("initTable"),X=Te.makeCancelable(e.getTable(),V=>V.close());try{g(yield X)}catch(V){Te.isCanceled(V)||St.error("Unable to initialize table",V)}}),A.apply(this,arguments)}return z(),()=>{X.cancel()}},[e]);var b=m.useCallback(L=>{Te.isCanceled(L)||St.error(L)},[]),E=m.useCallback(()=>{St.debug("handleCreateFile"),s()},[s]),x=m.useCallback(()=>{St.debug("handleCreateFolder"),l()},[l]),P=m.useCallback(L=>{St.debug("handleCopyFile",L.filename),i(L)},[i]),F=m.useCallback(L=>{St.debug("handleDelete, pending confirmation",L),f(L)},[]),U=m.useCallback(()=>{St.debug("handleDeleteConfirm",v),v.forEach(L=>e.deleteFile(yt(L)?N.makePath(L.filename):L.filename)),o(v),f([])},[v,o,e]),ee=m.useCallback(()=>{St.debug("handleDeleteCancel"),f([])},[]),j=m.useCallback((L,X)=>{var z=N.reducePaths(L.map(A=>yt(A)?N.makePath(A.filename):A.filename));z.forEach(A=>{var V=N.isPath(A)?"".concat(X).concat(N.getBaseName(A.substring(0,A.length-1)),"/"):"".concat(X).concat(N.getBaseName(A));e.moveFile(A,V).then(()=>{a(A,V)}).catch(b)})},[b,a,e]),W=m.useCallback((L,X)=>{var z=L.filename,A=yt(L);A&&!z.endsWith("/")&&(z="".concat(z,"/"));var V="".concat(N.getParent(z)).concat(X);A&&!V.endsWith("/")&&(V="".concat(V,"/")),St.debug2("handleRename",z,V),e.moveFile(z,V).catch(b),a(z,V)},[b,a,e]),H=m.useCallback(function(){var L=La(function*(X,z){if(z!==X.basename){N.validateName(z);var A="".concat(N.getPath(X.filename)).concat(z);try{var V=yield e.info(A);throw new yr(V)}catch(G){if(!(G instanceof Li))throw G}}});return function(X,z){return L.apply(this,arguments)}}(),[e]),ne=v.length>0,oe=m.useMemo(()=>v.length===1?'Are you sure you want to delete "'.concat(v[0].filename,'"?'):"Are you sure you want to delete the selected files?",[v]);return u.jsxs("div",{className:"file-explorer",children:[p&&u.jsx(Gl,{isMultiSelect:t,focusedPath:n,showContextMenu:!0,onCopy:P,onCreateFolder:x,onCreateFile:E,onMove:j,onDelete:F,onRename:W,onSelect:d,onSelectionChange:h,rowHeight:c,table:p,validateRename:H}),u.jsx(dn,{isOpen:ne,headerText:oe,bodyText:"You cannot undo this action.",onCancel:ee,onConfirm:U,confirmButtonText:"Delete"})]})}Fi.displayName="FileExplorer";function Ra(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function Kb(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Ra(o,n,i,a,s,"next",l)}function s(l){Ra(o,n,i,a,s,"throw",l)}a(void 0)})}}function Ut(r,e,t){return(e=zb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zb(r){var e=Gb(r,"string");return typeof e=="symbol"?e:e+""}function Gb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var tn=K.module("NewItemModal");class Yt extends m.PureComponent{static getValidationMessage(e){return e instanceof yr&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){Te.isCanceled(e)||tn.error(e)}constructor(e){super(e),Ut(this,"inputRef",R.createRef()),Ut(this,"cancelableValidatePromise",void 0),Ut(this,"cancelableExistingItemPromise",void 0),Ut(this,"pending",new qn),Ut(this,"pathMap",new Map),Ut(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,n=N.hasPath(t)?N.getPath(t):"/";this.state={isSubmitting:!1,path:n,prevExtension:N.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:N.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:n}=this.props,{isOpen:i}=e,{value:o,path:a}=this.state;!i&&n&&(this.resetValue(),this.isInitialLoad=!0),i&&n&&(!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=N.hasPath(e)?N.getPath(e):"/";this.setState({path:t,value:N.getBaseName(e),validationError:void 0,prevExtension:N.getExtension(e),isSubmitting:!1})}getValidationPromise(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=Te.makeCancelable(this.validateName(e,t,n)),this.cancelableValidatePromise}validateName(e,t,n){var i=this;return Kb(function*(){N.validateName(t);var{defaultValue:o,storage:a}=i.props;if(n){var s="".concat(e).concat(t);if(s!==o)try{var l=yield a.info(s);throw new yr(l)}catch(d){if(!(d instanceof Li))throw d}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(Yt.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:N.makePath(e.filename)});else{var t=e.basename,n=N.getPath(e.filename);this.setState({value:t,path:n},()=>{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:n}=this.props;n();break}}}handleValidationError(e){if(!(e instanceof Bn))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:n}=this.state;tn.debug("handleOverwriteConfirm",t,n),e("".concat(t).concat(n),!0)}handleExtensionChangeCancel(){tn.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:n}=e,i=N.replaceExtension(t,n);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:n}=e,i=t==="directory"?n.length:n.lastIndexOf(".");e.focus(),e.setSelectionRange(0,i>0?i:n.length)}}submitModal(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.setState(t=>{var{prevExtension:n,value:i,path:o}=t,{notifyOnExtensionChange:a,type:s}=this.props;tn.debug("submitModal",n,i);var l=N.getExtension(i);return a&&!e&&n!==null&&n!==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 yr&&s!=="directory"&&d.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw d}).catch(d=>{throw Te.isCanceled(d)&&this.setState({isSubmitting:!1}),d}).catch(this.handleValidationError).catch(Yt.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((n,i)=>{for(var o="",a=0;a<i;a+=1)o+="".concat(t[a],"/");return o+="".concat(n,"/"),u.jsxs(R.Fragment,{children:[u.jsx(ie,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(o),"aria-label":i===0?"Home":void 0,icon:i===0?u.jsx(fe,{icon:qd,transform:"right-1.6"}):void 0,tooltip:i===0?"Home":void 0,children:n}),"/"]},o)})}render(){var{storage:e,isOpen:t,onCancel:n,placeholder:i,title:o,type:a}=this.props,{isSubmitting:s,path:l,showExtensionChangeModal:d,showOverwriteModal:h,validationError:c,value:v,prevExtension:f,newExtension:p}=this.state,g=a==="directory",b=N.fileExtensionToString(f),E=N.fileExtensionToString(p),x=g?"Create":"Save",P=g?"New folder name":"Save file as";return u.jsxs(u.Fragment,{children:[u.jsxs(Qa,{isOpen:t,toggle:n,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[u.jsx(Ja,{toggle:n,children:o}),u.jsx(es,{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:P}),u.jsx("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:Y("form-control",{"is-invalid":c}),value:v,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),c&&u.jsx("div",{className:"invalid-feedback",children:Yt.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(Fi,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),u.jsxs(Ps,{children:[u.jsx(ie,{kind:"secondary",onClick:n,children:"Cancel"}),u.jsx(ie,{kind:"primary",disabled:s,onClick:this.handleModalSubmit,children:x})]})]}),u.jsx(dn,{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(dn,{isOpen:d,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(b,'" to "').concat(E,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(b,'"'),confirmButtonText:'Use "'.concat(E,'"')})]})}}Ut(Yt,"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});Ut(Yt,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(r,e)=>{},onCancel:()=>{}});function qb(r){var{createFile:e,createFolder:t,onSearchChange:n,defaultSearchText:i=""}=r;return u.jsxs("div",{className:"file-explorer-toolbar",children:[u.jsxs("div",{className:"file-explorer-toolbar-buttons",children:[u.jsx(ie,{kind:"ghost",icon:hs,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),u.jsx(ie,{kind:"ghost",icon:Xd,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),n&&u.jsx("div",{className:"file-explorer-toolbar-search",children:u.jsx(ks,{value:i,onChange:n,placeholder:"Search by name"})})]})}function Fa(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function Xb(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Fa(o,n,i,a,s,"next",l)}function s(l){Fa(o,n,i,a,s,"throw",l)}a(void 0)})}}function ql(r,e,t){return(e=Zb(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Zb(r){var e=Yb(r,"string");return typeof e=="symbol"?e:e+""}function Yb(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var nn=K.module("FileExplorerPanel"),Qb=(r,e)=>{var t=Hs(r),n=rr(r,e.localDashboardId),{session:i,config:o}=n??{},a=o==null?void 0:o.type;return{fileStorage:t,language:a,session:i}},Jb=In(Qb,null,null,{forwardRef:!0});function ey(r){var e=r;return e!=null&&typeof e.button=="number"}class xn extends R.Component{static handleError(e){nn.error(e)}static isFocusEvent(e){return ey(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:n}=e;this.state={isShown:!1,language:n,session:t,showCreateFolder:!1,focusedFilePath:"/"}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){var{glEventHub:e}=this.props,{session:t,language:n}=this.state,i={language:n,value:""};nn.debug("handleCreateFile",t,n,i),e.emit(J.CREATE_NOTEBOOK,t,n,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(xn.handleError)}handleCopyFile(e){var t=this;return Xb(function*(){var{fileStorage:n}=t.props;if(yt(e)){nn.error("Invalid item in handleCopyItem",e);return}var i=yield N.getUniqueCopyFileName(n,e.filename);yield n.copyFile(e.filename,i)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(n=>{t.emit(J.CLOSE_FILE,{id:n.filename,itemName:n.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=N.makePath(e[0].filename):t=N.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(nn.debug("fileSelect",e),e.type!=="directory"){var n=xn.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(J.SELECT_NOTEBOOK,a,s,l,i,n)}}handleRename(e,t){var{glEventHub:n}=this.props;nn.debug("handleRename",e,t),n.emit(J.RENAME_FILE,e,t)}handleSessionOpened(e,t){var{language:n}=t;this.setState({session:e,language:n})}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:n}=this.props,{isShown:i,showCreateFolder:o,focusedFilePath:a}=this.state;return u.jsxs(nr,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:n,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[u.jsx(qb,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&u.jsx(Fi,{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(Yt,{isOpen:o,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:a})]})}}ql(xn,"COMPONENT","FileExplorerPanel");ql(xn,"TITLE","File Explorer");var ty=Jb(xn);function Gn(r,e,t){return(e=ny(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ny(r){var e=ry(r,"string");return typeof e=="symbol"?e:e+""}function ry(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var $a=K.module("LogPanel");class Hr extends m.PureComponent{constructor(e){super(e),Gn(this,"isBottomVisible",void 0),Gn(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){$a.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){$a.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){var{glContainer:e,glEventHub:t}=this.props,{session:n}=this.state;return u.jsxs(nr,{componentPanel:this,glContainer:e,glEventHub:t,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[n==null&&u.jsx("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),n!=null&&u.jsx(Se,{session:n,ref:i=>{this.logView=i}})]})}}Gn(Hr,"defaultProps",{session:null});Gn(Hr,"COMPONENT","LogPanel");Gn(Hr,"TITLE","Log");var iy=(r,e)=>{var t;return{session:(t=rr(r,e.localDashboardId))===null||t===void 0?void 0:t.session}},oy=In(iy,null,null,{forwardRef:!0})(Hr);function Ha(r,e,t,n,i,o,a){try{var s=r[o](a),l=s.value}catch(d){return void t(d)}s.done?e(l):Promise.resolve(l).then(n,i)}function gr(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var o=r.apply(e,t);function a(l){Ha(o,n,i,a,s,"next",l)}function s(l){Ha(o,n,i,a,s,"throw",l)}a(void 0)})}}function Ba(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ze(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ba(Object(t),!0).forEach(function(n){Re(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ba(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Re(r,e,t){return(e=ay(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ay(r){var e=sy(r,"string");return typeof e=="symbol"?e:e+""}function sy(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ly=m.lazy(()=>ms(()=>import("./MarkdownNotebook-brf_5ixw.js"),__vite__mapDeps([6,4,3,5,7,8,9,10,11,12]),import.meta.url)),ue=K.module("NotebookPanel"),Wa=400;class xe extends m.Component{static handleError(e){Te.isCanceled(e)||ue.error(e)}static unsavedNotebookCount(){return document.querySelectorAll(".".concat(xe.UNSAVED_INDICATOR_CLASS_NAME,".").concat(xe.UNSAVED_STATUS_CLASS_NAME)).length}static languageFromFileName(e){var t=N.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),Re(this,"pending",void 0),Re(this,"debouncedSavePanelState",void 0),Re(this,"debouncedLoad",void 0),Re(this,"notebook",void 0),Re(this,"tabTitleElement",void 0),Re(this,"tabInitOnce",void 0),Re(this,"editor",void 0),Re(this,"getSettings",qt((v,f)=>Ze(Ze({},v),{},{minimap:{enabled:f}}))),Re(this,"getOverflowActions",qt((v,f,p)=>{var g=[{title:"Find",icon:Qd,action:this.handleFind,group:te.groups.high,shortcut:Ve.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:ts,action:this.handleCopy,group:te.groups.medium,order:20},{title:"Rename File",icon:Jd,action:this.handleShowRename,group:te.groups.medium,order:30},{title:"Delete File",icon:ss,action:this.handleDelete,group:te.groups.medium,order:40},{title:"Show Minimap",icon:v?wn:void 0,action:this.handleMinimapChange,group:te.groups.low,shortcut:Ve.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:f?wn:void 0,action:this.handleWordWrapChange,group:te.groups.low,shortcut:Ve.NOTEBOOK.WORDWRAP,order:30}];return this.canFormat()&&(g.push({title:"Format Document",action:this.handleFormat,group:te.groups.low,order:10}),g.push({title:"Format on Save",icon:p?wn:void 0,action:this.handleFormatOnSaveChange,group:te.groups.low,order:15})),g})),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.handleFormatOnSaveChange=this.handleFormatOnSaveChange.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.handleFormat=this.handleFormat.bind(this),this.canFormat=this.canFormat.bind(this),this.getDropdownOverflowActions=this.getDropdownOverflowActions.bind(this),this.pending=new qn,this.debouncedSavePanelState=ln(this.savePanelState.bind(this),Wa),this.debouncedLoad=ln(this.load.bind(this),Wa),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;var{isDashboardActive:t,session:n,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&&N.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:n,sessionLanguage:i,panelState:{fileMetadata:s,settings:a},showCloseModal:!1,showDeleteModal:!1,showSaveAsModal:!1,scriptCode:"",formatOnSave:!1},ue.debug("constructor",e,this.state)}componentDidMount(){var{glContainer:e,glEventHub:t}=this.props,{tab:n}=e;n!=null&&this.initTab(n),this.initNotebookContent(),t.on(J.RENAME_FILE,this.handleRenameFile),t.on(ae.DROPPED,this.handlePanelDropped),e.on(J.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion)}componentDidUpdate(e,t){var{isPreview:n,settings:i}=this.state,{wordWrap:o}=i,{notebookSettings:a}=this.props;n!==t.isPreview&&this.setPreviewStatus(),o!==t.settings.wordWrap&&(this.updateEditorWordWrap(),this.debouncedSavePanelState()),a.isMinimapEnabled!==e.notebookSettings.isMinimapEnabled&&this.updateEditorMinimap()}componentWillUnmount(){this.debouncedSavePanelState.flush(),this.pending.cancel();var{glEventHub:e,glContainer:t}=this.props,{fileMetadata:n,isPreview:i}=this.state;e.off(J.RENAME_FILE,this.handleRenameFile),e.off(ae.DROPPED,this.handlePanelDropped),t.off(J.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion),e.emit(J.UNREGISTER_FILE,n,i)}initTab(e){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(e)}initTabCloseOverride(){var{glContainer:e}=this.props;e.beforeClose(t=>{if((t==null?void 0:t.force)===!0)return!0;var{changeCount:n,savedChangeCount:i}=this.state;return n!==i?(this.setState({showCloseModal:!0}),!1):!0})}initTabClasses(e){var t=e.element.get(0);$(t);var n=t.querySelector(".lm_title");this.tabTitleElement=n,n==null||n.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){var{changeCount:e,savedChangeCount:t,settings:n}=this.state,{value:i}=n;if(e!==t&&this.notebook){var o=this.notebook.getValue();return o??i}return i}initNotebookContent(){var{fileMetadata:e,settings:t,isPreview:n}=this.state;if(e&&e.id){ue.debug("Init content from file"),this.registerFileMetadata(e,n),this.load();return}if(t.value!=null){ue.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(J.CLOSE_FILE,{id:e})}registerFileMetadata(e,t){var{glEventHub:n,metadata:i}=this.props,{id:o}=i;n.emit(J.REGISTER_FILE,o,e,t)}renameTab(e,t){var{glEventHub:n}=this.props;n.emit(J.RENAME,e,t)}load(){var{fileMetadata:e,settings:t}=this.state;$(e);var{id:n}=e,{fileStorage:i}=this.props;this.pending.add(i.loadFile(n)).then(o=>{var a;ue.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,N.getBaseName(s))}var c=Ze(Ze({},t),{},{language:(a=xe.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&&N.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){ue.debug("saveContent",e,t),this.updateSavedChangeCount();var{fileStorage:n}=this.props;this.pending.add(n.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;ue.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:n,fileMetadata:i,isPreview:o,settings:a}=e,s=this.getNotebookValue(),l=t!==n?s:void 0,d=Ze(Ze({},a),{},{value:s}),h=Ze(Ze({},a),{},{value:l}),c={settings:h,fileMetadata:i,isPreview:o};return ue.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(J.CLOSE_FILE,{id:e,itemName:e},{force:!0}),this.focus()}handleCopy(){var e=this;return gr(function*(){var{fileStorage:t,glEventHub:n,session:i}=e.props,{fileMetadata:o,settings:a}=e.state;$(o);var{language:s}=a,{itemName:l}=o,d=yield N.getUniqueCopyFileName(t,l);ue.debug("handleCopy",o,l,d),yield t.copyFile(l,d);var h={id:d,itemName:d},c={value:null,language:s};n.emit(J.SELECT_NOTEBOOK,i,s,c,h,!0)})()}handleDelete(){ue.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var e=this;return gr(function*(){var{fileStorage:t,glContainer:n,glEventHub:i}=e.props,{fileMetadata:o}=e.state;ue.debug("handleDeleteConfirm",o==null?void 0:o.itemName),e.setState({showDeleteModal:!1}),o&&(N.hasPath(o.itemName)&&(yield N.fileExists(t,o.itemName))?(i.emit(J.CLOSE_FILE,o,{force:!0}),t.deleteFile(o.itemName)):n.close({force:!0}))})()}handleDeleteCancel(){this.setState({showDeleteModal:!1})}handleEditorInitialized(e){this.editor=e}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(e){ue.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(t=>{var{changeCount:n,savedChangeCount:i}=t,{isUndoing:o,isRedoing:a}=e;return o?{changeCount:n-1,savedChangeCount:i}:!a&&n<i?{changeCount:n+1,savedChangeCount:0}:{changeCount:n+1,savedChangeCount:i}}),this.debouncedSavePanelState()}handleFind(){this.notebook&&this.notebook.toggleFind()}updateEditorMinimap(){if(this.editor){var{notebookSettings:e}=this.props;this.editor.updateOptions({minimap:{enabled:e.isMinimapEnabled}})}}handleMinimapChange(){var e,{notebookSettings:t,updateNotebookSettings:n}=this.props,i={isMinimapEnabled:!((e=t.isMinimapEnabled)!==null&&e!==void 0&&e)};n(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,n=t.wordWrap==="on"?"off":"on";return{settings:Ze(Ze({},t),{},{wordWrap:n})}})}handleFormatOnSaveChange(){var e,{notebookSettings:t,updateNotebookSettings:n}=this.props,i={formatOnSave:!((e=t.formatOnSave)!==null&&e!==void 0&&e)};n(i)}handleLinkClick(e){var{notebooksUrl:t,session:n,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==="/"){ue.debug("Ignoring invalid notebook link",a);return}ue.debug("Notebook link clicked, opening",a);var{glEventHub:s}=this.props,l={value:null,language:i},d={id:a,itemName:a};s.emit(J.SELECT_NOTEBOOK,n,i,l,d)}}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(e){var t=e;Te.isCanceled(t)||(Te.isTimedOut(t)&&(t=new Error("File not found.")),ue.error(t),this.setState({error:t,isLoading:!1}))}handleSave(){var e=this;return gr(function*(){ue.debug("handleSave");var{notebookSettings:t}=e.props,{formatOnSave:n=!1}=t;n&&(yield e.handleFormat()),e.save()})()}handleSaveSuccess(e){var t,{fileStorage:n}=this.props,i={id:e.filename,itemName:e.filename},o=(t=xe.languageFromFileName(e.filename))!==null&&t!==void 0?t:"";this.setState(a=>{var{fileMetadata:s}=a,l=Ze(Ze({},a.settings),{},{language:o});return ue.debug("handleSaveSuccess",i,s,l),s&&N.hasPath(s.itemName)&&s.itemName!==i.itemName&&(ue.debug("handleSaveSuccess deleting old file",s.itemName),n.deleteFile(s.itemName).catch(xe.handleError)),{fileMetadata:i,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(i,!1)}handleSaveError(e){Te.isCanceled(e)||(this.setState({savedChangeCount:0}),ue.error(e))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;n&&this.handleOverwrite(e),ue.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}),N.getBaseName(o)!==N.getBaseName(e)){var{metadata:s}=this.props,{id:l}=s;this.renameTab(l,N.getBaseName(e))}this.saveContent(e,a)}}canFormat(){var e;return((e=this.notebook)===null||e===void 0?void 0:e.editor)!=null?ve.canFormat(this.notebook.editor):!1}handleFormat(){var e=this;return gr(function*(){var t;((t=e.notebook)===null||t===void 0?void 0:t.editor)!=null&&(yield ve.formatDocument(e.notebook.editor))})()}handleRenameFile(e,t,n){var{fileMetadata:i,panelState:o}=this.state,{glContainer:a}=this.props;if((i==null?void 0:i.itemName)==="/".concat(t)&&n&&JSON.stringify(o)!==JSON.stringify(n)){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){ue.error("Editor is not initialized.");return}this.runCommand((e=this.notebook.getValue())!==null&&e!==void 0?e:void 0)}handleRunSelected(){if(!this.notebook){ue.error("Editor is not initialized.");return}this.runCommand(this.notebook.getSelectedCommand())}handleSessionOpened(e,t){var{language:n}=t;this.setState({session:e,sessionLanguage:n})}handleSessionClosed(){this.setState({session:void 0,sessionLanguage:void 0})}handleShow(){var e;ue.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){ue.debug("NotebookPanel tab event",e),this.initTab(e)}handleTabFocus(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];ue.debug("handleTabFocus",...t);var{glContainer:i}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!i.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){ue.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handleTabClick(e){ue.debug("handle NotebookPanel tab click"),this.focus(),e.detail===2&&this.removePreviewStatus()}handleTransformLinkUri(e){var{notebooksUrl:t}=this.props,{fileMetadata:n}=this.state;if(e.endsWith("/"))return e;if(e.startsWith("/"))return"".concat(t).concat(e.substring(1));var i=n==null?void 0:n.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 n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{glEventHub:i}=this.props,{session:o,sessionLanguage:a,settings:s}=this.state,l=Ze(Ze({},s),{},{language:t,value:n}),d={id:null,itemName:e};ue.debug("handleCreateNotebook",o,a,l,d),i.emit(J.CREATE_NOTEBOOK,o,a,l,d)}runCommand(e){if(e===void 0||e===""){ue.debug("Ignoring empty command.");return}this.removePreviewStatus();var{glEventHub:t}=this.props;t.emit(Ne.SEND_COMMAND,e,!1,!0)}removePreviewStatus(){this.setState(e=>{var{isPreview:t}=e;if(t){var{fileMetadata:n}=this.state;return n&&this.registerFileMetadata(n,!1),{isPreview:!1}}return null})}getDropdownOverflowActions(){var{notebookSettings:e}=this.props,{isMinimapEnabled:t,formatOnSave:n}=e,{settings:i}=this.state;return this.getOverflowActions(t??!1,this.getSettings(i,t??!1).wordWrap==="on",n??!1)}render(){var e,t,n,{fileStorage:i,glContainer:o,glContainer:{tab:a},glEventHub:s,notebookSettings:l}=this.props,{changeCount:d,savedChangeCount:h,error:c,isDashboardActive:v,isLoaded:f,isLoading:p,isPreview:g,fileMetadata:b,session:E,sessionLanguage:x,settings:P,showCloseModal:F,showDeleteModal:U,showSaveAsModal:ee}=this.state,j=v&&!o.isHidden&&!g,W=(e=b==null?void 0:b.itemName)!==null&&e!==void 0?e:xe.DEFAULT_NAME,H=W.endsWith(".md"),ne=(b==null?void 0:b.id)!=null,oe=this.getSettings(P,(t=l.isMinimapEnabled)!==null&&t!==void 0?t:!1),L=E!=null,X=x===oe.language,z=!f||!L||!X,A=!f,V=[{action:this.handleSave,shortcut:Kt.SAVE},{action:this.handleMinimapChange,shortcut:Ve.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:Ve.NOTEBOOK.WORDWRAP}],G=di.getDisabledRunTooltip(L,X,"Notebook extension","Run"),pe=di.getDisabledRunTooltip(L,X,"Notebook extension","Run Selected"),Ge=[{title:ne?"Rename":"Save As…",order:10,group:te.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:te.groups.high,order:20}],je=a==null?void 0:a.element.find(".lm_title_before").get(0);return u.jsxs(u.Fragment,{children:[je!=null&&Dr.createPortal(u.jsx("span",{className:Y(xe.UNSAVED_INDICATOR_CLASS_NAME,{[xe.UNSAVED_STATUS_CLASS_NAME]:d!==h})}),je),u.jsxs(nr,{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:Ge,renderTabTooltip:()=>W,children:[!H&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"notebook-toolbar",children:[u.jsxs("span",{children:[u.jsx(ie,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:z,icon:u.jsx(fe,{icon:us,transform:"grow-4"}),tooltip:"Run ".concat(Ve.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),G!=null&&u.jsx(ce,{children:G})]}),u.jsxs("span",{children:[u.jsx(ie,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:z,icon:u.jsx(fe,{icon:Zd,transform:"grow-4"}),tooltip:"Run Selected ".concat(Ve.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),pe!=null&&u.jsx(ce,{children:pe})]}),u.jsx(ie,{kind:"ghost",className:"mr-auto",disabled:A,onClick:this.handleSave,icon:Yd,tooltip:"Save ".concat(Kt.SAVE.getDisplayText()),"aria-label":"Save"}),u.jsx(ie,{kind:"ghost",className:"btn-overflow",disabled:A,icon:ds,tooltip:"More Actions...",onClick:()=>{},children:u.jsx(Yn,{actions:this.getDropdownOverflowActions,popperOptions:xe.POPPER_OPTIONS})})]}),u.jsx(ol,{isLoaded:f,isLoading:p,error:c,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:E,sessionLanguage:x,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:oe,focusOnMount:j,ref:y=>{this.notebook=y}})]}),H&&u.jsx(m.Suspense,{fallback:u.jsx(un,{"data-testid":"notebook-panel-loading"}),children:u.jsx(ly,{content:(n=oe.value)!==null&&n!==void 0?n:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri})}),u.jsx(Yt,{isOpen:ee,type:"file",defaultValue:W,title:ne?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:i}),u.jsx(dn,{isOpen:U,headerText:'Are you sure you want to delete "'.concat(W,'"?'),bodyText:"You cannot undo this action.",onCancel:this.handleDeleteCancel,onConfirm:this.handleDeleteConfirm,confirmButtonText:"Delete"}),u.jsx(dn,{isOpen:F,headerText:"Do you want to save the changes you made to ".concat(W,"?"),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(te,{actions:V})]})]})}}Re(xe,"COMPONENT","NotebookPanel");Re(xe,"POPPER_OPTIONS",{placement:"bottom-end"});Re(xe,"DEFAULT_NAME","Untitled");Re(xe,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");Re(xe,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");Re(xe,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,notebookSettings:{isMinimapEnabled:!0}});var dy=(r,e)=>{var t=Hs(r),n=Ws(r),i=rr(r,e.localDashboardId),{session:o,config:a}=i??{},{type:s}=a??{};return{fileStorage:t,notebookSettings:n,session:o,sessionLanguage:s}},rn=In(dy,{updateNotebookSettings:Cc},null,{forwardRef:!0})(xe);function uy(){var{python:{linter:r={}}={}}=fg(Ws),{isEnabled:e=!1,config:t}=r;m.useEffect(function(){B.isRuffEnabled=e,B.setRuffSettings(t)},[e,t])}function Ua(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Va(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ua(Object(t),!0).forEach(function(n){hy(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ua(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function hy(r,e,t){return(e=cy(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function cy(r){var e=my(r,"string");return typeof e=="symbol"?e:e+""}function my(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var we=K.module("ConsolePlugin");function Ka(r){return r.notebook!==void 0}function vy(r){Jp(r)}function m0(r){vy(r);var{id:e,hydrateConsole:t,layout:n,panelManager:i,registerComponent:o,notebooksUrl:a}=r,s=m.useRef(0),[l,d]=m.useState(new Map),[h,c]=m.useState(new Map);uy();var v=bi(),f=m.useCallback(()=>i.getLastUsedPanelOfType(ei),[i]),p=m.useCallback((y,w)=>{d(T=>new Map(T.set(y,w)))},[d]),g=m.useCallback(y=>{d(w=>(w.delete(y),new Map(w)))},[d]),b=m.useCallback((y,w)=>{c(T=>new Map(T.set(y,w)))},[c]),E=m.useCallback(y=>{c(w=>(w.delete(y),new Map(w)))},[c]),x=m.useCallback(function(y){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,T=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,q=y&&y.trim();if(!q)we.info("Ignoring empty code");else{var re=f();if(!re||!(re instanceof ei.WrappedComponent)){we.error("Console panel not found");return}we.debug("Send command: ",y,w,T),re.addCommand(y,w,T)}},[f]),P=m.useCallback(y=>{v(hb(e,y))},[v,e]),F=m.useCallback(y=>{var{language:w}=y,T=w==="python"?"py":w,q=null;return T==null?(we.debug("No extension for language",w),q="Untitled-".concat(s.current)):q="Untitled-".concat(s.current,".").concat(T),s.current+=1,q},[]),U=m.useCallback(function(y){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{id:T}=y;if(T!=null&&l.has(T))return l.get(T);if(T!=null&&h.has(T))return h.get(T);if(w)return Et()},[l,h]),ee=m.useCallback((y,w)=>{O.renameComponent(n.root,{id:y},w)},[n.root]),j=m.useCallback((y,w)=>{we.debug("Rename file panel",y,w);var T;if(l.has(y)&&(T=l.get(y),g(y),T!=null&&p(w,T)),h.has(y)&&(T=h.get(y),E(y),T!=null&&b(w,T)),T===void 0){we.debug2("File ".concat(y," isn't open, no need to rename the tab"));return}ee(T,N.getBaseName(w))},[l,h,ee,p,b,g,E]),W=m.useCallback(y=>{var w=U(y,!1);if(w==null){we.error("Could not find panel id for file metadata",y);return}O.activateTab(n.root,{id:w})},[U,n.root]),H=m.useCallback((y,w,T)=>{if(we.debug("registerFilePanel",y,w,T),w==null||w.id==null){we.debug("Ignore empty file id",w);return}var{id:q}=w;if(T){b(q,y);return}if(l.has(q)){var re=l.get(q);if(y===re){we.debug("Update tab title for file ".concat(q));var{itemName:st}=w;j(q,st)}else we.error("File ".concat(q," already associated with a different tab ").concat(re));return}p(q,y),h.has(q)&&E(q)},[l,h,j,p,b,E]),ne=m.useCallback((y,w)=>{if(we.debug("unregisterFileTab",y,w),y==null||y.id==null){we.debug("Ignore empty file id",y);return}var{id:T}=y;if(w){E(T);return}g(T)},[g,E]),oe=m.useCallback((y,w)=>{we.debug("closeFilePanel",y);var{id:T}=y,q=null,re=!1;if(l.has(T))q=l.get(T);else if(h.has(T))q=h.get(T),re=!0;else{we.debug("File ".concat(T," isn't open, ignore close event"));return}ne(y,re),O.closeComponent(n.root,{id:q},w)},[n.root,l,h,ne]),L=m.useCallback(y=>{var{itemName:w}=y;return N.getBaseName(w)},[]),X=m.useCallback(y=>{var{id:w}=y;return we.debug("fileIsOpen",y,w,l),w!=null&&l.has(w)},[l]),z=m.useCallback(y=>{var{id:w}=y;return we.debug("fileIsOpenAsPreview",y,w,h),w!=null&&h.has(w)},[h]),A=m.useCallback(y=>{if(y!=null){var w=i.getOpenedPanelById(y);w&&Ka(w)&&w.focus()}},[i]),V=m.useCallback(y=>{var{id:w,settings:T,fileMetadata:q,session:re,sessionLanguage:st,isPreview:D=!1}=y,Z={settings:T,fileMetadata:q},se=L(q);return{type:"react-component",component:rn.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:w},session:re,sessionLanguage:st,panelState:Z,isPreview:D,notebooksUrl:a},title:se,id:w}},[L,e,a]),G=m.useCallback(function(y,w,T){var q=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{id:null,itemName:F(T)},re=U(q);if(X(q)&&re!=null){we.debug("File is already open, focus panel"),W(q),A(re);return}var st=O.getStackForComponentTypes(n.root,[rn.COMPONENT]),D=V({id:re,settings:T,fileMetadata:q,session:y,sessionLanguage:w});we.debug("createNotebook",D,l),O.openComponentInStack(st,D)},[X,A,F,U,n.root,V,l,W]),pe=m.useCallback(function(y,w,T,q){var re=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;we.debug("selectNotebook",q,re);var st=X(q),D=z(q),[Z]=[...h.values()],se=!re,me=se&&Z?Z:U(q);if(me==null||me==="")throw new Error("Unable to retrieve or create panelId for metadata",q);if(st||D)W(q);else{var He=O.getStackForComponentTypes(n.root,[rn.COMPONENT]),Pt=V({id:me,settings:T,fileMetadata:q,session:y,sessionLanguage:w,isPreview:se});O.openComponentInStack(He,Pt)}if(D&&re){var Tt=q.id,Ur=O.getStackForConfig(n.root,{component:rn.COMPONENT,id:me}),Mn=O.getContentItemInStack(Ur,{component:rn.COMPONENT,id:me});Mn&&Qe(Mn)&&(Mn.container.emit(J.PROMOTE_FROM_PREVIEW),E(Tt),p(Tt,me))}re&&A(me)},[W,X,z,A,U,n.root,V,h,E,p]),Ge=m.useCallback(function(y,w){var T=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},q=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,re=i.getLastUsedPanelOfType(rn);re&&Ka(re)?T!=null&&T.value!=null&&re.notebook!=null&&re.notebook.append(T.value):q&&G(y,w,T)},[G,i]),je=m.useCallback((y,w)=>sg.hydrate(Va(Va({},y),{},{notebooksUrl:a}),w),[a]);return An(o,ei,t),An(o,fb),An(o,ty),An(o,oy),An(o,rn,je),Le(n.eventHub,Ne.SEND_COMMAND,x),Le(n.eventHub,Ne.SETTINGS_CHANGED,P),Le(n.eventHub,J.CLOSE_FILE,oe),Le(n.eventHub,J.CREATE_NOTEBOOK,G),Le(n.eventHub,J.SELECT_NOTEBOOK,pe),Le(n.eventHub,J.RENAME,ee),Le(n.eventHub,J.RENAME_FILE,j),Le(n.eventHub,J.SEND_TO_NOTEBOOK,Ge),Le(n.eventHub,J.REGISTER_FILE,H),Le(n.eventHub,J.UNREGISTER_FILE,ne),null}function Br(r,e,t){return(e=fy(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function fy(r){var e=py(r,"string");return typeof e=="symbol"?e:e+""}function py(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Wr{}Br(Wr,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");Br(Wr,"INPUT_FILTER","ControlType.INPUT_FILTER");Br(Wr,"MARKDOWN","ControlType.MARKDOWN");Br(Wr,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");export{NC as $,Gy as A,ie as B,Mr as C,Je as D,qy as E,tl as F,_s as G,Fe as H,mt as I,Ws as J,I as K,Cc as L,B as M,Kt as N,Kn as O,Te as P,Oy as Q,pm as R,Ns as S,_ as T,Wr as U,VC as V,Yn as W,Vs as X,Nr as Y,nC as Z,jl as _,be as a,yi as a$,Jt as a0,yc as a1,Xy as a2,pg as a3,$e as a4,vc as a5,QC as a6,rr as a7,jy as a8,Bs as a9,eC as aA,tC as aB,JC as aC,e0 as aD,Zy as aE,Jy as aF,Us as aG,Qy as aH,ve as aI,_y as aJ,Hu as aK,Xn as aL,zu as aM,Bu as aN,Es as aO,ws as aP,Wu as aQ,Uu as aR,pt as aS,at as aT,Ci as aU,ks as aV,Hh as aW,jr as aX,k as aY,Ps as aZ,kr as a_,sg as aa,au as ab,gs as ac,LC as ad,J as ae,_t as af,CC as ag,wC as ah,_C as ai,TC as aj,ae as ak,UC as al,RC as am,HC as an,rn as ao,Gp as ap,ac as aq,nu as ar,Zn as as,m0 as at,te as au,dn as av,u0 as aw,rC as ax,Yy as ay,iC as az,gt as b,Ve as b$,Ty as b0,Bh as b1,Si as b2,Iy as b3,xs as b4,js as b5,Os as b6,bh as b7,Cr as b8,tc as b9,iv as bA,fC as bB,vC as bC,Oi as bD,pC as bE,rf as bF,Yv as bG,of as bH,Gt as bI,Ks as bJ,Ue as bK,_r as bL,al as bM,Ar as bN,zs as bO,Ac as bP,Xs as bQ,Gs as bR,_n as bS,qs as bT,Pn as bU,Pv as bV,Sr as bW,Zs as bX,lf as bY,Se as bZ,li as b_,Rs as ba,Ls as bb,As as bc,Dy as bd,ky as be,My as bf,Lm as bg,Rm as bh,Ee as bi,Um as bj,nv as bk,Q as bl,Gm as bm,Me as bn,oC as bo,Js as bp,el as bq,lC as br,hC as bs,aC as bt,sC as bu,dC as bv,Ym as bw,cC as bx,mC as by,rv as bz,C as c,Cb as c$,ol as c0,di as c1,vs as c2,O as c3,An as c4,yC as c5,MC as c6,qg as c7,Ag as c8,jg as c9,IC as cA,BC as cB,$C as cC,SC as cD,PC as cE,EC as cF,OC as cG,jC as cH,WC as cI,Le as cJ,Sg as cK,l0 as cL,Ai as cM,d0 as cN,zl as cO,h0 as cP,kn as cQ,Wl as cR,wb as cS,Sb as cT,yb as cU,Vl as cV,gb as cW,pb as cX,a0 as cY,bb as cZ,s0 as c_,Jr as ca,Al as cb,xg as cc,ug as cd,Il as ce,rg as cf,Ni as cg,Mi as ch,kl as ci,cr as cj,Jp as ck,Ol as cl,Lg as cm,FC as cn,DC as co,kC as cp,Nl as cq,xl as cr,Qp as cs,qp as ct,Zp as cu,Xp as cv,Yp as cw,bC as cx,cg as cy,xC as cz,Dn as d,Ul as d0,_a as d1,Ey as d2,Gi as d3,Lr as d4,AC as d5,zp as d6,N as d7,Li as d8,c0 as d9,YC as dA,hb as dB,uy as dC,Sy as dD,Py as dE,wy as dF,Kr as dG,hu as dH,Vr as dI,uC as dJ,Bn as dK,ei as da,oy as db,fb as dc,ty as dd,ys as de,Cy as df,nr as dg,Cs as dh,Qt as di,r0 as dj,qn as dk,qC as dl,XC as dm,ZC as dn,GC as dp,Hl as dq,KC as dr,o0 as ds,zC as dt,yt as du,Bl as dv,t0 as dw,n0 as dx,i0 as dy,Ne as dz,Sc as e,Ry as f,Ly as g,Fy as h,Ny as i,Hy as j,By as k,Wy as l,Uy as m,Vy as n,Ky as o,mc as p,Ay as q,Ce as r,he as s,ce as t,oc as u,_e as v,zy as w,xy as x,$y as y,fg as z};
|
|
24
|
+
//# sourceMappingURL=ControlType-FC3HoMsR.js.map
|