@deephaven/embed-widget 0.80.1 → 0.81.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/build/assets/{App-a7fabfed.js → App-0b88cb92.js} +2 -2
  2. package/build/assets/{App-a7fabfed.js.map → App-0b88cb92.js.map} +1 -1
  3. package/build/assets/{Chart-c5645eba.js → Chart-ebc6d15e.js} +2 -2
  4. package/build/assets/{Chart-c5645eba.js.map → Chart-ebc6d15e.js.map} +1 -1
  5. package/build/assets/{DashboardConstants-443d54b5.js → DashboardConstants-23023426.js} +2 -2
  6. package/build/assets/{DashboardConstants-443d54b5.js.map → DashboardConstants-23023426.js.map} +1 -1
  7. package/build/assets/{IrisGrid-0253433e.js → IrisGrid-3e6902ca.js} +2 -2
  8. package/build/assets/{IrisGrid-0253433e.js.map → IrisGrid-3e6902ca.js.map} +1 -1
  9. package/build/assets/{IrisGridThemeProvider-e0411bab.js → IrisGridThemeProvider-f2257896.js} +2 -2
  10. package/build/assets/{IrisGridThemeProvider-e0411bab.js.map → IrisGridThemeProvider-f2257896.js.map} +1 -1
  11. package/build/assets/{MarkdownEditor-b49fe189.js → MarkdownEditor-93a30389.js} +2 -2
  12. package/build/assets/{MarkdownEditor-b49fe189.js.map → MarkdownEditor-93a30389.js.map} +1 -1
  13. package/build/assets/{MarkdownNotebook-1be91c34.js → MarkdownNotebook-21c0fdd8.js} +2 -2
  14. package/build/assets/{MarkdownNotebook-1be91c34.js.map → MarkdownNotebook-21c0fdd8.js.map} +1 -1
  15. package/build/assets/Plot-dcb8d374.js +2 -0
  16. package/build/assets/{Plot-caca304e.js.map → Plot-dcb8d374.js.map} +1 -1
  17. package/build/assets/{Plotly-edeb441c.js → Plotly-95a28c6f.js} +2 -2
  18. package/build/assets/{Plotly-edeb441c.js.map → Plotly-95a28c6f.js.map} +1 -1
  19. package/build/assets/index-10a3c25b.js +4 -0
  20. package/build/assets/index-10a3c25b.js.map +1 -0
  21. package/build/assets/{index-deb6051c.js → index-7d530b2c.js} +2 -2
  22. package/build/assets/{index-deb6051c.js.map → index-7d530b2c.js.map} +1 -1
  23. package/build/assets/{index-b5e8a95b.js → index-80cca098.js} +4 -4
  24. package/build/assets/{index-b5e8a95b.js.map → index-80cca098.js.map} +1 -1
  25. package/build/assets/plotly-02b3070a.js +7 -0
  26. package/build/assets/{plotly-ce3c7663.js.map → plotly-02b3070a.js.map} +1 -1
  27. package/build/assets/{useUser-88b9be49.js → useUser-b819646e.js} +2 -2
  28. package/build/assets/{useUser-88b9be49.js.map → useUser-b819646e.js.map} +1 -1
  29. package/build/index.html +2 -2
  30. package/package.json +17 -17
  31. package/build/assets/Plot-caca304e.js +0 -2
  32. package/build/assets/index-3348c099.js +0 -4
  33. package/build/assets/index-3348c099.js.map +0 -1
  34. package/build/assets/plotly-ce3c7663.js +0 -7
@@ -1,2 +1,2 @@
1
- import{aH as vi,aI as pi,aJ as gi,k as _i,L as Mt,F as bi,a4 as yi,l as fe,a as wi,aK as Ci}from"./index-deb6051c.js";import{bn as Zt,r as w,aZ as Pi,M as tt,I as S,K as Vt,L as zt,bp as c,Q as Wt,R as Si,bq as ve,br as Ii,a8 as C,N as Ei,O as Di}from"./vendor-1568bc3d.js";function pe(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function dt(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?pe(Object(e),!0).forEach(function(n){Mi(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):pe(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function Mi(i,t,e){return t=Oi(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Oi(i){var t=xi(i,"string");return typeof t=="symbol"?t:String(t)}function xi(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}var Oo=i=>({type:vi,payload:i}),Ti=i=>({type:gi,payload:i}),Ai=i=>(t,e)=>{t(Ti(i));var{storage:n}=e(),{workspaceStorage:r}=n;return r==null?void 0:r.save(i)},Li=i=>(t,e)=>{var{workspace:n}=e(),{data:r}=n??{},o=dt(dt({},n),{},{data:dt(dt(dt({},r),i),{},{settings:dt(dt({},r==null?void 0:r.settings),i.settings)})});return t(Ai(o))},xo=i=>t=>t(Li({settings:i})),To=i=>({type:pi,payload:i});function ge(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function _e(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?ge(Object(e),!0).forEach(function(n){ji(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):ge(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function ji(i,t,e){return t=Ri(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Ri(i){var t=Ni(i,"string");return typeof t=="symbol"?t:String(t)}function Ni(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}function $i(i){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:t,r=arguments.length>1?arguments[1]:void 0;switch(r.type){case i:{var{id:o,payload:s}=r;return e&&Zt({payload:s},{payload:n[o]})?n:_e(_e({},n),{},{[o]:s})}default:return n}}}var Ao=Object.freeze([]),Lo=new Map,jo=()=>{};function Ro(i){return Array.isArray(i)?i:[i]}function No(){for(var i=arguments.length,t=new Array(i),e=0;e<i;e++)t[e]=arguments[e];return t.filter(n=>n!=null)}function Fi(i,t,e){return t=Wi(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Wi(i){var t=Bi(i,"string");return typeof t=="symbol"?t:String(t)}function Bi(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class zi extends Error{constructor(){super(...arguments),Fi(this,"isCanceled",!0)}}const be=zi;function Hi(i,t,e){return t=ki(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function ki(i){var t=Ui(i,"string");return typeof t=="symbol"?t:String(t)}function Ui(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Ki extends Error{constructor(){super(...arguments),Hi(this,"isTimeout",!0)}}const Gi=Ki;class $o{static makeCancelable(t,e){var n=!1,r,o,s=new Promise((a,l)=>{o=l,Promise.resolve(t).then(h=>{n?e&&e(h):(r=h,a(h))}).catch(h=>l(h))});return s.cancel=()=>{n=!0,o(new be),r!=null&&e&&e(r)},s}static isCanceled(t){return t instanceof be}static isTimedOut(t){return t instanceof Gi}static withTimeout(t,e){return new Promise((n,r)=>{setTimeout(()=>{try{n(e())}catch(o){r(o)}},t)})}}function Re(i){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"No value available in context. Was code wrapped in a provider?",e=w.useContext(i);if(e==null)throw new Error(t);return e}function Yi(i,t,e){var n=w.useRef(e),r=w.useRef(i);r.current=i;var o=w.useMemo(()=>Pi(function(){return r.current(...arguments)},t,n.current),[t]);return w.useEffect(()=>()=>{var s,a;(s=(a=n.current)===null||a===void 0?void 0:a.flushOnUnmount)!==null&&s!==void 0&&s?o.flush():o.cancel()},[o]),o}function Vi(i){var t=w.useRef();return w.useEffect(function(){t.current=i}),t.current}function Xi(i,t,e){return t=qi(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function qi(i){var t=Zi(i,"string");return typeof t=="symbol"?t:String(t)}function Zi(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}function Fo(i){return i.then!==void 0}class st{static disableAllActions(){st.actionsDisabled=!0}static enableAllActions(){st.actionsDisabled=!1}static isContextActionEvent(t){return Array.isArray(t.contextActions)}static compareActions(t,e){if(t.group!==e.group){var n,r;return((n=t.group)!==null&&n!==void 0?n:0)>((r=e.group)!==null&&r!==void 0?r:0)?1:-1}if(t.order!==e.order){var o,s;return((o=t.order)!==null&&o!==void 0?o:0)>((s=e.order)!==null&&s!==void 0?s:0)?1:-1}if(t.title!==e.title){var a,l;return((a=t.title)!==null&&a!==void 0?a:"")>((l=e.title)!==null&&l!==void 0?l:"")?1:-1}return t!==e?t>e?1:-1:0}static sortActions(t){if(t==null||!Array.isArray(t))return[];var e=t.slice();return e.sort(st.compareActions),e}static isMacPlatform(){var{platform:t}=window.navigator;return t.startsWith("Mac")}static getModifierKey(){return st.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(t){var e=st.getModifierKey();return t[e]}static getMenuItems(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=[],r=t;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?e&&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(t,e,n){var r=t;r<0&&e<0&&(r=n.length);for(var o=1;o<n.length+1;o+=1){var s=(r+e*o+n.length)%n.length,a=n[s];if(!(a instanceof Promise)&&a.disabled!==!0)return s}return t}}Xi(st,"actionsDisabled",!1);const Wo=st;var re=tt.forwardRef((i,t)=>{var e,n;function r(L){var{menuItem:j,onMenuItemClick:R}=i;R(j,L)}function o(L){var{menuItem:j,onMenuItemMouseMove:R}=i;R(j,L)}function s(L){var{menuItem:j,onMenuItemContextMenu:R}=i;R(j,L)}function a(L,j,R){if(typeof L.type=="string")return L;var{closeMenu:lt,menuItem:B,isKeyboardSelected:it,isMouseSelected:V,"data-testid":X}=i,K={menuItem:B,closeMenu:lt,isKeyboardSelected:it,isMouseSelected:V,iconElement:j,displayShortcut:R,"data-testid":X};return tt.cloneElement(L,{forwardedProps:K})}var{children:l,menuItem:h,isKeyboardSelected:d=!1,isMouseSelected:u=!1,"data-testid":v}=i,f=(e=h.shortcutText)!==null&&e!==void 0?e:(n=h.shortcut)===null||n===void 0?void 0:n.getDisplayText(),g=null;if(h.icon){var _=h.icon;if(tt.isValidElement(_))g=_;else{var x;h.iconColor!=null&&(h.disabled===void 0||!h.disabled)&&(x={color:h.iconColor}),g=S.jsx(zt,{icon:_,style:x})}}var M=null,N=!!l;h.actions&&(M=S.jsx(zt,{icon:_i}));var P=null;if(h.menuElement)P=S.jsx("div",{className:"custom-menu-item",onMouseMove:o,children:a(h.menuElement,g,f)});else{var q,W=h.disabled,at=h.iconOutline;P=S.jsx("button",{type:"button",className:Vt("btn-context-menu",{disabled:W},{active:(N||u)&&(W===void 0||!W)},{"keyboard-active":d&&(W===void 0||!W)}),onClick:r,onMouseMove:o,onContextMenu:s,title:(q=h.description)!==null&&q!==void 0?q:"",children:S.jsxs("div",{className:"btn-context-menu-wrapper",children:[S.jsx("span",{className:Vt("icon",{outline:at}),children:g}),S.jsx("span",{className:"title",children:h.title}),f!==void 0&&S.jsx("span",{className:"shortcut",children:f}),M&&S.jsx("span",{className:Vt("submenu-indicator",{disabled:W}),children:M})]})})}return S.jsxs("div",{className:"context-menu-item",ref:t,"data-testid":v,children:[l,P]})});re.displayName="ContextMenuItem";re.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const Bo=re;function Ne(i){return typeof i=="object"&&i!=null&&typeof i.type=="string"&&i.name!=null}function $e(i){return typeof i=="object"&&i!=null&&typeof i.type=="string"&&i.id!=null}function zo(i){return Ne(i)||$e(i)}var Ji=w.createContext(null);function Ho(i){if($e(i))return{id:i.id,type:i.type};if(Ne(i)){var t;return{name:(t=i.name)!==null&&t!==void 0?t:"",type:i.type}}throw new Error("Invalid descriptor: ".concat(i))}function ko(i){var t,e;return{type:(t=i.type)!==null&&t!==void 0?t:"",name:(e=i.title)!==null&&e!==void 0?e:i.name,id:i.id}}function Uo(){return Re(Ji,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}var Qi=w.createContext(null),Ot=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin"});function tn(i){return"DashboardPlugin"in i}function en(i){return"AuthPlugin"in i}function nn(i){return"TablePlugin"in i}function Ko(i){return tn(i)||en(i)||nn(i)}function rn(i){return"type"in i&&i.type===Ot.DASHBOARD_PLUGIN}function oe(i){return"type"in i&&i.type===Ot.WIDGET_PLUGIN}function on(i){return"type"in i&&i.type===Ot.TABLE_PLUGIN}function sn(i){return"type"in i&&i.type===Ot.AUTH_PLUGIN}function Fe(i){return"type"in i&&i.type===Ot.THEME_PLUGIN}function Go(i){return rn(i)||sn(i)||on(i)||Fe(i)||oe(i)}var an=Mt.module("@deephaven/plugin.PluginUtils");function Yo(i,t){return i==null||!oe(i)?!1:[i.supportedTypes].flat().some(e=>e===t)}function Vo(i){var t=S.jsx(zt,{icon:yi});if(!oe(i))return t;var{icon:e}=i;return e==null?t:w.isValidElement(e)?e:S.jsx(zt,{icon:e})}function Xo(i){var t=[...i.entries()].filter(e=>Fe(e[1]));return an.debug("Getting theme data from plugins",t),t.map(e=>{var[n,r]=e,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:bi(n,a),name:a,styleContent:h}})}).flat()}function qo(){return Re(Qi,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}var We=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 Be(i){return i.componentName!==void 0}function ln(i){return i.component!==void 0}var ze=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const hn=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:We,isGLComponentConfig:Be,isReactComponentConfig:ln,itemDefaultConfig:ze},Symbol.toStringTag,{value:"Module"}));function Bt(i,t,e){return t=dn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function dn(i){var t=un(i,"string");return typeof t=="symbol"?t:String(t)}function un(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Dt{constructor(){Bt(this,"_mSubscriptions",void 0),Bt(this,"off",this.unbind),Bt(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[Dt.ALL_EVENT]=[]}on(t,e,n){if(typeof e!="function")throw new Error("Tried to listen to event "+t+" with non-function callback "+e);this._mSubscriptions[t]||(this._mSubscriptions[t]=[]),this._mSubscriptions[t].push({fn:e,ctx:n})}emit(t){for(var e=this._mSubscriptions[t],n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];if(e)for(var s=0;s<e.length;s++){var a=e[s].ctx||{};try{e[s].fn.apply(a,r)}catch(u){console.error("Error while emitting event:",u)}}r.unshift(t);for(var l=this._mSubscriptions[Dt.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(t,e,n){if(!this._mSubscriptions[t])throw new Error("No subscriptions to unsubscribe for event "+t);for(var r=!1,o=0;o<this._mSubscriptions[t].length;o++)(!e||this._mSubscriptions[t][o].fn===e)&&(!n||n===this._mSubscriptions[t][o].ctx)&&(this._mSubscriptions[t].splice(o,1),r=!0);if(r===!1)throw new Error("Nothing to unbind for "+t)}}Bt(Dt,"ALL_EVENT","__all");const Y=Dt;function G(i,t,e){return t=cn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function cn(i){var t=mn(i,"string");return typeof t=="symbol"?t:String(t)}function mn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Jt extends Y{constructor(t,e,n){super(),G(this,"width",void 0),G(this,"height",void 0),G(this,"title",void 0),G(this,"parent",void 0),G(this,"layoutManager",void 0),G(this,"tab",void 0),G(this,"_config",void 0),G(this,"isHidden",!1),G(this,"beforeCloseHandler",void 0),G(this,"_element",c(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),G(this,"_contentElement",void 0),this.title=Be(t)?t.componentName:"",this.parent=e,this.layoutManager=n,this._config=t,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(t,e){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"?e:t,u=((n=this[h])!==null&&n!==void 0?n:0)*(1/(((r=a.config[h])!==null&&r!==void 0?r:0)/100)),v=d/u*100,f=(((o=a.config[h])!==null&&o!==void 0?o:0)-v)/(s.contentItems.length-1),g=0;g<s.contentItems.length;g++)if(s.contentItems[g]===a)s.contentItems[g].config[h]=v;else{var _;s.contentItems[g].config[h]=((_=s.contentItems[g].config[h])!==null&&_!==void 0?_:0)+f}return s.callDownwards("setSize"),!0}close(t){var e,n;this._config.isClosable&&(!((e=(n=this.beforeCloseHandler)===null||n===void 0?void 0:n.call(this,t))!==null&&e!==void 0)||e)&&(this.emit("close"),this.parent.close())}beforeClose(t){this.beforeCloseHandler=t}getState(){return this._config.componentState}getConfig(){return this._config}extendState(t){this.setState(c.extend(!0,this.getState(),t))}setState(t){this._config.componentState=t,this.parent.emitBubblingEvent("stateChanged")}setTitle(t){this.parent.setTitle(t)}_$setSize(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(t!==this.width||e!==this.height){this.width=t,this.height=e;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 fn=Object.freeze(Object.defineProperty({__proto__:null,Container:Jt,ItemContainer:Jt},Symbol.toStringTag,{value:"Module"}));function He(i){var t=location.hash.match(new RegExp(i+"=([^&]*)"));return t?t[1]:null}function ke(i){if(window.location.hash)return He(i);if(!window.location.search)return null;var t=window.location.search.substr(1).split("&"),e={},n,r;for(r=0;r<t.length;r++)n=t[r].split("="),e[n[0]]=n[1];return e[i]||null}function se(i){return window.requestAnimationFrame(i)}function vn(i,t){var e=t.indexOf(i);if(e===-1)throw new Error("Can't remove item from array. Item is not in the array");t.splice(e,1)}function Ht(){return Wt()}function pn(i,t){var e=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 t===!0?e:e.replace(/>/g,"&gt;").replace(/</g,"&lt;")}function ae(i){return c.trim(i.replace(/(<([^>]+)>)/gi,""))}function z(i,t,e){return t=gn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function gn(i){var t=_n(i,"string");return typeof t=="symbol"?t:String(t)}function _n(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class bn extends Y{constructor(t){var e,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super(),z(this,"_eElement",void 0),z(this,"_oDocument",void 0),z(this,"_eBody",void 0),z(this,"_destroyAfterMouseUp",void 0),z(this,"_nDelay",400),z(this,"_timeout",void 0),z(this,"timeout",void 0),z(this,"_nDistance",10),z(this,"_nX",0),z(this,"_nY",0),z(this,"_nOriginalX",0),z(this,"_nOriginalY",0),z(this,"_bDragging",!1),this._eElement=t,this._oDocument=c(document),this._eBody=c(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),(e=this._eElement)===null||e===void 0||e.on("mousedown",this.onMouseDown)}destroy(){var t,e;(t=this._eElement)===null||t===void 0||t.unbind("mousedown",this.onMouseDown),(e=this._oDocument)===null||e===void 0||e.unbind("mouseup",this.onMouseUp),this._eElement=void 0,this._oDocument=void 0,this._eBody=void 0,clearTimeout(this._timeout),this._timeout=void 0}onMouseDown(t){if(t.preventDefault(),t.button===0){var e,n,r,o,s=this._getCoordinates(t);this._nOriginalX=(e=s.x)!==null&&e!==void 0?e: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(t){if(this._timeout!=null){var e,n;t.preventDefault();var r=this._getCoordinates(t);this._nX=((e=r.x)!==null&&e!==void 0?e: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,t)}}onMouseUp(t){if(this._timeout!=null){var e,n,r,o,s;if(clearTimeout(this._timeout),(e=this._oDocument)===null||e===void 0||e.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",t,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 t,e,n,r;window.clearTimeout(this._timeout),this._bDragging=!0,(t=this._eBody)===null||t===void 0||t.addClass("lm_dragging"),(e=this._eElement)===null||e===void 0||e.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(t){var e,n;return{x:(e=t.pageX)!==null&&e!==void 0?e:0,y:(n=t.pageY)!==null&&n!==void 0?n:0}}}const xt=bn;function vt(i,t,e){return t=yn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function yn(i){var t=wn(i,"string");return typeof t=="symbol"?t:String(t)}function wn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Ue{constructor(t,e){vt(this,"_container",void 0),vt(this,"_reactComponent",null),vt(this,"_portalComponent",null),vt(this,"_originalComponentWillUpdate",null),vt(this,"_initialState",void 0),vt(this,"_reactClass",void 0),this._reactComponent=null,this._portalComponent=null,this._originalComponentWillUpdate=null,this._container=t,this._initialState=e,this._reactClass=this._getReactClass(),this._container.on("open",this._render,this),this._container.on("destroy",this._destroy,this)}_key(){var t=this._container._config.id;if(!t)throw new Error("Cannot mount panel without id");return Array.isArray(t)?t.join(","):t}_render(){var t=this._key();this._portalComponent=Si.createPortal(this._getReactComponent(),this._container.getElement()[0],t),this._container.layoutManager.addReactChild(t,this._portalComponent)}_gotReactComponent(t){if(t){this._reactComponent=t,this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate||function(){},this._reactComponent.componentWillUpdate=this._onUpdate.bind(this);var e=this._container.getState();e&&this._reactComponent.setState(e)}}_destroy(){this._container.layoutManager.removeReactChild(this._key(),this._portalComponent),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)}_onUpdate(t,e){var n;this._container.setState(e),(n=this._originalComponentWillUpdate)===null||n===void 0||n.call(this._reactComponent,t,e)}_getReactClass(){var t=this._container._config.component;if(!t)throw new Error("No react component name. type: react-component needs a field `component`");var e=this._container.layoutManager.getComponent(t)||this._container.layoutManager.getFallbackComponent();if(!e)throw new Error('React component "'+t+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return e}_getReactComponent(){var t={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},e=c.extend(t,this._container._config.props);return tt.createElement(this._reactClass,e)}}var kt=["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"],Cn=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function le(i){if(kt.length>36)throw new Error("Too many keys in config minifier map");var t={};return he(i,t,"_min"),t}function Qt(i){if(kt.length>36)throw new Error("Too many keys in config minifier map");var t={};return he(i,t,"_max"),t}function he(i,t,e){var n=e==="_min"?Pn:Sn;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(t))t[Number.parseInt(r,10)]=s;else{var a=n(r,kt);t[a]=s}he(o,s,e)}else{var l=n(o,Cn);if(Array.isArray(t))t[Number.parseInt(r,10)]=l;else{var h=n(r,kt);t[h]=l}}}}function Pn(i,t){if(typeof i=="string"&&i.length===1)return"___"+i;var e=t.indexOf(i);return e===-1?i:e.toString(36)}function Sn(i,t){return typeof i=="string"&&i.length===1?t[parseInt(i,36)]:typeof i=="string"&&i.substr(0,3)==="___"?i[3]:i}function Xt(i,t,e){return t=In(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function In(i){var t=En(i,"string");return typeof t=="symbol"?t:String(t)}function En(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class te{constructor(t,e){Xt(this,"name",void 0),Xt(this,"origin",void 0),Xt(this,"isPropagationStopped",void 0),this.name=t,this.origin=e,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function jt(i,t,e){return t=Dn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Dn(i){var t=Mn(i,"string");return typeof t=="symbol"?t:String(t)}function Mn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}let On=class extends Y{constructor(t){super(),jt(this,"_layoutManager",void 0),jt(this,"_dontPropagateToParent",void 0),jt(this,"_childEventSource",void 0),jt(this,"_boundOnEventFromChild",void 0),this._layoutManager=t,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Y.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),c(window).on("gl_child_event",this._boundOnEventFromChild)}_onEventFromThis(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];this._layoutManager.isSubWindow&&e[0]!==this._dontPropagateToParent&&this._propagateToParent(e),this._propagateToChildren(e),this._dontPropagateToParent=null,this._childEventSource=null}_$onEventFromParent(t){this._dontPropagateToParent=t[0],this.emit.apply(this,t)}_onEventFromChild(t){this._childEventSource=t.originalEvent.__gl,this.emit.apply(this,t.originalEvent.__glArgs)}_propagateToParent(t){var e,n="gl_child_event",r=(e=window.opener)===null||e===void 0?void 0:e.document.createEvent("HTMLEvents");r.initEvent(n,!0,!0),r.eventName=n,r.__glArgs=t,r.__gl=this._layoutManager,window.opener.dispatchEvent(r)}_propagateToChildren(t){for(var e=0;e<this._layoutManager.openPopouts.length;e++){var n=this._layoutManager.openPopouts[e].getGlInstance();n&&n!==this._childEventSource&&n.eventHub._$onEventFromParent(t)}}destroy(){c(window).off("gl_child_event",this._boundOnEventFromChild)}};const Ke=On,xn=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:te,DragListener:xt,EventEmitter:Y,EventHub:Ke,ReactComponentHandler:Ue,animFrame:se,filterXss:pn,getHashValue:He,getQueryStringParam:ke,getUniqueId:Ht,minifyConfig:le,removeFromArray:vn,stripTags:ae,unminifyConfig:Qt},Symbol.toStringTag,{value:"Module"}));function nt(i,t,e){return t=Tn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Tn(i){var t=An(i,"string");return typeof t=="symbol"?t:String(t)}function An(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Ge extends Y{constructor(t,e,n,r,o){super(),nt(this,"isInitialised",!1),nt(this,"_config",void 0),nt(this,"_dimensions",void 0),nt(this,"_parentId",void 0),nt(this,"_indexInParent",void 0),nt(this,"_layoutManager",void 0),nt(this,"_popoutWindow",null),nt(this,"_id",null),this._config=t,this._dimensions=e,this._parentId=n,this._indexInParent=r,this._layoutManager=o,this._createWindow()}toConfig(){var t,e,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:(t=this.getGlInstance())===null||t===void 0?void 0:t.width,height:(e=this.getGlInstance())===null||e===void 0?void 0:e.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 t;return(t=this._popoutWindow)===null||t===void 0?void 0:t.__glInstance}getWindow(){return this._popoutWindow}close(){if(this.getGlInstance()){var t;(t=this.getGlInstance())===null||t===void 0||t._$closeWindow()}else try{var e;(e=this.getWindow())===null||e===void 0||e.close()}catch{}}popIn(){var t;this._indexInParent;var e=null,n=null;if(this._parentId){var r;if(e=c.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}}e&&((t=n)===null||t===void 0||t.addChild(e,this._indexInParent),this.close())}_createWindow(){var t=this._createUrl(),e=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(t,e,n),!this._popoutWindow)if(this._layoutManager.config.settings.blockedPopoutsThrowError===!0){var r=new Error("Popout blocked");throw r.type="popoutBlocked",r}else return;c(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(t){var e=[],n;for(n in t)e.push(n+"="+t[n]);return e.join(",")}_createUrl(){var t={content:this._config},e="gl-window-config-"+Ht();t=le(t);try{localStorage.setItem(e,JSON.stringify(t))}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="+e:document.location.href+"&gl-window="+e}_positionWindow(){var t,e;(t=this._popoutWindow)===null||t===void 0||t.moveTo(this._dimensions.left,this._dimensions.top),(e=this._popoutWindow)===null||e===void 0||e.focus()}_onInitialised(){var t;this.isInitialised=!0,(t=this.getGlInstance())===null||t===void 0||t.on("popIn",this.popIn,this),this.emit("initialised")}_onClose(){setTimeout(this.emit.bind(this,"closed"),50)}}function T(i,t,e){return t=Ln(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Ln(i){var t=jn(i,"string");return typeof t=="symbol"?t:String(t)}function jn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class mt extends Y{constructor(t,e,n,r,o,s){var a,l,h,d,u,v,f,g;if(super(),T(this,"_dragListener",void 0),T(this,"_layoutManager",void 0),T(this,"_contentItem",void 0),T(this,"_originalParent",void 0),T(this,"_area",null),T(this,"_lastValidArea",null),T(this,"_minX",void 0),T(this,"_maxX",void 0),T(this,"_minY",void 0),T(this,"_maxY",void 0),T(this,"_width",void 0),T(this,"_height",void 0),T(this,"_sided",void 0),T(this,"element",void 0),T(this,"childElementContainer",void 0),T(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 _,x;this._layoutManager.tabDropPlaceholder.width((_=this._contentItem.tab.element.outerWidth(!0))!==null&&_!==void 0?_:0),this._layoutManager.tabDropPlaceholder.height((x=this._contentItem.tab.element.outerHeight(!0))!==null&&x!==void 0?x:0)}if(this.element=c(mt._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:t,top:e}),this._proxyTab=this.element.find(".lm_tab"),this._proxyTab.attr("title",ae((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(),c(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var M,N;this._layoutManager.tabDropPlaceholder.width((M=this._proxyTab.outerWidth(!0))!==null&&M!==void 0?M:0),this._layoutManager.tabDropPlaceholder.height((N=this._proxyTab.outerHeight(!0))!==null&&N!==void 0?N: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=((v=this._layoutManager.container.height())!==null&&v!==void 0?v:0)+this._minY,this._width=(f=this.element.width())!==null&&f!==void 0?f:0,this._height=(g=this.element.height())!==null&&g!==void 0?g:0,this._setDropPosition(t,e),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(t,e,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(t,e){this.element.css({left:t,top:e}),this._area=this._layoutManager._$getArea(t,e),this._area!==null&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(t,e,this._area))}_onDrop(){var t;(t=this._layoutManager.dropTargetIndicator)===null||t===void 0||t.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 t=this._layoutManager.config.dimensions,e=t.dragProxyWidth,n=t.dragProxyHeight;this.element.width(e),this.element.height(n),e-=this._sided?t.headerHeight:0,n-=this._sided?0:t.headerHeight,this.childElementContainer.width(e),this.childElementContainer.height(n),this._contentItem.element.width(e),this._contentItem.element.height(n),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}T(mt,"_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 Rt(i,t,e){return t=Rn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Rn(i){var t=Nn(i,"string");return typeof t=="symbol"?t:String(t)}function Nn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Ye{constructor(t,e,n){Rt(this,"_element",void 0),Rt(this,"_itemConfig",void 0),Rt(this,"_layoutManager",void 0),Rt(this,"_dragListener",void 0),this._element=t,this._itemConfig=e,this._layoutManager=n,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new xt(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this),this._dragListener}_onDragStart(t,e){var n=this._itemConfig;typeof n=="function"&&(n=n());var r=this._layoutManager._$normalizeContentItem(c.extend(!0,{},n));new mt(t,e,this._dragListener,this._layoutManager,r,null)}}function Nt(i,t,e){return t=$n(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function $n(i){var t=Fn(i,"string");return typeof t=="symbol"?t:String(t)}function Fn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Ve{constructor(t,e,n){Nt(this,"_element",c(window)),Nt(this,"_itemConfig",void 0),Nt(this,"_layoutManager",void 0),Nt(this,"_dragListener",void 0),this._itemConfig=t,this._layoutManager=e,this._createDragListener(n)}_createDragListener(t){this._dragListener&&this._dragListener.destroy(),this._element&&(this._dragListener=new xt(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._destroy,this),this._dragListener.onMouseDown(t),this._dragListener._startDrag())}_destroy(){this._dragListener=void 0,this._element=void 0,this._itemConfig=void 0,this._layoutManager=void 0}_onDragStart(t,e){if(!(!this._dragListener||!this._layoutManager)){var n=this._itemConfig;typeof n=="function"&&(n=n());var r=this._layoutManager._$normalizeContentItem(c.extend(!0,{},n));new mt(t,e,this._dragListener,this._layoutManager,r,null)}}}function Xe(i,t,e){return t=Wn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Wn(i){var t=Bn(i,"string");return typeof t=="symbol"?t:String(t)}function Bn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Tt{constructor(){Xe(this,"element",c(Tt._template)),c(document.body).append(this.element)}destroy(){this.element.remove()}highlightArea(t){this.element.css({left:t.x1,top:t.y1,width:Math.floor(t.x2-t.x1),height:Math.floor(t.y2-t.y1)}).show()}hide(){this.element.hide()}}Xe(Tt,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function qt(i,t,e){return t=zn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function zn(i){var t=Hn(i,"string");return typeof t=="symbol"?t:String(t)}function Hn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Et{constructor(t,e,n,r){qt(this,"element",void 0),qt(this,"_header",void 0),qt(this,"_action",void 0),this._header=t,this.element=c('<li class="'+n+'" title="'+e+'"></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 kn(i,t,e){return t=Un(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Un(i){var t=Kn(i,"string");return typeof t=="symbol"?t:String(t)}function Kn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Gn extends Error{constructor(t,e){super(),kn(this,"node",void 0),this.name="Configuration Error",this.message=t,this.node=e}}const ut=Gn,Yn=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:ut},Symbol.toStringTag,{value:"Module"}));function O(i,t,e){return t=Vn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Vn(i){var t=Xn(i,"string");return typeof t=="symbol"?t:String(t)}function Xn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}function ct(i){return i.isStack}function U(i){return i.isComponent}function qe(i){return i.isRoot}class A extends Y{constructor(t,e,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(e),this.type=e.type,this.contentItems=[],this.parent=n,this.layoutManager=t,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(Y.ALL_EVENT,this._propagateEvent,this),e.content&&this._createContentItems(e)}callDownwards(t){var e=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[t].apply(this,e);for(var o=0;o<this.contentItems.length;o++)this.contentItems[o].callDownwards(t,e,n);n===!0&&r!==!0&&this[t].apply(this,e)}removeChild(t){var e,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=this.contentItems.indexOf(t);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),(e=this.config.content)===null||e===void 0||e.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(t,e){t=this.layoutManager._$normalizeContentItem(t,this),e===void 0&&(e=this.contentItems.length),this.contentItems.splice(e,0,t),this.config.content===void 0&&(this.config.content=[]),this.config.content.splice(e,0,t.config),t.parent=this,t.parent.isInitialised===!0&&t.isInitialised===!1&&t._$init()}replaceChild(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;e=this.layoutManager._$normalizeContentItem(e);var r=this.contentItems.indexOf(t),o=t.element[0].parentNode;if(r===-1)throw new Error("Can't replace child. oldChild is not child of this");o==null||o.replaceChild(e.element[0],t.element[0]),n===!0&&(t.parent=null,t._$destroy()),this.contentItems[r]=e,e.parent=this,ct(this)&&(this.header.tabs[r].contentItem=e),e.parent.isInitialised===!0&&e.isInitialised===!1&&e._$init(),this.callDownwards("setSize")}remove(){var t;(t=this.parent)===null||t===void 0||t.removeChild(this)}popout(){var t=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),t}toggleMaximise(t){t&&t.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(t){this.config.title=t,this.emit("titleChanged",t),this.emitBubblingEvent("stateChanged")}hasId(t){if(this.config.id){if(typeof this.config.id=="string")return this.config.id===t;if(this.config.id instanceof Array)return this.config.id.indexOf(t)!==-1}else return!1}addId(t){this.hasId(t)||(this.config.id?typeof this.config.id=="string"?this.config.id=[this.config.id,t]:this.config.id instanceof Array&&this.config.id.push(t):this.config.id=t)}removeId(t){if(!this.hasId(t))throw new Error("Id not found");if(typeof this.config.id=="string")delete this.config.id;else if(this.config.id instanceof Array){var e=this.config.id.indexOf(t);this.config.id.splice(e,1)}}getItemsByFilter(t){var e=[],n=function r(o){for(var s=0;s<o.contentItems.length;s++)t(o.contentItems[s])===!0&&e.push(o.contentItems[s]),r(o.contentItems[s])};return n(this),e}getItemsById(t){return this.getItemsByFilter(function(e){return e.config.id instanceof Array?e.config.id.indexOf(t)!==-1:e.config.id===t})}getItemsByType(t){return this._$getItemsByProperty("type",t)}getComponentsByName(t){for(var e=this._$getItemsByProperty("componentName",t),n=[],r=0;r<e.length;r++)n.push(e[r].instance);return n}_$getItemsByProperty(t,e){return this.getItemsByFilter(function(n){return n[t]===e})}_$setParent(t){this.parent=t}_$highlightDropZone(t,e,n){var r;(r=this.layoutManager.dropTargetIndicator)===null||r===void 0||r.highlightArea(n)}_$onDrop(t,e){this.addChild(t)}_$hide(){this._callOnActiveComponents("hide"),this.element.hide(),this.layoutManager.updateSize()}_$show(){this._callOnActiveComponents("show"),this.element.show(),this.layoutManager.updateSize()}_callOnActiveComponents(t){for(var e=this.getItemsByType("stack"),n=null,r=0;r<e.length;r++)n=e[r].getActiveContentItem(),n&&U(n)&&n.container[t]()}_$destroy(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")}_$getArea(t){var e,n,r;t=t||this.element;var o=(e=t.offset())!==null&&e!==void 0?e:{left:0,top:0},s=(n=t.width())!==null&&n!==void 0?n:0,a=(r=t.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 t=0;t<this.contentItems.length;t++){var e;(e=this.childElementContainer)===null||e===void 0||e.append(this.contentItems[t].element)}this.isInitialised=!0,this.emitBubblingEvent("itemCreated"),this.emitBubblingEvent(this.type+"Created")}emitBubblingEvent(t){var e=new te(t,this);this.emit(t,e)}_createContentItems(t){var e;if(!(t.content instanceof Array))throw new ut("content must be an Array",t);for(var n=0;n<t.content.length;n++)e=this.layoutManager.createContentItem(t.content[n],this),this.contentItems.push(e)}_extendItemNode(t){for(var[e,n]of Object.entries(ze)){var r=e;t[r]===void 0&&(t[r]=n)}return t}_propagateEvent(t,e){e instanceof te&&e.isPropagationStopped===!1&&this.isInitialised===!0&&(this.isRoot===!1&&this.parent?this.parent.emit.apply(this.parent,[t,e]):this._scheduleEventPropagationToLayoutManager(t,e))}_scheduleEventPropagationToLayoutManager(t,e){this._throttledEvents.indexOf(t)===-1?this.layoutManager.emit(t,e.origin):this._pendingEventPropagations[t]!==!0&&(this._pendingEventPropagations[t]=!0,se(this._propagateEventToLayoutManager.bind(this,t,e)))}_propagateEventToLayoutManager(t,e){this._pendingEventPropagations[t]=!1,this.layoutManager.emit(t,e)}}function Pt(i,t,e){return t=qn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function qn(i){var t=Zn(i,"string");return typeof t=="symbol"?t:String(t)}function Zn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Ze extends A{constructor(t,e,n){var r;Object.entries((r=t.config.settings.defaultComponentConfig)!==null&&r!==void 0?r:{}).forEach(a=>{var[l,h]=a;e[l]===void 0&&(e[l]=h)}),super(t,e,n,c()),Pt(this,"config",void 0),Pt(this,"componentName",void 0),Pt(this,"container",void 0),Pt(this,"parent",void 0),Pt(this,"instance",void 0),this.config=e,this.parent=n;var o=t.getComponent(this.config.componentName)||t.getFallbackComponent(),s=c.extend(!0,{},this.config.componentState||{});if(o==null)throw new ut('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 Jt(this.config,this,t),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(){A.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),A.prototype._$hide.call(this)}_$show(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),A.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),A.prototype._$destroy.call(this)}_$getArea(){return null}}function H(i,t,e){return t=Jn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Jn(i){var t=Qn(i,"string");return typeof t=="symbol"?t:String(t)}function Qn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Ut extends A{constructor(t,e,n,r){super(e,n,r,c('<div class="lm_item lm_'+(t?"column":"row")+'"></div>')),H(this,"isRow",void 0),H(this,"isColumn",void 0),H(this,"childElementContainer",void 0),H(this,"parent",void 0),H(this,"_splitter",[]),H(this,"_splitterSize",void 0),H(this,"_splitterGrabSize",void 0),H(this,"_isColumn",void 0),H(this,"_dimension",void 0),H(this,"_splitterPosition",null),H(this,"_splitterMinPosition",null),H(this,"_splitterMaxPosition",null),this.parent=r,this.isRow=!t,this.isColumn=t,this.childElementContainer=this.element,this._splitterSize=e.config.dimensions.borderWidth,this._splitterGrabSize=e.config.dimensions.borderGrabWidth,this._isColumn=t,this._dimension=t?"height":"width",this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null}addChild(t,e,n){var r,o,s,a;if(t=this.layoutManager._$normalizeContentItem(t,this),e===void 0&&(e=this.contentItems.length),this.contentItems.length>0?(a=this._createSplitter(Math.max(0,e-1)).element,e>0?(this.contentItems[e-1].element.after(a),a.after(t.element)):(this.contentItems[0].element.before(a),a.before(t.element))):this.childElementContainer.append(t.element),A.prototype.addChild.call(this,t,e),r=1/this.contentItems.length*100,n===!0){this.emitBubblingEvent("stateChanged");return}for(s=0;s<this.contentItems.length;s++)if(this.contentItems[s]===t)t.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(t,e){var n,r=(n=t.config[this._dimension])!==null&&n!==void 0?n:0,o=this.contentItems.indexOf(t),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]!==t){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)}A.prototype.removeChild.call(this,t,e),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(t,e){var n=t.config[this._dimension];super.replaceChild(t,e),e.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 t;for(A.prototype._$init.call(this),t=0;t<this.contentItems.length-1;t++)this.contentItems[t].element.after(this._createSplitter(t).element)}}_setAbsoluteSizes(){var t,e=this._calculateAbsoluteSizes();for(t=0;t<this.contentItems.length;t++)e.additionalPixel-t>0&&e.itemSizes[t]++,this._isColumn?(this.contentItems[t].element.width(e.totalWidth),this.contentItems[t].element.height(e.itemSizes[t])):(this.contentItems[t].element.width(e.itemSizes[t]),this.contentItems[t].element.height(e.totalHeight))}_calculateAbsoluteSizes(){var t,e,n=(this.contentItems.length-1)*this._splitterSize,r=(t=this.element.width())!==null&&t!==void 0?t:0,o=(e=this.element.height())!==null&&e!==void 0?e: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 v=Math.floor((this._isColumn?o:r)-s);return{itemSizes:a,additionalPixel:v,totalWidth:r,totalHeight:o}}_calculateRelativeSizes(){for(var t=0,e=[],n=this._isColumn?"height":"width",r=0;r<this.contentItems.length;r++){var o=this.contentItems[r].config[n];o!=null?t+=o:e.push(this.contentItems[r])}if(Math.round(t)===100){this._respectMinItemWidth();return}if(Math.round(t)<100&&e.length>0){for(var s=0;s<e.length;s++)e[s].config[n]=(100-t)/e.length;this._respectMinItemWidth();return}if(Math.round(t)>100)for(var a=0;a<e.length;a++)e[a].config[n]=50,t+=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)/t*100}this._respectMinItemWidth()}_respectMinItemWidth(){var t,e=this.layoutManager.config.dimensions&&(t=this.layoutManager.config.dimensions.minItemWidth)!==null&&t!==void 0?t:0,n=[],r=0,o=0,s=0,a=[],l;if(!(this._isColumn||!e||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<e?(o+=e-u,l={width:e}):(r+=u-e,l={width:u},n.push(l)),a.push(l)}if(!(o===0||o>r)){var v=o/r;s=o;for(var f=0;f<n.length;f++){l=n[f];var g=Math.round((l.width-e)*v);s-=g,l.width-=g}s!==0&&(a[a.length-1].width-=s);for(var _=0;_<this.contentItems.length;_++)this.contentItems[_].config.width=a[_].width/h.totalWidth*100}}}_createSplitter(t){var e;return e=new Je(this._isColumn,this._splitterSize,this._splitterGrabSize),e.on("drag",this._onSplitterDrag.bind(this,e),this),e.on("dragStop",this._onSplitterDragStop.bind(this,e),this),e.on("dragStart",this._onSplitterDragStart.bind(this,e),this),this._splitter.splice(t,0,e),e}_getItemsForSplitter(t){var e=this._splitter.indexOf(t);if(e<0)throw new Error("Splitter not found in RowOrColumn");return{before:this.contentItems[e],after:this.contentItems[e+1]}}_getMinimumDimensions(t){for(var e=0,n=0,r=0;r<t.length;++r){var o,s;e=Math.max((o=t[r].minWidth)!==null&&o!==void 0?o:0,e),n=Math.max((s=t[r].minHeight)!==null&&s!==void 0?s:0,n)}return{horizontal:e,vertical:n}}_onSplitterDragStart(t){var e,n,r,o,s=this._getItemsForSplitter(t),a=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((e=s.before.config.content)!==null&&e!==void 0?e:[]),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(t,e,n){var r=this._isColumn?n:e;this._splitterMaxPosition==null||this._splitterMinPosition==null||r>this._splitterMinPosition&&r<this._splitterMaxPosition&&(this._splitterPosition=r,t.element.css(this._isColumn?"top":"left",r))}_onSplitterDragStop(t){var e,n,r,o,s,a=this._getItemsForSplitter(t),l=(e=a.before.element[this._dimension]())!==null&&e!==void 0?e: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,t.element.css({top:0,left:0}),se(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function ye(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function we(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?ye(Object(e),!0).forEach(function(n){ee(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):ye(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function ee(i,t,e){return t=tr(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function tr(i){var t=er(i,"string");return typeof t=="symbol"?t:String(t)}function er(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class ie extends A{constructor(t,e,n){super(t,we(we({},e),{},{type:"root"}),null,c('<div class="lm_goldenlayout lm_item lm_root"></div>')),ee(this,"childElementContainer",void 0),ee(this,"_containerElement",void 0),this.isRoot=!0,this.type="root",this.childElementContainer=this.element,this._containerElement=n,this._containerElement.append(this.element)}addChild(t,e){if(this.contentItems.length>0)throw new Error("Root node can only have a single child");t=this.layoutManager._$normalizeContentItem(t,this),this.childElementContainer.append(t.element),super.addChild(t,e),this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(t,e){var n,r;t=typeof t>"u"?(n=this._containerElement.width())!==null&&n!==void 0?n:0:t,e=typeof e>"u"?(r=this._containerElement.height())!==null&&r!==void 0?r:0:e,this.element.width(t),this.element.height(e),this.contentItems[0]&&(this.contentItems[0].element.width(t),this.contentItems[0].element.height(e))}_$getArea(){var t=super._$getArea();if(t==null)throw new Error("Unable to get root area");return t}_$highlightDropZone(t,e,n){this.layoutManager.tabDropPlaceholder.remove(),super._$highlightDropZone(t,e,n)}_$onDrop(t,e){var n;if(U(t)&&(n=this.layoutManager.createContentItem({type:"stack",header:t.config.header||{}},this),n._$init(),n.addChild(t),t=n),!this.contentItems.length)this.addChild(t);else{var{side:r}=e,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 Ut)||l.type!=o){var h=this.layoutManager.createContentItem({type:o},this);this.replaceChild(l,h),h.addChild(t,a?0:void 0,!0),h.addChild(l,a?void 0:0,!0),l.config[s]=50,t.config[s]=50,h.callDownwards("setSize")}else{var d,u=l.contentItems[a?0:l.contentItems.length-1];l.addChild(t,a?0:void 0,!0),u.config[s]=((d=u.config[s])!==null&&d!==void 0?d:0)*.5,t.config[s]=u.config[s],l.callDownwards("setSize")}}}}function Ce(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function pt(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Ce(Object(e),!0).forEach(function(n){F(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):Ce(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function F(i,t,e){return t=ir(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function ir(i){var t=nr(i,"string");return typeof t=="symbol"?t:String(t)}function nr(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class ne extends A{constructor(t,e,n){var r,o,s,a,l,h,d,u,v;super(t,e,n,c('<div class="lm_item lm_stack"></div>')),F(this,"_activeContentItem",null),F(this,"_header",void 0),F(this,"childElementContainer",c('<div class="lm_items"></div>')),F(this,"header",void 0),F(this,"parent",void 0),F(this,"isStack",!0),F(this,"_dropZones",{}),F(this,"_dropSegment",null),F(this,"_contentAreaDimensions",null),F(this,"_dropIndex",void 0),F(this,"_side",void 0),F(this,"_sided",!1),F(this,"config",void 0),this.parent=n,this.config=e;var f=t.config;this._side=!1,this._header={show:((r=f.settings)===null||r===void 0?void 0:r.hasHeaders)&&e.hasHeaders!==!1,popout:(o=f.settings)!==null&&o!==void 0&&o.showPopoutIcon?(s=f.labels)===null||s===void 0?void 0:s.popout:void 0,maximise:(a=f.settings)!==null&&a!==void 0&&a.showMaximiseIcon?(l=f.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(h=f.settings)!==null&&h!==void 0&&h.showCloseIcon?(d=f.labels)===null||d===void 0?void 0:d.close:void 0,minimise:(u=(v=f.labels)===null||v===void 0?void 0:v.minimise)!==null&&u!==void 0?u:void 0},f.header&&(this._header=pt(pt({},this._header),f.header)),e.header&&(this._header=pt(pt({},this._header),e.header)),e.content&&e.content[0]&&e.content[0].header&&(this._header=pt(pt({},this._header),e.content[0].header)),this.header=new et(t,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var t,e,n,r,o,s=this._header.show&&(t=(e=this.layoutManager.config.dimensions)===null||e===void 0?void 0:e.headerHeight)!==null&&t!==void 0?t: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 t=0;t<this.contentItems.length;t++)this.header.createTab(this.contentItems[t]),this.contentItems[t]._$hide();if(this.contentItems.length>0){var e=this.contentItems[this.config.activeItemIndex||0];if(!e)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(e)}}}setActiveContentItem(t){if(this.contentItems.indexOf(t)===-1)throw new Error("contentItem is not a child of this stack");this._activeContentItem!==null&&this._activeContentItem._$hide(),this._activeContentItem=t,this.header.setActiveContentItem(t),t._$show(),this.emit("activeContentItemChanged",t),this.layoutManager.emit("activeContentItemChanged",t),this.emitBubblingEvent("stateChanged")}getActiveContentItem(){return this.header.activeContentItem}addChild(t,e){t=this.layoutManager._$normalizeContentItem(t,this),super.addChild(t,e),this.childElementContainer.append(t.element),this.header.createTab(t,e),this.setActiveContentItem(t),this.callDownwards("setSize"),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}removeChild(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.contentItems.indexOf(t);super.removeChild(t,e),this.header.removeTab(t),this.header.activeContentItem===t&&(this.contentItems.length>0?this.setActiveContentItem(this.contentItems[Math.max(n-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}_$validateClosability(){for(var t=this.header._isClosable(),e=0,n=this.contentItems.length;e<n;e++){var r;if(!t)break;t=(r=this.contentItems[e].config.isClosable)!==null&&r!==void 0?r:!1}this.header._$setClosable(t)}_$destroy(){A.prototype._$destroy.call(this),this.header._$destroy()}_$onDrop(t){if(this._dropSegment==="header"){this._resetHeaderDropZone(),this.addChild(t,this._dropIndex);return}if(this._dropSegment==="body"){this.addChild(t);return}var e=this._dropSegment==="top"||this._dropSegment==="bottom",n=this._dropSegment==="left"||this._dropSegment==="right",r=this._dropSegment==="top"||this._dropSegment==="left",o=e&&this.parent.isColumn||n&&this.parent.isRow,s=e?"column":"row",a=e?"height":"width";if(U(t)){var l=this.layoutManager.createContentItem({type:"stack",header:t.config.header||{}},this);l._$init(),l.addChild(t),t=l}if(o){var h,d=this.parent.contentItems.indexOf(this);this.parent.addChild(t,r?d:d+1,!0),this.config[a]=((h=this.config[a])!==null&&h!==void 0?h:0)*.5,t.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(t,r?0:void 0,!0),u.addChild(this,r?void 0:0,!0),this.config[a]=50,t.config[a]=50,u.callDownwards("setSize")}}_$highlightDropZone(t,e){if(this._contentAreaDimensions)for(var[n,r]of Object.entries(this._contentAreaDimensions)){var o=r.hoverArea;if(o.x1<t&&o.x2>t&&o.y1<e&&o.y2>e){n==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(t)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(n));return}}}_$getArea(){if(this.element.is(":visible")===!1)return null;var t=super._$getArea(this.header.element),e=super._$getArea(this.childElementContainer);if(t==null||e==null)return null;var n=e.x2-e.x1,r=e.y2-e.y1;return this._contentAreaDimensions={header:{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}}},this._activeContentItem&&this._activeContentItem.isComponent===!1?t:this.contentItems.length===0?(this._contentAreaDimensions.body={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}},super._$getArea(this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:e.x1,y1:e.y1,x2:e.x1+n*.25,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x1+n*.5,y2:e.y2}},this._contentAreaDimensions.top={hoverArea:{x1:e.x1+n*.25,y1:e.y1,x2:e.x1+n*.75,y2:e.y1+r*.5},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y1+r*.5}},this._contentAreaDimensions.right={hoverArea:{x1:e.x1+n*.75,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1+n*.5,y1:e.y1,x2:e.x2,y2:e.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:e.x1+n*.25,y1:e.y1+r*.5,x2:e.x1+n*.75,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1+r*.5,x2:e.x2,y2:e.y2}},super._$getArea(this.element))}_highlightHeaderDropZone(t){var e,n,r,o,s,a,l,h,d,u,v,f,g,_,x,M,N=this.header.tabs.length;if(N===0){var P,q,W,at,L,j,R,lt,B=this.header.element.offset();(P=this.layoutManager.dropTargetIndicator)===null||P===void 0||P.highlightArea({x1:(q=B==null?void 0:B.left)!==null&&q!==void 0?q:0,x2:((W=B==null?void 0:B.left)!==null&&W!==void 0?W:0)+100,y1:(at=(L=this.header.element.offset())===null||L===void 0?void 0:L.top)!==null&&at!==void 0?at:0,y2:((j=(R=this.header.element.offset())===null||R===void 0?void 0:R.top)!==null&&j!==void 0?j:0)+((lt=this.header.element.innerHeight())!==null&&lt!==void 0?lt:0)});return}var it=this.header.tabsContainer,V=(e=it.get(0))===null||e===void 0?void 0:e.getBoundingClientRect(),X=(n=this.layoutManager.tabDropPlaceholder.get(0))===null||n===void 0?void 0:n.getBoundingClientRect();if(!(!V||!X)){t<V.left?t=V.left+1:t>V.right&&(t=V.right-1);var K,Z;if(!(X.left<t&&t<X.right)){for(var ft=0;ft<N;ft++){var wt;if(K=this.header.tabs[ft].element,Z=(wt=K.get(0))===null||wt===void 0?void 0:wt.getBoundingClientRect(),Z&&Z.left<t&&t<Z.right){this._dropIndex=ft;break}}if(K&&Z&&t<Z.left+Z.width*.5)K.before(this.layoutManager.tabDropPlaceholder);else if(K){var Ct;this._dropIndex=Math.min(((Ct=this._dropIndex)!==null&&Ct!==void 0?Ct:0)+1,N),K.after(this.layoutManager.tabDropPlaceholder)}}var ht=(r=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&r!==void 0?r:0;ht=Math.max(ht,(s=(a=this.header.tabsContainer.offset())===null||a===void 0?void 0:a.left)!==null&&s!==void 0?s:0);var p=ht+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);p=Math.min(p,((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)),(v=this.layoutManager.dropTargetIndicator)===null||v===void 0||v.highlightArea({x1:ht,x2:p,y1:(f=(g=this.header.element.offset())===null||g===void 0?void 0:g.top)!==null&&f!==void 0?f:0,y2:((_=(x=this.header.element.offset())===null||x===void 0?void 0:x.top)!==null&&_!==void 0?_:0)+((M=this.header.element.innerHeight())!==null&&M!==void 0?M:0)})}}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){var t=["right","left","bottom"].some(n=>n===this._header.show)?this._header.show:void 0;if(this.header.element.toggle(!!this._header.show),!!t&&(this._side=t,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 e=["right","bottom"].indexOf(this._side.toString())>=0?"before":"after";this.header.element[e](this.childElementContainer),this.callDownwards("setSize")}}_highlightBodyDropZone(t){var e,n,r=(e=this._contentAreaDimensions)===null||e===void 0||(n=e[t])===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=t}}const rr=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:A,Component:Ze,ContentItem:A,Root:ie,RowOrColumn:Ut,Stack:ne,isComponent:U,isRoot:qe,isStack:ct},Symbol.toStringTag,{value:"Module"}));function Q(i,t,e){return t=or(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function or(i){var t=sr(i,"string");return typeof t=="symbol"?t:String(t)}function sr(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class At{constructor(t,e){var n;Q(this,"header",void 0),Q(this,"contentItem",void 0),Q(this,"element",c(At._template)),Q(this,"titleElement",void 0),Q(this,"closeElement",void 0),Q(this,"isActive",!1),Q(this,"_layoutManager",void 0),Q(this,"_dragListener",void 0),this.header=t,this.contentItem=e,this.titleElement=this.element.find(".lm_title"),this.closeElement=this.element.find(".lm_close_tab"),this.closeElement[e.config.isClosable?"show":"hide"](),this.setTitle(e.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&&e.config.reorderEnabled&&(this._dragListener=new xt(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 t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";this.titleElement.html(t)}setActive(t){t!==this.isActive&&(this.isActive=t,t?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(t,e){var n;(n=this.contentItem.parent)!==null&&n!==void 0&&n.isMaximised&&this.contentItem.parent.toggleMaximise(),this._dragListener&&new mt(t,e,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(){c(".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(t){if(!t||t.button===0){var e,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",t),this.header._hideAdditionalTabsDropdown(),(e=this.element.get(0))===null||e===void 0||e.scrollIntoView({inline:"nearest"})}else t.button===1&&this.contentItem.config.isClosable&&this._onCloseClick(t)}_onCloseClick(t){t.stopPropagation(),U(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onCloseMousedown(t){t.stopPropagation()}}Q(At,"_template",['<li class="lm_tab">','<span class="lm_title_before"></span>','<span class="lm_title"></span>','<div class="lm_close_tab" aria-label="Close tab"></div>',"</li>"].join(""));function y(i,t,e){return t=ar(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function ar(i){var t=lr(i,"string");return typeof t=="symbol"?t:String(t)}function lr(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class et extends Y{constructor(t,e){var n,r;super(),y(this,"layoutManager",void 0),y(this,"element",c(et._template)),y(this,"tabsContainer",void 0),y(this,"tabDropdownContainer",void 0),y(this,"tabDropdownSearch",void 0),y(this,"tabDropdownList",null),y(this,"controlsContainer",void 0),y(this,"parent",void 0),y(this,"tabs",[]),y(this,"activeContentItem",null),y(this,"closeButton",null),y(this,"tabDropdownButton",null),y(this,"tabNextButton",c(et._nextButtonTemplate)),y(this,"tabPreviousButton",c(et._previousButtonTemplate)),y(this,"holdTimer",null),y(this,"rAF",null),y(this,"CLICK_TIMEOUT",500),y(this,"START_SPEED",.01),y(this,"ACCELERATION",5e-4),y(this,"PADDING",10),y(this,"SCROLL_LEFT","left"),y(this,"SCROLL_RIGHT","right"),y(this,"isDraggingTab",!1),y(this,"isOverflowing",!1),y(this,"isDropdownShown",!1),y(this,"dropdownKeyIndex",0),y(this,"_lastVisibleTabIndex",-1),y(this,"_tabControlOffset",void 0),this.layoutManager=t,(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=e,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(t,e){for(var n=0;n<this.tabs.length;n++)if(this.tabs[n].contentItem===t)return;var r=new At(this,t);if(this.tabs.length===0){this.tabs.push(r),this.tabsContainer.append(r.element);return}e===void 0&&(e=this.tabs.length),e>0?this.tabs[e-1].element.after(r.element):this.tabs[0].element.before(r.element),this.tabs.splice(e,0,r),this._updateTabSizes()}removeTab(t){for(var e=0;e<this.tabs.length;e++)if(this.tabs[e].contentItem===t){this.tabs[e]._$destroy(),this.tabs.splice(e,1);return}throw new Error("contentItem is not controlled by this header")}setActiveContentItem(t){for(var e,n,r,o,s=0;s<this.tabs.length;s++)o=this.tabs[s].contentItem===t,this.tabs[s].setActive(o),o===!0&&(this.activeContentItem=t,this.parent.config.activeItemIndex=s);(e=this.tabs[(r=this.parent.config.activeItemIndex)!==null&&r!==void 0?r:0].element.get(0))===null||e===void 0||(n=e.scrollIntoView)===null||n===void 0||n.call(e,{inline:"nearest"}),this._hideAdditionalTabsDropdown(),this._updateTabSizes(),this.parent.emitBubblingEvent("stateChanged")}position(t){var e=this.parent._header.show;return e&&!this.parent._side&&(e="top"),t!==void 0&&this.parent._header.show!==t&&(this.parent._header.show=t,this.parent._setupHeaderPosition()),e}_attachWheelListener(){var t;(t=this.tabsContainer.get(0))===null||t===void 0||t.addEventListener("wheel",this._handleWheelEvent,{passive:!0})}_detachWheelListener(){var t;(t=this.tabsContainer.get(0))===null||t===void 0||t.removeEventListener("wheel",this._handleWheelEvent)}_handleWheelEvent(t){var e=t.currentTarget;if(e instanceof HTMLElement){var n=Math.abs(t.deltaY)>Math.abs(t.deltaX)?t.deltaY:t.deltaX;if(t.deltaMode===WheelEvent.DOM_DELTA_PAGE){var r;n*=(r=this.tabsContainer.innerWidth())!==null&&r!==void 0?r:1}else t.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=100/3);e.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 t;this.isDraggingTab=!1,window.cancelAnimationFrame((t=this.rAF)!==null&&t!==void 0?t:-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 t;this.controlsContainer.on("mouseleave",this._handleNextMouseLeave),this._handleScrollRepeat(this.SCROLL_RIGHT,(t=this.tabsContainer.scrollLeft())!==null&&t!==void 0?t:0)}_handlePreviousMouseEnter(){var t;this.tabPreviousButton.on("mouseleave",this._handlePreviousMouseLeave),this._handleScrollRepeat(this.SCROLL_LEFT,(t=this.tabsContainer.scrollLeft())!==null&&t!==void 0?t:0)}_handleNextMouseLeave(){var t;window.cancelAnimationFrame((t=this.rAF)!==null&&t!==void 0?t:-1),this.rAF=null,this.controlsContainer.off("mouseleave",this._handleNextMouseLeave)}_handlePreviousMouseLeave(){var t;window.cancelAnimationFrame((t=this.rAF)!==null&&t!==void 0?t:-1),this.rAF=null,this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextButtonMouseDown(){for(var t,e=0;e<this.tabs.length;e+=1){var n,r,o,s,a;if(((n=(r=this.tabs[e].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)){t=this.tabs[e].element.get(0);break}}if(t)t.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 t,e=this.tabs.length-1;e>=0;e-=1){var n,r,o;if(((n=(r=this.tabs[e].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)){t=this.tabs[e].element.get(0);break}}if(t)t.scrollIntoView({behavior:"smooth",inline:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT);else{var s=this.tabsContainer.get(0);s&&(s.scrollLeft=0)}}_handleScrollButtonMouseDown(t){this.holdTimer=window.setTimeout(()=>{var e;this._handleScrollRepeat(t,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0,100)},this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)}_handleScrollButtonMouseUp(){var t,e;clearTimeout((t=this.holdTimer)!==null&&t!==void 0?t:-1),this.holdTimer=null,cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)}_checkScrollArrows(){var t,e,n;this.tabsContainer.scrollLeft()===0?this.tabPreviousButton.first().prop("disabled",!0):((t=this.tabsContainer.scrollLeft())!==null&&t!==void 0?t:0)+((e=this.tabsContainer.innerWidth())!==null&&e!==void 0?e: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(t,e){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(t===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(e-r),this.isDraggingTab&&this.parent._highlightHeaderDropZone(a.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(t===this.SCROLL_RIGHT){var l,h;if(this.tabsContainer.scrollLeft(e+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,v,f=o||d,g=d-f,_=this.START_SPEED*g+.5*this.ACCELERATION*(g*g);_=Math.min(_,(u=(v=this.tabsContainer.get(0))===null||v===void 0?void 0:v.scrollWidth)!==null&&u!==void 0?u:1/0),this._handleScrollRepeat(t,e,_,f)})}}_$setClosable(t){return this.closeButton&&this._isClosable()?(this.closeButton.element[t?"show":"hide"](),!0):!1}_$destroy(){this.emit("destroy",this);for(var t=0;t<this.tabs.length;t++)this.tabs[t]._$destroy();this._detachWheelListener(),this._handleItemDropped(),c(document).off("mouseup",this._hideAdditionalTabsDropdown),this.tabDropdownSearch.off("input",this._handleFilterInput),this.tabDropdownSearch.off("keydown",this._handleFilterKeydown),this.element.remove()}_getHeaderSetting(t){if(t in this.parent._header)return this.parent._header[t]}_createControls(){var t,e,n,r,o;if(o=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new Et(this,o,"lm_tabdropdown",this._showAdditionalTabsDropdown),this.tabDropdownButton.element.hide(),this.controlsContainer.prepend(this.tabNextButton),this.tabNextButton.hide(),this._getHeaderSetting("popout")&&(e=this._onPopoutClick.bind(this),n=this._getHeaderSetting("popout"),new Et(this,n,"lm_popout",e)),this._getHeaderSetting("maximise")){r=this.parent.toggleMaximise.bind(this.parent);var s=this._getHeaderSetting("maximise"),a=this._getHeaderSetting("minimise"),l=new Et(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()&&(t=this.parent.remove.bind(this.parent),n=this._getHeaderSetting("close"),this.closeButton=new Et(this,n,"lm_close",t))}_showAdditionalTabsDropdown(){if(this.isDropdownShown){this._hideAdditionalTabsDropdown();return}this.tabDropdownList=this.tabsContainer.clone(!0).appendTo(this.tabDropdownContainer).children().removeClass("lm_active"),c(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"),c(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown()}_handleFilterKeydown(t){if(t.key==="Escape"){this._hideAdditionalTabsDropdown();return}if(this.dropdownKeyIndex===-1)return;if(t.key==="Enter"||t.key===" "){this._hideAdditionalTabsDropdown(),this.tabs[this.dropdownKeyIndex]._onTabClick();return}function e(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(t.key==="ArrowDown"||t.key==="Tab"&&t.shiftKey===!1){var n,r;t.preventDefault(),(n=this.tabDropdownList)===null||n===void 0||n.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=e(this.dropdownKeyIndex,1,this.tabDropdownList),(r=this.tabDropdownList)===null||r===void 0||r.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}else if(t.key==="ArrowUp"||t.key==="Tab"){var o,s;t.preventDefault(),(o=this.tabDropdownList)===null||o===void 0||o.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=e(this.dropdownKeyIndex,-1,this.tabDropdownList),(s=this.tabDropdownList)===null||s===void 0||s.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_handleFilterInput(t){if(this.tabDropdownList!=null){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var e=0;e<this.tabDropdownList.length;e++){var n,r;((n=(r=this.tabs[e].contentItem.config.title)===null||r===void 0?void 0:r.toLowerCase().indexOf(t.target.value.toLowerCase()))!==null&&n!==void 0?n:-1)!==-1?(this.tabDropdownList.eq(e).css("display",""),this.dropdownKeyIndex===-1&&(this.dropdownKeyIndex=e)):this.tabDropdownList.eq(e).css("display","none")}this.dropdownKeyIndex!==-1&&this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_hideAdditionalTabsDropdown(t){var e,n;this.isDropdownShown&&(t&&(e=this.tabDropdownContainer.get(0))!==null&&e!==void 0&&e.contains(t.target)||t&&((n=this.tabDropdownButton)===null||n===void 0?void 0:n.element.get(0))===t.target||(this.element.removeClass("lm_dropdown_open"),this.tabDropdownContainer.hide(),this.isDropdownShown=!1,this.element.append(this.tabDropdownContainer),this.tabDropdownContainer.find(".lm_tabs").remove(),c(document).off("mousedown",this._hideAdditionalTabsDropdown)))}_updateAdditionalTabsDropdown(){var t,e,n,r;if(this.isDropdownShown&&!(!this.tabDropdownList||this.tabDropdownList.length==0)){var o=(t=(e=this.tabDropdownContainer.get(0))===null||e===void 0?void 0:e.scrollHeight)!==null&&t!==void 0?t:0;if(o!==0){var s=this.tabDropdownContainer[0].getBoundingClientRect(),a=(n=c(window).height())!==null&&n!==void 0?n:0,l=(r=c(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,v=Math.min(h.left+(u?h.width:0),l-s.width-this.PADDING),f=u?Math.max(h.top-o,this.PADDING):h.bottom,g=a-f-this.PADDING;this.tabDropdownContainer.css({"max-height":g,top:f,left:v})}}}}_isClosable(){return!!(this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon)}_onPopoutClick(){if(this.layoutManager.config.settings.popoutWholeStack===!0)this.parent.popout();else{var t;(t=this.activeContentItem)===null||t===void 0||t.popout()}}_onHeaderClick(t){t.target===this.element[0]&&this.parent.select()}_updateTabSizes(){if(this.tabs.length!==0){var t=this.tabsContainer.get(0);if(this.isDropdownShown&&this._updateAdditionalTabsDropdown(),!!t){if(!this.isOverflowing&&t.scrollWidth>t.clientWidth){var e;(e=this.tabDropdownButton)===null||e===void 0||e.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0}else if(this.isOverflowing&&t.scrollWidth<=t.clientWidth){var n;(n=this.tabDropdownButton)===null||n===void 0||n.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1}this.isOverflowing&&this._checkScrollArrows()}}}}y(et,"_template",['<div class="lm_header">','<ul class="lm_tabs"></ul>','<ul class="lm_controls"></ul>','<ul class="lm_tabdropdown_list">','<li class="lm_tabdropdown_search"><input type="text" placeholder="Find tab..."></li>',"</ul>","</div>"].join(""));y(et,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));y(et,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function St(i,t,e){return t=hr(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function hr(i){var t=dr(i,"string");return typeof t=="symbol"?t:String(t)}function dr(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Je{constructor(t,e,n){St(this,"_isVertical",void 0),St(this,"_size",void 0),St(this,"_grabSize",void 0),St(this,"_dragListener",void 0),St(this,"element",void 0),this._isVertical=t,this._size=e,this._grabSize=n<e?e:n,this.element=this._createElement(),this._dragListener=new xt(this.element)}on(t,e,n){var r;(r=this._dragListener)===null||r===void 0||r.on(t,e,n)}_$destroy(){var t;(t=this._dragListener)===null||t===void 0||t.destroy(),this._dragListener=null,this.element.remove()}_createElement(){var t=c('<div class="lm_drag_handle"></div>'),e=c('<div class="lm_splitter"></div>');e.append(t);var n=this._grabSize-this._size,r=n/2;return this._isVertical?(t.css("top",-r),t.css("height",this._size+n),e.addClass("lm_vertical"),e.height(this._size)):(t.css("left",-r),t.css("width",this._size+n),e.addClass("lm_horizontal"),e.width(this._size)),e}}const ur=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:Ge,DragProxy:mt,DragSource:Ye,DragSourceFromEvent:Ve,DropTargetIndicator:Tt,Header:et,HeaderButton:Et,Splitter:Je,Tab:At},Symbol.toStringTag,{value:"Module"}));var cr={config:hn,container:fn,controls:ur,errors:Yn,items:rr,utils:xn};const mr=cr;function Pe(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function $(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Pe(Object(e),!0).forEach(function(n){b(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):Pe(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function b(i,t,e){return t=fr(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function fr(i){var t=vr(i,"string");return typeof t=="symbol"?t:String(t)}function vr(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Qe extends Y{static minifyConfig(t){return le(t)}static unminifyConfig(t){return Qt(t)}constructor(t,e){super(),b(this,"isInitialised",!1),b(this,"_isFullPage",!1),b(this,"_resizeTimeoutId",void 0),b(this,"_components",{"lm-react-component":Ue}),b(this,"_fallbackComponent",void 0),b(this,"_itemAreas",[]),b(this,"_maximisedItem",null),b(this,"_maximisePlaceholder",c('<div class="lm_maximise_place"></div>')),b(this,"_creationTimeoutPassed",!1),b(this,"_subWindowsCreated",!1),b(this,"_dragSources",[]),b(this,"_updatingColumnsResponsive",!1),b(this,"_firstLoad",!0),b(this,"_reactChildMap",new Map),b(this,"_reactChildren",null),b(this,"_initialHeaderHeight",void 0),b(this,"width",null),b(this,"height",null),b(this,"root",void 0),b(this,"openPopouts",[]),b(this,"selectedItem",null),b(this,"isSubWindow",!1),b(this,"eventHub",new Ke(this)),b(this,"config",void 0),b(this,"container",void 0),b(this,"_originalContainer",void 0),b(this,"dropTargetIndicator",null),b(this,"tabDropPlaceholder",c('<div class="lm_drop_tab_placeholder"></div>')),b(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(t),this._originalContainer=e,this.container=this._getContainer(),this._initialHeaderHeight=this.config.dimensions.headerHeight,this.isSubWindow&&c("body").css("visibility","hidden"),this._typeToItem={column:Ut.bind(this,!0),row:Ut.bind(this,!1),stack:ne,component:Ze}}registerComponent(t,e){if(typeof e!="function"&&(e==null||e.render==null||typeof e.render!="function"))throw new Error("Please register a constructor function");if(this._components[t]!==void 0)throw new Error("Component "+t+" is already registered");this._components[t]=e;var n=()=>{if(this._components[t]===void 0)throw new Error("Component "+t+" is not registered");delete this._components[t]};return n}setFallbackComponent(t){this._fallbackComponent=t}toConfig(t){if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");if(t&&!(t instanceof A))throw new Error("Root must be a ContentItem");var e={settings:$({},this.config.settings),dimensions:$({},this.config.dimensions),labels:$({},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])}};t?n(e,{contentItems:[t]}):n(e,this.root),this._$reconcilePopoutWindows(),e.openPopouts=[];for(var r=0;r<this.openPopouts.length;r++)e.openPopouts.push(this.openPopouts[r].toConfig());return e.maximisedItemId=this._maximisedItem?"__glMaximised":void 0,e}getComponent(t){return this._components[t]}getFallbackComponent(){return this._fallbackComponent}init(){if(this._subWindowsCreated===!1&&(this._createSubWindows(),this._subWindowsCreated=!0),document.readyState==="loading"||document.body===null){c(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 Tt,this.updateSize(),this._create(this.config),this._bindEvents(),this.isInitialised=!0,this._adjustColumnsResponsive(),this.emit("initialised")}addReactChild(t,e){this._reactChildMap.set(t,e),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged")}removeReactChild(t,e){var n=this._reactChildMap.get(t);n===e&&(this._reactChildMap.delete(t),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(t=>{t._header.show=!0,t.header.element.toggle(!0)}),this.updateSize()}disableHeaders(){this.config.settings.hasHeaders=!1,this.config.dimensions.headerHeight=0,this._findAllStackContainers().forEach(t=>{t._header.show=!1,t.header.element.toggle(!1)}),this.updateSize()}updateSize(t,e){var n,r;if(this.width=(n=t??this.container.width())!==null&&n!==void 0?n:0,this.height=(r=e??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 t;this.isInitialised===!1||!this.root||(this._onUnload(),c(window).off("resize",this._onResize),c(window).off("unload beforeunload",this._onUnload),c(window).off("blur.lm").off("focus.lm"),this.root.callDownwards("_$destroy",[],!0),this.root.contentItems=[],this.tabDropPlaceholder.remove(),(t=this.dropTargetIndicator)===null||t===void 0||t.destroy(),this.eventHub.destroy(),this._dragSources.forEach(function(e){e._dragListener.destroy()}),this._dragSources=[])}createContentItem(t,e){var n,r,o;if(typeof t.type!="string")throw new ut("Missing parameter 'type'",t);if(t.type==="react-component"&&(t.type="component",t.componentName="lm-react-component"),!this._typeToItem[t.type])throw r="Unknown type '"+t.type+"'. Valid types are "+Object.keys(this._typeToItem).join(","),new ut(r);return t.type==="component"&&!(e instanceof ne)&&e&&!(this.isSubWindow===!0&&e instanceof ie)&&(t={type:"stack",width:t.width,height:t.height,content:[t]}),t.id=(n=t.id)!==null&&n!==void 0?n:Ht(),o=new this._typeToItem[t.type](this,t,e),o}createPopout(t,e,n,r){var o=[],s=t instanceof A,a=this;if(s){var l;o=this.toConfig(t).content,n=Ht();for(var h=t.parent,d=t;((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 v;r=(v=h)===null||v===void 0?void 0:v.contentItems.indexOf(d)}}else t instanceof Array?o=t:o=[t];if(!e&&s){var f,g,_,x=window.screenX||window.screenLeft,M=window.screenY||window.screenTop,N=(f=t.element.offset())!==null&&f!==void 0?f:{left:0,top:0};e={left:x+N.left,top:M+N.top,width:(g=t.element.width())!==null&&g!==void 0?g:0,height:(_=t.element.height())!==null&&_!==void 0?_:0}}if(!e&&!s&&(e={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),s&&t.remove(),!(!e||!n||r===void 0)){var P=new Ge(o,e,n,r,this);return P.on("initialised",function(){a.emit("windowOpened",P)}),P.on("closed",function(){a._$reconcilePopoutWindows()}),this.openPopouts.push(P),P}}createDragSource(t,e){this.config.settings.constrainDragToContainer=!1;var n=new Ye(t,e,this);return this._dragSources.push(n),n}createDragSourceFromEvent(t,e){return this.config.settings.constrainDragToContainer=!1,new Ve(t,this,e)}selectItem(t,e){if(this.config.settings.selectionEnabled!==!0)throw new Error("Please set selectionEnabled to true to use this feature");t!==this.selectedItem&&(this.selectedItem!==null&&this.selectedItem.deselect(),t&&e!==!0&&t.select(),this.selectedItem=t,this.emit("selectionChanged",t))}_$maximiseItem(t){var e,n;this._maximisedItem!==null&&this._$minimiseItem(this._maximisedItem),this._maximisedItem=t,this._maximisedItem.addId("__glMaximised"),t.element.addClass("lm_maximised"),t.element.after(this._maximisePlaceholder),this.root.element.prepend(t.element),t.element.width((e=this.container.width())!==null&&e!==void 0?e:0),t.element.height((n=this.container.height())!==null&&n!==void 0?n:0),t.callDownwards("setSize"),this._maximisedItem.emit("maximised"),this.emit("stateChanged")}_$minimiseItem(t){var e;t.element.removeClass("lm_maximised"),t.removeId("__glMaximised"),this._maximisePlaceholder.after(t.element),this._maximisePlaceholder.remove(),(e=t.parent)===null||e===void 0||e.callDownwards("setSize"),this._maximisedItem=null,t.emit("minimised"),this.emit("stateChanged")}_$closeWindow(){window.setTimeout(function(){window.close()},1)}_$getArea(t,e){for(var n=1/0,r=null,o=0;o<this._itemAreas.length;o++){var s=this._itemAreas[o];t>s.x1&&t<s.x2&&e>s.y1&&e<s.y2&&n>s.surface&&(n=s.surface,r=s)}return r}_$createRootItemAreas(){var t=50,e=$({},this.root._$getArea()),n=[$($({},e),{},{side:"left",x2:e.x1+t}),$($({},e),{},{side:"right",x1:e.x2-t}),$($({},e),{},{side:"top",y2:e.y1+t}),$($({},e),{},{side:"bottom",y1:e.y2-t})];n.forEach(r=>{r.surface=(r.x2-r.x1)*(r.y2-r.y1)}),this._itemAreas.push(...n)}_$calculateItemAreas(){var t=this._getAllContentItems();if(this._itemAreas=[],t.length===1){this._itemAreas.push(this.root._$getArea());return}this._$createRootItemAreas();for(var e=0;e<t.length;e++){var n=t[e];if(ct(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=$($({},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(t,e){if(!t)throw new Error("No content item defined");if(typeof t=="function"&&(t=t()),t instanceof A)return t;if(c.isPlainObject(t)&&t.type){var n=this.createContentItem(t,e);return n.callDownwards("_$init"),n}else throw new Error("Invalid contentItem")}_$reconcilePopoutWindows(){for(var t=[],e=0;e<this.openPopouts.length;e++){var n;((n=this.openPopouts[e].getWindow())===null||n===void 0?void 0:n.closed)===!1?t.push(this.openPopouts[e]):this.emit("windowClosed",this.openPopouts[e])}this.openPopouts.length!==t.length&&(this.emit("stateChanged"),this.openPopouts=t)}_getAllContentItems(){var t=[],e=n=>{if(t.push(n),n.contentItems instanceof Array)for(var r=0;r<n.contentItems.length;r++)e(n.contentItems[r])};return e(this.root),t}_bindEvents(){this._isFullPage&&c(window).resize(this._onResize),c(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(t){var e,n=ke("gl-window");n&&(this.isSubWindow=!0,t=JSON.parse(localStorage.getItem(n)||"{}"),t=Qt(t),localStorage.removeItem(n)),t=c.extend(!0,{},We,t);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(t),((e=t.settings)===null||e===void 0?void 0:e.hasHeaders)===!1&&(t.dimensions.headerHeight=0),t}_adjustToWindowMode(){var t,e=c('<div class="lm_popin" title="'+this.config.labels.popin+'"><div class="lm_icon"></div><div class="lm_bg"></div></div>');e.click(()=>{this.emit("popIn")}),document.title=ae((t=this.config.content[0].title)!==null&&t!==void 0?t:""),c("head").append(c("body link, body style, template, .gl_keep")),this.container=c("body").html("").css("visibility","visible").append(e),document.body.offsetHeight,window.__glInstance=this}_createSubWindows(){if(this.config.openPopouts)for(var t=0;t<this.config.openPopouts.length;t++){var e=this.config.openPopouts[t];this.createPopout(e.content,e.dimensions,e.parentId,e.indexInParent)}}_getContainer(){var t=this._originalContainer?c(this._originalContainer):c("body");if(t.length===0)throw new Error("GoldenLayout container not found");if(t.length>1)throw new Error("GoldenLayout more than one container element specified");return t}_setContainer(){var t=this._getContainer();t[0]===document.body&&(this._isFullPage=!0,c("html, body").css({height:"100%",margin:0,padding:0,overflow:"hidden"})),this.container=t}_create(t){var e;if(!(t.content instanceof Array))throw t.content===void 0?e="Missing setting 'content' on top level of configuration":e="Configuration parameter 'content' must be an array",new ut(e,t);if(t.content.length>1)throw e="Top level content can't contain more then one element.",new ut(e,t);this.root=new ie(this,{content:t.content},this.container),this.root.callDownwards("_$init"),t.maximisedItemId==="__glMaximised"&&this.root.getItemsById(t.maximisedItemId)[0].toggleMaximise()}_onUnload(){if(this.config.settings.closePopoutsOnUnload===!0)for(var t=0;t<this.openPopouts.length;t++)this.openPopouts[t].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 t=this.root.contentItems[0].contentItems.length;if(!(t<=1)){var e=this.config.dimensions.minItemWidth,n=t*e;if(!(this.width==null||n<=this.width)){this._updatingColumnsResponsive=!0;for(var r=Math.max(Math.floor(this.width/e),1),o=t-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(t,e){e.type==="stack"?e.contentItems.forEach(function(n){t.addChild(n),e.removeChild(n,!0)}):e.contentItems.forEach(n=>{this._addChildContentItemsToContainer(t,n)})}_findAllStackContainers(){var t=[];return this._findAllStackContainersRecursive(t,this.root),t}_findAllStackContainersRecursive(t,e){e.contentItems.forEach(n=>{ct(n)?t.push(n):n.isComponent||this._findAllStackContainersRecursive(t,n)})}}b(Qe,"__lm",mr);const pr=Qe,gr="_lm_dragging_k4a5m_1",_r="_lm_goldenlayout_k4a5m_1",br="_lm_header_k4a5m_1",yr="_lm_controls_k4a5m_1",wr="_lm_tabpreviousbutton_k4a5m_1",Cr="_lm_tabnextbutton_k4a5m_1",Pr="_lm_tab_k4a5m_1",Sr="_lm_active_k4a5m_1",Ir="_lm_close_tab_k4a5m_1",Er="_lm_content_k4a5m_1",Dr="_lm_dragProxy_k4a5m_1",Mr="_lm_dropTargetIndicator_k4a5m_1",Or="_march_k4a5m_1",xr="_lm_inner_k4a5m_1",Tr="_lm_splitter_k4a5m_1",Ar="_lm_selectable_k4a5m_1",Lr="_lm_tabdropdown_list_k4a5m_1",jr="_lm_title_k4a5m_1",Rr="_lm_title_before_k4a5m_1",Nr="_lm_selected_k4a5m_1",$r="_lm_focusin_k4a5m_1",Fr="_lm_window_blur_k4a5m_1",Wr="_lm_popout_k4a5m_1",Br="_lm_maximise_k4a5m_1",zr="_lm_tabdropdown_k4a5m_1",Hr="_lm_close_k4a5m_1",kr="_lm_tabdropdown_search_k4a5m_1",Ur="_lm_tabs_k4a5m_1",Kr="_lm_keyboard_active_k4a5m_1",Gr="_lm_maximised_k4a5m_1",Yr="_lm_items_k4a5m_1",Se={"tab-height":"28px","drag-border-width":"5px",lm_dragging:gr,lm_goldenlayout:_r,lm_header:br,lm_controls:yr,lm_tabpreviousbutton:wr,lm_tabnextbutton:Cr,lm_tab:Pr,lm_active:Sr,lm_close_tab:Ir,lm_content:Er,lm_dragProxy:Dr,lm_dropTargetIndicator:Mr,march:Or,lm_inner:xr,lm_splitter:Tr,lm_selectable:Ar,lm_tabdropdown_list:Lr,lm_title:jr,lm_title_before:Rr,lm_selected:Nr,lm_focusin:$r,lm_window_blur:Fr,lm_popout:Wr,lm_maximise:Br,lm_tabdropdown:zr,lm_close:Hr,lm_tabdropdown_search:kr,lm_tabs:Ur,lm_keyboard_active:Kr,lm_maximised:Gr,lm_items:Yr},Ie=Object.freeze({tabHeight:parseInt(Se["tab-height"],10),dragBorderWidth:parseInt(Se["drag-border-width"],10)});function Ee(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function J(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Ee(Object(e),!0).forEach(function(n){ti(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):Ee(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function ti(i,t,e){return t=Vr(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Vr(i){var t=Xr(i,"string");return typeof t=="symbol"?t:String(t)}function Xr(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}var rt=Mt.module("LayoutUtils");function ei(i){return i.componentName!==void 0}function _t(i){var t=i;return(ei(i)&&i.componentName==="lm-react-component"||i.type==="react-component")&&t.component!==void 0}function $t(i){return i.focus!==void 0}function De(i){return i.type==="stack"}class m{static activateTab(t,e){var n=m.getStackForRoot(t,e,!1);if(!n){rt.error("Could not find stack for config",e);return}var r=m.getContentItemInStack(n,e);r&&n.setActiveContentItem(r)}static isActiveTab(t,e){var n=m.getStackForRoot(t,e,!1);if(!n)return rt.error("Could not find stack for config",e),!1;var r=m.getContentItemInStack(n,e),o=n.getActiveContentItem();return o===r}static addStack(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=e?"column":"row";if(qe(t)){(t.contentItems==null||t.contentItems.length===0)&&t.addChild({type:n});var r=t.contentItems[0],o=e?r.isColumn:r.isRow;if(!o){t.removeChild(r,!0),t.addChild({type:n});var s=document.activeElement;t.contentItems[0].addChild(r),s&&s.focus!=null&&s.focus()}return this.addStack(t.contentItems[0],e)}if(t.contentItems.length<2)return t.addChild({type:"stack"}),t.contentItems[t.contentItems.length-1];var a=t.contentItems[t.contentItems.length-1],l=e?a.isRow:a.isColumn;return l||(t.addChild({type:e?"row":"column"}),t.removeChild(a,!0),t.contentItems[t.contentItems.length-1].addChild(a),a=t.contentItems[t.contentItems.length-1]),this.addStack(a,!e)}static getStackById(t,e){var n,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(r&&ct(t)&&t.contentItems.length===0)return t;if(e===((n=t.config)===null||n===void 0?void 0:n.id)){if(ct(t))return t;throw new Error("Item with ID ".concat(e," is not a stack"))}if(t.contentItems==null)return null;for(var o=0;o<t.contentItems.length;o+=1){var s=this.getStackById(t.contentItems[o],e,r);if(s)return s}return null}static getStackForConfig(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(n&&ct(t)&&t.contentItems.length===0)return t;if(t.contentItems==null)return null;for(var r=0;r<t.contentItems.length;r+=1){var o=t.contentItems[r];if(o.isComponent&&o.config!=null&&ve(o.config,e))return t;var s=this.getStackForConfig(o,e,n);if(s)return s}return null}static getStackForRoot(t,e){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(t,e);return!s&&r&&(s=this.getStackForConfig(t,{component:e.component},o)),!s&&n&&(s=this.addStack(t)),s}static getStackForComponentTypes(t,e){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<e.length;s+=1){var a=e[s],l=s===e.length-1,h=m.getStackForRoot(t,{component:a},n&&l,r,o);if(h)return h}return null}static getContentItemInStack(t,e){if(!t)return null;for(var n=0;n<t.contentItems.length;n+=1){var r=t.contentItems[n];if(r.isComponent&&r.config!=null&&ve(r.config,e))return r}return null}static dehydrateLayoutConfig(t,e){if(t==null||!t.length)return[];for(var n=[],r=0;r<t.length;r+=1){var o=t[r],{component:s,content:a}=o;if(s){var l=e(s,o);l!=null?n.push(l):rt.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(s,'"'))}else if(a){var h=J(J({},o),{},{content:m.dehydrateLayoutConfig(a,e)});n.push(h)}else n.push(o)}return n}static getTabPoint(t){var{tab:e}=t;if(e==null)throw new Error("Cannot get tab for panel container ".concat(t));var n=e.element[0].getBoundingClientRect();return[n.left+n.width*.5,n.bottom-8]}static dropLayoutMinorChange(t){for(var e=0;e<t.length;e+=1){var n=t[e],{content:r}=n;r!==void 0?(De(n)&&delete n.activeItemIndex,m.dropLayoutMinorChange(r)):_t(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(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=m.cloneLayout(t),o=m.cloneLayout(e);return n?(m.dropLayoutMinorChange(r),m.dropLayoutMinorChange(o),Zt(r,o)):Zt(r,o)}static cloneLayout(t){return JSON.parse(JSON.stringify(t))}static hydrateLayoutConfig(t,e){if(t==null||!t.length)return[];for(var n=[],r=0;r<t.length;r+=1){var o=t[r];if(_t(o)){var s,{component:a,props:l={}}=o;n.push(J(J({},o),{},{id:(s=o==null?void 0:o.id)!==null&&s!==void 0?s:Wt(),props:e(a,l)}))}else if(o.content!==void 0){var h=m.hydrateLayoutConfig(o.content,e);De(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=h.length&&(rt.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),n.push(J(J({},o),{},{content:h}))}else n.push(o)}return n}static openComponent(){var{root:t,config:e,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=J({},e);if(d.id==null&&(d.id=Wt()),l!=null){t==null||t.layoutManager.createDragSourceFromEvent(d,l);return}var u=o||{id:d.id,component:d.component};fe(t);var v=n??(s?m.addStack(t):m.getStackForRoot(t,u));fe(v);var f=m.getContentItemInStack(v,u);if(a!=null){var g=x=>{rt.debug("Component created, focusing element",a),v.off("componentCreated",g);var{element:M}=x.origin;requestAnimationFrame(()=>{m.focusElement(M[0],a)})};v.on("componentCreated",g)}if(r&&f){var _=v.contentItems.indexOf(f);v.addChild(d,_+1),v.removeChild(f),v.setActiveContentItem(v.contentItems[_])}else v.addChild(d);a==null&&h&&$t(h)&&h.focus()}static openComponentInStack(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=document.activeElement,o={id:e.id},s=m.getContentItemInStack(t,o);if(n&&s&&t){var a=t==null?void 0:t.contentItems.indexOf(s);t.addChild(e,a+1),t.removeChild(s),t.setActiveContentItem(t.contentItems[a])}else t==null||t.addChild(e);r&&$t(r)&&r.focus()}static closeComponent(t,e,n){var r=m.getStackForRoot(t,e,!1,!1,!1);if(!r){rt.warn("Cannot find stack for component, ignoring close",e);return}var o=m.getContentItemInStack(r,e),s=document.activeElement;o&&(U(o)?o.container.close(n):r.removeChild(o)),s&&document.contains(s)&&$t(s)&&s.focus()}static renameComponent(t,e,n){var r=m.getStackForRoot(t,e,!1);if(!r){rt.error("Could not find stack for config",e);return}var o=m.getContentItemInStack(r,e);o&&o.setTitle(n)}static cloneComponent(t,e){var n=m.getStackForRoot(t,e,!1);if(!n)return rt.error("Could not find stack for config",e),null;var{props:r={}}=e,o=m.getPanelComponentState(e),s={type:"react-component",component:e.component,props:J(J({},r),{},{panelState:o}),title:"".concat(e.title," Copy"),id:Wt()};return m.openComponentInStack(n,s),s}static getPanelComponentState(t){if(ei(t)){var e;return(e=t.componentState)===null||e===void 0?void 0:e.panelState}if(_t(t)){var n;return(n=t.props)===null||n===void 0?void 0:n.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:Ie.tabHeight,borderWidth:Ie.dragBorderWidth,borderGrabWidth:10},settings:{showPopoutIcon:!1,showCloseIcon:!1,constrainDragToContainer:!1}}}static getRootFromContainer(t){return t.layoutManager.root}static getComponentConfigFromContainer(t){return t?t.tab!=null&&t.tab.contentItem!=null?t.tab.contentItem.config:t._config:null}static getTitleFromContainer(t){return t!=null&&t.tab!=null&&t.tab.contentItem!=null?t.tab.contentItem.config.title:null}static getTitleFromTab(t){return t!=null&&t.contentItem!=null?t.contentItem.config.title:null}static getIdFromContainer(t){var e=m.getComponentConfigFromContainer(t);return e?e.id:null}static getIdFromPanel(t){var{glContainer:e}=t.props;return m.getIdFromContainer(e)}static getComponentNameFromPanel(t){var{glContainer:e}=t.props,n=m.getComponentConfigFromContainer(e);if(n&&_t(n)){var r;return(r=n.component)!==null&&r!==void 0?r:null}return null}static getComponentName(t){var e,n,r=(e=(n=t.WrappedComponent)===null||n===void 0?void 0:n.displayName)!==null&&e!==void 0?e:t.displayName;if(r==null)throw new Error("Component displayName not defined ".concat(t));return r}static focusElement(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:m.DEFAULT_FOCUS_SELECTOR;if(t==null)return null;var n=t.querySelector(e);return n==null?null:($t(n)&&n.focus(),n)}static onInitialized(t){return new Promise(e=>{if(t.isInitialised){e();return}var n=()=>{t.off("initialised",n),e()};t.on("initialised",n)})}}ti(m,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var qr=tt.forwardRef((i,t)=>{var e=m.getComponentNameFromPanel({props:i});return S.jsx("div",{ref:t,className:"panel-placeholder",children:S.jsxs("div",{children:['Component "',e,'" is not registered.']})})});qr.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 Kt(i){return(i==null?void 0:i.WrappedComponent)!==void 0}function Zr(i){return typeof i.id=="string"&&i.layout instanceof pr&&i.panelManager instanceof de&&typeof i.registerComponent=="function"}function Jo(i){if(!Zr(i))throw new Error("Expected dashboard plugin props, but instead received ".concat(i))}function Me(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function Oe(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Me(Object(e),!0).forEach(function(n){ot(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):Me(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function ot(i,t,e){return t=Jr(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Jr(i){var t=Qr(i,"string");return typeof t=="symbol"?t:String(t)}function Qr(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}var k=Mt.module("PanelManager");class de{constructor(t){var e=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]:()=>{};ot(this,"layout",void 0),ot(this,"hydrateComponent",void 0),ot(this,"dehydrateComponent",void 0),ot(this,"onPanelsUpdated",void 0),ot(this,"closed",void 0),ot(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=t,this.hydrateComponent=e,this.dehydrateComponent=n,this.onPanelsUpdated=s,this.openedMap=new Map(r),this.closed=[...o],this.startListening()}startListening(){var{eventHub:t}=this.layout;t.on(D.FOCUS,this.handleFocus),t.on(D.MOUNT,this.handleMount),t.on(D.UNMOUNT,this.handleUnmount),t.on(D.REOPEN,this.handleReopen),t.on(D.REOPEN_LAST,this.handleReopenLast),t.on(D.DELETE,this.handleDeleted),t.on(D.CLOSED,this.handleClosed),t.on(D.CLOSE,this.handleControlClose)}stopListening(){var{eventHub:t}=this.layout;t.off(D.FOCUS,this.handleFocus),t.off(D.MOUNT,this.handleMount),t.off(D.UNMOUNT,this.handleUnmount),t.off(D.REOPEN,this.handleReopen),t.off(D.REOPEN_LAST,this.handleReopenLast),t.off(D.DELETE,this.handleDeleted),t.off(D.CLOSED,this.handleClosed),t.off(D.CLOSE,this.handleControlClose)}getClosedPanelConfigsOfType(t){return this.closed.filter(e=>e.component===t)}getOpenedPanels(){return Array.from(this.openedMap.values())}getOpenedPanelConfigs(){return this.getOpenedPanels().map(t=>{var{glContainer:e}=t.props;return m.getComponentConfigFromContainer(e)})}getOpenedPanelConfigsOfType(t){return this.getOpenedPanelConfigs().filter(e=>e!=null&&_t(e)&&e.component===t)}getOpenedPanelById(t){return this.openedMap.get(t)}getContainerByPanelId(t){var e,n=m.getStackForConfig(this.layout.root,{id:t});return(e=n&&m.getContentItemInStack(n,{id:t}))!==null&&e!==void 0?e:null}getLastUsedPanel(t){for(var e=this.getOpenedPanels(),n=e.length-1;n>=0;n-=1){var r=e[n];if(t==null||t(r))return r}}getLastUsedPanelOfType(t){return this.getLastUsedPanelOfTypes([t])}getLastUsedPanelOfTypes(t){return this.getLastUsedPanel(e=>t.some(n=>Kt(n)&&e instanceof n.WrappedComponent||!Kt(n)&&e instanceof n))}updatePanel(t){var e=m.getIdFromPanel(t);if(e==null){k.error("updatePanel Panel did not have an ID",t);return}k.debug2("Updating panel ID ".concat(e," in open panels map")),this.openedMap.delete(e),this.openedMap.set(e,t)}removePanel(t){var e=m.getIdFromPanel(t);if(e==null){k.error("removePanel Panel did not have an ID",t);return}if(!this.openedMap.has(e)){k.error("Missing panel ID ".concat(e," in open panels map"));return}if(this.openedMap.get(e)!==t){k.debug("Panel argument doesn't match the open panels map entry for ".concat(e,", removePanel ignored"));return}k.debug2("Removing panel ID ".concat(e," from open panels map")),this.openedMap.delete(e)}removeClosedPanelConfig(t){var e=this.closed.findIndex(n=>n===t||n.id!=null&&t.id!=null&&n.id===t.id);e>=0&&this.closed.splice(e,1)}handleFocus(t){k.debug2("Focus: ",t),this.updatePanel(t)}handleMount(t){k.debug2("Mount: ",t),this.updatePanel(t),this.sendUpdate()}handleUnmount(t){k.debug2("Unmount: ",t),this.removePanel(t),this.sendUpdate()}handleReopen(t,e){k.debug2("Reopen:",t,e),this.removeClosedPanelConfig(t);var{component:n}=t,{props:r}=t;r=this.hydrateComponent(n,r);var o=Oe(Oe({},t),{},{props:r}),{root:s}=this.layout,a=t.parentStackId===void 0?void 0:m.getStackById(s,t.parentStackId);m.openComponent({root:s,config:o,replaceConfig:e,stack:a??void 0})}handleReopenLast(t){var e;if(this.closed.length!==0){if(t===void 0){this.handleReopen(this.closed[this.closed.length-1]);return}for(var n=(e=m.getStackForConfig(this.layout.root,t.getConfig()))===null||e===void 0?void 0:e.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(t){k.debug2("Deleted:",t),this.removeClosedPanelConfig(t),this.sendUpdate()}handleClosed(t,e){k.debug2("Closed: ",t),this.addClosedPanel(e),this.sendUpdate()}handleControlClose(t){var e={id:t},{root:n}=this.layout;m.closeComponent(n,e)}addClosedPanel(t){var{root:e}=this.layout,n=m.getComponentConfigFromContainer(t);if(n&&_t(n)){var r=this.dehydrateComponent(n.component,n);if(r!=null){var o;r.parentStackId=(o=m.getStackForConfig(e,n))===null||o===void 0?void 0:o.config.id,this.closed.push(r)}}}sendUpdate(){var{closed:t,openedMap:e}=this;this.onPanelsUpdated({closed:[...t],openedMap:new Map(e)})}}ot(de,"MAX_CLOSED_PANEL_COUNT",100);var to=Mt.module("PanelErrorBoundary");class eo extends w.Component{constructor(t){super(t),this.state={error:null}}componentDidCatch(t){this.setState({error:t})}componentWillUnmount(){var{glContainer:t,glEventHub:e}=this.props,n=m.getIdFromContainer(t);to.debug("componentWillUnmount",n),e.emit(D.CLOSED,n,t)}render(){var{children:t}=this.props,{error:e}=this.state;return e!=null?S.jsx("div",{className:"panel-error-boundary",children:S.jsx(wi,{errorMessage:"".concat(e),isLoading:!1,isLoaded:!1})}):t}}function xe(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function Gt(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?xe(Object(e),!0).forEach(function(n){io(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):xe(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function io(i,t,e){return t=no(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function no(i){var t=ro(i,"string");return typeof t=="symbol"?t:String(t)}function ro(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}function ii(i){var{props:t,componentState:e}=i,{metadata:n}=t,{panelState:r=null}=t;e&&({panelState:r}=e);var o={};return n!=null&&(o.metadata=n),r!=null&&(o.panelState=r),Gt(Gt({},i),{},{componentState:null,props:o,type:"react-component"})}function ni(i){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return Gt(Gt({},i),{},{localDashboardId:t})}function oo(i){var t=Kt(i)&&i.WrappedComponent.prototype!=null&&i.WrappedComponent.prototype.isReactComponent!=null||i.prototype!=null&&i.prototype.isReactComponent!=null,e=!Kt(i)&&"$$typeof"in i&&i.$$typeof===Ii.ForwardRef;return t||e}const Qo={dehydrate:ii,hydrate:ni};var ts=tt.createContext(void 0),so=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}),ri=C.shape({on:C.func,off:C.func,emit:C.func}),ao=C.shape({registerComponent:C.func,root:C.shape({addChild:C.func}),on:C.func,off:C.func,eventHub:ri}),lo=Object.freeze({Container:so,EventHub:ri,Layout:ao});function gt(i,t,e){w.useEffect(function(){return i.on(t,e),()=>{i.off(t,e)}},[i,t,e])}var oi="SET_DASHBOARD_DATA";const ho=$i(oi,{},!1),uo={dashboardData:ho};var co=new Map,si=Object.freeze({}),mo=Object.freeze([]),fo=i=>i.dashboardData,yt=(i,t)=>{var e;return(e=fo(i)[t])!==null&&e!==void 0?e:si},es=(i,t)=>{var e;return(e=yt(i,t).closed)!==null&&e!==void 0?e:mo},is=(i,t)=>{var e;return(e=yt(i,t).openedMap)!==null&&e!==void 0?e:co},ai=(i,t)=>{var e;return(e=yt(i,t).pluginDataMap)!==null&&e!==void 0?e:si},ns=(i,t,e)=>ai(i,t)[e];function Te(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function bt(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Te(Object(e),!0).forEach(function(n){vo(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):Te(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function vo(i,t,e){return t=po(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function po(i){var t=go(i,"string");return typeof t=="symbol"?t:String(t)}function go(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}var li=(i,t)=>({type:oi,id:i,payload:t}),_o=(i,t)=>(e,n)=>e(li(i,bt(bt({},yt(n(),i)),t))),rs=(i,t,e)=>(n,r)=>n(li(i,bt(bt({},yt(r(),i)),{},{pluginDataMap:bt(bt({},ai(r(),i)),{},{[t]:e})})));Object.entries(uo).map(i=>{var[t,e]=i;return Ci.register(t,e)});function bo(i){var{children:t}=i;return S.jsx(S.Fragment,{children:t})}function Ae(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function It(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Ae(Object(e),!0).forEach(function(n){yo(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):Ae(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function yo(i,t,e){return t=wo(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function wo(i){var t=Co(i,"string");return typeof t=="symbol"?t:String(t)}function Co(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}var Ft=Mt.module("DashboardLayout"),Po=Object.freeze({}),So=[],Le=()=>{},Io=1e3,je=i=>i;function Eo(i){var t,e,{id:n,children:r,emptyDashboard:o=S.jsx("div",{children:"Dashboard is empty."}),layout:s,layoutConfig:a=So,onLayoutChange:l=Le,onLayoutInitialized:h=Le,hydrate:d=ni,dehydrate:u=ii,panelWrapper:v=bo}=i,f=Ei(),g=(t=Di(p=>yt(p,n)))!==null&&t!==void 0?t:Po,[_,x]=w.useState(!1),[M,N]=w.useState(!1),[P,q]=w.useState(),[W]=w.useState((e=g==null?void 0:g.closed)!==null&&e!==void 0?e:[]),[at,L]=w.useState(s.getReactChildren()),j=w.useMemo(()=>new Map,[]),R=w.useMemo(()=>new Map,[]),lt=w.useCallback(function(p,I){var E,ue=arguments.length>2&&arguments[2]!==void 0?arguments[2]:d,ce=arguments.length>3&&arguments[3]!==void 0?arguments[3]:u;Ft.debug2("registerComponent",p,I,ue,ce);function me(Lt,di){var Yt=I,ui=v,ci=oo(Yt),{glContainer:mi,glEventHub:fi}=Lt;return S.jsx(eo,{glContainer:mi,glEventHub:fi,children:S.jsx(ui,It(It({},Lt),{},{children:ci?S.jsx(Yt,It(It({},Lt),{},{ref:di})):S.jsx(Yt,It({},Lt))}))})}me.displayName="DashboardWrapper(".concat((E=I.displayName)!==null&&E!==void 0?E:p,")");var hi=s.registerComponent(p,tt.forwardRef(me));return j.set(p,ue),R.set(p,ce),hi},[d,u,j,R,s,v]),B=w.useCallback((p,I)=>{var E;return((E=j.get(p))!==null&&E!==void 0?E:je)(I,n)},[j,n]),it=w.useCallback((p,I)=>{var E;return((E=R.get(p))!==null&&E!==void 0?E:je)(I,n)},[R,n]),V=w.useMemo(()=>new de(s,B,it,new Map,W,p=>{var{closed:I,openedMap:E}=p;f(_o(n,{closed:I,openedMap:E}))}),[it,f,B,n,W,s]),X=Yi(p=>{var I=P==null||!m.isEqual(P,p);Ft.debug("handleLayoutStateChanged",I,p),I&&(x(s.root.contentItems.length===0),q(p),l(p),L(s.getReactChildren()))},Io,{flushOnUnmount:!0});w.useEffect(()=>()=>X.flush(),[X]);var K=w.useCallback(()=>{if(!M){var p=s.toConfig(),I=p.content,E=m.dehydrateLayoutConfig(I,it);X(E)}},[it,M,s,X]),Z=w.useCallback(p=>{var I=m.getIdFromContainer(p);s.eventHub.emit(D.DRAGGING,I),N(!0)},[s.eventHub]),ft=w.useCallback(p=>{var I=m.getIdFromContainer(p);s.eventHub.emit(D.DROPPED,I),N(!1)},[s.eventHub]),wt=w.useCallback(p=>{if(Ft.debug2("handleComponentCreated",p),!(p==null||p.config==null||p.config.component==null||p.element==null)){var I=p.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),E="".concat(I,"-component");p.element.addClass(E)}},[]),Ct=w.useCallback(()=>{L(s.getReactChildren())},[s]);gt(s,"stateChanged",K),gt(s,"itemPickedUp",Z),gt(s,"itemDropped",ft),gt(s,"componentCreated",wt),gt(s.eventHub,D.TITLE_CHANGED,K),gt(s,"reactChildrenChanged",Ct);var ht=Vi(a);return w.useEffect(function(){if(ht!==a&&a!==P){Ft.debug("Setting new layout content...");for(var I=m.hydrateLayoutConfig(a,B);s.root.contentItems.length>0;)s.root.contentItems[0].remove();for(var E=0;E<I.length;E+=1)s.root.addChild(I[E]);x(s.root.contentItems.length===0)}},[B,s,a,P,V,ht]),w.useEffect(()=>h(),[]),S.jsxs(S.Fragment,{children:[_&&o,at,tt.Children.map(r,p=>p!=null?tt.cloneElement(p,{id:n,layout:s,panelManager:V,registerComponent:lt}):null)]})}Eo.propTypes={id:C.string.isRequired,children:C.node,data:C.shape({}),emptyDashboard:C.node,layout:lo.Layout.isRequired,layoutConfig:C.arrayOf(C.shape({})),onLayoutChange:C.func,onLayoutInitialized:C.func};var os="default";export{es as $,tn as A,Ko as B,Wo as C,os as D,Ao as E,nn as F,Go as G,on as H,Fe as I,Yo as J,be as K,m as L,gt as M,ts as N,Ji as O,D as P,ns as Q,Eo as R,Qo as S,Gi as T,lo as U,eo as V,de as W,oi as X,Jo as Y,oo as Z,ii as _,fo as a,yt as a0,is as a1,ai as a2,ni as a3,Zr as a4,Kt as a5,uo as a6,li as a7,_o as a8,pr as a9,qr as aa,Li as ab,Fo as ac,Lo as ad,Ti as ae,To as af,xo as ag,U as ah,rs as b,Vi as c,Yi as d,jo as e,Ro as f,ko as g,Bo as h,$e as i,Ne as j,zo as k,Ho as l,Uo as m,$o as n,qo as o,oe as p,Ot as q,No as r,Oo as s,Qi as t,Re as u,Vo as v,Xo as w,sn as x,rn as y,en as z};
2
- //# sourceMappingURL=DashboardConstants-443d54b5.js.map
1
+ import{aH as vi,aI as pi,aJ as gi,k as _i,L as Mt,F as bi,a4 as yi,l as fe,a as wi,aK as Ci}from"./index-7d530b2c.js";import{bn as Zt,r as w,aZ as Pi,M as tt,I as S,K as Vt,L as zt,bp as c,Q as Wt,R as Si,bq as ve,br as Ii,a8 as C,N as Ei,O as Di}from"./vendor-1568bc3d.js";function pe(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function dt(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?pe(Object(e),!0).forEach(function(n){Mi(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):pe(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function Mi(i,t,e){return t=Oi(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Oi(i){var t=xi(i,"string");return typeof t=="symbol"?t:String(t)}function xi(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}var Oo=i=>({type:vi,payload:i}),Ti=i=>({type:gi,payload:i}),Ai=i=>(t,e)=>{t(Ti(i));var{storage:n}=e(),{workspaceStorage:r}=n;return r==null?void 0:r.save(i)},Li=i=>(t,e)=>{var{workspace:n}=e(),{data:r}=n??{},o=dt(dt({},n),{},{data:dt(dt(dt({},r),i),{},{settings:dt(dt({},r==null?void 0:r.settings),i.settings)})});return t(Ai(o))},xo=i=>t=>t(Li({settings:i})),To=i=>({type:pi,payload:i});function ge(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function _e(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?ge(Object(e),!0).forEach(function(n){ji(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):ge(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function ji(i,t,e){return t=Ri(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Ri(i){var t=Ni(i,"string");return typeof t=="symbol"?t:String(t)}function Ni(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}function $i(i){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:t,r=arguments.length>1?arguments[1]:void 0;switch(r.type){case i:{var{id:o,payload:s}=r;return e&&Zt({payload:s},{payload:n[o]})?n:_e(_e({},n),{},{[o]:s})}default:return n}}}var Ao=Object.freeze([]),Lo=new Map,jo=()=>{};function Ro(i){return Array.isArray(i)?i:[i]}function No(){for(var i=arguments.length,t=new Array(i),e=0;e<i;e++)t[e]=arguments[e];return t.filter(n=>n!=null)}function Fi(i,t,e){return t=Wi(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Wi(i){var t=Bi(i,"string");return typeof t=="symbol"?t:String(t)}function Bi(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class zi extends Error{constructor(){super(...arguments),Fi(this,"isCanceled",!0)}}const be=zi;function Hi(i,t,e){return t=ki(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function ki(i){var t=Ui(i,"string");return typeof t=="symbol"?t:String(t)}function Ui(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Ki extends Error{constructor(){super(...arguments),Hi(this,"isTimeout",!0)}}const Gi=Ki;class $o{static makeCancelable(t,e){var n=!1,r,o,s=new Promise((a,l)=>{o=l,Promise.resolve(t).then(h=>{n?e&&e(h):(r=h,a(h))}).catch(h=>l(h))});return s.cancel=()=>{n=!0,o(new be),r!=null&&e&&e(r)},s}static isCanceled(t){return t instanceof be}static isTimedOut(t){return t instanceof Gi}static withTimeout(t,e){return new Promise((n,r)=>{setTimeout(()=>{try{n(e())}catch(o){r(o)}},t)})}}function Re(i){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"No value available in context. Was code wrapped in a provider?",e=w.useContext(i);if(e==null)throw new Error(t);return e}function Yi(i,t,e){var n=w.useRef(e),r=w.useRef(i);r.current=i;var o=w.useMemo(()=>Pi(function(){return r.current(...arguments)},t,n.current),[t]);return w.useEffect(()=>()=>{var s,a;(s=(a=n.current)===null||a===void 0?void 0:a.flushOnUnmount)!==null&&s!==void 0&&s?o.flush():o.cancel()},[o]),o}function Vi(i){var t=w.useRef();return w.useEffect(function(){t.current=i}),t.current}function Xi(i,t,e){return t=qi(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function qi(i){var t=Zi(i,"string");return typeof t=="symbol"?t:String(t)}function Zi(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}function Fo(i){return i.then!==void 0}class st{static disableAllActions(){st.actionsDisabled=!0}static enableAllActions(){st.actionsDisabled=!1}static isContextActionEvent(t){return Array.isArray(t.contextActions)}static compareActions(t,e){if(t.group!==e.group){var n,r;return((n=t.group)!==null&&n!==void 0?n:0)>((r=e.group)!==null&&r!==void 0?r:0)?1:-1}if(t.order!==e.order){var o,s;return((o=t.order)!==null&&o!==void 0?o:0)>((s=e.order)!==null&&s!==void 0?s:0)?1:-1}if(t.title!==e.title){var a,l;return((a=t.title)!==null&&a!==void 0?a:"")>((l=e.title)!==null&&l!==void 0?l:"")?1:-1}return t!==e?t>e?1:-1:0}static sortActions(t){if(t==null||!Array.isArray(t))return[];var e=t.slice();return e.sort(st.compareActions),e}static isMacPlatform(){var{platform:t}=window.navigator;return t.startsWith("Mac")}static getModifierKey(){return st.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(t){var e=st.getModifierKey();return t[e]}static getMenuItems(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=[],r=t;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?e&&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(t,e,n){var r=t;r<0&&e<0&&(r=n.length);for(var o=1;o<n.length+1;o+=1){var s=(r+e*o+n.length)%n.length,a=n[s];if(!(a instanceof Promise)&&a.disabled!==!0)return s}return t}}Xi(st,"actionsDisabled",!1);const Wo=st;var re=tt.forwardRef((i,t)=>{var e,n;function r(L){var{menuItem:j,onMenuItemClick:R}=i;R(j,L)}function o(L){var{menuItem:j,onMenuItemMouseMove:R}=i;R(j,L)}function s(L){var{menuItem:j,onMenuItemContextMenu:R}=i;R(j,L)}function a(L,j,R){if(typeof L.type=="string")return L;var{closeMenu:lt,menuItem:B,isKeyboardSelected:it,isMouseSelected:V,"data-testid":X}=i,K={menuItem:B,closeMenu:lt,isKeyboardSelected:it,isMouseSelected:V,iconElement:j,displayShortcut:R,"data-testid":X};return tt.cloneElement(L,{forwardedProps:K})}var{children:l,menuItem:h,isKeyboardSelected:d=!1,isMouseSelected:u=!1,"data-testid":v}=i,f=(e=h.shortcutText)!==null&&e!==void 0?e:(n=h.shortcut)===null||n===void 0?void 0:n.getDisplayText(),g=null;if(h.icon){var _=h.icon;if(tt.isValidElement(_))g=_;else{var x;h.iconColor!=null&&(h.disabled===void 0||!h.disabled)&&(x={color:h.iconColor}),g=S.jsx(zt,{icon:_,style:x})}}var M=null,N=!!l;h.actions&&(M=S.jsx(zt,{icon:_i}));var P=null;if(h.menuElement)P=S.jsx("div",{className:"custom-menu-item",onMouseMove:o,children:a(h.menuElement,g,f)});else{var q,W=h.disabled,at=h.iconOutline;P=S.jsx("button",{type:"button",className:Vt("btn-context-menu",{disabled:W},{active:(N||u)&&(W===void 0||!W)},{"keyboard-active":d&&(W===void 0||!W)}),onClick:r,onMouseMove:o,onContextMenu:s,title:(q=h.description)!==null&&q!==void 0?q:"",children:S.jsxs("div",{className:"btn-context-menu-wrapper",children:[S.jsx("span",{className:Vt("icon",{outline:at}),children:g}),S.jsx("span",{className:"title",children:h.title}),f!==void 0&&S.jsx("span",{className:"shortcut",children:f}),M&&S.jsx("span",{className:Vt("submenu-indicator",{disabled:W}),children:M})]})})}return S.jsxs("div",{className:"context-menu-item",ref:t,"data-testid":v,children:[l,P]})});re.displayName="ContextMenuItem";re.defaultProps={children:null,isKeyboardSelected:!1,isMouseSelected:!1,"data-testid":void 0};const Bo=re;function Ne(i){return typeof i=="object"&&i!=null&&typeof i.type=="string"&&i.name!=null}function $e(i){return typeof i=="object"&&i!=null&&typeof i.type=="string"&&i.id!=null}function zo(i){return Ne(i)||$e(i)}var Ji=w.createContext(null);function Ho(i){if($e(i))return{id:i.id,type:i.type};if(Ne(i)){var t;return{name:(t=i.name)!==null&&t!==void 0?t:"",type:i.type}}throw new Error("Invalid descriptor: ".concat(i))}function ko(i){var t,e;return{type:(t=i.type)!==null&&t!==void 0?t:"",name:(e=i.title)!==null&&e!==void 0?e:i.name,id:i.id}}function Uo(){return Re(Ji,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}var Qi=w.createContext(null),Ot=Object.freeze({AUTH_PLUGIN:"AuthPlugin",DASHBOARD_PLUGIN:"DashboardPlugin",WIDGET_PLUGIN:"WidgetPlugin",TABLE_PLUGIN:"TablePlugin",THEME_PLUGIN:"ThemePlugin"});function tn(i){return"DashboardPlugin"in i}function en(i){return"AuthPlugin"in i}function nn(i){return"TablePlugin"in i}function Ko(i){return tn(i)||en(i)||nn(i)}function rn(i){return"type"in i&&i.type===Ot.DASHBOARD_PLUGIN}function oe(i){return"type"in i&&i.type===Ot.WIDGET_PLUGIN}function on(i){return"type"in i&&i.type===Ot.TABLE_PLUGIN}function sn(i){return"type"in i&&i.type===Ot.AUTH_PLUGIN}function Fe(i){return"type"in i&&i.type===Ot.THEME_PLUGIN}function Go(i){return rn(i)||sn(i)||on(i)||Fe(i)||oe(i)}var an=Mt.module("@deephaven/plugin.PluginUtils");function Yo(i,t){return i==null||!oe(i)?!1:[i.supportedTypes].flat().some(e=>e===t)}function Vo(i){var t=S.jsx(zt,{icon:yi});if(!oe(i))return t;var{icon:e}=i;return e==null?t:w.isValidElement(e)?e:S.jsx(zt,{icon:e})}function Xo(i){var t=[...i.entries()].filter(e=>Fe(e[1]));return an.debug("Getting theme data from plugins",t),t.map(e=>{var[n,r]=e,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:bi(n,a),name:a,styleContent:h}})}).flat()}function qo(){return Re(Qi,"No Plugins available in usePlugins. This can happen when plugins have not finished loading or if code is not wrapped in PluginsContext.Provider.")}var We=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 Be(i){return i.componentName!==void 0}function ln(i){return i.component!==void 0}var ze=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const hn=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:We,isGLComponentConfig:Be,isReactComponentConfig:ln,itemDefaultConfig:ze},Symbol.toStringTag,{value:"Module"}));function Bt(i,t,e){return t=dn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function dn(i){var t=un(i,"string");return typeof t=="symbol"?t:String(t)}function un(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Dt{constructor(){Bt(this,"_mSubscriptions",void 0),Bt(this,"off",this.unbind),Bt(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[Dt.ALL_EVENT]=[]}on(t,e,n){if(typeof e!="function")throw new Error("Tried to listen to event "+t+" with non-function callback "+e);this._mSubscriptions[t]||(this._mSubscriptions[t]=[]),this._mSubscriptions[t].push({fn:e,ctx:n})}emit(t){for(var e=this._mSubscriptions[t],n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];if(e)for(var s=0;s<e.length;s++){var a=e[s].ctx||{};try{e[s].fn.apply(a,r)}catch(u){console.error("Error while emitting event:",u)}}r.unshift(t);for(var l=this._mSubscriptions[Dt.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(t,e,n){if(!this._mSubscriptions[t])throw new Error("No subscriptions to unsubscribe for event "+t);for(var r=!1,o=0;o<this._mSubscriptions[t].length;o++)(!e||this._mSubscriptions[t][o].fn===e)&&(!n||n===this._mSubscriptions[t][o].ctx)&&(this._mSubscriptions[t].splice(o,1),r=!0);if(r===!1)throw new Error("Nothing to unbind for "+t)}}Bt(Dt,"ALL_EVENT","__all");const Y=Dt;function G(i,t,e){return t=cn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function cn(i){var t=mn(i,"string");return typeof t=="symbol"?t:String(t)}function mn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Jt extends Y{constructor(t,e,n){super(),G(this,"width",void 0),G(this,"height",void 0),G(this,"title",void 0),G(this,"parent",void 0),G(this,"layoutManager",void 0),G(this,"tab",void 0),G(this,"_config",void 0),G(this,"isHidden",!1),G(this,"beforeCloseHandler",void 0),G(this,"_element",c(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),G(this,"_contentElement",void 0),this.title=Be(t)?t.componentName:"",this.parent=e,this.layoutManager=n,this._config=t,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(t,e){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"?e:t,u=((n=this[h])!==null&&n!==void 0?n:0)*(1/(((r=a.config[h])!==null&&r!==void 0?r:0)/100)),v=d/u*100,f=(((o=a.config[h])!==null&&o!==void 0?o:0)-v)/(s.contentItems.length-1),g=0;g<s.contentItems.length;g++)if(s.contentItems[g]===a)s.contentItems[g].config[h]=v;else{var _;s.contentItems[g].config[h]=((_=s.contentItems[g].config[h])!==null&&_!==void 0?_:0)+f}return s.callDownwards("setSize"),!0}close(t){var e,n;this._config.isClosable&&(!((e=(n=this.beforeCloseHandler)===null||n===void 0?void 0:n.call(this,t))!==null&&e!==void 0)||e)&&(this.emit("close"),this.parent.close())}beforeClose(t){this.beforeCloseHandler=t}getState(){return this._config.componentState}getConfig(){return this._config}extendState(t){this.setState(c.extend(!0,this.getState(),t))}setState(t){this._config.componentState=t,this.parent.emitBubblingEvent("stateChanged")}setTitle(t){this.parent.setTitle(t)}_$setSize(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(t!==this.width||e!==this.height){this.width=t,this.height=e;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 fn=Object.freeze(Object.defineProperty({__proto__:null,Container:Jt,ItemContainer:Jt},Symbol.toStringTag,{value:"Module"}));function He(i){var t=location.hash.match(new RegExp(i+"=([^&]*)"));return t?t[1]:null}function ke(i){if(window.location.hash)return He(i);if(!window.location.search)return null;var t=window.location.search.substr(1).split("&"),e={},n,r;for(r=0;r<t.length;r++)n=t[r].split("="),e[n[0]]=n[1];return e[i]||null}function se(i){return window.requestAnimationFrame(i)}function vn(i,t){var e=t.indexOf(i);if(e===-1)throw new Error("Can't remove item from array. Item is not in the array");t.splice(e,1)}function Ht(){return Wt()}function pn(i,t){var e=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 t===!0?e:e.replace(/>/g,"&gt;").replace(/</g,"&lt;")}function ae(i){return c.trim(i.replace(/(<([^>]+)>)/gi,""))}function z(i,t,e){return t=gn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function gn(i){var t=_n(i,"string");return typeof t=="symbol"?t:String(t)}function _n(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class bn extends Y{constructor(t){var e,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super(),z(this,"_eElement",void 0),z(this,"_oDocument",void 0),z(this,"_eBody",void 0),z(this,"_destroyAfterMouseUp",void 0),z(this,"_nDelay",400),z(this,"_timeout",void 0),z(this,"timeout",void 0),z(this,"_nDistance",10),z(this,"_nX",0),z(this,"_nY",0),z(this,"_nOriginalX",0),z(this,"_nOriginalY",0),z(this,"_bDragging",!1),this._eElement=t,this._oDocument=c(document),this._eBody=c(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),(e=this._eElement)===null||e===void 0||e.on("mousedown",this.onMouseDown)}destroy(){var t,e;(t=this._eElement)===null||t===void 0||t.unbind("mousedown",this.onMouseDown),(e=this._oDocument)===null||e===void 0||e.unbind("mouseup",this.onMouseUp),this._eElement=void 0,this._oDocument=void 0,this._eBody=void 0,clearTimeout(this._timeout),this._timeout=void 0}onMouseDown(t){if(t.preventDefault(),t.button===0){var e,n,r,o,s=this._getCoordinates(t);this._nOriginalX=(e=s.x)!==null&&e!==void 0?e: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(t){if(this._timeout!=null){var e,n;t.preventDefault();var r=this._getCoordinates(t);this._nX=((e=r.x)!==null&&e!==void 0?e: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,t)}}onMouseUp(t){if(this._timeout!=null){var e,n,r,o,s;if(clearTimeout(this._timeout),(e=this._oDocument)===null||e===void 0||e.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",t,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 t,e,n,r;window.clearTimeout(this._timeout),this._bDragging=!0,(t=this._eBody)===null||t===void 0||t.addClass("lm_dragging"),(e=this._eElement)===null||e===void 0||e.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(t){var e,n;return{x:(e=t.pageX)!==null&&e!==void 0?e:0,y:(n=t.pageY)!==null&&n!==void 0?n:0}}}const xt=bn;function vt(i,t,e){return t=yn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function yn(i){var t=wn(i,"string");return typeof t=="symbol"?t:String(t)}function wn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Ue{constructor(t,e){vt(this,"_container",void 0),vt(this,"_reactComponent",null),vt(this,"_portalComponent",null),vt(this,"_originalComponentWillUpdate",null),vt(this,"_initialState",void 0),vt(this,"_reactClass",void 0),this._reactComponent=null,this._portalComponent=null,this._originalComponentWillUpdate=null,this._container=t,this._initialState=e,this._reactClass=this._getReactClass(),this._container.on("open",this._render,this),this._container.on("destroy",this._destroy,this)}_key(){var t=this._container._config.id;if(!t)throw new Error("Cannot mount panel without id");return Array.isArray(t)?t.join(","):t}_render(){var t=this._key();this._portalComponent=Si.createPortal(this._getReactComponent(),this._container.getElement()[0],t),this._container.layoutManager.addReactChild(t,this._portalComponent)}_gotReactComponent(t){if(t){this._reactComponent=t,this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate||function(){},this._reactComponent.componentWillUpdate=this._onUpdate.bind(this);var e=this._container.getState();e&&this._reactComponent.setState(e)}}_destroy(){this._container.layoutManager.removeReactChild(this._key(),this._portalComponent),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)}_onUpdate(t,e){var n;this._container.setState(e),(n=this._originalComponentWillUpdate)===null||n===void 0||n.call(this._reactComponent,t,e)}_getReactClass(){var t=this._container._config.component;if(!t)throw new Error("No react component name. type: react-component needs a field `component`");var e=this._container.layoutManager.getComponent(t)||this._container.layoutManager.getFallbackComponent();if(!e)throw new Error('React component "'+t+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return e}_getReactComponent(){var t={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},e=c.extend(t,this._container._config.props);return tt.createElement(this._reactClass,e)}}var kt=["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"],Cn=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function le(i){if(kt.length>36)throw new Error("Too many keys in config minifier map");var t={};return he(i,t,"_min"),t}function Qt(i){if(kt.length>36)throw new Error("Too many keys in config minifier map");var t={};return he(i,t,"_max"),t}function he(i,t,e){var n=e==="_min"?Pn:Sn;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(t))t[Number.parseInt(r,10)]=s;else{var a=n(r,kt);t[a]=s}he(o,s,e)}else{var l=n(o,Cn);if(Array.isArray(t))t[Number.parseInt(r,10)]=l;else{var h=n(r,kt);t[h]=l}}}}function Pn(i,t){if(typeof i=="string"&&i.length===1)return"___"+i;var e=t.indexOf(i);return e===-1?i:e.toString(36)}function Sn(i,t){return typeof i=="string"&&i.length===1?t[parseInt(i,36)]:typeof i=="string"&&i.substr(0,3)==="___"?i[3]:i}function Xt(i,t,e){return t=In(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function In(i){var t=En(i,"string");return typeof t=="symbol"?t:String(t)}function En(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class te{constructor(t,e){Xt(this,"name",void 0),Xt(this,"origin",void 0),Xt(this,"isPropagationStopped",void 0),this.name=t,this.origin=e,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function jt(i,t,e){return t=Dn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Dn(i){var t=Mn(i,"string");return typeof t=="symbol"?t:String(t)}function Mn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}let On=class extends Y{constructor(t){super(),jt(this,"_layoutManager",void 0),jt(this,"_dontPropagateToParent",void 0),jt(this,"_childEventSource",void 0),jt(this,"_boundOnEventFromChild",void 0),this._layoutManager=t,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Y.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),c(window).on("gl_child_event",this._boundOnEventFromChild)}_onEventFromThis(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];this._layoutManager.isSubWindow&&e[0]!==this._dontPropagateToParent&&this._propagateToParent(e),this._propagateToChildren(e),this._dontPropagateToParent=null,this._childEventSource=null}_$onEventFromParent(t){this._dontPropagateToParent=t[0],this.emit.apply(this,t)}_onEventFromChild(t){this._childEventSource=t.originalEvent.__gl,this.emit.apply(this,t.originalEvent.__glArgs)}_propagateToParent(t){var e,n="gl_child_event",r=(e=window.opener)===null||e===void 0?void 0:e.document.createEvent("HTMLEvents");r.initEvent(n,!0,!0),r.eventName=n,r.__glArgs=t,r.__gl=this._layoutManager,window.opener.dispatchEvent(r)}_propagateToChildren(t){for(var e=0;e<this._layoutManager.openPopouts.length;e++){var n=this._layoutManager.openPopouts[e].getGlInstance();n&&n!==this._childEventSource&&n.eventHub._$onEventFromParent(t)}}destroy(){c(window).off("gl_child_event",this._boundOnEventFromChild)}};const Ke=On,xn=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:te,DragListener:xt,EventEmitter:Y,EventHub:Ke,ReactComponentHandler:Ue,animFrame:se,filterXss:pn,getHashValue:He,getQueryStringParam:ke,getUniqueId:Ht,minifyConfig:le,removeFromArray:vn,stripTags:ae,unminifyConfig:Qt},Symbol.toStringTag,{value:"Module"}));function nt(i,t,e){return t=Tn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Tn(i){var t=An(i,"string");return typeof t=="symbol"?t:String(t)}function An(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Ge extends Y{constructor(t,e,n,r,o){super(),nt(this,"isInitialised",!1),nt(this,"_config",void 0),nt(this,"_dimensions",void 0),nt(this,"_parentId",void 0),nt(this,"_indexInParent",void 0),nt(this,"_layoutManager",void 0),nt(this,"_popoutWindow",null),nt(this,"_id",null),this._config=t,this._dimensions=e,this._parentId=n,this._indexInParent=r,this._layoutManager=o,this._createWindow()}toConfig(){var t,e,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:(t=this.getGlInstance())===null||t===void 0?void 0:t.width,height:(e=this.getGlInstance())===null||e===void 0?void 0:e.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 t;return(t=this._popoutWindow)===null||t===void 0?void 0:t.__glInstance}getWindow(){return this._popoutWindow}close(){if(this.getGlInstance()){var t;(t=this.getGlInstance())===null||t===void 0||t._$closeWindow()}else try{var e;(e=this.getWindow())===null||e===void 0||e.close()}catch{}}popIn(){var t;this._indexInParent;var e=null,n=null;if(this._parentId){var r;if(e=c.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}}e&&((t=n)===null||t===void 0||t.addChild(e,this._indexInParent),this.close())}_createWindow(){var t=this._createUrl(),e=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(t,e,n),!this._popoutWindow)if(this._layoutManager.config.settings.blockedPopoutsThrowError===!0){var r=new Error("Popout blocked");throw r.type="popoutBlocked",r}else return;c(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(t){var e=[],n;for(n in t)e.push(n+"="+t[n]);return e.join(",")}_createUrl(){var t={content:this._config},e="gl-window-config-"+Ht();t=le(t);try{localStorage.setItem(e,JSON.stringify(t))}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="+e:document.location.href+"&gl-window="+e}_positionWindow(){var t,e;(t=this._popoutWindow)===null||t===void 0||t.moveTo(this._dimensions.left,this._dimensions.top),(e=this._popoutWindow)===null||e===void 0||e.focus()}_onInitialised(){var t;this.isInitialised=!0,(t=this.getGlInstance())===null||t===void 0||t.on("popIn",this.popIn,this),this.emit("initialised")}_onClose(){setTimeout(this.emit.bind(this,"closed"),50)}}function T(i,t,e){return t=Ln(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Ln(i){var t=jn(i,"string");return typeof t=="symbol"?t:String(t)}function jn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class mt extends Y{constructor(t,e,n,r,o,s){var a,l,h,d,u,v,f,g;if(super(),T(this,"_dragListener",void 0),T(this,"_layoutManager",void 0),T(this,"_contentItem",void 0),T(this,"_originalParent",void 0),T(this,"_area",null),T(this,"_lastValidArea",null),T(this,"_minX",void 0),T(this,"_maxX",void 0),T(this,"_minY",void 0),T(this,"_maxY",void 0),T(this,"_width",void 0),T(this,"_height",void 0),T(this,"_sided",void 0),T(this,"element",void 0),T(this,"childElementContainer",void 0),T(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 _,x;this._layoutManager.tabDropPlaceholder.width((_=this._contentItem.tab.element.outerWidth(!0))!==null&&_!==void 0?_:0),this._layoutManager.tabDropPlaceholder.height((x=this._contentItem.tab.element.outerHeight(!0))!==null&&x!==void 0?x:0)}if(this.element=c(mt._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:t,top:e}),this._proxyTab=this.element.find(".lm_tab"),this._proxyTab.attr("title",ae((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(),c(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var M,N;this._layoutManager.tabDropPlaceholder.width((M=this._proxyTab.outerWidth(!0))!==null&&M!==void 0?M:0),this._layoutManager.tabDropPlaceholder.height((N=this._proxyTab.outerHeight(!0))!==null&&N!==void 0?N: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=((v=this._layoutManager.container.height())!==null&&v!==void 0?v:0)+this._minY,this._width=(f=this.element.width())!==null&&f!==void 0?f:0,this._height=(g=this.element.height())!==null&&g!==void 0?g:0,this._setDropPosition(t,e),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(t,e,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(t,e){this.element.css({left:t,top:e}),this._area=this._layoutManager._$getArea(t,e),this._area!==null&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(t,e,this._area))}_onDrop(){var t;(t=this._layoutManager.dropTargetIndicator)===null||t===void 0||t.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 t=this._layoutManager.config.dimensions,e=t.dragProxyWidth,n=t.dragProxyHeight;this.element.width(e),this.element.height(n),e-=this._sided?t.headerHeight:0,n-=this._sided?0:t.headerHeight,this.childElementContainer.width(e),this.childElementContainer.height(n),this._contentItem.element.width(e),this._contentItem.element.height(n),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}T(mt,"_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 Rt(i,t,e){return t=Rn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Rn(i){var t=Nn(i,"string");return typeof t=="symbol"?t:String(t)}function Nn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Ye{constructor(t,e,n){Rt(this,"_element",void 0),Rt(this,"_itemConfig",void 0),Rt(this,"_layoutManager",void 0),Rt(this,"_dragListener",void 0),this._element=t,this._itemConfig=e,this._layoutManager=n,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new xt(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this),this._dragListener}_onDragStart(t,e){var n=this._itemConfig;typeof n=="function"&&(n=n());var r=this._layoutManager._$normalizeContentItem(c.extend(!0,{},n));new mt(t,e,this._dragListener,this._layoutManager,r,null)}}function Nt(i,t,e){return t=$n(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function $n(i){var t=Fn(i,"string");return typeof t=="symbol"?t:String(t)}function Fn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Ve{constructor(t,e,n){Nt(this,"_element",c(window)),Nt(this,"_itemConfig",void 0),Nt(this,"_layoutManager",void 0),Nt(this,"_dragListener",void 0),this._itemConfig=t,this._layoutManager=e,this._createDragListener(n)}_createDragListener(t){this._dragListener&&this._dragListener.destroy(),this._element&&(this._dragListener=new xt(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._destroy,this),this._dragListener.onMouseDown(t),this._dragListener._startDrag())}_destroy(){this._dragListener=void 0,this._element=void 0,this._itemConfig=void 0,this._layoutManager=void 0}_onDragStart(t,e){if(!(!this._dragListener||!this._layoutManager)){var n=this._itemConfig;typeof n=="function"&&(n=n());var r=this._layoutManager._$normalizeContentItem(c.extend(!0,{},n));new mt(t,e,this._dragListener,this._layoutManager,r,null)}}}function Xe(i,t,e){return t=Wn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Wn(i){var t=Bn(i,"string");return typeof t=="symbol"?t:String(t)}function Bn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Tt{constructor(){Xe(this,"element",c(Tt._template)),c(document.body).append(this.element)}destroy(){this.element.remove()}highlightArea(t){this.element.css({left:t.x1,top:t.y1,width:Math.floor(t.x2-t.x1),height:Math.floor(t.y2-t.y1)}).show()}hide(){this.element.hide()}}Xe(Tt,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function qt(i,t,e){return t=zn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function zn(i){var t=Hn(i,"string");return typeof t=="symbol"?t:String(t)}function Hn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Et{constructor(t,e,n,r){qt(this,"element",void 0),qt(this,"_header",void 0),qt(this,"_action",void 0),this._header=t,this.element=c('<li class="'+n+'" title="'+e+'"></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 kn(i,t,e){return t=Un(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Un(i){var t=Kn(i,"string");return typeof t=="symbol"?t:String(t)}function Kn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Gn extends Error{constructor(t,e){super(),kn(this,"node",void 0),this.name="Configuration Error",this.message=t,this.node=e}}const ut=Gn,Yn=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:ut},Symbol.toStringTag,{value:"Module"}));function O(i,t,e){return t=Vn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Vn(i){var t=Xn(i,"string");return typeof t=="symbol"?t:String(t)}function Xn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}function ct(i){return i.isStack}function U(i){return i.isComponent}function qe(i){return i.isRoot}class A extends Y{constructor(t,e,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(e),this.type=e.type,this.contentItems=[],this.parent=n,this.layoutManager=t,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(Y.ALL_EVENT,this._propagateEvent,this),e.content&&this._createContentItems(e)}callDownwards(t){var e=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[t].apply(this,e);for(var o=0;o<this.contentItems.length;o++)this.contentItems[o].callDownwards(t,e,n);n===!0&&r!==!0&&this[t].apply(this,e)}removeChild(t){var e,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=this.contentItems.indexOf(t);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),(e=this.config.content)===null||e===void 0||e.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(t,e){t=this.layoutManager._$normalizeContentItem(t,this),e===void 0&&(e=this.contentItems.length),this.contentItems.splice(e,0,t),this.config.content===void 0&&(this.config.content=[]),this.config.content.splice(e,0,t.config),t.parent=this,t.parent.isInitialised===!0&&t.isInitialised===!1&&t._$init()}replaceChild(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;e=this.layoutManager._$normalizeContentItem(e);var r=this.contentItems.indexOf(t),o=t.element[0].parentNode;if(r===-1)throw new Error("Can't replace child. oldChild is not child of this");o==null||o.replaceChild(e.element[0],t.element[0]),n===!0&&(t.parent=null,t._$destroy()),this.contentItems[r]=e,e.parent=this,ct(this)&&(this.header.tabs[r].contentItem=e),e.parent.isInitialised===!0&&e.isInitialised===!1&&e._$init(),this.callDownwards("setSize")}remove(){var t;(t=this.parent)===null||t===void 0||t.removeChild(this)}popout(){var t=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),t}toggleMaximise(t){t&&t.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(t){this.config.title=t,this.emit("titleChanged",t),this.emitBubblingEvent("stateChanged")}hasId(t){if(this.config.id){if(typeof this.config.id=="string")return this.config.id===t;if(this.config.id instanceof Array)return this.config.id.indexOf(t)!==-1}else return!1}addId(t){this.hasId(t)||(this.config.id?typeof this.config.id=="string"?this.config.id=[this.config.id,t]:this.config.id instanceof Array&&this.config.id.push(t):this.config.id=t)}removeId(t){if(!this.hasId(t))throw new Error("Id not found");if(typeof this.config.id=="string")delete this.config.id;else if(this.config.id instanceof Array){var e=this.config.id.indexOf(t);this.config.id.splice(e,1)}}getItemsByFilter(t){var e=[],n=function r(o){for(var s=0;s<o.contentItems.length;s++)t(o.contentItems[s])===!0&&e.push(o.contentItems[s]),r(o.contentItems[s])};return n(this),e}getItemsById(t){return this.getItemsByFilter(function(e){return e.config.id instanceof Array?e.config.id.indexOf(t)!==-1:e.config.id===t})}getItemsByType(t){return this._$getItemsByProperty("type",t)}getComponentsByName(t){for(var e=this._$getItemsByProperty("componentName",t),n=[],r=0;r<e.length;r++)n.push(e[r].instance);return n}_$getItemsByProperty(t,e){return this.getItemsByFilter(function(n){return n[t]===e})}_$setParent(t){this.parent=t}_$highlightDropZone(t,e,n){var r;(r=this.layoutManager.dropTargetIndicator)===null||r===void 0||r.highlightArea(n)}_$onDrop(t,e){this.addChild(t)}_$hide(){this._callOnActiveComponents("hide"),this.element.hide(),this.layoutManager.updateSize()}_$show(){this._callOnActiveComponents("show"),this.element.show(),this.layoutManager.updateSize()}_callOnActiveComponents(t){for(var e=this.getItemsByType("stack"),n=null,r=0;r<e.length;r++)n=e[r].getActiveContentItem(),n&&U(n)&&n.container[t]()}_$destroy(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")}_$getArea(t){var e,n,r;t=t||this.element;var o=(e=t.offset())!==null&&e!==void 0?e:{left:0,top:0},s=(n=t.width())!==null&&n!==void 0?n:0,a=(r=t.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 t=0;t<this.contentItems.length;t++){var e;(e=this.childElementContainer)===null||e===void 0||e.append(this.contentItems[t].element)}this.isInitialised=!0,this.emitBubblingEvent("itemCreated"),this.emitBubblingEvent(this.type+"Created")}emitBubblingEvent(t){var e=new te(t,this);this.emit(t,e)}_createContentItems(t){var e;if(!(t.content instanceof Array))throw new ut("content must be an Array",t);for(var n=0;n<t.content.length;n++)e=this.layoutManager.createContentItem(t.content[n],this),this.contentItems.push(e)}_extendItemNode(t){for(var[e,n]of Object.entries(ze)){var r=e;t[r]===void 0&&(t[r]=n)}return t}_propagateEvent(t,e){e instanceof te&&e.isPropagationStopped===!1&&this.isInitialised===!0&&(this.isRoot===!1&&this.parent?this.parent.emit.apply(this.parent,[t,e]):this._scheduleEventPropagationToLayoutManager(t,e))}_scheduleEventPropagationToLayoutManager(t,e){this._throttledEvents.indexOf(t)===-1?this.layoutManager.emit(t,e.origin):this._pendingEventPropagations[t]!==!0&&(this._pendingEventPropagations[t]=!0,se(this._propagateEventToLayoutManager.bind(this,t,e)))}_propagateEventToLayoutManager(t,e){this._pendingEventPropagations[t]=!1,this.layoutManager.emit(t,e)}}function Pt(i,t,e){return t=qn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function qn(i){var t=Zn(i,"string");return typeof t=="symbol"?t:String(t)}function Zn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Ze extends A{constructor(t,e,n){var r;Object.entries((r=t.config.settings.defaultComponentConfig)!==null&&r!==void 0?r:{}).forEach(a=>{var[l,h]=a;e[l]===void 0&&(e[l]=h)}),super(t,e,n,c()),Pt(this,"config",void 0),Pt(this,"componentName",void 0),Pt(this,"container",void 0),Pt(this,"parent",void 0),Pt(this,"instance",void 0),this.config=e,this.parent=n;var o=t.getComponent(this.config.componentName)||t.getFallbackComponent(),s=c.extend(!0,{},this.config.componentState||{});if(o==null)throw new ut('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 Jt(this.config,this,t),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(){A.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),A.prototype._$hide.call(this)}_$show(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),A.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),A.prototype._$destroy.call(this)}_$getArea(){return null}}function H(i,t,e){return t=Jn(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Jn(i){var t=Qn(i,"string");return typeof t=="symbol"?t:String(t)}function Qn(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Ut extends A{constructor(t,e,n,r){super(e,n,r,c('<div class="lm_item lm_'+(t?"column":"row")+'"></div>')),H(this,"isRow",void 0),H(this,"isColumn",void 0),H(this,"childElementContainer",void 0),H(this,"parent",void 0),H(this,"_splitter",[]),H(this,"_splitterSize",void 0),H(this,"_splitterGrabSize",void 0),H(this,"_isColumn",void 0),H(this,"_dimension",void 0),H(this,"_splitterPosition",null),H(this,"_splitterMinPosition",null),H(this,"_splitterMaxPosition",null),this.parent=r,this.isRow=!t,this.isColumn=t,this.childElementContainer=this.element,this._splitterSize=e.config.dimensions.borderWidth,this._splitterGrabSize=e.config.dimensions.borderGrabWidth,this._isColumn=t,this._dimension=t?"height":"width",this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null}addChild(t,e,n){var r,o,s,a;if(t=this.layoutManager._$normalizeContentItem(t,this),e===void 0&&(e=this.contentItems.length),this.contentItems.length>0?(a=this._createSplitter(Math.max(0,e-1)).element,e>0?(this.contentItems[e-1].element.after(a),a.after(t.element)):(this.contentItems[0].element.before(a),a.before(t.element))):this.childElementContainer.append(t.element),A.prototype.addChild.call(this,t,e),r=1/this.contentItems.length*100,n===!0){this.emitBubblingEvent("stateChanged");return}for(s=0;s<this.contentItems.length;s++)if(this.contentItems[s]===t)t.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(t,e){var n,r=(n=t.config[this._dimension])!==null&&n!==void 0?n:0,o=this.contentItems.indexOf(t),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]!==t){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)}A.prototype.removeChild.call(this,t,e),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(t,e){var n=t.config[this._dimension];super.replaceChild(t,e),e.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 t;for(A.prototype._$init.call(this),t=0;t<this.contentItems.length-1;t++)this.contentItems[t].element.after(this._createSplitter(t).element)}}_setAbsoluteSizes(){var t,e=this._calculateAbsoluteSizes();for(t=0;t<this.contentItems.length;t++)e.additionalPixel-t>0&&e.itemSizes[t]++,this._isColumn?(this.contentItems[t].element.width(e.totalWidth),this.contentItems[t].element.height(e.itemSizes[t])):(this.contentItems[t].element.width(e.itemSizes[t]),this.contentItems[t].element.height(e.totalHeight))}_calculateAbsoluteSizes(){var t,e,n=(this.contentItems.length-1)*this._splitterSize,r=(t=this.element.width())!==null&&t!==void 0?t:0,o=(e=this.element.height())!==null&&e!==void 0?e: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 v=Math.floor((this._isColumn?o:r)-s);return{itemSizes:a,additionalPixel:v,totalWidth:r,totalHeight:o}}_calculateRelativeSizes(){for(var t=0,e=[],n=this._isColumn?"height":"width",r=0;r<this.contentItems.length;r++){var o=this.contentItems[r].config[n];o!=null?t+=o:e.push(this.contentItems[r])}if(Math.round(t)===100){this._respectMinItemWidth();return}if(Math.round(t)<100&&e.length>0){for(var s=0;s<e.length;s++)e[s].config[n]=(100-t)/e.length;this._respectMinItemWidth();return}if(Math.round(t)>100)for(var a=0;a<e.length;a++)e[a].config[n]=50,t+=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)/t*100}this._respectMinItemWidth()}_respectMinItemWidth(){var t,e=this.layoutManager.config.dimensions&&(t=this.layoutManager.config.dimensions.minItemWidth)!==null&&t!==void 0?t:0,n=[],r=0,o=0,s=0,a=[],l;if(!(this._isColumn||!e||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<e?(o+=e-u,l={width:e}):(r+=u-e,l={width:u},n.push(l)),a.push(l)}if(!(o===0||o>r)){var v=o/r;s=o;for(var f=0;f<n.length;f++){l=n[f];var g=Math.round((l.width-e)*v);s-=g,l.width-=g}s!==0&&(a[a.length-1].width-=s);for(var _=0;_<this.contentItems.length;_++)this.contentItems[_].config.width=a[_].width/h.totalWidth*100}}}_createSplitter(t){var e;return e=new Je(this._isColumn,this._splitterSize,this._splitterGrabSize),e.on("drag",this._onSplitterDrag.bind(this,e),this),e.on("dragStop",this._onSplitterDragStop.bind(this,e),this),e.on("dragStart",this._onSplitterDragStart.bind(this,e),this),this._splitter.splice(t,0,e),e}_getItemsForSplitter(t){var e=this._splitter.indexOf(t);if(e<0)throw new Error("Splitter not found in RowOrColumn");return{before:this.contentItems[e],after:this.contentItems[e+1]}}_getMinimumDimensions(t){for(var e=0,n=0,r=0;r<t.length;++r){var o,s;e=Math.max((o=t[r].minWidth)!==null&&o!==void 0?o:0,e),n=Math.max((s=t[r].minHeight)!==null&&s!==void 0?s:0,n)}return{horizontal:e,vertical:n}}_onSplitterDragStart(t){var e,n,r,o,s=this._getItemsForSplitter(t),a=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((e=s.before.config.content)!==null&&e!==void 0?e:[]),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(t,e,n){var r=this._isColumn?n:e;this._splitterMaxPosition==null||this._splitterMinPosition==null||r>this._splitterMinPosition&&r<this._splitterMaxPosition&&(this._splitterPosition=r,t.element.css(this._isColumn?"top":"left",r))}_onSplitterDragStop(t){var e,n,r,o,s,a=this._getItemsForSplitter(t),l=(e=a.before.element[this._dimension]())!==null&&e!==void 0?e: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,t.element.css({top:0,left:0}),se(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function ye(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function we(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?ye(Object(e),!0).forEach(function(n){ee(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):ye(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function ee(i,t,e){return t=tr(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function tr(i){var t=er(i,"string");return typeof t=="symbol"?t:String(t)}function er(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class ie extends A{constructor(t,e,n){super(t,we(we({},e),{},{type:"root"}),null,c('<div class="lm_goldenlayout lm_item lm_root"></div>')),ee(this,"childElementContainer",void 0),ee(this,"_containerElement",void 0),this.isRoot=!0,this.type="root",this.childElementContainer=this.element,this._containerElement=n,this._containerElement.append(this.element)}addChild(t,e){if(this.contentItems.length>0)throw new Error("Root node can only have a single child");t=this.layoutManager._$normalizeContentItem(t,this),this.childElementContainer.append(t.element),super.addChild(t,e),this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(t,e){var n,r;t=typeof t>"u"?(n=this._containerElement.width())!==null&&n!==void 0?n:0:t,e=typeof e>"u"?(r=this._containerElement.height())!==null&&r!==void 0?r:0:e,this.element.width(t),this.element.height(e),this.contentItems[0]&&(this.contentItems[0].element.width(t),this.contentItems[0].element.height(e))}_$getArea(){var t=super._$getArea();if(t==null)throw new Error("Unable to get root area");return t}_$highlightDropZone(t,e,n){this.layoutManager.tabDropPlaceholder.remove(),super._$highlightDropZone(t,e,n)}_$onDrop(t,e){var n;if(U(t)&&(n=this.layoutManager.createContentItem({type:"stack",header:t.config.header||{}},this),n._$init(),n.addChild(t),t=n),!this.contentItems.length)this.addChild(t);else{var{side:r}=e,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 Ut)||l.type!=o){var h=this.layoutManager.createContentItem({type:o},this);this.replaceChild(l,h),h.addChild(t,a?0:void 0,!0),h.addChild(l,a?void 0:0,!0),l.config[s]=50,t.config[s]=50,h.callDownwards("setSize")}else{var d,u=l.contentItems[a?0:l.contentItems.length-1];l.addChild(t,a?0:void 0,!0),u.config[s]=((d=u.config[s])!==null&&d!==void 0?d:0)*.5,t.config[s]=u.config[s],l.callDownwards("setSize")}}}}function Ce(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function pt(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Ce(Object(e),!0).forEach(function(n){F(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):Ce(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function F(i,t,e){return t=ir(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function ir(i){var t=nr(i,"string");return typeof t=="symbol"?t:String(t)}function nr(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class ne extends A{constructor(t,e,n){var r,o,s,a,l,h,d,u,v;super(t,e,n,c('<div class="lm_item lm_stack"></div>')),F(this,"_activeContentItem",null),F(this,"_header",void 0),F(this,"childElementContainer",c('<div class="lm_items"></div>')),F(this,"header",void 0),F(this,"parent",void 0),F(this,"isStack",!0),F(this,"_dropZones",{}),F(this,"_dropSegment",null),F(this,"_contentAreaDimensions",null),F(this,"_dropIndex",void 0),F(this,"_side",void 0),F(this,"_sided",!1),F(this,"config",void 0),this.parent=n,this.config=e;var f=t.config;this._side=!1,this._header={show:((r=f.settings)===null||r===void 0?void 0:r.hasHeaders)&&e.hasHeaders!==!1,popout:(o=f.settings)!==null&&o!==void 0&&o.showPopoutIcon?(s=f.labels)===null||s===void 0?void 0:s.popout:void 0,maximise:(a=f.settings)!==null&&a!==void 0&&a.showMaximiseIcon?(l=f.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(h=f.settings)!==null&&h!==void 0&&h.showCloseIcon?(d=f.labels)===null||d===void 0?void 0:d.close:void 0,minimise:(u=(v=f.labels)===null||v===void 0?void 0:v.minimise)!==null&&u!==void 0?u:void 0},f.header&&(this._header=pt(pt({},this._header),f.header)),e.header&&(this._header=pt(pt({},this._header),e.header)),e.content&&e.content[0]&&e.content[0].header&&(this._header=pt(pt({},this._header),e.content[0].header)),this.header=new et(t,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var t,e,n,r,o,s=this._header.show&&(t=(e=this.layoutManager.config.dimensions)===null||e===void 0?void 0:e.headerHeight)!==null&&t!==void 0?t: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 t=0;t<this.contentItems.length;t++)this.header.createTab(this.contentItems[t]),this.contentItems[t]._$hide();if(this.contentItems.length>0){var e=this.contentItems[this.config.activeItemIndex||0];if(!e)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(e)}}}setActiveContentItem(t){if(this.contentItems.indexOf(t)===-1)throw new Error("contentItem is not a child of this stack");this._activeContentItem!==null&&this._activeContentItem._$hide(),this._activeContentItem=t,this.header.setActiveContentItem(t),t._$show(),this.emit("activeContentItemChanged",t),this.layoutManager.emit("activeContentItemChanged",t),this.emitBubblingEvent("stateChanged")}getActiveContentItem(){return this.header.activeContentItem}addChild(t,e){t=this.layoutManager._$normalizeContentItem(t,this),super.addChild(t,e),this.childElementContainer.append(t.element),this.header.createTab(t,e),this.setActiveContentItem(t),this.callDownwards("setSize"),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}removeChild(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.contentItems.indexOf(t);super.removeChild(t,e),this.header.removeTab(t),this.header.activeContentItem===t&&(this.contentItems.length>0?this.setActiveContentItem(this.contentItems[Math.max(n-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}_$validateClosability(){for(var t=this.header._isClosable(),e=0,n=this.contentItems.length;e<n;e++){var r;if(!t)break;t=(r=this.contentItems[e].config.isClosable)!==null&&r!==void 0?r:!1}this.header._$setClosable(t)}_$destroy(){A.prototype._$destroy.call(this),this.header._$destroy()}_$onDrop(t){if(this._dropSegment==="header"){this._resetHeaderDropZone(),this.addChild(t,this._dropIndex);return}if(this._dropSegment==="body"){this.addChild(t);return}var e=this._dropSegment==="top"||this._dropSegment==="bottom",n=this._dropSegment==="left"||this._dropSegment==="right",r=this._dropSegment==="top"||this._dropSegment==="left",o=e&&this.parent.isColumn||n&&this.parent.isRow,s=e?"column":"row",a=e?"height":"width";if(U(t)){var l=this.layoutManager.createContentItem({type:"stack",header:t.config.header||{}},this);l._$init(),l.addChild(t),t=l}if(o){var h,d=this.parent.contentItems.indexOf(this);this.parent.addChild(t,r?d:d+1,!0),this.config[a]=((h=this.config[a])!==null&&h!==void 0?h:0)*.5,t.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(t,r?0:void 0,!0),u.addChild(this,r?void 0:0,!0),this.config[a]=50,t.config[a]=50,u.callDownwards("setSize")}}_$highlightDropZone(t,e){if(this._contentAreaDimensions)for(var[n,r]of Object.entries(this._contentAreaDimensions)){var o=r.hoverArea;if(o.x1<t&&o.x2>t&&o.y1<e&&o.y2>e){n==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(t)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(n));return}}}_$getArea(){if(this.element.is(":visible")===!1)return null;var t=super._$getArea(this.header.element),e=super._$getArea(this.childElementContainer);if(t==null||e==null)return null;var n=e.x2-e.x1,r=e.y2-e.y1;return this._contentAreaDimensions={header:{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}}},this._activeContentItem&&this._activeContentItem.isComponent===!1?t:this.contentItems.length===0?(this._contentAreaDimensions.body={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}},super._$getArea(this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:e.x1,y1:e.y1,x2:e.x1+n*.25,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x1+n*.5,y2:e.y2}},this._contentAreaDimensions.top={hoverArea:{x1:e.x1+n*.25,y1:e.y1,x2:e.x1+n*.75,y2:e.y1+r*.5},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y1+r*.5}},this._contentAreaDimensions.right={hoverArea:{x1:e.x1+n*.75,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1+n*.5,y1:e.y1,x2:e.x2,y2:e.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:e.x1+n*.25,y1:e.y1+r*.5,x2:e.x1+n*.75,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1+r*.5,x2:e.x2,y2:e.y2}},super._$getArea(this.element))}_highlightHeaderDropZone(t){var e,n,r,o,s,a,l,h,d,u,v,f,g,_,x,M,N=this.header.tabs.length;if(N===0){var P,q,W,at,L,j,R,lt,B=this.header.element.offset();(P=this.layoutManager.dropTargetIndicator)===null||P===void 0||P.highlightArea({x1:(q=B==null?void 0:B.left)!==null&&q!==void 0?q:0,x2:((W=B==null?void 0:B.left)!==null&&W!==void 0?W:0)+100,y1:(at=(L=this.header.element.offset())===null||L===void 0?void 0:L.top)!==null&&at!==void 0?at:0,y2:((j=(R=this.header.element.offset())===null||R===void 0?void 0:R.top)!==null&&j!==void 0?j:0)+((lt=this.header.element.innerHeight())!==null&&lt!==void 0?lt:0)});return}var it=this.header.tabsContainer,V=(e=it.get(0))===null||e===void 0?void 0:e.getBoundingClientRect(),X=(n=this.layoutManager.tabDropPlaceholder.get(0))===null||n===void 0?void 0:n.getBoundingClientRect();if(!(!V||!X)){t<V.left?t=V.left+1:t>V.right&&(t=V.right-1);var K,Z;if(!(X.left<t&&t<X.right)){for(var ft=0;ft<N;ft++){var wt;if(K=this.header.tabs[ft].element,Z=(wt=K.get(0))===null||wt===void 0?void 0:wt.getBoundingClientRect(),Z&&Z.left<t&&t<Z.right){this._dropIndex=ft;break}}if(K&&Z&&t<Z.left+Z.width*.5)K.before(this.layoutManager.tabDropPlaceholder);else if(K){var Ct;this._dropIndex=Math.min(((Ct=this._dropIndex)!==null&&Ct!==void 0?Ct:0)+1,N),K.after(this.layoutManager.tabDropPlaceholder)}}var ht=(r=(o=this.layoutManager.tabDropPlaceholder.offset())===null||o===void 0?void 0:o.left)!==null&&r!==void 0?r:0;ht=Math.max(ht,(s=(a=this.header.tabsContainer.offset())===null||a===void 0?void 0:a.left)!==null&&s!==void 0?s:0);var p=ht+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);p=Math.min(p,((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)),(v=this.layoutManager.dropTargetIndicator)===null||v===void 0||v.highlightArea({x1:ht,x2:p,y1:(f=(g=this.header.element.offset())===null||g===void 0?void 0:g.top)!==null&&f!==void 0?f:0,y2:((_=(x=this.header.element.offset())===null||x===void 0?void 0:x.top)!==null&&_!==void 0?_:0)+((M=this.header.element.innerHeight())!==null&&M!==void 0?M:0)})}}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){var t=["right","left","bottom"].some(n=>n===this._header.show)?this._header.show:void 0;if(this.header.element.toggle(!!this._header.show),!!t&&(this._side=t,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 e=["right","bottom"].indexOf(this._side.toString())>=0?"before":"after";this.header.element[e](this.childElementContainer),this.callDownwards("setSize")}}_highlightBodyDropZone(t){var e,n,r=(e=this._contentAreaDimensions)===null||e===void 0||(n=e[t])===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=t}}const rr=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:A,Component:Ze,ContentItem:A,Root:ie,RowOrColumn:Ut,Stack:ne,isComponent:U,isRoot:qe,isStack:ct},Symbol.toStringTag,{value:"Module"}));function Q(i,t,e){return t=or(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function or(i){var t=sr(i,"string");return typeof t=="symbol"?t:String(t)}function sr(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class At{constructor(t,e){var n;Q(this,"header",void 0),Q(this,"contentItem",void 0),Q(this,"element",c(At._template)),Q(this,"titleElement",void 0),Q(this,"closeElement",void 0),Q(this,"isActive",!1),Q(this,"_layoutManager",void 0),Q(this,"_dragListener",void 0),this.header=t,this.contentItem=e,this.titleElement=this.element.find(".lm_title"),this.closeElement=this.element.find(".lm_close_tab"),this.closeElement[e.config.isClosable?"show":"hide"](),this.setTitle(e.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&&e.config.reorderEnabled&&(this._dragListener=new xt(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 t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";this.titleElement.html(t)}setActive(t){t!==this.isActive&&(this.isActive=t,t?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(t,e){var n;(n=this.contentItem.parent)!==null&&n!==void 0&&n.isMaximised&&this.contentItem.parent.toggleMaximise(),this._dragListener&&new mt(t,e,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(){c(".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(t){if(!t||t.button===0){var e,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",t),this.header._hideAdditionalTabsDropdown(),(e=this.element.get(0))===null||e===void 0||e.scrollIntoView({inline:"nearest"})}else t.button===1&&this.contentItem.config.isClosable&&this._onCloseClick(t)}_onCloseClick(t){t.stopPropagation(),U(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onCloseMousedown(t){t.stopPropagation()}}Q(At,"_template",['<li class="lm_tab">','<span class="lm_title_before"></span>','<span class="lm_title"></span>','<div class="lm_close_tab" aria-label="Close tab"></div>',"</li>"].join(""));function y(i,t,e){return t=ar(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function ar(i){var t=lr(i,"string");return typeof t=="symbol"?t:String(t)}function lr(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class et extends Y{constructor(t,e){var n,r;super(),y(this,"layoutManager",void 0),y(this,"element",c(et._template)),y(this,"tabsContainer",void 0),y(this,"tabDropdownContainer",void 0),y(this,"tabDropdownSearch",void 0),y(this,"tabDropdownList",null),y(this,"controlsContainer",void 0),y(this,"parent",void 0),y(this,"tabs",[]),y(this,"activeContentItem",null),y(this,"closeButton",null),y(this,"tabDropdownButton",null),y(this,"tabNextButton",c(et._nextButtonTemplate)),y(this,"tabPreviousButton",c(et._previousButtonTemplate)),y(this,"holdTimer",null),y(this,"rAF",null),y(this,"CLICK_TIMEOUT",500),y(this,"START_SPEED",.01),y(this,"ACCELERATION",5e-4),y(this,"PADDING",10),y(this,"SCROLL_LEFT","left"),y(this,"SCROLL_RIGHT","right"),y(this,"isDraggingTab",!1),y(this,"isOverflowing",!1),y(this,"isDropdownShown",!1),y(this,"dropdownKeyIndex",0),y(this,"_lastVisibleTabIndex",-1),y(this,"_tabControlOffset",void 0),this.layoutManager=t,(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=e,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(t,e){for(var n=0;n<this.tabs.length;n++)if(this.tabs[n].contentItem===t)return;var r=new At(this,t);if(this.tabs.length===0){this.tabs.push(r),this.tabsContainer.append(r.element);return}e===void 0&&(e=this.tabs.length),e>0?this.tabs[e-1].element.after(r.element):this.tabs[0].element.before(r.element),this.tabs.splice(e,0,r),this._updateTabSizes()}removeTab(t){for(var e=0;e<this.tabs.length;e++)if(this.tabs[e].contentItem===t){this.tabs[e]._$destroy(),this.tabs.splice(e,1);return}throw new Error("contentItem is not controlled by this header")}setActiveContentItem(t){for(var e,n,r,o,s=0;s<this.tabs.length;s++)o=this.tabs[s].contentItem===t,this.tabs[s].setActive(o),o===!0&&(this.activeContentItem=t,this.parent.config.activeItemIndex=s);(e=this.tabs[(r=this.parent.config.activeItemIndex)!==null&&r!==void 0?r:0].element.get(0))===null||e===void 0||(n=e.scrollIntoView)===null||n===void 0||n.call(e,{inline:"nearest"}),this._hideAdditionalTabsDropdown(),this._updateTabSizes(),this.parent.emitBubblingEvent("stateChanged")}position(t){var e=this.parent._header.show;return e&&!this.parent._side&&(e="top"),t!==void 0&&this.parent._header.show!==t&&(this.parent._header.show=t,this.parent._setupHeaderPosition()),e}_attachWheelListener(){var t;(t=this.tabsContainer.get(0))===null||t===void 0||t.addEventListener("wheel",this._handleWheelEvent,{passive:!0})}_detachWheelListener(){var t;(t=this.tabsContainer.get(0))===null||t===void 0||t.removeEventListener("wheel",this._handleWheelEvent)}_handleWheelEvent(t){var e=t.currentTarget;if(e instanceof HTMLElement){var n=Math.abs(t.deltaY)>Math.abs(t.deltaX)?t.deltaY:t.deltaX;if(t.deltaMode===WheelEvent.DOM_DELTA_PAGE){var r;n*=(r=this.tabsContainer.innerWidth())!==null&&r!==void 0?r:1}else t.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=100/3);e.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 t;this.isDraggingTab=!1,window.cancelAnimationFrame((t=this.rAF)!==null&&t!==void 0?t:-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 t;this.controlsContainer.on("mouseleave",this._handleNextMouseLeave),this._handleScrollRepeat(this.SCROLL_RIGHT,(t=this.tabsContainer.scrollLeft())!==null&&t!==void 0?t:0)}_handlePreviousMouseEnter(){var t;this.tabPreviousButton.on("mouseleave",this._handlePreviousMouseLeave),this._handleScrollRepeat(this.SCROLL_LEFT,(t=this.tabsContainer.scrollLeft())!==null&&t!==void 0?t:0)}_handleNextMouseLeave(){var t;window.cancelAnimationFrame((t=this.rAF)!==null&&t!==void 0?t:-1),this.rAF=null,this.controlsContainer.off("mouseleave",this._handleNextMouseLeave)}_handlePreviousMouseLeave(){var t;window.cancelAnimationFrame((t=this.rAF)!==null&&t!==void 0?t:-1),this.rAF=null,this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextButtonMouseDown(){for(var t,e=0;e<this.tabs.length;e+=1){var n,r,o,s,a;if(((n=(r=this.tabs[e].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)){t=this.tabs[e].element.get(0);break}}if(t)t.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 t,e=this.tabs.length-1;e>=0;e-=1){var n,r,o;if(((n=(r=this.tabs[e].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)){t=this.tabs[e].element.get(0);break}}if(t)t.scrollIntoView({behavior:"smooth",inline:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT);else{var s=this.tabsContainer.get(0);s&&(s.scrollLeft=0)}}_handleScrollButtonMouseDown(t){this.holdTimer=window.setTimeout(()=>{var e;this._handleScrollRepeat(t,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0,100)},this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)}_handleScrollButtonMouseUp(){var t,e;clearTimeout((t=this.holdTimer)!==null&&t!==void 0?t:-1),this.holdTimer=null,cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)}_checkScrollArrows(){var t,e,n;this.tabsContainer.scrollLeft()===0?this.tabPreviousButton.first().prop("disabled",!0):((t=this.tabsContainer.scrollLeft())!==null&&t!==void 0?t:0)+((e=this.tabsContainer.innerWidth())!==null&&e!==void 0?e: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(t,e){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(t===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(e-r),this.isDraggingTab&&this.parent._highlightHeaderDropZone(a.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(t===this.SCROLL_RIGHT){var l,h;if(this.tabsContainer.scrollLeft(e+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,v,f=o||d,g=d-f,_=this.START_SPEED*g+.5*this.ACCELERATION*(g*g);_=Math.min(_,(u=(v=this.tabsContainer.get(0))===null||v===void 0?void 0:v.scrollWidth)!==null&&u!==void 0?u:1/0),this._handleScrollRepeat(t,e,_,f)})}}_$setClosable(t){return this.closeButton&&this._isClosable()?(this.closeButton.element[t?"show":"hide"](),!0):!1}_$destroy(){this.emit("destroy",this);for(var t=0;t<this.tabs.length;t++)this.tabs[t]._$destroy();this._detachWheelListener(),this._handleItemDropped(),c(document).off("mouseup",this._hideAdditionalTabsDropdown),this.tabDropdownSearch.off("input",this._handleFilterInput),this.tabDropdownSearch.off("keydown",this._handleFilterKeydown),this.element.remove()}_getHeaderSetting(t){if(t in this.parent._header)return this.parent._header[t]}_createControls(){var t,e,n,r,o;if(o=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new Et(this,o,"lm_tabdropdown",this._showAdditionalTabsDropdown),this.tabDropdownButton.element.hide(),this.controlsContainer.prepend(this.tabNextButton),this.tabNextButton.hide(),this._getHeaderSetting("popout")&&(e=this._onPopoutClick.bind(this),n=this._getHeaderSetting("popout"),new Et(this,n,"lm_popout",e)),this._getHeaderSetting("maximise")){r=this.parent.toggleMaximise.bind(this.parent);var s=this._getHeaderSetting("maximise"),a=this._getHeaderSetting("minimise"),l=new Et(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()&&(t=this.parent.remove.bind(this.parent),n=this._getHeaderSetting("close"),this.closeButton=new Et(this,n,"lm_close",t))}_showAdditionalTabsDropdown(){if(this.isDropdownShown){this._hideAdditionalTabsDropdown();return}this.tabDropdownList=this.tabsContainer.clone(!0).appendTo(this.tabDropdownContainer).children().removeClass("lm_active"),c(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"),c(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown()}_handleFilterKeydown(t){if(t.key==="Escape"){this._hideAdditionalTabsDropdown();return}if(this.dropdownKeyIndex===-1)return;if(t.key==="Enter"||t.key===" "){this._hideAdditionalTabsDropdown(),this.tabs[this.dropdownKeyIndex]._onTabClick();return}function e(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(t.key==="ArrowDown"||t.key==="Tab"&&t.shiftKey===!1){var n,r;t.preventDefault(),(n=this.tabDropdownList)===null||n===void 0||n.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=e(this.dropdownKeyIndex,1,this.tabDropdownList),(r=this.tabDropdownList)===null||r===void 0||r.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}else if(t.key==="ArrowUp"||t.key==="Tab"){var o,s;t.preventDefault(),(o=this.tabDropdownList)===null||o===void 0||o.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=e(this.dropdownKeyIndex,-1,this.tabDropdownList),(s=this.tabDropdownList)===null||s===void 0||s.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_handleFilterInput(t){if(this.tabDropdownList!=null){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var e=0;e<this.tabDropdownList.length;e++){var n,r;((n=(r=this.tabs[e].contentItem.config.title)===null||r===void 0?void 0:r.toLowerCase().indexOf(t.target.value.toLowerCase()))!==null&&n!==void 0?n:-1)!==-1?(this.tabDropdownList.eq(e).css("display",""),this.dropdownKeyIndex===-1&&(this.dropdownKeyIndex=e)):this.tabDropdownList.eq(e).css("display","none")}this.dropdownKeyIndex!==-1&&this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_hideAdditionalTabsDropdown(t){var e,n;this.isDropdownShown&&(t&&(e=this.tabDropdownContainer.get(0))!==null&&e!==void 0&&e.contains(t.target)||t&&((n=this.tabDropdownButton)===null||n===void 0?void 0:n.element.get(0))===t.target||(this.element.removeClass("lm_dropdown_open"),this.tabDropdownContainer.hide(),this.isDropdownShown=!1,this.element.append(this.tabDropdownContainer),this.tabDropdownContainer.find(".lm_tabs").remove(),c(document).off("mousedown",this._hideAdditionalTabsDropdown)))}_updateAdditionalTabsDropdown(){var t,e,n,r;if(this.isDropdownShown&&!(!this.tabDropdownList||this.tabDropdownList.length==0)){var o=(t=(e=this.tabDropdownContainer.get(0))===null||e===void 0?void 0:e.scrollHeight)!==null&&t!==void 0?t:0;if(o!==0){var s=this.tabDropdownContainer[0].getBoundingClientRect(),a=(n=c(window).height())!==null&&n!==void 0?n:0,l=(r=c(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,v=Math.min(h.left+(u?h.width:0),l-s.width-this.PADDING),f=u?Math.max(h.top-o,this.PADDING):h.bottom,g=a-f-this.PADDING;this.tabDropdownContainer.css({"max-height":g,top:f,left:v})}}}}_isClosable(){return!!(this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon)}_onPopoutClick(){if(this.layoutManager.config.settings.popoutWholeStack===!0)this.parent.popout();else{var t;(t=this.activeContentItem)===null||t===void 0||t.popout()}}_onHeaderClick(t){t.target===this.element[0]&&this.parent.select()}_updateTabSizes(){if(this.tabs.length!==0){var t=this.tabsContainer.get(0);if(this.isDropdownShown&&this._updateAdditionalTabsDropdown(),!!t){if(!this.isOverflowing&&t.scrollWidth>t.clientWidth){var e;(e=this.tabDropdownButton)===null||e===void 0||e.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0}else if(this.isOverflowing&&t.scrollWidth<=t.clientWidth){var n;(n=this.tabDropdownButton)===null||n===void 0||n.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1}this.isOverflowing&&this._checkScrollArrows()}}}}y(et,"_template",['<div class="lm_header">','<ul class="lm_tabs"></ul>','<ul class="lm_controls"></ul>','<ul class="lm_tabdropdown_list">','<li class="lm_tabdropdown_search"><input type="text" placeholder="Find tab..."></li>',"</ul>","</div>"].join(""));y(et,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));y(et,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function St(i,t,e){return t=hr(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function hr(i){var t=dr(i,"string");return typeof t=="symbol"?t:String(t)}function dr(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Je{constructor(t,e,n){St(this,"_isVertical",void 0),St(this,"_size",void 0),St(this,"_grabSize",void 0),St(this,"_dragListener",void 0),St(this,"element",void 0),this._isVertical=t,this._size=e,this._grabSize=n<e?e:n,this.element=this._createElement(),this._dragListener=new xt(this.element)}on(t,e,n){var r;(r=this._dragListener)===null||r===void 0||r.on(t,e,n)}_$destroy(){var t;(t=this._dragListener)===null||t===void 0||t.destroy(),this._dragListener=null,this.element.remove()}_createElement(){var t=c('<div class="lm_drag_handle"></div>'),e=c('<div class="lm_splitter"></div>');e.append(t);var n=this._grabSize-this._size,r=n/2;return this._isVertical?(t.css("top",-r),t.css("height",this._size+n),e.addClass("lm_vertical"),e.height(this._size)):(t.css("left",-r),t.css("width",this._size+n),e.addClass("lm_horizontal"),e.width(this._size)),e}}const ur=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:Ge,DragProxy:mt,DragSource:Ye,DragSourceFromEvent:Ve,DropTargetIndicator:Tt,Header:et,HeaderButton:Et,Splitter:Je,Tab:At},Symbol.toStringTag,{value:"Module"}));var cr={config:hn,container:fn,controls:ur,errors:Yn,items:rr,utils:xn};const mr=cr;function Pe(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function $(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Pe(Object(e),!0).forEach(function(n){b(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):Pe(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function b(i,t,e){return t=fr(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function fr(i){var t=vr(i,"string");return typeof t=="symbol"?t:String(t)}function vr(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}class Qe extends Y{static minifyConfig(t){return le(t)}static unminifyConfig(t){return Qt(t)}constructor(t,e){super(),b(this,"isInitialised",!1),b(this,"_isFullPage",!1),b(this,"_resizeTimeoutId",void 0),b(this,"_components",{"lm-react-component":Ue}),b(this,"_fallbackComponent",void 0),b(this,"_itemAreas",[]),b(this,"_maximisedItem",null),b(this,"_maximisePlaceholder",c('<div class="lm_maximise_place"></div>')),b(this,"_creationTimeoutPassed",!1),b(this,"_subWindowsCreated",!1),b(this,"_dragSources",[]),b(this,"_updatingColumnsResponsive",!1),b(this,"_firstLoad",!0),b(this,"_reactChildMap",new Map),b(this,"_reactChildren",null),b(this,"_initialHeaderHeight",void 0),b(this,"width",null),b(this,"height",null),b(this,"root",void 0),b(this,"openPopouts",[]),b(this,"selectedItem",null),b(this,"isSubWindow",!1),b(this,"eventHub",new Ke(this)),b(this,"config",void 0),b(this,"container",void 0),b(this,"_originalContainer",void 0),b(this,"dropTargetIndicator",null),b(this,"tabDropPlaceholder",c('<div class="lm_drop_tab_placeholder"></div>')),b(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(t),this._originalContainer=e,this.container=this._getContainer(),this._initialHeaderHeight=this.config.dimensions.headerHeight,this.isSubWindow&&c("body").css("visibility","hidden"),this._typeToItem={column:Ut.bind(this,!0),row:Ut.bind(this,!1),stack:ne,component:Ze}}registerComponent(t,e){if(typeof e!="function"&&(e==null||e.render==null||typeof e.render!="function"))throw new Error("Please register a constructor function");if(this._components[t]!==void 0)throw new Error("Component "+t+" is already registered");this._components[t]=e;var n=()=>{if(this._components[t]===void 0)throw new Error("Component "+t+" is not registered");delete this._components[t]};return n}setFallbackComponent(t){this._fallbackComponent=t}toConfig(t){if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");if(t&&!(t instanceof A))throw new Error("Root must be a ContentItem");var e={settings:$({},this.config.settings),dimensions:$({},this.config.dimensions),labels:$({},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])}};t?n(e,{contentItems:[t]}):n(e,this.root),this._$reconcilePopoutWindows(),e.openPopouts=[];for(var r=0;r<this.openPopouts.length;r++)e.openPopouts.push(this.openPopouts[r].toConfig());return e.maximisedItemId=this._maximisedItem?"__glMaximised":void 0,e}getComponent(t){return this._components[t]}getFallbackComponent(){return this._fallbackComponent}init(){if(this._subWindowsCreated===!1&&(this._createSubWindows(),this._subWindowsCreated=!0),document.readyState==="loading"||document.body===null){c(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 Tt,this.updateSize(),this._create(this.config),this._bindEvents(),this.isInitialised=!0,this._adjustColumnsResponsive(),this.emit("initialised")}addReactChild(t,e){this._reactChildMap.set(t,e),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged")}removeReactChild(t,e){var n=this._reactChildMap.get(t);n===e&&(this._reactChildMap.delete(t),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(t=>{t._header.show=!0,t.header.element.toggle(!0)}),this.updateSize()}disableHeaders(){this.config.settings.hasHeaders=!1,this.config.dimensions.headerHeight=0,this._findAllStackContainers().forEach(t=>{t._header.show=!1,t.header.element.toggle(!1)}),this.updateSize()}updateSize(t,e){var n,r;if(this.width=(n=t??this.container.width())!==null&&n!==void 0?n:0,this.height=(r=e??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 t;this.isInitialised===!1||!this.root||(this._onUnload(),c(window).off("resize",this._onResize),c(window).off("unload beforeunload",this._onUnload),c(window).off("blur.lm").off("focus.lm"),this.root.callDownwards("_$destroy",[],!0),this.root.contentItems=[],this.tabDropPlaceholder.remove(),(t=this.dropTargetIndicator)===null||t===void 0||t.destroy(),this.eventHub.destroy(),this._dragSources.forEach(function(e){e._dragListener.destroy()}),this._dragSources=[])}createContentItem(t,e){var n,r,o;if(typeof t.type!="string")throw new ut("Missing parameter 'type'",t);if(t.type==="react-component"&&(t.type="component",t.componentName="lm-react-component"),!this._typeToItem[t.type])throw r="Unknown type '"+t.type+"'. Valid types are "+Object.keys(this._typeToItem).join(","),new ut(r);return t.type==="component"&&!(e instanceof ne)&&e&&!(this.isSubWindow===!0&&e instanceof ie)&&(t={type:"stack",width:t.width,height:t.height,content:[t]}),t.id=(n=t.id)!==null&&n!==void 0?n:Ht(),o=new this._typeToItem[t.type](this,t,e),o}createPopout(t,e,n,r){var o=[],s=t instanceof A,a=this;if(s){var l;o=this.toConfig(t).content,n=Ht();for(var h=t.parent,d=t;((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 v;r=(v=h)===null||v===void 0?void 0:v.contentItems.indexOf(d)}}else t instanceof Array?o=t:o=[t];if(!e&&s){var f,g,_,x=window.screenX||window.screenLeft,M=window.screenY||window.screenTop,N=(f=t.element.offset())!==null&&f!==void 0?f:{left:0,top:0};e={left:x+N.left,top:M+N.top,width:(g=t.element.width())!==null&&g!==void 0?g:0,height:(_=t.element.height())!==null&&_!==void 0?_:0}}if(!e&&!s&&(e={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),s&&t.remove(),!(!e||!n||r===void 0)){var P=new Ge(o,e,n,r,this);return P.on("initialised",function(){a.emit("windowOpened",P)}),P.on("closed",function(){a._$reconcilePopoutWindows()}),this.openPopouts.push(P),P}}createDragSource(t,e){this.config.settings.constrainDragToContainer=!1;var n=new Ye(t,e,this);return this._dragSources.push(n),n}createDragSourceFromEvent(t,e){return this.config.settings.constrainDragToContainer=!1,new Ve(t,this,e)}selectItem(t,e){if(this.config.settings.selectionEnabled!==!0)throw new Error("Please set selectionEnabled to true to use this feature");t!==this.selectedItem&&(this.selectedItem!==null&&this.selectedItem.deselect(),t&&e!==!0&&t.select(),this.selectedItem=t,this.emit("selectionChanged",t))}_$maximiseItem(t){var e,n;this._maximisedItem!==null&&this._$minimiseItem(this._maximisedItem),this._maximisedItem=t,this._maximisedItem.addId("__glMaximised"),t.element.addClass("lm_maximised"),t.element.after(this._maximisePlaceholder),this.root.element.prepend(t.element),t.element.width((e=this.container.width())!==null&&e!==void 0?e:0),t.element.height((n=this.container.height())!==null&&n!==void 0?n:0),t.callDownwards("setSize"),this._maximisedItem.emit("maximised"),this.emit("stateChanged")}_$minimiseItem(t){var e;t.element.removeClass("lm_maximised"),t.removeId("__glMaximised"),this._maximisePlaceholder.after(t.element),this._maximisePlaceholder.remove(),(e=t.parent)===null||e===void 0||e.callDownwards("setSize"),this._maximisedItem=null,t.emit("minimised"),this.emit("stateChanged")}_$closeWindow(){window.setTimeout(function(){window.close()},1)}_$getArea(t,e){for(var n=1/0,r=null,o=0;o<this._itemAreas.length;o++){var s=this._itemAreas[o];t>s.x1&&t<s.x2&&e>s.y1&&e<s.y2&&n>s.surface&&(n=s.surface,r=s)}return r}_$createRootItemAreas(){var t=50,e=$({},this.root._$getArea()),n=[$($({},e),{},{side:"left",x2:e.x1+t}),$($({},e),{},{side:"right",x1:e.x2-t}),$($({},e),{},{side:"top",y2:e.y1+t}),$($({},e),{},{side:"bottom",y1:e.y2-t})];n.forEach(r=>{r.surface=(r.x2-r.x1)*(r.y2-r.y1)}),this._itemAreas.push(...n)}_$calculateItemAreas(){var t=this._getAllContentItems();if(this._itemAreas=[],t.length===1){this._itemAreas.push(this.root._$getArea());return}this._$createRootItemAreas();for(var e=0;e<t.length;e++){var n=t[e];if(ct(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=$($({},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(t,e){if(!t)throw new Error("No content item defined");if(typeof t=="function"&&(t=t()),t instanceof A)return t;if(c.isPlainObject(t)&&t.type){var n=this.createContentItem(t,e);return n.callDownwards("_$init"),n}else throw new Error("Invalid contentItem")}_$reconcilePopoutWindows(){for(var t=[],e=0;e<this.openPopouts.length;e++){var n;((n=this.openPopouts[e].getWindow())===null||n===void 0?void 0:n.closed)===!1?t.push(this.openPopouts[e]):this.emit("windowClosed",this.openPopouts[e])}this.openPopouts.length!==t.length&&(this.emit("stateChanged"),this.openPopouts=t)}_getAllContentItems(){var t=[],e=n=>{if(t.push(n),n.contentItems instanceof Array)for(var r=0;r<n.contentItems.length;r++)e(n.contentItems[r])};return e(this.root),t}_bindEvents(){this._isFullPage&&c(window).resize(this._onResize),c(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(t){var e,n=ke("gl-window");n&&(this.isSubWindow=!0,t=JSON.parse(localStorage.getItem(n)||"{}"),t=Qt(t),localStorage.removeItem(n)),t=c.extend(!0,{},We,t);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(t),((e=t.settings)===null||e===void 0?void 0:e.hasHeaders)===!1&&(t.dimensions.headerHeight=0),t}_adjustToWindowMode(){var t,e=c('<div class="lm_popin" title="'+this.config.labels.popin+'"><div class="lm_icon"></div><div class="lm_bg"></div></div>');e.click(()=>{this.emit("popIn")}),document.title=ae((t=this.config.content[0].title)!==null&&t!==void 0?t:""),c("head").append(c("body link, body style, template, .gl_keep")),this.container=c("body").html("").css("visibility","visible").append(e),document.body.offsetHeight,window.__glInstance=this}_createSubWindows(){if(this.config.openPopouts)for(var t=0;t<this.config.openPopouts.length;t++){var e=this.config.openPopouts[t];this.createPopout(e.content,e.dimensions,e.parentId,e.indexInParent)}}_getContainer(){var t=this._originalContainer?c(this._originalContainer):c("body");if(t.length===0)throw new Error("GoldenLayout container not found");if(t.length>1)throw new Error("GoldenLayout more than one container element specified");return t}_setContainer(){var t=this._getContainer();t[0]===document.body&&(this._isFullPage=!0,c("html, body").css({height:"100%",margin:0,padding:0,overflow:"hidden"})),this.container=t}_create(t){var e;if(!(t.content instanceof Array))throw t.content===void 0?e="Missing setting 'content' on top level of configuration":e="Configuration parameter 'content' must be an array",new ut(e,t);if(t.content.length>1)throw e="Top level content can't contain more then one element.",new ut(e,t);this.root=new ie(this,{content:t.content},this.container),this.root.callDownwards("_$init"),t.maximisedItemId==="__glMaximised"&&this.root.getItemsById(t.maximisedItemId)[0].toggleMaximise()}_onUnload(){if(this.config.settings.closePopoutsOnUnload===!0)for(var t=0;t<this.openPopouts.length;t++)this.openPopouts[t].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 t=this.root.contentItems[0].contentItems.length;if(!(t<=1)){var e=this.config.dimensions.minItemWidth,n=t*e;if(!(this.width==null||n<=this.width)){this._updatingColumnsResponsive=!0;for(var r=Math.max(Math.floor(this.width/e),1),o=t-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(t,e){e.type==="stack"?e.contentItems.forEach(function(n){t.addChild(n),e.removeChild(n,!0)}):e.contentItems.forEach(n=>{this._addChildContentItemsToContainer(t,n)})}_findAllStackContainers(){var t=[];return this._findAllStackContainersRecursive(t,this.root),t}_findAllStackContainersRecursive(t,e){e.contentItems.forEach(n=>{ct(n)?t.push(n):n.isComponent||this._findAllStackContainersRecursive(t,n)})}}b(Qe,"__lm",mr);const pr=Qe,gr="_lm_dragging_k4a5m_1",_r="_lm_goldenlayout_k4a5m_1",br="_lm_header_k4a5m_1",yr="_lm_controls_k4a5m_1",wr="_lm_tabpreviousbutton_k4a5m_1",Cr="_lm_tabnextbutton_k4a5m_1",Pr="_lm_tab_k4a5m_1",Sr="_lm_active_k4a5m_1",Ir="_lm_close_tab_k4a5m_1",Er="_lm_content_k4a5m_1",Dr="_lm_dragProxy_k4a5m_1",Mr="_lm_dropTargetIndicator_k4a5m_1",Or="_march_k4a5m_1",xr="_lm_inner_k4a5m_1",Tr="_lm_splitter_k4a5m_1",Ar="_lm_selectable_k4a5m_1",Lr="_lm_tabdropdown_list_k4a5m_1",jr="_lm_title_k4a5m_1",Rr="_lm_title_before_k4a5m_1",Nr="_lm_selected_k4a5m_1",$r="_lm_focusin_k4a5m_1",Fr="_lm_window_blur_k4a5m_1",Wr="_lm_popout_k4a5m_1",Br="_lm_maximise_k4a5m_1",zr="_lm_tabdropdown_k4a5m_1",Hr="_lm_close_k4a5m_1",kr="_lm_tabdropdown_search_k4a5m_1",Ur="_lm_tabs_k4a5m_1",Kr="_lm_keyboard_active_k4a5m_1",Gr="_lm_maximised_k4a5m_1",Yr="_lm_items_k4a5m_1",Se={"tab-height":"28px","drag-border-width":"5px",lm_dragging:gr,lm_goldenlayout:_r,lm_header:br,lm_controls:yr,lm_tabpreviousbutton:wr,lm_tabnextbutton:Cr,lm_tab:Pr,lm_active:Sr,lm_close_tab:Ir,lm_content:Er,lm_dragProxy:Dr,lm_dropTargetIndicator:Mr,march:Or,lm_inner:xr,lm_splitter:Tr,lm_selectable:Ar,lm_tabdropdown_list:Lr,lm_title:jr,lm_title_before:Rr,lm_selected:Nr,lm_focusin:$r,lm_window_blur:Fr,lm_popout:Wr,lm_maximise:Br,lm_tabdropdown:zr,lm_close:Hr,lm_tabdropdown_search:kr,lm_tabs:Ur,lm_keyboard_active:Kr,lm_maximised:Gr,lm_items:Yr},Ie=Object.freeze({tabHeight:parseInt(Se["tab-height"],10),dragBorderWidth:parseInt(Se["drag-border-width"],10)});function Ee(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function J(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Ee(Object(e),!0).forEach(function(n){ti(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):Ee(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function ti(i,t,e){return t=Vr(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Vr(i){var t=Xr(i,"string");return typeof t=="symbol"?t:String(t)}function Xr(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}var rt=Mt.module("LayoutUtils");function ei(i){return i.componentName!==void 0}function _t(i){var t=i;return(ei(i)&&i.componentName==="lm-react-component"||i.type==="react-component")&&t.component!==void 0}function $t(i){return i.focus!==void 0}function De(i){return i.type==="stack"}class m{static activateTab(t,e){var n=m.getStackForRoot(t,e,!1);if(!n){rt.error("Could not find stack for config",e);return}var r=m.getContentItemInStack(n,e);r&&n.setActiveContentItem(r)}static isActiveTab(t,e){var n=m.getStackForRoot(t,e,!1);if(!n)return rt.error("Could not find stack for config",e),!1;var r=m.getContentItemInStack(n,e),o=n.getActiveContentItem();return o===r}static addStack(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=e?"column":"row";if(qe(t)){(t.contentItems==null||t.contentItems.length===0)&&t.addChild({type:n});var r=t.contentItems[0],o=e?r.isColumn:r.isRow;if(!o){t.removeChild(r,!0),t.addChild({type:n});var s=document.activeElement;t.contentItems[0].addChild(r),s&&s.focus!=null&&s.focus()}return this.addStack(t.contentItems[0],e)}if(t.contentItems.length<2)return t.addChild({type:"stack"}),t.contentItems[t.contentItems.length-1];var a=t.contentItems[t.contentItems.length-1],l=e?a.isRow:a.isColumn;return l||(t.addChild({type:e?"row":"column"}),t.removeChild(a,!0),t.contentItems[t.contentItems.length-1].addChild(a),a=t.contentItems[t.contentItems.length-1]),this.addStack(a,!e)}static getStackById(t,e){var n,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(r&&ct(t)&&t.contentItems.length===0)return t;if(e===((n=t.config)===null||n===void 0?void 0:n.id)){if(ct(t))return t;throw new Error("Item with ID ".concat(e," is not a stack"))}if(t.contentItems==null)return null;for(var o=0;o<t.contentItems.length;o+=1){var s=this.getStackById(t.contentItems[o],e,r);if(s)return s}return null}static getStackForConfig(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(n&&ct(t)&&t.contentItems.length===0)return t;if(t.contentItems==null)return null;for(var r=0;r<t.contentItems.length;r+=1){var o=t.contentItems[r];if(o.isComponent&&o.config!=null&&ve(o.config,e))return t;var s=this.getStackForConfig(o,e,n);if(s)return s}return null}static getStackForRoot(t,e){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(t,e);return!s&&r&&(s=this.getStackForConfig(t,{component:e.component},o)),!s&&n&&(s=this.addStack(t)),s}static getStackForComponentTypes(t,e){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<e.length;s+=1){var a=e[s],l=s===e.length-1,h=m.getStackForRoot(t,{component:a},n&&l,r,o);if(h)return h}return null}static getContentItemInStack(t,e){if(!t)return null;for(var n=0;n<t.contentItems.length;n+=1){var r=t.contentItems[n];if(r.isComponent&&r.config!=null&&ve(r.config,e))return r}return null}static dehydrateLayoutConfig(t,e){if(t==null||!t.length)return[];for(var n=[],r=0;r<t.length;r+=1){var o=t[r],{component:s,content:a}=o;if(s){var l=e(s,o);l!=null?n.push(l):rt.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(s,'"'))}else if(a){var h=J(J({},o),{},{content:m.dehydrateLayoutConfig(a,e)});n.push(h)}else n.push(o)}return n}static getTabPoint(t){var{tab:e}=t;if(e==null)throw new Error("Cannot get tab for panel container ".concat(t));var n=e.element[0].getBoundingClientRect();return[n.left+n.width*.5,n.bottom-8]}static dropLayoutMinorChange(t){for(var e=0;e<t.length;e+=1){var n=t[e],{content:r}=n;r!==void 0?(De(n)&&delete n.activeItemIndex,m.dropLayoutMinorChange(r)):_t(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(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=m.cloneLayout(t),o=m.cloneLayout(e);return n?(m.dropLayoutMinorChange(r),m.dropLayoutMinorChange(o),Zt(r,o)):Zt(r,o)}static cloneLayout(t){return JSON.parse(JSON.stringify(t))}static hydrateLayoutConfig(t,e){if(t==null||!t.length)return[];for(var n=[],r=0;r<t.length;r+=1){var o=t[r];if(_t(o)){var s,{component:a,props:l={}}=o;n.push(J(J({},o),{},{id:(s=o==null?void 0:o.id)!==null&&s!==void 0?s:Wt(),props:e(a,l)}))}else if(o.content!==void 0){var h=m.hydrateLayoutConfig(o.content,e);De(o)&&o.activeItemIndex!=null&&o.activeItemIndex>=h.length&&(rt.warn("Fixing bad activeItemIndex!",o.activeItemIndex,o),o.activeItemIndex=0),n.push(J(J({},o),{},{content:h}))}else n.push(o)}return n}static openComponent(){var{root:t,config:e,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=J({},e);if(d.id==null&&(d.id=Wt()),l!=null){t==null||t.layoutManager.createDragSourceFromEvent(d,l);return}var u=o||{id:d.id,component:d.component};fe(t);var v=n??(s?m.addStack(t):m.getStackForRoot(t,u));fe(v);var f=m.getContentItemInStack(v,u);if(a!=null){var g=x=>{rt.debug("Component created, focusing element",a),v.off("componentCreated",g);var{element:M}=x.origin;requestAnimationFrame(()=>{m.focusElement(M[0],a)})};v.on("componentCreated",g)}if(r&&f){var _=v.contentItems.indexOf(f);v.addChild(d,_+1),v.removeChild(f),v.setActiveContentItem(v.contentItems[_])}else v.addChild(d);a==null&&h&&$t(h)&&h.focus()}static openComponentInStack(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=document.activeElement,o={id:e.id},s=m.getContentItemInStack(t,o);if(n&&s&&t){var a=t==null?void 0:t.contentItems.indexOf(s);t.addChild(e,a+1),t.removeChild(s),t.setActiveContentItem(t.contentItems[a])}else t==null||t.addChild(e);r&&$t(r)&&r.focus()}static closeComponent(t,e,n){var r=m.getStackForRoot(t,e,!1,!1,!1);if(!r){rt.warn("Cannot find stack for component, ignoring close",e);return}var o=m.getContentItemInStack(r,e),s=document.activeElement;o&&(U(o)?o.container.close(n):r.removeChild(o)),s&&document.contains(s)&&$t(s)&&s.focus()}static renameComponent(t,e,n){var r=m.getStackForRoot(t,e,!1);if(!r){rt.error("Could not find stack for config",e);return}var o=m.getContentItemInStack(r,e);o&&o.setTitle(n)}static cloneComponent(t,e){var n=m.getStackForRoot(t,e,!1);if(!n)return rt.error("Could not find stack for config",e),null;var{props:r={}}=e,o=m.getPanelComponentState(e),s={type:"react-component",component:e.component,props:J(J({},r),{},{panelState:o}),title:"".concat(e.title," Copy"),id:Wt()};return m.openComponentInStack(n,s),s}static getPanelComponentState(t){if(ei(t)){var e;return(e=t.componentState)===null||e===void 0?void 0:e.panelState}if(_t(t)){var n;return(n=t.props)===null||n===void 0?void 0:n.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:Ie.tabHeight,borderWidth:Ie.dragBorderWidth,borderGrabWidth:10},settings:{showPopoutIcon:!1,showCloseIcon:!1,constrainDragToContainer:!1}}}static getRootFromContainer(t){return t.layoutManager.root}static getComponentConfigFromContainer(t){return t?t.tab!=null&&t.tab.contentItem!=null?t.tab.contentItem.config:t._config:null}static getTitleFromContainer(t){return t!=null&&t.tab!=null&&t.tab.contentItem!=null?t.tab.contentItem.config.title:null}static getTitleFromTab(t){return t!=null&&t.contentItem!=null?t.contentItem.config.title:null}static getIdFromContainer(t){var e=m.getComponentConfigFromContainer(t);return e?e.id:null}static getIdFromPanel(t){var{glContainer:e}=t.props;return m.getIdFromContainer(e)}static getComponentNameFromPanel(t){var{glContainer:e}=t.props,n=m.getComponentConfigFromContainer(e);if(n&&_t(n)){var r;return(r=n.component)!==null&&r!==void 0?r:null}return null}static getComponentName(t){var e,n,r=(e=(n=t.WrappedComponent)===null||n===void 0?void 0:n.displayName)!==null&&e!==void 0?e:t.displayName;if(r==null)throw new Error("Component displayName not defined ".concat(t));return r}static focusElement(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:m.DEFAULT_FOCUS_SELECTOR;if(t==null)return null;var n=t.querySelector(e);return n==null?null:($t(n)&&n.focus(),n)}static onInitialized(t){return new Promise(e=>{if(t.isInitialised){e();return}var n=()=>{t.off("initialised",n),e()};t.on("initialised",n)})}}ti(m,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var qr=tt.forwardRef((i,t)=>{var e=m.getComponentNameFromPanel({props:i});return S.jsx("div",{ref:t,className:"panel-placeholder",children:S.jsxs("div",{children:['Component "',e,'" is not registered.']})})});qr.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 Kt(i){return(i==null?void 0:i.WrappedComponent)!==void 0}function Zr(i){return typeof i.id=="string"&&i.layout instanceof pr&&i.panelManager instanceof de&&typeof i.registerComponent=="function"}function Jo(i){if(!Zr(i))throw new Error("Expected dashboard plugin props, but instead received ".concat(i))}function Me(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function Oe(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Me(Object(e),!0).forEach(function(n){ot(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):Me(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function ot(i,t,e){return t=Jr(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Jr(i){var t=Qr(i,"string");return typeof t=="symbol"?t:String(t)}function Qr(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}var k=Mt.module("PanelManager");class de{constructor(t){var e=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]:()=>{};ot(this,"layout",void 0),ot(this,"hydrateComponent",void 0),ot(this,"dehydrateComponent",void 0),ot(this,"onPanelsUpdated",void 0),ot(this,"closed",void 0),ot(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=t,this.hydrateComponent=e,this.dehydrateComponent=n,this.onPanelsUpdated=s,this.openedMap=new Map(r),this.closed=[...o],this.startListening()}startListening(){var{eventHub:t}=this.layout;t.on(D.FOCUS,this.handleFocus),t.on(D.MOUNT,this.handleMount),t.on(D.UNMOUNT,this.handleUnmount),t.on(D.REOPEN,this.handleReopen),t.on(D.REOPEN_LAST,this.handleReopenLast),t.on(D.DELETE,this.handleDeleted),t.on(D.CLOSED,this.handleClosed),t.on(D.CLOSE,this.handleControlClose)}stopListening(){var{eventHub:t}=this.layout;t.off(D.FOCUS,this.handleFocus),t.off(D.MOUNT,this.handleMount),t.off(D.UNMOUNT,this.handleUnmount),t.off(D.REOPEN,this.handleReopen),t.off(D.REOPEN_LAST,this.handleReopenLast),t.off(D.DELETE,this.handleDeleted),t.off(D.CLOSED,this.handleClosed),t.off(D.CLOSE,this.handleControlClose)}getClosedPanelConfigsOfType(t){return this.closed.filter(e=>e.component===t)}getOpenedPanels(){return Array.from(this.openedMap.values())}getOpenedPanelConfigs(){return this.getOpenedPanels().map(t=>{var{glContainer:e}=t.props;return m.getComponentConfigFromContainer(e)})}getOpenedPanelConfigsOfType(t){return this.getOpenedPanelConfigs().filter(e=>e!=null&&_t(e)&&e.component===t)}getOpenedPanelById(t){return this.openedMap.get(t)}getContainerByPanelId(t){var e,n=m.getStackForConfig(this.layout.root,{id:t});return(e=n&&m.getContentItemInStack(n,{id:t}))!==null&&e!==void 0?e:null}getLastUsedPanel(t){for(var e=this.getOpenedPanels(),n=e.length-1;n>=0;n-=1){var r=e[n];if(t==null||t(r))return r}}getLastUsedPanelOfType(t){return this.getLastUsedPanelOfTypes([t])}getLastUsedPanelOfTypes(t){return this.getLastUsedPanel(e=>t.some(n=>Kt(n)&&e instanceof n.WrappedComponent||!Kt(n)&&e instanceof n))}updatePanel(t){var e=m.getIdFromPanel(t);if(e==null){k.error("updatePanel Panel did not have an ID",t);return}k.debug2("Updating panel ID ".concat(e," in open panels map")),this.openedMap.delete(e),this.openedMap.set(e,t)}removePanel(t){var e=m.getIdFromPanel(t);if(e==null){k.error("removePanel Panel did not have an ID",t);return}if(!this.openedMap.has(e)){k.error("Missing panel ID ".concat(e," in open panels map"));return}if(this.openedMap.get(e)!==t){k.debug("Panel argument doesn't match the open panels map entry for ".concat(e,", removePanel ignored"));return}k.debug2("Removing panel ID ".concat(e," from open panels map")),this.openedMap.delete(e)}removeClosedPanelConfig(t){var e=this.closed.findIndex(n=>n===t||n.id!=null&&t.id!=null&&n.id===t.id);e>=0&&this.closed.splice(e,1)}handleFocus(t){k.debug2("Focus: ",t),this.updatePanel(t)}handleMount(t){k.debug2("Mount: ",t),this.updatePanel(t),this.sendUpdate()}handleUnmount(t){k.debug2("Unmount: ",t),this.removePanel(t),this.sendUpdate()}handleReopen(t,e){k.debug2("Reopen:",t,e),this.removeClosedPanelConfig(t);var{component:n}=t,{props:r}=t;r=this.hydrateComponent(n,r);var o=Oe(Oe({},t),{},{props:r}),{root:s}=this.layout,a=t.parentStackId===void 0?void 0:m.getStackById(s,t.parentStackId);m.openComponent({root:s,config:o,replaceConfig:e,stack:a??void 0})}handleReopenLast(t){var e;if(this.closed.length!==0){if(t===void 0){this.handleReopen(this.closed[this.closed.length-1]);return}for(var n=(e=m.getStackForConfig(this.layout.root,t.getConfig()))===null||e===void 0?void 0:e.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(t){k.debug2("Deleted:",t),this.removeClosedPanelConfig(t),this.sendUpdate()}handleClosed(t,e){k.debug2("Closed: ",t),this.addClosedPanel(e),this.sendUpdate()}handleControlClose(t){var e={id:t},{root:n}=this.layout;m.closeComponent(n,e)}addClosedPanel(t){var{root:e}=this.layout,n=m.getComponentConfigFromContainer(t);if(n&&_t(n)){var r=this.dehydrateComponent(n.component,n);if(r!=null){var o;r.parentStackId=(o=m.getStackForConfig(e,n))===null||o===void 0?void 0:o.config.id,this.closed.push(r)}}}sendUpdate(){var{closed:t,openedMap:e}=this;this.onPanelsUpdated({closed:[...t],openedMap:new Map(e)})}}ot(de,"MAX_CLOSED_PANEL_COUNT",100);var to=Mt.module("PanelErrorBoundary");class eo extends w.Component{constructor(t){super(t),this.state={error:null}}componentDidCatch(t){this.setState({error:t})}componentWillUnmount(){var{glContainer:t,glEventHub:e}=this.props,n=m.getIdFromContainer(t);to.debug("componentWillUnmount",n),e.emit(D.CLOSED,n,t)}render(){var{children:t}=this.props,{error:e}=this.state;return e!=null?S.jsx("div",{className:"panel-error-boundary",children:S.jsx(wi,{errorMessage:"".concat(e),isLoading:!1,isLoaded:!1})}):t}}function xe(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function Gt(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?xe(Object(e),!0).forEach(function(n){io(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):xe(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function io(i,t,e){return t=no(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function no(i){var t=ro(i,"string");return typeof t=="symbol"?t:String(t)}function ro(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}function ii(i){var{props:t,componentState:e}=i,{metadata:n}=t,{panelState:r=null}=t;e&&({panelState:r}=e);var o={};return n!=null&&(o.metadata=n),r!=null&&(o.panelState=r),Gt(Gt({},i),{},{componentState:null,props:o,type:"react-component"})}function ni(i){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return Gt(Gt({},i),{},{localDashboardId:t})}function oo(i){var t=Kt(i)&&i.WrappedComponent.prototype!=null&&i.WrappedComponent.prototype.isReactComponent!=null||i.prototype!=null&&i.prototype.isReactComponent!=null,e=!Kt(i)&&"$$typeof"in i&&i.$$typeof===Ii.ForwardRef;return t||e}const Qo={dehydrate:ii,hydrate:ni};var ts=tt.createContext(void 0),so=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}),ri=C.shape({on:C.func,off:C.func,emit:C.func}),ao=C.shape({registerComponent:C.func,root:C.shape({addChild:C.func}),on:C.func,off:C.func,eventHub:ri}),lo=Object.freeze({Container:so,EventHub:ri,Layout:ao});function gt(i,t,e){w.useEffect(function(){return i.on(t,e),()=>{i.off(t,e)}},[i,t,e])}var oi="SET_DASHBOARD_DATA";const ho=$i(oi,{},!1),uo={dashboardData:ho};var co=new Map,si=Object.freeze({}),mo=Object.freeze([]),fo=i=>i.dashboardData,yt=(i,t)=>{var e;return(e=fo(i)[t])!==null&&e!==void 0?e:si},es=(i,t)=>{var e;return(e=yt(i,t).closed)!==null&&e!==void 0?e:mo},is=(i,t)=>{var e;return(e=yt(i,t).openedMap)!==null&&e!==void 0?e:co},ai=(i,t)=>{var e;return(e=yt(i,t).pluginDataMap)!==null&&e!==void 0?e:si},ns=(i,t,e)=>ai(i,t)[e];function Te(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function bt(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Te(Object(e),!0).forEach(function(n){vo(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):Te(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function vo(i,t,e){return t=po(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function po(i){var t=go(i,"string");return typeof t=="symbol"?t:String(t)}function go(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}var li=(i,t)=>({type:oi,id:i,payload:t}),_o=(i,t)=>(e,n)=>e(li(i,bt(bt({},yt(n(),i)),t))),rs=(i,t,e)=>(n,r)=>n(li(i,bt(bt({},yt(r(),i)),{},{pluginDataMap:bt(bt({},ai(r(),i)),{},{[t]:e})})));Object.entries(uo).map(i=>{var[t,e]=i;return Ci.register(t,e)});function bo(i){var{children:t}=i;return S.jsx(S.Fragment,{children:t})}function Ae(i,t){var e=Object.keys(i);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(i);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(i,r).enumerable})),e.push.apply(e,n)}return e}function It(i){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?Ae(Object(e),!0).forEach(function(n){yo(i,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):Ae(Object(e)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(e,n))})}return i}function yo(i,t,e){return t=wo(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function wo(i){var t=Co(i,"string");return typeof t=="symbol"?t:String(t)}function Co(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}var Ft=Mt.module("DashboardLayout"),Po=Object.freeze({}),So=[],Le=()=>{},Io=1e3,je=i=>i;function Eo(i){var t,e,{id:n,children:r,emptyDashboard:o=S.jsx("div",{children:"Dashboard is empty."}),layout:s,layoutConfig:a=So,onLayoutChange:l=Le,onLayoutInitialized:h=Le,hydrate:d=ni,dehydrate:u=ii,panelWrapper:v=bo}=i,f=Ei(),g=(t=Di(p=>yt(p,n)))!==null&&t!==void 0?t:Po,[_,x]=w.useState(!1),[M,N]=w.useState(!1),[P,q]=w.useState(),[W]=w.useState((e=g==null?void 0:g.closed)!==null&&e!==void 0?e:[]),[at,L]=w.useState(s.getReactChildren()),j=w.useMemo(()=>new Map,[]),R=w.useMemo(()=>new Map,[]),lt=w.useCallback(function(p,I){var E,ue=arguments.length>2&&arguments[2]!==void 0?arguments[2]:d,ce=arguments.length>3&&arguments[3]!==void 0?arguments[3]:u;Ft.debug2("registerComponent",p,I,ue,ce);function me(Lt,di){var Yt=I,ui=v,ci=oo(Yt),{glContainer:mi,glEventHub:fi}=Lt;return S.jsx(eo,{glContainer:mi,glEventHub:fi,children:S.jsx(ui,It(It({},Lt),{},{children:ci?S.jsx(Yt,It(It({},Lt),{},{ref:di})):S.jsx(Yt,It({},Lt))}))})}me.displayName="DashboardWrapper(".concat((E=I.displayName)!==null&&E!==void 0?E:p,")");var hi=s.registerComponent(p,tt.forwardRef(me));return j.set(p,ue),R.set(p,ce),hi},[d,u,j,R,s,v]),B=w.useCallback((p,I)=>{var E;return((E=j.get(p))!==null&&E!==void 0?E:je)(I,n)},[j,n]),it=w.useCallback((p,I)=>{var E;return((E=R.get(p))!==null&&E!==void 0?E:je)(I,n)},[R,n]),V=w.useMemo(()=>new de(s,B,it,new Map,W,p=>{var{closed:I,openedMap:E}=p;f(_o(n,{closed:I,openedMap:E}))}),[it,f,B,n,W,s]),X=Yi(p=>{var I=P==null||!m.isEqual(P,p);Ft.debug("handleLayoutStateChanged",I,p),I&&(x(s.root.contentItems.length===0),q(p),l(p),L(s.getReactChildren()))},Io,{flushOnUnmount:!0});w.useEffect(()=>()=>X.flush(),[X]);var K=w.useCallback(()=>{if(!M){var p=s.toConfig(),I=p.content,E=m.dehydrateLayoutConfig(I,it);X(E)}},[it,M,s,X]),Z=w.useCallback(p=>{var I=m.getIdFromContainer(p);s.eventHub.emit(D.DRAGGING,I),N(!0)},[s.eventHub]),ft=w.useCallback(p=>{var I=m.getIdFromContainer(p);s.eventHub.emit(D.DROPPED,I),N(!1)},[s.eventHub]),wt=w.useCallback(p=>{if(Ft.debug2("handleComponentCreated",p),!(p==null||p.config==null||p.config.component==null||p.element==null)){var I=p.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),E="".concat(I,"-component");p.element.addClass(E)}},[]),Ct=w.useCallback(()=>{L(s.getReactChildren())},[s]);gt(s,"stateChanged",K),gt(s,"itemPickedUp",Z),gt(s,"itemDropped",ft),gt(s,"componentCreated",wt),gt(s.eventHub,D.TITLE_CHANGED,K),gt(s,"reactChildrenChanged",Ct);var ht=Vi(a);return w.useEffect(function(){if(ht!==a&&a!==P){Ft.debug("Setting new layout content...");for(var I=m.hydrateLayoutConfig(a,B);s.root.contentItems.length>0;)s.root.contentItems[0].remove();for(var E=0;E<I.length;E+=1)s.root.addChild(I[E]);x(s.root.contentItems.length===0)}},[B,s,a,P,V,ht]),w.useEffect(()=>h(),[]),S.jsxs(S.Fragment,{children:[_&&o,at,tt.Children.map(r,p=>p!=null?tt.cloneElement(p,{id:n,layout:s,panelManager:V,registerComponent:lt}):null)]})}Eo.propTypes={id:C.string.isRequired,children:C.node,data:C.shape({}),emptyDashboard:C.node,layout:lo.Layout.isRequired,layoutConfig:C.arrayOf(C.shape({})),onLayoutChange:C.func,onLayoutInitialized:C.func};var os="default";export{es as $,tn as A,Ko as B,Wo as C,os as D,Ao as E,nn as F,Go as G,on as H,Fe as I,Yo as J,be as K,m as L,gt as M,ts as N,Ji as O,D as P,ns as Q,Eo as R,Qo as S,Gi as T,lo as U,eo as V,de as W,oi as X,Jo as Y,oo as Z,ii as _,fo as a,yt as a0,is as a1,ai as a2,ni as a3,Zr as a4,Kt as a5,uo as a6,li as a7,_o as a8,pr as a9,qr as aa,Li as ab,Fo as ac,Lo as ad,Ti as ae,To as af,xo as ag,U as ah,rs as b,Vi as c,Yi as d,jo as e,Ro as f,ko as g,Bo as h,$e as i,Ne as j,zo as k,Ho as l,Uo as m,$o as n,qo as o,oe as p,Ot as q,No as r,Oo as s,Qi as t,Re as u,Vo as v,Xo as w,sn as x,rn as y,en as z};
2
+ //# sourceMappingURL=DashboardConstants-23023426.js.map