UNPKG

flexlayout-react-v7-react-19

Version:

A multi-tab docking layout manager

1 lines 106 kB
!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===(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,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){"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,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_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 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.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 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("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 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=()=>{var t;const e=i.getDomRect(),n=null===(t=c.current)||void 0===t?void 0:t.getBoundingClientRect();n&&e&&o._setTabRect(new s(n.left-e.left,n.top-e.top,n.width,n.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())