flexlayout-react 0.7.12 → 0.7.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog.txt +12 -0
- package/README.md +74 -71
- package/declarations/Rect.d.ts +1 -1
- package/declarations/Types.d.ts +1 -0
- package/declarations/model/IJsonModel.d.ts +3 -0
- package/declarations/model/TabNode.d.ts +1 -0
- package/declarations/model/TabSetNode.d.ts +1 -0
- package/declarations/view/Layout.d.ts +4 -2
- package/dist/flexlayout.js +14 -14
- package/dist/flexlayout_min.js +1 -1
- package/lib/DragDrop.js +1 -1
- package/lib/DragDrop.js.map +1 -1
- package/lib/PopupMenu.js +9 -4
- package/lib/PopupMenu.js.map +1 -1
- package/lib/Rect.js +1 -6
- package/lib/Rect.js.map +1 -1
- package/lib/Types.js +1 -0
- package/lib/Types.js.map +1 -1
- package/lib/model/Model.js +1 -0
- package/lib/model/Model.js.map +1 -1
- package/lib/model/TabNode.js +4 -0
- package/lib/model/TabNode.js.map +1 -1
- package/lib/model/TabSetNode.js +4 -0
- package/lib/model/TabSetNode.js.map +1 -1
- package/lib/view/BorderButton.js +7 -5
- package/lib/view/BorderButton.js.map +1 -1
- package/lib/view/FloatingWindow.js +3 -2
- package/lib/view/FloatingWindow.js.map +1 -1
- package/lib/view/Layout.js +117 -57
- package/lib/view/Layout.js.map +1 -1
- package/lib/view/Splitter.js +18 -6
- package/lib/view/Splitter.js.map +1 -1
- package/lib/view/TabButton.js +17 -12
- package/lib/view/TabButton.js.map +1 -1
- package/lib/view/TabOverflowHook.js +7 -4
- package/lib/view/TabOverflowHook.js.map +1 -1
- package/lib/view/TabSet.js +17 -5
- package/lib/view/TabSet.js.map +1 -1
- package/package.json +8 -3
- package/src/DragDrop.ts +2 -2
- package/src/PopupMenu.tsx +8 -4
- package/src/Rect.ts +2 -6
- package/src/Types.ts +1 -0
- package/src/model/IJsonModel.ts +5 -2
- package/src/model/Model.ts +1 -0
- package/src/model/TabNode.ts +5 -0
- package/src/model/TabSetNode.ts +6 -0
- package/src/view/BorderButton.tsx +13 -5
- package/src/view/FloatingWindow.tsx +3 -3
- package/src/view/Layout.tsx +145 -69
- package/src/view/Splitter.tsx +36 -7
- package/src/view/TabButton.tsx +22 -11
- package/src/view/TabOverflowHook.tsx +8 -5
- package/src/view/TabSet.tsx +20 -5
- package/style/_base.scss +21 -0
- package/style/dark.css +17 -0
- package/style/dark.css.map +1 -1
- package/style/dark.scss +6 -0
- package/style/gray.css +17 -0
- package/style/gray.css.map +1 -1
- package/style/gray.scss +6 -0
- package/style/light.css +561 -544
- package/style/light.css.map +1 -1
- package/style/light.scss +6 -0
- package/style/underline.css +17 -0
- package/style/underline.css.map +1 -1
- package/style/underline.scss +6 -0
package/dist/flexlayout_min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],e):"object"==typeof exports?exports.FlexLayout=e(require("react"),require("react-dom")):t.FlexLayout=e(t.React,t.ReactDOM)}(self,((t,e)=>(()=>{"use strict";var i={899:e=>{e.exports=t},994:t=>{t.exports=e}},s={};function o(t){var e=s[t];if(void 0!==e)return e.exports;var n=s[t]={exports:{}};return i[t](n,n.exports,o),n.exports}o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{o.r(n),o.d(n,{Action:()=>l,Actions:()=>h,BorderNode:()=>R,BorderSet:()=>Z,CLASSES:()=>g,DockLocation:()=>r,DragDrop:()=>d,DropInfo:()=>u,I18nLabel:()=>T,ICloseType:()=>E,Layout:()=>V,Model:()=>j,Node:()=>p,Orientation:()=>i,Rect:()=>s,RowNode:()=>f,SplitterNode:()=>m,TabNode:()=>b,TabSetNode:()=>v});var t=o(899),e=o(994);class i{static flip(t){return t===i.HORZ?i.VERT:i.HORZ}constructor(t){this._name=t}getName(){return this._name}toString(){return this._name}}i.HORZ=new i("horz"),i.VERT=new i("vert");class s{static empty(){return new s(0,0,0,0)}constructor(t,e,i,s){this.x=t,this.y=e,this.width=i,this.height=s}static fromElement(t){let{x:e,y:i,width:o,height:n}=t.getBoundingClientRect();return new s(e,i,o,n)}clone(){return new s(this.x,this.y,this.width,this.height)}equals(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height}getBottom(){return this.y+this.height}getRight(){return this.x+this.width}getCenter(){return{x:this.x+this.width/2,y:this.y+this.height/2}}positionElement(t,e){this.styleWithPosition(t.style,e)}styleWithPosition(t,e="absolute"){return t.left=this.x+"px",t.top=this.y+"px",t.width=Math.max(0,this.width)+"px",t.height=Math.max(0,this.height)+"px",t.position=e,t}contains(t,e){return this.x<=t&&t<=this.getRight()&&this.y<=e&&e<=this.getBottom()}removeInsets(t){return new s(this.x+t.left,this.y+t.top,Math.max(0,this.width-t.left-t.right),Math.max(0,this.height-t.top-t.bottom))}centerInRect(t){this.x=(t.width-this.width)/2,this.y=(t.height-this.height)/2}_getSize(t){let e=this.width;return t===i.VERT&&(e=this.height),e}toString(){return"(Rect: x="+this.x+", y="+this.y+", width="+this.width+", height="+this.height+")"}}class r{static getByName(t){return r.values[t]}static getLocation(t,e,i){if(e=(e-t.x)/t.width,i=(i-t.y)/t.height,e>=.25&&e<.75&&i>=.25&&i<.75)return r.CENTER;const s=i>=1-e;return i>=e?s?r.BOTTOM:r.LEFT:s?r.RIGHT:r.TOP}constructor(t,e,i){this._name=t,this._orientation=e,this._indexPlus=i,r.values[this._name]=this}getName(){return this._name}getOrientation(){return this._orientation}getDockRect(t){return this===r.TOP?new s(t.x,t.y,t.width,t.height/2):this===r.BOTTOM?new s(t.x,t.getBottom()-t.height/2,t.width,t.height/2):this===r.LEFT?new s(t.x,t.y,t.width/2,t.height):this===r.RIGHT?new s(t.getRight()-t.width/2,t.y,t.width/2,t.height):t.clone()}split(t,e){return this===r.TOP?{start:new s(t.x,t.y,t.width,e),end:new s(t.x,t.y+e,t.width,t.height-e)}:this===r.LEFT?{start:new s(t.x,t.y,e,t.height),end:new s(t.x+e,t.y,t.width-e,t.height)}:this===r.RIGHT?{start:new s(t.getRight()-e,t.y,e,t.height),end:new s(t.x,t.y,t.width-e,t.height)}:{start:new s(t.x,t.getBottom()-e,t.width,e),end:new s(t.x,t.y,t.width,t.height-e)}}reflect(){return this===r.TOP?r.BOTTOM:this===r.LEFT?r.RIGHT:this===r.RIGHT?r.LEFT:r.TOP}toString(){return"(DockLocation: name="+this._name+", orientation="+this._orientation+")"}}r.values={},r.TOP=new r("top",i.VERT,0),r.BOTTOM=new r("bottom",i.VERT,1),r.LEFT=new r("left",i.HORZ,0),r.RIGHT=new r("right",i.HORZ,1),r.CENTER=new r("center",i.VERT,0);const a=!("undefined"==typeof window||!window.document||!window.document.createElement);class d{constructor(){this._manualGlassManagement=!1,this._startX=0,this._startY=0,this._dragDepth=0,this._glassShowing=!1,this._dragging=!1,this._active=!1,a&&(this._glass=document.createElement("div"),this._glass.style.zIndex="998",this._glass.style.backgroundColor="transparent",this._glass.style.outline="none"),this._defaultGlassCursor="default",this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._onKeyPress=this._onKeyPress.bind(this),this._onDragCancel=this._onDragCancel.bind(this),this._onDragEnter=this._onDragEnter.bind(this),this._onDragLeave=this._onDragLeave.bind(this),this.resizeGlass=this.resizeGlass.bind(this),this._lastClick=0,this._clickX=0,this._clickY=0}addGlass(t){var e;this._glassShowing?this._manualGlassManagement=!0:(this._document||(this._document=window.document),this._rootElement||(this._rootElement=this._document.body),this.resizeGlass(),null===(e=this._document.defaultView)||void 0===e||e.addEventListener("resize",this.resizeGlass),this._document.body.appendChild(this._glass),this._glass.tabIndex=-1,this._glass.focus(),this._glass.addEventListener("keydown",this._onKeyPress),this._glass.addEventListener("dragenter",this._onDragEnter,{passive:!1}),this._glass.addEventListener("dragover",this._onMouseMove,{passive:!1}),this._glass.addEventListener("dragleave",this._onDragLeave,{passive:!1}),this._glassShowing=!0,this._fDragCancel=t,this._manualGlassManagement=!1)}resizeGlass(){s.fromElement(this._rootElement).positionElement(this._glass,"fixed")}hideGlass(){var t;this._glassShowing&&(this._document.body.removeChild(this._glass),null===(t=this._document.defaultView)||void 0===t||t.removeEventListener("resize",this.resizeGlass),this._glassShowing=!1,this._document=void 0,this._rootElement=void 0,this.setGlassCursorOverride(void 0))}_updateGlassCursor(){var t;this._glass.style.cursor=null!==(t=this._glassCursorOverride)&&void 0!==t?t:this._defaultGlassCursor}_setDefaultGlassCursor(t){this._defaultGlassCursor=t,this._updateGlassCursor()}setGlassCursorOverride(t){this._glassCursorOverride=t,this._updateGlassCursor()}startDrag(t,e,i,s,o,n,r,a,d){if(t&&this._lastEvent&&this._lastEvent.type.startsWith("touch")&&t.type.startsWith("mouse")&&t.timeStamp-this._lastEvent.timeStamp<500)return;if(this._dragging)return;this._lastEvent=t,this._document=a||window.document,this._rootElement=d||this._document.body;const l=this._getLocationEvent(t);this.addGlass(o),t?(this._startX=l.clientX,this._startY=l.clientY,window.matchMedia&&!window.matchMedia("(pointer: fine)").matches||this._setDefaultGlassCursor(getComputedStyle(t.target).cursor),this._stopPropagation(t),this._preventDefault(t)):(this._startX=0,this._startY=0,this._setDefaultGlassCursor("default")),this._dragging=!1,this._fDragStart=e,this._fDragMove=i,this._fDragEnd=s,this._fDragCancel=o,this._fClick=n,this._fDblClick=r,this._active=!0,"dragenter"===(null==t?void 0:t.type)?(this._dragDepth=1,this._rootElement.addEventListener("dragenter",this._onDragEnter,{passive:!1}),this._rootElement.addEventListener("dragover",this._onMouseMove,{passive:!1}),this._rootElement.addEventListener("dragleave",this._onDragLeave,{passive:!1}),this._document.addEventListener("dragend",this._onDragCancel,{passive:!1}),this._document.addEventListener("drop",this._onMouseUp,{passive:!1})):(this._document.addEventListener("mouseup",this._onMouseUp,{passive:!1}),this._document.addEventListener("mousemove",this._onMouseMove,{passive:!1}),this._document.addEventListener("touchend",this._onMouseUp,{passive:!1}),this._document.addEventListener("touchmove",this._onMouseMove,{passive:!1}))}isDragging(){return this._dragging}isActive(){return this._active}toString(){return"(DragDrop: startX="+this._startX+", startY="+this._startY+", dragging="+this._dragging+")"}_onKeyPress(t){27===t.keyCode&&this._onDragCancel()}_onDragCancel(){this._rootElement.removeEventListener("dragenter",this._onDragEnter),this._rootElement.removeEventListener("dragover",this._onMouseMove),this._rootElement.removeEventListener("dragleave",this._onDragLeave),this._document.removeEventListener("dragend",this._onDragCancel),this._document.removeEventListener("drop",this._onMouseUp),this._document.removeEventListener("mousemove",this._onMouseMove),this._document.removeEventListener("mouseup",this._onMouseUp),this._document.removeEventListener("touchend",this._onMouseUp),this._document.removeEventListener("touchmove",this._onMouseMove),this.hideGlass(),void 0!==this._fDragCancel&&this._fDragCancel(this._dragging),this._dragging=!1,this._active=!1}_getLocationEvent(t){let e=t;return t&&t.touches&&(e=t.touches[0]),e}_getLocationEventEnd(t){let e=t;return t.changedTouches&&(e=t.changedTouches[0]),e}_stopPropagation(t){t.stopPropagation&&t.stopPropagation()}_preventDefault(t){return t.preventDefault&&t.cancelable&&t.preventDefault(),t}_onMouseMove(t){this._lastEvent=t;const e=this._getLocationEvent(t);return this._stopPropagation(t),this._preventDefault(t),!this._dragging&&(Math.abs(this._startX-e.clientX)>5||Math.abs(this._startY-e.clientY)>5)&&(this._dragging=!0,this._fDragStart&&(this._setDefaultGlassCursor("move"),this._dragging=this._fDragStart({clientX:this._startX,clientY:this._startY}))),this._dragging&&this._fDragMove&&this._fDragMove(e),!1}_onMouseUp(t){this._lastEvent=t;const e=this._getLocationEventEnd(t);if(this._stopPropagation(t),this._preventDefault(t),this._active=!1,this._rootElement.removeEventListener("dragenter",this._onDragEnter),this._rootElement.removeEventListener("dragover",this._onMouseMove),this._rootElement.removeEventListener("dragleave",this._onDragLeave),this._document.removeEventListener("dragend",this._onDragCancel),this._document.removeEventListener("drop",this._onMouseUp),this._document.removeEventListener("mousemove",this._onMouseMove),this._document.removeEventListener("mouseup",this._onMouseUp),this._document.removeEventListener("touchend",this._onMouseUp),this._document.removeEventListener("touchmove",this._onMouseMove),this._manualGlassManagement||this.hideGlass(),this._dragging)this._dragging=!1,this._fDragEnd&&this._fDragEnd(t);else if(this._fDragCancel&&this._fDragCancel(this._dragging),Math.abs(this._startX-e.clientX)<=5&&Math.abs(this._startY-e.clientY)<=5){let i=!1;const s=(new Date).getTime();Math.abs(this._clickX-e.clientX)<=5&&Math.abs(this._clickY-e.clientY)<=5&&s-this._lastClick<500&&this._fDblClick&&(this._fDblClick(t),i=!0),!i&&this._fClick&&this._fClick(t),this._lastClick=s,this._clickX=e.clientX,this._clickY=e.clientY}return!1}_onDragEnter(t){return this._preventDefault(t),this._stopPropagation(t),this._dragDepth++,!1}_onDragLeave(t){return this._preventDefault(t),this._stopPropagation(t),this._dragDepth--,this._dragDepth<=0&&this._onDragCancel(),!1}}d.instance=new d;class l{constructor(t,e){this.type=t,this.data=e}}class h{static addNode(t,e,i,s,o){return new l(h.ADD_NODE,{json:t,toNode:e,location:i.getName(),index:s,select:o})}static moveNode(t,e,i,s,o){return new l(h.MOVE_NODE,{fromNode:t,toNode:e,location:i.getName(),index:s,select:o})}static deleteTab(t){return new l(h.DELETE_TAB,{node:t})}static deleteTabset(t){return new l(h.DELETE_TABSET,{node:t})}static renameTab(t,e){return new l(h.RENAME_TAB,{node:t,text:e})}static selectTab(t){return new l(h.SELECT_TAB,{tabNode:t})}static setActiveTabset(t){return new l(h.SET_ACTIVE_TABSET,{tabsetNode:t})}static adjustSplit(t){const e=t.node1Id,i=t.node2Id;return new l(h.ADJUST_SPLIT,{node1:e,weight1:t.weight1,pixelWidth1:t.pixelWidth1,node2:i,weight2:t.weight2,pixelWidth2:t.pixelWidth2})}static adjustBorderSplit(t,e){return new l(h.ADJUST_BORDER_SPLIT,{node:t,pos:e})}static maximizeToggle(t){return new l(h.MAXIMIZE_TOGGLE,{node:t})}static updateModelAttributes(t){return new l(h.UPDATE_MODEL_ATTRIBUTES,{json:t})}static updateNodeAttributes(t,e){return new l(h.UPDATE_NODE_ATTRIBUTES,{node:t,json:e})}static floatTab(t){return new l(h.FLOAT_TAB,{node:t})}static unFloatTab(t){return new l(h.UNFLOAT_TAB,{node:t})}}h.ADD_NODE="FlexLayout_AddNode",h.MOVE_NODE="FlexLayout_MoveNode",h.DELETE_TAB="FlexLayout_DeleteTab",h.DELETE_TABSET="FlexLayout_DeleteTabset",h.RENAME_TAB="FlexLayout_RenameTab",h.SELECT_TAB="FlexLayout_SelectTab",h.SET_ACTIVE_TABSET="FlexLayout_SetActiveTabset",h.ADJUST_SPLIT="FlexLayout_AdjustSplit",h.ADJUST_BORDER_SPLIT="FlexLayout_AdjustBorderSplit",h.MAXIMIZE_TOGGLE="FlexLayout_MaximizeToggle",h.UPDATE_MODEL_ATTRIBUTES="FlexLayout_UpdateModelAttributes",h.UPDATE_NODE_ATTRIBUTES="FlexLayout_UpdateNodeAttributes",h.FLOAT_TAB="FlexLayout_FloatTab",h.UNFLOAT_TAB="FlexLayout_UnFloatTab";class _{constructor(t,e,i,s){this.name=t,this.modelName=e,this.defaultValue=i,this.alwaysWriteJson=s,this.required=!1,this.fixed=!1,this.type="any"}setType(t){return this.type=t,this}setRequired(){return this.required=!0,this}setFixed(){return this.fixed=!0,this}}_.NUMBER="number",_.STRING="string",_.BOOLEAN="boolean";class c{constructor(){this.attributes=[],this.nameToAttribute={}}addWithAll(t,e,i,s){const o=new _(t,e,i,s);return this.attributes.push(o),this.nameToAttribute[t]=o,o}addInherited(t,e){return this.addWithAll(t,e,void 0,!1)}add(t,e,i){return this.addWithAll(t,void 0,e,i)}getAttributes(){return this.attributes}getModelName(t){const e=this.nameToAttribute[t];if(void 0!==e)return e.modelName}toJson(t,e){for(const i of this.attributes){const s=e[i.name];(i.alwaysWriteJson||s!==i.defaultValue)&&(t[i.name]=s)}}fromJson(t,e){for(const i of this.attributes){const s=t[i.name];e[i.name]=void 0===s?i.defaultValue:s}}update(t,e){for(const i of this.attributes)if(t.hasOwnProperty(i.name)){const s=t[i.name];void 0===s?delete e[i.name]:e[i.name]=s}}setDefaults(t){for(const e of this.attributes)t[e.name]=e.defaultValue}toTypescriptInterface(t,e){const i=[],s=this.attributes.sort(((t,e)=>t.name.localeCompare(e.name)));i.push("export interface I"+t+"Attributes {");for(let t=0;t<s.length;t++){const o=s[t];let n,r,a=o.type,d=o;void 0!==d.defaultValue?n=d.defaultValue:void 0!==d.modelName&&void 0!==e&&void 0!==e.nameToAttribute[d.modelName]&&(r=d.modelName,d=e.nameToAttribute[d.modelName],n=d.defaultValue,a=d.type);let l=JSON.stringify(n);const h=d.required||d.fixed?"":"?";if(o.fixed)i.push("\t"+o.name+": "+l+";");else{const t=(void 0!==n?"default: "+l:"")+(void 0!==r?" - inherited from global "+r:"");i.push("\t"+o.name+h+": "+a+";"+(t.length>0?" // "+t:""))}}return i.push("}"),i.join("\n")}}class u{constructor(t,e,i,s,o){this.node=t,this.rect=e,this.location=i,this.index=s,this.className=o}}var g,T,E;!function(t){t.FLEXLAYOUT__BORDER="flexlayout__border",t.FLEXLAYOUT__BORDER_="flexlayout__border_",t.FLEXLAYOUT__BORDER_BUTTON="flexlayout__border_button",t.FLEXLAYOUT__BORDER_BUTTON_="flexlayout__border_button_",t.FLEXLAYOUT__BORDER_BUTTON_CONTENT="flexlayout__border_button_content",t.FLEXLAYOUT__BORDER_BUTTON_LEADING="flexlayout__border_button_leading",t.FLEXLAYOUT__BORDER_BUTTON_TRAILING="flexlayout__border_button_trailing",t.FLEXLAYOUT__BORDER_BUTTON__SELECTED="flexlayout__border_button--selected",t.FLEXLAYOUT__BORDER_BUTTON__UNSELECTED="flexlayout__border_button--unselected",t.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW="flexlayout__border_toolbar_button_overflow",t.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_="flexlayout__border_toolbar_button_overflow_",t.FLEXLAYOUT__BORDER_INNER="flexlayout__border_inner",t.FLEXLAYOUT__BORDER_INNER_="flexlayout__border_inner_",t.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER="flexlayout__border_inner_tab_container",t.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_="flexlayout__border_inner_tab_container_",t.FLEXLAYOUT__BORDER_TAB_DIVIDER="flexlayout__border_tab_divider",t.FLEXLAYOUT__BORDER_SIZER="flexlayout__border_sizer",t.FLEXLAYOUT__BORDER_TOOLBAR="flexlayout__border_toolbar",t.FLEXLAYOUT__BORDER_TOOLBAR_="flexlayout__border_toolbar_",t.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON="flexlayout__border_toolbar_button",t.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT="flexlayout__border_toolbar_button-float",t.FLEXLAYOUT__DRAG_RECT="flexlayout__drag_rect",t.FLEXLAYOUT__EDGE_RECT="flexlayout__edge_rect",t.FLEXLAYOUT__EDGE_RECT_TOP="flexlayout__edge_rect_top",t.FLEXLAYOUT__EDGE_RECT_LEFT="flexlayout__edge_rect_left",t.FLEXLAYOUT__EDGE_RECT_BOTTOM="flexlayout__edge_rect_bottom",t.FLEXLAYOUT__EDGE_RECT_RIGHT="flexlayout__edge_rect_right",t.FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER="flexlayout__error_boundary_container",t.FLEXLAYOUT__ERROR_BOUNDARY_CONTENT="flexlayout__error_boundary_content",t.FLEXLAYOUT__FLOATING_WINDOW_CONTENT="flexlayout__floating_window_content",t.FLEXLAYOUT__FLOATING_WINDOW_TAB="flexlayout__floating_window_tab",t.FLEXLAYOUT__LAYOUT="flexlayout__layout",t.FLEXLAYOUT__OUTLINE_RECT="flexlayout__outline_rect",t.FLEXLAYOUT__OUTLINE_RECT_EDGE="flexlayout__outline_rect_edge",t.FLEXLAYOUT__SPLITTER="flexlayout__splitter",t.FLEXLAYOUT__SPLITTER_EXTRA="flexlayout__splitter_extra",t.FLEXLAYOUT__SPLITTER_="flexlayout__splitter_",t.FLEXLAYOUT__SPLITTER_BORDER="flexlayout__splitter_border",t.FLEXLAYOUT__SPLITTER_DRAG="flexlayout__splitter_drag",t.FLEXLAYOUT__TAB="flexlayout__tab",t.FLEXLAYOUT__TABSET="flexlayout__tabset",t.FLEXLAYOUT__TABSET_HEADER="flexlayout__tabset_header",t.FLEXLAYOUT__TABSET_HEADER_SIZER="flexlayout__tabset_header_sizer",t.FLEXLAYOUT__TABSET_HEADER_CONTENT="flexlayout__tabset_header_content",t.FLEXLAYOUT__TABSET_MAXIMIZED="flexlayout__tabset-maximized",t.FLEXLAYOUT__TABSET_SELECTED="flexlayout__tabset-selected",t.FLEXLAYOUT__TABSET_SIZER="flexlayout__tabset_sizer",t.FLEXLAYOUT__TABSET_TAB_DIVIDER="flexlayout__tabset_tab_divider",t.FLEXLAYOUT__TABSET_CONTENT="flexlayout__tabset_content",t.FLEXLAYOUT__TABSET_TABBAR_INNER="flexlayout__tabset_tabbar_inner",t.FLEXLAYOUT__TABSET_TABBAR_INNER_="flexlayout__tabset_tabbar_inner_",t.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER="flexlayout__tabset_tabbar_inner_tab_container",t.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_="flexlayout__tabset_tabbar_inner_tab_container_",t.FLEXLAYOUT__TABSET_TABBAR_OUTER="flexlayout__tabset_tabbar_outer",t.FLEXLAYOUT__TABSET_TABBAR_OUTER_="flexlayout__tabset_tabbar_outer_",t.FLEXLAYOUT__TAB_BORDER="flexlayout__tab_border",t.FLEXLAYOUT__TAB_BORDER_="flexlayout__tab_border_",t.FLEXLAYOUT__TAB_BUTTON="flexlayout__tab_button",t.FLEXLAYOUT__TAB_BUTTON_CONTENT="flexlayout__tab_button_content",t.FLEXLAYOUT__TAB_BUTTON_LEADING="flexlayout__tab_button_leading",t.FLEXLAYOUT__TAB_BUTTON_OVERFLOW="flexlayout__tab_button_overflow",t.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT="flexlayout__tab_button_overflow_count",t.FLEXLAYOUT__TAB_BUTTON_TEXTBOX="flexlayout__tab_button_textbox",t.FLEXLAYOUT__TAB_BUTTON_TRAILING="flexlayout__tab_button_trailing",t.FLEXLAYOUT__TAB_BUTTON_STAMP="flexlayout__tab_button_stamp",t.FLEXLAYOUT__TAB_FLOATING="flexlayout__tab_floating",t.FLEXLAYOUT__TAB_FLOATING_INNER="flexlayout__tab_floating_inner",t.FLEXLAYOUT__TAB_TOOLBAR="flexlayout__tab_toolbar",t.FLEXLAYOUT__TAB_TOOLBAR_BUTTON="flexlayout__tab_toolbar_button",t.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_="flexlayout__tab_toolbar_button-",t.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT="flexlayout__tab_toolbar_button-float",t.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER="flexlayout__tab_toolbar_sticky_buttons_container",t.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE="flexlayout__tab_toolbar_button-close",t.FLEXLAYOUT__POPUP_MENU_CONTAINER="flexlayout__popup_menu_container",t.FLEXLAYOUT__POPUP_MENU_ITEM="flexlayout__popup_menu_item",t.FLEXLAYOUT__POPUP_MENU="flexlayout__popup_menu"}(g||(g={}));class p{constructor(t){this._dirty=!1,this._tempSize=0,this._model=t,this._attributes={},this._children=[],this._fixed=!1,this._rect=s.empty(),this._visible=!1,this._listeners={}}getId(){let t=this._attributes.id;return void 0!==t||(t=this._model._nextUniqueId(),this._setId(t)),t}getModel(){return this._model}getType(){return this._attributes.type}getParent(){return this._parent}getChildren(){return this._children}getRect(){return this._rect}isVisible(){return this._visible}getOrientation(){return void 0===this._parent?this._model.isRootOrientationVertical()?i.VERT:i.HORZ:i.flip(this._parent.getOrientation())}setEventListener(t,e){this._listeners[t]=e}removeEventListener(t){delete this._listeners[t]}_setId(t){this._attributes.id=t}_fireEvent(t,e){void 0!==this._listeners[t]&&this._listeners[t](e)}_getAttr(t){let e=this._attributes[t];if(void 0===e){const i=this._getAttributeDefinitions().getModelName(t);void 0!==i&&(e=this._model._getAttribute(i))}return e}_forEachNode(t,e){t(this,e),e++;for(const i of this._children)i._forEachNode(t,e)}_setVisible(t){t!==this._visible&&(this._fireEvent("visibility",{visible:t}),this._visible=t)}_getDrawChildren(){return this._children}_setParent(t){this._parent=t}_setRect(t){this._rect=t}_setWeight(t){this._attributes.weight=t}_setSelected(t){this._attributes.selected=t}_isFixed(){return this._fixed}_layout(t,e){this._rect=t}_findDropTargetNode(t,e,i){let s;if(this._rect.contains(e,i))if(void 0!==this._model.getMaximizedTabset())s=this._model.getMaximizedTabset().canDrop(t,e,i);else if(s=this.canDrop(t,e,i),void 0===s&&0!==this._children.length)for(const o of this._children)if(s=o._findDropTargetNode(t,e,i),void 0!==s)break;return s}canDrop(t,e,i){}_canDockInto(t,e){if(null!=e){if(e.location===r.CENTER&&!1===e.node.isEnableDrop())return!1;if(e.location===r.CENTER&&"tabset"===t.getType()&&void 0!==t.getName())return!1;if(e.location!==r.CENTER&&!1===e.node.isEnableDivide())return!1;if(this._model._getOnAllowDrop())return this._model._getOnAllowDrop()(t,e)}return!0}_removeChild(t){const e=this._children.indexOf(t);return-1!==e&&this._children.splice(e,1),this._dirty=!0,e}_addChild(t,e){return null!=e?this._children.splice(e,0,t):(this._children.push(t),e=this._children.length-1),t._parent=this,this._dirty=!0,e}_removeAll(){this._children=[],this._dirty=!0}_styleWithPosition(t){return null==t&&(t={}),this._rect.styleWithPosition(t)}_getTempSize(){return this._tempSize}_setTempSize(t){this._tempSize=t}isEnableDivide(){return!0}_toAttributeString(){return JSON.stringify(this._attributes,void 0,"\t")}}class m extends p{constructor(t){super(t),this._fixed=!0,this._attributes.type=m.TYPE,t._addNode(this)}getWidth(){return this._model.getSplitterSize()}getMinWidth(){return this.getOrientation()===i.VERT?this._model.getSplitterSize():0}getHeight(){return this._model.getSplitterSize()}getMinHeight(){return this.getOrientation()===i.HORZ?this._model.getSplitterSize():0}getMinSize(t){return t===i.HORZ?this.getMinWidth():this.getMinHeight()}getWeight(){return 0}_setWeight(t){}_getPrefSize(t){return this._model.getSplitterSize()}_updateAttrs(t){}_getAttributeDefinitions(){return new c}toJson(){}}m.TYPE="splitter";class b extends p{static _fromJson(t,e,i=!0){return new b(e,t,i)}static _createAttributeDefinitions(){const t=new c;return t.add("type",b.TYPE,!0).setType(_.STRING),t.add("id",void 0).setType(_.STRING),t.add("name","[Unnamed Tab]").setType(_.STRING),t.add("altName",void 0).setType(_.STRING),t.add("helpText",void 0).setType(_.STRING),t.add("component",void 0).setType(_.STRING),t.add("config",void 0).setType("any"),t.add("floating",!1).setType(_.BOOLEAN),t.addInherited("enableClose","tabEnableClose").setType(_.BOOLEAN),t.addInherited("closeType","tabCloseType").setType("ICloseType"),t.addInherited("enableDrag","tabEnableDrag").setType(_.BOOLEAN),t.addInherited("enableRename","tabEnableRename").setType(_.BOOLEAN),t.addInherited("className","tabClassName").setType(_.STRING),t.addInherited("contentClassName","tabContentClassName").setType(_.STRING),t.addInherited("icon","tabIcon").setType(_.STRING),t.addInherited("enableRenderOnDemand","tabEnableRenderOnDemand").setType(_.BOOLEAN),t.addInherited("enableFloat","tabEnableFloat").setType(_.BOOLEAN),t.addInherited("borderWidth","tabBorderWidth").setType(_.NUMBER),t.addInherited("borderHeight","tabBorderHeight").setType(_.NUMBER),t}constructor(t,e,i=!0){super(t),this._extra={},b._attributeDefinitions.fromJson(e,this._attributes),!0===i&&t._addNode(this)}getWindow(){return this._window}getTabRect(){return this._tabRect}_setTabRect(t){this._tabRect=t}_setRenderedName(t){this._renderedName=t}_getNameForOverflowMenu(){const t=this._getAttr("altName");return void 0!==t?t:this._renderedName}getName(){return this._getAttr("name")}getHelpText(){return this._getAttr("helpText")}getComponent(){return this._getAttr("component")}getConfig(){return this._attributes.config}getExtraData(){return this._extra}isFloating(){return this._getAttr("floating")}getIcon(){return this._getAttr("icon")}isEnableClose(){return this._getAttr("enableClose")}getCloseType(){return this._getAttr("closeType")}isEnableFloat(){return this._getAttr("enableFloat")}isEnableDrag(){return this._getAttr("enableDrag")}isEnableRename(){return this._getAttr("enableRename")}getClassName(){return this._getAttr("className")}getContentClassName(){return this._getAttr("contentClassName")}isEnableRenderOnDemand(){return this._getAttr("enableRenderOnDemand")}_setName(t){this._attributes.name=t,this._window&&this._window.document&&(this._window.document.title=t)}_setFloating(t){this._attributes.floating=t}_layout(t,e){t.equals(this._rect)||this._fireEvent("resize",{rect:t}),this._rect=t}_delete(){this._parent._remove(this),this._fireEvent("close",{})}toJson(){const t={};return b._attributeDefinitions.toJson(t,this._attributes),t}_updateAttrs(t){b._attributeDefinitions.update(t,this._attributes)}_getAttributeDefinitions(){return b._attributeDefinitions}_setWindow(t){this._window=t}_setBorderWidth(t){this._attributes.borderWidth=t}_setBorderHeight(t){this._attributes.borderHeight=t}static getAttributeDefinitions(){return b._attributeDefinitions}}b.TYPE="tab",b._attributeDefinitions=b._createAttributeDefinitions();class f extends p{static _fromJson(t,e){const i=new f(e,t);if(null!=t.children)for(const s of t.children)if(s.type===v.TYPE){const t=v._fromJson(s,e);i._addChild(t)}else{const t=f._fromJson(s,e);i._addChild(t)}return i}static _createAttributeDefinitions(){const t=new c;return t.add("type",f.TYPE,!0).setType(_.STRING).setFixed(),t.add("id",void 0).setType(_.STRING),t.add("weight",100).setType(_.NUMBER),t.add("width",void 0).setType(_.NUMBER),t.add("height",void 0).setType(_.NUMBER),t}constructor(t,e){super(t),this._dirty=!0,this._drawChildren=[],this._minHeight=0,this._minWidth=0,f._attributeDefinitions.fromJson(e,this._attributes),t._addNode(this)}getWeight(){return this._attributes.weight}getWidth(){return this._getAttr("width")}getHeight(){return this._getAttr("height")}_setWeight(t){this._attributes.weight=t}_layout(t,e){super._layout(t,e);const o=this._rect._getSize(this.getOrientation());let n=0,r=0,a=0,d=0;const l=this._getDrawChildren();for(const t of l){const e=t._getPrefSize(this.getOrientation());t._isFixed()?void 0!==e&&(r+=e):void 0===e?n+=t.getWeight():(a+=e,d+=t.getWeight())}let h=!1,_=o-r-a;_<0&&(_=o-r,h=!0,n+=d);let c=0,u=0;for(const t of l){const e=t._getPrefSize(this.getOrientation());if(t._isFixed())void 0!==e&&t._setTempSize(e);else if(null==e||h){if(0===n)t._setTempSize(0);else{const e=t.getMinSize(this.getOrientation()),i=Math.floor(_*(t.getWeight()/n));t._setTempSize(Math.max(e,i))}u+=t._getTempSize()}else t._setTempSize(e);c+=t._getTempSize()}if(u>0){for(;c<o;)for(const t of l)if(!(t instanceof m)){const e=t._getPrefSize(this.getOrientation());!t._isFixed()&&(void 0===e||h)&&c<o&&(t._setTempSize(t._getTempSize()+1),c++)}for(;c>o;){let t=!1;for(const e of l)if(!(e instanceof m)){const i=e.getMinSize(this.getOrientation());e._getTempSize()>i&&c>o&&(e._setTempSize(e._getTempSize()-1),c--,t=!0)}if(!t)break}for(;c>o;){let t=!1;for(const e of l)e instanceof m||e._getTempSize()>0&&c>o&&(e._setTempSize(e._getTempSize()-1),c--,t=!0);if(!t)break}}let g=0;for(const t of l)this.getOrientation()===i.HORZ?t._layout(new s(this._rect.x+g,this._rect.y,t._getTempSize(),this._rect.height),e):t._layout(new s(this._rect.x,this._rect.y+g,this._rect.width,t._getTempSize()),e),g+=t._getTempSize();return!0}_getSplitterBounds(t,e=!1){const s=[0,0],o=this._getDrawChildren(),n=o.indexOf(t),r=o[n-1],a=o[n+1];if(this.getOrientation()===i.HORZ){const i=e?r.getMinWidth():0,o=e?a.getMinWidth():0;s[0]=r.getRect().x+i,s[1]=a.getRect().getRight()-t.getWidth()-o}else{const i=e?r.getMinHeight():0,o=e?a.getMinHeight():0;s[0]=r.getRect().y+i,s[1]=a.getRect().getBottom()-t.getHeight()-o}return s}_calculateSplit(t,e){let i;const s=this._getDrawChildren(),o=s.indexOf(t),n=this._getSplitterBounds(t),r=s[o-1].getWeight()+s[o+1].getWeight(),a=Math.max(0,e-n[0]),d=Math.max(0,n[1]-e);if(a+d>0){const t=a*r/(a+d),e=d*r/(a+d);i={node1Id:s[o-1].getId(),weight1:t,pixelWidth1:a,node2Id:s[o+1].getId(),weight2:e,pixelWidth2:d}}return i}_getDrawChildren(){if(this._dirty){this._drawChildren=[];for(let t=0;t<this._children.length;t++){const e=this._children[t];if(0!==t){const t=new m(this._model);t._setParent(this),this._drawChildren.push(t)}this._drawChildren.push(e)}this._dirty=!1}return this._drawChildren}getMinSize(t){return t===i.HORZ?this.getMinWidth():this.getMinHeight()}getMinWidth(){return this._minWidth}getMinHeight(){return this._minHeight}calcMinSize(){this._minHeight=0,this._minWidth=0;let t=!0;for(const e of this._children){const s=e;s instanceof f&&s.calcMinSize(),this.getOrientation()===i.VERT?(this._minHeight+=s.getMinHeight(),t||(this._minHeight+=this._model.getSplitterSize()),this._minWidth=Math.max(this._minWidth,s.getMinWidth())):(this._minWidth+=s.getMinWidth(),t||(this._minWidth+=this._model.getSplitterSize()),this._minHeight=Math.max(this._minHeight,s.getMinHeight())),t=!1}}_tidy(){let t=0;for(;t<this._children.length;){const e=this._children[t];if(e instanceof f){e._tidy();const i=e.getChildren();if(0===i.length)this._removeChild(e);else if(1===i.length){const s=i[0];if(this._removeChild(e),s instanceof f){let i=0;const o=s.getChildren();for(const t of o)i+=t.getWeight();for(let s=0;s<o.length;s++){const n=o[s];n._setWeight(e.getWeight()*n.getWeight()/i),this._addChild(n,t+s)}}else s._setWeight(e.getWeight()),this._addChild(s,t)}else t++}else e instanceof v&&0===e.getChildren().length&&e.isEnableDeleteWhenEmpty()?(this._removeChild(e),e===this._model.getMaximizedTabset()&&this._model._setMaximizedTabset(void 0)):t++}if(this===this._model.getRoot()&&0===this._children.length){const t=this._model._getOnCreateTabSet();let e=t?t():{};e=Object.assign(Object.assign({},e),{selected:-1});const i=new v(this._model,e);this._model._setActiveTabset(i),this._addChild(i)}}canDrop(t,e,i){const s=i-this._rect.y,o=e-this._rect.x,n=this._rect.width,a=this._rect.height,d=50;let l;if(this._model.isEnableEdgeDock()&&void 0===this._parent){if(e<this._rect.x+10&&s>a/2-d&&s<a/2+d){const t=r.LEFT,e=t.getDockRect(this._rect);e.width=e.width/2,l=new u(this,e,t,-1,g.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(e>this._rect.getRight()-10&&s>a/2-d&&s<a/2+d){const t=r.RIGHT,e=t.getDockRect(this._rect);e.width=e.width/2,e.x+=e.width,l=new u(this,e,t,-1,g.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(i<this._rect.y+10&&o>n/2-d&&o<n/2+d){const t=r.TOP,e=t.getDockRect(this._rect);e.height=e.height/2,l=new u(this,e,t,-1,g.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(i>this._rect.getBottom()-10&&o>n/2-d&&o<n/2+d){const t=r.BOTTOM,e=t.getDockRect(this._rect);e.height=e.height/2,e.y+=e.height,l=new u(this,e,t,-1,g.FLEXLAYOUT__OUTLINE_RECT_EDGE)}if(void 0!==l&&!t._canDockInto(t,l))return}return l}drop(t,e,i){const s=e,o=t.getParent();let n;if(o&&o._removeChild(t),void 0!==o&&o.getType()===v.TYPE&&o._setSelected(0),void 0!==o&&o.getType()===R.TYPE&&o._setSelected(-1),t instanceof v)n=t;else{const e=this._model._getOnCreateTabSet();n=new v(this._model,e?e(t):{}),n._addChild(t)}let a=this._children.reduce(((t,e)=>t+e.getWeight()),0);0===a&&(a=100),n._setWeight(a/3);const d=!this._model.isRootOrientationVertical();if(d&&s===r.LEFT||!d&&s===r.TOP)this._addChild(n,0);else if(d&&s===r.RIGHT||!d&&s===r.BOTTOM)this._addChild(n);else if(d&&s===r.TOP||!d&&s===r.LEFT){const t=new f(this._model,{}),e=new f(this._model,{});e._setWeight(75),n._setWeight(25);for(const t of this._children)e._addChild(t);this._removeAll(),t._addChild(n),t._addChild(e),this._addChild(t)}else if(d&&s===r.BOTTOM||!d&&s===r.RIGHT){const t=new f(this._model,{}),e=new f(this._model,{});e._setWeight(75),n._setWeight(25);for(const t of this._children)e._addChild(t);this._removeAll(),t._addChild(e),t._addChild(n),this._addChild(t)}this._model._setActiveTabset(n),this._model._tidy()}toJson(){const t={};f._attributeDefinitions.toJson(t,this._attributes),t.children=[];for(const e of this._children)t.children.push(e.toJson());return t}isEnableDrop(){return!0}_getPrefSize(t){let e=this.getWidth();return t===i.VERT&&(e=this.getHeight()),e}_getAttributeDefinitions(){return f._attributeDefinitions}_updateAttrs(t){f._attributeDefinitions.update(t,this._attributes)}static getAttributeDefinitions(){return f._attributeDefinitions}}f.TYPE="row",f._attributeDefinitions=f._createAttributeDefinitions();class v extends p{static _fromJson(t,e){const i=new v(e,t);if(null!=t.children)for(const s of t.children){const t=b._fromJson(s,e);i._addChild(t)}return 0===i._children.length&&i._setSelected(-1),t.maximized&&!0===t.maximized&&e._setMaximizedTabset(i),t.active&&!0===t.active&&e._setActiveTabset(i),i}static _createAttributeDefinitions(){const t=new c;return t.add("type",v.TYPE,!0).setType(_.STRING).setFixed(),t.add("id",void 0).setType(_.STRING),t.add("weight",100).setType(_.NUMBER),t.add("width",void 0).setType(_.NUMBER),t.add("height",void 0).setType(_.NUMBER),t.add("selected",0).setType(_.NUMBER),t.add("name",void 0).setType(_.STRING),t.add("config",void 0).setType("any"),t.addInherited("enableDeleteWhenEmpty","tabSetEnableDeleteWhenEmpty"),t.addInherited("enableDrop","tabSetEnableDrop"),t.addInherited("enableDrag","tabSetEnableDrag"),t.addInherited("enableDivide","tabSetEnableDivide"),t.addInherited("enableMaximize","tabSetEnableMaximize"),t.addInherited("enableClose","tabSetEnableClose"),t.addInherited("classNameTabStrip","tabSetClassNameTabStrip"),t.addInherited("classNameHeader","tabSetClassNameHeader"),t.addInherited("enableTabStrip","tabSetEnableTabStrip"),t.addInherited("borderInsets","tabSetBorderInsets"),t.addInherited("marginInsets","tabSetMarginInsets"),t.addInherited("minWidth","tabSetMinWidth"),t.addInherited("minHeight","tabSetMinHeight"),t.addInherited("headerHeight","tabSetHeaderHeight"),t.addInherited("tabStripHeight","tabSetTabStripHeight"),t.addInherited("tabLocation","tabSetTabLocation"),t.addInherited("autoSelectTab","tabSetAutoSelectTab").setType(_.BOOLEAN),t}constructor(t,e){super(t),v._attributeDefinitions.fromJson(e,this._attributes),t._addNode(this),this._calculatedTabBarHeight=0,this._calculatedHeaderBarHeight=0}getName(){return this._getAttr("name")}getSelected(){const t=this._attributes.selected;return void 0!==t?t:-1}getSelectedNode(){const t=this.getSelected();if(-1!==t)return this._children[t]}getWeight(){return this._getAttr("weight")}getWidth(){return this._getAttr("width")}getMinWidth(){return this._getAttr("minWidth")}getHeight(){return this._getAttr("height")}getMinHeight(){return this._getAttr("minHeight")}getMinSize(t){return t===i.HORZ?this.getMinWidth():this.getMinHeight()}getConfig(){return this._attributes.config}isMaximized(){return this._model.getMaximizedTabset()===this}isActive(){return this._model.getActiveTabset()===this}isEnableDeleteWhenEmpty(){return this._getAttr("enableDeleteWhenEmpty")}isEnableDrop(){return this._getAttr("enableDrop")}isEnableDrag(){return this._getAttr("enableDrag")}isEnableDivide(){return this._getAttr("enableDivide")}isEnableMaximize(){return this._getAttr("enableMaximize")}isEnableClose(){return this._getAttr("enableClose")}canMaximize(){return!!this.isEnableMaximize()&&(this.getModel().getMaximizedTabset()===this||this.getParent()!==this.getModel().getRoot()||1!==this.getModel().getRoot().getChildren().length)}isEnableTabStrip(){return this._getAttr("enableTabStrip")}isAutoSelectTab(){return this._getAttr("autoSelectTab")}getClassNameTabStrip(){return this._getAttr("classNameTabStrip")}getClassNameHeader(){return this._getAttr("classNameHeader")}calculateHeaderBarHeight(t){const e=this._getAttr("headerHeight");this._calculatedHeaderBarHeight=0!==e?e:t.headerBarSize}calculateTabBarHeight(t){const e=this._getAttr("tabStripHeight");this._calculatedTabBarHeight=0!==e?e:t.tabBarSize}getHeaderHeight(){return this._calculatedHeaderBarHeight}getTabStripHeight(){return this._calculatedTabBarHeight}getTabLocation(){return this._getAttr("tabLocation")}_setWeight(t){this._attributes.weight=t}_setSelected(t){this._attributes.selected=t}canDrop(t,e,i){let o;if(t===this){const t=r.CENTER,e=this._tabHeaderRect;o=new u(this,e,t,-1,g.FLEXLAYOUT__OUTLINE_RECT)}else if(this._contentRect.contains(e,i)){let t=r.CENTER;void 0===this._model.getMaximizedTabset()&&(t=r.getLocation(this._contentRect,e,i));const s=t.getDockRect(this._rect);o=new u(this,s,t,-1,g.FLEXLAYOUT__OUTLINE_RECT)}else if(null!=this._tabHeaderRect&&this._tabHeaderRect.contains(e,i)){let t,i,n;if(0===this._children.length)t=this._tabHeaderRect.clone(),i=t.y+3,n=t.height-4,t.width=2;else{let a=this._children[0];t=a.getTabRect(),i=t.y,n=t.height;let d=this._tabHeaderRect.x,l=0;for(let h=0;h<this._children.length;h++){if(a=this._children[h],t=a.getTabRect(),l=t.x+t.width/2,e>=d&&e<l){const e=r.CENTER,a=new s(t.x-2,i,3,n);o=new u(this,a,e,h,g.FLEXLAYOUT__OUTLINE_RECT);break}d=l}}if(null==o){const e=r.CENTER,a=new s(t.getRight()-2,i,3,n);o=new u(this,a,e,this._children.length,g.FLEXLAYOUT__OUTLINE_RECT)}}if(t._canDockInto(t,o))return o}_layout(t,e){this.calculateHeaderBarHeight(e),this.calculateTabBarHeight(e),this.isMaximized()&&(t=this._model.getRoot().getRect()),t=t.removeInsets(this._getAttr("marginInsets")),this._rect=t,t=t.removeInsets(this._getAttr("borderInsets"));let i=0,o=0;void 0!==this.getName()&&(i+=this._calculatedHeaderBarHeight,o+=this._calculatedHeaderBarHeight),this.isEnableTabStrip()&&("top"===this.getTabLocation()?this._tabHeaderRect=new s(t.x,t.y+i,t.width,this._calculatedTabBarHeight):this._tabHeaderRect=new s(t.x,t.y+t.height-this._calculatedTabBarHeight,t.width,this._calculatedTabBarHeight),o+=this._calculatedTabBarHeight,"top"===this.getTabLocation()&&(i+=this._calculatedTabBarHeight)),this._contentRect=new s(t.x,t.y+i,t.width,t.height-o);for(let t=0;t<this._children.length;t++){const i=this._children[t];i._layout(this._contentRect,e),i._setVisible(t===this.getSelected())}}_delete(){this._parent._removeChild(this)}_remove(t){const e=this._removeChild(t);this._model._tidy(),O(this,e)}drop(t,e,i,s){const o=e;if(this===t)return;let n=t.getParent(),a=0;if(void 0!==n&&(a=n._removeChild(t),n instanceof R&&n.getSelected()===a?n._setSelected(-1):O(n,a)),t.getType()===b.TYPE&&n===this&&a<i&&i>0&&i--,o===r.CENTER){let e=i;if(-1===e&&(e=this._children.length),t.getType()===b.TYPE)this._addChild(t,e),(s||!1!==s&&this.isAutoSelectTab())&&this._setSelected(e);else{for(let i=0;i<t.getChildren().length;i++){const s=t.getChildren()[i];this._addChild(s,e),e++}-1===this.getSelected()&&this._children.length>0&&this._setSelected(0)}this._model._setActiveTabset(this)}else{let e;if(t instanceof b){const i=this._model._getOnCreateTabSet();e=new v(this._model,i?i(t):{}),e._addChild(t),n=e}else e=t;const i=this._parent,s=i.getChildren().indexOf(this);if(i.getOrientation()===o._orientation)e._setWeight(this.getWeight()/2),this._setWeight(this.getWeight()/2),i._addChild(e,s+o._indexPlus);else{const t=new f(this._model,{});t._setWeight(this.getWeight()),t._addChild(this),this._setWeight(50),e._setWeight(50),t._addChild(e,o._indexPlus),i._removeChild(this),i._addChild(t,s)}this._model._setActiveTabset(e)}this._model._tidy()}toJson(){const t={};return v._attributeDefinitions.toJson(t,this._attributes),t.children=this._children.map((t=>t.toJson())),this.isActive()&&(t.active=!0),this.isMaximized()&&(t.maximized=!0),t}_updateAttrs(t){v._attributeDefinitions.update(t,this._attributes)}_getAttributeDefinitions(){return v._attributeDefinitions}_getPrefSize(t){let e=this.getWidth();return t===i.VERT&&(e=this.getHeight()),e}static getAttributeDefinitions(){return v._attributeDefinitions}}function O(t,e){if(void 0!==t&&(t.getType()===v.TYPE||t.getType()===R.TYPE)){const i=t.getSelected();-1!==i&&(e===i&&t.getChildren().length>0?e>=t.getChildren().length&&t._setSelected(t.getChildren().length-1):e<i?t._setSelected(i-1):e>i||t._setSelected(-1))}}v.TYPE="tabset",v._attributeDefinitions=v._createAttributeDefinitions();class R extends p{static _fromJson(t,e){const i=r.getByName(t.location),s=new R(i,t,e);return t.children&&(s._children=t.children.map((t=>{const i=b._fromJson(t,e);return i._setParent(s),i}))),s}static _createAttributeDefinitions(){const t=new c;return t.add("type",R.TYPE,!0).setType(_.STRING).setFixed(),t.add("selected",-1).setType(_.NUMBER),t.add("show",!0).setType(_.BOOLEAN),t.add("config",void 0).setType("any"),t.addInherited("barSize","borderBarSize").setType(_.NUMBER),t.addInherited("enableDrop","borderEnableDrop").setType(_.BOOLEAN),t.addInherited("className","borderClassName").setType(_.STRING),t.addInherited("autoSelectTabWhenOpen","borderAutoSelectTabWhenOpen").setType(_.BOOLEAN),t.addInherited("autoSelectTabWhenClosed","borderAutoSelectTabWhenClosed").setType(_.BOOLEAN),t.addInherited("size","borderSize").setType(_.NUMBER),t.addInherited("minSize","borderMinSize").setType(_.NUMBER),t.addInherited("enableAutoHide","borderEnableAutoHide").setType(_.BOOLEAN),t}constructor(t,e,i){super(i),this._adjustedSize=0,this._calculatedBorderBarSize=0,this._location=t,this._drawChildren=[],this._attributes.id=`border_${t.getName()}`,R._attributeDefinitions.fromJson(e,this._attributes),i._addNode(this)}getLocation(){return this._location}getTabHeaderRect(){return this._tabHeaderRect}getRect(){return this._tabHeaderRect}getContentRect(){return this._contentRect}isEnableDrop(){return this._getAttr("enableDrop")}isAutoSelectTab(t){return null==t&&(t=-1!==this.getSelected()),t?this._getAttr("autoSelectTabWhenOpen"):this._getAttr("autoSelectTabWhenClosed")}getClassName(){return this._getAttr("className")}calcBorderBarSize(t){const e=this._getAttr("barSize");this._calculatedBorderBarSize=0!==e?e:t.borderBarSize}getBorderBarSize(){return this._calculatedBorderBarSize}getSize(){const t=this._getAttr("size"),e=this.getSelected();if(-1===e)return t;{const s=this._children[e],o=this._location._orientation===i.HORZ?s._getAttr("borderWidth"):s._getAttr("borderHeight");return-1===o?t:o}}getMinSize(){return this._getAttr("minSize")}getSelected(){return this._attributes.selected}getSelectedNode(){if(-1!==this.getSelected())return this._children[this.getSelected()]}getOrientation(){return this._location.getOrientation()}getConfig(){return this._attributes.config}isMaximized(){return!1}isShowing(){return!(!this._attributes.show||this._model._getShowHiddenBorder()!==this._location&&this.isAutoHide()&&0===this._children.length)}isAutoHide(){return this._getAttr("enableAutoHide")}_setSelected(t){this._attributes.selected=t}_setSize(t){const e=this.getSelected();if(-1===e)this._attributes.size=t;else{const s=this._children[e];-1===(this._location._orientation===i.HORZ?s._getAttr("borderWidth"):s._getAttr("borderHeight"))?this._attributes.size=t:this._location._orientation===i.HORZ?s._setBorderWidth(t):s._setBorderHeight(t)}}_updateAttrs(t){R._attributeDefinitions.update(t,this._attributes)}_getDrawChildren(){return this._drawChildren}_setAdjustedSize(t){this._adjustedSize=t}_getAdjustedSize(){return this._adjustedSize}_layoutBorderOuter(t,e){this.calcBorderBarSize(e);const i=this._location.split(t,this.getBorderBarSize());return this._tabHeaderRect=i.start,i.end}_layoutBorderInner(t,e){this._drawChildren=[];const i=this._location,s=i.split(t,this._adjustedSize+this._model.getSplitterSize()),o=i.reflect().split(s.start,this._model.getSplitterSize());this._contentRect=o.end;for(let t=0;t<this._children.length;t++){const i=this._children[t];i._layout(this._contentRect,e),i._setVisible(t===this.getSelected()),this._drawChildren.push(i)}if(-1===this.getSelected())return t;{const t=new m(this._model);return t._setParent(this),t._setRect(o.start),this._drawChildren.push(t),s.end}}_remove(t){const e=this._removeChild(t);-1!==this.getSelected()&&O(this,e)}canDrop(t,e,o){if(t.getType()!==b.TYPE)return;let n;const a=r.CENTER;if(this._tabHeaderRect.contains(e,o)){if(this._location._orientation===i.VERT)if(this._children.length>0){let t=this._children[0],i=t.getTabRect();const o=i.y,r=i.height;let d=this._tabHeaderRect.x,l=0;for(let h=0;h<this._children.length;h++){if(t=this._children[h],i=t.getTabRect(),l=i.x+i.width/2,e>=d&&e<l){const t=new s(i.x-2,o,3,r);n=new u(this,t,a,h,g.FLEXLAYOUT__OUTLINE_RECT);break}d=l}if(null==n){const t=new s(i.getRight()-2,o,3,r);n=new u(this,t,a,this._children.length,g.FLEXLAYOUT__OUTLINE_RECT)}}else{const t=new s(this._tabHeaderRect.x+1,this._tabHeaderRect.y+2,3,18);n=new u(this,t,a,0,g.FLEXLAYOUT__OUTLINE_RECT)}else if(this._children.length>0){let t=this._children[0],e=t.getTabRect();const i=e.x,r=e.width;let d=this._tabHeaderRect.y,l=0;for(let h=0;h<this._children.length;h++){if(t=this._children[h],e=t.getTabRect(),l=e.y+e.height/2,o>=d&&o<l){const t=new s(i,e.y-2,r,3);n=new u(this,t,a,h,g.FLEXLAYOUT__OUTLINE_RECT);break}d=l}if(null==n){const t=new s(i,e.getBottom()-2,r,3);n=new u(this,t,a,this._children.length,g.FLEXLAYOUT__OUTLINE_RECT)}}else{const t=new s(this._tabHeaderRect.x+2,this._tabHeaderRect.y+1,18,3);n=new u(this,t,a,0,g.FLEXLAYOUT__OUTLINE_RECT)}if(!t._canDockInto(t,n))return}else if(-1!==this.getSelected()&&this._contentRect.contains(e,o)){const e=this._contentRect;if(n=new u(this,e,a,-1,g.FLEXLAYOUT__OUTLINE_RECT),!t._canDockInto(t,n))return}return n}drop(t,e,i,s){let o=0;const n=t.getParent();void 0!==n&&(o=n._removeChild(t),n!==this&&n instanceof R&&n.getSelected()===o?n._setSelected(-1):O(n,o)),t.getType()===b.TYPE&&n===this&&o<i&&i>0&&i--;let r=i;-1===r&&(r=this._children.length),t.getType()===b.TYPE&&this._addChild(t,r),(s||!1!==s&&this.isAutoSelectTab())&&this._setSelected(r),this._model._tidy()}toJson(){const t={};return R._attributeDefinitions.toJson(t,this._attributes),t.location=this._location.getName(),t.children=this._children.map((t=>t.toJson())),t}_getSplitterBounds(t,e=!1){const i=[0,0],s=e?this.getMinSize():0,o=this._model._getOuterInnerRects().outer,n=this._model._getOuterInnerRects().inner,a=this._model.getRoot();return this._location===r.TOP?(i[0]=o.y+s,i[1]=Math.max(i[0],n.getBottom()-t.getHeight()-a.getMinHeight())):this._location===r.LEFT?(i[0]=o.x+s,i[1]=Math.max(i[0],n.getRight()-t.getWidth()-a.getMinWidth())):this._location===r.BOTTOM?(i[1]=o.getBottom()-t.getHeight()-s,i[0]=Math.min(i[1],n.y+a.getMinHeight())):this._location===r.RIGHT&&(i[1]=o.getRight()-t.getWidth()-s,i[0]=Math.min(i[1],n.x+a.getMinWidth())),i}_calculateSplit(t,e){const i=this._getSplitterBounds(t);return this._location===r.BOTTOM||this._location===r.RIGHT?Math.max(0,i[1]-e):Math.max(0,e-i[0])}_getAttributeDefinitions(){return R._attributeDefinitions}static getAttributeDefinitions(){return R._attributeDefinitions}}function A(e,i,s,o,n){let r=s?s(i):void 0,a=i.getName(),d=i.getName();if(void 0===n&&(n=0),void 0!==o){const t=o(i);void 0!==t&&("string"==typeof t?(a=t,d=t):void 0!==t.titleContent?(a=t.titleContent,d=t.name):a=t)}void 0===r&&void 0!==i.getIcon()&&(r=0!==n?t.createElement("img",{style:{width:"1em",height:"1em",transform:"rotate("+n+"deg)"},src:i.getIcon(),alt:"leadingContent"}):t.createElement("img",{style:{width:"1em",height:"1em"},src:i.getIcon(),alt:"leadingContent"}));const l={leading:r,content:a,name:d,buttons:[]};return e.customizeTab(i,l),i._setRenderedName(l.name),l}function L(t,e){e?t.visibility="hidden":t.display="none"}function y(t){let e=!1;return t.nativeEvent instanceof MouseEvent&&(0!==t.nativeEvent.button||t.ctrlKey||t.altKey||t.metaKey||t.shiftKey)&&(e=!0),e}R.TYPE="border",R._attributeDefinitions=R._createAttributeDefinitions(),function(t){t.Close_Tab="Close",t.Close_Tabset="Close tabset",t.Move_Tab="Move: ",t.Move_Tabset="Move tabset",t.Maximize="Maximize tabset",t.Restore="Restore tabset",t.Float_Tab="Show selected tab in floating window",t.Overflow_Menu_Tooltip="Hidden tabs",t.Floating_Window_Message="This panel is shown in a floating window",t.Floating_Window_Show_Window="Show window",t.Floating_Window_Dock_Window="Dock window",t.Error_rendering_component="Error rendering component"}(T||(T={})),function(t){t[t.Visible=1]="Visible",t[t.Always=2]="Always",t[t.Selected=3]="Selected"}(E||(E={}));const N=e=>{const{layout:i,node:o,selected:n,border:r,iconFactory:a,titleFactory:d,icons:l,path:_}=e,c=t.useRef(null),u=t.useRef(null),p=t=>{y(t)||i.getEditingTab()||i.dragStart(t,void 0,o,o.isEnableDrag(),b,f)},m=t=>{y(t)&&i.auxMouseClick(o,t)},b=()=>{i.doAction(h.selectTab(o.getId()))},f=t=>{},v=t=>{(()=>{const t=o.getCloseType();return!!(n||t===E.Always||t===E.Visible&&window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches)})()?i.doAction(h.deleteTab(o.getId())):b()},O=t=>{t.stopPropagation()};t.useLayoutEffect((()=>{R(),i.getEditingTab()===o&&u.current.select()}));const R=()=>{const t=i.getDomRect(),e=c.current.getBoundingClientRect();o._setTabRect(new s(e.left-t.left,e.top-t.top,e.width,e.height))},L=t=>{t.stopPropagation()},N=i.getClassName;let S=N(g.FLEXLAYOUT__BORDER_BUTTON)+" "+N(g.FLEXLAYOUT__BORDER_BUTTON_+r);S+=n?" "+N(g.FLEXLAYOUT__BORDER_BUTTON__SELECTED):" "+N(g.FLEXLAYOUT__BORDER_BUTTON__UNSELECTED),void 0!==o.getClassName()&&(S+=" "+o.getClassName());let D=0;!1===o.getModel().isEnableRotateBorderIcons()&&("left"===r?D=90:"right"===r&&(D=-90));const B=A(i,o,a,d,D);let w=B.content?t.createElement("div",{className:N(g.FLEXLAYOUT__BORDER_BUTTON_CONTENT)},B.content):null;const C=B.leading?t.createElement("div",{className:N(g.FLEXLAYOUT__BORDER_BUTTON_LEADING)},B.leading):null;if(i.getEditingTab()===o&&(w=t.createElement("input",{ref:u,className:N(g.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":_+"/textbox",type:"text",autoFocus:!0,defaultValue:o.getName(),onKeyDown:t=>{27===t.keyCode?i.setEditingTab(void 0):13===t.keyCode&&(i.setEditingTab(void 0),i.doAction(h.renameTab(o.getId(),t.target.value)))},onMouseDown:L,onTouchStart:L})),o.isEnableClose()){const e=i.i18nName(T.Close_Tab);B.buttons.push(t.createElement("div",{key:"close","data-layout-path":_+"/button/close",title:e,className:N(g.FLEXLAYOUT__BORDER_BUTTON_TRAILING),onMouseDown:O,onClick:v,onTouchStart:O},"function"==typeof l.close?l.close(o):l.close))}return t.createElement("div",{ref:c,"data-layout-path":_,className:S,onMouseDown:p,onClick:m,onAuxClick:m,onContextMenu:t=>{i.showContextMenu(o,t)},onTouchStart:p,title:o.getHelpText()},C,w,B.buttons)},S=e=>{const{layout:i,node:s,iconFactory:o,titleFactory:n}=e,r=t.useRef(null),a=i.getClassName;let d=a(g.FLEXLAYOUT__TAB_BUTTON_STAMP);const l=A(i,s,o,n);let h=l.content?t.createElement("div",{className:a(g.FLEXLAYOUT__TAB_BUTTON_CONTENT)},l.content):s._getNameForOverflowMenu();const _=l.leading?t.createElement("div",{className:a(g.FLEXLAYOUT__TAB_BUTTON_LEADING)},l.leading):null;return t.createElement("div",{ref:r,className:d,title:s.getHelpText()},_,h)};function D(e,i,s,o,n,r){const a=o.getRootDiv(),l=o.getClassName,h=e.ownerDocument,_=e.getBoundingClientRect(),c=a.getBoundingClientRect(),u=h.createElement("div");u.className=l(g.FLEXLAYOUT__POPUP_MENU_CONTAINER),_.left<c.left+c.width/2?u.style.left=_.left-c.left+"px":u.style.right=c.right-_.right+"px",_.top<c.top+c.height/2?u.style.top=_.top-c.top+"px":u.style.bottom=c.bottom-_.bottom+"px",d.instance.addGlass((()=>T())),d.instance.setGlassCursorOverride("default"),a.appendChild(u);const T=()=>{o.hidePortal(),d.instance.hideGlass(),a.removeChild(u),u.removeEventListener("mousedown",E),h.removeEventListener("mousedown",p)},E=t=>{t.stopPropagation()},p=t=>{T()};u.addEventListener("mousedown",E),h.addEventListener("mousedown",p),o.showPortal(t.createElement(B,{currentDocument:h,onSelect:s,onHide:T,items:i,classNameMapper:l,layout:o,iconFactory:n,titleFactory:r}),u)}const B=e=>{const{items:i,onHide:s,onSelect:o,classNameMapper:n,layout:r,iconFactory:a,titleFactory:d}=e,l=i.map(((e,i)=>t.createElement("div",{key:e.index,className:n(g.FLEXLAYOUT__POPUP_MENU_ITEM),"data-layout-path":"/popup-menu/tb"+i,onClick:t=>((t,e)=>{o(t),s(),e.stopPropagation()})(e,t),title:e.node.getHelpText()},e.node.getModel().isLegacyOverflowMenu()?e.node._getNameForOverflowMenu():t.createElement(S,{node:e.node,layout:r,iconFactory:a,titleFactory:d}))));return t.createElement("div",{className:n(g.FLEXLAYOUT__POPUP_MENU),"data-layout-path":"/popup-menu"},l)},w=(e,o,n,r)=>{const a=t.useRef(!0),d=t.useRef(!1),l=t.useRef(new s(0,0,0,0)),h=t.useRef(null),[_,c]=t.useState(0),u=t.useRef(!1),[g,T]=t.useState([]),E=t.useRef(0);t.useLayoutEffect((()=>{u.current=!1}),[e.getSelectedNode(),e.getRect().width,e.getRect().height]),t.useLayoutEffect((()=>{O()})),t.useEffect((()=>{const t=h.current;return t.addEventListener("wheel",p,{passive:!1}),()=>{t.removeEventListener("wheel",p)}}),[]);const p=t=>{t.preventDefault()},m=t=>o===i.HORZ?t.x:t.y,b=t=>o===i.HORZ?t.getRight():t.getBottom(),f=t=>o===i.HORZ?t.width:t.height,O=()=>{!0===a.current&&(d.current=!1);const t=e instanceof v?e.getRect():e.getTabHeaderRect();let i=e.getChildren()[e.getChildren().length-1];const s=null===r.current?0:f(r.current.getBoundingClientRect());if(!0===a.current||0===E.current&&0!==g.length||t.width!==l.current.width||t.height!==l.current.height){E.current=g.length,l.current=t;const o=!(e instanceof v)||!0===e.isEnableTabStrip();let r=b(t)-s;if(null!==n.current&&(r-=f(n.current.getBoundingClientRect())),o&&e.getChildren().length>0){if(0===g.length&&0===_&&b(i.getTabRect())+2<r)return;let s=0;const o=e.getSelectedNode();if(o&&!u.current){const e=o.getTabRect(),i=m(e)-2,n=b(e)+2;f(e)+4>=r-m(t)?s=m(t)-i:(n>r||i<m(t))&&(i<m(t)&&(s=m(t)-i),n+s>r&&(s=r-n))}const n=Math.max(0,r-(b(i.getTabRect())+2+s)),l=Math.min(0,_+s+n),h=l-_,E=[];for(let i=0;i<e.getChildren().length;i++){const s=e.getChildren()[i];(m(s.getTabRect())+h<m(t)||b(s.getTabRect())+h>r)&&E.push({node:s,index:i})}E.length>0&&(d.current=!0),a.current=!1,T(E),c(l)}}else a.current=!0};return{selfRef:h,position:_,userControlledLeft:u,hiddenTabs:g,onMouseWheel:t=>{let e=0;e=Math.abs(t.deltaX)>Math.abs(t.deltaY)?-t.deltaX:-t.deltaY,1===t.deltaMode&&(e*=40),c(_+e),u.current=!0,t.stopPropagation()},tabsTruncated:d.current}},C=e=>{const{border:s,layout:o,iconFactory:n,titleFactory:a,icons:d,path:l}=e,_=t.useRef(null),c=t.useRef(null),u=t.useRef(null),{selfRef:E,position:p,userControlledLeft:m,hiddenTabs:b,onMouseWheel:f,tabsTruncated:v}=w(s,i.flip(s.getOrientation()),_,u),O=t=>{y(t)&&o.auxMouseClick(s,t)},R=t=>{t.stopPropagation()},A=t=>{const e=o.getShowOverflowMenu();void 0!==e?e(s,t,b,L):D(c.current,b,L,o,n,a),t.stopPropagation()},L=t=>{o.doAction(h.selectTab(t.node.getId())),m.current=!1},S=t=>{const e=s.getChildren()[s.getSelected()];void 0!==e&&o.doAction(h.floatTab(e.getId())),t.stopPropagation()},B=o.getClassName;let C=s.getTabHeaderRect().styleWithPosition({});const M=[],x=e=>{let i=s.getSelected()===e,r=s.getChildren()[e];M.push(t.createElement(N,{layout:o,border:s.getLocation().getName(),node:r,path:l+"/tb"+e,key:r.getId(),selected:i,iconFactory:n,titleFactory:a,icons:d})),e<s.getChildren().length-1&&M.push(t.createElement("div",{key:"divider"+e,className:B(g.FLEXLAYOUT__BORDER_TAB_DIVIDER)}))};for(let t=0;t<s.getChildren().length;t++)x(t);let U=B(g.FLEXLAYOUT__BORDER)+" "+B(g.FLEXLAYOUT__BORDER_+s.getLocation().getName());void 0!==s.getClassName()&&(U+=" "+s.getClassName());let F=[],I=[];const z={headerContent:void 0,buttons:F,stickyButtons:I,headerButtons:[],overflowPosition:void 0};if(o.customizeTabSet(s,z),F=z.buttons,void 0===z.overflowPosition&&(z.overflowPosition=I.length),I.length>0&&(v?F=[...I,...F]:M.push(t.createElement("div",{ref:u,key:"sticky_buttons_container",onMouseDown:R,onTouchStart:R,onDragStart:t=>{t.preventDefault()},className:B(g.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER)},I))),b.length>0){const e=o.i18nName(T.Overflow_Menu_Tooltip);let i;i="function"==typeof d.more?d.more(s,b):t.createElement(t.Fragment,null,d.more,t.createElement("div",{className:B(g.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT)},b.length)),F.splice(Math.min(z.overflowPosition,F.length),0,t.createElement("button",{key:"overflowbutton",ref:c,className:B(g.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+" "+B(g.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW)+" "+B(g.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_+s.getLocation().getName()),title:e,onClick:A,onMouseDown:R,onTouchStart:R},i))}const Y=s.getSelected();if(-1!==Y){const e=s.getChildren()[Y];if(void 0!==e&&o.isSupportsPopout()&&e.isEnableFloat()&&!e.isFloating()){const i=o.i18nName(T.Float_Tab);F.push(t.createElement("button",{key:"float",title:i,className:B(g.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+" "+B(g.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT),onClick:S,onMouseDown:R,onTouchStart:R},"function"==typeof d.popout?d.popout(e):d.popout))}}const X=t.createElement("div",{key:"toolbar",ref:_,className:B(g.FLEXLAYOUT__BORDER_TOOLBAR)+" "+B(g.FLEXLAYOUT__BORDER_TOOLBAR_+s.getLocation().getName())},F);C=o.styleFont(C);let H={};const P=s.getBorderBarSize()-1;return H=s.getLocation()===r.LEFT?{right:P,height:P,top:p}:s.getLocation()===r.RIGHT?{left:P,height:P,top:p}:{height:P,left:p},t.createElement("div",{ref:E,dir:"ltr",style:C,className:U,"data-layout-path":l,onClick:O,onAuxClick:O,onContextMenu:t=>{o.showContextMenu(s,t)},onWheel:f},t.createElement("div",{style:{height:P},className:B(g.FLEXLAYOUT__BORDER_INNER)+" "+B(g.FLEXLAYOUT__BORDER_INNER_+s.getLocation().getName())},t.createElement("div",{style:H,className:B(g.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER)+" "+B(g.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_+s.getLocation().getName())},M)),X)},M=e=>{const{layout:s,node:o,path:n}=e,r=t.useRef([]),a=t.useRef(void 0),l=o.getParent(),_=t=>{d.instance.setGlassCursorOverride(o.getOrientation()===i.HORZ?"ns-resize":"ew-resize"),d.instance.startDrag(t,u,T,p,c,void 0,void 0,s.getCurrentDocument(),s.getRootDiv()),r.current=l._getSplitterBounds(o,!0);const e=s.getRootDiv();a.current=s.getCurrentDocument().createElement("div"),a.current.style.position="absolute",a.current.className=s.getClassName(g.FLEXLAYOUT__SPLITTER_DRAG),a.current.style.cursor=o.getOrientation()===i.HORZ?"ns-resize":"ew-resize";const n=o.getRect();o.getOrientation()===i.VERT&&n.width<2?n.width=2:o.getOrientation()===i.HORZ&&n.height<2&&(n.height=2),n.positionElement(a.current),e.appendChild(a.current)},c=t=>{s.getRootDiv().removeChild(a.current)},u=()=>!0,T=t=>{const e=s.getDomRect(),n=t.clientX-e.left,r=t.clientY-e.top;a&&(o.getOrientation()===i.HORZ?a.current.style.top=m(r-4)+"px":a.current.style.left=m(n-4)+"px"),s.isRealtimeResize()&&E()},E=()=>{let t=0;if(a&&(t=o.getOrientation()===i.HORZ?a.current.offsetTop:a.current.offsetLeft),l instanceof R){const e=l._calculateSplit(o,t);s.doAction(h.adjustBorderSplit(o.getParent().getId(),e))}else{const e=l._calculateSplit(o,t);void 0!==e&&s.doAction(h.adjustSplit(e))}},p=()=>{E(),s.getRootDiv().removeChild(a.current)},m=t=>{const e=r.current;let i=t;return t<e[0]&&(i=e[0]),t>e[1]&&(i=e[1]),i},b=s.getClassName;let f=o.getRect();const v=f.styleWithPosition({cursor:o.getOrientation()===i.HORZ?"ns-resize":"ew-resize"});let O=b(g.FLEXLAYOUT__SPLITTER)+" "+b(g.FLEXLAYOUT__SPLITTER_+o.getOrientation().getName());l instanceof R?O+=" "+b(g.FLEXLAYOUT__SPLITTER_BORDER):void 0!==o.getModel().getMaximizedTabset()&&(v.display="none");const A=o.getModel().getSplitterExtra();if(0===A)return t.createElement("div",{style:v,"data-layout-path":n,className:O,onTouchStart:_,onMouseDown:_});{let e=f.clone();e.x=0,e.y=0,o.getOrientation()===i.VERT?e.width+=A:e.height+=A;const s=e.styleWithPosition({cursor:o.getOrientation()===i.HORZ?"ns-resize":"ew-resize"}),r=b(g.FLEXLAYOUT__SPLITTER_EXTRA);return t.createElement("div",{style:v,"data-layout-path":n,className:O},t.createElement("div",{style:s,className:r,onTouchStart:_,onMouseDown:_}))}};class x extends t.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,e){console.debug(t),console.debug(e)}render(){return this.state.hasError?t.createElement("div",{className:g.FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER},t.createElement("div",{className:g.FLEXLAYOUT__ERROR_BOUNDARY_CONTENT},this.props.message)):this.props.children}}const U=e=>{const{layout:i,selected:s,node:o,factory:n,path:r}=e,[a,d]=t.useState(!e.node.isEnableRenderOnDemand()||e.selected);t.useLayoutEffect((()=>{!a&&s&&d(!0)}));const l=()=>{const t=o.getParent();t.getType()===v.TYPE&&(t.isActive()||i.doAction(h.setActiveTabset(t.getId())))},_=i.getClassName,c=o.getModel().isUseVisibility(),u=o.getParent(),E=o._styleWithPosition();let p;s||L(E,c),u instanceof v&&(void 0===o.getModel().getMaximizedTabset()||u.isMaximized()||L(E,c)),a&&(p=n(o));let m=_(g.FLEXLAYOUT__TAB);return u instanceof R&&(m+=" "+_(g.FLEXLAYOUT__TAB_BORDER),m+=" "+_(g.FLEXLAYOUT__TAB_BORDER_+u.getLocation().getName())),void 0!==o.getContentClassName()&&(m+=" "+o.getContentClassName()),t.createElement("div",{className:m,"data-layout-path":r,onMouseDown:l,onTouchStart:l,style:E},t.createElement(x,{message:e.layout.i18nName(T.Error_rendering_component)},t.createElement(t.Fragment,null,p)))},F=e=>{const{layout:i,node:o,selected:n,iconFactory:r,titleFactory:a,icons:d,path:l}=e,_=t.useRef(null),c=t.useRef(null),u=t=>{y(t)||i.getEditingTab()||i.dragStart(t,void 0,o,o.isEnableDrag(),m,b)},p=t=>{y(t)&&i.auxMouseClick(o,t)},m=()=>{i.doAction(h.selectTab(o.getId()))},b=t=>{o.isEnableRename()&&f()},f=()=>{i.setEditingTab(o),i.getCurrentDocument().body.addEventListener("mousedown",v),i.getCurrentDocument().body.addEventListener("touchstart",v)},v=t=>{t.target!==c.current&&(i.getCurrentDocument().body.removeEventListener("mousedown",v),i.getCurrentDocument().body.removeEventListener("touchstart",v),i.setEditingTab(void 0))},O=t=>{(()=>{const t=o.getCloseType();return!!(n||t===E.Always||t===E.Visible&&window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches)})()?i.doAction(h.deleteTab(o.getId())):m()},R=t=>{t.stopPropagation()};t.useLayoutEffect((()=>{L(),i.getEditingTab()===o&&c.current.select()}));const L=()=>{const t=i.getDomRect(),e=_.current.getBoundingClientRect();o._setTabRect(new s(e.left-t.left,e.top-t.top,e.width,e.height))},N=t=>{t.stopPropagation()},S=i.getClassName,D=o.getParent();let B=g.FLEXLAYOUT__TAB_BUTTON,w=S(B);w+=" "+S(B+"_"+D.getTabLocation()),w+=n?" "+S(B+"--selected"):" "+S(B+"--unselected"),void 0!==o.getClassName()&&(w+=" "+o.getClassName());const C=A(i,o,r,a);let M=C.content?t.createElement("div",{className:S(g.FLEXLAYOUT__TAB_BUTTON_CONTENT)},C.content):null;const x=C.leading?t.createElement("div",{className:S(g.FLEXLAYOUT__TAB_BUTTON_LEADING)},C.leading):null;if(i.getEditingTab()===o&&(M=t.createElement("input",{ref:c,className:S(g.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":l+"/textbox",type:"text",autoFocus:!0,defaultValue:o.getName(),onKeyDown:t=>{27===t.keyCode?i.setEditingTab(void 0):13===t.keyCode&&(i.setEditingTab(void 0),i.doAction(h.renameTab(o.getId(),t.target.value)))},onMouseDown:N,onTouchStart:N})),o.isEnableClose()){const e=i.i18nName(T.Close_Tab);C.buttons.push(t.createElement("div",{key:"close","data-layout-path":l+"/button/close",title:e,className:S(g.FLEXLAYOUT__TAB_BUTTON_TRAILING),onMouseDown:R,onClick:O,onTouchStart:R},"function"==typeof d.close?d.close(o):d.close))}return t.createElement("div",{ref:_,"data-layout-path":l,className:w,onMouseDown:u,onClick:p,onAuxClick:p,onContextMenu:t=>{i.showContextMenu(o,t)},onTouchStart:u,title:o.getHelpText()},x,M,C.buttons)},I=e=>{const{node:s,layout:o,iconFactory:n,titleFactory:r,icons:a,path:d}=e,l=t.useRef(null),_=t.useRef(null),c=t.useRef(null),u=t.useRef(null),{selfRef:E,position:p,userControlledLeft:m,hiddenTabs:b,onMouseWheel:f,tabsTruncated:v}=w(s,i.HORZ,l,u),O=t=>{const e=o.getShowOverflowMenu();void 0!==e?e(s,t,b,R):D(_.current,b,R,o,n,r),t.stopPropagation()},R=t=>{o.doAction(h.selectTab(t.node.getId())),m.current=!1},A=t=>{if(!y(t)){let e=s.getName();if(e=void 0===e?"":": "+e,o.doAction(h.setActiveTabset(s.getId())),!o.getEditingTab()){const i=o.i18nName(T.Move_Tabset,e);void 0!==s.getModel().getMaximizedTabset()?o.dragStart(t,i,s,!1,(t=>{}),U):o.dragStart(t,i,s,s.isEnableDrag(),(t=>{}),U)}}},N=t=>{y(t)&&o.auxMouseClick(s,t)},S=t=>{o.showContextMenu(s,t)},B=t=>{t.stopPropagation()},C=t=>{s.canMaximize()&&o.maximize(s),t.stopPropagation()},M=t=>{o.doAction(h.deleteTabset(s.getId())),t.stopPropagation()},x=t=>{void 0!==z&&o.doAction(h.floatTab(z.getId())),t.stopPropagation()},U=t=>{s.canMaximize()&&o.maximize(s)},I=o.getClassName;null!==c.current&&0!==c.current.scrollLeft&&(c.current.scrollLeft=0);const z=s.getSelectedNode();let Y=s._styleWithPosition();void 0===s.getModel().getMaximizedTabset()||s.isMaximized()||L(Y,s.getModel().isUseVisibility());const X=[];if(s.isEnableTabStrip())for(let e=0;e<s.getChildren().length;e++){const i=s.getChildren()[e];let l=s.getSelected()===e;X.push(t.createElement(F,{layout:o,node:i,path:d+"/tb"+e,key:i.getId(),selected:l,iconFactory:n,titleFactory:r,icons:a})),e<s.getChildren().length-1&&X.push(t.createElement("div",{key:"divider"+e,className:I(g.FLEXLAYOUT__TABSET_TAB_DIVIDER)}))}const H=void 0!==s.getName();let P=[],W=[],k=[];const G={headerContent:s.getName(),stickyButtons:P,buttons:W,headerButtons:k,overflowPosition:void 0};o.customizeTabSet(s,G);const V=G.headerContent;if(P=G.stickyButtons,W=G.buttons,k=G.headerButtons,void 0===G.overflowPosition&&(G.overflowPosition=P.length),P.length>0&&(v?W=[...P,...W]:X.push(t.createElement("div",{ref:u,key:"sticky_buttons_container",onMouseDown:B,onTouchStart:B,onDragStart:t=>{t.preventDefault()},className:I(g.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER)},P))),b.length>0){const e=o.i18nName(T.Overflow_Menu_Tooltip);let i;i="function"==typeof a.more?a.more(s,b):t.createElement(t.Fragment,null,a.more,t.createElement("div",{className:I(g.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT)},b.length)),W.splice(Math.min(G.overflowPosition,W.length),0,t.createElement("button",{key:"overflowbutton","data-layout-path":d+"/button/overflow",ref:_,className:I(g.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+I(g.FLEXLAYOUT__TAB_BUTTON_OVERFLOW),title:e,onClick:O,onMouseDown:B,onTouchStart:B},i))}if(void 0!==z&&o.isSupportsPopout()&&z.isEnableFloat()&&!z.isFloating()){const e=o.i18nName(T.Float_Tab);W.push(t.createElement("button",{key:"float","data-layout-path":d+"/button/float",title:e,className:I(g.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+I(g.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT),onClick:x,onMouseDown:B,onTouchStart:B},"function"==typeof a.popout?a.popout(z):a.popout))}if(s.canMaximize()){const e=o.i18nName(T.Restore),i=o.i18nName(T.Maximize);(H?k:W).push(t.createElement("button",{key:"max","data-layout-path":d+"/button/max",title:s.isMaximized()?e:i,className:I(g.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+I(g.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_+(s.isMaximized()?"max":"min")),onClick:C,onMouseDown:B,onTouchStart:B},s.isMaximized()?"function"==typeof a.restore?a.restore(s):a.restore:"function"==typeof a.maximize?a.maximize(s):a.maximize))}if(!s.isMaximized()&&s.isEnableClose()){const e=o.i18nName(T.Close_Tabset);(H?k:W).push(t.createElement("button",{key:"close","data-layout-path":d+"/button/close",title:e,className:I(g.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+I(g.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE),onClick:M,onMouseDown:B,onTouchStart:B},"function"==typeof a.closeTabset?a.closeTabset(s):a.closeTabset))}const J=t.createElement("div",{key:"toolbar",ref:l,className:I(g.FLEXLAYOUT__TAB_TOOLBAR),onMouseDown:B,onTouchStart:B,onDragStart:t=>{t.preventDefault()}},W);let Z,j,q=I(g.FLEXLAYOUT__TABSET_TABBAR_OUTER);if(void 0!==s.getClassNameTabStrip()&&(q+=" "+s.getClassNameTabStrip()),q+=" "+g.FLEXLAYOUT__TABSET_TABBAR_OUTER_+s.getTabLocation(),s.isActive()&&!H&&(q+=" "+I(g.FLEXLAYOUT__TABSET_SELECTED)),s.isMaximized()&&!H&&(q+=" "+I(g.FLEXLAYOUT__TABSET_MAXIMIZED)),H){const e=t.createElement("div",{key:"toolbar",ref:l,className:I(g.FLEXLAYOUT__TAB_TOOLBAR),onMouseDown:B,onTouchStart:B,onDragStart:t=>{t.preventDefault()}},k);let i=I(g.FLEXLAYOUT__TABSET_HEADER);s.isActive()&&(i+=" "+I(g.FLEXLAYOUT__TABSET_SELECTED)),s.isMaximized()&&(i+=" "+I(g.FLEXLAYOUT__TABSET_MAXIMIZED)),void 0!==s.getClassNameHeader()&&(i+=" "+s.getClassNameHeader()),Z=t.createElement("div",{className:i,style:{height:s.getHeaderHeight()+"px"},"data-layout-path":d+"/header",onMouseDown:A,onContextMenu:S,onClick:N,onAuxClick:N,onTouchStart:A},t.createElement("div",{className:I(g.FLEXLAYOUT__TABSET_HEADER_CONTENT)},V),e)}const K={height:s.getTabStripHeight()+"px"};j=t.createElement("div",{className:q,style:K,"data-layout-path":d+"/tabstrip",onMouseDown:A,onContextMenu:S,onClick:N,onAuxClick:N,onTouchStart:A},t.createElement("div",{ref:c,className:I(g.FLEXLAYOUT__TABSET_TABBAR_INNER)+" "+I(g.FLEXLAYOUT__TABSET_TABBAR_INNER_+s.getTabLocation())},t.createElement("div",{style:{left:p},className:I(g.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER)+" "+I(g.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_+s.getTabLocation())},X)),J),Y=o.styleFont(Y);var $=void 0;if(0===s.getChildren().length){const t=o.getTabSetPlaceHolderCallback();t&&($=t(s))}const Q=t.createElement("div",{className:I(g.FLEXLAYOUT__TABSET_CONTENT)},$);var tt;return tt="top"===s.getTabLocation()?t.createElement(t.Fragment,null,Z,j,Q):t.createElement(t.Fragment,null,Z,Q,j),t.createElement("div",{ref:E,dir:"ltr","data-layout-path":d,style:Y,className:I(g.FLEXLAYOUT__TABSET),onWheel:f},tt)},z=i=>{const{title:s,id:o,url:n,rect:r,onCloseWindow:a,onSetWindow:d,children:l}=i,h=t.useRef(null),_=t.useRef(null),[c,u]=t.useState(void 0);return t.useLayoutEffect((()=>{_.current&&clearTimeout(_.current);let t=!0;const e=r,i=Array.from(window.document.styleSheets).reduce(((t,e)=>{let i;try{i=e.cssRules}catch(t){}try{return[...t,{href:e.href,type:e.type,rules:i?Array.from(i).map((t=>t.cssText)):null}]}catch(e){return t}}),[]);return h.current=window.open(n,o,`left=${e.x},top=${e.y},width=${e.width},height=${e.height}`),null!==h.current?(d(o,h.current),window.addEventListener("beforeunload",(()=>{h.current&&(h.current.close(),h.current=null)})),h.current.addEventListener("load",(()=>{if(t){const t=h.current.document;t.title=s;const e=t.createElement("div");e.className=g.FLEXLAYOUT__FLOATING_WINDOW_CONTENT,t.body.appendChild(e),function(t,e){const i=t.head,s=[];for(const o of e)if(o.href){const e=t.createElement("link");e.type=o.type,e.rel="stylesheet",e.href=o.href,i.appendChild(e),s.push(new Promise(((t,i)=>{e.onload=()=>t(!0)})))}else if(o.rules){const e=t.createElement("style");for(const i of o.rules)e.appendChild(t.createTextNode(i));i.appendChild(e)}return Promise.all(s)}(t,i).then((()=>{u(e)})),h.current.addEventListener("beforeunload",(()=>{a(o)}))}}))):(console.warn(`Unable to open window ${n}`),a(o)),()=>{t=!1,_.current=setTimeout((()=>{h.current&&(h.current.close(),h.current=null)}),0)}}),[]),void 0!==c?(0,e.createPortal)(l,c):null},Y=e=>{const{layout:i,node:s,factory:o}=e,n=i.getClassName,r=o(s);return t.createElement("div",{className:n(g.FLEXLAYOUT__FLOATING_WINDOW_TAB)},t.createElement(x,{message:e.layout.i18nName(T.Error_rendering_component)},t.createElement(t.Fragment,null,r)))},X=e=>{const{layout:i,selected:s,node:o,path:n}=e,r=()=>{o.getWindow()&&o.getWindow().focus()},a=()=>{i.doAction(h.unFloatTab(o.getId()))},d=()=>{const t=o.getParent();t.getType()===v.TYPE&&(t.isActive()||i.doAction(h.setActiveTabset(t.getId())))},l=i.getClassName,_=o.getParent(),c=o._styleWithPosition();s||L(c,o.getModel().isUseVisibility()),_ instanceof v&&(void 0===o.getModel().getMaximizedTabset()||_.isMaximized()||L(c,o.getModel().isUseVisibility()));const u=i.i18nName(T.Floating_Window_Message),E=i.i18nName(T.Floating_Window_Show_Window),p=i.i18nName(T.Floating_Window_Dock_Window),m=i.getOnRenderFloatingTabPlaceholder();return m?t.createElement("div",{className:l(g.FLEXLAYOUT__TAB_FLOATING),onMouseDown:d,onTouchStart:d,style:c},m(a,r)):t.createElement("div",{className:l(g.FLEXLAYOUT__TAB_FLOATING),"data-layout-path":n,onMouseDown:d,onTouchStart:d,style:c},t.createElement("div",{className:l(g.FLEXLAYOUT__TAB_FLOATING_INNER)},t.createElement("div",null,u),t.createElement("div",null,t.createElement("a",{href:"#",onClick:t=>{t.preventDefault(),r()}},E)),t.createElement("div",null,t.createElement("a",{href:"#",onClick:t=>{t.preventDefault(),a()}},p))))},H={width:"1em",height:"1em",display:"flex",alignItems:"center"},P=()=>t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:H,viewBox:"0 0 24 24"},t.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),t.createElement("path",{stroke:"var(--color-icon)",fill:"var(--color-icon)",d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),W={close:t.createElement(P,null),closeTabset:t.createElement(P,null),popout:t.createElement((()=>t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:H,viewBox:"0 0 20 20",fill:"var(--color-icon)"},t.createElement("path",{d:"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"}),t.createElement("path",{d:"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"}))),null),maximize:t.createElement((()=>t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:H,viewBox:"0 0 24 24",fill:"var(--color-icon)"},t.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t.createElement("path",{stroke:"var(--color-icon)",d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"}))),null),restore:t.createElement((()=>t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:H,viewBox:"0 0 24 24",fill:"var(--color-icon)"},t.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t.createElement("path",{stroke:"var(--color-icon)",d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}))),null),more:t.createElement((()=>t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:H,viewBox:"0 0 24 24",fill:"var(--color-icon)"},t.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t.createElement("path",{stroke:"var(--color-icon)",d:"M7 10l5 5 5-5z"}))),null)},k="undefined"!=typeof window&&(window.document.documentMode||/Edge\//.test(window.navigator.userAgent)),G="undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches&&!k;class V extends t.Component{constructor(i){super(i),this.firstMove=!1,this.dragRectRendered=!0,this.dragDivText=void 0,this.edgeRectLength=100,this.edgeRectWidth=10,this.onModelChange=t=>{this.forceUpdate(),this.props.onModelChange&&this.props.onModelChange(this.props.model,t)},this.updateRect=(t=this.getDomRect())=>{const e=new s(0,0,t.width,t.height);e.equals(this.state.rect)||0===e.width||0===e.height||this.setState({rect:e})},this.updateLayoutMetrics=()=>{if(this.findHeaderBarSizeRef.current){const t=this.findHeaderBarSizeRef.current.getBoundingClientRect().height;t!==this.state.calculatedHeaderBarSize&&this.setState({calculatedHeaderBarSize:t})}if(this.findTabBarSizeRef.current){const t=this.findTabBarSizeRef.current.getBoundingClientRect().height;t!==this.state.calculatedTabBarSize&&this.setState({calculatedTabBarSize:t})}if(this.findBorderBarSizeRef.current){const t=this.findBorderBarSizeRef.current.getBoundingClientRect().height;t!==this.state.calculatedBorderBarSize&&this.setState({calculatedBorderBarSize:t})}},this.getClassName=t=>void 0===this.props.classNameMapper?t:this.props.classNameMapper(t),this.onCloseWindow=t=>{this.doAction(h.unFloatTab(t));try{this.props.model.getNodeById(t)._setWindow(void 0)}catch(t){}},this.onSetWindow=(t,e)=>{this.props.model.getNodeById(t)._setWindow(e)},this.onCancelAdd=()=>{var t,e;this.selfRef.current.removeChild(this.dragDiv),this.dragDiv=void 0,this.hidePortal(),null!=this.fnNewNodeDropped&&(this.fnNewNodeDropped(),this.fnNewNodeDropped=void 0);try{null===(e=null===(t=this.customDrop)||void 0===t?void 0:t.invalidated)||void 0===e||e.call(t)}catch(t){console.error(t)}d.instance.hideGlass(),this.newTabJson=void 0,this.customDrop=void 0},this.onCancelDrag=t=>{var e,i;if(t){const t=this.selfRef.current;try{t.removeChild(this.outlineDiv)}catch(t){}try{t.removeChild(this.dragDiv)}catch(t){}this.dragDiv=void 0,this.hidePortal(),this.setState({showEdges:!1}),null!=this.fnNewNodeDropped&&(this.fnNewNodeDropped(),this.fnNewNodeDropped=void 0);try{null===(i=null===(e=this.customDrop)||void 0===e?void 0:e.invalidated)||void 0===i||i.call(e)}catch(t){console.error(t)}d.instance.hideGlass(),this.newTabJson=void 0,this.customDrop=void 0}this.setState({showHiddenBorder:r.CENTER})},this.onDragDivMouseDown=t=>{t.preventDefault(),this.dragStart(t,this.dragDivText,b._fromJson(this.newTabJson,this.props.model,!1),!0,void 0,void 0)},this.dragStart=(t,e,i,s,o,n)=>{s?(this.dragNode=i,this.dragDivText=e,d.instance.startDrag(t,this.onDragStart,this.onDragMove,this.onDragEnd,this.onCancelDrag,o,n,this.currentDocument,this.selfRef.current)):d.instance.startDrag(t,void 0,void 0,void 0,void 0,o,n,this.currentDocument,this.selfRef.current)},this.dragRectRender=(e,i,s,o)=>{let n;if(void 0!==e?n=t.createElement("div",{style:{whiteSpace:"pre"}},e.replace("<br>","\n")):i&&i instanceof b&&(n=t.createElement(S,{node:i,layout:this,iconFactory:this.props.iconFactory,titleFactory:this.props.titleFactory})),void 0!==this.props.onRenderDragRect){const t=this.props.onRenderDragRect(n,i,s);void 0!==t&&(n=t)}this.dragDiv.style.visibility="hidden",this.dragRectRendered=!1,this.showPortal(t.createElement(J,{onRendered:()=>{this.dragRectRendered=!0,null==o||o()}},n),this.dragDiv)},this.showPortal=(t,i)=>{const s=(0,e.createPortal)(t,i);this.setState({portal:s})},this.hidePortal=()=>{this.setState({portal:void 0})},this.onDragStart=()=>{this.dropInfo=void 0,this.customDrop=void 0;const t=this.selfRef.current;return this.outlineDiv=this.currentDocument.createElement("div"),this.outlineDiv.className=this.getClassName(g.FLEXLAYOUT__OUTLINE_RECT),this.outlineDiv.style.visibility="hidden",t.appendChild(this.outlineDiv),null==this.dragDiv&&(this.dragDiv=this.currentDocument.createElement("div"),this.dragDiv.className=this.getClassName(g.FLEXLAYOUT__DRAG_RECT),this.dragDiv.setAttribute("data-layout-path","/drag-rectangle"),this.dragRectRender(this.dragDivText,this.dragNode,this.newTabJson),t.appendChild(this.dragDiv)),void 0===this.props.model.getMaximizedTabset()&&this.setState({showEdges:this.props.model.isEnableEdgeDock()}),void 0!==this.dragNode&&this.dragNode instanceof b&&void 0!==this.dragNode.getTabRect()&&this.dragNode.getTabRect().positionElement(this.outlineDiv),this.firstMove=!0,!0},this.onDragMove=t=>{if(!1===this.firstMove){const t=this.props.model._getAttribute("tabDragSpeed");this.outlineDiv.style.transition=`top ${t}s, left ${t}s, width ${t}s, height ${t}s`}this.firstMove=!1;const e=this.selfRef.current.getBoundingClientRect(),i={x:t.clientX-e.left,y:t.clientY-e.top};this.checkForBorderToShow(i.x,i.y);const s=this.dragDiv.getBoundingClientRect();let o=i.x-s.width/2;o+s.width>e.width&&(o=e.width-s.width),o=Math.max(0,o),this.dragDiv.style.left=o+"px",this.dragDiv.style.top=i.y+5+"px",this.dragRectRendered&&"hidden"===this.dragDiv.style.visibility&&(this.dragDiv.style.visibility="visible");let n=this.props.model._findDropTargetNode(this.dragNode,i.x,i.y);n&&(this.props.onTabDrag?this.handleCustomTabDrag(n,i,t):(this.dropInfo=n,this.outlineDiv.className=this.getClassName(n.className),n.rect.positionElement(this.outlineDiv),this.outlineDiv.style.visibility="visible"))},this.onDragEnd=t=>{const e=this.selfRef.current;if(e.removeChild(this.outlineDiv),e.removeChild(this.dragDiv),this.dragDiv=void 0,this.hidePortal(),this.setState({showEdges:!1}),d.instance.hideGlass(),this.dropInfo)if(this.customDrop){this.newTabJson=void 0;try{const{callback:t,dragging:e,over:i,x:s,y:o,location:n}=this.customDrop;t(e,i,s,o,n),null!=this.fnNewNodeDropped&&(this.fnNewNodeDropped(),this.fnNewNodeDropped=void 0)}catch(t){console.error(t)}}else if(void 0!==this.newTabJson){const e=this.doAction(h.addNode(this.newTabJson,this.dropInfo.node.getId(),this.dropInfo.location,this.dropInfo.index));null!=this.fnNewNodeDropped&&(this.fnNewNodeDropped(e,t),this.fnNewNodeDropped=void 0),this.newTabJson=void 0}else void 0!==this.dragNode&&this.doAction(h.moveNode(this.dragNode.getId(),this.dropInfo.node.getId(),this.dropInfo.location,this.dropInfo.index));this.setState({showHiddenBorder:r.CENTER})},this.props.model._setChangeListener(this.onModelChange),this.tabIds=[],this.selfRef=t.createRef(),this.findHeaderBarSizeRef=t.createRef(),this.findTabBarSizeRef=t.createRef(),this.findBorderBarSizeRef=t.createRef(),this.supportsPopout=void 0!==i.supportsPopout?i.supportsPopout:G,this.popoutURL=i.popoutURL?i.popoutURL:"popout.html",this.icons=Object.assign(Object.assign({},W),i.icons),this.state={rect:new s(0,0,0,0),calculatedHeaderBarSize:25,calculatedTabBarSize:26,calculatedBorderBarSize:30,editingTab:void 0,showHiddenBorder:r.CENTER,showEdges:!1},this.onDragEnter=this.onDragEnter.bind(this)}styleFont(t){return this.props.font&&(this.selfRef.current&&(this.props.font.size&&this.selfRef.current.style.setProperty("--font-size",this.props.font.size),this.props.font.family&&this.selfRef.current.style.setProperty("--font-family",this.props.font.family)),this.props.font.style&&(t.fontStyle=this.props.font.style),this.props.font.weight&&(t.fontWeight=this.props.font.weight)),t}doAction(t){if(void 0!==this.props.onAction){const e=this.props.onAction(t);return void 0!==e?this.props.model.doAction(e):void 0}return this.props.model.doAction(t)}componentDidMount(){this.updateRect(),this.updateLayoutMetrics(),this.currentDocument=this.selfRef.current.ownerDocument,this.currentWindow=this.currentDocument.defaultView,this.resizeObserver=new ResizeObserver((t=>{this.updateRect(t[0].contentRect)})),this.resizeObserver.observe(this.selfRef.current)}componentDidUpdate(){this.updateLayoutMetrics(),this.props.model!==this.previousModel&&(void 0!==this.previousModel&&this.previousModel._setChangeListener(void 0),this.props.model._setChangeListener(this.onModelChange),this.previousModel=this.props.model)}getCurrentDocument(){return this.currentDocument}getDomRect(){return this.selfRef.current.getBoundingClientRect()}getRootDiv(){return this.selfRef.current}isSupportsPopout(){return this.supportsPopout}isRealtimeResize(){var t;return null!==(t=this.props.realtimeResize)&&void 0!==t&&t}onTabDrag(...t){var e,i;return null===(i=(e=this.props).onTabDrag)||void 0===i?void 0:i.call(e,...t)}getPopoutURL(){return this.popoutURL}componentWillUnmount(){var t;null===(t=this.resizeObserver)||void 0===t||t.unobserve(this.selfRef.current)}setEditingTab(t){this.setState({editingTab:t})}getEditingTab(){return this.state.editingTab}render(){if(!this.selfRef.current)return t.createElement("div",{ref:this.selfRef,className:this.getClassName(g.FLEXLAYOUT__LAYOUT)},this.metricsElements());this.props.model._setPointerFine(window&&window.matchMedia&&window.matchMedia("(pointer: fine)").matches);const e=[],i=[],s=[],o={},n=[],r={headerBarSize:this.state.calculatedHeaderBarSize,tabBarSize:this.state.calculatedTabBarSize,borderBarSize:this.state.calculatedBorderBarSize};this.props.model._setShowHiddenBorder(this.state.showHiddenBorder),this.centerRect=this.props.model._layout(this.state.rect,r),this.renderBorder(this.props.model.getBorderSet(),e,o,s,n),this.renderChildren("",this.props.model.getRoot(),i,o,s,n);const a=[],d={};for(const t of this.tabIds)o[t]&&(a.push(t),d[t]=t);this.tabIds=a;for(const t of Object.keys(o))d[t]||this.tabIds.push(t);const l=[];if(this.state.showEdges){const e=this.centerRect,i=this.edgeRectLength,s=this.edgeRectWidth,o=this.edgeRectLength/2,n=this.getClassName(g.FLEXLAYOUT__EDGE_RECT),r=50;l.push(t.createElement("div",{key:"North",style:{top:e.y,left:e.x+e.width/2-o,width:i,height:s,borderBottomLeftRadius:r,borderBottomRightRadius:r},className:n+" "+this.getClassName(g.FLEXLAYOUT__EDGE_RECT_TOP)})),l.push(t.createElement("div",{key:"West",style:{top:e.y+e.height/2-o,left:e.x,width:s,height:i,borderTopRightRadius:r,borderBottomRightRadius:r},className:n+" "+this.getClassName(g.FLEXLAYOUT__EDGE_RECT_LEFT)})),l.push(t.createElement("div",{key:"South",style:{top:e.y+e.height-s,left:e.x+e.width/2-o,width:i,height:s,borderTopLeftRadius:r,borderTopRightRadius:r},className:n+" "+this.getClassName(g.FLEXLAYOUT__EDGE_RECT_BOTTOM)})),l.push(t.createElement("div",{key:"East",style:{top:e.y+e.height/2-o,left:e.x+e.width-s,width:s,height:i,borderTopLeftRadius:r,borderBottomLeftRadius:r},className:n+" "+this.getClassName(g.FLEXLAYOUT__EDGE_RECT_RIGHT)}))}return t.createElement("div",{ref:this.selfRef,className:this.getClassName(g.FLEXLAYOUT__LAYOUT),onDragEnter:this.props.onExternalDrag?this.onDragEnter:void 0},i,this.tabIds.map((t=>o[t])),e,n,l,s,this.metricsElements(),this.state.portal)}metricsElements(){const e=this.styleFont({visibility:"hidden"});return t.createElement(t.Fragment,null,t.createElement("div",{key:"findHeaderBarSize",ref:this.findHeaderBarSizeRef,style:e,className:this.getClassName(g.FLEXLAYOUT__TABSET_HEADER_SIZER)},"FindHeaderBarSize"),t.createElement("div",{key:"findTabBarSize",ref:this.findTabBarSizeRef,style:e,className:this.getClassName(g.FLEXLAYOUT__TABSET_SIZER)},"FindTabBarSize"),t.createElement("div",{key:"findBorderBarSize",ref:this.findBorderBarSizeRef,style:e,className:this.getClassName(g.FLEXLAYOUT__BORDER_SIZER)},"FindBorderBarSize"))}renderBorder(e,s,o,n,r){for(const a of e.getBorders()){const e=`/border/${a.getLocation().getName()}`;if(a.isShowing()){s.push(t.createElement(C,{key:`border_${a.getLocation().getName()}`,path:e,border:a,layout:this,iconFactory:this.props.iconFactory,titleFactory:this.props.titleFactory,icons:this.icons}));const d=a._getDrawChildren();let l=0,h=0;for(const s of d){if(s instanceof m){let i=e+"/s";r.push(t.createElement(M,{key:s.getId(),layout:this,node:s,path:i}))}else if(s instanceof b){let r=e+"/t"+h++;if(this.supportsPopout&&s.isFloating()){const e=this._getScreenRect(s),d=s._getAttr("borderWidth"),h=s._getAttr("borderHeight");-1!==d&&a.getLocation().getOrientation()===i.HORZ?e.width=d:-1!==h&&a.getLocation().getOrientation()===i.VERT&&(e.height=h),n.push(t.createElement(z,{key:s.getId(),url:this.popoutURL,rect:e,title:s.getName(),id:s.getId(),onSetWindow:this.onSetWindow,onCloseWindow:this.onCloseWindow},t.createElement(Y,{layout:this,node:s,factory:this.props.factory}))),o[s.getId()]=t.createElement(X,{key:s.getId(),layout:this,path:r,node:s,selected:l===a.getSelected()})}else o[s.getId()]=t.createElement(U,{key:s.getId(),layout:this,path:r,node:s,selected:l===a.getSelected(),factory:this.props.factory})}l++}}}}renderChildren(e,s,o,n,r,a){const d=s._getDrawChildren();let l=0,h=0,_=0;for(const s of d)if(s instanceof m){const i=e+"/s"+l++;a.push(t.createElement(M,{key:s.getId(),layout:this,path:i,node:s}))}else if(s instanceof v){const i=e+"/ts"+_++;o.push(t.createElement(I,{key:s.getId(),layout:this,path:i,node:s,iconFactory:this.props.iconFactory,titleFactory:this.props.titleFactory,icons:this.icons})),this.renderChildren(i,s,o,n,r,a)}else if(s instanceof b){const i=e+"/t"+h++,o=s.getParent().getChildren()[s.getParent().getSelected()];if(void 0===o&&console.warn("undefined selectedTab should not happen"),this.supportsPopout&&s.isFloating()){const e=this._getScreenRect(s);r.push(t.createElement(z,{key:s.getId(),url:this.popoutURL,rect:e,title:s.getName(),id:s.getId(),onSetWindow:this.onSetWindow,onCloseWindow:this.onCloseWindow},t.createElement(Y,{layout:this,node:s,factory:this.props.factory}))),n[s.getId()]=t.createElement(X,{key:s.getId(),layout:this,path:i,node:s,selected:s===o})}else n[s.getId()]=t.createElement(U,{key:s.getId(),layout:this,path:i,node:s,selected:s===o,factory:this.props.factory})}else{const t=e+(s.getOrientation()===i.HORZ?"/r":"/c")+_++;this.renderChildren(t,s,o,n,r,a)}}_getScreenRect(t){const e=t.getRect().clone(),i=this.selfRef.current.getBoundingClientRect(),s=Math.min(80,this.currentWindow.outerHeight-this.currentWindow.innerHeight),o=Math.min(80,this.currentWindow.outerWidth-this.currentWindow.innerWidth);return e.x=e.x+i.x+this.currentWindow.screenX+o,e.y=e.y+i.y+this.currentWindow.screenY+s,e}addTabToTabSet(t,e){void 0!==this.props.model.getNodeById(t)&&this.doAction(h.addNode(e,t,r.CENTER,-1))}addTabToActiveTabSet(t){const e=this.props.model.getActiveTabset();void 0!==e&&this.doAction(h.addNode(t,e.getId(),r.CENTER,-1))}addTabWithDragAndDrop(t,e,i){this.fnNewNodeDropped=i,this.newTabJson=e,this.dragStart(void 0,t,b._fromJson(e,this.props.model,!1),!0,void 0,void 0)}moveTabWithDragAndDrop(t,e){this.dragStart(void 0,e,t,!0,void 0,void 0)}addTabWithDragAndDropIndirect(t,e,i){this.fnNewNodeDropped=i,this.newTabJson=e,d.instance.addGlass(this.onCancelAdd),this.dragDivText=t,this.dragDiv=this.currentDocument.createElement("div"),this.dragDiv.className=this.getClassName(g.FLEXLAYOUT__DRAG_RECT),this.dragDiv.addEventListener("mousedown",this.onDragDivMouseDown),this.dragDiv.addEventListener("touchstart",this.onDragDivMouseDown,{passive:!1}),this.dragRectRender(this.dragDivText,void 0,this.newTabJson,(()=>{if(this.dragDiv){this.dragDiv.style.visibility="visible";const t=this.dragDiv.getBoundingClientRect(),e=new s(0,0,null==t?void 0:t.width,null==t?void 0:t.height);e.centerInRect(this.state.rect),this.dragDiv.setAttribute("data-layout-path","/drag-rectangle"),this.dragDiv.style.left=e.x+"px",this.dragDiv.style.top=e.y+"px"}})),this.selfRef.current.appendChild(this.dragDiv)}handleCustomTabDrag(t,e,i){var o,n,r;let a=null===(o=this.customDrop)||void 0===o?void 0:o.invalidated;const l=null===(n=this.customDrop)||void 0===n?void 0:n.callback;this.customDrop=void 0;const h=this.newTabJson||(this.dragNode instanceof b?this.dragNode:void 0);if(h&&(t.node instanceof v||t.node instanceof R)&&-1===t.index){const o=t.node.getSelectedNode(),n=null==o?void 0:o.getRect();if(o&&(null==n?void 0:n.contains(e.x,e.y))){let r;try{const a=this.onTabDrag(h,o,e.x-n.x,e.y-n.y,t.location,(()=>this.onDragMove(i)));a&&(r={rect:new s(a.x+n.x,a.y+n.y,a.width,a.height),callback:a.callback,invalidated:a.invalidated,dragging:h,over:o,x:e.x-n.x,y:e.y-n.y,location:t.location,cursor:a.cursor})}catch(t){console.error(t)}(null==r?void 0:r.callback)===l&&(a=void 0),this.customDrop=r}}this.dropInfo=t,this.outlineDiv.className=this.getClassName(this.customDrop?g.FLEXLAYOUT__OUTLINE_RECT:t.className),this.customDrop?this.customDrop.rect.positionElement(this.outlineDiv):t.rect.positionElement(this.outlineDiv),d.instance.setGlassCursorOverride(null===(r=this.customDrop)||void 0===r?void 0:r.cursor),this.outlineDiv.style.visibility="visible";try{null==a||a()}catch(t){console.error(t)}}onDragEnter(t){if(d.instance.isDragging())return;const e=this.props.onExternalDrag(t);e&&(this.fnNewNodeDropped=e.onDrop,this.newTabJson=e.json,this.dragStart(t,e.dragText,b._fromJson(e.json,this.props.model,!1),!0,void 0,void 0))}checkForBorderToShow(t,e){const i=this.props.model._getOuterInnerRects().outer,s=i.getCenter(),o=this.edgeRectWidth,n=this.edgeRectLength/2;let a=!1;this.props.model.isEnableEdgeDock()&&this.state.showHiddenBorder===r.CENTER&&(e>s.y-n&&e<s.y+n||t>s.x-n&&t<s.x+n)&&(a=!0);let d=r.CENTER;a||(t<=i.x+o?d=r.LEFT:t>=i.getRight()-o?d=r.RIGHT:e<=i.y+o?d=r.TOP:e>=i.getBottom()-o&&(d=r.BOTTOM)),d!==this.state.showHiddenBorder&&this.setState({showHiddenBorder:d})}maximize(t){this.doAction(h.maximizeToggle(t.getId()))}customizeTab(t,e){this.props.onRenderTab&&this.props.onRenderTab(t,e)}customizeTabSet(t,e){this.props.onRenderTabSet&&this.props.onRenderTabSet(t,e)}i18nName(t,e){let i;return this.props.i18nMapper&&(i=this.props.i18nMapper(t,e)),void 0===i&&(i=t+(void 0===e?"":e)),i}getOnRenderFloatingTabPlaceholder(){return this.props.onRenderFloatingTabPlaceholder}getShowOverflowMenu(){return this.props.onShowOverflowMenu}getTabSetPlaceHolderCallback(){return this.props.onTabSetPlaceHolder}showContextMenu(t,e){this.props.onContextMenu&&this.props.onContextMenu(t,e)}auxMouseClick(t,e){this.props.onAuxMouseClick&&this.props.onAuxMouseClick(t,e)}}const J=e=>(t.useEffect((()=>{var t;null===(t=e.onRendered)||void 0===t||t.call(e)}),[e]),t.createElement(t.Fragment,null,e.children));class Z{static _fromJson(t,e){const i=new Z(e);return i._borders=t.map((t=>R._fromJson(t,e))),i}constructor(t){this._model=t,this._borders=[]}getBorders(){return this._borders}_forEachNode(t){for(const e of this._borders){t(e,0);for(const i of e.getChildren())i._forEachNode(t,1)}}_toJson(){return this._borders.map((t=>t.toJson()))}_layoutBorder(t,e){const s=t.outer,o=this._model.getRoot();let n=Math.max(0,s.height-o.getMinHeight()),r=Math.max(0,s.width-o.getMinWidth()),a=0,d=0,l=0,h=0;const _=this._borders.filter((t=>t.isShowing()));for(const t of _){t._setAdjustedSize(t.getSize());const e=-1!==t.getSelected();t.getLocation().getOrientation()===i.HORZ?(d+=t.getBorderBarSize(),e&&(r-=this._model.getSplitterSize(),d+=t.getSize(),h+=t.getSize())):(a+=t.getBorderBarSize(),e&&(n-=this._model.getSplitterSize(),a+=t.getSize(),l+=t.getSize()))}let c=0,u=!1;for(;d>r&&h>0||a>n&&l>0;){const t=_[c];if(-1!==t.getSelected()){const e=t._getAdjustedSize();d>r&&h>0&&t.getLocation().getOrientation()===i.HORZ&&e>0&&e>t.getMinSize()?(t._setAdjustedSize(e-1),d--,h--,u=!0):a>n&&l>0&&t.getLocation().getOrientation()===i.VERT&&e>0&&e>t.getMinSize()&&(t._setAdjustedSize(e-1),a--,l--,u=!0)}if(c=(c+1)%_.length,0===c){if(!u)break;u=!1}}for(const i of _)t.outer=i._layoutBorderOuter(t.outer,e);t.inner=t.outer;for(const i of _)t.inner=i._layoutBorderInner(t.inner,e);return t}_findDropTargetNode(t,e,i){for(const s of this._borders)if(s.isShowing()){const o=s.canDrop(t,e,i);if(void 0!==o)return o}}}class j{static fromJson(t){const e=new j;return j._attributeDefinitions.fromJson(t.global,e._attributes),t.borders&&(e._borders=Z._fromJson(t.borders,e)),e._root=f._fromJson(t.layout,e),e._tidy(),e}static _createAttributeDefinitions(){const t=new c;return t.add("legacyOverflowMenu",!1).setType(_.BOOLEAN),t.add("enableEdgeDock",!0).setType(_.BOOLEAN),t.add("rootOrientationVertical",!1).setType(_.BOOLEAN),t.add("marginInsets",{top:0,right:0,bottom:0,left:0}).setType("IInsets"),t.add("enableUseVisibility",!1).setType(_.BOOLEAN),t.add("enableRotateBorderIcons",!0).setType(_.BOOLEAN),t.add("splitterSize",-1).setType(_.NUMBER),t.add("splitterExtra",0).setType(_.NUMBER),t.add("tabEnableClose",!0).setType(_.BOOLEAN),t.add("tabCloseType",1).setType("ICloseType"),t.add("tabEnableFloat",!1).setType(_.BOOLEAN),t.add("tabEnableDrag",!0).setType(_.BOOLEAN),t.add("tabEnableRename",!0).setType(_.BOOLEAN),t.add("tabContentClassName",void 0).setType(_.STRING),t.add("tabClassName",void 0).setType(_.STRING),t.add("tabIcon",void 0).setType(_.STRING),t.add("tabEnableRenderOnDemand",!0).setType(_.BOOLEAN),t.add("tabDragSpeed",.3).setType(_.NUMBER),t.add("tabBorderWidth",-1).setType(_.NUMBER),t.add("tabBorderHeight",-1).setType(_.NUMBER),t.add("tabSetEnableDeleteWhenEmpty",!0).setType(_.BOOLEAN),t.add("tabSetEnableDrop",!0).setType(_.BOOLEAN),t.add("tabSetEnableDrag",!0).setType(_.BOOLEAN),t.add("tabSetEnableDivide",!0).setType(_.BOOLEAN),t.add("tabSetEnableMaximize",!0).setType(_.BOOLEAN),t.add("tabSetEnableClose",!1).setType(_.BOOLEAN),t.add("tabSetAutoSelectTab",!0).setType(_.BOOLEAN),t.add("tabSetClassNameTabStrip",void 0).setType(_.STRING),t.add("tabSetClassNameHeader",void 0).setType(_.STRING),t.add("tabSetEnableTabStrip",!0).setType(_.BOOLEAN),t.add("tabSetHeaderHeight",0).setType(_.NUMBER),t.add("tabSetTabStripHeight",0).setType(_.NUMBER),t.add("tabSetMarginInsets",{top:0,right:0,bottom:0,left:0}).setType("IInsets"),t.add("tabSetBorderInsets",{top:0,right:0,bottom:0,left:0}).setType("IInsets"),t.add("tabSetTabLocation","top").setType("ITabLocation"),t.add("tabSetMinWidth",0).setType(_.NUMBER),t.add("tabSetMinHeight",0).setType(_.NUMBER),t.add("borderSize",200).setType(_.NUMBER),t.add("borderMinSize",0).setType(_.NUMBER),t.add("borderBarSize",0).setType(_.NUMBER),t.add("borderEnableDrop",!0).setType(_.BOOLEAN),t.add("borderAutoSelectTabWhenOpen",!0).setType(_.BOOLEAN),t.add("borderAutoSelectTabWhenClosed",!1).setType(_.BOOLEAN),t.add("borderClassName",void 0).setType(_.STRING),t.add("borderEnableAutoHide",!1).setType(_.BOOLEAN),t}constructor(){this._borderRects={inner:s.empty(),outer:s.empty()},this._attributes={},this._idMap={},this._borders=new Z(this),this._pointerFine=!0,this._showHiddenBorder=r.CENTER}_setChangeListener(t){this._changeListener=t}getActiveTabset(){return this._activeTabSet&&this.getNodeById(this._activeTabSet.getId())?this._activeTabSet:void 0}_getShowHiddenBorder(){return this._showHiddenBorder}_setShowHiddenBorder(t){this._showHiddenBorder=t}_setActiveTabset(t){this._activeTabSet=t}getMaximizedTabset(){return this._maximizedTabSet}_setMaximizedTabset(t){this._maximizedTabSet=t}getRoot(){return this._root}isRootOrientationVertical(){return this._attributes.rootOrientationVertical}isUseVisibility(){return this._attributes.enableUseVisibility}isEnableRotateBorderIcons(){return this._attributes.enableRotateBorderIcons}getBorderSet(){return this._borders}_getOuterInnerRects(){return this._borderRects}_getPointerFine(){return this._pointerFine}_setPointerFine(t){this._pointerFine=t}visitNodes(t){this._borders._forEachNode(t),this._root._forEachNode(t,0)}getNodeById(t){return this._idMap[t]}getFirstTabSet(t=this._root){const e=t.getChildren()[0];return e instanceof v?e:this.getFirstTabSet(e)}doAction(t){let e;switch(t.type){case h.ADD_NODE:{const i=new b(this,t.data.json,!0),s=this._idMap[t.data.toNode];(s instanceof v||s instanceof R||s instanceof f)&&(s.drop(i,r.getByName(t.data.location),t.data.index,t.data.select),e=i);break}case h.MOVE_NODE:{const e=this._idMap[t.data.fromNode];if(e instanceof b||e instanceof v){const i=this._idMap[t.data.toNode];(i instanceof v||i instanceof R||i instanceof f)&&i.drop(e,r.getByName(t.data.location),t.data.index,t.data.select)}break}case h.DELETE_TAB:{const e=this._idMap[t.data.node];e instanceof b&&e._delete();break}case h.DELETE_TABSET:{const e=this._idMap[t.data.node];if(e instanceof v){const t=[...e.getChildren()];for(let e=0;e<t.length;e++){const i=t[e];i.isEnableClose()&&i._delete()}0===e.getChildren().length&&e._delete(),this._tidy()}break}case h.FLOAT_TAB:{const e=this._idMap[t.data.node];e instanceof b&&(e._setFloating(!0),function(t){const e=t.getParent();if(null!==e)if(e instanceof v){let i=!1,s=0;const o=e.getChildren();for(let e=0;e<o.length;e++){const n=o[e];if(n===t)i=!0;else if(!n.isFloating()&&(s=e,i))break}e._setSelected(s)}else e instanceof R&&e._setSelected(-1)}(e));break}case h.UNFLOAT_TAB:{const e=this._idMap[t.data.node];e instanceof b&&(e._setFloating(!1),function(t){const e=t.getParent();if(null!==e&&(e instanceof v||e instanceof R)){const i=e.getChildren();for(let s=0;s<i.length;s++)if(i[s]===t)return void e._setSelected(s)}}(e));break}case h.RENAME_TAB:{const e=this._idMap[t.data.node];e instanceof b&&e._setName(t.data.text);break}case h.SELECT_TAB:{const e=this._idMap[t.data.tabNode];if(e instanceof b){const t=e.getParent(),i=t.getChildren().indexOf(e);t instanceof R?t.getSelected()===i?t._setSelected(-1):t._setSelected(i):t instanceof v&&(t.getSelected()!==i&&t._setSelected(i),this._activeTabSet=t)}break}case h.SET_ACTIVE_TABSET:if(void 0===t.data.tabsetNode)this._activeTabSet=void 0;else{const e=this._idMap[t.data.tabsetNode];e instanceof v&&(this._activeTabSet=e)}break;case h.ADJUST_SPLIT:{const e=this._idMap[t.data.node1],i=this._idMap[t.data.node2];(e instanceof v||e instanceof f)&&(i instanceof v||i instanceof f)&&(this._adjustSplitSide(e,t.data.weight1,t.data.pixelWidth1),this._adjustSplitSide(i,t.data.weight2,t.data.pixelWidth2));break}case h.ADJUST_BORDER_SPLIT:{const e=this._idMap[t.data.node];e instanceof R&&e._setSize(t.data.pos);break}case h.MAXIMIZE_TOGGLE:{const e=this._idMap[t.data.node];e instanceof v&&(e===this._maximizedTabSet?this._maximizedTabSet=void 0:(this._maximizedTabSet=e,this._activeTabSet=e));break}case h.UPDATE_MODEL_ATTRIBUTES:this._updateAttrs(t.data.json);break;case h.UPDATE_NODE_ATTRIBUTES:this._idMap[t.data.node]._updateAttrs(t.data.json)}return this._updateIdMap(),void 0!==this._changeListener&&this._changeListener(t),e}_updateIdMap(){this._idMap={},this.visitNodes((t=>this._idMap[t.getId()]=t))}_adjustSplitSide(t,e,s){t._setWeight(e),null!=t.getWidth()&&t.getOrientation()===i.VERT?t._updateAttrs({width:s}):null!=t.getHeight()&&t.getOrientation()===i.HORZ&&t._updateAttrs({height:s})}toJson(){const t={};return j._attributeDefinitions.toJson(t,this._attributes),this.visitNodes((t=>{t._fireEvent("save",void 0)})),{global:t,borders:this._borders._toJson(),layout:this._root.toJson()}}getSplitterSize(){let t=this._attributes.splitterSize;return-1===t&&(t=this._pointerFine?8:12),t}isLegacyOverflowMenu(){return this._attributes.legacyOverflowMenu}getSplitterExtra(){return this._attributes.splitterExtra}isEnableEdgeDock(){return this._attributes.enableEdgeDock}_addNode(t){const e=t.getId();if(void 0!==this._idMap[e])throw new Error(`Error: each node must have a unique id, duplicate id:${t.getId()}`);"splitter"!==t.getType()&&(this._idMap[e]=t)}_layout(t,e){var i;return this._borderRects=this._borders._layoutBorder({outer:t,inner:t},e),t=this._borderRects.inner.removeInsets(this._getAttribute("marginInsets")),null===(i=this._root)||void 0===i||i.calcMinSize(),this._root._layout(t,e),t}_findDropTargetNode(t,e,i){let s=this._root._findDropTargetNode(t,e,i);return void 0===s&&(s=this._borders._findDropTargetNode(t,e,i)),s}_tidy(){this._root._tidy()}_updateAttrs(t){j._attributeDefinitions.update(t,this._attributes)}_nextUniqueId(){return"#"+([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)))}_getAttribute(t){return this._attributes[t]}setOnAllowDrop(t){this._onAllowDrop=t}_getOnAllowDrop(){return this._onAllowDrop}setOnCreateTabSet(t){this._onCreateTabSet=t}_getOnCreateTabSet(){return this._onCreateTabSet}static toTypescriptInterfaces(){console.log(j._attributeDefinitions.toTypescriptInterface("Global",void 0)),console.log(f.getAttributeDefinitions().toTypescriptInterface("Row",j._attributeDefinitions)),console.log(v.getAttributeDefinitions().toTypescriptInterface("TabSet",j._attributeDefinitions)),console.log(b.getAttributeDefinitions().toTypescriptInterface("Tab",j._attributeDefinitions)),console.log(R.getAttributeDefinitions().toTypescriptInterface("Border",j._attributeDefinitions))}toString(){return JSON.stringify(this.toJson())}}j._attributeDefinitions=j._createAttributeDefinitions()})(),n})()));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],e):"object"==typeof exports?exports.FlexLayout=e(require("react"),require("react-dom")):t.FlexLayout=e(t.React,t.ReactDOM)}(self,((t,e)=>(()=>{"use strict";var i={899:e=>{e.exports=t},994:t=>{t.exports=e}},s={};function n(t){var e=s[t];if(void 0!==e)return e.exports;var o=s[t]={exports:{}};return i[t](o,o.exports,n),o.exports}n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{Action:()=>l,Actions:()=>h,BorderNode:()=>R,BorderSet:()=>Z,CLASSES:()=>g,DockLocation:()=>r,DragDrop:()=>d,DropInfo:()=>u,I18nLabel:()=>T,ICloseType:()=>E,Layout:()=>V,Model:()=>j,Node:()=>p,Orientation:()=>i,Rect:()=>s,RowNode:()=>f,SplitterNode:()=>m,TabNode:()=>b,TabSetNode:()=>v});var t=n(899),e=n(994);class i{static flip(t){return t===i.HORZ?i.VERT:i.HORZ}constructor(t){this._name=t}getName(){return this._name}toString(){return this._name}}i.HORZ=new i("horz"),i.VERT=new i("vert");class s{static empty(){return new s(0,0,0,0)}constructor(t,e,i,s){this.x=t,this.y=e,this.width=i,this.height=s}static fromElement(t){let{x:e,y:i,width:n,height:o}=t.getBoundingClientRect();return new s(e,i,n,o)}clone(){return new s(this.x,this.y,this.width,this.height)}equals(t){return this.x===(null==t?void 0:t.x)&&this.y===(null==t?void 0:t.y)&&this.width===(null==t?void 0:t.width)&&this.height===(null==t?void 0:t.height)}getBottom(){return this.y+this.height}getRight(){return this.x+this.width}getCenter(){return{x:this.x+this.width/2,y:this.y+this.height/2}}positionElement(t,e){this.styleWithPosition(t.style,e)}styleWithPosition(t,e="absolute"){return t.left=this.x+"px",t.top=this.y+"px",t.width=Math.max(0,this.width)+"px",t.height=Math.max(0,this.height)+"px",t.position=e,t}contains(t,e){return this.x<=t&&t<=this.getRight()&&this.y<=e&&e<=this.getBottom()}removeInsets(t){return new s(this.x+t.left,this.y+t.top,Math.max(0,this.width-t.left-t.right),Math.max(0,this.height-t.top-t.bottom))}centerInRect(t){this.x=(t.width-this.width)/2,this.y=(t.height-this.height)/2}_getSize(t){let e=this.width;return t===i.VERT&&(e=this.height),e}toString(){return"(Rect: x="+this.x+", y="+this.y+", width="+this.width+", height="+this.height+")"}}class r{static getByName(t){return r.values[t]}static getLocation(t,e,i){if(e=(e-t.x)/t.width,i=(i-t.y)/t.height,e>=.25&&e<.75&&i>=.25&&i<.75)return r.CENTER;const s=i>=1-e;return i>=e?s?r.BOTTOM:r.LEFT:s?r.RIGHT:r.TOP}constructor(t,e,i){this._name=t,this._orientation=e,this._indexPlus=i,r.values[this._name]=this}getName(){return this._name}getOrientation(){return this._orientation}getDockRect(t){return this===r.TOP?new s(t.x,t.y,t.width,t.height/2):this===r.BOTTOM?new s(t.x,t.getBottom()-t.height/2,t.width,t.height/2):this===r.LEFT?new s(t.x,t.y,t.width/2,t.height):this===r.RIGHT?new s(t.getRight()-t.width/2,t.y,t.width/2,t.height):t.clone()}split(t,e){return this===r.TOP?{start:new s(t.x,t.y,t.width,e),end:new s(t.x,t.y+e,t.width,t.height-e)}:this===r.LEFT?{start:new s(t.x,t.y,e,t.height),end:new s(t.x+e,t.y,t.width-e,t.height)}:this===r.RIGHT?{start:new s(t.getRight()-e,t.y,e,t.height),end:new s(t.x,t.y,t.width-e,t.height)}:{start:new s(t.x,t.getBottom()-e,t.width,e),end:new s(t.x,t.y,t.width,t.height-e)}}reflect(){return this===r.TOP?r.BOTTOM:this===r.LEFT?r.RIGHT:this===r.RIGHT?r.LEFT:r.TOP}toString(){return"(DockLocation: name="+this._name+", orientation="+this._orientation+")"}}r.values={},r.TOP=new r("top",i.VERT,0),r.BOTTOM=new r("bottom",i.VERT,1),r.LEFT=new r("left",i.HORZ,0),r.RIGHT=new r("right",i.HORZ,1),r.CENTER=new r("center",i.VERT,0);const a=!("undefined"==typeof window||!window.document||!window.document.createElement);class d{constructor(){this._manualGlassManagement=!1,this._startX=0,this._startY=0,this._dragDepth=0,this._glassShowing=!1,this._dragging=!1,this._active=!1,a&&(this._glass=document.createElement("div"),this._glass.style.zIndex="998",this._glass.style.backgroundColor="transparent",this._glass.style.outline="none"),this._defaultGlassCursor="default",this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._onKeyPress=this._onKeyPress.bind(this),this._onDragCancel=this._onDragCancel.bind(this),this._onDragEnter=this._onDragEnter.bind(this),this._onDragLeave=this._onDragLeave.bind(this),this.resizeGlass=this.resizeGlass.bind(this),this._lastClick=0,this._clickX=0,this._clickY=0}addGlass(t){var e;this._glassShowing?this._manualGlassManagement=!0:(this._document||(this._document=window.document),this._rootElement||(this._rootElement=this._document.body),this.resizeGlass(),null===(e=this._document.defaultView)||void 0===e||e.addEventListener("resize",this.resizeGlass),this._document.body.appendChild(this._glass),this._glass.tabIndex=-1,this._glass.focus(),this._glass.addEventListener("keydown",this._onKeyPress),this._glass.addEventListener("dragenter",this._onDragEnter,{passive:!1}),this._glass.addEventListener("dragover",this._onMouseMove,{passive:!1}),this._glass.addEventListener("dragleave",this._onDragLeave,{passive:!1}),this._glassShowing=!0,this._fDragCancel=t,this._manualGlassManagement=!1)}resizeGlass(){s.fromElement(this._rootElement).positionElement(this._glass,"fixed")}hideGlass(){var t;this._glassShowing&&(this._document.body.removeChild(this._glass),null===(t=this._document.defaultView)||void 0===t||t.removeEventListener("resize",this.resizeGlass),this._glassShowing=!1,this._document=void 0,this._rootElement=void 0,this.setGlassCursorOverride(void 0))}_updateGlassCursor(){var t;this._glass.style.cursor=null!==(t=this._glassCursorOverride)&&void 0!==t?t:this._defaultGlassCursor}_setDefaultGlassCursor(t){this._defaultGlassCursor=t,this._updateGlassCursor()}setGlassCursorOverride(t){this._glassCursorOverride=t,this._updateGlassCursor()}startDrag(t,e,i,s,n,o,r,a,d){if(t&&this._lastEvent&&this._lastEvent.type.startsWith("touch")&&t.type.startsWith("mouse")&&t.timeStamp-this._lastEvent.timeStamp<500)return;if(this._dragging)return;this._lastEvent=t,this._document=a||window.document,this._rootElement=d||this._document.body;const l=this._getLocationEvent(t);this.addGlass(n),t?(this._startX=l.clientX,this._startY=l.clientY,window.matchMedia&&!window.matchMedia("(pointer: fine)").matches||this._setDefaultGlassCursor(getComputedStyle(t.target).cursor),this._stopPropagation(t),this._preventDefault(t)):(this._startX=0,this._startY=0,this._setDefaultGlassCursor("default")),this._dragging=!1,this._fDragStart=e,this._fDragMove=i,this._fDragEnd=s,this._fDragCancel=n,this._fClick=o,this._fDblClick=r,this._active=!0,"dragenter"===(null==t?void 0:t.type)?(this._dragDepth=1,this._rootElement.addEventListener("dragenter",this._onDragEnter,{passive:!1}),this._rootElement.addEventListener("dragover",this._onMouseMove,{passive:!1}),this._rootElement.addEventListener("dragleave",this._onDragLeave,{passive:!1}),this._document.addEventListener("dragend",this._onDragCancel,{passive:!1}),this._document.addEventListener("drop",this._onMouseUp,{passive:!1})):(this._document.addEventListener("mouseup",this._onMouseUp,{passive:!1}),this._document.addEventListener("mousemove",this._onMouseMove,{passive:!1}),this._document.addEventListener("touchend",this._onMouseUp,{passive:!1}),this._document.addEventListener("touchmove",this._onMouseMove,{passive:!1}))}isDragging(){return this._dragging}isActive(){return this._active}toString(){return"(DragDrop: startX="+this._startX+", startY="+this._startY+", dragging="+this._dragging+")"}_onKeyPress(t){"Escape"===t.code&&this._onDragCancel()}_onDragCancel(){this._rootElement.removeEventListener("dragenter",this._onDragEnter),this._rootElement.removeEventListener("dragover",this._onMouseMove),this._rootElement.removeEventListener("dragleave",this._onDragLeave),this._document.removeEventListener("dragend",this._onDragCancel),this._document.removeEventListener("drop",this._onMouseUp),this._document.removeEventListener("mousemove",this._onMouseMove),this._document.removeEventListener("mouseup",this._onMouseUp),this._document.removeEventListener("touchend",this._onMouseUp),this._document.removeEventListener("touchmove",this._onMouseMove),this.hideGlass(),void 0!==this._fDragCancel&&this._fDragCancel(this._dragging),this._dragging=!1,this._active=!1}_getLocationEvent(t){let e=t;return t&&t.touches&&(e=t.touches[0]),e}_getLocationEventEnd(t){let e=t;return t.changedTouches&&(e=t.changedTouches[0]),e}_stopPropagation(t){t.stopPropagation&&t.stopPropagation()}_preventDefault(t){return t.preventDefault&&t.cancelable&&t.preventDefault(),t}_onMouseMove(t){this._lastEvent=t;const e=this._getLocationEvent(t);return this._stopPropagation(t),this._preventDefault(t),!this._dragging&&(Math.abs(this._startX-e.clientX)>5||Math.abs(this._startY-e.clientY)>5)&&(this._dragging=!0,this._fDragStart&&(this._setDefaultGlassCursor("move"),this._dragging=this._fDragStart({clientX:this._startX,clientY:this._startY}))),this._dragging&&this._fDragMove&&this._fDragMove(e),!1}_onMouseUp(t){this._lastEvent=t;const e=this._getLocationEventEnd(t);if(this._stopPropagation(t),this._preventDefault(t),this._active=!1,this._rootElement.removeEventListener("dragenter",this._onDragEnter),this._rootElement.removeEventListener("dragover",this._onMouseMove),this._rootElement.removeEventListener("dragleave",this._onDragLeave),this._document.removeEventListener("dragend",this._onDragCancel),this._document.removeEventListener("drop",this._onMouseUp),this._document.removeEventListener("mousemove",this._onMouseMove),this._document.removeEventListener("mouseup",this._onMouseUp),this._document.removeEventListener("touchend",this._onMouseUp),this._document.removeEventListener("touchmove",this._onMouseMove),this._manualGlassManagement||this.hideGlass(),this._dragging)this._dragging=!1,this._fDragEnd&&this._fDragEnd(t);else if(this._fDragCancel&&this._fDragCancel(this._dragging),Math.abs(this._startX-e.clientX)<=5&&Math.abs(this._startY-e.clientY)<=5){let i=!1;const s=(new Date).getTime();Math.abs(this._clickX-e.clientX)<=5&&Math.abs(this._clickY-e.clientY)<=5&&s-this._lastClick<500&&this._fDblClick&&(this._fDblClick(t),i=!0),!i&&this._fClick&&this._fClick(t),this._lastClick=s,this._clickX=e.clientX,this._clickY=e.clientY}return!1}_onDragEnter(t){return this._preventDefault(t),this._stopPropagation(t),this._dragDepth++,!1}_onDragLeave(t){return this._preventDefault(t),this._stopPropagation(t),this._dragDepth--,this._dragDepth<=0&&this._onDragCancel(),!1}}d.instance=new d;class l{constructor(t,e){this.type=t,this.data=e}}class h{static addNode(t,e,i,s,n){return new l(h.ADD_NODE,{json:t,toNode:e,location:i.getName(),index:s,select:n})}static moveNode(t,e,i,s,n){return new l(h.MOVE_NODE,{fromNode:t,toNode:e,location:i.getName(),index:s,select:n})}static deleteTab(t){return new l(h.DELETE_TAB,{node:t})}static deleteTabset(t){return new l(h.DELETE_TABSET,{node:t})}static renameTab(t,e){return new l(h.RENAME_TAB,{node:t,text:e})}static selectTab(t){return new l(h.SELECT_TAB,{tabNode:t})}static setActiveTabset(t){return new l(h.SET_ACTIVE_TABSET,{tabsetNode:t})}static adjustSplit(t){const e=t.node1Id,i=t.node2Id;return new l(h.ADJUST_SPLIT,{node1:e,weight1:t.weight1,pixelWidth1:t.pixelWidth1,node2:i,weight2:t.weight2,pixelWidth2:t.pixelWidth2})}static adjustBorderSplit(t,e){return new l(h.ADJUST_BORDER_SPLIT,{node:t,pos:e})}static maximizeToggle(t){return new l(h.MAXIMIZE_TOGGLE,{node:t})}static updateModelAttributes(t){return new l(h.UPDATE_MODEL_ATTRIBUTES,{json:t})}static updateNodeAttributes(t,e){return new l(h.UPDATE_NODE_ATTRIBUTES,{node:t,json:e})}static floatTab(t){return new l(h.FLOAT_TAB,{node:t})}static unFloatTab(t){return new l(h.UNFLOAT_TAB,{node:t})}}h.ADD_NODE="FlexLayout_AddNode",h.MOVE_NODE="FlexLayout_MoveNode",h.DELETE_TAB="FlexLayout_DeleteTab",h.DELETE_TABSET="FlexLayout_DeleteTabset",h.RENAME_TAB="FlexLayout_RenameTab",h.SELECT_TAB="FlexLayout_SelectTab",h.SET_ACTIVE_TABSET="FlexLayout_SetActiveTabset",h.ADJUST_SPLIT="FlexLayout_AdjustSplit",h.ADJUST_BORDER_SPLIT="FlexLayout_AdjustBorderSplit",h.MAXIMIZE_TOGGLE="FlexLayout_MaximizeToggle",h.UPDATE_MODEL_ATTRIBUTES="FlexLayout_UpdateModelAttributes",h.UPDATE_NODE_ATTRIBUTES="FlexLayout_UpdateNodeAttributes",h.FLOAT_TAB="FlexLayout_FloatTab",h.UNFLOAT_TAB="FlexLayout_UnFloatTab";class _{constructor(t,e,i,s){this.name=t,this.modelName=e,this.defaultValue=i,this.alwaysWriteJson=s,this.required=!1,this.fixed=!1,this.type="any"}setType(t){return this.type=t,this}setRequired(){return this.required=!0,this}setFixed(){return this.fixed=!0,this}}_.NUMBER="number",_.STRING="string",_.BOOLEAN="boolean";class c{constructor(){this.attributes=[],this.nameToAttribute={}}addWithAll(t,e,i,s){const n=new _(t,e,i,s);return this.attributes.push(n),this.nameToAttribute[t]=n,n}addInherited(t,e){return this.addWithAll(t,e,void 0,!1)}add(t,e,i){return this.addWithAll(t,void 0,e,i)}getAttributes(){return this.attributes}getModelName(t){const e=this.nameToAttribute[t];if(void 0!==e)return e.modelName}toJson(t,e){for(const i of this.attributes){const s=e[i.name];(i.alwaysWriteJson||s!==i.defaultValue)&&(t[i.name]=s)}}fromJson(t,e){for(const i of this.attributes){const s=t[i.name];e[i.name]=void 0===s?i.defaultValue:s}}update(t,e){for(const i of this.attributes)if(t.hasOwnProperty(i.name)){const s=t[i.name];void 0===s?delete e[i.name]:e[i.name]=s}}setDefaults(t){for(const e of this.attributes)t[e.name]=e.defaultValue}toTypescriptInterface(t,e){const i=[],s=this.attributes.sort(((t,e)=>t.name.localeCompare(e.name)));i.push("export interface I"+t+"Attributes {");for(let t=0;t<s.length;t++){const n=s[t];let o,r,a=n.type,d=n;void 0!==d.defaultValue?o=d.defaultValue:void 0!==d.modelName&&void 0!==e&&void 0!==e.nameToAttribute[d.modelName]&&(r=d.modelName,d=e.nameToAttribute[d.modelName],o=d.defaultValue,a=d.type);let l=JSON.stringify(o);const h=d.required||d.fixed?"":"?";if(n.fixed)i.push("\t"+n.name+": "+l+";");else{const t=(void 0!==o?"default: "+l:"")+(void 0!==r?" - inherited from global "+r:"");i.push("\t"+n.name+h+": "+a+";"+(t.length>0?" // "+t:""))}}return i.push("}"),i.join("\n")}}class u{constructor(t,e,i,s,n){this.node=t,this.rect=e,this.location=i,this.index=s,this.className=n}}var g,T,E;!function(t){t.FLEXLAYOUT__BORDER="flexlayout__border",t.FLEXLAYOUT__BORDER_="flexlayout__border_",t.FLEXLAYOUT__BORDER_BUTTON="flexlayout__border_button",t.FLEXLAYOUT__BORDER_BUTTON_="flexlayout__border_button_",t.FLEXLAYOUT__BORDER_BUTTON_CONTENT="flexlayout__border_button_content",t.FLEXLAYOUT__BORDER_BUTTON_LEADING="flexlayout__border_button_leading",t.FLEXLAYOUT__BORDER_BUTTON_TRAILING="flexlayout__border_button_trailing",t.FLEXLAYOUT__BORDER_BUTTON__SELECTED="flexlayout__border_button--selected",t.FLEXLAYOUT__BORDER_BUTTON__UNSELECTED="flexlayout__border_button--unselected",t.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW="flexlayout__border_toolbar_button_overflow",t.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_="flexlayout__border_toolbar_button_overflow_",t.FLEXLAYOUT__BORDER_INNER="flexlayout__border_inner",t.FLEXLAYOUT__BORDER_INNER_="flexlayout__border_inner_",t.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER="flexlayout__border_inner_tab_container",t.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_="flexlayout__border_inner_tab_container_",t.FLEXLAYOUT__BORDER_TAB_DIVIDER="flexlayout__border_tab_divider",t.FLEXLAYOUT__BORDER_SIZER="flexlayout__border_sizer",t.FLEXLAYOUT__BORDER_TOOLBAR="flexlayout__border_toolbar",t.FLEXLAYOUT__BORDER_TOOLBAR_="flexlayout__border_toolbar_",t.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON="flexlayout__border_toolbar_button",t.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT="flexlayout__border_toolbar_button-float",t.FLEXLAYOUT__DRAG_RECT="flexlayout__drag_rect",t.FLEXLAYOUT__EDGE_RECT="flexlayout__edge_rect",t.FLEXLAYOUT__EDGE_RECT_TOP="flexlayout__edge_rect_top",t.FLEXLAYOUT__EDGE_RECT_LEFT="flexlayout__edge_rect_left",t.FLEXLAYOUT__EDGE_RECT_BOTTOM="flexlayout__edge_rect_bottom",t.FLEXLAYOUT__EDGE_RECT_RIGHT="flexlayout__edge_rect_right",t.FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER="flexlayout__error_boundary_container",t.FLEXLAYOUT__ERROR_BOUNDARY_CONTENT="flexlayout__error_boundary_content",t.FLEXLAYOUT__FLOATING_WINDOW_CONTENT="flexlayout__floating_window_content",t.FLEXLAYOUT__FLOATING_WINDOW_TAB="flexlayout__floating_window_tab",t.FLEXLAYOUT__LAYOUT="flexlayout__layout",t.FLEXLAYOUT__OUTLINE_RECT="flexlayout__outline_rect",t.FLEXLAYOUT__OUTLINE_RECT_EDGE="flexlayout__outline_rect_edge",t.FLEXLAYOUT__SPLITTER="flexlayout__splitter",t.FLEXLAYOUT__SPLITTER_EXTRA="flexlayout__splitter_extra",t.FLEXLAYOUT__SPLITTER_="flexlayout__splitter_",t.FLEXLAYOUT__SPLITTER_BORDER="flexlayout__splitter_border",t.FLEXLAYOUT__SPLITTER_DRAG="flexlayout__splitter_drag",t.FLEXLAYOUT__TAB="flexlayout__tab",t.FLEXLAYOUT__TABSET="flexlayout__tabset",t.FLEXLAYOUT__TABSET_HEADER="flexlayout__tabset_header",t.FLEXLAYOUT__TABSET_HEADER_SIZER="flexlayout__tabset_header_sizer",t.FLEXLAYOUT__TABSET_HEADER_CONTENT="flexlayout__tabset_header_content",t.FLEXLAYOUT__TABSET_MAXIMIZED="flexlayout__tabset-maximized",t.FLEXLAYOUT__TABSET_SELECTED="flexlayout__tabset-selected",t.FLEXLAYOUT__TABSET_SIZER="flexlayout__tabset_sizer",t.FLEXLAYOUT__TABSET_TAB_DIVIDER="flexlayout__tabset_tab_divider",t.FLEXLAYOUT__TABSET_CONTENT="flexlayout__tabset_content",t.FLEXLAYOUT__TABSET_TABBAR_INNER="flexlayout__tabset_tabbar_inner",t.FLEXLAYOUT__TABSET_TABBAR_INNER_="flexlayout__tabset_tabbar_inner_",t.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER="flexlayout__tabset_tabbar_inner_tab_container",t.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_="flexlayout__tabset_tabbar_inner_tab_container_",t.FLEXLAYOUT__TABSET_TABBAR_OUTER="flexlayout__tabset_tabbar_outer",t.FLEXLAYOUT__TABSET_TABBAR_OUTER_="flexlayout__tabset_tabbar_outer_",t.FLEXLAYOUT__TAB_BORDER="flexlayout__tab_border",t.FLEXLAYOUT__TAB_BORDER_="flexlayout__tab_border_",t.FLEXLAYOUT__TAB_BUTTON="flexlayout__tab_button",t.FLEXLAYOUT__TAB_BUTTON_STRETCH="flexlayout__tab_button_stretch",t.FLEXLAYOUT__TAB_BUTTON_CONTENT="flexlayout__tab_button_content",t.FLEXLAYOUT__TAB_BUTTON_LEADING="flexlayout__tab_button_leading",t.FLEXLAYOUT__TAB_BUTTON_OVERFLOW="flexlayout__tab_button_overflow",t.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT="flexlayout__tab_button_overflow_count",t.FLEXLAYOUT__TAB_BUTTON_TEXTBOX="flexlayout__tab_button_textbox",t.FLEXLAYOUT__TAB_BUTTON_TRAILING="flexlayout__tab_button_trailing",t.FLEXLAYOUT__TAB_BUTTON_STAMP="flexlayout__tab_button_stamp",t.FLEXLAYOUT__TAB_FLOATING="flexlayout__tab_floating",t.FLEXLAYOUT__TAB_FLOATING_INNER="flexlayout__tab_floating_inner",t.FLEXLAYOUT__TAB_TOOLBAR="flexlayout__tab_toolbar",t.FLEXLAYOUT__TAB_TOOLBAR_BUTTON="flexlayout__tab_toolbar_button",t.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_="flexlayout__tab_toolbar_button-",t.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT="flexlayout__tab_toolbar_button-float",t.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER="flexlayout__tab_toolbar_sticky_buttons_container",t.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE="flexlayout__tab_toolbar_button-close",t.FLEXLAYOUT__POPUP_MENU_CONTAINER="flexlayout__popup_menu_container",t.FLEXLAYOUT__POPUP_MENU_ITEM="flexlayout__popup_menu_item",t.FLEXLAYOUT__POPUP_MENU="flexlayout__popup_menu"}(g||(g={}));class p{constructor(t){this._dirty=!1,this._tempSize=0,this._model=t,this._attributes={},this._children=[],this._fixed=!1,this._rect=s.empty(),this._visible=!1,this._listeners={}}getId(){let t=this._attributes.id;return void 0!==t||(t=this._model._nextUniqueId(),this._setId(t)),t}getModel(){return this._model}getType(){return this._attributes.type}getParent(){return this._parent}getChildren(){return this._children}getRect(){return this._rect}isVisible(){return this._visible}getOrientation(){return void 0===this._parent?this._model.isRootOrientationVertical()?i.VERT:i.HORZ:i.flip(this._parent.getOrientation())}setEventListener(t,e){this._listeners[t]=e}removeEventListener(t){delete this._listeners[t]}_setId(t){this._attributes.id=t}_fireEvent(t,e){void 0!==this._listeners[t]&&this._listeners[t](e)}_getAttr(t){let e=this._attributes[t];if(void 0===e){const i=this._getAttributeDefinitions().getModelName(t);void 0!==i&&(e=this._model._getAttribute(i))}return e}_forEachNode(t,e){t(this,e),e++;for(const i of this._children)i._forEachNode(t,e)}_setVisible(t){t!==this._visible&&(this._fireEvent("visibility",{visible:t}),this._visible=t)}_getDrawChildren(){return this._children}_setParent(t){this._parent=t}_setRect(t){this._rect=t}_setWeight(t){this._attributes.weight=t}_setSelected(t){this._attributes.selected=t}_isFixed(){return this._fixed}_layout(t,e){this._rect=t}_findDropTargetNode(t,e,i){let s;if(this._rect.contains(e,i))if(void 0!==this._model.getMaximizedTabset())s=this._model.getMaximizedTabset().canDrop(t,e,i);else if(s=this.canDrop(t,e,i),void 0===s&&0!==this._children.length)for(const n of this._children)if(s=n._findDropTargetNode(t,e,i),void 0!==s)break;return s}canDrop(t,e,i){}_canDockInto(t,e){if(null!=e){if(e.location===r.CENTER&&!1===e.node.isEnableDrop())return!1;if(e.location===r.CENTER&&"tabset"===t.getType()&&void 0!==t.getName())return!1;if(e.location!==r.CENTER&&!1===e.node.isEnableDivide())return!1;if(this._model._getOnAllowDrop())return this._model._getOnAllowDrop()(t,e)}return!0}_removeChild(t){const e=this._children.indexOf(t);return-1!==e&&this._children.splice(e,1),this._dirty=!0,e}_addChild(t,e){return null!=e?this._children.splice(e,0,t):(this._children.push(t),e=this._children.length-1),t._parent=this,this._dirty=!0,e}_removeAll(){this._children=[],this._dirty=!0}_styleWithPosition(t){return null==t&&(t={}),this._rect.styleWithPosition(t)}_getTempSize(){return this._tempSize}_setTempSize(t){this._tempSize=t}isEnableDivide(){return!0}_toAttributeString(){return JSON.stringify(this._attributes,void 0,"\t")}}class m extends p{constructor(t){super(t),this._fixed=!0,this._attributes.type=m.TYPE,t._addNode(this)}getWidth(){return this._model.getSplitterSize()}getMinWidth(){return this.getOrientation()===i.VERT?this._model.getSplitterSize():0}getHeight(){return this._model.getSplitterSize()}getMinHeight(){return this.getOrientation()===i.HORZ?this._model.getSplitterSize():0}getMinSize(t){return t===i.HORZ?this.getMinWidth():this.getMinHeight()}getWeight(){return 0}_setWeight(t){}_getPrefSize(t){return this._model.getSplitterSize()}_updateAttrs(t){}_getAttributeDefinitions(){return new c}toJson(){}}m.TYPE="splitter";class b extends p{static _fromJson(t,e,i=!0){return new b(e,t,i)}static _createAttributeDefinitions(){const t=new c;return t.add("type",b.TYPE,!0).setType(_.STRING),t.add("id",void 0).setType(_.STRING),t.add("name","[Unnamed Tab]").setType(_.STRING),t.add("altName",void 0).setType(_.STRING),t.add("helpText",void 0).setType(_.STRING),t.add("component",void 0).setType(_.STRING),t.add("config",void 0).setType("any"),t.add("floating",!1).setType(_.BOOLEAN),t.add("tabsetClassName",void 0).setType(_.STRING),t.addInherited("enableClose","tabEnableClose").setType(_.BOOLEAN),t.addInherited("closeType","tabCloseType").setType("ICloseType"),t.addInherited("enableDrag","tabEnableDrag").setType(_.BOOLEAN),t.addInherited("enableRename","tabEnableRename").setType(_.BOOLEAN),t.addInherited("className","tabClassName").setType(_.STRING),t.addInherited("contentClassName","tabContentClassName").setType(_.STRING),t.addInherited("icon","tabIcon").setType(_.STRING),t.addInherited("enableRenderOnDemand","tabEnableRenderOnDemand").setType(_.BOOLEAN),t.addInherited("enableFloat","tabEnableFloat").setType(_.BOOLEAN),t.addInherited("borderWidth","tabBorderWidth").setType(_.NUMBER),t.addInherited("borderHeight","tabBorderHeight").setType(_.NUMBER),t}constructor(t,e,i=!0){super(t),this._extra={},b._attributeDefinitions.fromJson(e,this._attributes),!0===i&&t._addNode(this)}getWindow(){return this._window}getTabRect(){return this._tabRect}_setTabRect(t){this._tabRect=t}_setRenderedName(t){this._renderedName=t}_getNameForOverflowMenu(){const t=this._getAttr("altName");return void 0!==t?t:this._renderedName}getName(){return this._getAttr("name")}getHelpText(){return this._getAttr("helpText")}getComponent(){return this._getAttr("component")}getConfig(){return this._attributes.config}getExtraData(){return this._extra}isFloating(){return this._getAttr("floating")}getIcon(){return this._getAttr("icon")}isEnableClose(){return this._getAttr("enableClose")}getCloseType(){return this._getAttr("closeType")}isEnableFloat(){return this._getAttr("enableFloat")}isEnableDrag(){return this._getAttr("enableDrag")}isEnableRename(){return this._getAttr("enableRename")}getClassName(){return this._getAttr("className")}getContentClassName(){return this._getAttr("contentClassName")}getTabSetClassName(){return this._getAttr("tabsetClassName")}isEnableRenderOnDemand(){return this._getAttr("enableRenderOnDemand")}_setName(t){this._attributes.name=t,this._window&&this._window.document&&(this._window.document.title=t)}_setFloating(t){this._attributes.floating=t}_layout(t,e){t.equals(this._rect)||this._fireEvent("resize",{rect:t}),this._rect=t}_delete(){this._parent._remove(this),this._fireEvent("close",{})}toJson(){const t={};return b._attributeDefinitions.toJson(t,this._attributes),t}_updateAttrs(t){b._attributeDefinitions.update(t,this._attributes)}_getAttributeDefinitions(){return b._attributeDefinitions}_setWindow(t){this._window=t}_setBorderWidth(t){this._attributes.borderWidth=t}_setBorderHeight(t){this._attributes.borderHeight=t}static getAttributeDefinitions(){return b._attributeDefinitions}}b.TYPE="tab",b._attributeDefinitions=b._createAttributeDefinitions();class f extends p{static _fromJson(t,e){const i=new f(e,t);if(null!=t.children)for(const s of t.children)if(s.type===v.TYPE){const t=v._fromJson(s,e);i._addChild(t)}else{const t=f._fromJson(s,e);i._addChild(t)}return i}static _createAttributeDefinitions(){const t=new c;return t.add("type",f.TYPE,!0).setType(_.STRING).setFixed(),t.add("id",void 0).setType(_.STRING),t.add("weight",100).setType(_.NUMBER),t.add("width",void 0).setType(_.NUMBER),t.add("height",void 0).setType(_.NUMBER),t}constructor(t,e){super(t),this._dirty=!0,this._drawChildren=[],this._minHeight=0,this._minWidth=0,f._attributeDefinitions.fromJson(e,this._attributes),t._addNode(this)}getWeight(){return this._attributes.weight}getWidth(){return this._getAttr("width")}getHeight(){return this._getAttr("height")}_setWeight(t){this._attributes.weight=t}_layout(t,e){super._layout(t,e);const n=this._rect._getSize(this.getOrientation());let o=0,r=0,a=0,d=0;const l=this._getDrawChildren();for(const t of l){const e=t._getPrefSize(this.getOrientation());t._isFixed()?void 0!==e&&(r+=e):void 0===e?o+=t.getWeight():(a+=e,d+=t.getWeight())}let h=!1,_=n-r-a;_<0&&(_=n-r,h=!0,o+=d);let c=0,u=0;for(const t of l){const e=t._getPrefSize(this.getOrientation());if(t._isFixed())void 0!==e&&t._setTempSize(e);else if(null==e||h){if(0===o)t._setTempSize(0);else{const e=t.getMinSize(this.getOrientation()),i=Math.floor(_*(t.getWeight()/o));t._setTempSize(Math.max(e,i))}u+=t._getTempSize()}else t._setTempSize(e);c+=t._getTempSize()}if(u>0){for(;c<n;)for(const t of l)if(!(t instanceof m)){const e=t._getPrefSize(this.getOrientation());!t._isFixed()&&(void 0===e||h)&&c<n&&(t._setTempSize(t._getTempSize()+1),c++)}for(;c>n;){let t=!1;for(const e of l)if(!(e instanceof m)){const i=e.getMinSize(this.getOrientation());e._getTempSize()>i&&c>n&&(e._setTempSize(e._getTempSize()-1),c--,t=!0)}if(!t)break}for(;c>n;){let t=!1;for(const e of l)e instanceof m||e._getTempSize()>0&&c>n&&(e._setTempSize(e._getTempSize()-1),c--,t=!0);if(!t)break}}let g=0;for(const t of l)this.getOrientation()===i.HORZ?t._layout(new s(this._rect.x+g,this._rect.y,t._getTempSize(),this._rect.height),e):t._layout(new s(this._rect.x,this._rect.y+g,this._rect.width,t._getTempSize()),e),g+=t._getTempSize();return!0}_getSplitterBounds(t,e=!1){const s=[0,0],n=this._getDrawChildren(),o=n.indexOf(t),r=n[o-1],a=n[o+1];if(this.getOrientation()===i.HORZ){const i=e?r.getMinWidth():0,n=e?a.getMinWidth():0;s[0]=r.getRect().x+i,s[1]=a.getRect().getRight()-t.getWidth()-n}else{const i=e?r.getMinHeight():0,n=e?a.getMinHeight():0;s[0]=r.getRect().y+i,s[1]=a.getRect().getBottom()-t.getHeight()-n}return s}_calculateSplit(t,e){let i;const s=this._getDrawChildren(),n=s.indexOf(t),o=this._getSplitterBounds(t),r=s[n-1].getWeight()+s[n+1].getWeight(),a=Math.max(0,e-o[0]),d=Math.max(0,o[1]-e);if(a+d>0){const t=a*r/(a+d),e=d*r/(a+d);i={node1Id:s[n-1].getId(),weight1:t,pixelWidth1:a,node2Id:s[n+1].getId(),weight2:e,pixelWidth2:d}}return i}_getDrawChildren(){if(this._dirty){this._drawChildren=[];for(let t=0;t<this._children.length;t++){const e=this._children[t];if(0!==t){const t=new m(this._model);t._setParent(this),this._drawChildren.push(t)}this._drawChildren.push(e)}this._dirty=!1}return this._drawChildren}getMinSize(t){return t===i.HORZ?this.getMinWidth():this.getMinHeight()}getMinWidth(){return this._minWidth}getMinHeight(){return this._minHeight}calcMinSize(){this._minHeight=0,this._minWidth=0;let t=!0;for(const e of this._children){const s=e;s instanceof f&&s.calcMinSize(),this.getOrientation()===i.VERT?(this._minHeight+=s.getMinHeight(),t||(this._minHeight+=this._model.getSplitterSize()),this._minWidth=Math.max(this._minWidth,s.getMinWidth())):(this._minWidth+=s.getMinWidth(),t||(this._minWidth+=this._model.getSplitterSize()),this._minHeight=Math.max(this._minHeight,s.getMinHeight())),t=!1}}_tidy(){let t=0;for(;t<this._children.length;){const e=this._children[t];if(e instanceof f){e._tidy();const i=e.getChildren();if(0===i.length)this._removeChild(e);else if(1===i.length){const s=i[0];if(this._removeChild(e),s instanceof f){let i=0;const n=s.getChildren();for(const t of n)i+=t.getWeight();for(let s=0;s<n.length;s++){const o=n[s];o._setWeight(e.getWeight()*o.getWeight()/i),this._addChild(o,t+s)}}else s._setWeight(e.getWeight()),this._addChild(s,t)}else t++}else e instanceof v&&0===e.getChildren().length&&e.isEnableDeleteWhenEmpty()?(this._removeChild(e),e===this._model.getMaximizedTabset()&&this._model._setMaximizedTabset(void 0)):t++}if(this===this._model.getRoot()&&0===this._children.length){const t=this._model._getOnCreateTabSet();let e=t?t():{};e=Object.assign(Object.assign({},e),{selected:-1});const i=new v(this._model,e);this._model._setActiveTabset(i),this._addChild(i)}}canDrop(t,e,i){const s=i-this._rect.y,n=e-this._rect.x,o=this._rect.width,a=this._rect.height,d=50;let l;if(this._model.isEnableEdgeDock()&&void 0===this._parent){if(e<this._rect.x+10&&s>a/2-d&&s<a/2+d){const t=r.LEFT,e=t.getDockRect(this._rect);e.width=e.width/2,l=new u(this,e,t,-1,g.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(e>this._rect.getRight()-10&&s>a/2-d&&s<a/2+d){const t=r.RIGHT,e=t.getDockRect(this._rect);e.width=e.width/2,e.x+=e.width,l=new u(this,e,t,-1,g.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(i<this._rect.y+10&&n>o/2-d&&n<o/2+d){const t=r.TOP,e=t.getDockRect(this._rect);e.height=e.height/2,l=new u(this,e,t,-1,g.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(i>this._rect.getBottom()-10&&n>o/2-d&&n<o/2+d){const t=r.BOTTOM,e=t.getDockRect(this._rect);e.height=e.height/2,e.y+=e.height,l=new u(this,e,t,-1,g.FLEXLAYOUT__OUTLINE_RECT_EDGE)}if(void 0!==l&&!t._canDockInto(t,l))return}return l}drop(t,e,i){const s=e,n=t.getParent();let o;if(n&&n._removeChild(t),void 0!==n&&n.getType()===v.TYPE&&n._setSelected(0),void 0!==n&&n.getType()===R.TYPE&&n._setSelected(-1),t instanceof v)o=t;else{const e=this._model._getOnCreateTabSet();o=new v(this._model,e?e(t):{}),o._addChild(t)}let a=this._children.reduce(((t,e)=>t+e.getWeight()),0);0===a&&(a=100),o._setWeight(a/3);const d=!this._model.isRootOrientationVertical();if(d&&s===r.LEFT||!d&&s===r.TOP)this._addChild(o,0);else if(d&&s===r.RIGHT||!d&&s===r.BOTTOM)this._addChild(o);else if(d&&s===r.TOP||!d&&s===r.LEFT){const t=new f(this._model,{}),e=new f(this._model,{});e._setWeight(75),o._setWeight(25);for(const t of this._children)e._addChild(t);this._removeAll(),t._addChild(o),t._addChild(e),this._addChild(t)}else if(d&&s===r.BOTTOM||!d&&s===r.RIGHT){const t=new f(this._model,{}),e=new f(this._model,{});e._setWeight(75),o._setWeight(25);for(const t of this._children)e._addChild(t);this._removeAll(),t._addChild(e),t._addChild(o),this._addChild(t)}this._model._setActiveTabset(o),this._model._tidy()}toJson(){const t={};f._attributeDefinitions.toJson(t,this._attributes),t.children=[];for(const e of this._children)t.children.push(e.toJson());return t}isEnableDrop(){return!0}_getPrefSize(t){let e=this.getWidth();return t===i.VERT&&(e=this.getHeight()),e}_getAttributeDefinitions(){return f._attributeDefinitions}_updateAttrs(t){f._attributeDefinitions.update(t,this._attributes)}static getAttributeDefinitions(){return f._attributeDefinitions}}f.TYPE="row",f._attributeDefinitions=f._createAttributeDefinitions();class v extends p{static _fromJson(t,e){const i=new v(e,t);if(null!=t.children)for(const s of t.children){const t=b._fromJson(s,e);i._addChild(t)}return 0===i._children.length&&i._setSelected(-1),t.maximized&&!0===t.maximized&&e._setMaximizedTabset(i),t.active&&!0===t.active&&e._setActiveTabset(i),i}static _createAttributeDefinitions(){const t=new c;return t.add("type",v.TYPE,!0).setType(_.STRING).setFixed(),t.add("id",void 0).setType(_.STRING),t.add("weight",100).setType(_.NUMBER),t.add("width",void 0).setType(_.NUMBER),t.add("height",void 0).setType(_.NUMBER),t.add("selected",0).setType(_.NUMBER),t.add("name",void 0).setType(_.STRING),t.add("config",void 0).setType("any"),t.addInherited("enableDeleteWhenEmpty","tabSetEnableDeleteWhenEmpty"),t.addInherited("enableDrop","tabSetEnableDrop"),t.addInherited("enableDrag","tabSetEnableDrag"),t.addInherited("enableDivide","tabSetEnableDivide"),t.addInherited("enableMaximize","tabSetEnableMaximize"),t.addInherited("enableClose","tabSetEnableClose"),t.addInherited("enableSingleTabStretch","tabSetEnableSingleTabStretch"),t.addInherited("classNameTabStrip","tabSetClassNameTabStrip"),t.addInherited("classNameHeader","tabSetClassNameHeader"),t.addInherited("enableTabStrip","tabSetEnableTabStrip"),t.addInherited("borderInsets","tabSetBorderInsets"),t.addInherited("marginInsets","tabSetMarginInsets"),t.addInherited("minWidth","tabSetMinWidth"),t.addInherited("minHeight","tabSetMinHeight"),t.addInherited("headerHeight","tabSetHeaderHeight"),t.addInherited("tabStripHeight","tabSetTabStripHeight"),t.addInherited("tabLocation","tabSetTabLocation"),t.addInherited("autoSelectTab","tabSetAutoSelectTab").setType(_.BOOLEAN),t}constructor(t,e){super(t),v._attributeDefinitions.fromJson(e,this._attributes),t._addNode(this),this._calculatedTabBarHeight=0,this._calculatedHeaderBarHeight=0}getName(){return this._getAttr("name")}getSelected(){const t=this._attributes.selected;return void 0!==t?t:-1}getSelectedNode(){const t=this.getSelected();if(-1!==t)return this._children[t]}getWeight(){return this._getAttr("weight")}getWidth(){return this._getAttr("width")}getMinWidth(){return this._getAttr("minWidth")}getHeight(){return this._getAttr("height")}getMinHeight(){return this._getAttr("minHeight")}getMinSize(t){return t===i.HORZ?this.getMinWidth():this.getMinHeight()}getConfig(){return this._attributes.config}isMaximized(){return this._model.getMaximizedTabset()===this}isActive(){return this._model.getActiveTabset()===this}isEnableDeleteWhenEmpty(){return this._getAttr("enableDeleteWhenEmpty")}isEnableDrop(){return this._getAttr("enableDrop")}isEnableDrag(){return this._getAttr("enableDrag")}isEnableDivide(){return this._getAttr("enableDivide")}isEnableMaximize(){return this._getAttr("enableMaximize")}isEnableClose(){return this._getAttr("enableClose")}isEnableSingleTabStretch(){return this._getAttr("enableSingleTabStretch")}canMaximize(){return!!this.isEnableMaximize()&&(this.getModel().getMaximizedTabset()===this||this.getParent()!==this.getModel().getRoot()||1!==this.getModel().getRoot().getChildren().length)}isEnableTabStrip(){return this._getAttr("enableTabStrip")}isAutoSelectTab(){return this._getAttr("autoSelectTab")}getClassNameTabStrip(){return this._getAttr("classNameTabStrip")}getClassNameHeader(){return this._getAttr("classNameHeader")}calculateHeaderBarHeight(t){const e=this._getAttr("headerHeight");this._calculatedHeaderBarHeight=0!==e?e:t.headerBarSize}calculateTabBarHeight(t){const e=this._getAttr("tabStripHeight");this._calculatedTabBarHeight=0!==e?e:t.tabBarSize}getHeaderHeight(){return this._calculatedHeaderBarHeight}getTabStripHeight(){return this._calculatedTabBarHeight}getTabLocation(){return this._getAttr("tabLocation")}_setWeight(t){this._attributes.weight=t}_setSelected(t){this._attributes.selected=t}canDrop(t,e,i){let n;if(t===this){const t=r.CENTER,e=this._tabHeaderRect;n=new u(this,e,t,-1,g.FLEXLAYOUT__OUTLINE_RECT)}else if(this._contentRect.contains(e,i)){let t=r.CENTER;void 0===this._model.getMaximizedTabset()&&(t=r.getLocation(this._contentRect,e,i));const s=t.getDockRect(this._rect);n=new u(this,s,t,-1,g.FLEXLAYOUT__OUTLINE_RECT)}else if(null!=this._tabHeaderRect&&this._tabHeaderRect.contains(e,i)){let t,i,o;if(0===this._children.length)t=this._tabHeaderRect.clone(),i=t.y+3,o=t.height-4,t.width=2;else{let a=this._children[0];t=a.getTabRect(),i=t.y,o=t.height;let d=this._tabHeaderRect.x,l=0;for(let h=0;h<this._children.length;h++){if(a=this._children[h],t=a.getTabRect(),l=t.x+t.width/2,e>=d&&e<l){const e=r.CENTER,a=new s(t.x-2,i,3,o);n=new u(this,a,e,h,g.FLEXLAYOUT__OUTLINE_RECT);break}d=l}}if(null==n){const e=r.CENTER,a=new s(t.getRight()-2,i,3,o);n=new u(this,a,e,this._children.length,g.FLEXLAYOUT__OUTLINE_RECT)}}if(t._canDockInto(t,n))return n}_layout(t,e){this.calculateHeaderBarHeight(e),this.calculateTabBarHeight(e),this.isMaximized()&&(t=this._model.getRoot().getRect()),t=t.removeInsets(this._getAttr("marginInsets")),this._rect=t,t=t.removeInsets(this._getAttr("borderInsets"));let i=0,n=0;void 0!==this.getName()&&(i+=this._calculatedHeaderBarHeight,n+=this._calculatedHeaderBarHeight),this.isEnableTabStrip()&&("top"===this.getTabLocation()?this._tabHeaderRect=new s(t.x,t.y+i,t.width,this._calculatedTabBarHeight):this._tabHeaderRect=new s(t.x,t.y+t.height-this._calculatedTabBarHeight,t.width,this._calculatedTabBarHeight),n+=this._calculatedTabBarHeight,"top"===this.getTabLocation()&&(i+=this._calculatedTabBarHeight)),this._contentRect=new s(t.x,t.y+i,t.width,t.height-n);for(let t=0;t<this._children.length;t++){const i=this._children[t];i._layout(this._contentRect,e),i._setVisible(t===this.getSelected())}}_delete(){this._parent._removeChild(this)}_remove(t){const e=this._removeChild(t);this._model._tidy(),O(this,e)}drop(t,e,i,s){const n=e;if(this===t)return;let o=t.getParent(),a=0;if(void 0!==o&&(a=o._removeChild(t),o instanceof R&&o.getSelected()===a?o._setSelected(-1):O(o,a)),t.getType()===b.TYPE&&o===this&&a<i&&i>0&&i--,n===r.CENTER){let e=i;if(-1===e&&(e=this._children.length),t.getType()===b.TYPE)this._addChild(t,e),(s||!1!==s&&this.isAutoSelectTab())&&this._setSelected(e);else{for(let i=0;i<t.getChildren().length;i++){const s=t.getChildren()[i];this._addChild(s,e),e++}-1===this.getSelected()&&this._children.length>0&&this._setSelected(0)}this._model._setActiveTabset(this)}else{let e;if(t instanceof b){const i=this._model._getOnCreateTabSet();e=new v(this._model,i?i(t):{}),e._addChild(t),o=e}else e=t;const i=this._parent,s=i.getChildren().indexOf(this);if(i.getOrientation()===n._orientation)e._setWeight(this.getWeight()/2),this._setWeight(this.getWeight()/2),i._addChild(e,s+n._indexPlus);else{const t=new f(this._model,{});t._setWeight(this.getWeight()),t._addChild(this),this._setWeight(50),e._setWeight(50),t._addChild(e,n._indexPlus),i._removeChild(this),i._addChild(t,s)}this._model._setActiveTabset(e)}this._model._tidy()}toJson(){const t={};return v._attributeDefinitions.toJson(t,this._attributes),t.children=this._children.map((t=>t.toJson())),this.isActive()&&(t.active=!0),this.isMaximized()&&(t.maximized=!0),t}_updateAttrs(t){v._attributeDefinitions.update(t,this._attributes)}_getAttributeDefinitions(){return v._attributeDefinitions}_getPrefSize(t){let e=this.getWidth();return t===i.VERT&&(e=this.getHeight()),e}static getAttributeDefinitions(){return v._attributeDefinitions}}function O(t,e){if(void 0!==t&&(t.getType()===v.TYPE||t.getType()===R.TYPE)){const i=t.getSelected();-1!==i&&(e===i&&t.getChildren().length>0?e>=t.getChildren().length&&t._setSelected(t.getChildren().length-1):e<i?t._setSelected(i-1):e>i||t._setSelected(-1))}}v.TYPE="tabset",v._attributeDefinitions=v._createAttributeDefinitions();class R extends p{static _fromJson(t,e){const i=r.getByName(t.location),s=new R(i,t,e);return t.children&&(s._children=t.children.map((t=>{const i=b._fromJson(t,e);return i._setParent(s),i}))),s}static _createAttributeDefinitions(){const t=new c;return t.add("type",R.TYPE,!0).setType(_.STRING).setFixed(),t.add("selected",-1).setType(_.NUMBER),t.add("show",!0).setType(_.BOOLEAN),t.add("config",void 0).setType("any"),t.addInherited("barSize","borderBarSize").setType(_.NUMBER),t.addInherited("enableDrop","borderEnableDrop").setType(_.BOOLEAN),t.addInherited("className","borderClassName").setType(_.STRING),t.addInherited("autoSelectTabWhenOpen","borderAutoSelectTabWhenOpen").setType(_.BOOLEAN),t.addInherited("autoSelectTabWhenClosed","borderAutoSelectTabWhenClosed").setType(_.BOOLEAN),t.addInherited("size","borderSize").setType(_.NUMBER),t.addInherited("minSize","borderMinSize").setType(_.NUMBER),t.addInherited("enableAutoHide","borderEnableAutoHide").setType(_.BOOLEAN),t}constructor(t,e,i){super(i),this._adjustedSize=0,this._calculatedBorderBarSize=0,this._location=t,this._drawChildren=[],this._attributes.id=`border_${t.getName()}`,R._attributeDefinitions.fromJson(e,this._attributes),i._addNode(this)}getLocation(){return this._location}getTabHeaderRect(){return this._tabHeaderRect}getRect(){return this._tabHeaderRect}getContentRect(){return this._contentRect}isEnableDrop(){return this._getAttr("enableDrop")}isAutoSelectTab(t){return null==t&&(t=-1!==this.getSelected()),t?this._getAttr("autoSelectTabWhenOpen"):this._getAttr("autoSelectTabWhenClosed")}getClassName(){return this._getAttr("className")}calcBorderBarSize(t){const e=this._getAttr("barSize");this._calculatedBorderBarSize=0!==e?e:t.borderBarSize}getBorderBarSize(){return this._calculatedBorderBarSize}getSize(){const t=this._getAttr("size"),e=this.getSelected();if(-1===e)return t;{const s=this._children[e],n=this._location._orientation===i.HORZ?s._getAttr("borderWidth"):s._getAttr("borderHeight");return-1===n?t:n}}getMinSize(){return this._getAttr("minSize")}getSelected(){return this._attributes.selected}getSelectedNode(){if(-1!==this.getSelected())return this._children[this.getSelected()]}getOrientation(){return this._location.getOrientation()}getConfig(){return this._attributes.config}isMaximized(){return!1}isShowing(){return!(!this._attributes.show||this._model._getShowHiddenBorder()!==this._location&&this.isAutoHide()&&0===this._children.length)}isAutoHide(){return this._getAttr("enableAutoHide")}_setSelected(t){this._attributes.selected=t}_setSize(t){const e=this.getSelected();if(-1===e)this._attributes.size=t;else{const s=this._children[e];-1===(this._location._orientation===i.HORZ?s._getAttr("borderWidth"):s._getAttr("borderHeight"))?this._attributes.size=t:this._location._orientation===i.HORZ?s._setBorderWidth(t):s._setBorderHeight(t)}}_updateAttrs(t){R._attributeDefinitions.update(t,this._attributes)}_getDrawChildren(){return this._drawChildren}_setAdjustedSize(t){this._adjustedSize=t}_getAdjustedSize(){return this._adjustedSize}_layoutBorderOuter(t,e){this.calcBorderBarSize(e);const i=this._location.split(t,this.getBorderBarSize());return this._tabHeaderRect=i.start,i.end}_layoutBorderInner(t,e){this._drawChildren=[];const i=this._location,s=i.split(t,this._adjustedSize+this._model.getSplitterSize()),n=i.reflect().split(s.start,this._model.getSplitterSize());this._contentRect=n.end;for(let t=0;t<this._children.length;t++){const i=this._children[t];i._layout(this._contentRect,e),i._setVisible(t===this.getSelected()),this._drawChildren.push(i)}if(-1===this.getSelected())return t;{const t=new m(this._model);return t._setParent(this),t._setRect(n.start),this._drawChildren.push(t),s.end}}_remove(t){const e=this._removeChild(t);-1!==this.getSelected()&&O(this,e)}canDrop(t,e,n){if(t.getType()!==b.TYPE)return;let o;const a=r.CENTER;if(this._tabHeaderRect.contains(e,n)){if(this._location._orientation===i.VERT)if(this._children.length>0){let t=this._children[0],i=t.getTabRect();const n=i.y,r=i.height;let d=this._tabHeaderRect.x,l=0;for(let h=0;h<this._children.length;h++){if(t=this._children[h],i=t.getTabRect(),l=i.x+i.width/2,e>=d&&e<l){const t=new s(i.x-2,n,3,r);o=new u(this,t,a,h,g.FLEXLAYOUT__OUTLINE_RECT);break}d=l}if(null==o){const t=new s(i.getRight()-2,n,3,r);o=new u(this,t,a,this._children.length,g.FLEXLAYOUT__OUTLINE_RECT)}}else{const t=new s(this._tabHeaderRect.x+1,this._tabHeaderRect.y+2,3,18);o=new u(this,t,a,0,g.FLEXLAYOUT__OUTLINE_RECT)}else if(this._children.length>0){let t=this._children[0],e=t.getTabRect();const i=e.x,r=e.width;let d=this._tabHeaderRect.y,l=0;for(let h=0;h<this._children.length;h++){if(t=this._children[h],e=t.getTabRect(),l=e.y+e.height/2,n>=d&&n<l){const t=new s(i,e.y-2,r,3);o=new u(this,t,a,h,g.FLEXLAYOUT__OUTLINE_RECT);break}d=l}if(null==o){const t=new s(i,e.getBottom()-2,r,3);o=new u(this,t,a,this._children.length,g.FLEXLAYOUT__OUTLINE_RECT)}}else{const t=new s(this._tabHeaderRect.x+2,this._tabHeaderRect.y+1,18,3);o=new u(this,t,a,0,g.FLEXLAYOUT__OUTLINE_RECT)}if(!t._canDockInto(t,o))return}else if(-1!==this.getSelected()&&this._contentRect.contains(e,n)){const e=this._contentRect;if(o=new u(this,e,a,-1,g.FLEXLAYOUT__OUTLINE_RECT),!t._canDockInto(t,o))return}return o}drop(t,e,i,s){let n=0;const o=t.getParent();void 0!==o&&(n=o._removeChild(t),o!==this&&o instanceof R&&o.getSelected()===n?o._setSelected(-1):O(o,n)),t.getType()===b.TYPE&&o===this&&n<i&&i>0&&i--;let r=i;-1===r&&(r=this._children.length),t.getType()===b.TYPE&&this._addChild(t,r),(s||!1!==s&&this.isAutoSelectTab())&&this._setSelected(r),this._model._tidy()}toJson(){const t={};return R._attributeDefinitions.toJson(t,this._attributes),t.location=this._location.getName(),t.children=this._children.map((t=>t.toJson())),t}_getSplitterBounds(t,e=!1){const i=[0,0],s=e?this.getMinSize():0,n=this._model._getOuterInnerRects().outer,o=this._model._getOuterInnerRects().inner,a=this._model.getRoot();return this._location===r.TOP?(i[0]=n.y+s,i[1]=Math.max(i[0],o.getBottom()-t.getHeight()-a.getMinHeight())):this._location===r.LEFT?(i[0]=n.x+s,i[1]=Math.max(i[0],o.getRight()-t.getWidth()-a.getMinWidth())):this._location===r.BOTTOM?(i[1]=n.getBottom()-t.getHeight()-s,i[0]=Math.min(i[1],o.y+a.getMinHeight())):this._location===r.RIGHT&&(i[1]=n.getRight()-t.getWidth()-s,i[0]=Math.min(i[1],o.x+a.getMinWidth())),i}_calculateSplit(t,e){const i=this._getSplitterBounds(t);return this._location===r.BOTTOM||this._location===r.RIGHT?Math.max(0,i[1]-e):Math.max(0,e-i[0])}_getAttributeDefinitions(){return R._attributeDefinitions}static getAttributeDefinitions(){return R._attributeDefinitions}}function A(e,i,s,n,o){let r=s?s(i):void 0,a=i.getName(),d=i.getName();if(void 0===o&&(o=0),void 0!==n){const t=n(i);void 0!==t&&("string"==typeof t?(a=t,d=t):void 0!==t.titleContent?(a=t.titleContent,d=t.name):a=t)}void 0===r&&void 0!==i.getIcon()&&(r=0!==o?t.createElement("img",{style:{width:"1em",height:"1em",transform:"rotate("+o+"deg)"},src:i.getIcon(),alt:"leadingContent"}):t.createElement("img",{style:{width:"1em",height:"1em"},src:i.getIcon(),alt:"leadingContent"}));const l={leading:r,content:a,name:d,buttons:[]};return e.customizeTab(i,l),i._setRenderedName(l.name),l}function L(t,e){e?t.visibility="hidden":t.display="none"}function y(t){let e=!1;return t.nativeEvent instanceof MouseEvent&&(0!==t.nativeEvent.button||t.ctrlKey||t.altKey||t.metaKey||t.shiftKey)&&(e=!0),e}R.TYPE="border",R._attributeDefinitions=R._createAttributeDefinitions(),function(t){t.Close_Tab="Close",t.Close_Tabset="Close tabset",t.Move_Tab="Move: ",t.Move_Tabset="Move tabset",t.Maximize="Maximize tabset",t.Restore="Restore tabset",t.Float_Tab="Show selected tab in floating window",t.Overflow_Menu_Tooltip="Hidden tabs",t.Floating_Window_Message="This panel is shown in a floating window",t.Floating_Window_Show_Window="Show window",t.Floating_Window_Dock_Window="Dock window",t.Error_rendering_component="Error rendering component"}(T||(T={})),function(t){t[t.Visible=1]="Visible",t[t.Always=2]="Always",t[t.Selected=3]="Selected"}(E||(E={}));const N=e=>{const{layout:i,node:n,selected:o,border:r,iconFactory:a,titleFactory:d,icons:l,path:_}=e,c=t.useRef(null),u=t.useRef(null),p=t=>{y(t)||i.getEditingTab()||i.dragStart(t,void 0,n,n.isEnableDrag(),b,f)},m=t=>{y(t)&&i.auxMouseClick(n,t)},b=()=>{i.doAction(h.selectTab(n.getId()))},f=t=>{},v=t=>{(()=>{const t=n.getCloseType();return!!(o||t===E.Always||t===E.Visible&&window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches)})()?i.doAction(h.deleteTab(n.getId())):b()},O=t=>{t.stopPropagation()};t.useLayoutEffect((()=>{R(),i.getEditingTab()===n&&u.current.select()}));const R=()=>{var t;const e=i.getDomRect(),o=null===(t=c.current)||void 0===t?void 0:t.getBoundingClientRect();o&&e&&n._setTabRect(new s(o.left-e.left,o.top-e.top,o.width,o.height))},L=t=>{t.stopPropagation()},N=i.getClassName;let S=N(g.FLEXLAYOUT__BORDER_BUTTON)+" "+N(g.FLEXLAYOUT__BORDER_BUTTON_+r);S+=o?" "+N(g.FLEXLAYOUT__BORDER_BUTTON__SELECTED):" "+N(g.FLEXLAYOUT__BORDER_BUTTON__UNSELECTED),void 0!==n.getClassName()&&(S+=" "+n.getClassName());let D=0;!1===n.getModel().isEnableRotateBorderIcons()&&("left"===r?D=90:"right"===r&&(D=-90));const B=A(i,n,a,d,D);let w=B.content?t.createElement("div",{className:N(g.FLEXLAYOUT__BORDER_BUTTON_CONTENT)},B.content):null;const C=B.leading?t.createElement("div",{className:N(g.FLEXLAYOUT__BORDER_BUTTON_LEADING)},B.leading):null;if(i.getEditingTab()===n&&(w=t.createElement("input",{ref:u,className:N(g.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":_+"/textbox",type:"text",autoFocus:!0,defaultValue:n.getName(),onKeyDown:t=>{"Escape"===t.code?i.setEditingTab(void 0):"Enter"===t.code&&(i.setEditingTab(void 0),i.doAction(h.renameTab(n.getId(),t.target.value)))},onMouseDown:L,onTouchStart:L})),n.isEnableClose()){const e=i.i18nName(T.Close_Tab);B.buttons.push(t.createElement("div",{key:"close","data-layout-path":_+"/button/close",title:e,className:N(g.FLEXLAYOUT__BORDER_BUTTON_TRAILING),onMouseDown:O,onClick:v,onTouchStart:O},"function"==typeof l.close?l.close(n):l.close))}return t.createElement("div",{ref:c,"data-layout-path":_,className:S,onMouseDown:p,onClick:m,onAuxClick:m,onContextMenu:t=>{i.showContextMenu(n,t)},onTouchStart:p,title:n.getHelpText()},C,w,B.buttons)},S=e=>{const{layout:i,node:s,iconFactory:n,titleFactory:o}=e,r=t.useRef(null),a=i.getClassName;let d=a(g.FLEXLAYOUT__TAB_BUTTON_STAMP);const l=A(i,s,n,o);let h=l.content?t.createElement("div",{className:a(g.FLEXLAYOUT__TAB_BUTTON_CONTENT)},l.content):s._getNameForOverflowMenu();const _=l.leading?t.createElement("div",{className:a(g.FLEXLAYOUT__TAB_BUTTON_LEADING)},l.leading):null;return t.createElement("div",{ref:r,className:d,title:s.getHelpText()},_,h)};function D(e,i,s,n,o,r){var a;const l=n.getRootDiv(),h=n.getClassName,_=e.ownerDocument,c=e.getBoundingClientRect(),u=null!==(a=null==l?void 0:l.getBoundingClientRect())&&void 0!==a?a:new DOMRect(0,0,100,100),T=_.createElement("div");T.className=h(g.FLEXLAYOUT__POPUP_MENU_CONTAINER),c.left<u.left+u.width/2?T.style.left=c.left-u.left+"px":T.style.right=u.right-c.right+"px",c.top<u.top+u.height/2?T.style.top=c.top-u.top+"px":T.style.bottom=u.bottom-c.bottom+"px",d.instance.addGlass((()=>E())),d.instance.setGlassCursorOverride("default"),l&&l.appendChild(T);const E=()=>{n.hidePortal(),d.instance.hideGlass(),l&&l.removeChild(T),T.removeEventListener("mousedown",p),_.removeEventListener("mousedown",m)},p=t=>{t.stopPropagation()},m=t=>{E()};T.addEventListener("mousedown",p),_.addEventListener("mousedown",m),n.showPortal(t.createElement(B,{currentDocument:_,onSelect:s,onHide:E,items:i,classNameMapper:h,layout:n,iconFactory:o,titleFactory:r}),T)}const B=e=>{const{items:i,onHide:s,onSelect:n,classNameMapper:o,layout:r,iconFactory:a,titleFactory:d}=e,l=i.map(((e,i)=>t.createElement("div",{key:e.index,className:o(g.FLEXLAYOUT__POPUP_MENU_ITEM),"data-layout-path":"/popup-menu/tb"+i,onClick:t=>((t,e)=>{n(t),s(),e.stopPropagation()})(e,t),title:e.node.getHelpText()},e.node.getModel().isLegacyOverflowMenu()?e.node._getNameForOverflowMenu():t.createElement(S,{node:e.node,layout:r,iconFactory:a,titleFactory:d}))));return t.createElement("div",{className:o(g.FLEXLAYOUT__POPUP_MENU),"data-layout-path":"/popup-menu"},l)},w=(e,n,o,r)=>{const a=t.useRef(!0),d=t.useRef(!1),l=t.useRef(new s(0,0,0,0)),h=t.useRef(null),[_,c]=t.useState(0),u=t.useRef(!1),[g,T]=t.useState([]),E=t.useRef(0);t.useLayoutEffect((()=>{u.current=!1}),[e.getSelectedNode(),e.getRect().width,e.getRect().height]),t.useLayoutEffect((()=>{R()}));const p=h.current;t.useEffect((()=>{if(p)return p.addEventListener("wheel",m,{passive:!1}),()=>{p.removeEventListener("wheel",m)}}),[p]);const m=t=>{t.preventDefault()},b=t=>n===i.HORZ?t.x:t.y,f=t=>n===i.HORZ?t.getRight():t.getBottom(),O=t=>n===i.HORZ?t.width:t.height,R=()=>{!0===a.current&&(d.current=!1);const t=e instanceof v?e.getRect():e.getTabHeaderRect();let i=e.getChildren()[e.getChildren().length-1];const s=null===r.current?0:O(r.current.getBoundingClientRect());if(!0===a.current||0===E.current&&0!==g.length||t.width!==l.current.width||t.height!==l.current.height){E.current=g.length,l.current=t;const n=!(e instanceof v)||!0===e.isEnableTabStrip();let r=f(t)-s;if(null!==o.current&&(r-=O(o.current.getBoundingClientRect())),n&&e.getChildren().length>0){if(0===g.length&&0===_&&f(i.getTabRect())+2<r)return;let s=0;const n=e.getSelectedNode();if(n&&!u.current){const e=n.getTabRect(),i=b(e)-2,o=f(e)+2;O(e)+4>=r-b(t)?s=b(t)-i:(o>r||i<b(t))&&(i<b(t)&&(s=b(t)-i),o+s>r&&(s=r-o))}const o=Math.max(0,r-(f(i.getTabRect())+2+s)),l=Math.min(0,_+s+o),h=l-_,E=[];for(let i=0;i<e.getChildren().length;i++){const s=e.getChildren()[i];(b(s.getTabRect())+h<b(t)||f(s.getTabRect())+h>r)&&E.push({node:s,index:i})}E.length>0&&(d.current=!0),a.current=!1,T(E),c(l)}}else a.current=!0};return{selfRef:h,position:_,userControlledLeft:u,hiddenTabs:g,onMouseWheel:t=>{let e=0;e=Math.abs(t.deltaX)>Math.abs(t.deltaY)?-t.deltaX:-t.deltaY,1===t.deltaMode&&(e*=40),c(_+e),u.current=!0,t.stopPropagation()},tabsTruncated:d.current}},C=e=>{const{border:s,layout:n,iconFactory:o,titleFactory:a,icons:d,path:l}=e,_=t.useRef(null),c=t.useRef(null),u=t.useRef(null),{selfRef:E,position:p,userControlledLeft:m,hiddenTabs:b,onMouseWheel:f,tabsTruncated:v}=w(s,i.flip(s.getOrientation()),_,u),O=t=>{y(t)&&n.auxMouseClick(s,t)},R=t=>{t.stopPropagation()},A=t=>{const e=n.getShowOverflowMenu();void 0!==e?e(s,t,b,L):D(c.current,b,L,n,o,a),t.stopPropagation()},L=t=>{n.doAction(h.selectTab(t.node.getId())),m.current=!1},S=t=>{const e=s.getChildren()[s.getSelected()];void 0!==e&&n.doAction(h.floatTab(e.getId())),t.stopPropagation()},B=n.getClassName;let C=s.getTabHeaderRect().styleWithPosition({});const M=[],x=e=>{let i=s.getSelected()===e,r=s.getChildren()[e];M.push(t.createElement(N,{layout:n,border:s.getLocation().getName(),node:r,path:l+"/tb"+e,key:r.getId(),selected:i,iconFactory:o,titleFactory:a,icons:d})),e<s.getChildren().length-1&&M.push(t.createElement("div",{key:"divider"+e,className:B(g.FLEXLAYOUT__BORDER_TAB_DIVIDER)}))};for(let t=0;t<s.getChildren().length;t++)x(t);let U=B(g.FLEXLAYOUT__BORDER)+" "+B(g.FLEXLAYOUT__BORDER_+s.getLocation().getName());void 0!==s.getClassName()&&(U+=" "+s.getClassName());let I=[],F=[];const z={headerContent:void 0,buttons:I,stickyButtons:F,headerButtons:[],overflowPosition:void 0};if(n.customizeTabSet(s,z),I=z.buttons,void 0===z.overflowPosition&&(z.overflowPosition=F.length),F.length>0&&(v?I=[...F,...I]:M.push(t.createElement("div",{ref:u,key:"sticky_buttons_container",onMouseDown:R,onTouchStart:R,onDragStart:t=>{t.preventDefault()},className:B(g.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER)},F))),b.length>0){const e=n.i18nName(T.Overflow_Menu_Tooltip);let i;i="function"==typeof d.more?d.more(s,b):t.createElement(t.Fragment,null,d.more,t.createElement("div",{className:B(g.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT)},b.length)),I.splice(Math.min(z.overflowPosition,I.length),0,t.createElement("button",{key:"overflowbutton",ref:c,className:B(g.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+" "+B(g.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW)+" "+B(g.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_+s.getLocation().getName()),title:e,onClick:A,onMouseDown:R,onTouchStart:R},i))}const Y=s.getSelected();if(-1!==Y){const e=s.getChildren()[Y];if(void 0!==e&&n.isSupportsPopout()&&e.isEnableFloat()&&!e.isFloating()){const i=n.i18nName(T.Float_Tab);I.push(t.createElement("button",{key:"float",title:i,className:B(g.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+" "+B(g.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT),onClick:S,onMouseDown:R,onTouchStart:R},"function"==typeof d.popout?d.popout(e):d.popout))}}const X=t.createElement("div",{key:"toolbar",ref:_,className:B(g.FLEXLAYOUT__BORDER_TOOLBAR)+" "+B(g.FLEXLAYOUT__BORDER_TOOLBAR_+s.getLocation().getName())},I);C=n.styleFont(C);let H={};const P=s.getBorderBarSize()-1;return H=s.getLocation()===r.LEFT?{right:P,height:P,top:p}:s.getLocation()===r.RIGHT?{left:P,height:P,top:p}:{height:P,left:p},t.createElement("div",{ref:E,dir:"ltr",style:C,className:U,"data-layout-path":l,onClick:O,onAuxClick:O,onContextMenu:t=>{n.showContextMenu(s,t)},onWheel:f},t.createElement("div",{style:{height:P},className:B(g.FLEXLAYOUT__BORDER_INNER)+" "+B(g.FLEXLAYOUT__BORDER_INNER_+s.getLocation().getName())},t.createElement("div",{style:H,className:B(g.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER)+" "+B(g.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_+s.getLocation().getName())},M)),X)},M=e=>{const{layout:s,node:n,path:o}=e,r=t.useRef([]),a=t.useRef(void 0),l=n.getParent(),_=t=>{var e;d.instance.setGlassCursorOverride(n.getOrientation()===i.HORZ?"ns-resize":"ew-resize"),d.instance.startDrag(t,u,T,p,c,void 0,void 0,s.getCurrentDocument(),null!==(e=s.getRootDiv())&&void 0!==e?e:void 0),r.current=l._getSplitterBounds(n,!0);const o=s.getRootDiv();a.current=s.getCurrentDocument().createElement("div"),a.current.style.position="absolute",a.current.className=s.getClassName(g.FLEXLAYOUT__SPLITTER_DRAG),a.current.style.cursor=n.getOrientation()===i.HORZ?"ns-resize":"ew-resize";const h=n.getRect();n.getOrientation()===i.VERT&&h.width<2?h.width=2:n.getOrientation()===i.HORZ&&h.height<2&&(h.height=2),h.positionElement(a.current),o&&o.appendChild(a.current)},c=t=>{const e=s.getRootDiv();e&&e.removeChild(a.current)},u=()=>!0,T=t=>{const e=s.getDomRect();if(!e)return;const o=t.clientX-e.left,r=t.clientY-e.top;a&&(n.getOrientation()===i.HORZ?a.current.style.top=m(r-4)+"px":a.current.style.left=m(o-4)+"px"),s.isRealtimeResize()&&E()},E=()=>{let t=0;if(a&&(t=n.getOrientation()===i.HORZ?a.current.offsetTop:a.current.offsetLeft),l instanceof R){const e=l._calculateSplit(n,t);s.doAction(h.adjustBorderSplit(n.getParent().getId(),e))}else{const e=l._calculateSplit(n,t);void 0!==e&&s.doAction(h.adjustSplit(e))}},p=()=>{E();const t=s.getRootDiv();t&&t.removeChild(a.current)},m=t=>{const e=r.current;let i=t;return t<e[0]&&(i=e[0]),t>e[1]&&(i=e[1]),i},b=s.getClassName;let f=n.getRect();const v=f.styleWithPosition({cursor:n.getOrientation()===i.HORZ?"ns-resize":"ew-resize"});let O=b(g.FLEXLAYOUT__SPLITTER)+" "+b(g.FLEXLAYOUT__SPLITTER_+n.getOrientation().getName());l instanceof R?O+=" "+b(g.FLEXLAYOUT__SPLITTER_BORDER):void 0!==n.getModel().getMaximizedTabset()&&(v.display="none");const A=n.getModel().getSplitterExtra();if(0===A)return t.createElement("div",{style:v,"data-layout-path":o,className:O,onTouchStart:_,onMouseDown:_});{let e=f.clone();e.x=0,e.y=0,n.getOrientation()===i.VERT?e.width+=A:e.height+=A;const s=e.styleWithPosition({cursor:n.getOrientation()===i.HORZ?"ns-resize":"ew-resize"}),r=b(g.FLEXLAYOUT__SPLITTER_EXTRA);return t.createElement("div",{style:v,"data-layout-path":o,className:O},t.createElement("div",{style:s,className:r,onTouchStart:_,onMouseDown:_}))}};class x extends t.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,e){console.debug(t),console.debug(e)}render(){return this.state.hasError?t.createElement("div",{className:g.FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER},t.createElement("div",{className:g.FLEXLAYOUT__ERROR_BOUNDARY_CONTENT},this.props.message)):this.props.children}}const U=e=>{const{layout:i,selected:s,node:n,factory:o,path:r}=e,[a,d]=t.useState(!e.node.isEnableRenderOnDemand()||e.selected);t.useLayoutEffect((()=>{!a&&s&&d(!0)}));const l=()=>{const t=n.getParent();t.getType()===v.TYPE&&(t.isActive()||i.doAction(h.setActiveTabset(t.getId())))},_=i.getClassName,c=n.getModel().isUseVisibility(),u=n.getParent(),E=n._styleWithPosition();let p;s||L(E,c),u instanceof v&&(void 0===n.getModel().getMaximizedTabset()||u.isMaximized()||L(E,c)),a&&(p=o(n));let m=_(g.FLEXLAYOUT__TAB);return u instanceof R&&(m+=" "+_(g.FLEXLAYOUT__TAB_BORDER),m+=" "+_(g.FLEXLAYOUT__TAB_BORDER_+u.getLocation().getName())),void 0!==n.getContentClassName()&&(m+=" "+n.getContentClassName()),t.createElement("div",{className:m,"data-layout-path":r,onMouseDown:l,onTouchStart:l,style:E},t.createElement(x,{message:e.layout.i18nName(T.Error_rendering_component)},t.createElement(t.Fragment,null,p)))},I=e=>{const{layout:i,node:n,selected:o,iconFactory:r,titleFactory:a,icons:d,path:l}=e,_=t.useRef(null),c=t.useRef(null),u=t=>{y(t)||i.getEditingTab()||i.dragStart(t,void 0,n,n.isEnableDrag(),m,b)},p=t=>{y(t)&&i.auxMouseClick(n,t)},m=()=>{i.doAction(h.selectTab(n.getId()))},b=t=>{n.isEnableRename()&&f()},f=()=>{i.setEditingTab(n),i.getCurrentDocument().body.addEventListener("mousedown",v),i.getCurrentDocument().body.addEventListener("touchstart",v)},v=t=>{t.target!==c.current&&(i.getCurrentDocument().body.removeEventListener("mousedown",v),i.getCurrentDocument().body.removeEventListener("touchstart",v),i.setEditingTab(void 0))},O=t=>{(()=>{const t=n.getCloseType();return!!(o||t===E.Always||t===E.Visible&&window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches)})()?i.doAction(h.deleteTab(n.getId())):m()},R=t=>{t.stopPropagation()};t.useLayoutEffect((()=>{L(),i.getEditingTab()===n&&c.current.select()}));const L=()=>{var t;const e=i.getDomRect(),o=null===(t=_.current)||void 0===t?void 0:t.getBoundingClientRect();o&&e&&n._setTabRect(new s(o.left-e.left,o.top-e.top,o.width,o.height))},N=t=>{t.stopPropagation()},S=i.getClassName,D=n.getParent(),B=D.isEnableSingleTabStretch()&&1===D.getChildren().length;let w=B?g.FLEXLAYOUT__TAB_BUTTON_STRETCH:g.FLEXLAYOUT__TAB_BUTTON,C=S(w);C+=" "+S(w+"_"+D.getTabLocation()),B||(C+=o?" "+S(w+"--selected"):" "+S(w+"--unselected")),void 0!==n.getClassName()&&(C+=" "+n.getClassName());const M=A(i,n,r,a);let x=M.content?t.createElement("div",{className:S(g.FLEXLAYOUT__TAB_BUTTON_CONTENT)},M.content):null;const U=M.leading?t.createElement("div",{className:S(g.FLEXLAYOUT__TAB_BUTTON_LEADING)},M.leading):null;if(i.getEditingTab()===n&&(x=t.createElement("input",{ref:c,className:S(g.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":l+"/textbox",type:"text",autoFocus:!0,defaultValue:n.getName(),onKeyDown:t=>{"Escape"===t.code?i.setEditingTab(void 0):"Enter"===t.code&&(i.setEditingTab(void 0),i.doAction(h.renameTab(n.getId(),t.target.value)))},onMouseDown:N,onTouchStart:N})),n.isEnableClose()&&!B){const e=i.i18nName(T.Close_Tab);M.buttons.push(t.createElement("div",{key:"close","data-layout-path":l+"/button/close",title:e,className:S(g.FLEXLAYOUT__TAB_BUTTON_TRAILING),onMouseDown:R,onClick:O,onTouchStart:R},"function"==typeof d.close?d.close(n):d.close))}return t.createElement("div",{ref:_,"data-layout-path":l,className:C,onMouseDown:u,onClick:p,onAuxClick:p,onContextMenu:t=>{i.showContextMenu(n,t)},onTouchStart:u,title:n.getHelpText()},U,x,M.buttons)},F=e=>{const{node:s,layout:n,iconFactory:o,titleFactory:r,icons:a,path:d}=e,l=t.useRef(null),_=t.useRef(null),c=t.useRef(null),u=t.useRef(null),{selfRef:E,position:p,userControlledLeft:m,hiddenTabs:b,onMouseWheel:f,tabsTruncated:v}=w(s,i.HORZ,l,u),O=t=>{const e=n.getShowOverflowMenu();void 0!==e?e(s,t,b,R):D(_.current,b,R,n,o,r),t.stopPropagation()},R=t=>{n.doAction(h.selectTab(t.node.getId())),m.current=!1},A=t=>{if(!y(t)){let e=s.getName();if(e=void 0===e?"":": "+e,n.doAction(h.setActiveTabset(s.getId())),!n.getEditingTab()){const i=n.i18nName(T.Move_Tabset,e);void 0!==s.getModel().getMaximizedTabset()?n.dragStart(t,i,s,!1,(t=>{}),F):n.dragStart(t,i,s,s.isEnableDrag(),(t=>{}),F)}}},N=t=>{y(t)&&n.auxMouseClick(s,t)},S=t=>{n.showContextMenu(s,t)},B=t=>{t.stopPropagation()},C=t=>{s.canMaximize()&&n.maximize(s),t.stopPropagation()},M=t=>{n.doAction(h.deleteTabset(s.getId())),t.stopPropagation()},x=t=>{n.doAction(h.deleteTab(s.getChildren()[0].getId())),t.stopPropagation()},U=t=>{void 0!==Y&&n.doAction(h.floatTab(Y.getId())),t.stopPropagation()},F=t=>{s.canMaximize()&&n.maximize(s)},z=n.getClassName;null!==c.current&&0!==c.current.scrollLeft&&(c.current.scrollLeft=0);const Y=s.getSelectedNode();let X=s._styleWithPosition();void 0===s.getModel().getMaximizedTabset()||s.isMaximized()||L(X,s.getModel().isUseVisibility());const H=[];if(s.isEnableTabStrip())for(let e=0;e<s.getChildren().length;e++){const i=s.getChildren()[e];let l=s.getSelected()===e;H.push(t.createElement(I,{layout:n,node:i,path:d+"/tb"+e,key:i.getId(),selected:l,iconFactory:o,titleFactory:r,icons:a})),e<s.getChildren().length-1&&H.push(t.createElement("div",{key:"divider"+e,className:z(g.FLEXLAYOUT__TABSET_TAB_DIVIDER)}))}const P=void 0!==s.getName();let W=[],k=[],G=[];const V={headerContent:s.getName(),stickyButtons:W,buttons:k,headerButtons:G,overflowPosition:void 0};n.customizeTabSet(s,V);const J=V.headerContent;W=V.stickyButtons,k=V.buttons,G=V.headerButtons;const Z=s.isEnableSingleTabStretch()&&1===s.getChildren().length,j=Z&&s.getChildren()[0].isEnableClose()||s.isEnableClose();if(void 0===V.overflowPosition&&(V.overflowPosition=W.length),W.length>0&&(v||Z?k=[...W,...k]:H.push(t.createElement("div",{ref:u,key:"sticky_buttons_container",onMouseDown:B,onTouchStart:B,onDragStart:t=>{t.preventDefault()},className:z(g.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER)},W))),b.length>0){const e=n.i18nName(T.Overflow_Menu_Tooltip);let i;i="function"==typeof a.more?a.more(s,b):t.createElement(t.Fragment,null,a.more,t.createElement("div",{className:z(g.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT)},b.length)),k.splice(Math.min(V.overflowPosition,k.length),0,t.createElement("button",{key:"overflowbutton","data-layout-path":d+"/button/overflow",ref:_,className:z(g.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+z(g.FLEXLAYOUT__TAB_BUTTON_OVERFLOW),title:e,onClick:O,onMouseDown:B,onTouchStart:B},i))}if(void 0!==Y&&n.isSupportsPopout()&&Y.isEnableFloat()&&!Y.isFloating()){const e=n.i18nName(T.Float_Tab);k.push(t.createElement("button",{key:"float","data-layout-path":d+"/button/float",title:e,className:z(g.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+z(g.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT),onClick:U,onMouseDown:B,onTouchStart:B},"function"==typeof a.popout?a.popout(Y):a.popout))}if(s.canMaximize()){const e=n.i18nName(T.Restore),i=n.i18nName(T.Maximize);(P?G:k).push(t.createElement("button",{key:"max","data-layout-path":d+"/button/max",title:s.isMaximized()?e:i,className:z(g.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+z(g.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_+(s.isMaximized()?"max":"min")),onClick:C,onMouseDown:B,onTouchStart:B},s.isMaximized()?"function"==typeof a.restore?a.restore(s):a.restore:"function"==typeof a.maximize?a.maximize(s):a.maximize))}if(!s.isMaximized()&&j){const e=Z?n.i18nName(T.Close_Tab):n.i18nName(T.Close_Tabset);(P?G:k).push(t.createElement("button",{key:"close","data-layout-path":d+"/button/close",title:e,className:z(g.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+z(g.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE),onClick:Z?x:M,onMouseDown:B,onTouchStart:B},"function"==typeof a.closeTabset?a.closeTabset(s):a.closeTabset))}const q=t.createElement("div",{key:"toolbar",ref:l,className:z(g.FLEXLAYOUT__TAB_TOOLBAR),onMouseDown:B,onTouchStart:B,onDragStart:t=>{t.preventDefault()}},k);let K,$,Q=z(g.FLEXLAYOUT__TABSET_TABBAR_OUTER);if(void 0!==s.getClassNameTabStrip()&&(Q+=" "+s.getClassNameTabStrip()),Q+=" "+g.FLEXLAYOUT__TABSET_TABBAR_OUTER_+s.getTabLocation(),s.isActive()&&!P&&(Q+=" "+z(g.FLEXLAYOUT__TABSET_SELECTED)),s.isMaximized()&&!P&&(Q+=" "+z(g.FLEXLAYOUT__TABSET_MAXIMIZED)),Z){const t=s.getChildren()[0];void 0!==t.getTabSetClassName()&&(Q+=" "+t.getTabSetClassName())}if(P){const e=t.createElement("div",{key:"toolbar",ref:l,className:z(g.FLEXLAYOUT__TAB_TOOLBAR),onMouseDown:B,onTouchStart:B,onDragStart:t=>{t.preventDefault()}},G);let i=z(g.FLEXLAYOUT__TABSET_HEADER);s.isActive()&&(i+=" "+z(g.FLEXLAYOUT__TABSET_SELECTED)),s.isMaximized()&&(i+=" "+z(g.FLEXLAYOUT__TABSET_MAXIMIZED)),void 0!==s.getClassNameHeader()&&(i+=" "+s.getClassNameHeader()),K=t.createElement("div",{className:i,style:{height:s.getHeaderHeight()+"px"},"data-layout-path":d+"/header",onMouseDown:A,onContextMenu:S,onClick:N,onAuxClick:N,onTouchStart:A},t.createElement("div",{className:z(g.FLEXLAYOUT__TABSET_HEADER_CONTENT)},J),e)}const tt={height:s.getTabStripHeight()+"px"};$=t.createElement("div",{className:Q,style:tt,"data-layout-path":d+"/tabstrip",onMouseDown:A,onContextMenu:S,onClick:N,onAuxClick:N,onTouchStart:A},t.createElement("div",{ref:c,className:z(g.FLEXLAYOUT__TABSET_TABBAR_INNER)+" "+z(g.FLEXLAYOUT__TABSET_TABBAR_INNER_+s.getTabLocation())},t.createElement("div",{style:{left:p,width:Z?"100%":"10000px"},className:z(g.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER)+" "+z(g.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_+s.getTabLocation())},H)),q),X=n.styleFont(X);var et=void 0;if(0===s.getChildren().length){const t=n.getTabSetPlaceHolderCallback();t&&(et=t(s))}const it=t.createElement("div",{className:z(g.FLEXLAYOUT__TABSET_CONTENT)},et);var st;return st="top"===s.getTabLocation()?t.createElement(t.Fragment,null,K,$,it):t.createElement(t.Fragment,null,K,it,$),t.createElement("div",{ref:E,dir:"ltr","data-layout-path":d,style:X,className:z(g.FLEXLAYOUT__TABSET),onWheel:f},st)},z=i=>{const{title:n,id:o,url:r,rect:a,onCloseWindow:d,onSetWindow:l,children:h}=i,_=t.useRef(null),c=t.useRef(null),[u,T]=t.useState(void 0);return t.useLayoutEffect((()=>{c.current&&clearTimeout(c.current);let t=!0;const e=a||new s(0,0,100,100),i=Array.from(window.document.styleSheets).reduce(((t,e)=>{let i;try{i=e.cssRules}catch(t){}try{return[...t,{href:e.href,type:e.type,rules:i?Array.from(i).map((t=>t.cssText)):null}]}catch(e){return t}}),[]);return _.current=window.open(r,o,`left=${e.x},top=${e.y},width=${e.width},height=${e.height}`),null!==_.current?(l(o,_.current),window.addEventListener("beforeunload",(()=>{_.current&&(_.current.close(),_.current=null)})),_.current.addEventListener("load",(()=>{if(t){const t=_.current.document;t.title=n;const e=t.createElement("div");e.className=g.FLEXLAYOUT__FLOATING_WINDOW_CONTENT,t.body.appendChild(e),function(t,e){const i=t.head,s=[];for(const n of e)if(n.href){const e=t.createElement("link");e.type=n.type,e.rel="stylesheet",e.href=n.href,i.appendChild(e),s.push(new Promise((t=>{e.onload=()=>t(!0)})))}else if(n.rules){const e=t.createElement("style");for(const i of n.rules)e.appendChild(t.createTextNode(i));i.appendChild(e)}return Promise.all(s)}(t,i).then((()=>{T(e)})),_.current.addEventListener("beforeunload",(()=>{d(o)}))}}))):(console.warn(`Unable to open window ${r}`),d(o)),()=>{t=!1,c.current=setTimeout((()=>{_.current&&(_.current.close(),_.current=null)}),0)}}),[]),void 0!==u?(0,e.createPortal)(h,u):null},Y=e=>{const{layout:i,node:s,factory:n}=e,o=i.getClassName,r=n(s);return t.createElement("div",{className:o(g.FLEXLAYOUT__FLOATING_WINDOW_TAB)},t.createElement(x,{message:e.layout.i18nName(T.Error_rendering_component)},t.createElement(t.Fragment,null,r)))},X=e=>{const{layout:i,selected:s,node:n,path:o}=e,r=()=>{n.getWindow()&&n.getWindow().focus()},a=()=>{i.doAction(h.unFloatTab(n.getId()))},d=()=>{const t=n.getParent();t.getType()===v.TYPE&&(t.isActive()||i.doAction(h.setActiveTabset(t.getId())))},l=i.getClassName,_=n.getParent(),c=n._styleWithPosition();s||L(c,n.getModel().isUseVisibility()),_ instanceof v&&(void 0===n.getModel().getMaximizedTabset()||_.isMaximized()||L(c,n.getModel().isUseVisibility()));const u=i.i18nName(T.Floating_Window_Message),E=i.i18nName(T.Floating_Window_Show_Window),p=i.i18nName(T.Floating_Window_Dock_Window),m=i.getOnRenderFloatingTabPlaceholder();return m?t.createElement("div",{className:l(g.FLEXLAYOUT__TAB_FLOATING),onMouseDown:d,onTouchStart:d,style:c},m(a,r)):t.createElement("div",{className:l(g.FLEXLAYOUT__TAB_FLOATING),"data-layout-path":o,onMouseDown:d,onTouchStart:d,style:c},t.createElement("div",{className:l(g.FLEXLAYOUT__TAB_FLOATING_INNER)},t.createElement("div",null,u),t.createElement("div",null,t.createElement("a",{href:"#",onClick:t=>{t.preventDefault(),r()}},E)),t.createElement("div",null,t.createElement("a",{href:"#",onClick:t=>{t.preventDefault(),a()}},p))))},H={width:"1em",height:"1em",display:"flex",alignItems:"center"},P=()=>t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:H,viewBox:"0 0 24 24"},t.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),t.createElement("path",{stroke:"var(--color-icon)",fill:"var(--color-icon)",d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),W={close:t.createElement(P,null),closeTabset:t.createElement(P,null),popout:t.createElement((()=>t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:H,viewBox:"0 0 20 20",fill:"var(--color-icon)"},t.createElement("path",{d:"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"}),t.createElement("path",{d:"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"}))),null),maximize:t.createElement((()=>t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:H,viewBox:"0 0 24 24",fill:"var(--color-icon)"},t.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t.createElement("path",{stroke:"var(--color-icon)",d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"}))),null),restore:t.createElement((()=>t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:H,viewBox:"0 0 24 24",fill:"var(--color-icon)"},t.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t.createElement("path",{stroke:"var(--color-icon)",d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}))),null),more:t.createElement((()=>t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:H,viewBox:"0 0 24 24",fill:"var(--color-icon)"},t.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t.createElement("path",{stroke:"var(--color-icon)",d:"M7 10l5 5 5-5z"}))),null)},k="undefined"!=typeof window&&(window.document.documentMode||/Edge\//.test(window.navigator.userAgent)),G="undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches&&!k;class V extends t.Component{constructor(i){super(i),this.firstMove=!1,this.dragRectRendered=!0,this.dragDivText=void 0,this.edgeRectLength=100,this.edgeRectWidth=10,this.onModelChange=t=>{this.forceUpdate(),this.props.onModelChange&&this.props.onModelChange(this.props.model,t)},this.updateRect=t=>{if(t||(t=this.getDomRect()),!t)return;const e=new s(0,0,t.width,t.height);e.equals(this.state.rect)||0===e.width||0===e.height||this.setState({rect:e})},this.updateLayoutMetrics=()=>{if(this.findHeaderBarSizeRef.current){const t=this.findHeaderBarSizeRef.current.getBoundingClientRect().height;t!==this.state.calculatedHeaderBarSize&&this.setState({calculatedHeaderBarSize:t})}if(this.findTabBarSizeRef.current){const t=this.findTabBarSizeRef.current.getBoundingClientRect().height;t!==this.state.calculatedTabBarSize&&this.setState({calculatedTabBarSize:t})}if(this.findBorderBarSizeRef.current){const t=this.findBorderBarSizeRef.current.getBoundingClientRect().height;t!==this.state.calculatedBorderBarSize&&this.setState({calculatedBorderBarSize:t})}},this.getClassName=t=>void 0===this.props.classNameMapper?t:this.props.classNameMapper(t),this.onCloseWindow=t=>{this.doAction(h.unFloatTab(t));try{this.props.model.getNodeById(t)._setWindow(void 0)}catch(t){}},this.onSetWindow=(t,e)=>{this.props.model.getNodeById(t)._setWindow(e)},this.onCancelAdd=()=>{var t,e;const i=this.selfRef.current;i&&this.dragDiv&&i.removeChild(this.dragDiv),this.dragDiv=void 0,this.hidePortal(),null!=this.fnNewNodeDropped&&(this.fnNewNodeDropped(),this.fnNewNodeDropped=void 0);try{null===(e=null===(t=this.customDrop)||void 0===t?void 0:t.invalidated)||void 0===e||e.call(t)}catch(t){console.error(t)}d.instance.hideGlass(),this.newTabJson=void 0,this.customDrop=void 0},this.onCancelDrag=t=>{var e,i;if(t){const t=this.selfRef.current,s=this.outlineDiv;if(t&&s)try{t.removeChild(s)}catch(t){}const n=this.dragDiv;if(t&&n)try{t.removeChild(n)}catch(t){}this.dragDiv=void 0,this.hidePortal(),this.setState({showEdges:!1}),null!=this.fnNewNodeDropped&&(this.fnNewNodeDropped(),this.fnNewNodeDropped=void 0);try{null===(i=null===(e=this.customDrop)||void 0===e?void 0:e.invalidated)||void 0===i||i.call(e)}catch(t){console.error(t)}d.instance.hideGlass(),this.newTabJson=void 0,this.customDrop=void 0}this.setState({showHiddenBorder:r.CENTER})},this.onDragDivMouseDown=t=>{t.preventDefault(),this.dragStart(t,this.dragDivText,b._fromJson(this.newTabJson,this.props.model,!1),!0,void 0,void 0)},this.dragStart=(t,e,i,s,n,o)=>{var r,a;s?(this.dragNode=i,this.dragDivText=e,d.instance.startDrag(t,this.onDragStart,this.onDragMove,this.onDragEnd,this.onCancelDrag,n,o,this.currentDocument,null!==(a=this.selfRef.current)&&void 0!==a?a:void 0)):d.instance.startDrag(t,void 0,void 0,void 0,void 0,n,o,this.currentDocument,null!==(r=this.selfRef.current)&&void 0!==r?r:void 0)},this.dragRectRender=(e,i,s,n)=>{let o;if(void 0!==e?o=t.createElement("div",{style:{whiteSpace:"pre"}},e.replace("<br>","\n")):i&&i instanceof b&&(o=t.createElement(S,{node:i,layout:this,iconFactory:this.props.iconFactory,titleFactory:this.props.titleFactory})),void 0!==this.props.onRenderDragRect){const t=this.props.onRenderDragRect(o,i,s);void 0!==t&&(o=t)}this.dragRectRendered=!1;const r=this.dragDiv;r&&(r.style.visibility="hidden",this.showPortal(t.createElement(J,{onRendered:()=>{this.dragRectRendered=!0,null==n||n()}},o),r))},this.showPortal=(t,i)=>{const s=(0,e.createPortal)(t,i);this.setState({portal:s})},this.hidePortal=()=>{this.setState({portal:void 0})},this.onDragStart=()=>{var t;this.dropInfo=void 0,this.customDrop=void 0;const e=this.selfRef.current;return this.outlineDiv=this.currentDocument.createElement("div"),this.outlineDiv.className=this.getClassName(g.FLEXLAYOUT__OUTLINE_RECT),this.outlineDiv.style.visibility="hidden",e&&e.appendChild(this.outlineDiv),null==this.dragDiv&&(this.dragDiv=this.currentDocument.createElement("div"),this.dragDiv.className=this.getClassName(g.FLEXLAYOUT__DRAG_RECT),this.dragDiv.setAttribute("data-layout-path","/drag-rectangle"),this.dragRectRender(this.dragDivText,this.dragNode,this.newTabJson),e&&e.appendChild(this.dragDiv)),void 0===this.props.model.getMaximizedTabset()&&this.setState({showEdges:this.props.model.isEnableEdgeDock()}),this.dragNode&&this.outlineDiv&&this.dragNode instanceof b&&void 0!==this.dragNode.getTabRect()&&(null===(t=this.dragNode.getTabRect())||void 0===t||t.positionElement(this.outlineDiv)),this.firstMove=!0,!0},this.onDragMove=t=>{var e,i,s,n,o,r,a;if(!1===this.firstMove){const t=this.props.model._getAttribute("tabDragSpeed");this.outlineDiv&&(this.outlineDiv.style.transition=`top ${t}s, left ${t}s, width ${t}s, height ${t}s`)}this.firstMove=!1;const d=null===(e=this.selfRef.current)||void 0===e?void 0:e.getBoundingClientRect(),l={x:t.clientX-(null!==(i=null==d?void 0:d.left)&&void 0!==i?i:0),y:t.clientY-(null!==(s=null==d?void 0:d.top)&&void 0!==s?s:0)};this.checkForBorderToShow(l.x,l.y);const h=null!==(o=null===(n=this.dragDiv)||void 0===n?void 0:n.getBoundingClientRect())&&void 0!==o?o:new DOMRect(0,0,100,100);let _=l.x-h.width/2;_+h.width>(null!==(r=null==d?void 0:d.width)&&void 0!==r?r:0)&&(_=(null!==(a=null==d?void 0:d.width)&&void 0!==a?a:0)-h.width),_=Math.max(0,_),this.dragDiv&&(this.dragDiv.style.left=_+"px",this.dragDiv.style.top=l.y+5+"px",this.dragRectRendered&&"hidden"===this.dragDiv.style.visibility&&(this.dragDiv.style.visibility="visible"));let c=this.props.model._findDropTargetNode(this.dragNode,l.x,l.y);c&&(this.props.onTabDrag?this.handleCustomTabDrag(c,l,t):(this.dropInfo=c,this.outlineDiv&&(this.outlineDiv.className=this.getClassName(c.className),c.rect.positionElement(this.outlineDiv),this.outlineDiv.style.visibility="visible")))},this.onDragEnd=t=>{const e=this.selfRef.current;if(e&&(this.outlineDiv&&e.removeChild(this.outlineDiv),this.dragDiv&&e.removeChild(this.dragDiv)),this.dragDiv=void 0,this.hidePortal(),this.setState({showEdges:!1}),d.instance.hideGlass(),this.dropInfo)if(this.customDrop){this.newTabJson=void 0;try{const{callback:t,dragging:e,over:i,x:s,y:n,location:o}=this.customDrop;t(e,i,s,n,o),null!=this.fnNewNodeDropped&&(this.fnNewNodeDropped(),this.fnNewNodeDropped=void 0)}catch(t){console.error(t)}}else if(void 0!==this.newTabJson){const e=this.doAction(h.addNode(this.newTabJson,this.dropInfo.node.getId(),this.dropInfo.location,this.dropInfo.index));null!=this.fnNewNodeDropped&&(this.fnNewNodeDropped(e,t),this.fnNewNodeDropped=void 0),this.newTabJson=void 0}else void 0!==this.dragNode&&this.doAction(h.moveNode(this.dragNode.getId(),this.dropInfo.node.getId(),this.dropInfo.location,this.dropInfo.index));this.setState({showHiddenBorder:r.CENTER})},this.props.model._setChangeListener(this.onModelChange),this.tabIds=[],this.selfRef=t.createRef(),this.findHeaderBarSizeRef=t.createRef(),this.findTabBarSizeRef=t.createRef(),this.findBorderBarSizeRef=t.createRef(),this.supportsPopout=void 0!==i.supportsPopout?i.supportsPopout:G,this.popoutURL=i.popoutURL?i.popoutURL:"popout.html",this.icons=Object.assign(Object.assign({},W),i.icons),this.state={rect:new s(0,0,0,0),calculatedHeaderBarSize:25,calculatedTabBarSize:26,calculatedBorderBarSize:30,editingTab:void 0,showHiddenBorder:r.CENTER,showEdges:!1},this.onDragEnter=this.onDragEnter.bind(this)}styleFont(t){return this.props.font&&(this.selfRef.current&&(this.props.font.size&&this.selfRef.current.style.setProperty("--font-size",this.props.font.size),this.props.font.family&&this.selfRef.current.style.setProperty("--font-family",this.props.font.family)),this.props.font.style&&(t.fontStyle=this.props.font.style),this.props.font.weight&&(t.fontWeight=this.props.font.weight)),t}doAction(t){if(void 0!==this.props.onAction){const e=this.props.onAction(t);return void 0!==e?this.props.model.doAction(e):void 0}return this.props.model.doAction(t)}componentDidMount(){this.updateRect(),this.updateLayoutMetrics(),this.currentDocument=this.selfRef.current.ownerDocument,this.currentWindow=this.currentDocument.defaultView,this.resizeObserver=new ResizeObserver((t=>{this.updateRect(t[0].contentRect)}));const t=this.selfRef.current;t&&this.resizeObserver.observe(t)}componentDidUpdate(){this.updateLayoutMetrics(),this.props.model!==this.previousModel&&(void 0!==this.previousModel&&this.previousModel._setChangeListener(void 0),this.props.model._setChangeListener(this.onModelChange),this.previousModel=this.props.model)}getCurrentDocument(){return this.currentDocument}getDomRect(){var t;return null===(t=this.selfRef.current)||void 0===t?void 0:t.getBoundingClientRect()}getRootDiv(){return this.selfRef.current}isSupportsPopout(){return this.supportsPopout}isRealtimeResize(){var t;return null!==(t=this.props.realtimeResize)&&void 0!==t&&t}onTabDrag(...t){var e,i;return null===(i=(e=this.props).onTabDrag)||void 0===i?void 0:i.call(e,...t)}getPopoutURL(){return this.popoutURL}componentWillUnmount(){var t;const e=this.selfRef.current;e&&(null===(t=this.resizeObserver)||void 0===t||t.unobserve(e))}setEditingTab(t){this.setState({editingTab:t})}getEditingTab(){return this.state.editingTab}render(){if(!this.selfRef.current)return t.createElement("div",{ref:this.selfRef,className:this.getClassName(g.FLEXLAYOUT__LAYOUT)},this.metricsElements());this.props.model._setPointerFine(window&&window.matchMedia&&window.matchMedia("(pointer: fine)").matches);const e=[],i=[],s=[],n={},o=[],r={headerBarSize:this.state.calculatedHeaderBarSize,tabBarSize:this.state.calculatedTabBarSize,borderBarSize:this.state.calculatedBorderBarSize};this.props.model._setShowHiddenBorder(this.state.showHiddenBorder),this.centerRect=this.props.model._layout(this.state.rect,r),this.renderBorder(this.props.model.getBorderSet(),e,n,s,o),this.renderChildren("",this.props.model.getRoot(),i,n,s,o);const a=[],d={};for(const t of this.tabIds)n[t]&&(a.push(t),d[t]=t);this.tabIds=a;for(const t of Object.keys(n))d[t]||this.tabIds.push(t);const l=[];if(this.state.showEdges){const e=this.centerRect,i=this.edgeRectLength,s=this.edgeRectWidth,n=this.edgeRectLength/2,o=this.getClassName(g.FLEXLAYOUT__EDGE_RECT),r=50;l.push(t.createElement("div",{key:"North",style:{top:e.y,left:e.x+e.width/2-n,width:i,height:s,borderBottomLeftRadius:r,borderBottomRightRadius:r},className:o+" "+this.getClassName(g.FLEXLAYOUT__EDGE_RECT_TOP)})),l.push(t.createElement("div",{key:"West",style:{top:e.y+e.height/2-n,left:e.x,width:s,height:i,borderTopRightRadius:r,borderBottomRightRadius:r},className:o+" "+this.getClassName(g.FLEXLAYOUT__EDGE_RECT_LEFT)})),l.push(t.createElement("div",{key:"South",style:{top:e.y+e.height-s,left:e.x+e.width/2-n,width:i,height:s,borderTopLeftRadius:r,borderTopRightRadius:r},className:o+" "+this.getClassName(g.FLEXLAYOUT__EDGE_RECT_BOTTOM)})),l.push(t.createElement("div",{key:"East",style:{top:e.y+e.height/2-n,left:e.x+e.width-s,width:s,height:i,borderTopLeftRadius:r,borderBottomLeftRadius:r},className:o+" "+this.getClassName(g.FLEXLAYOUT__EDGE_RECT_RIGHT)}))}return t.createElement("div",{ref:this.selfRef,className:this.getClassName(g.FLEXLAYOUT__LAYOUT),onDragEnter:this.props.onExternalDrag?this.onDragEnter:void 0},i,this.tabIds.map((t=>n[t])),e,o,l,s,this.metricsElements(),this.state.portal)}metricsElements(){const e=this.styleFont({visibility:"hidden"});return t.createElement(t.Fragment,null,t.createElement("div",{key:"findHeaderBarSize",ref:this.findHeaderBarSizeRef,style:e,className:this.getClassName(g.FLEXLAYOUT__TABSET_HEADER_SIZER)},"FindHeaderBarSize"),t.createElement("div",{key:"findTabBarSize",ref:this.findTabBarSizeRef,style:e,className:this.getClassName(g.FLEXLAYOUT__TABSET_SIZER)},"FindTabBarSize"),t.createElement("div",{key:"findBorderBarSize",ref:this.findBorderBarSizeRef,style:e,className:this.getClassName(g.FLEXLAYOUT__BORDER_SIZER)},"FindBorderBarSize"))}renderBorder(e,s,n,o,r){for(const a of e.getBorders()){const e=`/border/${a.getLocation().getName()}`;if(a.isShowing()){s.push(t.createElement(C,{key:`border_${a.getLocation().getName()}`,path:e,border:a,layout:this,iconFactory:this.props.iconFactory,titleFactory:this.props.titleFactory,icons:this.icons}));const d=a._getDrawChildren();let l=0,h=0;for(const s of d){if(s instanceof m){let i=e+"/s";r.push(t.createElement(M,{key:s.getId(),layout:this,node:s,path:i}))}else if(s instanceof b){let r=e+"/t"+h++;if(this.supportsPopout&&s.isFloating()){const e=this._getScreenRect(s),d=s._getAttr("borderWidth"),h=s._getAttr("borderHeight");e&&(-1!==d&&a.getLocation().getOrientation()===i.HORZ?e.width=d:-1!==h&&a.getLocation().getOrientation()===i.VERT&&(e.height=h)),o.push(t.createElement(z,{key:s.getId(),url:this.popoutURL,rect:e,title:s.getName(),id:s.getId(),onSetWindow:this.onSetWindow,onCloseWindow:this.onCloseWindow},t.createElement(Y,{layout:this,node:s,factory:this.props.factory}))),n[s.getId()]=t.createElement(X,{key:s.getId(),layout:this,path:r,node:s,selected:l===a.getSelected()})}else n[s.getId()]=t.createElement(U,{key:s.getId(),layout:this,path:r,node:s,selected:l===a.getSelected(),factory:this.props.factory})}l++}}}}renderChildren(e,s,n,o,r,a){const d=s._getDrawChildren();let l=0,h=0,_=0;for(const s of d)if(s instanceof m){const i=e+"/s"+l++;a.push(t.createElement(M,{key:s.getId(),layout:this,path:i,node:s}))}else if(s instanceof v){const i=e+"/ts"+_++;n.push(t.createElement(F,{key:s.getId(),layout:this,path:i,node:s,iconFactory:this.props.iconFactory,titleFactory:this.props.titleFactory,icons:this.icons})),this.renderChildren(i,s,n,o,r,a)}else if(s instanceof b){const i=e+"/t"+h++,n=s.getParent().getChildren()[s.getParent().getSelected()];if(void 0===n&&console.warn("undefined selectedTab should not happen"),this.supportsPopout&&s.isFloating()){const e=this._getScreenRect(s);r.push(t.createElement(z,{key:s.getId(),url:this.popoutURL,rect:e,title:s.getName(),id:s.getId(),onSetWindow:this.onSetWindow,onCloseWindow:this.onCloseWindow},t.createElement(Y,{layout:this,node:s,factory:this.props.factory}))),o[s.getId()]=t.createElement(X,{key:s.getId(),layout:this,path:i,node:s,selected:s===n})}else o[s.getId()]=t.createElement(U,{key:s.getId(),layout:this,path:i,node:s,selected:s===n,factory:this.props.factory})}else{const t=e+(s.getOrientation()===i.HORZ?"/r":"/c")+_++;this.renderChildren(t,s,n,o,r,a)}}_getScreenRect(t){var e;const i=t.getRect().clone(),s=null===(e=this.selfRef.current)||void 0===e?void 0:e.getBoundingClientRect();if(!s)return null;const n=Math.min(80,this.currentWindow.outerHeight-this.currentWindow.innerHeight),o=Math.min(80,this.currentWindow.outerWidth-this.currentWindow.innerWidth);return i.x=i.x+s.x+this.currentWindow.screenX+o,i.y=i.y+s.y+this.currentWindow.screenY+n,i}addTabToTabSet(t,e){if(void 0!==this.props.model.getNodeById(t))return this.doAction(h.addNode(e,t,r.CENTER,-1))}addTabToActiveTabSet(t){const e=this.props.model.getActiveTabset();if(void 0!==e)return this.doAction(h.addNode(t,e.getId(),r.CENTER,-1))}addTabWithDragAndDrop(t,e,i){this.fnNewNodeDropped=i,this.newTabJson=e,this.dragStart(void 0,t,b._fromJson(e,this.props.model,!1),!0,void 0,void 0)}moveTabWithDragAndDrop(t,e){this.dragStart(void 0,e,t,!0,void 0,void 0)}addTabWithDragAndDropIndirect(t,e,i){this.fnNewNodeDropped=i,this.newTabJson=e,d.instance.addGlass(this.onCancelAdd),this.dragDivText=t,this.dragDiv=this.currentDocument.createElement("div"),this.dragDiv.className=this.getClassName(g.FLEXLAYOUT__DRAG_RECT),this.dragDiv.addEventListener("mousedown",this.onDragDivMouseDown),this.dragDiv.addEventListener("touchstart",this.onDragDivMouseDown,{passive:!1}),this.dragRectRender(this.dragDivText,void 0,this.newTabJson,(()=>{if(this.dragDiv){this.dragDiv.style.visibility="visible";const t=this.dragDiv.getBoundingClientRect(),e=new s(0,0,null==t?void 0:t.width,null==t?void 0:t.height);e.centerInRect(this.state.rect),this.dragDiv.setAttribute("data-layout-path","/drag-rectangle"),this.dragDiv.style.left=e.x+"px",this.dragDiv.style.top=e.y+"px"}})),this.selfRef.current.appendChild(this.dragDiv)}handleCustomTabDrag(t,e,i){var n,o,r;let a=null===(n=this.customDrop)||void 0===n?void 0:n.invalidated;const l=null===(o=this.customDrop)||void 0===o?void 0:o.callback;this.customDrop=void 0;const h=this.newTabJson||(this.dragNode instanceof b?this.dragNode:void 0);if(h&&(t.node instanceof v||t.node instanceof R)&&-1===t.index){const n=t.node.getSelectedNode(),o=null==n?void 0:n.getRect();if(n&&(null==o?void 0:o.contains(e.x,e.y))){let r;try{const a=this.onTabDrag(h,n,e.x-o.x,e.y-o.y,t.location,(()=>this.onDragMove(i)));a&&(r={rect:new s(a.x+o.x,a.y+o.y,a.width,a.height),callback:a.callback,invalidated:a.invalidated,dragging:h,over:n,x:e.x-o.x,y:e.y-o.y,location:t.location,cursor:a.cursor})}catch(t){console.error(t)}(null==r?void 0:r.callback)===l&&(a=void 0),this.customDrop=r}}this.dropInfo=t,this.outlineDiv&&(this.outlineDiv.className=this.getClassName(this.customDrop?g.FLEXLAYOUT__OUTLINE_RECT:t.className),this.customDrop?this.customDrop.rect.positionElement(this.outlineDiv):t.rect.positionElement(this.outlineDiv)),d.instance.setGlassCursorOverride(null===(r=this.customDrop)||void 0===r?void 0:r.cursor),this.outlineDiv&&(this.outlineDiv.style.visibility="visible");try{null==a||a()}catch(t){console.error(t)}}onDragEnter(t){if(d.instance.isDragging())return;const e=this.props.onExternalDrag(t);e&&(this.fnNewNodeDropped=e.onDrop,this.newTabJson=e.json,this.dragStart(t,e.dragText,b._fromJson(e.json,this.props.model,!1),!0,void 0,void 0))}checkForBorderToShow(t,e){const i=this.props.model._getOuterInnerRects().outer,s=i.getCenter(),n=this.edgeRectWidth,o=this.edgeRectLength/2;let a=!1;this.props.model.isEnableEdgeDock()&&this.state.showHiddenBorder===r.CENTER&&(e>s.y-o&&e<s.y+o||t>s.x-o&&t<s.x+o)&&(a=!0);let d=r.CENTER;a||(t<=i.x+n?d=r.LEFT:t>=i.getRight()-n?d=r.RIGHT:e<=i.y+n?d=r.TOP:e>=i.getBottom()-n&&(d=r.BOTTOM)),d!==this.state.showHiddenBorder&&this.setState({showHiddenBorder:d})}maximize(t){this.doAction(h.maximizeToggle(t.getId()))}customizeTab(t,e){this.props.onRenderTab&&this.props.onRenderTab(t,e)}customizeTabSet(t,e){this.props.onRenderTabSet&&this.props.onRenderTabSet(t,e)}i18nName(t,e){let i;return this.props.i18nMapper&&(i=this.props.i18nMapper(t,e)),void 0===i&&(i=t+(void 0===e?"":e)),i}getOnRenderFloatingTabPlaceholder(){return this.props.onRenderFloatingTabPlaceholder}getShowOverflowMenu(){return this.props.onShowOverflowMenu}getTabSetPlaceHolderCallback(){return this.props.onTabSetPlaceHolder}showContextMenu(t,e){this.props.onContextMenu&&this.props.onContextMenu(t,e)}auxMouseClick(t,e){this.props.onAuxMouseClick&&this.props.onAuxMouseClick(t,e)}}const J=e=>(t.useEffect((()=>{var t;null===(t=e.onRendered)||void 0===t||t.call(e)}),[e]),t.createElement(t.Fragment,null,e.children));class Z{static _fromJson(t,e){const i=new Z(e);return i._borders=t.map((t=>R._fromJson(t,e))),i}constructor(t){this._model=t,this._borders=[]}getBorders(){return this._borders}_forEachNode(t){for(const e of this._borders){t(e,0);for(const i of e.getChildren())i._forEachNode(t,1)}}_toJson(){return this._borders.map((t=>t.toJson()))}_layoutBorder(t,e){const s=t.outer,n=this._model.getRoot();let o=Math.max(0,s.height-n.getMinHeight()),r=Math.max(0,s.width-n.getMinWidth()),a=0,d=0,l=0,h=0;const _=this._borders.filter((t=>t.isShowing()));for(const t of _){t._setAdjustedSize(t.getSize());const e=-1!==t.getSelected();t.getLocation().getOrientation()===i.HORZ?(d+=t.getBorderBarSize(),e&&(r-=this._model.getSplitterSize(),d+=t.getSize(),h+=t.getSize())):(a+=t.getBorderBarSize(),e&&(o-=this._model.getSplitterSize(),a+=t.getSize(),l+=t.getSize()))}let c=0,u=!1;for(;d>r&&h>0||a>o&&l>0;){const t=_[c];if(-1!==t.getSelected()){const e=t._getAdjustedSize();d>r&&h>0&&t.getLocation().getOrientation()===i.HORZ&&e>0&&e>t.getMinSize()?(t._setAdjustedSize(e-1),d--,h--,u=!0):a>o&&l>0&&t.getLocation().getOrientation()===i.VERT&&e>0&&e>t.getMinSize()&&(t._setAdjustedSize(e-1),a--,l--,u=!0)}if(c=(c+1)%_.length,0===c){if(!u)break;u=!1}}for(const i of _)t.outer=i._layoutBorderOuter(t.outer,e);t.inner=t.outer;for(const i of _)t.inner=i._layoutBorderInner(t.inner,e);return t}_findDropTargetNode(t,e,i){for(const s of this._borders)if(s.isShowing()){const n=s.canDrop(t,e,i);if(void 0!==n)return n}}}class j{static fromJson(t){const e=new j;return j._attributeDefinitions.fromJson(t.global,e._attributes),t.borders&&(e._borders=Z._fromJson(t.borders,e)),e._root=f._fromJson(t.layout,e),e._tidy(),e}static _createAttributeDefinitions(){const t=new c;return t.add("legacyOverflowMenu",!1).setType(_.BOOLEAN),t.add("enableEdgeDock",!0).setType(_.BOOLEAN),t.add("rootOrientationVertical",!1).setType(_.BOOLEAN),t.add("marginInsets",{top:0,right:0,bottom:0,left:0}).setType("IInsets"),t.add("enableUseVisibility",!1).setType(_.BOOLEAN),t.add("enableRotateBorderIcons",!0).setType(_.BOOLEAN),t.add("splitterSize",-1).setType(_.NUMBER),t.add("splitterExtra",0).setType(_.NUMBER),t.add("tabEnableClose",!0).setType(_.BOOLEAN),t.add("tabCloseType",1).setType("ICloseType"),t.add("tabEnableFloat",!1).setType(_.BOOLEAN),t.add("tabEnableDrag",!0).setType(_.BOOLEAN),t.add("tabEnableRename",!0).setType(_.BOOLEAN),t.add("tabContentClassName",void 0).setType(_.STRING),t.add("tabClassName",void 0).setType(_.STRING),t.add("tabIcon",void 0).setType(_.STRING),t.add("tabEnableRenderOnDemand",!0).setType(_.BOOLEAN),t.add("tabDragSpeed",.3).setType(_.NUMBER),t.add("tabBorderWidth",-1).setType(_.NUMBER),t.add("tabBorderHeight",-1).setType(_.NUMBER),t.add("tabSetEnableDeleteWhenEmpty",!0).setType(_.BOOLEAN),t.add("tabSetEnableDrop",!0).setType(_.BOOLEAN),t.add("tabSetEnableDrag",!0).setType(_.BOOLEAN),t.add("tabSetEnableDivide",!0).setType(_.BOOLEAN),t.add("tabSetEnableMaximize",!0).setType(_.BOOLEAN),t.add("tabSetEnableClose",!1).setType(_.BOOLEAN),t.add("tabSetEnableSingleTabStretch",!1).setType(_.BOOLEAN),t.add("tabSetAutoSelectTab",!0).setType(_.BOOLEAN),t.add("tabSetClassNameTabStrip",void 0).setType(_.STRING),t.add("tabSetClassNameHeader",void 0).setType(_.STRING),t.add("tabSetEnableTabStrip",!0).setType(_.BOOLEAN),t.add("tabSetHeaderHeight",0).setType(_.NUMBER),t.add("tabSetTabStripHeight",0).setType(_.NUMBER),t.add("tabSetMarginInsets",{top:0,right:0,bottom:0,left:0}).setType("IInsets"),t.add("tabSetBorderInsets",{top:0,right:0,bottom:0,left:0}).setType("IInsets"),t.add("tabSetTabLocation","top").setType("ITabLocation"),t.add("tabSetMinWidth",0).setType(_.NUMBER),t.add("tabSetMinHeight",0).setType(_.NUMBER),t.add("borderSize",200).setType(_.NUMBER),t.add("borderMinSize",0).setType(_.NUMBER),t.add("borderBarSize",0).setType(_.NUMBER),t.add("borderEnableDrop",!0).setType(_.BOOLEAN),t.add("borderAutoSelectTabWhenOpen",!0).setType(_.BOOLEAN),t.add("borderAutoSelectTabWhenClosed",!1).setType(_.BOOLEAN),t.add("borderClassName",void 0).setType(_.STRING),t.add("borderEnableAutoHide",!1).setType(_.BOOLEAN),t}constructor(){this._borderRects={inner:s.empty(),outer:s.empty()},this._attributes={},this._idMap={},this._borders=new Z(this),this._pointerFine=!0,this._showHiddenBorder=r.CENTER}_setChangeListener(t){this._changeListener=t}getActiveTabset(){return this._activeTabSet&&this.getNodeById(this._activeTabSet.getId())?this._activeTabSet:void 0}_getShowHiddenBorder(){return this._showHiddenBorder}_setShowHiddenBorder(t){this._showHiddenBorder=t}_setActiveTabset(t){this._activeTabSet=t}getMaximizedTabset(){return this._maximizedTabSet}_setMaximizedTabset(t){this._maximizedTabSet=t}getRoot(){return this._root}isRootOrientationVertical(){return this._attributes.rootOrientationVertical}isUseVisibility(){return this._attributes.enableUseVisibility}isEnableRotateBorderIcons(){return this._attributes.enableRotateBorderIcons}getBorderSet(){return this._borders}_getOuterInnerRects(){return this._borderRects}_getPointerFine(){return this._pointerFine}_setPointerFine(t){this._pointerFine=t}visitNodes(t){this._borders._forEachNode(t),this._root._forEachNode(t,0)}getNodeById(t){return this._idMap[t]}getFirstTabSet(t=this._root){const e=t.getChildren()[0];return e instanceof v?e:this.getFirstTabSet(e)}doAction(t){let e;switch(t.type){case h.ADD_NODE:{const i=new b(this,t.data.json,!0),s=this._idMap[t.data.toNode];(s instanceof v||s instanceof R||s instanceof f)&&(s.drop(i,r.getByName(t.data.location),t.data.index,t.data.select),e=i);break}case h.MOVE_NODE:{const e=this._idMap[t.data.fromNode];if(e instanceof b||e instanceof v){const i=this._idMap[t.data.toNode];(i instanceof v||i instanceof R||i instanceof f)&&i.drop(e,r.getByName(t.data.location),t.data.index,t.data.select)}break}case h.DELETE_TAB:{const e=this._idMap[t.data.node];e instanceof b&&e._delete();break}case h.DELETE_TABSET:{const e=this._idMap[t.data.node];if(e instanceof v){const t=[...e.getChildren()];for(let e=0;e<t.length;e++){const i=t[e];i.isEnableClose()&&i._delete()}0===e.getChildren().length&&e._delete(),this._tidy()}break}case h.FLOAT_TAB:{const e=this._idMap[t.data.node];e instanceof b&&(e._setFloating(!0),function(t){const e=t.getParent();if(null!==e)if(e instanceof v){let i=!1,s=0;const n=e.getChildren();for(let e=0;e<n.length;e++){const o=n[e];if(o===t)i=!0;else if(!o.isFloating()&&(s=e,i))break}e._setSelected(s)}else e instanceof R&&e._setSelected(-1)}(e));break}case h.UNFLOAT_TAB:{const e=this._idMap[t.data.node];e instanceof b&&(e._setFloating(!1),function(t){const e=t.getParent();if(null!==e&&(e instanceof v||e instanceof R)){const i=e.getChildren();for(let s=0;s<i.length;s++)if(i[s]===t)return void e._setSelected(s)}}(e));break}case h.RENAME_TAB:{const e=this._idMap[t.data.node];e instanceof b&&e._setName(t.data.text);break}case h.SELECT_TAB:{const e=this._idMap[t.data.tabNode];if(e instanceof b){const t=e.getParent(),i=t.getChildren().indexOf(e);t instanceof R?t.getSelected()===i?t._setSelected(-1):t._setSelected(i):t instanceof v&&(t.getSelected()!==i&&t._setSelected(i),this._activeTabSet=t)}break}case h.SET_ACTIVE_TABSET:if(void 0===t.data.tabsetNode)this._activeTabSet=void 0;else{const e=this._idMap[t.data.tabsetNode];e instanceof v&&(this._activeTabSet=e)}break;case h.ADJUST_SPLIT:{const e=this._idMap[t.data.node1],i=this._idMap[t.data.node2];(e instanceof v||e instanceof f)&&(i instanceof v||i instanceof f)&&(this._adjustSplitSide(e,t.data.weight1,t.data.pixelWidth1),this._adjustSplitSide(i,t.data.weight2,t.data.pixelWidth2));break}case h.ADJUST_BORDER_SPLIT:{const e=this._idMap[t.data.node];e instanceof R&&e._setSize(t.data.pos);break}case h.MAXIMIZE_TOGGLE:{const e=this._idMap[t.data.node];e instanceof v&&(e===this._maximizedTabSet?this._maximizedTabSet=void 0:(this._maximizedTabSet=e,this._activeTabSet=e));break}case h.UPDATE_MODEL_ATTRIBUTES:this._updateAttrs(t.data.json);break;case h.UPDATE_NODE_ATTRIBUTES:this._idMap[t.data.node]._updateAttrs(t.data.json)}return this._updateIdMap(),void 0!==this._changeListener&&this._changeListener(t),e}_updateIdMap(){this._idMap={},this.visitNodes((t=>this._idMap[t.getId()]=t))}_adjustSplitSide(t,e,s){t._setWeight(e),null!=t.getWidth()&&t.getOrientation()===i.VERT?t._updateAttrs({width:s}):null!=t.getHeight()&&t.getOrientation()===i.HORZ&&t._updateAttrs({height:s})}toJson(){const t={};return j._attributeDefinitions.toJson(t,this._attributes),this.visitNodes((t=>{t._fireEvent("save",void 0)})),{global:t,borders:this._borders._toJson(),layout:this._root.toJson()}}getSplitterSize(){let t=this._attributes.splitterSize;return-1===t&&(t=this._pointerFine?8:12),t}isLegacyOverflowMenu(){return this._attributes.legacyOverflowMenu}getSplitterExtra(){return this._attributes.splitterExtra}isEnableEdgeDock(){return this._attributes.enableEdgeDock}_addNode(t){const e=t.getId();if(void 0!==this._idMap[e])throw new Error(`Error: each node must have a unique id, duplicate id:${t.getId()}`);"splitter"!==t.getType()&&(this._idMap[e]=t)}_layout(t,e){var i;return this._borderRects=this._borders._layoutBorder({outer:t,inner:t},e),t=this._borderRects.inner.removeInsets(this._getAttribute("marginInsets")),null===(i=this._root)||void 0===i||i.calcMinSize(),this._root._layout(t,e),t}_findDropTargetNode(t,e,i){let s=this._root._findDropTargetNode(t,e,i);return void 0===s&&(s=this._borders._findDropTargetNode(t,e,i)),s}_tidy(){this._root._tidy()}_updateAttrs(t){j._attributeDefinitions.update(t,this._attributes)}_nextUniqueId(){return"#"+([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)))}_getAttribute(t){return this._attributes[t]}setOnAllowDrop(t){this._onAllowDrop=t}_getOnAllowDrop(){return this._onAllowDrop}setOnCreateTabSet(t){this._onCreateTabSet=t}_getOnCreateTabSet(){return this._onCreateTabSet}static toTypescriptInterfaces(){console.log(j._attributeDefinitions.toTypescriptInterface("Global",void 0)),console.log(f.getAttributeDefinitions().toTypescriptInterface("Row",j._attributeDefinitions)),console.log(v.getAttributeDefinitions().toTypescriptInterface("TabSet",j._attributeDefinitions)),console.log(b.getAttributeDefinitions().toTypescriptInterface("Tab",j._attributeDefinitions)),console.log(R.getAttributeDefinitions().toTypescriptInterface("Border",j._attributeDefinitions))}toString(){return JSON.stringify(this.toJson())}}j._attributeDefinitions=j._createAttributeDefinitions()})(),o})()));
|