@deephaven/code-studio 0.53.0 → 0.53.1-beta.2
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-e4b51b3e.js → AppRoot-3b369670.js} +2 -2
- package/build/assets/{AppRoot-e4b51b3e.js.map → AppRoot-3b369670.js.map} +1 -1
- package/build/assets/{ControlType-19f7d4f3.js → ControlType-1b6b0693.js} +2 -2
- package/build/assets/{ControlType-19f7d4f3.js.map → ControlType-1b6b0693.js.map} +1 -1
- package/build/assets/{IrisGridModelFactory-6d7566dc.js → IrisGridModelFactory-f04790a8.js} +2 -2
- package/build/assets/IrisGridModelFactory-f04790a8.js.map +1 -0
- package/build/assets/{PluginTypes-2b0ef082.js → PluginTypes-d6d1d60d.js} +2 -2
- package/build/assets/{PluginTypes-2b0ef082.js.map → PluginTypes-d6d1d60d.js.map} +1 -1
- package/build/assets/{index-81fc0d6a.js → index-485770e6.js} +4 -4
- package/build/assets/{index-81fc0d6a.js.map → index-485770e6.js.map} +1 -1
- package/build/assets/{index-aca484e9.js → index-5f14eca3.js} +2 -2
- package/build/assets/{index-aca484e9.js.map → index-5f14eca3.js.map} +1 -1
- package/build/assets/{index-9826fe01.js → index-71585b92.js} +2 -2
- package/build/assets/{index-9826fe01.js.map → index-71585b92.js.map} +1 -1
- package/build/assets/{useUser-da266903.js → useUser-bd84d546.js} +2 -2
- package/build/assets/{useUser-da266903.js.map → useUser-bd84d546.js.map} +1 -1
- package/build/index.html +1 -1
- package/package.json +31 -31
- package/build/assets/IrisGridModelFactory-6d7566dc.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as d,G as he,r as m,aq as Ro,N as H,F as de,H as se,S as tt,ar as Qt,I as vs,K as an,L as Ao,an as ln,as as Di,at as Fo,au as jo,av as ko,aw as Ho,ax as I,R as Mi,ay as Yi,a1 as en,az as $o,ap as fs,aA as Uo,M as mn,ao as Bo,aB as Wo}from"./vendor-9bc0b4ef.js";import{w as ps,ai as zo,af as gs,ag as bs,F as Cs,j as Vo,e as A,d as Yt,aj as Ko,L as ie,ak as qi,al as Go,am as Yo,an as qo,ao as Xo,f as ys,a8 as _s,ap as Ss,J as tn,G as Ni,ae as Zo,aq as Jo,ar as Qo,as as Xi,at as Un,au as Zi,av as ws,aw as ea,C as ta,ax as na,ay as ia,az as ra,aA as sa,aB as oa,M as aa,b as la,c as da,aC as ha,aD as ua,aa as ca,aE as ma,aF as va,aG as fa}from"./index-
|
|
1
|
+
import{C as d,G as he,r as m,aq as Ro,N as H,F as de,H as se,S as tt,ar as Qt,I as vs,K as an,L as Ao,an as ln,as as Di,at as Fo,au as jo,av as ko,aw as Ho,ax as I,R as Mi,ay as Yi,a1 as en,az as $o,ap as fs,aA as Uo,M as mn,ao as Bo,aB as Wo}from"./vendor-9bc0b4ef.js";import{w as ps,ai as zo,af as gs,ag as bs,F as Cs,j as Vo,e as A,d as Yt,aj as Ko,L as ie,ak as qi,al as Go,am as Yo,an as qo,ao as Xo,f as ys,a8 as _s,ap as Ss,J as tn,G as Ni,ae as Zo,aq as Jo,ar as Qo,as as Xi,at as Un,au as Zi,av as ws,aw as ea,C as ta,ax as na,ay as ia,az as ra,aA as sa,aB as oa,M as aa,b as la,c as da,aC as ha,aD as ua,aa as ca,aE as ma,aF as va,aG as fa}from"./index-485770e6.js";import{u as pa,d as Es,B as ne,e as xe,V as oe,K as re,az as ga,M as ze,P as Ee,G as Bn,n as q,at as ba,D as Ps,C as Ca,j as nn,k as Ts,au as $t,s as ya,f as Ot,av as _a,as as Sa,J as pi,X as wa,x as Ea,ai as Pa,ah as En,H as Ta,m as Oa,ay as Os,y as Ia,ar as xa,aA as rn,R as Ji,o as dn,W as Da,Q as Ma}from"./PluginTypes-d6d1d60d.js";import{e as Li,l as Pn,K as sn,a as Is}from"./monaco-1410cbed.js";function Na(i){var{type:e}=i,t=pa();switch(e){case t.VariableType.TABLE:case t.VariableType.TABLEMAP:case t.VariableType.TREETABLE:case t.VariableType.HIERARCHICALTABLE:return d.jsx(he,{icon:bs});case t.VariableType.FIGURE:return d.jsx(he,{icon:gs});case t.VariableType.PANDAS:return d.jsx(he,{icon:zo});default:return d.jsx(he,{icon:ps})}}function La(i,e,t){return e=Ra(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ra(i){var e=Aa(i,"string");return typeof e=="symbol"?e:String(e)}function Aa(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Fa extends m.Component{constructor(e){super(e),La(this,"container",void 0),this.container=null}componentDidMount(){this.colorize()}colorize(){var{children:e}=this.props;this.container&&e!=null&&Li.colorizeElement(this.container,{theme:"dh-dark"})}render(){var{children:e,language:t}=this.props;return d.jsx("div",{children:d.jsx("div",{"data-lang":t,ref:n=>{this.container=n},style:{pointerEvents:"none"},children:e})})}}const Ri=Fa;class ja{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}const xs=ja;class Wn{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)?[]:Ro.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"),r="".concat(e.getSeconds()).padStart(2,"0"),s="".concat(e.getMilliseconds()).padStart(3,"0");return"".concat(t,":").concat(n,":").concat(r,".").concat(s)}static isTableType(e,t){return t===e.VariableType.TABLE||t===e.VariableType.TREETABLE||t===e.VariableType.HIERARCHICALTABLE}static isWidgetType(e,t){return t===e.VariableType.FIGURE||t===e.VariableType.OTHERWIDGET||t===e.VariableType.PANDAS}static isOpenableType(e,t){return Wn.isTableType(e,t)||Wn.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}const gi=Wn;function Ds(i){var{children:e}=i;return d.jsxs("div",{className:"console-history-item-result",children:[d.jsx("div",{className:"console-history-gutter",children:"-"}),d.jsx("div",{className:"console-history-content",children:e})]})}Ds.propTypes={children:H.node.isRequired};function bi(i,e,t){return e=ka(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ka(i){var e=Ha(i,"string");return typeof e=="symbol"?e:String(e)}function Ha(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Ms extends m.Component{constructor(e){super(e),bi(this,"timer",void 0),bi(this,"startTime",void 0),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer&&clearInterval(this.timer),this.timer=void 0}updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){var{disabled:e,onCancelClick:t}=this.props,{elapsed:n}=this.state;return d.jsx("div",{className:de("console-history-result-in-progress",{disabled:e}),children:d.jsxs("span",{className:"badge",children:[d.jsx(Cs,{}),"Running... ",Es.formatElapsedTime(n)," ",d.jsx(ne,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:Vo,tooltip:"Cancel",onClick:t,disabled:e})]})})}}bi(Ms,"defaultProps",{disabled:!1});const $a=Ms;function on(i,e,t){return e=Ua(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ua(i){var e=Ba(i,"string");return typeof e=="symbol"?e:String(e)}function Ba(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class jt extends m.PureComponent{constructor(e){super(e),on(this,"mouseX",void 0),on(this,"mouseY",void 0),on(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)>=jt.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=jt.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;A(n);var r=n.indexOf(`
|
|
2
2
|
`),s=r>-1,o=n;s&&(o=n.slice(0,r));var a=n.slice(r),l=t?"error-btn-link error-btn-link--active":"error-btn-link";return d.jsxs("div",{className:de("error-message",{expanded:e}),children:[s&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"error-gutter",children:d.jsx("button",{type:"button",onClick:this.handleToggleError,className:l,tabIndex:-1,children:d.jsx(he,{icon:e?Yt:Ko,transform:"left-3"})})}),d.jsxs("div",{className:"error-content",children:[d.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:o}),e?a:""]})]}),!s&&d.jsx("div",{className:"error-content",children:d.jsx("div",{className:"console-error-text",children:o})})]},"error")}}on(jt,"defaultProps",{message:""});on(jt,"mouseDragThreshold",5);const Wa=jt;function za(i,e,t){return e=Va(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Va(i){var e=Ka(i,"string");return typeof e=="symbol"?e:String(e)}function Ka(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Qi=ie.module("ConsoleHistoryItem");class Ns extends m.PureComponent{constructor(e){super(e),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){Qi.debug("handleObjectClick",e);var{openObject:t}=this.props;t(e)}handleCancelClick(){var{item:e}=this.props;e!=null&&e.cancelResult&&(Qi.debug("Cancelling command: ".concat(e.command)),e.cancelResult())}render(){var{disabled:e,item:t,language:n,iconForType:r}=this.props,{disabledObjects:s,result:o}=t,a=t.command!=null&&t.command!=="",l=null;a&&(l=d.jsxs("div",{className:"console-history-item-command",children:[d.jsx("div",{className:"console-history-gutter",children:">"}),d.jsx("div",{className:"console-history-content",children:d.jsx(Ri,{language:n,children:t.command})})]}));var h=[],u=!1;if(o){var{error:c,message:v,changes:f}=o;if(f){var{created:p,updated:b}=f;[...p,...b].forEach(X=>{u=!0;var{title:N}=X,V="".concat(N),K=e===void 0||e||(s??[]).indexOf(V)>=0,z=d.jsx(ne,{kind:"primary",onClick:()=>this.handleObjectClick(X),className:"btn-console-object",disabled:K,icon:r(X.type),children:N},V);h.push(z)})}if(c!=null&&!a){var C,S="".concat((C=c.message)!==null&&C!==void 0?C:c);S||(S=c);var T=d.jsx(Wa,{message:S},"result-error");h.push(T)}if(v!==void 0&&v!==""){var E=d.jsx("div",{className:"log-message",children:v},"log-message");h.push(E)}}else{u=!0;var F=d.jsx($a,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");h.push(F)}var B=null;return h.length>0&&(B=d.jsx(Ds,{children:h})),d.jsxs("div",{className:de("console-command-result",{"console-result-buttons":u}),children:[l,B]})}}za(Ns,"defaultProps",{disabled:!1});const Ga=Ns;function Ya(i,e){return"".concat(i,".").concat(e.command,".").concat(e.result&&e.result.message,".").concat(e.result&&e.result.error)}function qa(i){for(var{disabled:e=!1,items:t,language:n,openObject:r,supportsType:s,iconForType:o}=i,a=[],l=0;l<t.length;l+=1){var h=t[l],u=d.jsx(Ga,{disabled:e,item:h,openObject:r,language:n,supportsType:s,iconForType:o},Ya(l,h));a.push(u)}return d.jsx("div",{className:"container-fluid console-history",children:a})}var Xa={name:"Console",CLEAR:xe.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[oe.CTRL,re.L],macShortcut:[oe.CTRL,re.C]}),FOCUS_HISTORY:xe.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[oe.CTRL,re.H],macShortcut:[oe.CTRL,oe.OPTION,re.H]})},Za={name:"Command History",FOCUS_HISTORY:xe.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[oe.CTRL,re.H],macShortcut:[oe.CTRL,oe.OPTION,re.H]}),SEND_TO_CONSOLE:xe.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[re.ENTER],macShortcut:[re.ENTER]}),SEND_TO_NOTEBOOK:xe.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[oe.CTRL,re.ENTER],macShortcut:[oe.CMD,re.ENTER]}),RUN:xe.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[oe.ALT,re.R],macShortcut:[oe.OPTION,re.R]})},Ja={name:"Notebook",RUN:xe.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[oe.ALT,re.R],macShortcut:[oe.OPTION,re.R]}),RUN_SELECTED:xe.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[oe.ALT,oe.SHIFT,re.R],macShortcut:[oe.OPTION,oe.SHIFT,re.R]}),FIND:xe.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[oe.CTRL,re.F],macShortcut:[oe.CMD,re.F],isEditable:!1}),MINIMAP:xe.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[oe.ALT,re.M],macShortcut:[oe.OPTION,re.M]}),WORDWRAP:xe.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[oe.ALT,re.Z],macShortcut:[oe.OPTION,re.Z]})},Qa={CONSOLE:Xa,COMMAND_HISTORY:Za,NOTEBOOK:Ja};const Ie=Qa,be=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"});function oi(i,e,t){return e=el(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function el(i){var e=tl(i,"string");return typeof e=="symbol"?e:String(e)}function tl(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var it=ie.module("MonacoCompletionProvider");class Et extends m.PureComponent{static lspToMonacoKind(e){var t=Pn.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}}constructor(e){super(e),oi(this,"registeredCompletionProvider",void 0),oi(this,"registeredSignatureProvider",void 0),oi(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=Pn.registerCompletionItemProvider(e,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),t.getSignatureHelp&&(this.registeredSignatureProvider=Pn.registerSignatureHelpProvider(e,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),t.getHover&&(this.registeredHoverProvider=Pn.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:r,session:s}=this.props;if(e!==r)return null;var o={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:Et.monacoToLspPosition(t),context:n},a=s.getCompletionItems(o);it.debug("Requested completion items",o);var l=a.then(h=>{it.debug("Completion items received: ",o,h);var u=h.map(c=>{var{label:v,kind:f,detail:p,documentation:b,sortText:C,filterText:S,textEdit:T,insertTextFormat:E}=c;return{label:v,kind:Et.lspToMonacoKind(f),detail:p,documentation:b?.kind==="markdown"?b:b?.value,sortText:C,filterText:S,insertText:T.text,insertTextRules:E===2?4:E,range:Et.lspToMonacoRange(T.range)}});return{incomplete:!0,suggestions:u}}).catch(h=>(it.error("There was an error retrieving completion items",h),{suggestions:[]}));return l}handleSignatureRequest(e,t,n,r){var s={value:{signatures:[],activeSignature:0,activeParameter:0},dispose:()=>{}},{model:o,session:a}=this.props;if(e!==o||!a.getSignatureHelp)return null;var l={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:Et.monacoToLspPosition(t),context:r},h=a.getSignatureHelp(l);it.debug("Requested signature help",l);var u=h.then(c=>{it.debug("Signatures received: ",l,h);var v=c.map(p=>{var{label:b,documentation:C,parameters:S}=p;return{documentation:C?.kind==="markdown"?C:C?.value,label:b,parameters:S??[]}});if(v.length===0)return s;var f=0;return{value:{signatures:v,activeSignature:f,activeParameter:c[f].activeParameter},dispose:()=>{}}}).catch(c=>(it.error("There was an error retrieving completion items",c),s));return u}handleHoverRequest(e,t){var{model:n,session:r}=this.props;if(e!==n||!r.getHover)return null;var s={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:Et.monacoToLspPosition(t)},o=r.getHover(s);it.debug("Requested hover",s);var a=o.then(l=>{it.debug("Hover received: ",s,l);var{contents:h}=l;return{contents:h?[h]:[]}}).catch(l=>(it.error("There was an error retrieving hover",l),{contents:[]}));return a}render(){return null}}const Ls=Et;function er(i,e,t,n,r,s,o){try{var a=i[s](o),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(n,r)}function nl(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){er(s,n,r,o,a,"next",l)}function a(l){er(s,n,r,o,a,"throw",l)}o(void 0)})}}function Be(i,e,t){return e=il(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function il(i){var e=rl(i,"string");return typeof e=="symbol"?e:String(e)}function rl(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var ai=ie.module("ConsoleInput"),zn=parseInt(ga["line-height"],10),Rs=6,As=6,sl=zn+Rs+As,li=100;class vn extends m.PureComponent{constructor(e){super(e),Be(this,"cancelListener",void 0),Be(this,"commandContainer",void 0),Be(this,"commandEditor",void 0),Be(this,"commandHistoryIndex",void 0),Be(this,"commandSuggestionContainer",void 0),Be(this,"loadingPromise",void 0),Be(this,"timestamp",void 0),Be(this,"bufferIndex",void 0),Be(this,"history",void 0),Be(this,"modifiedCommands",void 0),this.handleWindowResize=this.handleWindowResize.bind(this),this.commandContainer=se.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.state={commandEditorHeight:zn,isFocused:!1,model:null}}componentDidMount(){this.initCommandEditor(),window.addEventListener("resize",this.handleWindowResize),this.loadMoreHistory()}componentDidUpdate(){this.layoutEditor()}componentWillUnmount(){window.removeEventListener("resize",this.handleWindowResize),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(ai.debug("Command received: ",e),!n){var r;this.commandHistoryIndex=null,(r=this.commandEditor)===null||r===void 0||r.setValue(e)}t&&this.focusEnd(),this.updateDimensions(),n&&this.processCommand(e)}}initCommandEditor(){var{language:e,session:t}=this.props,n={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:zn,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:Rs,bottom:As},value:"",wordWrap:"on"},r=this.commandContainer.current;A(r),this.commandEditor=Li.create(r,n),ze.setEOL(this.commandEditor),ze.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{var s,o=(s=this.commandEditor)===null||s===void 0?void 0:s.getValue();this.modifiedCommands.set(this.commandHistoryIndex,o??null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(s=>{var{commandEditor:o,commandHistoryIndex:a}=this,l=o?.getPosition();A(l);var{lineNumber:h}=l,u=o?.getModel();if(s.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&h===1){a!=null?this.loadCommand(a+1):this.loadCommand(0),this.focusStart(),s.stopPropagation(),s.preventDefault();return}if(s.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&h===u?.getLineCount()){a!=null&&a>0?this.loadCommand(a-1):this.loadCommand(null),this.focusEnd(),s.stopPropagation(),s.preventDefault();return}if(!s.altKey&&!s.shiftKey&&!s.metaKey&&s.keyCode===sn.Enter&&!this.isSuggestionMenuPopulated()){var c;s.stopPropagation(),s.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("")}}}),ze.disableKeyBindings(this.commandEditor,[Is.CtrlCmd|sn.KeyF]),ze.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){var{session:e}=this.props;this.commandEditor&&(ze.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleWindowResize(){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,r,s,o=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();A(o);var a=o.getLineLength(1)+1,l=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(1,a);A(l),(n=this.commandEditor)===null||n===void 0||n.setPosition({lineNumber:1,column:a}),(r=this.commandEditor)===null||r===void 0||r.setScrollTop(l),(s=this.commandEditor)===null||s===void 0||s.focus()}focusEnd(){var e,t,n,r,s,o=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();A(o);var a=o.getLineCount(),l=o.getLineLength(a)+1,h=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(a,l);A(h),(n=this.commandEditor)===null||n===void 0||n.setPosition({lineNumber:a,column:l}),(r=this.commandEditor)===null||r===void 0||r.setScrollTop(h),(s=this.commandEditor)===null||s===void 0||s.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 r=this.modifiedCommands.get(e),s=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(r??s),e!==null&&e>this.history.length-li&&this.loadMoreHistory()}}loadMoreHistory(){var e=this;return nl(function*(){try{if(e.loadingPromise!=null||e.bufferIndex==null)return;var{commandHistoryStorage:t,language:n,scope:r}=e.props;e.loadingPromise=Ee.makeCancelable(t.getTable(n,r??"",e.timestamp),a=>a.close());var s=yield e.loadingPromise;s.setReversed(!0),s.setViewport({top:e.bufferIndex,bottom:e.bufferIndex+li-1}),e.loadingPromise=Ee.makeCancelable(s.getViewportData(),()=>s.close());var o=yield e.loadingPromise;e.bufferIndex+=li,e.bufferIndex>=s.size&&(e.bufferIndex=null),e.history=[...o.items.filter((a,l,h)=>{var{name:u}=a;return l===0||u!==h[l-1].name}).map(a=>{var{name:l}=a;return l}).reverse(),...e.history],e.loadingPromise=void 0,s.close()}catch(a){if(e.loadingPromise=void 0,Ee.isCanceled(a)){ai.debug2("Promise canceled, not loading history");return}ai.error("Error fetching history",a)}})()}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),A(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;A(e);var t=this.commandEditor.getContentHeight(),n=Math.max(Math.min(t,e),sl),r=t>n,s={overviewRulerLanes:r?void 0:0};this.setState({commandEditorHeight:n},()=>{var o,a;(o=this.commandEditor)===null||o===void 0||o.updateOptions(s),(a=this.commandEditor)===null||a===void 0||a.layout()})}}render(){var{disabled:e,language:t,session:n}=this.props,{commandEditorHeight:r,isFocused:s,model:o}=this.state;return d.jsx("div",{className:de("console-input-wrapper",{disabled:e}),children:d.jsxs("div",{className:de("console-input-inner-wrapper",{focus:s}),children:[d.jsx("div",{className:vn.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:r}}),o&&d.jsx(Ls,{model:o,language:t,session:n})]})})}}Be(vn,"defaultProps",{maxHeight:zn*10,scope:null,disabled:!1});Be(vn,"INPUT_CLASS_NAME","console-input");const tr=vn;function pt(i,e,t){return e=ol(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ol(i){var e=al(i,"string");return typeof e=="symbol"?e:String(e)}function al(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var nr="pasted values",ll=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],di=[".csv",".tsv",".tab",".psv",".dsv",".txt"],ir=[".zip"];class et extends m.Component{static isValidDropItem(e){return e!=null&&e.kind==="file"&&!ll.find(t=>t.test(e.type))}static isValidExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return di.some(n=>e.endsWith(n))||t&&ir.some(n=>e.endsWith(n))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===nr?qi:e.endsWith(".csv")?Go:e.endsWith(".zip")?Yo:qo}constructor(e){super(e),pt(this,"fileElem",void 0),pt(this,"divElem",void 0),pt(this,"getValidExtensions",tt(t=>t?[...di,...ir]:[...di])),pt(this,"getAcceptString",tt(t=>this.getValidExtensions(t).join(", "))),pt(this,"getFileTypeErrorString",tt(t=>ba.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=se.createRef(),this.divElem=se.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:r}=this.props;if(e.preventDefault(),e.stopPropagation(),r!=null){n();return}if(!(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)){var s=e.dataTransfer.items[0].getAsFile();A(s),et.isValidExtension(s.name,t)?this.handleFile(s):this.setState({dropError:et.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(r=>{e(r),this.setState({selectedFileName:nr,dropError:void 0})}).catch(r=>t(r))}handlePasteEvent(e){e.stopPropagation(),e.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){var{uploadInProgress:e}=this.props;return[{title:"Paste",icon:qi,action:this.handleMenuPaste,shortcut:Bn.PASTE,disabled:e}]}render(){var{allowZip:e,dragError:t,uploadInProgress:n}=this.props,{selectedFileName:r,dropError:s}=this.state,o=t??s,a=this.makeContextMenuItems();return d.jsxs("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:et.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[d.jsx(q,{actions:a}),d.jsx("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!r&&(o===void 0||o==="")&&d.jsxs("div",{className:"message-content",children:[d.jsx("div",{className:"message-icon",children:d.jsx(he,{icon:Xo})}),d.jsx("label",{children:"Drop file (or paste values) here to import"}),d.jsx("div",{className:"message-small",children:d.jsx("label",{children:"or"})}),d.jsx(ne,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),r&&(o===void 0||o==="")&&d.jsxs("div",{className:"selected-content",children:[d.jsx("div",{className:"selected-icon",children:d.jsx(he,{icon:et.getIcon(r)})}),d.jsxs("div",{className:"selected-text",children:[d.jsx("label",{children:"Selected File"}),d.jsxs("label",{className:"selected-name",children:[r,!n&&d.jsx(ne,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:ys,tooltip:"Remove"})]})]})]}),!!o&&d.jsxs("div",{className:"message-content",children:[d.jsx("div",{className:"message-icon",children:d.jsx(he,{icon:_s})}),d.jsx("label",{children:o}),o===et.FILE_TYPE_ERROR&&d.jsx("div",{className:"message-small",children:d.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}pt(et,"defaultProps",{allowZip:!1,dragError:null});pt(et,"MULTIPLE_FILE_ERROR","Please select only one file");pt(et,"FILE_TYPE_ERROR","Filetype not supported.");const Rt=et;function It(i,e,t){return e=dl(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function dl(i){var e=hl(i,"string");return typeof e=="symbol"?e:String(e)}function hl(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class bt{}It(bt,"INTEGER","int");It(bt,"LONG","long");It(bt,"DOUBLE","double");It(bt,"BOOLEAN","bool");It(bt,"STRING","string");It(bt,"DATE_TIME","datetime");It(bt,"LOCAL_TIME","localtime");const Z=bt;function Fs(i,e){var t=i.internalStream("string");return t.readable=!0,t.read=()=>!1,t.removeListener=()=>!1,t.on("data",(n,r)=>e(r)),t}function rr(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function sr(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?rr(Object(t),!0).forEach(function(n){Te(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):rr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Te(i,e,t){return e=ul(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ul(i){var e=cl(i,"string");return typeof e=="symbol"?e:String(e)}function cl(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var or="unknown",ml=2147483647,vl=-2147483648,ar=/^[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]+)?$/,lr=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class _e{static determineType(e,t,n){if(!e||e===n)return t;switch(t){case Z.STRING:return Z.STRING;case Z.INTEGER:return _e.checkInteger(e);case Z.LONG:return _e.checkLong(e);case Z.DOUBLE:return _e.checkDouble(e);case Z.BOOLEAN:return _e.checkBoolean(e);case Z.DATE_TIME:return _e.checkDateTime(e);case Z.LOCAL_TIME:return _e.checkLocalTime(e);default:return _e.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){var t=e.replace(/,/g,"");return _e.isNotParsableNumber(t)?Z.STRING:_e.getNumberType(t)}static checkLong(e){var t=e.replace(/,/g,"");return _e.isNotParsableNumber(t)?Z.STRING:t.includes(".")?Z.DOUBLE:Z.LONG}static checkDouble(e){var t=e.replace(/,/g,"");return _e.isNotParsableNumber(t)?Z.STRING:Z.DOUBLE}static checkBoolean(e){var t=e.toLowerCase();return t==="true"||t==="false"?Z.BOOLEAN:Z.STRING}static checkDateTime(e){return ar.test(e)?Z.DATE_TIME:Z.STRING}static checkLocalTime(e){return lr.test(e)?Z.LOCAL_TIME:Z.STRING}static getTypeFromUnknown(e){var t=e.replace(/,/g,"");if(_e.isNotParsableNumber(t)){var n=e.toLowerCase();return n==="true"||n==="false"?Z.BOOLEAN:ar.test(e)&&e.includes(":")?Z.DATE_TIME:lr.test(e)?Z.LOCAL_TIME:Z.STRING}return _e.getNumberType(t)}static getNumberType(e){if(e.includes("."))return Z.DOUBLE;var t=e.startsWith("-")?11:10;if(e.length>t)return Z.LONG;var n=parseInt(e,10);return n>ml||n<vl?Z.LONG:Z.INTEGER}constructor(e,t,n,r,s,o,a,l,h,u){Te(this,"onFileCompleted",void 0),Te(this,"file",void 0),Te(this,"readHeaders",void 0),Te(this,"nullString",void 0),Te(this,"onProgress",void 0),Te(this,"onError",void 0),Te(this,"types",void 0),Te(this,"chunks",void 0),Te(this,"totalChunks",void 0),Te(this,"rowCount",void 0),Te(this,"isZip",void 0),Te(this,"shouldTrim",void 0),Te(this,"zipProgress",void 0),Te(this,"config",void 0),this.onFileCompleted=e,this.file=t,this.readHeaders=n,this.nullString=s,this.onProgress=o,this.onError=a,this.chunks=0,this.totalChunks=l,this.rowCount=0,this.isZip=h,this.shouldTrim=u,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=sr(sr({},r),{},{error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete})}parse(){if(this.file instanceof File||this.file instanceof Blob)Qt.parse(this.file,this.config);else{var e=Fs(this.file,this.handleNodeUpdate);Qt.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(or),this.readHeaders&&(n=n.slice(1))}this.rowCount+=n.length,A(this.types);var r=[...this.types];n.forEach(a=>{if(a.length>=r.length){for(var l=0;l<r.length;l+=1)r[l]=_e.determineType(this.shouldTrim?a[l].trim():a[l],r[l],this.nullString);this.types=r}else t.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
|
|
3
3
|
Expected length `.concat(r.length," but found ").concat(a.length,`.
|
|
4
4
|
Row = `).concat(a))}),this.chunks+=1;var s=0;this.totalChunks>0?s=Math.round(this.chunks/this.totalChunks*50):s=Math.round(this.zipProgress/2);var o=this.onProgress(s);o&&t.abort()}handleComplete(e){var{types:t,onFileCompleted:n}=this;A(t),(e==null||!e.meta.aborted)&&n(t.map(r=>r===or||r===Z.LOCAL_TIME?Z.STRING:r),this.rowCount)}handleError(e){var{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}const fl=_e;function le(i,e,t){return e=pl(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function pl(i){var e=gl(i,"string");return typeof e=="symbol"?e:String(e)}function gl(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Tn=ie.module("CsvParser"),bl=650;class kt{static generateHeaderRecursive(e){var t="",n=e;return e>=26&&(t=t.concat(kt.generateHeaderRecursive(Math.floor(e/26)-1)),n=e%26),t.concat(String.fromCharCode(65+n))}constructor(e){var{onFileCompleted:t,session:n,file:r,type:s,readHeaders:o=!0,onProgress:a,onError:l,timeZone:h,isZip:u}=e;le(this,"onFileCompleted",void 0),le(this,"session",void 0),le(this,"file",void 0),le(this,"isZip",void 0),le(this,"type",void 0),le(this,"readHeaders",void 0),le(this,"timeZone",void 0),le(this,"onProgress",void 0),le(this,"onError",void 0),le(this,"tables",void 0),le(this,"headers",void 0),le(this,"types",void 0),le(this,"rowCount",void 0),le(this,"rowsProcessed",void 0),le(this,"chunks",void 0),le(this,"totalChunks",void 0),le(this,"isComplete",void 0),le(this,"zipProgress",void 0),le(this,"consolidatedChunks",void 0),le(this,"numConsolidated",void 0),le(this,"isCancelled",void 0),le(this,"config",void 0),this.onFileCompleted=t,this.session=n,this.file=r,this.isZip=u,this.type=s,this.readHeaders=o,this.timeZone=h,this.onProgress=a,this.onError=l,this.tables=[],this.rowCount=0,this.rowsProcessed=0,this.chunks=0,this.totalChunks=u?0:Math.ceil(r.size/Qt.LocalChunkSize),this.isComplete=!1,this.zipProgress=0,this.numConsolidated=0,this.isCancelled=!1,this.handleChunk=this.handleChunk.bind(this),this.handleError=this.handleError.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.handleCreateTable=this.handleCreateTable.bind(this),this.config={delimiter:s.delimiter,newline:s.newline,escapeChar:s.escapeChar,dynamicTyping:!1,error:this.handleError,skipEmptyLines:s.skipEmptyLines,chunk:this.handleChunk,complete:this.handleComplete,fastMode:!1}}cancel(){this.isCancelled=!0}transpose(e,t){for(var n=t.length,r=new Array(e).fill(null).map(()=>new Array(n)),s=0;s<n;s+=1){var o=t[s];if(o.length<e)throw new Error("Insufficient columns. Expected ".concat(e," but found ").concat(o.length,`
|
|
@@ -18,4 +18,4 @@ Row = `).concat(a))}),this.chunks+=1;var s=0;this.totalChunks>0?s=Math.round(thi
|
|
|
18
18
|
`))}}if(n=n.trimRight(),this.editor.setValue(n),t){var a,l=(a=this.editor.getModel())===null||a===void 0?void 0:a.getLineCount();A(l),this.editor.revealLine(l,1)}this.stopFlushTimer(),this.bufferedMessages=[]}}truncateLogIfNecessary(){this.messages.length>ue.maxLogSize&&(this.messages=this.messages.splice(this.messages.length-ue.truncateSize))}scrollToBottom(){var e,t,n;if(this.editor){var r=(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();A(r),this.editor.revealLine(r,1)}}isBottomVisible(){if(!this.editor)return!0;var e=this.editor.getModel(),t=e?.getLineCount();return A(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 r=0;r<n.length;r+=1){var s=n[r];if(s.startLineNumber<=e&&e<=s.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],r=ue.getLogText(n);e+=r,r.charAt(r.length-1)!==`
|
|
19
19
|
`&&(e+=`
|
|
20
20
|
`)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,ue.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 d.jsxs("div",{className:"log-pane h-100 w-100",children:[d.jsxs("div",{className:"log-pane-menu",children:[d.jsx(ne,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:ea,tooltip:"Clear log"}),d.jsx(ne,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:ta,tooltip:"Log Settings",onClick:()=>{},children:d.jsx(nn,{actions:n,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),d.jsx("div",{className:"log-pane-editor h-100 w-100",ref:r=>{this.editorContainer=r}})]})}}Re(ue,"DefaultLogLevels",[be.STDOUT,be.ERROR,be.FATAL,be.STDERR,be.WARN]);Re(ue,"AllLogLevels",[be.INFO,be.STDOUT,be.ERROR,be.FATAL,be.STDERR,be.WARN,be.DEBUG,be.TRACE]);Re(ue,"bufferTimeout",16);Re(ue,"maxLogSize",131072);Re(ue,"truncateSize",65536);const rd=ue;function Cr(i,e,t,n,r,s,o){try{var a=i[s](o),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(n,r)}function sd(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){Cr(s,n,r,o,a,"next",l)}function a(l){Cr(s,n,r,o,a,"throw",l)}o(void 0)})}}var od=ie.module("HeapUsage");function ad(i){var e,{connection:t,defaultUpdateInterval:n,hoverUpdateInterval:r,bgMonitoring:s=!0,monitorDuration:o}=i,[a,l]=m.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[h,u]=m.useState(!1),c=m.useRef({timestamps:[],usages:[]}),v=m.useCallback(sd(function*(){try{var L=yield t.getWorkerHeapInfo();if(l(L),s||h){for(var R=(L.totalHeapSize-L.freeMemory)/L.maximumHeapSize,x=Date.now(),{timestamps:D,usages:k}=c.current;D.length!==0&&x-D[0]>o*1.5;)D.shift(),k.shift();D.push(x),k.push(R)}else c.current={timestamps:[],usages:[]}}catch(fe){od.warn("Unable to get heap usage",fe)}}),[h,t,o,s]);Ea(v,h?r:n);var f=(L,R)=>Math.round(L*10**R)/10**R,p=2,b=1024**3,{freeMemory:C,totalHeapSize:S,maximumHeapSize:T}=a,E=f(C/b,p),F=f(S/b,p),B=f(T/b,p),X=F-E,N=function(R,x){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return d.jsxs("div",{className:de("heap-usage-info-row",{"heading-bottom-border":D}),children:[d.jsx("div",{className:"font-weight-bold",children:R}),d.jsx("div",{children:x})]})},{timestamps:V,usages:K}=c.current,z=(e=V[V.length-1])!==null&&e!==void 0?e:0,ee=S/T,j=(S-C)/T;return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"max-memory",children:[d.jsx("div",{className:"total-memory",style:{width:"calc(".concat(ee*100,"% - ").concat(ee*2,"px")}}),d.jsx("div",{className:de("used-memory",{"heap-overflow":(S-C)/T>.95}),style:{width:"calc(".concat(j*100,"% - ").concat(j*2,"px")}}),d.jsxs("div",{className:"memory-text",children:[B.toFixed(1)," GB"]})]}),d.jsx(Ot,{onEntered:()=>u(!0),onExited:()=>u(!1),interactive:!0,children:d.jsxs("div",{className:"heap-tooltip",children:[N("In use:","".concat(X.toFixed(p)," of ").concat(B.toFixed(p)," GB"),!0),N("Free:","".concat(E.toFixed(p)," GB")),N("Total:","".concat(F.toFixed(p)," GB")),N("Max:","".concat(B.toFixed(p)," GB")),d.jsx("div",{className:"heap-plot",children:d.jsx(Pa,{data:[{x:[...V],y:[...K],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(o/6),gridcolor:En.linecolor,range:[z-o,z],linecolor:En.linecolor,linewidth:2,mirror:!0},yaxis:{dtick:.2,gridcolor:En.linecolor,range:[0,1],linecolor:En.linecolor,linewidth:2,mirror:!0}}})}),d.jsxs("div",{className:"heap-utilisation-text",children:["% utilization over ",Math.round(o/1e3/60)," min."]})]})})]})}var Fi=Object.freeze({}),ld=new Map,Km=i=>i.api,Gm=i=>i.user,ji=i=>i.storage,Ws=i=>ji(i).commandHistoryStorage,zs=i=>ji(i).fileStorage,Ym=i=>ji(i).workspaceStorage,dd=i=>i.workspace,Xe=i=>dd(i).data.settings,qm=i=>Xe(i).defaultDateTimeFormat,Xm=i=>{var e;return(e=Xe(i).defaultDecimalFormatOptions)!==null&&e!==void 0?e:Fi},Zm=i=>{var e;return(e=Xe(i).defaultIntegerFormatOptions)!==null&&e!==void 0?e:Fi},Jm=i=>Xe(i).formatter,hd=i=>Xe(i).timeZone,Qm=i=>Xe(i).showTimeZone,ev=i=>Xe(i).showTSeparator,tv=i=>Xe(i).truncateNumbersWithPound,nv=i=>Xe(i).shortcutOverrides,ud=i=>{var e;return(e=Xe(i).defaultNotebookSettings)!==null&&e!==void 0?e:Fi},iv=i=>i.activeTool,cd=i=>{var e;return(e=i.plugins)!==null&&e!==void 0?e:ld},Vs="SET_ACTIVE_TOOL",Ks="SET_API",Gs="SET_COMMAND_HISTORY_STORAGE",Ys="SET_FILE_STORAGE",qs="SET_PLUGINS",Xs="SET_USER",Zs="SET_WORKSPACE",Js="SET_WORKSPACE_STORAGE",Qs="SET_SERVER_CONFIG_VALUES";function yr(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function In(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?yr(Object(t),!0).forEach(function(n){md(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):yr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function md(i,e,t){return e=vd(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function vd(i){var e=fd(i,"string");return typeof e=="symbol"?e:String(e)}function fd(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var rv=i=>({type:Xs,payload:i}),sv=i=>({type:Ks,payload:i}),pd=i=>({type:Zs,payload:i}),ov=i=>({type:Js,payload:i}),av=i=>({type:Gs,payload:i}),lv=i=>({type:Ys,payload:i}),gd=i=>(e,t)=>{e(pd(i));var{storage:n}=t(),{workspaceStorage:r}=n;return r.save(i)},bd=i=>(e,t)=>{var{workspace:n}=t(),{data:r}=n,s=In(In({},n),{},{data:In(In({},r),i)});return e(gd(s))},Cd=i=>e=>e(bd({settings:i})),dv=i=>({type:Vs,payload:i}),hv=i=>({type:qs,payload:i}),uv=i=>({type:Qs,payload:i});function _r(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function hi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_r(Object(t),!0).forEach(function(n){yd(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):_r(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function yd(i,e,t){return e=_d(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function _d(i){var e=Sd(i,"string");return typeof e=="symbol"?e:String(e)}function Sd(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function eo(i,e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case i:{var r=n.payload;return r==null?null:t!=null?hi(hi({},t),r):hi({},r)}default:return t}}}function Sr(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function wr(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Sr(Object(t),!0).forEach(function(n){wd(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Sr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function wd(i,e,t){return e=Ed(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ed(i){var e=Pd(i,"string");return typeof e=="symbol"?e:String(e)}function Pd(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function Td(i){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,r=arguments.length>1?arguments[1]:void 0;switch(r.type){case i:{var{id:s,payload:o}=r;return t&&ln({payload:o},{payload:n[s]})?n:wr(wr({},n),{},{[s]:o})}default:return n}}}function xt(i,e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case i:return n.payload;default:return t}}}const Od=xt(Ks,null),Id=xt(Vs,null),xd=xt(qs,null),Dd=xt(Gs,null),Md=xt(Ys,null),Nd=xt(Js,null),Ld=Di({commandHistoryStorage:Dd,fileStorage:Md,workspaceStorage:Nd}),Rd=eo(Xs,null),Ad=eo(Zs,null),Fd=xt(Qs,null);var jd={activeTool:Id,api:Od,plugins:xd,storage:Ld,user:Rd,workspace:Ad,serverConfigValues:Fd};const kd=jd;function Er(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Pr(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Er(Object(t),!0).forEach(function(n){yi(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Er(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function yi(i,e,t){return e=Hd(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Hd(i){var e=$d(i,"string");return typeof e=="symbol"?e:String(e)}function $d(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Ud{constructor(){yi(this,"reducers",{}),yi(this,"listener",null)}register(e,t){var n;this.reducers=Pr(Pr({},this.reducers),{},{[e]:t}),(n=this.listener)===null||n===void 0||n.call(this,this.reducers)}setListener(e){this.listener=e}}var Bd=new Ud;const ei=Bd;var Tr=ie.module("redux-logger"),Wd=i=>e=>t=>{Tr.debug("dispatching",t);var n=e(t);return Tr.debug("next state",i.getState()),n};const zd=Wd;var Vd=ie.module("redux-crashReporter"),Kd=i=>e=>t=>{try{return e(t)}catch(n){throw Vd.error("Error executing",t," with state ",i.getState(),":",n),n}};const Gd=Kd,Yd=[zd,Gd,Fo];var ui;Object.entries(kd).map(i=>{var[e,t]=i;return ei.register(e,t)});var qd=(ui=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__)!==null&&ui!==void 0?ui:Ho,to=jo(Di(ei.reducers),qd(ko(...Yd)));ei.setListener(i=>{to.replaceReducer(Di(i))});const cv=to;var no=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 io(i){return i.componentName!==void 0}function Xd(i){return i.component!==void 0}var ro=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const Zd=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:no,isGLComponentConfig:io,isReactComponentConfig:Xd,itemDefaultConfig:ro},Symbol.toStringTag,{value:"Module"}));function kn(i,e,t){return e=Jd(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Jd(i){var e=Qd(i,"string");return typeof e=="symbol"?e:String(e)}function Qd(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class hn{constructor(){kn(this,"_mSubscriptions",void 0),kn(this,"off",this.unbind),kn(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[hn.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,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];if(t)for(var o=0;o<t.length;o++){var a=t[o].ctx||{};try{t[o].fn.apply(a,r)}catch(c){console.error("Error while emitting event:",c)}}r.unshift(e);for(var l=this._mSubscriptions[hn.ALL_EVENT],h=0;h<l.length;h++){var u=l[h].ctx||{};try{l[h].fn.apply(u,r)}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 r=!1,s=0;s<this._mSubscriptions[e].length;s++)(!t||this._mSubscriptions[e][s].fn===t)&&(!n||n===this._mSubscriptions[e][s].ctx)&&(this._mSubscriptions[e].splice(s,1),r=!0);if(r===!1)throw new Error("Nothing to unbind for "+e)}}kn(hn,"ALL_EVENT","__all");const qe=hn;function Ge(i,e,t){return e=eh(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function eh(i){var e=th(i,"string");return typeof e=="symbol"?e:String(e)}function th(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class _i extends qe{constructor(e,t,n){super(),Ge(this,"width",void 0),Ge(this,"height",void 0),Ge(this,"title",void 0),Ge(this,"parent",void 0),Ge(this,"layoutManager",void 0),Ge(this,"tab",void 0),Ge(this,"_config",void 0),Ge(this,"isHidden",!1),Ge(this,"beforeCloseHandler",void 0),Ge(this,"_element",I(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),Ge(this,"_contentElement",void 0),this.title=io(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,r,s,o=this.parent,a=null;o&&!o.isColumn&&!o.isRow;){var l;if(a=o,o=o.parent,(l=o)!==null&&l!==void 0&&l.isRoot)return!1}if(!o||!a)return!1;for(var h=o.isColumn?"height":"width",u=h==="height"?t:e,c=((n=this[h])!==null&&n!==void 0?n:0)*(1/(((r=a.config[h])!==null&&r!==void 0?r:0)/100)),v=u/c*100,f=(((s=a.config[h])!==null&&s!==void 0?s:0)-v)/(o.contentItems.length-1),p=0;p<o.contentItems.length;p++)if(o.contentItems[p]===a)o.contentItems[p].config[h]=v;else{var b;o.contentItems[p].config[h]=((b=o.contentItems[p].config[h])!==null&&b!==void 0?b:0)+f}return o.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}extendState(e){this.setState(I.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],r=n.offsetWidth-n.clientWidth,s=n.offsetHeight-n.clientHeight;this._contentElement.width(this.width-r).height(this.height-s),this.emit("resize")}}}const nh=Object.freeze(Object.defineProperty({__proto__:null,Container:_i,ItemContainer:_i},Symbol.toStringTag,{value:"Module"}));function so(i){var e=location.hash.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null}function oo(i){if(window.location.hash)return so(i);if(!window.location.search)return null;var e=window.location.search.substr(1).split("&"),t={},n,r;for(r=0;r<e.length;r++)n=e[r].split("="),t[n[0]]=n[1];return t[i]||null}function ki(i){return window.requestAnimationFrame(i)}function ih(i,e){var t=e.indexOf(i);if(t===-1)throw new Error("Can't remove item from array. Item is not in the array");e.splice(t,1)}function Hi(){return(Math.random()*1e15).toString(36).replace(".","")}function rh(i,e){var t=i.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 $i(i){return I.trim(i.replace(/(<([^>]+)>)/gi,""))}function Le(i,e,t){return e=sh(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function sh(i){var e=oh(i,"string");return typeof e=="symbol"?e:String(e)}function oh(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class ah extends qe{constructor(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super(),Le(this,"_eElement",void 0),Le(this,"_oDocument",void 0),Le(this,"_eBody",void 0),Le(this,"_destroyAfterMouseUp",void 0),Le(this,"_nDelay",400),Le(this,"_timeout",void 0),Le(this,"timeout",void 0),Le(this,"_nDistance",10),Le(this,"_nX",0),Le(this,"_nY",0),Le(this,"_nOriginalX",0),Le(this,"_nOriginalY",0),Le(this,"_bDragging",!1),this._eElement=e,this._oDocument=I(document),this._eBody=I(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,r,s,o=this._getCoordinates(e);this._nOriginalX=(t=o.x)!==null&&t!==void 0?t:0,this._nOriginalY=(n=o.y)!==null&&n!==void 0?n:0,(r=this._oDocument)===null||r===void 0||r.on("mousemove",this.onMouseMove),(s=this._oDocument)===null||s===void 0||s.on("mouseup",this.onMouseUp),this._timeout=window.setTimeout(this._startDrag,this._nDelay)}}onMouseMove(e){if(this._timeout!=null){var t,n;e.preventDefault();var r=this._getCoordinates(e);this._nX=((t=r.x)!==null&&t!==void 0?t:0)-this._nOriginalX,this._nY=((n=r.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,r,s,o;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),(r=this._oDocument)===null||r===void 0||(s=r.find("iframe"))===null||s===void 0||s.css("pointer-events",""),this._bDragging===!0&&(this._bDragging=!1,this.emit("dragStop",e,this._nOriginalX+this._nX)),(o=this._eBody)===null||o===void 0||o.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var a;(a=this._eElement)===null||a===void 0||a.removeClass("lm_dragging")}this._destroyAfterMouseUp&&this.destroy()}}_startDrag(){var e,t,n,r;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||(r=n.find("iframe"))===null||r===void 0||r.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}}}const fn=ah;function Nt(i,e,t){return e=lh(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function lh(i){var e=dh(i,"string");return typeof e=="symbol"?e:String(e)}function dh(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class ao{constructor(e,t){Nt(this,"_container",void 0),Nt(this,"_reactComponent",null),Nt(this,"_portalComponent",null),Nt(this,"_originalComponentWillUpdate",null),Nt(this,"_initialState",void 0),Nt(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=Mi.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=I.extend(e,this._container._config.props);return se.createElement(this._reactClass,t)}}var Gn=["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"],hh=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function Ui(i){if(Gn.length>36)throw new Error("Too many keys in config minifier map");var e={};return Bi(i,e,"_min"),e}function Si(i){if(Gn.length>36)throw new Error("Too many keys in config minifier map");var e={};return Bi(i,e,"_max"),e}function Bi(i,e,t){var n=t==="_min"?uh:ch;for(var r in i)if(i.hasOwnProperty(r)){var s=Array.isArray(i)?i[Number.parseInt(r,10)]:i[r];if(typeof s=="object"&&s!=null){var o=s instanceof Array?[]:{};if(Array.isArray(e))e[Number.parseInt(r,10)]=o;else{var a=n(r,Gn);e[a]=o}Bi(s,o,t)}else{var l=n(s,hh);if(Array.isArray(e))e[Number.parseInt(r,10)]=l;else{var h=n(r,Gn);e[h]=l}}}}function uh(i,e){if(typeof i=="string"&&i.length===1)return"___"+i;var t=e.indexOf(i);return t===-1?i:t.toString(36)}function ch(i,e){return typeof i=="string"&&i.length===1?e[parseInt(i,36)]:typeof i=="string"&&i.substr(0,3)==="___"?i[3]:i}function ci(i,e,t){return e=mh(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function mh(i){var e=vh(i,"string");return typeof e=="symbol"?e:String(e)}function vh(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class wi{constructor(e,t){ci(this,"name",void 0),ci(this,"origin",void 0),ci(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function xn(i,e,t){return e=fh(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function fh(i){var e=ph(i,"string");return typeof e=="symbol"?e:String(e)}function ph(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}let gh=class extends qe{constructor(e){super(),xn(this,"_layoutManager",void 0),xn(this,"_dontPropagateToParent",void 0),xn(this,"_childEventSource",void 0),xn(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(qe.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),I(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",r=(t=window.opener)===null||t===void 0?void 0:t.document.createEvent("HTMLEvents");r.initEvent(n,!0,!0),r.eventName=n,r.__glArgs=e,r.__gl=this._layoutManager,window.opener.dispatchEvent(r)}_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(){I(window).off("gl_child_event",this._boundOnEventFromChild)}};const lo=gh,bh=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:wi,DragListener:fn,EventEmitter:qe,EventHub:lo,ReactComponentHandler:ao,animFrame:ki,filterXss:rh,getHashValue:so,getQueryStringParam:oo,getUniqueId:Hi,minifyConfig:Ui,removeFromArray:ih,stripTags:$i,unminifyConfig:Si},Symbol.toStringTag,{value:"Module"}));function ct(i,e,t){return e=Ch(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ch(i){var e=yh(i,"string");return typeof e=="symbol"?e:String(e)}function yh(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class ho extends qe{constructor(e,t,n,r,s){super(),ct(this,"isInitialised",!1),ct(this,"_config",void 0),ct(this,"_dimensions",void 0),ct(this,"_parentId",void 0),ct(this,"_indexInParent",void 0),ct(this,"_layoutManager",void 0),ct(this,"_popoutWindow",null),ct(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=n,this._indexInParent=r,this._layoutManager=s,this._createWindow()}toConfig(){var e,t,n,r,s,o,a,l,h,u,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=(r=(s=this._popoutWindow)===null||s===void 0?void 0:s.screenX)!==null&&r!==void 0?r:(o=this._popoutWindow)===null||o===void 0?void 0:o.screenLeft)!==null&&n!==void 0?n:0,top:(a=(l=(h=this._popoutWindow)===null||h===void 0?void 0:h.screenY)!==null&&l!==void 0?l:(u=this._popoutWindow)===null||u===void 0?void 0:u.screenTop)!==null&&a!==void 0?a: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 r;if(t=I.extend(!0,{},(r=this.getGlInstance())===null||r===void 0?void 0:r.toConfig()).content[0],n=this._layoutManager.root.getItemsById(this._parentId)[0],!n){var s;((s=this._layoutManager.root.contentItems.length)!==null&&s!==void 0?s: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 r=new Error("Popout blocked");throw r.type="popoutBlocked",r}else return;I(this._popoutWindow).on("load",this._positionWindow.bind(this)).on("unload beforeunload",this._onClose.bind(this));var s=window.setInterval(()=>{var o;(o=this._popoutWindow)!==null&&o!==void 0&&o.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),window.clearInterval(s))},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-"+Hi();e=Ui(e);try{localStorage.setItem(t,JSON.stringify(e))}catch(r){throw new Error("Error while writing to localStorage "+r.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 pe(i,e,t){return e=_h(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function _h(i){var e=Sh(i,"string");return typeof e=="symbol"?e:String(e)}function Sh(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Dt extends qe{constructor(e,t,n,r,s,o){var a,l,h,u,c,v,f,p;if(super(),pe(this,"_dragListener",void 0),pe(this,"_layoutManager",void 0),pe(this,"_contentItem",void 0),pe(this,"_originalParent",void 0),pe(this,"_area",null),pe(this,"_lastValidArea",null),pe(this,"_minX",void 0),pe(this,"_maxX",void 0),pe(this,"_minY",void 0),pe(this,"_maxY",void 0),pe(this,"_width",void 0),pe(this,"_height",void 0),pe(this,"_sided",void 0),pe(this,"element",void 0),pe(this,"childElementContainer",void 0),pe(this,"_proxyTab",void 0),this._dragListener=n,this._layoutManager=r,this._contentItem=s,this._originalParent=o,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var b,C;this._layoutManager.tabDropPlaceholder.width((b=this._contentItem.tab.element.outerWidth(!0))!==null&&b!==void 0?b:0),this._layoutManager.tabDropPlaceholder.height((C=this._contentItem.tab.element.outerHeight(!0))!==null&&C!==void 0?C:0)}if(this.element=I(Dt._template),o&&o._side&&(this._sided=o._sided,this.element.addClass("lm_"+o._side),["right","bottom"].indexOf(o._side.toString())>=0&&this.element.find(".lm_content").after(this.element.find(".lm_header"))),this.element.css({left:e,top:t}),this._proxyTab=this.element.find(".lm_tab"),this._proxyTab.attr("title",$i((a=this._contentItem.config.title)!==null&&a!==void 0?a:"")),this.element.find(".lm_title").html((l=this._contentItem.config.title)!==null&&l!==void 0?l:""),this.childElementContainer=this.element.find(".lm_content"),this.childElementContainer.append(s.element),this._updateTree(),this._layoutManager._$calculateItemAreas(),I(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var S,T;this._layoutManager.tabDropPlaceholder.width((S=this._proxyTab.outerWidth(!0))!==null&&S!==void 0?S:0),this._layoutManager.tabDropPlaceholder.height((T=this._proxyTab.outerHeight(!0))!==null&&T!==void 0?T:0)}var E=this._layoutManager.container.offset();this._minX=(h=E?.left)!==null&&h!==void 0?h:0,this._minY=(u=E?.top)!==null&&u!==void 0?u: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 r,s,o=(r=n.pageX)!==null&&r!==void 0?r:0,a=(s=n.pageY)!==null&&s!==void 0?s:0,l=o>this._minX&&o<this._maxX&&a>this._minY&&a<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(o,a)}_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")}}pe(Dt,"_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 Dn(i,e,t){return e=wh(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function wh(i){var e=Eh(i,"string");return typeof e=="symbol"?e:String(e)}function Eh(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class uo{constructor(e,t,n){Dn(this,"_element",void 0),Dn(this,"_itemConfig",void 0),Dn(this,"_layoutManager",void 0),Dn(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=n,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new fn(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 r=this._layoutManager._$normalizeContentItem(I.extend(!0,{},n));new Dt(e,t,this._dragListener,this._layoutManager,r,null)}}function Mn(i,e,t){return e=Ph(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ph(i){var e=Th(i,"string");return typeof e=="symbol"?e:String(e)}function Th(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class co{constructor(e,t,n){Mn(this,"_element",I(window)),Mn(this,"_itemConfig",void 0),Mn(this,"_layoutManager",void 0),Mn(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 fn(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 r=this._layoutManager._$normalizeContentItem(I.extend(!0,{},n));new Dt(e,t,this._dragListener,this._layoutManager,r,null)}}}function mo(i,e,t){return e=Oh(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Oh(i){var e=Ih(i,"string");return typeof e=="symbol"?e:String(e)}function Ih(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class pn{constructor(){mo(this,"element",I(pn._template)),I(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()}}mo(pn,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function mi(i,e,t){return e=xh(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function xh(i){var e=Dh(i,"string");return typeof e=="symbol"?e:String(e)}function Dh(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Jt{constructor(e,t,n,r){mi(this,"element",void 0),mi(this,"_header",void 0),mi(this,"_action",void 0),this._header=e,this.element=I('<li class="'+n+'" title="'+t+'"></li>'),this._header.on("destroy",this._$destroy,this),this._action=r,this.element.on("click",this._action),this._header.controlsContainer.append(this.element)}_$destroy(){this.element.off(),this.element.remove()}}function Mh(i,e,t){return e=Nh(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Nh(i){var e=Lh(i,"string");return typeof e=="symbol"?e:String(e)}function Lh(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Rh extends Error{constructor(e,t){super(),Mh(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const Pt=Rh,Ah=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:Pt},Symbol.toStringTag,{value:"Module"}));function ve(i,e,t){return e=Fh(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Fh(i){var e=jh(i,"string");return typeof e=="symbol"?e:String(e)}function jh(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function un(i){return i.isStack}function Ae(i){return i.isComponent}function vo(i){return i.isRoot}class Ce extends qe{constructor(e,t,n,r){super(),ve(this,"config",void 0),ve(this,"type",void 0),ve(this,"contentItems",void 0),ve(this,"parent",void 0),ve(this,"layoutManager",void 0),ve(this,"element",void 0),ve(this,"childElementContainer",void 0),ve(this,"componentName",void 0),ve(this,"isInitialised",!1),ve(this,"isMaximised",!1),ve(this,"isRoot",!1),ve(this,"isRow",!1),ve(this,"isColumn",!1),ve(this,"isStack",!1),ve(this,"isComponent",!1),ve(this,"tab",void 0),ve(this,"_pendingEventPropagations",void 0),ve(this,"_throttledEvents",void 0),this.element=r,this.config=this._extendItemNode(t),this.type=t.type,this.contentItems=[],this.parent=n,this.layoutManager=e,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(qe.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,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;n!==!0&&r!==!0&&this[e].apply(this,t);for(var s=0;s<this.contentItems.length;s++)this.contentItems[s].callDownwards(e,t,n);n===!0&&r!==!0&&this[e].apply(this,t)}removeChild(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=this.contentItems.indexOf(e);if(r===-1)throw new Error("Can't remove child item. Unknown content item");if(n!==!0&&this.contentItems[r]._$destroy(),this.contentItems.splice(r,1),(t=this.config.content)===null||t===void 0||t.splice(r,1),this.contentItems.length>0)this.callDownwards("setSize");else if(this.type!=="root"&&this.config.isClosable){var s;(s=this.parent)===null||s===void 0||s.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 r=this.contentItems.indexOf(e),s=e.element[0].parentNode;if(r===-1)throw new Error("Can't replace child. oldChild is not child of this");s?.replaceChild(t.element[0],e.element[0]),n===!0&&(e.parent=null,e._$destroy()),this.contentItems[r]=t,t.parent=this,un(this)&&(this.header.tabs[r].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 r(s){for(var o=0;o<s.contentItems.length;o++)e(s.contentItems[o])===!0&&t.push(s.contentItems[o]),r(s.contentItems[o])};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=[],r=0;r<t.length;r++)n.push(t[r].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 r;(r=this.layoutManager.dropTargetIndicator)===null||r===void 0||r.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,r=0;r<t.length;r++)n=t[r].getActiveContentItem(),n&&Ae(n)&&n.container[e]()}_$destroy(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")}_$getArea(e){var t,n,r;e=e||this.element;var s=(t=e.offset())!==null&&t!==void 0?t:{left:0,top:0},o=(n=e.width())!==null&&n!==void 0?n:0,a=(r=e.height())!==null&&r!==void 0?r:0;return{x1:s.left,y1:s.top,x2:s.left+o,y2:s.top+a,surface:o*a,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 wi(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new Pt("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(ro)){var r=t;e[r]===void 0&&(e[r]=n)}return e}_propagateEvent(e,t){t instanceof wi&&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,ki(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function zt(i,e,t){return e=kh(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function kh(i){var e=Hh(i,"string");return typeof e=="symbol"?e:String(e)}function Hh(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class fo extends Ce{constructor(e,t,n){super(e,t,n,I()),zt(this,"config",void 0),zt(this,"componentName",void 0),zt(this,"container",void 0),zt(this,"parent",void 0),zt(this,"instance",void 0),this.config=t,this.parent=n;var r=e.getComponent(this.config.componentName)||e.getFallbackComponent(),s=I.extend(!0,{},this.config.componentState||{});if(r==null)throw new Pt('Unknown component "'+this.config.componentName+'"');s.componentName=this.config.componentName,this.componentName=this.config.componentName,this.config.title===""&&(this.config.title=this.config.componentName),this.isComponent=!0,this.container=new _i(this.config,this,e),this.instance=new r(this.container,s),this.element=this.container._element}close(){this.parent.removeChild(this)}setSize(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())}_$init(){Ce.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),Ce.prototype._$hide.call(this)}_$show(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),Ce.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),Ce.prototype._$destroy.call(this)}_$getArea(){return null}}function $e(i,e,t){return e=$h(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function $h(i){var e=Uh(i,"string");return typeof e=="symbol"?e:String(e)}function Uh(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Yn extends Ce{constructor(e,t,n,r){super(t,n,r,I('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),$e(this,"isRow",void 0),$e(this,"isColumn",void 0),$e(this,"childElementContainer",void 0),$e(this,"parent",void 0),$e(this,"_splitter",[]),$e(this,"_splitterSize",void 0),$e(this,"_splitterGrabSize",void 0),$e(this,"_isColumn",void 0),$e(this,"_dimension",void 0),$e(this,"_splitterPosition",null),$e(this,"_splitterMinPosition",null),$e(this,"_splitterMaxPosition",null),this.parent=r,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 r,s,o,a;if(e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.length>0?(a=this._createSplitter(Math.max(0,t-1)).element,t>0?(this.contentItems[t-1].element.after(a),a.after(e.element)):(this.contentItems[0].element.before(a),a.before(e.element))):this.childElementContainer.append(e.element),Ce.prototype.addChild.call(this,e,t),r=1/this.contentItems.length*100,n===!0){this.emitBubblingEvent("stateChanged");return}for(o=0;o<this.contentItems.length;o++)if(this.contentItems[o]===e)e.config[this._dimension]=r;else{var l;s=((l=this.contentItems[o].config[this._dimension])!==null&&l!==void 0?l:0)*(100-r)/100,this.contentItems[o].config[this._dimension]=s}this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}removeChild(e,t){var n,r=(n=e.config[this._dimension])!==null&&n!==void 0?n:0,s=this.contentItems.indexOf(e),o=Math.max(s-1,0),a,l;if(s===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[o]&&(this._splitter[o]._$destroy(),this._splitter.splice(o,1)),a=0;a<this.contentItems.length;a++)if(this.contentItems[a]!==e){var h;this.contentItems[a].config[this._dimension]=((h=this.contentItems[a].config[this._dimension])!==null&&h!==void 0?h:0)+r/(this.contentItems.length-1)}Ce.prototype.removeChild.call(this,e,t),this.contentItems.length===1&&this.config.isClosable===!0?(l=this.contentItems[0],this.contentItems=[],this.parent.replaceChild(this,l,!0)):(this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged"))}replaceChild(e,t){var n=e.config[this._dimension];super.replaceChild(e,t),t.config[this._dimension]=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(Ce.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,r=(e=this.element.width())!==null&&e!==void 0?e:0,s=(t=this.element.height())!==null&&t!==void 0?t:0,o=0,a=[];this._isColumn?s-=n:r-=n;for(var l=0;l<this.contentItems.length;l++){var h,u,c=this._isColumn?Math.floor(s*(((h=this.contentItems[l].config.height)!==null&&h!==void 0?h:0)/100)):Math.floor(r*(((u=this.contentItems[l].config.width)!==null&&u!==void 0?u:0)/100));o+=c,a.push(c)}var v=Math.floor((this._isColumn?s:r)-o);return{itemSizes:a,additionalPixel:v,totalWidth:r,totalHeight:s}}_calculateRelativeSizes(){for(var e=0,t=[],n=this._isColumn?"height":"width",r=0;r<this.contentItems.length;r++)if(this.contentItems[r].config[n]!==void 0){var s;e+=(s=this.contentItems[r].config[n])!==null&&s!==void 0?s:0}else t.push(this.contentItems[r]);if(Math.round(e)===100){this._respectMinItemWidth();return}if(Math.round(e)<100&&t.length>0){for(var o=0;o<t.length;o++)t[o].config[n]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var a=0;a<t.length;a++)t[a].config[n]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var h;this.contentItems[l].config[n]=((h=this.contentItems[l].config[n])!==null&&h!==void 0?h: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=[],r=0,s=0,o=0,a=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var h=this._calculateAbsoluteSizes(),u=0;u<this.contentItems.length;u++){this.contentItems[u];var c=h.itemSizes[u];c<t?(s+=t-c,l={width:t}):(r+=c-t,l={width:c},n.push(l)),a.push(l)}if(!(s===0||s>r)){var v=s/r;o=s;for(var f=0;f<n.length;f++){l=n[f];var p=Math.round((l.width-t)*v);o-=p,l.width-=p}o!==0&&(a[a.length-1].width-=o);for(var b=0;b<this.contentItems.length;b++)this.contentItems[b].config.width=a[b].width/h.totalWidth*100}}}_createSplitter(e){var t;return t=new po(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,r=0;r<e.length;++r){var s,o;t=Math.max((s=e[r].minWidth)!==null&&s!==void 0?s:0,t),n=Math.max((o=e[r].minHeight)!==null&&o!==void 0?o:0,n)}return{horizontal:t,vertical:n}}_onSplitterDragStart(e){var t,n,r,s,o=this._getItemsForSplitter(e),a=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=o.before.config.content)!==null&&t!==void 0?t:[]),h=this._isColumn?l.vertical:l.horizontal,u=this._getMinimumDimensions((n=o.after.config.content)!==null&&n!==void 0?n:[]),c=this._isColumn?u.vertical:u.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((r=o.before.element[this._dimension]())!==null&&r!==void 0?r:0)-(h||a)),this._splitterMaxPosition=((s=o.after.element[this._dimension]())!==null&&s!==void 0?s:0)-(c||a)}_onSplitterDrag(e,t,n){var r=this._isColumn?n:t;this._splitterMaxPosition==null||this._splitterMinPosition==null||r>this._splitterMinPosition&&r<this._splitterMaxPosition&&(this._splitterPosition=r,e.element.css(this._isColumn?"top":"left",r))}_onSplitterDragStop(e){var t,n,r,s,o,a=this._getItemsForSplitter(e),l=(t=a.before.element[this._dimension]())!==null&&t!==void 0?t:0,h=(n=a.after.element[this._dimension]())!==null&&n!==void 0?n:0,u=(((r=this._splitterPosition)!==null&&r!==void 0?r:0)+l)/(l+h),c=((s=a.before.config[this._dimension])!==null&&s!==void 0?s:0)+((o=a.after.config[this._dimension])!==null&&o!==void 0?o:0);a.before.config[this._dimension]=u*c,a.after.config[this._dimension]=(1-u)*c,e.element.css({top:0,left:0}),ki(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function Or(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Ir(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Or(Object(t),!0).forEach(function(n){Ei(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Or(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Ei(i,e,t){return e=Bh(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Bh(i){var e=Wh(i,"string");return typeof e=="symbol"?e:String(e)}function Wh(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Pi extends Ce{constructor(e,t,n){super(e,Ir(Ir({},t),{},{type:"root"}),null,I('<div class="lm_goldenlayout lm_item lm_root"></div>')),Ei(this,"childElementContainer",void 0),Ei(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,r;e=typeof e>"u"?(n=this._containerElement.width())!==null&&n!==void 0?n:0:e,t=typeof t>"u"?(r=this._containerElement.height())!==null&&r!==void 0?r: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(Ae(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:r}=t,s=r==="left"||r==="right"?"row":"column",o=r==="left"||r==="right"?"width":"height",a=r==="left"||r==="top",l=this.contentItems[0];if(!(l instanceof Yn)||l.type!=s){var h=this.layoutManager.createContentItem({type:s},this);this.replaceChild(l,h),h.addChild(e,a?0:void 0,!0),h.addChild(l,a?void 0:0,!0),l.config[o]=50,e.config[o]=50,h.callDownwards("setSize")}else{var u,c=l.contentItems[a?0:l.contentItems.length-1];l.addChild(e,a?0:void 0,!0),c.config[o]=((u=c.config[o])!==null&&u!==void 0?u:0)*.5,e.config[o]=c.config[o],l.callDownwards("setSize")}}}}function xr(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Lt(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xr(Object(t),!0).forEach(function(n){Me(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):xr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Me(i,e,t){return e=zh(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function zh(i){var e=Vh(i,"string");return typeof e=="symbol"?e:String(e)}function Vh(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Ti extends Ce{constructor(e,t,n){var r,s,o,a,l,h,u,c,v;super(e,t,n,I('<div class="lm_item lm_stack"></div>')),Me(this,"_activeContentItem",null),Me(this,"_header",void 0),Me(this,"childElementContainer",I('<div class="lm_items"></div>')),Me(this,"header",void 0),Me(this,"parent",void 0),Me(this,"isStack",!0),Me(this,"_dropZones",{}),Me(this,"_dropSegment",null),Me(this,"_contentAreaDimensions",null),Me(this,"_dropIndex",void 0),Me(this,"_side",void 0),Me(this,"_sided",!1),Me(this,"config",void 0),this.parent=n,this.config=t;var f=e.config;this._side=!1,this._header={show:((r=f.settings)===null||r===void 0?void 0:r.hasHeaders)&&t.hasHeaders!==!1,popout:(s=f.settings)!==null&&s!==void 0&&s.showPopoutIcon?(o=f.labels)===null||o===void 0?void 0:o.popout:void 0,maximise:(a=f.settings)!==null&&a!==void 0&&a.showMaximiseIcon?(l=f.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(h=f.settings)!==null&&h!==void 0&&h.showCloseIcon?(u=f.labels)===null||u===void 0?void 0:u.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=Lt(Lt({},this._header),f.header)),t.header&&(this._header=Lt(Lt({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=Lt(Lt({},this._header),t.content[0].header)),this.header=new lt(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,n,r,s,o=this._header.show&&(e=(t=this.layoutManager.config.dimensions)===null||t===void 0?void 0:t.headerHeight)!==null&&e!==void 0?e:0,a=((n=this.element.width())!==null&&n!==void 0?n:0)-(this._sided?o:0),l=((r=this.element.height())!==null&&r!==void 0?r:0)-(this._sided?0:o);for(this.childElementContainer.width(a),this.childElementContainer.height(l),s=0;s<this.contentItems.length;s++)this.contentItems[s].element.width(a).height(l);this.emit("resize"),this.emitBubblingEvent("stateChanged")}_$init(){if(this.isInitialised!==!0){this.header._attachWheelListener(),super._$init();for(var e=0;e<this.contentItems.length;e++)this.header.createTab(this.contentItems[e]),this.contentItems[e]._$hide();if(this.contentItems.length>0){var t=this.contentItems[this.config.activeItemIndex||0];if(!t)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(t)}}}setActiveContentItem(e){if(this.contentItems.indexOf(e)===-1)throw new Error("contentItem is not a child of this stack");this._activeContentItem!==null&&this._activeContentItem._$hide(),this._activeContentItem=e,this.header.setActiveContentItem(e),e._$show(),this.emit("activeContentItemChanged",e),this.layoutManager.emit("activeContentItemChanged",e),this.emitBubblingEvent("stateChanged")}getActiveContentItem(){return this.header.activeContentItem}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),super.addChild(e,t),this.childElementContainer.append(e.element),this.header.createTab(e,t),this.setActiveContentItem(e),this.callDownwards("setSize"),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}removeChild(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,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 r;if(!e)break;e=(r=this.contentItems[t].config.isClosable)!==null&&r!==void 0?r:!1}this.header._$setClosable(e)}_$destroy(){Ce.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",r=this._dropSegment==="top"||this._dropSegment==="left",s=t&&this.parent.isColumn||n&&this.parent.isRow,o=t?"column":"row",a=t?"height":"width";if(Ae(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(s){var h,u=this.parent.contentItems.indexOf(this);this.parent.addChild(e,r?u:u+1,!0),this.config[a]=((h=this.config[a])!==null&&h!==void 0?h:0)*.5,e.config[a]=this.config[a],this.parent.callDownwards("setSize")}else{var c=this.layoutManager.createContentItem({type:o},this);this.parent.replaceChild(this,c),c.addChild(e,r?0:void 0,!0),c.addChild(this,r?void 0:0,!0),this.config[a]=50,e.config[a]=50,c.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[n,r]of Object.entries(this._contentAreaDimensions)){var s=r.hoverArea;if(s.x1<e&&s.x2>e&&s.y1<t&&s.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,r=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+r*.5},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y1+r*.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+r*.5,x2:t.x1+n*.75,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1+r*.5,x2:t.x2,y2:t.y2}},super._$getArea(this.element))}_highlightHeaderDropZone(e){var t,n,r,s,o,a,l,h,u,c,v,f,p,b,C,S,T=this.header.tabs.length;if(T===0){var E,F,B,X,N,V,K,z,ee=this.header.element.offset();(E=this.layoutManager.dropTargetIndicator)===null||E===void 0||E.highlightArea({x1:(F=ee?.left)!==null&&F!==void 0?F:0,x2:((B=ee?.left)!==null&&B!==void 0?B:0)+100,y1:(X=(N=this.header.element.offset())===null||N===void 0?void 0:N.top)!==null&&X!==void 0?X:0,y2:((V=(K=this.header.element.offset())===null||K===void 0?void 0:K.top)!==null&&V!==void 0?V:0)+((z=this.header.element.innerHeight())!==null&&z!==void 0?z:0)});return}var j=this.header.tabsContainer,L=(t=j.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),R=(n=this.layoutManager.tabDropPlaceholder.get(0))===null||n===void 0?void 0:n.getBoundingClientRect();if(!(!L||!R)){e<L.left?e=L.left+1:e>L.right&&(e=L.right-1);var x,D;if(!(R.left<e&&e<R.right)){for(var k=0;k<T;k++){var fe;if(x=this.header.tabs[k].element,D=(fe=x.get(0))===null||fe===void 0?void 0:fe.getBoundingClientRect(),D&&D.left<e&&e<D.right){this._dropIndex=k;break}}if(x&&D&&e<D.left+D.width*.5)x.before(this.layoutManager.tabDropPlaceholder);else if(x){var Fe;this._dropIndex=Math.min(((Fe=this._dropIndex)!==null&&Fe!==void 0?Fe:0)+1,T),x.after(this.layoutManager.tabDropPlaceholder)}}var je=(r=(s=this.layoutManager.tabDropPlaceholder.offset())===null||s===void 0?void 0:s.left)!==null&&r!==void 0?r:0;je=Math.max(je,(o=(a=this.header.tabsContainer.offset())===null||a===void 0?void 0:a.left)!==null&&o!==void 0?o:0);var y=je+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);y=Math.min(y,((h=(u=this.header.tabsContainer.offset())===null||u===void 0?void 0:u.left)!==null&&h!==void 0?h: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:((b=(C=this.header.element.offset())===null||C===void 0?void 0:C.top)!==null&&b!==void 0?b:0)+((S=this.header.element.innerHeight())!==null&&S!==void 0?S: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,r=(t=this._contentAreaDimensions)===null||t===void 0||(n=t[e])===null||n===void 0?void 0:n.highlightArea;if(r){var s;(s=this.layoutManager.dropTargetIndicator)===null||s===void 0||s.highlightArea(r)}this._dropSegment=e}}const Kh=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:Ce,Component:fo,ContentItem:Ce,Root:Pi,RowOrColumn:Yn,Stack:Ti,isComponent:Ae,isRoot:vo,isStack:un},Symbol.toStringTag,{value:"Module"}));function ot(i,e,t){return e=Gh(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Gh(i){var e=Yh(i,"string");return typeof e=="symbol"?e:String(e)}function Yh(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class gn{constructor(e,t){var n;ot(this,"header",void 0),ot(this,"contentItem",void 0),ot(this,"element",I(gn._template)),ot(this,"titleElement",void 0),ot(this,"closeElement",void 0),ot(this,"isActive",!1),ot(this,"_layoutManager",void 0),ot(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 fn(this.element),this._dragListener.on("dragStart",this._onDragStart,this),this.contentItem.on("destroy",this._dragListener.destroy,this._dragListener)),this._onTabClick=this._onTabClick.bind(this),this._onCloseClick=this._onCloseClick.bind(this),this._onTabContentFocusIn=this._onTabContentFocusIn.bind(this),this._onTabContentFocusOut=this._onTabContentFocusOut.bind(this),this.element.on("click",this._onTabClick),this.element.on("auxclick",this._onTabClick),this.contentItem.config.isClosable?(this.closeElement.on("click",this._onCloseClick),this.closeElement.on("mousedown",this._onCloseMousedown)):this.closeElement.remove(),this.contentItem.tab=this,this.contentItem.emit("tab",this),this.contentItem.layoutManager.emit("tabCreated",this),Ae(this.contentItem)&&(this.contentItem.container._contentElement.on("focusin",this._onTabContentFocusIn).on("focusout",this._onTabContentFocusOut),this.contentItem.container.tab=this,this.contentItem.container.emit("tab",this))}setTitle(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";this.titleElement.html(e)}setActive(e){e!==this.isActive&&(this.isActive=e,e?this.element.addClass("lm_active"):this.element.removeClass("lm_active"))}_$destroy(){this.element.off("click",this._onTabClick),this.element.off("auxclick",this._onTabClick),this.closeElement.off("click",this._onCloseClick),Ae(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 Dt(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(){I(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin")}_onTabContentFocusOut(){Ae(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&&Ae(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):Ae(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),Ae(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(),Ae(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onCloseMousedown(e){e.stopPropagation()}}ot(gn,"_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 Y(i,e,t){return e=qh(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function qh(i){var e=Xh(i,"string");return typeof e=="symbol"?e:String(e)}function Xh(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class lt extends qe{constructor(e,t){var n,r;super(),Y(this,"layoutManager",void 0),Y(this,"element",I(lt._template)),Y(this,"tabsContainer",void 0),Y(this,"tabDropdownContainer",void 0),Y(this,"tabDropdownSearch",void 0),Y(this,"tabDropdownList",null),Y(this,"controlsContainer",void 0),Y(this,"parent",void 0),Y(this,"tabs",[]),Y(this,"activeContentItem",null),Y(this,"closeButton",null),Y(this,"tabDropdownButton",null),Y(this,"tabNextButton",I(lt._nextButtonTemplate)),Y(this,"tabPreviousButton",I(lt._previousButtonTemplate)),Y(this,"holdTimer",null),Y(this,"rAF",null),Y(this,"CLICK_TIMEOUT",500),Y(this,"START_SPEED",.01),Y(this,"ACCELERATION",5e-4),Y(this,"PADDING",10),Y(this,"SCROLL_LEFT","left"),Y(this,"SCROLL_RIGHT","right"),Y(this,"isDraggingTab",!1),Y(this,"isOverflowing",!1),Y(this,"isDropdownShown",!1),Y(this,"dropdownKeyIndex",0),Y(this,"_lastVisibleTabIndex",-1),Y(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=(r=this.layoutManager.config.settings)===null||r===void 0?void 0:r.tabControlOffset,this._createControls()}createTab(e,t){for(var n=0;n<this.tabs.length;n++)if(this.tabs[n].contentItem===e)return;var r=new gn(this,e);if(this.tabs.length===0){this.tabs.push(r),this.tabsContainer.append(r.element);return}t===void 0&&(t=this.tabs.length),t>0?this.tabs[t-1].element.after(r.element):this.tabs[0].element.before(r.element),this.tabs.splice(t,0,r),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,r,s,o=0;o<this.tabs.length;o++)s=this.tabs[o].contentItem===e,this.tabs[o].setActive(s),s===!0&&(this.activeContentItem=e,this.parent.config.activeItemIndex=o);(t=this.tabs[(r=this.parent.config.activeItemIndex)!==null&&r!==void 0?r: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 r;n*=(r=this.tabsContainer.innerWidth())!==null&&r!==void 0?r: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,r,s,o,a;if(((n=(r=this.tabs[t].element.get(0))===null||r===void 0?void 0:r.offsetLeft)!==null&&n!==void 0?n:0)>((s=(o=this.tabsContainer.get(0))===null||o===void 0?void 0:o.offsetWidth)!==null&&s!==void 0?s:0)+((a=this.tabsContainer.scrollLeft())!==null&&a!==void 0?a:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT);else{var l=this.tabsContainer.get(0);if(l){var h,u;l.scrollLeft=(h=(u=this.tabsContainer.get(0))===null||u===void 0?void 0:u.scrollWidth)!==null&&h!==void 0?h:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var n,r,s;if(((n=(r=this.tabs[t].element.get(0))===null||r===void 0?void 0:r.offsetLeft)!==null&&n!==void 0?n: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:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT);else{var o=this.tabsContainer.get(0);o&&(o.scrollLeft=0)}}_handleScrollButtonMouseDown(e){this.holdTimer=window.setTimeout(()=>{var t;this._handleScrollRepeat(e,(t=this.tabsContainer.scrollLeft())!==null&&t!==void 0?t:0,100)},this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)}_handleScrollButtonMouseUp(){var e,t;clearTimeout((e=this.holdTimer)!==null&&e!==void 0?e:-1),this.holdTimer=null,cancelAnimationFrame((t=this.rAF)!==null&&t!==void 0?t:-1),this.rAF=null,window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)}_checkScrollArrows(){var e,t,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,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0,o=this.tabsContainer.get(0);if(o){var a=o.getBoundingClientRect();if(e===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(t-r),this.isDraggingTab&&this.parent._highlightHeaderDropZone(a.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(e===this.SCROLL_RIGHT){var l,h;if(this.tabsContainer.scrollLeft(t+r),this.isDraggingTab&&this.parent._highlightHeaderDropZone(a.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((h=this.tabsContainer.innerWidth())!==null&&h!==void 0?h:0)===o.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((n=this.rAF)!==null&&n!==void 0?n:-1),this.rAF=window.requestAnimationFrame(u=>{var c,v,f=s||u,p=u-f,b=this.START_SPEED*p+.5*this.ACCELERATION*(p*p);b=Math.min(b,(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,b,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(),I(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,r,s;if(s=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new Jt(this,s,"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 Jt(this,n,"lm_popout",t)),this._getHeaderSetting("maximise")){r=this.parent.toggleMaximise.bind(this.parent);var o=this._getHeaderSetting("maximise"),a=this._getHeaderSetting("minimise"),l=new Jt(this,o,"lm_maximise",r);this.parent.on("maximised",function(){l.element.attr("title",a??"")}),this.parent.on("minimised",function(){l.element.attr("title",o??"")})}this._isClosable()&&(e=this.parent.remove.bind(this.parent),n=this._getHeaderSetting("close"),this.closeButton=new Jt(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"),I(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"),I(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(a,l,h){if(h==null||h.length<2)return-1;for(var u=(a+l+h.length)%h.length;u!==a;){if(h.eq(u).css("display")!=="none")return u;u=(u+l+h.length)%h.length}return a}if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var n,r;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),(r=this.tabDropdownList)===null||r===void 0||r.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}else if(e.key==="ArrowUp"||e.key==="Tab"){var s,o;e.preventDefault(),(s=this.tabDropdownList)===null||s===void 0||s.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,-1,this.tabDropdownList),(o=this.tabDropdownList)===null||o===void 0||o.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_handleFilterInput(e){if(this.tabDropdownList!=null){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var t=0;t<this.tabDropdownList.length;t++){var n,r;((n=(r=this.tabs[t].contentItem.config.title)===null||r===void 0?void 0:r.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(),I(document).off("mousedown",this._hideAdditionalTabsDropdown)))}_updateAdditionalTabsDropdown(){var e,t,n,r;if(this.isDropdownShown&&!(!this.tabDropdownList||this.tabDropdownList.length==0)){var s=(e=(t=this.tabDropdownContainer.get(0))===null||t===void 0?void 0:t.scrollHeight)!==null&&e!==void 0?e:0;if(s!==0){var o=this.tabDropdownContainer[0].getBoundingClientRect(),a=(n=I(window).height())!==null&&n!==void 0?n:0,l=(r=I(window).width())!==null&&r!==void 0?r:0;if(this.tabDropdownButton){var h=this.tabDropdownButton.element[0].getBoundingClientRect(),u=s<a-h.bottom,c=!u&&h.bottom>a*.6,v=Math.min(h.left+(c?h.width:0),l-o.width-this.PADDING),f=c?Math.max(h.top-s,this.PADDING):h.bottom,p=a-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()}}}}Y(lt,"_template",['<div class="lm_header">','<ul class="lm_tabs"></ul>','<ul class="lm_controls"></ul>','<ul class="lm_tabdropdown_list">','<li class="lm_tabdropdown_search"><input type="text" placeholder="Find tab..."></li>',"</ul>","</div>"].join(""));Y(lt,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));Y(lt,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function Vt(i,e,t){return e=Zh(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Zh(i){var e=Jh(i,"string");return typeof e=="symbol"?e:String(e)}function Jh(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class po{constructor(e,t,n){Vt(this,"_isVertical",void 0),Vt(this,"_size",void 0),Vt(this,"_grabSize",void 0),Vt(this,"_dragListener",void 0),Vt(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=n<t?t:n,this.element=this._createElement(),this._dragListener=new fn(this.element)}on(e,t,n){var r;(r=this._dragListener)===null||r===void 0||r.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=I('<div class="lm_drag_handle"></div>'),t=I('<div class="lm_splitter"></div>');t.append(e);var n=this._grabSize-this._size,r=n/2;return this._isVertical?(e.css("top",-r),e.css("height",this._size+n),t.addClass("lm_vertical"),t.height(this._size)):(e.css("left",-r),e.css("width",this._size+n),t.addClass("lm_horizontal"),t.width(this._size)),t}}const Qh=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:ho,DragProxy:Dt,DragSource:uo,DragSourceFromEvent:co,DropTargetIndicator:pn,Header:lt,HeaderButton:Jt,Splitter:po,Tab:gn},Symbol.toStringTag,{value:"Module"}));var eu={config:Zd,container:nh,controls:Qh,errors:Ah,items:Kh,utils:bh};const tu=eu;function Dr(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function De(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Dr(Object(t),!0).forEach(function(n){J(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Dr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function J(i,e,t){return e=nu(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function nu(i){var e=iu(i,"string");return typeof e=="symbol"?e:String(e)}function iu(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class go extends qe{static minifyConfig(e){return Ui(e)}static unminifyConfig(e){return Si(e)}constructor(e,t){super(),J(this,"isInitialised",!1),J(this,"_isFullPage",!1),J(this,"_resizeTimeoutId",void 0),J(this,"_components",{"lm-react-component":ao}),J(this,"_fallbackComponent",void 0),J(this,"_itemAreas",[]),J(this,"_maximisedItem",null),J(this,"_maximisePlaceholder",I('<div class="lm_maximise_place"></div>')),J(this,"_creationTimeoutPassed",!1),J(this,"_subWindowsCreated",!1),J(this,"_dragSources",[]),J(this,"_updatingColumnsResponsive",!1),J(this,"_firstLoad",!0),J(this,"_reactChildMap",new Map),J(this,"_reactChildren",null),J(this,"width",null),J(this,"height",null),J(this,"root",void 0),J(this,"openPopouts",[]),J(this,"selectedItem",null),J(this,"isSubWindow",!1),J(this,"eventHub",new lo(this)),J(this,"config",void 0),J(this,"container",void 0),J(this,"_originalContainer",void 0),J(this,"dropTargetIndicator",null),J(this,"tabDropPlaceholder",I('<div class="lm_drop_tab_placeholder"></div>')),J(this,"_typeToItem",void 0),this._onResize=this._onResize.bind(this),this._onUnload=this._onUnload.bind(this),this._windowBlur=this._windowBlur.bind(this),this._windowFocus=this._windowFocus.bind(this),this.config=this._createConfig(e),this._originalContainer=t,this.container=this._getContainer(),this.isSubWindow&&I("body").css("visibility","hidden"),this._typeToItem={column:Yn.bind(this,!0),row:Yn.bind(this,!1),stack:Ti,component:fo}}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 Ce))throw new Error("Root must be a ContentItem");var t={settings:De({},this.config.settings),dimensions:De({},this.config.dimensions),labels:De({},this.config.labels),content:[]},n=function s(o,a){for(var l in a.config)l!=="content"&&(o[l]=a.config[l]);if(o.componentName==="lm-react-component"&&(o.type="react-component"),a.contentItems.length){o.content=[];for(var h=0;h<a.contentItems.length;h++)o.content[h]={},s(o.content[h],a.contentItems[h])}};e?n(t,{contentItems:[e]}):n(t,this.root),this._$reconcilePopoutWindows(),t.openPopouts=[];for(var r=0;r<this.openPopouts.length;r++)t.openPopouts.push(this.openPopouts[r].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){I(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 pn,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}updateSize(e,t){var n,r;if(this.width=(n=e??this.container.width())!==null&&n!==void 0?n:0,this.height=(r=t??this.container.height())!==null&&r!==void 0?r:0,this.isInitialised===!0){if(this.root.callDownwards("setSize",[this.width,this.height]),this._maximisedItem){var s,o;this._maximisedItem.element.width((s=this.container.width())!==null&&s!==void 0?s:0),this._maximisedItem.element.height((o=this.container.height())!==null&&o!==void 0?o:0),this._maximisedItem.callDownwards("setSize")}this._adjustColumnsResponsive()}}destroy(){var e;this.isInitialised===!1||!this.root||(this._onUnload(),I(window).off("resize",this._onResize),I(window).off("unload beforeunload",this._onUnload),I(window).off("blur.lm").off("focus.lm"),this.root.callDownwards("_$destroy",[],!0),this.root.contentItems=[],this.tabDropPlaceholder.remove(),(e=this.dropTargetIndicator)===null||e===void 0||e.destroy(),this.eventHub.destroy(),this._dragSources.forEach(function(t){t._dragListener.destroy()}),this._dragSources=[])}createContentItem(e,t){var n,r;if(typeof e.type!="string")throw new Pt("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!this._typeToItem[e.type])throw n="Unknown type '"+e.type+"'. Valid types are "+Object.keys(this._typeToItem).join(","),new Pt(n);return e.type==="component"&&!(t instanceof Ti)&&t&&!(this.isSubWindow===!0&&t instanceof Pi)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),r=new this._typeToItem[e.type](this,e,t),r}createPopout(e,t,n,r){var s=[],o=e instanceof Ce,a=this;if(o){var l;s=this.toConfig(e).content,n=Hi();for(var h=e.parent,u=e;((c=h)===null||c===void 0?void 0:c.contentItems.length)===1&&!h.isRoot;){var c;u=h,h=h.parent}if((l=h)===null||l===void 0||l.addId(n),r==null||Number.isNaN(r)){var v;r=(v=h)===null||v===void 0?void 0:v.contentItems.indexOf(u)}}else e instanceof Array?s=e:s=[e];if(!t&&o){var f,p,b,C=window.screenX||window.screenLeft,S=window.screenY||window.screenTop,T=(f=e.element.offset())!==null&&f!==void 0?f:{left:0,top:0};t={left:C+T.left,top:S+T.top,width:(p=e.element.width())!==null&&p!==void 0?p:0,height:(b=e.element.height())!==null&&b!==void 0?b:0}}if(!t&&!o&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),o&&e.remove(),!(!t||!n||r===void 0)){var E=new ho(s,t,n,r,this);return E.on("initialised",function(){a.emit("windowOpened",E)}),E.on("closed",function(){a._$reconcilePopoutWindows()}),this.openPopouts.push(E),E}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var n=new uo(e,t,this);return this._dragSources.push(n),n}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new co(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,r=null,s=0;s<this._itemAreas.length;s++){var o=this._itemAreas[s];e>o.x1&&e<o.x2&&t>o.y1&&t<o.y2&&n>o.surface&&(n=o.surface,r=o)}return r}_$createRootItemAreas(){var e=50,t=De({},this.root._$getArea()),n=[De(De({},t),{},{side:"left",x2:t.x1+e}),De(De({},t),{},{side:"right",x1:t.x2-e}),De(De({},t),{},{side:"top",y2:t.y1+e}),De(De({},t),{},{side:"bottom",y1:t.y2-e})];n.forEach(r=>{r.surface=(r.x2-r.x1)*(r.y2-r.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(un(n)){var r=n._$getArea();if(r!==null)if(r instanceof Array)this._itemAreas=this._itemAreas.concat(r);else{var s;this._itemAreas.push(r);var o=De(De({},r),(s=r.contentItem._contentAreaDimensions)===null||s===void 0?void 0:s.header.highlightArea);o.surface=(o.x2-o.x1)*(o.y2-o.y1),this._itemAreas.push(o)}}}}_$normalizeContentItem(e,t){if(!e)throw new Error("No content item defined");if(typeof e=="function"&&(e=e()),e instanceof Ce)return e;if(I.isPlainObject(e)&&e.type){var n=this.createContentItem(e,t);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 r=0;r<n.contentItems.length;r++)t(n.contentItems[r])};return t(this.root),e}_bindEvents(){this._isFullPage&&I(window).resize(this._onResize),I(window).on("unload beforeunload",this._onUnload).on("blur.lm",this._windowBlur).on("focus.lm",this._windowFocus)}_windowBlur(){this.root.element.addClass("lm_window_blur")}_windowFocus(){this.root.element.removeClass("lm_window_blur")}_onResize(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(this.updateSize.bind(this),100)}_createConfig(e){var t,n=oo("gl-window");n&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(n)||"{}"),e=Si(e),localStorage.removeItem(n)),e=I.extend(!0,{},no,e);var r=function s(o){for(var a in o){var l=o[a];a!=="props"&&typeof l=="object"&&l!=null?s(l):a==="type"&&l==="react-component"&&(o.type="component",o.componentName="lm-react-component")}};return r(e),((t=e.settings)===null||t===void 0?void 0:t.hasHeaders)===!1&&(e.dimensions.headerHeight=0),e}_adjustToWindowMode(){var e,t=I('<div class="lm_popin" title="'+this.config.labels.popin+'"><div class="lm_icon"></div><div class="lm_bg"></div></div>');t.click(()=>{this.emit("popIn")}),document.title=$i((e=this.config.content[0].title)!==null&&e!==void 0?e:""),I("head").append(I("body link, body style, template, .gl_keep")),this.container=I("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?I(this._originalContainer):I("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,I("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 Pt(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new Pt(t,e);this.root=new Pi(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 r=Math.max(Math.floor(this.width/t),1),s=e-r,o=this.root.contentItems[0],a=this._findAllStackContainers()[0],l=0;l<s;l++){var h=o.contentItems[o.contentItems.length-1];this._addChildContentItemsToContainer(a,h)}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=>{un(n)?e.push(n):n.isComponent||this._findAllStackContainersRecursive(e,n)})}}J(go,"__lm",tu);const ru=go,su="_lm_dragging_27ejx_1",ou="_lm_goldenlayout_27ejx_1",au="_lm_header_27ejx_1",lu="_lm_controls_27ejx_1",du="_lm_tabpreviousbutton_27ejx_1",hu="_lm_tabnextbutton_27ejx_1",uu="_lm_tab_27ejx_1",cu="_lm_active_27ejx_1",mu="_lm_close_tab_27ejx_1",vu="_lm_content_27ejx_1",fu="_lm_dragProxy_27ejx_1",pu="_lm_dropTargetIndicator_27ejx_1",gu="_march_27ejx_1",bu="_lm_inner_27ejx_1",Cu="_lm_splitter_27ejx_1",yu="_lm_selectable_27ejx_1",_u="_lm_tabdropdown_list_27ejx_1",Su="_lm_title_27ejx_1",wu="_lm_title_before_27ejx_1",Eu="_lm_selected_27ejx_1",Pu="_lm_focusin_27ejx_1",Tu="_lm_window_blur_27ejx_1",Ou="_lm_popout_27ejx_1",Iu="_lm_maximise_27ejx_1",xu="_lm_tabdropdown_27ejx_1",Du="_lm_close_27ejx_1",Mu="_lm_tabdropdown_search_27ejx_1",Nu="_lm_tabs_27ejx_1",Lu="_lm_keyboard_active_27ejx_1",Ru="_lm_maximised_27ejx_1",Au="_lm_items_27ejx_1",Mr={"tab-height":"28px","drag-border-width":"5px",lm_dragging:su,lm_goldenlayout:ou,lm_header:au,lm_controls:lu,lm_tabpreviousbutton:du,lm_tabnextbutton:hu,lm_tab:uu,lm_active:cu,lm_close_tab:mu,lm_content:vu,lm_dragProxy:fu,lm_dropTargetIndicator:pu,march:gu,lm_inner:bu,lm_splitter:Cu,lm_selectable:yu,lm_tabdropdown_list:_u,lm_title:Su,lm_title_before:wu,lm_selected:Eu,lm_focusin:Pu,lm_window_blur:Tu,lm_popout:Ou,lm_maximise:Iu,lm_tabdropdown:xu,lm_close:Du,lm_tabdropdown_search:Mu,lm_tabs:Nu,lm_keyboard_active:Lu,lm_maximised:Ru,lm_items:Au},Nr=Object.freeze({tabHeight:parseInt(Mr["tab-height"],10),dragBorderWidth:parseInt(Mr["drag-border-width"],10)});function Lr(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function st(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Lr(Object(t),!0).forEach(function(n){bo(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Lr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function bo(i,e,t){return e=Fu(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Fu(i){var e=ju(i,"string");return typeof e=="symbol"?e:String(e)}function ju(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var mt=ie.module("LayoutUtils");function Co(i){return i.componentName!==void 0}function At(i){var e=i;return(Co(i)&&i.componentName==="lm-react-component"||i.type==="react-component")&&e.component!==void 0}function Nn(i){return i.focus!==void 0}function Rr(i){return i.type==="stack"}class O{static activateTab(e,t){var n=O.getStackForRoot(e,t,!1);if(!n){mt.error("Could not find stack for config",t);return}var r=O.getContentItemInStack(n,t);r&&n.setActiveContentItem(r)}static isActiveTab(e,t){var n=O.getStackForRoot(e,t,!1);if(!n)return mt.error("Could not find stack for config",t),!1;var r=O.getContentItemInStack(n,t),s=n.getActiveContentItem();return s===r}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=t?"column":"row";if(vo(e)){(e.contentItems==null||e.contentItems.length===0)&&e.addChild({type:n});var r=e.contentItems[0],s=t?r.isColumn:r.isRow;if(!s){e.removeChild(r,!0),e.addChild({type:n});var o=document.activeElement;e.contentItems[0].addChild(r),o&&o.focus!=null&&o.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var a=e.contentItems[e.contentItems.length-1],l=t?a.isRow:a.isColumn;return l||(e.addChild({type:t?"row":"column"}),e.removeChild(a,!0),e.contentItems[e.contentItems.length-1].addChild(a),a=e.contentItems[e.contentItems.length-1]),this.addStack(a,!t)}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&&un(e)&&e.contentItems.length===0)return e;if(e.contentItems==null)return null;for(var r=0;r<e.contentItems.length;r+=1){var s=e.contentItems[r];if(s.isComponent&&s.config!=null&&Yi(s.config,t))return e;var o=this.getStackForConfig(s,t,n);if(o)return o}return null}static getStackForRoot(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=this.getStackForConfig(e,t);return!o&&r&&(o=this.getStackForConfig(e,{component:t.component},s)),!o&&n&&(o=this.addStack(e)),o}static getStackForComponentTypes(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=0;o<t.length;o+=1){var a=t[o],l=o===t.length-1,h=O.getStackForRoot(e,{component:a},n&&l,r,s);if(h)return h}return null}static getContentItemInStack(e,t){if(!e)return null;for(var n=0;n<e.contentItems.length;n+=1){var r=e.contentItems[n];if(r.isComponent&&r.config!=null&&Yi(r.config,t))return r}return null}static dehydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var n=[],r=0;r<e.length;r+=1){var s=e[r],{component:o,content:a}=s;if(o){var l=t(o,s);l!=null?n.push(l):mt.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(o,'"'))}else if(a){var h=st(st({},s),{},{content:O.dehydrateLayoutConfig(a,t)});n.push(h)}else n.push(s)}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:r}=n;r!==void 0?(Rr(n)&&delete n.activeItemIndex,O.dropLayoutMinorChange(r)):At(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;if(n){var r=O.cloneLayout(e),s=O.cloneLayout(t);return O.dropLayoutMinorChange(r),O.dropLayoutMinorChange(s),ln(r,s)}return ln(e,t)}static cloneLayout(e){return JSON.parse(JSON.stringify(e))}static hydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var n=[],r=0;r<e.length;r+=1){var s=e[r];if(At(s)){var o,{component:a,props:l={}}=s;n.push(st(st({},s),{},{id:(o=s?.id)!==null&&o!==void 0?o:en(),props:t(a,l)}))}else if(s.content!==void 0){var h=O.hydrateLayoutConfig(s.content,t);Rr(s)&&s.activeItemIndex!=null&&s.activeItemIndex>=h.length&&(mt.warn("Fixing bad activeItemIndex!",s.activeItemIndex,s),s.activeItemIndex=0),n.push(st(st({},s),{},{content:h}))}else n.push(s)}return n}static openComponent(){var{root:e,config:t,replaceExisting:n=!0,replaceConfig:r=void 0,createNewStack:s=!1,focusElement:o=void 0,dragEvent:a=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},l=document.activeElement,h=st({},t);if(h.id==null&&(h.id=en.generate()),a!=null){e?.layoutManager.createDragSourceFromEvent(h,a);return}var u=r||{id:h.id,component:h.component};A(e);var c=s?O.addStack(e):O.getStackForRoot(e,u);A(c);var v=O.getContentItemInStack(c,u);if(o!=null){var f=b=>{mt.debug("Component created, focusing element",o),c.off("componentCreated",f);var{element:C}=b.origin;requestAnimationFrame(()=>{O.focusElement(C[0],o)})};c.on("componentCreated",f)}if(n&&v){var p=c.contentItems.indexOf(v);c.addChild(h,p+1),c.removeChild(v),c.setActiveContentItem(c.contentItems[p])}else c.addChild(h);o==null&&l&&Nn(l)&&l.focus()}static openComponentInStack(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=document.activeElement,s={id:t.id},o=O.getContentItemInStack(e,s);if(n&&o&&e){var a=e?.contentItems.indexOf(o);e.addChild(t,a+1),e.removeChild(o),e.setActiveContentItem(e.contentItems[a])}else e?.addChild(t);r&&Nn(r)&&r.focus()}static closeComponent(e,t,n){var r=O.getStackForRoot(e,t,!1,!1,!1);if(!r){mt.warn("Cannot find stack for component, ignoring close",t);return}var s=O.getContentItemInStack(r,t),o=document.activeElement;s&&(Ae(s)?s.container.close(n):r.removeChild(s)),o&&document.contains(o)&&Nn(o)&&o.focus()}static renameComponent(e,t,n){var r=O.getStackForRoot(e,t,!1);if(!r){mt.error("Could not find stack for config",t);return}var s=O.getContentItemInStack(r,t);s&&s.setTitle(n)}static cloneComponent(e,t){var n=O.getStackForRoot(e,t,!1);if(!n)return mt.error("Could not find stack for config",t),null;var{props:r={}}=t,s=O.getPanelComponentState(t),o={type:"react-component",component:t.component,props:st(st({},r),{},{panelState:s}),title:"".concat(t.title," Copy"),id:en.generate()};return O.openComponentInStack(n,o),o}static getPanelComponentState(e){if(Co(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(At(e)){var n;return(n=e.props)===null||n===void 0?void 0:n.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:Nr.tabHeight,borderWidth:Nr.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&&At(n)){var r;return(r=n.component)!==null&&r!==void 0?r:null}return null}static getComponentName(e){var t,n,r=(t=(n=e.WrappedComponent)===null||n===void 0?void 0:n.displayName)!==null&&t!==void 0?t:e.displayName;if(r==null)throw new Error("Component displayName not defined ".concat(e));return r}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:(Nn(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)})}}bo(O,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var ku=se.forwardRef((i,e)=>{var t=O.getComponentNameFromPanel({props:i});return d.jsx("div",{ref:e,className:"panel-placeholder",children:d.jsxs("div",{children:['Component "',t,'" is not registered.']})})});ku.displayName="PanelPlaceholder";const Q=Object.freeze({FOCUS:"PanelEvent.FOCUS",MOUNT:"PanelEvent.MOUNT",UNMOUNT:"PanelEvent.UNMOUNT",TITLE_CHANGED:"PanelEvent.TITLE_CHANGED",REOPEN:"PanelEvent.REOPEN",DELETE:"PanelEvent.DELETE",CLONED:"PanelEvent.CLONED",CLOSED:"PanelEvent.CLOSED",OPEN:"PanelEvent.OPEN",CLOSE:"PanelEvent.CLOSE",DRAGGING:"PanelEvent.DRAGGING",DROPPED:"PanelEvent.DROPPED"});function qn(i){return i?.WrappedComponent!==void 0}function Hu(i){return typeof i.id=="string"&&i.layout instanceof ru&&i.panelManager instanceof Wi&&typeof i.registerComponent=="function"}function $u(i){if(!Hu(i))throw new Error("Expected dashboard plugin props, but instead received ".concat(i))}function Ar(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Fr(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ar(Object(t),!0).forEach(function(n){vt(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Ar(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function vt(i,e,t){return e=Uu(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Uu(i){var e=Bu(i,"string");return typeof e=="symbol"?e:String(e)}function Bu(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Ue=ie.module("PanelManager");class Wi{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(a,l)=>l,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(a,l)=>l,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:new Map,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:()=>{};vt(this,"layout",void 0),vt(this,"hydrateComponent",void 0),vt(this,"dehydrateComponent",void 0),vt(this,"onPanelsUpdated",void 0),vt(this,"closed",void 0),vt(this,"openedMap",void 0),this.handleFocus=this.handleFocus.bind(this),this.handleMount=this.handleMount.bind(this),this.handleUnmount=this.handleUnmount.bind(this),this.handleReopen=this.handleReopen.bind(this),this.handleDeleted=this.handleDeleted.bind(this),this.handleClosed=this.handleClosed.bind(this),this.handleControlClose=this.handleControlClose.bind(this),this.layout=e,this.hydrateComponent=t,this.dehydrateComponent=n,this.onPanelsUpdated=o,this.openedMap=new Map(r),this.closed=[...s],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(Q.FOCUS,this.handleFocus),e.on(Q.MOUNT,this.handleMount),e.on(Q.UNMOUNT,this.handleUnmount),e.on(Q.REOPEN,this.handleReopen),e.on(Q.DELETE,this.handleDeleted),e.on(Q.CLOSED,this.handleClosed),e.on(Q.CLOSE,this.handleControlClose)}stopListening(){var{eventHub:e}=this.layout;e.off(Q.FOCUS,this.handleFocus),e.off(Q.MOUNT,this.handleMount),e.off(Q.UNMOUNT,this.handleUnmount),e.off(Q.REOPEN,this.handleReopen),e.off(Q.DELETE,this.handleDeleted),e.off(Q.CLOSED,this.handleClosed),e.off(Q.CLOSE,this.handleControlClose)}getClosedPanelConfigsOfType(e){return this.closed.filter(t=>t.component===e)}getOpenedPanels(){return Array.from(this.openedMap.values())}getOpenedPanelConfigs(){return this.getOpenedPanels().map(e=>{var{glContainer:t}=e.props;return O.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&At(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 r=t[n];if(e==null||e(r))return r}}getLastUsedPanelOfType(e){return this.getLastUsedPanelOfTypes([e])}getLastUsedPanelOfTypes(e){return this.getLastUsedPanel(t=>e.some(n=>qn(n)&&t instanceof n.WrappedComponent||!qn(n)&&t instanceof n))}updatePanel(e){var t=O.getIdFromPanel(e);if(t==null){Ue.error("updatePanel Panel did not have an ID",e);return}Ue.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){Ue.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){Ue.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){Ue.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}Ue.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){Ue.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){Ue.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){Ue.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}handleReopen(e,t){Ue.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:n}=e,{props:r}=e;r=this.hydrateComponent(n,r);var s=Fr(Fr({},e),{},{props:r}),{root:o}=this.layout;O.openComponent({root:o,config:s,replaceConfig:t})}handleDeleted(e){Ue.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){Ue.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 t=O.getComponentConfigFromContainer(e);if(t&&At(t)){var n=this.dehydrateComponent(t.component,t);n!=null&&this.closed.push(n)}}sendUpdate(){var{closed:e,openedMap:t}=this;this.onPanelsUpdated({closed:[...e],openedMap:new Map(t)})}}vt(Wi,"MAX_CLOSED_PANEL_COUNT",100);var Wu=ie.module("PanelErrorBoundary");class zu 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);Wu.debug("componentWillUnmount",n),t.emit(Q.CLOSED,n,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?d.jsx("div",{className:"panel-error-boundary",children:d.jsx(Ni,{errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e}}function jr(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Xn(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?jr(Object(t),!0).forEach(function(n){Vu(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):jr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Vu(i,e,t){return e=Ku(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ku(i){var e=Gu(i,"string");return typeof e=="symbol"?e:String(e)}function Gu(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function yo(i){var{props:e,componentState:t}=i,{metadata:n}=e,{panelState:r=null}=e;t&&({panelState:r}=t);var s={};return n!=null&&(s.metadata=n),r!=null&&(s.panelState=r),Xn(Xn({},i),{},{componentState:null,props:s,type:"react-component"})}function _o(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return Xn(Xn({metadata:{}},i),{},{localDashboardId:e})}function Yu(i){var e=qn(i)&&i.WrappedComponent.prototype!=null&&i.WrappedComponent.prototype.isReactComponent!=null||i.prototype!=null&&i.prototype.isReactComponent!=null,t=!qn(i)&&"$$typeof"in i&&i.$$typeof===$o.ForwardRef;return e||t}const qu={dehydrate:yo,hydrate:_o};var Xu=H.shape({on:H.func,off:H.func,isHidden:H.bool,tab:H.shape({header:H.shape({tabs:H.arrayOf(H.shape({contentItem:H.shape({})}))})}),title:H.string,setTitle:H.func,close:H.func}),So=H.shape({on:H.func,off:H.func,emit:H.func}),Zu=H.shape({registerComponent:H.func,root:H.shape({addChild:H.func}),on:H.func,off:H.func,eventHub:So}),Ju=Object.freeze({Container:Xu,EventHub:So,Layout:Zu});function Se(i,e,t){m.useEffect(function(){return i.on(e,t),()=>{i.off(e,t)}},[i,e,t])}function Kt(i,e,t,n){var r,s=(r=e.COMPONENT)!==null&&r!==void 0?r:e.displayName;if(s==null)throw new Error("ComponentType must have a `COMPONENT` or `displayName` attribute.");se.useEffect(()=>{var o=i(s,e,t,n);return()=>{o()}},[e,n,t,s,i])}var wo="SET_DASHBOARD_DATA";const Qu=Td(wo,{},!1),ec={dashboardData:Qu};var tc=new Map,nc=Object.freeze({}),ic=Object.freeze([]),rc=i=>i.dashboardData,Ne=(i,e)=>{var t;return(t=rc(i)[e])!==null&&t!==void 0?t:nc},vv=(i,e)=>{var t;return(t=Ne(i,e).closed)!==null&&t!==void 0?t:ic},fv=(i,e)=>{var t;return(t=Ne(i,e).openedMap)!==null&&t!==void 0?t:tc};function kr(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Hr(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?kr(Object(t),!0).forEach(function(n){sc(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):kr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function sc(i,e,t){return e=oc(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function oc(i){var e=ac(i,"string");return typeof e=="symbol"?e:String(e)}function ac(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var lc=(i,e)=>({type:wo,id:i,payload:e}),Ct=(i,e)=>(t,n)=>t(lc(i,Hr(Hr({},Ne(n(),i)),e)));Object.entries(ec).map(i=>{var[e,t]=i;return ei.register(e,t)});function dc(i){var{children:e}=i;return d.jsx(d.Fragment,{children:e})}function $r(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Gt(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?$r(Object(t),!0).forEach(function(n){hc(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):$r(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function hc(i,e,t){return e=uc(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function uc(i){var e=cc(i,"string");return typeof e=="symbol"?e:String(e)}function cc(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Ln=ie.module("DashboardLayout"),mc=Object.freeze({}),vc=[],Ur=()=>{},Br=i=>i;function fc(i){var e,t,{id:n,children:r,emptyDashboard:s=d.jsx("div",{children:"Dashboard is empty."}),layout:o,layoutConfig:a=vc,onLayoutChange:l=Ur,onLayoutInitialized:h=Ur,hydrate:u=_o,dehydrate:c=yo,panelWrapper:v=dc}=i,f=fs(),p=(e=Uo(g=>Ne(g,n)))!==null&&e!==void 0?e:mc,[b,C]=m.useState(!1),[S,T]=m.useState(!1),[E,F]=m.useState(),[B]=m.useState((t=p?.closed)!==null&&t!==void 0?t:[]),[X,N]=m.useState(!1),[V,K]=m.useState(o.getReactChildren()),z=m.useMemo(()=>new Map,[]),ee=m.useMemo(()=>new Map,[]),j=m.useCallback(function(g,_){var P,U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:u,ke=arguments.length>3&&arguments[3]!==void 0?arguments[3]:c;Ln.debug2("registerComponent",g,_,U,ke);function w(W,ae){var me=_,ri=v,wn=Yu(me),{glContainer:si,glEventHub:Wt}=W;return d.jsx(zu,{glContainer:si,glEventHub:Wt,children:d.jsx(ri,Gt(Gt({},W),{},{children:wn?d.jsx(me,Gt(Gt({},W),{},{ref:ae})):d.jsx(me,Gt({},W))}))})}w.displayName="DashboardWrapper(".concat((P=_.displayName)!==null&&P!==void 0?P:g,")");var $=o.registerComponent(g,se.forwardRef(w));return z.set(g,U),ee.set(g,ke),$},[u,c,z,ee,o,v]),L=m.useCallback((g,_)=>{var P;return((P=z.get(g))!==null&&P!==void 0?P:Br)(_,n)},[z,n]),R=m.useCallback((g,_)=>{var P;return((P=ee.get(g))!==null&&P!==void 0?P:Br)(_,n)},[ee,n]),x=m.useMemo(()=>new Wi(o,L,R,new Map,B,g=>{var{closed:_,openedMap:P}=g;f(Ct(n,{closed:_,openedMap:P}))}),[R,f,L,n,B,o]),D=m.useCallback(()=>{if(!S){X||(h(),N(!0));var g=o.toConfig(),_=g.content,P=O.dehydrateLayoutConfig(_,R),U=E==null||!O.isEqual(E,P);Ln.debug("handleLayoutStateChanged",U,_,P),U&&(C(o.root.contentItems.length===0),F(P),l(P),K(o.getReactChildren()))}},[R,X,S,E,o,l,h]),k=m.useCallback(g=>{var _=O.getIdFromContainer(g);o.eventHub.emit(Q.DRAGGING,_),T(!0)},[o.eventHub]),fe=m.useCallback(g=>{var _=O.getIdFromContainer(g);o.eventHub.emit(Q.DROPPED,_),T(!1)},[o.eventHub]),Fe=m.useCallback(g=>{if(Ln.debug2("handleComponentCreated",g),!(g==null||g.config==null||g.config.component==null||g.element==null)){var _=g.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),P="".concat(_,"-component");g.element.addClass(P)}},[]),je=m.useCallback(()=>{K(o.getReactChildren())},[o]);Se(o,"stateChanged",D),Se(o,"itemPickedUp",k),Se(o,"itemDropped",fe),Se(o,"componentCreated",Fe),Se(o.eventHub,Q.TITLE_CHANGED,D),Se(o,"reactChildrenChanged",je);var y=Ta(a);return m.useEffect(function(){if(y!==a&&a!==E){Ln.debug("Setting new layout content...");for(var _=O.hydrateLayoutConfig(a,L);o.root.contentItems.length>0;)o.root.contentItems[0].remove();for(var P=0;P<_.length;P+=1)o.root.addChild(_[P]);C(o.root.contentItems.length===0)}},[L,o,a,E,x,y]),d.jsxs(d.Fragment,{children:[b&&s,V,se.Children.map(r,g=>g!=null?se.cloneElement(g,{id:n,layout:o,panelManager:x,registerComponent:j}):null)]})}fc.propTypes={id:H.string.isRequired,children:H.node,data:H.shape({}),emptyDashboard:H.node,layout:Ju.Layout.isRequired,layoutConfig:H.arrayOf(H.shape({})),onLayoutChange:H.func,onLayoutInitialized:H.func};var pv="default";function bn(i,e,t){return e=pc(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function pc(i){var e=gc(i,"string");return typeof e=="symbol"?e:String(e)}function gc(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Ut{}bn(Ut,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");bn(Ut,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");bn(Ut,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");bn(Ut,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");bn(Ut,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");const Ve=Ut;function yt(i,e,t){return e=bc(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function bc(i){var e=Cc(i,"string");return typeof e=="symbol"?e:String(e)}function Cc(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class dt{}yt(dt,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");yt(dt,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");yt(dt,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");yt(dt,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");yt(dt,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");yt(dt,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");yt(dt,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");yt(dt,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");const Wr=dt,gv=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function ht(i,e,t){return e=yc(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function yc(i){var e=_c(i,"string");return typeof e=="symbol"?e:String(e)}function _c(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class nt{}ht(nt,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");ht(nt,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");ht(nt,"CLOSE_FILE","NotebookEvent.closeFile");ht(nt,"RENAME","NotebookEvent.rename");ht(nt,"RENAME_FILE","NotebookEvent.renameFile");ht(nt,"REGISTER_FILE","NotebookEvent.registerFile");ht(nt,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");ht(nt,"UNREGISTER_FILE","NotebookEvent.unregisterFile");ht(nt,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");const te=nt;function Bt(i,e,t){return e=Sc(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Sc(i){var e=wc(i,"string");return typeof e=="symbol"?e:String(e)}function wc(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Mt{}Bt(Mt,"focus","TabEvent.focus");Bt(Mt,"blur","TabEvent.blur");Bt(Mt,"openPQObject","TabEvent.openPQObject");Bt(Mt,"openControl","TabEvent.openControl");Bt(Mt,"reload","TabEvent.reload");Bt(Mt,"clearAllFilters","TabEvent.clearAllFilters");const Rn=Mt;function Ec(i,e,t){return e=Pc(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Pc(i){var e=Tc(i,"string");return typeof e=="symbol"?e:String(e)}function Tc(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Eo 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)}getAllTabs(){var e,t,n,{glContainer:r}=this.props;return[...(e=r==null||(t=r.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?.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 r,s,o,a,l,h,u;if(((r=t[n].contentItem)===null||r===void 0||(s=r.config)===null||s===void 0?void 0:s.id)===((o=e.tab)===null||o===void 0||(a=o.contentItem)===null||a===void 0||(l=a.config)===null||l===void 0?void 0:l.id))break;(h=((u=t[n])===null||u===void 0?void 0:u.contentItem).container)===null||h===void 0||h.close()}}canCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),n=!0,r=t.length-1;r>0;r-=1){var s,o,a,l,h,u,c,v;if(((s=t[r].contentItem)===null||s===void 0||(o=s.config)===null||o===void 0?void 0:o.id)===((a=e.tab)===null||a===void 0||(l=a.contentItem)===null||l===void 0||(h=l.config)===null||h===void 0?void 0:h.id))break;var f=!!(!((u=t[r])===null||u===void 0||(c=u.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 r,s,o,a=!!(!((r=e[n])===null||r===void 0||(s=r.contentItem)===null||s===void 0||(o=s.config)===null||o===void 0)&&o.isClosable);if(a){t=!1;break}}return t}render(){var e,t,n,{additionalActions:r,glContainer:s}=this.props,o=[...r],a=(e=s.tab)===null||e===void 0||(t=e.contentItem)===null||t===void 0||(n=t.config)===null||n===void 0?void 0:n.isClosable;return o.push({title:"Close",order:10,group:q.groups.low,action:this.handleCloseTab,disabled:a===void 0||!a}),o.push(()=>({title:"Close Tabs to Right",order:20,group:q.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),o.push(()=>({title:"Close All",order:30,group:q.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),d.jsx(q,{actions:o})}}Ec(Eo,"defaultProps",{additionalActions:[]});const Oc=Eo;function Po(i,e,t){return e=Ic(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ic(i){var e=xc(i,"string");return typeof e=="symbol"?e:String(e)}function xc(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class To extends m.PureComponent{constructor(e){super(e),Po(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=se.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?.trim();if(n!==void 0&&n!==""){var{onSubmit:r}=this.props;r(n)}else this.setState({value:n,valueWasValidated:!0})}renderRenameDialog(){var{isShared:e,isOwner:t,itemType:n}=this.props,{value:r,valueWasValidated:s}=this.state;return d.jsxs("form",{className:de("p-3",{"was-validated":s}),onSubmit:this.handleRenameSubmit,noValidate:!0,role:"presentation",onMouseDown:o=>{o.stopPropagation()},onMouseUp:o=>{o.stopPropagation()},children:[d.jsxs("div",{className:"form-group",children:[d.jsxs("label",{htmlFor:"rename-dialog-".concat(n,"-input"),children:["Rename ",n]}),d.jsx("input",{type:"text",className:"form-control",id:"rename-dialog-".concat(n,"-input"),value:r??void 0,ref:this.renameInputRef,onChange:this.handleRenameInputChange,required:!0}),d.jsxs("div",{className:"invalid-feedback",children:[n," name cannot be empty"]}),(e||!t)&&d.jsxs("div",{className:"pt-2",children:["Renaming this ",n," will rename for all users."]})]}),d.jsxs("div",{className:"text-right",children:[d.jsx(ne,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),d.jsx(ne,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var{isShown:e,onCancel:t}=this.props;return d.jsx(Oa,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}Po(To,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});function Oi(i,e,t){return e=Dc(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Dc(i){var e=Mc(i,"string");return typeof e=="symbol"?e:String(e)}function Mc(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Nc=ie.module("Panel");class Oo extends m.PureComponent{constructor(e){super(e),Oi(this,"ref",void 0),Oi(this,"getAdditionActions",tt((n,r,s)=>{var o=[];return r&&o.push(this.getCloneAction()),s&&o.push(this.getRenameAction()),[...o,...n]})),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleCopyPanel=this.handleCopyPanel.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleHide=this.handleHide.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleBeforeShow=this.handleBeforeShow.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.handleShowRenameDialog=this.handleShowRenameDialog.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleTab=this.handleTab.bind(this),this.ref=se.createRef();var{glContainer:t}=this.props;this.state={title:O.getTitleFromContainer(t),showRenameDialog:!1,isWithinPanel:!0}}componentDidMount(){var e,t,{componentPanel:n,glContainer:r,glEventHub:s}=this.props;r.on("resize",this.handleResize),r.on("show",this.handleBeforeShow),r.on("shown",this.handleShow),r.on("hide",this.handleHide),r.on("tab",this.handleTab),r.on("tabClicked",this.handleTabClicked),s.on(Ve.SESSION_CLOSED,this.handleSessionClosed),s.on(Ve.SESSION_OPENED,this.handleSessionOpened),s.on(Rn.focus,this.handleTabFocus),s.on(Rn.blur,this.handleTabBlur),s.on(Wr.CLEAR_ALL_FILTERS,this.handleClearAllFilters),s.emit(Q.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(Ve.SESSION_CLOSED,this.handleSessionClosed),n.off(Ve.SESSION_OPENED,this.handleSessionOpened),n.off(Rn.focus,this.handleTabFocus),n.off(Rn.blur,this.handleTabBlur),n.off(Wr.CLEAR_ALL_FILTERS,this.handleClearAllFilters),n.emit(Q.UNMOUNT,e??this)}handleTab(e){e!=null&&this.setState({title:O.getTitleFromTab(e)}),this.forceUpdate();var{onTab:t}=this.props;t(e)}handleTabClicked(e){var{onTabClicked:t}=this.props;t(e)}handleClearAllFilters(){var{onClearAllFilters:e}=this.props;e(...arguments)}handleFocus(e){var{componentPanel:t,glEventHub:n}=this.props;n.emit(Q.FOCUS,t??this);var{onFocus:r}=this.props;r(e)}handleBlur(e){var{onBlur:t}=this.props;t(e)}handleHide(){var{onHide:e}=this.props;e(...arguments)}handleResize(){var{onResize:e}=this.props;e(...arguments)}handleSessionClosed(e){var{onSessionClose:t}=this.props;t(e)}handleSessionOpened(e,t){var{onSessionOpen:n}=this.props;n(e,t)}handleBeforeShow(){var{onBeforeShow:e}=this.props;e(...arguments)}handleShow(){var{onShow:e}=this.props;e(...arguments)}handleTabBlur(){var{onTabBlur:e}=this.props;e(...arguments)}handleTabFocus(){var{onTabFocus:e}=this.props;e(...arguments)}handleRenameCancel(){this.setState({showRenameDialog:!1})}handleShowRenameDialog(){this.setState({showRenameDialog:!0})}handleRenameSubmit(e){var{glContainer:t}=this.props;this.setState({showRenameDialog:!1,title:e});var n=O.getRootFromContainer(t),r=O.getComponentConfigFromContainer(t);A(r),O.renameComponent(n,r,e)}handleCopyPanel(){var{glContainer:e,glEventHub:t}=this.props,n=O.getRootFromContainer(e),r=O.getComponentConfigFromContainer(e);if(r==null){Nc.error("Could not get component config from container",e);return}var s=O.cloneComponent(n,r);s!==null&&t.emit(Q.CLONED,this,s)}getCloneAction(){return{title:"Copy Panel",order:10,group:q.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:q.groups.medium,action:this.handleShowRenameDialog}}render(){var{children:e,className:t,renderTabTooltip:n,glContainer:r,additionalActions:s,errorMessage:o,isLoaded:a,isLoading:l,isClonable:h,isRenamable:u}=this.props,{tab:c}=r,{showRenameDialog:v,title:f,isWithinPanel:p}=this.state;return d.jsxs("div",{className:de("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,d.jsx(Ni,{errorMessage:o,isLoaded:a,isLoading:l}),!p&&c!=null&&Mi.createPortal(d.jsxs(d.Fragment,{children:[d.jsx(Oc,{glContainer:r,additionalActions:this.getAdditionActions(s,h,u)}),u&&d.jsx(To,{isShown:v,value:f,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),n!=null&&d.jsx(Ot,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:n()})]}),c.element[0])]})}}Oi(Oo,"defaultProps",{className:"",onTab:()=>{},onTabClicked:()=>{},onClearAllFilters:()=>{},onFocus:()=>{},onBlur:()=>{},onHide:()=>{},onResize:()=>{},onSessionClose:()=>{},onSessionOpen:()=>{},onBeforeShow:()=>{},onShow:()=>{},onTabBlur:()=>{},onTabFocus:()=>{},renderTabTooltip:null,additionalActions:[],errorMessage:null,isLoading:!1,isLoaded:!0,isClonable:!1,isRenamable:!1});const Cn=Oo,bv=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var Lc=new Map,ti=Object.freeze([]),Cv=(i,e)=>{var t;return(t=Ne(i,e).columns)!==null&&t!==void 0?t:ti},yv=(i,e)=>{var t;return(t=Ne(i,e).filterSets)!==null&&t!==void 0?t:ti},_v=(i,e)=>{var t;return(t=Ne(i,e).filters)!==null&&t!==void 0?t:ti},Sv=(i,e)=>{var t;return(t=Ne(i,e).tableMap)!==null&&t!==void 0?t:Lc},wv=(i,e)=>Ne(i,e).isolatedLinkerPanelId,Io=(i,e)=>{var t;return(t=Ne(i,e).links)!==null&&t!==void 0?t:ti},Ev=(i,e)=>Ne(i,e).columnSelectionValidator,Pv=(i,e)=>Ne(i,e).consoleSettings,Tv=(i,e)=>Ne(i,e).connection,yn=(i,e)=>Ne(i,e).sessionWrapper,Ov=(i,e)=>t=>t(Ct(i,{connection:e})),Iv=(i,e)=>t=>t(Ct(i,{sessionWrapper:e})),xo=(i,e)=>t=>t(Ct(i,{links:e})),xv=(i,e)=>(t,n)=>{var r=Io(n(),i),s=e.filter(o=>r.findIndex(a=>ln(a.start,o.start)&&ln(a.end,o.end))<0);return t(xo(i,r.concat(s)))},Dv=(i,e)=>(t,n)=>{var r=Io(n(),i),s=r.filter(o=>!e.includes(o.id));return t(xo(i,s))},Mv=(i,e)=>t=>t(Ct(i,{isolatedLinkerPanelId:e})),Nv=(i,e)=>t=>t(Ct(i,{columnSelectionValidator:e})),Rc=(i,e)=>t=>t(Ct(i,{consoleSettings:e})),Lv=(i,e)=>t=>t(Ct(i,{filterSets:e}));function Zn(i,e,t){return e=Ac(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ac(i){var e=Fc(i,"string");return typeof e=="symbol"?e:String(e)}function Fc(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var An=ie.module("CommandHistoryPanel");class _n extends m.Component{static handleError(e){An.error(e)}constructor(e){super(e),Zn(this,"container",void 0),Zn(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=se.createRef(),this.pending=new $t;var{session:t,sessionId:n,language:r}=e;this.state={panelState:{},session:t,sessionId:n,language:r,contextActions:[{action:this.handleFocusHistory,shortcut:Ie.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){var{glEventHub:e,session:t}=this.props;e.on(Ve.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(Ve.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:r}=t;this.setState({session:e,sessionId:r,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:r}=this.state;if(An.debug("handleSendToNotebook",n,e),!n){An.error("Session is not connected.");return}var{glEventHub:s}=this.props;s.emit(t?te.CREATE_NOTEBOOK:te.SEND_TO_NOTEBOOK,n,r,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;An.debug("handleSendToConsole",e);var{glEventHub:r}=this.props;r.emit(Ve.SEND_COMMAND,e,t,n)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:n}=this.state;A(t),A(n),this.pending.add(e.getTable(t,n,Date.now()),r=>r.close()).then(r=>{this.setState({table:r})}).catch(_n.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:n}=this.props,{language:r,contextActions:s,table:o}=this.state;return d.jsxs(Cn,{className:"command-history-pane",componentPanel:this,glContainer:e,glEventHub:t,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[!o&&d.jsx("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),o&&r!=null&&d.jsxs(d.Fragment,{children:[d.jsx(Ql,{ref:this.container,language:r,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:o,commandHistoryStorage:n}),d.jsx(q,{actions:s})]})]})}}Zn(_n,"COMPONENT","CommandHistoryPanel");Zn(_n,"TITLE","Command History");var jc=(i,e)=>{var t=Ws(i),n=yn(i,e.localDashboardId),{session:r,config:s}=n??{},{type:o,id:a}=s??{};return{commandHistoryStorage:t,language:o,session:r,sessionId:a}},kc=mn(jc,null,null,{forwardRef:!0})(_n);const Hc=kc;function zr(i,e){return i==null||!Os(i)?!1:[i.supportedTypes].flat().some(t=>t===e)}function $c(i){var e=d.jsx(he,{icon:ps});if(!Os(i))return e;var{icon:t}=i;return t==null?e:m.isValidElement(t)?t:d.jsx(he,{icon:t})}function Rv(){return Ia(xa,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}function Vr(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Kr(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Vr(Object(t),!0).forEach(function(n){Ft(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Vr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Ft(i,e,t){return e=Uc(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Uc(i){var e=Bc(i,"string");return typeof e=="symbol"?e:String(e)}function Bc(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Fn=ie.module("ConsolePanel"),Wc=500,zc=Object.freeze({consoleSettings:{},itemIds:[]});class zi extends m.PureComponent{constructor(e){super(e),Ft(this,"consoleRef",void 0),Ft(this,"objectSubscriptionCleanup",void 0),Ft(this,"savePanelState",an(()=>{var{consoleSettings:o,itemIds:a}=this.state,l={consoleSettings:o,itemIds:[...a]};Fn.debug("Saving panel state",l),this.setState({panelState:l})},Wc)),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=se.createRef();var{panelState:t}=e,n=Kr(Kr({},zc),t||{}),{consoleSettings:r,itemIds:s}=n;this.state={consoleSettings:r,itemIds:new Map(s),objectMap:new Map,error:void 0,panelState:n}}componentDidMount(){var{glEventHub:e}=this.props;this.closeDisconnectedPanels(),e.on(Q.MOUNT,this.handlePanelMount),this.subscribeToFieldUpdates()}componentDidUpdate(e,t){var{consoleSettings:n,itemIds:r}=this.state;(t.consoleSettings!==n||t.itemIds!==r)&&this.savePanelState()}componentWillUnmount(){var e,{glEventHub:t}=this.props;this.savePanelState.flush(),t.off(Q.MOUNT,this.handlePanelMount),(e=this.objectSubscriptionCleanup)===null||e===void 0||e.call(this)}subscribeToFieldUpdates(){var{sessionWrapper:e}=this.props,{session:t}=e;this.objectSubscriptionCleanup=t.subscribeToFieldUpdates(n=>{Fn.debug("Got updates",n),this.setState(r=>{var{objectMap:s}=r,{updated:o,created:a,removed:l}=n,h=[...o,...l],u=new Map(s);h.forEach(v=>{var{title:f}=v;f!==void 0&&u.delete(f)});var c=[...o,...a];return c.forEach(v=>{v.title!==void 0&&u.set(v.title,v)}),{objectMap:u}})})}setItemId(e,t){this.setState(n=>{var{itemIds:r}=n,s=new Map(r);return s.set(e,t),{itemIds:s}})}getItemId(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{itemIds:n}=this.state,r=n.get(e);return r==null&&t&&(r=en.generate(),this.setItemId(e,r)),r}handleTabFocus(){var e;(e=this.consoleRef.current)===null||e===void 0||e.focus()}handlePanelMount(e){var t,n,r,{itemIds:s}=this.state,o=e==null||(t=e.props)===null||t===void 0?void 0:t.id,a=e==null||(n=e.props)===null||n===void 0||(r=n.metadata)===null||r===void 0?void 0:r.sourcePanelId;if(o&&a){var l=new Set(s.values());l.has(a)&&this.setItemId(o,o)}}handleFocusCommandHistory(){var{glEventHub:e}=this.props;e.emit(Ve.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){var{sessionWrapper:t}=this.props,{session:n}=t;this.openWidget(e,n)}handleCloseObject(e){var{title:t}=e;if(t!==void 0){var n=this.getItemId(t,!1),{glEventHub:r}=this.props;r.emit(Q.CLOSE,n)}}handleSettingsChange(e){var{glEventHub:t}=this.props;Fn.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(Ve.SETTINGS_CHANGED,e)}openWidget(e,t){var{glEventHub:n}=this.props,{title:r}=e;A(r);var s=this.getItemId(r),o={fetch:()=>t.getObject(e),panelId:s,widget:e};Fn.debug("openWidget",o),n.emit(Q.OPEN,o)}addCommand(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;(t=this.consoleRef.current)===null||t===void 0||t.addCommand(e,n,r)}closeDisconnectedPanels(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{consoleSettings:t,itemIds:n}=this.state,{isClosePanelsOnDisconnectEnabled:r=!0}=t;if(!(!r&&!e)){var s=[...n.values()],{glEventHub:o}=this.props;s.forEach(a=>{o.emit(Q.CLOSE,a)}),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=>zr(n,e))}iconForType(e){var{plugins:t}=this.props,n=[...t.values()].find(r=>zr(r,e));return n!=null?$c(n):d.jsx(Na,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:n,sessionWrapper:r,timeZone:s,unzip:o}=this.props,{consoleSettings:a,error:l,objectMap:h}=this.state,{config:u,session:c,connection:v,details:f={},dh:p}=r,{workerName:b,processInfoId:C}=f,{id:S,type:T}=u;return d.jsx(Cn,{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&&d.jsx(Fl,{dh:p,ref:this.consoleRef,settings:a,session:c,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:T,statusBarChildren:d.jsxs(d.Fragment,{children:[d.jsx("div",{children:" "}),d.jsx("div",{children:xs.LANGUAGE_MAP.get(T)}),b!=null&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:" • "}),b]}),C!=null&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:" • "}),C,d.jsx("div",{children:" •"})]}),d.jsx("div",{children:" "}),d.jsx("div",{children:d.jsx(ad,{connection:v,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})}),d.jsx("div",{children:" "})]}),scope:S,timeZone:s,objectMap:h,unzip:o,supportsType:this.supportsType,iconForType:this.iconForType})})}}Ft(zi,"COMPONENT","ConsolePanel");Ft(zi,"TITLE","Console");var Vc=(i,e)=>({commandHistoryStorage:Ws(i),sessionWrapper:yn(i,e.localDashboardId),timeZone:hd(i),plugins:cd(i)}),Kc=mn(Vc,null,null,{forwardRef:!0})(zi);const vi=Kc;function Ye(i){return i.type==="directory"}function Gc(i,e,t){return e=Yc(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Yc(i){var e=qc(i,"string");return typeof e=="symbol"?e:String(e)}function qc(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Xc extends Error{constructor(){super("No file exists at the path specified"),Gc(this,"isFileNotFound",!0)}}const Vi=Xc;function Gr(i,e,t,n,r,s,o){try{var a=i[s](o),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(n,r)}function Yr(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){Gr(s,n,r,o,a,"next",l)}function a(l){Gr(s,n,r,o,a,"throw",l)}o(void 0)})}}var at;(function(i){i.GROOVY="text/x-groovy",i.PLAIN_TEXT="text/plain",i.PYTHON="text/x-python",i.PYTHON_COMPILED="application/x-python-code",i.SCALA="text/x-scala",i.UNKNOWN=""})(at||(at={}));class Je{static fileExists(e,t){return Yr(function*(){try{return yield e.info(t),!0}catch(n){if(!(n instanceof Vi))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(!Je.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,r=null;t<0?r=e:(r=e.substring(0,t),n=e.substring(t+1));var s=r?"".concat(r,"-copy"):"Copy";return n!==null?"".concat(s,".").concat(n):s}static getUniqueCopyFileName(e,t){return Yr(function*(){for(var n=Je.getCopyFileName(t);yield Je.fileExists(e,n);)n=Je.getCopyFileName(n);return n})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return at.GROOVY;case"py":return at.PYTHON;case"pyc":return at.PYTHON_COMPILED;case"scala":return at.SCALA;case"txt":return at.PLAIN_TEXT;default:return at.UNKNOWN}}static getParent(e){if(!Je.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(!Je.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("."),r=n>-1?e.substring(0,n):e,s=Je.fileExtensionToString(t);return"".concat(r).concat(s)}static validateName(e){var t=[".",".."],n=/[\\/\0]/g,r=new Map([["\0","null"]]);if(!e)throw new rn("Name cannot be empty");if(t.includes(e))throw new rn('"'.concat(e,'" is a reserved name'));if(n.test(e)){var s,o;throw new rn('Invalid characters in name: "'.concat((s=(o=e.match(n))===null||o===void 0?void 0:o.reduce((a,l)=>a.includes(l)?a:[...a,l],[]).map(a=>r.has(a)?r.get(a):a).join('", "'))!==null&&s!==void 0?s:"",'"'))}}static reducePaths(e){var t=e.filter(n=>Je.isPath(n));return e.filter(n=>!t.some(r=>n!==r&&n.startsWith(r)))}static removeRoot(e,t){if(e.length===0)return t;if(!t.startsWith(e))throw new Error("Filename ".concat(t," does not start with expected root ").concat(e));return t.substring(e.length)}static addRoot(e,t){return"".concat(e).concat(t)}}const M=Je;var Ki=26;function Ii(i){return Ye(i)?M.makePath(i.filename):M.getPath(i.filename)}function qr(i,e){if(i.length===0||e==null)throw new Error("No items to move");var t=Ii(e);if(i.some(n=>{var{filename:r}=n;return M.getPath(r)===t}))throw new Error("File already in the destination folder");if(i.some(n=>Ye(n)&&t.startsWith(M.makePath(n.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:i,targetPath:t}}function Zc(i){if(Ye(i))return i.isExpanded?na:ia;var e=M.getMimeType(i.basename);switch(e){case at.PYTHON:return sa;default:return ra}}function xi(i){var e,{children:t,draggedItems:n,isDragInProgress:r,isDropTargetValid:s,isSelected:o,item:a,itemIndex:l,dropTargetItem:h,onDragStart:u,onDragOver:c,onDragEnd:v,onDrop:f}=i,p=(e=n?.some(N=>N.id===a.id))!==null&&e!==void 0?e:!1,b=Ii(a),C=r&&h?Ii(h):null,S=r&&s&&Ye(a)&&C===b,T=r&&s&&C===b,E=r&&!s&&C===b,F=Zc(a),B=M.getDepth(a.filename),X=Array(B).fill(null).map((N,V)=>d.jsx("span",{className:"file-list-depth-line"},V));return d.jsxs("div",{className:de("d-flex w-100 align-items-center","file-list-item",{"is-dragged":p,"is-exact-drop-target":S,"is-in-drop-target":T,"is-invalid-drop-target":E,"is-selected":o}),onDragStart:N=>u(l,N),onDragOver:N=>c(l,N),onDragEnd:N=>v(l,N),onDrop:N=>f(l,N),draggable:!0,role:"presentation","aria-label":a.basename,children:[X," ",d.jsx(he,{icon:F,className:"item-icon",fixedWidth:!0})," ",d.jsx("span",{className:"truncation-wrapper",children:t??d.jsxs(d.Fragment,{children:[a.basename,d.jsx(Ot,{children:a.basename})]})})]})}function Xr(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function jn(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Xr(Object(t),!0).forEach(function(n){Jc(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Xr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Jc(i,e,t){return e=Qc(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Qc(i){var e=em(i,"string");return typeof e=="symbol"?e:String(e)}function em(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Pe=ie.module("FileList"),tm=500,Zr="item-list-scroll-pane";function nm(i){var{isMultiSelect:e=!1,table:t,onFocusChange:n=()=>{},onMove:r,onSelect:s,onSelectionChange:o=()=>{},renderItem:a=xi,rowHeight:l=Ki,overscanCount:h=pi.DEFAULT_OVERSCAN}=i,[u,c]=m.useState(()=>({items:[],offset:0,itemCount:0})),[v,f]=m.useState({top:0,bottom:0}),[p,b]=m.useState(),[C,S]=m.useState(),[T,E]=m.useState(),[F,B]=m.useState([]),X=m.useRef(),N=m.useRef(null),V=m.useRef(null),K=m.useCallback(w=>{if(w.length===0||u==null)return[];for(var $=[],W=0;W<w.length;W+=1)for(var ae=w[W],me=ae[0];me<=ae[1];me+=1)me>=u.offset&&me<u.offset+u.items.length&&$.push(u.items[me-u.offset]);return $},[u]),z=m.useCallback(w=>{var $=K([[w,w]]);if($.length>0)return $[0]},[K]),ee=m.useCallback(()=>{var w=Ji.count(F);if(w===0)return null;if(w===1){var $=F[0][0],W=z($);if(W!=null)return W.filename}return"".concat(w," items")},[z,F]),j=m.useCallback(w=>{if(!(!C||!p)){Pe.debug("dropItems",C,"to",w);try{var{files:$,targetPath:W}=qr(C,p);if(r?.($,W),w!=null){var ae;B([[w,w]]),(ae=N.current)===null||ae===void 0||ae.focusItem(w)}}catch(me){Pe.error("Unable to complete move",me)}}},[C,p,r]),L=m.useCallback((w,$)=>{var W=u.items[w-u.offset];W!==void 0&&(Pe.debug("handleItemClick",W),s(W,$),Ye(W)&&t?.setExpanded(W.filename,!W.isExpanded))},[u,s,t]),R=m.useCallback((w,$)=>{var W;Pe.debug2("handleItemDragStart",w,F);var ae=F;Ji.isSelected(F,w)||(ae=[[w,w]],B(ae)),S(K(ae)),(W=N.current)===null||W===void 0||W.resetMouseState();var me=document.createElement("div");me.innerHTML='<div class="dnd-placeholder-content">'.concat(ee(),"</div>"),me.className="file-list-dnd-placeholder",document.body.appendChild(me),$.dataTransfer.setDragImage(me,0,0),$.dataTransfer.effectAllowed="move",E(me)},[ee,K,F]),x=m.useCallback((w,$)=>{$.preventDefault(),Pe.debug2("handleItemDragOver",$),b(z(w))},[z]),D=m.useCallback((w,$)=>{Pe.debug("handleItemDragEnd",w),T?.remove(),S(void 0),b(void 0),E(void 0)},[T]),k=m.useCallback((w,$)=>{j(w)},[j]),fe=m.useCallback(()=>{Pe.debug2("handleItemDragExit"),b(void 0)},[]),Fe=m.useCallback(w=>{w.target instanceof Element&&w.target.classList.contains(Zr)&&(w.preventDefault(),Pe.debug2("handleListDragOver",w),b({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),je=m.useCallback(w=>{w.target instanceof Element&&w.target.classList.contains(Zr)&&(Pe.debug("handleListDrop"),j())},[j]),y=m.useCallback(function(w){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(Pe.debug2("handleSelectionChange",w),$===!0||w!==F){B(w);var W=K(w);o(W)}},[K,o,F]),g=m.useCallback(w=>{if(Pe.debug2("handleFocusChange",w),w!=null){var[$]=K([[w,w]]);n($)}else n();X.current=w},[K,n]),_=m.useCallback((w,$)=>{Pe.debug("handleViewportChange",w,$),(w!==v.top||$!==v.bottom)&&f({top:w,bottom:$})},[v]),P=m.useMemo(()=>{if(!C||!p)return!1;try{return qr(C,p),Pe.debug("handleValidateDropTarget true"),!0}catch{return Pe.debug("handleValidateDropTarget false"),!1}},[C,p]),{focusedPath:U}=i;m.useEffect(()=>{U!==void 0&&(U==="/"?t.collapseAll():(t.setExpanded(U,!1),t.setExpanded(U,!0)))},[t,U]),m.useEffect(function(){Pe.debug("updating table viewport",v),t?.setViewport({top:Math.max(0,v.top-h),bottom:v.bottom+h})},[h,t,v]),m.useEffect(function(){var $=t.onUpdate(W=>{c({items:W.items.map(ae=>jn(jn({},ae),{},{itemName:ae.basename})),offset:W.offset,itemCount:t.size})});return()=>{$()}},[t]),m.useEffect(function(){X.current!=null&&g(X.current),F.length>0&&y(F,!0)},[u,g,y,F]),m.useEffect(function(){if(p!=null&&Ye(p)&&p.filename!=="/"){var $=setTimeout(()=>{p.isExpanded||t?.setExpanded(p.filename,!0)},tm);return()=>clearTimeout($)}},[p,t]);var ke=m.useCallback(w=>a(jn(jn({},w),{},{isDragInProgress:C!=null,dropTargetItem:p,draggedItems:C,isDropTargetValid:P,onDragStart:R,onDragEnd:D,onDragOver:x,onDragExit:fe,onDrop:k})),[D,fe,x,R,k,C,p,P,a]);return d.jsx("div",{ref:V,className:de("file-list",{"is-dragging":C!=null}),onDragOver:Fe,onDrop:je,children:d.jsx(pi,{ref:N,items:u.items,itemCount:u.itemCount,offset:u.offset,onFocusChange:g,onSelect:L,onSelectionChange:y,onViewportChange:_,selectedRanges:F,renderItem:ke,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var im={name:"File Explorer",DELETE:xe.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[re.DELETE],macShortcut:[oe.CMD,re.BACKSPACE]}),RENAME:xe.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[re.ENTER],macShortcut:[re.ENTER]})};const Jr={FILE_EXPLORER:im};var Qr=ie.module("FileListItemEditor"),rm=()=>Promise.resolve();function sm(i){var{item:e,onCancel:t,onSubmit:n,validate:r=rm}=i,s=m.useRef(null),[o,a]=m.useState(e.basename),[l,h]=m.useState(),[u,c]=m.useState(Promise.resolve()),v=m.useCallback(()=>{var T;(T=s.current)===null||T===void 0||T.focus()},[s]),f=m.useCallback(T=>T.stopPropagation(),[]),p=m.useCallback(()=>{u.then(()=>{n(o)}).catch(T=>Qr.info("Unable to validate name",T))},[n,o,u]);m.useEffect(function(){var E=Ee.makeCancelable(r(o));return E.then(()=>h(void 0)).catch(F=>{Ee.isCanceled(F)||h(F)}),c(E),()=>E.cancel()},[r,o]),m.useEffect(function(){v()},[v]);var b=m.useCallback(()=>{Qr.debug2("handleBlur"),p()},[p]),C=m.useCallback(T=>{var{value:E}=T.target;a(E)},[]),S=m.useCallback(T=>{T.stopPropagation();var{key:E}=T;switch(E){case"Enter":{p();break}case"Escape":{t();break}}},[t,p]);return d.jsxs("div",{className:"file-list-item-editor",children:[d.jsx("input",{type:"text",className:de("form-control file-list-item-editor-input",{"is-invalid":l}),value:o,ref:s,onBlur:b,onKeyDown:S,onChange:C,onClick:f,onDoubleClick:f,onMouseDown:f}),l&&d.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}function es(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function fi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?es(Object(t),!0).forEach(function(n){om(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):es(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function om(i,e,t){return e=am(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function am(i){var e=lm(i,"string");return typeof e=="symbol"?e:String(e)}function lm(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function Do(i){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:n=!1,onCreateFile:r,onCreateFolder:s,onCopy:o,onDelete:a,onMove:l,onRename:h,onSelect:u,onSelectionChange:c,table:v,rowHeight:f=Ki,validateRename:p=()=>Promise.resolve()}=i,[b,C]=m.useState(),[S,T]=m.useState([]),[E,F]=m.useState(),B=m.useCallback(k=>{T(k),c?.(k)},[c]),X=m.useCallback(k=>{F(k)},[]),N=m.useCallback(()=>{E&&o?.(E)},[E,o]),V=m.useCallback(()=>{S.length>0&&a?.(S)},[a,S]),K=m.useCallback(()=>{r?.()},[r]),z=m.useCallback(()=>{E&&s?.(M.getPath(E.filename))},[E,s]),ee=m.useCallback(()=>{E&&C(E)},[E]),j=m.useCallback(()=>{C(void 0)},[]),L=m.useCallback(k=>{b&&(h?.(b,k),C(void 0))},[h,b]),R=m.useMemo(()=>{if(b)return[];var k=[];return r&&k.push({title:"New File",description:"Create new file",action:K,group:q.groups.medium}),s&&k.push({title:"New Folder",description:"Create new folder",action:z,group:q.groups.medium}),o&&k.push({title:"Copy File",description:"Copy the selected file",action:N,group:q.groups.low,disabled:E==null||Ye(E)}),a&&S.length>0&&k.push({title:"Delete",description:"Delete",shortcut:Jr.FILE_EXPLORER.DELETE,action:V,group:q.groups.low}),h&&k.push({title:"Rename",description:"Rename",shortcut:Jr.FILE_EXPLORER.RENAME,action:ee,group:q.groups.low,disabled:E==null}),k},[N,V,K,z,ee,E,o,r,s,a,h,S,b]),x=m.useCallback(k=>(A(b),p(b,k)),[b,p]),D=m.useCallback(k=>{var{item:fe}=k;return b&&b.filename===fe.filename?d.jsx(xi,fi(fi({},k),{},{children:d.jsx(sm,{item:fe,validate:x,onSubmit:L,onCancel:j})})):d.jsx(xi,fi({},k))},[j,L,b,x]);return d.jsxs("div",{className:"file-list-container",children:[v!=null&&d.jsx(nm,{onMove:l,onSelect:u,onSelectionChange:B,onFocusChange:X,renderItem:D,rowHeight:f,table:v,isMultiSelect:e,focusedPath:t}),n&&d.jsx(q,{actions:R})]})}Do.displayName="FileListContainer";function ts(i,e,t){return e=dm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function dm(i){var e=hm(i,"string");return typeof e=="symbol"?e:String(e)}function hm(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class um extends rn{constructor(e){super("Name already exists"),ts(this,"isExistingFile",!0),ts(this,"info",void 0),this.info=e}}const Hn=um;function ns(i,e,t,n,r,s,o){try{var a=i[s](o),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(n,r)}function is(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){ns(s,n,r,o,a,"next",l)}function a(l){ns(s,n,r,o,a,"throw",l)}o(void 0)})}}var Ze=ie.module("FileExplorer");function Gi(i){var{storage:e,isMultiSelect:t=!1,focusedPath:n,onCopy:r=()=>{},onDelete:s=()=>{},onRename:o=()=>{},onCreateFile:a=()=>{},onCreateFolder:l=()=>{},onSelect:h,onSelectionChange:u,rowHeight:c=Ki}=i,[v,f]=m.useState([]),[p,b]=m.useState();m.useEffect(function(){var L;function R(){return x.apply(this,arguments)}function x(){return x=is(function*(){Ze.debug("initTable"),L=Ee.makeCancelable(e.getTable(),D=>D.close());try{b(yield L)}catch(D){Ee.isCanceled(D)||Ze.error("Unable to initialize table",D)}}),x.apply(this,arguments)}return R(),()=>{L.cancel()}},[e]);var C=m.useCallback(j=>{Ee.isCanceled(j)||Ze.error(j)},[]),S=m.useCallback(()=>{Ze.debug("handleCreateFile"),a()},[a]),T=m.useCallback(()=>{Ze.debug("handleCreateFolder"),l()},[l]),E=m.useCallback(j=>{Ze.debug("handleCopyFile",j.filename),r(j)},[r]),F=m.useCallback(j=>{Ze.debug("handleDelete, pending confirmation",j),f(j)},[]),B=m.useCallback(()=>{Ze.debug("handleDeleteConfirm",v),v.forEach(j=>e.deleteFile(Ye(j)?M.makePath(j.filename):j.filename)),s(v),f([])},[v,s,e]),X=m.useCallback(()=>{Ze.debug("handleDeleteCancel"),f([])},[]),N=m.useCallback((j,L)=>{var R=M.reducePaths(j.map(x=>Ye(x)?M.makePath(x.filename):x.filename));R.forEach(x=>{var D=M.isPath(x)?"".concat(L).concat(M.getBaseName(x.substring(0,x.length-1)),"/"):"".concat(L).concat(M.getBaseName(x));e.moveFile(x,D).then(()=>{o(x,D)}).catch(C)})},[C,o,e]),V=m.useCallback((j,L)=>{var R=j.filename,x=Ye(j);x&&!R.endsWith("/")&&(R="".concat(R,"/"));var D="".concat(M.getParent(R)).concat(L);x&&!D.endsWith("/")&&(D="".concat(D,"/")),Ze.debug2("handleRename",R,D),e.moveFile(R,D).catch(C),o(R,D)},[C,o,e]),K=m.useCallback(function(){var j=is(function*(L,R){if(R!==L.basename){M.validateName(R);var x="".concat(M.getPath(L.filename)).concat(R);try{var D=yield e.info(x);throw new Hn(D)}catch(k){if(!(k instanceof Vi))throw k}}});return function(L,R){return j.apply(this,arguments)}}(),[e]),z=v.length>0,ee=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 d.jsxs("div",{className:"file-explorer",children:[p&&d.jsx(Do,{isMultiSelect:t,focusedPath:n,showContextMenu:!0,onCopy:E,onCreateFolder:T,onCreateFile:S,onMove:N,onDelete:F,onRename:V,onSelect:h,onSelectionChange:u,rowHeight:c,table:p,validateRename:K}),d.jsx(dn,{isOpen:z,headerText:ee,bodyText:"You cannot undo this action.",onCancel:X,onConfirm:B,confirmButtonText:"Delete"})]})}Gi.displayName="FileExplorer";function rs(i,e,t,n,r,s,o){try{var a=i[s](o),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(n,r)}function cm(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){rs(s,n,r,o,a,"next",l)}function a(l){rs(s,n,r,o,a,"throw",l)}o(void 0)})}}function ft(i,e,t){return e=mm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function mm(i){var e=vm(i,"string");return typeof e=="symbol"?e:String(e)}function vm(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var _t=ie.module("NewItemModal");class Tt extends m.PureComponent{static getValidationMessage(e){return e instanceof Hn&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){Ee.isCanceled(e)||_t.error(e)}constructor(e){super(e),ft(this,"inputRef",se.createRef()),ft(this,"cancelableValidatePromise",void 0),ft(this,"cancelableExistingItemPromise",void 0),ft(this,"pending",new $t),ft(this,"pathMap",new Map),ft(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=M.hasPath(t)?M.getPath(t):"/";this.state={isSubmitting:!1,path:n,prevExtension:M.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:M.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:n}=this.props,{isOpen:r}=e,{value:s,path:o}=this.state;!r&&n&&(this.resetValue(),this.isInitialLoad=!0),r&&n&&(!this.isInitialLoad&&(o!==t.path||s!==t.value)&&this.updateValidationStatus(o,s),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){var{defaultValue:e}=this.props,t=M.hasPath(e)?M.getPath(e):"/";this.setState({path:t,value:M.getBaseName(e),validationError:void 0,prevExtension:M.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=Ee.makeCancelable(this.validateName(e,t,n)),this.cancelableValidatePromise}validateName(e,t,n){var r=this;return cm(function*(){M.validateName(t);var{defaultValue:s,storage:o}=r.props;if(n){var a="".concat(e).concat(t);if(a!==s)try{var l=yield o.info(a);throw new Hn(l)}catch(h){if(!(h instanceof Vi))throw h}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(Tt.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var{value:t}=e.target;this.setState({value:t})}handleSelect(e){if(_t.debug("handleSelect",e),e.type==="directory")this.setState({path:M.makePath(e.filename)});else{var t=e.basename,n=M.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 rn))throw e;_t.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;_t.debug("handleOverwriteConfirm",t,n),e("".concat(t).concat(n),!0)}handleExtensionChangeCancel(){_t.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:n}=e,r=M.replaceExtension(t,n);return{showExtensionChangeModal:!1,value:r}}),this.submitModal(!0)}handleExtensionChangeConfirm(){_t.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,r=t==="directory"?n.length:n.lastIndexOf(".");e.focus(),e.setSelectionRange(0,r>0?r:n.length)}}submitModal(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.setState(t=>{var{prevExtension:n,value:r,path:s}=t,{notifyOnExtensionChange:o,type:a}=this.props;_t.debug("submitModal",n,r);var l=M.getExtension(r);return o&&!e&&n!==null&&n!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(s,r,!0).then(h=>{var{onSubmit:u}=this.props;u("".concat(s).concat(r))}).catch(h=>{if(h instanceof Hn&&a!=="directory"&&h.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw h}).catch(h=>{throw Ee.isCanceled(h)&&this.setState({isSubmitting:!1}),h}).catch(this.handleValidationError).catch(Tt.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,r)=>{for(var s="",o=0;o<r;o+=1)s+="".concat(t[o],"/");return s+="".concat(n,"/"),d.jsxs(se.Fragment,{children:[d.jsx(ne,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(s),"aria-label":r===0?"Home":void 0,icon:r===0?d.jsx(he,{icon:oa,transform:"right-1.6"}):void 0,tooltip:r===0?"Home":void 0,children:n}),"/"]},s)})}render(){var{storage:e,isOpen:t,onCancel:n,placeholder:r,title:s,type:o}=this.props,{isSubmitting:a,path:l,showExtensionChangeModal:h,showOverwriteModal:u,validationError:c,value:v,prevExtension:f,newExtension:p}=this.state,b=o==="directory",C=M.fileExtensionToString(f),S=M.fileExtensionToString(p),T=b?"Create":"Save",E=b?"New folder name":"Save file as";return d.jsxs(d.Fragment,{children:[d.jsxs(aa,{isOpen:t,toggle:n,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal theme-bg-dark",children:[d.jsx(la,{toggle:n,children:s}),d.jsx(da,{children:d.jsx("form",{children:d.jsxs("div",{className:"d-flex flex-column new-file-modal-content",children:[d.jsxs("div",{className:"flex-grow-0 mb-4",children:[d.jsx("label",{htmlFor:"file-name-input",children:E}),d.jsx("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:de("form-control",{"is-invalid":c}),value:v,placeholder:r,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),c&&d.jsx("div",{className:"invalid-feedback",children:Tt.getValidationMessage(c)})]}),d.jsxs("div",{className:"flex-grow-0",children:[d.jsx("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),d.jsx("div",{className:"flex-grow-1 file-explorer-container",children:d.jsx(Gi,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),d.jsxs(Da,{children:[d.jsx(ne,{kind:"secondary",onClick:n,children:"Cancel"}),d.jsx(ne,{kind:"primary",disabled:a,onClick:this.handleModalSubmit,children:T})]})]}),d.jsx(dn,{isOpen:u,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"}),d.jsx(dn,{isOpen:h,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(C,'" to "').concat(S,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(C,'"'),confirmButtonText:'Use "'.concat(S,'"')})]})}}ft(Tt,"propTypes",{isOpen:H.bool,title:H.string.isRequired,defaultValue:H.string,type:H.oneOf(["file","directory"]).isRequired,onSubmit:H.func,onCancel:H.func,placeholder:H.string,storage:H.shape({}).isRequired,notifyOnExtensionChange:H.bool});ft(Tt,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(i,e)=>{},onCancel:()=>{}});const Mo=Tt;function fm(i){var{createFile:e,createFolder:t,onSearchChange:n,defaultSearchText:r=""}=i;return d.jsxs("div",{className:"file-explorer-toolbar",children:[d.jsxs("div",{className:"file-explorer-toolbar-buttons",children:[d.jsx(ne,{kind:"ghost",icon:ws,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),d.jsx(ne,{kind:"ghost",icon:ha,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),n&&d.jsx("div",{className:"file-explorer-toolbar-search",children:d.jsx(Ma,{value:r,onChange:n,placeholder:"Search by name"})})]})}function ss(i,e,t,n,r,s,o){try{var a=i[s](o),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(n,r)}function pm(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){ss(s,n,r,o,a,"next",l)}function a(l){ss(s,n,r,o,a,"throw",l)}o(void 0)})}}function No(i,e,t){return e=gm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function gm(i){var e=bm(i,"string");return typeof e=="symbol"?e:String(e)}function bm(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var St=ie.module("FileExplorerPanel"),Cm=(i,e)=>{var t=zs(i),n=yn(i,e.localDashboardId),{session:r,config:s}=n??{},o=s?.type;return{fileStorage:t,language:o,session:r}},ym=mn(Cm,null,null,{forwardRef:!0});function _m(i){var e=i;return e!=null&&typeof e.button=="number"}class Ht extends se.Component{static handleError(e){St.error(e)}static isFocusEvent(e){return _m(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,r={language:n,value:""};St.debug("handleCreateFile",t,n,r),e.emit(te.CREATE_NOTEBOOK,t,n,r)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){St.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){St.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(Ht.handleError)}handleCopyFile(e){var t=this;return pm(function*(){var{fileStorage:n}=t.props;if(Ye(e)){St.error("Invalid item in handleCopyItem",e);return}var r=yield M.getUniqueCopyFileName(n,e.filename);yield n.copyFile(e.filename,r)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(n=>{t.emit(te.CLOSE_FILE,{id:n.filename,itemName:n.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=M.makePath(e[0].filename):t=M.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(St.debug("fileSelect",e),e.type!=="directory"){var n=Ht.isFocusEvent(t),r={id:e.filename,itemName:e.filename},{glEventHub:s}=this.props,{session:o,language:a}=this.state,l={value:null,language:a};s.emit(te.SELECT_NOTEBOOK,o,a,l,r,n)}}handleRename(e,t){var{glEventHub:n}=this.props;St.debug("handleRename",e,t),n.emit(te.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:r,showCreateFolder:s,focusedFilePath:o}=this.state;return d.jsxs(Cn,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:n,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[d.jsx(fm,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),r&&d.jsx(Gi,{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}),d.jsx(Mo,{isOpen:s,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:o})]})}}No(Ht,"COMPONENT","FileExplorerPanel");No(Ht,"TITLE","File Explorer");var Sm=ym(Ht);const wm=Sm;function cn(i,e,t){return e=Em(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Em(i){var e=Pm(i,"string");return typeof e=="symbol"?e:String(e)}function Pm(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var os=ie.module("LogPanel");class ni extends m.PureComponent{constructor(e){super(e),cn(this,"isBottomVisible",void 0),cn(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){os.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){os.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){var{glContainer:e,glEventHub:t}=this.props,{session:n}=this.state;return d.jsxs(Cn,{componentPanel:this,glContainer:e,glEventHub:t,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[n==null&&d.jsx("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),n!=null&&d.jsx(rd,{session:n,ref:r=>{this.logView=r}})]})}}cn(ni,"defaultProps",{session:null});cn(ni,"COMPONENT","LogPanel");cn(ni,"TITLE","Log");var Tm=(i,e)=>{var t;return{session:(t=yn(i,e.localDashboardId))===null||t===void 0?void 0:t.session}},Om=mn(Tm,null,null,{forwardRef:!0})(ni);const Im=Om;function $n(i,e,t){return e=xm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function xm(i){var e=Dm(i,"string");return typeof e=="symbol"?e:String(e)}function Dm(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Lo extends m.PureComponent{constructor(e){super(e),$n(this,"commands",void 0),$n(this,"codeElements",void 0),$n(this,"editorScrollView",void 0),this.handleRunSelected=this.handleRunSelected.bind(this),this.renderCodeBlock=this.renderCodeBlock.bind(this),this.renderLink=this.renderLink.bind(this),this.commands=new Map,this.codeElements=new Map,this.editorScrollView=se.createRef(),this.state={hasCode:!1,hasRunCode:!1,nextStartLine:null}}componentDidMount(){this.updateHasCode()}componentDidUpdate(){this.updateHasCode()}updateHasCode(){var{hasCode:e}=this.state;this.commands.size===0&&e?this.setState({hasCode:!1}):this.commands.size>0&&!e&&this.setState({hasCode:!0})}getNextStartLine(e){var t=[...this.commands.keys()],n=t.findIndex(r=>r===e)+1;return n>=t.length?null:t[n]}handleRunSelected(e){var t,n;e.preventDefault(),e.stopPropagation();var{nextStartLine:r}=this.state,s=[...this.commands.keys()],o=s.findIndex(b=>b===r||r==null);if(!(o<0)){var a=s[o],l=this.commands.get(a),h=this.getNextStartLine(a),u=(t=this.codeElements.get(a))===null||t===void 0?void 0:t.current,c=u==null||(n=u.parentElement)===null||n===void 0?void 0:n.nextElementSibling;if(c!=null){var v,{offsetTop:f}=c,p=f;(v=this.editorScrollView.current)===null||v===void 0||v.scroll({top:p,left:0})}this.runCode(l),this.setState({nextStartLine:h})}}runCode(e){var{onRunCode:t}=this.props;t(e),this.setState({hasRunCode:!0})}renderCodeBlock(e){var{children:t,className:n,inline:r,node:s}=e,{hasRunCode:o,nextStartLine:a}=this.state,{children:l,position:h}=s;A(h);var{start:u}=h,{line:c}=u,v=l[0].value,f=se.createRef(),p=this.commands.size===0,b=a===c||p&&a==null&&!o,C=n!==void 0&&n.startsWith("language-")?n.substring(9):"plaintext";return r!=null&&r?d.jsx("code",{className:n,children:t}):(this.commands.set(c,v),this.codeElements.set(c,f),d.jsxs("div",{className:de("markdown-notebook-code-block",{"is-selected":b}),ref:f,onClick:()=>{this.setState({nextStartLine:c})},role:"presentation",children:[d.jsx(ne,{kind:"ghost",icon:Un,className:"btn-play-block",onClick:S=>{S.stopPropagation(),S.preventDefault(),this.runCode(v),this.setState({nextStartLine:c})},tooltip:"Run code"}),d.jsx("code",{children:d.jsx(Ri,{language:C,children:se.Children.map(t,S=>typeof S=="string"?S.trim():S)})})]}))}renderLink(e){var{onLinkClick:t}=this.props,{href:n,children:r,target:s}=e;return d.jsx("a",{href:n,onClick:t,target:s,children:r})}render(){var{content:e,transformImageUri:t,transformLinkUri:n}=this.props,{hasCode:r,hasRunCode:s,nextStartLine:o}=this.state;return d.jsxs("div",{className:"markdown-notebook",children:[d.jsx("div",{className:"markdown-notebook-toolbar",children:d.jsx(ne,{className:de("btn-play-selected-cell",{flashing:r&&!s}),kind:"ghost",icon:Un,onClick:this.handleRunSelected,tooltip:"Run code and select next",disabled:s&&o==null||!r,children:"Run Selected Code"})}),d.jsx("div",{className:"markdown-notebook-content",ref:this.editorScrollView,children:d.jsx(Bo,{components:{code:this.renderCodeBlock,a:this.renderLink},linkTarget:"_blank",remarkPlugins:[Wo],transformLinkUri:n,transformImageUri:t,includeElementIndex:!0,children:e})})]})}}$n(Lo,"defaultProps",{onRunCode:()=>{}});const Mm=Lo;function as(i,e,t,n,r,s,o){try{var a=i[s](o),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(n,r)}function ls(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){as(s,n,r,o,a,"next",l)}function a(l){as(s,n,r,o,a,"throw",l)}o(void 0)})}}function ds(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function ye(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ds(Object(t),!0).forEach(function(n){we(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):ds(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function we(i,e,t){return e=Nm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Nm(i){var e=Lm(i,"string");return typeof e=="symbol"?e:String(e)}function Lm(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var G=ie.module("NotebookPanel"),hs=400;class ge extends m.Component{static handleError(e){Ee.isCanceled(e)||G.error(e)}static unsavedNotebookCount(){return document.querySelectorAll(".".concat(ge.UNSAVED_INDICATOR_CLASS_NAME,".").concat(ge.UNSAVED_STATUS_CLASS_NAME)).length}static languageFromFileName(e){var t=M.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),we(this,"pending",void 0),we(this,"debouncedSavePanelState",void 0),we(this,"debouncedLoad",void 0),we(this,"notebook",void 0),we(this,"tabTitleElement",void 0),we(this,"tabInitOnce",void 0),we(this,"editor",void 0),we(this,"getSettings",tt((v,f)=>ye(ye({},v),{},{minimap:{enabled:f}}))),we(this,"getOverflowActions",tt((v,f)=>[{title:"Find",icon:ma,action:this.handleFind,group:q.groups.high,shortcut:Ie.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:va,action:this.handleCopy,group:q.groups.medium,order:20},{title:"Rename File",icon:fa,action:this.handleShowRename,group:q.groups.medium,order:30},{title:"Delete File",icon:ys,action:this.handleDelete,group:q.groups.medium,order:40},{title:"Show Minimap",icon:v?tn:void 0,action:this.handleMinimapChange,group:q.groups.low,shortcut:Ie.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:f?tn:void 0,action:this.handleWordWrapChange,group:q.groups.low,shortcut:Ie.NOTEBOOK.WORDWRAP,order:30}])),this.handleBlur=this.handleBlur.bind(this),this.handleCloseCancel=this.handleCloseCancel.bind(this),this.handleCloseDiscard=this.handleCloseDiscard.bind(this),this.handleCloseSave=this.handleCloseSave.bind(this),this.handleCopy=this.handleCopy.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleDeleteConfirm=this.handleDeleteConfirm.bind(this),this.handleDeleteCancel=this.handleDeleteCancel.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleEditorChange=this.handleEditorChange.bind(this),this.handleFind=this.handleFind.bind(this),this.handleMinimapChange=this.handleMinimapChange.bind(this),this.handleWordWrapChange=this.handleWordWrapChange.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleLinkClick=this.handleLinkClick.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handlePanelDropped=this.handlePanelDropped.bind(this),this.handleRenameFile=this.handleRenameFile.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRunCommand=this.handleRunCommand.bind(this),this.handleRunAll=this.handleRunAll.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.handleSave=this.handleSave.bind(this),this.handleSaveAsCancel=this.handleSaveAsCancel.bind(this),this.handleSaveAsSubmit=this.handleSaveAsSubmit.bind(this),this.handleSaveError=this.handleSaveError.bind(this),this.handleSaveSuccess=this.handleSaveSuccess.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleShowRename=this.handleShowRename.bind(this),this.handleTab=this.handleTab.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabClick=this.handleTabClick.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleTransformLinkUri=this.handleTransformLinkUri.bind(this),this.handleOverwrite=this.handleOverwrite.bind(this),this.handlePreviewPromotion=this.handlePreviewPromotion.bind(this),this.getDropdownOverflowActions=this.getDropdownOverflowActions.bind(this),this.pending=new $t,this.debouncedSavePanelState=an(this.savePanelState.bind(this),hs),this.debouncedLoad=an(this.load.bind(this),hs),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;var{isDashboardActive:t,session:n,sessionLanguage:r,panelState:s}=e,o={value:"",language:"",wordWrap:"off"},a=null,{isPreview:l}=e;s!=null&&({fileMetadata:a=a,isPreview:l=l,settings:o=o}=s);var h=a!=null&&M.hasPath(a.itemName),u=h===!0&&o.value!=null||!h&&o.value!=null&&o.value.length>0,c=u?1:0;this.state={error:void 0,isDashboardActive:t,isFocused:!1,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:c,fileMetadata:a,settings:o,session:n,sessionLanguage:r,panelState:{fileMetadata:a,settings:o},showCloseModal:!1,showDeleteModal:!1,showSaveAsModal:!1,scriptCode:""},G.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(te.RENAME_FILE,this.handleRenameFile),t.on(Q.DROPPED,this.handlePanelDropped),e.on(te.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion)}componentDidUpdate(e,t){var{isPreview:n,settings:r}=this.state,{wordWrap:s}=r,{defaultNotebookSettings:o}=this.props;n!==t.isPreview&&this.setPreviewStatus(),s!==t.settings.wordWrap&&(this.updateEditorWordWrap(),this.debouncedSavePanelState()),o.isMinimapEnabled!==e.defaultNotebookSettings.isMinimapEnabled&&this.updateEditorMinimap()}componentWillUnmount(){this.debouncedSavePanelState.flush(),this.pending.cancel();var{glEventHub:e,glContainer:t}=this.props,{fileMetadata:n,isPreview:r}=this.state;e.off(te.RENAME_FILE,this.handleRenameFile),e.off(Q.DROPPED,this.handlePanelDropped),t.off(te.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion),e.emit(te.UNREGISTER_FILE,n,r)}initTab(e){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(e)}initTabCloseOverride(){var{glContainer:e}=this.props;e.beforeClose(t=>{if(t?.force===!0)return!0;var{changeCount:n,savedChangeCount:r}=this.state;return n!==r?(this.setState({showCloseModal:!0}),!1):!0})}initTabClasses(e){var t=e.element.get(0);A(t);var n=t.querySelector(".lm_title");this.tabTitleElement=n,n?.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){var{changeCount:e,savedChangeCount:t,settings:n}=this.state,{value:r}=n;if(e!==t&&this.notebook){var s=this.notebook.getValue();return s??r}return r}initNotebookContent(){var{fileMetadata:e,settings:t,isPreview:n}=this.state;if(e&&e.id){G.debug("Init content from file"),this.registerFileMetadata(e,n),this.load();return}if(t.value!=null){G.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(te.CLOSE_FILE,{id:e})}registerFileMetadata(e,t){var{glEventHub:n,metadata:r}=this.props,{id:s}=r;n.emit(te.REGISTER_FILE,s,e,t)}renameTab(e,t){var{glEventHub:n}=this.props;n.emit(te.RENAME,e,t)}load(){var{fileMetadata:e,settings:t}=this.state;A(e);var{id:n}=e,{fileStorage:r}=this.props;this.pending.add(r.loadFile(n)).then(s=>{var o;G.debug("Loaded file",s);var{filename:a}=s,{itemName:l}=this.state;if(a!==l){var{metadata:h}=this.props,{id:u}=h;this.renameTab(u,M.getBaseName(a))}var c=ye(ye({},t),{},{language:(o=ge.languageFromFileName(a))!==null&&o!==void 0?o:""});t.value==null&&(c.value=s.content),t.wordWrap===void 0&&(t.wordWrap="off"),this.setState({fileMetadata:{id:a,itemName:a},settings:c}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){var{fileMetadata:e}=this.state;if(e&&M.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){G.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;G.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:r,isPreview:s,settings:o}=e,a=this.getNotebookValue(),l=t!==n?a:void 0,h=ye(ye({},o),{},{value:a}),u=ye(ye({},o),{},{value:l}),c={settings:u,fileMetadata:r,isPreview:s};return G.debug("Saving panel state",c),{settings:h,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(te.CLOSE_FILE,{id:e,itemName:e},{force:!0}),this.focus()}handleCopy(){var e=this;return ls(function*(){var{fileStorage:t,glEventHub:n,session:r}=e.props,{fileMetadata:s,settings:o}=e.state;A(s);var{language:a}=o,{itemName:l}=s,h=yield M.getUniqueCopyFileName(t,l);G.debug("handleCopy",s,l,h),yield t.copyFile(l,h);var u={id:h,itemName:h},c={value:null,language:a};n.emit(te.SELECT_NOTEBOOK,r,a,c,u,!0)})()}handleDelete(){G.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var e=this;return ls(function*(){var{fileStorage:t,glContainer:n,glEventHub:r}=e.props,{fileMetadata:s}=e.state;G.debug("handleDeleteConfirm",s?.itemName),e.setState({showDeleteModal:!1}),s&&(M.hasPath(s.itemName)&&(yield M.fileExists(t,s.itemName))?(r.emit(te.CLOSE_FILE,s,{force:!0}),t.deleteFile(s.itemName)):n.close({force:!0}))})()}handleDeleteCancel(){this.setState({showDeleteModal:!1})}handleEditorInitialized(e){this.editor=e}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(e){G.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(t=>{var{changeCount:n,savedChangeCount:r}=t,{isUndoing:s,isRedoing:o}=e;return s?{changeCount:n-1,savedChangeCount:r}:!o&&n<r?{changeCount:n+1,savedChangeCount:0}:{changeCount:n+1,savedChangeCount:r}}),this.debouncedSavePanelState()}handleFind(){this.notebook&&this.notebook.toggleFind()}updateEditorMinimap(){if(this.editor){var{defaultNotebookSettings:e}=this.props;this.editor.updateOptions({minimap:{enabled:e.isMinimapEnabled}})}}handleMinimapChange(){var{settings:e,defaultNotebookSettings:t,saveSettings:n}=this.props,r=ye(ye({},e),{},{defaultNotebookSettings:{isMinimapEnabled:!t.isMinimapEnabled}});n(r)}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:ye(ye({},t),{},{wordWrap:n})}})}handleBlur(){G.debug("handleBlur"),this.setState({isFocused:!1})}handleFocus(){G.debug("handleFocus"),this.setState({isFocused:!0})}handleLinkClick(e){var{notebooksUrl:t,session:n,sessionLanguage:r}=this.props,{href:s}=e.currentTarget;if(!(!s||!s.startsWith(t))){e.stopPropagation(),e.preventDefault();var o="/".concat(s.substring(t.length)).replace(/%20/g," ");if(o==="/"){G.debug("Ignoring invalid notebook link",o);return}G.debug("Notebook link clicked, opening",o);var{glEventHub:a}=this.props,l={value:null,language:r},h={id:o,itemName:o};a.emit(te.SELECT_NOTEBOOK,n,r,l,h)}}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(e){var t=e;Ee.isCanceled(t)||(Ee.isTimedOut(t)&&(t=new Error("File not found.")),G.error(t),this.setState({error:t,isLoading:!1}))}handleSave(){G.debug("handleSave"),this.save()}handleSaveSuccess(e){var t,{fileStorage:n}=this.props,r={id:e.filename,itemName:e.filename},s=(t=ge.languageFromFileName(e.filename))!==null&&t!==void 0?t:"";this.setState(o=>{var{fileMetadata:a}=o,l=ye(ye({},o.settings),{},{language:s});return G.debug("handleSaveSuccess",r,a,l),a&&M.hasPath(a.itemName)&&a.itemName!==r.itemName&&(G.debug("handleSaveSuccess deleting old file",a.itemName),n.deleteFile(a.itemName).catch(ge.handleError)),{fileMetadata:r,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(r,!1)}handleSaveError(e){Ee.isCanceled(e)||(this.setState({savedChangeCount:0}),G.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),G.debug("handleSaveAsSubmit",e);var{fileMetadata:r}=this.state;if(r){var{itemName:s}=r,o=(t=this.getNotebookValue())!==null&&t!==void 0?t:"";if(this.setState({showSaveAsModal:!1}),M.getBaseName(s)!==M.getBaseName(e)){var{metadata:a}=this.props,{id:l}=a;this.renameTab(l,M.getBaseName(e))}this.saveContent(e,o)}}handleRenameFile(e,t,n){var{fileMetadata:r,panelState:s}=this.state,{glContainer:o}=this.props;if(r?.itemName==="/".concat(t)&&n&&JSON.stringify(s)!==JSON.stringify(n)){o.close();return}r&&r.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){G.error("Editor is not initialized.");return}this.runCommand((e=this.notebook.getValue())!==null&&e!==void 0?e:void 0)}handleRunSelected(){if(!this.notebook){G.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;G.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){G.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];G.debug("handleTabFocus",...t);var{glContainer:r}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!r.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){G.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handleTabClick(e){G.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 r=n?.itemName;if(r===void 0)return e;r.charAt(0)==="/"&&(r=r.substring(1));var s=new URL(r,t);return new URL(e,s).href}focus(){requestAnimationFrame(()=>{this.notebook&&this.notebook.focus()})}createNotebook(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{glEventHub:r}=this.props,{session:s,sessionLanguage:o,settings:a}=this.state,l=ye(ye({},a),{},{language:t,value:n}),h={id:null,itemName:e};G.debug("handleCreateNotebook",s,o,l,h),r.emit(te.CREATE_NOTEBOOK,s,o,l,h)}runCommand(e){if(e===void 0||e===""){G.debug("Ignoring empty command.");return}this.removePreviewStatus();var{glEventHub:t}=this.props;t.emit(Ve.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{defaultNotebookSettings:e}=this.props,{settings:t}=this.state;return this.getOverflowActions(e.isMinimapEnabled,this.getSettings(t,e.isMinimapEnabled).wordWrap==="on")}render(){var e,t,{fileStorage:n,glContainer:r,glContainer:{tab:s},glEventHub:o,defaultNotebookSettings:a}=this.props,{changeCount:l,savedChangeCount:h,error:u,isDashboardActive:c,isLoaded:v,isLoading:f,isPreview:p,fileMetadata:b,session:C,sessionLanguage:S,settings:T,showCloseModal:E,showDeleteModal:F,showSaveAsModal:B}=this.state,X=c&&!r.isHidden&&!p,N=(e=b?.itemName)!==null&&e!==void 0?e:ge.DEFAULT_NAME,V=N.endsWith(".md"),K=b?.id!=null,z=this.getSettings(T,a.isMinimapEnabled),ee=C!=null,j=S===z.language,L=!v||!ee||!j,R=!v,x=[{action:this.handleSave,shortcut:Bn.SAVE},{action:this.handleMinimapChange,shortcut:Ie.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:Ie.NOTEBOOK.WORDWRAP}],D=Ci.getDisabledRunTooltip(ee,j,"Notebook extension","Run"),k=Ci.getDisabledRunTooltip(ee,j,"Notebook extension","Run Selected"),fe=[{title:K?"Rename":"Save As…",order:10,group:q.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:q.groups.high,order:20}],Fe=s?.element.find(".lm_title_before").get(0);return d.jsxs(d.Fragment,{children:[Fe!=null&&Mi.createPortal(d.jsx("span",{className:de(ge.UNSAVED_INDICATOR_CLASS_NAME,{[ge.UNSAVED_STATUS_CLASS_NAME]:l!==h})}),Fe),d.jsxs(Cn,{className:"notebook-container",componentPanel:this,glContainer:r,glEventHub:o,onTab:this.handleTab,onResize:this.handleResize,onShow:this.handleShow,onTabClicked:this.handleTabClick,onTabFocus:this.handleTabFocus,onTabBlur:this.handleTabBlur,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onFocus:this.handleFocus,onBlur:this.handleBlur,additionalActions:fe,renderTabTooltip:()=>N,children:[!V&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"notebook-toolbar",children:[d.jsxs("span",{children:[d.jsx(ne,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:L,icon:d.jsx(he,{icon:Un,transform:"grow-4"}),tooltip:"Run ".concat(Ie.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),D!=null&&d.jsx(Ot,{children:D})]}),d.jsxs("span",{children:[d.jsx(ne,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:L,icon:d.jsx(he,{icon:ua,transform:"grow-4"}),tooltip:"Run Selected ".concat(Ie.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),k!=null&&d.jsx(Ot,{children:k})]}),d.jsx(ne,{kind:"ghost",className:"mr-auto",disabled:R,onClick:this.handleSave,icon:ca,tooltip:"Save ".concat(Bn.SAVE.getDisplayText()),"aria-label":"Save"}),d.jsx(ne,{kind:"ghost",className:"btn-overflow btn-link-icon",disabled:R,icon:Ss,tooltip:"More Actions...",onClick:()=>{},children:d.jsx(nn,{actions:this.getDropdownOverflowActions,popperOptions:ge.POPPER_OPTIONS})})]}),d.jsx(Ul,{isLoaded:v,isLoading:f,error:u,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:C,sessionLanguage:S,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:z,focusOnMount:X,ref:je=>{this.notebook=je}})]}),V&&d.jsx(Mm,{content:(t=z.value)!==null&&t!==void 0?t:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri}),d.jsx(Mo,{isOpen:B,type:"file",defaultValue:N,title:K?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:n}),d.jsx(dn,{isOpen:F,headerText:'Are you sure you want to delete "'.concat(N,'"?'),bodyText:"You cannot undo this action.",onCancel:this.handleDeleteCancel,onConfirm:this.handleDeleteConfirm,confirmButtonText:"Delete"}),d.jsx(dn,{isOpen:E,headerText:"Do you want to save the changes you made to ".concat(N,"?"),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"}),d.jsx(q,{actions:x})]})]})}}we(ge,"COMPONENT","NotebookPanel");we(ge,"POPPER_OPTIONS",{placement:"bottom-end"});we(ge,"DEFAULT_NAME","Untitled");we(ge,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");we(ge,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");we(ge,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,defaultNotebookSettings:null});var Rm=(i,e)=>{var t=zs(i),n=Xe(i),r=ud(i),s=yn(i,e.localDashboardId),{session:o,config:a}=s??{},{type:l}=a??{};return{fileStorage:t,settings:n,defaultNotebookSettings:r,session:o,sessionLanguage:l}},Am=mn(Rm,{saveSettings:Cd},null,{forwardRef:!0})(ge);const wt=Am;function us(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function cs(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?us(Object(t),!0).forEach(function(n){Fm(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):us(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Fm(i,e,t){return e=jm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function jm(i){var e=km(i,"string");return typeof e=="symbol"?e:String(e)}function km(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var ce=ie.module("ConsolePlugin");function ms(i){return i.notebook!==void 0}function Hm(i){$u(i)}function Av(i){Hm(i);var{id:e,hydrateConsole:t,layout:n,panelManager:r,registerComponent:s,notebooksUrl:o}=i,a=m.useRef(0),[l,h]=m.useState(new Map),[u,c]=m.useState(new Map),v=fs(),f=m.useCallback(()=>r.getLastUsedPanelOfType(vi),[r]),p=m.useCallback((y,g)=>{h(_=>new Map(_.set(y,g)))},[h]),b=m.useCallback(y=>{h(g=>(g.delete(y),new Map(g)))},[h]),C=m.useCallback((y,g)=>{c(_=>new Map(_.set(y,g)))},[c]),S=m.useCallback(y=>{c(g=>(g.delete(y),new Map(g)))},[c]),T=m.useCallback(function(y){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,P=y&&y.trim();if(!P)ce.info("Ignoring empty code");else{var U=f();if(!U||!(U instanceof vi.WrappedComponent)){ce.error("Console panel not found");return}ce.debug("Send command: ",y,g,_),U.addCommand(y,g,_)}},[f]),E=m.useCallback(y=>{v(Rc(e,y))},[v,e]),F=m.useCallback(y=>{var{language:g}=y,_=g==="python"?"py":g,P=null;return _==null?(ce.debug("No extension for language",g),P="Untitled-".concat(a.current)):P="Untitled-".concat(a.current,".").concat(_),a.current+=1,P},[]),B=m.useCallback(function(y){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{id:_}=y;if(_!=null&&l.has(_))return l.get(_);if(_!=null&&u.has(_))return u.get(_);if(g)return en.generate()},[l,u]),X=m.useCallback((y,g)=>{O.renameComponent(n.root,{id:y},g)},[n.root]),N=m.useCallback((y,g)=>{ce.debug("Rename file panel",y,g);var _;if(l.has(y)&&(_=l.get(y),b(y),_!=null&&p(g,_)),u.has(y)&&(_=u.get(y),S(y),_!=null&&C(g,_)),_===void 0){ce.debug2("File ".concat(y," isn't open, no need to rename the tab"));return}X(_,M.getBaseName(g))},[l,u,X,p,C,b,S]),V=m.useCallback(y=>{var g=B(y,!1);if(g==null){ce.error("Could not find panel id for file metadata",y);return}O.activateTab(n.root,{id:g})},[B,n.root]),K=m.useCallback((y,g,_)=>{if(ce.debug("registerFilePanel",y,g,_),g==null||g.id==null){ce.debug("Ignore empty file id",g);return}var{id:P}=g;if(_){C(P,y);return}if(l.has(P)){var U=l.get(P);if(y===U){ce.debug("Update tab title for file ".concat(P));var{itemName:ke}=g;N(P,ke)}else ce.error("File ".concat(P," already associated with a different tab ").concat(U));return}p(P,y),u.has(P)&&S(P)},[l,u,N,p,C,S]),z=m.useCallback((y,g)=>{if(ce.debug("unregisterFileTab",y,g),y==null||y.id==null){ce.debug("Ignore empty file id",y);return}var{id:_}=y;if(g){S(_);return}b(_)},[b,S]),ee=m.useCallback((y,g)=>{ce.debug("closeFilePanel",y);var{id:_}=y,P=null,U=!1;if(l.has(_))P=l.get(_);else if(u.has(_))P=u.get(_),U=!0;else{ce.debug("File ".concat(_," isn't open, ignore close event"));return}z(y,U),O.closeComponent(n.root,{id:P},g)},[n.root,l,u,z]),j=m.useCallback(y=>{var{itemName:g}=y;return M.getBaseName(g)},[]),L=m.useCallback(y=>{var{id:g}=y;return ce.debug("fileIsOpen",y,g,l),g!=null&&l.has(g)},[l]),R=m.useCallback(y=>{var{id:g}=y;return ce.debug("fileIsOpenAsPreview",y,g,u),g!=null&&u.has(g)},[u]),x=m.useCallback(y=>{if(y!=null){var g=r.getOpenedPanelById(y);g&&ms(g)&&g.focus()}},[r]),D=m.useCallback(y=>{var{id:g,settings:_,fileMetadata:P,session:U,sessionLanguage:ke,isPreview:w=!1}=y,$={settings:_,fileMetadata:P},W=j(P);return{type:"react-component",component:wt.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:g},session:U,sessionLanguage:ke,panelState:$,isPreview:w,notebooksUrl:o},title:W,id:g}},[j,e,o]),k=m.useCallback(function(y,g,_){var P=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{id:null,itemName:F(_)},U=B(P);if(L(P)&&U!=null){ce.debug("File is already open, focus panel"),V(P),x(U);return}var ke=O.getStackForComponentTypes(n.root,[wt.COMPONENT]),w=D({id:U,settings:_,fileMetadata:P,session:y,sessionLanguage:g});ce.debug("createNotebook",w,l),O.openComponentInStack(ke,w)},[L,x,F,B,n.root,D,l,V]),fe=m.useCallback(function(y,g,_,P){var U=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;ce.debug("selectNotebook",P,U);var ke=L(P),w=R(P),[$]=[...u.values()],W=!U,ae=W&&$?$:B(P);if(ae==null||ae==="")throw new Error("Unable to retrieve or create panelId for metadata",P);if(ke||w)V(P);else{var me=O.getStackForComponentTypes(n.root,[wt.COMPONENT]),ri=D({id:ae,settings:_,fileMetadata:P,session:y,sessionLanguage:g,isPreview:W});O.openComponentInStack(me,ri)}if(w&&U){var wn=P.id,si=O.getStackForConfig(n.root,{component:wt.COMPONENT,id:ae}),Wt=O.getContentItemInStack(si,{component:wt.COMPONENT,id:ae});Wt&&Ae(Wt)&&(Wt.container.emit(te.PROMOTE_FROM_PREVIEW),S(wn),p(wn,ae))}U&&x(ae)},[V,L,R,x,B,n.root,D,u,S,p]),Fe=m.useCallback(function(y,g){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},P=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,U=r.getLastUsedPanelOfType(wt);U&&ms(U)?_!=null&&_.value!=null&&U.notebook!=null&&U.notebook.append(_.value):P&&k(y,g,_)},[k,r]),je=m.useCallback((y,g)=>qu.hydrate(cs(cs({},y),{},{notebooksUrl:o}),g),[o]);return Kt(s,vi,t),Kt(s,Hc),Kt(s,wm),Kt(s,Im),Kt(s,wt,je),Se(n.eventHub,Ve.SEND_COMMAND,T),Se(n.eventHub,Ve.SETTINGS_CHANGED,E),Se(n.eventHub,te.CLOSE_FILE,ee),Se(n.eventHub,te.CREATE_NOTEBOOK,k),Se(n.eventHub,te.SELECT_NOTEBOOK,fe),Se(n.eventHub,te.RENAME,X),Se(n.eventHub,te.RENAME_FILE,N),Se(n.eventHub,te.SEND_TO_NOTEBOOK,Fe),Se(n.eventHub,te.REGISTER_FILE,K),Se(n.eventHub,te.UNREGISTER_FILE,z),null}function ii(i,e,t){return e=$m(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function $m(i){var e=Um(i,"string");return typeof e=="symbol"?e:String(e)}function Um(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Sn{}ii(Sn,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");ii(Sn,"INPUT_FILTER","ControlType.INPUT_FILTER");ii(Sn,"MARKDOWN","ControlType.MARKDOWN");ii(Sn,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");const Fv=Sn;export{rv as $,yn as A,Gm as B,Fv as C,fc as D,dd as E,wm as F,qu as G,wt as H,Wr as I,pv as J,Q as K,O as L,gv as M,te as N,Na as O,ku as P,Av as Q,M as R,Vi as S,bv as T,sv as U,av as V,lc as W,lv as X,Ov as Y,Iv as Z,hv as _,ru as a,pd as a0,ov as a1,uv as a2,Rv as a3,Ym as a4,Ju as a5,Cn as a6,Mv as a7,Sv as a8,fv as a9,wv as aa,Ev as ab,_v as ac,Io as ad,Cv as ae,Lv as af,yv as ag,Ri as ah,vv as ai,Ye as aj,$u as ak,Se as al,xo as am,xv as an,Dv as ao,Nv as ap,yo as aq,_o as ar,Yu as as,Ve as at,Rn as au,Rc as av,Pv as aw,qm as b,Xm as c,Zm as d,Km as e,Qm as f,Jm as g,ev as h,tv as i,hd as j,Xe as k,nv as l,cv as m,ei as n,vi as o,Im as p,Hc as q,xt as r,Cd as s,dv as t,Ct as u,bd as v,iv as w,Ne as x,cd as y,Tv as z};
|
|
21
|
-
//# sourceMappingURL=ControlType-
|
|
21
|
+
//# sourceMappingURL=ControlType-1b6b0693.js.map
|