@deephaven/golden-layout 0.15.5-beta.4 → 0.15.6-beta.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.
@@ -3858,16 +3858,6 @@ lm.utils.copy(lm.controls.TransitionIndicator.prototype, {
3858
3858
  },
3859
3859
  });
3860
3860
 
3861
- lm.errors.ConfigurationError = function (message, node) {
3862
- Error.call(this);
3863
-
3864
- this.name = 'Configuration Error';
3865
- this.message = message;
3866
- this.node = node;
3867
- };
3868
-
3869
- lm.errors.ConfigurationError.prototype = new Error();
3870
-
3871
3861
  /**
3872
3862
  * This is the baseclass that all content items inherit from.
3873
3863
  * Most methods provide a subset of what the sub-classes do.
@@ -5832,6 +5822,16 @@ lm.utils.copy(lm.items.Stack.prototype, {
5832
5822
  },
5833
5823
  });
5834
5824
 
5825
+ lm.errors.ConfigurationError = function (message, node) {
5826
+ Error.call(this);
5827
+
5828
+ this.name = 'Configuration Error';
5829
+ this.message = message;
5830
+ this.node = node;
5831
+ };
5832
+
5833
+ lm.errors.ConfigurationError.prototype = new Error();
5834
+
5835
5835
  lm.utils.BubblingEvent = function (name, origin) {
5836
5836
  this.name = name;
5837
5837
  this.origin = origin;
@@ -1 +1 @@
1
- !function(r){var m={config:{},container:{},controls:{},errors:{},items:{},utils:{}};m.utils.F=function(){},m.utils.extend=function(t,e){t.prototype=m.utils.createObject(e.prototype),t.prototype.contructor=t},m.utils.createObject=function(t){return"function"==typeof Object.create?Object.create(t):(m.utils.F.prototype=t,new m.utils.F)},m.utils.objectKeys=function(t){var e,i;if("function"==typeof Object.keys)return Object.keys(t);for(i in e=[],t)e.push(i);return e},m.utils.getHashValue=function(t){t=location.hash.match(new RegExp(t+"=([^&]*)"));return t?t[1]:null},m.utils.getQueryStringParam=function(t){if(window.location.hash)return m.utils.getHashValue(t);if(!window.location.search)return null;for(var e,i=window.location.search.substr(1).split("&"),n={},o=0;o<i.length;o++)n[(e=i[o].split("="))[0]]=e[1];return n[t]||null},m.utils.copy=function(t,e){for(var i in e)t[i]=e[i];return t},m.utils.animFrame=function(t){return(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)})(function(){t()})},m.utils.indexOf=function(t,e){if(!(e instanceof Array))throw new Error("Haystack is not an Array");if(e.indexOf)return e.indexOf(t);for(var i=0;i<e.length;i++)if(e[i]===t)return i;return-1},"function"!=typeof/./&&"object"!=typeof Int8Array?m.utils.isFunction=function(t){return"function"==typeof t||!1}:m.utils.isFunction=function(t){return"[object Function]"===toString.call(t)},m.utils.fnBind=function(e,i,n){if(void 0!==Function.prototype.bind)return Function.prototype.bind.apply(e,[i].concat(n||[]));function o(){var t=(n||[]).concat(Array.prototype.slice.call(arguments,0));if(!(this instanceof o))return e.apply(i,t);e.apply(this,t)}return o.prototype=e.prototype,o},m.utils.removeFromArray=function(t,e){t=m.utils.indexOf(t,e);if(-1===t)throw new Error("Can't remove item from array. Item is not in the array");e.splice(t,1)},m.utils.now=function(){return"function"==typeof Date.now?Date.now():(new Date).getTime()},m.utils.getUniqueId=function(){return(1e15*Math.random()).toString(36).replace(".","")},m.utils.filterXss=function(t,e){t=t.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!0===e?t:t.replace(/>/g,"&gt;").replace(/</g,"&lt;")},m.utils.stripTags=function(t){return r.trim(t.replace(/(<([^>]+)>)/gi,""))},m.utils.EventEmitter=function(){this._mSubscriptions={},this._mSubscriptions[m.utils.EventEmitter.ALL_EVENT]=[],this.on=function(t,e,i){if(!m.utils.isFunction(e))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:i})},this.emit=function(t){var e,i=Array.prototype.slice.call(arguments,1),n=this._mSubscriptions[t];if(n)for(n=n.slice(),s=0;s<n.length;s++)e=n[s].ctx||{},n[s].fn.apply(e,i);i.unshift(t);for(var o=this._mSubscriptions[m.utils.EventEmitter.ALL_EVENT].slice(),s=0;s<o.length;s++)e=o[s].ctx||{},o[s].fn.apply(e,i)},this.unbind=function(t,e,i){if(!this._mSubscriptions[t])throw new Error("No subscribtions to unsubscribe for event "+t);for(var n=!1,o=0;o<this._mSubscriptions[t].length;o++)e&&this._mSubscriptions[t][o].fn!==e||i&&i!==this._mSubscriptions[t][o].ctx||(this._mSubscriptions[t].splice(o,1),n=!0);if(!1===n)throw new Error("Nothing to unbind for "+t)},this.off=this.unbind,this.trigger=this.emit},m.utils.EventEmitter.ALL_EVENT="__all",m.utils.DragListener=function(t,e){m.utils.EventEmitter.call(this),this._eElement=r(t),this._oDocument=r(document),this._eBody=r(document.body),this._destroyAfterMouseUp=e||!1,this._nDelay=400,this._timeout=null,this._nDistance=10,this._nX=0,this._nY=0,this._nOriginalX=0,this._nOriginalY=0,this._bDragging=!1,this._fMove=m.utils.fnBind(this.onMouseMove,this),this._fUp=m.utils.fnBind(this.onMouseUp,this),this._fDown=m.utils.fnBind(this.onMouseDown,this),this._eElement.on("mousedown",this._fDown)},m.utils.DragListener.timeout=null,m.utils.copy(m.utils.DragListener.prototype,{destroy:function(){this._eElement.unbind("mousedown",this._fDown),this._oDocument.unbind("mouseup",this._fUp),this._eElement=null,this._oDocument=null,this._eBody=null,clearTimeout(this._timeout),this._timeout=null},onMouseDown:function(t){t.preventDefault(),0===t.button&&(t=this._getCoordinates(t),this._nOriginalX=t.x,this._nOriginalY=t.y,this._oDocument.on("mousemove",this._fMove),this._oDocument.one("mouseup",this._fUp),this._timeout=setTimeout(m.utils.fnBind(this._startDrag,this),this._nDelay))},onMouseMove:function(t){var e;null!=this._timeout&&(t.preventDefault(),e=this._getCoordinates(t),this._nX=e.x-this._nOriginalX,this._nY=e.y-this._nOriginalY,!1===this._bDragging&&(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:function(t){null!=this._timeout&&(clearTimeout(this._timeout),this._oDocument.unbind("mousemove",this._fMove),this._oDocument.unbind("mouseup",this._fUp),this._oDocument.find("iframe").css("pointer-events",""),!0===this._bDragging&&(this._bDragging=!1,this.emit("dragStop",t,this._nOriginalX+this._nX)),this._eBody&&this._eBody.removeClass("lm_dragging"),this._eElement&&this._eElement.removeClass("lm_dragging"),this._destroyAfterMouseUp&&this.destroy())},_startDrag:function(){clearTimeout(this._timeout),this._bDragging=!0,this._eBody.addClass("lm_dragging"),this._eElement.addClass("lm_dragging"),this._oDocument.find("iframe").css("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)},_getCoordinates:function(t){return{x:(t=t.originalEvent&&t.originalEvent.touches?t.originalEvent.touches[0]:t).pageX,y:t.pageY}}}),m.LayoutManager=function(t,e){if(!r||"function"!=typeof r.noConflict)throw new Error('jQuery is missing as dependency for GoldenLayout. Please either expose $ on GoldenLayout\'s scope (e.g. window) or add "jquery" to your paths when using RequireJS/AMD');m.utils.EventEmitter.call(this),this.isInitialised=!1,this._isFullPage=!1,this._resizeTimeoutId=null,this._components={"lm-react-component":m.utils.ReactComponentHandler},this._fallbackComponent=void 0,this._itemAreas=[],this._resizeFunction=m.utils.fnBind(this._onResize,this),this._unloadFunction=m.utils.fnBind(this._onUnload,this),this._windowBlur=this._windowBlur.bind(this),this._windowFocus=this._windowFocus.bind(this),this._maximisedItem=null,this._maximisePlaceholder=r('<div class="lm_maximise_place"></div>'),this._creationTimeoutPassed=!1,this._subWindowsCreated=!1,this._dragSources=[],this._updatingColumnsResponsive=!1,this._firstLoad=!0,this.width=null,this.height=null,this.root=null,this.openPopouts=[],this.selectedItem=null,this.isSubWindow=!1,this.eventHub=new m.utils.EventHub(this),this.config=this._createConfig(t),this.container=e,this.dropTargetIndicator=null,this.transitionIndicator=null,this.tabDropPlaceholder=r('<div class="lm_drop_tab_placeholder"></div>'),!0===this.isSubWindow&&r("body").css("visibility","hidden"),this._typeToItem={column:m.utils.fnBind(m.items.RowOrColumn,this,[!0]),row:m.utils.fnBind(m.items.RowOrColumn,this,[!1]),stack:m.items.Stack,component:m.items.Component}},(m.LayoutManager.__lm=m).LayoutManager.minifyConfig=function(t){return(new m.utils.ConfigMinifier).minifyConfig(t)},m.LayoutManager.unminifyConfig=function(t){return(new m.utils.ConfigMinifier).unminifyConfig(t)},m.utils.copy(m.LayoutManager.prototype,{registerComponent:function(t,e){if("function"!=typeof e&&(null==e||null==e.render||"function"!=typeof e.render))throw new Error("Please register a constructor function");if(void 0!==this._components[t])throw new Error("Component "+t+" is already registered");return this._components[t]=e,function(){if(void 0===this._components[t])throw new Error("Component "+t+" is not registered");delete this._components[t]}.bind(this)},setFallbackComponent:function(t){this._fallbackComponent=t},toConfig:function(t){var e,o,i;if(!1===this.isInitialised)throw new Error("Can't create config, layout not yet initialised");if(t&&!(t instanceof m.items.AbstractContentItem))throw new Error("Root must be a ContentItem");for(e={settings:m.utils.copy({},this.config.settings),dimensions:m.utils.copy({},this.config.dimensions),labels:m.utils.copy({},this.config.labels),content:[]},(o=function(t,e){var i,n;for(i in e.config)"content"!==i&&(t[i]=e.config[i]);if("lm-react-component"===t.componentName&&(t.type="react-component"),e.contentItems.length)for(t.content=[],n=0;n<e.contentItems.length;n++)t.content[n]={},o(t.content[n],e.contentItems[n])})(e,t?{contentItems:[t]}:this.root),this._$reconcilePopoutWindows(),e.openPopouts=[],i=0;i<this.openPopouts.length;i++)e.openPopouts.push(this.openPopouts[i].toConfig());return e.maximisedItemId=this._maximisedItem?"__glMaximised":null,e},getComponent:function(t){return this._components[t]},getFallbackComponent:function(){return this._fallbackComponent},init:function(){if(!1===this._subWindowsCreated&&(this._createSubWindows(),this._subWindowsCreated=!0),"loading"===document.readyState||null===document.body)r(document).ready(m.utils.fnBind(this.init,this));else{if(!0===this.isSubWindow&&!1===this._creationTimeoutPassed)return setTimeout(m.utils.fnBind(this.init,this),7),void(this._creationTimeoutPassed=!0);!0===this.isSubWindow&&this._adjustToWindowMode(),this._setContainer(),this.dropTargetIndicator=new m.controls.DropTargetIndicator(this.container),this.transitionIndicator=new m.controls.TransitionIndicator,this.updateSize(),this._create(this.config),this._bindEvents(),this.isInitialised=!0,this._adjustColumnsResponsive(),this.emit("initialised")}},updateSize:function(t,e){2===arguments.length?(this.width=t,this.height=e):(this.width=this.container.width(),this.height=this.container.height()),!0===this.isInitialised&&(this.root.callDownwards("setSize",[this.width,this.height]),this._maximisedItem&&(this._maximisedItem.element.width(this.container.width()),this._maximisedItem.element.height(this.container.height()),this._maximisedItem.callDownwards("setSize")),this._adjustColumnsResponsive())},destroy:function(){!1!==this.isInitialised&&(this._onUnload(),r(window).off("resize",this._resizeFunction),r(window).off("unload beforeunload",this._unloadFunction),r(window).off("blur.lm").off("focus.lm"),this.root.callDownwards("_$destroy",[],!0),this.root.contentItems=[],this.tabDropPlaceholder.remove(),this.dropTargetIndicator.destroy(),this.transitionIndicator.destroy(),this.eventHub.destroy(),this._dragSources.forEach(function(t){t._dragListener.destroy(),t._element=null,t._itemConfig=null,t._dragListener=null}),this._dragSources=[])},createContentItem:function(t,e){if("string"!=typeof t.type)throw new m.errors.ConfigurationError("Missing parameter 'type'",t);if("react-component"===t.type&&(t.type="component",t.componentName="lm-react-component"),this._typeToItem[t.type])return"component"!==t.type||e instanceof m.items.Stack||!e||!0===this.isSubWindow&&e instanceof m.items.Root||(t={type:"stack",width:t.width,height:t.height,content:[t]}),new this._typeToItem[t.type](this,t,e);throw e="Unknown type '"+t.type+"'. Valid types are "+m.utils.objectKeys(this._typeToItem).join(","),new m.errors.ConfigurationError(e)},createPopout:function(t,e,i,n){var o,s,r,h,a,l=t,c=t instanceof m.items.AbstractContentItem,d=this;if(i=i||null,c){for(l=this.toConfig(t).content,i=m.utils.getUniqueId(),r=t.parent,h=t;1===r.contentItems.length&&!r.isRoot;)r=r.parent,h=h.parent;r.addId(i),isNaN(n)&&(n=m.utils.indexOf(h,r.contentItems))}else l instanceof Array||(l=[l]);return!e&&c&&(s=window.screenX||window.screenLeft,o=window.screenY||window.screenTop,e={left:s+(s=t.element.offset()).left,top:o+s.top,width:t.element.width(),height:t.element.height()}),e||c||(e={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),c&&t.remove(),(a=new m.controls.BrowserPopout(l,e,i,n,this)).on("initialised",function(){d.emit("windowOpened",a)}),a.on("closed",function(){d._$reconcilePopoutWindows()}),this.openPopouts.push(a),a},createDragSource:function(t,e){this.config.settings.constrainDragToContainer=!1;t=new m.controls.DragSource(r(t),e,this);return this._dragSources.push(t),t},createDragSourceFromEvent:function(t,e){return this.config.settings.constrainDragToContainer=!1,new m.controls.DragSourceFromEvent(t,this,e)},selectItem:function(t,e){if(!0!==this.config.settings.selectionEnabled)throw new Error("Please set selectionEnabled to true to use this feature");t!==this.selectedItem&&(null!==this.selectedItem&&this.selectedItem.deselect(),t&&!0!==e&&t.select(),this.selectedItem=t,this.emit("selectionChanged",t))},_$maximiseItem:function(t){null!==this._maximisedItem&&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(this.container.width()),t.element.height(this.container.height()),t.callDownwards("setSize"),this._maximisedItem.emit("maximised"),this.emit("stateChanged")},_$minimiseItem:function(t){t.element.removeClass("lm_maximised"),t.removeId("__glMaximised"),this._maximisePlaceholder.after(t.element),this._maximisePlaceholder.remove(),t.parent.callDownwards("setSize"),this._maximisedItem=null,t.emit("minimised"),this.emit("stateChanged")},_$closeWindow:function(){window.setTimeout(function(){window.close()},1)},_$getArea:function(t,e){for(var i,n=1/0,o=null,s=0;s<this._itemAreas.length;s++)t>(i=this._itemAreas[s]).x1&&t<i.x2&&e>i.y1&&e<i.y2&&n>i.surface&&(n=i.surface,o=i);return o},_$createRootItemAreas:function(){var t,e={y2:"y1",x2:"x1",y1:"y2",x1:"x2"};for(t in e){var i=this.root._$getArea();"2"==e[i.side=t][1]?i[t]=i[e[t]]-50:i[t]=i[e[t]]+50,i.surface=(i.x2-i.x1)*(i.y2-i.y1),this._itemAreas.push(i)}},_$calculateItemAreas:function(){var t,e,i,n=this._getAllContentItems();if(this._itemAreas=[],1===n.length)this._itemAreas.push(this.root._$getArea());else for(this._$createRootItemAreas(),t=0;t<n.length;t++)n[t].isStack&&null!==(i=n[t]._$getArea())&&(i instanceof Array?this._itemAreas=this._itemAreas.concat(i):(this._itemAreas.push(i),m.utils.copy(e={},i),m.utils.copy(e,i.contentItem._contentAreaDimensions.header.highlightArea),e.surface=(e.x2-e.x1)*(e.y2-e.y1),this._itemAreas.push(e)))},_$normalizeContentItem:function(t,e){if(!t)throw new Error("No content item defined");if((t=m.utils.isFunction(t)?t():t)instanceof m.items.AbstractContentItem)return t;if(r.isPlainObject(t)&&t.type)return(t=this.createContentItem(t,e)).callDownwards("_$init"),t;throw new Error("Invalid contentItem")},_$reconcilePopoutWindows:function(){for(var t=[],e=0;e<this.openPopouts.length;e++)!1===this.openPopouts[e].getWindow().closed?t.push(this.openPopouts[e]):this.emit("windowClosed",this.openPopouts[e]);this.openPopouts.length!==t.length&&(this.emit("stateChanged"),this.openPopouts=t)},_getAllContentItems:function(){function i(t){if(n.push(t),t.contentItems instanceof Array)for(var e=0;e<t.contentItems.length;e++)i(t.contentItems[e])}var n=[];return i(this.root),n},_bindEvents:function(){this._isFullPage&&r(window).resize(this._resizeFunction),r(window).on("unload beforeunload",this._unloadFunction).on("blur.lm",this._windowBlur).on("focus.lm",this._windowFocus)},_windowBlur:function(){this.root.element.addClass("lm_window_blur")},_windowFocus:function(){this.root.element.removeClass("lm_window_blur")},_onResize:function(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=setTimeout(m.utils.fnBind(this.updateSize,this),100)},_createConfig:function(t){var e=m.utils.getQueryStringParam("gl-window"),i=(e&&(this.isSubWindow=!0,t=localStorage.getItem(e),t=JSON.parse(t),t=(new m.utils.ConfigMinifier).unminifyConfig(t),localStorage.removeItem(e)),t=r.extend(!0,{},m.config.defaultConfig,t),function(t){for(var e in t)"props"!==e&&"object"==typeof t[e]?i(t[e]):"type"===e&&"react-component"===t[e]&&(t.type="component",t.componentName="lm-react-component")});return i(t),!1===t.settings.hasHeaders&&(t.dimensions.headerHeight=0),t},_adjustToWindowMode:function(){var t=r('<div class="lm_popin" title="'+this.config.labels.popin+'"><div class="lm_icon"></div><div class="lm_bg"></div></div>');t.click(m.utils.fnBind(function(){this.emit("popIn")},this)),document.title=m.utils.stripTags(this.config.content[0].title),r("head").append(r("body link, body style, template, .gl_keep")),this.container=r("body").html("").css("visibility","visible").append(t),document.body.offsetHeight;window.__glInstance=this},_createSubWindows:function(){for(var t,e=0;e<this.config.openPopouts.length;e++)t=this.config.openPopouts[e],this.createPopout(t.content,t.dimensions,t.parentId,t.indexInParent)},_setContainer:function(){var t=r(this.container||"body");if(0===t.length)throw new Error("GoldenLayout container not found");if(1<t.length)throw new Error("GoldenLayout more than one container element specified");t[0]===document.body&&(this._isFullPage=!0,r("html, body").css({height:"100%",margin:0,padding:0,overflow:"hidden"})),this.container=t},_create:function(t){var e;if(!(t.content instanceof Array))throw e=void 0===t.content?"Missing setting 'content' on top level of configuration":"Configuration parameter 'content' must be an array",new m.errors.ConfigurationError(e,t);if(1<t.content.length)throw new m.errors.ConfigurationError(e="Top level content can't contain more then one element.",t);this.root=new m.items.Root(this,{content:t.content},this.container),this.root.callDownwards("_$init"),"__glMaximised"===t.maximisedItemId&&this.root.getItemsById(t.maximisedItemId)[0].toggleMaximise()},_onUnload:function(){if(!0===this.config.settings.closePopoutsOnUnload)for(var t=0;t<this.openPopouts.length;t++)this.openPopouts[t].close()},_adjustColumnsResponsive:function(){if(this._useResponsiveLayout()&&!this._updatingColumnsResponsive&&this.config.dimensions&&this.config.dimensions.minItemWidth&&0!==this.root.contentItems.length&&this.root.contentItems[0].isRow){this._firstLoad=!1;var t=this.root.contentItems[0].contentItems.length;if(!(t<=1)){var e=this.config.dimensions.minItemWidth,i=t*e;if(!(i<=this.width)){this._updatingColumnsResponsive=!0;for(var n=t-Math.max(Math.floor(this.width/e),1),o=this.root.contentItems[0],s=this._findAllStackContainers()[0],r=0;r<n;r++){var h=o.contentItems[o.contentItems.length-1];this._addChildContentItemsToContainer(s,h)}this._updatingColumnsResponsive=!1}}}else this._firstLoad=!1},_useResponsiveLayout:function(){return this.config.settings&&("always"==this.config.settings.responsiveMode||"onload"==this.config.settings.responsiveMode&&this._firstLoad)},_addChildContentItemsToContainer:function(e,i){"stack"===i.type?i.contentItems.forEach(function(t){e.addChild(t),i.removeChild(t,!0)}):i.contentItems.forEach(m.utils.fnBind(function(t){this._addChildContentItemsToContainer(e,t)},this))},_findAllStackContainers:function(){var t=[];return this._findAllStackContainersRecursive(t,this.root),t},_findAllStackContainersRecursive:function(e,t){t.contentItems.forEach(m.utils.fnBind(function(t){"stack"==t.type?e.push(t):t.isComponent||this._findAllStackContainersRecursive(e,t)},this))}}),"function"==typeof define&&define.amd?define(["jquery"],function(t){return r=t,m.LayoutManager}):"object"==typeof exports?module.exports=m.LayoutManager:window.GoldenLayout=m.LayoutManager,m.config.itemDefaultConfig={isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""},m.config.defaultConfig={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"}},m.container.ItemContainer=function(t,e,i){m.utils.EventEmitter.call(this),this.width=null,this.height=null,this.title=t.componentName,this.parent=e,this.layoutManager=i,this.isHidden=!1,this._config=t,this._element=r(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join("")),this._contentElement=this._element.find(".lm_content")},m.utils.copy(m.container.ItemContainer.prototype,{getElement:function(){return this._contentElement},hide:function(){this.emit("hide"),this.isHidden=!0,this._element.hide()},show:function(){this.emit("show"),this.isHidden=!1,this._element.show(),0==this.height&&0==this.width||this.emit("shown")},setSize:function(t,e){for(var i,n,o,s,r,h=this.parent,a=this;!h.isColumn&&!h.isRow;)if((h=(a=h).parent).isRoot)return!1;for(i=this[o=h.isColumn?"height":"width"]*(1/(a.config[o]/100)),s=(a.config[o]-(n=("height"==o?e:t)/i*100))/(h.contentItems.length-1),r=0;r<h.contentItems.length;r++)h.contentItems[r]===a?h.contentItems[r].config[o]=n:h.contentItems[r].config[o]+=s;return h.callDownwards("setSize"),!0},close:function(){this._config.isClosable&&(this.emit("close"),this.parent.close())},getState:function(){return this._config.componentState},extendState:function(t){this.setState(r.extend(!0,this.getState(),t))},setState:function(t){this._config.componentState=t,this.parent.emitBubblingEvent("stateChanged")},setTitle:function(t){this.parent.setTitle(t)},_$setSize:function(t,e){t===this.width&&e===this.height||(this.width=t,this.height=e,e=(t=this._contentElement[0]).offsetWidth-t.clientWidth,t=t.offsetHeight-t.clientHeight,this._contentElement.width(this.width-e).height(this.height-t),this.emit("resize"))}}),m.controls.BrowserPopout=function(t,e,i,n,o){m.utils.EventEmitter.call(this),this.isInitialised=!1,this._config=t,this._dimensions=e,this._parentId=i,this._indexInParent=n,this._layoutManager=o,this._popoutWindow=null,this._id=null,this._createWindow()},m.utils.copy(m.controls.BrowserPopout.prototype,{toConfig:function(){if(!1===this.isInitialised)throw new Error("Can't create config, layout not yet initialised");return{dimensions:{width:this.getGlInstance().width,height:this.getGlInstance().height,left:this._popoutWindow.screenX||this._popoutWindow.screenLeft,top:this._popoutWindow.screenY||this._popoutWindow.screenTop},content:this.getGlInstance().toConfig().content,parentId:this._parentId,indexInParent:this._indexInParent}},getGlInstance:function(){return this._popoutWindow.__glInstance},getWindow:function(){return this._popoutWindow},close:function(){if(this.getGlInstance())this.getGlInstance()._$closeWindow();else try{this.getWindow().close()}catch(t){}},popIn:function(){var t,e;this._indexInParent;this._parentId&&(t=r.extend(!0,{},this.getGlInstance().toConfig()).content[0],e=(e=this._layoutManager.root.getItemsById(this._parentId)[0])||(0<this._layoutManager.root.contentItems.length?this._layoutManager.root.contentItems[0]:this._layoutManager.root)),e.addChild(t,this._indexInParent),this.close()},_createWindow:function(){var t,e=this._createUrl(),i=Math.floor(1e6*Math.random()).toString(36),n=this._serializeWindowOptions({width:this._dimensions.width,height:this._dimensions.height,innerWidth:this._dimensions.width,innerHeight:this._dimensions.height,menubar:"no",toolbar:"no",location:"no",personalbar:"no",resizable:"yes",scrollbars:"no",status:"no"});if(this._popoutWindow=window.open(e,i,n),this._popoutWindow)r(this._popoutWindow).on("load",m.utils.fnBind(this._positionWindow,this)).on("unload beforeunload",m.utils.fnBind(this._onClose,this)),t=setInterval(m.utils.fnBind(function(){this._popoutWindow.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),clearInterval(t))},this),10);else if(!0===this._layoutManager.config.settings.blockedPopoutsThrowError)throw(e=new Error("Popout blocked")).type="popoutBlocked",e},_serializeWindowOptions:function(t){var e,i=[];for(e in t)i.push(e+"="+t[e]);return i.join(",")},_createUrl:function(){var t={content:this._config},e="gl-window-config-"+m.utils.getUniqueId(),t=(new m.utils.ConfigMinifier).minifyConfig(t);try{localStorage.setItem(e,JSON.stringify(t))}catch(t){throw new Error("Error while writing to localStorage "+t.toString())}return 1===(t=document.location.href.split("?")).length?t[0]+"?gl-window="+e:document.location.href+"&gl-window="+e},_positionWindow:function(){this._popoutWindow.moveTo(this._dimensions.left,this._dimensions.top),this._popoutWindow.focus()},_onInitialised:function(){this.isInitialised=!0,this.getGlInstance().on("popIn",this.popIn,this),this.emit("initialised")},_onClose:function(){setTimeout(m.utils.fnBind(this.emit,this,["closed"]),50)}}),m.controls.DragProxy=function(t,e,i,n,o,s){m.utils.EventEmitter.call(this),this._dragListener=i,this._layoutManager=n,this._contentItem=o,this._originalParent=s,this._area=null,this._lastValidArea=null,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element&&(this._layoutManager.tabDropPlaceholder.width(this._contentItem.tab.element.outerWidth(!0)),this._layoutManager.tabDropPlaceholder.height(this._contentItem.tab.element.outerHeight(!0))),this.element=r(m.controls.DragProxy._template),s&&s._side&&(this._sided=s._sided,this.element.addClass("lm_"+s._side),0<=["right","bottom"].indexOf(s._side)&&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",m.utils.stripTags(this._contentItem.config.title)),this.element.find(".lm_title").html(this._contentItem.config.title),this.childElementContainer=this.element.find(".lm_content"),this.childElementContainer.append(o.element),this._updateTree(),this._layoutManager._$calculateItemAreas(),this._setDimensions(),r(document.body).append(this.element),!this._contentItem.tab&&this._proxyTab.length&&(this._layoutManager.tabDropPlaceholder.width(this._proxyTab.outerWidth(!0)),this._layoutManager.tabDropPlaceholder.height(this._proxyTab.outerHeight(!0)));i=this._layoutManager.container.offset();this._minX=i.left,this._minY=i.top,this._maxX=this._layoutManager.container.width()+this._minX,this._maxY=this._layoutManager.container.height()+this._minY,this._width=this.element.width(),this._height=this.element.height(),this._setDropPosition(t,e),this._layoutManager.emit("itemPickedUp",this._contentItem)},m.controls.DragProxy._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>',m.utils.copy(m.controls.DragProxy.prototype,{_onDrag:function(t,e,i){var n=(i=i.originalEvent&&i.originalEvent.touches?i.originalEvent.touches[0]:i).pageX,i=i.pageY;(n>this._minX&&n<this._maxX&&i>this._minY&&i<this._maxY||!0!==this._layoutManager.config.settings.constrainDragToContainer)&&this._setDropPosition(n,i)},_setDropPosition:function(t,e){this.element.css({left:t,top:e}),this._area=this._layoutManager._$getArea(t,e),null!==this._area&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(t,e,this._area))},_onDrop:function(){this._layoutManager.dropTargetIndicator.hide(),null!==this._area?this._area.contentItem._$onDrop(this._contentItem,this._area):null!==this._lastValidArea?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:function(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(this)},_setDimensions:function(){var t=this._layoutManager.config.dimensions,e=t.dragProxyWidth,i=t.dragProxyHeight;this.element.width(e),this.element.height(i),e-=this._sided?t.headerHeight:0,i-=this._sided?0:t.headerHeight,this.childElementContainer.width(e),this.childElementContainer.height(i),this._contentItem.element.width(e),this._contentItem.element.height(i),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}),m.controls.DragSource=function(t,e,i){this._element=t,this._itemConfig=e,this._layoutManager=i,this._dragListener=null,this._createDragListener()},m.utils.copy(m.controls.DragSource.prototype,{_createDragListener:function(){this._dragListener=new m.utils.DragListener(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this)},_onDragStart:function(t,e){var i=this._itemConfig,i=(m.utils.isFunction(i)&&(i=i()),this._layoutManager._$normalizeContentItem(r.extend(!0,{},i))),t=new m.controls.DragProxy(t,e,this._dragListener,this._layoutManager,i,null);this._layoutManager.transitionIndicator.transitionElements(this._element,t.element)}}),m.controls.DragSourceFromEvent=function(t,e,i){this._element=r(window),this._itemConfig=t,this._layoutManager=e,this._dragListener=null,this._createDragListener(i)},m.utils.copy(m.controls.DragSourceFromEvent.prototype,{_createDragListener:function(t){null!==this._dragListener&&this._dragListener.destroy(),this._dragListener=new m.utils.DragListener(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._destroy,this),this._dragListener._fDown(t),this._dragListener._startDrag()},_destroy:function(){this._dragListener=null,this._element=null,this._itemConfig=null,this._layoutManager=null},_onDragStart:function(t,e){var i=this._itemConfig,i=(m.utils.isFunction(i)&&(i=i()),this._layoutManager._$normalizeContentItem(r.extend(!0,{},i)));new m.controls.DragProxy(t,e,this._dragListener,this._layoutManager,i,null)}}),m.controls.DropTargetIndicator=function(){this.element=r(m.controls.DropTargetIndicator._template),r(document.body).append(this.element)},m.controls.DropTargetIndicator._template='<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>',m.utils.copy(m.controls.DropTargetIndicator.prototype,{destroy:function(){this.element.remove()},highlightArea:function(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:function(){this.element.hide()}}),m.controls.Header=function(t,e){m.utils.EventEmitter.call(this),this.layoutManager=t,this.element=r(m.controls.Header._template),!0===this.layoutManager.config.settings.selectionEnabled&&(this.element.addClass("lm_selectable"),this.element.on("click",m.utils.fnBind(this._onHeaderClick,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.tabDropdownList=null,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.tabs=[],this.activeContentItem=null,this.closeButton=null,this.tabDropdownButton=null,this.tabNextButton=r(m.controls.Header._nextButtonTemplate),this.tabPreviousButton=r(m.controls.Header._previousButtonTemplate),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.holdTimer=null,this.rAF=null,this.CLICK_TIMEOUT=500,this.START_SPEED=.01,this.ACCELERATION=5e-4,this.SCROLL_LEFT="left",this.SCROLL_RIGHT="right",this.layoutManager.on("itemPickedUp",this._handleItemPickedUp),this.layoutManager.on("itemDropped",this._handleItemDropped),this.isDraggingTab=!1,this.isOverflowing=!1,this.isDropdownShown=!1,this.dropdownKeyIndex=0,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._lastVisibleTabIndex=-1,this._tabControlOffset=this.layoutManager.config.settings.tabControlOffset,this._createControls()},m.controls.Header._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(""),m.controls.Header._previousButtonTemplate=['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""),m.controls.Header._nextButtonTemplate=['<li class="lm_tabnextbutton"></li>'].join(""),m.utils.copy(m.controls.Header.prototype,{createTab:function(t,e){for(var i,n=0;n<this.tabs.length;n++)if(this.tabs[n].contentItem===t)return;if(i=new m.controls.Tab(this,t),0===this.tabs.length)return this.tabs.push(i),void this.tabsContainer.append(i.element);0<(e=void 0===e?this.tabs.length:e)?this.tabs[e-1].element.after(i.element):this.tabs[0].element.before(i.element),this.tabs.splice(e,0,i),this._updateTabSizes()},removeTab:function(t){for(var e=0;e<this.tabs.length;e++)if(this.tabs[e].contentItem===t)return this.tabs[e]._$destroy(),void this.tabs.splice(e,1);throw new Error("contentItem is not controlled by this header")},setActiveContentItem:function(t){for(var e,i=0;i<this.tabs.length;i++)e=this.tabs[i].contentItem===t,this.tabs[i].setActive(e),!0==e&&(this.activeContentItem=t,this.parent.config.activeItemIndex=i);this.tabs[this.parent.config.activeItemIndex].element.get(0).scrollIntoView({inline:"nearest"}),this._hideAdditionalTabsDropdown(),this._updateTabSizes(),this.parent.emitBubblingEvent("stateChanged")},position:function(t){var e=this.parent._header.show;return e&&!this.parent._side&&(e="top"),void 0!==t&&this.parent._header.show!==t&&(this.parent._header.show=t,this.parent._setupHeaderPosition()),e},_attachWheelListener:function(){this.tabsContainer.get(0).addEventListener("wheel",this._handleWheelEvent,{passive:!0})},_detachWheelListener:function(){this.tabsContainer.get(0).removeEventListener("wheel",this._handleWheelEvent,{passive:!0})},_handleWheelEvent:function(t){var e=t.currentTarget,i=Math.abs(t.deltaY)>Math.abs(t.deltaX)?t.deltaY:t.deltaX;t.deltaMode===WheelEvent.DOM_DELTA_PAGE?i*=this.tabsContainer.innerWidhth():t.deltaMode===WheelEvent.DOM_DELTA_LINE&&(i*=100/3),e.scrollLeft+=Math.round(i)},_handleScrollEvent:function(){this._checkScrollArrows()},_handleItemPickedUp:function(){this.isDraggingTab=!0,this.controlsContainer.on("mouseenter",this._handleNextMouseEnter),this.tabPreviousButton.on("mouseenter",this._handlePreviousMouseEnter)},_handleItemDropped:function(){this.isDraggingTab=!1,this.rAF=window.cancelAnimationFrame(this.rAF),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:function(){this.controlsContainer.on("mouseleave",this._handleNextMouseLeave),this._handleScrollRepeat(this.SCROLL_RIGHT,this.tabsContainer.scrollLeft())},_handlePreviousMouseEnter:function(){this.tabPreviousButton.on("mouseleave",this._handlePreviousMouseLeave),this._handleScrollRepeat(this.SCROLL_LEFT,this.tabsContainer.scrollLeft())},_handleNextMouseLeave:function(){this.rAF=window.cancelAnimationFrame(this.rAF),this.controlsContainer.off("mouseleave",this._handleNextMouseLeave)},_handlePreviousMouseLeave:function(){this.rAF=window.cancelAnimationFrame(this.rAF),this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)},_handleNextButtonMouseDown:function(){for(var t,e=0;e<this.tabs.length;e+=1)if(this.tabs[e].element.get(0).offsetLeft>this.tabsContainer.get(0).offsetWidth+this.tabsContainer.scrollLeft()){t=this.tabs[e].element.get(0);break}t?(t.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT)):this.tabsContainer.get(0).scrollLeft=this.tabsContainer.get(0).scrollWidth},_handlePreviousButtonMouseDown:function(){for(var t,e=this.tabs.length-1;0<=e;--e)if(this.tabs[e].element.get(0).offsetLeft<this.tabsContainer.scrollLeft()){t=this.tabs[e].element.get(0);break}t?(t.scrollIntoView({behavior:"smooth",inline:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT)):this.tabsContainer.get(0).scrollLeft=0},_handleScrollButtonMouseDown:function(t){this.holdTimer=setTimeout(function(){this._handleScrollRepeat(t,this.tabsContainer.scrollLeft(),100)}.bind(this),this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)},_handleScrollButtonMouseUp:function(){this.holdTimer=clearTimeout(this.holdTimer),this.rAF=cancelAnimationFrame(this.rAF),window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)},_checkScrollArrows:function(){0===this.tabsContainer.scrollLeft()?this.tabPreviousButton.first().attr("disabled",!0):this.tabsContainer.scrollLeft()+this.tabsContainer.innerWidth()===this.tabsContainer.get(0).scrollWidth?this.tabNextButton.attr("disabled",!0):(this.tabNextButton.attr("disabled",!1),this.tabPreviousButton.first().attr("disabled",!1))},_handleScrollRepeat:function(i,n,t,o){t=t||0;var e=this.tabsContainer.get(0).getBoundingClientRect();if(i===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(n-t),this.isDraggingTab&&this.parent._highlightHeaderDropZone(e.left-1),0===this.tabsContainer.scrollLeft())return void this._checkScrollArrows()}else if(i===this.SCROLL_RIGHT&&(this.tabsContainer.scrollLeft(n+t),this.isDraggingTab&&this.parent._highlightHeaderDropZone(e.right+1),this.tabsContainer.scrollLeft()+this.tabsContainer.innerWidth()===this.tabsContainer.get(0).scrollWidth))return void this._checkScrollArrows();window.cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(function(t){var e=o||t,t=t-e,t=this.START_SPEED*t+.5*this.ACCELERATION*(t*t),t=Math.min(t,this.tabsContainer.get(0).scrollWidth);this._handleScrollRepeat(i,n,t,e)}.bind(this))},_$setClosable:function(t){return!(!this.closeButton||!this._isClosable())&&(this.closeButton.element[t?"show":"hide"](),!0)},_$destroy:function(){this.emit("destroy",this);for(var t=0;t<this.tabs.length;t++)this.tabs[t]._$destroy();this._detachWheelListener(),this._handleItemDropped(),r(document).off("mouseup",this._hideAdditionalTabsDropdown),this.tabDropdownSearch.off("input",this._handleFilterInput),this.tabDropdownSearch.off("keydown",this._handleFilterKeydown),this.element.remove()},_getHeaderSetting:function(t){if(t in this.parent._header)return this.parent._header[t]},_createControls:function(){var t,e,i,n,o=this.layoutManager.config.labels.tabDropdown;this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel;this.tabDropdownButton=new m.controls.HeaderButton(this,o,"lm_tabdropdown",this._showAdditionalTabsDropdown),this.tabDropdownButton.element.hide(),this.controlsContainer.prepend(this.tabNextButton),this.tabNextButton.hide(),this._getHeaderSetting("popout")&&(o=m.utils.fnBind(this._onPopoutClick,this),t=this._getHeaderSetting("popout"),new m.controls.HeaderButton(this,t,"lm_popout",o)),this._getHeaderSetting("maximise")&&(o=m.utils.fnBind(this.parent.toggleMaximise,this.parent),e=this._getHeaderSetting("maximise"),i=this._getHeaderSetting("minimise"),n=new m.controls.HeaderButton(this,e,"lm_maximise",o),this.parent.on("maximised",function(){n.element.attr("title",i)}),this.parent.on("minimised",function(){n.element.attr("title",e)})),this._isClosable()&&(o=m.utils.fnBind(this.parent.remove,this.parent),t=this._getHeaderSetting("close"),this.closeButton=new m.controls.HeaderButton(this,t,"lm_close",o))},_showAdditionalTabsDropdown:function(){this.isDropdownShown?this._hideAdditionalTabsDropdown():(this.tabDropdownList=this.tabsContainer.clone(!0).appendTo(this.tabDropdownContainer).children().removeClass("lm_active"),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"),r(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown())},_handleFilterKeydown:function(t){if(-1!==this.dropdownKeyIndex){if("Escape"!==t.key)return"Enter"===t.key||" "===t.key?(this._hideAdditionalTabsDropdown(),void this.tabs[this.dropdownKeyIndex]._onTabClick()):void("ArrowDown"===t.key||"Tab"===t.key&&!1===t.shiftKey?(t.preventDefault(),this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=e(this.dropdownKeyIndex,1,this.tabDropdownList),this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")):"ArrowUp"!==t.key&&"Tab"!==t.key||(t.preventDefault(),this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=e(this.dropdownKeyIndex,-1,this.tabDropdownList),this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")));this._hideAdditionalTabsDropdown()}function e(t,e,i){if(i.length<2)return-1;for(var n=(t+e+i.length)%i.length;n!==t;){if("none"!==i.eq(n).css("display"))return n;n=(n+e+i.length)%i.length}return t}},_handleFilterInput:function(t){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var e=0;e<this.tabDropdownList.length;e++)-1!==this.tabs[e].contentItem.config.title.toLowerCase().indexOf(t.target.value.toLowerCase())?(this.tabDropdownList.eq(e).css("display",""),-1===this.dropdownKeyIndex&&(this.dropdownKeyIndex=e)):this.tabDropdownList.eq(e).css("display","none");-1!==this.dropdownKeyIndex&&this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")},_hideAdditionalTabsDropdown:function(t){!this.isDropdownShown||t&&this.tabDropdownContainer.get(0).contains(t.target)||t&&this.tabDropdownButton.element.get(0)===t.target||(this.element.removeClass("lm_dropdown_open"),this.tabDropdownContainer.hide(),this.isDropdownShown=!1,this.tabDropdownContainer.find(".lm_tabs").remove(),r(document).off("mousedown",this._hideAdditionalTabsDropdown))},_updateAdditionalTabsDropdown:function(){this.tabDropdownContainer.css("max-height","");var t,e=this.tabDropdownContainer[0].scrollHeight;0!==e&&(t=this.tabDropdownContainer.offset().top-r(window).scrollTop())+e>r(window).height()&&this.tabDropdownContainer.css("max-height",r(window).height()-t-10)},_isClosable:function(){return this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon},_onPopoutClick:function(){(!0===this.layoutManager.config.settings.popoutWholeStack?this.parent:this.activeContentItem).popout()},_onHeaderClick:function(t){t.target===this.element[0]&&this.parent.select()},_updateTabSizes:function(){0!==this.tabs.length&&(!this.isOverflowing&&this.tabsContainer.get(0).scrollWidth>this.tabsContainer.get(0).clientWidth?(this.tabDropdownButton.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0):this.isOverflowing&&this.tabsContainer.get(0).scrollWidth<=this.tabsContainer.get(0).clientWidth&&(this.tabDropdownButton.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1),this.isOverflowing&&this._checkScrollArrows())}}),m.controls.HeaderButton=function(t,e,i,n){this._header=t,this.element=r('<li class="'+i+'" title="'+e+'"></li>'),this._header.on("destroy",this._$destroy,this),this._action=n,this.element.on("click",this._action),this._header.controlsContainer.append(this.element)},m.utils.copy(m.controls.HeaderButton.prototype,{_$destroy:function(){this.element.off(),this.element.remove()}}),m.controls.Splitter=function(t,e,i){this._isVertical=t,this._size=e,this._grabSize=i<e?e:i,this.element=this._createElement(),this._dragListener=new m.utils.DragListener(this.element)},m.utils.copy(m.controls.Splitter.prototype,{on:function(t,e,i){this._dragListener.on(t,e,i)},_$destroy:function(){this._dragListener.destroy(),this._dragListener=null,this.element.remove()},_createElement:function(){var t=r('<div class="lm_drag_handle"></div>'),e=r('<div class="lm_splitter"></div>'),i=(e.append(t),this._grabSize-this._size),n=i/2;return this._isVertical?(t.css("top",-n),t.css("height",this._size+i),e.addClass("lm_vertical"),e.height(this._size)):(t.css("left",-n),t.css("width",this._size+i),e.addClass("lm_horizontal"),e.width(this._size)),e}}),m.controls.Tab=function(t,e){this.header=t,this.contentItem=e,this.element=r(m.controls.Tab._template),this.titleElement=this.element.find(".lm_title"),this.closeElement=this.element.find(".lm_close_tab"),this.closeElement[e.config.isClosable?"show":"hide"](),this.isActive=!1,this.setTitle(e.config.title),this.contentItem.on("titleChanged",this.setTitle,this),this._layoutManager=this.contentItem.layoutManager,!0===this._layoutManager.config.settings.reorderEnabled&&!0===e.config.reorderEnabled&&(this._dragListener=new m.utils.DragListener(this.element),this._dragListener.on("dragStart",this._onDragStart,this),this.contentItem.on("destroy",this._dragListener.destroy,this._dragListener)),this._onTabClickFn=m.utils.fnBind(this._onTabClick,this),this._onCloseClickFn=m.utils.fnBind(this._onCloseClick,this),this._onTabContentFocusInFn=m.utils.fnBind(this._onTabContentFocusIn,this),this._onTabContentFocusOutFn=m.utils.fnBind(this._onTabContentFocusOut,this),this.element.on("click",this._onTabClickFn),this.element.on("auxclick",this._onTabClickFn),this.contentItem.config.isClosable?(this.closeElement.on("click",this._onCloseClickFn),this.closeElement.on("mousedown",this._onCloseMousedown)):this.closeElement.remove(),(this.contentItem.tab=this).contentItem.emit("tab",this),this.contentItem.layoutManager.emit("tabCreated",this),this.contentItem.isComponent&&(this.contentItem.container._contentElement.on("focusin click",this._onTabContentFocusInFn).on("focusout",this._onTabContentFocusOutFn),(this.contentItem.container.tab=this).contentItem.container.emit("tab",this))},m.controls.Tab._template=['<li class="lm_tab">','<span class="lm_title_before"></span>','<span class="lm_title"></span>','<div class="lm_close_tab"></div>',"</li>"].join(""),m.utils.copy(m.controls.Tab.prototype,{setTitle:function(t){this.titleElement.html(t)},setActive:function(t){t!==this.isActive&&((this.isActive=t)?this.element.addClass("lm_active"):this.element.removeClass("lm_active"))},_$destroy:function(){this.element.off("click",this._onTabClickFn),this.element.off("auxclick",this._onTabClickFn),this.closeElement.off("click",this._onCloseClickFn),this.contentItem.isComponent&&this.contentItem.container._contentElement.off(),this._dragListener&&(this.contentItem.off("destroy",this._dragListener.destroy,this._dragListener),this._dragListener.off("dragStart",this._onDragStart),this._dragListener=null),this.element.remove()},_onDragStart:function(t,e){!0===this.contentItem.parent.isMaximised&&this.contentItem.parent.toggleMaximise(),new m.controls.DragProxy(t,e,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)},_onTabContentFocusIn:function(){this.contentItem.container._contentElement[0].contains(document.activeElement)||this.contentItem.container._contentElement[0].focus(),this.element.addClass("lm_focusin")},_onTabContentFocusOut:function(){this.contentItem.container._contentElement[0].contains(document.activeElement)||this.element.removeClass("lm_focusin")},_onTabClick:function(t){t&&0!==t.button?1===t.button&&this.contentItem.config.isClosable&&this._onCloseClick(t):(t=this.header.parent.getActiveContentItem(),this.contentItem!==t?(this.header.parent.setActiveContentItem(this.contentItem),this.contentItem.container.emit("tabClicked")):this.contentItem.isComponent&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&(this.contentItem.container._contentElement.focus(),this.contentItem.container.emit("tabClicked")),this.header._hideAdditionalTabsDropdown(),this.element.get(0).scrollIntoView({inline:"nearest"}))},_onCloseClick:function(t){t.stopPropagation(),this.contentItem.isComponent?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)},_onCloseMousedown:function(t){t.stopPropagation()}}),m.controls.TransitionIndicator=function(){this._element=r('<div class="lm_transition_indicator"></div>'),r(document.body).append(this._element),this._toElement=null,this._fromDimensions=null,this._totalAnimationDuration=200,this._animationStartTime=null},m.utils.copy(m.controls.TransitionIndicator.prototype,{destroy:function(){this._element.remove()},transitionElements:function(t,e){},_nextAnimationFrame:function(){var t,e=this._measure(this._toElement),i=(m.utils.now()-this._animationStartTime)/this._totalAnimationDuration,n={};if(1<=i)this._element.hide();else{for(t in e.opacity=0,this._fromDimensions)n[t]=this._fromDimensions[t]+(e[t]-this._fromDimensions[t])*i;this._element.css(n),m.utils.animFrame(m.utils.fnBind(this._nextAnimationFrame,this))}},_measure:function(t){var e=t.offset();return{left:e.left,top:e.top,width:t.outerWidth(),height:t.outerHeight()}}}),m.errors.ConfigurationError=function(t,e){Error.call(this),this.name="Configuration Error",this.message=t,this.node=e},m.errors.ConfigurationError.prototype=new Error,m.items.AbstractContentItem=function(t,e,i){m.utils.EventEmitter.call(this),this.config=this._extendItemNode(e),this.type=e.type,this.contentItems=[],this.parent=i,this.isInitialised=!1,this.isMaximised=!1,this.isRoot=!1,this.isRow=!1,this.isColumn=!1,this.isStack=!1,this.isComponent=!1,this.layoutManager=t,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(m.utils.EventEmitter.ALL_EVENT,this._propagateEvent,this),e.content&&this._createContentItems(e)},m.utils.copy(m.items.AbstractContentItem.prototype,{setSize:function(){throw new Error("Abstract Method")},callDownwards:function(t,e,i,n){var o;for(!0!==i&&!0!==n&&this[t].apply(this,e||[]),o=0;o<this.contentItems.length;o++)this.contentItems[o].callDownwards(t,e,i);!0===i&&!0!==n&&this[t].apply(this,e||[])},removeChild:function(t,e){t=m.utils.indexOf(t,this.contentItems);if(-1===t)throw new Error("Can't remove child item. Unknown content item");!0!==e&&this.contentItems[t]._$destroy(),this.contentItems.splice(t,1),this.config.content.splice(t,1),0<this.contentItems.length?this.callDownwards("setSize"):this instanceof m.items.Root||!0!==this.config.isClosable||this.parent.removeChild(this)},addChild:function(t,e){void 0===e&&(e=this.contentItems.length),this.contentItems.splice(e,0,t),void 0===this.config.content&&(this.config.content=[]),this.config.content.splice(e,0,t.config),t.parent=this,!0===t.parent.isInitialised&&!1===t.isInitialised&&t._$init()},replaceChild:function(t,e,i){e=this.layoutManager._$normalizeContentItem(e);var n=m.utils.indexOf(t,this.contentItems),o=t.element[0].parentNode;if(-1===n)throw new Error("Can't replace child. oldChild is not child of this");o.replaceChild(e.element[0],t.element[0]),!0===i&&(t.parent=null,t._$destroy()),((this.contentItems[n]=e).parent=this).isStack&&(this.header.tabs[n].contentItem=e),!0===e.parent.isInitialised&&!1===e.isInitialised&&e._$init(),this.callDownwards("setSize")},remove:function(){this.parent.removeChild(this)},popout:function(){var t=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),t},toggleMaximise:function(t){t&&t.preventDefault(),!0===this.isMaximised?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximised=!this.isMaximised,this.emitBubblingEvent("stateChanged")},select:function(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))},deselect:function(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))},setTitle:function(t){this.config.title=t,this.emit("titleChanged",t),this.emitBubblingEvent("stateChanged")},hasId:function(t){return!!this.config.id&&("string"==typeof this.config.id?this.config.id===t:this.config.id instanceof Array?-1!==m.utils.indexOf(t,this.config.id):void 0)},addId:function(t){this.hasId(t)||(this.config.id?"string"==typeof this.config.id?this.config.id=[this.config.id,t]:this.config.id instanceof Array&&this.config.id.push(t):this.config.id=t)},removeId:function(t){if(!this.hasId(t))throw new Error("Id not found");"string"==typeof this.config.id?delete this.config.id:this.config.id instanceof Array&&(t=m.utils.indexOf(t,this.config.id),this.config.id.splice(t,1))},getItemsByFilter:function(i){function n(t){for(var e=0;e<t.contentItems.length;e++)!0===i(t.contentItems[e])&&o.push(t.contentItems[e]),n(t.contentItems[e])}var o=[];return n(this),o},getItemsById:function(e){return this.getItemsByFilter(function(t){return t.config.id instanceof Array?-1!==m.utils.indexOf(e,t.config.id):t.config.id===e})},getItemsByType:function(t){return this._$getItemsByProperty("type",t)},getComponentsByName:function(t){for(var e=this._$getItemsByProperty("componentName",t),i=[],n=0;n<e.length;n++)i.push(e[n].instance);return i},_$getItemsByProperty:function(e,i){return this.getItemsByFilter(function(t){return t[e]===i})},_$setParent:function(t){this.parent=t},_$highlightDropZone:function(t,e,i){this.layoutManager.dropTargetIndicator.highlightArea(i)},_$onDrop:function(t){this.addChild(t)},_$hide:function(){this._callOnActiveComponents("hide"),this.element.hide(),this.layoutManager.updateSize()},_$show:function(){this._callOnActiveComponents("show"),this.element.show(),this.layoutManager.updateSize()},_callOnActiveComponents:function(t){for(var e,i=this.getItemsByType("stack"),n=0;n<i.length;n++)(e=i[n].getActiveContentItem())&&e.isComponent&&e.container[t]()},_$destroy:function(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")},_$getArea:function(t){var e=(t=t||this.element).offset(),i=t.width(),t=t.height();return{x1:e.left,y1:e.top,x2:e.left+i,y2:e.top+t,surface:i*t,contentItem:this}},_$init:function(){var t;for(this.setSize(),t=0;t<this.contentItems.length;t++)this.childElementContainer.append(this.contentItems[t].element);this.isInitialised=!0,this.emitBubblingEvent("itemCreated"),this.emitBubblingEvent(this.type+"Created")},emitBubblingEvent:function(t){var e=new m.utils.BubblingEvent(t,this);this.emit(t,e)},_createContentItems:function(t){var e,i;if(!(t.content instanceof Array))throw new m.errors.ConfigurationError("content must be an Array",t);for(i=0;i<t.content.length;i++)e=this.layoutManager.createContentItem(t.content[i],this),this.contentItems.push(e)},_extendItemNode:function(t){for(var e in m.config.itemDefaultConfig)void 0===t[e]&&(t[e]=m.config.itemDefaultConfig[e]);return t},_propagateEvent:function(t,e){e instanceof m.utils.BubblingEvent&&!1===e.isPropagationStopped&&!0===this.isInitialised&&(!1===this.isRoot&&this.parent?this.parent.emit.apply(this.parent,Array.prototype.slice.call(arguments,0)):this._scheduleEventPropagationToLayoutManager(t,e))},_scheduleEventPropagationToLayoutManager:function(t,e){-1===m.utils.indexOf(t,this._throttledEvents)?this.layoutManager.emit(t,e.origin):!0!==this._pendingEventPropagations[t]&&(this._pendingEventPropagations[t]=!0,m.utils.animFrame(m.utils.fnBind(this._propagateEventToLayoutManager,this,[t,e])))},_propagateEventToLayoutManager:function(t,e){this._pendingEventPropagations[t]=!1,this.layoutManager.emit(t,e)}}),m.items.Component=function(t,e,i){m.items.AbstractContentItem.call(this,t,e,i);e=t.getComponent(this.config.componentName)||t.getFallbackComponent(),i=r.extend(!0,{},this.config.componentState||{});if(null==e)throw new m.errors.ConfigurationError('Unknown component "'+this.config.componentName+'"');i.componentName=this.config.componentName,this.componentName=this.config.componentName,""===this.config.title&&(this.config.title=this.config.componentName),this.isComponent=!0,this.container=new m.container.ItemContainer(this.config,this,t),this.instance=new e(this.container,i),this.element=this.container._element},m.utils.extend(m.items.Component,m.items.AbstractContentItem),m.utils.copy(m.items.Component.prototype,{close:function(){this.parent.removeChild(this)},setSize:function(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())},_$init:function(){m.items.AbstractContentItem.prototype._$init.call(this),this.container.emit("open")},_$hide:function(){this.container.hide(),m.items.AbstractContentItem.prototype._$hide.call(this)},_$show:function(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),m.items.AbstractContentItem.prototype._$show.call(this)},_$destroy:function(){this.container.emit("destroy",this),m.items.AbstractContentItem.prototype._$destroy.call(this)},_$getArea:function(){return null}}),m.items.Root=function(t,e,i){m.items.AbstractContentItem.call(this,t,e,null),this.isRoot=!0,this.type="root",this.element=r('<div class="lm_goldenlayout lm_item lm_root"></div>'),this.childElementContainer=this.element,this._containerElement=i,this._containerElement.append(this.element)},m.utils.extend(m.items.Root,m.items.AbstractContentItem),m.utils.copy(m.items.Root.prototype,{addChild:function(t){if(0<this.contentItems.length)throw new Error("Root node can only have a single child");t=this.layoutManager._$normalizeContentItem(t,this),this.childElementContainer.append(t.element),m.items.AbstractContentItem.prototype.addChild.call(this,t),this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")},setSize:function(t,e){t=void 0===t?this._containerElement.width():t,e=void 0===e?this._containerElement.height():e,this.element.width(t),this.element.height(e),this.contentItems[0]&&(this.contentItems[0].element.width(t),this.contentItems[0].element.height(e))},_$highlightDropZone:function(t,e,i){this.layoutManager.tabDropPlaceholder.remove(),m.items.AbstractContentItem.prototype._$highlightDropZone.apply(this,arguments)},_$onDrop:function(t,e){var i,n,o;t.isComponent&&((o=this.layoutManager.createContentItem({type:"stack",header:t.config.header||{}},this))._$init(),o.addChild(t),t=o),this.contentItems.length?(o="x"==e.side[0]?"row":"column",i="x"==e.side[0]?"width":"height",e="2"==e.side[1],!(n=this.contentItems[0])instanceof m.items.RowOrColumn||n.type!=o?(o=this.layoutManager.createContentItem({type:o},this),this.replaceChild(n,o),o.addChild(t,e?0:void 0,!0),o.addChild(n,e?void 0:0,!0),n.config[i]=50,t.config[i]=50,o.callDownwards("setSize")):(o=n.contentItems[e?0:n.contentItems.length-1],n.addChild(t,e?0:void 0,!0),o.config[i]*=.5,t.config[i]=o.config[i],n.callDownwards("setSize"))):this.addChild(t)}}),m.items.RowOrColumn=function(t,e,i,n){m.items.AbstractContentItem.call(this,e,i,n),this.isRow=!t,this.isColumn=t,this.element=r('<div class="lm_item lm_'+(t?"column":"row")+'"></div>'),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._splitter=[],this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null},m.utils.extend(m.items.RowOrColumn,m.items.AbstractContentItem),m.utils.copy(m.items.RowOrColumn.prototype,{addChild:function(t,e,i){var n,o,s,r;if(t=this.layoutManager._$normalizeContentItem(t,this),void 0===e&&(e=this.contentItems.length),0<this.contentItems.length?(r=this._createSplitter(Math.max(0,e-1)).element,0<e?(this.contentItems[e-1].element.after(r),r.after(t.element)):(this.contentItems[0].element.before(r),r.before(t.element))):this.childElementContainer.append(t.element),m.items.AbstractContentItem.prototype.addChild.call(this,t,e),n=1/this.contentItems.length*100,!0===i)this.emitBubblingEvent("stateChanged");else{for(s=0;s<this.contentItems.length;s++)this.contentItems[s]===t?t.config[this._dimension]=n:(o=this.contentItems[s].config[this._dimension]*=(100-n)/100,this.contentItems[s].config[this._dimension]=o);this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}},removeChild:function(t,e){var i,n=t.config[this._dimension],o=m.utils.indexOf(t,this.contentItems),s=Math.max(o-1,0);if(-1===o)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)),i=0;i<this.contentItems.length;i++)this.contentItems[i]!==t&&(this.contentItems[i].config[this._dimension]+=n/(this.contentItems.length-1));m.items.AbstractContentItem.prototype.removeChild.call(this,t,e),1===this.contentItems.length&&!0===this.config.isClosable?(o=this.contentItems[0],this.contentItems=[],this.parent.replaceChild(this,o,!0)):(this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged"))},replaceChild:function(t,e){var i=t.config[this._dimension];m.items.AbstractContentItem.prototype.replaceChild.call(this,t,e),e.config[this._dimension]=i,this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")},setSize:function(){0<this.contentItems.length&&(this._calculateRelativeSizes(),this._setAbsoluteSizes()),this.emitBubblingEvent("stateChanged"),this.emit("resize")},_$init:function(){var t;if(!0!==this.isInitialised)for(m.items.AbstractContentItem.prototype._$init.call(this),t=0;t<this.contentItems.length-1;t++)this.contentItems[t].element.after(this._createSplitter(t).element)},_setAbsoluteSizes:function(){for(var t=this._calculateAbsoluteSizes(),e=0;e<this.contentItems.length;e++)0<t.additionalPixel-e&&t.itemSizes[e]++,this._isColumn?(this.contentItems[e].element.width(t.totalWidth),this.contentItems[e].element.height(t.itemSizes[e])):(this.contentItems[e].element.width(t.itemSizes[e]),this.contentItems[e].element.height(t.totalHeight))},_calculateAbsoluteSizes:function(){var t,e,i=(this.contentItems.length-1)*this._splitterSize,n=this.element.width(),o=this.element.height(),s=0,r=[];for(this._isColumn?o-=i:n-=i,t=0;t<this.contentItems.length;t++)s+=e=this._isColumn?Math.floor(o*(this.contentItems[t].config.height/100)):Math.floor(n*(this.contentItems[t].config.width/100)),r.push(e);return{itemSizes:r,additionalPixel:Math.floor((this._isColumn?o:n)-s),totalWidth:n,totalHeight:o}},_calculateRelativeSizes:function(){for(var t=0,e=[],i=this._isColumn?"height":"width",n=0;n<this.contentItems.length;n++)void 0!==this.contentItems[n].config[i]?t+=this.contentItems[n].config[i]:e.push(this.contentItems[n]);if(100===Math.round(t))this._respectMinItemWidth();else if(Math.round(t)<100&&0<e.length){for(n=0;n<e.length;n++)e[n].config[i]=(100-t)/e.length;this._respectMinItemWidth()}else{if(100<Math.round(t))for(n=0;n<e.length;n++)t+=e[n].config[i]=50;for(n=0;n<this.contentItems.length;n++)this.contentItems[n].config[i]=this.contentItems[n].config[i]/t*100;this._respectMinItemWidth()}},_respectMinItemWidth:function(){var t,e,i,n,o=this.layoutManager.config.dimensions&&this.layoutManager.config.dimensions.minItemWidth||0,s=[],r=0,h=0,a=0,l=[];if(!(this._isColumn||!o||this.contentItems.length<=1)){for(var c=this._calculateAbsoluteSizes(),d=0;d<this.contentItems.length;d++)this.contentItems[d],(t=c.itemSizes[d])<o?(h+=o-t,n={width:o}):(r+=t-o,s.push(n={width:t})),l.push(n);if(!(0===h||r<h)){for(e=h/r,a=h,d=0;d<s.length;d++)n=s[d],a-=i=Math.round((n.width-o)*e),n.width-=i;for(0!==a&&(l[l.length-1].width-=a),d=0;d<this.contentItems.length;d++)this.contentItems[d].config.width=l[d].width/c.totalWidth*100}}},_createSplitter:function(t){var e=new m.controls.Splitter(this._isColumn,this._splitterSize,this._splitterGrabSize);return e.on("drag",m.utils.fnBind(this._onSplitterDrag,this,[e]),this),e.on("dragStop",m.utils.fnBind(this._onSplitterDragStop,this,[e]),this),e.on("dragStart",m.utils.fnBind(this._onSplitterDragStart,this,[e]),this),this._splitter.splice(t,0,e),e},_getItemsForSplitter:function(t){t=m.utils.indexOf(t,this._splitter);return{before:this.contentItems[t],after:this.contentItems[t+1]}},_getMinimumDimensions:function(t){for(var e=0,i=0,n=0;n<t.length;++n)e=Math.max(t[n].minWidth||0,e),i=Math.max(t[n].minHeight||0,i);return{horizontal:e,vertical:i}},_onSplitterDragStart:function(t){var t=this._getItemsForSplitter(t),e=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],i=this._getMinimumDimensions(t.before.config.content),i=this._isColumn?i.vertical:i.horizontal,n=this._getMinimumDimensions(t.after.config.content),n=this._isColumn?n.vertical:n.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(t.before.element[this._dimension]()-(i||e)),this._splitterMaxPosition=t.after.element[this._dimension]()-(n||e)},_onSplitterDrag:function(t,e,i){i=this._isColumn?i:e;i>this._splitterMinPosition&&i<this._splitterMaxPosition&&(this._splitterPosition=i,t.element.css(this._isColumn?"top":"left",i))},_onSplitterDragStop:function(t){var e=this._getItemsForSplitter(t),i=e.before.element[this._dimension](),n=e.after.element[this._dimension](),i=(this._splitterPosition+i)/(i+n),n=e.before.config[this._dimension]+e.after.config[this._dimension];e.before.config[this._dimension]=i*n,e.after.config[this._dimension]=(1-i)*n,t.element.css({top:0,left:0}),m.utils.animFrame(m.utils.fnBind(this.callDownwards,this,["setSize"]))}}),m.items.Stack=function(t,e,i){m.items.AbstractContentItem.call(this,t,e,i),this.element=r('<div class="lm_item lm_stack"></div>'),this._activeContentItem=null;i=t.config;this._header={show:!0===i.settings.hasHeaders&&!1!==e.hasHeaders,popout:i.settings.showPopoutIcon&&i.labels.popout,maximise:i.settings.showMaximiseIcon&&i.labels.maximise,close:i.settings.showCloseIcon&&i.labels.close,minimise:i.labels.minimise},i.header&&m.utils.copy(this._header,i.header),e.header&&m.utils.copy(this._header,e.header),e.content&&e.content[0]&&e.content[0].header&&m.utils.copy(this._header,e.content[0].header),this._dropZones={},this._dropSegment=null,this._contentAreaDimensions=null,this._dropIndex=null,this.isStack=!0,this.childElementContainer=r('<div class="lm_items"></div>'),this.header=new m.controls.Header(t,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()},m.utils.extend(m.items.Stack,m.items.AbstractContentItem),m.utils.copy(m.items.Stack.prototype,{setSize:function(){var t,e=this._header.show?this.layoutManager.config.dimensions.headerHeight:0,i=this.element.width()-(this._sided?e:0),n=this.element.height()-(this._sided?0:e);for(this.childElementContainer.width(i),this.childElementContainer.height(n),t=0;t<this.contentItems.length;t++)this.contentItems[t].element.width(i).height(n);this.emit("resize"),this.emitBubblingEvent("stateChanged")},_$init:function(){var t,e;if(!0!==this.isInitialised){for(this.header._attachWheelListener(),m.items.AbstractContentItem.prototype._$init.call(this),t=0;t<this.contentItems.length;t++)this.header.createTab(this.contentItems[t]),this.contentItems[t]._$hide();if(0<this.contentItems.length){if(!(e=this.contentItems[this.config.activeItemIndex||0]))throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(e)}}},setActiveContentItem:function(t){if(-1===m.utils.indexOf(t,this.contentItems))throw new Error("contentItem is not a child of this stack");null!==this._activeContentItem&&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:function(){return this.header.activeContentItem},addChild:function(t,e){t=this.layoutManager._$normalizeContentItem(t,this),m.items.AbstractContentItem.prototype.addChild.call(this,t,e),this.childElementContainer.append(t.element),this.header.createTab(t,e),this.setActiveContentItem(t),this.callDownwards("setSize"),this._$validateClosability(),this.emitBubblingEvent("stateChanged")},removeChild:function(t,e){var i=m.utils.indexOf(t,this.contentItems);m.items.AbstractContentItem.prototype.removeChild.call(this,t,e),this.header.removeTab(t),this.header.activeContentItem===t&&(0<this.contentItems.length?this.setActiveContentItem(this.contentItems[Math.max(i-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")},_$validateClosability:function(){for(var t=this.header._isClosable(),e=0,i=this.contentItems.length;e<i&&t;e++)t=this.contentItems[e].config.isClosable;this.header._$setClosable(t)},_$destroy:function(){m.items.AbstractContentItem.prototype._$destroy.call(this),this.header._$destroy()},_$onDrop:function(t){if("header"===this._dropSegment)return this._resetHeaderDropZone(),void this.addChild(t,this._dropIndex);var e,i,n,o,s;"body"===this._dropSegment?this.addChild(t):(e="top"===this._dropSegment||"bottom"===this._dropSegment,s="left"===this._dropSegment||"right"===this._dropSegment,i="top"===this._dropSegment||"left"===this._dropSegment,s=e&&this.parent.isColumn||s&&this.parent.isRow,n=e?"height":"width",t.isComponent&&((o=this.layoutManager.createContentItem({type:"stack",header:t.config.header||{}},this))._$init(),o.addChild(t),t=o),s?(o=m.utils.indexOf(this,this.parent.contentItems),this.parent.addChild(t,i?o:o+1,!0),this.config[n]*=.5,t.config[n]=this.config[n],this.parent.callDownwards("setSize")):(s=this.layoutManager.createContentItem({type:e?"column":"row"},this),this.parent.replaceChild(this,s),s.addChild(t,i?0:void 0,!0),s.addChild(this,i?void 0:0,!0),this.config[n]=50,t.config[n]=50,s.callDownwards("setSize")))},_$highlightDropZone:function(t,e){var i,n;for(i in this._contentAreaDimensions)if((n=this._contentAreaDimensions[i].hoverArea).x1<t&&n.x2>t&&n.y1<e&&n.y2>e)return void("header"===i?(this._dropSegment="header",this._highlightHeaderDropZone(t,e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(i)))},_$getArea:function(){if(!1===this.element.is(":visible"))return null;var t=m.items.AbstractContentItem.prototype._$getArea,e=t.call(this,this.header.element),i=t.call(this,this.childElementContainer),n=i.x2-i.x1,o=i.y2-i.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}},this._activeContentItem&&!1===this._activeContentItem.isComponent?e:(0===this.contentItems.length?this._contentAreaDimensions.body={hoverArea:{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},highlightArea:{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2}}:(this._contentAreaDimensions.left={hoverArea:{x1:i.x1,y1:i.y1,x2:i.x1+.25*n,y2:i.y2},highlightArea:{x1:i.x1,y1:i.y1,x2:i.x1+.5*n,y2:i.y2}},this._contentAreaDimensions.top={hoverArea:{x1:i.x1+.25*n,y1:i.y1,x2:i.x1+.75*n,y2:i.y1+.5*o},highlightArea:{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y1+.5*o}},this._contentAreaDimensions.right={hoverArea:{x1:i.x1+.75*n,y1:i.y1,x2:i.x2,y2:i.y2},highlightArea:{x1:i.x1+.5*n,y1:i.y1,x2:i.x2,y2:i.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:i.x1+.25*n,y1:i.y1+.5*o,x2:i.x1+.75*n,y2:i.y2},highlightArea:{x1:i.x1,y1:i.y1+.5*o,x2:i.x2,y2:i.y2}}),t.call(this,this.element))},_highlightHeaderDropZone:function(t){var e=this.header.tabs.length,i=null,n=null;if(0===e)return o=this.header.element.offset(),void this.layoutManager.dropTargetIndicator.highlightArea({x1:o.left,x2:o.left+100,y1:this.header.element.offset().top,y2:this.header.element.offset().top+this.header.element.innerHeight()});var o=this.header.tabsContainer.get(0).getBoundingClientRect(),s=this.layoutManager.tabDropPlaceholder.get(0).getBoundingClientRect();if(t<o.left?t=o.left+1:t>o.right&&(t=o.right-1),!(s.left<t&&t<s.right)){for(var r=0;r<e;r++)if((n=(i=this.header.tabs[r].element).get(0).getBoundingClientRect()).left<t&&t<n.right){this._dropIndex=r;break}i&&t<n.left+.5*n.width?i.before(this.layoutManager.tabDropPlaceholder):i&&(this._dropIndex=Math.min(this._dropIndex+1,e),i.after(this.layoutManager.tabDropPlaceholder))}o=this.layoutManager.tabDropPlaceholder.offset().left,s=(o=Math.max(o,this.header.tabsContainer.offset().left))+this.layoutManager.tabDropPlaceholder.width(),s=Math.min(s,this.header.tabsContainer.offset().left+this.header.tabsContainer.innerWidth());this.layoutManager.dropTargetIndicator.highlightArea({x1:o,x2:s,y1:this.header.element.offset().top,y2:this.header.element.offset().top+this.header.element.innerHeight()})},_resetHeaderDropZone:function(){this.layoutManager.tabDropPlaceholder.remove()},_setupHeaderPosition:function(){var t=0<=["right","left","bottom"].indexOf(this._header.show)&&this._header.show;this.header.element.toggle(!!this._header.show),this._side=t,this._sided=0<=["right","left"].indexOf(this._side),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&&(t=0<=["right","bottom"].indexOf(this._side)?"before":"after",this.header.element[t](this.childElementContainer),this.callDownwards("setSize"))},_highlightBodyDropZone:function(t){var e=this._contentAreaDimensions[t].highlightArea;this.layoutManager.dropTargetIndicator.highlightArea(e),this._dropSegment=t}}),m.utils.BubblingEvent=function(t,e){this.name=t,this.origin=e,this.isPropagationStopped=!1},m.utils.BubblingEvent.prototype.stopPropagation=function(){this.isPropagationStopped=!0},m.utils.ConfigMinifier=function(){if(this._keys=["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"],36<this._keys.length)throw new Error("Too many keys in config minifier map");this._values=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"]},m.utils.copy(m.utils.ConfigMinifier.prototype,{minifyConfig:function(t){var e={};return this._nextLevel(t,e,"_min"),e},unminifyConfig:function(t){var e={};return this._nextLevel(t,e,"_max"),e},_nextLevel:function(t,e,i){var n,o;for(n in t)t instanceof Array&&(n=parseInt(n,10)),t.hasOwnProperty(n)&&(o=this[i](n,this._keys),"object"==typeof t[n]?(e[o]=t[n]instanceof Array?[]:{},this._nextLevel(t[n],e[o],i)):e[o]=this[i](t[n],this._values))},_min:function(t,e){if("string"==typeof t&&1===t.length)return"___"+t;e=m.utils.indexOf(t,e);return-1===e?t:e.toString(36)},_max:function(t,e){return"string"==typeof t&&1===t.length?e[parseInt(t,36)]:"string"==typeof t&&"___"===t.substr(0,3)?t[3]:t}}),m.utils.EventHub=function(t){m.utils.EventEmitter.call(this),this._layoutManager=t,this._dontPropagateToParent=null,this._childEventSource=null,this.on(m.utils.EventEmitter.ALL_EVENT,m.utils.fnBind(this._onEventFromThis,this)),this._boundOnEventFromChild=m.utils.fnBind(this._onEventFromChild,this),r(window).on("gl_child_event",this._boundOnEventFromChild)},m.utils.EventHub.prototype._onEventFromThis=function(){var t=Array.prototype.slice.call(arguments);this._layoutManager.isSubWindow&&t[0]!==this._dontPropagateToParent&&this._propagateToParent(t),this._propagateToChildren(t),this._dontPropagateToParent=null,this._childEventSource=null},m.utils.EventHub.prototype._$onEventFromParent=function(t){this._dontPropagateToParent=t[0],this.emit.apply(this,t)},m.utils.EventHub.prototype._onEventFromChild=function(t){this._childEventSource=t.originalEvent.__gl,this.emit.apply(this,t.originalEvent.__glArgs)},m.utils.EventHub.prototype._propagateToParent=function(t){var e,i="gl_child_event";document.createEvent?(e=window.opener.document.createEvent("HTMLEvents")).initEvent(i,!0,!0):(e=window.opener.document.createEventObject()).eventType=i,e.eventName=i,e.__glArgs=t,e.__gl=this._layoutManager,document.createEvent?window.opener.dispatchEvent(e):window.opener.fireEvent("on"+e.eventType,e)},m.utils.EventHub.prototype._propagateToChildren=function(t){for(var e,i=0;i<this._layoutManager.openPopouts.length;i++)(e=this._layoutManager.openPopouts[i].getGlInstance())&&e!==this._childEventSource&&e.eventHub._$onEventFromParent(t)},m.utils.EventHub.prototype.destroy=function(){r(window).off("gl_child_event",this._boundOnEventFromChild)},m.utils.ReactComponentHandler=function(t,e){this._reactComponent=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)},m.utils.copy(m.utils.ReactComponentHandler.prototype,{_render:function(){ReactDOM.render(this._getReactComponent(),this._container.getElement()[0])},_gotReactComponent:function(t){t&&(this._reactComponent=t,this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate||function(){},this._reactComponent.componentWillUpdate=this._onUpdate.bind(this),this._container.getState()&&this._reactComponent.setState(this._container.getState()))},_destroy:function(){ReactDOM.unmountComponentAtNode(this._container.getElement()[0]),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)},_onUpdate:function(t,e){this._container.setState(e),this._originalComponentWillUpdate.call(this._reactComponent,t,e)},_getReactClass:function(){var t,e=this._container._config.component;if(!e)throw new Error("No react component name. type: react-component needs a field `component`");if(t=this._container.layoutManager.getComponent(e)||this._container.layoutManager.getFallbackComponent())return t;throw new Error('React component "'+e+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`')},_getReactComponent:function(){var t={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},t=r.extend(t,this._container._config.props);return React.createElement(this._reactClass,t)}})}(window.$);
1
+ !function(r){var m={config:{},container:{},controls:{},errors:{},items:{},utils:{}};m.utils.F=function(){},m.utils.extend=function(t,e){t.prototype=m.utils.createObject(e.prototype),t.prototype.contructor=t},m.utils.createObject=function(t){return"function"==typeof Object.create?Object.create(t):(m.utils.F.prototype=t,new m.utils.F)},m.utils.objectKeys=function(t){var e,i;if("function"==typeof Object.keys)return Object.keys(t);for(i in e=[],t)e.push(i);return e},m.utils.getHashValue=function(t){t=location.hash.match(new RegExp(t+"=([^&]*)"));return t?t[1]:null},m.utils.getQueryStringParam=function(t){if(window.location.hash)return m.utils.getHashValue(t);if(!window.location.search)return null;for(var e,i=window.location.search.substr(1).split("&"),n={},o=0;o<i.length;o++)n[(e=i[o].split("="))[0]]=e[1];return n[t]||null},m.utils.copy=function(t,e){for(var i in e)t[i]=e[i];return t},m.utils.animFrame=function(t){return(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)})(function(){t()})},m.utils.indexOf=function(t,e){if(!(e instanceof Array))throw new Error("Haystack is not an Array");if(e.indexOf)return e.indexOf(t);for(var i=0;i<e.length;i++)if(e[i]===t)return i;return-1},"function"!=typeof/./&&"object"!=typeof Int8Array?m.utils.isFunction=function(t){return"function"==typeof t||!1}:m.utils.isFunction=function(t){return"[object Function]"===toString.call(t)},m.utils.fnBind=function(e,i,n){if(void 0!==Function.prototype.bind)return Function.prototype.bind.apply(e,[i].concat(n||[]));function o(){var t=(n||[]).concat(Array.prototype.slice.call(arguments,0));if(!(this instanceof o))return e.apply(i,t);e.apply(this,t)}return o.prototype=e.prototype,o},m.utils.removeFromArray=function(t,e){t=m.utils.indexOf(t,e);if(-1===t)throw new Error("Can't remove item from array. Item is not in the array");e.splice(t,1)},m.utils.now=function(){return"function"==typeof Date.now?Date.now():(new Date).getTime()},m.utils.getUniqueId=function(){return(1e15*Math.random()).toString(36).replace(".","")},m.utils.filterXss=function(t,e){t=t.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!0===e?t:t.replace(/>/g,"&gt;").replace(/</g,"&lt;")},m.utils.stripTags=function(t){return r.trim(t.replace(/(<([^>]+)>)/gi,""))},m.utils.EventEmitter=function(){this._mSubscriptions={},this._mSubscriptions[m.utils.EventEmitter.ALL_EVENT]=[],this.on=function(t,e,i){if(!m.utils.isFunction(e))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:i})},this.emit=function(t){var e,i=Array.prototype.slice.call(arguments,1),n=this._mSubscriptions[t];if(n)for(n=n.slice(),s=0;s<n.length;s++)e=n[s].ctx||{},n[s].fn.apply(e,i);i.unshift(t);for(var o=this._mSubscriptions[m.utils.EventEmitter.ALL_EVENT].slice(),s=0;s<o.length;s++)e=o[s].ctx||{},o[s].fn.apply(e,i)},this.unbind=function(t,e,i){if(!this._mSubscriptions[t])throw new Error("No subscribtions to unsubscribe for event "+t);for(var n=!1,o=0;o<this._mSubscriptions[t].length;o++)e&&this._mSubscriptions[t][o].fn!==e||i&&i!==this._mSubscriptions[t][o].ctx||(this._mSubscriptions[t].splice(o,1),n=!0);if(!1===n)throw new Error("Nothing to unbind for "+t)},this.off=this.unbind,this.trigger=this.emit},m.utils.EventEmitter.ALL_EVENT="__all",m.utils.DragListener=function(t,e){m.utils.EventEmitter.call(this),this._eElement=r(t),this._oDocument=r(document),this._eBody=r(document.body),this._destroyAfterMouseUp=e||!1,this._nDelay=400,this._timeout=null,this._nDistance=10,this._nX=0,this._nY=0,this._nOriginalX=0,this._nOriginalY=0,this._bDragging=!1,this._fMove=m.utils.fnBind(this.onMouseMove,this),this._fUp=m.utils.fnBind(this.onMouseUp,this),this._fDown=m.utils.fnBind(this.onMouseDown,this),this._eElement.on("mousedown",this._fDown)},m.utils.DragListener.timeout=null,m.utils.copy(m.utils.DragListener.prototype,{destroy:function(){this._eElement.unbind("mousedown",this._fDown),this._oDocument.unbind("mouseup",this._fUp),this._eElement=null,this._oDocument=null,this._eBody=null,clearTimeout(this._timeout),this._timeout=null},onMouseDown:function(t){t.preventDefault(),0===t.button&&(t=this._getCoordinates(t),this._nOriginalX=t.x,this._nOriginalY=t.y,this._oDocument.on("mousemove",this._fMove),this._oDocument.one("mouseup",this._fUp),this._timeout=setTimeout(m.utils.fnBind(this._startDrag,this),this._nDelay))},onMouseMove:function(t){var e;null!=this._timeout&&(t.preventDefault(),e=this._getCoordinates(t),this._nX=e.x-this._nOriginalX,this._nY=e.y-this._nOriginalY,!1===this._bDragging&&(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:function(t){null!=this._timeout&&(clearTimeout(this._timeout),this._oDocument.unbind("mousemove",this._fMove),this._oDocument.unbind("mouseup",this._fUp),this._oDocument.find("iframe").css("pointer-events",""),!0===this._bDragging&&(this._bDragging=!1,this.emit("dragStop",t,this._nOriginalX+this._nX)),this._eBody&&this._eBody.removeClass("lm_dragging"),this._eElement&&this._eElement.removeClass("lm_dragging"),this._destroyAfterMouseUp&&this.destroy())},_startDrag:function(){clearTimeout(this._timeout),this._bDragging=!0,this._eBody.addClass("lm_dragging"),this._eElement.addClass("lm_dragging"),this._oDocument.find("iframe").css("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)},_getCoordinates:function(t){return{x:(t=t.originalEvent&&t.originalEvent.touches?t.originalEvent.touches[0]:t).pageX,y:t.pageY}}}),m.LayoutManager=function(t,e){if(!r||"function"!=typeof r.noConflict)throw new Error('jQuery is missing as dependency for GoldenLayout. Please either expose $ on GoldenLayout\'s scope (e.g. window) or add "jquery" to your paths when using RequireJS/AMD');m.utils.EventEmitter.call(this),this.isInitialised=!1,this._isFullPage=!1,this._resizeTimeoutId=null,this._components={"lm-react-component":m.utils.ReactComponentHandler},this._fallbackComponent=void 0,this._itemAreas=[],this._resizeFunction=m.utils.fnBind(this._onResize,this),this._unloadFunction=m.utils.fnBind(this._onUnload,this),this._windowBlur=this._windowBlur.bind(this),this._windowFocus=this._windowFocus.bind(this),this._maximisedItem=null,this._maximisePlaceholder=r('<div class="lm_maximise_place"></div>'),this._creationTimeoutPassed=!1,this._subWindowsCreated=!1,this._dragSources=[],this._updatingColumnsResponsive=!1,this._firstLoad=!0,this.width=null,this.height=null,this.root=null,this.openPopouts=[],this.selectedItem=null,this.isSubWindow=!1,this.eventHub=new m.utils.EventHub(this),this.config=this._createConfig(t),this.container=e,this.dropTargetIndicator=null,this.transitionIndicator=null,this.tabDropPlaceholder=r('<div class="lm_drop_tab_placeholder"></div>'),!0===this.isSubWindow&&r("body").css("visibility","hidden"),this._typeToItem={column:m.utils.fnBind(m.items.RowOrColumn,this,[!0]),row:m.utils.fnBind(m.items.RowOrColumn,this,[!1]),stack:m.items.Stack,component:m.items.Component}},(m.LayoutManager.__lm=m).LayoutManager.minifyConfig=function(t){return(new m.utils.ConfigMinifier).minifyConfig(t)},m.LayoutManager.unminifyConfig=function(t){return(new m.utils.ConfigMinifier).unminifyConfig(t)},m.utils.copy(m.LayoutManager.prototype,{registerComponent:function(t,e){if("function"!=typeof e&&(null==e||null==e.render||"function"!=typeof e.render))throw new Error("Please register a constructor function");if(void 0!==this._components[t])throw new Error("Component "+t+" is already registered");return this._components[t]=e,function(){if(void 0===this._components[t])throw new Error("Component "+t+" is not registered");delete this._components[t]}.bind(this)},setFallbackComponent:function(t){this._fallbackComponent=t},toConfig:function(t){var e,o,i;if(!1===this.isInitialised)throw new Error("Can't create config, layout not yet initialised");if(t&&!(t instanceof m.items.AbstractContentItem))throw new Error("Root must be a ContentItem");for(e={settings:m.utils.copy({},this.config.settings),dimensions:m.utils.copy({},this.config.dimensions),labels:m.utils.copy({},this.config.labels),content:[]},(o=function(t,e){var i,n;for(i in e.config)"content"!==i&&(t[i]=e.config[i]);if("lm-react-component"===t.componentName&&(t.type="react-component"),e.contentItems.length)for(t.content=[],n=0;n<e.contentItems.length;n++)t.content[n]={},o(t.content[n],e.contentItems[n])})(e,t?{contentItems:[t]}:this.root),this._$reconcilePopoutWindows(),e.openPopouts=[],i=0;i<this.openPopouts.length;i++)e.openPopouts.push(this.openPopouts[i].toConfig());return e.maximisedItemId=this._maximisedItem?"__glMaximised":null,e},getComponent:function(t){return this._components[t]},getFallbackComponent:function(){return this._fallbackComponent},init:function(){if(!1===this._subWindowsCreated&&(this._createSubWindows(),this._subWindowsCreated=!0),"loading"===document.readyState||null===document.body)r(document).ready(m.utils.fnBind(this.init,this));else{if(!0===this.isSubWindow&&!1===this._creationTimeoutPassed)return setTimeout(m.utils.fnBind(this.init,this),7),void(this._creationTimeoutPassed=!0);!0===this.isSubWindow&&this._adjustToWindowMode(),this._setContainer(),this.dropTargetIndicator=new m.controls.DropTargetIndicator(this.container),this.transitionIndicator=new m.controls.TransitionIndicator,this.updateSize(),this._create(this.config),this._bindEvents(),this.isInitialised=!0,this._adjustColumnsResponsive(),this.emit("initialised")}},updateSize:function(t,e){2===arguments.length?(this.width=t,this.height=e):(this.width=this.container.width(),this.height=this.container.height()),!0===this.isInitialised&&(this.root.callDownwards("setSize",[this.width,this.height]),this._maximisedItem&&(this._maximisedItem.element.width(this.container.width()),this._maximisedItem.element.height(this.container.height()),this._maximisedItem.callDownwards("setSize")),this._adjustColumnsResponsive())},destroy:function(){!1!==this.isInitialised&&(this._onUnload(),r(window).off("resize",this._resizeFunction),r(window).off("unload beforeunload",this._unloadFunction),r(window).off("blur.lm").off("focus.lm"),this.root.callDownwards("_$destroy",[],!0),this.root.contentItems=[],this.tabDropPlaceholder.remove(),this.dropTargetIndicator.destroy(),this.transitionIndicator.destroy(),this.eventHub.destroy(),this._dragSources.forEach(function(t){t._dragListener.destroy(),t._element=null,t._itemConfig=null,t._dragListener=null}),this._dragSources=[])},createContentItem:function(t,e){if("string"!=typeof t.type)throw new m.errors.ConfigurationError("Missing parameter 'type'",t);if("react-component"===t.type&&(t.type="component",t.componentName="lm-react-component"),this._typeToItem[t.type])return"component"!==t.type||e instanceof m.items.Stack||!e||!0===this.isSubWindow&&e instanceof m.items.Root||(t={type:"stack",width:t.width,height:t.height,content:[t]}),new this._typeToItem[t.type](this,t,e);throw e="Unknown type '"+t.type+"'. Valid types are "+m.utils.objectKeys(this._typeToItem).join(","),new m.errors.ConfigurationError(e)},createPopout:function(t,e,i,n){var o,s,r,h,a,l=t,c=t instanceof m.items.AbstractContentItem,d=this;if(i=i||null,c){for(l=this.toConfig(t).content,i=m.utils.getUniqueId(),r=t.parent,h=t;1===r.contentItems.length&&!r.isRoot;)r=r.parent,h=h.parent;r.addId(i),isNaN(n)&&(n=m.utils.indexOf(h,r.contentItems))}else l instanceof Array||(l=[l]);return!e&&c&&(s=window.screenX||window.screenLeft,o=window.screenY||window.screenTop,e={left:s+(s=t.element.offset()).left,top:o+s.top,width:t.element.width(),height:t.element.height()}),e||c||(e={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),c&&t.remove(),(a=new m.controls.BrowserPopout(l,e,i,n,this)).on("initialised",function(){d.emit("windowOpened",a)}),a.on("closed",function(){d._$reconcilePopoutWindows()}),this.openPopouts.push(a),a},createDragSource:function(t,e){this.config.settings.constrainDragToContainer=!1;t=new m.controls.DragSource(r(t),e,this);return this._dragSources.push(t),t},createDragSourceFromEvent:function(t,e){return this.config.settings.constrainDragToContainer=!1,new m.controls.DragSourceFromEvent(t,this,e)},selectItem:function(t,e){if(!0!==this.config.settings.selectionEnabled)throw new Error("Please set selectionEnabled to true to use this feature");t!==this.selectedItem&&(null!==this.selectedItem&&this.selectedItem.deselect(),t&&!0!==e&&t.select(),this.selectedItem=t,this.emit("selectionChanged",t))},_$maximiseItem:function(t){null!==this._maximisedItem&&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(this.container.width()),t.element.height(this.container.height()),t.callDownwards("setSize"),this._maximisedItem.emit("maximised"),this.emit("stateChanged")},_$minimiseItem:function(t){t.element.removeClass("lm_maximised"),t.removeId("__glMaximised"),this._maximisePlaceholder.after(t.element),this._maximisePlaceholder.remove(),t.parent.callDownwards("setSize"),this._maximisedItem=null,t.emit("minimised"),this.emit("stateChanged")},_$closeWindow:function(){window.setTimeout(function(){window.close()},1)},_$getArea:function(t,e){for(var i,n=1/0,o=null,s=0;s<this._itemAreas.length;s++)t>(i=this._itemAreas[s]).x1&&t<i.x2&&e>i.y1&&e<i.y2&&n>i.surface&&(n=i.surface,o=i);return o},_$createRootItemAreas:function(){var t,e={y2:"y1",x2:"x1",y1:"y2",x1:"x2"};for(t in e){var i=this.root._$getArea();"2"==e[i.side=t][1]?i[t]=i[e[t]]-50:i[t]=i[e[t]]+50,i.surface=(i.x2-i.x1)*(i.y2-i.y1),this._itemAreas.push(i)}},_$calculateItemAreas:function(){var t,e,i,n=this._getAllContentItems();if(this._itemAreas=[],1===n.length)this._itemAreas.push(this.root._$getArea());else for(this._$createRootItemAreas(),t=0;t<n.length;t++)n[t].isStack&&null!==(i=n[t]._$getArea())&&(i instanceof Array?this._itemAreas=this._itemAreas.concat(i):(this._itemAreas.push(i),m.utils.copy(e={},i),m.utils.copy(e,i.contentItem._contentAreaDimensions.header.highlightArea),e.surface=(e.x2-e.x1)*(e.y2-e.y1),this._itemAreas.push(e)))},_$normalizeContentItem:function(t,e){if(!t)throw new Error("No content item defined");if((t=m.utils.isFunction(t)?t():t)instanceof m.items.AbstractContentItem)return t;if(r.isPlainObject(t)&&t.type)return(t=this.createContentItem(t,e)).callDownwards("_$init"),t;throw new Error("Invalid contentItem")},_$reconcilePopoutWindows:function(){for(var t=[],e=0;e<this.openPopouts.length;e++)!1===this.openPopouts[e].getWindow().closed?t.push(this.openPopouts[e]):this.emit("windowClosed",this.openPopouts[e]);this.openPopouts.length!==t.length&&(this.emit("stateChanged"),this.openPopouts=t)},_getAllContentItems:function(){function i(t){if(n.push(t),t.contentItems instanceof Array)for(var e=0;e<t.contentItems.length;e++)i(t.contentItems[e])}var n=[];return i(this.root),n},_bindEvents:function(){this._isFullPage&&r(window).resize(this._resizeFunction),r(window).on("unload beforeunload",this._unloadFunction).on("blur.lm",this._windowBlur).on("focus.lm",this._windowFocus)},_windowBlur:function(){this.root.element.addClass("lm_window_blur")},_windowFocus:function(){this.root.element.removeClass("lm_window_blur")},_onResize:function(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=setTimeout(m.utils.fnBind(this.updateSize,this),100)},_createConfig:function(t){var e=m.utils.getQueryStringParam("gl-window"),i=(e&&(this.isSubWindow=!0,t=localStorage.getItem(e),t=JSON.parse(t),t=(new m.utils.ConfigMinifier).unminifyConfig(t),localStorage.removeItem(e)),t=r.extend(!0,{},m.config.defaultConfig,t),function(t){for(var e in t)"props"!==e&&"object"==typeof t[e]?i(t[e]):"type"===e&&"react-component"===t[e]&&(t.type="component",t.componentName="lm-react-component")});return i(t),!1===t.settings.hasHeaders&&(t.dimensions.headerHeight=0),t},_adjustToWindowMode:function(){var t=r('<div class="lm_popin" title="'+this.config.labels.popin+'"><div class="lm_icon"></div><div class="lm_bg"></div></div>');t.click(m.utils.fnBind(function(){this.emit("popIn")},this)),document.title=m.utils.stripTags(this.config.content[0].title),r("head").append(r("body link, body style, template, .gl_keep")),this.container=r("body").html("").css("visibility","visible").append(t),document.body.offsetHeight;window.__glInstance=this},_createSubWindows:function(){for(var t,e=0;e<this.config.openPopouts.length;e++)t=this.config.openPopouts[e],this.createPopout(t.content,t.dimensions,t.parentId,t.indexInParent)},_setContainer:function(){var t=r(this.container||"body");if(0===t.length)throw new Error("GoldenLayout container not found");if(1<t.length)throw new Error("GoldenLayout more than one container element specified");t[0]===document.body&&(this._isFullPage=!0,r("html, body").css({height:"100%",margin:0,padding:0,overflow:"hidden"})),this.container=t},_create:function(t){var e;if(!(t.content instanceof Array))throw e=void 0===t.content?"Missing setting 'content' on top level of configuration":"Configuration parameter 'content' must be an array",new m.errors.ConfigurationError(e,t);if(1<t.content.length)throw new m.errors.ConfigurationError(e="Top level content can't contain more then one element.",t);this.root=new m.items.Root(this,{content:t.content},this.container),this.root.callDownwards("_$init"),"__glMaximised"===t.maximisedItemId&&this.root.getItemsById(t.maximisedItemId)[0].toggleMaximise()},_onUnload:function(){if(!0===this.config.settings.closePopoutsOnUnload)for(var t=0;t<this.openPopouts.length;t++)this.openPopouts[t].close()},_adjustColumnsResponsive:function(){if(this._useResponsiveLayout()&&!this._updatingColumnsResponsive&&this.config.dimensions&&this.config.dimensions.minItemWidth&&0!==this.root.contentItems.length&&this.root.contentItems[0].isRow){this._firstLoad=!1;var t=this.root.contentItems[0].contentItems.length;if(!(t<=1)){var e=this.config.dimensions.minItemWidth,i=t*e;if(!(i<=this.width)){this._updatingColumnsResponsive=!0;for(var n=t-Math.max(Math.floor(this.width/e),1),o=this.root.contentItems[0],s=this._findAllStackContainers()[0],r=0;r<n;r++){var h=o.contentItems[o.contentItems.length-1];this._addChildContentItemsToContainer(s,h)}this._updatingColumnsResponsive=!1}}}else this._firstLoad=!1},_useResponsiveLayout:function(){return this.config.settings&&("always"==this.config.settings.responsiveMode||"onload"==this.config.settings.responsiveMode&&this._firstLoad)},_addChildContentItemsToContainer:function(e,i){"stack"===i.type?i.contentItems.forEach(function(t){e.addChild(t),i.removeChild(t,!0)}):i.contentItems.forEach(m.utils.fnBind(function(t){this._addChildContentItemsToContainer(e,t)},this))},_findAllStackContainers:function(){var t=[];return this._findAllStackContainersRecursive(t,this.root),t},_findAllStackContainersRecursive:function(e,t){t.contentItems.forEach(m.utils.fnBind(function(t){"stack"==t.type?e.push(t):t.isComponent||this._findAllStackContainersRecursive(e,t)},this))}}),"function"==typeof define&&define.amd?define(["jquery"],function(t){return r=t,m.LayoutManager}):"object"==typeof exports?module.exports=m.LayoutManager:window.GoldenLayout=m.LayoutManager,m.config.itemDefaultConfig={isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""},m.config.defaultConfig={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"}},m.container.ItemContainer=function(t,e,i){m.utils.EventEmitter.call(this),this.width=null,this.height=null,this.title=t.componentName,this.parent=e,this.layoutManager=i,this.isHidden=!1,this._config=t,this._element=r(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join("")),this._contentElement=this._element.find(".lm_content")},m.utils.copy(m.container.ItemContainer.prototype,{getElement:function(){return this._contentElement},hide:function(){this.emit("hide"),this.isHidden=!0,this._element.hide()},show:function(){this.emit("show"),this.isHidden=!1,this._element.show(),0==this.height&&0==this.width||this.emit("shown")},setSize:function(t,e){for(var i,n,o,s,r,h=this.parent,a=this;!h.isColumn&&!h.isRow;)if((h=(a=h).parent).isRoot)return!1;for(i=this[o=h.isColumn?"height":"width"]*(1/(a.config[o]/100)),s=(a.config[o]-(n=("height"==o?e:t)/i*100))/(h.contentItems.length-1),r=0;r<h.contentItems.length;r++)h.contentItems[r]===a?h.contentItems[r].config[o]=n:h.contentItems[r].config[o]+=s;return h.callDownwards("setSize"),!0},close:function(){this._config.isClosable&&(this.emit("close"),this.parent.close())},getState:function(){return this._config.componentState},extendState:function(t){this.setState(r.extend(!0,this.getState(),t))},setState:function(t){this._config.componentState=t,this.parent.emitBubblingEvent("stateChanged")},setTitle:function(t){this.parent.setTitle(t)},_$setSize:function(t,e){t===this.width&&e===this.height||(this.width=t,this.height=e,e=(t=this._contentElement[0]).offsetWidth-t.clientWidth,t=t.offsetHeight-t.clientHeight,this._contentElement.width(this.width-e).height(this.height-t),this.emit("resize"))}}),m.controls.BrowserPopout=function(t,e,i,n,o){m.utils.EventEmitter.call(this),this.isInitialised=!1,this._config=t,this._dimensions=e,this._parentId=i,this._indexInParent=n,this._layoutManager=o,this._popoutWindow=null,this._id=null,this._createWindow()},m.utils.copy(m.controls.BrowserPopout.prototype,{toConfig:function(){if(!1===this.isInitialised)throw new Error("Can't create config, layout not yet initialised");return{dimensions:{width:this.getGlInstance().width,height:this.getGlInstance().height,left:this._popoutWindow.screenX||this._popoutWindow.screenLeft,top:this._popoutWindow.screenY||this._popoutWindow.screenTop},content:this.getGlInstance().toConfig().content,parentId:this._parentId,indexInParent:this._indexInParent}},getGlInstance:function(){return this._popoutWindow.__glInstance},getWindow:function(){return this._popoutWindow},close:function(){if(this.getGlInstance())this.getGlInstance()._$closeWindow();else try{this.getWindow().close()}catch(t){}},popIn:function(){var t,e;this._indexInParent;this._parentId&&(t=r.extend(!0,{},this.getGlInstance().toConfig()).content[0],e=(e=this._layoutManager.root.getItemsById(this._parentId)[0])||(0<this._layoutManager.root.contentItems.length?this._layoutManager.root.contentItems[0]:this._layoutManager.root)),e.addChild(t,this._indexInParent),this.close()},_createWindow:function(){var t,e=this._createUrl(),i=Math.floor(1e6*Math.random()).toString(36),n=this._serializeWindowOptions({width:this._dimensions.width,height:this._dimensions.height,innerWidth:this._dimensions.width,innerHeight:this._dimensions.height,menubar:"no",toolbar:"no",location:"no",personalbar:"no",resizable:"yes",scrollbars:"no",status:"no"});if(this._popoutWindow=window.open(e,i,n),this._popoutWindow)r(this._popoutWindow).on("load",m.utils.fnBind(this._positionWindow,this)).on("unload beforeunload",m.utils.fnBind(this._onClose,this)),t=setInterval(m.utils.fnBind(function(){this._popoutWindow.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),clearInterval(t))},this),10);else if(!0===this._layoutManager.config.settings.blockedPopoutsThrowError)throw(e=new Error("Popout blocked")).type="popoutBlocked",e},_serializeWindowOptions:function(t){var e,i=[];for(e in t)i.push(e+"="+t[e]);return i.join(",")},_createUrl:function(){var t={content:this._config},e="gl-window-config-"+m.utils.getUniqueId(),t=(new m.utils.ConfigMinifier).minifyConfig(t);try{localStorage.setItem(e,JSON.stringify(t))}catch(t){throw new Error("Error while writing to localStorage "+t.toString())}return 1===(t=document.location.href.split("?")).length?t[0]+"?gl-window="+e:document.location.href+"&gl-window="+e},_positionWindow:function(){this._popoutWindow.moveTo(this._dimensions.left,this._dimensions.top),this._popoutWindow.focus()},_onInitialised:function(){this.isInitialised=!0,this.getGlInstance().on("popIn",this.popIn,this),this.emit("initialised")},_onClose:function(){setTimeout(m.utils.fnBind(this.emit,this,["closed"]),50)}}),m.controls.DragProxy=function(t,e,i,n,o,s){m.utils.EventEmitter.call(this),this._dragListener=i,this._layoutManager=n,this._contentItem=o,this._originalParent=s,this._area=null,this._lastValidArea=null,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element&&(this._layoutManager.tabDropPlaceholder.width(this._contentItem.tab.element.outerWidth(!0)),this._layoutManager.tabDropPlaceholder.height(this._contentItem.tab.element.outerHeight(!0))),this.element=r(m.controls.DragProxy._template),s&&s._side&&(this._sided=s._sided,this.element.addClass("lm_"+s._side),0<=["right","bottom"].indexOf(s._side)&&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",m.utils.stripTags(this._contentItem.config.title)),this.element.find(".lm_title").html(this._contentItem.config.title),this.childElementContainer=this.element.find(".lm_content"),this.childElementContainer.append(o.element),this._updateTree(),this._layoutManager._$calculateItemAreas(),this._setDimensions(),r(document.body).append(this.element),!this._contentItem.tab&&this._proxyTab.length&&(this._layoutManager.tabDropPlaceholder.width(this._proxyTab.outerWidth(!0)),this._layoutManager.tabDropPlaceholder.height(this._proxyTab.outerHeight(!0)));i=this._layoutManager.container.offset();this._minX=i.left,this._minY=i.top,this._maxX=this._layoutManager.container.width()+this._minX,this._maxY=this._layoutManager.container.height()+this._minY,this._width=this.element.width(),this._height=this.element.height(),this._setDropPosition(t,e),this._layoutManager.emit("itemPickedUp",this._contentItem)},m.controls.DragProxy._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>',m.utils.copy(m.controls.DragProxy.prototype,{_onDrag:function(t,e,i){var n=(i=i.originalEvent&&i.originalEvent.touches?i.originalEvent.touches[0]:i).pageX,i=i.pageY;(n>this._minX&&n<this._maxX&&i>this._minY&&i<this._maxY||!0!==this._layoutManager.config.settings.constrainDragToContainer)&&this._setDropPosition(n,i)},_setDropPosition:function(t,e){this.element.css({left:t,top:e}),this._area=this._layoutManager._$getArea(t,e),null!==this._area&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(t,e,this._area))},_onDrop:function(){this._layoutManager.dropTargetIndicator.hide(),null!==this._area?this._area.contentItem._$onDrop(this._contentItem,this._area):null!==this._lastValidArea?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:function(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(this)},_setDimensions:function(){var t=this._layoutManager.config.dimensions,e=t.dragProxyWidth,i=t.dragProxyHeight;this.element.width(e),this.element.height(i),e-=this._sided?t.headerHeight:0,i-=this._sided?0:t.headerHeight,this.childElementContainer.width(e),this.childElementContainer.height(i),this._contentItem.element.width(e),this._contentItem.element.height(i),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}),m.controls.DragSource=function(t,e,i){this._element=t,this._itemConfig=e,this._layoutManager=i,this._dragListener=null,this._createDragListener()},m.utils.copy(m.controls.DragSource.prototype,{_createDragListener:function(){this._dragListener=new m.utils.DragListener(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this)},_onDragStart:function(t,e){var i=this._itemConfig,i=(m.utils.isFunction(i)&&(i=i()),this._layoutManager._$normalizeContentItem(r.extend(!0,{},i))),t=new m.controls.DragProxy(t,e,this._dragListener,this._layoutManager,i,null);this._layoutManager.transitionIndicator.transitionElements(this._element,t.element)}}),m.controls.DragSourceFromEvent=function(t,e,i){this._element=r(window),this._itemConfig=t,this._layoutManager=e,this._dragListener=null,this._createDragListener(i)},m.utils.copy(m.controls.DragSourceFromEvent.prototype,{_createDragListener:function(t){null!==this._dragListener&&this._dragListener.destroy(),this._dragListener=new m.utils.DragListener(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._destroy,this),this._dragListener._fDown(t),this._dragListener._startDrag()},_destroy:function(){this._dragListener=null,this._element=null,this._itemConfig=null,this._layoutManager=null},_onDragStart:function(t,e){var i=this._itemConfig,i=(m.utils.isFunction(i)&&(i=i()),this._layoutManager._$normalizeContentItem(r.extend(!0,{},i)));new m.controls.DragProxy(t,e,this._dragListener,this._layoutManager,i,null)}}),m.controls.DropTargetIndicator=function(){this.element=r(m.controls.DropTargetIndicator._template),r(document.body).append(this.element)},m.controls.DropTargetIndicator._template='<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>',m.utils.copy(m.controls.DropTargetIndicator.prototype,{destroy:function(){this.element.remove()},highlightArea:function(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:function(){this.element.hide()}}),m.controls.Header=function(t,e){m.utils.EventEmitter.call(this),this.layoutManager=t,this.element=r(m.controls.Header._template),!0===this.layoutManager.config.settings.selectionEnabled&&(this.element.addClass("lm_selectable"),this.element.on("click",m.utils.fnBind(this._onHeaderClick,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.tabDropdownList=null,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.tabs=[],this.activeContentItem=null,this.closeButton=null,this.tabDropdownButton=null,this.tabNextButton=r(m.controls.Header._nextButtonTemplate),this.tabPreviousButton=r(m.controls.Header._previousButtonTemplate),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.holdTimer=null,this.rAF=null,this.CLICK_TIMEOUT=500,this.START_SPEED=.01,this.ACCELERATION=5e-4,this.SCROLL_LEFT="left",this.SCROLL_RIGHT="right",this.layoutManager.on("itemPickedUp",this._handleItemPickedUp),this.layoutManager.on("itemDropped",this._handleItemDropped),this.isDraggingTab=!1,this.isOverflowing=!1,this.isDropdownShown=!1,this.dropdownKeyIndex=0,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._lastVisibleTabIndex=-1,this._tabControlOffset=this.layoutManager.config.settings.tabControlOffset,this._createControls()},m.controls.Header._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(""),m.controls.Header._previousButtonTemplate=['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""),m.controls.Header._nextButtonTemplate=['<li class="lm_tabnextbutton"></li>'].join(""),m.utils.copy(m.controls.Header.prototype,{createTab:function(t,e){for(var i,n=0;n<this.tabs.length;n++)if(this.tabs[n].contentItem===t)return;if(i=new m.controls.Tab(this,t),0===this.tabs.length)return this.tabs.push(i),void this.tabsContainer.append(i.element);0<(e=void 0===e?this.tabs.length:e)?this.tabs[e-1].element.after(i.element):this.tabs[0].element.before(i.element),this.tabs.splice(e,0,i),this._updateTabSizes()},removeTab:function(t){for(var e=0;e<this.tabs.length;e++)if(this.tabs[e].contentItem===t)return this.tabs[e]._$destroy(),void this.tabs.splice(e,1);throw new Error("contentItem is not controlled by this header")},setActiveContentItem:function(t){for(var e,i=0;i<this.tabs.length;i++)e=this.tabs[i].contentItem===t,this.tabs[i].setActive(e),!0==e&&(this.activeContentItem=t,this.parent.config.activeItemIndex=i);this.tabs[this.parent.config.activeItemIndex].element.get(0).scrollIntoView({inline:"nearest"}),this._hideAdditionalTabsDropdown(),this._updateTabSizes(),this.parent.emitBubblingEvent("stateChanged")},position:function(t){var e=this.parent._header.show;return e&&!this.parent._side&&(e="top"),void 0!==t&&this.parent._header.show!==t&&(this.parent._header.show=t,this.parent._setupHeaderPosition()),e},_attachWheelListener:function(){this.tabsContainer.get(0).addEventListener("wheel",this._handleWheelEvent,{passive:!0})},_detachWheelListener:function(){this.tabsContainer.get(0).removeEventListener("wheel",this._handleWheelEvent,{passive:!0})},_handleWheelEvent:function(t){var e=t.currentTarget,i=Math.abs(t.deltaY)>Math.abs(t.deltaX)?t.deltaY:t.deltaX;t.deltaMode===WheelEvent.DOM_DELTA_PAGE?i*=this.tabsContainer.innerWidhth():t.deltaMode===WheelEvent.DOM_DELTA_LINE&&(i*=100/3),e.scrollLeft+=Math.round(i)},_handleScrollEvent:function(){this._checkScrollArrows()},_handleItemPickedUp:function(){this.isDraggingTab=!0,this.controlsContainer.on("mouseenter",this._handleNextMouseEnter),this.tabPreviousButton.on("mouseenter",this._handlePreviousMouseEnter)},_handleItemDropped:function(){this.isDraggingTab=!1,this.rAF=window.cancelAnimationFrame(this.rAF),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:function(){this.controlsContainer.on("mouseleave",this._handleNextMouseLeave),this._handleScrollRepeat(this.SCROLL_RIGHT,this.tabsContainer.scrollLeft())},_handlePreviousMouseEnter:function(){this.tabPreviousButton.on("mouseleave",this._handlePreviousMouseLeave),this._handleScrollRepeat(this.SCROLL_LEFT,this.tabsContainer.scrollLeft())},_handleNextMouseLeave:function(){this.rAF=window.cancelAnimationFrame(this.rAF),this.controlsContainer.off("mouseleave",this._handleNextMouseLeave)},_handlePreviousMouseLeave:function(){this.rAF=window.cancelAnimationFrame(this.rAF),this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)},_handleNextButtonMouseDown:function(){for(var t,e=0;e<this.tabs.length;e+=1)if(this.tabs[e].element.get(0).offsetLeft>this.tabsContainer.get(0).offsetWidth+this.tabsContainer.scrollLeft()){t=this.tabs[e].element.get(0);break}t?(t.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT)):this.tabsContainer.get(0).scrollLeft=this.tabsContainer.get(0).scrollWidth},_handlePreviousButtonMouseDown:function(){for(var t,e=this.tabs.length-1;0<=e;--e)if(this.tabs[e].element.get(0).offsetLeft<this.tabsContainer.scrollLeft()){t=this.tabs[e].element.get(0);break}t?(t.scrollIntoView({behavior:"smooth",inline:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT)):this.tabsContainer.get(0).scrollLeft=0},_handleScrollButtonMouseDown:function(t){this.holdTimer=setTimeout(function(){this._handleScrollRepeat(t,this.tabsContainer.scrollLeft(),100)}.bind(this),this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)},_handleScrollButtonMouseUp:function(){this.holdTimer=clearTimeout(this.holdTimer),this.rAF=cancelAnimationFrame(this.rAF),window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)},_checkScrollArrows:function(){0===this.tabsContainer.scrollLeft()?this.tabPreviousButton.first().attr("disabled",!0):this.tabsContainer.scrollLeft()+this.tabsContainer.innerWidth()===this.tabsContainer.get(0).scrollWidth?this.tabNextButton.attr("disabled",!0):(this.tabNextButton.attr("disabled",!1),this.tabPreviousButton.first().attr("disabled",!1))},_handleScrollRepeat:function(i,n,t,o){t=t||0;var e=this.tabsContainer.get(0).getBoundingClientRect();if(i===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(n-t),this.isDraggingTab&&this.parent._highlightHeaderDropZone(e.left-1),0===this.tabsContainer.scrollLeft())return void this._checkScrollArrows()}else if(i===this.SCROLL_RIGHT&&(this.tabsContainer.scrollLeft(n+t),this.isDraggingTab&&this.parent._highlightHeaderDropZone(e.right+1),this.tabsContainer.scrollLeft()+this.tabsContainer.innerWidth()===this.tabsContainer.get(0).scrollWidth))return void this._checkScrollArrows();window.cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(function(t){var e=o||t,t=t-e,t=this.START_SPEED*t+.5*this.ACCELERATION*(t*t),t=Math.min(t,this.tabsContainer.get(0).scrollWidth);this._handleScrollRepeat(i,n,t,e)}.bind(this))},_$setClosable:function(t){return!(!this.closeButton||!this._isClosable())&&(this.closeButton.element[t?"show":"hide"](),!0)},_$destroy:function(){this.emit("destroy",this);for(var t=0;t<this.tabs.length;t++)this.tabs[t]._$destroy();this._detachWheelListener(),this._handleItemDropped(),r(document).off("mouseup",this._hideAdditionalTabsDropdown),this.tabDropdownSearch.off("input",this._handleFilterInput),this.tabDropdownSearch.off("keydown",this._handleFilterKeydown),this.element.remove()},_getHeaderSetting:function(t){if(t in this.parent._header)return this.parent._header[t]},_createControls:function(){var t,e,i,n,o=this.layoutManager.config.labels.tabDropdown;this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel;this.tabDropdownButton=new m.controls.HeaderButton(this,o,"lm_tabdropdown",this._showAdditionalTabsDropdown),this.tabDropdownButton.element.hide(),this.controlsContainer.prepend(this.tabNextButton),this.tabNextButton.hide(),this._getHeaderSetting("popout")&&(o=m.utils.fnBind(this._onPopoutClick,this),t=this._getHeaderSetting("popout"),new m.controls.HeaderButton(this,t,"lm_popout",o)),this._getHeaderSetting("maximise")&&(o=m.utils.fnBind(this.parent.toggleMaximise,this.parent),e=this._getHeaderSetting("maximise"),i=this._getHeaderSetting("minimise"),n=new m.controls.HeaderButton(this,e,"lm_maximise",o),this.parent.on("maximised",function(){n.element.attr("title",i)}),this.parent.on("minimised",function(){n.element.attr("title",e)})),this._isClosable()&&(o=m.utils.fnBind(this.parent.remove,this.parent),t=this._getHeaderSetting("close"),this.closeButton=new m.controls.HeaderButton(this,t,"lm_close",o))},_showAdditionalTabsDropdown:function(){this.isDropdownShown?this._hideAdditionalTabsDropdown():(this.tabDropdownList=this.tabsContainer.clone(!0).appendTo(this.tabDropdownContainer).children().removeClass("lm_active"),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"),r(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown())},_handleFilterKeydown:function(t){if(-1!==this.dropdownKeyIndex){if("Escape"!==t.key)return"Enter"===t.key||" "===t.key?(this._hideAdditionalTabsDropdown(),void this.tabs[this.dropdownKeyIndex]._onTabClick()):void("ArrowDown"===t.key||"Tab"===t.key&&!1===t.shiftKey?(t.preventDefault(),this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=e(this.dropdownKeyIndex,1,this.tabDropdownList),this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")):"ArrowUp"!==t.key&&"Tab"!==t.key||(t.preventDefault(),this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=e(this.dropdownKeyIndex,-1,this.tabDropdownList),this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")));this._hideAdditionalTabsDropdown()}function e(t,e,i){if(i.length<2)return-1;for(var n=(t+e+i.length)%i.length;n!==t;){if("none"!==i.eq(n).css("display"))return n;n=(n+e+i.length)%i.length}return t}},_handleFilterInput:function(t){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var e=0;e<this.tabDropdownList.length;e++)-1!==this.tabs[e].contentItem.config.title.toLowerCase().indexOf(t.target.value.toLowerCase())?(this.tabDropdownList.eq(e).css("display",""),-1===this.dropdownKeyIndex&&(this.dropdownKeyIndex=e)):this.tabDropdownList.eq(e).css("display","none");-1!==this.dropdownKeyIndex&&this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")},_hideAdditionalTabsDropdown:function(t){!this.isDropdownShown||t&&this.tabDropdownContainer.get(0).contains(t.target)||t&&this.tabDropdownButton.element.get(0)===t.target||(this.element.removeClass("lm_dropdown_open"),this.tabDropdownContainer.hide(),this.isDropdownShown=!1,this.tabDropdownContainer.find(".lm_tabs").remove(),r(document).off("mousedown",this._hideAdditionalTabsDropdown))},_updateAdditionalTabsDropdown:function(){this.tabDropdownContainer.css("max-height","");var t,e=this.tabDropdownContainer[0].scrollHeight;0!==e&&(t=this.tabDropdownContainer.offset().top-r(window).scrollTop())+e>r(window).height()&&this.tabDropdownContainer.css("max-height",r(window).height()-t-10)},_isClosable:function(){return this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon},_onPopoutClick:function(){(!0===this.layoutManager.config.settings.popoutWholeStack?this.parent:this.activeContentItem).popout()},_onHeaderClick:function(t){t.target===this.element[0]&&this.parent.select()},_updateTabSizes:function(){0!==this.tabs.length&&(!this.isOverflowing&&this.tabsContainer.get(0).scrollWidth>this.tabsContainer.get(0).clientWidth?(this.tabDropdownButton.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0):this.isOverflowing&&this.tabsContainer.get(0).scrollWidth<=this.tabsContainer.get(0).clientWidth&&(this.tabDropdownButton.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1),this.isOverflowing&&this._checkScrollArrows())}}),m.controls.HeaderButton=function(t,e,i,n){this._header=t,this.element=r('<li class="'+i+'" title="'+e+'"></li>'),this._header.on("destroy",this._$destroy,this),this._action=n,this.element.on("click",this._action),this._header.controlsContainer.append(this.element)},m.utils.copy(m.controls.HeaderButton.prototype,{_$destroy:function(){this.element.off(),this.element.remove()}}),m.controls.Splitter=function(t,e,i){this._isVertical=t,this._size=e,this._grabSize=i<e?e:i,this.element=this._createElement(),this._dragListener=new m.utils.DragListener(this.element)},m.utils.copy(m.controls.Splitter.prototype,{on:function(t,e,i){this._dragListener.on(t,e,i)},_$destroy:function(){this._dragListener.destroy(),this._dragListener=null,this.element.remove()},_createElement:function(){var t=r('<div class="lm_drag_handle"></div>'),e=r('<div class="lm_splitter"></div>'),i=(e.append(t),this._grabSize-this._size),n=i/2;return this._isVertical?(t.css("top",-n),t.css("height",this._size+i),e.addClass("lm_vertical"),e.height(this._size)):(t.css("left",-n),t.css("width",this._size+i),e.addClass("lm_horizontal"),e.width(this._size)),e}}),m.controls.Tab=function(t,e){this.header=t,this.contentItem=e,this.element=r(m.controls.Tab._template),this.titleElement=this.element.find(".lm_title"),this.closeElement=this.element.find(".lm_close_tab"),this.closeElement[e.config.isClosable?"show":"hide"](),this.isActive=!1,this.setTitle(e.config.title),this.contentItem.on("titleChanged",this.setTitle,this),this._layoutManager=this.contentItem.layoutManager,!0===this._layoutManager.config.settings.reorderEnabled&&!0===e.config.reorderEnabled&&(this._dragListener=new m.utils.DragListener(this.element),this._dragListener.on("dragStart",this._onDragStart,this),this.contentItem.on("destroy",this._dragListener.destroy,this._dragListener)),this._onTabClickFn=m.utils.fnBind(this._onTabClick,this),this._onCloseClickFn=m.utils.fnBind(this._onCloseClick,this),this._onTabContentFocusInFn=m.utils.fnBind(this._onTabContentFocusIn,this),this._onTabContentFocusOutFn=m.utils.fnBind(this._onTabContentFocusOut,this),this.element.on("click",this._onTabClickFn),this.element.on("auxclick",this._onTabClickFn),this.contentItem.config.isClosable?(this.closeElement.on("click",this._onCloseClickFn),this.closeElement.on("mousedown",this._onCloseMousedown)):this.closeElement.remove(),(this.contentItem.tab=this).contentItem.emit("tab",this),this.contentItem.layoutManager.emit("tabCreated",this),this.contentItem.isComponent&&(this.contentItem.container._contentElement.on("focusin click",this._onTabContentFocusInFn).on("focusout",this._onTabContentFocusOutFn),(this.contentItem.container.tab=this).contentItem.container.emit("tab",this))},m.controls.Tab._template=['<li class="lm_tab">','<span class="lm_title_before"></span>','<span class="lm_title"></span>','<div class="lm_close_tab"></div>',"</li>"].join(""),m.utils.copy(m.controls.Tab.prototype,{setTitle:function(t){this.titleElement.html(t)},setActive:function(t){t!==this.isActive&&((this.isActive=t)?this.element.addClass("lm_active"):this.element.removeClass("lm_active"))},_$destroy:function(){this.element.off("click",this._onTabClickFn),this.element.off("auxclick",this._onTabClickFn),this.closeElement.off("click",this._onCloseClickFn),this.contentItem.isComponent&&this.contentItem.container._contentElement.off(),this._dragListener&&(this.contentItem.off("destroy",this._dragListener.destroy,this._dragListener),this._dragListener.off("dragStart",this._onDragStart),this._dragListener=null),this.element.remove()},_onDragStart:function(t,e){!0===this.contentItem.parent.isMaximised&&this.contentItem.parent.toggleMaximise(),new m.controls.DragProxy(t,e,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)},_onTabContentFocusIn:function(){this.contentItem.container._contentElement[0].contains(document.activeElement)||this.contentItem.container._contentElement[0].focus(),this.element.addClass("lm_focusin")},_onTabContentFocusOut:function(){this.contentItem.container._contentElement[0].contains(document.activeElement)||this.element.removeClass("lm_focusin")},_onTabClick:function(t){t&&0!==t.button?1===t.button&&this.contentItem.config.isClosable&&this._onCloseClick(t):(t=this.header.parent.getActiveContentItem(),this.contentItem!==t?(this.header.parent.setActiveContentItem(this.contentItem),this.contentItem.container.emit("tabClicked")):this.contentItem.isComponent&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&(this.contentItem.container._contentElement.focus(),this.contentItem.container.emit("tabClicked")),this.header._hideAdditionalTabsDropdown(),this.element.get(0).scrollIntoView({inline:"nearest"}))},_onCloseClick:function(t){t.stopPropagation(),this.contentItem.isComponent?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)},_onCloseMousedown:function(t){t.stopPropagation()}}),m.controls.TransitionIndicator=function(){this._element=r('<div class="lm_transition_indicator"></div>'),r(document.body).append(this._element),this._toElement=null,this._fromDimensions=null,this._totalAnimationDuration=200,this._animationStartTime=null},m.utils.copy(m.controls.TransitionIndicator.prototype,{destroy:function(){this._element.remove()},transitionElements:function(t,e){},_nextAnimationFrame:function(){var t,e=this._measure(this._toElement),i=(m.utils.now()-this._animationStartTime)/this._totalAnimationDuration,n={};if(1<=i)this._element.hide();else{for(t in e.opacity=0,this._fromDimensions)n[t]=this._fromDimensions[t]+(e[t]-this._fromDimensions[t])*i;this._element.css(n),m.utils.animFrame(m.utils.fnBind(this._nextAnimationFrame,this))}},_measure:function(t){var e=t.offset();return{left:e.left,top:e.top,width:t.outerWidth(),height:t.outerHeight()}}}),m.items.AbstractContentItem=function(t,e,i){m.utils.EventEmitter.call(this),this.config=this._extendItemNode(e),this.type=e.type,this.contentItems=[],this.parent=i,this.isInitialised=!1,this.isMaximised=!1,this.isRoot=!1,this.isRow=!1,this.isColumn=!1,this.isStack=!1,this.isComponent=!1,this.layoutManager=t,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(m.utils.EventEmitter.ALL_EVENT,this._propagateEvent,this),e.content&&this._createContentItems(e)},m.utils.copy(m.items.AbstractContentItem.prototype,{setSize:function(){throw new Error("Abstract Method")},callDownwards:function(t,e,i,n){var o;for(!0!==i&&!0!==n&&this[t].apply(this,e||[]),o=0;o<this.contentItems.length;o++)this.contentItems[o].callDownwards(t,e,i);!0===i&&!0!==n&&this[t].apply(this,e||[])},removeChild:function(t,e){t=m.utils.indexOf(t,this.contentItems);if(-1===t)throw new Error("Can't remove child item. Unknown content item");!0!==e&&this.contentItems[t]._$destroy(),this.contentItems.splice(t,1),this.config.content.splice(t,1),0<this.contentItems.length?this.callDownwards("setSize"):this instanceof m.items.Root||!0!==this.config.isClosable||this.parent.removeChild(this)},addChild:function(t,e){void 0===e&&(e=this.contentItems.length),this.contentItems.splice(e,0,t),void 0===this.config.content&&(this.config.content=[]),this.config.content.splice(e,0,t.config),t.parent=this,!0===t.parent.isInitialised&&!1===t.isInitialised&&t._$init()},replaceChild:function(t,e,i){e=this.layoutManager._$normalizeContentItem(e);var n=m.utils.indexOf(t,this.contentItems),o=t.element[0].parentNode;if(-1===n)throw new Error("Can't replace child. oldChild is not child of this");o.replaceChild(e.element[0],t.element[0]),!0===i&&(t.parent=null,t._$destroy()),((this.contentItems[n]=e).parent=this).isStack&&(this.header.tabs[n].contentItem=e),!0===e.parent.isInitialised&&!1===e.isInitialised&&e._$init(),this.callDownwards("setSize")},remove:function(){this.parent.removeChild(this)},popout:function(){var t=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),t},toggleMaximise:function(t){t&&t.preventDefault(),!0===this.isMaximised?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximised=!this.isMaximised,this.emitBubblingEvent("stateChanged")},select:function(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))},deselect:function(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))},setTitle:function(t){this.config.title=t,this.emit("titleChanged",t),this.emitBubblingEvent("stateChanged")},hasId:function(t){return!!this.config.id&&("string"==typeof this.config.id?this.config.id===t:this.config.id instanceof Array?-1!==m.utils.indexOf(t,this.config.id):void 0)},addId:function(t){this.hasId(t)||(this.config.id?"string"==typeof this.config.id?this.config.id=[this.config.id,t]:this.config.id instanceof Array&&this.config.id.push(t):this.config.id=t)},removeId:function(t){if(!this.hasId(t))throw new Error("Id not found");"string"==typeof this.config.id?delete this.config.id:this.config.id instanceof Array&&(t=m.utils.indexOf(t,this.config.id),this.config.id.splice(t,1))},getItemsByFilter:function(i){function n(t){for(var e=0;e<t.contentItems.length;e++)!0===i(t.contentItems[e])&&o.push(t.contentItems[e]),n(t.contentItems[e])}var o=[];return n(this),o},getItemsById:function(e){return this.getItemsByFilter(function(t){return t.config.id instanceof Array?-1!==m.utils.indexOf(e,t.config.id):t.config.id===e})},getItemsByType:function(t){return this._$getItemsByProperty("type",t)},getComponentsByName:function(t){for(var e=this._$getItemsByProperty("componentName",t),i=[],n=0;n<e.length;n++)i.push(e[n].instance);return i},_$getItemsByProperty:function(e,i){return this.getItemsByFilter(function(t){return t[e]===i})},_$setParent:function(t){this.parent=t},_$highlightDropZone:function(t,e,i){this.layoutManager.dropTargetIndicator.highlightArea(i)},_$onDrop:function(t){this.addChild(t)},_$hide:function(){this._callOnActiveComponents("hide"),this.element.hide(),this.layoutManager.updateSize()},_$show:function(){this._callOnActiveComponents("show"),this.element.show(),this.layoutManager.updateSize()},_callOnActiveComponents:function(t){for(var e,i=this.getItemsByType("stack"),n=0;n<i.length;n++)(e=i[n].getActiveContentItem())&&e.isComponent&&e.container[t]()},_$destroy:function(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")},_$getArea:function(t){var e=(t=t||this.element).offset(),i=t.width(),t=t.height();return{x1:e.left,y1:e.top,x2:e.left+i,y2:e.top+t,surface:i*t,contentItem:this}},_$init:function(){var t;for(this.setSize(),t=0;t<this.contentItems.length;t++)this.childElementContainer.append(this.contentItems[t].element);this.isInitialised=!0,this.emitBubblingEvent("itemCreated"),this.emitBubblingEvent(this.type+"Created")},emitBubblingEvent:function(t){var e=new m.utils.BubblingEvent(t,this);this.emit(t,e)},_createContentItems:function(t){var e,i;if(!(t.content instanceof Array))throw new m.errors.ConfigurationError("content must be an Array",t);for(i=0;i<t.content.length;i++)e=this.layoutManager.createContentItem(t.content[i],this),this.contentItems.push(e)},_extendItemNode:function(t){for(var e in m.config.itemDefaultConfig)void 0===t[e]&&(t[e]=m.config.itemDefaultConfig[e]);return t},_propagateEvent:function(t,e){e instanceof m.utils.BubblingEvent&&!1===e.isPropagationStopped&&!0===this.isInitialised&&(!1===this.isRoot&&this.parent?this.parent.emit.apply(this.parent,Array.prototype.slice.call(arguments,0)):this._scheduleEventPropagationToLayoutManager(t,e))},_scheduleEventPropagationToLayoutManager:function(t,e){-1===m.utils.indexOf(t,this._throttledEvents)?this.layoutManager.emit(t,e.origin):!0!==this._pendingEventPropagations[t]&&(this._pendingEventPropagations[t]=!0,m.utils.animFrame(m.utils.fnBind(this._propagateEventToLayoutManager,this,[t,e])))},_propagateEventToLayoutManager:function(t,e){this._pendingEventPropagations[t]=!1,this.layoutManager.emit(t,e)}}),m.items.Component=function(t,e,i){m.items.AbstractContentItem.call(this,t,e,i);e=t.getComponent(this.config.componentName)||t.getFallbackComponent(),i=r.extend(!0,{},this.config.componentState||{});if(null==e)throw new m.errors.ConfigurationError('Unknown component "'+this.config.componentName+'"');i.componentName=this.config.componentName,this.componentName=this.config.componentName,""===this.config.title&&(this.config.title=this.config.componentName),this.isComponent=!0,this.container=new m.container.ItemContainer(this.config,this,t),this.instance=new e(this.container,i),this.element=this.container._element},m.utils.extend(m.items.Component,m.items.AbstractContentItem),m.utils.copy(m.items.Component.prototype,{close:function(){this.parent.removeChild(this)},setSize:function(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())},_$init:function(){m.items.AbstractContentItem.prototype._$init.call(this),this.container.emit("open")},_$hide:function(){this.container.hide(),m.items.AbstractContentItem.prototype._$hide.call(this)},_$show:function(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),m.items.AbstractContentItem.prototype._$show.call(this)},_$destroy:function(){this.container.emit("destroy",this),m.items.AbstractContentItem.prototype._$destroy.call(this)},_$getArea:function(){return null}}),m.items.Root=function(t,e,i){m.items.AbstractContentItem.call(this,t,e,null),this.isRoot=!0,this.type="root",this.element=r('<div class="lm_goldenlayout lm_item lm_root"></div>'),this.childElementContainer=this.element,this._containerElement=i,this._containerElement.append(this.element)},m.utils.extend(m.items.Root,m.items.AbstractContentItem),m.utils.copy(m.items.Root.prototype,{addChild:function(t){if(0<this.contentItems.length)throw new Error("Root node can only have a single child");t=this.layoutManager._$normalizeContentItem(t,this),this.childElementContainer.append(t.element),m.items.AbstractContentItem.prototype.addChild.call(this,t),this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")},setSize:function(t,e){t=void 0===t?this._containerElement.width():t,e=void 0===e?this._containerElement.height():e,this.element.width(t),this.element.height(e),this.contentItems[0]&&(this.contentItems[0].element.width(t),this.contentItems[0].element.height(e))},_$highlightDropZone:function(t,e,i){this.layoutManager.tabDropPlaceholder.remove(),m.items.AbstractContentItem.prototype._$highlightDropZone.apply(this,arguments)},_$onDrop:function(t,e){var i,n,o;t.isComponent&&((o=this.layoutManager.createContentItem({type:"stack",header:t.config.header||{}},this))._$init(),o.addChild(t),t=o),this.contentItems.length?(o="x"==e.side[0]?"row":"column",i="x"==e.side[0]?"width":"height",e="2"==e.side[1],!(n=this.contentItems[0])instanceof m.items.RowOrColumn||n.type!=o?(o=this.layoutManager.createContentItem({type:o},this),this.replaceChild(n,o),o.addChild(t,e?0:void 0,!0),o.addChild(n,e?void 0:0,!0),n.config[i]=50,t.config[i]=50,o.callDownwards("setSize")):(o=n.contentItems[e?0:n.contentItems.length-1],n.addChild(t,e?0:void 0,!0),o.config[i]*=.5,t.config[i]=o.config[i],n.callDownwards("setSize"))):this.addChild(t)}}),m.items.RowOrColumn=function(t,e,i,n){m.items.AbstractContentItem.call(this,e,i,n),this.isRow=!t,this.isColumn=t,this.element=r('<div class="lm_item lm_'+(t?"column":"row")+'"></div>'),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._splitter=[],this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null},m.utils.extend(m.items.RowOrColumn,m.items.AbstractContentItem),m.utils.copy(m.items.RowOrColumn.prototype,{addChild:function(t,e,i){var n,o,s,r;if(t=this.layoutManager._$normalizeContentItem(t,this),void 0===e&&(e=this.contentItems.length),0<this.contentItems.length?(r=this._createSplitter(Math.max(0,e-1)).element,0<e?(this.contentItems[e-1].element.after(r),r.after(t.element)):(this.contentItems[0].element.before(r),r.before(t.element))):this.childElementContainer.append(t.element),m.items.AbstractContentItem.prototype.addChild.call(this,t,e),n=1/this.contentItems.length*100,!0===i)this.emitBubblingEvent("stateChanged");else{for(s=0;s<this.contentItems.length;s++)this.contentItems[s]===t?t.config[this._dimension]=n:(o=this.contentItems[s].config[this._dimension]*=(100-n)/100,this.contentItems[s].config[this._dimension]=o);this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}},removeChild:function(t,e){var i,n=t.config[this._dimension],o=m.utils.indexOf(t,this.contentItems),s=Math.max(o-1,0);if(-1===o)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)),i=0;i<this.contentItems.length;i++)this.contentItems[i]!==t&&(this.contentItems[i].config[this._dimension]+=n/(this.contentItems.length-1));m.items.AbstractContentItem.prototype.removeChild.call(this,t,e),1===this.contentItems.length&&!0===this.config.isClosable?(o=this.contentItems[0],this.contentItems=[],this.parent.replaceChild(this,o,!0)):(this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged"))},replaceChild:function(t,e){var i=t.config[this._dimension];m.items.AbstractContentItem.prototype.replaceChild.call(this,t,e),e.config[this._dimension]=i,this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")},setSize:function(){0<this.contentItems.length&&(this._calculateRelativeSizes(),this._setAbsoluteSizes()),this.emitBubblingEvent("stateChanged"),this.emit("resize")},_$init:function(){var t;if(!0!==this.isInitialised)for(m.items.AbstractContentItem.prototype._$init.call(this),t=0;t<this.contentItems.length-1;t++)this.contentItems[t].element.after(this._createSplitter(t).element)},_setAbsoluteSizes:function(){for(var t=this._calculateAbsoluteSizes(),e=0;e<this.contentItems.length;e++)0<t.additionalPixel-e&&t.itemSizes[e]++,this._isColumn?(this.contentItems[e].element.width(t.totalWidth),this.contentItems[e].element.height(t.itemSizes[e])):(this.contentItems[e].element.width(t.itemSizes[e]),this.contentItems[e].element.height(t.totalHeight))},_calculateAbsoluteSizes:function(){var t,e,i=(this.contentItems.length-1)*this._splitterSize,n=this.element.width(),o=this.element.height(),s=0,r=[];for(this._isColumn?o-=i:n-=i,t=0;t<this.contentItems.length;t++)s+=e=this._isColumn?Math.floor(o*(this.contentItems[t].config.height/100)):Math.floor(n*(this.contentItems[t].config.width/100)),r.push(e);return{itemSizes:r,additionalPixel:Math.floor((this._isColumn?o:n)-s),totalWidth:n,totalHeight:o}},_calculateRelativeSizes:function(){for(var t=0,e=[],i=this._isColumn?"height":"width",n=0;n<this.contentItems.length;n++)void 0!==this.contentItems[n].config[i]?t+=this.contentItems[n].config[i]:e.push(this.contentItems[n]);if(100===Math.round(t))this._respectMinItemWidth();else if(Math.round(t)<100&&0<e.length){for(n=0;n<e.length;n++)e[n].config[i]=(100-t)/e.length;this._respectMinItemWidth()}else{if(100<Math.round(t))for(n=0;n<e.length;n++)t+=e[n].config[i]=50;for(n=0;n<this.contentItems.length;n++)this.contentItems[n].config[i]=this.contentItems[n].config[i]/t*100;this._respectMinItemWidth()}},_respectMinItemWidth:function(){var t,e,i,n,o=this.layoutManager.config.dimensions&&this.layoutManager.config.dimensions.minItemWidth||0,s=[],r=0,h=0,a=0,l=[];if(!(this._isColumn||!o||this.contentItems.length<=1)){for(var c=this._calculateAbsoluteSizes(),d=0;d<this.contentItems.length;d++)this.contentItems[d],(t=c.itemSizes[d])<o?(h+=o-t,n={width:o}):(r+=t-o,s.push(n={width:t})),l.push(n);if(!(0===h||r<h)){for(e=h/r,a=h,d=0;d<s.length;d++)n=s[d],a-=i=Math.round((n.width-o)*e),n.width-=i;for(0!==a&&(l[l.length-1].width-=a),d=0;d<this.contentItems.length;d++)this.contentItems[d].config.width=l[d].width/c.totalWidth*100}}},_createSplitter:function(t){var e=new m.controls.Splitter(this._isColumn,this._splitterSize,this._splitterGrabSize);return e.on("drag",m.utils.fnBind(this._onSplitterDrag,this,[e]),this),e.on("dragStop",m.utils.fnBind(this._onSplitterDragStop,this,[e]),this),e.on("dragStart",m.utils.fnBind(this._onSplitterDragStart,this,[e]),this),this._splitter.splice(t,0,e),e},_getItemsForSplitter:function(t){t=m.utils.indexOf(t,this._splitter);return{before:this.contentItems[t],after:this.contentItems[t+1]}},_getMinimumDimensions:function(t){for(var e=0,i=0,n=0;n<t.length;++n)e=Math.max(t[n].minWidth||0,e),i=Math.max(t[n].minHeight||0,i);return{horizontal:e,vertical:i}},_onSplitterDragStart:function(t){var t=this._getItemsForSplitter(t),e=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],i=this._getMinimumDimensions(t.before.config.content),i=this._isColumn?i.vertical:i.horizontal,n=this._getMinimumDimensions(t.after.config.content),n=this._isColumn?n.vertical:n.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(t.before.element[this._dimension]()-(i||e)),this._splitterMaxPosition=t.after.element[this._dimension]()-(n||e)},_onSplitterDrag:function(t,e,i){i=this._isColumn?i:e;i>this._splitterMinPosition&&i<this._splitterMaxPosition&&(this._splitterPosition=i,t.element.css(this._isColumn?"top":"left",i))},_onSplitterDragStop:function(t){var e=this._getItemsForSplitter(t),i=e.before.element[this._dimension](),n=e.after.element[this._dimension](),i=(this._splitterPosition+i)/(i+n),n=e.before.config[this._dimension]+e.after.config[this._dimension];e.before.config[this._dimension]=i*n,e.after.config[this._dimension]=(1-i)*n,t.element.css({top:0,left:0}),m.utils.animFrame(m.utils.fnBind(this.callDownwards,this,["setSize"]))}}),m.items.Stack=function(t,e,i){m.items.AbstractContentItem.call(this,t,e,i),this.element=r('<div class="lm_item lm_stack"></div>'),this._activeContentItem=null;i=t.config;this._header={show:!0===i.settings.hasHeaders&&!1!==e.hasHeaders,popout:i.settings.showPopoutIcon&&i.labels.popout,maximise:i.settings.showMaximiseIcon&&i.labels.maximise,close:i.settings.showCloseIcon&&i.labels.close,minimise:i.labels.minimise},i.header&&m.utils.copy(this._header,i.header),e.header&&m.utils.copy(this._header,e.header),e.content&&e.content[0]&&e.content[0].header&&m.utils.copy(this._header,e.content[0].header),this._dropZones={},this._dropSegment=null,this._contentAreaDimensions=null,this._dropIndex=null,this.isStack=!0,this.childElementContainer=r('<div class="lm_items"></div>'),this.header=new m.controls.Header(t,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()},m.utils.extend(m.items.Stack,m.items.AbstractContentItem),m.utils.copy(m.items.Stack.prototype,{setSize:function(){var t,e=this._header.show?this.layoutManager.config.dimensions.headerHeight:0,i=this.element.width()-(this._sided?e:0),n=this.element.height()-(this._sided?0:e);for(this.childElementContainer.width(i),this.childElementContainer.height(n),t=0;t<this.contentItems.length;t++)this.contentItems[t].element.width(i).height(n);this.emit("resize"),this.emitBubblingEvent("stateChanged")},_$init:function(){var t,e;if(!0!==this.isInitialised){for(this.header._attachWheelListener(),m.items.AbstractContentItem.prototype._$init.call(this),t=0;t<this.contentItems.length;t++)this.header.createTab(this.contentItems[t]),this.contentItems[t]._$hide();if(0<this.contentItems.length){if(!(e=this.contentItems[this.config.activeItemIndex||0]))throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(e)}}},setActiveContentItem:function(t){if(-1===m.utils.indexOf(t,this.contentItems))throw new Error("contentItem is not a child of this stack");null!==this._activeContentItem&&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:function(){return this.header.activeContentItem},addChild:function(t,e){t=this.layoutManager._$normalizeContentItem(t,this),m.items.AbstractContentItem.prototype.addChild.call(this,t,e),this.childElementContainer.append(t.element),this.header.createTab(t,e),this.setActiveContentItem(t),this.callDownwards("setSize"),this._$validateClosability(),this.emitBubblingEvent("stateChanged")},removeChild:function(t,e){var i=m.utils.indexOf(t,this.contentItems);m.items.AbstractContentItem.prototype.removeChild.call(this,t,e),this.header.removeTab(t),this.header.activeContentItem===t&&(0<this.contentItems.length?this.setActiveContentItem(this.contentItems[Math.max(i-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")},_$validateClosability:function(){for(var t=this.header._isClosable(),e=0,i=this.contentItems.length;e<i&&t;e++)t=this.contentItems[e].config.isClosable;this.header._$setClosable(t)},_$destroy:function(){m.items.AbstractContentItem.prototype._$destroy.call(this),this.header._$destroy()},_$onDrop:function(t){if("header"===this._dropSegment)return this._resetHeaderDropZone(),void this.addChild(t,this._dropIndex);var e,i,n,o,s;"body"===this._dropSegment?this.addChild(t):(e="top"===this._dropSegment||"bottom"===this._dropSegment,s="left"===this._dropSegment||"right"===this._dropSegment,i="top"===this._dropSegment||"left"===this._dropSegment,s=e&&this.parent.isColumn||s&&this.parent.isRow,n=e?"height":"width",t.isComponent&&((o=this.layoutManager.createContentItem({type:"stack",header:t.config.header||{}},this))._$init(),o.addChild(t),t=o),s?(o=m.utils.indexOf(this,this.parent.contentItems),this.parent.addChild(t,i?o:o+1,!0),this.config[n]*=.5,t.config[n]=this.config[n],this.parent.callDownwards("setSize")):(s=this.layoutManager.createContentItem({type:e?"column":"row"},this),this.parent.replaceChild(this,s),s.addChild(t,i?0:void 0,!0),s.addChild(this,i?void 0:0,!0),this.config[n]=50,t.config[n]=50,s.callDownwards("setSize")))},_$highlightDropZone:function(t,e){var i,n;for(i in this._contentAreaDimensions)if((n=this._contentAreaDimensions[i].hoverArea).x1<t&&n.x2>t&&n.y1<e&&n.y2>e)return void("header"===i?(this._dropSegment="header",this._highlightHeaderDropZone(t,e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(i)))},_$getArea:function(){if(!1===this.element.is(":visible"))return null;var t=m.items.AbstractContentItem.prototype._$getArea,e=t.call(this,this.header.element),i=t.call(this,this.childElementContainer),n=i.x2-i.x1,o=i.y2-i.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}},this._activeContentItem&&!1===this._activeContentItem.isComponent?e:(0===this.contentItems.length?this._contentAreaDimensions.body={hoverArea:{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},highlightArea:{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2}}:(this._contentAreaDimensions.left={hoverArea:{x1:i.x1,y1:i.y1,x2:i.x1+.25*n,y2:i.y2},highlightArea:{x1:i.x1,y1:i.y1,x2:i.x1+.5*n,y2:i.y2}},this._contentAreaDimensions.top={hoverArea:{x1:i.x1+.25*n,y1:i.y1,x2:i.x1+.75*n,y2:i.y1+.5*o},highlightArea:{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y1+.5*o}},this._contentAreaDimensions.right={hoverArea:{x1:i.x1+.75*n,y1:i.y1,x2:i.x2,y2:i.y2},highlightArea:{x1:i.x1+.5*n,y1:i.y1,x2:i.x2,y2:i.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:i.x1+.25*n,y1:i.y1+.5*o,x2:i.x1+.75*n,y2:i.y2},highlightArea:{x1:i.x1,y1:i.y1+.5*o,x2:i.x2,y2:i.y2}}),t.call(this,this.element))},_highlightHeaderDropZone:function(t){var e=this.header.tabs.length,i=null,n=null;if(0===e)return o=this.header.element.offset(),void this.layoutManager.dropTargetIndicator.highlightArea({x1:o.left,x2:o.left+100,y1:this.header.element.offset().top,y2:this.header.element.offset().top+this.header.element.innerHeight()});var o=this.header.tabsContainer.get(0).getBoundingClientRect(),s=this.layoutManager.tabDropPlaceholder.get(0).getBoundingClientRect();if(t<o.left?t=o.left+1:t>o.right&&(t=o.right-1),!(s.left<t&&t<s.right)){for(var r=0;r<e;r++)if((n=(i=this.header.tabs[r].element).get(0).getBoundingClientRect()).left<t&&t<n.right){this._dropIndex=r;break}i&&t<n.left+.5*n.width?i.before(this.layoutManager.tabDropPlaceholder):i&&(this._dropIndex=Math.min(this._dropIndex+1,e),i.after(this.layoutManager.tabDropPlaceholder))}o=this.layoutManager.tabDropPlaceholder.offset().left,s=(o=Math.max(o,this.header.tabsContainer.offset().left))+this.layoutManager.tabDropPlaceholder.width(),s=Math.min(s,this.header.tabsContainer.offset().left+this.header.tabsContainer.innerWidth());this.layoutManager.dropTargetIndicator.highlightArea({x1:o,x2:s,y1:this.header.element.offset().top,y2:this.header.element.offset().top+this.header.element.innerHeight()})},_resetHeaderDropZone:function(){this.layoutManager.tabDropPlaceholder.remove()},_setupHeaderPosition:function(){var t=0<=["right","left","bottom"].indexOf(this._header.show)&&this._header.show;this.header.element.toggle(!!this._header.show),this._side=t,this._sided=0<=["right","left"].indexOf(this._side),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&&(t=0<=["right","bottom"].indexOf(this._side)?"before":"after",this.header.element[t](this.childElementContainer),this.callDownwards("setSize"))},_highlightBodyDropZone:function(t){var e=this._contentAreaDimensions[t].highlightArea;this.layoutManager.dropTargetIndicator.highlightArea(e),this._dropSegment=t}}),m.errors.ConfigurationError=function(t,e){Error.call(this),this.name="Configuration Error",this.message=t,this.node=e},m.errors.ConfigurationError.prototype=new Error,m.utils.BubblingEvent=function(t,e){this.name=t,this.origin=e,this.isPropagationStopped=!1},m.utils.BubblingEvent.prototype.stopPropagation=function(){this.isPropagationStopped=!0},m.utils.ConfigMinifier=function(){if(this._keys=["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"],36<this._keys.length)throw new Error("Too many keys in config minifier map");this._values=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"]},m.utils.copy(m.utils.ConfigMinifier.prototype,{minifyConfig:function(t){var e={};return this._nextLevel(t,e,"_min"),e},unminifyConfig:function(t){var e={};return this._nextLevel(t,e,"_max"),e},_nextLevel:function(t,e,i){var n,o;for(n in t)t instanceof Array&&(n=parseInt(n,10)),t.hasOwnProperty(n)&&(o=this[i](n,this._keys),"object"==typeof t[n]?(e[o]=t[n]instanceof Array?[]:{},this._nextLevel(t[n],e[o],i)):e[o]=this[i](t[n],this._values))},_min:function(t,e){if("string"==typeof t&&1===t.length)return"___"+t;e=m.utils.indexOf(t,e);return-1===e?t:e.toString(36)},_max:function(t,e){return"string"==typeof t&&1===t.length?e[parseInt(t,36)]:"string"==typeof t&&"___"===t.substr(0,3)?t[3]:t}}),m.utils.EventHub=function(t){m.utils.EventEmitter.call(this),this._layoutManager=t,this._dontPropagateToParent=null,this._childEventSource=null,this.on(m.utils.EventEmitter.ALL_EVENT,m.utils.fnBind(this._onEventFromThis,this)),this._boundOnEventFromChild=m.utils.fnBind(this._onEventFromChild,this),r(window).on("gl_child_event",this._boundOnEventFromChild)},m.utils.EventHub.prototype._onEventFromThis=function(){var t=Array.prototype.slice.call(arguments);this._layoutManager.isSubWindow&&t[0]!==this._dontPropagateToParent&&this._propagateToParent(t),this._propagateToChildren(t),this._dontPropagateToParent=null,this._childEventSource=null},m.utils.EventHub.prototype._$onEventFromParent=function(t){this._dontPropagateToParent=t[0],this.emit.apply(this,t)},m.utils.EventHub.prototype._onEventFromChild=function(t){this._childEventSource=t.originalEvent.__gl,this.emit.apply(this,t.originalEvent.__glArgs)},m.utils.EventHub.prototype._propagateToParent=function(t){var e,i="gl_child_event";document.createEvent?(e=window.opener.document.createEvent("HTMLEvents")).initEvent(i,!0,!0):(e=window.opener.document.createEventObject()).eventType=i,e.eventName=i,e.__glArgs=t,e.__gl=this._layoutManager,document.createEvent?window.opener.dispatchEvent(e):window.opener.fireEvent("on"+e.eventType,e)},m.utils.EventHub.prototype._propagateToChildren=function(t){for(var e,i=0;i<this._layoutManager.openPopouts.length;i++)(e=this._layoutManager.openPopouts[i].getGlInstance())&&e!==this._childEventSource&&e.eventHub._$onEventFromParent(t)},m.utils.EventHub.prototype.destroy=function(){r(window).off("gl_child_event",this._boundOnEventFromChild)},m.utils.ReactComponentHandler=function(t,e){this._reactComponent=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)},m.utils.copy(m.utils.ReactComponentHandler.prototype,{_render:function(){ReactDOM.render(this._getReactComponent(),this._container.getElement()[0])},_gotReactComponent:function(t){t&&(this._reactComponent=t,this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate||function(){},this._reactComponent.componentWillUpdate=this._onUpdate.bind(this),this._container.getState()&&this._reactComponent.setState(this._container.getState()))},_destroy:function(){ReactDOM.unmountComponentAtNode(this._container.getElement()[0]),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)},_onUpdate:function(t,e){this._container.setState(e),this._originalComponentWillUpdate.call(this._reactComponent,t,e)},_getReactClass:function(){var t,e=this._container._config.component;if(!e)throw new Error("No react component name. type: react-component needs a field `component`");if(t=this._container.layoutManager.getComponent(e)||this._container.layoutManager.getFallbackComponent())return t;throw new Error('React component "'+e+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`')},_getReactComponent:function(){var t={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},t=r.extend(t,this._container._config.props);return React.createElement(this._reactClass,t)}})}(window.$);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/golden-layout",
3
- "version": "0.15.5-beta.4+951179d",
3
+ "version": "0.15.6-beta.0+743f253",
4
4
  "author": "Deephaven Data Labs LLC",
5
5
  "license": "Apache-2.0",
6
6
  "description": "A multi-screen javascript Layout manager",
@@ -81,5 +81,5 @@
81
81
  "publishConfig": {
82
82
  "access": "public"
83
83
  },
84
- "gitHead": "951179d8b471f5909365d22da4f0f49a765870c8"
84
+ "gitHead": "743f253dd40b4f0dcca921ecf4f578d64202cd53"
85
85
  }