diff options
Diffstat (limited to 'webAO/ui.b.js')
| -rw-r--r-- | webAO/ui.b.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/webAO/ui.b.js b/webAO/ui.b.js index f2971f5..b0468e5 100644 --- a/webAO/ui.b.js +++ b/webAO/ui.b.js @@ -1,4 +1,4 @@ -!function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=157)}({155:function(t,e,n){var i,o,s,r;s=window.$,(r={config:{},container:{},controls:{},errors:{},items:{},utils:{}}).utils.F=function(){},r.utils.extend=function(t,e){t.prototype=r.utils.createObject(e.prototype),t.prototype.contructor=t},r.utils.createObject=function(t){return"function"==typeof Object.create?Object.create(t):(r.utils.F.prototype=t,new r.utils.F)},r.utils.objectKeys=function(t){var e,n;if("function"==typeof Object.keys)return Object.keys(t);for(n in e=[],t)e.push(n);return e},r.utils.getHashValue=function(t){var e=location.hash.match(new RegExp(t+"=([^&]*)"));return e?e[1]:null},r.utils.getQueryStringParam=function(t){if(window.location.hash)return r.utils.getHashValue(t);if(!window.location.search)return null;var e,n,i=window.location.search.substr(1).split("&"),o={};for(n=0;n<i.length;n++)o[(e=i[n].split("="))[0]]=e[1];return o[t]||null},r.utils.copy=function(t,e){for(var n in e)t[n]=e[n];return t},r.utils.animFrame=function(t){return(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)})((function(){t()}))},r.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 n=0;n<e.length;n++)if(e[n]===t)return n;return-1},"object"!=typeof Int8Array?r.utils.isFunction=function(t){return"function"==typeof t||!1}:r.utils.isFunction=function(t){return"[object Function]"===toString.call(t)},r.utils.fnBind=function(t,e,n){if(void 0!==Function.prototype.bind)return Function.prototype.bind.apply(t,[e].concat(n||[]));var i=function(){var o=(n||[]).concat(Array.prototype.slice.call(arguments,0));if(!(this instanceof i))return t.apply(e,o);t.apply(this,o)};return i.prototype=t.prototype,i},r.utils.removeFromArray=function(t,e){var n=r.utils.indexOf(t,e);if(-1===n)throw new Error("Can't remove item from array. Item is not in the array");e.splice(n,1)},r.utils.now=function(){return"function"==typeof Date.now?Date.now():(new Date).getTime()},r.utils.getUniqueId=function(){return(1e15*Math.random()).toString(36).replace(".","")},r.utils.filterXss=function(t,e){var n=t.replace(/javascript/gi,"javascript").replace(/expression/gi,"expression").replace(/onload/gi,"onload").replace(/script/gi,"script").replace(/onerror/gi,"onerror");return!0===e?n:n.replace(/>/g,">").replace(/</g,"<")},r.utils.stripTags=function(t){return s.trim(t.replace(/(<([^>]+)>)/gi,""))},r.utils.EventEmitter=function(){this._mSubscriptions={},this._mSubscriptions[r.utils.EventEmitter.ALL_EVENT]=[],this.on=function(t,e,n){if(!r.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:n})},this.emit=function(t){var e,n,i;i=Array.prototype.slice.call(arguments,1);var o=this._mSubscriptions[t];if(o)for(o=o.slice(),e=0;e<o.length;e++)n=o[e].ctx||{},o[e].fn.apply(n,i);i.unshift(t);var s=this._mSubscriptions[r.utils.EventEmitter.ALL_EVENT].slice();for(e=0;e<s.length;e++)n=s[e].ctx||{},s[e].fn.apply(n,i)},this.unbind=function(t,e,n){if(!this._mSubscriptions[t])throw new Error("No subscribtions to unsubscribe for event "+t);var i,o=!1;for(i=0;i<this._mSubscriptions[t].length;i++)e&&this._mSubscriptions[t][i].fn!==e||n&&n!==this._mSubscriptions[t][i].ctx||(this._mSubscriptions[t].splice(i,1),o=!0);if(!1===o)throw new Error("Nothing to unbind for "+t)},this.off=this.unbind,this.trigger=this.emit},r.utils.EventEmitter.ALL_EVENT="__all",r.utils.DragListener=function(t,e){r.utils.EventEmitter.call(this),this._eElement=s(t),this._oDocument=s(document),this._eBody=s(document.body),this._nButtonCode=e||0,this._nDelay=200,this._nDistance=10,this._nX=0,this._nY=0,this._nOriginalX=0,this._nOriginalY=0,this._bDragging=!1,this._fMove=r.utils.fnBind(this.onMouseMove,this),this._fUp=r.utils.fnBind(this.onMouseUp,this),this._fDown=r.utils.fnBind(this.onMouseDown,this),this._eElement.on("mousedown touchstart",this._fDown)},r.utils.DragListener.timeout=null,r.utils.copy(r.utils.DragListener.prototype,{destroy:function(){this._eElement.unbind("mousedown touchstart",this._fDown),this._oDocument.unbind("mouseup touchend",this._fUp),this._eElement=null,this._oDocument=null,this._eBody=null},onMouseDown:function(t){if(t.preventDefault(),0==t.button||"touchstart"===t.type){var e=this._getCoordinates(t);this._nOriginalX=e.x,this._nOriginalY=e.y,this._oDocument.on("mousemove touchmove",this._fMove),this._oDocument.one("mouseup touchend",this._fUp),this._timeout=setTimeout(r.utils.fnBind(this._startDrag,this),this._nDelay)}},onMouseMove:function(t){if(null!=this._timeout){t.preventDefault();var 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)&&(clearTimeout(this._timeout),this._startDrag()),this._bDragging&&this.emit("drag",this._nX,this._nY,t)}},onMouseUp:function(t){null!=this._timeout&&(clearTimeout(this._timeout),this._eBody.removeClass("lm_dragging"),this._eElement.removeClass("lm_dragging"),this._oDocument.find("iframe").css("pointer-events",""),this._oDocument.unbind("mousemove touchmove",this._fMove),this._oDocument.unbind("mouseup touchend",this._fUp),!0===this._bDragging&&(this._bDragging=!1,this.emit("dragStop",t,this._nOriginalX+this._nX)))},_startDrag:function(){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}}}),r.LayoutManager=function(t,e){if(!s||"function"!=typeof s.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');r.utils.EventEmitter.call(this),this.isInitialised=!1,this._isFullPage=!1,this._resizeTimeoutId=null,this._components={"lm-react-component":r.utils.ReactComponentHandler},this._itemAreas=[],this._resizeFunction=r.utils.fnBind(this._onResize,this),this._unloadFunction=r.utils.fnBind(this._onUnload,this),this._maximisedItem=null,this._maximisePlaceholder=s('<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 r.utils.EventHub(this),this.config=this._createConfig(t),this.container=e,this.dropTargetIndicator=null,this.transitionIndicator=null,this.tabDropPlaceholder=s('<div class="lm_drop_tab_placeholder"></div>'),!0===this.isSubWindow&&s("body").css("visibility","hidden"),this._typeToItem={column:r.utils.fnBind(r.items.RowOrColumn,this,[!0]),row:r.utils.fnBind(r.items.RowOrColumn,this,[!1]),stack:r.items.Stack,component:r.items.Component}},r.LayoutManager.__lm=r,r.LayoutManager.minifyConfig=function(t){return(new r.utils.ConfigMinifier).minifyConfig(t)},r.LayoutManager.unminifyConfig=function(t){return(new r.utils.ConfigMinifier).unminifyConfig(t)},r.utils.copy(r.LayoutManager.prototype,{registerComponent:function(t,e){if("function"!=typeof e)throw new Error("Please register a constructor function");if(void 0!==this._components[t])throw new Error("Component "+t+" is already registered");this._components[t]=e},toConfig:function(t){var e,n,i;if(!1===this.isInitialised)throw new Error("Can't create config, layout not yet initialised");if(t&&!(t instanceof r.items.AbstractContentItem))throw new Error("Root must be a ContentItem");for((e={settings:r.utils.copy({},this.config.settings),dimensions:r.utils.copy({},this.config.dimensions),labels:r.utils.copy({},this.config.labels)}).content=[],(n=function(t,e){var i,o;for(i in e.config)"content"!==i&&(t[i]=e.config[i]);if(e.contentItems.length)for(t.content=[],o=0;o<e.contentItems.length;o++)t.content[o]={},n(t.content[o],e.contentItems[o])})(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){if(void 0===this._components[t])throw new r.errors.ConfigurationError('Unknown component "'+t+'"');return this._components[t]},init:function(){if(!1===this._subWindowsCreated&&(this._createSubWindows(),this._subWindowsCreated=!0),"loading"!==document.readyState&&null!==document.body){if(!0===this.isSubWindow&&!1===this._creationTimeoutPassed)return setTimeout(r.utils.fnBind(this.init,this),7),void(this._creationTimeoutPassed=!0);!0===this.isSubWindow&&this._adjustToWindowMode(),this._setContainer(),this.dropTargetIndicator=new r.controls.DropTargetIndicator(this.container),this.transitionIndicator=new r.controls.TransitionIndicator,this.updateSize(),this._create(this.config),this._bindEvents(),this.isInitialised=!0,this._adjustColumnsResponsive(),this.emit("initialised")}else s(document).ready(r.utils.fnBind(this.init,this))},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(),s(window).off("resize",this._resizeFunction),s(window).off("unload beforeunload",this._unloadFunction),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){var n;if("string"!=typeof t.type)throw new r.errors.ConfigurationError("Missing parameter 'type'",t);if("react-component"===t.type&&(t.type="component",t.componentName="lm-react-component"),!this._typeToItem[t.type])throw n="Unknown type '"+t.type+"'. Valid types are "+r.utils.objectKeys(this._typeToItem).join(","),new r.errors.ConfigurationError(n);return"component"!==t.type||e instanceof r.items.Stack||!e||!0===this.isSubWindow&&e instanceof r.items.Root||(t={type:"stack",width:t.width,height:t.height,content:[t]}),new this._typeToItem[t.type](this,t,e)},createPopout:function(t,e,n,i){var o,s,a,l,c,h,u=t,d=t instanceof r.items.AbstractContentItem,f=this;if(n=n||null,d){for(u=this.toConfig(t).content,n=r.utils.getUniqueId(),l=t.parent,c=t;1===l.contentItems.length&&!l.isRoot;)l=l.parent,c=c.parent;l.addId(n),isNaN(i)&&(i=r.utils.indexOf(c,l.contentItems))}else u instanceof Array||(u=[u]);return!e&&d&&(o=window.screenX||window.screenLeft,s=window.screenY||window.screenTop,e={left:o+(a=t.element.offset()).left,top:s+a.top,width:t.element.width(),height:t.element.height()}),e||d||(e={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),d&&t.remove(),(h=new r.controls.BrowserPopout(u,e,n,i,this)).on("initialised",(function(){f.emit("windowOpened",h)})),h.on("closed",(function(){f._$reconcilePopoutWindows()})),this.openPopouts.push(h),h},createDragSource:function(t,e){this.config.settings.constrainDragToContainer=!1;var n=new r.controls.DragSource(s(t),e,this);return this._dragSources.push(n),n},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){var n,i,o=1/0,s=null;for(n=0;n<this._itemAreas.length;n++)t>(i=this._itemAreas[n]).x1&&t<i.x2&&e>i.y1&&e<i.y2&&o>i.surface&&(o=i.surface,s=i);return s},_$createRootItemAreas:function(){var t={y2:0,x2:0,y1:"y2",x1:"x2"};for(var e in t){var n=this.root._$getArea();n.side=e,n[e]=t[e]?n[t[e]]-50:50,n.surface=(n.x2-n.x1)*(n.y2-n.y1),this._itemAreas.push(n)}},_$calculateItemAreas:function(){var t,e,n=this._getAllContentItems();if(this._itemAreas=[],1!==n.length){for(this._$createRootItemAreas(),t=0;t<n.length;t++)if(n[t].isStack&&null!==(e=n[t]._$getArea()))if(e instanceof Array)this._itemAreas=this._itemAreas.concat(e);else{this._itemAreas.push(e);var i={};r.utils.copy(i,e),r.utils.copy(i,e.contentItem._contentAreaDimensions.header.highlightArea),i.surface=(i.x2-i.x1)*(i.y2-i.y1),this._itemAreas.push(i)}}else this._itemAreas.push(this.root._$getArea())},_$normalizeContentItem:function(t,e){if(!t)throw new Error("No content item defined");if(r.utils.isFunction(t)&&(t=t()),t instanceof r.items.AbstractContentItem)return t;if(s.isPlainObject(t)&&t.type){var n=this.createContentItem(t,e);return n.callDownwards("_$init"),n}throw new Error("Invalid contentItem")},_$reconcilePopoutWindows:function(){var t,e=[];for(t=0;t<this.openPopouts.length;t++)!1===this.openPopouts[t].getWindow().closed?e.push(this.openPopouts[t]):this.emit("windowClosed",this.openPopouts[t]);this.openPopouts.length!==e.length&&(this.emit("stateChanged"),this.openPopouts=e)},_getAllContentItems:function(){var t=[],e=function(n){if(t.push(n),n.contentItems instanceof Array)for(var i=0;i<n.contentItems.length;i++)e(n.contentItems[i])};return e(this.root),t},_bindEvents:function(){this._isFullPage&&s(window).resize(this._resizeFunction),s(window).on("unload beforeunload",this._unloadFunction)},_onResize:function(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=setTimeout(r.utils.fnBind(this.updateSize,this),100)},_createConfig:function(t){var e=r.utils.getQueryStringParam("gl-window");e&&(this.isSubWindow=!0,t=localStorage.getItem(e),t=JSON.parse(t),t=(new r.utils.ConfigMinifier).unminifyConfig(t),localStorage.removeItem(e)),t=s.extend(!0,{},r.config.defaultConfig,t);var n=function(t){for(var e in t)"props"!==e&&"object"==typeof t[e]?n(t[e]):"type"===e&&"react-component"===t[e]&&(t.type="component",t.componentName="lm-react-component")};return n(t),!1===t.settings.hasHeaders&&(t.dimensions.headerHeight=0),t},_adjustToWindowMode:function(){var t=s('<div class="lm_popin" title="'+this.config.labels.popin+'"><div class="lm_icon"></div><div class="lm_bg"></div></div>');t.click(r.utils.fnBind((function(){this.emit("popIn")}),this)),document.title=r.utils.stripTags(this.config.content[0].title),s("head").append(s("body link, body style, template, .gl_keep")),this.container=s("body").html("").css("visibility","visible").append(t),document.body.offsetHeight,window.__glInstance=this},_createSubWindows:function(){var t,e;for(t=0;t<this.config.openPopouts.length;t++)e=this.config.openPopouts[t],this.createPopout(e.content,e.dimensions,e.parentId,e.indexInParent)},_setContainer:function(){var t=s(this.container||"body");if(0===t.length)throw new Error("GoldenLayout container not found");if(t.length>1)throw new Error("GoldenLayout more than one container element specified");t[0]===document.body&&(this._isFullPage=!0,s("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 r.errors.ConfigurationError(e,t);if(t.content.length>1)throw e="Top level content can't contain more then one element.",new r.errors.ConfigurationError(e,t);this.root=new r.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;if(!(t*e<=this.width)){this._updatingColumnsResponsive=!0;for(var n=t-Math.max(Math.floor(this.width/e),1),i=this.root.contentItems[0],o=this._findAllStackContainers()[0],s=0;s<n;s++){var r=i.contentItems[i.contentItems.length-1];this._addChildContentItemsToContainer(o,r)}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(t,e){"stack"===e.type?e.contentItems.forEach((function(n){t.addChild(n),e.removeChild(n,!0)})):e.contentItems.forEach(r.utils.fnBind((function(e){this._addChildContentItemsToContainer(t,e)}),this))},_findAllStackContainers:function(){var t=[];return this._findAllStackContainersRecursive(t,this.root),t},_findAllStackContainersRecursive:function(t,e){e.contentItems.forEach(r.utils.fnBind((function(e){"stack"==e.type?t.push(e):e.isComponent||this._findAllStackContainersRecursive(t,e)}),this))}}),i=[n(158)],void 0===(o=function(t){return s=t,r.LayoutManager}.apply(e,i))||(t.exports=o),r.config.itemDefaultConfig={isClosable:!0,reorderEnabled:!0,title:""},r.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,reorderOnTabMenuClick:!0,tabControlOffset:10},dimensions:{borderWidth:5,borderGrabWidth:15,minItemHeight:10,minItemWidth:10,headerHeight:20,dragProxyWidth:300,dragProxyHeight:200},labels:{close:"close",maximise:"maximise",minimise:"minimise",popout:"open in new window",popin:"pop in",tabDropdown:"additional tabs"}},r.container.ItemContainer=function(t,e,n){r.utils.EventEmitter.call(this),this.width=null,this.height=null,this.title=t.componentName,this.parent=e,this.layoutManager=n,this.isHidden=!1,this._config=t,this._element=s(['<div class="lm_item_container">','<div class="lm_content"></div>',"</div>"].join("")),this._contentElement=this._element.find(".lm_content")},r.utils.copy(r.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 n,i,o,s,r=this.parent,a=this;!r.isColumn&&!r.isRow;)if(a=r,(r=r.parent).isRoot)return!1;for(n=("height"==(i=r.isColumn?"height":"width")?e:t)/(this[i]*(1/(a.config[i]/100)))*100,o=(a.config[i]-n)/(r.contentItems.length-1),s=0;s<r.contentItems.length;s++)r.contentItems[s]===a?r.contentItems[s].config[i]=n:r.contentItems[s].config[i]+=o;return r.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(s.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){if(t!==this.width||e!==this.height){this.width=t,this.height=e;var n=this._contentElement[0],i=n.offsetWidth-n.clientWidth,o=n.offsetHeight-n.clientHeight;this._contentElement.width(this.width-i).height(this.height-o),this.emit("resize")}}}),r.controls.BrowserPopout=function(t,e,n,i,o){r.utils.EventEmitter.call(this),this.isInitialised=!1,this._config=t,this._dimensions=e,this._parentId=n,this._indexInParent=i,this._layoutManager=o,this._popoutWindow=null,this._id=null,this._createWindow()},r.utils.copy(r.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=s.extend(!0,{},this.getGlInstance().toConfig()).content[0],(e=this._layoutManager.root.getItemsById(this._parentId)[0])||(e=this._layoutManager.root.contentItems.length>0?this._layoutManager.root.contentItems[0]:this._layoutManager.root)),e.addChild(t,this._indexInParent),this.close()},_createWindow:function(){var t,e=this._createUrl(),n=Math.floor(1e6*Math.random()).toString(36),i=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,n,i),this._popoutWindow)s(this._popoutWindow).on("load",r.utils.fnBind(this._positionWindow,this)).on("unload beforeunload",r.utils.fnBind(this._onClose,this)),t=setInterval(r.utils.fnBind((function(){this._popoutWindow.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),clearInterval(t))}),this),10);else if(!0===this._layoutManager.config.settings.blockedPopoutsThrowError){var o=new Error("Popout blocked");throw o.type="popoutBlocked",o}},_serializeWindowOptions:function(t){var e,n=[];for(e in t)n.push(e+"="+t[e]);return n.join(",")},_createUrl:function(){var t,e={content:this._config},n="gl-window-config-"+r.utils.getUniqueId();e=(new r.utils.ConfigMinifier).minifyConfig(e);try{localStorage.setItem(n,JSON.stringify(e))}catch(t){throw new Error("Error while writing to localStorage "+t.toString())}return 1===(t=document.location.href.split("?")).length?t[0]+"?gl-window="+n:document.location.href+"&gl-window="+n},_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(r.utils.fnBind(this.emit,this,["closed"]),50)}}),r.controls.DragProxy=function(t,e,n,i,o,a){r.utils.EventEmitter.call(this),this._dragListener=n,this._layoutManager=i,this._contentItem=o,this._originalParent=a,this._area=null,this._lastValidArea=null,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this.element=s(r.controls.DragProxy._template),a&&a._side&&(this._sided=a._sided,this.element.addClass("lm_"+a._side),["right","bottom"].indexOf(a._side)>=0&&this.element.find(".lm_content").after(this.element.find(".lm_header"))),this.element.css({left:t,top:e}),this.element.find(".lm_tab").attr("title",r.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(),s(document.body).append(this.element);var l=this._layoutManager.container.offset();this._minX=l.left,this._minY=l.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)},r.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>',r.utils.copy(r.controls.DragProxy.prototype,{_onDrag:function(t,e,n){var i=(n=n.originalEvent&&n.originalEvent.touches?n.originalEvent.touches[0]:n).pageX,o=n.pageY;(i>this._minX&&i<this._maxX&&o>this._minY&&o<this._maxY||!0!==this._layoutManager.config.settings.constrainDragToContainer)&&this._setDropPosition(i,o)},_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.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,n=t.dragProxyHeight;this.element.width(e),this.element.height(n),e-=this._sided?t.headerHeight:0,n-=this._sided?0:t.headerHeight,this.childElementContainer.width(e),this.childElementContainer.height(n),this._contentItem.element.width(e),this._contentItem.element.height(n),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}),r.controls.DragSource=function(t,e,n){this._element=t,this._itemConfig=e,this._layoutManager=n,this._dragListener=null,this._createDragListener()},r.utils.copy(r.controls.DragSource.prototype,{_createDragListener:function(){null!==this._dragListener&&this._dragListener.destroy(),this._dragListener=new r.utils.DragListener(this._element),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this)},_onDragStart:function(t,e){var n=this._itemConfig;r.utils.isFunction(n)&&(n=n());var i=this._layoutManager._$normalizeContentItem(s.extend(!0,{},n)),o=new r.controls.DragProxy(t,e,this._dragListener,this._layoutManager,i,null);this._layoutManager.transitionIndicator.transitionElements(this._element,o.element)}}),r.controls.DropTargetIndicator=function(){this.element=s(r.controls.DropTargetIndicator._template),s(document.body).append(this.element)},r.controls.DropTargetIndicator._template='<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>',r.utils.copy(r.controls.DropTargetIndicator.prototype,{destroy:function(){this.element.remove()},highlight:function(t,e,n,i){this.highlightArea({x1:t,y1:e,x2:n,y2:i})},highlightArea:function(t){this.element.css({left:t.x1,top:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}).show()},hide:function(){this.element.hide()}}),r.controls.Header=function(t,e){r.utils.EventEmitter.call(this),this.layoutManager=t,this.element=s(r.controls.Header._template),!0===this.layoutManager.config.settings.selectionEnabled&&(this.element.addClass("lm_selectable"),this.element.on("click touchstart",r.utils.fnBind(this._onHeaderClick,this))),this.tabsContainer=this.element.find(".lm_tabs"),this.tabDropdownContainer=this.element.find(".lm_tabdropdown_list"),this.tabDropdownContainer.hide(),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.hideAdditionalTabsDropdown=r.utils.fnBind(this._hideAdditionalTabsDropdown,this),s(document).mouseup(this.hideAdditionalTabsDropdown),this._lastVisibleTabIndex=-1,this._tabControlOffset=this.layoutManager.config.settings.tabControlOffset,this._createControls()},r.controls.Header._template=['<div class="lm_header">','<ul class="lm_tabs"></ul>','<ul class="lm_controls"></ul>','<ul class="lm_tabdropdown_list"></ul>',"</div>"].join(""),r.utils.copy(r.controls.Header.prototype,{createTab:function(t,e){var n,i;for(i=0;i<this.tabs.length;i++)if(this.tabs[i].contentItem===t)return;if(n=new r.controls.Tab(this,t),0===this.tabs.length)return this.tabs.push(n),void this.tabsContainer.append(n.element);void 0===e&&(e=this.tabs.length),e>0?this.tabs[e-1].element.after(n.element):this.tabs[0].element.before(n.element),this.tabs.splice(e,0,n),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){var e,n,i,o;for(e=0;e<this.tabs.length;e++)i=this.tabs[e].contentItem===t,this.tabs[e].setActive(i),!0===i&&(this.activeContentItem=t,this.parent.config.activeItemIndex=e);if(this.layoutManager.config.settings.reorderOnTabMenuClick&&-1!==this._lastVisibleTabIndex&&this.parent.config.activeItemIndex>this._lastVisibleTabIndex){for(o=this.tabs[this.parent.config.activeItemIndex],n=this.parent.config.activeItemIndex;n>0;n--)this.tabs[n]=this.tabs[n-1];this.tabs[0]=o,this.parent.config.activeItemIndex=0}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},_$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();s(document).off("mouseup",this.hideAdditionalTabsDropdown),this.element.remove()},_getHeaderSetting:function(t){if(t in this.parent._header)return this.parent._header[t]},_createControls:function(){var t,e,n,i,o,s,a,l,c;c=r.utils.fnBind(this._showAdditionalTabsDropdown,this),l=this.layoutManager.config.labels.tabDropdown,this.tabDropdownButton=new r.controls.HeaderButton(this,l,"lm_tabdropdown",c),this.tabDropdownButton.element.hide(),this._getHeaderSetting("popout")&&(e=r.utils.fnBind(this._onPopoutClick,this),n=this._getHeaderSetting("popout"),new r.controls.HeaderButton(this,n,"lm_popout",e)),this._getHeaderSetting("maximise")&&(s=r.utils.fnBind(this.parent.toggleMaximise,this.parent),i=this._getHeaderSetting("maximise"),o=this._getHeaderSetting("minimise"),a=new r.controls.HeaderButton(this,i,"lm_maximise",s),this.parent.on("maximised",(function(){a.element.attr("title",o)})),this.parent.on("minimised",(function(){a.element.attr("title",i)}))),this._isClosable()&&(t=r.utils.fnBind(this.parent.remove,this.parent),n=this._getHeaderSetting("close"),this.closeButton=new r.controls.HeaderButton(this,n,"lm_close",t))},_showAdditionalTabsDropdown:function(){this.tabDropdownContainer.show()},_hideAdditionalTabsDropdown:function(t){this.tabDropdownContainer.hide()},_isClosable:function(){return this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon},_onPopoutClick:function(){!0===this.layoutManager.config.settings.popoutWholeStack?this.parent.popout():this.activeContentItem.popout()},_onHeaderClick:function(t){t.target===this.element[0]&&this.parent.select()},_updateTabSizes:function(t){if(0!==this.tabs.length){this.tabDropdownButton.element.toggle(!0===t);var e=function(t){return t?"width":"height"};this.element.css(e(!this.parent._sided),""),this.element[e(this.parent._sided)](this.layoutManager.config.dimensions.headerHeight);var n,i,o,s,r=this.element.outerWidth()-this.controlsContainer.outerWidth()-this._tabControlOffset,a=0,l=0,c=0,h=this.layoutManager.config.settings.tabOverlapAllowance,u=!1,d=this.activeContentItem?this.tabs.indexOf(this.activeContentItem.tab):0,f=this.tabs[d];for(this.parent._sided&&(r=this.element.outerHeight()-this.controlsContainer.outerHeight()-this._tabControlOffset),this._lastVisibleTabIndex=-1,i=0;i<this.tabs.length;i++)if(n=this.tabs[i].element,this.tabsContainer.append(n),a+=n.outerWidth()+parseInt(n.css("margin-right"),10),(l=d<=i?a:a+f.element.outerWidth()+parseInt(f.element.css("margin-right"),10))>r){if(u)i===d&&(n.css({"z-index":"auto","margin-left":""}),this.tabsContainer.append(n));else if((c=d>0&&d<=i?(l-r)/(i-1):(l-r)/i)<h){for(o=0;o<=i;o++)s=o!==d&&0!==o?"-"+c+"px":"",this.tabs[o].element.css({"z-index":i-o,"margin-left":s});this._lastVisibleTabIndex=i,this.tabsContainer.append(n)}else u=!0;if(u&&i!==d){if(!t)return void this._updateTabSizes(!0);n.css({"z-index":"auto","margin-left":""}),this.tabDropdownContainer.append(n)}}else this._lastVisibleTabIndex=i,n.css({"z-index":"auto","margin-left":""}),this.tabsContainer.append(n)}}}),r.controls.HeaderButton=function(t,e,n,i){this._header=t,this.element=s('<li class="'+n+'" title="'+e+'"></li>'),this._header.on("destroy",this._$destroy,this),this._action=i,this.element.on("click touchstart",this._action),this._header.controlsContainer.append(this.element)},r.utils.copy(r.controls.HeaderButton.prototype,{_$destroy:function(){this.element.off(),this.element.remove()}}),r.controls.Splitter=function(t,e,n){this._isVertical=t,this._size=e,this._grabSize=n<e?e:n,this.element=this._createElement(),this._dragListener=new r.utils.DragListener(this.element)},r.utils.copy(r.controls.Splitter.prototype,{on:function(t,e,n){this._dragListener.on(t,e,n)},_$destroy:function(){this.element.remove()},_createElement:function(){var t=s('<div class="lm_drag_handle"></div>'),e=s('<div class="lm_splitter"></div>');e.append(t);var n=this._grabSize-this._size,i=n/2;return this._isVertical?(t.css("top",-i),t.css("height",this._size+n),e.addClass("lm_vertical"),e.height(this._size)):(t.css("left",-i),t.css("width",this._size+n),e.addClass("lm_horizontal"),e.width(this._size)),e}}),r.controls.Tab=function(t,e){this.header=t,this.contentItem=e,this.element=s(r.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 r.utils.DragListener(this.element),this._dragListener.on("dragStart",this._onDragStart,this),this.contentItem.on("destroy",this._dragListener.destroy,this._dragListener)),this._onTabClickFn=r.utils.fnBind(this._onTabClick,this),this._onCloseClickFn=r.utils.fnBind(this._onCloseClick,this),this.element.on("mousedown touchstart",this._onTabClickFn),this.contentItem.config.isClosable?(this.closeElement.on("click touchstart",this._onCloseClickFn),this.closeElement.on("mousedown",this._onCloseMousedown)):this.closeElement.remove(),this.contentItem.tab=this,this.contentItem.emit("tab",this),this.contentItem.layoutManager.emit("tabCreated",this),this.contentItem.isComponent&&(this.contentItem.container.tab=this,this.contentItem.container.emit("tab",this))},r.controls.Tab._template='<li class="lm_tab"><i class="lm_left"></i><span class="lm_title"></span><div class="lm_close_tab"></div><i class="lm_right"></i></li>',r.utils.copy(r.controls.Tab.prototype,{setTitle:function(t){this.element.attr("title",r.utils.stripTags(t)),this.titleElement.html(t)},setActive:function(t){t!==this.isActive&&(this.isActive=t,t?this.element.addClass("lm_active"):this.element.removeClass("lm_active"))},_$destroy:function(){this.element.off("mousedown touchstart",this._onTabClickFn),this.closeElement.off("click touchstart",this._onCloseClickFn),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 r.controls.DragProxy(t,e,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)},_onTabClick:function(t){if(0===t.button||"touchstart"===t.type){var e=this.header.parent.getActiveContentItem();this.contentItem!==e&&this.header.parent.setActiveContentItem(this.contentItem)}else 1===t.button&&this.contentItem.config.isClosable&&this._onCloseClick(t)},_onCloseClick:function(t){t.stopPropagation(),this.header.parent.removeChild(this.contentItem)},_onCloseMousedown:function(t){t.stopPropagation()}}),r.controls.TransitionIndicator=function(){this._element=s('<div class="lm_transition_indicator"></div>'),s(document.body).append(this._element),this._toElement=null,this._fromDimensions=null,this._totalAnimationDuration=200,this._animationStartTime=null},r.utils.copy(r.controls.TransitionIndicator.prototype,{destroy:function(){this._element.remove()},transitionElements:function(t,e){},_nextAnimationFrame:function(){var t,e=this._measure(this._toElement),n=(r.utils.now()-this._animationStartTime)/this._totalAnimationDuration,i={};if(n>=1)this._element.hide();else{for(t in e.opacity=0,this._fromDimensions)i[t]=this._fromDimensions[t]+(e[t]-this._fromDimensions[t])*n;this._element.css(i),r.utils.animFrame(r.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()}}}),r.errors.ConfigurationError=function(t,e){Error.call(this),this.name="Configuration Error",this.message=t,this.node=e},r.errors.ConfigurationError.prototype=new Error,r.items.AbstractContentItem=function(t,e,n){r.utils.EventEmitter.call(this),this.config=this._extendItemNode(e),this.type=e.type,this.contentItems=[],this.parent=n,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(r.utils.EventEmitter.ALL_EVENT,this._propagateEvent,this),e.content&&this._createContentItems(e)},r.utils.copy(r.items.AbstractContentItem.prototype,{setSize:function(){throw new Error("Abstract Method")},callDownwards:function(t,e,n,i){var o;for(!0!==n&&!0!==i&&this[t].apply(this,e||[]),o=0;o<this.contentItems.length;o++)this.contentItems[o].callDownwards(t,e,n);!0===n&&!0!==i&&this[t].apply(this,e||[])},removeChild:function(t,e){var n=r.utils.indexOf(t,this.contentItems);if(-1===n)throw new Error("Can't remove child item. Unknown content item");!0!==e&&this.contentItems[n]._$destroy(),this.contentItems.splice(n,1),this.config.content.splice(n,1),this.contentItems.length>0?this.callDownwards("setSize"):this instanceof r.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,n){e=this.layoutManager._$normalizeContentItem(e);var i=r.utils.indexOf(t,this.contentItems),o=t.element[0].parentNode;if(-1===i)throw new Error("Can't replace child. oldChild is not child of this");o.replaceChild(e.element[0],t.element[0]),!0===n&&(t.parent=null,t._$destroy()),this.contentItems[i]=e,e.parent=this,this.isStack&&(this.header.tabs[i].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.emit("stateChanged")},hasId:function(t){return!!this.config.id&&("string"==typeof this.config.id?this.config.id===t:this.config.id instanceof Array?-1!==r.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");if("string"==typeof this.config.id)delete this.config.id;else if(this.config.id instanceof Array){var e=r.utils.indexOf(t,this.config.id);this.config.id.splice(e,1)}},getItemsByFilter:function(t){var e=[],n=function(i){for(var o=0;o<i.contentItems.length;o++)!0===t(i.contentItems[o])&&e.push(i.contentItems[o]),n(i.contentItems[o])};return n(this),e},getItemsById:function(t){return this.getItemsByFilter((function(e){return e.config.id instanceof Array?-1!==r.utils.indexOf(t,e.config.id):e.config.id===t}))},getItemsByType:function(t){return this._$getItemsByProperty("type",t)},getComponentsByName:function(t){var e,n=this._$getItemsByProperty("componentName",t),i=[];for(e=0;e<n.length;e++)i.push(n[e].instance);return i},_$getItemsByProperty:function(t,e){return this.getItemsByFilter((function(n){return n[t]===e}))},_$setParent:function(t){this.parent=t},_$highlightDropZone:function(t,e,n){this.layoutManager.dropTargetIndicator.highlightArea(n)},_$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){var e,n,i=this.getItemsByType("stack");for(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(),n=t.width(),i=t.height();return{x1:e.left,y1:e.top,x2:e.left+n,y2:e.top+i,surface:n*i,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 r.utils.BubblingEvent(t,this);this.emit(t,e)},_createContentItems:function(t){var e,n;if(!(t.content instanceof Array))throw new r.errors.ConfigurationError("content must be an Array",t);for(n=0;n<t.content.length;n++)e=this.layoutManager.createContentItem(t.content[n],this),this.contentItems.push(e)},_extendItemNode:function(t){for(var e in r.config.itemDefaultConfig)void 0===t[e]&&(t[e]=r.config.itemDefaultConfig[e]);return t},_propagateEvent:function(t,e){e instanceof r.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===r.utils.indexOf(t,this._throttledEvents)?this.layoutManager.emit(t,e.origin):!0!==this._pendingEventPropagations[t]&&(this._pendingEventPropagations[t]=!0,r.utils.animFrame(r.utils.fnBind(this._propagateEventToLayoutManager,this,[t,e])))},_propagateEventToLayoutManager:function(t,e){this._pendingEventPropagations[t]=!1,this.layoutManager.emit(t,e)}}),r.items.Component=function(t,e,n){r.items.AbstractContentItem.call(this,t,e,n);var i=t.getComponent(this.config.componentName),o=s.extend(!0,{},this.config.componentState||{});o.componentName=this.config.componentName,this.componentName=this.config.componentName,""===this.config.title&&(this.config.title=this.config.componentName),this.isComponent=!0,this.container=new r.container.ItemContainer(this.config,this,t),this.instance=new i(this.container,o),this.element=this.container._element},r.utils.extend(r.items.Component,r.items.AbstractContentItem),r.utils.copy(r.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(){r.items.AbstractContentItem.prototype._$init.call(this),this.container.emit("open")},_$hide:function(){this.container.hide(),r.items.AbstractContentItem.prototype._$hide.call(this)},_$show:function(){this.container.show(),r.items.AbstractContentItem.prototype._$show.call(this)},_$shown:function(){this.container.shown(),r.items.AbstractContentItem.prototype._$shown.call(this)},_$destroy:function(){this.container.emit("destroy",this),r.items.AbstractContentItem.prototype._$destroy.call(this)},_$getArea:function(){return null}}),r.items.Root=function(t,e,n){r.items.AbstractContentItem.call(this,t,e,null),this.isRoot=!0,this.type="root",this.element=s('<div class="lm_goldenlayout lm_item lm_root"></div>'),this.childElementContainer=this.element,this._containerElement=n,this._containerElement.append(this.element)},r.utils.extend(r.items.Root,r.items.AbstractContentItem),r.utils.copy(r.items.Root.prototype,{addChild:function(t){if(this.contentItems.length>0)throw new Error("Root node can only have a single child");t=this.layoutManager._$normalizeContentItem(t,this),this.childElementContainer.append(t.element),r.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,n){this.layoutManager.tabDropPlaceholder.remove(),r.items.AbstractContentItem.prototype._$highlightDropZone.apply(this,arguments)},_$onDrop:function(t,e){var n;if(t.isComponent&&((n=this.layoutManager.createContentItem({type:"stack",header:t.config.header||{}},this))._$init(),n.addChild(t),t=n),this.contentItems.length){var i="x"==e.side[0]?"row":"column",o="x"==e.side[0]?"width":"height",s="2"==e.side[1],a=this.contentItems[0];if(!a instanceof r.items.RowOrColumn||a.type!=i){var l=this.layoutManager.createContentItem({type:i},this);this.replaceChild(a,l),l.addChild(t,s?0:void 0,!0),l.addChild(a,s?void 0:0,!0),a.config[o]=50,t.config[o]=50,l.callDownwards("setSize")}else{var c=a.contentItems[s?0:a.contentItems.length-1];a.addChild(t,s?0:void 0,!0),c.config[o]*=.5,t.config[o]=c.config[o],a.callDownwards("setSize")}}else this.addChild(t)}}),r.items.RowOrColumn=function(t,e,n,i){r.items.AbstractContentItem.call(this,e,n,i),this.isRow=!t,this.isColumn=t,this.element=s('<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},r.utils.extend(r.items.RowOrColumn,r.items.AbstractContentItem),r.utils.copy(r.items.RowOrColumn.prototype,{addChild:function(t,e,n){var i,o,s,a;if(t=this.layoutManager._$normalizeContentItem(t,this),void 0===e&&(e=this.contentItems.length),this.contentItems.length>0?(a=this._createSplitter(Math.max(0,e-1)).element,e>0?(this.contentItems[e-1].element.after(a),a.after(t.element)):(this.contentItems[0].element.before(a),a.before(t.element))):this.childElementContainer.append(t.element),r.items.AbstractContentItem.prototype.addChild.call(this,t,e),i=1/this.contentItems.length*100,!0!==n){for(s=0;s<this.contentItems.length;s++)this.contentItems[s]===t?t.config[this._dimension]=i:(o=this.contentItems[s].config[this._dimension]*=(100-i)/100,this.contentItems[s].config[this._dimension]=o);this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}else this.emitBubblingEvent("stateChanged")},removeChild:function(t,e){var n,i,o=t.config[this._dimension],s=r.utils.indexOf(t,this.contentItems),a=Math.max(s-1,0);if(-1===s)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[a]&&(this._splitter[a]._$destroy(),this._splitter.splice(a,1)),n=0;n<this.contentItems.length;n++)this.contentItems[n]!==t&&(this.contentItems[n].config[this._dimension]+=o/(this.contentItems.length-1));r.items.AbstractContentItem.prototype.removeChild.call(this,t,e),1===this.contentItems.length&&!0===this.config.isClosable?(i=this.contentItems[0],this.contentItems=[],this.parent.replaceChild(this,i,!0)):(this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged"))},replaceChild:function(t,e){var n=t.config[this._dimension];r.items.AbstractContentItem.prototype.replaceChild.call(this,t,e),e.config[this._dimension]=n,this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")},setSize:function(){this.contentItems.length>0&&(this._calculateRelativeSizes(),this._setAbsoluteSizes()),this.emitBubblingEvent("stateChanged"),this.emit("resize")},_$init:function(){var t;if(!0!==this.isInitialised)for(r.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(){var t,e=this._calculateAbsoluteSizes();for(t=0;t<this.contentItems.length;t++)e.additionalPixel-t>0&&e.itemSizes[t]++,this._isColumn?(this.contentItems[t].element.width(e.totalWidth),this.contentItems[t].element.height(e.itemSizes[t])):(this.contentItems[t].element.width(e.itemSizes[t]),this.contentItems[t].element.height(e.totalHeight))},_calculateAbsoluteSizes:function(){var t,e,n=(this.contentItems.length-1)*this._splitterSize,i=this.element.width(),o=this.element.height(),s=0,r=[];for(this._isColumn?o-=n:i-=n,t=0;t<this.contentItems.length;t++)s+=e=this._isColumn?Math.floor(o*(this.contentItems[t].config.height/100)):Math.floor(i*(this.contentItems[t].config.width/100)),r.push(e);return{itemSizes:r,additionalPixel:Math.floor((this._isColumn?o:i)-s),totalWidth:i,totalHeight:o}},_calculateRelativeSizes:function(){var t,e=0,n=[],i=this._isColumn?"height":"width";for(t=0;t<this.contentItems.length;t++)void 0!==this.contentItems[t].config[i]?e+=this.contentItems[t].config[i]:n.push(this.contentItems[t]);if(100!==Math.round(e))if(Math.round(e)<100&&n.length>0){for(t=0;t<n.length;t++)n[t].config[i]=(100-e)/n.length;this._respectMinItemWidth()}else{if(Math.round(e)>100)for(t=0;t<n.length;t++)n[t].config[i]=50,e+=50;for(t=0;t<this.contentItems.length;t++)this.contentItems[t].config[i]=this.contentItems[t].config[i]/e*100;this._respectMinItemWidth()}else this._respectMinItemWidth()},_respectMinItemWidth:function(){var t,e,n,i,o=this.layoutManager.config.dimensions&&this.layoutManager.config.dimensions.minItemWidth||0,s=[],r=0,a=0,l=0,c=0,h=[];if(!(this._isColumn||!o||this.contentItems.length<=1)){t=this._calculateAbsoluteSizes();for(var u=0;u<this.contentItems.length;u++)this.contentItems[u],(c=t.itemSizes[u])<o?(a+=o-c,i={width:o}):(r+=c-o,i={width:c},s.push(i)),h.push(i);if(!(0===a||a>r)){for(e=a/r,l=a,u=0;u<s.length;u++)i=s[u],l-=n=Math.round((i.width-o)*e),i.width-=n;for(0!==l&&(h[h.length-1].width-=l),u=0;u<this.contentItems.length;u++)this.contentItems[u].config.width=h[u].width/t.totalWidth*100}}},_createSplitter:function(t){var e;return(e=new r.controls.Splitter(this._isColumn,this._splitterSize,this._splitterGrabSize)).on("drag",r.utils.fnBind(this._onSplitterDrag,this,[e]),this),e.on("dragStop",r.utils.fnBind(this._onSplitterDragStop,this,[e]),this),e.on("dragStart",r.utils.fnBind(this._onSplitterDragStart,this,[e]),this),this._splitter.splice(t,0,e),e},_getItemsForSplitter:function(t){var e=r.utils.indexOf(t,this._splitter);return{before:this.contentItems[e],after:this.contentItems[e+1]}},_getMinimumDimensions:function(t){for(var e=0,n=0,i=0;i<t.length;++i)e=Math.max(t[i].minWidth||0,e),n=Math.max(t[i].minHeight||0,n);return{horizontal:e,vertical:n}},_onSplitterDragStart:function(t){var e=this._getItemsForSplitter(t),n=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],i=this._getMinimumDimensions(e.before.config.content),o=this._isColumn?i.vertical:i.horizontal,s=this._getMinimumDimensions(e.after.config.content),r=this._isColumn?s.vertical:s.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(e.before.element[this._dimension]()-(o||n)),this._splitterMaxPosition=e.after.element[this._dimension]()-(r||n)},_onSplitterDrag:function(t,e,n){var i=this._isColumn?n: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),n=e.before.element[this._dimension](),i=e.after.element[this._dimension](),o=(this._splitterPosition+n)/(n+i),s=e.before.config[this._dimension]+e.after.config[this._dimension];e.before.config[this._dimension]=o*s,e.after.config[this._dimension]=(1-o)*s,t.element.css({top:0,left:0}),r.utils.animFrame(r.utils.fnBind(this.callDownwards,this,["setSize"]))}}),r.items.Stack=function(t,e,n){r.items.AbstractContentItem.call(this,t,e,n),this.element=s('<div class="lm_item lm_stack"></div>'),this._activeContentItem=null;var 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&&r.utils.copy(this._header,i.header),e.header&&r.utils.copy(this._header,e.header),e.content&&e.content[0]&&e.content[0].header&&r.utils.copy(this._header,e.content[0].header),this._dropZones={},this._dropSegment=null,this._contentAreaDimensions=null,this._dropIndex=null,this.isStack=!0,this.childElementContainer=s('<div class="lm_items"></div>'),this.header=new r.controls.Header(t,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()},r.utils.extend(r.items.Stack,r.items.AbstractContentItem),r.utils.copy(r.items.Stack.prototype,{setSize:function(){var t,e=this._header.show?this.layoutManager.config.dimensions.headerHeight:0,n=this.element.width()-(this._sided?e:0),i=this.element.height()-(this._sided?0:e);for(this.childElementContainer.width(n),this.childElementContainer.height(i),t=0;t<this.contentItems.length;t++)this.contentItems[t].element.width(n).height(i);this.emit("resize"),this.emitBubblingEvent("stateChanged")},_$init:function(){var t,e;if(!0!==this.isInitialised){for(r.items.AbstractContentItem.prototype._$init.call(this),t=0;t<this.contentItems.length;t++)this.header.createTab(this.contentItems[t]),this.contentItems[t]._$hide();if(this.contentItems.length>0){if(!(e=this.contentItems[this.config.activeItemIndex||0]))throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(e)}}},setActiveContentItem:function(t){if(-1===r.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),r.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 n=r.utils.indexOf(t,this.contentItems);r.items.AbstractContentItem.prototype.removeChild.call(this,t,e),this.header.removeTab(t),this.header.activeContentItem===t&&(this.contentItems.length>0?this.setActiveContentItem(this.contentItems[Math.max(n-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")},_$validateClosability:function(){var t,e,n;for(t=this.header._isClosable(),n=0,e=this.contentItems.length;n<e&&t;n++)t=this.contentItems[n].config.isClosable;this.header._$setClosable(t)},_$destroy:function(){r.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);if("body"!==this._dropSegment){var e,n,i,o="top"===this._dropSegment||"bottom"===this._dropSegment,s="left"===this._dropSegment||"right"===this._dropSegment,a="top"===this._dropSegment||"left"===this._dropSegment,l=o&&this.parent.isColumn||s&&this.parent.isRow,c=o?"column":"row",h=o?"height":"width";t.isComponent&&((n=this.layoutManager.createContentItem({type:"stack",header:t.config.header||{}},this))._$init(),n.addChild(t),t=n),l?(e=r.utils.indexOf(this,this.parent.contentItems),this.parent.addChild(t,a?e:e+1,!0),this.config[h]*=.5,t.config[h]=this.config[h],this.parent.callDownwards("setSize")):(c=o?"column":"row",i=this.layoutManager.createContentItem({type:c},this),this.parent.replaceChild(this,i),i.addChild(t,a?0:void 0,!0),i.addChild(this,a?void 0:0,!0),this.config[h]=50,t.config[h]=50,i.callDownwards("setSize"))}else this.addChild(t)},_$highlightDropZone:function(t,e){var n,i;for(n in this._contentAreaDimensions)if((i=this._contentAreaDimensions[n].hoverArea).x1<t&&i.x2>t&&i.y1<e&&i.y2>e)return void("header"===n?(this._dropSegment="header",this._highlightHeaderDropZone(this._sided?e:t)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(n)))},_$getArea:function(){if(!1===this.element.is(":visible"))return null;var t=r.items.AbstractContentItem.prototype._$getArea,e=t.call(this,this.header.element),n=t.call(this,this.childElementContainer),i=n.x2-n.x1,o=n.y2-n.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:n.x1,y1:n.y1,x2:n.x2,y2:n.y2},highlightArea:{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2}},t.call(this,this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:n.x1,y1:n.y1,x2:n.x1+.25*i,y2:n.y2},highlightArea:{x1:n.x1,y1:n.y1,x2:n.x1+.5*i,y2:n.y2}},this._contentAreaDimensions.top={hoverArea:{x1:n.x1+.25*i,y1:n.y1,x2:n.x1+.75*i,y2:n.y1+.5*o},highlightArea:{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y1+.5*o}},this._contentAreaDimensions.right={hoverArea:{x1:n.x1+.75*i,y1:n.y1,x2:n.x2,y2:n.y2},highlightArea:{x1:n.x1+.5*i,y1:n.y1,x2:n.x2,y2:n.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:n.x1+.25*i,y1:n.y1+.5*o,x2:n.x1+.75*i,y2:n.y2},highlightArea:{x1:n.x1,y1:n.y1+.5*o,x2:n.x2,y2:n.y2}},t.call(this,this.element))},_highlightHeaderDropZone:function(t){var e,n,i,o,s,r,a,l,c=this.header.tabs.length,h=!1;if(0===c)return a=this.header.element.offset(),void this.layoutManager.dropTargetIndicator.highlightArea({x1:a.left,x2:a.left+100,y1:a.top+this.header.element.height()-20,y2:a.top+this.header.element.height()});for(e=0;e<c;e++)if(s=(n=this.header.tabs[e].element).offset(),this._sided?(o=s.top,i=s.left,l=n.height()):(o=s.left,i=s.top,l=n.width()),t>o&&t<o+l){h=!0;break}if(!(!1===h&&t<o)){if(t<o+l/2?(this._dropIndex=e,n.before(this.layoutManager.tabDropPlaceholder)):(this._dropIndex=Math.min(e+1,c),n.after(this.layoutManager.tabDropPlaceholder)),this._sided)return placeHolderTop=this.layoutManager.tabDropPlaceholder.offset().top,void this.layoutManager.dropTargetIndicator.highlightArea({x1:i,x2:i+n.innerHeight(),y1:placeHolderTop,y2:placeHolderTop+this.layoutManager.tabDropPlaceholder.width()});r=this.layoutManager.tabDropPlaceholder.offset().left,this.layoutManager.dropTargetIndicator.highlightArea({x1:r,x2:r+this.layoutManager.tabDropPlaceholder.width(),y1:i,y2:i+n.innerHeight()})}},_resetHeaderDropZone:function(){this.layoutManager.tabDropPlaceholder.remove()},_setupHeaderPosition:function(){var t=["right","left","bottom"].indexOf(this._header.show)>=0&&this._header.show;if(this.header.element.toggle(!!this._header.show),this._side=t,this._sided=["right","left"].indexOf(this._side)>=0,this.element.removeClass("lm_left lm_right lm_bottom"),this._side&&this.element.addClass("lm_"+this._side),this.element.find(".lm_header").length&&this.childElementContainer){var e=["right","bottom"].indexOf(this._side)>=0?"before":"after";this.header.element[e](this.childElementContainer),this.callDownwards("setSize")}},_highlightBodyDropZone:function(t){var e=this._contentAreaDimensions[t].highlightArea;this.layoutManager.dropTargetIndicator.highlightArea(e),this._dropSegment=t}}),r.utils.BubblingEvent=function(t,e){this.name=t,this.origin=e,this.isPropagationStopped=!1},r.utils.BubblingEvent.prototype.stopPropagation=function(){this.isPropagationStopped=!0},r.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"],this._keys.length>36)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"]},r.utils.copy(r.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,n){var i,o;for(i in t)t instanceof Array&&(i=parseInt(i,10)),t.hasOwnProperty(i)&&(o=this[n](i,this._keys),"object"==typeof t[i]?(e[o]=t[i]instanceof Array?[]:{},this._nextLevel(t[i],e[o],n)):e[o]=this[n](t[i],this._values))},_min:function(t,e){if("string"==typeof t&&1===t.length)return"___"+t;var n=r.utils.indexOf(t,e);return-1===n?t:n.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}}),r.utils.EventHub=function(t){r.utils.EventEmitter.call(this),this._layoutManager=t,this._dontPropagateToParent=null,this._childEventSource=null,this.on(r.utils.EventEmitter.ALL_EVENT,r.utils.fnBind(this._onEventFromThis,this)),this._boundOnEventFromChild=r.utils.fnBind(this._onEventFromChild,this),s(window).on("gl_child_event",this._boundOnEventFromChild)},r.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},r.utils.EventHub.prototype._$onEventFromParent=function(t){this._dontPropagateToParent=t[0],this.emit.apply(this,t)},r.utils.EventHub.prototype._onEventFromChild=function(t){this._childEventSource=t.originalEvent.__gl,this.emit.apply(this,t.originalEvent.__glArgs)},r.utils.EventHub.prototype._propagateToParent=function(t){var e;document.createEvent?(e=window.opener.document.createEvent("HTMLEvents")).initEvent("gl_child_event",!0,!0):(e=window.opener.document.createEventObject()).eventType="gl_child_event",e.eventName="gl_child_event",e.__glArgs=t,e.__gl=this._layoutManager,document.createEvent?window.opener.dispatchEvent(e):window.opener.fireEvent("on"+e.eventType,e)},r.utils.EventHub.prototype._propagateToChildren=function(t){var e,n;for(n=0;n<this._layoutManager.openPopouts.length;n++)(e=this._layoutManager.openPopouts[n].getGlInstance())&&e!==this._childEventSource&&e.eventHub._$onEventFromParent(t)},r.utils.EventHub.prototype.destroy=function(){s(window).off("gl_child_event",this._boundOnEventFromChild)},r.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)},r.utils.copy(r.utils.ReactComponentHandler.prototype,{_render:function(){this._reactComponent=ReactDOM.render(this._getReactComponent(),this._container.getElement()[0]),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)))throw new Error('React component "'+e+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return t},_getReactComponent:function(){var t={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container},e=s.extend(t,this._container._config.props);return React.createElement(this._reactClass,e)}})},157:function(t,e,n){"use strict";n.r(e);var i=n(155),o=new(n.n(i).a)({settings:{showPopoutIcon:!1,showCloseIcon:!1},dimensions:{minItemHeight:40},content:[{type:"row",content:[{type:"column",width:40,content:[{type:"component",isClosable:!1,componentName:"template",title:"Game",componentState:{id:"client_wrapper"}}]},{type:"column",content:[{type:"row",height:65,content:[{type:"stack",content:[{type:"component",isClosable:!1,title:"Main",componentName:"template",componentState:{id:"mainmenu"}},{type:"component",isClosable:!1,title:"Log",componentName:"template",componentState:{id:"log"}}]},{type:"component",title:"Music",width:30,componentName:"template",componentState:{id:"music"}}]},{type:"row",content:[{type:"component",title:"Server chat",componentName:"template",componentState:{id:"ooc"}}]}]}]}]});o.registerComponent("template",(function(t,e){var n=document.querySelector("#".concat(e.id));t.getElement().html(n.content)})),o.init()},158:function(t,e,n){var i; +!function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=164)}({162:function(t,e,n){var i,o,s,r;s=window.$,(r={config:{},container:{},controls:{},errors:{},items:{},utils:{}}).utils.F=function(){},r.utils.extend=function(t,e){t.prototype=r.utils.createObject(e.prototype),t.prototype.contructor=t},r.utils.createObject=function(t){return"function"==typeof Object.create?Object.create(t):(r.utils.F.prototype=t,new r.utils.F)},r.utils.objectKeys=function(t){var e,n;if("function"==typeof Object.keys)return Object.keys(t);for(n in e=[],t)e.push(n);return e},r.utils.getHashValue=function(t){var e=location.hash.match(new RegExp(t+"=([^&]*)"));return e?e[1]:null},r.utils.getQueryStringParam=function(t){if(window.location.hash)return r.utils.getHashValue(t);if(!window.location.search)return null;var e,n,i=window.location.search.substr(1).split("&"),o={};for(n=0;n<i.length;n++)o[(e=i[n].split("="))[0]]=e[1];return o[t]||null},r.utils.copy=function(t,e){for(var n in e)t[n]=e[n];return t},r.utils.animFrame=function(t){return(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)})((function(){t()}))},r.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 n=0;n<e.length;n++)if(e[n]===t)return n;return-1},"object"!=typeof Int8Array?r.utils.isFunction=function(t){return"function"==typeof t||!1}:r.utils.isFunction=function(t){return"[object Function]"===toString.call(t)},r.utils.fnBind=function(t,e,n){if(void 0!==Function.prototype.bind)return Function.prototype.bind.apply(t,[e].concat(n||[]));var i=function(){var o=(n||[]).concat(Array.prototype.slice.call(arguments,0));if(!(this instanceof i))return t.apply(e,o);t.apply(this,o)};return i.prototype=t.prototype,i},r.utils.removeFromArray=function(t,e){var n=r.utils.indexOf(t,e);if(-1===n)throw new Error("Can't remove item from array. Item is not in the array");e.splice(n,1)},r.utils.now=function(){return"function"==typeof Date.now?Date.now():(new Date).getTime()},r.utils.getUniqueId=function(){return(1e15*Math.random()).toString(36).replace(".","")},r.utils.filterXss=function(t,e){var n=t.replace(/javascript/gi,"javascript").replace(/expression/gi,"expression").replace(/onload/gi,"onload").replace(/script/gi,"script").replace(/onerror/gi,"onerror");return!0===e?n:n.replace(/>/g,">").replace(/</g,"<")},r.utils.stripTags=function(t){return s.trim(t.replace(/(<([^>]+)>)/gi,""))},r.utils.EventEmitter=function(){this._mSubscriptions={},this._mSubscriptions[r.utils.EventEmitter.ALL_EVENT]=[],this.on=function(t,e,n){if(!r.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:n})},this.emit=function(t){var e,n,i;i=Array.prototype.slice.call(arguments,1);var o=this._mSubscriptions[t];if(o)for(o=o.slice(),e=0;e<o.length;e++)n=o[e].ctx||{},o[e].fn.apply(n,i);i.unshift(t);var s=this._mSubscriptions[r.utils.EventEmitter.ALL_EVENT].slice();for(e=0;e<s.length;e++)n=s[e].ctx||{},s[e].fn.apply(n,i)},this.unbind=function(t,e,n){if(!this._mSubscriptions[t])throw new Error("No subscribtions to unsubscribe for event "+t);var i,o=!1;for(i=0;i<this._mSubscriptions[t].length;i++)e&&this._mSubscriptions[t][i].fn!==e||n&&n!==this._mSubscriptions[t][i].ctx||(this._mSubscriptions[t].splice(i,1),o=!0);if(!1===o)throw new Error("Nothing to unbind for "+t)},this.off=this.unbind,this.trigger=this.emit},r.utils.EventEmitter.ALL_EVENT="__all",r.utils.DragListener=function(t,e){r.utils.EventEmitter.call(this),this._eElement=s(t),this._oDocument=s(document),this._eBody=s(document.body),this._nButtonCode=e||0,this._nDelay=200,this._nDistance=10,this._nX=0,this._nY=0,this._nOriginalX=0,this._nOriginalY=0,this._bDragging=!1,this._fMove=r.utils.fnBind(this.onMouseMove,this),this._fUp=r.utils.fnBind(this.onMouseUp,this),this._fDown=r.utils.fnBind(this.onMouseDown,this),this._eElement.on("mousedown touchstart",this._fDown)},r.utils.DragListener.timeout=null,r.utils.copy(r.utils.DragListener.prototype,{destroy:function(){this._eElement.unbind("mousedown touchstart",this._fDown),this._oDocument.unbind("mouseup touchend",this._fUp),this._eElement=null,this._oDocument=null,this._eBody=null},onMouseDown:function(t){if(t.preventDefault(),0==t.button||"touchstart"===t.type){var e=this._getCoordinates(t);this._nOriginalX=e.x,this._nOriginalY=e.y,this._oDocument.on("mousemove touchmove",this._fMove),this._oDocument.one("mouseup touchend",this._fUp),this._timeout=setTimeout(r.utils.fnBind(this._startDrag,this),this._nDelay)}},onMouseMove:function(t){if(null!=this._timeout){t.preventDefault();var 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)&&(clearTimeout(this._timeout),this._startDrag()),this._bDragging&&this.emit("drag",this._nX,this._nY,t)}},onMouseUp:function(t){null!=this._timeout&&(clearTimeout(this._timeout),this._eBody.removeClass("lm_dragging"),this._eElement.removeClass("lm_dragging"),this._oDocument.find("iframe").css("pointer-events",""),this._oDocument.unbind("mousemove touchmove",this._fMove),this._oDocument.unbind("mouseup touchend",this._fUp),!0===this._bDragging&&(this._bDragging=!1,this.emit("dragStop",t,this._nOriginalX+this._nX)))},_startDrag:function(){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}}}),r.LayoutManager=function(t,e){if(!s||"function"!=typeof s.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');r.utils.EventEmitter.call(this),this.isInitialised=!1,this._isFullPage=!1,this._resizeTimeoutId=null,this._components={"lm-react-component":r.utils.ReactComponentHandler},this._itemAreas=[],this._resizeFunction=r.utils.fnBind(this._onResize,this),this._unloadFunction=r.utils.fnBind(this._onUnload,this),this._maximisedItem=null,this._maximisePlaceholder=s('<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 r.utils.EventHub(this),this.config=this._createConfig(t),this.container=e,this.dropTargetIndicator=null,this.transitionIndicator=null,this.tabDropPlaceholder=s('<div class="lm_drop_tab_placeholder"></div>'),!0===this.isSubWindow&&s("body").css("visibility","hidden"),this._typeToItem={column:r.utils.fnBind(r.items.RowOrColumn,this,[!0]),row:r.utils.fnBind(r.items.RowOrColumn,this,[!1]),stack:r.items.Stack,component:r.items.Component}},r.LayoutManager.__lm=r,r.LayoutManager.minifyConfig=function(t){return(new r.utils.ConfigMinifier).minifyConfig(t)},r.LayoutManager.unminifyConfig=function(t){return(new r.utils.ConfigMinifier).unminifyConfig(t)},r.utils.copy(r.LayoutManager.prototype,{registerComponent:function(t,e){if("function"!=typeof e)throw new Error("Please register a constructor function");if(void 0!==this._components[t])throw new Error("Component "+t+" is already registered");this._components[t]=e},toConfig:function(t){var e,n,i;if(!1===this.isInitialised)throw new Error("Can't create config, layout not yet initialised");if(t&&!(t instanceof r.items.AbstractContentItem))throw new Error("Root must be a ContentItem");for((e={settings:r.utils.copy({},this.config.settings),dimensions:r.utils.copy({},this.config.dimensions),labels:r.utils.copy({},this.config.labels)}).content=[],(n=function(t,e){var i,o;for(i in e.config)"content"!==i&&(t[i]=e.config[i]);if(e.contentItems.length)for(t.content=[],o=0;o<e.contentItems.length;o++)t.content[o]={},n(t.content[o],e.contentItems[o])})(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){if(void 0===this._components[t])throw new r.errors.ConfigurationError('Unknown component "'+t+'"');return this._components[t]},init:function(){if(!1===this._subWindowsCreated&&(this._createSubWindows(),this._subWindowsCreated=!0),"loading"!==document.readyState&&null!==document.body){if(!0===this.isSubWindow&&!1===this._creationTimeoutPassed)return setTimeout(r.utils.fnBind(this.init,this),7),void(this._creationTimeoutPassed=!0);!0===this.isSubWindow&&this._adjustToWindowMode(),this._setContainer(),this.dropTargetIndicator=new r.controls.DropTargetIndicator(this.container),this.transitionIndicator=new r.controls.TransitionIndicator,this.updateSize(),this._create(this.config),this._bindEvents(),this.isInitialised=!0,this._adjustColumnsResponsive(),this.emit("initialised")}else s(document).ready(r.utils.fnBind(this.init,this))},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(),s(window).off("resize",this._resizeFunction),s(window).off("unload beforeunload",this._unloadFunction),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){var n;if("string"!=typeof t.type)throw new r.errors.ConfigurationError("Missing parameter 'type'",t);if("react-component"===t.type&&(t.type="component",t.componentName="lm-react-component"),!this._typeToItem[t.type])throw n="Unknown type '"+t.type+"'. Valid types are "+r.utils.objectKeys(this._typeToItem).join(","),new r.errors.ConfigurationError(n);return"component"!==t.type||e instanceof r.items.Stack||!e||!0===this.isSubWindow&&e instanceof r.items.Root||(t={type:"stack",width:t.width,height:t.height,content:[t]}),new this._typeToItem[t.type](this,t,e)},createPopout:function(t,e,n,i){var o,s,a,l,c,h,u=t,d=t instanceof r.items.AbstractContentItem,f=this;if(n=n||null,d){for(u=this.toConfig(t).content,n=r.utils.getUniqueId(),l=t.parent,c=t;1===l.contentItems.length&&!l.isRoot;)l=l.parent,c=c.parent;l.addId(n),isNaN(i)&&(i=r.utils.indexOf(c,l.contentItems))}else u instanceof Array||(u=[u]);return!e&&d&&(o=window.screenX||window.screenLeft,s=window.screenY||window.screenTop,e={left:o+(a=t.element.offset()).left,top:s+a.top,width:t.element.width(),height:t.element.height()}),e||d||(e={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),d&&t.remove(),(h=new r.controls.BrowserPopout(u,e,n,i,this)).on("initialised",(function(){f.emit("windowOpened",h)})),h.on("closed",(function(){f._$reconcilePopoutWindows()})),this.openPopouts.push(h),h},createDragSource:function(t,e){this.config.settings.constrainDragToContainer=!1;var n=new r.controls.DragSource(s(t),e,this);return this._dragSources.push(n),n},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){var n,i,o=1/0,s=null;for(n=0;n<this._itemAreas.length;n++)t>(i=this._itemAreas[n]).x1&&t<i.x2&&e>i.y1&&e<i.y2&&o>i.surface&&(o=i.surface,s=i);return s},_$createRootItemAreas:function(){var t={y2:0,x2:0,y1:"y2",x1:"x2"};for(var e in t){var n=this.root._$getArea();n.side=e,n[e]=t[e]?n[t[e]]-50:50,n.surface=(n.x2-n.x1)*(n.y2-n.y1),this._itemAreas.push(n)}},_$calculateItemAreas:function(){var t,e,n=this._getAllContentItems();if(this._itemAreas=[],1!==n.length){for(this._$createRootItemAreas(),t=0;t<n.length;t++)if(n[t].isStack&&null!==(e=n[t]._$getArea()))if(e instanceof Array)this._itemAreas=this._itemAreas.concat(e);else{this._itemAreas.push(e);var i={};r.utils.copy(i,e),r.utils.copy(i,e.contentItem._contentAreaDimensions.header.highlightArea),i.surface=(i.x2-i.x1)*(i.y2-i.y1),this._itemAreas.push(i)}}else this._itemAreas.push(this.root._$getArea())},_$normalizeContentItem:function(t,e){if(!t)throw new Error("No content item defined");if(r.utils.isFunction(t)&&(t=t()),t instanceof r.items.AbstractContentItem)return t;if(s.isPlainObject(t)&&t.type){var n=this.createContentItem(t,e);return n.callDownwards("_$init"),n}throw new Error("Invalid contentItem")},_$reconcilePopoutWindows:function(){var t,e=[];for(t=0;t<this.openPopouts.length;t++)!1===this.openPopouts[t].getWindow().closed?e.push(this.openPopouts[t]):this.emit("windowClosed",this.openPopouts[t]);this.openPopouts.length!==e.length&&(this.emit("stateChanged"),this.openPopouts=e)},_getAllContentItems:function(){var t=[],e=function(n){if(t.push(n),n.contentItems instanceof Array)for(var i=0;i<n.contentItems.length;i++)e(n.contentItems[i])};return e(this.root),t},_bindEvents:function(){this._isFullPage&&s(window).resize(this._resizeFunction),s(window).on("unload beforeunload",this._unloadFunction)},_onResize:function(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=setTimeout(r.utils.fnBind(this.updateSize,this),100)},_createConfig:function(t){var e=r.utils.getQueryStringParam("gl-window");e&&(this.isSubWindow=!0,t=localStorage.getItem(e),t=JSON.parse(t),t=(new r.utils.ConfigMinifier).unminifyConfig(t),localStorage.removeItem(e)),t=s.extend(!0,{},r.config.defaultConfig,t);var n=function(t){for(var e in t)"props"!==e&&"object"==typeof t[e]?n(t[e]):"type"===e&&"react-component"===t[e]&&(t.type="component",t.componentName="lm-react-component")};return n(t),!1===t.settings.hasHeaders&&(t.dimensions.headerHeight=0),t},_adjustToWindowMode:function(){var t=s('<div class="lm_popin" title="'+this.config.labels.popin+'"><div class="lm_icon"></div><div class="lm_bg"></div></div>');t.click(r.utils.fnBind((function(){this.emit("popIn")}),this)),document.title=r.utils.stripTags(this.config.content[0].title),s("head").append(s("body link, body style, template, .gl_keep")),this.container=s("body").html("").css("visibility","visible").append(t),document.body.offsetHeight,window.__glInstance=this},_createSubWindows:function(){var t,e;for(t=0;t<this.config.openPopouts.length;t++)e=this.config.openPopouts[t],this.createPopout(e.content,e.dimensions,e.parentId,e.indexInParent)},_setContainer:function(){var t=s(this.container||"body");if(0===t.length)throw new Error("GoldenLayout container not found");if(t.length>1)throw new Error("GoldenLayout more than one container element specified");t[0]===document.body&&(this._isFullPage=!0,s("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 r.errors.ConfigurationError(e,t);if(t.content.length>1)throw e="Top level content can't contain more then one element.",new r.errors.ConfigurationError(e,t);this.root=new r.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;if(!(t*e<=this.width)){this._updatingColumnsResponsive=!0;for(var n=t-Math.max(Math.floor(this.width/e),1),i=this.root.contentItems[0],o=this._findAllStackContainers()[0],s=0;s<n;s++){var r=i.contentItems[i.contentItems.length-1];this._addChildContentItemsToContainer(o,r)}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(t,e){"stack"===e.type?e.contentItems.forEach((function(n){t.addChild(n),e.removeChild(n,!0)})):e.contentItems.forEach(r.utils.fnBind((function(e){this._addChildContentItemsToContainer(t,e)}),this))},_findAllStackContainers:function(){var t=[];return this._findAllStackContainersRecursive(t,this.root),t},_findAllStackContainersRecursive:function(t,e){e.contentItems.forEach(r.utils.fnBind((function(e){"stack"==e.type?t.push(e):e.isComponent||this._findAllStackContainersRecursive(t,e)}),this))}}),i=[n(165)],void 0===(o=function(t){return s=t,r.LayoutManager}.apply(e,i))||(t.exports=o),r.config.itemDefaultConfig={isClosable:!0,reorderEnabled:!0,title:""},r.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,reorderOnTabMenuClick:!0,tabControlOffset:10},dimensions:{borderWidth:5,borderGrabWidth:15,minItemHeight:10,minItemWidth:10,headerHeight:20,dragProxyWidth:300,dragProxyHeight:200},labels:{close:"close",maximise:"maximise",minimise:"minimise",popout:"open in new window",popin:"pop in",tabDropdown:"additional tabs"}},r.container.ItemContainer=function(t,e,n){r.utils.EventEmitter.call(this),this.width=null,this.height=null,this.title=t.componentName,this.parent=e,this.layoutManager=n,this.isHidden=!1,this._config=t,this._element=s(['<div class="lm_item_container">','<div class="lm_content"></div>',"</div>"].join("")),this._contentElement=this._element.find(".lm_content")},r.utils.copy(r.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 n,i,o,s,r=this.parent,a=this;!r.isColumn&&!r.isRow;)if(a=r,(r=r.parent).isRoot)return!1;for(n=("height"==(i=r.isColumn?"height":"width")?e:t)/(this[i]*(1/(a.config[i]/100)))*100,o=(a.config[i]-n)/(r.contentItems.length-1),s=0;s<r.contentItems.length;s++)r.contentItems[s]===a?r.contentItems[s].config[i]=n:r.contentItems[s].config[i]+=o;return r.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(s.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){if(t!==this.width||e!==this.height){this.width=t,this.height=e;var n=this._contentElement[0],i=n.offsetWidth-n.clientWidth,o=n.offsetHeight-n.clientHeight;this._contentElement.width(this.width-i).height(this.height-o),this.emit("resize")}}}),r.controls.BrowserPopout=function(t,e,n,i,o){r.utils.EventEmitter.call(this),this.isInitialised=!1,this._config=t,this._dimensions=e,this._parentId=n,this._indexInParent=i,this._layoutManager=o,this._popoutWindow=null,this._id=null,this._createWindow()},r.utils.copy(r.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=s.extend(!0,{},this.getGlInstance().toConfig()).content[0],(e=this._layoutManager.root.getItemsById(this._parentId)[0])||(e=this._layoutManager.root.contentItems.length>0?this._layoutManager.root.contentItems[0]:this._layoutManager.root)),e.addChild(t,this._indexInParent),this.close()},_createWindow:function(){var t,e=this._createUrl(),n=Math.floor(1e6*Math.random()).toString(36),i=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,n,i),this._popoutWindow)s(this._popoutWindow).on("load",r.utils.fnBind(this._positionWindow,this)).on("unload beforeunload",r.utils.fnBind(this._onClose,this)),t=setInterval(r.utils.fnBind((function(){this._popoutWindow.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),clearInterval(t))}),this),10);else if(!0===this._layoutManager.config.settings.blockedPopoutsThrowError){var o=new Error("Popout blocked");throw o.type="popoutBlocked",o}},_serializeWindowOptions:function(t){var e,n=[];for(e in t)n.push(e+"="+t[e]);return n.join(",")},_createUrl:function(){var t,e={content:this._config},n="gl-window-config-"+r.utils.getUniqueId();e=(new r.utils.ConfigMinifier).minifyConfig(e);try{localStorage.setItem(n,JSON.stringify(e))}catch(t){throw new Error("Error while writing to localStorage "+t.toString())}return 1===(t=document.location.href.split("?")).length?t[0]+"?gl-window="+n:document.location.href+"&gl-window="+n},_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(r.utils.fnBind(this.emit,this,["closed"]),50)}}),r.controls.DragProxy=function(t,e,n,i,o,a){r.utils.EventEmitter.call(this),this._dragListener=n,this._layoutManager=i,this._contentItem=o,this._originalParent=a,this._area=null,this._lastValidArea=null,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this.element=s(r.controls.DragProxy._template),a&&a._side&&(this._sided=a._sided,this.element.addClass("lm_"+a._side),["right","bottom"].indexOf(a._side)>=0&&this.element.find(".lm_content").after(this.element.find(".lm_header"))),this.element.css({left:t,top:e}),this.element.find(".lm_tab").attr("title",r.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(),s(document.body).append(this.element);var l=this._layoutManager.container.offset();this._minX=l.left,this._minY=l.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)},r.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>',r.utils.copy(r.controls.DragProxy.prototype,{_onDrag:function(t,e,n){var i=(n=n.originalEvent&&n.originalEvent.touches?n.originalEvent.touches[0]:n).pageX,o=n.pageY;(i>this._minX&&i<this._maxX&&o>this._minY&&o<this._maxY||!0!==this._layoutManager.config.settings.constrainDragToContainer)&&this._setDropPosition(i,o)},_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.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,n=t.dragProxyHeight;this.element.width(e),this.element.height(n),e-=this._sided?t.headerHeight:0,n-=this._sided?0:t.headerHeight,this.childElementContainer.width(e),this.childElementContainer.height(n),this._contentItem.element.width(e),this._contentItem.element.height(n),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}),r.controls.DragSource=function(t,e,n){this._element=t,this._itemConfig=e,this._layoutManager=n,this._dragListener=null,this._createDragListener()},r.utils.copy(r.controls.DragSource.prototype,{_createDragListener:function(){null!==this._dragListener&&this._dragListener.destroy(),this._dragListener=new r.utils.DragListener(this._element),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this)},_onDragStart:function(t,e){var n=this._itemConfig;r.utils.isFunction(n)&&(n=n());var i=this._layoutManager._$normalizeContentItem(s.extend(!0,{},n)),o=new r.controls.DragProxy(t,e,this._dragListener,this._layoutManager,i,null);this._layoutManager.transitionIndicator.transitionElements(this._element,o.element)}}),r.controls.DropTargetIndicator=function(){this.element=s(r.controls.DropTargetIndicator._template),s(document.body).append(this.element)},r.controls.DropTargetIndicator._template='<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>',r.utils.copy(r.controls.DropTargetIndicator.prototype,{destroy:function(){this.element.remove()},highlight:function(t,e,n,i){this.highlightArea({x1:t,y1:e,x2:n,y2:i})},highlightArea:function(t){this.element.css({left:t.x1,top:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}).show()},hide:function(){this.element.hide()}}),r.controls.Header=function(t,e){r.utils.EventEmitter.call(this),this.layoutManager=t,this.element=s(r.controls.Header._template),!0===this.layoutManager.config.settings.selectionEnabled&&(this.element.addClass("lm_selectable"),this.element.on("click touchstart",r.utils.fnBind(this._onHeaderClick,this))),this.tabsContainer=this.element.find(".lm_tabs"),this.tabDropdownContainer=this.element.find(".lm_tabdropdown_list"),this.tabDropdownContainer.hide(),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.hideAdditionalTabsDropdown=r.utils.fnBind(this._hideAdditionalTabsDropdown,this),s(document).mouseup(this.hideAdditionalTabsDropdown),this._lastVisibleTabIndex=-1,this._tabControlOffset=this.layoutManager.config.settings.tabControlOffset,this._createControls()},r.controls.Header._template=['<div class="lm_header">','<ul class="lm_tabs"></ul>','<ul class="lm_controls"></ul>','<ul class="lm_tabdropdown_list"></ul>',"</div>"].join(""),r.utils.copy(r.controls.Header.prototype,{createTab:function(t,e){var n,i;for(i=0;i<this.tabs.length;i++)if(this.tabs[i].contentItem===t)return;if(n=new r.controls.Tab(this,t),0===this.tabs.length)return this.tabs.push(n),void this.tabsContainer.append(n.element);void 0===e&&(e=this.tabs.length),e>0?this.tabs[e-1].element.after(n.element):this.tabs[0].element.before(n.element),this.tabs.splice(e,0,n),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){var e,n,i,o;for(e=0;e<this.tabs.length;e++)i=this.tabs[e].contentItem===t,this.tabs[e].setActive(i),!0===i&&(this.activeContentItem=t,this.parent.config.activeItemIndex=e);if(this.layoutManager.config.settings.reorderOnTabMenuClick&&-1!==this._lastVisibleTabIndex&&this.parent.config.activeItemIndex>this._lastVisibleTabIndex){for(o=this.tabs[this.parent.config.activeItemIndex],n=this.parent.config.activeItemIndex;n>0;n--)this.tabs[n]=this.tabs[n-1];this.tabs[0]=o,this.parent.config.activeItemIndex=0}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},_$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();s(document).off("mouseup",this.hideAdditionalTabsDropdown),this.element.remove()},_getHeaderSetting:function(t){if(t in this.parent._header)return this.parent._header[t]},_createControls:function(){var t,e,n,i,o,s,a,l,c;c=r.utils.fnBind(this._showAdditionalTabsDropdown,this),l=this.layoutManager.config.labels.tabDropdown,this.tabDropdownButton=new r.controls.HeaderButton(this,l,"lm_tabdropdown",c),this.tabDropdownButton.element.hide(),this._getHeaderSetting("popout")&&(e=r.utils.fnBind(this._onPopoutClick,this),n=this._getHeaderSetting("popout"),new r.controls.HeaderButton(this,n,"lm_popout",e)),this._getHeaderSetting("maximise")&&(s=r.utils.fnBind(this.parent.toggleMaximise,this.parent),i=this._getHeaderSetting("maximise"),o=this._getHeaderSetting("minimise"),a=new r.controls.HeaderButton(this,i,"lm_maximise",s),this.parent.on("maximised",(function(){a.element.attr("title",o)})),this.parent.on("minimised",(function(){a.element.attr("title",i)}))),this._isClosable()&&(t=r.utils.fnBind(this.parent.remove,this.parent),n=this._getHeaderSetting("close"),this.closeButton=new r.controls.HeaderButton(this,n,"lm_close",t))},_showAdditionalTabsDropdown:function(){this.tabDropdownContainer.show()},_hideAdditionalTabsDropdown:function(t){this.tabDropdownContainer.hide()},_isClosable:function(){return this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon},_onPopoutClick:function(){!0===this.layoutManager.config.settings.popoutWholeStack?this.parent.popout():this.activeContentItem.popout()},_onHeaderClick:function(t){t.target===this.element[0]&&this.parent.select()},_updateTabSizes:function(t){if(0!==this.tabs.length){this.tabDropdownButton.element.toggle(!0===t);var e=function(t){return t?"width":"height"};this.element.css(e(!this.parent._sided),""),this.element[e(this.parent._sided)](this.layoutManager.config.dimensions.headerHeight);var n,i,o,s,r=this.element.outerWidth()-this.controlsContainer.outerWidth()-this._tabControlOffset,a=0,l=0,c=0,h=this.layoutManager.config.settings.tabOverlapAllowance,u=!1,d=this.activeContentItem?this.tabs.indexOf(this.activeContentItem.tab):0,f=this.tabs[d];for(this.parent._sided&&(r=this.element.outerHeight()-this.controlsContainer.outerHeight()-this._tabControlOffset),this._lastVisibleTabIndex=-1,i=0;i<this.tabs.length;i++)if(n=this.tabs[i].element,this.tabsContainer.append(n),a+=n.outerWidth()+parseInt(n.css("margin-right"),10),(l=d<=i?a:a+f.element.outerWidth()+parseInt(f.element.css("margin-right"),10))>r){if(u)i===d&&(n.css({"z-index":"auto","margin-left":""}),this.tabsContainer.append(n));else if((c=d>0&&d<=i?(l-r)/(i-1):(l-r)/i)<h){for(o=0;o<=i;o++)s=o!==d&&0!==o?"-"+c+"px":"",this.tabs[o].element.css({"z-index":i-o,"margin-left":s});this._lastVisibleTabIndex=i,this.tabsContainer.append(n)}else u=!0;if(u&&i!==d){if(!t)return void this._updateTabSizes(!0);n.css({"z-index":"auto","margin-left":""}),this.tabDropdownContainer.append(n)}}else this._lastVisibleTabIndex=i,n.css({"z-index":"auto","margin-left":""}),this.tabsContainer.append(n)}}}),r.controls.HeaderButton=function(t,e,n,i){this._header=t,this.element=s('<li class="'+n+'" title="'+e+'"></li>'),this._header.on("destroy",this._$destroy,this),this._action=i,this.element.on("click touchstart",this._action),this._header.controlsContainer.append(this.element)},r.utils.copy(r.controls.HeaderButton.prototype,{_$destroy:function(){this.element.off(),this.element.remove()}}),r.controls.Splitter=function(t,e,n){this._isVertical=t,this._size=e,this._grabSize=n<e?e:n,this.element=this._createElement(),this._dragListener=new r.utils.DragListener(this.element)},r.utils.copy(r.controls.Splitter.prototype,{on:function(t,e,n){this._dragListener.on(t,e,n)},_$destroy:function(){this.element.remove()},_createElement:function(){var t=s('<div class="lm_drag_handle"></div>'),e=s('<div class="lm_splitter"></div>');e.append(t);var n=this._grabSize-this._size,i=n/2;return this._isVertical?(t.css("top",-i),t.css("height",this._size+n),e.addClass("lm_vertical"),e.height(this._size)):(t.css("left",-i),t.css("width",this._size+n),e.addClass("lm_horizontal"),e.width(this._size)),e}}),r.controls.Tab=function(t,e){this.header=t,this.contentItem=e,this.element=s(r.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 r.utils.DragListener(this.element),this._dragListener.on("dragStart",this._onDragStart,this),this.contentItem.on("destroy",this._dragListener.destroy,this._dragListener)),this._onTabClickFn=r.utils.fnBind(this._onTabClick,this),this._onCloseClickFn=r.utils.fnBind(this._onCloseClick,this),this.element.on("mousedown touchstart",this._onTabClickFn),this.contentItem.config.isClosable?(this.closeElement.on("click touchstart",this._onCloseClickFn),this.closeElement.on("mousedown",this._onCloseMousedown)):this.closeElement.remove(),this.contentItem.tab=this,this.contentItem.emit("tab",this),this.contentItem.layoutManager.emit("tabCreated",this),this.contentItem.isComponent&&(this.contentItem.container.tab=this,this.contentItem.container.emit("tab",this))},r.controls.Tab._template='<li class="lm_tab"><i class="lm_left"></i><span class="lm_title"></span><div class="lm_close_tab"></div><i class="lm_right"></i></li>',r.utils.copy(r.controls.Tab.prototype,{setTitle:function(t){this.element.attr("title",r.utils.stripTags(t)),this.titleElement.html(t)},setActive:function(t){t!==this.isActive&&(this.isActive=t,t?this.element.addClass("lm_active"):this.element.removeClass("lm_active"))},_$destroy:function(){this.element.off("mousedown touchstart",this._onTabClickFn),this.closeElement.off("click touchstart",this._onCloseClickFn),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 r.controls.DragProxy(t,e,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)},_onTabClick:function(t){if(0===t.button||"touchstart"===t.type){var e=this.header.parent.getActiveContentItem();this.contentItem!==e&&this.header.parent.setActiveContentItem(this.contentItem)}else 1===t.button&&this.contentItem.config.isClosable&&this._onCloseClick(t)},_onCloseClick:function(t){t.stopPropagation(),this.header.parent.removeChild(this.contentItem)},_onCloseMousedown:function(t){t.stopPropagation()}}),r.controls.TransitionIndicator=function(){this._element=s('<div class="lm_transition_indicator"></div>'),s(document.body).append(this._element),this._toElement=null,this._fromDimensions=null,this._totalAnimationDuration=200,this._animationStartTime=null},r.utils.copy(r.controls.TransitionIndicator.prototype,{destroy:function(){this._element.remove()},transitionElements:function(t,e){},_nextAnimationFrame:function(){var t,e=this._measure(this._toElement),n=(r.utils.now()-this._animationStartTime)/this._totalAnimationDuration,i={};if(n>=1)this._element.hide();else{for(t in e.opacity=0,this._fromDimensions)i[t]=this._fromDimensions[t]+(e[t]-this._fromDimensions[t])*n;this._element.css(i),r.utils.animFrame(r.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()}}}),r.errors.ConfigurationError=function(t,e){Error.call(this),this.name="Configuration Error",this.message=t,this.node=e},r.errors.ConfigurationError.prototype=new Error,r.items.AbstractContentItem=function(t,e,n){r.utils.EventEmitter.call(this),this.config=this._extendItemNode(e),this.type=e.type,this.contentItems=[],this.parent=n,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(r.utils.EventEmitter.ALL_EVENT,this._propagateEvent,this),e.content&&this._createContentItems(e)},r.utils.copy(r.items.AbstractContentItem.prototype,{setSize:function(){throw new Error("Abstract Method")},callDownwards:function(t,e,n,i){var o;for(!0!==n&&!0!==i&&this[t].apply(this,e||[]),o=0;o<this.contentItems.length;o++)this.contentItems[o].callDownwards(t,e,n);!0===n&&!0!==i&&this[t].apply(this,e||[])},removeChild:function(t,e){var n=r.utils.indexOf(t,this.contentItems);if(-1===n)throw new Error("Can't remove child item. Unknown content item");!0!==e&&this.contentItems[n]._$destroy(),this.contentItems.splice(n,1),this.config.content.splice(n,1),this.contentItems.length>0?this.callDownwards("setSize"):this instanceof r.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,n){e=this.layoutManager._$normalizeContentItem(e);var i=r.utils.indexOf(t,this.contentItems),o=t.element[0].parentNode;if(-1===i)throw new Error("Can't replace child. oldChild is not child of this");o.replaceChild(e.element[0],t.element[0]),!0===n&&(t.parent=null,t._$destroy()),this.contentItems[i]=e,e.parent=this,this.isStack&&(this.header.tabs[i].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.emit("stateChanged")},hasId:function(t){return!!this.config.id&&("string"==typeof this.config.id?this.config.id===t:this.config.id instanceof Array?-1!==r.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");if("string"==typeof this.config.id)delete this.config.id;else if(this.config.id instanceof Array){var e=r.utils.indexOf(t,this.config.id);this.config.id.splice(e,1)}},getItemsByFilter:function(t){var e=[],n=function(i){for(var o=0;o<i.contentItems.length;o++)!0===t(i.contentItems[o])&&e.push(i.contentItems[o]),n(i.contentItems[o])};return n(this),e},getItemsById:function(t){return this.getItemsByFilter((function(e){return e.config.id instanceof Array?-1!==r.utils.indexOf(t,e.config.id):e.config.id===t}))},getItemsByType:function(t){return this._$getItemsByProperty("type",t)},getComponentsByName:function(t){var e,n=this._$getItemsByProperty("componentName",t),i=[];for(e=0;e<n.length;e++)i.push(n[e].instance);return i},_$getItemsByProperty:function(t,e){return this.getItemsByFilter((function(n){return n[t]===e}))},_$setParent:function(t){this.parent=t},_$highlightDropZone:function(t,e,n){this.layoutManager.dropTargetIndicator.highlightArea(n)},_$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){var e,n,i=this.getItemsByType("stack");for(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(),n=t.width(),i=t.height();return{x1:e.left,y1:e.top,x2:e.left+n,y2:e.top+i,surface:n*i,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 r.utils.BubblingEvent(t,this);this.emit(t,e)},_createContentItems:function(t){var e,n;if(!(t.content instanceof Array))throw new r.errors.ConfigurationError("content must be an Array",t);for(n=0;n<t.content.length;n++)e=this.layoutManager.createContentItem(t.content[n],this),this.contentItems.push(e)},_extendItemNode:function(t){for(var e in r.config.itemDefaultConfig)void 0===t[e]&&(t[e]=r.config.itemDefaultConfig[e]);return t},_propagateEvent:function(t,e){e instanceof r.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===r.utils.indexOf(t,this._throttledEvents)?this.layoutManager.emit(t,e.origin):!0!==this._pendingEventPropagations[t]&&(this._pendingEventPropagations[t]=!0,r.utils.animFrame(r.utils.fnBind(this._propagateEventToLayoutManager,this,[t,e])))},_propagateEventToLayoutManager:function(t,e){this._pendingEventPropagations[t]=!1,this.layoutManager.emit(t,e)}}),r.items.Component=function(t,e,n){r.items.AbstractContentItem.call(this,t,e,n);var i=t.getComponent(this.config.componentName),o=s.extend(!0,{},this.config.componentState||{});o.componentName=this.config.componentName,this.componentName=this.config.componentName,""===this.config.title&&(this.config.title=this.config.componentName),this.isComponent=!0,this.container=new r.container.ItemContainer(this.config,this,t),this.instance=new i(this.container,o),this.element=this.container._element},r.utils.extend(r.items.Component,r.items.AbstractContentItem),r.utils.copy(r.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(){r.items.AbstractContentItem.prototype._$init.call(this),this.container.emit("open")},_$hide:function(){this.container.hide(),r.items.AbstractContentItem.prototype._$hide.call(this)},_$show:function(){this.container.show(),r.items.AbstractContentItem.prototype._$show.call(this)},_$shown:function(){this.container.shown(),r.items.AbstractContentItem.prototype._$shown.call(this)},_$destroy:function(){this.container.emit("destroy",this),r.items.AbstractContentItem.prototype._$destroy.call(this)},_$getArea:function(){return null}}),r.items.Root=function(t,e,n){r.items.AbstractContentItem.call(this,t,e,null),this.isRoot=!0,this.type="root",this.element=s('<div class="lm_goldenlayout lm_item lm_root"></div>'),this.childElementContainer=this.element,this._containerElement=n,this._containerElement.append(this.element)},r.utils.extend(r.items.Root,r.items.AbstractContentItem),r.utils.copy(r.items.Root.prototype,{addChild:function(t){if(this.contentItems.length>0)throw new Error("Root node can only have a single child");t=this.layoutManager._$normalizeContentItem(t,this),this.childElementContainer.append(t.element),r.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,n){this.layoutManager.tabDropPlaceholder.remove(),r.items.AbstractContentItem.prototype._$highlightDropZone.apply(this,arguments)},_$onDrop:function(t,e){var n;if(t.isComponent&&((n=this.layoutManager.createContentItem({type:"stack",header:t.config.header||{}},this))._$init(),n.addChild(t),t=n),this.contentItems.length){var i="x"==e.side[0]?"row":"column",o="x"==e.side[0]?"width":"height",s="2"==e.side[1],a=this.contentItems[0];if(!a instanceof r.items.RowOrColumn||a.type!=i){var l=this.layoutManager.createContentItem({type:i},this);this.replaceChild(a,l),l.addChild(t,s?0:void 0,!0),l.addChild(a,s?void 0:0,!0),a.config[o]=50,t.config[o]=50,l.callDownwards("setSize")}else{var c=a.contentItems[s?0:a.contentItems.length-1];a.addChild(t,s?0:void 0,!0),c.config[o]*=.5,t.config[o]=c.config[o],a.callDownwards("setSize")}}else this.addChild(t)}}),r.items.RowOrColumn=function(t,e,n,i){r.items.AbstractContentItem.call(this,e,n,i),this.isRow=!t,this.isColumn=t,this.element=s('<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},r.utils.extend(r.items.RowOrColumn,r.items.AbstractContentItem),r.utils.copy(r.items.RowOrColumn.prototype,{addChild:function(t,e,n){var i,o,s,a;if(t=this.layoutManager._$normalizeContentItem(t,this),void 0===e&&(e=this.contentItems.length),this.contentItems.length>0?(a=this._createSplitter(Math.max(0,e-1)).element,e>0?(this.contentItems[e-1].element.after(a),a.after(t.element)):(this.contentItems[0].element.before(a),a.before(t.element))):this.childElementContainer.append(t.element),r.items.AbstractContentItem.prototype.addChild.call(this,t,e),i=1/this.contentItems.length*100,!0!==n){for(s=0;s<this.contentItems.length;s++)this.contentItems[s]===t?t.config[this._dimension]=i:(o=this.contentItems[s].config[this._dimension]*=(100-i)/100,this.contentItems[s].config[this._dimension]=o);this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}else this.emitBubblingEvent("stateChanged")},removeChild:function(t,e){var n,i,o=t.config[this._dimension],s=r.utils.indexOf(t,this.contentItems),a=Math.max(s-1,0);if(-1===s)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[a]&&(this._splitter[a]._$destroy(),this._splitter.splice(a,1)),n=0;n<this.contentItems.length;n++)this.contentItems[n]!==t&&(this.contentItems[n].config[this._dimension]+=o/(this.contentItems.length-1));r.items.AbstractContentItem.prototype.removeChild.call(this,t,e),1===this.contentItems.length&&!0===this.config.isClosable?(i=this.contentItems[0],this.contentItems=[],this.parent.replaceChild(this,i,!0)):(this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged"))},replaceChild:function(t,e){var n=t.config[this._dimension];r.items.AbstractContentItem.prototype.replaceChild.call(this,t,e),e.config[this._dimension]=n,this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")},setSize:function(){this.contentItems.length>0&&(this._calculateRelativeSizes(),this._setAbsoluteSizes()),this.emitBubblingEvent("stateChanged"),this.emit("resize")},_$init:function(){var t;if(!0!==this.isInitialised)for(r.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(){var t,e=this._calculateAbsoluteSizes();for(t=0;t<this.contentItems.length;t++)e.additionalPixel-t>0&&e.itemSizes[t]++,this._isColumn?(this.contentItems[t].element.width(e.totalWidth),this.contentItems[t].element.height(e.itemSizes[t])):(this.contentItems[t].element.width(e.itemSizes[t]),this.contentItems[t].element.height(e.totalHeight))},_calculateAbsoluteSizes:function(){var t,e,n=(this.contentItems.length-1)*this._splitterSize,i=this.element.width(),o=this.element.height(),s=0,r=[];for(this._isColumn?o-=n:i-=n,t=0;t<this.contentItems.length;t++)s+=e=this._isColumn?Math.floor(o*(this.contentItems[t].config.height/100)):Math.floor(i*(this.contentItems[t].config.width/100)),r.push(e);return{itemSizes:r,additionalPixel:Math.floor((this._isColumn?o:i)-s),totalWidth:i,totalHeight:o}},_calculateRelativeSizes:function(){var t,e=0,n=[],i=this._isColumn?"height":"width";for(t=0;t<this.contentItems.length;t++)void 0!==this.contentItems[t].config[i]?e+=this.contentItems[t].config[i]:n.push(this.contentItems[t]);if(100!==Math.round(e))if(Math.round(e)<100&&n.length>0){for(t=0;t<n.length;t++)n[t].config[i]=(100-e)/n.length;this._respectMinItemWidth()}else{if(Math.round(e)>100)for(t=0;t<n.length;t++)n[t].config[i]=50,e+=50;for(t=0;t<this.contentItems.length;t++)this.contentItems[t].config[i]=this.contentItems[t].config[i]/e*100;this._respectMinItemWidth()}else this._respectMinItemWidth()},_respectMinItemWidth:function(){var t,e,n,i,o=this.layoutManager.config.dimensions&&this.layoutManager.config.dimensions.minItemWidth||0,s=[],r=0,a=0,l=0,c=0,h=[];if(!(this._isColumn||!o||this.contentItems.length<=1)){t=this._calculateAbsoluteSizes();for(var u=0;u<this.contentItems.length;u++)this.contentItems[u],(c=t.itemSizes[u])<o?(a+=o-c,i={width:o}):(r+=c-o,i={width:c},s.push(i)),h.push(i);if(!(0===a||a>r)){for(e=a/r,l=a,u=0;u<s.length;u++)i=s[u],l-=n=Math.round((i.width-o)*e),i.width-=n;for(0!==l&&(h[h.length-1].width-=l),u=0;u<this.contentItems.length;u++)this.contentItems[u].config.width=h[u].width/t.totalWidth*100}}},_createSplitter:function(t){var e;return(e=new r.controls.Splitter(this._isColumn,this._splitterSize,this._splitterGrabSize)).on("drag",r.utils.fnBind(this._onSplitterDrag,this,[e]),this),e.on("dragStop",r.utils.fnBind(this._onSplitterDragStop,this,[e]),this),e.on("dragStart",r.utils.fnBind(this._onSplitterDragStart,this,[e]),this),this._splitter.splice(t,0,e),e},_getItemsForSplitter:function(t){var e=r.utils.indexOf(t,this._splitter);return{before:this.contentItems[e],after:this.contentItems[e+1]}},_getMinimumDimensions:function(t){for(var e=0,n=0,i=0;i<t.length;++i)e=Math.max(t[i].minWidth||0,e),n=Math.max(t[i].minHeight||0,n);return{horizontal:e,vertical:n}},_onSplitterDragStart:function(t){var e=this._getItemsForSplitter(t),n=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],i=this._getMinimumDimensions(e.before.config.content),o=this._isColumn?i.vertical:i.horizontal,s=this._getMinimumDimensions(e.after.config.content),r=this._isColumn?s.vertical:s.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(e.before.element[this._dimension]()-(o||n)),this._splitterMaxPosition=e.after.element[this._dimension]()-(r||n)},_onSplitterDrag:function(t,e,n){var i=this._isColumn?n: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),n=e.before.element[this._dimension](),i=e.after.element[this._dimension](),o=(this._splitterPosition+n)/(n+i),s=e.before.config[this._dimension]+e.after.config[this._dimension];e.before.config[this._dimension]=o*s,e.after.config[this._dimension]=(1-o)*s,t.element.css({top:0,left:0}),r.utils.animFrame(r.utils.fnBind(this.callDownwards,this,["setSize"]))}}),r.items.Stack=function(t,e,n){r.items.AbstractContentItem.call(this,t,e,n),this.element=s('<div class="lm_item lm_stack"></div>'),this._activeContentItem=null;var 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&&r.utils.copy(this._header,i.header),e.header&&r.utils.copy(this._header,e.header),e.content&&e.content[0]&&e.content[0].header&&r.utils.copy(this._header,e.content[0].header),this._dropZones={},this._dropSegment=null,this._contentAreaDimensions=null,this._dropIndex=null,this.isStack=!0,this.childElementContainer=s('<div class="lm_items"></div>'),this.header=new r.controls.Header(t,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()},r.utils.extend(r.items.Stack,r.items.AbstractContentItem),r.utils.copy(r.items.Stack.prototype,{setSize:function(){var t,e=this._header.show?this.layoutManager.config.dimensions.headerHeight:0,n=this.element.width()-(this._sided?e:0),i=this.element.height()-(this._sided?0:e);for(this.childElementContainer.width(n),this.childElementContainer.height(i),t=0;t<this.contentItems.length;t++)this.contentItems[t].element.width(n).height(i);this.emit("resize"),this.emitBubblingEvent("stateChanged")},_$init:function(){var t,e;if(!0!==this.isInitialised){for(r.items.AbstractContentItem.prototype._$init.call(this),t=0;t<this.contentItems.length;t++)this.header.createTab(this.contentItems[t]),this.contentItems[t]._$hide();if(this.contentItems.length>0){if(!(e=this.contentItems[this.config.activeItemIndex||0]))throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(e)}}},setActiveContentItem:function(t){if(-1===r.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),r.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 n=r.utils.indexOf(t,this.contentItems);r.items.AbstractContentItem.prototype.removeChild.call(this,t,e),this.header.removeTab(t),this.header.activeContentItem===t&&(this.contentItems.length>0?this.setActiveContentItem(this.contentItems[Math.max(n-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")},_$validateClosability:function(){var t,e,n;for(t=this.header._isClosable(),n=0,e=this.contentItems.length;n<e&&t;n++)t=this.contentItems[n].config.isClosable;this.header._$setClosable(t)},_$destroy:function(){r.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);if("body"!==this._dropSegment){var e,n,i,o="top"===this._dropSegment||"bottom"===this._dropSegment,s="left"===this._dropSegment||"right"===this._dropSegment,a="top"===this._dropSegment||"left"===this._dropSegment,l=o&&this.parent.isColumn||s&&this.parent.isRow,c=o?"column":"row",h=o?"height":"width";t.isComponent&&((n=this.layoutManager.createContentItem({type:"stack",header:t.config.header||{}},this))._$init(),n.addChild(t),t=n),l?(e=r.utils.indexOf(this,this.parent.contentItems),this.parent.addChild(t,a?e:e+1,!0),this.config[h]*=.5,t.config[h]=this.config[h],this.parent.callDownwards("setSize")):(c=o?"column":"row",i=this.layoutManager.createContentItem({type:c},this),this.parent.replaceChild(this,i),i.addChild(t,a?0:void 0,!0),i.addChild(this,a?void 0:0,!0),this.config[h]=50,t.config[h]=50,i.callDownwards("setSize"))}else this.addChild(t)},_$highlightDropZone:function(t,e){var n,i;for(n in this._contentAreaDimensions)if((i=this._contentAreaDimensions[n].hoverArea).x1<t&&i.x2>t&&i.y1<e&&i.y2>e)return void("header"===n?(this._dropSegment="header",this._highlightHeaderDropZone(this._sided?e:t)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(n)))},_$getArea:function(){if(!1===this.element.is(":visible"))return null;var t=r.items.AbstractContentItem.prototype._$getArea,e=t.call(this,this.header.element),n=t.call(this,this.childElementContainer),i=n.x2-n.x1,o=n.y2-n.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:n.x1,y1:n.y1,x2:n.x2,y2:n.y2},highlightArea:{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2}},t.call(this,this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:n.x1,y1:n.y1,x2:n.x1+.25*i,y2:n.y2},highlightArea:{x1:n.x1,y1:n.y1,x2:n.x1+.5*i,y2:n.y2}},this._contentAreaDimensions.top={hoverArea:{x1:n.x1+.25*i,y1:n.y1,x2:n.x1+.75*i,y2:n.y1+.5*o},highlightArea:{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y1+.5*o}},this._contentAreaDimensions.right={hoverArea:{x1:n.x1+.75*i,y1:n.y1,x2:n.x2,y2:n.y2},highlightArea:{x1:n.x1+.5*i,y1:n.y1,x2:n.x2,y2:n.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:n.x1+.25*i,y1:n.y1+.5*o,x2:n.x1+.75*i,y2:n.y2},highlightArea:{x1:n.x1,y1:n.y1+.5*o,x2:n.x2,y2:n.y2}},t.call(this,this.element))},_highlightHeaderDropZone:function(t){var e,n,i,o,s,r,a,l,c=this.header.tabs.length,h=!1;if(0===c)return a=this.header.element.offset(),void this.layoutManager.dropTargetIndicator.highlightArea({x1:a.left,x2:a.left+100,y1:a.top+this.header.element.height()-20,y2:a.top+this.header.element.height()});for(e=0;e<c;e++)if(s=(n=this.header.tabs[e].element).offset(),this._sided?(o=s.top,i=s.left,l=n.height()):(o=s.left,i=s.top,l=n.width()),t>o&&t<o+l){h=!0;break}if(!(!1===h&&t<o)){if(t<o+l/2?(this._dropIndex=e,n.before(this.layoutManager.tabDropPlaceholder)):(this._dropIndex=Math.min(e+1,c),n.after(this.layoutManager.tabDropPlaceholder)),this._sided)return placeHolderTop=this.layoutManager.tabDropPlaceholder.offset().top,void this.layoutManager.dropTargetIndicator.highlightArea({x1:i,x2:i+n.innerHeight(),y1:placeHolderTop,y2:placeHolderTop+this.layoutManager.tabDropPlaceholder.width()});r=this.layoutManager.tabDropPlaceholder.offset().left,this.layoutManager.dropTargetIndicator.highlightArea({x1:r,x2:r+this.layoutManager.tabDropPlaceholder.width(),y1:i,y2:i+n.innerHeight()})}},_resetHeaderDropZone:function(){this.layoutManager.tabDropPlaceholder.remove()},_setupHeaderPosition:function(){var t=["right","left","bottom"].indexOf(this._header.show)>=0&&this._header.show;if(this.header.element.toggle(!!this._header.show),this._side=t,this._sided=["right","left"].indexOf(this._side)>=0,this.element.removeClass("lm_left lm_right lm_bottom"),this._side&&this.element.addClass("lm_"+this._side),this.element.find(".lm_header").length&&this.childElementContainer){var e=["right","bottom"].indexOf(this._side)>=0?"before":"after";this.header.element[e](this.childElementContainer),this.callDownwards("setSize")}},_highlightBodyDropZone:function(t){var e=this._contentAreaDimensions[t].highlightArea;this.layoutManager.dropTargetIndicator.highlightArea(e),this._dropSegment=t}}),r.utils.BubblingEvent=function(t,e){this.name=t,this.origin=e,this.isPropagationStopped=!1},r.utils.BubblingEvent.prototype.stopPropagation=function(){this.isPropagationStopped=!0},r.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"],this._keys.length>36)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"]},r.utils.copy(r.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,n){var i,o;for(i in t)t instanceof Array&&(i=parseInt(i,10)),t.hasOwnProperty(i)&&(o=this[n](i,this._keys),"object"==typeof t[i]?(e[o]=t[i]instanceof Array?[]:{},this._nextLevel(t[i],e[o],n)):e[o]=this[n](t[i],this._values))},_min:function(t,e){if("string"==typeof t&&1===t.length)return"___"+t;var n=r.utils.indexOf(t,e);return-1===n?t:n.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}}),r.utils.EventHub=function(t){r.utils.EventEmitter.call(this),this._layoutManager=t,this._dontPropagateToParent=null,this._childEventSource=null,this.on(r.utils.EventEmitter.ALL_EVENT,r.utils.fnBind(this._onEventFromThis,this)),this._boundOnEventFromChild=r.utils.fnBind(this._onEventFromChild,this),s(window).on("gl_child_event",this._boundOnEventFromChild)},r.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},r.utils.EventHub.prototype._$onEventFromParent=function(t){this._dontPropagateToParent=t[0],this.emit.apply(this,t)},r.utils.EventHub.prototype._onEventFromChild=function(t){this._childEventSource=t.originalEvent.__gl,this.emit.apply(this,t.originalEvent.__glArgs)},r.utils.EventHub.prototype._propagateToParent=function(t){var e;document.createEvent?(e=window.opener.document.createEvent("HTMLEvents")).initEvent("gl_child_event",!0,!0):(e=window.opener.document.createEventObject()).eventType="gl_child_event",e.eventName="gl_child_event",e.__glArgs=t,e.__gl=this._layoutManager,document.createEvent?window.opener.dispatchEvent(e):window.opener.fireEvent("on"+e.eventType,e)},r.utils.EventHub.prototype._propagateToChildren=function(t){var e,n;for(n=0;n<this._layoutManager.openPopouts.length;n++)(e=this._layoutManager.openPopouts[n].getGlInstance())&&e!==this._childEventSource&&e.eventHub._$onEventFromParent(t)},r.utils.EventHub.prototype.destroy=function(){s(window).off("gl_child_event",this._boundOnEventFromChild)},r.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)},r.utils.copy(r.utils.ReactComponentHandler.prototype,{_render:function(){this._reactComponent=ReactDOM.render(this._getReactComponent(),this._container.getElement()[0]),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)))throw new Error('React component "'+e+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return t},_getReactComponent:function(){var t={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container},e=s.extend(t,this._container._config.props);return React.createElement(this._reactClass,e)}})},164:function(t,e,n){"use strict";n.r(e);var i=n(162),o=new(n.n(i).a)({settings:{showPopoutIcon:!1,showCloseIcon:!1},dimensions:{minItemHeight:40},content:[{type:"row",content:[{type:"column",width:40,content:[{type:"component",isClosable:!1,componentName:"template",title:"Game",componentState:{id:"client_wrapper"}}]},{type:"column",content:[{type:"row",height:65,content:[{type:"stack",content:[{type:"component",isClosable:!1,title:"Main",componentName:"template",componentState:{id:"mainmenu"}},{type:"component",isClosable:!1,title:"Log",componentName:"template",componentState:{id:"log"}}]},{type:"component",title:"Music",width:30,componentName:"template",componentState:{id:"music"}}]},{type:"row",content:[{type:"component",title:"Server chat",componentName:"template",componentState:{id:"ooc"}}]}]}]}]});o.registerComponent("template",(function(t,e){var n=document.querySelector("#".concat(e.id));t.getElement().html(n.content)})),o.init()},165:function(t,e,n){var i; /*! * jQuery JavaScript Library v3.5.1 * https://jquery.com/ |
