@deephaven/code-studio 0.49.2-theme-plugins.45 → 0.50.0
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-594f9ef9.js +6 -0
- package/build/assets/AppRoot-594f9ef9.js.map +1 -0
- package/build/assets/ControlType-739cf14a.js +21 -0
- package/build/assets/ControlType-739cf14a.js.map +1 -0
- package/build/assets/{ControlType-61d50c36.css → ControlType-f220a027.css} +1 -1
- package/build/assets/index-07ade726.js +12 -0
- package/build/assets/index-07ade726.js.map +1 -0
- package/build/assets/{index-7c4decfc.js → index-22fa6865.js} +2 -2
- package/build/assets/{index-7c4decfc.js.map → index-22fa6865.js.map} +1 -1
- package/build/assets/{index-303a0543.js → index-4d662ebf.js} +11 -11
- package/build/assets/index-4d662ebf.js.map +1 -0
- package/build/assets/{index-3d62f2d2.css → index-824ffbc8.css} +1 -1
- package/build/assets/index-d04a1c67.css +1 -0
- package/build/assets/{useConnection-da79e332.js → useConnection-c5e2e341.js} +4 -4
- package/build/assets/{useConnection-da79e332.js.map → useConnection-c5e2e341.js.map} +1 -1
- package/build/assets/{useLoadTablePlugin-3c85f5cb.js → useLoadTablePlugin-6c4802c1.js} +2 -2
- package/build/assets/{useLoadTablePlugin-3c85f5cb.js.map → useLoadTablePlugin-6c4802c1.js.map} +1 -1
- package/build/assets/{useUser-df945b40.js → useUser-99bf68df.js} +2 -2
- package/build/assets/{useUser-df945b40.js.map → useUser-99bf68df.js.map} +1 -1
- package/build/index.html +3 -3
- package/package.json +31 -31
- package/build/assets/AppRoot-a1b43580.js +0 -6
- package/build/assets/AppRoot-a1b43580.js.map +0 -1
- package/build/assets/ControlType-6b65518d.js +0 -21
- package/build/assets/ControlType-6b65518d.js.map +0 -1
- package/build/assets/index-2d0a26d1.js +0 -8
- package/build/assets/index-2d0a26d1.js.map +0 -1
- package/build/assets/index-303a0543.js.map +0 -1
- package/build/assets/index-cb5a2514.css +0 -1
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{C as d,G as ge,r as m,as as qs,N as z,F as de,a3 as Kt,a1 as Ys,H as le,S as st,at as un,I as xo,K as fn,L as Xs,$ as pn,au as Wi,av as Zs,aw as Qs,ax as Js,ay as ea,az as I,R as zi,aA as or,ar as Io,aB as ta,M as Sn,aq as na,aC as ia}from"./vendor-c6a8042a.js";import{w as ra,aC as oa,aD as Do,a5 as Mo,F as No,j as sa,e as M,d as sn,X as aa,L as ee,aE as sr,aF as la,aG as da,aH as ha,aI as ua,f as Lo,N as Ro,aJ as Ao,U as cn,G as Vi,a6 as ca,aK as ma,aL as ga,aM as ar,aN as Xn,aO as lr,aP as ko,aQ as va,C as fa,aR as pa,aS as ba,aT as Ca,aU as ya,aV as _a,M as Sa,b as wa,c as Ea,aW as Pa,aX as Ta,aA as Oa,aY as xa,aZ as Ia,a_ as Da}from"./index-2d0a26d1.js";import{P as Se,u as Ma,c as Fo,B as se,e as ue,aE as R,K as B,G as Zn,p as Z,as as Na,C as La,k as mn,l as jo,x as Ra,f as Ft,ah as Aa,ar as xi,aF as ka,aG as Fa,af as ja,o as $a,aH as dr,s as bn,aC as Ha,aI as Ba}from"./useConnection-da79e332.js";import{e as it,l as rt,K as ke,a as mt,b as hr,R as Ua}from"./monaco-3857fcdf.js";import{P as Ii,b as Wa,h as za,p as Va,o as Ka,s as Ga,t as qa,c as pi}from"./plotly-e8f43474.js";function Zt(i,e,t){return e=Ya(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ya(i){var e=Xa(i,"string");return typeof e=="symbol"?e:String(e)}function Xa(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 Za="table_",$o="column_",Qa=new Set(["in","not","i","ii","k"]),Ja=new Set(["abstract","continue","for","new","switch","assert","default","if","package","synchronized","boolean","do","goto","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","null","true","false"]),el=/[^a-zA-Z0-9_$+@-]/g,tl=/[^A-Za-z0-9_$]/g;class qe{}Zt(qe,"legalize",(i,e,t,n,r)=>{var o=i.trim().replace(/[- ]/g,"_");return n&&(Qa.has(o)||Ja.has(o))&&(o=e+o),o=o.replace(t,""),o||(o=e+r),Number.isNaN(Number(o.charAt(0)))||(o=e+o),o});Zt(qe,"legalizeTableName",i=>qe.legalize(i,Za,el,!1,0));Zt(qe,"legalizeColumnNames",i=>{var e=[];return i.forEach((t,n)=>{var r=qe.legalizeColumnName(t,n);e.includes(r)&&(r=$o+n),e.push(r)}),e});Zt(qe,"legalizeColumnName",function(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return qe.legalize(i,$o,tl,!0,e)});Zt(qe,"isValidTableName",i=>qe.legalizeTableName(i)===i);Zt(qe,"isValidColumnName",i=>qe.legalizeColumnName(i)===i);const Ho=qe;function ur(i,e,t){return e=nl(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function nl(i){var e=il(i,"string");return typeof e=="symbol"?e:String(e)}function il(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 rl{constructor(){ur(this,"pending",[]),ur(this,"resolved",[])}add(e,t){var n=Se.makeCancelable(e,t);return this.pending.push(n),n.then(()=>{this.resolve(n)},()=>{this.resolve(n)}),n}remove(e){for(var t=0;t<this.pending.length;t+=1)if(this.pending[t]===e){this.pending.splice(t,1);return}}resolve(e){this.remove(e),this.resolved.push(e)}cancel(){for(var e=[...this.pending,...this.resolved],t=0;t<e.length;t+=1)e[t].cancel();this.pending=[],this.resolved=[]}}const Qt=rl;function ol(i,e,t){return e=sl(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function sl(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)}class ll extends Error{constructor(){super(...arguments),ol(this,"isInvalid",!0)}}const gn=ll;function dl(i){var{type:e}=i,t=Ma();switch(e){case t.VariableType.TABLE:case t.VariableType.TABLEMAP:case t.VariableType.TREETABLE:case t.VariableType.HIERARCHICALTABLE:return d.jsx(ge,{icon:Mo});case t.VariableType.FIGURE:return d.jsx(ge,{icon:Do});case t.VariableType.PANDAS:return d.jsx(ge,{icon:oa});default:return d.jsx(ge,{icon:ra})}}function hl(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)}class ml extends m.Component{constructor(e){super(e),hl(this,"container",void 0),this.container=null}componentDidMount(){this.colorize()}colorize(){var{children:e}=this.props;this.container&&e!=null&&it.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 Ki=ml;class gl{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}const Bo=gl;class Qn{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)?[]:qs.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"),o="".concat(e.getMilliseconds()).padStart(3,"0");return"".concat(t,":").concat(n,":").concat(r,".").concat(o)}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 Qn.isTableType(e,t)||Qn.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}const Di=Qn;function Uo(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})]})}Uo.propTypes={children:z.node.isRequired};function Mi(i,e,t){return e=vl(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function vl(i){var e=fl(i,"string");return typeof e=="symbol"?e:String(e)}function fl(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 Wo extends m.Component{constructor(e){super(e),Mi(this,"timer",void 0),Mi(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(No,{}),"Running... ",Fo.formatElapsedTime(n)," ",d.jsx(se,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:sa,tooltip:"Cancel",onClick:t,disabled:e})]})})}}Mi(Wo,"defaultProps",{disabled:!1});const pl=Wo;function vn(i,e,t){return e=bl(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function bl(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)}class qt extends m.PureComponent{constructor(e){super(e),vn(this,"mouseX",void 0),vn(this,"mouseY",void 0),vn(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)>=qt.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=qt.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;M(n);var r=n.indexOf(`
|
|
2
|
-
`),o=r>-1,s=n;o&&(s=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:[o&&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(ge,{icon:e?sn:aa,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:s}),e?a:""]})]}),!o&&d.jsx("div",{className:"error-content",children:d.jsx("div",{className:"console-error-text",children:s})})]},"error")}}vn(qt,"defaultProps",{message:""});vn(qt,"mouseDragThreshold",5);const yl=qt;function _l(i,e,t){return e=Sl(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Sl(i){var e=wl(i,"string");return typeof e=="symbol"?e:String(e)}function wl(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 cr=ee.module("ConsoleHistoryItem");class zo extends m.PureComponent{constructor(e){super(e),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){cr.debug("handleObjectClick",e);var{openObject:t}=this.props;t(e)}handleCancelClick(){var{item:e}=this.props;e!=null&&e.cancelResult&&(cr.debug("Cancelling command: ".concat(e.command)),e.cancelResult())}render(){var{disabled:e,item:t,language:n}=this.props,{disabledObjects:r,result:o}=t,s=t.command!=null&&t.command!=="",a=null;s&&(a=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(Ki,{language:n,children:t.command})})]}));var l=[],h=!1;if(o){var{error:u,message:c,changes:g}=o;if(g){var{created:v,updated:f}=g;[...v,...f].forEach(K=>{h=!0;var{title:te}=K,x="".concat(te),j=e===void 0||e||(r??[]).indexOf(x)>=0,G=d.jsx(se,{kind:"primary",onClick:()=>this.handleObjectClick(K),className:"btn-console-object",disabled:j,icon:d.jsx(dl,{type:K.type}),children:te},x);l.push(G)})}if(u!=null&&!s){var p,C="".concat((p=u.message)!==null&&p!==void 0?p:u);C||(C=u);var _=d.jsx(yl,{message:C},"result-error");l.push(_)}if(c!==void 0&&c!==""){var T=d.jsx("div",{className:"log-message",children:c},"log-message");l.push(T)}}else{h=!0;var w=d.jsx(pl,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");l.push(w)}var U=null;return l.length>0&&(U=d.jsx(Uo,{children:l})),d.jsxs("div",{className:de("console-command-result",{"console-result-buttons":h}),children:[a,U]})}}_l(zo,"defaultProps",{disabled:!1});const El=zo;function Pl(i,e,t){return e=Tl(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Tl(i){var e=Ol(i,"string");return typeof e=="symbol"?e:String(e)}function Ol(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 ai extends m.Component{static itemKey(e,t){return"".concat(e,".").concat(t.command,".").concat(t.result&&t.result.message,".").concat(t.result&&t.result.error)}render(){for(var{disabled:e,items:t,language:n,openObject:r}=this.props,o=[],s=0;s<t.length;s+=1){var a=t[s],l=d.jsx(El,{disabled:e,item:a,openObject:r,language:n},ai.itemKey(s,a));o.push(l)}return d.jsx("div",{className:"container-fluid console-history",children:o})}}Pl(ai,"defaultProps",{disabled:!1});const xl=ai;var Il={name:"Console",CLEAR:ue.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[R.CTRL,B.L],macShortcut:[R.CTRL,B.C]}),FOCUS_HISTORY:ue.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[R.CTRL,B.H],macShortcut:[R.CTRL,R.OPTION,B.H]})},Dl={name:"Command History",FOCUS_HISTORY:ue.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[R.CTRL,B.H],macShortcut:[R.CTRL,R.OPTION,B.H]}),SEND_TO_CONSOLE:ue.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[B.ENTER],macShortcut:[B.ENTER]}),SEND_TO_NOTEBOOK:ue.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[R.CTRL,B.ENTER],macShortcut:[R.CMD,B.ENTER]}),RUN:ue.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[R.ALT,B.R],macShortcut:[R.OPTION,B.R]})},Ml={name:"Notebook",RUN:ue.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[R.ALT,B.R],macShortcut:[R.OPTION,B.R]}),RUN_SELECTED:ue.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[R.ALT,R.SHIFT,B.R],macShortcut:[R.OPTION,R.SHIFT,B.R]}),FIND:ue.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[R.CTRL,B.F],macShortcut:[R.CMD,B.F],isEditable:!1}),MINIMAP:ue.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[R.ALT,B.M],macShortcut:[R.OPTION,B.M]}),WORDWRAP:ue.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[R.ALT,B.Z],macShortcut:[R.OPTION,B.Z]})},Nl={CONSOLE:Il,COMMAND_HISTORY:Dl,NOTEBOOK:Ml};const Me=Nl,ye=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),Ll="#2d2a2e",Rl="#fcfcfa",Al="#fcd65b",kl="#b2b1b2",Fl="#9edc6f",jl="#76d9e4",$l="#f95d84",Hl="#aa9af4",Bl="#f95d84",Ul="#fcfcfa",Wl="#7c7b7c",D={"error-foreground":"#f95d84",background:Ll,foreground:Rl,"line-height":"19px",string:Al,"string-delim":"#929192",delimiter:kl,predefined:Fl,keyword:jl,storage:$l,number:Hl,operator:Bl,identifier:Ul,"namespace-identifier":"#f95d84","identifier-js":"#fcd65b",comment:Wl,"input-option-active-border":"#929192","focus-border":"rgba(72, 120, 234, 0.85)","input-background":"#555356","input-foreground":"#f0f0ee","input-border":"#929192","editor-line-number-foreground":"#929192","editor-selection-background":"#676368","editor-line-highlight-bg":"#373438","context-menu-background":"#555356","context-menu-foreground":"#f0f0ee","menu-selection-background":"#4878ea","log-date":"#929192","log-error":"#f95d84","log-info":"#76d9e4","log-stdout":"#f0f0ee","log-warn":"#fcd65b","log-debug":"#aa9af4","log-trace":"#9edc6f","editor-find-match-background":"#3c5595","editor-find-match-highlight-background":"#343e5d","editor-widget-background":"#403e41","input-option-active-background":"#4878ea","input-option-active-foreground":"#f0f0ee","editor-suggest-widget-background":"#403e41","editor-suggest-widget-border":"#5b5a5c","editor-suggest-widget-foreground":"#f0f0ee","editor-suggest-widget-selected-background":"#41475a","editor-suggest-widget-highlightForeground":"#4878ea","list-hover-background":"#555356","text-link-foreground":"#929192","text-link-active-foreground":"#f0f0ee","editor-link-active-foreground":"#f0f0ee"};var zl="python",Vl={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},Kl={keywords:["and","del","from","not","while","as","elif","global","or","with","assert","else","if","pass","yield","break","except","import","print","exec","in","raise","continue","finally","is","return","for","try",":","=","isinstance","__debug__"],storage:["class","def","async","lambda"],operators:["+","-","*","**","/","//","%","<<",">>","&","|","^","~","<",">","<=",">=","==","!=","<>","+=","-=","*=","/","//=","%=","&=","|=","^=",">>=","<<=","**="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[=><!~&|+\-*/^%]+/,delimiters:/[;=.@:,`]/,escapes:/\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/,rawpre:/(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/,strpre:/(?:[buBU])/,tokenizer:{root:[[/@strpre?("""|''')/,{token:"string.delim",bracket:"@open",next:"@mstring.$1"}],[/@strpre?"([^"\\]|\\.)*$/,"string.invalid"],[/@strpre?'([^'\\]|\\.)*$/,"string.invalid"],[/@strpre?(["])/,{token:"string.delim",bracket:"@open",next:"@sstring.$1",nextEmbedded:"deephavenDb"}],[/@strpre?(["'])/,{token:"string.delim",bracket:"@open",next:"@string.$1"}],[/@rawpre("""|''')/,{token:"string.delim",bracket:"@open",next:"@mrawstring.$1"}],[/@rawpre"([^"\\]|\\.)*$/,"string.invalid"],[/@rawpre'([^'\\]|\\.)*$/,"string.invalid"],[/@rawpre(["'])/,{token:"string.delim",bracket:"@open",next:"@rawstring.$1"}],[/__[\w$]*/,"predefined"],[/[a-z_$][\w$]*/,{cases:{"@keywords":"keyword","@storage":"storage","@default":"identifier"}}],[/[A-Z][\w]*/,{cases:{"~[A-Z0-9_]+":"constructor.identifier","@default":"namespace.identifier"}}],{include:"@whitespace"},[/[{}()[\]]/,"@brackets"],[/@symbols/,{cases:{"@keywords":"keyword","@operators":"operator","@default":""}}],[/\d*\.\d+([eE][-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F]+[lL]?/,"number.hex"],[/0[bB][0-1]+[lL]?/,"number.binary"],[/(0[oO][0-7]+|0[0-7]+)[lL]?/,"number.octal"],[/(0|[1-9]\d*)[lL]?/,"number"],[":",{token:"keyword",bracket:"@open"}],[/@delimiters/,{cases:{"@keywords":"keyword","@default":"delimiter"}}]],comment:[[/[^/*]+/,"comment"],[/\/\*/,"comment","@push"],["\\*/","comment","@pop"],[/[/*]/,"comment"]],mstring:[{include:"@strcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],sstring:[{include:"@strcontent"},[/["]/,{token:"string.delim",bracket:"@close",next:"@pop",nextEmbedded:"@pop"}],[/./,"string.invalid"]],string:[{include:"@strcontent"},[/[']/,{token:"string.delim",bracket:"@close",next:"@pop"}],[/./,"string.invalid"]],strcontent:[[/[^\\"']+/,"string"],[/\\$/,"string.escape"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"]],mrawstring:[{include:"@rawstrcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],rawstring:[{include:"@rawstrcontent"},[/["']/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/./,"string.invalid"]],rawstrcontent:[[/[^\\"']+/,"string"],[/\\["']/,"string"],[/\\u[0-9A-Fa-f]{4}/,"string.escape"],[/\\/,"string"]],whitespace:[[/\s+/,"white"],[/(^#.*$)/,"comment"],[/'''/,"string","@endDocString"],[/"""/,"string","@endDblDocString"]],endDocString:[[/[^']+/,"string"],[/\\'/,"string"],[/'''/,"string","@popall"],[/'/,"string"]],endDblDocString:[[/[^"]+/,"string"],[/\\"/,"string"],[/"""/,"string","@popall"],[/"/,"string"]]}},Gl={id:zl,conf:Vl,language:Kl};const ql=Gl;var Yl="groovy",Xl={comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},Zl={keywords:["and","del","from","not","while","as","elif","global","or","with","assert","else","if","pass","yield","break","except","import","print","println","class","exec","in","raise","continue","finally","is","return","def","for","lambda","try",":","=","isinstance","__debug__"],operators:["+","-","*","**","/","//","%","<<",">>","&","|","^","~","<",">","<=",">=","==","!=","<>","+=","-=","*=","/","//=","%=","&=","|=","^=",">>=","<<=","**="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[=><!~&|+\-*/^%]+/,delimiters:/[;=.@:,`]/,escapes:/\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/,rawpre:/(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/,strpre:/(?:[buBU])/,tokenizer:{root:[[/@strpre?("""|''')/,{token:"string.delim",bracket:"@open",next:"@mstring.$1"}],[/@strpre?"([^"\\]|\\.)*$/,"string.invalid"],[/@strpre?'([^'\\]|\\.)*$/,"string.invalid"],[/@strpre?(["])/,{token:"string.delim",bracket:"@open",next:"@sstring.$1",nextEmbedded:"deephavenDb"}],[/@strpre?(["'])/,{token:"string.delim",bracket:"@open",next:"@string.$1"}],[/@rawpre("""|''')/,{token:"string.delim",bracket:"@open",next:"@mrawstring.$1"}],[/@rawpre"([^"\\]|\\.)*$/,"string.invalid"],[/@rawpre'([^'\\]|\\.)*$/,"string.invalid"],[/@rawpre(["'])/,{token:"string.delim",bracket:"@open",next:"@rawstring.$1"}],[/__[\w$]*/,"predefined"],[/[a-z_$][\w$]*/,{cases:{"@keywords":"keyword","@default":"identifier"}}],[/[A-Z][\w]*/,{cases:{"~[A-Z0-9_]+":"constructor.identifier","@default":"namespace.identifier"}}],{include:"@whitespace"},[/[{}()[\]]/,"@brackets"],[/@symbols/,{cases:{"@keywords":"keyword","@operators":"operator","@default":""}}],[/\d*\.\d+([eE][-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F]+[lL]?/,"number.hex"],[/0[bB][0-1]+[lL]?/,"number.binary"],[/(0[oO][0-7]+|0[0-7]+)[lL]?/,"number.octal"],[/(0|[1-9]\d*)[lL]?/,"number"],[":",{token:"keyword",bracket:"@open"}],[/@delimiters/,{cases:{"@keywords":"keyword","@default":"delimiter"}}]],mstring:[{include:"@strcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],sstring:[{include:"@strcontent"},[/["]/,{token:"string.delim",bracket:"@close",next:"@pop",nextEmbedded:"@pop"}],[/./,"string.invalid"]],string:[{include:"@strcontent"},[/[']/,{token:"string.delim",bracket:"@close",next:"@pop"}],[/./,"string.invalid"]],strcontent:[[/[^\\"']+/,"string"],[/\\$/,"string.escape"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"]],mrawstring:[{include:"@rawstrcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],rawstring:[{include:"@rawstrcontent"},[/["']/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/./,"string.invalid"]],rawstrcontent:[[/[^\\"']+/,"string"],[/\\["']/,"string"],[/\\u[0-9A-Fa-f]{4}/,"string.escape"],[/\\/,"string"]],whitespace:[[/[ \t\r\n]+/,""],[/\/\*\*(?!\/)/,"comment.doc","@doccomment"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^/*]+/,"comment"],[/\*\//,"comment","@pop"],[/[/*]/,"comment"]],doccomment:[[/[^/*]+/,"comment.doc"],[/\*\//,"comment.doc","@pop"],[/[/*]/,"comment.doc"]]}},Ql={id:Yl,conf:Xl,language:Zl};const Jl=Ql;var ed="scala",td={wordPattern:/(unary_[@~!#%^&*()\-=+\\|:<>/?]+)|([a-zA-Z_$][\w$]*?_=)|(`[^`]+`)|([a-zA-Z_$][\w$]*)/g,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],folding:{markers:{start:/^\s*\/\/\s*(?:(?:#?region\b)|(?:<editor-fold\b))/,end:/^\s*\/\/\s*(?:(?:#?endregion\b)|(?:<\/editor-fold>))/}}},nd={keywords:["asInstanceOf","catch","class","classOf","def","do","else","extends","finally","for","foreach","forSome","if","import","isInstanceOf","macro","match","new","object","package","return","throw","trait","try","type","until","val","var","while","with","yield","given","enum","then"],softKeywords:["as","export","extension","end","derives","on"],constants:["true","false","null","this","super"],modifiers:["abstract","final","implicit","lazy","override","private","protected","sealed"],softModifiers:["inline","opaque","open","transparent","using"],name:/(?:[a-z_$][\w$]*|`[^`]+`)/,type:/(?:[A-Z][\w$]*)/,symbols:/[=><!~?:&|+\-*/^\\%@#]+/,digits:/\d+(_+\d+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,escapes:/\\(?:[btnfr\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,fstring_conv:/[bBhHsScCdoxXeEfgGaAt]|[Tn](?:[HIklMSLNpzZsQ]|[BbhAaCYyjmde]|[RTrDFC])/,tokenizer:{root:[[/\braw"""/,{token:"string.quote",bracket:"@open",next:"@rawstringt"}],[/\braw"/,{token:"string.quote",bracket:"@open",next:"@rawstring"}],[/\bs"""/,{token:"string.quote",bracket:"@open",next:"@sstringt"}],[/\bs"/,{token:"string.quote",bracket:"@open",next:"@sstring"}],[/\bf""""/,{token:"string.quote",bracket:"@open",next:"@fstringt"}],[/\bf"/,{token:"string.quote",bracket:"@open",next:"@fstring"}],[/"""/,{token:"string.quote",bracket:"@open",next:"@stringt"}],[/"/,{token:"string.quote",bracket:"@open",next:"@string"}],[/(@digits)[eE]([-+]?(@digits))?[fFdD]?/,"number.float","@allowMethod"],[/(@digits)\.(@digits)([eE][-+]?(@digits))?[fFdD]?/,"number.float","@allowMethod"],[/0[xX](@hexdigits)[Ll]?/,"number.hex","@allowMethod"],[/(@digits)[fFdD]/,"number.float","@allowMethod"],[/(@digits)[lL]?/,"number","@allowMethod"],[/\b_\*/,"key"],[/\b(_)\b/,"keyword","@allowMethod"],[/\bimport\b/,"keyword","@import"],[/\b(case)([ \t]+)(class)\b/,["keyword.modifier","white","keyword"]],[/\bcase\b/,"keyword","@case"],[/\bva[lr]\b/,"keyword","@vardef"],[/\b(def)([ \t]+)((?:unary_)?@symbols|@name(?:_=)|@name)/,["keyword","white","identifier"]],[/@name(?=[ \t]*:(?!:))/,"variable"],[/(\.)(@name|@symbols)/,[{token:"operator"},{token:"@rematch",next:"@allowMethod"}]],[/([{(])(\s*)(@name(?=\s*=>))/,["@brackets","white","variable"]],[/@name/,{cases:{"@keywords":"keyword","@softKeywords":"keyword","@modifiers":"keyword.modifier","@softModifiers":"keyword.modifier","@constants":{token:"constant",next:"@allowMethod"},"@default":{token:"identifier",next:"@allowMethod"}}}],[/@type/,"type","@allowMethod"],{include:"@whitespace"},[/@[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*/,"annotation"],[/[{(]/,"@brackets"],[/[})]/,"@brackets","@allowMethod"],[/\[/,"operator.square"],[/](?!\s*(?:va[rl]|def|type)\b)/,"operator.square","@allowMethod"],[/]/,"operator.square"],[/([=-]>|<-|>:|<:|:>|<%)(?=[\s\w()[\]{},."'`])/,"keyword"],[/@symbols/,"operator"],[/[;,.]/,"delimiter"],[/'[a-zA-Z$][\w$]*(?!')/,"attribute.name"],[/'[^\\']'/,"string","@allowMethod"],[/(')(@escapes)(')/,[{token:"string"},{token:"string.escape"},{token:"string",next:"@allowMethod"}]],[/'/,"string.invalid"]],import:[[/;/,"delimiter","@pop"],[/^|$/,"","@pop"],[/[ \t]+/,"white"],[/[\n\r]+/,"white","@pop"],[/\/\*/,"comment","@comment"],[/@name|@type/,"type"],[/[(){}]/,"@brackets"],[/[[\]]/,"operator.square"],[/[.,]/,"delimiter"]],allowMethod:[[/^|$/,"","@pop"],[/[ \t]+/,"white"],[/[\n\r]+/,"white","@pop"],[/\/\*/,"comment","@comment"],[/(?==>[\s\w([{])/,"keyword","@pop"],[/(@name|@symbols)(?=[ \t]*[[({"'`]|[ \t]+(?:[+-]?\.?\d|\w))/,{cases:{"@keywords":{token:"keyword",next:"@pop"},"->|<-|>:|<:|<%":{token:"keyword",next:"@pop"},"@default":{token:"@rematch",next:"@pop"}}}],["","","@pop"]],comment:[[/[^/*]+/,"comment"],[/\/\*/,"comment","@push"],[/\*\//,"comment","@pop"],[/[/*]/,"comment"]],case:[[/\b_\*/,"key"],[/\b(_|true|false|null|this|super)\b/,"keyword","@allowMethod"],[/\bif\b|=>/,"keyword","@pop"],[/`[^`]+`/,"identifier","@allowMethod"],[/@name/,"variable","@allowMethod"],[/:::?|\||@(?![a-z_$])/,"keyword"],{include:"@root"}],vardef:[[/\b_\*/,"key"],[/\b(_|true|false|null|this|super)\b/,"keyword"],[/@name/,"variable"],[/:::?|\||@(?![a-z_$])/,"keyword"],[/=|:(?!:)/,"operator","@pop"],[/$/,"white","@pop"],{include:"@root"}],string:[[/[^\\"\n\r]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}]],stringt:[[/[^\\"\n\r]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/"/,"string"]],fstring:[[/@escapes/,"string.escape"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/%%/,"string"],[/(%)([-#+ 0,(])(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","keyword.modifier","number","metatag"]],[/(%)(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","number","metatag"]],[/(%)([-#+ 0,(])(@fstring_conv)/,["metatag","keyword.modifier","metatag"]],[/(%)(@fstring_conv)/,["metatag","metatag"]],[/./,"string"]],fstringt:[[/@escapes/,"string.escape"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/%%/,"string"],[/(%)([-#+ 0,(])(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","keyword.modifier","number","metatag"]],[/(%)(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","number","metatag"]],[/(%)([-#+ 0,(])(@fstring_conv)/,["metatag","keyword.modifier","metatag"]],[/(%)(@fstring_conv)/,["metatag","metatag"]],[/./,"string"]],sstring:[[/@escapes/,"string.escape"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/./,"string"]],sstringt:[[/@escapes/,"string.escape"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/./,"string"]],interp:[[/{/,"operator","@push"],[/}/,"operator","@pop"],{include:"@root"}],rawstring:[[/[^"]/,"string"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}]],rawstringt:[[/[^"]/,"string"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/"/,"string"]],whitespace:[[/[ \t\r\n]+/,"white"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]]}},id={id:ed,conf:td,language:nd};const rd=id;var od="deephavenDb",sd={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},ad={tokenPostfix:".js",keywords:["boolean","break","byte","case","catch","char","class","const","continue","debugger","default","delete","do","double","else","enum","export","extends","false","final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient","true","try","typeof","var","void","volatile","while","with"],builtins:["define","require","window","document","undefined"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.bracket"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[~!@#%\^&*-+=|\\:`<>.?\/]+/,escapes:/\\(?:[btnfr\\"']|[0-7][0-7]?|[0-3][0-7]{2})/,exponent:/[eE][\-+]?[0-9]+/,regexpctl:/[(){}\[\]\$\^|\-*+?\.]/,regexpesc:/\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,tokenizer:{root:[[/([a-zA-Z_\$][\w\$]*)(\s*)(:?)/,{cases:{"$1@keywords":["keyword","white","delimiter"],$3:["key.identifier","white","delimiter"],"$1@builtins":["predefined.identifier","white","delimiter"],"@default":["identifier","white","delimiter"]}}],{include:"@whitespace"},[/\/(?=([^\\\/]|\\.)+\/)/,{token:"regexp.slash",bracket:"@open",next:"@regexp"}],[/[{}()\[\]]/,"@brackets"],[/[;,.]/,"delimiter"],[/@symbols/,{cases:{"@operators":"operator","@default":""}}],[/\d+\.\d*(@exponent)?/,"number.float"],[/\.\d+(@exponent)?/,"number.float"],[/\d+@exponent/,"number.float"],[/0[xX][\da-fA-F]+/,"number.hex"],[/0[0-7]+/,"number.octal"],[/\d+/,"number"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/"/,"string",'@string."'],[/'/,"string","@string.'"]],whitespace:[[/[ \t\r\n]+/,"white"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^\/*]+/,"comment"],[/\/\*/,"comment.invalid"],["\\*/","comment","@pop"],[/[\/*]/,"comment"]],string:[[/[^\\"']+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/["']/,{cases:{"$#==$S2":{token:"string",next:"@pop"},"@default":"string"}}]],regexp:[[/(\{)(\d+(?:,\d*)?)(\})/,["@brackets.regexp.escape.control","regexp.escape.control","@brackets.regexp.escape.control"]],[/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,[{token:"@brackets.regexp.escape.control"},{token:"regexp.escape.control",next:"@regexrange"}]],[/(\()(\?:|\?=|\?!)/,["@brackets.regexp.escape.control","regexp.escape.control"]],[/[()]/,"@brackets.regexp.escape.control"],[/@regexpctl/,"regexp.escape.control"],[/[^\\\/]/,"regexp"],[/@regexpesc/,"regexp.escape"],[/\\\./,"regexp.invalid"],["/",{token:"regexp.slash",bracket:"@close"},"@pop"]],regexrange:[[/-/,"regexp.escape.control"],[/\^/,"regexp.invalid"],[/@regexpesc/,"regexp.escape"],[/[^\]]/,"regexp"],[/\]/,"@brackets.regexp.escape.control","@pop"]]}},ld={id:od,conf:sd,language:ad};const dd=ld;var hd="log",ud={},cd={tokenizer:{root:[[/ FATAL[\s\S]*/,{token:"error",next:"@error"}],[/ ERROR[\s\S]*/,{token:"error",next:"@error"}],[/ STDERR[\s\S]*/,{token:"error",next:"@error"}],[/ STDOUT.*/,{token:"stdout",next:"@stdout"}],[/ INFO[\s\S]*/,{token:"info",next:"@info"}],[/ WARN.*/,{token:"warn",next:"@warn"}],[/ TRACE[\s\S]*/,{token:"trace",next:"@trace"}],[/ DEBUG[.\s\S]*/,{token:"debug",next:"@debug"}],[/^\d{2}:\d{2}:\d{2}.\d{3}/,"date"]],error:[{include:"@body"}],info:[{include:"@body"}],warn:[{include:"@body"}],stdout:[{include:"@body"}],trace:[{include:"@body"}],debug:[{include:"@body"}],body:[[/^\d{2}:\d{2}:\d{2}.\d{3}/,{token:"date",next:"@pop"}],[/[\s\S]*/,{token:"$S0"}]]}},md={id:hd,conf:ud,language:cd};const gd=md;function mr(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 gr(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?mr(Object(t),!0).forEach(function(n){vd(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):mr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function vd(i,e,t){return e=fd(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function fd(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)}var It=ee.module("MonacoUtils");class yt{static init(){var{getWorker:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};It.debug("Initializing Monaco..."),e!==void 0&&yt.registerGetWorker(e);var{registerLanguages:t,removeHashtag:n}=yt,r=[{token:"",foreground:n(D.foreground)},{token:"string",foreground:n(D.string)},{token:"string.delim",foreground:n(D["string-delim"])},{token:"keyword",foreground:n(D.keyword)},{token:"identifier.js",foreground:n(D["identifier-js"])},{token:"delimiter",foreground:n(D.delimiter)},{token:"comment",foreground:n(D.comment)},{token:"number",foreground:n(D.number)},{token:"storage",foreground:n(D.storage)},{token:"identifier",foreground:n(D.identifier)},{token:"namespace.identifier",foreground:n(D["namespace-identifier"])},{token:"operator",foreground:n(D.operator)},{token:"predefined",foreground:n(D.predefined)},{token:"error.log",foreground:D["log-error"].substring(1)},{token:"warn.log",foreground:n(D["log-warn"])},{token:"info.log",foreground:n(D["log-info"])},{token:"stdout.log",foreground:n(D["log-stdout"])},{token:"trace.log",foreground:n(D["log-trace"])},{token:"debug.log",foreground:n(D["log-debug"])},{token:"date.log",foreground:n(D["log-date"])}],o={errorForeground:D["error-foreground"],"inputOption.activeBorder":D["input-option-active-border"],"editor.background":D.background,"editor.foreground":D.foreground,"editor.lineHighlightBackground":D["editor-line-highlight-bg"],"editorLineNumber.foreground":D["editor-line-number-foreground"],"editor.selectionBackground":D["editor-selection-background"],"editor.findMatchBackground":D["editor-find-match-background"],"editor.findMatchHighlightBackground":D["editor-find-match-highlight-background"],"editorSuggestWidget.background":D["editor-suggest-widget-background"],"editorSuggestWidget.border":D["editor-suggest-widget-border"],"editorSuggestWidget.foreground":D["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":D["editor-suggest-widget-selected-background"],"editorSuggestWidget.highlightForeground":D["editor-suggest-widget-highlightForeground"],"list.hoverBackground":D["list-hover-background"],"dropdown.background":D["context-menu-background"],"dropdown.foreground":D["context-menu-foreground"],"menu.selectionBackground":D["menu-selection-background"],"list.focusBackground":D["menu-selection-background"],"editorWidget.background":D["editor-widget-background"],"inputOption.activeBackground":D["input-option-active-background"],"inputOption.activeForeground":D["input-option-active-foreground"],focusBorder:D["focus-border"],"input.background":D["input-background"],"input.foreground":D["input-foreground"],"input.border":D["input-border"],"textLink.foreground":D["text-link-foreground"],"textLink.activeForeground":D["text-link-active-foreground"],"editorLink.activeForeground":D["editor-link-active-foreground"]};it.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:r,colors:o}),It.debug2("monaco theme: ",D),it.setTheme("dh-dark"),t([dd,ql,Jl,gd,rd]),yt.removeConflictingKeybindings(),It.debug("Monaco initialized.")}static registerGetWorker(e){window.MonacoEnvironment=gr(gr({},window.MonacoEnvironment),{},{getWorker:e})}static removeHashtag(e){return e.substring(1)}static registerLanguages(e){var t=e.map(n=>{var{id:r}=n;return r});rt.getLanguages().filter(n=>{var{id:r}=n;return t.includes(r)}).forEach(n=>{var r=n;It.debug2("Overriding default language loader:",r.id)}),e.forEach(n=>{yt.registerLanguage(n)})}static registerLanguage(e){It.debug2("Registering language: ",e.id),rt.register(e),rt.onLanguage(e.id,()=>{rt.setLanguageConfiguration(e.id,e.conf),rt.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:it.EndOfLineSequence.LF;(t=e.getModel())===null||t===void 0||t.setEOL(n)}static openDocument(e,t){var n=e.getModel();M(n);var r={textDocument:{uri:"".concat(n.uri),languageId:n.getLanguageId(),version:n.getVersionId(),text:n.getValue()}};It.debug2("didOpenDocumentParams: ",r),t.openDocument(r);var o=e.onDidChangeModelContent(s=>{for(var{changes:a,versionId:l}=s,h=[],u=0;u<a.length;u+=1){var c=a[u],{range:g,rangeLength:v,text:f}=c,p={range:{start:{line:g.startLineNumber-1,character:g.startColumn-1},end:{line:g.endLineNumber-1,character:g.endColumn-1}},rangeLength:v,text:f};h.push(p)}if(h.length>0){var C={textDocument:{version:l,uri:"".concat(n.uri)},contentChanges:h};It.debug2("didChangeDocumentParams",C),t.changeDocument(C)}});return o}static closeDocument(e,t){var n=e.getModel();M(n);var r={textDocument:{uri:"".concat(n.uri)}};t.closeDocument(r)}static registerPasteHandler(e){e.onDidPaste(t=>{var n=/“|”/g,r=/\u200b/g,o=/\u00A0/g,s=e.getModel();M(s);var a=s.getValueInRange(t.range);(n.test(a)||r.test(a)||o.test(a))&&s.applyEdits([{range:t.range,text:a.replace(n,'"').replace(r,"").replace(o," ")}])})}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static removeConflictingKeybindings(){it.addKeybindingRule({keybinding:ke.CtrlCmd|mt.KeyD,command:null}),yt.isMacPlatform()||it.addKeybindingRule({keybinding:ke.CtrlCmd|mt.KeyH,command:null})}static disableKeyBindings(e,t){e.addAction({id:"disable-keybindings-".concat(Kt()),label:"",keybindings:t,run:()=>{}})}static getMonacoKeyCodeFromShortcut(e){var{keyState:t}=e,{keyValue:n}=t;if(n===null)return 0;var r=yt.isMacPlatform();return r?(t.metaKey?ke.CtrlCmd:0)|(t.shiftKey?ke.Shift:0)|(t.altKey?ke.Alt:0)|(t.ctrlKey?ke.WinCtrl:0)|hr.fromString(n):(t.ctrlKey?ke.CtrlCmd:0)|(t.shiftKey?ke.Shift:0)|(t.altKey?ke.Alt:0)|(t.metaKey?ke.WinCtrl:0)|hr.fromString(n)}static provideLinks(e){for(var t=[],n=function(s){var a=e.getLineContent(s),l=Ys(a),h=l.filter(u=>u.type==="url"?/^https?:\/\//.test(u.value):!0);h.forEach(u=>{t.push({url:u.href,range:new Ua(s,u.start+1,s,u.end+1)})})},r=1;r<=e.getLineCount();r+=1)n(r);return{links:t}}}const $e=yt;function bi(i,e,t){return e=bd(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function bd(i){var e=Cd(i,"string");return typeof e=="symbol"?e:String(e)}function Cd(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 lt=ee.module("MonacoCompletionProvider");class Lt extends m.PureComponent{static lspToMonacoKind(e){var t=rt.CompletionItemKind;switch(e){case 1:return t.Text;case 2:return t.Method;case 3:return t.Function;case 4:return t.Constructor;case 5:return t.Field;case 6:return t.Variable;case 7:return t.Class;case 8:return t.Interface;case 9:return t.Module;case 10:return t.Property;case 11:return t.Unit;case 12:return t.Value;case 13:return t.Enum;case 14:return t.Keyword;case 15:return t.Snippet;case 16:return t.Color;case 17:return t.File;case 18:return t.Reference;case 19:return t.Folder;case 20:return t.EnumMember;case 21:return t.Constant;case 22:return t.Struct;case 23:return t.Event;case 24:return t.Operator;case 25:return t.TypeParameter;default:return t.Variable}}static lspToMonacoRange(e){var{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),bi(this,"registeredCompletionProvider",void 0),bi(this,"registeredSignatureProvider",void 0),bi(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=rt.registerCompletionItemProvider(e,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),t.getSignatureHelp&&(this.registeredSignatureProvider=rt.registerSignatureHelpProvider(e,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),t.getHover&&(this.registeredHoverProvider=rt.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:o}=this.props;if(e!==r)return null;var s={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:Lt.monacoToLspPosition(t),context:n},a=o.getCompletionItems(s);lt.debug("Requested completion items",s);var l=a.then(h=>{lt.debug("Completion items received: ",s,h);var u=h.map(c=>{var{label:g,kind:v,detail:f,documentation:p,sortText:C,filterText:_,textEdit:T,insertTextFormat:w}=c;return{label:g,kind:Lt.lspToMonacoKind(v),detail:f,documentation:p?.kind==="markdown"?p:p?.value,sortText:C,filterText:_,insertText:T.text,insertTextRules:w===2?4:w,range:Lt.lspToMonacoRange(T.range)}});return{incomplete:!0,suggestions:u}}).catch(h=>(lt.error("There was an error retrieving completion items",h),{suggestions:[]}));return l}handleSignatureRequest(e,t,n,r){var o={value:{signatures:[],activeSignature:0,activeParameter:0},dispose:()=>{}},{model:s,session:a}=this.props;if(e!==s||!a.getSignatureHelp)return null;var l={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:Lt.monacoToLspPosition(t),context:r},h=a.getSignatureHelp(l);lt.debug("Requested signature help",l);var u=h.then(c=>{lt.debug("Signatures received: ",l,h);var g=c.map(f=>{var{label:p,documentation:C,parameters:_}=f;return{documentation:C?.kind==="markdown"?C:C?.value,label:p,parameters:_??[]}});if(g.length===0)return o;var v=0;return{value:{signatures:g,activeSignature:v,activeParameter:c[v].activeParameter},dispose:()=>{}}}).catch(c=>(lt.error("There was an error retrieving completion items",c),o));return u}handleHoverRequest(e,t){var{model:n,session:r}=this.props;if(e!==n||!r.getHover)return null;var o={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:Lt.monacoToLspPosition(t)},s=r.getHover(o);lt.debug("Requested hover",o);var a=s.then(l=>{lt.debug("Hover received: ",o,l);var{contents:h}=l;return{contents:h?[h]:[]}}).catch(l=>(lt.error("There was an error retrieving hover",l),{contents:[]}));return a}render(){return null}}const Vo=Lt;function vr(i,e,t,n,r,o,s){try{var a=i[o](s),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(n,r)}function yd(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var o=i.apply(e,t);function s(l){vr(o,n,r,s,a,"next",l)}function a(l){vr(o,n,r,s,a,"throw",l)}s(void 0)})}}function Ve(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)}var Ci=ee.module("ConsoleInput"),Jn=parseInt(D["line-height"],10),Ko=6,Go=6,wd=Jn+Ko+Go,yi=100;class wn extends m.PureComponent{constructor(e){super(e),Ve(this,"cancelListener",void 0),Ve(this,"commandContainer",void 0),Ve(this,"commandEditor",void 0),Ve(this,"commandHistoryIndex",void 0),Ve(this,"commandSuggestionContainer",void 0),Ve(this,"loadingPromise",void 0),Ve(this,"timestamp",void 0),Ve(this,"bufferIndex",void 0),Ve(this,"history",void 0),Ve(this,"modifiedCommands",void 0),this.handleWindowResize=this.handleWindowResize.bind(this),this.commandContainer=le.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.state={commandEditorHeight:Jn,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(Ci.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:Jn,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:Ko,bottom:Go},tabCompletion:"on",value:"",wordWrap:"on"},r=this.commandContainer.current;M(r),this.commandEditor=it.create(r,n),$e.setEOL(this.commandEditor),$e.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{var o,s=(o=this.commandEditor)===null||o===void 0?void 0:o.getValue();this.modifiedCommands.set(this.commandHistoryIndex,s??null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(o=>{var{commandEditor:s,commandHistoryIndex:a}=this,l=s?.getPosition();M(l);var{lineNumber:h}=l,u=s?.getModel();if(o.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&h===1){a!=null?this.loadCommand(a+1):this.loadCommand(0),this.focusStart(),o.stopPropagation(),o.preventDefault();return}if(o.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&h===u?.getLineCount()){a!=null&&a>0?this.loadCommand(a-1):this.loadCommand(null),this.focusEnd(),o.stopPropagation(),o.preventDefault();return}if(!o.altKey&&!o.shiftKey&&!o.metaKey){if(o.keyCode===mt.Enter){if(!this.isSuggestionMenuPopulated()){var c;o.stopPropagation(),o.preventDefault();var g=(c=this.commandEditor)===null||c===void 0?void 0:c.getValue().trim();if(g!==void 0){var v;this.processCommand(g),(v=this.commandEditor)===null||v===void 0||v.setValue("")}}}else if(o.keyCode===mt.Tab)if(this.isSuggestionMenuActive())this.isSuggestionMenuPopulated()||(o.stopPropagation(),o.preventDefault());else{var f;o.stopPropagation(),o.preventDefault(),(f=this.commandEditor)===null||f===void 0||f.trigger("Tab key trigger suggestions","editor.action.triggerSuggest",{})}}}),$e.disableKeyBindings(this.commandEditor,[ke.CtrlCmd|mt.KeyF]),$e.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){var{session:e}=this.props;this.commandEditor&&($e.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,o,s=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();M(s);var a=s.getLineLength(1)+1,l=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(1,a);M(l),(n=this.commandEditor)===null||n===void 0||n.setPosition({lineNumber:1,column:a}),(r=this.commandEditor)===null||r===void 0||r.setScrollTop(l),(o=this.commandEditor)===null||o===void 0||o.focus()}focusEnd(){var e,t,n,r,o,s=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();M(s);var a=s.getLineCount(),l=s.getLineLength(a)+1,h=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(a,l);M(h),(n=this.commandEditor)===null||n===void 0||n.setPosition({lineNumber:a,column:l}),(r=this.commandEditor)===null||r===void 0||r.setScrollTop(h),(o=this.commandEditor)===null||o===void 0||o.focus()}clear(){var e,t,n;(e=this.commandEditor)===null||e===void 0||e.focus(),(t=this.commandEditor)===null||t===void 0||(n=t.getModel())===null||n===void 0||n.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var t,n;if(!(e!==null&&e>=this.history.length)){var r=this.modifiedCommands.get(e),o=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,(t=this.commandEditor)===null||t===void 0||(n=t.getModel())===null||n===void 0||n.setValue(r??o),e!==null&&e>this.history.length-yi&&this.loadMoreHistory()}}loadMoreHistory(){var e=this;return yd(function*(){try{if(e.loadingPromise!=null||e.bufferIndex==null)return;var{commandHistoryStorage:t,language:n,scope:r}=e.props;e.loadingPromise=Se.makeCancelable(t.getTable(n,r??"",e.timestamp),a=>a.close());var o=yield e.loadingPromise;o.setReversed(!0),o.setViewport({top:e.bufferIndex,bottom:e.bufferIndex+yi-1}),e.loadingPromise=Se.makeCancelable(o.getViewportData(),()=>o.close());var s=yield e.loadingPromise;e.bufferIndex+=yi,e.bufferIndex>=o.size&&(e.bufferIndex=null),e.history=[...s.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,o.close()}catch(a){if(e.loadingPromise=void 0,Se.isCanceled(a)){Ci.debug2("Promise canceled, not loading history");return}Ci.error("Error fetching history",a)}})()}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),M(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;M(e);var t=this.commandEditor.getContentHeight(),n=Math.max(Math.min(t,e),wd),r=t>n,o={overviewRulerLanes:r?void 0:0};this.setState({commandEditorHeight:n},()=>{var s,a;(s=this.commandEditor)===null||s===void 0||s.updateOptions(o),(a=this.commandEditor)===null||a===void 0||a.layout()})}}render(){var{disabled:e,language:t,session:n}=this.props,{commandEditorHeight:r,isFocused:o,model:s}=this.state;return d.jsx("div",{className:de("console-input-wrapper",{disabled:e}),children:d.jsxs("div",{className:de("console-input-inner-wrapper",{focus:o}),children:[d.jsx("div",{className:wn.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:r}}),s&&d.jsx(Vo,{model:s,language:t,session:n})]})})}}Ve(wn,"defaultProps",{maxHeight:Jn*10,scope:null,disabled:!1});Ve(wn,"INPUT_CLASS_NAME","console-input");const fr=wn;function wt(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)}var pr="pasted values",Td=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],_i=[".csv",".tsv",".tab",".psv",".dsv",".txt"],br=[".zip"];class ot extends m.Component{static isValidDropItem(e){return e!=null&&e.kind==="file"&&!Td.find(t=>t.test(e.type))}static isValidExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return _i.some(n=>e.endsWith(n))||t&&br.some(n=>e.endsWith(n))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===pr?sr:e.endsWith(".csv")?la:e.endsWith(".zip")?da:ha}constructor(e){super(e),wt(this,"fileElem",void 0),wt(this,"divElem",void 0),wt(this,"getValidExtensions",st(t=>t?[..._i,...br]:[..._i])),wt(this,"getAcceptString",st(t=>this.getValidExtensions(t).join(", "))),wt(this,"getFileTypeErrorString",st(t=>Na.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=le.createRef(),this.divElem=le.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 o=e.dataTransfer.items[0].getAsFile();M(o),ot.isValidExtension(o.name,t)?this.handleFile(o):this.setState({dropError:ot.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:pr,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:sr,action:this.handleMenuPaste,shortcut:Zn.PASTE,disabled:e}]}render(){var{allowZip:e,dragError:t,uploadInProgress:n}=this.props,{selectedFileName:r,dropError:o}=this.state,s=t??o,a=this.makeContextMenuItems();return d.jsxs("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:ot.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[d.jsx(Z,{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&&(s===void 0||s==="")&&d.jsxs("div",{className:"message-content",children:[d.jsx("div",{className:"message-icon",children:d.jsx(ge,{icon:ua})}),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(se,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),r&&(s===void 0||s==="")&&d.jsxs("div",{className:"selected-content",children:[d.jsx("div",{className:"selected-icon",children:d.jsx(ge,{icon:ot.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(se,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:Lo,tooltip:"Remove"})]})]})]}),!!s&&d.jsxs("div",{className:"message-content",children:[d.jsx("div",{className:"message-icon",children:d.jsx(ge,{icon:Ro})}),d.jsx("label",{children:s}),s===ot.FILE_TYPE_ERROR&&d.jsx("div",{className:"message-small",children:d.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}wt(ot,"defaultProps",{allowZip:!1,dragError:null});wt(ot,"MULTIPLE_FILE_ERROR","Please select only one file");wt(ot,"FILE_TYPE_ERROR","Filetype not supported.");const zt=ot;function jt(i,e,t){return e=Od(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Od(i){var e=xd(i,"string");return typeof e=="symbol"?e:String(e)}function xd(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 Tt{}jt(Tt,"INTEGER","int");jt(Tt,"LONG","long");jt(Tt,"DOUBLE","double");jt(Tt,"BOOLEAN","bool");jt(Tt,"STRING","string");jt(Tt,"DATE_TIME","datetime");jt(Tt,"LOCAL_TIME","localtime");const Q=Tt;function qo(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 Cr(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 yr(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Cr(Object(t),!0).forEach(function(n){Ie(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Cr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Ie(i,e,t){return e=Id(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Id(i){var e=Dd(i,"string");return typeof e=="symbol"?e:String(e)}function Dd(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 _r="unknown",Md=2147483647,Nd=-2147483648,Sr=/^[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]+)?$/,wr=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class Pe{static determineType(e,t,n){if(!e||e===n)return t;switch(t){case Q.STRING:return Q.STRING;case Q.INTEGER:return Pe.checkInteger(e);case Q.LONG:return Pe.checkLong(e);case Q.DOUBLE:return Pe.checkDouble(e);case Q.BOOLEAN:return Pe.checkBoolean(e);case Q.DATE_TIME:return Pe.checkDateTime(e);case Q.LOCAL_TIME:return Pe.checkLocalTime(e);default:return Pe.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){var t=e.replace(/,/g,"");return Pe.isNotParsableNumber(t)?Q.STRING:Pe.getNumberType(t)}static checkLong(e){var t=e.replace(/,/g,"");return Pe.isNotParsableNumber(t)?Q.STRING:t.includes(".")?Q.DOUBLE:Q.LONG}static checkDouble(e){var t=e.replace(/,/g,"");return Pe.isNotParsableNumber(t)?Q.STRING:Q.DOUBLE}static checkBoolean(e){var t=e.toLowerCase();return t==="true"||t==="false"?Q.BOOLEAN:Q.STRING}static checkDateTime(e){return Sr.test(e)?Q.DATE_TIME:Q.STRING}static checkLocalTime(e){return wr.test(e)?Q.LOCAL_TIME:Q.STRING}static getTypeFromUnknown(e){var t=e.replace(/,/g,"");if(Pe.isNotParsableNumber(t)){var n=e.toLowerCase();return n==="true"||n==="false"?Q.BOOLEAN:Sr.test(e)&&e.includes(":")?Q.DATE_TIME:wr.test(e)?Q.LOCAL_TIME:Q.STRING}return Pe.getNumberType(t)}static getNumberType(e){if(e.includes("."))return Q.DOUBLE;var t=e.startsWith("-")?11:10;if(e.length>t)return Q.LONG;var n=parseInt(e,10);return n>Md||n<Nd?Q.LONG:Q.INTEGER}constructor(e,t,n,r,o,s,a,l,h,u){Ie(this,"onFileCompleted",void 0),Ie(this,"file",void 0),Ie(this,"readHeaders",void 0),Ie(this,"nullString",void 0),Ie(this,"onProgress",void 0),Ie(this,"onError",void 0),Ie(this,"types",void 0),Ie(this,"chunks",void 0),Ie(this,"totalChunks",void 0),Ie(this,"rowCount",void 0),Ie(this,"isZip",void 0),Ie(this,"shouldTrim",void 0),Ie(this,"zipProgress",void 0),Ie(this,"config",void 0),this.onFileCompleted=e,this.file=t,this.readHeaders=n,this.nullString=o,this.onProgress=s,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=yr(yr({},r),{},{error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete})}parse(){if(this.file instanceof File||this.file instanceof Blob)un.parse(this.file,this.config);else{var e=qo(this.file,this.handleNodeUpdate);un.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(_r),this.readHeaders&&(n=n.slice(1))}this.rowCount+=n.length,M(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]=Pe.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
|
-
Expected length `.concat(r.length," but found ").concat(a.length,`.
|
|
4
|
-
Row = `).concat(a))}),this.chunks+=1;var o=0;this.totalChunks>0?o=Math.round(this.chunks/this.totalChunks*50):o=Math.round(this.zipProgress/2);var s=this.onProgress(o);s&&t.abort()}handleComplete(e){var{types:t,onFileCompleted:n}=this;M(t),(e==null||!e.meta.aborted)&&n(t.map(r=>r===_r||r===Q.LOCAL_TIME?Q.STRING:r),this.rowCount)}handleError(e){var{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}const Ld=Pe;function he(i,e,t){return e=Rd(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Rd(i){var e=Ad(i,"string");return typeof e=="symbol"?e:String(e)}function Ad(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=ee.module("CsvParser"),kd=650;class Yt{static generateHeaderRecursive(e){var t="",n=e;return e>=26&&(t=t.concat(Yt.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:o,readHeaders:s=!0,onProgress:a,onError:l,timeZone:h,isZip:u}=e;he(this,"onFileCompleted",void 0),he(this,"session",void 0),he(this,"file",void 0),he(this,"isZip",void 0),he(this,"type",void 0),he(this,"readHeaders",void 0),he(this,"timeZone",void 0),he(this,"onProgress",void 0),he(this,"onError",void 0),he(this,"tables",void 0),he(this,"headers",void 0),he(this,"types",void 0),he(this,"rowCount",void 0),he(this,"rowsProcessed",void 0),he(this,"chunks",void 0),he(this,"totalChunks",void 0),he(this,"isComplete",void 0),he(this,"zipProgress",void 0),he(this,"consolidatedChunks",void 0),he(this,"numConsolidated",void 0),he(this,"isCancelled",void 0),he(this,"config",void 0),this.onFileCompleted=t,this.session=n,this.file=r,this.isZip=u,this.type=o,this.readHeaders=s,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/un.LocalChunkSize),this.isComplete=!1,this.zipProgress=0,this.numConsolidated=0,this.isCancelled=!1,this.handleChunk=this.handleChunk.bind(this),this.handleError=this.handleError.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.handleCreateTable=this.handleCreateTable.bind(this),this.config={delimiter:o.delimiter,newline:o.newline,escapeChar:o.escapeChar,dynamicTyping:!1,error:this.handleError,skipEmptyLines:o.skipEmptyLines,chunk:this.handleChunk,complete:this.handleComplete,fastMode:!1}}cancel(){this.isCancelled=!0}transpose(e,t){for(var n=t.length,r=new Array(e).fill(null).map(()=>new Array(n)),o=0;o<n;o+=1){var s=t[o];if(s.length<e)throw new Error("Insufficient columns. Expected ".concat(e," but found ").concat(s.length,`
|
|
5
|
-
`).concat(s));for(var a=0;a<e;a+=1){var l=this.type.shouldTrim?t[o][a].trim():t[o][a];r[a][o]=this.nullCheck(l)}}return r}nullCheck(e){return e===this.type.nullString?"":e}parse(){var e=(n,r)=>{if(this.types=n,this.rowCount=r,this.file instanceof File||this.file instanceof Blob)un.parse(this.file,this.config);else{var o=qo(this.file,this.handleNodeUpdate);un.parse(o,this.config),o.resume()}},t=new Ld(e,this.file,this.readHeaders,this.config,this.type.nullString,this.onProgress,this.onError,this.totalChunks,this.isZip,this.type.shouldTrim);t.parse()}handleChunk(e,t){var{readHeaders:n,onError:r,handleCreateTable:o,isZip:s,tables:a}=this;if(this.isCancelled){Ln.debug2("CSV parser cancelled."),t.abort(),a.forEach(c=>c.close());return}var{data:l}=e;this.headers||(n?(this.headers=Ho.legalizeColumnNames(l[0]),l=l.slice(1)):this.headers=Yt.generateHeaders(l[0].length));var h=[];try{if(h=this.transpose(this.headers.length,l),s)this.consolidateChunks(h,t);else{var u=this.chunks;this.chunks+=1,o(u,h,t)}}catch(c){r(c)}}consolidateChunks(e,t){if(!this.consolidatedChunks)this.consolidatedChunks=e.slice();else for(var n=0;n<e.length;n+=1)this.consolidatedChunks[n]=this.consolidatedChunks[n].concat(e[n]);this.numConsolidated+=1,(this.numConsolidated>=kd||this.isComplete)&&this.uploadConsolidatedChunks(t)}uploadConsolidatedChunks(e){var t,{handleCreateTable:n}=this,r=this.chunks;this.chunks+=1;var o=(t=this.consolidatedChunks)===null||t===void 0?void 0:t.slice();this.consolidatedChunks=void 0,this.numConsolidated=0,M(o),n(r,o,e)}handleCreateTable(e,t,n){var{session:r,tables:o,onFileCompleted:s,totalChunks:a,types:l,onProgress:h,onError:u}=this;n&&n.pause(),M(this.headers),M(l),this.rowsProcessed+=t[0].length,r.newTable(this.headers,l,t,this.timeZone).then(c=>{if(this.isCancelled){Ln.debug2("CSV parser cancelled."),n&&n.abort(),o.forEach(v=>v.close());return}n&&n.resume(),o[e]=c;var g=0;a>0?g=Math.round(o.length/a*50)+50:g=Math.round(this.rowsProcessed/this.rowCount*50)+50,Ln.debug2("CSV parser progress ".concat(g)),h(g),this.isComplete&&o.length===this.chunks&&(Ln.debug2("CSV parser complete."),s(o))}).catch(c=>{!this.isComplete&&n&&n.abort(),u(c)})}handleComplete(e){(e==null||e.meta.aborted==null)&&(this.isComplete=!0,this.consolidatedChunks&&this.uploadConsolidatedChunks(null))}handleError(e){var{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}he(Yt,"generateHeaders",i=>{for(var e=[],t=0;t<i;t+=1)e.push(Yt.generateHeaderRecursive(t));return e});const Fd=Yt;function Gi(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=$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 li{static fromExtension(e){return e.endsWith(".csv")?"DEFAULT_CSV":e.endsWith(".tsv")||e.endsWith(".tab")?"TSV":e.endsWith(".psv")?"PIPE_SV":"AUTODETECT"}}Gi(li,"DEFAULT_TYPE","DEFAULT_CSV");Gi(li,"AUTO","AUTODETECT");Gi(li,"TYPES",Object.freeze({DEFAULT_CSV:{name:"Default csv (trimmed)",delimiter:",",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},TSV:{name:"Tab seperated (tsv)",delimiter:" ",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},APACHE_COMMON_CSV:{name:"Apache Common csv",delimiter:",",newline:`\r
|
|
6
|
-
`,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:null},EXCEL_CSV:{name:"Excel csv (strict)",delimiter:",",newline:`\r
|
|
7
|
-
`,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},MY_SQL_CSV:{name:"MySQL csv",delimiter:" ",newline:`
|
|
8
|
-
`,escapeChar:"\\",shouldTrim:!0,skipEmptyLines:!1,nullString:"\\N"},RFC4180_CSV:{name:"RFC4180 csv",delimiter:",",newline:`\r
|
|
9
|
-
`,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},COLON_SV:{name:": colon sv",delimiter:":",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},SEMI_COLON_SV:{name:"; semi-colon sv",delimiter:";",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},PIPE_SV:{name:"| pipe separated (psv)",delimiter:"|",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},SPACE_SV:{name:'" " space sv',delimiter:" ",newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"},AUTODETECT:{name:"autodetect",delimiter:void 0,newline:void 0,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:"(null)"}}));const an=li;function Yo(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=Bd(i,"string");return typeof e=="symbol"?e:String(e)}function Bd(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 Er=ee.module("CsvInputBar"),Ud=Object.entries(an.TYPES).map(i=>{var[e,t]=i;return d.jsx("option",{value:e,children:t.name},e)});class Xo extends m.Component{constructor(e){super(e),Yo(this,"inputRef",void 0),this.handleUpload=this.handleUpload.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleError=this.handleError.bind(this),this.handleTableName=this.handleTableName.bind(this),this.toggleFirstRowHeaders=this.toggleFirstRowHeaders.bind(this),this.handleProgress=this.handleProgress.bind(this),this.handleCancelInProgress=this.handleCancelInProgress.bind(this),this.handleQueryTypeChange=this.handleQueryTypeChange.bind(this),this.inputRef=le.createRef(),this.state={tableName:"",tableNameSet:!1,isFirstRowHeaders:!0,showProgress:!1,progressValue:0,type:an.DEFAULT_TYPE,parser:null}}componentDidUpdate(e){var{file:t,paste:n}=this.props,{tableName:r,tableNameSet:o}=this.state;if(!o&&t!=null&&!r){var s,a=t.name.lastIndexOf("."),l=Ho.legalizeTableName(t.name.substring(0,a));this.setState({tableName:l,tableNameSet:!0}),(s=this.inputRef.current)===null||s===void 0||s.focus()}else(t==null&&e.file!=null||n==null&&e.paste!=null)&&this.setState({tableName:"",tableNameSet:!1});n!=null&&n!==""&&!r&&this.inputRef.current&&this.inputRef.current.focus(),t!=null&&t!==e.file?this.setState({type:an.fromExtension(t.name)}):n!=null&&n!==""&&(e.paste===void 0||e.paste==="")&&this.setState({type:an.AUTO})}componentWillUnmount(){var{parser:e}=this.state;e&&e.cancel()}handleCancel(){var{onClose:e}=this.props;e()}handleError(e){var{onClose:t,onError:n}=this.props;Er.error(e),n(e),t()}handleTableName(e){this.setState({tableName:e.target.value,tableNameSet:!0})}toggleFirstRowHeaders(){var{isFirstRowHeaders:e}=this.state;this.setState({isFirstRowHeaders:!e})}handleUpload(e){e.stopPropagation(),e.preventDefault();var{file:t,paste:n}=this.props;t!=null?t.name.endsWith(".zip")?this.handleZipFile(t):this.handleFile(t):n!==void 0&&n!==""&&this.handleFile(new Blob([n],{type:"text/plain"}))}handleFile(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;Er.info("Starting CSV parser for ".concat(e instanceof File?e.name:"pasted values"," ").concat(t?"":e.size," bytes"));var{session:n,timeZone:r,onInProgress:o}=this.props,{tableName:s,isFirstRowHeaders:a,type:l}=this.state,h=c=>{c.length===1?n.bindTableToVariable(c[0],s).then(()=>this.openTable()).catch(g=>this.handleError(g)):n.mergeTables(c).then(g=>{n.bindTableToVariable(g,s).then(()=>this.openTable()).catch(v=>this.handleError(v)),c.forEach(v=>v.close())}).catch(g=>this.handleError(g))},u=new Fd({onFileCompleted:h,session:n,file:e,type:an.TYPES[l],readHeaders:a,onProgress:this.handleProgress,onError:this.handleError,timeZone:r,isZip:t});u.parse(),this.setState({showProgress:!0,parser:u}),o(!0)}handleZipFile(e){var{onUpdate:t,unzip:n}=this.props;if(n==null){this.handleError(new Error("No support for zip files available."));return}n(e).then(r=>{for(var o=!1,s=0;s<r.length;s+=1){var a=r[s];if(zt.isValidExtension(a.name)){t("Loading ".concat(a.name," as csv from ").concat(e.name)),o=!0,this.handleFile(a,!0);break}}if(!o)throw new Error("No csv file found in ".concat(e.name))}).catch(r=>this.handleError(r))}handleProgress(e){var{showProgress:t}=this.state;return t&&this.setState({progressValue:e}),!t}handleCancelInProgress(){var{onInProgress:e}=this.props,{parser:t}=this.state;t&&t.cancel(),this.setState({showProgress:!1,progressValue:0}),e(!1)}openTable(){var{onOpenTable:e,onClose:t}=this.props,{tableName:n}=this.state;e(n),t()}handleQueryTypeChange(e){this.setState({type:e.target.value})}render(){var{file:e,paste:t}=this.props,{tableName:n,isFirstRowHeaders:r,showProgress:o,progressValue:s,type:a}=this.state,l=!!t&&!n;return d.jsxs("div",{className:"csv-input-bar",children:[!o&&d.jsxs("form",{onSubmit:this.handleUpload,className:"csv-input-bar-container form-inline",children:[d.jsxs("div",{className:"form-group",children:[d.jsx("label",{htmlFor:"tableNameInput",children:"Table name"}),d.jsx("input",{ref:this.inputRef,id:"tableNameInput",type:"text",className:de("form-control",{"is-invalid":l}),value:n,onChange:this.handleTableName})]}),d.jsxs("div",{className:"form-group",children:[d.jsx("label",{htmlFor:"formatSelect",children:"File format"}),d.jsx("select",{id:"formatSelect",className:"custom-select",value:a,onChange:this.handleQueryTypeChange,children:Ud})]}),d.jsx(La,{className:"firstRowHeaders",checked:r,onChange:this.toggleFirstRowHeaders,children:"First row is column headers"}),d.jsxs("div",{className:"csv-input-buttons form-group",children:[d.jsx(se,{kind:"secondary",onClick:this.handleCancel,children:"Cancel"}),d.jsx(se,{kind:"primary",type:"submit",disabled:!(e!==null||t!==void 0&&t!=="")||!n,children:"Upload"})]})]}),o&&d.jsxs("div",{className:"csv-progress-container",children:[d.jsx("label",{children:"Uploading Table"}),d.jsx("div",{className:"progress",children:d.jsx("div",{className:"progress-bar bg-primary",style:{width:"".concat(s,"%")},"aria-valuenow":s,"aria-valuemin":0,"aria-valuemax":100})}),d.jsxs("label",{children:[s,"%"]}),d.jsx(se,{kind:"primary",onClick:this.handleCancelInProgress,children:"Cancel"})]})]})}}Yo(Xo,"defaultProps",{file:null,paste:null,unzip:null});const Wd=Xo;function Rn(i,e,t){return e=zd(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function zd(i){var e=Vd(i,"string");return typeof e=="symbol"?e:String(e)}function Vd(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 Pr=ee.module("ConsoleMenu");class ei extends m.PureComponent{static makeItemActions(e,t,n,r,o){if(e.length===0)return[];var s={menuElement:d.jsx(jo,{value:t,onChange:r,className:"console-menu",ref:n})},a=e;t&&(a=a.filter(h=>{var{title:u}=h;return u!=null&&u.toLowerCase().indexOf(t.toLowerCase())>=0}));var l=a.map(h=>({title:h.title,action:()=>{o(h)}}));return[s,...l]}constructor(e){super(e),Rn(this,"tableSearchField",void 0),Rn(this,"widgetSearchField",void 0),Rn(this,"makeTableActions",st((t,n,r)=>{var{dh:o}=this.props,s=t.filter(a=>Di.isTableType(o,a.type));return ei.makeItemActions(s,n,a=>{this.tableSearchField=a},this.handleTableFilterChange,r)})),Rn(this,"makeWidgetActions",st((t,n,r)=>{var{dh:o}=this.props,s=t.filter(a=>Di.isWidgetType(o,a.type));return ei.makeItemActions(s,n,a=>{this.widgetSearchField=a},this.handleWidgetFilterChange,r)})),this.handleTableFilterChange=this.handleTableFilterChange.bind(this),this.handleTableMenuClosed=this.handleTableMenuClosed.bind(this),this.handleTableMenuOpened=this.handleTableMenuOpened.bind(this),this.handleWidgetFilterChange=this.handleWidgetFilterChange.bind(this),this.handleWidgetMenuClosed=this.handleWidgetMenuClosed.bind(this),this.handleWidgetMenuOpened=this.handleWidgetMenuOpened.bind(this),this.state={tableFilterText:"",widgetFilterText:""}}handleTableFilterChange(e){Pr.debug("filtering tables..."),this.setState({tableFilterText:e.target.value})}handleTableMenuClosed(){this.setState({tableFilterText:""})}handleTableMenuOpened(){var e;(e=this.tableSearchField)===null||e===void 0||e.focus()}handleWidgetFilterChange(e){Pr.debug("filtering widgets..."),this.setState({widgetFilterText:e.target.value})}handleWidgetMenuClosed(){this.setState({widgetFilterText:""})}handleWidgetMenuOpened(){var e;(e=this.widgetSearchField)===null||e===void 0||e.focus()}render(){var{overflowActions:e,objects:t,openObject:n}=this.props,{tableFilterText:r,widgetFilterText:o}=this.state,s=this.makeTableActions(t,r,n),a=this.makeWidgetActions(t,o,n),l={placement:"bottom-end"},h=s.length===0,u=a.length===0;return d.jsxs("div",{className:"console-pane-menu",children:[d.jsxs(se,{kind:"ghost",className:"btn-link-icon",disabled:h,onClick:()=>{},tooltip:h?"No tables available":"Tables",children:[d.jsxs("div",{className:"fa-md fa-layers",children:[d.jsx(ge,{mask:Mo,icon:sn,transform:"right-5 down-5"}),d.jsx(ge,{icon:sn,transform:"right-8 down-6"})]}),d.jsx(mn,{actions:s,onMenuOpened:this.handleTableMenuOpened,onMenuClosed:this.handleTableMenuClosed,options:{initialKeyboardIndex:1},popperOptions:l},"table-actions ")]}),d.jsxs(se,{kind:"ghost",className:"btn-link-icon",disabled:a.length===0,onClick:()=>{},tooltip:u?"No widgets available":"Widgets",children:[d.jsxs("div",{className:"fa-md fa-layers",children:[d.jsx(ge,{mask:Do,icon:sn,transform:"right-5 down-5"}),d.jsx(ge,{icon:sn,transform:"right-8 down-6"})]}),d.jsx(mn,{actions:a,onMenuOpened:this.handleWidgetMenuOpened,onMenuClosed:this.handleWidgetMenuClosed,options:{initialKeyboardIndex:1},popperOptions:l},"table-actions")]}),d.jsx(se,{kind:"ghost",className:"btn-overflow btn-link-icon",icon:Ao,tooltip:"More Actions...",onClick:()=>{},children:d.jsx(mn,{actions:e,popperOptions:l})})]})}}const Kd=ei;function Zo(i,e,t){return e=Gd(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Gd(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 Qo extends m.PureComponent{constructor(e){super(e),Zo(this,"pending",void 0),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandCompleted=this.handleCommandCompleted.bind(this),this.pending=new Qt,this.state={isDisconnected:!1,isCommandRunning:!1}}componentDidMount(){this.startListening()}componentWillUnmount(){this.stopListening(),this.cancelPendingPromises()}startListening(){var{dh:e,session:t}=this.props;t.addEventListener(e.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted)}stopListening(){var{dh:e,session:t}=this.props;t.removeEventListener(e.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted)}cancelPendingPromises(){this.pending.cancel()}handleCommandStarted(e){var{result:t}=e.detail;this.pending.add(t).then(()=>this.handleCommandCompleted(null)).catch(n=>this.handleCommandCompleted(n)),this.setState({isCommandRunning:!0})}handleCommandCompleted(e){e instanceof Ra||this.setState({isCommandRunning:this.pending.pending.length>0})}render(){var{children:e,dh:t,openObject:n,overflowActions:r,objects:o}=this.props,{isDisconnected:s,isCommandRunning:a}=this.state,l=null,h=null;return s?(l="console-status-icon-disconnected",h="Worker is disconnected"):a?(l="console-status-icon-pending",h="Worker is busy"):(l="console-status-icon-idle",h="Worker is idle"),d.jsxs("div",{className:"console-pane-status-bar",children:[d.jsxs("div",{children:[d.jsx("div",{className:de("console-status-icon",l)}),d.jsx(Ft,{children:h})]}),e,d.jsx(Kd,{dh:t,overflowActions:r,openObject:n,objects:o})]})}}Zo(Qo,"defaultProps",{children:null});const Yd=Qo;function Tr(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 Xe(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Tr(Object(t),!0).forEach(function(n){Ke(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Tr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Ke(i,e,t){return e=Xd(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Xd(i){var e=Zd(i,"string");return typeof e=="symbol"?e:String(e)}function Zd(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 dt=ee.module("Console"),Or={isAutoLaunchPanelsEnabled:!0,isPrintStdOutEnabled:!0,isClosePanelsOnDisconnectEnabled:!0};class Pt extends m.PureComponent{static isErrorLevel(e){return e===ye.STDERR||e===ye.ERROR||e===ye.FATAL}static isOutputLevel(e){return e===ye.STDOUT||Pt.isErrorLevel(e)}constructor(e){super(e),Ke(this,"cancelListener",void 0),Ke(this,"consolePane",void 0),Ke(this,"consoleInput",void 0),Ke(this,"consoleHistoryScrollPane",void 0),Ke(this,"pending",void 0),Ke(this,"queuedLogMessages",void 0),Ke(this,"processLogMessageQueue",xo(()=>{this.scrollConsoleHistoryToBottom(),this.setState(r=>{dt.debug2("processLogMessageQueue",this.queuedLogMessages.length," items");var{consoleHistory:o}=r;return o=o.concat(this.queuedLogMessages),this.queuedLogMessages=[],{consoleHistory:o}})},Pt.LOG_THROTTLE)),Ke(this,"getObjects",st(r=>[...r.values()])),Ke(this,"getContextActions",st(r=>[...r,{action:this.handleClearShortcut,shortcut:Me.CONSOLE.CLEAR},{action:this.handleFocusHistory,shortcut:Me.CONSOLE.FOCUS_HISTORY}])),this.handleCommandResult=this.handleCommandResult.bind(this),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandSubmit=this.handleCommandSubmit.bind(this),this.handleClearShortcut=this.handleClearShortcut.bind(this),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleLogMessage=this.handleLogMessage.bind(this),this.handleOverflowActions=this.handleOverflowActions.bind(this),this.handleScrollPaneScroll=this.handleScrollPaneScroll.bind(this),this.handleToggleAutoLaunchPanels=this.handleToggleAutoLaunchPanels.bind(this),this.handleToggleClosePanelsOnDisconnect=this.handleToggleClosePanelsOnDisconnect.bind(this),this.handleTogglePrintStdout=this.handleTogglePrintStdout.bind(this),this.handleUploadCsv=this.handleUploadCsv.bind(this),this.handleHideCsv=this.handleHideCsv.bind(this),this.handleCsvFileCanceled=this.handleCsvFileCanceled.bind(this),this.handleCsvFileOpened=this.handleCsvFileOpened.bind(this),this.handleCsvPaste=this.handleCsvPaste.bind(this),this.handleDragEnter=this.handleDragEnter.bind(this),this.handleDragLeave=this.handleDragLeave.bind(this),this.handleClearDragError=this.handleClearDragError.bind(this),this.handleOpenCsvTable=this.handleOpenCsvTable.bind(this),this.handleCsvUpdate=this.handleCsvUpdate.bind(this),this.handleCsvError=this.handleCsvError.bind(this),this.handleCsvInProgress=this.handleCsvInProgress.bind(this),this.consolePane=le.createRef(),this.consoleInput=le.createRef(),this.consoleHistoryScrollPane=le.createRef(),this.pending=new Qt,this.queuedLogMessages=[];var{objectMap:t,settings:n}=this.props;this.state=Xe(Xe({consoleHistory:[],consoleHeight:0,isScrollDecorationShown:!1,objectHistoryMap:new Map,objectMap:new Map(t),showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1},Or),n)}componentDidMount(){this.initConsoleLogging();var{dh:e,session:t}=this.props;t.addEventListener(e.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.updateDimensions()}componentDidUpdate(e,t){var{props:n,state:r}=this;this.sendSettingsChange(t,r),n.objectMap!==e.objectMap&&this.updateObjectMap()}componentWillUnmount(){var{dh:e,session:t}=this.props;t.removeEventListener(e.IdeSession.EVENT_COMMANDSTARTED,this.handleCommandStarted),this.pending.cancel(),this.processLogMessageQueue.cancel(),this.deinitConsoleLogging()}initConsoleLogging(){var{session:e}=this.props;this.cancelListener=e.onLogMessage(this.handleLogMessage)}deinitConsoleLogging(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}handleClearShortcut(e){var t;e.preventDefault(),e.stopPropagation(),(t=this.consoleInput.current)===null||t===void 0||t.clear()}handleCommandStarted(e){var{code:t,result:n}=e.detail,r=this.pending.add(n),o={command:t,disabledObjects:[],startTime:Date.now(),cancelResult:()=>{n.cancel()},wrappedResult:r},{commandHistoryStorage:s,language:a,scope:l}=this.props,h=s.addItem(a,l,t,{command:t,startTime:new Date().toJSON()});h.catch(u=>{dt.debug("Error adding workspace item",u)}),this.setState(u=>({consoleHistory:u.consoleHistory.concat(o)}),()=>{this.scrollConsoleHistoryToBottom(!0)}),r.then(u=>{this.handleCommandResult(u,o,h)}).catch(u=>{this.handleCommandError(u,o,h)})}handleCommandResult(e,t,n){var r=Xe(Xe({},t),{},{wrappedResult:void 0,cancelResult:void 0,result:e??t.result});this.setState(o=>{var{consoleHistory:s}=o,a=s.lastIndexOf(t);if(a<0)return dt.error("historyItem not found in consoleHistory"),null;var l=s.concat();return l[a]=r,{consoleHistory:l}}),e&&(this.updateHistory(e,r),this.updateKnownObjects(r),this.updateWorkspaceHistoryItem({error:e.error},n),this.closeRemovedItems(e.changes),this.openUpdatedItems(e.changes))}handleCommandError(e,t,n){if(Se.isCanceled(e)){dt.debug("Called handleCommandError on a cancelled promise result");return}this.updateWorkspaceHistoryItem({error:"".concat(e)},n),this.setState(r=>{var o=r.consoleHistory.concat(),s=o.lastIndexOf(t),a=Xe({},t);return a.wrappedResult=void 0,a.cancelResult=void 0,a.endTime=Date.now(),a.result={error:e},o[s]=a,{consoleHistory:o}})}handleFocusHistory(e){e.preventDefault(),e.stopPropagation();var{focusCommandHistory:t}=this.props;t()}handleLogMessage(e){var{isPrintStdOutEnabled:t}=this.state;t&&Pt.isOutputLevel(e.logLevel)&&this.queueLogMessage(e.message,e.logLevel)}queueLogMessage(e,t){var n={};Pt.isErrorLevel(t)?n.error=e:n.message=e;var r={command:void 0,result:n};this.queuedLogMessages.push(r),this.processLogMessageQueue()}openUpdatedItems(e){var{isAutoLaunchPanelsEnabled:t}=this.state;if(!(e==null||!t)){var{openObject:n}=this.props;[...e.created,...e.updated].forEach(r=>n(r))}}closeRemovedItems(e){if(!(e==null||e.removed==null||e.removed.length===0)){var{closeObject:t}=this.props,{removed:n}=e;n.forEach(r=>t(r))}}updateHistory(e,t){var n=t;e==null||e.changes==null||n==null||(n.endTime=Date.now(),this.scrollConsoleHistoryToBottom(),this.setState(r=>{var o=r.consoleHistory.concat();return{consoleHistory:o}}))}updateKnownObjects(e){var t;if(e.result&&(t=e.result.changes),!t||(t.created==null||t.created.length===0)&&(t.updated==null||t.updated.length===0)&&(t.removed==null||t.removed.length===0)){dt.debug2("updateKnownObjects no changes");return}this.setState(n=>{var r,o,s,{consoleHistory:a}=n,l=a.lastIndexOf(e);if(l<0)return dt.error("historyItem not found in state.consoleHistory"),null;var h=new Map(n.objectHistoryMap),u=new Map(n.objectMap),c=function(v){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{title:p}=v;M(p);var C=h.get(p);if(C!=null&&C>=0){var _;a===n.consoleHistory&&(a=a.concat());var T=Xe(Xe({},a[C]),{},{disabledObjects:[...(_=a[C].disabledObjects)!==null&&_!==void 0?_:[],p]});a[C]=T}h.set(p,l),f?u.delete(p):u.set(p,v)};return(r=t)===null||r===void 0||r.updated.forEach(g=>c(g)),(o=t)===null||o===void 0||o.removed.forEach(g=>c(g,!0)),(s=t)===null||s===void 0||s.created.forEach(g=>{var{title:v}=g;M(v),h.set(v,l),u.set(v,g)}),{objectHistoryMap:h,objectMap:u,consoleHistory:a}})}updateObjectMap(){var{objectMap:e}=this.props;this.setState({objectMap:e})}updateWorkspaceHistoryItem(e,t){var n=this.pending.add(t),r=new Date().toJSON();n.then(o=>{var s=Xe(Xe({},o),{},{data:Xe(Xe({},o.data),{},{endTime:r,result:e})}),{commandHistoryStorage:a,language:l}=this.props;a.updateItem(l,s).catch(h=>{dt.warn("Error updating command history storage",h)})}).catch(o=>{dt.debug("Error updating workspace history item",o)})}scrollConsoleHistoryToBottom(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.consoleHistoryScrollPane.current;M(t),!(!e&&Math.abs(t.scrollHeight-t.clientHeight-t.scrollTop)>=1)&&window.requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight})}handleScrollPaneScroll(){var e=this.consoleHistoryScrollPane.current;M(e),e.scrollTop>0&&e.scrollHeight>e.clientHeight?this.setState({isScrollDecorationShown:!0}):this.setState({isScrollDecorationShown:!1})}handleToggleAutoLaunchPanels(){this.setState(e=>({isAutoLaunchPanelsEnabled:!e.isAutoLaunchPanelsEnabled}))}handleToggleClosePanelsOnDisconnect(){this.setState(e=>({isClosePanelsOnDisconnectEnabled:!e.isClosePanelsOnDisconnectEnabled}))}handleTogglePrintStdout(){this.setState(e=>({isPrintStdOutEnabled:!e.isPrintStdOutEnabled}))}handleUploadCsv(){this.setState({showCsvOverlay:!0,dragError:null,csvUploadInProgress:!1})}handleHideCsv(){this.setState({showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1})}handleCsvFileCanceled(){this.setState({csvFile:null,csvPaste:null})}handleCsvFileOpened(e){this.setState({csvFile:e,csvPaste:null})}handleCsvPaste(e){this.setState({csvFile:null,csvPaste:e})}handleDragEnter(e){if(!(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0||e.dataTransfer.items[0].kind==="string")){e.preventDefault(),e.stopPropagation(),this.setState({showCsvOverlay:!0});var{items:t}=e.dataTransfer;if(t.length>1){this.setState({dragError:zt.MULTIPLE_FILE_ERROR});return}var n=t[0];zt.isValidDropItem(n)?this.setState({dragError:null}):this.setState({dragError:zt.FILE_TYPE_ERROR})}}handleDragLeave(e){e.currentTarget==null||e.currentTarget instanceof Element&&e.relatedTarget instanceof Element&&e.currentTarget.contains(e.relatedTarget)||(e.preventDefault(),e.stopPropagation(),this.setState({showCsvOverlay:!1,dragError:null}))}handleClearDragError(){this.setState({dragError:null})}handleOpenCsvTable(e){var{dh:t,openObject:n,commandHistoryStorage:r,language:o,scope:s}=this.props,{consoleHistory:a,objectMap:l}=this.state,h={name:e,title:e,type:t.VariableType.TABLE},u=l.has(e),c={startTime:Date.now(),endTime:Date.now(),disabledObjects:[],result:{changes:{created:[],updated:[],removed:[],[u?"updated":"created"]:[h]}}},g=a.concat(c);this.setState({consoleHistory:g}),this.scrollConsoleHistoryToBottom(!0),this.updateKnownObjects(c),n({name:e,title:e,type:t.VariableType.TABLE}),r.addItem(o,s,e,{command:e,startTime:new Date().toJSON(),endTime:new Date().toJSON()})}addConsoleHistoryMessage(e,t){var{consoleHistory:n}=this.state,r={startTime:Date.now(),endTime:Date.now(),result:{message:e,error:t}},o=n.concat(r);this.setState({consoleHistory:o})}handleCsvUpdate(e){this.addConsoleHistoryMessage(e)}handleCsvError(e){this.addConsoleHistoryMessage(void 0,e!=null?"".concat(e):void 0)}handleCsvInProgress(e){this.setState({csvUploadInProgress:e})}handleOverflowActions(){var{isAutoLaunchPanelsEnabled:e,isClosePanelsOnDisconnectEnabled:t,isPrintStdOutEnabled:n}=this.state,{actions:r}=this.props;return[...r,{title:"Print Stdout",action:this.handleTogglePrintStdout,group:Z.groups.high,icon:n?cn:void 0,order:10},{title:"Auto Launch Panels",action:this.handleToggleAutoLaunchPanels,group:Z.groups.high,icon:e?cn:void 0,order:20},{title:"Close Panels on Disconnect",action:this.handleToggleClosePanelsOnDisconnect,group:Z.groups.high,icon:t?cn:void 0,order:30},{title:"Upload Table from File",action:this.handleUploadCsv,group:Z.groups.high+10,order:40}]}handleCommandSubmit(e){if(e==="clear"||e==="cls")this.clearConsoleHistory();else if(e.length>0){var{session:t}=this.props;t.runCode(e).catch(r=>{dt.error("There was an error initiating the command",r)})}else{var n={command:" ",result:{},startTime:Date.now(),endTime:Date.now()};this.scrollConsoleHistoryToBottom(!0),this.setState(r=>({consoleHistory:r.consoleHistory.concat(n)}))}}clearConsoleHistory(){this.pending.cancel(),this.setState(e=>{var t=new Map([...e.objectHistoryMap.keys()].map(n=>[n,-1]));return{consoleHistory:[],objectHistoryMap:t}})}addCommand(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.consoleInput.current&&(this.consoleInput.current.setConsoleText(e,t,n),t&&this.scrollConsoleHistoryToBottom(!0))}focus(){var e;(e=this.consoleInput.current)===null||e===void 0||e.focus()}sendSettingsChange(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=Object.keys(Or),o={},s=!1,a=0;a<r.length;a+=1){var l=r[a],{[l]:h}=t,{[l]:u}=e;h!==u&&(s=!0),o[l]=h}if(!(n&&!s)){var{onSettingsChange:c}=this.props;c(o)}}updateDimensions(){this.consolePane.current&&this.setState({consoleHeight:this.consolePane.current.clientHeight}),this.consoleInput.current&&this.consoleInput.current.updateDimensions()}render(){var{actions:e,dh:t,historyChildren:n,language:r,statusBarChildren:o,openObject:s,session:a,scope:l,commandHistoryStorage:h,timeZone:u,disabled:c,unzip:g}=this.props,{consoleHeight:v,consoleHistory:f,isScrollDecorationShown:p,objectMap:C,showCsvOverlay:_,csvFile:T,csvPaste:w,dragError:U,csvUploadInProgress:K}=this.state,te=this.getObjects(C),x=Math.round(v*.7),j=this.getContextActions(e);return d.jsxs("div",{role:"presentation",className:de("iris-console","h-100","w-100",{disabled:c}),children:[d.jsxs("div",{className:"console-pane",ref:this.consolePane,children:[d.jsx(Yd,{dh:t,session:a,overflowActions:this.handleOverflowActions,openObject:s,objects:te,children:o}),d.jsxs("div",{className:"console-csv-container",onDragOver:zt.handleDragOver,onDragEnter:this.handleDragEnter,onDragLeave:this.handleDragLeave,children:[_&&d.jsx(zt,{onCancel:this.handleCsvFileCanceled,onFileOpened:this.handleCsvFileOpened,onPaste:this.handleCsvPaste,clearDragError:this.handleClearDragError,dragError:U,onError:this.handleCsvError,uploadInProgress:K,allowZip:g!=null}),d.jsxs("div",{role:"presentation",className:de("scroll-pane no-scroll-x",{"scroll-decoration":p}),onScroll:this.handleScrollPaneScroll,ref:this.consoleHistoryScrollPane,children:[d.jsx(xl,{items:f,openObject:s,language:r,disabled:c}),n]})]}),!_&&d.jsx(fr,{ref:this.consoleInput,session:a,language:r,scope:l,onSubmit:this.handleCommandSubmit,maxHeight:x,commandHistoryStorage:h}),_&&d.jsx(Wd,{session:a,onOpenTable:this.handleOpenCsvTable,onClose:this.handleHideCsv,onUpdate:this.handleCsvUpdate,onError:this.handleCsvError,file:T??void 0,paste:w??void 0,onInProgress:this.handleCsvInProgress,timeZone:u,unzip:g})]}),d.jsx(Z,{actions:j,ignoreClassNames:[fr.INPUT_CLASS_NAME]})]})}}Ke(Pt,"defaultProps",{statusBarChildren:null,settings:{},onSettingsChange:()=>{},scope:null,actions:[],historyChildren:null,timeZone:"America/New_York",objectMap:new Map,disabled:!1,unzip:null});Ke(Pt,"LOG_THROTTLE",500);const Qd=Pt;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 Jd(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){ti(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 ti(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 Jo extends m.Component{constructor(e){super(e),ti(this,"container",void 0),ti(this,"editor",void 0),this.handleResize=this.handleResize.bind(this),this.container=null,this.state={}}componentDidMount(){this.initEditor(),window.addEventListener("resize",this.handleResize)}componentWillUnmount(){window.removeEventListener("resize",this.handleResize),this.destroyEditor()}setLanguage(e){if(this.editor){var t=this.editor.getModel();M(t),it.setModelLanguage(t,e)}}handleResize(){this.updateDimensions()}toggleFind(){this.editor&&(this.editor.focus(),this.editor.trigger("toggleFind","actions.find",void 0))}updateDimensions(){var e;(e=this.editor)===null||e===void 0||e.layout()}initEditor(){var{onEditorInitialized:e}=this.props,{settings:t}=this.props;t=Jd({copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"python",lineNumbersMinChars:3,minimap:{enabled:!1},scrollBeyondLastLine:!1,tabCompletion:"on",value:"",wordWrap:"off",links:!0},t),M(this.container),this.editor=it.create(this.container,t),this.editor.addAction({id:"find",label:"Find",keybindings:[ke.CtrlCmd|mt.KeyF],precondition:void 0,keybindingContext:void 0,contextMenuGroupId:"navigation",contextMenuOrder:1,run:()=>{this.toggleFind()}}),this.editor.layout(),rt.registerLinkProvider("plaintext",{provideLinks:$e.provideLinks}),e(this.editor)}destroyEditor(){var{onEditorWillDestroy:e}=this.props;M(this.editor),e(this.editor),this.editor.dispose(),this.editor=void 0}render(){var{className:e}=this.props;return d.jsx("div",{className:de("editor-container",e),ref:t=>{this.container=t}})}}ti(Jo,"defaultProps",{className:"fill-parent-absolute",onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},settings:{}});const nh=Jo;var ih={groovy:"Groovy",python:"Python",scala:"Scala"};class rh{static normalizeScriptLanguage(e){return ih[e]||null}static getDisabledRunTooltip(e,t,n,r){return e?t?null:"".concat(n," doesn't match the session language – ").concat(r," disabled"):"Console session not connected – ".concat(r," disabled")}static outdentCode(e){var t=e.split(`
|
|
10
|
-
`),n=t.reduce((r,o)=>{var s=o.length-o.trimStart().length;return s===o.length?r:s<r?s:r},Number.MAX_SAFE_INTEGER);return t.map(r=>r.slice(n)).join(`
|
|
11
|
-
`)}}const Ni=rh;function ln(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=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)}var Ue=ee.module("ScriptEditor");class es extends m.Component{constructor(e){super(e),ln(this,"contextActionCleanups",void 0),ln(this,"completionCleanup",void 0),ln(this,"editor",void 0),ln(this,"editorComponent",void 0),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleRun=this.handleRun.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.updateShortcuts=this.updateShortcuts.bind(this),this.contextActionCleanups=[],this.editorComponent=le.createRef(),this.state={model:null}}componentDidMount(){ue.addEventListener("onUpdate",this.updateShortcuts)}componentDidUpdate(e){var t,n,{sessionLanguage:r,settings:o}=this.props,s=o?.language,a=s!==((t=e.settings)===null||t===void 0?void 0:t.language);a&&(Ue.debug("Set language",s),this.setLanguage(s));var l=r==null&&e.sessionLanguage!=null,h=s===r,u=((n=e.settings)===null||n===void 0?void 0:n.language)===e.sessionLanguage;(l||r!==void 0&&u&&!h)&&(Ue.debug("De-init completion and context actions"),this.deInitContextActions(),this.deInitCodeCompletion());var c=r!=null&&e.sessionLanguage==null;(c&&h||r!==void 0&&!u&&h)&&(Ue.debug("Init completion and context actions"),this.initContextActions(),this.initCodeCompletion())}componentWillUnmount(){ue.removeEventListener("onUpdate",this.updateShortcuts)}getValue(){return this.editor?this.editor.getValue():(Ue.error("Editor not initialized"),null)}getSelectedCommand(){var e,t,n=(e=this.editor)===null||e===void 0?void 0:e.getSelection();M(n);var r=(t=this.editor)===null||t===void 0?void 0:t.getModel();M(r);var{startLineNumber:o,endColumn:s}=n,{endLineNumber:a}=n;s===1&&a>o&&(a-=1);var l=r.getLineMinColumn(o),h=r.getLineMaxColumn(a),u=n.setStartPosition(o,l).setEndPosition(a,h);return Ni.outdentCode(r.getValueInRange(u))}handleEditorInitialized(e){var{focusOnMount:t,onChange:n,onEditorInitialized:r,settings:o,session:s,sessionLanguage:a}=this.props;Ue.debug("handleEditorInitialized",a,s,o),this.editor=e,this.setState({model:this.editor.getModel()}),$e.setEOL(e),$e.registerPasteHandler(e),s!=null&&o&&a===o.language&&(this.initContextActions(),this.initCodeCompletion()),e.onDidChangeModelContent(n),t!=null&&t&&e.focus(),r(this.editor)}handleEditorWillDestroy(e){Ue.debug("handleEditorWillDestroy");var{onEditorWillDestroy:t}=this.props;t(e),this.deInitContextActions(),this.deInitCodeCompletion(),this.setState({model:null}),this.editor=void 0}handleRun(){var{onRunCommand:e}=this.props,t=this.getValue();t!=null&&e(t)}handleRunSelected(){var{onRunCommand:e}=this.props,t=this.getSelectedCommand();e(t)}initContextActions(){if(this.contextActionCleanups.length>0){Ue.error("Context actions already initialized.");return}if(this.editor){var e=[];e.push(this.editor.addAction({id:"run-code",label:"Run",keybindings:[$e.getMonacoKeyCodeFromShortcut(Me.NOTEBOOK.RUN)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRun()}})),e.push(this.editor.addAction({id:"run-selected-code",label:"Run Selected",keybindings:[$e.getMonacoKeyCodeFromShortcut(Me.NOTEBOOK.RUN_SELECTED)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRunSelected()}})),this.contextActionCleanups=e}}deInitContextActions(){this.contextActionCleanups.length>0&&(this.contextActionCleanups.forEach(e=>e.dispose()),this.contextActionCleanups=[])}updateShortcuts(){this.deInitContextActions(),this.initContextActions()}initCodeCompletion(){if(this.completionCleanup!=null){Ue.error("Code completion already initialized.");return}var{session:e}=this.props;Ue.debug("initCodeCompletion",this.editor,e),this.editor&&e!=null&&(this.completionCleanup=$e.openDocument(this.editor,e))}deInitCodeCompletion(){var{session:e}=this.props;Ue.debug("deInitCodeCompletion",this.editor,e),this.completionCleanup&&(this.completionCleanup.dispose(),this.completionCleanup=void 0,this.editor&&e!=null&&$e.closeDocument(this.editor,e))}append(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;M(this.editor);var n=this.editor.getModel();M(n);var r=n.getValue();r?n.setValue("".concat(r,`
|
|
12
|
-
`).concat(e)):n.setValue("".concat(e));var o=n.getLineCount(),s=n.getLineLength(o)+1;this.editor.setPosition({lineNumber:o,column:s}),t&&this.editor.focus()}updateDimensions(){Ue.debug("updateDimensions"),this.editor&&this.editor.layout()}focus(){Ue.debug("focus"),this.editor&&this.editor.focus()}toggleFind(){this.editorComponent.current&&this.editorComponent.current.toggleFind()}setLanguage(e){this.editorComponent.current&&e!==void 0&&this.editorComponent.current.setLanguage(e)}render(){var e,{error:t,isLoaded:n,isLoading:r,session:o,sessionLanguage:s,settings:a}=this.props,{model:l}=this.state,h=t?"Unable to open document. ".concat(t):null,u=a&&(e=a.language)!==null&&e!==void 0?e:null,c=l&&o&&u===s;return d.jsxs(d.Fragment,{children:[(t||r)&&d.jsx("div",{className:"h-100 w-100 position-relative",children:d.jsx(Vi,{errorMessage:h,isLoading:r,isLoaded:n})}),n&&d.jsx("div",{className:"h-100 w-100 script-editor",children:a&&d.jsxs(d.Fragment,{children:[d.jsx(nh,{ref:this.editorComponent,settings:a,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy}),c!=null&&c&&d.jsx(Vo,{model:l,language:u,session:o})]})})]})}}ln(es,"defaultProps",{error:null,isLoading:!1,isLoaded:!1,focusOnMount:!0,onChange:()=>{},onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},session:null});const ah=es;function dn(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)}var hh=250,uh=2500;class di extends m.Component{static getTimeString(e,t){if(e==null||t===""||t===0)return null;var n=Math.round((new Date(t).valueOf()-new Date(e).valueOf())/1e3);return n<1?"<1s":Fo.formatElapsedTime(n)}constructor(e){super(e),dn(this,"timer",void 0),dn(this,"cleanup",void 0),dn(this,"loadData",fn(()=>{var{commandHistoryStorage:t,item:n,language:r}=this.props,{id:o}=n;this.cleanup=t.listenItem(r,o,this.handleUpdate,this.handleError)},hh)),dn(this,"getPreviewText",Xs(t=>t.split(`
|
|
13
|
-
`,uh).join(`
|
|
14
|
-
`),{max:1})),this.handleUpdate=this.handleUpdate.bind(this),this.handleError=this.handleError.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.state={currentTime:Date.now()}}componentDidMount(){this.loadData()}componentDidUpdate(e,t){var n,{data:r}=this.state;this.timer==null&&!(r!=null&&r.result)&&r?.startTime&&!(r==null||r.endTime===void 0)?this.startTimer():(r!=null&&r.result&&!((n=t.data)!==null&&n!==void 0&&n.result)||r?.endTime&&!(t.data==null||t.data.endTime===void 0))&&this.stopTimer()}componentWillUnmount(){this.loadData.cancel(),this.cleanup!=null&&this.cleanup(),this.stopTimer()}startTimer(){this.stopTimer(),this.timer=setInterval(this.handleTimeout,1e3)}stopTimer(){this.timer&&(clearInterval(this.timer),this.timer=void 0)}updateTime(){this.setState({currentTime:Date.now()})}handleError(e){this.setState({error:"".concat(e)})}handleUpdate(e){var{data:t}=e??{};this.setState({data:t});var{onUpdate:n}=this.props;n?.(t)}handleTimeout(){this.updateTime()}render(){var e,{item:{name:t},language:n}=this.props,{currentTime:r,data:o,error:s}=this.state,{result:a,startTime:l,endTime:h}=o??{},u=(e=a?.error)!==null&&e!==void 0?e:s,c=di.getTimeString(l,h??r),g=this.getPreviewText(t),v=!!c;return d.jsxs("div",{className:"command-history-item-tooltip",children:[d.jsxs("div",{className:"scroll-container",children:[d.jsx(Ki,{language:n,children:g}),g.length<t.length&&d.jsx("p",{children:"Preview Truncated..."})]}),d.jsxs("div",{className:"result-info",children:[d.jsxs("div",{className:"d-flex justify-content-between",children:[!!u&&d.jsxs("div",{className:"text-danger mr-1",children:[d.jsx(ge,{icon:Ro})," Executed with errors"]}),d.jsxs("div",{className:"time-wrapper",children:["Elapsed time:"," ",v?d.jsx("span",{className:"time-string",children:c}):d.jsx(No,{className:"loading-spinner-vertical-align"})]})]}),!!u&&d.jsx("div",{className:"error-message",children:u})]})]})}}dn(di,"defaultProps",{onUpdate:()=>{}});const ch=di;var mh=512;function ts(i){var{item:e,language:t,isSelected:n,commandHistoryStorage:r}=i,o=e.name.substring(0,mh),s=m.useRef(null),a=m.useCallback(()=>{var l;(l=s.current)===null||l===void 0||l.update()},[s]);return d.jsxs("div",{className:de("command-history-item",{selected:n}),children:[o,d.jsx(Ft,{ref:s,interactive:!0,options:{placement:"left",modifiers:{preventOverflow:{enabled:!0,boundariesElement:"viewport",order:825}}},popperClassName:"command-history-item-popper",children:d.jsx(ch,{item:e,language:t,onUpdate:a,commandHistoryStorage:r})})]})}ts.defaultProps={isSelected:!1};class ni extends m.Component{static itemKey(e,t){return"".concat(t.title)}static renderContent(e){return e.selectionRequired!==void 0&&e.selectionRequired?d.jsxs("div",{className:"fa-md fa-layers",children:[d.jsx(ge,{icon:ca,mask:e.icon,transform:"right-5 down-5 shrink-4"}),d.jsx(ge,{icon:ma,transform:"shrink-3 right-7 down-6"})]}):d.jsx(ge,{icon:e.icon})}render(){var{actions:e,hasSelection:t}=this.props;return d.jsx("div",{className:"command-history-actions",children:e.map((n,r)=>d.jsx(se,{kind:"inline",className:de(n.className),onClick:n.action,tooltip:n.description,disabled:n.selectionRequired!==void 0&&n.selectionRequired&&!t,icon:ni.renderContent(n)},ni.itemKey(r,n)))})}}const gh=ni;var vh=150,Ir=3,Dr=ee.module("CommandHistoryViewportUpdater");function fh(i){var{table:e,columns:t,top:n=0,bottom:r=0,search:o,isReversed:s=!1,onUpdate:a}=i,l=m.useMemo(()=>xo(h=>{var u=h.bottom-h.top,c=Math.max(0,h.top-u*Ir),g=h.bottom+u*Ir;e.setViewport({top:c,bottom:g,columns:h.columns})},vh),[e]);return m.useEffect(function(){var u=e.onUpdate(c=>{var g,v;a({items:(g=c.items)!==null&&g!==void 0?g:[],offset:(v=c.offset)!==null&&v!==void 0?v:0})});return()=>{Dr.debug("onUpdate cleanup"),u()}},[e,a]),m.useEffect(function(){e.setSearch(o??"")},[e,o]),m.useEffect(function(){l({top:n,bottom:r,columns:t})},[l,n,r,t,o,s]),m.useEffect(()=>()=>{Dr.debug2("Cancel throttledUpdateViewport"),l.cancel()},[l]),null}function Mr(i,e,t,n,r,o,s){try{var a=i[o](s),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(n,r)}function Nr(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var o=i.apply(e,t);function s(l){Mr(o,n,r,s,a,"next",l)}function a(l){Mr(o,n,r,s,a,"throw",l)}s(void 0)})}}function nt(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=bh(i,"string");return typeof e=="symbol"?e:String(e)}function bh(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 pt=ee.module("CommandHistory");class De extends m.Component{static getCommandsFromViewport(e,t,n){for(var r=[],o=0;o<n.length;o+=1)for(var s=n[o],a=s[0];a<=s[1];a+=1)if(a>=t&&a<t+e.length){var{name:l}=e[a-t];r.push(l)}return r}static getCommandsFromSnapshot(e,t){return Nr(function*(){var n=yield e.getSnapshot(t);return[...n.values()].map(r=>r.name)})()}constructor(e){super(e),nt(this,"itemActions",void 0),nt(this,"historyActions",void 0),nt(this,"pending",void 0),nt(this,"searchInputRef",void 0),nt(this,"itemListRef",void 0),nt(this,"debouncedSearchChange",fn(()=>{this.setState(n=>{var{searchText:r}=n;return{debouncedSearchText:r,selectedRanges:[]}})},De.SET_SEARCH_DEBOUNCE_MS)),this.copySelectedCommands=this.copySelectedCommands.bind(this),this.createNotebook=this.createNotebook.bind(this),this.sendToConsole=this.sendToConsole.bind(this),this.renderItem=this.renderItem.bind(this),this.runInConsole=this.runInConsole.bind(this),this.sendToNotebook=this.sendToNotebook.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.handleViewportUpdate=this.handleViewportUpdate.bind(this),this.itemActions=[{title:"Copy Selection",description:"Copy selected commands to clipboard",icon:ga,shortcut:Zn.COPY,action:this.copySelectedCommands,group:Z.groups.edit},{title:"Send to Console",description:"Open selected commands in the console",icon:ar,shortcut:Me.COMMAND_HISTORY.SEND_TO_CONSOLE,action:this.sendToConsole,group:De.menuGroups.send,order:10},{title:"Run in Console",description:"Run selected commands in the console",icon:Xn,shortcut:Me.COMMAND_HISTORY.RUN,action:this.runInConsole,group:De.menuGroups.send,order:10},{title:"Send to Active Notebook",description:"Open selected commands in a notebook",icon:lr,shortcut:Me.COMMAND_HISTORY.SEND_TO_NOTEBOOK,action:this.sendToNotebook,group:De.menuGroups.send,order:20},{title:"Send to New Notebook",description:"Open selected commands in a new notebook",icon:ko,action:this.createNotebook,group:De.menuGroups.send,order:30}],this.historyActions=[{title:"Send to Console",icon:ar,selectionRequired:!0,description:"Open selected commands in the console",action:this.sendToConsole},{title:"Send to Notebook",icon:lr,selectionRequired:!0,description:"Open selected commands in a notebook",action:this.sendToNotebook}],this.pending=new Qt,this.searchInputRef=le.createRef(),this.itemListRef=le.createRef();var{table:t}=e;this.state={actions:[],historyActions:this.historyActions,top:0,bottom:0,itemCount:t.size,items:[],offset:0,selectedRanges:[],searchText:"",debouncedSearchText:""}}componentWillUnmount(){this.debouncedSearchChange.cancel(),this.pending.cancel()}getSelectedCommands(){var e=this;return Nr(function*(){var{items:t,offset:n,selectedRanges:r}=e.state,o=r.slice().sort((a,l)=>a[0]-l[0]);if(o.length===0)return[];if(o[0][0]>=n&&o[o.length-1][1]<n+t.length)return De.getCommandsFromViewport(t,n,o);var{table:s}=e.props;return e.pending.add(De.getCommandsFromSnapshot(s,o))})()}getSelectedCommandText(){return this.getSelectedCommands().then(e=>e.join(`
|
|
15
|
-
`))}updateActions(){this.setState(e=>{var{selectedRanges:t}=e,n=t.reduce((r,o)=>r+o[1]-o[0]+1,0);return n>0&&n<De.MAX_SELECTION_COUNT?(pt.debug("Updating actions",this.itemActions),{actions:this.itemActions}):(pt.debug("Disabling actions",n),{actions:[]})})}copySelectedCommands(){this.getSelectedCommandText().then(Aa).catch(pt.error)}createNotebook(){this.getSelectedCommandText().then(e=>{var{language:t,sendToNotebook:n}=this.props;n({value:e,language:t},!0)}).catch(pt.error)}sendToNotebook(){this.getSelectedCommandText().then(e=>{var{language:t,sendToNotebook:n}=this.props;n({value:e,language:t})}).catch(pt.error)}sendToConsole(){var{sendToConsole:e}=this.props;this.getSelectedCommandText().then(e).catch(pt.error)}runInConsole(){this.getSelectedCommandText().then(e=>{var{sendToConsole:t}=this.props;t(e,!0,!0)}).catch(pt.error)}handleSelect(e){var{sendToConsole:t}=this.props,{items:n,offset:r}=this.state;if(e<r||e>=r+n.length){pt.error("Invalid index!",e);return}var{name:o}=n[e-r];t(o)}handleSelectionChange(e){this.setState({selectedRanges:e}),this.updateActions()}handleViewportChange(e,t){this.setState({top:e,bottom:t})}handleSearchChange(e){this.setState({searchText:e.target.value}),this.debouncedSearchChange()}handleViewportUpdate(e){var{items:t,offset:n}=e,{table:r}=this.props,o=r.size;this.setState({items:t,itemCount:o,offset:n})}renderItem(e){var{item:t,itemIndex:n,isSelected:r}=e,{language:o,commandHistoryStorage:s}=this.props;return d.jsx(ts,{isSelected:r,item:t,language:o,commandHistoryStorage:s})}focus(){this.searchInputRef.current&&this.searchInputRef.current.focus()}restoreScrollPosition(){var e;(e=this.itemListRef.current)===null||e===void 0||e.restoreScrollPosition()}render(){var e,{language:t,table:n}=this.props,{actions:r,historyActions:o,searchText:s,debouncedSearchText:a,top:l,bottom:h,items:u,itemCount:c,offset:g,selectedRanges:v}=this.state,f=(e=Bo.LANGUAGE_MAP.get(t))!==null&&e!==void 0?e:"";return d.jsxs("div",{className:"command-history",children:[d.jsxs("div",{className:"command-history-search-bar",children:[d.jsx(jo,{ref:this.searchInputRef,value:s,placeholder:"".concat(f," Command History"),onChange:this.handleSearchChange}),d.jsx(gh,{actions:o,hasSelection:v.length>0})]}),d.jsxs("div",{className:"command-history-list",children:[d.jsx(xi,{ref:this.itemListRef,itemCount:c,items:u,offset:g,selectedRanges:v,onSelect:this.handleSelect,onSelectionChange:this.handleSelectionChange,onViewportChange:this.handleViewportChange,renderItem:this.renderItem,rowHeight:De.ITEM_HEIGHT,isDoubleClickSelect:!0,isMultiSelect:!0,isStickyBottom:!0}),d.jsx(fh,{table:n,top:l,bottom:h,search:a,onUpdate:this.handleViewportUpdate}),d.jsx(Z,{actions:r})]})]})}}nt(De,"ITEM_HEIGHT",29);nt(De,"MAX_SELECTION_COUNT",1e4);nt(De,"SET_SEARCH_DEBOUNCE_MS",150);nt(De,"menuGroups",{send:Z.groups.medium+100});const Ch=De;class yh extends m.PureComponent{constructor(e){super(e),this.handleSwitchClick=this.handleSwitchClick.bind(this)}handleSwitchClick(){var{logLevel:e,onClick:t}=this.props;t(e)}render(){var{logLevel:e,on:t}=this.props;return d.jsxs("div",{className:de("log-level-menu-item",e),children:[d.jsx(ka,{on:t,onClick:this.handleSwitchClick}),e]})}}const _h=yh;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 Rr(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){Fe(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 Fe(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=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 ce extends m.PureComponent{static getLogText(e){var t=new Date(e.micros/1e3),n=Di.formatTimestamp(t);return"".concat(n," ").concat(e.logLevel," ").concat(e.message)}constructor(e){super(e),Fe(this,"cancelListener",void 0),Fe(this,"editor",void 0),Fe(this,"editorContainer",void 0),Fe(this,"logLevelMenuItems",void 0),Fe(this,"flushTimer",void 0),Fe(this,"bufferedMessages",void 0),Fe(this,"messages",void 0),this.handleClearClick=this.handleClearClick.bind(this),this.handleFlushTimeout=this.handleFlushTimeout.bind(this),this.handleLogMessage=this.handleLogMessage.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleResetClick=this.handleResetClick.bind(this),this.handleResize=this.handleResize.bind(this),this.handleToggleAllClick=this.handleToggleAllClick.bind(this),this.logLevelMenuItems={},this.editorContainer=null,this.bufferedMessages=[],this.messages=[],this.state={shownLogLevels:{}}}componentDidMount(){this.resetLogLevels(),this.initMonaco(),this.startListening(),window.addEventListener("resize",this.handleResize)}componentDidUpdate(e,t){this.updateDimensions();var{shownLogLevels:n}=this.state;t.shownLogLevels!==n&&this.refreshLogText();var{session:r}=this.props;e.session!==r&&(this.stopListening(),this.startListening(),this.clearLogs())}componentWillUnmount(){this.stopFlushTimer(),this.stopListening(),this.destroyMonaco(),window.removeEventListener("resize",this.handleResize)}getMenuActions(e){var t=this,n=[];n.push({menuElement:d.jsx("div",{className:"log-level-menu-title",children:"Display Log Levels"}),group:1,order:10});for(var r=function(){var a=ce.AllLogLevels[o],l=e[a]!=null?e[a]:!1;n.push({title:a,group:1,order:o+100,menuElement:d.jsx(_h,{logLevel:a,on:l,onClick:t.handleMenuItemClick,ref:h=>{h!=null&&(t.logLevelMenuItems[a]=h)}})})},o=0;o<ce.AllLogLevels.length;o+=1)r();return n.push({group:1,order:1e3,menuElement:d.jsxs("div",{className:"log-level-menu-controls",children:[d.jsx(se,{kind:"ghost",className:"log-level-toggle-all",onClick:this.handleToggleAllClick,children:"Toggle All"}),d.jsx(se,{kind:"ghost",onClick:this.handleResetClick,children:"Reset"})]})}),n}resetLogLevels(){for(var e={},t=function(){var o=ce.AllLogLevels[n],s=ce.DefaultLogLevels.some(a=>a===o);e[o]=s},n=0;n<ce.AllLogLevels.length;n+=1)t();this.setState({shownLogLevels:e})}startListening(){var{session:e}=this.props;this.cancelListener=e.onLogMessage(this.handleLogMessage)}stopListening(){this.cancelListener!=null&&(this.cancelListener(),this.cancelListener=void 0)}initMonaco(){M(this.editorContainer),this.editor=it.create(this.editorContainer,{copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"log",lineDecorationsWidth:0,lineNumbers:"off",lineNumbersMinChars:0,minimap:{enabled:!1},readOnly:!0,renderLineHighlight:"none",scrollBeyondLastLine:!1,value:"",wordWrap:"on"}),[[mt.Escape],[ke.Shift|mt.Escape]].forEach(e=>{M(this.editor),$e.disableKeyBindings(this.editor,e),this.editor.addAction({id:"clear-selection-on-escape",label:"",keybindings:[mt.Escape],keybindingContext:"findWidgetVisible && editorTextFocus",run:()=>{var t,n,r=(t=this.editor)===null||t===void 0?void 0:t.getPosition();M(r),(n=this.editor)===null||n===void 0||n.setPosition(r)}})})}destroyMonaco(){this.editor&&(this.editor.dispose(),this.editor=void 0)}triggerFindWidget(){var e,t;(e=this.editor)===null||e===void 0||e.focus(),(t=this.editor)===null||t===void 0||t.trigger("keyboard","actions.find",void 0)}toggleAll(){for(var{shownLogLevels:e}=this.state,t=!0,n=0;n<ce.AllLogLevels.length;n+=1){var r=ce.AllLogLevels[n];if(!e[r]){t=!1;break}}if(t)this.setState({shownLogLevels:{}});else{for(var o={},s=0;s<ce.AllLogLevels.length;s+=1){var a=ce.AllLogLevels[s];o[a]=!0}this.setState({shownLogLevels:o})}}toggleLogLevel(e){var{shownLogLevels:t}=this.state,n=t[e],r={};r[e]=!n,this.updateLogLevels(r)}updateLogLevels(e){var{shownLogLevels:t}=this.state;t=Rr(Rr({},t),e),this.setState({shownLogLevels:t})}appendLogText(e){if(this.editor){var t=this.editor.getModel(),n=t?.getLineCount();M(n);var r=t?.getLineLength(n);M(r);var o=this.isBottomVisible(),s=[];if(r>0&&(s.push({range:{startLineNumber:n,startColumn:r+1,endLineNumber:n,endColumn:r+1},text:`
|
|
16
|
-
`,forceMoveMarkers:!0}),n+=1,r=0),s.push({range:{startLineNumber:n,startColumn:r,endLineNumber:n,endColumn:r},text:e,forceMoveMarkers:!0}),t?.applyEdits(s),o){var a=t?.getLineCount();M(a),this.editor.revealLine(a,1)}}}refreshLogText(){if(this.editor){this.truncateLogIfNecessary();for(var{shownLogLevels:e}=this.state,t=this.isBottomVisible(),n="",r=0;r<this.messages.length;r+=1){var o=this.messages[r];if(e[o.logLevel]){var s=ce.getLogText(o);s.length>0&&(n+=s,s.charAt(s.length-1)!==`
|
|
17
|
-
`&&(n+=`
|
|
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();M(l),this.editor.revealLine(l,1)}this.stopFlushTimer(),this.bufferedMessages=[]}}truncateLogIfNecessary(){this.messages.length>ce.maxLogSize&&(this.messages=this.messages.splice(this.messages.length-ce.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();M(r),this.editor.revealLine(r,1)}}isBottomVisible(){if(!this.editor)return!0;var e=this.editor.getModel(),t=e?.getLineCount();return M(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 o=n[r];if(o.startLineNumber<=e&&e<=o.endLineNumber)return!0}return!1}isLogItemVisible(e){var{shownLogLevels:t}=this.state;return t[e.logLevel]}flush(){for(var e="",t=0;t<this.bufferedMessages.length;t+=1){var n=this.bufferedMessages[t],r=ce.getLogText(n);e+=r,r.charAt(r.length-1)!==`
|
|
19
|
-
`&&(e+=`
|
|
20
|
-
`)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,ce.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(se,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:va,tooltip:"Clear log"}),d.jsx(se,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:fa,tooltip:"Log Settings",onClick:()=>{},children:d.jsx(mn,{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}})]})}}Fe(ce,"DefaultLogLevels",[ye.STDOUT,ye.ERROR,ye.FATAL,ye.STDERR,ye.WARN]);Fe(ce,"AllLogLevels",[ye.INFO,ye.STDOUT,ye.ERROR,ye.FATAL,ye.STDERR,ye.WARN,ye.DEBUG,ye.TRACE]);Fe(ce,"bufferTimeout",16);Fe(ce,"maxLogSize",131072);Fe(ce,"truncateSize",65536);const Eh=ce;Ii.register([Wa,za,Va,Ka,Ga,qa]);const Ph="#76d9e4 #9edc6f #fcd65b #aa9af4 #f37e3f #f95d84 #f0f0ee",Th="#403e41",Oh="#5b5a5c",xh="#c0bfbf",Ih="#4878ea",Dh="rgba(91, 90, 92, 0.7)",we={"paper-bgcolor":"#2d2a2e","plot-bgcolor":"#322f33","title-color":"#f0f0ee",colorway:Ph,gridcolor:Th,linecolor:Oh,zerolinecolor:xh,activecolor:Ih,rangebgcolor:Dh,"area-color":"#76d9e4","trend-color":"#d5f0c1","line-color":"#9edc6f","error-band-line-color":"white","error-band-fill-color":"rgba(213, 240, 193, 0.1)","ohlc-increasing":"#9edc6f","ohlc-decreasing":"#f95d84"},An=Object.freeze({paper_bgcolor:we["paper-bgcolor"],plot_bgcolor:we["plot-bgcolor"],title_color:we["title-color"],colorway:we.colorway,gridcolor:we.gridcolor,linecolor:we.linecolor,zerolinecolor:we.zerolinecolor,activecolor:we.activecolor,rangebgcolor:we.rangebgcolor,area_color:we["area-color"],trend_color:we["trend-color"],line_color:we["line-color"],error_band_line_color:we["error-band-line-color"],error_band_fill_color:we["error-band-fill-color"],ohlc_increasing:we["ohlc-increasing"],ohlc_decreasing:we["ohlc-decreasing"]}),Mh=typeof pi=="function"?pi(Ii):pi.default(Ii);function Ar(i,e,t,n,r,o,s){try{var a=i[o](s),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(n,r)}function Nh(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var o=i.apply(e,t);function s(l){Ar(o,n,r,s,a,"next",l)}function a(l){Ar(o,n,r,s,a,"throw",l)}s(void 0)})}}var Lh=ee.module("HeapUsage");function Rh(i){var e,{connection:t,defaultUpdateInterval:n,hoverUpdateInterval:r,bgMonitoring:o=!0,monitorDuration:s}=i,[a,l]=m.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[h,u]=m.useState(!1),c=m.useRef({timestamps:[],usages:[]}),g=m.useCallback(Nh(function*(){try{var k=yield t.getWorkerHeapInfo();if(l(k),o||h){for(var F=(k.totalHeapSize-k.freeMemory)/k.maximumHeapSize,N=Date.now(),{timestamps:L,usages:H}=c.current;L.length!==0&&N-L[0]>s*1.5;)L.shift(),H.shift();L.push(N),H.push(F)}else c.current={timestamps:[],usages:[]}}catch(fe){Lh.warn("Unable to get heap usage",fe)}}),[h,t,s,o]);Fa(g,h?r:n);var v=(k,F)=>Math.round(k*10**F)/10**F,f=2,p=1024**3,{freeMemory:C,totalHeapSize:_,maximumHeapSize:T}=a,w=v(C/p,f),U=v(_/p,f),K=v(T/p,f),te=U-w,x=function(F,N){var L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return d.jsxs("div",{className:de("heap-usage-info-row",{"heading-bottom-border":L}),children:[d.jsx("div",{className:"font-weight-bold",children:F}),d.jsx("div",{children:N})]})},{timestamps:j,usages:G}=c.current,ne=(e=j[j.length-1])!==null&&e!==void 0?e:0,oe=_/T,$=(_-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(oe*100,"% - ").concat(oe*2,"px")}}),d.jsx("div",{className:de("used-memory",{"heap-overflow":(_-C)/T>.95}),style:{width:"calc(".concat($*100,"% - ").concat($*2,"px")}}),d.jsxs("div",{className:"memory-text",children:[K.toFixed(1)," GB"]})]}),d.jsx(Ft,{onEntered:()=>u(!0),onExited:()=>u(!1),interactive:!0,children:d.jsxs("div",{className:"heap-tooltip",children:[x("In use:","".concat(te.toFixed(f)," of ").concat(K.toFixed(f)," GB"),!0),x("Free:","".concat(w.toFixed(f)," GB")),x("Total:","".concat(U.toFixed(f)," GB")),x("Max:","".concat(K.toFixed(f)," GB")),d.jsx("div",{className:"heap-plot",children:d.jsx(Mh,{data:[{x:[...j],y:[...G],type:"scatter",mode:"lines"}],config:{staticPlot:!0,responsive:!0},style:{width:"196px",height:"100px"},layout:{margin:{l:2,t:2,r:2,b:2},plot_bgcolor:"transparent",paper_bgcolor:"transparent",colorway:["#4878ea"],xaxis:{dtick:Math.round(s/6),gridcolor:An.linecolor,range:[ne-s,ne],linecolor:An.linecolor,linewidth:2,mirror:!0},yaxis:{dtick:.2,gridcolor:An.linecolor,range:[0,1],linecolor:An.linecolor,linewidth:2,mirror:!0}}})}),d.jsxs("div",{className:"heap-utilisation-text",children:["% utilization over ",Math.round(s/1e3/60)," min."]})]})})]})}var qi=Object.freeze({}),Ah=new Map,wv=i=>i.api,Ev=i=>i.user,Yi=i=>i.storage,ns=i=>Yi(i).commandHistoryStorage,is=i=>Yi(i).fileStorage,Pv=i=>Yi(i).workspaceStorage,kh=i=>i.workspace,et=i=>kh(i).data.settings,Tv=i=>et(i).defaultDateTimeFormat,Ov=i=>{var e;return(e=et(i).defaultDecimalFormatOptions)!==null&&e!==void 0?e:qi},xv=i=>{var e;return(e=et(i).defaultIntegerFormatOptions)!==null&&e!==void 0?e:qi},Iv=i=>et(i).formatter,Fh=i=>et(i).timeZone,Dv=i=>et(i).showTimeZone,Mv=i=>et(i).showTSeparator,Nv=i=>et(i).truncateNumbersWithPound,Lv=i=>et(i).shortcutOverrides,jh=i=>{var e;return(e=et(i).defaultNotebookSettings)!==null&&e!==void 0?e:qi},Rv=i=>i.activeTool,Av=i=>{var e;return(e=i.plugins)!==null&&e!==void 0?e:Ah},rs="SET_ACTIVE_TOOL",os="SET_API",ss="SET_COMMAND_HISTORY_STORAGE",as="SET_FILE_STORAGE",ls="SET_PLUGINS",ds="SET_USER",hs="SET_WORKSPACE",us="SET_WORKSPACE_STORAGE",cs="SET_SERVER_CONFIG_VALUES";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 kn(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){$h(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 $h(i,e,t){return e=Hh(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Hh(i){var e=Bh(i,"string");return typeof e=="symbol"?e:String(e)}function Bh(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 kv=i=>({type:ds,payload:i}),Fv=i=>({type:os,payload:i}),Uh=i=>({type:hs,payload:i}),jv=i=>({type:us,payload:i}),$v=i=>({type:ss,payload:i}),Hv=i=>({type:as,payload:i}),Wh=i=>(e,t)=>{e(Uh(i));var{storage:n}=t(),{workspaceStorage:r}=n;return r.save(i)},zh=i=>(e,t)=>{var{workspace:n}=t(),{data:r}=n,o=kn(kn({},n),{},{data:kn(kn({},r),i)});return e(Wh(o))},Vh=i=>e=>e(zh({settings:i})),Bv=i=>({type:rs,payload:i}),Uv=i=>({type:ls,payload:i}),Wv=i=>({type:cs,payload:i});function Fr(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 Si(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fr(Object(t),!0).forEach(function(n){Kh(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Fr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Kh(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=qh(i,"string");return typeof e=="symbol"?e:String(e)}function qh(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 ms(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?Si(Si({},t),r):Si({},r)}default:return t}}}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 $r(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){Yh(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 Yh(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=Zh(i,"string");return typeof e=="symbol"?e:String(e)}function Zh(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 Qh(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:o,payload:s}=r;return t&&pn({payload:s},{payload:n[o]})?n:$r($r({},n),{},{[o]:s})}default:return n}}}function $t(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 Jh=$t(os,null),eu=$t(rs,null),tu=$t(ls,null),nu=$t(ss,null),iu=$t(as,null),ru=$t(us,null),ou=Wi({commandHistoryStorage:nu,fileStorage:iu,workspaceStorage:ru}),su=ms(ds,null),au=ms(hs,null),lu=$t(cs,null);var du={activeTool:eu,api:Jh,plugins:tu,storage:ou,user:su,workspace:au,serverConfigValues:lu};const hu=du;function Hr(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 Br(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Hr(Object(t),!0).forEach(function(n){Li(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Hr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Li(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=cu(i,"string");return typeof e=="symbol"?e:String(e)}function cu(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 mu{constructor(){Li(this,"reducers",{}),Li(this,"listener",null)}register(e,t){var n;this.reducers=Br(Br({},this.reducers),{},{[e]:t}),(n=this.listener)===null||n===void 0||n.call(this,this.reducers)}setListener(e){this.listener=e}}var gu=new mu;const hi=gu;var Ur=ee.module("redux-logger"),vu=i=>e=>t=>{Ur.debug("dispatching",t);var n=e(t);return Ur.debug("next state",i.getState()),n};const fu=vu;var pu=ee.module("redux-crashReporter"),bu=i=>e=>t=>{try{return e(t)}catch(n){throw pu.error("Error executing",t," with state ",i.getState(),":",n),n}};const Cu=bu,yu=[fu,Cu,Zs];var wi;Object.entries(hu).map(i=>{var[e,t]=i;return hi.register(e,t)});var _u=(wi=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__)!==null&&wi!==void 0?wi:ea,gs=Qs(Wi(hi.reducers),_u(Js(...yu)));hi.setListener(i=>{gs.replaceReducer(Wi(i))});const zv=gs;var Su={TOGGLE_QUICK_FILTER:ue.createAndAdd({id:"TABLE.TOGGLE_QUICK_FILTER",name:"Toggle Quick Filter",shortcut:[R.CTRL,B.F],macShortcut:[R.CMD,B.F]}),CLEAR_ALL_FILTERS:ue.createAndAdd({id:"TABLE.CLEAR_ALL_FILTERS",name:"Clear All Table Filters",shortcut:[R.CTRL,B.E],macShortcut:[R.CMD,B.E]}),CLEAR_FILTERS:ue.createAndAdd({id:"TABLE.CLEAR_FILTERS",name:"Clear Active Table Filters",shortcut:[R.CTRL,R.SHIFT,B.E],macShortcut:[R.CMD,R.SHIFT,B.E]}),REVERSE:ue.createAndAdd({id:"TABLE.REVERSE",name:"Reverse",shortcut:[R.CTRL,B.I],macShortcut:[R.CMD,B.I]}),TOGGLE_SEARCH:ue.createAndAdd({id:"TABLE.TOGGLE_SEARCH",name:"Toggle Search",shortcut:[R.CTRL,R.SHIFT,B.F],macShortcut:[R.CMD,R.SHIFT,B.F]}),GOTO_ROW:ue.createAndAdd({id:"TABLE.GOTO_ROW",name:"Go to Row",shortcut:[R.CTRL,B.G],macShortcut:[R.CMD,B.G]})},wu={COMMIT:ue.createAndAdd({id:"INPUT_TABLE.COMMIT",name:"Commit",shortcut:[R.CTRL,B.S],macShortcut:[R.CMD,B.S]}),DISCARD:ue.createAndAdd({id:"INPUT_TABLE.DISCARD",name:"Discard",shortcut:[R.CTRL,R.ALT,B.S],macShortcut:[R.CMD,R.OPTION,B.S]})},Eu={TABLE:Su,INPUT_TABLE:wu};const Vv=Eu;function Wr(i,e,t,n,r,o,s){try{var a=i[o](s),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(n,r)}function Pu(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var o=i.apply(e,t);function s(l){Wr(o,n,r,s,a,"next",l)}function a(l){Wr(o,n,r,s,a,"throw",l)}s(void 0)})}}function Tu(i,e,t){return e=Ou(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ou(i){var e=xu(i,"string");return typeof e=="symbol"?e:String(e)}function xu(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=ee.module("DownloadServiceWorkerUtils");class Et{static register(e){Et.serviceWorkerRegistration&&Et.unregisterSW(),"serviceWorker"in navigator?navigator.serviceWorker.register(e).then(t=>{t.update(),Et.serviceWorkerRegistration=t,Fn.info("Registering service worker on ",e,t)}).catch(t=>{Fn.error("Failed to register service worker",t)}):Fn.info("Service worker is not supported.")}static getServiceWorker(){return Pu(function*(){if("serviceWorker"in navigator){var e=Et.serviceWorkerRegistration;if(e&&e.active)return Fn.info("Download service worker is active."),e.active;throw new Error("Can not find download service worker.")}throw new Error("Download service worker is not available.")})()}static unregisterSW(){var e;(e=Et.serviceWorkerRegistration)===null||e===void 0||e.unregister()}}Tu(Et,"serviceWorkerRegistration",null);const Kv=Et;var vs=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 fs(i){return i.componentName!==void 0}function Iu(i){return i.component!==void 0}var ps=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const Du=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:vs,isGLComponentConfig:fs,isReactComponentConfig:Iu,itemDefaultConfig:ps},Symbol.toStringTag,{value:"Module"}));function Gn(i,e,t){return e=Mu(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Mu(i){var e=Nu(i,"string");return typeof e=="symbol"?e:String(e)}function Nu(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 Cn{constructor(){Gn(this,"_mSubscriptions",void 0),Gn(this,"off",this.unbind),Gn(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[Cn.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),o=1;o<n;o++)r[o-1]=arguments[o];if(t)for(var s=0;s<t.length;s++){var a=t[s].ctx||{};try{t[s].fn.apply(a,r)}catch(c){console.error("Error while emitting event:",c)}}r.unshift(e);for(var l=this._mSubscriptions[Cn.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,o=0;o<this._mSubscriptions[e].length;o++)(!t||this._mSubscriptions[e][o].fn===t)&&(!n||n===this._mSubscriptions[e][o].ctx)&&(this._mSubscriptions[e].splice(o,1),r=!0);if(r===!1)throw new Error("Nothing to unbind for "+e)}}Gn(Cn,"ALL_EVENT","__all");const Je=Cn;function Ze(i,e,t){return e=Lu(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Lu(i){var e=Ru(i,"string");return typeof e=="symbol"?e:String(e)}function Ru(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 Ri extends Je{constructor(e,t,n){super(),Ze(this,"width",void 0),Ze(this,"height",void 0),Ze(this,"title",void 0),Ze(this,"parent",void 0),Ze(this,"layoutManager",void 0),Ze(this,"tab",void 0),Ze(this,"_config",void 0),Ze(this,"isHidden",!1),Ze(this,"beforeCloseHandler",void 0),Ze(this,"_element",I(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),Ze(this,"_contentElement",void 0),this.title=fs(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,o,s=this.parent,a=null;s&&!s.isColumn&&!s.isRow;){var l;if(a=s,s=s.parent,(l=s)!==null&&l!==void 0&&l.isRoot)return!1}if(!s||!a)return!1;for(var h=s.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)),g=u/c*100,v=(((o=a.config[h])!==null&&o!==void 0?o:0)-g)/(s.contentItems.length-1),f=0;f<s.contentItems.length;f++)if(s.contentItems[f]===a)s.contentItems[f].config[h]=g;else{var p;s.contentItems[f].config[h]=((p=s.contentItems[f].config[h])!==null&&p!==void 0?p:0)+v}return s.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,o=n.offsetHeight-n.clientHeight;this._contentElement.width(this.width-r).height(this.height-o),this.emit("resize")}}}const Au=Object.freeze(Object.defineProperty({__proto__:null,Container:Ri,ItemContainer:Ri},Symbol.toStringTag,{value:"Module"}));function bs(i){var e=location.hash.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null}function Cs(i){if(window.location.hash)return bs(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 Xi(i){return window.requestAnimationFrame(i)}function ku(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 Zi(){return(Math.random()*1e15).toString(36).replace(".","")}function Fu(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 Qi(i){return I.trim(i.replace(/(<([^>]+)>)/gi,""))}function Ae(i,e,t){return e=ju(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ju(i){var e=$u(i,"string");return typeof e=="symbol"?e:String(e)}function $u(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 Hu extends Je{constructor(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super(),Ae(this,"_eElement",void 0),Ae(this,"_oDocument",void 0),Ae(this,"_eBody",void 0),Ae(this,"_destroyAfterMouseUp",void 0),Ae(this,"_nDelay",400),Ae(this,"_timeout",void 0),Ae(this,"timeout",void 0),Ae(this,"_nDistance",10),Ae(this,"_nX",0),Ae(this,"_nY",0),Ae(this,"_nOriginalX",0),Ae(this,"_nOriginalY",0),Ae(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,o,s=this._getCoordinates(e);this._nOriginalX=(t=s.x)!==null&&t!==void 0?t:0,this._nOriginalY=(n=s.y)!==null&&n!==void 0?n:0,(r=this._oDocument)===null||r===void 0||r.on("mousemove",this.onMouseMove),(o=this._oDocument)===null||o===void 0||o.on("mouseup",this.onMouseUp),this._timeout=window.setTimeout(this._startDrag,this._nDelay)}}onMouseMove(e){if(this._timeout!=null){var t,n;e.preventDefault();var 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,o,s;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||(o=r.find("iframe"))===null||o===void 0||o.css("pointer-events",""),this._bDragging===!0&&(this._bDragging=!1,this.emit("dragStop",e,this._nOriginalX+this._nX)),(s=this._eBody)===null||s===void 0||s.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var 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 En=Hu;function Ut(i,e,t){return e=Bu(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Bu(i){var e=Uu(i,"string");return typeof e=="symbol"?e:String(e)}function Uu(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 ys{constructor(e,t){Ut(this,"_container",void 0),Ut(this,"_reactComponent",null),Ut(this,"_portalComponent",null),Ut(this,"_originalComponentWillUpdate",null),Ut(this,"_initialState",void 0),Ut(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=zi.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 le.createElement(this._reactClass,t)}}var ii=["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"],Wu=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function Ji(i){if(ii.length>36)throw new Error("Too many keys in config minifier map");var e={};return er(i,e,"_min"),e}function Ai(i){if(ii.length>36)throw new Error("Too many keys in config minifier map");var e={};return er(i,e,"_max"),e}function er(i,e,t){var n=t==="_min"?zu:Vu;for(var r in i)if(i.hasOwnProperty(r)){var o=Array.isArray(i)?i[Number.parseInt(r,10)]:i[r];if(typeof o=="object"&&o!=null){var s=o instanceof Array?[]:{};if(Array.isArray(e))e[Number.parseInt(r,10)]=s;else{var a=n(r,ii);e[a]=s}er(o,s,t)}else{var l=n(o,Wu);if(Array.isArray(e))e[Number.parseInt(r,10)]=l;else{var h=n(r,ii);e[h]=l}}}}function zu(i,e){if(typeof i=="string"&&i.length===1)return"___"+i;var t=e.indexOf(i);return t===-1?i:t.toString(36)}function Vu(i,e){return typeof i=="string"&&i.length===1?e[parseInt(i,36)]:typeof i=="string"&&i.substr(0,3)==="___"?i[3]:i}function Ei(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)}class ki{constructor(e,t){Ei(this,"name",void 0),Ei(this,"origin",void 0),Ei(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function jn(i,e,t){return e=qu(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function qu(i){var e=Yu(i,"string");return typeof e=="symbol"?e:String(e)}function Yu(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 Xu=class extends Je{constructor(e){super(),jn(this,"_layoutManager",void 0),jn(this,"_dontPropagateToParent",void 0),jn(this,"_childEventSource",void 0),jn(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Je.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 _s=Xu,Zu=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:ki,DragListener:En,EventEmitter:Je,EventHub:_s,ReactComponentHandler:ys,animFrame:Xi,filterXss:Fu,getHashValue:bs,getQueryStringParam:Cs,getUniqueId:Zi,minifyConfig:Ji,removeFromArray:ku,stripTags:Qi,unminifyConfig:Ai},Symbol.toStringTag,{value:"Module"}));function bt(i,e,t){return e=Qu(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Qu(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)}class Ss extends Je{constructor(e,t,n,r,o){super(),bt(this,"isInitialised",!1),bt(this,"_config",void 0),bt(this,"_dimensions",void 0),bt(this,"_parentId",void 0),bt(this,"_indexInParent",void 0),bt(this,"_layoutManager",void 0),bt(this,"_popoutWindow",null),bt(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=n,this._indexInParent=r,this._layoutManager=o,this._createWindow()}toConfig(){var e,t,n,r,o,s,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=(o=this._popoutWindow)===null||o===void 0?void 0:o.screenX)!==null&&r!==void 0?r:(s=this._popoutWindow)===null||s===void 0?void 0:s.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 o;((o=this._layoutManager.root.contentItems.length)!==null&&o!==void 0?o:0)>0?n=this._layoutManager.root.contentItems[0]:n=this._layoutManager.root}}t&&((e=n)===null||e===void 0||e.addChild(t,this._indexInParent),this.close())}_createWindow(){var e=this._createUrl(),t=Math.floor(Math.random()*1e6).toString(36),n=this._serializeWindowOptions({width:this._dimensions.width,height:this._dimensions.height,innerWidth:this._dimensions.width,innerHeight:this._dimensions.height,menubar:"no",toolbar:"no",location:"no",personalbar:"no",resizable:"yes",scrollbars:"no",status:"no"});if(this._popoutWindow=window.open(e,t,n),!this._popoutWindow)if(this._layoutManager.config.settings.blockedPopoutsThrowError===!0){var 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 o=window.setInterval(()=>{var s;(s=this._popoutWindow)!==null&&s!==void 0&&s.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),window.clearInterval(o))},10)}_serializeWindowOptions(e){var t=[],n;for(n in e)t.push(n+"="+e[n]);return t.join(",")}_createUrl(){var e={content:this._config},t="gl-window-config-"+Zi();e=Ji(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 be(i,e,t){return e=ec(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ec(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 Ht extends Je{constructor(e,t,n,r,o,s){var a,l,h,u,c,g,v,f;if(super(),be(this,"_dragListener",void 0),be(this,"_layoutManager",void 0),be(this,"_contentItem",void 0),be(this,"_originalParent",void 0),be(this,"_area",null),be(this,"_lastValidArea",null),be(this,"_minX",void 0),be(this,"_maxX",void 0),be(this,"_minY",void 0),be(this,"_maxY",void 0),be(this,"_width",void 0),be(this,"_height",void 0),be(this,"_sided",void 0),be(this,"element",void 0),be(this,"childElementContainer",void 0),be(this,"_proxyTab",void 0),this._dragListener=n,this._layoutManager=r,this._contentItem=o,this._originalParent=s,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var p,C;this._layoutManager.tabDropPlaceholder.width((p=this._contentItem.tab.element.outerWidth(!0))!==null&&p!==void 0?p:0),this._layoutManager.tabDropPlaceholder.height((C=this._contentItem.tab.element.outerHeight(!0))!==null&&C!==void 0?C:0)}if(this.element=I(Ht._template),s&&s._side&&(this._sided=s._sided,this.element.addClass("lm_"+s._side),["right","bottom"].indexOf(s._side.toString())>=0&&this.element.find(".lm_content").after(this.element.find(".lm_header"))),this.element.css({left:e,top:t}),this._proxyTab=this.element.find(".lm_tab"),this._proxyTab.attr("title",Qi((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(o.element),this._updateTree(),this._layoutManager._$calculateItemAreas(),I(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var _,T;this._layoutManager.tabDropPlaceholder.width((_=this._proxyTab.outerWidth(!0))!==null&&_!==void 0?_:0),this._layoutManager.tabDropPlaceholder.height((T=this._proxyTab.outerHeight(!0))!==null&&T!==void 0?T:0)}var w=this._layoutManager.container.offset();this._minX=(h=w?.left)!==null&&h!==void 0?h:0,this._minY=(u=w?.top)!==null&&u!==void 0?u:0,this._maxX=((c=this._layoutManager.container.width())!==null&&c!==void 0?c:0)+this._minX,this._maxY=((g=this._layoutManager.container.height())!==null&&g!==void 0?g:0)+this._minY,this._width=(v=this.element.width())!==null&&v!==void 0?v:0,this._height=(f=this.element.height())!==null&&f!==void 0?f:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,n){var r,o,s=(r=n.pageX)!==null&&r!==void 0?r:0,a=(o=n.pageY)!==null&&o!==void 0?o:0,l=s>this._minX&&s<this._maxX&&a>this._minY&&a<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(s,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")}}be(Ht,"_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 $n(i,e,t){return e=nc(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function nc(i){var e=ic(i,"string");return typeof e=="symbol"?e:String(e)}function ic(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 ws{constructor(e,t,n){$n(this,"_element",void 0),$n(this,"_itemConfig",void 0),$n(this,"_layoutManager",void 0),$n(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=n,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new En(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 Ht(e,t,this._dragListener,this._layoutManager,r,null)}}function Hn(i,e,t){return e=rc(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function rc(i){var e=oc(i,"string");return typeof e=="symbol"?e:String(e)}function oc(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 Es{constructor(e,t,n){Hn(this,"_element",I(window)),Hn(this,"_itemConfig",void 0),Hn(this,"_layoutManager",void 0),Hn(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 En(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 Ht(e,t,this._dragListener,this._layoutManager,r,null)}}}function Ps(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=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)}class Pn{constructor(){Ps(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()}}Ps(Pn,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function Pi(i,e,t){return e=lc(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function lc(i){var e=dc(i,"string");return typeof e=="symbol"?e:String(e)}function dc(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(e,t,n,r){Pi(this,"element",void 0),Pi(this,"_header",void 0),Pi(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 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)}class mc extends Error{constructor(e,t){super(),hc(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const At=mc,gc=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:At},Symbol.toStringTag,{value:"Module"}));function ve(i,e,t){return e=vc(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function vc(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)}function yn(i){return i.isStack}function je(i){return i.isComponent}function Ts(i){return i.isRoot}class _e extends Je{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(Je.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 o=0;o<this.contentItems.length;o++)this.contentItems[o].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 o;(o=this.parent)===null||o===void 0||o.removeChild(this)}}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.splice(t,0,e),this.config.content===void 0&&(this.config.content=[]),this.config.content.splice(t,0,e.config),e.parent=this,e.parent.isInitialised===!0&&e.isInitialised===!1&&e._$init()}replaceChild(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;t=this.layoutManager._$normalizeContentItem(t);var r=this.contentItems.indexOf(e),o=e.element[0].parentNode;if(r===-1)throw new Error("Can't replace child. oldChild is not child of this");o?.replaceChild(t.element[0],e.element[0]),n===!0&&(e.parent=null,e._$destroy()),this.contentItems[r]=t,t.parent=this,yn(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(o){for(var s=0;s<o.contentItems.length;s++)e(o.contentItems[s])===!0&&t.push(o.contentItems[s]),r(o.contentItems[s])};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&&je(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 o=(t=e.offset())!==null&&t!==void 0?t:{left:0,top:0},s=(n=e.width())!==null&&n!==void 0?n:0,a=(r=e.height())!==null&&r!==void 0?r:0;return{x1:o.left,y1:o.top,x2:o.left+s,y2:o.top+a,surface:s*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 ki(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new At("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(ps)){var r=t;e[r]===void 0&&(e[r]=n)}return e}_propagateEvent(e,t){t instanceof ki&&t.isPropagationStopped===!1&&this.isInitialised===!0&&(this.isRoot===!1&&this.parent?this.parent.emit.apply(this.parent,[e,t]):this._scheduleEventPropagationToLayoutManager(e,t))}_scheduleEventPropagationToLayoutManager(e,t){this._throttledEvents.indexOf(e)===-1?this.layoutManager.emit(e,t.origin):this._pendingEventPropagations[e]!==!0&&(this._pendingEventPropagations[e]=!0,Xi(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function tn(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=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)}class Os extends _e{constructor(e,t,n){super(e,t,n,I()),tn(this,"config",void 0),tn(this,"componentName",void 0),tn(this,"container",void 0),tn(this,"parent",void 0),tn(this,"instance",void 0),this.config=t,this.parent=n;var r=e.getComponent(this.config.componentName)||e.getFallbackComponent(),o=I.extend(!0,{},this.config.componentState||{});if(r==null)throw new At('Unknown component "'+this.config.componentName+'"');o.componentName=this.config.componentName,this.componentName=this.config.componentName,this.config.title===""&&(this.config.title=this.config.componentName),this.isComponent=!0,this.container=new Ri(this.config,this,e),this.instance=new r(this.container,o),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(){_e.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),_e.prototype._$hide.call(this)}_$show(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),_e.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),_e.prototype._$destroy.call(this)}_$getArea(){return null}}function We(i,e,t){return e=Cc(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Cc(i){var e=yc(i,"string");return typeof e=="symbol"?e:String(e)}function yc(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 ri extends _e{constructor(e,t,n,r){super(t,n,r,I('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),We(this,"isRow",void 0),We(this,"isColumn",void 0),We(this,"childElementContainer",void 0),We(this,"parent",void 0),We(this,"_splitter",[]),We(this,"_splitterSize",void 0),We(this,"_splitterGrabSize",void 0),We(this,"_isColumn",void 0),We(this,"_dimension",void 0),We(this,"_splitterPosition",null),We(this,"_splitterMinPosition",null),We(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,o,s,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),_e.prototype.addChild.call(this,e,t),r=1/this.contentItems.length*100,n===!0){this.emitBubblingEvent("stateChanged");return}for(s=0;s<this.contentItems.length;s++)if(this.contentItems[s]===e)e.config[this._dimension]=r;else{var l;o=((l=this.contentItems[s].config[this._dimension])!==null&&l!==void 0?l:0)*(100-r)/100,this.contentItems[s].config[this._dimension]=o}this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}removeChild(e,t){var n,r=(n=e.config[this._dimension])!==null&&n!==void 0?n:0,o=this.contentItems.indexOf(e),s=Math.max(o-1,0),a,l;if(o===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[s]&&(this._splitter[s]._$destroy(),this._splitter.splice(s,1)),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)}_e.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(_e.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,o=(t=this.element.height())!==null&&t!==void 0?t:0,s=0,a=[];this._isColumn?o-=n:r-=n;for(var l=0;l<this.contentItems.length;l++){var h,u,c=this._isColumn?Math.floor(o*(((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));s+=c,a.push(c)}var g=Math.floor((this._isColumn?o:r)-s);return{itemSizes:a,additionalPixel:g,totalWidth:r,totalHeight:o}}_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 o;e+=(o=this.contentItems[r].config[n])!==null&&o!==void 0?o: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 s=0;s<t.length;s++)t[s].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,o=0,s=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?(o+=t-c,l={width:t}):(r+=c-t,l={width:c},n.push(l)),a.push(l)}if(!(o===0||o>r)){var g=o/r;s=o;for(var v=0;v<n.length;v++){l=n[v];var f=Math.round((l.width-t)*g);s-=f,l.width-=f}s!==0&&(a[a.length-1].width-=s);for(var p=0;p<this.contentItems.length;p++)this.contentItems[p].config.width=a[p].width/h.totalWidth*100}}}_createSplitter(e){var t;return t=new xs(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 o,s;t=Math.max((o=e[r].minWidth)!==null&&o!==void 0?o:0,t),n=Math.max((s=e[r].minHeight)!==null&&s!==void 0?s:0,n)}return{horizontal:t,vertical:n}}_onSplitterDragStart(e){var t,n,r,o,s=this._getItemsForSplitter(e),a=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=s.before.config.content)!==null&&t!==void 0?t:[]),h=this._isColumn?l.vertical:l.horizontal,u=this._getMinimumDimensions((n=s.after.config.content)!==null&&n!==void 0?n:[]),c=this._isColumn?u.vertical:u.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((r=s.before.element[this._dimension]())!==null&&r!==void 0?r:0)-(h||a)),this._splitterMaxPosition=((o=s.after.element[this._dimension]())!==null&&o!==void 0?o: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,o,s,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=((o=a.before.config[this._dimension])!==null&&o!==void 0?o:0)+((s=a.after.config[this._dimension])!==null&&s!==void 0?s:0);a.before.config[this._dimension]=u*c,a.after.config[this._dimension]=(1-u)*c,e.element.css({top:0,left:0}),Xi(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function zr(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 Vr(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?zr(Object(t),!0).forEach(function(n){Fi(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):zr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Fi(i,e,t){return e=_c(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function _c(i){var e=Sc(i,"string");return typeof e=="symbol"?e:String(e)}function Sc(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 ji extends _e{constructor(e,t,n){super(e,Vr(Vr({},t),{},{type:"root"}),null,I('<div class="lm_goldenlayout lm_item lm_root"></div>')),Fi(this,"childElementContainer",void 0),Fi(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(je(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,o=r==="left"||r==="right"?"row":"column",s=r==="left"||r==="right"?"width":"height",a=r==="left"||r==="top",l=this.contentItems[0];if(!(l instanceof ri)||l.type!=o){var h=this.layoutManager.createContentItem({type:o},this);this.replaceChild(l,h),h.addChild(e,a?0:void 0,!0),h.addChild(l,a?void 0:0,!0),l.config[s]=50,e.config[s]=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[s]=((u=c.config[s])!==null&&u!==void 0?u:0)*.5,e.config[s]=c.config[s],l.callDownwards("setSize")}}}}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 Wt(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){Le(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 Le(i,e,t){return e=wc(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function wc(i){var e=Ec(i,"string");return typeof e=="symbol"?e:String(e)}function Ec(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 _e{constructor(e,t,n){var r,o,s,a,l,h,u,c,g;super(e,t,n,I('<div class="lm_item lm_stack"></div>')),Le(this,"_activeContentItem",null),Le(this,"_header",void 0),Le(this,"childElementContainer",I('<div class="lm_items"></div>')),Le(this,"header",void 0),Le(this,"parent",void 0),Le(this,"isStack",!0),Le(this,"_dropZones",{}),Le(this,"_dropSegment",null),Le(this,"_contentAreaDimensions",null),Le(this,"_dropIndex",void 0),Le(this,"_side",void 0),Le(this,"_sided",!1),Le(this,"config",void 0),this.parent=n,this.config=t;var v=e.config;this._side=!1,this._header={show:((r=v.settings)===null||r===void 0?void 0:r.hasHeaders)&&t.hasHeaders!==!1,popout:(o=v.settings)!==null&&o!==void 0&&o.showPopoutIcon?(s=v.labels)===null||s===void 0?void 0:s.popout:void 0,maximise:(a=v.settings)!==null&&a!==void 0&&a.showMaximiseIcon?(l=v.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(h=v.settings)!==null&&h!==void 0&&h.showCloseIcon?(u=v.labels)===null||u===void 0?void 0:u.close:void 0,minimise:(c=(g=v.labels)===null||g===void 0?void 0:g.minimise)!==null&&c!==void 0?c:void 0},v.header&&(this._header=Wt(Wt({},this._header),v.header)),t.header&&(this._header=Wt(Wt({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=Wt(Wt({},this._header),t.content[0].header)),this.header=new gt(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,n,r,o,s=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?s:0),l=((r=this.element.height())!==null&&r!==void 0?r:0)-(this._sided?0:s);for(this.childElementContainer.width(a),this.childElementContainer.height(l),o=0;o<this.contentItems.length;o++)this.contentItems[o].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(){_e.prototype._$destroy.call(this),this.header._$destroy()}_$onDrop(e){if(this._dropSegment==="header"){this._resetHeaderDropZone(),this.addChild(e,this._dropIndex);return}if(this._dropSegment==="body"){this.addChild(e);return}var t=this._dropSegment==="top"||this._dropSegment==="bottom",n=this._dropSegment==="left"||this._dropSegment==="right",r=this._dropSegment==="top"||this._dropSegment==="left",o=t&&this.parent.isColumn||n&&this.parent.isRow,s=t?"column":"row",a=t?"height":"width";if(je(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(o){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:s},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 o=r.hoverArea;if(o.x1<e&&o.x2>e&&o.y1<t&&o.y2>t){n==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(n));return}}}_$getArea(){if(this.element.is(":visible")===!1)return null;var e=super._$getArea(this.header.element),t=super._$getArea(this.childElementContainer);if(e==null||t==null)return null;var n=t.x2-t.x1,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,o,s,a,l,h,u,c,g,v,f,p,C,_,T=this.header.tabs.length;if(T===0){var w,U,K,te,x,j,G,ne,oe=this.header.element.offset();(w=this.layoutManager.dropTargetIndicator)===null||w===void 0||w.highlightArea({x1:(U=oe?.left)!==null&&U!==void 0?U:0,x2:((K=oe?.left)!==null&&K!==void 0?K:0)+100,y1:(te=(x=this.header.element.offset())===null||x===void 0?void 0:x.top)!==null&&te!==void 0?te:0,y2:((j=(G=this.header.element.offset())===null||G===void 0?void 0:G.top)!==null&&j!==void 0?j:0)+((ne=this.header.element.innerHeight())!==null&&ne!==void 0?ne:0)});return}var $=this.header.tabsContainer,k=(t=$.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),F=(n=this.layoutManager.tabDropPlaceholder.get(0))===null||n===void 0?void 0:n.getBoundingClientRect();if(!(!k||!F)){e<k.left?e=k.left+1:e>k.right&&(e=k.right-1);var N,L;if(!(F.left<e&&e<F.right)){for(var H=0;H<T;H++){var fe;if(N=this.header.tabs[H].element,L=(fe=N.get(0))===null||fe===void 0?void 0:fe.getBoundingClientRect(),L&&L.left<e&&e<L.right){this._dropIndex=H;break}}if(N&&L&&e<L.left+L.width*.5)N.before(this.layoutManager.tabDropPlaceholder);else if(N){var He;this._dropIndex=Math.min(((He=this._dropIndex)!==null&&He!==void 0?He:0)+1,T),N.after(this.layoutManager.tabDropPlaceholder)}}var Be=(r=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&r!==void 0?r:0;Be=Math.max(Be,(s=(a=this.header.tabsContainer.offset())===null||a===void 0?void 0:a.left)!==null&&s!==void 0?s:0);var y=Be+((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)),(g=this.layoutManager.dropTargetIndicator)===null||g===void 0||g.highlightArea({x1:Be,x2:y,y1:(v=(f=this.header.element.offset())===null||f===void 0?void 0:f.top)!==null&&v!==void 0?v:0,y2:((p=(C=this.header.element.offset())===null||C===void 0?void 0:C.top)!==null&&p!==void 0?p:0)+((_=this.header.element.innerHeight())!==null&&_!==void 0?_: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 o;(o=this.layoutManager.dropTargetIndicator)===null||o===void 0||o.highlightArea(r)}this._dropSegment=e}}const Pc=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:_e,Component:Os,ContentItem:_e,Root:ji,RowOrColumn:ri,Stack:$i,isComponent:je,isRoot:Ts,isStack:yn},Symbol.toStringTag,{value:"Module"}));function ut(i,e,t){return e=Tc(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Tc(i){var e=Oc(i,"string");return typeof e=="symbol"?e:String(e)}function Oc(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 Tn{constructor(e,t){var n;ut(this,"header",void 0),ut(this,"contentItem",void 0),ut(this,"element",I(Tn._template)),ut(this,"titleElement",void 0),ut(this,"closeElement",void 0),ut(this,"isActive",!1),ut(this,"_layoutManager",void 0),ut(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 En(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),je(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),je(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 Ht(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(){je(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&&je(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):je(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),je(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(),je(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onCloseMousedown(e){e.stopPropagation()}}ut(Tn,"_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 X(i,e,t){return e=xc(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function xc(i){var e=Ic(i,"string");return typeof e=="symbol"?e:String(e)}function Ic(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 gt extends Je{constructor(e,t){var n,r;super(),X(this,"layoutManager",void 0),X(this,"element",I(gt._template)),X(this,"tabsContainer",void 0),X(this,"tabDropdownContainer",void 0),X(this,"tabDropdownSearch",void 0),X(this,"tabDropdownList",null),X(this,"controlsContainer",void 0),X(this,"parent",void 0),X(this,"tabs",[]),X(this,"activeContentItem",null),X(this,"closeButton",null),X(this,"tabDropdownButton",null),X(this,"tabNextButton",I(gt._nextButtonTemplate)),X(this,"tabPreviousButton",I(gt._previousButtonTemplate)),X(this,"holdTimer",null),X(this,"rAF",null),X(this,"CLICK_TIMEOUT",500),X(this,"START_SPEED",.01),X(this,"ACCELERATION",5e-4),X(this,"PADDING",10),X(this,"SCROLL_LEFT","left"),X(this,"SCROLL_RIGHT","right"),X(this,"isDraggingTab",!1),X(this,"isOverflowing",!1),X(this,"isDropdownShown",!1),X(this,"dropdownKeyIndex",0),X(this,"_lastVisibleTabIndex",-1),X(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 Tn(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,o=0;o<this.tabs.length;o++)r=this.tabs[o].contentItem===e,this.tabs[o].setActive(r),r===!0&&(this.activeContentItem=e,this.parent.config.activeItemIndex=o);(t=this.tabs[(n=this.parent.config.activeItemIndex)!==null&&n!==void 0?n:0].element.get(0))===null||t===void 0||t.scrollIntoView({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,o,s,a;if(((n=(r=this.tabs[t].element.get(0))===null||r===void 0?void 0:r.offsetLeft)!==null&&n!==void 0?n:0)>((o=(s=this.tabsContainer.get(0))===null||s===void 0?void 0:s.offsetWidth)!==null&&o!==void 0?o: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,o;if(((n=(r=this.tabs[t].element.get(0))===null||r===void 0?void 0:r.offsetLeft)!==null&&n!==void 0?n:0)<((o=this.tabsContainer.scrollLeft())!==null&&o!==void 0?o:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT);else{var s=this.tabsContainer.get(0);s&&(s.scrollLeft=0)}}_handleScrollButtonMouseDown(e){this.holdTimer=window.setTimeout(()=>{var t;this._handleScrollRepeat(e,(t=this.tabsContainer.scrollLeft())!==null&&t!==void 0?t:0,100)},this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)}_handleScrollButtonMouseUp(){var e,t;clearTimeout((e=this.holdTimer)!==null&&e!==void 0?e:-1),this.holdTimer=null,cancelAnimationFrame((t=this.rAF)!==null&&t!==void 0?t:-1),this.rAF=null,window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)}_checkScrollArrows(){var e,t,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,o=arguments.length>3?arguments[3]:void 0,s=this.tabsContainer.get(0);if(s){var a=s.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)===s.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((n=this.rAF)!==null&&n!==void 0?n:-1),this.rAF=window.requestAnimationFrame(u=>{var c,g,v=o||u,f=u-v,p=this.START_SPEED*f+.5*this.ACCELERATION*(f*f);p=Math.min(p,(c=(g=this.tabsContainer.get(0))===null||g===void 0?void 0:g.scrollWidth)!==null&&c!==void 0?c:1/0),this._handleScrollRepeat(e,t,p,v)})}}_$setClosable(e){return this.closeButton&&this._isClosable()?(this.closeButton.element[e?"show":"hide"](),!0):!1}_$destroy(){this.emit("destroy",this);for(var e=0;e<this.tabs.length;e++)this.tabs[e]._$destroy();this._detachWheelListener(),this._handleItemDropped(),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,o;if(o=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new hn(this,o,"lm_tabdropdown",this._showAdditionalTabsDropdown),this.tabDropdownButton.element.hide(),this.controlsContainer.prepend(this.tabNextButton),this.tabNextButton.hide(),this._getHeaderSetting("popout")&&(t=this._onPopoutClick.bind(this),n=this._getHeaderSetting("popout"),new hn(this,n,"lm_popout",t)),this._getHeaderSetting("maximise")){r=this.parent.toggleMaximise.bind(this.parent);var s=this._getHeaderSetting("maximise"),a=this._getHeaderSetting("minimise"),l=new hn(this,s,"lm_maximise",r);this.parent.on("maximised",function(){l.element.attr("title",a??"")}),this.parent.on("minimised",function(){l.element.attr("title",s??"")})}this._isClosable()&&(e=this.parent.remove.bind(this.parent),n=this._getHeaderSetting("close"),this.closeButton=new hn(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 o,s;e.preventDefault(),(o=this.tabDropdownList)===null||o===void 0||o.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,-1,this.tabDropdownList),(s=this.tabDropdownList)===null||s===void 0||s.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_handleFilterInput(e){if(this.tabDropdownList!=null){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var t=0;t<this.tabDropdownList.length;t++){var 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 o=(e=(t=this.tabDropdownContainer.get(0))===null||t===void 0?void 0:t.scrollHeight)!==null&&e!==void 0?e:0;if(o!==0){var s=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=o<a-h.bottom,c=!u&&h.bottom>a*.6,g=Math.min(h.left+(c?h.width:0),l-s.width-this.PADDING),v=c?Math.max(h.top-o,this.PADDING):h.bottom,f=a-v-this.PADDING;this.tabDropdownContainer.css({"max-height":f,top:v,left:g})}}}}_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()}}}}X(gt,"_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(""));X(gt,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));X(gt,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function nn(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)}class xs{constructor(e,t,n){nn(this,"_isVertical",void 0),nn(this,"_size",void 0),nn(this,"_grabSize",void 0),nn(this,"_dragListener",void 0),nn(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=n<t?t:n,this.element=this._createElement(),this._dragListener=new En(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 Nc=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:Ss,DragProxy:Ht,DragSource:ws,DragSourceFromEvent:Es,DropTargetIndicator:Pn,Header:gt,HeaderButton:hn,Splitter:xs,Tab:Tn},Symbol.toStringTag,{value:"Module"}));var Lc={config:Du,container:Au,controls:Nc,errors:gc,items:Pc,utils:Zu};const Rc=Lc;function Gr(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 Ne(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Gr(Object(t),!0).forEach(function(n){J(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Gr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function J(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=kc(i,"string");return typeof e=="symbol"?e:String(e)}function kc(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 Is extends Je{static minifyConfig(e){return Ji(e)}static unminifyConfig(e){return Ai(e)}constructor(e,t){super(),J(this,"isInitialised",!1),J(this,"_isFullPage",!1),J(this,"_resizeTimeoutId",void 0),J(this,"_components",{"lm-react-component":ys}),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 _s(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:ri.bind(this,!0),row:ri.bind(this,!1),stack:$i,component:Os}}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 _e))throw new Error("Root must be a ContentItem");var t={settings:Ne({},this.config.settings),dimensions:Ne({},this.config.dimensions),labels:Ne({},this.config.labels),content:[]},n=function o(s,a){for(var l in a.config)l!=="content"&&(s[l]=a.config[l]);if(s.componentName==="lm-react-component"&&(s.type="react-component"),a.contentItems.length){s.content=[];for(var h=0;h<a.contentItems.length;h++)s.content[h]={},o(s.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 o,s;this._maximisedItem.element.width((o=this.container.width())!==null&&o!==void 0?o:0),this._maximisedItem.element.height((s=this.container.height())!==null&&s!==void 0?s:0),this._maximisedItem.callDownwards("setSize")}this._adjustColumnsResponsive()}}destroy(){var e;this.isInitialised===!1||!this.root||(this._onUnload(),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 At("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 At(n);return e.type==="component"&&!(t instanceof $i)&&t&&!(this.isSubWindow===!0&&t instanceof ji)&&(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 o=[],s=e instanceof _e,a=this;if(s){var l;o=this.toConfig(e).content,n=Zi();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 g;r=(g=h)===null||g===void 0?void 0:g.contentItems.indexOf(u)}}else e instanceof Array?o=e:o=[e];if(!t&&s){var v,f,p,C=window.screenX||window.screenLeft,_=window.screenY||window.screenTop,T=(v=e.element.offset())!==null&&v!==void 0?v:{left:0,top:0};t={left:C+T.left,top:_+T.top,width:(f=e.element.width())!==null&&f!==void 0?f:0,height:(p=e.element.height())!==null&&p!==void 0?p:0}}if(!t&&!s&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),s&&e.remove(),!(!t||!n||r===void 0)){var w=new Ss(o,t,n,r,this);return w.on("initialised",function(){a.emit("windowOpened",w)}),w.on("closed",function(){a._$reconcilePopoutWindows()}),this.openPopouts.push(w),w}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var n=new ws(e,t,this);return this._dragSources.push(n),n}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new Es(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,o=0;o<this._itemAreas.length;o++){var s=this._itemAreas[o];e>s.x1&&e<s.x2&&t>s.y1&&t<s.y2&&n>s.surface&&(n=s.surface,r=s)}return r}_$createRootItemAreas(){var e=50,t=Ne({},this.root._$getArea()),n=[Ne(Ne({},t),{},{side:"left",x2:t.x1+e}),Ne(Ne({},t),{},{side:"right",x1:t.x2-e}),Ne(Ne({},t),{},{side:"top",y2:t.y1+e}),Ne(Ne({},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(yn(n)){var r=n._$getArea();if(r!==null)if(r instanceof Array)this._itemAreas=this._itemAreas.concat(r);else{var o;this._itemAreas.push(r);var s=Ne(Ne({},r),(o=r.contentItem._contentAreaDimensions)===null||o===void 0?void 0:o.header.highlightArea);s.surface=(s.x2-s.x1)*(s.y2-s.y1),this._itemAreas.push(s)}}}}_$normalizeContentItem(e,t){if(!e)throw new Error("No content item defined");if(typeof e=="function"&&(e=e()),e instanceof _e)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=Cs("gl-window");n&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(n)||"{}"),e=Ai(e),localStorage.removeItem(n)),e=I.extend(!0,{},vs,e);var r=function o(s){for(var a in s){var l=s[a];a!=="props"&&typeof l=="object"&&l!=null?o(l):a==="type"&&l==="react-component"&&(s.type="component",s.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=Qi((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 At(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new At(t,e);this.root=new ji(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),o=e-r,s=this.root.contentItems[0],a=this._findAllStackContainers()[0],l=0;l<o;l++){var h=s.contentItems[s.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=>{yn(n)?e.push(n):n.isComponent||this._findAllStackContainersRecursive(e,n)})}}J(Is,"__lm",Rc);const Fc=Is,jc="_lm_dragging_1ec0h_1",$c="_lm_goldenlayout_1ec0h_1",Hc="_lm_header_1ec0h_1",Bc="_lm_controls_1ec0h_1",Uc="_lm_tabpreviousbutton_1ec0h_1",Wc="_lm_tabnextbutton_1ec0h_1",zc="_lm_tab_1ec0h_1",Vc="_lm_active_1ec0h_1",Kc="_lm_close_tab_1ec0h_1",Gc="_lm_content_1ec0h_1",qc="_lm_dragProxy_1ec0h_1",Yc="_lm_dropTargetIndicator_1ec0h_1",Xc="_march_1ec0h_1",Zc="_lm_inner_1ec0h_1",Qc="_lm_splitter_1ec0h_1",Jc="_lm_selectable_1ec0h_1",em="_lm_tabdropdown_list_1ec0h_1",tm="_lm_title_1ec0h_1",nm="_lm_title_before_1ec0h_1",im="_lm_selected_1ec0h_1",rm="_lm_focusin_1ec0h_1",om="_lm_window_blur_1ec0h_1",sm="_lm_popout_1ec0h_1",am="_lm_maximise_1ec0h_1",lm="_lm_tabdropdown_1ec0h_1",dm="_lm_close_1ec0h_1",hm="_lm_tabdropdown_search_1ec0h_1",um="_lm_tabs_1ec0h_1",cm="_lm_keyboard_active_1ec0h_1",mm="_lm_maximised_1ec0h_1",gm="_lm_items_1ec0h_1",qr={"tab-height":"28px","drag-border-width":"5px",lm_dragging:jc,lm_goldenlayout:$c,lm_header:Hc,lm_controls:Bc,lm_tabpreviousbutton:Uc,lm_tabnextbutton:Wc,lm_tab:zc,lm_active:Vc,lm_close_tab:Kc,lm_content:Gc,lm_dragProxy:qc,lm_dropTargetIndicator:Yc,march:Xc,lm_inner:Zc,lm_splitter:Qc,lm_selectable:Jc,lm_tabdropdown_list:em,lm_title:tm,lm_title_before:nm,lm_selected:im,lm_focusin:rm,lm_window_blur:om,lm_popout:sm,lm_maximise:am,lm_tabdropdown:lm,lm_close:dm,lm_tabdropdown_search:hm,lm_tabs:um,lm_keyboard_active:cm,lm_maximised:mm,lm_items:gm},Yr=Object.freeze({tabHeight:parseInt(qr["tab-height"],10),dragBorderWidth:parseInt(qr["drag-border-width"],10)});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 ht(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){Ds(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 Ds(i,e,t){return e=vm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function vm(i){var e=fm(i,"string");return typeof e=="symbol"?e:String(e)}function fm(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 Ct=ee.module("LayoutUtils");function Ms(i){return i.componentName!==void 0}function Vt(i){var e=i;return(Ms(i)&&i.componentName==="lm-react-component"||i.type==="react-component")&&e.component!==void 0}function Bn(i){return i.focus!==void 0}function Zr(i){return i.type==="stack"}class O{static activateTab(e,t){var n=O.getStackForRoot(e,t,!1);if(!n){Ct.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 Ct.error("Could not find stack for config",t),!1;var r=O.getContentItemInStack(n,t),o=n.getActiveContentItem();return o===r}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=t?"column":"row";if(Ts(e)){(e.contentItems==null||e.contentItems.length===0)&&e.addChild({type:n});var r=e.contentItems[0],o=t?r.isColumn:r.isRow;if(!o){e.removeChild(r,!0),e.addChild({type:n});var s=document.activeElement;e.contentItems[0].addChild(r),s&&s.focus!=null&&s.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var 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&&yn(e)&&e.contentItems.length===0)return e;if(e.contentItems==null)return null;for(var r=0;r<e.contentItems.length;r+=1){var o=e.contentItems[r];if(o.isComponent&&o.config!=null&&or(o.config,t))return e;var s=this.getStackForConfig(o,t,n);if(s)return s}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,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=this.getStackForConfig(e,t);return!s&&r&&(s=this.getStackForConfig(e,{component:t.component},o)),!s&&n&&(s=this.addStack(e)),s}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,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=0;s<t.length;s+=1){var a=t[s],l=s===t.length-1,h=O.getStackForRoot(e,{component:a},n&&l,r,o);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&&or(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 o=e[r],{component:s,content:a}=o;if(s){var l=t(s,o);l!=null?n.push(l):Ct.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(s,'"'))}else if(a){var h=ht(ht({},o),{},{content:O.dehydrateLayoutConfig(a,t)});n.push(h)}else n.push(o)}return n}static getTabPoint(e){var{tab:t}=e;if(t==null)throw new Error("Cannot get tab for panel container ".concat(e));var n=t.element[0].getBoundingClientRect();return[n.left+n.width*.5,n.bottom-8]}static dropLayoutMinorChange(e){for(var t=0;t<e.length;t+=1){var n=e[t],{content:r}=n;r!==void 0?(Zr(n)&&delete n.activeItemIndex,O.dropLayoutMinorChange(r)):Vt(n)&&n.component==="IrisGridPanel"&&n.props.panelState!=null&&(delete n.id,n.props.panelState.irisGridState.sorts=[],n.props.panelState.irisGridState.quickFilters=[])}}static isEqual(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(n){var r=O.cloneLayout(e),o=O.cloneLayout(t);return O.dropLayoutMinorChange(r),O.dropLayoutMinorChange(o),pn(r,o)}return pn(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 o=e[r];if(Vt(o)){var s,{component:a,props:l={}}=o;n.push(ht(ht({},o),{},{id:(s=o?.id)!==null&&s!==void 0?s:Kt(),props:t(a,l)}))}else if(o.content!==void 0){var h=O.hydrateLayoutConfig(o.content,t);Zr(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=h.length&&(Ct.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),n.push(ht(ht({},o),{},{content:h}))}else n.push(o)}return n}static openComponent(){var{root:e,config:t,replaceExisting:n=!0,replaceConfig:r=void 0,createNewStack:o=!1,focusElement:s=void 0,dragEvent:a=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},l=document.activeElement,h=ht({},t);if(h.id==null&&(h.id=Kt.generate()),a!=null){e?.layoutManager.createDragSourceFromEvent(h,a);return}var u=r||{id:h.id,component:h.component};M(e);var c=o?O.addStack(e):O.getStackForRoot(e,u);M(c);var g=O.getContentItemInStack(c,u);if(s!=null){var v=p=>{Ct.debug("Component created, focusing element",s),c.off("componentCreated",v);var{element:C}=p.origin;requestAnimationFrame(()=>{O.focusElement(C[0],s)})};c.on("componentCreated",v)}if(n&&g){var f=c.contentItems.indexOf(g);c.addChild(h,f+1),c.removeChild(g),c.setActiveContentItem(c.contentItems[f])}else c.addChild(h);s==null&&l&&Bn(l)&&l.focus()}static openComponentInStack(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=document.activeElement,o={id:t.id},s=O.getContentItemInStack(e,o);if(n&&s&&e){var a=e?.contentItems.indexOf(s);e.addChild(t,a+1),e.removeChild(s),e.setActiveContentItem(e.contentItems[a])}else e?.addChild(t);r&&Bn(r)&&r.focus()}static closeComponent(e,t,n){var r=O.getStackForRoot(e,t,!1,!1,!1);if(!r){Ct.warn("Cannot find stack for component, ignoring close",t);return}var o=O.getContentItemInStack(r,t),s=document.activeElement;o&&(je(o)?o.container.close(n):r.removeChild(o)),s&&document.contains(s)&&Bn(s)&&s.focus()}static renameComponent(e,t,n){var r=O.getStackForRoot(e,t,!1);if(!r){Ct.error("Could not find stack for config",t);return}var o=O.getContentItemInStack(r,t);o&&o.setTitle(n)}static cloneComponent(e,t){var n=O.getStackForRoot(e,t,!1);if(!n)return Ct.error("Could not find stack for config",t),null;var{props:r={}}=t,o=O.getPanelComponentState(t),s={type:"react-component",component:t.component,props:ht(ht({},r),{},{panelState:o}),title:"".concat(t.title," Copy"),id:Kt.generate()};return O.openComponentInStack(n,s),s}static getPanelComponentState(e){if(Ms(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(Vt(e)){var n;return(n=e.props)===null||n===void 0?void 0:n.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:Yr.tabHeight,borderWidth:Yr.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&&Vt(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:(Bn(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)})}}Ds(O,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var pm=le.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.']})})});pm.displayName="PanelPlaceholder";const re=Object.freeze({FOCUS:"PanelEvent.FOCUS",MOUNT:"PanelEvent.MOUNT",UNMOUNT:"PanelEvent.UNMOUNT",TITLE_CHANGED:"PanelEvent.TITLE_CHANGED",REOPEN:"PanelEvent.REOPEN",DELETE:"PanelEvent.DELETE",CLONED:"PanelEvent.CLONED",CLOSED:"PanelEvent.CLOSED",OPEN:"PanelEvent.OPEN",CLOSE:"PanelEvent.CLOSE",DRAGGING:"PanelEvent.DRAGGING",DROPPED:"PanelEvent.DROPPED"});function Hi(i){return i?.WrappedComponent!==void 0}function bm(i){return typeof i.id=="string"&&i.layout instanceof Fc&&i.panelManager instanceof tr&&typeof i.registerComponent=="function"}function Cm(i){if(!bm(i))throw new Error("Expected dashboard plugin props, but instead received ".concat(i))}function Qr(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 Jr(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qr(Object(t),!0).forEach(function(n){_t(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Qr(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function _t(i,e,t){return e=ym(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ym(i){var e=_m(i,"string");return typeof e=="symbol"?e:String(e)}function _m(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 ze=ee.module("PanelManager");class tr{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,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:()=>{};_t(this,"layout",void 0),_t(this,"hydrateComponent",void 0),_t(this,"dehydrateComponent",void 0),_t(this,"onPanelsUpdated",void 0),_t(this,"closed",void 0),_t(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=s,this.openedMap=new Map(r),this.closed=[...o],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(re.FOCUS,this.handleFocus),e.on(re.MOUNT,this.handleMount),e.on(re.UNMOUNT,this.handleUnmount),e.on(re.REOPEN,this.handleReopen),e.on(re.DELETE,this.handleDeleted),e.on(re.CLOSED,this.handleClosed),e.on(re.CLOSE,this.handleControlClose)}stopListening(){var{eventHub:e}=this.layout;e.off(re.FOCUS,this.handleFocus),e.off(re.MOUNT,this.handleMount),e.off(re.UNMOUNT,this.handleUnmount),e.off(re.REOPEN,this.handleReopen),e.off(re.DELETE,this.handleDeleted),e.off(re.CLOSED,this.handleClosed),e.off(re.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&&Vt(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=>Hi(n)&&t instanceof n.WrappedComponent||!Hi(n)&&t instanceof n))}updatePanel(e){var t=O.getIdFromPanel(e);if(t==null){ze.error("updatePanel Panel did not have an ID",e);return}ze.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){ze.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){ze.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){ze.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}ze.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){ze.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){ze.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){ze.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}handleReopen(e,t){ze.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:n}=e,{props:r}=e;r=this.hydrateComponent(n,r);var o=Jr(Jr({},e),{},{props:r}),{root:s}=this.layout;O.openComponent({root:s,config:o,replaceConfig:t})}handleDeleted(e){ze.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){ze.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&&Vt(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)})}}_t(tr,"MAX_CLOSED_PANEL_COUNT",100);var Sm=ee.module("PanelErrorBoundary");class wm 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);Sm.debug("componentWillUnmount",n),t.emit(re.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(Vi,{errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e}}function eo(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 oi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?eo(Object(t),!0).forEach(function(n){Em(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):eo(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Em(i,e,t){return e=Pm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Pm(i){var e=Tm(i,"string");return typeof e=="symbol"?e:String(e)}function Tm(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 Ns(i){var{props:e,componentState:t}=i,{metadata:n}=e,{panelState:r=null}=e;t&&({panelState:r}=t);var o={};return n!=null&&(o.metadata=n),r!=null&&(o.panelState=r),oi(oi({},i),{},{componentState:null,props:o,type:"react-component"})}function Ls(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return oi(oi({metadata:{}},i),{},{localDashboardId:e})}const Om={dehydrate:Ns,hydrate:Ls};var xm=z.shape({on:z.func,off:z.func,isHidden:z.bool,tab:z.shape({header:z.shape({tabs:z.arrayOf(z.shape({contentItem:z.shape({})}))})}),title:z.string,setTitle:z.func,close:z.func}),Rs=z.shape({on:z.func,off:z.func,emit:z.func}),Im=z.shape({registerComponent:z.func,root:z.shape({addChild:z.func}),on:z.func,off:z.func,eventHub:Rs}),Dm=Object.freeze({Container:xm,EventHub:Rs,Layout:Im});function Te(i,e,t){m.useEffect(function(){return i.on(e,t),()=>{i.off(e,t)}},[i,e,t])}function rn(i,e,t,n){var r,o=(r=e.COMPONENT)!==null&&r!==void 0?r:e.displayName;if(o==null)throw new Error("ComponentType must have a `COMPONENT` or `displayName` attribute.");le.useEffect(()=>{var s=i(o,e,t,n);return()=>{s()}},[e,n,t,o,i])}var As="SET_DASHBOARD_DATA";const Mm=Qh(As,{},!1),Nm={dashboardData:Mm};var Lm=new Map,Rm=Object.freeze({}),Am=Object.freeze([]),km=i=>i.dashboardData,Re=(i,e)=>{var t;return(t=km(i)[e])!==null&&t!==void 0?t:Rm},qv=(i,e)=>{var t;return(t=Re(i,e).closed)!==null&&t!==void 0?t:Am},Yv=(i,e)=>{var t;return(t=Re(i,e).openedMap)!==null&&t!==void 0?t:Lm};function to(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 no(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?to(Object(t),!0).forEach(function(n){Fm(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):to(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=$m(i,"string");return typeof e=="symbol"?e:String(e)}function $m(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 Hm=(i,e)=>({type:As,id:i,payload:e}),Ot=(i,e)=>(t,n)=>t(Hm(i,no(no({},Re(n(),i)),e)));Object.entries(Nm).map(i=>{var[e,t]=i;return hi.register(e,t)});function Bm(i){var{children:e}=i;return d.jsx(d.Fragment,{children:e})}function io(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 on(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?io(Object(t),!0).forEach(function(n){Um(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):io(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Um(i,e,t){return e=Wm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Wm(i){var e=zm(i,"string");return typeof e=="symbol"?e:String(e)}function zm(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 Un=ee.module("DashboardLayout"),Vm=Object.freeze({}),Km=[],ro=()=>{},oo=i=>i;function Gm(i){var e,t,{id:n,children:r,emptyDashboard:o=d.jsx("div",{children:"Dashboard is empty."}),layout:s,layoutConfig:a=Km,onLayoutChange:l=ro,onLayoutInitialized:h=ro,hydrate:u=Ls,dehydrate:c=Ns,panelWrapper:g=Bm}=i,v=Io(),f=(e=ta(b=>Re(b,n)))!==null&&e!==void 0?e:Vm,[p,C]=m.useState(!1),[_,T]=m.useState(!1),[w,U]=m.useState(),[K]=m.useState((t=f?.closed)!==null&&t!==void 0?t:[]),[te,x]=m.useState(!1),[j,G]=m.useState(s.getReactChildren()),ne=m.useMemo(()=>new Map,[]),oe=m.useMemo(()=>new Map,[]),$=m.useCallback(function(b,S){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:u,V=arguments.length>3&&arguments[3]!==void 0?arguments[3]:c;Un.debug2("registerComponent",b,S,P,V);function Ye(W,q){var ie=S,pe=g,gi=Hi(ie)&&ie.WrappedComponent.prototype!=null&&ie.WrappedComponent.prototype.isReactComponent!=null||ie.prototype!=null&&ie.prototype.isReactComponent!=null,{glContainer:Nn,glEventHub:vi}=W;return d.jsx(wm,{glContainer:Nn,glEventHub:vi,children:d.jsx(pe,on(on({},W),{},{children:gi?d.jsx(ie,on(on({},W),{},{ref:q})):d.jsx(ie,on({},W))}))})}var E=s.registerComponent(b,le.forwardRef(Ye));return ne.set(b,P),oe.set(b,V),E},[u,c,ne,oe,s,g]),k=m.useCallback((b,S)=>{var P;return((P=ne.get(b))!==null&&P!==void 0?P:oo)(S,n)},[ne,n]),F=m.useCallback((b,S)=>{var P;return((P=oe.get(b))!==null&&P!==void 0?P:oo)(S,n)},[oe,n]),N=m.useMemo(()=>new tr(s,k,F,new Map,K,b=>{var{closed:S,openedMap:P}=b;v(Ot(n,{closed:S,openedMap:P}))}),[F,v,k,n,K,s]),L=m.useCallback(()=>{if(!_){te||(h(),x(!0));var b=s.toConfig(),S=b.content,P=O.dehydrateLayoutConfig(S,F),V=w==null||!O.isEqual(w,P);Un.debug("handleLayoutStateChanged",V,S,P),V&&(C(s.root.contentItems.length===0),U(P),l(P),G(s.getReactChildren()))}},[F,te,_,w,s,l,h]),H=m.useCallback(b=>{var S=O.getIdFromContainer(b);s.eventHub.emit(re.DRAGGING,S),T(!0)},[s.eventHub]),fe=m.useCallback(b=>{var S=O.getIdFromContainer(b);s.eventHub.emit(re.DROPPED,S),T(!1)},[s.eventHub]),He=m.useCallback(b=>{if(Un.debug2("handleComponentCreated",b),!(b==null||b.config==null||b.config.component==null||b.element==null)){var S=b.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),P="".concat(S,"-component");b.element.addClass(P)}},[]),Be=m.useCallback(()=>{G(s.getReactChildren())},[s]);Te(s,"stateChanged",L),Te(s,"itemPickedUp",H),Te(s,"itemDropped",fe),Te(s,"componentCreated",He),Te(s.eventHub,re.TITLE_CHANGED,L),Te(s,"reactChildrenChanged",Be);var y=ja(a);return m.useEffect(function(){if(y!==a&&a!==w){Un.debug("Setting new layout content...");for(var S=O.hydrateLayoutConfig(a,k);s.root.contentItems.length>0;)s.root.contentItems[0].remove();for(var P=0;P<S.length;P+=1)s.root.addChild(S[P]);C(s.root.contentItems.length===0)}},[k,s,a,w,N,y]),d.jsxs(d.Fragment,{children:[p&&o,j,le.Children.map(r,b=>b!=null?le.cloneElement(b,{id:n,layout:s,panelManager:N,registerComponent:$}):null)]})}Gm.propTypes={id:z.string.isRequired,children:z.node,data:z.shape({}),emptyDashboard:z.node,layout:Dm.Layout.isRequired,layoutConfig:z.arrayOf(z.shape({})),onLayoutChange:z.func,onLayoutInitialized:z.func};var Xv="default";function On(i,e,t){return e=qm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function qm(i){var e=Ym(i,"string");return typeof e=="symbol"?e:String(e)}function Ym(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{}On(Jt,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");On(Jt,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");On(Jt,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");On(Jt,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");On(Jt,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");const Ge=Jt;function xt(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=Zm(i,"string");return typeof e=="symbol"?e:String(e)}function Zm(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 vt{}xt(vt,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");xt(vt,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");xt(vt,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");xt(vt,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");xt(vt,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");xt(vt,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");xt(vt,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");xt(vt,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");const so=vt,Zv=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function ft(i,e,t){return e=Qm(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Qm(i){var e=Jm(i,"string");return typeof e=="symbol"?e:String(e)}function Jm(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 at{}ft(at,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");ft(at,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");ft(at,"CLOSE_FILE","NotebookEvent.closeFile");ft(at,"RENAME","NotebookEvent.rename");ft(at,"RENAME_FILE","NotebookEvent.renameFile");ft(at,"REGISTER_FILE","NotebookEvent.registerFile");ft(at,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");ft(at,"UNREGISTER_FILE","NotebookEvent.unregisterFile");ft(at,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");const ae=at;function en(i,e,t){return e=eg(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function eg(i){var e=tg(i,"string");return typeof e=="symbol"?e:String(e)}function tg(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{}en(Bt,"focus","TabEvent.focus");en(Bt,"blur","TabEvent.blur");en(Bt,"openPQObject","TabEvent.openPQObject");en(Bt,"openControl","TabEvent.openControl");en(Bt,"reload","TabEvent.reload");en(Bt,"clearAllFilters","TabEvent.clearAllFilters");const Wn=Bt;function ng(i,e,t){return e=ig(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ig(i){var e=rg(i,"string");return typeof e=="symbol"?e:String(e)}function rg(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 ks 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,o,s,a,l,h,u;if(((r=t[n].contentItem)===null||r===void 0||(o=r.config)===null||o===void 0?void 0:o.id)===((s=e.tab)===null||s===void 0||(a=s.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 o,s,a,l,h,u,c,g;if(((o=t[r].contentItem)===null||o===void 0||(s=o.config)===null||s===void 0?void 0:s.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 v=!!(!((u=t[r])===null||u===void 0||(c=u.contentItem)===null||c===void 0||(g=c.config)===null||g===void 0)&&g.isClosable);if(v){n=!1;break}}return n}canCloseAny(){for(var e=this.getAllTabs(),t=!0,n=e.length-1;n>0;n-=1){var r,o,s,a=!!(!((r=e[n])===null||r===void 0||(o=r.contentItem)===null||o===void 0||(s=o.config)===null||s===void 0)&&s.isClosable);if(a){t=!1;break}}return t}render(){var e,t,n,{additionalActions:r,glContainer:o}=this.props,s=[...r],a=(e=o.tab)===null||e===void 0||(t=e.contentItem)===null||t===void 0||(n=t.config)===null||n===void 0?void 0:n.isClosable;return s.push({title:"Close",order:10,group:Z.groups.low,action:this.handleCloseTab,disabled:a===void 0||!a}),s.push(()=>({title:"Close Tabs to Right",order:20,group:Z.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),s.push(()=>({title:"Close All",order:30,group:Z.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),d.jsx(Z,{actions:s})}}ng(ks,"defaultProps",{additionalActions:[]});const og=ks;function Fs(i,e,t){return e=sg(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function sg(i){var e=ag(i,"string");return typeof e=="symbol"?e:String(e)}function ag(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 js extends m.PureComponent{constructor(e){super(e),Fs(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=le.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:o}=this.state;return d.jsxs("form",{className:de("p-3",{"was-validated":o}),onSubmit:this.handleRenameSubmit,noValidate:!0,role:"presentation",onMouseDown:s=>{s.stopPropagation()},onMouseUp:s=>{s.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(se,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),d.jsx(se,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var{isShown:e,onCancel:t}=this.props;return d.jsx($a,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}Fs(js,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});function $s(i,e,t){return e=lg(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function lg(i){var e=dg(i,"string");return typeof e=="symbol"?e:String(e)}function dg(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 hg=ee.module("Panel");class Hs extends m.PureComponent{constructor(e){super(e),$s(this,"getAdditionActions",st((n,r,o)=>{var s=[];return r&&s.push(this.getCloneAction()),o&&s.push(this.getRenameAction()),[...s,...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);var{glContainer:t}=this.props;this.state={title:O.getTitleFromContainer(t),showRenameDialog:!1}}componentDidMount(){var{componentPanel:e,glContainer:t,glEventHub:n}=this.props;t.on("resize",this.handleResize),t.on("show",this.handleBeforeShow),t.on("shown",this.handleShow),t.on("hide",this.handleHide),t.on("tab",this.handleTab),t.on("tabClicked",this.handleTabClicked),n.on(Ge.SESSION_CLOSED,this.handleSessionClosed),n.on(Ge.SESSION_OPENED,this.handleSessionOpened),n.on(Wn.focus,this.handleTabFocus),n.on(Wn.blur,this.handleTabBlur),n.on(so.CLEAR_ALL_FILTERS,this.handleClearAllFilters),n.emit(re.MOUNT,e)}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(Ge.SESSION_CLOSED,this.handleSessionClosed),n.off(Ge.SESSION_OPENED,this.handleSessionOpened),n.off(Wn.focus,this.handleTabFocus),n.off(Wn.blur,this.handleTabBlur),n.off(so.CLEAR_ALL_FILTERS,this.handleClearAllFilters),n.emit(re.UNMOUNT,e)}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(re.FOCUS,t);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);M(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){hg.error("Could not get component config from container",e);return}var o=O.cloneComponent(n,r);o!==null&&t.emit(re.CLONED,this,o)}getCloneAction(){return{title:"Copy Panel",order:10,group:Z.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:Z.groups.medium,action:this.handleShowRenameDialog}}render(){var{children:e,className:t,renderTabTooltip:n,glContainer:r,additionalActions:o,errorMessage:s,isLoaded:a,isLoading:l,isClonable:h,isRenamable:u}=this.props,{tab:c}=r,{showRenameDialog:g,title:v}=this.state;return d.jsxs("div",{className:de("h-100 w-100 iris-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,children:[e,d.jsx(Vi,{errorMessage:s,isLoaded:a,isLoading:l}),c!=null&&zi.createPortal(d.jsxs(d.Fragment,{children:[d.jsx(og,{glContainer:r,additionalActions:this.getAdditionActions(o,h,u)}),u&&d.jsx(js,{isShown:g,value:v,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),n!=null&&d.jsx(Ft,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:n()})]}),c.element[0])]})}}$s(Hs,"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 xn=Hs,Qv=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var ug=new Map,ui=Object.freeze([]),Jv=(i,e)=>{var t;return(t=Re(i,e).columns)!==null&&t!==void 0?t:ui},ef=(i,e)=>{var t;return(t=Re(i,e).filterSets)!==null&&t!==void 0?t:ui},tf=(i,e)=>{var t;return(t=Re(i,e).filters)!==null&&t!==void 0?t:ui},nf=(i,e)=>{var t;return(t=Re(i,e).tableMap)!==null&&t!==void 0?t:ug},rf=(i,e)=>Re(i,e).isolatedLinkerPanelId,Bs=(i,e)=>{var t;return(t=Re(i,e).links)!==null&&t!==void 0?t:ui},of=(i,e)=>Re(i,e).columnSelectionValidator,sf=(i,e)=>Re(i,e).consoleSettings,af=(i,e)=>Re(i,e).connection,In=(i,e)=>Re(i,e).sessionWrapper,lf=(i,e)=>t=>t(Ot(i,{connection:e})),df=(i,e)=>t=>t(Ot(i,{sessionWrapper:e})),Us=(i,e)=>t=>t(Ot(i,{links:e})),hf=(i,e)=>(t,n)=>{var r=Bs(n(),i),o=e.filter(s=>r.findIndex(a=>pn(a.start,s.start)&&pn(a.end,s.end))<0);return t(Us(i,r.concat(o)))},uf=(i,e)=>(t,n)=>{var r=Bs(n(),i),o=r.filter(s=>!e.includes(s.id));return t(Us(i,o))},cf=(i,e)=>t=>t(Ot(i,{isolatedLinkerPanelId:e})),mf=(i,e)=>t=>t(Ot(i,{columnSelectionValidator:e})),cg=(i,e)=>t=>t(Ot(i,{consoleSettings:e})),gf=(i,e)=>t=>t(Ot(i,{filterSets:e}));function si(i,e,t){return e=mg(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function mg(i){var e=gg(i,"string");return typeof e=="symbol"?e:String(e)}function gg(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 zn=ee.module("CommandHistoryPanel");class Dn extends m.Component{static handleError(e){zn.error(e)}constructor(e){super(e),si(this,"container",void 0),si(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=le.createRef(),this.pending=new Qt;var{session:t,sessionId:n,language:r}=e;this.state={panelState:{},session:t,sessionId:n,language:r,contextActions:[{action:this.handleFocusHistory,shortcut:Me.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){var{glEventHub:e,session:t}=this.props;e.on(Ge.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(Ge.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(zn.debug("handleSendToNotebook",n,e),!n){zn.error("Session is not connected.");return}var{glEventHub:o}=this.props;o.emit(t?ae.CREATE_NOTEBOOK:ae.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;zn.debug("handleSendToConsole",e);var{glEventHub:r}=this.props;r.emit(Ge.SEND_COMMAND,e,t,n)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:n}=this.state;M(t),M(n),this.pending.add(e.getTable(t,n,Date.now()),r=>r.close()).then(r=>{this.setState({table:r})}).catch(Dn.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:n}=this.props,{language:r,contextActions:o,table:s}=this.state;return d.jsxs(xn,{className:"command-history-pane",componentPanel:this,glContainer:e,glEventHub:t,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[!s&&d.jsx("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),s&&r!=null&&d.jsxs(d.Fragment,{children:[d.jsx(Ch,{ref:this.container,language:r,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:s,commandHistoryStorage:n}),d.jsx(Z,{actions:o})]})]})}}si(Dn,"COMPONENT","CommandHistoryPanel");si(Dn,"TITLE","Command History");var vg=(i,e)=>{var t=ns(i),n=In(i,e.localDashboardId),{session:r,config:o}=n??{},{type:s,id:a}=o??{};return{commandHistoryStorage:t,language:s,session:r,sessionId:a}},fg=Sn(vg,null,null,{forwardRef:!0})(Dn);const pg=fg;function ao(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 lo(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ao(Object(t),!0).forEach(function(n){Gt(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):ao(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Gt(i,e,t){return e=bg(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function bg(i){var e=Cg(i,"string");return typeof e=="symbol"?e:String(e)}function Cg(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 Vn=ee.module("ConsolePanel"),yg=500,_g=Object.freeze({consoleSettings:{},itemIds:[]});class nr extends m.PureComponent{constructor(e){super(e),Gt(this,"consoleRef",void 0),Gt(this,"objectSubscriptionCleanup",void 0),Gt(this,"savePanelState",fn(()=>{var{consoleSettings:s,itemIds:a}=this.state,l={consoleSettings:s,itemIds:[...a]};Vn.debug("Saving panel state",l),this.setState({panelState:l})},yg)),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.consoleRef=le.createRef();var{panelState:t}=e,n=lo(lo({},_g),t||{}),{consoleSettings:r,itemIds:o}=n;this.state={consoleSettings:r,itemIds:new Map(o),objectMap:new Map,error:void 0,panelState:n}}componentDidMount(){var{glEventHub:e}=this.props;this.closeDisconnectedPanels(),e.on(re.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(re.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=>{Vn.debug("Got updates",n),this.setState(r=>{var{objectMap:o}=r,{updated:s,created:a,removed:l}=n,h=[...s,...l],u=new Map(o);h.forEach(g=>{var{title:v}=g;v!==void 0&&u.delete(v)});var c=[...s,...a];return c.forEach(g=>{g.title!==void 0&&u.set(g.title,g)}),{objectMap:u}})})}setItemId(e,t){this.setState(n=>{var{itemIds:r}=n,o=new Map(r);return o.set(e,t),{itemIds:o}})}getItemId(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{itemIds:n}=this.state,r=n.get(e);return r==null&&t&&(r=Kt.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:o}=this.state,s=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(s&&a){var l=new Set(o.values());l.has(a)&&this.setItemId(s,s)}}handleFocusCommandHistory(){var{glEventHub:e}=this.props;e.emit(Ge.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(re.CLOSE,n)}}handleSettingsChange(e){var{glEventHub:t}=this.props;Vn.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(Ge.SETTINGS_CHANGED,e)}openWidget(e,t){var{glEventHub:n}=this.props,{title:r}=e;M(r);var o=this.getItemId(r),s={fetch:()=>t.getObject(e),panelId:o,widget:e};Vn.debug("openWidget",s),n.emit(re.OPEN,s)}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 o=[...n.values()],{glEventHub:s}=this.props;o.forEach(a=>{s.emit(re.CLOSE,a)}),this.setState({itemIds:new Map})}}updateDimensions(){var e;(e=this.consoleRef.current)===null||e===void 0||e.updateDimensions()}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:n,sessionWrapper:r,timeZone:o,unzip:s}=this.props,{consoleSettings:a,error:l,objectMap:h}=this.state,{config:u,session:c,connection:g,details:v={},dh:f}=r,{workerName:p,processInfoId:C}=v,{id:_,type:T}=u;return d.jsx(xn,{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(Qd,{dh:f,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:Bo.LANGUAGE_MAP.get(T)}),p!=null&&d.jsxs(d.Fragment,{children:[d.jsx("div",{children:" • "}),p]}),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(Rh,{connection:g,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})}),d.jsx("div",{children:" "})]}),scope:_,timeZone:o,objectMap:h,unzip:s})})}}Gt(nr,"COMPONENT","ConsolePanel");Gt(nr,"TITLE","Console");var Sg=(i,e)=>({commandHistoryStorage:ns(i),sessionWrapper:In(i,e.localDashboardId),timeZone:Fh(i)}),wg=Sn(Sg,null,null,{forwardRef:!0})(nr);const Ti=wg;function Qe(i){return i.type==="directory"}var ct;(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=""})(ct||(ct={}));class Rt{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(!Rt.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 o=r?"".concat(r,"-copy"):"Copy";return n!==null?"".concat(o,".").concat(n):o}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return ct.GROOVY;case"py":return ct.PYTHON;case"pyc":return ct.PYTHON_COMPILED;case"scala":return ct.SCALA;case"txt":return ct.PLAIN_TEXT;default:return ct.UNKNOWN}}static getParent(e){if(!Rt.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(!Rt.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,o=Rt.fileExtensionToString(t);return"".concat(r).concat(o)}static validateName(e){var t=[".",".."],n=/[\\/\0]/g,r=new Map([["\0","null"]]);if(!e)throw new gn("Name cannot be empty");if(t.includes(e))throw new gn('"'.concat(e,'" is a reserved name'));if(n.test(e)){var o,s;throw new gn('Invalid characters in name: "'.concat((o=(s=e.match(n))===null||s===void 0?void 0:s.reduce((a,l)=>a.includes(l)?a:[...a,l],[]).map(a=>r.has(a)?r.get(a):a).join('", "'))!==null&&o!==void 0?o:"",'"'))}}static reducePaths(e){var t=e.filter(n=>Rt.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 A=Rt;var ir=26;function Bi(i){return Qe(i)?A.makePath(i.filename):A.getPath(i.filename)}function ho(i,e){if(i.length===0||e==null)throw new Error("No items to move");var t=Bi(e);if(i.some(n=>{var{filename:r}=n;return A.getPath(r)===t}))throw new Error("File already in the destination folder");if(i.some(n=>Qe(n)&&t.startsWith(A.makePath(n.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:i,targetPath:t}}function Eg(i){if(Qe(i))return i.isExpanded?pa:ba;var e=A.getMimeType(i.basename);switch(e){case ct.PYTHON:return ya;default:return Ca}}function Ui(i){var e,{children:t,draggedItems:n,isDragInProgress:r,isDropTargetValid:o,isSelected:s,item:a,itemIndex:l,dropTargetItem:h,onDragStart:u,onDragOver:c,onDragEnd:g,onDrop:v}=i,f=(e=n?.some(x=>x.id===a.id))!==null&&e!==void 0?e:!1,p=Bi(a),C=r&&h?Bi(h):null,_=r&&o&&Qe(a)&&C===p,T=r&&o&&C===p,w=r&&!o&&C===p,U=Eg(a),K=A.getDepth(a.filename),te=Array(K).fill(null).map((x,j)=>d.jsx("span",{className:"file-list-depth-line"},j));return d.jsxs("div",{className:de("d-flex w-100 align-items-center","file-list-item",{"is-dragged":f,"is-exact-drop-target":_,"is-in-drop-target":T,"is-invalid-drop-target":w,"is-selected":s}),onDragStart:function(x){function j(G){return x.apply(this,arguments)}return j.toString=function(){return x.toString()},j}(x=>u(l,x)),onDragOver:function(x){function j(G){return x.apply(this,arguments)}return j.toString=function(){return x.toString()},j}(x=>c(l,x)),onDragEnd:function(x){function j(G){return x.apply(this,arguments)}return j.toString=function(){return x.toString()},j}(x=>g(l,x)),onDrop:function(x){function j(G){return x.apply(this,arguments)}return j.toString=function(){return x.toString()},j}(x=>v(l,x)),draggable:!0,role:"presentation","aria-label":a.basename,children:[te," ",d.jsx(ge,{icon:U,className:"item-icon",fixedWidth:!0})," ",d.jsx("span",{className:"truncation-wrapper",children:t??d.jsxs(d.Fragment,{children:[a.basename,d.jsx(Ft,{children:a.basename})]})})]})}function uo(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 Kn(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?uo(Object(t),!0).forEach(function(n){Pg(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):uo(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Pg(i,e,t){return e=Tg(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Tg(i){var e=Og(i,"string");return typeof e=="symbol"?e:String(e)}function Og(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 xe=ee.module("FileList"),xg=500,co="item-list-scroll-pane";function Ig(i){var{isMultiSelect:e=!1,table:t,onFocusChange:n=()=>{},onMove:r,onSelect:o,onSelectionChange:s=()=>{},renderItem:a=Ui,rowHeight:l=ir,overscanCount:h=xi.DEFAULT_OVERSCAN}=i,[u,c]=m.useState(()=>({items:[],offset:0,itemCount:0})),[g,v]=m.useState({top:0,bottom:0}),[f,p]=m.useState(),[C,_]=m.useState(),[T,w]=m.useState(),[U,K]=m.useState([]),te=m.useRef(),x=m.useRef(null),j=m.useRef(null),G=m.useCallback(E=>{if(E.length===0||u==null)return[];for(var W=[],q=0;q<E.length;q+=1)for(var ie=E[q],pe=ie[0];pe<=ie[1];pe+=1)pe>=u.offset&&pe<u.offset+u.items.length&&W.push(u.items[pe-u.offset]);return W},[u]),ne=m.useCallback(E=>{var W=G([[E,E]]);if(W.length>0)return W[0]},[G]),oe=m.useCallback(()=>{var E=dr.count(U);if(E===0)return null;if(E===1){var W=U[0][0],q=ne(W);if(q!=null)return q.filename}return"".concat(E," items")},[ne,U]),$=m.useCallback(E=>{if(!(!C||!f)){xe.debug("dropItems",C,"to",E);try{var{files:W,targetPath:q}=ho(C,f);if(r?.(W,q),E!=null){var ie;K([[E,E]]),(ie=x.current)===null||ie===void 0||ie.focusItem(E)}}catch(pe){xe.error("Unable to complete move",pe)}}},[C,f,r]),k=m.useCallback((E,W)=>{var q=u.items[E-u.offset];q!==void 0&&(xe.debug("handleItemClick",q),o(q,W),Qe(q)&&t?.setExpanded(q.filename,!q.isExpanded))},[u,o,t]),F=m.useCallback((E,W)=>{var q;xe.debug2("handleItemDragStart",E,U);var ie=U;dr.isSelected(U,E)||(ie=[[E,E]],K(ie)),_(G(ie)),(q=x.current)===null||q===void 0||q.resetMouseState();var pe=document.createElement("div");pe.innerHTML='<div class="dnd-placeholder-content">'.concat(oe(),"</div>"),pe.className="file-list-dnd-placeholder",document.body.appendChild(pe),W.dataTransfer.setDragImage(pe,0,0),W.dataTransfer.effectAllowed="move",w(pe)},[oe,G,U]),N=m.useCallback((E,W)=>{W.preventDefault(),xe.debug2("handleItemDragOver",W),p(ne(E))},[ne]),L=m.useCallback((E,W)=>{xe.debug("handleItemDragEnd",E),T?.remove(),_(void 0),p(void 0),w(void 0)},[T]),H=m.useCallback((E,W)=>{$(E)},[$]),fe=m.useCallback(()=>{xe.debug2("handleItemDragExit"),p(void 0)},[]),He=m.useCallback(E=>{E.target instanceof Element&&E.target.classList.contains(co)&&(E.preventDefault(),xe.debug2("handleListDragOver",E),p({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),Be=m.useCallback(E=>{E.target instanceof Element&&E.target.classList.contains(co)&&(xe.debug("handleListDrop"),$())},[$]),y=m.useCallback(function(E){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(xe.debug2("handleSelectionChange",E),W===!0||E!==U){K(E);var q=G(E);s(q)}},[G,s,U]),b=m.useCallback(E=>{if(xe.debug2("handleFocusChange",E),E!=null){var[W]=G([[E,E]]);n(W)}else n();te.current=E},[G,n]),S=m.useCallback((E,W)=>{xe.debug("handleViewportChange",E,W),(E!==g.top||W!==g.bottom)&&v({top:E,bottom:W})},[g]),P=m.useMemo(()=>{if(!C||!f)return!1;try{return ho(C,f),xe.debug("handleValidateDropTarget true"),!0}catch{return xe.debug("handleValidateDropTarget false"),!1}},[C,f]),{focusedPath:V}=i;m.useEffect(()=>{V!==void 0&&(V==="/"?t.collapseAll():(t.setExpanded(V,!1),t.setExpanded(V,!0)))},[t,V]),m.useEffect(function(){xe.debug("updating table viewport",g),t?.setViewport({top:Math.max(0,g.top-h),bottom:g.bottom+h})},[h,t,g]),m.useEffect(function(){var W=t.onUpdate(q=>{c({items:q.items.map(ie=>Kn(Kn({},ie),{},{itemName:ie.basename})),offset:q.offset,itemCount:t.size})});return()=>{W()}},[t]),m.useEffect(function(){te.current!=null&&b(te.current),U.length>0&&y(U,!0)},[u,b,y,U]),m.useEffect(function(){if(f!=null&&Qe(f)&&f.filename!=="/"){var W=setTimeout(()=>{f.isExpanded||t?.setExpanded(f.filename,!0)},xg);return()=>clearTimeout(W)}},[f,t]);var Ye=m.useCallback(E=>a(Kn(Kn({},E),{},{isDragInProgress:C!=null,dropTargetItem:f,draggedItems:C,isDropTargetValid:P,onDragStart:F,onDragEnd:L,onDragOver:N,onDragExit:fe,onDrop:H})),[L,fe,N,F,H,C,f,P,a]);return d.jsx("div",{ref:j,className:de("file-list",{"is-dragging":C!=null}),onDragOver:He,onDrop:Be,children:d.jsx(xi,{ref:x,items:u.items,itemCount:u.itemCount,offset:u.offset,onFocusChange:b,onSelect:k,onSelectionChange:y,onViewportChange:S,selectedRanges:U,renderItem:Ye,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var Dg={name:"File Explorer",DELETE:ue.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[B.DELETE],macShortcut:[R.CMD,B.BACKSPACE]}),RENAME:ue.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[B.ENTER],macShortcut:[B.ENTER]})};const mo={FILE_EXPLORER:Dg};var go=ee.module("FileListItemEditor"),Mg=()=>Promise.resolve();function Ng(i){var{item:e,onCancel:t,onSubmit:n,validate:r=Mg}=i,o=m.useRef(null),[s,a]=m.useState(e.basename),[l,h]=m.useState(),[u,c]=m.useState(Promise.resolve()),g=m.useCallback(()=>{var T;(T=o.current)===null||T===void 0||T.focus()},[o]),v=m.useCallback(T=>T.stopPropagation(),[]),f=m.useCallback(()=>{u.then(()=>{n(s)}).catch(T=>go.info("Unable to validate name",T))},[n,s,u]);m.useEffect(function(){var w=Se.makeCancelable(r(s));return w.then(()=>h(void 0)).catch(U=>{Se.isCanceled(U)||h(U)}),c(w),()=>w.cancel()},[r,s]),m.useEffect(function(){g()},[g]);var p=m.useCallback(()=>{go.debug2("handleBlur"),f()},[f]),C=m.useCallback(T=>{var{value:w}=T.target;a(w)},[]),_=m.useCallback(T=>{T.stopPropagation();var{key:w}=T;switch(w){case"Enter":{f();break}case"Escape":{t();break}}},[t,f]);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:s,ref:o,onBlur:p,onKeyDown:_,onChange:C,onClick:v,onDoubleClick:v,onMouseDown:v}),l&&d.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}function vo(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 Oi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vo(Object(t),!0).forEach(function(n){Lg(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):vo(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Lg(i,e,t){return e=Rg(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Rg(i){var e=Ag(i,"string");return typeof e=="symbol"?e:String(e)}function Ag(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 Ws(i){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:n=!1,onCreateFile:r,onCreateFolder:o,onCopy:s,onDelete:a,onMove:l,onRename:h,onSelect:u,onSelectionChange:c,table:g,rowHeight:v=ir,validateRename:f=()=>Promise.resolve()}=i,[p,C]=m.useState(),[_,T]=m.useState([]),[w,U]=m.useState(),K=m.useCallback(H=>{T(H),c?.(H)},[c]),te=m.useCallback(H=>{U(H)},[]),x=m.useCallback(()=>{w&&s?.(w)},[w,s]),j=m.useCallback(()=>{_.length>0&&a?.(_)},[a,_]),G=m.useCallback(()=>{r?.()},[r]),ne=m.useCallback(()=>{w&&o?.(A.getPath(w.filename))},[w,o]),oe=m.useCallback(()=>{w&&C(w)},[w]),$=m.useCallback(()=>{C(void 0)},[]),k=m.useCallback(H=>{p&&(h?.(p,H),C(void 0))},[h,p]),F=m.useMemo(()=>{if(p)return[];var H=[];return r&&H.push({title:"New File",description:"Create new file",action:G,group:Z.groups.medium}),o&&H.push({title:"New Folder",description:"Create new folder",action:ne,group:Z.groups.medium}),s&&H.push({title:"Copy File",description:"Copy the selected file",action:x,group:Z.groups.low,disabled:w==null||Qe(w)}),a&&_.length>0&&H.push({title:"Delete",description:"Delete",shortcut:mo.FILE_EXPLORER.DELETE,action:j,group:Z.groups.low}),h&&H.push({title:"Rename",description:"Rename",shortcut:mo.FILE_EXPLORER.RENAME,action:oe,group:Z.groups.low,disabled:w==null}),H},[x,j,G,ne,oe,w,s,r,o,a,h,_,p]),N=m.useCallback(H=>(M(p),f(p,H)),[p,f]),L=m.useCallback(H=>{var{item:fe}=H;return p&&p.filename===fe.filename?d.jsx(Ui,Oi(Oi({},H),{},{children:d.jsx(Ng,{item:fe,validate:N,onSubmit:k,onCancel:$})})):d.jsx(Ui,Oi({},H))},[$,k,p,N]);return d.jsxs("div",{className:"file-list-container",children:[g!=null&&d.jsx(Ig,{onMove:l,onSelect:u,onSelectionChange:K,onFocusChange:te,renderItem:L,rowHeight:v,table:g,isMultiSelect:e,focusedPath:t}),n&&d.jsx(Z,{actions:F})]})}Ws.displayName="FileListContainer";function fo(i,e,t){return e=kg(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function kg(i){var e=Fg(i,"string");return typeof e=="symbol"?e:String(e)}function Fg(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 jg extends gn{constructor(e){super("Name already exists"),fo(this,"isExistingFile",!0),fo(this,"info",void 0),this.info=e}}const qn=jg;function $g(i,e,t){return e=Hg(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Hg(i){var e=Bg(i,"string");return typeof e=="symbol"?e:String(e)}function Bg(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 Ug extends Error{constructor(){super("No file exists at the path specified"),$g(this,"isFileNotFound",!0)}}const zs=Ug;function po(i,e,t,n,r,o,s){try{var a=i[o](s),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(n,r)}function bo(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var o=i.apply(e,t);function s(l){po(o,n,r,s,a,"next",l)}function a(l){po(o,n,r,s,a,"throw",l)}s(void 0)})}}var tt=ee.module("FileExplorer");function rr(i){var{storage:e,isMultiSelect:t=!1,focusedPath:n,onCopy:r=()=>{},onDelete:o=()=>{},onRename:s=()=>{},onCreateFile:a=()=>{},onCreateFolder:l=()=>{},onSelect:h,onSelectionChange:u,rowHeight:c=ir}=i,[g,v]=m.useState([]),[f,p]=m.useState();m.useEffect(function(){var k;function F(){return N.apply(this,arguments)}function N(){return N=bo(function*(){tt.debug("initTable"),k=Se.makeCancelable(e.getTable(),L=>L.close());try{p(yield k)}catch(L){Se.isCanceled(L)||tt.error("Unable to initialize table",L)}}),N.apply(this,arguments)}return F(),()=>{k.cancel()}},[e]);var C=m.useCallback($=>{Se.isCanceled($)||tt.error($)},[]),_=m.useCallback(()=>{tt.debug("handleCreateFile"),a()},[a]),T=m.useCallback(()=>{tt.debug("handleCreateFolder"),l()},[l]),w=m.useCallback($=>{tt.debug("handleCopyFile",$.filename),r($)},[r]),U=m.useCallback($=>{tt.debug("handleDelete, pending confirmation",$),v($)},[]),K=m.useCallback(()=>{tt.debug("handleDeleteConfirm",g),g.forEach($=>e.deleteFile(Qe($)?A.makePath($.filename):$.filename)),o(g),v([])},[g,o,e]),te=m.useCallback(()=>{tt.debug("handleDeleteCancel"),v([])},[]),x=m.useCallback(($,k)=>{var F=A.reducePaths($.map(N=>Qe(N)?A.makePath(N.filename):N.filename));F.forEach(N=>{var L=A.isPath(N)?"".concat(k).concat(A.getBaseName(N.substring(0,N.length-1)),"/"):"".concat(k).concat(A.getBaseName(N));e.moveFile(N,L).then(()=>{s(N,L)}).catch(C)})},[C,s,e]),j=m.useCallback(($,k)=>{var F=$.filename,N=Qe($);N&&!F.endsWith("/")&&(F="".concat(F,"/"));var L="".concat(A.getParent(F)).concat(k);N&&!L.endsWith("/")&&(L="".concat(L,"/")),tt.debug2("handleRename",F,L),e.moveFile(F,L).catch(C),s(F,L)},[C,s,e]),G=m.useCallback(function(){var $=bo(function*(k,F){if(F!==k.basename){A.validateName(F);var N="".concat(A.getPath(k.filename)).concat(F);try{var L=yield e.info(N);throw new qn(L)}catch(H){if(!(H instanceof zs))throw H}}});return function(k,F){return $.apply(this,arguments)}}(),[e]),ne=g.length>0,oe=m.useMemo(()=>g.length===1?'Are you sure you want to delete "'.concat(g[0].filename,'"?'):"Are you sure you want to delete the selected files?",[g]);return d.jsxs("div",{className:"file-explorer",children:[f&&d.jsx(Ws,{isMultiSelect:t,focusedPath:n,showContextMenu:!0,onCopy:w,onCreateFolder:T,onCreateFile:_,onMove:x,onDelete:U,onRename:j,onSelect:h,onSelectionChange:u,rowHeight:c,table:f,validateRename:G}),d.jsx(bn,{isOpen:ne,headerText:oe,bodyText:"You cannot undo this action.",onCancel:te,onConfirm:K,confirmButtonText:"Delete"})]})}rr.displayName="FileExplorer";function Co(i,e,t,n,r,o,s){try{var a=i[o](s),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(n,r)}function Wg(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var o=i.apply(e,t);function s(l){Co(o,n,r,s,a,"next",l)}function a(l){Co(o,n,r,s,a,"throw",l)}s(void 0)})}}function St(i,e,t){return e=zg(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function zg(i){var e=Vg(i,"string");return typeof e=="symbol"?e:String(e)}function Vg(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 Dt=ee.module("NewItemModal");class kt extends m.PureComponent{static getValidationMessage(e){return e instanceof qn&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){Se.isCanceled(e)||Dt.error(e)}constructor(e){super(e),St(this,"inputRef",le.createRef()),St(this,"cancelableValidatePromise",void 0),St(this,"cancelableExistingItemPromise",void 0),St(this,"pending",new Qt),St(this,"pathMap",new Map),St(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=A.hasPath(t)?A.getPath(t):"/";this.state={isSubmitting:!1,path:n,prevExtension:A.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:A.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:n}=this.props,{isOpen:r}=e,{value:o,path:s}=this.state;!r&&n&&(this.resetValue(),this.isInitialLoad=!0),r&&n&&(!this.isInitialLoad&&(s!==t.path||o!==t.value)&&this.updateValidationStatus(s,o),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){var{defaultValue:e}=this.props,t=A.hasPath(e)?A.getPath(e):"/";this.setState({path:t,value:A.getBaseName(e),validationError:void 0,prevExtension:A.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=Se.makeCancelable(this.validateName(e,t,n)),this.cancelableValidatePromise}validateName(e,t,n){var r=this;return Wg(function*(){A.validateName(t);var{defaultValue:o,storage:s}=r.props;if(n){var a="".concat(e).concat(t);if(a!==o)try{var l=yield s.info(a);throw new qn(l)}catch(h){if(!(h instanceof zs))throw h}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(kt.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var{value:t}=e.target;this.setState({value:t})}handleSelect(e){if(Dt.debug("handleSelect",e),e.type==="directory")this.setState({path:A.makePath(e.filename)});else{var t=e.basename,n=A.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 gn))throw e;Dt.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;Dt.debug("handleOverwriteConfirm",t,n),e("".concat(t).concat(n),!0)}handleExtensionChangeCancel(){Dt.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:n}=e,r=A.replaceExtension(t,n);return{showExtensionChangeModal:!1,value:r}}),this.submitModal(!0)}handleExtensionChangeConfirm(){Dt.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:o}=t,{notifyOnExtensionChange:s,type:a}=this.props;Dt.debug("submitModal",n,r);var l=A.getExtension(r);return s&&!e&&n!==null&&n!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(o,r,!0).then(h=>{var{onSubmit:u}=this.props;u("".concat(o).concat(r))}).catch(h=>{if(h instanceof qn&&a!=="directory"&&h.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw h}).catch(h=>{throw Se.isCanceled(h)&&this.setState({isSubmitting:!1}),h}).catch(this.handleValidationError).catch(kt.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 o="",s=0;s<r;s+=1)o+="".concat(t[s],"/");return o+="".concat(n,"/"),d.jsxs(le.Fragment,{children:[d.jsx(se,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(o),"aria-label":r===0?"Home":void 0,icon:r===0?d.jsx(ge,{icon:_a,transform:"right-1.6"}):void 0,tooltip:r===0?"Home":void 0,children:n}),"/"]},o)})}render(){var{storage:e,isOpen:t,onCancel:n,placeholder:r,title:o,type:s}=this.props,{isSubmitting:a,path:l,showExtensionChangeModal:h,showOverwriteModal:u,validationError:c,value:g,prevExtension:v,newExtension:f}=this.state,p=s==="directory",C=A.fileExtensionToString(v),_=A.fileExtensionToString(f),T=p?"Create":"Save",w=p?"New folder name":"Save file as";return d.jsxs(d.Fragment,{children:[d.jsxs(Sa,{isOpen:t,toggle:n,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal theme-bg-dark",children:[d.jsx(wa,{toggle:n,children:o}),d.jsx(Ea,{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:w}),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:g,placeholder:r,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),c&&d.jsx("div",{className:"invalid-feedback",children:kt.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(rr,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),d.jsxs(Ha,{children:[d.jsx(se,{kind:"secondary",onClick:n,children:"Cancel"}),d.jsx(se,{kind:"primary",disabled:a,onClick:this.handleModalSubmit,children:T})]})]}),d.jsx(bn,{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(bn,{isOpen:h,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(C,'" to "').concat(_,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(C,'"'),confirmButtonText:'Use "'.concat(_,'"')})]})}}St(kt,"propTypes",{isOpen:z.bool,title:z.string.isRequired,defaultValue:z.string,type:z.oneOf(["file","directory"]).isRequired,onSubmit:z.func,onCancel:z.func,placeholder:z.string,storage:z.shape({}).isRequired,notifyOnExtensionChange:z.bool});St(kt,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(i,e)=>{},onCancel:()=>{}});const Vs=kt;function Kg(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(se,{kind:"ghost",icon:ko,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),d.jsx(se,{kind:"ghost",icon:Pa,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),n&&d.jsx("div",{className:"file-explorer-toolbar-search",children:d.jsx(Ba,{value:r,onChange:n,placeholder:"Search by name"})})]})}function yo(i,e,t,n,r,o,s){try{var a=i[o](s),l=a.value}catch(h){t(h);return}a.done?e(l):Promise.resolve(l).then(n,r)}function _o(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var o=i.apply(e,t);function s(l){yo(o,n,r,s,a,"next",l)}function a(l){yo(o,n,r,s,a,"throw",l)}s(void 0)})}}function Ks(i,e,t){return e=Gg(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Gg(i){var e=qg(i,"string");return typeof e=="symbol"?e:String(e)}function qg(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=ee.module("FileExplorerPanel"),Yg=(i,e)=>{var t=is(i),n=In(i,e.localDashboardId),{session:r,config:o}=n??{},s=o?.type;return{fileStorage:t,language:s,session:r}},Xg=Sn(Yg,null,null,{forwardRef:!0});function Zg(i){var e=i;return e!=null&&typeof e.button=="number"}class Xt extends le.Component{static handleError(e){Mt.error(e)}static isFocusEvent(e){return Zg(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:""};Mt.debug("handleCreateFile",t,n,r),e.emit(ae.CREATE_NOTEBOOK,t,n,r)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){Mt.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){Mt.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(Xt.handleError)}handleCopyFile(e){var t=this;return _o(function*(){var{fileStorage:n}=t.props;if(Qe(e)){Mt.error("Invalid item in handleCopyItem",e);return}for(var r=A.getCopyFileName(e.filename),o=function(){var s=_o(function*(){try{return yield n.info(r),!0}catch{return!1}});return function(){return s.apply(this,arguments)}}();yield o();)r=A.getCopyFileName(r);yield n.copyFile(e.filename,r)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(n=>{t.emit(ae.CLOSE_FILE,{id:n.filename,itemName:n.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=A.makePath(e[0].filename):t=A.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(Mt.debug("fileSelect",e),e.type!=="directory"){var n=Xt.isFocusEvent(t),r={id:e.filename,itemName:e.filename},{glEventHub:o}=this.props,{session:s,language:a}=this.state,l={value:null,language:a};o.emit(ae.SELECT_NOTEBOOK,s,a,l,r,n)}}handleRename(e,t){var{glEventHub:n}=this.props;Mt.debug("handleRename",e,t),n.emit(ae.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:o,focusedFilePath:s}=this.state;return d.jsxs(xn,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:n,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[d.jsx(Kg,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),r&&d.jsx(rr,{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(Vs,{isOpen:o,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:s})]})}}Ks(Xt,"COMPONENT","FileExplorerPanel");Ks(Xt,"TITLE","File Explorer");var Qg=Xg(Xt);const Jg=Qg;function _n(i,e,t){return e=ev(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ev(i){var e=tv(i,"string");return typeof e=="symbol"?e:String(e)}function tv(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 So=ee.module("LogPanel");class ci extends m.PureComponent{constructor(e){super(e),_n(this,"isBottomVisible",void 0),_n(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){So.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){So.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(xn,{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(Eh,{session:n,ref:r=>{this.logView=r}})]})}}_n(ci,"defaultProps",{session:null});_n(ci,"COMPONENT","LogPanel");_n(ci,"TITLE","Log");var nv=(i,e)=>{var t;return{session:(t=In(i,e.localDashboardId))===null||t===void 0?void 0:t.session}},iv=Sn(nv,null,null,{forwardRef:!0})(ci);const rv=iv;function Yn(i,e,t){return e=ov(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ov(i){var e=sv(i,"string");return typeof e=="symbol"?e:String(e)}function sv(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 Gs extends m.PureComponent{constructor(e){super(e),Yn(this,"commands",void 0),Yn(this,"codeElements",void 0),Yn(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=le.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,o=[...this.commands.keys()],s=o.findIndex(p=>p===r||r==null);if(!(s<0)){var a=o[s],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 g,{offsetTop:v}=c,f=v;(g=this.editorScrollView.current)===null||g===void 0||g.scroll({top:f,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:o}=e,{hasRunCode:s,nextStartLine:a}=this.state,{children:l,position:h}=o;M(h);var{start:u}=h,{line:c}=u,g=l[0].value,v=le.createRef(),f=this.commands.size===0,p=a===c||f&&a==null&&!s,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,g),this.codeElements.set(c,v),d.jsxs("div",{className:de("markdown-notebook-code-block",{"is-selected":p}),ref:v,onClick:()=>{this.setState({nextStartLine:c})},role:"presentation",children:[d.jsx(se,{kind:"ghost",icon:Xn,className:"btn-play-block",onClick:_=>{_.stopPropagation(),_.preventDefault(),this.runCode(g),this.setState({nextStartLine:c})},tooltip:"Run code"}),d.jsx("code",{children:d.jsx(Ki,{language:C,children:le.Children.map(t,_=>typeof _=="string"?_.trim():_)})})]}))}renderLink(e){var{onLinkClick:t}=this.props,{href:n,children:r,target:o}=e;return d.jsx("a",{href:n,onClick:t,target:o,children:r})}render(){var{content:e,transformImageUri:t,transformLinkUri:n}=this.props,{hasCode:r,hasRunCode:o,nextStartLine:s}=this.state;return d.jsxs("div",{className:"markdown-notebook",children:[d.jsx("div",{className:"markdown-notebook-toolbar",children:d.jsx(se,{className:de("btn-play-selected-cell",{flashing:r&&!o}),kind:"ghost",icon:Xn,onClick:this.handleRunSelected,tooltip:"Run code and select next",disabled:o&&s==null||!r,children:"Run Selected Code"})}),d.jsx("div",{className:"markdown-notebook-content",ref:this.editorScrollView,children:d.jsx(na,{components:{code:this.renderCodeBlock,a:this.renderLink},linkTarget:"_blank",remarkPlugins:[ia],transformLinkUri:n,transformImageUri:t,includeElementIndex:!0,children:e})})]})}}Yn(Gs,"defaultProps",{onRunCode:()=>{}});const av=Gs;function wo(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 Ee(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wo(Object(t),!0).forEach(function(n){Oe(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):wo(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Oe(i,e,t){return e=lv(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function lv(i){var e=dv(i,"string");return typeof e=="symbol"?e:String(e)}function dv(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 Y=ee.module("NotebookPanel"),Eo=400;class Ce extends m.Component{static handleError(e){Se.isCanceled(e)||Y.error(e)}static unsavedNotebookCount(){return document.querySelectorAll(".".concat(Ce.UNSAVED_INDICATOR_CLASS_NAME,".").concat(Ce.UNSAVED_STATUS_CLASS_NAME)).length}static languageFromFileName(e){var t=A.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),Oe(this,"pending",void 0),Oe(this,"debouncedSavePanelState",void 0),Oe(this,"debouncedLoad",void 0),Oe(this,"notebook",void 0),Oe(this,"tabTitleElement",void 0),Oe(this,"tabInitOnce",void 0),Oe(this,"editor",void 0),Oe(this,"getSettings",st((g,v)=>Ee(Ee({},g),{},{minimap:{enabled:v}}))),Oe(this,"getOverflowActions",st((g,v)=>[{title:"Find",icon:xa,action:this.handleFind,group:Z.groups.high,shortcut:Me.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:Ia,action:this.handleCopy,group:Z.groups.medium,order:20},{title:"Rename File",icon:Da,action:this.handleShowRename,group:Z.groups.medium,order:30},{title:"Delete File",icon:Lo,action:this.handleDelete,group:Z.groups.medium,order:40},{title:"Show Minimap",icon:g?cn:void 0,action:this.handleMinimapChange,group:Z.groups.low,shortcut:Me.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:v?cn:void 0,action:this.handleWordWrapChange,group:Z.groups.low,shortcut:Me.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 Qt,this.debouncedSavePanelState=fn(this.savePanelState.bind(this),Eo),this.debouncedLoad=fn(this.load.bind(this),Eo),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;var{isDashboardActive:t,session:n,sessionLanguage:r,panelState:o}=e,s={value:"",language:"",wordWrap:"off"},a=null,{isPreview:l}=e;o!=null&&({fileMetadata:a=a,isPreview:l=l,settings:s=s}=o);var h=a!=null&&A.hasPath(a.itemName),u=h===!0&&s.value!=null||!h&&s.value!=null&&s.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:s,session:n,sessionLanguage:r,panelState:{fileMetadata:a,settings:s},showCloseModal:!1,showDeleteModal:!1,showSaveAsModal:!1,scriptCode:""},Y.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(ae.RENAME_FILE,this.handleRenameFile),t.on(re.DROPPED,this.handlePanelDropped),e.on(ae.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion)}componentDidUpdate(e,t){var{isPreview:n,settings:r}=this.state,{wordWrap:o}=r,{defaultNotebookSettings:s}=this.props;n!==t.isPreview&&this.setPreviewStatus(),o!==t.settings.wordWrap&&(this.updateEditorWordWrap(),this.debouncedSavePanelState()),s.isMinimapEnabled!==e.defaultNotebookSettings.isMinimapEnabled&&this.updateEditorMinimap()}componentWillUnmount(){this.debouncedSavePanelState.flush(),this.pending.cancel();var{glEventHub:e,glContainer:t}=this.props,{fileMetadata:n,isPreview:r}=this.state;e.off(ae.RENAME_FILE,this.handleRenameFile),e.off(re.DROPPED,this.handlePanelDropped),t.off(ae.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion),e.emit(ae.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);M(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 o=this.notebook.getValue();return o??r}return r}initNotebookContent(){var{fileMetadata:e,settings:t,isPreview:n}=this.state;if(e&&e.id){Y.debug("Init content from file"),this.registerFileMetadata(e,n),this.load();return}if(t.value!=null){Y.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(ae.CLOSE_FILE,{id:e})}registerFileMetadata(e,t){var{glEventHub:n,metadata:r}=this.props,{id:o}=r;n.emit(ae.REGISTER_FILE,o,e,t)}renameTab(e,t){var{glEventHub:n}=this.props;n.emit(ae.RENAME,e,t)}load(){var{fileMetadata:e,settings:t}=this.state;M(e);var{id:n}=e,{fileStorage:r}=this.props;this.pending.add(r.loadFile(n)).then(o=>{var s;Y.debug("Loaded file",o);var{filename:a}=o,{itemName:l}=this.state;if(a!==l){var{metadata:h}=this.props,{id:u}=h;this.renameTab(u,A.getBaseName(a))}var c=Ee(Ee({},t),{},{language:(s=Ce.languageFromFileName(a))!==null&&s!==void 0?s:""});t.value==null&&(c.value=o.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&&A.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){Y.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;Y.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:o,settings:s}=e,a=this.getNotebookValue(),l=t!==n?a:void 0,h=Ee(Ee({},s),{},{value:a}),u=Ee(Ee({},s),{},{value:l}),c={settings:u,fileMetadata:r,isPreview:o};return Y.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(ae.CLOSE_FILE,{id:e,itemName:e},{force:!0}),this.focus()}handleCopy(){var{fileMetadata:e,settings:t}=this.state;M(e);var n=this.getNotebookValue(),{language:r}=t,{itemName:o}=e,s=A.getCopyFileName(o);Y.debug("handleCopy",e,o,s),this.createNotebook(s,r,n)}handleDelete(){Y.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var{fileStorage:e,glContainer:t,glEventHub:n}=this.props,{fileMetadata:r}=this.state;Y.debug("handleDeleteConfirm",r?.itemName),this.setState({showDeleteModal:!1}),r&&(A.hasPath(r.itemName)?(n.emit(ae.CLOSE_FILE,r,{force:!0}),e.deleteFile(r.itemName)):t.close({force:!0}))}handleDeleteCancel(){this.setState({showDeleteModal:!1})}handleEditorInitialized(e){this.editor=e}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(e){Y.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(t=>{var{changeCount:n,savedChangeCount:r}=t,{isUndoing:o,isRedoing:s}=e;return o?{changeCount:n-1,savedChangeCount:r}:!s&&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=Ee(Ee({},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:Ee(Ee({},t),{},{wordWrap:n})}})}handleBlur(){Y.debug("handleBlur"),this.setState({isFocused:!1})}handleFocus(){Y.debug("handleFocus"),this.setState({isFocused:!0})}handleLinkClick(e){var{notebooksUrl:t,session:n,sessionLanguage:r}=this.props,{href:o}=e.currentTarget;if(!(!o||!o.startsWith(t))){e.stopPropagation(),e.preventDefault();var s="/".concat(o.substring(t.length)).replace(/%20/g," ");if(s==="/"){Y.debug("Ignoring invalid notebook link",s);return}Y.debug("Notebook link clicked, opening",s);var{glEventHub:a}=this.props,l={value:null,language:r},h={id:s,itemName:s};a.emit(ae.SELECT_NOTEBOOK,n,r,l,h)}}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(e){var t=e;Se.isCanceled(t)||(Se.isTimedOut(t)&&(t=new Error("File not found.")),Y.error(t),this.setState({error:t,isLoading:!1}))}handleSave(){Y.debug("handleSave"),this.save()}handleSaveSuccess(e){var t,{fileStorage:n}=this.props,r={id:e.filename,itemName:e.filename},o=(t=Ce.languageFromFileName(e.filename))!==null&&t!==void 0?t:"";this.setState(s=>{var{fileMetadata:a}=s,l=Ee(Ee({},s.settings),{},{language:o});return Y.debug("handleSaveSuccess",r,a,l),a&&A.hasPath(a.itemName)&&a.itemName!==r.itemName&&(Y.debug("handleSaveSuccess deleting old file",a.itemName),n.deleteFile(a.itemName).catch(Ce.handleError)),{fileMetadata:r,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(r,!1)}handleSaveError(e){Se.isCanceled(e)||(this.setState({savedChangeCount:0}),Y.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),Y.debug("handleSaveAsSubmit",e);var{fileMetadata:r}=this.state;if(r){var{itemName:o}=r,s=(t=this.getNotebookValue())!==null&&t!==void 0?t:"";if(this.setState({showSaveAsModal:!1}),A.getBaseName(o)!==A.getBaseName(e)){var{metadata:a}=this.props,{id:l}=a;this.renameTab(l,A.getBaseName(e))}this.saveContent(e,s)}}handleRenameFile(e,t,n){var{fileMetadata:r,panelState:o}=this.state,{glContainer:s}=this.props;if(r?.itemName==="/".concat(t)&&n&&JSON.stringify(o)!==JSON.stringify(n)){s.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){Y.error("Editor is not initialized.");return}this.runCommand((e=this.notebook.getValue())!==null&&e!==void 0?e:void 0)}handleRunSelected(){if(!this.notebook){Y.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;Y.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){Y.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];Y.debug("handleTabFocus",...t);var{glContainer:r}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!r.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){Y.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handleTabClick(e){Y.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 o=new URL(r,t);return new URL(e,o).href}focus(){requestAnimationFrame(()=>{this.notebook&&this.notebook.focus()})}createNotebook(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{glEventHub:r}=this.props,{session:o,sessionLanguage:s,settings:a}=this.state,l=Ee(Ee({},a),{},{language:t,value:n}),h={id:null,itemName:e};Y.debug("handleCreateNotebook",o,s,l,h),r.emit(ae.CREATE_NOTEBOOK,o,s,l,h)}runCommand(e){if(e===void 0||e===""){Y.debug("Ignoring empty command.");return}this.removePreviewStatus();var{glEventHub:t}=this.props;t.emit(Ge.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:o},glEventHub:s,defaultNotebookSettings:a}=this.props,{changeCount:l,savedChangeCount:h,error:u,isDashboardActive:c,isLoaded:g,isLoading:v,isPreview:f,fileMetadata:p,session:C,sessionLanguage:_,settings:T,showCloseModal:w,showDeleteModal:U,showSaveAsModal:K}=this.state,te=c&&!r.isHidden&&!f,x=(e=p?.itemName)!==null&&e!==void 0?e:Ce.DEFAULT_NAME,j=x.endsWith(".md"),G=p?.id!=null,ne=this.getSettings(T,a.isMinimapEnabled),oe=C!=null,$=_===ne.language,k=!g||!oe||!$,F=!g,N=[{action:this.handleSave,shortcut:Zn.SAVE},{action:this.handleMinimapChange,shortcut:Me.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:Me.NOTEBOOK.WORDWRAP}],L=Ni.getDisabledRunTooltip(oe,$,"Notebook extension","Run"),H=Ni.getDisabledRunTooltip(oe,$,"Notebook extension","Run Selected"),fe=[{title:G?"Rename":"Save As…",order:10,group:Z.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:Z.groups.high,order:20}],He=o?.element.find(".lm_title_before").get(0);return d.jsxs(d.Fragment,{children:[He!=null&&zi.createPortal(d.jsx("span",{className:de(Ce.UNSAVED_INDICATOR_CLASS_NAME,{[Ce.UNSAVED_STATUS_CLASS_NAME]:l!==h})}),He),d.jsxs(xn,{className:"notebook-container",componentPanel:this,glContainer:r,glEventHub:s,onTab:this.handleTab,onResize:this.handleResize,onShow:this.handleShow,onTabClicked:this.handleTabClick,onTabFocus:this.handleTabFocus,onTabBlur:this.handleTabBlur,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onFocus:this.handleFocus,onBlur:this.handleBlur,additionalActions:fe,renderTabTooltip:()=>x,children:[!j&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"notebook-toolbar",children:[d.jsxs("span",{children:[d.jsx(se,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:k,icon:d.jsx(ge,{icon:Xn,transform:"grow-4"}),tooltip:"Run ".concat(Me.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),L!=null&&d.jsx(Ft,{children:L})]}),d.jsxs("span",{children:[d.jsx(se,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:k,icon:d.jsx(ge,{icon:Ta,transform:"grow-4"}),tooltip:"Run Selected ".concat(Me.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),H!=null&&d.jsx(Ft,{children:H})]}),d.jsx(se,{kind:"ghost",className:"mr-auto",disabled:F,onClick:this.handleSave,icon:Oa,tooltip:"Save ".concat(Zn.SAVE.getDisplayText()),"aria-label":"Save"}),d.jsx(se,{kind:"ghost",className:"btn-overflow btn-link-icon",disabled:F,icon:Ao,tooltip:"More Actions...",onClick:()=>{},children:d.jsx(mn,{actions:this.getDropdownOverflowActions,popperOptions:Ce.POPPER_OPTIONS})})]}),d.jsx(ah,{isLoaded:g,isLoading:v,error:u,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:C,sessionLanguage:_,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:ne,focusOnMount:te,ref:Be=>{this.notebook=Be}})]}),j&&d.jsx(av,{content:(t=ne.value)!==null&&t!==void 0?t:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri}),d.jsx(Vs,{isOpen:K,type:"file",defaultValue:x,title:G?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:n}),d.jsx(bn,{isOpen:U,headerText:'Are you sure you want to delete "'.concat(x,'"?'),bodyText:"You cannot undo this action.",onCancel:this.handleDeleteCancel,onConfirm:this.handleDeleteConfirm,confirmButtonText:"Delete"}),d.jsx(bn,{isOpen:w,headerText:"Do you want to save the changes you made to ".concat(x,"?"),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(Z,{actions:N})]})]})}}Oe(Ce,"COMPONENT","NotebookPanel");Oe(Ce,"POPPER_OPTIONS",{placement:"bottom-end"});Oe(Ce,"DEFAULT_NAME","Untitled");Oe(Ce,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");Oe(Ce,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");Oe(Ce,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,defaultNotebookSettings:null});var hv=(i,e)=>{var t=is(i),n=et(i),r=jh(i),o=In(i,e.localDashboardId),{session:s,config:a}=o??{},{type:l}=a??{};return{fileStorage:t,settings:n,defaultNotebookSettings:r,session:s,sessionLanguage:l}},uv=Sn(hv,{saveSettings:Vh},null,{forwardRef:!0})(Ce);const Nt=uv;function Po(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 To(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Po(Object(t),!0).forEach(function(n){cv(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Po(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function cv(i,e,t){return e=mv(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function mv(i){var e=gv(i,"string");return typeof e=="symbol"?e:String(e)}function gv(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 me=ee.module("ConsolePlugin");function Oo(i){return i.notebook!==void 0}function vv(i){Cm(i)}function vf(i){vv(i);var{id:e,hydrateConsole:t,layout:n,panelManager:r,registerComponent:o,notebooksUrl:s}=i,a=m.useRef(0),[l,h]=m.useState(new Map),[u,c]=m.useState(new Map),g=Io(),v=m.useCallback(()=>r.getLastUsedPanelOfType(Ti),[r]),f=m.useCallback((y,b)=>{h(S=>new Map(S.set(y,b)))},[h]),p=m.useCallback(y=>{h(b=>(b.delete(y),new Map(b)))},[h]),C=m.useCallback((y,b)=>{c(S=>new Map(S.set(y,b)))},[c]),_=m.useCallback(y=>{c(b=>(b.delete(y),new Map(b)))},[c]),T=m.useCallback(function(y){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,P=y&&y.trim();if(!P)me.info("Ignoring empty code");else{var V=v();if(!V||!(V instanceof Ti.WrappedComponent)){me.error("Console panel not found");return}me.debug("Send command: ",y,b,S),V.addCommand(y,b,S)}},[v]),w=m.useCallback(y=>{g(cg(e,y))},[g,e]),U=m.useCallback(y=>{var{language:b}=y,S=b==="python"?"py":b,P=null;return S==null?(me.debug("No extension for language",b),P="Untitled-".concat(a.current)):P="Untitled-".concat(a.current,".").concat(S),a.current+=1,P},[]),K=m.useCallback(function(y){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{id:S}=y;if(S!=null&&l.has(S))return l.get(S);if(S!=null&&u.has(S))return u.get(S);if(b)return Kt.generate()},[l,u]),te=m.useCallback((y,b)=>{O.renameComponent(n.root,{id:y},b)},[n.root]),x=m.useCallback((y,b)=>{me.debug("Rename file panel",y,b);var S;if(l.has(y)&&(S=l.get(y),p(y),S!=null&&f(b,S)),u.has(y)&&(S=u.get(y),_(y),S!=null&&C(b,S)),S===void 0){me.debug2("File ".concat(y," isn't open, no need to rename the tab"));return}te(S,A.getBaseName(b))},[l,u,te,f,C,p,_]),j=m.useCallback(y=>{var b=K(y,!1);if(b==null){me.error("Could not find panel id for file metadata",y);return}O.activateTab(n.root,{id:b})},[K,n.root]),G=m.useCallback((y,b,S)=>{if(me.debug("registerFilePanel",y,b,S),b==null||b.id==null){me.debug("Ignore empty file id",b);return}var{id:P}=b;if(S){C(P,y);return}if(l.has(P)){var V=l.get(P);if(y===V){me.debug("Update tab title for file ".concat(P));var{itemName:Ye}=b;x(P,Ye)}else me.error("File ".concat(P," already associated with a different tab ").concat(V));return}f(P,y),u.has(P)&&_(P)},[l,u,x,f,C,_]),ne=m.useCallback((y,b)=>{if(me.debug("unregisterFileTab",y,b),y==null||y.id==null){me.debug("Ignore empty file id",y);return}var{id:S}=y;if(b){_(S);return}p(S)},[p,_]),oe=m.useCallback((y,b)=>{me.debug("closeFilePanel",y);var{id:S}=y,P=null,V=!1;if(l.has(S))P=l.get(S);else if(u.has(S))P=u.get(S),V=!0;else{me.debug("File ".concat(S," isn't open, ignore close event"));return}ne(y,V),O.closeComponent(n.root,{id:P},b)},[n.root,l,u,ne]),$=m.useCallback(y=>{var{itemName:b}=y;return A.getBaseName(b)},[]),k=m.useCallback(y=>{var{id:b}=y;return me.debug("fileIsOpen",y,b,l),b!=null&&l.has(b)},[l]),F=m.useCallback(y=>{var{id:b}=y;return me.debug("fileIsOpenAsPreview",y,b,u),b!=null&&u.has(b)},[u]),N=m.useCallback(y=>{if(y!=null){var b=r.getOpenedPanelById(y);b&&Oo(b)&&b.focus()}},[r]),L=m.useCallback(y=>{var{id:b,settings:S,fileMetadata:P,session:V,sessionLanguage:Ye,isPreview:E=!1}=y,W={settings:S,fileMetadata:P},q=$(P);return{type:"react-component",component:Nt.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:b},session:V,sessionLanguage:Ye,panelState:W,isPreview:E,notebooksUrl:s},title:q,id:b}},[$,e,s]),H=m.useCallback(function(y,b,S){var P=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{id:null,itemName:U(S)},V=K(P);if(k(P)&&V!=null){me.debug("File is already open, focus panel"),j(P),N(V);return}var Ye=O.getStackForComponentTypes(n.root,[Nt.COMPONENT]),E=L({id:V,settings:S,fileMetadata:P,session:y,sessionLanguage:b});me.debug("createNotebook",E,l),O.openComponentInStack(Ye,E)},[k,N,U,K,n.root,L,l,j]),fe=m.useCallback(function(y,b,S,P){var V=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;me.debug("selectNotebook",P,V);var Ye=k(P),E=F(P),[W]=[...u.values()],q=!V,ie=q&&W?W:K(P);if(ie==null||ie==="")throw new Error("Unable to retrieve or create panelId for metadata",P);if(Ye||E)j(P);else{var pe=O.getStackForComponentTypes(n.root,[Nt.COMPONENT]),gi=L({id:ie,settings:S,fileMetadata:P,session:y,sessionLanguage:b,isPreview:q});O.openComponentInStack(pe,gi)}if(E&&V){var Nn=P.id,vi=O.getStackForConfig(n.root,{component:Nt.COMPONENT,id:ie}),fi=O.getContentItemInStack(vi,{component:Nt.COMPONENT,id:ie});fi&&je(fi)&&(fi.container.emit(ae.PROMOTE_FROM_PREVIEW),_(Nn),f(Nn,ie))}V&&N(ie)},[j,k,F,N,K,n.root,L,u,_,f]),He=m.useCallback(function(y,b){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},P=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,V=r.getLastUsedPanelOfType(Nt);V&&Oo(V)?S!=null&&S.value!=null&&V.notebook!=null&&V.notebook.append(S.value):P&&H(y,b,S)},[H,r]),Be=m.useCallback((y,b)=>Om.hydrate(To(To({},y),{},{notebooksUrl:s}),b),[s]);return rn(o,Ti,t),rn(o,pg),rn(o,Jg),rn(o,rv),rn(o,Nt,Be),Te(n.eventHub,Ge.SEND_COMMAND,T),Te(n.eventHub,Ge.SETTINGS_CHANGED,w),Te(n.eventHub,ae.CLOSE_FILE,oe),Te(n.eventHub,ae.CREATE_NOTEBOOK,H),Te(n.eventHub,ae.SELECT_NOTEBOOK,fe),Te(n.eventHub,ae.RENAME,te),Te(n.eventHub,ae.RENAME_FILE,x),Te(n.eventHub,ae.SEND_TO_NOTEBOOK,He),Te(n.eventHub,ae.REGISTER_FILE,G),Te(n.eventHub,ae.UNREGISTER_FILE,ne),null}function mi(i,e,t){return e=fv(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function fv(i){var e=pv(i,"string");return typeof e=="symbol"?e:String(e)}function pv(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 Mn{}mi(Mn,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");mi(Mn,"INPUT_FILTER","ControlType.INPUT_FILTER");mi(Mn,"MARKDOWN","ControlType.MARKDOWN");mi(Mn,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");const ff=Mn;export{df as $,af as A,In as B,ff as C,Gm as D,Ev as E,Jg as F,kh as G,Om as H,Vv as I,so as J,Nt as K,O as L,Zv as M,ae as N,dl as O,pm as P,Xv as Q,re as R,vf as S,Qv as T,A as U,zs as V,Fv as W,$v as X,Hm as Y,Hv as Z,lf as _,Fc as a,Uv as a0,kv as a1,Uh as a2,jv as a3,Wv as a4,Pv as a5,Kv as a6,$e as a7,An as a8,nh as a9,Ls as aA,Wn as aB,cg as aC,sf as aD,Qt as aa,gn as ab,rn as ac,Te as ad,Dm as ae,xn as af,cf as ag,nf as ah,Yv as ai,rf as aj,of as ak,tf as al,Bs as am,Jv as an,Ge as ao,gf as ap,ef as aq,Ki as ar,qv as as,Qe as at,Cm as au,Us as av,hf as aw,uf as ax,mf as ay,Ns as az,Ho as b,Tv as c,Ov as d,xv as e,wv as f,Iv as g,Dv as h,Mv as i,Nv as j,Fh as k,et as l,Lv as m,zv as n,hi as o,Ti as p,rv as q,$t as r,Vh as s,pg as t,Bv as u,Ot as v,zh as w,Rv as x,Re as y,Av as z};
|
|
21
|
-
//# sourceMappingURL=ControlType-6b65518d.js.map
|