From 468cef15a3990f9bd0eaf7570f89990236bb31ba Mon Sep 17 00:00:00 2001 From: jkuehner Date: Wed, 6 Mar 2024 20:10:15 +0100 Subject: [PATCH] fix resize on macos touchpad --- lib/es5/dock-spawn-ts.js | 2 +- lib/js/SplitterBar.js | 4 ++-- lib/js/SplitterBar.js.map | 2 +- package.json | 2 +- src/SplitterBar.ts | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/es5/dock-spawn-ts.js b/lib/es5/dock-spawn-ts.js index 08bc01e..f8d4173 100644 --- a/lib/es5/dock-spawn-ts.js +++ b/lib/es5/dock-spawn-ts.js @@ -1 +1 @@ -"use strict";function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _get(){if(typeof Reflect!=="undefined"&&Reflect.get){_get=Reflect.get.bind()}else{_get=function _get(target,property,receiver){var base=_superPropBase(target,property);if(!base)return;var desc=Object.getOwnPropertyDescriptor(base,property);if(desc.get){return desc.get.call(arguments.length<3?target:receiver)}return desc.value}}return _get.apply(this,arguments)}function _superPropBase(object,property){while(!Object.prototype.hasOwnProperty.call(object,property)){object=_getPrototypeOf(object);if(object===null)break}return object}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e))}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined")}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t})()}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _regeneratorRuntime(){"use strict";_regeneratorRuntime=function _regeneratorRuntime(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function define(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{define({},"")}catch(t){define=function define(t,e,r){return t[e]=r}}function wrap(t,e,r,n){var i=e&&e.prototype instanceof Generator?e:Generator,a=Object.create(i.prototype),c=new Context(n||[]);return o(a,"_invoke",{value:makeInvokeMethod(t,r,c)}),a}function tryCatch(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=wrap;var h="suspendedStart",l="suspendedYield",f="executing",s="completed",y={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var p={};define(p,a,function(){return this});var d=Object.getPrototypeOf,v=d&&d(d(values([])));v&&v!==r&&n.call(v,a)&&(p=v);var g=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p);function defineIteratorMethods(t){["next","throw","return"].forEach(function(e){define(t,e,function(t){return this._invoke(e,t)})})}function AsyncIterator(t,e){function invoke(r,o,i,a){var c=tryCatch(t[r],t,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==_typeof(h)&&n.call(h,"__await")?e.resolve(h.__await).then(function(t){invoke("next",t,i,a)},function(t){invoke("throw",t,i,a)}):e.resolve(h).then(function(t){u.value=t,i(u)},function(t){return invoke("throw",t,i,a)})}a(c.arg)}var r;o(this,"_invoke",{value:function value(t,n){function callInvokeWithMethodAndArg(){return new e(function(e,r){invoke(t,n,e,r)})}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(e,r,n){var o=h;return function(i,a){if(o===f)throw new Error("Generator is already running");if(o===s){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=maybeInvokeDelegate(c,n);if(u){if(u===y)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=s,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=f;var p=tryCatch(e,r,n);if("normal"===p.type){if(o=n.done?s:l,p.arg===y)continue;return{value:p.arg,done:n.done}}"throw"===p.type&&(o=s,n.method="throw",n.arg=p.arg)}}}function maybeInvokeDelegate(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator["return"]&&(r.method="return",r.arg=t,maybeInvokeDelegate(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=tryCatch(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0)}function values(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function next(){for(;++o=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),y}},catch:function _catch(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(e,r,n){return this.delegate={iterator:values(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;var F=function F(){};return{s:F,n:function n(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]}},e:function e(_e39){throw _e39},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o)},n:function n(){var step=it.next();normalCompletion=step.done;return step},e:function e(_e40){didErr=true;err=_e40},f:function f(){try{if(!normalCompletion&&it["return"]!=null)it["return"]()}finally{if(didErr)throw err}}}}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i=i.left&&e<=i.left+i.width&&t>=i.top&&t<=i.top+i.height}},{key:"getNextId",value:function getNextId(e){return e+s._counter++}},{key:"removeNode",value:function removeNode(e){return null!==e.parentNode&&(e.parentNode.removeChild(e),!0)}},{key:"orderByIndexes",value:function orderByIndexes(e,t){var n=[];for(var _i=0;_i1)return;e=e.touches[0]}this.mouseUpHandler&&(this.mouseUpHandler.cancel(),delete this.mouseUpHandler),this.touchUpHandler&&(this.touchUpHandler.cancel(),delete this.touchUpHandler),this.mouseMoveHandler&&(this.mouseMoveHandler.cancel(),delete this.mouseMoveHandler),this.touchMoveHandler&&(this.touchMoveHandler.cancel(),delete this.touchMoveHandler),this.mouseUpHandler=new l(window,"mouseup",this.onMouseUp.bind(this)),this.touchUpHandler=new l(window,"touchend",this.onMouseUp.bind(this)),this.mouseMoveHandler=new l(window,"mousemove",this.onMouseMove.bind(this)),this.touchMoveHandler=new l(window,"touchmove",this.onMouseMove.bind(this)),this.dragStartPosition=new o(e.clientX,e.clientY)}}},{key:"onMouseUp",value:function onMouseUp(){this.mouseUpHandler&&(this.mouseUpHandler.cancel(),delete this.mouseUpHandler),this.touchUpHandler&&(this.touchUpHandler.cancel(),delete this.touchUpHandler),this.mouseMoveHandler&&(this.mouseMoveHandler.cancel(),delete this.mouseMoveHandler),this.touchMoveHandler&&(this.touchMoveHandler.cancel(),delete this.touchMoveHandler)}},{key:"onMouseMove",value:function onMouseMove(e){if(e.touches){if(e.touches.length>1)return;e=e.touches[0]}var t=new o(e.clientX,e.clientY).y-this.dragStartPosition.y;(t>this.thresholdPixels||t<-this.thresholdPixels)&&(this.enabled=!1,this._requestUndock(e))}},{key:"_requestUndock",value:function _requestUndock(e){var t=0,n=0,i=this.element;do{t+=i.offsetTop||0,n+=i.offsetLeft||0,i=i.offsetParent}while(i);var s=this.dragStartPosition.x-n,l=this.dragStartPosition.y-t,_a=new o(s,l);this._undockededCallback(e,_a)}}]);return a}();!function(e){e.document="document",e.panel="panel"}(t||(t={}));var h={CloseDialog:"Close dialog",CloseAll:"Close all documents",CloseAllButThis:"Close all documents but this",DefaultPanelName:"Panel",NewBrowserWindow:"Open in new window"};var r=function(){function r(){_classCallCheck(this,r)}_createClass(r,null,[{key:"configure",value:function configure(e){r._getTemplateString=e}},{key:"getString",value:function getString(e){var n,i;for(var _len=arguments.length,t=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){t[_key-1]=arguments[_key]}return function(e){for(var _len2=arguments.length,t=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){t[_key2-1]=arguments[_key2]}return e.replace(/{(\d+)}/g,function(e,n){var i=Number.parseInt(n);return t[i].toString()})}.apply(void 0,[null!==(i=null===(n=r._getTemplateString)||void 0===n?void 0:n.call(r,e))&&void 0!==i?i:h[e]].concat(t))}}]);return r}();var d=function(){function d(n,i,o,s,l){var _this=this;_classCallCheck(this,d);this.undockedToNewBrowserWindow=!1,o||(o=r.getString("DefaultPanelName")),s||(s=t.panel),this.panelType=s,n._dockSpawnPanelContainer=this,this.elementContent=n,n.style.position="absolute",n.style.width="100%",n.style.height="100%",n.style.top="0",n.style.bottom="0",this.elementContentContainer=document.createElement("div"),this.elementContentContainer.className="panel-element-content-container",this.elementContentContainer.style.position="absolute",this.elementContentContainer._panel=this,this.elementContentContainer.addEventListener("pointerdown",function(e){try{_this.isDialog?_this._floatingDialog.bringToFront():_this.tabPage&&_this.tabPage.setSelected(!0,!0),_this.dockManager.activePanel=_this}catch(e){}},{passive:!0}),this.elementContentContainer.appendChild(n),i.config.dialogRootElement.appendChild(this.elementContentContainer),this.dockManager=i,this.title=o,this.containerType=e.panel,this.icon=null,this.minimumAllowedChildNodes=0,this._floatingDialog=void 0,this.isDialog=!1,this._canUndock=i._undockEnabled,this.eventListeners=[],this._hideCloseButton=l,this._initialize()}_createClass(d,[{key:"canUndock",value:function canUndock(e){var _this2=this;this._canUndock=e,this.undockInitiator.enabled=e,this.eventListeners.forEach(function(t){t.onDockEnabled&&t.onDockEnabled({self:_this2,state:e})})}},{key:"addListener",value:function addListener(e){this.eventListeners.push(e)}},{key:"removeListener",value:function removeListener(e){this.eventListeners.splice(this.eventListeners.indexOf(e),1)}},{key:"floatingDialog",get:function get(){return this._floatingDialog},set:function set(e){this._floatingDialog=e;var t=void 0===this._floatingDialog;this.undockInitiator.enabled=t}},{key:"saveState",value:function saveState(e){e.element=this.elementContent.id,e.width=this.width,e.height=this.height,e.canUndock=this._canUndock,e.hideCloseButton=this._hideCloseButton,e.panelType=this.panelType}},{key:"loadState",value:function loadState(e){this.width=e.width,this.height=e.height,this.state={width:e.width,height:e.height},this.canUndock(e.canUndock),this.hideCloseButton(e.hideCloseButton),this.panelType=e.panelType}},{key:"setActiveChild",value:function setActiveChild(){}},{key:"containerElement",get:function get(){return this.elementPanel}},{key:"grayOut",value:function grayOut(e){var _this3=this;!e&&this._grayOut?(this.elementContentWrapper.removeChild(this._grayOut),this.elementButtonClose.style.display=this._hideCloseButton?"none":"block",this._grayOut=null,this._hideCloseButton||this.eventListeners.forEach(function(e){e.onHideCloseButton&&e.onHideCloseButton({self:_this3,state:_this3._hideCloseButton})})):e&&!this._grayOut&&(this._grayOut=document.createElement("div"),this._grayOut.className="panel-grayout",this.elementButtonClose.style.display="none",this.elementContentWrapper.appendChild(this._grayOut),this.eventListeners.forEach(function(e){e.onHideCloseButton&&e.onHideCloseButton({self:_this3,state:!0})}))}},{key:"_initialize",value:function _initialize(){var e;this.name=s.getNextId("panel_"),this.elementPanel=document.createElement("div"),this.elementPanel.tabIndex=0,this.elementTitle=document.createElement("div"),this.elementTitleText=document.createElement("div"),this.elementContentHost=document.createElement("div"),this.elementButtonClose=document.createElement("div"),this.elementPanel.appendChild(this.elementTitle),this.elementTitle.appendChild(this.elementTitleText),this.elementTitle.appendChild(this.elementButtonClose),this.elementButtonClose.classList.add("panel-titlebar-button-close"),this.elementButtonClose.style.display=this._hideCloseButton?"none":"block",this.elementPanel.appendChild(this.elementContentHost),this.elementPanel.classList.add("panel-base"),this.elementTitle.classList.add("panel-titlebar"),this.elementTitle.classList.add("disable-selection"),this.elementTitleText.classList.add("panel-titlebar-text"),this.elementContentHost.classList.add("panel-content");var t=this.elementContentContainer.clientWidth,n=this.elementContentContainer.clientHeight,i=this.elementTitle.clientHeight;this.elementContentWrapper=document.createElement("div"),this.elementContentWrapper.classList.add("panel-content-wrapper"),this._setPanelDimensions(t,n+i),this._hideCloseButton||(this.closeButtonClickedHandler=new l(this.elementButtonClose,"mousedown",this.onCloseButtonClicked.bind(this)),this.closeButtonTouchedHandler=new l(this.elementButtonClose,"touchstart",this.onCloseButtonClicked.bind(this))),s.removeNode(this.elementContentWrapper),this.elementContentHost.appendChild(this.elementContentWrapper);var o=this.elementContent.dataset.panelCaption,h=this.elementContent.dataset.panelIcon;o&&(this.title=o),h&&(this.icon=h),this._updateTitle(),this.undockInitiator=new a(this.elementTitle,this.performUndockToDialog.bind(this)),delete this.floatingDialog,this.mouseDownHandler=new l(this.elementPanel,"mousedown",this.onMouseDown.bind(this)),this.touchDownHandler=new l(this.elementPanel,"touchstart",this.onMouseDown.bind(this),{passive:!0}),this._resolvedElementContent=this.elementContent,this.elementContent instanceof HTMLSlotElement&&(this._resolvedElementContent=null===(e=this.elementContent.assignedElements())||void 0===e?void 0:e[0])}},{key:"onMouseDown",value:function onMouseDown(){this.dockManager.activePanel=this}},{key:"hideCloseButton",value:function hideCloseButton(e){var _this4=this;this._hideCloseButton=e,this.elementButtonClose.style.display=e?"none":"block",this.eventListeners.forEach(function(t){t.onHideCloseButton&&t.onHideCloseButton({self:_this4,state:e})})}},{key:"destroy",value:function destroy(){this.mouseDownHandler&&(this.mouseDownHandler.cancel(),delete this.mouseDownHandler),this.touchDownHandler&&(this.touchDownHandler.cancel(),delete this.touchDownHandler),s.removeNode(this.elementPanel),this.closeButtonClickedHandler&&(this.closeButtonClickedHandler.cancel(),delete this.closeButtonClickedHandler),this.closeButtonTouchedHandler&&(this.closeButtonTouchedHandler.cancel(),delete this.closeButtonTouchedHandler)}},{key:"performUndockToDialog",value:function performUndockToDialog(e,t){return this.isDialog=!0,this.undockInitiator.enabled=!1,this.elementContentWrapper.style.display="block",this.elementPanel.style.position="",this.dockManager.requestUndockToDialog(this,e,t)}},{key:"performClose",value:function performClose(){this.isDialog=!0,this.undockInitiator.enabled=!1,this.elementContentWrapper.style.display="block",this.elementContentContainer.style.display="none",this.elementPanel.style.position="",this.dockManager.requestClose(this)}},{key:"performUndock",value:function performUndock(){this.undockInitiator.enabled=!1,this.dockManager.requestUndock(this)}},{key:"prepareForDocking",value:function prepareForDocking(){this.isDialog=!1,this.undockInitiator.enabled=this._canUndock,this.elementContentContainer.parentElement!=this.dockManager.config.dialogRootElement&&this.dockManager.config.dialogRootElement.appendChild(this.elementContentContainer)}},{key:"width",get:function get(){return this._cachedWidth},set:function set(e){e!==this._cachedWidth&&(this._cachedWidth=e,this.elementPanel.style.width=e+"px")}},{key:"height",get:function get(){return this._cachedHeight},set:function set(e){e!==this._cachedHeight&&(this._cachedHeight=e,this.elementPanel.style.height=e+"px")}},{key:"resolvedElementContent",get:function get(){var e;return this._resolvedElementContent||(this._resolvedElementContent=this.elementContent,this.elementContent instanceof HTMLSlotElement&&(this._resolvedElementContent=null===(e=this.elementContent.assignedElements())||void 0===e?void 0:e[0])),this._resolvedElementContent}},{key:"panelDocked",value:function panelDocked(){this.elementContent.hidden&&(this.elementContent.hidden=!1),this.elementContentContainer.parentElement!==this.dockManager.config.dialogRootElement&&this.dockManager.config.dialogRootElement.appendChild(this.elementContentContainer)}},{key:"resize",value:function resize(e,t){this.panelDocked(),this.setVisible(!0),this._setPanelDimensions(e,t),this._cachedWidth=e,this._cachedHeight=t;try{null!=this.elementContent&&"function"==typeof this.elementContent.resizeHandler&&this.elementContent.resizeHandler(e,t-this.elementTitle.clientHeight)}catch(e){console.log("error calling resizeHandler:",e," elt:",this.elementContent)}}},{key:"_setPanelDimensions",value:function _setPanelDimensions(e,t){this.elementTitle.style.width=e+"px",this.elementContentHost.style.width=e+"px",this.elementContentContainer.style.width=e+"px",this.elementPanel.style.width=e+"px";var n=t-this.elementTitle.clientHeight;this.elementContentHost.style.height=n+"px",this.elementContentContainer.style.height=n+"px",this.elementPanel.style.height=t+"px";var i=this.elementContentWrapper.getBoundingClientRect(),o=this.dockManager.config.dialogRootElement.getBoundingClientRect();this.elementContentContainer.style.left=i.x-o.x+"px",this.elementContentContainer.style.top=i.y-o.y+"px",this.elementContentContainer.style.width=i.width+"px",this.elementContentContainer.style.height=i.height+"px"}},{key:"setDialogPosition",value:function setDialogPosition(e,t){this.elementContentContainer.style.left=e+"px",this.elementContentContainer.style.top=t+this.elementTitle.clientHeight+"px"}},{key:"setVisible",value:function setVisible(e){this.elementContentContainer.style.display=e?"block":"none"}},{key:"setTitle",value:function setTitle(e){this.title=e,this._updateTitle(),this.onTitleChanged&&this.onTitleChanged(this,e)}},{key:"setTitleIcon",value:function setTitleIcon(e){this.icon=e,this._updateTitle(),this.onTitleChanged&&this.onTitleChanged(this,this.title)}},{key:"setHasChanges",value:function setHasChanges(e){this.hasChanges=e,this._updateTitle(),e?this.elementTitleText.classList.add("panel-has-changes"):this.elementTitleText.classList.remove("panel-has-changes"),this.onTitleChanged&&this.onTitleChanged(this,this.title)}},{key:"setCloseIconTemplate",value:function setCloseIconTemplate(e){this.elementButtonClose.innerHTML=e}},{key:"_updateTitle",value:function _updateTitle(){null===this.icon?this.elementTitleText.innerHTML=this.title:this.elementTitleText.innerHTML=''+this.title+""}},{key:"getRawTitle",value:function getRawTitle(){return this.elementTitleText.innerHTML}},{key:"performLayout",value:function performLayout(e,t){}},{key:"onCloseButtonClicked",value:function onCloseButtonClicked(e){e.preventDefault(),e.stopPropagation(),this.close()}},{key:"undockToBrowserDialog",value:function undockToBrowserDialog(){var _this5=this;!function(e,t){var n=e.getBoundingClientRect(),i=n.x+24,o=n.y+60,s=n.width,l=n.height,a=window.open("about:blank",void 0,"popup=yes,left=".concat(i,",top=").concat(o,",width=").concat(s,",height=").concat(l));a.onfocus=function(e){return t.focused(e)},a.onblur=function(e){return t.blured(e)};var h=_toConsumableArray(document.head.querySelectorAll("link")).map(function(e){return e.cloneNode()});var _iterator=_createForOfIteratorHelper(h),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var _e=_step.value;a.document.head.appendChild(a.document.adoptNode(_e))}}catch(err){_iterator.e(err)}finally{_iterator.f()}var r=a.document.createElement("style");r.innerText="\n html {\n overflow: hidden;\n position: fixed;\n width: 100%;\n height: 100%;\n }\n body {\n height: 100%;\n width: 100%;\n margin: 0;\n }\n ",a.document.head.appendChild(r);var d=a.document.createElement("title");d.innerText=t.title,a.document.head.appendChild(d),a.onunload=function(){return t.newWindowClosedCallback()};var c=new Map,u=new Map;function m(e){if(e.shadowRoot){e.shadowRoot.adoptedStyleSheets.length>0&&u.set(e,_toConsumableArray(e.shadowRoot.adoptedStyleSheets.map(function(e){return function(e,t,n){var i=n.get(t);if(i)return i;var o="";var s=t.cssRules;for(var l=0;l3&&arguments[3]!==undefined?arguments[3]:!1;_classCallCheck(this,m);this.dialog=e,this.disableResize=i,this.delegate=t,this.containerElement=t.containerElement,this.dockManager=t.dockManager,this.topLevelElement=n,this.containerType=t.containerType,this.topLevelElement.style.left=this.topLevelElement.offsetLeft+"px",this.topLevelElement.style.top=this.topLevelElement.offsetTop+"px",this.minimumAllowedChildNodes=t.minimumAllowedChildNodes,this._buildResizeHandles(),this.readyToProcessNextResize=!0,this.dockSpawnResizedEvent=new CustomEvent("DockSpawnResizedEvent",{composed:!0,bubbles:!0}),this.iframeEventHandlers=[]}_createClass(m,[{key:"setActiveChild",value:function setActiveChild(){}},{key:"_buildResizeHandles",value:function _buildResizeHandles(){this.resizeHandles=[],this.disableResize||(this._buildResizeHandle(!1,!0,!0,!1),this._buildResizeHandle(!0,!1,!1,!0),this._buildResizeHandle(!1,!0,!1,!0),this._buildResizeHandle(!0,!1,!1,!1),this._buildResizeHandle(!1,!0,!1,!1),this._buildResizeHandle(!1,!1,!0,!1),this._buildResizeHandle(!1,!1,!1,!0))}},{key:"_buildResizeHandle",value:function _buildResizeHandle(e,t,n,i){var _this7=this;var o=new u;o.east=e,o.west=t,o.north=n,o.south=i,o.element=document.createElement("div"),this.topLevelElement.appendChild(o.element);var s="",a="";n&&(s="n"),i&&(s="s"),e&&(a="e"),t&&(a="w");var h="resize-handle-"+s+a;s.length>0&&a.length>0&&(o.corner=!0),o.element.classList.add(o.corner?"resize-handle-corner":"resize-handle"),o.element.classList.add(h),this.resizeHandles.push(o),o.mouseDownHandler=new l(o.element,"mousedown",function(e){_this7.onMouseDown(o,e)}),o.touchDownHandler=new l(o.element,"touchstart",function(e){_this7.onMouseDown(o,e)})}},{key:"saveState",value:function saveState(e){this.delegate.saveState(e)}},{key:"loadState",value:function loadState(e){this.delegate.loadState(e)}},{key:"width",get:function get(){return this.delegate.width}},{key:"height",get:function get(){return this.delegate.height}},{key:"name",get:function get(){return this.delegate.name},set:function set(e){e&&(this.delegate.name=e)}},{key:"resize",value:function resize(e,t){this.delegate.resize(e,t),this._adjustResizeHandles(e,t),document.dispatchEvent(this.dockSpawnResizedEvent)}},{key:"_adjustResizeHandles",value:function _adjustResizeHandles(e,t){this.resizeHandles.forEach(function(n){n.adjustSize(e,t)})}},{key:"performLayout",value:function performLayout(e){this.delegate.performLayout(e,!1)}},{key:"destroy",value:function destroy(){this.removeDecorator(),this.delegate.destroy()}},{key:"removeDecorator",value:function removeDecorator(){}},{key:"onMouseMovedIframe",value:function onMouseMovedIframe(e,t,n){var i=n.getBoundingClientRect();this.onMouseMoved(e,t,{x:i.x,y:i.y})}},{key:"onMouseMoved",value:function onMouseMoved(e,t,n){var i=null;if(t.changedTouches){if(t.changedTouches.length>1)return;i=t.changedTouches[0]}else i=t;if(!this.readyToProcessNextResize)return;this.readyToProcessNextResize=!1,this.dialog.panel&&this.dockManager.suspendLayout(this.dialog.panel);var s=new o(i.clientX,i.clientY);n&&(s=new o(i.clientX+n.x,i.clientY+n.y));var l=this.dockManager.checkXBounds(this.topLevelElement,s,this.previousMousePosition,e.west,e.east),a=this.dockManager.checkYBounds(this.topLevelElement,s,this.previousMousePosition,e.north,e.south);this._performDrag(e,l,a),this.previousMousePosition=s,this.readyToProcessNextResize=!0,this.dialog.panel&&this.dockManager.resumeLayout(this.dialog.panel),this.dockManager.notifyOnContainerResized(this)}},{key:"onMouseDown",value:function onMouseDown(e,t){var _this8=this;var n=null;if(t.touches){if(t.touches.length>1)return;n=t.touches[0]}else n=t;this.previousMousePosition=new o(n.clientX,n.clientY),e.mouseMoveHandler&&(e.mouseMoveHandler.cancel(),delete e.mouseMoveHandler),e.touchMoveHandler&&(e.touchMoveHandler.cancel(),delete e.touchMoveHandler),e.mouseUpHandler&&(e.mouseUpHandler.cancel(),delete e.mouseUpHandler),e.touchUpHandler&&(e.touchUpHandler.cancel(),delete e.touchUpHandler);var _iterator7=_createForOfIteratorHelper(this.iframeEventHandlers),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var _e4=_step7.value;_e4.cancel()}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}if(this.iframeEventHandlers=[],e.mouseMoveHandler=new l(window,"mousemove",function(t){_this8.onMouseMoved(e,t)}),e.touchMoveHandler=new l(window,"touchmove",function(t){_this8.onMouseMoved(e,t)}),e.mouseUpHandler=new l(window,"mouseup",function(t){_this8.onMouseUp(e)}),e.touchUpHandler=new l(window,"touchend",function(t){_this8.onMouseUp(e)}),this.dockManager.iframes){var _iterator8=_createForOfIteratorHelper(this.dockManager.iframes),_step8;try{var _loop2=function _loop2(){var t=_step8.value;var n=_this8.onMouseMovedIframe.bind(_this8);_this8.iframeEventHandlers.push(new l(t.contentWindow,"mousemove",function(i){return n(e,i,t)})),_this8.iframeEventHandlers.push(new l(t.contentWindow,"mouseup",function(t){return _this8.onMouseUp(e)})),_this8.iframeEventHandlers.push(new l(t.contentWindow,"touchmove",function(i){return n(e,i,t)})),_this8.iframeEventHandlers.push(new l(t.contentWindow,"touchend",function(t){return _this8.onMouseUp(e)}))};for(_iterator8.s();!(_step8=_iterator8.n()).done;){_loop2()}}catch(err){_iterator8.e(err)}finally{_iterator8.f()}}s.disableGlobalTextSelection(this.dockManager.config.dialogRootElement)}},{key:"onMouseUp",value:function onMouseUp(e){e.mouseMoveHandler.cancel(),e.touchMoveHandler.cancel(),e.mouseUpHandler.cancel(),e.touchUpHandler.cancel(),delete e.mouseMoveHandler,delete e.touchMoveHandler,delete e.mouseUpHandler,delete e.touchUpHandler;var _iterator9=_createForOfIteratorHelper(this.iframeEventHandlers),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var _e5=_step9.value;_e5.cancel()}}catch(err){_iterator9.e(err)}finally{_iterator9.f()}this.iframeEventHandlers=[],s.enableGlobalTextSelection(this.dockManager.config.dialogRootElement)}},{key:"_performDrag",value:function _performDrag(e,t,n){var i={};i.left=s.getPixels(this.topLevelElement.style.left),i.top=s.getPixels(this.topLevelElement.style.top),i.width=this.topLevelElement.clientWidth,i.height=this.topLevelElement.clientHeight,e.east&&this._resizeEast(t,i),e.west&&this._resizeWest(t,i),e.north&&this._resizeNorth(n,i),e.south&&this._resizeSouth(n,i)}},{key:"_resizeWest",value:function _resizeWest(e,t){this._resizeContainer(e,0,-e,0,t)}},{key:"_resizeEast",value:function _resizeEast(e,t){this._resizeContainer(0,0,e,0,t)}},{key:"_resizeNorth",value:function _resizeNorth(e,t){this._resizeContainer(0,e,0,-e,t)}},{key:"_resizeSouth",value:function _resizeSouth(e,t){this._resizeContainer(0,0,0,e,t)}},{key:"_resizeContainer",value:function _resizeContainer(e,t,n,i,o){o.left+=e,o.top+=t,o.width+=n,o.height+=i,o.width=Math.max(o.width,50),o.height=Math.max(o.height,50),this.topLevelElement.style.left=o.left+"px",this.topLevelElement.style.top=o.top+"px",this.resize(o.width,o.height)}}]);return m}();var p=function(){function p(e,t,n,i){_classCallCheck(this,p);this.panel=e,this.dockManager=t,this.eventListener=t,this.grayoutParent=n,this.disableResize=i,this._initialize(),this.dockManager.context.model.dialogs.push(this),this.position=t.defaultDialogPosition,this.dockManager.notifyOnCreateDialog(this),e.isDialog=!0}_createClass(p,[{key:"saveState",value:function saveState(e,t){this.position=new o(e,t),this.dockManager.notifyOnChangeDialogPosition(this,e,t)}},{key:"_initialize",value:function _initialize(){this.panel.floatingDialog=this,this.elementDialog=Object.assign(document.createElement("div"),{floatingDialog:this}),this.elementDialog.tabIndex=0,this.elementDialog.appendChild(this.panel.elementPanel),this.draggable=new c(this,this.panel,this.elementDialog,this.panel.elementTitle),this.resizable=new m(this,this.draggable,this.draggable.topLevelElement,this.disableResize),this.dockManager.config.dialogRootElement.appendChild(this.elementDialog),this.elementDialog.classList.add("dialog-floating"),this.focusHandler=new l(this.elementDialog,"focus",this.onFocus.bind(this),!0),this.mouseDownHandler=new l(this.elementDialog,"pointerdown",this.onMouseDown.bind(this),!0),this.keyPressHandler=new l(this.elementDialog,"keypress",this.dockManager.onKeyPressBound,!0),this.contextmenuHandler=new l(this.panel.elementTitle,"contextmenu",this.oncontextMenuClicked.bind(this)),this.resize(this.panel.elementPanel.clientWidth,this.panel.elementPanel.clientHeight),this.isHidden=!1,null!=this.grayoutParent&&this.grayoutParent.grayOut(!0),this.bringToFront()}},{key:"setPosition",value:function setPosition(e,t){var n=this.dockManager.config.dialogRootElement.getBoundingClientRect();this.position=new o(e-n.left,t-n.top),this.elementDialog.style.left=e-n.left+"px",this.elementDialog.style.top=t-n.top+"px",this.panel.setDialogPosition(e,t),this.dockManager.notifyOnChangeDialogPosition(this,e,t)}},{key:"getPosition",value:function getPosition(){return new o(this.position?this.position.x:0,this.position?this.position.y:0)}},{key:"onFocus",value:function onFocus(){this.dockManager.activePanel!=this.panel&&(this.dockManager.activePanel=this.panel)}},{key:"onMouseDown",value:function onMouseDown(e){2!=e.button&&this.bringToFront()}},{key:"destroy",value:function destroy(){this.panel.lastDialogSize={width:this.resizable.width,height:this.resizable.height},this.focusHandler&&(this.focusHandler.cancel(),delete this.focusHandler),this.mouseDownHandler&&(this.mouseDownHandler.cancel(),delete this.mouseDownHandler),this.keyPressHandler&&(this.keyPressHandler.cancel(),delete this.keyPressHandler),this.contextmenuHandler&&(this.contextmenuHandler.cancel(),delete this.contextmenuHandler),s.removeNode(this.elementDialog),this.draggable.removeDecorator(),s.removeNode(this.panel.elementPanel),s.arrayRemove(this.dockManager.context.model.dialogs,this),delete this.panel.floatingDialog,this.grayoutParent&&this.grayoutParent.grayOut(!1)}},{key:"resize",value:function resize(e,t){this.resizable.resize(e,t)}},{key:"setTitle",value:function setTitle(e){this.panel.setTitle(e)}},{key:"setTitleIcon",value:function setTitleIcon(e){this.panel.setTitleIcon(e)}},{key:"bringToFront",value:function bringToFront(){this.panel.elementContentContainer.style.zIndex=this.dockManager.zIndexDialogCounter++,this.elementDialog.style.zIndex=this.dockManager.zIndexDialogCounter++,this.dockManager.activePanel=this.panel}},{key:"hide",value:function hide(){this.elementDialog.style.zIndex="0",this.panel.elementContentContainer.style.zIndex="",this.elementDialog.style.display="none",this.isHidden||(this.isHidden=!0,this.dockManager.notifyOnHideDialog(this)),this.grayoutParent&&this.grayoutParent.grayOut(!1)}},{key:"close",value:function close(){this.hide(),this.remove(),this.dockManager.notifyOnClosePanel(this.panel),this.destroy()}},{key:"remove",value:function remove(){this.elementDialog.parentNode.removeChild(this.elementDialog)}},{key:"show",value:function show(){this.panel.elementContentContainer.style.zIndex=this.dockManager.zIndexDialogCounter++,this.elementDialog.style.zIndex=this.dockManager.zIndexDialogCounter++,this.elementDialog.style.display="block",this.isHidden&&(this.isHidden=!1,this.dockManager.notifyOnShowDialog(this))}},{key:"oncontextMenuClicked",value:function oncontextMenuClicked(e){e.preventDefault(),!this._ctxMenu&&p.createContextMenuContentCallback?(this._ctxMenu=document.createElement("div"),this._ctxMenu.className="dockspab-tab-handle-context-menu",!1!==p.createContextMenuContentCallback(this,this._ctxMenu,this.dockManager.context.model.documentManagerNode.children)?(this._ctxMenu.style.left=e.pageX+"px",this._ctxMenu.style.top=e.pageY+"px",document.body.appendChild(this._ctxMenu),this._windowsContextMenuCloseBound=this.windowsContextMenuClose.bind(this),window.addEventListener("pointerup",this._windowsContextMenuCloseBound)):this._ctxMenu=null):this.closeContextMenu()}},{key:"closeContextMenu",value:function closeContextMenu(){this._ctxMenu&&(document.body.removeChild(this._ctxMenu),delete this._ctxMenu,window.removeEventListener("pointerup",this._windowsContextMenuCloseBound))}},{key:"windowsContextMenuClose",value:function windowsContextMenuClose(e){var t=e.composedPath();for(var _e6 in t)if(t[_e6]==this._ctxMenu)return;this.closeContextMenu()}}],[{key:"fromElement",value:function fromElement(e,t){return new p(new d(document.getElementById(e),t),t,null)}}]);return p}();p.createContextMenuContentCallback=function(e,t,n){if(e.panel._hideCloseButton)return!1;{var _n2=document.createElement("div");_n2.innerText=r.getString("CloseDialog"),t.append(_n2),_n2.onclick=function(){e.panel.close(),e.closeContextMenu()};var i=document.createElement("div");return i.innerText=r.getString("NewBrowserWindow"),t.append(i),i.onclick=function(){e.panel.undockToBrowserDialog(),e.closeContextMenu()},!0}};var g=_createClass(function g(){_classCallCheck(this,g);this.escClosesWindow=!0,this.escClosesDialog=!0,this.dialogRootElement=document.body,this.moveOnlyWithinDockConatiner=!1});var v=function(){function v(){_classCallCheck(this,v)}_createClass(v,[{key:"serialize",value:function serialize(e){var t=this._buildGraphInfo(e.rootNode),n=this._buildDialogsInfo(e.dialogs.sort(function(e,t){return e.elementDialog.style.zIndex-t.elementDialog.style.zIndex}));return JSON.stringify({graphInfo:t,dialogsInfo:n})}},{key:"_buildGraphInfo",value:function _buildGraphInfo(e){var _this9=this;var t={};e.container.saveState(t);var n=[];return e.children.forEach(function(e){n.push(_this9._buildGraphInfo(e))}),{containerType:e.container.containerType,state:t,children:n}}},{key:"_buildDialogsInfo",value:function _buildDialogsInfo(e){var t=[];return e.forEach(function(e){var n={},i=e.panel;i.saveState(n);var o={containerType:i.containerType,state:n,position:e.getPosition(),isHidden:e.isHidden};t.push(o)}),t}}]);return v}();var f=function(){function f(e){_classCallCheck(this,f);this.container=e,this.children=[]}_createClass(f,[{key:"detachFromParent",value:function detachFromParent(){this.parent&&(this.parent.removeChild(this),delete this.parent)}},{key:"removeChild",value:function removeChild(e){var t=this.children.indexOf(e);t>=0&&this.children.splice(t,1)}},{key:"addChild",value:function addChild(e){e.detachFromParent(),e.parent=this,this.children.push(e)}},{key:"addChildBefore",value:function addChildBefore(e,t){this._addChildWithDirection(e,t,!0)}},{key:"addChildAfter",value:function addChildAfter(e,t){this._addChildWithDirection(e,t,!1)}},{key:"_addChildWithDirection",value:function _addChildWithDirection(e,t,n){t.detachFromParent(),t.parent=this;var i=this.children.indexOf(e),o=this.children.slice(0,i),s=this.children.slice(i+1,this.children.length);this.children=o.slice(0),n?(this.children.push(t),this.children.push(e)):(this.children.push(e),this.children.push(t)),Array.prototype.push.apply(this.children,s)}},{key:"performLayout",value:function performLayout(e){var t=this.children.map(function(e){return e.container});this.container.performLayout(t,e)}},{key:"debugDumpTree",value:function debugDumpTree(e){void 0===e&&(e=0);var t=this.container.name;for(var _n3=0;_n3>"+t+" ["+n+"]"),this.children.forEach(function(t){t.debugDumpTree(e+1)})}}]);return f}();var C=function(){function C(e,t,n){_classCallCheck(this,C);this.previousContainer=e,this.nextContainer=t,this.stackedVertical=n,this.barElement=document.createElement("div"),this.barElement.classList.add(n?"splitbar-horizontal":"splitbar-vertical"),this.pointerDownHandler=new l(this.barElement,"pointerdown",this.onPointerDown.bind(this)),this.minPanelSize=50,this.readyToProcessNextDrag=!0,this.dockSpawnResizedEvent=new CustomEvent("DockSpawnResizedEvent",{composed:!0,bubbles:!0}),this.iframeEventHandlers=[]}_createClass(C,[{key:"onPointerDown",value:function onPointerDown(e){this.barElement.setPointerCapture(e.pointerId),this._startDragging(e)}},{key:"onPointerUp",value:function onPointerUp(e){this.barElement.releasePointerCapture(e.pointerId),this._stopDragging()}},{key:"onPointerMovedIframe",value:function onPointerMovedIframe(e,t){null!=e.changedTouches&&(e=e.changedTouches[0]);var n=t.getBoundingClientRect();this.handleMoveEvent({x:e.clientX+n.x,y:e.clientY+n.y})}},{key:"onPointerMoved",value:function onPointerMoved(e){null!=e.changedTouches&&(e=e.changedTouches[0]),this.handleMoveEvent({x:e.clientX,y:e.clientY})}},{key:"handleMoveEvent",value:function handleMoveEvent(e){if(!this.readyToProcessNextDrag)return;this.readyToProcessNextDrag=!1;var t=this.previousContainer.dockManager;t.suspendLayout(this.previousContainer),t.suspendLayout(this.nextContainer);var n=e.x-this.previousMouseEvent.x,i=e.y-this.previousMouseEvent.y;this._performDrag(n,i),this.previousMouseEvent=e,this.readyToProcessNextDrag=!0,t.resumeLayout(this.previousContainer),t.resumeLayout(this.nextContainer)}},{key:"_performDrag",value:function _performDrag(e,t){var n=this.previousContainer.containerElement.clientWidth,i=this.previousContainer.containerElement.clientHeight,o=this.nextContainer.containerElement.clientWidth,s=this.nextContainer.containerElement.clientHeight,l=this.stackedVertical?i:n,a=this.stackedVertical?s:o,h=this.stackedVertical?t:e,r=l+h,d=a-h;(!(rl||da)&&(this.stackedVertical?(this.previousContainer.resize(n,r),this.nextContainer.resize(o,d)):h<0?(this.previousContainer.resize(r,i),this.nextContainer.resize(d,s)):(this.nextContainer.resize(d,s),this.previousContainer.resize(r,i),this.nextContainer.resize(d,s)),document.dispatchEvent(this.dockSpawnResizedEvent))}},{key:"_startDragging",value:function _startDragging(e){var _this10=this;if(s.disableGlobalTextSelection(this.previousContainer.dockManager.config.dialogRootElement),this.pointerMovedHandler&&(this.pointerMovedHandler.cancel(),delete this.pointerMovedHandler),this.pointerUpHandler&&(this.pointerUpHandler.cancel(),delete this.pointerUpHandler),this.pointerMovedHandler=new l(window,"pointermove",this.onPointerMoved.bind(this)),this.pointerUpHandler=new l(window,"pointerup",this.onPointerUp.bind(this)),this.previousContainer.dockManager.iframes){var _iterator10=_createForOfIteratorHelper(this.previousContainer.dockManager.iframes),_step10;try{var _loop3=function _loop3(){var e=_step10.value;var t=_this10.onPointerMovedIframe.bind(_this10);_this10.iframeEventHandlers.push(new l(e.contentWindow,"pointermove",function(n){return t(n,e)})),_this10.iframeEventHandlers.push(new l(e.contentWindow,"pointerup",_this10.onPointerUp.bind(_this10)))};for(_iterator10.s();!(_step10=_iterator10.n()).done;){_loop3()}}catch(err){_iterator10.e(err)}finally{_iterator10.f()}}this.previousMouseEvent={x:e.clientX,y:e.clientY}}},{key:"_stopDragging",value:function _stopDragging(){s.enableGlobalTextSelection(this.previousContainer.dockManager.config.dialogRootElement),this.pointerMovedHandler&&(this.pointerMovedHandler.cancel(),delete this.pointerMovedHandler),this.pointerUpHandler&&(this.pointerUpHandler.cancel(),delete this.pointerUpHandler);var _iterator11=_createForOfIteratorHelper(this.iframeEventHandlers),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var _e7=_step11.value;_e7.cancel()}}catch(err){_iterator11.e(err)}finally{_iterator11.f()}this.iframeEventHandlers=[]}}]);return C}();var w=function(){function w(e,t){_classCallCheck(this,w);this.childContainers=e,this.stackedVertical=t,this.panelElement=document.createElement("div"),this.spiltterBars=[],this._buildSplitterDOMAndAddElements()}_createClass(w,[{key:"_buildSplitterDOMAndAddElements",value:function _buildSplitterDOMAndAddElements(){if(this.childContainers.length<=1)throw new Error("Splitter panel should contain atleast 2 panels");this.spiltterBars=[];var e=null;for(var _t4=0;_t40?this.panelElement.insertBefore(e.containerElement,this.panelElement.children[0]):this.panelElement.appendChild(e.containerElement)),e.containerElement.classList.add(this.stackedVertical?"splitter-container-vertical":"splitter-container-horizontal")):console.error("container is undefined")}},{key:"setContainerRatio",value:function setContainerRatio(e,t){var n=this.stackedVertical?this.panelElement.clientHeight:this.panelElement.clientWidth,i=n*t,o=(n-i-(this.stackedVertical?this.spiltterBars[0].barElement.clientHeight:this.spiltterBars[0].barElement.clientWidth)*this.spiltterBars.length)/n;for(var _t5=0;_t51?Math.floor(_t7*a):Math.ceil(_t7*a);h+=_i4,n===this.childContainers.length-1&&(_i4+=l-h),this.stackedVertical?_e9.resize(_e9.width,_i4):_e9.resize(_i4,_e9.height)}}}]);return w}();var y=function(){function y(e,t,n,i){_classCallCheck(this,y);0!==arguments.length&&(this.name=e,this.dockManager=t,this.stackedVertical=i,this.splitterPanel=new w(n,this.stackedVertical),this.containerElement=this.splitterPanel.panelElement,this.minimumAllowedChildNodes=2)}_createClass(y,[{key:"resize",value:function resize(e,t){this.splitterPanel.resize(e,t),this._cachedWidth=e,this._cachedHeight=t}},{key:"performLayout",value:function performLayout(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;this.splitterPanel.performLayout(e,t)}},{key:"setActiveChild",value:function setActiveChild(){}},{key:"destroy",value:function destroy(){this.splitterPanel.destroy()}},{key:"setContainerRatio",value:function setContainerRatio(e,t){this.splitterPanel.setContainerRatio(e,t),this.resize(this.width,this.height)}},{key:"getRatios",value:function getRatios(){return this.splitterPanel.getRatios()}},{key:"setRatios",value:function setRatios(e){this.splitterPanel.setRatios(e),this.resize(this.width,this.height)}},{key:"saveState",value:function saveState(e){e.width=this.width,e.height=this.height}},{key:"loadState",value:function loadState(e){this.state={width:e.width,height:e.height}}},{key:"width",get:function get(){return void 0===this._cachedWidth&&(this._cachedWidth=this.splitterPanel.panelElement.clientWidth),this._cachedWidth}},{key:"height",get:function get(){return void 0===this._cachedHeight&&(this._cachedHeight=this.splitterPanel.panelElement.clientHeight),this._cachedHeight}}]);return y}();var k=function(_y){_inherits(k,_y);function k(t,n){var _this12;_classCallCheck(this,k);_this12=_callSuper(this,k,[s.getNextId("horizontal_splitter_"),t,n,!1]),_this12.containerType=e.horizontal;return _this12}return _createClass(k)}(y);var M=function(_y2){_inherits(M,_y2);function M(t,n){var _this13;_classCallCheck(this,M);_this13=_callSuper(this,M,[s.getNextId("vertical_splitter_"),t,n,!0]),_this13.containerType=e.vertical;return _this13}return _createClass(M)}(y);var b=function(){function b(e){var _this14=this;_classCallCheck(this,b);this.parent=e;var n=this._performUndock.bind(this);this.elementBase=document.createElement("div"),this.elementText=document.createElement("div"),this.elementCloseButton=document.createElement("div"),this.elementBase.classList.add("dockspan-tab-handle"),this.elementBase.classList.add("disable-selection"),this.elementText.classList.add("dockspan-tab-handle-text"),this.elementCloseButton.classList.add("dockspan-tab-handle-close-button"),this.elementBase.appendChild(this.elementText),this.parent.host.displayCloseButton&&this.elementBase.appendChild(this.elementCloseButton),(this.parent.container._hideCloseButton||this.parent.container._grayOut)&&(this.elementCloseButton.style.display="none"),this.parent.host.tabListElement.appendChild(this.elementBase);var i=e.container,o=i.getRawTitle();this.undockListener={onDockEnabled:function onDockEnabled(e){_this14.undockEnabled(e.state)},onHideCloseButton:function onHideCloseButton(e){_this14.hideCloseButton(e.state)}},this.eventListeners=[],i.addListener(this.undockListener),this.elementText.innerHTML=o,this.elementText.title=this.elementText.innerText,this.undockInitiator=new a(this.elementBase,n),this.undockInitiator.enabled=!0,this.mouseDownHandler=new l(this.elementBase,"mousedown",this.onMouseDown.bind(this)),this.touchDownHandler=new l(this.elementBase,"touchstart",this.onMouseDown.bind(this),{passive:!1}),this.closeButtonHandler=new l(this.elementCloseButton,"click",this.onCloseButtonClicked.bind(this)),this.closeButtonTouchHandler=new l(this.elementCloseButton,"touchstart",this.onCloseButtonClicked.bind(this)),this.auxClickHandler=new l(this.elementBase,"auxclick",this.onCloseButtonClicked.bind(this)),i.panelType==t.document&&(this.contextMenuHandler=new l(this.elementBase,"contextmenu",this.oncontextMenuClicked.bind(this)))}_createClass(b,[{key:"addListener",value:function addListener(e){this.eventListeners.push(e)}},{key:"removeListener",value:function removeListener(e){this.eventListeners.splice(this.eventListeners.indexOf(e),1)}},{key:"undockEnabled",value:function undockEnabled(e){this.undockInitiator.enabled=e}},{key:"oncontextMenuClicked",value:function oncontextMenuClicked(e){e.preventDefault(),!this._ctxMenu&&b.createContextMenuContentCallback?(this._ctxMenu=document.createElement("div"),this._ctxMenu.className="dockspab-tab-handle-context-menu",b.createContextMenuContentCallback(this,this._ctxMenu,this.parent.container.dockManager.context.model.documentManagerNode.children),this._ctxMenu.style.left=e.pageX+"px",this._ctxMenu.style.top=e.pageY+"px",document.body.appendChild(this._ctxMenu),this._windowsContextMenuCloseBound=this.windowsContextMenuClose.bind(this),window.addEventListener("mouseup",this._windowsContextMenuCloseBound)):this.closeContextMenu()}},{key:"closeContextMenu",value:function closeContextMenu(){this._ctxMenu&&(document.body.removeChild(this._ctxMenu),delete this._ctxMenu,window.removeEventListener("mouseup",this._windowsContextMenuCloseBound))}},{key:"windowsContextMenuClose",value:function windowsContextMenuClose(e){var t=e.composedPath();for(var _e10 in t)if(t[_e10]==this._ctxMenu)return;this.closeContextMenu()}},{key:"onMouseDown",value:function onMouseDown(e){e.preventDefault(),this.parent.onSelected(),this.mouseMoveHandler&&(this.mouseMoveHandler.cancel(),delete this.mouseMoveHandler),this.touchMoveHandler&&(this.touchMoveHandler.cancel(),delete this.touchMoveHandler),this.mouseUpHandler&&(this.mouseUpHandler.cancel(),delete this.mouseUpHandler),this.touchUpHandler&&(this.touchUpHandler.cancel(),delete this.touchUpHandler),this.stargDragPosition=e.clientX,this.mouseMoveHandler=new l(window,"mousemove",this.onMouseMove.bind(this)),this.touchMoveHandler=new l(window,"touchmove",this.onMouseMove.bind(this),{passive:!1}),this.mouseUpHandler=new l(window,"mouseup",this.onMouseUp.bind(this)),this.touchUpHandler=new l(window,"touchend",this.onMouseUp.bind(this))}},{key:"onMouseUp",value:function onMouseUp(e){this.elementBase&&this.elementBase.classList.remove("dockspan-tab-handle-dragged"),this.dragged=!1,this.mouseMoveHandler&&this.mouseMoveHandler.cancel(),this.touchMoveHandler&&this.touchMoveHandler.cancel(),this.mouseUpHandler&&this.mouseUpHandler.cancel(),this.touchUpHandler&&this.touchUpHandler.cancel(),delete this.mouseMoveHandler,delete this.touchMoveHandler,delete this.mouseUpHandler,delete this.touchUpHandler}},{key:"moveTabEvent",value:function moveTabEvent(e,t){e.eventListeners.forEach(function(n){n.onMoveTab&&n.onMoveTab({self:e,state:t})})}},{key:"onMouseMove",value:function onMouseMove(e){if(e.preventDefault(),!(Math.abs(this.stargDragPosition-e.clientX)<10)&&null!=this.elementBase){this.elementBase.classList.add("dockspan-tab-handle-dragged"),this.dragged=!0,this.prev=this.current,this.current=e.clientX,this.direction=this.current-this.prev;var _t8=this.elementBase.getBoundingClientRect(),n=this.direction<0?{state:"left",bound:_t8.left,rect:_t8}:{state:"right",bound:_t8.right,rect:_t8};(e.clientX<_t8.left&&this.direction<0||e.clientX>_t8.left+_t8.width&&this.direction>0)&&this.moveTabEvent(this,n.state)}}},{key:"hideCloseButton",value:function hideCloseButton(e){this.elementCloseButton.style.display=e?"none":"block"}},{key:"updateTitle",value:function updateTitle(){if(this.parent.container instanceof d){var _e11=this.parent.container.getRawTitle();this.elementText.innerHTML=_e11}}},{key:"destroy",value:function destroy(){this.parent.container.removeListener(this.undockListener),this.mouseDownHandler.cancel(),this.touchDownHandler.cancel(),this.closeButtonHandler.cancel(),this.closeButtonTouchHandler.cancel(),this.auxClickHandler.cancel(),this.mouseMoveHandler&&this.mouseMoveHandler.cancel(),this.touchMoveHandler&&this.touchMoveHandler.cancel(),this.mouseUpHandler&&this.mouseUpHandler.cancel(),this.touchUpHandler&&this.touchUpHandler.cancel(),this.contextMenuHandler&&this.contextMenuHandler.cancel(),this.elementBase&&(s.removeNode(this.elementBase),delete this.elementBase),this.elementCloseButton&&(s.removeNode(this.elementCloseButton),delete this.elementCloseButton)}},{key:"_performUndock",value:function _performUndock(e,t){return"panel"===this.parent.container.containerType?(this.undockInitiator.enabled=!1,this.parent.container.performUndockToDialog(e,t)):null}},{key:"onCloseButtonClicked",value:function onCloseButtonClicked(e){"none"!==this.elementCloseButton.style.display&&2!==e.button&&"panel"===this.parent.container.containerType&&this.parent.container.close()}},{key:"setSelected",value:function setSelected(e){e?this.elementBase.classList.add("dockspan-tab-handle-selected"):(this.elementBase.classList.remove("dockspan-tab-handle-selected"),this.elementBase.classList.remove("dockspan-tab-handle-active"))}},{key:"setActive",value:function setActive(e){this.elementBase&&(e?this.elementBase.classList.add("dockspan-tab-handle-active"):this.elementBase.classList.remove("dockspan-tab-handle-active"))}}]);return b}();b.createContextMenuContentCallback=function(e,n,i){var o=document.createElement("div");o.innerText=r.getString("CloseAll"),n.append(o),o.onclick=function(){for(var _e12=i.length-1;_e12>=0;_e12--){var _n5=i[_e12].container;_n5.panelType==t.document&&_n5.close()}e.closeContextMenu()};var s=document.createElement("div");s.innerText=r.getString("CloseAllButThis"),n.append(s),s.onclick=function(){for(var _n6=i.length-1;_n6>=0;_n6--){var _o5=i[_n6].container;e.parent.container!=_o5&&_o5.panelType==t.document&&_o5.close()}e.closeContextMenu()};var l=document.createElement("div");l.innerText=r.getString("NewBrowserWindow"),n.append(l),l.onclick=function(){e.parent.container.undockToBrowserDialog(),e.closeContextMenu()}};var E=function(){function E(e,t){_classCallCheck(this,E);0!==arguments.length&&(this.selected=!1,this.host=e,this.container=t,this.handle=new b(this),this.containerElement=t.containerElement,t instanceof d&&(this.panel=t,this.panel.onTitleChanged=this.onTitleChanged.bind(this),this.onTitleChanged()),t.tabPage=this)}_createClass(E,[{key:"onTitleChanged",value:function onTitleChanged(){this.handle.updateTitle(),this.panel&&(this.panel.hasChanges?this.handle.elementText.classList.add("panel-has-changes"):this.handle.elementText.classList.remove("panel-has-changes"))}},{key:"destroy",value:function destroy(){this.handle.destroy(),this.container instanceof d&&delete this.container.onTitleChanged,this.host.dockManager.activePanel==this.panel&&(this.host.dockManager.activePanel=null),this.container.tabPage=null,s.removeNode(this.containerElement)}},{key:"onSelected",value:function onSelected(){this.host.onTabPageSelected(this,!0),this.container instanceof d&&this.container.dockManager.notifyOnTabChange(this)}},{key:"setSelected",value:function setSelected(e,t){if(this.selected=e,this.handle.setSelected(e),this._initContent||this.host.contentElement.appendChild(this.containerElement),this._initContent=!0,this.selected){this.containerElement.style.display="block",this.panel.setVisible(!0);var _e13=this.host.contentElement.clientWidth,n=this.host.contentElement.clientHeight;this.container.resize(_e13,n),t&&(this.host.dockManager.activePanel=this.container)}else this.containerElement.style.display="none",this.panel.setVisible(!1)}},{key:"resize",value:function resize(e,t){this.container.resize(e,t)}}]);return E}();var D,H;!function(e){e[e.TOP=0]="TOP",e[e.BOTTOM=1]="BOTTOM",e[e.LEFT=2]="LEFT",e[e.RIGHT=3]="RIGHT"}(D||(D={}));var x=function(){function x(e,t,n){var _this15=this;_classCallCheck(this,x);if(void 0===t&&(t=D.BOTTOM),void 0===n&&(n=!1),this.dockManager=e,this.tabStripDirection=t,this.displayCloseButton=n,this.pages=[],this.eventListeners=[],this.tabHandleListener={onMoveTab:function onMoveTab(e){_this15.onMoveTab(e)}},this.hostElement=document.createElement("div"),this.tabListElement=document.createElement("div"),this.separatorElement=document.createElement("div"),this.contentElement=document.createElement("div"),this.contentElement.tabIndex=0,this.createTabPage=this._createDefaultTabPage,this.tabStripDirection===D.BOTTOM)this.hostElement.appendChild(this.contentElement),this.hostElement.appendChild(this.separatorElement),this.hostElement.appendChild(this.tabListElement);else{if(this.tabStripDirection!==D.TOP)throw new Error("Only top and bottom tab strip orientations are supported");this.hostElement.appendChild(this.tabListElement),this.hostElement.appendChild(this.separatorElement),this.hostElement.appendChild(this.contentElement)}this.hostElement.classList.add("dockspan-tab-host"),this.tabListElement.classList.add("dockspan-tab-handle-list-container"),this.separatorElement.classList.add("dockspan-tab-handle-content-seperator"),this.contentElement.classList.add("dockspan-tab-content"),this.contentElement.tabIndex=0,this.focusHandler=new l(this.contentElement,"focus",this.onFocus.bind(this),!0),this.mouseDownHandler=new l(this.contentElement,"mousedown",this.onMousedown.bind(this),!0)}_createClass(x,[{key:"onFocus",value:function onFocus(){this.activeTab&&this.dockManager.activePanel!=this.activeTab.panel&&(this.dockManager.activePanel=this.activeTab.panel)}},{key:"setActive",value:function setActive(e){e?this.separatorElement.classList.add("dockspan-tab-handle-content-seperator-active"):this.separatorElement.classList.remove("dockspan-tab-handle-content-seperator-active"),this.activeTab&&this.activeTab.handle.setActive(e)}},{key:"onMousedown",value:function onMousedown(){this.activeTab&&this.dockManager.activePanel!=this.activeTab.panel&&(this.dockManager.activePanel=this.activeTab.panel)}},{key:"onMoveTab",value:function onMoveTab(e){var t=Array.prototype.slice.call(this.tabListElement.childNodes).indexOf(e.self.elementBase);this.change(this,e.self,e.state,t)}},{key:"performTabsLayout",value:function performTabsLayout(e){this.pages=s.orderByIndexes(this.pages,e);var t=this.tabListElement.childNodes,n=[];for(var _e14 in t)1===t[_e14].nodeType&&n.push(t[_e14]);n=s.orderByIndexes(n,e);for(var _e15=0;_e150&&t&&(this.onTabPageSelected(t,!0),this.dockManager.activePanel=e)}},{key:"resize",value:function resize(e,t){var _this16=this;this.hostElement.style.width=e+"px",this.hostElement.style.height=t+"px";var n=this.tabListElement.clientHeight;this._resizeRequested||requestAnimationFrame(function(){return _this16.resizeTabListElement(e,t)}),this._resizeRequested=!0;var i=this.separatorElement.clientHeight,o=t-n-i;this.contentElement.style.height=o+"px",this.activeTab&&this.activeTab.resize(e,o)}},{key:"resizeTabListElement",value:function resizeTabListElement(e,t){var _this17=this;if(this._resizeRequested=!1,0===this.pages.length)return;var n=0;this.pages.forEach(function(e){var t=e.handle;null!=t.elementBase&&(t.elementBase.style.width="",n+=t.elementBase.clientWidth)});var i=e/n;i>1.2||this.pages.forEach(function(e,t){var n=e.handle,o=i*n.elementBase.clientWidth;t===_this17.pages.length-1&&(o-=5),n.elementBase.style.width=o+"px"})}},{key:"performLayout",value:function performLayout(e){var _this18=this;this.pages.forEach(function(t){if(!e.some(function(e){return e==t.container})){t.handle.removeListener(_this18.tabHandleListener),t.destroy();var _e16=_this18.pages.indexOf(t);_e16>-1&&_this18.pages.splice(_e16,1)}});var t=this.activeTab;delete this.activeTab;var n=e.filter(function(e){return"panel"===e.containerType});n.length>0?(n.forEach(function(e){var n=null;_this18.pages.some(function(t){return t.container==e&&(n=t,!0)})||(n=_this18.createTabPage(_this18,e),n.handle.addListener(_this18.tabHandleListener),_this18.pages.push(n)),t&&n.container===t.container&&(_this18.activeTab=n)}),this._setTabHandlesVisible(!0)):this._setTabHandlesVisible(!1),this.activeTab&&this.onTabPageSelected(this.activeTab,!1)}},{key:"_setTabHandlesVisible",value:function _setTabHandlesVisible(e){e?(this.tabListElement.classList.add("dockspan-tab-handle-list-container-visible"),this.separatorElement.classList.add("dockspan-tab-handle-content-seperator-visible")):(this.tabListElement.classList.remove("dockspan-tab-handle-list-container-visible"),this.separatorElement.classList.remove("dockspan-tab-handle-content-seperator-visible"))}},{key:"onTabPageSelected",value:function onTabPageSelected(e,t){this.activeTab=e,this.pages.forEach(function(n){var i=n===e;n.setSelected(i,t)})}}]);return x}();var _=function(){function _(t,n){var _this19=this;_classCallCheck(this,_);void 0===n&&(n=D.BOTTOM),this.dockManager=t,this.tabOrientation=n,this.name=s.getNextId("fill_"),this.element=document.createElement("div"),this.containerElement=this.element,this.containerType=e.fill,this.minimumAllowedChildNodes=2,this.element.classList.add("dock-container"),this.element.classList.add("dock-container-fill"),this.tabHost=new x(t,this.tabOrientation),this.tabHostListener={onChange:function onChange(e){_this19.dockManager._requestTabReorder(_this19,e)}},this.tabHost.addListener(this.tabHostListener),this.element.appendChild(this.tabHost.hostElement)}_createClass(_,[{key:"setActiveChild",value:function setActiveChild(e){this.tabHost.setActiveTab(e)}},{key:"resize",value:function resize(e,t){this.element.style.width=e+"px",this.element.style.height=t+"px",this.tabHost.resize(e,t)}},{key:"performLayout",value:function performLayout(e){this.tabHost.performLayout(e)}},{key:"destroy",value:function destroy(){this.tabHost.pages.forEach(function(e){return e.destroy()}),s.removeNode(this.element)&&delete this.element}},{key:"saveState",value:function saveState(e){e.width=this.width,e.height=this.height}},{key:"loadState",value:function loadState(e){this.state={width:e.width,height:e.height}}},{key:"width",get:function get(){return this.element.clientWidth},set:function set(e){this.element.style.width=e+"px"}},{key:"height",get:function get(){return this.element.clientHeight},set:function set(e){this.element.style.height=e+"px"}}]);return _}();var T=function(){function T(e){_classCallCheck(this,T);this._forceResizeCompositeContainer=function(e){var t=e.containerElement.clientWidth,n=e.containerElement.clientHeight;e.resize(t,n)},this.dockManager=e}_createClass(T,[{key:"dockLeft",value:function dockLeft(e,t){this._performDock(e,t,"horizontal",!0)}},{key:"dockRight",value:function dockRight(e,t){this._performDock(e,t,"horizontal",!1)}},{key:"dockUp",value:function dockUp(e,t){this._performDock(e,t,"vertical",!0)}},{key:"dockDown",value:function dockDown(e,t){this._performDock(e,t,"vertical",!1)}},{key:"dockFill",value:function dockFill(e,t){this._performDock(e,t,"fill",!1)}},{key:"undock",value:function undock(e){var t=e.parent;if(!t)throw new Error("Cannot undock. panel is not a leaf node");var n=t.children.indexOf(e);if(e.detachFromParent(),t.children.length0){var _e18=t.children[Math.max(0,n-1)];t.container.setActiveChild(_e18.container)}this.dockManager.invalidate(),this.dockManager.notifyOnUnDock(e)}},{key:"close",value:function close(e){var t=null==e?void 0:e.parent;if(!t)throw new Error("Cannot undock. panel is not a leaf node");var n=!1;t.children.length>0&&null!=t.container.tabHost&&(n=t.container.tabHost.getActiveTab().container==e.container);var i=t.children.indexOf(e);if(e.detachFromParent(),t.children.length=e.children.length)return;if("left"==n&&0==l)return;var a=Array.apply(null,{length:o}).map(Number.call,Number),h=a.splice(l,1)[0];a.splice("left"===n?i-1:i,0,h),e.children=s.orderByIndexes(e.children,a),e.container.tabHost.performTabsLayout(a),this.dockManager.notifyOnTabsReorder(e)}},{key:"_performDock",value:function _performDock(e,t,n,i){if(e.parent&&"fill"===e.parent.container.containerType&&(e=e.parent),"fill"===n&&"fill"===e.container.containerType)return e.addChild(t),e.performLayout(!1),e.container.setActiveChild(t.container),this.dockManager.invalidate(),void this.dockManager.notifyOnDock(t);var o,l,a;if(e===this.dockManager.context.model.rootNode)return i?(o=this._createDockContainer(n,t,e),l=new f(o),l.addChild(t),l.addChild(e)):(o=this._createDockContainer(n,e,t),l=new f(o),l.addChild(e),l.addChild(t)),this.dockManager.setRootNode(l),this.dockManager.rebuildLayout(this.dockManager.context.model.rootNode),l.container.setActiveChild(t.container),this.dockManager.invalidate(),void this.dockManager.notifyOnDock(t);if(e.parent.container.containerType!==n){a=e.parent;var _h=e.container.containerElement.clientWidth,_r=e.container.containerElement.clientHeight,_d=a.container.containerElement.clientWidth,_c=a.container.containerElement.clientHeight;o=this._createDockContainer(n,t,e),l=new f(o),a.addChildAfter(e,l),e.detachFromParent(),s.removeNode(e.container.containerElement),i?(l.addChild(t),l.addChild(e)):(l.addChild(e),l.addChild(t)),a.performLayout(!1),l.performLayout(!0),l.container.setActiveChild(t.container),l.container.resize(_h,_r),a.container.resize(_d,_c)}else a=e.parent,i?a.addChildBefore(e,t):a.addChildAfter(e,t),a.performLayout(!1),a.container.setActiveChild(t.container);var h=t.container.containerElement.clientWidth,r=t.container.containerElement.clientHeight;t.container.resize(h,r),this.dockManager.invalidate(),this.dockManager.notifyOnDock(t)}},{key:"_createDockContainer",value:function _createDockContainer(e,t,n){if("horizontal"===e)return new k(this.dockManager,[t.container,n.container]);if("vertical"===e)return new M(this.dockManager,[t.container,n.container]);if("fill"===e)return new _(this.dockManager);throw new Error("Failed to create dock container of type: "+e)}},{key:"getDockBounds",value:function getDockBounds(e,t,n,i){var o,s,l,a;if("fill"===n){var _t9=e.container.containerElement,_n11=this.dockManager.element.getBoundingClientRect(),_i6=_t9.getBoundingClientRect();return{x:_i6.left-_n11.left,y:_i6.top-_n11.top,width:_t9.clientWidth,height:_t9.clientHeight}}e.parent&&"fill"===e.parent.container.containerType&&(e=e.parent);var h=!1;e.parent&&e.parent.container.containerType===n?(o=e.parent,s=o.children.length,l=o.children.indexOf(e)+(i?0:1)):(o=e,s=1,l=i?0:1,h=!0);var r=0,d=0;if("vertical"===n||"horizontal"===n){var _e21=this._getVaringDimension(o.container,n)-5*(s-1),_a2=this._getVaringDimension(t,n),_c2=_e21/(_e21+_a2);if(r=_a2*_c2,h)d=i?0:_e21*_c2;else{for(var _e22=0;_e22document.body.clientWidth||n.position.y>document.body.clientHeight-70)&&(n.position.x=20,n.position.y=70),_i7.setPosition(n.position.x,n.position.y),_i7.isHidden=n.isHidden,_i7.isHidden&&_i7.hide(),t.push(_i7);case 17:_context7.next=4;break;case 19:_context7.next=24;break;case 21:_context7.prev=21;_context7.t1=_context7["catch"](2);_iterator15.e(_context7.t1);case 24:_context7.prev=24;_iterator15.f();return _context7.finish(24);case 27:return _context7.abrupt("return",t);case 28:case"end":return _context7.stop()}},_callee7,this,[[2,21,24,27]])}));function _buildDialogs(_x8){return _buildDialogs2.apply(this,arguments)}return _buildDialogs}()}]);return W}();var R=function(){function R(e,t){_classCallCheck(this,R);if(void 0===e)throw new Error("Invalid Dock Manager element provided");this._config=Object.assign(new g,t),this.element=e,this.context=this.dockWheel=this.layoutEngine=this.mouseMoveHandler=this.touchMoveHandler=void 0,this.layoutEventListeners=[],this.defaultDialogPosition=new o(0,0)}_createClass(R,[{key:"config",get:function get(){return this._config}},{key:"initialize",value:function initialize(){this.backgroundContext=this.element.children[0],this.context=new S(this);var e=new f(this.context.documentManagerView);this.context.model.rootNode=e,this.context.model.documentManagerNode=e,this.context.model.dialogs=[],this.setRootNode(this.context.model.rootNode),this.resize(this.element.clientWidth,this.element.clientHeight),this.dockWheel=new L(this),this.layoutEngine=new T(this),this._undockEnabled=!0,this.rebuildLayout(this.context.model.rootNode),this.zIndexCounter=1001,this.zIndexTabHost=1e3,this.zIndexTabHandle=100,this.zIndexDialogCounter=10001,null!=this.backgroundContext&&this.context.model.rootNode.container.tabHost.hostElement.insertBefore(this.backgroundContext,this.context.model.rootNode.container.tabHost.hostElement.firstChild),this.onKeyPressBound=this.onKeyPress.bind(this),this.element.addEventListener("keydown",this.onKeyPressBound)}},{key:"onKeyPress",value:function onKeyPress(e){if("Escape"==e.key&&this.activePanel&&!this.activePanel._hideCloseButton&&(this.activePanel.isDialog&&this._config.escClosesDialog||!this.activePanel.isDialog&&this._config.escClosesWindow)){var _e30=this.activePanel;this.activePanel=null,_e30.close()}}},{key:"checkXBounds",value:function checkXBounds(e,t,n,i,o){if(this._config.moveOnlyWithinDockConatiner)return this.checkXBoundsWithinDockContainer(e,t,n,i,o);var s=this.element.getBoundingClientRect(),l=Math.floor(t.x-n.x),a=e.offsetLeft+e.offsetWidth+l+s.left<40,h=e.offsetLeft+l+s.left>window.innerWidth-40;if(a){n.x=t.x,l=0;var _i8=40-(e.offsetWidth+e.offsetLeft+s.left);_i8>0&&(l=_i8)}else if(h){n.x=t.x,l=0;var _i9=window.innerWidth-40-e.offsetLeft-s.left;_i9>0&&(l=_i9)}return l}},{key:"checkXBoundsWithinDockContainer",value:function checkXBoundsWithinDockContainer(e,t,n,i,o){var s=t.x-n.x,l=this.element.getBoundingClientRect(),a=e.getBoundingClientRect(),h=s<0&&a.left+s0&&a.right+s>l.right&&!i;return h?(t.x-=s,s=l.left-a.left,t.x-=s):r&&(t.x-=s,s=l.right-a.right,t.x-=s),s}},{key:"checkYBounds",value:function checkYBounds(e,t,n,i,o){if(this._config.moveOnlyWithinDockConatiner)return this.checkYBoundsWithinDockContainer(e,t,n,i,o);var s=this.element.getBoundingClientRect(),l=Math.floor(t.y-n.y),a=e.offsetTop+l+s.top<0,h=e.offsetTop+l+s.top>window.innerHeight-16;if(a)n.y=t.y,l=0;else if(h){n.y=t.y,l=0;var _i10=window.innerHeight-16-e.offsetTop-s.top;_i10>0&&(l=_i10)}return l}},{key:"checkYBoundsWithinDockContainer",value:function checkYBoundsWithinDockContainer(e,t,n,i,o){var s=t.y-n.y,l=this.element.getBoundingClientRect(),a=e.getBoundingClientRect(),h=s<0&&a.top+s0&&a.bottom+s>l.bottom&&!i;return h?(t.y-=s,s=l.top-a.top,t.y-=s):r&&(t.y-=s,s=l.bottom-a.bottom,t.y-=s),s}},{key:"rebuildLayout",value:function rebuildLayout(e){var _this22=this;e.children.forEach(function(e){_this22.rebuildLayout(e)}),e.performLayout(!1)}},{key:"invalidate",value:function invalidate(){this.resize(this.element.clientWidth,this.element.clientHeight)}},{key:"resize",value:function resize(e,t){this.element.style.width=e+"px",this.element.style.height=t+"px",this.context.model.rootNode.container.resize(e,t);var n=0,i=0;var _iterator16=_createForOfIteratorHelper(this.context.model.dialogs),_step16;try{for(_iterator16.s();!(_step16=_iterator16.n()).done;){var _e31=_step16.value;(_e31.position.x>this.element.clientWidth||_e31.position.y>this.element.clientHeight)&&((n>this.element.clientWidth||i>this.element.clientHeight)&&(n=0,i=0),_e31.setPosition(100+n,100+i),n+=100,i+=100)}}catch(err){_iterator16.e(err)}finally{_iterator16.f()}}},{key:"setModel",value:function setModel(e){s.removeNode(this.context.documentManagerView.containerElement),this.context.model=e,this.setRootNode(e.rootNode),this.rebuildLayout(e.rootNode),this.loadResize(e.rootNode)}},{key:"loadResize",value:function loadResize(e){var _this23=this;e.children.reverse().forEach(function(t){_this23.loadResize(t),e.container.setActiveChild(t.container)}),e.children.reverse();var t=e.container;e.container.resize(t.state.width,t.state.height)}},{key:"setRootNode",value:function setRootNode(e){e.detachFromParent(),this.context.model.rootNode=e,this.element.appendChild(e.container.containerElement)}},{key:"_onDialogDragStarted",value:function _onDialogDragStarted(e,t){this.dockWheel.activeNode=this._findNodeOnPoint(t.clientX,t.clientY),this.dockWheel.activeDialog=e,null!=e.noDocking&&!0===e.noDocking||this.dockWheel.showWheel(),this.mouseMoveHandler&&(this.mouseMoveHandler.cancel(),delete this.mouseMoveHandler),this.touchMoveHandler&&(this.touchMoveHandler.cancel(),delete this.touchMoveHandler),this.mouseMoveHandler=new l(window,"mousemove",this._onMouseMoved.bind(this)),this.touchMoveHandler=new l(window,"touchmove",this._onMouseMoved.bind(this))}},{key:"_onDialogDragEnded",value:function _onDialogDragEnded(e,t){this.mouseMoveHandler&&(this.mouseMoveHandler.cancel(),delete this.mouseMoveHandler),this.touchMoveHandler&&(this.touchMoveHandler.cancel(),delete this.touchMoveHandler),this.dockWheel.onDialogDropped(e),this.dockWheel.hideWheel(),delete this.dockWheel.activeDialog,e.saveState(e.elementDialog.offsetLeft,e.elementDialog.offsetTop)}},{key:"_onMouseMoved",value:function _onMouseMoved(e){null!=e.changedTouches&&(e=e.changedTouches[0]),this.dockWheel.activeNode=this._findNodeOnPoint(e.clientX,e.clientY)}},{key:"_findNodeOnPoint",value:function _findNodeOnPoint(e,t){var n,i=[];for(i.push(this.context.model.rootNode);i.length>0;){var _o9=i.pop();s.isPointInsideNode(e,t,_o9)&&(n=_o9,[].push.apply(i,_o9.children))}return n}},{key:"dockDialogLeft",value:function dockDialogLeft(e,t){return this._requestDockDialog(e,t,this.layoutEngine.dockLeft.bind(this.layoutEngine))}},{key:"dockDialogRight",value:function dockDialogRight(e,t){return this._requestDockDialog(e,t,this.layoutEngine.dockRight.bind(this.layoutEngine))}},{key:"dockDialogUp",value:function dockDialogUp(e,t){return this._requestDockDialog(e,t,this.layoutEngine.dockUp.bind(this.layoutEngine))}},{key:"dockDialogDown",value:function dockDialogDown(e,t){return this._requestDockDialog(e,t,this.layoutEngine.dockDown.bind(this.layoutEngine))}},{key:"dockDialogFill",value:function dockDialogFill(e,t){return this._requestDockDialog(e,t,this.layoutEngine.dockFill.bind(this.layoutEngine))}},{key:"dockLeft",value:function dockLeft(e,t,n){return this._requestDockContainer(e,t,this.layoutEngine.dockLeft.bind(this.layoutEngine),!1,n)}},{key:"dockRight",value:function dockRight(e,t,n){return this._requestDockContainer(e,t,this.layoutEngine.dockRight.bind(this.layoutEngine),!0,n)}},{key:"dockUp",value:function dockUp(e,t,n){return this._requestDockContainer(e,t,this.layoutEngine.dockUp.bind(this.layoutEngine),!1,n)}},{key:"dockDown",value:function dockDown(e,t,n){return this._requestDockContainer(e,t,this.layoutEngine.dockDown.bind(this.layoutEngine),!0,n)}},{key:"dockFill",value:function dockFill(e,t){return this._requestDockContainer(e,t,this.layoutEngine.dockFill.bind(this.layoutEngine),!1)}},{key:"floatDialog",value:function floatDialog(e,t,n,i,o){var l;if(this.context.model.dialogs.forEach(function(i){e==i.panel&&(i.show(),i.setPosition(t,n),l=i)}),l)return l;try{var _t12=this._findNodeFromContainer(e);this.layoutEngine.undock(_t12)}catch(e){}var a=e;s.removeNode(a.elementPanel),a.isDialog=!0;var h=new p(a,this,i,o);return h.setPosition(t,n),h}},{key:"_requestDockDialog",value:function _requestDockDialog(e,t,n){var i=t.panel,o=new f(i);return i.prepareForDocking(),i.elementContentContainer.style.zIndex="",t.destroy(),n(e,o),o}},{key:"_checkShowBackgroundContext",value:function _checkShowBackgroundContext(){null!=this.backgroundContext&&(this.context.model.documentManagerNode.children.length>0?this.backgroundContext.style.display="none":this.backgroundContext.style.display="block")}},{key:"_requestDockContainer",value:function _requestDockContainer(e,t,n,i,o){var l=new f(t);if("panel"===t.containerType){var _e32=t;_e32.prepareForDocking(),s.removeNode(_e32.elementPanel)}var a,h=null;if(e.parent&&e.parent.container&&(a=e.parent.container,a.getRatios&&(h=a.getRatios())),n(e,l),o&&l.parent&&("vertical"===l.parent.container.containerType||"horizontal"===l.parent.container.containerType)){var _e33=l.parent.container;if(h&&a==_e33){if(i){for(var _e34=0;_e34_e35&&(n.x=.75*_e35),s.setPosition(t.clientX-n.x,t.clientY-n.y),s.draggable.onMouseDown(t)}return s}},{key:"requestClose",value:function requestClose(e){var t=this._findNodeFromContainer(e);if(this.layoutEngine.close(t),this.activePanel==e&&(this.activePanel=null),this._activeDocument==e){var _e36=this._activeDocument;this._activeDocument=null,this.notifyOnActiveDocumentChange(null,_e36)}}},{key:"openInDialog",value:function openInDialog(e,t,n,i){var o=new p(e,this,null,i);if(null!=t){var _e37=o.elementDialog.clientWidth;n.x>_e37&&(n.x=.75*_e37),o.setPosition(t.clientX-n.x,t.clientY-n.y),o.draggable.onMouseDown(t)}return o}},{key:"requestUndock",value:function requestUndock(e){var t=this._findNodeFromContainer(e);this.layoutEngine.undock(t)}},{key:"requestRemove",value:function requestRemove(e){var t=this._findNodeFromContainer(e),n=t.parent;return t.detachFromParent(),n&&this.rebuildLayout(n),t}},{key:"getNodeByElementId",value:function getNodeByElementId(e){var t,n;var i=[];for(i.push(this.context.model.rootNode);i.length>0;){var _o10=i.pop();if(_o10.container instanceof d){if(_o10.container.elementContent.id===e)return _o10;if(_o10.container.elementContent instanceof HTMLSlotElement&&(null===(n=null===(t=_o10.container.elementContent.assignedElements())||void 0===t?void 0:t[0])||void 0===n?void 0:n.id)===e)return _o10}[].push.apply(i,_o10.children)}return null}},{key:"getNodeByElement",value:function getNodeByElement(e){var t;var n=[];for(n.push(this.context.model.rootNode);n.length>0;){var i=n.pop();if(i.container instanceof d){if(i.container.elementContent===e)return i;if(i.container.elementContent instanceof HTMLSlotElement&&(null===(t=i.container.elementContent.assignedElements())||void 0===t?void 0:t[0])===e)return i}[].push.apply(n,i.children)}return null}},{key:"_findNodeFromContainer",value:function _findNodeFromContainer(e){var t=[];for(t.push(this.context.model.rootNode);t.length>0;){var n=t.pop();if(n.container===e)return n;[].push.apply(t,n.children)}return null}},{key:"findNodeFromContainerElement",value:function findNodeFromContainerElement(e){var t=[];for(t.push(this.context.model.rootNode);t.length>0;){var n=t.pop();if(n.container.containerElement===e)return n;[].push.apply(t,n.children)}return null}},{key:"addLayoutListener",value:function addLayoutListener(e){this.layoutEventListeners.push(e)}},{key:"removeLayoutListener",value:function removeLayoutListener(e){this.layoutEventListeners.splice(this.layoutEventListeners.indexOf(e),1)}},{key:"suspendLayout",value:function suspendLayout(e){var _this24=this;this.layoutEventListeners.forEach(function(t){t.onSuspendLayout&&t.onSuspendLayout(_this24,e)})}},{key:"resumeLayout",value:function resumeLayout(e){var _this25=this;this.layoutEventListeners.forEach(function(t){t.onResumeLayout&&t.onResumeLayout(_this25,e)})}},{key:"notifyOnDock",value:function notifyOnDock(e){var _this26=this;this._checkShowBackgroundContext(),this.layoutEventListeners.forEach(function(t){t.onDock&&(t.onDock(_this26,e),e.container.resize(e.container.width,e.container.height))})}},{key:"notifyOnTabsReorder",value:function notifyOnTabsReorder(e){var _this27=this;this.layoutEventListeners.forEach(function(t){t.onTabsReorder&&t.onTabsReorder(_this27,e)})}},{key:"notifyOnUnDock",value:function notifyOnUnDock(e){var _this28=this;this._checkShowBackgroundContext(),this.layoutEventListeners.forEach(function(t){t.onUndock&&t.onUndock(_this28,e)})}},{key:"notifyOnClosePanel",value:function notifyOnClosePanel(e){var _this29=this;if(this._checkShowBackgroundContext(),this.activePanel==e&&(this.activePanel=null),this._activeDocument==e){var _e38=this._activeDocument;this._activeDocument=null,this.notifyOnActiveDocumentChange(null,_e38)}this.layoutEventListeners.forEach(function(t){t.onClosePanel&&t.onClosePanel(_this29,e)})}},{key:"notifyOnCreateDialog",value:function notifyOnCreateDialog(e){var _this30=this;this.layoutEventListeners.forEach(function(t){t.onCreateDialog&&t.onCreateDialog(_this30,e)})}},{key:"notifyOnHideDialog",value:function notifyOnHideDialog(e){var _this31=this;this.layoutEventListeners.forEach(function(t){t.onHideDialog&&t.onHideDialog(_this31,e)})}},{key:"notifyOnShowDialog",value:function notifyOnShowDialog(e){var _this32=this;this.layoutEventListeners.forEach(function(t){t.onShowDialog&&t.onShowDialog(_this32,e)})}},{key:"notifyOnChangeDialogPosition",value:function notifyOnChangeDialogPosition(e,t,n){var _this33=this;this.layoutEventListeners.forEach(function(i){i.onChangeDialogPosition&&i.onChangeDialogPosition(_this33,e,t,n)})}},{key:"notifyOnContainerResized",value:function notifyOnContainerResized(e){var _this34=this;this.layoutEventListeners.forEach(function(t){t.onContainerResized&&t.onContainerResized(_this34,e)})}},{key:"notifyOnTabChange",value:function notifyOnTabChange(e){var _this35=this;this.layoutEventListeners.forEach(function(t){t.onTabChanged&&t.onTabChanged(_this35,e)})}},{key:"notifyOnActivePanelChange",value:function notifyOnActivePanelChange(e,t){var _this36=this;this.layoutEventListeners.forEach(function(n){n.onActivePanelChange&&n.onActivePanelChange(_this36,e,t)})}},{key:"notifyOnActiveDocumentChange",value:function notifyOnActiveDocumentChange(e,t){var _this37=this;this.layoutEventListeners.forEach(function(n){n.onActiveDocumentChange&&n.onActiveDocumentChange(_this37,e,t)})}},{key:"saveState",value:function saveState(){return(new v).serialize(this.context.model)}},{key:"loadState",value:function(){var _loadState=_asyncToGenerator(_regeneratorRuntime().mark(function _callee8(e){var t;return _regeneratorRuntime().wrap(function _callee8$(_context8){while(1)switch(_context8.prev=_context8.next){case 0:t=new W(this);_context8.next=3;return t.deserialize(e);case 3:this.context.model=_context8.sent;this.setModel(this.context.model);case 5:case"end":return _context8.stop()}},_callee8,this)}));function loadState(_x9){return _loadState.apply(this,arguments)}return loadState}()},{key:"getPanels",value:function getPanels(){var e=[];return this._allPanels(this.context.model.rootNode,e),this.context.model.dialogs.forEach(function(t){e.push(t.panel)}),e}},{key:"undockEnabled",value:function undockEnabled(e){this._undockEnabled=e,this.getPanels().forEach(function(t){t.canUndock(e)})}},{key:"lockDockState",value:function lockDockState(e){this.undockEnabled(!e),this.hideCloseButton(e)}},{key:"hideCloseButton",value:function hideCloseButton(e){this.getPanels().forEach(function(t){t.hideCloseButton(e)})}},{key:"updatePanels",value:function updatePanels(e){var t=[];return this._allPanels(this.context.model.rootNode,t),t.forEach(function(t){s.arrayContains(e,t.elementContent.id)||t.close()}),this.context.model.dialogs.forEach(function(t){s.arrayContains(e,t.panel.elementContent.id)?t.show():t.hide()}),t}},{key:"getVisiblePanels",value:function getVisiblePanels(){var e=[];return this._allPanels(this.context.model.rootNode,e),this.context.model.dialogs.forEach(function(t){t.isHidden||e.push(t.panel)}),e}},{key:"_allPanels",value:function _allPanels(e,t){var _this38=this;e.children.forEach(function(e){_this38._allPanels(e,t)}),"panel"===e.container.containerType&&t.push(e.container)}},{key:"activeDocument",get:function get(){return this._activeDocument}},{key:"activePanel",get:function get(){return this._activePanel},set:function set(e){if(e!==this._activePanel){e&&!e.isDialog&&(this._lastPanelNotADialog=e),this._lastPanelNotADialog&&this.getPanels().indexOf(this._lastPanelNotADialog)<0&&(this._lastPanelNotADialog=null);var n=this.activePanel;this.activePanel&&(this.activePanel.elementTitle.classList.remove("dockspan-panel-active"),this.activePanel.elementTitleText.classList.remove("dockspan-panel-titlebar-text-active"),this.activePanel.tabPage&&this.activePanel.tabPage.host.setActive(!1)),this._activePanel=e;var i=this._activeDocument;e&&e.panelType==t.document&&(this._activeDocument=e),!e&&n&&n.isDialog&&null==e&&this._lastPanelNotADialog&&this.activePanel!=this._lastPanelNotADialog&&(e=this._lastPanelNotADialog,this._lastPanelNotADialog=void 0),this.notifyOnActivePanelChange(e,n),i!=this._activeDocument&&this.notifyOnActiveDocumentChange(this._activeDocument,i),e&&(e.elementTitle.classList.add("dockspan-panel-active"),e.elementTitleText.classList.add("dockspan-panel-titlebar-text-active"),e.tabPage&&e.tabPage.host.setActive(!0))}else e&&e.tabPage&&e.tabPage.host.setActive(!0)}}]);return R}();DockSpawnTS=i})(); +"use strict";function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _get(){if(typeof Reflect!=="undefined"&&Reflect.get){_get=Reflect.get.bind()}else{_get=function _get(target,property,receiver){var base=_superPropBase(target,property);if(!base)return;var desc=Object.getOwnPropertyDescriptor(base,property);if(desc.get){return desc.get.call(arguments.length<3?target:receiver)}return desc.value}}return _get.apply(this,arguments)}function _superPropBase(object,property){while(!Object.prototype.hasOwnProperty.call(object,property)){object=_getPrototypeOf(object);if(object===null)break}return object}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e))}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined")}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t})()}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _regeneratorRuntime(){"use strict";_regeneratorRuntime=function _regeneratorRuntime(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function define(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{define({},"")}catch(t){define=function define(t,e,r){return t[e]=r}}function wrap(t,e,r,n){var i=e&&e.prototype instanceof Generator?e:Generator,a=Object.create(i.prototype),c=new Context(n||[]);return o(a,"_invoke",{value:makeInvokeMethod(t,r,c)}),a}function tryCatch(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=wrap;var h="suspendedStart",l="suspendedYield",f="executing",s="completed",y={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var p={};define(p,a,function(){return this});var d=Object.getPrototypeOf,v=d&&d(d(values([])));v&&v!==r&&n.call(v,a)&&(p=v);var g=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p);function defineIteratorMethods(t){["next","throw","return"].forEach(function(e){define(t,e,function(t){return this._invoke(e,t)})})}function AsyncIterator(t,e){function invoke(r,o,i,a){var c=tryCatch(t[r],t,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==_typeof(h)&&n.call(h,"__await")?e.resolve(h.__await).then(function(t){invoke("next",t,i,a)},function(t){invoke("throw",t,i,a)}):e.resolve(h).then(function(t){u.value=t,i(u)},function(t){return invoke("throw",t,i,a)})}a(c.arg)}var r;o(this,"_invoke",{value:function value(t,n){function callInvokeWithMethodAndArg(){return new e(function(e,r){invoke(t,n,e,r)})}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(e,r,n){var o=h;return function(i,a){if(o===f)throw new Error("Generator is already running");if(o===s){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=maybeInvokeDelegate(c,n);if(u){if(u===y)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=s,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=f;var p=tryCatch(e,r,n);if("normal"===p.type){if(o=n.done?s:l,p.arg===y)continue;return{value:p.arg,done:n.done}}"throw"===p.type&&(o=s,n.method="throw",n.arg=p.arg)}}}function maybeInvokeDelegate(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator["return"]&&(r.method="return",r.arg=t,maybeInvokeDelegate(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=tryCatch(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0)}function values(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function next(){for(;++o=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),y}},catch:function _catch(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(e,r,n){return this.delegate={iterator:values(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;var F=function F(){};return{s:F,n:function n(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]}},e:function e(_e39){throw _e39},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o)},n:function n(){var step=it.next();normalCompletion=step.done;return step},e:function e(_e40){didErr=true;err=_e40},f:function f(){try{if(!normalCompletion&&it["return"]!=null)it["return"]()}finally{if(didErr)throw err}}}}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i=i.left&&e<=i.left+i.width&&t>=i.top&&t<=i.top+i.height}},{key:"getNextId",value:function getNextId(e){return e+s._counter++}},{key:"removeNode",value:function removeNode(e){return null!==e.parentNode&&(e.parentNode.removeChild(e),!0)}},{key:"orderByIndexes",value:function orderByIndexes(e,t){var n=[];for(var _i=0;_i1)return;e=e.touches[0]}this.mouseUpHandler&&(this.mouseUpHandler.cancel(),delete this.mouseUpHandler),this.touchUpHandler&&(this.touchUpHandler.cancel(),delete this.touchUpHandler),this.mouseMoveHandler&&(this.mouseMoveHandler.cancel(),delete this.mouseMoveHandler),this.touchMoveHandler&&(this.touchMoveHandler.cancel(),delete this.touchMoveHandler),this.mouseUpHandler=new l(window,"mouseup",this.onMouseUp.bind(this)),this.touchUpHandler=new l(window,"touchend",this.onMouseUp.bind(this)),this.mouseMoveHandler=new l(window,"mousemove",this.onMouseMove.bind(this)),this.touchMoveHandler=new l(window,"touchmove",this.onMouseMove.bind(this)),this.dragStartPosition=new o(e.clientX,e.clientY)}}},{key:"onMouseUp",value:function onMouseUp(){this.mouseUpHandler&&(this.mouseUpHandler.cancel(),delete this.mouseUpHandler),this.touchUpHandler&&(this.touchUpHandler.cancel(),delete this.touchUpHandler),this.mouseMoveHandler&&(this.mouseMoveHandler.cancel(),delete this.mouseMoveHandler),this.touchMoveHandler&&(this.touchMoveHandler.cancel(),delete this.touchMoveHandler)}},{key:"onMouseMove",value:function onMouseMove(e){if(e.touches){if(e.touches.length>1)return;e=e.touches[0]}var t=new o(e.clientX,e.clientY).y-this.dragStartPosition.y;(t>this.thresholdPixels||t<-this.thresholdPixels)&&(this.enabled=!1,this._requestUndock(e))}},{key:"_requestUndock",value:function _requestUndock(e){var t=0,n=0,i=this.element;do{t+=i.offsetTop||0,n+=i.offsetLeft||0,i=i.offsetParent}while(i);var s=this.dragStartPosition.x-n,l=this.dragStartPosition.y-t,_a=new o(s,l);this._undockededCallback(e,_a)}}]);return a}();!function(e){e.document="document",e.panel="panel"}(t||(t={}));var h={CloseDialog:"Close dialog",CloseAll:"Close all documents",CloseAllButThis:"Close all documents but this",DefaultPanelName:"Panel",NewBrowserWindow:"Open in new window"};var r=function(){function r(){_classCallCheck(this,r)}_createClass(r,null,[{key:"configure",value:function configure(e){r._getTemplateString=e}},{key:"getString",value:function getString(e){var n,i;for(var _len=arguments.length,t=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){t[_key-1]=arguments[_key]}return function(e){for(var _len2=arguments.length,t=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){t[_key2-1]=arguments[_key2]}return e.replace(/{(\d+)}/g,function(e,n){var i=Number.parseInt(n);return t[i].toString()})}.apply(void 0,[null!==(i=null===(n=r._getTemplateString)||void 0===n?void 0:n.call(r,e))&&void 0!==i?i:h[e]].concat(t))}}]);return r}();var d=function(){function d(n,i,o,s,l){var _this=this;_classCallCheck(this,d);this.undockedToNewBrowserWindow=!1,o||(o=r.getString("DefaultPanelName")),s||(s=t.panel),this.panelType=s,n._dockSpawnPanelContainer=this,this.elementContent=n,n.style.position="absolute",n.style.width="100%",n.style.height="100%",n.style.top="0",n.style.bottom="0",this.elementContentContainer=document.createElement("div"),this.elementContentContainer.className="panel-element-content-container",this.elementContentContainer.style.position="absolute",this.elementContentContainer._panel=this,this.elementContentContainer.addEventListener("pointerdown",function(e){try{_this.isDialog?_this._floatingDialog.bringToFront():_this.tabPage&&_this.tabPage.setSelected(!0,!0),_this.dockManager.activePanel=_this}catch(e){}},{passive:!0}),this.elementContentContainer.appendChild(n),i.config.dialogRootElement.appendChild(this.elementContentContainer),this.dockManager=i,this.title=o,this.containerType=e.panel,this.icon=null,this.minimumAllowedChildNodes=0,this._floatingDialog=void 0,this.isDialog=!1,this._canUndock=i._undockEnabled,this.eventListeners=[],this._hideCloseButton=l,this._initialize()}_createClass(d,[{key:"canUndock",value:function canUndock(e){var _this2=this;this._canUndock=e,this.undockInitiator.enabled=e,this.eventListeners.forEach(function(t){t.onDockEnabled&&t.onDockEnabled({self:_this2,state:e})})}},{key:"addListener",value:function addListener(e){this.eventListeners.push(e)}},{key:"removeListener",value:function removeListener(e){this.eventListeners.splice(this.eventListeners.indexOf(e),1)}},{key:"floatingDialog",get:function get(){return this._floatingDialog},set:function set(e){this._floatingDialog=e;var t=void 0===this._floatingDialog;this.undockInitiator.enabled=t}},{key:"saveState",value:function saveState(e){e.element=this.elementContent.id,e.width=this.width,e.height=this.height,e.canUndock=this._canUndock,e.hideCloseButton=this._hideCloseButton,e.panelType=this.panelType}},{key:"loadState",value:function loadState(e){this.width=e.width,this.height=e.height,this.state={width:e.width,height:e.height},this.canUndock(e.canUndock),this.hideCloseButton(e.hideCloseButton),this.panelType=e.panelType}},{key:"setActiveChild",value:function setActiveChild(){}},{key:"containerElement",get:function get(){return this.elementPanel}},{key:"grayOut",value:function grayOut(e){var _this3=this;!e&&this._grayOut?(this.elementContentWrapper.removeChild(this._grayOut),this.elementButtonClose.style.display=this._hideCloseButton?"none":"block",this._grayOut=null,this._hideCloseButton||this.eventListeners.forEach(function(e){e.onHideCloseButton&&e.onHideCloseButton({self:_this3,state:_this3._hideCloseButton})})):e&&!this._grayOut&&(this._grayOut=document.createElement("div"),this._grayOut.className="panel-grayout",this.elementButtonClose.style.display="none",this.elementContentWrapper.appendChild(this._grayOut),this.eventListeners.forEach(function(e){e.onHideCloseButton&&e.onHideCloseButton({self:_this3,state:!0})}))}},{key:"_initialize",value:function _initialize(){var e;this.name=s.getNextId("panel_"),this.elementPanel=document.createElement("div"),this.elementPanel.tabIndex=0,this.elementTitle=document.createElement("div"),this.elementTitleText=document.createElement("div"),this.elementContentHost=document.createElement("div"),this.elementButtonClose=document.createElement("div"),this.elementPanel.appendChild(this.elementTitle),this.elementTitle.appendChild(this.elementTitleText),this.elementTitle.appendChild(this.elementButtonClose),this.elementButtonClose.classList.add("panel-titlebar-button-close"),this.elementButtonClose.style.display=this._hideCloseButton?"none":"block",this.elementPanel.appendChild(this.elementContentHost),this.elementPanel.classList.add("panel-base"),this.elementTitle.classList.add("panel-titlebar"),this.elementTitle.classList.add("disable-selection"),this.elementTitleText.classList.add("panel-titlebar-text"),this.elementContentHost.classList.add("panel-content");var t=this.elementContentContainer.clientWidth,n=this.elementContentContainer.clientHeight,i=this.elementTitle.clientHeight;this.elementContentWrapper=document.createElement("div"),this.elementContentWrapper.classList.add("panel-content-wrapper"),this._setPanelDimensions(t,n+i),this._hideCloseButton||(this.closeButtonClickedHandler=new l(this.elementButtonClose,"mousedown",this.onCloseButtonClicked.bind(this)),this.closeButtonTouchedHandler=new l(this.elementButtonClose,"touchstart",this.onCloseButtonClicked.bind(this))),s.removeNode(this.elementContentWrapper),this.elementContentHost.appendChild(this.elementContentWrapper);var o=this.elementContent.dataset.panelCaption,h=this.elementContent.dataset.panelIcon;o&&(this.title=o),h&&(this.icon=h),this._updateTitle(),this.undockInitiator=new a(this.elementTitle,this.performUndockToDialog.bind(this)),delete this.floatingDialog,this.mouseDownHandler=new l(this.elementPanel,"mousedown",this.onMouseDown.bind(this)),this.touchDownHandler=new l(this.elementPanel,"touchstart",this.onMouseDown.bind(this),{passive:!0}),this._resolvedElementContent=this.elementContent,this.elementContent instanceof HTMLSlotElement&&(this._resolvedElementContent=null===(e=this.elementContent.assignedElements())||void 0===e?void 0:e[0])}},{key:"onMouseDown",value:function onMouseDown(){this.dockManager.activePanel=this}},{key:"hideCloseButton",value:function hideCloseButton(e){var _this4=this;this._hideCloseButton=e,this.elementButtonClose.style.display=e?"none":"block",this.eventListeners.forEach(function(t){t.onHideCloseButton&&t.onHideCloseButton({self:_this4,state:e})})}},{key:"destroy",value:function destroy(){this.mouseDownHandler&&(this.mouseDownHandler.cancel(),delete this.mouseDownHandler),this.touchDownHandler&&(this.touchDownHandler.cancel(),delete this.touchDownHandler),s.removeNode(this.elementPanel),this.closeButtonClickedHandler&&(this.closeButtonClickedHandler.cancel(),delete this.closeButtonClickedHandler),this.closeButtonTouchedHandler&&(this.closeButtonTouchedHandler.cancel(),delete this.closeButtonTouchedHandler)}},{key:"performUndockToDialog",value:function performUndockToDialog(e,t){return this.isDialog=!0,this.undockInitiator.enabled=!1,this.elementContentWrapper.style.display="block",this.elementPanel.style.position="",this.dockManager.requestUndockToDialog(this,e,t)}},{key:"performClose",value:function performClose(){this.isDialog=!0,this.undockInitiator.enabled=!1,this.elementContentWrapper.style.display="block",this.elementContentContainer.style.display="none",this.elementPanel.style.position="",this.dockManager.requestClose(this)}},{key:"performUndock",value:function performUndock(){this.undockInitiator.enabled=!1,this.dockManager.requestUndock(this)}},{key:"prepareForDocking",value:function prepareForDocking(){this.isDialog=!1,this.undockInitiator.enabled=this._canUndock,this.elementContentContainer.parentElement!=this.dockManager.config.dialogRootElement&&this.dockManager.config.dialogRootElement.appendChild(this.elementContentContainer)}},{key:"width",get:function get(){return this._cachedWidth},set:function set(e){e!==this._cachedWidth&&(this._cachedWidth=e,this.elementPanel.style.width=e+"px")}},{key:"height",get:function get(){return this._cachedHeight},set:function set(e){e!==this._cachedHeight&&(this._cachedHeight=e,this.elementPanel.style.height=e+"px")}},{key:"resolvedElementContent",get:function get(){var e;return this._resolvedElementContent||(this._resolvedElementContent=this.elementContent,this.elementContent instanceof HTMLSlotElement&&(this._resolvedElementContent=null===(e=this.elementContent.assignedElements())||void 0===e?void 0:e[0])),this._resolvedElementContent}},{key:"panelDocked",value:function panelDocked(){this.elementContent.hidden&&(this.elementContent.hidden=!1),this.elementContentContainer.parentElement!==this.dockManager.config.dialogRootElement&&this.dockManager.config.dialogRootElement.appendChild(this.elementContentContainer)}},{key:"resize",value:function resize(e,t){this.panelDocked(),this.setVisible(!0),this._setPanelDimensions(e,t),this._cachedWidth=e,this._cachedHeight=t;try{null!=this.elementContent&&"function"==typeof this.elementContent.resizeHandler&&this.elementContent.resizeHandler(e,t-this.elementTitle.clientHeight)}catch(e){console.log("error calling resizeHandler:",e," elt:",this.elementContent)}}},{key:"_setPanelDimensions",value:function _setPanelDimensions(e,t){this.elementTitle.style.width=e+"px",this.elementContentHost.style.width=e+"px",this.elementContentContainer.style.width=e+"px",this.elementPanel.style.width=e+"px";var n=t-this.elementTitle.clientHeight;this.elementContentHost.style.height=n+"px",this.elementContentContainer.style.height=n+"px",this.elementPanel.style.height=t+"px";var i=this.elementContentWrapper.getBoundingClientRect(),o=this.dockManager.config.dialogRootElement.getBoundingClientRect();this.elementContentContainer.style.left=i.x-o.x+"px",this.elementContentContainer.style.top=i.y-o.y+"px",this.elementContentContainer.style.width=i.width+"px",this.elementContentContainer.style.height=i.height+"px"}},{key:"setDialogPosition",value:function setDialogPosition(e,t){this.elementContentContainer.style.left=e+"px",this.elementContentContainer.style.top=t+this.elementTitle.clientHeight+"px"}},{key:"setVisible",value:function setVisible(e){this.elementContentContainer.style.display=e?"block":"none"}},{key:"setTitle",value:function setTitle(e){this.title=e,this._updateTitle(),this.onTitleChanged&&this.onTitleChanged(this,e)}},{key:"setTitleIcon",value:function setTitleIcon(e){this.icon=e,this._updateTitle(),this.onTitleChanged&&this.onTitleChanged(this,this.title)}},{key:"setHasChanges",value:function setHasChanges(e){this.hasChanges=e,this._updateTitle(),e?this.elementTitleText.classList.add("panel-has-changes"):this.elementTitleText.classList.remove("panel-has-changes"),this.onTitleChanged&&this.onTitleChanged(this,this.title)}},{key:"setCloseIconTemplate",value:function setCloseIconTemplate(e){this.elementButtonClose.innerHTML=e}},{key:"_updateTitle",value:function _updateTitle(){null===this.icon?this.elementTitleText.innerHTML=this.title:this.elementTitleText.innerHTML=''+this.title+""}},{key:"getRawTitle",value:function getRawTitle(){return this.elementTitleText.innerHTML}},{key:"performLayout",value:function performLayout(e,t){}},{key:"onCloseButtonClicked",value:function onCloseButtonClicked(e){e.preventDefault(),e.stopPropagation(),this.close()}},{key:"undockToBrowserDialog",value:function undockToBrowserDialog(){var _this5=this;!function(e,t){var n=e.getBoundingClientRect(),i=n.x+24,o=n.y+60,s=n.width,l=n.height,a=window.open("about:blank",void 0,"popup=yes,left=".concat(i,",top=").concat(o,",width=").concat(s,",height=").concat(l));a.onfocus=function(e){return t.focused(e)},a.onblur=function(e){return t.blured(e)};var h=_toConsumableArray(document.head.querySelectorAll("link")).map(function(e){return e.cloneNode()});var _iterator=_createForOfIteratorHelper(h),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var _e=_step.value;a.document.head.appendChild(a.document.adoptNode(_e))}}catch(err){_iterator.e(err)}finally{_iterator.f()}var r=a.document.createElement("style");r.innerText="\n html {\n overflow: hidden;\n position: fixed;\n width: 100%;\n height: 100%;\n }\n body {\n height: 100%;\n width: 100%;\n margin: 0;\n }\n ",a.document.head.appendChild(r);var d=a.document.createElement("title");d.innerText=t.title,a.document.head.appendChild(d),a.onunload=function(){return t.newWindowClosedCallback()};var c=new Map,u=new Map;function m(e){if(e.shadowRoot){e.shadowRoot.adoptedStyleSheets.length>0&&u.set(e,_toConsumableArray(e.shadowRoot.adoptedStyleSheets.map(function(e){return function(e,t,n){var i=n.get(t);if(i)return i;var o="";var s=t.cssRules;for(var l=0;l3&&arguments[3]!==undefined?arguments[3]:!1;_classCallCheck(this,m);this.dialog=e,this.disableResize=i,this.delegate=t,this.containerElement=t.containerElement,this.dockManager=t.dockManager,this.topLevelElement=n,this.containerType=t.containerType,this.topLevelElement.style.left=this.topLevelElement.offsetLeft+"px",this.topLevelElement.style.top=this.topLevelElement.offsetTop+"px",this.minimumAllowedChildNodes=t.minimumAllowedChildNodes,this._buildResizeHandles(),this.readyToProcessNextResize=!0,this.dockSpawnResizedEvent=new CustomEvent("DockSpawnResizedEvent",{composed:!0,bubbles:!0}),this.iframeEventHandlers=[]}_createClass(m,[{key:"setActiveChild",value:function setActiveChild(){}},{key:"_buildResizeHandles",value:function _buildResizeHandles(){this.resizeHandles=[],this.disableResize||(this._buildResizeHandle(!1,!0,!0,!1),this._buildResizeHandle(!0,!1,!1,!0),this._buildResizeHandle(!1,!0,!1,!0),this._buildResizeHandle(!0,!1,!1,!1),this._buildResizeHandle(!1,!0,!1,!1),this._buildResizeHandle(!1,!1,!0,!1),this._buildResizeHandle(!1,!1,!1,!0))}},{key:"_buildResizeHandle",value:function _buildResizeHandle(e,t,n,i){var _this7=this;var o=new u;o.east=e,o.west=t,o.north=n,o.south=i,o.element=document.createElement("div"),this.topLevelElement.appendChild(o.element);var s="",a="";n&&(s="n"),i&&(s="s"),e&&(a="e"),t&&(a="w");var h="resize-handle-"+s+a;s.length>0&&a.length>0&&(o.corner=!0),o.element.classList.add(o.corner?"resize-handle-corner":"resize-handle"),o.element.classList.add(h),this.resizeHandles.push(o),o.mouseDownHandler=new l(o.element,"mousedown",function(e){_this7.onMouseDown(o,e)}),o.touchDownHandler=new l(o.element,"touchstart",function(e){_this7.onMouseDown(o,e)})}},{key:"saveState",value:function saveState(e){this.delegate.saveState(e)}},{key:"loadState",value:function loadState(e){this.delegate.loadState(e)}},{key:"width",get:function get(){return this.delegate.width}},{key:"height",get:function get(){return this.delegate.height}},{key:"name",get:function get(){return this.delegate.name},set:function set(e){e&&(this.delegate.name=e)}},{key:"resize",value:function resize(e,t){this.delegate.resize(e,t),this._adjustResizeHandles(e,t),document.dispatchEvent(this.dockSpawnResizedEvent)}},{key:"_adjustResizeHandles",value:function _adjustResizeHandles(e,t){this.resizeHandles.forEach(function(n){n.adjustSize(e,t)})}},{key:"performLayout",value:function performLayout(e){this.delegate.performLayout(e,!1)}},{key:"destroy",value:function destroy(){this.removeDecorator(),this.delegate.destroy()}},{key:"removeDecorator",value:function removeDecorator(){}},{key:"onMouseMovedIframe",value:function onMouseMovedIframe(e,t,n){var i=n.getBoundingClientRect();this.onMouseMoved(e,t,{x:i.x,y:i.y})}},{key:"onMouseMoved",value:function onMouseMoved(e,t,n){var i=null;if(t.changedTouches){if(t.changedTouches.length>1)return;i=t.changedTouches[0]}else i=t;if(!this.readyToProcessNextResize)return;this.readyToProcessNextResize=!1,this.dialog.panel&&this.dockManager.suspendLayout(this.dialog.panel);var s=new o(i.clientX,i.clientY);n&&(s=new o(i.clientX+n.x,i.clientY+n.y));var l=this.dockManager.checkXBounds(this.topLevelElement,s,this.previousMousePosition,e.west,e.east),a=this.dockManager.checkYBounds(this.topLevelElement,s,this.previousMousePosition,e.north,e.south);this._performDrag(e,l,a),this.previousMousePosition=s,this.readyToProcessNextResize=!0,this.dialog.panel&&this.dockManager.resumeLayout(this.dialog.panel),this.dockManager.notifyOnContainerResized(this)}},{key:"onMouseDown",value:function onMouseDown(e,t){var _this8=this;var n=null;if(t.touches){if(t.touches.length>1)return;n=t.touches[0]}else n=t;this.previousMousePosition=new o(n.clientX,n.clientY),e.mouseMoveHandler&&(e.mouseMoveHandler.cancel(),delete e.mouseMoveHandler),e.touchMoveHandler&&(e.touchMoveHandler.cancel(),delete e.touchMoveHandler),e.mouseUpHandler&&(e.mouseUpHandler.cancel(),delete e.mouseUpHandler),e.touchUpHandler&&(e.touchUpHandler.cancel(),delete e.touchUpHandler);var _iterator7=_createForOfIteratorHelper(this.iframeEventHandlers),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var _e4=_step7.value;_e4.cancel()}}catch(err){_iterator7.e(err)}finally{_iterator7.f()}if(this.iframeEventHandlers=[],e.mouseMoveHandler=new l(window,"mousemove",function(t){_this8.onMouseMoved(e,t)}),e.touchMoveHandler=new l(window,"touchmove",function(t){_this8.onMouseMoved(e,t)}),e.mouseUpHandler=new l(window,"mouseup",function(t){_this8.onMouseUp(e)}),e.touchUpHandler=new l(window,"touchend",function(t){_this8.onMouseUp(e)}),this.dockManager.iframes){var _iterator8=_createForOfIteratorHelper(this.dockManager.iframes),_step8;try{var _loop2=function _loop2(){var t=_step8.value;var n=_this8.onMouseMovedIframe.bind(_this8);_this8.iframeEventHandlers.push(new l(t.contentWindow,"mousemove",function(i){return n(e,i,t)})),_this8.iframeEventHandlers.push(new l(t.contentWindow,"mouseup",function(t){return _this8.onMouseUp(e)})),_this8.iframeEventHandlers.push(new l(t.contentWindow,"touchmove",function(i){return n(e,i,t)})),_this8.iframeEventHandlers.push(new l(t.contentWindow,"touchend",function(t){return _this8.onMouseUp(e)}))};for(_iterator8.s();!(_step8=_iterator8.n()).done;){_loop2()}}catch(err){_iterator8.e(err)}finally{_iterator8.f()}}s.disableGlobalTextSelection(this.dockManager.config.dialogRootElement)}},{key:"onMouseUp",value:function onMouseUp(e){e.mouseMoveHandler.cancel(),e.touchMoveHandler.cancel(),e.mouseUpHandler.cancel(),e.touchUpHandler.cancel(),delete e.mouseMoveHandler,delete e.touchMoveHandler,delete e.mouseUpHandler,delete e.touchUpHandler;var _iterator9=_createForOfIteratorHelper(this.iframeEventHandlers),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var _e5=_step9.value;_e5.cancel()}}catch(err){_iterator9.e(err)}finally{_iterator9.f()}this.iframeEventHandlers=[],s.enableGlobalTextSelection(this.dockManager.config.dialogRootElement)}},{key:"_performDrag",value:function _performDrag(e,t,n){var i={};i.left=s.getPixels(this.topLevelElement.style.left),i.top=s.getPixels(this.topLevelElement.style.top),i.width=this.topLevelElement.clientWidth,i.height=this.topLevelElement.clientHeight,e.east&&this._resizeEast(t,i),e.west&&this._resizeWest(t,i),e.north&&this._resizeNorth(n,i),e.south&&this._resizeSouth(n,i)}},{key:"_resizeWest",value:function _resizeWest(e,t){this._resizeContainer(e,0,-e,0,t)}},{key:"_resizeEast",value:function _resizeEast(e,t){this._resizeContainer(0,0,e,0,t)}},{key:"_resizeNorth",value:function _resizeNorth(e,t){this._resizeContainer(0,e,0,-e,t)}},{key:"_resizeSouth",value:function _resizeSouth(e,t){this._resizeContainer(0,0,0,e,t)}},{key:"_resizeContainer",value:function _resizeContainer(e,t,n,i,o){o.left+=e,o.top+=t,o.width+=n,o.height+=i,o.width=Math.max(o.width,50),o.height=Math.max(o.height,50),this.topLevelElement.style.left=o.left+"px",this.topLevelElement.style.top=o.top+"px",this.resize(o.width,o.height)}}]);return m}();var p=function(){function p(e,t,n,i){_classCallCheck(this,p);this.panel=e,this.dockManager=t,this.eventListener=t,this.grayoutParent=n,this.disableResize=i,this._initialize(),this.dockManager.context.model.dialogs.push(this),this.position=t.defaultDialogPosition,this.dockManager.notifyOnCreateDialog(this),e.isDialog=!0}_createClass(p,[{key:"saveState",value:function saveState(e,t){this.position=new o(e,t),this.dockManager.notifyOnChangeDialogPosition(this,e,t)}},{key:"_initialize",value:function _initialize(){this.panel.floatingDialog=this,this.elementDialog=Object.assign(document.createElement("div"),{floatingDialog:this}),this.elementDialog.tabIndex=0,this.elementDialog.appendChild(this.panel.elementPanel),this.draggable=new c(this,this.panel,this.elementDialog,this.panel.elementTitle),this.resizable=new m(this,this.draggable,this.draggable.topLevelElement,this.disableResize),this.dockManager.config.dialogRootElement.appendChild(this.elementDialog),this.elementDialog.classList.add("dialog-floating"),this.focusHandler=new l(this.elementDialog,"focus",this.onFocus.bind(this),!0),this.mouseDownHandler=new l(this.elementDialog,"pointerdown",this.onMouseDown.bind(this),!0),this.keyPressHandler=new l(this.elementDialog,"keypress",this.dockManager.onKeyPressBound,!0),this.contextmenuHandler=new l(this.panel.elementTitle,"contextmenu",this.oncontextMenuClicked.bind(this)),this.resize(this.panel.elementPanel.clientWidth,this.panel.elementPanel.clientHeight),this.isHidden=!1,null!=this.grayoutParent&&this.grayoutParent.grayOut(!0),this.bringToFront()}},{key:"setPosition",value:function setPosition(e,t){var n=this.dockManager.config.dialogRootElement.getBoundingClientRect();this.position=new o(e-n.left,t-n.top),this.elementDialog.style.left=e-n.left+"px",this.elementDialog.style.top=t-n.top+"px",this.panel.setDialogPosition(e,t),this.dockManager.notifyOnChangeDialogPosition(this,e,t)}},{key:"getPosition",value:function getPosition(){return new o(this.position?this.position.x:0,this.position?this.position.y:0)}},{key:"onFocus",value:function onFocus(){this.dockManager.activePanel!=this.panel&&(this.dockManager.activePanel=this.panel)}},{key:"onMouseDown",value:function onMouseDown(e){2!=e.button&&this.bringToFront()}},{key:"destroy",value:function destroy(){this.panel.lastDialogSize={width:this.resizable.width,height:this.resizable.height},this.focusHandler&&(this.focusHandler.cancel(),delete this.focusHandler),this.mouseDownHandler&&(this.mouseDownHandler.cancel(),delete this.mouseDownHandler),this.keyPressHandler&&(this.keyPressHandler.cancel(),delete this.keyPressHandler),this.contextmenuHandler&&(this.contextmenuHandler.cancel(),delete this.contextmenuHandler),s.removeNode(this.elementDialog),this.draggable.removeDecorator(),s.removeNode(this.panel.elementPanel),s.arrayRemove(this.dockManager.context.model.dialogs,this),delete this.panel.floatingDialog,this.grayoutParent&&this.grayoutParent.grayOut(!1)}},{key:"resize",value:function resize(e,t){this.resizable.resize(e,t)}},{key:"setTitle",value:function setTitle(e){this.panel.setTitle(e)}},{key:"setTitleIcon",value:function setTitleIcon(e){this.panel.setTitleIcon(e)}},{key:"bringToFront",value:function bringToFront(){this.panel.elementContentContainer.style.zIndex=this.dockManager.zIndexDialogCounter++,this.elementDialog.style.zIndex=this.dockManager.zIndexDialogCounter++,this.dockManager.activePanel=this.panel}},{key:"hide",value:function hide(){this.elementDialog.style.zIndex="0",this.panel.elementContentContainer.style.zIndex="",this.elementDialog.style.display="none",this.isHidden||(this.isHidden=!0,this.dockManager.notifyOnHideDialog(this)),this.grayoutParent&&this.grayoutParent.grayOut(!1)}},{key:"close",value:function close(){this.hide(),this.remove(),this.dockManager.notifyOnClosePanel(this.panel),this.destroy()}},{key:"remove",value:function remove(){this.elementDialog.parentNode.removeChild(this.elementDialog)}},{key:"show",value:function show(){this.panel.elementContentContainer.style.zIndex=this.dockManager.zIndexDialogCounter++,this.elementDialog.style.zIndex=this.dockManager.zIndexDialogCounter++,this.elementDialog.style.display="block",this.isHidden&&(this.isHidden=!1,this.dockManager.notifyOnShowDialog(this))}},{key:"oncontextMenuClicked",value:function oncontextMenuClicked(e){e.preventDefault(),!this._ctxMenu&&p.createContextMenuContentCallback?(this._ctxMenu=document.createElement("div"),this._ctxMenu.className="dockspab-tab-handle-context-menu",!1!==p.createContextMenuContentCallback(this,this._ctxMenu,this.dockManager.context.model.documentManagerNode.children)?(this._ctxMenu.style.left=e.pageX+"px",this._ctxMenu.style.top=e.pageY+"px",document.body.appendChild(this._ctxMenu),this._windowsContextMenuCloseBound=this.windowsContextMenuClose.bind(this),window.addEventListener("pointerup",this._windowsContextMenuCloseBound)):this._ctxMenu=null):this.closeContextMenu()}},{key:"closeContextMenu",value:function closeContextMenu(){this._ctxMenu&&(document.body.removeChild(this._ctxMenu),delete this._ctxMenu,window.removeEventListener("pointerup",this._windowsContextMenuCloseBound))}},{key:"windowsContextMenuClose",value:function windowsContextMenuClose(e){var t=e.composedPath();for(var _e6 in t)if(t[_e6]==this._ctxMenu)return;this.closeContextMenu()}}],[{key:"fromElement",value:function fromElement(e,t){return new p(new d(document.getElementById(e),t),t,null)}}]);return p}();p.createContextMenuContentCallback=function(e,t,n){if(e.panel._hideCloseButton)return!1;{var _n2=document.createElement("div");_n2.innerText=r.getString("CloseDialog"),t.append(_n2),_n2.onclick=function(){e.panel.close(),e.closeContextMenu()};var i=document.createElement("div");return i.innerText=r.getString("NewBrowserWindow"),t.append(i),i.onclick=function(){e.panel.undockToBrowserDialog(),e.closeContextMenu()},!0}};var g=_createClass(function g(){_classCallCheck(this,g);this.escClosesWindow=!0,this.escClosesDialog=!0,this.dialogRootElement=document.body,this.moveOnlyWithinDockConatiner=!1});var v=function(){function v(){_classCallCheck(this,v)}_createClass(v,[{key:"serialize",value:function serialize(e){var t=this._buildGraphInfo(e.rootNode),n=this._buildDialogsInfo(e.dialogs.sort(function(e,t){return e.elementDialog.style.zIndex-t.elementDialog.style.zIndex}));return JSON.stringify({graphInfo:t,dialogsInfo:n})}},{key:"_buildGraphInfo",value:function _buildGraphInfo(e){var _this9=this;var t={};e.container.saveState(t);var n=[];return e.children.forEach(function(e){n.push(_this9._buildGraphInfo(e))}),{containerType:e.container.containerType,state:t,children:n}}},{key:"_buildDialogsInfo",value:function _buildDialogsInfo(e){var t=[];return e.forEach(function(e){var n={},i=e.panel;i.saveState(n);var o={containerType:i.containerType,state:n,position:e.getPosition(),isHidden:e.isHidden};t.push(o)}),t}}]);return v}();var f=function(){function f(e){_classCallCheck(this,f);this.container=e,this.children=[]}_createClass(f,[{key:"detachFromParent",value:function detachFromParent(){this.parent&&(this.parent.removeChild(this),delete this.parent)}},{key:"removeChild",value:function removeChild(e){var t=this.children.indexOf(e);t>=0&&this.children.splice(t,1)}},{key:"addChild",value:function addChild(e){e.detachFromParent(),e.parent=this,this.children.push(e)}},{key:"addChildBefore",value:function addChildBefore(e,t){this._addChildWithDirection(e,t,!0)}},{key:"addChildAfter",value:function addChildAfter(e,t){this._addChildWithDirection(e,t,!1)}},{key:"_addChildWithDirection",value:function _addChildWithDirection(e,t,n){t.detachFromParent(),t.parent=this;var i=this.children.indexOf(e),o=this.children.slice(0,i),s=this.children.slice(i+1,this.children.length);this.children=o.slice(0),n?(this.children.push(t),this.children.push(e)):(this.children.push(e),this.children.push(t)),Array.prototype.push.apply(this.children,s)}},{key:"performLayout",value:function performLayout(e){var t=this.children.map(function(e){return e.container});this.container.performLayout(t,e)}},{key:"debugDumpTree",value:function debugDumpTree(e){void 0===e&&(e=0);var t=this.container.name;for(var _n3=0;_n3>"+t+" ["+n+"]"),this.children.forEach(function(t){t.debugDumpTree(e+1)})}}]);return f}();var C=function(){function C(e,t,n){_classCallCheck(this,C);this.previousContainer=e,this.nextContainer=t,this.stackedVertical=n,this.barElement=document.createElement("div"),this.barElement.classList.add(n?"splitbar-horizontal":"splitbar-vertical"),this.pointerDownHandler=new l(this.barElement,"pointerdown",this.onPointerDown.bind(this)),this.minPanelSize=50,this.readyToProcessNextDrag=!0,this.dockSpawnResizedEvent=new CustomEvent("DockSpawnResizedEvent",{composed:!0,bubbles:!0}),this.iframeEventHandlers=[]}_createClass(C,[{key:"onPointerDown",value:function onPointerDown(e){this.barElement.setPointerCapture(e.pointerId),this._startDragging(e)}},{key:"onPointerUp",value:function onPointerUp(e){this.barElement.releasePointerCapture(e.pointerId),this._stopDragging()}},{key:"onPointerMovedIframe",value:function onPointerMovedIframe(e,t){null!=e.changedTouches&&(e=e.changedTouches[0]);var n=t.getBoundingClientRect();this.handleMoveEvent({x:parseInt(""+e.clientX+n.x),y:parseInt(""+e.clientY+n.y)})}},{key:"onPointerMoved",value:function onPointerMoved(e){null!=e.changedTouches&&(e=e.changedTouches[0]),this.handleMoveEvent({x:parseInt(""+e.clientX),y:parseInt(""+e.clientY)})}},{key:"handleMoveEvent",value:function handleMoveEvent(e){if(!this.readyToProcessNextDrag)return;this.readyToProcessNextDrag=!1;var t=this.previousContainer.dockManager;t.suspendLayout(this.previousContainer),t.suspendLayout(this.nextContainer);var n=e.x-this.previousMouseEvent.x,i=e.y-this.previousMouseEvent.y;this._performDrag(n,i),this.previousMouseEvent=e,this.readyToProcessNextDrag=!0,t.resumeLayout(this.previousContainer),t.resumeLayout(this.nextContainer)}},{key:"_performDrag",value:function _performDrag(e,t){var n=this.previousContainer.containerElement.clientWidth,i=this.previousContainer.containerElement.clientHeight,o=this.nextContainer.containerElement.clientWidth,s=this.nextContainer.containerElement.clientHeight,l=this.stackedVertical?i:n,a=this.stackedVertical?s:o,h=this.stackedVertical?t:e,r=l+h,d=a-h;(!(rl||da)&&(this.stackedVertical?(this.previousContainer.resize(n,r),this.nextContainer.resize(o,d)):h<0?(this.previousContainer.resize(r,i),this.nextContainer.resize(d,s)):(this.nextContainer.resize(d,s),this.previousContainer.resize(r,i),this.nextContainer.resize(d,s)),document.dispatchEvent(this.dockSpawnResizedEvent))}},{key:"_startDragging",value:function _startDragging(e){var _this10=this;if(s.disableGlobalTextSelection(this.previousContainer.dockManager.config.dialogRootElement),this.pointerMovedHandler&&(this.pointerMovedHandler.cancel(),delete this.pointerMovedHandler),this.pointerUpHandler&&(this.pointerUpHandler.cancel(),delete this.pointerUpHandler),this.pointerMovedHandler=new l(window,"pointermove",this.onPointerMoved.bind(this)),this.pointerUpHandler=new l(window,"pointerup",this.onPointerUp.bind(this)),this.previousContainer.dockManager.iframes){var _iterator10=_createForOfIteratorHelper(this.previousContainer.dockManager.iframes),_step10;try{var _loop3=function _loop3(){var e=_step10.value;var t=_this10.onPointerMovedIframe.bind(_this10);_this10.iframeEventHandlers.push(new l(e.contentWindow,"pointermove",function(n){return t(n,e)})),_this10.iframeEventHandlers.push(new l(e.contentWindow,"pointerup",_this10.onPointerUp.bind(_this10)))};for(_iterator10.s();!(_step10=_iterator10.n()).done;){_loop3()}}catch(err){_iterator10.e(err)}finally{_iterator10.f()}}this.previousMouseEvent={x:e.clientX,y:e.clientY}}},{key:"_stopDragging",value:function _stopDragging(){s.enableGlobalTextSelection(this.previousContainer.dockManager.config.dialogRootElement),this.pointerMovedHandler&&(this.pointerMovedHandler.cancel(),delete this.pointerMovedHandler),this.pointerUpHandler&&(this.pointerUpHandler.cancel(),delete this.pointerUpHandler);var _iterator11=_createForOfIteratorHelper(this.iframeEventHandlers),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var _e7=_step11.value;_e7.cancel()}}catch(err){_iterator11.e(err)}finally{_iterator11.f()}this.iframeEventHandlers=[]}}]);return C}();var w=function(){function w(e,t){_classCallCheck(this,w);this.childContainers=e,this.stackedVertical=t,this.panelElement=document.createElement("div"),this.spiltterBars=[],this._buildSplitterDOMAndAddElements()}_createClass(w,[{key:"_buildSplitterDOMAndAddElements",value:function _buildSplitterDOMAndAddElements(){if(this.childContainers.length<=1)throw new Error("Splitter panel should contain atleast 2 panels");this.spiltterBars=[];var e=null;for(var _t4=0;_t40?this.panelElement.insertBefore(e.containerElement,this.panelElement.children[0]):this.panelElement.appendChild(e.containerElement)),e.containerElement.classList.add(this.stackedVertical?"splitter-container-vertical":"splitter-container-horizontal")):console.error("container is undefined")}},{key:"setContainerRatio",value:function setContainerRatio(e,t){var n=this.stackedVertical?this.panelElement.clientHeight:this.panelElement.clientWidth,i=n*t,o=(n-i-(this.stackedVertical?this.spiltterBars[0].barElement.clientHeight:this.spiltterBars[0].barElement.clientWidth)*this.spiltterBars.length)/n;for(var _t5=0;_t51?Math.floor(_t7*a):Math.ceil(_t7*a);h+=_i4,n===this.childContainers.length-1&&(_i4+=l-h),this.stackedVertical?_e9.resize(_e9.width,_i4):_e9.resize(_i4,_e9.height)}}}]);return w}();var y=function(){function y(e,t,n,i){_classCallCheck(this,y);0!==arguments.length&&(this.name=e,this.dockManager=t,this.stackedVertical=i,this.splitterPanel=new w(n,this.stackedVertical),this.containerElement=this.splitterPanel.panelElement,this.minimumAllowedChildNodes=2)}_createClass(y,[{key:"resize",value:function resize(e,t){this.splitterPanel.resize(e,t),this._cachedWidth=e,this._cachedHeight=t}},{key:"performLayout",value:function performLayout(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;this.splitterPanel.performLayout(e,t)}},{key:"setActiveChild",value:function setActiveChild(){}},{key:"destroy",value:function destroy(){this.splitterPanel.destroy()}},{key:"setContainerRatio",value:function setContainerRatio(e,t){this.splitterPanel.setContainerRatio(e,t),this.resize(this.width,this.height)}},{key:"getRatios",value:function getRatios(){return this.splitterPanel.getRatios()}},{key:"setRatios",value:function setRatios(e){this.splitterPanel.setRatios(e),this.resize(this.width,this.height)}},{key:"saveState",value:function saveState(e){e.width=this.width,e.height=this.height}},{key:"loadState",value:function loadState(e){this.state={width:e.width,height:e.height}}},{key:"width",get:function get(){return void 0===this._cachedWidth&&(this._cachedWidth=this.splitterPanel.panelElement.clientWidth),this._cachedWidth}},{key:"height",get:function get(){return void 0===this._cachedHeight&&(this._cachedHeight=this.splitterPanel.panelElement.clientHeight),this._cachedHeight}}]);return y}();var k=function(_y){_inherits(k,_y);function k(t,n){var _this12;_classCallCheck(this,k);_this12=_callSuper(this,k,[s.getNextId("horizontal_splitter_"),t,n,!1]),_this12.containerType=e.horizontal;return _this12}return _createClass(k)}(y);var M=function(_y2){_inherits(M,_y2);function M(t,n){var _this13;_classCallCheck(this,M);_this13=_callSuper(this,M,[s.getNextId("vertical_splitter_"),t,n,!0]),_this13.containerType=e.vertical;return _this13}return _createClass(M)}(y);var b=function(){function b(e){var _this14=this;_classCallCheck(this,b);this.parent=e;var n=this._performUndock.bind(this);this.elementBase=document.createElement("div"),this.elementText=document.createElement("div"),this.elementCloseButton=document.createElement("div"),this.elementBase.classList.add("dockspan-tab-handle"),this.elementBase.classList.add("disable-selection"),this.elementText.classList.add("dockspan-tab-handle-text"),this.elementCloseButton.classList.add("dockspan-tab-handle-close-button"),this.elementBase.appendChild(this.elementText),this.parent.host.displayCloseButton&&this.elementBase.appendChild(this.elementCloseButton),(this.parent.container._hideCloseButton||this.parent.container._grayOut)&&(this.elementCloseButton.style.display="none"),this.parent.host.tabListElement.appendChild(this.elementBase);var i=e.container,o=i.getRawTitle();this.undockListener={onDockEnabled:function onDockEnabled(e){_this14.undockEnabled(e.state)},onHideCloseButton:function onHideCloseButton(e){_this14.hideCloseButton(e.state)}},this.eventListeners=[],i.addListener(this.undockListener),this.elementText.innerHTML=o,this.elementText.title=this.elementText.innerText,this.undockInitiator=new a(this.elementBase,n),this.undockInitiator.enabled=!0,this.mouseDownHandler=new l(this.elementBase,"mousedown",this.onMouseDown.bind(this)),this.touchDownHandler=new l(this.elementBase,"touchstart",this.onMouseDown.bind(this),{passive:!1}),this.closeButtonHandler=new l(this.elementCloseButton,"click",this.onCloseButtonClicked.bind(this)),this.closeButtonTouchHandler=new l(this.elementCloseButton,"touchstart",this.onCloseButtonClicked.bind(this)),this.auxClickHandler=new l(this.elementBase,"auxclick",this.onCloseButtonClicked.bind(this)),i.panelType==t.document&&(this.contextMenuHandler=new l(this.elementBase,"contextmenu",this.oncontextMenuClicked.bind(this)))}_createClass(b,[{key:"addListener",value:function addListener(e){this.eventListeners.push(e)}},{key:"removeListener",value:function removeListener(e){this.eventListeners.splice(this.eventListeners.indexOf(e),1)}},{key:"undockEnabled",value:function undockEnabled(e){this.undockInitiator.enabled=e}},{key:"oncontextMenuClicked",value:function oncontextMenuClicked(e){e.preventDefault(),!this._ctxMenu&&b.createContextMenuContentCallback?(this._ctxMenu=document.createElement("div"),this._ctxMenu.className="dockspab-tab-handle-context-menu",b.createContextMenuContentCallback(this,this._ctxMenu,this.parent.container.dockManager.context.model.documentManagerNode.children),this._ctxMenu.style.left=e.pageX+"px",this._ctxMenu.style.top=e.pageY+"px",document.body.appendChild(this._ctxMenu),this._windowsContextMenuCloseBound=this.windowsContextMenuClose.bind(this),window.addEventListener("mouseup",this._windowsContextMenuCloseBound)):this.closeContextMenu()}},{key:"closeContextMenu",value:function closeContextMenu(){this._ctxMenu&&(document.body.removeChild(this._ctxMenu),delete this._ctxMenu,window.removeEventListener("mouseup",this._windowsContextMenuCloseBound))}},{key:"windowsContextMenuClose",value:function windowsContextMenuClose(e){var t=e.composedPath();for(var _e10 in t)if(t[_e10]==this._ctxMenu)return;this.closeContextMenu()}},{key:"onMouseDown",value:function onMouseDown(e){e.preventDefault(),this.parent.onSelected(),this.mouseMoveHandler&&(this.mouseMoveHandler.cancel(),delete this.mouseMoveHandler),this.touchMoveHandler&&(this.touchMoveHandler.cancel(),delete this.touchMoveHandler),this.mouseUpHandler&&(this.mouseUpHandler.cancel(),delete this.mouseUpHandler),this.touchUpHandler&&(this.touchUpHandler.cancel(),delete this.touchUpHandler),this.stargDragPosition=e.clientX,this.mouseMoveHandler=new l(window,"mousemove",this.onMouseMove.bind(this)),this.touchMoveHandler=new l(window,"touchmove",this.onMouseMove.bind(this),{passive:!1}),this.mouseUpHandler=new l(window,"mouseup",this.onMouseUp.bind(this)),this.touchUpHandler=new l(window,"touchend",this.onMouseUp.bind(this))}},{key:"onMouseUp",value:function onMouseUp(e){this.elementBase&&this.elementBase.classList.remove("dockspan-tab-handle-dragged"),this.dragged=!1,this.mouseMoveHandler&&this.mouseMoveHandler.cancel(),this.touchMoveHandler&&this.touchMoveHandler.cancel(),this.mouseUpHandler&&this.mouseUpHandler.cancel(),this.touchUpHandler&&this.touchUpHandler.cancel(),delete this.mouseMoveHandler,delete this.touchMoveHandler,delete this.mouseUpHandler,delete this.touchUpHandler}},{key:"moveTabEvent",value:function moveTabEvent(e,t){e.eventListeners.forEach(function(n){n.onMoveTab&&n.onMoveTab({self:e,state:t})})}},{key:"onMouseMove",value:function onMouseMove(e){if(e.preventDefault(),!(Math.abs(this.stargDragPosition-e.clientX)<10)&&null!=this.elementBase){this.elementBase.classList.add("dockspan-tab-handle-dragged"),this.dragged=!0,this.prev=this.current,this.current=e.clientX,this.direction=this.current-this.prev;var _t8=this.elementBase.getBoundingClientRect(),n=this.direction<0?{state:"left",bound:_t8.left,rect:_t8}:{state:"right",bound:_t8.right,rect:_t8};(e.clientX<_t8.left&&this.direction<0||e.clientX>_t8.left+_t8.width&&this.direction>0)&&this.moveTabEvent(this,n.state)}}},{key:"hideCloseButton",value:function hideCloseButton(e){this.elementCloseButton.style.display=e?"none":"block"}},{key:"updateTitle",value:function updateTitle(){if(this.parent.container instanceof d){var _e11=this.parent.container.getRawTitle();this.elementText.innerHTML=_e11}}},{key:"destroy",value:function destroy(){this.parent.container.removeListener(this.undockListener),this.mouseDownHandler.cancel(),this.touchDownHandler.cancel(),this.closeButtonHandler.cancel(),this.closeButtonTouchHandler.cancel(),this.auxClickHandler.cancel(),this.mouseMoveHandler&&this.mouseMoveHandler.cancel(),this.touchMoveHandler&&this.touchMoveHandler.cancel(),this.mouseUpHandler&&this.mouseUpHandler.cancel(),this.touchUpHandler&&this.touchUpHandler.cancel(),this.contextMenuHandler&&this.contextMenuHandler.cancel(),this.elementBase&&(s.removeNode(this.elementBase),delete this.elementBase),this.elementCloseButton&&(s.removeNode(this.elementCloseButton),delete this.elementCloseButton)}},{key:"_performUndock",value:function _performUndock(e,t){return"panel"===this.parent.container.containerType?(this.undockInitiator.enabled=!1,this.parent.container.performUndockToDialog(e,t)):null}},{key:"onCloseButtonClicked",value:function onCloseButtonClicked(e){"none"!==this.elementCloseButton.style.display&&2!==e.button&&"panel"===this.parent.container.containerType&&this.parent.container.close()}},{key:"setSelected",value:function setSelected(e){e?this.elementBase.classList.add("dockspan-tab-handle-selected"):(this.elementBase.classList.remove("dockspan-tab-handle-selected"),this.elementBase.classList.remove("dockspan-tab-handle-active"))}},{key:"setActive",value:function setActive(e){this.elementBase&&(e?this.elementBase.classList.add("dockspan-tab-handle-active"):this.elementBase.classList.remove("dockspan-tab-handle-active"))}}]);return b}();b.createContextMenuContentCallback=function(e,n,i){var o=document.createElement("div");o.innerText=r.getString("CloseAll"),n.append(o),o.onclick=function(){for(var _e12=i.length-1;_e12>=0;_e12--){var _n5=i[_e12].container;_n5.panelType==t.document&&_n5.close()}e.closeContextMenu()};var s=document.createElement("div");s.innerText=r.getString("CloseAllButThis"),n.append(s),s.onclick=function(){for(var _n6=i.length-1;_n6>=0;_n6--){var _o5=i[_n6].container;e.parent.container!=_o5&&_o5.panelType==t.document&&_o5.close()}e.closeContextMenu()};var l=document.createElement("div");l.innerText=r.getString("NewBrowserWindow"),n.append(l),l.onclick=function(){e.parent.container.undockToBrowserDialog(),e.closeContextMenu()}};var E=function(){function E(e,t){_classCallCheck(this,E);0!==arguments.length&&(this.selected=!1,this.host=e,this.container=t,this.handle=new b(this),this.containerElement=t.containerElement,t instanceof d&&(this.panel=t,this.panel.onTitleChanged=this.onTitleChanged.bind(this),this.onTitleChanged()),t.tabPage=this)}_createClass(E,[{key:"onTitleChanged",value:function onTitleChanged(){this.handle.updateTitle(),this.panel&&(this.panel.hasChanges?this.handle.elementText.classList.add("panel-has-changes"):this.handle.elementText.classList.remove("panel-has-changes"))}},{key:"destroy",value:function destroy(){this.handle.destroy(),this.container instanceof d&&delete this.container.onTitleChanged,this.host.dockManager.activePanel==this.panel&&(this.host.dockManager.activePanel=null),this.container.tabPage=null,s.removeNode(this.containerElement)}},{key:"onSelected",value:function onSelected(){this.host.onTabPageSelected(this,!0),this.container instanceof d&&this.container.dockManager.notifyOnTabChange(this)}},{key:"setSelected",value:function setSelected(e,t){if(this.selected=e,this.handle.setSelected(e),this._initContent||this.host.contentElement.appendChild(this.containerElement),this._initContent=!0,this.selected){this.containerElement.style.display="block",this.panel.setVisible(!0);var _e13=this.host.contentElement.clientWidth,n=this.host.contentElement.clientHeight;this.container.resize(_e13,n),t&&(this.host.dockManager.activePanel=this.container)}else this.containerElement.style.display="none",this.panel.setVisible(!1)}},{key:"resize",value:function resize(e,t){this.container.resize(e,t)}}]);return E}();var D,H;!function(e){e[e.TOP=0]="TOP",e[e.BOTTOM=1]="BOTTOM",e[e.LEFT=2]="LEFT",e[e.RIGHT=3]="RIGHT"}(D||(D={}));var x=function(){function x(e,t,n){var _this15=this;_classCallCheck(this,x);if(void 0===t&&(t=D.BOTTOM),void 0===n&&(n=!1),this.dockManager=e,this.tabStripDirection=t,this.displayCloseButton=n,this.pages=[],this.eventListeners=[],this.tabHandleListener={onMoveTab:function onMoveTab(e){_this15.onMoveTab(e)}},this.hostElement=document.createElement("div"),this.tabListElement=document.createElement("div"),this.separatorElement=document.createElement("div"),this.contentElement=document.createElement("div"),this.contentElement.tabIndex=0,this.createTabPage=this._createDefaultTabPage,this.tabStripDirection===D.BOTTOM)this.hostElement.appendChild(this.contentElement),this.hostElement.appendChild(this.separatorElement),this.hostElement.appendChild(this.tabListElement);else{if(this.tabStripDirection!==D.TOP)throw new Error("Only top and bottom tab strip orientations are supported");this.hostElement.appendChild(this.tabListElement),this.hostElement.appendChild(this.separatorElement),this.hostElement.appendChild(this.contentElement)}this.hostElement.classList.add("dockspan-tab-host"),this.tabListElement.classList.add("dockspan-tab-handle-list-container"),this.separatorElement.classList.add("dockspan-tab-handle-content-seperator"),this.contentElement.classList.add("dockspan-tab-content"),this.contentElement.tabIndex=0,this.focusHandler=new l(this.contentElement,"focus",this.onFocus.bind(this),!0),this.mouseDownHandler=new l(this.contentElement,"mousedown",this.onMousedown.bind(this),!0)}_createClass(x,[{key:"onFocus",value:function onFocus(){this.activeTab&&this.dockManager.activePanel!=this.activeTab.panel&&(this.dockManager.activePanel=this.activeTab.panel)}},{key:"setActive",value:function setActive(e){e?this.separatorElement.classList.add("dockspan-tab-handle-content-seperator-active"):this.separatorElement.classList.remove("dockspan-tab-handle-content-seperator-active"),this.activeTab&&this.activeTab.handle.setActive(e)}},{key:"onMousedown",value:function onMousedown(){this.activeTab&&this.dockManager.activePanel!=this.activeTab.panel&&(this.dockManager.activePanel=this.activeTab.panel)}},{key:"onMoveTab",value:function onMoveTab(e){var t=Array.prototype.slice.call(this.tabListElement.childNodes).indexOf(e.self.elementBase);this.change(this,e.self,e.state,t)}},{key:"performTabsLayout",value:function performTabsLayout(e){this.pages=s.orderByIndexes(this.pages,e);var t=this.tabListElement.childNodes,n=[];for(var _e14 in t)1===t[_e14].nodeType&&n.push(t[_e14]);n=s.orderByIndexes(n,e);for(var _e15=0;_e150&&t&&(this.onTabPageSelected(t,!0),this.dockManager.activePanel=e)}},{key:"resize",value:function resize(e,t){var _this16=this;this.hostElement.style.width=e+"px",this.hostElement.style.height=t+"px";var n=this.tabListElement.clientHeight;this._resizeRequested||requestAnimationFrame(function(){return _this16.resizeTabListElement(e,t)}),this._resizeRequested=!0;var i=this.separatorElement.clientHeight,o=t-n-i;this.contentElement.style.height=o+"px",this.activeTab&&this.activeTab.resize(e,o)}},{key:"resizeTabListElement",value:function resizeTabListElement(e,t){var _this17=this;if(this._resizeRequested=!1,0===this.pages.length)return;var n=0;this.pages.forEach(function(e){var t=e.handle;null!=t.elementBase&&(t.elementBase.style.width="",n+=t.elementBase.clientWidth)});var i=e/n;i>1.2||this.pages.forEach(function(e,t){var n=e.handle,o=i*n.elementBase.clientWidth;t===_this17.pages.length-1&&(o-=5),n.elementBase.style.width=o+"px"})}},{key:"performLayout",value:function performLayout(e){var _this18=this;this.pages.forEach(function(t){if(!e.some(function(e){return e==t.container})){t.handle.removeListener(_this18.tabHandleListener),t.destroy();var _e16=_this18.pages.indexOf(t);_e16>-1&&_this18.pages.splice(_e16,1)}});var t=this.activeTab;delete this.activeTab;var n=e.filter(function(e){return"panel"===e.containerType});n.length>0?(n.forEach(function(e){var n=null;_this18.pages.some(function(t){return t.container==e&&(n=t,!0)})||(n=_this18.createTabPage(_this18,e),n.handle.addListener(_this18.tabHandleListener),_this18.pages.push(n)),t&&n.container===t.container&&(_this18.activeTab=n)}),this._setTabHandlesVisible(!0)):this._setTabHandlesVisible(!1),this.activeTab&&this.onTabPageSelected(this.activeTab,!1)}},{key:"_setTabHandlesVisible",value:function _setTabHandlesVisible(e){e?(this.tabListElement.classList.add("dockspan-tab-handle-list-container-visible"),this.separatorElement.classList.add("dockspan-tab-handle-content-seperator-visible")):(this.tabListElement.classList.remove("dockspan-tab-handle-list-container-visible"),this.separatorElement.classList.remove("dockspan-tab-handle-content-seperator-visible"))}},{key:"onTabPageSelected",value:function onTabPageSelected(e,t){this.activeTab=e,this.pages.forEach(function(n){var i=n===e;n.setSelected(i,t)})}}]);return x}();var _=function(){function _(t,n){var _this19=this;_classCallCheck(this,_);void 0===n&&(n=D.BOTTOM),this.dockManager=t,this.tabOrientation=n,this.name=s.getNextId("fill_"),this.element=document.createElement("div"),this.containerElement=this.element,this.containerType=e.fill,this.minimumAllowedChildNodes=2,this.element.classList.add("dock-container"),this.element.classList.add("dock-container-fill"),this.tabHost=new x(t,this.tabOrientation),this.tabHostListener={onChange:function onChange(e){_this19.dockManager._requestTabReorder(_this19,e)}},this.tabHost.addListener(this.tabHostListener),this.element.appendChild(this.tabHost.hostElement)}_createClass(_,[{key:"setActiveChild",value:function setActiveChild(e){this.tabHost.setActiveTab(e)}},{key:"resize",value:function resize(e,t){this.element.style.width=e+"px",this.element.style.height=t+"px",this.tabHost.resize(e,t)}},{key:"performLayout",value:function performLayout(e){this.tabHost.performLayout(e)}},{key:"destroy",value:function destroy(){this.tabHost.pages.forEach(function(e){return e.destroy()}),s.removeNode(this.element)&&delete this.element}},{key:"saveState",value:function saveState(e){e.width=this.width,e.height=this.height}},{key:"loadState",value:function loadState(e){this.state={width:e.width,height:e.height}}},{key:"width",get:function get(){return this.element.clientWidth},set:function set(e){this.element.style.width=e+"px"}},{key:"height",get:function get(){return this.element.clientHeight},set:function set(e){this.element.style.height=e+"px"}}]);return _}();var T=function(){function T(e){_classCallCheck(this,T);this._forceResizeCompositeContainer=function(e){var t=e.containerElement.clientWidth,n=e.containerElement.clientHeight;e.resize(t,n)},this.dockManager=e}_createClass(T,[{key:"dockLeft",value:function dockLeft(e,t){this._performDock(e,t,"horizontal",!0)}},{key:"dockRight",value:function dockRight(e,t){this._performDock(e,t,"horizontal",!1)}},{key:"dockUp",value:function dockUp(e,t){this._performDock(e,t,"vertical",!0)}},{key:"dockDown",value:function dockDown(e,t){this._performDock(e,t,"vertical",!1)}},{key:"dockFill",value:function dockFill(e,t){this._performDock(e,t,"fill",!1)}},{key:"undock",value:function undock(e){var t=e.parent;if(!t)throw new Error("Cannot undock. panel is not a leaf node");var n=t.children.indexOf(e);if(e.detachFromParent(),t.children.length0){var _e18=t.children[Math.max(0,n-1)];t.container.setActiveChild(_e18.container)}this.dockManager.invalidate(),this.dockManager.notifyOnUnDock(e)}},{key:"close",value:function close(e){var t=null==e?void 0:e.parent;if(!t)throw new Error("Cannot undock. panel is not a leaf node");var n=!1;t.children.length>0&&null!=t.container.tabHost&&(n=t.container.tabHost.getActiveTab().container==e.container);var i=t.children.indexOf(e);if(e.detachFromParent(),t.children.length=e.children.length)return;if("left"==n&&0==l)return;var a=Array.apply(null,{length:o}).map(Number.call,Number),h=a.splice(l,1)[0];a.splice("left"===n?i-1:i,0,h),e.children=s.orderByIndexes(e.children,a),e.container.tabHost.performTabsLayout(a),this.dockManager.notifyOnTabsReorder(e)}},{key:"_performDock",value:function _performDock(e,t,n,i){if(e.parent&&"fill"===e.parent.container.containerType&&(e=e.parent),"fill"===n&&"fill"===e.container.containerType)return e.addChild(t),e.performLayout(!1),e.container.setActiveChild(t.container),this.dockManager.invalidate(),void this.dockManager.notifyOnDock(t);var o,l,a;if(e===this.dockManager.context.model.rootNode)return i?(o=this._createDockContainer(n,t,e),l=new f(o),l.addChild(t),l.addChild(e)):(o=this._createDockContainer(n,e,t),l=new f(o),l.addChild(e),l.addChild(t)),this.dockManager.setRootNode(l),this.dockManager.rebuildLayout(this.dockManager.context.model.rootNode),l.container.setActiveChild(t.container),this.dockManager.invalidate(),void this.dockManager.notifyOnDock(t);if(e.parent.container.containerType!==n){a=e.parent;var _h=e.container.containerElement.clientWidth,_r=e.container.containerElement.clientHeight,_d=a.container.containerElement.clientWidth,_c=a.container.containerElement.clientHeight;o=this._createDockContainer(n,t,e),l=new f(o),a.addChildAfter(e,l),e.detachFromParent(),s.removeNode(e.container.containerElement),i?(l.addChild(t),l.addChild(e)):(l.addChild(e),l.addChild(t)),a.performLayout(!1),l.performLayout(!0),l.container.setActiveChild(t.container),l.container.resize(_h,_r),a.container.resize(_d,_c)}else a=e.parent,i?a.addChildBefore(e,t):a.addChildAfter(e,t),a.performLayout(!1),a.container.setActiveChild(t.container);var h=t.container.containerElement.clientWidth,r=t.container.containerElement.clientHeight;t.container.resize(h,r),this.dockManager.invalidate(),this.dockManager.notifyOnDock(t)}},{key:"_createDockContainer",value:function _createDockContainer(e,t,n){if("horizontal"===e)return new k(this.dockManager,[t.container,n.container]);if("vertical"===e)return new M(this.dockManager,[t.container,n.container]);if("fill"===e)return new _(this.dockManager);throw new Error("Failed to create dock container of type: "+e)}},{key:"getDockBounds",value:function getDockBounds(e,t,n,i){var o,s,l,a;if("fill"===n){var _t9=e.container.containerElement,_n11=this.dockManager.element.getBoundingClientRect(),_i6=_t9.getBoundingClientRect();return{x:_i6.left-_n11.left,y:_i6.top-_n11.top,width:_t9.clientWidth,height:_t9.clientHeight}}e.parent&&"fill"===e.parent.container.containerType&&(e=e.parent);var h=!1;e.parent&&e.parent.container.containerType===n?(o=e.parent,s=o.children.length,l=o.children.indexOf(e)+(i?0:1)):(o=e,s=1,l=i?0:1,h=!0);var r=0,d=0;if("vertical"===n||"horizontal"===n){var _e21=this._getVaringDimension(o.container,n)-5*(s-1),_a2=this._getVaringDimension(t,n),_c2=_e21/(_e21+_a2);if(r=_a2*_c2,h)d=i?0:_e21*_c2;else{for(var _e22=0;_e22document.body.clientWidth||n.position.y>document.body.clientHeight-70)&&(n.position.x=20,n.position.y=70),_i7.setPosition(n.position.x,n.position.y),_i7.isHidden=n.isHidden,_i7.isHidden&&_i7.hide(),t.push(_i7);case 17:_context7.next=4;break;case 19:_context7.next=24;break;case 21:_context7.prev=21;_context7.t1=_context7["catch"](2);_iterator15.e(_context7.t1);case 24:_context7.prev=24;_iterator15.f();return _context7.finish(24);case 27:return _context7.abrupt("return",t);case 28:case"end":return _context7.stop()}},_callee7,this,[[2,21,24,27]])}));function _buildDialogs(_x8){return _buildDialogs2.apply(this,arguments)}return _buildDialogs}()}]);return W}();var R=function(){function R(e,t){_classCallCheck(this,R);if(void 0===e)throw new Error("Invalid Dock Manager element provided");this._config=Object.assign(new g,t),this.element=e,this.context=this.dockWheel=this.layoutEngine=this.mouseMoveHandler=this.touchMoveHandler=void 0,this.layoutEventListeners=[],this.defaultDialogPosition=new o(0,0)}_createClass(R,[{key:"config",get:function get(){return this._config}},{key:"initialize",value:function initialize(){this.backgroundContext=this.element.children[0],this.context=new S(this);var e=new f(this.context.documentManagerView);this.context.model.rootNode=e,this.context.model.documentManagerNode=e,this.context.model.dialogs=[],this.setRootNode(this.context.model.rootNode),this.resize(this.element.clientWidth,this.element.clientHeight),this.dockWheel=new L(this),this.layoutEngine=new T(this),this._undockEnabled=!0,this.rebuildLayout(this.context.model.rootNode),this.zIndexCounter=1001,this.zIndexTabHost=1e3,this.zIndexTabHandle=100,this.zIndexDialogCounter=10001,null!=this.backgroundContext&&this.context.model.rootNode.container.tabHost.hostElement.insertBefore(this.backgroundContext,this.context.model.rootNode.container.tabHost.hostElement.firstChild),this.onKeyPressBound=this.onKeyPress.bind(this),this.element.addEventListener("keydown",this.onKeyPressBound)}},{key:"onKeyPress",value:function onKeyPress(e){if("Escape"==e.key&&this.activePanel&&!this.activePanel._hideCloseButton&&(this.activePanel.isDialog&&this._config.escClosesDialog||!this.activePanel.isDialog&&this._config.escClosesWindow)){var _e30=this.activePanel;this.activePanel=null,_e30.close()}}},{key:"checkXBounds",value:function checkXBounds(e,t,n,i,o){if(this._config.moveOnlyWithinDockConatiner)return this.checkXBoundsWithinDockContainer(e,t,n,i,o);var s=this.element.getBoundingClientRect(),l=Math.floor(t.x-n.x),a=e.offsetLeft+e.offsetWidth+l+s.left<40,h=e.offsetLeft+l+s.left>window.innerWidth-40;if(a){n.x=t.x,l=0;var _i8=40-(e.offsetWidth+e.offsetLeft+s.left);_i8>0&&(l=_i8)}else if(h){n.x=t.x,l=0;var _i9=window.innerWidth-40-e.offsetLeft-s.left;_i9>0&&(l=_i9)}return l}},{key:"checkXBoundsWithinDockContainer",value:function checkXBoundsWithinDockContainer(e,t,n,i,o){var s=t.x-n.x,l=this.element.getBoundingClientRect(),a=e.getBoundingClientRect(),h=s<0&&a.left+s0&&a.right+s>l.right&&!i;return h?(t.x-=s,s=l.left-a.left,t.x-=s):r&&(t.x-=s,s=l.right-a.right,t.x-=s),s}},{key:"checkYBounds",value:function checkYBounds(e,t,n,i,o){if(this._config.moveOnlyWithinDockConatiner)return this.checkYBoundsWithinDockContainer(e,t,n,i,o);var s=this.element.getBoundingClientRect(),l=Math.floor(t.y-n.y),a=e.offsetTop+l+s.top<0,h=e.offsetTop+l+s.top>window.innerHeight-16;if(a)n.y=t.y,l=0;else if(h){n.y=t.y,l=0;var _i10=window.innerHeight-16-e.offsetTop-s.top;_i10>0&&(l=_i10)}return l}},{key:"checkYBoundsWithinDockContainer",value:function checkYBoundsWithinDockContainer(e,t,n,i,o){var s=t.y-n.y,l=this.element.getBoundingClientRect(),a=e.getBoundingClientRect(),h=s<0&&a.top+s0&&a.bottom+s>l.bottom&&!i;return h?(t.y-=s,s=l.top-a.top,t.y-=s):r&&(t.y-=s,s=l.bottom-a.bottom,t.y-=s),s}},{key:"rebuildLayout",value:function rebuildLayout(e){var _this22=this;e.children.forEach(function(e){_this22.rebuildLayout(e)}),e.performLayout(!1)}},{key:"invalidate",value:function invalidate(){this.resize(this.element.clientWidth,this.element.clientHeight)}},{key:"resize",value:function resize(e,t){this.element.style.width=e+"px",this.element.style.height=t+"px",this.context.model.rootNode.container.resize(e,t);var n=0,i=0;var _iterator16=_createForOfIteratorHelper(this.context.model.dialogs),_step16;try{for(_iterator16.s();!(_step16=_iterator16.n()).done;){var _e31=_step16.value;(_e31.position.x>this.element.clientWidth||_e31.position.y>this.element.clientHeight)&&((n>this.element.clientWidth||i>this.element.clientHeight)&&(n=0,i=0),_e31.setPosition(100+n,100+i),n+=100,i+=100)}}catch(err){_iterator16.e(err)}finally{_iterator16.f()}}},{key:"setModel",value:function setModel(e){s.removeNode(this.context.documentManagerView.containerElement),this.context.model=e,this.setRootNode(e.rootNode),this.rebuildLayout(e.rootNode),this.loadResize(e.rootNode)}},{key:"loadResize",value:function loadResize(e){var _this23=this;e.children.reverse().forEach(function(t){_this23.loadResize(t),e.container.setActiveChild(t.container)}),e.children.reverse();var t=e.container;e.container.resize(t.state.width,t.state.height)}},{key:"setRootNode",value:function setRootNode(e){e.detachFromParent(),this.context.model.rootNode=e,this.element.appendChild(e.container.containerElement)}},{key:"_onDialogDragStarted",value:function _onDialogDragStarted(e,t){this.dockWheel.activeNode=this._findNodeOnPoint(t.clientX,t.clientY),this.dockWheel.activeDialog=e,null!=e.noDocking&&!0===e.noDocking||this.dockWheel.showWheel(),this.mouseMoveHandler&&(this.mouseMoveHandler.cancel(),delete this.mouseMoveHandler),this.touchMoveHandler&&(this.touchMoveHandler.cancel(),delete this.touchMoveHandler),this.mouseMoveHandler=new l(window,"mousemove",this._onMouseMoved.bind(this)),this.touchMoveHandler=new l(window,"touchmove",this._onMouseMoved.bind(this))}},{key:"_onDialogDragEnded",value:function _onDialogDragEnded(e,t){this.mouseMoveHandler&&(this.mouseMoveHandler.cancel(),delete this.mouseMoveHandler),this.touchMoveHandler&&(this.touchMoveHandler.cancel(),delete this.touchMoveHandler),this.dockWheel.onDialogDropped(e),this.dockWheel.hideWheel(),delete this.dockWheel.activeDialog,e.saveState(e.elementDialog.offsetLeft,e.elementDialog.offsetTop)}},{key:"_onMouseMoved",value:function _onMouseMoved(e){null!=e.changedTouches&&(e=e.changedTouches[0]),this.dockWheel.activeNode=this._findNodeOnPoint(e.clientX,e.clientY)}},{key:"_findNodeOnPoint",value:function _findNodeOnPoint(e,t){var n,i=[];for(i.push(this.context.model.rootNode);i.length>0;){var _o9=i.pop();s.isPointInsideNode(e,t,_o9)&&(n=_o9,[].push.apply(i,_o9.children))}return n}},{key:"dockDialogLeft",value:function dockDialogLeft(e,t){return this._requestDockDialog(e,t,this.layoutEngine.dockLeft.bind(this.layoutEngine))}},{key:"dockDialogRight",value:function dockDialogRight(e,t){return this._requestDockDialog(e,t,this.layoutEngine.dockRight.bind(this.layoutEngine))}},{key:"dockDialogUp",value:function dockDialogUp(e,t){return this._requestDockDialog(e,t,this.layoutEngine.dockUp.bind(this.layoutEngine))}},{key:"dockDialogDown",value:function dockDialogDown(e,t){return this._requestDockDialog(e,t,this.layoutEngine.dockDown.bind(this.layoutEngine))}},{key:"dockDialogFill",value:function dockDialogFill(e,t){return this._requestDockDialog(e,t,this.layoutEngine.dockFill.bind(this.layoutEngine))}},{key:"dockLeft",value:function dockLeft(e,t,n){return this._requestDockContainer(e,t,this.layoutEngine.dockLeft.bind(this.layoutEngine),!1,n)}},{key:"dockRight",value:function dockRight(e,t,n){return this._requestDockContainer(e,t,this.layoutEngine.dockRight.bind(this.layoutEngine),!0,n)}},{key:"dockUp",value:function dockUp(e,t,n){return this._requestDockContainer(e,t,this.layoutEngine.dockUp.bind(this.layoutEngine),!1,n)}},{key:"dockDown",value:function dockDown(e,t,n){return this._requestDockContainer(e,t,this.layoutEngine.dockDown.bind(this.layoutEngine),!0,n)}},{key:"dockFill",value:function dockFill(e,t){return this._requestDockContainer(e,t,this.layoutEngine.dockFill.bind(this.layoutEngine),!1)}},{key:"floatDialog",value:function floatDialog(e,t,n,i,o){var l;if(this.context.model.dialogs.forEach(function(i){e==i.panel&&(i.show(),i.setPosition(t,n),l=i)}),l)return l;try{var _t12=this._findNodeFromContainer(e);this.layoutEngine.undock(_t12)}catch(e){}var a=e;s.removeNode(a.elementPanel),a.isDialog=!0;var h=new p(a,this,i,o);return h.setPosition(t,n),h}},{key:"_requestDockDialog",value:function _requestDockDialog(e,t,n){var i=t.panel,o=new f(i);return i.prepareForDocking(),i.elementContentContainer.style.zIndex="",t.destroy(),n(e,o),o}},{key:"_checkShowBackgroundContext",value:function _checkShowBackgroundContext(){null!=this.backgroundContext&&(this.context.model.documentManagerNode.children.length>0?this.backgroundContext.style.display="none":this.backgroundContext.style.display="block")}},{key:"_requestDockContainer",value:function _requestDockContainer(e,t,n,i,o){var l=new f(t);if("panel"===t.containerType){var _e32=t;_e32.prepareForDocking(),s.removeNode(_e32.elementPanel)}var a,h=null;if(e.parent&&e.parent.container&&(a=e.parent.container,a.getRatios&&(h=a.getRatios())),n(e,l),o&&l.parent&&("vertical"===l.parent.container.containerType||"horizontal"===l.parent.container.containerType)){var _e33=l.parent.container;if(h&&a==_e33){if(i){for(var _e34=0;_e34_e35&&(n.x=.75*_e35),s.setPosition(t.clientX-n.x,t.clientY-n.y),s.draggable.onMouseDown(t)}return s}},{key:"requestClose",value:function requestClose(e){var t=this._findNodeFromContainer(e);if(this.layoutEngine.close(t),this.activePanel==e&&(this.activePanel=null),this._activeDocument==e){var _e36=this._activeDocument;this._activeDocument=null,this.notifyOnActiveDocumentChange(null,_e36)}}},{key:"openInDialog",value:function openInDialog(e,t,n,i){var o=new p(e,this,null,i);if(null!=t){var _e37=o.elementDialog.clientWidth;n.x>_e37&&(n.x=.75*_e37),o.setPosition(t.clientX-n.x,t.clientY-n.y),o.draggable.onMouseDown(t)}return o}},{key:"requestUndock",value:function requestUndock(e){var t=this._findNodeFromContainer(e);this.layoutEngine.undock(t)}},{key:"requestRemove",value:function requestRemove(e){var t=this._findNodeFromContainer(e),n=t.parent;return t.detachFromParent(),n&&this.rebuildLayout(n),t}},{key:"getNodeByElementId",value:function getNodeByElementId(e){var t,n;var i=[];for(i.push(this.context.model.rootNode);i.length>0;){var _o10=i.pop();if(_o10.container instanceof d){if(_o10.container.elementContent.id===e)return _o10;if(_o10.container.elementContent instanceof HTMLSlotElement&&(null===(n=null===(t=_o10.container.elementContent.assignedElements())||void 0===t?void 0:t[0])||void 0===n?void 0:n.id)===e)return _o10}[].push.apply(i,_o10.children)}return null}},{key:"getNodeByElement",value:function getNodeByElement(e){var t;var n=[];for(n.push(this.context.model.rootNode);n.length>0;){var i=n.pop();if(i.container instanceof d){if(i.container.elementContent===e)return i;if(i.container.elementContent instanceof HTMLSlotElement&&(null===(t=i.container.elementContent.assignedElements())||void 0===t?void 0:t[0])===e)return i}[].push.apply(n,i.children)}return null}},{key:"_findNodeFromContainer",value:function _findNodeFromContainer(e){var t=[];for(t.push(this.context.model.rootNode);t.length>0;){var n=t.pop();if(n.container===e)return n;[].push.apply(t,n.children)}return null}},{key:"findNodeFromContainerElement",value:function findNodeFromContainerElement(e){var t=[];for(t.push(this.context.model.rootNode);t.length>0;){var n=t.pop();if(n.container.containerElement===e)return n;[].push.apply(t,n.children)}return null}},{key:"addLayoutListener",value:function addLayoutListener(e){this.layoutEventListeners.push(e)}},{key:"removeLayoutListener",value:function removeLayoutListener(e){this.layoutEventListeners.splice(this.layoutEventListeners.indexOf(e),1)}},{key:"suspendLayout",value:function suspendLayout(e){var _this24=this;this.layoutEventListeners.forEach(function(t){t.onSuspendLayout&&t.onSuspendLayout(_this24,e)})}},{key:"resumeLayout",value:function resumeLayout(e){var _this25=this;this.layoutEventListeners.forEach(function(t){t.onResumeLayout&&t.onResumeLayout(_this25,e)})}},{key:"notifyOnDock",value:function notifyOnDock(e){var _this26=this;this._checkShowBackgroundContext(),this.layoutEventListeners.forEach(function(t){t.onDock&&(t.onDock(_this26,e),e.container.resize(e.container.width,e.container.height))})}},{key:"notifyOnTabsReorder",value:function notifyOnTabsReorder(e){var _this27=this;this.layoutEventListeners.forEach(function(t){t.onTabsReorder&&t.onTabsReorder(_this27,e)})}},{key:"notifyOnUnDock",value:function notifyOnUnDock(e){var _this28=this;this._checkShowBackgroundContext(),this.layoutEventListeners.forEach(function(t){t.onUndock&&t.onUndock(_this28,e)})}},{key:"notifyOnClosePanel",value:function notifyOnClosePanel(e){var _this29=this;if(this._checkShowBackgroundContext(),this.activePanel==e&&(this.activePanel=null),this._activeDocument==e){var _e38=this._activeDocument;this._activeDocument=null,this.notifyOnActiveDocumentChange(null,_e38)}this.layoutEventListeners.forEach(function(t){t.onClosePanel&&t.onClosePanel(_this29,e)})}},{key:"notifyOnCreateDialog",value:function notifyOnCreateDialog(e){var _this30=this;this.layoutEventListeners.forEach(function(t){t.onCreateDialog&&t.onCreateDialog(_this30,e)})}},{key:"notifyOnHideDialog",value:function notifyOnHideDialog(e){var _this31=this;this.layoutEventListeners.forEach(function(t){t.onHideDialog&&t.onHideDialog(_this31,e)})}},{key:"notifyOnShowDialog",value:function notifyOnShowDialog(e){var _this32=this;this.layoutEventListeners.forEach(function(t){t.onShowDialog&&t.onShowDialog(_this32,e)})}},{key:"notifyOnChangeDialogPosition",value:function notifyOnChangeDialogPosition(e,t,n){var _this33=this;this.layoutEventListeners.forEach(function(i){i.onChangeDialogPosition&&i.onChangeDialogPosition(_this33,e,t,n)})}},{key:"notifyOnContainerResized",value:function notifyOnContainerResized(e){var _this34=this;this.layoutEventListeners.forEach(function(t){t.onContainerResized&&t.onContainerResized(_this34,e)})}},{key:"notifyOnTabChange",value:function notifyOnTabChange(e){var _this35=this;this.layoutEventListeners.forEach(function(t){t.onTabChanged&&t.onTabChanged(_this35,e)})}},{key:"notifyOnActivePanelChange",value:function notifyOnActivePanelChange(e,t){var _this36=this;this.layoutEventListeners.forEach(function(n){n.onActivePanelChange&&n.onActivePanelChange(_this36,e,t)})}},{key:"notifyOnActiveDocumentChange",value:function notifyOnActiveDocumentChange(e,t){var _this37=this;this.layoutEventListeners.forEach(function(n){n.onActiveDocumentChange&&n.onActiveDocumentChange(_this37,e,t)})}},{key:"saveState",value:function saveState(){return(new v).serialize(this.context.model)}},{key:"loadState",value:function(){var _loadState=_asyncToGenerator(_regeneratorRuntime().mark(function _callee8(e){var t;return _regeneratorRuntime().wrap(function _callee8$(_context8){while(1)switch(_context8.prev=_context8.next){case 0:t=new W(this);_context8.next=3;return t.deserialize(e);case 3:this.context.model=_context8.sent;this.setModel(this.context.model);case 5:case"end":return _context8.stop()}},_callee8,this)}));function loadState(_x9){return _loadState.apply(this,arguments)}return loadState}()},{key:"getPanels",value:function getPanels(){var e=[];return this._allPanels(this.context.model.rootNode,e),this.context.model.dialogs.forEach(function(t){e.push(t.panel)}),e}},{key:"undockEnabled",value:function undockEnabled(e){this._undockEnabled=e,this.getPanels().forEach(function(t){t.canUndock(e)})}},{key:"lockDockState",value:function lockDockState(e){this.undockEnabled(!e),this.hideCloseButton(e)}},{key:"hideCloseButton",value:function hideCloseButton(e){this.getPanels().forEach(function(t){t.hideCloseButton(e)})}},{key:"updatePanels",value:function updatePanels(e){var t=[];return this._allPanels(this.context.model.rootNode,t),t.forEach(function(t){s.arrayContains(e,t.elementContent.id)||t.close()}),this.context.model.dialogs.forEach(function(t){s.arrayContains(e,t.panel.elementContent.id)?t.show():t.hide()}),t}},{key:"getVisiblePanels",value:function getVisiblePanels(){var e=[];return this._allPanels(this.context.model.rootNode,e),this.context.model.dialogs.forEach(function(t){t.isHidden||e.push(t.panel)}),e}},{key:"_allPanels",value:function _allPanels(e,t){var _this38=this;e.children.forEach(function(e){_this38._allPanels(e,t)}),"panel"===e.container.containerType&&t.push(e.container)}},{key:"activeDocument",get:function get(){return this._activeDocument}},{key:"activePanel",get:function get(){return this._activePanel},set:function set(e){if(e!==this._activePanel){e&&!e.isDialog&&(this._lastPanelNotADialog=e),this._lastPanelNotADialog&&this.getPanels().indexOf(this._lastPanelNotADialog)<0&&(this._lastPanelNotADialog=null);var n=this.activePanel;this.activePanel&&(this.activePanel.elementTitle.classList.remove("dockspan-panel-active"),this.activePanel.elementTitleText.classList.remove("dockspan-panel-titlebar-text-active"),this.activePanel.tabPage&&this.activePanel.tabPage.host.setActive(!1)),this._activePanel=e;var i=this._activeDocument;e&&e.panelType==t.document&&(this._activeDocument=e),!e&&n&&n.isDialog&&null==e&&this._lastPanelNotADialog&&this.activePanel!=this._lastPanelNotADialog&&(e=this._lastPanelNotADialog,this._lastPanelNotADialog=void 0),this.notifyOnActivePanelChange(e,n),i!=this._activeDocument&&this.notifyOnActiveDocumentChange(this._activeDocument,i),e&&(e.elementTitle.classList.add("dockspan-panel-active"),e.elementTitleText.classList.add("dockspan-panel-titlebar-text-active"),e.tabPage&&e.tabPage.host.setActive(!0))}else e&&e.tabPage&&e.tabPage.host.setActive(!0)}}]);return R}();DockSpawnTS=i})(); diff --git a/lib/js/SplitterBar.js b/lib/js/SplitterBar.js index dc53017..00f9023 100644 --- a/lib/js/SplitterBar.js +++ b/lib/js/SplitterBar.js @@ -28,13 +28,13 @@ export class SplitterBar { e = e.changedTouches[0]; } let posIf = iframe.getBoundingClientRect(); - this.handleMoveEvent({ x: e.clientX + posIf.x, y: e.clientY + posIf.y }); + this.handleMoveEvent({ x: parseInt("" + e.clientX + posIf.x), y: parseInt("" + e.clientY + posIf.y) }); } onPointerMoved(e) { if (e.changedTouches != null) { e = e.changedTouches[0]; } - this.handleMoveEvent({ x: e.clientX, y: e.clientY }); + this.handleMoveEvent({ x: parseInt("" + e.clientX), y: parseInt("" + e.clientY) }); } handleMoveEvent(pos) { if (!this.readyToProcessNextDrag) diff --git a/lib/js/SplitterBar.js.map b/lib/js/SplitterBar.js.map index b00f1f5..2c074a5 100644 --- a/lib/js/SplitterBar.js.map +++ b/lib/js/SplitterBar.js.map @@ -1 +1 @@ -{"version":3,"file":"SplitterBar.js","sourceRoot":"","sources":["../../src/SplitterBar.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGnC,MAAM,OAAO,WAAW;IAepB,YAAY,iBAAiC,EAAE,aAA6B,EAAE,eAAwB;QAClG,8EAA8E;QAC9E,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,kFAAkF;QAClF,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAChD,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC;QAC7F,IAAI,CAAC,kBAAkB,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,UAAU,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1G,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC,CAAC,yCAAyC;QACjE,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC;QACnC,IAAI,CAAC,qBAAqB,GAAG,IAAI,WAAW,CAAC,uBAAuB,EA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AI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;YAC/B,OAAO,IAAI,CAAC,gBAAgB,CAAC;QACjC,CAAC;QACD,KAAK,IAAI,CAAC,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACrC,CAAC,CAAC,MAAM,EAAE,CAAC;QACf,CAAC;QACD,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAC;IAClC,CAAC;CACJ"} \ No newline at end of file diff --git a/package.json b/package.json index 8991639..c3a2a90 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dock-spawn-ts", - "version": "2.535.2", + "version": "2.535.3", "description": "DockSpawn Typescript Version", "license": "MIT", "author": "jochen.kuehner@gmx.de", diff --git a/src/SplitterBar.ts b/src/SplitterBar.ts index da5a610..1e8a5e9 100644 --- a/src/SplitterBar.ts +++ b/src/SplitterBar.ts @@ -15,7 +15,7 @@ export class SplitterBar { previousMouseEvent: { x: number, y: number }; pointerMovedHandler: EventHandler; pointerUpHandler: EventHandler; - + private iframeEventHandlers: EventHandler[]; constructor(previousContainer: IDockContainer, nextContainer: IDockContainer, stackedVertical: boolean) { @@ -48,14 +48,14 @@ export class SplitterBar { e = e.changedTouches[0]; } let posIf = iframe.getBoundingClientRect(); - this.handleMoveEvent({ x: e.clientX + posIf.x, y: e.clientY + posIf.y }); + this.handleMoveEvent({ x: parseInt("" + e.clientX + posIf.x), y: parseInt("" + e.clientY + posIf.y) }); } onPointerMoved(e: IMouseOrTouchEvent) { if (e.changedTouches != null) { e = e.changedTouches[0]; } - this.handleMoveEvent({ x: e.clientX, y: e.clientY }); + this.handleMoveEvent({ x: parseInt("" + e.clientX), y: parseInt("" + e.clientY) }); } handleMoveEvent(pos: { x: number, y: number }) {