@deephaven/embed-widget 0.74.1-beta.5 → 0.74.1-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/build/assets/{App-6aab1fda.js → App-2d359f77.js} +2 -2
  2. package/build/assets/{App-6aab1fda.js.map → App-2d359f77.js.map} +1 -1
  3. package/build/assets/{Chart-6cb1d950.js → Chart-5712993f.js} +2 -2
  4. package/build/assets/{Chart-6cb1d950.js.map → Chart-5712993f.js.map} +1 -1
  5. package/build/assets/{DashboardConstants-02ead187.js → DashboardConstants-666eb926.js} +2 -2
  6. package/build/assets/{DashboardConstants-02ead187.js.map → DashboardConstants-666eb926.js.map} +1 -1
  7. package/build/assets/{IrisGrid-8d7079ea.js → IrisGrid-28d555c9.js} +2 -2
  8. package/build/assets/{IrisGrid-8d7079ea.js.map → IrisGrid-28d555c9.js.map} +1 -1
  9. package/build/assets/IrisGridThemeProvider-4eb12e68.js +11 -0
  10. package/build/assets/{IrisGridThemeProvider-d610d222.js.map → IrisGridThemeProvider-4eb12e68.js.map} +1 -1
  11. package/build/assets/{MarkdownEditor-2603f709.js → MarkdownEditor-5b3b8cfb.js} +2 -2
  12. package/build/assets/{MarkdownEditor-2603f709.js.map → MarkdownEditor-5b3b8cfb.js.map} +1 -1
  13. package/build/assets/{MarkdownNotebook-ddbf0507.js → MarkdownNotebook-1a8cddc0.js} +2 -2
  14. package/build/assets/{MarkdownNotebook-ddbf0507.js.map → MarkdownNotebook-1a8cddc0.js.map} +1 -1
  15. package/build/assets/{index-c6fa40da.js → index-4acee94a.js} +5 -5
  16. package/build/assets/{index-c6fa40da.js.map → index-4acee94a.js.map} +1 -1
  17. package/build/assets/{index-4af57556.js → index-635efb82.js} +2 -2
  18. package/build/assets/{index-4af57556.js.map → index-635efb82.js.map} +1 -1
  19. package/build/assets/index-86d16d8e.css +1 -0
  20. package/build/assets/index-b5c087a9.js +4 -0
  21. package/build/assets/index-b5c087a9.js.map +1 -0
  22. package/build/assets/{useUser-ca3ca5d7.js → useUser-d12ae607.js} +2 -2
  23. package/build/assets/{useUser-ca3ca5d7.js.map → useUser-d12ae607.js.map} +1 -1
  24. package/build/index.html +1 -1
  25. package/package.json +18 -18
  26. package/build/assets/IrisGridThemeProvider-d610d222.js +0 -11
  27. package/build/assets/index-45f97a6f.js +0 -4
  28. package/build/assets/index-45f97a6f.js.map +0 -1
  29. package/build/assets/index-aef304e2.css +0 -1
@@ -1,2 +1,2 @@
1
- import{aF as Cn,aG as Pn,aH as Sn,g as In,L as Ce,n as Mn,A as En,a1 as Dn,h as pt,a as xn,aI as On}from"./index-4af57556.js";import{bn as et,r as S,M as z,I as b,K as Oe,L as Ue,bp as m,Q as ke,R as Tn,bq as gt,br as An,ab as C,N as Ln,O as jn}from"./vendor-e3051ace.js";function _t(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function de(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_t(Object(t),!0).forEach(function(n){Rn(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):_t(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Rn(i,e,t){return e=$n(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function $n(i){var e=Nn(i,"string");return typeof e=="symbol"?e:String(e)}function Nn(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Ho=i=>({type:Cn,payload:i}),Fn=i=>({type:Sn,payload:i}),Wn=i=>(e,t)=>{e(Fn(i));var{storage:n}=t(),{workspaceStorage:r}=n;return r==null?void 0:r.save(i)},Bn=i=>(e,t)=>{var{workspace:n}=t(),{data:r}=n??{},o=de(de({},n),{},{data:de(de(de({},r),i),{},{settings:de(de({},r==null?void 0:r.settings),i.settings)})});return e(Wn(o))},zo=i=>e=>e(Bn({settings:i})),ko=i=>({type:Pn,payload:i});function bt(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function yt(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bt(Object(t),!0).forEach(function(n){Hn(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):bt(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Hn(i,e,t){return e=zn(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function zn(i){var e=kn(i,"string");return typeof e=="symbol"?e:String(e)}function kn(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function Kn(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,r=arguments.length>1?arguments[1]:void 0;switch(r.type){case i:{var{id:o,payload:s}=r;return t&&et({payload:s},{payload:n[o]})?n:yt(yt({},n),{},{[o]:s})}default:return n}}}var Ko=Object.freeze([]),Uo=new Map,Go=()=>{};function Yo(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return e.filter(n=>n!=null)}function Un(i,e,t){return e=Gn(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Gn(i){var e=Yn(i,"string");return typeof e=="symbol"?e:String(e)}function Yn(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Vn extends Error{constructor(){super(...arguments),Un(this,"isCanceled",!0)}}const wt=Vn;function Xn(i,e,t){return e=qn(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function qn(i){var e=Zn(i,"string");return typeof e=="symbol"?e:String(e)}function Zn(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Jn extends Error{constructor(){super(...arguments),Xn(this,"isTimeout",!0)}}const Qn=Jn;class Ct{static makeCancelable(e,t){var n=!1,r,o,s=new Promise((a,l)=>{o=l,Promise.resolve(e).then(h=>{n?t&&t(h):(r=h,a(h))}).catch(h=>l(h))});return s.cancel=()=>{n=!0,o(new wt),r!=null&&t&&t(r)},s}static isCanceled(e){return e instanceof wt}static isTimedOut(e){return e instanceof Qn}static withTimeout(e,t){return new Promise((n,r)=>{setTimeout(()=>{try{n(t())}catch(o){r(o)}},e)})}}function Ht(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"No value available in context. Was code wrapped in a provider?",t=S.useContext(i);if(t==null)throw new Error(e);return t}function ei(i){var e=S.useRef();return S.useEffect(function(){e.current=i}),e.current}function ti(i,e,t){return e=ni(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ni(i){var e=ii(i,"string");return typeof e=="symbol"?e:String(e)}function ii(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function Vo(i){return i.then!==void 0}class le{static disableAllActions(){le.actionsDisabled=!0}static enableAllActions(){le.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){if(e.group!==t.group){var n,r;return((n=e.group)!==null&&n!==void 0?n:0)>((r=t.group)!==null&&r!==void 0?r:0)?1:-1}if(e.order!==t.order){var o,s;return((o=e.order)!==null&&o!==void 0?o:0)>((s=t.order)!==null&&s!==void 0?s:0)?1:-1}if(e.title!==t.title){var a,l;return((a=e.title)!==null&&a!==void 0?a:"")>((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(le.compareActions),t}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return le.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){var t=le.getModifierKey();return e[t]}static getMenuItems(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=[],r=e;Array.isArray(r)||(r=[r]);for(var o=0;o<r.length;o+=1){var s=r[o],a=void 0;typeof s=="function"?a=s():a=s,a!=null&&(a instanceof Promise?t&&n.push(a):Array.isArray(a)?n=n.concat(a):n.push(a))}return n=n.filter(l=>l.title!==void 0||l.then!=null||l.menuElement),n}static getNextMenuItem(e,t,n){var r=e;r<0&&t<0&&(r=n.length);for(var o=1;o<n.length+1;o+=1){var s=(r+t*o+n.length)%n.length,a=n[s];if(!(a instanceof Promise)&&a.disabled!==!0)return s}return e}}ti(le,"actionsDisabled",!1);const ue=le;var at=z.forwardRef((i,e)=>{var t,n;function r(j){var{menuItem:R,onMenuItemClick:$}=i;$(R,j)}function o(j){var{menuItem:R,onMenuItemMouseMove:$}=i;$(R,j)}function s(j){var{menuItem:R,onMenuItemContextMenu:$}=i;$(R,j)}function a(j,R,$){if(typeof j.type=="string")return j;var{closeMenu:he,menuItem:B,isKeyboardSelected:ne,isMouseSelected:X,"data-testid":ie}=i,q={menuItem:B,closeMenu:he,isKeyboardSelected:ne,isMouseSelected:X,iconElement:R,displayShortcut:$,"data-testid":ie};return z.cloneElement(j,{forwardedProps:q})}var{children:l,menuItem:h,isKeyboardSelected:d=!1,isMouseSelected:u=!1,"data-testid":f}=i,v=(t=h.shortcutText)!==null&&t!==void 0?t:(n=h.shortcut)===null||n===void 0?void 0:n.getDisplayText(),c=null;if(h.icon){var g=h.icon;if(z.isValidElement(g))c=g;else{var x;h.iconColor!=null&&(h.disabled===void 0||!h.disabled)&&(x={color:h.iconColor}),c=b.jsx(Ue,{icon:g,style:x})}}var E=null,T=!!l;h.actions&&(E=b.jsx(Ue,{icon:In}));var P=null;if(h.menuElement)P=b.jsx("div",{className:"custom-menu-item",onMouseMove:o,children:a(h.menuElement,c,v)});else{var G,N=h.disabled,Z=h.iconOutline;P=b.jsx("button",{type:"button",className:Oe("btn-context-menu",{disabled:N},{active:(T||u)&&(N===void 0||!N)},{"keyboard-active":d&&(N===void 0||!N)}),onClick:r,onMouseMove:o,onContextMenu:s,title:(G=h.description)!==null&&G!==void 0?G:"",children:b.jsxs("div",{className:"btn-context-menu-wrapper",children:[b.jsx("span",{className:Oe("icon",{outline:Z}),children:c}),b.jsx("span",{className:"title",children:h.title}),v!==void 0&&b.jsx("span",{className:"shortcut",children:v}),E&&b.jsx("span",{className:Oe("submenu-indicator",{disabled:N}),children:E})]})})}return b.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":f,children:[l,P]})});at.displayName="ContextMenuItem";at.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const ri=at;function Pt(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function oi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Pt(Object(t),!0).forEach(function(n){se(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Pt(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function se(i,e,t){return e=si(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function si(i){var e=ai(i,"string");return typeof e=="symbol"?e:String(e)}function ai(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var St=Ce.module("ContextMenu");class Te extends S.PureComponent{static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),se(this,"container",void 0),se(this,"oldFocus",void 0),se(this,"activeSubMenuRef",void 0),se(this,"subMenuTimer",void 0),se(this,"rAF",void 0),se(this,"initialPosition",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleCloseSubMenu=this.handleCloseSubMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemContextMenu=this.handleMenuItemContextMenu.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.container=z.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=z.createRef(),this.subMenuTimer=0,this.rAF=0,this.initialPosition={top:e.top,left:e.left},this.state={menuItems:[],pendingItems:[],activeSubMenu:null,hasOverflow:!1,subMenuTop:null,subMenuLeft:null,subMenuParentWidth:0,subMenuParentHeight:0,keyboardIndex:-1,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.verifyPosition(),window.addEventListener("resize",this.handleWindowResize),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,t){var{actions:n}=this.props,{activeSubMenu:r}=this.state;if(r!==t.activeSubMenu)if(r==null){var o;(o=this.container.current)===null||o===void 0||o.focus()}else this.setActiveSubMenuPosition();if(e.actions!==n&&(this.initMenu(),this.container.current==null||!this.container.current.contains(document.activeElement))){var s;(s=this.container.current)===null||s===void 0||s.focus()}this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),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(){this.cancelPromises(),cancelAnimationFrame(this.rAF);var{options:e}=this.props,t=e.initialKeyboardIndex;t===void 0&&(t=-1);for(var{actions:n}=this.props,r=ue.getMenuItems(n),o=[],s=r.length-1;s>=0;s-=1){var a=r[s];a instanceof Promise?this.initMenuPromise(a):o.push(a)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:ue.sortActions(o)})}initMenuPromise(e){var t=Ct.makeCancelable(e);this.setState(n=>({pendingItems:n.pendingItems.concat(t)})),t.then(n=>{this.setState(r=>{var o=r.pendingItems.indexOf(t);if(o>=0){var s=r.pendingItems.slice();return s.splice(o,1),{menuItems:ue.sortActions(r.menuItems.concat(n)),pendingItems:s}}return null})},n=>{Ct.isCanceled(n)||(this.setState(r=>{var o=r.pendingItems.indexOf(t);if(o>=0){var s=r.pendingItems.slice();return s.splice(o,1),{pendingItems:s}}return null}),St.error(n))})}cancelPromises(){var{pendingItems:e}=this.state;e.map(t=>t.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current!==null){var e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}}verifyPosition(){var e,t,n,r,{options:o,updatePosition:s,subMenuParentWidth:a,subMenuParentHeight:l,top:h,left:d}=this.props;if(!(!this.container.current||o.doNotVerifyPosition!=null&&o.doNotVerifyPosition)){var{top:u,left:f}=this.initialPosition,{width:v,height:c}=(e=(t=this.container.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:{width:0,height:0},g=((n=(r=this.container.current)===null||r===void 0?void 0:r.scrollHeight)!==null&&n!==void 0?n:0)>window.innerHeight;c===0||v===0||(u+c>window.innerHeight&&(u-c-l>0?u-=c-l:u=window.innerHeight-c),f+v>window.innerWidth&&(f=f-v-a),(d!==f||h!==u)&&(this.setState({hasOverflow:g}),s(u,f)))}}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){St.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){for(var t=e.relatedTarget,n=!1;t&&!n;)n=t.hasAttribute("data-dh-context-menu"),t=t.parentElement;n||this.closeMenu(!0)}}isEscapeKey(e){var{left:t}=this.props;return e==="Escape"||t<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){var{menuItems:t}=this.state,n=this.getKeyboardIndex(),r=n,o=!1;if(e.key==="Enter"||e.key===" "){n>=0&&n<t.length&&this.handleMenuItemClick(t[n],e);return}if(e.key==="ArrowRight"?n>=0&&n<=t.length?o=!0:r=0:this.isEscapeKey(e.key)?r=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?r=ue.getNextMenuItem(r,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(r=ue.getNextMenuItem(r,1,t)),o){this.openSubMenu(n),e.preventDefault(),e.stopPropagation();return}n!==r&&(r!==null?this.setKeyboardIndex(r):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){var{menuItems:t,activeSubMenu:n}=this.state,r=t[e].actions?e:null;n!==r&&this.setState({activeSubMenu:r,subMenuTop:null,subMenuLeft:null})}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{closeMenu:t,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),n(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation();var{menuItems:n}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(n.indexOf(e)):e.action!=null&&(e.action(t.nativeEvent),this.closeMenu(!0)))}handleMenuItemContextMenu(e,t){t.metaKey||this.handleMenuItemClick(e,t)}handleMenuItemMouseMove(e){var{menuItems:t}=this.state,n=t.indexOf(e);this.setMouseIndex(n),n>=0&&n<t.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{top:t,left:n}=this.props,{activeSubMenu:r,hasOverflow:o,keyboardIndex:s,menuItems:a,mouseIndex:l,pendingItems:h,subMenuTop:d,subMenuLeft:u,subMenuParentWidth:f,subMenuParentHeight:v}=this.state,c=0;c<a.length;c+=1){var g=a[c];c>0&&g.group!==a[c-1].group&&e.push(b.jsx("hr",{},"".concat(c,".separator")));var x=b.jsx(ri,{ref:r===c?this.activeSubMenuRef:null,isKeyboardSelected:s===c,isMouseSelected:l===c,menuItem:g,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},c);e.push(x)}var E=null;h.length>0&&(E=b.jsx("div",{className:"loading",children:b.jsx(Mn,{className:"loading-spinner-vertical-align"})}));var{menuStyle:T,"data-testid":P}=this.props,G=r!==null&&d!==null&&u!==null;return b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:Oe({"has-overflow":o},"context-menu-container"),style:oi({top:t,left:n},T),ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:Te.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":P,children:[e,E]}),G&&r!==null&&d!==null&&u!==null&&b.jsx(Te,{actions:a[r].actions||[],closeMenu:this.handleCloseSubMenu,top:d,left:u,updatePosition:(N,Z)=>{this.setState({subMenuTop:N,subMenuLeft:Z})},subMenuParentWidth:f,subMenuParentHeight:v},"sub-".concat(r))]})}}se(Te,"defaultProps",{subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});const li=Te;function It(i,e,t){return e=hi(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function hi(i){var e=di(i,"string");return typeof e=="symbol"?e:String(e)}function di(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class ui extends S.Component{constructor(e){super(e),It(this,"container",void 0),It(this,"openMenu",void 0),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=z.createRef(),this.openMenu=z.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(e){if(this.container.current){var t=this.container.current.getBoundingClientRect(),n=e.clientY-t.top,r=e.clientX-t.left,{actions:o}=this.state;if(o!=null&&e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{var a=document.elementFromPoint(r,n),l=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});a==null||a.dispatchEvent(l)});return}if(ue.isContextActionEvent(e)&&!(e.metaKey||e.ctrlKey)){var s=ue.getMenuItems(e.contextActions);s.length!==0&&(e.preventDefault(),this.setState({actions:s,top:n,left:r}))}}}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){var e=null,{"data-testid":t}=this.props,{actions:n,top:r,left:o}=this.state;return n&&(e=b.jsx(li,{ref:this.openMenu,actions:n,onMenuClosed:this.handleMenuClose,top:r,left:o,updatePosition:(s,a)=>{this.setState({top:s,left:a})},"data-testid":t})),b.jsx("div",{className:Oe("context-menu-root",{active:n}),ref:this.container,children:e})}}const Xo=ui;function zt(i){return typeof i=="object"&&i!=null&&typeof i.type=="string"&&i.name!=null}function kt(i){return typeof i=="object"&&i!=null&&typeof i.type=="string"&&i.id!=null}function qo(i){return zt(i)||kt(i)}var ci=S.createContext(null);function Zo(i){if(kt(i))return{id:i.id,type:i.type};if(zt(i)){var e;return{name:(e=i.name)!==null&&e!==void 0?e:"",type:i.type}}throw new Error("Invalid descriptor: ".concat(i))}function Jo(i){var e,t;return{type:(e=i.type)!==null&&e!==void 0?e:"",name:(t=i.title)!==null&&t!==void 0?t:i.name,id:i.id}}function Qo(){return Ht(ci,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}var mi=S.createContext(null),Le=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin"});function fi(i){return"DashboardPlugin"in i}function vi(i){return"AuthPlugin"in i}function pi(i){return"TablePlugin"in i}function es(i){return fi(i)||vi(i)||pi(i)}function gi(i){return"type"in i&&i.type===Le.DASHBOARD_PLUGIN}function lt(i){return"type"in i&&i.type===Le.WIDGET_PLUGIN}function _i(i){return"type"in i&&i.type===Le.TABLE_PLUGIN}function bi(i){return"type"in i&&i.type===Le.AUTH_PLUGIN}function Kt(i){return"type"in i&&i.type===Le.THEME_PLUGIN}function ts(i){return gi(i)||bi(i)||_i(i)||Kt(i)||lt(i)}var yi=Ce.module("@deephaven/plugin.PluginUtils");function ns(i,e){return i==null||!lt(i)?!1:[i.supportedTypes].flat().some(t=>t===e)}function is(i){var e=b.jsx(Ue,{icon:Dn});if(!lt(i))return e;var{icon:t}=i;return t==null?e:S.isValidElement(t)?t:b.jsx(Ue,{icon:t})}function rs(i){var e=[...i.entries()].filter(t=>Kt(t[1]));return yi.debug("Getting theme data from plugins",e),e.map(t=>{var[n,r]=t,o=Array.isArray(r.themes)?r.themes:[r.themes];return o.map(s=>{var{name:a,baseTheme:l,styleContent:h}=s;return{baseThemeKey:"default-".concat(l??"dark"),themeKey:En(n,a),name:a,styleContent:h}})}).flat()}function os(){return Ht(mi,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}var Ut=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 Gt(i){return i.componentName!==void 0}function wi(i){return i.component!==void 0}var Yt=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const Ci=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:Ut,isGLComponentConfig:Gt,isReactComponentConfig:wi,itemDefaultConfig:Yt},Symbol.toStringTag,{value:"Module"}));function Ke(i,e,t){return e=Pi(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Pi(i){var e=Si(i,"string");return typeof e=="symbol"?e:String(e)}function Si(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Ae{constructor(){Ke(this,"_mSubscriptions",void 0),Ke(this,"off",this.unbind),Ke(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[Ae.ALL_EVENT]=[]}on(e,t,n){if(typeof t!="function")throw new Error("Tried to listen to event "+e+" with non-function callback "+t);this._mSubscriptions[e]||(this._mSubscriptions[e]=[]),this._mSubscriptions[e].push({fn:t,ctx:n})}emit(e){for(var t=this._mSubscriptions[e],n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];if(t)for(var s=0;s<t.length;s++){var a=t[s].ctx||{};try{t[s].fn.apply(a,r)}catch(u){console.error("Error while emitting event:",u)}}r.unshift(e);for(var l=this._mSubscriptions[Ae.ALL_EVENT],h=0;h<l.length;h++){var d=l[h].ctx||{};try{l[h].fn.apply(d,r)}catch(u){console.error("Error while emitting event to allEventSubs:",u)}}}unbind(e,t,n){if(!this._mSubscriptions[e])throw new Error("No subscriptions to unsubscribe for event "+e);for(var r=!1,o=0;o<this._mSubscriptions[e].length;o++)(!t||this._mSubscriptions[e][o].fn===t)&&(!n||n===this._mSubscriptions[e][o].ctx)&&(this._mSubscriptions[e].splice(o,1),r=!0);if(r===!1)throw new Error("Nothing to unbind for "+e)}}Ke(Ae,"ALL_EVENT","__all");const V=Ae;function Y(i,e,t){return e=Ii(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ii(i){var e=Mi(i,"string");return typeof e=="symbol"?e:String(e)}function Mi(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class tt extends V{constructor(e,t,n){super(),Y(this,"width",void 0),Y(this,"height",void 0),Y(this,"title",void 0),Y(this,"parent",void 0),Y(this,"layoutManager",void 0),Y(this,"tab",void 0),Y(this,"_config",void 0),Y(this,"isHidden",!1),Y(this,"beforeCloseHandler",void 0),Y(this,"_element",m(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),Y(this,"_contentElement",void 0),this.title=Gt(e)?e.componentName:"",this.parent=t,this.layoutManager=n,this._config=e,this._contentElement=this._element.find(".lm_content"),this.beforeCloseHandler=null}getElement(){return this._contentElement}hide(){this.emit("hide"),this.isHidden=!0,this._element.hide()}show(){this.emit("show"),this.isHidden=!1,this._element.show(),(this.height!=0||this.width!=0)&&this.emit("shown")}setSize(e,t){for(var n,r,o,s=this.parent,a=null;s&&!s.isColumn&&!s.isRow;){var l;if(a=s,s=s.parent,(l=s)!==null&&l!==void 0&&l.isRoot)return!1}if(!s||!a)return!1;for(var h=s.isColumn?"height":"width",d=h==="height"?t:e,u=((n=this[h])!==null&&n!==void 0?n:0)*(1/(((r=a.config[h])!==null&&r!==void 0?r:0)/100)),f=d/u*100,v=(((o=a.config[h])!==null&&o!==void 0?o:0)-f)/(s.contentItems.length-1),c=0;c<s.contentItems.length;c++)if(s.contentItems[c]===a)s.contentItems[c].config[h]=f;else{var g;s.contentItems[c].config[h]=((g=s.contentItems[c].config[h])!==null&&g!==void 0?g:0)+v}return s.callDownwards("setSize"),!0}close(e){var t,n;this._config.isClosable&&(!((t=(n=this.beforeCloseHandler)===null||n===void 0?void 0:n.call(this,e))!==null&&t!==void 0)||t)&&(this.emit("close"),this.parent.close())}beforeClose(e){this.beforeCloseHandler=e}getState(){return this._config.componentState}getConfig(){return this._config}extendState(e){this.setState(m.extend(!0,this.getState(),e))}setState(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")}setTitle(e){this.parent.setTitle(e)}_$setSize(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(e!==this.width||t!==this.height){this.width=e,this.height=t;var n=this._contentElement[0],r=n.offsetWidth-n.clientWidth,o=n.offsetHeight-n.clientHeight;this._contentElement.width(this.width-r).height(this.height-o),this.emit("resize")}}}const Ei=Object.freeze(Object.defineProperty({__proto__:null,Container:tt,ItemContainer:tt},Symbol.toStringTag,{value:"Module"}));function Vt(i){var e=location.hash.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null}function Xt(i){if(window.location.hash)return Vt(i);if(!window.location.search)return null;var e=window.location.search.substr(1).split("&"),t={},n,r;for(r=0;r<e.length;r++)n=e[r].split("="),t[n[0]]=n[1];return t[i]||null}function ht(i){return window.requestAnimationFrame(i)}function Di(i,e){var t=e.indexOf(i);if(t===-1)throw new Error("Can't remove item from array. Item is not in the array");e.splice(t,1)}function Ge(){return ke()}function xi(i,e){var t=i.replace(/javascript/gi,"j&#97;vascript").replace(/expression/gi,"expr&#101;ssion").replace(/onload/gi,"onlo&#97;d").replace(/script/gi,"&#115;cript").replace(/onerror/gi,"on&#101;rror");return e===!0?t:t.replace(/>/g,"&gt;").replace(/</g,"&lt;")}function dt(i){return m.trim(i.replace(/(<([^>]+)>)/gi,""))}function H(i,e,t){return e=Oi(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Oi(i){var e=Ti(i,"string");return typeof e=="symbol"?e:String(e)}function Ti(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Ai extends V{constructor(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super(),H(this,"_eElement",void 0),H(this,"_oDocument",void 0),H(this,"_eBody",void 0),H(this,"_destroyAfterMouseUp",void 0),H(this,"_nDelay",400),H(this,"_timeout",void 0),H(this,"timeout",void 0),H(this,"_nDistance",10),H(this,"_nX",0),H(this,"_nY",0),H(this,"_nOriginalX",0),H(this,"_nOriginalY",0),H(this,"_bDragging",!1),this._eElement=e,this._oDocument=m(document),this._eBody=m(document.body),this._destroyAfterMouseUp=n,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this._startDrag=this._startDrag.bind(this),(t=this._eElement)===null||t===void 0||t.on("mousedown",this.onMouseDown)}destroy(){var e,t;(e=this._eElement)===null||e===void 0||e.unbind("mousedown",this.onMouseDown),(t=this._oDocument)===null||t===void 0||t.unbind("mouseup",this.onMouseUp),this._eElement=void 0,this._oDocument=void 0,this._eBody=void 0,clearTimeout(this._timeout),this._timeout=void 0}onMouseDown(e){if(e.preventDefault(),e.button===0){var t,n,r,o,s=this._getCoordinates(e);this._nOriginalX=(t=s.x)!==null&&t!==void 0?t:0,this._nOriginalY=(n=s.y)!==null&&n!==void 0?n:0,(r=this._oDocument)===null||r===void 0||r.on("mousemove",this.onMouseMove),(o=this._oDocument)===null||o===void 0||o.on("mouseup",this.onMouseUp),this._timeout=window.setTimeout(this._startDrag,this._nDelay)}}onMouseMove(e){if(this._timeout!=null){var t,n;e.preventDefault();var r=this._getCoordinates(e);this._nX=((t=r.x)!==null&&t!==void 0?t:0)-this._nOriginalX,this._nY=((n=r.y)!==null&&n!==void 0?n:0)-this._nOriginalY,this._bDragging===!1&&(Math.abs(this._nX)>this._nDistance||Math.abs(this._nY)>this._nDistance)&&this._startDrag(),this._bDragging&&this.emit("drag",this._nX,this._nY,e)}}onMouseUp(e){if(this._timeout!=null){var t,n,r,o,s;if(clearTimeout(this._timeout),(t=this._oDocument)===null||t===void 0||t.unbind("mousemove",this.onMouseMove),(n=this._oDocument)===null||n===void 0||n.unbind("mouseup",this.onMouseUp),(r=this._oDocument)===null||r===void 0||(o=r.find("iframe"))===null||o===void 0||o.css("pointer-events",""),this._bDragging===!0&&(this._bDragging=!1,this.emit("dragStop",e,this._nOriginalX+this._nX)),(s=this._eBody)===null||s===void 0||s.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var a;(a=this._eElement)===null||a===void 0||a.removeClass("lm_dragging")}this._destroyAfterMouseUp&&this.destroy()}}_startDrag(){var e,t,n,r;window.clearTimeout(this._timeout),this._bDragging=!0,(e=this._eBody)===null||e===void 0||e.addClass("lm_dragging"),(t=this._eElement)===null||t===void 0||t.addClass("lm_dragging"),(n=this._oDocument)===null||n===void 0||(r=n.find("iframe"))===null||r===void 0||r.css("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)}_getCoordinates(e){var t,n;return{x:(t=e.pageX)!==null&&t!==void 0?t:0,y:(n=e.pageY)!==null&&n!==void 0?n:0}}}const je=Ai;function ge(i,e,t){return e=Li(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Li(i){var e=ji(i,"string");return typeof e=="symbol"?e:String(e)}function ji(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class qt{constructor(e,t){ge(this,"_container",void 0),ge(this,"_reactComponent",null),ge(this,"_portalComponent",null),ge(this,"_originalComponentWillUpdate",null),ge(this,"_initialState",void 0),ge(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=Tn.createPortal(this._getReactComponent(),this._container.getElement()[0],e),this._container.layoutManager.addReactChild(e,this._portalComponent)}_gotReactComponent(e){if(e){this._reactComponent=e,this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate||function(){},this._reactComponent.componentWillUpdate=this._onUpdate.bind(this);var t=this._container.getState();t&&this._reactComponent.setState(t)}}_destroy(){this._container.layoutManager.removeReactChild(this._key(),this._portalComponent),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)}_onUpdate(e,t){var n;this._container.setState(t),(n=this._originalComponentWillUpdate)===null||n===void 0||n.call(this._reactComponent,e,t)}_getReactClass(){var e=this._container._config.component;if(!e)throw new Error("No react component name. type: react-component needs a field `component`");var t=this._container.layoutManager.getComponent(e)||this._container.layoutManager.getFallbackComponent();if(!t)throw new Error('React component "'+e+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return t}_getReactComponent(){var e={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},t=m.extend(e,this._container._config.props);return z.createElement(this._reactClass,t)}}var Ye=["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"],Ri=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function ut(i){if(Ye.length>36)throw new Error("Too many keys in config minifier map");var e={};return ct(i,e,"_min"),e}function nt(i){if(Ye.length>36)throw new Error("Too many keys in config minifier map");var e={};return ct(i,e,"_max"),e}function ct(i,e,t){var n=t==="_min"?$i:Ni;for(var r in i)if(i.hasOwnProperty(r)){var o=Array.isArray(i)?i[Number.parseInt(r,10)]:i[r];if(typeof o=="object"&&o!=null){var s=o instanceof Array?[]:{};if(Array.isArray(e))e[Number.parseInt(r,10)]=s;else{var a=n(r,Ye);e[a]=s}ct(o,s,t)}else{var l=n(o,Ri);if(Array.isArray(e))e[Number.parseInt(r,10)]=l;else{var h=n(r,Ye);e[h]=l}}}}function $i(i,e){if(typeof i=="string"&&i.length===1)return"___"+i;var t=e.indexOf(i);return t===-1?i:t.toString(36)}function Ni(i,e){return typeof i=="string"&&i.length===1?e[parseInt(i,36)]:typeof i=="string"&&i.substr(0,3)==="___"?i[3]:i}function Je(i,e,t){return e=Fi(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Fi(i){var e=Wi(i,"string");return typeof e=="symbol"?e:String(e)}function Wi(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class it{constructor(e,t){Je(this,"name",void 0),Je(this,"origin",void 0),Je(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function Fe(i,e,t){return e=Bi(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Bi(i){var e=Hi(i,"string");return typeof e=="symbol"?e:String(e)}function Hi(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}let zi=class extends V{constructor(e){super(),Fe(this,"_layoutManager",void 0),Fe(this,"_dontPropagateToParent",void 0),Fe(this,"_childEventSource",void 0),Fe(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(V.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),m(window).on("gl_child_event",this._boundOnEventFromChild)}_onEventFromThis(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._layoutManager.isSubWindow&&t[0]!==this._dontPropagateToParent&&this._propagateToParent(t),this._propagateToChildren(t),this._dontPropagateToParent=null,this._childEventSource=null}_$onEventFromParent(e){this._dontPropagateToParent=e[0],this.emit.apply(this,e)}_onEventFromChild(e){this._childEventSource=e.originalEvent.__gl,this.emit.apply(this,e.originalEvent.__glArgs)}_propagateToParent(e){var t,n="gl_child_event",r=(t=window.opener)===null||t===void 0?void 0:t.document.createEvent("HTMLEvents");r.initEvent(n,!0,!0),r.eventName=n,r.__glArgs=e,r.__gl=this._layoutManager,window.opener.dispatchEvent(r)}_propagateToChildren(e){for(var t=0;t<this._layoutManager.openPopouts.length;t++){var n=this._layoutManager.openPopouts[t].getGlInstance();n&&n!==this._childEventSource&&n.eventHub._$onEventFromParent(e)}}destroy(){m(window).off("gl_child_event",this._boundOnEventFromChild)}};const Zt=zi,ki=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:it,DragListener:je,EventEmitter:V,EventHub:Zt,ReactComponentHandler:qt,animFrame:ht,filterXss:xi,getHashValue:Vt,getQueryStringParam:Xt,getUniqueId:Ge,minifyConfig:ut,removeFromArray:Di,stripTags:dt,unminifyConfig:nt},Symbol.toStringTag,{value:"Module"}));function re(i,e,t){return e=Ki(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ki(i){var e=Ui(i,"string");return typeof e=="symbol"?e:String(e)}function Ui(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Jt extends V{constructor(e,t,n,r,o){super(),re(this,"isInitialised",!1),re(this,"_config",void 0),re(this,"_dimensions",void 0),re(this,"_parentId",void 0),re(this,"_indexInParent",void 0),re(this,"_layoutManager",void 0),re(this,"_popoutWindow",null),re(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=n,this._indexInParent=r,this._layoutManager=o,this._createWindow()}toConfig(){var e,t,n,r,o,s,a,l,h,d,u;if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");return{dimensions:{width:(e=this.getGlInstance())===null||e===void 0?void 0:e.width,height:(t=this.getGlInstance())===null||t===void 0?void 0:t.height,left:(n=(r=(o=this._popoutWindow)===null||o===void 0?void 0:o.screenX)!==null&&r!==void 0?r:(s=this._popoutWindow)===null||s===void 0?void 0:s.screenLeft)!==null&&n!==void 0?n:0,top:(a=(l=(h=this._popoutWindow)===null||h===void 0?void 0:h.screenY)!==null&&l!==void 0?l:(d=this._popoutWindow)===null||d===void 0?void 0:d.screenTop)!==null&&a!==void 0?a:0},content:(u=this.getGlInstance())===null||u===void 0?void 0:u.toConfig().content,parentId:this._parentId,indexInParent:this._indexInParent}}getGlInstance(){var e;return(e=this._popoutWindow)===null||e===void 0?void 0:e.__glInstance}getWindow(){return this._popoutWindow}close(){if(this.getGlInstance()){var e;(e=this.getGlInstance())===null||e===void 0||e._$closeWindow()}else try{var t;(t=this.getWindow())===null||t===void 0||t.close()}catch{}}popIn(){var e;this._indexInParent;var t=null,n=null;if(this._parentId){var r;if(t=m.extend(!0,{},(r=this.getGlInstance())===null||r===void 0?void 0:r.toConfig()).content[0],n=this._layoutManager.root.getItemsById(this._parentId)[0],!n){var o;((o=this._layoutManager.root.contentItems.length)!==null&&o!==void 0?o:0)>0?n=this._layoutManager.root.contentItems[0]:n=this._layoutManager.root}}t&&((e=n)===null||e===void 0||e.addChild(t,this._indexInParent),this.close())}_createWindow(){var e=this._createUrl(),t=Math.floor(Math.random()*1e6).toString(36),n=this._serializeWindowOptions({width:this._dimensions.width,height:this._dimensions.height,innerWidth:this._dimensions.width,innerHeight:this._dimensions.height,menubar:"no",toolbar:"no",location:"no",personalbar:"no",resizable:"yes",scrollbars:"no",status:"no"});if(this._popoutWindow=window.open(e,t,n),!this._popoutWindow)if(this._layoutManager.config.settings.blockedPopoutsThrowError===!0){var r=new Error("Popout blocked");throw r.type="popoutBlocked",r}else return;m(this._popoutWindow).on("load",this._positionWindow.bind(this)).on("unload beforeunload",this._onClose.bind(this));var o=window.setInterval(()=>{var s;(s=this._popoutWindow)!==null&&s!==void 0&&s.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),window.clearInterval(o))},10)}_serializeWindowOptions(e){var t=[],n;for(n in e)t.push(n+"="+e[n]);return t.join(",")}_createUrl(){var e={content:this._config},t="gl-window-config-"+Ge();e=ut(e);try{localStorage.setItem(t,JSON.stringify(e))}catch(r){throw new Error("Error while writing to localStorage "+r.toString())}var n=document.location.href.split("?");return n.length===1?n[0]+"?gl-window="+t:document.location.href+"&gl-window="+t}_positionWindow(){var e,t;(e=this._popoutWindow)===null||e===void 0||e.moveTo(this._dimensions.left,this._dimensions.top),(t=this._popoutWindow)===null||t===void 0||t.focus()}_onInitialised(){var e;this.isInitialised=!0,(e=this.getGlInstance())===null||e===void 0||e.on("popIn",this.popIn,this),this.emit("initialised")}_onClose(){setTimeout(this.emit.bind(this,"closed"),50)}}function A(i,e,t){return e=Gi(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Gi(i){var e=Yi(i,"string");return typeof e=="symbol"?e:String(e)}function Yi(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class fe extends V{constructor(e,t,n,r,o,s){var a,l,h,d,u,f,v,c;if(super(),A(this,"_dragListener",void 0),A(this,"_layoutManager",void 0),A(this,"_contentItem",void 0),A(this,"_originalParent",void 0),A(this,"_area",null),A(this,"_lastValidArea",null),A(this,"_minX",void 0),A(this,"_maxX",void 0),A(this,"_minY",void 0),A(this,"_maxY",void 0),A(this,"_width",void 0),A(this,"_height",void 0),A(this,"_sided",void 0),A(this,"element",void 0),A(this,"childElementContainer",void 0),A(this,"_proxyTab",void 0),this._dragListener=n,this._layoutManager=r,this._contentItem=o,this._originalParent=s,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var g,x;this._layoutManager.tabDropPlaceholder.width((g=this._contentItem.tab.element.outerWidth(!0))!==null&&g!==void 0?g:0),this._layoutManager.tabDropPlaceholder.height((x=this._contentItem.tab.element.outerHeight(!0))!==null&&x!==void 0?x:0)}if(this.element=m(fe._template),s&&s._side&&(this._sided=s._sided,this.element.addClass("lm_"+s._side),["right","bottom"].indexOf(s._side.toString())>=0&&this.element.find(".lm_content").after(this.element.find(".lm_header"))),this.element.css({left:e,top:t}),this._proxyTab=this.element.find(".lm_tab"),this._proxyTab.attr("title",dt((a=this._contentItem.config.title)!==null&&a!==void 0?a:"")),this.element.find(".lm_title").html((l=this._contentItem.config.title)!==null&&l!==void 0?l:""),this.childElementContainer=this.element.find(".lm_content"),this.childElementContainer.append(o.element),this._updateTree(),this._layoutManager._$calculateItemAreas(),m(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var E,T;this._layoutManager.tabDropPlaceholder.width((E=this._proxyTab.outerWidth(!0))!==null&&E!==void 0?E:0),this._layoutManager.tabDropPlaceholder.height((T=this._proxyTab.outerHeight(!0))!==null&&T!==void 0?T:0)}var P=this._layoutManager.container.offset();this._minX=(h=P==null?void 0:P.left)!==null&&h!==void 0?h:0,this._minY=(d=P==null?void 0:P.top)!==null&&d!==void 0?d:0,this._maxX=((u=this._layoutManager.container.width())!==null&&u!==void 0?u: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=(c=this.element.height())!==null&&c!==void 0?c:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,n){var r,o,s=(r=n.pageX)!==null&&r!==void 0?r:0,a=(o=n.pageY)!==null&&o!==void 0?o:0,l=s>this._minX&&s<this._maxX&&a>this._minY&&a<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(s,a)}_setDropPosition(e,t){this.element.css({left:e,top:t}),this._area=this._layoutManager._$getArea(e,t),this._area!==null&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(e,t,this._area))}_onDrop(){var e;(e=this._layoutManager.dropTargetIndicator)===null||e===void 0||e.hide(),this._area!==null?this._area.contentItem._$onDrop(this._contentItem,this._area):this._lastValidArea!==null?this._lastValidArea.contentItem._$onDrop(this._contentItem,this._lastValidArea):this._originalParent?this._originalParent.addChild(this._contentItem):this._contentItem._$destroy(),this._dragListener.off("drag",this._onDrag,this),this._dragListener.off("dragStop",this._onDrop,this),this.element.remove(),this._layoutManager.emit("itemDropped",this._contentItem)}_updateTree(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(null)}_setDimensions(){var e=this._layoutManager.config.dimensions,t=e.dragProxyWidth,n=e.dragProxyHeight;this.element.width(t),this.element.height(n),t-=this._sided?e.headerHeight:0,n-=this._sided?0:e.headerHeight,this.childElementContainer.width(t),this.childElementContainer.height(n),this._contentItem.element.width(t),this._contentItem.element.height(n),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}A(fe,"_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 We(i,e,t){return e=Vi(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Vi(i){var e=Xi(i,"string");return typeof e=="symbol"?e:String(e)}function Xi(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Qt{constructor(e,t,n){We(this,"_element",void 0),We(this,"_itemConfig",void 0),We(this,"_layoutManager",void 0),We(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=n,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new je(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this),this._dragListener}_onDragStart(e,t){var n=this._itemConfig;typeof n=="function"&&(n=n());var r=this._layoutManager._$normalizeContentItem(m.extend(!0,{},n));new fe(e,t,this._dragListener,this._layoutManager,r,null)}}function Be(i,e,t){return e=qi(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function qi(i){var e=Zi(i,"string");return typeof e=="symbol"?e:String(e)}function Zi(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class en{constructor(e,t,n){Be(this,"_element",m(window)),Be(this,"_itemConfig",void 0),Be(this,"_layoutManager",void 0),Be(this,"_dragListener",void 0),this._itemConfig=e,this._layoutManager=t,this._createDragListener(n)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&(this._dragListener=new je(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._destroy,this),this._dragListener.onMouseDown(e),this._dragListener._startDrag())}_destroy(){this._dragListener=void 0,this._element=void 0,this._itemConfig=void 0,this._layoutManager=void 0}_onDragStart(e,t){if(!(!this._dragListener||!this._layoutManager)){var n=this._itemConfig;typeof n=="function"&&(n=n());var r=this._layoutManager._$normalizeContentItem(m.extend(!0,{},n));new fe(e,t,this._dragListener,this._layoutManager,r,null)}}}function tn(i,e,t){return e=Ji(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ji(i){var e=Qi(i,"string");return typeof e=="symbol"?e:String(e)}function Qi(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Re{constructor(){tn(this,"element",m(Re._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()}}tn(Re,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function Qe(i,e,t){return e=er(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function er(i){var e=tr(i,"string");return typeof e=="symbol"?e:String(e)}function tr(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class xe{constructor(e,t,n,r){Qe(this,"element",void 0),Qe(this,"_header",void 0),Qe(this,"_action",void 0),this._header=e,this.element=m('<li class="'+n+'" title="'+t+'"></li>'),this._header.on("destroy",this._$destroy,this),this._action=r,this.element.on("click",this._action),this._header.controlsContainer.append(this.element)}_$destroy(){this.element.off(),this.element.remove()}}function nr(i,e,t){return e=ir(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ir(i){var e=rr(i,"string");return typeof e=="symbol"?e:String(e)}function rr(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class or extends Error{constructor(e,t){super(),nr(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const ce=or,sr=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:ce},Symbol.toStringTag,{value:"Module"}));function O(i,e,t){return e=ar(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ar(i){var e=lr(i,"string");return typeof e=="symbol"?e:String(e)}function lr(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function me(i){return i.isStack}function U(i){return i.isComponent}function nn(i){return i.isRoot}class L extends V{constructor(e,t,n,r){super(),O(this,"config",void 0),O(this,"type",void 0),O(this,"contentItems",void 0),O(this,"parent",void 0),O(this,"layoutManager",void 0),O(this,"element",void 0),O(this,"childElementContainer",void 0),O(this,"componentName",void 0),O(this,"isInitialised",!1),O(this,"isMaximised",!1),O(this,"isRoot",!1),O(this,"isRow",!1),O(this,"isColumn",!1),O(this,"isStack",!1),O(this,"isComponent",!1),O(this,"tab",void 0),O(this,"_pendingEventPropagations",void 0),O(this,"_throttledEvents",void 0),this.element=r,this.config=this._extendItemNode(t),this.type=t.type,this.contentItems=[],this.parent=n,this.layoutManager=e,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(V.ALL_EVENT,this._propagateEvent,this),t.content&&this._createContentItems(t)}callDownwards(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;n!==!0&&r!==!0&&this[e].apply(this,t);for(var o=0;o<this.contentItems.length;o++)this.contentItems[o].callDownwards(e,t,n);n===!0&&r!==!0&&this[e].apply(this,t)}removeChild(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=this.contentItems.indexOf(e);if(r===-1)throw new Error("Can't remove child item. Unknown content item");if(n!==!0&&this.contentItems[r]._$destroy(),this.contentItems.splice(r,1),(t=this.config.content)===null||t===void 0||t.splice(r,1),this.contentItems.length>0)this.callDownwards("setSize");else if(this.type!=="root"&&this.config.isClosable){var o;(o=this.parent)===null||o===void 0||o.removeChild(this)}}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.splice(t,0,e),this.config.content===void 0&&(this.config.content=[]),this.config.content.splice(t,0,e.config),e.parent=this,e.parent.isInitialised===!0&&e.isInitialised===!1&&e._$init()}replaceChild(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;t=this.layoutManager._$normalizeContentItem(t);var r=this.contentItems.indexOf(e),o=e.element[0].parentNode;if(r===-1)throw new Error("Can't replace child. oldChild is not child of this");o==null||o.replaceChild(t.element[0],e.element[0]),n===!0&&(e.parent=null,e._$destroy()),this.contentItems[r]=t,t.parent=this,me(this)&&(this.header.tabs[r].contentItem=t),t.parent.isInitialised===!0&&t.isInitialised===!1&&t._$init(),this.callDownwards("setSize")}remove(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}popout(){var e=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),e}toggleMaximise(e){e&&e.preventDefault(),this.isMaximised===!0?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximised=!this.isMaximised,this.emitBubblingEvent("stateChanged")}select(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))}deselect(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))}setTitle(e){this.config.title=e,this.emit("titleChanged",e),this.emitBubblingEvent("stateChanged")}hasId(e){if(this.config.id){if(typeof this.config.id=="string")return this.config.id===e;if(this.config.id instanceof Array)return this.config.id.indexOf(e)!==-1}else return!1}addId(e){this.hasId(e)||(this.config.id?typeof this.config.id=="string"?this.config.id=[this.config.id,e]:this.config.id instanceof Array&&this.config.id.push(e):this.config.id=e)}removeId(e){if(!this.hasId(e))throw new Error("Id not found");if(typeof this.config.id=="string")delete this.config.id;else if(this.config.id instanceof Array){var t=this.config.id.indexOf(e);this.config.id.splice(t,1)}}getItemsByFilter(e){var t=[],n=function r(o){for(var s=0;s<o.contentItems.length;s++)e(o.contentItems[s])===!0&&t.push(o.contentItems[s]),r(o.contentItems[s])};return n(this),t}getItemsById(e){return this.getItemsByFilter(function(t){return t.config.id instanceof Array?t.config.id.indexOf(e)!==-1:t.config.id===e})}getItemsByType(e){return this._$getItemsByProperty("type",e)}getComponentsByName(e){for(var t=this._$getItemsByProperty("componentName",e),n=[],r=0;r<t.length;r++)n.push(t[r].instance);return n}_$getItemsByProperty(e,t){return this.getItemsByFilter(function(n){return n[e]===t})}_$setParent(e){this.parent=e}_$highlightDropZone(e,t,n){var r;(r=this.layoutManager.dropTargetIndicator)===null||r===void 0||r.highlightArea(n)}_$onDrop(e,t){this.addChild(e)}_$hide(){this._callOnActiveComponents("hide"),this.element.hide(),this.layoutManager.updateSize()}_$show(){this._callOnActiveComponents("show"),this.element.show(),this.layoutManager.updateSize()}_callOnActiveComponents(e){for(var t=this.getItemsByType("stack"),n=null,r=0;r<t.length;r++)n=t[r].getActiveContentItem(),n&&U(n)&&n.container[e]()}_$destroy(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")}_$getArea(e){var t,n,r;e=e||this.element;var o=(t=e.offset())!==null&&t!==void 0?t:{left:0,top:0},s=(n=e.width())!==null&&n!==void 0?n:0,a=(r=e.height())!==null&&r!==void 0?r:0;return{x1:o.left,y1:o.top,x2:o.left+s,y2:o.top+a,surface:s*a,contentItem:this,side:""}}_$init(){this.setSize();for(var e=0;e<this.contentItems.length;e++){var t;(t=this.childElementContainer)===null||t===void 0||t.append(this.contentItems[e].element)}this.isInitialised=!0,this.emitBubblingEvent("itemCreated"),this.emitBubblingEvent(this.type+"Created")}emitBubblingEvent(e){var t=new it(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new ce("content must be an Array",e);for(var n=0;n<e.content.length;n++)t=this.layoutManager.createContentItem(e.content[n],this),this.contentItems.push(t)}_extendItemNode(e){for(var[t,n]of Object.entries(Yt)){var r=t;e[r]===void 0&&(e[r]=n)}return e}_propagateEvent(e,t){t instanceof it&&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,ht(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function Me(i,e,t){return e=hr(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function hr(i){var e=dr(i,"string");return typeof e=="symbol"?e:String(e)}function dr(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class rn extends L{constructor(e,t,n){var r;Object.entries((r=e.config.settings.defaultComponentConfig)!==null&&r!==void 0?r:{}).forEach(a=>{var[l,h]=a;t[l]===void 0&&(t[l]=h)}),super(e,t,n,m()),Me(this,"config",void 0),Me(this,"componentName",void 0),Me(this,"container",void 0),Me(this,"parent",void 0),Me(this,"instance",void 0),this.config=t,this.parent=n;var o=e.getComponent(this.config.componentName)||e.getFallbackComponent(),s=m.extend(!0,{},this.config.componentState||{});if(o==null)throw new ce('Unknown component "'+this.config.componentName+'"');s.componentName=this.config.componentName,this.componentName=this.config.componentName,this.config.title===""&&(this.config.title=this.config.componentName),this.isComponent=!0,this.container=new tt(this.config,this,e),this.instance=new o(this.container,s),this.element=this.container._element}close(){this.parent.removeChild(this)}setSize(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())}_$init(){L.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),L.prototype._$hide.call(this)}_$show(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),L.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),L.prototype._$destroy.call(this)}_$getArea(){return null}}function k(i,e,t){return e=ur(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ur(i){var e=cr(i,"string");return typeof e=="symbol"?e:String(e)}function cr(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Ve extends L{constructor(e,t,n,r){super(t,n,r,m('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),k(this,"isRow",void 0),k(this,"isColumn",void 0),k(this,"childElementContainer",void 0),k(this,"parent",void 0),k(this,"_splitter",[]),k(this,"_splitterSize",void 0),k(this,"_splitterGrabSize",void 0),k(this,"_isColumn",void 0),k(this,"_dimension",void 0),k(this,"_splitterPosition",null),k(this,"_splitterMinPosition",null),k(this,"_splitterMaxPosition",null),this.parent=r,this.isRow=!e,this.isColumn=e,this.childElementContainer=this.element,this._splitterSize=t.config.dimensions.borderWidth,this._splitterGrabSize=t.config.dimensions.borderGrabWidth,this._isColumn=e,this._dimension=e?"height":"width",this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null}addChild(e,t,n){var r,o,s,a;if(e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.length>0?(a=this._createSplitter(Math.max(0,t-1)).element,t>0?(this.contentItems[t-1].element.after(a),a.after(e.element)):(this.contentItems[0].element.before(a),a.before(e.element))):this.childElementContainer.append(e.element),L.prototype.addChild.call(this,e,t),r=1/this.contentItems.length*100,n===!0){this.emitBubblingEvent("stateChanged");return}for(s=0;s<this.contentItems.length;s++)if(this.contentItems[s]===e)e.config[this._dimension]=r;else{var l;o=((l=this.contentItems[s].config[this._dimension])!==null&&l!==void 0?l:0)*(100-r)/100,this.contentItems[s].config[this._dimension]=o}this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}removeChild(e,t){var n,r=(n=e.config[this._dimension])!==null&&n!==void 0?n:0,o=this.contentItems.indexOf(e),s=Math.max(o-1,0),a,l;if(o===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[s]&&(this._splitter[s]._$destroy(),this._splitter.splice(s,1)),a=0;a<this.contentItems.length;a++)if(this.contentItems[a]!==e){var h;this.contentItems[a].config[this._dimension]=((h=this.contentItems[a].config[this._dimension])!==null&&h!==void 0?h:0)+r/(this.contentItems.length-1)}L.prototype.removeChild.call(this,e,t),this.contentItems.length===1&&this.config.isClosable===!0?(l=this.contentItems[0],this.contentItems=[],this.parent.replaceChild(this,l,!0)):(this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged"))}replaceChild(e,t){var n=e.config[this._dimension];super.replaceChild(e,t),t.config[this._dimension]=n,this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(){this.contentItems.length>0&&(this._calculateRelativeSizes(),this._setAbsoluteSizes()),this.emitBubblingEvent("stateChanged"),this.emit("resize")}_$init(){if(this.isInitialised!==!0){var e;for(L.prototype._$init.call(this),e=0;e<this.contentItems.length-1;e++)this.contentItems[e].element.after(this._createSplitter(e).element)}}_setAbsoluteSizes(){var e,t=this._calculateAbsoluteSizes();for(e=0;e<this.contentItems.length;e++)t.additionalPixel-e>0&&t.itemSizes[e]++,this._isColumn?(this.contentItems[e].element.width(t.totalWidth),this.contentItems[e].element.height(t.itemSizes[e])):(this.contentItems[e].element.width(t.itemSizes[e]),this.contentItems[e].element.height(t.totalHeight))}_calculateAbsoluteSizes(){var e,t,n=(this.contentItems.length-1)*this._splitterSize,r=(e=this.element.width())!==null&&e!==void 0?e:0,o=(t=this.element.height())!==null&&t!==void 0?t:0,s=0,a=[];this._isColumn?o-=n:r-=n;for(var l=0;l<this.contentItems.length;l++){var h,d,u=this._isColumn?Math.floor(o*(((h=this.contentItems[l].config.height)!==null&&h!==void 0?h:0)/100)):Math.floor(r*(((d=this.contentItems[l].config.width)!==null&&d!==void 0?d:0)/100));s+=u,a.push(u)}var f=Math.floor((this._isColumn?o:r)-s);return{itemSizes:a,additionalPixel:f,totalWidth:r,totalHeight:o}}_calculateRelativeSizes(){for(var e=0,t=[],n=this._isColumn?"height":"width",r=0;r<this.contentItems.length;r++){var o=this.contentItems[r].config[n];o!=null?e+=o:t.push(this.contentItems[r])}if(Math.round(e)===100){this._respectMinItemWidth();return}if(Math.round(e)<100&&t.length>0){for(var s=0;s<t.length;s++)t[s].config[n]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var a=0;a<t.length;a++)t[a].config[n]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var h;this.contentItems[l].config[n]=((h=this.contentItems[l].config[n])!==null&&h!==void 0?h:0)/e*100}this._respectMinItemWidth()}_respectMinItemWidth(){var e,t=this.layoutManager.config.dimensions&&(e=this.layoutManager.config.dimensions.minItemWidth)!==null&&e!==void 0?e:0,n=[],r=0,o=0,s=0,a=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var h=this._calculateAbsoluteSizes(),d=0;d<this.contentItems.length;d++){this.contentItems[d];var u=h.itemSizes[d];u<t?(o+=t-u,l={width:t}):(r+=u-t,l={width:u},n.push(l)),a.push(l)}if(!(o===0||o>r)){var f=o/r;s=o;for(var v=0;v<n.length;v++){l=n[v];var c=Math.round((l.width-t)*f);s-=c,l.width-=c}s!==0&&(a[a.length-1].width-=s);for(var g=0;g<this.contentItems.length;g++)this.contentItems[g].config.width=a[g].width/h.totalWidth*100}}}_createSplitter(e){var t;return t=new on(this._isColumn,this._splitterSize,this._splitterGrabSize),t.on("drag",this._onSplitterDrag.bind(this,t),this),t.on("dragStop",this._onSplitterDragStop.bind(this,t),this),t.on("dragStart",this._onSplitterDragStart.bind(this,t),this),this._splitter.splice(e,0,t),t}_getItemsForSplitter(e){var t=this._splitter.indexOf(e);if(t<0)throw new Error("Splitter not found in RowOrColumn");return{before:this.contentItems[t],after:this.contentItems[t+1]}}_getMinimumDimensions(e){for(var t=0,n=0,r=0;r<e.length;++r){var o,s;t=Math.max((o=e[r].minWidth)!==null&&o!==void 0?o:0,t),n=Math.max((s=e[r].minHeight)!==null&&s!==void 0?s:0,n)}return{horizontal:t,vertical:n}}_onSplitterDragStart(e){var t,n,r,o,s=this._getItemsForSplitter(e),a=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=s.before.config.content)!==null&&t!==void 0?t:[]),h=this._isColumn?l.vertical:l.horizontal,d=this._getMinimumDimensions((n=s.after.config.content)!==null&&n!==void 0?n:[]),u=this._isColumn?d.vertical:d.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((r=s.before.element[this._dimension]())!==null&&r!==void 0?r:0)-(h||a)),this._splitterMaxPosition=((o=s.after.element[this._dimension]())!==null&&o!==void 0?o:0)-(u||a)}_onSplitterDrag(e,t,n){var r=this._isColumn?n:t;this._splitterMaxPosition==null||this._splitterMinPosition==null||r>this._splitterMinPosition&&r<this._splitterMaxPosition&&(this._splitterPosition=r,e.element.css(this._isColumn?"top":"left",r))}_onSplitterDragStop(e){var t,n,r,o,s,a=this._getItemsForSplitter(e),l=(t=a.before.element[this._dimension]())!==null&&t!==void 0?t:0,h=(n=a.after.element[this._dimension]())!==null&&n!==void 0?n:0,d=(((r=this._splitterPosition)!==null&&r!==void 0?r:0)+l)/(l+h),u=((o=a.before.config[this._dimension])!==null&&o!==void 0?o:0)+((s=a.after.config[this._dimension])!==null&&s!==void 0?s:0);a.before.config[this._dimension]=d*u,a.after.config[this._dimension]=(1-d)*u,e.element.css({top:0,left:0}),ht(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function Mt(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Et(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Mt(Object(t),!0).forEach(function(n){rt(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Mt(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function rt(i,e,t){return e=mr(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function mr(i){var e=fr(i,"string");return typeof e=="symbol"?e:String(e)}function fr(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class ot extends L{constructor(e,t,n){super(e,Et(Et({},t),{},{type:"root"}),null,m('<div class="lm_goldenlayout lm_item lm_root"></div>')),rt(this,"childElementContainer",void 0),rt(this,"_containerElement",void 0),this.isRoot=!0,this.type="root",this.childElementContainer=this.element,this._containerElement=n,this._containerElement.append(this.element)}addChild(e,t){if(this.contentItems.length>0)throw new Error("Root node can only have a single child");e=this.layoutManager._$normalizeContentItem(e,this),this.childElementContainer.append(e.element),super.addChild(e,t),this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(e,t){var n,r;e=typeof e>"u"?(n=this._containerElement.width())!==null&&n!==void 0?n:0:e,t=typeof t>"u"?(r=this._containerElement.height())!==null&&r!==void 0?r:0:t,this.element.width(e),this.element.height(t),this.contentItems[0]&&(this.contentItems[0].element.width(e),this.contentItems[0].element.height(t))}_$getArea(){var e=super._$getArea();if(e==null)throw new Error("Unable to get root area");return e}_$highlightDropZone(e,t,n){this.layoutManager.tabDropPlaceholder.remove(),super._$highlightDropZone(e,t,n)}_$onDrop(e,t){var n;if(U(e)&&(n=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this),n._$init(),n.addChild(e),e=n),!this.contentItems.length)this.addChild(e);else{var{side:r}=t,o=r==="left"||r==="right"?"row":"column",s=r==="left"||r==="right"?"width":"height",a=r==="left"||r==="top",l=this.contentItems[0];if(!(l instanceof Ve)||l.type!=o){var h=this.layoutManager.createContentItem({type:o},this);this.replaceChild(l,h),h.addChild(e,a?0:void 0,!0),h.addChild(l,a?void 0:0,!0),l.config[s]=50,e.config[s]=50,h.callDownwards("setSize")}else{var d,u=l.contentItems[a?0:l.contentItems.length-1];l.addChild(e,a?0:void 0,!0),u.config[s]=((d=u.config[s])!==null&&d!==void 0?d:0)*.5,e.config[s]=u.config[s],l.callDownwards("setSize")}}}}function Dt(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function _e(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Dt(Object(t),!0).forEach(function(n){W(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Dt(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function W(i,e,t){return e=vr(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function vr(i){var e=pr(i,"string");return typeof e=="symbol"?e:String(e)}function pr(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class st extends L{constructor(e,t,n){var r,o,s,a,l,h,d,u,f;super(e,t,n,m('<div class="lm_item lm_stack"></div>')),W(this,"_activeContentItem",null),W(this,"_header",void 0),W(this,"childElementContainer",m('<div class="lm_items"></div>')),W(this,"header",void 0),W(this,"parent",void 0),W(this,"isStack",!0),W(this,"_dropZones",{}),W(this,"_dropSegment",null),W(this,"_contentAreaDimensions",null),W(this,"_dropIndex",void 0),W(this,"_side",void 0),W(this,"_sided",!1),W(this,"config",void 0),this.parent=n,this.config=t;var v=e.config;this._side=!1,this._header={show:((r=v.settings)===null||r===void 0?void 0:r.hasHeaders)&&t.hasHeaders!==!1,popout:(o=v.settings)!==null&&o!==void 0&&o.showPopoutIcon?(s=v.labels)===null||s===void 0?void 0:s.popout:void 0,maximise:(a=v.settings)!==null&&a!==void 0&&a.showMaximiseIcon?(l=v.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(h=v.settings)!==null&&h!==void 0&&h.showCloseIcon?(d=v.labels)===null||d===void 0?void 0:d.close:void 0,minimise:(u=(f=v.labels)===null||f===void 0?void 0:f.minimise)!==null&&u!==void 0?u:void 0},v.header&&(this._header=_e(_e({},this._header),v.header)),t.header&&(this._header=_e(_e({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=_e(_e({},this._header),t.content[0].header)),this.header=new te(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,n,r,o,s=this._header.show&&(e=(t=this.layoutManager.config.dimensions)===null||t===void 0?void 0:t.headerHeight)!==null&&e!==void 0?e:0,a=((n=this.element.width())!==null&&n!==void 0?n:0)-(this._sided?s:0),l=((r=this.element.height())!==null&&r!==void 0?r:0)-(this._sided?0:s);for(this.childElementContainer.width(a),this.childElementContainer.height(l),o=0;o<this.contentItems.length;o++)this.contentItems[o].element.width(a).height(l);this.emit("resize"),this.emitBubblingEvent("stateChanged")}_$init(){if(this.isInitialised!==!0){this.header._attachWheelListener(),super._$init();for(var e=0;e<this.contentItems.length;e++)this.header.createTab(this.contentItems[e]),this.contentItems[e]._$hide();if(this.contentItems.length>0){var t=this.contentItems[this.config.activeItemIndex||0];if(!t)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(t)}}}setActiveContentItem(e){if(this.contentItems.indexOf(e)===-1)throw new Error("contentItem is not a child of this stack");this._activeContentItem!==null&&this._activeContentItem._$hide(),this._activeContentItem=e,this.header.setActiveContentItem(e),e._$show(),this.emit("activeContentItemChanged",e),this.layoutManager.emit("activeContentItemChanged",e),this.emitBubblingEvent("stateChanged")}getActiveContentItem(){return this.header.activeContentItem}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),super.addChild(e,t),this.childElementContainer.append(e.element),this.header.createTab(e,t),this.setActiveContentItem(e),this.callDownwards("setSize"),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}removeChild(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.contentItems.indexOf(e);super.removeChild(e,t),this.header.removeTab(e),this.header.activeContentItem===e&&(this.contentItems.length>0?this.setActiveContentItem(this.contentItems[Math.max(n-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}_$validateClosability(){for(var e=this.header._isClosable(),t=0,n=this.contentItems.length;t<n;t++){var r;if(!e)break;e=(r=this.contentItems[t].config.isClosable)!==null&&r!==void 0?r:!1}this.header._$setClosable(e)}_$destroy(){L.prototype._$destroy.call(this),this.header._$destroy()}_$onDrop(e){if(this._dropSegment==="header"){this._resetHeaderDropZone(),this.addChild(e,this._dropIndex);return}if(this._dropSegment==="body"){this.addChild(e);return}var t=this._dropSegment==="top"||this._dropSegment==="bottom",n=this._dropSegment==="left"||this._dropSegment==="right",r=this._dropSegment==="top"||this._dropSegment==="left",o=t&&this.parent.isColumn||n&&this.parent.isRow,s=t?"column":"row",a=t?"height":"width";if(U(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(o){var h,d=this.parent.contentItems.indexOf(this);this.parent.addChild(e,r?d:d+1,!0),this.config[a]=((h=this.config[a])!==null&&h!==void 0?h:0)*.5,e.config[a]=this.config[a],this.parent.callDownwards("setSize")}else{var u=this.layoutManager.createContentItem({type:s},this);this.parent.replaceChild(this,u),u.addChild(e,r?0:void 0,!0),u.addChild(this,r?void 0:0,!0),this.config[a]=50,e.config[a]=50,u.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[n,r]of Object.entries(this._contentAreaDimensions)){var o=r.hoverArea;if(o.x1<e&&o.x2>e&&o.y1<t&&o.y2>t){n==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(n));return}}}_$getArea(){if(this.element.is(":visible")===!1)return null;var e=super._$getArea(this.header.element),t=super._$getArea(this.childElementContainer);if(e==null||t==null)return null;var n=t.x2-t.x1,r=t.y2-t.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}},this._activeContentItem&&this._activeContentItem.isComponent===!1?e:this.contentItems.length===0?(this._contentAreaDimensions.body={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}},super._$getArea(this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x1+n*.25,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x1+n*.5,y2:t.y2}},this._contentAreaDimensions.top={hoverArea:{x1:t.x1+n*.25,y1:t.y1,x2:t.x1+n*.75,y2:t.y1+r*.5},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y1+r*.5}},this._contentAreaDimensions.right={hoverArea:{x1:t.x1+n*.75,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1+n*.5,y1:t.y1,x2:t.x2,y2:t.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:t.x1+n*.25,y1:t.y1+r*.5,x2:t.x1+n*.75,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1+r*.5,x2:t.x2,y2:t.y2}},super._$getArea(this.element))}_highlightHeaderDropZone(e){var t,n,r,o,s,a,l,h,d,u,f,v,c,g,x,E,T=this.header.tabs.length;if(T===0){var P,G,N,Z,j,R,$,he,B=this.header.element.offset();(P=this.layoutManager.dropTargetIndicator)===null||P===void 0||P.highlightArea({x1:(G=B==null?void 0:B.left)!==null&&G!==void 0?G:0,x2:((N=B==null?void 0:B.left)!==null&&N!==void 0?N:0)+100,y1:(Z=(j=this.header.element.offset())===null||j===void 0?void 0:j.top)!==null&&Z!==void 0?Z:0,y2:((R=($=this.header.element.offset())===null||$===void 0?void 0:$.top)!==null&&R!==void 0?R:0)+((he=this.header.element.innerHeight())!==null&&he!==void 0?he:0)});return}var ne=this.header.tabsContainer,X=(t=ne.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),ie=(n=this.layoutManager.tabDropPlaceholder.get(0))===null||n===void 0?void 0:n.getBoundingClientRect();if(!(!X||!ie)){e<X.left?e=X.left+1:e>X.right&&(e=X.right-1);var q,J;if(!(ie.left<e&&e<ie.right)){for(var ve=0;ve<T;ve++){var Se;if(q=this.header.tabs[ve].element,J=(Se=q.get(0))===null||Se===void 0?void 0:Se.getBoundingClientRect(),J&&J.left<e&&e<J.right){this._dropIndex=ve;break}}if(q&&J&&e<J.left+J.width*.5)q.before(this.layoutManager.tabDropPlaceholder);else if(q){var pe;this._dropIndex=Math.min(((pe=this._dropIndex)!==null&&pe!==void 0?pe:0)+1,T),q.after(this.layoutManager.tabDropPlaceholder)}}var _=(r=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&r!==void 0?r:0;_=Math.max(_,(s=(a=this.header.tabsContainer.offset())===null||a===void 0?void 0:a.left)!==null&&s!==void 0?s:0);var I=_+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);I=Math.min(I,((h=(d=this.header.tabsContainer.offset())===null||d===void 0?void 0:d.left)!==null&&h!==void 0?h:0)+((u=this.header.tabsContainer.innerWidth())!==null&&u!==void 0?u:0)),(f=this.layoutManager.dropTargetIndicator)===null||f===void 0||f.highlightArea({x1:_,x2:I,y1:(v=(c=this.header.element.offset())===null||c===void 0?void 0:c.top)!==null&&v!==void 0?v:0,y2:((g=(x=this.header.element.offset())===null||x===void 0?void 0:x.top)!==null&&g!==void 0?g:0)+((E=this.header.element.innerHeight())!==null&&E!==void 0?E:0)})}}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){var e=["right","left","bottom"].some(n=>n===this._header.show)?this._header.show:void 0;if(this.header.element.toggle(!!this._header.show),!!e&&(this._side=e,this._sided=["right","left"].indexOf(this._side.toString())>=0,this.element.removeClass("lm_left lm_right lm_bottom"),this._side&&this.element.addClass("lm_"+this._side),this.element.find(".lm_header").length&&this.childElementContainer)){var t=["right","bottom"].indexOf(this._side.toString())>=0?"before":"after";this.header.element[t](this.childElementContainer),this.callDownwards("setSize")}}_highlightBodyDropZone(e){var t,n,r=(t=this._contentAreaDimensions)===null||t===void 0||(n=t[e])===null||n===void 0?void 0:n.highlightArea;if(r){var o;(o=this.layoutManager.dropTargetIndicator)===null||o===void 0||o.highlightArea(r)}this._dropSegment=e}}const gr=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:L,Component:rn,ContentItem:L,Root:ot,RowOrColumn:Ve,Stack:st,isComponent:U,isRoot:nn,isStack:me},Symbol.toStringTag,{value:"Module"}));function ee(i,e,t){return e=_r(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function _r(i){var e=br(i,"string");return typeof e=="symbol"?e:String(e)}function br(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class $e{constructor(e,t){var n;ee(this,"header",void 0),ee(this,"contentItem",void 0),ee(this,"element",m($e._template)),ee(this,"titleElement",void 0),ee(this,"closeElement",void 0),ee(this,"isActive",!1),ee(this,"_layoutManager",void 0),ee(this,"_dragListener",void 0),this.header=e,this.contentItem=t,this.titleElement=this.element.find(".lm_title"),this.closeElement=this.element.find(".lm_close_tab"),this.closeElement[t.config.isClosable?"show":"hide"](),this.setTitle(t.config.title),this.contentItem.on("titleChanged",this.setTitle,this),this._layoutManager=this.contentItem.layoutManager,(n=this._layoutManager.config.settings)!==null&&n!==void 0&&n.reorderEnabled&&t.config.reorderEnabled&&(this._dragListener=new je(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),U(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),U(this.contentItem)&&(this.contentItem.container._contentElement.off(),this.contentItem.container._contentElement[0].removeEventListener("click",this._onTabContentFocusIn,!0)),this._dragListener&&(this.contentItem.off("destroy",this._dragListener.destroy,this._dragListener),this._dragListener.off("dragStart",this._onDragStart),this._dragListener=void 0),this.element.remove()}_onDragStart(e,t){var n;(n=this.contentItem.parent)!==null&&n!==void 0&&n.isMaximised&&this.contentItem.parent.toggleMaximise(),this._dragListener&&new fe(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(){U(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.element.removeClass("lm_focusin")}_onTabClick(e){if(!e||e.button===0){var t,n=this.header.parent.getActiveContentItem();this.contentItem!==n&&U(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):U(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),U(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(),U(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onCloseMousedown(e){e.stopPropagation()}}ee($e,"_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 w(i,e,t){return e=yr(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function yr(i){var e=wr(i,"string");return typeof e=="symbol"?e:String(e)}function wr(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class te extends V{constructor(e,t){var n,r;super(),w(this,"layoutManager",void 0),w(this,"element",m(te._template)),w(this,"tabsContainer",void 0),w(this,"tabDropdownContainer",void 0),w(this,"tabDropdownSearch",void 0),w(this,"tabDropdownList",null),w(this,"controlsContainer",void 0),w(this,"parent",void 0),w(this,"tabs",[]),w(this,"activeContentItem",null),w(this,"closeButton",null),w(this,"tabDropdownButton",null),w(this,"tabNextButton",m(te._nextButtonTemplate)),w(this,"tabPreviousButton",m(te._previousButtonTemplate)),w(this,"holdTimer",null),w(this,"rAF",null),w(this,"CLICK_TIMEOUT",500),w(this,"START_SPEED",.01),w(this,"ACCELERATION",5e-4),w(this,"PADDING",10),w(this,"SCROLL_LEFT","left"),w(this,"SCROLL_RIGHT","right"),w(this,"isDraggingTab",!1),w(this,"isOverflowing",!1),w(this,"isDropdownShown",!1),w(this,"dropdownKeyIndex",0),w(this,"_lastVisibleTabIndex",-1),w(this,"_tabControlOffset",void 0),this.layoutManager=e,(n=this.layoutManager.config.settings)!==null&&n!==void 0&&n.selectionEnabled&&(this.element.addClass("lm_selectable"),this.element.on("click",this._onHeaderClick.bind(this))),this.tabsContainer=this.element.find(".lm_tabs"),this.tabDropdownContainer=this.element.find(".lm_tabdropdown_list"),this.tabDropdownContainer.hide(),this.tabDropdownSearch=this.element.find(".lm_tabdropdown_search input"),this._handleFilterInput=this._handleFilterInput.bind(this),this._handleFilterKeydown=this._handleFilterKeydown.bind(this),this.tabDropdownSearch.on("input",this._handleFilterInput),this.tabDropdownSearch.on("keydown",this._handleFilterKeydown),this.controlsContainer=this.element.find(".lm_controls"),this.parent=t,this.parent.on("resize",this._updateTabSizes,this),this._handleItemPickedUp=this._handleItemPickedUp.bind(this),this._handleItemDropped=this._handleItemDropped.bind(this),this._handleNextMouseEnter=this._handleNextMouseEnter.bind(this),this._handleNextMouseLeave=this._handleNextMouseLeave.bind(this),this._handlePreviousMouseEnter=this._handlePreviousMouseEnter.bind(this),this._handlePreviousMouseLeave=this._handlePreviousMouseLeave.bind(this),this._handleScrollRepeat=this._handleScrollRepeat.bind(this),this._handleNextButtonMouseDown=this._handleNextButtonMouseDown.bind(this),this._handlePreviousButtonMouseDown=this._handlePreviousButtonMouseDown.bind(this),this._handleScrollButtonMouseDown=this._handleScrollButtonMouseDown.bind(this),this._handleScrollButtonMouseUp=this._handleScrollButtonMouseUp.bind(this),this._handleScrollEvent=this._handleScrollEvent.bind(this),this.tabNextButton.on("mousedown",this._handleNextButtonMouseDown),this.tabPreviousButton.on("mousedown",this._handlePreviousButtonMouseDown),this.tabsContainer.on("scroll",this._handleScrollEvent),this.layoutManager.on("itemPickedUp",this._handleItemPickedUp),this.layoutManager.on("itemDropped",this._handleItemDropped),this.tabsContainer.before(this.tabPreviousButton),this.tabPreviousButton=this.tabPreviousButton.find(">:first-child"),this.tabPreviousButton.hide(),this._showAdditionalTabsDropdown=this._showAdditionalTabsDropdown.bind(this),this._hideAdditionalTabsDropdown=this._hideAdditionalTabsDropdown.bind(this),this._tabControlOffset=(r=this.layoutManager.config.settings)===null||r===void 0?void 0:r.tabControlOffset,this._createControls()}createTab(e,t){for(var n=0;n<this.tabs.length;n++)if(this.tabs[n].contentItem===e)return;var r=new $e(this,e);if(this.tabs.length===0){this.tabs.push(r),this.tabsContainer.append(r.element);return}t===void 0&&(t=this.tabs.length),t>0?this.tabs[t-1].element.after(r.element):this.tabs[0].element.before(r.element),this.tabs.splice(t,0,r),this._updateTabSizes()}removeTab(e){for(var t=0;t<this.tabs.length;t++)if(this.tabs[t].contentItem===e){this.tabs[t]._$destroy(),this.tabs.splice(t,1);return}throw new Error("contentItem is not controlled by this header")}setActiveContentItem(e){for(var t,n,r,o,s=0;s<this.tabs.length;s++)o=this.tabs[s].contentItem===e,this.tabs[s].setActive(o),o===!0&&(this.activeContentItem=e,this.parent.config.activeItemIndex=s);(t=this.tabs[(r=this.parent.config.activeItemIndex)!==null&&r!==void 0?r:0].element.get(0))===null||t===void 0||(n=t.scrollIntoView)===null||n===void 0||n.call(t,{inline:"nearest"}),this._hideAdditionalTabsDropdown(),this._updateTabSizes(),this.parent.emitBubblingEvent("stateChanged")}position(e){var t=this.parent._header.show;return t&&!this.parent._side&&(t="top"),e!==void 0&&this.parent._header.show!==e&&(this.parent._header.show=e,this.parent._setupHeaderPosition()),t}_attachWheelListener(){var e;(e=this.tabsContainer.get(0))===null||e===void 0||e.addEventListener("wheel",this._handleWheelEvent,{passive:!0})}_detachWheelListener(){var e;(e=this.tabsContainer.get(0))===null||e===void 0||e.removeEventListener("wheel",this._handleWheelEvent)}_handleWheelEvent(e){var t=e.currentTarget;if(t instanceof HTMLElement){var n=Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX;if(e.deltaMode===WheelEvent.DOM_DELTA_PAGE){var r;n*=(r=this.tabsContainer.innerWidth())!==null&&r!==void 0?r:1}else e.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=100/3);t.scrollLeft+=Math.round(n)}}_handleScrollEvent(){this._checkScrollArrows()}_handleItemPickedUp(){this.isDraggingTab=!0,this.isDropdownShown&&this._hideAdditionalTabsDropdown(),this.controlsContainer.on("mouseenter",this._handleNextMouseEnter),this.tabPreviousButton.on("mouseenter",this._handlePreviousMouseEnter)}_handleItemDropped(){var e;this.isDraggingTab=!1,window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.controlsContainer.off("mouseenter",this._handleNextMouseEnter),this.controlsContainer.off("mouseleave",this._handleNextMouseLeave),this.tabPreviousButton.off("mouseenter",this._handlePreviousMouseEnter),this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextMouseEnter(){var e;this.controlsContainer.on("mouseleave",this._handleNextMouseLeave),this._handleScrollRepeat(this.SCROLL_RIGHT,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)}_handlePreviousMouseEnter(){var e;this.tabPreviousButton.on("mouseleave",this._handlePreviousMouseLeave),this._handleScrollRepeat(this.SCROLL_LEFT,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)}_handleNextMouseLeave(){var e;window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.controlsContainer.off("mouseleave",this._handleNextMouseLeave)}_handlePreviousMouseLeave(){var e;window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextButtonMouseDown(){for(var e,t=0;t<this.tabs.length;t+=1){var n,r,o,s,a;if(((n=(r=this.tabs[t].element.get(0))===null||r===void 0?void 0:r.offsetLeft)!==null&&n!==void 0?n:0)>((o=(s=this.tabsContainer.get(0))===null||s===void 0?void 0:s.offsetWidth)!==null&&o!==void 0?o:0)+((a=this.tabsContainer.scrollLeft())!==null&&a!==void 0?a:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT);else{var l=this.tabsContainer.get(0);if(l){var h,d;l.scrollLeft=(h=(d=this.tabsContainer.get(0))===null||d===void 0?void 0:d.scrollWidth)!==null&&h!==void 0?h:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var n,r,o;if(((n=(r=this.tabs[t].element.get(0))===null||r===void 0?void 0:r.offsetLeft)!==null&&n!==void 0?n:0)<((o=this.tabsContainer.scrollLeft())!==null&&o!==void 0?o:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT);else{var s=this.tabsContainer.get(0);s&&(s.scrollLeft=0)}}_handleScrollButtonMouseDown(e){this.holdTimer=window.setTimeout(()=>{var t;this._handleScrollRepeat(e,(t=this.tabsContainer.scrollLeft())!==null&&t!==void 0?t:0,100)},this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)}_handleScrollButtonMouseUp(){var e,t;clearTimeout((e=this.holdTimer)!==null&&e!==void 0?e:-1),this.holdTimer=null,cancelAnimationFrame((t=this.rAF)!==null&&t!==void 0?t:-1),this.rAF=null,window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)}_checkScrollArrows(){var e,t,n;this.tabsContainer.scrollLeft()===0?this.tabPreviousButton.first().prop("disabled",!0):((e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)+((t=this.tabsContainer.innerWidth())!==null&&t!==void 0?t:0)===((n=this.tabsContainer.get(0))===null||n===void 0?void 0:n.scrollWidth)?this.tabNextButton.prop("disabled",!0):(this.tabNextButton.prop("disabled",!1),this.tabPreviousButton.first().prop("disabled",!1))}_handleScrollRepeat(e,t){var n,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0,s=this.tabsContainer.get(0);if(s){var a=s.getBoundingClientRect();if(e===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(t-r),this.isDraggingTab&&this.parent._highlightHeaderDropZone(a.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(e===this.SCROLL_RIGHT){var l,h;if(this.tabsContainer.scrollLeft(t+r),this.isDraggingTab&&this.parent._highlightHeaderDropZone(a.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((h=this.tabsContainer.innerWidth())!==null&&h!==void 0?h:0)===s.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((n=this.rAF)!==null&&n!==void 0?n:-1),this.rAF=window.requestAnimationFrame(d=>{var u,f,v=o||d,c=d-v,g=this.START_SPEED*c+.5*this.ACCELERATION*(c*c);g=Math.min(g,(u=(f=this.tabsContainer.get(0))===null||f===void 0?void 0:f.scrollWidth)!==null&&u!==void 0?u: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,n,r,o;if(o=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new xe(this,o,"lm_tabdropdown",this._showAdditionalTabsDropdown),this.tabDropdownButton.element.hide(),this.controlsContainer.prepend(this.tabNextButton),this.tabNextButton.hide(),this._getHeaderSetting("popout")&&(t=this._onPopoutClick.bind(this),n=this._getHeaderSetting("popout"),new xe(this,n,"lm_popout",t)),this._getHeaderSetting("maximise")){r=this.parent.toggleMaximise.bind(this.parent);var s=this._getHeaderSetting("maximise"),a=this._getHeaderSetting("minimise"),l=new xe(this,s,"lm_maximise",r);this.parent.on("maximised",function(){l.element.attr("title",a??"")}),this.parent.on("minimised",function(){l.element.attr("title",s??"")})}this._isClosable()&&(e=this.parent.remove.bind(this.parent),n=this._getHeaderSetting("close"),this.closeButton=new xe(this,n,"lm_close",e))}_showAdditionalTabsDropdown(){if(this.isDropdownShown){this._hideAdditionalTabsDropdown();return}this.tabDropdownList=this.tabsContainer.clone(!0).appendTo(this.tabDropdownContainer).children().removeClass("lm_active"),m(document.body).append(this.tabDropdownContainer),this.tabDropdownContainer.show(),this.isDropdownShown=!0,this.element.addClass("lm_dropdown_open"),this.tabDropdownSearch.val("").focus(),this.dropdownKeyIndex=0,this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active"),m(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown()}_handleFilterKeydown(e){if(e.key==="Escape"){this._hideAdditionalTabsDropdown();return}if(this.dropdownKeyIndex===-1)return;if(e.key==="Enter"||e.key===" "){this._hideAdditionalTabsDropdown(),this.tabs[this.dropdownKeyIndex]._onTabClick();return}function t(a,l,h){if(h==null||h.length<2)return-1;for(var d=(a+l+h.length)%h.length;d!==a;){if(h.eq(d).css("display")!=="none")return d;d=(d+l+h.length)%h.length}return a}if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var n,r;e.preventDefault(),(n=this.tabDropdownList)===null||n===void 0||n.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,1,this.tabDropdownList),(r=this.tabDropdownList)===null||r===void 0||r.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}else if(e.key==="ArrowUp"||e.key==="Tab"){var o,s;e.preventDefault(),(o=this.tabDropdownList)===null||o===void 0||o.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,-1,this.tabDropdownList),(s=this.tabDropdownList)===null||s===void 0||s.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_handleFilterInput(e){if(this.tabDropdownList!=null){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var t=0;t<this.tabDropdownList.length;t++){var n,r;((n=(r=this.tabs[t].contentItem.config.title)===null||r===void 0?void 0:r.toLowerCase().indexOf(e.target.value.toLowerCase()))!==null&&n!==void 0?n:-1)!==-1?(this.tabDropdownList.eq(t).css("display",""),this.dropdownKeyIndex===-1&&(this.dropdownKeyIndex=t)):this.tabDropdownList.eq(t).css("display","none")}this.dropdownKeyIndex!==-1&&this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_hideAdditionalTabsDropdown(e){var t,n;this.isDropdownShown&&(e&&(t=this.tabDropdownContainer.get(0))!==null&&t!==void 0&&t.contains(e.target)||e&&((n=this.tabDropdownButton)===null||n===void 0?void 0:n.element.get(0))===e.target||(this.element.removeClass("lm_dropdown_open"),this.tabDropdownContainer.hide(),this.isDropdownShown=!1,this.element.append(this.tabDropdownContainer),this.tabDropdownContainer.find(".lm_tabs").remove(),m(document).off("mousedown",this._hideAdditionalTabsDropdown)))}_updateAdditionalTabsDropdown(){var e,t,n,r;if(this.isDropdownShown&&!(!this.tabDropdownList||this.tabDropdownList.length==0)){var o=(e=(t=this.tabDropdownContainer.get(0))===null||t===void 0?void 0:t.scrollHeight)!==null&&e!==void 0?e:0;if(o!==0){var s=this.tabDropdownContainer[0].getBoundingClientRect(),a=(n=m(window).height())!==null&&n!==void 0?n:0,l=(r=m(window).width())!==null&&r!==void 0?r:0;if(this.tabDropdownButton){var h=this.tabDropdownButton.element[0].getBoundingClientRect(),d=o<a-h.bottom,u=!d&&h.bottom>a*.6,f=Math.min(h.left+(u?h.width:0),l-s.width-this.PADDING),v=u?Math.max(h.top-o,this.PADDING):h.bottom,c=a-v-this.PADDING;this.tabDropdownContainer.css({"max-height":c,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 n;(n=this.tabDropdownButton)===null||n===void 0||n.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1}this.isOverflowing&&this._checkScrollArrows()}}}}w(te,"_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(""));w(te,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));w(te,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function Ee(i,e,t){return e=Cr(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Cr(i){var e=Pr(i,"string");return typeof e=="symbol"?e:String(e)}function Pr(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class on{constructor(e,t,n){Ee(this,"_isVertical",void 0),Ee(this,"_size",void 0),Ee(this,"_grabSize",void 0),Ee(this,"_dragListener",void 0),Ee(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=n<t?t:n,this.element=this._createElement(),this._dragListener=new je(this.element)}on(e,t,n){var r;(r=this._dragListener)===null||r===void 0||r.on(e,t,n)}_$destroy(){var e;(e=this._dragListener)===null||e===void 0||e.destroy(),this._dragListener=null,this.element.remove()}_createElement(){var e=m('<div class="lm_drag_handle"></div>'),t=m('<div class="lm_splitter"></div>');t.append(e);var n=this._grabSize-this._size,r=n/2;return this._isVertical?(e.css("top",-r),e.css("height",this._size+n),t.addClass("lm_vertical"),t.height(this._size)):(e.css("left",-r),e.css("width",this._size+n),t.addClass("lm_horizontal"),t.width(this._size)),t}}const Sr=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:Jt,DragProxy:fe,DragSource:Qt,DragSourceFromEvent:en,DropTargetIndicator:Re,Header:te,HeaderButton:xe,Splitter:on,Tab:$e},Symbol.toStringTag,{value:"Module"}));var Ir={config:Ci,container:Ei,controls:Sr,errors:sr,items:gr,utils:ki};const Mr=Ir;function xt(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function F(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xt(Object(t),!0).forEach(function(n){y(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):xt(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function y(i,e,t){return e=Er(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Er(i){var e=Dr(i,"string");return typeof e=="symbol"?e:String(e)}function Dr(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class sn extends V{static minifyConfig(e){return ut(e)}static unminifyConfig(e){return nt(e)}constructor(e,t){super(),y(this,"isInitialised",!1),y(this,"_isFullPage",!1),y(this,"_resizeTimeoutId",void 0),y(this,"_components",{"lm-react-component":qt}),y(this,"_fallbackComponent",void 0),y(this,"_itemAreas",[]),y(this,"_maximisedItem",null),y(this,"_maximisePlaceholder",m('<div class="lm_maximise_place"></div>')),y(this,"_creationTimeoutPassed",!1),y(this,"_subWindowsCreated",!1),y(this,"_dragSources",[]),y(this,"_updatingColumnsResponsive",!1),y(this,"_firstLoad",!0),y(this,"_reactChildMap",new Map),y(this,"_reactChildren",null),y(this,"_initialHeaderHeight",void 0),y(this,"width",null),y(this,"height",null),y(this,"root",void 0),y(this,"openPopouts",[]),y(this,"selectedItem",null),y(this,"isSubWindow",!1),y(this,"eventHub",new Zt(this)),y(this,"config",void 0),y(this,"container",void 0),y(this,"_originalContainer",void 0),y(this,"dropTargetIndicator",null),y(this,"tabDropPlaceholder",m('<div class="lm_drop_tab_placeholder"></div>')),y(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:Ve.bind(this,!0),row:Ve.bind(this,!1),stack:st,component:rn}}registerComponent(e,t){if(typeof t!="function"&&(t==null||t.render==null||typeof t.render!="function"))throw new Error("Please register a constructor function");if(this._components[e]!==void 0)throw new Error("Component "+e+" is already registered");this._components[e]=t;var n=()=>{if(this._components[e]===void 0)throw new Error("Component "+e+" is not registered");delete this._components[e]};return n}setFallbackComponent(e){this._fallbackComponent=e}toConfig(e){if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");if(e&&!(e instanceof L))throw new Error("Root must be a ContentItem");var t={settings:F({},this.config.settings),dimensions:F({},this.config.dimensions),labels:F({},this.config.labels),content:[]},n=function o(s,a){for(var l in a.config)l!=="content"&&(s[l]=a.config[l]);if(s.componentName==="lm-react-component"&&(s.type="react-component"),a.contentItems.length){s.content=[];for(var h=0;h<a.contentItems.length;h++)s.content[h]={},o(s.content[h],a.contentItems[h])}};e?n(t,{contentItems:[e]}):n(t,this.root),this._$reconcilePopoutWindows(),t.openPopouts=[];for(var r=0;r<this.openPopouts.length;r++)t.openPopouts.push(this.openPopouts[r].toConfig());return t.maximisedItemId=this._maximisedItem?"__glMaximised":void 0,t}getComponent(e){return this._components[e]}getFallbackComponent(){return this._fallbackComponent}init(){if(this._subWindowsCreated===!1&&(this._createSubWindows(),this._subWindowsCreated=!0),document.readyState==="loading"||document.body===null){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 Re,this.updateSize(),this._create(this.config),this._bindEvents(),this.isInitialised=!0,this._adjustColumnsResponsive(),this.emit("initialised")}addReactChild(e,t){this._reactChildMap.set(e,t),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged")}removeReactChild(e,t){var n=this._reactChildMap.get(e);n===t&&(this._reactChildMap.delete(e),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged"))}getReactChildren(){return this._reactChildren}enableHeaders(){this.config.settings.hasHeaders=!0,this.config.dimensions.headerHeight=this._initialHeaderHeight,this._findAllStackContainers().forEach(e=>{e._header.show=!0,e.header.element.toggle(!0)}),this.updateSize()}disableHeaders(){this.config.settings.hasHeaders=!1,this.config.dimensions.headerHeight=0,this._findAllStackContainers().forEach(e=>{e._header.show=!1,e.header.element.toggle(!1)}),this.updateSize()}updateSize(e,t){var n,r;if(this.width=(n=e??this.container.width())!==null&&n!==void 0?n:0,this.height=(r=t??this.container.height())!==null&&r!==void 0?r:0,this.isInitialised===!0){if(this.root.callDownwards("setSize",[this.width,this.height]),this._maximisedItem){var o,s;this._maximisedItem.element.width((o=this.container.width())!==null&&o!==void 0?o:0),this._maximisedItem.element.height((s=this.container.height())!==null&&s!==void 0?s:0),this._maximisedItem.callDownwards("setSize")}this._adjustColumnsResponsive()}}destroy(){var e;this.isInitialised===!1||!this.root||(this._onUnload(),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 n,r,o;if(typeof e.type!="string")throw new ce("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!this._typeToItem[e.type])throw r="Unknown type '"+e.type+"'. Valid types are "+Object.keys(this._typeToItem).join(","),new ce(r);return e.type==="component"&&!(t instanceof st)&&t&&!(this.isSubWindow===!0&&t instanceof ot)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),e.id=(n=e.id)!==null&&n!==void 0?n:Ge(),o=new this._typeToItem[e.type](this,e,t),o}createPopout(e,t,n,r){var o=[],s=e instanceof L,a=this;if(s){var l;o=this.toConfig(e).content,n=Ge();for(var h=e.parent,d=e;((u=h)===null||u===void 0?void 0:u.contentItems.length)===1&&!h.isRoot;){var u;d=h,h=h.parent}if((l=h)===null||l===void 0||l.addId(n),r==null||Number.isNaN(r)){var f;r=(f=h)===null||f===void 0?void 0:f.contentItems.indexOf(d)}}else e instanceof Array?o=e:o=[e];if(!t&&s){var v,c,g,x=window.screenX||window.screenLeft,E=window.screenY||window.screenTop,T=(v=e.element.offset())!==null&&v!==void 0?v:{left:0,top:0};t={left:x+T.left,top:E+T.top,width:(c=e.element.width())!==null&&c!==void 0?c:0,height:(g=e.element.height())!==null&&g!==void 0?g:0}}if(!t&&!s&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),s&&e.remove(),!(!t||!n||r===void 0)){var P=new Jt(o,t,n,r,this);return P.on("initialised",function(){a.emit("windowOpened",P)}),P.on("closed",function(){a._$reconcilePopoutWindows()}),this.openPopouts.push(P),P}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var n=new Qt(e,t,this);return this._dragSources.push(n),n}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new en(e,this,t)}selectItem(e,t){if(this.config.settings.selectionEnabled!==!0)throw new Error("Please set selectionEnabled to true to use this feature");e!==this.selectedItem&&(this.selectedItem!==null&&this.selectedItem.deselect(),e&&t!==!0&&e.select(),this.selectedItem=e,this.emit("selectionChanged",e))}_$maximiseItem(e){var t,n;this._maximisedItem!==null&&this._$minimiseItem(this._maximisedItem),this._maximisedItem=e,this._maximisedItem.addId("__glMaximised"),e.element.addClass("lm_maximised"),e.element.after(this._maximisePlaceholder),this.root.element.prepend(e.element),e.element.width((t=this.container.width())!==null&&t!==void 0?t:0),e.element.height((n=this.container.height())!==null&&n!==void 0?n:0),e.callDownwards("setSize"),this._maximisedItem.emit("maximised"),this.emit("stateChanged")}_$minimiseItem(e){var t;e.element.removeClass("lm_maximised"),e.removeId("__glMaximised"),this._maximisePlaceholder.after(e.element),this._maximisePlaceholder.remove(),(t=e.parent)===null||t===void 0||t.callDownwards("setSize"),this._maximisedItem=null,e.emit("minimised"),this.emit("stateChanged")}_$closeWindow(){window.setTimeout(function(){window.close()},1)}_$getArea(e,t){for(var n=1/0,r=null,o=0;o<this._itemAreas.length;o++){var s=this._itemAreas[o];e>s.x1&&e<s.x2&&t>s.y1&&t<s.y2&&n>s.surface&&(n=s.surface,r=s)}return r}_$createRootItemAreas(){var e=50,t=F({},this.root._$getArea()),n=[F(F({},t),{},{side:"left",x2:t.x1+e}),F(F({},t),{},{side:"right",x1:t.x2-e}),F(F({},t),{},{side:"top",y2:t.y1+e}),F(F({},t),{},{side:"bottom",y1:t.y2-e})];n.forEach(r=>{r.surface=(r.x2-r.x1)*(r.y2-r.y1)}),this._itemAreas.push(...n)}_$calculateItemAreas(){var e=this._getAllContentItems();if(this._itemAreas=[],e.length===1){this._itemAreas.push(this.root._$getArea());return}this._$createRootItemAreas();for(var t=0;t<e.length;t++){var n=e[t];if(me(n)){var r=n._$getArea();if(r!==null)if(r instanceof Array)this._itemAreas=this._itemAreas.concat(r);else{var o;this._itemAreas.push(r);var s=F(F({},r),(o=r.contentItem._contentAreaDimensions)===null||o===void 0?void 0:o.header.highlightArea);s.surface=(s.x2-s.x1)*(s.y2-s.y1),this._itemAreas.push(s)}}}}_$normalizeContentItem(e,t){if(!e)throw new Error("No content item defined");if(typeof e=="function"&&(e=e()),e instanceof L)return e;if(m.isPlainObject(e)&&e.type){var n=this.createContentItem(e,t);return n.callDownwards("_$init"),n}else throw new Error("Invalid contentItem")}_$reconcilePopoutWindows(){for(var e=[],t=0;t<this.openPopouts.length;t++){var n;((n=this.openPopouts[t].getWindow())===null||n===void 0?void 0:n.closed)===!1?e.push(this.openPopouts[t]):this.emit("windowClosed",this.openPopouts[t])}this.openPopouts.length!==e.length&&(this.emit("stateChanged"),this.openPopouts=e)}_getAllContentItems(){var e=[],t=n=>{if(e.push(n),n.contentItems instanceof Array)for(var r=0;r<n.contentItems.length;r++)t(n.contentItems[r])};return t(this.root),e}_bindEvents(){this._isFullPage&&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,n=Xt("gl-window");n&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(n)||"{}"),e=nt(e),localStorage.removeItem(n)),e=m.extend(!0,{},Ut,e);var r=function o(s){for(var a in s){var l=s[a];a!=="props"&&typeof l=="object"&&l!=null?o(l):a==="type"&&l==="react-component"&&(s.type="component",s.componentName="lm-react-component")}};return r(e),((t=e.settings)===null||t===void 0?void 0:t.hasHeaders)===!1&&(e.dimensions.headerHeight=0),e}_adjustToWindowMode(){var e,t=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=dt((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 ce(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new ce(t,e);this.root=new ot(this,{content:e.content},this.container),this.root.callDownwards("_$init"),e.maximisedItemId==="__glMaximised"&&this.root.getItemsById(e.maximisedItemId)[0].toggleMaximise()}_onUnload(){if(this.config.settings.closePopoutsOnUnload===!0)for(var e=0;e<this.openPopouts.length;e++)this.openPopouts[e].close()}_adjustColumnsResponsive(){if(!this._useResponsiveLayout()||this._updatingColumnsResponsive||!this.config.dimensions||!this.config.dimensions.minItemWidth||this.root.contentItems.length===0||!this.root.contentItems[0].isRow){this._firstLoad=!1;return}this._firstLoad=!1;var e=this.root.contentItems[0].contentItems.length;if(!(e<=1)){var t=this.config.dimensions.minItemWidth,n=e*t;if(!(this.width==null||n<=this.width)){this._updatingColumnsResponsive=!0;for(var r=Math.max(Math.floor(this.width/t),1),o=e-r,s=this.root.contentItems[0],a=this._findAllStackContainers()[0],l=0;l<o;l++){var h=s.contentItems[s.contentItems.length-1];this._addChildContentItemsToContainer(a,h)}this._updatingColumnsResponsive=!1}}}_useResponsiveLayout(){return this.config.settings&&(this.config.settings.responsiveMode=="always"||this.config.settings.responsiveMode=="onload"&&this._firstLoad)}_addChildContentItemsToContainer(e,t){t.type==="stack"?t.contentItems.forEach(function(n){e.addChild(n),t.removeChild(n,!0)}):t.contentItems.forEach(n=>{this._addChildContentItemsToContainer(e,n)})}_findAllStackContainers(){var e=[];return this._findAllStackContainersRecursive(e,this.root),e}_findAllStackContainersRecursive(e,t){t.contentItems.forEach(n=>{me(n)?e.push(n):n.isComponent||this._findAllStackContainersRecursive(e,n)})}}y(sn,"__lm",Mr);const xr=sn,Or="_lm_dragging_k4a5m_1",Tr="_lm_goldenlayout_k4a5m_1",Ar="_lm_header_k4a5m_1",Lr="_lm_controls_k4a5m_1",jr="_lm_tabpreviousbutton_k4a5m_1",Rr="_lm_tabnextbutton_k4a5m_1",$r="_lm_tab_k4a5m_1",Nr="_lm_active_k4a5m_1",Fr="_lm_close_tab_k4a5m_1",Wr="_lm_content_k4a5m_1",Br="_lm_dragProxy_k4a5m_1",Hr="_lm_dropTargetIndicator_k4a5m_1",zr="_march_k4a5m_1",kr="_lm_inner_k4a5m_1",Kr="_lm_splitter_k4a5m_1",Ur="_lm_selectable_k4a5m_1",Gr="_lm_tabdropdown_list_k4a5m_1",Yr="_lm_title_k4a5m_1",Vr="_lm_title_before_k4a5m_1",Xr="_lm_selected_k4a5m_1",qr="_lm_focusin_k4a5m_1",Zr="_lm_window_blur_k4a5m_1",Jr="_lm_popout_k4a5m_1",Qr="_lm_maximise_k4a5m_1",eo="_lm_tabdropdown_k4a5m_1",to="_lm_close_k4a5m_1",no="_lm_tabdropdown_search_k4a5m_1",io="_lm_tabs_k4a5m_1",ro="_lm_keyboard_active_k4a5m_1",oo="_lm_maximised_k4a5m_1",so="_lm_items_k4a5m_1",Ot={"tab-height":"28px","drag-border-width":"5px",lm_dragging:Or,lm_goldenlayout:Tr,lm_header:Ar,lm_controls:Lr,lm_tabpreviousbutton:jr,lm_tabnextbutton:Rr,lm_tab:$r,lm_active:Nr,lm_close_tab:Fr,lm_content:Wr,lm_dragProxy:Br,lm_dropTargetIndicator:Hr,march:zr,lm_inner:kr,lm_splitter:Kr,lm_selectable:Ur,lm_tabdropdown_list:Gr,lm_title:Yr,lm_title_before:Vr,lm_selected:Xr,lm_focusin:qr,lm_window_blur:Zr,lm_popout:Jr,lm_maximise:Qr,lm_tabdropdown:eo,lm_close:to,lm_tabdropdown_search:no,lm_tabs:io,lm_keyboard_active:ro,lm_maximised:oo,lm_items:so},Tt=Object.freeze({tabHeight:parseInt(Ot["tab-height"],10),dragBorderWidth:parseInt(Ot["drag-border-width"],10)});function At(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Q(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?At(Object(t),!0).forEach(function(n){an(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):At(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function an(i,e,t){return e=ao(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ao(i){var e=lo(i,"string");return typeof e=="symbol"?e:String(e)}function lo(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var oe=Ce.module("LayoutUtils");function ln(i){return i.componentName!==void 0}function ye(i){var e=i;return(ln(i)&&i.componentName==="lm-react-component"||i.type==="react-component")&&e.component!==void 0}function He(i){return i.focus!==void 0}function Lt(i){return i.type==="stack"}class p{static activateTab(e,t){var n=p.getStackForRoot(e,t,!1);if(!n){oe.error("Could not find stack for config",t);return}var r=p.getContentItemInStack(n,t);r&&n.setActiveContentItem(r)}static isActiveTab(e,t){var n=p.getStackForRoot(e,t,!1);if(!n)return oe.error("Could not find stack for config",t),!1;var r=p.getContentItemInStack(n,t),o=n.getActiveContentItem();return o===r}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=t?"column":"row";if(nn(e)){(e.contentItems==null||e.contentItems.length===0)&&e.addChild({type:n});var r=e.contentItems[0],o=t?r.isColumn:r.isRow;if(!o){e.removeChild(r,!0),e.addChild({type:n});var s=document.activeElement;e.contentItems[0].addChild(r),s&&s.focus!=null&&s.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var a=e.contentItems[e.contentItems.length-1],l=t?a.isRow:a.isColumn;return l||(e.addChild({type:t?"row":"column"}),e.removeChild(a,!0),e.contentItems[e.contentItems.length-1].addChild(a),a=e.contentItems[e.contentItems.length-1]),this.addStack(a,!t)}static getStackById(e,t){var n,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(r&&me(e)&&e.contentItems.length===0)return e;if(t===((n=e.config)===null||n===void 0?void 0:n.id)){if(me(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 s=this.getStackById(e.contentItems[o],t,r);if(s)return s}return null}static getStackForConfig(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(n&&me(e)&&e.contentItems.length===0)return e;if(e.contentItems==null)return null;for(var r=0;r<e.contentItems.length;r+=1){var o=e.contentItems[r];if(o.isComponent&&o.config!=null&&gt(o.config,t))return e;var s=this.getStackForConfig(o,t,n);if(s)return s}return null}static getStackForRoot(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=this.getStackForConfig(e,t);return!s&&r&&(s=this.getStackForConfig(e,{component:t.component},o)),!s&&n&&(s=this.addStack(e)),s}static getStackForComponentTypes(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=0;s<t.length;s+=1){var a=t[s],l=s===t.length-1,h=p.getStackForRoot(e,{component:a},n&&l,r,o);if(h)return h}return null}static getContentItemInStack(e,t){if(!e)return null;for(var n=0;n<e.contentItems.length;n+=1){var r=e.contentItems[n];if(r.isComponent&&r.config!=null&&gt(r.config,t))return r}return null}static dehydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var n=[],r=0;r<e.length;r+=1){var o=e[r],{component:s,content:a}=o;if(s){var l=t(s,o);l!=null?n.push(l):oe.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(s,'"'))}else if(a){var h=Q(Q({},o),{},{content:p.dehydrateLayoutConfig(a,t)});n.push(h)}else n.push(o)}return n}static getTabPoint(e){var{tab:t}=e;if(t==null)throw new Error("Cannot get tab for panel container ".concat(e));var n=t.element[0].getBoundingClientRect();return[n.left+n.width*.5,n.bottom-8]}static dropLayoutMinorChange(e){for(var t=0;t<e.length;t+=1){var n=e[t],{content:r}=n;r!==void 0?(Lt(n)&&delete n.activeItemIndex,p.dropLayoutMinorChange(r)):ye(n)&&n.component==="IrisGridPanel"&&n.props.panelState!=null&&(delete n.id,n.props.panelState.irisGridState.sorts=[],n.props.panelState.irisGridState.quickFilters=[],n.props.panelState.gridState.isStuckToBottom=!1,n.props.panelState.gridState.isStuckToRight=!1)}}static isEqual(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=p.cloneLayout(e),o=p.cloneLayout(t);return n?(p.dropLayoutMinorChange(r),p.dropLayoutMinorChange(o),et(r,o)):et(r,o)}static cloneLayout(e){return JSON.parse(JSON.stringify(e))}static hydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var n=[],r=0;r<e.length;r+=1){var o=e[r];if(ye(o)){var s,{component:a,props:l={}}=o;n.push(Q(Q({},o),{},{id:(s=o==null?void 0:o.id)!==null&&s!==void 0?s:ke(),props:t(a,l)}))}else if(o.content!==void 0){var h=p.hydrateLayoutConfig(o.content,t);Lt(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=h.length&&(oe.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),n.push(Q(Q({},o),{},{content:h}))}else n.push(o)}return n}static openComponent(){var{root:e,config:t,stack:n=void 0,replaceExisting:r=!0,replaceConfig:o=void 0,createNewStack:s=!1,focusElement:a=void 0,dragEvent:l=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},h=document.activeElement,d=Q({},t);if(d.id==null&&(d.id=ke.generate()),l!=null){e==null||e.layoutManager.createDragSourceFromEvent(d,l);return}var u=o||{id:d.id,component:d.component};pt(e);var f=n??(s?p.addStack(e):p.getStackForRoot(e,u));pt(f);var v=p.getContentItemInStack(f,u);if(a!=null){var c=x=>{oe.debug("Component created, focusing element",a),f.off("componentCreated",c);var{element:E}=x.origin;requestAnimationFrame(()=>{p.focusElement(E[0],a)})};f.on("componentCreated",c)}if(r&&v){var g=f.contentItems.indexOf(v);f.addChild(d,g+1),f.removeChild(v),f.setActiveContentItem(f.contentItems[g])}else f.addChild(d);a==null&&h&&He(h)&&h.focus()}static openComponentInStack(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=document.activeElement,o={id:t.id},s=p.getContentItemInStack(e,o);if(n&&s&&e){var a=e==null?void 0:e.contentItems.indexOf(s);e.addChild(t,a+1),e.removeChild(s),e.setActiveContentItem(e.contentItems[a])}else e==null||e.addChild(t);r&&He(r)&&r.focus()}static closeComponent(e,t,n){var r=p.getStackForRoot(e,t,!1,!1,!1);if(!r){oe.warn("Cannot find stack for component, ignoring close",t);return}var o=p.getContentItemInStack(r,t),s=document.activeElement;o&&(U(o)?o.container.close(n):r.removeChild(o)),s&&document.contains(s)&&He(s)&&s.focus()}static renameComponent(e,t,n){var r=p.getStackForRoot(e,t,!1);if(!r){oe.error("Could not find stack for config",t);return}var o=p.getContentItemInStack(r,t);o&&o.setTitle(n)}static cloneComponent(e,t){var n=p.getStackForRoot(e,t,!1);if(!n)return oe.error("Could not find stack for config",t),null;var{props:r={}}=t,o=p.getPanelComponentState(t),s={type:"react-component",component:t.component,props:Q(Q({},r),{},{panelState:o}),title:"".concat(t.title," Copy"),id:ke.generate()};return p.openComponentInStack(n,s),s}static getPanelComponentState(e){if(ln(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(ye(e)){var n;return(n=e.props)===null||n===void 0?void 0:n.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:Tt.tabHeight,borderWidth:Tt.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=p.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return p.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,n=p.getComponentConfigFromContainer(t);if(n&&ye(n)){var r;return(r=n.component)!==null&&r!==void 0?r:null}return null}static getComponentName(e){var t,n,r=(t=(n=e.WrappedComponent)===null||n===void 0?void 0:n.displayName)!==null&&t!==void 0?t:e.displayName;if(r==null)throw new Error("Component displayName not defined ".concat(e));return r}static focusElement(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var n=e.querySelector(t);return n==null?null:(He(n)&&n.focus(),n)}static onInitialized(e){return new Promise(t=>{if(e.isInitialised){t();return}var n=()=>{e.off("initialised",n),t()};e.on("initialised",n)})}}an(p,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var ho=z.forwardRef((i,e)=>{var t=p.getComponentNameFromPanel({props:i});return b.jsx("div",{ref:e,className:"panel-placeholder",children:b.jsxs("div",{children:['Component "',t,'" is not registered.']})})});ho.displayName="PanelPlaceholder";const D=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 Xe(i){return(i==null?void 0:i.WrappedComponent)!==void 0}function uo(i){return typeof i.id=="string"&&i.layout instanceof xr&&i.panelManager instanceof mt&&typeof i.registerComponent=="function"}function as(i){if(!uo(i))throw new Error("Expected dashboard plugin props, but instead received ".concat(i))}function jt(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Rt(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?jt(Object(t),!0).forEach(function(n){ae(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):jt(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function ae(i,e,t){return e=co(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function co(i){var e=mo(i,"string");return typeof e=="symbol"?e:String(e)}function mo(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var K=Ce.module("PanelManager");class mt{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(a,l)=>l,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(a,l)=>l,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:new Map,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:()=>{};ae(this,"layout",void 0),ae(this,"hydrateComponent",void 0),ae(this,"dehydrateComponent",void 0),ae(this,"onPanelsUpdated",void 0),ae(this,"closed",void 0),ae(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=n,this.onPanelsUpdated=s,this.openedMap=new Map(r),this.closed=[...o],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(D.FOCUS,this.handleFocus),e.on(D.MOUNT,this.handleMount),e.on(D.UNMOUNT,this.handleUnmount),e.on(D.REOPEN,this.handleReopen),e.on(D.REOPEN_LAST,this.handleReopenLast),e.on(D.DELETE,this.handleDeleted),e.on(D.CLOSED,this.handleClosed),e.on(D.CLOSE,this.handleControlClose)}stopListening(){var{eventHub:e}=this.layout;e.off(D.FOCUS,this.handleFocus),e.off(D.MOUNT,this.handleMount),e.off(D.UNMOUNT,this.handleUnmount),e.off(D.REOPEN,this.handleReopen),e.off(D.REOPEN_LAST,this.handleReopenLast),e.off(D.DELETE,this.handleDeleted),e.off(D.CLOSED,this.handleClosed),e.off(D.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 p.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&ye(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,n=p.getStackForConfig(this.layout.root,{id:e});return(t=n&&p.getContentItemInStack(n,{id:e}))!==null&&t!==void 0?t:null}getLastUsedPanel(e){for(var t=this.getOpenedPanels(),n=t.length-1;n>=0;n-=1){var r=t[n];if(e==null||e(r))return r}}getLastUsedPanelOfType(e){return this.getLastUsedPanelOfTypes([e])}getLastUsedPanelOfTypes(e){return this.getLastUsedPanel(t=>e.some(n=>Xe(n)&&t instanceof n.WrappedComponent||!Xe(n)&&t instanceof n))}updatePanel(e){var t=p.getIdFromPanel(e);if(t==null){K.error("updatePanel Panel did not have an ID",e);return}K.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=p.getIdFromPanel(e);if(t==null){K.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){K.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){K.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}K.debug2("Removing panel ID ".concat(t," from open panels map")),this.openedMap.delete(t)}removeClosedPanelConfig(e){var t=this.closed.findIndex(n=>n===e||n.id!=null&&e.id!=null&&n.id===e.id);t>=0&&this.closed.splice(t,1)}handleFocus(e){K.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){K.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){K.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}handleReopen(e,t){K.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:n}=e,{props:r}=e;r=this.hydrateComponent(n,r);var o=Rt(Rt({},e),{},{props:r}),{root:s}=this.layout,a=e.parentStackId===void 0?void 0:p.getStackById(s,e.parentStackId);p.openComponent({root:s,config:o,replaceConfig:t,stack:a??void 0})}handleReopenLast(e){var t;if(this.closed.length!==0){if(e===void 0){this.handleReopen(this.closed[this.closed.length-1]);return}for(var n=(t=p.getStackForConfig(this.layout.root,e.getConfig()))===null||t===void 0?void 0:t.config.id,r=this.closed.length-1;r>=0;r-=1){var o=this.closed[r];if(o.parentStackId===n){this.handleReopen(o);return}}}}handleDeleted(e){K.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){K.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:n}=this.layout;p.closeComponent(n,t)}addClosedPanel(e){var{root:t}=this.layout,n=p.getComponentConfigFromContainer(e);if(n&&ye(n)){var r,o=this.dehydrateComponent(n.component,n);o.parentStackId=(r=p.getStackForConfig(t,n))===null||r===void 0?void 0:r.config.id,this.closed.push(o)}}sendUpdate(){var{closed:e,openedMap:t}=this;this.onPanelsUpdated({closed:[...e],openedMap:new Map(t)})}}ae(mt,"MAX_CLOSED_PANEL_COUNT",100);var fo=Ce.module("PanelErrorBoundary");class vo extends S.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}componentWillUnmount(){var{glContainer:e,glEventHub:t}=this.props,n=p.getIdFromContainer(e);fo.debug("componentWillUnmount",n),t.emit(D.CLOSED,n,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?b.jsx("div",{className:"panel-error-boundary",children:b.jsx(xn,{errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e}}function $t(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function qe(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?$t(Object(t),!0).forEach(function(n){po(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):$t(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function po(i,e,t){return e=go(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function go(i){var e=_o(i,"string");return typeof e=="symbol"?e:String(e)}function _o(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function hn(i){var{props:e,componentState:t}=i,{metadata:n}=e,{panelState:r=null}=e;t&&({panelState:r}=t);var o={};return n!=null&&(o.metadata=n),r!=null&&(o.panelState=r),qe(qe({},i),{},{componentState:null,props:o,type:"react-component"})}function dn(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return qe(qe({},i),{},{localDashboardId:e})}function bo(i){var e=Xe(i)&&i.WrappedComponent.prototype!=null&&i.WrappedComponent.prototype.isReactComponent!=null||i.prototype!=null&&i.prototype.isReactComponent!=null,t=!Xe(i)&&"$$typeof"in i&&i.$$typeof===An.ForwardRef;return e||t}const ls={dehydrate:hn,hydrate:dn};var hs=z.createContext(void 0),yo=C.shape({on:C.func,off:C.func,isHidden:C.bool,tab:C.shape({header:C.shape({tabs:C.arrayOf(C.shape({contentItem:C.shape({})}))})}),title:C.string,setTitle:C.func,close:C.func}),un=C.shape({on:C.func,off:C.func,emit:C.func}),wo=C.shape({registerComponent:C.func,root:C.shape({addChild:C.func}),on:C.func,off:C.func,eventHub:un}),Co=Object.freeze({Container:yo,EventHub:un,Layout:wo});function be(i,e,t){S.useEffect(function(){return i.on(e,t),()=>{i.off(e,t)}},[i,e,t])}var cn="SET_DASHBOARD_DATA";const Po=Kn(cn,{},!1),So={dashboardData:Po};var Io=new Map,mn=Object.freeze({}),Mo=Object.freeze([]),Eo=i=>i.dashboardData,Pe=(i,e)=>{var t;return(t=Eo(i)[e])!==null&&t!==void 0?t:mn},ds=(i,e)=>{var t;return(t=Pe(i,e).closed)!==null&&t!==void 0?t:Mo},us=(i,e)=>{var t;return(t=Pe(i,e).openedMap)!==null&&t!==void 0?t:Io},fn=(i,e)=>{var t;return(t=Pe(i,e).pluginDataMap)!==null&&t!==void 0?t:mn},cs=(i,e,t)=>fn(i,e)[t];function Nt(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function we(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Nt(Object(t),!0).forEach(function(n){Do(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Nt(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Do(i,e,t){return e=xo(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function xo(i){var e=Oo(i,"string");return typeof e=="symbol"?e:String(e)}function Oo(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var vn=(i,e)=>({type:cn,id:i,payload:e}),To=(i,e)=>(t,n)=>t(vn(i,we(we({},Pe(n(),i)),e))),ms=(i,e,t)=>(n,r)=>n(vn(i,we(we({},Pe(r(),i)),{},{pluginDataMap:we(we({},fn(r(),i)),{},{[e]:t})})));Object.entries(So).map(i=>{var[e,t]=i;return On.register(e,t)});function Ao(i){var{children:e}=i;return b.jsx(b.Fragment,{children:e})}function Ft(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function De(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ft(Object(t),!0).forEach(function(n){Lo(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Ft(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Lo(i,e,t){return e=jo(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function jo(i){var e=Ro(i,"string");return typeof e=="symbol"?e:String(e)}function Ro(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var ze=Ce.module("DashboardLayout"),$o=Object.freeze({}),No=[],Wt=()=>{},Bt=i=>i;function Fo(i){var e,t,{id:n,children:r,emptyDashboard:o=b.jsx("div",{children:"Dashboard is empty."}),layout:s,layoutConfig:a=No,onLayoutChange:l=Wt,onLayoutInitialized:h=Wt,hydrate:d=dn,dehydrate:u=hn,panelWrapper:f=Ao}=i,v=Ln(),c=(e=jn(_=>Pe(_,n)))!==null&&e!==void 0?e:$o,[g,x]=S.useState(!1),[E,T]=S.useState(!1),[P,G]=S.useState(),[N]=S.useState((t=c==null?void 0:c.closed)!==null&&t!==void 0?t:[]),[Z,j]=S.useState(s.getReactChildren()),R=S.useMemo(()=>new Map,[]),$=S.useMemo(()=>new Map,[]),he=S.useCallback(function(_,I){var M,Ie=arguments.length>2&&arguments[2]!==void 0?arguments[2]:d,ft=arguments.length>3&&arguments[3]!==void 0?arguments[3]:u;ze.debug2("registerComponent",_,I,Ie,ft);function vt(Ne,gn){var Ze=I,_n=f,bn=bo(Ze),{glContainer:yn,glEventHub:wn}=Ne;return b.jsx(vo,{glContainer:yn,glEventHub:wn,children:b.jsx(_n,De(De({},Ne),{},{children:bn?b.jsx(Ze,De(De({},Ne),{},{ref:gn})):b.jsx(Ze,De({},Ne))}))})}vt.displayName="DashboardWrapper(".concat((M=I.displayName)!==null&&M!==void 0?M:_,")");var pn=s.registerComponent(_,z.forwardRef(vt));return R.set(_,Ie),$.set(_,ft),pn},[d,u,R,$,s,f]),B=S.useCallback((_,I)=>{var M;return((M=R.get(_))!==null&&M!==void 0?M:Bt)(I,n)},[R,n]),ne=S.useCallback((_,I)=>{var M;return((M=$.get(_))!==null&&M!==void 0?M:Bt)(I,n)},[$,n]),X=S.useMemo(()=>new mt(s,B,ne,new Map,N,_=>{var{closed:I,openedMap:M}=_;v(To(n,{closed:I,openedMap:M}))}),[ne,v,B,n,N,s]),ie=S.useCallback(()=>{if(!E){var _=s.toConfig(),I=_.content,M=p.dehydrateLayoutConfig(I,ne),Ie=P==null||!p.isEqual(P,M);ze.debug("handleLayoutStateChanged",Ie,I,M),Ie&&(x(s.root.contentItems.length===0),G(M),l(M),j(s.getReactChildren()))}},[ne,E,P,s,l]),q=S.useCallback(_=>{var I=p.getIdFromContainer(_);s.eventHub.emit(D.DRAGGING,I),T(!0)},[s.eventHub]),J=S.useCallback(_=>{var I=p.getIdFromContainer(_);s.eventHub.emit(D.DROPPED,I),T(!1)},[s.eventHub]),ve=S.useCallback(_=>{if(ze.debug2("handleComponentCreated",_),!(_==null||_.config==null||_.config.component==null||_.element==null)){var I=_.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),M="".concat(I,"-component");_.element.addClass(M)}},[]),Se=S.useCallback(()=>{j(s.getReactChildren())},[s]);be(s,"stateChanged",ie),be(s,"itemPickedUp",q),be(s,"itemDropped",J),be(s,"componentCreated",ve),be(s.eventHub,D.TITLE_CHANGED,ie),be(s,"reactChildrenChanged",Se);var pe=ei(a);return S.useEffect(function(){if(pe!==a&&a!==P){ze.debug("Setting new layout content...");for(var I=p.hydrateLayoutConfig(a,B);s.root.contentItems.length>0;)s.root.contentItems[0].remove();for(var M=0;M<I.length;M+=1)s.root.addChild(I[M]);x(s.root.contentItems.length===0)}},[B,s,a,P,X,pe]),S.useEffect(()=>h(),[]),b.jsxs(b.Fragment,{children:[g&&o,Z,z.Children.map(r,_=>_!=null?z.cloneElement(_,{id:n,layout:s,panelManager:X,registerComponent:he}):null)]})}Fo.propTypes={id:C.string.isRequired,children:C.node,data:C.shape({}),emptyDashboard:C.node,layout:Co.Layout.isRequired,layoutConfig:C.arrayOf(C.shape({})),onLayoutChange:C.func,onLayoutInitialized:C.func};var fs="default";export{Pe as $,es as A,pi as B,Xo as C,fs as D,Ko as E,ts as F,_i as G,Kt as H,ns as I,wt as J,be as K,p as L,hs as M,cs as N,ci as O,D as P,Fo as Q,ls as R,Co as S,Qn as T,vo as U,mt as V,cn as W,as as X,bo as Y,hn as Z,ds as _,Eo as a,us as a0,fn as a1,dn as a2,uo as a3,Xe as a4,So as a5,vn as a6,To as a7,xr as a8,ho as a9,Bn as aa,Vo as ab,Uo as ac,Fn as ad,ko as ae,zo as af,U as ag,ms as b,ei as c,Go as d,ue as e,ri as f,Jo as g,zt as h,kt as i,qo as j,Zo as k,Qo as l,Ct as m,os as n,lt as o,Le as p,mi as q,Yo as r,Ho as s,is as t,Ht as u,rs as v,bi as w,gi as x,vi as y,fi as z};
2
- //# sourceMappingURL=DashboardConstants-02ead187.js.map
1
+ import{aH as Cn,aI as Pn,aJ as Sn,k as In,L as Ce,q as Mn,F as En,a4 as Dn,l as pt,a as xn,aK as On}from"./index-635efb82.js";import{bn as et,r as S,M as z,I as b,K as Oe,L as Ue,bp as m,Q as ke,R as Tn,bq as gt,br as An,ab as C,N as Ln,O as jn}from"./vendor-e3051ace.js";function _t(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function de(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_t(Object(t),!0).forEach(function(n){Rn(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):_t(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Rn(i,e,t){return e=$n(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function $n(i){var e=Nn(i,"string");return typeof e=="symbol"?e:String(e)}function Nn(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var Ho=i=>({type:Cn,payload:i}),Fn=i=>({type:Sn,payload:i}),Wn=i=>(e,t)=>{e(Fn(i));var{storage:n}=t(),{workspaceStorage:r}=n;return r==null?void 0:r.save(i)},Bn=i=>(e,t)=>{var{workspace:n}=t(),{data:r}=n??{},o=de(de({},n),{},{data:de(de(de({},r),i),{},{settings:de(de({},r==null?void 0:r.settings),i.settings)})});return e(Wn(o))},zo=i=>e=>e(Bn({settings:i})),ko=i=>({type:Pn,payload:i});function bt(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function yt(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bt(Object(t),!0).forEach(function(n){Hn(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):bt(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Hn(i,e,t){return e=zn(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function zn(i){var e=kn(i,"string");return typeof e=="symbol"?e:String(e)}function kn(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function Kn(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,r=arguments.length>1?arguments[1]:void 0;switch(r.type){case i:{var{id:o,payload:s}=r;return t&&et({payload:s},{payload:n[o]})?n:yt(yt({},n),{},{[o]:s})}default:return n}}}var Ko=Object.freeze([]),Uo=new Map,Go=()=>{};function Yo(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return e.filter(n=>n!=null)}function Un(i,e,t){return e=Gn(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Gn(i){var e=Yn(i,"string");return typeof e=="symbol"?e:String(e)}function Yn(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Vn extends Error{constructor(){super(...arguments),Un(this,"isCanceled",!0)}}const wt=Vn;function Xn(i,e,t){return e=qn(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function qn(i){var e=Zn(i,"string");return typeof e=="symbol"?e:String(e)}function Zn(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Jn extends Error{constructor(){super(...arguments),Xn(this,"isTimeout",!0)}}const Qn=Jn;class Ct{static makeCancelable(e,t){var n=!1,r,o,s=new Promise((a,l)=>{o=l,Promise.resolve(e).then(h=>{n?t&&t(h):(r=h,a(h))}).catch(h=>l(h))});return s.cancel=()=>{n=!0,o(new wt),r!=null&&t&&t(r)},s}static isCanceled(e){return e instanceof wt}static isTimedOut(e){return e instanceof Qn}static withTimeout(e,t){return new Promise((n,r)=>{setTimeout(()=>{try{n(t())}catch(o){r(o)}},e)})}}function Ht(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"No value available in context. Was code wrapped in a provider?",t=S.useContext(i);if(t==null)throw new Error(e);return t}function ei(i){var e=S.useRef();return S.useEffect(function(){e.current=i}),e.current}function ti(i,e,t){return e=ni(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ni(i){var e=ii(i,"string");return typeof e=="symbol"?e:String(e)}function ii(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function Vo(i){return i.then!==void 0}class le{static disableAllActions(){le.actionsDisabled=!0}static enableAllActions(){le.actionsDisabled=!1}static isContextActionEvent(e){return Array.isArray(e.contextActions)}static compareActions(e,t){if(e.group!==t.group){var n,r;return((n=e.group)!==null&&n!==void 0?n:0)>((r=t.group)!==null&&r!==void 0?r:0)?1:-1}if(e.order!==t.order){var o,s;return((o=e.order)!==null&&o!==void 0?o:0)>((s=t.order)!==null&&s!==void 0?s:0)?1:-1}if(e.title!==t.title){var a,l;return((a=e.title)!==null&&a!==void 0?a:"")>((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(le.compareActions),t}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return le.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){var t=le.getModifierKey();return e[t]}static getMenuItems(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=[],r=e;Array.isArray(r)||(r=[r]);for(var o=0;o<r.length;o+=1){var s=r[o],a=void 0;typeof s=="function"?a=s():a=s,a!=null&&(a instanceof Promise?t&&n.push(a):Array.isArray(a)?n=n.concat(a):n.push(a))}return n=n.filter(l=>l.title!==void 0||l.then!=null||l.menuElement),n}static getNextMenuItem(e,t,n){var r=e;r<0&&t<0&&(r=n.length);for(var o=1;o<n.length+1;o+=1){var s=(r+t*o+n.length)%n.length,a=n[s];if(!(a instanceof Promise)&&a.disabled!==!0)return s}return e}}ti(le,"actionsDisabled",!1);const ue=le;var at=z.forwardRef((i,e)=>{var t,n;function r(j){var{menuItem:R,onMenuItemClick:$}=i;$(R,j)}function o(j){var{menuItem:R,onMenuItemMouseMove:$}=i;$(R,j)}function s(j){var{menuItem:R,onMenuItemContextMenu:$}=i;$(R,j)}function a(j,R,$){if(typeof j.type=="string")return j;var{closeMenu:he,menuItem:B,isKeyboardSelected:ne,isMouseSelected:X,"data-testid":ie}=i,q={menuItem:B,closeMenu:he,isKeyboardSelected:ne,isMouseSelected:X,iconElement:R,displayShortcut:$,"data-testid":ie};return z.cloneElement(j,{forwardedProps:q})}var{children:l,menuItem:h,isKeyboardSelected:d=!1,isMouseSelected:u=!1,"data-testid":f}=i,v=(t=h.shortcutText)!==null&&t!==void 0?t:(n=h.shortcut)===null||n===void 0?void 0:n.getDisplayText(),c=null;if(h.icon){var g=h.icon;if(z.isValidElement(g))c=g;else{var x;h.iconColor!=null&&(h.disabled===void 0||!h.disabled)&&(x={color:h.iconColor}),c=b.jsx(Ue,{icon:g,style:x})}}var E=null,T=!!l;h.actions&&(E=b.jsx(Ue,{icon:In}));var P=null;if(h.menuElement)P=b.jsx("div",{className:"custom-menu-item",onMouseMove:o,children:a(h.menuElement,c,v)});else{var G,N=h.disabled,Z=h.iconOutline;P=b.jsx("button",{type:"button",className:Oe("btn-context-menu",{disabled:N},{active:(T||u)&&(N===void 0||!N)},{"keyboard-active":d&&(N===void 0||!N)}),onClick:r,onMouseMove:o,onContextMenu:s,title:(G=h.description)!==null&&G!==void 0?G:"",children:b.jsxs("div",{className:"btn-context-menu-wrapper",children:[b.jsx("span",{className:Oe("icon",{outline:Z}),children:c}),b.jsx("span",{className:"title",children:h.title}),v!==void 0&&b.jsx("span",{className:"shortcut",children:v}),E&&b.jsx("span",{className:Oe("submenu-indicator",{disabled:N}),children:E})]})})}return b.jsxs("div",{className:"context-menu-item",ref:e,"data-testid":f,children:[l,P]})});at.displayName="ContextMenuItem";at.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const ri=at;function Pt(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function oi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Pt(Object(t),!0).forEach(function(n){se(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Pt(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function se(i,e,t){return e=si(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function si(i){var e=ai(i,"string");return typeof e=="symbol"?e:String(e)}function ai(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var St=Ce.module("ContextMenu");class Te extends S.PureComponent{static handleContextMenu(e){e.metaKey||(e.stopPropagation(),e.preventDefault())}constructor(e){super(e),se(this,"container",void 0),se(this,"oldFocus",void 0),se(this,"activeSubMenuRef",void 0),se(this,"subMenuTimer",void 0),se(this,"rAF",void 0),se(this,"initialPosition",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleCloseSubMenu=this.handleCloseSubMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemContextMenu=this.handleMenuItemContextMenu.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowResize=this.handleWindowResize.bind(this),this.container=z.createRef(),this.oldFocus=document.activeElement,this.activeSubMenuRef=z.createRef(),this.subMenuTimer=0,this.rAF=0,this.initialPosition={top:e.top,left:e.left},this.state={menuItems:[],pendingItems:[],activeSubMenu:null,hasOverflow:!1,subMenuTop:null,subMenuLeft:null,subMenuParentWidth:0,subMenuParentHeight:0,keyboardIndex:-1,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.verifyPosition(),window.addEventListener("resize",this.handleWindowResize),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,t){var{actions:n}=this.props,{activeSubMenu:r}=this.state;if(r!==t.activeSubMenu)if(r==null){var o;(o=this.container.current)===null||o===void 0||o.focus()}else this.setActiveSubMenuPosition();if(e.actions!==n&&(this.initMenu(),this.container.current==null||!this.container.current.contains(document.activeElement))){var s;(s=this.container.current)===null||s===void 0||s.focus()}this.verifyPosition()}componentWillUnmount(){this.cancelPromises(),window.removeEventListener("resize",this.handleWindowResize),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(){this.cancelPromises(),cancelAnimationFrame(this.rAF);var{options:e}=this.props,t=e.initialKeyboardIndex;t===void 0&&(t=-1);for(var{actions:n}=this.props,r=ue.getMenuItems(n),o=[],s=r.length-1;s>=0;s-=1){var a=r[s];a instanceof Promise?this.initMenuPromise(a):o.push(a)}this.setState({mouseIndex:-1,keyboardIndex:t,activeSubMenu:null,menuItems:ue.sortActions(o)})}initMenuPromise(e){var t=Ct.makeCancelable(e);this.setState(n=>({pendingItems:n.pendingItems.concat(t)})),t.then(n=>{this.setState(r=>{var o=r.pendingItems.indexOf(t);if(o>=0){var s=r.pendingItems.slice();return s.splice(o,1),{menuItems:ue.sortActions(r.menuItems.concat(n)),pendingItems:s}}return null})},n=>{Ct.isCanceled(n)||(this.setState(r=>{var o=r.pendingItems.indexOf(t);if(o>=0){var s=r.pendingItems.slice();return s.splice(o,1),{pendingItems:s}}return null}),St.error(n))})}cancelPromises(){var{pendingItems:e}=this.state;e.map(t=>t.cancel())}setActiveSubMenuPosition(){if(this.activeSubMenuRef.current!==null){var e=this.activeSubMenuRef.current.getBoundingClientRect();this.setState({subMenuTop:e.top,subMenuLeft:e.right,subMenuParentHeight:e.height,subMenuParentWidth:e.width})}}verifyPosition(){var e,t,n,r,{options:o,updatePosition:s,subMenuParentWidth:a,subMenuParentHeight:l,top:h,left:d}=this.props;if(!(!this.container.current||o.doNotVerifyPosition!=null&&o.doNotVerifyPosition)){var{top:u,left:f}=this.initialPosition,{width:v,height:c}=(e=(t=this.container.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:{width:0,height:0},g=((n=(r=this.container.current)===null||r===void 0?void 0:r.scrollHeight)!==null&&n!==void 0?n:0)>window.innerHeight;c===0||v===0||(u+c>window.innerHeight&&(u-c-l>0?u-=c-l:u=window.innerHeight-c),f+v>window.innerWidth&&(f=f-v-a),(d!==f||h!==u)&&(this.setState({hasOverflow:g}),s(u,f)))}}handleWindowResize(){this.container.current&&this.closeMenu(!0)}handleBlur(e){if(!this.container.current){St.warn("Container is null!");return}if(!this.container.current.contains(e.relatedTarget)){for(var t=e.relatedTarget,n=!1;t&&!n;)n=t.hasAttribute("data-dh-context-menu"),t=t.parentElement;n||this.closeMenu(!0)}}isEscapeKey(e){var{left:t}=this.props;return e==="Escape"||t<0&&e==="ArrowRight"||e==="ArrowLeft"}handleKeyDown(e){var{menuItems:t}=this.state,n=this.getKeyboardIndex(),r=n,o=!1;if(e.key==="Enter"||e.key===" "){n>=0&&n<t.length&&this.handleMenuItemClick(t[n],e);return}if(e.key==="ArrowRight"?n>=0&&n<=t.length?o=!0:r=0:this.isEscapeKey(e.key)?r=null:e.key==="ArrowUp"||e.shiftKey&&e.key==="Tab"?r=ue.getNextMenuItem(r,-1,t):(e.key==="ArrowDown"||e.key==="Tab")&&(r=ue.getNextMenuItem(r,1,t)),o){this.openSubMenu(n),e.preventDefault(),e.stopPropagation();return}n!==r&&(r!==null?this.setKeyboardIndex(r):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}openSubMenu(e){var{menuItems:t,activeSubMenu:n}=this.state,r=t[e].actions?e:null;n!==r&&this.setState({activeSubMenu:r,subMenuTop:null,subMenuLeft:null})}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{closeMenu:t,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),n(this)})}closeSubMenu(){this.setState({activeSubMenu:null})}handleCloseSubMenu(e){e?this.closeMenu(!0):this.closeSubMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation();var{menuItems:n}=this.state;e!=null&&(e.disabled===void 0||!e.disabled)&&(e.actions!=null?this.openSubMenu(n.indexOf(e)):e.action!=null&&(e.action(t.nativeEvent),this.closeMenu(!0)))}handleMenuItemContextMenu(e,t){t.metaKey||this.handleMenuItemClick(e,t)}handleMenuItemMouseMove(e){var{menuItems:t}=this.state,n=t.indexOf(e);this.setMouseIndex(n),n>=0&&n<t.length&&(e.disabled===void 0||!e.disabled)&&this.openSubMenu(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{top:t,left:n}=this.props,{activeSubMenu:r,hasOverflow:o,keyboardIndex:s,menuItems:a,mouseIndex:l,pendingItems:h,subMenuTop:d,subMenuLeft:u,subMenuParentWidth:f,subMenuParentHeight:v}=this.state,c=0;c<a.length;c+=1){var g=a[c];c>0&&g.group!==a[c-1].group&&e.push(b.jsx("hr",{},"".concat(c,".separator")));var x=b.jsx(ri,{ref:r===c?this.activeSubMenuRef:null,isKeyboardSelected:s===c,isMouseSelected:l===c,menuItem:g,closeMenu:this.handleCloseSubMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:this.handleMenuItemContextMenu},c);e.push(x)}var E=null;h.length>0&&(E=b.jsx("div",{className:"loading",children:b.jsx(Mn,{className:"loading-spinner-vertical-align"})}));var{menuStyle:T,"data-testid":P}=this.props,G=r!==null&&d!==null&&u!==null;return b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:Oe({"has-overflow":o},"context-menu-container"),style:oi({top:t,left:n},T),ref:this.container,"data-dh-context-menu":!0,onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,onContextMenu:Te.handleContextMenu,role:"menuitem",tabIndex:0,"data-testid":P,children:[e,E]}),G&&r!==null&&d!==null&&u!==null&&b.jsx(Te,{actions:a[r].actions||[],closeMenu:this.handleCloseSubMenu,top:d,left:u,updatePosition:(N,Z)=>{this.setState({subMenuTop:N,subMenuLeft:Z})},subMenuParentWidth:f,subMenuParentHeight:v},"sub-".concat(r))]})}}se(Te,"defaultProps",{subMenuParentWidth:0,subMenuParentHeight:0,closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});const li=Te;function It(i,e,t){return e=hi(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function hi(i){var e=di(i,"string");return typeof e=="symbol"?e:String(e)}function di(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class ui extends S.Component{constructor(e){super(e),It(this,"container",void 0),It(this,"openMenu",void 0),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=z.createRef(),this.openMenu=z.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(e){if(this.container.current){var t=this.container.current.getBoundingClientRect(),n=e.clientY-t.top,r=e.clientX-t.left,{actions:o}=this.state;if(o!=null&&e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{var a=document.elementFromPoint(r,n),l=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});a==null||a.dispatchEvent(l)});return}if(ue.isContextActionEvent(e)&&!(e.metaKey||e.ctrlKey)){var s=ue.getMenuItems(e.contextActions);s.length!==0&&(e.preventDefault(),this.setState({actions:s,top:n,left:r}))}}}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){var e=null,{"data-testid":t}=this.props,{actions:n,top:r,left:o}=this.state;return n&&(e=b.jsx(li,{ref:this.openMenu,actions:n,onMenuClosed:this.handleMenuClose,top:r,left:o,updatePosition:(s,a)=>{this.setState({top:s,left:a})},"data-testid":t})),b.jsx("div",{className:Oe("context-menu-root",{active:n}),ref:this.container,children:e})}}const Xo=ui;function zt(i){return typeof i=="object"&&i!=null&&typeof i.type=="string"&&i.name!=null}function kt(i){return typeof i=="object"&&i!=null&&typeof i.type=="string"&&i.id!=null}function qo(i){return zt(i)||kt(i)}var ci=S.createContext(null);function Zo(i){if(kt(i))return{id:i.id,type:i.type};if(zt(i)){var e;return{name:(e=i.name)!==null&&e!==void 0?e:"",type:i.type}}throw new Error("Invalid descriptor: ".concat(i))}function Jo(i){var e,t;return{type:(e=i.type)!==null&&e!==void 0?e:"",name:(t=i.title)!==null&&t!==void 0?t:i.name,id:i.id}}function Qo(){return Ht(ci,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}var mi=S.createContext(null),Le=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin"});function fi(i){return"DashboardPlugin"in i}function vi(i){return"AuthPlugin"in i}function pi(i){return"TablePlugin"in i}function es(i){return fi(i)||vi(i)||pi(i)}function gi(i){return"type"in i&&i.type===Le.DASHBOARD_PLUGIN}function lt(i){return"type"in i&&i.type===Le.WIDGET_PLUGIN}function _i(i){return"type"in i&&i.type===Le.TABLE_PLUGIN}function bi(i){return"type"in i&&i.type===Le.AUTH_PLUGIN}function Kt(i){return"type"in i&&i.type===Le.THEME_PLUGIN}function ts(i){return gi(i)||bi(i)||_i(i)||Kt(i)||lt(i)}var yi=Ce.module("@deephaven/plugin.PluginUtils");function ns(i,e){return i==null||!lt(i)?!1:[i.supportedTypes].flat().some(t=>t===e)}function is(i){var e=b.jsx(Ue,{icon:Dn});if(!lt(i))return e;var{icon:t}=i;return t==null?e:S.isValidElement(t)?t:b.jsx(Ue,{icon:t})}function rs(i){var e=[...i.entries()].filter(t=>Kt(t[1]));return yi.debug("Getting theme data from plugins",e),e.map(t=>{var[n,r]=t,o=Array.isArray(r.themes)?r.themes:[r.themes];return o.map(s=>{var{name:a,baseTheme:l,styleContent:h}=s;return{baseThemeKey:"default-".concat(l??"dark"),themeKey:En(n,a),name:a,styleContent:h}})}).flat()}function os(){return Ht(mi,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}var Ut=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 Gt(i){return i.componentName!==void 0}function wi(i){return i.component!==void 0}var Yt=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const Ci=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:Ut,isGLComponentConfig:Gt,isReactComponentConfig:wi,itemDefaultConfig:Yt},Symbol.toStringTag,{value:"Module"}));function Ke(i,e,t){return e=Pi(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Pi(i){var e=Si(i,"string");return typeof e=="symbol"?e:String(e)}function Si(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Ae{constructor(){Ke(this,"_mSubscriptions",void 0),Ke(this,"off",this.unbind),Ke(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[Ae.ALL_EVENT]=[]}on(e,t,n){if(typeof t!="function")throw new Error("Tried to listen to event "+e+" with non-function callback "+t);this._mSubscriptions[e]||(this._mSubscriptions[e]=[]),this._mSubscriptions[e].push({fn:t,ctx:n})}emit(e){for(var t=this._mSubscriptions[e],n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];if(t)for(var s=0;s<t.length;s++){var a=t[s].ctx||{};try{t[s].fn.apply(a,r)}catch(u){console.error("Error while emitting event:",u)}}r.unshift(e);for(var l=this._mSubscriptions[Ae.ALL_EVENT],h=0;h<l.length;h++){var d=l[h].ctx||{};try{l[h].fn.apply(d,r)}catch(u){console.error("Error while emitting event to allEventSubs:",u)}}}unbind(e,t,n){if(!this._mSubscriptions[e])throw new Error("No subscriptions to unsubscribe for event "+e);for(var r=!1,o=0;o<this._mSubscriptions[e].length;o++)(!t||this._mSubscriptions[e][o].fn===t)&&(!n||n===this._mSubscriptions[e][o].ctx)&&(this._mSubscriptions[e].splice(o,1),r=!0);if(r===!1)throw new Error("Nothing to unbind for "+e)}}Ke(Ae,"ALL_EVENT","__all");const V=Ae;function Y(i,e,t){return e=Ii(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ii(i){var e=Mi(i,"string");return typeof e=="symbol"?e:String(e)}function Mi(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class tt extends V{constructor(e,t,n){super(),Y(this,"width",void 0),Y(this,"height",void 0),Y(this,"title",void 0),Y(this,"parent",void 0),Y(this,"layoutManager",void 0),Y(this,"tab",void 0),Y(this,"_config",void 0),Y(this,"isHidden",!1),Y(this,"beforeCloseHandler",void 0),Y(this,"_element",m(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),Y(this,"_contentElement",void 0),this.title=Gt(e)?e.componentName:"",this.parent=t,this.layoutManager=n,this._config=e,this._contentElement=this._element.find(".lm_content"),this.beforeCloseHandler=null}getElement(){return this._contentElement}hide(){this.emit("hide"),this.isHidden=!0,this._element.hide()}show(){this.emit("show"),this.isHidden=!1,this._element.show(),(this.height!=0||this.width!=0)&&this.emit("shown")}setSize(e,t){for(var n,r,o,s=this.parent,a=null;s&&!s.isColumn&&!s.isRow;){var l;if(a=s,s=s.parent,(l=s)!==null&&l!==void 0&&l.isRoot)return!1}if(!s||!a)return!1;for(var h=s.isColumn?"height":"width",d=h==="height"?t:e,u=((n=this[h])!==null&&n!==void 0?n:0)*(1/(((r=a.config[h])!==null&&r!==void 0?r:0)/100)),f=d/u*100,v=(((o=a.config[h])!==null&&o!==void 0?o:0)-f)/(s.contentItems.length-1),c=0;c<s.contentItems.length;c++)if(s.contentItems[c]===a)s.contentItems[c].config[h]=f;else{var g;s.contentItems[c].config[h]=((g=s.contentItems[c].config[h])!==null&&g!==void 0?g:0)+v}return s.callDownwards("setSize"),!0}close(e){var t,n;this._config.isClosable&&(!((t=(n=this.beforeCloseHandler)===null||n===void 0?void 0:n.call(this,e))!==null&&t!==void 0)||t)&&(this.emit("close"),this.parent.close())}beforeClose(e){this.beforeCloseHandler=e}getState(){return this._config.componentState}getConfig(){return this._config}extendState(e){this.setState(m.extend(!0,this.getState(),e))}setState(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")}setTitle(e){this.parent.setTitle(e)}_$setSize(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(e!==this.width||t!==this.height){this.width=e,this.height=t;var n=this._contentElement[0],r=n.offsetWidth-n.clientWidth,o=n.offsetHeight-n.clientHeight;this._contentElement.width(this.width-r).height(this.height-o),this.emit("resize")}}}const Ei=Object.freeze(Object.defineProperty({__proto__:null,Container:tt,ItemContainer:tt},Symbol.toStringTag,{value:"Module"}));function Vt(i){var e=location.hash.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null}function Xt(i){if(window.location.hash)return Vt(i);if(!window.location.search)return null;var e=window.location.search.substr(1).split("&"),t={},n,r;for(r=0;r<e.length;r++)n=e[r].split("="),t[n[0]]=n[1];return t[i]||null}function ht(i){return window.requestAnimationFrame(i)}function Di(i,e){var t=e.indexOf(i);if(t===-1)throw new Error("Can't remove item from array. Item is not in the array");e.splice(t,1)}function Ge(){return ke()}function xi(i,e){var t=i.replace(/javascript/gi,"j&#97;vascript").replace(/expression/gi,"expr&#101;ssion").replace(/onload/gi,"onlo&#97;d").replace(/script/gi,"&#115;cript").replace(/onerror/gi,"on&#101;rror");return e===!0?t:t.replace(/>/g,"&gt;").replace(/</g,"&lt;")}function dt(i){return m.trim(i.replace(/(<([^>]+)>)/gi,""))}function H(i,e,t){return e=Oi(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Oi(i){var e=Ti(i,"string");return typeof e=="symbol"?e:String(e)}function Ti(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Ai extends V{constructor(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super(),H(this,"_eElement",void 0),H(this,"_oDocument",void 0),H(this,"_eBody",void 0),H(this,"_destroyAfterMouseUp",void 0),H(this,"_nDelay",400),H(this,"_timeout",void 0),H(this,"timeout",void 0),H(this,"_nDistance",10),H(this,"_nX",0),H(this,"_nY",0),H(this,"_nOriginalX",0),H(this,"_nOriginalY",0),H(this,"_bDragging",!1),this._eElement=e,this._oDocument=m(document),this._eBody=m(document.body),this._destroyAfterMouseUp=n,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this._startDrag=this._startDrag.bind(this),(t=this._eElement)===null||t===void 0||t.on("mousedown",this.onMouseDown)}destroy(){var e,t;(e=this._eElement)===null||e===void 0||e.unbind("mousedown",this.onMouseDown),(t=this._oDocument)===null||t===void 0||t.unbind("mouseup",this.onMouseUp),this._eElement=void 0,this._oDocument=void 0,this._eBody=void 0,clearTimeout(this._timeout),this._timeout=void 0}onMouseDown(e){if(e.preventDefault(),e.button===0){var t,n,r,o,s=this._getCoordinates(e);this._nOriginalX=(t=s.x)!==null&&t!==void 0?t:0,this._nOriginalY=(n=s.y)!==null&&n!==void 0?n:0,(r=this._oDocument)===null||r===void 0||r.on("mousemove",this.onMouseMove),(o=this._oDocument)===null||o===void 0||o.on("mouseup",this.onMouseUp),this._timeout=window.setTimeout(this._startDrag,this._nDelay)}}onMouseMove(e){if(this._timeout!=null){var t,n;e.preventDefault();var r=this._getCoordinates(e);this._nX=((t=r.x)!==null&&t!==void 0?t:0)-this._nOriginalX,this._nY=((n=r.y)!==null&&n!==void 0?n:0)-this._nOriginalY,this._bDragging===!1&&(Math.abs(this._nX)>this._nDistance||Math.abs(this._nY)>this._nDistance)&&this._startDrag(),this._bDragging&&this.emit("drag",this._nX,this._nY,e)}}onMouseUp(e){if(this._timeout!=null){var t,n,r,o,s;if(clearTimeout(this._timeout),(t=this._oDocument)===null||t===void 0||t.unbind("mousemove",this.onMouseMove),(n=this._oDocument)===null||n===void 0||n.unbind("mouseup",this.onMouseUp),(r=this._oDocument)===null||r===void 0||(o=r.find("iframe"))===null||o===void 0||o.css("pointer-events",""),this._bDragging===!0&&(this._bDragging=!1,this.emit("dragStop",e,this._nOriginalX+this._nX)),(s=this._eBody)===null||s===void 0||s.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var a;(a=this._eElement)===null||a===void 0||a.removeClass("lm_dragging")}this._destroyAfterMouseUp&&this.destroy()}}_startDrag(){var e,t,n,r;window.clearTimeout(this._timeout),this._bDragging=!0,(e=this._eBody)===null||e===void 0||e.addClass("lm_dragging"),(t=this._eElement)===null||t===void 0||t.addClass("lm_dragging"),(n=this._oDocument)===null||n===void 0||(r=n.find("iframe"))===null||r===void 0||r.css("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)}_getCoordinates(e){var t,n;return{x:(t=e.pageX)!==null&&t!==void 0?t:0,y:(n=e.pageY)!==null&&n!==void 0?n:0}}}const je=Ai;function ge(i,e,t){return e=Li(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Li(i){var e=ji(i,"string");return typeof e=="symbol"?e:String(e)}function ji(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class qt{constructor(e,t){ge(this,"_container",void 0),ge(this,"_reactComponent",null),ge(this,"_portalComponent",null),ge(this,"_originalComponentWillUpdate",null),ge(this,"_initialState",void 0),ge(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=Tn.createPortal(this._getReactComponent(),this._container.getElement()[0],e),this._container.layoutManager.addReactChild(e,this._portalComponent)}_gotReactComponent(e){if(e){this._reactComponent=e,this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate||function(){},this._reactComponent.componentWillUpdate=this._onUpdate.bind(this);var t=this._container.getState();t&&this._reactComponent.setState(t)}}_destroy(){this._container.layoutManager.removeReactChild(this._key(),this._portalComponent),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)}_onUpdate(e,t){var n;this._container.setState(t),(n=this._originalComponentWillUpdate)===null||n===void 0||n.call(this._reactComponent,e,t)}_getReactClass(){var e=this._container._config.component;if(!e)throw new Error("No react component name. type: react-component needs a field `component`");var t=this._container.layoutManager.getComponent(e)||this._container.layoutManager.getFallbackComponent();if(!t)throw new Error('React component "'+e+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return t}_getReactComponent(){var e={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},t=m.extend(e,this._container._config.props);return z.createElement(this._reactClass,t)}}var Ye=["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"],Ri=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function ut(i){if(Ye.length>36)throw new Error("Too many keys in config minifier map");var e={};return ct(i,e,"_min"),e}function nt(i){if(Ye.length>36)throw new Error("Too many keys in config minifier map");var e={};return ct(i,e,"_max"),e}function ct(i,e,t){var n=t==="_min"?$i:Ni;for(var r in i)if(i.hasOwnProperty(r)){var o=Array.isArray(i)?i[Number.parseInt(r,10)]:i[r];if(typeof o=="object"&&o!=null){var s=o instanceof Array?[]:{};if(Array.isArray(e))e[Number.parseInt(r,10)]=s;else{var a=n(r,Ye);e[a]=s}ct(o,s,t)}else{var l=n(o,Ri);if(Array.isArray(e))e[Number.parseInt(r,10)]=l;else{var h=n(r,Ye);e[h]=l}}}}function $i(i,e){if(typeof i=="string"&&i.length===1)return"___"+i;var t=e.indexOf(i);return t===-1?i:t.toString(36)}function Ni(i,e){return typeof i=="string"&&i.length===1?e[parseInt(i,36)]:typeof i=="string"&&i.substr(0,3)==="___"?i[3]:i}function Je(i,e,t){return e=Fi(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Fi(i){var e=Wi(i,"string");return typeof e=="symbol"?e:String(e)}function Wi(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class it{constructor(e,t){Je(this,"name",void 0),Je(this,"origin",void 0),Je(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function Fe(i,e,t){return e=Bi(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Bi(i){var e=Hi(i,"string");return typeof e=="symbol"?e:String(e)}function Hi(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}let zi=class extends V{constructor(e){super(),Fe(this,"_layoutManager",void 0),Fe(this,"_dontPropagateToParent",void 0),Fe(this,"_childEventSource",void 0),Fe(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(V.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),m(window).on("gl_child_event",this._boundOnEventFromChild)}_onEventFromThis(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._layoutManager.isSubWindow&&t[0]!==this._dontPropagateToParent&&this._propagateToParent(t),this._propagateToChildren(t),this._dontPropagateToParent=null,this._childEventSource=null}_$onEventFromParent(e){this._dontPropagateToParent=e[0],this.emit.apply(this,e)}_onEventFromChild(e){this._childEventSource=e.originalEvent.__gl,this.emit.apply(this,e.originalEvent.__glArgs)}_propagateToParent(e){var t,n="gl_child_event",r=(t=window.opener)===null||t===void 0?void 0:t.document.createEvent("HTMLEvents");r.initEvent(n,!0,!0),r.eventName=n,r.__glArgs=e,r.__gl=this._layoutManager,window.opener.dispatchEvent(r)}_propagateToChildren(e){for(var t=0;t<this._layoutManager.openPopouts.length;t++){var n=this._layoutManager.openPopouts[t].getGlInstance();n&&n!==this._childEventSource&&n.eventHub._$onEventFromParent(e)}}destroy(){m(window).off("gl_child_event",this._boundOnEventFromChild)}};const Zt=zi,ki=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:it,DragListener:je,EventEmitter:V,EventHub:Zt,ReactComponentHandler:qt,animFrame:ht,filterXss:xi,getHashValue:Vt,getQueryStringParam:Xt,getUniqueId:Ge,minifyConfig:ut,removeFromArray:Di,stripTags:dt,unminifyConfig:nt},Symbol.toStringTag,{value:"Module"}));function re(i,e,t){return e=Ki(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ki(i){var e=Ui(i,"string");return typeof e=="symbol"?e:String(e)}function Ui(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Jt extends V{constructor(e,t,n,r,o){super(),re(this,"isInitialised",!1),re(this,"_config",void 0),re(this,"_dimensions",void 0),re(this,"_parentId",void 0),re(this,"_indexInParent",void 0),re(this,"_layoutManager",void 0),re(this,"_popoutWindow",null),re(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=n,this._indexInParent=r,this._layoutManager=o,this._createWindow()}toConfig(){var e,t,n,r,o,s,a,l,h,d,u;if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");return{dimensions:{width:(e=this.getGlInstance())===null||e===void 0?void 0:e.width,height:(t=this.getGlInstance())===null||t===void 0?void 0:t.height,left:(n=(r=(o=this._popoutWindow)===null||o===void 0?void 0:o.screenX)!==null&&r!==void 0?r:(s=this._popoutWindow)===null||s===void 0?void 0:s.screenLeft)!==null&&n!==void 0?n:0,top:(a=(l=(h=this._popoutWindow)===null||h===void 0?void 0:h.screenY)!==null&&l!==void 0?l:(d=this._popoutWindow)===null||d===void 0?void 0:d.screenTop)!==null&&a!==void 0?a:0},content:(u=this.getGlInstance())===null||u===void 0?void 0:u.toConfig().content,parentId:this._parentId,indexInParent:this._indexInParent}}getGlInstance(){var e;return(e=this._popoutWindow)===null||e===void 0?void 0:e.__glInstance}getWindow(){return this._popoutWindow}close(){if(this.getGlInstance()){var e;(e=this.getGlInstance())===null||e===void 0||e._$closeWindow()}else try{var t;(t=this.getWindow())===null||t===void 0||t.close()}catch{}}popIn(){var e;this._indexInParent;var t=null,n=null;if(this._parentId){var r;if(t=m.extend(!0,{},(r=this.getGlInstance())===null||r===void 0?void 0:r.toConfig()).content[0],n=this._layoutManager.root.getItemsById(this._parentId)[0],!n){var o;((o=this._layoutManager.root.contentItems.length)!==null&&o!==void 0?o:0)>0?n=this._layoutManager.root.contentItems[0]:n=this._layoutManager.root}}t&&((e=n)===null||e===void 0||e.addChild(t,this._indexInParent),this.close())}_createWindow(){var e=this._createUrl(),t=Math.floor(Math.random()*1e6).toString(36),n=this._serializeWindowOptions({width:this._dimensions.width,height:this._dimensions.height,innerWidth:this._dimensions.width,innerHeight:this._dimensions.height,menubar:"no",toolbar:"no",location:"no",personalbar:"no",resizable:"yes",scrollbars:"no",status:"no"});if(this._popoutWindow=window.open(e,t,n),!this._popoutWindow)if(this._layoutManager.config.settings.blockedPopoutsThrowError===!0){var r=new Error("Popout blocked");throw r.type="popoutBlocked",r}else return;m(this._popoutWindow).on("load",this._positionWindow.bind(this)).on("unload beforeunload",this._onClose.bind(this));var o=window.setInterval(()=>{var s;(s=this._popoutWindow)!==null&&s!==void 0&&s.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),window.clearInterval(o))},10)}_serializeWindowOptions(e){var t=[],n;for(n in e)t.push(n+"="+e[n]);return t.join(",")}_createUrl(){var e={content:this._config},t="gl-window-config-"+Ge();e=ut(e);try{localStorage.setItem(t,JSON.stringify(e))}catch(r){throw new Error("Error while writing to localStorage "+r.toString())}var n=document.location.href.split("?");return n.length===1?n[0]+"?gl-window="+t:document.location.href+"&gl-window="+t}_positionWindow(){var e,t;(e=this._popoutWindow)===null||e===void 0||e.moveTo(this._dimensions.left,this._dimensions.top),(t=this._popoutWindow)===null||t===void 0||t.focus()}_onInitialised(){var e;this.isInitialised=!0,(e=this.getGlInstance())===null||e===void 0||e.on("popIn",this.popIn,this),this.emit("initialised")}_onClose(){setTimeout(this.emit.bind(this,"closed"),50)}}function A(i,e,t){return e=Gi(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Gi(i){var e=Yi(i,"string");return typeof e=="symbol"?e:String(e)}function Yi(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class fe extends V{constructor(e,t,n,r,o,s){var a,l,h,d,u,f,v,c;if(super(),A(this,"_dragListener",void 0),A(this,"_layoutManager",void 0),A(this,"_contentItem",void 0),A(this,"_originalParent",void 0),A(this,"_area",null),A(this,"_lastValidArea",null),A(this,"_minX",void 0),A(this,"_maxX",void 0),A(this,"_minY",void 0),A(this,"_maxY",void 0),A(this,"_width",void 0),A(this,"_height",void 0),A(this,"_sided",void 0),A(this,"element",void 0),A(this,"childElementContainer",void 0),A(this,"_proxyTab",void 0),this._dragListener=n,this._layoutManager=r,this._contentItem=o,this._originalParent=s,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var g,x;this._layoutManager.tabDropPlaceholder.width((g=this._contentItem.tab.element.outerWidth(!0))!==null&&g!==void 0?g:0),this._layoutManager.tabDropPlaceholder.height((x=this._contentItem.tab.element.outerHeight(!0))!==null&&x!==void 0?x:0)}if(this.element=m(fe._template),s&&s._side&&(this._sided=s._sided,this.element.addClass("lm_"+s._side),["right","bottom"].indexOf(s._side.toString())>=0&&this.element.find(".lm_content").after(this.element.find(".lm_header"))),this.element.css({left:e,top:t}),this._proxyTab=this.element.find(".lm_tab"),this._proxyTab.attr("title",dt((a=this._contentItem.config.title)!==null&&a!==void 0?a:"")),this.element.find(".lm_title").html((l=this._contentItem.config.title)!==null&&l!==void 0?l:""),this.childElementContainer=this.element.find(".lm_content"),this.childElementContainer.append(o.element),this._updateTree(),this._layoutManager._$calculateItemAreas(),m(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var E,T;this._layoutManager.tabDropPlaceholder.width((E=this._proxyTab.outerWidth(!0))!==null&&E!==void 0?E:0),this._layoutManager.tabDropPlaceholder.height((T=this._proxyTab.outerHeight(!0))!==null&&T!==void 0?T:0)}var P=this._layoutManager.container.offset();this._minX=(h=P==null?void 0:P.left)!==null&&h!==void 0?h:0,this._minY=(d=P==null?void 0:P.top)!==null&&d!==void 0?d:0,this._maxX=((u=this._layoutManager.container.width())!==null&&u!==void 0?u: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=(c=this.element.height())!==null&&c!==void 0?c:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,n){var r,o,s=(r=n.pageX)!==null&&r!==void 0?r:0,a=(o=n.pageY)!==null&&o!==void 0?o:0,l=s>this._minX&&s<this._maxX&&a>this._minY&&a<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(s,a)}_setDropPosition(e,t){this.element.css({left:e,top:t}),this._area=this._layoutManager._$getArea(e,t),this._area!==null&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(e,t,this._area))}_onDrop(){var e;(e=this._layoutManager.dropTargetIndicator)===null||e===void 0||e.hide(),this._area!==null?this._area.contentItem._$onDrop(this._contentItem,this._area):this._lastValidArea!==null?this._lastValidArea.contentItem._$onDrop(this._contentItem,this._lastValidArea):this._originalParent?this._originalParent.addChild(this._contentItem):this._contentItem._$destroy(),this._dragListener.off("drag",this._onDrag,this),this._dragListener.off("dragStop",this._onDrop,this),this.element.remove(),this._layoutManager.emit("itemDropped",this._contentItem)}_updateTree(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(null)}_setDimensions(){var e=this._layoutManager.config.dimensions,t=e.dragProxyWidth,n=e.dragProxyHeight;this.element.width(t),this.element.height(n),t-=this._sided?e.headerHeight:0,n-=this._sided?0:e.headerHeight,this.childElementContainer.width(t),this.childElementContainer.height(n),this._contentItem.element.width(t),this._contentItem.element.height(n),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}A(fe,"_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 We(i,e,t){return e=Vi(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Vi(i){var e=Xi(i,"string");return typeof e=="symbol"?e:String(e)}function Xi(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Qt{constructor(e,t,n){We(this,"_element",void 0),We(this,"_itemConfig",void 0),We(this,"_layoutManager",void 0),We(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=n,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new je(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this),this._dragListener}_onDragStart(e,t){var n=this._itemConfig;typeof n=="function"&&(n=n());var r=this._layoutManager._$normalizeContentItem(m.extend(!0,{},n));new fe(e,t,this._dragListener,this._layoutManager,r,null)}}function Be(i,e,t){return e=qi(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function qi(i){var e=Zi(i,"string");return typeof e=="symbol"?e:String(e)}function Zi(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class en{constructor(e,t,n){Be(this,"_element",m(window)),Be(this,"_itemConfig",void 0),Be(this,"_layoutManager",void 0),Be(this,"_dragListener",void 0),this._itemConfig=e,this._layoutManager=t,this._createDragListener(n)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&(this._dragListener=new je(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._destroy,this),this._dragListener.onMouseDown(e),this._dragListener._startDrag())}_destroy(){this._dragListener=void 0,this._element=void 0,this._itemConfig=void 0,this._layoutManager=void 0}_onDragStart(e,t){if(!(!this._dragListener||!this._layoutManager)){var n=this._itemConfig;typeof n=="function"&&(n=n());var r=this._layoutManager._$normalizeContentItem(m.extend(!0,{},n));new fe(e,t,this._dragListener,this._layoutManager,r,null)}}}function tn(i,e,t){return e=Ji(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Ji(i){var e=Qi(i,"string");return typeof e=="symbol"?e:String(e)}function Qi(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Re{constructor(){tn(this,"element",m(Re._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()}}tn(Re,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function Qe(i,e,t){return e=er(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function er(i){var e=tr(i,"string");return typeof e=="symbol"?e:String(e)}function tr(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class xe{constructor(e,t,n,r){Qe(this,"element",void 0),Qe(this,"_header",void 0),Qe(this,"_action",void 0),this._header=e,this.element=m('<li class="'+n+'" title="'+t+'"></li>'),this._header.on("destroy",this._$destroy,this),this._action=r,this.element.on("click",this._action),this._header.controlsContainer.append(this.element)}_$destroy(){this.element.off(),this.element.remove()}}function nr(i,e,t){return e=ir(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ir(i){var e=rr(i,"string");return typeof e=="symbol"?e:String(e)}function rr(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class or extends Error{constructor(e,t){super(),nr(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const ce=or,sr=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:ce},Symbol.toStringTag,{value:"Module"}));function O(i,e,t){return e=ar(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ar(i){var e=lr(i,"string");return typeof e=="symbol"?e:String(e)}function lr(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function me(i){return i.isStack}function U(i){return i.isComponent}function nn(i){return i.isRoot}class L extends V{constructor(e,t,n,r){super(),O(this,"config",void 0),O(this,"type",void 0),O(this,"contentItems",void 0),O(this,"parent",void 0),O(this,"layoutManager",void 0),O(this,"element",void 0),O(this,"childElementContainer",void 0),O(this,"componentName",void 0),O(this,"isInitialised",!1),O(this,"isMaximised",!1),O(this,"isRoot",!1),O(this,"isRow",!1),O(this,"isColumn",!1),O(this,"isStack",!1),O(this,"isComponent",!1),O(this,"tab",void 0),O(this,"_pendingEventPropagations",void 0),O(this,"_throttledEvents",void 0),this.element=r,this.config=this._extendItemNode(t),this.type=t.type,this.contentItems=[],this.parent=n,this.layoutManager=e,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(V.ALL_EVENT,this._propagateEvent,this),t.content&&this._createContentItems(t)}callDownwards(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;n!==!0&&r!==!0&&this[e].apply(this,t);for(var o=0;o<this.contentItems.length;o++)this.contentItems[o].callDownwards(e,t,n);n===!0&&r!==!0&&this[e].apply(this,t)}removeChild(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=this.contentItems.indexOf(e);if(r===-1)throw new Error("Can't remove child item. Unknown content item");if(n!==!0&&this.contentItems[r]._$destroy(),this.contentItems.splice(r,1),(t=this.config.content)===null||t===void 0||t.splice(r,1),this.contentItems.length>0)this.callDownwards("setSize");else if(this.type!=="root"&&this.config.isClosable){var o;(o=this.parent)===null||o===void 0||o.removeChild(this)}}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.splice(t,0,e),this.config.content===void 0&&(this.config.content=[]),this.config.content.splice(t,0,e.config),e.parent=this,e.parent.isInitialised===!0&&e.isInitialised===!1&&e._$init()}replaceChild(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;t=this.layoutManager._$normalizeContentItem(t);var r=this.contentItems.indexOf(e),o=e.element[0].parentNode;if(r===-1)throw new Error("Can't replace child. oldChild is not child of this");o==null||o.replaceChild(t.element[0],e.element[0]),n===!0&&(e.parent=null,e._$destroy()),this.contentItems[r]=t,t.parent=this,me(this)&&(this.header.tabs[r].contentItem=t),t.parent.isInitialised===!0&&t.isInitialised===!1&&t._$init(),this.callDownwards("setSize")}remove(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}popout(){var e=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),e}toggleMaximise(e){e&&e.preventDefault(),this.isMaximised===!0?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximised=!this.isMaximised,this.emitBubblingEvent("stateChanged")}select(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))}deselect(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))}setTitle(e){this.config.title=e,this.emit("titleChanged",e),this.emitBubblingEvent("stateChanged")}hasId(e){if(this.config.id){if(typeof this.config.id=="string")return this.config.id===e;if(this.config.id instanceof Array)return this.config.id.indexOf(e)!==-1}else return!1}addId(e){this.hasId(e)||(this.config.id?typeof this.config.id=="string"?this.config.id=[this.config.id,e]:this.config.id instanceof Array&&this.config.id.push(e):this.config.id=e)}removeId(e){if(!this.hasId(e))throw new Error("Id not found");if(typeof this.config.id=="string")delete this.config.id;else if(this.config.id instanceof Array){var t=this.config.id.indexOf(e);this.config.id.splice(t,1)}}getItemsByFilter(e){var t=[],n=function r(o){for(var s=0;s<o.contentItems.length;s++)e(o.contentItems[s])===!0&&t.push(o.contentItems[s]),r(o.contentItems[s])};return n(this),t}getItemsById(e){return this.getItemsByFilter(function(t){return t.config.id instanceof Array?t.config.id.indexOf(e)!==-1:t.config.id===e})}getItemsByType(e){return this._$getItemsByProperty("type",e)}getComponentsByName(e){for(var t=this._$getItemsByProperty("componentName",e),n=[],r=0;r<t.length;r++)n.push(t[r].instance);return n}_$getItemsByProperty(e,t){return this.getItemsByFilter(function(n){return n[e]===t})}_$setParent(e){this.parent=e}_$highlightDropZone(e,t,n){var r;(r=this.layoutManager.dropTargetIndicator)===null||r===void 0||r.highlightArea(n)}_$onDrop(e,t){this.addChild(e)}_$hide(){this._callOnActiveComponents("hide"),this.element.hide(),this.layoutManager.updateSize()}_$show(){this._callOnActiveComponents("show"),this.element.show(),this.layoutManager.updateSize()}_callOnActiveComponents(e){for(var t=this.getItemsByType("stack"),n=null,r=0;r<t.length;r++)n=t[r].getActiveContentItem(),n&&U(n)&&n.container[e]()}_$destroy(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")}_$getArea(e){var t,n,r;e=e||this.element;var o=(t=e.offset())!==null&&t!==void 0?t:{left:0,top:0},s=(n=e.width())!==null&&n!==void 0?n:0,a=(r=e.height())!==null&&r!==void 0?r:0;return{x1:o.left,y1:o.top,x2:o.left+s,y2:o.top+a,surface:s*a,contentItem:this,side:""}}_$init(){this.setSize();for(var e=0;e<this.contentItems.length;e++){var t;(t=this.childElementContainer)===null||t===void 0||t.append(this.contentItems[e].element)}this.isInitialised=!0,this.emitBubblingEvent("itemCreated"),this.emitBubblingEvent(this.type+"Created")}emitBubblingEvent(e){var t=new it(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new ce("content must be an Array",e);for(var n=0;n<e.content.length;n++)t=this.layoutManager.createContentItem(e.content[n],this),this.contentItems.push(t)}_extendItemNode(e){for(var[t,n]of Object.entries(Yt)){var r=t;e[r]===void 0&&(e[r]=n)}return e}_propagateEvent(e,t){t instanceof it&&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,ht(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function Me(i,e,t){return e=hr(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function hr(i){var e=dr(i,"string");return typeof e=="symbol"?e:String(e)}function dr(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class rn extends L{constructor(e,t,n){var r;Object.entries((r=e.config.settings.defaultComponentConfig)!==null&&r!==void 0?r:{}).forEach(a=>{var[l,h]=a;t[l]===void 0&&(t[l]=h)}),super(e,t,n,m()),Me(this,"config",void 0),Me(this,"componentName",void 0),Me(this,"container",void 0),Me(this,"parent",void 0),Me(this,"instance",void 0),this.config=t,this.parent=n;var o=e.getComponent(this.config.componentName)||e.getFallbackComponent(),s=m.extend(!0,{},this.config.componentState||{});if(o==null)throw new ce('Unknown component "'+this.config.componentName+'"');s.componentName=this.config.componentName,this.componentName=this.config.componentName,this.config.title===""&&(this.config.title=this.config.componentName),this.isComponent=!0,this.container=new tt(this.config,this,e),this.instance=new o(this.container,s),this.element=this.container._element}close(){this.parent.removeChild(this)}setSize(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())}_$init(){L.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),L.prototype._$hide.call(this)}_$show(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),L.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),L.prototype._$destroy.call(this)}_$getArea(){return null}}function k(i,e,t){return e=ur(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ur(i){var e=cr(i,"string");return typeof e=="symbol"?e:String(e)}function cr(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class Ve extends L{constructor(e,t,n,r){super(t,n,r,m('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),k(this,"isRow",void 0),k(this,"isColumn",void 0),k(this,"childElementContainer",void 0),k(this,"parent",void 0),k(this,"_splitter",[]),k(this,"_splitterSize",void 0),k(this,"_splitterGrabSize",void 0),k(this,"_isColumn",void 0),k(this,"_dimension",void 0),k(this,"_splitterPosition",null),k(this,"_splitterMinPosition",null),k(this,"_splitterMaxPosition",null),this.parent=r,this.isRow=!e,this.isColumn=e,this.childElementContainer=this.element,this._splitterSize=t.config.dimensions.borderWidth,this._splitterGrabSize=t.config.dimensions.borderGrabWidth,this._isColumn=e,this._dimension=e?"height":"width",this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null}addChild(e,t,n){var r,o,s,a;if(e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.length>0?(a=this._createSplitter(Math.max(0,t-1)).element,t>0?(this.contentItems[t-1].element.after(a),a.after(e.element)):(this.contentItems[0].element.before(a),a.before(e.element))):this.childElementContainer.append(e.element),L.prototype.addChild.call(this,e,t),r=1/this.contentItems.length*100,n===!0){this.emitBubblingEvent("stateChanged");return}for(s=0;s<this.contentItems.length;s++)if(this.contentItems[s]===e)e.config[this._dimension]=r;else{var l;o=((l=this.contentItems[s].config[this._dimension])!==null&&l!==void 0?l:0)*(100-r)/100,this.contentItems[s].config[this._dimension]=o}this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}removeChild(e,t){var n,r=(n=e.config[this._dimension])!==null&&n!==void 0?n:0,o=this.contentItems.indexOf(e),s=Math.max(o-1,0),a,l;if(o===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[s]&&(this._splitter[s]._$destroy(),this._splitter.splice(s,1)),a=0;a<this.contentItems.length;a++)if(this.contentItems[a]!==e){var h;this.contentItems[a].config[this._dimension]=((h=this.contentItems[a].config[this._dimension])!==null&&h!==void 0?h:0)+r/(this.contentItems.length-1)}L.prototype.removeChild.call(this,e,t),this.contentItems.length===1&&this.config.isClosable===!0?(l=this.contentItems[0],this.contentItems=[],this.parent.replaceChild(this,l,!0)):(this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged"))}replaceChild(e,t){var n=e.config[this._dimension];super.replaceChild(e,t),t.config[this._dimension]=n,this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(){this.contentItems.length>0&&(this._calculateRelativeSizes(),this._setAbsoluteSizes()),this.emitBubblingEvent("stateChanged"),this.emit("resize")}_$init(){if(this.isInitialised!==!0){var e;for(L.prototype._$init.call(this),e=0;e<this.contentItems.length-1;e++)this.contentItems[e].element.after(this._createSplitter(e).element)}}_setAbsoluteSizes(){var e,t=this._calculateAbsoluteSizes();for(e=0;e<this.contentItems.length;e++)t.additionalPixel-e>0&&t.itemSizes[e]++,this._isColumn?(this.contentItems[e].element.width(t.totalWidth),this.contentItems[e].element.height(t.itemSizes[e])):(this.contentItems[e].element.width(t.itemSizes[e]),this.contentItems[e].element.height(t.totalHeight))}_calculateAbsoluteSizes(){var e,t,n=(this.contentItems.length-1)*this._splitterSize,r=(e=this.element.width())!==null&&e!==void 0?e:0,o=(t=this.element.height())!==null&&t!==void 0?t:0,s=0,a=[];this._isColumn?o-=n:r-=n;for(var l=0;l<this.contentItems.length;l++){var h,d,u=this._isColumn?Math.floor(o*(((h=this.contentItems[l].config.height)!==null&&h!==void 0?h:0)/100)):Math.floor(r*(((d=this.contentItems[l].config.width)!==null&&d!==void 0?d:0)/100));s+=u,a.push(u)}var f=Math.floor((this._isColumn?o:r)-s);return{itemSizes:a,additionalPixel:f,totalWidth:r,totalHeight:o}}_calculateRelativeSizes(){for(var e=0,t=[],n=this._isColumn?"height":"width",r=0;r<this.contentItems.length;r++){var o=this.contentItems[r].config[n];o!=null?e+=o:t.push(this.contentItems[r])}if(Math.round(e)===100){this._respectMinItemWidth();return}if(Math.round(e)<100&&t.length>0){for(var s=0;s<t.length;s++)t[s].config[n]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var a=0;a<t.length;a++)t[a].config[n]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var h;this.contentItems[l].config[n]=((h=this.contentItems[l].config[n])!==null&&h!==void 0?h:0)/e*100}this._respectMinItemWidth()}_respectMinItemWidth(){var e,t=this.layoutManager.config.dimensions&&(e=this.layoutManager.config.dimensions.minItemWidth)!==null&&e!==void 0?e:0,n=[],r=0,o=0,s=0,a=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var h=this._calculateAbsoluteSizes(),d=0;d<this.contentItems.length;d++){this.contentItems[d];var u=h.itemSizes[d];u<t?(o+=t-u,l={width:t}):(r+=u-t,l={width:u},n.push(l)),a.push(l)}if(!(o===0||o>r)){var f=o/r;s=o;for(var v=0;v<n.length;v++){l=n[v];var c=Math.round((l.width-t)*f);s-=c,l.width-=c}s!==0&&(a[a.length-1].width-=s);for(var g=0;g<this.contentItems.length;g++)this.contentItems[g].config.width=a[g].width/h.totalWidth*100}}}_createSplitter(e){var t;return t=new on(this._isColumn,this._splitterSize,this._splitterGrabSize),t.on("drag",this._onSplitterDrag.bind(this,t),this),t.on("dragStop",this._onSplitterDragStop.bind(this,t),this),t.on("dragStart",this._onSplitterDragStart.bind(this,t),this),this._splitter.splice(e,0,t),t}_getItemsForSplitter(e){var t=this._splitter.indexOf(e);if(t<0)throw new Error("Splitter not found in RowOrColumn");return{before:this.contentItems[t],after:this.contentItems[t+1]}}_getMinimumDimensions(e){for(var t=0,n=0,r=0;r<e.length;++r){var o,s;t=Math.max((o=e[r].minWidth)!==null&&o!==void 0?o:0,t),n=Math.max((s=e[r].minHeight)!==null&&s!==void 0?s:0,n)}return{horizontal:t,vertical:n}}_onSplitterDragStart(e){var t,n,r,o,s=this._getItemsForSplitter(e),a=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=s.before.config.content)!==null&&t!==void 0?t:[]),h=this._isColumn?l.vertical:l.horizontal,d=this._getMinimumDimensions((n=s.after.config.content)!==null&&n!==void 0?n:[]),u=this._isColumn?d.vertical:d.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((r=s.before.element[this._dimension]())!==null&&r!==void 0?r:0)-(h||a)),this._splitterMaxPosition=((o=s.after.element[this._dimension]())!==null&&o!==void 0?o:0)-(u||a)}_onSplitterDrag(e,t,n){var r=this._isColumn?n:t;this._splitterMaxPosition==null||this._splitterMinPosition==null||r>this._splitterMinPosition&&r<this._splitterMaxPosition&&(this._splitterPosition=r,e.element.css(this._isColumn?"top":"left",r))}_onSplitterDragStop(e){var t,n,r,o,s,a=this._getItemsForSplitter(e),l=(t=a.before.element[this._dimension]())!==null&&t!==void 0?t:0,h=(n=a.after.element[this._dimension]())!==null&&n!==void 0?n:0,d=(((r=this._splitterPosition)!==null&&r!==void 0?r:0)+l)/(l+h),u=((o=a.before.config[this._dimension])!==null&&o!==void 0?o:0)+((s=a.after.config[this._dimension])!==null&&s!==void 0?s:0);a.before.config[this._dimension]=d*u,a.after.config[this._dimension]=(1-d)*u,e.element.css({top:0,left:0}),ht(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function Mt(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Et(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Mt(Object(t),!0).forEach(function(n){rt(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Mt(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function rt(i,e,t){return e=mr(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function mr(i){var e=fr(i,"string");return typeof e=="symbol"?e:String(e)}function fr(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class ot extends L{constructor(e,t,n){super(e,Et(Et({},t),{},{type:"root"}),null,m('<div class="lm_goldenlayout lm_item lm_root"></div>')),rt(this,"childElementContainer",void 0),rt(this,"_containerElement",void 0),this.isRoot=!0,this.type="root",this.childElementContainer=this.element,this._containerElement=n,this._containerElement.append(this.element)}addChild(e,t){if(this.contentItems.length>0)throw new Error("Root node can only have a single child");e=this.layoutManager._$normalizeContentItem(e,this),this.childElementContainer.append(e.element),super.addChild(e,t),this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(e,t){var n,r;e=typeof e>"u"?(n=this._containerElement.width())!==null&&n!==void 0?n:0:e,t=typeof t>"u"?(r=this._containerElement.height())!==null&&r!==void 0?r:0:t,this.element.width(e),this.element.height(t),this.contentItems[0]&&(this.contentItems[0].element.width(e),this.contentItems[0].element.height(t))}_$getArea(){var e=super._$getArea();if(e==null)throw new Error("Unable to get root area");return e}_$highlightDropZone(e,t,n){this.layoutManager.tabDropPlaceholder.remove(),super._$highlightDropZone(e,t,n)}_$onDrop(e,t){var n;if(U(e)&&(n=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this),n._$init(),n.addChild(e),e=n),!this.contentItems.length)this.addChild(e);else{var{side:r}=t,o=r==="left"||r==="right"?"row":"column",s=r==="left"||r==="right"?"width":"height",a=r==="left"||r==="top",l=this.contentItems[0];if(!(l instanceof Ve)||l.type!=o){var h=this.layoutManager.createContentItem({type:o},this);this.replaceChild(l,h),h.addChild(e,a?0:void 0,!0),h.addChild(l,a?void 0:0,!0),l.config[s]=50,e.config[s]=50,h.callDownwards("setSize")}else{var d,u=l.contentItems[a?0:l.contentItems.length-1];l.addChild(e,a?0:void 0,!0),u.config[s]=((d=u.config[s])!==null&&d!==void 0?d:0)*.5,e.config[s]=u.config[s],l.callDownwards("setSize")}}}}function Dt(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function _e(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Dt(Object(t),!0).forEach(function(n){W(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Dt(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function W(i,e,t){return e=vr(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function vr(i){var e=pr(i,"string");return typeof e=="symbol"?e:String(e)}function pr(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class st extends L{constructor(e,t,n){var r,o,s,a,l,h,d,u,f;super(e,t,n,m('<div class="lm_item lm_stack"></div>')),W(this,"_activeContentItem",null),W(this,"_header",void 0),W(this,"childElementContainer",m('<div class="lm_items"></div>')),W(this,"header",void 0),W(this,"parent",void 0),W(this,"isStack",!0),W(this,"_dropZones",{}),W(this,"_dropSegment",null),W(this,"_contentAreaDimensions",null),W(this,"_dropIndex",void 0),W(this,"_side",void 0),W(this,"_sided",!1),W(this,"config",void 0),this.parent=n,this.config=t;var v=e.config;this._side=!1,this._header={show:((r=v.settings)===null||r===void 0?void 0:r.hasHeaders)&&t.hasHeaders!==!1,popout:(o=v.settings)!==null&&o!==void 0&&o.showPopoutIcon?(s=v.labels)===null||s===void 0?void 0:s.popout:void 0,maximise:(a=v.settings)!==null&&a!==void 0&&a.showMaximiseIcon?(l=v.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(h=v.settings)!==null&&h!==void 0&&h.showCloseIcon?(d=v.labels)===null||d===void 0?void 0:d.close:void 0,minimise:(u=(f=v.labels)===null||f===void 0?void 0:f.minimise)!==null&&u!==void 0?u:void 0},v.header&&(this._header=_e(_e({},this._header),v.header)),t.header&&(this._header=_e(_e({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=_e(_e({},this._header),t.content[0].header)),this.header=new te(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,n,r,o,s=this._header.show&&(e=(t=this.layoutManager.config.dimensions)===null||t===void 0?void 0:t.headerHeight)!==null&&e!==void 0?e:0,a=((n=this.element.width())!==null&&n!==void 0?n:0)-(this._sided?s:0),l=((r=this.element.height())!==null&&r!==void 0?r:0)-(this._sided?0:s);for(this.childElementContainer.width(a),this.childElementContainer.height(l),o=0;o<this.contentItems.length;o++)this.contentItems[o].element.width(a).height(l);this.emit("resize"),this.emitBubblingEvent("stateChanged")}_$init(){if(this.isInitialised!==!0){this.header._attachWheelListener(),super._$init();for(var e=0;e<this.contentItems.length;e++)this.header.createTab(this.contentItems[e]),this.contentItems[e]._$hide();if(this.contentItems.length>0){var t=this.contentItems[this.config.activeItemIndex||0];if(!t)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(t)}}}setActiveContentItem(e){if(this.contentItems.indexOf(e)===-1)throw new Error("contentItem is not a child of this stack");this._activeContentItem!==null&&this._activeContentItem._$hide(),this._activeContentItem=e,this.header.setActiveContentItem(e),e._$show(),this.emit("activeContentItemChanged",e),this.layoutManager.emit("activeContentItemChanged",e),this.emitBubblingEvent("stateChanged")}getActiveContentItem(){return this.header.activeContentItem}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),super.addChild(e,t),this.childElementContainer.append(e.element),this.header.createTab(e,t),this.setActiveContentItem(e),this.callDownwards("setSize"),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}removeChild(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.contentItems.indexOf(e);super.removeChild(e,t),this.header.removeTab(e),this.header.activeContentItem===e&&(this.contentItems.length>0?this.setActiveContentItem(this.contentItems[Math.max(n-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}_$validateClosability(){for(var e=this.header._isClosable(),t=0,n=this.contentItems.length;t<n;t++){var r;if(!e)break;e=(r=this.contentItems[t].config.isClosable)!==null&&r!==void 0?r:!1}this.header._$setClosable(e)}_$destroy(){L.prototype._$destroy.call(this),this.header._$destroy()}_$onDrop(e){if(this._dropSegment==="header"){this._resetHeaderDropZone(),this.addChild(e,this._dropIndex);return}if(this._dropSegment==="body"){this.addChild(e);return}var t=this._dropSegment==="top"||this._dropSegment==="bottom",n=this._dropSegment==="left"||this._dropSegment==="right",r=this._dropSegment==="top"||this._dropSegment==="left",o=t&&this.parent.isColumn||n&&this.parent.isRow,s=t?"column":"row",a=t?"height":"width";if(U(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(o){var h,d=this.parent.contentItems.indexOf(this);this.parent.addChild(e,r?d:d+1,!0),this.config[a]=((h=this.config[a])!==null&&h!==void 0?h:0)*.5,e.config[a]=this.config[a],this.parent.callDownwards("setSize")}else{var u=this.layoutManager.createContentItem({type:s},this);this.parent.replaceChild(this,u),u.addChild(e,r?0:void 0,!0),u.addChild(this,r?void 0:0,!0),this.config[a]=50,e.config[a]=50,u.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[n,r]of Object.entries(this._contentAreaDimensions)){var o=r.hoverArea;if(o.x1<e&&o.x2>e&&o.y1<t&&o.y2>t){n==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(n));return}}}_$getArea(){if(this.element.is(":visible")===!1)return null;var e=super._$getArea(this.header.element),t=super._$getArea(this.childElementContainer);if(e==null||t==null)return null;var n=t.x2-t.x1,r=t.y2-t.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}},this._activeContentItem&&this._activeContentItem.isComponent===!1?e:this.contentItems.length===0?(this._contentAreaDimensions.body={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}},super._$getArea(this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x1+n*.25,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x1+n*.5,y2:t.y2}},this._contentAreaDimensions.top={hoverArea:{x1:t.x1+n*.25,y1:t.y1,x2:t.x1+n*.75,y2:t.y1+r*.5},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y1+r*.5}},this._contentAreaDimensions.right={hoverArea:{x1:t.x1+n*.75,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1+n*.5,y1:t.y1,x2:t.x2,y2:t.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:t.x1+n*.25,y1:t.y1+r*.5,x2:t.x1+n*.75,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1+r*.5,x2:t.x2,y2:t.y2}},super._$getArea(this.element))}_highlightHeaderDropZone(e){var t,n,r,o,s,a,l,h,d,u,f,v,c,g,x,E,T=this.header.tabs.length;if(T===0){var P,G,N,Z,j,R,$,he,B=this.header.element.offset();(P=this.layoutManager.dropTargetIndicator)===null||P===void 0||P.highlightArea({x1:(G=B==null?void 0:B.left)!==null&&G!==void 0?G:0,x2:((N=B==null?void 0:B.left)!==null&&N!==void 0?N:0)+100,y1:(Z=(j=this.header.element.offset())===null||j===void 0?void 0:j.top)!==null&&Z!==void 0?Z:0,y2:((R=($=this.header.element.offset())===null||$===void 0?void 0:$.top)!==null&&R!==void 0?R:0)+((he=this.header.element.innerHeight())!==null&&he!==void 0?he:0)});return}var ne=this.header.tabsContainer,X=(t=ne.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),ie=(n=this.layoutManager.tabDropPlaceholder.get(0))===null||n===void 0?void 0:n.getBoundingClientRect();if(!(!X||!ie)){e<X.left?e=X.left+1:e>X.right&&(e=X.right-1);var q,J;if(!(ie.left<e&&e<ie.right)){for(var ve=0;ve<T;ve++){var Se;if(q=this.header.tabs[ve].element,J=(Se=q.get(0))===null||Se===void 0?void 0:Se.getBoundingClientRect(),J&&J.left<e&&e<J.right){this._dropIndex=ve;break}}if(q&&J&&e<J.left+J.width*.5)q.before(this.layoutManager.tabDropPlaceholder);else if(q){var pe;this._dropIndex=Math.min(((pe=this._dropIndex)!==null&&pe!==void 0?pe:0)+1,T),q.after(this.layoutManager.tabDropPlaceholder)}}var _=(r=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&r!==void 0?r:0;_=Math.max(_,(s=(a=this.header.tabsContainer.offset())===null||a===void 0?void 0:a.left)!==null&&s!==void 0?s:0);var I=_+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);I=Math.min(I,((h=(d=this.header.tabsContainer.offset())===null||d===void 0?void 0:d.left)!==null&&h!==void 0?h:0)+((u=this.header.tabsContainer.innerWidth())!==null&&u!==void 0?u:0)),(f=this.layoutManager.dropTargetIndicator)===null||f===void 0||f.highlightArea({x1:_,x2:I,y1:(v=(c=this.header.element.offset())===null||c===void 0?void 0:c.top)!==null&&v!==void 0?v:0,y2:((g=(x=this.header.element.offset())===null||x===void 0?void 0:x.top)!==null&&g!==void 0?g:0)+((E=this.header.element.innerHeight())!==null&&E!==void 0?E:0)})}}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){var e=["right","left","bottom"].some(n=>n===this._header.show)?this._header.show:void 0;if(this.header.element.toggle(!!this._header.show),!!e&&(this._side=e,this._sided=["right","left"].indexOf(this._side.toString())>=0,this.element.removeClass("lm_left lm_right lm_bottom"),this._side&&this.element.addClass("lm_"+this._side),this.element.find(".lm_header").length&&this.childElementContainer)){var t=["right","bottom"].indexOf(this._side.toString())>=0?"before":"after";this.header.element[t](this.childElementContainer),this.callDownwards("setSize")}}_highlightBodyDropZone(e){var t,n,r=(t=this._contentAreaDimensions)===null||t===void 0||(n=t[e])===null||n===void 0?void 0:n.highlightArea;if(r){var o;(o=this.layoutManager.dropTargetIndicator)===null||o===void 0||o.highlightArea(r)}this._dropSegment=e}}const gr=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:L,Component:rn,ContentItem:L,Root:ot,RowOrColumn:Ve,Stack:st,isComponent:U,isRoot:nn,isStack:me},Symbol.toStringTag,{value:"Module"}));function ee(i,e,t){return e=_r(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function _r(i){var e=br(i,"string");return typeof e=="symbol"?e:String(e)}function br(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class $e{constructor(e,t){var n;ee(this,"header",void 0),ee(this,"contentItem",void 0),ee(this,"element",m($e._template)),ee(this,"titleElement",void 0),ee(this,"closeElement",void 0),ee(this,"isActive",!1),ee(this,"_layoutManager",void 0),ee(this,"_dragListener",void 0),this.header=e,this.contentItem=t,this.titleElement=this.element.find(".lm_title"),this.closeElement=this.element.find(".lm_close_tab"),this.closeElement[t.config.isClosable?"show":"hide"](),this.setTitle(t.config.title),this.contentItem.on("titleChanged",this.setTitle,this),this._layoutManager=this.contentItem.layoutManager,(n=this._layoutManager.config.settings)!==null&&n!==void 0&&n.reorderEnabled&&t.config.reorderEnabled&&(this._dragListener=new je(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),U(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),U(this.contentItem)&&(this.contentItem.container._contentElement.off(),this.contentItem.container._contentElement[0].removeEventListener("click",this._onTabContentFocusIn,!0)),this._dragListener&&(this.contentItem.off("destroy",this._dragListener.destroy,this._dragListener),this._dragListener.off("dragStart",this._onDragStart),this._dragListener=void 0),this.element.remove()}_onDragStart(e,t){var n;(n=this.contentItem.parent)!==null&&n!==void 0&&n.isMaximised&&this.contentItem.parent.toggleMaximise(),this._dragListener&&new fe(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(){U(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.element.removeClass("lm_focusin")}_onTabClick(e){if(!e||e.button===0){var t,n=this.header.parent.getActiveContentItem();this.contentItem!==n&&U(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):U(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),U(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(),U(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onCloseMousedown(e){e.stopPropagation()}}ee($e,"_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 w(i,e,t){return e=yr(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function yr(i){var e=wr(i,"string");return typeof e=="symbol"?e:String(e)}function wr(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class te extends V{constructor(e,t){var n,r;super(),w(this,"layoutManager",void 0),w(this,"element",m(te._template)),w(this,"tabsContainer",void 0),w(this,"tabDropdownContainer",void 0),w(this,"tabDropdownSearch",void 0),w(this,"tabDropdownList",null),w(this,"controlsContainer",void 0),w(this,"parent",void 0),w(this,"tabs",[]),w(this,"activeContentItem",null),w(this,"closeButton",null),w(this,"tabDropdownButton",null),w(this,"tabNextButton",m(te._nextButtonTemplate)),w(this,"tabPreviousButton",m(te._previousButtonTemplate)),w(this,"holdTimer",null),w(this,"rAF",null),w(this,"CLICK_TIMEOUT",500),w(this,"START_SPEED",.01),w(this,"ACCELERATION",5e-4),w(this,"PADDING",10),w(this,"SCROLL_LEFT","left"),w(this,"SCROLL_RIGHT","right"),w(this,"isDraggingTab",!1),w(this,"isOverflowing",!1),w(this,"isDropdownShown",!1),w(this,"dropdownKeyIndex",0),w(this,"_lastVisibleTabIndex",-1),w(this,"_tabControlOffset",void 0),this.layoutManager=e,(n=this.layoutManager.config.settings)!==null&&n!==void 0&&n.selectionEnabled&&(this.element.addClass("lm_selectable"),this.element.on("click",this._onHeaderClick.bind(this))),this.tabsContainer=this.element.find(".lm_tabs"),this.tabDropdownContainer=this.element.find(".lm_tabdropdown_list"),this.tabDropdownContainer.hide(),this.tabDropdownSearch=this.element.find(".lm_tabdropdown_search input"),this._handleFilterInput=this._handleFilterInput.bind(this),this._handleFilterKeydown=this._handleFilterKeydown.bind(this),this.tabDropdownSearch.on("input",this._handleFilterInput),this.tabDropdownSearch.on("keydown",this._handleFilterKeydown),this.controlsContainer=this.element.find(".lm_controls"),this.parent=t,this.parent.on("resize",this._updateTabSizes,this),this._handleItemPickedUp=this._handleItemPickedUp.bind(this),this._handleItemDropped=this._handleItemDropped.bind(this),this._handleNextMouseEnter=this._handleNextMouseEnter.bind(this),this._handleNextMouseLeave=this._handleNextMouseLeave.bind(this),this._handlePreviousMouseEnter=this._handlePreviousMouseEnter.bind(this),this._handlePreviousMouseLeave=this._handlePreviousMouseLeave.bind(this),this._handleScrollRepeat=this._handleScrollRepeat.bind(this),this._handleNextButtonMouseDown=this._handleNextButtonMouseDown.bind(this),this._handlePreviousButtonMouseDown=this._handlePreviousButtonMouseDown.bind(this),this._handleScrollButtonMouseDown=this._handleScrollButtonMouseDown.bind(this),this._handleScrollButtonMouseUp=this._handleScrollButtonMouseUp.bind(this),this._handleScrollEvent=this._handleScrollEvent.bind(this),this.tabNextButton.on("mousedown",this._handleNextButtonMouseDown),this.tabPreviousButton.on("mousedown",this._handlePreviousButtonMouseDown),this.tabsContainer.on("scroll",this._handleScrollEvent),this.layoutManager.on("itemPickedUp",this._handleItemPickedUp),this.layoutManager.on("itemDropped",this._handleItemDropped),this.tabsContainer.before(this.tabPreviousButton),this.tabPreviousButton=this.tabPreviousButton.find(">:first-child"),this.tabPreviousButton.hide(),this._showAdditionalTabsDropdown=this._showAdditionalTabsDropdown.bind(this),this._hideAdditionalTabsDropdown=this._hideAdditionalTabsDropdown.bind(this),this._tabControlOffset=(r=this.layoutManager.config.settings)===null||r===void 0?void 0:r.tabControlOffset,this._createControls()}createTab(e,t){for(var n=0;n<this.tabs.length;n++)if(this.tabs[n].contentItem===e)return;var r=new $e(this,e);if(this.tabs.length===0){this.tabs.push(r),this.tabsContainer.append(r.element);return}t===void 0&&(t=this.tabs.length),t>0?this.tabs[t-1].element.after(r.element):this.tabs[0].element.before(r.element),this.tabs.splice(t,0,r),this._updateTabSizes()}removeTab(e){for(var t=0;t<this.tabs.length;t++)if(this.tabs[t].contentItem===e){this.tabs[t]._$destroy(),this.tabs.splice(t,1);return}throw new Error("contentItem is not controlled by this header")}setActiveContentItem(e){for(var t,n,r,o,s=0;s<this.tabs.length;s++)o=this.tabs[s].contentItem===e,this.tabs[s].setActive(o),o===!0&&(this.activeContentItem=e,this.parent.config.activeItemIndex=s);(t=this.tabs[(r=this.parent.config.activeItemIndex)!==null&&r!==void 0?r:0].element.get(0))===null||t===void 0||(n=t.scrollIntoView)===null||n===void 0||n.call(t,{inline:"nearest"}),this._hideAdditionalTabsDropdown(),this._updateTabSizes(),this.parent.emitBubblingEvent("stateChanged")}position(e){var t=this.parent._header.show;return t&&!this.parent._side&&(t="top"),e!==void 0&&this.parent._header.show!==e&&(this.parent._header.show=e,this.parent._setupHeaderPosition()),t}_attachWheelListener(){var e;(e=this.tabsContainer.get(0))===null||e===void 0||e.addEventListener("wheel",this._handleWheelEvent,{passive:!0})}_detachWheelListener(){var e;(e=this.tabsContainer.get(0))===null||e===void 0||e.removeEventListener("wheel",this._handleWheelEvent)}_handleWheelEvent(e){var t=e.currentTarget;if(t instanceof HTMLElement){var n=Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX;if(e.deltaMode===WheelEvent.DOM_DELTA_PAGE){var r;n*=(r=this.tabsContainer.innerWidth())!==null&&r!==void 0?r:1}else e.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=100/3);t.scrollLeft+=Math.round(n)}}_handleScrollEvent(){this._checkScrollArrows()}_handleItemPickedUp(){this.isDraggingTab=!0,this.isDropdownShown&&this._hideAdditionalTabsDropdown(),this.controlsContainer.on("mouseenter",this._handleNextMouseEnter),this.tabPreviousButton.on("mouseenter",this._handlePreviousMouseEnter)}_handleItemDropped(){var e;this.isDraggingTab=!1,window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.controlsContainer.off("mouseenter",this._handleNextMouseEnter),this.controlsContainer.off("mouseleave",this._handleNextMouseLeave),this.tabPreviousButton.off("mouseenter",this._handlePreviousMouseEnter),this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextMouseEnter(){var e;this.controlsContainer.on("mouseleave",this._handleNextMouseLeave),this._handleScrollRepeat(this.SCROLL_RIGHT,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)}_handlePreviousMouseEnter(){var e;this.tabPreviousButton.on("mouseleave",this._handlePreviousMouseLeave),this._handleScrollRepeat(this.SCROLL_LEFT,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)}_handleNextMouseLeave(){var e;window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.controlsContainer.off("mouseleave",this._handleNextMouseLeave)}_handlePreviousMouseLeave(){var e;window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextButtonMouseDown(){for(var e,t=0;t<this.tabs.length;t+=1){var n,r,o,s,a;if(((n=(r=this.tabs[t].element.get(0))===null||r===void 0?void 0:r.offsetLeft)!==null&&n!==void 0?n:0)>((o=(s=this.tabsContainer.get(0))===null||s===void 0?void 0:s.offsetWidth)!==null&&o!==void 0?o:0)+((a=this.tabsContainer.scrollLeft())!==null&&a!==void 0?a:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT);else{var l=this.tabsContainer.get(0);if(l){var h,d;l.scrollLeft=(h=(d=this.tabsContainer.get(0))===null||d===void 0?void 0:d.scrollWidth)!==null&&h!==void 0?h:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var n,r,o;if(((n=(r=this.tabs[t].element.get(0))===null||r===void 0?void 0:r.offsetLeft)!==null&&n!==void 0?n:0)<((o=this.tabsContainer.scrollLeft())!==null&&o!==void 0?o:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT);else{var s=this.tabsContainer.get(0);s&&(s.scrollLeft=0)}}_handleScrollButtonMouseDown(e){this.holdTimer=window.setTimeout(()=>{var t;this._handleScrollRepeat(e,(t=this.tabsContainer.scrollLeft())!==null&&t!==void 0?t:0,100)},this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)}_handleScrollButtonMouseUp(){var e,t;clearTimeout((e=this.holdTimer)!==null&&e!==void 0?e:-1),this.holdTimer=null,cancelAnimationFrame((t=this.rAF)!==null&&t!==void 0?t:-1),this.rAF=null,window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)}_checkScrollArrows(){var e,t,n;this.tabsContainer.scrollLeft()===0?this.tabPreviousButton.first().prop("disabled",!0):((e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)+((t=this.tabsContainer.innerWidth())!==null&&t!==void 0?t:0)===((n=this.tabsContainer.get(0))===null||n===void 0?void 0:n.scrollWidth)?this.tabNextButton.prop("disabled",!0):(this.tabNextButton.prop("disabled",!1),this.tabPreviousButton.first().prop("disabled",!1))}_handleScrollRepeat(e,t){var n,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0,s=this.tabsContainer.get(0);if(s){var a=s.getBoundingClientRect();if(e===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(t-r),this.isDraggingTab&&this.parent._highlightHeaderDropZone(a.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(e===this.SCROLL_RIGHT){var l,h;if(this.tabsContainer.scrollLeft(t+r),this.isDraggingTab&&this.parent._highlightHeaderDropZone(a.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((h=this.tabsContainer.innerWidth())!==null&&h!==void 0?h:0)===s.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((n=this.rAF)!==null&&n!==void 0?n:-1),this.rAF=window.requestAnimationFrame(d=>{var u,f,v=o||d,c=d-v,g=this.START_SPEED*c+.5*this.ACCELERATION*(c*c);g=Math.min(g,(u=(f=this.tabsContainer.get(0))===null||f===void 0?void 0:f.scrollWidth)!==null&&u!==void 0?u: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,n,r,o;if(o=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new xe(this,o,"lm_tabdropdown",this._showAdditionalTabsDropdown),this.tabDropdownButton.element.hide(),this.controlsContainer.prepend(this.tabNextButton),this.tabNextButton.hide(),this._getHeaderSetting("popout")&&(t=this._onPopoutClick.bind(this),n=this._getHeaderSetting("popout"),new xe(this,n,"lm_popout",t)),this._getHeaderSetting("maximise")){r=this.parent.toggleMaximise.bind(this.parent);var s=this._getHeaderSetting("maximise"),a=this._getHeaderSetting("minimise"),l=new xe(this,s,"lm_maximise",r);this.parent.on("maximised",function(){l.element.attr("title",a??"")}),this.parent.on("minimised",function(){l.element.attr("title",s??"")})}this._isClosable()&&(e=this.parent.remove.bind(this.parent),n=this._getHeaderSetting("close"),this.closeButton=new xe(this,n,"lm_close",e))}_showAdditionalTabsDropdown(){if(this.isDropdownShown){this._hideAdditionalTabsDropdown();return}this.tabDropdownList=this.tabsContainer.clone(!0).appendTo(this.tabDropdownContainer).children().removeClass("lm_active"),m(document.body).append(this.tabDropdownContainer),this.tabDropdownContainer.show(),this.isDropdownShown=!0,this.element.addClass("lm_dropdown_open"),this.tabDropdownSearch.val("").focus(),this.dropdownKeyIndex=0,this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active"),m(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown()}_handleFilterKeydown(e){if(e.key==="Escape"){this._hideAdditionalTabsDropdown();return}if(this.dropdownKeyIndex===-1)return;if(e.key==="Enter"||e.key===" "){this._hideAdditionalTabsDropdown(),this.tabs[this.dropdownKeyIndex]._onTabClick();return}function t(a,l,h){if(h==null||h.length<2)return-1;for(var d=(a+l+h.length)%h.length;d!==a;){if(h.eq(d).css("display")!=="none")return d;d=(d+l+h.length)%h.length}return a}if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var n,r;e.preventDefault(),(n=this.tabDropdownList)===null||n===void 0||n.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,1,this.tabDropdownList),(r=this.tabDropdownList)===null||r===void 0||r.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}else if(e.key==="ArrowUp"||e.key==="Tab"){var o,s;e.preventDefault(),(o=this.tabDropdownList)===null||o===void 0||o.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,-1,this.tabDropdownList),(s=this.tabDropdownList)===null||s===void 0||s.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_handleFilterInput(e){if(this.tabDropdownList!=null){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var t=0;t<this.tabDropdownList.length;t++){var n,r;((n=(r=this.tabs[t].contentItem.config.title)===null||r===void 0?void 0:r.toLowerCase().indexOf(e.target.value.toLowerCase()))!==null&&n!==void 0?n:-1)!==-1?(this.tabDropdownList.eq(t).css("display",""),this.dropdownKeyIndex===-1&&(this.dropdownKeyIndex=t)):this.tabDropdownList.eq(t).css("display","none")}this.dropdownKeyIndex!==-1&&this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_hideAdditionalTabsDropdown(e){var t,n;this.isDropdownShown&&(e&&(t=this.tabDropdownContainer.get(0))!==null&&t!==void 0&&t.contains(e.target)||e&&((n=this.tabDropdownButton)===null||n===void 0?void 0:n.element.get(0))===e.target||(this.element.removeClass("lm_dropdown_open"),this.tabDropdownContainer.hide(),this.isDropdownShown=!1,this.element.append(this.tabDropdownContainer),this.tabDropdownContainer.find(".lm_tabs").remove(),m(document).off("mousedown",this._hideAdditionalTabsDropdown)))}_updateAdditionalTabsDropdown(){var e,t,n,r;if(this.isDropdownShown&&!(!this.tabDropdownList||this.tabDropdownList.length==0)){var o=(e=(t=this.tabDropdownContainer.get(0))===null||t===void 0?void 0:t.scrollHeight)!==null&&e!==void 0?e:0;if(o!==0){var s=this.tabDropdownContainer[0].getBoundingClientRect(),a=(n=m(window).height())!==null&&n!==void 0?n:0,l=(r=m(window).width())!==null&&r!==void 0?r:0;if(this.tabDropdownButton){var h=this.tabDropdownButton.element[0].getBoundingClientRect(),d=o<a-h.bottom,u=!d&&h.bottom>a*.6,f=Math.min(h.left+(u?h.width:0),l-s.width-this.PADDING),v=u?Math.max(h.top-o,this.PADDING):h.bottom,c=a-v-this.PADDING;this.tabDropdownContainer.css({"max-height":c,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 n;(n=this.tabDropdownButton)===null||n===void 0||n.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1}this.isOverflowing&&this._checkScrollArrows()}}}}w(te,"_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(""));w(te,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));w(te,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function Ee(i,e,t){return e=Cr(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Cr(i){var e=Pr(i,"string");return typeof e=="symbol"?e:String(e)}function Pr(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class on{constructor(e,t,n){Ee(this,"_isVertical",void 0),Ee(this,"_size",void 0),Ee(this,"_grabSize",void 0),Ee(this,"_dragListener",void 0),Ee(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=n<t?t:n,this.element=this._createElement(),this._dragListener=new je(this.element)}on(e,t,n){var r;(r=this._dragListener)===null||r===void 0||r.on(e,t,n)}_$destroy(){var e;(e=this._dragListener)===null||e===void 0||e.destroy(),this._dragListener=null,this.element.remove()}_createElement(){var e=m('<div class="lm_drag_handle"></div>'),t=m('<div class="lm_splitter"></div>');t.append(e);var n=this._grabSize-this._size,r=n/2;return this._isVertical?(e.css("top",-r),e.css("height",this._size+n),t.addClass("lm_vertical"),t.height(this._size)):(e.css("left",-r),e.css("width",this._size+n),t.addClass("lm_horizontal"),t.width(this._size)),t}}const Sr=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:Jt,DragProxy:fe,DragSource:Qt,DragSourceFromEvent:en,DropTargetIndicator:Re,Header:te,HeaderButton:xe,Splitter:on,Tab:$e},Symbol.toStringTag,{value:"Module"}));var Ir={config:Ci,container:Ei,controls:Sr,errors:sr,items:gr,utils:ki};const Mr=Ir;function xt(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function F(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xt(Object(t),!0).forEach(function(n){y(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):xt(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function y(i,e,t){return e=Er(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Er(i){var e=Dr(i,"string");return typeof e=="symbol"?e:String(e)}function Dr(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}class sn extends V{static minifyConfig(e){return ut(e)}static unminifyConfig(e){return nt(e)}constructor(e,t){super(),y(this,"isInitialised",!1),y(this,"_isFullPage",!1),y(this,"_resizeTimeoutId",void 0),y(this,"_components",{"lm-react-component":qt}),y(this,"_fallbackComponent",void 0),y(this,"_itemAreas",[]),y(this,"_maximisedItem",null),y(this,"_maximisePlaceholder",m('<div class="lm_maximise_place"></div>')),y(this,"_creationTimeoutPassed",!1),y(this,"_subWindowsCreated",!1),y(this,"_dragSources",[]),y(this,"_updatingColumnsResponsive",!1),y(this,"_firstLoad",!0),y(this,"_reactChildMap",new Map),y(this,"_reactChildren",null),y(this,"_initialHeaderHeight",void 0),y(this,"width",null),y(this,"height",null),y(this,"root",void 0),y(this,"openPopouts",[]),y(this,"selectedItem",null),y(this,"isSubWindow",!1),y(this,"eventHub",new Zt(this)),y(this,"config",void 0),y(this,"container",void 0),y(this,"_originalContainer",void 0),y(this,"dropTargetIndicator",null),y(this,"tabDropPlaceholder",m('<div class="lm_drop_tab_placeholder"></div>')),y(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:Ve.bind(this,!0),row:Ve.bind(this,!1),stack:st,component:rn}}registerComponent(e,t){if(typeof t!="function"&&(t==null||t.render==null||typeof t.render!="function"))throw new Error("Please register a constructor function");if(this._components[e]!==void 0)throw new Error("Component "+e+" is already registered");this._components[e]=t;var n=()=>{if(this._components[e]===void 0)throw new Error("Component "+e+" is not registered");delete this._components[e]};return n}setFallbackComponent(e){this._fallbackComponent=e}toConfig(e){if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");if(e&&!(e instanceof L))throw new Error("Root must be a ContentItem");var t={settings:F({},this.config.settings),dimensions:F({},this.config.dimensions),labels:F({},this.config.labels),content:[]},n=function o(s,a){for(var l in a.config)l!=="content"&&(s[l]=a.config[l]);if(s.componentName==="lm-react-component"&&(s.type="react-component"),a.contentItems.length){s.content=[];for(var h=0;h<a.contentItems.length;h++)s.content[h]={},o(s.content[h],a.contentItems[h])}};e?n(t,{contentItems:[e]}):n(t,this.root),this._$reconcilePopoutWindows(),t.openPopouts=[];for(var r=0;r<this.openPopouts.length;r++)t.openPopouts.push(this.openPopouts[r].toConfig());return t.maximisedItemId=this._maximisedItem?"__glMaximised":void 0,t}getComponent(e){return this._components[e]}getFallbackComponent(){return this._fallbackComponent}init(){if(this._subWindowsCreated===!1&&(this._createSubWindows(),this._subWindowsCreated=!0),document.readyState==="loading"||document.body===null){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 Re,this.updateSize(),this._create(this.config),this._bindEvents(),this.isInitialised=!0,this._adjustColumnsResponsive(),this.emit("initialised")}addReactChild(e,t){this._reactChildMap.set(e,t),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged")}removeReactChild(e,t){var n=this._reactChildMap.get(e);n===t&&(this._reactChildMap.delete(e),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged"))}getReactChildren(){return this._reactChildren}enableHeaders(){this.config.settings.hasHeaders=!0,this.config.dimensions.headerHeight=this._initialHeaderHeight,this._findAllStackContainers().forEach(e=>{e._header.show=!0,e.header.element.toggle(!0)}),this.updateSize()}disableHeaders(){this.config.settings.hasHeaders=!1,this.config.dimensions.headerHeight=0,this._findAllStackContainers().forEach(e=>{e._header.show=!1,e.header.element.toggle(!1)}),this.updateSize()}updateSize(e,t){var n,r;if(this.width=(n=e??this.container.width())!==null&&n!==void 0?n:0,this.height=(r=t??this.container.height())!==null&&r!==void 0?r:0,this.isInitialised===!0){if(this.root.callDownwards("setSize",[this.width,this.height]),this._maximisedItem){var o,s;this._maximisedItem.element.width((o=this.container.width())!==null&&o!==void 0?o:0),this._maximisedItem.element.height((s=this.container.height())!==null&&s!==void 0?s:0),this._maximisedItem.callDownwards("setSize")}this._adjustColumnsResponsive()}}destroy(){var e;this.isInitialised===!1||!this.root||(this._onUnload(),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 n,r,o;if(typeof e.type!="string")throw new ce("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!this._typeToItem[e.type])throw r="Unknown type '"+e.type+"'. Valid types are "+Object.keys(this._typeToItem).join(","),new ce(r);return e.type==="component"&&!(t instanceof st)&&t&&!(this.isSubWindow===!0&&t instanceof ot)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),e.id=(n=e.id)!==null&&n!==void 0?n:Ge(),o=new this._typeToItem[e.type](this,e,t),o}createPopout(e,t,n,r){var o=[],s=e instanceof L,a=this;if(s){var l;o=this.toConfig(e).content,n=Ge();for(var h=e.parent,d=e;((u=h)===null||u===void 0?void 0:u.contentItems.length)===1&&!h.isRoot;){var u;d=h,h=h.parent}if((l=h)===null||l===void 0||l.addId(n),r==null||Number.isNaN(r)){var f;r=(f=h)===null||f===void 0?void 0:f.contentItems.indexOf(d)}}else e instanceof Array?o=e:o=[e];if(!t&&s){var v,c,g,x=window.screenX||window.screenLeft,E=window.screenY||window.screenTop,T=(v=e.element.offset())!==null&&v!==void 0?v:{left:0,top:0};t={left:x+T.left,top:E+T.top,width:(c=e.element.width())!==null&&c!==void 0?c:0,height:(g=e.element.height())!==null&&g!==void 0?g:0}}if(!t&&!s&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),s&&e.remove(),!(!t||!n||r===void 0)){var P=new Jt(o,t,n,r,this);return P.on("initialised",function(){a.emit("windowOpened",P)}),P.on("closed",function(){a._$reconcilePopoutWindows()}),this.openPopouts.push(P),P}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var n=new Qt(e,t,this);return this._dragSources.push(n),n}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new en(e,this,t)}selectItem(e,t){if(this.config.settings.selectionEnabled!==!0)throw new Error("Please set selectionEnabled to true to use this feature");e!==this.selectedItem&&(this.selectedItem!==null&&this.selectedItem.deselect(),e&&t!==!0&&e.select(),this.selectedItem=e,this.emit("selectionChanged",e))}_$maximiseItem(e){var t,n;this._maximisedItem!==null&&this._$minimiseItem(this._maximisedItem),this._maximisedItem=e,this._maximisedItem.addId("__glMaximised"),e.element.addClass("lm_maximised"),e.element.after(this._maximisePlaceholder),this.root.element.prepend(e.element),e.element.width((t=this.container.width())!==null&&t!==void 0?t:0),e.element.height((n=this.container.height())!==null&&n!==void 0?n:0),e.callDownwards("setSize"),this._maximisedItem.emit("maximised"),this.emit("stateChanged")}_$minimiseItem(e){var t;e.element.removeClass("lm_maximised"),e.removeId("__glMaximised"),this._maximisePlaceholder.after(e.element),this._maximisePlaceholder.remove(),(t=e.parent)===null||t===void 0||t.callDownwards("setSize"),this._maximisedItem=null,e.emit("minimised"),this.emit("stateChanged")}_$closeWindow(){window.setTimeout(function(){window.close()},1)}_$getArea(e,t){for(var n=1/0,r=null,o=0;o<this._itemAreas.length;o++){var s=this._itemAreas[o];e>s.x1&&e<s.x2&&t>s.y1&&t<s.y2&&n>s.surface&&(n=s.surface,r=s)}return r}_$createRootItemAreas(){var e=50,t=F({},this.root._$getArea()),n=[F(F({},t),{},{side:"left",x2:t.x1+e}),F(F({},t),{},{side:"right",x1:t.x2-e}),F(F({},t),{},{side:"top",y2:t.y1+e}),F(F({},t),{},{side:"bottom",y1:t.y2-e})];n.forEach(r=>{r.surface=(r.x2-r.x1)*(r.y2-r.y1)}),this._itemAreas.push(...n)}_$calculateItemAreas(){var e=this._getAllContentItems();if(this._itemAreas=[],e.length===1){this._itemAreas.push(this.root._$getArea());return}this._$createRootItemAreas();for(var t=0;t<e.length;t++){var n=e[t];if(me(n)){var r=n._$getArea();if(r!==null)if(r instanceof Array)this._itemAreas=this._itemAreas.concat(r);else{var o;this._itemAreas.push(r);var s=F(F({},r),(o=r.contentItem._contentAreaDimensions)===null||o===void 0?void 0:o.header.highlightArea);s.surface=(s.x2-s.x1)*(s.y2-s.y1),this._itemAreas.push(s)}}}}_$normalizeContentItem(e,t){if(!e)throw new Error("No content item defined");if(typeof e=="function"&&(e=e()),e instanceof L)return e;if(m.isPlainObject(e)&&e.type){var n=this.createContentItem(e,t);return n.callDownwards("_$init"),n}else throw new Error("Invalid contentItem")}_$reconcilePopoutWindows(){for(var e=[],t=0;t<this.openPopouts.length;t++){var n;((n=this.openPopouts[t].getWindow())===null||n===void 0?void 0:n.closed)===!1?e.push(this.openPopouts[t]):this.emit("windowClosed",this.openPopouts[t])}this.openPopouts.length!==e.length&&(this.emit("stateChanged"),this.openPopouts=e)}_getAllContentItems(){var e=[],t=n=>{if(e.push(n),n.contentItems instanceof Array)for(var r=0;r<n.contentItems.length;r++)t(n.contentItems[r])};return t(this.root),e}_bindEvents(){this._isFullPage&&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,n=Xt("gl-window");n&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(n)||"{}"),e=nt(e),localStorage.removeItem(n)),e=m.extend(!0,{},Ut,e);var r=function o(s){for(var a in s){var l=s[a];a!=="props"&&typeof l=="object"&&l!=null?o(l):a==="type"&&l==="react-component"&&(s.type="component",s.componentName="lm-react-component")}};return r(e),((t=e.settings)===null||t===void 0?void 0:t.hasHeaders)===!1&&(e.dimensions.headerHeight=0),e}_adjustToWindowMode(){var e,t=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=dt((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 ce(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new ce(t,e);this.root=new ot(this,{content:e.content},this.container),this.root.callDownwards("_$init"),e.maximisedItemId==="__glMaximised"&&this.root.getItemsById(e.maximisedItemId)[0].toggleMaximise()}_onUnload(){if(this.config.settings.closePopoutsOnUnload===!0)for(var e=0;e<this.openPopouts.length;e++)this.openPopouts[e].close()}_adjustColumnsResponsive(){if(!this._useResponsiveLayout()||this._updatingColumnsResponsive||!this.config.dimensions||!this.config.dimensions.minItemWidth||this.root.contentItems.length===0||!this.root.contentItems[0].isRow){this._firstLoad=!1;return}this._firstLoad=!1;var e=this.root.contentItems[0].contentItems.length;if(!(e<=1)){var t=this.config.dimensions.minItemWidth,n=e*t;if(!(this.width==null||n<=this.width)){this._updatingColumnsResponsive=!0;for(var r=Math.max(Math.floor(this.width/t),1),o=e-r,s=this.root.contentItems[0],a=this._findAllStackContainers()[0],l=0;l<o;l++){var h=s.contentItems[s.contentItems.length-1];this._addChildContentItemsToContainer(a,h)}this._updatingColumnsResponsive=!1}}}_useResponsiveLayout(){return this.config.settings&&(this.config.settings.responsiveMode=="always"||this.config.settings.responsiveMode=="onload"&&this._firstLoad)}_addChildContentItemsToContainer(e,t){t.type==="stack"?t.contentItems.forEach(function(n){e.addChild(n),t.removeChild(n,!0)}):t.contentItems.forEach(n=>{this._addChildContentItemsToContainer(e,n)})}_findAllStackContainers(){var e=[];return this._findAllStackContainersRecursive(e,this.root),e}_findAllStackContainersRecursive(e,t){t.contentItems.forEach(n=>{me(n)?e.push(n):n.isComponent||this._findAllStackContainersRecursive(e,n)})}}y(sn,"__lm",Mr);const xr=sn,Or="_lm_dragging_k4a5m_1",Tr="_lm_goldenlayout_k4a5m_1",Ar="_lm_header_k4a5m_1",Lr="_lm_controls_k4a5m_1",jr="_lm_tabpreviousbutton_k4a5m_1",Rr="_lm_tabnextbutton_k4a5m_1",$r="_lm_tab_k4a5m_1",Nr="_lm_active_k4a5m_1",Fr="_lm_close_tab_k4a5m_1",Wr="_lm_content_k4a5m_1",Br="_lm_dragProxy_k4a5m_1",Hr="_lm_dropTargetIndicator_k4a5m_1",zr="_march_k4a5m_1",kr="_lm_inner_k4a5m_1",Kr="_lm_splitter_k4a5m_1",Ur="_lm_selectable_k4a5m_1",Gr="_lm_tabdropdown_list_k4a5m_1",Yr="_lm_title_k4a5m_1",Vr="_lm_title_before_k4a5m_1",Xr="_lm_selected_k4a5m_1",qr="_lm_focusin_k4a5m_1",Zr="_lm_window_blur_k4a5m_1",Jr="_lm_popout_k4a5m_1",Qr="_lm_maximise_k4a5m_1",eo="_lm_tabdropdown_k4a5m_1",to="_lm_close_k4a5m_1",no="_lm_tabdropdown_search_k4a5m_1",io="_lm_tabs_k4a5m_1",ro="_lm_keyboard_active_k4a5m_1",oo="_lm_maximised_k4a5m_1",so="_lm_items_k4a5m_1",Ot={"tab-height":"28px","drag-border-width":"5px",lm_dragging:Or,lm_goldenlayout:Tr,lm_header:Ar,lm_controls:Lr,lm_tabpreviousbutton:jr,lm_tabnextbutton:Rr,lm_tab:$r,lm_active:Nr,lm_close_tab:Fr,lm_content:Wr,lm_dragProxy:Br,lm_dropTargetIndicator:Hr,march:zr,lm_inner:kr,lm_splitter:Kr,lm_selectable:Ur,lm_tabdropdown_list:Gr,lm_title:Yr,lm_title_before:Vr,lm_selected:Xr,lm_focusin:qr,lm_window_blur:Zr,lm_popout:Jr,lm_maximise:Qr,lm_tabdropdown:eo,lm_close:to,lm_tabdropdown_search:no,lm_tabs:io,lm_keyboard_active:ro,lm_maximised:oo,lm_items:so},Tt=Object.freeze({tabHeight:parseInt(Ot["tab-height"],10),dragBorderWidth:parseInt(Ot["drag-border-width"],10)});function At(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Q(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?At(Object(t),!0).forEach(function(n){an(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):At(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function an(i,e,t){return e=ao(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ao(i){var e=lo(i,"string");return typeof e=="symbol"?e:String(e)}function lo(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var oe=Ce.module("LayoutUtils");function ln(i){return i.componentName!==void 0}function ye(i){var e=i;return(ln(i)&&i.componentName==="lm-react-component"||i.type==="react-component")&&e.component!==void 0}function He(i){return i.focus!==void 0}function Lt(i){return i.type==="stack"}class p{static activateTab(e,t){var n=p.getStackForRoot(e,t,!1);if(!n){oe.error("Could not find stack for config",t);return}var r=p.getContentItemInStack(n,t);r&&n.setActiveContentItem(r)}static isActiveTab(e,t){var n=p.getStackForRoot(e,t,!1);if(!n)return oe.error("Could not find stack for config",t),!1;var r=p.getContentItemInStack(n,t),o=n.getActiveContentItem();return o===r}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=t?"column":"row";if(nn(e)){(e.contentItems==null||e.contentItems.length===0)&&e.addChild({type:n});var r=e.contentItems[0],o=t?r.isColumn:r.isRow;if(!o){e.removeChild(r,!0),e.addChild({type:n});var s=document.activeElement;e.contentItems[0].addChild(r),s&&s.focus!=null&&s.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var a=e.contentItems[e.contentItems.length-1],l=t?a.isRow:a.isColumn;return l||(e.addChild({type:t?"row":"column"}),e.removeChild(a,!0),e.contentItems[e.contentItems.length-1].addChild(a),a=e.contentItems[e.contentItems.length-1]),this.addStack(a,!t)}static getStackById(e,t){var n,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(r&&me(e)&&e.contentItems.length===0)return e;if(t===((n=e.config)===null||n===void 0?void 0:n.id)){if(me(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 s=this.getStackById(e.contentItems[o],t,r);if(s)return s}return null}static getStackForConfig(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(n&&me(e)&&e.contentItems.length===0)return e;if(e.contentItems==null)return null;for(var r=0;r<e.contentItems.length;r+=1){var o=e.contentItems[r];if(o.isComponent&&o.config!=null&&gt(o.config,t))return e;var s=this.getStackForConfig(o,t,n);if(s)return s}return null}static getStackForRoot(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=this.getStackForConfig(e,t);return!s&&r&&(s=this.getStackForConfig(e,{component:t.component},o)),!s&&n&&(s=this.addStack(e)),s}static getStackForComponentTypes(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=0;s<t.length;s+=1){var a=t[s],l=s===t.length-1,h=p.getStackForRoot(e,{component:a},n&&l,r,o);if(h)return h}return null}static getContentItemInStack(e,t){if(!e)return null;for(var n=0;n<e.contentItems.length;n+=1){var r=e.contentItems[n];if(r.isComponent&&r.config!=null&&gt(r.config,t))return r}return null}static dehydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var n=[],r=0;r<e.length;r+=1){var o=e[r],{component:s,content:a}=o;if(s){var l=t(s,o);l!=null?n.push(l):oe.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(s,'"'))}else if(a){var h=Q(Q({},o),{},{content:p.dehydrateLayoutConfig(a,t)});n.push(h)}else n.push(o)}return n}static getTabPoint(e){var{tab:t}=e;if(t==null)throw new Error("Cannot get tab for panel container ".concat(e));var n=t.element[0].getBoundingClientRect();return[n.left+n.width*.5,n.bottom-8]}static dropLayoutMinorChange(e){for(var t=0;t<e.length;t+=1){var n=e[t],{content:r}=n;r!==void 0?(Lt(n)&&delete n.activeItemIndex,p.dropLayoutMinorChange(r)):ye(n)&&n.component==="IrisGridPanel"&&n.props.panelState!=null&&(delete n.id,n.props.panelState.irisGridState.sorts=[],n.props.panelState.irisGridState.quickFilters=[],n.props.panelState.gridState.isStuckToBottom=!1,n.props.panelState.gridState.isStuckToRight=!1)}}static isEqual(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=p.cloneLayout(e),o=p.cloneLayout(t);return n?(p.dropLayoutMinorChange(r),p.dropLayoutMinorChange(o),et(r,o)):et(r,o)}static cloneLayout(e){return JSON.parse(JSON.stringify(e))}static hydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var n=[],r=0;r<e.length;r+=1){var o=e[r];if(ye(o)){var s,{component:a,props:l={}}=o;n.push(Q(Q({},o),{},{id:(s=o==null?void 0:o.id)!==null&&s!==void 0?s:ke(),props:t(a,l)}))}else if(o.content!==void 0){var h=p.hydrateLayoutConfig(o.content,t);Lt(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=h.length&&(oe.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),n.push(Q(Q({},o),{},{content:h}))}else n.push(o)}return n}static openComponent(){var{root:e,config:t,stack:n=void 0,replaceExisting:r=!0,replaceConfig:o=void 0,createNewStack:s=!1,focusElement:a=void 0,dragEvent:l=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},h=document.activeElement,d=Q({},t);if(d.id==null&&(d.id=ke.generate()),l!=null){e==null||e.layoutManager.createDragSourceFromEvent(d,l);return}var u=o||{id:d.id,component:d.component};pt(e);var f=n??(s?p.addStack(e):p.getStackForRoot(e,u));pt(f);var v=p.getContentItemInStack(f,u);if(a!=null){var c=x=>{oe.debug("Component created, focusing element",a),f.off("componentCreated",c);var{element:E}=x.origin;requestAnimationFrame(()=>{p.focusElement(E[0],a)})};f.on("componentCreated",c)}if(r&&v){var g=f.contentItems.indexOf(v);f.addChild(d,g+1),f.removeChild(v),f.setActiveContentItem(f.contentItems[g])}else f.addChild(d);a==null&&h&&He(h)&&h.focus()}static openComponentInStack(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=document.activeElement,o={id:t.id},s=p.getContentItemInStack(e,o);if(n&&s&&e){var a=e==null?void 0:e.contentItems.indexOf(s);e.addChild(t,a+1),e.removeChild(s),e.setActiveContentItem(e.contentItems[a])}else e==null||e.addChild(t);r&&He(r)&&r.focus()}static closeComponent(e,t,n){var r=p.getStackForRoot(e,t,!1,!1,!1);if(!r){oe.warn("Cannot find stack for component, ignoring close",t);return}var o=p.getContentItemInStack(r,t),s=document.activeElement;o&&(U(o)?o.container.close(n):r.removeChild(o)),s&&document.contains(s)&&He(s)&&s.focus()}static renameComponent(e,t,n){var r=p.getStackForRoot(e,t,!1);if(!r){oe.error("Could not find stack for config",t);return}var o=p.getContentItemInStack(r,t);o&&o.setTitle(n)}static cloneComponent(e,t){var n=p.getStackForRoot(e,t,!1);if(!n)return oe.error("Could not find stack for config",t),null;var{props:r={}}=t,o=p.getPanelComponentState(t),s={type:"react-component",component:t.component,props:Q(Q({},r),{},{panelState:o}),title:"".concat(t.title," Copy"),id:ke.generate()};return p.openComponentInStack(n,s),s}static getPanelComponentState(e){if(ln(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(ye(e)){var n;return(n=e.props)===null||n===void 0?void 0:n.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:Tt.tabHeight,borderWidth:Tt.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=p.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return p.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,n=p.getComponentConfigFromContainer(t);if(n&&ye(n)){var r;return(r=n.component)!==null&&r!==void 0?r:null}return null}static getComponentName(e){var t,n,r=(t=(n=e.WrappedComponent)===null||n===void 0?void 0:n.displayName)!==null&&t!==void 0?t:e.displayName;if(r==null)throw new Error("Component displayName not defined ".concat(e));return r}static focusElement(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var n=e.querySelector(t);return n==null?null:(He(n)&&n.focus(),n)}static onInitialized(e){return new Promise(t=>{if(e.isInitialised){t();return}var n=()=>{e.off("initialised",n),t()};e.on("initialised",n)})}}an(p,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var ho=z.forwardRef((i,e)=>{var t=p.getComponentNameFromPanel({props:i});return b.jsx("div",{ref:e,className:"panel-placeholder",children:b.jsxs("div",{children:['Component "',t,'" is not registered.']})})});ho.displayName="PanelPlaceholder";const D=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 Xe(i){return(i==null?void 0:i.WrappedComponent)!==void 0}function uo(i){return typeof i.id=="string"&&i.layout instanceof xr&&i.panelManager instanceof mt&&typeof i.registerComponent=="function"}function as(i){if(!uo(i))throw new Error("Expected dashboard plugin props, but instead received ".concat(i))}function jt(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function Rt(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?jt(Object(t),!0).forEach(function(n){ae(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):jt(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function ae(i,e,t){return e=co(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function co(i){var e=mo(i,"string");return typeof e=="symbol"?e:String(e)}function mo(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var K=Ce.module("PanelManager");class mt{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(a,l)=>l,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(a,l)=>l,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:new Map,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:()=>{};ae(this,"layout",void 0),ae(this,"hydrateComponent",void 0),ae(this,"dehydrateComponent",void 0),ae(this,"onPanelsUpdated",void 0),ae(this,"closed",void 0),ae(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=n,this.onPanelsUpdated=s,this.openedMap=new Map(r),this.closed=[...o],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(D.FOCUS,this.handleFocus),e.on(D.MOUNT,this.handleMount),e.on(D.UNMOUNT,this.handleUnmount),e.on(D.REOPEN,this.handleReopen),e.on(D.REOPEN_LAST,this.handleReopenLast),e.on(D.DELETE,this.handleDeleted),e.on(D.CLOSED,this.handleClosed),e.on(D.CLOSE,this.handleControlClose)}stopListening(){var{eventHub:e}=this.layout;e.off(D.FOCUS,this.handleFocus),e.off(D.MOUNT,this.handleMount),e.off(D.UNMOUNT,this.handleUnmount),e.off(D.REOPEN,this.handleReopen),e.off(D.REOPEN_LAST,this.handleReopenLast),e.off(D.DELETE,this.handleDeleted),e.off(D.CLOSED,this.handleClosed),e.off(D.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 p.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&ye(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,n=p.getStackForConfig(this.layout.root,{id:e});return(t=n&&p.getContentItemInStack(n,{id:e}))!==null&&t!==void 0?t:null}getLastUsedPanel(e){for(var t=this.getOpenedPanels(),n=t.length-1;n>=0;n-=1){var r=t[n];if(e==null||e(r))return r}}getLastUsedPanelOfType(e){return this.getLastUsedPanelOfTypes([e])}getLastUsedPanelOfTypes(e){return this.getLastUsedPanel(t=>e.some(n=>Xe(n)&&t instanceof n.WrappedComponent||!Xe(n)&&t instanceof n))}updatePanel(e){var t=p.getIdFromPanel(e);if(t==null){K.error("updatePanel Panel did not have an ID",e);return}K.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=p.getIdFromPanel(e);if(t==null){K.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){K.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){K.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}K.debug2("Removing panel ID ".concat(t," from open panels map")),this.openedMap.delete(t)}removeClosedPanelConfig(e){var t=this.closed.findIndex(n=>n===e||n.id!=null&&e.id!=null&&n.id===e.id);t>=0&&this.closed.splice(t,1)}handleFocus(e){K.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){K.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){K.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}handleReopen(e,t){K.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:n}=e,{props:r}=e;r=this.hydrateComponent(n,r);var o=Rt(Rt({},e),{},{props:r}),{root:s}=this.layout,a=e.parentStackId===void 0?void 0:p.getStackById(s,e.parentStackId);p.openComponent({root:s,config:o,replaceConfig:t,stack:a??void 0})}handleReopenLast(e){var t;if(this.closed.length!==0){if(e===void 0){this.handleReopen(this.closed[this.closed.length-1]);return}for(var n=(t=p.getStackForConfig(this.layout.root,e.getConfig()))===null||t===void 0?void 0:t.config.id,r=this.closed.length-1;r>=0;r-=1){var o=this.closed[r];if(o.parentStackId===n){this.handleReopen(o);return}}}}handleDeleted(e){K.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){K.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:n}=this.layout;p.closeComponent(n,t)}addClosedPanel(e){var{root:t}=this.layout,n=p.getComponentConfigFromContainer(e);if(n&&ye(n)){var r,o=this.dehydrateComponent(n.component,n);o.parentStackId=(r=p.getStackForConfig(t,n))===null||r===void 0?void 0:r.config.id,this.closed.push(o)}}sendUpdate(){var{closed:e,openedMap:t}=this;this.onPanelsUpdated({closed:[...e],openedMap:new Map(t)})}}ae(mt,"MAX_CLOSED_PANEL_COUNT",100);var fo=Ce.module("PanelErrorBoundary");class vo extends S.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}componentWillUnmount(){var{glContainer:e,glEventHub:t}=this.props,n=p.getIdFromContainer(e);fo.debug("componentWillUnmount",n),t.emit(D.CLOSED,n,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?b.jsx("div",{className:"panel-error-boundary",children:b.jsx(xn,{errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e}}function $t(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function qe(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?$t(Object(t),!0).forEach(function(n){po(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):$t(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function po(i,e,t){return e=go(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function go(i){var e=_o(i,"string");return typeof e=="symbol"?e:String(e)}function _o(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function hn(i){var{props:e,componentState:t}=i,{metadata:n}=e,{panelState:r=null}=e;t&&({panelState:r}=t);var o={};return n!=null&&(o.metadata=n),r!=null&&(o.panelState=r),qe(qe({},i),{},{componentState:null,props:o,type:"react-component"})}function dn(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return qe(qe({},i),{},{localDashboardId:e})}function bo(i){var e=Xe(i)&&i.WrappedComponent.prototype!=null&&i.WrappedComponent.prototype.isReactComponent!=null||i.prototype!=null&&i.prototype.isReactComponent!=null,t=!Xe(i)&&"$$typeof"in i&&i.$$typeof===An.ForwardRef;return e||t}const ls={dehydrate:hn,hydrate:dn};var hs=z.createContext(void 0),yo=C.shape({on:C.func,off:C.func,isHidden:C.bool,tab:C.shape({header:C.shape({tabs:C.arrayOf(C.shape({contentItem:C.shape({})}))})}),title:C.string,setTitle:C.func,close:C.func}),un=C.shape({on:C.func,off:C.func,emit:C.func}),wo=C.shape({registerComponent:C.func,root:C.shape({addChild:C.func}),on:C.func,off:C.func,eventHub:un}),Co=Object.freeze({Container:yo,EventHub:un,Layout:wo});function be(i,e,t){S.useEffect(function(){return i.on(e,t),()=>{i.off(e,t)}},[i,e,t])}var cn="SET_DASHBOARD_DATA";const Po=Kn(cn,{},!1),So={dashboardData:Po};var Io=new Map,mn=Object.freeze({}),Mo=Object.freeze([]),Eo=i=>i.dashboardData,Pe=(i,e)=>{var t;return(t=Eo(i)[e])!==null&&t!==void 0?t:mn},ds=(i,e)=>{var t;return(t=Pe(i,e).closed)!==null&&t!==void 0?t:Mo},us=(i,e)=>{var t;return(t=Pe(i,e).openedMap)!==null&&t!==void 0?t:Io},fn=(i,e)=>{var t;return(t=Pe(i,e).pluginDataMap)!==null&&t!==void 0?t:mn},cs=(i,e,t)=>fn(i,e)[t];function Nt(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function we(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Nt(Object(t),!0).forEach(function(n){Do(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Nt(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Do(i,e,t){return e=xo(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function xo(i){var e=Oo(i,"string");return typeof e=="symbol"?e:String(e)}function Oo(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var vn=(i,e)=>({type:cn,id:i,payload:e}),To=(i,e)=>(t,n)=>t(vn(i,we(we({},Pe(n(),i)),e))),ms=(i,e,t)=>(n,r)=>n(vn(i,we(we({},Pe(r(),i)),{},{pluginDataMap:we(we({},fn(r(),i)),{},{[e]:t})})));Object.entries(So).map(i=>{var[e,t]=i;return On.register(e,t)});function Ao(i){var{children:e}=i;return b.jsx(b.Fragment,{children:e})}function Ft(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),t.push.apply(t,n)}return t}function De(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ft(Object(t),!0).forEach(function(n){Lo(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Ft(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function Lo(i,e,t){return e=jo(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function jo(i){var e=Ro(i,"string");return typeof e=="symbol"?e:String(e)}function Ro(i,e){if(typeof i!="object"||i===null)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}var ze=Ce.module("DashboardLayout"),$o=Object.freeze({}),No=[],Wt=()=>{},Bt=i=>i;function Fo(i){var e,t,{id:n,children:r,emptyDashboard:o=b.jsx("div",{children:"Dashboard is empty."}),layout:s,layoutConfig:a=No,onLayoutChange:l=Wt,onLayoutInitialized:h=Wt,hydrate:d=dn,dehydrate:u=hn,panelWrapper:f=Ao}=i,v=Ln(),c=(e=jn(_=>Pe(_,n)))!==null&&e!==void 0?e:$o,[g,x]=S.useState(!1),[E,T]=S.useState(!1),[P,G]=S.useState(),[N]=S.useState((t=c==null?void 0:c.closed)!==null&&t!==void 0?t:[]),[Z,j]=S.useState(s.getReactChildren()),R=S.useMemo(()=>new Map,[]),$=S.useMemo(()=>new Map,[]),he=S.useCallback(function(_,I){var M,Ie=arguments.length>2&&arguments[2]!==void 0?arguments[2]:d,ft=arguments.length>3&&arguments[3]!==void 0?arguments[3]:u;ze.debug2("registerComponent",_,I,Ie,ft);function vt(Ne,gn){var Ze=I,_n=f,bn=bo(Ze),{glContainer:yn,glEventHub:wn}=Ne;return b.jsx(vo,{glContainer:yn,glEventHub:wn,children:b.jsx(_n,De(De({},Ne),{},{children:bn?b.jsx(Ze,De(De({},Ne),{},{ref:gn})):b.jsx(Ze,De({},Ne))}))})}vt.displayName="DashboardWrapper(".concat((M=I.displayName)!==null&&M!==void 0?M:_,")");var pn=s.registerComponent(_,z.forwardRef(vt));return R.set(_,Ie),$.set(_,ft),pn},[d,u,R,$,s,f]),B=S.useCallback((_,I)=>{var M;return((M=R.get(_))!==null&&M!==void 0?M:Bt)(I,n)},[R,n]),ne=S.useCallback((_,I)=>{var M;return((M=$.get(_))!==null&&M!==void 0?M:Bt)(I,n)},[$,n]),X=S.useMemo(()=>new mt(s,B,ne,new Map,N,_=>{var{closed:I,openedMap:M}=_;v(To(n,{closed:I,openedMap:M}))}),[ne,v,B,n,N,s]),ie=S.useCallback(()=>{if(!E){var _=s.toConfig(),I=_.content,M=p.dehydrateLayoutConfig(I,ne),Ie=P==null||!p.isEqual(P,M);ze.debug("handleLayoutStateChanged",Ie,I,M),Ie&&(x(s.root.contentItems.length===0),G(M),l(M),j(s.getReactChildren()))}},[ne,E,P,s,l]),q=S.useCallback(_=>{var I=p.getIdFromContainer(_);s.eventHub.emit(D.DRAGGING,I),T(!0)},[s.eventHub]),J=S.useCallback(_=>{var I=p.getIdFromContainer(_);s.eventHub.emit(D.DROPPED,I),T(!1)},[s.eventHub]),ve=S.useCallback(_=>{if(ze.debug2("handleComponentCreated",_),!(_==null||_.config==null||_.config.component==null||_.element==null)){var I=_.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),M="".concat(I,"-component");_.element.addClass(M)}},[]),Se=S.useCallback(()=>{j(s.getReactChildren())},[s]);be(s,"stateChanged",ie),be(s,"itemPickedUp",q),be(s,"itemDropped",J),be(s,"componentCreated",ve),be(s.eventHub,D.TITLE_CHANGED,ie),be(s,"reactChildrenChanged",Se);var pe=ei(a);return S.useEffect(function(){if(pe!==a&&a!==P){ze.debug("Setting new layout content...");for(var I=p.hydrateLayoutConfig(a,B);s.root.contentItems.length>0;)s.root.contentItems[0].remove();for(var M=0;M<I.length;M+=1)s.root.addChild(I[M]);x(s.root.contentItems.length===0)}},[B,s,a,P,X,pe]),S.useEffect(()=>h(),[]),b.jsxs(b.Fragment,{children:[g&&o,Z,z.Children.map(r,_=>_!=null?z.cloneElement(_,{id:n,layout:s,panelManager:X,registerComponent:he}):null)]})}Fo.propTypes={id:C.string.isRequired,children:C.node,data:C.shape({}),emptyDashboard:C.node,layout:Co.Layout.isRequired,layoutConfig:C.arrayOf(C.shape({})),onLayoutChange:C.func,onLayoutInitialized:C.func};var fs="default";export{Pe as $,es as A,pi as B,Xo as C,fs as D,Ko as E,ts as F,_i as G,Kt as H,ns as I,wt as J,be as K,p as L,hs as M,cs as N,ci as O,D as P,Fo as Q,ls as R,Co as S,Qn as T,vo as U,mt as V,cn as W,as as X,bo as Y,hn as Z,ds as _,Eo as a,us as a0,fn as a1,dn as a2,uo as a3,Xe as a4,So as a5,vn as a6,To as a7,xr as a8,ho as a9,Bn as aa,Vo as ab,Uo as ac,Fn as ad,ko as ae,zo as af,U as ag,ms as b,ei as c,Go as d,ue as e,ri as f,Jo as g,zt as h,kt as i,qo as j,Zo as k,Qo as l,Ct as m,os as n,lt as o,Le as p,mi as q,Yo as r,Ho as s,is as t,Ht as u,rs as v,bi as w,gi as x,vi as y,fi as z};
2
+ //# sourceMappingURL=DashboardConstants-666eb926.js.map