@deephaven/code-studio 0.85.3-beta.3 → 0.85.3
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-6d5376cb.js → AppRoot-2c3d8ba6.js} +3 -3
- package/build/assets/{AppRoot-6d5376cb.js.map → AppRoot-2c3d8ba6.js.map} +1 -1
- package/build/assets/{Chart-3228fe10.js → Chart-193dc89e.js} +2 -2
- package/build/assets/{Chart-3228fe10.js.map → Chart-193dc89e.js.map} +1 -1
- package/build/assets/{ControlType-4d792bd5.js → ControlType-7a96d66b.js} +13 -13
- package/build/assets/ControlType-7a96d66b.js.map +1 -0
- package/build/assets/{FontBootstrap-f59066a5.js → FontBootstrap-acd62e74.js} +2 -2
- package/build/assets/{FontBootstrap-f59066a5.js.map → FontBootstrap-acd62e74.js.map} +1 -1
- package/build/assets/{FormatterUtils-59256d3e.js → FormatterUtils-f9c9a814.js} +2 -2
- package/build/assets/{FormatterUtils-59256d3e.js.map → FormatterUtils-f9c9a814.js.map} +1 -1
- package/build/assets/{Grid-1381e53d.js → Grid-f62da059.js} +3 -3
- package/build/assets/{Grid-1381e53d.js.map → Grid-f62da059.js.map} +1 -1
- package/build/assets/{IrisGrid-91aadac3.js → IrisGrid-bdc67971.js} +2 -2
- package/build/assets/{IrisGrid-91aadac3.js.map → IrisGrid-bdc67971.js.map} +1 -1
- package/build/assets/{IrisGridModel-2a36e41a.js → IrisGridModel-7513b4f9.js} +2 -2
- package/build/assets/{IrisGridModel-2a36e41a.js.map → IrisGridModel-7513b4f9.js.map} +1 -1
- package/build/assets/{IrisGridShortcuts-eb66acf2.js → IrisGridShortcuts-1ac3bc80.js} +2 -2
- package/build/assets/{IrisGridShortcuts-eb66acf2.js.map → IrisGridShortcuts-1ac3bc80.js.map} +1 -1
- package/build/assets/IrisGridThemeProvider-417b77f6.js +11 -0
- package/build/assets/IrisGridThemeProvider-417b77f6.js.map +1 -0
- package/build/assets/{LocalWorkspaceStorage-1a534d33.js → LocalWorkspaceStorage-fc4bc35d.js} +2 -2
- package/build/assets/{LocalWorkspaceStorage-1a534d33.js.map → LocalWorkspaceStorage-fc4bc35d.js.map} +1 -1
- package/build/assets/{MarkdownEditor-3dd90750.js → MarkdownEditor-d37a0743.js} +2 -2
- package/build/assets/{MarkdownEditor-3dd90750.js.map → MarkdownEditor-d37a0743.js.map} +1 -1
- package/build/assets/{MarkdownNotebook-c90d577f.js → MarkdownNotebook-1e09c624.js} +2 -2
- package/build/assets/{MarkdownNotebook-c90d577f.js.map → MarkdownNotebook-1e09c624.js.map} +1 -1
- package/build/assets/{MissingPartitionError-746bb023.js → MissingPartitionError-8b86a8cd.js} +2 -2
- package/build/assets/{MissingPartitionError-746bb023.js.map → MissingPartitionError-8b86a8cd.js.map} +1 -1
- package/build/assets/{StyleGuideRoot-389d3c67.js → StyleGuideRoot-1e8c8954.js} +2 -2
- package/build/assets/{StyleGuideRoot-389d3c67.js.map → StyleGuideRoot-1e8c8954.js.map} +1 -1
- package/build/assets/{TokenBoxCellRenderer-f517060c.js → TokenBoxCellRenderer-758c4877.js} +2 -2
- package/build/assets/{TokenBoxCellRenderer-f517060c.js.map → TokenBoxCellRenderer-758c4877.js.map} +1 -1
- package/build/assets/{index-37d8f201.js → index-86fc9ab4.js} +5 -5
- package/build/assets/index-86fc9ab4.js.map +1 -0
- package/build/assets/{index-0868e7f5.js → index-a5f0f1ea.js} +2 -2
- package/build/assets/{index-0868e7f5.js.map → index-a5f0f1ea.js.map} +1 -1
- package/build/assets/{index-7d62d702.js → index-cb5be03d.js} +2 -2
- package/build/assets/{index-7d62d702.js.map → index-cb5be03d.js.map} +1 -1
- package/build/index.html +2 -2
- package/package.json +30 -30
- package/build/assets/ControlType-4d792bd5.js.map +0 -1
- package/build/assets/IrisGridThemeProvider-4378584b.js +0 -11
- package/build/assets/IrisGridThemeProvider-4378584b.js.map +0 -1
- package/build/assets/index-37d8f201.js.map +0 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import{r as m,bd as Ni,a1 as Mt,I as u,bg as fd,M as H,bh as vd,J as ss,K as Z,R as Hr,V as S,bi as gd,bj as pd,L as ue,H as ls,T as Pn,U as bn,bk as bd,bl as yd,bm as Cd,bn as Sd,a2 as yt,bo as Un,ai as eo,bp as wd,bf as Xn,bq as Ai,br as Ed,bs as _d,bt as Pd,bu as Td,bv as M,bw as to,bx as Od,Y as Li,a3 as ds,by as Id,Q as Dn}from"./vendor-e600113a.js";import{L as B,T as us,a0 as Dd,a3 as xd,K as Md,$ as Nd,a4 as Ad,X as Ld,a9 as Fd,P as Rd,M as hs,b as cs,c as ms,ah as kd,at as jd,au as fs,av as vs,aw as $d,ax as Hd,G as un,ac as Bd,y as gs,as as Wd,ap as ps,aq as bs,Q as ys,j as Ud,e as k,d as jn,ay as Vd,a7 as Cs,az as no,aA as Kd,aB as zd,aC as Gd,aD as qd,f as Ss,ai as ws,aE as Es,aF as Vn,ao as Xd,aG as Zd,C as ro,aH as _s,aI as io,aJ as Ps,aK as Yd,F as Qd,aL as Jd,a1 as eu,aM as tu,a2 as nu,aN as ru,aO as iu,aP as ou,aQ as au,aR as su,aS as lu,aT as du,ak as uu,aU as hu,aV as cu}from"./index-0868e7f5.js";import{e as lt,l as pt,K as ze,a as Gt,b as oo,R as mu,_ as Ts}from"./monaco-b5248072.js";var AC=Object.freeze([]),LC=new Map,FC=()=>{};function RC(n){return Array.isArray(n)?n:[n]}function ni(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return e.filter(r=>r!=null)}function fu(n,e,t){return e=vu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function vu(n){var e=gu(n,"string");return typeof e=="symbol"?e:String(e)}function gu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class pu extends Error{constructor(){super(...arguments),fu(this,"isCanceled",!0)}}const vi=pu;function bu(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=yu(n,e);t.forEach(r=>{n[r]=n[r].bind(n)})}function yu(n,e){for(var t=new Set,r=n,i=0;r!=null&&r!==Object.prototype&&(i<=1||e);){for(var o of Object.getOwnPropertyNames(r)){var a;o!=="constructor"&&typeof((a=Object.getOwnPropertyDescriptor(r,o))===null||a===void 0?void 0:a.value)=="function"&&t.add(o)}r=Object.getPrototypeOf(r),i+=1}return[...t.keys()]}function ao(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Cu(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ao(o,r,i,a,s,"next",l)}function s(l){ao(o,r,i,a,s,"throw",l)}a(void 0)})}}function Os(n){return gi.apply(this,arguments)}function gi(){return gi=Cu(function*(n){var{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(n)}catch{return so(n)}so(n)}),gi.apply(this,arguments)}function so(n){var e=document.activeElement,t=document.createElement("textarea");t.value=n,document.body.appendChild(t),t.focus(),t.select();var r=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!r)throw new Error("Unable to execute copy command")}function xn(n,e,t){return e=Su(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Su(n){var e=wu(n,"string");return typeof e=="symbol"?e:String(e)}function wu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Eu="table_",Is="column_",_u=new Set(["in","not","i","ii","k"]),Pu=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"]),Tu=/[^a-zA-Z0-9_$+@-]/g,Ou=/[^A-Za-z0-9_$]/g;class ot{}xn(ot,"legalize",(n,e,t,r,i)=>{var o=n.trim().replace(/[- ]/g,"_");return r&&(_u.has(o)||Pu.has(o))&&(o=e+o),o=o.replace(t,""),o||(o=e+i),Number.isNaN(Number(o.charAt(0)))||(o=e+o),o});xn(ot,"legalizeTableName",n=>ot.legalize(n,Eu,Tu,!1,0));xn(ot,"legalizeColumnNames",n=>{var e=[];return n.forEach((t,r)=>{var i=ot.legalizeColumnName(t,r);e.includes(i)&&(i=Is+r),e.push(i)}),e});xn(ot,"legalizeColumnName",function(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return ot.legalize(n,Is,Ou,!0,e)});xn(ot,"isValidTableName",n=>ot.legalizeTableName(n)===n);xn(ot,"isValidColumnName",n=>ot.legalizeColumnName(n)===n);const Ds=ot;class xs extends CustomEvent{constructor(e,t){super(e,t)}}function Iu(n,e,t){return e=Du(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Du(n){var e=xu(n,"string");return typeof e=="symbol"?e:String(e)}function xu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Mu extends Error{constructor(){super(...arguments),Iu(this,"isTimeout",!0)}}const Ms=Mu;class Ee{static makeCancelable(e,t){var r=!1,i,o,a=new Promise((s,l)=>{o=l,Promise.resolve(e).then(d=>{r?t&&t(d):(i=d,s(d))}).catch(d=>l(d))});return a.cancel=()=>{r=!0,o(new vi),i!=null&&t&&t(i)},a}static isCanceled(e){return e instanceof vi}static isTimedOut(e){return e instanceof Ms}static withTimeout(e,t){return new Promise((r,i)=>{setTimeout(()=>{try{r(t())}catch(o){i(o)}},e)})}}function lo(n,e,t){return e=Nu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Nu(n){var e=Au(n,"string");return typeof e=="symbol"?e:String(e)}function Au(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Lu{constructor(){lo(this,"pending",[]),lo(this,"resolved",[])}add(e,t){var r=Ee.makeCancelable(e,t);return this.pending.push(r),r.then(()=>{this.resolve(r)},()=>{this.resolve(r)}),r}remove(e){for(var t=0;t<this.pending.length;t+=1)if(this.pending[t]===e){this.pending.splice(t,1);return}}resolve(e){this.remove(e),this.resolved.push(e)}cancel(){for(var e=[...this.pending,...this.resolved],t=0;t<e.length;t+=1)e[t].cancel();this.pending=[],this.resolved=[]}}const Mn=Lu;class Fi{static isValidRange(e){return e!=null&&e.length===2&&Number.isInteger(e[0])&&Number.isInteger(e[1])&&e[0]<=e[1]}static validateRange(e){if(!Fi.isValidRange(e))throw new Error("Invalid range! ".concat(e))}static isSelected(e,t){for(var r=0;r<e.length;r+=1){var i=e[r],o=i[0],a=i[1];if(o<=t&&t<=a)return!0}return!1}static selectRange(e,t){for(var[r,i]=t,o=[...e],a=o.length-1;a>=0;a-=1){var s=o[a],l=s[0],d=s[1];if(l<=r&&i<=d)return o;r<=d&&l<=i&&(r=Math.min(r,l),i=Math.max(i,d),o.splice(a,1))}return o.push([r,i]),o}static deselectRange(e,t){for(var[r,i]=t,o=[...e],a=o.length-1;a>=0;a-=1){var s=o[a],l=s[0],d=s[1];if(!(i<l||d<r))if(l<r&&i<d){o[a]=[l,r-1],o.splice(a+1,0,[i+1,d]);break}else r<=l&&d<=i?o.splice(a,1):l<r?o[a]=[l,r-1]:o[a]=[i+1,d]}return o}static count(e){return e.reduce((t,r)=>t+(r[1]-r[0]+1),0)}static getItemsInRanges(e,t){return t.reduce((r,i)=>{for(var o=[...r],a=i[0];a<=i[1];a+=1)o.push(e[a]);return o},[])}}const It=Fi;function*kC(n,e){for(var t=n;t<=e;++t)yield t}var jC=" ";class Ns{static join(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"and";if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return"".concat(e[0]," ").concat(t," ").concat(e[1]);var r=e.slice(0,e.length-1).join(", "),i=e[e.length-1];return"".concat(r,", ").concat(t," ").concat(i)}static toLower(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e==null){if(t)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return e<t?r?-1:1:e>t?r?1:-1:0}}function As(n,e,t){return e=Fu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fu(n){var e=Ru(n,"string");return typeof e=="symbol"?e:String(e)}function Ru(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class tr{static formatElapsedTime(e){if(typeof e!="number"||!Number.isInteger(e))throw new Error("".concat(e," is not a number that can be expressed as a formatted time"));var t=Math.floor(e/3600),r=Math.floor(e%3600/60),i=e%60;return"".concat(t>0?"".concat(t,"h "):"")+"".concat(r>0||t>0?"".concat(r,"m "):"")+"".concat(e>=60?"".concat(i,"s").padStart(3,"0"):"".concat(i,"s"))}static formatTime(e){if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error("".concat(e," is not a number that can be expressed as a formatted time"));var t=String(Math.floor(e/(60*60))).padStart(2,"0"),r=e%(60*60),i=String(Math.floor(r/60)).padStart(2,"0"),o=r%60,a=String(Math.ceil(o)).padStart(2,"0");return"".concat(t,":").concat(i,":").concat(a)}static isTimeString(e){return new RegExp(tr.TIME_PATTERN).test(e)}static parseTime(e){if(e==null||typeof e!="string")throw new Error("".concat(e," is not a valid string"));var t=e.split(":");if(t.length!==3)throw new Error("".concat(e," is not a time string that can be parsed"));return Number(t[0])*60*60+Number(t[1])*60+Number(t[2])}}As(tr,"TIME_PATTERN","([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]");As(tr,"TIME_ZONES",Object.freeze([{label:"Tokyo UTC+9 No DST",value:"Asia/Tokyo"},{label:"Seoul UTC+9 No DST",value:"Asia/Seoul"},{label:"Hong Kong UTC+8 No DST",value:"Asia/Hong_Kong"},{label:"Singapore UTC+8 No DST",value:"Asia/Singapore"},{label:"Kolkata UTC+5:30 No DST",value:"Asia/Kolkata"},{label:"Berlin UTC+1",value:"Europe/Berlin"},{label:"UTC UTC±0 No DST",value:"UTC"},{label:"London UTC±0",value:"Europe/London"},{label:"Sao Paulo UTC-2",value:"America/Sao_Paulo"},{label:"Newfoundland UTC-3:30",value:"America/St_Johns"},{label:"Halifax UTC-4",value:"America/Halifax"},{label:"New York UTC−5",value:"America/New_York"},{label:"Chicago UTC-6",value:"America/Chicago"},{label:"Denver UTC-7",value:"America/Denver"},{label:"Los Angeles UTC-8",value:"America/Los_Angeles"},{label:"Anchorage UTC-9",value:"America/Anchorage"},{label:"Honolulu UTC-10 No DST",value:"Pacific/Honolulu"},{label:"Zurich UTC+1",value:"Europe/Zurich"},{label:"Amsterdam UTC+1",value:"Europe/Amsterdam"},{label:"Taipei UTC+8 No DST",value:"Asia/Taipei"},{label:"Sydney UTC+10",value:"Australia/Sydney"}]));const Ls=tr;function ku(n,e,t){return e=ju(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ju(n){var e=$u(n,"string");return typeof e=="symbol"?e:String(e)}function $u(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Hu extends Error{constructor(){super(...arguments),ku(this,"isInvalid",!0)}}const Kn=Hu;function Fs(){var n=m.useRef(!1);return m.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[]),n}function uo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Bu(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){uo(o,r,i,a,s,"next",l)}function s(l){uo(o,r,i,a,s,"throw",l)}a(void 0)})}}var Wu=B.module("useAsyncInterval");function Uu(n,e){var t=Fs(),r=m.useRef(0),i=m.useRef(0),o=m.useRef(null),a=m.useCallback(Bu(function*(){var s=Date.now();i.current+=1;var l=o.current==null?e:s-o.current;o.current=s;try{yield n()}catch(c){Wu.error("A tick error occurred:",c)}if(t.current){l+=Date.now()-o.current;var d=Math.max(0,l-e),h=Math.max(0,e-d);r.current=window.setTimeout(a,h)}}),[n,t,e]);m.useEffect(()=>(o.current=null,a(),()=>{window.clearTimeout(r.current)}),[e,a])}function nr(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"No value available in context. Was code wrapped in a provider?",t=m.useContext(n);if(t==null)throw new Error(e);return t}function Vu(n,e,t){var r=m.useRef(t),i=m.useRef(n);i.current=n;var o=m.useMemo(()=>Ni(function(){return i.current(...arguments)},e,r.current),[e]);return m.useEffect(()=>()=>{var a,s;(a=(s=r.current)===null||s===void 0?void 0:s.flushOnUnmount)!==null&&a!==void 0&&a?o.flush():o.cancel()},[o]),o}function Ku(n){var e=m.useRef();return m.useEffect(function(){e.current=n}),e.current}function Rs(n){var e=m.useRef(null);return m.useEffect(function(){n&&(typeof n=="function"?n(e.current):n.current=e.current)}),e}var zu=3500,Gu=B.module("useCopyToClipboard");function qu(){var[n,e]=m.useState(!1),t=m.useRef(null),r=m.useCallback(i=>{Os(i).then(()=>{e(!0)}).catch(o=>Gu.error("Unable to copy ".concat(i),`
|
|
2
|
-
`,o))},[]);return m.useEffect(()=>(t.current&&clearTimeout(t.current),n&&(t.current=setTimeout(()=>{e(!1)},zu)),()=>{t.current&&clearTimeout(t.current)}),[n]),[n,r]}function ks(n){var{children:e,isPortal:t=!1,theme:r=vh,colorScheme:i}=n,[o]=m.useState(t?Mt():null);return u.jsx(fd,{UNSAFE_className:"spectrum-theme-provider",theme:r,colorScheme:i,"data-unique-id":o,children:e})}function ho(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Xu(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ho(Object(t),!0).forEach(function(r){En(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ho(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function En(n,e,t){return e=Zu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Zu(n){var e=Yu(n,"string");return typeof e=="symbol"?e:String(e)}function Yu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var co="popper";class Ri extends m.Component{constructor(e){super(e),En(this,"element",void 0),En(this,"container",void 0),En(this,"rAF",void 0),this.handleEnter=this.handleEnter.bind(this),this.handleExit=this.handleExit.bind(this),this.handleBlur=this.handleBlur.bind(this),this.element=document.createElement("div"),this.element.className="popper-container",this.container=H.createRef(),this.rAF=0;var{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){var{isShown:t}=this.props;e.isShown!==t&&(t?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){var{popper:e}=this.state,{closeOnBlur:t,referenceObject:r}=this.props;if(!e&&this.container.current!==null){var{options:i}=this.props;i=Xu({placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}}},i),document.body.appendChild(this.element);var o=this.getVisibleElement(this.container.current);o==null&&(o=this.container.current),e=new vd(r||o,this.element,i),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t){var a=this.element.querySelector(".".concat(co));a instanceof HTMLElement&&!a.contains(document.activeElement)&&a.focus()}}),this.setState({popper:e})}}destroyPopper(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;cancelAnimationFrame(this.rAF);var{popper:t}=this.state;t&&(t.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),this.setState({show:!0})}hide(){this.setState({show:!1})}scheduleUpdate(){var{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){var{onEntered:e}=this.props;e()}handleExit(){var{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){var{className:e,children:t,timeout:r,interactive:i,closeOnBlur:o}=this.props,{show:a}=this.state;return u.jsx(ks,{isPortal:!0,children:u.jsx(ss,{in:a,timeout:r,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:u.jsx("div",{onClick:s=>{s.stopPropagation()},onKeyDown:s=>{s.key==="Escape"&&this.hide()},className:Z(co,{interactive:i},e),onBlur:o?this.handleBlur:void 0,tabIndex:o?-1:void 0,role:"presentation",children:u.jsxs("div",{className:"popper-content",children:[t,u.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})})}render(){var{popper:e}=this.state,{"data-testid":t}=this.props;return u.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&Hr.createPortal(this.renderContent(),this.element)})}}En(Ri,"propTypes",{children:S.node.isRequired,options:S.shape({}),className:S.string,timeout:S.number,onEntered:S.func,onExited:S.func,isShown:S.bool,closeOnBlur:S.bool,interactive:S.bool,referenceObject:S.shape({}),"data-testid":S.string});En(Ri,"defaultProps",{options:{},className:"",timeout:us.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0});const ki=Ri;function mo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Qu(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?mo(Object(t),!0).forEach(function(r){ut(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):mo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ut(n,e,t){return e=Ju(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ju(n){var e=eh(n,"string");return typeof e=="symbol"?e:String(e)}function eh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var th=B.module("Tooltip");class ye extends m.Component{static handleHidden(){ye.shownTooltipCount-=1,ye.shownTooltipCount===0&&(ye.lastHiddenTime=Date.now())}static handleShown(){ye.shownTooltipCount+=1}constructor(e){super(e),ut(this,"container",void 0),ut(this,"popper",void 0),ut(this,"parent",void 0),ut(this,"timer",void 0),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowMouseMove=this.handleWindowMouseMove.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.handleExited=this.handleExited.bind(this),this.stopShowingTooltip=this.stopShowingTooltip.bind(this),this.container=H.createRef(),this.popper=H.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();var{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){var{isShown:r}=t,{isShown:i}=this.state;i!==r&&(i?ye.handleShown():ye.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();var{isShown:e}=this.state;e&&ye.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){th.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){this.parent&&(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){var{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){var{isShown:e}=this.state;this.stopTimer();var{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){var t=e.clientX,r=e.clientY,{isShown:i}=this.state;if(!(!this.popper.current||!this.parent)){var o=this.popper.current.element.getBoundingClientRect(),a=this.parent.getBoundingClientRect();t>=o.left&&t<=o.left+o.width&&r>=o.top&&r<=o.top+o.height?this.handleMouseMove():t>=a.left&&t<=a.left+a.width&&r>=a.top&&r<=a.top+a.height?this.handleMouseMove():i&&(this.stopTimer(),this.hide())}}startTimer(){this.stopTimer();var{timeout:e,reshowTimeout:t}=this.props,r=e;(ye.shownTooltipCount>0||Date.now()-ye.lastHiddenTime<ye.triggerReshowThreshold)&&(r=t),this.timer=window.setTimeout(this.handleTimeout,r)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var{isShown:e}=this.state;if(this.stopTimer(),!e){var t;(t=this.popper.current)===null||t===void 0||t.show(),this.setState({isShown:!0});var{interactive:r}=this.props;r&&this.startListeningWindow()}}hide(){var e;(e=this.popper.current)===null||e===void 0||e.hide(),this.stopListeningWindow()}update(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleExited(){this.setState({isShown:!1});var{onExited:e}=this.props;e()}stopShowingTooltip(){var{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){var{interactive:e,children:t,referenceObject:r,popperClassName:i,"data-testid":o,onEntered:a}=this.props,{isShown:s}=this.state,{options:l}=this.props;return l=Qu({placement:"bottom"},l),u.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":o,children:u.jsx(ki,{className:Z(i,"popper-tooltip"),options:l,ref:this.popper,onEntered:a,onExited:this.handleExited,interactive:e,referenceObject:r,children:u.jsxs("div",{className:"tooltip-content",children:[" ",s&&t]})})})}}ut(ye,"defaultTimeout",500);ut(ye,"defaultReshowTimeout",100);ut(ye,"triggerReshowThreshold",300);ut(ye,"shownTooltipCount",0);ut(ye,"lastHiddenTime",Date.now());ut(ye,"defaultProps",{interactive:!1,options:{},popperClassName:"",reshowTimeout:ye.defaultReshowTimeout,timeout:ye.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});const qt=ye,nh={"dh-spectrum-palette":"_dh-spectrum-palette_llwuf_1"},rh={"dh-spectrum-alias":"_dh-spectrum-alias_1906d_1"};function fo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function vo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fo(Object(t),!0).forEach(function(r){ih(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):fo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ih(n,e,t){return e=oh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function oh(n){var e=ah(n,"string");return typeof e=="symbol"?e:String(e)}function ah(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var go=vo(vo({},nh),rh);function po(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function fr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?po(Object(t),!0).forEach(function(r){sh(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):po(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function sh(n,e,t){return e=lh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lh(n){var e=dh(n,"string");return typeof e=="symbol"?e:String(e)}function dh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var{global:uh,light:hh,dark:ch,medium:mh,large:fh}=gd,vh={global:uh,light:fr(fr({},hh),go),dark:fr(fr({},ch),go),medium:mh,large:fh};var gh=B.module("ThemeProvider"),js=m.createContext(null);function $C(n){var{themes:e,defaultPreloadValues:t=Rd,children:r}=n,i=m.useMemo(()=>Dd(),[]),[o,a]=m.useState(null),[s,l]=m.useState(()=>{var c,f;return(c=(f=xd())===null||f===void 0?void 0:f.themeKey)!==null&&c!==void 0?c:Md}),d=m.useMemo(()=>e==null?null:Nd(s,{base:i,custom:e??[]}),[i,s,e]),h=m.useMemo(()=>[...i,...e??[]],[i,e]);return m.useEffect(function(){if(!(d==null||e==null)){Ad(t);var f=Ld(t);gh.debug2("updateThemePreloadData:",{active:d.map(v=>v.themeKey),custom:e.map(v=>v.themeKey),preloadStyleContent:f,selectedThemeKey:s}),Fd({themeKey:s,preloadStyleContent:f})}},[d,s,e,t]),m.useEffect(()=>{a({activeThemes:d,selectedThemeKey:s,themes:h,setSelectedThemeKey:l})},[d,s,h]),u.jsxs(u.Fragment,{children:[d==null?null:u.jsx(u.Fragment,{children:d.map(c=>u.jsx("style",{"data-theme-key":c.themeKey,children:c.styleContent},c.themeKey))}),o==null?null:u.jsx(js.Provider,{value:o,children:u.jsx(ks,{children:r})})]})}function $s(){return nr(js,"No ThemeContext value found. Component must be wrapped in a ThemeContext.Provider")}function Br(n){var{children:e,className:t,style:r,"data-testid":i}=n;return u.jsx("div",{className:Z("btn-group",t),style:r,role:"group","data-testid":i,children:e})}Br.displayName="SplitButtonGroup";Br.propTypes={children:S.node.isRequired,className:S.string,style:S.object,"data-testid":S.string};Br.defaultProps={className:null,style:{},"data-testid":void 0};var ph=["kind","variant","type","tooltip","icon","disabled","active","onClick","onContextMenu","onMouseDown","onMouseUp","onMouseEnter","onMouseLeave","onKeyDown","className","style","children","tabIndex","data-testid","aria-label"];function bo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function yo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bo(Object(t),!0).forEach(function(r){bh(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):bo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function bh(n,e,t){return e=yh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yh(n){var e=Ch(n,"string");return typeof e=="symbol"?e:String(e)}function Ch(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Sh(n,e){if(n==null)return{};var t=wh(n,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function wh(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var Eh=["primary","secondary","tertiary","success","danger","inline","ghost"],_h=["group-end"];function Ph(n,e){switch(n){case"primary":return"btn-primary";case"secondary":return"btn-outline-primary";case"tertiary":return"btn-secondary";case"success":return"btn-success";case"danger":return"btn-danger";case"inline":return"btn-inline";case"ghost":return Z("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function Th(n){switch(n){case"group-end":return Z("pl-2","pr-3")}}var se=H.forwardRef((n,e)=>{var{kind:t,variant:r,type:i,tooltip:o,icon:a,disabled:s=!1,active:l,onClick:d,onContextMenu:h,onMouseDown:c,onMouseUp:f,onMouseEnter:v,onMouseLeave:p,onKeyDown:g,className:y,style:P,children:O,tabIndex:_,"data-testid":R,"aria-label":U}=n,Q=Sh(n,ph),{UNSAFE_className:N}=pd({},"button"),W;r&&(W=Th(r));var j;a&&(j=H.isValidElement(a)?a:u.jsx(ue,{icon:a}));var Y=j!=null&&O==null,ne=Ph(t,Y),F;o!==void 0&&(F=typeof o=="string"?u.jsx(qt,{children:o}):o);var q=U;U===void 0&&Y&&o!=null&&typeof o=="string"&&(q=o);var K=u.jsxs("button",yo(yo({"data-testid":R,ref:e,type:i,className:Z("btn",ne,W,{active:l},y,N),onClick:d,onContextMenu:h,onMouseUp:f,onMouseDown:c,onMouseEnter:v,onMouseLeave:p,onKeyDown:g,style:P,disabled:s,tabIndex:_,"aria-label":q},Q),{},{children:[a&&j,O,o!=null&&!s&&F]}));return s&&o!=null?u.jsxs("span",{className:"btn-disabled-wrapper",children:[K,F]}):K});se.displayName="Button";se.propTypes={kind:S.oneOf(Eh).isRequired,variant:S.oneOf(_h),type:S.oneOf(["submit","reset","button"]),tooltip(n){var{tooltip:e,icon:t,children:r}=n;return e===void 0&&t!=null&&r==null?new Error("Tooltip is required for icon only buttons"):null},icon(n){var{children:e,icon:t}=n;return t==null&&e==null?new Error("Icon is required if no children are provided"):e==null&&!H.isValidElement(t)&&(t==null||t.iconName===""||t.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:S.bool,active:S.bool,onClick(n){var{onClick:e,type:t}=n;return t==="button"&&typeof e!="function"?new Error("type button requires an onClick function"):e!==void 0&&typeof e!="function"?new Error("onClick must be a function"):null},onContextMenu:S.func,onMouseUp:S.func,onMouseDown:S.func,onMouseEnter:S.func,onMouseLeave:S.func,onKeyDown:S.func,tabIndex:S.number,children:S.node,className:S.string,style:S.object,"data-testid":S.string};se.defaultProps={type:"button",onClick:void 0,onContextMenu:void 0,onMouseUp:void 0,onMouseDown:void 0,onMouseEnter:void 0,onMouseLeave:void 0,onKeyDown:void 0,variant:void 0,tooltip:void 0,icon:void 0,disabled:!1,active:void 0,tabIndex:void 0,children:void 0,className:void 0,style:{},"data-testid":void 0};const _n=se;function Hs(n){var{className:e="modal-footer",children:t,"data-testid":r}=n;return u.jsx("div",{className:e,"data-testid":r,children:t})}function dn(n){var{isOpen:e,headerText:t,bodyText:r,onCancel:i,onConfirm:o,onDiscard:a,onModalDisable:s,cancelButtonText:l="Cancel",confirmButtonText:d="Okay",discardButtonText:h="Discard",isConfirmDanger:c=!1,children:f,"data-testid":v}=n,p=m.useRef(null),g=m.useRef(null),y=m.useCallback(()=>{g.current!==null&&g.current.checked&&s&&s(),o()},[o,s]),P=m.useCallback(()=>{var _;(_=p.current)===null||_===void 0||_.focus()},[]),O="";return e&&(O=typeof r=="function"?r():r),u.jsxs(hs,{isOpen:e,onOpened:P,children:[u.jsx(cs,{closeButton:!1,children:t}),u.jsx(ms,{children:O}),u.jsxs(Hs,{children:[s&&u.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[u.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:g,"data-testid":v!==void 0?"".concat(v,"-checkbox-confirm"):void 0}),u.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),a&&u.jsx(_n,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:a,"data-testid":v!==void 0?"".concat(v,"-btn-discard"):void 0,children:h}),i&&u.jsx(_n,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":v!==void 0?"".concat(v,"-btn-cancel"):void 0,children:l}),u.jsxs(Br,{children:[u.jsx(_n,{kind:c?"danger":"primary",onClick:y,ref:p,"data-testid":v!==void 0?"".concat(v,"-btn-confirm"):void 0,children:d}),f]})]})]})}dn.propTypes={isOpen:S.bool.isRequired,headerText:S.string.isRequired,bodyText:S.oneOfType([S.string,S.func]).isRequired,onCancel:S.func,onConfirm:S.func.isRequired,onDiscard:S.func,onModalDisable:S.func,cancelButtonText:S.string,confirmButtonText:S.string,discardButtonText:S.string,children:S.node,"data-testid":S.string};dn.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};function Oh(n,e,t){return e=Ih(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ih(n){var e=Dh(n,"string");return typeof e=="symbol"?e:String(e)}function Dh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function ri(n){return n.then!==void 0}class Ut{static disableAllActions(){Ut.actionsDisabled=!0}static enableAllActions(){Ut.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){if(e.group!==t.group){var r,i;return((r=e.group)!==null&&r!==void 0?r:0)>((i=t.group)!==null&&i!==void 0?i:0)?1:-1}if(e.order!==t.order){var o,a;return((o=e.order)!==null&&o!==void 0?o:0)>((a=t.order)!==null&&a!==void 0?a:0)?1:-1}if(e.title!==t.title){var s,l;return((s=e.title)!==null&&s!==void 0?s:"")>((l=t.title)!==null&&l!==void 0?l:"")?1:-1}return e!==t?e>t?1:-1:0}static sortActions(e){if(e==null||!Array.isArray(e))return[];var t=e.slice();return t.sort(Ut.compareActions),t}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return Ut.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){var t=Ut.getModifierKey();return e[t]}static getMenuItems(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=[],i=e;Array.isArray(i)||(i=[i]);for(var o=0;o<i.length;o+=1){var a=i[o],s=void 0;typeof a=="function"?s=a():s=a,s!=null&&(s instanceof Promise?t&&r.push(s):Array.isArray(s)?r=r.concat(s):r.push(s))}return r=r.filter(l=>l.title!==void 0||l.then!=null||l.menuElement),r}static getNextMenuItem(e,t,r){var i=e;i<0&&t<0&&(i=r.length);for(var o=1;o<r.length+1;o+=1){var a=(i+t*o+r.length)%r.length,s=r[a];if(!(s instanceof Promise)&&s.disabled!==!0)return a}return e}}Oh(Ut,"actionsDisabled",!1);const Ze=Ut;var Co=B.module("GlobalContextAction");class xh extends m.Component{constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentDidMount(){document.body.addEventListener("contextmenu",this.handleContextMenu),document.body.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.body.removeEventListener("contextmenu",this.handleContextMenu),document.body.removeEventListener("keydown",this.handleKeyDown)}handleContextMenu(e){var t=e;t.contextActions==null&&(t.contextActions=[]);var{action:r}=this.props;r.title==null&&!r.menuElement||(t.contextActions==null&&(t.contextActions=[]),t.contextActions.push(r),Co.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){var{action:t}=this.props;if(!Ze.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)){var r;Co.debug("Global hotkey matched!",e),(r=t.action)===null||r===void 0||r.call(t,e),e.preventDefault(),e.stopPropagation()}}render(){return null}}const Mh=xh;class Nh extends m.Component{render(){for(var{actions:e,"data-testid":t}=this.props,r=[],i=0;i<e.length;i+=1){var o=e[i],{shortcut:a}=o;if(o.title!=null||o.menuElement||a){var s=u.jsx(Mh,{action:o,"data-testid":t},"".concat(o.title,".").concat(a?.id));r.push(s)}}return r}}const Ah=Nh;function Bs(n,e,t){return e=Lh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Lh(n){var e=Fh(n,"string");return typeof e=="symbol"?e:String(e)}function Fh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var vr=B.module("ContextActions");class Ws extends m.Component{static triggerMenu(e,t,r,i){if(i.length!==0){var o=new MouseEvent("contextmenu",{clientX:t,clientY:r,bubbles:!0,cancelable:!0});o.contextActions=i,e.dispatchEvent(o)}}constructor(e){super(e),Bs(this,"container",void 0),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=H.createRef(),this.state={globalActions:[],keyboardActions:[]}}static getDerivedStateFromProps(e){if(e.actions==null||!Array.isArray(e.actions))return{globalActions:[],keyboardActions:[]};var t=e.actions.filter(i=>!ri(i)&&typeof i!="function"&&i.isGlobal),r=e.actions.filter(i=>!ri(i)&&typeof i!="function"&&(i.isGlobal===void 0||!i.isGlobal)&&i.shortcut!=null);return{globalActions:t,keyboardActions:r}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}handleContextMenu(e){var{ignoreClassNames:t=[]}=this.props;if(t.length>0)for(var r=e.target,i=function(){var{classList:d}=r,h=t.find(c=>d.contains(c));if(h!==void 0)return vr.debug2('Contextmenu event ignored based on the target className "'.concat(h,'"')),{v:void 0};r=r.parentElement};r!=null;){var o=i();if(typeof o=="object")return o.v}if(Ze.isContextActionEvent(e)||(e.contextActions=[]),!!Ze.isContextActionEvent(e)){var{actions:a}=this.props;if(a!=null){var s=a;Array.isArray(s)&&(s=s.filter(l=>ri(l)||typeof l=="function"||l.isGlobal===void 0||!l.isGlobal)),e.contextActions=e.contextActions.concat(s)}vr.debug("Received context menu event! Menu items are now: ",e.contextActions)}}handleKeyDown(e){for(var{keyboardActions:t}=this.state,r=0;r<t.length;r+=1){var i=t[r];if(!Ze.actionsDisabled&&i.shortcut!=null&&i.shortcut.matchesEvent(e)){var o;vr.debug("Context hotkey matched!",e),(o=i.action)===null||o===void 0||o.call(i,e),e.stopPropagation(),e.preventDefault(),vr.debug2("Matched hotkey returned false, key event not consumed")}}}render(){var{"data-testid":e}=this.props,{globalActions:t}=this.state;return u.jsx("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:u.jsx(Ah,{actions:t})})}}Bs(Ws,"groups",{default:void 0,high:100,medium:5e3,low:1e4,global:1e5,edit:100});const ee=Ws;var ji=H.forwardRef((n,e)=>{var t,r;function i(N){var{menuItem:W,onMenuItemClick:j}=n;j(W,N)}function o(N){var{menuItem:W,onMenuItemMouseMove:j}=n;j(W,N)}function a(N){var{menuItem:W,onMenuItemContextMenu:j}=n;j(W,N)}function s(N,W,j){if(typeof N.type=="string")return N;var{closeMenu:Y,menuItem:ne,isKeyboardSelected:F,isMouseSelected:q,"data-testid":K}=n,A={menuItem:ne,closeMenu:Y,isKeyboardSelected:F,isMouseSelected:q,iconElement:W,displayShortcut:j,"data-testid":K};return H.cloneElement(N,{forwardedProps:A})}var{children:l,menuItem:d,isKeyboardSelected:h=!1,isMouseSelected:c=!1,"data-testid":f}=n,v=(t=d.shortcutText)!==null&&t!==void 0?t:(r=d.shortcut)===null||r===void 0?void 0:r.getDisplayText(),p=null;if(d.icon){var g=d.icon;if(H.isValidElement(g))p=g;else{var y;d.iconColor!=null&&(d.disabled===void 0||!d.disabled)&&(y={color:d.iconColor}),p=u.jsx(ue,{icon:g,style:y})}}var P=null,O=!!l;d.actions&&(P=u.jsx(ue,{icon:kd}));var _=null;if(d.menuElement)_=u.jsx("div",{className:"custom-menu-item",onMouseMove:o,children:s(d.menuElement,p,v)});else{var R,U=d.disabled,Q=d.iconOutline;_=u.jsx("button",{type:"button",className:Z("btn-context-menu",{disabled:U},{active:(O||c)&&(U===void 0||!U)},{"keyboard-active":h&&(U===void 0||!U)}),onClick:i,onMouseMove:o,onContextMenu:a,title:(R=d.description)!==null&&R!==void 0?R:"",children:u.jsxs("div",{className:"btn-context-menu-wrapper",children:[u.jsx("span",{className:Z("icon",{outline:Q}),children:p}),u.jsx("span",{className:"title",children:d.title}),v!==void 0&&u.jsx("span",{className:"shortcut",children:v}),P&&u.jsx("span",{className:Z("submenu-indicator",{disabled:U}),children:P})]})})}return u.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":f,children:[l,_]})});ji.displayName="ContextMenuItem";ji.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const Rh=ji;var Wr=H.forwardRef((n,e)=>{var{checked:t=!1,children:r,className:i,disabled:o,inputClassName:a,isInvalid:s,labelClassName:l,name:d,onChange:h,"data-testid":c}=n,[f]=m.useState(Mt()),v=Rs(e);m.useEffect(function(){v.current&&(v.current.indeterminate=t===null)},[v,t]);var p=m.useCallback(g=>{v.current&&(v.current.indeterminate=t===null),h&&h(g)},[v,t,h]);return u.jsxs("div",{className:Z("custom-control custom-checkbox",i),children:[u.jsx("input",{type:"checkbox",ref:v,checked:t??!1,className:Z("custom-control-input",a,{"is-invalid":s}),disabled:o,id:f,name:d,onChange:p,"data-testid":c}),u.jsx("label",{className:Z("custom-control-label",l),htmlFor:f,children:r})]})});Wr.displayName="Checkbox";Wr.propTypes={checked:(n,e)=>{var{[e]:t}=n;return t!==null&&typeof t!="boolean"?new Error("Checked must be a boolean or null for indeterminate"):null},children:S.node.isRequired,className:S.string,disabled:S.bool,inputClassName:S.string,isInvalid:S.bool,labelClassName:S.string,name:S.string,onChange:S.func,"data-testid":S.string};Wr.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const kh=Wr;function HC(n){var{copy:e,kind:t="ghost",tooltip:r="Copy",className:i,style:o,"data-testid":a,children:s}=n,[l,d]=qu();return u.jsx(_n,{kind:t,className:i,style:o,"data-testid":a,icon:l?jd:fs,tooltip:l?"Copied":r,onClick:()=>{d(typeof e=="function"?e():e)},children:s})}function So(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function jh(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?So(Object(t),!0).forEach(function(r){zn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):So(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function zn(n,e,t){return e=$h(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $h(n){var e=Hh(n,"string");return typeof e=="symbol"?e:String(e)}function Hh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Us extends m.PureComponent{constructor(e){var t;super(e),zn(this,"container",void 0),zn(this,"oldFocus",void 0),zn(this,"rAF",void 0),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.container=H.createRef(),this.oldFocus=document.activeElement,this.rAF=0;var{options:r}=e,i=(t=r.initialKeyboardIndex)!==null&&t!==void 0?t:-1;this.state={menuItems:[],keyboardIndex:i,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)===null||e===void 0||e.focus();var{onMenuOpened:t}=this.props;t(this)})}componentDidUpdate(e){var{actions:t}=this.props;e.actions!==t&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}getKeyboardIndex(){var{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){var{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){var{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){var{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});var{actions:e}=this.props,t=Ze.getMenuItems(e,!1);t.length>0&&this.setState(r=>({menuItems:Ze.sortActions(r.menuItems.concat(t))}))}handleKeyDown(e){var{menuItems:t}=this.state,r=this.getKeyboardIndex(),i=r;if(e.key==="Enter"||e.key===" "){r!=null&&r>=0&&r<t.length&&this.handleMenuItemClick(t[r],e);return}if(e.key==="Escape")i=null;else if(e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0){var o;i=Ze.getNextMenuItem((o=i)!==null&&o!==void 0?o:0,-1,t)}else if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var a;i=Ze.getNextMenuItem((a=i)!==null&&a!==void 0?a:0,1,t)}r!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{closeMenu:t,onMenuClosed:r}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),r(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation(),e!=null&&(e.disabled===void 0||!e.disabled)&&e.action!=null&&(e.action(t.nativeEvent),this.closeMenu(!0))}handleMenuItemMouseMove(e){var{menuItems:t}=this.state,r=t.indexOf(e);this.setMouseIndex(r)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{"data-testid":t}=this.props,{keyboardIndex:r,menuItems:i,mouseIndex:o}=this.state,a=0;a<i.length;a+=1){var s=i[a];a>0&&s.group!==i[a-1].group&&e.push(u.jsx("hr",{},"".concat(a,".separator")));var l=u.jsx(Rh,{isKeyboardSelected:r===a,isMouseSelected:o===a,menuItem:s,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},a);e.push(l)}var{menuStyle:d}=this.props;return u.jsx("div",{className:"context-menu-container",style:jh({},d),ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}}zn(Us,"defaultProps",{closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});const Bh=Us;function wo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Eo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wo(Object(t),!0).forEach(function(r){Cn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):wo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Cn(n,e,t){return e=Wh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wh(n){var e=Uh(n,"string");return typeof e=="symbol"?e:String(e)}function Uh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Vs extends m.PureComponent{constructor(e){super(e),Cn(this,"container",void 0),Cn(this,"parent",void 0),Cn(this,"popper",void 0),Cn(this,"isOpen",void 0),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=H.createRef(),this.parent=null,this.popper=H.createRef(),this.isOpen=!1}componentDidMount(){var{isShown:e}=this.props;if(e===null){var t;(t=this.container.current)!==null&&t!==void 0&&t.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick))}else e&&this.openMenu()}componentDidUpdate(e){var{isShown:t}=this.props;e.isShown!==t&&(t!==null&&t?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}closeMenu(){var e;(e=this.popper.current)===null||e===void 0||e.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleClick(e){e.preventDefault(),e.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;var{onMenuClosed:e}=this.props;e()}render(){var{actions:e,onMenuOpened:t,popperClassName:r,"data-testid":i}=this.props,{menuStyle:o}=this.props,{options:a,popperOptions:s}=this.props;return s=Eo({placement:"bottom"},s),a=Eo({separateKeyboardMouse:!0},a),u.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":i,children:u.jsx(ki,{ref:this.popper,options:s,className:Z("menu-popper",r),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:u.jsx(Bh,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:a,menuStyle:o})})})}}Cn(Vs,"defaultProps",{isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0});const Gn=Vs;function $t(n,e,t){return e=Vh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Vh(n){var e=Kh(n,"string");return typeof e=="symbol"?e:String(e)}function Kh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var _o=B.module("Shortcut"),L;(function(n){n.CTRL="MODIFIER_CTRL",n.CMD="MODIFIER_CMD",n.ALT="MODIFIER_ALT",n.OPTION="MODIFIER_OPTION",n.SHIFT="MODIFIER_SHIFT"})(L||(L={}));var D;(function(n){n.A="A",n.B="B",n.C="C",n.D="D",n.E="E",n.F="F",n.G="G",n.H="H",n.I="I",n.J="J",n.K="K",n.L="L",n.M="M",n.N="N",n.O="O",n.P="P",n.Q="Q",n.R="R",n.S="S",n.T="T",n.U="U",n.V="V",n.W="W",n.X="X",n.Y="Y",n.Z="Z",n.ZERO="0",n.ONE="1",n.TWO="2",n.THREE="3",n.FOUR="4",n.FIVE="5",n.SIX="6",n.SEVEN="7",n.EIGHT="8",n.NINE="9",n.BACKSPACE="Backspace",n.ESCAPE="Escape",n.ENTER="Enter",n.DELETE="Delete",n.SLASH="/",n.QUESTION_MARK="?",n.BACKSLASH="\\",n.PIPE="|",n.MINUS="-",n.UNDERSCORE="_",n.EQUALS="=",n.PLUS="+",n.BACKTICK="`",n.TILDE="~",n.COMMA=",",n.LEFT_CHEVRON="<",n.PERIOD=".",n.RIGHT_CHEVRON=">",n.SEMICOLON=";",n.COLON=":",n.SINGLE_QUOTE="'",n.DOUBLE_QUOTE='"',n.LEFT_BRACKET="[",n.RIGHT_BRACKET="]",n.LEFT_CURLY="{",n.RIGHT_CURLY="}",n.F1="F1",n.F2="F2",n.F3="F3",n.F4="F4",n.F5="F5",n.F6="F6",n.F7="F7",n.F8="F8",n.F9="F9",n.F10="F10",n.F11="F11",n.F12="F12"})(D||(D={}));var zh=new Set([D.ENTER,D.DELETE,D.F1,D.F2,D.F3,D.F4,D.F5,D.F6,D.F7,D.F8,D.F9,D.F10,D.F11,D.F12]);class ge extends ls{static isAllowedKey(e){return Object.values(D).includes(e)}static isValidKeyState(e){var{keyValue:t}=e;if(t===null)return!0;if(!ge.isMacPlatform&&e.metaKey||!ge.isAllowedKey(t))return!1;var r=!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey;return!r||zh.has(t)}static createKeyState(e){var t={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:e[e.length-1]};return e.forEach(r=>{switch(r){case L.CTRL:t.ctrlKey=!0;break;case L.ALT:case L.OPTION:t.altKey=!0;break;case L.CMD:t.metaKey=!0;break;case L.SHIFT:t.shiftKey=!0;break}}),t}static getKeyStateFromEvent(e){var{key:t,keyCode:r}=e,i="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?i="":!ge.isAllowedKey(t)&&ge.isAllowedKey(String.fromCharCode(r))?i=String.fromCharCode(r):i=t,{keyValue:i,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey}}static getWindowsDisplayText(e){var t="";return e.ctrlKey&&(t+="Ctrl+"),e.altKey&&(t+="Alt+"),e.shiftKey&&(t+="Shift+"),e.keyValue===D.ESCAPE?t+="Esc":e.keyValue!==null&&(t+=e.keyValue),t}static getMacDisplayText(e){var t="";switch(e.ctrlKey&&(t+="⌃"),e.altKey&&(t+="⌥"),e.shiftKey&&(t+="⇧"),e.metaKey&&(t+="⌘"),e.keyValue){case D.ENTER:t+="⏎";break;case D.ESCAPE:t+="⎋";break;case D.BACKSPACE:t+="⌫";break;case D.DELETE:t+="⌦";break;case null:break;default:t+=e.keyValue}return t}static doKeyStatesMatch(e,t){var r,i;return((r=e.keyValue)===null||r===void 0?void 0:r.toUpperCase())===((i=t.keyValue)===null||i===void 0?void 0:i.toUpperCase())&&e.altKey===t.altKey&&e.ctrlKey===t.ctrlKey&&e.metaKey===t.metaKey&&e.shiftKey===t.shiftKey}static getDisplayText(e){return e.keyValue===null?"":ge.isMacPlatform?ge.getMacDisplayText(e):ge.getWindowsDisplayText(e)}constructor(e){var{id:t,shortcut:r,macShortcut:i,isEditable:o=!0,name:a,tooltip:s}=e;super(),$t(this,"id",void 0),$t(this,"name",void 0),$t(this,"tooltip",void 0),$t(this,"isEditable",void 0),$t(this,"defaultKeyState",void 0),$t(this,"keyState",void 0),this.id=t,this.name=a,this.tooltip=s,this.isEditable=o;var l=ge.isMacPlatform,d=l?i:r;this.defaultKeyState=ge.createKeyState(d),this.keyState=this.defaultKeyState}getDisplayText(){return ge.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){ge.isValidKeyState(e)?(_o.debug2("Shortcut ".concat(this.id," updated to ").concat(JSON.stringify(e))),this.keyState=e,this.dispatchEvent(new xs("onUpdate",{detail:this}))):_o.debug2("Shortcut ".concat(this.id," tried to update to invalid keyState ").concat(JSON.stringify(e)))}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return ge.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(ge.NULL_KEY_STATE)}isNull(){return ge.doKeyStatesMatch(this.keyState,ge.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return ge.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(ge.getKeyStateFromEvent(e))}}$t(ge,"NULL_KEY_STATE",{metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null});$t(ge,"isMacPlatform",Ze.isMacPlatform());function Po(n,e,t){return e=Gh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gh(n){var e=qh(n,"string");return typeof e=="symbol"?e:String(e)}function qh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var To=B.module("ShortcutRegistry");class Xh extends ls{constructor(){super(...arguments),Po(this,"shortcutMap",new Map),Po(this,"shortcutsByCategory",new Map)}createAndAdd(e){var t=new ge(e);return this.add(t)}add(e){var t=this.shortcutMap.get(e.id);if(t)return To.warn("Skipping attempt to add duplicate shortcut ID to registry: ".concat(e.id)),t;To.debug2("Adding shortcut to registry: ".concat(e.id)),e.addEventListener("onUpdate",o=>{var{detail:a}=o;return this.dispatchEvent(new xs("onUpdate",{detail:a}))});var r=e.id.split(".")[0];if(this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(r)){var i;(i=this.shortcutsByCategory.get(r))===null||i===void 0||i.push(e)}else this.shortcutsByCategory.set(r,[e]);return e}get(e){return this.shortcutMap.get(e)}getConflictingShortcuts(e){return Array.from(this.shortcutMap.values()).filter(t=>!t.isNull()&&t.matchesKeyState(e))}}var Zh=Object.freeze(new Xh);const ce=Zh;var Yh={COPY:ce.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[L.CTRL,D.C],macShortcut:[L.CMD,D.C],isEditable:!1}),PASTE:ce.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[L.CTRL,D.V],macShortcut:[L.CMD,D.V],isEditable:!1}),SAVE:ce.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[L.CTRL,D.S],macShortcut:[L.CMD,D.S],isEditable:!1}),SELECT_ALL:ce.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[L.CTRL,D.A],macShortcut:[L.CMD,D.A],isEditable:!1}),REOPEN_CLOSED_PANEL:ce.createAndAdd({id:"GLOBAL.REOPEN_CLOSED_PANEL",name:"Re-open Closed Panel",shortcut:[L.ALT,L.SHIFT,D.T],macShortcut:[L.OPTION,L.SHIFT,D.T],isEditable:!0}),LINKER:ce.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[L.CTRL,D.L],macShortcut:[L.CMD,D.L]}),LINKER_CLOSE:ce.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[D.ESCAPE],macShortcut:[D.ESCAPE],isEditable:!1}),COPY_VERSION_INFO:ce.createAndAdd({id:"GLOBAL.COPY_VERSION_INFO",name:"Copy Version Info",shortcut:[L.CTRL,L.ALT,D.I],macShortcut:[L.CMD,L.SHIFT,D.I],isEditable:!0}),NEXT:ce.createAndAdd({id:"GLOBAL.NEXT",name:"Next",shortcut:[D.ENTER],macShortcut:[D.ENTER],isEditable:!1}),PREVIOUS:ce.createAndAdd({id:"GLOBAL.PREVIOUS",name:"Previous",shortcut:[L.SHIFT,D.ENTER],macShortcut:[L.SHIFT,D.ENTER],isEditable:!1})};const Kt=Yh;function pi(n,e,t){return e=Qh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Qh(n){var e=Jh(n,"string");return typeof e=="symbol"?e:String(e)}function Jh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ks extends m.PureComponent{constructor(e){super(e),pi(this,"inputField",void 0),pi(this,"searchChangeSelection",void 0),this.inputField=H.createRef(),this.searchChangeSelection=H.createRef()}componentDidMount(){this.setInputPaddingRight()}componentDidUpdate(){this.setInputPaddingRight()}focus(){var e;(e=this.inputField.current)===null||e===void 0||e.focus()}setInputPaddingRight(){var e=this.inputField.current,t=this.searchChangeSelection.current;if(e&&t){var r=t.getBoundingClientRect().width;e.style.paddingRight="".concat(r,"px")}}render(){var{value:e,placeholder:t,onBlur:r,onChange:i,className:o,disabled:a,matchCount:s,id:l,onKeyDown:d,"data-testid":h,cursor:c}=this.props,f,v=[{action:()=>c?.next("forward"),shortcut:Kt.NEXT},{action:()=>c?.next("back"),shortcut:Kt.PREVIOUS}];return c&&s>1?f=u.jsxs(u.Fragment,{children:[u.jsx(_n,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{c.next("back")},icon:vs,tooltip:"Previous match (".concat(Kt.PREVIOUS.getDisplayText(),")")}),u.jsxs("span",{className:"search-change-text",children:[c.index!==void 0&&"".concat(c.index+1," of "),s]}),u.jsx(_n,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{c.next("forward")},icon:$d,tooltip:"Next match (".concat(Kt.NEXT.getDisplayText(),")")})]}):f=s>0&&u.jsx("span",{className:"search-match",children:s}),u.jsxs("div",{className:Z("search-group",o),children:[u.jsx("input",{type:"search",value:e,onBlur:r,onChange:i,onKeyDown:d,className:"form-control",disabled:a,placeholder:t,ref:this.inputField,id:l,"data-testid":h}),s!=null?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"search-change-selection",ref:this.searchChangeSelection,children:f}),u.jsx(ee,{actions:v})]}):u.jsx("span",{className:"search-icon",children:u.jsx(ue,{icon:Hd})})]})}}pi(Ks,"defaultProps",{placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0,cursor:void 0});const $i=Ks;function zs(n,e,t){return e=ec(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ec(n){var e=tc(n,"string");return typeof e=="symbol"?e:String(e)}function tc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Gs extends m.PureComponent{constructor(e){super(e),zs(this,"searchInput",void 0),this.searchInput=H.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=Pn(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){var{value:t}=this.props;e.value!==t&&this.setState({value:t})}focus(){var e;(e=this.searchInput.current)===null||e===void 0||e.focus()}handleChange(e){this.setState({value:e.target.value},this.sendUpdate)}sendUpdate(){var{onChange:e}=this.props,{value:t}=this.state;e(t)}render(){var{placeholder:e,className:t,matchCount:r,id:i,"data-testid":o}=this.props,{value:a}=this.state;return u.jsx($i,{value:a,placeholder:e,onChange:this.handleChange,className:t,matchCount:r,ref:this.searchInput,id:i,"data-testid":o})}}zs(Gs,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});const nc=Gs;function qs(n,e,t){return e=rc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function rc(n){var e=ic(n,"string");return typeof e=="symbol"?e:String(e)}function ic(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var oc=B.module("ItemListItem");class Ur extends m.Component{static handleKeyDown(){return oc.log("ItemListItem.handleKeyDown false"),!1}constructor(e){super(e),qs(this,"itemRef",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDrag=this.handleDrag.bind(this),this.handleDragOver=this.handleDragOver.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.itemRef=H.createRef()}handleBlur(e){var{itemIndex:t,onBlur:r}=this.props;r(t,e)}handleFocus(e){var{itemIndex:t,onFocus:r}=this.props;r(t,e)}handleClick(e){var{itemIndex:t,onClick:r}=this.props;r(t,e)}handleContextMenu(e){var{itemIndex:t,onContextMenu:r}=this.props;r(t,e)}handleDragStart(e){var{itemIndex:t,onDragStart:r}=this.props;r(t,e)}handleDrag(e){var{itemIndex:t,onDrag:r}=this.props;r(t,e)}handleDragOver(e){e.preventDefault();var{itemIndex:t,onDragOver:r}=this.props;r(t,e)}handleDragEnd(e){var{itemIndex:t,onDragEnd:r}=this.props;r(t,e)}handleDrop(e){var{itemIndex:t,onDrop:r}=this.props;r(t,e)}handleDoubleClick(e){var{itemIndex:t,onDoubleClick:r}=this.props;r(t,e)}handleMouseMove(e){var{itemIndex:t,onMouseMove:r}=this.props;r(t,e)}handleMouseDown(e){var{itemIndex:t,onMouseDown:r}=this.props;r(t,e)}handleMouseUp(e){var{itemIndex:t,onMouseUp:r}=this.props;r(t,e)}render(){var{isDraggable:e,isFocused:t,isSelected:r,style:i,children:o,"data-testid":a}=this.props;return u.jsx("div",{className:Z("item-list-item",{active:r},{"is-focused":t},{"is-draggable":e}),onKeyDown:Ur.handleKeyDown,onContextMenuCapture:this.handleContextMenu,onClick:this.handleClick,onDrag:this.handleDrag,onDragStart:this.handleDragStart,onDragOver:this.handleDragOver,onDragEnd:this.handleDragEnd,onDrop:this.handleDrop,onDoubleClick:this.handleDoubleClick,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,tabIndex:-1,ref:this.itemRef,role:"listitem",style:i,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:e,"data-testid":a,children:o})}}qs(Ur,"defaultProps",{children:null,isDraggable:!1,isFocused:!1,isSelected:!1,itemIndex:0,"data-testid":void 0,onBlur(){},onClick(){},onContextMenu(){},onDragStart(){},onDrag(){},onDragOver(){},onDragEnd(){},onDrop(){},onDoubleClick(){},onFocus(){},onMouseDown(){},onMouseMove(){},onMouseUp(){},style:{}});const ac=Ur;function Oo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Io(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Oo(Object(t),!0).forEach(function(r){rt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Oo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function rt(n,e,t){return e=sc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sc(n){var e=lc(n,"string");return typeof e=="symbol"?e:String(e)}function lc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Do=B.module("ItemList"),xo=5;class Ye extends m.PureComponent{static renderItem(e){var t,r,{item:i}=e;return u.jsx("div",{className:"item-list-item-content",children:i!=null&&((t=(r=i.displayValue)!==null&&r!==void 0?r:i.value)!==null&&t!==void 0?t:"".concat(i))})}constructor(e){super(e),rt(this,"list",void 0),rt(this,"listContainer",void 0),rt(this,"getItemSelected",bn((i,o)=>It.isSelected(o,i),{max:Ye.CACHE_SIZE})),rt(this,"getCachedItem",bn((i,o,a,s,l,d,h,c)=>{var f=d({item:a,itemIndex:i,isFocused:s,isSelected:l,style:h});return u.jsx(ac,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:c,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:s,isSelected:l,itemIndex:i,style:h,children:f},o)},{max:Ye.CACHE_SIZE})),rt(this,"getOuterElement",bn(i=>{var o=H.forwardRef((a,s)=>u.jsx("div",Io({ref:s,tabIndex:-1,onKeyDown:i,role:"presentation"},a)));return o.displayName="ItemListOuterElement",o})),rt(this,"getInnerElement",bn(()=>{var i=H.forwardRef((o,a)=>u.jsx("div",Io({className:"item-list-inner-element",ref:a},o)));return i.displayName="ItemListInnerElement",i})),rt(this,"getItemData",bn((i,o,a)=>({items:i,selectedRanges:o,renderItem:a}))),this.handleItemBlur=this.handleItemBlur.bind(this),this.handleItemContextMenu=this.handleItemContextMenu.bind(this),this.handleItemFocus=this.handleItemFocus.bind(this),this.handleItemDoubleClick=this.handleItemDoubleClick.bind(this),this.handleItemMouseDown=this.handleItemMouseDown.bind(this),this.handleItemMouseMove=this.handleItemMouseMove.bind(this),this.handleItemMouseUp=this.handleItemMouseUp.bind(this),this.handleItemsRendered=this.handleItemsRendered.bind(this),this.handleWindowMouseUp=this.handleWindowMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleResize=this.handleResize.bind(this),this.renderInnerElement=this.renderInnerElement.bind(this),this.list=H.createRef(),this.listContainer=H.createRef();var{isStickyBottom:t,selectedRanges:r}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:r,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null,mouseX:null,mouseY:null}}componentDidUpdate(e,t){var{selectedRanges:r,itemCount:i}=this.props,{focusIndex:o,isStuckToBottom:a,scrollOffset:s,height:l,selectedRanges:d}=this.state;if(a&&!this.isListAtBottom()&&i>0&&this.scrollToBottom(),(s!==t.scrollOffset||l!==t.height)&&this.sendViewportUpdate(),r!==e.selectedRanges&&r!==d)this.setSelectedRanges(r);else if(d!==t.selectedRanges){var{onSelectionChange:h}=this.props;h(d)}if(o!==t.focusIndex){var{onFocusChange:c}=this.props;c(o)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var e;(e=this.listContainer.current)===null||e===void 0||e.focus()}restoreScrollPosition(){var{scrollOffset:e}=this.state;if(e!=null){var t;(t=this.listContainer.current)===null||t===void 0||t.scrollTo(0,e)}}getElement(e){if(this.listContainer.current==null)return null;var{focusSelector:t}=this.props,{overscanStartIndex:r}=this.state,i=this.listContainer.current.querySelectorAll(t),o=e-r;return i[o]}focusItem(e){var{disableSelect:t}=this.props;if(!t){this.setState({focusIndex:e});var r=this.getElement(e);r instanceof HTMLElement&&r.focus()}}scrollToItem(e){var t=this.getElement(e);t?.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){this.setState({focusIndex:e});var{selectedRanges:r}=this.state,i=It.isSelected(r,e),o=i||Ze.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,o,!1)}handleItemDoubleClick(e,t){var{isDoubleClickSelect:r,onSelect:i}=this.props;r&&this.setState(o=>{var{selectedRanges:a}=o;return{selectedRanges:It.selectRange(a,[e,e])}},()=>{i(e,t)})}handleItemMouseDown(e,t){var{selectedRanges:r}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&r.length===0){this.focusItem(e),this.selectItem(e);return}t.button!=null&&t.button!==0||(this.setState({mouseDownIndex:e,mouseX:t.clientX,mouseY:t.clientY}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(e,t){Do.debug2("item blur",e,t.currentTarget,t.relatedTarget),(!t.relatedTarget||this.listContainer.current&&t.relatedTarget instanceof HTMLElement&&!this.listContainer.current.contains(t.relatedTarget))&&this.setState({focusIndex:null})}handleItemFocus(e,t){Do.debug2("item focus",e,t.target),this.setState(r=>{var{focusIndex:i}=r;return i!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){var{isDragSelect:r,isMultiSelect:i,disableSelect:o}=this.props,{mouseDownIndex:a,selectedRanges:s,mouseX:l,mouseY:d}=this.state;if(!(a==null||o)){var h=Math.abs(t.clientX-(l??0)),c=Math.abs(t.clientY-(d??0));h>xo&&c>xo&&this.setState({isDragging:!0}),(r||a===e)&&(this.focusItem(e),i?(!r&&!this.getItemSelected(e,s)&&!Ze.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(a,e),Math.max(a,e)])):this.toggleSelect(e,t.shiftKey,Ze.isModifierKeyDown(t),!1))}}handleItemMouseUp(e,t){var{isDeselectOnClick:r,isDoubleClickSelect:i,onSelect:o}=this.props,{mouseDownIndex:a,isDragging:s}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(a===e&&!s){var l=t.shiftKey,d=Ze.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,l,d,r),!i&&!l&&!d&&o(e,t)}this.resetMouseState()}}handleItemsRendered(e){var{overscanStartIndex:t}=e;this.setState({overscanStartIndex:t})}handleResize(e){var{height:t}=e;this.setState({height:t})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(e){var{isMultiSelect:t,itemCount:r,onSelect:i}=this.props,{focusIndex:o}=this.state,a=o;if(e.key==="Enter"||e.key===" "){!t&&a!=null&&this.setState({selectedRanges:[[a,a]]},()=>{a!=null&&i(a,e)});return}if(e.key==="ArrowUp")a!=null&&a>=0?a=Math.max(0,a-1):a=r-1;else if(e.key==="ArrowDown")a!=null&&a>=0?a=Math.min(a+1,r-1):a=0;else return;if(o!==a){e.stopPropagation(),e.preventDefault(),this.focusItem(a);var{selectedRanges:s}=this.state;if(e.shiftKey&&s.length>0){var l=s[s.length-1];this.selectRange([Math.min(a,l[0]),Math.max(a,l[1])])}else if(this.deselectAll(),a!==null)this.selectItem(a);else{var d;(d=this.listContainer.current)===null||d===void 0||d.focus()}this.scrollIntoView(a)}}handleScroll(e){var{scrollUpdateWasRequested:t,scrollOffset:r}=e;this.setState(i=>{if(t)return{scrollOffset:r};var{isStickyBottom:o}=this.props,{height:a}=i,s=o&&this.isListAtBottom({scrollOffset:r,height:a});return{isStuckToBottom:s,scrollOffset:r}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){var{itemCount:e}=this.props;this.list.current&&this.list.current.scrollToItem(e)}scrollIntoView(e){this.list.current&&this.list.current.scrollToItem(e)}toggleSelect(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,{isMultiSelect:o}=this.props,{selectedRanges:a}=this.state;if(o&&t&&a.length>0){var s=a[a.length-1];this.selectRange([Math.min(s[0],e),Math.max(e,s[1])])}else o&&a.length===1&&a[0][0]===e&&a[0][1]===e?i&&this.deselectItem(e):o&&r?this.getItemSelected(e,a)?i&&this.deselectItem(e):this.selectItem(e):(this.deselectAll(),this.selectItem(e))}deselectAll(){var{itemCount:e}=this.props;this.deselectRange([0,e])}deselectItem(e){this.deselectRange([e,e])}deselectRange(e){It.validateRange(e),this.setState(t=>{var{selectedRanges:r}=t;return{selectedRanges:It.deselectRange(r,e)}})}selectItem(e){var{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){It.validateRange(e),this.setState(t=>{var{selectedRanges:r}=t;return{selectedRanges:It.selectRange(r,e)}})}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){var{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){var{onViewportChange:r,rowHeight:i}=this.props,o=Math.floor(e/i),a=o+Math.ceil(t/i);r(o,a)}}isListAtBottom(){var{scrollOffset:e,height:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.state;if(t==null||e==null)return!1;var{itemCount:r,rowHeight:i}=this.props;return e+t>=r*i}renderInnerElement(e){var{index:t,style:r}=e,{items:i,offset:o,renderItem:a,disableSelect:s}=this.props,{focusIndex:l,selectedRanges:d}=this.state;if(t<o||t>=o+i.length)return null;var h=i[t-o];return this.getCachedItem(t,t,h,t===l&&!s,this.getItemSelected(t,d),a,r,s)}render(){var{items:e,itemCount:t,overscanCount:r,renderItem:i,rowHeight:o,"data-testid":a}=this.props,{selectedRanges:s,isStuckToBottom:l}=this.state;return u.jsx(bd,{className:"item-list-auto-sizer",onResize:this.handleResize,children:d=>{var{width:h,height:c}=d;return u.jsx(yd,{className:"item-list-scroll-pane",height:c,width:h,initialScrollOffset:l?t*o:0,itemCount:t,itemSize:o,itemData:this.getItemData(e,s,i),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:r,"data-testid":a,children:this.renderInnerElement})}})}}rt(Ye,"CACHE_SIZE",1e3);rt(Ye,"DEFAULT_ROW_HEIGHT",20);rt(Ye,"DEFAULT_OVERSCAN",10);rt(Ye,"defaultProps",{offset:0,items:[],rowHeight:Ye.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Ye.DEFAULT_OVERSCAN,renderItem:Ye.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0});var dc=B.module("ErrorBoundary");class uc extends m.Component{static getDerivedStateFromError(e){return{error:e}}constructor(e){super(e),this.state={error:void 0}}componentDidCatch(e,t){var{onError:r}=this.props;dc.error("Error caught by ErrorBoundary",e,t),r?.(e,t)}render(){var{children:e,className:t,fallback:r}=this.props,{error:i}=this.state;return i!=null?r??u.jsx("div",{className:t,children:u.jsx(un,{errorMessage:"".concat(i),isLoading:!1,isLoaded:!1})}):e}}function hc(n){var{on:e,id:t,className:r,isInvalid:i,disabled:o=!1,onClick:a,"data-testid":s}=n;return u.jsx("button",{type:"button",className:Z("btn","btn-switch",r,{active:e},{"is-invalid":i}),id:t,onClick:a,disabled:o,"data-testid":s,children:u.jsx("div",{className:"handle"})})}var cc=["className","timeout"];function Mo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function mc(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Mo(Object(t),!0).forEach(function(r){fc(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Mo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function fc(n,e,t){return e=vc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function vc(n){var e=gc(n,"string");return typeof e=="symbol"?e:String(e)}function gc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function pc(n,e){if(n==null)return{};var t=bc(n,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function bc(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function BC(n){var{className:e,timeout:t=us.transitionMs}=n,r=pc(n,cc);return u.jsx(ss,mc({timeout:t,classNames:Z("fade",e)},r))}var yc=["children","className","isInvalid","onChange","data-testid"];function No(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ao(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?No(Object(t),!0).forEach(function(r){Cc(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):No(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Cc(n,e,t){return e=Sc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sc(n){var e=wc(n,"string");return typeof e=="symbol"?e:String(e)}function wc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Ec(n,e){if(n==null)return{};var t=_c(n,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function _c(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var Xs=H.forwardRef((n,e)=>{var{children:t,className:r,isInvalid:i,onChange:o,"data-testid":a}=n,s=Ec(n,yc),l=Rs(e),d=m.useCallback(h=>{o(h.target.value)},[o]);return u.jsx("select",Ao(Ao({ref:l,className:Z("custom-select",r,{"is-invalid":i}),onChange:d,"data-testid":a},s),{},{children:t}))});Xs.displayName="Select";const Pc=Xs;function Tc(){return nr(Bd,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function Zs(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.name!=null}function Ys(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.id!=null}function WC(n){return Zs(n)||Ys(n)}var Oc=m.createContext(null);function UC(n){if(Ys(n))return{id:n.id,type:n.type};if(Zs(n)){var e;return{name:(e=n.name)!==null&&e!==void 0?e:"",type:n.type}}throw new Error("Invalid descriptor: ".concat(n))}function Ic(n){var e,t;return{type:(e=n.type)!==null&&e!==void 0?e:"",name:(t=n.title)!==null&&t!==void 0?t:n.name,id:n.id}}function VC(){return nr(Oc,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}function Dc(n){var{type:e}=n,t=Tc();switch(e){case t.VariableType.TABLE:case t.VariableType.TABLEMAP:case t.VariableType.TREETABLE:case t.VariableType.HIERARCHICALTABLE:case t.VariableType.PARTITIONEDTABLE:return u.jsx(ue,{icon:bs});case t.VariableType.FIGURE:return u.jsx(ue,{icon:ps});case t.VariableType.PANDAS:return u.jsx(ue,{icon:Wd});default:return u.jsx(ue,{icon:gs})}}function Lo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function xc(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Lo(o,r,i,a,s,"next",l)}function s(l){Lo(o,r,i,a,s,"throw",l)}a(void 0)})}}function Qs(n){var{children:e,language:t}=n,[r,i]=m.useState(null),{activeThemes:o}=$s();return m.useEffect(()=>{var a=!1;function s(){return l.apply(this,arguments)}function l(){return l=xc(function*(){if(e!=null&&o!=null){var d=yield lt.colorize(e.toString(),t,{});a||i(d)}}),l.apply(this,arguments)}return s(),()=>{a=!0}},[o,e,t]),u.jsx("div",{style:{pointerEvents:"none"},dangerouslySetInnerHTML:r!=null?{__html:r}:void 0})}class Mc{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}const Js=Mc;class xr{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)?[]:Cd.parse(e).filter(t=>!this.hasComment(t)).map(t=>this.hasPattern(t)?t.pattern:this.hasOp(t)?t.op:"".concat(t))}static formatTimestamp(e){if(e==null||!(e instanceof Date))return null;var t="".concat(e.getHours()).padStart(2,"0"),r="".concat(e.getMinutes()).padStart(2,"0"),i="".concat(e.getSeconds()).padStart(2,"0"),o="".concat(e.getMilliseconds()).padStart(3,"0");return"".concat(t,":").concat(r,":").concat(i,".").concat(o)}static isTableType(e,t){return t===e.VariableType.TABLE||t===e.VariableType.TREETABLE||t===e.VariableType.HIERARCHICALTABLE||t===e.VariableType.PARTITIONEDTABLE}static isWidgetType(e,t){return t===e.VariableType.FIGURE||t===e.VariableType.OTHERWIDGET||t===e.VariableType.PANDAS}static isOpenableType(e,t){return xr.isTableType(e,t)||xr.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}const bi=xr;function el(n){var{children:e}=n;return u.jsxs("div",{className:"console-history-item-result",children:[u.jsx("div",{className:"console-history-gutter",children:"-"}),u.jsx("div",{className:"console-history-content",children:e})]})}el.propTypes={children:S.node.isRequired};function yi(n,e,t){return e=Nc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Nc(n){var e=Ac(n,"string");return typeof e=="symbol"?e:String(e)}function Ac(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class tl extends m.Component{constructor(e){super(e),yi(this,"timer",void 0),yi(this,"startTime",void 0),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer&&clearInterval(this.timer),this.timer=void 0}updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){var{disabled:e,onCancelClick:t}=this.props,{elapsed:r}=this.state;return u.jsx("div",{className:Z("console-history-result-in-progress",{disabled:e}),children:u.jsxs("span",{className:"badge",children:[u.jsx(ys,{className:"ml-2"}),"Running... ",Ls.formatElapsedTime(r)," ",u.jsx(se,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:Ud,tooltip:"Cancel",onClick:t,disabled:e})]})})}}yi(tl,"defaultProps",{disabled:!1});const Lc=tl;function qn(n,e,t){return e=Fc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fc(n){var e=Rc(n,"string");return typeof e=="symbol"?e:String(e)}function Rc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Tn extends m.PureComponent{constructor(e){super(e),qn(this,"mouseX",void 0),qn(this,"mouseY",void 0),qn(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)>=Tn.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=Tn.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(e){this.isClicking&&!e.shiftKey&&!e.metaKey&&!e.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(e=>({isExpanded:!e.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){var{isExpanded:e,isTriggerHovered:t}=this.state,{message:r}=this.props;k(r);var i=r.indexOf(`
|
|
3
|
-
`),o=i>-1,a=r;o&&(a=r.slice(0,i));var s=r.slice(i),l=t?"error-btn-link error-btn-link--active":"error-btn-link";return u.jsxs("div",{className:Z("error-message",{expanded:e}),children:[o&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"error-gutter",children:u.jsx("button",{type:"button",onClick:this.handleToggleError,className:l,tabIndex:-1,children:u.jsx(ue,{icon:e?jn:Vd,transform:"left-3"})})}),u.jsxs("div",{className:"error-content",children:[u.jsx("div",{className:"console-error-text-trigger",role:"button",tabIndex:0,onKeyPress:this.handleKeyPress,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onMouseUp:this.handleMouseUp,children:a}),e?s:""]})]}),!o&&u.jsx("div",{className:"error-content",children:u.jsx("div",{className:"console-error-text",children:a})})]},"error")}}qn(Tn,"defaultProps",{message:""});qn(Tn,"mouseDragThreshold",5);const kc=Tn;function jc(n,e,t){return e=$c(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $c(n){var e=Hc(n,"string");return typeof e=="symbol"?e:String(e)}function Hc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Fo=B.module("ConsoleHistoryItem");class nl extends m.PureComponent{constructor(e){super(e),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){Fo.debug("handleObjectClick",e);var{openObject:t}=this.props;t(e)}handleCancelClick(){var{item:e}=this.props;e!=null&&e.cancelResult&&(Fo.debug("Cancelling command: ".concat(e.command)),e.cancelResult())}render(){var{disabled:e,item:t,language:r,iconForType:i}=this.props,{disabledObjects:o,result:a}=t,s=t.command!=null&&t.command!=="",l=null;s&&(l=u.jsxs("div",{className:"console-history-item-command",children:[u.jsx("div",{className:"console-history-gutter",children:">"}),u.jsx("div",{className:"console-history-content",children:u.jsx(Qs,{language:r,children:t.command})})]}));var d=[],h=!1;if(a){var{error:c,message:f,changes:v}=a;if(v){var{created:p,updated:g}=v;[...p,...g].forEach(Q=>{h=!0;var{title:N}=Q,W="".concat(N),j=e===void 0||e||(o??[]).indexOf(W)>=0,Y=u.jsx(se,{kind:"primary",onClick:()=>this.handleObjectClick(Q),className:"btn-console-object",disabled:j,icon:i(Q.type),children:N},W);d.push(Y)})}if(c!=null&&!s){var y,P="".concat((y=c.message)!==null&&y!==void 0?y:c);P||(P=c);var O=u.jsx(kc,{message:P},"result-error");d.push(O)}if(f!==void 0&&f!==""){var _=u.jsx("div",{className:"log-message",children:f},"log-message");d.push(_)}}else{h=!0;var R=u.jsx(Lc,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");d.push(R)}var U=null;return d.length>0&&(U=u.jsx(el,{children:d})),u.jsxs("div",{className:Z("console-command-result",{"console-result-buttons":h}),children:[l,U]})}}jc(nl,"defaultProps",{disabled:!1});const Bc=nl;function Wc(n,e){return"".concat(n,".").concat(e.command,".").concat(e.result&&e.result.message,".").concat(e.result&&e.result.error)}function Uc(n){for(var{disabled:e=!1,items:t,language:r,openObject:i,supportsType:o,iconForType:a}=n,s=[],l=0;l<t.length;l+=1){var d=t[l],h=u.jsx(Bc,{disabled:e,item:d,openObject:i,language:r,supportsType:o,iconForType:a},Wc(l,d));s.push(h)}return u.jsx("div",{className:"container-fluid console-history",children:s})}var Vc={name:"Console",CLEAR:ce.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[L.CTRL,D.L],macShortcut:[L.CTRL,D.C]}),FOCUS_HISTORY:ce.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[L.CTRL,D.H],macShortcut:[L.CTRL,L.OPTION,D.H]})},Kc={name:"Command History",FOCUS_HISTORY:ce.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[L.CTRL,D.H],macShortcut:[L.CTRL,L.OPTION,D.H]}),SEND_TO_CONSOLE:ce.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[D.ENTER],macShortcut:[D.ENTER]}),SEND_TO_NOTEBOOK:ce.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[L.CTRL,D.ENTER],macShortcut:[L.CMD,D.ENTER]}),RUN:ce.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[L.ALT,D.R],macShortcut:[L.OPTION,D.R]})},zc={name:"Notebook",RUN:ce.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[L.ALT,D.R],macShortcut:[L.OPTION,D.R]}),RUN_SELECTED:ce.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[L.ALT,L.SHIFT,D.R],macShortcut:[L.OPTION,L.SHIFT,D.R]}),FIND:ce.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[L.CTRL,D.F],macShortcut:[L.CMD,D.F],isEditable:!1}),MINIMAP:ce.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[L.ALT,D.M],macShortcut:[L.OPTION,D.M]}),WORDWRAP:ce.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[L.ALT,D.Z],macShortcut:[L.OPTION,D.Z]})},Gc={CONSOLE:Vc,COMMAND_HISTORY:Kc,NOTEBOOK:zc};const ke=Gc,Oe=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),qc="var(--dh-color-editor-bg)",Xc="var(--dh-color-editor-fg)",Zc="var(--dh-color-editor-string)",Yc="var(--dh-color-editor-delimiter)",Qc="var(--dh-color-editor-predefined)",Jc="var(--dh-color-editor-keyword)",em="var(--dh-color-editor-storage)",tm="var(--dh-color-editor-number)",nm="var(--dh-color-editor-operator)",rm="var(--dh-color-editor-identifier)",im="var(--dh-color-editor-comment)",Ci={"error-foreground":"var(--dh-color-editor-error-fg)",background:qc,foreground:Xc,"line-height":"19px",string:Zc,"string-delim":"var(--dh-color-editor-string-delim)",delimiter:Yc,predefined:Qc,keyword:Jc,storage:em,number:tm,operator:nm,identifier:rm,"namespace-identifier":"var(--dh-color-editor-identifier-namespace)","identifier-js":"var(--dh-color-editor-identifier-js)",comment:im,"editor-bracket-foreground1":"var(--dh-color-editor-bracket-fg1)","editor-bracket-foreground2":"var(--dh-color-editor-bracket-fg2)","editor-bracket-foreground3":"var(--dh-color-editor-bracket-fg3)","editor-bracket-foreground4":"var(--dh-color-editor-bracket-fg4)","editor-bracket-foreground5":"var(--dh-color-editor-bracket-fg5)","editor-bracket-foreground6":"var(--dh-color-editor-bracket-fg6)","editor-unexpected-bracket-foreground":"var(--dh-color-editor-unexpected-bracket-fg)","input-option-active-border":"var(--dh-color-editor-input-option-active-border)","focus-border":"var(--dh-color-editor-focus-border)","input-background":"var(--dh-color-editor-input-bg)","input-foreground":"var(--dh-color-editor-input-fg)","input-border":"var(--dh-color-editor-input-border)","editor-line-number-foreground":"var(--dh-color-editor-line-number-fg)","editor-line-number-active-foreground":"var(--dh-color-editor-line-number-active-fg)","editor-selection-background":"var(--dh-color-editor-selection-bg)","editor-inactive-selection-background":"var(--dh-color-editor-inactive-selection-bg)","editor-selection-highlight-background":"var(--dh-color-editor-selection-highlight-bg)","editor-line-highlight-background":"var(--dh-color-editor-line-highlight-bg)","editor-word-highlight-background":"var(--dh-color-editor-word-highlight-bg)","context-menu-background":"var(--dh-color-editor-context-menu-bg)","context-menu-foreground":"var(--dh-color-editor-context-menu-fg)","menu-selection-background":"var(--dh-color-editor-menu-selection-bg)","menu-selection-foreground":"var(--dh-color-editor-menu-selection-fg)","log-date":"var(--dh-color-editor-log-date)","log-error":"var(--dh-color-editor-log-error)","log-info":"var(--dh-color-editor-log-info)","log-stdout":"var(--dh-color-editor-log-stdout)","log-warn":"var(--dh-color-editor-log-warn)","log-debug":"var(--dh-color-editor-log-debug)","log-trace":"var(--dh-color-editor-log-trace)","editor-find-match-background":"var(--dh-color-editor-find-match-bg)","editor-find-match-highlight-background":"var(--dh-color-editor-find-match-highlight-bg)","editor-widget-background":"var(--dh-color-editor-find-bg)","input-option-active-background":"var(--dh-color-editor-find-option-active-bg)","input-option-active-foreground":"var(--dh-color-editor-find-option-active-fg)","editor-suggest-widget-background":"var(--dh-color-editor-suggest-bg)","editor-suggest-widget-border":"var(--dh-color-editor-suggest-border)","editor-suggest-widget-foreground":"var(--dh-color-editor-suggest-fg)","editor-suggest-widget-selected-background":"var(--dh-color-editor-suggest-selected-bg)","editor-suggest-widget-selected-foreground":"var(--dh-color-editor-suggest-selected-fg)","editor-suggest-widget-highlightForeground":"var(--dh-color-editor-suggest-highlight-fg)","editor-suggest-widget-focus-highlight-foreground":"var(--dh-color-editor-suggest-focus-highlight-fg)","list-hover-background":"var(--dh-color-editor-suggest-hover-bg)","text-link-foreground":"var(--dh-color-editor-link-foreground)","text-link-active-foreground":"var(--dh-color-editor-link-active-fg)","editor-link-active-foreground":"var(--dh-color-editor-link-active-fg)"};var om="python",am={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},sm={keywords:["and","del","from","not","while","as","elif","global","or","with","assert","else","if","pass","yield","break","except","import","print","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"]]}},lm={id:om,conf:am,language:sm};const dm=lm;var um="groovy",hm={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/}}},cm={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"]]}},mm={id:um,conf:hm,language:cm};const fm=mm;var vm="scala",gm={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>))/}}},pm={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"]]}},bm={id:vm,conf:gm,language:pm};const ym=bm;var Cm="deephavenDb",Sm={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/}}},wm={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"]]}},Em={id:Cm,conf:Sm,language:wm};const _m=Em;var Pm="log",Tm={},Om={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"}]]}},Im={id:Pm,conf:Tm,language:Om};const Dm=Im;function Ro(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ko(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ro(Object(t),!0).forEach(function(r){xm(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ro(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function xm(n,e,t){return e=Mm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mm(n){var e=Nm(n,"string");return typeof e=="symbol"?e:String(e)}function Nm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Et=B.module("MonacoUtils");class Dt{static init(){var{getWorker:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Et.debug("Initializing Monaco..."),e!==void 0&&Dt.registerGetWorker(e);var{initTheme:t,registerLanguages:r}=Dt;t(),r([_m,dm,fm,Dm,ym]),Dt.removeConflictingKeybindings(),Et.debug("Monaco initialized.")}static initTheme(){var e,t,{removeHashtag:r}=Dt,i=Cs(Ci);Et.debug2("Monaco theme:",Ci),Et.debug2("Monaco theme derived:",i);var o=[{token:"",foreground:r(i.foreground)},{token:"string",foreground:r(i.string)},{token:"string.delim",foreground:r(i["string-delim"])},{token:"keyword",foreground:r(i.keyword)},{token:"identifier.js",foreground:r(i["identifier-js"])},{token:"delimiter",foreground:r(i.delimiter)},{token:"comment",foreground:r(i.comment)},{token:"number",foreground:r(i.number)},{token:"storage",foreground:r(i.storage)},{token:"identifier",foreground:r(i.identifier)},{token:"namespace.identifier",foreground:r(i["namespace-identifier"])},{token:"operator",foreground:r(i.operator)},{token:"predefined",foreground:r(i.predefined)},{token:"error.log",foreground:(e=(t=i["log-error"])===null||t===void 0?void 0:t.substring(1))!==null&&e!==void 0?e:""},{token:"warn.log",foreground:r(i["log-warn"])},{token:"info.log",foreground:r(i["log-info"])},{token:"stdout.log",foreground:r(i["log-stdout"])},{token:"trace.log",foreground:r(i["log-trace"])},{token:"debug.log",foreground:r(i["log-debug"])},{token:"date.log",foreground:r(i["log-date"])}],a={foreground:i.foreground,errorForeground:i["error-foreground"],"inputOption.activeBorder":i["input-option-active-border"],"editor.background":i.background,"editor.foreground":i.foreground,"editor.lineHighlightBackground":i["editor-line-highlight-background"],"editorLineNumber.foreground":i["editor-line-number-foreground"],"editorLineNumber.activeForeground":i["editor-line-number-active-foreground"],"editor.selectionBackground":i["editor-selection-background"],"editor.inactiveSelectionBackground":i["editor-inactive-selection-background"],"editor.selectionHighlightBackground":i["editor-selection-highlight-background"],"editor.wordHighlightBackground":i["editor-word-highlight-background"],"editor.findMatchBackground":i["editor-find-match-background"],"editor.findMatchHighlightBackground":i["editor-find-match-highlight-background"],"editorSuggestWidget.background":i["editor-suggest-widget-background"],"editorSuggestWidget.border":i["editor-suggest-widget-border"],"editorSuggestWidget.foreground":i["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":i["editor-suggest-widget-selected-background"],"list.activeSelectionBackground":i["editor-suggest-widget-selected-background"],"editorSuggestWidget.selectedForeground":i["editor-suggest-widget-selected-foreground"],"list.activeSelectionForeground":i["editor-suggest-widget-selected-foreground"],"editorSuggestWidget.highlightForeground":i["editor-suggest-widget-highlightForeground"],"editorSuggestWidget.focusHighlightForeground":i["editor-suggest-widget-focus-highlight-foreground"],"list.hoverBackground":i["list-hover-background"],"dropdown.background":i["context-menu-background"],"dropdown.foreground":i["context-menu-foreground"],"menu.selectionBackground":i["menu-selection-background"],"menu.selectionForeground":i["menu-selection-foreground"],"keybindingLabel.foreground":i["menu-selection-foreground"],"list.focusBackground":i["menu-selection-background"],"editorWidget.background":i["editor-widget-background"],"inputOption.activeBackground":i["input-option-active-background"],"inputOption.activeForeground":i["input-option-active-foreground"],focusBorder:i["focus-border"],"input.background":i["input-background"],"input.foreground":i["input-foreground"],"input.border":i["input-border"],"textLink.foreground":i["text-link-foreground"],"textLink.activeForeground":i["text-link-active-foreground"],"editorLink.activeForeground":i["editor-link-active-foreground"],"editorBracketHighlight.foreground1":i["editor-bracket-foreground1"],"editorBracketHighlight.foreground2":i["editor-bracket-foreground2"],"editorBracketHighlight.foreground3":i["editor-bracket-foreground3"],"editorBracketHighlight.foreground4":i["editor-bracket-foreground4"],"editorBracketHighlight.foreground5":i["editor-bracket-foreground5"],"editorBracketHighlight.foreground6":i["editor-bracket-foreground6"],"editorBracketHighlight.unexpectedBracket.foreground":i["editor-unexpected-bracket-foreground"]};lt.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:o,colors:a});try{lt.setTheme("dh-dark")}catch(s){Et.error("Failed to set 'dh-dark' Monaco theme, falling back to vs-dark",s),lt.setTheme("vs-dark")}}static registerGetWorker(e){window.MonacoEnvironment=ko(ko({},window.MonacoEnvironment),{},{getWorker:e})}static removeHashtag(e){var t;return(t=e?.substring(1))!==null&&t!==void 0?t:""}static registerLanguages(e){var t=e.map(r=>{var{id:i}=r;return i});pt.getLanguages().filter(r=>{var{id:i}=r;return t.includes(i)}).forEach(r=>{var i=r;Et.debug2("Overriding default language loader:",i.id)}),e.forEach(r=>{Dt.registerLanguage(r)})}static registerLanguage(e){Et.debug2("Registering language: ",e.id),pt.register(e),pt.onLanguage(e.id,()=>{pt.setLanguageConfiguration(e.id,e.conf),pt.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:lt.EndOfLineSequence.LF;(t=e.getModel())===null||t===void 0||t.setEOL(r)}static openDocument(e,t){var r=e.getModel();k(r);var i={textDocument:{uri:"".concat(r.uri),languageId:r.getLanguageId(),version:r.getVersionId(),text:r.getValue()}};Et.debug2("didOpenDocumentParams: ",i),t.openDocument(i);var o=e.onDidChangeModelContent(a=>{for(var{changes:s,versionId:l}=a,d=[],h=0;h<s.length;h+=1){var c=s[h],{range:f,rangeLength:v,text:p}=c,g={range:{start:{line:f.startLineNumber-1,character:f.startColumn-1},end:{line:f.endLineNumber-1,character:f.endColumn-1}},rangeLength:v,text:p};d.push(g)}if(d.length>0){var y={textDocument:{version:l,uri:"".concat(r.uri)},contentChanges:d};Et.debug2("didChangeDocumentParams",y),t.changeDocument(y)}});return o}static closeDocument(e,t){var r=e.getModel();k(r);var i={textDocument:{uri:"".concat(r.uri)}};t.closeDocument(i)}static registerPasteHandler(e){e.onDidPaste(t=>{var r=/“|”/g,i=/\u200b/g,o=/\u00A0/g,a=e.getModel();k(a);var s=a.getValueInRange(t.range);(r.test(s)||i.test(s)||o.test(s))&&a.applyEdits([{range:t.range,text:s.replace(r,'"').replace(i,"").replace(o," ")}])})}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static removeConflictingKeybindings(){lt.addKeybindingRule({keybinding:ze.CtrlCmd|Gt.KeyD,command:null}),Dt.isMacPlatform()||lt.addKeybindingRule({keybinding:ze.CtrlCmd|Gt.KeyH,command:null})}static disableKeyBindings(e,t){e.addAction({id:"disable-keybindings-".concat(Mt()),label:"",keybindings:t,run:()=>{}})}static getMonacoKeyCodeFromShortcut(e){var{keyState:t}=e,{keyValue:r}=t;if(r===null)return 0;var i=Dt.isMacPlatform();return i?(t.metaKey?ze.CtrlCmd:0)|(t.shiftKey?ze.Shift:0)|(t.altKey?ze.Alt:0)|(t.ctrlKey?ze.WinCtrl:0)|oo.fromString(r):(t.ctrlKey?ze.CtrlCmd:0)|(t.shiftKey?ze.Shift:0)|(t.altKey?ze.Alt:0)|(t.metaKey?ze.WinCtrl:0)|oo.fromString(r)}static provideLinks(e){for(var t=[],r=function(a){var s=e.getLineContent(a),l=Sd(s),d=l.filter(h=>h.type==="url"?/^https?:\/\//.test(h.value):!0);d.forEach(h=>{t.push({url:h.href,range:new mu(a,h.start+1,a,h.end+1)})})},i=1;i<=e.getLineCount();i+=1)r(i);return{links:t}}}const Xe=Dt;function ii(n,e,t){return e=Am(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Am(n){var e=Lm(n,"string");return typeof e=="symbol"?e:String(e)}function Lm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var _t=B.module("MonacoCompletionProvider");class rn extends m.PureComponent{static lspToMonacoKind(e){var t=pt.CompletionItemKind;switch(e){case 1:return t.Text;case 2:return t.Method;case 3:return t.Function;case 4:return t.Constructor;case 5:return t.Field;case 6:return t.Variable;case 7:return t.Class;case 8:return t.Interface;case 9:return t.Module;case 10:return t.Property;case 11:return t.Unit;case 12:return t.Value;case 13:return t.Enum;case 14:return t.Keyword;case 15:return t.Snippet;case 16:return t.Color;case 17:return t.File;case 18:return t.Reference;case 19:return t.Folder;case 20:return t.EnumMember;case 21:return t.Constant;case 22:return t.Struct;case 23:return t.Event;case 24:return t.Operator;case 25:return t.TypeParameter;default:return t.Variable}}static lspToMonacoRange(e){var{start:t,end:r}=e;return{startLineNumber:t.line+1,startColumn:t.character+1,endLineNumber:r.line+1,endColumn:r.character+1}}static monacoToLspPosition(e){return{line:e.lineNumber-1,character:e.column-1}}constructor(e){super(e),ii(this,"registeredCompletionProvider",void 0),ii(this,"registeredSignatureProvider",void 0),ii(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=pt.registerCompletionItemProvider(e,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),t.getSignatureHelp!=null&&(this.registeredSignatureProvider=pt.registerSignatureHelpProvider(e,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),t.getHover!=null&&(this.registeredHoverProvider=pt.registerHoverProvider(e,{provideHover:this.handleHoverRequest}))}componentWillUnmount(){var e,t,r;(e=this.registeredCompletionProvider)===null||e===void 0||e.dispose(),(t=this.registeredSignatureProvider)===null||t===void 0||t.dispose(),(r=this.registeredHoverProvider)===null||r===void 0||r.dispose()}handleCompletionRequest(e,t,r){var{model:i,session:o}=this.props;if(e!==i)return null;var a={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:rn.monacoToLspPosition(t),context:r},s=o.getCompletionItems(a);_t.debug("Requested completion items",a);var l=s.then(d=>{_t.debug("Completion items received: ",a,d);var h=d.map(c=>{var{label:f,kind:v,detail:p,documentation:g,sortText:y,filterText:P,textEdit:O,insertTextFormat:_}=c;return{label:f,kind:rn.lspToMonacoKind(v),detail:p,documentation:g?.kind==="markdown"?g:g?.value,sortText:y,filterText:P,insertText:O.text,insertTextRules:_===2?4:_,range:rn.lspToMonacoRange(O.range)}});return{incomplete:!0,suggestions:h}}).catch(d=>(_t.error("There was an error retrieving completion items",d),{suggestions:[]}));return l}handleSignatureRequest(e,t,r,i){var o={value:{signatures:[],activeSignature:0,activeParameter:0},dispose:()=>{}},{model:a,session:s}=this.props;if(e!==a||s.getSignatureHelp==null)return null;var l={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:rn.monacoToLspPosition(t),context:i},d=s.getSignatureHelp(l);_t.debug("Requested signature help",l);var h=d.then(c=>{_t.debug("Signatures received: ",l,d);var f=c.map(p=>{var{label:g,documentation:y,parameters:P}=p;return{documentation:y?.kind==="markdown"?y:y?.value,label:g,parameters:P??[]}});if(f.length===0)return o;var v=0;return{value:{signatures:f,activeSignature:v,activeParameter:c[v].activeParameter},dispose:()=>{}}}).catch(c=>(_t.error("There was an error retrieving completion items",c),o));return h}handleHoverRequest(e,t){var{model:r,session:i}=this.props;if(e!==r||i.getHover==null)return null;var o={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:rn.monacoToLspPosition(t)},a=i.getHover(o);_t.debug("Requested hover",o);var s=a.then(l=>{_t.debug("Hover received: ",o,l);var{contents:d}=l;return{contents:d!=null?[d]:[]}}).catch(l=>(_t.error("There was an error retrieving hover",l),{contents:[]}));return s}render(){return null}}const rl=rn;function jo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Fm(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){jo(o,r,i,a,s,"next",l)}function s(l){jo(o,r,i,a,s,"throw",l)}a(void 0)})}}function Ke(n,e,t){return e=Rm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Rm(n){var e=km(n,"string");return typeof e=="symbol"?e:String(e)}function km(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var oi=B.module("ConsoleInput"),Mr=parseInt(Ci["line-height"],10),il=6,ol=6,jm=Mr+il+ol,ai=100;class rr extends m.PureComponent{constructor(e){super(e),Ke(this,"cancelListener",void 0),Ke(this,"resizeObserver",void 0),Ke(this,"commandContainer",void 0),Ke(this,"commandEditor",void 0),Ke(this,"commandHistoryIndex",void 0),Ke(this,"commandSuggestionContainer",void 0),Ke(this,"loadingPromise",void 0),Ke(this,"timestamp",void 0),Ke(this,"bufferIndex",void 0),Ke(this,"history",void 0),Ke(this,"modifiedCommands",void 0),this.handleResize=this.handleResize.bind(this),this.commandContainer=H.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.resizeObserver=new window.ResizeObserver(this.handleResize),this.state={commandEditorHeight:Mr,isFocused:!1,model:null}}componentDidMount(){this.initCommandEditor(),this.loadMoreHistory()}componentDidUpdate(){this.layoutEditor()}componentWillUnmount(){this.resizeObserver.disconnect(),this.loadingPromise!=null&&this.loadingPromise.cancel(),this.destroyCommandEditor()}setConsoleText(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(e){if(oi.debug("Command received: ",e),!r){var i;this.commandHistoryIndex=null,(i=this.commandEditor)===null||i===void 0||i.setValue(e)}t&&this.focusEnd(),this.updateDimensions(),r&&this.processCommand(e)}}initCommandEditor(){var{language:e,session:t}=this.props,r={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:Mr,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:il,bottom:ol},value:"",wordWrap:"on",autoClosingBrackets:"beforeWhitespace"},i=this.commandContainer.current;k(i),this.commandEditor=lt.create(i,r),Xe.setEOL(this.commandEditor),Xe.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{var o,a=(o=this.commandEditor)===null||o===void 0?void 0:o.getValue();this.modifiedCommands.set(this.commandHistoryIndex,a??null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(o=>{var{commandEditor:a,commandHistoryIndex:s}=this,l=a?.getPosition();k(l);var{lineNumber:d}=l,h=a?.getModel();if(o.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&d===1){s!=null?this.loadCommand(s+1):this.loadCommand(0),this.focusStart(),o.stopPropagation(),o.preventDefault();return}if(o.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&d===h?.getLineCount()){s!=null&&s>0?this.loadCommand(s-1):this.loadCommand(null),this.focusEnd(),o.stopPropagation(),o.preventDefault();return}if(!o.altKey&&!o.shiftKey&&!o.metaKey&&o.keyCode===Gt.Enter&&!this.isSuggestionMenuPopulated()){var c;o.stopPropagation(),o.preventDefault();var f=(c=this.commandEditor)===null||c===void 0?void 0:c.getValue().trim();if(f!==void 0){var v;this.processCommand(f),(v=this.commandEditor)===null||v===void 0||v.setValue("")}}}),Xe.disableKeyBindings(this.commandEditor,[ze.CtrlCmd|Gt.KeyF]),Xe.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.resizeObserver.observe(i),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){var{session:e}=this.props;this.commandEditor&&(Xe.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleResize(){this.updateDimensions()}isSuggestionMenuActive(){var e;if(!this.commandSuggestionContainer){var t,r;this.commandSuggestionContainer=(t=this.commandEditor)===null||t===void 0||(r=t.getDomNode())===null||r===void 0?void 0:r.querySelector(".suggest-widget")}return(e=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!==null&&e!==void 0?e:!1}isSuggestionMenuPopulated(){var e,t,r;return this.isSuggestionMenuActive()&&((e=(t=this.commandSuggestionContainer)===null||t===void 0||(r=t.querySelector(".monaco-list-rows"))===null||r===void 0?void 0:r.childElementCount)!==null&&e!==void 0?e:0)>0}focus(){var e;(e=this.commandEditor)===null||e===void 0||e.focus()}focusStart(){var e,t,r,i,o,a=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();k(a);var s=a.getLineLength(1)+1,l=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(1,s);k(l),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:1,column:s}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(l),(o=this.commandEditor)===null||o===void 0||o.focus()}focusEnd(){var e,t,r,i,o,a=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();k(a);var s=a.getLineCount(),l=a.getLineLength(s)+1,d=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(s,l);k(d),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:s,column:l}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(d),(o=this.commandEditor)===null||o===void 0||o.focus()}clear(){var e,t,r;(e=this.commandEditor)===null||e===void 0||e.focus(),(t=this.commandEditor)===null||t===void 0||(r=t.getModel())===null||r===void 0||r.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var t,r;if(!(e!==null&&e>=this.history.length)){var i=this.modifiedCommands.get(e),o=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,(t=this.commandEditor)===null||t===void 0||(r=t.getModel())===null||r===void 0||r.setValue(i??o),e!==null&&e>this.history.length-ai&&this.loadMoreHistory()}}loadMoreHistory(){var e=this;return Fm(function*(){try{if(e.loadingPromise!=null||e.bufferIndex==null)return;var{commandHistoryStorage:t,language:r,scope:i}=e.props;e.loadingPromise=Ee.makeCancelable(t.getTable(r,i??"",e.timestamp),s=>s.close());var o=yield e.loadingPromise;o.setReversed(!0),o.setViewport({top:e.bufferIndex,bottom:e.bufferIndex+ai-1}),e.loadingPromise=Ee.makeCancelable(o.getViewportData(),()=>o.close());var a=yield e.loadingPromise;e.bufferIndex+=ai,e.bufferIndex>=o.size&&(e.bufferIndex=null),e.history=[...a.items.filter((s,l,d)=>{var{name:h}=s;return l===0||h!==d[l-1].name}).map(s=>{var{name:l}=s;return l}).reverse(),...e.history],e.loadingPromise=void 0,o.close()}catch(s){if(e.loadingPromise=void 0,Ee.isCanceled(s)){oi.debug2("Promise canceled, not loading history");return}oi.error("Error fetching history",s)}})()}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),k(e),e!==""&&(this.history.length===0||e!==this.history[this.history.length-1])&&this.history.push(e),this.updateDimensions();var{onSubmit:t}=this.props;t(e)}updateDimensions(){if(this.commandEditor){var{maxHeight:e}=this.props;k(e);var t=this.commandEditor.getContentHeight(),r=Math.max(Math.min(t,e),jm),i=t>r,o={overviewRulerLanes:i?void 0:0};this.setState({commandEditorHeight:r},()=>{var a,s;(a=this.commandEditor)===null||a===void 0||a.updateOptions(o),(s=this.commandEditor)===null||s===void 0||s.layout()})}}render(){var{disabled:e,language:t,session:r}=this.props,{commandEditorHeight:i,isFocused:o,model:a}=this.state;return u.jsx("div",{className:Z("console-input-wrapper",{disabled:e}),children:u.jsxs("div",{className:Z("console-input-inner-wrapper",{focus:o}),children:[u.jsx("div",{className:rr.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:i}}),a&&u.jsx(rl,{model:a,language:t,session:r})]})})}}Ke(rr,"defaultProps",{maxHeight:Mr*10,scope:null,disabled:!1});Ke(rr,"INPUT_CLASS_NAME","console-input");const $o=rr;function Vt(n,e,t){return e=$m(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $m(n){var e=Hm(n,"string");return typeof e=="symbol"?e:String(e)}function Hm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ho="pasted values",Bm=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],si=[".csv",".tsv",".tab",".psv",".dsv",".txt"],Bo=[".zip"];class bt extends m.Component{static isValidDropItem(e){return e!=null&&e.kind==="file"&&!Bm.find(t=>t.test(e.type))}static isValidExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return si.some(r=>e.endsWith(r))||t&&Bo.some(r=>e.endsWith(r))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===Ho?no:e.endsWith(".csv")?Kd:e.endsWith(".zip")?zd:Gd}constructor(e){super(e),Vt(this,"fileElem",void 0),Vt(this,"divElem",void 0),Vt(this,"getValidExtensions",yt(t=>t?[...si,...Bo]:[...si])),Vt(this,"getAcceptString",yt(t=>this.getValidExtensions(t).join(", "))),Vt(this,"getFileTypeErrorString",yt(t=>Ns.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=H.createRef(),this.divElem=H.createRef(),this.state={selectedFileName:""}}componentDidMount(){var e,t;(e=this.divElem.current)===null||e===void 0||e.addEventListener("paste",this.handlePasteEvent),(t=this.divElem.current)===null||t===void 0||t.focus()}componentWillUnmount(){var e;(e=this.divElem.current)===null||e===void 0||e.removeEventListener("paste",this.handlePasteEvent)}handleSelectFile(){if(this.fileElem.current){var e;this.fileElem.current.value="",(e=this.fileElem.current)===null||e===void 0||e.click()}}handleFiles(e){e.stopPropagation(),e.preventDefault();var{files:t}=e.target;t!=null&&this.handleFile(t[0])}handleDrop(e){var{allowZip:t,clearDragError:r,dragError:i}=this.props;if(e.preventDefault(),e.stopPropagation(),i!=null){r();return}if(!(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)){var o=e.dataTransfer.items[0].getAsFile();k(o),bt.isValidExtension(o.name,t)?this.handleFile(o):this.setState({dropError:bt.FILE_TYPE_ERROR})}}unstageFile(e){var{onCancel:t}=this.props;e.stopPropagation(),e.preventDefault(),t(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(e){var{onFileOpened:t}=this.props;t(e),this.setState({selectedFileName:e.name,dropError:void 0})}handleMenuPaste(){var{onPaste:e,onError:t,uploadInProgress:r}=this.props;r||navigator.clipboard.readText().then(i=>{e(i),this.setState({selectedFileName:Ho,dropError:void 0})}).catch(i=>t(i))}handlePasteEvent(e){e.stopPropagation(),e.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){var{uploadInProgress:e}=this.props;return[{title:"Paste",icon:no,action:this.handleMenuPaste,shortcut:Kt.PASTE,disabled:e}]}render(){var{allowZip:e,dragError:t,uploadInProgress:r}=this.props,{selectedFileName:i,dropError:o}=this.state,a=t??o,s=this.makeContextMenuItems();return u.jsxs("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:bt.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[u.jsx(ee,{actions:s}),u.jsx("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!i&&(a===void 0||a==="")&&u.jsxs("div",{className:"message-content",children:[u.jsx("div",{className:"message-icon",children:u.jsx(ue,{icon:qd})}),u.jsx("label",{children:"Drop file (or paste values) here to import"}),u.jsx("div",{className:"message-small",children:u.jsx("label",{children:"or"})}),u.jsx(se,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),i&&(a===void 0||a==="")&&u.jsxs("div",{className:"selected-content",children:[u.jsx("div",{className:"selected-icon",children:u.jsx(ue,{icon:bt.getIcon(i)})}),u.jsxs("div",{className:"selected-text",children:[u.jsx("label",{children:"Selected File"}),u.jsxs("label",{className:"selected-name",children:[i,!r&&u.jsx(se,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:Ss,tooltip:"Remove"})]})]})]}),!!a&&u.jsxs("div",{className:"message-content",children:[u.jsx("div",{className:"message-icon",children:u.jsx(ue,{icon:ws})}),u.jsx("label",{children:a}),a===bt.FILE_TYPE_ERROR&&u.jsx("div",{className:"message-small",children:u.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}Vt(bt,"defaultProps",{allowZip:!1,dragError:null});Vt(bt,"MULTIPLE_FILE_ERROR","Please select only one file");Vt(bt,"FILE_TYPE_ERROR","Filetype not supported.");const yn=bt;function hn(n,e,t){return e=Wm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wm(n){var e=Um(n,"string");return typeof e=="symbol"?e:String(e)}function Um(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Xt{}hn(Xt,"INTEGER","int");hn(Xt,"LONG","long");hn(Xt,"DOUBLE","double");hn(Xt,"BOOLEAN","bool");hn(Xt,"STRING","string");hn(Xt,"DATE_TIME","datetime");hn(Xt,"LOCAL_TIME","localtime");const oe=Xt;function al(n,e){var t=n.internalStream("string");return t.readable=!0,t.read=()=>!1,t.removeListener=()=>!1,t.on("data",(r,i)=>e(i)),t}function Wo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Uo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Wo(Object(t),!0).forEach(function(r){Fe(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Wo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Fe(n,e,t){return e=Vm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Vm(n){var e=Km(n,"string");return typeof e=="symbol"?e:String(e)}function Km(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Vo="unknown",zm=2147483647,Gm=-2147483648,Ko=/^[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]+)?$/,zo=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class xe{static determineType(e,t,r){if(!e||e===r)return t;switch(t){case oe.STRING:return oe.STRING;case oe.INTEGER:return xe.checkInteger(e);case oe.LONG:return xe.checkLong(e);case oe.DOUBLE:return xe.checkDouble(e);case oe.BOOLEAN:return xe.checkBoolean(e);case oe.DATE_TIME:return xe.checkDateTime(e);case oe.LOCAL_TIME:return xe.checkLocalTime(e);default:return xe.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){var t=e.replace(/,/g,"");return xe.isNotParsableNumber(t)?oe.STRING:xe.getNumberType(t)}static checkLong(e){var t=e.replace(/,/g,"");return xe.isNotParsableNumber(t)?oe.STRING:t.includes(".")?oe.DOUBLE:oe.LONG}static checkDouble(e){var t=e.replace(/,/g,"");return xe.isNotParsableNumber(t)?oe.STRING:oe.DOUBLE}static checkBoolean(e){var t=e.toLowerCase();return t==="true"||t==="false"?oe.BOOLEAN:oe.STRING}static checkDateTime(e){return Ko.test(e)?oe.DATE_TIME:oe.STRING}static checkLocalTime(e){return zo.test(e)?oe.LOCAL_TIME:oe.STRING}static getTypeFromUnknown(e){var t=e.replace(/,/g,"");if(xe.isNotParsableNumber(t)){var r=e.toLowerCase();return r==="true"||r==="false"?oe.BOOLEAN:Ko.test(e)&&e.includes(":")?oe.DATE_TIME:zo.test(e)?oe.LOCAL_TIME:oe.STRING}return xe.getNumberType(t)}static getNumberType(e){if(e.includes("."))return oe.DOUBLE;var t=e.startsWith("-")?11:10;if(e.length>t)return oe.LONG;var r=parseInt(e,10);return r>zm||r<Gm?oe.LONG:oe.INTEGER}constructor(e,t,r,i,o,a,s,l,d,h){Fe(this,"onFileCompleted",void 0),Fe(this,"file",void 0),Fe(this,"readHeaders",void 0),Fe(this,"nullString",void 0),Fe(this,"onProgress",void 0),Fe(this,"onError",void 0),Fe(this,"types",void 0),Fe(this,"chunks",void 0),Fe(this,"totalChunks",void 0),Fe(this,"rowCount",void 0),Fe(this,"isZip",void 0),Fe(this,"shouldTrim",void 0),Fe(this,"zipProgress",void 0),Fe(this,"config",void 0),this.onFileCompleted=e,this.file=t,this.readHeaders=r,this.nullString=o,this.onProgress=a,this.onError=s,this.chunks=0,this.totalChunks=l,this.rowCount=0,this.isZip=d,this.shouldTrim=h,this.zipProgress=0,this.handleChunk=this.handleChunk.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.config=Uo(Uo({},i),{},{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=al(this.file,this.handleNodeUpdate);Un.parse(e,this.config),e.resume()}}handleChunk(e,t){var{data:r}=e;if(!this.types){if(r==null||r.length===0){t.abort(),this.onError("Error parsing CSV: no data in file.");return}this.types=new Array(r[0].length).fill(Vo),this.readHeaders&&(r=r.slice(1))}this.rowCount+=r.length,k(this.types);var i=[...this.types];r.forEach(s=>{if(s.length>=i.length){for(var l=0;l<i.length;l+=1)i[l]=xe.determineType(this.shouldTrim?s[l].trim():s[l],i[l],this.nullString);this.types=i}else t.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
|
|
1
|
+
import{r as m,bd as Mi,a1 as Mt,I as u,bg as md,M as H,bh as fd,J as os,K as Z,R as Hr,V as S,bi as vd,bj as gd,L as ue,H as as,T as Pn,U as bn,bk as pd,bl as bd,bm as yd,bn as Cd,a2 as yt,bo as Un,ai as Ji,bp as Sd,bf as Xn,bq as Ni,br as wd,bs as Ed,bt as _d,bu as Pd,bv as M,bw as eo,bx as Td,Y as Ai,a3 as ss,by as Od,Q as Dn}from"./vendor-e600113a.js";import{L as B,T as ls,a0 as Id,a3 as Dd,K as xd,$ as Md,a4 as Nd,X as Ad,a9 as Ld,P as Fd,M as ds,b as us,c as hs,ah as Rd,at as kd,au as cs,av as ms,aw as jd,ax as $d,G as un,ac as Hd,y as fs,as as Bd,ap as vs,aq as gs,Q as ps,j as Wd,e as k,d as jn,ay as Ud,a7 as bs,az as to,aA as Vd,aB as Kd,aC as zd,aD as Gd,f as ys,ai as Cs,aE as Ss,aF as Vn,ao as qd,aG as Xd,C as no,aH as ws,aI as ro,aJ as Es,aK as Zd,F as Yd,aL as Qd,a1 as Jd,aM as eu,a2 as tu,aN as nu,aO as ru,aP as iu,aQ as ou,aR as au,aS as su,aT as lu,ak as du,aU as uu,aV as hu}from"./index-a5f0f1ea.js";import{e as lt,l as pt,K as ze,a as Gt,b as io,R as cu,_ as _s}from"./monaco-b5248072.js";var NC=Object.freeze([]),AC=new Map,LC=()=>{};function FC(n){return Array.isArray(n)?n:[n]}function ti(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return e.filter(r=>r!=null)}function mu(n,e,t){return e=fu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fu(n){var e=vu(n,"string");return typeof e=="symbol"?e:String(e)}function vu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class gu extends Error{constructor(){super(...arguments),mu(this,"isCanceled",!0)}}const fi=gu;function pu(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=bu(n,e);t.forEach(r=>{n[r]=n[r].bind(n)})}function bu(n,e){for(var t=new Set,r=n,i=0;r!=null&&r!==Object.prototype&&(i<=1||e);){for(var o of Object.getOwnPropertyNames(r)){var a;o!=="constructor"&&typeof((a=Object.getOwnPropertyDescriptor(r,o))===null||a===void 0?void 0:a.value)=="function"&&t.add(o)}r=Object.getPrototypeOf(r),i+=1}return[...t.keys()]}function oo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function yu(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){oo(o,r,i,a,s,"next",l)}function s(l){oo(o,r,i,a,s,"throw",l)}a(void 0)})}}function Ps(n){return vi.apply(this,arguments)}function vi(){return vi=yu(function*(n){var{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(n)}catch{return ao(n)}ao(n)}),vi.apply(this,arguments)}function ao(n){var e=document.activeElement,t=document.createElement("textarea");t.value=n,document.body.appendChild(t),t.focus(),t.select();var r=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!r)throw new Error("Unable to execute copy command")}function xn(n,e,t){return e=Cu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cu(n){var e=Su(n,"string");return typeof e=="symbol"?e:String(e)}function Su(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var wu="table_",Ts="column_",Eu=new Set(["in","not","i","ii","k"]),_u=new Set(["abstract","continue","for","new","switch","assert","default","if","package","synchronized","boolean","do","goto","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","null","true","false"]),Pu=/[^a-zA-Z0-9_$+@-]/g,Tu=/[^A-Za-z0-9_$]/g;class ot{}xn(ot,"legalize",(n,e,t,r,i)=>{var o=n.trim().replace(/[- ]/g,"_");return r&&(Eu.has(o)||_u.has(o))&&(o=e+o),o=o.replace(t,""),o||(o=e+i),Number.isNaN(Number(o.charAt(0)))||(o=e+o),o});xn(ot,"legalizeTableName",n=>ot.legalize(n,wu,Pu,!1,0));xn(ot,"legalizeColumnNames",n=>{var e=[];return n.forEach((t,r)=>{var i=ot.legalizeColumnName(t,r);e.includes(i)&&(i=Ts+r),e.push(i)}),e});xn(ot,"legalizeColumnName",function(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return ot.legalize(n,Ts,Tu,!0,e)});xn(ot,"isValidTableName",n=>ot.legalizeTableName(n)===n);xn(ot,"isValidColumnName",n=>ot.legalizeColumnName(n)===n);const Os=ot;class Is extends CustomEvent{constructor(e,t){super(e,t)}}function Ou(n,e,t){return e=Iu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Iu(n){var e=Du(n,"string");return typeof e=="symbol"?e:String(e)}function Du(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class xu extends Error{constructor(){super(...arguments),Ou(this,"isTimeout",!0)}}const Ds=xu;class Ee{static makeCancelable(e,t){var r=!1,i,o,a=new Promise((s,l)=>{o=l,Promise.resolve(e).then(d=>{r?t&&t(d):(i=d,s(d))}).catch(d=>l(d))});return a.cancel=()=>{r=!0,o(new fi),i!=null&&t&&t(i)},a}static isCanceled(e){return e instanceof fi}static isTimedOut(e){return e instanceof Ds}static withTimeout(e,t){return new Promise((r,i)=>{setTimeout(()=>{try{r(t())}catch(o){i(o)}},e)})}}function so(n,e,t){return e=Mu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mu(n){var e=Nu(n,"string");return typeof e=="symbol"?e:String(e)}function Nu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Au{constructor(){so(this,"pending",[]),so(this,"resolved",[])}add(e,t){var r=Ee.makeCancelable(e,t);return this.pending.push(r),r.then(()=>{this.resolve(r)},()=>{this.resolve(r)}),r}remove(e){for(var t=0;t<this.pending.length;t+=1)if(this.pending[t]===e){this.pending.splice(t,1);return}}resolve(e){this.remove(e),this.resolved.push(e)}cancel(){for(var e=[...this.pending,...this.resolved],t=0;t<e.length;t+=1)e[t].cancel();this.pending=[],this.resolved=[]}}const Mn=Au;class Li{static isValidRange(e){return e!=null&&e.length===2&&Number.isInteger(e[0])&&Number.isInteger(e[1])&&e[0]<=e[1]}static validateRange(e){if(!Li.isValidRange(e))throw new Error("Invalid range! ".concat(e))}static isSelected(e,t){for(var r=0;r<e.length;r+=1){var i=e[r],o=i[0],a=i[1];if(o<=t&&t<=a)return!0}return!1}static selectRange(e,t){for(var[r,i]=t,o=[...e],a=o.length-1;a>=0;a-=1){var s=o[a],l=s[0],d=s[1];if(l<=r&&i<=d)return o;r<=d&&l<=i&&(r=Math.min(r,l),i=Math.max(i,d),o.splice(a,1))}return o.push([r,i]),o}static deselectRange(e,t){for(var[r,i]=t,o=[...e],a=o.length-1;a>=0;a-=1){var s=o[a],l=s[0],d=s[1];if(!(i<l||d<r))if(l<r&&i<d){o[a]=[l,r-1],o.splice(a+1,0,[i+1,d]);break}else r<=l&&d<=i?o.splice(a,1):l<r?o[a]=[l,r-1]:o[a]=[i+1,d]}return o}static count(e){return e.reduce((t,r)=>t+(r[1]-r[0]+1),0)}static getItemsInRanges(e,t){return t.reduce((r,i)=>{for(var o=[...r],a=i[0];a<=i[1];a+=1)o.push(e[a]);return o},[])}}const It=Li;function*RC(n,e){for(var t=n;t<=e;++t)yield t}var kC=" ";class xs{static join(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"and";if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return"".concat(e[0]," ").concat(t," ").concat(e[1]);var r=e.slice(0,e.length-1).join(", "),i=e[e.length-1];return"".concat(r,", ").concat(t," ").concat(i)}static toLower(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e==null){if(t)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return e<t?r?-1:1:e>t?r?1:-1:0}}function Ms(n,e,t){return e=Lu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Lu(n){var e=Fu(n,"string");return typeof e=="symbol"?e:String(e)}function Fu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class er{static formatElapsedTime(e){if(typeof e!="number"||!Number.isInteger(e))throw new Error("".concat(e," is not a number that can be expressed as a formatted time"));var t=Math.floor(e/3600),r=Math.floor(e%3600/60),i=e%60;return"".concat(t>0?"".concat(t,"h "):"")+"".concat(r>0||t>0?"".concat(r,"m "):"")+"".concat(e>=60?"".concat(i,"s").padStart(3,"0"):"".concat(i,"s"))}static formatTime(e){if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error("".concat(e," is not a number that can be expressed as a formatted time"));var t=String(Math.floor(e/(60*60))).padStart(2,"0"),r=e%(60*60),i=String(Math.floor(r/60)).padStart(2,"0"),o=r%60,a=String(Math.ceil(o)).padStart(2,"0");return"".concat(t,":").concat(i,":").concat(a)}static isTimeString(e){return new RegExp(er.TIME_PATTERN).test(e)}static parseTime(e){if(e==null||typeof e!="string")throw new Error("".concat(e," is not a valid string"));var t=e.split(":");if(t.length!==3)throw new Error("".concat(e," is not a time string that can be parsed"));return Number(t[0])*60*60+Number(t[1])*60+Number(t[2])}}Ms(er,"TIME_PATTERN","([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]");Ms(er,"TIME_ZONES",Object.freeze([{label:"Tokyo UTC+9 No DST",value:"Asia/Tokyo"},{label:"Seoul UTC+9 No DST",value:"Asia/Seoul"},{label:"Hong Kong UTC+8 No DST",value:"Asia/Hong_Kong"},{label:"Singapore UTC+8 No DST",value:"Asia/Singapore"},{label:"Kolkata UTC+5:30 No DST",value:"Asia/Kolkata"},{label:"Berlin UTC+1",value:"Europe/Berlin"},{label:"UTC UTC±0 No DST",value:"UTC"},{label:"London UTC±0",value:"Europe/London"},{label:"Sao Paulo UTC-2",value:"America/Sao_Paulo"},{label:"Newfoundland UTC-3:30",value:"America/St_Johns"},{label:"Halifax UTC-4",value:"America/Halifax"},{label:"New York UTC−5",value:"America/New_York"},{label:"Chicago UTC-6",value:"America/Chicago"},{label:"Denver UTC-7",value:"America/Denver"},{label:"Los Angeles UTC-8",value:"America/Los_Angeles"},{label:"Anchorage UTC-9",value:"America/Anchorage"},{label:"Honolulu UTC-10 No DST",value:"Pacific/Honolulu"},{label:"Zurich UTC+1",value:"Europe/Zurich"},{label:"Amsterdam UTC+1",value:"Europe/Amsterdam"},{label:"Taipei UTC+8 No DST",value:"Asia/Taipei"},{label:"Sydney UTC+10",value:"Australia/Sydney"}]));const Ns=er;function Ru(n,e,t){return e=ku(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ku(n){var e=ju(n,"string");return typeof e=="symbol"?e:String(e)}function ju(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class $u extends Error{constructor(){super(...arguments),Ru(this,"isInvalid",!0)}}const Kn=$u;function As(){var n=m.useRef(!1);return m.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[]),n}function lo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Hu(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){lo(o,r,i,a,s,"next",l)}function s(l){lo(o,r,i,a,s,"throw",l)}a(void 0)})}}var Bu=B.module("useAsyncInterval");function Wu(n,e){var t=As(),r=m.useRef(0),i=m.useRef(0),o=m.useRef(null),a=m.useCallback(Hu(function*(){var s=Date.now();i.current+=1;var l=o.current==null?e:s-o.current;o.current=s;try{yield n()}catch(c){Bu.error("A tick error occurred:",c)}if(t.current){l+=Date.now()-o.current;var d=Math.max(0,l-e),h=Math.max(0,e-d);r.current=window.setTimeout(a,h)}}),[n,t,e]);m.useEffect(()=>(o.current=null,a(),()=>{window.clearTimeout(r.current)}),[e,a])}function tr(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"No value available in context. Was code wrapped in a provider?",t=m.useContext(n);if(t==null)throw new Error(e);return t}function Uu(n,e,t){var r=m.useRef(t),i=m.useRef(n);i.current=n;var o=m.useMemo(()=>Mi(function(){return i.current(...arguments)},e,r.current),[e]);return m.useEffect(()=>()=>{var a,s;(a=(s=r.current)===null||s===void 0?void 0:s.flushOnUnmount)!==null&&a!==void 0&&a?o.flush():o.cancel()},[o]),o}function Vu(n){var e=m.useRef();return m.useEffect(function(){e.current=n}),e.current}function Ls(n){var e=m.useRef(null);return m.useEffect(function(){n&&(typeof n=="function"?n(e.current):n.current=e.current)}),e}var Ku=3500,zu=B.module("useCopyToClipboard");function Gu(){var[n,e]=m.useState(!1),t=m.useRef(null),r=m.useCallback(i=>{Ps(i).then(()=>{e(!0)}).catch(o=>zu.error("Unable to copy ".concat(i),`
|
|
2
|
+
`,o))},[]);return m.useEffect(()=>(t.current&&clearTimeout(t.current),n&&(t.current=setTimeout(()=>{e(!1)},Ku)),()=>{t.current&&clearTimeout(t.current)}),[n]),[n,r]}function Fs(n){var{children:e,isPortal:t=!1,theme:r=fh,colorScheme:i}=n,[o]=m.useState(t?Mt():null);return u.jsx(md,{UNSAFE_className:"spectrum-theme-provider",theme:r,colorScheme:i,"data-unique-id":o,children:e})}function uo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function qu(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?uo(Object(t),!0).forEach(function(r){En(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):uo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function En(n,e,t){return e=Xu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xu(n){var e=Zu(n,"string");return typeof e=="symbol"?e:String(e)}function Zu(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ho="popper";class Fi extends m.Component{constructor(e){super(e),En(this,"element",void 0),En(this,"container",void 0),En(this,"rAF",void 0),this.handleEnter=this.handleEnter.bind(this),this.handleExit=this.handleExit.bind(this),this.handleBlur=this.handleBlur.bind(this),this.element=document.createElement("div"),this.element.className="popper-container",this.container=H.createRef(),this.rAF=0;var{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){var{isShown:t}=this.props;e.isShown!==t&&(t?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){var{popper:e}=this.state,{closeOnBlur:t,referenceObject:r}=this.props;if(!e&&this.container.current!==null){var{options:i}=this.props;i=qu({placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}}},i),document.body.appendChild(this.element);var o=this.getVisibleElement(this.container.current);o==null&&(o=this.container.current),e=new fd(r||o,this.element,i),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t){var a=this.element.querySelector(".".concat(ho));a instanceof HTMLElement&&!a.contains(document.activeElement)&&a.focus()}}),this.setState({popper:e})}}destroyPopper(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;cancelAnimationFrame(this.rAF);var{popper:t}=this.state;t&&(t.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),this.setState({show:!0})}hide(){this.setState({show:!1})}scheduleUpdate(){var{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){var{onEntered:e}=this.props;e()}handleExit(){var{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){var{className:e,children:t,timeout:r,interactive:i,closeOnBlur:o}=this.props,{show:a}=this.state;return u.jsx(Fs,{isPortal:!0,children:u.jsx(os,{in:a,timeout:r,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:u.jsx("div",{onClick:s=>{s.stopPropagation()},onKeyDown:s=>{s.key==="Escape"&&this.hide()},className:Z(ho,{interactive:i},e),onBlur:o?this.handleBlur:void 0,tabIndex:o?-1:void 0,role:"presentation",children:u.jsxs("div",{className:"popper-content",children:[t,u.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})})}render(){var{popper:e}=this.state,{"data-testid":t}=this.props;return u.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&Hr.createPortal(this.renderContent(),this.element)})}}En(Fi,"propTypes",{children:S.node.isRequired,options:S.shape({}),className:S.string,timeout:S.number,onEntered:S.func,onExited:S.func,isShown:S.bool,closeOnBlur:S.bool,interactive:S.bool,referenceObject:S.shape({}),"data-testid":S.string});En(Fi,"defaultProps",{options:{},className:"",timeout:ls.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0});const Ri=Fi;function co(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Yu(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?co(Object(t),!0).forEach(function(r){ut(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):co(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ut(n,e,t){return e=Qu(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Qu(n){var e=Ju(n,"string");return typeof e=="symbol"?e:String(e)}function Ju(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var eh=B.module("Tooltip");class ye extends m.Component{static handleHidden(){ye.shownTooltipCount-=1,ye.shownTooltipCount===0&&(ye.lastHiddenTime=Date.now())}static handleShown(){ye.shownTooltipCount+=1}constructor(e){super(e),ut(this,"container",void 0),ut(this,"popper",void 0),ut(this,"parent",void 0),ut(this,"timer",void 0),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowMouseMove=this.handleWindowMouseMove.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.handleExited=this.handleExited.bind(this),this.stopShowingTooltip=this.stopShowingTooltip.bind(this),this.container=H.createRef(),this.popper=H.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();var{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){var{isShown:r}=t,{isShown:i}=this.state;i!==r&&(i?ye.handleShown():ye.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();var{isShown:e}=this.state;e&&ye.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){eh.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){this.parent&&(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){var{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){var{isShown:e}=this.state;this.stopTimer();var{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){var t=e.clientX,r=e.clientY,{isShown:i}=this.state;if(!(!this.popper.current||!this.parent)){var o=this.popper.current.element.getBoundingClientRect(),a=this.parent.getBoundingClientRect();t>=o.left&&t<=o.left+o.width&&r>=o.top&&r<=o.top+o.height?this.handleMouseMove():t>=a.left&&t<=a.left+a.width&&r>=a.top&&r<=a.top+a.height?this.handleMouseMove():i&&(this.stopTimer(),this.hide())}}startTimer(){this.stopTimer();var{timeout:e,reshowTimeout:t}=this.props,r=e;(ye.shownTooltipCount>0||Date.now()-ye.lastHiddenTime<ye.triggerReshowThreshold)&&(r=t),this.timer=window.setTimeout(this.handleTimeout,r)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var{isShown:e}=this.state;if(this.stopTimer(),!e){var t;(t=this.popper.current)===null||t===void 0||t.show(),this.setState({isShown:!0});var{interactive:r}=this.props;r&&this.startListeningWindow()}}hide(){var e;(e=this.popper.current)===null||e===void 0||e.hide(),this.stopListeningWindow()}update(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleExited(){this.setState({isShown:!1});var{onExited:e}=this.props;e()}stopShowingTooltip(){var{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){var{interactive:e,children:t,referenceObject:r,popperClassName:i,"data-testid":o,onEntered:a}=this.props,{isShown:s}=this.state,{options:l}=this.props;return l=Yu({placement:"bottom"},l),u.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":o,children:u.jsx(Ri,{className:Z(i,"popper-tooltip"),options:l,ref:this.popper,onEntered:a,onExited:this.handleExited,interactive:e,referenceObject:r,children:u.jsxs("div",{className:"tooltip-content",children:[" ",s&&t]})})})}}ut(ye,"defaultTimeout",500);ut(ye,"defaultReshowTimeout",100);ut(ye,"triggerReshowThreshold",300);ut(ye,"shownTooltipCount",0);ut(ye,"lastHiddenTime",Date.now());ut(ye,"defaultProps",{interactive:!1,options:{},popperClassName:"",reshowTimeout:ye.defaultReshowTimeout,timeout:ye.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});const qt=ye,th={"dh-spectrum-palette":"_dh-spectrum-palette_llwuf_1"},nh={"dh-spectrum-alias":"_dh-spectrum-alias_1906d_1"};function mo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function fo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?mo(Object(t),!0).forEach(function(r){rh(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):mo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function rh(n,e,t){return e=ih(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ih(n){var e=oh(n,"string");return typeof e=="symbol"?e:String(e)}function oh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var vo=fo(fo({},th),nh);function go(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function mr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?go(Object(t),!0).forEach(function(r){ah(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):go(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ah(n,e,t){return e=sh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sh(n){var e=lh(n,"string");return typeof e=="symbol"?e:String(e)}function lh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var{global:dh,light:uh,dark:hh,medium:ch,large:mh}=vd,fh={global:dh,light:mr(mr({},uh),vo),dark:mr(mr({},hh),vo),medium:ch,large:mh};var vh=B.module("ThemeProvider"),Rs=m.createContext(null);function jC(n){var{themes:e,defaultPreloadValues:t=Fd,children:r}=n,i=m.useMemo(()=>Id(),[]),[o,a]=m.useState(null),[s,l]=m.useState(()=>{var c,f;return(c=(f=Dd())===null||f===void 0?void 0:f.themeKey)!==null&&c!==void 0?c:xd}),d=m.useMemo(()=>e==null?null:Md(s,{base:i,custom:e??[]}),[i,s,e]),h=m.useMemo(()=>[...i,...e??[]],[i,e]);return m.useEffect(function(){if(!(d==null||e==null)){Nd(t);var f=Ad(t);vh.debug2("updateThemePreloadData:",{active:d.map(v=>v.themeKey),custom:e.map(v=>v.themeKey),preloadStyleContent:f,selectedThemeKey:s}),Ld({themeKey:s,preloadStyleContent:f})}},[d,s,e,t]),m.useEffect(()=>{a({activeThemes:d,selectedThemeKey:s,themes:h,setSelectedThemeKey:l})},[d,s,h]),u.jsxs(u.Fragment,{children:[d==null?null:u.jsx(u.Fragment,{children:d.map(c=>u.jsx("style",{"data-theme-key":c.themeKey,children:c.styleContent},c.themeKey))}),o==null?null:u.jsx(Rs.Provider,{value:o,children:u.jsx(Fs,{children:r})})]})}function ks(){return tr(Rs,"No ThemeContext value found. Component must be wrapped in a ThemeContext.Provider")}function Br(n){var{children:e,className:t,style:r,"data-testid":i}=n;return u.jsx("div",{className:Z("btn-group",t),style:r,role:"group","data-testid":i,children:e})}Br.displayName="SplitButtonGroup";Br.propTypes={children:S.node.isRequired,className:S.string,style:S.object,"data-testid":S.string};Br.defaultProps={className:null,style:{},"data-testid":void 0};var gh=["kind","variant","type","tooltip","icon","disabled","active","onClick","onContextMenu","onMouseDown","onMouseUp","onMouseEnter","onMouseLeave","onKeyDown","className","style","children","tabIndex","data-testid","aria-label"];function po(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function bo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?po(Object(t),!0).forEach(function(r){ph(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):po(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ph(n,e,t){return e=bh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bh(n){var e=yh(n,"string");return typeof e=="symbol"?e:String(e)}function yh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Ch(n,e){if(n==null)return{};var t=Sh(n,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function Sh(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var wh=["primary","secondary","tertiary","success","danger","inline","ghost"],Eh=["group-end"];function _h(n,e){switch(n){case"primary":return"btn-primary";case"secondary":return"btn-outline-primary";case"tertiary":return"btn-secondary";case"success":return"btn-success";case"danger":return"btn-danger";case"inline":return"btn-inline";case"ghost":return Z("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function Ph(n){switch(n){case"group-end":return Z("pl-2","pr-3")}}var se=H.forwardRef((n,e)=>{var{kind:t,variant:r,type:i,tooltip:o,icon:a,disabled:s=!1,active:l,onClick:d,onContextMenu:h,onMouseDown:c,onMouseUp:f,onMouseEnter:v,onMouseLeave:p,onKeyDown:g,className:y,style:P,children:O,tabIndex:_,"data-testid":R,"aria-label":U}=n,Q=Ch(n,gh),{UNSAFE_className:N}=gd({},"button"),W;r&&(W=Ph(r));var j;a&&(j=H.isValidElement(a)?a:u.jsx(ue,{icon:a}));var Y=j!=null&&O==null,ne=_h(t,Y),F;o!==void 0&&(F=typeof o=="string"?u.jsx(qt,{children:o}):o);var q=U;U===void 0&&Y&&o!=null&&typeof o=="string"&&(q=o);var K=u.jsxs("button",bo(bo({"data-testid":R,ref:e,type:i,className:Z("btn",ne,W,{active:l},y,N),onClick:d,onContextMenu:h,onMouseUp:f,onMouseDown:c,onMouseEnter:v,onMouseLeave:p,onKeyDown:g,style:P,disabled:s,tabIndex:_,"aria-label":q},Q),{},{children:[a&&j,O,o!=null&&!s&&F]}));return s&&o!=null?u.jsxs("span",{className:"btn-disabled-wrapper",children:[K,F]}):K});se.displayName="Button";se.propTypes={kind:S.oneOf(wh).isRequired,variant:S.oneOf(Eh),type:S.oneOf(["submit","reset","button"]),tooltip(n){var{tooltip:e,icon:t,children:r}=n;return e===void 0&&t!=null&&r==null?new Error("Tooltip is required for icon only buttons"):null},icon(n){var{children:e,icon:t}=n;return t==null&&e==null?new Error("Icon is required if no children are provided"):e==null&&!H.isValidElement(t)&&(t==null||t.iconName===""||t.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:S.bool,active:S.bool,onClick(n){var{onClick:e,type:t}=n;return t==="button"&&typeof e!="function"?new Error("type button requires an onClick function"):e!==void 0&&typeof e!="function"?new Error("onClick must be a function"):null},onContextMenu:S.func,onMouseUp:S.func,onMouseDown:S.func,onMouseEnter:S.func,onMouseLeave:S.func,onKeyDown:S.func,tabIndex:S.number,children:S.node,className:S.string,style:S.object,"data-testid":S.string};se.defaultProps={type:"button",onClick:void 0,onContextMenu:void 0,onMouseUp:void 0,onMouseDown:void 0,onMouseEnter:void 0,onMouseLeave:void 0,onKeyDown:void 0,variant:void 0,tooltip:void 0,icon:void 0,disabled:!1,active:void 0,tabIndex:void 0,children:void 0,className:void 0,style:{},"data-testid":void 0};const _n=se;function js(n){var{className:e="modal-footer",children:t,"data-testid":r}=n;return u.jsx("div",{className:e,"data-testid":r,children:t})}function dn(n){var{isOpen:e,headerText:t,bodyText:r,onCancel:i,onConfirm:o,onDiscard:a,onModalDisable:s,cancelButtonText:l="Cancel",confirmButtonText:d="Okay",discardButtonText:h="Discard",isConfirmDanger:c=!1,children:f,"data-testid":v}=n,p=m.useRef(null),g=m.useRef(null),y=m.useCallback(()=>{g.current!==null&&g.current.checked&&s&&s(),o()},[o,s]),P=m.useCallback(()=>{var _;(_=p.current)===null||_===void 0||_.focus()},[]),O="";return e&&(O=typeof r=="function"?r():r),u.jsxs(ds,{isOpen:e,onOpened:P,children:[u.jsx(us,{closeButton:!1,children:t}),u.jsx(hs,{children:O}),u.jsxs(js,{children:[s&&u.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[u.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:g,"data-testid":v!==void 0?"".concat(v,"-checkbox-confirm"):void 0}),u.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),a&&u.jsx(_n,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:a,"data-testid":v!==void 0?"".concat(v,"-btn-discard"):void 0,children:h}),i&&u.jsx(_n,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":v!==void 0?"".concat(v,"-btn-cancel"):void 0,children:l}),u.jsxs(Br,{children:[u.jsx(_n,{kind:c?"danger":"primary",onClick:y,ref:p,"data-testid":v!==void 0?"".concat(v,"-btn-confirm"):void 0,children:d}),f]})]})]})}dn.propTypes={isOpen:S.bool.isRequired,headerText:S.string.isRequired,bodyText:S.oneOfType([S.string,S.func]).isRequired,onCancel:S.func,onConfirm:S.func.isRequired,onDiscard:S.func,onModalDisable:S.func,cancelButtonText:S.string,confirmButtonText:S.string,discardButtonText:S.string,children:S.node,"data-testid":S.string};dn.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};function Th(n,e,t){return e=Oh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Oh(n){var e=Ih(n,"string");return typeof e=="symbol"?e:String(e)}function Ih(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function ni(n){return n.then!==void 0}class Ut{static disableAllActions(){Ut.actionsDisabled=!0}static enableAllActions(){Ut.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){if(e.group!==t.group){var r,i;return((r=e.group)!==null&&r!==void 0?r:0)>((i=t.group)!==null&&i!==void 0?i:0)?1:-1}if(e.order!==t.order){var o,a;return((o=e.order)!==null&&o!==void 0?o:0)>((a=t.order)!==null&&a!==void 0?a:0)?1:-1}if(e.title!==t.title){var s,l;return((s=e.title)!==null&&s!==void 0?s:"")>((l=t.title)!==null&&l!==void 0?l:"")?1:-1}return e!==t?e>t?1:-1:0}static sortActions(e){if(e==null||!Array.isArray(e))return[];var t=e.slice();return t.sort(Ut.compareActions),t}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return Ut.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){var t=Ut.getModifierKey();return e[t]}static getMenuItems(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=[],i=e;Array.isArray(i)||(i=[i]);for(var o=0;o<i.length;o+=1){var a=i[o],s=void 0;typeof a=="function"?s=a():s=a,s!=null&&(s instanceof Promise?t&&r.push(s):Array.isArray(s)?r=r.concat(s):r.push(s))}return r=r.filter(l=>l.title!==void 0||l.then!=null||l.menuElement),r}static getNextMenuItem(e,t,r){var i=e;i<0&&t<0&&(i=r.length);for(var o=1;o<r.length+1;o+=1){var a=(i+t*o+r.length)%r.length,s=r[a];if(!(s instanceof Promise)&&s.disabled!==!0)return a}return e}}Th(Ut,"actionsDisabled",!1);const Ze=Ut;var yo=B.module("GlobalContextAction");class Dh extends m.Component{constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentDidMount(){document.body.addEventListener("contextmenu",this.handleContextMenu),document.body.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.body.removeEventListener("contextmenu",this.handleContextMenu),document.body.removeEventListener("keydown",this.handleKeyDown)}handleContextMenu(e){var t=e;t.contextActions==null&&(t.contextActions=[]);var{action:r}=this.props;r.title==null&&!r.menuElement||(t.contextActions==null&&(t.contextActions=[]),t.contextActions.push(r),yo.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){var{action:t}=this.props;if(!Ze.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)){var r;yo.debug("Global hotkey matched!",e),(r=t.action)===null||r===void 0||r.call(t,e),e.preventDefault(),e.stopPropagation()}}render(){return null}}const xh=Dh;class Mh extends m.Component{render(){for(var{actions:e,"data-testid":t}=this.props,r=[],i=0;i<e.length;i+=1){var o=e[i],{shortcut:a}=o;if(o.title!=null||o.menuElement||a){var s=u.jsx(xh,{action:o,"data-testid":t},"".concat(o.title,".").concat(a?.id));r.push(s)}}return r}}const Nh=Mh;function $s(n,e,t){return e=Ah(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ah(n){var e=Lh(n,"string");return typeof e=="symbol"?e:String(e)}function Lh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var fr=B.module("ContextActions");class Hs extends m.Component{static triggerMenu(e,t,r,i){if(i.length!==0){var o=new MouseEvent("contextmenu",{clientX:t,clientY:r,bubbles:!0,cancelable:!0});o.contextActions=i,e.dispatchEvent(o)}}constructor(e){super(e),$s(this,"container",void 0),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=H.createRef(),this.state={globalActions:[],keyboardActions:[]}}static getDerivedStateFromProps(e){if(e.actions==null||!Array.isArray(e.actions))return{globalActions:[],keyboardActions:[]};var t=e.actions.filter(i=>!ni(i)&&typeof i!="function"&&i.isGlobal),r=e.actions.filter(i=>!ni(i)&&typeof i!="function"&&(i.isGlobal===void 0||!i.isGlobal)&&i.shortcut!=null);return{globalActions:t,keyboardActions:r}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}handleContextMenu(e){var{ignoreClassNames:t=[]}=this.props;if(t.length>0)for(var r=e.target,i=function(){var{classList:d}=r,h=t.find(c=>d.contains(c));if(h!==void 0)return fr.debug2('Contextmenu event ignored based on the target className "'.concat(h,'"')),{v:void 0};r=r.parentElement};r!=null;){var o=i();if(typeof o=="object")return o.v}if(Ze.isContextActionEvent(e)||(e.contextActions=[]),!!Ze.isContextActionEvent(e)){var{actions:a}=this.props;if(a!=null){var s=a;Array.isArray(s)&&(s=s.filter(l=>ni(l)||typeof l=="function"||l.isGlobal===void 0||!l.isGlobal)),e.contextActions=e.contextActions.concat(s)}fr.debug("Received context menu event! Menu items are now: ",e.contextActions)}}handleKeyDown(e){for(var{keyboardActions:t}=this.state,r=0;r<t.length;r+=1){var i=t[r];if(!Ze.actionsDisabled&&i.shortcut!=null&&i.shortcut.matchesEvent(e)){var o;fr.debug("Context hotkey matched!",e),(o=i.action)===null||o===void 0||o.call(i,e),e.stopPropagation(),e.preventDefault(),fr.debug2("Matched hotkey returned false, key event not consumed")}}}render(){var{"data-testid":e}=this.props,{globalActions:t}=this.state;return u.jsx("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:u.jsx(Nh,{actions:t})})}}$s(Hs,"groups",{default:void 0,high:100,medium:5e3,low:1e4,global:1e5,edit:100});const ee=Hs;var ki=H.forwardRef((n,e)=>{var t,r;function i(N){var{menuItem:W,onMenuItemClick:j}=n;j(W,N)}function o(N){var{menuItem:W,onMenuItemMouseMove:j}=n;j(W,N)}function a(N){var{menuItem:W,onMenuItemContextMenu:j}=n;j(W,N)}function s(N,W,j){if(typeof N.type=="string")return N;var{closeMenu:Y,menuItem:ne,isKeyboardSelected:F,isMouseSelected:q,"data-testid":K}=n,A={menuItem:ne,closeMenu:Y,isKeyboardSelected:F,isMouseSelected:q,iconElement:W,displayShortcut:j,"data-testid":K};return H.cloneElement(N,{forwardedProps:A})}var{children:l,menuItem:d,isKeyboardSelected:h=!1,isMouseSelected:c=!1,"data-testid":f}=n,v=(t=d.shortcutText)!==null&&t!==void 0?t:(r=d.shortcut)===null||r===void 0?void 0:r.getDisplayText(),p=null;if(d.icon){var g=d.icon;if(H.isValidElement(g))p=g;else{var y;d.iconColor!=null&&(d.disabled===void 0||!d.disabled)&&(y={color:d.iconColor}),p=u.jsx(ue,{icon:g,style:y})}}var P=null,O=!!l;d.actions&&(P=u.jsx(ue,{icon:Rd}));var _=null;if(d.menuElement)_=u.jsx("div",{className:"custom-menu-item",onMouseMove:o,children:s(d.menuElement,p,v)});else{var R,U=d.disabled,Q=d.iconOutline;_=u.jsx("button",{type:"button",className:Z("btn-context-menu",{disabled:U},{active:(O||c)&&(U===void 0||!U)},{"keyboard-active":h&&(U===void 0||!U)}),onClick:i,onMouseMove:o,onContextMenu:a,title:(R=d.description)!==null&&R!==void 0?R:"",children:u.jsxs("div",{className:"btn-context-menu-wrapper",children:[u.jsx("span",{className:Z("icon",{outline:Q}),children:p}),u.jsx("span",{className:"title",children:d.title}),v!==void 0&&u.jsx("span",{className:"shortcut",children:v}),P&&u.jsx("span",{className:Z("submenu-indicator",{disabled:U}),children:P})]})})}return u.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":f,children:[l,_]})});ki.displayName="ContextMenuItem";ki.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const Fh=ki;var Wr=H.forwardRef((n,e)=>{var{checked:t=!1,children:r,className:i,disabled:o,inputClassName:a,isInvalid:s,labelClassName:l,name:d,onChange:h,"data-testid":c}=n,[f]=m.useState(Mt()),v=Ls(e);m.useEffect(function(){v.current&&(v.current.indeterminate=t===null)},[v,t]);var p=m.useCallback(g=>{v.current&&(v.current.indeterminate=t===null),h&&h(g)},[v,t,h]);return u.jsxs("div",{className:Z("custom-control custom-checkbox",i),children:[u.jsx("input",{type:"checkbox",ref:v,checked:t??!1,className:Z("custom-control-input",a,{"is-invalid":s}),disabled:o,id:f,name:d,onChange:p,"data-testid":c}),u.jsx("label",{className:Z("custom-control-label",l),htmlFor:f,children:r})]})});Wr.displayName="Checkbox";Wr.propTypes={checked:(n,e)=>{var{[e]:t}=n;return t!==null&&typeof t!="boolean"?new Error("Checked must be a boolean or null for indeterminate"):null},children:S.node.isRequired,className:S.string,disabled:S.bool,inputClassName:S.string,isInvalid:S.bool,labelClassName:S.string,name:S.string,onChange:S.func,"data-testid":S.string};Wr.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const Rh=Wr;function $C(n){var{copy:e,kind:t="ghost",tooltip:r="Copy",className:i,style:o,"data-testid":a,children:s}=n,[l,d]=Gu();return u.jsx(_n,{kind:t,className:i,style:o,"data-testid":a,icon:l?kd:cs,tooltip:l?"Copied":r,onClick:()=>{d(typeof e=="function"?e():e)},children:s})}function Co(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function kh(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Co(Object(t),!0).forEach(function(r){zn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Co(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function zn(n,e,t){return e=jh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jh(n){var e=$h(n,"string");return typeof e=="symbol"?e:String(e)}function $h(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Bs extends m.PureComponent{constructor(e){var t;super(e),zn(this,"container",void 0),zn(this,"oldFocus",void 0),zn(this,"rAF",void 0),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.container=H.createRef(),this.oldFocus=document.activeElement,this.rAF=0;var{options:r}=e,i=(t=r.initialKeyboardIndex)!==null&&t!==void 0?t:-1;this.state={menuItems:[],keyboardIndex:i,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)===null||e===void 0||e.focus();var{onMenuOpened:t}=this.props;t(this)})}componentDidUpdate(e){var{actions:t}=this.props;e.actions!==t&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}getKeyboardIndex(){var{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){var{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){var{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){var{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});var{actions:e}=this.props,t=Ze.getMenuItems(e,!1);t.length>0&&this.setState(r=>({menuItems:Ze.sortActions(r.menuItems.concat(t))}))}handleKeyDown(e){var{menuItems:t}=this.state,r=this.getKeyboardIndex(),i=r;if(e.key==="Enter"||e.key===" "){r!=null&&r>=0&&r<t.length&&this.handleMenuItemClick(t[r],e);return}if(e.key==="Escape")i=null;else if(e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0){var o;i=Ze.getNextMenuItem((o=i)!==null&&o!==void 0?o:0,-1,t)}else if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var a;i=Ze.getNextMenuItem((a=i)!==null&&a!==void 0?a:0,1,t)}r!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{closeMenu:t,onMenuClosed:r}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),r(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation(),e!=null&&(e.disabled===void 0||!e.disabled)&&e.action!=null&&(e.action(t.nativeEvent),this.closeMenu(!0))}handleMenuItemMouseMove(e){var{menuItems:t}=this.state,r=t.indexOf(e);this.setMouseIndex(r)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{"data-testid":t}=this.props,{keyboardIndex:r,menuItems:i,mouseIndex:o}=this.state,a=0;a<i.length;a+=1){var s=i[a];a>0&&s.group!==i[a-1].group&&e.push(u.jsx("hr",{},"".concat(a,".separator")));var l=u.jsx(Fh,{isKeyboardSelected:r===a,isMouseSelected:o===a,menuItem:s,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},a);e.push(l)}var{menuStyle:d}=this.props;return u.jsx("div",{className:"context-menu-container",style:kh({},d),ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}}zn(Bs,"defaultProps",{closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});const Hh=Bs;function So(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function wo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?So(Object(t),!0).forEach(function(r){Cn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):So(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Cn(n,e,t){return e=Bh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Bh(n){var e=Wh(n,"string");return typeof e=="symbol"?e:String(e)}function Wh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ws extends m.PureComponent{constructor(e){super(e),Cn(this,"container",void 0),Cn(this,"parent",void 0),Cn(this,"popper",void 0),Cn(this,"isOpen",void 0),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=H.createRef(),this.parent=null,this.popper=H.createRef(),this.isOpen=!1}componentDidMount(){var{isShown:e}=this.props;if(e===null){var t;(t=this.container.current)!==null&&t!==void 0&&t.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick))}else e&&this.openMenu()}componentDidUpdate(e){var{isShown:t}=this.props;e.isShown!==t&&(t!==null&&t?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}closeMenu(){var e;(e=this.popper.current)===null||e===void 0||e.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleClick(e){e.preventDefault(),e.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;var{onMenuClosed:e}=this.props;e()}render(){var{actions:e,onMenuOpened:t,popperClassName:r,"data-testid":i}=this.props,{menuStyle:o}=this.props,{options:a,popperOptions:s}=this.props;return s=wo({placement:"bottom"},s),a=wo({separateKeyboardMouse:!0},a),u.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":i,children:u.jsx(Ri,{ref:this.popper,options:s,className:Z("menu-popper",r),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:u.jsx(Hh,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:a,menuStyle:o})})})}}Cn(Ws,"defaultProps",{isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0});const Gn=Ws;function $t(n,e,t){return e=Uh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Uh(n){var e=Vh(n,"string");return typeof e=="symbol"?e:String(e)}function Vh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Eo=B.module("Shortcut"),L;(function(n){n.CTRL="MODIFIER_CTRL",n.CMD="MODIFIER_CMD",n.ALT="MODIFIER_ALT",n.OPTION="MODIFIER_OPTION",n.SHIFT="MODIFIER_SHIFT"})(L||(L={}));var D;(function(n){n.A="A",n.B="B",n.C="C",n.D="D",n.E="E",n.F="F",n.G="G",n.H="H",n.I="I",n.J="J",n.K="K",n.L="L",n.M="M",n.N="N",n.O="O",n.P="P",n.Q="Q",n.R="R",n.S="S",n.T="T",n.U="U",n.V="V",n.W="W",n.X="X",n.Y="Y",n.Z="Z",n.ZERO="0",n.ONE="1",n.TWO="2",n.THREE="3",n.FOUR="4",n.FIVE="5",n.SIX="6",n.SEVEN="7",n.EIGHT="8",n.NINE="9",n.BACKSPACE="Backspace",n.ESCAPE="Escape",n.ENTER="Enter",n.DELETE="Delete",n.SLASH="/",n.QUESTION_MARK="?",n.BACKSLASH="\\",n.PIPE="|",n.MINUS="-",n.UNDERSCORE="_",n.EQUALS="=",n.PLUS="+",n.BACKTICK="`",n.TILDE="~",n.COMMA=",",n.LEFT_CHEVRON="<",n.PERIOD=".",n.RIGHT_CHEVRON=">",n.SEMICOLON=";",n.COLON=":",n.SINGLE_QUOTE="'",n.DOUBLE_QUOTE='"',n.LEFT_BRACKET="[",n.RIGHT_BRACKET="]",n.LEFT_CURLY="{",n.RIGHT_CURLY="}",n.F1="F1",n.F2="F2",n.F3="F3",n.F4="F4",n.F5="F5",n.F6="F6",n.F7="F7",n.F8="F8",n.F9="F9",n.F10="F10",n.F11="F11",n.F12="F12"})(D||(D={}));var Kh=new Set([D.ENTER,D.DELETE,D.F1,D.F2,D.F3,D.F4,D.F5,D.F6,D.F7,D.F8,D.F9,D.F10,D.F11,D.F12]);class ge extends as{static isAllowedKey(e){return Object.values(D).includes(e)}static isValidKeyState(e){var{keyValue:t}=e;if(t===null)return!0;if(!ge.isMacPlatform&&e.metaKey||!ge.isAllowedKey(t))return!1;var r=!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey;return!r||Kh.has(t)}static createKeyState(e){var t={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:e[e.length-1]};return e.forEach(r=>{switch(r){case L.CTRL:t.ctrlKey=!0;break;case L.ALT:case L.OPTION:t.altKey=!0;break;case L.CMD:t.metaKey=!0;break;case L.SHIFT:t.shiftKey=!0;break}}),t}static getKeyStateFromEvent(e){var{key:t,keyCode:r}=e,i="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?i="":!ge.isAllowedKey(t)&&ge.isAllowedKey(String.fromCharCode(r))?i=String.fromCharCode(r):i=t,{keyValue:i,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey}}static getWindowsDisplayText(e){var t="";return e.ctrlKey&&(t+="Ctrl+"),e.altKey&&(t+="Alt+"),e.shiftKey&&(t+="Shift+"),e.keyValue===D.ESCAPE?t+="Esc":e.keyValue!==null&&(t+=e.keyValue),t}static getMacDisplayText(e){var t="";switch(e.ctrlKey&&(t+="⌃"),e.altKey&&(t+="⌥"),e.shiftKey&&(t+="⇧"),e.metaKey&&(t+="⌘"),e.keyValue){case D.ENTER:t+="⏎";break;case D.ESCAPE:t+="⎋";break;case D.BACKSPACE:t+="⌫";break;case D.DELETE:t+="⌦";break;case null:break;default:t+=e.keyValue}return t}static doKeyStatesMatch(e,t){var r,i;return((r=e.keyValue)===null||r===void 0?void 0:r.toUpperCase())===((i=t.keyValue)===null||i===void 0?void 0:i.toUpperCase())&&e.altKey===t.altKey&&e.ctrlKey===t.ctrlKey&&e.metaKey===t.metaKey&&e.shiftKey===t.shiftKey}static getDisplayText(e){return e.keyValue===null?"":ge.isMacPlatform?ge.getMacDisplayText(e):ge.getWindowsDisplayText(e)}constructor(e){var{id:t,shortcut:r,macShortcut:i,isEditable:o=!0,name:a,tooltip:s}=e;super(),$t(this,"id",void 0),$t(this,"name",void 0),$t(this,"tooltip",void 0),$t(this,"isEditable",void 0),$t(this,"defaultKeyState",void 0),$t(this,"keyState",void 0),this.id=t,this.name=a,this.tooltip=s,this.isEditable=o;var l=ge.isMacPlatform,d=l?i:r;this.defaultKeyState=ge.createKeyState(d),this.keyState=this.defaultKeyState}getDisplayText(){return ge.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){ge.isValidKeyState(e)?(Eo.debug2("Shortcut ".concat(this.id," updated to ").concat(JSON.stringify(e))),this.keyState=e,this.dispatchEvent(new Is("onUpdate",{detail:this}))):Eo.debug2("Shortcut ".concat(this.id," tried to update to invalid keyState ").concat(JSON.stringify(e)))}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return ge.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(ge.NULL_KEY_STATE)}isNull(){return ge.doKeyStatesMatch(this.keyState,ge.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return ge.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(ge.getKeyStateFromEvent(e))}}$t(ge,"NULL_KEY_STATE",{metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null});$t(ge,"isMacPlatform",Ze.isMacPlatform());function _o(n,e,t){return e=zh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zh(n){var e=Gh(n,"string");return typeof e=="symbol"?e:String(e)}function Gh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Po=B.module("ShortcutRegistry");class qh extends as{constructor(){super(...arguments),_o(this,"shortcutMap",new Map),_o(this,"shortcutsByCategory",new Map)}createAndAdd(e){var t=new ge(e);return this.add(t)}add(e){var t=this.shortcutMap.get(e.id);if(t)return Po.warn("Skipping attempt to add duplicate shortcut ID to registry: ".concat(e.id)),t;Po.debug2("Adding shortcut to registry: ".concat(e.id)),e.addEventListener("onUpdate",o=>{var{detail:a}=o;return this.dispatchEvent(new Is("onUpdate",{detail:a}))});var r=e.id.split(".")[0];if(this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(r)){var i;(i=this.shortcutsByCategory.get(r))===null||i===void 0||i.push(e)}else this.shortcutsByCategory.set(r,[e]);return e}get(e){return this.shortcutMap.get(e)}getConflictingShortcuts(e){return Array.from(this.shortcutMap.values()).filter(t=>!t.isNull()&&t.matchesKeyState(e))}}var Xh=Object.freeze(new qh);const ce=Xh;var Zh={COPY:ce.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[L.CTRL,D.C],macShortcut:[L.CMD,D.C],isEditable:!1}),PASTE:ce.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[L.CTRL,D.V],macShortcut:[L.CMD,D.V],isEditable:!1}),SAVE:ce.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[L.CTRL,D.S],macShortcut:[L.CMD,D.S],isEditable:!1}),SELECT_ALL:ce.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[L.CTRL,D.A],macShortcut:[L.CMD,D.A],isEditable:!1}),REOPEN_CLOSED_PANEL:ce.createAndAdd({id:"GLOBAL.REOPEN_CLOSED_PANEL",name:"Re-open Closed Panel",shortcut:[L.ALT,L.SHIFT,D.T],macShortcut:[L.OPTION,L.SHIFT,D.T],isEditable:!0}),LINKER:ce.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[L.CTRL,D.L],macShortcut:[L.CMD,D.L]}),LINKER_CLOSE:ce.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[D.ESCAPE],macShortcut:[D.ESCAPE],isEditable:!1}),COPY_VERSION_INFO:ce.createAndAdd({id:"GLOBAL.COPY_VERSION_INFO",name:"Copy Version Info",shortcut:[L.CTRL,L.ALT,D.I],macShortcut:[L.CMD,L.SHIFT,D.I],isEditable:!0}),NEXT:ce.createAndAdd({id:"GLOBAL.NEXT",name:"Next",shortcut:[D.ENTER],macShortcut:[D.ENTER],isEditable:!1}),PREVIOUS:ce.createAndAdd({id:"GLOBAL.PREVIOUS",name:"Previous",shortcut:[L.SHIFT,D.ENTER],macShortcut:[L.SHIFT,D.ENTER],isEditable:!1})};const Kt=Zh;function gi(n,e,t){return e=Yh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yh(n){var e=Qh(n,"string");return typeof e=="symbol"?e:String(e)}function Qh(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Us extends m.PureComponent{constructor(e){super(e),gi(this,"inputField",void 0),gi(this,"searchChangeSelection",void 0),this.inputField=H.createRef(),this.searchChangeSelection=H.createRef()}componentDidMount(){this.setInputPaddingRight()}componentDidUpdate(){this.setInputPaddingRight()}focus(){var e;(e=this.inputField.current)===null||e===void 0||e.focus()}setInputPaddingRight(){var e=this.inputField.current,t=this.searchChangeSelection.current;if(e&&t){var r=t.getBoundingClientRect().width;e.style.paddingRight="".concat(r,"px")}}render(){var{value:e,placeholder:t,onBlur:r,onChange:i,className:o,disabled:a,matchCount:s,id:l,onKeyDown:d,"data-testid":h,cursor:c}=this.props,f,v=[{action:()=>c?.next("forward"),shortcut:Kt.NEXT},{action:()=>c?.next("back"),shortcut:Kt.PREVIOUS}];return c&&s>1?f=u.jsxs(u.Fragment,{children:[u.jsx(_n,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{c.next("back")},icon:ms,tooltip:"Previous match (".concat(Kt.PREVIOUS.getDisplayText(),")")}),u.jsxs("span",{className:"search-change-text",children:[c.index!==void 0&&"".concat(c.index+1," of "),s]}),u.jsx(_n,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{c.next("forward")},icon:jd,tooltip:"Next match (".concat(Kt.NEXT.getDisplayText(),")")})]}):f=s>0&&u.jsx("span",{className:"search-match",children:s}),u.jsxs("div",{className:Z("search-group",o),children:[u.jsx("input",{type:"search",value:e,onBlur:r,onChange:i,onKeyDown:d,className:"form-control",disabled:a,placeholder:t,ref:this.inputField,id:l,"data-testid":h}),s!=null?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"search-change-selection",ref:this.searchChangeSelection,children:f}),u.jsx(ee,{actions:v})]}):u.jsx("span",{className:"search-icon",children:u.jsx(ue,{icon:$d})})]})}}gi(Us,"defaultProps",{placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0,cursor:void 0});const ji=Us;function Vs(n,e,t){return e=Jh(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Jh(n){var e=ec(n,"string");return typeof e=="symbol"?e:String(e)}function ec(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ks extends m.PureComponent{constructor(e){super(e),Vs(this,"searchInput",void 0),this.searchInput=H.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=Pn(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){var{value:t}=this.props;e.value!==t&&this.setState({value:t})}focus(){var e;(e=this.searchInput.current)===null||e===void 0||e.focus()}handleChange(e){this.setState({value:e.target.value},this.sendUpdate)}sendUpdate(){var{onChange:e}=this.props,{value:t}=this.state;e(t)}render(){var{placeholder:e,className:t,matchCount:r,id:i,"data-testid":o}=this.props,{value:a}=this.state;return u.jsx(ji,{value:a,placeholder:e,onChange:this.handleChange,className:t,matchCount:r,ref:this.searchInput,id:i,"data-testid":o})}}Vs(Ks,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});const tc=Ks;function zs(n,e,t){return e=nc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function nc(n){var e=rc(n,"string");return typeof e=="symbol"?e:String(e)}function rc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ic=B.module("ItemListItem");class Ur extends m.Component{static handleKeyDown(){return ic.log("ItemListItem.handleKeyDown false"),!1}constructor(e){super(e),zs(this,"itemRef",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDrag=this.handleDrag.bind(this),this.handleDragOver=this.handleDragOver.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.itemRef=H.createRef()}handleBlur(e){var{itemIndex:t,onBlur:r}=this.props;r(t,e)}handleFocus(e){var{itemIndex:t,onFocus:r}=this.props;r(t,e)}handleClick(e){var{itemIndex:t,onClick:r}=this.props;r(t,e)}handleContextMenu(e){var{itemIndex:t,onContextMenu:r}=this.props;r(t,e)}handleDragStart(e){var{itemIndex:t,onDragStart:r}=this.props;r(t,e)}handleDrag(e){var{itemIndex:t,onDrag:r}=this.props;r(t,e)}handleDragOver(e){e.preventDefault();var{itemIndex:t,onDragOver:r}=this.props;r(t,e)}handleDragEnd(e){var{itemIndex:t,onDragEnd:r}=this.props;r(t,e)}handleDrop(e){var{itemIndex:t,onDrop:r}=this.props;r(t,e)}handleDoubleClick(e){var{itemIndex:t,onDoubleClick:r}=this.props;r(t,e)}handleMouseMove(e){var{itemIndex:t,onMouseMove:r}=this.props;r(t,e)}handleMouseDown(e){var{itemIndex:t,onMouseDown:r}=this.props;r(t,e)}handleMouseUp(e){var{itemIndex:t,onMouseUp:r}=this.props;r(t,e)}render(){var{isDraggable:e,isFocused:t,isSelected:r,style:i,children:o,"data-testid":a}=this.props;return u.jsx("div",{className:Z("item-list-item",{active:r},{"is-focused":t},{"is-draggable":e}),onKeyDown:Ur.handleKeyDown,onContextMenuCapture:this.handleContextMenu,onClick:this.handleClick,onDrag:this.handleDrag,onDragStart:this.handleDragStart,onDragOver:this.handleDragOver,onDragEnd:this.handleDragEnd,onDrop:this.handleDrop,onDoubleClick:this.handleDoubleClick,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,tabIndex:-1,ref:this.itemRef,role:"listitem",style:i,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:e,"data-testid":a,children:o})}}zs(Ur,"defaultProps",{children:null,isDraggable:!1,isFocused:!1,isSelected:!1,itemIndex:0,"data-testid":void 0,onBlur(){},onClick(){},onContextMenu(){},onDragStart(){},onDrag(){},onDragOver(){},onDragEnd(){},onDrop(){},onDoubleClick(){},onFocus(){},onMouseDown(){},onMouseMove(){},onMouseUp(){},style:{}});const oc=Ur;function To(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Oo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?To(Object(t),!0).forEach(function(r){rt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):To(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function rt(n,e,t){return e=ac(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ac(n){var e=sc(n,"string");return typeof e=="symbol"?e:String(e)}function sc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Io=B.module("ItemList"),Do=5;class Ye extends m.PureComponent{static renderItem(e){var t,r,{item:i}=e;return u.jsx("div",{className:"item-list-item-content",children:i!=null&&((t=(r=i.displayValue)!==null&&r!==void 0?r:i.value)!==null&&t!==void 0?t:"".concat(i))})}constructor(e){super(e),rt(this,"list",void 0),rt(this,"listContainer",void 0),rt(this,"getItemSelected",bn((i,o)=>It.isSelected(o,i),{max:Ye.CACHE_SIZE})),rt(this,"getCachedItem",bn((i,o,a,s,l,d,h,c)=>{var f=d({item:a,itemIndex:i,isFocused:s,isSelected:l,style:h});return u.jsx(oc,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:c,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:s,isSelected:l,itemIndex:i,style:h,children:f},o)},{max:Ye.CACHE_SIZE})),rt(this,"getOuterElement",bn(i=>{var o=H.forwardRef((a,s)=>u.jsx("div",Oo({ref:s,tabIndex:-1,onKeyDown:i,role:"presentation"},a)));return o.displayName="ItemListOuterElement",o})),rt(this,"getInnerElement",bn(()=>{var i=H.forwardRef((o,a)=>u.jsx("div",Oo({className:"item-list-inner-element",ref:a},o)));return i.displayName="ItemListInnerElement",i})),rt(this,"getItemData",bn((i,o,a)=>({items:i,selectedRanges:o,renderItem:a}))),this.handleItemBlur=this.handleItemBlur.bind(this),this.handleItemContextMenu=this.handleItemContextMenu.bind(this),this.handleItemFocus=this.handleItemFocus.bind(this),this.handleItemDoubleClick=this.handleItemDoubleClick.bind(this),this.handleItemMouseDown=this.handleItemMouseDown.bind(this),this.handleItemMouseMove=this.handleItemMouseMove.bind(this),this.handleItemMouseUp=this.handleItemMouseUp.bind(this),this.handleItemsRendered=this.handleItemsRendered.bind(this),this.handleWindowMouseUp=this.handleWindowMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleResize=this.handleResize.bind(this),this.renderInnerElement=this.renderInnerElement.bind(this),this.list=H.createRef(),this.listContainer=H.createRef();var{isStickyBottom:t,selectedRanges:r}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:r,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null,mouseX:null,mouseY:null}}componentDidUpdate(e,t){var{selectedRanges:r,itemCount:i}=this.props,{focusIndex:o,isStuckToBottom:a,scrollOffset:s,height:l,selectedRanges:d}=this.state;if(a&&!this.isListAtBottom()&&i>0&&this.scrollToBottom(),(s!==t.scrollOffset||l!==t.height)&&this.sendViewportUpdate(),r!==e.selectedRanges&&r!==d)this.setSelectedRanges(r);else if(d!==t.selectedRanges){var{onSelectionChange:h}=this.props;h(d)}if(o!==t.focusIndex){var{onFocusChange:c}=this.props;c(o)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var e;(e=this.listContainer.current)===null||e===void 0||e.focus()}restoreScrollPosition(){var{scrollOffset:e}=this.state;if(e!=null){var t;(t=this.listContainer.current)===null||t===void 0||t.scrollTo(0,e)}}getElement(e){if(this.listContainer.current==null)return null;var{focusSelector:t}=this.props,{overscanStartIndex:r}=this.state,i=this.listContainer.current.querySelectorAll(t),o=e-r;return i[o]}focusItem(e){var{disableSelect:t}=this.props;if(!t){this.setState({focusIndex:e});var r=this.getElement(e);r instanceof HTMLElement&&r.focus()}}scrollToItem(e){var t=this.getElement(e);t?.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){this.setState({focusIndex:e});var{selectedRanges:r}=this.state,i=It.isSelected(r,e),o=i||Ze.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,o,!1)}handleItemDoubleClick(e,t){var{isDoubleClickSelect:r,onSelect:i}=this.props;r&&this.setState(o=>{var{selectedRanges:a}=o;return{selectedRanges:It.selectRange(a,[e,e])}},()=>{i(e,t)})}handleItemMouseDown(e,t){var{selectedRanges:r}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&r.length===0){this.focusItem(e),this.selectItem(e);return}t.button!=null&&t.button!==0||(this.setState({mouseDownIndex:e,mouseX:t.clientX,mouseY:t.clientY}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(e,t){Io.debug2("item blur",e,t.currentTarget,t.relatedTarget),(!t.relatedTarget||this.listContainer.current&&t.relatedTarget instanceof HTMLElement&&!this.listContainer.current.contains(t.relatedTarget))&&this.setState({focusIndex:null})}handleItemFocus(e,t){Io.debug2("item focus",e,t.target),this.setState(r=>{var{focusIndex:i}=r;return i!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){var{isDragSelect:r,isMultiSelect:i,disableSelect:o}=this.props,{mouseDownIndex:a,selectedRanges:s,mouseX:l,mouseY:d}=this.state;if(!(a==null||o)){var h=Math.abs(t.clientX-(l??0)),c=Math.abs(t.clientY-(d??0));h>Do&&c>Do&&this.setState({isDragging:!0}),(r||a===e)&&(this.focusItem(e),i?(!r&&!this.getItemSelected(e,s)&&!Ze.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(a,e),Math.max(a,e)])):this.toggleSelect(e,t.shiftKey,Ze.isModifierKeyDown(t),!1))}}handleItemMouseUp(e,t){var{isDeselectOnClick:r,isDoubleClickSelect:i,onSelect:o}=this.props,{mouseDownIndex:a,isDragging:s}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(a===e&&!s){var l=t.shiftKey,d=Ze.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,l,d,r),!i&&!l&&!d&&o(e,t)}this.resetMouseState()}}handleItemsRendered(e){var{overscanStartIndex:t}=e;this.setState({overscanStartIndex:t})}handleResize(e){var{height:t}=e;this.setState({height:t})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(e){var{isMultiSelect:t,itemCount:r,onSelect:i}=this.props,{focusIndex:o}=this.state,a=o;if(e.key==="Enter"||e.key===" "){!t&&a!=null&&this.setState({selectedRanges:[[a,a]]},()=>{a!=null&&i(a,e)});return}if(e.key==="ArrowUp")a!=null&&a>=0?a=Math.max(0,a-1):a=r-1;else if(e.key==="ArrowDown")a!=null&&a>=0?a=Math.min(a+1,r-1):a=0;else return;if(o!==a){e.stopPropagation(),e.preventDefault(),this.focusItem(a);var{selectedRanges:s}=this.state;if(e.shiftKey&&s.length>0){var l=s[s.length-1];this.selectRange([Math.min(a,l[0]),Math.max(a,l[1])])}else if(this.deselectAll(),a!==null)this.selectItem(a);else{var d;(d=this.listContainer.current)===null||d===void 0||d.focus()}this.scrollIntoView(a)}}handleScroll(e){var{scrollUpdateWasRequested:t,scrollOffset:r}=e;this.setState(i=>{if(t)return{scrollOffset:r};var{isStickyBottom:o}=this.props,{height:a}=i,s=o&&this.isListAtBottom({scrollOffset:r,height:a});return{isStuckToBottom:s,scrollOffset:r}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){var{itemCount:e}=this.props;this.list.current&&this.list.current.scrollToItem(e)}scrollIntoView(e){this.list.current&&this.list.current.scrollToItem(e)}toggleSelect(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,{isMultiSelect:o}=this.props,{selectedRanges:a}=this.state;if(o&&t&&a.length>0){var s=a[a.length-1];this.selectRange([Math.min(s[0],e),Math.max(e,s[1])])}else o&&a.length===1&&a[0][0]===e&&a[0][1]===e?i&&this.deselectItem(e):o&&r?this.getItemSelected(e,a)?i&&this.deselectItem(e):this.selectItem(e):(this.deselectAll(),this.selectItem(e))}deselectAll(){var{itemCount:e}=this.props;this.deselectRange([0,e])}deselectItem(e){this.deselectRange([e,e])}deselectRange(e){It.validateRange(e),this.setState(t=>{var{selectedRanges:r}=t;return{selectedRanges:It.deselectRange(r,e)}})}selectItem(e){var{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){It.validateRange(e),this.setState(t=>{var{selectedRanges:r}=t;return{selectedRanges:It.selectRange(r,e)}})}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){var{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){var{onViewportChange:r,rowHeight:i}=this.props,o=Math.floor(e/i),a=o+Math.ceil(t/i);r(o,a)}}isListAtBottom(){var{scrollOffset:e,height:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.state;if(t==null||e==null)return!1;var{itemCount:r,rowHeight:i}=this.props;return e+t>=r*i}renderInnerElement(e){var{index:t,style:r}=e,{items:i,offset:o,renderItem:a,disableSelect:s}=this.props,{focusIndex:l,selectedRanges:d}=this.state;if(t<o||t>=o+i.length)return null;var h=i[t-o];return this.getCachedItem(t,t,h,t===l&&!s,this.getItemSelected(t,d),a,r,s)}render(){var{items:e,itemCount:t,overscanCount:r,renderItem:i,rowHeight:o,"data-testid":a}=this.props,{selectedRanges:s,isStuckToBottom:l}=this.state;return u.jsx(pd,{className:"item-list-auto-sizer",onResize:this.handleResize,children:d=>{var{width:h,height:c}=d;return u.jsx(bd,{className:"item-list-scroll-pane",height:c,width:h,initialScrollOffset:l?t*o:0,itemCount:t,itemSize:o,itemData:this.getItemData(e,s,i),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:r,"data-testid":a,children:this.renderInnerElement})}})}}rt(Ye,"CACHE_SIZE",1e3);rt(Ye,"DEFAULT_ROW_HEIGHT",20);rt(Ye,"DEFAULT_OVERSCAN",10);rt(Ye,"defaultProps",{offset:0,items:[],rowHeight:Ye.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Ye.DEFAULT_OVERSCAN,renderItem:Ye.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0});var lc=B.module("ErrorBoundary");class dc extends m.Component{static getDerivedStateFromError(e){return{error:e}}constructor(e){super(e),this.state={error:void 0}}componentDidCatch(e,t){var{onError:r}=this.props;lc.error("Error caught by ErrorBoundary",e,t),r?.(e,t)}render(){var{children:e,className:t,fallback:r}=this.props,{error:i}=this.state;return i!=null?r??u.jsx("div",{className:t,children:u.jsx(un,{errorMessage:"".concat(i),isLoading:!1,isLoaded:!1})}):e}}function uc(n){var{on:e,id:t,className:r,isInvalid:i,disabled:o=!1,onClick:a,"data-testid":s}=n;return u.jsx("button",{type:"button",className:Z("btn","btn-switch",r,{active:e},{"is-invalid":i}),id:t,onClick:a,disabled:o,"data-testid":s,children:u.jsx("div",{className:"handle"})})}var hc=["className","timeout"];function xo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function cc(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xo(Object(t),!0).forEach(function(r){mc(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):xo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function mc(n,e,t){return e=fc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fc(n){var e=vc(n,"string");return typeof e=="symbol"?e:String(e)}function vc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function gc(n,e){if(n==null)return{};var t=pc(n,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function pc(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}function HC(n){var{className:e,timeout:t=ls.transitionMs}=n,r=gc(n,hc);return u.jsx(os,cc({timeout:t,classNames:Z("fade",e)},r))}var bc=["children","className","isInvalid","onChange","data-testid"];function Mo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function No(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Mo(Object(t),!0).forEach(function(r){yc(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Mo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function yc(n,e,t){return e=Cc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cc(n){var e=Sc(n,"string");return typeof e=="symbol"?e:String(e)}function Sc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function wc(n,e){if(n==null)return{};var t=Ec(n,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(n,r)&&(t[r]=n[r])}return t}function Ec(n,e){if(n==null)return{};var t={},r=Object.keys(n),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(t[i]=n[i]);return t}var Gs=H.forwardRef((n,e)=>{var{children:t,className:r,isInvalid:i,onChange:o,"data-testid":a}=n,s=wc(n,bc),l=Ls(e),d=m.useCallback(h=>{o(h.target.value)},[o]);return u.jsx("select",No(No({ref:l,className:Z("custom-select",r,{"is-invalid":i}),onChange:d,"data-testid":a},s),{},{children:t}))});Gs.displayName="Select";const _c=Gs;function Pc(){return tr(Hd,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function qs(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.name!=null}function Xs(n){return typeof n=="object"&&n!=null&&typeof n.type=="string"&&n.id!=null}function BC(n){return qs(n)||Xs(n)}var Tc=m.createContext(null);function WC(n){if(Xs(n))return{id:n.id,type:n.type};if(qs(n)){var e;return{name:(e=n.name)!==null&&e!==void 0?e:"",type:n.type}}throw new Error("Invalid descriptor: ".concat(n))}function Oc(n){var e,t;return{type:(e=n.type)!==null&&e!==void 0?e:"",name:(t=n.title)!==null&&t!==void 0?t:n.name,id:n.id}}function UC(){return tr(Tc,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}function Ic(n){var{type:e}=n,t=Pc();switch(e){case t.VariableType.TABLE:case t.VariableType.TABLEMAP:case t.VariableType.TREETABLE:case t.VariableType.HIERARCHICALTABLE:case t.VariableType.PARTITIONEDTABLE:return u.jsx(ue,{icon:gs});case t.VariableType.FIGURE:return u.jsx(ue,{icon:vs});case t.VariableType.PANDAS:return u.jsx(ue,{icon:Bd});default:return u.jsx(ue,{icon:fs})}}function Ao(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Dc(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Ao(o,r,i,a,s,"next",l)}function s(l){Ao(o,r,i,a,s,"throw",l)}a(void 0)})}}function Zs(n){var{children:e,language:t}=n,[r,i]=m.useState(null),{activeThemes:o}=ks();return m.useEffect(()=>{var a=!1;function s(){return l.apply(this,arguments)}function l(){return l=Dc(function*(){if(e!=null&&o!=null){var d=yield lt.colorize(e.toString(),t,{});a||i(d)}}),l.apply(this,arguments)}return s(),()=>{a=!0}},[o,e,t]),u.jsx("div",{style:{pointerEvents:"none"},dangerouslySetInnerHTML:r!=null?{__html:r}:void 0})}class xc{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}const Ys=xc;class Dr{static hasComment(e){return e.comment!==void 0}static hasPattern(e){return e.pattern!==void 0}static hasOp(e){return e.op!==void 0}static parseArguments(e){return e==null||!(typeof e=="string"||e instanceof String)?[]:yd.parse(e).filter(t=>!this.hasComment(t)).map(t=>this.hasPattern(t)?t.pattern:this.hasOp(t)?t.op:"".concat(t))}static formatTimestamp(e){if(e==null||!(e instanceof Date))return null;var t="".concat(e.getHours()).padStart(2,"0"),r="".concat(e.getMinutes()).padStart(2,"0"),i="".concat(e.getSeconds()).padStart(2,"0"),o="".concat(e.getMilliseconds()).padStart(3,"0");return"".concat(t,":").concat(r,":").concat(i,".").concat(o)}static isTableType(e,t){return t===e.VariableType.TABLE||t===e.VariableType.TREETABLE||t===e.VariableType.HIERARCHICALTABLE||t===e.VariableType.PARTITIONEDTABLE}static isWidgetType(e,t){return t===e.VariableType.FIGURE||t===e.VariableType.OTHERWIDGET||t===e.VariableType.PANDAS}static isOpenableType(e,t){return Dr.isTableType(e,t)||Dr.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}const pi=Dr;function Qs(n){var{children:e}=n;return u.jsxs("div",{className:"console-history-item-result",children:[u.jsx("div",{className:"console-history-gutter",children:"-"}),u.jsx("div",{className:"console-history-content",children:e})]})}Qs.propTypes={children:S.node.isRequired};function bi(n,e,t){return e=Mc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mc(n){var e=Nc(n,"string");return typeof e=="symbol"?e:String(e)}function Nc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Js extends m.Component{constructor(e){super(e),bi(this,"timer",void 0),bi(this,"startTime",void 0),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer&&clearInterval(this.timer),this.timer=void 0}updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){var{disabled:e,onCancelClick:t}=this.props,{elapsed:r}=this.state;return u.jsx("div",{className:Z("console-history-result-in-progress",{disabled:e}),children:u.jsxs("span",{className:"badge",children:[u.jsx(ps,{className:"ml-2"}),"Running... ",Ns.formatElapsedTime(r)," ",u.jsx(se,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:Wd,tooltip:"Cancel",onClick:t,disabled:e})]})})}}bi(Js,"defaultProps",{disabled:!1});const Ac=Js;function qn(n,e,t){return e=Lc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Lc(n){var e=Fc(n,"string");return typeof e=="symbol"?e:String(e)}function Fc(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Tn extends m.PureComponent{constructor(e){super(e),qn(this,"mouseX",void 0),qn(this,"mouseY",void 0),qn(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)>=Tn.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=Tn.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(e){this.isClicking&&!e.shiftKey&&!e.metaKey&&!e.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(e=>({isExpanded:!e.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){var{isExpanded:e,isTriggerHovered:t}=this.state,{message:r}=this.props;k(r);var i=r.indexOf(`
|
|
3
|
+
`),o=i>-1,a=r;o&&(a=r.slice(0,i));var s=r.slice(i),l=t?"error-btn-link error-btn-link--active":"error-btn-link";return u.jsxs("div",{className:Z("error-message",{expanded:e}),children:[o&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"error-gutter",children:u.jsx("button",{type:"button",onClick:this.handleToggleError,className:l,tabIndex:-1,children:u.jsx(ue,{icon:e?jn:Ud,transform:"left-3"})})}),u.jsxs("div",{className:"error-content",children:[u.jsx("div",{className:"console-error-text-trigger",role:"button",tabIndex:0,onKeyPress:this.handleKeyPress,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onMouseUp:this.handleMouseUp,children:a}),e?s:""]})]}),!o&&u.jsx("div",{className:"error-content",children:u.jsx("div",{className:"console-error-text",children:a})})]},"error")}}qn(Tn,"defaultProps",{message:""});qn(Tn,"mouseDragThreshold",5);const Rc=Tn;function kc(n,e,t){return e=jc(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jc(n){var e=$c(n,"string");return typeof e=="symbol"?e:String(e)}function $c(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Lo=B.module("ConsoleHistoryItem");class el extends m.PureComponent{constructor(e){super(e),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){Lo.debug("handleObjectClick",e);var{openObject:t}=this.props;t(e)}handleCancelClick(){var{item:e}=this.props;e!=null&&e.cancelResult&&(Lo.debug("Cancelling command: ".concat(e.command)),e.cancelResult())}render(){var{disabled:e,item:t,language:r,iconForType:i}=this.props,{disabledObjects:o,result:a}=t,s=t.command!=null&&t.command!=="",l=null;s&&(l=u.jsxs("div",{className:"console-history-item-command",children:[u.jsx("div",{className:"console-history-gutter",children:">"}),u.jsx("div",{className:"console-history-content",children:u.jsx(Zs,{language:r,children:t.command})})]}));var d=[],h=!1;if(a){var{error:c,message:f,changes:v}=a;if(v){var{created:p,updated:g}=v;[...p,...g].forEach(Q=>{h=!0;var{title:N}=Q,W="".concat(N),j=e===void 0||e||(o??[]).indexOf(W)>=0,Y=u.jsx(se,{kind:"primary",onClick:()=>this.handleObjectClick(Q),className:"btn-console-object",disabled:j,icon:i(Q.type),children:N},W);d.push(Y)})}if(c!=null&&!s){var y,P="".concat((y=c.message)!==null&&y!==void 0?y:c);P||(P=c);var O=u.jsx(Rc,{message:P},"result-error");d.push(O)}if(f!==void 0&&f!==""){var _=u.jsx("div",{className:"log-message",children:f},"log-message");d.push(_)}}else{h=!0;var R=u.jsx(Ac,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");d.push(R)}var U=null;return d.length>0&&(U=u.jsx(Qs,{children:d})),u.jsxs("div",{className:Z("console-command-result",{"console-result-buttons":h}),children:[l,U]})}}kc(el,"defaultProps",{disabled:!1});const Hc=el;function Bc(n,e){return"".concat(n,".").concat(e.command,".").concat(e.result&&e.result.message,".").concat(e.result&&e.result.error)}function Wc(n){for(var{disabled:e=!1,items:t,language:r,openObject:i,supportsType:o,iconForType:a}=n,s=[],l=0;l<t.length;l+=1){var d=t[l],h=u.jsx(Hc,{disabled:e,item:d,openObject:i,language:r,supportsType:o,iconForType:a},Bc(l,d));s.push(h)}return u.jsx("div",{className:"container-fluid console-history",children:s})}var Uc={name:"Console",CLEAR:ce.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[L.CTRL,D.L],macShortcut:[L.CTRL,D.C]}),FOCUS_HISTORY:ce.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[L.CTRL,D.H],macShortcut:[L.CTRL,L.OPTION,D.H]})},Vc={name:"Command History",FOCUS_HISTORY:ce.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[L.CTRL,D.H],macShortcut:[L.CTRL,L.OPTION,D.H]}),SEND_TO_CONSOLE:ce.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[D.ENTER],macShortcut:[D.ENTER]}),SEND_TO_NOTEBOOK:ce.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[L.CTRL,D.ENTER],macShortcut:[L.CMD,D.ENTER]}),RUN:ce.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[L.ALT,D.R],macShortcut:[L.OPTION,D.R]})},Kc={name:"Notebook",RUN:ce.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[L.ALT,D.R],macShortcut:[L.OPTION,D.R]}),RUN_SELECTED:ce.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[L.ALT,L.SHIFT,D.R],macShortcut:[L.OPTION,L.SHIFT,D.R]}),FIND:ce.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[L.CTRL,D.F],macShortcut:[L.CMD,D.F],isEditable:!1}),MINIMAP:ce.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[L.ALT,D.M],macShortcut:[L.OPTION,D.M]}),WORDWRAP:ce.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[L.ALT,D.Z],macShortcut:[L.OPTION,D.Z]})},zc={CONSOLE:Uc,COMMAND_HISTORY:Vc,NOTEBOOK:Kc};const ke=zc,Oe=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),Gc="var(--dh-color-editor-bg)",qc="var(--dh-color-editor-fg)",Xc="var(--dh-color-editor-string)",Zc="var(--dh-color-editor-delimiter)",Yc="var(--dh-color-editor-predefined)",Qc="var(--dh-color-editor-keyword)",Jc="var(--dh-color-editor-storage)",em="var(--dh-color-editor-number)",tm="var(--dh-color-editor-operator)",nm="var(--dh-color-editor-identifier)",rm="var(--dh-color-editor-comment)",yi={"error-foreground":"var(--dh-color-editor-error-fg)",background:Gc,foreground:qc,"line-height":"19px",string:Xc,"string-delim":"var(--dh-color-editor-string-delim)",delimiter:Zc,predefined:Yc,keyword:Qc,storage:Jc,number:em,operator:tm,identifier:nm,"namespace-identifier":"var(--dh-color-editor-identifier-namespace)","identifier-js":"var(--dh-color-editor-identifier-js)",comment:rm,"editor-bracket-foreground1":"var(--dh-color-editor-bracket-fg1)","editor-bracket-foreground2":"var(--dh-color-editor-bracket-fg2)","editor-bracket-foreground3":"var(--dh-color-editor-bracket-fg3)","editor-bracket-foreground4":"var(--dh-color-editor-bracket-fg4)","editor-bracket-foreground5":"var(--dh-color-editor-bracket-fg5)","editor-bracket-foreground6":"var(--dh-color-editor-bracket-fg6)","editor-unexpected-bracket-foreground":"var(--dh-color-editor-unexpected-bracket-fg)","input-option-active-border":"var(--dh-color-editor-input-option-active-border)","focus-border":"var(--dh-color-editor-focus-border)","input-background":"var(--dh-color-editor-input-bg)","input-foreground":"var(--dh-color-editor-input-fg)","input-border":"var(--dh-color-editor-input-border)","editor-line-number-foreground":"var(--dh-color-editor-line-number-fg)","editor-line-number-active-foreground":"var(--dh-color-editor-line-number-active-fg)","editor-selection-background":"var(--dh-color-editor-selection-bg)","editor-inactive-selection-background":"var(--dh-color-editor-inactive-selection-bg)","editor-selection-highlight-background":"var(--dh-color-editor-selection-highlight-bg)","editor-line-highlight-background":"var(--dh-color-editor-line-highlight-bg)","editor-word-highlight-background":"var(--dh-color-editor-word-highlight-bg)","context-menu-background":"var(--dh-color-editor-context-menu-bg)","context-menu-foreground":"var(--dh-color-editor-context-menu-fg)","menu-selection-background":"var(--dh-color-editor-menu-selection-bg)","menu-selection-foreground":"var(--dh-color-editor-menu-selection-fg)","log-date":"var(--dh-color-editor-log-date)","log-error":"var(--dh-color-editor-log-error)","log-info":"var(--dh-color-editor-log-info)","log-stdout":"var(--dh-color-editor-log-stdout)","log-warn":"var(--dh-color-editor-log-warn)","log-debug":"var(--dh-color-editor-log-debug)","log-trace":"var(--dh-color-editor-log-trace)","editor-find-match-background":"var(--dh-color-editor-find-match-bg)","editor-find-match-highlight-background":"var(--dh-color-editor-find-match-highlight-bg)","editor-widget-background":"var(--dh-color-editor-find-bg)","input-option-active-background":"var(--dh-color-editor-find-option-active-bg)","input-option-active-foreground":"var(--dh-color-editor-find-option-active-fg)","editor-suggest-widget-background":"var(--dh-color-editor-suggest-bg)","editor-suggest-widget-border":"var(--dh-color-editor-suggest-border)","editor-suggest-widget-foreground":"var(--dh-color-editor-suggest-fg)","editor-suggest-widget-selected-background":"var(--dh-color-editor-suggest-selected-bg)","editor-suggest-widget-selected-foreground":"var(--dh-color-editor-suggest-selected-fg)","editor-suggest-widget-highlightForeground":"var(--dh-color-editor-suggest-highlight-fg)","editor-suggest-widget-focus-highlight-foreground":"var(--dh-color-editor-suggest-focus-highlight-fg)","list-hover-background":"var(--dh-color-editor-suggest-hover-bg)","text-link-foreground":"var(--dh-color-editor-link-foreground)","text-link-active-foreground":"var(--dh-color-editor-link-active-fg)","editor-link-active-foreground":"var(--dh-color-editor-link-active-fg)"};var im="python",om={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/}}},am={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"]]}},sm={id:im,conf:om,language:am};const lm=sm;var dm="groovy",um={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/}}},hm={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"]]}},cm={id:dm,conf:um,language:hm};const mm=cm;var fm="scala",vm={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>))/}}},gm={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"]]}},pm={id:fm,conf:vm,language:gm};const bm=pm;var ym="deephavenDb",Cm={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},Sm={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"]]}},wm={id:ym,conf:Cm,language:Sm};const Em=wm;var _m="log",Pm={},Tm={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"}]]}},Om={id:_m,conf:Pm,language:Tm};const Im=Om;function Fo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ro(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fo(Object(t),!0).forEach(function(r){Dm(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Fo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Dm(n,e,t){return e=xm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xm(n){var e=Mm(n,"string");return typeof e=="symbol"?e:String(e)}function Mm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Et=B.module("MonacoUtils");class Dt{static init(){var{getWorker:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Et.debug("Initializing Monaco..."),e!==void 0&&Dt.registerGetWorker(e);var{initTheme:t,registerLanguages:r}=Dt;t(),r([Em,lm,mm,Im,bm]),Dt.removeConflictingKeybindings(),Et.debug("Monaco initialized.")}static initTheme(){var e,t,{removeHashtag:r}=Dt,i=bs(yi);Et.debug2("Monaco theme:",yi),Et.debug2("Monaco theme derived:",i);var o=[{token:"",foreground:r(i.foreground)},{token:"string",foreground:r(i.string)},{token:"string.delim",foreground:r(i["string-delim"])},{token:"keyword",foreground:r(i.keyword)},{token:"identifier.js",foreground:r(i["identifier-js"])},{token:"delimiter",foreground:r(i.delimiter)},{token:"comment",foreground:r(i.comment)},{token:"number",foreground:r(i.number)},{token:"storage",foreground:r(i.storage)},{token:"identifier",foreground:r(i.identifier)},{token:"namespace.identifier",foreground:r(i["namespace-identifier"])},{token:"operator",foreground:r(i.operator)},{token:"predefined",foreground:r(i.predefined)},{token:"error.log",foreground:(e=(t=i["log-error"])===null||t===void 0?void 0:t.substring(1))!==null&&e!==void 0?e:""},{token:"warn.log",foreground:r(i["log-warn"])},{token:"info.log",foreground:r(i["log-info"])},{token:"stdout.log",foreground:r(i["log-stdout"])},{token:"trace.log",foreground:r(i["log-trace"])},{token:"debug.log",foreground:r(i["log-debug"])},{token:"date.log",foreground:r(i["log-date"])}],a={foreground:i.foreground,errorForeground:i["error-foreground"],"inputOption.activeBorder":i["input-option-active-border"],"editor.background":i.background,"editor.foreground":i.foreground,"editor.lineHighlightBackground":i["editor-line-highlight-background"],"editorLineNumber.foreground":i["editor-line-number-foreground"],"editorLineNumber.activeForeground":i["editor-line-number-active-foreground"],"editor.selectionBackground":i["editor-selection-background"],"editor.inactiveSelectionBackground":i["editor-inactive-selection-background"],"editor.selectionHighlightBackground":i["editor-selection-highlight-background"],"editor.wordHighlightBackground":i["editor-word-highlight-background"],"editor.findMatchBackground":i["editor-find-match-background"],"editor.findMatchHighlightBackground":i["editor-find-match-highlight-background"],"editorSuggestWidget.background":i["editor-suggest-widget-background"],"editorSuggestWidget.border":i["editor-suggest-widget-border"],"editorSuggestWidget.foreground":i["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":i["editor-suggest-widget-selected-background"],"list.activeSelectionBackground":i["editor-suggest-widget-selected-background"],"editorSuggestWidget.selectedForeground":i["editor-suggest-widget-selected-foreground"],"list.activeSelectionForeground":i["editor-suggest-widget-selected-foreground"],"editorSuggestWidget.highlightForeground":i["editor-suggest-widget-highlightForeground"],"editorSuggestWidget.focusHighlightForeground":i["editor-suggest-widget-focus-highlight-foreground"],"list.hoverBackground":i["list-hover-background"],"dropdown.background":i["context-menu-background"],"dropdown.foreground":i["context-menu-foreground"],"menu.selectionBackground":i["menu-selection-background"],"menu.selectionForeground":i["menu-selection-foreground"],"keybindingLabel.foreground":i["menu-selection-foreground"],"list.focusBackground":i["menu-selection-background"],"editorWidget.background":i["editor-widget-background"],"inputOption.activeBackground":i["input-option-active-background"],"inputOption.activeForeground":i["input-option-active-foreground"],focusBorder:i["focus-border"],"input.background":i["input-background"],"input.foreground":i["input-foreground"],"input.border":i["input-border"],"textLink.foreground":i["text-link-foreground"],"textLink.activeForeground":i["text-link-active-foreground"],"editorLink.activeForeground":i["editor-link-active-foreground"],"editorBracketHighlight.foreground1":i["editor-bracket-foreground1"],"editorBracketHighlight.foreground2":i["editor-bracket-foreground2"],"editorBracketHighlight.foreground3":i["editor-bracket-foreground3"],"editorBracketHighlight.foreground4":i["editor-bracket-foreground4"],"editorBracketHighlight.foreground5":i["editor-bracket-foreground5"],"editorBracketHighlight.foreground6":i["editor-bracket-foreground6"],"editorBracketHighlight.unexpectedBracket.foreground":i["editor-unexpected-bracket-foreground"]};lt.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:o,colors:a});try{lt.setTheme("dh-dark")}catch(s){Et.error("Failed to set 'dh-dark' Monaco theme, falling back to vs-dark",s),lt.setTheme("vs-dark")}}static registerGetWorker(e){window.MonacoEnvironment=Ro(Ro({},window.MonacoEnvironment),{},{getWorker:e})}static removeHashtag(e){var t;return(t=e?.substring(1))!==null&&t!==void 0?t:""}static registerLanguages(e){var t=e.map(r=>{var{id:i}=r;return i});pt.getLanguages().filter(r=>{var{id:i}=r;return t.includes(i)}).forEach(r=>{var i=r;Et.debug2("Overriding default language loader:",i.id)}),e.forEach(r=>{Dt.registerLanguage(r)})}static registerLanguage(e){Et.debug2("Registering language: ",e.id),pt.register(e),pt.onLanguage(e.id,()=>{pt.setLanguageConfiguration(e.id,e.conf),pt.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:lt.EndOfLineSequence.LF;(t=e.getModel())===null||t===void 0||t.setEOL(r)}static openDocument(e,t){var r=e.getModel();k(r);var i={textDocument:{uri:"".concat(r.uri),languageId:r.getLanguageId(),version:r.getVersionId(),text:r.getValue()}};Et.debug2("didOpenDocumentParams: ",i),t.openDocument(i);var o=e.onDidChangeModelContent(a=>{for(var{changes:s,versionId:l}=a,d=[],h=0;h<s.length;h+=1){var c=s[h],{range:f,rangeLength:v,text:p}=c,g={range:{start:{line:f.startLineNumber-1,character:f.startColumn-1},end:{line:f.endLineNumber-1,character:f.endColumn-1}},rangeLength:v,text:p};d.push(g)}if(d.length>0){var y={textDocument:{version:l,uri:"".concat(r.uri)},contentChanges:d};Et.debug2("didChangeDocumentParams",y),t.changeDocument(y)}});return o}static closeDocument(e,t){var r=e.getModel();k(r);var i={textDocument:{uri:"".concat(r.uri)}};t.closeDocument(i)}static registerPasteHandler(e){e.onDidPaste(t=>{var r=/“|”/g,i=/\u200b/g,o=/\u00A0/g,a=e.getModel();k(a);var s=a.getValueInRange(t.range);(r.test(s)||i.test(s)||o.test(s))&&a.applyEdits([{range:t.range,text:s.replace(r,'"').replace(i,"").replace(o," ")}])})}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static removeConflictingKeybindings(){lt.addKeybindingRule({keybinding:ze.CtrlCmd|Gt.KeyD,command:null}),Dt.isMacPlatform()||lt.addKeybindingRule({keybinding:ze.CtrlCmd|Gt.KeyH,command:null})}static disableKeyBindings(e,t){e.addAction({id:"disable-keybindings-".concat(Mt()),label:"",keybindings:t,run:()=>{}})}static getMonacoKeyCodeFromShortcut(e){var{keyState:t}=e,{keyValue:r}=t;if(r===null)return 0;var i=Dt.isMacPlatform();return i?(t.metaKey?ze.CtrlCmd:0)|(t.shiftKey?ze.Shift:0)|(t.altKey?ze.Alt:0)|(t.ctrlKey?ze.WinCtrl:0)|io.fromString(r):(t.ctrlKey?ze.CtrlCmd:0)|(t.shiftKey?ze.Shift:0)|(t.altKey?ze.Alt:0)|(t.metaKey?ze.WinCtrl:0)|io.fromString(r)}static provideLinks(e){for(var t=[],r=function(a){var s=e.getLineContent(a),l=Cd(s),d=l.filter(h=>h.type==="url"?/^https?:\/\//.test(h.value):!0);d.forEach(h=>{t.push({url:h.href,range:new cu(a,h.start+1,a,h.end+1)})})},i=1;i<=e.getLineCount();i+=1)r(i);return{links:t}}}const Xe=Dt;function ri(n,e,t){return e=Nm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Nm(n){var e=Am(n,"string");return typeof e=="symbol"?e:String(e)}function Am(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var _t=B.module("MonacoCompletionProvider");class rn extends m.PureComponent{static lspToMonacoKind(e){var t=pt.CompletionItemKind;switch(e){case 1:return t.Text;case 2:return t.Method;case 3:return t.Function;case 4:return t.Constructor;case 5:return t.Field;case 6:return t.Variable;case 7:return t.Class;case 8:return t.Interface;case 9:return t.Module;case 10:return t.Property;case 11:return t.Unit;case 12:return t.Value;case 13:return t.Enum;case 14:return t.Keyword;case 15:return t.Snippet;case 16:return t.Color;case 17:return t.File;case 18:return t.Reference;case 19:return t.Folder;case 20:return t.EnumMember;case 21:return t.Constant;case 22:return t.Struct;case 23:return t.Event;case 24:return t.Operator;case 25:return t.TypeParameter;default:return t.Variable}}static lspToMonacoRange(e){var{start:t,end:r}=e;return{startLineNumber:t.line+1,startColumn:t.character+1,endLineNumber:r.line+1,endColumn:r.character+1}}static monacoToLspPosition(e){return{line:e.lineNumber-1,character:e.column-1}}constructor(e){super(e),ri(this,"registeredCompletionProvider",void 0),ri(this,"registeredSignatureProvider",void 0),ri(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=pt.registerCompletionItemProvider(e,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),t.getSignatureHelp!=null&&(this.registeredSignatureProvider=pt.registerSignatureHelpProvider(e,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),t.getHover!=null&&(this.registeredHoverProvider=pt.registerHoverProvider(e,{provideHover:this.handleHoverRequest}))}componentWillUnmount(){var e,t,r;(e=this.registeredCompletionProvider)===null||e===void 0||e.dispose(),(t=this.registeredSignatureProvider)===null||t===void 0||t.dispose(),(r=this.registeredHoverProvider)===null||r===void 0||r.dispose()}handleCompletionRequest(e,t,r){var{model:i,session:o}=this.props;if(e!==i)return null;var a={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:rn.monacoToLspPosition(t),context:r},s=o.getCompletionItems(a);_t.debug("Requested completion items",a);var l=s.then(d=>{_t.debug("Completion items received: ",a,d);var h=d.map(c=>{var{label:f,kind:v,detail:p,documentation:g,sortText:y,filterText:P,textEdit:O,insertTextFormat:_}=c;return{label:f,kind:rn.lspToMonacoKind(v),detail:p,documentation:g?.kind==="markdown"?g:g?.value,sortText:y,filterText:P,insertText:O.text,insertTextRules:_===2?4:_,range:rn.lspToMonacoRange(O.range)}});return{incomplete:!0,suggestions:h}}).catch(d=>(_t.error("There was an error retrieving completion items",d),{suggestions:[]}));return l}handleSignatureRequest(e,t,r,i){var o={value:{signatures:[],activeSignature:0,activeParameter:0},dispose:()=>{}},{model:a,session:s}=this.props;if(e!==a||s.getSignatureHelp==null)return null;var l={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:rn.monacoToLspPosition(t),context:i},d=s.getSignatureHelp(l);_t.debug("Requested signature help",l);var h=d.then(c=>{_t.debug("Signatures received: ",l,d);var f=c.map(p=>{var{label:g,documentation:y,parameters:P}=p;return{documentation:y?.kind==="markdown"?y:y?.value,label:g,parameters:P??[]}});if(f.length===0)return o;var v=0;return{value:{signatures:f,activeSignature:v,activeParameter:c[v].activeParameter},dispose:()=>{}}}).catch(c=>(_t.error("There was an error retrieving completion items",c),o));return h}handleHoverRequest(e,t){var{model:r,session:i}=this.props;if(e!==r||i.getHover==null)return null;var o={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:rn.monacoToLspPosition(t)},a=i.getHover(o);_t.debug("Requested hover",o);var s=a.then(l=>{_t.debug("Hover received: ",o,l);var{contents:d}=l;return{contents:d!=null?[d]:[]}}).catch(l=>(_t.error("There was an error retrieving hover",l),{contents:[]}));return s}render(){return null}}const tl=rn;function ko(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Lm(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ko(o,r,i,a,s,"next",l)}function s(l){ko(o,r,i,a,s,"throw",l)}a(void 0)})}}function Ke(n,e,t){return e=Fm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fm(n){var e=Rm(n,"string");return typeof e=="symbol"?e:String(e)}function Rm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ii=B.module("ConsoleInput"),xr=parseInt(yi["line-height"],10),nl=6,rl=6,km=xr+nl+rl,oi=100;class nr extends m.PureComponent{constructor(e){super(e),Ke(this,"cancelListener",void 0),Ke(this,"resizeObserver",void 0),Ke(this,"commandContainer",void 0),Ke(this,"commandEditor",void 0),Ke(this,"commandHistoryIndex",void 0),Ke(this,"commandSuggestionContainer",void 0),Ke(this,"loadingPromise",void 0),Ke(this,"timestamp",void 0),Ke(this,"bufferIndex",void 0),Ke(this,"history",void 0),Ke(this,"modifiedCommands",void 0),this.handleResize=this.handleResize.bind(this),this.commandContainer=H.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.resizeObserver=new window.ResizeObserver(this.handleResize),this.state={commandEditorHeight:xr,isFocused:!1,model:null}}componentDidMount(){this.initCommandEditor(),this.loadMoreHistory()}componentDidUpdate(){this.layoutEditor()}componentWillUnmount(){this.resizeObserver.disconnect(),this.loadingPromise!=null&&this.loadingPromise.cancel(),this.destroyCommandEditor()}setConsoleText(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(e){if(ii.debug("Command received: ",e),!r){var i;this.commandHistoryIndex=null,(i=this.commandEditor)===null||i===void 0||i.setValue(e)}t&&this.focusEnd(),this.updateDimensions(),r&&this.processCommand(e)}}initCommandEditor(){var{language:e,session:t}=this.props,r={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:xr,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:nl,bottom:rl},value:"",wordWrap:"on",autoClosingBrackets:"beforeWhitespace"},i=this.commandContainer.current;k(i),this.commandEditor=lt.create(i,r),Xe.setEOL(this.commandEditor),Xe.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{var o,a=(o=this.commandEditor)===null||o===void 0?void 0:o.getValue();this.modifiedCommands.set(this.commandHistoryIndex,a??null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(o=>{var{commandEditor:a,commandHistoryIndex:s}=this,l=a?.getPosition();k(l);var{lineNumber:d}=l,h=a?.getModel();if(o.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&d===1){s!=null?this.loadCommand(s+1):this.loadCommand(0),this.focusStart(),o.stopPropagation(),o.preventDefault();return}if(o.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&d===h?.getLineCount()){s!=null&&s>0?this.loadCommand(s-1):this.loadCommand(null),this.focusEnd(),o.stopPropagation(),o.preventDefault();return}if(!o.altKey&&!o.shiftKey&&!o.metaKey&&o.keyCode===Gt.Enter&&!this.isSuggestionMenuPopulated()){var c;o.stopPropagation(),o.preventDefault();var f=(c=this.commandEditor)===null||c===void 0?void 0:c.getValue().trim();if(f!==void 0){var v;this.processCommand(f),(v=this.commandEditor)===null||v===void 0||v.setValue("")}}}),Xe.disableKeyBindings(this.commandEditor,[ze.CtrlCmd|Gt.KeyF]),Xe.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.resizeObserver.observe(i),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){var{session:e}=this.props;this.commandEditor&&(Xe.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleResize(){this.updateDimensions()}isSuggestionMenuActive(){var e;if(!this.commandSuggestionContainer){var t,r;this.commandSuggestionContainer=(t=this.commandEditor)===null||t===void 0||(r=t.getDomNode())===null||r===void 0?void 0:r.querySelector(".suggest-widget")}return(e=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!==null&&e!==void 0?e:!1}isSuggestionMenuPopulated(){var e,t,r;return this.isSuggestionMenuActive()&&((e=(t=this.commandSuggestionContainer)===null||t===void 0||(r=t.querySelector(".monaco-list-rows"))===null||r===void 0?void 0:r.childElementCount)!==null&&e!==void 0?e:0)>0}focus(){var e;(e=this.commandEditor)===null||e===void 0||e.focus()}focusStart(){var e,t,r,i,o,a=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();k(a);var s=a.getLineLength(1)+1,l=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(1,s);k(l),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:1,column:s}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(l),(o=this.commandEditor)===null||o===void 0||o.focus()}focusEnd(){var e,t,r,i,o,a=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();k(a);var s=a.getLineCount(),l=a.getLineLength(s)+1,d=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(s,l);k(d),(r=this.commandEditor)===null||r===void 0||r.setPosition({lineNumber:s,column:l}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(d),(o=this.commandEditor)===null||o===void 0||o.focus()}clear(){var e,t,r;(e=this.commandEditor)===null||e===void 0||e.focus(),(t=this.commandEditor)===null||t===void 0||(r=t.getModel())===null||r===void 0||r.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var t,r;if(!(e!==null&&e>=this.history.length)){var i=this.modifiedCommands.get(e),o=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,(t=this.commandEditor)===null||t===void 0||(r=t.getModel())===null||r===void 0||r.setValue(i??o),e!==null&&e>this.history.length-oi&&this.loadMoreHistory()}}loadMoreHistory(){var e=this;return Lm(function*(){try{if(e.loadingPromise!=null||e.bufferIndex==null)return;var{commandHistoryStorage:t,language:r,scope:i}=e.props;e.loadingPromise=Ee.makeCancelable(t.getTable(r,i??"",e.timestamp),s=>s.close());var o=yield e.loadingPromise;o.setReversed(!0),o.setViewport({top:e.bufferIndex,bottom:e.bufferIndex+oi-1}),e.loadingPromise=Ee.makeCancelable(o.getViewportData(),()=>o.close());var a=yield e.loadingPromise;e.bufferIndex+=oi,e.bufferIndex>=o.size&&(e.bufferIndex=null),e.history=[...a.items.filter((s,l,d)=>{var{name:h}=s;return l===0||h!==d[l-1].name}).map(s=>{var{name:l}=s;return l}).reverse(),...e.history],e.loadingPromise=void 0,o.close()}catch(s){if(e.loadingPromise=void 0,Ee.isCanceled(s)){ii.debug2("Promise canceled, not loading history");return}ii.error("Error fetching history",s)}})()}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),k(e),e!==""&&(this.history.length===0||e!==this.history[this.history.length-1])&&this.history.push(e),this.updateDimensions();var{onSubmit:t}=this.props;t(e)}updateDimensions(){if(this.commandEditor){var{maxHeight:e}=this.props;k(e);var t=this.commandEditor.getContentHeight(),r=Math.max(Math.min(t,e),km),i=t>r,o={overviewRulerLanes:i?void 0:0};this.setState({commandEditorHeight:r},()=>{var a,s;(a=this.commandEditor)===null||a===void 0||a.updateOptions(o),(s=this.commandEditor)===null||s===void 0||s.layout()})}}render(){var{disabled:e,language:t,session:r}=this.props,{commandEditorHeight:i,isFocused:o,model:a}=this.state;return u.jsx("div",{className:Z("console-input-wrapper",{disabled:e}),children:u.jsxs("div",{className:Z("console-input-inner-wrapper",{focus:o}),children:[u.jsx("div",{className:nr.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:i}}),a&&u.jsx(tl,{model:a,language:t,session:r})]})})}}Ke(nr,"defaultProps",{maxHeight:xr*10,scope:null,disabled:!1});Ke(nr,"INPUT_CLASS_NAME","console-input");const jo=nr;function Vt(n,e,t){return e=jm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jm(n){var e=$m(n,"string");return typeof e=="symbol"?e:String(e)}function $m(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var $o="pasted values",Hm=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],ai=[".csv",".tsv",".tab",".psv",".dsv",".txt"],Ho=[".zip"];class bt extends m.Component{static isValidDropItem(e){return e!=null&&e.kind==="file"&&!Hm.find(t=>t.test(e.type))}static isValidExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return ai.some(r=>e.endsWith(r))||t&&Ho.some(r=>e.endsWith(r))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===$o?to:e.endsWith(".csv")?Vd:e.endsWith(".zip")?Kd:zd}constructor(e){super(e),Vt(this,"fileElem",void 0),Vt(this,"divElem",void 0),Vt(this,"getValidExtensions",yt(t=>t?[...ai,...Ho]:[...ai])),Vt(this,"getAcceptString",yt(t=>this.getValidExtensions(t).join(", "))),Vt(this,"getFileTypeErrorString",yt(t=>xs.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=H.createRef(),this.divElem=H.createRef(),this.state={selectedFileName:""}}componentDidMount(){var e,t;(e=this.divElem.current)===null||e===void 0||e.addEventListener("paste",this.handlePasteEvent),(t=this.divElem.current)===null||t===void 0||t.focus()}componentWillUnmount(){var e;(e=this.divElem.current)===null||e===void 0||e.removeEventListener("paste",this.handlePasteEvent)}handleSelectFile(){if(this.fileElem.current){var e;this.fileElem.current.value="",(e=this.fileElem.current)===null||e===void 0||e.click()}}handleFiles(e){e.stopPropagation(),e.preventDefault();var{files:t}=e.target;t!=null&&this.handleFile(t[0])}handleDrop(e){var{allowZip:t,clearDragError:r,dragError:i}=this.props;if(e.preventDefault(),e.stopPropagation(),i!=null){r();return}if(!(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)){var o=e.dataTransfer.items[0].getAsFile();k(o),bt.isValidExtension(o.name,t)?this.handleFile(o):this.setState({dropError:bt.FILE_TYPE_ERROR})}}unstageFile(e){var{onCancel:t}=this.props;e.stopPropagation(),e.preventDefault(),t(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(e){var{onFileOpened:t}=this.props;t(e),this.setState({selectedFileName:e.name,dropError:void 0})}handleMenuPaste(){var{onPaste:e,onError:t,uploadInProgress:r}=this.props;r||navigator.clipboard.readText().then(i=>{e(i),this.setState({selectedFileName:$o,dropError:void 0})}).catch(i=>t(i))}handlePasteEvent(e){e.stopPropagation(),e.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){var{uploadInProgress:e}=this.props;return[{title:"Paste",icon:to,action:this.handleMenuPaste,shortcut:Kt.PASTE,disabled:e}]}render(){var{allowZip:e,dragError:t,uploadInProgress:r}=this.props,{selectedFileName:i,dropError:o}=this.state,a=t??o,s=this.makeContextMenuItems();return u.jsxs("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:bt.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[u.jsx(ee,{actions:s}),u.jsx("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!i&&(a===void 0||a==="")&&u.jsxs("div",{className:"message-content",children:[u.jsx("div",{className:"message-icon",children:u.jsx(ue,{icon:Gd})}),u.jsx("label",{children:"Drop file (or paste values) here to import"}),u.jsx("div",{className:"message-small",children:u.jsx("label",{children:"or"})}),u.jsx(se,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),i&&(a===void 0||a==="")&&u.jsxs("div",{className:"selected-content",children:[u.jsx("div",{className:"selected-icon",children:u.jsx(ue,{icon:bt.getIcon(i)})}),u.jsxs("div",{className:"selected-text",children:[u.jsx("label",{children:"Selected File"}),u.jsxs("label",{className:"selected-name",children:[i,!r&&u.jsx(se,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:ys,tooltip:"Remove"})]})]})]}),!!a&&u.jsxs("div",{className:"message-content",children:[u.jsx("div",{className:"message-icon",children:u.jsx(ue,{icon:Cs})}),u.jsx("label",{children:a}),a===bt.FILE_TYPE_ERROR&&u.jsx("div",{className:"message-small",children:u.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}Vt(bt,"defaultProps",{allowZip:!1,dragError:null});Vt(bt,"MULTIPLE_FILE_ERROR","Please select only one file");Vt(bt,"FILE_TYPE_ERROR","Filetype not supported.");const yn=bt;function hn(n,e,t){return e=Bm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Bm(n){var e=Wm(n,"string");return typeof e=="symbol"?e:String(e)}function Wm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Xt{}hn(Xt,"INTEGER","int");hn(Xt,"LONG","long");hn(Xt,"DOUBLE","double");hn(Xt,"BOOLEAN","bool");hn(Xt,"STRING","string");hn(Xt,"DATE_TIME","datetime");hn(Xt,"LOCAL_TIME","localtime");const ae=Xt;function il(n,e){var t=n.internalStream("string");return t.readable=!0,t.read=()=>!1,t.removeListener=()=>!1,t.on("data",(r,i)=>e(i)),t}function Bo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Wo(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Bo(Object(t),!0).forEach(function(r){Fe(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Bo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Fe(n,e,t){return e=Um(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Um(n){var e=Vm(n,"string");return typeof e=="symbol"?e:String(e)}function Vm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Uo="unknown",Km=2147483647,zm=-2147483648,Vo=/^[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]+)?$/,Ko=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class xe{static determineType(e,t,r){if(!e||e===r)return t;switch(t){case ae.STRING:return ae.STRING;case ae.INTEGER:return xe.checkInteger(e);case ae.LONG:return xe.checkLong(e);case ae.DOUBLE:return xe.checkDouble(e);case ae.BOOLEAN:return xe.checkBoolean(e);case ae.DATE_TIME:return xe.checkDateTime(e);case ae.LOCAL_TIME:return xe.checkLocalTime(e);default:return xe.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){var t=e.replace(/,/g,"");return xe.isNotParsableNumber(t)?ae.STRING:xe.getNumberType(t)}static checkLong(e){var t=e.replace(/,/g,"");return xe.isNotParsableNumber(t)?ae.STRING:t.includes(".")?ae.DOUBLE:ae.LONG}static checkDouble(e){var t=e.replace(/,/g,"");return xe.isNotParsableNumber(t)?ae.STRING:ae.DOUBLE}static checkBoolean(e){var t=e.toLowerCase();return t==="true"||t==="false"?ae.BOOLEAN:ae.STRING}static checkDateTime(e){return Vo.test(e)?ae.DATE_TIME:ae.STRING}static checkLocalTime(e){return Ko.test(e)?ae.LOCAL_TIME:ae.STRING}static getTypeFromUnknown(e){var t=e.replace(/,/g,"");if(xe.isNotParsableNumber(t)){var r=e.toLowerCase();return r==="true"||r==="false"?ae.BOOLEAN:Vo.test(e)&&e.includes(":")?ae.DATE_TIME:Ko.test(e)?ae.LOCAL_TIME:ae.STRING}return xe.getNumberType(t)}static getNumberType(e){if(e.includes("."))return ae.DOUBLE;var t=e.startsWith("-")?11:10;if(e.length>t)return ae.LONG;var r=parseInt(e,10);return r>Km||r<zm?ae.LONG:ae.INTEGER}constructor(e,t,r,i,o,a,s,l,d,h){Fe(this,"onFileCompleted",void 0),Fe(this,"file",void 0),Fe(this,"readHeaders",void 0),Fe(this,"nullString",void 0),Fe(this,"onProgress",void 0),Fe(this,"onError",void 0),Fe(this,"types",void 0),Fe(this,"chunks",void 0),Fe(this,"totalChunks",void 0),Fe(this,"rowCount",void 0),Fe(this,"isZip",void 0),Fe(this,"shouldTrim",void 0),Fe(this,"zipProgress",void 0),Fe(this,"config",void 0),this.onFileCompleted=e,this.file=t,this.readHeaders=r,this.nullString=o,this.onProgress=a,this.onError=s,this.chunks=0,this.totalChunks=l,this.rowCount=0,this.isZip=d,this.shouldTrim=h,this.zipProgress=0,this.handleChunk=this.handleChunk.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.config=Wo(Wo({},i),{},{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=il(this.file,this.handleNodeUpdate);Un.parse(e,this.config),e.resume()}}handleChunk(e,t){var{data:r}=e;if(!this.types){if(r==null||r.length===0){t.abort(),this.onError("Error parsing CSV: no data in file.");return}this.types=new Array(r[0].length).fill(Uo),this.readHeaders&&(r=r.slice(1))}this.rowCount+=r.length,k(this.types);var i=[...this.types];r.forEach(s=>{if(s.length>=i.length){for(var l=0;l<i.length;l+=1)i[l]=xe.determineType(this.shouldTrim?s[l].trim():s[l],i[l],this.nullString);this.types=i}else t.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
|
|
4
4
|
Expected length `.concat(i.length," but found ").concat(s.length,`.
|
|
5
|
-
Row = `).concat(s))}),this.chunks+=1;var o=0;this.totalChunks>0?o=Math.round(this.chunks/this.totalChunks*50):o=Math.round(this.zipProgress/2);var a=this.onProgress(o);a&&t.abort()}handleComplete(e){var{types:t,onFileCompleted:r}=this;k(t),(e==null||!e.meta.aborted)&&r(t.map(i=>i===
|
|
6
|
-
`).concat(a));for(var s=0;s<e;s+=1){var l=this.type.shouldTrim?t[o][s].trim():t[o][s];i[s][o]=this.nullCheck(l)}}return i}nullCheck(e){return e===this.type.nullString?"":e}parse(){var e=(r,i)=>{if(this.types=r,this.rowCount=i,this.file instanceof File||this.file instanceof Blob)Un.parse(this.file,this.config);else{var o=
|
|
5
|
+
Row = `).concat(s))}),this.chunks+=1;var o=0;this.totalChunks>0?o=Math.round(this.chunks/this.totalChunks*50):o=Math.round(this.zipProgress/2);var a=this.onProgress(o);a&&t.abort()}handleComplete(e){var{types:t,onFileCompleted:r}=this;k(t),(e==null||!e.meta.aborted)&&r(t.map(i=>i===Uo||i===ae.LOCAL_TIME?ae.STRING:i),this.rowCount)}handleError(e){var{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}const Gm=xe;function fe(n,e,t){return e=qm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qm(n){var e=Xm(n,"string");return typeof e=="symbol"?e:String(e)}function Xm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var vr=B.module("CsvParser"),Zm=650;class On{static generateHeaderRecursive(e){var t="",r=e;return e>=26&&(t=t.concat(On.generateHeaderRecursive(Math.floor(e/26)-1)),r=e%26),t.concat(String.fromCharCode(65+r))}constructor(e){var{onFileCompleted:t,session:r,file:i,type:o,readHeaders:a=!0,onProgress:s,onError:l,timeZone:d,isZip:h}=e;fe(this,"onFileCompleted",void 0),fe(this,"session",void 0),fe(this,"file",void 0),fe(this,"isZip",void 0),fe(this,"type",void 0),fe(this,"readHeaders",void 0),fe(this,"timeZone",void 0),fe(this,"onProgress",void 0),fe(this,"onError",void 0),fe(this,"tables",void 0),fe(this,"headers",void 0),fe(this,"types",void 0),fe(this,"rowCount",void 0),fe(this,"rowsProcessed",void 0),fe(this,"chunks",void 0),fe(this,"totalChunks",void 0),fe(this,"isComplete",void 0),fe(this,"zipProgress",void 0),fe(this,"consolidatedChunks",void 0),fe(this,"numConsolidated",void 0),fe(this,"isCancelled",void 0),fe(this,"config",void 0),this.onFileCompleted=t,this.session=r,this.file=i,this.isZip=h,this.type=o,this.readHeaders=a,this.timeZone=d,this.onProgress=s,this.onError=l,this.tables=[],this.rowCount=0,this.rowsProcessed=0,this.chunks=0,this.totalChunks=h?0:Math.ceil(i.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 r=t.length,i=new Array(e).fill(null).map(()=>new Array(r)),o=0;o<r;o+=1){var a=t[o];if(a.length<e)throw new Error("Insufficient columns. Expected ".concat(e," but found ").concat(a.length,`
|
|
6
|
+
`).concat(a));for(var s=0;s<e;s+=1){var l=this.type.shouldTrim?t[o][s].trim():t[o][s];i[s][o]=this.nullCheck(l)}}return i}nullCheck(e){return e===this.type.nullString?"":e}parse(){var e=(r,i)=>{if(this.types=r,this.rowCount=i,this.file instanceof File||this.file instanceof Blob)Un.parse(this.file,this.config);else{var o=il(this.file,this.handleNodeUpdate);Un.parse(o,this.config),o.resume()}},t=new Gm(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:r,onError:i,handleCreateTable:o,isZip:a,tables:s}=this;if(this.isCancelled){vr.debug2("CSV parser cancelled."),t.abort(),s.forEach(c=>c.close());return}var{data:l}=e;this.headers||(r?(this.headers=Os.legalizeColumnNames(l[0]),l=l.slice(1)):this.headers=On.generateHeaders(l[0].length));var d=[];try{if(d=this.transpose(this.headers.length,l),a)this.consolidateChunks(d,t);else{var h=this.chunks;this.chunks+=1,o(h,d,t)}}catch(c){i(c)}}consolidateChunks(e,t){if(!this.consolidatedChunks)this.consolidatedChunks=e.slice();else for(var r=0;r<e.length;r+=1)this.consolidatedChunks[r]=this.consolidatedChunks[r].concat(e[r]);this.numConsolidated+=1,(this.numConsolidated>=Zm||this.isComplete)&&this.uploadConsolidatedChunks(t)}uploadConsolidatedChunks(e){var t,{handleCreateTable:r}=this,i=this.chunks;this.chunks+=1;var o=(t=this.consolidatedChunks)===null||t===void 0?void 0:t.slice();this.consolidatedChunks=void 0,this.numConsolidated=0,k(o),r(i,o,e)}handleCreateTable(e,t,r){var{session:i,tables:o,onFileCompleted:a,totalChunks:s,types:l,onProgress:d,onError:h}=this;r&&r.pause(),k(this.headers),k(l),this.rowsProcessed+=t[0].length,i.newTable(this.headers,l,t,this.timeZone).then(c=>{if(this.isCancelled){vr.debug2("CSV parser cancelled."),r&&r.abort(),o.forEach(v=>v.close());return}r&&r.resume(),o[e]=c;var f=0;s>0?f=Math.round(o.length/s*50)+50:f=Math.round(this.rowsProcessed/this.rowCount*50)+50,vr.debug2("CSV parser progress ".concat(f)),d(f),this.isComplete&&o.length===this.chunks&&(vr.debug2("CSV parser complete."),a(o))}).catch(c=>{!this.isComplete&&r&&r.abort(),h(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}}fe(On,"generateHeaders",n=>{for(var e=[],t=0;t<n;t+=1)e.push(On.generateHeaderRecursive(t));return e});const Ym=On;function $i(n,e,t){return e=Qm(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Qm(n){var e=Jm(n,"string");return typeof e=="symbol"?e:String(e)}function Jm(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Vr{static fromExtension(e){return e.endsWith(".csv")?"DEFAULT_CSV":e.endsWith(".tsv")||e.endsWith(".tab")?"TSV":e.endsWith(".psv")?"PIPE_SV":"AUTODETECT"}}$i(Vr,"DEFAULT_TYPE","DEFAULT_CSV");$i(Vr,"AUTO","AUTODETECT");$i(Vr,"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
|
|
7
7
|
`,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!0,nullString:null},EXCEL_CSV:{name:"Excel csv (strict)",delimiter:",",newline:`\r
|
|
8
8
|
`,escapeChar:'"',shouldTrim:!0,skipEmptyLines:!1,nullString:null},MY_SQL_CSV:{name:"MySQL csv",delimiter:" ",newline:`
|
|
9
9
|
`,escapeChar:"\\",shouldTrim:!0,skipEmptyLines:!1,nullString:"\\N"},RFC4180_CSV:{name:"RFC4180 csv",delimiter:",",newline:`\r
|
|
10
|
-
`,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 $n=Vr;function sl(n,e,t){return e=tf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tf(n){var e=nf(n,"string");return typeof e=="symbol"?e:String(e)}function nf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Go=B.module("CsvInputBar"),rf=Object.entries($n.TYPES).map(n=>{var[e,t]=n;return u.jsx("option",{value:e,children:t.name},e)});class ll extends m.Component{constructor(e){super(e),sl(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=H.createRef(),this.state={tableName:"",tableNameSet:!1,isFirstRowHeaders:!0,showProgress:!1,progressValue:0,type:$n.DEFAULT_TYPE,parser:null}}componentDidUpdate(e){var{file:t,paste:r}=this.props,{tableName:i,tableNameSet:o}=this.state;if(!o&&t!=null&&!i){var a,s=t.name.lastIndexOf("."),l=Ds.legalizeTableName(t.name.substring(0,s));this.setState({tableName:l,tableNameSet:!0}),(a=this.inputRef.current)===null||a===void 0||a.focus()}else(t==null&&e.file!=null||r==null&&e.paste!=null)&&this.setState({tableName:"",tableNameSet:!1});r!=null&&r!==""&&!i&&this.inputRef.current&&this.inputRef.current.focus(),t!=null&&t!==e.file?this.setState({type:$n.fromExtension(t.name)}):r!=null&&r!==""&&(e.paste===void 0||e.paste==="")&&this.setState({type:$n.AUTO})}componentWillUnmount(){var{parser:e}=this.state;e&&e.cancel()}handleCancel(){var{onClose:e}=this.props;e()}handleError(e){var{onClose:t,onError:r}=this.props;Go.error(e),r(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:r}=this.props;t!=null?t.name.endsWith(".zip")?this.handleZipFile(t):this.handleFile(t):r!==void 0&&r!==""&&this.handleFile(new Blob([r],{type:"text/plain"}))}handleFile(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;Go.info("Starting CSV parser for ".concat(e instanceof File?e.name:"pasted values"," ").concat(t?"":e.size," bytes"));var{session:r,timeZone:i,onInProgress:o}=this.props,{tableName:a,isFirstRowHeaders:s,type:l}=this.state,d=c=>{c.length===1?r.bindTableToVariable(c[0],a).then(()=>this.openTable()).catch(f=>this.handleError(f)):r.mergeTables(c).then(f=>{r.bindTableToVariable(f,a).then(()=>this.openTable()).catch(v=>this.handleError(v)),c.forEach(v=>v.close())}).catch(f=>this.handleError(f))},h=new Qm({onFileCompleted:d,session:r,file:e,type:$n.TYPES[l],readHeaders:s,onProgress:this.handleProgress,onError:this.handleError,timeZone:i,isZip:t});h.parse(),this.setState({showProgress:!0,parser:h}),o(!0)}handleZipFile(e){var{onUpdate:t,unzip:r}=this.props;if(r==null){this.handleError(new Error("No support for zip files available."));return}r(e).then(i=>{for(var o=!1,a=0;a<i.length;a+=1){var s=i[a];if(yn.isValidExtension(s.name)){t("Loading ".concat(s.name," as csv from ").concat(e.name)),o=!0,this.handleFile(s,!0);break}}if(!o)throw new Error("No csv file found in ".concat(e.name))}).catch(i=>this.handleError(i))}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:r}=this.state;e(r),t()}handleQueryTypeChange(e){this.setState({type:e})}render(){var{file:e,paste:t}=this.props,{tableName:r,isFirstRowHeaders:i,showProgress:o,progressValue:a,type:s}=this.state,l=!!t&&!r;return u.jsxs("div",{className:"csv-input-bar",children:[!o&&u.jsxs("form",{onSubmit:this.handleUpload,className:"csv-input-bar-container form-inline",children:[u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"tableNameInput",children:"Table name"}),u.jsx("input",{ref:this.inputRef,id:"tableNameInput",type:"text",className:Z("form-control",{"is-invalid":l}),value:r,onChange:this.handleTableName})]}),u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"formatSelect",children:"File format"}),u.jsx(Pc,{id:"formatSelect",className:"custom-select",value:s,onChange:this.handleQueryTypeChange,children:rf})]}),u.jsx(kh,{className:"firstRowHeaders",checked:i,onChange:this.toggleFirstRowHeaders,children:"First row is column headers"}),u.jsxs("div",{className:"csv-input-buttons form-group",children:[u.jsx(se,{kind:"secondary",onClick:this.handleCancel,children:"Cancel"}),u.jsx(se,{kind:"primary",type:"submit",disabled:!(e!==null||t!==void 0&&t!=="")||!r,children:"Upload"})]})]}),o&&u.jsxs("div",{className:"csv-progress-container",children:[u.jsx("label",{children:"Uploading Table"}),u.jsx("div",{className:"progress",children:u.jsx("div",{className:"progress-bar bg-primary",style:{width:"".concat(a,"%")},"aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":100})}),u.jsxs("label",{children:[a,"%"]}),u.jsx(se,{kind:"primary",onClick:this.handleCancelInProgress,children:"Cancel"})]})]})}}sl(ll,"defaultProps",{file:null,paste:null,unzip:null});const of=ll;function pr(n,e,t){return e=af(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function af(n){var e=sf(n,"string");return typeof e=="symbol"?e:String(e)}function sf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var qo=B.module("ConsoleMenu");class Nr extends m.PureComponent{static makeItemActions(e,t,r,i,o){if(e.length===0)return[];var a={menuElement:u.jsx($i,{value:t,onChange:i,className:"console-menu",ref:r})},s=e;t&&(s=s.filter(d=>{var{title:h}=d;return h!=null&&h.toLowerCase().indexOf(t.toLowerCase())>=0}));var l=s.map(d=>({title:d.title,action:()=>{o(d)}}));return[a,...l]}constructor(e){super(e),pr(this,"tableSearchField",void 0),pr(this,"widgetSearchField",void 0),pr(this,"makeTableActions",yt((t,r,i)=>{var{dh:o}=this.props,a=t.filter(s=>bi.isTableType(o,s.type));return Nr.makeItemActions(a,r,s=>{this.tableSearchField=s},this.handleTableFilterChange,i)})),pr(this,"makeWidgetActions",yt((t,r,i)=>{var{dh:o}=this.props,a=t.filter(s=>bi.isWidgetType(o,s.type));return Nr.makeItemActions(a,r,s=>{this.widgetSearchField=s},this.handleWidgetFilterChange,i)})),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){qo.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){qo.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:r}=this.props,{tableFilterText:i,widgetFilterText:o}=this.state,a=this.makeTableActions(t,i,r),s=this.makeWidgetActions(t,o,r),l={placement:"bottom-end"},d=a.length===0,h=s.length===0;return u.jsxs(u.Fragment,{children:[u.jsx(se,{"aria-label":"Tables",kind:"ghost",disabled:d,onClick:()=>{},icon:u.jsxs("div",{className:"fa-md fa-layers",children:[u.jsx(ue,{mask:bs,icon:jn,transform:"right-5 down-5"}),u.jsx(ue,{icon:jn,transform:"right-8 down-6"})]}),tooltip:d?"No tables available":"Tables",children:u.jsx(Gn,{actions:a,onMenuOpened:this.handleTableMenuOpened,onMenuClosed:this.handleTableMenuClosed,options:{initialKeyboardIndex:1},popperOptions:l},"table-actions ")}),u.jsx(se,{"aria-label":"Widgets",kind:"ghost",disabled:s.length===0,onClick:()=>{},icon:u.jsxs("div",{className:"fa-md fa-layers",children:[u.jsx(ue,{mask:ps,icon:jn,transform:"right-5 down-5"}),u.jsx(ue,{icon:jn,transform:"right-8 down-6"})]}),tooltip:h?"No widgets available":"Widgets",children:u.jsx(Gn,{actions:s,onMenuOpened:this.handleWidgetMenuOpened,onMenuClosed:this.handleWidgetMenuClosed,options:{initialKeyboardIndex:1},popperOptions:l},"table-actions")}),u.jsx(se,{kind:"ghost",icon:Es,tooltip:"More Actions...","aria-label":"More Actions...",onClick:()=>{},children:u.jsx(Gn,{actions:e,popperOptions:l})})]})}}const lf=Nr;function dl(n,e,t){return e=df(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function df(n){var e=uf(n,"string");return typeof e=="symbol"?e:String(e)}function uf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ul extends m.PureComponent{constructor(e){super(e),dl(this,"pending",void 0),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandCompleted=this.handleCommandCompleted.bind(this),this.pending=new Mn,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(r=>this.handleCommandCompleted(r)),this.setState({isCommandRunning:!0})}handleCommandCompleted(e){e instanceof vi||this.setState({isCommandRunning:this.pending.pending.length>0})}render(){var{children:e,dh:t,openObject:r,overflowActions:i,objects:o}=this.props,{isDisconnected:a,isCommandRunning:s}=this.state,l=null,d=null;return a?(l="console-status-icon-disconnected",d="Worker is disconnected"):s?(l="console-status-icon-pending",d="Worker is busy"):(l="console-status-icon-idle",d="Worker is idle"),u.jsxs("div",{className:"console-pane-status-bar",children:[u.jsxs("div",{children:[u.jsx("div",{className:Z("console-status-icon",l)}),u.jsx(qt,{children:d})]}),e,u.jsx(lf,{dh:t,overflowActions:i,openObject:r,objects:o})]})}}dl(ul,"defaultProps",{children:null});const hf=ul;function Xo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function at(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Xo(Object(t),!0).forEach(function(r){nt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Xo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function nt(n,e,t){return e=cf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cf(n){var e=mf(n,"string");return typeof e=="symbol"?e:String(e)}function mf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var mt=B.module("Console"),Zo={isAutoLaunchPanelsEnabled:!0,isPrintStdOutEnabled:!0,isClosePanelsOnDisconnectEnabled:!0};function ff(){return!0}function vf(n){return u.jsx(u.Fragment,{})}class zt extends m.PureComponent{static isErrorLevel(e){return e===Oe.STDERR||e===Oe.ERROR||e===Oe.FATAL}static isOutputLevel(e){return e===Oe.STDOUT||zt.isErrorLevel(e)}constructor(e){super(e),nt(this,"cancelListener",void 0),nt(this,"consolePane",void 0),nt(this,"consoleInput",void 0),nt(this,"consoleHistoryScrollPane",void 0),nt(this,"pending",void 0),nt(this,"queuedLogMessages",void 0),nt(this,"processLogMessageQueue",Ni(()=>{this.setState(i=>{mt.debug2("processLogMessageQueue",this.queuedLogMessages.length," items");var{consoleHistory:o}=i;return o=o.concat(this.queuedLogMessages),this.queuedLogMessages=[],{consoleHistory:o}})},zt.LOG_THROTTLE)),nt(this,"getObjects",yt(i=>[...i.values()])),nt(this,"getContextActions",yt(i=>[...i,{action:this.handleClearShortcut,shortcut:ke.CONSOLE.CLEAR},{action:this.handleFocusHistory,shortcut:ke.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=H.createRef(),this.consoleInput=H.createRef(),this.consoleHistoryScrollPane=H.createRef(),this.pending=new Mn,this.queuedLogMessages=[];var{objectMap:t,settings:r}=this.props;this.state=at(at({consoleHistory:[],consoleHeight:0,isScrollDecorationShown:!1,objectHistoryMap:new Map,objectMap:new Map(t),showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1,isStuckToBottom:!0},Zo),r)}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:r,state:i}=this;this.sendSettingsChange(t,i),r.objectMap!==e.objectMap&&this.updateObjectMap(),i.isStuckToBottom&&!this.isAtBottom()&&this.scrollConsoleHistoryToBottom()}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)}isAtBottom(){if(this.consoleHistoryScrollPane.current==null)return!1;var{scrollHeight:e,clientHeight:t,scrollTop:r}=this.consoleHistoryScrollPane.current;return Math.abs(e-t-r)<=1}handleClearShortcut(e){var t;e.preventDefault(),e.stopPropagation(),(t=this.consoleInput.current)===null||t===void 0||t.clear()}handleCommandStarted(e){var{code:t,result:r}=e.detail,i=this.pending.add(r),o={command:t,disabledObjects:[],startTime:Date.now(),cancelResult:()=>{r.cancel()},wrappedResult:i},{commandHistoryStorage:a,language:s,scope:l}=this.props,d=a.addItem(s,l,t,{command:t,startTime:new Date().toJSON()});d.catch(h=>{mt.debug("Error adding workspace item",h)}),this.setState(h=>({consoleHistory:h.consoleHistory.concat(o)}),()=>{this.scrollConsoleHistoryToBottom()}),i.then(h=>{this.handleCommandResult(h,o,d)}).catch(h=>{this.handleCommandError(h,o,d)})}handleCommandResult(e,t,r){var i=at(at({},t),{},{wrappedResult:void 0,cancelResult:void 0,result:e??t.result});this.setState(o=>{var{consoleHistory:a}=o,s=a.lastIndexOf(t);if(s<0)return mt.error("historyItem not found in consoleHistory"),null;var l=a.concat();return l[s]=i,{consoleHistory:l}}),e&&(this.updateHistory(e,i),this.updateKnownObjects(i),this.updateWorkspaceHistoryItem({error:e.error},r),this.closeRemovedItems(e.changes),this.openUpdatedItems(e.changes))}handleCommandError(e,t,r){if(Ee.isCanceled(e)){mt.debug("Called handleCommandError on a cancelled promise result");return}this.updateWorkspaceHistoryItem({error:"".concat(e)},r),this.setState(i=>{var o=i.consoleHistory.concat(),a=o.lastIndexOf(t),s=at({},t);return s.wrappedResult=void 0,s.cancelResult=void 0,s.endTime=Date.now(),s.result={error:e},o[a]=s,{consoleHistory:o}})}handleFocusHistory(e){e.preventDefault(),e.stopPropagation();var{focusCommandHistory:t}=this.props;t()}handleLogMessage(e){var{isPrintStdOutEnabled:t}=this.state;t&&zt.isOutputLevel(e.logLevel)&&this.queueLogMessage(e.message,e.logLevel)}queueLogMessage(e,t){var r={};zt.isErrorLevel(t)?r.error=e:r.message=e;var i={command:void 0,result:r};this.queuedLogMessages.push(i),this.processLogMessageQueue()}openUpdatedItems(e){mt.debug("openUpdatedItems",e);var{isAutoLaunchPanelsEnabled:t}=this.state;if(e!=null){var{openObject:r}=this.props;[...e.created,...e.updated].forEach(i=>r(i,t&&(i.title===void 0||!i.title.startsWith("_"))))}}closeRemovedItems(e){if(!(e==null||e.removed==null||e.removed.length===0)){var{closeObject:t}=this.props,{removed:r}=e;r.forEach(i=>t(i))}}updateHistory(e,t){var r=t;e==null||e.changes==null||r==null||(r.endTime=Date.now(),this.setState(i=>{var o=i.consoleHistory.concat();return{consoleHistory:o}}))}updateKnownObjects(e){var t;if(e.result&&(t=e.result.changes),!t||(t.created==null||t.created.length===0)&&(t.updated==null||t.updated.length===0)&&(t.removed==null||t.removed.length===0)){mt.debug2("updateKnownObjects no changes");return}this.setState(r=>{var i,o,a,{consoleHistory:s}=r,l=s.lastIndexOf(e);if(l<0)return mt.error("historyItem not found in state.consoleHistory"),null;var d=new Map(r.objectHistoryMap),h=new Map(r.objectMap),c=function(v){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{title:g}=v;k(g);var y=d.get(g);if(y!=null&&y>=0){var P;s===r.consoleHistory&&(s=s.concat());var O=at(at({},s[y]),{},{disabledObjects:[...(P=s[y].disabledObjects)!==null&&P!==void 0?P:[],g]});s[y]=O}d.set(g,l),p?h.delete(g):h.set(g,v)};return(i=t)===null||i===void 0||i.updated.forEach(f=>c(f)),(o=t)===null||o===void 0||o.removed.forEach(f=>c(f,!0)),(a=t)===null||a===void 0||a.created.forEach(f=>{var{title:v}=f;k(v),d.set(v,l),h.set(v,f)}),{objectHistoryMap:d,objectMap:h,consoleHistory:s}})}updateObjectMap(){var{objectMap:e}=this.props;this.setState({objectMap:e})}updateWorkspaceHistoryItem(e,t){var r=this.pending.add(t),i=new Date().toJSON();r.then(o=>{var a=at(at({},o),{},{data:at(at({},o.data),{},{endTime:i,result:e})}),{commandHistoryStorage:s,language:l}=this.props;s.updateItem(l,a).catch(d=>{mt.warn("Error updating command history storage",d)})}).catch(o=>{mt.debug("Error updating workspace history item",o)})}scrollConsoleHistoryToBottom(){var e=this.consoleHistoryScrollPane.current;e!=null&&window.requestAnimationFrame(()=>{e.scrollTo({top:e.scrollHeight})})}handleScrollPaneScroll(){var e=this.consoleHistoryScrollPane.current;k(e),this.setState({isScrollDecorationShown:e.scrollTop>0&&e.scrollHeight>e.clientHeight,isStuckToBottom:this.isAtBottom()})}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:yn.MULTIPLE_FILE_ERROR});return}var r=t[0];yn.isValidDropItem(r)?this.setState({dragError:null}):this.setState({dragError:yn.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:r,commandHistoryStorage:i,language:o,scope:a}=this.props,{consoleHistory:s,objectMap:l}=this.state,d={name:e,title:e,type:t.VariableType.TABLE},h=l.has(e),c={startTime:Date.now(),endTime:Date.now(),disabledObjects:[],result:{changes:{created:[],updated:[],removed:[],[h?"updated":"created"]:[d]}}},f=s.concat(c);this.setState({consoleHistory:f}),this.scrollConsoleHistoryToBottom(),this.updateKnownObjects(c),r({name:e,type:t.VariableType.TABLE}),i.addItem(o,a,e,{command:e,startTime:new Date().toJSON(),endTime:new Date().toJSON()})}addConsoleHistoryMessage(e,t){var{consoleHistory:r}=this.state,i={startTime:Date.now(),endTime:Date.now(),result:{message:e,error:t}},o=r.concat(i);this.setState({consoleHistory:o})}handleCsvUpdate(e){this.addConsoleHistoryMessage(e)}handleCsvError(e){this.addConsoleHistoryMessage(void 0,e!=null?"".concat(e):void 0)}handleCsvInProgress(e){this.setState({csvUploadInProgress:e})}handleOverflowActions(){var{isAutoLaunchPanelsEnabled:e,isClosePanelsOnDisconnectEnabled:t,isPrintStdOutEnabled:r}=this.state,{actions:i}=this.props;return[...i,{title:"Print Stdout",action:this.handleTogglePrintStdout,group:ee.groups.high,icon:r?Vn:void 0,order:10},{title:"Auto Launch Panels",action:this.handleToggleAutoLaunchPanels,group:ee.groups.high,icon:e?Vn:void 0,order:20},{title:"Close Panels on Disconnect",action:this.handleToggleClosePanelsOnDisconnect,group:ee.groups.high,icon:t?Vn:void 0,order:30},{title:"Upload Table from File",action:this.handleUploadCsv,group:ee.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(i=>{mt.error("There was an error initiating the command",i)})}else{var r={command:" ",result:{},startTime:Date.now(),endTime:Date.now()};this.scrollConsoleHistoryToBottom(),this.setState(i=>({consoleHistory:i.consoleHistory.concat(r)}))}}clearConsoleHistory(){this.pending.cancel(),this.setState(e=>{var t=new Map([...e.objectHistoryMap.keys()].map(r=>[r,-1]));return{consoleHistory:[],objectHistoryMap:t}})}addCommand(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.consoleInput.current&&(this.consoleInput.current.setConsoleText(e,t,r),t&&this.scrollConsoleHistoryToBottom())}focus(){var e;(e=this.consoleInput.current)===null||e===void 0||e.focus()}sendSettingsChange(e,t){for(var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=Object.keys(Zo),o={},a=!1,s=0;s<i.length;s+=1){var l=i[s],{[l]:d}=t,{[l]:h}=e;d!==h&&(a=!0),o[l]=d}if(!(r&&!a)){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:r,language:i,statusBarChildren:o,openObject:a,session:s,scope:l,commandHistoryStorage:d,timeZone:h,disabled:c,unzip:f,supportsType:v,iconForType:p}=this.props,{consoleHeight:g,consoleHistory:y,isScrollDecorationShown:P,objectMap:O,showCsvOverlay:_,csvFile:R,csvPaste:U,dragError:Q,csvUploadInProgress:N}=this.state,W=this.getObjects(O),j=Math.round(g*.7),Y=this.getContextActions(e);return u.jsxs("div",{role:"presentation",className:Z("iris-console","h-100","w-100",{disabled:c}),children:[u.jsxs("div",{className:"console-pane",ref:this.consolePane,children:[u.jsx(hf,{dh:t,session:s,overflowActions:this.handleOverflowActions,openObject:a,objects:W,children:o}),u.jsxs("div",{className:"console-csv-container",onDragOver:yn.handleDragOver,onDragEnter:this.handleDragEnter,onDragLeave:this.handleDragLeave,children:[_&&u.jsx(yn,{onCancel:this.handleCsvFileCanceled,onFileOpened:this.handleCsvFileOpened,onPaste:this.handleCsvPaste,clearDragError:this.handleClearDragError,dragError:Q,onError:this.handleCsvError,uploadInProgress:N,allowZip:f!=null}),u.jsxs("div",{role:"presentation",className:Z("scroll-pane no-scroll-x",{"scroll-decoration":P}),onScroll:this.handleScrollPaneScroll,ref:this.consoleHistoryScrollPane,children:[u.jsx(Uc,{items:y,openObject:a,language:i,disabled:c,supportsType:v,iconForType:p}),r]})]}),!_&&u.jsx($o,{ref:this.consoleInput,session:s,language:i,scope:l,onSubmit:this.handleCommandSubmit,maxHeight:j,commandHistoryStorage:d}),_&&u.jsx(of,{session:s,onOpenTable:this.handleOpenCsvTable,onClose:this.handleHideCsv,onUpdate:this.handleCsvUpdate,onError:this.handleCsvError,file:R??void 0,paste:U??void 0,onInProgress:this.handleCsvInProgress,timeZone:h,unzip:f})]}),u.jsx(ee,{actions:Y,ignoreClassNames:[$o.INPUT_CLASS_NAME]})]})}}nt(zt,"defaultProps",{statusBarChildren:null,settings:{},onSettingsChange:()=>{},scope:null,actions:[],historyChildren:null,timeZone:"America/New_York",objectMap:new Map,disabled:!1,unzip:null,supportsType:ff,iconForType:vf});nt(zt,"LOG_THROTTLE",500);const gf=zt;function Yo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function pf(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Yo(Object(t),!0).forEach(function(r){Ar(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Yo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ar(n,e,t){return e=bf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bf(n){var e=yf(n,"string");return typeof e=="symbol"?e:String(e)}function yf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class hl extends m.Component{constructor(e){super(e),Ar(this,"container",void 0),Ar(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();k(t),lt.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=pf({copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"python",lineNumbersMinChars:3,minimap:{enabled:!1},scrollBeyondLastLine:!1,tabCompletion:"on",value:"",wordWrap:"off",links:!0,autoClosingBrackets:"beforeWhitespace"},t),k(this.container),this.editor=lt.create(this.container,t),this.editor.addAction({id:"find",label:"Find",keybindings:[ze.CtrlCmd|Gt.KeyF],precondition:void 0,keybindingContext:void 0,contextMenuGroupId:"navigation",contextMenuOrder:1,run:()=>{this.toggleFind()}}),this.editor.layout(),pt.registerLinkProvider("plaintext",{provideLinks:Xe.provideLinks}),e(this.editor)}destroyEditor(){var{onEditorWillDestroy:e}=this.props;k(this.editor),e(this.editor),this.editor.dispose(),this.editor=void 0}render(){var{className:e}=this.props;return u.jsx("div",{className:Z("editor-container",e),ref:t=>{this.container=t}})}}Ar(hl,"defaultProps",{className:"fill-parent-absolute",onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},settings:{}});const Cf=hl;var Sf={groovy:"Groovy",python:"Python",scala:"Scala"};class wf{static normalizeScriptLanguage(e){return Sf[e]||null}static getDisabledRunTooltip(e,t,r,i){return e?t?null:"".concat(r," doesn't match the session language – ").concat(i," disabled"):"Console session not connected – ".concat(i," disabled")}static outdentCode(e){var t=e.split(`
|
|
10
|
+
`,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 $n=Vr;function ol(n,e,t){return e=ef(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ef(n){var e=tf(n,"string");return typeof e=="symbol"?e:String(e)}function tf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var zo=B.module("CsvInputBar"),nf=Object.entries($n.TYPES).map(n=>{var[e,t]=n;return u.jsx("option",{value:e,children:t.name},e)});class al extends m.Component{constructor(e){super(e),ol(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=H.createRef(),this.state={tableName:"",tableNameSet:!1,isFirstRowHeaders:!0,showProgress:!1,progressValue:0,type:$n.DEFAULT_TYPE,parser:null}}componentDidUpdate(e){var{file:t,paste:r}=this.props,{tableName:i,tableNameSet:o}=this.state;if(!o&&t!=null&&!i){var a,s=t.name.lastIndexOf("."),l=Os.legalizeTableName(t.name.substring(0,s));this.setState({tableName:l,tableNameSet:!0}),(a=this.inputRef.current)===null||a===void 0||a.focus()}else(t==null&&e.file!=null||r==null&&e.paste!=null)&&this.setState({tableName:"",tableNameSet:!1});r!=null&&r!==""&&!i&&this.inputRef.current&&this.inputRef.current.focus(),t!=null&&t!==e.file?this.setState({type:$n.fromExtension(t.name)}):r!=null&&r!==""&&(e.paste===void 0||e.paste==="")&&this.setState({type:$n.AUTO})}componentWillUnmount(){var{parser:e}=this.state;e&&e.cancel()}handleCancel(){var{onClose:e}=this.props;e()}handleError(e){var{onClose:t,onError:r}=this.props;zo.error(e),r(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:r}=this.props;t!=null?t.name.endsWith(".zip")?this.handleZipFile(t):this.handleFile(t):r!==void 0&&r!==""&&this.handleFile(new Blob([r],{type:"text/plain"}))}handleFile(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;zo.info("Starting CSV parser for ".concat(e instanceof File?e.name:"pasted values"," ").concat(t?"":e.size," bytes"));var{session:r,timeZone:i,onInProgress:o}=this.props,{tableName:a,isFirstRowHeaders:s,type:l}=this.state,d=c=>{c.length===1?r.bindTableToVariable(c[0],a).then(()=>this.openTable()).catch(f=>this.handleError(f)):r.mergeTables(c).then(f=>{r.bindTableToVariable(f,a).then(()=>this.openTable()).catch(v=>this.handleError(v)),c.forEach(v=>v.close())}).catch(f=>this.handleError(f))},h=new Ym({onFileCompleted:d,session:r,file:e,type:$n.TYPES[l],readHeaders:s,onProgress:this.handleProgress,onError:this.handleError,timeZone:i,isZip:t});h.parse(),this.setState({showProgress:!0,parser:h}),o(!0)}handleZipFile(e){var{onUpdate:t,unzip:r}=this.props;if(r==null){this.handleError(new Error("No support for zip files available."));return}r(e).then(i=>{for(var o=!1,a=0;a<i.length;a+=1){var s=i[a];if(yn.isValidExtension(s.name)){t("Loading ".concat(s.name," as csv from ").concat(e.name)),o=!0,this.handleFile(s,!0);break}}if(!o)throw new Error("No csv file found in ".concat(e.name))}).catch(i=>this.handleError(i))}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:r}=this.state;e(r),t()}handleQueryTypeChange(e){this.setState({type:e})}render(){var{file:e,paste:t}=this.props,{tableName:r,isFirstRowHeaders:i,showProgress:o,progressValue:a,type:s}=this.state,l=!!t&&!r;return u.jsxs("div",{className:"csv-input-bar",children:[!o&&u.jsxs("form",{onSubmit:this.handleUpload,className:"csv-input-bar-container form-inline",children:[u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"tableNameInput",children:"Table name"}),u.jsx("input",{ref:this.inputRef,id:"tableNameInput",type:"text",className:Z("form-control",{"is-invalid":l}),value:r,onChange:this.handleTableName})]}),u.jsxs("div",{className:"form-group",children:[u.jsx("label",{htmlFor:"formatSelect",children:"File format"}),u.jsx(_c,{id:"formatSelect",className:"custom-select",value:s,onChange:this.handleQueryTypeChange,children:nf})]}),u.jsx(Rh,{className:"firstRowHeaders",checked:i,onChange:this.toggleFirstRowHeaders,children:"First row is column headers"}),u.jsxs("div",{className:"csv-input-buttons form-group",children:[u.jsx(se,{kind:"secondary",onClick:this.handleCancel,children:"Cancel"}),u.jsx(se,{kind:"primary",type:"submit",disabled:!(e!==null||t!==void 0&&t!=="")||!r,children:"Upload"})]})]}),o&&u.jsxs("div",{className:"csv-progress-container",children:[u.jsx("label",{children:"Uploading Table"}),u.jsx("div",{className:"progress",children:u.jsx("div",{className:"progress-bar bg-primary",style:{width:"".concat(a,"%")},"aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":100})}),u.jsxs("label",{children:[a,"%"]}),u.jsx(se,{kind:"primary",onClick:this.handleCancelInProgress,children:"Cancel"})]})]})}}ol(al,"defaultProps",{file:null,paste:null,unzip:null});const rf=al;function gr(n,e,t){return e=of(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function of(n){var e=af(n,"string");return typeof e=="symbol"?e:String(e)}function af(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Go=B.module("ConsoleMenu");class Mr extends m.PureComponent{static makeItemActions(e,t,r,i,o){if(e.length===0)return[];var a={menuElement:u.jsx(ji,{value:t,onChange:i,className:"console-menu",ref:r})},s=e;t&&(s=s.filter(d=>{var{title:h}=d;return h!=null&&h.toLowerCase().indexOf(t.toLowerCase())>=0}));var l=s.map(d=>({title:d.title,action:()=>{o(d)}}));return[a,...l]}constructor(e){super(e),gr(this,"tableSearchField",void 0),gr(this,"widgetSearchField",void 0),gr(this,"makeTableActions",yt((t,r,i)=>{var{dh:o}=this.props,a=t.filter(s=>pi.isTableType(o,s.type));return Mr.makeItemActions(a,r,s=>{this.tableSearchField=s},this.handleTableFilterChange,i)})),gr(this,"makeWidgetActions",yt((t,r,i)=>{var{dh:o}=this.props,a=t.filter(s=>pi.isWidgetType(o,s.type));return Mr.makeItemActions(a,r,s=>{this.widgetSearchField=s},this.handleWidgetFilterChange,i)})),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){Go.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){Go.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:r}=this.props,{tableFilterText:i,widgetFilterText:o}=this.state,a=this.makeTableActions(t,i,r),s=this.makeWidgetActions(t,o,r),l={placement:"bottom-end"},d=a.length===0,h=s.length===0;return u.jsxs(u.Fragment,{children:[u.jsx(se,{"aria-label":"Tables",kind:"ghost",disabled:d,onClick:()=>{},icon:u.jsxs("div",{className:"fa-md fa-layers",children:[u.jsx(ue,{mask:gs,icon:jn,transform:"right-5 down-5"}),u.jsx(ue,{icon:jn,transform:"right-8 down-6"})]}),tooltip:d?"No tables available":"Tables",children:u.jsx(Gn,{actions:a,onMenuOpened:this.handleTableMenuOpened,onMenuClosed:this.handleTableMenuClosed,options:{initialKeyboardIndex:1},popperOptions:l},"table-actions ")}),u.jsx(se,{"aria-label":"Widgets",kind:"ghost",disabled:s.length===0,onClick:()=>{},icon:u.jsxs("div",{className:"fa-md fa-layers",children:[u.jsx(ue,{mask:vs,icon:jn,transform:"right-5 down-5"}),u.jsx(ue,{icon:jn,transform:"right-8 down-6"})]}),tooltip:h?"No widgets available":"Widgets",children:u.jsx(Gn,{actions:s,onMenuOpened:this.handleWidgetMenuOpened,onMenuClosed:this.handleWidgetMenuClosed,options:{initialKeyboardIndex:1},popperOptions:l},"table-actions")}),u.jsx(se,{kind:"ghost",icon:Ss,tooltip:"More Actions...","aria-label":"More Actions...",onClick:()=>{},children:u.jsx(Gn,{actions:e,popperOptions:l})})]})}}const sf=Mr;function sl(n,e,t){return e=lf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lf(n){var e=df(n,"string");return typeof e=="symbol"?e:String(e)}function df(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ll extends m.PureComponent{constructor(e){super(e),sl(this,"pending",void 0),this.handleCommandStarted=this.handleCommandStarted.bind(this),this.handleCommandCompleted=this.handleCommandCompleted.bind(this),this.pending=new Mn,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(r=>this.handleCommandCompleted(r)),this.setState({isCommandRunning:!0})}handleCommandCompleted(e){e instanceof fi||this.setState({isCommandRunning:this.pending.pending.length>0})}render(){var{children:e,dh:t,openObject:r,overflowActions:i,objects:o}=this.props,{isDisconnected:a,isCommandRunning:s}=this.state,l=null,d=null;return a?(l="console-status-icon-disconnected",d="Worker is disconnected"):s?(l="console-status-icon-pending",d="Worker is busy"):(l="console-status-icon-idle",d="Worker is idle"),u.jsxs("div",{className:"console-pane-status-bar",children:[u.jsxs("div",{children:[u.jsx("div",{className:Z("console-status-icon",l)}),u.jsx(qt,{children:d})]}),e,u.jsx(sf,{dh:t,overflowActions:i,openObject:r,objects:o})]})}}sl(ll,"defaultProps",{children:null});const uf=ll;function qo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function at(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qo(Object(t),!0).forEach(function(r){nt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):qo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function nt(n,e,t){return e=hf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function hf(n){var e=cf(n,"string");return typeof e=="symbol"?e:String(e)}function cf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var mt=B.module("Console"),Xo={isAutoLaunchPanelsEnabled:!0,isPrintStdOutEnabled:!0,isClosePanelsOnDisconnectEnabled:!0};function mf(){return!0}function ff(n){return u.jsx(u.Fragment,{})}class zt extends m.PureComponent{static isErrorLevel(e){return e===Oe.STDERR||e===Oe.ERROR||e===Oe.FATAL}static isOutputLevel(e){return e===Oe.STDOUT||zt.isErrorLevel(e)}constructor(e){super(e),nt(this,"cancelListener",void 0),nt(this,"consolePane",void 0),nt(this,"consoleInput",void 0),nt(this,"consoleHistoryScrollPane",void 0),nt(this,"pending",void 0),nt(this,"queuedLogMessages",void 0),nt(this,"processLogMessageQueue",Mi(()=>{this.setState(i=>{mt.debug2("processLogMessageQueue",this.queuedLogMessages.length," items");var{consoleHistory:o}=i;return o=o.concat(this.queuedLogMessages),this.queuedLogMessages=[],{consoleHistory:o}})},zt.LOG_THROTTLE)),nt(this,"getObjects",yt(i=>[...i.values()])),nt(this,"getContextActions",yt(i=>[...i,{action:this.handleClearShortcut,shortcut:ke.CONSOLE.CLEAR},{action:this.handleFocusHistory,shortcut:ke.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=H.createRef(),this.consoleInput=H.createRef(),this.consoleHistoryScrollPane=H.createRef(),this.pending=new Mn,this.queuedLogMessages=[];var{objectMap:t,settings:r}=this.props;this.state=at(at({consoleHistory:[],consoleHeight:0,isScrollDecorationShown:!1,objectHistoryMap:new Map,objectMap:new Map(t),showCsvOverlay:!1,csvFile:null,csvPaste:null,dragError:null,csvUploadInProgress:!1,isStuckToBottom:!0},Xo),r)}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:r,state:i}=this;this.sendSettingsChange(t,i),r.objectMap!==e.objectMap&&this.updateObjectMap(),i.isStuckToBottom&&!this.isAtBottom()&&this.scrollConsoleHistoryToBottom()}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)}isAtBottom(){if(this.consoleHistoryScrollPane.current==null)return!1;var{scrollHeight:e,clientHeight:t,scrollTop:r}=this.consoleHistoryScrollPane.current;return Math.abs(e-t-r)<=1}handleClearShortcut(e){var t;e.preventDefault(),e.stopPropagation(),(t=this.consoleInput.current)===null||t===void 0||t.clear()}handleCommandStarted(e){var{code:t,result:r}=e.detail,i=this.pending.add(r),o={command:t,disabledObjects:[],startTime:Date.now(),cancelResult:()=>{r.cancel()},wrappedResult:i},{commandHistoryStorage:a,language:s,scope:l}=this.props,d=a.addItem(s,l,t,{command:t,startTime:new Date().toJSON()});d.catch(h=>{mt.debug("Error adding workspace item",h)}),this.setState(h=>({consoleHistory:h.consoleHistory.concat(o)}),()=>{this.scrollConsoleHistoryToBottom()}),i.then(h=>{this.handleCommandResult(h,o,d)}).catch(h=>{this.handleCommandError(h,o,d)})}handleCommandResult(e,t,r){var i=at(at({},t),{},{wrappedResult:void 0,cancelResult:void 0,result:e??t.result});this.setState(o=>{var{consoleHistory:a}=o,s=a.lastIndexOf(t);if(s<0)return mt.error("historyItem not found in consoleHistory"),null;var l=a.concat();return l[s]=i,{consoleHistory:l}}),e&&(this.updateHistory(e,i),this.updateKnownObjects(i),this.updateWorkspaceHistoryItem({error:e.error},r),this.closeRemovedItems(e.changes),this.openUpdatedItems(e.changes))}handleCommandError(e,t,r){if(Ee.isCanceled(e)){mt.debug("Called handleCommandError on a cancelled promise result");return}this.updateWorkspaceHistoryItem({error:"".concat(e)},r),this.setState(i=>{var o=i.consoleHistory.concat(),a=o.lastIndexOf(t),s=at({},t);return s.wrappedResult=void 0,s.cancelResult=void 0,s.endTime=Date.now(),s.result={error:e},o[a]=s,{consoleHistory:o}})}handleFocusHistory(e){e.preventDefault(),e.stopPropagation();var{focusCommandHistory:t}=this.props;t()}handleLogMessage(e){var{isPrintStdOutEnabled:t}=this.state;t&&zt.isOutputLevel(e.logLevel)&&this.queueLogMessage(e.message,e.logLevel)}queueLogMessage(e,t){var r={};zt.isErrorLevel(t)?r.error=e:r.message=e;var i={command:void 0,result:r};this.queuedLogMessages.push(i),this.processLogMessageQueue()}openUpdatedItems(e){mt.debug("openUpdatedItems",e);var{isAutoLaunchPanelsEnabled:t}=this.state;if(e!=null){var{openObject:r}=this.props;[...e.created,...e.updated].forEach(i=>r(i,t&&(i.title===void 0||!i.title.startsWith("_"))))}}closeRemovedItems(e){if(!(e==null||e.removed==null||e.removed.length===0)){var{closeObject:t}=this.props,{removed:r}=e;r.forEach(i=>t(i))}}updateHistory(e,t){var r=t;e==null||e.changes==null||r==null||(r.endTime=Date.now(),this.setState(i=>{var o=i.consoleHistory.concat();return{consoleHistory:o}}))}updateKnownObjects(e){var t;if(e.result&&(t=e.result.changes),!t||(t.created==null||t.created.length===0)&&(t.updated==null||t.updated.length===0)&&(t.removed==null||t.removed.length===0)){mt.debug2("updateKnownObjects no changes");return}this.setState(r=>{var i,o,a,{consoleHistory:s}=r,l=s.lastIndexOf(e);if(l<0)return mt.error("historyItem not found in state.consoleHistory"),null;var d=new Map(r.objectHistoryMap),h=new Map(r.objectMap),c=function(v){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{title:g}=v;k(g);var y=d.get(g);if(y!=null&&y>=0){var P;s===r.consoleHistory&&(s=s.concat());var O=at(at({},s[y]),{},{disabledObjects:[...(P=s[y].disabledObjects)!==null&&P!==void 0?P:[],g]});s[y]=O}d.set(g,l),p?h.delete(g):h.set(g,v)};return(i=t)===null||i===void 0||i.updated.forEach(f=>c(f)),(o=t)===null||o===void 0||o.removed.forEach(f=>c(f,!0)),(a=t)===null||a===void 0||a.created.forEach(f=>{var{title:v}=f;k(v),d.set(v,l),h.set(v,f)}),{objectHistoryMap:d,objectMap:h,consoleHistory:s}})}updateObjectMap(){var{objectMap:e}=this.props;this.setState({objectMap:e})}updateWorkspaceHistoryItem(e,t){var r=this.pending.add(t),i=new Date().toJSON();r.then(o=>{var a=at(at({},o),{},{data:at(at({},o.data),{},{endTime:i,result:e})}),{commandHistoryStorage:s,language:l}=this.props;s.updateItem(l,a).catch(d=>{mt.warn("Error updating command history storage",d)})}).catch(o=>{mt.debug("Error updating workspace history item",o)})}scrollConsoleHistoryToBottom(){var e=this.consoleHistoryScrollPane.current;e!=null&&window.requestAnimationFrame(()=>{e.scrollTo({top:e.scrollHeight})})}handleScrollPaneScroll(){var e=this.consoleHistoryScrollPane.current;k(e),this.setState({isScrollDecorationShown:e.scrollTop>0&&e.scrollHeight>e.clientHeight,isStuckToBottom:this.isAtBottom()})}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:yn.MULTIPLE_FILE_ERROR});return}var r=t[0];yn.isValidDropItem(r)?this.setState({dragError:null}):this.setState({dragError:yn.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:r,commandHistoryStorage:i,language:o,scope:a}=this.props,{consoleHistory:s,objectMap:l}=this.state,d={name:e,title:e,type:t.VariableType.TABLE},h=l.has(e),c={startTime:Date.now(),endTime:Date.now(),disabledObjects:[],result:{changes:{created:[],updated:[],removed:[],[h?"updated":"created"]:[d]}}},f=s.concat(c);this.setState({consoleHistory:f}),this.scrollConsoleHistoryToBottom(),this.updateKnownObjects(c),r({name:e,type:t.VariableType.TABLE}),i.addItem(o,a,e,{command:e,startTime:new Date().toJSON(),endTime:new Date().toJSON()})}addConsoleHistoryMessage(e,t){var{consoleHistory:r}=this.state,i={startTime:Date.now(),endTime:Date.now(),result:{message:e,error:t}},o=r.concat(i);this.setState({consoleHistory:o})}handleCsvUpdate(e){this.addConsoleHistoryMessage(e)}handleCsvError(e){this.addConsoleHistoryMessage(void 0,e!=null?"".concat(e):void 0)}handleCsvInProgress(e){this.setState({csvUploadInProgress:e})}handleOverflowActions(){var{isAutoLaunchPanelsEnabled:e,isClosePanelsOnDisconnectEnabled:t,isPrintStdOutEnabled:r}=this.state,{actions:i}=this.props;return[...i,{title:"Print Stdout",action:this.handleTogglePrintStdout,group:ee.groups.high,icon:r?Vn:void 0,order:10},{title:"Auto Launch Panels",action:this.handleToggleAutoLaunchPanels,group:ee.groups.high,icon:e?Vn:void 0,order:20},{title:"Close Panels on Disconnect",action:this.handleToggleClosePanelsOnDisconnect,group:ee.groups.high,icon:t?Vn:void 0,order:30},{title:"Upload Table from File",action:this.handleUploadCsv,group:ee.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(i=>{mt.error("There was an error initiating the command",i)})}else{var r={command:" ",result:{},startTime:Date.now(),endTime:Date.now()};this.scrollConsoleHistoryToBottom(),this.setState(i=>({consoleHistory:i.consoleHistory.concat(r)}))}}clearConsoleHistory(){this.pending.cancel(),this.setState(e=>{var t=new Map([...e.objectHistoryMap.keys()].map(r=>[r,-1]));return{consoleHistory:[],objectHistoryMap:t}})}addCommand(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.consoleInput.current&&(this.consoleInput.current.setConsoleText(e,t,r),t&&this.scrollConsoleHistoryToBottom())}focus(){var e;(e=this.consoleInput.current)===null||e===void 0||e.focus()}sendSettingsChange(e,t){for(var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=Object.keys(Xo),o={},a=!1,s=0;s<i.length;s+=1){var l=i[s],{[l]:d}=t,{[l]:h}=e;d!==h&&(a=!0),o[l]=d}if(!(r&&!a)){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:r,language:i,statusBarChildren:o,openObject:a,session:s,scope:l,commandHistoryStorage:d,timeZone:h,disabled:c,unzip:f,supportsType:v,iconForType:p}=this.props,{consoleHeight:g,consoleHistory:y,isScrollDecorationShown:P,objectMap:O,showCsvOverlay:_,csvFile:R,csvPaste:U,dragError:Q,csvUploadInProgress:N}=this.state,W=this.getObjects(O),j=Math.round(g*.7),Y=this.getContextActions(e);return u.jsxs("div",{role:"presentation",className:Z("iris-console","h-100","w-100",{disabled:c}),children:[u.jsxs("div",{className:"console-pane",ref:this.consolePane,children:[u.jsx(uf,{dh:t,session:s,overflowActions:this.handleOverflowActions,openObject:a,objects:W,children:o}),u.jsxs("div",{className:"console-csv-container",onDragOver:yn.handleDragOver,onDragEnter:this.handleDragEnter,onDragLeave:this.handleDragLeave,children:[_&&u.jsx(yn,{onCancel:this.handleCsvFileCanceled,onFileOpened:this.handleCsvFileOpened,onPaste:this.handleCsvPaste,clearDragError:this.handleClearDragError,dragError:Q,onError:this.handleCsvError,uploadInProgress:N,allowZip:f!=null}),u.jsxs("div",{role:"presentation",className:Z("scroll-pane no-scroll-x",{"scroll-decoration":P}),onScroll:this.handleScrollPaneScroll,ref:this.consoleHistoryScrollPane,children:[u.jsx(Wc,{items:y,openObject:a,language:i,disabled:c,supportsType:v,iconForType:p}),r]})]}),!_&&u.jsx(jo,{ref:this.consoleInput,session:s,language:i,scope:l,onSubmit:this.handleCommandSubmit,maxHeight:j,commandHistoryStorage:d}),_&&u.jsx(rf,{session:s,onOpenTable:this.handleOpenCsvTable,onClose:this.handleHideCsv,onUpdate:this.handleCsvUpdate,onError:this.handleCsvError,file:R??void 0,paste:U??void 0,onInProgress:this.handleCsvInProgress,timeZone:h,unzip:f})]}),u.jsx(ee,{actions:Y,ignoreClassNames:[jo.INPUT_CLASS_NAME]})]})}}nt(zt,"defaultProps",{statusBarChildren:null,settings:{},onSettingsChange:()=>{},scope:null,actions:[],historyChildren:null,timeZone:"America/New_York",objectMap:new Map,disabled:!1,unzip:null,supportsType:mf,iconForType:ff});nt(zt,"LOG_THROTTLE",500);const vf=zt;function Zo(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function gf(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Zo(Object(t),!0).forEach(function(r){Nr(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Zo(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Nr(n,e,t){return e=pf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pf(n){var e=bf(n,"string");return typeof e=="symbol"?e:String(e)}function bf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class dl extends m.Component{constructor(e){super(e),Nr(this,"container",void 0),Nr(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();k(t),lt.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=gf({copyWithSyntaxHighlighting:!1,fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"python",lineNumbersMinChars:3,minimap:{enabled:!1},scrollBeyondLastLine:!1,tabCompletion:"on",value:"",wordWrap:"off",links:!0,autoClosingBrackets:"beforeWhitespace"},t),k(this.container),this.editor=lt.create(this.container,t),this.editor.addAction({id:"find",label:"Find",keybindings:[ze.CtrlCmd|Gt.KeyF],precondition:void 0,keybindingContext:void 0,contextMenuGroupId:"navigation",contextMenuOrder:1,run:()=>{this.toggleFind()}}),this.editor.layout(),pt.registerLinkProvider("plaintext",{provideLinks:Xe.provideLinks}),e(this.editor)}destroyEditor(){var{onEditorWillDestroy:e}=this.props;k(this.editor),e(this.editor),this.editor.dispose(),this.editor=void 0}render(){var{className:e}=this.props;return u.jsx("div",{className:Z("editor-container",e),ref:t=>{this.container=t}})}}Nr(dl,"defaultProps",{className:"fill-parent-absolute",onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},settings:{}});const yf=dl;var Cf={groovy:"Groovy",python:"Python",scala:"Scala"};class Sf{static normalizeScriptLanguage(e){return Cf[e]||null}static getDisabledRunTooltip(e,t,r,i){return e?t?null:"".concat(r," doesn't match the session language – ").concat(i," disabled"):"Console session not connected – ".concat(i," disabled")}static outdentCode(e){var t=e.split(`
|
|
11
11
|
`),r=t.reduce((i,o)=>{var a=o.length-o.trimStart().length;return a===o.length?i:a<i?a:i},Number.MAX_SAFE_INTEGER);return t.map(i=>i.slice(r)).join(`
|
|
12
|
-
`)}}const
|
|
13
|
-
`).concat(e)):r.setValue("".concat(e));var o=r.getLineCount(),a=r.getLineLength(o)+1;this.editor.setPosition({lineNumber:o,column:a}),t&&this.editor.focus()}updateDimensions(){Je.debug("updateDimensions"),this.editor&&this.editor.layout()}focus(){Je.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:r,isLoading:i,session:o,sessionLanguage:a,settings:s}=this.props,{model:l}=this.state,d=t?"Unable to open document. ".concat(t):null,h=s&&(e=s.language)!==null&&e!==void 0?e:null,c=l&&o&&h===a;return u.jsxs(u.Fragment,{children:[(t||i)&&u.jsx("div",{className:"h-100 w-100 position-relative",children:u.jsx(un,{errorMessage:d,isLoading:i,isLoaded:r})}),r&&u.jsx("div",{className:"h-100 w-100 script-editor",children:s&&u.jsxs(u.Fragment,{children:[u.jsx(
|
|
14
|
-
`,
|
|
15
|
-
`),{max:1})),this.handleUpdate=this.handleUpdate.bind(this),this.handleError=this.handleError.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.state={currentTime:Date.now()}}componentDidMount(){this.loadData()}componentDidUpdate(e,t){var r,{data:i}=this.state;this.timer==null&&!(i!=null&&i.result)&&i?.startTime&&!(i==null||i.endTime===void 0)?this.startTimer():(i!=null&&i.result&&!((r=t.data)!==null&&r!==void 0&&r.result)||i?.endTime&&!(t.data==null||t.data.endTime===void 0))&&this.stopTimer()}componentWillUnmount(){this.loadData.cancel(),this.cleanup!=null&&this.cleanup(),this.stopTimer()}startTimer(){this.stopTimer(),this.timer=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:r}=this.props;r?.(t)}handleTimeout(){this.updateTime()}render(){var e,{item:{name:t},language:r}=this.props,{currentTime:i,data:o,error:a}=this.state,{result:s,startTime:l,endTime:d}=o??{},h=(e=s?.error)!==null&&e!==void 0?e:a,c=Kr.getTimeString(l,d??i),f=this.getPreviewText(t),v=!!c;return u.jsxs("div",{className:"command-history-item-tooltip",children:[u.jsxs("div",{className:"scroll-container",children:[u.jsx(
|
|
16
|
-
`))}updateActions(){this.setState(e=>{var{selectedRanges:t}=e,r=t.reduce((i,o)=>i+o[1]-o[0]+1,0);return r>0&&r<Re.MAX_SELECTION_COUNT?(Ft.debug("Updating actions",this.itemActions),{actions:this.itemActions}):(Ft.debug("Disabling actions",r),{actions:[]})})}copySelectedCommands(){this.getSelectedCommandText().then(
|
|
12
|
+
`)}}const Ci=Sf;function Hn(n,e,t){return e=wf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wf(n){var e=Ef(n,"string");return typeof e=="symbol"?e:String(e)}function Ef(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Je=B.module("ScriptEditor");class ul extends m.Component{constructor(e){super(e),Hn(this,"contextActionCleanups",void 0),Hn(this,"completionCleanup",void 0),Hn(this,"editor",void 0),Hn(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=H.createRef(),this.state={model:null}}componentDidMount(){ce.addEventListener("onUpdate",this.updateShortcuts)}componentDidUpdate(e){var t,r,{sessionLanguage:i,settings:o}=this.props,a=o?.language,s=a!==((t=e.settings)===null||t===void 0?void 0:t.language);s&&(Je.debug("Set language",a),this.setLanguage(a));var l=i==null&&e.sessionLanguage!=null,d=a===i,h=((r=e.settings)===null||r===void 0?void 0:r.language)===e.sessionLanguage;(l||i!==void 0&&h&&!d)&&(Je.debug("De-init completion and context actions"),this.deInitContextActions(),this.deInitCodeCompletion());var c=i!=null&&e.sessionLanguage==null;(c&&d||i!==void 0&&!h&&d)&&(Je.debug("Init completion and context actions"),this.initContextActions(),this.initCodeCompletion())}componentWillUnmount(){ce.removeEventListener("onUpdate",this.updateShortcuts)}getValue(){return this.editor?this.editor.getValue():(Je.error("Editor not initialized"),null)}getSelectedCommand(){var e,t,r=(e=this.editor)===null||e===void 0?void 0:e.getSelection();k(r);var i=(t=this.editor)===null||t===void 0?void 0:t.getModel();k(i);var{startLineNumber:o,endColumn:a}=r,{endLineNumber:s}=r;a===1&&s>o&&(s-=1);var l=i.getLineMinColumn(o),d=i.getLineMaxColumn(s),h=r.setStartPosition(o,l).setEndPosition(s,d);return Ci.outdentCode(i.getValueInRange(h))}handleEditorInitialized(e){var{focusOnMount:t,onChange:r,onEditorInitialized:i,settings:o,session:a,sessionLanguage:s}=this.props;Je.debug("handleEditorInitialized",s,a,o),this.editor=e,this.setState({model:this.editor.getModel()}),Xe.setEOL(e),Xe.registerPasteHandler(e),a!=null&&o&&s===o.language&&(this.initContextActions(),this.initCodeCompletion()),e.onDidChangeModelContent(r),t!=null&&t&&e.focus(),i(this.editor)}handleEditorWillDestroy(e){Je.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){Je.error("Context actions already initialized.");return}if(this.editor){var e=[];e.push(this.editor.addAction({id:"run-code",label:"Run",keybindings:[Xe.getMonacoKeyCodeFromShortcut(ke.NOTEBOOK.RUN)],contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:()=>{this.handleRun()}})),e.push(this.editor.addAction({id:"run-selected-code",label:"Run Selected",keybindings:[Xe.getMonacoKeyCodeFromShortcut(ke.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){Je.error("Code completion already initialized.");return}var{session:e}=this.props;Je.debug("initCodeCompletion",this.editor,e),this.editor&&e!=null&&(this.completionCleanup=Xe.openDocument(this.editor,e))}deInitCodeCompletion(){var{session:e}=this.props;Je.debug("deInitCodeCompletion",this.editor,e),this.completionCleanup&&(this.completionCleanup.dispose(),this.completionCleanup=void 0,this.editor&&e!=null&&Xe.closeDocument(this.editor,e))}append(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;k(this.editor);var r=this.editor.getModel();k(r);var i=r.getValue();i?r.setValue("".concat(i,`
|
|
13
|
+
`).concat(e)):r.setValue("".concat(e));var o=r.getLineCount(),a=r.getLineLength(o)+1;this.editor.setPosition({lineNumber:o,column:a}),t&&this.editor.focus()}updateDimensions(){Je.debug("updateDimensions"),this.editor&&this.editor.layout()}focus(){Je.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:r,isLoading:i,session:o,sessionLanguage:a,settings:s}=this.props,{model:l}=this.state,d=t?"Unable to open document. ".concat(t):null,h=s&&(e=s.language)!==null&&e!==void 0?e:null,c=l&&o&&h===a;return u.jsxs(u.Fragment,{children:[(t||i)&&u.jsx("div",{className:"h-100 w-100 position-relative",children:u.jsx(un,{errorMessage:d,isLoading:i,isLoaded:r})}),r&&u.jsx("div",{className:"h-100 w-100 script-editor",children:s&&u.jsxs(u.Fragment,{children:[u.jsx(yf,{ref:this.editorComponent,settings:s,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy}),c!=null&&c&&u.jsx(tl,{model:l,language:h,session:o})]})})]})}}Hn(ul,"defaultProps",{error:null,isLoading:!1,isLoaded:!1,focusOnMount:!0,onChange:()=>{},onEditorInitialized:()=>{},onEditorWillDestroy:()=>{},session:null});const _f=ul;function Bn(n,e,t){return e=Pf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Pf(n){var e=Tf(n,"string");return typeof e=="symbol"?e:String(e)}function Tf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Of=250,If=2500;class Kr extends m.Component{static getTimeString(e,t){if(e==null||t===""||t===0)return null;var r=Math.round((new Date(t).valueOf()-new Date(e).valueOf())/1e3);return r<1?"<1s":Ns.formatElapsedTime(r)}constructor(e){super(e),Bn(this,"timer",void 0),Bn(this,"cleanup",void 0),Bn(this,"loadData",Pn(()=>{var{commandHistoryStorage:t,item:r,language:i}=this.props,{id:o}=r;this.cleanup=t.listenItem(i,o,this.handleUpdate,this.handleError)},Of)),Bn(this,"getPreviewText",bn(t=>t.split(`
|
|
14
|
+
`,If).join(`
|
|
15
|
+
`),{max:1})),this.handleUpdate=this.handleUpdate.bind(this),this.handleError=this.handleError.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.state={currentTime:Date.now()}}componentDidMount(){this.loadData()}componentDidUpdate(e,t){var r,{data:i}=this.state;this.timer==null&&!(i!=null&&i.result)&&i?.startTime&&!(i==null||i.endTime===void 0)?this.startTimer():(i!=null&&i.result&&!((r=t.data)!==null&&r!==void 0&&r.result)||i?.endTime&&!(t.data==null||t.data.endTime===void 0))&&this.stopTimer()}componentWillUnmount(){this.loadData.cancel(),this.cleanup!=null&&this.cleanup(),this.stopTimer()}startTimer(){this.stopTimer(),this.timer=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:r}=this.props;r?.(t)}handleTimeout(){this.updateTime()}render(){var e,{item:{name:t},language:r}=this.props,{currentTime:i,data:o,error:a}=this.state,{result:s,startTime:l,endTime:d}=o??{},h=(e=s?.error)!==null&&e!==void 0?e:a,c=Kr.getTimeString(l,d??i),f=this.getPreviewText(t),v=!!c;return u.jsxs("div",{className:"command-history-item-tooltip",children:[u.jsxs("div",{className:"scroll-container",children:[u.jsx(Zs,{language:r,children:f}),f.length<t.length&&u.jsx("p",{children:"Preview Truncated..."})]}),u.jsxs("div",{className:"result-info",children:[u.jsxs("div",{className:"d-flex justify-content-between",children:[!!h&&u.jsxs("div",{className:"text-danger mr-1",children:[u.jsx(ue,{icon:Cs})," Executed with errors"]}),u.jsxs("div",{className:"time-wrapper",children:["Elapsed time:"," ",v?u.jsx("span",{className:"time-string",children:c}):u.jsx(ps,{className:"loading-spinner-vertical-align"})]})]}),!!h&&u.jsx("div",{className:"error-message",children:h})]})]})}}Bn(Kr,"defaultProps",{onUpdate:()=>{}});const Df=Kr;var xf=512;function hl(n){var{item:e,language:t,isSelected:r,commandHistoryStorage:i}=n,o=e.name.substring(0,xf),a=m.useRef(null),s=m.useCallback(()=>{var l;(l=a.current)===null||l===void 0||l.update()},[a]);return u.jsxs("div",{className:Z("command-history-item",{selected:r}),children:[o,u.jsx(qt,{ref:a,interactive:!0,options:{placement:"left",modifiers:{preventOverflow:{enabled:!0,boundariesElement:"viewport",order:825}}},popperClassName:"command-history-item-popper",children:u.jsx(Df,{item:e,language:t,onUpdate:s,commandHistoryStorage:i})})]})}hl.defaultProps={isSelected:!1};class Ar extends m.Component{static itemKey(e,t){return"".concat(t.title)}static renderContent(e){return e.selectionRequired!==void 0&&e.selectionRequired?u.jsxs("div",{className:"fa-md fa-layers",children:[u.jsx(ue,{icon:qd,mask:e.icon,transform:"right-5 down-5 shrink-4"}),u.jsx(ue,{icon:ms,transform:"shrink-3 right-7 down-6"})]}):u.jsx(ue,{icon:e.icon})}render(){var{actions:e,hasSelection:t}=this.props;return u.jsx("div",{className:"command-history-actions",children:e.map((r,i)=>u.jsx(se,{kind:"inline",className:Z(r.className),onClick:r.action,tooltip:r.description,disabled:r.selectionRequired!==void 0&&r.selectionRequired&&!t,icon:Ar.renderContent(r)},Ar.itemKey(i,r)))})}}const Mf=Ar;var Nf=150,Yo=3,Qo=B.module("CommandHistoryViewportUpdater");function Af(n){var{table:e,columns:t,top:r=0,bottom:i=0,search:o,isReversed:a=!1,onUpdate:s}=n,l=m.useMemo(()=>Mi(d=>{var h=d.bottom-d.top,c=Math.max(0,d.top-h*Yo),f=d.bottom+h*Yo;e.setViewport({top:c,bottom:f,columns:d.columns})},Nf),[e]);return m.useEffect(function(){var h=e.onUpdate(c=>{var f,v;s({items:(f=c.items)!==null&&f!==void 0?f:[],offset:(v=c.offset)!==null&&v!==void 0?v:0})});return()=>{Qo.debug("onUpdate cleanup"),h()}},[e,s]),m.useEffect(function(){e.setSearch(o??"")},[e,o]),m.useEffect(function(){l({top:r,bottom:i,columns:t})},[l,r,i,t,o,a]),m.useEffect(()=>()=>{Qo.debug2("Cancel throttledUpdateViewport"),l.cancel()},[l]),null}function Jo(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function ea(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Jo(o,r,i,a,s,"next",l)}function s(l){Jo(o,r,i,a,s,"throw",l)}a(void 0)})}}function gt(n,e,t){return e=Lf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Lf(n){var e=Ff(n,"string");return typeof e=="symbol"?e:String(e)}function Ff(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ft=B.module("CommandHistory");class Re extends m.Component{static getCommandsFromViewport(e,t,r){for(var i=[],o=0;o<r.length;o+=1)for(var a=r[o],s=a[0];s<=a[1];s+=1)if(s>=t&&s<t+e.length){var{name:l}=e[s-t];i.push(l)}return i}static getCommandsFromSnapshot(e,t){return ea(function*(){var r=yield e.getSnapshot(t);return[...r.values()].map(i=>i.name)})()}constructor(e){super(e),gt(this,"itemActions",void 0),gt(this,"historyActions",void 0),gt(this,"pending",void 0),gt(this,"searchInputRef",void 0),gt(this,"itemListRef",void 0),gt(this,"debouncedSearchChange",Pn(()=>{this.setState(r=>{var{searchText:i}=r;return{debouncedSearchText:i,selectedRanges:[]}})},Re.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:Xd,shortcut:Kt.COPY,action:this.copySelectedCommands,group:ee.groups.edit},{title:"Send to Console",description:"Open selected commands in the console",icon:no,shortcut:ke.COMMAND_HISTORY.SEND_TO_CONSOLE,action:this.sendToConsole,group:Re.menuGroups.send,order:10},{title:"Run in Console",description:"Run selected commands in the console",icon:ws,shortcut:ke.COMMAND_HISTORY.RUN,action:this.runInConsole,group:Re.menuGroups.send,order:10},{title:"Send to Active Notebook",description:"Open selected commands in a notebook",icon:ro,shortcut:ke.COMMAND_HISTORY.SEND_TO_NOTEBOOK,action:this.sendToNotebook,group:Re.menuGroups.send,order:20},{title:"Send to New Notebook",description:"Open selected commands in a new notebook",icon:Es,action:this.createNotebook,group:Re.menuGroups.send,order:30}],this.historyActions=[{title:"Send to Console",icon:no,selectionRequired:!0,description:"Open selected commands in the console",action:this.sendToConsole},{title:"Send to Notebook",icon:ro,selectionRequired:!0,description:"Open selected commands in a notebook",action:this.sendToNotebook}],this.pending=new Mn,this.searchInputRef=H.createRef(),this.itemListRef=H.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 ea(function*(){var{items:t,offset:r,selectedRanges:i}=e.state,o=i.slice().sort((s,l)=>s[0]-l[0]);if(o.length===0)return[];if(o[0][0]>=r&&o[o.length-1][1]<r+t.length)return Re.getCommandsFromViewport(t,r,o);var{table:a}=e.props;return e.pending.add(Re.getCommandsFromSnapshot(a,o))})()}getSelectedCommandText(){return this.getSelectedCommands().then(e=>e.join(`
|
|
16
|
+
`))}updateActions(){this.setState(e=>{var{selectedRanges:t}=e,r=t.reduce((i,o)=>i+o[1]-o[0]+1,0);return r>0&&r<Re.MAX_SELECTION_COUNT?(Ft.debug("Updating actions",this.itemActions),{actions:this.itemActions}):(Ft.debug("Disabling actions",r),{actions:[]})})}copySelectedCommands(){this.getSelectedCommandText().then(Ps).catch(Ft.error)}createNotebook(){this.getSelectedCommandText().then(e=>{var{language:t,sendToNotebook:r}=this.props;r({value:e,language:t},!0)}).catch(Ft.error)}sendToNotebook(){this.getSelectedCommandText().then(e=>{var{language:t,sendToNotebook:r}=this.props;r({value:e,language:t})}).catch(Ft.error)}sendToConsole(){var{sendToConsole:e}=this.props;this.getSelectedCommandText().then(e).catch(Ft.error)}runInConsole(){this.getSelectedCommandText().then(e=>{var{sendToConsole:t}=this.props;t(e,!0,!0)}).catch(Ft.error)}handleSelect(e){var{sendToConsole:t}=this.props,{items:r,offset:i}=this.state;if(e<i||e>=i+r.length){Ft.error("Invalid index!",e);return}var{name:o}=r[e-i];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:r}=e,{table:i}=this.props,o=i.size;this.setState({items:t,itemCount:o,offset:r})}renderItem(e){var{item:t,itemIndex:r,isSelected:i}=e,{language:o,commandHistoryStorage:a}=this.props;return u.jsx(hl,{isSelected:i,item:t,language:o,commandHistoryStorage:a})}focus(){this.searchInputRef.current&&this.searchInputRef.current.focus()}restoreScrollPosition(){var e;(e=this.itemListRef.current)===null||e===void 0||e.restoreScrollPosition()}render(){var e,{language:t,table:r}=this.props,{actions:i,historyActions:o,searchText:a,debouncedSearchText:s,top:l,bottom:d,items:h,itemCount:c,offset:f,selectedRanges:v}=this.state,p=(e=Ys.LANGUAGE_MAP.get(t))!==null&&e!==void 0?e:"";return u.jsxs("div",{className:"command-history",children:[u.jsxs("div",{className:"command-history-search-bar",children:[u.jsx(ji,{ref:this.searchInputRef,value:a,placeholder:"".concat(p," Command History"),onChange:this.handleSearchChange}),u.jsx(Mf,{actions:o,hasSelection:v.length>0})]}),u.jsxs("div",{className:"command-history-list",children:[u.jsx(Ye,{ref:this.itemListRef,itemCount:c,items:h,offset:f,selectedRanges:v,onSelect:this.handleSelect,onSelectionChange:this.handleSelectionChange,onViewportChange:this.handleViewportChange,renderItem:this.renderItem,rowHeight:Re.ITEM_HEIGHT,isDoubleClickSelect:!0,isMultiSelect:!0,isStickyBottom:!0}),u.jsx(Af,{table:r,top:l,bottom:d,search:s,onUpdate:this.handleViewportUpdate}),u.jsx(ee,{actions:i})]})]})}}gt(Re,"ITEM_HEIGHT",29);gt(Re,"MAX_SELECTION_COUNT",1e4);gt(Re,"SET_SEARCH_DEBOUNCE_MS",150);gt(Re,"menuGroups",{send:ee.groups.medium+100});const Rf=Re;class kf 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 u.jsxs("div",{className:Z("log-level-menu-item",e),children:[u.jsx(uc,{on:t,onClick:this.handleSwitchClick}),e]})}}const jf=kf;function ta(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function na(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ta(Object(t),!0).forEach(function(r){Ge(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ta(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ge(n,e,t){return e=$f(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $f(n){var e=Hf(n,"string");return typeof e=="symbol"?e:String(e)}function Hf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class pe extends m.PureComponent{static getLogText(e){var t=new Date(e.micros/1e3),r=pi.formatTimestamp(t);return"".concat(r," ").concat(e.logLevel," ").concat(e.message)}constructor(e){super(e),Ge(this,"cancelListener",void 0),Ge(this,"editor",void 0),Ge(this,"editorContainer",void 0),Ge(this,"logLevelMenuItems",void 0),Ge(this,"flushTimer",void 0),Ge(this,"bufferedMessages",void 0),Ge(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:r}=this.state;t.shownLogLevels!==r&&this.refreshLogText();var{session:i}=this.props;e.session!==i&&(this.stopListening(),this.startListening(),this.clearLogs())}componentWillUnmount(){this.stopFlushTimer(),this.stopListening(),this.destroyMonaco(),window.removeEventListener("resize",this.handleResize)}getMenuActions(e){var t=this,r=[];r.push({menuElement:u.jsx("div",{className:"log-level-menu-title",children:"Display Log Levels"}),group:1,order:10});for(var i=function(){var s=pe.AllLogLevels[o],l=e[s]!=null?e[s]:!1;r.push({title:s,group:1,order:o+100,menuElement:u.jsx(jf,{logLevel:s,on:l,onClick:t.handleMenuItemClick,ref:d=>{d!=null&&(t.logLevelMenuItems[s]=d)}})})},o=0;o<pe.AllLogLevels.length;o+=1)i();return r.push({group:1,order:1e3,menuElement:u.jsxs("div",{className:"log-level-menu-controls",children:[u.jsx(se,{kind:"ghost",className:"log-level-toggle-all",onClick:this.handleToggleAllClick,children:"Toggle All"}),u.jsx(se,{kind:"ghost",onClick:this.handleResetClick,children:"Reset"})]})}),r}resetLogLevels(){for(var e={},t=function(){var o=pe.AllLogLevels[r],a=pe.DefaultLogLevels.some(s=>s===o);e[o]=a},r=0;r<pe.AllLogLevels.length;r+=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(){k(this.editorContainer),this.editor=lt.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"}),[[Gt.Escape],[ze.Shift|Gt.Escape]].forEach(e=>{k(this.editor),Xe.disableKeyBindings(this.editor,e),this.editor.addAction({id:"clear-selection-on-escape",label:"",keybindings:[Gt.Escape],keybindingContext:"findWidgetVisible && editorTextFocus",run:()=>{var t,r,i=(t=this.editor)===null||t===void 0?void 0:t.getPosition();k(i),(r=this.editor)===null||r===void 0||r.setPosition(i)}})})}destroyMonaco(){this.editor&&(this.editor.dispose(),this.editor=void 0)}triggerFindWidget(){var e,t;(e=this.editor)===null||e===void 0||e.focus(),(t=this.editor)===null||t===void 0||t.trigger("keyboard","actions.find",void 0)}toggleAll(){for(var{shownLogLevels:e}=this.state,t=!0,r=0;r<pe.AllLogLevels.length;r+=1){var i=pe.AllLogLevels[r];if(!e[i]){t=!1;break}}if(t)this.setState({shownLogLevels:{}});else{for(var o={},a=0;a<pe.AllLogLevels.length;a+=1){var s=pe.AllLogLevels[a];o[s]=!0}this.setState({shownLogLevels:o})}}toggleLogLevel(e){var{shownLogLevels:t}=this.state,r=t[e],i={};i[e]=!r,this.updateLogLevels(i)}updateLogLevels(e){var{shownLogLevels:t}=this.state;t=na(na({},t),e),this.setState({shownLogLevels:t})}appendLogText(e){if(this.editor){var t=this.editor.getModel(),r=t?.getLineCount();k(r);var i=t?.getLineLength(r);k(i);var o=this.isBottomVisible(),a=[];if(i>0&&(a.push({range:{startLineNumber:r,startColumn:i+1,endLineNumber:r,endColumn:i+1},text:`
|
|
17
17
|
`,forceMoveMarkers:!0}),r+=1,i=0),a.push({range:{startLineNumber:r,startColumn:i,endLineNumber:r,endColumn:i},text:e,forceMoveMarkers:!0}),t?.applyEdits(a),o){var s=t?.getLineCount();k(s),this.editor.revealLine(s,1)}}}refreshLogText(){if(this.editor){this.truncateLogIfNecessary();for(var{shownLogLevels:e}=this.state,t=this.isBottomVisible(),r="",i=0;i<this.messages.length;i+=1){var o=this.messages[i];if(e[o.logLevel]){var a=pe.getLogText(o);a.length>0&&(r+=a,a.charAt(a.length-1)!==`
|
|
18
18
|
`&&(r+=`
|
|
19
19
|
`))}}if(r=r.trimRight(),this.editor.setValue(r),t){var s,l=(s=this.editor.getModel())===null||s===void 0?void 0:s.getLineCount();k(l),this.editor.revealLine(l,1)}this.stopFlushTimer(),this.bufferedMessages=[]}}truncateLogIfNecessary(){this.messages.length>pe.maxLogSize&&(this.messages=this.messages.splice(this.messages.length-pe.truncateSize))}scrollToBottom(){var e,t,r;if(this.editor){var i=(e=this.editor)===null||e===void 0||(t=e.getModel)===null||t===void 0||(r=t.call(e))===null||r===void 0?void 0:r.getLineCount();k(i),this.editor.revealLine(i,1)}}isBottomVisible(){if(!this.editor)return!0;var e=this.editor.getModel(),t=e?.getLineCount();return k(t),this.isLineVisible(t)}isLineVisible(e){var t,r=(t=this.editor)===null||t===void 0?void 0:t.getVisibleRanges();if(r==null||r.length===0)return!1;for(var i=0;i<r.length;i+=1){var o=r[i];if(o.startLineNumber<=e&&e<=o.endLineNumber)return!0}return!1}isLogItemVisible(e){var{shownLogLevels:t}=this.state;return t[e.logLevel]}flush(){for(var e="",t=0;t<this.bufferedMessages.length;t+=1){var r=this.bufferedMessages[t],i=pe.getLogText(r);e+=i,i.charAt(i.length-1)!==`
|
|
20
20
|
`&&(e+=`
|
|
21
|
-
`)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,pe.bufferTimeout))}stopFlushTimer(){this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=void 0)}updateDimensions(){this.editor&&this.editor.layout()}handleClearClick(){this.clearLogs()}clearLogs(){this.messages=[],this.refreshLogText()}handleFlushTimeout(){this.stopFlushTimer(),this.flush()}handleLogMessage(e){this.messages.push(e),this.editor&&this.isLogItemVisible(e)&&this.queue(e)}handleMenuItemClick(e){this.toggleLogLevel(e)}handleResetClick(){this.resetLogLevels()}handleResize(){this.updateDimensions()}handleToggleAllClick(){this.toggleAll()}render(){var e={placement:"bottom-end"},{shownLogLevels:t}=this.state,r=this.getMenuActions(t);return u.jsxs("div",{className:"log-pane h-100 w-100",children:[u.jsxs("div",{className:"log-pane-menu",children:[u.jsx(se,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:Yd,tooltip:"Clear log"}),u.jsx(se,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:Qd,tooltip:"Log Settings",onClick:()=>{},children:u.jsx(Gn,{actions:r,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),u.jsx("div",{className:"log-pane-editor h-100 w-100",ref:i=>{this.editorContainer=i}})]})}}Ge(pe,"DefaultLogLevels",[Oe.STDOUT,Oe.ERROR,Oe.FATAL,Oe.STDERR,Oe.WARN]);Ge(pe,"AllLogLevels",[Oe.INFO,Oe.STDOUT,Oe.ERROR,Oe.FATAL,Oe.STDERR,Oe.WARN,Oe.DEBUG,Oe.TRACE]);Ge(pe,"bufferTimeout",16);Ge(pe,"maxLogSize",131072);Ge(pe,"truncateSize",65536);const Wf=pe;function Bi(n,e,t){return e=Uf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Uf(n){var e=Vf(n,"string");return typeof e=="symbol"?e:String(e)}function Vf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class zr{static isValid(e,t){return!0}static isSameFormat(e,t){throw new Error("isSameFormat not implemented")}static makeFormat(e,t,r){return{label:e,formatString:t,type:r}}format(e,t){return""}}Bi(zr,"TYPE_GLOBAL","type-global");Bi(zr,"TYPE_CONTEXT_PRESET","type-context-preset");Bi(zr,"TYPE_CONTEXT_CUSTOM","type-context-custom");const Be=zr;class Kf extends Be{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}const zf=Kf;class Gf extends Be{format(e){return String.fromCharCode(e)}}const qf=Gf;function Ht(n,e,t){return e=Xf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xf(n){var e=Zf(n,"string");return typeof e=="symbol"?e:String(e)}function Zf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ia=B.module("DateTimeColumnFormatter");class dt extends Be{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.DateTimeFormat.format(t.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Be.TYPE_CONTEXT_PRESET;return{label:e,formatString:t,type:r}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static makeGlobalFormatStringMap(e,t){var r=t?"'T'":" ",i=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getGlobalFormats(e,t){var r=dt.makeGlobalFormatStringMap(e,t);return[...r.keys()]}static makeFormatStringMap(e,t){var r=t!==void 0&&t?"'T'":" ",i=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd","yyyy-MM-dd".concat(i)],["MM-dd-yyyy","MM-dd-yyyy".concat(i)],["HH:mm:ss","HH:mm:ss".concat(i)],["HH:mm:ss.SSS","HH:mm:ss.SSS".concat(i)],["HH:mm:ss.SSSSSSSSS","HH:mm:ss.SSSSSSSSS".concat(i)],["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getFormats(e,t){var r=dt.makeFormatStringMap(e,t);return[...r.keys()]}constructor(e){var{timeZone:t="",showTimeZone:r=!0,showTSeparator:i=!1,defaultDateTimeFormatString:o=dt.DEFAULT_DATETIME_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Ht(this,"dh",void 0),Ht(this,"dhTimeZone",void 0),Ht(this,"defaultDateTimeFormatString",void 0),Ht(this,"showTimeZone",void 0),Ht(this,"showTSeparator",void 0),Ht(this,"formatStringMap",void 0);var a=t||dt.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(a)}catch{ia.error("Unsupported time zone id",a),this.dhTimeZone=e.i18n.TimeZone.getTimeZone(dt.DEFAULT_TIME_ZONE_ID)}this.dh=e,this.defaultDateTimeFormatString=o,this.showTimeZone=r,this.showTSeparator=i,this.formatStringMap=dt.makeFormatStringMap(r,i)}getEffectiveFormatString(e){var t;return(t=this.formatStringMap.get(e))!==null&&t!==void 0?t:e}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,i=this.getEffectiveFormatString(r);try{return this.dh.i18n.DateTimeFormat.format(i,e,this.dhTimeZone)}catch{ia.error("Invalid format arguments")}return""}}Ht(dt,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");Ht(dt,"DEFAULT_TIME_ZONE_ID","America/New_York");function St(n,e,t){return e=Yf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yf(n){var e=Qf(n,"string");return typeof e=="symbol"?e:String(e)}function Qf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Jf=B.module("DecimalColumnFormatter");class Ce extends Be{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Be.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return Ce.makeFormat(e,t,Be.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return Ce.makeFormat("Custom Format",e,Be.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}constructor(e){var{defaultFormatString:t=Ce.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),St(this,"defaultFormatString",void 0),St(this,"dh",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,i)}catch{Jf.error("Invalid format arguments")}return""}}St(Ce,"DEFAULT_FORMAT_STRING","###,##0.0000");St(Ce,"FORMAT_PERCENT",Ce.makePresetFormat("Percent","##0.00%"));St(Ce,"FORMAT_BASIS_POINTS",Ce.makePresetFormat("Basis Points","###,##0 bp",1e4));St(Ce,"FORMAT_MILLIONS",Ce.makePresetFormat("Millions","###,##0.000 mm",1e-6));St(Ce,"FORMAT_SCIENTIFIC_NOTATION",Ce.makePresetFormat("Scientific Notation","0.0000E0"));St(Ce,"FORMAT_ROUND",Ce.makePresetFormat("Round","###,##0"));St(Ce,"FORMAT_ROUND_TWO_DECIMALS",Ce.makePresetFormat("0.00","###,##0.00"));St(Ce,"FORMAT_ROUND_FOUR_DECIMALS",Ce.makePresetFormat("0.0000","###,##0.0000"));class ev extends Be{format(e){return"".concat(e)}}const tv=ev;function Zn(n,e,t){return e=nv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function nv(n){var e=rv(n,"string");return typeof e=="symbol"?e:String(e)}function rv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var iv=B.module("IntegerColumnFormatter");class Ct extends Be{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Be.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return Ct.makeFormat(e,t,Be.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return Ct.makeFormat("Custom Format",e,Be.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}constructor(e){var{defaultFormatString:t=Ct.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Zn(this,"dh",void 0),Zn(this,"defaultFormatString",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,i)}catch{iv.error("Invalid format arguments")}return""}}Zn(Ct,"DEFAULT_FORMAT_STRING","###,##0");Zn(Ct,"FORMAT_MILLIONS",Ct.makePresetFormat("Millions","###,##0.000 mm",1e-6));Zn(Ct,"FORMAT_SCIENTIFIC_NOTATION",Ct.makePresetFormat("Scientific Notation","0.0000E0"));class ov extends Be{format(e){return e}}function oa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function aa(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?oa(Object(t),!0).forEach(function(r){Wi(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):oa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Wi(n,e,t){return e=av(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function av(n){var e=sv(n,"string");return typeof e=="symbol"?e:String(e)}function sv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var lv=/\s*(\d{4})([-./](\d{1,2}|[a-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/;class we{static makeDateWrapper(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:0,d=arguments.length>8&&arguments[8]!==void 0?arguments[8]:0;if(!t)throw new Error("No timezone provided");var h="".concat(r).padStart(4,"0"),c="".concat(i+1).padStart(2,"0"),f="".concat(o).padStart(2,"0"),v="".concat(a).padStart(2,"0"),p="".concat(s).padStart(2,"0"),g="".concat(l).padStart(2,"0"),y="".concat(d).padStart(9,"0"),P="".concat(h,"-").concat(c,"-").concat(f," ").concat(v,":").concat(p,":").concat(g,".").concat(y);return e.i18n.DateTimeFormat.parse(we.FULL_DATE_FORMAT,P,e.i18n.TimeZone.getTimeZone(t))}static getNextNanos(e){var t=parseInt(e,10),r="0".repeat(9-e.length),i="".concat(t+1).concat(r);return parseInt(i,10)}static getNextDate(e,t,r,i){var{year:o,month:a,date:s,hours:l,minutes:d,seconds:h,nanos:c}=r;if(t.nanos!=null){if(t.nanos.length===9)return null;c=we.getNextNanos(t.nanos),c>999999999&&(h+=1,c=0)}else t.seconds!=null?h+=1:t.minutes!=null?d+=1:t.hours!=null?l+=1:t.date!=null?s+=1:t.month!=null?a+=1:o+=1;var f=new Date(o,a,s,l,d,h);return we.makeDateWrapper(e,i,f.getFullYear(),f.getMonth(),f.getDate(),f.getHours(),f.getMinutes(),f.getSeconds(),c)}static parseMonth(e){var t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;var r=e.trim().toLowerCase();if(r.length>=3){for(var i=0;i<we.months.length;i+=1)if(we.months[i].startsWith(r))return i}return NaN}static parseDateValues(e,t,r,i,o,a,s){var l=parseInt(e,10),d=t!=null?this.parseMonth(t):0,h=r!=null?parseInt(r,10):1,c=i!=null?parseInt(i,10):0,f=o!=null?parseInt(o,10):0,v=a!=null?parseInt(a,10):0,p=s!=null?parseInt(s.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(d)||Number.isNaN(h)||Number.isNaN(c)||Number.isNaN(f)||Number.isNaN(v)||Number.isNaN(p)?null:{year:l,month:d,date:h,hours:c,minutes:f,seconds:v,nanos:p}}static parseDateTimeString(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=lv.exec(e);if(r==null)throw new Error("Unexpected date string: ".concat(e));var[,i,,o,,a,,s,,l,,d,,h,c]=r;if(!t&&c!=null&&c.length>0)throw new Error("Unexpected characters after date string '".concat(e,"': ").concat(c));var f={year:i,month:o,date:a,hours:s,minutes:l,seconds:d,nanos:h};return t?aa(aa({},f),{},{overflow:c}):f}static parseDateRange(e,t,r){var i=t.trim().toLowerCase();if(i.length===0)throw new Error("Cannot parse date range from empty string");if(i==="null")return[null,null];if(i==="today"){var o=new Date(Date.now()),a=we.makeDateWrapper(e,r,o.getFullYear(),o.getMonth(),o.getDate()),s=new Date(o.getFullYear(),o.getMonth(),o.getDate()+1),l=we.makeDateWrapper(e,r,s.getFullYear(),s.getMonth(),s.getDate());return[a,l]}if(i==="yesterday"){var d=new Date(Date.now()),h=new Date(d.getFullYear(),d.getMonth(),d.getDate()-1),c=we.makeDateWrapper(e,r,h.getFullYear(),h.getMonth(),h.getDate()),f=we.makeDateWrapper(e,r,d.getFullYear(),d.getMonth(),d.getDate());return[c,f]}if(i==="now"){var v=new Date(Date.now()),p=e.DateWrapper.ofJsDate(v);return[p,null]}var g=we.parseDateTimeString(i);if(g.year==null&&g.month==null&&g.date==null)throw new Error("Unable to extract year, month, or day ".concat(i));var y=we.parseDateValues(g.year,g.month,g.date,g.hours,g.minutes,g.seconds,g.nanos);if(y==null)throw new Error("Unable to extract date values from ".concat(g));var P=we.makeDateWrapper(e,r,y.year,y.month,y.date,y.hours,y.minutes,y.seconds,y.nanos),O=we.getNextDate(e,g,y,r);return[P,O]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}static trimDateTimeStringTimeZone(e){var{overflow:t=""}=we.parseDateTimeString(e,!0);if(t==="")return e;if(!/^\s[A-Za-z]+/.test(t))throw new Error("Unexpected timezone format in overflow: '".concat(e,"'"));return e.slice(0,-t.length)}}Wi(we,"FULL_DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSSSSS");Wi(we,"months",["january","february","march","april","may","june","july","august","september","october","november","december"]);const li=we;function KC(n,e){return n===e?{operator:"notEq",value:""}:{operator:"eq",value:n}}function zC(n,e,t,r){return function(o){var a=t.trim();if(a==="")return null;var s=fl(e,l=>n.makeSearchTextFilter(l,a,r),"or");return s(o)}}function fl(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"or";return function(i){var o=i?.findColumns(typeof n=="string"?[n]:n);if(o==null||o.length===0)return null;var a=o.map(e);return a.reduce((s,l)=>s[t](l))}}function dv(n,e,t,r){return fl(e,i=>i.filter()[r](n.makeFilterValue(i.type,t)),"or")}function GC(n,e,t,r,i){return function(a){var s=a?.findColumn(e),l=t==="all"||r&&t.size===0;return s==null||l?null:n.makeSelectValueFilter(s,[...t.keys()],i)}}function qC(n){return function(t){return t.filter().isNull().not().and(t.filter().notEq(n.makeFilterValue(t.type,"")))}}function XC(n,e){return function(r){var i=r.filter(),o=n.makeFilterValue(r.type,""),a=i.eq(o);return e?i.isNull().or(a):a.or(i.notEq(o))}}function Ui(n,e,t){return e=uv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function uv(n){var e=hv(n,"string");return typeof e=="symbol"?e:String(e)}function hv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Yn{}Ui(Yn,"not","not");Ui(Yn,"and","and");Ui(Yn,"or","or");function ZC(n){if(!(n==="not"||n==="and"||n==="or"))throw new Error("operator is not a valid FilterOperatorValue")}function ve(n,e,t){return e=cv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function cv(n){var e=mv(n,"string");return typeof e=="symbol"?e:String(e)}function mv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class E{}ve(E,"eq","eq");ve(E,"eqIgnoreCase","eqIgnoreCase");ve(E,"notEq","notEq");ve(E,"notEqIgnoreCase","notEqIgnoreCase");ve(E,"greaterThan","greaterThan");ve(E,"greaterThanOrEqualTo","greaterThanOrEqualTo");ve(E,"lessThan","lessThan");ve(E,"lessThanOrEqualTo","lessThanOrEqualTo");ve(E,"in","in");ve(E,"inIgnoreCase","inIgnoreCase");ve(E,"notIn","notIn");ve(E,"notInIgnoreCase","notInIgnoreCase");ve(E,"isTrue","isTrue");ve(E,"isFalse","isFalse");ve(E,"isNull","isNull");ve(E,"invoke","invoke");ve(E,"contains","contains");ve(E,"notContains","notContains");ve(E,"containsIgnoreCase","containsIgnoreCase");ve(E,"startsWith","startsWith");ve(E,"endsWith","endsWith");ve(E,"containsAny","containsAny");var fv="DH_ITEM_KEY",sa=B.module("ViewportDataUtils");function vl(n){return"".concat(fv,"_").concat(n)}function vv(n,e){return vl(n.offsetInSnapshot+e)}function YC(n,e){var{bulkUpdate:t}=n;return function(i){var{columns:o,offset:a,rows:s}=i.detail;sa.debug("table updated",i.detail);var l=new Map;s.forEach(d=>{var h=e(d,o),c=vv(d,a);l.set(c,{key:c,item:h})}),sa.debug("update keys",l),t(l)}}function QC(n,e){return e.reduce((t,r)=>(t[r.name]=n.get(r),t),{})}function*JC(n,e){for(var t=n;t<=e;++t)yield{key:vl(t)}}function gv(n){return n==null||pv(n)?0:n.size}function pv(n){return"isClosed"in n?n.isClosed:!1}function eS(n,e,t,r){var i=n+e-1,[o,a]=[0,r-1],s=eo(n-t,o,a),l=eo(i+t,o,a);return[s,l]}function la(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function jt(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){la(o,r,i,a,s,"next",l)}function s(l){la(o,r,i,a,s,"throw",l)}a(void 0)})}}function cn(n,e,t){return e=bv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bv(n){var e=yv(n,"string");return typeof e=="symbol"?e:String(e)}function yv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Pt=B.module("TableUtils");function tS(n){return n===C.sortDirection.ascending||n===C.sortDirection.descending||n===C.sortDirection.reverse||n===C.sortDirection.none}class C{static copyTableAndApplyFilters(e){var t=arguments;return jt(function*(){if(e==null)return null;for(var r=yield e.copy(),i=t.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=t[a];return r.applyFilter(ni(...o.map(s=>s(r)))),r})()}static getSortIndex(e,t){for(var r=0;r<e.length;r+=1){var i,o=e[r];if(((i=o.column)===null||i===void 0?void 0:i.name)===t)return r}return null}static getSortForColumn(e,t){var r=C.getSortIndex(e,t);return r!=null?e[r]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return C.isBooleanType(e)?[E.isTrue,E.isFalse,E.isNull]:C.isCharType(e)||C.isNumberType(e)||C.isDateType(e)?[E.eq,E.notEq,E.greaterThan,E.greaterThanOrEqualTo,E.lessThan,E.lessThanOrEqualTo]:C.isTextType(e)?[E.eq,E.eqIgnoreCase,E.notEq,E.notEqIgnoreCase,E.contains,E.notContains,E.startsWith,E.endsWith]:[]}static getNextSort(e,t,r){if(r<0||r>=e.length)return null;var i=C.getSortForColumn(t,e[r].name);return i===null?e[r].sort().asc():i.direction===C.sortDirection.ascending?i.desc():null}static makeColumnSort(e,t,r,i){if(t<0||t>=e.length||r===C.sortDirection.none)return null;var o=e[t].sort();switch(r){case C.sortDirection.ascending:o=o.asc();break;case C.sortDirection.descending:o=o.desc();break}return i&&(o=o.abs()),o}static toggleSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(r<0||r>=t.length)return[];var o=C.getNextSort(t,e,r);return C.setSortForColumn(e,t[r].name,o,i)}static sortColumn(e,t,r,i,o,a){if(r<0||r>=t.length)return[];var s=C.makeColumnSort(t,r,i,o);return C.setSortForColumn(e,t[r].name,s,a)}static setSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=C.getSortIndex(e,t),a=[];return i&&(a=a.concat(e.filter(s=>{var{direction:l}=s;return l!==C.sortDirection.reverse})),o!==null&&a.splice(o,1)),r!==null&&a.push(r),a}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case C.dataType.BOOLEAN:return C.dataType.BOOLEAN;case"char":case"java.lang.Character":case C.dataType.CHAR:return C.dataType.CHAR;case"java.lang.String":case C.dataType.STRING:return C.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case C.dataType.DATETIME:return C.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case C.dataType.DECIMAL:return C.dataType.DECIMAL;case"int":case"java.lang.Integer":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":case"java.math.BigInteger":case C.dataType.INT:return C.dataType.INT;default:return C.dataType.UNKNOWN}}static isLongType(e){switch(e){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(e){switch(e){case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(e){return C.isIntegerType(e)||C.isDecimalType(e)}static isIntegerType(e){switch(e){case"int":case"java.lang.Integer":case"java.math.BigInteger":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":return!0;default:return!1}}static isDecimalType(e){switch(e){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBigDecimalType(e){switch(e){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(e){switch(e){case"java.math.BigInteger":return!0;default:return!1}}static isBooleanType(e){switch(e){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(e){switch(e){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(e){switch(e){case"java.lang.String":return!0;default:return!1}}static isTextType(e){return this.isStringType(e)||this.isCharType(e)}static getBaseType(e){return e.split("[]")[0]}static isCompatibleType(e,t){return C.getNormalizedType(e)===C.getNormalizedType(t)}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:'"'.concat(e,'"')}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeRangeFilterWithOperation(e,t,r){switch(t){case"=":return e.eq(r);case"<":return e.lessThan(r);case"<=":case"=<":return e.lessThanOrEqualTo(r);case">":return e.greaterThan(r);case">=":case"=>":return e.greaterThanOrEqualTo(r);case"!=":case"!":return e.notEq(r);default:return null}}static makeCancelableTablePromise(e){return Ee.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,o,a,s=!0,l=new Promise((d,h)=>{a=setTimeout(()=>{o(),s=!1,h(new Ms('Event "'.concat(t,'" timed out.')))},r),o=e.addEventListener(t,c=>{if(i!=null&&!i(c)){Pt.debug2("Event triggered, but matcher returned false.");return}Pt.debug2("Event triggered, resolving."),o(),clearTimeout(a),s=!1,d(c)})});return l.cancel=()=>{if(s){Pt.debug2("Pending promise cleanup."),o(),clearTimeout(a),s=!1;return}Pt.debug2("Ignoring non-pending promise cancel.")},l}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeBooleanValue(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e===""&&t)return null;switch(e?.toLowerCase()){case"null":return null;case"0":case"f":case"fa":case"fal":case"fals":case"false":case"n":case"no":return!1;case"1":case"t":case"tr":case"tru":case"true":case"y":case"ye":case"yes":return!0;default:throw new Error("Invalid boolean '".concat(e,"'"))}}static makeNumberValue(e){if(e==="null"||e==="")return null;var t=e.toLowerCase().trim();if(t==="∞"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-∞"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;var r=C.removeCommas(t);if(C.NUMBER_REGEX.test(r))return parseFloat(r);throw new Error("Invalid number '".concat(e,"'"))}static getFilterOperatorString(e){switch(e){case E.eq:return"=";case E.notEq:return"!=";case E.greaterThan:return">";case E.greaterThanOrEqualTo:return">=";case E.lessThan:return"<";case E.lessThanOrEqualTo:return"<=";case E.contains:return"~";case E.notContains:return"!~";default:throw new Error("Unexpected filter type ".concat(e))}}static isPartitionedTable(e){return e!=null&&e.getMergedTable!==void 0&&e.getKeyTable!==void 0&&e.getKeys!==void 0}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return[...e].sort((r,i)=>{var o=r.name.toUpperCase(),a=i.name.toUpperCase();return Ns.sort(o,a,t)})}constructor(e){cn(this,"dh",void 0),this.dh=e,bu(this)}createDistinctSortedColumnTable(e,t,r){var i=arguments,o=this;return jt(function*(){if(e==null)return null;for(var a=e,s=i.length,l=new Array(s>3?s-3:0),d=3;d<s;d++)l[d-3]=i[d];l.length>0&&(a=yield e.copy(),yield a.applyFilter(ni(...l.map(v=>v(a)))));var h=a.findColumn(t),c=yield a.selectDistinct([h]);a!==e&&a.close();var f=c.findColumn(t).sort()[r]();return o.applySort(c,[f])})()}doesColumnValueExist(e,t,r,i){var o=this;return jt(function*(){if(e==null)return null;var a=dv(o,t,r,i?"eq":"eqIgnoreCase"),s=yield e.copy();yield o.applyFilter(s,ni(a(s)));var l=gv(s);return s.close(),l>0})()}getValueType(e){if(e==null)return this.dh.ValueType.STRING;var t=C.getNormalizedType(e);switch(t){case C.dataType.BOOLEAN:return this.dh.ValueType.BOOLEAN;case C.dataType.CHAR:case C.dataType.STRING:return this.dh.ValueType.STRING;case C.dataType.DATETIME:return this.dh.ValueType.DATETIME;case C.dataType.DECIMAL:case C.dataType.INT:return C.isBigDecimalType(e)||C.isBigIntegerType(e)?this.dh.ValueType.STRING:this.dh.ValueType.NUMBER;default:return this.dh.ValueType.STRING}}makeQuickFilter(e,t,r){for(var i=t.split("||"),o=null,a=0;a<i.length;a+=1){for(var s=i[a],l=s.split("&&"),d=null,h=0;h<l.length;h+=1){var c=l[h].trim();if(c.length>0){var f=this.makeQuickFilterFromComponent(e,c,r);if(f)d?d=d.and(f):d=f;else throw new Error("Unable to parse quick filter from text ".concat(t))}}o&&d?o=o.or(d):o=d}return o}makeQuickFilterFromComponent(e,t,r){var{type:i}=e;return C.isNumberType(i)?this.makeQuickNumberFilter(e,t):C.isBooleanType(i)?this.makeQuickBooleanFilter(e,t):r!=null&&C.isDateType(i)?this.makeQuickDateFilter(e,t,r):C.isCharType(i)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}makeQuickNumberFilter(e,t){var r=e.filter(),{dh:i}=this,o=null,a=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i,s=a.exec(t),l=null,d=null,h=null,c=null,f=null;if(s!==null&&s.length>3&&([,l,d,h,c,f]=s),f!=null&&f.trim().length>0)return null;if(l==null&&(l="="),c!=null){if(!(l==="="||l==="!"||l==="!="))return null;switch(c=c.trim().toLowerCase(),c){case"null":o=r.isNull();break;case"nan":o=i.FilterCondition.invoke("isNaN",r);break;case"infinity":case"inf":case"∞":d!=null?o=i.FilterCondition.invoke("isInf",r).and(r.lessThan(i.FilterValue.ofNumber(0))):o=i.FilterCondition.invoke("isInf",r).and(r.greaterThan(i.FilterValue.ofNumber(0)));break}return o!==null&&(l==="!"||l==="!=")&&(o=o.not()),o}if(h==null)return null;if(h=C.removeCommas(h),C.isLongType(e.type))try{h=i.FilterValue.ofNumber(i.LongWrapper.ofString("".concat(d!=null?"-":"").concat(h)))}catch(v){return Pt.warn("Unable to create long filter",v),null}else{if(h=parseFloat(h),h==null||Number.isNaN(h))return null;h=i.FilterValue.ofNumber(d!=null?0-h:h)}return o=e.filter(),C.makeRangeFilterWithOperation(o,l,h)}static escapeQuickTextFilter(e){var t,r;if(e==null)return null;var i=/^(!~|!=|~|=|!)?(.*)/,o=/^\\*null$/,a=i.exec(e),s=null,l=null;if(a!==null&&a.length>2&&([,s,l]=a),s!=null){var d;return"\\".concat(s).concat((d=l)!==null&&d!==void 0?d:"")}return l!=null&&o.test(l.toLowerCase())||l!=null&&l.startsWith("*")?"\\".concat(l):l!=null&&l.endsWith("*")&&!l.endsWith("\\*")?(l=l.substring(0,l.length-1),"".concat(l,"\\*")):"".concat((t=s)!==null&&t!==void 0?t:"").concat((r=l)!==null&&r!==void 0?r:"")}static unescapeQuickTextFilter(e){var t,r,i=/^(\\!~|\\!=|\\~|\\=|\\!)?(.*)/,o=/^\\*null$/,a=i.exec(e),s=null,l=null;return a!==null&&a.length>2&&([,s,l]=a),s!=null&&(s=s.replace("\\","")),l!=null&&o.test(l.toLowerCase())&&(l=l.replace("\\","")),s==null&&l!=null&&l.startsWith("\\*")&&(l=l.substring(1)),s==null&&l!=null&&l.endsWith("\\*")?(l=l.substring(0,l.length-2),"".concat(l,"*")):"".concat((t=s)!==null&&t!==void 0?t:"").concat((r=l)!==null&&r!==void 0?r:"")}makeQuickTextFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),o=/^(!~|!=|~|=|!)?(.*)/,a=o.exec(i),s=null,l=null;if(a!==null&&a.length>2&&([,s,l]=a,l!=null&&(l=l.trim())),l==null||l.length===0&&!(s==="="||s==="!="))return null;s==null&&(s="=");var d=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return d.isNull();case"!=":case"!":return d.isNull().not()}var h=null,c=null;switch(l.startsWith("*")?(h="*",l=l.substring(1)):l.endsWith("*")&&!l.endsWith("\\*")&&(c="*",l=l.substring(0,l.length-1)),l=C.unescapeQuickTextFilter(l),s){case"~":return d.isNull().not().and(d.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))));case"!~":return d.isNull().or(d.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))).not());case"!=":return h==="*"?d.isNull().or(d.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$"))).not()):c==="*"?d.isNull().or(d.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*"))).not()):d.notEqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()));case"=":return h==="*"?d.isNull().not().and(d.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$")))):c==="*"?d.isNull().not().and(d.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*")))):d.eqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()))}return null}makeQuickBooleanFilter(e,t){var r=/^(!=|=|!)?(.*)/,i=r.exec("".concat(t).trim());if(i===null)return null;var[,o,a]=i,s=o==="!"||o==="!=",l=a.trim().toLowerCase(),d=e.filter();try{var h=C.makeBooleanValue(l);return h!=null&&h?d=d.isTrue():h===null?d=d.isNull():d=d.isFalse(),s?d.not():d}catch{return null}}makeQuickDateFilter(e,t,r){var i=t.trim(),o=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/,a=o.exec(i);if(a==null||a.length<=2)throw new Error("Unable to parse date filter: ".concat(t));var s=null,l=null;[,s,l]=a;var d=E.eq;switch(s){case"<":d=E.lessThan;break;case"<=":case"=<":d=E.lessThanOrEqualTo;break;case">":d=E.greaterThan;break;case">=":case"=>":d=E.greaterThanOrEqualTo;break;case"!=":case"!":d=E.notEq;break;case"=":case"==":default:d=E.eq;break}return this.makeQuickDateFilterWithOperation(e,l,d,r)}makeQuickDateFilterWithOperation(e,t,r,i){var{dh:o}=this,[a,s]=li.parseDateRange(o,t,i),l=a!=null?o.FilterValue.ofNumber(a):null,d=s!=null?o.FilterValue.ofNumber(s):null,h=e.filter();if(l==null)return r===E.notEq?h.isNull().not():h.isNull();switch(r){case E.eq:{if(d!=null){var c=h.greaterThanOrEqualTo(l),f=h.lessThan(d);return c.and(f)}return h.eq(l)}case E.lessThan:return h.lessThan(l);case E.lessThanOrEqualTo:return d!=null?h.lessThan(d):h.lessThanOrEqualTo(l);case E.greaterThan:return d!=null?h.greaterThanOrEqualTo(d):h.greaterThan(l);case E.greaterThanOrEqualTo:return h.greaterThanOrEqualTo(l);case E.notEq:{if(d!=null){var v=h.lessThan(l),p=h.greaterThanOrEqualTo(d);return v.or(p)}return h.notEq(l)}default:throw new Error("Invalid operator: ".concat(r))}}makeQuickCharFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),o=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/,a=o.exec(i),s=null,l=null,d=null;if(a!==null&&a.length>3&&([,s,l,d]=a),d!=null&&d.trim().length>0||l==null||l.length===0)return null;s==null&&(s="=");var h=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return h.isNull();case"!=":case"!":return h.isNull().not();default:return null}var c=r.FilterValue.ofString(C.isRangeOperation(s)?C.quoteValue(l):l);return C.makeRangeFilterWithOperation(h,s,c)}makeAdvancedFilter(e,t,r){for(var{filterItems:i,filterOperators:o,invertSelection:a,selectedValues:s}=t,l=null,d=0;d<i.length;d+=1){var h=i[d],{selectedType:c,value:f}=h;if(c!=null&&c.length>0&&f!=null&&f.length>0)try{var v=this.makeAdvancedValueFilter(e,c,f,r);if(v!=null){if(d===0)l=v;else if(l!==null&&d-1<o.length){var p=o[d-1];if(p===Yn.and)l=l.and(v);else if(p===Yn.or)l=l.or(v);else{Pt.error("Unexpected filter operator",p,v),l=null;break}}}else Pt.debug2("Empty filter ignored for",c,f)}catch(y){Pt.error("Unable to create filter",y),l=null;break}}var g=this.makeSelectValueFilter(e,s,a);return g!=null&&(l!=null?l=l.and(g):l=g),l}makeAdvancedValueFilter(e,t,r,i){var{dh:o}=this;if(C.isDateType(e.type))return this.makeQuickDateFilterWithOperation(e,r,t,i);if(C.isNumberType(e.type)||C.isCharType(e.type))return this.makeQuickFilter(e,"".concat(C.getFilterOperatorString(t)).concat(r));var a=this.makeFilterValue(e.type,r),s=e.filter();switch(t){case E.eq:return s.eq(a);case E.eqIgnoreCase:return s.eqIgnoreCase(a);case E.notEq:return s.notEq(a);case E.notEqIgnoreCase:return s.notEqIgnoreCase(a);case E.greaterThan:return s.greaterThan(a);case E.greaterThanOrEqualTo:return s.greaterThanOrEqualTo(a);case E.lessThan:return s.lessThan(a);case E.lessThanOrEqualTo:return s.lessThanOrEqualTo(a);case E.isTrue:return s.isTrue();case E.isFalse:return s.isFalse();case E.isNull:return s.isNull();case E.contains:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))));case E.notContains:return s.isNull().or(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))).not());case E.startsWith:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i)^\\Q".concat(r,"\\E.*"))));case E.endsWith:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E$"))));case E.in:case E.inIgnoreCase:case E.notIn:case E.notInIgnoreCase:case E.invoke:default:throw new Error("Unexpected filter operation: ".concat(t))}}makeSearchTextFilter(e,t,r){var i=this.getValueType(e.type);try{if(i===this.dh.ValueType.BOOLEAN){var o=this.makeQuickBooleanFilter(e,t);return k(o),o}if(i===this.dh.ValueType.DATETIME)return this.makeQuickDateFilterWithOperation(e,li.trimDateTimeStringTimeZone(t),"eq",r);if(i===this.dh.ValueType.NUMBER){var a=this.makeQuickNumberFilter(e,t);return k(a),a}return C.isBigDecimalType(e.type)||C.isBigIntegerType(e.type)?e.filter().eq(this.makeFilterValue(e.type,t)):e.filter().containsIgnoreCase(this.makeFilterValue(e.type,t))}catch{return this.makeNeverFilter(e)}}applyNeverFilter(e,t){var r=arguments,i=this;return jt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(e==null)return null;var a=e.findColumn(t),s=[i.makeNeverFilter(a)];return yield i.applyFilter(e,s,o),e})()}applyCustomColumns(e,t){var r=arguments,i=this;return jt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return C.executeAndWaitForEvent(s=>s?.applyCustomColumns(t),e,a.Table.EVENT_CUSTOMCOLUMNSCHANGED,o)})()}applyFilter(e,t){var r=arguments,i=this;return jt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return C.executeAndWaitForEvent(s=>s?.applyFilter(t),e,a.Table.EVENT_FILTERCHANGED,o)})()}applySort(e,t){var r=arguments,i=this;return jt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return C.executeAndWaitForEvent(s=>s?.applySort(t),e,a.Table.EVENT_SORTCHANGED,o)})()}makeNeverFilter(e){var{dh:t}=this,r=null;C.isTextType(e.type)?r=t.FilterValue.ofString("a"):C.isBooleanType(e.type)?r=t.FilterValue.ofBoolean(!0):C.isDateType(e.type)?r=t.FilterValue.ofNumber(t.DateWrapper.ofJsDate(new Date)):r=t.FilterValue.ofNumber(0);var i=e.filter().eq(r),o=e.filter().notEq(r);return i.and(o)}makeFilterValue(e,t){var{dh:r}=this,i=C.getBaseType(e);return C.isTextType(i)?r.FilterValue.ofString(t):C.isLongType(i)?r.FilterValue.ofNumber(r.LongWrapper.ofString(C.removeCommas(t))):r.FilterValue.ofNumber(C.removeCommas(t))}makeFilterRawValue(e,t){var{dh:r}=this;return C.isCharType(e)?r.FilterValue.ofString(typeof t=="number"?String.fromCharCode(t):t):C.isTextType(e)?r.FilterValue.ofString(t):C.isBooleanType(e)?r.FilterValue.ofBoolean(t):r.FilterValue.ofNumber(t)}makeNullableEqFilter(e,t){return t==null?e.filter().isNull():e.filter().eq(this.makeFilterRawValue(e.type,t))}makeValue(e,t,r){var{dh:i}=this;if(t==="null")return null;if(C.isTextType(e))return t;if(C.isLongType(e))return i.LongWrapper.ofString(C.removeCommas(t));if(C.isBooleanType(e))return C.makeBooleanValue(t,!0);if(C.isDateType(e)){var[o]=li.parseDateRange(i,t,r);return o}return C.isNumberType(e)?C.makeNumberValue(t):(Pt.error("Unexpected column type",e),null)}makeSelectValueFilter(e,t,r){var{dh:i}=this;if(t.length===0)return r?null:this.makeNeverFilter(e);for(var o=[],a=!1,s=0;s<t.length;s+=1){var l=t[s];l==null?a=!0:C.isTextType(e.type)?o.push(i.FilterValue.ofString(typeof l=="number"?String.fromCharCode(l):l)):C.isBooleanType(e.type)?o.push(i.FilterValue.ofBoolean(!!l)):o.push(i.FilterValue.ofNumber(l))}return a?o.length>0?r?e.filter().isNull().not().and(e.filter().notIn(o)):e.filter().isNull().or(e.filter().in(o)):r?e.filter().isNull().not():e.filter().isNull():r?e.filter().notIn(o):e.filter().in(o)}}cn(C,"dataType",{BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"});cn(C,"sortDirection",{ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null});cn(C,"APPLY_TABLE_CHANGE_TIMEOUT_MS",3e4);cn(C,"REVERSE_TYPE",Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"}));cn(C,"NUMBER_REGEX",/^-?\d+(\.\d+)?$/);cn(C,"executeAndWaitForEvent",function(){var n=jt(function*(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(t==null)return null;var o=C.makeCancelableTableEventPromise(t,r,i);return e(t),yield o,t});return function(e,t,r){return n.apply(this,arguments)}}());function vn(n,e,t){return e=Cv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cv(n){var e=Sv(n,"string");return typeof e=="symbol"?e:String(e)}function Sv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class gl{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((t,r)=>{var i=C.getNormalizedType(r.columnType);if(i===null)return t;t.has(i)||t.set(i,new Map);var o=t.get(i);return o?.set(r.columnName,r.format),t},new Map)}static makeColumnFormattingRule(e,t,r){return{columnType:e,columnName:t,format:r}}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:!0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!0;vn(this,"defaultColumnFormatter",void 0),vn(this,"typeFormatterMap",void 0),vn(this,"columnFormatMap",void 0),vn(this,"truncateNumbersWithPound",void 0),vn(this,"showEmptyStrings",void 0),vn(this,"showNullStrings",void 0),this.defaultColumnFormatter=new tv,this.typeFormatterMap=new Map([[C.dataType.BOOLEAN,new zf],[C.dataType.CHAR,new qf],[C.dataType.DATETIME,new dt(e,r)],[C.dataType.DECIMAL,new Ce(e,i)],[C.dataType.INT,new Ct(e,o)],[C.dataType.STRING,new ov]]),this.columnFormatMap=gl.makeColumnFormatMap(t),this.truncateNumbersWithPound=a,this.showEmptyStrings=s,this.showNullStrings=l}getColumnFormatMapForType(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=C.getNormalizedType(e);if(r!==null)return t&&!this.columnFormatMap.has(r)&&this.columnFormatMap.set(r,new Map),this.columnFormatMap.get(r)}getColumnFormat(e,t){var r,i=this.getColumnFormatMapForType(e);return(r=i?.get(t))!==null&&r!==void 0?r:null}getColumnTypeFormatter(e){var t=C.getNormalizedType(e),r=this.defaultColumnFormatter;if(t){var i;r=(i=this.typeFormatterMap.get(t))!==null&&i!==void 0?i:r}return r}getFormattedString(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",i=arguments.length>3?arguments[3]:void 0;if(e==null)return"";var o=this.getColumnTypeFormatter(t),a=i||this.getColumnFormat(t,r);return o.format(e,a??void 0)}get timeZone(){var e=this.typeFormatterMap.get(C.dataType.DATETIME);return Jd(e,dt),e.dhTimeZone.id}}const wv="var(--dh-color-chart-colorway)",Ev="var(--dh-color-chart-grid)",_v="var(--dh-color-chart-axis-line)",Pv="var(--dh-color-chart-axis-line-zero)",da={"paper-bgcolor":"var(--dh-color-chart-bg)","plot-bgcolor":"var(--dh-color-chart-plot-bg)","title-color":"var(--dh-color-chart-title)","legend-color":"var(--dh-color-chart-legend-fg)",colorway:wv,gridcolor:Ev,linecolor:_v,zerolinecolor:Pv,"error-band-line-color":"var(--dh-color-chart-error-band-line)","ohlc-increasing":"var(--dh-color-chart-ohlc-increase)","ohlc-decreasing":"var(--dh-color-chart-ohlc-decrease)","coastline-color":"var(--dh-color-chart-geo-coastline)","land-color":"var(--dh-color-chart-geo-land)","ocean-color":"var(--dh-color-chart-geo-ocean)","lake-color":"var(--dh-color-chart-geo-lake)","river-color":"var(--dh-color-chart-geo-river)"};var ua=B.module("ChartTheme");function Tv(){var n,e=Cs(da);return e.colorway=eu((n=e.colorway)!==null&&n!==void 0?n:"").map(t=>{var[r,i]=t;return tu.normalizeCssColor(e.colorway.substring(r,i+1))}).join(" "),ua.debug2("Chart theme:",da),ua.debug2("Chart theme derived:",e),Object.freeze({paper_bgcolor:e["paper-bgcolor"],plot_bgcolor:e["plot-bgcolor"],title_color:e["title-color"],legend_color:e["legend-color"],colorway:e.colorway,gridcolor:e.gridcolor,linecolor:e.linecolor,zerolinecolor:e.zerolinecolor,error_band_line_color:e["error-band-line-color"],ohlc_increasing:e["ohlc-increasing"],ohlc_decreasing:e["ohlc-decreasing"],coastline_color:e["coastline-color"],land_color:e["land-color"],ocean_color:e["ocean-color"],lake_color:e["lake-color"],river_color:e["river-color"]})}function ha(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ov(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ha(Object(t),!0).forEach(function(r){Iv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ha(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Iv(n,e,t){return e=Dv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Dv(n){var e=xv(n,"string");return typeof e=="symbol"?e:String(e)}function xv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Mv=m.lazy(()=>Ts(()=>import("./Plot-ebc409c8.js"),["./Plot-ebc409c8.js","./Plotly-63b44574.js","./plotly-96591286.js","./helpers-de833af9.js","./vendor-e600113a.js","./vendor-fb3fd713.css"],import.meta.url));function Nv(n){return u.jsx(m.Suspense,{fallback:u.jsx(un,{}),children:u.jsx(Mv,Ov({},n))})}var pl=m.createContext(null);function nS(n){var{children:e}=n,{activeThemes:t}=$s(),r=m.useMemo(Tv,[t]);return u.jsx(pl.Provider,{value:r,children:e})}function Av(){return nr(pl,"No ChartThemeContext value found.")}function ca(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Lv(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ca(o,r,i,a,s,"next",l)}function s(l){ca(o,r,i,a,s,"throw",l)}a(void 0)})}}var Fv=B.module("HeapUsage");function Rv(n){var e,{connection:t,defaultUpdateInterval:r,hoverUpdateInterval:i,bgMonitoring:o=!0,monitorDuration:a}=n,s=Av(),[l,d]=m.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[h,c]=m.useState(!1),f=m.useRef({timestamps:[],usages:[]}),v=Fs(),p=m.useCallback(Lv(function*(){try{var A=yield t.getWorkerHeapInfo();if(!v.current)return;if(d(A),o||h){for(var V=(A.totalHeapSize-A.freeMemory)/A.maximumHeapSize,z=Date.now(),{timestamps:me,usages:je}=f.current;me.length!==0&&z-me[0]>a*1.5;)me.shift(),je.shift();me.push(z),je.push(V)}else f.current={timestamps:[],usages:[]}}catch(De){Fv.warn("Unable to get heap usage",De)}}),[t,v,o,h,a]);Uu(p,h?i:r);var g=(A,V)=>Math.round(A*10**V)/10**V,y=2,P=1024**3,{freeMemory:O,totalHeapSize:_,maximumHeapSize:R}=l,U=g(O/P,y),Q=g(_/P,y),N=g(R/P,y),W=Q-U,j=function(V,z){var me=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return u.jsxs("div",{className:Z("heap-usage-info-row",{"heading-bottom-border":me}),children:[u.jsx("div",{className:"font-weight-bold",children:V}),u.jsx("div",{children:z})]})},{timestamps:Y,usages:ne}=f.current,F=(e=Y[Y.length-1])!==null&&e!==void 0?e:0,q=_/R,K=(_-O)/R;return u.jsxs("div",{className:"max-memory",children:[u.jsx("div",{className:"total-memory",style:{width:"calc(".concat(q*100,"% - ").concat(q*2,"px")}}),u.jsx("div",{className:Z("used-memory",{"heap-overflow":(_-O)/R>.95}),style:{width:"calc(".concat(K*100,"% - ").concat(K*2,"px")}}),u.jsxs("div",{className:"memory-text",children:[N.toFixed(1)," GB"]}),u.jsx(qt,{onEntered:()=>c(!0),onExited:()=>c(!1),interactive:!0,children:u.jsxs("div",{className:"heap-tooltip",children:[j("In use:","".concat(W.toFixed(y)," of ").concat(N.toFixed(y)," GB"),!0),j("Free:","".concat(U.toFixed(y)," GB")),j("Total:","".concat(Q.toFixed(y)," GB")),j("Max:","".concat(N.toFixed(y)," GB")),u.jsx("div",{className:"heap-plot",children:u.jsx(Nv,{data:[{x:[...Y],y:[...ne],type:"scatter",mode:"lines"}],config:{staticPlot:!0,responsive:!0},style:{width:"196px",height:"100px"},layout:{margin:{l:2,t:2,r:2,b:2},plot_bgcolor:"transparent",paper_bgcolor:"transparent",colorway:["#4878ea"],xaxis:{dtick:Math.round(a/6),gridcolor:s.linecolor,range:[F-a,F],linecolor:s.linecolor,linewidth:2,mirror:!0},yaxis:{dtick:.2,gridcolor:s.linecolor,range:[0,1],linecolor:s.linecolor,linewidth:2,mirror:!0}}})}),u.jsxs("div",{className:"heap-utilisation-text",children:["% utilization over ",Math.round(a/1e3/60)," min."]})]})})]})}function ma(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function kv(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ma(Object(t),!0).forEach(function(r){jv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ma(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function jv(n,e,t){return e=$v(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $v(n){var e=Hv(n,"string");return typeof e=="symbol"?e:String(e)}function Hv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Vi=Object.freeze({}),Bv=new Map,rS=n=>n.api,iS=n=>n.user,bl=n=>n.storage,yl=n=>bl(n).commandHistoryStorage,Cl=n=>bl(n).fileStorage,Wv=n=>n.defaultWorkspaceSettings,Sl=n=>{var{workspace:e}=n;return e},We=wd(n=>{for(var e,t,r=(e=(t=Sl(n))===null||t===void 0?void 0:t.data.settings)!==null&&e!==void 0?e:{},i=kv({},Wv(n)),o=Object.keys(r),a=0;a<o.length;a+=1){var s=o[a];r[s]!==void 0&&(i[s]=r[s])}return i}),oS=n=>n.defaultWorkspaceSettings,aS=n=>We(n).defaultDateTimeFormat,sS=n=>{var e;return(e=We(n).defaultDecimalFormatOptions)!==null&&e!==void 0?e:Vi},lS=n=>{var e;return(e=We(n).defaultIntegerFormatOptions)!==null&&e!==void 0?e:Vi},dS=n=>{var e;return(e=We(n).formatter)!==null&&e!==void 0?e:[]},Uv=n=>We(n).timeZone,uS=n=>We(n).showTimeZone,hS=n=>We(n).showTSeparator,cS=n=>We(n).truncateNumbersWithPound,mS=n=>We(n).showEmptyStrings,fS=n=>We(n).showNullStrings,vS=n=>We(n).shortcutOverrides,gS=n=>We(n).webgl,pS=n=>We(n).webglEditable,Vv=n=>{var e;return(e=We(n).defaultNotebookSettings)!==null&&e!==void 0?e:Vi},bS=n=>n.activeTool,Kv=n=>{var e;return(e=n.plugins)!==null&&e!==void 0?e:Bv},wl="SET_ACTIVE_TOOL",El="SET_API",_l="SET_COMMAND_HISTORY_STORAGE",Pl="SET_FILE_STORAGE",Tl="SET_PLUGINS",Ol="SET_USER",Il="SET_WORKSPACE",Dl="SET_DEFAULT_WORKSPACE_SETTINGS",xl="SET_WORKSPACE_STORAGE",Ml="SET_SERVER_CONFIG_VALUES";function fa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Jt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fa(Object(t),!0).forEach(function(r){zv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):fa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function zv(n,e,t){return e=Gv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gv(n){var e=qv(n,"string");return typeof e=="symbol"?e:String(e)}function qv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var yS=n=>({type:Ol,payload:n}),CS=n=>({type:El,payload:n}),Nl=n=>({type:Il,payload:n}),SS=n=>({type:Dl,payload:n}),wS=n=>({type:xl,payload:n}),ES=n=>({type:_l,payload:n}),_S=n=>({type:Pl,payload:n}),Xv=n=>(e,t)=>{e(Nl(n));var{storage:r}=t(),{workspaceStorage:i}=r;return i?.save(n)},Zv=n=>(e,t)=>{var{workspace:r}=t(),{data:i}=r??{},o=Jt(Jt({},r),{},{data:Jt(Jt(Jt({},i),n),{},{settings:Jt(Jt({},i?.settings),n.settings)})});return e(Xv(o))},Yv=n=>e=>e(Zv({settings:n})),PS=n=>({type:wl,payload:n}),TS=n=>({type:Tl,payload:n}),OS=n=>({type:Ml,payload:n});function va(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function di(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?va(Object(t),!0).forEach(function(r){Qv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):va(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Qv(n,e,t){return e=Jv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Jv(n){var e=eg(n,"string");return typeof e=="symbol"?e:String(e)}function eg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Al(n,e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,r=arguments.length>1?arguments[1]:void 0;switch(r.type){case n:{var i=r.payload;return i==null?null:t!=null?di(di({},t),i):di({},i)}default:return t}}}function ga(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function pa(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ga(Object(t),!0).forEach(function(r){tg(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ga(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function tg(n,e,t){return e=ng(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ng(n){var e=rg(n,"string");return typeof e=="symbol"?e:String(e)}function rg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function ig(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,i=arguments.length>1?arguments[1]:void 0;switch(i.type){case n:{var{id:o,payload:a}=i;return t&&Xn({payload:a},{payload:r[o]})?r:pa(pa({},r),{},{[o]:a})}default:return r}}}function Zt(n,e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,r=arguments.length>1?arguments[1]:void 0;switch(r.type){case n:return r.payload;default:return t}}}const og=Zt(El,null),ag=Zt(wl,null),sg=Zt(Tl,null),lg=Zt(_l,null),dg=Zt(Pl,null),ug=Zt(xl,null),hg=Ai({commandHistoryStorage:lg,fileStorage:dg,workspaceStorage:ug}),cg=Al(Ol,null),mg=Al(Il,null),fg=Zt(Dl,null),vg=Zt(Ml,null);var gg={activeTool:ag,api:og,plugins:sg,storage:hg,user:cg,workspace:mg,defaultWorkspaceSettings:fg,serverConfigValues:vg};const pg=gg;function ba(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ya(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ba(Object(t),!0).forEach(function(r){wi(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ba(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function wi(n,e,t){return e=bg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bg(n){var e=yg(n,"string");return typeof e=="symbol"?e:String(e)}function yg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Cg{constructor(){wi(this,"reducers",{}),wi(this,"listener",null)}register(e,t){var r;this.reducers=ya(ya({},this.reducers),{},{[e]:t}),(r=this.listener)===null||r===void 0||r.call(this,this.reducers)}setListener(e){this.listener=e}}var Sg=new Cg;const Gr=Sg;var Ca=B.module("redux-logger"),wg=n=>e=>t=>{Ca.debug("dispatching",t);var r=e(t);return Ca.debug("next state",n.getState()),r};const Eg=wg;var _g=B.module("redux-crashReporter"),Pg=n=>e=>t=>{try{return e(t)}catch(r){throw _g.error("Error executing",t," with state ",n.getState(),":",r),r}};const Tg=Pg,Og=[Eg,Tg,Ed];var ui;Object.entries(pg).map(n=>{var[e,t]=n;return Gr.register(e,t)});var Ig=(ui=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__)!==null&&ui!==void 0?ui:Td,Ll=_d(Ai(Gr.reducers),Ig(Pd(...Og)));Gr.setListener(n=>{Ll.replaceReducer(Ai(n))});const IS=Ll;var Fl=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 Rl(n){return n.componentName!==void 0}function Dg(n){return n.component!==void 0}var kl=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const xg=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:Fl,isGLComponentConfig:Rl,isReactComponentConfig:Dg,itemDefaultConfig:kl},Symbol.toStringTag,{value:"Module"}));function Ir(n,e,t){return e=Mg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Mg(n){var e=Ng(n,"string");return typeof e=="symbol"?e:String(e)}function Ng(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Qn{constructor(){Ir(this,"_mSubscriptions",void 0),Ir(this,"off",this.unbind),Ir(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[Qn.ALL_EVENT]=[]}on(e,t,r){if(typeof t!="function")throw new Error("Tried to listen to event "+e+" with non-function callback "+t);this._mSubscriptions[e]||(this._mSubscriptions[e]=[]),this._mSubscriptions[e].push({fn:t,ctx:r})}emit(e){for(var t=this._mSubscriptions[e],r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];if(t)for(var a=0;a<t.length;a++){var s=t[a].ctx||{};try{t[a].fn.apply(s,i)}catch(c){console.error("Error while emitting event:",c)}}i.unshift(e);for(var l=this._mSubscriptions[Qn.ALL_EVENT],d=0;d<l.length;d++){var h=l[d].ctx||{};try{l[d].fn.apply(h,i)}catch(c){console.error("Error while emitting event to allEventSubs:",c)}}}unbind(e,t,r){if(!this._mSubscriptions[e])throw new Error("No subscriptions to unsubscribe for event "+e);for(var i=!1,o=0;o<this._mSubscriptions[e].length;o++)(!t||this._mSubscriptions[e][o].fn===t)&&(!r||r===this._mSubscriptions[e][o].ctx)&&(this._mSubscriptions[e].splice(o,1),i=!0);if(i===!1)throw new Error("Nothing to unbind for "+e)}}Ir(Qn,"ALL_EVENT","__all");const ct=Qn;function st(n,e,t){return e=Ag(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ag(n){var e=Lg(n,"string");return typeof e=="symbol"?e:String(e)}function Lg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ei extends ct{constructor(e,t,r){super(),st(this,"width",void 0),st(this,"height",void 0),st(this,"title",void 0),st(this,"parent",void 0),st(this,"layoutManager",void 0),st(this,"tab",void 0),st(this,"_config",void 0),st(this,"isHidden",!1),st(this,"beforeCloseHandler",void 0),st(this,"_element",M(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),st(this,"_contentElement",void 0),this.title=Rl(e)?e.componentName:"",this.parent=t,this.layoutManager=r,this._config=e,this._contentElement=this._element.find(".lm_content"),this.beforeCloseHandler=null}getElement(){return this._contentElement}hide(){this.emit("hide"),this.isHidden=!0,this._element.hide()}show(){this.emit("show"),this.isHidden=!1,this._element.show(),(this.height!=0||this.width!=0)&&this.emit("shown")}setSize(e,t){for(var r,i,o,a=this.parent,s=null;a&&!a.isColumn&&!a.isRow;){var l;if(s=a,a=a.parent,(l=a)!==null&&l!==void 0&&l.isRoot)return!1}if(!a||!s)return!1;for(var d=a.isColumn?"height":"width",h=d==="height"?t:e,c=((r=this[d])!==null&&r!==void 0?r:0)*(1/(((i=s.config[d])!==null&&i!==void 0?i:0)/100)),f=h/c*100,v=(((o=s.config[d])!==null&&o!==void 0?o:0)-f)/(a.contentItems.length-1),p=0;p<a.contentItems.length;p++)if(a.contentItems[p]===s)a.contentItems[p].config[d]=f;else{var g;a.contentItems[p].config[d]=((g=a.contentItems[p].config[d])!==null&&g!==void 0?g:0)+v}return a.callDownwards("setSize"),!0}close(e){var t,r;this._config.isClosable&&(!((t=(r=this.beforeCloseHandler)===null||r===void 0?void 0:r.call(this,e))!==null&&t!==void 0)||t)&&(this.emit("close"),this.parent.close())}beforeClose(e){this.beforeCloseHandler=e}getState(){return this._config.componentState}getConfig(){return this._config}extendState(e){this.setState(M.extend(!0,this.getState(),e))}setState(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")}setTitle(e){this.parent.setTitle(e)}_$setSize(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(e!==this.width||t!==this.height){this.width=e,this.height=t;var r=this._contentElement[0],i=r.offsetWidth-r.clientWidth,o=r.offsetHeight-r.clientHeight;this._contentElement.width(this.width-i).height(this.height-o),this.emit("resize")}}}const Fg=Object.freeze(Object.defineProperty({__proto__:null,Container:Ei,ItemContainer:Ei},Symbol.toStringTag,{value:"Module"}));function jl(n){var e=location.hash.match(new RegExp(n+"=([^&]*)"));return e?e[1]:null}function $l(n){if(window.location.hash)return jl(n);if(!window.location.search)return null;var e=window.location.search.substr(1).split("&"),t={},r,i;for(i=0;i<e.length;i++)r=e[i].split("="),t[r[0]]=r[1];return t[n]||null}function Ki(n){return window.requestAnimationFrame(n)}function Rg(n,e){var t=e.indexOf(n);if(t===-1)throw new Error("Can't remove item from array. Item is not in the array");e.splice(t,1)}function Fr(){return Mt()}function kg(n,e){var t=n.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 zi(n){return M.trim(n.replace(/(<([^>]+)>)/gi,""))}function Ue(n,e,t){return e=jg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jg(n){var e=$g(n,"string");return typeof e=="symbol"?e:String(e)}function $g(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Hg extends ct{constructor(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super(),Ue(this,"_eElement",void 0),Ue(this,"_oDocument",void 0),Ue(this,"_eBody",void 0),Ue(this,"_destroyAfterMouseUp",void 0),Ue(this,"_nDelay",400),Ue(this,"_timeout",void 0),Ue(this,"timeout",void 0),Ue(this,"_nDistance",10),Ue(this,"_nX",0),Ue(this,"_nY",0),Ue(this,"_nOriginalX",0),Ue(this,"_nOriginalY",0),Ue(this,"_bDragging",!1),this._eElement=e,this._oDocument=M(document),this._eBody=M(document.body),this._destroyAfterMouseUp=r,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this._startDrag=this._startDrag.bind(this),(t=this._eElement)===null||t===void 0||t.on("mousedown",this.onMouseDown)}destroy(){var e,t;(e=this._eElement)===null||e===void 0||e.unbind("mousedown",this.onMouseDown),(t=this._oDocument)===null||t===void 0||t.unbind("mouseup",this.onMouseUp),this._eElement=void 0,this._oDocument=void 0,this._eBody=void 0,clearTimeout(this._timeout),this._timeout=void 0}onMouseDown(e){if(e.preventDefault(),e.button===0){var t,r,i,o,a=this._getCoordinates(e);this._nOriginalX=(t=a.x)!==null&&t!==void 0?t:0,this._nOriginalY=(r=a.y)!==null&&r!==void 0?r:0,(i=this._oDocument)===null||i===void 0||i.on("mousemove",this.onMouseMove),(o=this._oDocument)===null||o===void 0||o.on("mouseup",this.onMouseUp),this._timeout=window.setTimeout(this._startDrag,this._nDelay)}}onMouseMove(e){if(this._timeout!=null){var t,r;e.preventDefault();var i=this._getCoordinates(e);this._nX=((t=i.x)!==null&&t!==void 0?t:0)-this._nOriginalX,this._nY=((r=i.y)!==null&&r!==void 0?r:0)-this._nOriginalY,this._bDragging===!1&&(Math.abs(this._nX)>this._nDistance||Math.abs(this._nY)>this._nDistance)&&this._startDrag(),this._bDragging&&this.emit("drag",this._nX,this._nY,e)}}onMouseUp(e){if(this._timeout!=null){var t,r,i,o,a;if(clearTimeout(this._timeout),(t=this._oDocument)===null||t===void 0||t.unbind("mousemove",this.onMouseMove),(r=this._oDocument)===null||r===void 0||r.unbind("mouseup",this.onMouseUp),(i=this._oDocument)===null||i===void 0||(o=i.find("iframe"))===null||o===void 0||o.css("pointer-events",""),this._bDragging===!0&&(this._bDragging=!1,this.emit("dragStop",e,this._nOriginalX+this._nX)),(a=this._eBody)===null||a===void 0||a.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var s;(s=this._eElement)===null||s===void 0||s.removeClass("lm_dragging")}this._destroyAfterMouseUp&&this.destroy()}}_startDrag(){var e,t,r,i;window.clearTimeout(this._timeout),this._bDragging=!0,(e=this._eBody)===null||e===void 0||e.addClass("lm_dragging"),(t=this._eElement)===null||t===void 0||t.addClass("lm_dragging"),(r=this._oDocument)===null||r===void 0||(i=r.find("iframe"))===null||i===void 0||i.css("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)}_getCoordinates(e){var t,r;return{x:(t=e.pageX)!==null&&t!==void 0?t:0,y:(r=e.pageY)!==null&&r!==void 0?r:0}}}const ir=Hg;function gn(n,e,t){return e=Bg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Bg(n){var e=Wg(n,"string");return typeof e=="symbol"?e:String(e)}function Wg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Hl{constructor(e,t){gn(this,"_container",void 0),gn(this,"_reactComponent",null),gn(this,"_portalComponent",null),gn(this,"_originalComponentWillUpdate",null),gn(this,"_initialState",void 0),gn(this,"_reactClass",void 0),this._reactComponent=null,this._portalComponent=null,this._originalComponentWillUpdate=null,this._container=e,this._initialState=t,this._reactClass=this._getReactClass(),this._container.on("open",this._render,this),this._container.on("destroy",this._destroy,this)}_key(){var e=this._container._config.id;if(!e)throw new Error("Cannot mount panel without id");return Array.isArray(e)?e.join(","):e}_render(){var e=this._key();this._portalComponent=Hr.createPortal(this._getReactComponent(),this._container.getElement()[0],e),this._container.layoutManager.addReactChild(e,this._portalComponent)}_gotReactComponent(e){if(e){this._reactComponent=e,this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate||function(){},this._reactComponent.componentWillUpdate=this._onUpdate.bind(this);var t=this._container.getState();t&&this._reactComponent.setState(t)}}_destroy(){this._container.layoutManager.removeReactChild(this._key(),this._portalComponent),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)}_onUpdate(e,t){var r;this._container.setState(t),(r=this._originalComponentWillUpdate)===null||r===void 0||r.call(this._reactComponent,e,t)}_getReactClass(){var e=this._container._config.component;if(!e)throw new Error("No react component name. type: react-component needs a field `component`");var t=this._container.layoutManager.getComponent(e)||this._container.layoutManager.getFallbackComponent();if(!t)throw new Error('React component "'+e+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return t}_getReactComponent(){var e={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},t=M.extend(e,this._container._config.props);return H.createElement(this._reactClass,t)}}var Rr=["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"],Ug=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function Gi(n){if(Rr.length>36)throw new Error("Too many keys in config minifier map");var e={};return qi(n,e,"_min"),e}function _i(n){if(Rr.length>36)throw new Error("Too many keys in config minifier map");var e={};return qi(n,e,"_max"),e}function qi(n,e,t){var r=t==="_min"?Vg:Kg;for(var i in n)if(n.hasOwnProperty(i)){var o=Array.isArray(n)?n[Number.parseInt(i,10)]:n[i];if(typeof o=="object"&&o!=null){var a=o instanceof Array?[]:{};if(Array.isArray(e))e[Number.parseInt(i,10)]=a;else{var s=r(i,Rr);e[s]=a}qi(o,a,t)}else{var l=r(o,Ug);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var d=r(i,Rr);e[d]=l}}}}function Vg(n,e){if(typeof n=="string"&&n.length===1)return"___"+n;var t=e.indexOf(n);return t===-1?n:t.toString(36)}function Kg(n,e){return typeof n=="string"&&n.length===1?e[parseInt(n,36)]:typeof n=="string"&&n.substr(0,3)==="___"?n[3]:n}function hi(n,e,t){return e=zg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zg(n){var e=Gg(n,"string");return typeof e=="symbol"?e:String(e)}function Gg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Pi{constructor(e,t){hi(this,"name",void 0),hi(this,"origin",void 0),hi(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function br(n,e,t){return e=qg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qg(n){var e=Xg(n,"string");return typeof e=="symbol"?e:String(e)}function Xg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}let Zg=class extends ct{constructor(e){super(),br(this,"_layoutManager",void 0),br(this,"_dontPropagateToParent",void 0),br(this,"_childEventSource",void 0),br(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(ct.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),M(window).on("gl_child_event",this._boundOnEventFromChild)}_onEventFromThis(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this._layoutManager.isSubWindow&&t[0]!==this._dontPropagateToParent&&this._propagateToParent(t),this._propagateToChildren(t),this._dontPropagateToParent=null,this._childEventSource=null}_$onEventFromParent(e){this._dontPropagateToParent=e[0],this.emit.apply(this,e)}_onEventFromChild(e){this._childEventSource=e.originalEvent.__gl,this.emit.apply(this,e.originalEvent.__glArgs)}_propagateToParent(e){var t,r="gl_child_event",i=(t=window.opener)===null||t===void 0?void 0:t.document.createEvent("HTMLEvents");i.initEvent(r,!0,!0),i.eventName=r,i.__glArgs=e,i.__gl=this._layoutManager,window.opener.dispatchEvent(i)}_propagateToChildren(e){for(var t=0;t<this._layoutManager.openPopouts.length;t++){var r=this._layoutManager.openPopouts[t].getGlInstance();r&&r!==this._childEventSource&&r.eventHub._$onEventFromParent(e)}}destroy(){M(window).off("gl_child_event",this._boundOnEventFromChild)}};const Bl=Zg,Yg=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:Pi,DragListener:ir,EventEmitter:ct,EventHub:Bl,ReactComponentHandler:Hl,animFrame:Ki,filterXss:kg,getHashValue:jl,getQueryStringParam:$l,getUniqueId:Fr,minifyConfig:Gi,removeFromArray:Rg,stripTags:zi,unminifyConfig:_i},Symbol.toStringTag,{value:"Module"}));function Rt(n,e,t){return e=Qg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Qg(n){var e=Jg(n,"string");return typeof e=="symbol"?e:String(e)}function Jg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Wl extends ct{constructor(e,t,r,i,o){super(),Rt(this,"isInitialised",!1),Rt(this,"_config",void 0),Rt(this,"_dimensions",void 0),Rt(this,"_parentId",void 0),Rt(this,"_indexInParent",void 0),Rt(this,"_layoutManager",void 0),Rt(this,"_popoutWindow",null),Rt(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=r,this._indexInParent=i,this._layoutManager=o,this._createWindow()}toConfig(){var e,t,r,i,o,a,s,l,d,h,c;if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");return{dimensions:{width:(e=this.getGlInstance())===null||e===void 0?void 0:e.width,height:(t=this.getGlInstance())===null||t===void 0?void 0:t.height,left:(r=(i=(o=this._popoutWindow)===null||o===void 0?void 0:o.screenX)!==null&&i!==void 0?i:(a=this._popoutWindow)===null||a===void 0?void 0:a.screenLeft)!==null&&r!==void 0?r:0,top:(s=(l=(d=this._popoutWindow)===null||d===void 0?void 0:d.screenY)!==null&&l!==void 0?l:(h=this._popoutWindow)===null||h===void 0?void 0:h.screenTop)!==null&&s!==void 0?s:0},content:(c=this.getGlInstance())===null||c===void 0?void 0:c.toConfig().content,parentId:this._parentId,indexInParent:this._indexInParent}}getGlInstance(){var e;return(e=this._popoutWindow)===null||e===void 0?void 0:e.__glInstance}getWindow(){return this._popoutWindow}close(){if(this.getGlInstance()){var e;(e=this.getGlInstance())===null||e===void 0||e._$closeWindow()}else try{var t;(t=this.getWindow())===null||t===void 0||t.close()}catch{}}popIn(){var e;this._indexInParent;var t=null,r=null;if(this._parentId){var i;if(t=M.extend(!0,{},(i=this.getGlInstance())===null||i===void 0?void 0:i.toConfig()).content[0],r=this._layoutManager.root.getItemsById(this._parentId)[0],!r){var o;((o=this._layoutManager.root.contentItems.length)!==null&&o!==void 0?o:0)>0?r=this._layoutManager.root.contentItems[0]:r=this._layoutManager.root}}t&&((e=r)===null||e===void 0||e.addChild(t,this._indexInParent),this.close())}_createWindow(){var e=this._createUrl(),t=Math.floor(Math.random()*1e6).toString(36),r=this._serializeWindowOptions({width:this._dimensions.width,height:this._dimensions.height,innerWidth:this._dimensions.width,innerHeight:this._dimensions.height,menubar:"no",toolbar:"no",location:"no",personalbar:"no",resizable:"yes",scrollbars:"no",status:"no"});if(this._popoutWindow=window.open(e,t,r),!this._popoutWindow)if(this._layoutManager.config.settings.blockedPopoutsThrowError===!0){var i=new Error("Popout blocked");throw i.type="popoutBlocked",i}else return;M(this._popoutWindow).on("load",this._positionWindow.bind(this)).on("unload beforeunload",this._onClose.bind(this));var o=window.setInterval(()=>{var a;(a=this._popoutWindow)!==null&&a!==void 0&&a.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),window.clearInterval(o))},10)}_serializeWindowOptions(e){var t=[],r;for(r in e)t.push(r+"="+e[r]);return t.join(",")}_createUrl(){var e={content:this._config},t="gl-window-config-"+Fr();e=Gi(e);try{localStorage.setItem(t,JSON.stringify(e))}catch(i){throw new Error("Error while writing to localStorage "+i.toString())}var r=document.location.href.split("?");return r.length===1?r[0]+"?gl-window="+t:document.location.href+"&gl-window="+t}_positionWindow(){var e,t;(e=this._popoutWindow)===null||e===void 0||e.moveTo(this._dimensions.left,this._dimensions.top),(t=this._popoutWindow)===null||t===void 0||t.focus()}_onInitialised(){var e;this.isInitialised=!0,(e=this.getGlInstance())===null||e===void 0||e.on("popIn",this.popIn,this),this.emit("initialised")}_onClose(){setTimeout(this.emit.bind(this,"closed"),50)}}function Pe(n,e,t){return e=ep(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ep(n){var e=tp(n,"string");return typeof e=="symbol"?e:String(e)}function tp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class mn extends ct{constructor(e,t,r,i,o,a){var s,l,d,h,c,f,v,p;if(super(),Pe(this,"_dragListener",void 0),Pe(this,"_layoutManager",void 0),Pe(this,"_contentItem",void 0),Pe(this,"_originalParent",void 0),Pe(this,"_area",null),Pe(this,"_lastValidArea",null),Pe(this,"_minX",void 0),Pe(this,"_maxX",void 0),Pe(this,"_minY",void 0),Pe(this,"_maxY",void 0),Pe(this,"_width",void 0),Pe(this,"_height",void 0),Pe(this,"_sided",void 0),Pe(this,"element",void 0),Pe(this,"childElementContainer",void 0),Pe(this,"_proxyTab",void 0),this._dragListener=r,this._layoutManager=i,this._contentItem=o,this._originalParent=a,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var g,y;this._layoutManager.tabDropPlaceholder.width((g=this._contentItem.tab.element.outerWidth(!0))!==null&&g!==void 0?g:0),this._layoutManager.tabDropPlaceholder.height((y=this._contentItem.tab.element.outerHeight(!0))!==null&&y!==void 0?y:0)}if(this.element=M(mn._template),a&&a._side&&(this._sided=a._sided,this.element.addClass("lm_"+a._side),["right","bottom"].indexOf(a._side.toString())>=0&&this.element.find(".lm_content").after(this.element.find(".lm_header"))),this.element.css({left:e,top:t}),this._proxyTab=this.element.find(".lm_tab"),this._proxyTab.attr("title",zi((s=this._contentItem.config.title)!==null&&s!==void 0?s:"")),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(),M(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var P,O;this._layoutManager.tabDropPlaceholder.width((P=this._proxyTab.outerWidth(!0))!==null&&P!==void 0?P:0),this._layoutManager.tabDropPlaceholder.height((O=this._proxyTab.outerHeight(!0))!==null&&O!==void 0?O:0)}var _=this._layoutManager.container.offset();this._minX=(d=_?.left)!==null&&d!==void 0?d:0,this._minY=(h=_?.top)!==null&&h!==void 0?h:0,this._maxX=((c=this._layoutManager.container.width())!==null&&c!==void 0?c:0)+this._minX,this._maxY=((f=this._layoutManager.container.height())!==null&&f!==void 0?f:0)+this._minY,this._width=(v=this.element.width())!==null&&v!==void 0?v:0,this._height=(p=this.element.height())!==null&&p!==void 0?p:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,r){var i,o,a=(i=r.pageX)!==null&&i!==void 0?i:0,s=(o=r.pageY)!==null&&o!==void 0?o:0,l=a>this._minX&&a<this._maxX&&s>this._minY&&s<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(a,s)}_setDropPosition(e,t){this.element.css({left:e,top:t}),this._area=this._layoutManager._$getArea(e,t),this._area!==null&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(e,t,this._area))}_onDrop(){var e;(e=this._layoutManager.dropTargetIndicator)===null||e===void 0||e.hide(),this._area!==null?this._area.contentItem._$onDrop(this._contentItem,this._area):this._lastValidArea!==null?this._lastValidArea.contentItem._$onDrop(this._contentItem,this._lastValidArea):this._originalParent?this._originalParent.addChild(this._contentItem):this._contentItem._$destroy(),this._dragListener.off("drag",this._onDrag,this),this._dragListener.off("dragStop",this._onDrop,this),this.element.remove(),this._layoutManager.emit("itemDropped",this._contentItem)}_updateTree(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(null)}_setDimensions(){var e=this._layoutManager.config.dimensions,t=e.dragProxyWidth,r=e.dragProxyHeight;this.element.width(t),this.element.height(r),t-=this._sided?e.headerHeight:0,r-=this._sided?0:e.headerHeight,this.childElementContainer.width(t),this.childElementContainer.height(r),this._contentItem.element.width(t),this._contentItem.element.height(r),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}Pe(mn,"_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 yr(n,e,t){return e=np(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function np(n){var e=rp(n,"string");return typeof e=="symbol"?e:String(e)}function rp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ul{constructor(e,t,r){yr(this,"_element",void 0),yr(this,"_itemConfig",void 0),yr(this,"_layoutManager",void 0),yr(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=r,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new ir(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this),this._dragListener}_onDragStart(e,t){var r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(M.extend(!0,{},r));new mn(e,t,this._dragListener,this._layoutManager,i,null)}}function Cr(n,e,t){return e=ip(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ip(n){var e=op(n,"string");return typeof e=="symbol"?e:String(e)}function op(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Vl{constructor(e,t,r){Cr(this,"_element",M(window)),Cr(this,"_itemConfig",void 0),Cr(this,"_layoutManager",void 0),Cr(this,"_dragListener",void 0),this._itemConfig=e,this._layoutManager=t,this._createDragListener(r)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&(this._dragListener=new ir(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._destroy,this),this._dragListener.onMouseDown(e),this._dragListener._startDrag())}_destroy(){this._dragListener=void 0,this._element=void 0,this._itemConfig=void 0,this._layoutManager=void 0}_onDragStart(e,t){if(!(!this._dragListener||!this._layoutManager)){var r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(M.extend(!0,{},r));new mn(e,t,this._dragListener,this._layoutManager,i,null)}}}function Kl(n,e,t){return e=ap(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ap(n){var e=sp(n,"string");return typeof e=="symbol"?e:String(e)}function sp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class or{constructor(){Kl(this,"element",M(or._template)),M(document.body).append(this.element)}destroy(){this.element.remove()}highlightArea(e){this.element.css({left:e.x1,top:e.y1,width:Math.floor(e.x2-e.x1),height:Math.floor(e.y2-e.y1)}).show()}hide(){this.element.hide()}}Kl(or,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function ci(n,e,t){return e=lp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function lp(n){var e=dp(n,"string");return typeof e=="symbol"?e:String(e)}function dp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Wn{constructor(e,t,r,i){ci(this,"element",void 0),ci(this,"_header",void 0),ci(this,"_action",void 0),this._header=e,this.element=M('<li class="'+r+'" title="'+t+'"></li>'),this._header.on("destroy",this._$destroy,this),this._action=i,this.element.on("click",this._action),this._header.controlsContainer.append(this.element)}_$destroy(){this.element.off(),this.element.remove()}}function up(n,e,t){return e=hp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function hp(n){var e=cp(n,"string");return typeof e=="symbol"?e:String(e)}function cp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class mp extends Error{constructor(e,t){super(),up(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const on=mp,fp=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:on},Symbol.toStringTag,{value:"Module"}));function Se(n,e,t){return e=vp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function vp(n){var e=gp(n,"string");return typeof e=="symbol"?e:String(e)}function gp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function an(n){return n.isStack}function qe(n){return n.isComponent}function zl(n){return n.isRoot}class Ie extends ct{constructor(e,t,r,i){super(),Se(this,"config",void 0),Se(this,"type",void 0),Se(this,"contentItems",void 0),Se(this,"parent",void 0),Se(this,"layoutManager",void 0),Se(this,"element",void 0),Se(this,"childElementContainer",void 0),Se(this,"componentName",void 0),Se(this,"isInitialised",!1),Se(this,"isMaximised",!1),Se(this,"isRoot",!1),Se(this,"isRow",!1),Se(this,"isColumn",!1),Se(this,"isStack",!1),Se(this,"isComponent",!1),Se(this,"tab",void 0),Se(this,"_pendingEventPropagations",void 0),Se(this,"_throttledEvents",void 0),this.element=i,this.config=this._extendItemNode(t),this.type=t.type,this.contentItems=[],this.parent=r,this.layoutManager=e,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(ct.ALL_EVENT,this._propagateEvent,this),t.content&&this._createContentItems(t)}callDownwards(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;r!==!0&&i!==!0&&this[e].apply(this,t);for(var o=0;o<this.contentItems.length;o++)this.contentItems[o].callDownwards(e,t,r);r===!0&&i!==!0&&this[e].apply(this,t)}removeChild(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=this.contentItems.indexOf(e);if(i===-1)throw new Error("Can't remove child item. Unknown content item");if(r!==!0&&this.contentItems[i]._$destroy(),this.contentItems.splice(i,1),(t=this.config.content)===null||t===void 0||t.splice(i,1),this.contentItems.length>0)this.callDownwards("setSize");else if(this.type!=="root"&&this.config.isClosable){var o;(o=this.parent)===null||o===void 0||o.removeChild(this)}}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.splice(t,0,e),this.config.content===void 0&&(this.config.content=[]),this.config.content.splice(t,0,e.config),e.parent=this,e.parent.isInitialised===!0&&e.isInitialised===!1&&e._$init()}replaceChild(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;t=this.layoutManager._$normalizeContentItem(t);var i=this.contentItems.indexOf(e),o=e.element[0].parentNode;if(i===-1)throw new Error("Can't replace child. oldChild is not child of this");o?.replaceChild(t.element[0],e.element[0]),r===!0&&(e.parent=null,e._$destroy()),this.contentItems[i]=t,t.parent=this,an(this)&&(this.header.tabs[i].contentItem=t),t.parent.isInitialised===!0&&t.isInitialised===!1&&t._$init(),this.callDownwards("setSize")}remove(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}popout(){var e=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),e}toggleMaximise(e){e&&e.preventDefault(),this.isMaximised===!0?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximised=!this.isMaximised,this.emitBubblingEvent("stateChanged")}select(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))}deselect(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))}setTitle(e){this.config.title=e,this.emit("titleChanged",e),this.emitBubblingEvent("stateChanged")}hasId(e){if(this.config.id){if(typeof this.config.id=="string")return this.config.id===e;if(this.config.id instanceof Array)return this.config.id.indexOf(e)!==-1}else return!1}addId(e){this.hasId(e)||(this.config.id?typeof this.config.id=="string"?this.config.id=[this.config.id,e]:this.config.id instanceof Array&&this.config.id.push(e):this.config.id=e)}removeId(e){if(!this.hasId(e))throw new Error("Id not found");if(typeof this.config.id=="string")delete this.config.id;else if(this.config.id instanceof Array){var t=this.config.id.indexOf(e);this.config.id.splice(t,1)}}getItemsByFilter(e){var t=[],r=function i(o){for(var a=0;a<o.contentItems.length;a++)e(o.contentItems[a])===!0&&t.push(o.contentItems[a]),i(o.contentItems[a])};return r(this),t}getItemsById(e){return this.getItemsByFilter(function(t){return t.config.id instanceof Array?t.config.id.indexOf(e)!==-1:t.config.id===e})}getItemsByType(e){return this._$getItemsByProperty("type",e)}getComponentsByName(e){for(var t=this._$getItemsByProperty("componentName",e),r=[],i=0;i<t.length;i++)r.push(t[i].instance);return r}_$getItemsByProperty(e,t){return this.getItemsByFilter(function(r){return r[e]===t})}_$setParent(e){this.parent=e}_$highlightDropZone(e,t,r){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(r)}_$onDrop(e,t){this.addChild(e)}_$hide(){this._callOnActiveComponents("hide"),this.element.hide(),this.layoutManager.updateSize()}_$show(){this._callOnActiveComponents("show"),this.element.show(),this.layoutManager.updateSize()}_callOnActiveComponents(e){for(var t=this.getItemsByType("stack"),r=null,i=0;i<t.length;i++)r=t[i].getActiveContentItem(),r&&qe(r)&&r.container[e]()}_$destroy(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")}_$getArea(e){var t,r,i;e=e||this.element;var o=(t=e.offset())!==null&&t!==void 0?t:{left:0,top:0},a=(r=e.width())!==null&&r!==void 0?r:0,s=(i=e.height())!==null&&i!==void 0?i:0;return{x1:o.left,y1:o.top,x2:o.left+a,y2:o.top+s,surface:a*s,contentItem:this,side:""}}_$init(){this.setSize();for(var e=0;e<this.contentItems.length;e++){var t;(t=this.childElementContainer)===null||t===void 0||t.append(this.contentItems[e].element)}this.isInitialised=!0,this.emitBubblingEvent("itemCreated"),this.emitBubblingEvent(this.type+"Created")}emitBubblingEvent(e){var t=new Pi(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new on("content must be an Array",e);for(var r=0;r<e.content.length;r++)t=this.layoutManager.createContentItem(e.content[r],this),this.contentItems.push(t)}_extendItemNode(e){for(var[t,r]of Object.entries(kl)){var i=t;e[i]===void 0&&(e[i]=r)}return e}_propagateEvent(e,t){t instanceof Pi&&t.isPropagationStopped===!1&&this.isInitialised===!0&&(this.isRoot===!1&&this.parent?this.parent.emit.apply(this.parent,[e,t]):this._scheduleEventPropagationToLayoutManager(e,t))}_scheduleEventPropagationToLayoutManager(e,t){this._throttledEvents.indexOf(e)===-1?this.layoutManager.emit(e,t.origin):this._pendingEventPropagations[e]!==!0&&(this._pendingEventPropagations[e]=!0,Ki(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function Ln(n,e,t){return e=pp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pp(n){var e=bp(n,"string");return typeof e=="symbol"?e:String(e)}function bp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Gl extends Ie{constructor(e,t,r){var i;Object.entries((i=e.config.settings.defaultComponentConfig)!==null&&i!==void 0?i:{}).forEach(s=>{var[l,d]=s;t[l]===void 0&&(t[l]=d)}),super(e,t,r,M()),Ln(this,"config",void 0),Ln(this,"componentName",void 0),Ln(this,"container",void 0),Ln(this,"parent",void 0),Ln(this,"instance",void 0),this.config=t,this.parent=r;var o=e.getComponent(this.config.componentName)||e.getFallbackComponent(),a=M.extend(!0,{},this.config.componentState||{});if(o==null)throw new on('Unknown component "'+this.config.componentName+'"');a.componentName=this.config.componentName,this.componentName=this.config.componentName,this.config.title===""&&(this.config.title=this.config.componentName),this.isComponent=!0,this.container=new Ei(this.config,this,e),this.instance=new o(this.container,a),this.element=this.container._element}close(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}setSize(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())}_$init(){Ie.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),Ie.prototype._$hide.call(this)}_$show(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),Ie.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),Ie.prototype._$destroy.call(this)}_$getArea(){return null}}function et(n,e,t){return e=yp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yp(n){var e=Cp(n,"string");return typeof e=="symbol"?e:String(e)}function Cp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Jn extends Ie{constructor(e,t,r,i){super(t,r,i,M('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),et(this,"isRow",void 0),et(this,"isColumn",void 0),et(this,"childElementContainer",void 0),et(this,"parent",void 0),et(this,"_splitter",[]),et(this,"_splitterSize",void 0),et(this,"_splitterGrabSize",void 0),et(this,"_isColumn",void 0),et(this,"_dimension",void 0),et(this,"_splitterPosition",null),et(this,"_splitterMinPosition",null),et(this,"_splitterMaxPosition",null),this.parent=i,this.isRow=!e,this.isColumn=e,this.childElementContainer=this.element,this._splitterSize=t.config.dimensions.borderWidth,this._splitterGrabSize=t.config.dimensions.borderGrabWidth,this._isColumn=e,this._dimension=e?"height":"width",this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null}addChild(e,t,r){var i,o,a,s;if(e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.length>0?(s=this._createSplitter(Math.max(0,t-1)).element,t>0?(this.contentItems[t-1].element.after(s),s.after(e.element)):(this.contentItems[0].element.before(s),s.before(e.element))):this.childElementContainer.append(e.element),Ie.prototype.addChild.call(this,e,t),i=1/this.contentItems.length*100,r===!0){this.emitBubblingEvent("stateChanged");return}for(a=0;a<this.contentItems.length;a++)if(this.contentItems[a]===e)e.config[this._dimension]=i;else{var l;o=((l=this.contentItems[a].config[this._dimension])!==null&&l!==void 0?l:0)*(100-i)/100,this.contentItems[a].config[this._dimension]=o}this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}removeChild(e,t){var r,i=(r=e.config[this._dimension])!==null&&r!==void 0?r:0,o=this.contentItems.indexOf(e),a=Math.max(o-1,0),s,l;if(o===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[a]&&(this._splitter[a]._$destroy(),this._splitter.splice(a,1)),s=0;s<this.contentItems.length;s++)if(this.contentItems[s]!==e){var d;this.contentItems[s].config[this._dimension]=((d=this.contentItems[s].config[this._dimension])!==null&&d!==void 0?d:0)+i/(this.contentItems.length-1)}if(Ie.prototype.removeChild.call(this,e,t),this.contentItems.length===1&&this.config.isClosable===!0){var h;l=this.contentItems[0],this.contentItems=[],(h=this.parent)===null||h===void 0||h.replaceChild(this,l,!0)}else this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}replaceChild(e,t){var r=e.config[this._dimension];super.replaceChild(e,t),t.config[this._dimension]=r,this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(){this.contentItems.length>0&&(this._calculateRelativeSizes(),this._setAbsoluteSizes()),this.emitBubblingEvent("stateChanged"),this.emit("resize")}_$init(){if(this.isInitialised!==!0){var e;for(Ie.prototype._$init.call(this),e=0;e<this.contentItems.length-1;e++)this.contentItems[e].element.after(this._createSplitter(e).element)}}_setAbsoluteSizes(){var e,t=this._calculateAbsoluteSizes();for(e=0;e<this.contentItems.length;e++)t.additionalPixel-e>0&&t.itemSizes[e]++,this._isColumn?(this.contentItems[e].element.width(t.totalWidth),this.contentItems[e].element.height(t.itemSizes[e])):(this.contentItems[e].element.width(t.itemSizes[e]),this.contentItems[e].element.height(t.totalHeight))}_calculateAbsoluteSizes(){var e,t,r=(this.contentItems.length-1)*this._splitterSize,i=(e=this.element.width())!==null&&e!==void 0?e:0,o=(t=this.element.height())!==null&&t!==void 0?t:0,a=0,s=[];this._isColumn?o-=r:i-=r;for(var l=0;l<this.contentItems.length;l++){var d,h,c=this._isColumn?Math.floor(o*(((d=this.contentItems[l].config.height)!==null&&d!==void 0?d:0)/100)):Math.floor(i*(((h=this.contentItems[l].config.width)!==null&&h!==void 0?h:0)/100));a+=c,s.push(c)}var f=Math.floor((this._isColumn?o:i)-a);return{itemSizes:s,additionalPixel:f,totalWidth:i,totalHeight:o}}_calculateRelativeSizes(){for(var e=0,t=[],r=this._isColumn?"height":"width",i=0;i<this.contentItems.length;i++){var o=this.contentItems[i].config[r];o!=null?e+=o:t.push(this.contentItems[i])}if(Math.round(e)===100){this._respectMinItemWidth();return}if(Math.round(e)<100&&t.length>0){for(var a=0;a<t.length;a++)t[a].config[r]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var s=0;s<t.length;s++)t[s].config[r]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var d;this.contentItems[l].config[r]=((d=this.contentItems[l].config[r])!==null&&d!==void 0?d:0)/e*100}this._respectMinItemWidth()}_respectMinItemWidth(){var e,t=this.layoutManager.config.dimensions&&(e=this.layoutManager.config.dimensions.minItemWidth)!==null&&e!==void 0?e:0,r=[],i=0,o=0,a=0,s=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var d=this._calculateAbsoluteSizes(),h=0;h<this.contentItems.length;h++){this.contentItems[h];var c=d.itemSizes[h];c<t?(o+=t-c,l={width:t}):(i+=c-t,l={width:c},r.push(l)),s.push(l)}if(!(o===0||o>i)){var f=o/i;a=o;for(var v=0;v<r.length;v++){l=r[v];var p=Math.round((l.width-t)*f);a-=p,l.width-=p}a!==0&&(s[s.length-1].width-=a);for(var g=0;g<this.contentItems.length;g++)this.contentItems[g].config.width=s[g].width/d.totalWidth*100}}}_createSplitter(e){var t;return t=new ql(this._isColumn,this._splitterSize,this._splitterGrabSize),t.on("drag",this._onSplitterDrag.bind(this,t),this),t.on("dragStop",this._onSplitterDragStop.bind(this,t),this),t.on("dragStart",this._onSplitterDragStart.bind(this,t),this),this._splitter.splice(e,0,t),t}_getItemsForSplitter(e){var t=this._splitter.indexOf(e);if(t<0)throw new Error("Splitter not found in RowOrColumn");return{before:this.contentItems[t],after:this.contentItems[t+1]}}_getMinimumDimensions(e){for(var t=0,r=0,i=0;i<e.length;++i){var o,a;t=Math.max((o=e[i].minWidth)!==null&&o!==void 0?o:0,t),r=Math.max((a=e[i].minHeight)!==null&&a!==void 0?a:0,r)}return{horizontal:t,vertical:r}}_onSplitterDragStart(e){var t,r,i,o,a=this._getItemsForSplitter(e),s=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=a.before.config.content)!==null&&t!==void 0?t:[]),d=this._isColumn?l.vertical:l.horizontal,h=this._getMinimumDimensions((r=a.after.config.content)!==null&&r!==void 0?r:[]),c=this._isColumn?h.vertical:h.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((i=a.before.element[this._dimension]())!==null&&i!==void 0?i:0)-(d||s)),this._splitterMaxPosition=((o=a.after.element[this._dimension]())!==null&&o!==void 0?o:0)-(c||s)}_onSplitterDrag(e,t,r){var i=this._isColumn?r:t;this._splitterMaxPosition==null||this._splitterMinPosition==null||i>this._splitterMinPosition&&i<this._splitterMaxPosition&&(this._splitterPosition=i,e.element.css(this._isColumn?"top":"left",i))}_onSplitterDragStop(e){var t,r,i,o,a,s=this._getItemsForSplitter(e),l=(t=s.before.element[this._dimension]())!==null&&t!==void 0?t:0,d=(r=s.after.element[this._dimension]())!==null&&r!==void 0?r:0,h=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+d),c=((o=s.before.config[this._dimension])!==null&&o!==void 0?o:0)+((a=s.after.config[this._dimension])!==null&&a!==void 0?a:0);s.before.config[this._dimension]=h*c,s.after.config[this._dimension]=(1-h)*c,e.element.css({top:0,left:0}),Ki(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function Sa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function wa(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Sa(Object(t),!0).forEach(function(r){Ti(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Sa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ti(n,e,t){return e=Sp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Sp(n){var e=wp(n,"string");return typeof e=="symbol"?e:String(e)}function wp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Oi extends Ie{constructor(e,t,r){super(e,wa(wa({},t),{},{type:"root"}),null,M('<div class="lm_goldenlayout lm_item lm_root"></div>')),Ti(this,"childElementContainer",void 0),Ti(this,"_containerElement",void 0),this.isRoot=!0,this.type="root",this.childElementContainer=this.element,this._containerElement=r,this._containerElement.append(this.element)}addChild(e,t){if(this.contentItems.length>0)throw new Error("Root node can only have a single child");e=this.layoutManager._$normalizeContentItem(e,this),this.childElementContainer.append(e.element),super.addChild(e,t),this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(e,t){var r,i;e=typeof e>"u"?(r=this._containerElement.width())!==null&&r!==void 0?r:0:e,t=typeof t>"u"?(i=this._containerElement.height())!==null&&i!==void 0?i:0:t,this.element.width(e),this.element.height(t),this.contentItems[0]&&(this.contentItems[0].element.width(e),this.contentItems[0].element.height(t))}_$getArea(){var e=super._$getArea();if(e==null)throw new Error("Unable to get root area");return e}_$highlightDropZone(e,t,r){this.layoutManager.tabDropPlaceholder.remove(),super._$highlightDropZone(e,t,r)}_$onDrop(e,t){var r;if(qe(e)&&(r=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this),r._$init(),r.addChild(e),e=r),!this.contentItems.length)this.addChild(e);else{var{side:i}=t,o=i==="left"||i==="right"?"row":"column",a=i==="left"||i==="right"?"width":"height",s=i==="left"||i==="top",l=this.contentItems[0];if(!(l instanceof Jn)||l.type!=o){var d=this.layoutManager.createContentItem({type:o},this);this.replaceChild(l,d),d.addChild(e,s?0:void 0,!0),d.addChild(l,s?void 0:0,!0),l.config[a]=50,e.config[a]=50,d.callDownwards("setSize")}else{var h,c=l.contentItems[s?0:l.contentItems.length-1];l.addChild(e,s?0:void 0,!0),c.config[a]=((h=c.config[a])!==null&&h!==void 0?h:0)*.5,e.config[a]=c.config[a],l.callDownwards("setSize")}}}}function Ea(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function pn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ea(Object(t),!0).forEach(function(r){Ve(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ea(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ve(n,e,t){return e=Ep(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ep(n){var e=_p(n,"string");return typeof e=="symbol"?e:String(e)}function _p(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ii extends Ie{constructor(e,t,r){var i,o,a,s,l,d,h,c,f;super(e,t,r,M('<div class="lm_item lm_stack"></div>')),Ve(this,"_activeContentItem",null),Ve(this,"_header",void 0),Ve(this,"childElementContainer",M('<div class="lm_items"></div>')),Ve(this,"header",void 0),Ve(this,"parent",void 0),Ve(this,"isStack",!0),Ve(this,"_dropSegment",null),Ve(this,"_contentAreaDimensions",null),Ve(this,"_dropIndex",void 0),Ve(this,"_side",void 0),Ve(this,"_sided",!1),Ve(this,"config",void 0),this.parent=r,this.config=t;var v=e.config;this._side=!1,this._header={show:((i=v.settings)===null||i===void 0?void 0:i.hasHeaders)&&t.hasHeaders!==!1,popout:(o=v.settings)!==null&&o!==void 0&&o.showPopoutIcon?(a=v.labels)===null||a===void 0?void 0:a.popout:void 0,maximise:(s=v.settings)!==null&&s!==void 0&&s.showMaximiseIcon?(l=v.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(d=v.settings)!==null&&d!==void 0&&d.showCloseIcon?(h=v.labels)===null||h===void 0?void 0:h.close:void 0,minimise:(c=(f=v.labels)===null||f===void 0?void 0:f.minimise)!==null&&c!==void 0?c:void 0},v.header&&(this._header=pn(pn({},this._header),v.header)),t.header&&(this._header=pn(pn({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=pn(pn({},this._header),t.content[0].header)),this.header=new Nt(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,r,i,o,a=this._header.show&&(e=(t=this.layoutManager.config.dimensions)===null||t===void 0?void 0:t.headerHeight)!==null&&e!==void 0?e:0,s=((r=this.element.width())!==null&&r!==void 0?r:0)-(this._sided?a:0),l=((i=this.element.height())!==null&&i!==void 0?i:0)-(this._sided?0:a);for(this.childElementContainer.width(s),this.childElementContainer.height(l),o=0;o<this.contentItems.length;o++)this.contentItems[o].element.width(s).height(l);this.emit("resize"),this.emitBubblingEvent("stateChanged")}_$init(){if(this.isInitialised!==!0){this.header._attachWheelListener(),super._$init();for(var e=0;e<this.contentItems.length;e++)this.header.createTab(this.contentItems[e]),this.contentItems[e]._$hide();if(this.contentItems.length>0){var t=this.contentItems[this.config.activeItemIndex||0];if(!t)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(t)}}}setActiveContentItem(e){if(this.contentItems.indexOf(e)===-1)throw new Error("contentItem is not a child of this stack");this._activeContentItem!==null&&this._activeContentItem._$hide(),this._activeContentItem=e,this.header.setActiveContentItem(e),e._$show(),this.emit("activeContentItemChanged",e),this.layoutManager.emit("activeContentItemChanged",e),this.emitBubblingEvent("stateChanged")}getActiveContentItem(){return this.header.activeContentItem}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),super.addChild(e,t),this.childElementContainer.append(e.element),this.header.createTab(e,t),this.setActiveContentItem(e),this.callDownwards("setSize"),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}removeChild(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=this.contentItems.indexOf(e);super.removeChild(e,t),this.header.removeTab(e),this.header.activeContentItem===e&&(this.contentItems.length>0?this.setActiveContentItem(this.contentItems[Math.max(r-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}_$validateClosability(){for(var e=this.header._isClosable(),t=0,r=this.contentItems.length;t<r;t++){var i;if(!e)break;e=(i=this.contentItems[t].config.isClosable)!==null&&i!==void 0?i:!1}this.header._$setClosable(e)}_$destroy(){Ie.prototype._$destroy.call(this),this.header._$destroy()}_$onDrop(e){if(this._dropSegment==="header"){this._resetHeaderDropZone(),this.addChild(e,this._dropIndex);return}if(this._dropSegment==="body"){this.addChild(e);return}var t=this._dropSegment==="top"||this._dropSegment==="bottom",r=this._dropSegment==="left"||this._dropSegment==="right",i=this._dropSegment==="top"||this._dropSegment==="left",o=this.parent instanceof Jn&&(t&&this.parent.isColumn||r&&this.parent.isRow),a=t?"column":"row",s=t?"height":"width";if(qe(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(o){var d,h=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?h:h+1,!0),this.config[s]=((d=this.config[s])!==null&&d!==void 0?d:0)*.5,e.config[s]=this.config[s],this.parent.callDownwards("setSize")}else{var c,f=this.layoutManager.createContentItem({type:a},this);(c=this.parent)===null||c===void 0||c.replaceChild(this,f),f.addChild(e,i?0:void 0,!0),f.addChild(this,i?void 0:0,!0),this.config[s]=50,e.config[s]=50,f.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[r,i]of Object.entries(this._contentAreaDimensions)){var o=i.hoverArea;if(o.x1<e&&o.x2>e&&o.y1<t&&o.y2>t){r==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(r));return}}}_$getArea(){if(this.element.is(":visible")===!1)return null;var e=super._$getArea(this.header.element),t=super._$getArea(this.childElementContainer);if(e==null||t==null)return null;var r=t.x2-t.x1,i=t.y2-t.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}},this._activeContentItem&&this._activeContentItem.isComponent===!1?e:this.contentItems.length===0?(this._contentAreaDimensions.body={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}},super._$getArea(this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x1+r*.25,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x1+r*.5,y2:t.y2}},this._contentAreaDimensions.top={hoverArea:{x1:t.x1+r*.25,y1:t.y1,x2:t.x1+r*.75,y2:t.y1+i*.5},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y1+i*.5}},this._contentAreaDimensions.right={hoverArea:{x1:t.x1+r*.75,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1+r*.5,y1:t.y1,x2:t.x2,y2:t.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:t.x1+r*.25,y1:t.y1+i*.5,x2:t.x1+r*.75,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1+i*.5,x2:t.x2,y2:t.y2}},super._$getArea(this.element))}_highlightHeaderDropZone(e){var t,r,i,o,a,s,l,d,h,c,f,v,p,g,y,P,O=this.header.tabs.length;if(O===0){var _,R,U,Q,N,W,j,Y,ne=this.header.element.offset();(_=this.layoutManager.dropTargetIndicator)===null||_===void 0||_.highlightArea({x1:(R=ne?.left)!==null&&R!==void 0?R:0,x2:((U=ne?.left)!==null&&U!==void 0?U:0)+100,y1:(Q=(N=this.header.element.offset())===null||N===void 0?void 0:N.top)!==null&&Q!==void 0?Q:0,y2:((W=(j=this.header.element.offset())===null||j===void 0?void 0:j.top)!==null&&W!==void 0?W:0)+((Y=this.header.element.innerHeight())!==null&&Y!==void 0?Y:0)});return}var F=this.header.tabsContainer,q=(t=F.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),K=(r=this.layoutManager.tabDropPlaceholder.get(0))===null||r===void 0?void 0:r.getBoundingClientRect();if(!(!q||!K)){e<q.left?e=q.left+1:e>q.right&&(e=q.right-1);var A,V;if(!(K.left<e&&e<K.right)){for(var z=0;z<O;z++){var me;if(A=this.header.tabs[z].element,V=(me=A.get(0))===null||me===void 0?void 0:me.getBoundingClientRect(),V&&V.left<e&&e<V.right){this._dropIndex=z;break}}if(A&&V&&e<V.left+V.width*.5)A.before(this.layoutManager.tabDropPlaceholder);else if(A){var je;this._dropIndex=Math.min(((je=this._dropIndex)!==null&&je!==void 0?je:0)+1,O),A.after(this.layoutManager.tabDropPlaceholder)}}var De=(i=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&i!==void 0?i:0;De=Math.max(De,(a=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&a!==void 0?a:0);var b=De+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);b=Math.min(b,((d=(h=this.header.tabsContainer.offset())===null||h===void 0?void 0:h.left)!==null&&d!==void 0?d:0)+((c=this.header.tabsContainer.innerWidth())!==null&&c!==void 0?c:0)),(f=this.layoutManager.dropTargetIndicator)===null||f===void 0||f.highlightArea({x1:De,x2:b,y1:(v=(p=this.header.element.offset())===null||p===void 0?void 0:p.top)!==null&&v!==void 0?v:0,y2:((g=(y=this.header.element.offset())===null||y===void 0?void 0:y.top)!==null&&g!==void 0?g:0)+((P=this.header.element.innerHeight())!==null&&P!==void 0?P:0)})}}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){var e=["right","left","bottom"].some(r=>r===this._header.show)?this._header.show:void 0;if(this.header.element.toggle(!!this._header.show),!!e&&(this._side=e,this._sided=["right","left"].indexOf(this._side.toString())>=0,this.element.removeClass("lm_left lm_right lm_bottom"),this._side&&this.element.addClass("lm_"+this._side),this.element.find(".lm_header").length&&this.childElementContainer)){var t=["right","bottom"].indexOf(this._side.toString())>=0?"before":"after";this.header.element[t](this.childElementContainer),this.callDownwards("setSize")}}_highlightBodyDropZone(e){var t,r,i=(t=this._contentAreaDimensions)===null||t===void 0||(r=t[e])===null||r===void 0?void 0:r.highlightArea;if(i){var o;(o=this.layoutManager.dropTargetIndicator)===null||o===void 0||o.highlightArea(i)}this._dropSegment=e}}const Pp=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:Ie,Component:Gl,ContentItem:Ie,Root:Oi,RowOrColumn:Jn,Stack:Ii,isComponent:qe,isRoot:zl,isStack:an},Symbol.toStringTag,{value:"Module"}));function Ot(n,e,t){return e=Tp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Tp(n){var e=Op(n,"string");return typeof e=="symbol"?e:String(e)}function Op(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ar{constructor(e,t){var r;Ot(this,"header",void 0),Ot(this,"contentItem",void 0),Ot(this,"element",M(ar._template)),Ot(this,"titleElement",void 0),Ot(this,"closeElement",void 0),Ot(this,"isActive",!1),Ot(this,"_layoutManager",void 0),Ot(this,"_dragListener",void 0),this.header=e,this.contentItem=t,this.titleElement=this.element.find(".lm_title"),this.closeElement=this.element.find(".lm_close_tab"),this.closeElement[t.config.isClosable?"show":"hide"](),this.setTitle(t.config.title),this.contentItem.on("titleChanged",this.setTitle,this),this._layoutManager=this.contentItem.layoutManager,(r=this._layoutManager.config.settings)!==null&&r!==void 0&&r.reorderEnabled&&t.config.reorderEnabled&&(this._dragListener=new ir(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),qe(this.contentItem)&&(this.contentItem.container._contentElement.on("focusin",this._onTabContentFocusIn).on("focusout",this._onTabContentFocusOut),this.contentItem.container.tab=this,this.contentItem.container.emit("tab",this))}setTitle(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";this.titleElement.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),qe(this.contentItem)&&(this.contentItem.container._contentElement.off(),this.contentItem.container._contentElement[0].removeEventListener("click",this._onTabContentFocusIn,!0)),this._dragListener&&(this.contentItem.off("destroy",this._dragListener.destroy,this._dragListener),this._dragListener.off("dragStart",this._onDragStart),this._dragListener=void 0),this.element.remove()}_onDragStart(e,t){var r;(r=this.contentItem.parent)!==null&&r!==void 0&&r.isMaximised&&this.contentItem.parent.toggleMaximise(),this._dragListener&&new mn(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(){M(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin")}_onTabContentFocusOut(){qe(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.element.removeClass("lm_focusin")}_onTabClick(e){if(!e||e.button===0){var t,r=this.header.parent.getActiveContentItem();this.contentItem!==r&&qe(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):qe(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),qe(this.contentItem)&&this.contentItem.container.emit("tabClicked",e),this.header._hideAdditionalTabsDropdown(),(t=this.element.get(0))===null||t===void 0||t.scrollIntoView({inline:"nearest"})}else e.button===1&&this.contentItem.config.isClosable&&this._onCloseClick(e)}_onCloseClick(e){e.stopPropagation(),qe(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onCloseMousedown(e){e.stopPropagation()}}Ot(ar,"_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 ie(n,e,t){return e=Ip(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ip(n){var e=Dp(n,"string");return typeof e=="symbol"?e:String(e)}function Dp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Nt extends ct{constructor(e,t){var r,i;super(),ie(this,"layoutManager",void 0),ie(this,"element",M(Nt._template)),ie(this,"tabsContainer",void 0),ie(this,"tabDropdownContainer",void 0),ie(this,"tabDropdownSearch",void 0),ie(this,"tabDropdownList",null),ie(this,"controlsContainer",void 0),ie(this,"parent",void 0),ie(this,"tabs",[]),ie(this,"activeContentItem",null),ie(this,"closeButton",null),ie(this,"tabDropdownButton",null),ie(this,"tabNextButton",M(Nt._nextButtonTemplate)),ie(this,"tabPreviousButton",M(Nt._previousButtonTemplate)),ie(this,"holdTimer",null),ie(this,"rAF",null),ie(this,"CLICK_TIMEOUT",500),ie(this,"START_SPEED",.01),ie(this,"ACCELERATION",5e-4),ie(this,"PADDING",10),ie(this,"SCROLL_LEFT","left"),ie(this,"SCROLL_RIGHT","right"),ie(this,"isDraggingTab",!1),ie(this,"isOverflowing",!1),ie(this,"isDropdownShown",!1),ie(this,"dropdownKeyIndex",0),ie(this,"_lastVisibleTabIndex",-1),ie(this,"_tabControlOffset",void 0),this.layoutManager=e,(r=this.layoutManager.config.settings)!==null&&r!==void 0&&r.selectionEnabled&&(this.element.addClass("lm_selectable"),this.element.on("click",this._onHeaderClick.bind(this))),this.tabsContainer=this.element.find(".lm_tabs"),this.tabDropdownContainer=this.element.find(".lm_tabdropdown_list"),this.tabDropdownContainer.hide(),this.tabDropdownSearch=this.element.find(".lm_tabdropdown_search input"),this._handleFilterInput=this._handleFilterInput.bind(this),this._handleFilterKeydown=this._handleFilterKeydown.bind(this),this.tabDropdownSearch.on("input",this._handleFilterInput),this.tabDropdownSearch.on("keydown",this._handleFilterKeydown),this.controlsContainer=this.element.find(".lm_controls"),this.parent=t,this.parent.on("resize",this._updateTabSizes,this),this._handleItemPickedUp=this._handleItemPickedUp.bind(this),this._handleItemDropped=this._handleItemDropped.bind(this),this._handleNextMouseEnter=this._handleNextMouseEnter.bind(this),this._handleNextMouseLeave=this._handleNextMouseLeave.bind(this),this._handlePreviousMouseEnter=this._handlePreviousMouseEnter.bind(this),this._handlePreviousMouseLeave=this._handlePreviousMouseLeave.bind(this),this._handleScrollRepeat=this._handleScrollRepeat.bind(this),this._handleNextButtonMouseDown=this._handleNextButtonMouseDown.bind(this),this._handlePreviousButtonMouseDown=this._handlePreviousButtonMouseDown.bind(this),this._handleScrollButtonMouseDown=this._handleScrollButtonMouseDown.bind(this),this._handleScrollButtonMouseUp=this._handleScrollButtonMouseUp.bind(this),this._handleScrollEvent=this._handleScrollEvent.bind(this),this.tabNextButton.on("mousedown",this._handleNextButtonMouseDown),this.tabPreviousButton.on("mousedown",this._handlePreviousButtonMouseDown),this.tabsContainer.on("scroll",this._handleScrollEvent),this.layoutManager.on("itemPickedUp",this._handleItemPickedUp),this.layoutManager.on("itemDropped",this._handleItemDropped),this.tabsContainer.before(this.tabPreviousButton),this.tabPreviousButton=this.tabPreviousButton.find(">:first-child"),this.tabPreviousButton.hide(),this._showAdditionalTabsDropdown=this._showAdditionalTabsDropdown.bind(this),this._hideAdditionalTabsDropdown=this._hideAdditionalTabsDropdown.bind(this),this._tabControlOffset=(i=this.layoutManager.config.settings)===null||i===void 0?void 0:i.tabControlOffset,this._createControls()}createTab(e,t){for(var r=0;r<this.tabs.length;r++)if(this.tabs[r].contentItem===e)return;var i=new ar(this,e);if(this.tabs.length===0){this.tabs.push(i),this.tabsContainer.append(i.element);return}t===void 0&&(t=this.tabs.length),t>0?this.tabs[t-1].element.after(i.element):this.tabs[0].element.before(i.element),this.tabs.splice(t,0,i),this._updateTabSizes()}removeTab(e){for(var t=0;t<this.tabs.length;t++)if(this.tabs[t].contentItem===e){this.tabs[t]._$destroy(),this.tabs.splice(t,1);return}throw new Error("contentItem is not controlled by this header")}setActiveContentItem(e){for(var t,r,i,o,a=0;a<this.tabs.length;a++)o=this.tabs[a].contentItem===e,this.tabs[a].setActive(o),o===!0&&(this.activeContentItem=e,this.parent.config.activeItemIndex=a);(t=this.tabs[(i=this.parent.config.activeItemIndex)!==null&&i!==void 0?i:0].element.get(0))===null||t===void 0||(r=t.scrollIntoView)===null||r===void 0||r.call(t,{inline:"nearest"}),this._hideAdditionalTabsDropdown(),this._updateTabSizes(),this.parent.emitBubblingEvent("stateChanged")}position(e){var t=this.parent._header.show;return t&&!this.parent._side&&(t="top"),e!==void 0&&this.parent._header.show!==e&&(this.parent._header.show=e,this.parent._setupHeaderPosition()),t}_attachWheelListener(){var e;(e=this.tabsContainer.get(0))===null||e===void 0||e.addEventListener("wheel",this._handleWheelEvent,{passive:!0})}_detachWheelListener(){var e;(e=this.tabsContainer.get(0))===null||e===void 0||e.removeEventListener("wheel",this._handleWheelEvent)}_handleWheelEvent(e){var t=e.currentTarget;if(t instanceof HTMLElement){var r=Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX;if(e.deltaMode===WheelEvent.DOM_DELTA_PAGE){var i;r*=(i=this.tabsContainer.innerWidth())!==null&&i!==void 0?i:1}else e.deltaMode===WheelEvent.DOM_DELTA_LINE&&(r*=100/3);t.scrollLeft+=Math.round(r)}}_handleScrollEvent(){this._checkScrollArrows()}_handleItemPickedUp(){this.isDraggingTab=!0,this.isDropdownShown&&this._hideAdditionalTabsDropdown(),this.controlsContainer.on("mouseenter",this._handleNextMouseEnter),this.tabPreviousButton.on("mouseenter",this._handlePreviousMouseEnter)}_handleItemDropped(){var e;this.isDraggingTab=!1,window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.controlsContainer.off("mouseenter",this._handleNextMouseEnter),this.controlsContainer.off("mouseleave",this._handleNextMouseLeave),this.tabPreviousButton.off("mouseenter",this._handlePreviousMouseEnter),this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextMouseEnter(){var e;this.controlsContainer.on("mouseleave",this._handleNextMouseLeave),this._handleScrollRepeat(this.SCROLL_RIGHT,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)}_handlePreviousMouseEnter(){var e;this.tabPreviousButton.on("mouseleave",this._handlePreviousMouseLeave),this._handleScrollRepeat(this.SCROLL_LEFT,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)}_handleNextMouseLeave(){var e;window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.controlsContainer.off("mouseleave",this._handleNextMouseLeave)}_handlePreviousMouseLeave(){var e;window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextButtonMouseDown(){for(var e,t=0;t<this.tabs.length;t+=1){var r,i,o,a,s;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r:0)>((o=(a=this.tabsContainer.get(0))===null||a===void 0?void 0:a.offsetWidth)!==null&&o!==void 0?o:0)+((s=this.tabsContainer.scrollLeft())!==null&&s!==void 0?s:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT);else{var l=this.tabsContainer.get(0);if(l){var d,h;l.scrollLeft=(d=(h=this.tabsContainer.get(0))===null||h===void 0?void 0:h.scrollWidth)!==null&&d!==void 0?d:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var r,i,o;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r:0)<((o=this.tabsContainer.scrollLeft())!==null&&o!==void 0?o:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT);else{var a=this.tabsContainer.get(0);a&&(a.scrollLeft=0)}}_handleScrollButtonMouseDown(e){this.holdTimer=window.setTimeout(()=>{var t;this._handleScrollRepeat(e,(t=this.tabsContainer.scrollLeft())!==null&&t!==void 0?t:0,100)},this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)}_handleScrollButtonMouseUp(){var e,t;clearTimeout((e=this.holdTimer)!==null&&e!==void 0?e:-1),this.holdTimer=null,cancelAnimationFrame((t=this.rAF)!==null&&t!==void 0?t:-1),this.rAF=null,window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)}_checkScrollArrows(){var e,t,r;this.tabsContainer.scrollLeft()===0?this.tabPreviousButton.first().prop("disabled",!0):((e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)+((t=this.tabsContainer.innerWidth())!==null&&t!==void 0?t:0)===((r=this.tabsContainer.get(0))===null||r===void 0?void 0:r.scrollWidth)?this.tabNextButton.prop("disabled",!0):(this.tabNextButton.prop("disabled",!1),this.tabPreviousButton.first().prop("disabled",!1))}_handleScrollRepeat(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0,a=this.tabsContainer.get(0);if(a){var s=a.getBoundingClientRect();if(e===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(t-i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(e===this.SCROLL_RIGHT){var l,d;if(this.tabsContainer.scrollLeft(t+i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((d=this.tabsContainer.innerWidth())!==null&&d!==void 0?d:0)===a.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((r=this.rAF)!==null&&r!==void 0?r:-1),this.rAF=window.requestAnimationFrame(h=>{var c,f,v=o||h,p=h-v,g=this.START_SPEED*p+.5*this.ACCELERATION*(p*p);g=Math.min(g,(c=(f=this.tabsContainer.get(0))===null||f===void 0?void 0:f.scrollWidth)!==null&&c!==void 0?c:1/0),this._handleScrollRepeat(e,t,g,v)})}}_$setClosable(e){return this.closeButton&&this._isClosable()?(this.closeButton.element[e?"show":"hide"](),!0):!1}_$destroy(){this.emit("destroy",this);for(var e=0;e<this.tabs.length;e++)this.tabs[e]._$destroy();this._detachWheelListener(),this._handleItemDropped(),M(document).off("mouseup",this._hideAdditionalTabsDropdown),this.tabDropdownSearch.off("input",this._handleFilterInput),this.tabDropdownSearch.off("keydown",this._handleFilterKeydown),this.element.remove()}_getHeaderSetting(e){if(e in this.parent._header)return this.parent._header[e]}_createControls(){var e,t,r,i,o;if(o=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new Wn(this,o,"lm_tabdropdown",this._showAdditionalTabsDropdown),this.tabDropdownButton.element.hide(),this.controlsContainer.prepend(this.tabNextButton),this.tabNextButton.hide(),this._getHeaderSetting("popout")&&(t=this._onPopoutClick.bind(this),r=this._getHeaderSetting("popout"),new Wn(this,r,"lm_popout",t)),this._getHeaderSetting("maximise")){i=this.parent.toggleMaximise.bind(this.parent);var a=this._getHeaderSetting("maximise"),s=this._getHeaderSetting("minimise"),l=new Wn(this,a,"lm_maximise",i);this.parent.on("maximised",function(){l.element.attr("title",s??"")}),this.parent.on("minimised",function(){l.element.attr("title",a??"")})}this._isClosable()&&(e=this.parent.remove.bind(this.parent),r=this._getHeaderSetting("close"),this.closeButton=new Wn(this,r,"lm_close",e))}_showAdditionalTabsDropdown(){if(this.isDropdownShown){this._hideAdditionalTabsDropdown();return}this.tabDropdownList=this.tabsContainer.clone(!0).appendTo(this.tabDropdownContainer).children().removeClass("lm_active"),M(document.body).append(this.tabDropdownContainer),this.tabDropdownContainer.show(),this.isDropdownShown=!0,this.element.addClass("lm_dropdown_open"),this.tabDropdownSearch.val("").focus(),this.dropdownKeyIndex=0,this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active"),M(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown()}_handleFilterKeydown(e){if(e.key==="Escape"){this._hideAdditionalTabsDropdown();return}if(this.dropdownKeyIndex===-1)return;if(e.key==="Enter"||e.key===" "){this._hideAdditionalTabsDropdown(),this.tabs[this.dropdownKeyIndex]._onTabClick();return}function t(s,l,d){if(d==null||d.length<2)return-1;for(var h=(s+l+d.length)%d.length;h!==s;){if(d.eq(h).css("display")!=="none")return h;h=(h+l+d.length)%d.length}return s}if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var r,i;e.preventDefault(),(r=this.tabDropdownList)===null||r===void 0||r.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,1,this.tabDropdownList),(i=this.tabDropdownList)===null||i===void 0||i.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}else if(e.key==="ArrowUp"||e.key==="Tab"){var o,a;e.preventDefault(),(o=this.tabDropdownList)===null||o===void 0||o.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,-1,this.tabDropdownList),(a=this.tabDropdownList)===null||a===void 0||a.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_handleFilterInput(e){if(this.tabDropdownList!=null){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var t=0;t<this.tabDropdownList.length;t++){var r,i;((r=(i=this.tabs[t].contentItem.config.title)===null||i===void 0?void 0:i.toLowerCase().indexOf(e.target.value.toLowerCase()))!==null&&r!==void 0?r:-1)!==-1?(this.tabDropdownList.eq(t).css("display",""),this.dropdownKeyIndex===-1&&(this.dropdownKeyIndex=t)):this.tabDropdownList.eq(t).css("display","none")}this.dropdownKeyIndex!==-1&&this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_hideAdditionalTabsDropdown(e){var t,r;this.isDropdownShown&&(e&&(t=this.tabDropdownContainer.get(0))!==null&&t!==void 0&&t.contains(e.target)||e&&((r=this.tabDropdownButton)===null||r===void 0?void 0:r.element.get(0))===e.target||(this.element.removeClass("lm_dropdown_open"),this.tabDropdownContainer.hide(),this.isDropdownShown=!1,this.element.append(this.tabDropdownContainer),this.tabDropdownContainer.find(".lm_tabs").remove(),M(document).off("mousedown",this._hideAdditionalTabsDropdown)))}_updateAdditionalTabsDropdown(){var e,t,r,i;if(this.isDropdownShown&&!(!this.tabDropdownList||this.tabDropdownList.length==0)){var o=(e=(t=this.tabDropdownContainer.get(0))===null||t===void 0?void 0:t.scrollHeight)!==null&&e!==void 0?e:0;if(o!==0){var a=this.tabDropdownContainer[0].getBoundingClientRect(),s=(r=M(window).height())!==null&&r!==void 0?r:0,l=(i=M(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var d=this.tabDropdownButton.element[0].getBoundingClientRect(),h=o<s-d.bottom,c=!h&&d.bottom>s*.6,f=Math.min(d.left+(c?d.width:0),l-a.width-this.PADDING),v=c?Math.max(d.top-o,this.PADDING):d.bottom,p=s-v-this.PADDING;this.tabDropdownContainer.css({"max-height":p,top:v,left:f})}}}}_isClosable(){return!!(this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon)}_onPopoutClick(){if(this.layoutManager.config.settings.popoutWholeStack===!0)this.parent.popout();else{var e;(e=this.activeContentItem)===null||e===void 0||e.popout()}}_onHeaderClick(e){e.target===this.element[0]&&this.parent.select()}_updateTabSizes(){if(this.tabs.length!==0){var e=this.tabsContainer.get(0);if(this.isDropdownShown&&this._updateAdditionalTabsDropdown(),!!e){if(!this.isOverflowing&&e.scrollWidth>e.clientWidth){var t;(t=this.tabDropdownButton)===null||t===void 0||t.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0}else if(this.isOverflowing&&e.scrollWidth<=e.clientWidth){var r;(r=this.tabDropdownButton)===null||r===void 0||r.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1}this.isOverflowing&&this._checkScrollArrows()}}}}ie(Nt,"_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(""));ie(Nt,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));ie(Nt,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function Fn(n,e,t){return e=xp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xp(n){var e=Mp(n,"string");return typeof e=="symbol"?e:String(e)}function Mp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ql{constructor(e,t,r){Fn(this,"_isVertical",void 0),Fn(this,"_size",void 0),Fn(this,"_grabSize",void 0),Fn(this,"_dragListener",void 0),Fn(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=r<t?t:r,this.element=this._createElement(),this._dragListener=new ir(this.element)}on(e,t,r){var i;(i=this._dragListener)===null||i===void 0||i.on(e,t,r)}_$destroy(){var e;(e=this._dragListener)===null||e===void 0||e.destroy(),this._dragListener=null,this.element.remove()}_createElement(){var e=M('<div class="lm_drag_handle"></div>'),t=M('<div class="lm_splitter"></div>');t.append(e);var r=this._grabSize-this._size,i=r/2;return this._isVertical?(e.css("top",-i),e.css("height",this._size+r),t.addClass("lm_vertical"),t.height(this._size)):(e.css("left",-i),e.css("width",this._size+r),t.addClass("lm_horizontal"),t.width(this._size)),t}}const Np=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:Wl,DragProxy:mn,DragSource:Ul,DragSourceFromEvent:Vl,DropTargetIndicator:or,Header:Nt,HeaderButton:Wn,Splitter:ql,Tab:ar},Symbol.toStringTag,{value:"Module"}));var Ap={config:xg,container:Fg,controls:Np,errors:fp,items:Pp,utils:Yg};const Lp=Ap;function _a(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function $e(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_a(Object(t),!0).forEach(function(r){ae(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):_a(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ae(n,e,t){return e=Fp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fp(n){var e=Rp(n,"string");return typeof e=="symbol"?e:String(e)}function Rp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Pa=["column","row","stack","component"];class qr extends ct{static isLayoutItemConfig(e){return Pa.includes(e.type)}static minifyConfig(e){return Gi(e)}static unminifyConfig(e){return _i(e)}constructor(e,t){super(),ae(this,"isInitialised",!1),ae(this,"_isFullPage",!1),ae(this,"_resizeTimeoutId",void 0),ae(this,"_components",{"lm-react-component":Hl}),ae(this,"_fallbackComponent",void 0),ae(this,"_itemAreas",[]),ae(this,"_maximisedItem",null),ae(this,"_maximisePlaceholder",M('<div class="lm_maximise_place"></div>')),ae(this,"_creationTimeoutPassed",!1),ae(this,"_subWindowsCreated",!1),ae(this,"_dragSources",[]),ae(this,"_updatingColumnsResponsive",!1),ae(this,"_firstLoad",!0),ae(this,"_reactChildMap",new Map),ae(this,"_reactChildren",null),ae(this,"_initialHeaderHeight",void 0),ae(this,"width",null),ae(this,"height",null),ae(this,"root",void 0),ae(this,"openPopouts",[]),ae(this,"selectedItem",null),ae(this,"isSubWindow",!1),ae(this,"eventHub",new Bl(this)),ae(this,"config",void 0),ae(this,"container",void 0),ae(this,"_originalContainer",void 0),ae(this,"dropTargetIndicator",null),ae(this,"tabDropPlaceholder",M('<div class="lm_drop_tab_placeholder"></div>')),this._onResize=this._onResize.bind(this),this._onUnload=this._onUnload.bind(this),this._windowBlur=this._windowBlur.bind(this),this._windowFocus=this._windowFocus.bind(this),this.config=this._createConfig(e),this._originalContainer=t,this.container=this._getContainer(),this._initialHeaderHeight=this.config.dimensions.headerHeight,this.isSubWindow&&M("body").css("visibility","hidden")}registerComponent(e,t){if(typeof t!="function"&&(t==null||t.render==null||typeof t.render!="function"))throw new Error("Please register a constructor function");if(this._components[e]!==void 0)throw new Error("Component "+e+" is already registered");this._components[e]=t;var r=()=>{if(this._components[e]===void 0)throw new Error("Component "+e+" is not registered");delete this._components[e]};return r}setFallbackComponent(e){this._fallbackComponent=e}toConfig(e){if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");if(e&&!(e instanceof Ie))throw new Error("Root must be a ContentItem");var t={settings:$e({},this.config.settings),dimensions:$e({},this.config.dimensions),labels:$e({},this.config.labels),content:[]},r=function o(a,s){for(var l in s.config)l!=="content"&&(a[l]=s.config[l]);if(a.componentName==="lm-react-component"&&(a.type="react-component"),s.contentItems.length){a.content=[];for(var d=0;d<s.contentItems.length;d++)a.content[d]={},o(a.content[d],s.contentItems[d])}};e?r(t,{contentItems:[e]}):r(t,this.root),this._$reconcilePopoutWindows(),t.openPopouts=[];for(var i=0;i<this.openPopouts.length;i++)t.openPopouts.push(this.openPopouts[i].toConfig());return t.maximisedItemId=this._maximisedItem?"__glMaximised":void 0,t}getComponent(e){return this._components[e]}getFallbackComponent(){return this._fallbackComponent}init(){if(this._subWindowsCreated===!1&&(this._createSubWindows(),this._subWindowsCreated=!0),document.readyState==="loading"||document.body===null){M(document).ready(this.init.bind(this));return}if(this.isSubWindow===!0&&this._creationTimeoutPassed===!1){setTimeout(this.init.bind(this),7),this._creationTimeoutPassed=!0;return}this.isSubWindow===!0&&this._adjustToWindowMode(),this._setContainer(),this.dropTargetIndicator=new or,this.updateSize(),this._create(this.config),this._bindEvents(),this.isInitialised=!0,this._adjustColumnsResponsive(),this.emit("initialised")}addReactChild(e,t){this._reactChildMap.set(e,t),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged")}removeReactChild(e,t){var r=this._reactChildMap.get(e);r===t&&(this._reactChildMap.delete(e),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged"))}getReactChildren(){return this._reactChildren}enableHeaders(){this.config.settings.hasHeaders=!0,this.config.dimensions.headerHeight=this._initialHeaderHeight,this._findAllStackContainers().forEach(e=>{e._header.show=!0,e.header.element.toggle(!0)}),this.updateSize()}disableHeaders(){this.config.settings.hasHeaders=!1,this.config.dimensions.headerHeight=0,this._findAllStackContainers().forEach(e=>{e._header.show=!1,e.header.element.toggle(!1)}),this.updateSize()}updateSize(e,t){var r,i;if(this.width=(r=e??this.container.width())!==null&&r!==void 0?r:0,this.height=(i=t??this.container.height())!==null&&i!==void 0?i:0,this.isInitialised===!0){if(this.root.callDownwards("setSize",[this.width,this.height]),this._maximisedItem){var o,a;this._maximisedItem.element.width((o=this.container.width())!==null&&o!==void 0?o:0),this._maximisedItem.element.height((a=this.container.height())!==null&&a!==void 0?a:0),this._maximisedItem.callDownwards("setSize")}this._adjustColumnsResponsive()}}destroy(){var e;this.isInitialised===!1||!this.root||(this._onUnload(),M(window).off("resize",this._onResize),M(window).off("unload beforeunload",this._onUnload),M(window).off("blur.lm").off("focus.lm"),this.root.callDownwards("_$destroy",[],!0),this.root.contentItems=[],this.tabDropPlaceholder.remove(),(e=this.dropTargetIndicator)===null||e===void 0||e.destroy(),this.eventHub.destroy(),this._dragSources.forEach(function(t){t._dragListener.destroy()}),this._dragSources=[])}createContentItem(e,t){var r,i;if(typeof e.type!="string")throw new on("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!qr.isLayoutItemConfig(e))throw i="Unknown type '"+e.type+"'. Valid types are "+Pa.join(","),new on(i);return e.type==="component"&&!(t instanceof Ii)&&t&&!(this.isSubWindow===!0&&t instanceof Oi)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),e.id=(r=e.id)!==null&&r!==void 0?r:Fr(),e.type==="stack"?new Ii(this,e,t):e.type==="row"?new Jn(!1,this,e,t):e.type==="column"?new Jn(!0,this,e,t):new Gl(this,e,t)}createPopout(e,t,r,i){var o=[],a=e instanceof Ie,s=this;if(a){var l;o=this.toConfig(e).content,r=Fr();for(var d=e.parent,h=e;((c=d)===null||c===void 0?void 0:c.contentItems.length)===1&&!d.isRoot;){var c;h=d,d=d.parent}if((l=d)===null||l===void 0||l.addId(r),i==null||Number.isNaN(i)){var f;i=(f=d)===null||f===void 0?void 0:f.contentItems.indexOf(h)}}else e instanceof Array?o=e:o=[e];if(!t&&a){var v,p,g,y=window.screenX||window.screenLeft,P=window.screenY||window.screenTop,O=(v=e.element.offset())!==null&&v!==void 0?v:{left:0,top:0};t={left:y+O.left,top:P+O.top,width:(p=e.element.width())!==null&&p!==void 0?p:0,height:(g=e.element.height())!==null&&g!==void 0?g:0}}if(!t&&!a&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),a&&e.remove(),!(!t||!r||i===void 0)){var _=new Wl(o,t,r,i,this);return _.on("initialised",function(){s.emit("windowOpened",_)}),_.on("closed",function(){s._$reconcilePopoutWindows()}),this.openPopouts.push(_),_}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var r=new Ul(e,t,this);return this._dragSources.push(r),r}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new Vl(e,this,t)}selectItem(e,t){if(this.config.settings.selectionEnabled!==!0)throw new Error("Please set selectionEnabled to true to use this feature");e!==this.selectedItem&&(this.selectedItem!==null&&this.selectedItem.deselect(),e&&t!==!0&&e.select(),this.selectedItem=e,this.emit("selectionChanged",e))}_$maximiseItem(e){var t,r;this._maximisedItem!==null&&this._$minimiseItem(this._maximisedItem),this._maximisedItem=e,this._maximisedItem.addId("__glMaximised"),e.element.addClass("lm_maximised"),e.element.after(this._maximisePlaceholder),this.root.element.prepend(e.element),e.element.width((t=this.container.width())!==null&&t!==void 0?t:0),e.element.height((r=this.container.height())!==null&&r!==void 0?r:0),e.callDownwards("setSize"),this._maximisedItem.emit("maximised"),this.emit("stateChanged")}_$minimiseItem(e){var t;e.element.removeClass("lm_maximised"),e.removeId("__glMaximised"),this._maximisePlaceholder.after(e.element),this._maximisePlaceholder.remove(),(t=e.parent)===null||t===void 0||t.callDownwards("setSize"),this._maximisedItem=null,e.emit("minimised"),this.emit("stateChanged")}_$closeWindow(){window.setTimeout(function(){window.close()},1)}_$getArea(e,t){for(var r=1/0,i=null,o=0;o<this._itemAreas.length;o++){var a=this._itemAreas[o];e>a.x1&&e<a.x2&&t>a.y1&&t<a.y2&&r>a.surface&&(r=a.surface,i=a)}return i}_$createRootItemAreas(){var e=50,t=$e({},this.root._$getArea()),r=[$e($e({},t),{},{side:"left",x2:t.x1+e}),$e($e({},t),{},{side:"right",x1:t.x2-e}),$e($e({},t),{},{side:"top",y2:t.y1+e}),$e($e({},t),{},{side:"bottom",y1:t.y2-e})];r.forEach(i=>{i.surface=(i.x2-i.x1)*(i.y2-i.y1)}),this._itemAreas.push(...r)}_$calculateItemAreas(){var e=this._getAllContentItems();if(this._itemAreas=[],e.length===1){this._itemAreas.push(this.root._$getArea());return}this._$createRootItemAreas();for(var t=0;t<e.length;t++){var r=e[t];if(an(r)){var i=r._$getArea();if(i!==null)if(i instanceof Array)this._itemAreas=this._itemAreas.concat(i);else{var o;this._itemAreas.push(i);var a=$e($e({},i),(o=i.contentItem._contentAreaDimensions)===null||o===void 0?void 0:o.header.highlightArea);a.surface=(a.x2-a.x1)*(a.y2-a.y1),this._itemAreas.push(a)}}}}_$normalizeContentItem(e,t){if(!e)throw new Error("No content item defined");if(typeof e=="function"&&(e=e()),e instanceof Ie)return e;if(M.isPlainObject(e)&&e.type){var r=this.createContentItem(e,t??null);return r.callDownwards("_$init"),r}else throw new Error("Invalid contentItem")}_$reconcilePopoutWindows(){for(var e=[],t=0;t<this.openPopouts.length;t++){var r;((r=this.openPopouts[t].getWindow())===null||r===void 0?void 0:r.closed)===!1?e.push(this.openPopouts[t]):this.emit("windowClosed",this.openPopouts[t])}this.openPopouts.length!==e.length&&(this.emit("stateChanged"),this.openPopouts=e)}_getAllContentItems(){var e=[],t=r=>{if(e.push(r),r.contentItems instanceof Array)for(var i=0;i<r.contentItems.length;i++)t(r.contentItems[i])};return t(this.root),e}_bindEvents(){this._isFullPage&&M(window).resize(this._onResize),M(window).on("unload beforeunload",this._onUnload).on("blur.lm",this._windowBlur).on("focus.lm",this._windowFocus)}_windowBlur(){this.root.element.addClass("lm_window_blur")}_windowFocus(){this.root.element.removeClass("lm_window_blur")}_onResize(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(this.updateSize.bind(this),100)}_createConfig(e){var t,r=$l("gl-window");r&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(r)||"{}"),e=_i(e),localStorage.removeItem(r)),e=M.extend(!0,{},Fl,e);var i=function o(a){for(var s in a){var l=a[s];s!=="props"&&typeof l=="object"&&l!=null?o(l):s==="type"&&l==="react-component"&&(a.type="component",a.componentName="lm-react-component")}};return i(e),((t=e.settings)===null||t===void 0?void 0:t.hasHeaders)===!1&&(e.dimensions.headerHeight=0),e}_adjustToWindowMode(){var e,t=M('<div class="lm_popin" title="'+this.config.labels.popin+'"><div class="lm_icon"></div><div class="lm_bg"></div></div>');t.click(()=>{this.emit("popIn")}),document.title=zi((e=this.config.content[0].title)!==null&&e!==void 0?e:""),M("head").append(M("body link, body style, template, .gl_keep")),this.container=M("body").html("").css("visibility","visible").append(t),document.body.offsetHeight,window.__glInstance=this}_createSubWindows(){if(this.config.openPopouts)for(var e=0;e<this.config.openPopouts.length;e++){var t=this.config.openPopouts[e];this.createPopout(t.content,t.dimensions,t.parentId,t.indexInParent)}}_getContainer(){var e=this._originalContainer?M(this._originalContainer):M("body");if(e.length===0)throw new Error("GoldenLayout container not found");if(e.length>1)throw new Error("GoldenLayout more than one container element specified");return e}_setContainer(){var e=this._getContainer();e[0]===document.body&&(this._isFullPage=!0,M("html, body").css({height:"100%",margin:0,padding:0,overflow:"hidden"})),this.container=e}_create(e){var t;if(!(e.content instanceof Array))throw e.content===void 0?t="Missing setting 'content' on top level of configuration":t="Configuration parameter 'content' must be an array",new on(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new on(t,e);this.root=new Oi(this,{content:e.content},this.container),this.root.callDownwards("_$init"),e.maximisedItemId==="__glMaximised"&&this.root.getItemsById(e.maximisedItemId)[0].toggleMaximise()}_onUnload(){if(this.config.settings.closePopoutsOnUnload===!0)for(var e=0;e<this.openPopouts.length;e++)this.openPopouts[e].close()}_adjustColumnsResponsive(){if(!this._useResponsiveLayout()||this._updatingColumnsResponsive||!this.config.dimensions||!this.config.dimensions.minItemWidth||this.root.contentItems.length===0||!this.root.contentItems[0].isRow){this._firstLoad=!1;return}this._firstLoad=!1;var e=this.root.contentItems[0].contentItems.length;if(!(e<=1)){var t=this.config.dimensions.minItemWidth,r=e*t;if(!(this.width==null||r<=this.width)){this._updatingColumnsResponsive=!0;for(var i=Math.max(Math.floor(this.width/t),1),o=e-i,a=this.root.contentItems[0],s=this._findAllStackContainers()[0],l=0;l<o;l++){var d=a.contentItems[a.contentItems.length-1];this._addChildContentItemsToContainer(s,d)}this._updatingColumnsResponsive=!1}}}_useResponsiveLayout(){return this.config.settings&&(this.config.settings.responsiveMode=="always"||this.config.settings.responsiveMode=="onload"&&this._firstLoad)}_addChildContentItemsToContainer(e,t){t.type==="stack"?t.contentItems.forEach(function(r){e.addChild(r),t.removeChild(r,!0)}):t.contentItems.forEach(r=>{this._addChildContentItemsToContainer(e,r)})}_findAllStackContainers(){var e=[];return this._findAllStackContainersRecursive(e,this.root),e}_findAllStackContainersRecursive(e,t){t.contentItems.forEach(r=>{an(r)?e.push(r):r.isComponent||this._findAllStackContainersRecursive(e,r)})}}ae(qr,"__lm",Lp);const kp=qr,jp="_lm_dragging_k4a5m_1",$p="_lm_goldenlayout_k4a5m_1",Hp="_lm_header_k4a5m_1",Bp="_lm_controls_k4a5m_1",Wp="_lm_tabpreviousbutton_k4a5m_1",Up="_lm_tabnextbutton_k4a5m_1",Vp="_lm_tab_k4a5m_1",Kp="_lm_active_k4a5m_1",zp="_lm_close_tab_k4a5m_1",Gp="_lm_content_k4a5m_1",qp="_lm_dragProxy_k4a5m_1",Xp="_lm_dropTargetIndicator_k4a5m_1",Zp="_march_k4a5m_1",Yp="_lm_inner_k4a5m_1",Qp="_lm_splitter_k4a5m_1",Jp="_lm_selectable_k4a5m_1",eb="_lm_tabdropdown_list_k4a5m_1",tb="_lm_title_k4a5m_1",nb="_lm_title_before_k4a5m_1",rb="_lm_selected_k4a5m_1",ib="_lm_focusin_k4a5m_1",ob="_lm_window_blur_k4a5m_1",ab="_lm_popout_k4a5m_1",sb="_lm_maximise_k4a5m_1",lb="_lm_tabdropdown_k4a5m_1",db="_lm_close_k4a5m_1",ub="_lm_tabdropdown_search_k4a5m_1",hb="_lm_tabs_k4a5m_1",cb="_lm_keyboard_active_k4a5m_1",mb="_lm_maximised_k4a5m_1",fb="_lm_items_k4a5m_1",Ta={"tab-height":"28px","drag-border-width":"5px",lm_dragging:jp,lm_goldenlayout:$p,lm_header:Hp,lm_controls:Bp,lm_tabpreviousbutton:Wp,lm_tabnextbutton:Up,lm_tab:Vp,lm_active:Kp,lm_close_tab:zp,lm_content:Gp,lm_dragProxy:qp,lm_dropTargetIndicator:Xp,march:Zp,lm_inner:Yp,lm_splitter:Qp,lm_selectable:Jp,lm_tabdropdown_list:eb,lm_title:tb,lm_title_before:nb,lm_selected:rb,lm_focusin:ib,lm_window_blur:ob,lm_popout:ab,lm_maximise:sb,lm_tabdropdown:lb,lm_close:db,lm_tabdropdown_search:ub,lm_tabs:hb,lm_keyboard_active:cb,lm_maximised:mb,lm_items:fb},Oa=Object.freeze({tabHeight:parseInt(Ta["tab-height"],10),dragBorderWidth:parseInt(Ta["drag-border-width"],10)});function Ia(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Tt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ia(Object(t),!0).forEach(function(r){Xl(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ia(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Xl(n,e,t){return e=vb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function vb(n){var e=gb(n,"string");return typeof e=="symbol"?e:String(e)}function gb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var kt=B.module("LayoutUtils");function Zl(n){return n.componentName!==void 0}function Sn(n){var e=n;return(Zl(n)&&n.componentName==="lm-react-component"||n.type==="react-component")&&e.component!==void 0}function Sr(n){return n.focus!==void 0}function Da(n){return n.type==="stack"}class x{static activateTab(e,t){var r=x.getStackForRoot(e,t,!1);if(!r){kt.error("Could not find stack for config",t);return}var i=x.getContentItemInStack(r,t);i&&r.setActiveContentItem(i)}static isActiveTab(e,t){var r=x.getStackForRoot(e,t,!1);if(!r)return kt.error("Could not find stack for config",t),!1;var i=x.getContentItemInStack(r,t),o=r.getActiveContentItem();return o===i}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(zl(e)){var r={type:t?"column":"row"};(e.contentItems==null||e.contentItems.length===0)&&e.addChild(r);var i=e.contentItems[0],o=t?i.isColumn:i.isRow;if(!o){e.removeChild(i,!0),e.addChild(r);var a=document.activeElement;e.contentItems[0].addChild(i),a&&a.focus!=null&&a.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var s=e.contentItems[e.contentItems.length-1],l=t?s.isRow:s.isColumn;if(!l){var d={type:t?"row":"column"};e.addChild(d),e.removeChild(s,!0),e.contentItems[e.contentItems.length-1].addChild(s),s=e.contentItems[e.contentItems.length-1]}return this.addStack(s,!t)}static getStackById(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(i&&an(e)&&e.contentItems.length===0)return e;if(t===((r=e.config)===null||r===void 0?void 0:r.id)){if(an(e))return e;throw new Error("Item with ID ".concat(t," is not a stack"))}if(e.contentItems==null)return null;for(var o=0;o<e.contentItems.length;o+=1){var a=this.getStackById(e.contentItems[o],t,i);if(a)return a}return null}static getStackForConfig(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(r&&an(e)&&e.contentItems.length===0)return e;if(e.contentItems==null)return null;for(var i=0;i<e.contentItems.length;i+=1){var o=e.contentItems[i];if(o.isComponent&&o.config!=null&&to(o.config,t))return e;var a=this.getStackForConfig(o,t,r);if(a)return a}return null}static getStackForRoot(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=this.getStackForConfig(e,t);return!a&&i&&(a=this.getStackForConfig(e,{component:t.component},o)),!a&&r&&(a=this.addStack(e)),a}static getStackForComponentTypes(e,t){for(var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=0;a<t.length;a+=1){var s=t[a],l=a===t.length-1,d=x.getStackForRoot(e,{component:s},r&&l,i,o);if(d)return d}return null}static getContentItemInStack(e,t){if(!e)return null;for(var r=0;r<e.contentItems.length;r+=1){var i=e.contentItems[r];if(i.isComponent&&i.config!=null&&to(i.config,t))return i}return null}static dehydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var r=[],i=0;i<e.length;i+=1){var o=e[i],{component:a,content:s}=o;if(a){var l=t(a,o);l!=null?r.push(l):kt.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(a,'"'))}else if(s){var d=Tt(Tt({},o),{},{content:x.dehydrateLayoutConfig(s,t)});r.push(d)}else r.push(o)}return r}static getTabPoint(e){var{tab:t}=e;if(t==null)throw new Error("Cannot get tab for panel container ".concat(e));var r=t.element[0].getBoundingClientRect();return[r.left+r.width*.5,r.bottom-8]}static dropLayoutMinorChange(e){for(var t=0;t<e.length;t+=1){var r=e[t],{content:i}=r;i!==void 0?(Da(r)&&delete r.activeItemIndex,x.dropLayoutMinorChange(i)):Sn(r)&&r.component==="IrisGridPanel"&&r.props.panelState!=null&&(delete r.id,r.props.panelState.irisGridState.sorts=[],r.props.panelState.irisGridState.quickFilters=[],r.props.panelState.gridState.isStuckToBottom=!1,r.props.panelState.gridState.isStuckToRight=!1)}}static isEqual(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=x.cloneLayout(e),o=x.cloneLayout(t);return r?(x.dropLayoutMinorChange(i),x.dropLayoutMinorChange(o),Xn(i,o)):Xn(i,o)}static cloneLayout(e){return JSON.parse(JSON.stringify(e))}static hydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var r=[],i=0;i<e.length;i+=1){var o=e[i];if(Sn(o)){var a,{component:s,props:l={}}=o;r.push(Tt(Tt({},o),{},{id:(a=o?.id)!==null&&a!==void 0?a:Mt(),props:t(s,l)}))}else if(o.content!==void 0){var d=x.hydrateLayoutConfig(o.content,t);Da(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=d.length&&(kt.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),r.push(Tt(Tt({},o),{},{content:d}))}else r.push(o)}return r}static openComponent(){var{root:e,config:t,stack:r=void 0,replaceExisting:i=!0,replaceConfig:o=void 0,createNewStack:a=!1,focusElement:s=void 0,dragEvent:l=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},d=document.activeElement,h=Tt({},t);if(h.id==null&&(h.id=Mt()),l!=null){e?.layoutManager.createDragSourceFromEvent(h,l);return}var c=o||{id:h.id,component:h.component};k(e);var f=r??(a?x.addStack(e):x.getStackForRoot(e,c));k(f);var v=x.getContentItemInStack(f,c);if(s!=null){var p=y=>{kt.debug("Component created, focusing element",s),f.off("componentCreated",p);var{element:P}=y.origin;requestAnimationFrame(()=>{x.focusElement(P[0],s)})};f.on("componentCreated",p)}if(i&&v){var g=f.contentItems.indexOf(v);f.addChild(h,g+1),f.removeChild(v),f.setActiveContentItem(f.contentItems[g])}else f.addChild(h);s==null&&d&&Sr(d)&&d.focus()}static openComponentInStack(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=document.activeElement,o={id:t.id},a=x.getContentItemInStack(e,o);if(r&&a&&e){var s=e?.contentItems.indexOf(a);e.addChild(t,s+1),e.removeChild(a),e.setActiveContentItem(e.contentItems[s])}else e?.addChild(t);i&&Sr(i)&&i.focus()}static closeComponent(e,t,r){var i=x.getStackForRoot(e,t,!1,!1,!1);if(!i){kt.warn("Cannot find stack for component, ignoring close",t);return}var o=x.getContentItemInStack(i,t),a=document.activeElement;o&&(qe(o)?o.container.close(r):i.removeChild(o)),a&&document.contains(a)&&Sr(a)&&a.focus()}static renameComponent(e,t,r){var i=x.getStackForRoot(e,t,!1);if(!i){kt.error("Could not find stack for config",t);return}var o=x.getContentItemInStack(i,t);o&&o.setTitle(r)}static cloneComponent(e,t){var r=x.getStackForRoot(e,t,!1);if(!r)return kt.error("Could not find stack for config",t),null;var{props:i={}}=t,o=x.getPanelComponentState(t),a={type:"react-component",component:t.component,props:Tt(Tt({},i),{},{panelState:o}),title:"".concat(t.title," Copy"),id:Mt()};return x.openComponentInStack(r,a),a}static getPanelComponentState(e){if(Zl(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(Sn(e)){var r;return(r=e.props)===null||r===void 0?void 0:r.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:Oa.tabHeight,borderWidth:Oa.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=x.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return x.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,r=x.getComponentConfigFromContainer(t);if(r&&Sn(r)){var i;return(i=r.component)!==null&&i!==void 0?i:null}return null}static getComponentName(e){var t,r,i=(t=(r=e.WrappedComponent)===null||r===void 0?void 0:r.displayName)!==null&&t!==void 0?t:e.displayName;if(i==null)throw new Error("Component displayName not defined ".concat(e));return i}static focusElement(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:x.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var r=e.querySelector(t);return r==null?null:(Sr(r)&&r.focus(),r)}static onInitialized(e){return new Promise(t=>{if(e.isInitialised){t();return}var r=()=>{e.off("initialised",r),t()};e.on("initialised",r)})}}Xl(x,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var pb=H.forwardRef((n,e)=>{var t=x.getComponentNameFromPanel({props:n});return u.jsx("div",{ref:e,className:"panel-placeholder",children:u.jsxs("div",{children:['Component "',t,'" is not registered.']})})});pb.displayName="PanelPlaceholder";const te=Object.freeze({FOCUS:"PanelEvent.FOCUS",MOUNT:"PanelEvent.MOUNT",UNMOUNT:"PanelEvent.UNMOUNT",TITLE_CHANGED:"PanelEvent.TITLE_CHANGED",REOPEN:"PanelEvent.REOPEN",REOPEN_LAST:"PanelEvent.REOPEN_LAST",DELETE:"PanelEvent.DELETE",CLONED:"PanelEvent.CLONED",CLOSED:"PanelEvent.CLOSED",OPEN:"PanelEvent.OPEN",CLOSE:"PanelEvent.CLOSE",DRAGGING:"PanelEvent.DRAGGING",DROPPED:"PanelEvent.DROPPED"});function kr(n){return n?.WrappedComponent!==void 0}function bb(n){return typeof n.id=="string"&&n.layout instanceof kp&&n.panelManager instanceof Xi&&typeof n.registerComponent=="function"}function yb(n){if(!bb(n))throw new Error("Expected dashboard plugin props, but instead received ".concat(n))}function xa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ma(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xa(Object(t),!0).forEach(function(r){Bt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):xa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Bt(n,e,t){return e=Cb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cb(n){var e=Sb(n,"string");return typeof e=="symbol"?e:String(e)}function Sb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var tt=B.module("PanelManager");class Xi{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(s,l)=>l,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(s,l)=>l,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:new Map,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:()=>{};Bt(this,"layout",void 0),Bt(this,"hydrateComponent",void 0),Bt(this,"dehydrateComponent",void 0),Bt(this,"onPanelsUpdated",void 0),Bt(this,"closed",void 0),Bt(this,"openedMap",void 0),this.handleFocus=this.handleFocus.bind(this),this.handleMount=this.handleMount.bind(this),this.handleUnmount=this.handleUnmount.bind(this),this.handleReopen=this.handleReopen.bind(this),this.handleReopenLast=this.handleReopenLast.bind(this),this.handleDeleted=this.handleDeleted.bind(this),this.handleClosed=this.handleClosed.bind(this),this.handleControlClose=this.handleControlClose.bind(this),this.layout=e,this.hydrateComponent=t,this.dehydrateComponent=r,this.onPanelsUpdated=a,this.openedMap=new Map(i),this.closed=[...o],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(te.FOCUS,this.handleFocus),e.on(te.MOUNT,this.handleMount),e.on(te.UNMOUNT,this.handleUnmount),e.on(te.REOPEN,this.handleReopen),e.on(te.REOPEN_LAST,this.handleReopenLast),e.on(te.DELETE,this.handleDeleted),e.on(te.CLOSED,this.handleClosed),e.on(te.CLOSE,this.handleControlClose)}stopListening(){var{eventHub:e}=this.layout;e.off(te.FOCUS,this.handleFocus),e.off(te.MOUNT,this.handleMount),e.off(te.UNMOUNT,this.handleUnmount),e.off(te.REOPEN,this.handleReopen),e.off(te.REOPEN_LAST,this.handleReopenLast),e.off(te.DELETE,this.handleDeleted),e.off(te.CLOSED,this.handleClosed),e.off(te.CLOSE,this.handleControlClose)}getClosedPanelConfigsOfType(e){return this.closed.filter(t=>t.component===e)}getOpenedPanels(){return Array.from(this.openedMap.values())}getOpenedPanelConfigs(){return this.getOpenedPanels().map(e=>{var{glContainer:t}=e.props;return x.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&Sn(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,r=x.getStackForConfig(this.layout.root,{id:e});return(t=r&&x.getContentItemInStack(r,{id:e}))!==null&&t!==void 0?t:null}getLastUsedPanel(e){for(var t=this.getOpenedPanels(),r=t.length-1;r>=0;r-=1){var i=t[r];if(e==null||e(i))return i}}getLastUsedPanelOfType(e){return this.getLastUsedPanelOfTypes([e])}getLastUsedPanelOfTypes(e){return this.getLastUsedPanel(t=>e.some(r=>kr(r)&&t instanceof r.WrappedComponent||!kr(r)&&t instanceof r))}updatePanel(e){var t=x.getIdFromPanel(e);if(t==null){tt.error("updatePanel Panel did not have an ID",e);return}tt.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=x.getIdFromPanel(e);if(t==null){tt.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){tt.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){tt.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}tt.debug2("Removing panel ID ".concat(t," from open panels map")),this.openedMap.delete(t)}removeClosedPanelConfig(e){var t=this.closed.findIndex(r=>r===e||r.id!=null&&e.id!=null&&r.id===e.id);t>=0&&this.closed.splice(t,1)}handleFocus(e){tt.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){tt.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){tt.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}handleReopen(e,t){tt.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:r}=e,{props:i}=e;i=this.hydrateComponent(r,i);var o=Ma(Ma({},e),{},{props:i}),{root:a}=this.layout,s=e.parentStackId===void 0?void 0:x.getStackById(a,e.parentStackId);x.openComponent({root:a,config:o,replaceConfig:t,stack:s??void 0})}handleReopenLast(e){var t;if(this.closed.length!==0){if(e===void 0){this.handleReopen(this.closed[this.closed.length-1]);return}for(var r=(t=x.getStackForConfig(this.layout.root,e.getConfig()))===null||t===void 0?void 0:t.config.id,i=this.closed.length-1;i>=0;i-=1){var o=this.closed[i];if(o.parentStackId===r){this.handleReopen(o);return}}}}handleDeleted(e){tt.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){tt.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:r}=this.layout;x.closeComponent(r,t)}addClosedPanel(e){var{root:t}=this.layout,r=x.getComponentConfigFromContainer(e);if(r&&Sn(r)){var i=this.dehydrateComponent(r.component,r);if(i!=null){var o;i.parentStackId=(o=x.getStackForConfig(t,r))===null||o===void 0?void 0:o.config.id,this.closed.push(i)}}}sendUpdate(){var{closed:e,openedMap:t}=this;this.onPanelsUpdated({closed:[...e],openedMap:new Map(t)})}}Bt(Xi,"MAX_CLOSED_PANEL_COUNT",100);var wb=B.module("PanelErrorBoundary");class Eb extends m.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}componentWillUnmount(){var{glContainer:e,glEventHub:t}=this.props,r=x.getIdFromContainer(e);wb.debug("componentWillUnmount",r),t.emit(te.CLOSED,r,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?u.jsx("div",{className:"panel-error-boundary",children:u.jsx(un,{errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e}}function Na(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function jr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Na(Object(t),!0).forEach(function(r){_b(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Na(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function _b(n,e,t){return e=Pb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Pb(n){var e=Tb(n,"string");return typeof e=="symbol"?e:String(e)}function Tb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Yl(n){var{props:e,componentState:t}=n,{metadata:r}=e,{panelState:i=null}=e;t&&({panelState:i}=t);var o={};return r!=null&&(o.metadata=r),i!=null&&(o.panelState=i),jr(jr({},n),{},{componentState:null,props:o,type:"react-component"})}function Ql(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return jr(jr({},n),{},{localDashboardId:e})}function Ob(n){var e=kr(n)&&n.WrappedComponent.prototype!=null&&n.WrappedComponent.prototype.isReactComponent!=null||n.prototype!=null&&n.prototype.isReactComponent!=null,t=!kr(n)&&"$$typeof"in n&&n.$$typeof===Od.ForwardRef;return e||t}const Ib={dehydrate:Yl,hydrate:Ql};var Db=H.createContext(void 0),xb=S.shape({on:S.func,off:S.func,isHidden:S.bool,tab:S.shape({header:S.shape({tabs:S.arrayOf(S.shape({contentItem:S.shape({})}))})}),title:S.string,setTitle:S.func,close:S.func}),Jl=S.shape({on:S.func,off:S.func,emit:S.func}),Mb=S.shape({registerComponent:S.func,root:S.shape({addChild:S.func}),on:S.func,off:S.func,eventHub:Jl}),Nb=Object.freeze({Container:xb,EventHub:Jl,Layout:Mb});function Me(n,e,t){m.useEffect(function(){return n.on(e,t),()=>{n.off(e,t)}},[n,e,t])}function Rn(n,e,t,r){var i,o=(i=e.COMPONENT)!==null&&i!==void 0?i:e.displayName;if(o==null)throw new Error("ComponentType must have a `COMPONENT` or `displayName` attribute.");H.useEffect(()=>{var a=n(o,e,t,r);return()=>{a()}},[e,r,t,o,n])}var ed="SET_DASHBOARD_DATA";const Ab=ig(ed,{},!1),Lb={dashboardData:Ab};var Fb=new Map,td=Object.freeze({}),Rb=Object.freeze([]),xS=Li,MS=ds,NS=Id,kb=n=>n.dashboardData,Ae=(n,e)=>{var t;return(t=kb(n)[e])!==null&&t!==void 0?t:td},AS=(n,e)=>{var t;return(t=Ae(n,e).closed)!==null&&t!==void 0?t:Rb},LS=(n,e)=>{var t;return(t=Ae(n,e).openedMap)!==null&&t!==void 0?t:Fb},nd=(n,e)=>{var t;return(t=Ae(n,e).pluginDataMap)!==null&&t!==void 0?t:td},FS=(n,e,t)=>nd(n,e)[t];function Aa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function wn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Aa(Object(t),!0).forEach(function(r){jb(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Aa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function jb(n,e,t){return e=$b(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function $b(n){var e=Hb(n,"string");return typeof e=="symbol"?e:String(e)}function Hb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var rd=(n,e)=>({type:ed,id:n,payload:e}),Yt=(n,e)=>(t,r)=>t(rd(n,wn(wn({},Ae(r(),n)),e))),RS=(n,e,t)=>(r,i)=>r(rd(n,wn(wn({},Ae(i(),n)),{},{pluginDataMap:wn(wn({},nd(i(),n)),{},{[e]:t})})));Object.entries(Lb).map(n=>{var[e,t]=n;return Gr.register(e,t)});function Bb(n){var{children:e}=n;return u.jsx(u.Fragment,{children:e})}function La(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function kn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?La(Object(t),!0).forEach(function(r){Wb(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):La(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Wb(n,e,t){return e=Ub(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ub(n){var e=Vb(n,"string");return typeof e=="symbol"?e:String(e)}function Vb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var wr=B.module("DashboardLayout"),Kb=Object.freeze({}),zb=[],Fa=()=>{},Gb=1e3,Ra=n=>n;function qb(n){var e,t,{id:r,children:i,emptyDashboard:o=u.jsx("div",{children:"Dashboard is empty."}),layout:a,layoutConfig:s=zb,onLayoutChange:l=Fa,onLayoutInitialized:d=Fa,hydrate:h=Ql,dehydrate:c=Yl,panelWrapper:f=Bb}=n,v=Li(),p=(e=ds(b=>Ae(b,r)))!==null&&e!==void 0?e:Kb,[g,y]=m.useState(!1),[P,O]=m.useState(!1),[_,R]=m.useState(),[U]=m.useState((t=p?.closed)!==null&&t!==void 0?t:[]),[Q,N]=m.useState(a.getReactChildren()),W=m.useMemo(()=>new Map,[]),j=m.useMemo(()=>new Map,[]),Y=m.useCallback(function(b,w){var T,G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:h,J=arguments.length>3&&arguments[3]!==void 0?arguments[3]:c;wr.debug2("registerComponent",b,w,G,J);function Qe(X,re){var he=w,_e=f,Jr=Ob(he),{glContainer:mr,glEventHub:ei}=X;return u.jsx(Eb,{glContainer:mr,glEventHub:ei,children:u.jsx(_e,kn(kn({},X),{},{children:Jr?u.jsx(he,kn(kn({},X),{},{ref:re})):u.jsx(he,kn({},X))}))})}Qe.displayName="DashboardWrapper(".concat((T=w.displayName)!==null&&T!==void 0?T:b,")");var I=a.registerComponent(b,H.forwardRef(Qe));return W.set(b,G),j.set(b,J),I},[h,c,W,j,a,f]),ne=m.useCallback((b,w)=>{var T;return((T=W.get(b))!==null&&T!==void 0?T:Ra)(w,r)},[W,r]),F=m.useCallback((b,w)=>{var T;return((T=j.get(b))!==null&&T!==void 0?T:Ra)(w,r)},[j,r]),q=m.useMemo(()=>new Xi(a,ne,F,new Map,U,b=>{var{closed:w,openedMap:T}=b;v(Yt(r,{closed:w,openedMap:T}))}),[F,v,ne,r,U,a]),K=Vu(b=>{var w=_==null||!x.isEqual(_,b);wr.debug("handleLayoutStateChanged",w,b),w&&(y(a.root.contentItems.length===0),R(b),l(b),N(a.getReactChildren()))},Gb,{flushOnUnmount:!0});m.useEffect(()=>()=>K.flush(),[K]);var A=m.useCallback(()=>{if(!P){var b=a.toConfig(),w=b.content,T=x.dehydrateLayoutConfig(w,F);K(T)}},[F,P,a,K]),V=m.useCallback(b=>{var w=x.getIdFromContainer(b);a.eventHub.emit(te.DRAGGING,w),O(!0)},[a.eventHub]),z=m.useCallback(b=>{var w=x.getIdFromContainer(b);a.eventHub.emit(te.DROPPED,w),O(!1)},[a.eventHub]),me=m.useCallback(b=>{if(wr.debug2("handleComponentCreated",b),!(b==null||b.config==null||b.config.component==null||b.element==null)){var w=b.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),T="".concat(w,"-component");b.element.addClass(T)}},[]),je=m.useCallback(()=>{N(a.getReactChildren())},[a]);Me(a,"stateChanged",A),Me(a,"itemPickedUp",V),Me(a,"itemDropped",z),Me(a,"componentCreated",me),Me(a.eventHub,te.TITLE_CHANGED,A),Me(a,"reactChildrenChanged",je);var De=Ku(s);return m.useEffect(function(){if(De!==s&&s!==_){wr.debug("Setting new layout content...");for(var w=x.hydrateLayoutConfig(s,ne);a.root.contentItems.length>0;)a.root.contentItems[0].remove();for(var T=0;T<w.length;T+=1)a.root.addChild(w[T]);y(a.root.contentItems.length===0)}},[ne,a,s,_,q,De]),m.useEffect(()=>d(),[]),u.jsxs(u.Fragment,{children:[g&&o,Q,H.Children.map(i,b=>b!=null?u.jsx(uc,{fallback:[],children:H.cloneElement(b,{id:r,layout:a,panelManager:q,registerComponent:Y})}):null)]})}qb.propTypes={id:S.string.isRequired,children:S.node,data:S.shape({}),emptyDashboard:S.node,layout:Nb.Layout.isRequired,layoutConfig:S.arrayOf(S.shape({})),onLayoutChange:S.func,onLayoutInitialized:S.func};var kS="default";function sr(n,e,t){return e=Xb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Xb(n){var e=Zb(n,"string");return typeof e=="symbol"?e:String(e)}function Zb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Nn{}sr(Nn,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");sr(Nn,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");sr(Nn,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");sr(Nn,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");sr(Nn,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");const it=Nn;function Qt(n,e,t){return e=Yb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yb(n){var e=Qb(n,"string");return typeof e=="symbol"?e:String(e)}function Qb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class At{}Qt(At,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");Qt(At,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");Qt(At,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");Qt(At,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");Qt(At,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");Qt(At,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");Qt(At,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");Qt(At,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");const ka=At,jS=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function Lt(n,e,t){return e=Jb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Jb(n){var e=ey(n,"string");return typeof e=="symbol"?e:String(e)}function ey(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class wt{}Lt(wt,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");Lt(wt,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");Lt(wt,"CLOSE_FILE","NotebookEvent.closeFile");Lt(wt,"RENAME","NotebookEvent.rename");Lt(wt,"RENAME_FILE","NotebookEvent.renameFile");Lt(wt,"REGISTER_FILE","NotebookEvent.registerFile");Lt(wt,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");Lt(wt,"UNREGISTER_FILE","NotebookEvent.unregisterFile");Lt(wt,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");const de=wt;function An(n,e,t){return e=ty(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ty(n){var e=ny(n,"string");return typeof e=="symbol"?e:String(e)}function ny(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class fn{}An(fn,"focus","TabEvent.focus");An(fn,"blur","TabEvent.blur");An(fn,"openPQObject","TabEvent.openPQObject");An(fn,"openControl","TabEvent.openControl");An(fn,"reload","TabEvent.reload");An(fn,"clearAllFilters","TabEvent.clearAllFilters");const Er=fn;function ry(n,e,t){return e=iy(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function iy(n){var e=oy(n,"string");return typeof e=="symbol"?e:String(e)}function oy(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class id extends m.PureComponent{constructor(e){super(e),this.handleCloseTab=this.handleCloseTab.bind(this),this.handleCloseTabsRight=this.handleCloseTabsRight.bind(this),this.handleCloseTabsAll=this.handleCloseTabsAll.bind(this),this.handleReopenLast=this.handleReopenLast.bind(this)}getAllTabs(){var e,t,r,{glContainer:i}=this.props;return[...(e=i==null||(t=i.tab)===null||t===void 0||(r=t.header)===null||r===void 0?void 0:r.tabs)!==null&&e!==void 0?e:[]]}handleCloseTab(){var{glContainer:e}=this.props;e.close()}handleCloseTabsAll(){var e=this.getAllTabs();e.forEach(t=>{var r;return(r=(t?.contentItem).container)===null||r===void 0?void 0:r.close()})}handleCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),r=t.length-1;r>0;r-=1){var i,o,a,s,l,d,h;if(((i=t[r].contentItem)===null||i===void 0||(o=i.config)===null||o===void 0?void 0:o.id)===((a=e.tab)===null||a===void 0||(s=a.contentItem)===null||s===void 0||(l=s.config)===null||l===void 0?void 0:l.id))break;(d=((h=t[r])===null||h===void 0?void 0:h.contentItem).container)===null||d===void 0||d.close()}}handleReopenLast(){var{glContainer:e,glEventHub:t}=this.props;t.emit(te.REOPEN_LAST,e)}canCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),r=!0,i=t.length-1;i>0;i-=1){var o,a,s,l,d,h,c,f;if(((o=t[i].contentItem)===null||o===void 0||(a=o.config)===null||a===void 0?void 0:a.id)===((s=e.tab)===null||s===void 0||(l=s.contentItem)===null||l===void 0||(d=l.config)===null||d===void 0?void 0:d.id))break;var v=!!(!((h=t[i])===null||h===void 0||(c=h.contentItem)===null||c===void 0||(f=c.config)===null||f===void 0)&&f.isClosable);if(v){r=!1;break}}return r}canCloseAny(){for(var e=this.getAllTabs(),t=!0,r=e.length-1;r>0;r-=1){var i,o,a,s=!!(!((i=e[r])===null||i===void 0||(o=i.contentItem)===null||o===void 0||(a=o.config)===null||a===void 0)&&a.isClosable);if(s){t=!1;break}}return t}canReopenLast(){var e,t,{workspace:r,glContainer:i}=this.props,o=(e=x.getStackForConfig(i.layoutManager.root,i.getConfig()))===null||e===void 0?void 0:e.config.id;return!((t=r.data.closed)!==null&&t!==void 0&&t.some(a=>a.parentStackId===o))}render(){var e,t,r,{additionalActions:i,glContainer:o}=this.props,a=[...i];a.push(()=>({title:"Re-open closed panel",group:ee.groups.medium+2004,action:this.handleReopenLast,disabled:this.canReopenLast()}));var s=(e=o.tab)===null||e===void 0||(t=e.contentItem)===null||t===void 0||(r=t.config)===null||r===void 0?void 0:r.isClosable;return a.push({title:"Close",order:10,group:ee.groups.low,action:this.handleCloseTab,disabled:s===void 0||!s}),a.push(()=>({title:"Close Tabs to Right",order:20,group:ee.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),a.push(()=>({title:"Close All",order:30,group:ee.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),u.jsx(ee,{actions:a})}}ry(id,"defaultProps",{additionalActions:[]});var ay=n=>({workspace:Sl(n)}),sy=Dn(ay,{setWorkspace:Nl})(id);const ly=sy;function od(n,e,t){return e=dy(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function dy(n){var e=uy(n,"string");return typeof e=="symbol"?e:String(e)}function uy(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ad extends m.PureComponent{constructor(e){super(e),od(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=H.createRef();var{value:t}=e;this.state={value:t,valueWasValidated:!1}}componentDidUpdate(e){var{isShown:t}=e,{isShown:r}=this.props;r&&!t&&this.resetState()}resetState(){var{value:e}=this.props;this.setState({value:e,valueWasValidated:!1})}handleRenameDialogOpened(){var e,t;(e=this.renameInputRef)===null||e===void 0||(t=e.current)===null||t===void 0||t.focus()}handleRenameInputChange(e){this.setState({value:e.target.value})}handleRenameCancel(){var{onCancel:e}=this.props;e()}handleRenameSubmit(e){e.stopPropagation(),e.preventDefault();var{value:t}=this.state,r=t?.trim();if(r!==void 0&&r!==""){var{onSubmit:i}=this.props;i(r)}else this.setState({value:r,valueWasValidated:!0})}renderRenameDialog(){var{isShared:e,isOwner:t,itemType:r}=this.props,{value:i,valueWasValidated:o}=this.state;return u.jsxs("form",{className:Z("p-3",{"was-validated":o}),onSubmit:this.handleRenameSubmit,noValidate:!0,role:"presentation",onMouseDown:a=>{a.stopPropagation()},onMouseUp:a=>{a.stopPropagation()},children:[u.jsxs("div",{className:"form-group",children:[u.jsxs("label",{htmlFor:"rename-dialog-".concat(r,"-input"),children:["Rename ",r]}),u.jsx("input",{type:"text",className:"form-control",id:"rename-dialog-".concat(r,"-input"),value:i??void 0,ref:this.renameInputRef,onChange:this.handleRenameInputChange,required:!0}),u.jsxs("div",{className:"invalid-feedback",children:[r," name cannot be empty"]}),(e||!t)&&u.jsxs("div",{className:"pt-2",children:["Renaming this ",r," will rename for all users."]})]}),u.jsxs("div",{className:"text-right",children:[u.jsx(se,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),u.jsx(se,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var{isShown:e,onCancel:t}=this.props;return u.jsx(ki,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}od(ad,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});function Di(n,e,t){return e=hy(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function hy(n){var e=cy(n,"string");return typeof e=="symbol"?e:String(e)}function cy(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var my=B.module("Panel");class sd extends m.PureComponent{constructor(e){super(e),Di(this,"ref",void 0),Di(this,"getAdditionActions",yt((r,i,o)=>{var a=[];return i&&a.push(this.getCloneAction()),o&&a.push(this.getRenameAction()),[...a,...r]})),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleCopyPanel=this.handleCopyPanel.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleHide=this.handleHide.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleBeforeShow=this.handleBeforeShow.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.handleShowRenameDialog=this.handleShowRenameDialog.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleTab=this.handleTab.bind(this),this.ref=H.createRef();var{glContainer:t}=this.props;this.state={title:x.getTitleFromContainer(t),showRenameDialog:!1,isWithinPanel:!0}}componentDidMount(){var e,t,{componentPanel:r,glContainer:i,glEventHub:o}=this.props;i.on("resize",this.handleResize),i.on("show",this.handleBeforeShow),i.on("shown",this.handleShow),i.on("hide",this.handleHide),i.on("tab",this.handleTab),i.on("tabClicked",this.handleTabClicked),o.on(it.SESSION_CLOSED,this.handleSessionClosed),o.on(it.SESSION_OPENED,this.handleSessionOpened),o.on(Er.focus,this.handleTabFocus),o.on(Er.blur,this.handleTabBlur),o.on(ka.CLEAR_ALL_FILTERS,this.handleClearAllFilters),o.emit(te.MOUNT,r??this),this.setState({isWithinPanel:((e=this.ref.current)===null||e===void 0||(t=e.parentElement)===null||t===void 0?void 0:t.closest(".dh-panel"))!=null})}componentWillUnmount(){var{componentPanel:e,glContainer:t,glEventHub:r}=this.props;t.off("resize",this.handleResize),t.off("show",this.handleBeforeShow),t.off("shown",this.handleShow),t.off("hide",this.handleHide),t.off("tab",this.handleTab),t.off("tabClicked",this.handleTabClicked),r.off(it.SESSION_CLOSED,this.handleSessionClosed),r.off(it.SESSION_OPENED,this.handleSessionOpened),r.off(Er.focus,this.handleTabFocus),r.off(Er.blur,this.handleTabBlur),r.off(ka.CLEAR_ALL_FILTERS,this.handleClearAllFilters),r.emit(te.UNMOUNT,e??this)}handleTab(e){e!=null&&this.setState({title:x.getTitleFromTab(e)}),this.forceUpdate();var{onTab:t}=this.props;t(e)}handleTabClicked(e){var{onTabClicked:t}=this.props;t(e)}handleClearAllFilters(){var{onClearAllFilters:e}=this.props;e(...arguments)}handleFocus(e){var{componentPanel:t,glEventHub:r}=this.props;r.emit(te.FOCUS,t??this);var{onFocus:i}=this.props;i(e)}handleBlur(e){var{onBlur:t}=this.props;t(e)}handleHide(){var{onHide:e}=this.props;e(...arguments)}handleResize(){var{onResize:e}=this.props;e(...arguments)}handleSessionClosed(e){var{onSessionClose:t}=this.props;t(e)}handleSessionOpened(e,t){var{onSessionOpen:r}=this.props;r(e,t)}handleBeforeShow(){var{onBeforeShow:e}=this.props;e(...arguments)}handleShow(){var{onShow:e}=this.props;e(...arguments)}handleTabBlur(){var{onTabBlur:e}=this.props;e(...arguments)}handleTabFocus(){var{onTabFocus:e}=this.props;e(...arguments)}handleRenameCancel(){this.setState({showRenameDialog:!1})}handleShowRenameDialog(){this.setState({showRenameDialog:!0})}handleRenameSubmit(e){var{glContainer:t}=this.props;this.setState({showRenameDialog:!1,title:e});var r=x.getRootFromContainer(t),i=x.getComponentConfigFromContainer(t);k(i),x.renameComponent(r,i,e)}handleCopyPanel(){var{glContainer:e,glEventHub:t}=this.props,r=x.getRootFromContainer(e),i=x.getComponentConfigFromContainer(e);if(i==null){my.error("Could not get component config from container",e);return}var o=x.cloneComponent(r,i);o!==null&&t.emit(te.CLONED,this,o)}getCloneAction(){return{title:"Copy Panel",order:10,group:ee.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:ee.groups.medium,action:this.handleShowRenameDialog}}render(){var{children:e,className:t,renderTabTooltip:r,glContainer:i,glEventHub:o,additionalActions:a,errorMessage:s,isLoaded:l,isLoading:d,isClonable:h,isRenamable:c}=this.props,{tab:f}=i,{showRenameDialog:v,title:p,isWithinPanel:g}=this.state;return u.jsxs("div",{className:Z("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,u.jsx(un,{errorMessage:s,isLoaded:l,isLoading:d}),!g&&f!=null&&Hr.createPortal(u.jsxs(u.Fragment,{children:[u.jsx(ly,{glContainer:i,glEventHub:o,additionalActions:this.getAdditionActions(a,h,c)}),c&&u.jsx(ad,{isShown:v,value:p,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),r!=null&&u.jsx(qt,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:r()})]}),f.element[0])]})}}Di(sd,"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 lr=sd,$S=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var fy=Object.freeze({}),vy=new Map,Xr=Object.freeze([]),HS=(n,e)=>{var t;return(t=Ae(n,e).columns)!==null&&t!==void 0?t:Xr},BS=(n,e)=>{var t;return(t=Ae(n,e).filterSets)!==null&&t!==void 0?t:Xr},WS=(n,e)=>{var t;return(t=Ae(n,e).filters)!==null&&t!==void 0?t:Xr},US=(n,e)=>{var t;return(t=Ae(n,e).tableMap)!==null&&t!==void 0?t:vy},VS=(n,e)=>Ae(n,e).isolatedLinkerPanelId,ld=(n,e)=>{var t;return(t=Ae(n,e).links)!==null&&t!==void 0?t:Xr},KS=(n,e)=>Ae(n,e).columnSelectionValidator,zS=(n,e)=>{var t;return(t=Ae(n,e).consoleSettings)!==null&&t!==void 0?t:fy},GS=(n,e)=>Ae(n,e).connection,dr=(n,e)=>Ae(n,e).sessionWrapper,qS=(n,e)=>t=>t(Yt(n,{connection:e})),XS=(n,e)=>t=>t(Yt(n,{sessionWrapper:e})),dd=(n,e)=>t=>t(Yt(n,{links:e})),ZS=(n,e)=>(t,r)=>{var i=ld(r(),n),o=e.filter(a=>i.findIndex(s=>Xn(s.start,a.start)&&Xn(s.end,a.end))<0);return t(dd(n,i.concat(o)))},YS=(n,e)=>(t,r)=>{var i=ld(r(),n),o=i.filter(a=>!e.includes(a.id));return t(dd(n,o))},QS=(n,e)=>t=>t(Yt(n,{isolatedLinkerPanelId:e})),JS=(n,e)=>t=>t(Yt(n,{columnSelectionValidator:e})),gy=(n,e)=>t=>t(Yt(n,{consoleSettings:e})),ew=(n,e)=>t=>t(Yt(n,{filterSets:e}));function $r(n,e,t){return e=py(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function py(n){var e=by(n,"string");return typeof e=="symbol"?e:String(e)}function by(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var _r=B.module("CommandHistoryPanel");class ur extends m.Component{static handleError(e){_r.error(e)}constructor(e){super(e),$r(this,"container",void 0),$r(this,"pending",void 0),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSendToConsole=this.handleSendToConsole.bind(this),this.handleSendToNotebook=this.handleSendToNotebook.bind(this),this.container=H.createRef(),this.pending=new Mn;var{session:t,sessionId:r,language:i}=e;this.state={panelState:{},session:t,sessionId:r,language:i,contextActions:[{action:this.handleFocusHistory,shortcut:ke.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){var{glEventHub:e,session:t}=this.props;e.on(it.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(it.FOCUS_HISTORY,this.handleFocusHistory),this.pending.cancel()}handleFocusHistory(){this.container.current&&this.container.current.focus()}handleShow(){var e;(e=this.container.current)===null||e===void 0||e.restoreScrollPosition()}handleSessionOpened(e,t){var{language:r,sessionId:i}=t;this.setState({session:e,sessionId:i,language:r},()=>{this.loadTable()})}handleSessionClosed(){this.pending.cancel(),this.setState({session:void 0,language:void 0,table:void 0})}handleSendToNotebook(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{session:r,language:i}=this.state;if(_r.debug("handleSendToNotebook",r,e),!r){_r.error("Session is not connected.");return}var{glEventHub:o}=this.props;o.emit(t?de.CREATE_NOTEBOOK:de.SEND_TO_NOTEBOOK,r,i,e)}handleSendToConsole(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;_r.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(it.SEND_COMMAND,e,t,r)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:r}=this.state;k(t),k(r),this.pending.add(e.getTable(t,r,Date.now()),i=>i.close()).then(i=>{this.setState({table:i})}).catch(ur.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:r}=this.props,{language:i,contextActions:o,table:a}=this.state;return u.jsxs(lr,{className:"command-history-pane",componentPanel:this,glContainer:e,glEventHub:t,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[!a&&u.jsx("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),a&&i!=null&&u.jsxs(u.Fragment,{children:[u.jsx(kf,{ref:this.container,language:i,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:a,commandHistoryStorage:r}),u.jsx(ee,{actions:o})]})]})}}$r(ur,"COMPONENT","CommandHistoryPanel");$r(ur,"TITLE","Command History");var yy=(n,e)=>{var t=yl(n),r=dr(n,e.localDashboardId),{session:i,config:o}=r??{},{type:a,id:s}=o??{};return{commandHistoryStorage:t,language:a,session:i,sessionId:s}},Cy=Dn(yy,null,null,{forwardRef:!0})(ur);const Sy=Cy;var wy=m.createContext(null),hr=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin"});function Ey(n){return"DashboardPlugin"in n}function _y(n){return"AuthPlugin"in n}function Py(n){return"TablePlugin"in n}function tw(n){return Ey(n)||_y(n)||Py(n)}function Ty(n){return"type"in n&&n.type===hr.DASHBOARD_PLUGIN}function Zi(n){return"type"in n&&n.type===hr.WIDGET_PLUGIN}function Oy(n){return"type"in n&&n.type===hr.TABLE_PLUGIN}function Iy(n){return"type"in n&&n.type===hr.AUTH_PLUGIN}function ud(n){return"type"in n&&n.type===hr.THEME_PLUGIN}function nw(n){return Ty(n)||Iy(n)||Oy(n)||ud(n)||Zi(n)}var Dy=B.module("@deephaven/plugin.PluginUtils");function ja(n,e){return n==null||!Zi(n)?!1:[n.supportedTypes].flat().some(t=>t===e)}function xy(n){var e=u.jsx(ue,{icon:gs});if(!Zi(n))return e;var{icon:t}=n;return t==null?e:m.isValidElement(t)?t:u.jsx(ue,{icon:t})}function rw(n){var e=[...n.entries()].filter(t=>ud(t[1]));return Dy.debug("Getting theme data from plugins",e),e.map(t=>{var[r,i]=t,o=Array.isArray(i.themes)?i.themes:[i.themes];return o.map(a=>{var{name:s,baseTheme:l,styleContent:d}=a;return{baseThemeKey:"default-".concat(l??"dark"),themeKey:nu(r,s),name:s,styleContent:d}})}).flat()}function iw(){return nr(wy,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}function $a(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Pr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?$a(Object(t),!0).forEach(function(r){sn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):$a(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function sn(n,e,t){return e=My(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function My(n){var e=Ny(n,"string");return typeof e=="symbol"?e:String(e)}function Ny(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Tr=B.module("ConsolePanel"),Ay=500,Ly=Object.freeze({consoleSettings:{},itemIds:[]});class Zr extends m.PureComponent{constructor(e){super(e),sn(this,"consoleRef",void 0),sn(this,"objectSubscriptionCleanup",void 0),sn(this,"savePanelState",Pn(()=>{var{consoleSettings:a,itemIds:s}=this.state,l={consoleSettings:a,itemIds:[...s]};Tr.debug("Saving panel state",l),this.setState({panelState:l})},Ay)),this.handleFocusCommandHistory=this.handleFocusCommandHistory.bind(this),this.handleOpenObject=this.handleOpenObject.bind(this),this.handleCloseObject=this.handleCloseObject.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSettingsChange=this.handleSettingsChange.bind(this),this.handleShow=this.handleShow.bind(this),this.handlePanelMount=this.handlePanelMount.bind(this),this.supportsType=this.supportsType.bind(this),this.iconForType=this.iconForType.bind(this),this.consoleRef=H.createRef();var{panelState:t}=e,r=Pr(Pr({},Ly),t||{}),{consoleSettings:i,itemIds:o}=r;this.state={consoleSettings:i,itemIds:new Map(o),objectMap:new Map,error:void 0,panelState:r}}componentDidMount(){var{glEventHub:e}=this.props;this.closeDisconnectedPanels(),e.on(te.MOUNT,this.handlePanelMount),this.subscribeToFieldUpdates()}componentDidUpdate(e,t){var{consoleSettings:r,itemIds:i}=this.state;(t.consoleSettings!==r||t.itemIds!==i)&&this.savePanelState()}componentWillUnmount(){var e,{glEventHub:t}=this.props;this.savePanelState.flush(),t.off(te.MOUNT,this.handlePanelMount),(e=this.objectSubscriptionCleanup)===null||e===void 0||e.call(this)}subscribeToFieldUpdates(){var{sessionWrapper:e}=this.props;if(e!=null){var{session:t}=e;this.objectSubscriptionCleanup=t.subscribeToFieldUpdates(r=>{Tr.debug("Got updates",r),this.setState(i=>{var{objectMap:o}=i,{updated:a,created:s,removed:l}=r,d=[...a,...l],h=new Map(o);d.forEach(f=>{var{title:v}=f;v!==void 0&&h.delete(v)});var c=[...a,...s];return c.forEach(f=>{f.title!==void 0&&h.set(f.title,f)}),{objectMap:h}})})}}setItemId(e,t){this.setState(r=>{var{itemIds:i}=r,o=new Map(i);return o.set(e,t),{itemIds:o}})}getItemId(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{itemIds:r}=this.state,i=r.get(e);return i==null&&t&&(i=Mt(),this.setItemId(e,i)),i}handleTabFocus(){var e;(e=this.consoleRef.current)===null||e===void 0||e.focus()}handlePanelMount(e){var t,r,i,{itemIds:o}=this.state,a=e==null||(t=e.props)===null||t===void 0?void 0:t.id,s=e==null||(r=e.props)===null||r===void 0||(i=r.metadata)===null||i===void 0?void 0:i.sourcePanelId;if(a&&s){var l=new Set(o.values());l.has(s)&&this.setItemId(a,a)}}handleFocusCommandHistory(){var{glEventHub:e}=this.props;e.emit(it.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{root:r}=this.context,i=e.title!=null?this.getItemId(e.title,!1):null;(t||i!=null&&x.getStackForRoot(r,{id:i},!1,!1,!1)!=null)&&this.openWidget(e)}handleCloseObject(e){var{title:t}=e;if(t!==void 0){var r=this.getItemId(t,!1);if(r!=null){var{glEventHub:i}=this.props;i.emit(te.CLOSE,r)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;Tr.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(it.SETTINGS_CHANGED,e)}openWidget(e){var{glEventHub:t,sessionWrapper:r}=this.props;k(r);var{config:i,session:o}=r,{title:a=e.name}=e;k(a);var s=this.getItemId(a),l={fetch:()=>o.getObject(e),panelId:s,widget:Pr(Pr({},Ic(e)),{},{sessionId:i.id})};Tr.debug("openWidget",l),t.emit(te.OPEN,l)}addCommand(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;(t=this.consoleRef.current)===null||t===void 0||t.addCommand(e,r,i)}closeDisconnectedPanels(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{consoleSettings:t,itemIds:r}=this.state,{isClosePanelsOnDisconnectEnabled:i=!0}=t;if(!(!i&&!e)){var o=[...r.values()],{glEventHub:a}=this.props;o.forEach(s=>{a.emit(te.CLOSE,s)}),this.setState({itemIds:new Map})}}updateDimensions(){var e;(e=this.consoleRef.current)===null||e===void 0||e.updateDimensions()}supportsType(e){var{plugins:t}=this.props;return[...t.values()].some(r=>ja(r,e))}iconForType(e){var{plugins:t}=this.props,r=[...t.values()].find(i=>ja(i,e));return r!=null?xy(r):u.jsx(Dc,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:r,sessionWrapper:i,timeZone:o,unzip:a}=this.props;if(i==null)return u.jsx(un,{isLoading:!1,errorMessage:"Console is disabled."});var{consoleSettings:s,error:l,objectMap:d}=this.state,{config:h,session:c,connection:f,details:v={},dh:p}=i,{workerName:g,processInfoId:y}=v,{id:P,type:O}=h;return u.jsx(lr,{className:"iris-panel-console",componentPanel:this,glContainer:t,glEventHub:r,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,errorMessage:l!=null?"".concat(l):void 0,children:c!=null&&u.jsx(gf,{dh:p,ref:this.consoleRef,settings:s,session:c,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:O,statusBarChildren:u.jsxs(u.Fragment,{children:[u.jsx("div",{children:Js.LANGUAGE_MAP.get(O)}),g!=null&&u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"•"}),g]}),y!=null&&u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"•"}),y,u.jsx("div",{children:"•"})]}),u.jsx(Rv,{connection:f,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})]}),scope:P,timeZone:o,objectMap:d,unzip:a,supportsType:this.supportsType,iconForType:this.iconForType})})}}sn(Zr,"COMPONENT","ConsolePanel");sn(Zr,"TITLE","Console");sn(Zr,"contextType",Db);var Fy=(n,e)=>({commandHistoryStorage:yl(n),sessionWrapper:dr(n,e.localDashboardId),timeZone:Uv(n),plugins:Kv(n)}),Ry=Dn(Fy,null,null,{forwardRef:!0})(Zr);const mi=Ry;function ow(n){return n==="file"||n==="directory"}function ht(n){return n.type==="directory"}function ky(n,e,t){return e=jy(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jy(n){var e=$y(n,"string");return typeof e=="symbol"?e:String(e)}function $y(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Hy extends Error{constructor(){super("No file exists at the path specified"),ky(this,"isFileNotFound",!0)}}const Yi=Hy;function Ha(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Ba(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Ha(o,r,i,a,s,"next",l)}function s(l){Ha(o,r,i,a,s,"throw",l)}a(void 0)})}}var xt;(function(n){n.GROOVY="text/x-groovy",n.PLAIN_TEXT="text/plain",n.PYTHON="text/x-python",n.PYTHON_COMPILED="application/x-python-code",n.SCALA="text/x-scala",n.UNKNOWN=""})(xt||(xt={}));class vt{static fileExists(e,t){return Ba(function*(){try{return yield e.info(t),!0}catch(r){if(!(r instanceof Yi))throw r;return!1}})()}static fileExtensionToString(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return e.length===0?"":".".concat(e)}static getDepth(e){var t;if(!vt.hasPath(e))throw new Error("Invalid path provided: ".concat(e));var r=(t=e.match(/\//g))!==null&&t!==void 0?t:[];return r.length-1}static getExtension(e){var t=this.getBaseName(e).split(".");if(t.length>1){var r;return(r=t.pop())!==null&&r!==void 0?r:""}return""}static getBaseName(e){var t;return(t=e.split("/").pop())!==null&&t!==void 0?t:""}static getCopyFileName(e){var t=e.lastIndexOf("."),r=null,i=null;t<0?i=e:(i=e.substring(0,t),r=e.substring(t+1));var o=i?"".concat(i,"-copy"):"Copy";return r!==null?"".concat(o,".").concat(r):o}static getUniqueCopyFileName(e,t){return Ba(function*(){for(var r=vt.getCopyFileName(t);yield vt.fileExists(e,r);)r=vt.getCopyFileName(r);return r})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return xt.GROOVY;case"py":return xt.PYTHON;case"pyc":return xt.PYTHON_COMPILED;case"scala":return xt.SCALA;case"txt":return xt.PLAIN_TEXT;default:return xt.UNKNOWN}}static getParent(e){if(!vt.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(!vt.hasPath(e))throw new Error("Invalid filename provided: ".concat(e));var t=e.split("/");return t.pop(),"".concat(t.join("/"),"/")}static hasPath(e){return e.startsWith("/")}static isPath(e){return e.startsWith("/")&&e.endsWith("/")}static makePath(e){return e.endsWith("/")?e:"".concat(e,"/")}static replaceExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=e.lastIndexOf("."),i=r>-1?e.substring(0,r):e,o=vt.fileExtensionToString(t);return"".concat(i).concat(o)}static validateName(e){var t=[".",".."],r=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new Kn("Name cannot be empty");if(t.includes(e))throw new Kn('"'.concat(e,'" is a reserved name'));if(r.test(e)){var o,a;throw new Kn('Invalid characters in name: "'.concat((o=(a=e.match(r))===null||a===void 0?void 0:a.reduce((s,l)=>s.includes(l)?s:[...s,l],[]).map(s=>i.has(s)?i.get(s):s).join('", "'))!==null&&o!==void 0?o:"",'"'))}}static reducePaths(e){var t=e.filter(r=>vt.isPath(r));return e.filter(r=>!t.some(i=>r!==i&&r.startsWith(i)))}static removeRoot(e,t){if(e.length===0)return t;if(!t.startsWith(e))throw new Error("Filename ".concat(t," does not start with expected root ").concat(e));return t.substring(e.length)}static addRoot(e,t){return"".concat(e).concat(t)}}const $=vt;var Qi=26;function xi(n){return ht(n)?$.makePath(n.filename):$.getPath(n.filename)}function Wa(n,e){if(n.length===0||e==null)throw new Error("No items to move");var t=xi(e);if(n.some(r=>{var{filename:i}=r;return $.getPath(i)===t}))throw new Error("File already in the destination folder");if(n.some(r=>ht(r)&&t.startsWith($.makePath(r.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:n,targetPath:t}}function By(n){if(ht(n))return n.isExpanded?ru:iu;var e=$.getMimeType(n.basename);switch(e){case xt.PYTHON:return au;default:return ou}}function Mi(n){var e,{children:t,draggedItems:r,isDragInProgress:i,isDropTargetValid:o,isSelected:a,item:s,itemIndex:l,dropTargetItem:d,onDragStart:h,onDragOver:c,onDragEnd:f,onDrop:v}=n,p=(e=r?.some(N=>N.id===s.id))!==null&&e!==void 0?e:!1,g=xi(s),y=i&&d?xi(d):null,P=i&&o&&ht(s)&&y===g,O=i&&o&&y===g,_=i&&!o&&y===g,R=By(s),U=$.getDepth(s.filename),Q=Array(U).fill(null).map((N,W)=>u.jsx("span",{className:"file-list-depth-line"},W));return u.jsxs("div",{className:Z("d-flex w-100 align-items-center","file-list-item",{"is-dragged":p,"is-exact-drop-target":P,"is-in-drop-target":O,"is-invalid-drop-target":_,"is-selected":a}),onDragStart:N=>h(l,N),onDragOver:N=>c(l,N),onDragEnd:N=>f(l,N),onDrop:N=>v(l,N),draggable:!0,role:"presentation","aria-label":s.basename,children:[Q," ",u.jsx(ue,{icon:R,className:"item-icon",fixedWidth:!0})," ",u.jsx("span",{className:"truncation-wrapper",children:t??u.jsxs(u.Fragment,{children:[s.basename,u.jsx(qt,{children:s.basename})]})})]})}function Ua(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Or(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ua(Object(t),!0).forEach(function(r){Wy(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ua(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Wy(n,e,t){return e=Uy(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Uy(n){var e=Vy(n,"string");return typeof e=="symbol"?e:String(e)}function Vy(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Le=B.module("FileList"),Ky=500,Va="item-list-scroll-pane";function zy(n){var{isMultiSelect:e=!1,table:t,onFocusChange:r=()=>{},onMove:i,onSelect:o,onSelectionChange:a=()=>{},renderItem:s=Mi,rowHeight:l=Qi,overscanCount:d=Ye.DEFAULT_OVERSCAN}=n,[h,c]=m.useState(()=>({items:[],offset:0,itemCount:0})),[f,v]=m.useState({top:0,bottom:0}),[p,g]=m.useState(),[y,P]=m.useState(),[O,_]=m.useState(),[R,U]=m.useState([]),Q=m.useRef(),N=m.useRef(null),W=m.useRef(null),j=m.useCallback(I=>{if(I.length===0||h==null)return[];for(var X=[],re=0;re<I.length;re+=1)for(var he=I[re],_e=he[0];_e<=he[1];_e+=1)_e>=h.offset&&_e<h.offset+h.items.length&&X.push(h.items[_e-h.offset]);return X},[h]),Y=m.useCallback(I=>{var X=j([[I,I]]);if(X.length>0)return X[0]},[j]),ne=m.useCallback(()=>{var I=It.count(R);if(I===0)return null;if(I===1){var X=R[0][0],re=Y(X);if(re!=null)return re.filename}return"".concat(I," items")},[Y,R]),F=m.useCallback(I=>{if(!(!y||!p)){Le.debug("dropItems",y,"to",I);try{var{files:X,targetPath:re}=Wa(y,p);if(i?.(X,re),I!=null){var he;U([[I,I]]),(he=N.current)===null||he===void 0||he.focusItem(I)}}catch(_e){Le.error("Unable to complete move",_e)}}},[y,p,i]),q=m.useCallback((I,X)=>{var re=h.items[I-h.offset];re!==void 0&&(Le.debug("handleItemClick",re),o(re,X),ht(re)&&t?.setExpanded(re.filename,!re.isExpanded))},[h,o,t]),K=m.useCallback((I,X)=>{var re;Le.debug2("handleItemDragStart",I,R);var he=R;It.isSelected(R,I)||(he=[[I,I]],U(he)),P(j(he)),(re=N.current)===null||re===void 0||re.resetMouseState();var _e=document.createElement("div");_e.innerHTML='<div class="dnd-placeholder-content">'.concat(ne(),"</div>"),_e.className="file-list-dnd-placeholder",document.body.appendChild(_e),X.dataTransfer.setDragImage(_e,0,0),X.dataTransfer.effectAllowed="move",_(_e)},[ne,j,R]),A=m.useCallback((I,X)=>{X.preventDefault(),Le.debug2("handleItemDragOver",X),g(Y(I))},[Y]),V=m.useCallback((I,X)=>{Le.debug("handleItemDragEnd",I),O?.remove(),P(void 0),g(void 0),_(void 0)},[O]),z=m.useCallback((I,X)=>{F(I)},[F]),me=m.useCallback(()=>{Le.debug2("handleItemDragExit"),g(void 0)},[]),je=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains(Va)&&(I.preventDefault(),Le.debug2("handleListDragOver",I),g({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),De=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains(Va)&&(Le.debug("handleListDrop"),F())},[F]),b=m.useCallback(function(I){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(Le.debug2("handleSelectionChange",I),X===!0||I!==R){U(I);var re=j(I);a(re)}},[j,a,R]),w=m.useCallback(I=>{if(Le.debug2("handleFocusChange",I),I!=null){var[X]=j([[I,I]]);r(X)}else r();Q.current=I},[j,r]),T=m.useCallback((I,X)=>{Le.debug("handleViewportChange",I,X),(I!==f.top||X!==f.bottom)&&v({top:I,bottom:X})},[f]),G=m.useMemo(()=>{if(!y||!p)return!1;try{return Wa(y,p),Le.debug("handleValidateDropTarget true"),!0}catch{return Le.debug("handleValidateDropTarget false"),!1}},[y,p]),{focusedPath:J}=n;m.useEffect(()=>{J!==void 0&&(J==="/"?t.collapseAll():(t.setExpanded(J,!1),t.setExpanded(J,!0)))},[t,J]),m.useEffect(function(){Le.debug("updating table viewport",f),t?.setViewport({top:Math.max(0,f.top-d),bottom:f.bottom+d})},[d,t,f]),m.useEffect(function(){var X=t.onUpdate(re=>{c({items:re.items.map(he=>Or(Or({},he),{},{itemName:he.basename})),offset:re.offset,itemCount:t.size})});return()=>{X()}},[t]),m.useEffect(function(){Q.current!=null&&w(Q.current),R.length>0&&b(R,!0)},[h,w,b,R]),m.useEffect(function(){if(p!=null&&ht(p)&&p.filename!=="/"){var X=setTimeout(()=>{p.isExpanded||t?.setExpanded(p.filename,!0)},Ky);return()=>clearTimeout(X)}},[p,t]);var Qe=m.useCallback(I=>s(Or(Or({},I),{},{isDragInProgress:y!=null,dropTargetItem:p,draggedItems:y,isDropTargetValid:G,onDragStart:K,onDragEnd:V,onDragOver:A,onDragExit:me,onDrop:z})),[V,me,A,K,z,y,p,G,s]);return u.jsx("div",{ref:W,className:Z("file-list",{"is-dragging":y!=null}),onDragOver:je,onDrop:De,children:u.jsx(Ye,{ref:N,items:h.items,itemCount:h.itemCount,offset:h.offset,onFocusChange:w,onSelect:q,onSelectionChange:b,onViewportChange:T,selectedRanges:R,renderItem:Qe,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var Gy={name:"File Explorer",DELETE:ce.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[D.DELETE],macShortcut:[L.CMD,D.BACKSPACE]}),RENAME:ce.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[D.ENTER],macShortcut:[D.ENTER]})};const Ka={FILE_EXPLORER:Gy};var za=B.module("FileListItemEditor"),qy=()=>Promise.resolve();function Xy(n){var{item:e,onCancel:t,onSubmit:r,validate:i=qy}=n,o=m.useRef(null),[a,s]=m.useState(e.basename),[l,d]=m.useState(),[h,c]=m.useState(Promise.resolve()),f=m.useCallback(()=>{var O;(O=o.current)===null||O===void 0||O.focus()},[o]),v=m.useCallback(O=>O.stopPropagation(),[]),p=m.useCallback(()=>{h.then(()=>{r(a)}).catch(O=>za.info("Unable to validate name",O))},[r,a,h]);m.useEffect(function(){var _=Ee.makeCancelable(i(a));return _.then(()=>d(void 0)).catch(R=>{Ee.isCanceled(R)||d(R)}),c(_),()=>_.cancel()},[i,a]),m.useEffect(function(){f()},[f]);var g=m.useCallback(()=>{za.debug2("handleBlur"),p()},[p]),y=m.useCallback(O=>{var{value:_}=O.target;s(_)},[]),P=m.useCallback(O=>{O.stopPropagation();var{key:_}=O;switch(_){case"Enter":{p();break}case"Escape":{t();break}}},[t,p]);return u.jsxs("div",{className:"file-list-item-editor",children:[u.jsx("input",{type:"text",className:Z("form-control file-list-item-editor-input",{"is-invalid":l}),value:a,ref:o,onBlur:g,onKeyDown:P,onChange:y,onClick:v,onDoubleClick:v,onMouseDown:v}),l&&u.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}function Ga(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function fi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ga(Object(t),!0).forEach(function(r){Zy(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ga(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Zy(n,e,t){return e=Yy(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yy(n){var e=Qy(n,"string");return typeof e=="symbol"?e:String(e)}function Qy(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function hd(n){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:r=!1,onCreateFile:i,onCreateFolder:o,onCopy:a,onDelete:s,onMove:l,onRename:d,onSelect:h,onSelectionChange:c,table:f,rowHeight:v=Qi,validateRename:p=()=>Promise.resolve()}=n,[g,y]=m.useState(),[P,O]=m.useState([]),[_,R]=m.useState(),U=m.useCallback(z=>{O(z),c?.(z)},[c]),Q=m.useCallback(z=>{R(z)},[]),N=m.useCallback(()=>{_&&a?.(_)},[_,a]),W=m.useCallback(()=>{P.length>0&&s?.(P)},[s,P]),j=m.useCallback(()=>{i?.()},[i]),Y=m.useCallback(()=>{_&&o?.($.getPath(_.filename))},[_,o]),ne=m.useCallback(()=>{_&&y(_)},[_]),F=m.useCallback(()=>{y(void 0)},[]),q=m.useCallback(z=>{g&&(d?.(g,z),y(void 0))},[d,g]),K=m.useMemo(()=>{if(g)return[];var z=[];return i&&z.push({title:"New File",description:"Create new file",action:j,group:ee.groups.medium}),o&&z.push({title:"New Folder",description:"Create new folder",action:Y,group:ee.groups.medium}),a&&z.push({title:"Copy File",description:"Copy the selected file",action:N,group:ee.groups.low,disabled:_==null||ht(_)}),s&&P.length>0&&z.push({title:"Delete",description:"Delete",shortcut:Ka.FILE_EXPLORER.DELETE,action:W,group:ee.groups.low}),d&&z.push({title:"Rename",description:"Rename",shortcut:Ka.FILE_EXPLORER.RENAME,action:ne,group:ee.groups.low,disabled:_==null}),z},[N,W,j,Y,ne,_,a,i,o,s,d,P,g]),A=m.useCallback(z=>(k(g),p(g,z)),[g,p]),V=m.useCallback(z=>{var{item:me}=z;return g&&g.filename===me.filename?u.jsx(Mi,fi(fi({},z),{},{children:u.jsx(Xy,{item:me,validate:A,onSubmit:q,onCancel:F})})):u.jsx(Mi,fi({},z))},[F,q,g,A]);return u.jsxs("div",{className:"file-list-container",children:[f!=null&&u.jsx(zy,{onMove:l,onSelect:h,onSelectionChange:U,onFocusChange:Q,renderItem:V,rowHeight:v,table:f,isMultiSelect:e,focusedPath:t}),r&&u.jsx(ee,{actions:K})]})}hd.displayName="FileListContainer";function qa(n,e,t){return e=Jy(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Jy(n){var e=eC(n,"string");return typeof e=="symbol"?e:String(e)}function eC(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class tC extends Kn{constructor(e){super("Name already exists"),qa(this,"isExistingFile",!0),qa(this,"info",void 0),this.info=e}}const Dr=tC;function Xa(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Za(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Xa(o,r,i,a,s,"next",l)}function s(l){Xa(o,r,i,a,s,"throw",l)}a(void 0)})}}var ft=B.module("FileExplorer");function Ji(n){var{storage:e,isMultiSelect:t=!1,focusedPath:r,onCopy:i=()=>{},onDelete:o=()=>{},onRename:a=()=>{},onCreateFile:s=()=>{},onCreateFolder:l=()=>{},onSelect:d,onSelectionChange:h,rowHeight:c=Qi}=n,[f,v]=m.useState([]),[p,g]=m.useState();m.useEffect(function(){var q;function K(){return A.apply(this,arguments)}function A(){return A=Za(function*(){ft.debug("initTable"),q=Ee.makeCancelable(e.getTable(),V=>V.close());try{g(yield q)}catch(V){Ee.isCanceled(V)||ft.error("Unable to initialize table",V)}}),A.apply(this,arguments)}return K(),()=>{q.cancel()}},[e]);var y=m.useCallback(F=>{Ee.isCanceled(F)||ft.error(F)},[]),P=m.useCallback(()=>{ft.debug("handleCreateFile"),s()},[s]),O=m.useCallback(()=>{ft.debug("handleCreateFolder"),l()},[l]),_=m.useCallback(F=>{ft.debug("handleCopyFile",F.filename),i(F)},[i]),R=m.useCallback(F=>{ft.debug("handleDelete, pending confirmation",F),v(F)},[]),U=m.useCallback(()=>{ft.debug("handleDeleteConfirm",f),f.forEach(F=>e.deleteFile(ht(F)?$.makePath(F.filename):F.filename)),o(f),v([])},[f,o,e]),Q=m.useCallback(()=>{ft.debug("handleDeleteCancel"),v([])},[]),N=m.useCallback((F,q)=>{var K=$.reducePaths(F.map(A=>ht(A)?$.makePath(A.filename):A.filename));K.forEach(A=>{var V=$.isPath(A)?"".concat(q).concat($.getBaseName(A.substring(0,A.length-1)),"/"):"".concat(q).concat($.getBaseName(A));e.moveFile(A,V).then(()=>{a(A,V)}).catch(y)})},[y,a,e]),W=m.useCallback((F,q)=>{var K=F.filename,A=ht(F);A&&!K.endsWith("/")&&(K="".concat(K,"/"));var V="".concat($.getParent(K)).concat(q);A&&!V.endsWith("/")&&(V="".concat(V,"/")),ft.debug2("handleRename",K,V),e.moveFile(K,V).catch(y),a(K,V)},[y,a,e]),j=m.useCallback(function(){var F=Za(function*(q,K){if(K!==q.basename){$.validateName(K);var A="".concat($.getPath(q.filename)).concat(K);try{var V=yield e.info(A);throw new Dr(V)}catch(z){if(!(z instanceof Yi))throw z}}});return function(q,K){return F.apply(this,arguments)}}(),[e]),Y=f.length>0,ne=m.useMemo(()=>f.length===1?'Are you sure you want to delete "'.concat(f[0].filename,'"?'):"Are you sure you want to delete the selected files?",[f]);return u.jsxs("div",{className:"file-explorer",children:[p&&u.jsx(hd,{isMultiSelect:t,focusedPath:r,showContextMenu:!0,onCopy:_,onCreateFolder:O,onCreateFile:P,onMove:N,onDelete:R,onRename:W,onSelect:d,onSelectionChange:h,rowHeight:c,table:p,validateRename:j}),u.jsx(dn,{isOpen:Y,headerText:ne,bodyText:"You cannot undo this action.",onCancel:Q,onConfirm:U,confirmButtonText:"Delete"})]})}Ji.displayName="FileExplorer";function Ya(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function nC(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Ya(o,r,i,a,s,"next",l)}function s(l){Ya(o,r,i,a,s,"throw",l)}a(void 0)})}}function Wt(n,e,t){return e=rC(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function rC(n){var e=iC(n,"string");return typeof e=="symbol"?e:String(e)}function iC(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var en=B.module("NewItemModal");class ln extends m.PureComponent{static getValidationMessage(e){return e instanceof Dr&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){Ee.isCanceled(e)||en.error(e)}constructor(e){super(e),Wt(this,"inputRef",H.createRef()),Wt(this,"cancelableValidatePromise",void 0),Wt(this,"cancelableExistingItemPromise",void 0),Wt(this,"pending",new Mn),Wt(this,"pathMap",new Map),Wt(this,"isInitialLoad",!0),this.handleModalSubmit=this.handleModalSubmit.bind(this),this.handleModalOpened=this.handleModalOpened.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleChange=this.handleChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleValidationError=this.handleValidationError.bind(this),this.handleOverwriteCancel=this.handleOverwriteCancel.bind(this),this.handleOverwriteConfirm=this.handleOverwriteConfirm.bind(this),this.handleExtensionChangeCancel=this.handleExtensionChangeCancel.bind(this),this.handleExtensionChangeConfirm=this.handleExtensionChangeConfirm.bind(this),this.handleBreadcrumbSelect=this.handleBreadcrumbSelect.bind(this);var{defaultValue:t}=e,r=$.hasPath(t)?$.getPath(t):"/";this.state={isSubmitting:!1,path:r,prevExtension:$.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:$.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:r}=this.props,{isOpen:i}=e,{value:o,path:a}=this.state;!i&&r&&(this.resetValue(),this.isInitialLoad=!0),i&&r&&(!this.isInitialLoad&&(a!==t.path||o!==t.value)&&this.updateValidationStatus(a,o),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){var{defaultValue:e}=this.props,t=$.hasPath(e)?$.getPath(e):"/";this.setState({path:t,value:$.getBaseName(e),validationError:void 0,prevExtension:$.getExtension(e),isSubmitting:!1})}getValidationPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=Ee.makeCancelable(this.validateName(e,t,r)),this.cancelableValidatePromise}validateName(e,t,r){var i=this;return nC(function*(){$.validateName(t);var{defaultValue:o,storage:a}=i.props;if(r){var s="".concat(e).concat(t);if(s!==o)try{var l=yield a.info(s);throw new Dr(l)}catch(d){if(!(d instanceof Yi))throw d}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(ln.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var{value:t}=e.target;this.setState({value:t})}handleSelect(e){if(en.debug("handleSelect",e),e.type==="directory")this.setState({path:$.makePath(e.filename)});else{var t=e.basename,r=$.getPath(e.filename);this.setState({value:t,path:r},()=>{this.focusRenameInput()})}}handleKeyDown(e){var{key:t}=e;switch(e.stopPropagation(),t){case"Enter":{e.preventDefault(),this.submitModal();break}case"Escape":{e.preventDefault();var{onCancel:r}=this.props;r();break}}}handleValidationError(e){if(!(e instanceof Kn))throw e;en.debug("Validation error",e),this.setState({validationError:e})}handleOverwriteCancel(){this.setState({showOverwriteModal:!1,isSubmitting:!1})}handleOverwriteConfirm(){this.setState({showOverwriteModal:!1});var{onSubmit:e}=this.props,{path:t,value:r}=this.state;en.debug("handleOverwriteConfirm",t,r),e("".concat(t).concat(r),!0)}handleExtensionChangeCancel(){en.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:r}=e,i=$.replaceExtension(t,r);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){en.debug("handleExtensionChangeConfirm"),this.setState({showExtensionChangeModal:!1}),this.submitModal(!0)}focusRenameInput(){var e=this.inputRef.current;if(e){var{type:t}=this.props,{value:r}=e,i=t==="directory"?r.length:r.lastIndexOf(".");e.focus(),e.setSelectionRange(0,i>0?i:r.length)}}submitModal(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.setState(t=>{var{prevExtension:r,value:i,path:o}=t,{notifyOnExtensionChange:a,type:s}=this.props;en.debug("submitModal",r,i);var l=$.getExtension(i);return a&&!e&&r!==null&&r!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(o,i,!0).then(d=>{var{onSubmit:h}=this.props;h("".concat(o).concat(i))}).catch(d=>{if(d instanceof Dr&&s!=="directory"&&d.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw d}).catch(d=>{throw Ee.isCanceled(d)&&this.setState({isSubmitting:!1}),d}).catch(this.handleValidationError).catch(ln.handleError),{isSubmitting:!0,showExtensionChangeModal:!1,newExtension:void 0})})}handleBreadcrumbSelect(e){this.setState({path:e})}renderPathButtons(e){var t=e.split("/");return t.pop(),t.map((r,i)=>{for(var o="",a=0;a<i;a+=1)o+="".concat(t[a],"/");return o+="".concat(r,"/"),u.jsxs(H.Fragment,{children:[u.jsx(se,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(o),"aria-label":i===0?"Home":void 0,icon:i===0?u.jsx(ue,{icon:su,transform:"right-1.6"}):void 0,tooltip:i===0?"Home":void 0,children:r}),"/"]},o)})}render(){var{storage:e,isOpen:t,onCancel:r,placeholder:i,title:o,type:a}=this.props,{isSubmitting:s,path:l,showExtensionChangeModal:d,showOverwriteModal:h,validationError:c,value:f,prevExtension:v,newExtension:p}=this.state,g=a==="directory",y=$.fileExtensionToString(v),P=$.fileExtensionToString(p),O=g?"Create":"Save",_=g?"New folder name":"Save file as";return u.jsxs(u.Fragment,{children:[u.jsxs(hs,{isOpen:t,toggle:r,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[u.jsx(cs,{toggle:r,children:o}),u.jsx(ms,{children:u.jsx("form",{children:u.jsxs("div",{className:"d-flex flex-column new-file-modal-content",children:[u.jsxs("div",{className:"flex-grow-0 mb-4",children:[u.jsx("label",{htmlFor:"file-name-input",children:_}),u.jsx("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:Z("form-control",{"is-invalid":c}),value:f,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),c&&u.jsx("div",{className:"invalid-feedback",children:ln.getValidationMessage(c)})]}),u.jsxs("div",{className:"flex-grow-0",children:[u.jsx("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),u.jsx("div",{className:"flex-grow-1 file-explorer-container",children:u.jsx(Ji,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),u.jsxs(Hs,{children:[u.jsx(se,{kind:"secondary",onClick:r,children:"Cancel"}),u.jsx(se,{kind:"primary",disabled:s,onClick:this.handleModalSubmit,children:O})]})]}),u.jsx(dn,{isOpen:h,headerText:"Confirm overwrite",bodyText:"File with this name already exists, are you sure you want to overwrite it?",onCancel:this.handleOverwriteCancel,onConfirm:this.handleOverwriteConfirm,cancelButtonText:"Cancel",confirmButtonText:"Overwrite"}),u.jsx(dn,{isOpen:d,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(y,'" to "').concat(P,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(y,'"'),confirmButtonText:'Use "'.concat(P,'"')})]})}}Wt(ln,"propTypes",{isOpen:S.bool,title:S.string.isRequired,defaultValue:S.string,type:S.oneOf(["file","directory"]).isRequired,onSubmit:S.func,onCancel:S.func,placeholder:S.string,storage:S.shape({}).isRequired,notifyOnExtensionChange:S.bool});Wt(ln,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(n,e)=>{},onCancel:()=>{}});const cd=ln;function oC(n){var{createFile:e,createFolder:t,onSearchChange:r,defaultSearchText:i=""}=n;return u.jsxs("div",{className:"file-explorer-toolbar",children:[u.jsxs("div",{className:"file-explorer-toolbar-buttons",children:[u.jsx(se,{kind:"ghost",icon:Ps,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),u.jsx(se,{kind:"ghost",icon:lu,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),r&&u.jsx("div",{className:"file-explorer-toolbar-search",children:u.jsx(nc,{value:i,onChange:r,placeholder:"Search by name"})})]})}function Qa(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function aC(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Qa(o,r,i,a,s,"next",l)}function s(l){Qa(o,r,i,a,s,"throw",l)}a(void 0)})}}function md(n,e,t){return e=sC(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sC(n){var e=lC(n,"string");return typeof e=="symbol"?e:String(e)}function lC(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var tn=B.module("FileExplorerPanel"),dC=(n,e)=>{var t=Cl(n),r=dr(n,e.localDashboardId),{session:i,config:o}=r??{},a=o?.type;return{fileStorage:t,language:a,session:i}},uC=Dn(dC,null,null,{forwardRef:!0});function hC(n){var e=n;return e!=null&&typeof e.button=="number"}class In extends H.Component{static handleError(e){tn.error(e)}static isFocusEvent(e){return hC(e)?e.detail>=2:!0}constructor(e){super(e),this.handleFileSelect=this.handleFileSelect.bind(this),this.handleCopyFile=this.handleCopyFile.bind(this),this.handleCreateFile=this.handleCreateFile.bind(this),this.handleCreateDirectory=this.handleCreateDirectory.bind(this),this.handleCreateDirectoryCancel=this.handleCreateDirectoryCancel.bind(this),this.handleCreateDirectorySubmit=this.handleCreateDirectorySubmit.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleRename=this.handleRename.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this);var{session:t,language:r}=e;this.state={isShown:!1,language:r,session:t,showCreateFolder:!1,focusedFilePath:"/"}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){var{glEventHub:e}=this.props,{session:t,language:r}=this.state,i={language:r,value:""};tn.debug("handleCreateFile",t,r,i),e.emit(de.CREATE_NOTEBOOK,t,r,i)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){tn.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){tn.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(In.handleError)}handleCopyFile(e){var t=this;return aC(function*(){var{fileStorage:r}=t.props;if(ht(e)){tn.error("Invalid item in handleCopyItem",e);return}var i=yield $.getUniqueCopyFileName(r,e.filename);yield r.copyFile(e.filename,i)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(r=>{t.emit(de.CLOSE_FILE,{id:r.filename,itemName:r.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=$.makePath(e[0].filename):t=$.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(tn.debug("fileSelect",e),e.type!=="directory"){var r=In.isFocusEvent(t),i={id:e.filename,itemName:e.filename},{glEventHub:o}=this.props,{session:a,language:s}=this.state,l={value:null,language:s};o.emit(de.SELECT_NOTEBOOK,a,s,l,i,r)}}handleRename(e,t){var{glEventHub:r}=this.props;tn.debug("handleRename",e,t),r.emit(de.RENAME_FILE,e,t)}handleSessionOpened(e,t){var{language:r}=t;this.setState({session:e,language:r})}handleSessionClosed(){this.setState({session:void 0,language:void 0})}handleShow(){this.setState({isShown:!0})}isHidden(){var{glContainer:e}=this.props,{isHidden:t}=e;return t}render(){var{fileStorage:e,glContainer:t,glEventHub:r}=this.props,{isShown:i,showCreateFolder:o,focusedFilePath:a}=this.state;return u.jsxs(lr,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:r,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[u.jsx(oC,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&u.jsx(Ji,{isMultiSelect:!0,storage:e,onCopy:this.handleCopyFile,onCreateFile:this.handleCreateFile,onCreateFolder:this.handleCreateDirectory,onDelete:this.handleDelete,onRename:this.handleRename,onSelect:this.handleFileSelect,onSelectionChange:this.handleSelectionChange}),u.jsx(cd,{isOpen:o,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:a})]})}}md(In,"COMPONENT","FileExplorerPanel");md(In,"TITLE","File Explorer");var cC=uC(In);const mC=cC;function er(n,e,t){return e=fC(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fC(n){var e=vC(n,"string");return typeof e=="symbol"?e:String(e)}function vC(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ja=B.module("LogPanel");class Yr extends m.PureComponent{constructor(e){super(e),er(this,"isBottomVisible",void 0),er(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){Ja.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){Ja.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){var{glContainer:e,glEventHub:t}=this.props,{session:r}=this.state;return u.jsxs(lr,{componentPanel:this,glContainer:e,glEventHub:t,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[r==null&&u.jsx("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),r!=null&&u.jsx(Wf,{session:r,ref:i=>{this.logView=i}})]})}}er(Yr,"defaultProps",{session:null});er(Yr,"COMPONENT","LogPanel");er(Yr,"TITLE","Log");var gC=(n,e)=>{var t;return{session:(t=dr(n,e.localDashboardId))===null||t===void 0?void 0:t.session}},pC=Dn(gC,null,null,{forwardRef:!0})(Yr);const bC=pC;function es(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function ts(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){es(o,r,i,a,s,"next",l)}function s(l){es(o,r,i,a,s,"throw",l)}a(void 0)})}}function ns(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function He(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ns(Object(t),!0).forEach(function(r){Ne(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ns(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ne(n,e,t){return e=yC(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yC(n){var e=CC(n,"string");return typeof e=="symbol"?e:String(e)}function CC(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var SC=m.lazy(()=>Ts(()=>import("./MarkdownNotebook-c90d577f.js"),["./MarkdownNotebook-c90d577f.js","./vendor-e600113a.js","./helpers-de833af9.js","./vendor-fb3fd713.css","./index-0868e7f5.js","./monaco-b5248072.js","./monaco-f18fde03.css","./index-13e1b819.css","./mathjax-d44a0e6a.js","./MarkdownNotebook-9207e775.css"],import.meta.url)),le=B.module("NotebookPanel"),rs=400;class Te extends m.Component{static handleError(e){Ee.isCanceled(e)||le.error(e)}static unsavedNotebookCount(){return document.querySelectorAll(".".concat(Te.UNSAVED_INDICATOR_CLASS_NAME,".").concat(Te.UNSAVED_STATUS_CLASS_NAME)).length}static languageFromFileName(e){var t=$.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),Ne(this,"pending",void 0),Ne(this,"debouncedSavePanelState",void 0),Ne(this,"debouncedLoad",void 0),Ne(this,"notebook",void 0),Ne(this,"tabTitleElement",void 0),Ne(this,"tabInitOnce",void 0),Ne(this,"editor",void 0),Ne(this,"getSettings",yt((f,v)=>He(He({},f),{},{minimap:{enabled:v}}))),Ne(this,"getOverflowActions",yt((f,v)=>[{title:"Find",icon:hu,action:this.handleFind,group:ee.groups.high,shortcut:ke.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:fs,action:this.handleCopy,group:ee.groups.medium,order:20},{title:"Rename File",icon:cu,action:this.handleShowRename,group:ee.groups.medium,order:30},{title:"Delete File",icon:Ss,action:this.handleDelete,group:ee.groups.medium,order:40},{title:"Show Minimap",icon:f?Vn:void 0,action:this.handleMinimapChange,group:ee.groups.low,shortcut:ke.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:v?Vn:void 0,action:this.handleWordWrapChange,group:ee.groups.low,shortcut:ke.NOTEBOOK.WORDWRAP,order:30}])),this.handleCloseCancel=this.handleCloseCancel.bind(this),this.handleCloseDiscard=this.handleCloseDiscard.bind(this),this.handleCloseSave=this.handleCloseSave.bind(this),this.handleCopy=this.handleCopy.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleDeleteConfirm=this.handleDeleteConfirm.bind(this),this.handleDeleteCancel=this.handleDeleteCancel.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleEditorChange=this.handleEditorChange.bind(this),this.handleFind=this.handleFind.bind(this),this.handleMinimapChange=this.handleMinimapChange.bind(this),this.handleWordWrapChange=this.handleWordWrapChange.bind(this),this.handleLinkClick=this.handleLinkClick.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handlePanelDropped=this.handlePanelDropped.bind(this),this.handleRenameFile=this.handleRenameFile.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRunCommand=this.handleRunCommand.bind(this),this.handleRunAll=this.handleRunAll.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.handleSave=this.handleSave.bind(this),this.handleSaveAsCancel=this.handleSaveAsCancel.bind(this),this.handleSaveAsSubmit=this.handleSaveAsSubmit.bind(this),this.handleSaveError=this.handleSaveError.bind(this),this.handleSaveSuccess=this.handleSaveSuccess.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleShowRename=this.handleShowRename.bind(this),this.handleTab=this.handleTab.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabClick=this.handleTabClick.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleTransformLinkUri=this.handleTransformLinkUri.bind(this),this.handleOverwrite=this.handleOverwrite.bind(this),this.handlePreviewPromotion=this.handlePreviewPromotion.bind(this),this.getDropdownOverflowActions=this.getDropdownOverflowActions.bind(this),this.pending=new Mn,this.debouncedSavePanelState=Pn(this.savePanelState.bind(this),rs),this.debouncedLoad=Pn(this.load.bind(this),rs),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;var{isDashboardActive:t,session:r,sessionLanguage:i,panelState:o}=e,a={value:"",language:"",wordWrap:"off"},s=null,{isPreview:l}=e;o!=null&&({fileMetadata:s=s,isPreview:l=l,settings:a=a}=o);var d=s!=null&&$.hasPath(s.itemName),h=d===!0&&a.value!=null||!d&&a.value!=null&&a.value.length>0,c=h?1:0;this.state={error:void 0,isDashboardActive:t,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:c,fileMetadata:s,settings:a,session:r,sessionLanguage:i,panelState:{fileMetadata:s,settings:a},showCloseModal:!1,showDeleteModal:!1,showSaveAsModal:!1,scriptCode:""},le.debug("constructor",e,this.state)}componentDidMount(){var{glContainer:e,glEventHub:t}=this.props,{tab:r}=e;r!=null&&this.initTab(r),this.initNotebookContent(),t.on(de.RENAME_FILE,this.handleRenameFile),t.on(te.DROPPED,this.handlePanelDropped),e.on(de.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion)}componentDidUpdate(e,t){var{isPreview:r,settings:i}=this.state,{wordWrap:o}=i,{defaultNotebookSettings:a}=this.props;r!==t.isPreview&&this.setPreviewStatus(),o!==t.settings.wordWrap&&(this.updateEditorWordWrap(),this.debouncedSavePanelState()),a.isMinimapEnabled!==e.defaultNotebookSettings.isMinimapEnabled&&this.updateEditorMinimap()}componentWillUnmount(){this.debouncedSavePanelState.flush(),this.pending.cancel();var{glEventHub:e,glContainer:t}=this.props,{fileMetadata:r,isPreview:i}=this.state;e.off(de.RENAME_FILE,this.handleRenameFile),e.off(te.DROPPED,this.handlePanelDropped),t.off(de.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion),e.emit(de.UNREGISTER_FILE,r,i)}initTab(e){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(e)}initTabCloseOverride(){var{glContainer:e}=this.props;e.beforeClose(t=>{if(t?.force===!0)return!0;var{changeCount:r,savedChangeCount:i}=this.state;return r!==i?(this.setState({showCloseModal:!0}),!1):!0})}initTabClasses(e){var t=e.element.get(0);k(t);var r=t.querySelector(".lm_title");this.tabTitleElement=r,r?.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){var{changeCount:e,savedChangeCount:t,settings:r}=this.state,{value:i}=r;if(e!==t&&this.notebook){var o=this.notebook.getValue();return o??i}return i}initNotebookContent(){var{fileMetadata:e,settings:t,isPreview:r}=this.state;if(e&&e.id){le.debug("Init content from file"),this.registerFileMetadata(e,r),this.load();return}if(t.value!=null){le.debug("Use content passed in the settings prop"),this.handleLoadSuccess();return}this.handleLoadError(new Error("Missing file metadata"))}closeFileTabById(e){var{glEventHub:t}=this.props;t.emit(de.CLOSE_FILE,{id:e})}registerFileMetadata(e,t){var{glEventHub:r,metadata:i}=this.props,{id:o}=i;r.emit(de.REGISTER_FILE,o,e,t)}renameTab(e,t){var{glEventHub:r}=this.props;r.emit(de.RENAME,e,t)}load(){var{fileMetadata:e,settings:t}=this.state;k(e);var{id:r}=e,{fileStorage:i}=this.props;this.pending.add(i.loadFile(r)).then(o=>{var a;le.debug("Loaded file",o);var{filename:s}=o,{itemName:l}=this.state;if(s!==l){var{metadata:d}=this.props,{id:h}=d;this.renameTab(h,$.getBaseName(s))}var c=He(He({},t),{},{language:(a=Te.languageFromFileName(s))!==null&&a!==void 0?a:""});t.value==null&&(c.value=o.content),t.wordWrap===void 0&&(t.wordWrap="off"),this.setState({fileMetadata:{id:s,itemName:s},settings:c}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){var{fileMetadata:e}=this.state;if(e&&$.hasPath(e.itemName)){var t=this.getNotebookValue();return t!==void 0?(this.saveContent(e.itemName,t),!0):!1}return this.setState({showSaveAsModal:!0}),!1}saveContent(e,t){le.debug("saveContent",e,t),this.updateSavedChangeCount();var{fileStorage:r}=this.props;this.pending.add(r.saveFile({filename:e,content:t,basename:e})).then(this.handleSaveSuccess).catch(this.handleSaveError)}updateSavedChangeCount(){this.setState(e=>{var{changeCount:t}=e;return{savedChangeCount:t}})}setPreviewStatus(){if(this.tabTitleElement){var{isPreview:e}=this.state;le.debug("setPreviewStatus",this.tabTitleElement,e),e?this.tabTitleElement.classList.add("is-preview"):this.tabTitleElement.classList.remove("is-preview")}}handlePreviewPromotion(){this.removePreviewStatus()}savePanelState(){this.setState(e=>{var{changeCount:t,savedChangeCount:r,fileMetadata:i,isPreview:o,settings:a}=e,s=this.getNotebookValue(),l=t!==r?s:void 0,d=He(He({},a),{},{value:s}),h=He(He({},a),{},{value:l}),c={settings:h,fileMetadata:i,isPreview:o};return le.debug("Saving panel state",c),{settings:d,panelState:c}})}handleCloseDiscard(){this.setState({showCloseModal:!1});var{glContainer:e}=this.props;e.close({force:!0})}handleCloseSave(){if(this.setState({showCloseModal:!1}),this.save()){var{glContainer:e}=this.props;e.close({force:!0})}}handleCloseCancel(){this.setState({showCloseModal:!1})}handleOverwrite(e){var{glEventHub:t}=this.props;t.emit(de.CLOSE_FILE,{id:e,itemName:e},{force:!0}),this.focus()}handleCopy(){var e=this;return ts(function*(){var{fileStorage:t,glEventHub:r,session:i}=e.props,{fileMetadata:o,settings:a}=e.state;k(o);var{language:s}=a,{itemName:l}=o,d=yield $.getUniqueCopyFileName(t,l);le.debug("handleCopy",o,l,d),yield t.copyFile(l,d);var h={id:d,itemName:d},c={value:null,language:s};r.emit(de.SELECT_NOTEBOOK,i,s,c,h,!0)})()}handleDelete(){le.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var e=this;return ts(function*(){var{fileStorage:t,glContainer:r,glEventHub:i}=e.props,{fileMetadata:o}=e.state;le.debug("handleDeleteConfirm",o?.itemName),e.setState({showDeleteModal:!1}),o&&($.hasPath(o.itemName)&&(yield $.fileExists(t,o.itemName))?(i.emit(de.CLOSE_FILE,o,{force:!0}),t.deleteFile(o.itemName)):r.close({force:!0}))})()}handleDeleteCancel(){this.setState({showDeleteModal:!1})}handleEditorInitialized(e){this.editor=e}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(e){le.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(t=>{var{changeCount:r,savedChangeCount:i}=t,{isUndoing:o,isRedoing:a}=e;return o?{changeCount:r-1,savedChangeCount:i}:!a&&r<i?{changeCount:r+1,savedChangeCount:0}:{changeCount:r+1,savedChangeCount:i}}),this.debouncedSavePanelState()}handleFind(){this.notebook&&this.notebook.toggleFind()}updateEditorMinimap(){if(this.editor){var{defaultNotebookSettings:e}=this.props;this.editor.updateOptions({minimap:{enabled:e.isMinimapEnabled}})}}handleMinimapChange(){var e,{defaultNotebookSettings:t,updateSettings:r}=this.props,i={defaultNotebookSettings:{isMinimapEnabled:!((e=t.isMinimapEnabled)!==null&&e!==void 0&&e)}};r(i)}updateEditorWordWrap(){if(this.editor){var{settings:e}=this.state,{wordWrap:t}=e;this.editor.updateOptions({wordWrap:t})}}handleWordWrapChange(){this.editor&&this.setState(e=>{var{settings:t}=e,r=t.wordWrap==="on"?"off":"on";return{settings:He(He({},t),{},{wordWrap:r})}})}handleLinkClick(e){var{notebooksUrl:t,session:r,sessionLanguage:i}=this.props,{href:o}=e.currentTarget;if(!(!o||!o.startsWith(t))){e.stopPropagation(),e.preventDefault();var a="/".concat(o.substring(t.length)).replace(/%20/g," ");if(a==="/"){le.debug("Ignoring invalid notebook link",a);return}le.debug("Notebook link clicked, opening",a);var{glEventHub:s}=this.props,l={value:null,language:i},d={id:a,itemName:a};s.emit(de.SELECT_NOTEBOOK,r,i,l,d)}}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(e){var t=e;Ee.isCanceled(t)||(Ee.isTimedOut(t)&&(t=new Error("File not found.")),le.error(t),this.setState({error:t,isLoading:!1}))}handleSave(){le.debug("handleSave"),this.save()}handleSaveSuccess(e){var t,{fileStorage:r}=this.props,i={id:e.filename,itemName:e.filename},o=(t=Te.languageFromFileName(e.filename))!==null&&t!==void 0?t:"";this.setState(a=>{var{fileMetadata:s}=a,l=He(He({},a.settings),{},{language:o});return le.debug("handleSaveSuccess",i,s,l),s&&$.hasPath(s.itemName)&&s.itemName!==i.itemName&&(le.debug("handleSaveSuccess deleting old file",s.itemName),r.deleteFile(s.itemName).catch(Te.handleError)),{fileMetadata:i,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(i,!1)}handleSaveError(e){Ee.isCanceled(e)||(this.setState({savedChangeCount:0}),le.error(e))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;r&&this.handleOverwrite(e),le.debug("handleSaveAsSubmit",e);var{fileMetadata:i}=this.state;if(i){var{itemName:o}=i,a=(t=this.getNotebookValue())!==null&&t!==void 0?t:"";if(this.setState({showSaveAsModal:!1}),$.getBaseName(o)!==$.getBaseName(e)){var{metadata:s}=this.props,{id:l}=s;this.renameTab(l,$.getBaseName(e))}this.saveContent(e,a)}}handleRenameFile(e,t,r){var{fileMetadata:i,panelState:o}=this.state,{glContainer:a}=this.props;if(i?.itemName==="/".concat(t)&&r&&JSON.stringify(o)!==JSON.stringify(r)){a.close();return}i&&i.id===e&&(this.setState({fileMetadata:{id:t,itemName:t}}),this.debouncedSavePanelState())}handleResize(){var e;(e=this.notebook)===null||e===void 0||e.updateDimensions()}handleRunCommand(e){this.runCommand(e)}handleRunAll(){var e;if(!this.notebook){le.error("Editor is not initialized.");return}this.runCommand((e=this.notebook.getValue())!==null&&e!==void 0?e:void 0)}handleRunSelected(){if(!this.notebook){le.error("Editor is not initialized.");return}this.runCommand(this.notebook.getSelectedCommand())}handleSessionOpened(e,t){var{language:r}=t;this.setState({session:e,sessionLanguage:r})}handleSessionClosed(){this.setState({session:void 0,sessionLanguage:void 0})}handleShow(){var e;le.debug("handleShow"),(e=this.notebook)===null||e===void 0||e.updateDimensions()}handlePanelDropped(e){var{metadata:{id:t}}=this.props;e===t&&this.forceUpdate()}handleShowRename(){this.setState({showSaveAsModal:!0})}handleTab(e){le.debug("NotebookPanel tab event",e),this.initTab(e)}handleTabFocus(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];le.debug("handleTabFocus",...t);var{glContainer:i}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!i.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){le.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handleTabClick(e){le.debug("handle NotebookPanel tab click"),this.focus(),e.detail===2&&this.removePreviewStatus()}handleTransformLinkUri(e){var{notebooksUrl:t}=this.props,{fileMetadata:r}=this.state;if(e.endsWith("/"))return e;if(e.startsWith("/"))return"".concat(t).concat(e.substring(1));var i=r?.itemName;if(i===void 0)return e;i.charAt(0)==="/"&&(i=i.substring(1));var o=new URL(i,t);return new URL(e,o).href}focus(){requestAnimationFrame(()=>{this.notebook&&this.notebook.focus()})}createNotebook(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{glEventHub:i}=this.props,{session:o,sessionLanguage:a,settings:s}=this.state,l=He(He({},s),{},{language:t,value:r}),d={id:null,itemName:e};le.debug("handleCreateNotebook",o,a,l,d),i.emit(de.CREATE_NOTEBOOK,o,a,l,d)}runCommand(e){if(e===void 0||e===""){le.debug("Ignoring empty command.");return}this.removePreviewStatus();var{glEventHub:t}=this.props;t.emit(it.SEND_COMMAND,e,!1,!0)}removePreviewStatus(){this.setState(e=>{var{isPreview:t}=e;if(t){var{fileMetadata:r}=this.state;return r&&this.registerFileMetadata(r,!1),{isPreview:!1}}return null})}getDropdownOverflowActions(){var e,t,{defaultNotebookSettings:r}=this.props,{settings:i}=this.state;return this.getOverflowActions((e=r.isMinimapEnabled)!==null&&e!==void 0?e:!1,this.getSettings(i,(t=r.isMinimapEnabled)!==null&&t!==void 0?t:!1).wordWrap==="on")}render(){var e,t,r,{fileStorage:i,glContainer:o,glContainer:{tab:a},glEventHub:s,defaultNotebookSettings:l}=this.props,{changeCount:d,savedChangeCount:h,error:c,isDashboardActive:f,isLoaded:v,isLoading:p,isPreview:g,fileMetadata:y,session:P,sessionLanguage:O,settings:_,showCloseModal:R,showDeleteModal:U,showSaveAsModal:Q}=this.state,N=f&&!o.isHidden&&!g,W=(e=y?.itemName)!==null&&e!==void 0?e:Te.DEFAULT_NAME,j=W.endsWith(".md"),Y=y?.id!=null,ne=this.getSettings(_,(t=l.isMinimapEnabled)!==null&&t!==void 0?t:!1),F=P!=null,q=O===ne.language,K=!v||!F||!q,A=!v,V=[{action:this.handleSave,shortcut:Kt.SAVE},{action:this.handleMinimapChange,shortcut:ke.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:ke.NOTEBOOK.WORDWRAP}],z=Si.getDisabledRunTooltip(F,q,"Notebook extension","Run"),me=Si.getDisabledRunTooltip(F,q,"Notebook extension","Run Selected"),je=[{title:Y?"Rename":"Save As…",order:10,group:ee.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:ee.groups.high,order:20}],De=a?.element.find(".lm_title_before").get(0);return u.jsxs(u.Fragment,{children:[De!=null&&Hr.createPortal(u.jsx("span",{className:Z(Te.UNSAVED_INDICATOR_CLASS_NAME,{[Te.UNSAVED_STATUS_CLASS_NAME]:d!==h})}),De),u.jsxs(lr,{className:"notebook-container",componentPanel:this,glContainer:o,glEventHub:s,onTab:this.handleTab,onResize:this.handleResize,onShow:this.handleShow,onTabClicked:this.handleTabClick,onTabFocus:this.handleTabFocus,onTabBlur:this.handleTabBlur,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,additionalActions:je,renderTabTooltip:()=>W,children:[!j&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"notebook-toolbar",children:[u.jsxs("span",{children:[u.jsx(se,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:K,icon:u.jsx(ue,{icon:_s,transform:"grow-4"}),tooltip:"Run ".concat(ke.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),z!=null&&u.jsx(qt,{children:z})]}),u.jsxs("span",{children:[u.jsx(se,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:K,icon:u.jsx(ue,{icon:du,transform:"grow-4"}),tooltip:"Run Selected ".concat(ke.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),me!=null&&u.jsx(qt,{children:me})]}),u.jsx(se,{kind:"ghost",className:"mr-auto",disabled:A,onClick:this.handleSave,icon:uu,tooltip:"Save ".concat(Kt.SAVE.getDisplayText()),"aria-label":"Save"}),u.jsx(se,{kind:"ghost",className:"btn-overflow",disabled:A,icon:Es,tooltip:"More Actions...",onClick:()=>{},children:u.jsx(Gn,{actions:this.getDropdownOverflowActions,popperOptions:Te.POPPER_OPTIONS})})]}),u.jsx(Pf,{isLoaded:v,isLoading:p,error:c,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:P,sessionLanguage:O,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:ne,focusOnMount:N,ref:b=>{this.notebook=b}})]}),j&&u.jsx(m.Suspense,{fallback:u.jsx(un,{}),children:u.jsx(SC,{content:(r=ne.value)!==null&&r!==void 0?r:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri})}),u.jsx(cd,{isOpen:Q,type:"file",defaultValue:W,title:Y?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:i}),u.jsx(dn,{isOpen:U,headerText:'Are you sure you want to delete "'.concat(W,'"?'),bodyText:"You cannot undo this action.",onCancel:this.handleDeleteCancel,onConfirm:this.handleDeleteConfirm,confirmButtonText:"Delete"}),u.jsx(dn,{isOpen:R,headerText:"Do you want to save the changes you made to ".concat(W,"?"),bodyText:"Your changes will be lost if you don't save them.",onCancel:this.handleCloseCancel,onDiscard:this.handleCloseDiscard,onConfirm:this.handleCloseSave,discardButtonText:"Discard Changes",confirmButtonText:"Save"}),u.jsx(ee,{actions:V})]})]})}}Ne(Te,"COMPONENT","NotebookPanel");Ne(Te,"POPPER_OPTIONS",{placement:"bottom-end"});Ne(Te,"DEFAULT_NAME","Untitled");Ne(Te,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");Ne(Te,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");Ne(Te,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,defaultNotebookSettings:{isMinimapEnabled:!0}});var wC=(n,e)=>{var t=Cl(n),r=Vv(n),i=dr(n,e.localDashboardId),{session:o,config:a}=i??{},{type:s}=a??{};return{fileStorage:t,defaultNotebookSettings:r,session:o,sessionLanguage:s}},EC=Dn(wC,{updateSettings:Yv},null,{forwardRef:!0})(Te);const nn=EC;function is(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function os(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?is(Object(t),!0).forEach(function(r){_C(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):is(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function _C(n,e,t){return e=PC(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function PC(n){var e=TC(n,"string");return typeof e=="symbol"?e:String(e)}function TC(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var be=B.module("ConsolePlugin");function as(n){return n.notebook!==void 0}function OC(n){yb(n)}function aw(n){OC(n);var{id:e,hydrateConsole:t,layout:r,panelManager:i,registerComponent:o,notebooksUrl:a}=n,s=m.useRef(0),[l,d]=m.useState(new Map),[h,c]=m.useState(new Map),f=Li(),v=m.useCallback(()=>i.getLastUsedPanelOfType(mi),[i]),p=m.useCallback((b,w)=>{d(T=>new Map(T.set(b,w)))},[d]),g=m.useCallback(b=>{d(w=>(w.delete(b),new Map(w)))},[d]),y=m.useCallback((b,w)=>{c(T=>new Map(T.set(b,w)))},[c]),P=m.useCallback(b=>{c(w=>(w.delete(b),new Map(w)))},[c]),O=m.useCallback(function(b){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,T=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,G=b&&b.trim();if(!G)be.info("Ignoring empty code");else{var J=v();if(!J||!(J instanceof mi.WrappedComponent)){be.error("Console panel not found");return}be.debug("Send command: ",b,w,T),J.addCommand(b,w,T)}},[v]),_=m.useCallback(b=>{f(gy(e,b))},[f,e]),R=m.useCallback(b=>{var{language:w}=b,T=w==="python"?"py":w,G=null;return T==null?(be.debug("No extension for language",w),G="Untitled-".concat(s.current)):G="Untitled-".concat(s.current,".").concat(T),s.current+=1,G},[]),U=m.useCallback(function(b){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{id:T}=b;if(T!=null&&l.has(T))return l.get(T);if(T!=null&&h.has(T))return h.get(T);if(w)return Mt()},[l,h]),Q=m.useCallback((b,w)=>{x.renameComponent(r.root,{id:b},w)},[r.root]),N=m.useCallback((b,w)=>{be.debug("Rename file panel",b,w);var T;if(l.has(b)&&(T=l.get(b),g(b),T!=null&&p(w,T)),h.has(b)&&(T=h.get(b),P(b),T!=null&&y(w,T)),T===void 0){be.debug2("File ".concat(b," isn't open, no need to rename the tab"));return}Q(T,$.getBaseName(w))},[l,h,Q,p,y,g,P]),W=m.useCallback(b=>{var w=U(b,!1);if(w==null){be.error("Could not find panel id for file metadata",b);return}x.activateTab(r.root,{id:w})},[U,r.root]),j=m.useCallback((b,w,T)=>{if(be.debug("registerFilePanel",b,w,T),w==null||w.id==null){be.debug("Ignore empty file id",w);return}var{id:G}=w;if(T){y(G,b);return}if(l.has(G)){var J=l.get(G);if(b===J){be.debug("Update tab title for file ".concat(G));var{itemName:Qe}=w;N(G,Qe)}else be.error("File ".concat(G," already associated with a different tab ").concat(J));return}p(G,b),h.has(G)&&P(G)},[l,h,N,p,y,P]),Y=m.useCallback((b,w)=>{if(be.debug("unregisterFileTab",b,w),b==null||b.id==null){be.debug("Ignore empty file id",b);return}var{id:T}=b;if(w){P(T);return}g(T)},[g,P]),ne=m.useCallback((b,w)=>{be.debug("closeFilePanel",b);var{id:T}=b,G=null,J=!1;if(l.has(T))G=l.get(T);else if(h.has(T))G=h.get(T),J=!0;else{be.debug("File ".concat(T," isn't open, ignore close event"));return}Y(b,J),x.closeComponent(r.root,{id:G},w)},[r.root,l,h,Y]),F=m.useCallback(b=>{var{itemName:w}=b;return $.getBaseName(w)},[]),q=m.useCallback(b=>{var{id:w}=b;return be.debug("fileIsOpen",b,w,l),w!=null&&l.has(w)},[l]),K=m.useCallback(b=>{var{id:w}=b;return be.debug("fileIsOpenAsPreview",b,w,h),w!=null&&h.has(w)},[h]),A=m.useCallback(b=>{if(b!=null){var w=i.getOpenedPanelById(b);w&&as(w)&&w.focus()}},[i]),V=m.useCallback(b=>{var{id:w,settings:T,fileMetadata:G,session:J,sessionLanguage:Qe,isPreview:I=!1}=b,X={settings:T,fileMetadata:G},re=F(G);return{type:"react-component",component:nn.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:w},session:J,sessionLanguage:Qe,panelState:X,isPreview:I,notebooksUrl:a},title:re,id:w}},[F,e,a]),z=m.useCallback(function(b,w,T){var G=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{id:null,itemName:R(T)},J=U(G);if(q(G)&&J!=null){be.debug("File is already open, focus panel"),W(G),A(J);return}var Qe=x.getStackForComponentTypes(r.root,[nn.COMPONENT]),I=V({id:J,settings:T,fileMetadata:G,session:b,sessionLanguage:w});be.debug("createNotebook",I,l),x.openComponentInStack(Qe,I)},[q,A,R,U,r.root,V,l,W]),me=m.useCallback(function(b,w,T,G){var J=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;be.debug("selectNotebook",G,J);var Qe=q(G),I=K(G),[X]=[...h.values()],re=!J,he=re&&X?X:U(G);if(he==null||he==="")throw new Error("Unable to retrieve or create panelId for metadata",G);if(Qe||I)W(G);else{var _e=x.getStackForComponentTypes(r.root,[nn.COMPONENT]),Jr=V({id:he,settings:T,fileMetadata:G,session:b,sessionLanguage:w,isPreview:re});x.openComponentInStack(_e,Jr)}if(I&&J){var mr=G.id,ei=x.getStackForConfig(r.root,{component:nn.COMPONENT,id:he}),ti=x.getContentItemInStack(ei,{component:nn.COMPONENT,id:he});ti&&qe(ti)&&(ti.container.emit(de.PROMOTE_FROM_PREVIEW),P(mr),p(mr,he))}J&&A(he)},[W,q,K,A,U,r.root,V,h,P,p]),je=m.useCallback(function(b,w){var T=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},G=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,J=i.getLastUsedPanelOfType(nn);J&&as(J)?T!=null&&T.value!=null&&J.notebook!=null&&J.notebook.append(T.value):G&&z(b,w,T)},[z,i]),De=m.useCallback((b,w)=>Ib.hydrate(os(os({},b),{},{notebooksUrl:a}),w),[a]);return Rn(o,mi,t),Rn(o,Sy),Rn(o,mC),Rn(o,bC),Rn(o,nn,De),Me(r.eventHub,it.SEND_COMMAND,O),Me(r.eventHub,it.SETTINGS_CHANGED,_),Me(r.eventHub,de.CLOSE_FILE,ne),Me(r.eventHub,de.CREATE_NOTEBOOK,z),Me(r.eventHub,de.SELECT_NOTEBOOK,me),Me(r.eventHub,de.RENAME,Q),Me(r.eventHub,de.RENAME_FILE,N),Me(r.eventHub,de.SEND_TO_NOTEBOOK,je),Me(r.eventHub,de.REGISTER_FILE,j),Me(r.eventHub,de.UNREGISTER_FILE,Y),null}function Qr(n,e,t){return e=IC(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function IC(n){var e=DC(n,"string");return typeof e=="symbol"?e:String(e)}function DC(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class cr{}Qr(cr,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");Qr(cr,"INPUT_FILTER","ControlType.INPUT_FILTER");Qr(cr,"MARKDOWN","ControlType.MARKDOWN");Qr(cr,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");const sw=cr;export{bS as $,gS as A,se as B,kh as C,Ds as D,pS as E,gl as F,Kt as G,js as H,Ct as I,HC as J,D as K,sw as L,$S as M,Gn as N,Yn as O,Ee as P,Zt as Q,Gr as R,Pc as S,E as T,Dc as U,$i as V,PS as W,rd as X,RS as Y,Yt as Z,Zv as _,Ce as a,Ms as a$,kb as a0,Ae as a1,Kv as a2,GS as a3,dr as a4,iS as a5,Sl as a6,Ib as a7,bu as a8,Os as a9,Uu as aA,nr as aB,qu as aC,Rs as aD,Fs as aE,Ku as aF,Vu as aG,It as aH,Ye as aI,_n as aJ,Rh as aK,nc as aL,uc as aM,ac as aN,L as aO,Hs as aP,Br as aQ,$C as aR,hc as aS,vh as aT,$s as aU,Oc as aV,Ys as aW,Zs as aX,WC as aY,UC as aZ,VC as a_,kS as aa,de as ab,ka as ac,te as ad,jS as ae,nn as af,Ic as ag,AC as ah,ki as ai,aw as aj,ee as ak,dn as al,iw as am,TS as an,CS as ao,OS as ap,ES as aq,_S as ar,qS as as,XS as at,yS as au,wS as av,Nl as aw,SS as ax,Xe as ay,kC as az,dt as b,Oy as b$,zf as b0,qf as b1,we as b2,tv as b3,fv as b4,ov as b5,Be as b6,KC as b7,fl as b8,vv as b9,Eb as bA,Xi as bB,ed as bC,yb as bD,Ob as bE,Yl as bF,AS as bG,LS as bH,nd as bI,Ql as bJ,bb as bK,kr as bL,Lb as bM,xS as bN,NS as bO,Zi as bP,hr as bQ,wy as bR,xy as bS,rw as bT,Iy as bU,Ty as bV,_y as bW,Ey as bX,tw as bY,Py as bZ,nw as b_,vl as ba,qC as bb,YC as bc,zC as bd,GC as be,XC as bf,dv as bg,QC as bh,JC as bi,gv as bj,pv as bk,tS as bl,eS as bm,pl as bn,nS as bo,Nv as bp,Tv as bq,Av as br,FC as bs,x as bt,Rn as bu,Me as bv,Db as bw,FS as bx,qb as by,Nb as bz,C as c,ud as c0,ja as c1,vi as c2,kp as c3,pb as c4,$ as c5,Yi as c6,ow as c7,mi as c8,bC as c9,Cf as cA,ni as cB,jC as cC,RC as cD,Qs as cE,ZC as cF,Kn as cG,Sy as ca,mC as cb,xs as cc,LC as cd,lr as ce,Ns as cf,QS as cg,Mn as ch,US as ci,VS as cj,KS as ck,WS as cl,ld as cm,We as cn,HS as co,ew as cp,BS as cq,ht as cr,dd as cs,ZS as ct,YS as cu,JS as cv,it as cw,Er as cx,zS as cy,gy as cz,Ls as d,Yv as e,sS as f,aS as g,lS as h,rS as i,uS as j,hS as k,cS as l,mS as m,fS as n,Uv as o,oS as p,ge as q,ce as r,qt as s,Ze as t,Tc as u,vS as v,IS as w,BC as x,dS as y,MS as z};
|
|
22
|
-
//# sourceMappingURL=ControlType-
|
|
21
|
+
`)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,pe.bufferTimeout))}stopFlushTimer(){this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=void 0)}updateDimensions(){this.editor&&this.editor.layout()}handleClearClick(){this.clearLogs()}clearLogs(){this.messages=[],this.refreshLogText()}handleFlushTimeout(){this.stopFlushTimer(),this.flush()}handleLogMessage(e){this.messages.push(e),this.editor&&this.isLogItemVisible(e)&&this.queue(e)}handleMenuItemClick(e){this.toggleLogLevel(e)}handleResetClick(){this.resetLogLevels()}handleResize(){this.updateDimensions()}handleToggleAllClick(){this.toggleAll()}render(){var e={placement:"bottom-end"},{shownLogLevels:t}=this.state,r=this.getMenuActions(t);return u.jsxs("div",{className:"log-pane h-100 w-100",children:[u.jsxs("div",{className:"log-pane-menu",children:[u.jsx(se,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:Zd,tooltip:"Clear log"}),u.jsx(se,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:Yd,tooltip:"Log Settings",onClick:()=>{},children:u.jsx(Gn,{actions:r,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),u.jsx("div",{className:"log-pane-editor h-100 w-100",ref:i=>{this.editorContainer=i}})]})}}Ge(pe,"DefaultLogLevels",[Oe.STDOUT,Oe.ERROR,Oe.FATAL,Oe.STDERR,Oe.WARN]);Ge(pe,"AllLogLevels",[Oe.INFO,Oe.STDOUT,Oe.ERROR,Oe.FATAL,Oe.STDERR,Oe.WARN,Oe.DEBUG,Oe.TRACE]);Ge(pe,"bufferTimeout",16);Ge(pe,"maxLogSize",131072);Ge(pe,"truncateSize",65536);const Bf=pe;function Hi(n,e,t){return e=Wf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wf(n){var e=Uf(n,"string");return typeof e=="symbol"?e:String(e)}function Uf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class zr{static isValid(e,t){return!0}static isSameFormat(e,t){throw new Error("isSameFormat not implemented")}static makeFormat(e,t,r){return{label:e,formatString:t,type:r}}format(e,t){return""}}Hi(zr,"TYPE_GLOBAL","type-global");Hi(zr,"TYPE_CONTEXT_PRESET","type-context-preset");Hi(zr,"TYPE_CONTEXT_CUSTOM","type-context-custom");const We=zr;class Vf extends We{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}const Kf=Vf;class zf extends We{format(e){return String.fromCharCode(e)}}const Gf=zf;function Ht(n,e,t){return e=qf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qf(n){var e=Xf(n,"string");return typeof e=="symbol"?e:String(e)}function Xf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ra=B.module("DateTimeColumnFormatter");class dt extends We{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.DateTimeFormat.format(t.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:We.TYPE_CONTEXT_PRESET;return{label:e,formatString:t,type:r}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static makeGlobalFormatStringMap(e,t){var r=t?"'T'":" ",i=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getGlobalFormats(e,t){var r=dt.makeGlobalFormatStringMap(e,t);return[...r.keys()]}static makeFormatStringMap(e,t){var r=t!==void 0&&t?"'T'":" ",i=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd","yyyy-MM-dd".concat(i)],["MM-dd-yyyy","MM-dd-yyyy".concat(i)],["HH:mm:ss","HH:mm:ss".concat(i)],["HH:mm:ss.SSS","HH:mm:ss.SSS".concat(i)],["HH:mm:ss.SSSSSSSSS","HH:mm:ss.SSSSSSSSS".concat(i)],["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(r,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(r,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getFormats(e,t){var r=dt.makeFormatStringMap(e,t);return[...r.keys()]}constructor(e){var{timeZone:t="",showTimeZone:r=!0,showTSeparator:i=!1,defaultDateTimeFormatString:o=dt.DEFAULT_DATETIME_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Ht(this,"dh",void 0),Ht(this,"dhTimeZone",void 0),Ht(this,"defaultDateTimeFormatString",void 0),Ht(this,"showTimeZone",void 0),Ht(this,"showTSeparator",void 0),Ht(this,"formatStringMap",void 0);var a=t||dt.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(a)}catch{ra.error("Unsupported time zone id",a),this.dhTimeZone=e.i18n.TimeZone.getTimeZone(dt.DEFAULT_TIME_ZONE_ID)}this.dh=e,this.defaultDateTimeFormatString=o,this.showTimeZone=r,this.showTSeparator=i,this.formatStringMap=dt.makeFormatStringMap(r,i)}getEffectiveFormatString(e){var t;return(t=this.formatStringMap.get(e))!==null&&t!==void 0?t:e}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,i=this.getEffectiveFormatString(r);try{return this.dh.i18n.DateTimeFormat.format(i,e,this.dhTimeZone)}catch{ra.error("Invalid format arguments")}return""}}Ht(dt,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");Ht(dt,"DEFAULT_TIME_ZONE_ID","America/New_York");function St(n,e,t){return e=Zf(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Zf(n){var e=Yf(n,"string");return typeof e=="symbol"?e:String(e)}function Yf(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Qf=B.module("DecimalColumnFormatter");class Ce extends We{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:We.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return Ce.makeFormat(e,t,We.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return Ce.makeFormat("Custom Format",e,We.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}constructor(e){var{defaultFormatString:t=Ce.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),St(this,"defaultFormatString",void 0),St(this,"dh",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,i)}catch{Qf.error("Invalid format arguments")}return""}}St(Ce,"DEFAULT_FORMAT_STRING","###,##0.0000");St(Ce,"FORMAT_PERCENT",Ce.makePresetFormat("Percent","##0.00%"));St(Ce,"FORMAT_BASIS_POINTS",Ce.makePresetFormat("Basis Points","###,##0 bp",1e4));St(Ce,"FORMAT_MILLIONS",Ce.makePresetFormat("Millions","###,##0.000 mm",1e-6));St(Ce,"FORMAT_SCIENTIFIC_NOTATION",Ce.makePresetFormat("Scientific Notation","0.0000E0"));St(Ce,"FORMAT_ROUND",Ce.makePresetFormat("Round","###,##0"));St(Ce,"FORMAT_ROUND_TWO_DECIMALS",Ce.makePresetFormat("0.00","###,##0.00"));St(Ce,"FORMAT_ROUND_FOUR_DECIMALS",Ce.makePresetFormat("0.0000","###,##0.0000"));class Jf extends We{format(e){return"".concat(e)}}const ev=Jf;function Zn(n,e,t){return e=tv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tv(n){var e=nv(n,"string");return typeof e=="symbol"?e:String(e)}function nv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var rv=B.module("IntegerColumnFormatter");class Ct extends We{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:We.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:r,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;return Ct.makeFormat(e,t,We.TYPE_CONTEXT_PRESET,r)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return Ct.makeFormat("Custom Format",e,We.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}constructor(e){var{defaultFormatString:t=Ct.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Zn(this,"dh",void 0),Zn(this,"defaultFormatString",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(r,i)}catch{rv.error("Invalid format arguments")}return""}}Zn(Ct,"DEFAULT_FORMAT_STRING","###,##0");Zn(Ct,"FORMAT_MILLIONS",Ct.makePresetFormat("Millions","###,##0.000 mm",1e-6));Zn(Ct,"FORMAT_SCIENTIFIC_NOTATION",Ct.makePresetFormat("Scientific Notation","0.0000E0"));class iv extends We{format(e){return e}}function ia(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function oa(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ia(Object(t),!0).forEach(function(r){Bi(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ia(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Bi(n,e,t){return e=ov(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ov(n){var e=av(n,"string");return typeof e=="symbol"?e:String(e)}function av(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var sv=/\s*(\d{4})([-./](\d{1,2}|[a-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/;class we{static makeDateWrapper(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:0,d=arguments.length>8&&arguments[8]!==void 0?arguments[8]:0;if(!t)throw new Error("No timezone provided");var h="".concat(r).padStart(4,"0"),c="".concat(i+1).padStart(2,"0"),f="".concat(o).padStart(2,"0"),v="".concat(a).padStart(2,"0"),p="".concat(s).padStart(2,"0"),g="".concat(l).padStart(2,"0"),y="".concat(d).padStart(9,"0"),P="".concat(h,"-").concat(c,"-").concat(f," ").concat(v,":").concat(p,":").concat(g,".").concat(y);return e.i18n.DateTimeFormat.parse(we.FULL_DATE_FORMAT,P,e.i18n.TimeZone.getTimeZone(t))}static getNextNanos(e){var t=parseInt(e,10),r="0".repeat(9-e.length),i="".concat(t+1).concat(r);return parseInt(i,10)}static getNextDate(e,t,r,i){var{year:o,month:a,date:s,hours:l,minutes:d,seconds:h,nanos:c}=r;if(t.nanos!=null){if(t.nanos.length===9)return null;c=we.getNextNanos(t.nanos),c>999999999&&(h+=1,c=0)}else t.seconds!=null?h+=1:t.minutes!=null?d+=1:t.hours!=null?l+=1:t.date!=null?s+=1:t.month!=null?a+=1:o+=1;var f=new Date(o,a,s,l,d,h);return we.makeDateWrapper(e,i,f.getFullYear(),f.getMonth(),f.getDate(),f.getHours(),f.getMinutes(),f.getSeconds(),c)}static parseMonth(e){var t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;var r=e.trim().toLowerCase();if(r.length>=3){for(var i=0;i<we.months.length;i+=1)if(we.months[i].startsWith(r))return i}return NaN}static parseDateValues(e,t,r,i,o,a,s){var l=parseInt(e,10),d=t!=null?this.parseMonth(t):0,h=r!=null?parseInt(r,10):1,c=i!=null?parseInt(i,10):0,f=o!=null?parseInt(o,10):0,v=a!=null?parseInt(a,10):0,p=s!=null?parseInt(s.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(d)||Number.isNaN(h)||Number.isNaN(c)||Number.isNaN(f)||Number.isNaN(v)||Number.isNaN(p)?null:{year:l,month:d,date:h,hours:c,minutes:f,seconds:v,nanos:p}}static parseDateTimeString(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=sv.exec(e);if(r==null)throw new Error("Unexpected date string: ".concat(e));var[,i,,o,,a,,s,,l,,d,,h,c]=r;if(!t&&c!=null&&c.length>0)throw new Error("Unexpected characters after date string '".concat(e,"': ").concat(c));var f={year:i,month:o,date:a,hours:s,minutes:l,seconds:d,nanos:h};return t?oa(oa({},f),{},{overflow:c}):f}static parseDateRange(e,t,r){var i=t.trim().toLowerCase();if(i.length===0)throw new Error("Cannot parse date range from empty string");if(i==="null")return[null,null];if(i==="today"){var o=new Date(Date.now()),a=we.makeDateWrapper(e,r,o.getFullYear(),o.getMonth(),o.getDate()),s=new Date(o.getFullYear(),o.getMonth(),o.getDate()+1),l=we.makeDateWrapper(e,r,s.getFullYear(),s.getMonth(),s.getDate());return[a,l]}if(i==="yesterday"){var d=new Date(Date.now()),h=new Date(d.getFullYear(),d.getMonth(),d.getDate()-1),c=we.makeDateWrapper(e,r,h.getFullYear(),h.getMonth(),h.getDate()),f=we.makeDateWrapper(e,r,d.getFullYear(),d.getMonth(),d.getDate());return[c,f]}if(i==="now"){var v=new Date(Date.now()),p=e.DateWrapper.ofJsDate(v);return[p,null]}var g=we.parseDateTimeString(i);if(g.year==null&&g.month==null&&g.date==null)throw new Error("Unable to extract year, month, or day ".concat(i));var y=we.parseDateValues(g.year,g.month,g.date,g.hours,g.minutes,g.seconds,g.nanos);if(y==null)throw new Error("Unable to extract date values from ".concat(g));var P=we.makeDateWrapper(e,r,y.year,y.month,y.date,y.hours,y.minutes,y.seconds,y.nanos),O=we.getNextDate(e,g,y,r);return[P,O]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}static trimDateTimeStringTimeZone(e){var{overflow:t=""}=we.parseDateTimeString(e,!0);if(t==="")return e;if(!/^\s[A-Za-z]+/.test(t))throw new Error("Unexpected timezone format in overflow: '".concat(e,"'"));return e.slice(0,-t.length)}}Bi(we,"FULL_DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSSSSS");Bi(we,"months",["january","february","march","april","may","june","july","august","september","october","november","december"]);const si=we;function VC(n,e){return n===e?{operator:"notEq",value:""}:{operator:"eq",value:n}}function KC(n,e,t,r){return function(o){var a=t.trim();if(a==="")return null;var s=cl(e,l=>n.makeSearchTextFilter(l,a,r),"or");return s(o)}}function cl(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"or";return function(i){var o=i?.findColumns(typeof n=="string"?[n]:n);if(o==null||o.length===0)return null;var a=o.map(e);return a.reduce((s,l)=>s[t](l))}}function lv(n,e,t,r){return cl(e,i=>i.filter()[r](n.makeFilterValue(i.type,t)),"or")}function zC(n,e,t,r,i){return function(a){var s=a?.findColumn(e),l=t==="all"||r&&t.size===0;return s==null||l?null:n.makeSelectValueFilter(s,[...t.keys()],i)}}function GC(n){return function(t){return t.filter().isNull().not().and(t.filter().notEq(n.makeFilterValue(t.type,"")))}}function qC(n,e){return function(r){var i=r.filter(),o=n.makeFilterValue(r.type,""),a=i.eq(o);return e?i.isNull().or(a):a.or(i.notEq(o))}}function Wi(n,e,t){return e=dv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function dv(n){var e=uv(n,"string");return typeof e=="symbol"?e:String(e)}function uv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Yn{}Wi(Yn,"not","not");Wi(Yn,"and","and");Wi(Yn,"or","or");function XC(n){if(!(n==="not"||n==="and"||n==="or"))throw new Error("operator is not a valid FilterOperatorValue")}function ve(n,e,t){return e=hv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function hv(n){var e=cv(n,"string");return typeof e=="symbol"?e:String(e)}function cv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class E{}ve(E,"eq","eq");ve(E,"eqIgnoreCase","eqIgnoreCase");ve(E,"notEq","notEq");ve(E,"notEqIgnoreCase","notEqIgnoreCase");ve(E,"greaterThan","greaterThan");ve(E,"greaterThanOrEqualTo","greaterThanOrEqualTo");ve(E,"lessThan","lessThan");ve(E,"lessThanOrEqualTo","lessThanOrEqualTo");ve(E,"in","in");ve(E,"inIgnoreCase","inIgnoreCase");ve(E,"notIn","notIn");ve(E,"notInIgnoreCase","notInIgnoreCase");ve(E,"isTrue","isTrue");ve(E,"isFalse","isFalse");ve(E,"isNull","isNull");ve(E,"invoke","invoke");ve(E,"contains","contains");ve(E,"notContains","notContains");ve(E,"containsIgnoreCase","containsIgnoreCase");ve(E,"startsWith","startsWith");ve(E,"endsWith","endsWith");ve(E,"containsAny","containsAny");var mv="DH_ITEM_KEY",aa=B.module("ViewportDataUtils");function ml(n){return"".concat(mv,"_").concat(n)}function fv(n,e){return ml(n.offsetInSnapshot+e)}function ZC(n,e){var{bulkUpdate:t}=n;return function(i){var{columns:o,offset:a,rows:s}=i.detail;aa.debug("table updated",i.detail);var l=new Map;s.forEach(d=>{var h=e(d,o),c=fv(d,a);l.set(c,{key:c,item:h})}),aa.debug("update keys",l),t(l)}}function YC(n,e){return e.reduce((t,r)=>(t[r.name]=n.get(r),t),{})}function*QC(n,e){for(var t=n;t<=e;++t)yield{key:ml(t)}}function vv(n){return n==null||gv(n)?0:n.size}function gv(n){return"isClosed"in n?n.isClosed:!1}function JC(n,e,t,r){var i=n+e-1,[o,a]=[0,r-1],s=Ji(n-t,o,a),l=Ji(i+t,o,a);return[s,l]}function sa(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function jt(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){sa(o,r,i,a,s,"next",l)}function s(l){sa(o,r,i,a,s,"throw",l)}a(void 0)})}}function cn(n,e,t){return e=pv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pv(n){var e=bv(n,"string");return typeof e=="symbol"?e:String(e)}function bv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Pt=B.module("TableUtils");function eS(n){return n===C.sortDirection.ascending||n===C.sortDirection.descending||n===C.sortDirection.reverse||n===C.sortDirection.none}class C{static copyTableAndApplyFilters(e){var t=arguments;return jt(function*(){if(e==null)return null;for(var r=yield e.copy(),i=t.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=t[a];return r.applyFilter(ti(...o.map(s=>s(r)))),r})()}static getSortIndex(e,t){for(var r=0;r<e.length;r+=1){var i,o=e[r];if(((i=o.column)===null||i===void 0?void 0:i.name)===t)return r}return null}static getSortForColumn(e,t){var r=C.getSortIndex(e,t);return r!=null?e[r]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return C.isBooleanType(e)?[E.isTrue,E.isFalse,E.isNull]:C.isCharType(e)||C.isNumberType(e)||C.isDateType(e)?[E.eq,E.notEq,E.greaterThan,E.greaterThanOrEqualTo,E.lessThan,E.lessThanOrEqualTo]:C.isTextType(e)?[E.eq,E.eqIgnoreCase,E.notEq,E.notEqIgnoreCase,E.contains,E.notContains,E.startsWith,E.endsWith]:[]}static getNextSort(e,t,r){if(r<0||r>=e.length)return null;var i=C.getSortForColumn(t,e[r].name);return i===null?e[r].sort().asc():i.direction===C.sortDirection.ascending?i.desc():null}static makeColumnSort(e,t,r,i){if(t<0||t>=e.length||r===C.sortDirection.none)return null;var o=e[t].sort();switch(r){case C.sortDirection.ascending:o=o.asc();break;case C.sortDirection.descending:o=o.desc();break}return i&&(o=o.abs()),o}static toggleSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(r<0||r>=t.length)return[];var o=C.getNextSort(t,e,r);return C.setSortForColumn(e,t[r].name,o,i)}static sortColumn(e,t,r,i,o,a){if(r<0||r>=t.length)return[];var s=C.makeColumnSort(t,r,i,o);return C.setSortForColumn(e,t[r].name,s,a)}static setSortForColumn(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=C.getSortIndex(e,t),a=[];return i&&(a=a.concat(e.filter(s=>{var{direction:l}=s;return l!==C.sortDirection.reverse})),o!==null&&a.splice(o,1)),r!==null&&a.push(r),a}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case C.dataType.BOOLEAN:return C.dataType.BOOLEAN;case"char":case"java.lang.Character":case C.dataType.CHAR:return C.dataType.CHAR;case"java.lang.String":case C.dataType.STRING:return C.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case C.dataType.DATETIME:return C.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case C.dataType.DECIMAL:return C.dataType.DECIMAL;case"int":case"java.lang.Integer":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":case"java.math.BigInteger":case C.dataType.INT:return C.dataType.INT;default:return C.dataType.UNKNOWN}}static isLongType(e){switch(e){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(e){switch(e){case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(e){return C.isIntegerType(e)||C.isDecimalType(e)}static isIntegerType(e){switch(e){case"int":case"java.lang.Integer":case"java.math.BigInteger":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":return!0;default:return!1}}static isDecimalType(e){switch(e){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBigDecimalType(e){switch(e){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(e){switch(e){case"java.math.BigInteger":return!0;default:return!1}}static isBooleanType(e){switch(e){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(e){switch(e){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(e){switch(e){case"java.lang.String":return!0;default:return!1}}static isTextType(e){return this.isStringType(e)||this.isCharType(e)}static getBaseType(e){return e.split("[]")[0]}static isCompatibleType(e,t){return C.getNormalizedType(e)===C.getNormalizedType(t)}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:'"'.concat(e,'"')}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeRangeFilterWithOperation(e,t,r){switch(t){case"=":return e.eq(r);case"<":return e.lessThan(r);case"<=":case"=<":return e.lessThanOrEqualTo(r);case">":return e.greaterThan(r);case">=":case"=>":return e.greaterThanOrEqualTo(r);case"!=":case"!":return e.notEq(r);default:return null}}static makeCancelableTablePromise(e){return Ee.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,o,a,s=!0,l=new Promise((d,h)=>{a=setTimeout(()=>{o(),s=!1,h(new Ds('Event "'.concat(t,'" timed out.')))},r),o=e.addEventListener(t,c=>{if(i!=null&&!i(c)){Pt.debug2("Event triggered, but matcher returned false.");return}Pt.debug2("Event triggered, resolving."),o(),clearTimeout(a),s=!1,d(c)})});return l.cancel=()=>{if(s){Pt.debug2("Pending promise cleanup."),o(),clearTimeout(a),s=!1;return}Pt.debug2("Ignoring non-pending promise cancel.")},l}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeBooleanValue(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e===""&&t)return null;switch(e?.toLowerCase()){case"null":return null;case"0":case"f":case"fa":case"fal":case"fals":case"false":case"n":case"no":return!1;case"1":case"t":case"tr":case"tru":case"true":case"y":case"ye":case"yes":return!0;default:throw new Error("Invalid boolean '".concat(e,"'"))}}static makeNumberValue(e){if(e==="null"||e==="")return null;var t=e.toLowerCase().trim();if(t==="∞"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-∞"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;var r=C.removeCommas(t);if(C.NUMBER_REGEX.test(r))return parseFloat(r);throw new Error("Invalid number '".concat(e,"'"))}static getFilterOperatorString(e){switch(e){case E.eq:return"=";case E.notEq:return"!=";case E.greaterThan:return">";case E.greaterThanOrEqualTo:return">=";case E.lessThan:return"<";case E.lessThanOrEqualTo:return"<=";case E.contains:return"~";case E.notContains:return"!~";default:throw new Error("Unexpected filter type ".concat(e))}}static isPartitionedTable(e){return e!=null&&e.getMergedTable!==void 0&&e.getKeyTable!==void 0&&e.getKeys!==void 0}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return[...e].sort((r,i)=>{var o=r.name.toUpperCase(),a=i.name.toUpperCase();return xs.sort(o,a,t)})}constructor(e){cn(this,"dh",void 0),this.dh=e,pu(this)}createDistinctSortedColumnTable(e,t,r){var i=arguments,o=this;return jt(function*(){if(e==null)return null;for(var a=e,s=i.length,l=new Array(s>3?s-3:0),d=3;d<s;d++)l[d-3]=i[d];l.length>0&&(a=yield e.copy(),yield a.applyFilter(ti(...l.map(v=>v(a)))));var h=a.findColumn(t),c=yield a.selectDistinct([h]);a!==e&&a.close();var f=c.findColumn(t).sort()[r]();return o.applySort(c,[f])})()}doesColumnValueExist(e,t,r,i){var o=this;return jt(function*(){if(e==null)return null;var a=lv(o,t,r,i?"eq":"eqIgnoreCase"),s=yield e.copy();yield o.applyFilter(s,ti(a(s)));var l=vv(s);return s.close(),l>0})()}getValueType(e){if(e==null)return this.dh.ValueType.STRING;var t=C.getNormalizedType(e);switch(t){case C.dataType.BOOLEAN:return this.dh.ValueType.BOOLEAN;case C.dataType.CHAR:case C.dataType.STRING:return this.dh.ValueType.STRING;case C.dataType.DATETIME:return this.dh.ValueType.DATETIME;case C.dataType.DECIMAL:case C.dataType.INT:return C.isBigDecimalType(e)||C.isBigIntegerType(e)?this.dh.ValueType.STRING:this.dh.ValueType.NUMBER;default:return this.dh.ValueType.STRING}}makeQuickFilter(e,t,r){for(var i=t.split("||"),o=null,a=0;a<i.length;a+=1){for(var s=i[a],l=s.split("&&"),d=null,h=0;h<l.length;h+=1){var c=l[h].trim();if(c.length>0){var f=this.makeQuickFilterFromComponent(e,c,r);if(f)d?d=d.and(f):d=f;else throw new Error("Unable to parse quick filter from text ".concat(t))}}o&&d?o=o.or(d):o=d}return o}makeQuickFilterFromComponent(e,t,r){var{type:i}=e;return C.isNumberType(i)?this.makeQuickNumberFilter(e,t):C.isBooleanType(i)?this.makeQuickBooleanFilter(e,t):r!=null&&C.isDateType(i)?this.makeQuickDateFilter(e,t,r):C.isCharType(i)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}makeQuickNumberFilter(e,t){var r=e.filter(),{dh:i}=this,o=null,a=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i,s=a.exec(t),l=null,d=null,h=null,c=null,f=null;if(s!==null&&s.length>3&&([,l,d,h,c,f]=s),f!=null&&f.trim().length>0)return null;if(l==null&&(l="="),c!=null){if(!(l==="="||l==="!"||l==="!="))return null;switch(c=c.trim().toLowerCase(),c){case"null":o=r.isNull();break;case"nan":o=i.FilterCondition.invoke("isNaN",r);break;case"infinity":case"inf":case"∞":d!=null?o=i.FilterCondition.invoke("isInf",r).and(r.lessThan(i.FilterValue.ofNumber(0))):o=i.FilterCondition.invoke("isInf",r).and(r.greaterThan(i.FilterValue.ofNumber(0)));break}return o!==null&&(l==="!"||l==="!=")&&(o=o.not()),o}if(h==null)return null;if(h=C.removeCommas(h),C.isLongType(e.type))try{h=i.FilterValue.ofNumber(i.LongWrapper.ofString("".concat(d!=null?"-":"").concat(h)))}catch(v){return Pt.warn("Unable to create long filter",v),null}else{if(h=parseFloat(h),h==null||Number.isNaN(h))return null;h=i.FilterValue.ofNumber(d!=null?0-h:h)}return o=e.filter(),C.makeRangeFilterWithOperation(o,l,h)}static escapeQuickTextFilter(e){var t,r;if(e==null)return null;var i=/^(!~|!=|~|=|!)?(.*)/,o=/^\\*null$/,a=i.exec(e),s=null,l=null;if(a!==null&&a.length>2&&([,s,l]=a),s!=null){var d;return"\\".concat(s).concat((d=l)!==null&&d!==void 0?d:"")}return l!=null&&o.test(l.toLowerCase())||l!=null&&l.startsWith("*")?"\\".concat(l):l!=null&&l.endsWith("*")&&!l.endsWith("\\*")?(l=l.substring(0,l.length-1),"".concat(l,"\\*")):"".concat((t=s)!==null&&t!==void 0?t:"").concat((r=l)!==null&&r!==void 0?r:"")}static unescapeQuickTextFilter(e){var t,r,i=/^(\\!~|\\!=|\\~|\\=|\\!)?(.*)/,o=/^\\*null$/,a=i.exec(e),s=null,l=null;return a!==null&&a.length>2&&([,s,l]=a),s!=null&&(s=s.replace("\\","")),l!=null&&o.test(l.toLowerCase())&&(l=l.replace("\\","")),s==null&&l!=null&&l.startsWith("\\*")&&(l=l.substring(1)),s==null&&l!=null&&l.endsWith("\\*")?(l=l.substring(0,l.length-2),"".concat(l,"*")):"".concat((t=s)!==null&&t!==void 0?t:"").concat((r=l)!==null&&r!==void 0?r:"")}makeQuickTextFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),o=/^(!~|!=|~|=|!)?(.*)/,a=o.exec(i),s=null,l=null;if(a!==null&&a.length>2&&([,s,l]=a,l!=null&&(l=l.trim())),l==null||l.length===0&&!(s==="="||s==="!="))return null;s==null&&(s="=");var d=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return d.isNull();case"!=":case"!":return d.isNull().not()}var h=null,c=null;switch(l.startsWith("*")?(h="*",l=l.substring(1)):l.endsWith("*")&&!l.endsWith("\\*")&&(c="*",l=l.substring(0,l.length-1)),l=C.unescapeQuickTextFilter(l),s){case"~":return d.isNull().not().and(d.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))));case"!~":return d.isNull().or(d.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))).not());case"!=":return h==="*"?d.isNull().or(d.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$"))).not()):c==="*"?d.isNull().or(d.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*"))).not()):d.notEqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()));case"=":return h==="*"?d.isNull().not().and(d.invoke("matches",r.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$")))):c==="*"?d.isNull().not().and(d.invoke("matches",r.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*")))):d.eqIgnoreCase(r.FilterValue.ofString(l.toLowerCase()))}return null}makeQuickBooleanFilter(e,t){var r=/^(!=|=|!)?(.*)/,i=r.exec("".concat(t).trim());if(i===null)return null;var[,o,a]=i,s=o==="!"||o==="!=",l=a.trim().toLowerCase(),d=e.filter();try{var h=C.makeBooleanValue(l);return h!=null&&h?d=d.isTrue():h===null?d=d.isNull():d=d.isFalse(),s?d.not():d}catch{return null}}makeQuickDateFilter(e,t,r){var i=t.trim(),o=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/,a=o.exec(i);if(a==null||a.length<=2)throw new Error("Unable to parse date filter: ".concat(t));var s=null,l=null;[,s,l]=a;var d=E.eq;switch(s){case"<":d=E.lessThan;break;case"<=":case"=<":d=E.lessThanOrEqualTo;break;case">":d=E.greaterThan;break;case">=":case"=>":d=E.greaterThanOrEqualTo;break;case"!=":case"!":d=E.notEq;break;case"=":case"==":default:d=E.eq;break}return this.makeQuickDateFilterWithOperation(e,l,d,r)}makeQuickDateFilterWithOperation(e,t,r,i){var{dh:o}=this,[a,s]=si.parseDateRange(o,t,i),l=a!=null?o.FilterValue.ofNumber(a):null,d=s!=null?o.FilterValue.ofNumber(s):null,h=e.filter();if(l==null)return r===E.notEq?h.isNull().not():h.isNull();switch(r){case E.eq:{if(d!=null){var c=h.greaterThanOrEqualTo(l),f=h.lessThan(d);return c.and(f)}return h.eq(l)}case E.lessThan:return h.lessThan(l);case E.lessThanOrEqualTo:return d!=null?h.lessThan(d):h.lessThanOrEqualTo(l);case E.greaterThan:return d!=null?h.greaterThanOrEqualTo(d):h.greaterThan(l);case E.greaterThanOrEqualTo:return h.greaterThanOrEqualTo(l);case E.notEq:{if(d!=null){var v=h.lessThan(l),p=h.greaterThanOrEqualTo(d);return v.or(p)}return h.notEq(l)}default:throw new Error("Invalid operator: ".concat(r))}}makeQuickCharFilter(e,t){var{dh:r}=this,i="".concat(t).trim(),o=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/,a=o.exec(i),s=null,l=null,d=null;if(a!==null&&a.length>3&&([,s,l,d]=a),d!=null&&d.trim().length>0||l==null||l.length===0)return null;s==null&&(s="=");var h=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return h.isNull();case"!=":case"!":return h.isNull().not();default:return null}var c=r.FilterValue.ofString(C.isRangeOperation(s)?C.quoteValue(l):l);return C.makeRangeFilterWithOperation(h,s,c)}makeAdvancedFilter(e,t,r){for(var{filterItems:i,filterOperators:o,invertSelection:a,selectedValues:s}=t,l=null,d=0;d<i.length;d+=1){var h=i[d],{selectedType:c,value:f}=h;if(c!=null&&c.length>0&&f!=null&&f.length>0)try{var v=this.makeAdvancedValueFilter(e,c,f,r);if(v!=null){if(d===0)l=v;else if(l!==null&&d-1<o.length){var p=o[d-1];if(p===Yn.and)l=l.and(v);else if(p===Yn.or)l=l.or(v);else{Pt.error("Unexpected filter operator",p,v),l=null;break}}}else Pt.debug2("Empty filter ignored for",c,f)}catch(y){Pt.error("Unable to create filter",y),l=null;break}}var g=this.makeSelectValueFilter(e,s,a);return g!=null&&(l!=null?l=l.and(g):l=g),l}makeAdvancedValueFilter(e,t,r,i){var{dh:o}=this;if(C.isDateType(e.type))return this.makeQuickDateFilterWithOperation(e,r,t,i);if(C.isNumberType(e.type)||C.isCharType(e.type))return this.makeQuickFilter(e,"".concat(C.getFilterOperatorString(t)).concat(r));var a=this.makeFilterValue(e.type,r),s=e.filter();switch(t){case E.eq:return s.eq(a);case E.eqIgnoreCase:return s.eqIgnoreCase(a);case E.notEq:return s.notEq(a);case E.notEqIgnoreCase:return s.notEqIgnoreCase(a);case E.greaterThan:return s.greaterThan(a);case E.greaterThanOrEqualTo:return s.greaterThanOrEqualTo(a);case E.lessThan:return s.lessThan(a);case E.lessThanOrEqualTo:return s.lessThanOrEqualTo(a);case E.isTrue:return s.isTrue();case E.isFalse:return s.isFalse();case E.isNull:return s.isNull();case E.contains:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))));case E.notContains:return s.isNull().or(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E.*"))).not());case E.startsWith:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i)^\\Q".concat(r,"\\E.*"))));case E.endsWith:return s.isNull().not().and(s.invoke("matches",o.FilterValue.ofString("(?s)(?i).*\\Q".concat(r,"\\E$"))));case E.in:case E.inIgnoreCase:case E.notIn:case E.notInIgnoreCase:case E.invoke:default:throw new Error("Unexpected filter operation: ".concat(t))}}makeSearchTextFilter(e,t,r){var i=this.getValueType(e.type);try{if(i===this.dh.ValueType.BOOLEAN){var o=this.makeQuickBooleanFilter(e,t);return k(o),o}if(i===this.dh.ValueType.DATETIME)return this.makeQuickDateFilterWithOperation(e,si.trimDateTimeStringTimeZone(t),"eq",r);if(i===this.dh.ValueType.NUMBER){var a=this.makeQuickNumberFilter(e,t);return k(a),a}return C.isBigDecimalType(e.type)||C.isBigIntegerType(e.type)?e.filter().eq(this.makeFilterValue(e.type,t)):e.filter().containsIgnoreCase(this.makeFilterValue(e.type,t))}catch{return this.makeNeverFilter(e)}}applyNeverFilter(e,t){var r=arguments,i=this;return jt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(e==null)return null;var a=e.findColumn(t),s=[i.makeNeverFilter(a)];return yield i.applyFilter(e,s,o),e})()}applyCustomColumns(e,t){var r=arguments,i=this;return jt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return C.executeAndWaitForEvent(s=>s?.applyCustomColumns(t),e,a.Table.EVENT_CUSTOMCOLUMNSCHANGED,o)})()}applyFilter(e,t){var r=arguments,i=this;return jt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return C.executeAndWaitForEvent(s=>s?.applyFilter(t),e,a.Table.EVENT_FILTERCHANGED,o)})()}applySort(e,t){var r=arguments,i=this;return jt(function*(){var o=r.length>2&&r[2]!==void 0?r[2]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:a}=i;return C.executeAndWaitForEvent(s=>s?.applySort(t),e,a.Table.EVENT_SORTCHANGED,o)})()}makeNeverFilter(e){var{dh:t}=this,r=null;C.isTextType(e.type)?r=t.FilterValue.ofString("a"):C.isBooleanType(e.type)?r=t.FilterValue.ofBoolean(!0):C.isDateType(e.type)?r=t.FilterValue.ofNumber(t.DateWrapper.ofJsDate(new Date)):r=t.FilterValue.ofNumber(0);var i=e.filter().eq(r),o=e.filter().notEq(r);return i.and(o)}makeFilterValue(e,t){var{dh:r}=this,i=C.getBaseType(e);return C.isTextType(i)?r.FilterValue.ofString(t):C.isLongType(i)?r.FilterValue.ofNumber(r.LongWrapper.ofString(C.removeCommas(t))):r.FilterValue.ofNumber(C.removeCommas(t))}makeFilterRawValue(e,t){var{dh:r}=this;return C.isCharType(e)?r.FilterValue.ofString(typeof t=="number"?String.fromCharCode(t):t):C.isTextType(e)?r.FilterValue.ofString(t):C.isBooleanType(e)?r.FilterValue.ofBoolean(t):r.FilterValue.ofNumber(t)}makeNullableEqFilter(e,t){return t==null?e.filter().isNull():e.filter().eq(this.makeFilterRawValue(e.type,t))}makeValue(e,t,r){var{dh:i}=this;if(t==="null")return null;if(C.isTextType(e))return t;if(C.isLongType(e))return i.LongWrapper.ofString(C.removeCommas(t));if(C.isBooleanType(e))return C.makeBooleanValue(t,!0);if(C.isDateType(e)){var[o]=si.parseDateRange(i,t,r);return o}return C.isNumberType(e)?C.makeNumberValue(t):(Pt.error("Unexpected column type",e),null)}makeSelectValueFilter(e,t,r){var{dh:i}=this;if(t.length===0)return r?null:this.makeNeverFilter(e);for(var o=[],a=!1,s=0;s<t.length;s+=1){var l=t[s];l==null?a=!0:C.isTextType(e.type)?o.push(i.FilterValue.ofString(typeof l=="number"?String.fromCharCode(l):l)):C.isBooleanType(e.type)?o.push(i.FilterValue.ofBoolean(!!l)):o.push(i.FilterValue.ofNumber(l))}return a?o.length>0?r?e.filter().isNull().not().and(e.filter().notIn(o)):e.filter().isNull().or(e.filter().in(o)):r?e.filter().isNull().not():e.filter().isNull():r?e.filter().notIn(o):e.filter().in(o)}}cn(C,"dataType",{BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"});cn(C,"sortDirection",{ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null});cn(C,"APPLY_TABLE_CHANGE_TIMEOUT_MS",3e4);cn(C,"REVERSE_TYPE",Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"}));cn(C,"NUMBER_REGEX",/^-?\d+(\.\d+)?$/);cn(C,"executeAndWaitForEvent",function(){var n=jt(function*(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:C.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(t==null)return null;var o=C.makeCancelableTableEventPromise(t,r,i);return e(t),yield o,t});return function(e,t,r){return n.apply(this,arguments)}}());function vn(n,e,t){return e=yv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yv(n){var e=Cv(n,"string");return typeof e=="symbol"?e:String(e)}function Cv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class fl{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((t,r)=>{var i=C.getNormalizedType(r.columnType);if(i===null)return t;t.has(i)||t.set(i,new Map);var o=t.get(i);return o?.set(r.columnName,r.format),t},new Map)}static makeColumnFormattingRule(e,t,r){return{columnType:e,columnName:t,format:r}}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:!0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!0;vn(this,"defaultColumnFormatter",void 0),vn(this,"typeFormatterMap",void 0),vn(this,"columnFormatMap",void 0),vn(this,"truncateNumbersWithPound",void 0),vn(this,"showEmptyStrings",void 0),vn(this,"showNullStrings",void 0),this.defaultColumnFormatter=new ev,this.typeFormatterMap=new Map([[C.dataType.BOOLEAN,new Kf],[C.dataType.CHAR,new Gf],[C.dataType.DATETIME,new dt(e,r)],[C.dataType.DECIMAL,new Ce(e,i)],[C.dataType.INT,new Ct(e,o)],[C.dataType.STRING,new iv]]),this.columnFormatMap=fl.makeColumnFormatMap(t),this.truncateNumbersWithPound=a,this.showEmptyStrings=s,this.showNullStrings=l}getColumnFormatMapForType(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=C.getNormalizedType(e);if(r!==null)return t&&!this.columnFormatMap.has(r)&&this.columnFormatMap.set(r,new Map),this.columnFormatMap.get(r)}getColumnFormat(e,t){var r,i=this.getColumnFormatMapForType(e);return(r=i?.get(t))!==null&&r!==void 0?r:null}getColumnTypeFormatter(e){var t=C.getNormalizedType(e),r=this.defaultColumnFormatter;if(t){var i;r=(i=this.typeFormatterMap.get(t))!==null&&i!==void 0?i:r}return r}getFormattedString(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",i=arguments.length>3?arguments[3]:void 0;if(e==null)return"";var o=this.getColumnTypeFormatter(t),a=i||this.getColumnFormat(t,r);return o.format(e,a??void 0)}get timeZone(){var e=this.typeFormatterMap.get(C.dataType.DATETIME);return Qd(e,dt),e.dhTimeZone.id}}const Sv="var(--dh-color-chart-colorway)",wv="var(--dh-color-chart-grid)",Ev="var(--dh-color-chart-axis-line)",_v="var(--dh-color-chart-axis-line-zero)",la={"paper-bgcolor":"var(--dh-color-chart-bg)","plot-bgcolor":"var(--dh-color-chart-plot-bg)","title-color":"var(--dh-color-chart-title)","legend-color":"var(--dh-color-chart-legend-fg)",colorway:Sv,gridcolor:wv,linecolor:Ev,zerolinecolor:_v,"error-band-line-color":"var(--dh-color-chart-error-band-line)","ohlc-increasing":"var(--dh-color-chart-ohlc-increase)","ohlc-decreasing":"var(--dh-color-chart-ohlc-decrease)","coastline-color":"var(--dh-color-chart-geo-coastline)","land-color":"var(--dh-color-chart-geo-land)","ocean-color":"var(--dh-color-chart-geo-ocean)","lake-color":"var(--dh-color-chart-geo-lake)","river-color":"var(--dh-color-chart-geo-river)"};var da=B.module("ChartTheme");function Pv(){var n,e=bs(la);return e.colorway=Jd((n=e.colorway)!==null&&n!==void 0?n:"").map(t=>{var[r,i]=t;return eu.normalizeCssColor(e.colorway.substring(r,i+1))}).join(" "),da.debug2("Chart theme:",la),da.debug2("Chart theme derived:",e),Object.freeze({paper_bgcolor:e["paper-bgcolor"],plot_bgcolor:e["plot-bgcolor"],title_color:e["title-color"],legend_color:e["legend-color"],colorway:e.colorway,gridcolor:e.gridcolor,linecolor:e.linecolor,zerolinecolor:e.zerolinecolor,error_band_line_color:e["error-band-line-color"],ohlc_increasing:e["ohlc-increasing"],ohlc_decreasing:e["ohlc-decreasing"],coastline_color:e["coastline-color"],land_color:e["land-color"],ocean_color:e["ocean-color"],lake_color:e["lake-color"],river_color:e["river-color"]})}function ua(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Tv(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ua(Object(t),!0).forEach(function(r){Ov(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ua(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ov(n,e,t){return e=Iv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Iv(n){var e=Dv(n,"string");return typeof e=="symbol"?e:String(e)}function Dv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var xv=m.lazy(()=>_s(()=>import("./Plot-ebc409c8.js"),["./Plot-ebc409c8.js","./Plotly-63b44574.js","./plotly-96591286.js","./helpers-de833af9.js","./vendor-e600113a.js","./vendor-fb3fd713.css"],import.meta.url));function Mv(n){return u.jsx(m.Suspense,{fallback:u.jsx(un,{}),children:u.jsx(xv,Tv({},n))})}var vl=m.createContext(null);function tS(n){var{children:e}=n,{activeThemes:t}=ks(),r=m.useMemo(Pv,[t]);return u.jsx(vl.Provider,{value:r,children:e})}function Nv(){return tr(vl,"No ChartThemeContext value found.")}function ha(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Av(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ha(o,r,i,a,s,"next",l)}function s(l){ha(o,r,i,a,s,"throw",l)}a(void 0)})}}var Lv=B.module("HeapUsage");function Fv(n){var e,{connection:t,defaultUpdateInterval:r,hoverUpdateInterval:i,bgMonitoring:o=!0,monitorDuration:a}=n,s=Nv(),[l,d]=m.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[h,c]=m.useState(!1),f=m.useRef({timestamps:[],usages:[]}),v=As(),p=m.useCallback(Av(function*(){try{var A=yield t.getWorkerHeapInfo();if(!v.current)return;if(d(A),o||h){for(var V=(A.totalHeapSize-A.freeMemory)/A.maximumHeapSize,z=Date.now(),{timestamps:me,usages:je}=f.current;me.length!==0&&z-me[0]>a*1.5;)me.shift(),je.shift();me.push(z),je.push(V)}else f.current={timestamps:[],usages:[]}}catch(De){Lv.warn("Unable to get heap usage",De)}}),[t,v,o,h,a]);Wu(p,h?i:r);var g=(A,V)=>Math.round(A*10**V)/10**V,y=2,P=1024**3,{freeMemory:O,totalHeapSize:_,maximumHeapSize:R}=l,U=g(O/P,y),Q=g(_/P,y),N=g(R/P,y),W=Q-U,j=function(V,z){var me=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return u.jsxs("div",{className:Z("heap-usage-info-row",{"heading-bottom-border":me}),children:[u.jsx("div",{className:"font-weight-bold",children:V}),u.jsx("div",{children:z})]})},{timestamps:Y,usages:ne}=f.current,F=(e=Y[Y.length-1])!==null&&e!==void 0?e:0,q=_/R,K=(_-O)/R;return u.jsxs("div",{className:"max-memory",children:[u.jsx("div",{className:"total-memory",style:{width:"calc(".concat(q*100,"% - ").concat(q*2,"px")}}),u.jsx("div",{className:Z("used-memory",{"heap-overflow":(_-O)/R>.95}),style:{width:"calc(".concat(K*100,"% - ").concat(K*2,"px")}}),u.jsxs("div",{className:"memory-text",children:[N.toFixed(1)," GB"]}),u.jsx(qt,{onEntered:()=>c(!0),onExited:()=>c(!1),interactive:!0,children:u.jsxs("div",{className:"heap-tooltip",children:[j("In use:","".concat(W.toFixed(y)," of ").concat(N.toFixed(y)," GB"),!0),j("Free:","".concat(U.toFixed(y)," GB")),j("Total:","".concat(Q.toFixed(y)," GB")),j("Max:","".concat(N.toFixed(y)," GB")),u.jsx("div",{className:"heap-plot",children:u.jsx(Mv,{data:[{x:[...Y],y:[...ne],type:"scatter",mode:"lines"}],config:{staticPlot:!0,responsive:!0},style:{width:"196px",height:"100px"},layout:{margin:{l:2,t:2,r:2,b:2},plot_bgcolor:"transparent",paper_bgcolor:"transparent",colorway:["#4878ea"],xaxis:{dtick:Math.round(a/6),gridcolor:s.linecolor,range:[F-a,F],linecolor:s.linecolor,linewidth:2,mirror:!0},yaxis:{dtick:.2,gridcolor:s.linecolor,range:[0,1],linecolor:s.linecolor,linewidth:2,mirror:!0}}})}),u.jsxs("div",{className:"heap-utilisation-text",children:["% utilization over ",Math.round(a/1e3/60)," min."]})]})})]})}function ca(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Rv(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ca(Object(t),!0).forEach(function(r){kv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ca(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function kv(n,e,t){return e=jv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jv(n){var e=$v(n,"string");return typeof e=="symbol"?e:String(e)}function $v(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ui=Object.freeze({}),Hv=new Map,nS=n=>n.api,rS=n=>n.user,gl=n=>n.storage,pl=n=>gl(n).commandHistoryStorage,bl=n=>gl(n).fileStorage,Bv=n=>n.defaultWorkspaceSettings,yl=n=>{var{workspace:e}=n;return e},Ue=Sd(n=>{for(var e,t,r=(e=(t=yl(n))===null||t===void 0?void 0:t.data.settings)!==null&&e!==void 0?e:{},i=Rv({},Bv(n)),o=Object.keys(r),a=0;a<o.length;a+=1){var s=o[a];r[s]!==void 0&&(i[s]=r[s])}return i}),iS=n=>n.defaultWorkspaceSettings,oS=n=>Ue(n).defaultDateTimeFormat,aS=n=>{var e;return(e=Ue(n).defaultDecimalFormatOptions)!==null&&e!==void 0?e:Ui},sS=n=>{var e;return(e=Ue(n).defaultIntegerFormatOptions)!==null&&e!==void 0?e:Ui},lS=n=>{var e;return(e=Ue(n).formatter)!==null&&e!==void 0?e:[]},Wv=n=>Ue(n).timeZone,dS=n=>Ue(n).showTimeZone,uS=n=>Ue(n).showTSeparator,hS=n=>Ue(n).truncateNumbersWithPound,cS=n=>Ue(n).showEmptyStrings,mS=n=>Ue(n).showNullStrings,fS=n=>Ue(n).shortcutOverrides,vS=n=>Ue(n).webgl,gS=n=>Ue(n).webglEditable,Uv=n=>{var e;return(e=Ue(n).defaultNotebookSettings)!==null&&e!==void 0?e:Ui},pS=n=>n.activeTool,Vv=n=>{var e;return(e=n.plugins)!==null&&e!==void 0?e:Hv},Cl="SET_ACTIVE_TOOL",Sl="SET_API",wl="SET_COMMAND_HISTORY_STORAGE",El="SET_FILE_STORAGE",_l="SET_PLUGINS",Pl="SET_USER",Tl="SET_WORKSPACE",Ol="SET_DEFAULT_WORKSPACE_SETTINGS",Il="SET_WORKSPACE_STORAGE",Dl="SET_SERVER_CONFIG_VALUES";function ma(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Jt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ma(Object(t),!0).forEach(function(r){Kv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ma(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Kv(n,e,t){return e=zv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function zv(n){var e=Gv(n,"string");return typeof e=="symbol"?e:String(e)}function Gv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var bS=n=>({type:Pl,payload:n}),yS=n=>({type:Sl,payload:n}),xl=n=>({type:Tl,payload:n}),CS=n=>({type:Ol,payload:n}),SS=n=>({type:Il,payload:n}),wS=n=>({type:wl,payload:n}),ES=n=>({type:El,payload:n}),qv=n=>(e,t)=>{e(xl(n));var{storage:r}=t(),{workspaceStorage:i}=r;return i?.save(n)},Xv=n=>(e,t)=>{var{workspace:r}=t(),{data:i}=r??{},o=Jt(Jt({},r),{},{data:Jt(Jt(Jt({},i),n),{},{settings:Jt(Jt({},i?.settings),n.settings)})});return e(qv(o))},Zv=n=>e=>e(Xv({settings:n})),_S=n=>({type:Cl,payload:n}),PS=n=>({type:_l,payload:n}),TS=n=>({type:Dl,payload:n});function fa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function li(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fa(Object(t),!0).forEach(function(r){Yv(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):fa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Yv(n,e,t){return e=Qv(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Qv(n){var e=Jv(n,"string");return typeof e=="symbol"?e:String(e)}function Jv(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Ml(n,e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,r=arguments.length>1?arguments[1]:void 0;switch(r.type){case n:{var i=r.payload;return i==null?null:t!=null?li(li({},t),i):li({},i)}default:return t}}}function va(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ga(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?va(Object(t),!0).forEach(function(r){eg(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):va(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function eg(n,e,t){return e=tg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tg(n){var e=ng(n,"string");return typeof e=="symbol"?e:String(e)}function ng(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function rg(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,i=arguments.length>1?arguments[1]:void 0;switch(i.type){case n:{var{id:o,payload:a}=i;return t&&Xn({payload:a},{payload:r[o]})?r:ga(ga({},r),{},{[o]:a})}default:return r}}}function Zt(n,e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,r=arguments.length>1?arguments[1]:void 0;switch(r.type){case n:return r.payload;default:return t}}}const ig=Zt(Sl,null),og=Zt(Cl,null),ag=Zt(_l,null),sg=Zt(wl,null),lg=Zt(El,null),dg=Zt(Il,null),ug=Ni({commandHistoryStorage:sg,fileStorage:lg,workspaceStorage:dg}),hg=Ml(Pl,null),cg=Ml(Tl,null),mg=Zt(Ol,null),fg=Zt(Dl,null);var vg={activeTool:og,api:ig,plugins:ag,storage:ug,user:hg,workspace:cg,defaultWorkspaceSettings:mg,serverConfigValues:fg};const gg=vg;function pa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ba(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?pa(Object(t),!0).forEach(function(r){Si(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):pa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Si(n,e,t){return e=pg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function pg(n){var e=bg(n,"string");return typeof e=="symbol"?e:String(e)}function bg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class yg{constructor(){Si(this,"reducers",{}),Si(this,"listener",null)}register(e,t){var r;this.reducers=ba(ba({},this.reducers),{},{[e]:t}),(r=this.listener)===null||r===void 0||r.call(this,this.reducers)}setListener(e){this.listener=e}}var Cg=new yg;const Gr=Cg;var ya=B.module("redux-logger"),Sg=n=>e=>t=>{ya.debug("dispatching",t);var r=e(t);return ya.debug("next state",n.getState()),r};const wg=Sg;var Eg=B.module("redux-crashReporter"),_g=n=>e=>t=>{try{return e(t)}catch(r){throw Eg.error("Error executing",t," with state ",n.getState(),":",r),r}};const Pg=_g,Tg=[wg,Pg,wd];var di;Object.entries(gg).map(n=>{var[e,t]=n;return Gr.register(e,t)});var Og=(di=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__)!==null&&di!==void 0?di:Pd,Nl=Ed(Ni(Gr.reducers),Og(_d(...Tg)));Gr.setListener(n=>{Nl.replaceReducer(Ni(n))});const OS=Nl;var Al=Object.freeze({openPopouts:[],settings:{hasHeaders:!0,constrainDragToContainer:!0,reorderEnabled:!0,selectionEnabled:!1,popoutWholeStack:!1,blockedPopoutsThrowError:!0,closePopoutsOnUnload:!0,showPopoutIcon:!0,showMaximiseIcon:!0,showCloseIcon:!0,responsiveMode:"onload",tabOverlapAllowance:0,tabControlOffset:10},dimensions:{borderWidth:5,borderGrabWidth:10,minItemHeight:10,minItemWidth:10,headerHeight:20,dragProxyWidth:300,dragProxyHeight:200},labels:{close:"Close",maximise:"Maximize",minimise:"Minimize",popout:"Open in new window",popin:"Pop in",tabDropdown:"Additional tabs",tabNextLabel:"Next",tabPreviousLabel:"Previous"},content:[]});function Ll(n){return n.componentName!==void 0}function Ig(n){return n.component!==void 0}var Fl=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const Dg=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:Al,isGLComponentConfig:Ll,isReactComponentConfig:Ig,itemDefaultConfig:Fl},Symbol.toStringTag,{value:"Module"}));function Or(n,e,t){return e=xg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xg(n){var e=Mg(n,"string");return typeof e=="symbol"?e:String(e)}function Mg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Qn{constructor(){Or(this,"_mSubscriptions",void 0),Or(this,"off",this.unbind),Or(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[Qn.ALL_EVENT]=[]}on(e,t,r){if(typeof t!="function")throw new Error("Tried to listen to event "+e+" with non-function callback "+t);this._mSubscriptions[e]||(this._mSubscriptions[e]=[]),this._mSubscriptions[e].push({fn:t,ctx:r})}emit(e){for(var t=this._mSubscriptions[e],r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];if(t)for(var a=0;a<t.length;a++){var s=t[a].ctx||{};try{t[a].fn.apply(s,i)}catch(c){console.error("Error while emitting event:",c)}}i.unshift(e);for(var l=this._mSubscriptions[Qn.ALL_EVENT],d=0;d<l.length;d++){var h=l[d].ctx||{};try{l[d].fn.apply(h,i)}catch(c){console.error("Error while emitting event to allEventSubs:",c)}}}unbind(e,t,r){if(!this._mSubscriptions[e])throw new Error("No subscriptions to unsubscribe for event "+e);for(var i=!1,o=0;o<this._mSubscriptions[e].length;o++)(!t||this._mSubscriptions[e][o].fn===t)&&(!r||r===this._mSubscriptions[e][o].ctx)&&(this._mSubscriptions[e].splice(o,1),i=!0);if(i===!1)throw new Error("Nothing to unbind for "+e)}}Or(Qn,"ALL_EVENT","__all");const ct=Qn;function st(n,e,t){return e=Ng(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ng(n){var e=Ag(n,"string");return typeof e=="symbol"?e:String(e)}function Ag(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class wi extends ct{constructor(e,t,r){super(),st(this,"width",void 0),st(this,"height",void 0),st(this,"title",void 0),st(this,"parent",void 0),st(this,"layoutManager",void 0),st(this,"tab",void 0),st(this,"_config",void 0),st(this,"isHidden",!1),st(this,"beforeCloseHandler",void 0),st(this,"_element",M(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),st(this,"_contentElement",void 0),this.title=Ll(e)?e.componentName:"",this.parent=t,this.layoutManager=r,this._config=e,this._contentElement=this._element.find(".lm_content"),this.beforeCloseHandler=null}getElement(){return this._contentElement}hide(){this.emit("hide"),this.isHidden=!0,this._element.hide()}show(){this.emit("show"),this.isHidden=!1,this._element.show(),(this.height!=0||this.width!=0)&&this.emit("shown")}setSize(e,t){for(var r,i,o,a=this.parent,s=null;a&&!a.isColumn&&!a.isRow;){var l;if(s=a,a=a.parent,(l=a)!==null&&l!==void 0&&l.isRoot)return!1}if(!a||!s)return!1;for(var d=a.isColumn?"height":"width",h=d==="height"?t:e,c=((r=this[d])!==null&&r!==void 0?r:0)*(1/(((i=s.config[d])!==null&&i!==void 0?i:0)/100)),f=h/c*100,v=(((o=s.config[d])!==null&&o!==void 0?o:0)-f)/(a.contentItems.length-1),p=0;p<a.contentItems.length;p++)if(a.contentItems[p]===s)a.contentItems[p].config[d]=f;else{var g;a.contentItems[p].config[d]=((g=a.contentItems[p].config[d])!==null&&g!==void 0?g:0)+v}return a.callDownwards("setSize"),!0}close(e){var t,r;this._config.isClosable&&(!((t=(r=this.beforeCloseHandler)===null||r===void 0?void 0:r.call(this,e))!==null&&t!==void 0)||t)&&(this.emit("close"),this.parent.close())}beforeClose(e){this.beforeCloseHandler=e}getState(){return this._config.componentState}getConfig(){return this._config}extendState(e){this.setState(M.extend(!0,this.getState(),e))}setState(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")}setTitle(e){this.parent.setTitle(e)}_$setSize(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(e!==this.width||t!==this.height){this.width=e,this.height=t;var r=this._contentElement[0],i=r.offsetWidth-r.clientWidth,o=r.offsetHeight-r.clientHeight;this._contentElement.width(this.width-i).height(this.height-o),this.emit("resize")}}}const Lg=Object.freeze(Object.defineProperty({__proto__:null,Container:wi,ItemContainer:wi},Symbol.toStringTag,{value:"Module"}));function Rl(n){var e=location.hash.match(new RegExp(n+"=([^&]*)"));return e?e[1]:null}function kl(n){if(window.location.hash)return Rl(n);if(!window.location.search)return null;var e=window.location.search.substr(1).split("&"),t={},r,i;for(i=0;i<e.length;i++)r=e[i].split("="),t[r[0]]=r[1];return t[n]||null}function Vi(n){return window.requestAnimationFrame(n)}function Fg(n,e){var t=e.indexOf(n);if(t===-1)throw new Error("Can't remove item from array. Item is not in the array");e.splice(t,1)}function Lr(){return Mt()}function Rg(n,e){var t=n.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 Ki(n){return M.trim(n.replace(/(<([^>]+)>)/gi,""))}function Ve(n,e,t){return e=kg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function kg(n){var e=jg(n,"string");return typeof e=="symbol"?e:String(e)}function jg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class $g extends ct{constructor(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super(),Ve(this,"_eElement",void 0),Ve(this,"_oDocument",void 0),Ve(this,"_eBody",void 0),Ve(this,"_destroyAfterMouseUp",void 0),Ve(this,"_nDelay",400),Ve(this,"_timeout",void 0),Ve(this,"timeout",void 0),Ve(this,"_nDistance",10),Ve(this,"_nX",0),Ve(this,"_nY",0),Ve(this,"_nOriginalX",0),Ve(this,"_nOriginalY",0),Ve(this,"_bDragging",!1),this._eElement=e,this._oDocument=M(document),this._eBody=M(document.body),this._destroyAfterMouseUp=r,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this._startDrag=this._startDrag.bind(this),(t=this._eElement)===null||t===void 0||t.on("mousedown",this.onMouseDown)}destroy(){var e,t;(e=this._eElement)===null||e===void 0||e.unbind("mousedown",this.onMouseDown),(t=this._oDocument)===null||t===void 0||t.unbind("mouseup",this.onMouseUp),this._eElement=void 0,this._oDocument=void 0,this._eBody=void 0,clearTimeout(this._timeout),this._timeout=void 0}onMouseDown(e){if(e.preventDefault(),e.button===0){var t,r,i,o,a=this._getCoordinates(e);this._nOriginalX=(t=a.x)!==null&&t!==void 0?t:0,this._nOriginalY=(r=a.y)!==null&&r!==void 0?r:0,(i=this._oDocument)===null||i===void 0||i.on("mousemove",this.onMouseMove),(o=this._oDocument)===null||o===void 0||o.on("mouseup",this.onMouseUp),this._timeout=window.setTimeout(this._startDrag,this._nDelay)}}onMouseMove(e){if(this._timeout!=null){var t,r;e.preventDefault();var i=this._getCoordinates(e);this._nX=((t=i.x)!==null&&t!==void 0?t:0)-this._nOriginalX,this._nY=((r=i.y)!==null&&r!==void 0?r:0)-this._nOriginalY,this._bDragging===!1&&(Math.abs(this._nX)>this._nDistance||Math.abs(this._nY)>this._nDistance)&&this._startDrag(),this._bDragging&&this.emit("drag",this._nX,this._nY,e)}}onMouseUp(e){if(this._timeout!=null){var t,r,i,o,a;if(clearTimeout(this._timeout),(t=this._oDocument)===null||t===void 0||t.unbind("mousemove",this.onMouseMove),(r=this._oDocument)===null||r===void 0||r.unbind("mouseup",this.onMouseUp),(i=this._oDocument)===null||i===void 0||(o=i.find("iframe"))===null||o===void 0||o.css("pointer-events",""),this._bDragging===!0&&(this._bDragging=!1,this.emit("dragStop",e,this._nOriginalX+this._nX)),(a=this._eBody)===null||a===void 0||a.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var s;(s=this._eElement)===null||s===void 0||s.removeClass("lm_dragging")}this._destroyAfterMouseUp&&this.destroy()}}_startDrag(){var e,t,r,i;window.clearTimeout(this._timeout),this._bDragging=!0,(e=this._eBody)===null||e===void 0||e.addClass("lm_dragging"),(t=this._eElement)===null||t===void 0||t.addClass("lm_dragging"),(r=this._oDocument)===null||r===void 0||(i=r.find("iframe"))===null||i===void 0||i.css("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)}_getCoordinates(e){var t,r;return{x:(t=e.pageX)!==null&&t!==void 0?t:0,y:(r=e.pageY)!==null&&r!==void 0?r:0}}}const rr=$g;function gn(n,e,t){return e=Hg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Hg(n){var e=Bg(n,"string");return typeof e=="symbol"?e:String(e)}function Bg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class jl{constructor(e,t){gn(this,"_container",void 0),gn(this,"_reactComponent",null),gn(this,"_portalComponent",null),gn(this,"_originalComponentWillUpdate",null),gn(this,"_initialState",void 0),gn(this,"_reactClass",void 0),this._reactComponent=null,this._portalComponent=null,this._originalComponentWillUpdate=null,this._container=e,this._initialState=t,this._reactClass=this._getReactClass(),this._container.on("open",this._render,this),this._container.on("destroy",this._destroy,this)}_key(){var e=this._container._config.id;if(!e)throw new Error("Cannot mount panel without id");return Array.isArray(e)?e.join(","):e}_render(){var e=this._key();this._portalComponent=Hr.createPortal(this._getReactComponent(),this._container.getElement()[0],e),this._container.layoutManager.addReactChild(e,this._portalComponent)}_gotReactComponent(e){if(e){this._reactComponent=e,this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate||function(){},this._reactComponent.componentWillUpdate=this._onUpdate.bind(this);var t=this._container.getState();t&&this._reactComponent.setState(t)}}_destroy(){this._container.layoutManager.removeReactChild(this._key(),this._portalComponent),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)}_onUpdate(e,t){var r;this._container.setState(t),(r=this._originalComponentWillUpdate)===null||r===void 0||r.call(this._reactComponent,e,t)}_getReactClass(){var e=this._container._config.component;if(!e)throw new Error("No react component name. type: react-component needs a field `component`");var t=this._container.layoutManager.getComponent(e)||this._container.layoutManager.getFallbackComponent();if(!t)throw new Error('React component "'+e+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return t}_getReactComponent(){var e={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},t=M.extend(e,this._container._config.props);return H.createElement(this._reactClass,t)}}var Fr=["settings","hasHeaders","constrainDragToContainer","selectionEnabled","dimensions","borderWidth","minItemHeight","minItemWidth","headerHeight","dragProxyWidth","dragProxyHeight","labels","close","maximise","minimise","popout","content","componentName","componentState","id","width","type","height","isClosable","title","popoutWholeStack","openPopouts","parentId","activeItemIndex","reorderEnabled","borderGrabWidth"],Wg=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function zi(n){if(Fr.length>36)throw new Error("Too many keys in config minifier map");var e={};return Gi(n,e,"_min"),e}function Ei(n){if(Fr.length>36)throw new Error("Too many keys in config minifier map");var e={};return Gi(n,e,"_max"),e}function Gi(n,e,t){var r=t==="_min"?Ug:Vg;for(var i in n)if(n.hasOwnProperty(i)){var o=Array.isArray(n)?n[Number.parseInt(i,10)]:n[i];if(typeof o=="object"&&o!=null){var a=o instanceof Array?[]:{};if(Array.isArray(e))e[Number.parseInt(i,10)]=a;else{var s=r(i,Fr);e[s]=a}Gi(o,a,t)}else{var l=r(o,Wg);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var d=r(i,Fr);e[d]=l}}}}function Ug(n,e){if(typeof n=="string"&&n.length===1)return"___"+n;var t=e.indexOf(n);return t===-1?n:t.toString(36)}function Vg(n,e){return typeof n=="string"&&n.length===1?e[parseInt(n,36)]:typeof n=="string"&&n.substr(0,3)==="___"?n[3]:n}function ui(n,e,t){return e=Kg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Kg(n){var e=zg(n,"string");return typeof e=="symbol"?e:String(e)}function zg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class _i{constructor(e,t){ui(this,"name",void 0),ui(this,"origin",void 0),ui(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function pr(n,e,t){return e=Gg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Gg(n){var e=qg(n,"string");return typeof e=="symbol"?e:String(e)}function qg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}let Xg=class extends ct{constructor(e){super(),pr(this,"_layoutManager",void 0),pr(this,"_dontPropagateToParent",void 0),pr(this,"_childEventSource",void 0),pr(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(ct.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),M(window).on("gl_child_event",this._boundOnEventFromChild)}_onEventFromThis(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this._layoutManager.isSubWindow&&t[0]!==this._dontPropagateToParent&&this._propagateToParent(t),this._propagateToChildren(t),this._dontPropagateToParent=null,this._childEventSource=null}_$onEventFromParent(e){this._dontPropagateToParent=e[0],this.emit.apply(this,e)}_onEventFromChild(e){this._childEventSource=e.originalEvent.__gl,this.emit.apply(this,e.originalEvent.__glArgs)}_propagateToParent(e){var t,r="gl_child_event",i=(t=window.opener)===null||t===void 0?void 0:t.document.createEvent("HTMLEvents");i.initEvent(r,!0,!0),i.eventName=r,i.__glArgs=e,i.__gl=this._layoutManager,window.opener.dispatchEvent(i)}_propagateToChildren(e){for(var t=0;t<this._layoutManager.openPopouts.length;t++){var r=this._layoutManager.openPopouts[t].getGlInstance();r&&r!==this._childEventSource&&r.eventHub._$onEventFromParent(e)}}destroy(){M(window).off("gl_child_event",this._boundOnEventFromChild)}};const $l=Xg,Zg=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:_i,DragListener:rr,EventEmitter:ct,EventHub:$l,ReactComponentHandler:jl,animFrame:Vi,filterXss:Rg,getHashValue:Rl,getQueryStringParam:kl,getUniqueId:Lr,minifyConfig:zi,removeFromArray:Fg,stripTags:Ki,unminifyConfig:Ei},Symbol.toStringTag,{value:"Module"}));function Rt(n,e,t){return e=Yg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Yg(n){var e=Qg(n,"string");return typeof e=="symbol"?e:String(e)}function Qg(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Hl extends ct{constructor(e,t,r,i,o){super(),Rt(this,"isInitialised",!1),Rt(this,"_config",void 0),Rt(this,"_dimensions",void 0),Rt(this,"_parentId",void 0),Rt(this,"_indexInParent",void 0),Rt(this,"_layoutManager",void 0),Rt(this,"_popoutWindow",null),Rt(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=r,this._indexInParent=i,this._layoutManager=o,this._createWindow()}toConfig(){var e,t,r,i,o,a,s,l,d,h,c;if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");return{dimensions:{width:(e=this.getGlInstance())===null||e===void 0?void 0:e.width,height:(t=this.getGlInstance())===null||t===void 0?void 0:t.height,left:(r=(i=(o=this._popoutWindow)===null||o===void 0?void 0:o.screenX)!==null&&i!==void 0?i:(a=this._popoutWindow)===null||a===void 0?void 0:a.screenLeft)!==null&&r!==void 0?r:0,top:(s=(l=(d=this._popoutWindow)===null||d===void 0?void 0:d.screenY)!==null&&l!==void 0?l:(h=this._popoutWindow)===null||h===void 0?void 0:h.screenTop)!==null&&s!==void 0?s:0},content:(c=this.getGlInstance())===null||c===void 0?void 0:c.toConfig().content,parentId:this._parentId,indexInParent:this._indexInParent}}getGlInstance(){var e;return(e=this._popoutWindow)===null||e===void 0?void 0:e.__glInstance}getWindow(){return this._popoutWindow}close(){if(this.getGlInstance()){var e;(e=this.getGlInstance())===null||e===void 0||e._$closeWindow()}else try{var t;(t=this.getWindow())===null||t===void 0||t.close()}catch{}}popIn(){var e;this._indexInParent;var t=null,r=null;if(this._parentId){var i;if(t=M.extend(!0,{},(i=this.getGlInstance())===null||i===void 0?void 0:i.toConfig()).content[0],r=this._layoutManager.root.getItemsById(this._parentId)[0],!r){var o;((o=this._layoutManager.root.contentItems.length)!==null&&o!==void 0?o:0)>0?r=this._layoutManager.root.contentItems[0]:r=this._layoutManager.root}}t&&((e=r)===null||e===void 0||e.addChild(t,this._indexInParent),this.close())}_createWindow(){var e=this._createUrl(),t=Math.floor(Math.random()*1e6).toString(36),r=this._serializeWindowOptions({width:this._dimensions.width,height:this._dimensions.height,innerWidth:this._dimensions.width,innerHeight:this._dimensions.height,menubar:"no",toolbar:"no",location:"no",personalbar:"no",resizable:"yes",scrollbars:"no",status:"no"});if(this._popoutWindow=window.open(e,t,r),!this._popoutWindow)if(this._layoutManager.config.settings.blockedPopoutsThrowError===!0){var i=new Error("Popout blocked");throw i.type="popoutBlocked",i}else return;M(this._popoutWindow).on("load",this._positionWindow.bind(this)).on("unload beforeunload",this._onClose.bind(this));var o=window.setInterval(()=>{var a;(a=this._popoutWindow)!==null&&a!==void 0&&a.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),window.clearInterval(o))},10)}_serializeWindowOptions(e){var t=[],r;for(r in e)t.push(r+"="+e[r]);return t.join(",")}_createUrl(){var e={content:this._config},t="gl-window-config-"+Lr();e=zi(e);try{localStorage.setItem(t,JSON.stringify(e))}catch(i){throw new Error("Error while writing to localStorage "+i.toString())}var r=document.location.href.split("?");return r.length===1?r[0]+"?gl-window="+t:document.location.href+"&gl-window="+t}_positionWindow(){var e,t;(e=this._popoutWindow)===null||e===void 0||e.moveTo(this._dimensions.left,this._dimensions.top),(t=this._popoutWindow)===null||t===void 0||t.focus()}_onInitialised(){var e;this.isInitialised=!0,(e=this.getGlInstance())===null||e===void 0||e.on("popIn",this.popIn,this),this.emit("initialised")}_onClose(){setTimeout(this.emit.bind(this,"closed"),50)}}function Pe(n,e,t){return e=Jg(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Jg(n){var e=ep(n,"string");return typeof e=="symbol"?e:String(e)}function ep(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class mn extends ct{constructor(e,t,r,i,o,a){var s,l,d,h,c,f,v,p;if(super(),Pe(this,"_dragListener",void 0),Pe(this,"_layoutManager",void 0),Pe(this,"_contentItem",void 0),Pe(this,"_originalParent",void 0),Pe(this,"_area",null),Pe(this,"_lastValidArea",null),Pe(this,"_minX",void 0),Pe(this,"_maxX",void 0),Pe(this,"_minY",void 0),Pe(this,"_maxY",void 0),Pe(this,"_width",void 0),Pe(this,"_height",void 0),Pe(this,"_sided",void 0),Pe(this,"element",void 0),Pe(this,"childElementContainer",void 0),Pe(this,"_proxyTab",void 0),this._dragListener=r,this._layoutManager=i,this._contentItem=o,this._originalParent=a,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var g,y;this._layoutManager.tabDropPlaceholder.width((g=this._contentItem.tab.element.outerWidth(!0))!==null&&g!==void 0?g:0),this._layoutManager.tabDropPlaceholder.height((y=this._contentItem.tab.element.outerHeight(!0))!==null&&y!==void 0?y:0)}if(this.element=M(mn._template),a&&a._side&&(this._sided=a._sided,this.element.addClass("lm_"+a._side),["right","bottom"].indexOf(a._side.toString())>=0&&this.element.find(".lm_content").after(this.element.find(".lm_header"))),this.element.css({left:e,top:t}),this._proxyTab=this.element.find(".lm_tab"),this._proxyTab.attr("title",Ki((s=this._contentItem.config.title)!==null&&s!==void 0?s:"")),this.element.find(".lm_title").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(),M(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var P,O;this._layoutManager.tabDropPlaceholder.width((P=this._proxyTab.outerWidth(!0))!==null&&P!==void 0?P:0),this._layoutManager.tabDropPlaceholder.height((O=this._proxyTab.outerHeight(!0))!==null&&O!==void 0?O:0)}var _=this._layoutManager.container.offset();this._minX=(d=_?.left)!==null&&d!==void 0?d:0,this._minY=(h=_?.top)!==null&&h!==void 0?h:0,this._maxX=((c=this._layoutManager.container.width())!==null&&c!==void 0?c:0)+this._minX,this._maxY=((f=this._layoutManager.container.height())!==null&&f!==void 0?f:0)+this._minY,this._width=(v=this.element.width())!==null&&v!==void 0?v:0,this._height=(p=this.element.height())!==null&&p!==void 0?p:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,r){var i,o,a=(i=r.pageX)!==null&&i!==void 0?i:0,s=(o=r.pageY)!==null&&o!==void 0?o:0,l=a>this._minX&&a<this._maxX&&s>this._minY&&s<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(a,s)}_setDropPosition(e,t){this.element.css({left:e,top:t}),this._area=this._layoutManager._$getArea(e,t),this._area!==null&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(e,t,this._area))}_onDrop(){var e;(e=this._layoutManager.dropTargetIndicator)===null||e===void 0||e.hide(),this._area!==null?this._area.contentItem._$onDrop(this._contentItem,this._area):this._lastValidArea!==null?this._lastValidArea.contentItem._$onDrop(this._contentItem,this._lastValidArea):this._originalParent?this._originalParent.addChild(this._contentItem):this._contentItem._$destroy(),this._dragListener.off("drag",this._onDrag,this),this._dragListener.off("dragStop",this._onDrop,this),this.element.remove(),this._layoutManager.emit("itemDropped",this._contentItem)}_updateTree(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(null)}_setDimensions(){var e=this._layoutManager.config.dimensions,t=e.dragProxyWidth,r=e.dragProxyHeight;this.element.width(t),this.element.height(r),t-=this._sided?e.headerHeight:0,r-=this._sided?0:e.headerHeight,this.childElementContainer.width(t),this.childElementContainer.height(r),this._contentItem.element.width(t),this._contentItem.element.height(r),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}Pe(mn,"_template",'<div class="lm_dragProxy"><div class="lm_header"><ul class="lm_tabs"><li class="lm_tab lm_active"><i class="lm_left"></i><span class="lm_title"></span><i class="lm_right"></i></li></ul></div><div class="lm_content"></div></div>');function br(n,e,t){return e=tp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function tp(n){var e=np(n,"string");return typeof e=="symbol"?e:String(e)}function np(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Bl{constructor(e,t,r){br(this,"_element",void 0),br(this,"_itemConfig",void 0),br(this,"_layoutManager",void 0),br(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=r,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new rr(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this),this._dragListener}_onDragStart(e,t){var r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(M.extend(!0,{},r));new mn(e,t,this._dragListener,this._layoutManager,i,null)}}function yr(n,e,t){return e=rp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function rp(n){var e=ip(n,"string");return typeof e=="symbol"?e:String(e)}function ip(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Wl{constructor(e,t,r){yr(this,"_element",M(window)),yr(this,"_itemConfig",void 0),yr(this,"_layoutManager",void 0),yr(this,"_dragListener",void 0),this._itemConfig=e,this._layoutManager=t,this._createDragListener(r)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&(this._dragListener=new rr(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._destroy,this),this._dragListener.onMouseDown(e),this._dragListener._startDrag())}_destroy(){this._dragListener=void 0,this._element=void 0,this._itemConfig=void 0,this._layoutManager=void 0}_onDragStart(e,t){if(!(!this._dragListener||!this._layoutManager)){var r=this._itemConfig;typeof r=="function"&&(r=r());var i=this._layoutManager._$normalizeContentItem(M.extend(!0,{},r));new mn(e,t,this._dragListener,this._layoutManager,i,null)}}}function Ul(n,e,t){return e=op(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function op(n){var e=ap(n,"string");return typeof e=="symbol"?e:String(e)}function ap(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class ir{constructor(){Ul(this,"element",M(ir._template)),M(document.body).append(this.element)}destroy(){this.element.remove()}highlightArea(e){this.element.css({left:e.x1,top:e.y1,width:Math.floor(e.x2-e.x1),height:Math.floor(e.y2-e.y1)}).show()}hide(){this.element.hide()}}Ul(ir,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function hi(n,e,t){return e=sp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function sp(n){var e=lp(n,"string");return typeof e=="symbol"?e:String(e)}function lp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Wn{constructor(e,t,r,i){hi(this,"element",void 0),hi(this,"_header",void 0),hi(this,"_action",void 0),this._header=e,this.element=M('<li class="'+r+'" title="'+t+'"></li>'),this._header.on("destroy",this._$destroy,this),this._action=i,this.element.on("click",this._action),this._header.controlsContainer.append(this.element)}_$destroy(){this.element.off(),this.element.remove()}}function dp(n,e,t){return e=up(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function up(n){var e=hp(n,"string");return typeof e=="symbol"?e:String(e)}function hp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class cp extends Error{constructor(e,t){super(),dp(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const on=cp,mp=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:on},Symbol.toStringTag,{value:"Module"}));function Se(n,e,t){return e=fp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fp(n){var e=vp(n,"string");return typeof e=="symbol"?e:String(e)}function vp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function an(n){return n.isStack}function qe(n){return n.isComponent}function Vl(n){return n.isRoot}class Ie extends ct{constructor(e,t,r,i){super(),Se(this,"config",void 0),Se(this,"type",void 0),Se(this,"contentItems",void 0),Se(this,"parent",void 0),Se(this,"layoutManager",void 0),Se(this,"element",void 0),Se(this,"childElementContainer",void 0),Se(this,"componentName",void 0),Se(this,"isInitialised",!1),Se(this,"isMaximised",!1),Se(this,"isRoot",!1),Se(this,"isRow",!1),Se(this,"isColumn",!1),Se(this,"isStack",!1),Se(this,"isComponent",!1),Se(this,"tab",void 0),Se(this,"_pendingEventPropagations",void 0),Se(this,"_throttledEvents",void 0),this.element=i,this.config=this._extendItemNode(t),this.type=t.type,this.contentItems=[],this.parent=r,this.layoutManager=e,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(ct.ALL_EVENT,this._propagateEvent,this),t.content&&this._createContentItems(t)}callDownwards(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;r!==!0&&i!==!0&&this[e].apply(this,t);for(var o=0;o<this.contentItems.length;o++)this.contentItems[o].callDownwards(e,t,r);r===!0&&i!==!0&&this[e].apply(this,t)}removeChild(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=this.contentItems.indexOf(e);if(i===-1)throw new Error("Can't remove child item. Unknown content item");if(r!==!0&&this.contentItems[i]._$destroy(),this.contentItems.splice(i,1),(t=this.config.content)===null||t===void 0||t.splice(i,1),this.contentItems.length>0)this.callDownwards("setSize");else if(this.type!=="root"&&this.config.isClosable){var o;(o=this.parent)===null||o===void 0||o.removeChild(this)}}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.splice(t,0,e),this.config.content===void 0&&(this.config.content=[]),this.config.content.splice(t,0,e.config),e.parent=this,e.parent.isInitialised===!0&&e.isInitialised===!1&&e._$init()}replaceChild(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;t=this.layoutManager._$normalizeContentItem(t);var i=this.contentItems.indexOf(e),o=e.element[0].parentNode;if(i===-1)throw new Error("Can't replace child. oldChild is not child of this");o?.replaceChild(t.element[0],e.element[0]),r===!0&&(e.parent=null,e._$destroy()),this.contentItems[i]=t,t.parent=this,an(this)&&(this.header.tabs[i].contentItem=t),t.parent.isInitialised===!0&&t.isInitialised===!1&&t._$init(),this.callDownwards("setSize")}remove(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}popout(){var e=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),e}toggleMaximise(e){e&&e.preventDefault(),this.isMaximised===!0?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximised=!this.isMaximised,this.emitBubblingEvent("stateChanged")}select(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))}deselect(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))}setTitle(e){this.config.title=e,this.emit("titleChanged",e),this.emitBubblingEvent("stateChanged")}hasId(e){if(this.config.id){if(typeof this.config.id=="string")return this.config.id===e;if(this.config.id instanceof Array)return this.config.id.indexOf(e)!==-1}else return!1}addId(e){this.hasId(e)||(this.config.id?typeof this.config.id=="string"?this.config.id=[this.config.id,e]:this.config.id instanceof Array&&this.config.id.push(e):this.config.id=e)}removeId(e){if(!this.hasId(e))throw new Error("Id not found");if(typeof this.config.id=="string")delete this.config.id;else if(this.config.id instanceof Array){var t=this.config.id.indexOf(e);this.config.id.splice(t,1)}}getItemsByFilter(e){var t=[],r=function i(o){for(var a=0;a<o.contentItems.length;a++)e(o.contentItems[a])===!0&&t.push(o.contentItems[a]),i(o.contentItems[a])};return r(this),t}getItemsById(e){return this.getItemsByFilter(function(t){return t.config.id instanceof Array?t.config.id.indexOf(e)!==-1:t.config.id===e})}getItemsByType(e){return this._$getItemsByProperty("type",e)}getComponentsByName(e){for(var t=this._$getItemsByProperty("componentName",e),r=[],i=0;i<t.length;i++)r.push(t[i].instance);return r}_$getItemsByProperty(e,t){return this.getItemsByFilter(function(r){return r[e]===t})}_$setParent(e){this.parent=e}_$highlightDropZone(e,t,r){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(r)}_$onDrop(e,t){this.addChild(e)}_$hide(){this._callOnActiveComponents("hide"),this.element.hide(),this.layoutManager.updateSize()}_$show(){this._callOnActiveComponents("show"),this.element.show(),this.layoutManager.updateSize()}_callOnActiveComponents(e){for(var t=this.getItemsByType("stack"),r=null,i=0;i<t.length;i++)r=t[i].getActiveContentItem(),r&&qe(r)&&r.container[e]()}_$destroy(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")}_$getArea(e){var t,r,i;e=e||this.element;var o=(t=e.offset())!==null&&t!==void 0?t:{left:0,top:0},a=(r=e.width())!==null&&r!==void 0?r:0,s=(i=e.height())!==null&&i!==void 0?i:0;return{x1:o.left,y1:o.top,x2:o.left+a,y2:o.top+s,surface:a*s,contentItem:this,side:""}}_$init(){this.setSize();for(var e=0;e<this.contentItems.length;e++){var t;(t=this.childElementContainer)===null||t===void 0||t.append(this.contentItems[e].element)}this.isInitialised=!0,this.emitBubblingEvent("itemCreated"),this.emitBubblingEvent(this.type+"Created")}emitBubblingEvent(e){var t=new _i(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new on("content must be an Array",e);for(var r=0;r<e.content.length;r++)t=this.layoutManager.createContentItem(e.content[r],this),this.contentItems.push(t)}_extendItemNode(e){for(var[t,r]of Object.entries(Fl)){var i=t;e[i]===void 0&&(e[i]=r)}return e}_propagateEvent(e,t){t instanceof _i&&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,Vi(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function Ln(n,e,t){return e=gp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function gp(n){var e=pp(n,"string");return typeof e=="symbol"?e:String(e)}function pp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Kl extends Ie{constructor(e,t,r){var i;Object.entries((i=e.config.settings.defaultComponentConfig)!==null&&i!==void 0?i:{}).forEach(s=>{var[l,d]=s;t[l]===void 0&&(t[l]=d)}),super(e,t,r,M()),Ln(this,"config",void 0),Ln(this,"componentName",void 0),Ln(this,"container",void 0),Ln(this,"parent",void 0),Ln(this,"instance",void 0),this.config=t,this.parent=r;var o=e.getComponent(this.config.componentName)||e.getFallbackComponent(),a=M.extend(!0,{},this.config.componentState||{});if(o==null)throw new on('Unknown component "'+this.config.componentName+'"');a.componentName=this.config.componentName,this.componentName=this.config.componentName,this.config.title===""&&(this.config.title=this.config.componentName),this.isComponent=!0,this.container=new wi(this.config,this,e),this.instance=new o(this.container,a),this.element=this.container._element}close(){this.parent.removeChild(this)}setSize(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())}_$init(){Ie.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),Ie.prototype._$hide.call(this)}_$show(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),Ie.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),Ie.prototype._$destroy.call(this)}_$getArea(){return null}}function et(n,e,t){return e=bp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bp(n){var e=yp(n,"string");return typeof e=="symbol"?e:String(e)}function yp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Rr extends Ie{constructor(e,t,r,i){super(t,r,i,M('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),et(this,"isRow",void 0),et(this,"isColumn",void 0),et(this,"childElementContainer",void 0),et(this,"parent",void 0),et(this,"_splitter",[]),et(this,"_splitterSize",void 0),et(this,"_splitterGrabSize",void 0),et(this,"_isColumn",void 0),et(this,"_dimension",void 0),et(this,"_splitterPosition",null),et(this,"_splitterMinPosition",null),et(this,"_splitterMaxPosition",null),this.parent=i,this.isRow=!e,this.isColumn=e,this.childElementContainer=this.element,this._splitterSize=t.config.dimensions.borderWidth,this._splitterGrabSize=t.config.dimensions.borderGrabWidth,this._isColumn=e,this._dimension=e?"height":"width",this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null}addChild(e,t,r){var i,o,a,s;if(e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.length>0?(s=this._createSplitter(Math.max(0,t-1)).element,t>0?(this.contentItems[t-1].element.after(s),s.after(e.element)):(this.contentItems[0].element.before(s),s.before(e.element))):this.childElementContainer.append(e.element),Ie.prototype.addChild.call(this,e,t),i=1/this.contentItems.length*100,r===!0){this.emitBubblingEvent("stateChanged");return}for(a=0;a<this.contentItems.length;a++)if(this.contentItems[a]===e)e.config[this._dimension]=i;else{var l;o=((l=this.contentItems[a].config[this._dimension])!==null&&l!==void 0?l:0)*(100-i)/100,this.contentItems[a].config[this._dimension]=o}this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}removeChild(e,t){var r,i=(r=e.config[this._dimension])!==null&&r!==void 0?r:0,o=this.contentItems.indexOf(e),a=Math.max(o-1,0),s,l;if(o===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[a]&&(this._splitter[a]._$destroy(),this._splitter.splice(a,1)),s=0;s<this.contentItems.length;s++)if(this.contentItems[s]!==e){var d;this.contentItems[s].config[this._dimension]=((d=this.contentItems[s].config[this._dimension])!==null&&d!==void 0?d:0)+i/(this.contentItems.length-1)}Ie.prototype.removeChild.call(this,e,t),this.contentItems.length===1&&this.config.isClosable===!0?(l=this.contentItems[0],this.contentItems=[],this.parent.replaceChild(this,l,!0)):(this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged"))}replaceChild(e,t){var r=e.config[this._dimension];super.replaceChild(e,t),t.config[this._dimension]=r,this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(){this.contentItems.length>0&&(this._calculateRelativeSizes(),this._setAbsoluteSizes()),this.emitBubblingEvent("stateChanged"),this.emit("resize")}_$init(){if(this.isInitialised!==!0){var e;for(Ie.prototype._$init.call(this),e=0;e<this.contentItems.length-1;e++)this.contentItems[e].element.after(this._createSplitter(e).element)}}_setAbsoluteSizes(){var e,t=this._calculateAbsoluteSizes();for(e=0;e<this.contentItems.length;e++)t.additionalPixel-e>0&&t.itemSizes[e]++,this._isColumn?(this.contentItems[e].element.width(t.totalWidth),this.contentItems[e].element.height(t.itemSizes[e])):(this.contentItems[e].element.width(t.itemSizes[e]),this.contentItems[e].element.height(t.totalHeight))}_calculateAbsoluteSizes(){var e,t,r=(this.contentItems.length-1)*this._splitterSize,i=(e=this.element.width())!==null&&e!==void 0?e:0,o=(t=this.element.height())!==null&&t!==void 0?t:0,a=0,s=[];this._isColumn?o-=r:i-=r;for(var l=0;l<this.contentItems.length;l++){var d,h,c=this._isColumn?Math.floor(o*(((d=this.contentItems[l].config.height)!==null&&d!==void 0?d:0)/100)):Math.floor(i*(((h=this.contentItems[l].config.width)!==null&&h!==void 0?h:0)/100));a+=c,s.push(c)}var f=Math.floor((this._isColumn?o:i)-a);return{itemSizes:s,additionalPixel:f,totalWidth:i,totalHeight:o}}_calculateRelativeSizes(){for(var e=0,t=[],r=this._isColumn?"height":"width",i=0;i<this.contentItems.length;i++){var o=this.contentItems[i].config[r];o!=null?e+=o:t.push(this.contentItems[i])}if(Math.round(e)===100){this._respectMinItemWidth();return}if(Math.round(e)<100&&t.length>0){for(var a=0;a<t.length;a++)t[a].config[r]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var s=0;s<t.length;s++)t[s].config[r]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var d;this.contentItems[l].config[r]=((d=this.contentItems[l].config[r])!==null&&d!==void 0?d:0)/e*100}this._respectMinItemWidth()}_respectMinItemWidth(){var e,t=this.layoutManager.config.dimensions&&(e=this.layoutManager.config.dimensions.minItemWidth)!==null&&e!==void 0?e:0,r=[],i=0,o=0,a=0,s=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var d=this._calculateAbsoluteSizes(),h=0;h<this.contentItems.length;h++){this.contentItems[h];var c=d.itemSizes[h];c<t?(o+=t-c,l={width:t}):(i+=c-t,l={width:c},r.push(l)),s.push(l)}if(!(o===0||o>i)){var f=o/i;a=o;for(var v=0;v<r.length;v++){l=r[v];var p=Math.round((l.width-t)*f);a-=p,l.width-=p}a!==0&&(s[s.length-1].width-=a);for(var g=0;g<this.contentItems.length;g++)this.contentItems[g].config.width=s[g].width/d.totalWidth*100}}}_createSplitter(e){var t;return t=new zl(this._isColumn,this._splitterSize,this._splitterGrabSize),t.on("drag",this._onSplitterDrag.bind(this,t),this),t.on("dragStop",this._onSplitterDragStop.bind(this,t),this),t.on("dragStart",this._onSplitterDragStart.bind(this,t),this),this._splitter.splice(e,0,t),t}_getItemsForSplitter(e){var t=this._splitter.indexOf(e);if(t<0)throw new Error("Splitter not found in RowOrColumn");return{before:this.contentItems[t],after:this.contentItems[t+1]}}_getMinimumDimensions(e){for(var t=0,r=0,i=0;i<e.length;++i){var o,a;t=Math.max((o=e[i].minWidth)!==null&&o!==void 0?o:0,t),r=Math.max((a=e[i].minHeight)!==null&&a!==void 0?a:0,r)}return{horizontal:t,vertical:r}}_onSplitterDragStart(e){var t,r,i,o,a=this._getItemsForSplitter(e),s=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=a.before.config.content)!==null&&t!==void 0?t:[]),d=this._isColumn?l.vertical:l.horizontal,h=this._getMinimumDimensions((r=a.after.config.content)!==null&&r!==void 0?r:[]),c=this._isColumn?h.vertical:h.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((i=a.before.element[this._dimension]())!==null&&i!==void 0?i:0)-(d||s)),this._splitterMaxPosition=((o=a.after.element[this._dimension]())!==null&&o!==void 0?o:0)-(c||s)}_onSplitterDrag(e,t,r){var i=this._isColumn?r:t;this._splitterMaxPosition==null||this._splitterMinPosition==null||i>this._splitterMinPosition&&i<this._splitterMaxPosition&&(this._splitterPosition=i,e.element.css(this._isColumn?"top":"left",i))}_onSplitterDragStop(e){var t,r,i,o,a,s=this._getItemsForSplitter(e),l=(t=s.before.element[this._dimension]())!==null&&t!==void 0?t:0,d=(r=s.after.element[this._dimension]())!==null&&r!==void 0?r:0,h=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+d),c=((o=s.before.config[this._dimension])!==null&&o!==void 0?o:0)+((a=s.after.config[this._dimension])!==null&&a!==void 0?a:0);s.before.config[this._dimension]=h*c,s.after.config[this._dimension]=(1-h)*c,e.element.css({top:0,left:0}),Vi(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function Ca(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Sa(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ca(Object(t),!0).forEach(function(r){Pi(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ca(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Pi(n,e,t){return e=Cp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Cp(n){var e=Sp(n,"string");return typeof e=="symbol"?e:String(e)}function Sp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ti extends Ie{constructor(e,t,r){super(e,Sa(Sa({},t),{},{type:"root"}),null,M('<div class="lm_goldenlayout lm_item lm_root"></div>')),Pi(this,"childElementContainer",void 0),Pi(this,"_containerElement",void 0),this.isRoot=!0,this.type="root",this.childElementContainer=this.element,this._containerElement=r,this._containerElement.append(this.element)}addChild(e,t){if(this.contentItems.length>0)throw new Error("Root node can only have a single child");e=this.layoutManager._$normalizeContentItem(e,this),this.childElementContainer.append(e.element),super.addChild(e,t),this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(e,t){var r,i;e=typeof e>"u"?(r=this._containerElement.width())!==null&&r!==void 0?r:0:e,t=typeof t>"u"?(i=this._containerElement.height())!==null&&i!==void 0?i:0:t,this.element.width(e),this.element.height(t),this.contentItems[0]&&(this.contentItems[0].element.width(e),this.contentItems[0].element.height(t))}_$getArea(){var e=super._$getArea();if(e==null)throw new Error("Unable to get root area");return e}_$highlightDropZone(e,t,r){this.layoutManager.tabDropPlaceholder.remove(),super._$highlightDropZone(e,t,r)}_$onDrop(e,t){var r;if(qe(e)&&(r=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this),r._$init(),r.addChild(e),e=r),!this.contentItems.length)this.addChild(e);else{var{side:i}=t,o=i==="left"||i==="right"?"row":"column",a=i==="left"||i==="right"?"width":"height",s=i==="left"||i==="top",l=this.contentItems[0];if(!(l instanceof Rr)||l.type!=o){var d=this.layoutManager.createContentItem({type:o},this);this.replaceChild(l,d),d.addChild(e,s?0:void 0,!0),d.addChild(l,s?void 0:0,!0),l.config[a]=50,e.config[a]=50,d.callDownwards("setSize")}else{var h,c=l.contentItems[s?0:l.contentItems.length-1];l.addChild(e,s?0:void 0,!0),c.config[a]=((h=c.config[a])!==null&&h!==void 0?h:0)*.5,e.config[a]=c.config[a],l.callDownwards("setSize")}}}}function wa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function pn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wa(Object(t),!0).forEach(function(r){Be(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):wa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Be(n,e,t){return e=wp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wp(n){var e=Ep(n,"string");return typeof e=="symbol"?e:String(e)}function Ep(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Oi extends Ie{constructor(e,t,r){var i,o,a,s,l,d,h,c,f;super(e,t,r,M('<div class="lm_item lm_stack"></div>')),Be(this,"_activeContentItem",null),Be(this,"_header",void 0),Be(this,"childElementContainer",M('<div class="lm_items"></div>')),Be(this,"header",void 0),Be(this,"parent",void 0),Be(this,"isStack",!0),Be(this,"_dropZones",{}),Be(this,"_dropSegment",null),Be(this,"_contentAreaDimensions",null),Be(this,"_dropIndex",void 0),Be(this,"_side",void 0),Be(this,"_sided",!1),Be(this,"config",void 0),this.parent=r,this.config=t;var v=e.config;this._side=!1,this._header={show:((i=v.settings)===null||i===void 0?void 0:i.hasHeaders)&&t.hasHeaders!==!1,popout:(o=v.settings)!==null&&o!==void 0&&o.showPopoutIcon?(a=v.labels)===null||a===void 0?void 0:a.popout:void 0,maximise:(s=v.settings)!==null&&s!==void 0&&s.showMaximiseIcon?(l=v.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(d=v.settings)!==null&&d!==void 0&&d.showCloseIcon?(h=v.labels)===null||h===void 0?void 0:h.close:void 0,minimise:(c=(f=v.labels)===null||f===void 0?void 0:f.minimise)!==null&&c!==void 0?c:void 0},v.header&&(this._header=pn(pn({},this._header),v.header)),t.header&&(this._header=pn(pn({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=pn(pn({},this._header),t.content[0].header)),this.header=new Nt(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,r,i,o,a=this._header.show&&(e=(t=this.layoutManager.config.dimensions)===null||t===void 0?void 0:t.headerHeight)!==null&&e!==void 0?e:0,s=((r=this.element.width())!==null&&r!==void 0?r:0)-(this._sided?a:0),l=((i=this.element.height())!==null&&i!==void 0?i:0)-(this._sided?0:a);for(this.childElementContainer.width(s),this.childElementContainer.height(l),o=0;o<this.contentItems.length;o++)this.contentItems[o].element.width(s).height(l);this.emit("resize"),this.emitBubblingEvent("stateChanged")}_$init(){if(this.isInitialised!==!0){this.header._attachWheelListener(),super._$init();for(var e=0;e<this.contentItems.length;e++)this.header.createTab(this.contentItems[e]),this.contentItems[e]._$hide();if(this.contentItems.length>0){var t=this.contentItems[this.config.activeItemIndex||0];if(!t)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(t)}}}setActiveContentItem(e){if(this.contentItems.indexOf(e)===-1)throw new Error("contentItem is not a child of this stack");this._activeContentItem!==null&&this._activeContentItem._$hide(),this._activeContentItem=e,this.header.setActiveContentItem(e),e._$show(),this.emit("activeContentItemChanged",e),this.layoutManager.emit("activeContentItemChanged",e),this.emitBubblingEvent("stateChanged")}getActiveContentItem(){return this.header.activeContentItem}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),super.addChild(e,t),this.childElementContainer.append(e.element),this.header.createTab(e,t),this.setActiveContentItem(e),this.callDownwards("setSize"),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}removeChild(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=this.contentItems.indexOf(e);super.removeChild(e,t),this.header.removeTab(e),this.header.activeContentItem===e&&(this.contentItems.length>0?this.setActiveContentItem(this.contentItems[Math.max(r-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}_$validateClosability(){for(var e=this.header._isClosable(),t=0,r=this.contentItems.length;t<r;t++){var i;if(!e)break;e=(i=this.contentItems[t].config.isClosable)!==null&&i!==void 0?i:!1}this.header._$setClosable(e)}_$destroy(){Ie.prototype._$destroy.call(this),this.header._$destroy()}_$onDrop(e){if(this._dropSegment==="header"){this._resetHeaderDropZone(),this.addChild(e,this._dropIndex);return}if(this._dropSegment==="body"){this.addChild(e);return}var t=this._dropSegment==="top"||this._dropSegment==="bottom",r=this._dropSegment==="left"||this._dropSegment==="right",i=this._dropSegment==="top"||this._dropSegment==="left",o=t&&this.parent.isColumn||r&&this.parent.isRow,a=t?"column":"row",s=t?"height":"width";if(qe(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(o){var d,h=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?h:h+1,!0),this.config[s]=((d=this.config[s])!==null&&d!==void 0?d:0)*.5,e.config[s]=this.config[s],this.parent.callDownwards("setSize")}else{var c=this.layoutManager.createContentItem({type:a},this);this.parent.replaceChild(this,c),c.addChild(e,i?0:void 0,!0),c.addChild(this,i?void 0:0,!0),this.config[s]=50,e.config[s]=50,c.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[r,i]of Object.entries(this._contentAreaDimensions)){var o=i.hoverArea;if(o.x1<e&&o.x2>e&&o.y1<t&&o.y2>t){r==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(r));return}}}_$getArea(){if(this.element.is(":visible")===!1)return null;var e=super._$getArea(this.header.element),t=super._$getArea(this.childElementContainer);if(e==null||t==null)return null;var r=t.x2-t.x1,i=t.y2-t.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}},this._activeContentItem&&this._activeContentItem.isComponent===!1?e:this.contentItems.length===0?(this._contentAreaDimensions.body={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}},super._$getArea(this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x1+r*.25,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x1+r*.5,y2:t.y2}},this._contentAreaDimensions.top={hoverArea:{x1:t.x1+r*.25,y1:t.y1,x2:t.x1+r*.75,y2:t.y1+i*.5},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y1+i*.5}},this._contentAreaDimensions.right={hoverArea:{x1:t.x1+r*.75,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1+r*.5,y1:t.y1,x2:t.x2,y2:t.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:t.x1+r*.25,y1:t.y1+i*.5,x2:t.x1+r*.75,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1+i*.5,x2:t.x2,y2:t.y2}},super._$getArea(this.element))}_highlightHeaderDropZone(e){var t,r,i,o,a,s,l,d,h,c,f,v,p,g,y,P,O=this.header.tabs.length;if(O===0){var _,R,U,Q,N,W,j,Y,ne=this.header.element.offset();(_=this.layoutManager.dropTargetIndicator)===null||_===void 0||_.highlightArea({x1:(R=ne?.left)!==null&&R!==void 0?R:0,x2:((U=ne?.left)!==null&&U!==void 0?U:0)+100,y1:(Q=(N=this.header.element.offset())===null||N===void 0?void 0:N.top)!==null&&Q!==void 0?Q:0,y2:((W=(j=this.header.element.offset())===null||j===void 0?void 0:j.top)!==null&&W!==void 0?W:0)+((Y=this.header.element.innerHeight())!==null&&Y!==void 0?Y:0)});return}var F=this.header.tabsContainer,q=(t=F.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),K=(r=this.layoutManager.tabDropPlaceholder.get(0))===null||r===void 0?void 0:r.getBoundingClientRect();if(!(!q||!K)){e<q.left?e=q.left+1:e>q.right&&(e=q.right-1);var A,V;if(!(K.left<e&&e<K.right)){for(var z=0;z<O;z++){var me;if(A=this.header.tabs[z].element,V=(me=A.get(0))===null||me===void 0?void 0:me.getBoundingClientRect(),V&&V.left<e&&e<V.right){this._dropIndex=z;break}}if(A&&V&&e<V.left+V.width*.5)A.before(this.layoutManager.tabDropPlaceholder);else if(A){var je;this._dropIndex=Math.min(((je=this._dropIndex)!==null&&je!==void 0?je:0)+1,O),A.after(this.layoutManager.tabDropPlaceholder)}}var De=(i=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&i!==void 0?i:0;De=Math.max(De,(a=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&a!==void 0?a:0);var b=De+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);b=Math.min(b,((d=(h=this.header.tabsContainer.offset())===null||h===void 0?void 0:h.left)!==null&&d!==void 0?d:0)+((c=this.header.tabsContainer.innerWidth())!==null&&c!==void 0?c:0)),(f=this.layoutManager.dropTargetIndicator)===null||f===void 0||f.highlightArea({x1:De,x2:b,y1:(v=(p=this.header.element.offset())===null||p===void 0?void 0:p.top)!==null&&v!==void 0?v:0,y2:((g=(y=this.header.element.offset())===null||y===void 0?void 0:y.top)!==null&&g!==void 0?g:0)+((P=this.header.element.innerHeight())!==null&&P!==void 0?P:0)})}}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){var e=["right","left","bottom"].some(r=>r===this._header.show)?this._header.show:void 0;if(this.header.element.toggle(!!this._header.show),!!e&&(this._side=e,this._sided=["right","left"].indexOf(this._side.toString())>=0,this.element.removeClass("lm_left lm_right lm_bottom"),this._side&&this.element.addClass("lm_"+this._side),this.element.find(".lm_header").length&&this.childElementContainer)){var t=["right","bottom"].indexOf(this._side.toString())>=0?"before":"after";this.header.element[t](this.childElementContainer),this.callDownwards("setSize")}}_highlightBodyDropZone(e){var t,r,i=(t=this._contentAreaDimensions)===null||t===void 0||(r=t[e])===null||r===void 0?void 0:r.highlightArea;if(i){var o;(o=this.layoutManager.dropTargetIndicator)===null||o===void 0||o.highlightArea(i)}this._dropSegment=e}}const _p=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:Ie,Component:Kl,ContentItem:Ie,Root:Ti,RowOrColumn:Rr,Stack:Oi,isComponent:qe,isRoot:Vl,isStack:an},Symbol.toStringTag,{value:"Module"}));function Ot(n,e,t){return e=Pp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Pp(n){var e=Tp(n,"string");return typeof e=="symbol"?e:String(e)}function Tp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class or{constructor(e,t){var r;Ot(this,"header",void 0),Ot(this,"contentItem",void 0),Ot(this,"element",M(or._template)),Ot(this,"titleElement",void 0),Ot(this,"closeElement",void 0),Ot(this,"isActive",!1),Ot(this,"_layoutManager",void 0),Ot(this,"_dragListener",void 0),this.header=e,this.contentItem=t,this.titleElement=this.element.find(".lm_title"),this.closeElement=this.element.find(".lm_close_tab"),this.closeElement[t.config.isClosable?"show":"hide"](),this.setTitle(t.config.title),this.contentItem.on("titleChanged",this.setTitle,this),this._layoutManager=this.contentItem.layoutManager,(r=this._layoutManager.config.settings)!==null&&r!==void 0&&r.reorderEnabled&&t.config.reorderEnabled&&(this._dragListener=new rr(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),qe(this.contentItem)&&(this.contentItem.container._contentElement.on("focusin",this._onTabContentFocusIn).on("focusout",this._onTabContentFocusOut),this.contentItem.container.tab=this,this.contentItem.container.emit("tab",this))}setTitle(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";this.titleElement.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),qe(this.contentItem)&&(this.contentItem.container._contentElement.off(),this.contentItem.container._contentElement[0].removeEventListener("click",this._onTabContentFocusIn,!0)),this._dragListener&&(this.contentItem.off("destroy",this._dragListener.destroy,this._dragListener),this._dragListener.off("dragStart",this._onDragStart),this._dragListener=void 0),this.element.remove()}_onDragStart(e,t){var r;(r=this.contentItem.parent)!==null&&r!==void 0&&r.isMaximised&&this.contentItem.parent.toggleMaximise(),this._dragListener&&new mn(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(){M(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin")}_onTabContentFocusOut(){qe(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.element.removeClass("lm_focusin")}_onTabClick(e){if(!e||e.button===0){var t,r=this.header.parent.getActiveContentItem();this.contentItem!==r&&qe(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):qe(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),qe(this.contentItem)&&this.contentItem.container.emit("tabClicked",e),this.header._hideAdditionalTabsDropdown(),(t=this.element.get(0))===null||t===void 0||t.scrollIntoView({inline:"nearest"})}else e.button===1&&this.contentItem.config.isClosable&&this._onCloseClick(e)}_onCloseClick(e){e.stopPropagation(),qe(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onCloseMousedown(e){e.stopPropagation()}}Ot(or,"_template",['<li class="lm_tab">','<span class="lm_title_before"></span>','<span class="lm_title"></span>','<div class="lm_close_tab" aria-label="Close tab"></div>',"</li>"].join(""));function oe(n,e,t){return e=Op(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Op(n){var e=Ip(n,"string");return typeof e=="symbol"?e:String(e)}function Ip(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Nt extends ct{constructor(e,t){var r,i;super(),oe(this,"layoutManager",void 0),oe(this,"element",M(Nt._template)),oe(this,"tabsContainer",void 0),oe(this,"tabDropdownContainer",void 0),oe(this,"tabDropdownSearch",void 0),oe(this,"tabDropdownList",null),oe(this,"controlsContainer",void 0),oe(this,"parent",void 0),oe(this,"tabs",[]),oe(this,"activeContentItem",null),oe(this,"closeButton",null),oe(this,"tabDropdownButton",null),oe(this,"tabNextButton",M(Nt._nextButtonTemplate)),oe(this,"tabPreviousButton",M(Nt._previousButtonTemplate)),oe(this,"holdTimer",null),oe(this,"rAF",null),oe(this,"CLICK_TIMEOUT",500),oe(this,"START_SPEED",.01),oe(this,"ACCELERATION",5e-4),oe(this,"PADDING",10),oe(this,"SCROLL_LEFT","left"),oe(this,"SCROLL_RIGHT","right"),oe(this,"isDraggingTab",!1),oe(this,"isOverflowing",!1),oe(this,"isDropdownShown",!1),oe(this,"dropdownKeyIndex",0),oe(this,"_lastVisibleTabIndex",-1),oe(this,"_tabControlOffset",void 0),this.layoutManager=e,(r=this.layoutManager.config.settings)!==null&&r!==void 0&&r.selectionEnabled&&(this.element.addClass("lm_selectable"),this.element.on("click",this._onHeaderClick.bind(this))),this.tabsContainer=this.element.find(".lm_tabs"),this.tabDropdownContainer=this.element.find(".lm_tabdropdown_list"),this.tabDropdownContainer.hide(),this.tabDropdownSearch=this.element.find(".lm_tabdropdown_search input"),this._handleFilterInput=this._handleFilterInput.bind(this),this._handleFilterKeydown=this._handleFilterKeydown.bind(this),this.tabDropdownSearch.on("input",this._handleFilterInput),this.tabDropdownSearch.on("keydown",this._handleFilterKeydown),this.controlsContainer=this.element.find(".lm_controls"),this.parent=t,this.parent.on("resize",this._updateTabSizes,this),this._handleItemPickedUp=this._handleItemPickedUp.bind(this),this._handleItemDropped=this._handleItemDropped.bind(this),this._handleNextMouseEnter=this._handleNextMouseEnter.bind(this),this._handleNextMouseLeave=this._handleNextMouseLeave.bind(this),this._handlePreviousMouseEnter=this._handlePreviousMouseEnter.bind(this),this._handlePreviousMouseLeave=this._handlePreviousMouseLeave.bind(this),this._handleScrollRepeat=this._handleScrollRepeat.bind(this),this._handleNextButtonMouseDown=this._handleNextButtonMouseDown.bind(this),this._handlePreviousButtonMouseDown=this._handlePreviousButtonMouseDown.bind(this),this._handleScrollButtonMouseDown=this._handleScrollButtonMouseDown.bind(this),this._handleScrollButtonMouseUp=this._handleScrollButtonMouseUp.bind(this),this._handleScrollEvent=this._handleScrollEvent.bind(this),this.tabNextButton.on("mousedown",this._handleNextButtonMouseDown),this.tabPreviousButton.on("mousedown",this._handlePreviousButtonMouseDown),this.tabsContainer.on("scroll",this._handleScrollEvent),this.layoutManager.on("itemPickedUp",this._handleItemPickedUp),this.layoutManager.on("itemDropped",this._handleItemDropped),this.tabsContainer.before(this.tabPreviousButton),this.tabPreviousButton=this.tabPreviousButton.find(">:first-child"),this.tabPreviousButton.hide(),this._showAdditionalTabsDropdown=this._showAdditionalTabsDropdown.bind(this),this._hideAdditionalTabsDropdown=this._hideAdditionalTabsDropdown.bind(this),this._tabControlOffset=(i=this.layoutManager.config.settings)===null||i===void 0?void 0:i.tabControlOffset,this._createControls()}createTab(e,t){for(var r=0;r<this.tabs.length;r++)if(this.tabs[r].contentItem===e)return;var i=new or(this,e);if(this.tabs.length===0){this.tabs.push(i),this.tabsContainer.append(i.element);return}t===void 0&&(t=this.tabs.length),t>0?this.tabs[t-1].element.after(i.element):this.tabs[0].element.before(i.element),this.tabs.splice(t,0,i),this._updateTabSizes()}removeTab(e){for(var t=0;t<this.tabs.length;t++)if(this.tabs[t].contentItem===e){this.tabs[t]._$destroy(),this.tabs.splice(t,1);return}throw new Error("contentItem is not controlled by this header")}setActiveContentItem(e){for(var t,r,i,o,a=0;a<this.tabs.length;a++)o=this.tabs[a].contentItem===e,this.tabs[a].setActive(o),o===!0&&(this.activeContentItem=e,this.parent.config.activeItemIndex=a);(t=this.tabs[(i=this.parent.config.activeItemIndex)!==null&&i!==void 0?i:0].element.get(0))===null||t===void 0||(r=t.scrollIntoView)===null||r===void 0||r.call(t,{inline:"nearest"}),this._hideAdditionalTabsDropdown(),this._updateTabSizes(),this.parent.emitBubblingEvent("stateChanged")}position(e){var t=this.parent._header.show;return t&&!this.parent._side&&(t="top"),e!==void 0&&this.parent._header.show!==e&&(this.parent._header.show=e,this.parent._setupHeaderPosition()),t}_attachWheelListener(){var e;(e=this.tabsContainer.get(0))===null||e===void 0||e.addEventListener("wheel",this._handleWheelEvent,{passive:!0})}_detachWheelListener(){var e;(e=this.tabsContainer.get(0))===null||e===void 0||e.removeEventListener("wheel",this._handleWheelEvent)}_handleWheelEvent(e){var t=e.currentTarget;if(t instanceof HTMLElement){var r=Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX;if(e.deltaMode===WheelEvent.DOM_DELTA_PAGE){var i;r*=(i=this.tabsContainer.innerWidth())!==null&&i!==void 0?i:1}else e.deltaMode===WheelEvent.DOM_DELTA_LINE&&(r*=100/3);t.scrollLeft+=Math.round(r)}}_handleScrollEvent(){this._checkScrollArrows()}_handleItemPickedUp(){this.isDraggingTab=!0,this.isDropdownShown&&this._hideAdditionalTabsDropdown(),this.controlsContainer.on("mouseenter",this._handleNextMouseEnter),this.tabPreviousButton.on("mouseenter",this._handlePreviousMouseEnter)}_handleItemDropped(){var e;this.isDraggingTab=!1,window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.controlsContainer.off("mouseenter",this._handleNextMouseEnter),this.controlsContainer.off("mouseleave",this._handleNextMouseLeave),this.tabPreviousButton.off("mouseenter",this._handlePreviousMouseEnter),this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextMouseEnter(){var e;this.controlsContainer.on("mouseleave",this._handleNextMouseLeave),this._handleScrollRepeat(this.SCROLL_RIGHT,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)}_handlePreviousMouseEnter(){var e;this.tabPreviousButton.on("mouseleave",this._handlePreviousMouseLeave),this._handleScrollRepeat(this.SCROLL_LEFT,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)}_handleNextMouseLeave(){var e;window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.controlsContainer.off("mouseleave",this._handleNextMouseLeave)}_handlePreviousMouseLeave(){var e;window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextButtonMouseDown(){for(var e,t=0;t<this.tabs.length;t+=1){var r,i,o,a,s;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r:0)>((o=(a=this.tabsContainer.get(0))===null||a===void 0?void 0:a.offsetWidth)!==null&&o!==void 0?o:0)+((s=this.tabsContainer.scrollLeft())!==null&&s!==void 0?s:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT);else{var l=this.tabsContainer.get(0);if(l){var d,h;l.scrollLeft=(d=(h=this.tabsContainer.get(0))===null||h===void 0?void 0:h.scrollWidth)!==null&&d!==void 0?d:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var r,i,o;if(((r=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&r!==void 0?r:0)<((o=this.tabsContainer.scrollLeft())!==null&&o!==void 0?o:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT);else{var a=this.tabsContainer.get(0);a&&(a.scrollLeft=0)}}_handleScrollButtonMouseDown(e){this.holdTimer=window.setTimeout(()=>{var t;this._handleScrollRepeat(e,(t=this.tabsContainer.scrollLeft())!==null&&t!==void 0?t:0,100)},this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)}_handleScrollButtonMouseUp(){var e,t;clearTimeout((e=this.holdTimer)!==null&&e!==void 0?e:-1),this.holdTimer=null,cancelAnimationFrame((t=this.rAF)!==null&&t!==void 0?t:-1),this.rAF=null,window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)}_checkScrollArrows(){var e,t,r;this.tabsContainer.scrollLeft()===0?this.tabPreviousButton.first().prop("disabled",!0):((e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)+((t=this.tabsContainer.innerWidth())!==null&&t!==void 0?t:0)===((r=this.tabsContainer.get(0))===null||r===void 0?void 0:r.scrollWidth)?this.tabNextButton.prop("disabled",!0):(this.tabNextButton.prop("disabled",!1),this.tabPreviousButton.first().prop("disabled",!1))}_handleScrollRepeat(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0,a=this.tabsContainer.get(0);if(a){var s=a.getBoundingClientRect();if(e===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(t-i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(e===this.SCROLL_RIGHT){var l,d;if(this.tabsContainer.scrollLeft(t+i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((d=this.tabsContainer.innerWidth())!==null&&d!==void 0?d:0)===a.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((r=this.rAF)!==null&&r!==void 0?r:-1),this.rAF=window.requestAnimationFrame(h=>{var c,f,v=o||h,p=h-v,g=this.START_SPEED*p+.5*this.ACCELERATION*(p*p);g=Math.min(g,(c=(f=this.tabsContainer.get(0))===null||f===void 0?void 0:f.scrollWidth)!==null&&c!==void 0?c:1/0),this._handleScrollRepeat(e,t,g,v)})}}_$setClosable(e){return this.closeButton&&this._isClosable()?(this.closeButton.element[e?"show":"hide"](),!0):!1}_$destroy(){this.emit("destroy",this);for(var e=0;e<this.tabs.length;e++)this.tabs[e]._$destroy();this._detachWheelListener(),this._handleItemDropped(),M(document).off("mouseup",this._hideAdditionalTabsDropdown),this.tabDropdownSearch.off("input",this._handleFilterInput),this.tabDropdownSearch.off("keydown",this._handleFilterKeydown),this.element.remove()}_getHeaderSetting(e){if(e in this.parent._header)return this.parent._header[e]}_createControls(){var e,t,r,i,o;if(o=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new Wn(this,o,"lm_tabdropdown",this._showAdditionalTabsDropdown),this.tabDropdownButton.element.hide(),this.controlsContainer.prepend(this.tabNextButton),this.tabNextButton.hide(),this._getHeaderSetting("popout")&&(t=this._onPopoutClick.bind(this),r=this._getHeaderSetting("popout"),new Wn(this,r,"lm_popout",t)),this._getHeaderSetting("maximise")){i=this.parent.toggleMaximise.bind(this.parent);var a=this._getHeaderSetting("maximise"),s=this._getHeaderSetting("minimise"),l=new Wn(this,a,"lm_maximise",i);this.parent.on("maximised",function(){l.element.attr("title",s??"")}),this.parent.on("minimised",function(){l.element.attr("title",a??"")})}this._isClosable()&&(e=this.parent.remove.bind(this.parent),r=this._getHeaderSetting("close"),this.closeButton=new Wn(this,r,"lm_close",e))}_showAdditionalTabsDropdown(){if(this.isDropdownShown){this._hideAdditionalTabsDropdown();return}this.tabDropdownList=this.tabsContainer.clone(!0).appendTo(this.tabDropdownContainer).children().removeClass("lm_active"),M(document.body).append(this.tabDropdownContainer),this.tabDropdownContainer.show(),this.isDropdownShown=!0,this.element.addClass("lm_dropdown_open"),this.tabDropdownSearch.val("").focus(),this.dropdownKeyIndex=0,this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active"),M(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown()}_handleFilterKeydown(e){if(e.key==="Escape"){this._hideAdditionalTabsDropdown();return}if(this.dropdownKeyIndex===-1)return;if(e.key==="Enter"||e.key===" "){this._hideAdditionalTabsDropdown(),this.tabs[this.dropdownKeyIndex]._onTabClick();return}function t(s,l,d){if(d==null||d.length<2)return-1;for(var h=(s+l+d.length)%d.length;h!==s;){if(d.eq(h).css("display")!=="none")return h;h=(h+l+d.length)%d.length}return s}if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var r,i;e.preventDefault(),(r=this.tabDropdownList)===null||r===void 0||r.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,1,this.tabDropdownList),(i=this.tabDropdownList)===null||i===void 0||i.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}else if(e.key==="ArrowUp"||e.key==="Tab"){var o,a;e.preventDefault(),(o=this.tabDropdownList)===null||o===void 0||o.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,-1,this.tabDropdownList),(a=this.tabDropdownList)===null||a===void 0||a.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_handleFilterInput(e){if(this.tabDropdownList!=null){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var t=0;t<this.tabDropdownList.length;t++){var r,i;((r=(i=this.tabs[t].contentItem.config.title)===null||i===void 0?void 0:i.toLowerCase().indexOf(e.target.value.toLowerCase()))!==null&&r!==void 0?r:-1)!==-1?(this.tabDropdownList.eq(t).css("display",""),this.dropdownKeyIndex===-1&&(this.dropdownKeyIndex=t)):this.tabDropdownList.eq(t).css("display","none")}this.dropdownKeyIndex!==-1&&this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_hideAdditionalTabsDropdown(e){var t,r;this.isDropdownShown&&(e&&(t=this.tabDropdownContainer.get(0))!==null&&t!==void 0&&t.contains(e.target)||e&&((r=this.tabDropdownButton)===null||r===void 0?void 0:r.element.get(0))===e.target||(this.element.removeClass("lm_dropdown_open"),this.tabDropdownContainer.hide(),this.isDropdownShown=!1,this.element.append(this.tabDropdownContainer),this.tabDropdownContainer.find(".lm_tabs").remove(),M(document).off("mousedown",this._hideAdditionalTabsDropdown)))}_updateAdditionalTabsDropdown(){var e,t,r,i;if(this.isDropdownShown&&!(!this.tabDropdownList||this.tabDropdownList.length==0)){var o=(e=(t=this.tabDropdownContainer.get(0))===null||t===void 0?void 0:t.scrollHeight)!==null&&e!==void 0?e:0;if(o!==0){var a=this.tabDropdownContainer[0].getBoundingClientRect(),s=(r=M(window).height())!==null&&r!==void 0?r:0,l=(i=M(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var d=this.tabDropdownButton.element[0].getBoundingClientRect(),h=o<s-d.bottom,c=!h&&d.bottom>s*.6,f=Math.min(d.left+(c?d.width:0),l-a.width-this.PADDING),v=c?Math.max(d.top-o,this.PADDING):d.bottom,p=s-v-this.PADDING;this.tabDropdownContainer.css({"max-height":p,top:v,left:f})}}}}_isClosable(){return!!(this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon)}_onPopoutClick(){if(this.layoutManager.config.settings.popoutWholeStack===!0)this.parent.popout();else{var e;(e=this.activeContentItem)===null||e===void 0||e.popout()}}_onHeaderClick(e){e.target===this.element[0]&&this.parent.select()}_updateTabSizes(){if(this.tabs.length!==0){var e=this.tabsContainer.get(0);if(this.isDropdownShown&&this._updateAdditionalTabsDropdown(),!!e){if(!this.isOverflowing&&e.scrollWidth>e.clientWidth){var t;(t=this.tabDropdownButton)===null||t===void 0||t.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0}else if(this.isOverflowing&&e.scrollWidth<=e.clientWidth){var r;(r=this.tabDropdownButton)===null||r===void 0||r.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1}this.isOverflowing&&this._checkScrollArrows()}}}}oe(Nt,"_template",['<div class="lm_header">','<ul class="lm_tabs"></ul>','<ul class="lm_controls"></ul>','<ul class="lm_tabdropdown_list">','<li class="lm_tabdropdown_search"><input type="text" placeholder="Find tab..."></li>',"</ul>","</div>"].join(""));oe(Nt,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));oe(Nt,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function Fn(n,e,t){return e=Dp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Dp(n){var e=xp(n,"string");return typeof e=="symbol"?e:String(e)}function xp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class zl{constructor(e,t,r){Fn(this,"_isVertical",void 0),Fn(this,"_size",void 0),Fn(this,"_grabSize",void 0),Fn(this,"_dragListener",void 0),Fn(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=r<t?t:r,this.element=this._createElement(),this._dragListener=new rr(this.element)}on(e,t,r){var i;(i=this._dragListener)===null||i===void 0||i.on(e,t,r)}_$destroy(){var e;(e=this._dragListener)===null||e===void 0||e.destroy(),this._dragListener=null,this.element.remove()}_createElement(){var e=M('<div class="lm_drag_handle"></div>'),t=M('<div class="lm_splitter"></div>');t.append(e);var r=this._grabSize-this._size,i=r/2;return this._isVertical?(e.css("top",-i),e.css("height",this._size+r),t.addClass("lm_vertical"),t.height(this._size)):(e.css("left",-i),e.css("width",this._size+r),t.addClass("lm_horizontal"),t.width(this._size)),t}}const Mp=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:Hl,DragProxy:mn,DragSource:Bl,DragSourceFromEvent:Wl,DropTargetIndicator:ir,Header:Nt,HeaderButton:Wn,Splitter:zl,Tab:or},Symbol.toStringTag,{value:"Module"}));var Np={config:Dg,container:Lg,controls:Mp,errors:mp,items:_p,utils:Zg};const Ap=Np;function Ea(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function $e(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ea(Object(t),!0).forEach(function(r){ie(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ea(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ie(n,e,t){return e=Lp(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Lp(n){var e=Fp(n,"string");return typeof e=="symbol"?e:String(e)}function Fp(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Gl extends ct{static minifyConfig(e){return zi(e)}static unminifyConfig(e){return Ei(e)}constructor(e,t){super(),ie(this,"isInitialised",!1),ie(this,"_isFullPage",!1),ie(this,"_resizeTimeoutId",void 0),ie(this,"_components",{"lm-react-component":jl}),ie(this,"_fallbackComponent",void 0),ie(this,"_itemAreas",[]),ie(this,"_maximisedItem",null),ie(this,"_maximisePlaceholder",M('<div class="lm_maximise_place"></div>')),ie(this,"_creationTimeoutPassed",!1),ie(this,"_subWindowsCreated",!1),ie(this,"_dragSources",[]),ie(this,"_updatingColumnsResponsive",!1),ie(this,"_firstLoad",!0),ie(this,"_reactChildMap",new Map),ie(this,"_reactChildren",null),ie(this,"_initialHeaderHeight",void 0),ie(this,"width",null),ie(this,"height",null),ie(this,"root",void 0),ie(this,"openPopouts",[]),ie(this,"selectedItem",null),ie(this,"isSubWindow",!1),ie(this,"eventHub",new $l(this)),ie(this,"config",void 0),ie(this,"container",void 0),ie(this,"_originalContainer",void 0),ie(this,"dropTargetIndicator",null),ie(this,"tabDropPlaceholder",M('<div class="lm_drop_tab_placeholder"></div>')),ie(this,"_typeToItem",void 0),this._onResize=this._onResize.bind(this),this._onUnload=this._onUnload.bind(this),this._windowBlur=this._windowBlur.bind(this),this._windowFocus=this._windowFocus.bind(this),this.config=this._createConfig(e),this._originalContainer=t,this.container=this._getContainer(),this._initialHeaderHeight=this.config.dimensions.headerHeight,this.isSubWindow&&M("body").css("visibility","hidden"),this._typeToItem={column:Rr.bind(this,!0),row:Rr.bind(this,!1),stack:Oi,component:Kl}}registerComponent(e,t){if(typeof t!="function"&&(t==null||t.render==null||typeof t.render!="function"))throw new Error("Please register a constructor function");if(this._components[e]!==void 0)throw new Error("Component "+e+" is already registered");this._components[e]=t;var r=()=>{if(this._components[e]===void 0)throw new Error("Component "+e+" is not registered");delete this._components[e]};return r}setFallbackComponent(e){this._fallbackComponent=e}toConfig(e){if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");if(e&&!(e instanceof Ie))throw new Error("Root must be a ContentItem");var t={settings:$e({},this.config.settings),dimensions:$e({},this.config.dimensions),labels:$e({},this.config.labels),content:[]},r=function o(a,s){for(var l in s.config)l!=="content"&&(a[l]=s.config[l]);if(a.componentName==="lm-react-component"&&(a.type="react-component"),s.contentItems.length){a.content=[];for(var d=0;d<s.contentItems.length;d++)a.content[d]={},o(a.content[d],s.contentItems[d])}};e?r(t,{contentItems:[e]}):r(t,this.root),this._$reconcilePopoutWindows(),t.openPopouts=[];for(var i=0;i<this.openPopouts.length;i++)t.openPopouts.push(this.openPopouts[i].toConfig());return t.maximisedItemId=this._maximisedItem?"__glMaximised":void 0,t}getComponent(e){return this._components[e]}getFallbackComponent(){return this._fallbackComponent}init(){if(this._subWindowsCreated===!1&&(this._createSubWindows(),this._subWindowsCreated=!0),document.readyState==="loading"||document.body===null){M(document).ready(this.init.bind(this));return}if(this.isSubWindow===!0&&this._creationTimeoutPassed===!1){setTimeout(this.init.bind(this),7),this._creationTimeoutPassed=!0;return}this.isSubWindow===!0&&this._adjustToWindowMode(),this._setContainer(),this.dropTargetIndicator=new ir,this.updateSize(),this._create(this.config),this._bindEvents(),this.isInitialised=!0,this._adjustColumnsResponsive(),this.emit("initialised")}addReactChild(e,t){this._reactChildMap.set(e,t),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged")}removeReactChild(e,t){var r=this._reactChildMap.get(e);r===t&&(this._reactChildMap.delete(e),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged"))}getReactChildren(){return this._reactChildren}enableHeaders(){this.config.settings.hasHeaders=!0,this.config.dimensions.headerHeight=this._initialHeaderHeight,this._findAllStackContainers().forEach(e=>{e._header.show=!0,e.header.element.toggle(!0)}),this.updateSize()}disableHeaders(){this.config.settings.hasHeaders=!1,this.config.dimensions.headerHeight=0,this._findAllStackContainers().forEach(e=>{e._header.show=!1,e.header.element.toggle(!1)}),this.updateSize()}updateSize(e,t){var r,i;if(this.width=(r=e??this.container.width())!==null&&r!==void 0?r:0,this.height=(i=t??this.container.height())!==null&&i!==void 0?i:0,this.isInitialised===!0){if(this.root.callDownwards("setSize",[this.width,this.height]),this._maximisedItem){var o,a;this._maximisedItem.element.width((o=this.container.width())!==null&&o!==void 0?o:0),this._maximisedItem.element.height((a=this.container.height())!==null&&a!==void 0?a:0),this._maximisedItem.callDownwards("setSize")}this._adjustColumnsResponsive()}}destroy(){var e;this.isInitialised===!1||!this.root||(this._onUnload(),M(window).off("resize",this._onResize),M(window).off("unload beforeunload",this._onUnload),M(window).off("blur.lm").off("focus.lm"),this.root.callDownwards("_$destroy",[],!0),this.root.contentItems=[],this.tabDropPlaceholder.remove(),(e=this.dropTargetIndicator)===null||e===void 0||e.destroy(),this.eventHub.destroy(),this._dragSources.forEach(function(t){t._dragListener.destroy()}),this._dragSources=[])}createContentItem(e,t){var r,i,o;if(typeof e.type!="string")throw new on("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!this._typeToItem[e.type])throw i="Unknown type '"+e.type+"'. Valid types are "+Object.keys(this._typeToItem).join(","),new on(i);return e.type==="component"&&!(t instanceof Oi)&&t&&!(this.isSubWindow===!0&&t instanceof Ti)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),e.id=(r=e.id)!==null&&r!==void 0?r:Lr(),o=new this._typeToItem[e.type](this,e,t),o}createPopout(e,t,r,i){var o=[],a=e instanceof Ie,s=this;if(a){var l;o=this.toConfig(e).content,r=Lr();for(var d=e.parent,h=e;((c=d)===null||c===void 0?void 0:c.contentItems.length)===1&&!d.isRoot;){var c;h=d,d=d.parent}if((l=d)===null||l===void 0||l.addId(r),i==null||Number.isNaN(i)){var f;i=(f=d)===null||f===void 0?void 0:f.contentItems.indexOf(h)}}else e instanceof Array?o=e:o=[e];if(!t&&a){var v,p,g,y=window.screenX||window.screenLeft,P=window.screenY||window.screenTop,O=(v=e.element.offset())!==null&&v!==void 0?v:{left:0,top:0};t={left:y+O.left,top:P+O.top,width:(p=e.element.width())!==null&&p!==void 0?p:0,height:(g=e.element.height())!==null&&g!==void 0?g:0}}if(!t&&!a&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),a&&e.remove(),!(!t||!r||i===void 0)){var _=new Hl(o,t,r,i,this);return _.on("initialised",function(){s.emit("windowOpened",_)}),_.on("closed",function(){s._$reconcilePopoutWindows()}),this.openPopouts.push(_),_}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var r=new Bl(e,t,this);return this._dragSources.push(r),r}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new Wl(e,this,t)}selectItem(e,t){if(this.config.settings.selectionEnabled!==!0)throw new Error("Please set selectionEnabled to true to use this feature");e!==this.selectedItem&&(this.selectedItem!==null&&this.selectedItem.deselect(),e&&t!==!0&&e.select(),this.selectedItem=e,this.emit("selectionChanged",e))}_$maximiseItem(e){var t,r;this._maximisedItem!==null&&this._$minimiseItem(this._maximisedItem),this._maximisedItem=e,this._maximisedItem.addId("__glMaximised"),e.element.addClass("lm_maximised"),e.element.after(this._maximisePlaceholder),this.root.element.prepend(e.element),e.element.width((t=this.container.width())!==null&&t!==void 0?t:0),e.element.height((r=this.container.height())!==null&&r!==void 0?r:0),e.callDownwards("setSize"),this._maximisedItem.emit("maximised"),this.emit("stateChanged")}_$minimiseItem(e){var t;e.element.removeClass("lm_maximised"),e.removeId("__glMaximised"),this._maximisePlaceholder.after(e.element),this._maximisePlaceholder.remove(),(t=e.parent)===null||t===void 0||t.callDownwards("setSize"),this._maximisedItem=null,e.emit("minimised"),this.emit("stateChanged")}_$closeWindow(){window.setTimeout(function(){window.close()},1)}_$getArea(e,t){for(var r=1/0,i=null,o=0;o<this._itemAreas.length;o++){var a=this._itemAreas[o];e>a.x1&&e<a.x2&&t>a.y1&&t<a.y2&&r>a.surface&&(r=a.surface,i=a)}return i}_$createRootItemAreas(){var e=50,t=$e({},this.root._$getArea()),r=[$e($e({},t),{},{side:"left",x2:t.x1+e}),$e($e({},t),{},{side:"right",x1:t.x2-e}),$e($e({},t),{},{side:"top",y2:t.y1+e}),$e($e({},t),{},{side:"bottom",y1:t.y2-e})];r.forEach(i=>{i.surface=(i.x2-i.x1)*(i.y2-i.y1)}),this._itemAreas.push(...r)}_$calculateItemAreas(){var e=this._getAllContentItems();if(this._itemAreas=[],e.length===1){this._itemAreas.push(this.root._$getArea());return}this._$createRootItemAreas();for(var t=0;t<e.length;t++){var r=e[t];if(an(r)){var i=r._$getArea();if(i!==null)if(i instanceof Array)this._itemAreas=this._itemAreas.concat(i);else{var o;this._itemAreas.push(i);var a=$e($e({},i),(o=i.contentItem._contentAreaDimensions)===null||o===void 0?void 0:o.header.highlightArea);a.surface=(a.x2-a.x1)*(a.y2-a.y1),this._itemAreas.push(a)}}}}_$normalizeContentItem(e,t){if(!e)throw new Error("No content item defined");if(typeof e=="function"&&(e=e()),e instanceof Ie)return e;if(M.isPlainObject(e)&&e.type){var r=this.createContentItem(e,t);return r.callDownwards("_$init"),r}else throw new Error("Invalid contentItem")}_$reconcilePopoutWindows(){for(var e=[],t=0;t<this.openPopouts.length;t++){var r;((r=this.openPopouts[t].getWindow())===null||r===void 0?void 0:r.closed)===!1?e.push(this.openPopouts[t]):this.emit("windowClosed",this.openPopouts[t])}this.openPopouts.length!==e.length&&(this.emit("stateChanged"),this.openPopouts=e)}_getAllContentItems(){var e=[],t=r=>{if(e.push(r),r.contentItems instanceof Array)for(var i=0;i<r.contentItems.length;i++)t(r.contentItems[i])};return t(this.root),e}_bindEvents(){this._isFullPage&&M(window).resize(this._onResize),M(window).on("unload beforeunload",this._onUnload).on("blur.lm",this._windowBlur).on("focus.lm",this._windowFocus)}_windowBlur(){this.root.element.addClass("lm_window_blur")}_windowFocus(){this.root.element.removeClass("lm_window_blur")}_onResize(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(this.updateSize.bind(this),100)}_createConfig(e){var t,r=kl("gl-window");r&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(r)||"{}"),e=Ei(e),localStorage.removeItem(r)),e=M.extend(!0,{},Al,e);var i=function o(a){for(var s in a){var l=a[s];s!=="props"&&typeof l=="object"&&l!=null?o(l):s==="type"&&l==="react-component"&&(a.type="component",a.componentName="lm-react-component")}};return i(e),((t=e.settings)===null||t===void 0?void 0:t.hasHeaders)===!1&&(e.dimensions.headerHeight=0),e}_adjustToWindowMode(){var e,t=M('<div class="lm_popin" title="'+this.config.labels.popin+'"><div class="lm_icon"></div><div class="lm_bg"></div></div>');t.click(()=>{this.emit("popIn")}),document.title=Ki((e=this.config.content[0].title)!==null&&e!==void 0?e:""),M("head").append(M("body link, body style, template, .gl_keep")),this.container=M("body").html("").css("visibility","visible").append(t),document.body.offsetHeight,window.__glInstance=this}_createSubWindows(){if(this.config.openPopouts)for(var e=0;e<this.config.openPopouts.length;e++){var t=this.config.openPopouts[e];this.createPopout(t.content,t.dimensions,t.parentId,t.indexInParent)}}_getContainer(){var e=this._originalContainer?M(this._originalContainer):M("body");if(e.length===0)throw new Error("GoldenLayout container not found");if(e.length>1)throw new Error("GoldenLayout more than one container element specified");return e}_setContainer(){var e=this._getContainer();e[0]===document.body&&(this._isFullPage=!0,M("html, body").css({height:"100%",margin:0,padding:0,overflow:"hidden"})),this.container=e}_create(e){var t;if(!(e.content instanceof Array))throw e.content===void 0?t="Missing setting 'content' on top level of configuration":t="Configuration parameter 'content' must be an array",new on(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new on(t,e);this.root=new Ti(this,{content:e.content},this.container),this.root.callDownwards("_$init"),e.maximisedItemId==="__glMaximised"&&this.root.getItemsById(e.maximisedItemId)[0].toggleMaximise()}_onUnload(){if(this.config.settings.closePopoutsOnUnload===!0)for(var e=0;e<this.openPopouts.length;e++)this.openPopouts[e].close()}_adjustColumnsResponsive(){if(!this._useResponsiveLayout()||this._updatingColumnsResponsive||!this.config.dimensions||!this.config.dimensions.minItemWidth||this.root.contentItems.length===0||!this.root.contentItems[0].isRow){this._firstLoad=!1;return}this._firstLoad=!1;var e=this.root.contentItems[0].contentItems.length;if(!(e<=1)){var t=this.config.dimensions.minItemWidth,r=e*t;if(!(this.width==null||r<=this.width)){this._updatingColumnsResponsive=!0;for(var i=Math.max(Math.floor(this.width/t),1),o=e-i,a=this.root.contentItems[0],s=this._findAllStackContainers()[0],l=0;l<o;l++){var d=a.contentItems[a.contentItems.length-1];this._addChildContentItemsToContainer(s,d)}this._updatingColumnsResponsive=!1}}}_useResponsiveLayout(){return this.config.settings&&(this.config.settings.responsiveMode=="always"||this.config.settings.responsiveMode=="onload"&&this._firstLoad)}_addChildContentItemsToContainer(e,t){t.type==="stack"?t.contentItems.forEach(function(r){e.addChild(r),t.removeChild(r,!0)}):t.contentItems.forEach(r=>{this._addChildContentItemsToContainer(e,r)})}_findAllStackContainers(){var e=[];return this._findAllStackContainersRecursive(e,this.root),e}_findAllStackContainersRecursive(e,t){t.contentItems.forEach(r=>{an(r)?e.push(r):r.isComponent||this._findAllStackContainersRecursive(e,r)})}}ie(Gl,"__lm",Ap);const Rp=Gl,kp="_lm_dragging_k4a5m_1",jp="_lm_goldenlayout_k4a5m_1",$p="_lm_header_k4a5m_1",Hp="_lm_controls_k4a5m_1",Bp="_lm_tabpreviousbutton_k4a5m_1",Wp="_lm_tabnextbutton_k4a5m_1",Up="_lm_tab_k4a5m_1",Vp="_lm_active_k4a5m_1",Kp="_lm_close_tab_k4a5m_1",zp="_lm_content_k4a5m_1",Gp="_lm_dragProxy_k4a5m_1",qp="_lm_dropTargetIndicator_k4a5m_1",Xp="_march_k4a5m_1",Zp="_lm_inner_k4a5m_1",Yp="_lm_splitter_k4a5m_1",Qp="_lm_selectable_k4a5m_1",Jp="_lm_tabdropdown_list_k4a5m_1",eb="_lm_title_k4a5m_1",tb="_lm_title_before_k4a5m_1",nb="_lm_selected_k4a5m_1",rb="_lm_focusin_k4a5m_1",ib="_lm_window_blur_k4a5m_1",ob="_lm_popout_k4a5m_1",ab="_lm_maximise_k4a5m_1",sb="_lm_tabdropdown_k4a5m_1",lb="_lm_close_k4a5m_1",db="_lm_tabdropdown_search_k4a5m_1",ub="_lm_tabs_k4a5m_1",hb="_lm_keyboard_active_k4a5m_1",cb="_lm_maximised_k4a5m_1",mb="_lm_items_k4a5m_1",_a={"tab-height":"28px","drag-border-width":"5px",lm_dragging:kp,lm_goldenlayout:jp,lm_header:$p,lm_controls:Hp,lm_tabpreviousbutton:Bp,lm_tabnextbutton:Wp,lm_tab:Up,lm_active:Vp,lm_close_tab:Kp,lm_content:zp,lm_dragProxy:Gp,lm_dropTargetIndicator:qp,march:Xp,lm_inner:Zp,lm_splitter:Yp,lm_selectable:Qp,lm_tabdropdown_list:Jp,lm_title:eb,lm_title_before:tb,lm_selected:nb,lm_focusin:rb,lm_window_blur:ib,lm_popout:ob,lm_maximise:ab,lm_tabdropdown:sb,lm_close:lb,lm_tabdropdown_search:db,lm_tabs:ub,lm_keyboard_active:hb,lm_maximised:cb,lm_items:mb},Pa=Object.freeze({tabHeight:parseInt(_a["tab-height"],10),dragBorderWidth:parseInt(_a["drag-border-width"],10)});function Ta(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Tt(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ta(Object(t),!0).forEach(function(r){ql(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ta(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function ql(n,e,t){return e=fb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fb(n){var e=vb(n,"string");return typeof e=="symbol"?e:String(e)}function vb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var kt=B.module("LayoutUtils");function Xl(n){return n.componentName!==void 0}function Sn(n){var e=n;return(Xl(n)&&n.componentName==="lm-react-component"||n.type==="react-component")&&e.component!==void 0}function Cr(n){return n.focus!==void 0}function Oa(n){return n.type==="stack"}class x{static activateTab(e,t){var r=x.getStackForRoot(e,t,!1);if(!r){kt.error("Could not find stack for config",t);return}var i=x.getContentItemInStack(r,t);i&&r.setActiveContentItem(i)}static isActiveTab(e,t){var r=x.getStackForRoot(e,t,!1);if(!r)return kt.error("Could not find stack for config",t),!1;var i=x.getContentItemInStack(r,t),o=r.getActiveContentItem();return o===i}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=t?"column":"row";if(Vl(e)){(e.contentItems==null||e.contentItems.length===0)&&e.addChild({type:r});var i=e.contentItems[0],o=t?i.isColumn:i.isRow;if(!o){e.removeChild(i,!0),e.addChild({type:r});var a=document.activeElement;e.contentItems[0].addChild(i),a&&a.focus!=null&&a.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var s=e.contentItems[e.contentItems.length-1],l=t?s.isRow:s.isColumn;return l||(e.addChild({type:t?"row":"column"}),e.removeChild(s,!0),e.contentItems[e.contentItems.length-1].addChild(s),s=e.contentItems[e.contentItems.length-1]),this.addStack(s,!t)}static getStackById(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(i&&an(e)&&e.contentItems.length===0)return e;if(t===((r=e.config)===null||r===void 0?void 0:r.id)){if(an(e))return e;throw new Error("Item with ID ".concat(t," is not a stack"))}if(e.contentItems==null)return null;for(var o=0;o<e.contentItems.length;o+=1){var a=this.getStackById(e.contentItems[o],t,i);if(a)return a}return null}static getStackForConfig(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(r&&an(e)&&e.contentItems.length===0)return e;if(e.contentItems==null)return null;for(var i=0;i<e.contentItems.length;i+=1){var o=e.contentItems[i];if(o.isComponent&&o.config!=null&&eo(o.config,t))return e;var a=this.getStackForConfig(o,t,r);if(a)return a}return null}static getStackForRoot(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=this.getStackForConfig(e,t);return!a&&i&&(a=this.getStackForConfig(e,{component:t.component},o)),!a&&r&&(a=this.addStack(e)),a}static getStackForComponentTypes(e,t){for(var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=0;a<t.length;a+=1){var s=t[a],l=a===t.length-1,d=x.getStackForRoot(e,{component:s},r&&l,i,o);if(d)return d}return null}static getContentItemInStack(e,t){if(!e)return null;for(var r=0;r<e.contentItems.length;r+=1){var i=e.contentItems[r];if(i.isComponent&&i.config!=null&&eo(i.config,t))return i}return null}static dehydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var r=[],i=0;i<e.length;i+=1){var o=e[i],{component:a,content:s}=o;if(a){var l=t(a,o);l!=null?r.push(l):kt.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(a,'"'))}else if(s){var d=Tt(Tt({},o),{},{content:x.dehydrateLayoutConfig(s,t)});r.push(d)}else r.push(o)}return r}static getTabPoint(e){var{tab:t}=e;if(t==null)throw new Error("Cannot get tab for panel container ".concat(e));var r=t.element[0].getBoundingClientRect();return[r.left+r.width*.5,r.bottom-8]}static dropLayoutMinorChange(e){for(var t=0;t<e.length;t+=1){var r=e[t],{content:i}=r;i!==void 0?(Oa(r)&&delete r.activeItemIndex,x.dropLayoutMinorChange(i)):Sn(r)&&r.component==="IrisGridPanel"&&r.props.panelState!=null&&(delete r.id,r.props.panelState.irisGridState.sorts=[],r.props.panelState.irisGridState.quickFilters=[],r.props.panelState.gridState.isStuckToBottom=!1,r.props.panelState.gridState.isStuckToRight=!1)}}static isEqual(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=x.cloneLayout(e),o=x.cloneLayout(t);return r?(x.dropLayoutMinorChange(i),x.dropLayoutMinorChange(o),Xn(i,o)):Xn(i,o)}static cloneLayout(e){return JSON.parse(JSON.stringify(e))}static hydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var r=[],i=0;i<e.length;i+=1){var o=e[i];if(Sn(o)){var a,{component:s,props:l={}}=o;r.push(Tt(Tt({},o),{},{id:(a=o?.id)!==null&&a!==void 0?a:Mt(),props:t(s,l)}))}else if(o.content!==void 0){var d=x.hydrateLayoutConfig(o.content,t);Oa(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=d.length&&(kt.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),r.push(Tt(Tt({},o),{},{content:d}))}else r.push(o)}return r}static openComponent(){var{root:e,config:t,stack:r=void 0,replaceExisting:i=!0,replaceConfig:o=void 0,createNewStack:a=!1,focusElement:s=void 0,dragEvent:l=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},d=document.activeElement,h=Tt({},t);if(h.id==null&&(h.id=Mt()),l!=null){e?.layoutManager.createDragSourceFromEvent(h,l);return}var c=o||{id:h.id,component:h.component};k(e);var f=r??(a?x.addStack(e):x.getStackForRoot(e,c));k(f);var v=x.getContentItemInStack(f,c);if(s!=null){var p=y=>{kt.debug("Component created, focusing element",s),f.off("componentCreated",p);var{element:P}=y.origin;requestAnimationFrame(()=>{x.focusElement(P[0],s)})};f.on("componentCreated",p)}if(i&&v){var g=f.contentItems.indexOf(v);f.addChild(h,g+1),f.removeChild(v),f.setActiveContentItem(f.contentItems[g])}else f.addChild(h);s==null&&d&&Cr(d)&&d.focus()}static openComponentInStack(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=document.activeElement,o={id:t.id},a=x.getContentItemInStack(e,o);if(r&&a&&e){var s=e?.contentItems.indexOf(a);e.addChild(t,s+1),e.removeChild(a),e.setActiveContentItem(e.contentItems[s])}else e?.addChild(t);i&&Cr(i)&&i.focus()}static closeComponent(e,t,r){var i=x.getStackForRoot(e,t,!1,!1,!1);if(!i){kt.warn("Cannot find stack for component, ignoring close",t);return}var o=x.getContentItemInStack(i,t),a=document.activeElement;o&&(qe(o)?o.container.close(r):i.removeChild(o)),a&&document.contains(a)&&Cr(a)&&a.focus()}static renameComponent(e,t,r){var i=x.getStackForRoot(e,t,!1);if(!i){kt.error("Could not find stack for config",t);return}var o=x.getContentItemInStack(i,t);o&&o.setTitle(r)}static cloneComponent(e,t){var r=x.getStackForRoot(e,t,!1);if(!r)return kt.error("Could not find stack for config",t),null;var{props:i={}}=t,o=x.getPanelComponentState(t),a={type:"react-component",component:t.component,props:Tt(Tt({},i),{},{panelState:o}),title:"".concat(t.title," Copy"),id:Mt()};return x.openComponentInStack(r,a),a}static getPanelComponentState(e){if(Xl(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(Sn(e)){var r;return(r=e.props)===null||r===void 0?void 0:r.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:Pa.tabHeight,borderWidth:Pa.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=x.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return x.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,r=x.getComponentConfigFromContainer(t);if(r&&Sn(r)){var i;return(i=r.component)!==null&&i!==void 0?i:null}return null}static getComponentName(e){var t,r,i=(t=(r=e.WrappedComponent)===null||r===void 0?void 0:r.displayName)!==null&&t!==void 0?t:e.displayName;if(i==null)throw new Error("Component displayName not defined ".concat(e));return i}static focusElement(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:x.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var r=e.querySelector(t);return r==null?null:(Cr(r)&&r.focus(),r)}static onInitialized(e){return new Promise(t=>{if(e.isInitialised){t();return}var r=()=>{e.off("initialised",r),t()};e.on("initialised",r)})}}ql(x,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var gb=H.forwardRef((n,e)=>{var t=x.getComponentNameFromPanel({props:n});return u.jsx("div",{ref:e,className:"panel-placeholder",children:u.jsxs("div",{children:['Component "',t,'" is not registered.']})})});gb.displayName="PanelPlaceholder";const te=Object.freeze({FOCUS:"PanelEvent.FOCUS",MOUNT:"PanelEvent.MOUNT",UNMOUNT:"PanelEvent.UNMOUNT",TITLE_CHANGED:"PanelEvent.TITLE_CHANGED",REOPEN:"PanelEvent.REOPEN",REOPEN_LAST:"PanelEvent.REOPEN_LAST",DELETE:"PanelEvent.DELETE",CLONED:"PanelEvent.CLONED",CLOSED:"PanelEvent.CLOSED",OPEN:"PanelEvent.OPEN",CLOSE:"PanelEvent.CLOSE",DRAGGING:"PanelEvent.DRAGGING",DROPPED:"PanelEvent.DROPPED"});function kr(n){return n?.WrappedComponent!==void 0}function pb(n){return typeof n.id=="string"&&n.layout instanceof Rp&&n.panelManager instanceof qi&&typeof n.registerComponent=="function"}function bb(n){if(!pb(n))throw new Error("Expected dashboard plugin props, but instead received ".concat(n))}function Ia(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Da(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ia(Object(t),!0).forEach(function(r){Bt(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ia(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Bt(n,e,t){return e=yb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function yb(n){var e=Cb(n,"string");return typeof e=="symbol"?e:String(e)}function Cb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var tt=B.module("PanelManager");class qi{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(s,l)=>l,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(s,l)=>l,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:new Map,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:()=>{};Bt(this,"layout",void 0),Bt(this,"hydrateComponent",void 0),Bt(this,"dehydrateComponent",void 0),Bt(this,"onPanelsUpdated",void 0),Bt(this,"closed",void 0),Bt(this,"openedMap",void 0),this.handleFocus=this.handleFocus.bind(this),this.handleMount=this.handleMount.bind(this),this.handleUnmount=this.handleUnmount.bind(this),this.handleReopen=this.handleReopen.bind(this),this.handleReopenLast=this.handleReopenLast.bind(this),this.handleDeleted=this.handleDeleted.bind(this),this.handleClosed=this.handleClosed.bind(this),this.handleControlClose=this.handleControlClose.bind(this),this.layout=e,this.hydrateComponent=t,this.dehydrateComponent=r,this.onPanelsUpdated=a,this.openedMap=new Map(i),this.closed=[...o],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(te.FOCUS,this.handleFocus),e.on(te.MOUNT,this.handleMount),e.on(te.UNMOUNT,this.handleUnmount),e.on(te.REOPEN,this.handleReopen),e.on(te.REOPEN_LAST,this.handleReopenLast),e.on(te.DELETE,this.handleDeleted),e.on(te.CLOSED,this.handleClosed),e.on(te.CLOSE,this.handleControlClose)}stopListening(){var{eventHub:e}=this.layout;e.off(te.FOCUS,this.handleFocus),e.off(te.MOUNT,this.handleMount),e.off(te.UNMOUNT,this.handleUnmount),e.off(te.REOPEN,this.handleReopen),e.off(te.REOPEN_LAST,this.handleReopenLast),e.off(te.DELETE,this.handleDeleted),e.off(te.CLOSED,this.handleClosed),e.off(te.CLOSE,this.handleControlClose)}getClosedPanelConfigsOfType(e){return this.closed.filter(t=>t.component===e)}getOpenedPanels(){return Array.from(this.openedMap.values())}getOpenedPanelConfigs(){return this.getOpenedPanels().map(e=>{var{glContainer:t}=e.props;return x.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&Sn(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,r=x.getStackForConfig(this.layout.root,{id:e});return(t=r&&x.getContentItemInStack(r,{id:e}))!==null&&t!==void 0?t:null}getLastUsedPanel(e){for(var t=this.getOpenedPanels(),r=t.length-1;r>=0;r-=1){var i=t[r];if(e==null||e(i))return i}}getLastUsedPanelOfType(e){return this.getLastUsedPanelOfTypes([e])}getLastUsedPanelOfTypes(e){return this.getLastUsedPanel(t=>e.some(r=>kr(r)&&t instanceof r.WrappedComponent||!kr(r)&&t instanceof r))}updatePanel(e){var t=x.getIdFromPanel(e);if(t==null){tt.error("updatePanel Panel did not have an ID",e);return}tt.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=x.getIdFromPanel(e);if(t==null){tt.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){tt.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){tt.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}tt.debug2("Removing panel ID ".concat(t," from open panels map")),this.openedMap.delete(t)}removeClosedPanelConfig(e){var t=this.closed.findIndex(r=>r===e||r.id!=null&&e.id!=null&&r.id===e.id);t>=0&&this.closed.splice(t,1)}handleFocus(e){tt.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){tt.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){tt.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}handleReopen(e,t){tt.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:r}=e,{props:i}=e;i=this.hydrateComponent(r,i);var o=Da(Da({},e),{},{props:i}),{root:a}=this.layout,s=e.parentStackId===void 0?void 0:x.getStackById(a,e.parentStackId);x.openComponent({root:a,config:o,replaceConfig:t,stack:s??void 0})}handleReopenLast(e){var t;if(this.closed.length!==0){if(e===void 0){this.handleReopen(this.closed[this.closed.length-1]);return}for(var r=(t=x.getStackForConfig(this.layout.root,e.getConfig()))===null||t===void 0?void 0:t.config.id,i=this.closed.length-1;i>=0;i-=1){var o=this.closed[i];if(o.parentStackId===r){this.handleReopen(o);return}}}}handleDeleted(e){tt.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){tt.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:r}=this.layout;x.closeComponent(r,t)}addClosedPanel(e){var{root:t}=this.layout,r=x.getComponentConfigFromContainer(e);if(r&&Sn(r)){var i=this.dehydrateComponent(r.component,r);if(i!=null){var o;i.parentStackId=(o=x.getStackForConfig(t,r))===null||o===void 0?void 0:o.config.id,this.closed.push(i)}}}sendUpdate(){var{closed:e,openedMap:t}=this;this.onPanelsUpdated({closed:[...e],openedMap:new Map(t)})}}Bt(qi,"MAX_CLOSED_PANEL_COUNT",100);var Sb=B.module("PanelErrorBoundary");class wb extends m.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}componentWillUnmount(){var{glContainer:e,glEventHub:t}=this.props,r=x.getIdFromContainer(e);Sb.debug("componentWillUnmount",r),t.emit(te.CLOSED,r,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?u.jsx("div",{className:"panel-error-boundary",children:u.jsx(un,{errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e}}function xa(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function jr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xa(Object(t),!0).forEach(function(r){Eb(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):xa(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Eb(n,e,t){return e=_b(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _b(n){var e=Pb(n,"string");return typeof e=="symbol"?e:String(e)}function Pb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function Zl(n){var{props:e,componentState:t}=n,{metadata:r}=e,{panelState:i=null}=e;t&&({panelState:i}=t);var o={};return r!=null&&(o.metadata=r),i!=null&&(o.panelState=i),jr(jr({},n),{},{componentState:null,props:o,type:"react-component"})}function Yl(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return jr(jr({},n),{},{localDashboardId:e})}function Tb(n){var e=kr(n)&&n.WrappedComponent.prototype!=null&&n.WrappedComponent.prototype.isReactComponent!=null||n.prototype!=null&&n.prototype.isReactComponent!=null,t=!kr(n)&&"$$typeof"in n&&n.$$typeof===Td.ForwardRef;return e||t}const Ob={dehydrate:Zl,hydrate:Yl};var Ib=H.createContext(void 0),Db=S.shape({on:S.func,off:S.func,isHidden:S.bool,tab:S.shape({header:S.shape({tabs:S.arrayOf(S.shape({contentItem:S.shape({})}))})}),title:S.string,setTitle:S.func,close:S.func}),Ql=S.shape({on:S.func,off:S.func,emit:S.func}),xb=S.shape({registerComponent:S.func,root:S.shape({addChild:S.func}),on:S.func,off:S.func,eventHub:Ql}),Mb=Object.freeze({Container:Db,EventHub:Ql,Layout:xb});function Me(n,e,t){m.useEffect(function(){return n.on(e,t),()=>{n.off(e,t)}},[n,e,t])}function Rn(n,e,t,r){var i,o=(i=e.COMPONENT)!==null&&i!==void 0?i:e.displayName;if(o==null)throw new Error("ComponentType must have a `COMPONENT` or `displayName` attribute.");H.useEffect(()=>{var a=n(o,e,t,r);return()=>{a()}},[e,r,t,o,n])}var Jl="SET_DASHBOARD_DATA";const Nb=rg(Jl,{},!1),Ab={dashboardData:Nb};var Lb=new Map,ed=Object.freeze({}),Fb=Object.freeze([]),DS=Ai,xS=ss,MS=Od,Rb=n=>n.dashboardData,Ae=(n,e)=>{var t;return(t=Rb(n)[e])!==null&&t!==void 0?t:ed},NS=(n,e)=>{var t;return(t=Ae(n,e).closed)!==null&&t!==void 0?t:Fb},AS=(n,e)=>{var t;return(t=Ae(n,e).openedMap)!==null&&t!==void 0?t:Lb},td=(n,e)=>{var t;return(t=Ae(n,e).pluginDataMap)!==null&&t!==void 0?t:ed},LS=(n,e,t)=>td(n,e)[t];function Ma(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function wn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ma(Object(t),!0).forEach(function(r){kb(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ma(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function kb(n,e,t){return e=jb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function jb(n){var e=$b(n,"string");return typeof e=="symbol"?e:String(e)}function $b(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var nd=(n,e)=>({type:Jl,id:n,payload:e}),Yt=(n,e)=>(t,r)=>t(nd(n,wn(wn({},Ae(r(),n)),e))),FS=(n,e,t)=>(r,i)=>r(nd(n,wn(wn({},Ae(i(),n)),{},{pluginDataMap:wn(wn({},td(i(),n)),{},{[e]:t})})));Object.entries(Ab).map(n=>{var[e,t]=n;return Gr.register(e,t)});function Hb(n){var{children:e}=n;return u.jsx(u.Fragment,{children:e})}function Na(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function kn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Na(Object(t),!0).forEach(function(r){Bb(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Na(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Bb(n,e,t){return e=Wb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wb(n){var e=Ub(n,"string");return typeof e=="symbol"?e:String(e)}function Ub(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Sr=B.module("DashboardLayout"),Vb=Object.freeze({}),Kb=[],Aa=()=>{},zb=1e3,La=n=>n;function Gb(n){var e,t,{id:r,children:i,emptyDashboard:o=u.jsx("div",{children:"Dashboard is empty."}),layout:a,layoutConfig:s=Kb,onLayoutChange:l=Aa,onLayoutInitialized:d=Aa,hydrate:h=Yl,dehydrate:c=Zl,panelWrapper:f=Hb}=n,v=Ai(),p=(e=ss(b=>Ae(b,r)))!==null&&e!==void 0?e:Vb,[g,y]=m.useState(!1),[P,O]=m.useState(!1),[_,R]=m.useState(),[U]=m.useState((t=p?.closed)!==null&&t!==void 0?t:[]),[Q,N]=m.useState(a.getReactChildren()),W=m.useMemo(()=>new Map,[]),j=m.useMemo(()=>new Map,[]),Y=m.useCallback(function(b,w){var T,G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:h,J=arguments.length>3&&arguments[3]!==void 0?arguments[3]:c;Sr.debug2("registerComponent",b,w,G,J);function Qe(X,re){var he=w,_e=f,Qr=Tb(he),{glContainer:cr,glEventHub:Jr}=X;return u.jsx(wb,{glContainer:cr,glEventHub:Jr,children:u.jsx(_e,kn(kn({},X),{},{children:Qr?u.jsx(he,kn(kn({},X),{},{ref:re})):u.jsx(he,kn({},X))}))})}Qe.displayName="DashboardWrapper(".concat((T=w.displayName)!==null&&T!==void 0?T:b,")");var I=a.registerComponent(b,H.forwardRef(Qe));return W.set(b,G),j.set(b,J),I},[h,c,W,j,a,f]),ne=m.useCallback((b,w)=>{var T;return((T=W.get(b))!==null&&T!==void 0?T:La)(w,r)},[W,r]),F=m.useCallback((b,w)=>{var T;return((T=j.get(b))!==null&&T!==void 0?T:La)(w,r)},[j,r]),q=m.useMemo(()=>new qi(a,ne,F,new Map,U,b=>{var{closed:w,openedMap:T}=b;v(Yt(r,{closed:w,openedMap:T}))}),[F,v,ne,r,U,a]),K=Uu(b=>{var w=_==null||!x.isEqual(_,b);Sr.debug("handleLayoutStateChanged",w,b),w&&(y(a.root.contentItems.length===0),R(b),l(b),N(a.getReactChildren()))},zb,{flushOnUnmount:!0});m.useEffect(()=>()=>K.flush(),[K]);var A=m.useCallback(()=>{if(!P){var b=a.toConfig(),w=b.content,T=x.dehydrateLayoutConfig(w,F);K(T)}},[F,P,a,K]),V=m.useCallback(b=>{var w=x.getIdFromContainer(b);a.eventHub.emit(te.DRAGGING,w),O(!0)},[a.eventHub]),z=m.useCallback(b=>{var w=x.getIdFromContainer(b);a.eventHub.emit(te.DROPPED,w),O(!1)},[a.eventHub]),me=m.useCallback(b=>{if(Sr.debug2("handleComponentCreated",b),!(b==null||b.config==null||b.config.component==null||b.element==null)){var w=b.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),T="".concat(w,"-component");b.element.addClass(T)}},[]),je=m.useCallback(()=>{N(a.getReactChildren())},[a]);Me(a,"stateChanged",A),Me(a,"itemPickedUp",V),Me(a,"itemDropped",z),Me(a,"componentCreated",me),Me(a.eventHub,te.TITLE_CHANGED,A),Me(a,"reactChildrenChanged",je);var De=Vu(s);return m.useEffect(function(){if(De!==s&&s!==_){Sr.debug("Setting new layout content...");for(var w=x.hydrateLayoutConfig(s,ne);a.root.contentItems.length>0;)a.root.contentItems[0].remove();for(var T=0;T<w.length;T+=1)a.root.addChild(w[T]);y(a.root.contentItems.length===0)}},[ne,a,s,_,q,De]),m.useEffect(()=>d(),[]),u.jsxs(u.Fragment,{children:[g&&o,Q,H.Children.map(i,b=>b!=null?u.jsx(dc,{fallback:[],children:H.cloneElement(b,{id:r,layout:a,panelManager:q,registerComponent:Y})}):null)]})}Gb.propTypes={id:S.string.isRequired,children:S.node,data:S.shape({}),emptyDashboard:S.node,layout:Mb.Layout.isRequired,layoutConfig:S.arrayOf(S.shape({})),onLayoutChange:S.func,onLayoutInitialized:S.func};var RS="default";function ar(n,e,t){return e=qb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qb(n){var e=Xb(n,"string");return typeof e=="symbol"?e:String(e)}function Xb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Nn{}ar(Nn,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");ar(Nn,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");ar(Nn,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");ar(Nn,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");ar(Nn,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");const it=Nn;function Qt(n,e,t){return e=Zb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Zb(n){var e=Yb(n,"string");return typeof e=="symbol"?e:String(e)}function Yb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class At{}Qt(At,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");Qt(At,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");Qt(At,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");Qt(At,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");Qt(At,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");Qt(At,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");Qt(At,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");Qt(At,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");const Fa=At,kS=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function Lt(n,e,t){return e=Qb(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Qb(n){var e=Jb(n,"string");return typeof e=="symbol"?e:String(e)}function Jb(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class wt{}Lt(wt,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");Lt(wt,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");Lt(wt,"CLOSE_FILE","NotebookEvent.closeFile");Lt(wt,"RENAME","NotebookEvent.rename");Lt(wt,"RENAME_FILE","NotebookEvent.renameFile");Lt(wt,"REGISTER_FILE","NotebookEvent.registerFile");Lt(wt,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");Lt(wt,"UNREGISTER_FILE","NotebookEvent.unregisterFile");Lt(wt,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");const de=wt;function An(n,e,t){return e=ey(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ey(n){var e=ty(n,"string");return typeof e=="symbol"?e:String(e)}function ty(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class fn{}An(fn,"focus","TabEvent.focus");An(fn,"blur","TabEvent.blur");An(fn,"openPQObject","TabEvent.openPQObject");An(fn,"openControl","TabEvent.openControl");An(fn,"reload","TabEvent.reload");An(fn,"clearAllFilters","TabEvent.clearAllFilters");const wr=fn;function ny(n,e,t){return e=ry(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ry(n){var e=iy(n,"string");return typeof e=="symbol"?e:String(e)}function iy(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class rd extends m.PureComponent{constructor(e){super(e),this.handleCloseTab=this.handleCloseTab.bind(this),this.handleCloseTabsRight=this.handleCloseTabsRight.bind(this),this.handleCloseTabsAll=this.handleCloseTabsAll.bind(this),this.handleReopenLast=this.handleReopenLast.bind(this)}getAllTabs(){var e,t,r,{glContainer:i}=this.props;return[...(e=i==null||(t=i.tab)===null||t===void 0||(r=t.header)===null||r===void 0?void 0:r.tabs)!==null&&e!==void 0?e:[]]}handleCloseTab(){var{glContainer:e}=this.props;e.close()}handleCloseTabsAll(){var e=this.getAllTabs();e.forEach(t=>{var r;return(r=(t?.contentItem).container)===null||r===void 0?void 0:r.close()})}handleCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),r=t.length-1;r>0;r-=1){var i,o,a,s,l,d,h;if(((i=t[r].contentItem)===null||i===void 0||(o=i.config)===null||o===void 0?void 0:o.id)===((a=e.tab)===null||a===void 0||(s=a.contentItem)===null||s===void 0||(l=s.config)===null||l===void 0?void 0:l.id))break;(d=((h=t[r])===null||h===void 0?void 0:h.contentItem).container)===null||d===void 0||d.close()}}handleReopenLast(){var{glContainer:e,glEventHub:t}=this.props;t.emit(te.REOPEN_LAST,e)}canCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),r=!0,i=t.length-1;i>0;i-=1){var o,a,s,l,d,h,c,f;if(((o=t[i].contentItem)===null||o===void 0||(a=o.config)===null||a===void 0?void 0:a.id)===((s=e.tab)===null||s===void 0||(l=s.contentItem)===null||l===void 0||(d=l.config)===null||d===void 0?void 0:d.id))break;var v=!!(!((h=t[i])===null||h===void 0||(c=h.contentItem)===null||c===void 0||(f=c.config)===null||f===void 0)&&f.isClosable);if(v){r=!1;break}}return r}canCloseAny(){for(var e=this.getAllTabs(),t=!0,r=e.length-1;r>0;r-=1){var i,o,a,s=!!(!((i=e[r])===null||i===void 0||(o=i.contentItem)===null||o===void 0||(a=o.config)===null||a===void 0)&&a.isClosable);if(s){t=!1;break}}return t}canReopenLast(){var e,t,{workspace:r,glContainer:i}=this.props,o=(e=x.getStackForConfig(i.layoutManager.root,i.getConfig()))===null||e===void 0?void 0:e.config.id;return!((t=r.data.closed)!==null&&t!==void 0&&t.some(a=>a.parentStackId===o))}render(){var e,t,r,{additionalActions:i,glContainer:o}=this.props,a=[...i];a.push(()=>({title:"Re-open closed panel",group:ee.groups.medium+2004,action:this.handleReopenLast,disabled:this.canReopenLast()}));var s=(e=o.tab)===null||e===void 0||(t=e.contentItem)===null||t===void 0||(r=t.config)===null||r===void 0?void 0:r.isClosable;return a.push({title:"Close",order:10,group:ee.groups.low,action:this.handleCloseTab,disabled:s===void 0||!s}),a.push(()=>({title:"Close Tabs to Right",order:20,group:ee.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),a.push(()=>({title:"Close All",order:30,group:ee.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),u.jsx(ee,{actions:a})}}ny(rd,"defaultProps",{additionalActions:[]});var oy=n=>({workspace:yl(n)}),ay=Dn(oy,{setWorkspace:xl})(rd);const sy=ay;function id(n,e,t){return e=ly(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ly(n){var e=dy(n,"string");return typeof e=="symbol"?e:String(e)}function dy(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class od extends m.PureComponent{constructor(e){super(e),id(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=H.createRef();var{value:t}=e;this.state={value:t,valueWasValidated:!1}}componentDidUpdate(e){var{isShown:t}=e,{isShown:r}=this.props;r&&!t&&this.resetState()}resetState(){var{value:e}=this.props;this.setState({value:e,valueWasValidated:!1})}handleRenameDialogOpened(){var e,t;(e=this.renameInputRef)===null||e===void 0||(t=e.current)===null||t===void 0||t.focus()}handleRenameInputChange(e){this.setState({value:e.target.value})}handleRenameCancel(){var{onCancel:e}=this.props;e()}handleRenameSubmit(e){e.stopPropagation(),e.preventDefault();var{value:t}=this.state,r=t?.trim();if(r!==void 0&&r!==""){var{onSubmit:i}=this.props;i(r)}else this.setState({value:r,valueWasValidated:!0})}renderRenameDialog(){var{isShared:e,isOwner:t,itemType:r}=this.props,{value:i,valueWasValidated:o}=this.state;return u.jsxs("form",{className:Z("p-3",{"was-validated":o}),onSubmit:this.handleRenameSubmit,noValidate:!0,role:"presentation",onMouseDown:a=>{a.stopPropagation()},onMouseUp:a=>{a.stopPropagation()},children:[u.jsxs("div",{className:"form-group",children:[u.jsxs("label",{htmlFor:"rename-dialog-".concat(r,"-input"),children:["Rename ",r]}),u.jsx("input",{type:"text",className:"form-control",id:"rename-dialog-".concat(r,"-input"),value:i??void 0,ref:this.renameInputRef,onChange:this.handleRenameInputChange,required:!0}),u.jsxs("div",{className:"invalid-feedback",children:[r," name cannot be empty"]}),(e||!t)&&u.jsxs("div",{className:"pt-2",children:["Renaming this ",r," will rename for all users."]})]}),u.jsxs("div",{className:"text-right",children:[u.jsx(se,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),u.jsx(se,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var{isShown:e,onCancel:t}=this.props;return u.jsx(Ri,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}id(od,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});function Ii(n,e,t){return e=uy(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function uy(n){var e=hy(n,"string");return typeof e=="symbol"?e:String(e)}function hy(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var cy=B.module("Panel");class ad extends m.PureComponent{constructor(e){super(e),Ii(this,"ref",void 0),Ii(this,"getAdditionActions",yt((r,i,o)=>{var a=[];return i&&a.push(this.getCloneAction()),o&&a.push(this.getRenameAction()),[...a,...r]})),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleCopyPanel=this.handleCopyPanel.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleHide=this.handleHide.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleBeforeShow=this.handleBeforeShow.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.handleShowRenameDialog=this.handleShowRenameDialog.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleTab=this.handleTab.bind(this),this.ref=H.createRef();var{glContainer:t}=this.props;this.state={title:x.getTitleFromContainer(t),showRenameDialog:!1,isWithinPanel:!0}}componentDidMount(){var e,t,{componentPanel:r,glContainer:i,glEventHub:o}=this.props;i.on("resize",this.handleResize),i.on("show",this.handleBeforeShow),i.on("shown",this.handleShow),i.on("hide",this.handleHide),i.on("tab",this.handleTab),i.on("tabClicked",this.handleTabClicked),o.on(it.SESSION_CLOSED,this.handleSessionClosed),o.on(it.SESSION_OPENED,this.handleSessionOpened),o.on(wr.focus,this.handleTabFocus),o.on(wr.blur,this.handleTabBlur),o.on(Fa.CLEAR_ALL_FILTERS,this.handleClearAllFilters),o.emit(te.MOUNT,r??this),this.setState({isWithinPanel:((e=this.ref.current)===null||e===void 0||(t=e.parentElement)===null||t===void 0?void 0:t.closest(".dh-panel"))!=null})}componentWillUnmount(){var{componentPanel:e,glContainer:t,glEventHub:r}=this.props;t.off("resize",this.handleResize),t.off("show",this.handleBeforeShow),t.off("shown",this.handleShow),t.off("hide",this.handleHide),t.off("tab",this.handleTab),t.off("tabClicked",this.handleTabClicked),r.off(it.SESSION_CLOSED,this.handleSessionClosed),r.off(it.SESSION_OPENED,this.handleSessionOpened),r.off(wr.focus,this.handleTabFocus),r.off(wr.blur,this.handleTabBlur),r.off(Fa.CLEAR_ALL_FILTERS,this.handleClearAllFilters),r.emit(te.UNMOUNT,e??this)}handleTab(e){e!=null&&this.setState({title:x.getTitleFromTab(e)}),this.forceUpdate();var{onTab:t}=this.props;t(e)}handleTabClicked(e){var{onTabClicked:t}=this.props;t(e)}handleClearAllFilters(){var{onClearAllFilters:e}=this.props;e(...arguments)}handleFocus(e){var{componentPanel:t,glEventHub:r}=this.props;r.emit(te.FOCUS,t??this);var{onFocus:i}=this.props;i(e)}handleBlur(e){var{onBlur:t}=this.props;t(e)}handleHide(){var{onHide:e}=this.props;e(...arguments)}handleResize(){var{onResize:e}=this.props;e(...arguments)}handleSessionClosed(e){var{onSessionClose:t}=this.props;t(e)}handleSessionOpened(e,t){var{onSessionOpen:r}=this.props;r(e,t)}handleBeforeShow(){var{onBeforeShow:e}=this.props;e(...arguments)}handleShow(){var{onShow:e}=this.props;e(...arguments)}handleTabBlur(){var{onTabBlur:e}=this.props;e(...arguments)}handleTabFocus(){var{onTabFocus:e}=this.props;e(...arguments)}handleRenameCancel(){this.setState({showRenameDialog:!1})}handleShowRenameDialog(){this.setState({showRenameDialog:!0})}handleRenameSubmit(e){var{glContainer:t}=this.props;this.setState({showRenameDialog:!1,title:e});var r=x.getRootFromContainer(t),i=x.getComponentConfigFromContainer(t);k(i),x.renameComponent(r,i,e)}handleCopyPanel(){var{glContainer:e,glEventHub:t}=this.props,r=x.getRootFromContainer(e),i=x.getComponentConfigFromContainer(e);if(i==null){cy.error("Could not get component config from container",e);return}var o=x.cloneComponent(r,i);o!==null&&t.emit(te.CLONED,this,o)}getCloneAction(){return{title:"Copy Panel",order:10,group:ee.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:ee.groups.medium,action:this.handleShowRenameDialog}}render(){var{children:e,className:t,renderTabTooltip:r,glContainer:i,glEventHub:o,additionalActions:a,errorMessage:s,isLoaded:l,isLoading:d,isClonable:h,isRenamable:c}=this.props,{tab:f}=i,{showRenameDialog:v,title:p,isWithinPanel:g}=this.state;return u.jsxs("div",{className:Z("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,u.jsx(un,{errorMessage:s,isLoaded:l,isLoading:d}),!g&&f!=null&&Hr.createPortal(u.jsxs(u.Fragment,{children:[u.jsx(sy,{glContainer:i,glEventHub:o,additionalActions:this.getAdditionActions(a,h,c)}),c&&u.jsx(od,{isShown:v,value:p,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),r!=null&&u.jsx(qt,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:r()})]}),f.element[0])]})}}Ii(ad,"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 sr=ad,jS=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var my=Object.freeze({}),fy=new Map,qr=Object.freeze([]),$S=(n,e)=>{var t;return(t=Ae(n,e).columns)!==null&&t!==void 0?t:qr},HS=(n,e)=>{var t;return(t=Ae(n,e).filterSets)!==null&&t!==void 0?t:qr},BS=(n,e)=>{var t;return(t=Ae(n,e).filters)!==null&&t!==void 0?t:qr},WS=(n,e)=>{var t;return(t=Ae(n,e).tableMap)!==null&&t!==void 0?t:fy},US=(n,e)=>Ae(n,e).isolatedLinkerPanelId,sd=(n,e)=>{var t;return(t=Ae(n,e).links)!==null&&t!==void 0?t:qr},VS=(n,e)=>Ae(n,e).columnSelectionValidator,KS=(n,e)=>{var t;return(t=Ae(n,e).consoleSettings)!==null&&t!==void 0?t:my},zS=(n,e)=>Ae(n,e).connection,lr=(n,e)=>Ae(n,e).sessionWrapper,GS=(n,e)=>t=>t(Yt(n,{connection:e})),qS=(n,e)=>t=>t(Yt(n,{sessionWrapper:e})),ld=(n,e)=>t=>t(Yt(n,{links:e})),XS=(n,e)=>(t,r)=>{var i=sd(r(),n),o=e.filter(a=>i.findIndex(s=>Xn(s.start,a.start)&&Xn(s.end,a.end))<0);return t(ld(n,i.concat(o)))},ZS=(n,e)=>(t,r)=>{var i=sd(r(),n),o=i.filter(a=>!e.includes(a.id));return t(ld(n,o))},YS=(n,e)=>t=>t(Yt(n,{isolatedLinkerPanelId:e})),QS=(n,e)=>t=>t(Yt(n,{columnSelectionValidator:e})),vy=(n,e)=>t=>t(Yt(n,{consoleSettings:e})),JS=(n,e)=>t=>t(Yt(n,{filterSets:e}));function $r(n,e,t){return e=gy(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function gy(n){var e=py(n,"string");return typeof e=="symbol"?e:String(e)}function py(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Er=B.module("CommandHistoryPanel");class dr extends m.Component{static handleError(e){Er.error(e)}constructor(e){super(e),$r(this,"container",void 0),$r(this,"pending",void 0),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSendToConsole=this.handleSendToConsole.bind(this),this.handleSendToNotebook=this.handleSendToNotebook.bind(this),this.container=H.createRef(),this.pending=new Mn;var{session:t,sessionId:r,language:i}=e;this.state={panelState:{},session:t,sessionId:r,language:i,contextActions:[{action:this.handleFocusHistory,shortcut:ke.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){var{glEventHub:e,session:t}=this.props;e.on(it.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(it.FOCUS_HISTORY,this.handleFocusHistory),this.pending.cancel()}handleFocusHistory(){this.container.current&&this.container.current.focus()}handleShow(){var e;(e=this.container.current)===null||e===void 0||e.restoreScrollPosition()}handleSessionOpened(e,t){var{language:r,sessionId:i}=t;this.setState({session:e,sessionId:i,language:r},()=>{this.loadTable()})}handleSessionClosed(){this.pending.cancel(),this.setState({session:void 0,language:void 0,table:void 0})}handleSendToNotebook(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{session:r,language:i}=this.state;if(Er.debug("handleSendToNotebook",r,e),!r){Er.error("Session is not connected.");return}var{glEventHub:o}=this.props;o.emit(t?de.CREATE_NOTEBOOK:de.SEND_TO_NOTEBOOK,r,i,e)}handleSendToConsole(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;Er.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(it.SEND_COMMAND,e,t,r)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:r}=this.state;k(t),k(r),this.pending.add(e.getTable(t,r,Date.now()),i=>i.close()).then(i=>{this.setState({table:i})}).catch(dr.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:r}=this.props,{language:i,contextActions:o,table:a}=this.state;return u.jsxs(sr,{className:"command-history-pane",componentPanel:this,glContainer:e,glEventHub:t,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[!a&&u.jsx("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),a&&i!=null&&u.jsxs(u.Fragment,{children:[u.jsx(Rf,{ref:this.container,language:i,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:a,commandHistoryStorage:r}),u.jsx(ee,{actions:o})]})]})}}$r(dr,"COMPONENT","CommandHistoryPanel");$r(dr,"TITLE","Command History");var by=(n,e)=>{var t=pl(n),r=lr(n,e.localDashboardId),{session:i,config:o}=r??{},{type:a,id:s}=o??{};return{commandHistoryStorage:t,language:a,session:i,sessionId:s}},yy=Dn(by,null,null,{forwardRef:!0})(dr);const Cy=yy;var Sy=m.createContext(null),ur=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin"});function wy(n){return"DashboardPlugin"in n}function Ey(n){return"AuthPlugin"in n}function _y(n){return"TablePlugin"in n}function ew(n){return wy(n)||Ey(n)||_y(n)}function Py(n){return"type"in n&&n.type===ur.DASHBOARD_PLUGIN}function Xi(n){return"type"in n&&n.type===ur.WIDGET_PLUGIN}function Ty(n){return"type"in n&&n.type===ur.TABLE_PLUGIN}function Oy(n){return"type"in n&&n.type===ur.AUTH_PLUGIN}function dd(n){return"type"in n&&n.type===ur.THEME_PLUGIN}function tw(n){return Py(n)||Oy(n)||Ty(n)||dd(n)||Xi(n)}var Iy=B.module("@deephaven/plugin.PluginUtils");function Ra(n,e){return n==null||!Xi(n)?!1:[n.supportedTypes].flat().some(t=>t===e)}function Dy(n){var e=u.jsx(ue,{icon:fs});if(!Xi(n))return e;var{icon:t}=n;return t==null?e:m.isValidElement(t)?t:u.jsx(ue,{icon:t})}function nw(n){var e=[...n.entries()].filter(t=>dd(t[1]));return Iy.debug("Getting theme data from plugins",e),e.map(t=>{var[r,i]=t,o=Array.isArray(i.themes)?i.themes:[i.themes];return o.map(a=>{var{name:s,baseTheme:l,styleContent:d}=a;return{baseThemeKey:"default-".concat(l??"dark"),themeKey:tu(r,s),name:s,styleContent:d}})}).flat()}function rw(){return tr(Sy,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}function ka(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function _r(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ka(Object(t),!0).forEach(function(r){sn(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ka(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function sn(n,e,t){return e=xy(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function xy(n){var e=My(n,"string");return typeof e=="symbol"?e:String(e)}function My(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Pr=B.module("ConsolePanel"),Ny=500,Ay=Object.freeze({consoleSettings:{},itemIds:[]});class Xr extends m.PureComponent{constructor(e){super(e),sn(this,"consoleRef",void 0),sn(this,"objectSubscriptionCleanup",void 0),sn(this,"savePanelState",Pn(()=>{var{consoleSettings:a,itemIds:s}=this.state,l={consoleSettings:a,itemIds:[...s]};Pr.debug("Saving panel state",l),this.setState({panelState:l})},Ny)),this.handleFocusCommandHistory=this.handleFocusCommandHistory.bind(this),this.handleOpenObject=this.handleOpenObject.bind(this),this.handleCloseObject=this.handleCloseObject.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSettingsChange=this.handleSettingsChange.bind(this),this.handleShow=this.handleShow.bind(this),this.handlePanelMount=this.handlePanelMount.bind(this),this.supportsType=this.supportsType.bind(this),this.iconForType=this.iconForType.bind(this),this.consoleRef=H.createRef();var{panelState:t}=e,r=_r(_r({},Ay),t||{}),{consoleSettings:i,itemIds:o}=r;this.state={consoleSettings:i,itemIds:new Map(o),objectMap:new Map,error:void 0,panelState:r}}componentDidMount(){var{glEventHub:e}=this.props;this.closeDisconnectedPanels(),e.on(te.MOUNT,this.handlePanelMount),this.subscribeToFieldUpdates()}componentDidUpdate(e,t){var{consoleSettings:r,itemIds:i}=this.state;(t.consoleSettings!==r||t.itemIds!==i)&&this.savePanelState()}componentWillUnmount(){var e,{glEventHub:t}=this.props;this.savePanelState.flush(),t.off(te.MOUNT,this.handlePanelMount),(e=this.objectSubscriptionCleanup)===null||e===void 0||e.call(this)}subscribeToFieldUpdates(){var{sessionWrapper:e}=this.props;if(e!=null){var{session:t}=e;this.objectSubscriptionCleanup=t.subscribeToFieldUpdates(r=>{Pr.debug("Got updates",r),this.setState(i=>{var{objectMap:o}=i,{updated:a,created:s,removed:l}=r,d=[...a,...l],h=new Map(o);d.forEach(f=>{var{title:v}=f;v!==void 0&&h.delete(v)});var c=[...a,...s];return c.forEach(f=>{f.title!==void 0&&h.set(f.title,f)}),{objectMap:h}})})}}setItemId(e,t){this.setState(r=>{var{itemIds:i}=r,o=new Map(i);return o.set(e,t),{itemIds:o}})}getItemId(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{itemIds:r}=this.state,i=r.get(e);return i==null&&t&&(i=Mt(),this.setItemId(e,i)),i}handleTabFocus(){var e;(e=this.consoleRef.current)===null||e===void 0||e.focus()}handlePanelMount(e){var t,r,i,{itemIds:o}=this.state,a=e==null||(t=e.props)===null||t===void 0?void 0:t.id,s=e==null||(r=e.props)===null||r===void 0||(i=r.metadata)===null||i===void 0?void 0:i.sourcePanelId;if(a&&s){var l=new Set(o.values());l.has(s)&&this.setItemId(a,a)}}handleFocusCommandHistory(){var{glEventHub:e}=this.props;e.emit(it.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{root:r}=this.context,i=e.title!=null?this.getItemId(e.title,!1):null;(t||i!=null&&x.getStackForRoot(r,{id:i},!1,!1,!1)!=null)&&this.openWidget(e)}handleCloseObject(e){var{title:t}=e;if(t!==void 0){var r=this.getItemId(t,!1);if(r!=null){var{glEventHub:i}=this.props;i.emit(te.CLOSE,r)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;Pr.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(it.SETTINGS_CHANGED,e)}openWidget(e){var{glEventHub:t,sessionWrapper:r}=this.props;k(r);var{config:i,session:o}=r,{title:a=e.name}=e;k(a);var s=this.getItemId(a),l={fetch:()=>o.getObject(e),panelId:s,widget:_r(_r({},Oc(e)),{},{sessionId:i.id})};Pr.debug("openWidget",l),t.emit(te.OPEN,l)}addCommand(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;(t=this.consoleRef.current)===null||t===void 0||t.addCommand(e,r,i)}closeDisconnectedPanels(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{consoleSettings:t,itemIds:r}=this.state,{isClosePanelsOnDisconnectEnabled:i=!0}=t;if(!(!i&&!e)){var o=[...r.values()],{glEventHub:a}=this.props;o.forEach(s=>{a.emit(te.CLOSE,s)}),this.setState({itemIds:new Map})}}updateDimensions(){var e;(e=this.consoleRef.current)===null||e===void 0||e.updateDimensions()}supportsType(e){var{plugins:t}=this.props;return[...t.values()].some(r=>Ra(r,e))}iconForType(e){var{plugins:t}=this.props,r=[...t.values()].find(i=>Ra(i,e));return r!=null?Dy(r):u.jsx(Ic,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:r,sessionWrapper:i,timeZone:o,unzip:a}=this.props;if(i==null)return u.jsx(un,{isLoading:!1,errorMessage:"Console is disabled."});var{consoleSettings:s,error:l,objectMap:d}=this.state,{config:h,session:c,connection:f,details:v={},dh:p}=i,{workerName:g,processInfoId:y}=v,{id:P,type:O}=h;return u.jsx(sr,{className:"iris-panel-console",componentPanel:this,glContainer:t,glEventHub:r,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,errorMessage:l!=null?"".concat(l):void 0,children:c!=null&&u.jsx(vf,{dh:p,ref:this.consoleRef,settings:s,session:c,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:O,statusBarChildren:u.jsxs(u.Fragment,{children:[u.jsx("div",{children:Ys.LANGUAGE_MAP.get(O)}),g!=null&&u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"•"}),g]}),y!=null&&u.jsxs(u.Fragment,{children:[u.jsx("div",{children:"•"}),y,u.jsx("div",{children:"•"})]}),u.jsx(Fv,{connection:f,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})]}),scope:P,timeZone:o,objectMap:d,unzip:a,supportsType:this.supportsType,iconForType:this.iconForType})})}}sn(Xr,"COMPONENT","ConsolePanel");sn(Xr,"TITLE","Console");sn(Xr,"contextType",Ib);var Ly=(n,e)=>({commandHistoryStorage:pl(n),sessionWrapper:lr(n,e.localDashboardId),timeZone:Wv(n),plugins:Vv(n)}),Fy=Dn(Ly,null,null,{forwardRef:!0})(Xr);const ci=Fy;function iw(n){return n==="file"||n==="directory"}function ht(n){return n.type==="directory"}function Ry(n,e,t){return e=ky(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ky(n){var e=jy(n,"string");return typeof e=="symbol"?e:String(e)}function jy(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class $y extends Error{constructor(){super("No file exists at the path specified"),Ry(this,"isFileNotFound",!0)}}const Zi=$y;function ja(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function $a(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){ja(o,r,i,a,s,"next",l)}function s(l){ja(o,r,i,a,s,"throw",l)}a(void 0)})}}var xt;(function(n){n.GROOVY="text/x-groovy",n.PLAIN_TEXT="text/plain",n.PYTHON="text/x-python",n.PYTHON_COMPILED="application/x-python-code",n.SCALA="text/x-scala",n.UNKNOWN=""})(xt||(xt={}));class vt{static fileExists(e,t){return $a(function*(){try{return yield e.info(t),!0}catch(r){if(!(r instanceof Zi))throw r;return!1}})()}static fileExtensionToString(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return e.length===0?"":".".concat(e)}static getDepth(e){var t;if(!vt.hasPath(e))throw new Error("Invalid path provided: ".concat(e));var r=(t=e.match(/\//g))!==null&&t!==void 0?t:[];return r.length-1}static getExtension(e){var t=this.getBaseName(e).split(".");if(t.length>1){var r;return(r=t.pop())!==null&&r!==void 0?r:""}return""}static getBaseName(e){var t;return(t=e.split("/").pop())!==null&&t!==void 0?t:""}static getCopyFileName(e){var t=e.lastIndexOf("."),r=null,i=null;t<0?i=e:(i=e.substring(0,t),r=e.substring(t+1));var o=i?"".concat(i,"-copy"):"Copy";return r!==null?"".concat(o,".").concat(r):o}static getUniqueCopyFileName(e,t){return $a(function*(){for(var r=vt.getCopyFileName(t);yield vt.fileExists(e,r);)r=vt.getCopyFileName(r);return r})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return xt.GROOVY;case"py":return xt.PYTHON;case"pyc":return xt.PYTHON_COMPILED;case"scala":return xt.SCALA;case"txt":return xt.PLAIN_TEXT;default:return xt.UNKNOWN}}static getParent(e){if(!vt.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(!vt.hasPath(e))throw new Error("Invalid filename provided: ".concat(e));var t=e.split("/");return t.pop(),"".concat(t.join("/"),"/")}static hasPath(e){return e.startsWith("/")}static isPath(e){return e.startsWith("/")&&e.endsWith("/")}static makePath(e){return e.endsWith("/")?e:"".concat(e,"/")}static replaceExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=e.lastIndexOf("."),i=r>-1?e.substring(0,r):e,o=vt.fileExtensionToString(t);return"".concat(i).concat(o)}static validateName(e){var t=[".",".."],r=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new Kn("Name cannot be empty");if(t.includes(e))throw new Kn('"'.concat(e,'" is a reserved name'));if(r.test(e)){var o,a;throw new Kn('Invalid characters in name: "'.concat((o=(a=e.match(r))===null||a===void 0?void 0:a.reduce((s,l)=>s.includes(l)?s:[...s,l],[]).map(s=>i.has(s)?i.get(s):s).join('", "'))!==null&&o!==void 0?o:"",'"'))}}static reducePaths(e){var t=e.filter(r=>vt.isPath(r));return e.filter(r=>!t.some(i=>r!==i&&r.startsWith(i)))}static removeRoot(e,t){if(e.length===0)return t;if(!t.startsWith(e))throw new Error("Filename ".concat(t," does not start with expected root ").concat(e));return t.substring(e.length)}static addRoot(e,t){return"".concat(e).concat(t)}}const $=vt;var Yi=26;function Di(n){return ht(n)?$.makePath(n.filename):$.getPath(n.filename)}function Ha(n,e){if(n.length===0||e==null)throw new Error("No items to move");var t=Di(e);if(n.some(r=>{var{filename:i}=r;return $.getPath(i)===t}))throw new Error("File already in the destination folder");if(n.some(r=>ht(r)&&t.startsWith($.makePath(r.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:n,targetPath:t}}function Hy(n){if(ht(n))return n.isExpanded?nu:ru;var e=$.getMimeType(n.basename);switch(e){case xt.PYTHON:return ou;default:return iu}}function xi(n){var e,{children:t,draggedItems:r,isDragInProgress:i,isDropTargetValid:o,isSelected:a,item:s,itemIndex:l,dropTargetItem:d,onDragStart:h,onDragOver:c,onDragEnd:f,onDrop:v}=n,p=(e=r?.some(N=>N.id===s.id))!==null&&e!==void 0?e:!1,g=Di(s),y=i&&d?Di(d):null,P=i&&o&&ht(s)&&y===g,O=i&&o&&y===g,_=i&&!o&&y===g,R=Hy(s),U=$.getDepth(s.filename),Q=Array(U).fill(null).map((N,W)=>u.jsx("span",{className:"file-list-depth-line"},W));return u.jsxs("div",{className:Z("d-flex w-100 align-items-center","file-list-item",{"is-dragged":p,"is-exact-drop-target":P,"is-in-drop-target":O,"is-invalid-drop-target":_,"is-selected":a}),onDragStart:N=>h(l,N),onDragOver:N=>c(l,N),onDragEnd:N=>f(l,N),onDrop:N=>v(l,N),draggable:!0,role:"presentation","aria-label":s.basename,children:[Q," ",u.jsx(ue,{icon:R,className:"item-icon",fixedWidth:!0})," ",u.jsx("span",{className:"truncation-wrapper",children:t??u.jsxs(u.Fragment,{children:[s.basename,u.jsx(qt,{children:s.basename})]})})]})}function Ba(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Tr(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ba(Object(t),!0).forEach(function(r){By(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ba(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function By(n,e,t){return e=Wy(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Wy(n){var e=Uy(n,"string");return typeof e=="symbol"?e:String(e)}function Uy(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Le=B.module("FileList"),Vy=500,Wa="item-list-scroll-pane";function Ky(n){var{isMultiSelect:e=!1,table:t,onFocusChange:r=()=>{},onMove:i,onSelect:o,onSelectionChange:a=()=>{},renderItem:s=xi,rowHeight:l=Yi,overscanCount:d=Ye.DEFAULT_OVERSCAN}=n,[h,c]=m.useState(()=>({items:[],offset:0,itemCount:0})),[f,v]=m.useState({top:0,bottom:0}),[p,g]=m.useState(),[y,P]=m.useState(),[O,_]=m.useState(),[R,U]=m.useState([]),Q=m.useRef(),N=m.useRef(null),W=m.useRef(null),j=m.useCallback(I=>{if(I.length===0||h==null)return[];for(var X=[],re=0;re<I.length;re+=1)for(var he=I[re],_e=he[0];_e<=he[1];_e+=1)_e>=h.offset&&_e<h.offset+h.items.length&&X.push(h.items[_e-h.offset]);return X},[h]),Y=m.useCallback(I=>{var X=j([[I,I]]);if(X.length>0)return X[0]},[j]),ne=m.useCallback(()=>{var I=It.count(R);if(I===0)return null;if(I===1){var X=R[0][0],re=Y(X);if(re!=null)return re.filename}return"".concat(I," items")},[Y,R]),F=m.useCallback(I=>{if(!(!y||!p)){Le.debug("dropItems",y,"to",I);try{var{files:X,targetPath:re}=Ha(y,p);if(i?.(X,re),I!=null){var he;U([[I,I]]),(he=N.current)===null||he===void 0||he.focusItem(I)}}catch(_e){Le.error("Unable to complete move",_e)}}},[y,p,i]),q=m.useCallback((I,X)=>{var re=h.items[I-h.offset];re!==void 0&&(Le.debug("handleItemClick",re),o(re,X),ht(re)&&t?.setExpanded(re.filename,!re.isExpanded))},[h,o,t]),K=m.useCallback((I,X)=>{var re;Le.debug2("handleItemDragStart",I,R);var he=R;It.isSelected(R,I)||(he=[[I,I]],U(he)),P(j(he)),(re=N.current)===null||re===void 0||re.resetMouseState();var _e=document.createElement("div");_e.innerHTML='<div class="dnd-placeholder-content">'.concat(ne(),"</div>"),_e.className="file-list-dnd-placeholder",document.body.appendChild(_e),X.dataTransfer.setDragImage(_e,0,0),X.dataTransfer.effectAllowed="move",_(_e)},[ne,j,R]),A=m.useCallback((I,X)=>{X.preventDefault(),Le.debug2("handleItemDragOver",X),g(Y(I))},[Y]),V=m.useCallback((I,X)=>{Le.debug("handleItemDragEnd",I),O?.remove(),P(void 0),g(void 0),_(void 0)},[O]),z=m.useCallback((I,X)=>{F(I)},[F]),me=m.useCallback(()=>{Le.debug2("handleItemDragExit"),g(void 0)},[]),je=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains(Wa)&&(I.preventDefault(),Le.debug2("handleListDragOver",I),g({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),De=m.useCallback(I=>{I.target instanceof Element&&I.target.classList.contains(Wa)&&(Le.debug("handleListDrop"),F())},[F]),b=m.useCallback(function(I){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(Le.debug2("handleSelectionChange",I),X===!0||I!==R){U(I);var re=j(I);a(re)}},[j,a,R]),w=m.useCallback(I=>{if(Le.debug2("handleFocusChange",I),I!=null){var[X]=j([[I,I]]);r(X)}else r();Q.current=I},[j,r]),T=m.useCallback((I,X)=>{Le.debug("handleViewportChange",I,X),(I!==f.top||X!==f.bottom)&&v({top:I,bottom:X})},[f]),G=m.useMemo(()=>{if(!y||!p)return!1;try{return Ha(y,p),Le.debug("handleValidateDropTarget true"),!0}catch{return Le.debug("handleValidateDropTarget false"),!1}},[y,p]),{focusedPath:J}=n;m.useEffect(()=>{J!==void 0&&(J==="/"?t.collapseAll():(t.setExpanded(J,!1),t.setExpanded(J,!0)))},[t,J]),m.useEffect(function(){Le.debug("updating table viewport",f),t?.setViewport({top:Math.max(0,f.top-d),bottom:f.bottom+d})},[d,t,f]),m.useEffect(function(){var X=t.onUpdate(re=>{c({items:re.items.map(he=>Tr(Tr({},he),{},{itemName:he.basename})),offset:re.offset,itemCount:t.size})});return()=>{X()}},[t]),m.useEffect(function(){Q.current!=null&&w(Q.current),R.length>0&&b(R,!0)},[h,w,b,R]),m.useEffect(function(){if(p!=null&&ht(p)&&p.filename!=="/"){var X=setTimeout(()=>{p.isExpanded||t?.setExpanded(p.filename,!0)},Vy);return()=>clearTimeout(X)}},[p,t]);var Qe=m.useCallback(I=>s(Tr(Tr({},I),{},{isDragInProgress:y!=null,dropTargetItem:p,draggedItems:y,isDropTargetValid:G,onDragStart:K,onDragEnd:V,onDragOver:A,onDragExit:me,onDrop:z})),[V,me,A,K,z,y,p,G,s]);return u.jsx("div",{ref:W,className:Z("file-list",{"is-dragging":y!=null}),onDragOver:je,onDrop:De,children:u.jsx(Ye,{ref:N,items:h.items,itemCount:h.itemCount,offset:h.offset,onFocusChange:w,onSelect:q,onSelectionChange:b,onViewportChange:T,selectedRanges:R,renderItem:Qe,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var zy={name:"File Explorer",DELETE:ce.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[D.DELETE],macShortcut:[L.CMD,D.BACKSPACE]}),RENAME:ce.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[D.ENTER],macShortcut:[D.ENTER]})};const Ua={FILE_EXPLORER:zy};var Va=B.module("FileListItemEditor"),Gy=()=>Promise.resolve();function qy(n){var{item:e,onCancel:t,onSubmit:r,validate:i=Gy}=n,o=m.useRef(null),[a,s]=m.useState(e.basename),[l,d]=m.useState(),[h,c]=m.useState(Promise.resolve()),f=m.useCallback(()=>{var O;(O=o.current)===null||O===void 0||O.focus()},[o]),v=m.useCallback(O=>O.stopPropagation(),[]),p=m.useCallback(()=>{h.then(()=>{r(a)}).catch(O=>Va.info("Unable to validate name",O))},[r,a,h]);m.useEffect(function(){var _=Ee.makeCancelable(i(a));return _.then(()=>d(void 0)).catch(R=>{Ee.isCanceled(R)||d(R)}),c(_),()=>_.cancel()},[i,a]),m.useEffect(function(){f()},[f]);var g=m.useCallback(()=>{Va.debug2("handleBlur"),p()},[p]),y=m.useCallback(O=>{var{value:_}=O.target;s(_)},[]),P=m.useCallback(O=>{O.stopPropagation();var{key:_}=O;switch(_){case"Enter":{p();break}case"Escape":{t();break}}},[t,p]);return u.jsxs("div",{className:"file-list-item-editor",children:[u.jsx("input",{type:"text",className:Z("form-control file-list-item-editor-input",{"is-invalid":l}),value:a,ref:o,onBlur:g,onKeyDown:P,onChange:y,onClick:v,onDoubleClick:v,onMouseDown:v}),l&&u.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}function Ka(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function mi(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ka(Object(t),!0).forEach(function(r){Xy(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Ka(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Xy(n,e,t){return e=Zy(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Zy(n){var e=Yy(n,"string");return typeof e=="symbol"?e:String(e)}function Yy(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function ud(n){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:r=!1,onCreateFile:i,onCreateFolder:o,onCopy:a,onDelete:s,onMove:l,onRename:d,onSelect:h,onSelectionChange:c,table:f,rowHeight:v=Yi,validateRename:p=()=>Promise.resolve()}=n,[g,y]=m.useState(),[P,O]=m.useState([]),[_,R]=m.useState(),U=m.useCallback(z=>{O(z),c?.(z)},[c]),Q=m.useCallback(z=>{R(z)},[]),N=m.useCallback(()=>{_&&a?.(_)},[_,a]),W=m.useCallback(()=>{P.length>0&&s?.(P)},[s,P]),j=m.useCallback(()=>{i?.()},[i]),Y=m.useCallback(()=>{_&&o?.($.getPath(_.filename))},[_,o]),ne=m.useCallback(()=>{_&&y(_)},[_]),F=m.useCallback(()=>{y(void 0)},[]),q=m.useCallback(z=>{g&&(d?.(g,z),y(void 0))},[d,g]),K=m.useMemo(()=>{if(g)return[];var z=[];return i&&z.push({title:"New File",description:"Create new file",action:j,group:ee.groups.medium}),o&&z.push({title:"New Folder",description:"Create new folder",action:Y,group:ee.groups.medium}),a&&z.push({title:"Copy File",description:"Copy the selected file",action:N,group:ee.groups.low,disabled:_==null||ht(_)}),s&&P.length>0&&z.push({title:"Delete",description:"Delete",shortcut:Ua.FILE_EXPLORER.DELETE,action:W,group:ee.groups.low}),d&&z.push({title:"Rename",description:"Rename",shortcut:Ua.FILE_EXPLORER.RENAME,action:ne,group:ee.groups.low,disabled:_==null}),z},[N,W,j,Y,ne,_,a,i,o,s,d,P,g]),A=m.useCallback(z=>(k(g),p(g,z)),[g,p]),V=m.useCallback(z=>{var{item:me}=z;return g&&g.filename===me.filename?u.jsx(xi,mi(mi({},z),{},{children:u.jsx(qy,{item:me,validate:A,onSubmit:q,onCancel:F})})):u.jsx(xi,mi({},z))},[F,q,g,A]);return u.jsxs("div",{className:"file-list-container",children:[f!=null&&u.jsx(Ky,{onMove:l,onSelect:h,onSelectionChange:U,onFocusChange:Q,renderItem:V,rowHeight:v,table:f,isMultiSelect:e,focusedPath:t}),r&&u.jsx(ee,{actions:K})]})}ud.displayName="FileListContainer";function za(n,e,t){return e=Qy(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Qy(n){var e=Jy(n,"string");return typeof e=="symbol"?e:String(e)}function Jy(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class eC extends Kn{constructor(e){super("Name already exists"),za(this,"isExistingFile",!0),za(this,"info",void 0),this.info=e}}const Ir=eC;function Ga(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function qa(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Ga(o,r,i,a,s,"next",l)}function s(l){Ga(o,r,i,a,s,"throw",l)}a(void 0)})}}var ft=B.module("FileExplorer");function Qi(n){var{storage:e,isMultiSelect:t=!1,focusedPath:r,onCopy:i=()=>{},onDelete:o=()=>{},onRename:a=()=>{},onCreateFile:s=()=>{},onCreateFolder:l=()=>{},onSelect:d,onSelectionChange:h,rowHeight:c=Yi}=n,[f,v]=m.useState([]),[p,g]=m.useState();m.useEffect(function(){var q;function K(){return A.apply(this,arguments)}function A(){return A=qa(function*(){ft.debug("initTable"),q=Ee.makeCancelable(e.getTable(),V=>V.close());try{g(yield q)}catch(V){Ee.isCanceled(V)||ft.error("Unable to initialize table",V)}}),A.apply(this,arguments)}return K(),()=>{q.cancel()}},[e]);var y=m.useCallback(F=>{Ee.isCanceled(F)||ft.error(F)},[]),P=m.useCallback(()=>{ft.debug("handleCreateFile"),s()},[s]),O=m.useCallback(()=>{ft.debug("handleCreateFolder"),l()},[l]),_=m.useCallback(F=>{ft.debug("handleCopyFile",F.filename),i(F)},[i]),R=m.useCallback(F=>{ft.debug("handleDelete, pending confirmation",F),v(F)},[]),U=m.useCallback(()=>{ft.debug("handleDeleteConfirm",f),f.forEach(F=>e.deleteFile(ht(F)?$.makePath(F.filename):F.filename)),o(f),v([])},[f,o,e]),Q=m.useCallback(()=>{ft.debug("handleDeleteCancel"),v([])},[]),N=m.useCallback((F,q)=>{var K=$.reducePaths(F.map(A=>ht(A)?$.makePath(A.filename):A.filename));K.forEach(A=>{var V=$.isPath(A)?"".concat(q).concat($.getBaseName(A.substring(0,A.length-1)),"/"):"".concat(q).concat($.getBaseName(A));e.moveFile(A,V).then(()=>{a(A,V)}).catch(y)})},[y,a,e]),W=m.useCallback((F,q)=>{var K=F.filename,A=ht(F);A&&!K.endsWith("/")&&(K="".concat(K,"/"));var V="".concat($.getParent(K)).concat(q);A&&!V.endsWith("/")&&(V="".concat(V,"/")),ft.debug2("handleRename",K,V),e.moveFile(K,V).catch(y),a(K,V)},[y,a,e]),j=m.useCallback(function(){var F=qa(function*(q,K){if(K!==q.basename){$.validateName(K);var A="".concat($.getPath(q.filename)).concat(K);try{var V=yield e.info(A);throw new Ir(V)}catch(z){if(!(z instanceof Zi))throw z}}});return function(q,K){return F.apply(this,arguments)}}(),[e]),Y=f.length>0,ne=m.useMemo(()=>f.length===1?'Are you sure you want to delete "'.concat(f[0].filename,'"?'):"Are you sure you want to delete the selected files?",[f]);return u.jsxs("div",{className:"file-explorer",children:[p&&u.jsx(ud,{isMultiSelect:t,focusedPath:r,showContextMenu:!0,onCopy:_,onCreateFolder:O,onCreateFile:P,onMove:N,onDelete:R,onRename:W,onSelect:d,onSelectionChange:h,rowHeight:c,table:p,validateRename:j}),u.jsx(dn,{isOpen:Y,headerText:ne,bodyText:"You cannot undo this action.",onCancel:Q,onConfirm:U,confirmButtonText:"Delete"})]})}Qi.displayName="FileExplorer";function Xa(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function tC(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Xa(o,r,i,a,s,"next",l)}function s(l){Xa(o,r,i,a,s,"throw",l)}a(void 0)})}}function Wt(n,e,t){return e=nC(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function nC(n){var e=rC(n,"string");return typeof e=="symbol"?e:String(e)}function rC(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var en=B.module("NewItemModal");class ln extends m.PureComponent{static getValidationMessage(e){return e instanceof Ir&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){Ee.isCanceled(e)||en.error(e)}constructor(e){super(e),Wt(this,"inputRef",H.createRef()),Wt(this,"cancelableValidatePromise",void 0),Wt(this,"cancelableExistingItemPromise",void 0),Wt(this,"pending",new Mn),Wt(this,"pathMap",new Map),Wt(this,"isInitialLoad",!0),this.handleModalSubmit=this.handleModalSubmit.bind(this),this.handleModalOpened=this.handleModalOpened.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleChange=this.handleChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleValidationError=this.handleValidationError.bind(this),this.handleOverwriteCancel=this.handleOverwriteCancel.bind(this),this.handleOverwriteConfirm=this.handleOverwriteConfirm.bind(this),this.handleExtensionChangeCancel=this.handleExtensionChangeCancel.bind(this),this.handleExtensionChangeConfirm=this.handleExtensionChangeConfirm.bind(this),this.handleBreadcrumbSelect=this.handleBreadcrumbSelect.bind(this);var{defaultValue:t}=e,r=$.hasPath(t)?$.getPath(t):"/";this.state={isSubmitting:!1,path:r,prevExtension:$.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:$.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:r}=this.props,{isOpen:i}=e,{value:o,path:a}=this.state;!i&&r&&(this.resetValue(),this.isInitialLoad=!0),i&&r&&(!this.isInitialLoad&&(a!==t.path||o!==t.value)&&this.updateValidationStatus(a,o),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){var{defaultValue:e}=this.props,t=$.hasPath(e)?$.getPath(e):"/";this.setState({path:t,value:$.getBaseName(e),validationError:void 0,prevExtension:$.getExtension(e),isSubmitting:!1})}getValidationPromise(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=Ee.makeCancelable(this.validateName(e,t,r)),this.cancelableValidatePromise}validateName(e,t,r){var i=this;return tC(function*(){$.validateName(t);var{defaultValue:o,storage:a}=i.props;if(r){var s="".concat(e).concat(t);if(s!==o)try{var l=yield a.info(s);throw new Ir(l)}catch(d){if(!(d instanceof Zi))throw d}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(ln.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var{value:t}=e.target;this.setState({value:t})}handleSelect(e){if(en.debug("handleSelect",e),e.type==="directory")this.setState({path:$.makePath(e.filename)});else{var t=e.basename,r=$.getPath(e.filename);this.setState({value:t,path:r},()=>{this.focusRenameInput()})}}handleKeyDown(e){var{key:t}=e;switch(e.stopPropagation(),t){case"Enter":{e.preventDefault(),this.submitModal();break}case"Escape":{e.preventDefault();var{onCancel:r}=this.props;r();break}}}handleValidationError(e){if(!(e instanceof Kn))throw e;en.debug("Validation error",e),this.setState({validationError:e})}handleOverwriteCancel(){this.setState({showOverwriteModal:!1,isSubmitting:!1})}handleOverwriteConfirm(){this.setState({showOverwriteModal:!1});var{onSubmit:e}=this.props,{path:t,value:r}=this.state;en.debug("handleOverwriteConfirm",t,r),e("".concat(t).concat(r),!0)}handleExtensionChangeCancel(){en.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:r}=e,i=$.replaceExtension(t,r);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){en.debug("handleExtensionChangeConfirm"),this.setState({showExtensionChangeModal:!1}),this.submitModal(!0)}focusRenameInput(){var e=this.inputRef.current;if(e){var{type:t}=this.props,{value:r}=e,i=t==="directory"?r.length:r.lastIndexOf(".");e.focus(),e.setSelectionRange(0,i>0?i:r.length)}}submitModal(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.setState(t=>{var{prevExtension:r,value:i,path:o}=t,{notifyOnExtensionChange:a,type:s}=this.props;en.debug("submitModal",r,i);var l=$.getExtension(i);return a&&!e&&r!==null&&r!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(o,i,!0).then(d=>{var{onSubmit:h}=this.props;h("".concat(o).concat(i))}).catch(d=>{if(d instanceof Ir&&s!=="directory"&&d.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw d}).catch(d=>{throw Ee.isCanceled(d)&&this.setState({isSubmitting:!1}),d}).catch(this.handleValidationError).catch(ln.handleError),{isSubmitting:!0,showExtensionChangeModal:!1,newExtension:void 0})})}handleBreadcrumbSelect(e){this.setState({path:e})}renderPathButtons(e){var t=e.split("/");return t.pop(),t.map((r,i)=>{for(var o="",a=0;a<i;a+=1)o+="".concat(t[a],"/");return o+="".concat(r,"/"),u.jsxs(H.Fragment,{children:[u.jsx(se,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(o),"aria-label":i===0?"Home":void 0,icon:i===0?u.jsx(ue,{icon:au,transform:"right-1.6"}):void 0,tooltip:i===0?"Home":void 0,children:r}),"/"]},o)})}render(){var{storage:e,isOpen:t,onCancel:r,placeholder:i,title:o,type:a}=this.props,{isSubmitting:s,path:l,showExtensionChangeModal:d,showOverwriteModal:h,validationError:c,value:f,prevExtension:v,newExtension:p}=this.state,g=a==="directory",y=$.fileExtensionToString(v),P=$.fileExtensionToString(p),O=g?"Create":"Save",_=g?"New folder name":"Save file as";return u.jsxs(u.Fragment,{children:[u.jsxs(ds,{isOpen:t,toggle:r,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[u.jsx(us,{toggle:r,children:o}),u.jsx(hs,{children:u.jsx("form",{children:u.jsxs("div",{className:"d-flex flex-column new-file-modal-content",children:[u.jsxs("div",{className:"flex-grow-0 mb-4",children:[u.jsx("label",{htmlFor:"file-name-input",children:_}),u.jsx("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:Z("form-control",{"is-invalid":c}),value:f,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),c&&u.jsx("div",{className:"invalid-feedback",children:ln.getValidationMessage(c)})]}),u.jsxs("div",{className:"flex-grow-0",children:[u.jsx("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),u.jsx("div",{className:"flex-grow-1 file-explorer-container",children:u.jsx(Qi,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),u.jsxs(js,{children:[u.jsx(se,{kind:"secondary",onClick:r,children:"Cancel"}),u.jsx(se,{kind:"primary",disabled:s,onClick:this.handleModalSubmit,children:O})]})]}),u.jsx(dn,{isOpen:h,headerText:"Confirm overwrite",bodyText:"File with this name already exists, are you sure you want to overwrite it?",onCancel:this.handleOverwriteCancel,onConfirm:this.handleOverwriteConfirm,cancelButtonText:"Cancel",confirmButtonText:"Overwrite"}),u.jsx(dn,{isOpen:d,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(y,'" to "').concat(P,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(y,'"'),confirmButtonText:'Use "'.concat(P,'"')})]})}}Wt(ln,"propTypes",{isOpen:S.bool,title:S.string.isRequired,defaultValue:S.string,type:S.oneOf(["file","directory"]).isRequired,onSubmit:S.func,onCancel:S.func,placeholder:S.string,storage:S.shape({}).isRequired,notifyOnExtensionChange:S.bool});Wt(ln,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(n,e)=>{},onCancel:()=>{}});const hd=ln;function iC(n){var{createFile:e,createFolder:t,onSearchChange:r,defaultSearchText:i=""}=n;return u.jsxs("div",{className:"file-explorer-toolbar",children:[u.jsxs("div",{className:"file-explorer-toolbar-buttons",children:[u.jsx(se,{kind:"ghost",icon:Es,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),u.jsx(se,{kind:"ghost",icon:su,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),r&&u.jsx("div",{className:"file-explorer-toolbar-search",children:u.jsx(tc,{value:i,onChange:r,placeholder:"Search by name"})})]})}function Za(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function oC(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Za(o,r,i,a,s,"next",l)}function s(l){Za(o,r,i,a,s,"throw",l)}a(void 0)})}}function cd(n,e,t){return e=aC(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function aC(n){var e=sC(n,"string");return typeof e=="symbol"?e:String(e)}function sC(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var tn=B.module("FileExplorerPanel"),lC=(n,e)=>{var t=bl(n),r=lr(n,e.localDashboardId),{session:i,config:o}=r??{},a=o?.type;return{fileStorage:t,language:a,session:i}},dC=Dn(lC,null,null,{forwardRef:!0});function uC(n){var e=n;return e!=null&&typeof e.button=="number"}class In extends H.Component{static handleError(e){tn.error(e)}static isFocusEvent(e){return uC(e)?e.detail>=2:!0}constructor(e){super(e),this.handleFileSelect=this.handleFileSelect.bind(this),this.handleCopyFile=this.handleCopyFile.bind(this),this.handleCreateFile=this.handleCreateFile.bind(this),this.handleCreateDirectory=this.handleCreateDirectory.bind(this),this.handleCreateDirectoryCancel=this.handleCreateDirectoryCancel.bind(this),this.handleCreateDirectorySubmit=this.handleCreateDirectorySubmit.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleRename=this.handleRename.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this);var{session:t,language:r}=e;this.state={isShown:!1,language:r,session:t,showCreateFolder:!1,focusedFilePath:"/"}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){var{glEventHub:e}=this.props,{session:t,language:r}=this.state,i={language:r,value:""};tn.debug("handleCreateFile",t,r,i),e.emit(de.CREATE_NOTEBOOK,t,r,i)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){tn.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){tn.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(In.handleError)}handleCopyFile(e){var t=this;return oC(function*(){var{fileStorage:r}=t.props;if(ht(e)){tn.error("Invalid item in handleCopyItem",e);return}var i=yield $.getUniqueCopyFileName(r,e.filename);yield r.copyFile(e.filename,i)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(r=>{t.emit(de.CLOSE_FILE,{id:r.filename,itemName:r.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=$.makePath(e[0].filename):t=$.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(tn.debug("fileSelect",e),e.type!=="directory"){var r=In.isFocusEvent(t),i={id:e.filename,itemName:e.filename},{glEventHub:o}=this.props,{session:a,language:s}=this.state,l={value:null,language:s};o.emit(de.SELECT_NOTEBOOK,a,s,l,i,r)}}handleRename(e,t){var{glEventHub:r}=this.props;tn.debug("handleRename",e,t),r.emit(de.RENAME_FILE,e,t)}handleSessionOpened(e,t){var{language:r}=t;this.setState({session:e,language:r})}handleSessionClosed(){this.setState({session:void 0,language:void 0})}handleShow(){this.setState({isShown:!0})}isHidden(){var{glContainer:e}=this.props,{isHidden:t}=e;return t}render(){var{fileStorage:e,glContainer:t,glEventHub:r}=this.props,{isShown:i,showCreateFolder:o,focusedFilePath:a}=this.state;return u.jsxs(sr,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:r,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[u.jsx(iC,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&u.jsx(Qi,{isMultiSelect:!0,storage:e,onCopy:this.handleCopyFile,onCreateFile:this.handleCreateFile,onCreateFolder:this.handleCreateDirectory,onDelete:this.handleDelete,onRename:this.handleRename,onSelect:this.handleFileSelect,onSelectionChange:this.handleSelectionChange}),u.jsx(hd,{isOpen:o,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:a})]})}}cd(In,"COMPONENT","FileExplorerPanel");cd(In,"TITLE","File Explorer");var hC=dC(In);const cC=hC;function Jn(n,e,t){return e=mC(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function mC(n){var e=fC(n,"string");return typeof e=="symbol"?e:String(e)}function fC(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var Ya=B.module("LogPanel");class Zr extends m.PureComponent{constructor(e){super(e),Jn(this,"isBottomVisible",void 0),Jn(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){Ya.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){Ya.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){var{glContainer:e,glEventHub:t}=this.props,{session:r}=this.state;return u.jsxs(sr,{componentPanel:this,glContainer:e,glEventHub:t,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[r==null&&u.jsx("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),r!=null&&u.jsx(Bf,{session:r,ref:i=>{this.logView=i}})]})}}Jn(Zr,"defaultProps",{session:null});Jn(Zr,"COMPONENT","LogPanel");Jn(Zr,"TITLE","Log");var vC=(n,e)=>{var t;return{session:(t=lr(n,e.localDashboardId))===null||t===void 0?void 0:t.session}},gC=Dn(vC,null,null,{forwardRef:!0})(Zr);const pC=gC;function Qa(n,e,t,r,i,o,a){try{var s=n[o](a),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(r,i)}function Ja(n){return function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(l){Qa(o,r,i,a,s,"next",l)}function s(l){Qa(o,r,i,a,s,"throw",l)}a(void 0)})}}function es(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function He(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?es(Object(t),!0).forEach(function(r){Ne(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):es(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function Ne(n,e,t){return e=bC(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bC(n){var e=yC(n,"string");return typeof e=="symbol"?e:String(e)}function yC(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var CC=m.lazy(()=>_s(()=>import("./MarkdownNotebook-1e09c624.js"),["./MarkdownNotebook-1e09c624.js","./vendor-e600113a.js","./helpers-de833af9.js","./vendor-fb3fd713.css","./index-a5f0f1ea.js","./monaco-b5248072.js","./monaco-f18fde03.css","./index-13e1b819.css","./mathjax-d44a0e6a.js","./MarkdownNotebook-9207e775.css"],import.meta.url)),le=B.module("NotebookPanel"),ts=400;class Te extends m.Component{static handleError(e){Ee.isCanceled(e)||le.error(e)}static unsavedNotebookCount(){return document.querySelectorAll(".".concat(Te.UNSAVED_INDICATOR_CLASS_NAME,".").concat(Te.UNSAVED_STATUS_CLASS_NAME)).length}static languageFromFileName(e){var t=$.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),Ne(this,"pending",void 0),Ne(this,"debouncedSavePanelState",void 0),Ne(this,"debouncedLoad",void 0),Ne(this,"notebook",void 0),Ne(this,"tabTitleElement",void 0),Ne(this,"tabInitOnce",void 0),Ne(this,"editor",void 0),Ne(this,"getSettings",yt((f,v)=>He(He({},f),{},{minimap:{enabled:v}}))),Ne(this,"getOverflowActions",yt((f,v)=>[{title:"Find",icon:uu,action:this.handleFind,group:ee.groups.high,shortcut:ke.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:cs,action:this.handleCopy,group:ee.groups.medium,order:20},{title:"Rename File",icon:hu,action:this.handleShowRename,group:ee.groups.medium,order:30},{title:"Delete File",icon:ys,action:this.handleDelete,group:ee.groups.medium,order:40},{title:"Show Minimap",icon:f?Vn:void 0,action:this.handleMinimapChange,group:ee.groups.low,shortcut:ke.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:v?Vn:void 0,action:this.handleWordWrapChange,group:ee.groups.low,shortcut:ke.NOTEBOOK.WORDWRAP,order:30}])),this.handleCloseCancel=this.handleCloseCancel.bind(this),this.handleCloseDiscard=this.handleCloseDiscard.bind(this),this.handleCloseSave=this.handleCloseSave.bind(this),this.handleCopy=this.handleCopy.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleDeleteConfirm=this.handleDeleteConfirm.bind(this),this.handleDeleteCancel=this.handleDeleteCancel.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleEditorChange=this.handleEditorChange.bind(this),this.handleFind=this.handleFind.bind(this),this.handleMinimapChange=this.handleMinimapChange.bind(this),this.handleWordWrapChange=this.handleWordWrapChange.bind(this),this.handleLinkClick=this.handleLinkClick.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handlePanelDropped=this.handlePanelDropped.bind(this),this.handleRenameFile=this.handleRenameFile.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRunCommand=this.handleRunCommand.bind(this),this.handleRunAll=this.handleRunAll.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.handleSave=this.handleSave.bind(this),this.handleSaveAsCancel=this.handleSaveAsCancel.bind(this),this.handleSaveAsSubmit=this.handleSaveAsSubmit.bind(this),this.handleSaveError=this.handleSaveError.bind(this),this.handleSaveSuccess=this.handleSaveSuccess.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleShowRename=this.handleShowRename.bind(this),this.handleTab=this.handleTab.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabClick=this.handleTabClick.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleTransformLinkUri=this.handleTransformLinkUri.bind(this),this.handleOverwrite=this.handleOverwrite.bind(this),this.handlePreviewPromotion=this.handlePreviewPromotion.bind(this),this.getDropdownOverflowActions=this.getDropdownOverflowActions.bind(this),this.pending=new Mn,this.debouncedSavePanelState=Pn(this.savePanelState.bind(this),ts),this.debouncedLoad=Pn(this.load.bind(this),ts),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;var{isDashboardActive:t,session:r,sessionLanguage:i,panelState:o}=e,a={value:"",language:"",wordWrap:"off"},s=null,{isPreview:l}=e;o!=null&&({fileMetadata:s=s,isPreview:l=l,settings:a=a}=o);var d=s!=null&&$.hasPath(s.itemName),h=d===!0&&a.value!=null||!d&&a.value!=null&&a.value.length>0,c=h?1:0;this.state={error:void 0,isDashboardActive:t,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:c,fileMetadata:s,settings:a,session:r,sessionLanguage:i,panelState:{fileMetadata:s,settings:a},showCloseModal:!1,showDeleteModal:!1,showSaveAsModal:!1,scriptCode:""},le.debug("constructor",e,this.state)}componentDidMount(){var{glContainer:e,glEventHub:t}=this.props,{tab:r}=e;r!=null&&this.initTab(r),this.initNotebookContent(),t.on(de.RENAME_FILE,this.handleRenameFile),t.on(te.DROPPED,this.handlePanelDropped),e.on(de.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion)}componentDidUpdate(e,t){var{isPreview:r,settings:i}=this.state,{wordWrap:o}=i,{defaultNotebookSettings:a}=this.props;r!==t.isPreview&&this.setPreviewStatus(),o!==t.settings.wordWrap&&(this.updateEditorWordWrap(),this.debouncedSavePanelState()),a.isMinimapEnabled!==e.defaultNotebookSettings.isMinimapEnabled&&this.updateEditorMinimap()}componentWillUnmount(){this.debouncedSavePanelState.flush(),this.pending.cancel();var{glEventHub:e,glContainer:t}=this.props,{fileMetadata:r,isPreview:i}=this.state;e.off(de.RENAME_FILE,this.handleRenameFile),e.off(te.DROPPED,this.handlePanelDropped),t.off(de.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion),e.emit(de.UNREGISTER_FILE,r,i)}initTab(e){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(e)}initTabCloseOverride(){var{glContainer:e}=this.props;e.beforeClose(t=>{if(t?.force===!0)return!0;var{changeCount:r,savedChangeCount:i}=this.state;return r!==i?(this.setState({showCloseModal:!0}),!1):!0})}initTabClasses(e){var t=e.element.get(0);k(t);var r=t.querySelector(".lm_title");this.tabTitleElement=r,r?.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){var{changeCount:e,savedChangeCount:t,settings:r}=this.state,{value:i}=r;if(e!==t&&this.notebook){var o=this.notebook.getValue();return o??i}return i}initNotebookContent(){var{fileMetadata:e,settings:t,isPreview:r}=this.state;if(e&&e.id){le.debug("Init content from file"),this.registerFileMetadata(e,r),this.load();return}if(t.value!=null){le.debug("Use content passed in the settings prop"),this.handleLoadSuccess();return}this.handleLoadError(new Error("Missing file metadata"))}closeFileTabById(e){var{glEventHub:t}=this.props;t.emit(de.CLOSE_FILE,{id:e})}registerFileMetadata(e,t){var{glEventHub:r,metadata:i}=this.props,{id:o}=i;r.emit(de.REGISTER_FILE,o,e,t)}renameTab(e,t){var{glEventHub:r}=this.props;r.emit(de.RENAME,e,t)}load(){var{fileMetadata:e,settings:t}=this.state;k(e);var{id:r}=e,{fileStorage:i}=this.props;this.pending.add(i.loadFile(r)).then(o=>{var a;le.debug("Loaded file",o);var{filename:s}=o,{itemName:l}=this.state;if(s!==l){var{metadata:d}=this.props,{id:h}=d;this.renameTab(h,$.getBaseName(s))}var c=He(He({},t),{},{language:(a=Te.languageFromFileName(s))!==null&&a!==void 0?a:""});t.value==null&&(c.value=o.content),t.wordWrap===void 0&&(t.wordWrap="off"),this.setState({fileMetadata:{id:s,itemName:s},settings:c}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){var{fileMetadata:e}=this.state;if(e&&$.hasPath(e.itemName)){var t=this.getNotebookValue();return t!==void 0?(this.saveContent(e.itemName,t),!0):!1}return this.setState({showSaveAsModal:!0}),!1}saveContent(e,t){le.debug("saveContent",e,t),this.updateSavedChangeCount();var{fileStorage:r}=this.props;this.pending.add(r.saveFile({filename:e,content:t,basename:e})).then(this.handleSaveSuccess).catch(this.handleSaveError)}updateSavedChangeCount(){this.setState(e=>{var{changeCount:t}=e;return{savedChangeCount:t}})}setPreviewStatus(){if(this.tabTitleElement){var{isPreview:e}=this.state;le.debug("setPreviewStatus",this.tabTitleElement,e),e?this.tabTitleElement.classList.add("is-preview"):this.tabTitleElement.classList.remove("is-preview")}}handlePreviewPromotion(){this.removePreviewStatus()}savePanelState(){this.setState(e=>{var{changeCount:t,savedChangeCount:r,fileMetadata:i,isPreview:o,settings:a}=e,s=this.getNotebookValue(),l=t!==r?s:void 0,d=He(He({},a),{},{value:s}),h=He(He({},a),{},{value:l}),c={settings:h,fileMetadata:i,isPreview:o};return le.debug("Saving panel state",c),{settings:d,panelState:c}})}handleCloseDiscard(){this.setState({showCloseModal:!1});var{glContainer:e}=this.props;e.close({force:!0})}handleCloseSave(){if(this.setState({showCloseModal:!1}),this.save()){var{glContainer:e}=this.props;e.close({force:!0})}}handleCloseCancel(){this.setState({showCloseModal:!1})}handleOverwrite(e){var{glEventHub:t}=this.props;t.emit(de.CLOSE_FILE,{id:e,itemName:e},{force:!0}),this.focus()}handleCopy(){var e=this;return Ja(function*(){var{fileStorage:t,glEventHub:r,session:i}=e.props,{fileMetadata:o,settings:a}=e.state;k(o);var{language:s}=a,{itemName:l}=o,d=yield $.getUniqueCopyFileName(t,l);le.debug("handleCopy",o,l,d),yield t.copyFile(l,d);var h={id:d,itemName:d},c={value:null,language:s};r.emit(de.SELECT_NOTEBOOK,i,s,c,h,!0)})()}handleDelete(){le.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var e=this;return Ja(function*(){var{fileStorage:t,glContainer:r,glEventHub:i}=e.props,{fileMetadata:o}=e.state;le.debug("handleDeleteConfirm",o?.itemName),e.setState({showDeleteModal:!1}),o&&($.hasPath(o.itemName)&&(yield $.fileExists(t,o.itemName))?(i.emit(de.CLOSE_FILE,o,{force:!0}),t.deleteFile(o.itemName)):r.close({force:!0}))})()}handleDeleteCancel(){this.setState({showDeleteModal:!1})}handleEditorInitialized(e){this.editor=e}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(e){le.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(t=>{var{changeCount:r,savedChangeCount:i}=t,{isUndoing:o,isRedoing:a}=e;return o?{changeCount:r-1,savedChangeCount:i}:!a&&r<i?{changeCount:r+1,savedChangeCount:0}:{changeCount:r+1,savedChangeCount:i}}),this.debouncedSavePanelState()}handleFind(){this.notebook&&this.notebook.toggleFind()}updateEditorMinimap(){if(this.editor){var{defaultNotebookSettings:e}=this.props;this.editor.updateOptions({minimap:{enabled:e.isMinimapEnabled}})}}handleMinimapChange(){var e,{defaultNotebookSettings:t,updateSettings:r}=this.props,i={defaultNotebookSettings:{isMinimapEnabled:!((e=t.isMinimapEnabled)!==null&&e!==void 0&&e)}};r(i)}updateEditorWordWrap(){if(this.editor){var{settings:e}=this.state,{wordWrap:t}=e;this.editor.updateOptions({wordWrap:t})}}handleWordWrapChange(){this.editor&&this.setState(e=>{var{settings:t}=e,r=t.wordWrap==="on"?"off":"on";return{settings:He(He({},t),{},{wordWrap:r})}})}handleLinkClick(e){var{notebooksUrl:t,session:r,sessionLanguage:i}=this.props,{href:o}=e.currentTarget;if(!(!o||!o.startsWith(t))){e.stopPropagation(),e.preventDefault();var a="/".concat(o.substring(t.length)).replace(/%20/g," ");if(a==="/"){le.debug("Ignoring invalid notebook link",a);return}le.debug("Notebook link clicked, opening",a);var{glEventHub:s}=this.props,l={value:null,language:i},d={id:a,itemName:a};s.emit(de.SELECT_NOTEBOOK,r,i,l,d)}}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(e){var t=e;Ee.isCanceled(t)||(Ee.isTimedOut(t)&&(t=new Error("File not found.")),le.error(t),this.setState({error:t,isLoading:!1}))}handleSave(){le.debug("handleSave"),this.save()}handleSaveSuccess(e){var t,{fileStorage:r}=this.props,i={id:e.filename,itemName:e.filename},o=(t=Te.languageFromFileName(e.filename))!==null&&t!==void 0?t:"";this.setState(a=>{var{fileMetadata:s}=a,l=He(He({},a.settings),{},{language:o});return le.debug("handleSaveSuccess",i,s,l),s&&$.hasPath(s.itemName)&&s.itemName!==i.itemName&&(le.debug("handleSaveSuccess deleting old file",s.itemName),r.deleteFile(s.itemName).catch(Te.handleError)),{fileMetadata:i,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(i,!1)}handleSaveError(e){Ee.isCanceled(e)||(this.setState({savedChangeCount:0}),le.error(e))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;r&&this.handleOverwrite(e),le.debug("handleSaveAsSubmit",e);var{fileMetadata:i}=this.state;if(i){var{itemName:o}=i,a=(t=this.getNotebookValue())!==null&&t!==void 0?t:"";if(this.setState({showSaveAsModal:!1}),$.getBaseName(o)!==$.getBaseName(e)){var{metadata:s}=this.props,{id:l}=s;this.renameTab(l,$.getBaseName(e))}this.saveContent(e,a)}}handleRenameFile(e,t,r){var{fileMetadata:i,panelState:o}=this.state,{glContainer:a}=this.props;if(i?.itemName==="/".concat(t)&&r&&JSON.stringify(o)!==JSON.stringify(r)){a.close();return}i&&i.id===e&&(this.setState({fileMetadata:{id:t,itemName:t}}),this.debouncedSavePanelState())}handleResize(){var e;(e=this.notebook)===null||e===void 0||e.updateDimensions()}handleRunCommand(e){this.runCommand(e)}handleRunAll(){var e;if(!this.notebook){le.error("Editor is not initialized.");return}this.runCommand((e=this.notebook.getValue())!==null&&e!==void 0?e:void 0)}handleRunSelected(){if(!this.notebook){le.error("Editor is not initialized.");return}this.runCommand(this.notebook.getSelectedCommand())}handleSessionOpened(e,t){var{language:r}=t;this.setState({session:e,sessionLanguage:r})}handleSessionClosed(){this.setState({session:void 0,sessionLanguage:void 0})}handleShow(){var e;le.debug("handleShow"),(e=this.notebook)===null||e===void 0||e.updateDimensions()}handlePanelDropped(e){var{metadata:{id:t}}=this.props;e===t&&this.forceUpdate()}handleShowRename(){this.setState({showSaveAsModal:!0})}handleTab(e){le.debug("NotebookPanel tab event",e),this.initTab(e)}handleTabFocus(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];le.debug("handleTabFocus",...t);var{glContainer:i}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!i.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){le.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handleTabClick(e){le.debug("handle NotebookPanel tab click"),this.focus(),e.detail===2&&this.removePreviewStatus()}handleTransformLinkUri(e){var{notebooksUrl:t}=this.props,{fileMetadata:r}=this.state;if(e.endsWith("/"))return e;if(e.startsWith("/"))return"".concat(t).concat(e.substring(1));var i=r?.itemName;if(i===void 0)return e;i.charAt(0)==="/"&&(i=i.substring(1));var o=new URL(i,t);return new URL(e,o).href}focus(){requestAnimationFrame(()=>{this.notebook&&this.notebook.focus()})}createNotebook(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{glEventHub:i}=this.props,{session:o,sessionLanguage:a,settings:s}=this.state,l=He(He({},s),{},{language:t,value:r}),d={id:null,itemName:e};le.debug("handleCreateNotebook",o,a,l,d),i.emit(de.CREATE_NOTEBOOK,o,a,l,d)}runCommand(e){if(e===void 0||e===""){le.debug("Ignoring empty command.");return}this.removePreviewStatus();var{glEventHub:t}=this.props;t.emit(it.SEND_COMMAND,e,!1,!0)}removePreviewStatus(){this.setState(e=>{var{isPreview:t}=e;if(t){var{fileMetadata:r}=this.state;return r&&this.registerFileMetadata(r,!1),{isPreview:!1}}return null})}getDropdownOverflowActions(){var e,t,{defaultNotebookSettings:r}=this.props,{settings:i}=this.state;return this.getOverflowActions((e=r.isMinimapEnabled)!==null&&e!==void 0?e:!1,this.getSettings(i,(t=r.isMinimapEnabled)!==null&&t!==void 0?t:!1).wordWrap==="on")}render(){var e,t,r,{fileStorage:i,glContainer:o,glContainer:{tab:a},glEventHub:s,defaultNotebookSettings:l}=this.props,{changeCount:d,savedChangeCount:h,error:c,isDashboardActive:f,isLoaded:v,isLoading:p,isPreview:g,fileMetadata:y,session:P,sessionLanguage:O,settings:_,showCloseModal:R,showDeleteModal:U,showSaveAsModal:Q}=this.state,N=f&&!o.isHidden&&!g,W=(e=y?.itemName)!==null&&e!==void 0?e:Te.DEFAULT_NAME,j=W.endsWith(".md"),Y=y?.id!=null,ne=this.getSettings(_,(t=l.isMinimapEnabled)!==null&&t!==void 0?t:!1),F=P!=null,q=O===ne.language,K=!v||!F||!q,A=!v,V=[{action:this.handleSave,shortcut:Kt.SAVE},{action:this.handleMinimapChange,shortcut:ke.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:ke.NOTEBOOK.WORDWRAP}],z=Ci.getDisabledRunTooltip(F,q,"Notebook extension","Run"),me=Ci.getDisabledRunTooltip(F,q,"Notebook extension","Run Selected"),je=[{title:Y?"Rename":"Save As…",order:10,group:ee.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:ee.groups.high,order:20}],De=a?.element.find(".lm_title_before").get(0);return u.jsxs(u.Fragment,{children:[De!=null&&Hr.createPortal(u.jsx("span",{className:Z(Te.UNSAVED_INDICATOR_CLASS_NAME,{[Te.UNSAVED_STATUS_CLASS_NAME]:d!==h})}),De),u.jsxs(sr,{className:"notebook-container",componentPanel:this,glContainer:o,glEventHub:s,onTab:this.handleTab,onResize:this.handleResize,onShow:this.handleShow,onTabClicked:this.handleTabClick,onTabFocus:this.handleTabFocus,onTabBlur:this.handleTabBlur,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,additionalActions:je,renderTabTooltip:()=>W,children:[!j&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"notebook-toolbar",children:[u.jsxs("span",{children:[u.jsx(se,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:K,icon:u.jsx(ue,{icon:ws,transform:"grow-4"}),tooltip:"Run ".concat(ke.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),z!=null&&u.jsx(qt,{children:z})]}),u.jsxs("span",{children:[u.jsx(se,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:K,icon:u.jsx(ue,{icon:lu,transform:"grow-4"}),tooltip:"Run Selected ".concat(ke.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),me!=null&&u.jsx(qt,{children:me})]}),u.jsx(se,{kind:"ghost",className:"mr-auto",disabled:A,onClick:this.handleSave,icon:du,tooltip:"Save ".concat(Kt.SAVE.getDisplayText()),"aria-label":"Save"}),u.jsx(se,{kind:"ghost",className:"btn-overflow",disabled:A,icon:Ss,tooltip:"More Actions...",onClick:()=>{},children:u.jsx(Gn,{actions:this.getDropdownOverflowActions,popperOptions:Te.POPPER_OPTIONS})})]}),u.jsx(_f,{isLoaded:v,isLoading:p,error:c,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:P,sessionLanguage:O,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:ne,focusOnMount:N,ref:b=>{this.notebook=b}})]}),j&&u.jsx(m.Suspense,{fallback:u.jsx(un,{}),children:u.jsx(CC,{content:(r=ne.value)!==null&&r!==void 0?r:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri})}),u.jsx(hd,{isOpen:Q,type:"file",defaultValue:W,title:Y?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:i}),u.jsx(dn,{isOpen:U,headerText:'Are you sure you want to delete "'.concat(W,'"?'),bodyText:"You cannot undo this action.",onCancel:this.handleDeleteCancel,onConfirm:this.handleDeleteConfirm,confirmButtonText:"Delete"}),u.jsx(dn,{isOpen:R,headerText:"Do you want to save the changes you made to ".concat(W,"?"),bodyText:"Your changes will be lost if you don't save them.",onCancel:this.handleCloseCancel,onDiscard:this.handleCloseDiscard,onConfirm:this.handleCloseSave,discardButtonText:"Discard Changes",confirmButtonText:"Save"}),u.jsx(ee,{actions:V})]})]})}}Ne(Te,"COMPONENT","NotebookPanel");Ne(Te,"POPPER_OPTIONS",{placement:"bottom-end"});Ne(Te,"DEFAULT_NAME","Untitled");Ne(Te,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");Ne(Te,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");Ne(Te,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,defaultNotebookSettings:{isMinimapEnabled:!0}});var SC=(n,e)=>{var t=bl(n),r=Uv(n),i=lr(n,e.localDashboardId),{session:o,config:a}=i??{},{type:s}=a??{};return{fileStorage:t,defaultNotebookSettings:r,session:o,sessionLanguage:s}},wC=Dn(SC,{updateSettings:Zv},null,{forwardRef:!0})(Te);const nn=wC;function ns(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function rs(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ns(Object(t),!0).forEach(function(r){EC(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ns(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function EC(n,e,t){return e=_C(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function _C(n){var e=PC(n,"string");return typeof e=="symbol"?e:String(e)}function PC(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var be=B.module("ConsolePlugin");function is(n){return n.notebook!==void 0}function TC(n){bb(n)}function ow(n){TC(n);var{id:e,hydrateConsole:t,layout:r,panelManager:i,registerComponent:o,notebooksUrl:a}=n,s=m.useRef(0),[l,d]=m.useState(new Map),[h,c]=m.useState(new Map),f=Ai(),v=m.useCallback(()=>i.getLastUsedPanelOfType(ci),[i]),p=m.useCallback((b,w)=>{d(T=>new Map(T.set(b,w)))},[d]),g=m.useCallback(b=>{d(w=>(w.delete(b),new Map(w)))},[d]),y=m.useCallback((b,w)=>{c(T=>new Map(T.set(b,w)))},[c]),P=m.useCallback(b=>{c(w=>(w.delete(b),new Map(w)))},[c]),O=m.useCallback(function(b){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,T=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,G=b&&b.trim();if(!G)be.info("Ignoring empty code");else{var J=v();if(!J||!(J instanceof ci.WrappedComponent)){be.error("Console panel not found");return}be.debug("Send command: ",b,w,T),J.addCommand(b,w,T)}},[v]),_=m.useCallback(b=>{f(vy(e,b))},[f,e]),R=m.useCallback(b=>{var{language:w}=b,T=w==="python"?"py":w,G=null;return T==null?(be.debug("No extension for language",w),G="Untitled-".concat(s.current)):G="Untitled-".concat(s.current,".").concat(T),s.current+=1,G},[]),U=m.useCallback(function(b){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{id:T}=b;if(T!=null&&l.has(T))return l.get(T);if(T!=null&&h.has(T))return h.get(T);if(w)return Mt()},[l,h]),Q=m.useCallback((b,w)=>{x.renameComponent(r.root,{id:b},w)},[r.root]),N=m.useCallback((b,w)=>{be.debug("Rename file panel",b,w);var T;if(l.has(b)&&(T=l.get(b),g(b),T!=null&&p(w,T)),h.has(b)&&(T=h.get(b),P(b),T!=null&&y(w,T)),T===void 0){be.debug2("File ".concat(b," isn't open, no need to rename the tab"));return}Q(T,$.getBaseName(w))},[l,h,Q,p,y,g,P]),W=m.useCallback(b=>{var w=U(b,!1);if(w==null){be.error("Could not find panel id for file metadata",b);return}x.activateTab(r.root,{id:w})},[U,r.root]),j=m.useCallback((b,w,T)=>{if(be.debug("registerFilePanel",b,w,T),w==null||w.id==null){be.debug("Ignore empty file id",w);return}var{id:G}=w;if(T){y(G,b);return}if(l.has(G)){var J=l.get(G);if(b===J){be.debug("Update tab title for file ".concat(G));var{itemName:Qe}=w;N(G,Qe)}else be.error("File ".concat(G," already associated with a different tab ").concat(J));return}p(G,b),h.has(G)&&P(G)},[l,h,N,p,y,P]),Y=m.useCallback((b,w)=>{if(be.debug("unregisterFileTab",b,w),b==null||b.id==null){be.debug("Ignore empty file id",b);return}var{id:T}=b;if(w){P(T);return}g(T)},[g,P]),ne=m.useCallback((b,w)=>{be.debug("closeFilePanel",b);var{id:T}=b,G=null,J=!1;if(l.has(T))G=l.get(T);else if(h.has(T))G=h.get(T),J=!0;else{be.debug("File ".concat(T," isn't open, ignore close event"));return}Y(b,J),x.closeComponent(r.root,{id:G},w)},[r.root,l,h,Y]),F=m.useCallback(b=>{var{itemName:w}=b;return $.getBaseName(w)},[]),q=m.useCallback(b=>{var{id:w}=b;return be.debug("fileIsOpen",b,w,l),w!=null&&l.has(w)},[l]),K=m.useCallback(b=>{var{id:w}=b;return be.debug("fileIsOpenAsPreview",b,w,h),w!=null&&h.has(w)},[h]),A=m.useCallback(b=>{if(b!=null){var w=i.getOpenedPanelById(b);w&&is(w)&&w.focus()}},[i]),V=m.useCallback(b=>{var{id:w,settings:T,fileMetadata:G,session:J,sessionLanguage:Qe,isPreview:I=!1}=b,X={settings:T,fileMetadata:G},re=F(G);return{type:"react-component",component:nn.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:w},session:J,sessionLanguage:Qe,panelState:X,isPreview:I,notebooksUrl:a},title:re,id:w}},[F,e,a]),z=m.useCallback(function(b,w,T){var G=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{id:null,itemName:R(T)},J=U(G);if(q(G)&&J!=null){be.debug("File is already open, focus panel"),W(G),A(J);return}var Qe=x.getStackForComponentTypes(r.root,[nn.COMPONENT]),I=V({id:J,settings:T,fileMetadata:G,session:b,sessionLanguage:w});be.debug("createNotebook",I,l),x.openComponentInStack(Qe,I)},[q,A,R,U,r.root,V,l,W]),me=m.useCallback(function(b,w,T,G){var J=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;be.debug("selectNotebook",G,J);var Qe=q(G),I=K(G),[X]=[...h.values()],re=!J,he=re&&X?X:U(G);if(he==null||he==="")throw new Error("Unable to retrieve or create panelId for metadata",G);if(Qe||I)W(G);else{var _e=x.getStackForComponentTypes(r.root,[nn.COMPONENT]),Qr=V({id:he,settings:T,fileMetadata:G,session:b,sessionLanguage:w,isPreview:re});x.openComponentInStack(_e,Qr)}if(I&&J){var cr=G.id,Jr=x.getStackForConfig(r.root,{component:nn.COMPONENT,id:he}),ei=x.getContentItemInStack(Jr,{component:nn.COMPONENT,id:he});ei&&qe(ei)&&(ei.container.emit(de.PROMOTE_FROM_PREVIEW),P(cr),p(cr,he))}J&&A(he)},[W,q,K,A,U,r.root,V,h,P,p]),je=m.useCallback(function(b,w){var T=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},G=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,J=i.getLastUsedPanelOfType(nn);J&&is(J)?T!=null&&T.value!=null&&J.notebook!=null&&J.notebook.append(T.value):G&&z(b,w,T)},[z,i]),De=m.useCallback((b,w)=>Ob.hydrate(rs(rs({},b),{},{notebooksUrl:a}),w),[a]);return Rn(o,ci,t),Rn(o,Cy),Rn(o,cC),Rn(o,pC),Rn(o,nn,De),Me(r.eventHub,it.SEND_COMMAND,O),Me(r.eventHub,it.SETTINGS_CHANGED,_),Me(r.eventHub,de.CLOSE_FILE,ne),Me(r.eventHub,de.CREATE_NOTEBOOK,z),Me(r.eventHub,de.SELECT_NOTEBOOK,me),Me(r.eventHub,de.RENAME,Q),Me(r.eventHub,de.RENAME_FILE,N),Me(r.eventHub,de.SEND_TO_NOTEBOOK,je),Me(r.eventHub,de.REGISTER_FILE,j),Me(r.eventHub,de.UNREGISTER_FILE,Y),null}function Yr(n,e,t){return e=OC(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function OC(n){var e=IC(n,"string");return typeof e=="symbol"?e:String(e)}function IC(n,e){if(typeof n!="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class hr{}Yr(hr,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");Yr(hr,"INPUT_FILTER","ControlType.INPUT_FILTER");Yr(hr,"MARKDOWN","ControlType.MARKDOWN");Yr(hr,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");const aw=hr;export{pS as $,vS as A,se as B,Rh as C,Os as D,gS as E,fl as F,Kt as G,Rs as H,Ct as I,$C as J,D as K,aw as L,jS as M,Gn as N,Yn as O,Ee as P,Zt as Q,Gr as R,_c as S,E as T,Ic as U,ji as V,_S as W,nd as X,FS as Y,Yt as Z,Xv as _,Ce as a,Ds as a$,Rb as a0,Ae as a1,Vv as a2,zS as a3,lr as a4,rS as a5,yl as a6,Ob as a7,pu as a8,Ps as a9,Wu as aA,tr as aB,Gu as aC,Ls as aD,As as aE,Vu as aF,Uu as aG,It as aH,Ye as aI,_n as aJ,Fh as aK,tc as aL,dc as aM,oc as aN,L as aO,js as aP,Br as aQ,jC as aR,uc as aS,fh as aT,ks as aU,Tc as aV,Xs as aW,qs as aX,BC as aY,WC as aZ,UC as a_,RS as aa,de as ab,Fa as ac,te as ad,kS as ae,nn as af,Oc as ag,NC as ah,Ri as ai,ow as aj,ee as ak,dn as al,rw as am,PS as an,yS as ao,TS as ap,wS as aq,ES as ar,GS as as,qS as at,bS as au,SS as av,xl as aw,CS as ax,Xe as ay,RC as az,dt as b,Ty as b$,Kf as b0,Gf as b1,we as b2,ev as b3,mv as b4,iv as b5,We as b6,VC as b7,cl as b8,fv as b9,wb as bA,qi as bB,Jl as bC,bb as bD,Tb as bE,Zl as bF,NS as bG,AS as bH,td as bI,Yl as bJ,pb as bK,kr as bL,Ab as bM,DS as bN,MS as bO,Xi as bP,ur as bQ,Sy as bR,Dy as bS,nw as bT,Oy as bU,Py as bV,Ey as bW,wy as bX,ew as bY,_y as bZ,tw as b_,ml as ba,GC as bb,ZC as bc,KC as bd,zC as be,qC as bf,lv as bg,YC as bh,QC as bi,vv as bj,gv as bk,eS as bl,JC as bm,vl as bn,tS as bo,Mv as bp,Pv as bq,Nv as br,LC as bs,x as bt,Rn as bu,Me as bv,Ib as bw,LS as bx,Gb as by,Mb as bz,C as c,dd as c0,Ra as c1,fi as c2,Rp as c3,gb as c4,$ as c5,Zi as c6,iw as c7,ci as c8,pC as c9,yf as cA,ti as cB,kC as cC,FC as cD,Zs as cE,XC as cF,Kn as cG,Cy as ca,cC as cb,Is as cc,AC as cd,sr as ce,xs as cf,YS as cg,Mn as ch,WS as ci,US as cj,VS as ck,BS as cl,sd as cm,Ue as cn,$S as co,JS as cp,HS as cq,ht as cr,ld as cs,XS as ct,ZS as cu,QS as cv,it as cw,wr as cx,KS as cy,vy as cz,Ns as d,Zv as e,aS as f,oS as g,sS as h,nS as i,dS as j,uS as k,hS as l,cS as m,mS as n,Wv as o,iS as p,ge as q,ce as r,qt as s,Ze as t,Pc as u,fS as v,OS as w,HC as x,lS as y,xS as z};
|
|
22
|
+
//# sourceMappingURL=ControlType-7a96d66b.js.map
|