flexlayout-react 0.7.15 → 0.8.1

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.
Files changed (252) hide show
  1. package/ChangeLog.txt +28 -0
  2. package/README.md +157 -330
  3. package/Screenshot_light.png +0 -0
  4. package/Screenshot_rounded.png +0 -0
  5. package/declarations/Attribute.d.ts +1 -1
  6. package/declarations/AttributeDefinitions.d.ts +1 -1
  7. package/declarations/DockLocation.d.ts +12 -12
  8. package/declarations/DropInfo.d.ts +12 -12
  9. package/declarations/I18nLabel.d.ts +12 -14
  10. package/declarations/Orientation.d.ts +7 -7
  11. package/declarations/PopupMenu.d.ts +1 -1
  12. package/declarations/Rect.d.ts +41 -28
  13. package/declarations/Types.d.ts +95 -79
  14. package/declarations/examples/demo/Utils.d.ts +4 -0
  15. package/declarations/index.d.ts +21 -22
  16. package/declarations/model/Action.d.ts +5 -5
  17. package/declarations/model/Actions.d.ts +127 -110
  18. package/declarations/model/BorderNode.d.ts +30 -34
  19. package/declarations/model/BorderSet.d.ts +3 -4
  20. package/declarations/model/ICloseType.d.ts +5 -5
  21. package/declarations/model/IDraggable.d.ts +2 -2
  22. package/declarations/model/IDropTarget.d.ts +2 -2
  23. package/declarations/model/IJsonModel.d.ts +811 -149
  24. package/declarations/model/LayoutWindow.d.ts +28 -0
  25. package/declarations/model/Model.d.ts +91 -86
  26. package/declarations/model/Node.d.ts +17 -17
  27. package/declarations/model/RowNode.d.ts +10 -11
  28. package/declarations/model/TabNode.d.ts +44 -37
  29. package/declarations/model/TabSetNode.d.ts +44 -41
  30. package/declarations/model/Utils.d.ts +1 -1
  31. package/declarations/model/WindowLayout.d.ts +24 -0
  32. package/declarations/src/Attribute.d.ts +1 -0
  33. package/declarations/src/AttributeDefinitions.d.ts +1 -0
  34. package/declarations/src/DockLocation.d.ts +12 -0
  35. package/declarations/src/DropInfo.d.ts +12 -0
  36. package/declarations/src/I18nLabel.d.ts +10 -0
  37. package/declarations/src/Orientation.d.ts +7 -0
  38. package/declarations/src/PopupMenu.d.ts +1 -0
  39. package/declarations/src/Rect.d.ts +31 -0
  40. package/declarations/src/Types.d.ts +92 -0
  41. package/declarations/src/index.d.ts +20 -0
  42. package/declarations/src/model/Action.d.ts +5 -0
  43. package/declarations/src/model/Actions.d.ts +110 -0
  44. package/declarations/src/model/BorderNode.d.ts +28 -0
  45. package/declarations/src/model/BorderSet.d.ts +3 -0
  46. package/declarations/src/model/ICloseType.d.ts +5 -0
  47. package/declarations/src/model/IDraggable.d.ts +2 -0
  48. package/declarations/src/model/IDropTarget.d.ts +2 -0
  49. package/declarations/src/model/IJsonModel.d.ts +153 -0
  50. package/declarations/src/model/Model.d.ts +98 -0
  51. package/declarations/src/model/Node.d.ts +16 -0
  52. package/declarations/src/model/RowNode.d.ts +11 -0
  53. package/declarations/src/model/TabNode.d.ts +36 -0
  54. package/declarations/src/model/TabSetNode.d.ts +37 -0
  55. package/declarations/src/model/Utils.d.ts +1 -0
  56. package/declarations/src/view/BorderButton.d.ts +1 -0
  57. package/declarations/src/view/BorderTab.d.ts +2 -0
  58. package/declarations/src/view/BorderTabSet.d.ts +1 -0
  59. package/declarations/src/view/DragContainer.d.ts +1 -0
  60. package/declarations/src/view/ErrorBoundary.d.ts +1 -0
  61. package/declarations/src/view/FloatingWindow.d.ts +1 -0
  62. package/declarations/src/view/Icons.d.ts +7 -0
  63. package/declarations/src/view/Layout.d.ts +113 -0
  64. package/declarations/src/view/Overlay.d.ts +1 -0
  65. package/declarations/src/view/PopupMenu.d.ts +1 -0
  66. package/declarations/src/view/Row.d.ts +1 -0
  67. package/declarations/src/view/Splitter.d.ts +1 -0
  68. package/declarations/src/view/Tab.d.ts +1 -0
  69. package/declarations/src/view/TabButton.d.ts +1 -0
  70. package/declarations/src/view/TabButtonStamp.d.ts +1 -0
  71. package/declarations/src/view/TabOverflowHook.d.ts +1 -0
  72. package/declarations/src/view/TabSet.d.ts +1 -0
  73. package/declarations/src/view/Utils.d.ts +4 -0
  74. package/declarations/view/BorderButton.d.ts +1 -1
  75. package/declarations/view/BorderTab.d.ts +2 -0
  76. package/declarations/view/BorderTabSet.d.ts +1 -1
  77. package/declarations/view/DragContainer.d.ts +1 -0
  78. package/declarations/view/ErrorBoundary.d.ts +1 -1
  79. package/declarations/view/ExtendedResizeObserver.d.ts +23 -0
  80. package/declarations/view/FloatingWindow.d.ts +1 -1
  81. package/declarations/view/Icons.d.ts +8 -7
  82. package/declarations/view/Layout.d.ts +140 -161
  83. package/declarations/view/Overlay.d.ts +1 -0
  84. package/declarations/view/PopoutWindow.d.ts +1 -0
  85. package/declarations/view/PopupMenu.d.ts +1 -0
  86. package/declarations/view/Row.d.ts +1 -0
  87. package/declarations/view/SizeTracker.d.ts +10 -0
  88. package/declarations/view/Splitter.d.ts +1 -1
  89. package/declarations/view/Tab.d.ts +1 -1
  90. package/declarations/view/TabButton.d.ts +1 -1
  91. package/declarations/view/TabButtonStamp.d.ts +1 -1
  92. package/declarations/view/TabOverflowHook.d.ts +1 -1
  93. package/declarations/view/TabSet.d.ts +1 -1
  94. package/declarations/view/Utils.d.ts +11 -1
  95. package/dist/bundles/demo.js +232052 -0
  96. package/dist/bundles/demo.js.map +1 -0
  97. package/dist/flexlayout.js +122 -92
  98. package/dist/flexlayout_min.js +1 -1
  99. package/lib/Attribute.js +42 -31
  100. package/lib/Attribute.js.map +1 -1
  101. package/lib/AttributeDefinitions.js +131 -108
  102. package/lib/AttributeDefinitions.js.map +1 -1
  103. package/lib/DockLocation.js +120 -124
  104. package/lib/DockLocation.js.map +1 -1
  105. package/lib/DropInfo.js +9 -13
  106. package/lib/DropInfo.js.map +1 -1
  107. package/lib/I18nLabel.js +13 -18
  108. package/lib/I18nLabel.js.map +1 -1
  109. package/lib/Orientation.js +22 -26
  110. package/lib/Orientation.js.map +1 -1
  111. package/lib/Rect.js +104 -72
  112. package/lib/Rect.js.map +1 -1
  113. package/lib/Types.js +96 -83
  114. package/lib/Types.js.map +1 -1
  115. package/lib/index.js +21 -38
  116. package/lib/index.js.map +1 -1
  117. package/lib/model/Action.js +6 -10
  118. package/lib/model/Action.js.map +1 -1
  119. package/lib/model/Actions.js +169 -155
  120. package/lib/model/Actions.js.map +1 -1
  121. package/lib/model/BorderNode.js +385 -406
  122. package/lib/model/BorderNode.js.map +1 -1
  123. package/lib/model/BorderSet.js +66 -121
  124. package/lib/model/BorderSet.js.map +1 -1
  125. package/lib/model/ICloseType.js +6 -9
  126. package/lib/model/ICloseType.js.map +1 -1
  127. package/lib/model/IDraggable.js +1 -2
  128. package/lib/model/IDropTarget.js +1 -2
  129. package/lib/model/IJsonModel.js +1 -2
  130. package/lib/model/LayoutWindow.js +83 -0
  131. package/lib/model/LayoutWindow.js.map +1 -0
  132. package/lib/model/Model.js +614 -496
  133. package/lib/model/Model.js.map +1 -1
  134. package/lib/model/Node.js +217 -228
  135. package/lib/model/Node.js.map +1 -1
  136. package/lib/model/RowNode.js +491 -504
  137. package/lib/model/RowNode.js.map +1 -1
  138. package/lib/model/TabNode.js +289 -184
  139. package/lib/model/TabNode.js.map +1 -1
  140. package/lib/model/TabSetNode.js +459 -446
  141. package/lib/model/TabSetNode.js.map +1 -1
  142. package/lib/model/Utils.js +47 -82
  143. package/lib/model/Utils.js.map +1 -1
  144. package/lib/view/BorderButton.js +129 -138
  145. package/lib/view/BorderButton.js.map +1 -1
  146. package/lib/view/BorderTab.js +47 -0
  147. package/lib/view/BorderTab.js.map +1 -0
  148. package/lib/view/BorderTabSet.js +134 -128
  149. package/lib/view/BorderTabSet.js.map +1 -1
  150. package/lib/view/DragContainer.js +16 -0
  151. package/lib/view/DragContainer.js.map +1 -0
  152. package/lib/view/ErrorBoundary.js +23 -27
  153. package/lib/view/ErrorBoundary.js.map +1 -1
  154. package/lib/view/Icons.js +40 -45
  155. package/lib/view/Icons.js.map +1 -1
  156. package/lib/view/Layout.js +919 -907
  157. package/lib/view/Layout.js.map +1 -1
  158. package/lib/view/Overlay.js +9 -0
  159. package/lib/view/Overlay.js.map +1 -0
  160. package/lib/view/PopoutWindow.js +129 -0
  161. package/lib/view/PopoutWindow.js.map +1 -0
  162. package/lib/view/PopupMenu.js +71 -0
  163. package/lib/view/PopupMenu.js.map +1 -0
  164. package/lib/view/Row.js +45 -0
  165. package/lib/view/Row.js.map +1 -0
  166. package/lib/view/SizeTracker.js +11 -0
  167. package/lib/view/SizeTracker.js.map +1 -0
  168. package/lib/view/Splitter.js +191 -147
  169. package/lib/view/Splitter.js.map +1 -1
  170. package/lib/view/Tab.js +86 -60
  171. package/lib/view/Tab.js.map +1 -1
  172. package/lib/view/TabButton.js +127 -135
  173. package/lib/view/TabButton.js.map +1 -1
  174. package/lib/view/TabButtonStamp.js +16 -21
  175. package/lib/view/TabButtonStamp.js.map +1 -1
  176. package/lib/view/TabOverflowHook.js +150 -149
  177. package/lib/view/TabOverflowHook.js.map +1 -1
  178. package/lib/view/TabSet.js +272 -234
  179. package/lib/view/TabSet.js.map +1 -1
  180. package/lib/view/Utils.js +126 -68
  181. package/lib/view/Utils.js.map +1 -1
  182. package/package.json +36 -30
  183. package/src/Attribute.ts +23 -0
  184. package/src/AttributeDefinitions.ts +38 -15
  185. package/src/DockLocation.ts +13 -13
  186. package/src/I18nLabel.ts +7 -9
  187. package/src/Rect.ts +53 -1
  188. package/src/Types.ts +16 -0
  189. package/src/index.ts +1 -2
  190. package/src/model/Actions.ts +49 -29
  191. package/src/model/BorderNode.ts +208 -214
  192. package/src/model/BorderSet.ts +42 -91
  193. package/src/model/IJsonModel.ts +883 -103
  194. package/src/model/LayoutWindow.ts +121 -0
  195. package/src/model/Model.ts +488 -366
  196. package/src/model/Node.ts +98 -111
  197. package/src/model/RowNode.ts +323 -319
  198. package/src/model/TabNode.ts +294 -110
  199. package/src/model/TabSetNode.ts +303 -242
  200. package/src/model/Utils.ts +6 -32
  201. package/src/view/BorderButton.tsx +36 -52
  202. package/src/view/BorderTab.tsx +70 -0
  203. package/src/view/BorderTabSet.tsx +64 -52
  204. package/src/view/DragContainer.tsx +32 -0
  205. package/src/view/Icons.tsx +6 -0
  206. package/src/view/Layout.tsx +1053 -1046
  207. package/src/view/Overlay.tsx +22 -0
  208. package/src/view/PopoutWindow.tsx +152 -0
  209. package/src/{PopupMenu.tsx → view/PopupMenu.tsx} +36 -31
  210. package/src/view/Row.tsx +68 -0
  211. package/src/view/SizeTracker.tsx +20 -0
  212. package/src/view/Splitter.tsx +167 -112
  213. package/src/view/Tab.tsx +76 -42
  214. package/src/view/TabButton.tsx +39 -54
  215. package/src/view/TabButtonStamp.tsx +5 -9
  216. package/src/view/TabOverflowHook.tsx +14 -9
  217. package/src/view/TabSet.tsx +221 -176
  218. package/src/view/Utils.tsx +119 -39
  219. package/style/_base.scss +140 -34
  220. package/style/dark.css +140 -35
  221. package/style/dark.css.map +1 -1
  222. package/style/dark.scss +3 -1
  223. package/style/gray.css +139 -34
  224. package/style/gray.css.map +1 -1
  225. package/style/gray.scss +2 -0
  226. package/style/light.css +141 -36
  227. package/style/light.css.map +1 -1
  228. package/style/light.scss +4 -2
  229. package/style/rounded.css +697 -0
  230. package/style/rounded.css.map +1 -0
  231. package/style/rounded.scss +194 -0
  232. package/style/underline.css +139 -34
  233. package/style/underline.css.map +1 -1
  234. package/style/underline.scss +2 -0
  235. package/cypress.config.ts +0 -16
  236. package/lib/DragDrop.js +0 -316
  237. package/lib/DragDrop.js.map +0 -1
  238. package/lib/PopupMenu.js +0 -68
  239. package/lib/PopupMenu.js.map +0 -1
  240. package/lib/model/SplitterNode.js +0 -72
  241. package/lib/model/SplitterNode.js.map +0 -1
  242. package/lib/view/FloatingWindow.js +0 -123
  243. package/lib/view/FloatingWindow.js.map +0 -1
  244. package/lib/view/FloatingWindowTab.js +0 -19
  245. package/lib/view/FloatingWindowTab.js.map +0 -1
  246. package/lib/view/TabFloating.js +0 -66
  247. package/lib/view/TabFloating.js.map +0 -1
  248. package/src/DragDrop.ts +0 -392
  249. package/src/model/SplitterNode.ts +0 -78
  250. package/src/view/FloatingWindow.tsx +0 -140
  251. package/src/view/FloatingWindowTab.tsx +0 -29
  252. package/src/view/TabFloating.tsx +0 -101
@@ -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===(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());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=>{"Escape"===t.code?i.setEditingTab(void 0):"Enter"===t.code&&(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){var a;const l=o.getRootDiv(),h=o.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=()=>{o.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),o.showPortal(t.createElement(B,{currentDocument:_,onSelect:s,onHide:E,items:i,classNameMapper:h,layout:o,iconFactory:n,titleFactory:r}),T)}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((()=>{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=>o===i.HORZ?t.x:t.y,f=t=>o===i.HORZ?t.getRight():t.getBottom(),O=t=>o===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 o=!(e instanceof v)||!0===e.isEnableTabStrip();let r=f(t)-s;if(null!==n.current&&(r-=O(n.current.getBoundingClientRect())),o&&e.getChildren().length>0){if(0===g.length&&0===_&&f(i.getTabRect())+2<r)return;let s=0;const o=e.getSelectedNode();if(o&&!u.current){const e=o.getTabRect(),i=b(e)-2,n=f(e)+2;O(e)+4>=r-b(t)?s=b(t)-i:(n>r||i<b(t))&&(i<b(t)&&(s=b(t)-i),n+s>r&&(s=r-n))}const n=Math.max(0,r-(f(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];(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: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 I=[],F=[];const z={headerContent:void 0,buttons:I,stickyButtons:F,headerButtons:[],overflowPosition:void 0};if(o.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=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)),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&&o.isSupportsPopout()&&e.isEnableFloat()&&!e.isFloating()){const i=o.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=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=>{var e;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(),null!==(e=s.getRootDiv())&&void 0!==e?e:void 0),r.current=l._getSplitterBounds(o,!0);const n=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 h=o.getRect();o.getOrientation()===i.VERT&&h.width<2?h.width=2:o.getOrientation()===i.HORZ&&h.height<2&&(h.height=2),h.positionElement(a.current),n&&n.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 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();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=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)))},I=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=()=>{var t;const e=i.getDomRect(),n=null===(t=_.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))},N=t=>{t.stopPropagation()},S=i.getClassName,D=o.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+=n?" "+S(w+"--selected"):" "+S(w+"--unselected")),void 0!==o.getClassName()&&(C+=" "+o.getClassName());const M=A(i,o,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()===o&&(x=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=>{"Escape"===t.code?i.setEditingTab(void 0):"Enter"===t.code&&(i.setEditingTab(void 0),i.doAction(h.renameTab(o.getId(),t.target.value)))},onMouseDown:N,onTouchStart:N})),o.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(o):d.close))}return t.createElement("div",{ref:_,"data-layout-path":l,className:C,onMouseDown:u,onClick:p,onAuxClick:p,onContextMenu:t=>{i.showContextMenu(o,t)},onTouchStart:u,title:o.getHelpText()},U,x,M.buttons)},F=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=>{}),F):o.dragStart(t,i,s,s.isEnableDrag(),(t=>{}),F)}}},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=>{o.doAction(h.deleteTab(s.getChildren()[0].getId())),t.stopPropagation()},U=t=>{void 0!==Y&&o.doAction(h.floatTab(Y.getId())),t.stopPropagation()},F=t=>{s.canMaximize()&&o.maximize(s)},z=o.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:o,node:i,path:d+"/tb"+e,key:i.getId(),selected:l,iconFactory:n,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};o.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=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: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&&o.isSupportsPopout()&&Y.isEnableFloat()&&!Y.isFloating()){const e=o.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=o.i18nName(T.Restore),i=o.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?o.i18nName(T.Close_Tab):o.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=o.styleFont(X);var et=void 0;if(0===s.getChildren().length){const t=o.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:o,id:n,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,n,`left=${e.x},top=${e.y},width=${e.width},height=${e.height}`),null!==_.current?(l(n,_.current),window.addEventListener("beforeunload",(()=>{_.current&&(_.current.close(),_.current=null)})),_.current.addEventListener("load",(()=>{if(t){const t=_.current.document;t.title=o;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=>{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((()=>{T(e)})),_.current.addEventListener("beforeunload",(()=>{d(n)}))}}))):(console.warn(`Unable to open window ${r}`),d(n)),()=>{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: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),edgeArrow:t.createElement((()=>t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:{display:"block",width:10,height:10},preserveAspectRatio:"none",viewBox:"0 0 100 100"},t.createElement("path",{fill:"var(--color-edge-icon)",stroke:"var(--color-edge-icon)",d:"M10 30 L90 30 l-40 40 Z"}))),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 o=this.dragDiv;if(t&&o)try{t.removeChild(o)}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)=>{var r,a;s?(this.dragNode=i,this.dragDivText=e,d.instance.startDrag(t,this.onDragStart,this.onDragMove,this.onDragEnd,this.onCancelDrag,o,n,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,o,n,this.currentDocument,null!==(r=this.selfRef.current)&&void 0!==r?r:void 0)},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.dragRectRendered=!1;const r=this.dragDiv;r&&(r.style.visibility="hidden",this.showPortal(t.createElement(J,{onRendered:()=>{this.dragRectRendered=!0,null==o||o()}},n),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,o,n,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!==(n=null===(o=this.dragDiv)||void 0===o?void 0:o.getBoundingClientRect())&&void 0!==n?n: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: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)}));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=[],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=[],h=this.icons.edgeArrow;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)},t.createElement("div",{style:{transform:"rotate(180deg)"}},h))),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)},t.createElement("div",{style:{transform:"rotate(90deg)"}},h))),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)},t.createElement("div",null,h))),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)},t.createElement("div",{style:{transform:"rotate(-90deg)"}},h)))}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");e&&(-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(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,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){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 o=Math.min(80,this.currentWindow.outerHeight-this.currentWindow.innerHeight),n=Math.min(80,this.currentWindow.outerWidth-this.currentWindow.innerWidth);return i.x=i.x+s.x+this.currentWindow.screenX+n,i.y=i.y+s.y+this.currentWindow.screenY+o,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 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&&(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(),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("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 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={557:(t,e,i)=>{var n=i(47);e.H=n.createRoot,n.hydrateRoot},36:e=>{e.exports=t},47:t=>{t.exports=e}},n={};function o(t){var e=n[t];if(void 0!==e)return e.exports;var s=n[t]={exports:{}};return i[t](s,s.exports,o),s.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 s={};o.r(s),o.d(s,{Action:()=>T,Actions:()=>_,BorderNode:()=>F,BorderSet:()=>m,CLASSES:()=>r,DefaultMax:()=>U,DefaultMin:()=>C,DockLocation:()=>g,DropInfo:()=>b,FlexLayoutVersion:()=>lt,I18nLabel:()=>a,ICloseType:()=>H,Layout:()=>at,LayoutInternal:()=>rt,LayoutWindow:()=>B,Model:()=>W,Node:()=>f,Orientation:()=>c,Rect:()=>u,RowNode:()=>I,TabNode:()=>O,TabSetNode:()=>M});var a,r,l=o(36),d=o(47),h=o(557);class c{static flip(t){return t===c.HORZ?c.VERT:c.HORZ}constructor(t){this._name=t}getName(){return this._name}toString(){return this._name}}c.HORZ=new c("horz"),c.VERT=new c("vert");class u{static empty(){return new u(0,0,0,0)}static fromJson(t){return new u(t.x,t.y,t.width,t.height)}constructor(t,e,i,n){this.x=t,this.y=e,this.width=i,this.height=n}toJson(){return{x:this.x,y:this.y,width:this.width,height:this.height}}snap(t){this.x=Math.round(this.x/t)*t,this.y=Math.round(this.y/t)*t,this.width=Math.round(this.width/t)*t,this.height=Math.round(this.height/t)*t}static getBoundingClientRect(t){let{x:e,y:i,width:n,height:o}=t.getBoundingClientRect();return new u(e,i,n,o)}static getContentRect(t){const e=t.getBoundingClientRect(),i=window.getComputedStyle(t),n=parseFloat(i.paddingLeft),o=parseFloat(i.paddingRight),s=parseFloat(i.paddingTop),a=parseFloat(i.paddingBottom),r=parseFloat(i.borderLeftWidth),l=parseFloat(i.borderRightWidth),d=parseFloat(i.borderTopWidth),h=parseFloat(i.borderBottomWidth),c=e.width-r-n-o-l,g=e.height-d-s-a-h;return new u(e.left+r+n,e.top+d+s,c,g)}static fromDomRect(t){return new u(t.x,t.y,t.width,t.height)}relativeTo(t){return new u(this.x-t.x,this.y-t.y,this.width,this.height)}clone(){return new u(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)}equalSize(t){return 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 u(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===c.VERT&&(e=this.height),e}toString(){return"(Rect: x="+this.x+", y="+this.y+", width="+this.width+", height="+this.height+")"}}class g{static getByName(t){return g.values.get(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 g.CENTER;const n=i>=1-e;return i>=e?n?g.BOTTOM:g.LEFT:n?g.RIGHT:g.TOP}constructor(t,e,i){this.name=t,this.orientation=e,this.indexPlus=i,g.values.set(this.name,this)}getName(){return this.name}getOrientation(){return this.orientation}getDockRect(t){return this===g.TOP?new u(t.x,t.y,t.width,t.height/2):this===g.BOTTOM?new u(t.x,t.getBottom()-t.height/2,t.width,t.height/2):this===g.LEFT?new u(t.x,t.y,t.width/2,t.height):this===g.RIGHT?new u(t.getRight()-t.width/2,t.y,t.width/2,t.height):t.clone()}split(t,e){return this===g.TOP?{start:new u(t.x,t.y,t.width,e),end:new u(t.x,t.y+e,t.width,t.height-e)}:this===g.LEFT?{start:new u(t.x,t.y,e,t.height),end:new u(t.x+e,t.y,t.width-e,t.height)}:this===g.RIGHT?{start:new u(t.getRight()-e,t.y,e,t.height),end:new u(t.x,t.y,t.width-e,t.height)}:{start:new u(t.x,t.getBottom()-e,t.width,e),end:new u(t.x,t.y,t.width,t.height-e)}}reflect(){return this===g.TOP?g.BOTTOM:this===g.LEFT?g.RIGHT:this===g.RIGHT?g.LEFT:g.TOP}toString(){return"(DockLocation: name="+this.name+", orientation="+this.orientation+")"}}g.values=new Map,g.TOP=new g("top",c.VERT,0),g.BOTTOM=new g("bottom",c.VERT,1),g.LEFT=new g("left",c.HORZ,0),g.RIGHT=new g("right",c.HORZ,1),g.CENTER=new g("center",c.VERT,0),function(t){t.Close_Tab="Close",t.Close_Tabset="Close tab set",t.Active_Tabset="Active tab set",t.Move_Tabset="Move tab set",t.Move_Tabs="Move tabs(?)",t.Maximize="Maximize tab set",t.Restore="Restore tab set",t.Popout_Tab="Popout selected tab",t.Overflow_Menu_Tooltip="Hidden tabs",t.Error_rendering_component="Error rendering component"}(a||(a={})),function(t){t.FLEXLAYOUT__BORDER="flexlayout__border",t.FLEXLAYOUT__BORDER_="flexlayout__border_",t.FLEXLAYOUT__BORDER_TAB_CONTENTS="flexlayout__border_tab_contents",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__LAYOUT_MOVEABLES="flexlayout__layout_moveables",t.FLEXLAYOUT__LAYOUT_OVERLAY="flexlayout__layout_overlay",t.FLEXLAYOUT__LAYOUT_TAB_STAMPS="flexlayout__layout_tab_stamps",t.FLEXLAYOUT__LAYOUT_MAIN="flexlayout__layout_main",t.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER="flexlayout__layout_border_container",t.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER_INNER="flexlayout__layout_border_container_inner",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__SPLITTER_HANDLE="flexlayout__splitter_handle",t.FLEXLAYOUT__SPLITTER_HANDLE_HORZ="flexlayout__splitter_handle_horz",t.FLEXLAYOUT__SPLITTER_HANDLE_VERT="flexlayout__splitter_handle_vert",t.FLEXLAYOUT__ROW="flexlayout__row",t.FLEXLAYOUT__TAB="flexlayout__tab",t.FLEXLAYOUT__TAB_POSITION="flexlayout__tab_position",t.FLEXLAYOUT__TAB_MOVEABLE="flexlayout__tab_moveable",t.FLEXLAYOUT__TAB_OVERLAY="flexlayout__tab_overlay",t.FLEXLAYOUT__TABSET="flexlayout__tabset",t.FLEXLAYOUT__TABSET_CONTAINER="flexlayout__tabset_container",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_ICON="flexlayout__tab_toolbar_icon",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"}(r||(r={}));class T{constructor(t,e){this.type=t,this.data=e}}class _{static addNode(t,e,i,n,o){return new T(_.ADD_NODE,{json:t,toNode:e,location:i.getName(),index:n,select:o})}static moveNode(t,e,i,n,o){return new T(_.MOVE_NODE,{fromNode:t,toNode:e,location:i.getName(),index:n,select:o})}static deleteTab(t){return new T(_.DELETE_TAB,{node:t})}static deleteTabset(t){return new T(_.DELETE_TABSET,{node:t})}static renameTab(t,e){return new T(_.RENAME_TAB,{node:t,text:e})}static selectTab(t){return new T(_.SELECT_TAB,{tabNode:t})}static setActiveTabset(t,e){return new T(_.SET_ACTIVE_TABSET,{tabsetNode:t,windowId:e})}static adjustWeights(t,e){return new T(_.ADJUST_WEIGHTS,{nodeId:t,weights:e})}static adjustBorderSplit(t,e){return new T(_.ADJUST_BORDER_SPLIT,{node:t,pos:e})}static maximizeToggle(t,e){return new T(_.MAXIMIZE_TOGGLE,{node:t,windowId:e})}static updateModelAttributes(t){return new T(_.UPDATE_MODEL_ATTRIBUTES,{json:t})}static updateNodeAttributes(t,e){return new T(_.UPDATE_NODE_ATTRIBUTES,{node:t,json:e})}static popoutTab(t){return new T(_.POPOUT_TAB,{node:t})}static popoutTabset(t){return new T(_.POPOUT_TABSET,{node:t})}static closeWindow(t){return new T(_.CLOSE_WINDOW,{windowId:t})}static createWindow(t,e){return new T(_.CREATE_WINDOW,{layout:t,rect:e})}}_.ADD_NODE="FlexLayout_AddNode",_.MOVE_NODE="FlexLayout_MoveNode",_.DELETE_TAB="FlexLayout_DeleteTab",_.DELETE_TABSET="FlexLayout_DeleteTabset",_.RENAME_TAB="FlexLayout_RenameTab",_.SELECT_TAB="FlexLayout_SelectTab",_.SET_ACTIVE_TABSET="FlexLayout_SetActiveTabset",_.ADJUST_WEIGHTS="FlexLayout_AdjustWeights",_.ADJUST_BORDER_SPLIT="FlexLayout_AdjustBorderSplit",_.MAXIMIZE_TOGGLE="FlexLayout_MaximizeToggle",_.UPDATE_MODEL_ATTRIBUTES="FlexLayout_UpdateModelAttributes",_.UPDATE_NODE_ATTRIBUTES="FlexLayout_UpdateNodeAttributes",_.POPOUT_TAB="FlexLayout_PopoutTab",_.POPOUT_TABSET="FlexLayout_PopoutTabset",_.CLOSE_WINDOW="FlexLayout_CloseWindow",_.CREATE_WINDOW="FlexLayout_CreateWindow";class p{constructor(t,e,i,n){this.name=t,this.alias=void 0,this.modelName=e,this.defaultValue=i,this.alwaysWriteJson=n,this.required=!1,this.fixed=!1,this.type="any"}setType(t){return this.type=t,this}setAlias(t){return this.alias=t,this}setDescription(t){this.description=t}setRequired(){return this.required=!0,this}setFixed(){return this.fixed=!0,this}setpairedAttr(t){this.pairedAttr=t}setPairedType(t){this.pairedType=t}}p.NUMBER="number",p.STRING="string",p.BOOLEAN="boolean";class E{constructor(){this.attributes=[],this.nameToAttribute=new Map}addWithAll(t,e,i,n){const o=new p(t,e,i,n);return this.attributes.push(o),this.nameToAttribute.set(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.get(t);if(void 0!==e)return e.modelName}toJson(t,e){for(const i of this.attributes){const n=e[i.name];(i.alwaysWriteJson||n!==i.defaultValue)&&(t[i.name]=n)}}fromJson(t,e){for(const i of this.attributes){let n=t[i.name];void 0===n&&i.alias&&(n=t[i.alias]),e[i.name]=void 0===n?i.defaultValue:n}}update(t,e){for(const i of this.attributes)if(t.hasOwnProperty(i.name)){const n=t[i.name];void 0===n?delete e[i.name]:e[i.name]=n}}setDefaults(t){for(const e of this.attributes)t[e.name]=e.defaultValue}pairAttributes(t,e){for(const i of e.attributes)if(i.modelName&&this.nameToAttribute.has(i.modelName)){const e=this.nameToAttribute.get(i.modelName);e.setpairedAttr(i),i.setpairedAttr(e),e.setPairedType(t)}}toTypescriptInterface(t,e){var i,n;const o=[],s=this.attributes.sort(((t,e)=>t.name.localeCompare(e.name)));o.push("export interface I"+t+"Attributes {");for(let t=0;t<s.length;t++){const a=s[t];let r,l,d=a.type,h=a;void 0!==h.defaultValue?r=h.defaultValue:void 0!==h.modelName&&void 0!==e&&void 0!==e.nameToAttribute.get(h.modelName)&&(l=h.modelName,h=e.nameToAttribute.get(l),r=h.defaultValue,d=h.type);let c=JSON.stringify(r);const u=h.required?"":"?";let g="\t/**\n\t ";a.description?g+=a.description:a.pairedType&&(null===(i=a.pairedAttr)||void 0===i?void 0:i.description)&&(g+=`Value for ${a.pairedType} attribute ${a.pairedAttr.name} if not overridden`,g+="\n\n\t ",g+=null===(n=a.pairedAttr)||void 0===n?void 0:n.description),g+="\n\n\t ",a.fixed?g+=`Fixed value: ${c}`:g+=l?`Default: inherited from Global attribute ${a.modelName} (default ${c})`:`Default: ${c}`,g+="\n\t */",o.push(g),o.push("\t"+a.name+u+": "+d+";\n")}return o.push("}"),o.join("\n")}}class b{constructor(t,e,i,n,o){this.node=t,this.rect=e,this.location=i,this.index=n,this.className=o}}class m{static fromJson(t,e){const i=new m(e);i.borders=t.map((t=>F.fromJson(t,e)));for(const t of i.borders)i.borderMap.set(t.getLocation(),t);return i}constructor(t){this.borders=[],this.borderMap=new Map,this.layoutHorizontal=!0}toJson(){return this.borders.map((t=>t.toJson()))}getLayoutHorizontal(){return this.layoutHorizontal}getBorders(){return this.borders}getBorderMap(){return this.borderMap}forEachNode(t){for(const e of this.borders){t(e,0);for(const i of e.getChildren())i.forEachNode(t,1)}}setPaths(){for(const t of this.borders){const e="/border/"+t.getLocation().getName();t.setPath(e);let i=0;for(const n of t.getChildren())n.setPath(e+"/t"+i),i++}}findDropTargetNode(t,e,i){for(const n of this.borders)if(n.isShowing()){const o=n.canDrop(t,e,i);if(void 0!==o)return o}}}class f{constructor(t){this.model=t,this.attributes={},this.children=[],this.rect=u.empty(),this.listeners=new Map,this.path=""}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}getPath(){return this.path}getOrientation(){return void 0===this.parent?this.model.isRootOrientationVertical()?c.VERT:c.HORZ:c.flip(this.parent.getOrientation())}setEventListener(t,e){this.listeners.set(t,e)}removeEventListener(t){this.listeners.delete(t)}setId(t){this.attributes.id=t}fireEvent(t,e){this.listeners.has(t)&&this.listeners.get(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)}setPaths(t){let e=0;for(const i of this.children){let n=t;"row"===i.getType()?i.getOrientation()===c.VERT?n+="/c"+e:n+="/r"+e:"tabset"===i.getType()?n+="/ts"+e:"tab"===i.getType()&&(n+="/t"+e),i.path=n,i.setPaths(n),e++}}setParent(t){this.parent=t}setRect(t){this.rect=t}setPath(t){this.path=t}setWeight(t){this.attributes.weight=t}setSelected(t){this.attributes.selected=t}findDropTargetNode(t,e,i,n){let o;if(this.rect.contains(i,n))if(void 0!==this.model.getMaximizedTabset(t))o=this.model.getMaximizedTabset(t).canDrop(e,i,n);else if(o=this.canDrop(e,i,n),void 0===o&&0!==this.children.length)for(const s of this.children)if(o=s.findDropTargetNode(t,e,i,n),void 0!==o)break;return o}canDrop(t,e,i){}canDockInto(t,e){if(null!=e){if(e.location===g.CENTER&&!1===e.node.isEnableDrop())return!1;if(e.location===g.CENTER&&"tabset"===t.getType()&&void 0!==t.getName())return!1;if(e.location!==g.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),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,e}removeAll(){this.children=[]}styleWithPosition(t){return null==t&&(t={}),this.rect.styleWithPosition(t)}isEnableDivide(){return!0}toAttributeString(){return JSON.stringify(this.attributes,void 0,"\t")}}class O extends f{static fromJson(t,e,i=!0){return new O(e,t,i)}constructor(t,e,i=!0){super(t),this.tabRect=u.empty(),this.extra={},this.moveableElement=null,this.tabStamp=null,this.rendered=!1,this.visible=!1,O.attributeDefinitions.fromJson(e,this.attributes),!0===i&&t.addNode(this)}getName(){return this.getAttr("name")}getHelpText(){return this.getAttr("helpText")}getComponent(){return this.getAttr("component")}getWindowId(){return this.parent instanceof M?this.parent.getWindowId():W.MAIN_WINDOW_ID}getWindow(){const t=this.model.getwindowsMap().get(this.getWindowId());if(t)return t.window}getConfig(){return this.attributes.config}getExtraData(){return this.extra}isPoppedOut(){return this.getWindowId()!==W.MAIN_WINDOW_ID}isSelected(){return this.getParent().getSelectedNode()===this}getIcon(){return this.getAttr("icon")}isEnableClose(){return this.getAttr("enableClose")}getCloseType(){return this.getAttr("closeType")}isEnablePopout(){return this.getAttr("enablePopout")}isEnablePopoutIcon(){return this.getAttr("enablePopoutIcon")}isEnablePopoutOverlay(){return this.getAttr("enablePopoutOverlay")}isEnableDrag(){return this.getAttr("enableDrag")}isEnableRename(){return this.getAttr("enableRename")}isEnableWindowReMount(){return this.getAttr("enableWindowReMount")}getClassName(){return this.getAttr("className")}getContentClassName(){return this.getAttr("contentClassName")}getTabSetClassName(){return this.getAttr("tabsetClassName")}isEnableRenderOnDemand(){return this.getAttr("enableRenderOnDemand")}getMinWidth(){return this.getAttr("minWidth")}getMinHeight(){return this.getAttr("minHeight")}getMaxWidth(){return this.getAttr("maxWidth")}getMaxHeight(){return this.getAttr("maxHeight")}toJson(){const t={};return O.attributeDefinitions.toJson(t,this.attributes),t}saveScrollPosition(){this.moveableElement&&(this.scrollLeft=this.moveableElement.scrollLeft,this.scrollTop=this.moveableElement.scrollTop)}restoreScrollPosition(){this.scrollTop&&requestAnimationFrame((()=>{this.moveableElement&&this.scrollTop&&(this.moveableElement.scrollTop=this.scrollTop,this.moveableElement.scrollLeft=this.scrollLeft)}))}setRect(t){t.equals(this.rect)||(this.fireEvent("resize",{rect:t}),this.rect=t)}setVisible(t){t!==this.visible&&(this.fireEvent("visibility",{visible:t}),this.visible=t)}getScrollTop(){return this.scrollTop}setScrollTop(t){this.scrollTop=t}getScrollLeft(){return this.scrollLeft}setScrollLeft(t){this.scrollLeft=t}isRendered(){return this.rendered}setRendered(t){this.rendered=t}getTabRect(){return this.tabRect}setTabRect(t){this.tabRect=t}getTabStamp(){return this.tabStamp}setTabStamp(t){this.tabStamp=t}getMoveableElement(){return this.moveableElement}setMoveableElement(t){this.moveableElement=t}setRenderedName(t){this.renderedName=t}getNameForOverflowMenu(){const t=this.getAttr("altName");return void 0!==t?t:this.renderedName}setName(t){this.attributes.name=t}delete(){this.parent.remove(this),this.fireEvent("close",{})}updateAttrs(t){O.attributeDefinitions.update(t,this.attributes)}getAttributeDefinitions(){return O.attributeDefinitions}setBorderWidth(t){this.attributes.borderWidth=t}setBorderHeight(t){this.attributes.borderHeight=t}static getAttributeDefinitions(){return O.attributeDefinitions}static createAttributeDefinitions(){const t=new E;return t.add("type",O.TYPE,!0).setType(p.STRING).setFixed(),t.add("id",void 0).setType(p.STRING).setDescription("the unique id of the tab, if left undefined a uuid will be assigned"),t.add("name","[Unnamed Tab]").setType(p.STRING).setDescription("name of tab to be displayed in the tab button"),t.add("altName",void 0).setType(p.STRING).setDescription("if there is no name specifed then this value will be used in the overflow menu"),t.add("helpText",void 0).setType(p.STRING).setDescription("An optional help text for the tab to be displayed upon tab hover."),t.add("component",void 0).setType(p.STRING).setDescription("string identifying which component to run (for factory)"),t.add("config",void 0).setType("any").setDescription("a place to hold json config for the hosted component"),t.add("tabsetClassName",void 0).setType(p.STRING).setDescription("class applied to parent tabset when this is the only tab and it is stretched to fill the tabset"),t.add("enableWindowReMount",!1).setType(p.BOOLEAN).setDescription("if enabled the tab will re-mount when popped out/in"),t.addInherited("enableClose","tabEnableClose").setType(p.BOOLEAN).setDescription("allow user to close tab via close button"),t.addInherited("closeType","tabCloseType").setType("ICloseType").setDescription("see values in ICloseType"),t.addInherited("enableDrag","tabEnableDrag").setType(p.BOOLEAN).setDescription("allow user to drag tab to new location"),t.addInherited("enableRename","tabEnableRename").setType(p.BOOLEAN).setDescription("allow user to rename tabs by double clicking"),t.addInherited("className","tabClassName").setType(p.STRING).setDescription("class applied to tab button"),t.addInherited("contentClassName","tabContentClassName").setType(p.STRING).setDescription("class applied to tab content"),t.addInherited("icon","tabIcon").setType(p.STRING).setDescription("the tab icon"),t.addInherited("enableRenderOnDemand","tabEnableRenderOnDemand").setType(p.BOOLEAN).setDescription("whether to avoid rendering component until tab is visible"),t.addInherited("enablePopout","tabEnablePopout").setType(p.BOOLEAN).setAlias("enableFloat").setDescription("enable popout (in popout capable browser)"),t.addInherited("enablePopoutIcon","tabEnablePopoutIcon").setType(p.BOOLEAN).setDescription("whether to show the popout icon in the tabset header if this tab enables popouts"),t.addInherited("enablePopoutOverlay","tabEnablePopoutOverlay").setType(p.BOOLEAN).setDescription("if this tab will not work correctly in a popout window when the main window is backgrounded (inactive)\n then enabling this option will gray out this tab"),t.addInherited("borderWidth","tabBorderWidth").setType(p.NUMBER).setDescription("width when added to border, -1 will use border size"),t.addInherited("borderHeight","tabBorderHeight").setType(p.NUMBER).setDescription("height when added to border, -1 will use border size"),t.addInherited("minWidth","tabMinWidth").setType(p.NUMBER).setDescription("the min width of this tab"),t.addInherited("minHeight","tabMinHeight").setType(p.NUMBER).setDescription("the min height of this tab"),t.addInherited("maxWidth","tabMaxWidth").setType(p.NUMBER).setDescription("the max width of this tab"),t.addInherited("maxHeight","tabMaxHeight").setType(p.NUMBER).setDescription("the max height of this tab"),t}}function w(){return"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches}function R(t,e,i){let n,o=e.getName(),s=e.getName();void 0===i&&(i=0),void 0===n&&void 0!==e.getIcon()&&(n=0!==i?l.createElement("img",{style:{width:"1em",height:"1em",transform:"rotate("+i+"deg)"},src:e.getIcon(),alt:"leadingContent"}):l.createElement("img",{style:{width:"1em",height:"1em"},src:e.getIcon(),alt:"leadingContent"}));const a={leading:n,content:o,name:s,buttons:[]};return t.customizeTab(e,a),e.setRenderedName(a.name),a}function A(t){let e=!1;return t.nativeEvent instanceof MouseEvent&&(0!==t.nativeEvent.button||t.ctrlKey||t.altKey||t.metaKey||t.shiftKey)&&(e=!0),e}function L(t,e){const i=[...y("iframe",e),...y("webview",e)];for(const e of i)e.style.pointerEvents=t?"auto":"none"}function y(t,e){return[...e.getElementsByTagName(t)]}function v(t){if(t instanceof O)return t.isEnablePopout();if(t instanceof M){for(const e of t.getChildren())if(!1===e.isEnablePopout())return!1;return!0}return!1}function N(t){const e=window.screen.availWidth,i=window.screen.availHeight;return t.x>=0&&t.getRight()<=e&&t.y>=0||t.getBottom()<=i}function D(t,e){const i=t.getAttribute("style");return i!==e.getAttribute("style")&&(i?e.setAttribute("style",i):e.removeAttribute("style"),!0)}function x(t,e){if(void 0!==t&&(t instanceof M||t instanceof F)){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))}}function S(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)))}O.TYPE="tab",O.attributeDefinitions=O.createAttributeDefinitions();class M extends f{static fromJson(t,e,i){const n=new M(e,t);if(null!=t.children)for(const i of t.children){const t=O.fromJson(i,e);n.addChild(t)}return 0===n.children.length&&n.setSelected(-1),t.maximized&&!0===t.maximized&&(i.maximizedTabSet=n),t.active&&!0===t.active&&(i.activeTabSet=n),n}constructor(t,e){super(t),this.tabStripRect=u.empty(),this.contentRect=u.empty(),this.calculatedMinHeight=0,this.calculatedMinWidth=0,this.calculatedMaxHeight=0,this.calculatedMaxWidth=0,M.attributeDefinitions.fromJson(e,this.attributes),t.addNode(this)}getName(){return this.getAttr("name")}isEnableActiveIcon(){return this.getAttr("enableActiveIcon")}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")}getAttrMinWidth(){return this.getAttr("minWidth")}getAttrMinHeight(){return this.getAttr("minHeight")}getMinWidth(){return this.calculatedMinWidth}getMinHeight(){return this.calculatedMinHeight}getMinSize(t){return t===c.HORZ?this.getMinWidth():this.getMinHeight()}getAttrMaxWidth(){return this.getAttr("maxWidth")}getAttrMaxHeight(){return this.getAttr("maxHeight")}getMaxWidth(){return this.calculatedMaxWidth}getMaxHeight(){return this.calculatedMaxHeight}getMaxSize(t){return t===c.HORZ?this.getMaxWidth():this.getMaxHeight()}getConfig(){return this.attributes.config}isMaximized(){return this.model.getMaximizedTabset(this.getWindowId())===this}isActive(){return this.model.getActiveTabset(this.getWindowId())===this}isEnableDeleteWhenEmpty(){return this.getAttr("enableDeleteWhenEmpty")}isEnableDrop(){return this.getAttr("enableDrop")}isEnableTabWrap(){return this.getAttr("enableTabWrap")}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")}isEnableTabStrip(){return this.getAttr("enableTabStrip")}isAutoSelectTab(){return this.getAttr("autoSelectTab")}getClassNameTabStrip(){return this.getAttr("classNameTabStrip")}getTabLocation(){return this.getAttr("tabLocation")}toJson(){const t={};return M.attributeDefinitions.toJson(t,this.attributes),t.children=this.children.map((t=>t.toJson())),this.isActive()&&(t.active=!0),this.isMaximized()&&(t.maximized=!0),t}calcMinMaxSize(){this.calculatedMinHeight=this.getAttrMinHeight(),this.calculatedMinWidth=this.getAttrMinWidth(),this.calculatedMaxHeight=this.getAttrMaxHeight(),this.calculatedMaxWidth=this.getAttrMaxWidth();for(const t of this.children){const e=t;this.calculatedMinWidth=Math.max(this.calculatedMinWidth,e.getMinWidth()),this.calculatedMinHeight=Math.max(this.calculatedMinHeight,e.getMinHeight()),this.calculatedMaxWidth=Math.min(this.calculatedMaxWidth,e.getMaxWidth()),this.calculatedMaxHeight=Math.min(this.calculatedMaxHeight,e.getMaxHeight())}this.calculatedMinHeight+=this.tabStripRect.height,this.calculatedMaxHeight+=this.tabStripRect.height}canMaximize(){return!!this.isEnableMaximize()&&(this.getModel().getMaximizedTabset(this.getWindowId())===this||this.getParent()!==this.getModel().getRoot(this.getWindowId())||1!==this.getModel().getRoot(this.getWindowId()).getChildren().length)}setContentRect(t){this.contentRect=t}getContentRect(){return this.contentRect}setTabStripRect(t){this.tabStripRect=t}setWeight(t){this.attributes.weight=t}setSelected(t){this.attributes.selected=t}getWindowId(){return this.parent.getWindowId()}canDrop(t,e,i){let n;if(t===this){const t=g.CENTER,e=this.tabStripRect;n=new b(this,e,t,-1,r.FLEXLAYOUT__OUTLINE_RECT)}else{if(this.getWindowId()!==W.MAIN_WINDOW_ID&&!v(t))return;if(this.contentRect.contains(e,i)){let t=g.CENTER;void 0===this.model.getMaximizedTabset(this.parent.getWindowId())&&(t=g.getLocation(this.contentRect,e,i));const o=t.getDockRect(this.rect);n=new b(this,o,t,-1,r.FLEXLAYOUT__OUTLINE_RECT)}else if(null!=this.tabStripRect&&this.tabStripRect.contains(e,i)){let t,o,s;if(0===this.children.length)t=this.tabStripRect.clone(),o=t.y+3,s=t.height-4,t.width=2;else{let a=this.children[0];t=a.getTabRect(),o=t.y,s=t.height;let l=this.tabStripRect.x,d=0;for(let s=0;s<this.children.length;s++){if(a=this.children[s],t=a.getTabRect(),t.y!==o&&(o=t.y,l=this.tabStripRect.x),d=t.x+t.width/2,e>=l&&e<d&&i>t.y&&i<t.getBottom()){const e=g.CENTER,i=new u(t.x-2,t.y,3,t.height);n=new b(this,i,e,s,r.FLEXLAYOUT__OUTLINE_RECT);break}l=d}}if(null==n){const e=g.CENTER,i=new u(t.getRight()-2,o,3,s);n=new b(this,i,e,this.children.length,r.FLEXLAYOUT__OUTLINE_RECT)}}}if(t.canDockInto(t,n))return n}delete(){this.parent.removeChild(this)}remove(t){const e=this.removeChild(t);this.model.tidy(),x(this,e)}drop(t,e,i,n){const o=e;if(this===t)return;let s=t.getParent(),a=0;if(void 0!==s&&(a=s.removeChild(t),s instanceof F&&s.getSelected()===a?s.setSelected(-1):x(s,a)),t instanceof O&&s===this&&a<i&&i>0&&i--,o===g.CENTER){let e=i;if(-1===e&&(e=this.children.length),t instanceof O)this.addChild(t,e),(n||!1!==n&&this.isAutoSelectTab())&&this.setSelected(e);else if(t instanceof I)t.forEachNode(((t,i)=>{t instanceof O&&(this.addChild(t,e),e++)}),0);else{for(let i=0;i<t.getChildren().length;i++){const n=t.getChildren()[i];this.addChild(n,e),e++}-1===this.getSelected()&&this.children.length>0&&this.setSelected(0)}this.model.setActiveTabset(this,this.parent.getWindowId())}else{let i=t;if(t instanceof O){const e=this.model.getOnCreateTabSet();i=new M(this.model,e?e(t):{}),i.addChild(t),s=i}else if(t instanceof I){const n=this.getParent();if(t.getOrientation()===n.getOrientation()&&(e.getOrientation()===n.getOrientation()||e===g.CENTER)){const e=new I(this.model,this.getWindowId(),{});e.addChild(t),i=e}}else i=t;const n=this.parent,a=n.getChildren().indexOf(this);if(n.getOrientation()===o.orientation)i.setWeight(this.getWeight()/2),this.setWeight(this.getWeight()/2),n.addChild(i,a+o.indexPlus);else{const t=new I(this.model,this.getWindowId(),{});t.setWeight(this.getWeight()),t.addChild(this),this.setWeight(50),i.setWeight(50),t.addChild(i,o.indexPlus),n.removeChild(this),n.addChild(t,a)}i instanceof M&&this.model.setActiveTabset(i,this.getWindowId())}this.model.tidy()}updateAttrs(t){M.attributeDefinitions.update(t,this.attributes)}getAttributeDefinitions(){return M.attributeDefinitions}static getAttributeDefinitions(){return M.attributeDefinitions}static createAttributeDefinitions(){const t=new E;return t.add("type",M.TYPE,!0).setType(p.STRING).setFixed(),t.add("id",void 0).setType(p.STRING).setDescription("the unique id of the tab set, if left undefined a uuid will be assigned"),t.add("weight",100).setType(p.NUMBER).setDescription("relative weight for sizing of this tabset in parent row"),t.add("selected",0).setType(p.NUMBER).setDescription("index of selected/visible tab in tabset"),t.add("name",void 0).setType(p.STRING),t.add("config",void 0).setType("any").setDescription("a place to hold json config used in your own code"),t.addInherited("enableDeleteWhenEmpty","tabSetEnableDeleteWhenEmpty").setDescription("whether to delete this tabset when is has no tabs"),t.addInherited("enableDrop","tabSetEnableDrop").setDescription("allow user to drag tabs into this tabset"),t.addInherited("enableDrag","tabSetEnableDrag").setDescription("allow user to drag tabs out this tabset"),t.addInherited("enableDivide","tabSetEnableDivide").setDescription("allow user to drag tabs to region of this tabset, splitting into new tabset"),t.addInherited("enableMaximize","tabSetEnableMaximize").setDescription("allow user to maximize tabset to fill view via maximize button"),t.addInherited("enableClose","tabSetEnableClose").setDescription("allow user to close tabset via a close button"),t.addInherited("enableSingleTabStretch","tabSetEnableSingleTabStretch").setDescription("if the tabset has only a single tab then stretch the single tab to fill area and display in a header style"),t.addInherited("classNameTabStrip","tabSetClassNameTabStrip").setDescription("a class name to apply to the tab strip"),t.addInherited("enableTabStrip","tabSetEnableTabStrip").setDescription("enable tab strip and allow multiple tabs in this tabset"),t.addInherited("minWidth","tabSetMinWidth").setDescription("minimum width (in px) for this tabset"),t.addInherited("minHeight","tabSetMinHeight").setDescription("minimum height (in px) for this tabset"),t.addInherited("maxWidth","tabSetMaxWidth").setDescription("maximum width (in px) for this tabset"),t.addInherited("maxHeight","tabSetMaxHeight").setDescription("maximum height (in px) for this tabset"),t.addInherited("enableTabWrap","tabSetEnableTabWrap").setDescription("show tabs in location top or bottom"),t.addInherited("tabLocation","tabSetTabLocation").setDescription("the location of the tabs either top or bottom"),t.addInherited("autoSelectTab","tabSetAutoSelectTab").setType(p.BOOLEAN).setDescription("whether to select new/moved tabs in tabset"),t.addInherited("enableActiveIcon","tabSetEnableActiveIcon").setType(p.BOOLEAN).setDescription("whether the active icon (*) should be displayed when the tabset is active"),t}}M.TYPE="tabset",M.attributeDefinitions=M.createAttributeDefinitions();class I extends f{static fromJson(t,e,i){const n=new I(e,i.windowId,t);if(null!=t.children)for(const o of t.children)if(o.type===M.TYPE){const t=M.fromJson(o,e,i);n.addChild(t)}else{const t=I.fromJson(o,e,i);n.addChild(t)}return n}constructor(t,e,i){super(t),this.windowId=e,this.minHeight=C,this.minWidth=C,this.maxHeight=U,this.maxWidth=U,I.attributeDefinitions.fromJson(i,this.attributes),this.normalizeWeights(),t.addNode(this)}getWeight(){return this.attributes.weight}toJson(){const t={};I.attributeDefinitions.toJson(t,this.attributes),t.children=[];for(const e of this.children)t.children.push(e.toJson());return t}getWindowId(){return this.windowId}setWindowId(t){this.windowId=t}setWeight(t){this.attributes.weight=t}getSplitterBounds(t){const e=this.getOrientation()===c.HORZ,i=this.getChildren(),n=this.model.getSplitterSize(),o=i[0].getRect(),s=i[i.length-1].getRect();let a=e?[o.x,s.getRight()]:[o.y,s.getBottom()];const r=e?[o.x,s.getRight()]:[o.y,s.getBottom()];for(let o=0;o<t;o++){const t=i[o];a[0]+=e?t.getMinWidth():t.getMinHeight(),r[0]+=e?t.getMaxWidth():t.getMaxHeight(),o>0&&(a[0]+=n,r[0]+=n)}for(let o=i.length-1;o>=t;o--){const t=i[o];a[1]-=(e?t.getMinWidth():t.getMinHeight())+n,r[1]-=(e?t.getMaxWidth():t.getMaxHeight())+n}return a=[Math.max(r[1],a[0]),Math.min(r[0],a[1])],a}getSplitterInitials(t){const e=this.getOrientation()===c.HORZ,i=this.getChildren(),n=this.model.getSplitterSize(),o=[];let s=0;for(let t=0;t<i.length;t++){const n=i[t].getRect(),a=e?n.width:n.height;o.push(a),s+=a}const a=i[t].getRect();return{initialSizes:o,sum:s,startPosition:(e?a.x:a.y)-n}}calculateSplit(t,e,i,n,o){const s=this.getOrientation()===c.HORZ,a=this.getChildren(),r=a[t],l=s?r.getMaxWidth():r.getMaxHeight(),d=[...i];if(e<o){let i=o-e,n=0;d[t]+i>l?(n=d[t]+i-l,d[t]=l):d[t]+=i;for(let e=t-1;e>=0;e--){const t=a[e],n=s?t.getMinWidth():t.getMinHeight();if(d[e]-i>n){d[e]-=i;break}i-=d[e]-n,d[e]=n}for(let e=t+1;e<a.length;e++){const t=a[e],i=s?t.getMaxWidth():t.getMaxHeight();if(d[e]+n<i){d[e]+=n;break}n-=i-d[e],d[e]=i}}else{let i=e-o,n=0;d[t-1]+i>l?(n=d[t-1]+i-l,d[t-1]=l):d[t-1]+=i;for(let e=t;e<a.length;e++){const t=a[e],n=s?t.getMinWidth():t.getMinHeight();if(d[e]-i>n){d[e]-=i;break}i-=d[e]-n,d[e]=n}for(let e=t-1;e>=0;e--){const t=a[e],i=s?t.getMaxWidth():t.getMaxHeight();if(d[e]+n<i){d[e]+=n;break}n-=i-d[e],d[e]=i}}return d.map((t=>100*Math.max(.1,t)/n))}getMinSize(t){return t===c.HORZ?this.getMinWidth():this.getMinHeight()}getMinWidth(){return this.minWidth}getMinHeight(){return this.minHeight}getMaxSize(t){return t===c.HORZ?this.getMaxWidth():this.getMaxHeight()}getMaxWidth(){return this.maxWidth}getMaxHeight(){return this.maxHeight}calcMinMaxSize(){this.minHeight=C,this.minWidth=C,this.maxHeight=U,this.maxWidth=U;let t=!0;for(const e of this.children){const i=e;i.calcMinMaxSize(),this.getOrientation()===c.VERT?(this.minHeight+=i.getMinHeight(),this.maxHeight+=i.getMaxHeight(),t||(this.minHeight+=this.model.getSplitterSize(),this.maxHeight+=this.model.getSplitterSize()),this.minWidth=Math.max(this.minWidth,i.getMinWidth()),this.maxWidth=Math.min(this.maxWidth,i.getMaxWidth())):(this.minWidth+=i.getMinWidth(),this.maxWidth+=i.getMaxWidth(),t||(this.minWidth+=this.model.getSplitterSize(),this.maxWidth+=this.model.getSplitterSize()),this.minHeight=Math.max(this.minHeight,i.getMinHeight()),this.maxHeight=Math.min(this.maxHeight,i.getMaxHeight())),t=!1}}tidy(){let t=0;for(;t<this.children.length;){const e=this.children[t];if(e instanceof I){e.tidy();const i=e.getChildren();if(0===i.length)this.removeChild(e);else if(1===i.length){const n=i[0];if(this.removeChild(e),n instanceof I){let i=0;const o=n.getChildren();for(const t of o)i+=t.getWeight();for(let n=0;n<o.length;n++){const s=o[n];s.setWeight(e.getWeight()*s.getWeight()/i),this.addChild(s,t+n)}}else n.setWeight(e.getWeight()),this.addChild(n,t)}else t++}else e instanceof M&&0===e.getChildren().length&&e.isEnableDeleteWhenEmpty()?(this.removeChild(e),e===this.model.getMaximizedTabset(this.windowId)&&this.model.setMaximizedTabset(void 0,this.windowId)):t++}if(this===this.model.getRoot(this.windowId)&&0===this.children.length){const t=this.model.getOnCreateTabSet();let e=t?t():{};e=Object.assign(Object.assign({},e),{selected:-1});const i=new M(this.model,e);this.model.setActiveTabset(i,this.windowId),this.addChild(i)}}canDrop(t,e,i){const n=i-this.rect.y,o=e-this.rect.x,s=this.rect.width,a=this.rect.height,l=50;let d;if(this.getWindowId()===W.MAIN_WINDOW_ID||v(t)){if(this.model.isEnableEdgeDock()&&void 0===this.parent){if(e<this.rect.x+10&&n>a/2-l&&n<a/2+l){const t=g.LEFT,e=t.getDockRect(this.rect);e.width=e.width/2,d=new b(this,e,t,-1,r.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(e>this.rect.getRight()-10&&n>a/2-l&&n<a/2+l){const t=g.RIGHT,e=t.getDockRect(this.rect);e.width=e.width/2,e.x+=e.width,d=new b(this,e,t,-1,r.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(i<this.rect.y+10&&o>s/2-l&&o<s/2+l){const t=g.TOP,e=t.getDockRect(this.rect);e.height=e.height/2,d=new b(this,e,t,-1,r.FLEXLAYOUT__OUTLINE_RECT_EDGE)}else if(i>this.rect.getBottom()-10&&o>s/2-l&&o<s/2+l){const t=g.BOTTOM,e=t.getDockRect(this.rect);e.height=e.height/2,e.y+=e.height,d=new b(this,e,t,-1,r.FLEXLAYOUT__OUTLINE_RECT_EDGE)}if(void 0!==d&&!t.canDockInto(t,d))return}return d}}drop(t,e,i){const n=e,o=t.getParent();let s;if(o&&o.removeChild(t),void 0!==o&&o instanceof M&&o.setSelected(0),void 0!==o&&o instanceof F&&o.setSelected(-1),t instanceof M||t instanceof I)s=t,s instanceof I&&s.getOrientation()===this.getOrientation()&&(e.getOrientation()===this.getOrientation()||e===g.CENTER)&&(s=new I(this.model,this.windowId,{}),s.addChild(t));else{const e=this.model.getOnCreateTabSet();s=new M(this.model,e?e(t):{}),s.addChild(t)}let a=this.children.reduce(((t,e)=>t+e.getWeight()),0);0===a&&(a=100),s.setWeight(a/3);const r=!this.model.isRootOrientationVertical();if(n===g.CENTER)-1===i?this.addChild(s,this.children.length):this.addChild(s,i);else if(r&&n===g.LEFT||!r&&n===g.TOP)this.addChild(s,0);else if(r&&n===g.RIGHT||!r&&n===g.BOTTOM)this.addChild(s);else if(r&&n===g.TOP||!r&&n===g.LEFT){const t=new I(this.model,this.windowId,{}),e=new I(this.model,this.windowId,{});e.setWeight(75),s.setWeight(25);for(const t of this.children)e.addChild(t);this.removeAll(),t.addChild(s),t.addChild(e),this.addChild(t)}else if(r&&n===g.BOTTOM||!r&&n===g.RIGHT){const t=new I(this.model,this.windowId,{}),e=new I(this.model,this.windowId,{});e.setWeight(75),s.setWeight(25);for(const t of this.children)e.addChild(t);this.removeAll(),t.addChild(e),t.addChild(s),this.addChild(t)}s instanceof M&&this.model.setActiveTabset(s,this.windowId),this.model.tidy()}isEnableDrop(){return!0}getAttributeDefinitions(){return I.attributeDefinitions}updateAttrs(t){I.attributeDefinitions.update(t,this.attributes)}static getAttributeDefinitions(){return I.attributeDefinitions}normalizeWeights(){let t=0;for(const e of this.children)t+=e.getWeight();0===t&&(t=1);for(const e of this.children){const i=e;i.setWeight(Math.max(.001,100*i.getWeight()/t))}}static createAttributeDefinitions(){const t=new E;return t.add("type",I.TYPE,!0).setType(p.STRING).setFixed(),t.add("id",void 0).setType(p.STRING).setDescription("the unique id of the row, if left undefined a uuid will be assigned"),t.add("weight",100).setType(p.NUMBER).setDescription("relative weight for sizing of this row in parent row"),t}}I.TYPE="row",I.attributeDefinitions=I.createAttributeDefinitions();class B{constructor(t,e){this._windowId=t,this._rect=e,this._toScreenRectFunction=t=>t}visitNodes(t){this.root.forEachNode(t,0)}get windowId(){return this._windowId}get rect(){return this._rect}get layout(){return this._layout}get window(){return this._window}get root(){return this._root}get maximizedTabSet(){return this._maximizedTabSet}get activeTabSet(){return this._activeTabSet}set rect(t){this._rect=t}set layout(t){this._layout=t}set window(t){this._window=t}set root(t){this._root=t}set maximizedTabSet(t){this._maximizedTabSet=t}set activeTabSet(t){this._activeTabSet=t}get toScreenRectFunction(){return this._toScreenRectFunction}set toScreenRectFunction(t){this._toScreenRectFunction=t}toJson(){return this._window&&this._window.screenTop>-1e4&&(this.rect=new u(this._window.screenLeft,this._window.screenTop,this._window.outerWidth,this._window.outerHeight)),{layout:this.root.toJson(),rect:this.rect.toJson()}}static fromJson(t,e,i){const n=e.getwindowsMap().size;let o=t.rect?u.fromJson(t.rect):new u(50+50*n,50+50*n,600,400);o=function(t){t.snap(10);const e=window.screen.availWidth,i=window.screen.availHeight;return(t.x+t.width>e||t.y+t.height>i)&&(t.x=Math.max(0,Math.min(t.x,e-t.width)),t.y=Math.max(0,Math.min(t.y,i-t.height))),t}(o);const s=new B(i,o);return s.root=I.fromJson(t.layout,e,s),s}}const C=0,U=99999;class W{constructor(){this.attributes={},this.idMap=new Map,this.borders=new m(this),this.windows=new Map,this.rootWindow=new B(W.MAIN_WINDOW_ID,u.empty()),this.windows.set(W.MAIN_WINDOW_ID,this.rootWindow),this.changeListeners=[]}doAction(t){var e;let i;switch(t.type){case _.ADD_NODE:{const e=new O(this,t.data.json,!0),n=this.idMap.get(t.data.toNode);(n instanceof M||n instanceof F||n instanceof I)&&(n.drop(e,g.getByName(t.data.location),t.data.index,t.data.select),i=e);break}case _.MOVE_NODE:{const e=this.idMap.get(t.data.fromNode);if(e instanceof O||e instanceof M||e instanceof I){e===this.getMaximizedTabset(e.getWindowId())&&(this.windows.get(e.getWindowId()).maximizedTabSet=void 0);const i=this.idMap.get(t.data.toNode);(i instanceof M||i instanceof F||i instanceof I)&&i.drop(e,g.getByName(t.data.location),t.data.index,t.data.select)}this.removeEmptyWindows();break}case _.DELETE_TAB:{const e=this.idMap.get(t.data.node);e instanceof O&&e.delete(),this.removeEmptyWindows();break}case _.DELETE_TABSET:{const e=this.idMap.get(t.data.node);if(e instanceof M){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()}this.removeEmptyWindows();break}case _.POPOUT_TABSET:{const e=this.idMap.get(t.data.node);if(e instanceof M){const t=e.isMaximized(),i=this.windows.get(e.getWindowId()),n=S(),o=new B(n,i.toScreenRectFunction(e.getRect())),s={type:"row",children:[]},a=I.fromJson(s,this,o);o.root=a,this.windows.set(n,o),a.drop(e,g.CENTER,0),t&&(this.rootWindow.maximizedTabSet=void 0)}this.removeEmptyWindows();break}case _.POPOUT_TAB:{const e=this.idMap.get(t.data.node);if(e instanceof O){const t=S();let i=u.empty();i=e.getParent()instanceof M?e.getParent().getRect():e.getParent().getContentRect();const n=this.windows.get(e.getWindowId()),o=new B(t,n.toScreenRectFunction(i)),s=S(),a={type:"row",children:[{type:"tabset",id:s}]},r=I.fromJson(a,this,o);o.root=r,this.windows.set(t,o),this.idMap.get(s).drop(e,g.CENTER,0,!0)}this.removeEmptyWindows();break}case _.CLOSE_WINDOW:{const i=this.windows.get(t.data.windowId);i&&(null===(e=this.rootWindow.root)||void 0===e||e.drop(null==i?void 0:i.root,g.CENTER,-1),this.rootWindow.visitNodes(((t,e)=>{t instanceof I&&t.setWindowId(W.MAIN_WINDOW_ID)})),this.windows.delete(t.data.windowId));break}case _.CREATE_WINDOW:{const e=S(),n=new B(e,u.fromJson(t.data.rect)),o=I.fromJson(t.data.layout,this,n);n.root=o,this.windows.set(e,n),i=e;break}case _.RENAME_TAB:{const e=this.idMap.get(t.data.node);e instanceof O&&e.setName(t.data.text);break}case _.SELECT_TAB:{const e=this.idMap.get(t.data.tabNode),i=t.data.windowId?t.data.windowId:W.MAIN_WINDOW_ID,n=this.windows.get(i);if(e instanceof O){const t=e.getParent(),i=t.getChildren().indexOf(e);t instanceof F?t.getSelected()===i?t.setSelected(-1):t.setSelected(i):t instanceof M&&(t.getSelected()!==i&&t.setSelected(i),n.activeTabSet=t)}break}case _.SET_ACTIVE_TABSET:{const e=t.data.windowId?t.data.windowId:W.MAIN_WINDOW_ID,i=this.windows.get(e);if(void 0===t.data.tabsetNode)i.activeTabSet=void 0;else{const e=this.idMap.get(t.data.tabsetNode);e instanceof M&&(i.activeTabSet=e)}break}case _.ADJUST_WEIGHTS:{const e=this.idMap.get(t.data.nodeId).getChildren();for(let i=0;i<e.length;i++)e[i].setWeight(t.data.weights[i]);break}case _.ADJUST_BORDER_SPLIT:{const e=this.idMap.get(t.data.node);e instanceof F&&e.setSize(t.data.pos);break}case _.MAXIMIZE_TOGGLE:{const e=t.data.windowId?t.data.windowId:W.MAIN_WINDOW_ID,i=this.windows.get(e),n=this.idMap.get(t.data.node);n instanceof M&&(n===i.maximizedTabSet?i.maximizedTabSet=void 0:(i.maximizedTabSet=n,i.activeTabSet=n));break}case _.UPDATE_MODEL_ATTRIBUTES:this.updateAttrs(t.data.json);break;case _.UPDATE_NODE_ATTRIBUTES:this.idMap.get(t.data.node).updateAttrs(t.data.json)}this.updateIdMap();for(const e of this.changeListeners)e(t);return i}getActiveTabset(t=W.MAIN_WINDOW_ID){const e=this.windows.get(t);return e&&e.activeTabSet&&this.getNodeById(e.activeTabSet.getId())?e.activeTabSet:void 0}getMaximizedTabset(t=W.MAIN_WINDOW_ID){return this.windows.get(t).maximizedTabSet}getRoot(t=W.MAIN_WINDOW_ID){return this.windows.get(t).root}isRootOrientationVertical(){return this.attributes.rootOrientationVertical}isEnableRotateBorderIcons(){return this.attributes.enableRotateBorderIcons}getBorderSet(){return this.borders}getwindowsMap(){return this.windows}visitNodes(t){this.borders.forEachNode(t);for(const[e,i]of this.windows)i.root.forEachNode(t,0)}visitWindowNodes(t,e){this.windows.has(t)&&(t===W.MAIN_WINDOW_ID&&this.borders.forEachNode(e),this.windows.get(t).visitNodes(e))}getNodeById(t){return this.idMap.get(t)}getFirstTabSet(t=this.windows.get(W.MAIN_WINDOW_ID).root){const e=t.getChildren()[0];return e instanceof M?e:this.getFirstTabSet(e)}static fromJson(t){const e=new W;if(W.attributeDefinitions.fromJson(t.global,e.attributes),t.borders&&(e.borders=m.fromJson(t.borders,e)),t.popouts){let i=0,n=100,o=100;for(const s in t.popouts){const a=t.popouts[s],r=B.fromJson(a,e,s);e.windows.set(s,r),N(r.rect)||(r.rect=new u(n+50*i,o+50*i,600,400),i++)}}return e.rootWindow.root=I.fromJson(t.layout,e,e.getwindowsMap().get(W.MAIN_WINDOW_ID)),e.tidy(),e}toJson(){const t={};W.attributeDefinitions.toJson(t,this.attributes),this.visitNodes((t=>{t.fireEvent("save",{})}));const e={};for(const[t,i]of this.windows)t!==W.MAIN_WINDOW_ID&&(e[t]=i.toJson());return{global:t,borders:this.borders.toJson(),layout:this.rootWindow.root.toJson(),popouts:e}}getSplitterSize(){return this.attributes.splitterSize}getSplitterExtra(){return this.attributes.splitterExtra}isEnableEdgeDock(){return this.attributes.enableEdgeDock}isSplitterEnableHandle(){return this.attributes.splitterEnableHandle}setOnAllowDrop(t){this.onAllowDrop=t}setOnCreateTabSet(t){this.onCreateTabSet=t}addChangeListener(t){this.changeListeners.push(t)}removeChangeListener(t){const e=this.changeListeners.findIndex((e=>e===t));-1!==e&&this.changeListeners.splice(e,1)}toString(){return JSON.stringify(this.toJson())}removeEmptyWindows(){const t=new Set;for(const[e]of this.windows)if(e!==W.MAIN_WINDOW_ID){let i=0;this.visitWindowNodes(e,(t=>{t instanceof O&&i++})),0===i&&t.add(e)}for(const e of t)this.windows.delete(e)}setActiveTabset(t,e){const i=this.windows.get(e);i&&(i.activeTabSet=t||void 0)}setMaximizedTabset(t,e){const i=this.windows.get(e);i&&(i.maximizedTabSet=t||void 0)}updateIdMap(){this.idMap.clear(),this.visitNodes((t=>{this.idMap.set(t.getId(),t)}))}addNode(t){const e=t.getId();if(this.idMap.has(e))throw new Error(`Error: each node must have a unique id, duplicate id:${t.getId()}`);this.idMap.set(e,t)}findDropTargetNode(t,e,i,n){let o=this.windows.get(t).root.findDropTargetNode(t,e,i,n);return void 0===o&&t===W.MAIN_WINDOW_ID&&(o=this.borders.findDropTargetNode(e,i,n)),o}tidy(){for(const[t,e]of this.windows)e.root.tidy()}updateAttrs(t){W.attributeDefinitions.update(t,this.attributes)}nextUniqueId(){return"#"+S()}getAttribute(t){return this.attributes[t]}getOnAllowDrop(){return this.onAllowDrop}getOnCreateTabSet(){return this.onCreateTabSet}static toTypescriptInterfaces(){W.attributeDefinitions.pairAttributes("RowNode",I.getAttributeDefinitions()),W.attributeDefinitions.pairAttributes("TabSetNode",M.getAttributeDefinitions()),W.attributeDefinitions.pairAttributes("TabNode",O.getAttributeDefinitions()),W.attributeDefinitions.pairAttributes("BorderNode",F.getAttributeDefinitions());let t=[];t.push(W.attributeDefinitions.toTypescriptInterface("Global",void 0)),t.push(I.getAttributeDefinitions().toTypescriptInterface("Row",W.attributeDefinitions)),t.push(M.getAttributeDefinitions().toTypescriptInterface("TabSet",W.attributeDefinitions)),t.push(O.getAttributeDefinitions().toTypescriptInterface("Tab",W.attributeDefinitions)),t.push(F.getAttributeDefinitions().toTypescriptInterface("Border",W.attributeDefinitions)),console.log(t.join("\n"))}static createAttributeDefinitions(){const t=new E;return t.add("enableEdgeDock",!0).setType(p.BOOLEAN).setDescription("enable docking to the edges of the layout, this will show the edge indicators"),t.add("rootOrientationVertical",!1).setType(p.BOOLEAN).setDescription("the top level 'row' will layout horizontally by default, set this option true to make it layout vertically"),t.add("enableRotateBorderIcons",!0).setType(p.BOOLEAN).setDescription("boolean indicating if tab icons should rotate with the text in the left and right borders"),t.add("splitterSize",8).setType(p.NUMBER).setDescription("width in pixels of all splitters between tabsets/borders"),t.add("splitterExtra",0).setType(p.NUMBER).setDescription("additional width in pixels of the splitter hit test area"),t.add("splitterEnableHandle",!1).setType(p.BOOLEAN).setDescription("enable a small centralized handle on all splitters"),t.add("tabEnableClose",!0).setType(p.BOOLEAN),t.add("tabCloseType",1).setType("ICloseType"),t.add("tabEnablePopout",!1).setType(p.BOOLEAN).setAlias("tabEnableFloat"),t.add("tabEnablePopoutIcon",!0).setType(p.BOOLEAN),t.add("tabEnablePopoutOverlay",!1).setType(p.BOOLEAN),t.add("tabEnableDrag",!0).setType(p.BOOLEAN),t.add("tabEnableRename",!0).setType(p.BOOLEAN),t.add("tabContentClassName",void 0).setType(p.STRING),t.add("tabClassName",void 0).setType(p.STRING),t.add("tabIcon",void 0).setType(p.STRING),t.add("tabEnableRenderOnDemand",!0).setType(p.BOOLEAN),t.add("tabDragSpeed",.3).setType(p.NUMBER),t.add("tabBorderWidth",-1).setType(p.NUMBER),t.add("tabBorderHeight",-1).setType(p.NUMBER),t.add("tabSetEnableDeleteWhenEmpty",!0).setType(p.BOOLEAN),t.add("tabSetEnableDrop",!0).setType(p.BOOLEAN),t.add("tabSetEnableDrag",!0).setType(p.BOOLEAN),t.add("tabSetEnableDivide",!0).setType(p.BOOLEAN),t.add("tabSetEnableMaximize",!0).setType(p.BOOLEAN),t.add("tabSetEnableClose",!1).setType(p.BOOLEAN),t.add("tabSetEnableSingleTabStretch",!1).setType(p.BOOLEAN),t.add("tabSetAutoSelectTab",!0).setType(p.BOOLEAN),t.add("tabSetEnableActiveIcon",!1).setType(p.BOOLEAN),t.add("tabSetClassNameTabStrip",void 0).setType(p.STRING),t.add("tabSetEnableTabStrip",!0).setType(p.BOOLEAN),t.add("tabSetEnableTabWrap",!1).setType(p.BOOLEAN),t.add("tabSetTabLocation","top").setType("ITabLocation"),t.add("tabMinWidth",C).setType(p.NUMBER),t.add("tabMinHeight",C).setType(p.NUMBER),t.add("tabSetMinWidth",C).setType(p.NUMBER),t.add("tabSetMinHeight",C).setType(p.NUMBER),t.add("tabMaxWidth",U).setType(p.NUMBER),t.add("tabMaxHeight",U).setType(p.NUMBER),t.add("tabSetMaxWidth",U).setType(p.NUMBER),t.add("tabSetMaxHeight",U).setType(p.NUMBER),t.add("borderSize",200).setType(p.NUMBER),t.add("borderMinSize",C).setType(p.NUMBER),t.add("borderMaxSize",U).setType(p.NUMBER),t.add("borderEnableDrop",!0).setType(p.BOOLEAN),t.add("borderAutoSelectTabWhenOpen",!0).setType(p.BOOLEAN),t.add("borderAutoSelectTabWhenClosed",!1).setType(p.BOOLEAN),t.add("borderClassName",void 0).setType(p.STRING),t.add("borderEnableAutoHide",!1).setType(p.BOOLEAN),t}}W.MAIN_WINDOW_ID="__main_window_id__",W.attributeDefinitions=W.createAttributeDefinitions();class F extends f{static fromJson(t,e){const i=g.getByName(t.location),n=new F(i,t,e);return t.children&&(n.children=t.children.map((t=>{const i=O.fromJson(t,e);return i.setParent(n),i}))),n}constructor(t,e,i){super(i),this.outerRect=u.empty(),this.contentRect=u.empty(),this.tabHeaderRect=u.empty(),this.location=t,this.attributes.id=`border_${t.getName()}`,F.attributeDefinitions.fromJson(e,this.attributes),i.addNode(this)}getLocation(){return this.location}getClassName(){return this.getAttr("className")}isHorizontal(){return this.location.orientation===c.HORZ}getSize(){const t=this.getAttr("size"),e=this.getSelected();if(-1===e)return t;{const i=this.children[e],n=this.isHorizontal()?i.getAttr("borderWidth"):i.getAttr("borderHeight");return-1===n?t:n}}getMinSize(){const t=this.getSelectedNode();let e=this.getAttr("minSize");if(t){const i=this.isHorizontal()?t.getMinWidth():t.getMinHeight();e=Math.max(e,i)}return e}getMaxSize(){const t=this.getSelectedNode();let e=this.getAttr("maxSize");if(t){const i=this.isHorizontal()?t.getMaxWidth():t.getMaxHeight();e=Math.min(e,i)}return e}getSelected(){return this.attributes.selected}isAutoHide(){return this.getAttr("enableAutoHide")}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}toJson(){const t={};return F.attributeDefinitions.toJson(t,this.attributes),t.location=this.location.getName(),t.children=this.children.map((t=>t.toJson())),t}isAutoSelectTab(t){return null==t&&(t=-1!==this.getSelected()),t?this.getAttr("autoSelectTabWhenOpen"):this.getAttr("autoSelectTabWhenClosed")}setSelected(t){this.attributes.selected=t}getTabHeaderRect(){return this.tabHeaderRect}setTabHeaderRect(t){this.tabHeaderRect=t}getOuterRect(){return this.outerRect}setOuterRect(t){this.outerRect=t}getRect(){return this.tabHeaderRect}getContentRect(){return this.contentRect}setContentRect(t){this.contentRect=t}isEnableDrop(){return this.getAttr("enableDrop")}setSize(t){const e=this.getSelected();if(-1===e)this.attributes.size=t;else{const i=this.children[e];-1===(this.isHorizontal()?i.getAttr("borderWidth"):i.getAttr("borderHeight"))?this.attributes.size=t:this.isHorizontal()?i.setBorderWidth(t):i.setBorderHeight(t)}}updateAttrs(t){F.attributeDefinitions.update(t,this.attributes)}remove(t){const e=this.removeChild(t);-1!==this.getSelected()&&x(this,e)}canDrop(t,e,i){if(!(t instanceof O))return;let n;const o=g.CENTER;if(this.tabHeaderRect.contains(e,i)){if(this.location.orientation===c.VERT)if(this.children.length>0){let t=this.children[0],i=t.getTabRect();const s=i.y,a=i.height;let l=this.tabHeaderRect.x,d=0;for(let h=0;h<this.children.length;h++){if(t=this.children[h],i=t.getTabRect(),d=i.x+i.width/2,e>=l&&e<d){const t=new u(i.x-2,s,3,a);n=new b(this,t,o,h,r.FLEXLAYOUT__OUTLINE_RECT);break}l=d}if(null==n){const t=new u(i.getRight()-2,s,3,a);n=new b(this,t,o,this.children.length,r.FLEXLAYOUT__OUTLINE_RECT)}}else{const t=new u(this.tabHeaderRect.x+1,this.tabHeaderRect.y+2,3,18);n=new b(this,t,o,0,r.FLEXLAYOUT__OUTLINE_RECT)}else if(this.children.length>0){let t=this.children[0],e=t.getTabRect();const s=e.x,a=e.width;let l=this.tabHeaderRect.y,d=0;for(let h=0;h<this.children.length;h++){if(t=this.children[h],e=t.getTabRect(),d=e.y+e.height/2,i>=l&&i<d){const t=new u(s,e.y-2,a,3);n=new b(this,t,o,h,r.FLEXLAYOUT__OUTLINE_RECT);break}l=d}if(null==n){const t=new u(s,e.getBottom()-2,a,3);n=new b(this,t,o,this.children.length,r.FLEXLAYOUT__OUTLINE_RECT)}}else{const t=new u(this.tabHeaderRect.x+2,this.tabHeaderRect.y+1,18,3);n=new b(this,t,o,0,r.FLEXLAYOUT__OUTLINE_RECT)}if(!t.canDockInto(t,n))return}else if(-1!==this.getSelected()&&this.outerRect.contains(e,i)){const e=this.outerRect;if(n=new b(this,e,o,-1,r.FLEXLAYOUT__OUTLINE_RECT),!t.canDockInto(t,n))return}return n}drop(t,e,i,n){let o=0;const s=t.getParent();void 0!==s&&(o=s.removeChild(t),s!==this&&s instanceof F&&s.getSelected()===o?s.setSelected(-1):x(s,o)),t instanceof O&&s===this&&o<i&&i>0&&i--;let a=i;-1===a&&(a=this.children.length),t instanceof O&&this.addChild(t,a),(n||!1!==n&&this.isAutoSelectTab())&&this.setSelected(a),this.model.tidy()}getSplitterBounds(t,e=!1){const i=[0,0],n=e?this.getMinSize():0,o=e?this.getMaxSize():99999,s=this.model.getRoot(W.MAIN_WINDOW_ID),a=s.getRect(),r=this.model.getSplitterSize();if(this.location===g.TOP){i[0]=this.tabHeaderRect.getBottom()+n;const t=this.tabHeaderRect.getBottom()+o;i[1]=Math.max(i[0],a.getBottom()-s.getMinHeight()-r),i[1]=Math.min(i[1],t)}else if(this.location===g.LEFT){i[0]=this.tabHeaderRect.getRight()+n;const t=this.tabHeaderRect.getRight()+o;i[1]=Math.max(i[0],a.getRight()-s.getMinWidth()-r),i[1]=Math.min(i[1],t)}else if(this.location===g.BOTTOM){i[1]=this.tabHeaderRect.y-n-r;const t=this.tabHeaderRect.y-o-r;i[0]=Math.min(i[1],a.y+s.getMinHeight()),i[0]=Math.max(i[0],t)}else if(this.location===g.RIGHT){i[1]=this.tabHeaderRect.x-n-r;const t=this.tabHeaderRect.x-o-r;i[0]=Math.min(i[1],a.x+s.getMinWidth()),i[0]=Math.max(i[0],t)}return i}calculateSplit(t,e){const i=this.getSplitterBounds(e);return this.location===g.BOTTOM||this.location===g.RIGHT?Math.max(0,i[1]-e):Math.max(0,e-i[0])}getAttributeDefinitions(){return F.attributeDefinitions}static getAttributeDefinitions(){return F.attributeDefinitions}static createAttributeDefinitions(){const t=new E;return t.add("type",F.TYPE,!0).setType(p.STRING).setFixed(),t.add("selected",-1).setType(p.NUMBER).setDescription("index of selected/visible tab in border; -1 means no tab selected"),t.add("show",!0).setType(p.BOOLEAN).setDescription("show/hide this border"),t.add("config",void 0).setType("any").setDescription("a place to hold json config used in your own code"),t.addInherited("enableDrop","borderEnableDrop").setType(p.BOOLEAN).setDescription("whether tabs can be dropped into this border"),t.addInherited("className","borderClassName").setType(p.STRING).setDescription("class applied to tab button"),t.addInherited("autoSelectTabWhenOpen","borderAutoSelectTabWhenOpen").setType(p.BOOLEAN).setDescription("whether to select new/moved tabs in border when the border is already open"),t.addInherited("autoSelectTabWhenClosed","borderAutoSelectTabWhenClosed").setType(p.BOOLEAN).setDescription("whether to select new/moved tabs in border when the border is currently closed"),t.addInherited("size","borderSize").setType(p.NUMBER).setDescription("size of the tab area when selected"),t.addInherited("minSize","borderMinSize").setType(p.NUMBER).setDescription("the minimum size of the tab area"),t.addInherited("maxSize","borderMaxSize").setType(p.NUMBER).setDescription("the maximum size of the tab area"),t.addInherited("enableAutoHide","borderEnableAutoHide").setType(p.BOOLEAN).setDescription("hide border if it has zero tabs"),t}}F.TYPE="border",F.attributeDefinitions=F.createAttributeDefinitions();const Y=t=>{const{layout:e,node:i,index:n,horizontal:o}=t,[s,a]=l.useState(!1),d=l.useRef(null),h=l.useRef(null),g=l.useRef([]),T=l.useRef(void 0),p=l.useRef(void 0),E=l.useRef(0),b=l.useRef(0),m=l.useRef({initialSizes:[],sum:0,startPosition:0}),f=i.getModel().getSplitterSize();let O=i.getModel().getSplitterExtra();w()||(O=Math.max(30,O+f)-f),l.useEffect((()=>{var t,e;return null===(t=d.current)||void 0===t||t.addEventListener("touchstart",R,{passive:!1}),null===(e=h.current)||void 0===e||e.addEventListener("touchstart",R,{passive:!1}),()=>{var t,e;null===(t=d.current)||void 0===t||t.removeEventListener("touchstart",R),null===(e=h.current)||void 0===e||e.removeEventListener("touchstart",R)}}),[]);const R=t=>{t.preventDefault(),t.stopImmediatePropagation()},A=t=>{var s;t.stopPropagation(),i instanceof I&&(m.current=i.getSplitterInitials(n)),L(!1,e.getCurrentDocument()),function(t,e,i,n,o){e.preventDefault();const s=t=>{t.preventDefault(),i(t.clientX,t.clientY)},a=t=>{t.preventDefault(),o()},r=()=>{t.removeEventListener("pointermove",s),t.removeEventListener("pointerup",r),t.removeEventListener("pointercancel",a),n()};t.addEventListener("pointermove",s),t.addEventListener("pointerup",r),t.addEventListener("pointercancel",a)}(t.currentTarget.ownerDocument,t,v,N,y),g.current=i.getSplitterBounds(n,!0);const l=e.getRootDiv();T.current=e.getCurrentDocument().createElement("div"),T.current.style.flexDirection=o?"row":"column",T.current.className=e.getClassName(r.FLEXLAYOUT__SPLITTER_DRAG),T.current.style.cursor=i.getOrientation()===c.VERT?"ns-resize":"ew-resize",i.getModel().isSplitterEnableHandle()&&(p.current=e.getCurrentDocument().createElement("div"),p.current.className=S(r.FLEXLAYOUT__SPLITTER_HANDLE)+" "+S(o?r.FLEXLAYOUT__SPLITTER_HANDLE_HORZ:r.FLEXLAYOUT__SPLITTER_HANDLE_VERT),T.current.appendChild(p.current));const h=null===(s=d.current)||void 0===s?void 0:s.getBoundingClientRect(),_=new u(h.x-e.getDomRect().x,h.y-e.getDomRect().y,h.width,h.height);E.current=t.clientX-h.x,b.current=t.clientY-h.y,_.positionElement(T.current),l&&l.appendChild(T.current),a(!0)},y=()=>{const t=e.getRootDiv();t&&T.current&&t.removeChild(T.current),T.current=void 0,a(!1)},v=(t,n)=>{if(T.current){const o=e.getDomRect();if(!o)return;i.getOrientation()===c.VERT?T.current.style.top=x(n-o.y-b.current)+"px":T.current.style.left=x(t-o.x-E.current)+"px",e.isRealtimeResize()&&D(!0)}},N=()=>{if(T.current){D(!1);const t=e.getRootDiv();t&&T.current&&t.removeChild(T.current),T.current=void 0}L(!0,e.getCurrentDocument()),a(!1)},D=t=>{(()=>{if(T.current){let t=0;if(t=i.getOrientation()===c.VERT?T.current.offsetTop:T.current.offsetLeft,i instanceof F){const n=i.calculateSplit(i,t);e.doAction(_.adjustBorderSplit(i.getId(),n))}else{const o=m.current,s=i.calculateSplit(n,t,o.initialSizes,o.sum,o.startPosition);e.doAction(_.adjustWeights(i.getId(),s))}}})()},x=t=>{const e=g.current;let i=t;return t<e[0]&&(i=e[0]),t>e[1]&&(i=e[1]),i},S=e.getClassName,M={cursor:o?"ew-resize":"ns-resize",flexDirection:o?"column":"row"};let B,C=S(r.FLEXLAYOUT__SPLITTER)+" "+S(r.FLEXLAYOUT__SPLITTER_+i.getOrientation().getName());if(i instanceof F?C+=" "+S(r.FLEXLAYOUT__SPLITTER_BORDER):void 0!==i.getModel().getMaximizedTabset(e.getWindowId())&&(M.display="none"),o?(M.width=f+"px",M.minWidth=f+"px"):(M.height=f+"px",M.minHeight=f+"px"),!s&&i.getModel().isSplitterEnableHandle()&&(B=l.createElement("div",{className:S(r.FLEXLAYOUT__SPLITTER_HANDLE)+" "+S(o?r.FLEXLAYOUT__SPLITTER_HANDLE_HORZ:r.FLEXLAYOUT__SPLITTER_HANDLE_VERT)})),0===O)return l.createElement("div",{className:C,style:M,ref:d,"data-layout-path":i.getPath()+"/s"+(n-1),onPointerDown:A},B);{const t={};i.getOrientation()===c.HORZ?(t.height="100%",t.width=f+O+"px",t.cursor="ew-resize"):(t.height=f+O+"px",t.width="100%",t.cursor="ns-resize");const e=S(r.FLEXLAYOUT__SPLITTER_EXTRA);return l.createElement("div",{className:C,style:M,ref:d,"data-layout-path":i.getPath()+"/s"+(n-1),onPointerDown:A},l.createElement("div",{style:t,ref:h,className:e,onPointerDown:A}))}};function P(t){const{layout:e,border:i,show:n}=t,o=l.useRef(null);l.useLayoutEffect((()=>{const t=e.getBoundingClientRect(o.current),n=u.getContentRect(o.current).relativeTo(e.getDomRect());t.width>0&&(i.setOuterRect(t),i.getContentRect().equals(n)||(i.setContentRect(n),e.redrawInternal("border content rect")))}));let s=!0;const a={};i.getOrientation()===c.HORZ?(a.width=i.getSize(),a.minWidth=i.getMinSize(),a.maxWidth=i.getMaxSize()):(a.height=i.getSize(),a.minHeight=i.getMinSize(),a.maxHeight=i.getMaxSize(),s=!1),a.display=n?"flex":"none";const d=e.getClassName(r.FLEXLAYOUT__BORDER_TAB_CONTENTS);return i.getLocation()===g.LEFT||i.getLocation()===g.TOP?l.createElement(l.Fragment,null,l.createElement("div",{ref:o,style:a,className:d}),n&&l.createElement(Y,{layout:e,node:i,index:0,horizontal:s})):l.createElement(l.Fragment,null,n&&l.createElement(Y,{layout:e,node:i,index:0,horizontal:s}),l.createElement("div",{ref:o,style:a,className:d}))}var H;!function(t){t[t.Visible=1]="Visible",t[t.Always=2]="Always",t[t.Selected=3]="Selected"}(H||(H={}));const X=t=>{const{layout:e,node:i,selected:n,border:o,icons:s,path:d}=t,h=l.useRef(null),c=l.useRef(null),u=()=>{e.doAction(_.selectTab(i.getId()))},g=t=>{(()=>{const t=i.getCloseType();return!!(n||t===H.Always||t===H.Visible&&window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches)})()?e.doAction(_.deleteTab(i.getId())):u()},T=t=>{t.stopPropagation()};l.useLayoutEffect((()=>{i.setTabRect(e.getBoundingClientRect(h.current)),e.getEditingTab()===i&&c.current.select()}));const p=e.getClassName;let E=p(r.FLEXLAYOUT__BORDER_BUTTON)+" "+p(r.FLEXLAYOUT__BORDER_BUTTON_+o);E+=n?" "+p(r.FLEXLAYOUT__BORDER_BUTTON__SELECTED):" "+p(r.FLEXLAYOUT__BORDER_BUTTON__UNSELECTED),void 0!==i.getClassName()&&(E+=" "+i.getClassName());let b=0;!1===i.getModel().isEnableRotateBorderIcons()&&("left"===o?b=90:"right"===o&&(b=-90));const m=R(e,i,b);let f=m.content?l.createElement("div",{className:p(r.FLEXLAYOUT__BORDER_BUTTON_CONTENT)},m.content):null;const O=m.leading?l.createElement("div",{className:p(r.FLEXLAYOUT__BORDER_BUTTON_LEADING)},m.leading):null;if(e.getEditingTab()===i&&(f=l.createElement("input",{ref:c,className:p(r.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":d+"/textbox",type:"text",autoFocus:!0,defaultValue:i.getName(),onKeyDown:t=>{"Escape"===t.code?e.setEditingTab(void 0):"Enter"===t.code&&(e.setEditingTab(void 0),e.doAction(_.renameTab(i.getId(),t.target.value)))},onPointerDown:t=>{t.stopPropagation()}})),i.isEnableClose()){const t=e.i18nName(a.Close_Tab);m.buttons.push(l.createElement("div",{key:"close","data-layout-path":d+"/button/close",title:t,className:p(r.FLEXLAYOUT__BORDER_BUTTON_TRAILING),onPointerDown:T,onClick:g},"function"==typeof s.close?s.close(i):s.close))}return l.createElement("div",{ref:h,"data-layout-path":d,className:E,onClick:u,onAuxClick:t=>{A(t)&&e.auxMouseClick(i,t)},onContextMenu:t=>{e.showContextMenu(i,t)},title:i.getHelpText(),draggable:!0,onDragStart:t=>{i.isEnableDrag()?(t.stopPropagation(),e.setDragNode(t.nativeEvent,i)):t.preventDefault()},onDragEnd:t=>{t.stopPropagation(),e.clearDragMain()}},O,f,m.buttons)},z=t=>{const{layout:e,node:i}=t,n=e.getClassName;let o=n(r.FLEXLAYOUT__TAB_BUTTON_STAMP);const s=R(e,i);let a=s.content?l.createElement("div",{className:n(r.FLEXLAYOUT__TAB_BUTTON_CONTENT)},s.content):i.getNameForOverflowMenu();const d=s.leading?l.createElement("div",{className:n(r.FLEXLAYOUT__TAB_BUTTON_LEADING)},s.leading):null;return l.createElement("div",{className:o,title:i.getHelpText()},d,a)};function k(t,e,i,n){var o;const s=n.getRootDiv(),a=n.getClassName,d=t.ownerDocument,h=t.getBoundingClientRect(),c=null!==(o=null==s?void 0:s.getBoundingClientRect())&&void 0!==o?o:new DOMRect(0,0,100,100),u=d.createElement("div");u.className=a(r.FLEXLAYOUT__POPUP_MENU_CONTAINER),h.left<c.left+c.width/2?u.style.left=h.left-c.left+"px":u.style.right=c.right-h.right+"px",h.top<c.top+c.height/2?u.style.top=h.top-c.top+"px":u.style.bottom=c.bottom-h.bottom+"px",n.showOverlay(!0),s&&s.appendChild(u);const g=()=>{n.hideControlInPortal(),n.showOverlay(!1),s&&s.removeChild(u),u.removeEventListener("pointerdown",T),d.removeEventListener("pointerdown",_)},T=t=>{t.stopPropagation()},_=t=>{g()};u.addEventListener("pointerdown",T),d.addEventListener("pointerdown",_),n.showControlInPortal(l.createElement(G,{currentDocument:d,onSelect:i,onHide:g,items:e,classNameMapper:a,layout:n}),u)}const G=t=>{const{items:e,onHide:i,onSelect:n,classNameMapper:o,layout:s}=t,a=t=>{s.clearDragMain()},d=e.map(((t,e)=>l.createElement("div",{key:t.index,className:o(r.FLEXLAYOUT__POPUP_MENU_ITEM),"data-layout-path":"/popup-menu/tb"+e,onClick:e=>((t,e)=>{n(t),i(),e.stopPropagation()})(t,e),draggable:!0,onDragStart:e=>{return n=e,o=t.node,n.stopPropagation(),s.setDragNode(n.nativeEvent,o),void setTimeout((()=>{i()}),0);var n,o},onDragEnd:a,title:t.node.getHelpText()},l.createElement(z,{node:t.node,layout:s}))));return l.createElement("div",{className:o(r.FLEXLAYOUT__POPUP_MENU),"data-layout-path":"/popup-menu"},d)},V=(t,e,i,n)=>{const o=l.useRef(!0),s=l.useRef(!1),a=l.useRef(u.empty()),r=l.useRef(null),[d,h]=l.useState(0),g=l.useRef(!1),[T,_]=l.useState([]),p=l.useRef(0);l.useLayoutEffect((()=>{g.current=!1}),[t.getSelectedNode(),t.getRect().width,t.getRect().height]),l.useLayoutEffect((()=>{const e=t instanceof M?t.getRect():t.getTabHeaderRect();e.width>0&&e.height>0&&w()}));const E=i.current;l.useEffect((()=>{if(E)return E.addEventListener("wheel",b,{passive:!1}),()=>{E.removeEventListener("wheel",b)}}),[E]);const b=t=>{t.preventDefault()},m=t=>e===c.HORZ?t.x:t.y,f=t=>e===c.HORZ?t.getRight():t.getBottom(),O=t=>e===c.HORZ?t.width:t.height,w=()=>{!0===o.current&&(s.current=!1);const e=t instanceof M?t.getRect():t.getTabHeaderRect();let r=t.getChildren()[t.getChildren().length-1];const l=null===n.current?0:O(n.current.getBoundingClientRect());if(!0===o.current||0===p.current&&0!==T.length||e.width!==a.current.width||e.height!==a.current.height){p.current=T.length,a.current=e;const n=!(t instanceof M)||!0===t.isEnableTabStrip();let c=f(e)-l;if(null!==i.current&&(c-=O(i.current.getBoundingClientRect())),n&&t.getChildren().length>0){if(0===T.length&&0===d&&f(r.getTabRect())+2<c)return;let i=0;const n=t.getSelectedNode();if(n&&!g.current){const t=n.getTabRect(),o=m(t)-2,s=f(t)+2;O(t)+4>=c-m(e)?i=m(e)-o:(s>c||o<m(e))&&(o<m(e)&&(i=m(e)-o),s+i>c&&(i=c-s))}const a=Math.max(0,c-(f(r.getTabRect())+2+i)),l=Math.min(0,d+i+a),u=l-d,p=[];for(let i=0;i<t.getChildren().length;i++){const n=t.getChildren()[i];(m(n.getTabRect())+u<m(e)||f(n.getTabRect())+u>c)&&p.push({node:n,index:i})}s.current=p.length>0,o.current=!1,_(p),h(l)}}else o.current=!0};return{selfRef:r,position:d,userControlledLeft:g,hiddenTabs:T,onMouseWheel:t=>{let e=0;e=Math.abs(t.deltaX)>Math.abs(t.deltaY)?-t.deltaX:-t.deltaY,1===t.deltaMode&&(e*=40),h(d+e),g.current=!0,t.stopPropagation()},tabsTruncated:s.current}},J=t=>{const{border:e,layout:i,size:n}=t,o=l.useRef(null),s=l.useRef(null),d=l.useRef(null),h=i.getIcons();l.useLayoutEffect((()=>{e.setTabHeaderRect(u.getBoundingClientRect(T.current).relativeTo(i.getDomRect()))}));const{selfRef:T,position:p,userControlledLeft:E,hiddenTabs:b,onMouseWheel:m,tabsTruncated:f}=V(e,c.flip(e.getOrientation()),o,d),O=t=>{A(t)&&i.auxMouseClick(e,t)},w=t=>{t.stopPropagation()},R=t=>{const n=i.getShowOverflowMenu();void 0!==n?n(e,t,b,L):k(s.current,b,L,i),t.stopPropagation()},L=t=>{i.doAction(_.selectTab(t.node.getId())),E.current=!1},y=t=>{const n=e.getChildren()[e.getSelected()];void 0!==n&&i.doAction(_.popoutTab(n.getId())),t.stopPropagation()},v=i.getClassName,N=[],D=t=>{let n=e.getSelected()===t,o=e.getChildren()[t];N.push(l.createElement(X,{layout:i,border:e.getLocation().getName(),node:o,path:e.getPath()+"/tb"+t,key:o.getId(),selected:n,icons:h})),t<e.getChildren().length-1&&N.push(l.createElement("div",{key:"divider"+t,className:v(r.FLEXLAYOUT__BORDER_TAB_DIVIDER)}))};for(let t=0;t<e.getChildren().length;t++)D(t);let x=v(r.FLEXLAYOUT__BORDER)+" "+v(r.FLEXLAYOUT__BORDER_+e.getLocation().getName());void 0!==e.getClassName()&&(x+=" "+e.getClassName());let S=[],M=[];const I={buttons:S,stickyButtons:M,overflowPosition:void 0};if(i.customizeTabSet(e,I),S=I.buttons,void 0===I.overflowPosition&&(I.overflowPosition=M.length),M.length>0&&(f?S=[...M,...S]:N.push(l.createElement("div",{ref:d,key:"sticky_buttons_container",onPointerDown:w,onDragStart:t=>{t.preventDefault()},className:v(r.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER)},M))),b.length>0){const t=i.i18nName(a.Overflow_Menu_Tooltip);let n;n="function"==typeof h.more?h.more(e,b):l.createElement(l.Fragment,null,h.more,l.createElement("div",{className:v(r.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT)},b.length)),S.splice(Math.min(I.overflowPosition,S.length),0,l.createElement("button",{key:"overflowbutton",ref:s,className:v(r.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+" "+v(r.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW)+" "+v(r.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_+e.getLocation().getName()),title:t,onClick:R,onPointerDown:w},n))}const B=e.getSelected();if(-1!==B){const t=e.getChildren()[B];if(void 0!==t&&i.isSupportsPopout()&&t.isEnablePopout()){const e=i.i18nName(a.Popout_Tab);S.push(l.createElement("button",{key:"popout",title:e,className:v(r.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON)+" "+v(r.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT),onClick:y,onPointerDown:w},"function"==typeof h.popout?h.popout(t):h.popout))}}const C=l.createElement("div",{key:"toolbar",ref:o,className:v(r.FLEXLAYOUT__BORDER_TOOLBAR)+" "+v(r.FLEXLAYOUT__BORDER_TOOLBAR_+e.getLocation().getName())},S);let U={},W={};const F=n-1;return e.getLocation()===g.LEFT?(U={right:"100%",top:p},W={width:F}):e.getLocation()===g.RIGHT?(U={left:"100%",top:p},W={width:F}):(U={left:p},W={height:F}),l.createElement("div",{ref:T,style:{display:"flex",flexDirection:e.getOrientation()===c.VERT?"row":"column"},className:x,"data-layout-path":e.getPath(),onClick:O,onAuxClick:O,onContextMenu:t=>{i.showContextMenu(e,t)},onWheel:m},l.createElement("div",{style:W,className:v(r.FLEXLAYOUT__BORDER_INNER)+" "+v(r.FLEXLAYOUT__BORDER_INNER_+e.getLocation().getName())},l.createElement("div",{style:U,className:v(r.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER)+" "+v(r.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_+e.getLocation().getName())},N)),C)},Z=t=>{const{layout:e,node:i}=t,n=l.useRef(null);l.useEffect((()=>{i.setTabStamp(n.current)}),[i,n.current]);let o=(0,e.getClassName)(r.FLEXLAYOUT__DRAG_RECT);return l.createElement("div",{ref:n,className:o},l.createElement(z,{key:i.getId(),layout:e,node:i}))};class j extends l.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?l.createElement("div",{className:r.FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER},l.createElement("div",{className:r.FLEXLAYOUT__ERROR_BOUNDARY_CONTENT},this.props.message)):this.props.children}}const q=t=>{const{title:e,layout:i,layoutWindow:n,url:o,onCloseWindow:s,onSetWindow:a,children:h}=t,c=l.useRef(null),[u,g]=l.useState(void 0),T=new Map;return l.useLayoutEffect((()=>{if(!c.current){const t=n.windowId,i=n.rect;c.current=window.open(o,t,`left=${i.x},top=${i.y},width=${i.width},height=${i.height}`),c.current?(n.window=c.current,a(n,c.current),window.addEventListener("beforeunload",(()=>{if(c.current){const t=c.current;c.current=null,t.close()}})),c.current.addEventListener("load",(()=>{if(c.current){c.current.focus(),c.current.resizeTo(i.width,i.height),c.current.moveTo(i.x,i.y);const t=c.current.document;t.title=e;const o=t.createElement("div");o.className=r.FLEXLAYOUT__FLOATING_WINDOW_CONTENT,t.body.appendChild(o),function(t,e){const i=[],n=document.querySelectorAll('style, link[rel="stylesheet"]');for(const o of n)$(t,o,e,i);return Promise.all(i)}(t,T).then((()=>{g(o)}));const a=new MutationObserver((e=>function(t,e,i){for(const n of t)if("childList"===n.type){for(const t of n.addedNodes)(t instanceof HTMLLinkElement||t instanceof HTMLStyleElement)&&$(e,t,i);for(const t of n.removedNodes)if(t instanceof HTMLLinkElement||t instanceof HTMLStyleElement){const n=i.get(t);n&&e.head.removeChild(n)}}}(e,t,T)));a.observe(document.head,{childList:!0}),c.current.addEventListener("beforeunload",(()=>{c.current&&(s(n),c.current=null,a.disconnect())}))}}))):(console.warn(`Unable to open window ${o}`),s(n))}return()=>{var t;i.getModel().getwindowsMap().has(n.windowId)||(null===(t=c.current)||void 0===t||t.close(),c.current=null)}}),[]),void 0!==u?(0,d.createPortal)(h,u):null};function $(t,e,i,n){if(e instanceof HTMLLinkElement){const o=e.cloneNode(!0);t.head.appendChild(o),i.set(e,o),n&&n.push(new Promise((t=>{o.onload=()=>t(!0)})))}else if(e instanceof HTMLStyleElement)try{const n=e.cloneNode(!0);t.head.appendChild(n),i.set(e,n)}catch(t){}}const K={width:"1em",height:"1em",display:"flex",alignItems:"center"},Q=()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:K,viewBox:"0 0 24 24"},l.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),l.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"})),tt=t=>{const{layout:e,show:i}=t;return l.createElement("div",{className:e.getClassName(r.FLEXLAYOUT__LAYOUT_OVERLAY),style:{display:i?"flex":"none"}})},et=t=>{const{layout:e,node:i,selected:n,path:o}=t,s=l.useRef(null),d=l.useRef(null),h=e.getIcons();l.useLayoutEffect((()=>{i.setTabRect(e.getBoundingClientRect(s.current)),e.getEditingTab()===i&&d.current.select()}));const c=()=>{e.doAction(_.selectTab(i.getId()))},u=t=>{t.target!==d.current&&(e.getCurrentDocument().body.removeEventListener("pointerdown",u),e.setEditingTab(void 0))},g=t=>{(()=>{const t=i.getCloseType();return!!(n||t===H.Always||t===H.Visible&&window.matchMedia&&window.matchMedia("(hover: hover) and (pointer: fine)").matches)})()?e.doAction(_.deleteTab(i.getId())):c()},T=t=>{t.stopPropagation()},p=e.getClassName,E=i.getParent(),b=E.isEnableSingleTabStretch()&&1===E.getChildren().length;let m=b?r.FLEXLAYOUT__TAB_BUTTON_STRETCH:r.FLEXLAYOUT__TAB_BUTTON,f=p(m);f+=" "+p(m+"_"+E.getTabLocation()),b||(f+=n?" "+p(m+"--selected"):" "+p(m+"--unselected")),void 0!==i.getClassName()&&(f+=" "+i.getClassName());const O=R(e,i);let w=O.content?l.createElement("div",{className:p(r.FLEXLAYOUT__TAB_BUTTON_CONTENT)},O.content):null;const L=O.leading?l.createElement("div",{className:p(r.FLEXLAYOUT__TAB_BUTTON_LEADING)},O.leading):null;if(e.getEditingTab()===i&&(w=l.createElement("input",{ref:d,className:p(r.FLEXLAYOUT__TAB_BUTTON_TEXTBOX),"data-layout-path":o+"/textbox",type:"text",autoFocus:!0,defaultValue:i.getName(),onKeyDown:t=>{"Escape"===t.code?e.setEditingTab(void 0):"Enter"===t.code&&(e.setEditingTab(void 0),e.doAction(_.renameTab(i.getId(),t.target.value)))},onPointerDown:t=>{t.stopPropagation()}})),i.isEnableClose()&&!b){const t=e.i18nName(a.Close_Tab);O.buttons.push(l.createElement("div",{key:"close","data-layout-path":o+"/button/close",title:t,className:p(r.FLEXLAYOUT__TAB_BUTTON_TRAILING),onPointerDown:T,onClick:g},"function"==typeof h.close?h.close(i):h.close))}return l.createElement("div",{ref:s,"data-layout-path":o,className:f,onClick:c,onAuxClick:t=>{A(t)&&e.auxMouseClick(i,t)},onContextMenu:t=>{e.showContextMenu(i,t)},title:i.getHelpText(),draggable:!0,onDragStart:t=>{i.isEnableDrag()?(t.stopPropagation(),e.setDragNode(t.nativeEvent,i)):t.preventDefault()},onDragEnd:t=>{e.clearDragMain()},onDoubleClick:t=>{i.isEnableRename()&&(e.setEditingTab(i),e.getCurrentDocument().body.addEventListener("pointerdown",u),t.stopPropagation())}},L,w,O.buttons)},it=t=>{const{node:e,layout:i}=t,n=l.useRef(null),o=l.useRef(null),s=l.useRef(null),h=l.useRef(null),g=l.useRef(null),T=l.useRef(null),p=i.getIcons();l.useEffect((()=>{e.setRect(i.getBoundingClientRect(E.current)),n.current&&e.setTabStripRect(i.getBoundingClientRect(n.current));const t=u.getContentRect(s.current).relativeTo(i.getDomRect());e.getContentRect().equals(t)||(e.setContentRect(t),i.redrawInternal("tabset content rect "+t))}));const{selfRef:E,position:b,userControlledLeft:m,hiddenTabs:f,onMouseWheel:O,tabsTruncated:w}=V(e,c.HORZ,h,T),R=t=>{const n=i.getShowOverflowMenu();void 0!==n?n(e,t,f,L):k(g.current,f,L,i),t.stopPropagation()},L=t=>{i.doAction(_.selectTab(t.node.getId())),m.current=!1},y=t=>{i.getEditingTab()?t.preventDefault():e.isEnableDrag()?(t.stopPropagation(),i.setDragNode(t.nativeEvent,e)):t.preventDefault()},v=t=>{if(!A(t)){let t=e.getName();t=void 0===t?"":": "+t,i.doAction(_.setActiveTabset(e.getId(),i.getWindowId()))}},N=t=>{A(t)&&i.auxMouseClick(e,t)},D=t=>{i.showContextMenu(e,t)},x=t=>{t.stopPropagation()},S=t=>{e.canMaximize()&&i.maximize(e),t.stopPropagation()},M=t=>{i.doAction(_.deleteTabset(e.getId())),t.stopPropagation()},I=t=>{i.doAction(_.deleteTab(e.getChildren()[0].getId())),t.stopPropagation()},B=t=>{void 0!==W&&i.doAction(_.popoutTab(W.getId())),t.stopPropagation()},C=t=>{e.canMaximize()&&i.maximize(e)},U=i.getClassName;null!==o.current&&0!==o.current.scrollLeft&&(o.current.scrollLeft=0);const W=e.getSelectedNode(),F=e.getPath(),Y=[];if(e.isEnableTabStrip())for(let t=0;t<e.getChildren().length;t++){const n=e.getChildren()[t];let o=e.getSelected()===t;Y.push(l.createElement(et,{layout:i,node:n,path:F+"/tb"+t,key:n.getId(),selected:o})),t<e.getChildren().length-1&&Y.push(l.createElement("div",{key:"divider"+t,className:U(r.FLEXLAYOUT__TABSET_TAB_DIVIDER)}))}let P=[],H=[];const X={stickyButtons:P,buttons:H,overflowPosition:void 0};i.customizeTabSet(e,X),P=X.stickyButtons,H=X.buttons;const z=e.isEnableSingleTabStretch()&&1===e.getChildren().length,G=z&&e.getChildren()[0].isEnableClose()||e.isEnableClose();if(void 0===X.overflowPosition&&(X.overflowPosition=P.length),P.length>0&&(e.isEnableTabWrap()||!w&&!z?Y.push(l.createElement("div",{ref:T,key:"sticky_buttons_container",onPointerDown:x,onDragStart:t=>{t.preventDefault()},className:U(r.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER)},P)):H=[...P,...H]),!e.isEnableTabWrap()&&f.length>0){const t=i.i18nName(a.Overflow_Menu_Tooltip);let n;n="function"==typeof p.more?p.more(e,f):l.createElement(l.Fragment,null,p.more,l.createElement("div",{className:U(r.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT)},f.length)),H.splice(Math.min(X.overflowPosition,H.length),0,l.createElement("button",{key:"overflowbutton","data-layout-path":F+"/button/overflow",ref:g,className:U(r.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+U(r.FLEXLAYOUT__TAB_BUTTON_OVERFLOW),title:t,onClick:R,onPointerDown:x},n))}if(void 0!==W&&i.isSupportsPopout()&&W.isEnablePopout()&&W.isEnablePopoutIcon()){const t=i.i18nName(a.Popout_Tab);H.push(l.createElement("button",{key:"popout","data-layout-path":F+"/button/popout",title:t,className:U(r.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+U(r.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT),onClick:B,onPointerDown:x},"function"==typeof p.popout?p.popout(W):p.popout))}if(e.canMaximize()){const t=i.i18nName(a.Restore),n=i.i18nName(a.Maximize);H.push(l.createElement("button",{key:"max","data-layout-path":F+"/button/max",title:e.isMaximized()?t:n,className:U(r.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+U(r.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_+(e.isMaximized()?"max":"min")),onClick:S,onPointerDown:x},e.isMaximized()?"function"==typeof p.restore?p.restore(e):p.restore:"function"==typeof p.maximize?p.maximize(e):p.maximize))}if(!e.isMaximized()&&G){const t=z?i.i18nName(a.Close_Tab):i.i18nName(a.Close_Tabset);H.push(l.createElement("button",{key:"close","data-layout-path":F+"/button/close",title:t,className:U(r.FLEXLAYOUT__TAB_TOOLBAR_BUTTON)+" "+U(r.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE),onClick:z?I:M,onPointerDown:x},"function"==typeof p.closeTabset?p.closeTabset(e):p.closeTabset))}if(e.isActive()&&e.isEnableActiveIcon()){const t=i.i18nName(a.Active_Tabset);H.push(l.createElement("div",{key:"active","data-layout-path":F+"/button/active",title:t,className:U(r.FLEXLAYOUT__TAB_TOOLBAR_ICON)},"function"==typeof p.activeTabset?p.activeTabset(e):p.activeTabset))}const J=l.createElement("div",{key:"buttonbar",ref:h,className:U(r.FLEXLAYOUT__TAB_TOOLBAR),onPointerDown:x,onDragStart:t=>{t.preventDefault()}},H);let Z,j=U(r.FLEXLAYOUT__TABSET_TABBAR_OUTER);if(void 0!==e.getClassNameTabStrip()&&(j+=" "+e.getClassNameTabStrip()),j+=" "+r.FLEXLAYOUT__TABSET_TABBAR_OUTER_+e.getTabLocation(),e.isActive()&&(j+=" "+U(r.FLEXLAYOUT__TABSET_SELECTED)),e.isMaximized()&&(j+=" "+U(r.FLEXLAYOUT__TABSET_MAXIMIZED)),z){const t=e.getChildren()[0];void 0!==t.getTabSetClassName()&&(j+=" "+t.getTabSetClassName())}var q;if(e.isEnableTabWrap()?e.isEnableTabStrip()&&(Z=l.createElement("div",{className:j,style:{flexWrap:"wrap",gap:"1px",marginTop:"2px"},ref:n,"data-layout-path":F+"/tabstrip",onPointerDown:v,onDoubleClick:C,onContextMenu:D,onClick:N,onAuxClick:N,draggable:!0,onDragStart:y},Y,l.createElement("div",{style:{flexGrow:1}}),J)):e.isEnableTabStrip()&&(Z=l.createElement("div",{className:j,ref:n,"data-layout-path":F+"/tabstrip",onPointerDown:v,onDoubleClick:C,onContextMenu:D,onClick:N,onAuxClick:N,draggable:!0,onWheel:O,onDragStart:y},l.createElement("div",{ref:o,className:U(r.FLEXLAYOUT__TABSET_TABBAR_INNER)+" "+U(r.FLEXLAYOUT__TABSET_TABBAR_INNER_+e.getTabLocation())},l.createElement("div",{style:{left:b,width:z?"100%":"10000px"},className:U(r.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER)+" "+U(r.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_+e.getTabLocation())},Y)),J)),0===e.getChildren().length){const t=i.getTabSetPlaceHolderCallback();t&&(q=t(e))}let $=l.createElement("div",{ref:s,className:U(r.FLEXLAYOUT__TABSET_CONTENT)},q);$="top"===e.getTabLocation()?l.createElement(l.Fragment,null,Z,$):l.createElement(l.Fragment,null,$,Z);let K={flexGrow:Math.max(1,1e3*e.getWeight()),minWidth:e.getMinWidth(),minHeight:e.getMinHeight(),maxWidth:e.getMaxWidth(),maxHeight:e.getMaxHeight()};void 0===e.getModel().getMaximizedTabset(i.getWindowId())||e.isMaximized()||(K.display="none");const Q=l.createElement("div",{ref:E,className:U(r.FLEXLAYOUT__TABSET_CONTAINER),style:K},l.createElement("div",{className:U(r.FLEXLAYOUT__TABSET),"data-layout-path":F},$));return e.isMaximized()&&i.getMainElement()?(0,d.createPortal)(l.createElement("div",{style:{position:"absolute",display:"flex",top:0,left:0,bottom:0,right:0}},Q),i.getMainElement()):Q},nt=t=>{const{layout:e,node:i}=t,n=l.useRef(null),o=i.getOrientation()===c.HORZ;l.useLayoutEffect((()=>{i.setRect(e.getBoundingClientRect(n.current))}));const s=[];let a=0;for(const t of i.getChildren())a>0&&s.push(l.createElement(Y,{key:"splitter"+a,layout:e,node:i,index:a,horizontal:o})),t instanceof I?s.push(l.createElement(nt,{key:t.getId(),layout:e,node:t})):t instanceof M&&s.push(l.createElement(it,{key:t.getId(),layout:e,node:t})),a++;const d={flexGrow:Math.max(1,1e3*i.getWeight()),minWidth:i.getMinWidth(),minHeight:i.getMinHeight(),maxWidth:i.getMaxWidth(),maxHeight:i.getMaxHeight()};return d.flexDirection=o?"row":"column",l.createElement("div",{ref:n,className:e.getClassName(r.FLEXLAYOUT__ROW),style:d},s)},ot=t=>{const{layout:e,selected:i,node:n,path:o}=t,s=l.useRef(null),a=l.useRef(!0),d=n.getParent(),h=d.getContentRect();l.useLayoutEffect((()=>{const t=n.getMoveableElement();s.current.appendChild(t),n.setMoveableElement(t);const e=()=>{n.saveScrollPosition()};return t.addEventListener("scroll",e),s.current.addEventListener("pointerdown",c),()=>{t.removeEventListener("scroll",e),s.current&&s.current.removeEventListener("pointerdown",c),n.setVisible(!1)}}),[]),l.useEffect((()=>{n.isSelected()&&a.current&&(n.restoreScrollPosition(),a.current=!1)}));const c=()=>{const t=n.getParent();t instanceof M&&(t.isActive()||e.doAction(_.setActiveTabset(t.getId(),e.getWindowId())))};n.setRect(h);const u=e.getClassName,g={};h.styleWithPosition(g);let T=null;if(i){if(n.setVisible(!0),document.hidden&&n.isEnablePopoutOverlay()){const t={};h.styleWithPosition(t),T=l.createElement("div",{style:t,className:u(r.FLEXLAYOUT__TAB_OVERLAY)})}}else g.display="none",n.setVisible(!1);d instanceof M&&void 0!==n.getModel().getMaximizedTabset(e.getWindowId())&&(d.isMaximized()?g.zIndex=10:g.display="none");let p=u(r.FLEXLAYOUT__TAB);return d instanceof F&&(p+=" "+u(r.FLEXLAYOUT__TAB_BORDER),p+=" "+u(r.FLEXLAYOUT__TAB_BORDER_+d.getLocation().getName())),void 0!==n.getContentClassName()&&(p+=" "+n.getContentClassName()),l.createElement(l.Fragment,null,T,l.createElement("div",{ref:s,style:g,className:p,"data-layout-path":o}))},st=l.memo((({children:t})=>l.createElement(l.Fragment,null,t)),((t,e)=>t.rect.equalSize(e.rect)&&t.selected===e.selected&&t.forceRevision===e.forceRevision&&t.tabsRevision===e.tabsRevision));class at extends l.Component{constructor(t){super(t),this.selfRef=l.createRef(),this.revision=0}redraw(){this.selfRef.current.redraw("parent "+this.revision)}addTabToTabSet(t,e){return this.selfRef.current.addTabToTabSet(t,e)}addTabWithDragAndDrop(t,e,i){this.selfRef.current.addTabWithDragAndDrop(t,e,i)}moveTabWithDragAndDrop(t,e){this.selfRef.current.moveTabWithDragAndDrop(t,e)}addTabToActiveTabSet(t){return this.selfRef.current.addTabToActiveTabSet(t)}setDragComponent(t,e,i,n){this.selfRef.current.setDragComponent(t,e,i,n)}getRootDiv(){return this.selfRef.current.getRootDiv()}render(){return l.createElement(rt,Object.assign({ref:this.selfRef},this.props,{renderRevision:this.revision++}))}}class rt extends l.Component{constructor(t){super(t),this.moveableElementMap=new Map,this.dragEnterCount=0,this.dragging=!1,this.updateLayoutMetrics=()=>{if(this.findBorderBarSizeRef.current){const t=this.findBorderBarSizeRef.current.getBoundingClientRect().height;t!==this.state.calculatedBorderBarSize&&this.setState({calculatedBorderBarSize:t})}},this.onModelChange=t=>{this.redrawInternal("model change"),this.props.onModelChange&&this.props.onModelChange(this.props.model,t)},this.updateRect=()=>{const t=this.getDomRect();t.equals(this.state.rect)||0===t.width||0===t.height||(this.setState({rect:t}),this.windowId!==W.MAIN_WINDOW_ID&&this.redrawInternal("rect updated"))},this.getClassName=t=>void 0===this.props.classNameMapper?t:this.props.classNameMapper(t),this.onCloseWindow=t=>{this.doAction(_.closeWindow(t.windowId))},this.onSetWindow=(t,e)=>{},this.showControlInPortal=(t,e)=>{const i=(0,d.createPortal)(t,e);this.setState({portal:i})},this.hideControlInPortal=()=>{this.setState({portal:void 0})},this.getIcons=()=>this.icons,this.setDragNode=(t,e)=>{if(rt.dragState=new Tt(this.mainLayout,ht.Internal,e,void 0,void 0),t.dataTransfer.setData("text/plain","--flexlayout--"),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.dropEffect="move",this.dragEnterCount=0,e instanceof M){let i=!1,n=this.i18nName(a.Move_Tabset);if(e.getChildren().length>0&&(n=this.i18nName(a.Move_Tabs).replace("?",String(e.getChildren().length))),this.props.onRenderDragRect){const o=this.props.onRenderDragRect(n,e,void 0);o&&(this.setDragComponent(t,o,10,10),i=!0)}i||this.setDragComponent(t,n,10,10)}else{const i=t.target.getBoundingClientRect(),n=t.clientX-i.left,o=t.clientY-i.top,s=null==e?void 0:e.getParent(),a=s instanceof F&&s.getOrientation()===c.HORZ,r=a?10:n,d=a?10:o;let h=!1;if(this.props.onRenderDragRect){const i=l.createElement(z,{key:e.getId(),layout:this,node:e}),n=this.props.onRenderDragRect(i,e,void 0);n&&(this.setDragComponent(t,n,r,d),h=!0)}h||(function(){const t=navigator.userAgent;return t.includes("Safari")&&!t.includes("Chrome")&&!t.includes("Chromium")}()?this.setDragComponent(t,l.createElement(z,{node:e,layout:this}),r,d):t.dataTransfer.setDragImage(e.getTabStamp(),r,d))}},this.onDragEnterRaw=t=>{this.dragEnterCount++,1===this.dragEnterCount&&this.onDragEnter(t)},this.onDragLeaveRaw=t=>{this.dragEnterCount--,0===this.dragEnterCount&&this.onDragLeave(t)},this.onDragEnter=t=>{var e;if(!rt.dragState&&this.props.onExternalDrag){const e=this.props.onExternalDrag(t);if(e){const t=O.fromJson(e.json,this.props.model,!1);rt.dragState=new Tt(this.mainLayout,ht.External,t,e.json,e.onDrop)}}if(rt.dragState){if(this.windowId!==W.MAIN_WINDOW_ID&&rt.dragState.mainLayout===this.mainLayout&&rt.dragState.mainLayout.setDraggingOverWindow(!0),rt.dragState.mainLayout!==this.mainLayout)return;t.preventDefault(),this.dropInfo=void 0;const i=this.selfRef.current;this.outlineDiv=this.currentDocument.createElement("div"),this.outlineDiv.className=this.getClassName(r.FLEXLAYOUT__OUTLINE_RECT),this.outlineDiv.style.visibility="hidden";const n=this.props.model.getAttribute("tabDragSpeed");this.outlineDiv.style.transition=`top ${n}s, left ${n}s, width ${n}s, height ${n}s`,i.appendChild(this.outlineDiv),this.dragging=!0,this.showOverlay(!0),this.isDraggingOverWindow||void 0!==this.props.model.getMaximizedTabset(this.windowId)||this.setState({showEdges:this.props.model.isEnableEdgeDock()});const o=null===(e=this.selfRef.current)||void 0===e?void 0:e.getBoundingClientRect();new u(t.clientX-o.left,t.clientY-o.top,1,1).positionElement(this.outlineDiv)}},this.onDragOver=t=>{var e,i,n;if(this.dragging&&!this.isDraggingOverWindow){t.preventDefault();const o=null===(e=this.selfRef.current)||void 0===e?void 0:e.getBoundingClientRect(),s={x:t.clientX-(null!==(i=null==o?void 0:o.left)&&void 0!==i?i:0),y:t.clientY-(null!==(n=null==o?void 0:o.top)&&void 0!==n?n:0)};this.checkForBorderToShow(s.x,s.y);let a=this.props.model.findDropTargetNode(this.windowId,rt.dragState.dragNode,s.x,s.y);a&&(this.dropInfo=a,this.outlineDiv&&(this.outlineDiv.className=this.getClassName(a.className),a.rect.positionElement(this.outlineDiv),this.outlineDiv.style.visibility="visible"))}},this.onDragLeave=t=>{this.dragging&&(this.windowId!==W.MAIN_WINDOW_ID&&rt.dragState.mainLayout.setDraggingOverWindow(!1),this.clearDragLocal())},this.onDrop=t=>{if(this.dragging){t.preventDefault();const e=rt.dragState;if(this.dropInfo)if(void 0!==e.dragJson){const i=this.doAction(_.addNode(e.dragJson,this.dropInfo.node.getId(),this.dropInfo.location,this.dropInfo.index));void 0!==e.fnNewNodeDropped&&e.fnNewNodeDropped(i,t)}else void 0!==e.dragNode&&this.doAction(_.moveNode(e.dragNode.getId(),this.dropInfo.node.getId(),this.dropInfo.location,this.dropInfo.index));this.mainLayout.clearDragMain()}this.dragEnterCount=0},this.orderedIds=[],this.selfRef=l.createRef(),this.moveablesRef=l.createRef(),this.mainRef=l.createRef(),this.findBorderBarSizeRef=l.createRef(),this.supportsPopout=void 0!==t.supportsPopout?t.supportsPopout:ct,this.popoutURL=t.popoutURL?t.popoutURL:"popout.html",this.icons=Object.assign(Object.assign({},dt),t.icons),this.windowId=t.windowId?t.windowId:W.MAIN_WINDOW_ID,this.mainLayout=this.props.mainLayout?this.props.mainLayout:this,this.isDraggingOverWindow=!1,this.layoutWindow=this.props.model.getwindowsMap().get(this.windowId),this.layoutWindow.layout=this,this.popoutWindowName=this.props.popoutWindowName||"Popout Window",this.state={rect:u.empty(),editingTab:void 0,showEdges:!1,showOverlay:!1,calculatedBorderBarSize:29,layoutRevision:0,forceRevision:0,showHiddenBorder:g.CENTER},this.isMainWindow=this.windowId===W.MAIN_WINDOW_ID}componentDidMount(){if(this.updateRect(),this.currentDocument=this.selfRef.current.ownerDocument,this.currentWindow=this.currentDocument.defaultView,this.layoutWindow.window=this.currentWindow,this.layoutWindow.toScreenRectFunction=t=>this.getScreenRect(t),this.resizeObserver=new ResizeObserver((t=>{requestAnimationFrame((()=>{this.updateRect()}))})),this.selfRef.current&&this.resizeObserver.observe(this.selfRef.current),this.isMainWindow)this.props.model.addChangeListener(this.onModelChange),this.updateLayoutMetrics();else{this.currentWindow.addEventListener("resize",(()=>{this.updateRect()}));const t=this.props.mainLayout.getRootDiv(),e=this.selfRef.current;D(t,e),this.styleObserver=new MutationObserver((()=>{D(t,e)&&this.redraw("mutation observer")})),this.styleObserver.observe(t,{attributeFilter:["style"]})}document.addEventListener("visibilitychange",(()=>{for(const[t,e]of this.props.model.getwindowsMap())e.layout&&this.redraw("visibility change")}))}componentDidUpdate(){this.currentDocument=this.selfRef.current.ownerDocument,this.currentWindow=this.currentDocument.defaultView,this.isMainWindow&&(this.props.model!==this.previousModel&&(void 0!==this.previousModel&&this.previousModel.removeChangeListener(this.onModelChange),this.props.model.getwindowsMap().get(this.windowId).layout=this,this.props.model.addChangeListener(this.onModelChange),this.layoutWindow=this.props.model.getwindowsMap().get(this.windowId),this.layoutWindow.layout=this,this.layoutWindow.toScreenRectFunction=t=>this.getScreenRect(t),this.previousModel=this.props.model,this.tidyMoveablesMap()),this.updateLayoutMetrics())}componentWillUnmount(){var t,e;this.selfRef.current&&(null===(t=this.resizeObserver)||void 0===t||t.unobserve(this.selfRef.current)),null===(e=this.styleObserver)||void 0===e||e.disconnect()}render(){if(!this.selfRef.current)return l.createElement("div",{ref:this.selfRef,className:this.getClassName(r.FLEXLAYOUT__LAYOUT)},l.createElement("div",{ref:this.moveablesRef,key:"__moveables__",className:this.getClassName(r.FLEXLAYOUT__LAYOUT_MOVEABLES)}),this.renderMetricsElements());const t=this.props.model;t.getRoot(this.windowId).calcMinMaxSize(),t.getRoot(this.windowId).setPaths(""),t.getBorderSet().setPaths();const e=this.renderLayout(),i=this.renderBorders(e),n=this.renderTabs(),o=this.reorderComponents(n,this.orderedIds);let s=null,a=null,d=null,h=null;return this.isMainWindow&&(s=this.renderWindows(),h=this.renderMetricsElements(),a=this.renderTabMoveables(),d=l.createElement("div",{key:"__tabStamps__",className:this.getClassName(r.FLEXLAYOUT__LAYOUT_TAB_STAMPS)},this.renderTabStamps())),l.createElement("div",{ref:this.selfRef,className:this.getClassName(r.FLEXLAYOUT__LAYOUT),onDragEnter:this.onDragEnterRaw,onDragLeave:this.onDragLeaveRaw,onDragOver:this.onDragOver,onDrop:this.onDrop},l.createElement("div",{ref:this.moveablesRef,key:"__moveables__",className:this.getClassName(r.FLEXLAYOUT__LAYOUT_MOVEABLES)}),h,l.createElement(tt,{key:"__overlay__",layout:this,show:this.state.showOverlay}),i,o,a,d,this.state.portal,s)}renderBorders(t){const e=this.getClassName(r.FLEXLAYOUT__LAYOUT_MAIN),i=this.props.model.getBorderSet().getBorderMap();if(this.isMainWindow&&i.size>0){t=l.createElement("div",{className:e,ref:this.mainRef},t);const n=new Map,o=new Map;for(const[t,e]of g.values){const t=i.get(e);t&&(!t.isAutoHide()||t.isAutoHide()&&(t.getChildren().length>0||this.state.showHiddenBorder===e))&&(n.set(e,l.createElement(J,{layout:this,border:t,size:this.state.calculatedBorderBarSize})),o.set(e,l.createElement(P,{layout:this,border:t,show:-1!==t.getSelected()})))}const s=this.getClassName(r.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER),a=this.getClassName(r.FLEXLAYOUT__LAYOUT_BORDER_CONTAINER_INNER);if(this.props.model.getBorderSet().getLayoutHorizontal()){const e=l.createElement("div",{className:a,style:{flexDirection:"column"}},o.get(g.TOP),l.createElement("div",{className:a,style:{flexDirection:"row"}},o.get(g.LEFT),t,o.get(g.RIGHT)),o.get(g.BOTTOM));return l.createElement("div",{className:s,style:{flexDirection:"column"}},n.get(g.TOP),l.createElement("div",{className:a,style:{flexDirection:"row"}},n.get(g.LEFT),e,n.get(g.RIGHT)),n.get(g.BOTTOM))}{const e=l.createElement("div",{className:a,style:{flexDirection:"row"}},o.get(g.LEFT),l.createElement("div",{className:a,style:{flexDirection:"column"}},o.get(g.TOP),t,o.get(g.BOTTOM)),o.get(g.RIGHT));return l.createElement("div",{className:s,style:{flexDirection:"row"}},n.get(g.LEFT),l.createElement("div",{className:a,style:{flexDirection:"column"}},n.get(g.TOP),e,n.get(g.BOTTOM)),n.get(g.RIGHT))}}return l.createElement("div",{className:e,ref:this.mainRef,style:{position:"absolute",top:0,left:0,bottom:0,right:0,display:"flex"}},t)}renderLayout(){return l.createElement(l.Fragment,null,l.createElement(nt,{key:"__row__",layout:this,node:this.props.model.getRoot(this.windowId)}),this.renderEdgeIndicators())}renderEdgeIndicators(){const t=[],e=this.icons.edgeArrow;if(this.state.showEdges){const i=this.props.model.getRoot(this.windowId).getRect(),n=ut,o=gt,s=ut/2,a=this.getClassName(r.FLEXLAYOUT__EDGE_RECT),d=50;t.push(l.createElement("div",{key:"North",style:{top:0,left:i.width/2-s,width:n,height:o,borderBottomLeftRadius:d,borderBottomRightRadius:d},className:a+" "+this.getClassName(r.FLEXLAYOUT__EDGE_RECT_TOP)},l.createElement("div",{style:{transform:"rotate(180deg)"}},e))),t.push(l.createElement("div",{key:"West",style:{top:i.height/2-s,left:0,width:o,height:n,borderTopRightRadius:d,borderBottomRightRadius:d},className:a+" "+this.getClassName(r.FLEXLAYOUT__EDGE_RECT_LEFT)},l.createElement("div",{style:{transform:"rotate(90deg)"}},e))),t.push(l.createElement("div",{key:"South",style:{top:i.height-o,left:i.width/2-s,width:n,height:o,borderTopLeftRadius:d,borderTopRightRadius:d},className:a+" "+this.getClassName(r.FLEXLAYOUT__EDGE_RECT_BOTTOM)},l.createElement("div",null,e))),t.push(l.createElement("div",{key:"East",style:{top:i.height/2-s,left:i.width-o,width:o,height:n,borderTopLeftRadius:d,borderBottomLeftRadius:d},className:a+" "+this.getClassName(r.FLEXLAYOUT__EDGE_RECT_RIGHT)},l.createElement("div",{style:{transform:"rotate(-90deg)"}},e)))}return t}renderWindows(){const t=[];if(this.supportsPopout){const e=this.props.model.getwindowsMap();let i=1;for(const[n,o]of e)n!==W.MAIN_WINDOW_ID&&(t.push(l.createElement(q,{key:n,layout:this,title:this.popoutWindowName+" "+i,layoutWindow:o,url:this.popoutURL+"?id="+n,onSetWindow:this.onSetWindow,onCloseWindow:this.onCloseWindow},l.createElement(rt,Object.assign({},this.props,{windowId:n,mainLayout:this})))),i++)}return t}renderTabMoveables(){const t=[];return this.props.model.visitNodes((e=>{if(e instanceof O){const i=e,n=this.getMoveableElement(i.getId());i.setMoveableElement(n);const o=i.isSelected(),s=i.getParent().getContentRect(),r=i.isRendered()||(o||!i.isEnableRenderOnDemand())&&s.width>0&&s.height>0;if(r){const e=i.getId()+(i.isEnableWindowReMount()?i.getWindowId():"");t.push((0,d.createPortal)(l.createElement(st,{rect:s,selected:i.isSelected(),forceRevision:this.state.forceRevision,tabsRevision:this.props.renderRevision,key:e},l.createElement(j,{message:this.i18nName(a.Error_rendering_component)},this.props.factory(i))),n,e)),i.setRendered(r)}}})),t}renderTabStamps(){const t=[];return this.props.model.visitNodes((e=>{if(e instanceof O){const i=e;t.push(l.createElement(Z,{key:i.getId(),layout:this,node:i}))}})),t}renderTabs(){const t=new Map;return this.props.model.visitWindowNodes(this.windowId,(e=>{if(e instanceof O){const i=e,n=i.isSelected(),o=i.getPath();(i.isRendered()||n||!i.isEnableRenderOnDemand())&&t.set(i.getId(),l.createElement(ot,{key:i.getId(),layout:this,path:o,node:i,selected:n}))}})),t}renderMetricsElements(){return l.createElement("div",{key:"findBorderBarSize",ref:this.findBorderBarSizeRef,className:this.getClassName(r.FLEXLAYOUT__BORDER_SIZER)},"FindBorderBarSize")}checkForBorderToShow(t,e){const i=this.getBoundingClientRect(this.mainRef.current),n=i.getCenter(),o=gt,s=ut/2;let a=!1;this.props.model.isEnableEdgeDock()&&this.state.showHiddenBorder===g.CENTER&&(e>n.y-s&&e<n.y+s||t>n.x-s&&t<n.x+s)&&(a=!0);let r=g.CENTER;a||(t<=i.x+o?r=g.LEFT:t>=i.getRight()-o?r=g.RIGHT:e<=i.y+o?r=g.TOP:e>=i.getBottom()-o&&(r=g.BOTTOM)),r!==this.state.showHiddenBorder&&this.setState({showHiddenBorder:r})}tidyMoveablesMap(){const t=new Map;this.props.model.visitNodes(((e,i)=>{e instanceof O&&t.set(e.getId(),e)}));for(const[e,i]of this.moveableElementMap)t.has(e)||(i.remove(),this.moveableElementMap.delete(e))}reorderComponents(t,e){const i=[],n=new Set;let o=[];for(const o of e)t.get(o)&&(i.push(o),n.add(o));e.splice(0,e.length,...i);for(const[i,o]of t)n.has(i)||e.push(i);return o=e.map((e=>t.get(e))),o}redraw(t){this.mainLayout.setState(((t,e)=>({forceRevision:t.forceRevision+1})))}redrawInternal(t){this.mainLayout.setState(((t,e)=>({layoutRevision:t.layoutRevision+1})))}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)}getBoundingClientRect(t){const e=this.getDomRect();return e?u.getBoundingClientRect(t).relativeTo(e):u.empty()}getMoveableContainer(){return this.moveablesRef.current}getMoveableElement(t){let e=this.moveableElementMap.get(t);return void 0===e&&(e=document.createElement("div"),this.moveablesRef.current.appendChild(e),e.className=r.FLEXLAYOUT__TAB_MOVEABLE,this.moveableElementMap.set(t,e)),e}getMainLayout(){return this.mainLayout}getCurrentDocument(){return this.currentDocument}getDomRect(){return this.selfRef.current?u.fromDomRect(this.selfRef.current.getBoundingClientRect()):u.empty()}getWindowId(){return this.windowId}getRootDiv(){return this.selfRef.current}getMainElement(){return this.mainRef.current}getFactory(){return this.props.factory}isSupportsPopout(){return this.supportsPopout}isRealtimeResize(){var t;return null!==(t=this.props.realtimeResize)&&void 0!==t&&t}getPopoutURL(){return this.popoutURL}setEditingTab(t){this.setState({editingTab:t})}getEditingTab(){return this.state.editingTab}getModel(){return this.props.model}getScreenRect(t){const e=t.clone(),i=this.getDomRect();return e.x=this.currentWindow.screenX+this.currentWindow.scrollX+1+i.x+e.x,e.y=this.currentWindow.screenY+this.currentWindow.scrollY+59+i.y+e.y,e.height+=60,e.width+=2,e}addTabToTabSet(t,e){if(void 0!==this.props.model.getNodeById(t))return this.doAction(_.addNode(e,t,g.CENTER,-1))}addTabToActiveTabSet(t){const e=this.props.model.getActiveTabset(this.windowId);if(void 0!==e)return this.doAction(_.addNode(t,e.getId(),g.CENTER,-1))}maximize(t){this.doAction(_.maximizeToggle(t.getId(),this.getWindowId()))}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}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)}showOverlay(t){this.setState({showOverlay:t}),L(!t,this.currentDocument)}addTabWithDragAndDrop(t,e,i){const n=O.fromJson(e,this.props.model,!1);rt.dragState=new Tt(this.mainLayout,ht.Add,n,e,i)}moveTabWithDragAndDrop(t,e){this.setDragNode(t,e)}setDragComponent(t,e,i,n){let o=l.createElement("div",{style:{position:"unset"},className:this.getClassName(r.FLEXLAYOUT__LAYOUT)+" "+this.getClassName(r.FLEXLAYOUT__DRAG_RECT)},e);const s=this.currentDocument.createElement("div");s.setAttribute("data-layout-path","/drag-rectangle"),s.style.position="absolute",s.style.left="-10000px",s.style.top="-10000px",this.currentDocument.body.appendChild(s),(0,h.H)(s).render(o),t.dataTransfer.setDragImage(s,i,n),setTimeout((()=>{this.currentDocument.body.removeChild(s)}),0)}setDraggingOverWindow(t){this.isDraggingOverWindow!==t&&(this.outlineDiv&&(this.outlineDiv.style.visibility=t?"hidden":"visible"),t?this.setState({showEdges:!1}):void 0===this.props.model.getMaximizedTabset(this.windowId)&&this.setState({showEdges:this.props.model.isEnableEdgeDock()}),this.isDraggingOverWindow=t)}clearDragMain(){rt.dragState=void 0,this.windowId===W.MAIN_WINDOW_ID&&(this.isDraggingOverWindow=!1);for(const[,t]of this.props.model.getwindowsMap())t.layout.clearDragLocal()}clearDragLocal(){this.setState({showEdges:!1}),this.showOverlay(!1),this.dragEnterCount=0,this.dragging=!1,this.outlineDiv&&(this.selfRef.current.removeChild(this.outlineDiv),this.outlineDiv=void 0)}}rt.dragState=void 0;const lt="0.8.1",dt={close:l.createElement(Q,null),closeTabset:l.createElement(Q,null),popout:l.createElement((()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:K,viewBox:"0 0 20 20",fill:"var(--color-icon)"},l.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"}),l.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:l.createElement((()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:K,viewBox:"0 0 24 24",fill:"var(--color-icon)"},l.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),l.createElement("path",{stroke:"var(--color-icon)",d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"}))),null),restore:l.createElement((()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:K,viewBox:"0 0 24 24",fill:"var(--color-icon)"},l.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),l.createElement("path",{stroke:"var(--color-icon)",d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}))),null),more:l.createElement((()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:K,viewBox:"0 0 24 24",fill:"var(--color-icon)"},l.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),l.createElement("path",{stroke:"var(--color-icon)",d:"M7 10l5 5 5-5z"}))),null),edgeArrow:l.createElement((()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:{display:"block",width:10,height:10},preserveAspectRatio:"none",viewBox:"0 0 100 100"},l.createElement("path",{fill:"var(--color-edge-icon)",stroke:"var(--color-edge-icon)",d:"M10 30 L90 30 l-40 40 Z"}))),null),activeTabset:l.createElement((()=>l.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",style:K,height:"24px",viewBox:"0 -960 960 960",width:"24px"},l.createElement("path",{fill:"var(--color-icon)",stroke:"var(--color-icon)",d:"M440-120v-264L254-197l-57-57 187-186H120v-80h264L197-706l57-57 186 187v-264h80v264l186-187 57 57-187 186h264v80H576l187 186-57 57-186-187v264h-80Z"}))),null)};var ht;!function(t){t.Internal="internal",t.External="external",t.Add="add"}(ht||(ht={}));const ct=w(),ut=100,gt=10;class Tt{constructor(t,e,i,n,o){this.mainLayout=t,this.dragSource=e,this.dragNode=i,this.dragJson=n,this.fnNewNodeDropped=o}}return s})()));