dockview-core 5.1.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/cjs/api/component.api.d.ts +93 -1
- package/dist/cjs/api/component.api.js +146 -0
- package/dist/cjs/api/dockviewGroupPanelApi.d.ts +26 -0
- package/dist/cjs/api/dockviewGroupPanelApi.js +21 -1
- package/dist/cjs/api/entryPoints.js +4 -5
- package/dist/cjs/array.js +7 -8
- package/dist/cjs/dnd/dataTransfer.d.ts +2 -1
- package/dist/cjs/dnd/dataTransfer.js +5 -4
- package/dist/cjs/dnd/droptarget.d.ts +12 -0
- package/dist/cjs/dnd/droptarget.js +38 -10
- package/dist/cjs/dnd/ghost.js +1 -2
- package/dist/cjs/dockview/components/panel/content.js +5 -1
- package/dist/cjs/dockview/components/popupService.d.ts +9 -2
- package/dist/cjs/dockview/components/popupService.js +24 -9
- package/dist/cjs/dockview/components/tab/tab.d.ts +8 -1
- package/dist/cjs/dockview/components/tab/tab.js +94 -6
- package/dist/cjs/dockview/components/titlebar/tabGroupChip.d.ts +30 -0
- package/dist/cjs/dockview/components/titlebar/tabGroupChip.js +95 -0
- package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.d.ts +71 -0
- package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.js +471 -0
- package/dist/cjs/dockview/components/titlebar/tabGroups.d.ts +57 -0
- package/dist/cjs/dockview/components/titlebar/tabGroups.js +612 -0
- package/dist/cjs/dockview/components/titlebar/tabOverflowControl.js +1 -2
- package/dist/cjs/dockview/components/titlebar/tabs.d.ts +67 -0
- package/dist/cjs/dockview/components/titlebar/tabs.js +1464 -34
- package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts +6 -0
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js +132 -14
- package/dist/cjs/dockview/contextMenu.d.ts +10 -0
- package/dist/cjs/dockview/contextMenu.js +298 -0
- package/dist/cjs/dockview/dockviewComponent.d.ts +60 -3
- package/dist/cjs/dockview/dockviewComponent.js +712 -126
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +83 -0
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +619 -27
- package/dist/cjs/dockview/dockviewShell.d.ts +128 -0
- package/dist/cjs/dockview/dockviewShell.js +681 -0
- package/dist/cjs/dockview/events.d.ts +9 -0
- package/dist/cjs/dockview/framework.d.ts +14 -0
- package/dist/cjs/dockview/options.d.ts +97 -2
- package/dist/cjs/dockview/options.js +10 -5
- package/dist/cjs/dockview/tabGroup.d.ts +99 -0
- package/dist/cjs/dockview/tabGroup.js +219 -0
- package/dist/cjs/dockview/tabGroupAccent.d.ts +65 -0
- package/dist/cjs/dockview/tabGroupAccent.js +128 -0
- package/dist/cjs/dockview/theme.d.ts +56 -1
- package/dist/cjs/dockview/theme.js +103 -6
- package/dist/cjs/dockview/types.d.ts +2 -0
- package/dist/cjs/dom.js +19 -19
- package/dist/cjs/events.js +2 -2
- package/dist/cjs/gridview/baseComponentGridview.d.ts +1 -0
- package/dist/cjs/gridview/baseComponentGridview.js +6 -3
- package/dist/cjs/gridview/gridview.js +7 -7
- package/dist/cjs/index.d.ts +8 -5
- package/dist/cjs/index.js +6 -1
- package/dist/cjs/popoutWindow.js +3 -3
- package/dist/cjs/splitview/splitviewPanel.d.ts +1 -1
- package/dist/dockview-core.js +5188 -729
- package/dist/dockview-core.min.js +2 -2
- package/dist/dockview-core.min.js.map +1 -1
- package/dist/dockview-core.min.noStyle.js +2 -2
- package/dist/dockview-core.min.noStyle.js.map +1 -1
- package/dist/dockview-core.noStyle.js +5186 -727
- package/dist/esm/api/component.api.d.ts +93 -1
- package/dist/esm/api/component.api.js +118 -0
- package/dist/esm/api/dockviewGroupPanelApi.d.ts +26 -0
- package/dist/esm/api/dockviewGroupPanelApi.js +21 -1
- package/dist/esm/dnd/dataTransfer.d.ts +2 -1
- package/dist/esm/dnd/dataTransfer.js +2 -1
- package/dist/esm/dnd/droptarget.d.ts +12 -0
- package/dist/esm/dnd/droptarget.js +33 -5
- package/dist/esm/dockview/components/panel/content.js +5 -1
- package/dist/esm/dockview/components/popupService.d.ts +9 -2
- package/dist/esm/dockview/components/popupService.js +23 -9
- package/dist/esm/dockview/components/tab/tab.d.ts +8 -1
- package/dist/esm/dockview/components/tab/tab.js +96 -6
- package/dist/esm/dockview/components/titlebar/tabGroupChip.d.ts +30 -0
- package/dist/esm/dockview/components/titlebar/tabGroupChip.js +68 -0
- package/dist/esm/dockview/components/titlebar/tabGroupIndicator.d.ts +71 -0
- package/dist/esm/dockview/components/titlebar/tabGroupIndicator.js +354 -0
- package/dist/esm/dockview/components/titlebar/tabGroups.d.ts +57 -0
- package/dist/esm/dockview/components/titlebar/tabGroups.js +406 -0
- package/dist/esm/dockview/components/titlebar/tabs.d.ts +67 -0
- package/dist/esm/dockview/components/titlebar/tabs.js +1212 -25
- package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts +6 -0
- package/dist/esm/dockview/components/titlebar/tabsContainer.js +105 -7
- package/dist/esm/dockview/contextMenu.d.ts +10 -0
- package/dist/esm/dockview/contextMenu.js +213 -0
- package/dist/esm/dockview/dockviewComponent.d.ts +60 -3
- package/dist/esm/dockview/dockviewComponent.js +460 -35
- package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +83 -0
- package/dist/esm/dockview/dockviewGroupPanelModel.js +460 -4
- package/dist/esm/dockview/dockviewShell.d.ts +128 -0
- package/dist/esm/dockview/dockviewShell.js +621 -0
- package/dist/esm/dockview/events.d.ts +9 -0
- package/dist/esm/dockview/framework.d.ts +14 -0
- package/dist/esm/dockview/options.d.ts +97 -2
- package/dist/esm/dockview/options.js +5 -0
- package/dist/esm/dockview/tabGroup.d.ts +99 -0
- package/dist/esm/dockview/tabGroup.js +144 -0
- package/dist/esm/dockview/tabGroupAccent.d.ts +65 -0
- package/dist/esm/dockview/tabGroupAccent.js +116 -0
- package/dist/esm/dockview/theme.d.ts +56 -1
- package/dist/esm/dockview/theme.js +102 -5
- package/dist/esm/dockview/types.d.ts +2 -0
- package/dist/esm/dom.js +1 -1
- package/dist/esm/gridview/baseComponentGridview.d.ts +1 -0
- package/dist/esm/gridview/baseComponentGridview.js +4 -1
- package/dist/esm/index.d.ts +8 -5
- package/dist/esm/index.js +2 -1
- package/dist/esm/popoutWindow.js +1 -1
- package/dist/esm/splitview/splitviewPanel.d.ts +1 -1
- package/dist/package/main.cjs.js +5182 -753
- package/dist/package/main.cjs.min.js +2 -2
- package/dist/package/main.esm.min.mjs +2 -2
- package/dist/package/main.esm.mjs +5168 -753
- package/dist/styles/dockview.css +1968 -195
- package/package.json +5 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-core
|
|
3
|
-
* @version
|
|
3
|
+
* @version 6.0.0
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var e;!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}('.dv-scrollable {\n position: relative;\n overflow: hidden;\n}\n.dv-scrollable .dv-scrollbar {\n position: absolute;\n border-radius: 2px;\n background-color: transparent;\n /* GPU optimizations */\n will-change: background-color, transform;\n transform: translate3d(0, 0, 0);\n backface-visibility: hidden;\n transition-property: background-color;\n transition-timing-function: ease-in-out;\n transition-duration: 1s;\n transition-delay: 0s;\n}\n.dv-scrollable .dv-scrollbar-horizontal {\n bottom: 0px;\n left: 0px;\n height: 4px;\n}\n.dv-scrollable .dv-scrollbar-vertical {\n right: 0px;\n top: 0px;\n width: 4px;\n}\n.dv-scrollable:hover .dv-scrollbar, .dv-scrollable.dv-scrollable-resizing .dv-scrollbar, .dv-scrollable.dv-scrollable-scrolling .dv-scrollbar {\n background-color: var(--dv-scrollbar-background-color, rgba(255, 255, 255, 0.25));\n}\n.dv-svg {\n display: inline-block;\n fill: currentcolor;\n line-height: 1;\n stroke: currentcolor;\n stroke-width: 0;\n}\n.dockview-theme-dark {\n --dv-paneview-active-outline-color: dodgerblue;\n --dv-tabs-and-actions-container-font-size: 13px;\n --dv-tabs-and-actions-container-height: 35px;\n --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);\n --dv-drag-over-border-color: transparent;\n --dv-tabs-container-scrollbar-color: #888;\n --dv-icon-hover-background-color: rgba(90, 93, 94, 0.31);\n --dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, 0.5);\n --dv-overlay-z-index: 999;\n --dv-tab-font-size: inherit;\n --dv-border-radius: 0px;\n --dv-tab-margin: 0;\n --dv-sash-color: transparent;\n --dv-active-sash-color: transparent;\n --dv-active-sash-transition-duration: 0.1s;\n --dv-active-sash-transition-delay: 0.5s;\n --dv-group-view-background-color: #1e1e1e;\n --dv-tabs-and-actions-container-background-color: #252526;\n --dv-activegroup-visiblepanel-tab-background-color: #1e1e1e;\n --dv-activegroup-hiddenpanel-tab-background-color: #2d2d2d;\n --dv-inactivegroup-visiblepanel-tab-background-color: #1e1e1e;\n --dv-inactivegroup-hiddenpanel-tab-background-color: #2d2d2d;\n --dv-tab-divider-color: #1e1e1e;\n --dv-activegroup-visiblepanel-tab-color: white;\n --dv-activegroup-hiddenpanel-tab-color: #969696;\n --dv-inactivegroup-visiblepanel-tab-color: #8f8f8f;\n --dv-inactivegroup-hiddenpanel-tab-color: #626262;\n --dv-separator-border: rgb(68, 68, 68);\n --dv-paneview-header-border-color: rgba(204, 204, 204, 0.2);\n}\n.dockview-theme-dark .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed {\n opacity: 0;\n transition: none;\n}\n\n.dockview-theme-light {\n --dv-paneview-active-outline-color: dodgerblue;\n --dv-tabs-and-actions-container-font-size: 13px;\n --dv-tabs-and-actions-container-height: 35px;\n --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);\n --dv-drag-over-border-color: transparent;\n --dv-tabs-container-scrollbar-color: #888;\n --dv-icon-hover-background-color: rgba(90, 93, 94, 0.31);\n --dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, 0.5);\n --dv-overlay-z-index: 999;\n --dv-tab-font-size: inherit;\n --dv-border-radius: 0px;\n --dv-tab-margin: 0;\n --dv-sash-color: transparent;\n --dv-active-sash-color: transparent;\n --dv-active-sash-transition-duration: 0.1s;\n --dv-active-sash-transition-delay: 0.5s;\n --dv-group-view-background-color: white;\n --dv-tabs-and-actions-container-background-color: #f3f3f3;\n --dv-activegroup-visiblepanel-tab-background-color: white;\n --dv-activegroup-hiddenpanel-tab-background-color: #ececec;\n --dv-inactivegroup-visiblepanel-tab-background-color: white;\n --dv-inactivegroup-hiddenpanel-tab-background-color: #ececec;\n --dv-tab-divider-color: white;\n --dv-activegroup-visiblepanel-tab-color: rgb(51, 51, 51);\n --dv-activegroup-hiddenpanel-tab-color: rgba(51, 51, 51, 0.7);\n --dv-inactivegroup-visiblepanel-tab-color: rgba(51, 51, 51, 0.7);\n --dv-inactivegroup-hiddenpanel-tab-color: rgba(51, 51, 51, 0.35);\n --dv-separator-border: rgba(128, 128, 128, 0.35);\n --dv-paneview-header-border-color: rgb(51, 51, 51);\n --dv-scrollbar-background-color: rgba(0, 0, 0, 0.25);\n}\n.dockview-theme-light .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed {\n opacity: 0;\n transition: none;\n}\n\n.dockview-theme-vs {\n --dv-paneview-active-outline-color: dodgerblue;\n --dv-tabs-and-actions-container-font-size: 13px;\n --dv-tabs-and-actions-container-height: 35px;\n --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);\n --dv-drag-over-border-color: transparent;\n --dv-tabs-container-scrollbar-color: #888;\n --dv-icon-hover-background-color: rgba(90, 93, 94, 0.31);\n --dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, 0.5);\n --dv-overlay-z-index: 999;\n --dv-tab-font-size: inherit;\n --dv-border-radius: 0px;\n --dv-tab-margin: 0;\n --dv-sash-color: transparent;\n --dv-active-sash-color: transparent;\n --dv-active-sash-transition-duration: 0.1s;\n --dv-active-sash-transition-delay: 0.5s;\n --dv-group-view-background-color: #1e1e1e;\n --dv-tabs-and-actions-container-background-color: #252526;\n --dv-activegroup-visiblepanel-tab-background-color: #1e1e1e;\n --dv-activegroup-hiddenpanel-tab-background-color: #2d2d2d;\n --dv-inactivegroup-visiblepanel-tab-background-color: #1e1e1e;\n --dv-inactivegroup-hiddenpanel-tab-background-color: #2d2d2d;\n --dv-tab-divider-color: #1e1e1e;\n --dv-activegroup-visiblepanel-tab-color: white;\n --dv-activegroup-hiddenpanel-tab-color: #969696;\n --dv-inactivegroup-visiblepanel-tab-color: #8f8f8f;\n --dv-inactivegroup-hiddenpanel-tab-color: #626262;\n --dv-separator-border: rgb(68, 68, 68);\n --dv-paneview-header-border-color: rgba(204, 204, 204, 0.2);\n --dv-tabs-and-actions-container-background-color: #2d2d30;\n --dv-tabs-and-actions-container-height: 20px;\n --dv-tabs-and-actions-container-font-size: 11px;\n --dv-activegroup-visiblepanel-tab-background-color: #007acc;\n --dv-inactivegroup-visiblepanel-tab-background-color: #3f3f46;\n --dv-activegroup-visiblepanel-tab-color: white;\n --dv-activegroup-hiddenpanel-tab-color: white;\n --dv-inactivegroup-visiblepanel-tab-color: white;\n --dv-inactivegroup-hiddenpanel-tab-color: white;\n}\n.dockview-theme-vs .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed {\n opacity: 0;\n transition: none;\n}\n.dockview-theme-vs .dv-groupview.dv-active-group > .dv-tabs-and-actions-container {\n box-sizing: content-box;\n border-bottom: 2px solid var(--dv-activegroup-visiblepanel-tab-background-color);\n}\n.dockview-theme-vs .dv-groupview.dv-active-group > .dv-tabs-and-actions-container .dv-tab.dv-active-tab {\n border-top: 2px solid var(--dv-activegroup-visiblepanel-tab-background-color);\n}\n.dockview-theme-vs .dv-groupview.dv-active-group > .dv-tabs-and-actions-container .dv-tab.dv-inactive-tab {\n border-top: 2px solid var(--dv-activegroup-hiddenpanel-tab-background-color);\n}\n.dockview-theme-vs .dv-groupview.dv-inactive-group > .dv-tabs-and-actions-container {\n box-sizing: content-box;\n border-bottom: 2px solid var(--dv-inactivegroup-visiblepanel-tab-background-color);\n}\n.dockview-theme-vs .dv-groupview.dv-inactive-group > .dv-tabs-and-actions-container .dv-tab.dv-active-tab {\n border-top: 2px solid var(--dv-inactivegroup-visiblepanel-tab-background-color);\n}\n.dockview-theme-vs .dv-groupview.dv-inactive-group > .dv-tabs-and-actions-container .dv-tab.dv-inactive-tab {\n border-top: 2px solid var(--dv-inactivegroup-hiddenpanel-tab-background-color);\n}\n\n.dockview-theme-abyss {\n --dv-paneview-active-outline-color: dodgerblue;\n --dv-tabs-and-actions-container-font-size: 13px;\n --dv-tabs-and-actions-container-height: 35px;\n --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);\n --dv-drag-over-border-color: transparent;\n --dv-tabs-container-scrollbar-color: #888;\n --dv-icon-hover-background-color: rgba(90, 93, 94, 0.31);\n --dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, 0.5);\n --dv-overlay-z-index: 999;\n --dv-tab-font-size: inherit;\n --dv-border-radius: 0px;\n --dv-tab-margin: 0;\n --dv-sash-color: transparent;\n --dv-active-sash-color: transparent;\n --dv-active-sash-transition-duration: 0.1s;\n --dv-active-sash-transition-delay: 0.5s;\n --dv-color-abyss-dark: #000c18;\n --dv-color-abyss: #10192c;\n --dv-color-abyss-light: #1c1c2a;\n --dv-color-abyss-lighter: #2b2b4a;\n --dv-color-abyss-accent: rgb(91, 30, 207);\n --dv-color-abyss-primary-text: white;\n --dv-color-abyss-secondary-text: rgb(148, 151, 169);\n --dv-group-view-background-color: var(--dv-color-abyss-dark);\n --dv-tabs-and-actions-container-background-color: var(\n --dv-color-abyss-light\n );\n --dv-activegroup-visiblepanel-tab-background-color: var(\n --dv-color-abyss-dark\n );\n --dv-activegroup-hiddenpanel-tab-background-color: var(--dv-color-abyss);\n --dv-inactivegroup-visiblepanel-tab-background-color: var(\n --dv-color-abyss-dark\n );\n --dv-inactivegroup-hiddenpanel-tab-background-color: var(--dv-color-abyss);\n --dv-tab-divider-color: var(--dv-color-abyss-lighter);\n --dv-activegroup-visiblepanel-tab-color: white;\n --dv-activegroup-hiddenpanel-tab-color: rgba(255, 255, 255, 0.5);\n --dv-inactivegroup-visiblepanel-tab-color: rgba(255, 255, 255, 0.5);\n --dv-inactivegroup-hiddenpanel-tab-color: rgba(255, 255, 255, 0.25);\n --dv-separator-border: var(--dv-color-abyss-lighter);\n --dv-paneview-header-border-color: var(--dv-color-abyss-lighter);\n --dv-paneview-active-outline-color: #596f99;\n}\n.dockview-theme-abyss .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed {\n opacity: 0;\n transition: none;\n}\n\n.dockview-theme-dracula {\n --dv-paneview-active-outline-color: dodgerblue;\n --dv-tabs-and-actions-container-font-size: 13px;\n --dv-tabs-and-actions-container-height: 35px;\n --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);\n --dv-drag-over-border-color: transparent;\n --dv-tabs-container-scrollbar-color: #888;\n --dv-icon-hover-background-color: rgba(90, 93, 94, 0.31);\n --dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, 0.5);\n --dv-overlay-z-index: 999;\n --dv-tab-font-size: inherit;\n --dv-border-radius: 0px;\n --dv-tab-margin: 0;\n --dv-sash-color: transparent;\n --dv-active-sash-color: transparent;\n --dv-active-sash-transition-duration: 0.1s;\n --dv-active-sash-transition-delay: 0.5s;\n --dv-group-view-background-color: #282a36;\n --dv-tabs-and-actions-container-background-color: #191a21;\n --dv-activegroup-visiblepanel-tab-background-color: #282a36;\n --dv-activegroup-hiddenpanel-tab-background-color: #21222c;\n --dv-inactivegroup-visiblepanel-tab-background-color: #282a36;\n --dv-inactivegroup-hiddenpanel-tab-background-color: #21222c;\n --dv-tab-divider-color: #191a21;\n --dv-activegroup-visiblepanel-tab-color: rgb(248, 248, 242);\n --dv-activegroup-hiddenpanel-tab-color: rgb(98, 114, 164);\n --dv-inactivegroup-visiblepanel-tab-color: rgba(248, 248, 242, 0.5);\n --dv-inactivegroup-hiddenpanel-tab-color: rgba(98, 114, 164, 0.5);\n --dv-separator-border: #bd93f9;\n --dv-paneview-header-border-color: #bd93f9;\n --dv-paneview-active-outline-color: #6272a4;\n}\n.dockview-theme-dracula .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed {\n opacity: 0;\n transition: none;\n}\n.dockview-theme-dracula .dv-groupview.dv-active-group > .dv-tabs-and-actions-container .dv-tabs-container > .dv-tab.dv-active-tab {\n position: relative;\n}\n.dockview-theme-dracula .dv-groupview.dv-active-group > .dv-tabs-and-actions-container .dv-tabs-container > .dv-tab.dv-active-tab::after {\n position: absolute;\n left: 0px;\n top: 0px;\n content: "";\n width: 100%;\n height: 1px;\n background-color: #94527e;\n z-index: 999;\n}\n.dockview-theme-dracula .dv-groupview.dv-inactive-group > .dv-tabs-and-actions-container .dv-tabs-container > .dv-tab.dv-active-tab {\n position: relative;\n}\n.dockview-theme-dracula .dv-groupview.dv-inactive-group > .dv-tabs-and-actions-container .dv-tabs-container > .dv-tab.dv-active-tab::after {\n position: absolute;\n left: 0px;\n bottom: 0px;\n content: "";\n width: 100%;\n height: 1px;\n background-color: #5e3d5a;\n z-index: 999;\n}\n\n.dockview-theme-replit {\n --dv-paneview-active-outline-color: dodgerblue;\n --dv-tabs-and-actions-container-font-size: 13px;\n --dv-tabs-and-actions-container-height: 35px;\n --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);\n --dv-drag-over-border-color: transparent;\n --dv-tabs-container-scrollbar-color: #888;\n --dv-icon-hover-background-color: rgba(90, 93, 94, 0.31);\n --dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, 0.5);\n --dv-overlay-z-index: 999;\n --dv-tab-font-size: inherit;\n --dv-border-radius: 0px;\n --dv-tab-margin: 0;\n --dv-sash-color: transparent;\n --dv-active-sash-color: transparent;\n --dv-active-sash-transition-duration: 0.1s;\n --dv-active-sash-transition-delay: 0.5s;\n box-sizing: border-box;\n padding: 10px;\n background-color: #ebeced;\n --dv-group-view-background-color: #ebeced;\n --dv-tabs-and-actions-container-background-color: #fcfcfc;\n --dv-activegroup-visiblepanel-tab-background-color: #f0f1f2;\n --dv-activegroup-hiddenpanel-tab-background-color: #fcfcfc;\n --dv-inactivegroup-visiblepanel-tab-background-color: #f0f1f2;\n --dv-inactivegroup-hiddenpanel-tab-background-color: #fcfcfc;\n --dv-tab-divider-color: transparent;\n --dv-activegroup-visiblepanel-tab-color: rgb(51, 51, 51);\n --dv-activegroup-hiddenpanel-tab-color: rgb(51, 51, 51);\n --dv-inactivegroup-visiblepanel-tab-color: rgb(51, 51, 51);\n --dv-inactivegroup-hiddenpanel-tab-color: rgb(51, 51, 51);\n --dv-separator-border: transparent;\n --dv-paneview-header-border-color: rgb(51, 51, 51);\n --dv-sash-color: #cfd1d3;\n --dv-active-sash-color: #babbbb;\n}\n.dockview-theme-replit .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed {\n opacity: 0;\n transition: none;\n}\n.dockview-theme-replit .dv-resize-container:has(> .dv-groupview) {\n border-radius: 8px;\n}\n.dockview-theme-replit .dv-resize-container {\n border-radius: 10px !important;\n border: none;\n}\n.dockview-theme-replit .dv-groupview {\n overflow: hidden;\n border-radius: 10px;\n}\n.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container {\n border-bottom: 1px solid rgba(128, 128, 128, 0.35);\n}\n.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container .dv-tab {\n margin: 4px;\n border-radius: 8px;\n}\n.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container .dv-tab .dv-svg {\n height: 8px;\n width: 8px;\n}\n.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container .dv-tab:hover {\n background-color: #e4e5e6 !important;\n}\n.dockview-theme-replit .dv-groupview .dv-content-container {\n background-color: #fcfcfc;\n}\n.dockview-theme-replit .dv-groupview.dv-active-group {\n border: 1px solid rgba(128, 128, 128, 0.35);\n}\n.dockview-theme-replit .dv-groupview.dv-inactive-group {\n border: 1px solid transparent;\n}\n.dockview-theme-replit .dv-vertical > .dv-sash-container > .dv-sash {\n background-color: transparent;\n}\n.dockview-theme-replit .dv-vertical > .dv-sash-container > .dv-sash:not(.disabled)::after {\n content: "";\n height: 4px;\n width: 40px;\n border-radius: 2px;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n background-color: var(--dv-sash-color);\n position: absolute;\n}\n.dockview-theme-replit .dv-vertical > .dv-sash-container > .dv-sash:not(.disabled):hover, .dockview-theme-replit .dv-vertical > .dv-sash-container > .dv-sash:not(.disabled):active {\n background-color: transparent;\n}\n.dockview-theme-replit .dv-vertical > .dv-sash-container > .dv-sash:not(.disabled):hover::after, .dockview-theme-replit .dv-vertical > .dv-sash-container > .dv-sash:not(.disabled):active::after {\n background-color: var(--dv-active-sash-color);\n}\n.dockview-theme-replit .dv-horizontal > .dv-sash-container > .dv-sash {\n background-color: transparent;\n}\n.dockview-theme-replit .dv-horizontal > .dv-sash-container > .dv-sash:not(.disabled)::after {\n content: "";\n height: 40px;\n width: 4px;\n border-radius: 2px;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n background-color: var(--dv-sash-color);\n position: absolute;\n}\n.dockview-theme-replit .dv-horizontal > .dv-sash-container > .dv-sash:not(.disabled):hover, .dockview-theme-replit .dv-horizontal > .dv-sash-container > .dv-sash:not(.disabled):active {\n background-color: transparent;\n}\n.dockview-theme-replit .dv-horizontal > .dv-sash-container > .dv-sash:not(.disabled):hover::after, .dockview-theme-replit .dv-horizontal > .dv-sash-container > .dv-sash:not(.disabled):active::after {\n background-color: var(--dv-active-sash-color);\n}\n\n.dockview-theme-abyss-spaced {\n --dv-paneview-active-outline-color: dodgerblue;\n --dv-tabs-and-actions-container-font-size: 13px;\n --dv-tabs-and-actions-container-height: 35px;\n --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);\n --dv-drag-over-border-color: transparent;\n --dv-tabs-container-scrollbar-color: #888;\n --dv-icon-hover-background-color: rgba(90, 93, 94, 0.31);\n --dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, 0.5);\n --dv-overlay-z-index: 999;\n --dv-tab-font-size: inherit;\n --dv-border-radius: 0px;\n --dv-tab-margin: 0;\n --dv-sash-color: transparent;\n --dv-active-sash-color: transparent;\n --dv-active-sash-transition-duration: 0.1s;\n --dv-active-sash-transition-delay: 0.5s;\n --dv-tab-font-size: 12px;\n --dv-border-radius: 20px;\n --dv-tab-margin: 0.5rem 0.25rem;\n --dv-tabs-and-actions-container-height: 44px;\n --dv-border-radius: 20px;\n box-sizing: border-box;\n --dv-color-abyss-dark: rgb(11, 6, 17);\n --dv-color-abyss: #16121f;\n --dv-color-abyss-light: #201d2b;\n --dv-color-abyss-lighter: #2a2837;\n --dv-color-abyss-accent: rgb(91, 30, 207);\n --dv-color-abyss-primary-text: white;\n --dv-color-abyss-secondary-text: rgb(148, 151, 169);\n --dv-drag-over-border: 2px solid var(--dv-color-abyss-accent);\n --dv-drag-over-background-color: "";\n --dv-group-view-background-color: var(--dv-color-abyss-dark);\n --dv-tabs-and-actions-container-background-color: var(--dv-color-abyss);\n --dv-activegroup-visiblepanel-tab-background-color: var(\n --dv-color-abyss-lighter\n );\n --dv-activegroup-hiddenpanel-tab-background-color: var(\n --dv-color-abyss-light\n );\n --dv-inactivegroup-visiblepanel-tab-background-color: var(\n --dv-color-abyss-lighter\n );\n --dv-inactivegroup-hiddenpanel-tab-background-color: var(\n --dv-color-abyss-light\n );\n --dv-tab-divider-color: transparent;\n --dv-activegroup-visiblepanel-tab-color: var(--dv-color-abyss-primary-text);\n --dv-activegroup-hiddenpanel-tab-color: var(\n --dv-color-abyss-secondary-text\n );\n --dv-inactivegroup-visiblepanel-tab-color: var(\n --dv-color-abyss-primary-text\n );\n --dv-inactivegroup-hiddenpanel-tab-color: var(\n --dv-color-abyss-secondary-text\n );\n --dv-separator-border: transparent;\n --dv-paneview-header-border-color: rgb(51, 51, 51);\n --dv-active-sash-color: var(--dv-color-abyss-accent);\n --dv-floating-box-shadow: 8px 8px 8px 0px rgba(0, 0, 0, 0.5);\n padding: 10px;\n background-color: var(--dv-color-abyss-dark);\n}\n.dockview-theme-abyss-spaced .dv-resize-container:has(> .dv-groupview) {\n border-radius: 8px;\n}\n.dockview-theme-abyss-spaced .dv-sash {\n border-radius: 4px;\n}\n.dockview-theme-abyss-spaced .dv-drop-target-anchor {\n border-radius: calc(var(--dv-border-radius) / 4);\n}\n.dockview-theme-abyss-spaced .dv-drop-target-anchor.dv-drop-target-content {\n border-radius: var(--dv-border-radius);\n}\n.dockview-theme-abyss-spaced .dv-resize-container {\n border-radius: var(--dv-border-radius) !important;\n border: none;\n}\n.dockview-theme-abyss-spaced .dv-tabs-overflow-container,\n.dockview-theme-abyss-spaced .dv-tabs-overflow-dropdown-default {\n border-radius: 8px;\n height: unset !important;\n}\n.dockview-theme-abyss-spaced .dv-tab {\n border-radius: 8px;\n}\n.dockview-theme-abyss-spaced .dv-tab .dv-svg {\n height: 8px;\n width: 8px;\n}\n.dockview-theme-abyss-spaced .dv-groupview {\n border-radius: var(--dv-border-radius);\n}\n.dockview-theme-abyss-spaced .dv-groupview .dv-tabs-and-actions-container {\n padding: 0px calc(var(--dv-border-radius) / 2);\n}\n.dockview-theme-abyss-spaced .dv-groupview .dv-content-container {\n background-color: var(--dv-tabs-and-actions-container-background-color);\n}\n.dockview-theme-abyss-spaced .dv-resize-container .dv-groupview {\n border: 2px solid var(--dv-color-abyss-dark);\n}\n\n.dockview-theme-light-spaced {\n --dv-paneview-active-outline-color: dodgerblue;\n --dv-tabs-and-actions-container-font-size: 13px;\n --dv-tabs-and-actions-container-height: 35px;\n --dv-drag-over-background-color: rgba(83, 89, 93, 0.5);\n --dv-drag-over-border-color: transparent;\n --dv-tabs-container-scrollbar-color: #888;\n --dv-icon-hover-background-color: rgba(90, 93, 94, 0.31);\n --dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, 0.5);\n --dv-overlay-z-index: 999;\n --dv-tab-font-size: inherit;\n --dv-border-radius: 0px;\n --dv-tab-margin: 0;\n --dv-sash-color: transparent;\n --dv-active-sash-color: transparent;\n --dv-active-sash-transition-duration: 0.1s;\n --dv-active-sash-transition-delay: 0.5s;\n --dv-tab-font-size: 12px;\n --dv-border-radius: 20px;\n --dv-tab-margin: 0.5rem 0.25rem;\n --dv-tabs-and-actions-container-height: 44px;\n --dv-border-radius: 20px;\n box-sizing: border-box;\n --dv-drag-over-border: 2px solid rgb(91, 30, 207);\n --dv-drag-over-background-color: "";\n --dv-group-view-background-color: #f6f5f9;\n --dv-tabs-and-actions-container-background-color: white;\n --dv-activegroup-visiblepanel-tab-background-color: #ededf0;\n --dv-activegroup-hiddenpanel-tab-background-color: #f9f9fa;\n --dv-inactivegroup-visiblepanel-tab-background-color: #ededf0;\n --dv-inactivegroup-hiddenpanel-tab-background-color: #f9f9fa;\n --dv-tab-divider-color: transparent;\n --dv-activegroup-visiblepanel-tab-color: rgb(104, 107, 130);\n --dv-activegroup-hiddenpanel-tab-color: rgb(148, 151, 169);\n --dv-inactivegroup-visiblepanel-tab-color: rgb(104, 107, 130);\n --dv-inactivegroup-hiddenpanel-tab-color: rgb(148, 151, 169);\n --dv-separator-border: transparent;\n --dv-paneview-header-border-color: rgb(51, 51, 51);\n --dv-active-sash-color: rgb(91, 30, 207);\n --dv-floating-box-shadow: 8px 8px 8px 0px rgba(0, 0, 0, 0.1);\n padding: 10px;\n background-color: #f6f5f9;\n --dv-scrollbar-background-color: rgba(0, 0, 0, 0.25);\n}\n.dockview-theme-light-spaced .dv-resize-container:has(> .dv-groupview) {\n border-radius: 8px;\n}\n.dockview-theme-light-spaced .dv-sash {\n border-radius: 4px;\n}\n.dockview-theme-light-spaced .dv-drop-target-anchor {\n border-radius: calc(var(--dv-border-radius) / 4);\n}\n.dockview-theme-light-spaced .dv-drop-target-anchor.dv-drop-target-content {\n border-radius: var(--dv-border-radius);\n}\n.dockview-theme-light-spaced .dv-resize-container {\n border-radius: var(--dv-border-radius) !important;\n border: none;\n}\n.dockview-theme-light-spaced .dv-tabs-overflow-container,\n.dockview-theme-light-spaced .dv-tabs-overflow-dropdown-default {\n border-radius: 8px;\n height: unset !important;\n}\n.dockview-theme-light-spaced .dv-tab {\n border-radius: 8px;\n}\n.dockview-theme-light-spaced .dv-tab .dv-svg {\n height: 8px;\n width: 8px;\n}\n.dockview-theme-light-spaced .dv-groupview {\n border-radius: var(--dv-border-radius);\n}\n.dockview-theme-light-spaced .dv-groupview .dv-tabs-and-actions-container {\n padding: 0px calc(var(--dv-border-radius) / 2);\n}\n.dockview-theme-light-spaced .dv-groupview .dv-content-container {\n background-color: var(--dv-tabs-and-actions-container-background-color);\n}\n.dockview-theme-light-spaced .dv-resize-container .dv-groupview {\n border: 2px solid rgba(255, 255, 255, 0.1);\n}\n.dv-drop-target-container {\n position: absolute;\n z-index: 9999;\n top: 0px;\n left: 0px;\n height: 100%;\n width: 100%;\n pointer-events: none;\n overflow: hidden;\n --dv-transition-duration: 300ms;\n}\n.dv-drop-target-container .dv-drop-target-anchor {\n position: relative;\n border: var(--dv-drag-over-border);\n background-color: var(--dv-drag-over-background-color);\n opacity: 1;\n /* GPU optimizations */\n will-change: transform, opacity;\n transform: translate3d(0, 0, 0);\n backface-visibility: hidden;\n contain: layout paint;\n transition: opacity var(--dv-transition-duration) ease-in, transform var(--dv-transition-duration) ease-out;\n}\n.dv-drop-target {\n position: relative;\n --dv-transition-duration: 70ms;\n}\n.dv-drop-target > .dv-drop-target-dropzone {\n position: absolute;\n left: 0px;\n top: 0px;\n height: 100%;\n width: 100%;\n z-index: 1000;\n pointer-events: none;\n}\n.dv-drop-target > .dv-drop-target-dropzone > .dv-drop-target-selection {\n position: relative;\n box-sizing: border-box;\n height: 100%;\n width: 100%;\n border: var(--dv-drag-over-border);\n background-color: var(--dv-drag-over-background-color);\n transition: top var(--dv-transition-duration) ease-out, left var(--dv-transition-duration) ease-out, width var(--dv-transition-duration) ease-out, height var(--dv-transition-duration) ease-out, opacity var(--dv-transition-duration) ease-out;\n will-change: transform;\n pointer-events: none;\n}\n.dv-drop-target > .dv-drop-target-dropzone > .dv-drop-target-selection.dv-drop-target-top.dv-drop-target-small-vertical {\n border-top: 1px solid var(--dv-drag-over-border-color);\n}\n.dv-drop-target > .dv-drop-target-dropzone > .dv-drop-target-selection.dv-drop-target-bottom.dv-drop-target-small-vertical {\n border-bottom: 1px solid var(--dv-drag-over-border-color);\n}\n.dv-drop-target > .dv-drop-target-dropzone > .dv-drop-target-selection.dv-drop-target-left.dv-drop-target-small-horizontal {\n border-left: 1px solid var(--dv-drag-over-border-color);\n}\n.dv-drop-target > .dv-drop-target-dropzone > .dv-drop-target-selection.dv-drop-target-right.dv-drop-target-small-horizontal {\n border-right: 1px solid var(--dv-drag-over-border-color);\n}\n.dv-dockview {\n position: relative;\n background-color: var(--dv-group-view-background-color);\n contain: layout;\n}\n.dv-dockview .dv-watermark-container {\n position: absolute;\n top: 0px;\n left: 0px;\n height: 100%;\n width: 100%;\n z-index: 1;\n}\n.dv-dockview .dv-overlay-render-container {\n position: relative;\n}\n\n.dv-groupview.dv-active-group > .dv-tabs-and-actions-container .dv-tabs-container > .dv-tab.dv-active-tab {\n background-color: var(--dv-activegroup-visiblepanel-tab-background-color);\n color: var(--dv-activegroup-visiblepanel-tab-color);\n}\n.dv-groupview.dv-active-group > .dv-tabs-and-actions-container .dv-tabs-container > .dv-tab.dv-inactive-tab {\n background-color: var(--dv-activegroup-hiddenpanel-tab-background-color);\n color: var(--dv-activegroup-hiddenpanel-tab-color);\n}\n.dv-groupview.dv-inactive-group > .dv-tabs-and-actions-container .dv-tabs-container > .dv-tab.dv-active-tab {\n background-color: var(--dv-inactivegroup-visiblepanel-tab-background-color);\n color: var(--dv-inactivegroup-visiblepanel-tab-color);\n}\n.dv-groupview.dv-inactive-group > .dv-tabs-and-actions-container .dv-tabs-container > .dv-tab.dv-inactive-tab {\n background-color: var(--dv-inactivegroup-hiddenpanel-tab-background-color);\n color: var(--dv-inactivegroup-hiddenpanel-tab-color);\n}\n\n/**\n * when a tab is dragged we lose the above stylings because they are conditional on parent elements\n * therefore we also set some stylings for the dragging event\n **/\n.dv-tab.dv-tab-dragging {\n background-color: var(--dv-activegroup-visiblepanel-tab-background-color);\n color: var(--dv-activegroup-visiblepanel-tab-color);\n}\n.dv-groupview {\n display: flex;\n height: 100%;\n background-color: var(--dv-group-view-background-color);\n overflow: hidden;\n flex-direction: column;\n}\n.dv-groupview:focus {\n outline: none;\n}\n.dv-groupview > .dv-content-container {\n flex-grow: 1;\n min-height: 0;\n outline: none;\n}\n.dv-groupview.dv-groupview-header-bottom {\n flex-direction: column-reverse;\n}\n.dv-groupview.dv-groupview-header-left {\n flex-direction: row;\n}\n.dv-groupview.dv-groupview-header-right {\n flex-direction: row-reverse;\n}\n.dv-root-wrapper {\n height: 100%;\n width: 100%;\n}\n.dv-grid-view,\n.dv-branch-node {\n height: 100%;\n width: 100%;\n}\n.dv-debug .dv-resize-container .dv-resize-handle-top {\n background-color: red;\n}\n.dv-debug .dv-resize-container .dv-resize-handle-bottom {\n background-color: green;\n}\n.dv-debug .dv-resize-container .dv-resize-handle-left {\n background-color: yellow;\n}\n.dv-debug .dv-resize-container .dv-resize-handle-right {\n background-color: blue;\n}\n.dv-debug .dv-resize-container .dv-resize-handle-topleft,\n.dv-debug .dv-resize-container .dv-resize-handle-topright,\n.dv-debug .dv-resize-container .dv-resize-handle-bottomleft,\n.dv-debug .dv-resize-container .dv-resize-handle-bottomright {\n background-color: cyan;\n}\n\n.dv-resize-container {\n --dv-overlay-z-index: var(--dv-overlay-z-index, 999);\n position: absolute;\n z-index: calc(var(--dv-overlay-z-index) - 2);\n border: 1px solid var(--dv-tab-divider-color);\n box-shadow: var(--dv-floating-box-shadow);\n /* GPU optimizations for floating group movement */\n will-change: transform, opacity;\n transform: translate3d(0, 0, 0);\n backface-visibility: hidden;\n}\n.dv-resize-container.dv-hidden {\n display: none;\n}\n.dv-resize-container.dv-resize-container-dragging {\n opacity: 0.5;\n /* Enhanced GPU acceleration during drag */\n will-change: transform, opacity;\n}\n.dv-resize-container .dv-resize-handle-top {\n height: 4px;\n width: calc(100% - 8px);\n left: 4px;\n top: -2px;\n z-index: var(--dv-overlay-z-index);\n position: absolute;\n cursor: ns-resize;\n}\n.dv-resize-container .dv-resize-handle-bottom {\n height: 4px;\n width: calc(100% - 8px);\n left: 4px;\n bottom: -2px;\n z-index: var(--dv-overlay-z-index);\n position: absolute;\n cursor: ns-resize;\n}\n.dv-resize-container .dv-resize-handle-left {\n height: calc(100% - 8px);\n width: 4px;\n left: -2px;\n top: 4px;\n z-index: var(--dv-overlay-z-index);\n position: absolute;\n cursor: ew-resize;\n}\n.dv-resize-container .dv-resize-handle-right {\n height: calc(100% - 8px);\n width: 4px;\n right: -2px;\n top: 4px;\n z-index: var(--dv-overlay-z-index);\n position: absolute;\n cursor: ew-resize;\n}\n.dv-resize-container .dv-resize-handle-topleft {\n height: 4px;\n width: 4px;\n top: -2px;\n left: -2px;\n z-index: var(--dv-overlay-z-index);\n position: absolute;\n cursor: nw-resize;\n}\n.dv-resize-container .dv-resize-handle-topright {\n height: 4px;\n width: 4px;\n right: -2px;\n top: -2px;\n z-index: var(--dv-overlay-z-index);\n position: absolute;\n cursor: ne-resize;\n}\n.dv-resize-container .dv-resize-handle-bottomleft {\n height: 4px;\n width: 4px;\n left: -2px;\n bottom: -2px;\n z-index: var(--dv-overlay-z-index);\n position: absolute;\n cursor: sw-resize;\n}\n.dv-resize-container .dv-resize-handle-bottomright {\n height: 4px;\n width: 4px;\n right: -2px;\n bottom: -2px;\n z-index: var(--dv-overlay-z-index);\n position: absolute;\n cursor: se-resize;\n}\n.dv-render-overlay {\n --dv-overlay-z-index: var(--dv-overlay-z-index, 999);\n position: absolute;\n z-index: 1;\n width: 100%;\n height: 100%;\n contain: layout paint;\n isolation: isolate;\n /* GPU optimizations */\n will-change: transform;\n transform: translate3d(0, 0, 0);\n backface-visibility: hidden;\n}\n.dv-render-overlay.dv-render-overlay-float {\n z-index: calc(var(--dv-overlay-z-index) - 1);\n}\n\n.dv-debug .dv-render-overlay {\n outline: 1px solid red;\n outline-offset: -1;\n}\n.dv-pane-container {\n height: 100%;\n width: 100%;\n}\n.dv-pane-container.dv-animated .dv-view {\n /* GPU optimizations for smooth pane animations */\n will-change: transform;\n transform: translate3d(0, 0, 0);\n backface-visibility: hidden;\n transition: transform 0.15s ease-out;\n}\n.dv-pane-container .dv-view {\n overflow: hidden;\n display: flex;\n flex-direction: column;\n padding: 0px !important;\n}\n.dv-pane-container .dv-view:not(:first-child)::before {\n background-color: transparent !important;\n}\n.dv-pane-container .dv-view:not(:first-child) .dv-pane > .dv-pane-header {\n border-top: 1px solid var(--dv-paneview-header-border-color);\n}\n.dv-pane-container .dv-view .dv-default-header {\n background-color: var(--dv-group-view-background-color);\n color: var(--dv-activegroup-visiblepanel-tab-color);\n display: flex;\n padding: 0px 8px;\n cursor: pointer;\n}\n.dv-pane-container .dv-view .dv-default-header .dv-pane-header-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.dv-pane-container .dv-view .dv-default-header > span {\n padding-left: 8px;\n flex-grow: 1;\n}\n.dv-pane-container:first-of-type > .dv-pane > .dv-pane-header {\n border-top: none !important;\n}\n.dv-pane-container .dv-pane {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n height: 100%;\n}\n.dv-pane-container .dv-pane .dv-pane-header {\n box-sizing: border-box;\n user-select: none;\n position: relative;\n outline: none;\n}\n.dv-pane-container .dv-pane .dv-pane-header.dv-pane-draggable {\n cursor: pointer;\n}\n.dv-pane-container .dv-pane .dv-pane-header:focus:before, .dv-pane-container .dv-pane .dv-pane-header:focus-within:before {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 5;\n content: "";\n pointer-events: none;\n outline: 1px solid;\n outline-width: -1px;\n outline-style: solid;\n outline-offset: -1px;\n outline-color: var(--dv-paneview-active-outline-color);\n}\n.dv-pane-container .dv-pane .dv-pane-body {\n overflow-y: auto;\n overflow-x: hidden;\n flex-grow: 1;\n position: relative;\n outline: none;\n}\n.dv-pane-container .dv-pane .dv-pane-body:focus:before, .dv-pane-container .dv-pane .dv-pane-body:focus-within:before {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 5;\n content: "";\n pointer-events: none;\n outline: 1px solid;\n outline-width: -1px;\n outline-style: solid;\n outline-offset: -1px;\n outline-color: var(--dv-paneview-active-outline-color);\n}\n.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-enabled {\n background-color: black;\n}\n.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-disabled {\n background-color: orange;\n}\n.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-maximum {\n background-color: green;\n}\n.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-minimum {\n background-color: red;\n}\n\n.dv-split-view-container {\n position: relative;\n overflow: hidden;\n height: 100%;\n width: 100%;\n}\n.dv-split-view-container.dv-splitview-disabled > .dv-sash-container > .dv-sash {\n pointer-events: none;\n}\n.dv-split-view-container.dv-animation .dv-view,\n.dv-split-view-container.dv-animation .dv-sash {\n /* GPU optimizations for smooth animations */\n will-change: transform;\n transform: translate3d(0, 0, 0);\n backface-visibility: hidden;\n transition: transform 0.15s ease-out;\n}\n.dv-split-view-container.dv-horizontal {\n height: 100%;\n}\n.dv-split-view-container.dv-horizontal > .dv-sash-container > .dv-sash {\n height: 100%;\n width: 4px;\n}\n.dv-split-view-container.dv-horizontal > .dv-sash-container > .dv-sash.dv-enabled {\n cursor: ew-resize;\n}\n.dv-split-view-container.dv-horizontal > .dv-sash-container > .dv-sash.dv-disabled {\n cursor: default;\n}\n.dv-split-view-container.dv-horizontal > .dv-sash-container > .dv-sash.dv-maximum {\n cursor: w-resize;\n}\n.dv-split-view-container.dv-horizontal > .dv-sash-container > .dv-sash.dv-minimum {\n cursor: e-resize;\n}\n.dv-split-view-container.dv-horizontal > .dv-view-container > .dv-view:not(:first-child)::before {\n height: 100%;\n width: 1px;\n}\n.dv-split-view-container.dv-vertical {\n width: 100%;\n}\n.dv-split-view-container.dv-vertical > .dv-sash-container > .dv-sash {\n width: 100%;\n height: 4px;\n}\n.dv-split-view-container.dv-vertical > .dv-sash-container > .dv-sash.dv-enabled {\n cursor: ns-resize;\n}\n.dv-split-view-container.dv-vertical > .dv-sash-container > .dv-sash.dv-disabled {\n cursor: default;\n}\n.dv-split-view-container.dv-vertical > .dv-sash-container > .dv-sash.dv-maximum {\n cursor: n-resize;\n}\n.dv-split-view-container.dv-vertical > .dv-sash-container > .dv-sash.dv-minimum {\n cursor: s-resize;\n}\n.dv-split-view-container.dv-vertical > .dv-view-container > .dv-view {\n width: 100%;\n}\n.dv-split-view-container.dv-vertical > .dv-view-container > .dv-view:not(:first-child)::before {\n height: 1px;\n width: 100%;\n}\n.dv-split-view-container .dv-sash-container {\n height: 100%;\n width: 100%;\n position: absolute;\n}\n.dv-split-view-container .dv-sash-container .dv-sash {\n position: absolute;\n z-index: 99;\n outline: none;\n user-select: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n touch-action: none;\n background-color: var(--dv-sash-color, transparent);\n}\n.dv-split-view-container .dv-sash-container .dv-sash:not(.disabled):active, .dv-split-view-container .dv-sash-container .dv-sash:not(.disabled):hover {\n background-color: var(--dv-active-sash-color, transparent);\n transition-property: background-color;\n transition-timing-function: ease-in-out;\n transition-duration: var(--dv-active-sash-transition-duration, 0.1s);\n transition-delay: var(--dv-active-sash-transition-delay, 0.5s);\n}\n.dv-split-view-container .dv-view-container {\n position: relative;\n height: 100%;\n width: 100%;\n}\n.dv-split-view-container .dv-view-container .dv-view {\n height: 100%;\n box-sizing: border-box;\n overflow: auto;\n position: absolute;\n}\n.dv-split-view-container.dv-separator-border .dv-view:not(:first-child)::before {\n content: " ";\n position: absolute;\n top: 0;\n left: 0;\n z-index: 5;\n pointer-events: none;\n background-color: var(--dv-separator-border);\n}\n.dv-dragged {\n transform: translate3d(0px, 0px, 0px); /* forces tab to be drawn on a separate layer (see https://github.com/microsoft/vscode/issues/18733) */\n}\n\n.dv-tab {\n flex-shrink: 0;\n}\n.dv-tab:focus-within, .dv-tab:focus {\n position: relative;\n}\n.dv-tab:focus-within::after, .dv-tab:focus::after {\n position: absolute;\n content: "";\n height: 100%;\n width: 100%;\n top: 0px;\n left: 0px;\n pointer-events: none;\n outline: 1px solid var(--dv-tab-divider-color) !important;\n outline-offset: -1px;\n z-index: 5;\n}\n.dv-tab.dv-tab-dragging .dv-default-tab-action {\n background-color: var(--dv-activegroup-visiblepanel-tab-color);\n}\n.dv-tab.dv-active-tab .dv-default-tab .dv-default-tab-action {\n visibility: visible;\n}\n.dv-tab.dv-inactive-tab .dv-default-tab .dv-default-tab-action {\n visibility: hidden;\n}\n.dv-tab.dv-inactive-tab .dv-default-tab:hover .dv-default-tab-action {\n visibility: visible;\n}\n.dv-tab .dv-default-tab {\n position: relative;\n height: 100%;\n width: 100%;\n display: flex;\n align-items: center;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n.dv-tab .dv-default-tab .dv-default-tab-content {\n flex-grow: 1;\n margin-right: 4px;\n}\n.dv-tab .dv-default-tab .dv-default-tab-action {\n padding: 4px;\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n}\n.dv-tab .dv-default-tab .dv-default-tab-action:hover {\n border-radius: 2px;\n background-color: var(--dv-icon-hover-background-color);\n}\n.dv-tabs-overflow-dropdown-default {\n height: 100%;\n color: var(--dv-activegroup-hiddenpanel-tab-color);\n margin: var(--dv-tab-margin);\n display: flex;\n align-items: center;\n flex-shrink: 0;\n padding: 0.25rem 0.5rem;\n cursor: pointer;\n}\n.dv-tabs-overflow-dropdown-default > span {\n padding-left: 0.25rem;\n}\n.dv-tabs-overflow-dropdown-default > svg {\n transform: rotate(90deg);\n}\n.dv-tabs-container {\n display: flex;\n height: 100%;\n overflow: auto;\n scrollbar-width: thin;\n /* GPU optimizations for smooth scrolling */\n will-change: scroll-position;\n transform: translate3d(0, 0, 0);\n /* Track */\n /* Handle */\n}\n.dv-tabs-container.dv-tabs-container-vertical {\n width: 100%;\n height: fit-content;\n max-height: 100%;\n writing-mode: vertical-rl;\n}\n.dv-tabs-container.dv-horizontal .dv-tab:not(:first-child)::before, .dv-tabs-container.dv-vertical .dv-tab:not(:first-child)::before {\n content: " ";\n position: absolute;\n top: 0;\n left: 0;\n z-index: 5;\n pointer-events: none;\n background-color: var(--dv-tab-divider-color);\n}\n.dv-tabs-container.dv-horizontal .dv-tab:not(:first-child)::before {\n width: 1px;\n height: 100%;\n}\n.dv-tabs-container.dv-vertical .dv-tab:not(:first-child)::before {\n width: 100%;\n height: 1px;\n}\n.dv-tabs-container::-webkit-scrollbar {\n height: 3px;\n}\n.dv-tabs-container::-webkit-scrollbar-track {\n background: transparent;\n}\n.dv-tabs-container::-webkit-scrollbar-thumb {\n background: var(--dv-tabs-container-scrollbar-color);\n}\n\n.dv-scrollable > .dv-tabs-container {\n overflow: hidden;\n}\n\n.dv-tab {\n -webkit-user-drag: element;\n outline: none;\n padding: 0.25rem 0.5rem;\n cursor: pointer;\n position: relative;\n box-sizing: border-box;\n font-size: var(--dv-tab-font-size);\n margin: var(--dv-tab-margin);\n}\n\n.dv-tabs-container-vertical .dv-tab {\n padding: 0.5rem 0.25rem;\n}\n\n.dv-tabs-overflow-container {\n flex-direction: column;\n height: unset;\n max-height: min(50vh, 400px);\n overflow-y: auto;\n border: 1px solid var(--dv-tab-divider-color);\n background-color: var(--dv-group-view-background-color);\n /* Scrollbar styling for webkit browsers */\n /* Firefox scrollbar */\n scrollbar-width: thin;\n}\n.dv-tabs-overflow-container::-webkit-scrollbar {\n width: 6px;\n}\n.dv-tabs-overflow-container::-webkit-scrollbar-track {\n background: transparent;\n}\n.dv-tabs-overflow-container::-webkit-scrollbar-thumb {\n background: var(--dv-tabs-container-scrollbar-color);\n border-radius: 3px;\n}\n.dv-tabs-overflow-container .dv-tab:not(:last-child) {\n border-bottom: 1px solid var(--dv-tab-divider-color);\n}\n.dv-tabs-overflow-container .dv-active-tab {\n background-color: var(--dv-activegroup-visiblepanel-tab-background-color);\n color: var(--dv-activegroup-visiblepanel-tab-color);\n}\n.dv-tabs-overflow-container .dv-inactive-tab {\n background-color: var(--dv-activegroup-hiddenpanel-tab-background-color);\n color: var(--dv-activegroup-hiddenpanel-tab-color);\n}\n.dv-tabs-and-actions-container {\n display: flex;\n background-color: var(--dv-tabs-and-actions-container-background-color);\n flex-shrink: 0;\n box-sizing: border-box;\n height: var(--dv-tabs-and-actions-container-height);\n font-size: var(--dv-tabs-and-actions-container-font-size);\n}\n.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-scrollable {\n flex-grow: 1;\n}\n.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-tabs-container {\n flex-grow: 1;\n}\n.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-tabs-container .dv-tab {\n flex-grow: 1;\n padding: 0px;\n}\n.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-void-container {\n flex-grow: 0;\n}\n.dv-tabs-and-actions-container .dv-void-container {\n display: flex;\n flex-grow: 1;\n}\n.dv-tabs-and-actions-container .dv-void-container.dv-draggable {\n cursor: grab;\n}\n.dv-tabs-and-actions-container .dv-right-actions-container {\n display: flex;\n}\n.dv-tabs-and-actions-container .dv-right-actions-container.dv-right-actions-container-vertical {\n flex-direction: column;\n}\n.dv-tabs-and-actions-container.dv-groupview-header-vertical {\n flex-direction: column;\n height: auto;\n width: var(--dv-tabs-and-actions-container-height);\n}\n.dv-watermark {\n display: flex;\n height: 100%;\n}');class t{}class i extends t{constructor(e,t,i){super(),this.viewId=e,this.groupId=t,this.panelId=i}}class n extends t{constructor(e,t){super(),this.viewId=e,this.paneId=t}}class o{constructor(){}static getInstance(){return o.INSTANCE}hasData(e){return e&&e===this.proto}clearData(e){this.hasData(e)&&(this.proto=void 0,this.data=void 0)}getData(e){if(this.hasData(e))return this.data}setData(e,t){t&&(this.data=e,this.proto=t)}}function s(){const e=o.getInstance();if(e.hasData(i.prototype))return e.getData(i.prototype)[0]}function r(){const e=o.getInstance();if(e.hasData(n.prototype))return e.getData(n.prototype)[0]}o.INSTANCE=new o,exports.DockviewEvent=void 0,(exports.DockviewEvent||(exports.DockviewEvent={})).any=(...e)=>t=>{const i=e.map((e=>e(t)));return{dispose:()=>{i.forEach((e=>{e.dispose()}))}}};class a{constructor(){this._defaultPrevented=!1}get defaultPrevented(){return this._defaultPrevented}preventDefault(){this._defaultPrevented=!0}}class d{constructor(){this._isAccepted=!1}get isAccepted(){return this._isAccepted}accept(){this._isAccepted=!0}}class h{static create(){var e;return new h(null!==(e=(new Error).stack)&&void 0!==e?e:"")}constructor(e){this.value=e}print(){console.warn("dockview: stacktrace",this.value)}}class l{constructor(e,t){this.callback=e,this.stacktrace=t}}class p{static setLeakageMonitorEnabled(e){e!==p.ENABLE_TRACKING&&p.MEMORY_LEAK_WATCHER.clear(),p.ENABLE_TRACKING=e}get value(){return this._last}constructor(e){this.options=e,this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=e=>{var t;(null===(t=this.options)||void 0===t?void 0:t.replay)&&void 0!==this._last&&e(this._last);const i=new l(e,p.ENABLE_TRACKING?h.create():void 0);return this._listeners.push(i),{dispose:()=>{const e=this._listeners.indexOf(i);e>-1?this._listeners.splice(e,1):p.ENABLE_TRACKING}}},p.ENABLE_TRACKING&&p.MEMORY_LEAK_WATCHER.add(this._event,h.create())),this._event}fire(e){var t;(null===(t=this.options)||void 0===t?void 0:t.replay)&&(this._last=e);for(const t of this._listeners)t.callback(e)}dispose(){this._disposed||(this._disposed=!0,this._listeners.length>0&&(p.ENABLE_TRACKING&&queueMicrotask((()=>{var e;for(const t of this._listeners)console.warn("dockview: stacktrace",null===(e=t.stacktrace)||void 0===e?void 0:e.print())})),this._listeners=[]),p.ENABLE_TRACKING&&this._event&&p.MEMORY_LEAK_WATCHER.delete(this._event))}}function c(e,t,i,n){return e.addEventListener(t,i,n),{dispose:()=>{e.removeEventListener(t,i,n)}}}p.ENABLE_TRACKING=!1,p.MEMORY_LEAK_WATCHER=new class{constructor(){this.events=new Map}get size(){return this.events.size}add(e,t){this.events.set(e,t)}delete(e){this.events.delete(e)}clear(){this.events.clear()}};class v{constructor(){this._onFired=new p,this._currentFireCount=0,this._queued=!1,this.onEvent=e=>{const t=this._currentFireCount;return this._onFired.event((()=>{this._currentFireCount>t&&e()}))}}fire(){this._currentFireCount++,this._queued||(this._queued=!0,queueMicrotask((()=>{this._queued=!1,this._onFired.fire()})))}dispose(){this._onFired.dispose()}}exports.DockviewDisposable=void 0,(e=exports.DockviewDisposable||(exports.DockviewDisposable={})).NONE={dispose:()=>{}},e.from=function(e){return{dispose:()=>{e()}}};class u{get isDisposed(){return this._isDisposed}constructor(...e){this._isDisposed=!1,this._disposables=new Set(e)}addDisposables(...e){e.forEach((e=>this._disposables.add(e)))}removeDisposable(e){this._disposables.delete(e)}dispose(){this._isDisposed||(this._isDisposed=!0,this._disposables.forEach((e=>e.dispose())),this._disposables.clear())}}class m{constructor(){this._disposable=exports.DockviewDisposable.NONE}set value(e){this._disposable&&this._disposable.dispose(),this._disposable=e}dispose(){this._disposable&&(this._disposable.dispose(),this._disposable=exports.DockviewDisposable.NONE)}}class g extends u{constructor(e){super(),this._onDidChange=new p,this.onDidChange=this._onDidChange.event,this._value=null,this.addDisposables(this._onDidChange,b(e,(e=>{const t=e.target.scrollWidth>e.target.clientWidth,i=e.target.scrollHeight>e.target.clientHeight;this._value={hasScrollX:t,hasScrollY:i},this._onDidChange.fire(this._value)})))}}function b(e,t){const i=new ResizeObserver((e=>{requestAnimationFrame((()=>{const i=e[0];t(i)}))}));return i.observe(e),{dispose:()=>{i.unobserve(e),i.disconnect()}}}const w=(e,...t)=>{for(const i of t)e.classList.contains(i)&&e.classList.remove(i)},f=(e,...t)=>{for(const i of t)e.classList.contains(i)||e.classList.add(i)},_=(e,t,i)=>{const n=e.classList.contains(t);i&&!n&&e.classList.add(t),!i&&n&&e.classList.remove(t)};function x(e,t){for(;e;){if(e===t)return!0;e=e.parentNode}return!1}function D(e){return new y(e)}class y extends u{constructor(e){super(),this._onDidFocus=new p,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new p,this.onDidBlur=this._onDidBlur.event,this.addDisposables(this._onDidFocus,this._onDidBlur);let t=x(document.activeElement,e),i=!1;const n=()=>{i=!1,t||(t=!0,this._onDidFocus.fire())},o=()=>{t&&(i=!0,window.setTimeout((()=>{i&&(i=!1,t=!1,this._onDidBlur.fire())}),0))};this._refreshStateHandler=()=>{x(document.activeElement,e)!==t&&(t?o():n())},this.addDisposables(c(e,"focus",n,!0)),this.addDisposables(c(e,"blur",o,!0))}refreshState(){this._refreshStateHandler()}}const C="dv-quasiPreventDefault";function z(e){return e[C]}function S(e){const{left:t,top:i,width:n,height:o}=e.getBoundingClientRect();return{left:t+window.scrollX,top:i+window.scrollY,width:n,height:o}}function A(e=document){const t=function(e){const t=[];return function i(n){if(n.nodeType===Node.ELEMENT_NODE){e.includes(n.tagName)&&t.push(n),n.shadowRoot&&i(n.shadowRoot);for(const e of n.children)i(e)}}(document.documentElement),t}(["IFRAME","WEBVIEW"]),i=new WeakMap;for(const e of t)i.set(e,e.style.pointerEvents),e.style.pointerEvents="none";return{release:()=>{var e;for(const n of t)n.style.pointerEvents=null!==(e=i.get(n))&&void 0!==e?e:"auto";t.splice(0,t.length)}}}class k{constructor(e){this.element=e,this._classNames=[]}setClassNames(e){for(const e of this._classNames)_(this.element,e,!1);this._classNames=e.split(" ").filter((e=>e.trim().length>0));for(const e of this._classNames)_(this.element,e,!0)}}function P(e){if(0===e.length)throw new Error("Invalid tail call");return[e.slice(0,e.length-1),e[e.length-1]]}function E(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}function O(e,t){const i=e.indexOf(t);i>-1&&(e.splice(i,1),e.unshift(t))}function G(e,t){const i=e.indexOf(t);i>-1&&(e.splice(i,1),e.push(t))}function I(e,t){const i=e.findIndex((e=>e===t));return i>-1&&(e.splice(i,1),!0)}const V=(e,t,i)=>t>i?t:Math.min(i,Math.max(e,t)),N=()=>{let e=1;return{next:()=>(e++).toString()}},T=(e,t)=>{const i=[];if("number"!=typeof t&&(t=e,e=0),e<=t)for(let n=e;n<t;n++)i.push(n);else for(let n=e;n>t;n--)i.push(n);return i};class L{set size(e){this._size=e}get size(){return this._size}get cachedVisibleSize(){return this._cachedVisibleSize}get visible(){return void 0===this._cachedVisibleSize}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get snap(){return!!this.view.snap}set enabled(e){this.container.style.pointerEvents=e?"":"none"}constructor(e,t,i,n){this.container=e,this.view=t,this.disposable=n,this._cachedVisibleSize=void 0,"number"==typeof i?(this._size=i,this._cachedVisibleSize=void 0,e.classList.add("visible")):(this._size=0,this._cachedVisibleSize=i.cachedVisibleSize)}setVisible(e,t){var i;e!==this.visible&&(e?(this.size=V(null!==(i=this._cachedVisibleSize)&&void 0!==i?i:0,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize="number"==typeof t?t:this.size,this.size=0),this.container.classList.toggle("visible",e),this.view.setVisible&&this.view.setVisible(e))}dispose(){return this.disposable.dispose(),this.view}}var M,R,W,H;exports.Orientation=void 0,(M=exports.Orientation||(exports.Orientation={})).HORIZONTAL="HORIZONTAL",M.VERTICAL="VERTICAL",exports.SashState=void 0,(R=exports.SashState||(exports.SashState={}))[R.MAXIMUM=0]="MAXIMUM",R[R.MINIMUM=1]="MINIMUM",R[R.DISABLED=2]="DISABLED",R[R.ENABLED=3]="ENABLED",exports.LayoutPriority=void 0,(W=exports.LayoutPriority||(exports.LayoutPriority={})).Low="low",W.High="high",W.Normal="normal",exports.Sizing=void 0,(H=exports.Sizing||(exports.Sizing={})).Distribute={type:"distribute"},H.Split=function(e){return{type:"split",index:e}},H.Invisible=function(e){return{type:"invisible",cachedVisibleSize:e}};class F{get contentSize(){return this._contentSize}get size(){return this._size}set size(e){this._size=e}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get length(){return this.viewItems.length}get proportions(){return this._proportions?[...this._proportions]:void 0}get orientation(){return this._orientation}set orientation(e){this._orientation=e;const t=this.size;this.size=this.orthogonalSize,this.orthogonalSize=t,w(this.element,"dv-horizontal","dv-vertical"),this.element.classList.add(this.orientation==exports.Orientation.HORIZONTAL?"dv-horizontal":"dv-vertical")}get minimumSize(){return this.viewItems.reduce(((e,t)=>e+t.minimumSize),0)}get maximumSize(){return 0===this.length?Number.POSITIVE_INFINITY:this.viewItems.reduce(((e,t)=>e+t.maximumSize),0)}get startSnappingEnabled(){return this._startSnappingEnabled}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}get endSnappingEnabled(){return this._endSnappingEnabled}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}get disabled(){return this._disabled}set disabled(e){this._disabled=e,_(this.element,"dv-splitview-disabled",e)}get margin(){return this._margin}set margin(e){this._margin=e,_(this.element,"dv-splitview-has-margin",0!==e)}constructor(e,t){var i,n;this.container=e,this.viewItems=[],this.sashes=[],this._size=0,this._orthogonalSize=0,this._contentSize=0,this._proportions=void 0,this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this._disabled=!1,this._margin=0,this._onDidSashEnd=new p,this.onDidSashEnd=this._onDidSashEnd.event,this._onDidAddView=new p,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new p,this.onDidRemoveView=this._onDidRemoveView.event,this.resize=(e,t,i=this.viewItems.map((e=>e.size)),n,o,s=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY,a,d)=>{if(e<0||e>this.viewItems.length)return 0;const h=T(e,-1),l=T(e+1,this.viewItems.length);if(o)for(const e of o)O(h,e),O(l,e);if(n)for(const e of n)G(h,e),G(l,e);const p=h.map((e=>this.viewItems[e])),c=h.map((e=>i[e])),v=l.map((e=>this.viewItems[e])),u=l.map((e=>i[e])),m=h.reduce(((e,t)=>e+this.viewItems[t].minimumSize-i[t]),0),g=h.reduce(((e,t)=>e+this.viewItems[t].maximumSize-i[t]),0),b=0===l.length?Number.POSITIVE_INFINITY:l.reduce(((e,t)=>e+i[t]-this.viewItems[t].minimumSize),0),w=0===l.length?Number.NEGATIVE_INFINITY:l.reduce(((e,t)=>e+i[t]-this.viewItems[t].maximumSize),0),f=Math.max(m,w),_=Math.min(b,g);let x=!1;if(a){const e=this.viewItems[a.index],i=t>=a.limitDelta;x=i!==e.visible,e.setVisible(i,a.size)}if(!x&&d){const e=this.viewItems[d.index],i=t<d.limitDelta;x=i!==e.visible,e.setVisible(i,d.size)}if(x)return this.resize(e,t,i,n,o,s,r);let D=0,y=V(t,f,_);for(let e=0;e<p.length;e++){const t=p[e],i=V(c[e]+y,t.minimumSize,t.maximumSize),n=i-c[e];D+=n,y-=n,t.size=i}let C=D;for(let e=0;e<v.length;e++){const t=v[e],i=V(u[e]-C,t.minimumSize,t.maximumSize);C+=i-u[e],t.size=i}return t},this._orientation=null!==(i=t.orientation)&&void 0!==i?i:exports.Orientation.VERTICAL,this.element=this.createContainer(),this.margin=null!==(n=t.margin)&&void 0!==n?n:0,this.proportionalLayout=void 0===t.proportionalLayout||!!t.proportionalLayout,this.viewContainer=this.createViewContainer(),this.sashContainer=this.createSashContainer(),this.element.appendChild(this.sashContainer),this.element.appendChild(this.viewContainer),this.container.appendChild(this.element),this.style(t.styles),t.descriptor&&(this._size=t.descriptor.size,t.descriptor.views.forEach(((e,t)=>{const i=void 0===e.visible||e.visible?e.size:{type:"invisible",cachedVisibleSize:e.size},n=e.view;this.addView(n,i,t,!0)})),this._contentSize=this.viewItems.reduce(((e,t)=>e+t.size),0),this.saveProportions())}style(e){"transparent"===(null==e?void 0:e.separatorBorder)?(w(this.element,"dv-separator-border"),this.element.style.removeProperty("--dv-separator-border")):(f(this.element,"dv-separator-border"),(null==e?void 0:e.separatorBorder)&&this.element.style.setProperty("--dv-separator-border",e.separatorBorder))}isViewVisible(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].visible}setViewVisible(e,t){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");const i=this.viewItems[e];i.setVisible(t,i.size),this.distributeEmptySpace(e),this.layoutViews(),this.saveProportions()}getViewSize(e){return e<0||e>=this.viewItems.length?-1:this.viewItems[e].size}resizeView(e,t){if(e<0||e>=this.viewItems.length)return;const i=T(this.viewItems.length).filter((t=>t!==e)),n=[...i.filter((e=>this.viewItems[e].priority===exports.LayoutPriority.Low)),e],o=i.filter((e=>this.viewItems[e].priority===exports.LayoutPriority.High)),s=this.viewItems[e];t=Math.round(t),t=V(t,s.minimumSize,Math.min(s.maximumSize,this._size)),s.size=t,this.relayout(n,o)}getViews(){return this.viewItems.map((e=>e.view))}onDidChange(e,t){const i=this.viewItems.indexOf(e);if(i<0||i>=this.viewItems.length)return;t="number"==typeof t?t:e.size,t=V(t,e.minimumSize,e.maximumSize),e.size=t;const n=T(this.viewItems.length).filter((e=>e!==i)),o=[...n.filter((e=>this.viewItems[e].priority===exports.LayoutPriority.Low)),i],s=n.filter((e=>this.viewItems[e].priority===exports.LayoutPriority.High));this.relayout([...o,i],s)}addView(e,t={type:"distribute"},i=this.viewItems.length,n){const o=document.createElement("div");let s;o.className="dv-view",o.appendChild(e.element),s="number"==typeof t?t:"split"===t.type?this.getViewSize(t.index)/2:"invisible"===t.type?{cachedVisibleSize:t.cachedVisibleSize}:e.minimumSize;const r=e.onDidChange((e=>this.onDidChange(a,e.size))),a=new L(o,e,s,{dispose:()=>{r.dispose(),this.viewContainer.removeChild(o)}});if(i===this.viewItems.length?this.viewContainer.appendChild(o):this.viewContainer.insertBefore(o,this.viewContainer.children.item(i)),this.viewItems.splice(i,0,a),this.viewItems.length>1){const e=document.createElement("div");e.className="dv-sash";const t=t=>{for(const e of this.viewItems)e.enabled=!1;const i=A(),n=this._orientation===exports.Orientation.HORIZONTAL?t.clientX:t.clientY,o=function(e,t){for(let i=0;i<e.length;i++)if(t(e[i]))return i;return-1}(this.sashes,(t=>t.container===e)),s=this.viewItems.map((e=>e.size));let r,a;const d=T(o,-1),h=T(o+1,this.viewItems.length),l=d.reduce(((e,t)=>e+(this.viewItems[t].minimumSize-s[t])),0),p=d.reduce(((e,t)=>e+(this.viewItems[t].viewMaximumSize-s[t])),0),c=0===h.length?Number.POSITIVE_INFINITY:h.reduce(((e,t)=>e+(s[t]-this.viewItems[t].minimumSize)),0),v=0===h.length?Number.NEGATIVE_INFINITY:h.reduce(((e,t)=>e+(s[t]-this.viewItems[t].viewMaximumSize)),0),u=Math.max(l,v),m=Math.min(c,p),g=this.findFirstSnapIndex(d),b=this.findFirstSnapIndex(h);if("number"==typeof g){const e=this.viewItems[g],t=Math.floor(e.viewMinimumSize/2);r={index:g,limitDelta:e.visible?u-t:u+t,size:e.size}}if("number"==typeof b){const e=this.viewItems[b],t=Math.floor(e.viewMinimumSize/2);a={index:b,limitDelta:e.visible?m+t:m-t,size:e.size}}const w=e=>{const t=(this._orientation===exports.Orientation.HORIZONTAL?e.clientX:e.clientY)-n;this.resize(o,t,s,void 0,void 0,u,m,r,a),this.distributeEmptySpace(),this.layoutViews()},f=()=>{for(const e of this.viewItems)e.enabled=!0;i.release(),this.saveProportions(),document.removeEventListener("pointermove",w),document.removeEventListener("pointerup",f),document.removeEventListener("pointercancel",f),document.removeEventListener("contextmenu",f),this._onDidSashEnd.fire(void 0)};document.addEventListener("pointermove",w),document.addEventListener("pointerup",f),document.addEventListener("pointercancel",f),document.addEventListener("contextmenu",f)};e.addEventListener("pointerdown",t);const i={container:e,disposable:()=>{e.removeEventListener("pointerdown",t),this.sashContainer.removeChild(e)}};this.sashContainer.appendChild(e),this.sashes.push(i)}n||this.relayout([i]),n||"number"==typeof t||"distribute"!==t.type||this.distributeViewSizes(),this._onDidAddView.fire(e)}distributeViewSizes(){const e=[];let t=0;for(const i of this.viewItems)i.maximumSize-i.minimumSize>0&&(e.push(i),t+=i.size);const i=Math.floor(t/e.length);for(const t of e)t.size=V(i,t.minimumSize,t.maximumSize);const n=T(this.viewItems.length),o=n.filter((e=>this.viewItems[e].priority===exports.LayoutPriority.Low)),s=n.filter((e=>this.viewItems[e].priority===exports.LayoutPriority.High));this.relayout(o,s)}removeView(e,t,i=!1){const n=this.viewItems.splice(e,1)[0];if(n.dispose(),this.viewItems.length>=1){const t=Math.max(e-1,0);this.sashes.splice(t,1)[0].disposable()}return i||this.relayout(),t&&"distribute"===t.type&&this.distributeViewSizes(),this._onDidRemoveView.fire(n.view),n.view}getViewCachedVisibleSize(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].cachedVisibleSize}moveView(e,t){const i=this.getViewCachedVisibleSize(e),n=void 0===i?this.getViewSize(e):exports.Sizing.Invisible(i),o=this.removeView(e,void 0,!0);this.addView(o,n,t)}layout(e,t){const i=Math.max(this.size,this._contentSize);if(this.size=e,this.orthogonalSize=t,this.proportions){let t=0;for(let i=0;i<this.viewItems.length;i++){const n=this.viewItems[i],o=this.proportions[i];"number"==typeof o?t+=o:e-=n.size}for(let i=0;i<this.viewItems.length;i++){const n=this.viewItems[i],o=this.proportions[i];"number"==typeof o&&t>0&&(n.size=V(Math.round(o*e/t),n.minimumSize,n.maximumSize))}}else{const t=T(this.viewItems.length),n=t.filter((e=>this.viewItems[e].priority===exports.LayoutPriority.Low)),o=t.filter((e=>this.viewItems[e].priority===exports.LayoutPriority.High));this.resize(this.viewItems.length-1,e-i,void 0,n,o)}this.distributeEmptySpace(),this.layoutViews()}relayout(e,t){const i=this.viewItems.reduce(((e,t)=>e+t.size),0);this.resize(this.viewItems.length-1,this._size-i,void 0,e,t),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}distributeEmptySpace(e){const t=this.viewItems.reduce(((e,t)=>e+t.size),0);let i=this.size-t;const n=T(this.viewItems.length-1,-1),o=n.filter((e=>this.viewItems[e].priority===exports.LayoutPriority.Low)),s=n.filter((e=>this.viewItems[e].priority===exports.LayoutPriority.High));for(const e of s)O(n,e);for(const e of o)G(n,e);"number"==typeof e&&G(n,e);for(let e=0;0!==i&&e<n.length;e++){const t=this.viewItems[n[e]],o=V(t.size+i,t.minimumSize,t.maximumSize);i-=o-t.size,t.size=o}}saveProportions(){this.proportionalLayout&&this._contentSize>0&&(this._proportions=this.viewItems.map((e=>e.visible?e.size/this._contentSize:void 0)))}layoutViews(){if(this._contentSize=this.viewItems.reduce(((e,t)=>e+t.size),0),this.updateSashEnablement(),0===this.viewItems.length)return;const e=this.viewItems.filter((e=>e.visible)),t=Math.max(0,e.length-1),i=this.margin*t/Math.max(1,e.length);let n=0;const o=[],s=this.viewItems.reduce(((e,t,i)=>{const n=t.visible?1:0;return 0===i?e.push(n):e.push(e[i-1]+n),e}),[]);this.viewItems.forEach(((e,r)=>{n+=this.viewItems[r].size,o.push(n);const a=e.visible?e.size-i:0,d=Math.max(0,s[r]-1),h=0===r||0===d?0:o[r-1]+d/t*i;if(r<this.viewItems.length-1){const t=e.visible?h+a-2+this.margin/2:h;this._orientation===exports.Orientation.HORIZONTAL&&(this.sashes[r].container.style.left=`${t}px`,this.sashes[r].container.style.top="0px"),this._orientation===exports.Orientation.VERTICAL&&(this.sashes[r].container.style.left="0px",this.sashes[r].container.style.top=`${t}px`)}this._orientation===exports.Orientation.HORIZONTAL&&(e.container.style.width=`${a}px`,e.container.style.left=`${h}px`,e.container.style.top="",e.container.style.height=""),this._orientation===exports.Orientation.VERTICAL&&(e.container.style.height=`${a}px`,e.container.style.top=`${h}px`,e.container.style.width="",e.container.style.left=""),e.view.layout(e.size-i,this._orthogonalSize)}))}findFirstSnapIndex(e){for(const t of e){const e=this.viewItems[t];if(e.visible&&e.snap)return t}for(const t of e){const e=this.viewItems[t];if(e.visible&&e.maximumSize-e.minimumSize>0)return;if(!e.visible&&e.snap)return t}}updateSashEnablement(){let e=!1;const t=this.viewItems.map((t=>e=t.size-t.minimumSize>0||e));e=!1;const i=this.viewItems.map((t=>e=t.maximumSize-t.size>0||e)),n=[...this.viewItems].reverse();e=!1;const o=n.map((t=>e=t.size-t.minimumSize>0||e)).reverse();e=!1;const s=n.map((t=>e=t.maximumSize-t.size>0||e)).reverse();let r=0;for(let e=0;e<this.sashes.length;e++){const n=this.sashes[e];r+=this.viewItems[e].size;const a=!(t[e]&&s[e+1]),d=!(i[e]&&o[e+1]);if(a&&d){const i=T(e,-1),s=T(e+1,this.viewItems.length),a=this.findFirstSnapIndex(i),d=this.findFirstSnapIndex(s),h="number"==typeof a&&!this.viewItems[a].visible,l="number"==typeof d&&!this.viewItems[d].visible;h&&o[e]&&(r>0||this.startSnappingEnabled)?this.updateSash(n,exports.SashState.MINIMUM):l&&t[e]&&(r<this._contentSize||this.endSnappingEnabled)?this.updateSash(n,exports.SashState.MAXIMUM):this.updateSash(n,exports.SashState.DISABLED)}else a&&!d?this.updateSash(n,exports.SashState.MINIMUM):!a&&d?this.updateSash(n,exports.SashState.MAXIMUM):this.updateSash(n,exports.SashState.ENABLED)}}updateSash(e,t){_(e.container,"dv-disabled",t===exports.SashState.DISABLED),_(e.container,"dv-enabled",t===exports.SashState.ENABLED),_(e.container,"dv-maximum",t===exports.SashState.MAXIMUM),_(e.container,"dv-minimum",t===exports.SashState.MINIMUM)}createViewContainer(){const e=document.createElement("div");return e.className="dv-view-container",e}createSashContainer(){const e=document.createElement("div");return e.className="dv-sash-container",e}createContainer(){const e=document.createElement("div"),t=this._orientation===exports.Orientation.HORIZONTAL?"dv-horizontal":"dv-vertical";return e.className=`dv-split-view-container ${t}`,e}dispose(){this._onDidSashEnd.dispose(),this._onDidAddView.dispose(),this._onDidRemoveView.dispose();for(let e=0;e<this.element.children.length;e++)if(this.element.children.item(e)===this.element){this.element.removeChild(this.element);break}for(const e of this.viewItems)e.dispose();this.element.remove()}}const B=(()=>{const e={orientation:void 0,descriptor:void 0,proportionalLayout:void 0,styles:void 0,margin:void 0,disableAutoResizing:void 0,className:void 0};return Object.keys(e)})();class U extends u{get onDidAddView(){return this.splitview.onDidAddView}get onDidRemoveView(){return this.splitview.onDidRemoveView}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get orientation(){return this.splitview.orientation}get size(){return this.splitview.size}get orthogonalSize(){return this.splitview.orthogonalSize}constructor(e,t){var i;super(),this.paneItems=[],this.skipAnimation=!1,this._onDidChange=new p,this.onDidChange=this._onDidChange.event,this._orientation=null!==(i=t.orientation)&&void 0!==i?i:exports.Orientation.VERTICAL,this.element=document.createElement("div"),this.element.className="dv-pane-container",e.appendChild(this.element),this.splitview=new F(this.element,{orientation:this._orientation,proportionalLayout:!1,descriptor:t.descriptor}),this.getPanes().forEach((e=>{const t=new u(e.onDidChangeExpansionState((()=>{this.setupAnimation(),this._onDidChange.fire(void 0)}))),i={pane:e,disposable:{dispose:()=>{t.dispose()}}};this.paneItems.push(i),e.orthogonalSize=this.splitview.orthogonalSize})),this.addDisposables(this._onDidChange,this.splitview.onDidSashEnd((()=>{this._onDidChange.fire(void 0)})),this.splitview.onDidAddView((()=>{this._onDidChange.fire()})),this.splitview.onDidRemoveView((()=>{this._onDidChange.fire()})))}setViewVisible(e,t){this.splitview.setViewVisible(e,t)}addPane(e,t,i=this.splitview.length,n=!1){const o=e.onDidChangeExpansionState((()=>{this.setupAnimation(),this._onDidChange.fire(void 0)})),s={pane:e,disposable:{dispose:()=>{o.dispose()}}};this.paneItems.splice(i,0,s),e.orthogonalSize=this.splitview.orthogonalSize,this.splitview.addView(e,t,i,n)}getViewSize(e){return this.splitview.getViewSize(e)}getPanes(){return this.splitview.getViews()}removePane(e,t={skipDispose:!1}){const i=this.paneItems.splice(e,1)[0];return this.splitview.removeView(e),t.skipDispose||(i.disposable.dispose(),i.pane.dispose()),i}moveView(e,t){if(e===t)return;const i=this.removePane(e,{skipDispose:!0});this.skipAnimation=!0;try{this.addPane(i.pane,i.pane.size,t,!1)}finally{this.skipAnimation=!1}}layout(e,t){this.splitview.layout(e,t)}setupAnimation(){this.skipAnimation||(this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),f(this.element,"dv-animated"),this.animationTimer=setTimeout((()=>{this.animationTimer=void 0,w(this.element,"dv-animated")}),200))}dispose(){super.dispose(),this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),this.paneItems.forEach((e=>{e.disposable.dispose(),e.pane.dispose()})),this.paneItems=[],this.splitview.dispose(),this.element.remove()}}class ${get minimumWidth(){return this.view.minimumWidth}get maximumWidth(){return this.view.maximumWidth}get minimumHeight(){return this.view.minimumHeight}get maximumHeight(){return this.view.maximumHeight}get priority(){return this.view.priority}get snap(){return this.view.snap}get minimumSize(){return this.orientation===exports.Orientation.HORIZONTAL?this.minimumHeight:this.minimumWidth}get maximumSize(){return this.orientation===exports.Orientation.HORIZONTAL?this.maximumHeight:this.maximumWidth}get minimumOrthogonalSize(){return this.orientation===exports.Orientation.HORIZONTAL?this.minimumWidth:this.minimumHeight}get maximumOrthogonalSize(){return this.orientation===exports.Orientation.HORIZONTAL?this.maximumWidth:this.maximumHeight}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get element(){return this.view.element}get width(){return this.orientation===exports.Orientation.HORIZONTAL?this.orthogonalSize:this.size}get height(){return this.orientation===exports.Orientation.HORIZONTAL?this.size:this.orthogonalSize}constructor(e,t,i,n=0){this.view=e,this.orientation=t,this._onDidChange=new p,this.onDidChange=this._onDidChange.event,this._orthogonalSize=i,this._size=n,this._disposable=this.view.onDidChange((e=>{e?this._onDidChange.fire({size:this.orientation===exports.Orientation.VERTICAL?e.width:e.height,orthogonalSize:this.orientation===exports.Orientation.VERTICAL?e.height:e.width}):this._onDidChange.fire({})}))}setVisible(e){this.view.setVisible&&this.view.setVisible(e)}layout(e,t){this._size=e,this._orthogonalSize=t,this.view.layout(this.width,this.height)}dispose(){this._onDidChange.dispose(),this._disposable.dispose()}}class J extends u{get width(){return this.orientation===exports.Orientation.HORIZONTAL?this.size:this.orthogonalSize}get height(){return this.orientation===exports.Orientation.HORIZONTAL?this.orthogonalSize:this.size}get minimumSize(){return 0===this.children.length?0:Math.max(...this.children.map(((e,t)=>this.splitview.isViewVisible(t)?e.minimumOrthogonalSize:0)))}get maximumSize(){return Math.min(...this.children.map(((e,t)=>this.splitview.isViewVisible(t)?e.maximumOrthogonalSize:Number.POSITIVE_INFINITY)))}get minimumOrthogonalSize(){return this.splitview.minimumSize}get maximumOrthogonalSize(){return this.splitview.maximumSize}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get minimumWidth(){return this.orientation===exports.Orientation.HORIZONTAL?this.minimumOrthogonalSize:this.minimumSize}get minimumHeight(){return this.orientation===exports.Orientation.HORIZONTAL?this.minimumSize:this.minimumOrthogonalSize}get maximumWidth(){return this.orientation===exports.Orientation.HORIZONTAL?this.maximumOrthogonalSize:this.maximumSize}get maximumHeight(){return this.orientation===exports.Orientation.HORIZONTAL?this.maximumSize:this.maximumOrthogonalSize}get priority(){if(0===this.children.length)return exports.LayoutPriority.Normal;const e=this.children.map((e=>void 0===e.priority?exports.LayoutPriority.Normal:e.priority));return e.some((e=>e===exports.LayoutPriority.High))?exports.LayoutPriority.High:e.some((e=>e===exports.LayoutPriority.Low))?exports.LayoutPriority.Low:exports.LayoutPriority.Normal}get disabled(){return this.splitview.disabled}set disabled(e){this.splitview.disabled=e}get margin(){return this.splitview.margin}set margin(e){this.splitview.margin=e,this.children.forEach((t=>{t instanceof J&&(t.margin=e)}))}constructor(e,t,i,n,o,s,r,a){if(super(),this.orientation=e,this.proportionalLayout=t,this.styles=i,this._childrenDisposable=exports.DockviewDisposable.NONE,this.children=[],this._onDidChange=new p,this.onDidChange=this._onDidChange.event,this._onDidVisibilityChange=new p,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._orthogonalSize=o,this._size=n,this.element=document.createElement("div"),this.element.className="dv-branch-node",a){const e={views:a.map((e=>({view:e.node,size:e.node.size,visible:!(e.node instanceof $&&void 0!==e.visible)||e.visible}))),size:this.orthogonalSize};this.children=a.map((e=>e.node)),this.splitview=new F(this.element,{orientation:this.orientation,descriptor:e,proportionalLayout:t,styles:i,margin:r})}else this.splitview=new F(this.element,{orientation:this.orientation,proportionalLayout:t,styles:i,margin:r}),this.splitview.layout(this.size,this.orthogonalSize);this.disabled=s,this.addDisposables(this._onDidChange,this._onDidVisibilityChange,this.splitview.onDidSashEnd((()=>{this._onDidChange.fire({})}))),this.setupChildrenEvents()}setVisible(e){}isChildVisible(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.isViewVisible(e)}setChildVisible(e,t){if(e<0||e>=this.children.length)throw new Error("Invalid index");if(this.splitview.isViewVisible(e)===t)return;const i=0===this.splitview.contentSize;this.splitview.setViewVisible(e,t);const n=0===this.splitview.contentSize;(t&&i||!t&&n)&&this._onDidVisibilityChange.fire({visible:t})}moveChild(e,t){if(e===t)return;if(e<0||e>=this.children.length)throw new Error("Invalid from index");e<t&&t--,this.splitview.moveView(e,t);const i=this._removeChild(e);this._addChild(i,t)}getChildSize(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewSize(e)}resizeChild(e,t){if(e<0||e>=this.children.length)throw new Error("Invalid index");this.splitview.resizeView(e,t)}layout(e,t){this._size=t,this._orthogonalSize=e,this.splitview.layout(t,e)}addChild(e,t,i,n){if(i<0||i>this.children.length)throw new Error("Invalid index");this.splitview.addView(e,t,i,n),this._addChild(e,i)}getChildCachedVisibleSize(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewCachedVisibleSize(e)}removeChild(e,t){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.removeView(e,t),this._removeChild(e)}_addChild(e,t){this.children.splice(t,0,e),this.setupChildrenEvents()}_removeChild(e){const[t]=this.children.splice(e,1);return this.setupChildrenEvents(),t}setupChildrenEvents(){this._childrenDisposable.dispose(),this._childrenDisposable=new u(exports.DockviewEvent.any(...this.children.map((e=>e.onDidChange)))((e=>{this._onDidChange.fire({size:e.orthogonalSize})})),...this.children.map(((e,t)=>e instanceof J?e.onDidVisibilityChange((({visible:e})=>{this.setChildVisible(t,e)})):exports.DockviewDisposable.NONE)))}dispose(){this._childrenDisposable.dispose(),this.splitview.dispose(),this.children.forEach((e=>e.dispose())),super.dispose()}}function j(e,t){if(e instanceof $)return e;if(e instanceof J)return j(e.children[t?e.children.length-1:0],t);throw new Error("invalid node")}function Z(e,t,i){if(e instanceof J){const n=new J(e.orientation,e.proportionalLayout,e.styles,t,i,e.disabled,e.margin);for(let t=e.children.length-1;t>=0;t--){const i=e.children[t];n.addChild(Z(i,i.size,i.orthogonalSize),i.size,0,!0)}return n}return new $(e.view,e.orientation,i)}function Y(e,t,i){if(e instanceof J){const n=new J(te(e.orientation),e.proportionalLayout,e.styles,t,i,e.disabled,e.margin);let o=0;for(let s=e.children.length-1;s>=0;s--){const r=e.children[s],a=r instanceof J?r.orthogonalSize:r.size;let d=0===e.size?0:Math.round(t*a/e.size);o+=d,0===s&&(d+=t-o),n.addChild(Y(r,i,d),d,0,!0)}return n}return new $(e.view,te(e.orientation),i)}function X(e){const t=e.parentElement;if(!t)throw new Error("Invalid grid element");let i=t.firstElementChild,n=0;for(;i!==e&&i!==t.lastElementChild&&i;)i=i.nextElementSibling,n++;return n}function K(e){const t=e.parentElement;if(!t)throw new Error("Invalid grid element");if(/\bdv-grid-view\b/.test(t.className))return[];const i=X(t);return[...K(t.parentElement.parentElement.parentElement),i]}function q(e,t,i){if(ee(e,t)===Q(i)){const[e,n]=P(t);let o=n;return"right"!==i&&"bottom"!==i||(o+=1),[...e,o]}{const e="right"===i||"bottom"===i?1:0;return[...t,e]}}function Q(e){return"top"===e||"bottom"===e?exports.Orientation.VERTICAL:exports.Orientation.HORIZONTAL}function ee(e,t){return t.length%2==0?te(e):e}const te=e=>e===exports.Orientation.HORIZONTAL?exports.Orientation.VERTICAL:exports.Orientation.HORIZONTAL;function ie(e){return!!e.children}const ne=(e,t)=>{const i=t===exports.Orientation.VERTICAL?e.box.width:e.box.height;return ie(e)?{type:"branch",data:e.children.map((e=>ne(e,te(t)))),size:i}:"number"==typeof e.cachedVisibleSize?{type:"leaf",data:e.view.toJSON(),size:e.cachedVisibleSize,visible:!1}:{type:"leaf",data:e.view.toJSON(),size:i}};class oe{get length(){return this._root?this._root.children.length:0}get orientation(){return this.root.orientation}set orientation(e){if(this.root.orientation===e)return;const{size:t,orthogonalSize:i}=this.root;this.root=Y(this.root,i,t),this.root.layout(t,i)}get width(){return this.root.width}get height(){return this.root.height}get minimumWidth(){return this.root.minimumWidth}get minimumHeight(){return this.root.minimumHeight}get maximumWidth(){return this.root.maximumHeight}get maximumHeight(){return this.root.maximumHeight}get locked(){return this._locked}set locked(e){this._locked=e;const t=[this.root];for(;t.length>0;){const i=t.pop();i instanceof J&&(i.disabled=e,t.push(...i.children))}}get margin(){return this._margin}set margin(e){this._margin=e,this.root.margin=e}maximizedView(){var e;return null===(e=this._maximizedNode)||void 0===e?void 0:e.leaf.view}hasMaximizedView(){return void 0!==this._maximizedNode}maximizeView(e){var t;const i=K(e.element),[n,o]=this.getNode(i);if(!(o instanceof $))return;if((null===(t=this._maximizedNode)||void 0===t?void 0:t.leaf)===o)return;this.hasMaximizedView()&&this.exitMaximizedView(),ne(this.getView(),this.orientation);const s=[];!function e(t,i){for(let n=0;n<t.children.length;n++){const o=t.children[n];o instanceof $?o!==i&&(t.isChildVisible(n)?t.setChildVisible(n,!1):s.push(o)):e(o,i)}}(this.root,o),this._maximizedNode={leaf:o,hiddenOnMaximize:s},this._onDidMaximizedNodeChange.fire({view:o.view,isMaximized:!0})}exitMaximizedView(){if(!this._maximizedNode)return;const e=this._maximizedNode.hiddenOnMaximize;!function t(i){for(let n=i.children.length-1;n>=0;n--){const o=i.children[n];o instanceof $?e.includes(o)||i.setChildVisible(n,!0):t(o)}}(this.root);const t=this._maximizedNode.leaf;this._maximizedNode=void 0,this._onDidMaximizedNodeChange.fire({view:t.view,isMaximized:!1})}serialize(){const e=this.maximizedView();let t;e&&(t=K(e.element)),this.hasMaximizedView()&&this.exitMaximizedView();const i={root:ne(this.getView(),this.orientation),width:this.width,height:this.height,orientation:this.orientation};return t&&(i.maximizedNode={location:t}),e&&this.maximizeView(e),i}dispose(){this.disposable.dispose(),this._onDidChange.dispose(),this._onDidMaximizedNodeChange.dispose(),this._onDidViewVisibilityChange.dispose(),this.root.dispose(),this._maximizedNode=void 0,this.element.remove()}clear(){const e=this.root.orientation;this.root=new J(e,this.proportionalLayout,this.styles,this.root.size,this.root.orthogonalSize,this.locked,this.margin)}deserialize(e,t){const i=e.orientation,n=i===exports.Orientation.VERTICAL?e.height:e.width;if(this._deserialize(e.root,i,t,n),this.layout(e.width,e.height),e.maximizedNode){const t=e.maximizedNode.location,[i,n]=this.getNode(t);if(!(n instanceof $))return;this.maximizeView(n.view)}}_deserialize(e,t,i,n){this.root=this._deserializeNode(e,t,i,n)}_deserializeNode(e,t,i,n){var o;let s;if("branch"===e.type){const o=e.data.map((n=>({node:this._deserializeNode(n,te(t),i,e.size),visible:n.visible})));s=new J(t,this.proportionalLayout,this.styles,e.size,n,this.locked,this.margin,o)}else{const r=i.fromJSON(e);"boolean"==typeof e.visible&&(null===(o=r.setVisible)||void 0===o||o.call(r,e.visible)),s=new $(r,t,n,e.size)}return s}get root(){return this._root}set root(e){const t=this._root;t&&(t.dispose(),this._maximizedNode=void 0,this.element.removeChild(t.element)),this._root=e,this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange((e=>{this._onDidChange.fire(e)}))}normalize(){if(!this._root)return;if(1!==this._root.children.length)return;const e=this.root,t=e.children[0];if(t instanceof $)return;e.element.remove();const i=e.removeChild(0);e.dispose(),i.dispose(),this._root=Z(t,t.size,t.orthogonalSize),this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange((e=>{this._onDidChange.fire(e)}))}insertOrthogonalSplitviewAtRoot(){if(!this._root)return;const e=this.root;if(e.element.remove(),this._root=new J(te(e.orientation),this.proportionalLayout,this.styles,this.root.orthogonalSize,this.root.size,this.locked,this.margin),0===e.children.length);else if(1===e.children.length){const t=e.children[0];e.removeChild(0).dispose(),e.dispose(),this._root.addChild(Y(t,t.orthogonalSize,t.size),exports.Sizing.Distribute,0)}else this._root.addChild(e,exports.Sizing.Distribute,0);this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange((e=>{this._onDidChange.fire(e)}))}next(e){return this.progmaticSelect(e)}previous(e){return this.progmaticSelect(e,!0)}getView(e){const t=e?this.getNode(e)[1]:this.root;return this._getViews(t,this.orientation)}_getViews(e,t,i){const n={height:e.height,width:e.width};if(e instanceof $)return{box:n,view:e.view,cachedVisibleSize:i};const o=[];for(let i=0;i<e.children.length;i++){const n=e.children[i],s=e.getChildCachedVisibleSize(i);o.push(this._getViews(n,te(t),s))}return{box:n,children:o}}progmaticSelect(e,t=!1){const[i,n]=this.getNode(e);if(!(n instanceof $))throw new Error("invalid location");for(let n=i.length-1;n>-1;n--){const o=i[n],s=e[n]||0;if(t?s-1>-1:s+1<o.children.length)return j(o.children[t?s-1:s+1],t)}return j(this.root,t)}constructor(e,t,i,n,o){this.proportionalLayout=e,this.styles=t,this._locked=!1,this._margin=0,this._maximizedNode=void 0,this.disposable=new m,this._onDidChange=new p,this.onDidChange=this._onDidChange.event,this._onDidViewVisibilityChange=new p,this.onDidViewVisibilityChange=this._onDidViewVisibilityChange.event,this._onDidMaximizedNodeChange=new p,this.onDidMaximizedNodeChange=this._onDidMaximizedNodeChange.event,this.element=document.createElement("div"),this.element.className="dv-grid-view",this._locked=null!=n&&n,this._margin=null!=o?o:0,this.root=new J(i,e,t,0,0,this.locked,this.margin)}isViewVisible(e){const[t,i]=P(e),[,n]=this.getNode(t);if(!(n instanceof J))throw new Error("Invalid from location");return n.isChildVisible(i)}setViewVisible(e,t){this.hasMaximizedView()&&this.exitMaximizedView();const[i,n]=P(e),[,o]=this.getNode(i);if(!(o instanceof J))throw new Error("Invalid from location");this._onDidViewVisibilityChange.fire(),o.setChildVisible(n,t)}moveView(e,t,i){this.hasMaximizedView()&&this.exitMaximizedView();const[,n]=this.getNode(e);if(!(n instanceof J))throw new Error("Invalid location");n.moveChild(t,i)}addView(e,t,i){this.hasMaximizedView()&&this.exitMaximizedView();const[n,o]=P(i),[s,r]=this.getNode(n);if(r instanceof J){const i=new $(e,te(r.orientation),r.orthogonalSize);r.addChild(i,t,o)}else{const[i,...a]=[...s].reverse(),[d,...h]=[...n].reverse();let l=0;const p=i.getChildCachedVisibleSize(d);"number"==typeof p&&(l=exports.Sizing.Invisible(p));i.removeChild(d).dispose();const c=new J(r.orientation,this.proportionalLayout,this.styles,r.size,r.orthogonalSize,this.locked,this.margin);i.addChild(c,r.size,d);const v=new $(r.view,i.orientation,r.size);c.addChild(v,l,0),"number"!=typeof t&&"split"===t.type&&(t={type:"split",index:0});const u=new $(e,i.orientation,r.size);c.addChild(u,t,o)}}remove(e,t){const i=K(e.element);return this.removeView(i,t)}removeView(e,t){this.hasMaximizedView()&&this.exitMaximizedView();const[i,n]=P(e),[o,s]=this.getNode(i);if(!(s instanceof J))throw new Error("Invalid location");const r=s.children[n];if(!(r instanceof $))throw new Error("Invalid location");if(s.removeChild(n,t),r.dispose(),1!==s.children.length)return r.view;const a=s.children[0];if(0===o.length)return a instanceof $||(s.removeChild(0,t),this.root=a),r.view;const[d,...h]=[...o].reverse(),[l,...p]=[...i].reverse(),c=s.isChildVisible(0);s.removeChild(0,t);const v=d.children.map(((e,t)=>d.getChildSize(t)));if(d.removeChild(l,t).dispose(),a instanceof J){v.splice(l,1,...a.children.map((e=>e.size)));for(let e=0;e<a.children.length;e++){const t=a.children[e];d.addChild(t,t.size,l+e)}for(;a.children.length>0;)a.removeChild(0)}else{const e=new $(a.view,te(a.orientation),a.size),t=c?a.orthogonalSize:exports.Sizing.Invisible(a.orthogonalSize);d.addChild(e,t,l)}a.dispose();for(let e=0;e<v.length;e++)d.resizeChild(e,v[e]);return r.view}layout(e,t){const[i,n]=this.root.orientation===exports.Orientation.HORIZONTAL?[t,e]:[e,t];this.root.layout(i,n)}getNode(e,t=this.root,i=[]){if(0===e.length)return[i,t];if(!(t instanceof J))throw new Error("Invalid location");const[n,...o]=e;if(n<0||n>=t.children.length)throw new Error("Invalid location");const s=t.children[n];return i.push(t),this.getNode(o,s,i)}}const se=(()=>{const e={disableAutoResizing:void 0,proportionalLayout:void 0,orientation:void 0,hideBorders:void 0,className:void 0};return Object.keys(e)})();class re extends u{get element(){return this._element}get disableResizing(){return this._disableResizing}set disableResizing(e){this._disableResizing=e}constructor(e,t=!1){super(),this._disableResizing=t,this._element=e,this.addDisposables(b(this._element,(e=>{if(this.isDisposed)return;if(this.disableResizing)return;if(!this._element.offsetParent)return;if(!function(e){let t=e;for(;null==t?void 0:t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof DocumentFragment?t.parentNode.host:t.parentNode}return!1}(this._element))return;const{width:t,height:i}=e.contentRect;this.layout(t,i)})))}}const ae=N();function de(e){switch(e){case"left":return"left";case"right":return"right";case"above":return"top";case"below":return"bottom";default:return"center"}}class he extends re{get id(){return this._id}get size(){return this._groups.size}get groups(){return Array.from(this._groups.values()).map((e=>e.value))}get width(){return this.gridview.width}get height(){return this.gridview.height}get minimumHeight(){return this.gridview.minimumHeight}get maximumHeight(){return this.gridview.maximumHeight}get minimumWidth(){return this.gridview.minimumWidth}get maximumWidth(){return this.gridview.maximumWidth}get activeGroup(){return this._activeGroup}get locked(){return this.gridview.locked}set locked(e){this.gridview.locked=e}constructor(e,t){var i;super(document.createElement("div"),t.disableAutoResizing),this._id=ae.next(),this._groups=new Map,this._onDidRemove=new p,this.onDidRemove=this._onDidRemove.event,this._onDidAdd=new p,this.onDidAdd=this._onDidAdd.event,this._onDidMaximizedChange=new p,this.onDidMaximizedChange=this._onDidMaximizedChange.event,this._onDidActiveChange=new p,this.onDidActiveChange=this._onDidActiveChange.event,this._bufferOnDidLayoutChange=new v,this.onDidLayoutChange=this._bufferOnDidLayoutChange.onEvent,this._onDidViewVisibilityChangeMicroTaskQueue=new v,this.onDidViewVisibilityChangeMicroTaskQueue=this._onDidViewVisibilityChangeMicroTaskQueue.onEvent,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new k(this.element),this._classNames.setClassNames(null!==(i=t.className)&&void 0!==i?i:""),e.appendChild(this.element),this.gridview=new oe(!!t.proportionalLayout,t.styles,t.orientation,t.locked,t.margin),this.gridview.locked=!!t.locked,this.element.appendChild(this.gridview.element),this.layout(0,0,!0),this.addDisposables(this.gridview.onDidMaximizedNodeChange((e=>{this._onDidMaximizedChange.fire({panel:e.view,isMaximized:e.isMaximized})})),this.gridview.onDidViewVisibilityChange((()=>this._onDidViewVisibilityChangeMicroTaskQueue.fire())),this.onDidViewVisibilityChangeMicroTaskQueue((()=>{this.layout(this.width,this.height,!0)})),exports.DockviewDisposable.from((()=>{var e;null===(e=this.element.parentElement)||void 0===e||e.removeChild(this.element)})),this.gridview.onDidChange((()=>{this._bufferOnDidLayoutChange.fire()})),exports.DockviewEvent.any(this.onDidAdd,this.onDidRemove,this.onDidActiveChange)((()=>{this._bufferOnDidLayoutChange.fire()})),this._onDidMaximizedChange,this._onDidViewVisibilityChangeMicroTaskQueue,this._bufferOnDidLayoutChange)}setVisible(e,t){this.gridview.setViewVisible(K(e.element),t),this._bufferOnDidLayoutChange.fire()}isVisible(e){return this.gridview.isViewVisible(K(e.element))}updateOptions(e){var t,i,n,o;e.proportionalLayout,e.orientation&&(this.gridview.orientation=e.orientation),"disableResizing"in e&&(this.disableResizing=null!==(t=e.disableAutoResizing)&&void 0!==t&&t),"locked"in e&&(this.locked=null!==(i=e.locked)&&void 0!==i&&i),"margin"in e&&(this.gridview.margin=null!==(n=e.margin)&&void 0!==n?n:0),"className"in e&&this._classNames.setClassNames(null!==(o=e.className)&&void 0!==o?o:"")}maximizeGroup(e){this.gridview.maximizeView(e),this.doSetGroupActive(e)}isMaximizedGroup(e){return this.gridview.maximizedView()===e}exitMaximizedGroup(){this.gridview.exitMaximizedView()}hasMaximizedGroup(){return this.gridview.hasMaximizedView()}doAddGroup(e,t=[0],i){this.gridview.addView(e,null!=i?i:exports.Sizing.Distribute,t),this._onDidAdd.fire(e)}doRemoveGroup(e,t){if(!this._groups.has(e.id))throw new Error("invalid operation");const i=this._groups.get(e.id),n=this.gridview.remove(e,exports.Sizing.Distribute);if(i&&!(null==t?void 0:t.skipDispose)&&(i.disposable.dispose(),i.value.dispose(),this._groups.delete(e.id),this._onDidRemove.fire(e)),!(null==t?void 0:t.skipActive)&&this._activeGroup===e){const e=Array.from(this._groups.values());this.doSetGroupActive(e.length>0?e[0].value:void 0)}return n}getPanel(e){var t;return null===(t=this._groups.get(e))||void 0===t?void 0:t.value}doSetGroupActive(e){this._activeGroup!==e&&(this._activeGroup&&this._activeGroup.setActive(!1),e&&e.setActive(!0),this._activeGroup=e,this._onDidActiveChange.fire(e))}removeGroup(e){this.doRemoveGroup(e)}moveToNext(e){var t;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const i=K(e.group.element),n=null===(t=this.gridview.next(i))||void 0===t?void 0:t.view;this.doSetGroupActive(n)}moveToPrevious(e){var t;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const i=K(e.group.element),n=null===(t=this.gridview.previous(i))||void 0===t?void 0:t.view;this.doSetGroupActive(n)}layout(e,t,i){(i||e!==this.width||t!==this.height)&&(this.gridview.element.style.height=`${t}px`,this.gridview.element.style.width=`${e}px`,this.gridview.layout(e,t))}dispose(){this._onDidActiveChange.dispose(),this._onDidAdd.dispose(),this._onDidRemove.dispose();for(const e of this.groups)e.dispose();this.gridview.dispose(),super.dispose()}}class le{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get length(){return this.component.length}get orientation(){return this.component.orientation}get panels(){return this.component.panels}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}constructor(e){this.component=e}removePanel(e,t){this.component.removePanel(e,t)}focus(){this.component.focus()}getPanel(e){return this.component.getPanel(e)}layout(e,t){return this.component.layout(e,t)}addPanel(e){return this.component.addPanel(e)}movePanel(e,t){this.component.movePanel(e,t)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class pe{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get panels(){return this.component.panels}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}get onDidDrop(){return this.component.onDidDrop}get onUnhandledDragOverEvent(){return this.component.onUnhandledDragOverEvent}constructor(e){this.component=e}removePanel(e){this.component.removePanel(e)}getPanel(e){return this.component.getPanel(e)}movePanel(e,t){this.component.movePanel(e,t)}focus(){this.component.focus()}layout(e,t){this.component.layout(e,t)}addPanel(e){return this.component.addPanel(e)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class ce{get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddPanel(){return this.component.onDidAddGroup}get onDidRemovePanel(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActiveGroupChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get panels(){return this.component.groups}get orientation(){return this.component.orientation}set orientation(e){this.component.updateOptions({orientation:e})}constructor(e){this.component=e}focus(){this.component.focus()}layout(e,t,i=!1){this.component.layout(e,t,i)}addPanel(e){return this.component.addPanel(e)}removePanel(e,t){this.component.removePanel(e,t)}movePanel(e,t){this.component.movePanel(e,t)}getPanel(e){return this.component.getPanel(e)}fromJSON(e){return this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class ve{get id(){return this.component.id}get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get size(){return this.component.size}get totalPanels(){return this.component.totalPanels}get onDidActiveGroupChange(){return this.component.onDidActiveGroupChange}get onDidAddGroup(){return this.component.onDidAddGroup}get onDidRemoveGroup(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActivePanelChange}get onDidAddPanel(){return this.component.onDidAddPanel}get onDidRemovePanel(){return this.component.onDidRemovePanel}get onDidMovePanel(){return this.component.onDidMovePanel}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidDrop(){return this.component.onDidDrop}get onWillDrop(){return this.component.onWillDrop}get onWillShowOverlay(){return this.component.onWillShowOverlay}get onWillDragGroup(){return this.component.onWillDragGroup}get onWillDragPanel(){return this.component.onWillDragPanel}get onUnhandledDragOverEvent(){return this.component.onUnhandledDragOverEvent}get onDidPopoutGroupSizeChange(){return this.component.onDidPopoutGroupSizeChange}get onDidPopoutGroupPositionChange(){return this.component.onDidPopoutGroupPositionChange}get onDidOpenPopoutWindowFail(){return this.component.onDidOpenPopoutWindowFail}get panels(){return this.component.panels}get groups(){return this.component.groups}get activePanel(){return this.component.activePanel}get activeGroup(){return this.component.activeGroup}constructor(e){this.component=e}focus(){this.component.focus()}getPanel(e){return this.component.getGroupPanel(e)}layout(e,t,i=!1){this.component.layout(e,t,i)}addPanel(e){return this.component.addPanel(e)}removePanel(e){this.component.removePanel(e)}addGroup(e){return this.component.addGroup(e)}closeAllGroups(){return this.component.closeAllGroups()}removeGroup(e){this.component.removeGroup(e)}getGroup(e){return this.component.getPanel(e)}addFloatingGroup(e,t){return this.component.addFloatingGroup(e,t)}fromJSON(e,t){this.component.fromJSON(e,t)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}moveToNext(e){this.component.moveToNext(e)}moveToPrevious(e){this.component.moveToPrevious(e)}maximizeGroup(e){this.component.maximizeGroup(e.group)}hasMaximizedGroup(){return this.component.hasMaximizedGroup()}exitMaximizedGroup(){this.component.exitMaximizedGroup()}get onDidMaximizedGroupChange(){return this.component.onDidMaximizedGroupChange}addPopoutGroup(e,t){return this.component.addPopoutGroup(e,t)}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class ue extends u{constructor(e,t){super(),this.el=e,this.disabled=t,this.dataDisposable=new m,this.pointerEventsDisposable=new m,this._onDragStart=new p,this.onDragStart=this._onDragStart.event,this.addDisposables(this._onDragStart,this.dataDisposable,this.pointerEventsDisposable),this.configure()}setDisabled(e){this.disabled=e}isCancelled(e){return!1}configure(){this.addDisposables(this._onDragStart,c(this.el,"dragstart",(e=>{if(e.defaultPrevented||this.isCancelled(e)||this.disabled)return void e.preventDefault();const t=A();if(this.pointerEventsDisposable.value={dispose:()=>{t.release()}},this.el.classList.add("dv-dragged"),setTimeout((()=>this.el.classList.remove("dv-dragged")),0),this.dataDisposable.value=this.getData(e),this._onDragStart.fire(e),e.dataTransfer){e.dataTransfer.effectAllowed="move";e.dataTransfer.items.length>0||e.dataTransfer.setData("text/plain","")}})),c(this.el,"dragend",(()=>{this.pointerEventsDisposable.dispose(),setTimeout((()=>{this.dataDisposable.dispose()}),0)})))}}class me extends u{constructor(e,t){super(),this.element=e,this.callbacks=t,this.target=null,this.registerListeners()}onDragEnter(e){this.target=e.target,this.callbacks.onDragEnter(e)}onDragOver(e){e.preventDefault(),this.callbacks.onDragOver&&this.callbacks.onDragOver(e)}onDragLeave(e){this.target===e.target&&(this.target=null,this.callbacks.onDragLeave(e))}onDragEnd(e){this.target=null,this.callbacks.onDragEnd(e)}onDrop(e){this.callbacks.onDrop(e)}registerListeners(){this.addDisposables(c(this.element,"dragenter",(e=>{this.onDragEnter(e)}),!0)),this.addDisposables(c(this.element,"dragover",(e=>{this.onDragOver(e)}),!0)),this.addDisposables(c(this.element,"dragleave",(e=>{this.onDragLeave(e)}))),this.addDisposables(c(this.element,"dragend",(e=>{this.onDragEnd(e)}))),this.addDisposables(c(this.element,"drop",(e=>{this.onDrop(e)})))}}class ge extends a{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}constructor(e){super(),this.options=e}}function be(e){switch(e){case"above":return"top";case"below":return"bottom";case"left":return"left";case"right":return"right";case"within":return"center";default:throw new Error(`invalid direction '${e}'`)}}function we(e){switch(e){case"top":return"above";case"bottom":return"below";case"left":return"left";case"right":return"right";case"center":return"within";default:throw new Error(`invalid position '${e}'`)}}const fe={value:20,type:"percentage"},_e={value:50,type:"percentage"};class xe extends u{get disabled(){return this._disabled}set disabled(e){this._disabled=e}get state(){return this._state}constructor(e,t){super(),this.element=e,this.options=t,this._onDrop=new p,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new p,this.onWillShowOverlay=this._onWillShowOverlay.event,this._disabled=!1,this._acceptedTargetZonesSet=new Set(this.options.acceptedTargetZones),this.dnd=new me(this.element,{onDragEnter:()=>{var e,t,i;null===(i=null===(t=(e=this.options).getOverrideTarget)||void 0===t?void 0:t.call(e))||void 0===i||i.getElements()},onDragOver:e=>{var t,i,n,o,s,r,a;xe.ACTUAL_TARGET=this;const d=null===(i=(t=this.options).getOverrideTarget)||void 0===i?void 0:i.call(t);if(0===this._acceptedTargetZonesSet.size){if(d)return;return void this.removeDropTarget()}const h=null!==(s=null===(o=(n=this.options).getOverlayOutline)||void 0===o?void 0:o.call(n))&&void 0!==s?s:this.element,l=h.offsetWidth,p=h.offsetHeight;if(0===l||0===p)return;const c=e.currentTarget.getBoundingClientRect(),v=(null!==(r=e.clientX)&&void 0!==r?r:0)-c.left,u=(null!==(a=e.clientY)&&void 0!==a?a:0)-c.top,m=this.calculateQuadrant(this._acceptedTargetZonesSet,v,u,l,p);if(this.isAlreadyUsed(e)||null===m)return void this.removeDropTarget();if(!this.options.canDisplayOverlay(e,m)){if(d)return;return void this.removeDropTarget()}const g=new ge({nativeEvent:e,position:m});this._onWillShowOverlay.fire(g),g.defaultPrevented?this.removeDropTarget():(this.markAsUsed(e),d||this.targetElement||(this.targetElement=document.createElement("div"),this.targetElement.className="dv-drop-target-dropzone",this.overlayElement=document.createElement("div"),this.overlayElement.className="dv-drop-target-selection",this._state="center",this.targetElement.appendChild(this.overlayElement),h.classList.add("dv-drop-target"),h.append(this.targetElement)),this.toggleClasses(m,l,p),this._state=m)},onDragLeave:()=>{var e,t;(null===(t=(e=this.options).getOverrideTarget)||void 0===t?void 0:t.call(e))||this.removeDropTarget()},onDragEnd:e=>{var t,i;const n=null===(i=(t=this.options).getOverrideTarget)||void 0===i?void 0:i.call(t);n&&xe.ACTUAL_TARGET===this&&this._state&&(e.stopPropagation(),this._onDrop.fire({position:this._state,nativeEvent:e})),this.removeDropTarget(),null==n||n.clear()},onDrop:e=>{var t,i,n;e.preventDefault();const o=this._state;this.removeDropTarget(),null===(n=null===(i=(t=this.options).getOverrideTarget)||void 0===i?void 0:i.call(t))||void 0===n||n.clear(),o&&(e.stopPropagation(),this._onDrop.fire({position:o,nativeEvent:e}))}}),this.addDisposables(this._onDrop,this._onWillShowOverlay,this.dnd)}setTargetZones(e){this._acceptedTargetZonesSet=new Set(e)}setOverlayModel(e){this.options.overlayModel=e}dispose(){this.removeDropTarget(),super.dispose()}markAsUsed(e){e[xe.USED_EVENT_ID]=!0}isAlreadyUsed(e){const t=e[xe.USED_EVENT_ID];return"boolean"==typeof t&&t}toggleClasses(e,t,i){var n,o,s,r,a,d,h;const l=null===(o=(n=this.options).getOverrideTarget)||void 0===o?void 0:o.call(n);if(!l&&!this.overlayElement)return;const p=t<100,c=i<100,v="left"===e,u="right"===e,m="top"===e,g="bottom"===e,b=!p&&u,w=!p&&v,f=!c&&m,x=!c&&g;let D=1;const y=null!==(r=null===(s=this.options.overlayModel)||void 0===s?void 0:s.size)&&void 0!==r?r:_e;if("percentage"===y.type?D=V(y.value,0,100)/100:((b||w)&&(D=V(0,y.value,t)/t),(f||x)&&(D=V(0,y.value,i)/i)),l){const n=null!==(h=null===(d=(a=this.options).getOverlayOutline)||void 0===d?void 0:d.call(a))&&void 0!==h?h:this.element,o=n.getBoundingClientRect(),s=l.getElements(void 0,n),r=s.root,c=s.overlay,y=r.getBoundingClientRect(),C=o.top-y.top,z=o.left-y.left,S={top:C,left:z,width:t,height:i};if(b?(S.left=z+t*(1-D),S.width=t*D):w?S.width=t*D:f?S.height=i*D:x&&(S.top=C+i*(1-D),S.height=i*D),p&&v&&(S.width=4),p&&u&&(S.left=z+t-4,S.width=4),!function(e,t){const{top:i,left:n,width:o,height:s}=t,r=`${Math.round(i)}px`,a=`${Math.round(n)}px`,d=`${Math.round(o)}px`,h=`${Math.round(s)}px`;return e.style.top!==r||e.style.left!==a||e.style.width!==d||e.style.height!==h}(c,S))return;return function(e,t){const{top:i,left:n,width:o,height:s}=t,r=`${Math.round(i)}px`,a=`${Math.round(n)}px`,d=`${Math.round(o)}px`,h=`${Math.round(s)}px`;e.style.top=r,e.style.left=a,e.style.width=d,e.style.height=h,e.style.visibility="visible",e.style.transform&&""!==e.style.transform||(e.style.transform="translate3d(0, 0, 0)")}(c,S),c.className="dv-drop-target-anchor"+(this.options.className?` ${this.options.className}`:""),_(c,"dv-drop-target-left",v),_(c,"dv-drop-target-right",u),_(c,"dv-drop-target-top",m),_(c,"dv-drop-target-bottom",g),_(c,"dv-drop-target-center","center"===e),void(s.changed&&(_(c,"dv-drop-target-anchor-container-changed",!0),setTimeout((()=>{_(c,"dv-drop-target-anchor-container-changed",!1)}),10)))}if(!this.overlayElement)return;const C={top:"0px",left:"0px",width:"100%",height:"100%"};b?(C.left=100*(1-D)+"%",C.width=100*D+"%"):w?C.width=100*D+"%":f?C.height=100*D+"%":x&&(C.top=100*(1-D)+"%",C.height=100*D+"%"),function(e,t){const{top:i,left:n,width:o,height:s}=t;e.style.top=i,e.style.left=n,e.style.width=o,e.style.height=s,e.style.visibility="visible",e.style.transform&&""!==e.style.transform||(e.style.transform="translate3d(0, 0, 0)")}(this.overlayElement,C),_(this.overlayElement,"dv-drop-target-small-vertical",c),_(this.overlayElement,"dv-drop-target-small-horizontal",p),_(this.overlayElement,"dv-drop-target-left",v),_(this.overlayElement,"dv-drop-target-right",u),_(this.overlayElement,"dv-drop-target-top",m),_(this.overlayElement,"dv-drop-target-bottom",g),_(this.overlayElement,"dv-drop-target-center","center"===e)}calculateQuadrant(e,t,i,n,o){var s,r;const a=null!==(r=null===(s=this.options.overlayModel)||void 0===s?void 0:s.activationSize)&&void 0!==r?r:fe;return"percentage"===a.type?function(e,t,i,n,o,s){const r=100*t/n,a=100*i/o;if(e.has("left")&&r<s)return"left";if(e.has("right")&&r>100-s)return"right";if(e.has("top")&&a<s)return"top";if(e.has("bottom")&&a>100-s)return"bottom";if(!e.has("center"))return null;return"center"}(e,t,i,n,o,a.value):function(e,t,i,n,o,s){if(e.has("left")&&t<s)return"left";if(e.has("right")&&t>n-s)return"right";if(e.has("top")&&i<s)return"top";if(e.has("bottom")&&i>o-s)return"bottom";if(!e.has("center"))return null;return"center"}(e,t,i,n,o,a.value)}removeDropTarget(){var e;this.targetElement&&(this._state=void 0,null===(e=this.targetElement.parentElement)||void 0===e||e.classList.remove("dv-drop-target"),this.targetElement.remove(),this.targetElement=void 0,this.overlayElement=void 0)}}xe.USED_EVENT_ID="__dockview_droptarget_event_is_used__";const De=(()=>{const e={disableAutoResizing:void 0,disableDnd:void 0,className:void 0};return Object.keys(e)})();class ye extends d{constructor(e,t,i,n){super(),this.nativeEvent=e,this.position=t,this.getData=i,this.panel=n}}class Ce extends a{constructor(){super()}}class ze extends u{get isFocused(){return this._isFocused}get isActive(){return this._isActive}get isVisible(){return this._isVisible}get width(){return this._width}get height(){return this._height}constructor(e,t){super(),this.id=e,this.component=t,this._isFocused=!1,this._isActive=!1,this._isVisible=!0,this._width=0,this._height=0,this._parameters={},this.panelUpdatesDisposable=new m,this._onDidDimensionChange=new p,this.onDidDimensionsChange=this._onDidDimensionChange.event,this._onDidChangeFocus=new p,this.onDidFocusChange=this._onDidChangeFocus.event,this._onWillFocus=new p,this.onWillFocus=this._onWillFocus.event,this._onDidVisibilityChange=new p,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._onWillVisibilityChange=new p,this.onWillVisibilityChange=this._onWillVisibilityChange.event,this._onDidActiveChange=new p,this.onDidActiveChange=this._onDidActiveChange.event,this._onActiveChange=new p,this.onActiveChange=this._onActiveChange.event,this._onDidParametersChange=new p,this.onDidParametersChange=this._onDidParametersChange.event,this.addDisposables(this.onDidFocusChange((e=>{this._isFocused=e.isFocused})),this.onDidActiveChange((e=>{this._isActive=e.isActive})),this.onDidVisibilityChange((e=>{this._isVisible=e.isVisible})),this.onDidDimensionsChange((e=>{this._width=e.width,this._height=e.height})),this.panelUpdatesDisposable,this._onDidDimensionChange,this._onDidChangeFocus,this._onDidVisibilityChange,this._onDidActiveChange,this._onWillFocus,this._onActiveChange,this._onWillFocus,this._onWillVisibilityChange,this._onDidParametersChange)}getParameters(){return this._parameters}initialize(e){this.panelUpdatesDisposable.value=this._onDidParametersChange.event((t=>{this._parameters=t,e.update({params:t})}))}setVisible(e){this._onWillVisibilityChange.fire({isVisible:e})}setActive(){this._onActiveChange.fire()}updateParameters(e){this._onDidParametersChange.fire(e)}}class Se extends ze{constructor(e,t){super(e,t),this._onDidConstraintsChangeInternal=new p,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new p({replay:!0}),this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new p,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}}class Ae extends Se{set pane(e){this._pane=e}constructor(e,t){super(e,t),this._onDidExpansionChange=new p({replay:!0}),this.onDidExpansionChange=this._onDidExpansionChange.event,this._onMouseEnter=new p({}),this.onMouseEnter=this._onMouseEnter.event,this._onMouseLeave=new p({}),this.onMouseLeave=this._onMouseLeave.event,this.addDisposables(this._onDidExpansionChange,this._onMouseEnter,this._onMouseLeave)}setExpanded(e){var t;null===(t=this._pane)||void 0===t||t.setExpanded(e)}get isExpanded(){var e;return!!(null===(e=this._pane)||void 0===e?void 0:e.isExpanded())}}class ke extends u{get element(){return this._element}get width(){return this._width}get height(){return this._height}get params(){var e;return null===(e=this._params)||void 0===e?void 0:e.params}constructor(e,t,i){super(),this.id=e,this.component=t,this.api=i,this._height=0,this._width=0,this._element=document.createElement("div"),this._element.tabIndex=-1,this._element.style.outline="none",this._element.style.height="100%",this._element.style.width="100%",this._element.style.overflow="hidden";const n=D(this._element);this.addDisposables(this.api,n.onDidFocus((()=>{this.api._onDidChangeFocus.fire({isFocused:!0})})),n.onDidBlur((()=>{this.api._onDidChangeFocus.fire({isFocused:!1})})),n)}focus(){const e=new Ce;this.api._onWillFocus.fire(e),e.defaultPrevented||this._element.focus()}layout(e,t){this._width=e,this._height=t,this.api._onDidDimensionChange.fire({width:e,height:t}),this.part&&this._params&&this.part.update(this._params.params)}init(e){this._params=e,this.part=this.getComponent()}update(e){var t,i;this._params=Object.assign(Object.assign({},this._params),{params:Object.assign(Object.assign({},null===(t=this._params)||void 0===t?void 0:t.params),e.params)});for(const t of Object.keys(e.params))void 0===e.params[t]&&delete this._params.params[t];null===(i=this.part)||void 0===i||i.update({params:this._params.params})}toJSON(){var e,t;const i=null!==(t=null===(e=this._params)||void 0===e?void 0:e.params)&&void 0!==t?t:{};return{id:this.id,component:this.component,params:Object.keys(i).length>0?i:void 0}}dispose(){var e;this.api.dispose(),null===(e=this.part)||void 0===e||e.dispose(),super.dispose()}}class Pe extends ke{set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){return this.headerSize+(this.isExpanded()?this._minimumBodySize:0)}get maximumSize(){return this.headerSize+(this.isExpanded()?this._maximumBodySize:0)}get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get minimumBodySize(){return this._minimumBodySize}set minimumBodySize(e){this._minimumBodySize="number"==typeof e?e:0}get maximumBodySize(){return this._maximumBodySize}set maximumBodySize(e){this._maximumBodySize="number"==typeof e?e:Number.POSITIVE_INFINITY}get headerVisible(){return this._headerVisible}set headerVisible(e){this._headerVisible=e,this.header.style.display=e?"":"none"}constructor(e){super(e.id,e.component,new Ae(e.id,e.component)),this._onDidChangeExpansionState=new p({replay:!0}),this.onDidChangeExpansionState=this._onDidChangeExpansionState.event,this._onDidChange=new p,this.onDidChange=this._onDidChange.event,this._orthogonalSize=0,this._size=0,this._isExpanded=!1,this.api.pane=this,this.api.initialize(this),this.headerSize=e.headerSize,this.headerComponent=e.headerComponent,this._minimumBodySize=e.minimumBodySize,this._maximumBodySize=e.maximumBodySize,this._isExpanded=e.isExpanded,this._headerVisible=e.isHeaderVisible,this._onDidChangeExpansionState.fire(this.isExpanded()),this._orientation=e.orientation,this.element.classList.add("dv-pane"),this.addDisposables(this.api.onWillVisibilityChange((e=>{const{isVisible:t}=e,{accessor:i}=this._params;i.setVisible(this,t)})),this.api.onDidSizeChange((e=>{this._onDidChange.fire({size:e.size})})),c(this.element,"mouseenter",(e=>{this.api._onMouseEnter.fire(e)})),c(this.element,"mouseleave",(e=>{this.api._onMouseLeave.fire(e)}))),this.addDisposables(this._onDidChangeExpansionState,this.onDidChangeExpansionState((e=>{this.api._onDidExpansionChange.fire({isExpanded:e})})),this.api.onDidFocusChange((e=>{this.header&&(e.isFocused?f(this.header,"focused"):w(this.header,"focused"))}))),this.renderOnce()}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}isExpanded(){return this._isExpanded}setExpanded(e){this._isExpanded!==e&&(this._isExpanded=e,e?(this.animationTimer&&clearTimeout(this.animationTimer),this.body&&this.element.appendChild(this.body)):this.animationTimer=setTimeout((()=>{var e;null===(e=this.body)||void 0===e||e.remove()}),200),this._onDidChange.fire(e?{size:this.width}:{}),this._onDidChangeExpansionState.fire(e))}layout(e,t){this._size=e,this._orthogonalSize=t;const[i,n]=this.orientation===exports.Orientation.HORIZONTAL?[e,t]:[t,e];super.layout(i,n)}init(e){var t,i;super.init(e),"number"==typeof e.minimumBodySize&&(this.minimumBodySize=e.minimumBodySize),"number"==typeof e.maximumBodySize&&(this.maximumBodySize=e.maximumBodySize),this.bodyPart=this.getBodyComponent(),this.headerPart=this.getHeaderComponent(),this.bodyPart.init(Object.assign(Object.assign({},e),{api:this.api})),this.headerPart.init(Object.assign(Object.assign({},e),{api:this.api})),null===(t=this.body)||void 0===t||t.append(this.bodyPart.element),null===(i=this.header)||void 0===i||i.append(this.headerPart.element),"boolean"==typeof e.isExpanded&&this.setExpanded(e.isExpanded)}toJSON(){const e=this._params;return Object.assign(Object.assign({},super.toJSON()),{headerComponent:this.headerComponent,title:e.title})}renderOnce(){this.header=document.createElement("div"),this.header.tabIndex=0,this.header.className="dv-pane-header",this.header.style.height=`${this.headerSize}px`,this.header.style.lineHeight=`${this.headerSize}px`,this.header.style.minHeight=`${this.headerSize}px`,this.header.style.maxHeight=`${this.headerSize}px`,this.element.appendChild(this.header),this.body=document.createElement("div"),this.body.className="dv-pane-body",this.element.appendChild(this.body)}getComponent(){return{update:e=>{var t,i;null===(t=this.bodyPart)||void 0===t||t.update({params:e}),null===(i=this.headerPart)||void 0===i||i.update({params:e})},dispose:()=>{var e,t;null===(e=this.bodyPart)||void 0===e||e.dispose(),null===(t=this.headerPart)||void 0===t||t.dispose()}}}}class Ee extends Pe{constructor(e){super({id:e.id,component:e.component,headerComponent:e.headerComponent,orientation:e.orientation,isExpanded:e.isExpanded,isHeaderVisible:!0,headerSize:e.headerSize,minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize}),this._onDidDrop=new p,this.onDidDrop=this._onDidDrop.event,this._onUnhandledDragOverEvent=new p,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this.accessor=e.accessor,this.addDisposables(this._onDidDrop,this._onUnhandledDragOverEvent),e.disableDnd||this.initDragFeatures()}initDragFeatures(){if(!this.header)return;const e=this.id,t=this.accessor.id;this.header.draggable=!0,this.handler=new class extends ue{getData(){return o.getInstance().setData([new n(t,e)],n.prototype),{dispose:()=>{o.getInstance().clearData(n.prototype)}}}}(this.header),this.target=new xe(this.element,{acceptedTargetZones:["top","bottom"],overlayModel:{activationSize:{type:"percentage",value:50}},canDisplayOverlay:(e,t)=>{const i=r();if(i&&i.paneId!==this.id&&i.viewId===this.accessor.id)return!0;const n=new ye(e,t,r,this);return this._onUnhandledDragOverEvent.fire(n),n.isAccepted}}),this.addDisposables(this._onDidDrop,this.handler,this.target,this.target.onDrop((e=>{this.onDrop(e)})))}onDrop(e){const t=r();if(!t||t.viewId!==this.accessor.id)return void this._onDidDrop.fire(Object.assign(Object.assign({},e),{panel:this,api:new pe(this.accessor),getData:r}));const i=this._params.containerApi,n=t.paneId,o=i.getPanel(n);if(!o)return void this._onDidDrop.fire(Object.assign(Object.assign({},e),{panel:this,getData:r,api:new pe(this.accessor)}));const s=i.panels,a=s.indexOf(o);let d=i.panels.indexOf(this);"left"!==e.position&&"top"!==e.position||(d=Math.max(0,d-1)),"right"!==e.position&&"bottom"!==e.position||(a>d&&d++,d=Math.min(s.length-1,d)),i.movePanel(a,d)}}class Oe extends u{get element(){return this._element}constructor(e,t){super(),this.accessor=e,this.group=t,this.disposable=new m,this._onDidFocus=new p,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new p,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="dv-content-container",this._element.tabIndex=-1,this.addDisposables(this._onDidFocus,this._onDidBlur);const i=t.dropTargetContainer;this.dropTarget=new xe(this.element,{getOverlayOutline:()=>{var t;return"group"===(null===(t=e.options.theme)||void 0===t?void 0:t.dndPanelOverlay)?this.element.parentElement:null},className:"dv-drop-target-content",acceptedTargetZones:["top","bottom","left","right","center"],canDisplayOverlay:(e,t)=>{if("no-drop-target"===this.group.locked||this.group.locked&&"center"===t)return!1;const i=s();return!(!i&&e.shiftKey&&"floating"!==this.group.location.type)&&(!(!i||i.viewId!==this.accessor.id)||this.group.canDisplayOverlay(e,t,"content"))},getOverrideTarget:i?()=>i.model:void 0}),this.addDisposables(this.dropTarget)}show(){this.element.style.display=""}hide(){this.element.style.display="none"}renderPanel(e,t={asActive:!0}){const i=t.asActive||this.panel&&this.group.isPanelActive(this.panel);let n;switch(this.panel&&this.panel.view.content.element.parentElement===this._element&&this._element.removeChild(this.panel.view.content.element),this.panel=e,e.api.renderer){case"onlyWhenVisible":this.group.renderContainer.detatch(e),this.panel&&i&&this._element.appendChild(this.panel.view.content.element),n=this._element;break;case"always":e.view.content.element.parentElement===this._element&&this._element.removeChild(e.view.content.element),n=this.group.renderContainer.attach({panel:e,referenceContainer:this});break;default:throw new Error(`dockview: invalid renderer type '${e.api.renderer}'`)}if(i){const e=D(n);this.focusTracker=e;const t=new u;t.addDisposables(e,e.onDidFocus((()=>this._onDidFocus.fire())),e.onDidBlur((()=>this._onDidBlur.fire()))),this.disposable.value=t}}openPanel(e){this.panel!==e&&this.renderPanel(e)}layout(e,t){}closePanel(){var e;this.panel&&"onlyWhenVisible"===this.panel.api.renderer&&(null===(e=this.panel.view.content.element.parentElement)||void 0===e||e.removeChild(this.panel.view.content.element)),this.panel=void 0}dispose(){this.disposable.dispose(),super.dispose()}refreshFocusState(){var e;(null===(e=this.focusTracker)||void 0===e?void 0:e.refreshState)&&this.focusTracker.refreshState()}}function Ge(e,t,i){var n,o;f(t,"dv-dragged"),t.style.top="-9999px",document.body.appendChild(t),e.setDragImage(t,null!==(n=null==i?void 0:i.x)&&void 0!==n?n:0,null!==(o=null==i?void 0:i.y)&&void 0!==o?o:0),setTimeout((()=>{w(t,"dv-dragged"),t.remove()}),0)}class Ie extends ue{constructor(e,t,i,n,s){super(e,s),this.accessor=t,this.group=i,this.panel=n,this.panelTransfer=o.getInstance()}getData(e){return this.panelTransfer.setData([new i(this.accessor.id,this.group.id,this.panel.id)],i.prototype),{dispose:()=>{this.panelTransfer.clearData(i.prototype)}}}}class Ve extends u{get element(){return this._element}constructor(e,t,i){super(),this.panel=e,this.accessor=t,this.group=i,this.content=void 0,this._onPointDown=new p,this.onPointerDown=this._onPointDown.event,this._onDropped=new p,this.onDrop=this._onDropped.event,this._onDragStart=new p,this.onDragStart=this._onDragStart.event,this._element=document.createElement("div"),this._element.className="dv-tab",this._element.tabIndex=0,this._element.draggable=!this.accessor.options.disableDnd,_(this.element,"dv-inactive-tab",!0),this.dragHandler=new Ie(this._element,this.accessor,this.group,this.panel,!!this.accessor.options.disableDnd),this.dropTarget=new xe(this._element,{acceptedTargetZones:["left","right"],overlayModel:{activationSize:{value:50,type:"percentage"}},canDisplayOverlay:(e,t)=>{if(this.group.locked)return!1;const i=s();return!(!i||this.accessor.id!==i.viewId)||this.group.model.canDisplayOverlay(e,t,"tab")},getOverrideTarget:()=>{var e;return null===(e=i.model.dropTargetContainer)||void 0===e?void 0:e.model}}),this.onWillShowOverlay=this.dropTarget.onWillShowOverlay,this.addDisposables(this._onPointDown,this._onDropped,this._onDragStart,this.dragHandler.onDragStart((e=>{if(e.dataTransfer){const t=getComputedStyle(this.element),i=this.element.cloneNode(!0);Array.from(t).forEach((e=>i.style.setProperty(e,t.getPropertyValue(e),t.getPropertyPriority(e)))),i.style.position="absolute",Ge(e.dataTransfer,i,{y:-10,x:30})}this._onDragStart.fire(e)})),this.dragHandler,c(this._element,"pointerdown",(e=>{this._onPointDown.fire(e)})),this.dropTarget.onDrop((e=>{this._onDropped.fire(e)})),this.dropTarget)}setActive(e){_(this.element,"dv-active-tab",e),_(this.element,"dv-inactive-tab",!e)}setContent(e){this.content&&this._element.removeChild(this.content.element),this.content=e,this._element.appendChild(this.content.element)}updateDragAndDropState(){this._element.draggable=!this.accessor.options.disableDnd,this.dragHandler.setDisabled(!!this.accessor.options.disableDnd)}dispose(){super.dispose()}}class Ne{get kind(){return this.options.kind}get nativeEvent(){return this.event.nativeEvent}get position(){return this.event.position}get defaultPrevented(){return this.event.defaultPrevented}get panel(){return this.options.panel}get api(){return this.options.api}get group(){return this.options.group}preventDefault(){this.event.preventDefault()}getData(){return this.options.getData()}constructor(e,t){this.event=e,this.options=t}}class Te extends ue{constructor(e,t,i,n){super(e,n),this.accessor=t,this.group=i,this.panelTransfer=o.getInstance(),this.addDisposables(c(e,"pointerdown",(e=>{e.shiftKey&&(e[C]=!0)}),!0))}isCancelled(e){return"floating"===this.group.api.location.type&&!e.shiftKey}getData(e){const t=e.dataTransfer;this.panelTransfer.setData([new i(this.accessor.id,this.group.id,null)],i.prototype);const n=window.getComputedStyle(this.el),o=n.getPropertyValue("--dv-activegroup-visiblepanel-tab-background-color"),s=n.getPropertyValue("--dv-activegroup-visiblepanel-tab-color");if(t){const e=document.createElement("div");e.style.backgroundColor=o,e.style.color=s,e.style.padding="2px 8px",e.style.height="24px",e.style.fontSize="11px",e.style.lineHeight="20px",e.style.borderRadius="12px",e.style.position="absolute",e.style.pointerEvents="none",e.style.top="-9999px",e.textContent=`Multiple Panels (${this.group.size})`,Ge(t,e,{y:-10,x:30})}return{dispose:()=>{this.panelTransfer.clearData(i.prototype)}}}}class Le extends u{get element(){return this._element}constructor(e,t){super(),this.accessor=e,this.group=t,this._onDrop=new p,this.onDrop=this._onDrop.event,this._onDragStart=new p,this.onDragStart=this._onDragStart.event,this._element=document.createElement("div"),this._element.className="dv-void-container",this._element.draggable=!this.accessor.options.disableDnd,_(this._element,"dv-draggable",!this.accessor.options.disableDnd),this.addDisposables(this._onDrop,this._onDragStart,c(this._element,"pointerdown",(()=>{this.accessor.doSetGroupActive(this.group)}))),this.handler=new Te(this._element,e,t,!!this.accessor.options.disableDnd),this.dropTarget=new xe(this._element,{acceptedTargetZones:["center"],canDisplayOverlay:(e,i)=>{const n=s();return!(!n||this.accessor.id!==n.viewId)||t.model.canDisplayOverlay(e,i,"header_space")},getOverrideTarget:()=>{var e;return null===(e=t.model.dropTargetContainer)||void 0===e?void 0:e.model}}),this.onWillShowOverlay=this.dropTarget.onWillShowOverlay,this.addDisposables(this.handler,this.handler.onDragStart((e=>{this._onDragStart.fire(e)})),this.dropTarget.onDrop((e=>{this._onDrop.fire(e)})),this.dropTarget)}updateDragAndDropState(){this._element.draggable=!this.accessor.options.disableDnd,_(this._element,"dv-draggable",!this.accessor.options.disableDnd),this.handler.setDisabled(!!this.accessor.options.disableDnd)}}class Me extends u{get element(){return this._element}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._scrollOffset=0,this._orientation=e,w(this._scrollbar,"dv-scrollbar-vertical","dv-scrollbar-horizontal"),f(this._scrollbar,"vertical"===e?"dv-scrollbar-vertical":"dv-scrollbar-horizontal"))}constructor(e){super(),this.scrollableElement=e,this._scrollOffset=0,this._orientation="horizontal",this._element=document.createElement("div"),this._element.className="dv-scrollable",this._scrollbar=document.createElement("div"),this._scrollbar.className="dv-scrollbar dv-scrollbar-horizontal",this.element.appendChild(e),this.element.appendChild(this._scrollbar),this.addDisposables(c(this.element,"wheel",(e=>{this._scrollOffset+=e.deltaY*Me.MouseWheelSpeed,this.calculateScrollbarStyles()})),c(this._scrollbar,"pointerdown",(e=>{e.preventDefault(),_(this.element,"dv-scrollable-scrolling",!0);const t="horizontal"===this._orientation?e.clientX:e.clientY,i=this._scrollOffset,n=e=>{const n="horizontal"===this._orientation?e.clientX-t:e.clientY-t,o=("horizontal"===this._orientation?this.element.clientWidth:this.element.clientHeight)/("horizontal"===this._orientation?this.scrollableElement.scrollWidth:this.scrollableElement.scrollHeight);this._scrollOffset=i+n/o,this.calculateScrollbarStyles()},o=()=>{_(this.element,"dv-scrollable-scrolling",!1),document.removeEventListener("pointermove",n),document.removeEventListener("pointerup",o),document.removeEventListener("pointercancel",o)};document.addEventListener("pointermove",n),document.addEventListener("pointerup",o),document.addEventListener("pointercancel",o)})),c(this.element,"scroll",(()=>{this.calculateScrollbarStyles()})),c(this.scrollableElement,"scroll",(()=>{this._scrollOffset="horizontal"===this._orientation?this.scrollableElement.scrollLeft:this.scrollableElement.scrollTop,this.calculateScrollbarStyles()})),b(this.element,(()=>{_(this.element,"dv-scrollable-resizing",!0),this._animationTimer&&clearTimeout(this._animationTimer),this._animationTimer=setTimeout((()=>{clearTimeout(this._animationTimer),_(this.element,"dv-scrollable-resizing",!1)}),500),this.calculateScrollbarStyles()})))}calculateScrollbarStyles(){const e="horizontal"===this._orientation?this.element.clientWidth:this.element.clientHeight,t="horizontal"===this._orientation?this.scrollableElement.scrollWidth:this.scrollableElement.scrollHeight;if(t>e){const i=e*(e/t);"horizontal"===this._orientation?(this._scrollbar.style.width=`${i}px`,this._scrollbar.style.height=""):(this._scrollbar.style.height=`${i}px`,this._scrollbar.style.width=""),this._scrollOffset=V(this._scrollOffset,0,t-e),"horizontal"===this._orientation?this.scrollableElement.scrollLeft=this._scrollOffset:this.scrollableElement.scrollTop=this._scrollOffset;const n=this._scrollOffset/(t-e);"horizontal"===this._orientation?(this._scrollbar.style.left=(e-i)*n+"px",this._scrollbar.style.top=""):(this._scrollbar.style.top=(e-i)*n+"px",this._scrollbar.style.left="")}else"horizontal"===this._orientation?(this._scrollbar.style.width="0px",this._scrollbar.style.left="0px"):(this._scrollbar.style.height="0px",this._scrollbar.style.top="0px"),this._scrollOffset=0}}Me.MouseWheelSpeed=1;class Re extends u{get showTabsOverflowControl(){return this._showTabsOverflowControl}set showTabsOverflowControl(e){if(this._showTabsOverflowControl!=e&&(this._showTabsOverflowControl=e,e)){const e=new g(this._tabsList);this._observerDisposable.value=new u(e,e.onDidChange((e=>{const t=e.hasScrollX||e.hasScrollY;this.toggleDropdown({reset:!t})})),c(this._tabsList,"scroll",(()=>{this.toggleDropdown({reset:!1})})))}}get element(){return this._element}get panels(){return this._tabs.map((e=>e.value.panel.id))}get size(){return this._tabs.length}get tabs(){return this._tabs.map((e=>e.value))}get direction(){return this._direction}set direction(e){this._direction!==e&&(this._direction=e,this._scrollbar&&(this._scrollbar.orientation=e),w(this._tabsList,"dv-horizontal","dv-vertical"),"vertical"===e?f(this._tabsList,"dv-tabs-container-vertical","dv-vertical"):(w(this._tabsList,"dv-tabs-container-vertical"),f(this._tabsList,"dv-horizontal")))}constructor(e,t,i){super(),this.group=e,this.accessor=t,this._observerDisposable=new m,this._scrollbar=null,this._tabs=[],this.selectedIndex=-1,this._showTabsOverflowControl=!1,this._direction="horizontal",this._onTabDragStart=new p,this.onTabDragStart=this._onTabDragStart.event,this._onDrop=new p,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new p,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onOverflowTabsChange=new p,this.onOverflowTabsChange=this._onOverflowTabsChange.event,this._tabsList=document.createElement("div"),this._tabsList.className="dv-tabs-container",this.showTabsOverflowControl=i.showTabsOverflowControl,"native"===t.options.scrollbars?this._element=this._tabsList:(this._scrollbar=new Me(this._tabsList),this._scrollbar.orientation=this.direction,this._element=this._scrollbar.element,this.addDisposables(this._scrollbar)),this.addDisposables(this._onOverflowTabsChange,this._observerDisposable,this._onWillShowOverlay,this._onDrop,this._onTabDragStart,c(this.element,"pointerdown",(e=>{if(e.defaultPrevented)return;0===e.button&&this.accessor.doSetGroupActive(this.group)})),exports.DockviewDisposable.from((()=>{for(const{value:e,disposable:t}of this._tabs)t.dispose(),e.dispose();this._tabs=[]})))}indexOf(e){return this._tabs.findIndex((t=>t.value.panel.id===e))}isActive(e){return this.selectedIndex>-1&&this._tabs[this.selectedIndex].value===e}setActivePanel(e){let t=0;for(const i of this._tabs){const n=e.id===i.value.panel.id;if(i.value.setActive(n),n){const e=i.value.element,n=e.parentElement;(t<n.scrollLeft||t+e.clientWidth>n.scrollLeft+n.clientWidth)&&(n.scrollLeft=t)}t+=i.value.element.clientWidth}}openPanel(e,t=this._tabs.length){if(this._tabs.find((t=>t.value.panel.id===e.id)))return;const i=new Ve(e,this.accessor,this.group);i.setContent(e.view.tab);const n=new u(i.onDragStart((t=>{this._onTabDragStart.fire({nativeEvent:t,panel:e})})),i.onPointerDown((t=>{if(t.defaultPrevented)return;const n=!this.accessor.options.disableFloatingGroups,o="floating"===this.group.api.location.type&&1===this.size;if(n&&!o&&t.shiftKey){t.preventDefault();const e=this.accessor.getGroupPanel(i.panel.id),{top:n,left:o}=i.element.getBoundingClientRect(),{top:s,left:r}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(e,{x:o-r,y:n-s,inDragMode:!0})}else if(0===t.button)this.group.activePanel!==e&&this.group.model.openPanel(e)})),i.onDrop((e=>{this._onDrop.fire({event:e.nativeEvent,index:this._tabs.findIndex((e=>e.value===i))})})),i.onWillShowOverlay((e=>{this._onWillShowOverlay.fire(new Ne(e,{kind:"tab",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:s}))}))),o={value:i,disposable:n};this.addTab(o,t)}delete(e){const t=this.indexOf(e),i=this._tabs.splice(t,1)[0],{value:n,disposable:o}=i;o.dispose(),n.dispose(),n.element.remove()}addTab(e,t=this._tabs.length){if(t<0||t>this._tabs.length)throw new Error("invalid location");this._tabsList.insertBefore(e.value.element,this._tabsList.children[t]),this._tabs=[...this._tabs.slice(0,t),e,...this._tabs.slice(t)],this.selectedIndex<0&&(this.selectedIndex=t)}toggleDropdown(e){const t=e.reset?[]:this._tabs.filter((e=>!function(e,t){const i=S(e),n=S(t);return!(i.left<n.left||i.left+i.width>n.left+n.width||i.top<n.top||i.top+i.height>n.top+n.height)}(e.value.element,this._tabsList))).map((e=>e.value.panel.id));this._onOverflowTabsChange.fire({tabs:t,reset:e.reset})}updateDragAndDropState(){for(const e of this._tabs)e.value.updateDragAndDropState()}}const We=e=>{const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttributeNS(null,"height",e.height),t.setAttributeNS(null,"width",e.width),t.setAttributeNS(null,"viewBox",e.viewbox),t.setAttributeNS(null,"aria-hidden","false"),t.setAttributeNS(null,"focusable","false"),t.classList.add("dv-svg");const i=document.createElementNS("http://www.w3.org/2000/svg","path");return i.setAttributeNS(null,"d",e.path),t.appendChild(i),t},He=()=>We({width:"11",height:"11",viewbox:"0 0 15 25",path:"M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z"});class Fe extends u{get onTabDragStart(){return this.tabs.onTabDragStart}get panels(){return this.tabs.panels}get size(){return this.tabs.size}get hidden(){return this._hidden}set hidden(e){this._hidden=e,this.element.style.display=e?"none":""}get direction(){return this._direction}set direction(e){this._direction=e,"vertical"===e?(f(this._element,"dv-groupview-header-vertical"),f(this.rightActionsContainer,"dv-right-actions-container-vertical"),this.tabs.direction=e):(w(this._element,"dv-groupview-header-vertical"),w(this.rightActionsContainer,"dv-right-actions-container-vertical"),this.tabs.direction=e)}get element(){return this._element}constructor(e,t){super(),this.accessor=e,this.group=t,this._hidden=!1,this._direction="horizontal",this.dropdownPart=null,this._overflowTabs=[],this._dropdownDisposable=new m,this._onDrop=new p,this.onDrop=this._onDrop.event,this._onGroupDragStart=new p,this.onGroupDragStart=this._onGroupDragStart.event,this._onWillShowOverlay=new p,this.onWillShowOverlay=this._onWillShowOverlay.event,this._element=document.createElement("div"),this._element.className="dv-tabs-and-actions-container",_(this._element,"dv-full-width-single-tab","fullwidth"===this.accessor.options.singleTabMode),this.rightActionsContainer=document.createElement("div"),this.rightActionsContainer.className="dv-right-actions-container",this.leftActionsContainer=document.createElement("div"),this.leftActionsContainer.className="dv-left-actions-container",this.preActionsContainer=document.createElement("div"),this.preActionsContainer.className="dv-pre-actions-container",this.tabs=new Re(t,e,{showTabsOverflowControl:!e.options.disableTabsOverflowList}),this.voidContainer=new Le(this.accessor,this.group),this._element.appendChild(this.preActionsContainer),this._element.appendChild(this.tabs.element),this._element.appendChild(this.leftActionsContainer),this._element.appendChild(this.voidContainer.element),this._element.appendChild(this.rightActionsContainer),this.addDisposables(this.tabs.onDrop((e=>this._onDrop.fire(e))),this.tabs.onWillShowOverlay((e=>this._onWillShowOverlay.fire(e))),e.onDidOptionsChange((()=>{this.tabs.showTabsOverflowControl=!e.options.disableTabsOverflowList})),this.tabs.onOverflowTabsChange((e=>{this.toggleDropdown(e)})),this.tabs,this._onWillShowOverlay,this._onDrop,this._onGroupDragStart,this.voidContainer,this.voidContainer.onDragStart((e=>{this._onGroupDragStart.fire({nativeEvent:e,group:this.group})})),this.voidContainer.onDrop((e=>{this._onDrop.fire({event:e.nativeEvent,index:this.tabs.size})})),this.voidContainer.onWillShowOverlay((e=>{this._onWillShowOverlay.fire(new Ne(e,{kind:"header_space",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:s}))})),c(this.voidContainer.element,"pointerdown",(e=>{if(e.defaultPrevented)return;if(!this.accessor.options.disableFloatingGroups&&e.shiftKey&&"floating"!==this.group.api.location.type){e.preventDefault();const{top:t,left:i}=this.element.getBoundingClientRect(),{top:n,left:o}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(this.group,{x:i-o+20,y:t-n+20,inDragMode:!0})}})))}show(){this.hidden||(this.element.style.display="")}hide(){this._element.style.display="none"}setRightActionsElement(e){this.rightActions!==e&&(this.rightActions&&(this.rightActions.remove(),this.rightActions=void 0),e&&(this.rightActionsContainer.appendChild(e),this.rightActions=e))}setLeftActionsElement(e){this.leftActions!==e&&(this.leftActions&&(this.leftActions.remove(),this.leftActions=void 0),e&&(this.leftActionsContainer.appendChild(e),this.leftActions=e))}setPrefixActionsElement(e){this.preActions!==e&&(this.preActions&&(this.preActions.remove(),this.preActions=void 0),e&&(this.preActionsContainer.appendChild(e),this.preActions=e))}isActive(e){return this.tabs.isActive(e)}indexOf(e){return this.tabs.indexOf(e)}setActive(e){}delete(e){this.tabs.delete(e),this.updateClassnames()}setActivePanel(e){this.tabs.setActivePanel(e)}openPanel(e,t=this.tabs.size){this.tabs.openPanel(e,t),this.updateClassnames()}closePanel(e){this.delete(e.id)}updateClassnames(){_(this._element,"dv-single-tab",1===this.size)}toggleDropdown(e){const t=e.reset?[]:e.tabs;if(this._overflowTabs=t,this._overflowTabs.length>0&&this.dropdownPart)return void this.dropdownPart.update({tabs:t.length});if(0===this._overflowTabs.length)return void this._dropdownDisposable.dispose();const i=document.createElement("div");i.className="dv-tabs-overflow-dropdown-root";const n=function(){const e=document.createElement("div");e.className="dv-tabs-overflow-dropdown-default";const t=document.createElement("span");t.textContent="";const i=He();return e.appendChild(i),e.appendChild(t),{element:e,update:e=>{t.textContent=`${e.tabs}`}}}();n.update({tabs:t.length}),this.dropdownPart=n,i.appendChild(n.element),this.rightActionsContainer.prepend(i),this._dropdownDisposable.value=new u(exports.DockviewDisposable.from((()=>{var e,t;i.remove(),null===(t=null===(e=this.dropdownPart)||void 0===e?void 0:e.dispose)||void 0===t||t.call(e),this.dropdownPart=null})),c(i,"pointerdown",(e=>{e.preventDefault()}),{capture:!0}),c(i,"click",(e=>{const t=document.createElement("div");t.style.overflow="auto",t.className="dv-tabs-overflow-container";for(const e of this.tabs.tabs.filter((e=>this._overflowTabs.includes(e.panel.id)))){const i=this.group.panels.find((t=>t===e.panel)),n=i.view.createTabRenderer("headerOverflow").element,o=document.createElement("div");_(o,"dv-tab",!0),_(o,"dv-active-tab",i.api.isActive),_(o,"dv-inactive-tab",!i.api.isActive),o.addEventListener("click",(t=>{this.accessor.popupService.close(),t.defaultPrevented||(e.element.scrollIntoView(),e.panel.api.setActive())})),o.appendChild(n),t.appendChild(o)}const n=function(e){let t=e;for(;t&&("auto"===t.style.zIndex||""===t.style.zIndex);)t=t.parentElement;return t}(i);this.accessor.popupService.openPopover(t,{x:e.clientX,y:e.clientY,zIndex:(null==n?void 0:n.style.zIndex)?`calc(${n.style.zIndex} * 2)`:void 0})})))}updateDragAndDropState(){this.tabs.updateDragAndDropState(),this.voidContainer.updateDragAndDropState()}}class Be extends d{constructor(e,t,i,n,o){super(),this.nativeEvent=e,this.target=t,this.position=i,this.getData=n,this.group=o}}const Ue=(()=>{const e={disableAutoResizing:void 0,hideBorders:void 0,singleTabMode:void 0,disableFloatingGroups:void 0,floatingGroupBounds:void 0,popoutUrl:void 0,defaultRenderer:void 0,defaultHeaderPosition:void 0,debug:void 0,rootOverlayModel:void 0,locked:void 0,disableDnd:void 0,className:void 0,noPanelsOverlay:void 0,dndEdges:void 0,theme:void 0,disableTabsOverflowList:void 0,scrollbars:void 0};return Object.keys(e)})();function $e(e){return!!e.referencePanel}function Je(e){return!!e.referenceGroup}function je(e){return!!e.referencePanel}function Ze(e){return!!e.referenceGroup}class Ye extends a{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}get panel(){return this.options.panel}get group(){return this.options.group}get api(){return this.options.api}constructor(e){super(),this.options=e}getData(){return this.options.getData()}}class Xe extends Ye{get kind(){return this._kind}constructor(e){super(e),this._kind=e.kind}}class Ke extends u{get element(){throw new Error("dockview: not supported")}get activePanel(){return this._activePanel}get locked(){return this._locked}set locked(e){this._locked=e,_(this.container,"dv-locked-groupview","no-drop-target"===e||e)}get isActive(){return this._isGroupActive}get panels(){return this._panels}get size(){return this._panels.length}get isEmpty(){return 0===this._panels.length}get hasWatermark(){return!(!this.watermark||!this.container.contains(this.watermark.element))}get header(){return this.tabsContainer}get isContentFocused(){return!!document.activeElement&&x(document.activeElement,this.contentContainer.element)}get headerPosition(){var e;return null!==(e=this._headerPosition)&&void 0!==e?e:"top"}set headerPosition(e){var t;this._headerPosition=e,w(this.container,"dv-groupview-header-top","dv-groupview-header-bottom","dv-groupview-header-left","dv-groupview-header-right"),f(this.container,`dv-groupview-header-${e}`);const i="top"===e||"bottom"===e?"horizontal":"vertical";this.tabsContainer.direction=i,this.header.direction=i,(null===(t=this._activePanel)||void 0===t?void 0:t.layout)&&this._activePanel.layout(this._width,this._height),(this._leftHeaderActions||this._rightHeaderActions||this._prefixHeaderActions)&&this.updateHeaderActions()}get location(){return this._location}set location(e){switch(this._location=e,_(this.container,"dv-groupview-floating",!1),_(this.container,"dv-groupview-popout",!1),e.type){case"grid":this.contentContainer.dropTarget.setTargetZones(["top","bottom","left","right","center"]);break;case"floating":this.contentContainer.dropTarget.setTargetZones(["center"]),this.contentContainer.dropTarget.setTargetZones(e?["center"]:["top","bottom","left","right","center"]),_(this.container,"dv-groupview-floating",!0);break;case"popout":this.contentContainer.dropTarget.setTargetZones(["center"]),_(this.container,"dv-groupview-popout",!0)}this.groupPanel.api._onDidLocationChange.fire({location:this.location})}constructor(e,t,i,n,o){var r,a;super(),this.container=e,this.accessor=t,this.id=i,this.options=n,this.groupPanel=o,this._isGroupActive=!1,this._locked=!1,this._rightHeaderActionsDisposable=new m,this._leftHeaderActionsDisposable=new m,this._prefixHeaderActionsDisposable=new m,this._location={type:"grid"},this.mostRecentlyUsed=[],this._overwriteRenderContainer=null,this._overwriteDropTargetContainer=null,this._onDidChange=new p,this.onDidChange=this._onDidChange.event,this._width=0,this._height=0,this._panels=[],this._panelDisposables=new Map,this._onMove=new p,this.onMove=this._onMove.event,this._onDidDrop=new p,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new p,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new p,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onTabDragStart=new p,this.onTabDragStart=this._onTabDragStart.event,this._onGroupDragStart=new p,this.onGroupDragStart=this._onGroupDragStart.event,this._onDidAddPanel=new p,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPanelTitleChange=new p,this.onDidPanelTitleChange=this._onDidPanelTitleChange.event,this._onDidPanelParametersChange=new p,this.onDidPanelParametersChange=this._onDidPanelParametersChange.event,this._onDidRemovePanel=new p,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidActivePanelChange=new p,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onUnhandledDragOverEvent=new p,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,_(this.container,"dv-groupview",!0),this._api=new ve(this.accessor),this.tabsContainer=new Fe(this.accessor,this.groupPanel),this.contentContainer=new Oe(this.accessor,this),e.append(this.tabsContainer.element,this.contentContainer.element),this.header.hidden=!!n.hideHeader,this.locked=null!==(r=n.locked)&&void 0!==r&&r,this.headerPosition=null!==(a=n.headerPosition)&&void 0!==a?a:t.defaultHeaderPosition,this.addDisposables(this._onTabDragStart,this._onGroupDragStart,this._onWillShowOverlay,this._rightHeaderActionsDisposable,this._leftHeaderActionsDisposable,this._prefixHeaderActionsDisposable,this.tabsContainer.onTabDragStart((e=>{this._onTabDragStart.fire(e)})),this.tabsContainer.onGroupDragStart((e=>{this._onGroupDragStart.fire(e)})),this.tabsContainer.onDrop((e=>{this.handleDropEvent("header",e.event,"center",e.index)})),this.contentContainer.onDidFocus((()=>{this.accessor.doSetGroupActive(this.groupPanel)})),this.contentContainer.onDidBlur((()=>{})),this.contentContainer.dropTarget.onDrop((e=>{this.handleDropEvent("content",e.nativeEvent,e.position)})),this.tabsContainer.onWillShowOverlay((e=>{this._onWillShowOverlay.fire(e)})),this.contentContainer.dropTarget.onWillShowOverlay((e=>{this._onWillShowOverlay.fire(new Ne(e,{kind:"content",panel:this.activePanel,api:this._api,group:this.groupPanel,getData:s}))})),this._onMove,this._onDidChange,this._onDidDrop,this._onWillDrop,this._onDidAddPanel,this._onDidRemovePanel,this._onDidActivePanelChange,this._onUnhandledDragOverEvent,this._onDidPanelTitleChange,this._onDidPanelParametersChange)}focusContent(){this.contentContainer.element.focus()}set renderContainer(e){this.panels.forEach((e=>{this.renderContainer.detatch(e)})),this._overwriteRenderContainer=e,this.panels.forEach((e=>{this.rerender(e)}))}get renderContainer(){var e;return null!==(e=this._overwriteRenderContainer)&&void 0!==e?e:this.accessor.overlayRenderContainer}set dropTargetContainer(e){this._overwriteDropTargetContainer=e}get dropTargetContainer(){var e;return null!==(e=this._overwriteDropTargetContainer)&&void 0!==e?e:this.accessor.rootDropTargetContainer}initialize(){this.options.panels&&this.options.panels.forEach((e=>{this.doAddPanel(e)})),this.options.activePanel&&this.openPanel(this.options.activePanel),this.setActive(this.isActive,!0),this.updateContainer(),this.updateHeaderActions()}updateHeaderActions(){this.accessor.options.createRightHeaderActionComponent?(this._rightHeaderActions=this.accessor.options.createRightHeaderActionComponent(this.groupPanel),this._rightHeaderActionsDisposable.value=this._rightHeaderActions,this._rightHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element)):(this._rightHeaderActions=void 0,this._rightHeaderActionsDisposable.dispose(),this.tabsContainer.setRightActionsElement(void 0)),this.accessor.options.createLeftHeaderActionComponent?(this._leftHeaderActions=this.accessor.options.createLeftHeaderActionComponent(this.groupPanel),this._leftHeaderActionsDisposable.value=this._leftHeaderActions,this._leftHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element)):(this._leftHeaderActions=void 0,this._leftHeaderActionsDisposable.dispose(),this.tabsContainer.setLeftActionsElement(void 0)),this.accessor.options.createPrefixHeaderActionComponent?(this._prefixHeaderActions=this.accessor.options.createPrefixHeaderActionComponent(this.groupPanel),this._prefixHeaderActionsDisposable.value=this._prefixHeaderActions,this._prefixHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element)):(this._prefixHeaderActions=void 0,this._prefixHeaderActionsDisposable.dispose(),this.tabsContainer.setPrefixActionsElement(void 0))}rerender(e){this.contentContainer.renderPanel(e,{asActive:!1})}indexOf(e){return this.tabsContainer.indexOf(e.id)}toJSON(){var e;const t={views:this.tabsContainer.panels,activeView:null===(e=this._activePanel)||void 0===e?void 0:e.id,id:this.id};return!1!==this.locked&&(t.locked=this.locked),this.header.hidden&&(t.hideHeader=!0),"top"!==this.headerPosition&&(t.headerPosition=this.headerPosition),t}moveToNext(e){e||(e={}),e.panel||(e.panel=this.activePanel);const t=e.panel?this.panels.indexOf(e.panel):-1;let i;if(t<this.panels.length-1)i=t+1;else{if(e.suppressRoll)return;i=0}this.openPanel(this.panels[i])}moveToPrevious(e){if(e||(e={}),e.panel||(e.panel=this.activePanel),!e.panel)return;const t=this.panels.indexOf(e.panel);let i;if(t>0)i=t-1;else{if(e.suppressRoll)return;i=this.panels.length-1}this.openPanel(this.panels[i])}containsPanel(e){return this.panels.includes(e)}init(e){}update(e){}focus(){var e;null===(e=this._activePanel)||void 0===e||e.focus()}openPanel(e,t={}){("number"!=typeof t.index||t.index>this.panels.length)&&(t.index=this.panels.length);const i=!!t.skipSetActive;e.updateParentGroup(this.groupPanel,{skipSetActive:t.skipSetActive}),this.doAddPanel(e,t.index,{skipSetActive:i}),this._activePanel!==e?(i||this.doSetActivePanel(e),t.skipSetGroupActive||this.accessor.doSetGroupActive(this.groupPanel),t.skipSetActive||this.updateContainer()):this.contentContainer.renderPanel(e,{asActive:!0})}removePanel(e,t={skipSetActive:!1}){const i="string"==typeof e?e:e.id,n=this._panels.find((e=>e.id===i));if(!n)throw new Error("invalid operation");return this._removePanel(n,t)}closeAllPanels(){if(this.panels.length>0){const e=[...this.panels];for(const t of e)this.doClose(t)}else this.accessor.removeGroup(this.groupPanel)}closePanel(e){this.doClose(e)}doClose(e){const t=1===this.panels.length&&1===this.accessor.groups.length;this.accessor.removePanel(e,t&&"emptyGroup"===this.accessor.options.noPanelsOverlay?{removeEmptyGroup:!1}:void 0)}isPanelActive(e){return this._activePanel===e}updateActions(e){this.tabsContainer.setRightActionsElement(e)}setActive(e,t=!1){(t||this.isActive!==e)&&(this._isGroupActive=e,_(this.container,"dv-active-group",e),_(this.container,"dv-inactive-group",!e),this.tabsContainer.setActive(this.isActive),!this._activePanel&&this.panels.length>0&&this.doSetActivePanel(this.panels[0]),this.updateContainer())}layout(e,t){var i;this._width=e,this._height=t,this.contentContainer.layout(this._width,this._height),(null===(i=this._activePanel)||void 0===i?void 0:i.layout)&&this._activePanel.layout(this._width,this._height)}_removePanel(e,t){const i=this._activePanel===e;if(this.doRemovePanel(e),i&&this.panels.length>0){const e=this.mostRecentlyUsed[0];this.openPanel(e,{skipSetActive:t.skipSetActive,skipSetGroupActive:t.skipSetActiveGroup})}return this._activePanel&&0===this.panels.length&&this.doSetActivePanel(void 0),t.skipSetActive||this.updateContainer(),e}doRemovePanel(e){const t=this.panels.indexOf(e);if(this._activePanel===e&&this.contentContainer.closePanel(),this.tabsContainer.delete(e.id),this._panels.splice(t,1),this.mostRecentlyUsed.includes(e)){const t=this.mostRecentlyUsed.indexOf(e);this.mostRecentlyUsed.splice(t,1)}const i=this._panelDisposables.get(e.id);i&&(i.dispose(),this._panelDisposables.delete(e.id)),this._onDidRemovePanel.fire({panel:e})}doAddPanel(e,t=this.panels.length,i={skipSetActive:!1}){const n=this._panels.indexOf(e)>-1;this.tabsContainer.show(),this.contentContainer.show(),this.tabsContainer.openPanel(e,t),i.skipSetActive?"always"===e.api.renderer&&this.contentContainer.renderPanel(e,{asActive:!1}):this.contentContainer.openPanel(e),n||(this.updateMru(e),this.panels.splice(t,0,e),this._panelDisposables.set(e.id,new u(e.api.onDidTitleChange((e=>this._onDidPanelTitleChange.fire(e))),e.api.onDidParametersChange((e=>this._onDidPanelParametersChange.fire(e))))),this._onDidAddPanel.fire({panel:e}))}doSetActivePanel(e){this._activePanel!==e&&(this._activePanel=e,e&&(this.tabsContainer.setActivePanel(e),this.contentContainer.openPanel(e),e.layout(this._width,this._height),this.updateMru(e),this.contentContainer.refreshFocusState(),this._onDidActivePanelChange.fire({panel:e})))}updateMru(e){this.mostRecentlyUsed.includes(e)&&this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(e),1),this.mostRecentlyUsed=[e,...this.mostRecentlyUsed]}updateContainer(){var e,t;if(this.panels.forEach((e=>e.runEvents())),this.isEmpty&&!this.watermark){const e=this.accessor.createWatermarkComponent();e.init({containerApi:this._api,group:this.groupPanel}),this.watermark=e,c(this.watermark.element,"pointerdown",(()=>{this.isActive||this.accessor.doSetGroupActive(this.groupPanel)})),this.contentContainer.element.appendChild(this.watermark.element)}!this.isEmpty&&this.watermark&&(this.watermark.element.remove(),null===(t=(e=this.watermark).dispose)||void 0===t||t.call(e),this.watermark=void 0)}canDisplayOverlay(e,t,i){const n=new Be(e,i,t,s,this.accessor.getPanel(this.id));return this._onUnhandledDragOverEvent.fire(n),n.isAccepted}handleDropEvent(e,t,i,n){if("no-drop-target"===this.locked)return;const o="number"==typeof n?this.panels[n]:void 0,r=new Xe({nativeEvent:t,position:i,panel:o,getData:()=>s(),kind:function(){switch(e){case"header":return"number"==typeof n?"tab":"header_space";case"content":return"content"}}(),group:this.groupPanel,api:this._api});if(this._onWillDrop.fire(r),r.defaultPrevented)return;const a=s();if(a&&a.viewId===this.accessor.id){if("content"===e&&a.groupId===this.id){if("center"===i)return;if(null===a.panelId)return}if("header"===e&&a.groupId===this.id&&null===a.panelId)return;if(null===a.panelId){const{groupId:e}=a;return void this._onMove.fire({target:i,groupId:e,index:n})}if(-1!==this.tabsContainer.indexOf(a.panelId)&&1===this.tabsContainer.size)return;const{groupId:t,panelId:o}=a;if(this.id===t&&!i){if(this.tabsContainer.indexOf(o)===n)return}this._onMove.fire({target:i,groupId:a.groupId,itemId:a.panelId,index:n})}else this._onDidDrop.fire(new Ye({nativeEvent:t,position:i,panel:o,getData:()=>s(),group:this.groupPanel,api:this._api}))}updateDragAndDropState(){this.tabsContainer.updateDragAndDropState()}dispose(){var e,t,i;super.dispose(),null===(e=this.watermark)||void 0===e||e.element.remove(),null===(i=null===(t=this.watermark)||void 0===t?void 0:t.dispose)||void 0===i||i.call(t),this.watermark=void 0;for(const e of this.panels)e.dispose();this.tabsContainer.dispose(),this.contentContainer.dispose()}}class qe extends ze{constructor(e,t,i){super(e,t),this._onDidConstraintsChangeInternal=new p,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new p,this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new p,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange),i&&this.initialize(i)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}}class Qe extends ke{get priority(){return this._priority}get snap(){return this._snap}get minimumWidth(){return this.__minimumWidth()}get minimumHeight(){return this.__minimumHeight()}get maximumHeight(){return this.__maximumHeight()}get maximumWidth(){return this.__maximumWidth()}__minimumWidth(){const e="function"==typeof this._minimumWidth?this._minimumWidth():this._minimumWidth;return e!==this._evaluatedMinimumWidth&&(this._evaluatedMinimumWidth=e,this.updateConstraints()),e}__maximumWidth(){const e="function"==typeof this._maximumWidth?this._maximumWidth():this._maximumWidth;return e!==this._evaluatedMaximumWidth&&(this._evaluatedMaximumWidth=e,this.updateConstraints()),e}__minimumHeight(){const e="function"==typeof this._minimumHeight?this._minimumHeight():this._minimumHeight;return e!==this._evaluatedMinimumHeight&&(this._evaluatedMinimumHeight=e,this.updateConstraints()),e}__maximumHeight(){const e="function"==typeof this._maximumHeight?this._maximumHeight():this._maximumHeight;return e!==this._evaluatedMaximumHeight&&(this._evaluatedMaximumHeight=e,this.updateConstraints()),e}get isActive(){return this.api.isActive}get isVisible(){return this.api.isVisible}constructor(e,t,i,n){super(e,t,null!=n?n:new qe(e,t)),this._evaluatedMinimumWidth=0,this._evaluatedMaximumWidth=Number.MAX_SAFE_INTEGER,this._evaluatedMinimumHeight=0,this._evaluatedMaximumHeight=Number.MAX_SAFE_INTEGER,this._minimumWidth=0,this._minimumHeight=0,this._maximumWidth=Number.MAX_SAFE_INTEGER,this._maximumHeight=Number.MAX_SAFE_INTEGER,this._snap=!1,this._onDidChange=new p,this.onDidChange=this._onDidChange.event,"number"==typeof(null==i?void 0:i.minimumWidth)&&(this._minimumWidth=i.minimumWidth),"number"==typeof(null==i?void 0:i.maximumWidth)&&(this._maximumWidth=i.maximumWidth),"number"==typeof(null==i?void 0:i.minimumHeight)&&(this._minimumHeight=i.minimumHeight),"number"==typeof(null==i?void 0:i.maximumHeight)&&(this._maximumHeight=i.maximumHeight),this.api.initialize(this),this.addDisposables(this.api.onWillVisibilityChange((e=>{const{isVisible:t}=e,{accessor:i}=this._params;i.setVisible(this,t)})),this.api.onActiveChange((()=>{const{accessor:e}=this._params;e.doSetGroupActive(this)})),this.api.onDidConstraintsChangeInternal((e=>{"number"!=typeof e.minimumWidth&&"function"!=typeof e.minimumWidth||(this._minimumWidth=e.minimumWidth),"number"!=typeof e.minimumHeight&&"function"!=typeof e.minimumHeight||(this._minimumHeight=e.minimumHeight),"number"!=typeof e.maximumWidth&&"function"!=typeof e.maximumWidth||(this._maximumWidth=e.maximumWidth),"number"!=typeof e.maximumHeight&&"function"!=typeof e.maximumHeight||(this._maximumHeight=e.maximumHeight)})),this.api.onDidSizeChange((e=>{this._onDidChange.fire({height:e.height,width:e.width})})),this._onDidChange)}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}init(e){e.maximumHeight&&(this._maximumHeight=e.maximumHeight),e.minimumHeight&&(this._minimumHeight=e.minimumHeight),e.maximumWidth&&(this._maximumWidth=e.maximumWidth),e.minimumWidth&&(this._minimumWidth=e.minimumWidth),this._priority=e.priority,this._snap=!!e.snap,super.init(e),"boolean"==typeof e.isVisible&&this.setVisible(e.isVisible)}updateConstraints(){this.api._onDidConstraintsChange.fire({minimumWidth:this._evaluatedMinimumWidth,maximumWidth:this._evaluatedMaximumWidth,minimumHeight:this._evaluatedMinimumHeight,maximumHeight:this._evaluatedMaximumHeight})}toJSON(){const e=super.toJSON(),t=e=>e===Number.MAX_SAFE_INTEGER?void 0:e,i=e=>e<=0?void 0:e;return Object.assign(Object.assign({},e),{minimumHeight:i(this.minimumHeight),maximumHeight:t(this.maximumHeight),minimumWidth:i(this.minimumWidth),maximumWidth:t(this.maximumWidth),snap:this.snap,priority:this.priority})}}const et="dockview: DockviewGroupPanelApiImpl not initialized";class tt extends qe{get location(){if(!this._group)throw new Error(et);return this._group.model.location}constructor(e,t){super(e,"__dockviewgroup__"),this.accessor=t,this._onDidLocationChange=new p,this.onDidLocationChange=this._onDidLocationChange.event,this._onDidActivePanelChange=new p,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this.addDisposables(this._onDidLocationChange,this._onDidActivePanelChange,this._onDidVisibilityChange.event((e=>{e.isVisible&&this._pendingSize&&(super.setSize(this._pendingSize),this._pendingSize=void 0)})))}setSize(e){this._pendingSize=Object.assign({},e),super.setSize(e)}close(){if(this._group)return this.accessor.removeGroup(this._group)}getWindow(){return"popout"===this.location.type?this.location.getWindow():window}setHeaderPosition(e){if(!this._group)throw new Error(et);this._group.model.headerPosition=e}getHeaderPosition(){if(!this._group)throw new Error(et);return this._group.model.headerPosition}moveTo(e){var t,i,n,o;if(!this._group)throw new Error(et);const s=null!==(t=e.group)&&void 0!==t?t:this.accessor.addGroup({direction:we(null!==(i=e.position)&&void 0!==i?i:"right"),skipSetActive:null!==(n=e.skipSetActive)&&void 0!==n&&n});this.accessor.moveGroupOrPanel({from:{groupId:this._group.id},to:{group:s,position:e.group&&null!==(o=e.position)&&void 0!==o?o:"center",index:e.index},skipSetActive:e.skipSetActive})}maximize(){if(!this._group)throw new Error(et);"grid"===this.location.type&&this.accessor.maximizeGroup(this._group)}isMaximized(){if(!this._group)throw new Error(et);return this.accessor.isMaximizedGroup(this._group)}exitMaximized(){if(!this._group)throw new Error(et);this.isMaximized()&&this.accessor.exitMaximizedGroup()}initialize(e){this._group=e}}class it extends Qe{get minimumWidth(){var e;if("number"==typeof this._explicitConstraints.minimumWidth)return this._explicitConstraints.minimumWidth;const t=null===(e=this.activePanel)||void 0===e?void 0:e.minimumWidth;return"number"==typeof t?t:super.__minimumWidth()}get minimumHeight(){var e;if("number"==typeof this._explicitConstraints.minimumHeight)return this._explicitConstraints.minimumHeight;const t=null===(e=this.activePanel)||void 0===e?void 0:e.minimumHeight;return"number"==typeof t?t:super.__minimumHeight()}get maximumWidth(){var e;if("number"==typeof this._explicitConstraints.maximumWidth)return this._explicitConstraints.maximumWidth;const t=null===(e=this.activePanel)||void 0===e?void 0:e.maximumWidth;return"number"==typeof t?t:super.__maximumWidth()}get maximumHeight(){var e;if("number"==typeof this._explicitConstraints.maximumHeight)return this._explicitConstraints.maximumHeight;const t=null===(e=this.activePanel)||void 0===e?void 0:e.maximumHeight;return"number"==typeof t?t:super.__maximumHeight()}get panels(){return this._model.panels}get activePanel(){return this._model.activePanel}get size(){return this._model.size}get model(){return this._model}get locked(){return this._model.locked}set locked(e){this._model.locked=e}get header(){return this._model.header}constructor(e,t,i){var n,o,s,r,a,d;super(t,"groupview_default",{minimumHeight:null!==(o=null===(n=i.constraints)||void 0===n?void 0:n.minimumHeight)&&void 0!==o?o:100,minimumWidth:null!==(r=null===(s=i.constraints)||void 0===s?void 0:s.minimumWidth)&&void 0!==r?r:100,maximumHeight:null===(a=i.constraints)||void 0===a?void 0:a.maximumHeight,maximumWidth:null===(d=i.constraints)||void 0===d?void 0:d.maximumWidth},new tt(t,e)),this._explicitConstraints={},this.api.initialize(this),this._model=new Ke(this.element,e,t,i,this),this.addDisposables(this.model.onDidActivePanelChange((e=>{this.api._onDidActivePanelChange.fire(e)})),this.api.onDidConstraintsChangeInternal((e=>{void 0!==e.minimumWidth&&(this._explicitConstraints.minimumWidth="function"==typeof e.minimumWidth?e.minimumWidth():e.minimumWidth),void 0!==e.minimumHeight&&(this._explicitConstraints.minimumHeight="function"==typeof e.minimumHeight?e.minimumHeight():e.minimumHeight),void 0!==e.maximumWidth&&(this._explicitConstraints.maximumWidth="function"==typeof e.maximumWidth?e.maximumWidth():e.maximumWidth),void 0!==e.maximumHeight&&(this._explicitConstraints.maximumHeight="function"==typeof e.maximumHeight?e.maximumHeight():e.maximumHeight)})))}focus(){this.api.isActive||this.api.setActive(),super.focus()}initialize(){this._model.initialize()}setActive(e){super.setActive(e),this.model.setActive(e)}layout(e,t){super.layout(e,t),this.model.layout(e,t)}getComponent(){return this._model}toJSON(){return this.model.toJSON()}}const nt={name:"abyss",className:"dockview-theme-abyss"};class ot extends qe{get location(){return this.group.api.location}get title(){return this.panel.title}get isGroupActive(){return this.group.isActive}get renderer(){return this.panel.renderer}set group(e){const t=this._group;this._group!==e&&(this._group=e,this._onDidGroupChange.fire({}),this.setupGroupEventListeners(t),this._onDidLocationChange.fire({location:this.group.api.location}))}get group(){return this._group}get tabComponent(){return this._tabComponent}constructor(e,t,i,n,o){super(e.id,n),this.panel=e,this.accessor=i,this._onDidTitleChange=new p,this.onDidTitleChange=this._onDidTitleChange.event,this._onDidActiveGroupChange=new p,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._onDidGroupChange=new p,this.onDidGroupChange=this._onDidGroupChange.event,this._onDidRendererChange=new p,this.onDidRendererChange=this._onDidRendererChange.event,this._onDidLocationChange=new p,this.onDidLocationChange=this._onDidLocationChange.event,this.groupEventsDisposable=new m,this._tabComponent=o,this.initialize(e),this._group=t,this.setupGroupEventListeners(),this.addDisposables(this.groupEventsDisposable,this._onDidRendererChange,this._onDidTitleChange,this._onDidGroupChange,this._onDidActiveGroupChange,this._onDidLocationChange)}getWindow(){return this.group.api.getWindow()}moveTo(e){var t,i;this.accessor.moveGroupOrPanel({from:{groupId:this._group.id,panelId:this.panel.id},to:{group:null!==(t=e.group)&&void 0!==t?t:this._group,position:e.group&&null!==(i=e.position)&&void 0!==i?i:"center",index:e.index},skipSetActive:e.skipSetActive})}setTitle(e){this.panel.setTitle(e)}setRenderer(e){this.panel.setRenderer(e)}close(){this.group.model.closePanel(this.panel)}maximize(){this.group.api.maximize()}isMaximized(){return this.group.api.isMaximized()}exitMaximized(){this.group.api.exitMaximized()}setupGroupEventListeners(e){var t;let i=null!==(t=null==e?void 0:e.isActive)&&void 0!==t&&t;this.groupEventsDisposable.value=new u(this.group.api.onDidVisibilityChange((e=>{const t=!e.isVisible&&this.isVisible,i=e.isVisible&&!this.isVisible,n=this.group.model.isPanelActive(this.panel);(t||i&&n)&&this._onDidVisibilityChange.fire(e)})),this.group.api.onDidLocationChange((e=>{this.group===this.panel.group&&this._onDidLocationChange.fire(e)})),this.group.api.onDidActiveChange((()=>{this.group===this.panel.group&&i!==this.isGroupActive&&(i=this.isGroupActive,this._onDidActiveGroupChange.fire({isActive:this.isGroupActive}))})))}}class st extends u{get params(){return this._params}get title(){return this._title}get group(){return this._group}get renderer(){var e;return null!==(e=this._renderer)&&void 0!==e?e:this.accessor.renderer}get minimumWidth(){return this._minimumWidth}get minimumHeight(){return this._minimumHeight}get maximumWidth(){return this._maximumWidth}get maximumHeight(){return this._maximumHeight}constructor(e,t,i,n,o,s,r,a){super(),this.id=e,this.accessor=n,this.containerApi=o,this.view=r,this._renderer=a.renderer,this._group=s,this._minimumWidth=a.minimumWidth,this._minimumHeight=a.minimumHeight,this._maximumWidth=a.maximumWidth,this._maximumHeight=a.maximumHeight,this.api=new ot(this,this._group,n,t,i),this.addDisposables(this.api.onActiveChange((()=>{n.setActivePanel(this)})),this.api.onDidSizeChange((e=>{this.group.api.setSize(e)})),this.api.onDidRendererChange((()=>{this.group.model.rerender(this)})))}init(e){this._params=e.params,this.view.init(Object.assign(Object.assign({},e),{api:this.api,containerApi:this.containerApi})),this.setTitle(e.title)}focus(){const e=new Ce;this.api._onWillFocus.fire(e),e.defaultPrevented||this.api.isActive||this.api.setActive()}toJSON(){return{id:this.id,contentComponent:this.view.contentComponent,tabComponent:this.view.tabComponent,params:Object.keys(this._params||{}).length>0?this._params:void 0,title:this.title,renderer:this._renderer,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,minimumWidth:this._minimumWidth,maximumWidth:this._maximumWidth}}setTitle(e){e!==this.title&&(this._title=e,this.api._onDidTitleChange.fire({title:e}))}setRenderer(e){e!==this.renderer&&(this._renderer=e,this.api._onDidRendererChange.fire({renderer:e}))}update(e){var t;this._params=Object.assign(Object.assign({},null!==(t=this._params)&&void 0!==t?t:{}),e.params);for(const t of Object.keys(e.params))void 0===e.params[t]&&delete this._params[t];this.view.update({params:this._params})}updateFromStateModel(e){var t,i,n;this._maximumHeight=e.maximumHeight,this._minimumHeight=e.minimumHeight,this._maximumWidth=e.maximumWidth,this._minimumWidth=e.minimumWidth,this.update({params:null!==(t=e.params)&&void 0!==t?t:{}}),this.setTitle(null!==(i=e.title)&&void 0!==i?i:this.id),this.setRenderer(null!==(n=e.renderer)&&void 0!==n?n:this.accessor.renderer)}updateParentGroup(e,t){this._group=e,this.api.group=this._group;const i=this._group.model.isPanelActive(this),n=this.group.api.isActive&&i;(null==t?void 0:t.skipSetActive)||this.api.isActive!==n&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&i}),this.api.isVisible!==i&&this.api._onDidVisibilityChange.fire({isVisible:i})}runEvents(){const e=this._group.model.isPanelActive(this),t=this.group.api.isActive&&e;this.api.isActive!==t&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&e}),this.api.isVisible!==e&&this.api._onDidVisibilityChange.fire({isVisible:e})}layout(e,t){this.api._onDidDimensionChange.fire({width:e,height:t}),this.view.layout(e,t)}dispose(){this.api.dispose(),this.view.dispose()}}class rt extends u{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-default-tab",this._content=document.createElement("div"),this._content.className="dv-default-tab-content",this.action=document.createElement("div"),this.action.className="dv-default-tab-action",this.action.appendChild(We({width:"11",height:"11",viewbox:"0 0 28 28",path:"M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z"})),this._element.appendChild(this._content),this._element.appendChild(this.action),this.render()}init(e){this._title=e.title,this.addDisposables(e.api.onDidTitleChange((e=>{this._title=e.title,this.render()})),c(this.action,"pointerdown",(e=>{e.preventDefault()})),c(this.action,"click",(t=>{t.defaultPrevented||(t.preventDefault(),e.api.close())}))),this.render()}render(){var e;this._content.textContent!==this._title&&(this._content.textContent=null!==(e=this._title)&&void 0!==e?e:"")}}class at{get content(){return this._content}get tab(){return this._tab}constructor(e,t,i,n){this.accessor=e,this.id=t,this.contentComponent=i,this.tabComponent=n,this._content=this.createContentComponent(this.id,i),this._tab=this.createTabComponent(this.id,n)}createTabRenderer(e){var t;const i=this.createTabComponent(this.id,this.tabComponent);return this._params&&i.init(Object.assign(Object.assign({},this._params),{tabLocation:e})),this._updateEvent&&(null===(t=i.update)||void 0===t||t.call(i,this._updateEvent)),i}init(e){this._params=e,this.content.init(e),this.tab.init(Object.assign(Object.assign({},e),{tabLocation:"header"}))}layout(e,t){var i,n;null===(n=(i=this.content).layout)||void 0===n||n.call(i,e,t)}update(e){var t,i,n,o;this._updateEvent=e,null===(i=(t=this.content).update)||void 0===i||i.call(t,e),null===(o=(n=this.tab).update)||void 0===o||o.call(n,e)}dispose(){var e,t,i,n;null===(t=(e=this.content).dispose)||void 0===t||t.call(e),null===(n=(i=this.tab).dispose)||void 0===n||n.call(i)}createContentComponent(e,t){return this.accessor.options.createComponent({id:e,name:t})}createTabComponent(e,t){const i=null!=t?t:this.accessor.options.defaultTabComponent;if(i){if(this.accessor.options.createTabComponent){const t=this.accessor.options.createTabComponent({id:e,name:i});return t||new rt}console.warn(`dockview: tabComponent '${t}' was not found. falling back to the default tab.`)}return new rt}}class dt{constructor(e){this.accessor=e}fromJSON(e,t){var i,n;const o=e.id,s=e.params,r=e.title,a=e.view,d=a?a.content.id:null!==(i=e.contentComponent)&&void 0!==i?i:"unknown",h=a?null===(n=a.tab)||void 0===n?void 0:n.id:e.tabComponent,l=new at(this.accessor,o,d,h),p=new st(o,d,h,this.accessor,new ve(this.accessor),t,l,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return p.init({title:null!=r?r:o,params:null!=s?s:{}}),p}}class ht extends u{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-watermark"}init(e){}}const lt=new class{constructor(){this._orderedList=[]}push(e){this._orderedList=[...this._orderedList.filter((t=>t!==e)),e],this.update()}destroy(e){this._orderedList=this._orderedList.filter((t=>t!==e)),this.update()}update(){for(let e=0;e<this._orderedList.length;e++)this._orderedList[e].setAttribute("aria-level",`${e}`),this._orderedList[e].style.zIndex=`calc(var(--dv-overlay-z-index, 999) + ${2*e})`}};class pt extends u{set minimumInViewportWidth(e){this.options.minimumInViewportWidth=e}set minimumInViewportHeight(e){this.options.minimumInViewportHeight=e}get element(){return this._element}get isVisible(){return this._isVisible}constructor(e){super(),this.options=e,this._element=document.createElement("div"),this._onDidChange=new p,this.onDidChange=this._onDidChange.event,this._onDidChangeEnd=new p,this.onDidChangeEnd=this._onDidChangeEnd.event,this.addDisposables(this._onDidChange,this._onDidChangeEnd),this._element.className="dv-resize-container",this._isVisible=!0,this.setupResize("top"),this.setupResize("bottom"),this.setupResize("left"),this.setupResize("right"),this.setupResize("topleft"),this.setupResize("topright"),this.setupResize("bottomleft"),this.setupResize("bottomright"),this._element.appendChild(this.options.content),this.options.container.appendChild(this._element),this.setBounds(Object.assign(Object.assign(Object.assign(Object.assign({height:this.options.height,width:this.options.width},"top"in this.options&&{top:this.options.top}),"bottom"in this.options&&{bottom:this.options.bottom}),"left"in this.options&&{left:this.options.left}),"right"in this.options&&{right:this.options.right})),lt.push(this._element)}setVisible(e){e!==this.isVisible&&(this._isVisible=e,_(this.element,"dv-hidden",!this.isVisible))}bringToFront(){lt.push(this._element)}setBounds(e={}){"number"==typeof e.height&&(this._element.style.height=`${e.height}px`),"number"==typeof e.width&&(this._element.style.width=`${e.width}px`),"top"in e&&"number"==typeof e.top&&(this._element.style.top=`${e.top}px`,this._element.style.bottom="auto",this.verticalAlignment="top"),"bottom"in e&&"number"==typeof e.bottom&&(this._element.style.bottom=`${e.bottom}px`,this._element.style.top="auto",this.verticalAlignment="bottom"),"left"in e&&"number"==typeof e.left&&(this._element.style.left=`${e.left}px`,this._element.style.right="auto",this.horiziontalAlignment="left"),"right"in e&&"number"==typeof e.right&&(this._element.style.right=`${e.right}px`,this._element.style.left="auto",this.horiziontalAlignment="right");const t=this.options.container.getBoundingClientRect(),i=this._element.getBoundingClientRect(),n=Math.max(0,this.getMinimumWidth(i.width)),o=Math.max(0,this.getMinimumHeight(i.height));if("top"===this.verticalAlignment){const e=V(i.top-t.top,-o,Math.max(0,t.height-i.height+o));this._element.style.top=`${e}px`,this._element.style.bottom="auto"}if("bottom"===this.verticalAlignment){const e=V(t.bottom-i.bottom,-o,Math.max(0,t.height-i.height+o));this._element.style.bottom=`${e}px`,this._element.style.top="auto"}if("left"===this.horiziontalAlignment){const e=V(i.left-t.left,-n,Math.max(0,t.width-i.width+n));this._element.style.left=`${e}px`,this._element.style.right="auto"}if("right"===this.horiziontalAlignment){const e=V(t.right-i.right,-n,Math.max(0,t.width-i.width+n));this._element.style.right=`${e}px`,this._element.style.left="auto"}this._onDidChange.fire()}toJSON(){const e=this.options.container.getBoundingClientRect(),t=this._element.getBoundingClientRect(),i={};return"top"===this.verticalAlignment?i.top=parseFloat(this._element.style.top):"bottom"===this.verticalAlignment?i.bottom=parseFloat(this._element.style.bottom):i.top=t.top-e.top,"left"===this.horiziontalAlignment?i.left=parseFloat(this._element.style.left):"right"===this.horiziontalAlignment?i.right=parseFloat(this._element.style.right):i.left=t.left-e.left,i.width=t.width,i.height=t.height,i}setupDrag(e,t={inDragMode:!1}){const i=new m,n=()=>{let e=null;const t=A();i.value=new u({dispose:()=>{t.release()}},c(window,"pointermove",(t=>{const i=this.options.container.getBoundingClientRect(),n=t.clientX-i.left,o=t.clientY-i.top;_(this._element,"dv-resize-container-dragging",!0);const s=this._element.getBoundingClientRect();null===e&&(e={x:t.clientX-s.left,y:t.clientY-s.top});const r=Math.max(0,this.getMinimumWidth(s.width)),a=Math.max(0,this.getMinimumHeight(s.height)),d=V(o-e.y,-a,Math.max(0,i.height-s.height+a)),h=V(e.y-o+i.height-s.height,-a,Math.max(0,i.height-s.height+a)),l=V(n-e.x,-r,Math.max(0,i.width-s.width+r)),p=V(e.x-n+i.width-s.width,-r,Math.max(0,i.width-s.width+r)),c={};d<=h?c.top=d:c.bottom=h,l<=p?c.left=l:c.right=p,this.setBounds(c)})),c(window,"pointerup",(()=>{_(this._element,"dv-resize-container-dragging",!1),i.dispose(),this._onDidChangeEnd.fire()})))};this.addDisposables(i,c(e,"pointerdown",(e=>{e.defaultPrevented?e.preventDefault():z(e)||n()})),c(this.options.content,"pointerdown",(e=>{e.defaultPrevented||z(e)||e.shiftKey&&n()})),c(this.options.content,"pointerdown",(()=>{lt.push(this._element)}),!0)),t.inDragMode&&n()}setupResize(e){const t=document.createElement("div");t.className=`dv-resize-handle-${e}`,this._element.appendChild(t);const i=new m;this.addDisposables(i,c(t,"pointerdown",(t=>{t.preventDefault();let n=null;const o=A();i.value=new u(c(window,"pointermove",(t=>{const i=this.options.container.getBoundingClientRect(),o=this._element.getBoundingClientRect(),s=t.clientY-i.top,r=t.clientX-i.left;let a,d,h,l,p,c;null===n&&(n={originalY:s,originalHeight:o.height,originalX:r,originalWidth:o.width});const v=()=>{const e=n.originalY+n.originalHeight>i.height?Math.max(0,i.height-pt.MINIMUM_HEIGHT):Math.max(0,n.originalY+n.originalHeight-pt.MINIMUM_HEIGHT);a=V(s,0,e),h=n.originalY+n.originalHeight-a,d=i.height-a-h},u=()=>{a=n.originalY-n.originalHeight;const e=a<0&&"number"==typeof this.options.minimumInViewportHeight?-a+this.options.minimumInViewportHeight:pt.MINIMUM_HEIGHT,t=i.height-Math.max(0,a);h=V(s-a,e,t),d=i.height-a-h},m=()=>{const e=n.originalX+n.originalWidth>i.width?Math.max(0,i.width-pt.MINIMUM_WIDTH):Math.max(0,n.originalX+n.originalWidth-pt.MINIMUM_WIDTH);l=V(r,0,e),c=n.originalX+n.originalWidth-l,p=i.width-l-c},g=()=>{l=n.originalX-n.originalWidth;const e=l<0&&"number"==typeof this.options.minimumInViewportWidth?-l+this.options.minimumInViewportWidth:pt.MINIMUM_WIDTH,t=i.width-Math.max(0,l);c=V(r-l,e,t),p=i.width-l-c};switch(e){case"top":v();break;case"bottom":u();break;case"left":m();break;case"right":g();break;case"topleft":v(),m();break;case"topright":v(),g();break;case"bottomleft":u(),m();break;case"bottomright":u(),g()}const b={};a<=d?b.top=a:b.bottom=d,l<=p?b.left=l:b.right=p,b.height=h,b.width=c,this.setBounds(b)})),{dispose:()=>{o.release()}},c(window,"pointerup",(()=>{i.dispose(),this._onDidChangeEnd.fire()})))})))}getMinimumWidth(e){return"number"==typeof this.options.minimumInViewportWidth?e-this.options.minimumInViewportWidth:0}getMinimumHeight(e){return"number"==typeof this.options.minimumInViewportHeight?e-this.options.minimumInViewportHeight:0}dispose(){lt.destroy(this._element),this._element.remove(),super.dispose()}}pt.MINIMUM_HEIGHT=20,pt.MINIMUM_WIDTH=20;class ct extends u{constructor(e,t){super(),this.group=e,this.overlay=t,this.addDisposables(t)}position(e){this.overlay.setBounds(e)}}const vt=100,ut=100,mt=100,gt=300,bt=300;class wt{constructor(){this.cache=new Map,this.currentFrameId=0,this.rafId=null}getPosition(e){const t=this.cache.get(e);if(t&&t.frameId===this.currentFrameId)return t.rect;this.scheduleFrameUpdate();const i=S(e);return this.cache.set(e,{rect:i,frameId:this.currentFrameId}),i}invalidate(){this.currentFrameId++}scheduleFrameUpdate(){this.rafId||(this.rafId=requestAnimationFrame((()=>{this.currentFrameId++,this.rafId=null})))}}class ft extends u{constructor(e,t){super(),this.element=e,this.accessor=t,this.map={},this._disposed=!1,this.positionCache=new wt,this.pendingUpdates=new Set,this.addDisposables(exports.DockviewDisposable.from((()=>{for(const e of Object.values(this.map))e.disposable.dispose(),e.destroy.dispose();this._disposed=!0})))}updateAllPositions(){if(!this._disposed){this.positionCache.invalidate();for(const e of Object.values(this.map))e.panel.api.isVisible&&e.resize&&e.resize()}}detatch(e){if(this.map[e.api.id]){const{disposable:t,destroy:i}=this.map[e.api.id];return t.dispose(),i.dispose(),delete this.map[e.api.id],!0}return!1}attach(e){const{panel:t,referenceContainer:i}=e;if(!this.map[t.api.id]){const e=function(){const e=document.createElement("div");return e.tabIndex=-1,e}();e.className="dv-render-overlay",e.style.visibility="hidden",this.map[t.api.id]={panel:t,disposable:exports.DockviewDisposable.NONE,destroy:exports.DockviewDisposable.NONE,element:e}}const n=this.map[t.api.id].element;t.view.content.element.parentElement!==n&&n.appendChild(t.view.content.element),n.parentElement!==this.element&&this.element.appendChild(n);const o=()=>{const e=t.api.id;this.pendingUpdates.has(e)||(this.pendingUpdates.add(e),requestAnimationFrame((()=>{if(this.pendingUpdates.delete(e),this.isDisposed||!this.map[e])return;const o=this.positionCache.getPosition(i.element),s=this.positionCache.getPosition(this.element),r=o.left-s.left,a=o.top-s.top,d=o.width,h=o.height;n.style.left=`${r}px`,n.style.top=`${a}px`,n.style.width=`${d}px`,n.style.height=`${h}px`,"hidden"===n.style.visibility&&(n.style.visibility=""),_(n,"dv-render-overlay-float","floating"===t.group.api.location.type)})))},s=()=>{t.api.isVisible&&(this.positionCache.invalidate(),o()),n.style.display=t.api.isVisible?"":"none"},r=new m,a=()=>{"floating"===t.api.location.type?queueMicrotask((()=>{const e=this.accessor.floatingGroups.find((e=>e.group===t.api.group));if(!e)return;const i=e.overlay.element,o=()=>{const e=Number(i.getAttribute("aria-level"));n.style.zIndex=`calc(var(--dv-overlay-z-index, 999) + ${2*e+1})`},s=new MutationObserver((()=>{o()}));r.value=exports.DockviewDisposable.from((()=>s.disconnect())),s.observe(i,{attributeFilter:["aria-level"],attributes:!0}),o()})):n.style.zIndex=""},d=new u(r,new me(n,{onDragEnd:e=>{i.dropTarget.dnd.onDragEnd(e)},onDragEnter:e=>{i.dropTarget.dnd.onDragEnter(e)},onDragLeave:e=>{i.dropTarget.dnd.onDragLeave(e)},onDrop:e=>{i.dropTarget.dnd.onDrop(e)},onDragOver:e=>{i.dropTarget.dnd.onDragOver(e)}}),t.api.onDidVisibilityChange((()=>{s()})),t.api.onDidDimensionsChange((()=>{t.api.isVisible&&o()})),t.api.onDidLocationChange((()=>{a()})));return this.map[t.api.id].destroy=exports.DockviewDisposable.from((()=>{var e;t.view.content.element.parentElement===n&&n.removeChild(t.view.content.element),null===(e=n.parentElement)||void 0===e||e.removeChild(n)})),a(),queueMicrotask((()=>{this.isDisposed||s()})),this.map[t.api.id].disposable.dispose(),this.map[t.api.id].disposable=d,this.map[t.api.id].resize=o,n}}function _t(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{d(n.next(e))}catch(e){s(e)}}function a(e){try{d(n.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}d((n=n.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class xt extends u{get window(){var e,t;return null!==(t=null===(e=this._window)||void 0===e?void 0:e.value)&&void 0!==t?t:null}constructor(e,t,i){super(),this.target=e,this.className=t,this.options=i,this._onWillClose=new p,this.onWillClose=this._onWillClose.event,this._onDidClose=new p,this.onDidClose=this._onDidClose.event,this._window=null,this.addDisposables(this._onWillClose,this._onDidClose,{dispose:()=>{this.close()}})}dimensions(){if(!this._window)return null;const e=this._window.value.screenX;return{top:this._window.value.screenY,left:e,width:this._window.value.innerWidth,height:this._window.value.innerHeight}}close(){var e,t;this._window&&(this._onWillClose.fire(),null===(t=(e=this.options).onWillClose)||void 0===t||t.call(e,{id:this.target,window:this._window.value}),this._window.disposable.dispose(),this._window=null,this._onDidClose.fire())}open(){var e,t;return _t(this,void 0,void 0,(function*(){if(this._window)throw new Error("instance of popout window is already open");const i=`${this.options.url}`,n=Object.entries({top:this.options.top,left:this.options.left,width:this.options.width,height:this.options.height}).map((([e,t])=>`${e}=${t}`)).join(","),o=window.open(i,this.target,n);if(!o)return null;const s=new u;this._window={value:o,disposable:s},s.addDisposables(exports.DockviewDisposable.from((()=>{o.close()})),c(window,"beforeunload",(()=>{this.close()})));const r=this.createPopoutWindowContainer();return this.className&&r.classList.add(this.className),null===(t=(e=this.options).onDidOpen)||void 0===t||t.call(e,{id:this.target,window:o}),new Promise(((e,t)=>{o.addEventListener("unload",(e=>{})),o.addEventListener("load",(()=>{try{const t=o.document;t.title=document.title,t.body.appendChild(r),function(e,t){const i=Array.from(t);for(const t of i){if(t.href){const i=e.createElement("link");i.href=t.href,i.type=t.type,i.rel="stylesheet",e.head.appendChild(i)}let i=[];try{t.cssRules&&(i=Array.from(t.cssRules).map((e=>e.cssText)))}catch(e){}for(const t of i){const i=e.createElement("style");i.appendChild(e.createTextNode(t)),e.head.appendChild(i)}}}(t,window.document.styleSheets),c(o,"beforeunload",(()=>{this.close()})),e(r)}catch(e){t(e)}}))}))}))}createPopoutWindowContainer(){const e=document.createElement("div");return e.classList.add("dv-popout-window"),e.id="dv-popout-window",e.style.position="absolute",e.style.width="100%",e.style.height="100%",e.style.top="0px",e.style.left="0px",e}}class Dt extends u{constructor(e){super(),this.accessor=e,this.init()}init(){const e=new Set,t=new Set;this.addDisposables(this.accessor.onDidAddPanel((t=>{if(e.has(t.api.id))throw new Error(`dockview: Invalid event sequence. [onDidAddPanel] called for panel ${t.api.id} but panel already exists`);e.add(t.api.id)})),this.accessor.onDidRemovePanel((t=>{if(!e.has(t.api.id))throw new Error(`dockview: Invalid event sequence. [onDidRemovePanel] called for panel ${t.api.id} but panel does not exists`);e.delete(t.api.id)})),this.accessor.onDidAddGroup((e=>{if(t.has(e.api.id))throw new Error(`dockview: Invalid event sequence. [onDidAddGroup] called for group ${e.api.id} but group already exists`);t.add(e.api.id)})),this.accessor.onDidRemoveGroup((e=>{if(!t.has(e.api.id))throw new Error(`dockview: Invalid event sequence. [onDidRemoveGroup] called for group ${e.api.id} but group does not exists`);t.delete(e.api.id)})))}}class yt extends u{constructor(e){super(),this.root=e,this._active=null,this._activeDisposable=new m,this._element=document.createElement("div"),this._element.className="dv-popover-anchor",this._element.style.position="relative",this.root.prepend(this._element),this.addDisposables(exports.DockviewDisposable.from((()=>{this.close()})),this._activeDisposable)}openPopover(e,t){var i;this.close();const n=document.createElement("div");n.style.position="absolute",n.style.zIndex=null!==(i=t.zIndex)&&void 0!==i?i:"var(--dv-overlay-z-index)",n.appendChild(e);const o=this._element.getBoundingClientRect(),s=o.left,r=o.top;n.style.top=t.y-r+"px",n.style.left=t.x-s+"px",this._element.appendChild(n),this._active=n,this._activeDisposable.value=new u(c(window,"pointerdown",(e=>{var t;const i=e.target;if(!(i instanceof HTMLElement))return;let o=i;for(;o&&o!==n;)o=null!==(t=null==o?void 0:o.parentElement)&&void 0!==t?t:null;o||this.close()})),c(window,"resize",(()=>{this.close()}))),requestAnimationFrame((()=>{!function(e,t,i={buffer:10}){const n=i.buffer,o=e.getBoundingClientRect(),s=t.getBoundingClientRect();let r=0,a=0;const d=o.left-s.left,h=o.top-s.top,l=o.bottom-s.bottom,p=o.right-s.right;d<n?r=n-d:p>n&&(r=-n-p),h<n?a=n-h:l>n&&(a=-l-n),0===r&&0===a||(e.style.transform=`translate(${r}px, ${a}px)`)}(n,this.root)}))}close(){this._active&&(this._active.remove(),this._activeDisposable.dispose(),this._active=null)}}class Ct extends u{get disabled(){return this._disabled}set disabled(e){var t;this.disabled!==e&&(this._disabled=e,e&&(null===(t=this.model)||void 0===t||t.clear()))}get model(){if(!this.disabled)return{clear:()=>{var e;this._model&&(null===(e=this._model.root.parentElement)||void 0===e||e.removeChild(this._model.root)),this._model=void 0},exists:()=>!!this._model,getElements:(e,t)=>{const i=this._outline!==t;if(this._outline=t,this._model)return this._model.changed=i,this._model;const n=this.createContainer(),o=this.createAnchor();if(this._model={root:n,overlay:o,changed:i},n.appendChild(o),this.element.appendChild(n),(null==e?void 0:e.target)instanceof HTMLElement){const t=e.target.getBoundingClientRect(),i=this.element.getBoundingClientRect();o.style.left=t.left-i.left+"px",o.style.top=t.top-i.top+"px"}return this._model}}}constructor(e,t){super(),this.element=e,this._disabled=!1,this._disabled=t.disabled,this.addDisposables(exports.DockviewDisposable.from((()=>{var e;null===(e=this.model)||void 0===e||e.clear()})))}createContainer(){const e=document.createElement("div");return e.className="dv-drop-target-container",e}createAnchor(){const e=document.createElement("div");return e.className="dv-drop-target-anchor",e.style.visibility="hidden",e}}const zt={activationSize:{type:"pixels",value:10},size:{type:"pixels",value:20}};function St(e){const t=e.from.activePanel;[...e.from.panels].map((t=>{const i=e.from.model.removePanel(t);return e.from.model.renderContainer.detatch(t),i})).forEach((i=>{e.to.model.openPanel(i,{skipSetActive:t!==i,skipSetGroupActive:!0})}))}class At extends he{get orientation(){return this.gridview.orientation}get totalPanels(){return this.panels.length}get panels(){return this.groups.flatMap((e=>e.panels))}get options(){return this._options}get activePanel(){const e=this.activeGroup;if(e)return e.activePanel}get renderer(){var e;return null!==(e=this.options.defaultRenderer)&&void 0!==e?e:"onlyWhenVisible"}get defaultHeaderPosition(){var e;return null!==(e=this.options.defaultHeaderPosition)&&void 0!==e?e:"top"}get api(){return this._api}get floatingGroups(){return this._floatingGroups}get popoutRestorationPromise(){return this._popoutRestorationPromise}constructor(e,t){var i,n,o;super(e,{proportionalLayout:!0,orientation:exports.Orientation.HORIZONTAL,styles:t.hideBorders?{separatorBorder:"transparent"}:void 0,disableAutoResizing:t.disableAutoResizing,locked:t.locked,margin:null!==(n=null===(i=t.theme)||void 0===i?void 0:i.gap)&&void 0!==n?n:0,className:t.className}),this.nextGroupId=N(),this._deserializer=new dt(this),this._watermark=null,this._onWillDragPanel=new p,this.onWillDragPanel=this._onWillDragPanel.event,this._onWillDragGroup=new p,this.onWillDragGroup=this._onWillDragGroup.event,this._onDidDrop=new p,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new p,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new p,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onUnhandledDragOverEvent=new p,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this._onDidRemovePanel=new p,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidAddPanel=new p,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPopoutGroupSizeChange=new p,this.onDidPopoutGroupSizeChange=this._onDidPopoutGroupSizeChange.event,this._onDidPopoutGroupPositionChange=new p,this.onDidPopoutGroupPositionChange=this._onDidPopoutGroupPositionChange.event,this._onDidOpenPopoutWindowFail=new p,this.onDidOpenPopoutWindowFail=this._onDidOpenPopoutWindowFail.event,this._onDidLayoutFromJSON=new p,this.onDidLayoutFromJSON=this._onDidLayoutFromJSON.event,this._onDidActivePanelChange=new p({replay:!0}),this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onDidMovePanel=new p,this.onDidMovePanel=this._onDidMovePanel.event,this._onDidMaximizedGroupChange=new p,this.onDidMaximizedGroupChange=this._onDidMaximizedGroupChange.event,this._floatingGroups=[],this._popoutGroups=[],this._popoutRestorationPromise=Promise.resolve(),this._onDidRemoveGroup=new p,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new p,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidOptionsChange=new p,this.onDidOptionsChange=this._onDidOptionsChange.event,this._onDidActiveGroupChange=new p,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._moving=!1,this._options=t,this.popupService=new yt(this.element),this._themeClassnames=new k(this.element),this._api=new ve(this),this.rootDropTargetContainer=new Ct(this.element,{disabled:!0}),this.overlayRenderContainer=new ft(this.gridview.element,this),this._rootDropTarget=new xe(this.element,{className:"dv-drop-target-edge",canDisplayOverlay:(e,t)=>{const i=s();if(i)return i.viewId===this.id&&("center"!==t||0===this.gridview.length);if("center"===t&&0!==this.gridview.length)return!1;const n=new Be(e,"edge",t,s);return this._onUnhandledDragOverEvent.fire(n),n.isAccepted},acceptedTargetZones:["top","bottom","left","right","center"],overlayModel:null!==(o=t.rootOverlayModel)&&void 0!==o?o:zt,getOverrideTarget:()=>{var e;return null===(e=this.rootDropTargetContainer)||void 0===e?void 0:e.model}}),this.updateDropTargetModel(t),_(this.gridview.element,"dv-dockview",!0),_(this.element,"dv-debug",!!t.debug),this.updateTheme(),this.updateWatermark(),t.debug&&this.addDisposables(new Dt(this)),this.addDisposables(this.rootDropTargetContainer,this.overlayRenderContainer,this._onWillDragPanel,this._onWillDragGroup,this._onWillShowOverlay,this._onDidActivePanelChange,this._onDidAddPanel,this._onDidRemovePanel,this._onDidLayoutFromJSON,this._onDidDrop,this._onWillDrop,this._onDidMovePanel,this._onDidMovePanel.event((()=>{this.debouncedUpdateAllPositions()})),this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this._onUnhandledDragOverEvent,this._onDidMaximizedGroupChange,this._onDidOptionsChange,this._onDidPopoutGroupSizeChange,this._onDidPopoutGroupPositionChange,this._onDidOpenPopoutWindowFail,this.onDidViewVisibilityChangeMicroTaskQueue((()=>{this.updateWatermark()})),this.onDidAdd((e=>{this._moving||this._onDidAddGroup.fire(e)})),this.onDidRemove((e=>{this._moving||this._onDidRemoveGroup.fire(e)})),this.onDidActiveChange((e=>{this._moving||this._onDidActiveGroupChange.fire(e)})),this.onDidMaximizedChange((e=>{this._onDidMaximizedGroupChange.fire({group:e.panel,isMaximized:e.isMaximized})})),exports.DockviewEvent.any(this.onDidAdd,this.onDidRemove)((()=>{this.updateWatermark()})),exports.DockviewEvent.any(this.onDidAddPanel,this.onDidRemovePanel,this.onDidAddGroup,this.onDidRemove,this.onDidMovePanel,this.onDidActivePanelChange,this.onDidPopoutGroupPositionChange,this.onDidPopoutGroupSizeChange)((()=>{this._bufferOnDidLayoutChange.fire()})),exports.DockviewDisposable.from((()=>{for(const e of[...this._floatingGroups])e.dispose();for(const e of[...this._popoutGroups])e.disposable.dispose()})),this._rootDropTarget,this._rootDropTarget.onWillShowOverlay((e=>{this.gridview.length>0&&"center"===e.position||this._onWillShowOverlay.fire(new Ne(e,{kind:"edge",panel:void 0,api:this._api,group:void 0,getData:s}))})),this._rootDropTarget.onDrop((e=>{var t;const i=new Xe({nativeEvent:e.nativeEvent,position:e.position,panel:void 0,api:this._api,group:void 0,getData:s,kind:"edge"});if(this._onWillDrop.fire(i),i.defaultPrevented)return;const n=s();n?this.moveGroupOrPanel({from:{groupId:n.groupId,panelId:null!==(t=n.panelId)&&void 0!==t?t:void 0},to:{group:this.orthogonalize(e.position),position:"center"}}):this._onDidDrop.fire(new Ye({nativeEvent:e.nativeEvent,position:e.position,panel:void 0,api:this._api,group:void 0,getData:s}))})),this._rootDropTarget)}setVisible(e,t){switch(e.api.location.type){case"grid":super.setVisible(e,t);break;case"floating":{const i=this.floatingGroups.find((t=>t.group===e));i&&(i.overlay.setVisible(t),e.api._onDidVisibilityChange.fire({isVisible:t}));break}case"popout":console.warn("dockview: You cannot hide a group that is in a popout window")}}addPopoutGroup(e,t){var i,n,o,s,r;if(e instanceof st&&1===e.group.size)return this.addPopoutGroup(e.group,t);const a=function(e){function t(e){const t=[];for(let i=0;i<e.classList.length;i++)t.push(e.classList.item(i));return t}let i,n=e;for(;null!==n&&(i=t(n).find((e=>e.startsWith("dockview-theme-"))),"string"!=typeof i);)n=n.parentElement;return i}(this.gridview.element),d=this.element;const h=(null==t?void 0:t.position)?t.position:e instanceof it?e.element.getBoundingClientRect():e.group?e.group.element.getBoundingClientRect():d.getBoundingClientRect(),l=null!==(n=null===(i=null==t?void 0:t.overridePopoutGroup)||void 0===i?void 0:i.id)&&void 0!==n?n:this.getNextGroupId(),v=new xt(`${this.id}-${l}`,null!=a?a:"",{url:null!==(r=null!==(o=null==t?void 0:t.popoutUrl)&&void 0!==o?o:null===(s=this.options)||void 0===s?void 0:s.popoutUrl)&&void 0!==r?r:"/popout.html",left:window.screenX+h.left,top:window.screenY+h.top,width:h.width,height:h.height,onDidOpen:null==t?void 0:t.onDidOpen,onWillClose:null==t?void 0:t.onWillClose}),m=new u(v,v.onDidClose((()=>{m.dispose()})));return v.open().then((i=>{var n;if(v.isDisposed)return!1;const o=(null==t?void 0:t.referenceGroup)?t.referenceGroup:e instanceof st?e.group:e,s=e.api.location.type,r=null!==o.element.parentElement;let a;if(r?(null==t?void 0:t.overridePopoutGroup)?a=t.overridePopoutGroup:(a=this.createGroup({id:l}),i&&this._onDidAddGroup.fire(a)):a=o,null===i)return console.error("dockview: failed to create popout. perhaps you need to allow pop-ups for this website"),m.dispose(),this._onDidOpenPopoutWindowFail.fire(),this.movingLock((()=>St({from:a,to:o}))),o.api.isVisible||o.api.setVisible(!0),!1;const d=document.createElement("div");d.className="dv-overlay-render-container";const h=new ft(d,this);let g;if(a.model.renderContainer=h,a.layout(v.window.innerWidth,v.window.innerHeight),!(null==t?void 0:t.overridePopoutGroup)&&r)if(e instanceof st)this.movingLock((()=>{const t=o.model.removePanel(e);a.model.openPanel(t)}));else switch(this.movingLock((()=>St({from:o,to:a}))),s){case"grid":o.api.setVisible(!1);break;case"floating":case"popout":g=null===(n=this._floatingGroups.find((t=>t.group.api.id===e.api.id)))||void 0===n?void 0:n.overlay.toJSON(),this.removeGroup(o)}i.classList.add("dv-dockview"),i.style.overflow="hidden",i.appendChild(d),i.appendChild(a.element);const b=document.createElement("div"),w=new Ct(b,{disabled:this.rootDropTargetContainer.disabled});let f;i.appendChild(b),a.model.dropTargetContainer=w,a.model.location={type:"popout",getWindow:()=>v.window,popoutUrl:null==t?void 0:t.popoutUrl},r&&"grid"===e.api.location.type&&e.api.setVisible(!1),this.doSetGroupAndPanelActive(a),m.addDisposables(a.api.onDidActiveChange((e=>{var t;e.isActive&&(null===(t=v.window)||void 0===t||t.focus())})),a.api.onWillFocus((()=>{var e;null===(e=v.window)||void 0===e||e.focus()})));const _=r&&o&&this.getPanel(o.id),x={window:v,popoutGroup:a,referenceGroup:_?o.id:void 0,disposable:{dispose:()=>(m.dispose(),f)}},D=function(e){const t=new p;let i,n=e.screenX,o=e.screenY;const s=()=>{if(e.closed)return;const r=e.screenX,a=e.screenY;r===n&&a===o||(clearTimeout(i),i=setTimeout((()=>{t.fire()}),100),n=r,o=a),requestAnimationFrame(s)};return s(),t}(v.window);return m.addDisposables(D,function(e,t){let i;return new u(c(e,"resize",(()=>{clearTimeout(i),i=setTimeout((()=>{t()}),100)})))}(v.window,(()=>{this._onDidPopoutGroupSizeChange.fire({width:v.window.innerWidth,height:v.window.innerHeight,group:a})})),D.event((()=>{this._onDidPopoutGroupPositionChange.fire({screenX:v.window.screenX,screenY:v.window.screenX,group:a})})),c(v.window,"resize",(()=>{a.layout(v.window.innerWidth,v.window.innerHeight)})),h,exports.DockviewDisposable.from((()=>{if(!this.isDisposed)if(r&&this.getPanel(o.id))this.movingLock((()=>St({from:a,to:o}))),o.api.isVisible||o.api.setVisible(!0),this.getPanel(a.id)&&this.doRemoveGroup(a,{skipPopoutAssociated:!0});else if(this.getPanel(a.id)){a.model.renderContainer=this.overlayRenderContainer,a.model.dropTargetContainer=this.rootDropTargetContainer,f=a;if(!this._popoutGroups.find((e=>e.popoutGroup===a)))return;g?this.addFloatingGroup(a,{height:g.height,width:g.width,position:g}):(this.doRemoveGroup(a,{skipDispose:!0,skipActive:!0,skipPopoutReturn:!0}),a.model.location={type:"grid"},this.movingLock((()=>{this.doAddGroup(a,[0])}))),this.doSetGroupAndPanelActive(a)}}))),this._popoutGroups.push(x),this.updateWatermark(),!0})).catch((e=>(console.error("dockview: failed to create popout.",e),!1)))}addFloatingGroup(e,t){var i,n,o,s,r;let a;if(e instanceof st)a=this.createGroup(),this._onDidAddGroup.fire(a),this.movingLock((()=>this.removePanel(e,{removeEmptyGroup:!0,skipDispose:!0,skipSetActiveGroup:!0}))),this.movingLock((()=>a.model.openPanel(e,{skipSetGroupActive:!0})));else{a=e;const n=null===(i=this._popoutGroups.find((e=>e.popoutGroup===a)))||void 0===i?void 0:i.referenceGroup,o=n?this.getPanel(n):void 0;"boolean"==typeof(null==t?void 0:t.skipRemoveGroup)&&t.skipRemoveGroup||(o?(this.movingLock((()=>St({from:e,to:o}))),this.doRemoveGroup(e,{skipPopoutReturn:!0,skipPopoutAssociated:!0}),this.doRemoveGroup(o,{skipDispose:!0}),a=o):this.doRemoveGroup(e,{skipDispose:!0,skipPopoutReturn:!0,skipPopoutAssociated:!1}))}const d=function(){if(null==t?void 0:t.position){const e={};return"left"in t.position?e.left=Math.max(t.position.left,0):"right"in t.position?e.right=Math.max(t.position.right,0):e.left=ut,"top"in t.position?e.top=Math.max(t.position.top,0):"bottom"in t.position?e.bottom=Math.max(t.position.bottom,0):e.top=mt,"number"==typeof t.width?e.width=Math.max(t.width,0):e.width=gt,"number"==typeof t.height?e.height=Math.max(t.height,0):e.height=bt,e}return{left:"number"==typeof(null==t?void 0:t.x)?Math.max(t.x,0):ut,top:"number"==typeof(null==t?void 0:t.y)?Math.max(t.y,0):mt,width:"number"==typeof(null==t?void 0:t.width)?Math.max(t.width,0):gt,height:"number"==typeof(null==t?void 0:t.height)?Math.max(t.height,0):bt}}(),h=new pt(Object.assign(Object.assign({container:this.gridview.element,content:a.element},d),{minimumInViewportWidth:"boundedWithinViewport"===this.options.floatingGroupBounds?void 0:null!==(o=null===(n=this.options.floatingGroupBounds)||void 0===n?void 0:n.minimumWidthWithinViewport)&&void 0!==o?o:vt,minimumInViewportHeight:"boundedWithinViewport"===this.options.floatingGroupBounds?void 0:null!==(r=null===(s=this.options.floatingGroupBounds)||void 0===s?void 0:s.minimumHeightWithinViewport)&&void 0!==r?r:vt})),l=a.element.querySelector(".dv-void-container");if(!l)throw new Error("dockview: failed to find drag handle");h.setupDrag(l,{inDragMode:"boolean"==typeof(null==t?void 0:t.inDragMode)&&t.inDragMode});const p=new ct(a,h),c=new u(a.api.onDidActiveChange((e=>{e.isActive&&h.bringToFront()})),b(a.element,(e=>{const{width:t,height:i}=e.contentRect;a.layout(t,i)})));p.addDisposables(h.onDidChange((()=>{a.layout(a.width,a.height)})),h.onDidChangeEnd((()=>{this._bufferOnDidLayoutChange.fire()})),a.onDidChange((e=>{h.setBounds({height:null==e?void 0:e.height,width:null==e?void 0:e.width})})),{dispose:()=>{c.dispose(),I(this._floatingGroups,p),a.model.location={type:"grid"},this.updateWatermark()}}),this._floatingGroups.push(p),a.model.location={type:"floating"},(null==t?void 0:t.skipActiveGroup)||this.doSetGroupAndPanelActive(a),this.updateWatermark()}orthogonalize(e,t){switch(this.gridview.normalize(),e){case"top":case"bottom":this.gridview.orientation===exports.Orientation.HORIZONTAL&&this.gridview.insertOrthogonalSplitviewAtRoot();break;case"left":case"right":this.gridview.orientation===exports.Orientation.VERTICAL&&this.gridview.insertOrthogonalSplitviewAtRoot()}switch(e){case"top":case"left":case"center":return this.createGroupAtLocation([0],void 0,t);case"bottom":case"right":return this.createGroupAtLocation([this.gridview.length],void 0,t);default:throw new Error(`dockview: unsupported position ${e}`)}}updateOptions(e){var t,i;if(super.updateOptions(e),"floatingGroupBounds"in e)for(const n of this._floatingGroups){switch(e.floatingGroupBounds){case"boundedWithinViewport":n.overlay.minimumInViewportHeight=void 0,n.overlay.minimumInViewportWidth=void 0;break;case void 0:n.overlay.minimumInViewportHeight=vt,n.overlay.minimumInViewportWidth=vt;break;default:n.overlay.minimumInViewportHeight=null===(t=e.floatingGroupBounds)||void 0===t?void 0:t.minimumHeightWithinViewport,n.overlay.minimumInViewportWidth=null===(i=e.floatingGroupBounds)||void 0===i?void 0:i.minimumWidthWithinViewport}n.overlay.setBounds()}this.updateDropTargetModel(e);const n=this.options.disableDnd;this._options=Object.assign(Object.assign({},this.options),e);if(n!==this.options.disableDnd&&this.updateDragAndDropState(),"theme"in e&&this.updateTheme(),"createRightHeaderActionComponent"in e||"createLeftHeaderActionComponent"in e||"createPrefixHeaderActionComponent"in e)for(const e of this.groups)e.model.updateHeaderActions();this.layout(this.gridview.width,this.gridview.height,!0)}layout(e,t,i){if(super.layout(e,t,i),this._floatingGroups)for(const e of this._floatingGroups)e.overlay.setBounds()}updateDragAndDropState(){for(const e of this.groups)e.model.updateDragAndDropState()}focus(){var e;null===(e=this.activeGroup)||void 0===e||e.focus()}getGroupPanel(e){return this.panels.find((t=>t.id===e))}setActivePanel(e){e.group.model.openPanel(e),this.doSetGroupAndPanelActive(e.group)}moveToNext(e={}){var t;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.activePanel!==e.group.panels[e.group.panels.length-1])return void e.group.model.moveToNext({suppressRoll:!0});const i=K(e.group.element),n=null===(t=this.gridview.next(i))||void 0===t?void 0:t.view;this.doSetGroupAndPanelActive(n)}moveToPrevious(e={}){var t;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.activePanel!==e.group.panels[0])return void e.group.model.moveToPrevious({suppressRoll:!0});const i=K(e.group.element),n=null===(t=this.gridview.previous(i))||void 0===t?void 0:t.view;n&&this.doSetGroupAndPanelActive(n)}toJSON(){var e;const t=this.gridview.serialize(),i=this.panels.reduce(((e,t)=>(e[t.id]=t.toJSON(),e)),{}),n=this._floatingGroups.map((e=>({data:e.group.toJSON(),position:e.overlay.toJSON()}))),o=this._popoutGroups.map((e=>({data:e.popoutGroup.toJSON(),gridReferenceGroup:e.referenceGroup,position:e.window.dimensions(),url:"popout"===e.popoutGroup.api.location.type?e.popoutGroup.api.location.popoutUrl:void 0}))),s={grid:t,panels:i,activeGroup:null===(e=this.activeGroup)||void 0===e?void 0:e.id};return n.length>0&&(s.floatingGroups=n),o.length>0&&(s.popoutGroups=o),s}fromJSON(e,t){var i,n;const o=new Map;let s;if(null==t?void 0:t.reuseExistingPanels){s=this.createGroup(),this._groups.delete(s.api.id);const t=Object.keys(e.panels);for(const e of this.panels)t.includes(e.api.id)&&o.set(e.api.id,e);this.movingLock((()=>{Array.from(o.values()).forEach((e=>{this.moveGroupOrPanel({from:{groupId:e.api.group.api.id,panelId:e.api.id},to:{group:s,position:"center"},keepEmptyGroups:!0})}))}))}if(this.clear(),"object"!=typeof e||null===e)throw new Error("dockview: serialized layout must be a non-null object");const{grid:r,panels:a,activeGroup:d}=e;if("branch"!==r.root.type||!Array.isArray(r.root.data))throw new Error("dockview: root must be of type branch");try{const t=this.width,h=this.height,l=e=>{const{id:t,locked:i,hideHeader:n,headerPosition:r,views:d,activeView:h}=e;if("string"!=typeof t)throw new Error("dockview: group id must be of type string");const l=this.createGroup({id:t,locked:!!i,hideHeader:!!n,headerPosition:r});this._onDidAddGroup.fire(l);const p=[];for(const e of d){const t=o.get(e);if(s&&t)this.movingLock((()=>{s.model.removePanel(t)})),p.push(t),t.updateFromStateModel(a[e]);else{const t=this._deserializer.fromJSON(a[e],l);p.push(t)}}for(let e=0;e<d.length;e++){const t=p[e],i="string"==typeof h&&h===t.id;o.has(t.api.id)?this.movingLock((()=>{l.model.openPanel(t,{skipSetActive:!i,skipSetGroupActive:!0})})):l.model.openPanel(t,{skipSetActive:!i,skipSetGroupActive:!0})}return!l.activePanel&&l.panels.length>0&&l.model.openPanel(l.panels[l.panels.length-1],{skipSetGroupActive:!0}),l};this.gridview.deserialize(r,{fromJSON:e=>l(e.data)}),this.layout(t,h,!0);const p=null!==(i=e.floatingGroups)&&void 0!==i?i:[];for(const e of p){const{data:t,position:i}=e,n=l(t);this.addFloatingGroup(n,{position:i,width:i.width,height:i.height,skipRemoveGroup:!0,inDragMode:!1})}const c=null!==(n=e.popoutGroups)&&void 0!==n?n:[],v=[];c.forEach(((e,t)=>{const{data:i,position:n,gridReferenceGroup:o,url:s}=e,r=l(i),a=new Promise((e=>{setTimeout((()=>{this.addPopoutGroup(r,{position:null!=n?n:void 0,overridePopoutGroup:o?r:void 0,referenceGroup:o?this.getPanel(o):void 0,popoutUrl:s}),e()}),100*t)}));v.push(a)})),this._popoutRestorationPromise=Promise.all(v).then((()=>{}));for(const e of this._floatingGroups)e.overlay.setBounds();if("string"==typeof d){const e=this.getPanel(d);e&&this.doSetGroupAndPanelActive(e)}}catch(e){console.error("dockview: failed to deserialize layout. Reverting changes",e);for(const e of this.groups)for(const t of e.panels)this.removePanel(t,{removeEmptyGroup:!1,skipDispose:!1});for(const e of this.groups)e.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e);for(const e of[...this._floatingGroups])e.dispose();throw this.clear(),e}this.updateWatermark(),this.debouncedUpdateAllPositions(),this._onDidLayoutFromJSON.fire()}clear(){const e=Array.from(this._groups.values()).map((e=>e.value)),t=!!this.activeGroup;for(const t of e)this.removeGroup(t,{skipActive:!0});t&&this.doSetGroupAndPanelActive(void 0),this.gridview.clear()}closeAllGroups(){for(const e of this._groups.entries()){const[t,i]=e;i.value.model.closeAllPanels()}}addPanel(e){var t,i;if(this.panels.find((t=>t.id===e.id)))throw new Error(`dockview: panel with id ${e.id} already exists`);let n;if(e.position&&e.floating)throw new Error("dockview: you can only provide one of: position, floating as arguments to .addPanel(...)");const o={width:e.initialWidth,height:e.initialHeight};let s,r;if(e.position)if($e(e.position)){const t="string"==typeof e.position.referencePanel?this.getGroupPanel(e.position.referencePanel):e.position.referencePanel;if(s=e.position.index,!t)throw new Error(`dockview: referencePanel '${e.position.referencePanel}' does not exist`);n=this.findGroup(t)}else{if(!Je(e.position)){const t=this.orthogonalize(be(e.position.direction)),i=this.createPanel(e,t);return t.model.openPanel(i,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:s}),e.inactive||this.doSetGroupAndPanelActive(t),t.api.setSize({height:null==o?void 0:o.height,width:null==o?void 0:o.width}),i}if(n="string"==typeof e.position.referenceGroup?null===(t=this._groups.get(e.position.referenceGroup))||void 0===t?void 0:t.value:e.position.referenceGroup,s=e.position.index,!n)throw new Error(`dockview: referenceGroup '${e.position.referenceGroup}' does not exist`)}else n=this.activeGroup;if(n){const t=de((null===(i=e.position)||void 0===i?void 0:i.direction)||"within");if(e.floating){const t=this.createGroup();this._onDidAddGroup.fire(t);const i="object"==typeof e.floating&&null!==e.floating?e.floating:{};this.addFloatingGroup(t,Object.assign(Object.assign({},i),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),r=this.createPanel(e,t),t.model.openPanel(r,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:s})}else if("floating"===n.api.location.type||"center"===t)r=this.createPanel(e,n),n.model.openPanel(r,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:s}),n.api.setSize({width:null==o?void 0:o.width,height:null==o?void 0:o.height}),e.inactive||this.doSetGroupAndPanelActive(n);else{const i=K(n.element),a=q(this.gridview.orientation,i,t),d=this.createGroupAtLocation(a,this.orientationAtLocation(a)===exports.Orientation.VERTICAL?null==o?void 0:o.height:null==o?void 0:o.width);r=this.createPanel(e,d),d.model.openPanel(r,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:s}),e.inactive||this.doSetGroupAndPanelActive(d)}}else if(e.floating){const t=this.createGroup();this._onDidAddGroup.fire(t);const i="object"==typeof e.floating&&null!==e.floating?e.floating:{};this.addFloatingGroup(t,Object.assign(Object.assign({},i),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),r=this.createPanel(e,t),t.model.openPanel(r,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:s})}else{const t=this.createGroupAtLocation([0],this.gridview.orientation===exports.Orientation.VERTICAL?null==o?void 0:o.height:null==o?void 0:o.width);r=this.createPanel(e,t),t.model.openPanel(r,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:s}),e.inactive||this.doSetGroupAndPanelActive(t)}return r}removePanel(e,t={removeEmptyGroup:!0}){const i=e.group;if(!i)throw new Error(`dockview: cannot remove panel ${e.id}. it's missing a group.`);i.model.removePanel(e,{skipSetActiveGroup:t.skipSetActiveGroup}),t.skipDispose||(e.group.model.renderContainer.detatch(e),e.dispose()),0===i.size&&t.removeEmptyGroup&&this.removeGroup(i,{skipActive:t.skipSetActiveGroup})}createWatermarkComponent(){return this.options.createWatermarkComponent?this.options.createWatermarkComponent():new ht}updateWatermark(){var e,t,i;if(0===this.groups.filter((e=>"grid"===e.api.location.type&&e.api.isVisible)).length){if(!this._watermark){this._watermark=this.createWatermarkComponent(),this._watermark.init({containerApi:new ve(this)});const e=document.createElement("div");e.className="dv-watermark-container",i="watermark-component",e.setAttribute("data-testid",i),e.appendChild(this._watermark.element),this.gridview.element.appendChild(e)}}else this._watermark&&(this._watermark.element.parentElement.remove(),null===(t=(e=this._watermark).dispose)||void 0===t||t.call(e),this._watermark=null)}addGroup(e){var t;if(e){let i;if(je(e)){const t="string"==typeof e.referencePanel?this.panels.find((t=>t.id===e.referencePanel)):e.referencePanel;if(!t)throw new Error(`dockview: reference panel ${e.referencePanel} does not exist`);if(i=this.findGroup(t),!i)throw new Error(`dockview: reference group for reference panel ${e.referencePanel} does not exist`)}else{if(!Ze(e)){const t=this.orthogonalize(be(e.direction),e);return e.skipSetActive||this.doSetGroupAndPanelActive(t),t}if(i="string"==typeof e.referenceGroup?null===(t=this._groups.get(e.referenceGroup))||void 0===t?void 0:t.value:e.referenceGroup,!i)throw new Error(`dockview: reference group ${e.referenceGroup} does not exist`)}const n=de(e.direction||"within"),o=K(i.element),s=q(this.gridview.orientation,o,n),r=this.createGroup(e),a=this.getLocationOrientation(s)===exports.Orientation.VERTICAL?e.initialHeight:e.initialWidth;return this.doAddGroup(r,s,a),e.skipSetActive||this.doSetGroupAndPanelActive(r),r}{const t=this.createGroup(e);return this.doAddGroup(t),this.doSetGroupAndPanelActive(t),t}}getLocationOrientation(e){return e.length%2==0&&this.gridview.orientation===exports.Orientation.HORIZONTAL?exports.Orientation.HORIZONTAL:exports.Orientation.VERTICAL}removeGroup(e,t){this.doRemoveGroup(e,t)}doRemoveGroup(e,t){var i;const n=[...e.panels];if(!(null==t?void 0:t.skipDispose))for(const e of n)this.removePanel(e,{removeEmptyGroup:!1,skipDispose:null!==(i=null==t?void 0:t.skipDispose)&&void 0!==i&&i});const o=this.activePanel;if("floating"===e.api.location.type){const i=this._floatingGroups.find((t=>t.group===e));if(i){if((null==t?void 0:t.skipDispose)||(i.group.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e)),I(this._floatingGroups,i),i.dispose(),!(null==t?void 0:t.skipActive)&&this._activeGroup===e){const e=Array.from(this._groups.values());this.doSetGroupAndPanelActive(e.length>0?e[0].value:void 0)}return i.group}throw new Error("dockview: failed to find floating group")}if("popout"===e.api.location.type){const i=this._popoutGroups.find((t=>t.popoutGroup===e));if(i){if(!(null==t?void 0:t.skipDispose)){if(!(null==t?void 0:t.skipPopoutAssociated)){const e=i.referenceGroup?this.getPanel(i.referenceGroup):void 0;e&&0===e.panels.length&&this.removeGroup(e)}i.popoutGroup.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e)}I(this._popoutGroups,i);const n=i.disposable.dispose();if(!(null==t?void 0:t.skipPopoutReturn)&&n&&(this.doAddGroup(n,[0]),this.doSetGroupAndPanelActive(n)),!(null==t?void 0:t.skipActive)&&this._activeGroup===e){const e=Array.from(this._groups.values());this.doSetGroupAndPanelActive(e.length>0?e[0].value:void 0)}return this.updateWatermark(),i.popoutGroup}throw new Error("dockview: failed to find popout group")}const s=super.doRemoveGroup(e,t);return(null==t?void 0:t.skipActive)||this.activePanel!==o&&this._onDidActivePanelChange.fire(this.activePanel),s}debouncedUpdateAllPositions(){void 0!==this._updatePositionsFrameId&&cancelAnimationFrame(this._updatePositionsFrameId),this._updatePositionsFrameId=requestAnimationFrame((()=>{this._updatePositionsFrameId=void 0,this.overlayRenderContainer.updateAllPositions()}))}movingLock(e){const t=this._moving;try{return this._moving=!0,e()}finally{this._moving=t}}moveGroupOrPanel(e){var t;const i=e.to.group,n=e.from.groupId,o=e.from.panelId,s=e.to.position,r=e.to.index,a=n?null===(t=this._groups.get(n))||void 0===t?void 0:t.value:void 0;if(!a)throw new Error(`dockview: Failed to find group id ${n}`);if(void 0!==o)if(s&&"center"!==s){const e=K(i.element),t=q(this.gridview.orientation,e,s);if(a.size<2){const[e,n]=P(t);if("grid"===a.api.location.type){const t=K(a.element),[i,s]=P(t);if(E(i,e))return this.gridview.moveView(i,s,n),void this._onDidMovePanel.fire({panel:this.getGroupPanel(o),from:a})}if("popout"===a.api.location.type){const e=this._popoutGroups.find((e=>e.popoutGroup===a)),i=this.movingLock((()=>e.popoutGroup.model.removePanel(e.popoutGroup.panels[0],{skipSetActive:!0,skipSetActiveGroup:!0})));this.doRemoveGroup(a,{skipActive:!0});const n=this.createGroupAtLocation(t);return this.movingLock((()=>n.model.openPanel(i,{skipSetActive:!0}))),this.doSetGroupAndPanelActive(n),void this._onDidMovePanel.fire({panel:this.getGroupPanel(o),from:a})}const r=this.movingLock((()=>this.doRemoveGroup(a,{skipActive:!0,skipDispose:!0}))),d=K(i.element),h=q(this.gridview.orientation,d,s);this.movingLock((()=>this.doAddGroup(r,h))),this.doSetGroupAndPanelActive(r),this._onDidMovePanel.fire({panel:this.getGroupPanel(o),from:a})}else{const t=this.movingLock((()=>a.model.removePanel(o,{skipSetActive:!1,skipSetActiveGroup:!0})));if(!t)throw new Error(`dockview: No panel with id ${o}`);const i=q(this.gridview.orientation,e,s),n=this.createGroupAtLocation(i);this.movingLock((()=>n.model.openPanel(t,{skipSetGroupActive:!0}))),this.doSetGroupAndPanelActive(n),this._onDidMovePanel.fire({panel:t,from:a})}}else{const t=this.movingLock((()=>a.model.removePanel(o,{skipSetActive:!1,skipSetActiveGroup:!0})));if(!t)throw new Error(`dockview: No panel with id ${o}`);e.keepEmptyGroups||0!==a.model.size||this.doRemoveGroup(a,{skipActive:!0});const n=0===i.model.size;this.movingLock((()=>{var o;return i.model.openPanel(t,{index:r,skipSetActive:null!==(o=e.skipSetActive)&&void 0!==o&&o&&!n,skipSetGroupActive:!0})})),e.skipSetActive||this.doSetGroupAndPanelActive(i),this._onDidMovePanel.fire({panel:t,from:a})}else this.moveGroup({from:{group:a},to:{group:i,position:s},skipSetActive:e.skipSetActive})}moveGroup(e){const t=e.from.group,i=e.to.group,n=e.to.position;if("center"===n){const n=t.activePanel,o=this.movingLock((()=>[...t.panels].map((e=>t.model.removePanel(e.id,{skipSetActive:!0})))));0===(null==t?void 0:t.model.size)&&this.doRemoveGroup(t,{skipActive:!0}),this.movingLock((()=>{for(const e of o)i.model.openPanel(e,{skipSetActive:e!==n,skipSetGroupActive:!0})})),!0!==e.skipSetActive?this.doSetGroupAndPanelActive(i):this.activePanel||this.doSetGroupAndPanelActive(i)}else{switch(t.api.location.type){case"grid":this.gridview.removeView(K(t.element));break;case"floating":{const e=this._floatingGroups.find((e=>e.group===t));if(!e)throw new Error("dockview: failed to find floating group");e.dispose();break}case"popout":{const e=this._popoutGroups.find((e=>e.popoutGroup===t));if(!e)throw new Error("dockview: failed to find popout group");const n=this._popoutGroups.indexOf(e);if(n>=0&&this._popoutGroups.splice(n,1),e.referenceGroup){const t=this.getPanel(e.referenceGroup);t&&!t.api.isVisible&&this.doRemoveGroup(t,{skipActive:!0})}e.window.dispose(),"grid"===i.api.location.type?(t.model.renderContainer=this.overlayRenderContainer,t.model.dropTargetContainer=this.rootDropTargetContainer,t.model.location={type:"grid"}):"floating"===i.api.location.type&&(t.model.renderContainer=this.overlayRenderContainer,t.model.dropTargetContainer=this.rootDropTargetContainer,t.model.location={type:"floating"});break}}if("grid"===i.api.location.type){const e=K(i.element),o=q(this.gridview.orientation,e,n);let s;switch(this.gridview.orientation){case exports.Orientation.VERTICAL:s=e.length%2==0?t.api.width:t.api.height;break;case exports.Orientation.HORIZONTAL:s=e.length%2==0?t.api.height:t.api.width}this.gridview.addView(t,s,o)}else if("floating"===i.api.location.type){const e=this._floatingGroups.find((e=>e.group===i));if(e){const i=e.overlay.toJSON();let n,o;n="left"in i?i.left+50:"right"in i?Math.max(0,i.right-i.width-50):50,o="top"in i?i.top+50:"bottom"in i?Math.max(0,i.bottom-i.height-50):50,this.addFloatingGroup(t,{height:i.height,width:i.width,position:{left:n,top:o}})}}}if(t.panels.forEach((e=>{this._onDidMovePanel.fire({panel:e,from:t})})),this.debouncedUpdateAllPositions(),!1===e.skipSetActive){const e=null!=i?i:t;this.doSetGroupAndPanelActive(e)}}doSetGroupActive(e){super.doSetGroupActive(e);const t=this.activePanel;this._moving||t===this._onDidActivePanelChange.value||this._onDidActivePanelChange.fire(t)}doSetGroupAndPanelActive(e){super.doSetGroupActive(e);const t=this.activePanel;e&&this.hasMaximizedGroup()&&!this.isMaximizedGroup(e)&&this.exitMaximizedGroup(),this._moving||t===this._onDidActivePanelChange.value||this._onDidActivePanelChange.fire(t)}getNextGroupId(){let e=this.nextGroupId.next();for(;this._groups.has(e);)e=this.nextGroupId.next();return e}createGroup(e){e||(e={});let t=null==e?void 0:e.id;if(t&&this._groups.has(e.id)&&(console.warn(`dockview: Duplicate group id ${null==e?void 0:e.id}. reassigning group id to avoid errors`),t=void 0),!t)for(t=this.nextGroupId.next();this._groups.has(t);)t=this.nextGroupId.next();const i=new it(this,t,e);if(i.init({params:{},accessor:this}),!this._groups.has(i.id)){const e=new u(i.model.onTabDragStart((e=>{this._onWillDragPanel.fire(e)})),i.model.onGroupDragStart((e=>{this._onWillDragGroup.fire(e)})),i.model.onMove((e=>{const{groupId:t,itemId:n,target:o,index:s}=e;this.moveGroupOrPanel({from:{groupId:t,panelId:n},to:{group:i,position:o,index:s}})})),i.model.onDidDrop((e=>{this._onDidDrop.fire(e)})),i.model.onWillDrop((e=>{this._onWillDrop.fire(e)})),i.model.onWillShowOverlay((e=>{this.options.disableDnd?e.preventDefault():this._onWillShowOverlay.fire(e)})),i.model.onUnhandledDragOverEvent((e=>{this._onUnhandledDragOverEvent.fire(e)})),i.model.onDidAddPanel((e=>{this._moving||this._onDidAddPanel.fire(e.panel)})),i.model.onDidRemovePanel((e=>{this._moving||this._onDidRemovePanel.fire(e.panel)})),i.model.onDidActivePanelChange((e=>{this._moving||e.panel===this.activePanel&&this._onDidActivePanelChange.value!==e.panel&&this._onDidActivePanelChange.fire(e.panel)})),exports.DockviewEvent.any(i.model.onDidPanelTitleChange,i.model.onDidPanelParametersChange)((()=>{this._bufferOnDidLayoutChange.fire()})));this._groups.set(i.id,{value:i,disposable:e})}return i.initialize(),i}createPanel(e,t){var i,n,o;const s=e.component,r=null!==(i=e.tabComponent)&&void 0!==i?i:this.options.defaultTabComponent,a=new at(this,e.id,s,r),d=new st(e.id,s,r,this,this._api,t,a,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return d.init({title:null!==(n=e.title)&&void 0!==n?n:e.id,params:null!==(o=null==e?void 0:e.params)&&void 0!==o?o:{}}),d}createGroupAtLocation(e,t,i){const n=this.createGroup(i);return this.doAddGroup(n,e,t),n}findGroup(e){var t;return null===(t=Array.from(this._groups.values()).find((t=>t.value.model.containsPanel(e))))||void 0===t?void 0:t.value}orientationAtLocation(e){const t=this.gridview.orientation;return e.length%2==1?t:te(t)}updateDropTargetModel(e){"dndEdges"in e&&(this._rootDropTarget.disabled="boolean"==typeof e.dndEdges&&!1===e.dndEdges,"object"==typeof e.dndEdges&&null!==e.dndEdges?this._rootDropTarget.setOverlayModel(e.dndEdges):this._rootDropTarget.setOverlayModel(zt)),"rootOverlayModel"in e&&this.updateDropTargetModel({dndEdges:e.dndEdges})}updateTheme(){var e,t;const i=null!==(e=this._options.theme)&&void 0!==e?e:nt;if(this._themeClassnames.setClassNames(i.className),this.gridview.margin=null!==(t=i.gap)&&void 0!==t?t:0,"absolute"===i.dndOverlayMounting)this.rootDropTargetContainer.disabled=!1;else this.rootDropTargetContainer.disabled=!0}}class kt extends he{get orientation(){return this.gridview.orientation}set orientation(e){this.gridview.orientation=e}get options(){return this._options}get deserializer(){return this._deserializer}set deserializer(e){this._deserializer=e}constructor(e,t){var i;super(e,{proportionalLayout:null===(i=t.proportionalLayout)||void 0===i||i,orientation:t.orientation,styles:t.hideBorders?{separatorBorder:"transparent"}:void 0,disableAutoResizing:t.disableAutoResizing,className:t.className}),this._onDidLayoutfromJSON=new p,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidRemoveGroup=new p,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new p,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidActiveGroupChange=new p,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._options=t,this.addDisposables(this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this.onDidAdd((e=>{this._onDidAddGroup.fire(e)})),this.onDidRemove((e=>{this._onDidRemoveGroup.fire(e)})),this.onDidActiveChange((e=>{this._onDidActiveGroupChange.fire(e)})))}updateOptions(e){super.updateOptions(e);const t="string"==typeof e.orientation&&this.gridview.orientation!==e.orientation;this._options=Object.assign(Object.assign({},this.options),e),t&&(this.gridview.orientation=e.orientation),this.layout(this.gridview.width,this.gridview.height,!0)}removePanel(e){this.removeGroup(e)}toJSON(){var e;return{grid:this.gridview.serialize(),activePanel:null===(e=this.activeGroup)||void 0===e?void 0:e.id}}setVisible(e,t){this.gridview.setViewVisible(K(e.element),t)}setActive(e){this._groups.forEach(((t,i)=>{t.value.setActive(e===t.value)}))}focus(){var e;null===(e=this.activeGroup)||void 0===e||e.focus()}fromJSON(e){this.clear();const{grid:t,activePanel:i}=e;try{const e=[],n=this.width,o=this.height;if(this.gridview.deserialize(t,{fromJSON:t=>{const{data:i}=t,n=this.options.createComponent({id:i.id,name:i.component});return e.push((()=>n.init({params:i.params,minimumWidth:i.minimumWidth,maximumWidth:i.maximumWidth,minimumHeight:i.minimumHeight,maximumHeight:i.maximumHeight,priority:i.priority,snap:!!i.snap,accessor:this,isVisible:t.visible}))),this._onDidAddGroup.fire(n),this.registerPanel(n),n}}),this.layout(n,o,!0),e.forEach((e=>e())),"string"==typeof i){const e=this.getPanel(i);e&&this.doSetGroupActive(e)}}catch(e){for(const e of this.groups)e.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e);throw this.clear(),e}this._onDidLayoutfromJSON.fire()}clear(){const e=this.activeGroup,t=Array.from(this._groups.values());for(const e of t)e.disposable.dispose(),this.doRemoveGroup(e.value,{skipActive:!0});e&&this.doSetGroupActive(void 0),this.gridview.clear()}movePanel(e,t){var i;let n;const o=this.gridview.remove(e),s=null===(i=this._groups.get(t.reference))||void 0===i?void 0:i.value;if(!s)throw new Error(`reference group ${t.reference} does not exist`);const r=de(t.direction);if("center"===r)throw new Error(`${r} not supported as an option`);{const e=K(s.element);n=q(this.gridview.orientation,e,r)}this.doAddGroup(o,n,t.size)}addPanel(e){var t,i,n,o;let s=null!==(t=e.location)&&void 0!==t?t:[0];if(null===(i=e.position)||void 0===i?void 0:i.referencePanel){const t=null===(n=this._groups.get(e.position.referencePanel))||void 0===n?void 0:n.value;if(!t)throw new Error(`reference group ${e.position.referencePanel} does not exist`);const i=de(e.position.direction);if("center"===i)throw new Error(`${i} not supported as an option`);{const e=K(t.element);s=q(this.gridview.orientation,e,i)}}const r=this.options.createComponent({id:e.id,name:e.component});return r.init({params:null!==(o=e.params)&&void 0!==o?o:{},minimumWidth:e.minimumWidth,maximumWidth:e.maximumWidth,minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight,priority:e.priority,snap:!!e.snap,accessor:this,isVisible:!0}),this.doAddGroup(r,s,e.size),this.registerPanel(r),this.doSetGroupActive(r),r}registerPanel(e){const t=new u(e.api.onDidFocusChange((t=>{t.isFocused&&this._groups.forEach((t=>{const i=t.value;i!==e?i.setActive(!1):i.setActive(!0)}))})));this._groups.set(e.id,{value:e,disposable:t})}moveGroup(e,t,i){const n=this.getPanel(t);if(!n)throw new Error("invalid operation");const o=K(e.element),s=q(this.gridview.orientation,o,i),[r,a]=P(s),d=K(n.element),[h,l]=P(d);if(E(h,r))return void this.gridview.moveView(h,l,a);const p=this.doRemoveGroup(n,{skipActive:!0,skipDispose:!0}),c=K(e.element),v=q(this.gridview.orientation,c,i);this.doAddGroup(p,v)}removeGroup(e){super.removeGroup(e)}dispose(){super.dispose(),this._onDidLayoutfromJSON.dispose()}}class Pt extends re{get panels(){return this.splitview.getViews()}get options(){return this._options}get length(){return this._panels.size}get orientation(){return this.splitview.orientation}get splitview(){return this._splitview}set splitview(e){this._splitview&&this._splitview.dispose(),this._splitview=e,this._splitviewChangeDisposable.value=new u(this._splitview.onDidSashEnd((()=>{this._onDidLayoutChange.fire(void 0)})),this._splitview.onDidAddView((e=>this._onDidAddView.fire(e))),this._splitview.onDidRemoveView((e=>this._onDidRemoveView.fire(e))))}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get height(){return this.splitview.orientation===exports.Orientation.HORIZONTAL?this.splitview.orthogonalSize:this.splitview.size}get width(){return this.splitview.orientation===exports.Orientation.HORIZONTAL?this.splitview.size:this.splitview.orthogonalSize}constructor(e,t){var i;super(document.createElement("div"),t.disableAutoResizing),this._splitviewChangeDisposable=new m,this._panels=new Map,this._onDidLayoutfromJSON=new p,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidAddView=new p,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new p,this.onDidRemoveView=this._onDidRemoveView.event,this._onDidLayoutChange=new p,this.onDidLayoutChange=this._onDidLayoutChange.event,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new k(this.element),this._classNames.setClassNames(null!==(i=t.className)&&void 0!==i?i:""),e.appendChild(this.element),this._options=t,this.splitview=new F(this.element,t),this.addDisposables(this._onDidAddView,this._onDidLayoutfromJSON,this._onDidRemoveView,this._onDidLayoutChange)}updateOptions(e){var t,i;"className"in e&&this._classNames.setClassNames(null!==(t=e.className)&&void 0!==t?t:""),"disableResizing"in e&&(this.disableResizing=null!==(i=e.disableAutoResizing)&&void 0!==i&&i),"string"==typeof e.orientation&&(this.splitview.orientation=e.orientation),this._options=Object.assign(Object.assign({},this.options),e),this.splitview.layout(this.splitview.size,this.splitview.orthogonalSize)}focus(){var e;null===(e=this._activePanel)||void 0===e||e.focus()}movePanel(e,t){this.splitview.moveView(e,t)}setVisible(e,t){const i=this.panels.indexOf(e);this.splitview.setViewVisible(i,t)}setActive(e,t){this._activePanel=e,this.panels.filter((t=>t!==e)).forEach((e=>{e.api._onDidActiveChange.fire({isActive:!1}),t||e.focus()})),e.api._onDidActiveChange.fire({isActive:!0}),t||e.focus()}removePanel(e,t){const i=this._panels.get(e.id);if(!i)throw new Error(`unknown splitview panel ${e.id}`);i.dispose(),this._panels.delete(e.id);const n=this.panels.findIndex((t=>t===e));this.splitview.removeView(n,t).dispose();const o=this.panels;o.length>0&&this.setActive(o[o.length-1])}getPanel(e){return this.panels.find((t=>t.id===e))}addPanel(e){var t;if(this._panels.has(e.id))throw new Error(`panel ${e.id} already exists`);const i=this.options.createComponent({id:e.id,name:e.component});i.orientation=this.splitview.orientation,i.init({params:null!==(t=e.params)&&void 0!==t?t:{},minimumSize:e.minimumSize,maximumSize:e.maximumSize,snap:e.snap,priority:e.priority,accessor:this});const n="number"==typeof e.size?e.size:exports.Sizing.Distribute,o="number"==typeof e.index?e.index:void 0;return this.splitview.addView(i,n,o),this.doAddView(i),this.setActive(i),i}layout(e,t){const[i,n]=this.splitview.orientation===exports.Orientation.HORIZONTAL?[e,t]:[t,e];this.splitview.layout(i,n)}doAddView(e){const t=e.api.onDidFocusChange((t=>{t.isFocused&&this.setActive(e,!0)}));this._panels.set(e.id,t)}toJSON(){var e;return{views:this.splitview.getViews().map(((e,t)=>({size:this.splitview.getViewSize(t),data:e.toJSON(),snap:!!e.snap,priority:e.priority}))),activeView:null===(e=this._activePanel)||void 0===e?void 0:e.id,size:this.splitview.size,orientation:this.splitview.orientation}}fromJSON(e){this.clear();const{views:t,orientation:i,size:n,activeView:o}=e,s=[],r=this.width,a=this.height;if(this.splitview=new F(this.element,{orientation:i,proportionalLayout:this.options.proportionalLayout,descriptor:{size:n,views:t.map((e=>{const t=e.data;if(this._panels.has(t.id))throw new Error(`panel ${t.id} already exists`);const n=this.options.createComponent({id:t.id,name:t.component});return s.push((()=>{var i;n.init({params:null!==(i=t.params)&&void 0!==i?i:{},minimumSize:t.minimumSize,maximumSize:t.maximumSize,snap:e.snap,priority:e.priority,accessor:this})})),n.orientation=i,this.doAddView(n),setTimeout((()=>{this._onDidAddView.fire(n)}),0),{size:e.size,view:n}}))}}),this.layout(r,a),s.forEach((e=>e())),"string"==typeof o){const e=this.getPanel(o);e&&this.setActive(e)}this._onDidLayoutfromJSON.fire()}clear(){for(const e of this._panels.values())e.dispose();for(this._panels.clear();this.splitview.length>0;){this.splitview.removeView(0,exports.Sizing.Distribute,!0).dispose()}}dispose(){for(const e of this._panels.values())e.dispose();this._panels.clear();const e=this.splitview.getViews();this._splitviewChangeDisposable.dispose(),this.splitview.dispose();for(const t of e)t.dispose();this.element.remove(),super.dispose()}}class Et extends u{get element(){return this._element}constructor(){super(),this._expandedIcon=We({width:"11",height:"11",viewbox:"0 0 24 15",path:"M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z"}),this._collapsedIcon=He(),this.disposable=new m,this.apiRef={api:null},this._element=document.createElement("div"),this.element.className="dv-default-header",this._content=document.createElement("span"),this._expander=document.createElement("div"),this._expander.className="dv-pane-header-icon",this.element.appendChild(this._expander),this.element.appendChild(this._content),this.addDisposables(c(this._element,"click",(()=>{var e;null===(e=this.apiRef.api)||void 0===e||e.setExpanded(!this.apiRef.api.isExpanded)})))}init(e){this.apiRef.api=e.api,this._content.textContent=e.title,this.updateIcon(),this.disposable.value=e.api.onDidExpansionChange((()=>{this.updateIcon()}))}updateIcon(){var e;const t=!!(null===(e=this.apiRef.api)||void 0===e?void 0:e.isExpanded);_(this._expander,"collapsed",!t),t?(this._expander.contains(this._collapsedIcon)&&this._collapsedIcon.remove(),this._expander.contains(this._expandedIcon)||this._expander.appendChild(this._expandedIcon)):(this._expander.contains(this._expandedIcon)&&this._expandedIcon.remove(),this._expander.contains(this._collapsedIcon)||this._expander.appendChild(this._collapsedIcon))}update(e){}dispose(){this.disposable.dispose(),super.dispose()}}const Ot=N(),Gt=Number.MAX_SAFE_INTEGER;class It extends Ee{constructor(e){super({accessor:e.accessor,id:e.id,component:e.component,headerComponent:e.headerComponent,orientation:e.orientation,isExpanded:e.isExpanded,disableDnd:e.disableDnd,headerSize:e.headerSize,minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize}),this.options=e}getBodyComponent(){return this.options.body}getHeaderComponent(){return this.options.header}}class Vt extends re{get id(){return this._id}get panels(){return this.paneview.getPanes()}set paneview(e){this._paneview=e,this._disposable.value=new u(this._paneview.onDidChange((()=>{this._onDidLayoutChange.fire(void 0)})),this._paneview.onDidAddView((e=>this._onDidAddView.fire(e))),this._paneview.onDidRemoveView((e=>this._onDidRemoveView.fire(e))))}get paneview(){return this._paneview}get minimumSize(){return this.paneview.minimumSize}get maximumSize(){return this.paneview.maximumSize}get height(){return this.paneview.orientation===exports.Orientation.HORIZONTAL?this.paneview.orthogonalSize:this.paneview.size}get width(){return this.paneview.orientation===exports.Orientation.HORIZONTAL?this.paneview.size:this.paneview.orthogonalSize}get options(){return this._options}constructor(e,t){var i;super(document.createElement("div"),t.disableAutoResizing),this._id=Ot.next(),this._disposable=new m,this._viewDisposables=new Map,this._onDidLayoutfromJSON=new p,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidLayoutChange=new p,this.onDidLayoutChange=this._onDidLayoutChange.event,this._onDidDrop=new p,this.onDidDrop=this._onDidDrop.event,this._onDidAddView=new p,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new p,this.onDidRemoveView=this._onDidRemoveView.event,this._onUnhandledDragOverEvent=new p,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this.element.style.height="100%",this.element.style.width="100%",this.addDisposables(this._onDidLayoutChange,this._onDidLayoutfromJSON,this._onDidDrop,this._onDidAddView,this._onDidRemoveView,this._onUnhandledDragOverEvent),this._classNames=new k(this.element),this._classNames.setClassNames(null!==(i=t.className)&&void 0!==i?i:""),e.appendChild(this.element),this._options=t,this.paneview=new U(this.element,{orientation:exports.Orientation.VERTICAL}),this.addDisposables(this._disposable)}setVisible(e,t){const i=this.panels.indexOf(e);this.paneview.setViewVisible(i,t)}focus(){}updateOptions(e){var t,i;"className"in e&&this._classNames.setClassNames(null!==(t=e.className)&&void 0!==t?t:""),"disableResizing"in e&&(this.disableResizing=null!==(i=e.disableAutoResizing)&&void 0!==i&&i),this._options=Object.assign(Object.assign({},this.options),e)}addPanel(e){var t,i;const n=this.options.createComponent({id:e.id,name:e.component});let o;e.headerComponent&&this.options.createHeaderComponent&&(o=this.options.createHeaderComponent({id:e.id,name:e.headerComponent})),o||(o=new Et);const s=new It({id:e.id,component:e.component,headerComponent:e.headerComponent,header:o,body:n,orientation:exports.Orientation.VERTICAL,isExpanded:!!e.isExpanded,disableDnd:!!this.options.disableDnd,accessor:this,headerSize:null!==(t=e.headerSize)&&void 0!==t?t:22,minimumBodySize:0,maximumBodySize:Gt});this.doAddPanel(s);const r="number"==typeof e.size?e.size:exports.Sizing.Distribute,a="number"==typeof e.index?e.index:void 0;return s.init({params:null!==(i=e.params)&&void 0!==i?i:{},minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize,isExpanded:e.isExpanded,title:e.title,containerApi:new pe(this),accessor:this}),this.paneview.addPane(s,r,a),s.orientation=this.paneview.orientation,s}removePanel(e){const t=this.panels.findIndex((t=>t===e));this.paneview.removePane(t),this.doRemovePanel(e)}movePanel(e,t){this.paneview.moveView(e,t)}getPanel(e){return this.panels.find((t=>t.id===e))}layout(e,t){const[i,n]=this.paneview.orientation===exports.Orientation.HORIZONTAL?[e,t]:[t,e];this.paneview.layout(i,n)}toJSON(){const e=e=>e===Number.MAX_SAFE_INTEGER||e===Number.POSITIVE_INFINITY?void 0:e;return{views:this.paneview.getPanes().map(((t,i)=>{return{size:this.paneview.getViewSize(i),data:t.toJSON(),minimumSize:(n=t.minimumBodySize,n<=0?void 0:n),maximumSize:e(t.maximumBodySize),headerSize:t.headerSize,expanded:t.isExpanded()};var n})),size:this.paneview.size}}fromJSON(e){this.clear();const{views:t,size:i}=e,n=[],o=this.width,s=this.height;this.paneview=new U(this.element,{orientation:exports.Orientation.VERTICAL,descriptor:{size:i,views:t.map((e=>{var t,i,o;const s=e.data,r=this.options.createComponent({id:s.id,name:s.component});let a;s.headerComponent&&this.options.createHeaderComponent&&(a=this.options.createHeaderComponent({id:s.id,name:s.headerComponent})),a||(a=new Et);const d=new It({id:s.id,component:s.component,headerComponent:s.headerComponent,header:a,body:r,orientation:exports.Orientation.VERTICAL,isExpanded:!!e.expanded,disableDnd:!!this.options.disableDnd,accessor:this,headerSize:null!==(t=e.headerSize)&&void 0!==t?t:22,minimumBodySize:null!==(i=e.minimumSize)&&void 0!==i?i:0,maximumBodySize:null!==(o=e.maximumSize)&&void 0!==o?o:Gt});return this.doAddPanel(d),n.push((()=>{var t;d.init({params:null!==(t=s.params)&&void 0!==t?t:{},minimumBodySize:e.minimumSize,maximumBodySize:e.maximumSize,title:s.title,isExpanded:!!e.expanded,containerApi:new pe(this),accessor:this}),d.orientation=this.paneview.orientation})),setTimeout((()=>{this._onDidAddView.fire(d)}),0),{size:e.size,view:d}}))}}),this.layout(o,s),n.forEach((e=>e())),this._onDidLayoutfromJSON.fire()}clear(){for(const[e,t]of this._viewDisposables.entries())t.dispose();this._viewDisposables.clear(),this.paneview.dispose()}doAddPanel(e){const t=new u(e.onDidDrop((e=>{this._onDidDrop.fire(e)})),e.onUnhandledDragOverEvent((e=>{this._onUnhandledDragOverEvent.fire(e)})));this._viewDisposables.set(e.id,t)}doRemovePanel(e){const t=this._viewDisposables.get(e.id);t&&(t.dispose(),this._viewDisposables.delete(e.id))}dispose(){super.dispose();for(const[e,t]of this._viewDisposables.entries())t.dispose();this._viewDisposables.clear(),this.element.remove(),this.paneview.dispose()}}exports.BaseGrid=he,exports.ContentContainer=Oe,exports.DefaultDockviewDeserialzier=dt,exports.DefaultTab=rt,exports.DockviewApi=ve,exports.DockviewComponent=At,exports.DockviewCompositeDisposable=u,exports.DockviewDidDropEvent=Ye,exports.DockviewEmitter=p,exports.DockviewGroupPanel=it,exports.DockviewGroupPanelModel=Ke,exports.DockviewMutableDisposable=m,exports.DockviewPanel=st,exports.DockviewUnhandledDragOverEvent=Be,exports.DockviewWillDropEvent=Xe,exports.DockviewWillShowOverlayLocationEvent=Ne,exports.DraggablePaneviewPanel=Ee,exports.Gridview=oe,exports.GridviewApi=ce,exports.GridviewComponent=kt,exports.GridviewPanel=Qe,exports.PROPERTY_KEYS_DOCKVIEW=Ue,exports.PROPERTY_KEYS_GRIDVIEW=se,exports.PROPERTY_KEYS_PANEVIEW=De,exports.PROPERTY_KEYS_SPLITVIEW=B,exports.PaneFramework=It,exports.PaneTransfer=n,exports.PanelTransfer=i,exports.Paneview=U,exports.PaneviewApi=pe,exports.PaneviewComponent=Vt,exports.PaneviewPanel=Pe,exports.PaneviewUnhandledDragOverEvent=ye,exports.Splitview=F,exports.SplitviewApi=le,exports.SplitviewComponent=Pt,exports.SplitviewPanel=class extends ke{get priority(){return this._priority}set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){const e="function"==typeof this._minimumSize?this._minimumSize():this._minimumSize;return e!==this._evaluatedMinimumSize&&(this._evaluatedMinimumSize=e,this.updateConstraints()),e}get maximumSize(){const e="function"==typeof this._maximumSize?this._maximumSize():this._maximumSize;return e!==this._evaluatedMaximumSize&&(this._evaluatedMaximumSize=e,this.updateConstraints()),e}get snap(){return this._snap}constructor(e,t){super(e,t,new Se(e,t)),this._evaluatedMinimumSize=0,this._evaluatedMaximumSize=Number.POSITIVE_INFINITY,this._minimumSize=0,this._maximumSize=Number.POSITIVE_INFINITY,this._snap=!1,this._onDidChange=new p,this.onDidChange=this._onDidChange.event,this.api.initialize(this),this.addDisposables(this._onDidChange,this.api.onWillVisibilityChange((e=>{const{isVisible:t}=e,{accessor:i}=this._params;i.setVisible(this,t)})),this.api.onActiveChange((()=>{const{accessor:e}=this._params;e.setActive(this)})),this.api.onDidConstraintsChangeInternal((e=>{"number"!=typeof e.minimumSize&&"function"!=typeof e.minimumSize||(this._minimumSize=e.minimumSize),"number"!=typeof e.maximumSize&&"function"!=typeof e.maximumSize||(this._maximumSize=e.maximumSize),this.updateConstraints()})),this.api.onDidSizeChange((e=>{this._onDidChange.fire({size:e.size})})))}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}layout(e,t){const[i,n]=this.orientation===exports.Orientation.HORIZONTAL?[e,t]:[t,e];super.layout(i,n)}init(e){super.init(e),this._priority=e.priority,e.minimumSize&&(this._minimumSize=e.minimumSize),e.maximumSize&&(this._maximumSize=e.maximumSize),e.snap&&(this._snap=e.snap)}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{minimumSize:(e=this.minimumSize,e<=0?void 0:e),maximumSize:(e=>e===Number.MAX_SAFE_INTEGER||e===Number.POSITIVE_INFINITY?void 0:e)(this.maximumSize)});var e}updateConstraints(){this.api._onDidConstraintsChange.fire({maximumSize:this._evaluatedMaximumSize,minimumSize:this._evaluatedMinimumSize})}},exports.Tab=Ve,exports.createDockview=function(e,t){return new At(e,t).api},exports.createGridview=function(e,t){const i=new kt(e,t);return new ce(i)},exports.createPaneview=function(e,t){const i=new Vt(e,t);return new pe(i)},exports.createSplitview=function(e,t){const i=new Pt(e,t);return new le(i)},exports.directionToPosition=be,exports.getDirectionOrientation=Q,exports.getGridLocation=K,exports.getLocationOrientation=ee,exports.getPaneData=r,exports.getPanelData=s,exports.getRelativeLocation=q,exports.indexInParent=X,exports.isGridBranchNode=ie,exports.isGroupOptionsWithGroup=Ze,exports.isGroupOptionsWithPanel=je,exports.isPanelOptionsWithGroup=Je,exports.isPanelOptionsWithPanel=$e,exports.orthogonal=te,exports.positionToDirection=we,exports.themeAbyss=nt,exports.themeAbyssSpaced={name:"abyssSpaced",className:"dockview-theme-abyss-spaced",gap:10,dndOverlayMounting:"absolute",dndPanelOverlay:"group"},exports.themeDark={name:"dark",className:"dockview-theme-dark"},exports.themeDracula={name:"dracula",className:"dockview-theme-dracula"},exports.themeLight={name:"light",className:"dockview-theme-light"},exports.themeLightSpaced={name:"lightSpaced",className:"dockview-theme-light-spaced",gap:10,dndOverlayMounting:"absolute",dndPanelOverlay:"group"},exports.themeReplit={name:"replit",className:"dockview-theme-replit",gap:10},exports.themeVisualStudio={name:"visualStudio",className:"dockview-theme-vs"},exports.toTarget=de;
|
|
7
|
+
"use strict";class e{}class t extends e{constructor(e,t,i,s){super(),this.viewId=e,this.groupId=t,this.panelId=i,this.tabGroupId=s}}class i extends e{constructor(e,t){super(),this.viewId=e,this.paneId=t}}class s{constructor(){}static getInstance(){return s.INSTANCE}hasData(e){return e&&e===this.proto}clearData(e){this.hasData(e)&&(this.proto=void 0,this.data=void 0)}getData(e){if(this.hasData(e))return this.data}setData(e,t){t&&(this.data=e,this.proto=t)}}function o(){const e=s.getInstance();if(e.hasData(t.prototype))return e.getData(t.prototype)[0]}function n(){const e=s.getInstance();if(e.hasData(i.prototype))return e.getData(i.prototype)[0]}s.INSTANCE=new s,exports.DockviewEvent=void 0,(exports.DockviewEvent||(exports.DockviewEvent={})).any=(...e)=>t=>{const i=e.map(e=>e(t));return{dispose:()=>{i.forEach(e=>{e.dispose()})}}};class r{constructor(){this._defaultPrevented=!1}get defaultPrevented(){return this._defaultPrevented}preventDefault(){this._defaultPrevented=!0}}class a{constructor(){this._isAccepted=!1}get isAccepted(){return this._isAccepted}accept(){this._isAccepted=!0}}class h{static create(){var e;return new h(null!==(e=(new Error).stack)&&void 0!==e?e:"")}constructor(e){this.value=e}print(){console.warn("dockview: stacktrace",this.value)}}class l{constructor(e,t){this.callback=e,this.stacktrace=t}}class d{static setLeakageMonitorEnabled(e){e!==d.ENABLE_TRACKING&&d.MEMORY_LEAK_WATCHER.clear(),d.ENABLE_TRACKING=e}get value(){return this._last}constructor(e){this.options=e,this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=e=>{var t;(null===(t=this.options)||void 0===t?void 0:t.replay)&&void 0!==this._last&&e(this._last);const i=new l(e,d.ENABLE_TRACKING?h.create():void 0);return this._listeners.push(i),{dispose:()=>{const e=this._listeners.indexOf(i);e>-1?this._listeners.splice(e,1):d.ENABLE_TRACKING}}},d.ENABLE_TRACKING&&d.MEMORY_LEAK_WATCHER.add(this._event,h.create())),this._event}fire(e){var t;(null===(t=this.options)||void 0===t?void 0:t.replay)&&(this._last=e);for(const t of this._listeners)t.callback(e)}dispose(){this._disposed||(this._disposed=!0,this._listeners.length>0&&(d.ENABLE_TRACKING&&queueMicrotask(()=>{var e;for(const t of this._listeners)console.warn("dockview: stacktrace",null===(e=t.stacktrace)||void 0===e?void 0:e.print())}),this._listeners=[]),d.ENABLE_TRACKING&&this._event&&d.MEMORY_LEAK_WATCHER.delete(this._event))}}function p(e,t,i,s){return e.addEventListener(t,i,s),{dispose:()=>{e.removeEventListener(t,i,s)}}}d.ENABLE_TRACKING=!1,d.MEMORY_LEAK_WATCHER=new class{constructor(){this.events=new Map}get size(){return this.events.size}add(e,t){this.events.set(e,t)}delete(e){this.events.delete(e)}clear(){this.events.clear()}};class u{constructor(){this._onFired=new d,this._currentFireCount=0,this._queued=!1,this.onEvent=e=>{const t=this._currentFireCount;return this._onFired.event(()=>{this._currentFireCount>t&&e()})}}fire(){this._currentFireCount++,this._queued||(this._queued=!0,queueMicrotask(()=>{this._queued=!1,this._onFired.fire()}))}dispose(){this._onFired.dispose()}}var c;exports.DockviewDisposable=void 0,(c=exports.DockviewDisposable||(exports.DockviewDisposable={})).NONE={dispose:()=>{}},c.from=function(e){return{dispose:()=>{e()}}};class m{get isDisposed(){return this._isDisposed}constructor(...e){this._isDisposed=!1,this._disposables=new Set(e)}addDisposables(...e){e.forEach(e=>this._disposables.add(e))}removeDisposable(e){this._disposables.delete(e)}dispose(){this._isDisposed||(this._isDisposed=!0,this._disposables.forEach(e=>e.dispose()),this._disposables.clear())}}class v{constructor(){this._disposable=exports.DockviewDisposable.NONE}set value(e){this._disposable&&this._disposable.dispose(),this._disposable=e}dispose(){this._disposable&&(this._disposable.dispose(),this._disposable=exports.DockviewDisposable.NONE)}}class g extends m{constructor(e){super(),this._onDidChange=new d,this.onDidChange=this._onDidChange.event,this._value=null,this.addDisposables(this._onDidChange,_(e,e=>{const t=e.target.scrollWidth>e.target.clientWidth,i=e.target.scrollHeight>e.target.clientHeight;this._value={hasScrollX:t,hasScrollY:i},this._onDidChange.fire(this._value)}))}}function _(e,t){const i=new ResizeObserver(e=>{requestAnimationFrame(()=>{const i=e[0];t(i)})});return i.observe(e),{dispose:()=>{i.unobserve(e),i.disconnect()}}}const f=(e,...t)=>{for(const i of t)e.classList.contains(i)&&e.classList.remove(i)},b=(e,...t)=>{for(const i of t)e.classList.contains(i)||e.classList.add(i)},w=(e,t,i)=>{const s=e.classList.contains(t);i&&!s&&e.classList.add(t),!i&&s&&e.classList.remove(t)};function D(e,t){for(;e;){if(e===t)return!0;e=e.parentNode}return!1}function C(e){return new x(e)}class x extends m{constructor(e){super(),this._onDidFocus=new d,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new d,this.onDidBlur=this._onDidBlur.event,this.addDisposables(this._onDidFocus,this._onDidBlur);let t=D(document.activeElement,e),i=!1;const s=()=>{i=!1,t||(t=!0,this._onDidFocus.fire())},o=()=>{t&&(i=!0,window.setTimeout(()=>{i&&(i=!1,t=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{D(document.activeElement,e)!==t&&(t?o():s())},this.addDisposables(p(e,"focus",s,!0)),this.addDisposables(p(e,"blur",o,!0))}refreshState(){this._refreshStateHandler()}}const y="dv-quasiPreventDefault";function S(e){return e[y]}function G(e){const{left:t,top:i,width:s,height:o}=e.getBoundingClientRect();return{left:t+window.scrollX,top:i+window.scrollY,width:s,height:o}}function z(e=document){const t=function(e){const t=[];return function i(s){if(s.nodeType===Node.ELEMENT_NODE){e.includes(s.tagName)&&t.push(s),s.shadowRoot&&i(s.shadowRoot);for(const e of s.children)i(e)}}(document.documentElement),t}(["IFRAME","WEBVIEW"]),i=new WeakMap;for(const e of t)i.set(e,e.style.pointerEvents),e.style.pointerEvents="none";return{release:()=>{var e;for(const s of t)s.style.pointerEvents=null!==(e=i.get(s))&&void 0!==e?e:"auto";t.splice(0,t.length)}}}class A{constructor(e){this.element=e,this._classNames=[]}setClassNames(e){for(const e of this._classNames)w(this.element,e,!1);this._classNames=e.split(" ").filter(e=>e.trim().length>0);for(const e of this._classNames)w(this.element,e,!0)}}function P(e,t){const i=G(e),s=G(t);return!(i.left<s.left)&&(!(i.left+i.width>s.left+s.width)&&(!(i.top<s.top)&&!(i.top+i.height>s.top+s.height)))}function I(e){let t=e;for(;t&&("auto"===t.style.zIndex||""===t.style.zIndex);)t=t.parentElement;return t}function T(e){if(0===e.length)throw new Error("Invalid tail call");return[e.slice(0,e.length-1),e[e.length-1]]}function E(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}function O(e,t){const i=e.indexOf(t);i>-1&&(e.splice(i,1),e.unshift(t))}function V(e,t){const i=e.indexOf(t);i>-1&&(e.splice(i,1),e.push(t))}function k(e,t){const i=e.findIndex(e=>e===t);return i>-1&&(e.splice(i,1),!0)}const M=(e,t,i)=>t>i?t:Math.min(i,Math.max(e,t)),L=()=>{let e=1;return{next:()=>(e++).toString()}},N=(e,t)=>{const i=[];if("number"!=typeof t&&(t=e,e=0),e<=t)for(let s=e;s<t;s++)i.push(s);else for(let s=e;s>t;s--)i.push(s);return i};class R{set size(e){this._size=e}get size(){return this._size}get cachedVisibleSize(){return this._cachedVisibleSize}get visible(){return void 0===this._cachedVisibleSize}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get snap(){return!!this.view.snap}set enabled(e){this.container.style.pointerEvents=e?"":"none"}constructor(e,t,i,s){this.container=e,this.view=t,this.disposable=s,this._cachedVisibleSize=void 0,"number"==typeof i?(this._size=i,this._cachedVisibleSize=void 0,e.classList.add("visible")):(this._size=0,this._cachedVisibleSize=i.cachedVisibleSize)}setVisible(e,t){var i;e!==this.visible&&(e?(this.size=M(null!==(i=this._cachedVisibleSize)&&void 0!==i?i:0,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize="number"==typeof t?t:this.size,this.size=0),this.container.classList.toggle("visible",e),this.view.setVisible&&this.view.setVisible(e))}dispose(){return this.disposable.dispose(),this.view}}var W,H,F,B;exports.Orientation=void 0,(W=exports.Orientation||(exports.Orientation={})).HORIZONTAL="HORIZONTAL",W.VERTICAL="VERTICAL",exports.SashState=void 0,(H=exports.SashState||(exports.SashState={}))[H.MAXIMUM=0]="MAXIMUM",H[H.MINIMUM=1]="MINIMUM",H[H.DISABLED=2]="DISABLED",H[H.ENABLED=3]="ENABLED",exports.LayoutPriority=void 0,(F=exports.LayoutPriority||(exports.LayoutPriority={})).Low="low",F.High="high",F.Normal="normal",exports.Sizing=void 0,(B=exports.Sizing||(exports.Sizing={})).Distribute={type:"distribute"},B.Split=function(e){return{type:"split",index:e}},B.Invisible=function(e){return{type:"invisible",cachedVisibleSize:e}};class ${get contentSize(){return this._contentSize}get size(){return this._size}set size(e){this._size=e}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get length(){return this.viewItems.length}get proportions(){return this._proportions?[...this._proportions]:void 0}get orientation(){return this._orientation}set orientation(e){this._orientation=e;const t=this.size;this.size=this.orthogonalSize,this.orthogonalSize=t,f(this.element,"dv-horizontal","dv-vertical"),this.element.classList.add(this.orientation==exports.Orientation.HORIZONTAL?"dv-horizontal":"dv-vertical")}get minimumSize(){return this.viewItems.reduce((e,t)=>e+t.minimumSize,0)}get maximumSize(){return 0===this.length?Number.POSITIVE_INFINITY:this.viewItems.reduce((e,t)=>e+t.maximumSize,0)}get startSnappingEnabled(){return this._startSnappingEnabled}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}get endSnappingEnabled(){return this._endSnappingEnabled}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}get disabled(){return this._disabled}set disabled(e){this._disabled=e,w(this.element,"dv-splitview-disabled",e)}get margin(){return this._margin}set margin(e){this._margin=e,w(this.element,"dv-splitview-has-margin",0!==e)}constructor(e,t){var i,s;this.container=e,this.viewItems=[],this.sashes=[],this._size=0,this._orthogonalSize=0,this._contentSize=0,this._proportions=void 0,this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this._disabled=!1,this._margin=0,this._onDidSashEnd=new d,this.onDidSashEnd=this._onDidSashEnd.event,this._onDidAddView=new d,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new d,this.onDidRemoveView=this._onDidRemoveView.event,this.resize=(e,t,i=this.viewItems.map(e=>e.size),s,o,n=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY,a,h)=>{if(e<0||e>this.viewItems.length)return 0;const l=N(e,-1),d=N(e+1,this.viewItems.length);if(o)for(const e of o)O(l,e),O(d,e);if(s)for(const e of s)V(l,e),V(d,e);const p=l.map(e=>this.viewItems[e]),u=l.map(e=>i[e]),c=d.map(e=>this.viewItems[e]),m=d.map(e=>i[e]),v=l.reduce((e,t)=>e+this.viewItems[t].minimumSize-i[t],0),g=l.reduce((e,t)=>e+this.viewItems[t].maximumSize-i[t],0),_=0===d.length?Number.POSITIVE_INFINITY:d.reduce((e,t)=>e+i[t]-this.viewItems[t].minimumSize,0),f=0===d.length?Number.NEGATIVE_INFINITY:d.reduce((e,t)=>e+i[t]-this.viewItems[t].maximumSize,0),b=Math.max(v,f),w=Math.min(_,g);let D=!1;if(a){const e=this.viewItems[a.index],i=t>=a.limitDelta;D=i!==e.visible,e.setVisible(i,a.size)}if(!D&&h){const e=this.viewItems[h.index],i=t<h.limitDelta;D=i!==e.visible,e.setVisible(i,h.size)}if(D)return this.resize(e,t,i,s,o,n,r);let C=0,x=M(t,b,w);for(let e=0;e<p.length;e++){const t=p[e],i=M(u[e]+x,t.minimumSize,t.maximumSize),s=i-u[e];C+=s,x-=s,t.size=i}let y=C;for(let e=0;e<c.length;e++){const t=c[e],i=M(m[e]-y,t.minimumSize,t.maximumSize);y+=i-m[e],t.size=i}return t},this._orientation=null!==(i=t.orientation)&&void 0!==i?i:exports.Orientation.VERTICAL,this.element=this.createContainer(),this.margin=null!==(s=t.margin)&&void 0!==s?s:0,this.proportionalLayout=void 0===t.proportionalLayout||!!t.proportionalLayout,this.viewContainer=this.createViewContainer(),this.sashContainer=this.createSashContainer(),this.element.appendChild(this.sashContainer),this.element.appendChild(this.viewContainer),this.container.appendChild(this.element),this.style(t.styles),t.descriptor&&(this._size=t.descriptor.size,t.descriptor.views.forEach((e,t)=>{const i=void 0===e.visible||e.visible?e.size:{type:"invisible",cachedVisibleSize:e.size},s=e.view;this.addView(s,i,t,!0)}),this._contentSize=this.viewItems.reduce((e,t)=>e+t.size,0),this.saveProportions())}style(e){"transparent"===(null==e?void 0:e.separatorBorder)?(f(this.element,"dv-separator-border"),this.element.style.removeProperty("--dv-separator-border")):(b(this.element,"dv-separator-border"),(null==e?void 0:e.separatorBorder)&&this.element.style.setProperty("--dv-separator-border",e.separatorBorder))}isViewVisible(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].visible}setViewVisible(e,t){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");const i=this.viewItems[e];i.setVisible(t,i.size),this.distributeEmptySpace(e),this.layoutViews(),this.saveProportions()}getViewSize(e){return e<0||e>=this.viewItems.length?-1:this.viewItems[e].size}resizeView(e,t){if(e<0||e>=this.viewItems.length)return;const i=N(this.viewItems.length).filter(t=>t!==e),s=[...i.filter(e=>this.viewItems[e].priority===exports.LayoutPriority.Low),e],o=i.filter(e=>this.viewItems[e].priority===exports.LayoutPriority.High),n=this.viewItems[e];t=Math.round(t),t=M(t,n.minimumSize,Math.min(n.maximumSize,this._size)),n.size=t,this.relayout(s,o)}getViews(){return this.viewItems.map(e=>e.view)}onDidChange(e,t){const i=this.viewItems.indexOf(e);if(i<0||i>=this.viewItems.length)return;t="number"==typeof t?t:e.size,t=M(t,e.minimumSize,e.maximumSize),e.size=t;const s=N(this.viewItems.length).filter(e=>e!==i),o=[...s.filter(e=>this.viewItems[e].priority===exports.LayoutPriority.Low),i],n=s.filter(e=>this.viewItems[e].priority===exports.LayoutPriority.High);this.relayout([...o,i],n)}addView(e,t={type:"distribute"},i=this.viewItems.length,s){const o=document.createElement("div");let n;o.className="dv-view",o.appendChild(e.element),n="number"==typeof t?t:"split"===t.type?this.getViewSize(t.index)/2:"invisible"===t.type?{cachedVisibleSize:t.cachedVisibleSize}:e.minimumSize;const r=e.onDidChange(e=>this.onDidChange(a,e.size)),a=new R(o,e,n,{dispose:()=>{r.dispose(),this.viewContainer.removeChild(o)}});if(i===this.viewItems.length?this.viewContainer.appendChild(o):this.viewContainer.insertBefore(o,this.viewContainer.children.item(i)),this.viewItems.splice(i,0,a),this.viewItems.length>1){const e=document.createElement("div");e.className="dv-sash";const t=t=>{for(const e of this.viewItems)e.enabled=!1;const i=z(),s=this._orientation===exports.Orientation.HORIZONTAL?t.clientX:t.clientY,o=function(e,t){for(let i=0;i<e.length;i++)if(t(e[i]))return i;return-1}(this.sashes,t=>t.container===e),n=this.viewItems.map(e=>e.size);let r,a;const h=N(o,-1),l=N(o+1,this.viewItems.length),d=h.reduce((e,t)=>e+(this.viewItems[t].minimumSize-n[t]),0),p=h.reduce((e,t)=>e+(this.viewItems[t].viewMaximumSize-n[t]),0),u=0===l.length?Number.POSITIVE_INFINITY:l.reduce((e,t)=>e+(n[t]-this.viewItems[t].minimumSize),0),c=0===l.length?Number.NEGATIVE_INFINITY:l.reduce((e,t)=>e+(n[t]-this.viewItems[t].viewMaximumSize),0),m=Math.max(d,c),v=Math.min(u,p),g=this.findFirstSnapIndex(h),_=this.findFirstSnapIndex(l);if("number"==typeof g){const e=this.viewItems[g],t=Math.floor(e.viewMinimumSize/2);r={index:g,limitDelta:e.visible?m-t:m+t,size:e.size}}if("number"==typeof _){const e=this.viewItems[_],t=Math.floor(e.viewMinimumSize/2);a={index:_,limitDelta:e.visible?v+t:v-t,size:e.size}}const f=e=>{const t=(this._orientation===exports.Orientation.HORIZONTAL?e.clientX:e.clientY)-s;this.resize(o,t,n,void 0,void 0,m,v,r,a),this.distributeEmptySpace(),this.layoutViews()},b=()=>{for(const e of this.viewItems)e.enabled=!0;i.release(),this.saveProportions(),document.removeEventListener("pointermove",f),document.removeEventListener("pointerup",b),document.removeEventListener("pointercancel",b),document.removeEventListener("contextmenu",b),this._onDidSashEnd.fire(void 0)};document.addEventListener("pointermove",f),document.addEventListener("pointerup",b),document.addEventListener("pointercancel",b),document.addEventListener("contextmenu",b)};e.addEventListener("pointerdown",t);const i={container:e,disposable:()=>{e.removeEventListener("pointerdown",t),this.sashContainer.removeChild(e)}};this.sashContainer.appendChild(e),this.sashes.push(i)}s||this.relayout([i]),s||"number"==typeof t||"distribute"!==t.type||this.distributeViewSizes(),this._onDidAddView.fire(e)}distributeViewSizes(){const e=[];let t=0;for(const i of this.viewItems)i.maximumSize-i.minimumSize>0&&(e.push(i),t+=i.size);const i=Math.floor(t/e.length);for(const t of e)t.size=M(i,t.minimumSize,t.maximumSize);const s=N(this.viewItems.length),o=s.filter(e=>this.viewItems[e].priority===exports.LayoutPriority.Low),n=s.filter(e=>this.viewItems[e].priority===exports.LayoutPriority.High);this.relayout(o,n)}removeView(e,t,i=!1){const s=this.viewItems.splice(e,1)[0];if(s.dispose(),this.viewItems.length>=1){const t=Math.max(e-1,0);this.sashes.splice(t,1)[0].disposable()}return i||this.relayout(),t&&"distribute"===t.type&&this.distributeViewSizes(),this._onDidRemoveView.fire(s.view),s.view}getViewCachedVisibleSize(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].cachedVisibleSize}moveView(e,t){const i=this.getViewCachedVisibleSize(e),s=void 0===i?this.getViewSize(e):exports.Sizing.Invisible(i),o=this.removeView(e,void 0,!0);this.addView(o,s,t)}layout(e,t){const i=Math.max(this.size,this._contentSize);if(this.size=e,this.orthogonalSize=t,this.proportions){let t=0;for(let i=0;i<this.viewItems.length;i++){const s=this.viewItems[i],o=this.proportions[i];"number"==typeof o?t+=o:e-=s.size}for(let i=0;i<this.viewItems.length;i++){const s=this.viewItems[i],o=this.proportions[i];"number"==typeof o&&t>0&&(s.size=M(Math.round(o*e/t),s.minimumSize,s.maximumSize))}}else{const t=N(this.viewItems.length),s=t.filter(e=>this.viewItems[e].priority===exports.LayoutPriority.Low),o=t.filter(e=>this.viewItems[e].priority===exports.LayoutPriority.High);this.resize(this.viewItems.length-1,e-i,void 0,s,o)}this.distributeEmptySpace(),this.layoutViews()}relayout(e,t){const i=this.viewItems.reduce((e,t)=>e+t.size,0);this.resize(this.viewItems.length-1,this._size-i,void 0,e,t),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}distributeEmptySpace(e){const t=this.viewItems.reduce((e,t)=>e+t.size,0);let i=this.size-t;const s=N(this.viewItems.length-1,-1),o=s.filter(e=>this.viewItems[e].priority===exports.LayoutPriority.Low),n=s.filter(e=>this.viewItems[e].priority===exports.LayoutPriority.High);for(const e of n)O(s,e);for(const e of o)V(s,e);"number"==typeof e&&V(s,e);for(let e=0;0!==i&&e<s.length;e++){const t=this.viewItems[s[e]],o=M(t.size+i,t.minimumSize,t.maximumSize);i-=o-t.size,t.size=o}}saveProportions(){this.proportionalLayout&&this._contentSize>0&&(this._proportions=this.viewItems.map(e=>e.visible?e.size/this._contentSize:void 0))}layoutViews(){if(this._contentSize=this.viewItems.reduce((e,t)=>e+t.size,0),this.updateSashEnablement(),0===this.viewItems.length)return;const e=this.viewItems.filter(e=>e.visible),t=Math.max(0,e.length-1),i=this.margin*t/Math.max(1,e.length);let s=0;const o=[],n=this.viewItems.reduce((e,t,i)=>{const s=t.visible?1:0;return 0===i?e.push(s):e.push(e[i-1]+s),e},[]);this.viewItems.forEach((e,r)=>{s+=this.viewItems[r].size,o.push(s);const a=e.visible?e.size-i:0,h=Math.max(0,n[r]-1),l=0===r||0===h?0:o[r-1]+h/t*i;if(r<this.viewItems.length-1){const t=e.visible?l+a-2+this.margin/2:l;this._orientation===exports.Orientation.HORIZONTAL&&(this.sashes[r].container.style.left=`${t}px`,this.sashes[r].container.style.top="0px"),this._orientation===exports.Orientation.VERTICAL&&(this.sashes[r].container.style.left="0px",this.sashes[r].container.style.top=`${t}px`)}this._orientation===exports.Orientation.HORIZONTAL&&(e.container.style.width=`${a}px`,e.container.style.left=`${l}px`,e.container.style.top="",e.container.style.height=""),this._orientation===exports.Orientation.VERTICAL&&(e.container.style.height=`${a}px`,e.container.style.top=`${l}px`,e.container.style.width="",e.container.style.left=""),e.view.layout(e.size-i,this._orthogonalSize)})}findFirstSnapIndex(e){for(const t of e){const e=this.viewItems[t];if(e.visible&&e.snap)return t}for(const t of e){const e=this.viewItems[t];if(e.visible&&e.maximumSize-e.minimumSize>0)return;if(!e.visible&&e.snap)return t}}updateSashEnablement(){let e=!1;const t=this.viewItems.map(t=>e=t.size-t.minimumSize>0||e);e=!1;const i=this.viewItems.map(t=>e=t.maximumSize-t.size>0||e),s=[...this.viewItems].reverse();e=!1;const o=s.map(t=>e=t.size-t.minimumSize>0||e).reverse();e=!1;const n=s.map(t=>e=t.maximumSize-t.size>0||e).reverse();let r=0;for(let e=0;e<this.sashes.length;e++){const s=this.sashes[e];r+=this.viewItems[e].size;const a=!(t[e]&&n[e+1]),h=!(i[e]&&o[e+1]);if(a&&h){const i=N(e,-1),n=N(e+1,this.viewItems.length),a=this.findFirstSnapIndex(i),h=this.findFirstSnapIndex(n),l="number"==typeof a&&!this.viewItems[a].visible,d="number"==typeof h&&!this.viewItems[h].visible;l&&o[e]&&(r>0||this.startSnappingEnabled)?this.updateSash(s,exports.SashState.MINIMUM):d&&t[e]&&(r<this._contentSize||this.endSnappingEnabled)?this.updateSash(s,exports.SashState.MAXIMUM):this.updateSash(s,exports.SashState.DISABLED)}else a&&!h?this.updateSash(s,exports.SashState.MINIMUM):!a&&h?this.updateSash(s,exports.SashState.MAXIMUM):this.updateSash(s,exports.SashState.ENABLED)}}updateSash(e,t){w(e.container,"dv-disabled",t===exports.SashState.DISABLED),w(e.container,"dv-enabled",t===exports.SashState.ENABLED),w(e.container,"dv-maximum",t===exports.SashState.MAXIMUM),w(e.container,"dv-minimum",t===exports.SashState.MINIMUM)}createViewContainer(){const e=document.createElement("div");return e.className="dv-view-container",e}createSashContainer(){const e=document.createElement("div");return e.className="dv-sash-container",e}createContainer(){const e=document.createElement("div"),t=this._orientation===exports.Orientation.HORIZONTAL?"dv-horizontal":"dv-vertical";return e.className=`dv-split-view-container ${t}`,e}dispose(){this._onDidSashEnd.dispose(),this._onDidAddView.dispose(),this._onDidRemoveView.dispose();for(let e=0;e<this.element.children.length;e++)if(this.element.children.item(e)===this.element){this.element.removeChild(this.element);break}for(const e of this.viewItems)e.dispose();this.element.remove()}}const U=(()=>{const e={orientation:void 0,descriptor:void 0,proportionalLayout:void 0,styles:void 0,margin:void 0,disableAutoResizing:void 0,className:void 0};return Object.keys(e)})();class J extends m{get onDidAddView(){return this.splitview.onDidAddView}get onDidRemoveView(){return this.splitview.onDidRemoveView}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get orientation(){return this.splitview.orientation}get size(){return this.splitview.size}get orthogonalSize(){return this.splitview.orthogonalSize}constructor(e,t){var i;super(),this.paneItems=[],this.skipAnimation=!1,this._onDidChange=new d,this.onDidChange=this._onDidChange.event,this._orientation=null!==(i=t.orientation)&&void 0!==i?i:exports.Orientation.VERTICAL,this.element=document.createElement("div"),this.element.className="dv-pane-container",e.appendChild(this.element),this.splitview=new $(this.element,{orientation:this._orientation,proportionalLayout:!1,descriptor:t.descriptor}),this.getPanes().forEach(e=>{const t=new m(e.onDidChangeExpansionState(()=>{this.setupAnimation(),this._onDidChange.fire(void 0)})),i={pane:e,disposable:{dispose:()=>{t.dispose()}}};this.paneItems.push(i),e.orthogonalSize=this.splitview.orthogonalSize}),this.addDisposables(this._onDidChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire(void 0)}),this.splitview.onDidAddView(()=>{this._onDidChange.fire()}),this.splitview.onDidRemoveView(()=>{this._onDidChange.fire()}))}setViewVisible(e,t){this.splitview.setViewVisible(e,t)}addPane(e,t,i=this.splitview.length,s=!1){const o=e.onDidChangeExpansionState(()=>{this.setupAnimation(),this._onDidChange.fire(void 0)}),n={pane:e,disposable:{dispose:()=>{o.dispose()}}};this.paneItems.splice(i,0,n),e.orthogonalSize=this.splitview.orthogonalSize,this.splitview.addView(e,t,i,s)}getViewSize(e){return this.splitview.getViewSize(e)}getPanes(){return this.splitview.getViews()}removePane(e,t={skipDispose:!1}){const i=this.paneItems.splice(e,1)[0];return this.splitview.removeView(e),t.skipDispose||(i.disposable.dispose(),i.pane.dispose()),i}moveView(e,t){if(e===t)return;const i=this.removePane(e,{skipDispose:!0});this.skipAnimation=!0;try{this.addPane(i.pane,i.pane.size,t,!1)}finally{this.skipAnimation=!1}}layout(e,t){this.splitview.layout(e,t)}setupAnimation(){this.skipAnimation||(this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),b(this.element,"dv-animated"),this.animationTimer=setTimeout(()=>{this.animationTimer=void 0,f(this.element,"dv-animated")},200))}dispose(){super.dispose(),this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),this.paneItems.forEach(e=>{e.disposable.dispose(),e.pane.dispose()}),this.paneItems=[],this.splitview.dispose(),this.element.remove()}}class j{get minimumWidth(){return this.view.minimumWidth}get maximumWidth(){return this.view.maximumWidth}get minimumHeight(){return this.view.minimumHeight}get maximumHeight(){return this.view.maximumHeight}get priority(){return this.view.priority}get snap(){return this.view.snap}get minimumSize(){return this.orientation===exports.Orientation.HORIZONTAL?this.minimumHeight:this.minimumWidth}get maximumSize(){return this.orientation===exports.Orientation.HORIZONTAL?this.maximumHeight:this.maximumWidth}get minimumOrthogonalSize(){return this.orientation===exports.Orientation.HORIZONTAL?this.minimumWidth:this.minimumHeight}get maximumOrthogonalSize(){return this.orientation===exports.Orientation.HORIZONTAL?this.maximumWidth:this.maximumHeight}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get element(){return this.view.element}get width(){return this.orientation===exports.Orientation.HORIZONTAL?this.orthogonalSize:this.size}get height(){return this.orientation===exports.Orientation.HORIZONTAL?this.size:this.orthogonalSize}constructor(e,t,i,s=0){this.view=e,this.orientation=t,this._onDidChange=new d,this.onDidChange=this._onDidChange.event,this._orthogonalSize=i,this._size=s,this._disposable=this.view.onDidChange(e=>{e?this._onDidChange.fire({size:this.orientation===exports.Orientation.VERTICAL?e.width:e.height,orthogonalSize:this.orientation===exports.Orientation.VERTICAL?e.height:e.width}):this._onDidChange.fire({})})}setVisible(e){this.view.setVisible&&this.view.setVisible(e)}layout(e,t){this._size=e,this._orthogonalSize=t,this.view.layout(this.width,this.height)}dispose(){this._onDidChange.dispose(),this._disposable.dispose()}}class Z extends m{get width(){return this.orientation===exports.Orientation.HORIZONTAL?this.size:this.orthogonalSize}get height(){return this.orientation===exports.Orientation.HORIZONTAL?this.orthogonalSize:this.size}get minimumSize(){return 0===this.children.length?0:Math.max(...this.children.map((e,t)=>this.splitview.isViewVisible(t)?e.minimumOrthogonalSize:0))}get maximumSize(){return Math.min(...this.children.map((e,t)=>this.splitview.isViewVisible(t)?e.maximumOrthogonalSize:Number.POSITIVE_INFINITY))}get minimumOrthogonalSize(){return this.splitview.minimumSize}get maximumOrthogonalSize(){return this.splitview.maximumSize}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get minimumWidth(){return this.orientation===exports.Orientation.HORIZONTAL?this.minimumOrthogonalSize:this.minimumSize}get minimumHeight(){return this.orientation===exports.Orientation.HORIZONTAL?this.minimumSize:this.minimumOrthogonalSize}get maximumWidth(){return this.orientation===exports.Orientation.HORIZONTAL?this.maximumOrthogonalSize:this.maximumSize}get maximumHeight(){return this.orientation===exports.Orientation.HORIZONTAL?this.maximumSize:this.maximumOrthogonalSize}get priority(){if(0===this.children.length)return exports.LayoutPriority.Normal;const e=this.children.map(e=>void 0===e.priority?exports.LayoutPriority.Normal:e.priority);return e.some(e=>e===exports.LayoutPriority.High)?exports.LayoutPriority.High:e.some(e=>e===exports.LayoutPriority.Low)?exports.LayoutPriority.Low:exports.LayoutPriority.Normal}get disabled(){return this.splitview.disabled}set disabled(e){this.splitview.disabled=e}get margin(){return this.splitview.margin}set margin(e){this.splitview.margin=e,this.children.forEach(t=>{t instanceof Z&&(t.margin=e)})}constructor(e,t,i,s,o,n,r,a){if(super(),this.orientation=e,this.proportionalLayout=t,this.styles=i,this._childrenDisposable=exports.DockviewDisposable.NONE,this.children=[],this._onDidChange=new d,this.onDidChange=this._onDidChange.event,this._onDidVisibilityChange=new d,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._orthogonalSize=o,this._size=s,this.element=document.createElement("div"),this.element.className="dv-branch-node",a){const e={views:a.map(e=>({view:e.node,size:e.node.size,visible:!(e.node instanceof j&&void 0!==e.visible)||e.visible})),size:this.orthogonalSize};this.children=a.map(e=>e.node),this.splitview=new $(this.element,{orientation:this.orientation,descriptor:e,proportionalLayout:t,styles:i,margin:r})}else this.splitview=new $(this.element,{orientation:this.orientation,proportionalLayout:t,styles:i,margin:r}),this.splitview.layout(this.size,this.orthogonalSize);this.disabled=n,this.addDisposables(this._onDidChange,this._onDidVisibilityChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire({})})),this.setupChildrenEvents()}setVisible(e){}isChildVisible(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.isViewVisible(e)}setChildVisible(e,t){if(e<0||e>=this.children.length)throw new Error("Invalid index");if(this.splitview.isViewVisible(e)===t)return;const i=0===this.splitview.contentSize;this.splitview.setViewVisible(e,t);const s=0===this.splitview.contentSize;(t&&i||!t&&s)&&this._onDidVisibilityChange.fire({visible:t})}moveChild(e,t){if(e===t)return;if(e<0||e>=this.children.length)throw new Error("Invalid from index");e<t&&t--,this.splitview.moveView(e,t);const i=this._removeChild(e);this._addChild(i,t)}getChildSize(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewSize(e)}resizeChild(e,t){if(e<0||e>=this.children.length)throw new Error("Invalid index");this.splitview.resizeView(e,t)}layout(e,t){this._size=t,this._orthogonalSize=e,this.splitview.layout(t,e)}addChild(e,t,i,s){if(i<0||i>this.children.length)throw new Error("Invalid index");this.splitview.addView(e,t,i,s),this._addChild(e,i)}getChildCachedVisibleSize(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewCachedVisibleSize(e)}removeChild(e,t){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.removeView(e,t),this._removeChild(e)}_addChild(e,t){this.children.splice(t,0,e),this.setupChildrenEvents()}_removeChild(e){const[t]=this.children.splice(e,1);return this.setupChildrenEvents(),t}setupChildrenEvents(){this._childrenDisposable.dispose(),this._childrenDisposable=new m(exports.DockviewEvent.any(...this.children.map(e=>e.onDidChange))(e=>{this._onDidChange.fire({size:e.orthogonalSize})}),...this.children.map((e,t)=>e instanceof Z?e.onDidVisibilityChange(({visible:e})=>{this.setChildVisible(t,e)}):exports.DockviewDisposable.NONE))}dispose(){this._childrenDisposable.dispose(),this.splitview.dispose(),this.children.forEach(e=>e.dispose()),super.dispose()}}function Y(e,t){if(e instanceof j)return e;if(e instanceof Z)return Y(e.children[t?e.children.length-1:0],t);throw new Error("invalid node")}function X(e,t,i){if(e instanceof Z){const s=new Z(e.orientation,e.proportionalLayout,e.styles,t,i,e.disabled,e.margin);for(let t=e.children.length-1;t>=0;t--){const i=e.children[t];s.addChild(X(i,i.size,i.orthogonalSize),i.size,0,!0)}return s}return new j(e.view,e.orientation,i)}function q(e,t,i){if(e instanceof Z){const s=new Z(se(e.orientation),e.proportionalLayout,e.styles,t,i,e.disabled,e.margin);let o=0;for(let n=e.children.length-1;n>=0;n--){const r=e.children[n],a=r instanceof Z?r.orthogonalSize:r.size;let h=0===e.size?0:Math.round(t*a/e.size);o+=h,0===n&&(h+=t-o),s.addChild(q(r,i,h),h,0,!0)}return s}return new j(e.view,se(e.orientation),i)}function K(e){const t=e.parentElement;if(!t)throw new Error("Invalid grid element");let i=t.firstElementChild,s=0;for(;i!==e&&i!==t.lastElementChild&&i;)i=i.nextElementSibling,s++;return s}function Q(e){const t=e.parentElement;if(!t)throw new Error("Invalid grid element");if(/\bdv-grid-view\b/.test(t.className))return[];const i=K(t);return[...Q(t.parentElement.parentElement.parentElement),i]}function ee(e,t,i){if(ie(e,t)===te(i)){const[e,s]=T(t);let o=s;return"right"!==i&&"bottom"!==i||(o+=1),[...e,o]}{const e="right"===i||"bottom"===i?1:0;return[...t,e]}}function te(e){return"top"===e||"bottom"===e?exports.Orientation.VERTICAL:exports.Orientation.HORIZONTAL}function ie(e,t){return t.length%2==0?se(e):e}const se=e=>e===exports.Orientation.HORIZONTAL?exports.Orientation.VERTICAL:exports.Orientation.HORIZONTAL;function oe(e){return!!e.children}const ne=(e,t)=>{const i=t===exports.Orientation.VERTICAL?e.box.width:e.box.height;return oe(e)?{type:"branch",data:e.children.map(e=>ne(e,se(t))),size:i}:"number"==typeof e.cachedVisibleSize?{type:"leaf",data:e.view.toJSON(),size:e.cachedVisibleSize,visible:!1}:{type:"leaf",data:e.view.toJSON(),size:i}};class re{get length(){return this._root?this._root.children.length:0}get orientation(){return this.root.orientation}set orientation(e){if(this.root.orientation===e)return;const{size:t,orthogonalSize:i}=this.root;this.root=q(this.root,i,t),this.root.layout(t,i)}get width(){return this.root.width}get height(){return this.root.height}get minimumWidth(){return this.root.minimumWidth}get minimumHeight(){return this.root.minimumHeight}get maximumWidth(){return this.root.maximumHeight}get maximumHeight(){return this.root.maximumHeight}get locked(){return this._locked}set locked(e){this._locked=e;const t=[this.root];for(;t.length>0;){const i=t.pop();i instanceof Z&&(i.disabled=e,t.push(...i.children))}}get margin(){return this._margin}set margin(e){this._margin=e,this.root.margin=e}maximizedView(){var e;return null===(e=this._maximizedNode)||void 0===e?void 0:e.leaf.view}hasMaximizedView(){return void 0!==this._maximizedNode}maximizeView(e){var t;const i=Q(e.element),[s,o]=this.getNode(i);if(!(o instanceof j))return;if((null===(t=this._maximizedNode)||void 0===t?void 0:t.leaf)===o)return;this.hasMaximizedView()&&this.exitMaximizedView(),ne(this.getView(),this.orientation);const n=[];!function e(t,i){for(let s=0;s<t.children.length;s++){const o=t.children[s];o instanceof j?o!==i&&(t.isChildVisible(s)?t.setChildVisible(s,!1):n.push(o)):e(o,i)}}(this.root,o),this._maximizedNode={leaf:o,hiddenOnMaximize:n},this._onDidMaximizedNodeChange.fire({view:o.view,isMaximized:!0})}exitMaximizedView(){if(!this._maximizedNode)return;const e=this._maximizedNode.hiddenOnMaximize;!function t(i){for(let s=i.children.length-1;s>=0;s--){const o=i.children[s];o instanceof j?e.includes(o)||i.setChildVisible(s,!0):t(o)}}(this.root);const t=this._maximizedNode.leaf;this._maximizedNode=void 0,this._onDidMaximizedNodeChange.fire({view:t.view,isMaximized:!1})}serialize(){const e=this.maximizedView();let t;e&&(t=Q(e.element)),this.hasMaximizedView()&&this.exitMaximizedView();const i={root:ne(this.getView(),this.orientation),width:this.width,height:this.height,orientation:this.orientation};return t&&(i.maximizedNode={location:t}),e&&this.maximizeView(e),i}dispose(){this.disposable.dispose(),this._onDidChange.dispose(),this._onDidMaximizedNodeChange.dispose(),this._onDidViewVisibilityChange.dispose(),this.root.dispose(),this._maximizedNode=void 0,this.element.remove()}clear(){const e=this.root.orientation;this.root=new Z(e,this.proportionalLayout,this.styles,this.root.size,this.root.orthogonalSize,this.locked,this.margin)}deserialize(e,t){const i=e.orientation,s=i===exports.Orientation.VERTICAL?e.height:e.width;if(this._deserialize(e.root,i,t,s),this.layout(e.width,e.height),e.maximizedNode){const t=e.maximizedNode.location,[i,s]=this.getNode(t);if(!(s instanceof j))return;this.maximizeView(s.view)}}_deserialize(e,t,i,s){this.root=this._deserializeNode(e,t,i,s)}_deserializeNode(e,t,i,s){var o;let n;if("branch"===e.type){const o=e.data.map(s=>({node:this._deserializeNode(s,se(t),i,e.size),visible:s.visible}));n=new Z(t,this.proportionalLayout,this.styles,e.size,s,this.locked,this.margin,o)}else{const r=i.fromJSON(e);"boolean"==typeof e.visible&&(null===(o=r.setVisible)||void 0===o||o.call(r,e.visible)),n=new j(r,t,s,e.size)}return n}get root(){return this._root}set root(e){const t=this._root;t&&(t.dispose(),this._maximizedNode=void 0,this.element.removeChild(t.element)),this._root=e,this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(e=>{this._onDidChange.fire(e)})}normalize(){if(!this._root)return;if(1!==this._root.children.length)return;const e=this.root,t=e.children[0];if(t instanceof j)return;e.element.remove();const i=e.removeChild(0);e.dispose(),i.dispose(),this._root=X(t,t.size,t.orthogonalSize),this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(e=>{this._onDidChange.fire(e)})}insertOrthogonalSplitviewAtRoot(){if(!this._root)return;const e=this.root;if(e.element.remove(),this._root=new Z(se(e.orientation),this.proportionalLayout,this.styles,this.root.orthogonalSize,this.root.size,this.locked,this.margin),0===e.children.length);else if(1===e.children.length){const t=e.children[0];e.removeChild(0).dispose(),e.dispose(),this._root.addChild(q(t,t.orthogonalSize,t.size),exports.Sizing.Distribute,0)}else this._root.addChild(e,exports.Sizing.Distribute,0);this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(e=>{this._onDidChange.fire(e)})}next(e){return this.progmaticSelect(e)}previous(e){return this.progmaticSelect(e,!0)}getView(e){const t=e?this.getNode(e)[1]:this.root;return this._getViews(t,this.orientation)}_getViews(e,t,i){const s={height:e.height,width:e.width};if(e instanceof j)return{box:s,view:e.view,cachedVisibleSize:i};const o=[];for(let i=0;i<e.children.length;i++){const s=e.children[i],n=e.getChildCachedVisibleSize(i);o.push(this._getViews(s,se(t),n))}return{box:s,children:o}}progmaticSelect(e,t=!1){const[i,s]=this.getNode(e);if(!(s instanceof j))throw new Error("invalid location");for(let s=i.length-1;s>-1;s--){const o=i[s],n=e[s]||0;if(t?n-1>-1:n+1<o.children.length)return Y(o.children[t?n-1:n+1],t)}return Y(this.root,t)}constructor(e,t,i,s,o){this.proportionalLayout=e,this.styles=t,this._locked=!1,this._margin=0,this._maximizedNode=void 0,this.disposable=new v,this._onDidChange=new d,this.onDidChange=this._onDidChange.event,this._onDidViewVisibilityChange=new d,this.onDidViewVisibilityChange=this._onDidViewVisibilityChange.event,this._onDidMaximizedNodeChange=new d,this.onDidMaximizedNodeChange=this._onDidMaximizedNodeChange.event,this.element=document.createElement("div"),this.element.className="dv-grid-view",this._locked=null!=s&&s,this._margin=null!=o?o:0,this.root=new Z(i,e,t,0,0,this.locked,this.margin)}isViewVisible(e){const[t,i]=T(e),[,s]=this.getNode(t);if(!(s instanceof Z))throw new Error("Invalid from location");return s.isChildVisible(i)}setViewVisible(e,t){this.hasMaximizedView()&&this.exitMaximizedView();const[i,s]=T(e),[,o]=this.getNode(i);if(!(o instanceof Z))throw new Error("Invalid from location");this._onDidViewVisibilityChange.fire(),o.setChildVisible(s,t)}moveView(e,t,i){this.hasMaximizedView()&&this.exitMaximizedView();const[,s]=this.getNode(e);if(!(s instanceof Z))throw new Error("Invalid location");s.moveChild(t,i)}addView(e,t,i){this.hasMaximizedView()&&this.exitMaximizedView();const[s,o]=T(i),[n,r]=this.getNode(s);if(r instanceof Z){const i=new j(e,se(r.orientation),r.orthogonalSize);r.addChild(i,t,o)}else{const[i,...a]=[...n].reverse(),[h,...l]=[...s].reverse();let d=0;const p=i.getChildCachedVisibleSize(h);"number"==typeof p&&(d=exports.Sizing.Invisible(p));i.removeChild(h).dispose();const u=new Z(r.orientation,this.proportionalLayout,this.styles,r.size,r.orthogonalSize,this.locked,this.margin);i.addChild(u,r.size,h);const c=new j(r.view,i.orientation,r.size);u.addChild(c,d,0),"number"!=typeof t&&"split"===t.type&&(t={type:"split",index:0});const m=new j(e,i.orientation,r.size);u.addChild(m,t,o)}}remove(e,t){const i=Q(e.element);return this.removeView(i,t)}removeView(e,t){this.hasMaximizedView()&&this.exitMaximizedView();const[i,s]=T(e),[o,n]=this.getNode(i);if(!(n instanceof Z))throw new Error("Invalid location");const r=n.children[s];if(!(r instanceof j))throw new Error("Invalid location");if(n.removeChild(s,t),r.dispose(),1!==n.children.length)return r.view;const a=n.children[0];if(0===o.length)return a instanceof j||(n.removeChild(0,t),this.root=a),r.view;const[h,...l]=[...o].reverse(),[d,...p]=[...i].reverse(),u=n.isChildVisible(0);n.removeChild(0,t);const c=h.children.map((e,t)=>h.getChildSize(t));if(h.removeChild(d,t).dispose(),a instanceof Z){c.splice(d,1,...a.children.map(e=>e.size));for(let e=0;e<a.children.length;e++){const t=a.children[e];h.addChild(t,t.size,d+e)}for(;a.children.length>0;)a.removeChild(0)}else{const e=new j(a.view,se(a.orientation),a.size),t=u?a.orthogonalSize:exports.Sizing.Invisible(a.orthogonalSize);h.addChild(e,t,d)}a.dispose();for(let e=0;e<c.length;e++)h.resizeChild(e,c[e]);return r.view}layout(e,t){const[i,s]=this.root.orientation===exports.Orientation.HORIZONTAL?[t,e]:[e,t];this.root.layout(i,s)}getNode(e,t=this.root,i=[]){if(0===e.length)return[i,t];if(!(t instanceof Z))throw new Error("Invalid location");const[s,...o]=e;if(s<0||s>=t.children.length)throw new Error("Invalid location");const n=t.children[s];return i.push(t),this.getNode(o,n,i)}}const ae=(()=>{const e={disableAutoResizing:void 0,proportionalLayout:void 0,orientation:void 0,hideBorders:void 0,className:void 0};return Object.keys(e)})();class he extends m{get element(){return this._element}get disableResizing(){return this._disableResizing}set disableResizing(e){this._disableResizing=e}constructor(e,t=!1){super(),this._disableResizing=t,this._element=e,this.addDisposables(_(this._element,e=>{if(this.isDisposed)return;if(this.disableResizing)return;if(!this._element.offsetParent)return;if(!function(e){let t=e;for(;null==t?void 0:t.parentNode;){if(t.parentNode===document)return!0;t=t.parentNode instanceof DocumentFragment?t.parentNode.host:t.parentNode}return!1}(this._element))return;const{width:t,height:i}=e.contentRect;this.layout(t,i)}))}}const le=L();function de(e){switch(e){case"left":return"left";case"right":return"right";case"above":return"top";case"below":return"bottom";default:return"center"}}class pe extends he{get id(){return this._id}get size(){return this._groups.size}get groups(){return Array.from(this._groups.values()).map(e=>e.value)}get width(){return this.gridview.width}get height(){return this.gridview.height}get minimumHeight(){return this.gridview.minimumHeight}get maximumHeight(){return this.gridview.maximumHeight}get minimumWidth(){return this.gridview.minimumWidth}get maximumWidth(){return this.gridview.maximumWidth}get activeGroup(){return this._activeGroup}get locked(){return this.gridview.locked}set locked(e){this.gridview.locked=e}constructor(e,t){var i;super(document.createElement("div"),t.disableAutoResizing),this._id=le.next(),this._groups=new Map,this._onDidRemove=new d,this.onDidRemove=this._onDidRemove.event,this._onDidAdd=new d,this.onDidAdd=this._onDidAdd.event,this._onDidMaximizedChange=new d,this.onDidMaximizedChange=this._onDidMaximizedChange.event,this._onDidActiveChange=new d,this.onDidActiveChange=this._onDidActiveChange.event,this._bufferOnDidLayoutChange=new u,this.onDidLayoutChange=this._bufferOnDidLayoutChange.onEvent,this._onDidViewVisibilityChangeMicroTaskQueue=new u,this.onDidViewVisibilityChangeMicroTaskQueue=this._onDidViewVisibilityChangeMicroTaskQueue.onEvent,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new A(this.element),this._classNames.setClassNames(null!==(i=t.className)&&void 0!==i?i:""),e.appendChild(this.element),this.gridview=new re(!!t.proportionalLayout,t.styles,t.orientation,t.locked,t.margin),this.gridview.locked=!!t.locked,this.element.appendChild(this.gridview.element),this.layout(0,0,!0),this.addDisposables(this.gridview.onDidMaximizedNodeChange(e=>{this._onDidMaximizedChange.fire({panel:e.view,isMaximized:e.isMaximized})}),this.gridview.onDidViewVisibilityChange(()=>this._onDidViewVisibilityChangeMicroTaskQueue.fire()),this.onDidViewVisibilityChangeMicroTaskQueue(()=>{this.forceRelayout()}),exports.DockviewDisposable.from(()=>{var e;null===(e=this.element.parentElement)||void 0===e||e.removeChild(this.element)}),this.gridview.onDidChange(()=>{this._bufferOnDidLayoutChange.fire()}),exports.DockviewEvent.any(this.onDidAdd,this.onDidRemove,this.onDidActiveChange)(()=>{this._bufferOnDidLayoutChange.fire()}),this._onDidMaximizedChange,this._onDidViewVisibilityChangeMicroTaskQueue,this._bufferOnDidLayoutChange)}setVisible(e,t){this.gridview.setViewVisible(Q(e.element),t),this._bufferOnDidLayoutChange.fire()}isVisible(e){return this.gridview.isViewVisible(Q(e.element))}updateOptions(e){var t,i,s,o;e.proportionalLayout,e.orientation&&(this.gridview.orientation=e.orientation),"disableResizing"in e&&(this.disableResizing=null!==(t=e.disableAutoResizing)&&void 0!==t&&t),"locked"in e&&(this.locked=null!==(i=e.locked)&&void 0!==i&&i),"margin"in e&&(this.gridview.margin=null!==(s=e.margin)&&void 0!==s?s:0),"className"in e&&this._classNames.setClassNames(null!==(o=e.className)&&void 0!==o?o:"")}maximizeGroup(e){this.gridview.maximizeView(e),this.doSetGroupActive(e)}isMaximizedGroup(e){return this.gridview.maximizedView()===e}exitMaximizedGroup(){this.gridview.exitMaximizedView()}hasMaximizedGroup(){return this.gridview.hasMaximizedView()}doAddGroup(e,t=[0],i){this.gridview.addView(e,null!=i?i:exports.Sizing.Distribute,t),this._onDidAdd.fire(e)}doRemoveGroup(e,t){if(!this._groups.has(e.id))throw new Error("invalid operation");const i=this._groups.get(e.id),s=this.gridview.remove(e,exports.Sizing.Distribute);if(i&&!(null==t?void 0:t.skipDispose)&&(i.disposable.dispose(),i.value.dispose(),this._groups.delete(e.id),this._onDidRemove.fire(e)),!(null==t?void 0:t.skipActive)&&this._activeGroup===e){const e=Array.from(this._groups.values());this.doSetGroupActive(e.length>0?e[0].value:void 0)}return s}getPanel(e){var t;return null===(t=this._groups.get(e))||void 0===t?void 0:t.value}doSetGroupActive(e){this._activeGroup!==e&&(this._activeGroup&&this._activeGroup.setActive(!1),e&&e.setActive(!0),this._activeGroup=e,this._onDidActiveChange.fire(e))}removeGroup(e){this.doRemoveGroup(e)}moveToNext(e){var t;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const i=Q(e.group.element),s=null===(t=this.gridview.next(i))||void 0===t?void 0:t.view;this.doSetGroupActive(s)}moveToPrevious(e){var t;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const i=Q(e.group.element),s=null===(t=this.gridview.previous(i))||void 0===t?void 0:t.view;this.doSetGroupActive(s)}forceRelayout(){this.layout(this.width,this.height,!0)}layout(e,t,i){(i||e!==this.width||t!==this.height)&&(this.gridview.element.style.height=`${t}px`,this.gridview.element.style.width=`${e}px`,this.gridview.layout(e,t))}dispose(){this._onDidActiveChange.dispose(),this._onDidAdd.dispose(),this._onDidRemove.dispose();for(const e of this.groups)e.dispose();this.gridview.dispose(),super.dispose()}}class ue{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get length(){return this.component.length}get orientation(){return this.component.orientation}get panels(){return this.component.panels}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}constructor(e){this.component=e}removePanel(e,t){this.component.removePanel(e,t)}focus(){this.component.focus()}getPanel(e){return this.component.getPanel(e)}layout(e,t){return this.component.layout(e,t)}addPanel(e){return this.component.addPanel(e)}movePanel(e,t){this.component.movePanel(e,t)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class ce{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get panels(){return this.component.panels}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}get onDidDrop(){return this.component.onDidDrop}get onUnhandledDragOverEvent(){return this.component.onUnhandledDragOverEvent}constructor(e){this.component=e}removePanel(e){this.component.removePanel(e)}getPanel(e){return this.component.getPanel(e)}movePanel(e,t){this.component.movePanel(e,t)}focus(){this.component.focus()}layout(e,t){this.component.layout(e,t)}addPanel(e){return this.component.addPanel(e)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class me{get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddPanel(){return this.component.onDidAddGroup}get onDidRemovePanel(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActiveGroupChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get panels(){return this.component.groups}get orientation(){return this.component.orientation}set orientation(e){this.component.updateOptions({orientation:e})}constructor(e){this.component=e}focus(){this.component.focus()}layout(e,t,i=!1){this.component.layout(e,t,i)}addPanel(e){return this.component.addPanel(e)}removePanel(e,t){this.component.removePanel(e,t)}movePanel(e,t){this.component.movePanel(e,t)}getPanel(e){return this.component.getPanel(e)}fromJSON(e){return this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class ve{get id(){return this.component.id}get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get size(){return this.component.size}get tabGroupColors(){return this.component.tabGroupColorPalette.entries()}get totalPanels(){return this.component.totalPanels}get onDidActiveGroupChange(){return this.component.onDidActiveGroupChange}get onDidAddGroup(){return this.component.onDidAddGroup}get onDidRemoveGroup(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActivePanelChange}get onDidAddPanel(){return this.component.onDidAddPanel}get onDidRemovePanel(){return this.component.onDidRemovePanel}get onDidMovePanel(){return this.component.onDidMovePanel}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidDrop(){return this.component.onDidDrop}get onWillDrop(){return this.component.onWillDrop}get onWillShowOverlay(){return this.component.onWillShowOverlay}get onWillDragGroup(){return this.component.onWillDragGroup}get onWillDragPanel(){return this.component.onWillDragPanel}get onUnhandledDragOverEvent(){return this.component.onUnhandledDragOverEvent}get onDidPopoutGroupSizeChange(){return this.component.onDidPopoutGroupSizeChange}get onDidPopoutGroupPositionChange(){return this.component.onDidPopoutGroupPositionChange}get onDidOpenPopoutWindowFail(){return this.component.onDidOpenPopoutWindowFail}get onDidCreateTabGroup(){return this.component.onDidCreateTabGroup}get onDidDestroyTabGroup(){return this.component.onDidDestroyTabGroup}get onDidAddPanelToTabGroup(){return this.component.onDidAddPanelToTabGroup}get onDidRemovePanelFromTabGroup(){return this.component.onDidRemovePanelFromTabGroup}get onDidTabGroupChange(){return this.component.onDidTabGroupChange}get onDidTabGroupCollapsedChange(){return this.component.onDidTabGroupCollapsedChange}get panels(){return this.component.panels}get groups(){return this.component.groups}get activePanel(){return this.component.activePanel}get activeGroup(){return this.component.activeGroup}constructor(e){this.component=e}focus(){this.component.focus()}getPanel(e){return this.component.getGroupPanel(e)}layout(e,t,i=!1){this.component.layout(e,t,i)}addPanel(e){return this.component.addPanel(e)}removePanel(e){this.component.removePanel(e)}addGroup(e){return this.component.addGroup(e)}closeAllGroups(){return this.component.closeAllGroups()}removeGroup(e){this.component.removeGroup(e)}getGroup(e){return this.component.getPanel(e)}addFloatingGroup(e,t){return this.component.addFloatingGroup(e,t)}fromJSON(e,t){this.component.fromJSON(e,t)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}moveToNext(e){this.component.moveToNext(e)}moveToPrevious(e){this.component.moveToPrevious(e)}maximizeGroup(e){this.component.maximizeGroup(e.group)}hasMaximizedGroup(){return this.component.hasMaximizedGroup()}exitMaximizedGroup(){this.component.exitMaximizedGroup()}get onDidMaximizedGroupChange(){return this.component.onDidMaximizedGroupChange}addPopoutGroup(e,t){return this.component.addPopoutGroup(e,t)}addEdgeGroup(e,t){return this.component.addEdgeGroup(e,t)}getEdgeGroup(e){return this.component.getEdgeGroup(e)}setEdgeGroupVisible(e,t){this.component.setEdgeGroupVisible(e,t)}isEdgeGroupVisible(e){return this.component.isEdgeGroupVisible(e)}removeEdgeGroup(e){this.component.removeEdgeGroup(e)}updateOptions(e){this.component.updateOptions(e)}_getGroupModel(e){const t=this.component.getPanel(e);if(!t)throw new Error(`dockview: group '${e}' not found`);return t.model}createTabGroup(e){return this._getGroupModel(e.groupId).createTabGroup({label:e.label,color:e.color,componentParams:e.componentParams})}dissolveTabGroup(e){this._getGroupModel(e.groupId).dissolveTabGroup(e.tabGroupId)}addPanelToTabGroup(e){this._getGroupModel(e.groupId).addPanelToTabGroup(e.tabGroupId,e.panelId,e.index)}removePanelFromTabGroup(e){this._getGroupModel(e.groupId).removePanelFromTabGroup(e.panelId)}getTabGroups(e){return this._getGroupModel(e.groupId).getTabGroups()}getTabGroupForPanel(e){return this._getGroupModel(e.groupId).getTabGroupForPanel(e.panelId)}moveTabGroup(e){this._getGroupModel(e.groupId).moveTabGroup(e.tabGroupId,e.index)}dispose(){this.component.dispose()}}class ge extends m{constructor(e,t){super(),this.el=e,this.disabled=t,this.dataDisposable=new v,this.pointerEventsDisposable=new v,this._onDragStart=new d,this.onDragStart=this._onDragStart.event,this.addDisposables(this._onDragStart,this.dataDisposable,this.pointerEventsDisposable),this.configure()}setDisabled(e){this.disabled=e}isCancelled(e){return!1}configure(){this.addDisposables(this._onDragStart,p(this.el,"dragstart",e=>{if(e.defaultPrevented||this.isCancelled(e)||this.disabled)return void e.preventDefault();const t=z();if(this.pointerEventsDisposable.value={dispose:()=>{t.release()}},this.el.classList.add("dv-dragged"),setTimeout(()=>this.el.classList.remove("dv-dragged"),0),this.dataDisposable.value=this.getData(e),this._onDragStart.fire(e),e.dataTransfer){e.dataTransfer.effectAllowed="move";e.dataTransfer.items.length>0||e.dataTransfer.setData("text/plain","")}}),p(this.el,"dragend",()=>{this.pointerEventsDisposable.dispose(),setTimeout(()=>{this.dataDisposable.dispose()},0)}))}}class _e extends m{constructor(e,t){super(),this.element=e,this.callbacks=t,this.target=null,this.registerListeners()}onDragEnter(e){this.target=e.target,this.callbacks.onDragEnter(e)}onDragOver(e){e.preventDefault(),this.callbacks.onDragOver&&this.callbacks.onDragOver(e)}onDragLeave(e){this.target===e.target&&(this.target=null,this.callbacks.onDragLeave(e))}onDragEnd(e){this.target=null,this.callbacks.onDragEnd(e)}onDrop(e){this.callbacks.onDrop(e)}registerListeners(){this.addDisposables(p(this.element,"dragenter",e=>{this.onDragEnter(e)},!0)),this.addDisposables(p(this.element,"dragover",e=>{this.onDragOver(e)},!0)),this.addDisposables(p(this.element,"dragleave",e=>{this.onDragLeave(e)})),this.addDisposables(p(this.element,"dragend",e=>{this.onDragEnd(e)})),this.addDisposables(p(this.element,"drop",e=>{this.onDrop(e)}))}}class fe extends r{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}constructor(e){super(),this.options=e}}function be(e){switch(e){case"above":return"top";case"below":return"bottom";case"left":return"left";case"right":return"right";case"within":return"center";default:throw new Error(`invalid direction '${e}'`)}}function we(e){switch(e){case"top":return"above";case"bottom":return"below";case"left":return"left";case"right":return"right";case"center":return"within";default:throw new Error(`invalid position '${e}'`)}}const De={value:20,type:"percentage"},Ce={value:50,type:"percentage"};class xe extends m{get disabled(){return this._disabled}set disabled(e){this._disabled=e}get state(){return this._state}constructor(e,t){super(),this.element=e,this.options=t,this._onDrop=new d,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new d,this.onWillShowOverlay=this._onWillShowOverlay.event,this._disabled=!1,this._acceptedTargetZonesSet=new Set(this.options.acceptedTargetZones),this.dnd=new _e(this.element,{onDragEnter:()=>{var e,t,i;null===(i=null===(t=(e=this.options).getOverrideTarget)||void 0===t?void 0:t.call(e))||void 0===i||i.getElements()},onDragOver:e=>{var t,i,s,o,n,r,a;xe.ACTUAL_TARGET=this;const h=null===(i=(t=this.options).getOverrideTarget)||void 0===i?void 0:i.call(t);if(0===this._acceptedTargetZonesSet.size){if(h)return;return void this.removeDropTarget()}const l=null!==(n=null===(o=(s=this.options).getOverlayOutline)||void 0===o?void 0:o.call(s))&&void 0!==n?n:this.element,d=l.offsetWidth,p=l.offsetHeight;if(0===d||0===p)return;const u=e.currentTarget.getBoundingClientRect(),c=(null!==(r=e.clientX)&&void 0!==r?r:0)-u.left,m=(null!==(a=e.clientY)&&void 0!==a?a:0)-u.top,v=this.calculateQuadrant(this._acceptedTargetZonesSet,c,m,d,p);if(this.isAlreadyUsed(e)||null===v)return void this.removeDropTarget();if(!this.options.canDisplayOverlay(e,v)){if(h)return;return void this.removeDropTarget()}const g=new fe({nativeEvent:e,position:v});this._onWillShowOverlay.fire(g),g.defaultPrevented?this.removeDropTarget():(this.markAsUsed(e),h||this.targetElement||(this.targetElement=document.createElement("div"),this.targetElement.className="dv-drop-target-dropzone",this.overlayElement=document.createElement("div"),this.overlayElement.className="dv-drop-target-selection",this._state="center",this.targetElement.appendChild(this.overlayElement),l.classList.add("dv-drop-target"),l.append(this.targetElement)),this.toggleClasses(v,d,p),this._state=v)},onDragLeave:()=>{var e,t;(null===(t=(e=this.options).getOverrideTarget)||void 0===t?void 0:t.call(e))||this.removeDropTarget()},onDragEnd:e=>{var t,i;const s=null===(i=(t=this.options).getOverrideTarget)||void 0===i?void 0:i.call(t);s&&xe.ACTUAL_TARGET===this&&this._state&&(e.stopPropagation(),this._onDrop.fire({position:this._state,nativeEvent:e})),this.removeDropTarget(),null==s||s.clear()},onDrop:e=>{var t,i,s;e.preventDefault();const o=this._state;this.removeDropTarget(),null===(s=null===(i=(t=this.options).getOverrideTarget)||void 0===i?void 0:i.call(t))||void 0===s||s.clear(),o&&(e.stopPropagation(),this._onDrop.fire({position:o,nativeEvent:e}))}}),this.addDisposables(this._onDrop,this._onWillShowOverlay,this.dnd)}setTargetZones(e){this._acceptedTargetZonesSet=new Set(e)}setOverlayModel(e){this.options.overlayModel=e}dispose(){this.removeDropTarget(),super.dispose()}markAsUsed(e){e[xe.USED_EVENT_ID]=!0}isAlreadyUsed(e){const t=e[xe.USED_EVENT_ID];return"boolean"==typeof t&&t}toggleClasses(e,t,i){var s,o,n,r,a,h,l,d,p,u,c;const m=null===(o=(s=this.options).getOverrideTarget)||void 0===o?void 0:o.call(s);if(!m&&!this.overlayElement)return;const v=t<(null!==(r=null===(n=this.options.overlayModel)||void 0===n?void 0:n.smallWidthBoundary)&&void 0!==r?r:100),g=i<(null!==(h=null===(a=this.options.overlayModel)||void 0===a?void 0:a.smallHeightBoundary)&&void 0!==h?h:100),_="left"===e,f="right"===e,b="top"===e,D="bottom"===e,C=!v&&f,x=!v&&_,y=!g&&b,S=!g&&D;let G=1;const z=null!==(d=null===(l=this.options.overlayModel)||void 0===l?void 0:l.size)&&void 0!==d?d:Ce;if("percentage"===z.type?G=M(z.value,0,100)/100:((C||x)&&(G=M(0,z.value,t)/t),(y||S)&&(G=M(0,z.value,i)/i)),m){const s=null!==(c=null===(u=(p=this.options).getOverlayOutline)||void 0===u?void 0:u.call(p))&&void 0!==c?c:this.element,o=s.getBoundingClientRect(),n=m.getElements(void 0,s),r=n.root,a=n.overlay,h=r.getBoundingClientRect(),l=o.top-h.top,d=o.left-h.left,z={top:l,left:d,width:t,height:i};if(C?(z.left=d+t*(1-G),z.width=t*G):x?z.width=t*G:y?z.height=i*G:S&&(z.top=l+i*(1-G),z.height=i*G),v&&_&&(z.width=4),v&&f&&(z.left=d+t-4,z.width=4),g&&b&&(z.height=4),g&&D&&(z.top=l+i-4,z.height=4),!function(e,t){const{top:i,left:s,width:o,height:n}=t,r=`${Math.round(i)}px`,a=`${Math.round(s)}px`,h=`${Math.round(o)}px`,l=`${Math.round(n)}px`;return e.style.top!==r||e.style.left!==a||e.style.width!==h||e.style.height!==l}(a,z))return;return function(e,t){const{top:i,left:s,width:o,height:n}=t,r=`${Math.round(i)}px`,a=`${Math.round(s)}px`,h=`${Math.round(o)}px`,l=`${Math.round(n)}px`;e.style.top=r,e.style.left=a,e.style.width=h,e.style.height=l,e.style.visibility="visible",e.style.transform&&""!==e.style.transform||(e.style.transform="translate3d(0, 0, 0)")}(a,z),a.className="dv-drop-target-anchor"+(this.options.className?` ${this.options.className}`:""),w(a,"dv-drop-target-left",_),w(a,"dv-drop-target-right",f),w(a,"dv-drop-target-top",b),w(a,"dv-drop-target-bottom",D),w(a,"dv-drop-target-anchor-line",v&&(_||f)||g&&(b||D)),w(a,"dv-drop-target-center","center"===e),void(n.changed&&(w(a,"dv-drop-target-anchor-container-changed",!0),setTimeout(()=>{w(a,"dv-drop-target-anchor-container-changed",!1)},10)))}if(!this.overlayElement)return;const A={top:"0px",left:"0px",width:"100%",height:"100%"};C?(A.left=100*(1-G)+"%",A.width=100*G+"%"):x?A.width=100*G+"%":y?A.height=100*G+"%":S&&(A.top=100*(1-G)+"%",A.height=100*G+"%"),v&&_&&(A.width="4px"),v&&f&&(A.left=t-4+"px",A.width="4px"),g&&b&&(A.height="4px"),g&&D&&(A.top=i-4+"px",A.height="4px"),function(e,t){const{top:i,left:s,width:o,height:n}=t;e.style.top=i,e.style.left=s,e.style.width=o,e.style.height=n,e.style.visibility="visible",e.style.transform&&""!==e.style.transform||(e.style.transform="translate3d(0, 0, 0)")}(this.overlayElement,A);const P=v&&(_||f)||g&&(b||D);w(this.overlayElement,"dv-drop-target-small-vertical",g),w(this.overlayElement,"dv-drop-target-small-horizontal",v),w(this.overlayElement,"dv-drop-target-selection-line",P),w(this.overlayElement,"dv-drop-target-left",_),w(this.overlayElement,"dv-drop-target-right",f),w(this.overlayElement,"dv-drop-target-top",b),w(this.overlayElement,"dv-drop-target-bottom",D),w(this.overlayElement,"dv-drop-target-center","center"===e)}calculateQuadrant(e,t,i,s,o){var n,r;const a=null!==(r=null===(n=this.options.overlayModel)||void 0===n?void 0:n.activationSize)&&void 0!==r?r:De;return"percentage"===a.type?function(e,t,i,s,o,n){const r=100*t/s,a=100*i/o;if(e.has("left")&&r<n)return"left";if(e.has("right")&&r>100-n)return"right";if(e.has("top")&&a<n)return"top";if(e.has("bottom")&&a>100-n)return"bottom";if(!e.has("center"))return null;return"center"}(e,t,i,s,o,a.value):function(e,t,i,s,o,n){if(e.has("left")&&t<n)return"left";if(e.has("right")&&t>s-n)return"right";if(e.has("top")&&i<n)return"top";if(e.has("bottom")&&i>o-n)return"bottom";if(!e.has("center"))return null;return"center"}(e,t,i,s,o,a.value)}removeDropTarget(){var e;this.targetElement&&(this._state=void 0,null===(e=this.targetElement.parentElement)||void 0===e||e.classList.remove("dv-drop-target"),this.targetElement.remove(),this.targetElement=void 0,this.overlayElement=void 0)}}xe.USED_EVENT_ID="__dockview_droptarget_event_is_used__";const ye=(()=>{const e={disableAutoResizing:void 0,disableDnd:void 0,className:void 0};return Object.keys(e)})();class Se extends a{constructor(e,t,i,s){super(),this.nativeEvent=e,this.position=t,this.getData=i,this.panel=s}}class Ge extends r{constructor(){super()}}class ze extends m{get isFocused(){return this._isFocused}get isActive(){return this._isActive}get isVisible(){return this._isVisible}get width(){return this._width}get height(){return this._height}constructor(e,t){super(),this.id=e,this.component=t,this._isFocused=!1,this._isActive=!1,this._isVisible=!0,this._width=0,this._height=0,this._parameters={},this.panelUpdatesDisposable=new v,this._onDidDimensionChange=new d,this.onDidDimensionsChange=this._onDidDimensionChange.event,this._onDidChangeFocus=new d,this.onDidFocusChange=this._onDidChangeFocus.event,this._onWillFocus=new d,this.onWillFocus=this._onWillFocus.event,this._onDidVisibilityChange=new d,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._onWillVisibilityChange=new d,this.onWillVisibilityChange=this._onWillVisibilityChange.event,this._onDidActiveChange=new d,this.onDidActiveChange=this._onDidActiveChange.event,this._onActiveChange=new d,this.onActiveChange=this._onActiveChange.event,this._onDidParametersChange=new d,this.onDidParametersChange=this._onDidParametersChange.event,this.addDisposables(this.onDidFocusChange(e=>{this._isFocused=e.isFocused}),this.onDidActiveChange(e=>{this._isActive=e.isActive}),this.onDidVisibilityChange(e=>{this._isVisible=e.isVisible}),this.onDidDimensionsChange(e=>{this._width=e.width,this._height=e.height}),this.panelUpdatesDisposable,this._onDidDimensionChange,this._onDidChangeFocus,this._onDidVisibilityChange,this._onDidActiveChange,this._onWillFocus,this._onActiveChange,this._onWillFocus,this._onWillVisibilityChange,this._onDidParametersChange)}getParameters(){return this._parameters}initialize(e){this.panelUpdatesDisposable.value=this._onDidParametersChange.event(t=>{this._parameters=t,e.update({params:t})})}setVisible(e){this._onWillVisibilityChange.fire({isVisible:e})}setActive(){this._onActiveChange.fire()}updateParameters(e){this._onDidParametersChange.fire(e)}}class Ae extends ze{constructor(e,t){super(e,t),this._onDidConstraintsChangeInternal=new d,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new d({replay:!0}),this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new d,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}}class Pe extends Ae{set pane(e){this._pane=e}constructor(e,t){super(e,t),this._onDidExpansionChange=new d({replay:!0}),this.onDidExpansionChange=this._onDidExpansionChange.event,this._onMouseEnter=new d({}),this.onMouseEnter=this._onMouseEnter.event,this._onMouseLeave=new d({}),this.onMouseLeave=this._onMouseLeave.event,this.addDisposables(this._onDidExpansionChange,this._onMouseEnter,this._onMouseLeave)}setExpanded(e){var t;null===(t=this._pane)||void 0===t||t.setExpanded(e)}get isExpanded(){var e;return!!(null===(e=this._pane)||void 0===e?void 0:e.isExpanded())}}class Ie extends m{get element(){return this._element}get width(){return this._width}get height(){return this._height}get params(){var e;return null===(e=this._params)||void 0===e?void 0:e.params}constructor(e,t,i){super(),this.id=e,this.component=t,this.api=i,this._height=0,this._width=0,this._element=document.createElement("div"),this._element.tabIndex=-1,this._element.style.outline="none",this._element.style.height="100%",this._element.style.width="100%",this._element.style.overflow="hidden";const s=C(this._element);this.addDisposables(this.api,s.onDidFocus(()=>{this.api._onDidChangeFocus.fire({isFocused:!0})}),s.onDidBlur(()=>{this.api._onDidChangeFocus.fire({isFocused:!1})}),s)}focus(){const e=new Ge;this.api._onWillFocus.fire(e),e.defaultPrevented||this._element.focus()}layout(e,t){this._width=e,this._height=t,this.api._onDidDimensionChange.fire({width:e,height:t}),this.part&&this._params&&this.part.update(this._params.params)}init(e){this._params=e,this.part=this.getComponent()}update(e){var t,i;this._params=Object.assign(Object.assign({},this._params),{params:Object.assign(Object.assign({},null===(t=this._params)||void 0===t?void 0:t.params),e.params)});for(const t of Object.keys(e.params))void 0===e.params[t]&&delete this._params.params[t];null===(i=this.part)||void 0===i||i.update({params:this._params.params})}toJSON(){var e,t;const i=null!==(t=null===(e=this._params)||void 0===e?void 0:e.params)&&void 0!==t?t:{};return{id:this.id,component:this.component,params:Object.keys(i).length>0?i:void 0}}dispose(){var e;this.api.dispose(),null===(e=this.part)||void 0===e||e.dispose(),super.dispose()}}class Te extends Ie{set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){return this.headerSize+(this.isExpanded()?this._minimumBodySize:0)}get maximumSize(){return this.headerSize+(this.isExpanded()?this._maximumBodySize:0)}get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get minimumBodySize(){return this._minimumBodySize}set minimumBodySize(e){this._minimumBodySize="number"==typeof e?e:0}get maximumBodySize(){return this._maximumBodySize}set maximumBodySize(e){this._maximumBodySize="number"==typeof e?e:Number.POSITIVE_INFINITY}get headerVisible(){return this._headerVisible}set headerVisible(e){this._headerVisible=e,this.header.style.display=e?"":"none"}constructor(e){super(e.id,e.component,new Pe(e.id,e.component)),this._onDidChangeExpansionState=new d({replay:!0}),this.onDidChangeExpansionState=this._onDidChangeExpansionState.event,this._onDidChange=new d,this.onDidChange=this._onDidChange.event,this._orthogonalSize=0,this._size=0,this._isExpanded=!1,this.api.pane=this,this.api.initialize(this),this.headerSize=e.headerSize,this.headerComponent=e.headerComponent,this._minimumBodySize=e.minimumBodySize,this._maximumBodySize=e.maximumBodySize,this._isExpanded=e.isExpanded,this._headerVisible=e.isHeaderVisible,this._onDidChangeExpansionState.fire(this.isExpanded()),this._orientation=e.orientation,this.element.classList.add("dv-pane"),this.addDisposables(this.api.onWillVisibilityChange(e=>{const{isVisible:t}=e,{accessor:i}=this._params;i.setVisible(this,t)}),this.api.onDidSizeChange(e=>{this._onDidChange.fire({size:e.size})}),p(this.element,"mouseenter",e=>{this.api._onMouseEnter.fire(e)}),p(this.element,"mouseleave",e=>{this.api._onMouseLeave.fire(e)})),this.addDisposables(this._onDidChangeExpansionState,this.onDidChangeExpansionState(e=>{this.api._onDidExpansionChange.fire({isExpanded:e})}),this.api.onDidFocusChange(e=>{this.header&&(e.isFocused?b(this.header,"focused"):f(this.header,"focused"))})),this.renderOnce()}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}isExpanded(){return this._isExpanded}setExpanded(e){this._isExpanded!==e&&(this._isExpanded=e,e?(this.animationTimer&&clearTimeout(this.animationTimer),this.body&&this.element.appendChild(this.body)):this.animationTimer=setTimeout(()=>{var e;null===(e=this.body)||void 0===e||e.remove()},200),this._onDidChange.fire(e?{size:this.width}:{}),this._onDidChangeExpansionState.fire(e))}layout(e,t){this._size=e,this._orthogonalSize=t;const[i,s]=this.orientation===exports.Orientation.HORIZONTAL?[e,t]:[t,e];super.layout(i,s)}init(e){var t,i;super.init(e),"number"==typeof e.minimumBodySize&&(this.minimumBodySize=e.minimumBodySize),"number"==typeof e.maximumBodySize&&(this.maximumBodySize=e.maximumBodySize),this.bodyPart=this.getBodyComponent(),this.headerPart=this.getHeaderComponent(),this.bodyPart.init(Object.assign(Object.assign({},e),{api:this.api})),this.headerPart.init(Object.assign(Object.assign({},e),{api:this.api})),null===(t=this.body)||void 0===t||t.append(this.bodyPart.element),null===(i=this.header)||void 0===i||i.append(this.headerPart.element),"boolean"==typeof e.isExpanded&&this.setExpanded(e.isExpanded)}toJSON(){const e=this._params;return Object.assign(Object.assign({},super.toJSON()),{headerComponent:this.headerComponent,title:e.title})}renderOnce(){this.header=document.createElement("div"),this.header.tabIndex=0,this.header.className="dv-pane-header",this.header.style.height=`${this.headerSize}px`,this.header.style.lineHeight=`${this.headerSize}px`,this.header.style.minHeight=`${this.headerSize}px`,this.header.style.maxHeight=`${this.headerSize}px`,this.element.appendChild(this.header),this.body=document.createElement("div"),this.body.className="dv-pane-body",this.element.appendChild(this.body)}getComponent(){return{update:e=>{var t,i;null===(t=this.bodyPart)||void 0===t||t.update({params:e}),null===(i=this.headerPart)||void 0===i||i.update({params:e})},dispose:()=>{var e,t;null===(e=this.bodyPart)||void 0===e||e.dispose(),null===(t=this.headerPart)||void 0===t||t.dispose()}}}}class Ee extends Te{constructor(e){super({id:e.id,component:e.component,headerComponent:e.headerComponent,orientation:e.orientation,isExpanded:e.isExpanded,isHeaderVisible:!0,headerSize:e.headerSize,minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize}),this._onDidDrop=new d,this.onDidDrop=this._onDidDrop.event,this._onUnhandledDragOverEvent=new d,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this.accessor=e.accessor,this.addDisposables(this._onDidDrop,this._onUnhandledDragOverEvent),e.disableDnd||this.initDragFeatures()}initDragFeatures(){if(!this.header)return;const e=this.id,t=this.accessor.id;this.header.draggable=!0,this.handler=new class extends ge{getData(){return s.getInstance().setData([new i(t,e)],i.prototype),{dispose:()=>{s.getInstance().clearData(i.prototype)}}}}(this.header),this.target=new xe(this.element,{acceptedTargetZones:["top","bottom"],overlayModel:{activationSize:{type:"percentage",value:50}},canDisplayOverlay:(e,t)=>{const i=n();if(i&&i.paneId!==this.id&&i.viewId===this.accessor.id)return!0;const s=new Se(e,t,n,this);return this._onUnhandledDragOverEvent.fire(s),s.isAccepted}}),this.addDisposables(this._onDidDrop,this.handler,this.target,this.target.onDrop(e=>{this.onDrop(e)}))}onDrop(e){const t=n();if(!t||t.viewId!==this.accessor.id)return void this._onDidDrop.fire(Object.assign(Object.assign({},e),{panel:this,api:new ce(this.accessor),getData:n}));const i=this._params.containerApi,s=t.paneId,o=i.getPanel(s);if(!o)return void this._onDidDrop.fire(Object.assign(Object.assign({},e),{panel:this,getData:n,api:new ce(this.accessor)}));const r=i.panels,a=r.indexOf(o);let h=i.panels.indexOf(this);"left"!==e.position&&"top"!==e.position||(h=Math.max(0,h-1)),"right"!==e.position&&"bottom"!==e.position||(a>h&&h++,h=Math.min(r.length-1,h)),i.movePanel(a,h)}}class Oe extends m{get element(){return this._element}constructor(e,t){super(),this.accessor=e,this.group=t,this.disposable=new v,this._onDidFocus=new d,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new d,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="dv-content-container",this._element.tabIndex=-1,this.addDisposables(this._onDidFocus,this._onDidBlur);const i=t.dropTargetContainer;this.dropTarget=new xe(this.element,{getOverlayOutline:()=>{var t;return"group"===(null===(t=e.options.theme)||void 0===t?void 0:t.dndPanelOverlay)?this.element.parentElement:null},className:"dv-drop-target-content",acceptedTargetZones:["top","bottom","left","right","center"],canDisplayOverlay:(e,t)=>{if("no-drop-target"===this.group.locked||this.group.locked&&"center"===t)return!1;const i=o();return!(!i&&e.shiftKey&&"floating"!==this.group.location.type)&&(!(!i||i.viewId!==this.accessor.id)||this.group.canDisplayOverlay(e,t,"content"))},getOverrideTarget:i?()=>i.model:void 0}),this.addDisposables(this.dropTarget)}show(){this.element.style.display=""}hide(){this.element.style.display="none"}renderPanel(e,t={asActive:!0}){var i,s,o,n;const r=t.asActive||this.panel&&this.group.isPanelActive(this.panel);let a;switch(this.panel&&this.panel.view.content.element.parentElement===this._element&&(this._element.removeChild(this.panel.view.content.element),null===(s=(i=this.panel.view.content).onHide)||void 0===s||s.call(i)),this.panel=e,e.api.renderer){case"onlyWhenVisible":this.group.renderContainer.detatch(e),this.panel&&r&&(this._element.appendChild(this.panel.view.content.element),null===(n=(o=this.panel.view.content).onShow)||void 0===n||n.call(o)),a=this._element;break;case"always":e.view.content.element.parentElement===this._element&&this._element.removeChild(e.view.content.element),a=this.group.renderContainer.attach({panel:e,referenceContainer:this});break;default:throw new Error(`dockview: invalid renderer type '${e.api.renderer}'`)}if(r){const e=C(a);this.focusTracker=e;const t=new m;t.addDisposables(e,e.onDidFocus(()=>this._onDidFocus.fire()),e.onDidBlur(()=>this._onDidBlur.fire())),this.disposable.value=t}}openPanel(e){this.panel!==e&&this.renderPanel(e)}layout(e,t){}closePanel(){var e,t,i;this.panel&&"onlyWhenVisible"===this.panel.api.renderer&&(null===(e=this.panel.view.content.element.parentElement)||void 0===e||e.removeChild(this.panel.view.content.element),null===(i=(t=this.panel.view.content).onHide)||void 0===i||i.call(t)),this.panel=void 0}dispose(){this.disposable.dispose(),super.dispose()}refreshFocusState(){var e;(null===(e=this.focusTracker)||void 0===e?void 0:e.refreshState)&&this.focusTracker.refreshState()}}function Ve(e,t,i){var s,o;b(t,"dv-dragged"),t.style.top="-9999px",document.body.appendChild(t),e.setDragImage(t,null!==(s=null==i?void 0:i.x)&&void 0!==s?s:0,null!==(o=null==i?void 0:i.y)&&void 0!==o?o:0),setTimeout(()=>{f(t,"dv-dragged"),t.remove()},0)}class ke extends ge{constructor(e,t,i,o,n){super(e,n),this.accessor=t,this.group=i,this.panel=o,this.panelTransfer=s.getInstance()}getData(e){return this.panelTransfer.setData([new t(this.accessor.id,this.group.id,this.panel.id)],t.prototype),{dispose:()=>{this.panelTransfer.clearData(t.prototype)}}}}class Me extends m{get element(){return this._element}constructor(e,t,i){super(),this.panel=e,this.accessor=t,this.group=i,this.content=void 0,this._direction="horizontal",this._onPointDown=new d,this.onPointerDown=this._onPointDown.event,this._onTabClick=new d,this.onTabClick=this._onTabClick.event,this._onDropped=new d,this.onDrop=this._onDropped.event,this._onDragStart=new d,this.onDragStart=this._onDragStart.event,this._onDragEnd=new d,this.onDragEnd=this._onDragEnd.event,this._element=document.createElement("div"),this._element.className="dv-tab",this._element.tabIndex=0,this._element.draggable=!this.accessor.options.disableDnd,w(this.element,"dv-inactive-tab",!0),this.dragHandler=new ke(this._element,this.accessor,this.group,this.panel,!!this.accessor.options.disableDnd),this.dropTarget=new xe(this._element,{acceptedTargetZones:["left","right"],overlayModel:this._buildOverlayModel(),canDisplayOverlay:(e,t)=>{var i;if(this.group.locked)return!1;const s=o();return s&&this.accessor.id===s.viewId?"smooth"!==(null===(i=this.accessor.options.theme)||void 0===i?void 0:i.tabAnimation):this.group.model.canDisplayOverlay(e,t,"tab")},getOverrideTarget:()=>{var e;return null===(e=i.model.dropTargetContainer)||void 0===e?void 0:e.model}}),this.onWillShowOverlay=this.dropTarget.onWillShowOverlay,this.addDisposables(this._onPointDown,this._onTabClick,this._onDropped,this._onDragStart,this._onDragEnd,this.accessor.onDidOptionsChange(()=>{this.dropTarget.setOverlayModel(this._buildOverlayModel())}),this.dragHandler.onDragStart(e=>{var t;if(e.dataTransfer){const t=getComputedStyle(this.element),i=this.element.cloneNode(!0),s="vertical"===this._direction,o=new Set(["writing-mode","inline-size","block-size","min-inline-size","min-block-size","max-inline-size","max-block-size","margin-inline","margin-inline-start","margin-inline-end","margin-block","margin-block-start","margin-block-end","padding-inline","padding-inline-start","padding-inline-end","padding-block","padding-block-start","padding-block-end"]);Array.from(t).forEach(e=>{s&&o.has(e)||i.style.setProperty(e,t.getPropertyValue(e),t.getPropertyPriority(e))}),s&&(i.style.setProperty("writing-mode","horizontal-tb"),i.style.setProperty("width",t.height),i.style.setProperty("height",t.width)),i.style.position="absolute",i.classList.add("dv-tab-ghost-drag"),Ve(e.dataTransfer,i,{y:-10,x:30})}this._onDragStart.fire(e),"smooth"===(null===(t=this.accessor.options.theme)||void 0===t?void 0:t.tabAnimation)&&requestAnimationFrame(()=>{w(this.element,"dv-tab--dragging",!0)})}),p(this._element,"dragend",e=>{w(this.element,"dv-tab--dragging",!1),this._onDragEnd.fire(e)}),this.dragHandler,p(this._element,"pointerdown",e=>{this._onPointDown.fire(e)}),p(this._element,"click",e=>{this._onTabClick.fire(e)}),p(this._element,"contextmenu",e=>{this.accessor.contextMenuController.show(this.panel,this.group,e)}),this.dropTarget.onDrop(e=>{this._onDropped.fire(e)}),this.dropTarget)}setActive(e){w(this.element,"dv-active-tab",e),w(this.element,"dv-inactive-tab",!e)}setContent(e){this.content&&this._element.removeChild(this.content.element),this.content=e,this._element.appendChild(this.content.element)}_buildOverlayModel(){var e;const t="line"===(null===(e=this.accessor.options.theme)||void 0===e?void 0:e.dndTabIndicator)?Number.POSITIVE_INFINITY:0;return{activationSize:{value:50,type:"percentage"},smallWidthBoundary:t,smallHeightBoundary:t}}setDirection(e){this._direction=e,this.dropTarget.setTargetZones("vertical"===e?["top","bottom"]:["left","right"])}updateDragAndDropState(){this._element.draggable=!this.accessor.options.disableDnd,this.dragHandler.setDisabled(!!this.accessor.options.disableDnd)}}class Le{get kind(){return this.options.kind}get nativeEvent(){return this.event.nativeEvent}get position(){return this.event.position}get defaultPrevented(){return this.event.defaultPrevented}get panel(){return this.options.panel}get api(){return this.options.api}get group(){return this.options.group}preventDefault(){this.event.preventDefault()}getData(){return this.options.getData()}constructor(e,t){this.event=e,this.options=t}}class Ne extends ge{constructor(e,t,i,o){super(e,o),this.accessor=t,this.group=i,this.panelTransfer=s.getInstance(),this.addDisposables(p(e,"pointerdown",e=>{e.shiftKey&&(e[y]=!0)},!0))}isCancelled(e){return"floating"===this.group.api.location.type&&!e.shiftKey}getData(e){const i=e.dataTransfer;this.panelTransfer.setData([new t(this.accessor.id,this.group.id,null)],t.prototype);const s=window.getComputedStyle(this.el),o=s.getPropertyValue("--dv-activegroup-visiblepanel-tab-background-color"),n=s.getPropertyValue("--dv-activegroup-visiblepanel-tab-color");if(i){const e=document.createElement("div");e.style.backgroundColor=o,e.style.color=n,e.style.padding="2px 8px",e.style.height="24px",e.style.fontSize="11px",e.style.lineHeight="20px",e.style.borderRadius="12px",e.style.position="absolute",e.style.pointerEvents="none",e.style.top="-9999px",e.textContent=`Multiple Panels (${this.group.size})`,Ve(i,e,{y:-10,x:30})}return{dispose:()=>{this.panelTransfer.clearData(t.prototype)}}}}class Re extends m{get element(){return this._element}constructor(e,t){super(),this.accessor=e,this.group=t,this._onDrop=new d,this.onDrop=this._onDrop.event,this._onDragStart=new d,this.onDragStart=this._onDragStart.event,this._element=document.createElement("div"),this._element.className="dv-void-container",this._element.draggable=!this.accessor.options.disableDnd,w(this._element,"dv-draggable",!this.accessor.options.disableDnd),this.addDisposables(this._onDrop,this._onDragStart,p(this._element,"pointerdown",()=>{this.accessor.doSetGroupActive(this.group)})),this.handler=new Ne(this._element,e,t,!!this.accessor.options.disableDnd),this.dropTarget=new xe(this._element,{acceptedTargetZones:["center"],canDisplayOverlay:(e,i)=>{const s=o();return!(!s||this.accessor.id!==s.viewId)||t.model.canDisplayOverlay(e,i,"header_space")},getOverrideTarget:()=>{var e;return null===(e=t.model.dropTargetContainer)||void 0===e?void 0:e.model}}),this.onWillShowOverlay=this.dropTarget.onWillShowOverlay,this.addDisposables(this.handler,this.handler.onDragStart(e=>{this._onDragStart.fire(e)}),this.dropTarget.onDrop(e=>{this._onDrop.fire(e)}),this.dropTarget)}updateDragAndDropState(){this._element.draggable=!this.accessor.options.disableDnd,w(this._element,"dv-draggable",!this.accessor.options.disableDnd),this.handler.setDisabled(!!this.accessor.options.disableDnd)}}class We extends m{get element(){return this._element}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._scrollOffset=0,this._orientation=e,f(this._scrollbar,"dv-scrollbar-vertical","dv-scrollbar-horizontal"),b(this._scrollbar,"vertical"===e?"dv-scrollbar-vertical":"dv-scrollbar-horizontal"))}constructor(e){super(),this.scrollableElement=e,this._scrollOffset=0,this._orientation="horizontal",this._element=document.createElement("div"),this._element.className="dv-scrollable",this._scrollbar=document.createElement("div"),this._scrollbar.className="dv-scrollbar dv-scrollbar-horizontal",this.element.appendChild(e),this.element.appendChild(this._scrollbar),this.addDisposables(p(this.element,"wheel",e=>{this._scrollOffset+=e.deltaY*We.MouseWheelSpeed,this.calculateScrollbarStyles()}),p(this._scrollbar,"pointerdown",e=>{e.preventDefault(),w(this.element,"dv-scrollable-scrolling",!0);const t="horizontal"===this._orientation?e.clientX:e.clientY,i=this._scrollOffset,s=e=>{const s="horizontal"===this._orientation?e.clientX-t:e.clientY-t,o=("horizontal"===this._orientation?this.element.clientWidth:this.element.clientHeight)/("horizontal"===this._orientation?this.scrollableElement.scrollWidth:this.scrollableElement.scrollHeight);this._scrollOffset=i+s/o,this.calculateScrollbarStyles()},o=()=>{w(this.element,"dv-scrollable-scrolling",!1),document.removeEventListener("pointermove",s),document.removeEventListener("pointerup",o),document.removeEventListener("pointercancel",o)};document.addEventListener("pointermove",s),document.addEventListener("pointerup",o),document.addEventListener("pointercancel",o)}),p(this.element,"scroll",()=>{this.calculateScrollbarStyles()}),p(this.scrollableElement,"scroll",()=>{this._scrollOffset="horizontal"===this._orientation?this.scrollableElement.scrollLeft:this.scrollableElement.scrollTop,this.calculateScrollbarStyles()}),_(this.element,()=>{w(this.element,"dv-scrollable-resizing",!0),this._animationTimer&&clearTimeout(this._animationTimer),this._animationTimer=setTimeout(()=>{clearTimeout(this._animationTimer),w(this.element,"dv-scrollable-resizing",!1)},500),this.calculateScrollbarStyles()}))}calculateScrollbarStyles(){const e="horizontal"===this._orientation?this.element.clientWidth:this.element.clientHeight,t="horizontal"===this._orientation?this.scrollableElement.scrollWidth:this.scrollableElement.scrollHeight;if(t>e){const i=e*(e/t);"horizontal"===this._orientation?(this._scrollbar.style.width=`${i}px`,this._scrollbar.style.height=""):(this._scrollbar.style.height=`${i}px`,this._scrollbar.style.width=""),this._scrollOffset=M(this._scrollOffset,0,t-e),"horizontal"===this._orientation?this.scrollableElement.scrollLeft=this._scrollOffset:this.scrollableElement.scrollTop=this._scrollOffset;const s=this._scrollOffset/(t-e);"horizontal"===this._orientation?(this._scrollbar.style.left=(e-i)*s+"px",this._scrollbar.style.top=""):(this._scrollbar.style.top=(e-i)*s+"px",this._scrollbar.style.left="")}else"horizontal"===this._orientation?(this._scrollbar.style.width="0px",this._scrollbar.style.left="0px"):(this._scrollbar.style.height="0px",this._scrollbar.style.top="0px"),this._scrollOffset=0}}We.MouseWheelSpeed=1;const He=[{id:"grey",value:"var(--dv-tab-group-color-grey)",label:"Grey"},{id:"blue",value:"var(--dv-tab-group-color-blue)",label:"Blue"},{id:"red",value:"var(--dv-tab-group-color-red)",label:"Red"},{id:"yellow",value:"var(--dv-tab-group-color-yellow)",label:"Yellow"},{id:"green",value:"var(--dv-tab-group-color-green)",label:"Green"},{id:"pink",value:"var(--dv-tab-group-color-pink)",label:"Pink"},{id:"purple",value:"var(--dv-tab-group-color-purple)",label:"Purple"},{id:"cyan",value:"var(--dv-tab-group-color-cyan)",label:"Cyan"},{id:"orange",value:"var(--dv-tab-group-color-orange)",label:"Orange"}];class Fe{constructor(e,t=!0){this._entries=e.slice(),this._byId=new Map(e.map(e=>[e.id,e])),this._enabled=t}get enabled(){return this._enabled}set enabled(e){this._enabled=e}setEntries(e){this._entries=e.slice(),this._byId=new Map(e.map(e=>[e.id,e]))}entries(){return this._entries}has(e){return this._byId.has(e)}get(e){return this._byId.get(e)}defaultId(){var e;return null===(e=this._entries[0])||void 0===e?void 0:e.id}resolveValue(e){if(!this._enabled||!e)return;const t=this._byId.get(e);return t?t.value:e}}let Be;function $e(){return Be||(Be=new Fe(He,!0)),Be}function Ue(e,t,i){const s=(null!=i?i:$e()).resolveValue(t);void 0===s?e.style.removeProperty("--dv-tab-group-color"):e.style.setProperty("--dv-tab-group-color",s)}function Je(e,t){return(null!=t?t:$e()).resolveValue(e)}class je extends m{get element(){return this._element}constructor(e){super(),this._palette=e,this._onClick=new d,this.onClick=this._onClick.event,this._onContextMenu=new d,this.onContextMenu=this._onContextMenu.event,this._onDragStart=new d,this.onDragStart=this._onDragStart.event,this._element=document.createElement("div"),this._element.className="dv-tab-group-chip",this._element.tabIndex=0,this._element.draggable=!0,this._label=document.createElement("span"),this._label.className="dv-tab-group-chip-label",this._element.appendChild(this._label),this.addDisposables(this._onClick,this._onContextMenu,this._onDragStart,p(this._element,"click",e=>{this._onClick.fire(e)}),p(this._element,"contextmenu",e=>{this._onContextMenu.fire(e)}),p(this._element,"dragstart",e=>{this._onDragStart.fire(e)}))}init(e){this._tabGroup=e.tabGroup,this.updateColor(e.tabGroup.color),this.updateLabel(e.tabGroup.label),this.updateCollapsed(e.tabGroup.collapsed),this.addDisposables(e.tabGroup.onDidChange(()=>{this._tabGroup&&(this.updateColor(this._tabGroup.color),this.updateLabel(this._tabGroup.label))}),e.tabGroup.onDidCollapseChange(e=>{this.updateCollapsed(e)}),this._onClick.event(()=>{var e;null===(e=this._tabGroup)||void 0===e||e.toggle()}))}update(e){this._tabGroup=e.tabGroup,this.updateColor(e.tabGroup.color),this.updateLabel(e.tabGroup.label),this.updateCollapsed(e.tabGroup.collapsed)}updateColor(e){var t;Ue(this._element,e,this._palette),w(this._element,"dv-tab-group-chip--accent-off",!1===(null===(t=this._palette)||void 0===t?void 0:t.enabled))}updateLabel(e){this._label.textContent=e,w(this._label,"dv-tab-group-chip-label--empty",!e)}updateCollapsed(e){w(this._element,"dv-tab-group-chip--collapsed",e)}}class Ze{get underlines(){return this._underlines}constructor(e){this._ctx=e,this._underlines=new Map,this._rafId=null}positionUnderlines(){requestAnimationFrame(()=>{this._positionUnderlinesSync()})}trackUnderlines(){null!==this._rafId&&cancelAnimationFrame(this._rafId);const e=performance.now(),t=()=>{this._positionUnderlinesSync(),performance.now()-e<250?this._rafId=requestAnimationFrame(t):this._rafId=null};this._rafId=requestAnimationFrame(t)}syncUnderlineElements(e){for(const t of e)if(!this._underlines.has(t)){const e=document.createElement("div");e.className="dv-tab-group-underline",this._ctx.tabsList.appendChild(e),this._underlines.set(t,e)}for(const[t,i]of this._underlines)e.has(t)||(i.remove(),this._underlines.delete(t))}getUnderline(e){return this._underlines.get(e)}dispose(){null!==this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=null);for(const[,e]of this._underlines)e.remove();this._underlines.clear()}_positionUnderlinesSync(){const e=this._ctx.tabsList.getBoundingClientRect(),t=this._ctx.getTabGroups(),i="vertical"===this._ctx.getDirection(),s=i?e.width:e.height,o=this._ctx.getActivePanelId(),n=this._ctx.getTabMap();for(const r of t){const t=this._underlines.get(r.id);if(!t)continue;const a=r.panelIds;if(0===a.length){t.style.display="none";continue}t.style.display="";const h=this._ctx.getChipElement(r.id);let l;if(h){const t=h.getBoundingClientRect(),s=getComputedStyle(h),o=i?Number.parseFloat(s.marginTop)||0:Number.parseFloat(s.marginLeft)||0;l=i?t.top-e.top-o:t.left-e.left-o}else{const t=a[0],s=n.get(t);if(s){const t=s.value.element.getBoundingClientRect();l=i?t.top-e.top:t.left-e.left}else l=0}const d=a[a.length-1],p=n.get(d);if(!p){i?(t.style.top=`${l}px`,t.style.height="0px",t.style.left="",t.style.width=""):(t.style.left=`${l}px`,t.style.width="0px",t.style.top="",t.style.height="");continue}const u=p.value.element.getBoundingClientRect();let c=i?u.bottom-e.top:u.right-e.left,m=c-l;if((r.collapsed||r.panelIds.some(e=>{const t=n.get(e);return t&&t.value.element.classList.contains("dv-tab--group-expanding")}))&&h){const t=h.getBoundingClientRect(),s=i?t.top+t.height/2-e.top:t.left+t.width/2-e.left;let o=0,a=0;for(const e of r.panelIds){const t=n.get(e);if(!t)continue;const s=t.value.element;i?(o+=s.getBoundingClientRect().height,a+=s.scrollHeight):(o+=s.getBoundingClientRect().width,a+=s.scrollWidth)}const d=a>0?Math.min(1,o/a):0;l=s+(l-s)*d,c=s+(c-s)*d,m=Math.max(0,c-l)}i?(t.style.top=`${l}px`,t.style.height=`${Math.max(0,m)}px`,t.style.left="",t.style.width=""):(t.style.left=`${l}px`,t.style.width=`${Math.max(0,m)}px`,t.style.top="",t.style.height=""),this.applyShape(t,r,l,m,s,o,e,i)}}}class Ye extends Ze{_applyStraightLine(e,t,i,s,o,n){n?(e.setAttribute("width",String(s)),e.setAttribute("height",String(o)),i.style.width=`${s}px`,i.style.height=`${o}px`,t.setAttribute("d",`M ${s/2},0 L ${s/2},${o}`)):(e.setAttribute("width",String(o)),e.setAttribute("height",String(s)),i.style.width=`${o}px`,i.style.height=`${s}px`,t.setAttribute("d",`M 0,${s/2} L ${o},${s/2}`))}applyShape(e,t,i,s,o,n,r,a){const h=o,l=s,d=Je(t.color,this._ctx.getColorPalette());if(l<=0||h<=0||void 0===d)return void(e.style.display="none");let p;e.style.display="",n&&t.panelIds.includes(n)&&(p=this._ctx.getTabMap().get(n));let u,c=e.firstElementChild;if(c&&"svg"===c.tagName?u=c.firstElementChild:(e.innerHTML="",c=document.createElementNS("http://www.w3.org/2000/svg","svg"),c.style.display="block",u=document.createElementNS("http://www.w3.org/2000/svg","path"),u.setAttribute("fill","none"),c.appendChild(u),e.appendChild(c)),u.setAttribute("stroke",d),u.setAttribute("stroke-width",String(2)),!p)return void this._applyStraightLine(c,u,e,2,l,a);const m=p.value.element.getBoundingClientRect();let v,g;if(a?(v=Math.max(0,m.top-r.top-i),g=Math.min(l,m.bottom-r.top-i)):(v=Math.max(0,m.left-r.left-i),g=Math.min(l,m.right-r.left-i)),g<=v)return void this._applyStraightLine(c,u,e,2,l,a);if(a){const t=h,i=l;c.setAttribute("width",String(t)),c.setAttribute("height",String(i)),e.style.width=`${t}px`,e.style.height=`${i}px`;const s=1,o=t-1,n=[`M ${s},0`,`L ${s},${v-6}`,`Q ${s},${v} ${s+6},${v}`,`L ${o-6},${v}`,`Q ${o},${v} ${o},${v+6}`,`L ${o},${g-6}`,`Q ${o},${g} ${o-6},${g}`,`L ${s+6},${g}`,`Q ${s},${g} ${s},${g+6}`,`L ${s},${i}`].join(" ");u.setAttribute("d",n)}else{const t=l,i=h;c.setAttribute("width",String(t)),c.setAttribute("height",String(i)),e.style.width=`${t}px`,e.style.height=`${i}px`;const s=i-1,o=1,n=[`M 0,${s}`,`L ${v-6},${s}`,`Q ${v},${s} ${v},${s-6}`,`L ${v},${o+6}`,`Q ${v},${o} ${v+6},${o}`,`L ${g-6},${o}`,`Q ${g},${o} ${g},${o+6}`,`L ${g},${s-6}`,`Q ${g},${s} ${g+6},${s}`,`L ${t},${s}`].join(" ");u.setAttribute("d",n)}}}class Xe extends Ze{applyShape(e,t,i,s,o,n,r,a){const h=Je(t.color,this._ctx.getColorPalette());s<=0||void 0===h?e.style.display="none":(e.style.display="",e.firstElementChild&&(e.innerHTML=""),e.style.backgroundColor=h,a?(e.style.width="2px",e.style.height=`${s}px`):(e.style.width=`${s}px`,e.style.height="2px"))}}const qe=new Map;class Ke{get chipRenderers(){return this._chipRenderers}get groupUnderlines(){var e,t;return null!==(t=null===(e=this._indicator)||void 0===e?void 0:e.underlines)&&void 0!==t?t:qe}get skipNextCollapseAnimation(){return this._skipNextCollapseAnimation}set skipNextCollapseAnimation(e){this._skipNextCollapseAnimation=e}constructor(e,t){this._ctx=e,this._callbacks=t,this._chipRenderers=new Map,this._indicator=null,this._skipNextCollapseAnimation=!1,this._pendingTransitionCleanups=new Map}update(){const e=this._ctx.group.model.getTabGroups(),t=new Set;for(const i of e)t.add(i.id),this._ensureChipForGroup(i),this._positionChipForGroup(i);for(const[e,i]of this._chipRenderers)t.has(e)||(i.chip.element.remove(),i.chip.dispose(),i.disposable.dispose(),this._chipRenderers.delete(e));this._updateTabGroupClasses()}refreshAccents(){var e,t;for(const i of this._ctx.group.model.getTabGroups()){const s=this._chipRenderers.get(i.id);null===(t=null==s?void 0:(e=s.chip).update)||void 0===t||t.call(e,{tabGroup:i})}this._updateTabGroupClasses()}positionAllChips(){if(0!==this._chipRenderers.size)for(const e of this._ctx.group.model.getTabGroups())this._positionChipForGroup(e)}snapshotChipWidths(){const e=new Map;for(const[t,i]of this._chipRenderers)e.set(t,i.chip.element.getBoundingClientRect().width);return e}positionUnderlines(){var e;null===(e=this._indicator)||void 0===e||e.positionUnderlines()}trackUnderlines(){var e;null===(e=this._indicator)||void 0===e||e.trackUnderlines()}setGroupDragImage(e,t,i){if(!e.dataTransfer)return;const s="vertical"===this._ctx.getDirection(),o=this._ctx.tabsList.cloneNode(!0);s?(o.classList.remove("dv-tabs-container-vertical","dv-vertical"),o.classList.add("dv-horizontal"),o.style.writingMode="horizontal-tb",o.style.height=`${this._ctx.tabsList.offsetWidth}px`):o.style.height=`${this._ctx.tabsList.offsetHeight}px`,o.style.width="auto",o.style.overflow="visible",o.style.pointerEvents="none";const n=Array.from(o.children),r=Array.from(this._ctx.tabsList.children);for(let e=n.length-1;e>=0;e--){r[e]!==i&&n[e].remove()}const a=document.createElement("div");a.className="dv-groupview dv-active-group",a.style.position="fixed",a.style.top="-10000px",a.style.left="0px",a.style.height="auto",a.style.width="auto",a.style.pointerEvents="none";const h=document.createElement("div");h.className="dv-tabs-and-actions-container",h.style.height="auto",h.style.width="auto",a.appendChild(h),h.appendChild(o),this._ctx.accessor.element.appendChild(a);const l=o.querySelector(".dv-tab-group-chip"),d=i.getBoundingClientRect(),p=e.clientX-d.left,u=e.clientY-d.top;if(l){const t=l.getBoundingClientRect(),i=a.getBoundingClientRect(),s=t.left-i.left+p,o=t.top-i.top+u;e.dataTransfer.setDragImage(a,s,o)}else e.dataTransfer.setDragImage(a,p,u);requestAnimationFrame(()=>{a.remove()})}cleanupTransition(e){var t;null===(t=this._pendingTransitionCleanups.get(e))||void 0===t||t(),this._pendingTransitionCleanups.delete(e)}disposeAll(){var e;null===(e=this._indicator)||void 0===e||e.dispose(),this._indicator=null;for(const[,e]of this._pendingTransitionCleanups)e();this._pendingTransitionCleanups.clear();for(const[,e]of this._chipRenderers)e.chip.element.remove(),e.chip.dispose(),e.disposable.dispose();this._chipRenderers.clear()}_ensureIndicator(){var e,t;const i="none"===(null!==(t=null===(e=this._ctx.accessor.options.theme)||void 0===e?void 0:e.tabGroupIndicator)&&void 0!==t?t:"wrap")?Xe:Ye;!this._indicator||this._indicator instanceof i||(this._indicator.dispose(),this._indicator=null),this._indicator||(this._indicator=new i({tabsList:this._ctx.tabsList,getTabGroups:()=>this._ctx.group.model.getTabGroups(),getActivePanelId:()=>{var e;return null===(e=this._ctx.group.activePanel)||void 0===e?void 0:e.id},getTabMap:()=>this._ctx.getTabMap(),getChipElement:e=>{var t;return null===(t=this._chipRenderers.get(e))||void 0===t?void 0:t.chip.element},getDirection:()=>this._ctx.getDirection(),getColorPalette:()=>this._ctx.accessor.tabGroupColorPalette}))}_ensureChipForGroup(e){if(this._chipRenderers.has(e.id))return;const t=this._ctx.accessor.options.createTabGroupChipComponent,i=t?t(e):new je(this._ctx.accessor.tabGroupColorPalette);i.init({tabGroup:e,api:this._ctx.accessor.api});const s=[e.onDidChange(()=>{var t;null===(t=i.update)||void 0===t||t.call(i,{tabGroup:e}),this._updateTabGroupClasses()}),e.onDidPanelChange(()=>{this._positionChipForGroup(e),this._updateTabGroupClasses()}),e.onDidCollapseChange(()=>{this._updateTabGroupClasses()})];i instanceof je?s.push(i.onContextMenu(t=>{this._callbacks.onChipContextMenu(e,t)}),i.onDragStart(t=>{this._callbacks.onChipDragStart(e,i,t)})):s.push(p(i.element,"contextmenu",t=>{this._callbacks.onChipContextMenu(e,t)}),p(i.element,"dragstart",t=>{this._callbacks.onChipDragStart(e,i,t)}));const o=new m(...s);this._chipRenderers.set(e.id,{chip:i,disposable:o}),e.collapsed&&(this._skipNextCollapseAnimation=!0)}_positionChipForGroup(e){const t=this._chipRenderers.get(e.id);if(!t)return;const i=t.chip.element,s=e.panelIds;if(0===s.length)return void i.remove();const o=s[0],n=this._ctx.getTabMap().get(o);if(!n)return void i.remove();const r=n.value.element;i.nextSibling!==r&&this._ctx.tabsList.insertBefore(i,r)}_updateTabGroupClasses(){var e;const t=this._ctx.group.model.getTabGroups(),i=this._ctx.getTabs(),s=this._ctx.getTabMap();let o=!1;const n=new Map;for(const e of t)for(const t of e.panelIds)n.set(t,e);for(const t of i){const i=t.value,s=i.panel.id,r=n.get(s),a=!!r;if(w(i.element,"dv-tab--grouped",a),r){const t=r.panelIds,n=t[0]===s,a=t[t.length-1]===s;w(i.element,"dv-tab--group-first",n),w(i.element,"dv-tab--group-last",a),Ue(i.element,r.color,this._ctx.accessor.tabGroupColorPalette);const h=i.element.classList.contains("dv-tab--group-collapsed");if(!r.collapsed&&h){o=!0,i.element.classList.remove("dv-tab--group-collapsed"),i.element.classList.add("dv-tab--group-expanding"),null===(e=this._pendingTransitionCleanups.get(s))||void 0===e||e();const t=()=>{i.element.classList.remove("dv-tab--group-expanding"),i.element.style.removeProperty("width"),i.element.removeEventListener("transitionend",t),clearTimeout(n),this._pendingTransitionCleanups.delete(s)},n=setTimeout(t,300);this._pendingTransitionCleanups.set(s,t),i.element.addEventListener("transitionend",t)}}else w(i.element,"dv-tab--group-first",!1),w(i.element,"dv-tab--group-last",!1),i.element.classList.remove("dv-tab--group-collapsed","dv-tab--group-expanding"),i.element.style.removeProperty("width"),i.element.style.removeProperty("--dv-tab-group-color")}const r=new Set;for(const e of t){r.add(e.id);if(e.collapsed&&e.panelIds.some(e=>{const t=s.get(e);return t&&!t.value.element.classList.contains("dv-tab--group-collapsed")}))if(this._skipNextCollapseAnimation){const t=[];for(const i of e.panelIds){const e=s.get(i);e&&(e.value.element.style.transition="none",e.value.element.classList.add("dv-tab--group-collapsed"),t.push(e.value.element))}if(t.length>0){t[0].offsetHeight;for(const e of t)e.style.removeProperty("transition")}}else{o=!0;const t="vertical"===this._ctx.getDirection();for(const i of e.panelIds){const e=s.get(i);if(e&&!e.value.element.classList.contains("dv-tab--group-collapsed")){const i=e.value.element.getBoundingClientRect();t?e.value.element.style.height=`${i.height}px`:e.value.element.style.width=`${i.width}px`,e.value.element.offsetHeight,e.value.element.classList.add("dv-tab--group-collapsed")}}}}this._skipNextCollapseAnimation=!1,this._ensureIndicator(),this._indicator&&(this._indicator.syncUnderlineElements(r),o?this._indicator.trackUnderlines():this._indicator.positionUnderlines())}}class Qe extends m{get showTabsOverflowControl(){return this._showTabsOverflowControl}set showTabsOverflowControl(e){if(this._showTabsOverflowControl!=e&&(this._showTabsOverflowControl=e,e)){const e=new g(this._tabsList);this._observerDisposable.value=new m(e,e.onDidChange(e=>{const t=e.hasScrollX||e.hasScrollY;this.toggleDropdown({reset:!t}),this._tabGroupManager.groupUnderlines.size>0&&this._tabGroupManager.positionUnderlines()}),p(this._tabsList,"scroll",()=>{this.toggleDropdown({reset:!1}),this._tabGroupManager.groupUnderlines.size>0&&this._tabGroupManager.positionUnderlines()}))}}get element(){return this._element}set voidContainer(e){var t;null===(t=this._voidContainerListeners)||void 0===t||t.dispose(),this._voidContainerListeners=null,this._voidContainer=e,e&&(this._voidContainerListeners=new m(p(e,"dragover",e=>{this._animState&&e.preventDefault()}),p(e,"drop",e=>{var t;(null===(t=this._animState)||void 0===t?void 0:t.sourceTabGroupId)&&null!==this._animState.currentInsertionIndex&&(e.preventDefault(),e.stopPropagation(),this.handleVoidDrop())})))}handleVoidDrop(){var e,t;if(!(null===(e=this._animState)||void 0===e?void 0:e.sourceTabGroupId))return!1;const i=this._animState.sourceTabGroupId,s=null!==(t=this._animState.currentInsertionIndex)&&void 0!==t?t:this._tabs.length;return this._animState=null,this._commitGroupMove(i,s),!0}get panels(){return this._tabs.map(e=>e.value.panel.id)}get size(){return this._tabs.length}get tabs(){return this._tabs.map(e=>e.value)}get direction(){return this._direction}set direction(e){if(this._direction!==e){this._direction=e,this._scrollbar&&(this._scrollbar.orientation=e),f(this._tabsList,"dv-horizontal","dv-vertical"),"vertical"===e?b(this._tabsList,"dv-tabs-container-vertical","dv-vertical"):(f(this._tabsList,"dv-tabs-container-vertical"),b(this._tabsList,"dv-horizontal"));for(const t of this._tabs)t.value.setDirection(e)}}constructor(e,t,i){super(),this.group=e,this.accessor=t,this._observerDisposable=new v,this._scrollbar=null,this._tabs=[],this._tabMap=new Map,this.selectedIndex=-1,this._showTabsOverflowControl=!1,this._direction="horizontal",this._animState=null,this._pendingMarginCleanups=new Map,this._pendingCollapse=!1,this._flipTransitionCleanup=null,this._voidContainer=null,this._voidContainerListeners=null,this._extendedDropZone=null,this._chipDragCleanup=null,this._onTabDragStart=new d,this.onTabDragStart=this._onTabDragStart.event,this._onDrop=new d,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new d,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onOverflowTabsChange=new d,this.onOverflowTabsChange=this._onOverflowTabsChange.event,this._tabsList=document.createElement("div"),this._tabsList.className="dv-tabs-container",this.showTabsOverflowControl=i.showTabsOverflowControl,"native"===t.options.scrollbars?this._element=this._tabsList:(this._scrollbar=new We(this._tabsList),this._scrollbar.orientation=this.direction,this._element=this._scrollbar.element,this.addDisposables(this._scrollbar)),this._tabGroupManager=new Ke({group:this.group,accessor:this.accessor,tabsList:this._tabsList,getTabs:()=>this._tabs,getTabMap:()=>this._tabMap,getDirection:()=>this._direction},{onChipContextMenu:(e,t)=>{this.accessor.contextMenuController.showForChip(e,this.group,t)},onChipDragStart:(e,t,i)=>{this._handleChipDragStart(e,t,i)}}),this.addDisposables(this._onOverflowTabsChange,this._observerDisposable,this._onWillShowOverlay,this._onDrop,this._onTabDragStart,{dispose:()=>{var e;null===(e=this._flipTransitionCleanup)||void 0===e||e.call(this)}},p(this.element,"pointerdown",e=>{if(e.defaultPrevented)return;0===e.button&&this.accessor.doSetGroupActive(this.group)}),p(this._tabsList,"dragover",e=>{var t,i,s,n;if(!this.accessor.options.disableDnd){if(this._animState){const e=o();(null==e?void 0:e.tabGroupId)&&e.groupId!==this.group.id&&this._animState.sourceTabGroupId!==e.tabGroupId&&(this._animState=null)}if(!this._animState){const e=o();if("default"===(null===(t=this.accessor.options.theme)||void 0===t?void 0:t.tabAnimation)&&!(null==e?void 0:e.tabGroupId))return;if(!e||!e.panelId&&!e.tabGroupId||e.groupId===this.group.id)return;{const t=this.getAverageTabWidth();if(e.tabGroupId){const s=this.accessor.getPanel(e.groupId),o=null==s?void 0:s.model.getTabGroups().find(t=>t.id===e.tabGroupId),n=t*(null!==(i=null==o?void 0:o.panelIds.length)&&void 0!==i?i:1)+t;this._animState={sourceTabId:"",sourceIndex:-1,tabPositions:this.snapshotTabPositions(),chipPositions:this._tabGroupManager.snapshotChipWidths(),currentInsertionIndex:null,targetTabGroupId:null,sourceTabGroupId:e.tabGroupId,sourceGroupPanelIds:o?new Set(o.panelIds):new Set,sourceChipWidth:t,cursorOffsetFromDragLeft:n/2,sourceGapWidth:n,containerLeft:this._tabsList.getBoundingClientRect().left}}else this._animState={sourceTabId:e.panelId,sourceIndex:-1,tabPositions:this.snapshotTabPositions(),chipPositions:this._tabGroupManager.snapshotChipWidths(),currentInsertionIndex:null,targetTabGroupId:null,sourceTabGroupId:null,sourceGroupPanelIds:null,sourceChipWidth:0,cursorOffsetFromDragLeft:t/2,sourceGapWidth:t,containerLeft:this._tabsList.getBoundingClientRect().left}}}e.preventDefault(),-1!==this._animState.sourceIndex&&(null===(n=null===(s=this.group.model.dropTargetContainer)||void 0===s?void 0:s.model)||void 0===n||n.clear()),this.handleDragOver(e)}},!0),p(this._tabsList,"dragleave",e=>{var t,i,s;if(!this._animState)return;const o=e.relatedTarget;if(o&&this._tabsList.contains(o))return;if(o&&(null===(t=this._extendedDropZone)||void 0===t?void 0:t.contains(o)))return this.resetTabTransforms(),void(this._animState.currentInsertionIndex=null);const n=e.relatedTarget;this._voidContainer&&n&&(n===this._voidContainer||this._voidContainer.contains(n))||(this.resetTabTransforms(),this._animState&&(-1===this._animState.sourceIndex?(null===(s=null===(i=this.group.model.dropTargetContainer)||void 0===i?void 0:i.model)||void 0===s||s.clear(),this._animState=null):this._animState.currentInsertionIndex=null))},!0),p(this._tabsList,"dragend",()=>{this.resetDragAnimation()}),p(this._tabsList,"drop",e=>{var t,i,s;if(!this._animState||null===this._animState.currentInsertionIndex)return;if("smooth"!==(null===(t=this.accessor.options.theme)||void 0===t?void 0:t.tabAnimation)&&!this._animState.sourceTabGroupId)return;e.stopPropagation(),e.preventDefault(),null===(s=null===(i=this.group.model.dropTargetContainer)||void 0===i?void 0:i.model)||void 0===s||s.clear();const o=this._animState;if(this._animState=null,this._pendingCollapse=!1,o.sourceTabGroupId)return void this._commitGroupMove(o.sourceTabGroupId,o.currentInsertionIndex);const n=o.currentInsertionIndex,r=o.sourceIndex,a=n-(-1!==r&&r<n?1:0),h=this.group.model.getTabGroupForPanel(o.sourceTabId);if(a===r&&!o.targetTabGroupId&&!h)return this._uncollapsSourceTab(o.sourceTabId),void this.resetTabTransforms();this._uncollapsSourceTab(o.sourceTabId);const l=this.snapshotTabPositions();this.resetTabTransforms(),this._onDrop.fire({event:e,index:a,targetTabGroupId:o.targetTabGroupId}),this.runFlipAnimation(l,o.sourceTabId,-1===o.sourceIndex,{from:Math.min(r,a),to:Math.max(r,a)})},!0),exports.DockviewDisposable.from(()=>{var e;null===(e=this._voidContainerListeners)||void 0===e||e.dispose(),this.resetDragAnimation(),this._tabGroupManager.disposeAll();for(const{value:e,disposable:t}of this._tabs)t.dispose(),e.dispose();this._tabs=[],this._tabMap.clear()}))}indexOf(e){return this._tabs.findIndex(t=>t.value.panel.id===e)}isActive(e){return this.selectedIndex>-1&&this._tabs[this.selectedIndex].value===e}setActivePanel(e){const t="vertical"===this._direction;let i=0;for(const s of this._tabs){const o=e.id===s.value.panel.id;if(s.value.setActive(o),o){const e=s.value.element,o=e.parentElement;t?(i<o.scrollTop||i+e.clientHeight>o.scrollTop+o.clientHeight)&&(o.scrollTop=i):(i<o.scrollLeft||i+e.clientWidth>o.scrollLeft+o.clientWidth)&&(o.scrollLeft=i)}i+=t?s.value.element.clientHeight:s.value.element.clientWidth}this._tabGroupManager.groupUnderlines.size>0&&this._tabGroupManager.positionUnderlines()}openPanel(e,t=this._tabs.length){if(this._tabMap.has(e.id))return;const i=new Me(e,this.accessor,this.group);i.setContent(e.view.tab),"horizontal"!==this._direction&&i.setDirection(this._direction);const s=new m(i.onDragStart(t=>{var s;if(this._onTabDragStart.fire({nativeEvent:t,panel:e}),"smooth"===(null===(s=this.accessor.options.theme)||void 0===s?void 0:s.tabAnimation)){const t=i.element.getBoundingClientRect().width,s=this._tabs.findIndex(e=>e.value===i);this._animState={sourceTabId:e.id,sourceIndex:s,tabPositions:this.snapshotTabPositions(),chipPositions:this._tabGroupManager.snapshotChipWidths(),currentInsertionIndex:null,targetTabGroupId:null,sourceTabGroupId:null,sourceGroupPanelIds:null,sourceChipWidth:0,cursorOffsetFromDragLeft:t/2,sourceGapWidth:t,containerLeft:this._tabsList.getBoundingClientRect().left},this._pendingCollapse=!0,requestAnimationFrame(()=>{var e,t;this._pendingCollapse=!1,this._animState&&(i.element.style.transition="none",w(i.element,"dv-tab--dragging",!0),i.element.offsetHeight,null!==(e=(t=this._animState).currentInsertionIndex)&&void 0!==e||(t.currentInsertionIndex=s),this.applyDragOverTransforms(!0),i.element.style.removeProperty("transition"))})}}),i.onTabClick(t=>{t.defaultPrevented||"edge"===this.group.api.location.type&&(this.group.activePanel===e?this.group.api.isCollapsed()?this.group.api.expand():this.group.api.collapse():(this.group.model.openPanel(e),this.group.api.isCollapsed()&&this.group.api.expand()))}),i.onPointerDown(t=>{if(t.defaultPrevented)return;const s=!this.accessor.options.disableFloatingGroups,o="floating"===this.group.api.location.type&&1===this.size;if(s&&!o&&t.shiftKey){t.preventDefault();const e=this.accessor.getGroupPanel(i.panel.id),{top:s,left:o}=i.element.getBoundingClientRect(),{top:n,left:r}=this.accessor.element.getBoundingClientRect();return void this.accessor.addFloatingGroup(e,{x:o-r,y:s-n,inDragMode:!0})}if(0===t.button)"edge"===this.group.api.location.type||this.group.activePanel!==e&&this.group.model.openPanel(e)}),i.onDrop(e=>{var t,s,n,r;const a=this._animState;this._animState=null,this._pendingCollapse=!1;const h=this._tabs.findIndex(e=>e.value===i);if(a){const i="right"===e.position?h+1:h;if(a.sourceTabGroupId)return void this._commitGroupMove(a.sourceTabGroupId,null!==(t=a.currentInsertionIndex)&&void 0!==t?t:i);this._uncollapsSourceTab(a.sourceTabId);const o=this.snapshotTabPositions();this.resetTabTransforms(),this._onDrop.fire({event:e.nativeEvent,index:i,targetTabGroupId:a.targetTabGroupId}),"smooth"===(null===(s=this.accessor.options.theme)||void 0===s?void 0:s.tabAnimation)&&this.runFlipAnimation(o,a.sourceTabId,-1===a.sourceIndex,-1!==a.sourceIndex?{from:Math.min(a.sourceIndex,i),to:Math.max(a.sourceIndex,i)}:void 0)}else{const t="vertical"===this._direction?"bottom":"right",s=e.position===t?h+1:h,a=o(),l=a?this._tabs.findIndex(e=>e.value.panel.id===a.panelId):-1,d=s-(-1!==l&&l<s?1:0),p=null!==(r=null===(n=this.group.model.getTabGroupForPanel(i.panel.id))||void 0===n?void 0:n.id)&&void 0!==r?r:null;this._onDrop.fire({event:e.nativeEvent,index:d,targetTabGroupId:p})}}),i.onWillShowOverlay(e=>{this._onWillShowOverlay.fire(new Le(e,{kind:"tab",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:o}))})),n={value:i,disposable:s};this.addTab(n,t),this._tabGroupManager.positionAllChips(),this._animState&&(this._animState.tabPositions=this.snapshotTabPositions(),this._animState.chipPositions=this._tabGroupManager.snapshotChipWidths(),this.applyDragOverTransforms())}delete(e){var t;(null===(t=this._animState)||void 0===t?void 0:t.sourceTabId)===e&&(this.resetTabTransforms(),this._animState=null),this._tabGroupManager.cleanupTransition(e);const i=this.indexOf(e),s=this._tabs.splice(i,1)[0];this._tabMap.delete(e);const{value:o,disposable:n}=s;n.dispose(),o.dispose(),o.element.remove(),this._animState&&(this._animState.tabPositions=this.snapshotTabPositions(),this._animState.chipPositions=this._tabGroupManager.snapshotChipWidths(),this.applyDragOverTransforms())}addTab(e,t=this._tabs.length){if(t<0||t>this._tabs.length)throw new Error("invalid location");const i=t<this._tabs.length?this._tabs[t].value.element:null;this._tabsList.insertBefore(e.value.element,i),this._tabs=[...this._tabs.slice(0,t),e,...this._tabs.slice(t)],this._tabMap.set(e.value.panel.id,e),this.selectedIndex<0&&(this.selectedIndex=t)}toggleDropdown(e){if(e.reset)return void this._onOverflowTabsChange.fire({tabs:[],tabGroups:[],reset:!0});const t=this._tabs.filter(e=>!P(e.value.element,this._tabsList)).map(e=>e.value.panel.id),i=new Set(t),s=[];for(const e of this.group.model.getTabGroups()){const o=this._tabGroupManager.chipRenderers.get(e.id),n=o&&!P(o.chip.element,this._tabsList),r=e.panelIds.length>0&&e.panelIds.every(e=>i.has(e));if((n||r)&&(s.push(e.id),e.collapsed))for(const s of e.panelIds)i.has(s)||(i.add(s),t.push(s))}this._onOverflowTabsChange.fire({tabs:t,tabGroups:s,reset:!1})}updateDragAndDropState(){for(const e of this._tabs)e.value.updateDragAndDropState()}updateTabGroups(){this._tabGroupManager.update()}refreshTabGroupAccent(){this._tabGroupManager.refreshAccents()}_handleChipDragStart(e,i,o){var n;const r=e.panelIds[0],a=r?this._tabs.findIndex(e=>e.value.panel.id===r):-1,h=i.element.getBoundingClientRect();let l=h.width;for(const t of e.panelIds){const e=this._tabMap.get(t);e&&(l+=e.value.element.getBoundingClientRect().width)}this._animState={sourceTabId:"",sourceIndex:a,tabPositions:this.snapshotTabPositions(),chipPositions:this._tabGroupManager.snapshotChipWidths(),currentInsertionIndex:null,targetTabGroupId:null,sourceTabGroupId:e.id,sourceGroupPanelIds:new Set(e.panelIds),sourceChipWidth:h.width,cursorOffsetFromDragLeft:o.clientX-h.left,sourceGapWidth:l,containerLeft:this._tabsList.getBoundingClientRect().left};const d=s.getInstance();d.setData([new t(this.accessor.id,this.group.id,null,e.id)],t.prototype);const p=z();if(this._chipDragCleanup={dispose:()=>{d.clearData(t.prototype),p.release()}},o.dataTransfer&&(o.dataTransfer.effectAllowed="move",0===o.dataTransfer.items.length&&o.dataTransfer.setData("text/plain","")),"smooth"===(null===(n=this.accessor.options.theme)||void 0===n?void 0:n.tabAnimation)){const t=new Set(e.panelIds);this._pendingCollapse=!0,requestAnimationFrame(()=>{var i,s;if(this._pendingCollapse=!1,!this._animState)return;for(const e of this._tabs)t.has(e.value.panel.id)&&(e.value.element.style.transition="none",w(e.value.element,"dv-tab--dragging",!0));const o=this._tabGroupManager.chipRenderers.get(e.id);o&&(o.chip.element.style.transition="none",w(o.chip.element,"dv-tab-group-chip--dragging",!0)),this._tabsList.offsetHeight;const n=this._tabGroupManager.groupUnderlines.get(e.id);n&&(n.style.display="none"),null!==(i=(s=this._animState).currentInsertionIndex)&&void 0!==i||(s.currentInsertionIndex=a),this.applyDragOverTransforms(!0);for(const e of this._tabs)t.has(e.value.panel.id)&&e.value.element.style.removeProperty("transition");o&&o.chip.element.style.removeProperty("transition")})}this._tabGroupManager.setGroupDragImage(o,e,i.element)}setExtendedDropZone(e){this._extendedDropZone=e}setExternalInsertionIndex(e){this._animState&&e!==this._animState.currentInsertionIndex&&(this._animState.currentInsertionIndex=e,this.applyDragOverTransforms())}clearExternalAnimState(){this._animState&&(this.resetTabTransforms(),-1===this._animState.sourceIndex?this._animState=null:this._animState.currentInsertionIndex=null)}snapshotTabPositions(){const e=new Map;for(const t of this._tabs)e.set(t.value.panel.id,t.value.element.getBoundingClientRect());return e}getAverageTabWidth(){if(0===this._tabs.length)return 0;const e="vertical"===this._direction;let t=0;for(const i of this._tabs){const s=i.value.element.getBoundingClientRect();t+=e?s.height:s.width}return t/this._tabs.length}handleDragOver(e){var t,i,s,o,n;if(!this._animState)return;const r=e.clientX;let a=null,h=null;const l=this._animState.sourceGroupPanelIds,d=r-this._animState.cursorOffsetFromDragLeft-this._animState.containerLeft;let p=0;const u=new Map;if(this._tabGroupManager.chipRenderers.size>0){const e=this.group.model.getTabGroups();for(const t of e)t.id!==this._animState.sourceTabGroupId&&t.panelIds.length>0&&u.set(t.panelIds[0],t.id)}for(let e=0;e<this._tabs.length;e++){const i=this._tabs[e].value;if(i.panel.id===this._animState.sourceTabId)continue;if(null==l?void 0:l.has(i.panel.id))continue;const s=u.get(i.panel.id);if(s){const i=null!==(t=this._animState.chipPositions.get(s))&&void 0!==t?t:0;if(p+i>d){null!=a||(a=e);break}p+=i}const o=this._animState.tabPositions.get(i.panel.id),n=o?o.width:i.element.getBoundingClientRect().width;if(!(p+n/2<=d)){null!=a||(a=e);break}p+=n,a=e+1}if(null!==a&&this._tabGroupManager.chipRenderers.size>0){const e=!!this._animState.sourceTabGroupId,t=this.group.model.getTabGroups();let n=0;for(let e=0;e<this._tabs.length;e++){const t=this._tabs[e].value;if(t.panel.id===this._animState.sourceTabId)continue;if(null==l?void 0:l.has(t.panel.id))continue;if(e>=a)break;const s=u.get(t.panel.id);s&&(n+=null!==(i=this._animState.chipPositions.get(s))&&void 0!==i?i:0);const o=this._animState.tabPositions.get(t.panel.id);n+=o?o.width:t.element.getBoundingClientRect().width}for(const i of t){const t=i.panelIds.filter(e=>e!==this._animState.sourceTabId&&!(null==l?void 0:l.has(e)));if(0===t.length)continue;const d=this._tabs.findIndex(e=>e.value.panel.id===t[0]),p=this._tabs.findIndex(e=>e.value.panel.id===t[t.length-1]);if(-1===d||-1===p)continue;const u=a>=d&&a<=p,c=!u&&a===d-1;if(u||c){if(e){a=a<(d+p+1)/2?d:p+1;break}if(c){let e=!0;for(let t=a;t<d;t++){const i=this._tabs[t].value.panel.id;if(i!==this._animState.sourceTabId&&!(null==l?void 0:l.has(i))){e=!1;break}}if(!e)continue;const t=null!==(s=this._animState.chipPositions.get(i.id))&&void 0!==s?s:0;r>=(i.collapsed?this._animState.containerLeft+n+t/2:this._animState.containerLeft+n+t)&&(a=d,h=i.id);break}if(u){const e=null!==(o=this._animState.chipPositions.get(i.id))&&void 0!==o?o:0,t=this._animState.containerLeft+n+e;a===d?r>=t&&(h=i.id):h=i.id;break}}}}a===this._animState.currentInsertionIndex&&h===this._animState.targetTabGroupId||(this._animState.currentInsertionIndex=a,this._animState.targetTabGroupId=h,"smooth"===(null===(n=this.accessor.options.theme)||void 0===n?void 0:n.tabAnimation)&&this.applyDragOverTransforms())}_removeClassInstantlyBatch(e,t){const i=[];for(const s of e)s.classList.contains(t)&&(s.style.transition="none",w(s,t,!1),i.push(s));if(i.length>0){i[0].offsetHeight;for(const e of i)e.style.removeProperty("transition")}}_uncollapsSourceTab(e){const t=this._tabMap.get(e);t&&this._removeClassInstantlyBatch([t.value.element],"dv-tab--dragging")}applyDragOverTransforms(e=!1){if(!this._animState||null===this._animState.currentInsertionIndex)return void this.resetTabTransforms();if(this._pendingCollapse)return;const t=this._animState.currentInsertionIndex;let i;const s=this._animState.sourceGroupPanelIds;if(this._animState.sourceTabGroupId&&s)i=this._animState.sourceGapWidth;else{const e=this._animState.tabPositions.get(this._animState.sourceTabId);i=e?e.width:this.getAverageTabWidth()}let o=null;if(this._tabGroupManager.chipRenderers.size>0){const e=this.group.model.getTabGroups();for(const i of e){if(i.id===this._animState.sourceTabGroupId)continue;if(i.panelIds.includes(this._animState.sourceTabId))continue;const e=i.panelIds.filter(e=>e!==this._animState.sourceTabId&&!(null==s?void 0:s.has(e)));if(0===e.length)continue;const n=this._tabs.findIndex(t=>t.value.panel.id===e[0]);if((!this._animState.targetTabGroupId||this._animState.targetTabGroupId===i.id&&i.collapsed)&&n>=t){let e=!1;for(let i=t;i<n;i++){const t=this._tabs[i].value.panel.id;if(t!==this._animState.sourceTabId&&!(null==s?void 0:s.has(t))){e=!0;break}}if(!e){const e=this._tabGroupManager.chipRenderers.get(i.id);e&&(o=e.chip.element)}break}}}const n=e=>e.classList.contains("dv-tab-group-chip")?"dv-tab-group-chip--shifting":"dv-tab--shifting",r=(t,i)=>{e?(t.style.transition="none",t.style.marginLeft=i,t.offsetHeight,t.style.removeProperty("transition")):t.style.marginLeft=i,w(t,n(t),!0)},a=t=>{const i=n(t),s=this._pendingMarginCleanups.get(t);if(s&&s(),e||!t.style.marginLeft)t.style.removeProperty("margin-left"),w(t,i,!1);else{t.style.marginLeft="0px",w(t,i,!0);const e=()=>{t.style.removeProperty("margin-left"),w(t,i,!1),t.removeEventListener("transitionend",e),clearTimeout(s),this._pendingMarginCleanups.delete(t)},s=setTimeout(e,300);this._pendingMarginCleanups.set(t,e),t.addEventListener("transitionend",e)}};let h=!1;for(const[e,t]of this._tabGroupManager.chipRenderers)e!==this._animState.sourceTabGroupId&&a(t.chip.element);o&&(r(o,`${i}px`),h=!0);for(let e=0;e<this._tabs.length;e++){const o=this._tabs[e].value;o.panel.id!==this._animState.sourceTabId&&((null==s?void 0:s.has(o.panel.id))||(!h&&e>=t?(r(o.element,`${i}px`),h=!0):a(o.element)))}this._tabGroupManager.trackUnderlines()}resetTabTransforms(){for(const[,e]of this._pendingMarginCleanups)e();this._pendingMarginCleanups.clear();for(const e of this._tabs)e.value.element.style.removeProperty("margin-left"),e.value.element.style.removeProperty("margin-right"),e.value.element.style.removeProperty("margin-top"),e.value.element.style.removeProperty("margin-bottom"),e.value.element.style.removeProperty("transform"),w(e.value.element,"dv-tab--shifting",!1);for(const[,e]of this._tabGroupManager.chipRenderers)e.chip.element.style.removeProperty("margin-left"),w(e.chip.element,"dv-tab-group-chip--shifting",!1);this._tabGroupManager.positionUnderlines()}_commitGroupMove(e,t){var i,s,n;const r=o();null===(i=this._chipDragCleanup)||void 0===i||i.dispose(),this._chipDragCleanup=null;if(this.group.model.getTabGroups().some(t=>t.id===e))if("smooth"===(null===(s=this.accessor.options.theme)||void 0===s?void 0:s.tabAnimation)){this._clearGroupDragClasses(e);const i=this.snapshotTabPositions();this.resetTabTransforms(),this.group.model.moveTabGroup(e,t),this.runFlipAnimation(i,"",!1)}else this._tabGroupManager.skipNextCollapseAnimation=!0,this.group.model.moveTabGroup(e,t);else r&&this.accessor.moveGroupOrPanel({from:{groupId:r.groupId,tabGroupId:null!==(n=r.tabGroupId)&&void 0!==n?n:e},to:{group:this.group,position:"center",index:t}})}_clearGroupDragClasses(e){const t=this._tabGroupManager.chipRenderers.get(e);t&&this._removeClassInstantlyBatch([t.chip.element],"dv-tab-group-chip--dragging"),this._removeClassInstantlyBatch(this._tabs.map(e=>e.value.element),"dv-tab--dragging");const i=this._tabGroupManager.groupUnderlines.get(e);i&&i.style.removeProperty("display"),this._tabGroupManager.skipNextCollapseAnimation=!0}resetDragAnimation(){var e,t;this._pendingCollapse=!1,this.resetTabTransforms(),(null===(e=this._animState)||void 0===e?void 0:e.sourceTabGroupId)?this._clearGroupDragClasses(this._animState.sourceTabGroupId):this._removeClassInstantlyBatch(this._tabs.map(e=>e.value.element),"dv-tab--dragging"),this._animState=null,null===(t=this._chipDragCleanup)||void 0===t||t.dispose(),this._chipDragCleanup=null;for(const[,e]of this._tabGroupManager.groupUnderlines)e.style.removeProperty("display")}runFlipAnimation(e,t,i=!1,s){const o="vertical"===this._direction;let n=!1;for(let r=0;r<this._tabs.length;r++){const a=this._tabs[r],h=a.value.panel.id;if(h===t){if(i){const e=a.value.element.getBoundingClientRect();a.value.element.style.transform=o?`translateY(${e.height}px)`:`translateX(${e.width}px)`,w(a.value.element,"dv-tab--shifting",!0),n=!0}continue}if(void 0!==s&&(r<s.from||r>s.to))continue;const l=e.get(h);if(!l)continue;const d=a.value.element.getBoundingClientRect(),p=o?l.top-d.top:l.left-d.left;Math.abs(p)<1||(a.value.element.style.transform=o?`translateY(${p}px)`:`translateX(${p}px)`,w(a.value.element,"dv-tab--shifting",!0),n=!0)}n&&requestAnimationFrame(()=>{var e;for(const e of this._tabs)e.value.element.style.transform&&(e.value.element.style.transform="");this._tabGroupManager.trackUnderlines(),null===(e=this._flipTransitionCleanup)||void 0===e||e.call(this);const t=e=>{if("transform"===e.propertyName){i();for(const e of this._tabs)w(e.value.element,"dv-tab--shifting",!1);this._tabGroupManager.positionUnderlines()}},i=()=>{this._tabsList.removeEventListener("transitionend",t),this._flipTransitionCleanup=null};this._flipTransitionCleanup=i,this._tabsList.addEventListener("transitionend",t)})}}const et=e=>{const t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttributeNS(null,"height",e.height),t.setAttributeNS(null,"width",e.width),t.setAttributeNS(null,"viewBox",e.viewbox),t.setAttributeNS(null,"aria-hidden","false"),t.setAttributeNS(null,"focusable","false"),t.classList.add("dv-svg");const i=document.createElementNS("http://www.w3.org/2000/svg","path");return i.setAttributeNS(null,"d",e.path),t.appendChild(i),t},tt=()=>et({width:"11",height:"11",viewbox:"0 0 15 25",path:"M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z"});class it extends m{get onTabDragStart(){return this.tabs.onTabDragStart}get panels(){return this.tabs.panels}get size(){return this.tabs.size}get hidden(){return this._hidden}set hidden(e){this._hidden=e,this.element.style.display=e?"none":""}get direction(){return this._direction}set direction(e){this._direction=e,"vertical"===e?(b(this._element,"dv-groupview-header-vertical"),b(this.rightActionsContainer,"dv-right-actions-container-vertical"),this.tabs.direction=e):(f(this._element,"dv-groupview-header-vertical"),f(this.rightActionsContainer,"dv-right-actions-container-vertical"),this.tabs.direction=e)}get element(){return this._element}constructor(e,t){super(),this.accessor=e,this.group=t,this._hidden=!1,this._direction="horizontal",this.dropdownPart=null,this._overflowTabs=[],this._overflowTabGroups=[],this._dropdownDisposable=new v,this._onDrop=new d,this.onDrop=this._onDrop.event,this._onGroupDragStart=new d,this.onGroupDragStart=this._onGroupDragStart.event,this._onWillShowOverlay=new d,this.onWillShowOverlay=this._onWillShowOverlay.event,this._element=document.createElement("div"),this._element.className="dv-tabs-and-actions-container",w(this._element,"dv-full-width-single-tab","fullwidth"===this.accessor.options.singleTabMode),this.rightActionsContainer=document.createElement("div"),this.rightActionsContainer.className="dv-right-actions-container",this.leftActionsContainer=document.createElement("div"),this.leftActionsContainer.className="dv-left-actions-container",this.preActionsContainer=document.createElement("div"),this.preActionsContainer.className="dv-pre-actions-container",this.tabs=new Qe(t,e,{showTabsOverflowControl:!e.options.disableTabsOverflowList}),this.voidContainer=new Re(this.accessor,this.group),this.tabs.voidContainer=this.voidContainer.element,this._element.appendChild(this.preActionsContainer),this._element.appendChild(this.tabs.element),this._element.appendChild(this.leftActionsContainer),this._element.appendChild(this.voidContainer.element),this._element.appendChild(this.rightActionsContainer),this.tabs.setExtendedDropZone(this._element),this.addDisposables(this.tabs.onDrop(e=>this._onDrop.fire(e)),this.tabs.onWillShowOverlay(e=>this._onWillShowOverlay.fire(e)),e.onDidOptionsChange(()=>{this.tabs.showTabsOverflowControl=!e.options.disableTabsOverflowList}),this.tabs.onOverflowTabsChange(e=>{this.toggleDropdown(e)}),this.tabs,this._onWillShowOverlay,this._onDrop,this._onGroupDragStart,this.voidContainer,this.voidContainer.onDragStart(e=>{this._onGroupDragStart.fire({nativeEvent:e,group:this.group})}),this.voidContainer.onDrop(e=>{this.tabs.handleVoidDrop()||this._onDrop.fire({event:e.nativeEvent,index:this.tabs.size})}),this.voidContainer.onWillShowOverlay(e=>{this._onWillShowOverlay.fire(new Le(e,{kind:"header_space",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:o}))}),p(this.leftActionsContainer,"dragleave",e=>{const t=e.relatedTarget;this.leftActionsContainer.contains(t)||this._element.contains(t)||this.tabs.clearExternalAnimState()}),p(this.voidContainer.element,"dragleave",e=>{const t=e.relatedTarget;this.voidContainer.element.contains(t)||(this._element.contains(t)?this.tabs.setExternalInsertionIndex(null):this.tabs.clearExternalAnimState())}),p(this.voidContainer.element,"pointerdown",e=>{if(e.defaultPrevented)return;if(!this.accessor.options.disableFloatingGroups&&e.shiftKey&&"floating"!==this.group.api.location.type&&"edge"!==this.group.api.location.type){e.preventDefault();const{top:t,left:i}=this.element.getBoundingClientRect(),{top:s,left:o}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(this.group,{x:i-o+20,y:t-s+20,inDragMode:!0})}}))}show(){this.hidden||(this.element.style.display="")}hide(){this._element.style.display="none"}setRightActionsElement(e){this.rightActions!==e&&(this.rightActions&&(this.rightActions.remove(),this.rightActions=void 0),e&&(this.rightActionsContainer.appendChild(e),this.rightActions=e))}setLeftActionsElement(e){this.leftActions!==e&&(this.leftActions&&(this.leftActions.remove(),this.leftActions=void 0),e&&(this.leftActionsContainer.appendChild(e),this.leftActions=e))}setPrefixActionsElement(e){this.preActions!==e&&(this.preActions&&(this.preActions.remove(),this.preActions=void 0),e&&(this.preActionsContainer.appendChild(e),this.preActions=e))}isActive(e){return this.tabs.isActive(e)}indexOf(e){return this.tabs.indexOf(e)}setActive(e){}delete(e){this.tabs.delete(e),this.updateClassnames()}setActivePanel(e){this.tabs.setActivePanel(e)}openPanel(e,t=this.tabs.size){this.tabs.openPanel(e,t),this.updateClassnames()}closePanel(e){this.delete(e.id)}updateClassnames(){w(this._element,"dv-single-tab",1===this.size)}toggleDropdown(e){const t=e.reset?[]:e.tabs,i=e.reset?[]:e.tabGroups;this._overflowTabs=t,this._overflowTabGroups=i;const s=this._overflowTabs.length;if(s>0&&this.dropdownPart)return void this.dropdownPart.update({tabs:s});if(0===s)return void this._dropdownDisposable.dispose();const o=document.createElement("div");o.className="dv-tabs-overflow-dropdown-root";const n=function(){const e=document.createElement("div");e.className="dv-tabs-overflow-dropdown-default";const t=document.createElement("span");t.textContent="";const i=tt();return e.appendChild(i),e.appendChild(t),{element:e,update:e=>{t.textContent=`${e.tabs}`}}}();n.update({tabs:s}),this.dropdownPart=n,o.appendChild(n.element),this.rightActionsContainer.prepend(o),this._dropdownDisposable.value=new m(exports.DockviewDisposable.from(()=>{var e,t;o.remove(),null===(t=null===(e=this.dropdownPart)||void 0===e?void 0:e.dispose)||void 0===t||t.call(e),this.dropdownPart=null}),p(o,"pointerdown",e=>{e.preventDefault()},{capture:!0}),p(o,"click",e=>{const t=document.createElement("div");t.style.overflow="auto",t.className="dv-tabs-overflow-container";const i=new Set(this._overflowTabGroups),s=this.group.model.getTabGroups(),n=new Map;for(const e of s)if(i.has(e.id))for(const t of e.panelIds)n.set(t,e);const r=new Set;for(const e of this.tabs.tabs.filter(e=>this._overflowTabs.includes(e.panel.id))){const i=n.get(e.panel.id);if(i&&!r.has(i.id)){r.add(i.id);const e=document.createElement("div");e.className="dv-tabs-overflow-group-header";const s=document.createElement("span");s.className="dv-tabs-overflow-group-color",Ue(s,i.color,this.accessor.tabGroupColorPalette),e.appendChild(s);const o=document.createElement("span");if(o.className="dv-tabs-overflow-group-label",o.textContent=i.label||i.id,e.appendChild(o),i.collapsed){const t=document.createElement("span");t.className="dv-tabs-overflow-group-collapsed-badge",t.textContent=`${i.panelIds.length}`,e.appendChild(t)}e.addEventListener("click",()=>{this.accessor.getPopupServiceForGroup(this.group).close(),i.collapsed&&i.expand();const e=i.panelIds[0];if(e){const t=this.group.panels.find(t=>t.id===e);null==t||t.api.setActive()}}),t.appendChild(e)}const s=this.group.panels.find(t=>t===e.panel),o=s.view.createTabRenderer("headerOverflow").element,a=document.createElement("div");w(a,"dv-tab",!0),w(a,"dv-active-tab",s.api.isActive),w(a,"dv-inactive-tab",!s.api.isActive),i&&w(a,"dv-tab--grouped",!0),a.addEventListener("click",t=>{this.accessor.getPopupServiceForGroup(this.group).close(),t.defaultPrevented||((null==i?void 0:i.collapsed)&&i.expand(),e.element.scrollIntoView(),e.panel.api.setActive())}),a.appendChild(o),t.appendChild(a)}const a=I(o);this.accessor.getPopupServiceForGroup(this.group).openPopover(t,{x:e.clientX,y:e.clientY,zIndex:(null==a?void 0:a.style.zIndex)?`calc(${a.style.zIndex} * 2)`:void 0})}))}updateDragAndDropState(){this.tabs.updateDragAndDropState(),this.voidContainer.updateDragAndDropState()}updateTabGroups(){this.tabs.updateTabGroups()}refreshTabGroupAccent(){this.tabs.refreshTabGroupAccent()}}class st extends a{constructor(e,t,i,s,o){super(),this.nativeEvent=e,this.target=t,this.position=i,this.getData=s,this.group=o}}const ot=(()=>{const e={disableAutoResizing:void 0,hideBorders:void 0,singleTabMode:void 0,disableFloatingGroups:void 0,floatingGroupBounds:void 0,popoutUrl:void 0,defaultRenderer:void 0,defaultHeaderPosition:void 0,debug:void 0,rootOverlayModel:void 0,locked:void 0,disableDnd:void 0,className:void 0,noPanelsOverlay:void 0,dndEdges:void 0,theme:void 0,disableTabsOverflowList:void 0,scrollbars:void 0,getTabContextMenuItems:void 0,getTabGroupChipContextMenuItems:void 0,createTabGroupChipComponent:void 0,tabGroupColors:void 0,tabGroupAccent:void 0};return Object.keys(e)})();function nt(e){return!!e.referencePanel}function rt(e){return!!e.referenceGroup}function at(e){return!!e.referencePanel}function ht(e){return!!e.referenceGroup}class lt extends m{get label(){return this._label}get color(){return this._color}get componentParams(){return this._componentParams}setLabel(e){this.isDisposed||this._label===e||(this._label=e,this._onDidChange.fire())}setColor(e){if(this.isDisposed)return;const t=""===e?void 0:e;this._color!==t&&(this._color=t,this._onDidChange.fire())}setComponentParams(e){this.isDisposed||(this._componentParams=e,this._onDidChange.fire())}get collapsed(){return this._collapsed}get panelIds(){return this._panelIds}get size(){return this._panelIds.length}get isEmpty(){return 0===this._panelIds.length}constructor(e,t){var i,s;super(),this.id=e,this._collapsed=!1,this._panelIds=[],this._onDidChange=new d,this.onDidChange=this._onDidChange.event,this._onDidPanelChange=new d,this.onDidPanelChange=this._onDidPanelChange.event,this._onDidCollapseChange=new d,this.onDidCollapseChange=this._onDidCollapseChange.event,this._onDidDestroy=new d,this.onDidDestroy=this._onDidDestroy.event,this._label=null!==(i=null==t?void 0:t.label)&&void 0!==i?i:"",this._color=""===(null==t?void 0:t.color)||null==t?void 0:t.color,this._collapsed=null!==(s=null==t?void 0:t.collapsed)&&void 0!==s&&s,this._componentParams=null==t?void 0:t.componentParams,this.addDisposables(this._onDidChange,this._onDidPanelChange,this._onDidCollapseChange,this._onDidDestroy)}addPanel(e,t){if(this.isDisposed)return;if(this._panelIds.includes(e))return;const i=void 0!==t?Math.max(0,Math.min(t,this._panelIds.length)):this._panelIds.length;this._panelIds.splice(i,0,e),this._onDidPanelChange.fire({panelId:e,type:"add"})}removePanel(e){if(this.isDisposed)return!1;const t=this._panelIds.indexOf(e);return-1!==t&&(this._panelIds.splice(t,1),this._onDidPanelChange.fire({panelId:e,type:"remove"}),!0)}indexOfPanel(e){return this._panelIds.indexOf(e)}containsPanel(e){return this._panelIds.includes(e)}collapse(){this.isDisposed||this._collapsed||(this._collapsed=!0,this._onDidCollapseChange.fire(!0))}expand(){!this.isDisposed&&this._collapsed&&(this._collapsed=!1,this._onDidCollapseChange.fire(!1))}toggle(){this._collapsed?this.expand():this.collapse()}toJSON(){const e={id:this.id,collapsed:this._collapsed,panelIds:[...this._panelIds]};return this._label&&(e.label=this._label),void 0!==this._color&&(e.color=this._color),void 0!==this._componentParams&&(e.componentParams=this._componentParams),e}dispose(){this._onDidDestroy.fire(),super.dispose()}}class dt extends r{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}get panel(){return this.options.panel}get group(){return this.options.group}get api(){return this.options.api}constructor(e){super(),this.options=e}getData(){return this.options.getData()}}class pt extends dt{get kind(){return this._kind}constructor(e){super(e),this._kind=e.kind}}class ut extends m{get tabGroups(){return this._tabGroups}get element(){throw new Error("dockview: not supported")}get activePanel(){return this._activePanel}get locked(){return this._locked}set locked(e){this._locked=e,w(this.container,"dv-locked-groupview","no-drop-target"===e||e)}get isActive(){return this._isGroupActive}get panels(){return this._panels}get size(){return this._panels.length}get isEmpty(){return 0===this._panels.length}get hasWatermark(){return!(!this.watermark||!this.container.contains(this.watermark.element))}get header(){return this.tabsContainer}get isContentFocused(){return!!document.activeElement&&D(document.activeElement,this.contentContainer.element)}get headerPosition(){var e;return null!==(e=this._headerPosition)&&void 0!==e?e:"top"}set headerPosition(e){var t;this._headerPosition=e,f(this.container,"dv-groupview-header-top","dv-groupview-header-bottom","dv-groupview-header-left","dv-groupview-header-right"),b(this.container,`dv-groupview-header-${e}`);const i="top"===e||"bottom"===e?"horizontal":"vertical";this.tabsContainer.direction=i,this.header.direction=i,(null===(t=this._activePanel)||void 0===t?void 0:t.layout)&&this._activePanel.layout(this._width,this._height),(this._leftHeaderActions||this._rightHeaderActions||this._prefixHeaderActions)&&this.updateHeaderActions()}get location(){return this._location}set location(e){switch(this._location=e,w(this.container,"dv-groupview-floating",!1),w(this.container,"dv-groupview-popout",!1),w(this.container,"dv-groupview-edge",!1),e.type){case"grid":this.contentContainer.dropTarget.setTargetZones(["top","bottom","left","right","center"]);break;case"floating":this.contentContainer.dropTarget.setTargetZones(["center"]),this.contentContainer.dropTarget.setTargetZones(e?["center"]:["top","bottom","left","right","center"]),w(this.container,"dv-groupview-floating",!0);break;case"popout":this.contentContainer.dropTarget.setTargetZones(["center"]),w(this.container,"dv-groupview-popout",!0);break;case"edge":this.contentContainer.dropTarget.setTargetZones(["center"]),w(this.container,"dv-groupview-edge",!0)}this.groupPanel.api._onDidLocationChange.fire({location:this.location})}constructor(e,t,i,s,n){var r,a;super(),this.container=e,this.accessor=t,this.id=i,this.options=s,this.groupPanel=n,this._isGroupActive=!1,this._locked=!1,this._rightHeaderActionsDisposable=new v,this._leftHeaderActionsDisposable=new v,this._prefixHeaderActionsDisposable=new v,this._location={type:"grid"},this.mostRecentlyUsed=[],this._overwriteRenderContainer=null,this._overwriteDropTargetContainer=null,this._onDidChange=new d,this.onDidChange=this._onDidChange.event,this._width=0,this._height=0,this._panels=[],this._panelDisposables=new Map,this._tabGroupDisposables=new Map,this._pendingMicrotaskDisposables=new Set,this._onMove=new d,this.onMove=this._onMove.event,this._onDidDrop=new d,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new d,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new d,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onTabDragStart=new d,this.onTabDragStart=this._onTabDragStart.event,this._onGroupDragStart=new d,this.onGroupDragStart=this._onGroupDragStart.event,this._onDidAddPanel=new d,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPanelTitleChange=new d,this.onDidPanelTitleChange=this._onDidPanelTitleChange.event,this._onDidPanelParametersChange=new d,this.onDidPanelParametersChange=this._onDidPanelParametersChange.event,this._onDidRemovePanel=new d,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidActivePanelChange=new d,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onUnhandledDragOverEvent=new d,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this._tabGroups=[],this._tabGroupMap=new Map,this._panelToTabGroup=new Map,this._tabGroupIdCounter=0,this._pendingTabGroupUpdate=!1,this._onDidCreateTabGroup=new d,this.onDidCreateTabGroup=this._onDidCreateTabGroup.event,this._onDidDestroyTabGroup=new d,this.onDidDestroyTabGroup=this._onDidDestroyTabGroup.event,this._onDidAddPanelToTabGroup=new d,this.onDidAddPanelToTabGroup=this._onDidAddPanelToTabGroup.event,this._onDidRemovePanelFromTabGroup=new d,this.onDidRemovePanelFromTabGroup=this._onDidRemovePanelFromTabGroup.event,this._onDidTabGroupChange=new d,this.onDidTabGroupChange=this._onDidTabGroupChange.event,this._onDidTabGroupCollapsedChange=new d,this.onDidTabGroupCollapsedChange=this._onDidTabGroupCollapsedChange.event,w(this.container,"dv-groupview",!0),this._api=new ve(this.accessor),this.tabsContainer=new it(this.accessor,this.groupPanel),this.contentContainer=new Oe(this.accessor,this),e.append(this.tabsContainer.element,this.contentContainer.element),this.header.hidden=!!s.hideHeader,this.locked=null!==(r=s.locked)&&void 0!==r&&r,this.headerPosition=null!==(a=s.headerPosition)&&void 0!==a?a:t.defaultHeaderPosition,this.addDisposables(this._onTabDragStart,this._onGroupDragStart,this._onWillShowOverlay,this._rightHeaderActionsDisposable,this._leftHeaderActionsDisposable,this._prefixHeaderActionsDisposable,this.tabsContainer.onTabDragStart(e=>{this._onTabDragStart.fire(e)}),this.tabsContainer.onGroupDragStart(e=>{this._onGroupDragStart.fire(e)}),this.tabsContainer.onDrop(e=>{var t;const i=o(),s=null!==(t=null==i?void 0:i.panelId)&&void 0!==t?t:null;if(this.handleDropEvent("header",e.event,"center",e.index),s&&e.targetTabGroupId){const t=this._tabGroupMap.get(e.targetTabGroupId);let i;if(t){const e=this._panels.findIndex(e=>e.id===s);if(-1!==e){i=0;for(const s of t.panelIds){this._panels.findIndex(e=>e.id===s)<e&&i++}}}this.addPanelToTabGroup(e.targetTabGroupId,s,i)}else s&&null===e.targetTabGroupId&&this.removePanelFromTabGroup(s)}),this.contentContainer.onDidFocus(()=>{this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.onDidBlur(()=>{}),this.contentContainer.dropTarget.onDrop(e=>{this.handleDropEvent("content",e.nativeEvent,e.position)}),this.tabsContainer.onWillShowOverlay(e=>{this._onWillShowOverlay.fire(e)}),this.contentContainer.dropTarget.onWillShowOverlay(e=>{this._onWillShowOverlay.fire(new Le(e,{kind:"content",panel:this.activePanel,api:this._api,group:this.groupPanel,getData:o}))}),this._onMove,this._onDidChange,this._onDidDrop,this._onWillDrop,this._onDidAddPanel,this._onDidRemovePanel,this._onDidActivePanelChange,this._onUnhandledDragOverEvent,this._onDidPanelTitleChange,this._onDidPanelParametersChange,this._onDidCreateTabGroup,this._onDidDestroyTabGroup,this._onDidAddPanelToTabGroup,this._onDidRemovePanelFromTabGroup,this._onDidTabGroupChange,this._onDidTabGroupCollapsedChange,this._onDidCreateTabGroup.event(()=>{this._scheduleTabGroupUpdate()}),this._onDidDestroyTabGroup.event(()=>{this._scheduleTabGroupUpdate()}),this._onDidAddPanelToTabGroup.event(()=>{this._scheduleTabGroupUpdate()}),this._onDidRemovePanelFromTabGroup.event(()=>{this._scheduleTabGroupUpdate()}),this._onDidTabGroupChange.event(()=>{this._scheduleTabGroupUpdate()}),this._onDidTabGroupCollapsedChange.event(()=>{this._scheduleTabGroupUpdate()}))}_scheduleTabGroupUpdate(){this._pendingTabGroupUpdate||(this._pendingTabGroupUpdate=!0,queueMicrotask(()=>{this._pendingTabGroupUpdate=!1,this.isDisposed||this.tabsContainer.updateTabGroups()}))}createTabGroup(e){var t;const i=null!==(t=null==e?void 0:e.id)&&void 0!==t?t:`tg-${this.id}-${this._tabGroupIdCounter++}`,s=new lt(i,{label:null==e?void 0:e.label,color:null==e?void 0:e.color,collapsed:null==e?void 0:e.collapsed,componentParams:null==e?void 0:e.componentParams});return this._tabGroups.push(s),this._tabGroupMap.set(i,s),this._tabGroupDisposables.set(i,new m(s.onDidChange(()=>{this._onDidTabGroupChange.fire({tabGroup:s})}),s.onDidCollapseChange(e=>{e?this._handleGroupCollapse(s):this._handleGroupExpand(s),this._onDidTabGroupCollapsedChange.fire({tabGroup:s})}),s.onDidDestroy(()=>{this._removeTabGroupInternal(s)}))),this._onDidCreateTabGroup.fire({tabGroup:s}),s}dissolveTabGroup(e){const t=this._tabGroupMap.get(e);if(!t)return;const i=[...t.panelIds];for(const e of i)t.removePanel(e),this._panelToTabGroup.delete(e),this._onDidRemovePanelFromTabGroup.fire({tabGroup:t,panelId:e});t.dispose()}addPanelToTabGroup(e,t,i){const s=this._tabGroupMap.get(e);if(!s)return;if(!this._panels.some(e=>e.id===t))return;const o=this.getTabGroupForPanel(t);if(o){if(o.id===e)return;this.removePanelFromTabGroup(t)}s.addPanel(t,i),this._panelToTabGroup.set(t,s),this._enforceContiguity(s,t),this._onDidAddPanelToTabGroup.fire({tabGroup:s,panelId:t})}movePanelWithinGroup(e,t,i){const s=this._tabGroupMap.get(e);s&&s.containsPanel(t)&&(s.removePanel(t),s.addPanel(t,i),this._enforceContiguity(s,t),this.tabsContainer.updateTabGroups())}movePanelBetweenGroups(e,t,i){const s=this._findTabGroupForPanel(e),o=this._tabGroupMap.get(t);o&&(s&&(s.removePanel(e),this._panelToTabGroup.delete(e),this._onDidRemovePanelFromTabGroup.fire({tabGroup:s,panelId:e}),s.isEmpty&&s.dispose()),o.addPanel(e,i),this._panelToTabGroup.set(e,o),this._enforceContiguity(o,e),this._onDidAddPanelToTabGroup.fire({tabGroup:o,panelId:e}))}moveTabGroup(e,t){const i=this._tabGroupMap.get(e);if(!i||0===i.panelIds.length)return;const s=new Set(i.panelIds),o=i.panelIds.map(e=>this._panels.find(t=>t.id===e)).filter(e=>void 0!==e);if(0===o.length)return;let n=0;for(let e=0;e<Math.min(t,this._panels.length);e++)s.has(this._panels[e].id)&&n++;for(const e of o){const t=this._panels.indexOf(e);-1!==t&&this._panels.splice(t,1)}const r=t-n,a=Math.max(0,Math.min(r,this._panels.length));this._panels.splice(a,0,...o);for(const e of this._panels)this.tabsContainer.delete(e.id);for(let e=0;e<this._panels.length;e++)this.tabsContainer.openPanel(this._panels[e],e);this.tabsContainer.updateTabGroups()}_enforceContiguity(e,t){const i=this._panels.find(e=>e.id===t);if(!i)return;const s=e.indexOfPanel(t),o=this._computeGlobalIndex(e,s),n=this._panels.indexOf(i);if(n===o)return;this._panels.splice(n,1);const r=o>n?o-1:o;this._panels.splice(r,0,i),this.tabsContainer.delete(t),this.tabsContainer.openPanel(i,r)}_computeGlobalIndex(e,t){const i=e.panelIds;if(i.length<=1){const e=this._panels.find(e=>e.id===i[0]);return e?this._panels.indexOf(e):this._panels.length}for(let e=0;e<i.length;e++){if(e===t)continue;const s=this._panels.find(t=>t.id===i[e]);if(s){const i=this._panels.indexOf(s);return Math.max(0,i+(t-e))}}return this._panels.length}removePanelFromTabGroup(e){const t=this._findTabGroupForPanel(e);t&&(t.removePanel(e),this._panelToTabGroup.delete(e),this._onDidRemovePanelFromTabGroup.fire({tabGroup:t,panelId:e}),t.isEmpty&&t.dispose())}getTabGroups(){return this._tabGroups}updateTabGroups(){this.tabsContainer.updateTabGroups()}refreshTabGroupAccent(){this.tabsContainer.refreshTabGroupAccent()}getTabGroupForPanel(e){return this._findTabGroupForPanel(e)}_findTabGroupForPanel(e){return this._panelToTabGroup.get(e)}_removeTabGroupInternal(e){const t=this._tabGroups.indexOf(e);if(-1!==t){this._tabGroups.splice(t,1),this._tabGroupMap.delete(e.id);for(const t of e.panelIds)this._panelToTabGroup.delete(t);this._onDidDestroyTabGroup.fire({tabGroup:e});const i=this._tabGroupDisposables.get(e.id);this._tabGroupDisposables.delete(e.id),i&&(this._pendingMicrotaskDisposables.add(i),queueMicrotask(()=>{this._pendingMicrotaskDisposables.delete(i),i.dispose()}))}}_handleGroupCollapse(e){if(!this._activePanel)return;if(!e.containsPanel(this._activePanel.id))return;const t=this._panels.indexOf(this._activePanel);for(let e=t+1;e<this._panels.length;e++){const t=this._panels[e],i=this._findTabGroupForPanel(t.id);if(!i||!i.collapsed)return this.doSetActivePanel(t),void this.updateContainer()}for(let e=t-1;e>=0;e--){const t=this._panels[e],i=this._findTabGroupForPanel(t.id);if(!i||!i.collapsed)return this.doSetActivePanel(t),void this.updateContainer()}this.contentContainer.closePanel(),this.doSetActivePanel(void 0),this.updateContainer()}_handleGroupExpand(e){if(this._activePanel)return;const t=e.panelIds[0];if(t){const e=this._panels.find(e=>e.id===t);e&&(this.doSetActivePanel(e),this.updateContainer())}}restoreTabGroups(e){for(const t of e){const e=t.id.match(/-(\d+)$/);if(e){const t=parseInt(e[1],10)+1;t>this._tabGroupIdCounter&&(this._tabGroupIdCounter=t)}}for(const t of e){const e=this.createTabGroup({id:t.id,label:t.label,color:t.color,componentParams:t.componentParams}),i=this._tabGroupMap.get(e.id);for(const s of t.panelIds)this._panels.some(e=>e.id===s)&&(e.addPanel(s),this._panelToTabGroup.set(s,i),this._enforceContiguity(i,s));t.collapsed&&e.collapse(),e.isEmpty&&e.dispose()}}focusContent(){this.contentContainer.element.focus()}set renderContainer(e){this.panels.forEach(e=>{this.renderContainer.detatch(e)}),this._overwriteRenderContainer=e,this.panels.forEach(e=>{this.rerender(e)})}get renderContainer(){var e;return null!==(e=this._overwriteRenderContainer)&&void 0!==e?e:this.accessor.overlayRenderContainer}set dropTargetContainer(e){this._overwriteDropTargetContainer=e}get dropTargetContainer(){var e;return null!==(e=this._overwriteDropTargetContainer)&&void 0!==e?e:this.accessor.rootDropTargetContainer}initialize(){this.options.panels&&this.options.panels.forEach(e=>{this.doAddPanel(e)}),this.options.activePanel&&this.openPanel(this.options.activePanel),this.setActive(this.isActive,!0),this.updateContainer(),this.updateHeaderActions()}updateHeaderActions(){this.accessor.options.createRightHeaderActionComponent?(this._rightHeaderActions=this.accessor.options.createRightHeaderActionComponent(this.groupPanel),this._rightHeaderActionsDisposable.value=this._rightHeaderActions,this._rightHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element)):(this._rightHeaderActions=void 0,this._rightHeaderActionsDisposable.dispose(),this.tabsContainer.setRightActionsElement(void 0)),this.accessor.options.createLeftHeaderActionComponent?(this._leftHeaderActions=this.accessor.options.createLeftHeaderActionComponent(this.groupPanel),this._leftHeaderActionsDisposable.value=this._leftHeaderActions,this._leftHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element)):(this._leftHeaderActions=void 0,this._leftHeaderActionsDisposable.dispose(),this.tabsContainer.setLeftActionsElement(void 0)),this.accessor.options.createPrefixHeaderActionComponent?(this._prefixHeaderActions=this.accessor.options.createPrefixHeaderActionComponent(this.groupPanel),this._prefixHeaderActionsDisposable.value=this._prefixHeaderActions,this._prefixHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element)):(this._prefixHeaderActions=void 0,this._prefixHeaderActionsDisposable.dispose(),this.tabsContainer.setPrefixActionsElement(void 0))}rerender(e){this.contentContainer.renderPanel(e,{asActive:!1})}indexOf(e){return this.tabsContainer.indexOf(e.id)}toJSON(){var e;const t={views:this.tabsContainer.panels,activeView:null===(e=this._activePanel)||void 0===e?void 0:e.id,id:this.id};return!1!==this.locked&&(t.locked=this.locked),this.header.hidden&&(t.hideHeader=!0),"top"!==this.headerPosition&&(t.headerPosition=this.headerPosition),this._tabGroups.length>0&&(t.tabGroups=this._tabGroups.map(e=>e.toJSON())),t}moveToNext(e){e||(e={}),e.panel||(e.panel=this.activePanel);const t=e.panel?this.panels.indexOf(e.panel):-1;let i;if(t<this.panels.length-1)i=t+1;else{if(e.suppressRoll)return;i=0}this.openPanel(this.panels[i])}moveToPrevious(e){if(e||(e={}),e.panel||(e.panel=this.activePanel),!e.panel)return;const t=this.panels.indexOf(e.panel);let i;if(t>0)i=t-1;else{if(e.suppressRoll)return;i=this.panels.length-1}this.openPanel(this.panels[i])}containsPanel(e){return this.panels.includes(e)}init(e){}update(e){}focus(){var e;null===(e=this._activePanel)||void 0===e||e.focus()}openPanel(e,t={}){("number"!=typeof t.index||t.index>this.panels.length)&&(t.index=this.panels.length);const i=!!t.skipSetActive;e.updateParentGroup(this.groupPanel,{skipSetActive:t.skipSetActive}),this.doAddPanel(e,t.index,{skipSetActive:i}),this._activePanel!==e?(i||this.doSetActivePanel(e),t.skipSetGroupActive||this.accessor.doSetGroupActive(this.groupPanel),t.skipSetActive||this.updateContainer()):this.contentContainer.renderPanel(e,{asActive:!0})}removePanel(e,t={skipSetActive:!1}){const i="string"==typeof e?e:e.id,s=this._panels.find(e=>e.id===i);if(!s)throw new Error("invalid operation");return this._removePanel(s,t)}closeAllPanels(){if(this.panels.length>0){const e=[...this.panels];for(const t of e)this.doClose(t)}else this.accessor.removeGroup(this.groupPanel)}closePanel(e){this.doClose(e)}doClose(e){const t=1===this.panels.length&&1===this.accessor.groups.length;this.accessor.removePanel(e,t&&"emptyGroup"===this.accessor.options.noPanelsOverlay?{removeEmptyGroup:!1}:void 0)}isPanelActive(e){return this._activePanel===e}updateActions(e){this.tabsContainer.setRightActionsElement(e)}setActive(e,t=!1){if(t||this.isActive!==e){if(this._isGroupActive=e,w(this.container,"dv-active-group",e),w(this.container,"dv-inactive-group",!e),this.tabsContainer.setActive(this.isActive),!this._activePanel&&this.panels.length>0){const e=this._panels.find(e=>{const t=this._findTabGroupForPanel(e.id);return!t||!t.collapsed});e&&this.doSetActivePanel(e)}this.updateContainer()}}layout(e,t){var i;this._width=e,this._height=t,this.contentContainer.layout(this._width,this._height),(null===(i=this._activePanel)||void 0===i?void 0:i.layout)&&this._activePanel.layout(this._width,this._height)}_removePanel(e,t){const i=this._activePanel===e;if(this.doRemovePanel(e),i&&this.panels.length>0){const e=this.mostRecentlyUsed[0];this.openPanel(e,{skipSetActive:t.skipSetActive,skipSetGroupActive:t.skipSetActiveGroup})}return this._activePanel&&0===this.panels.length&&this.doSetActivePanel(void 0),t.skipSetActive||this.updateContainer(),e}doRemovePanel(e){const t=this.panels.indexOf(e);if(this._activePanel===e&&this.contentContainer.closePanel(),this.tabsContainer.delete(e.id),this._panels.splice(t,1),this.mostRecentlyUsed.includes(e)){const t=this.mostRecentlyUsed.indexOf(e);this.mostRecentlyUsed.splice(t,1)}const i=this._panelDisposables.get(e.id);i&&(i.dispose(),this._panelDisposables.delete(e.id)),this.removePanelFromTabGroup(e.id),this._onDidRemovePanel.fire({panel:e})}doAddPanel(e,t=this.panels.length,i={skipSetActive:!1}){const s=this._panels.indexOf(e)>-1;this.tabsContainer.show(),this.contentContainer.show(),this.tabsContainer.openPanel(e,t),i.skipSetActive?"always"===e.api.renderer&&this.contentContainer.renderPanel(e,{asActive:!1}):this.contentContainer.openPanel(e),s||(this.updateMru(e),this.panels.splice(t,0,e),this._panelDisposables.set(e.id,new m(e.api.onDidTitleChange(e=>this._onDidPanelTitleChange.fire(e)),e.api.onDidParametersChange(e=>this._onDidPanelParametersChange.fire(e)))),this._onDidAddPanel.fire({panel:e}))}doSetActivePanel(e){this._activePanel!==e&&(this._activePanel=e,e&&(this.tabsContainer.setActivePanel(e),this.contentContainer.openPanel(e),e.layout(this._width,this._height),this.updateMru(e),this.contentContainer.refreshFocusState(),this._onDidActivePanelChange.fire({panel:e})))}updateMru(e){this.mostRecentlyUsed.includes(e)&&this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(e),1),this.mostRecentlyUsed=[e,...this.mostRecentlyUsed]}updateContainer(){var e,t;this.panels.forEach(e=>e.runEvents());const i=this.isEmpty||!this._activePanel;if(i&&!this.watermark){const e=this.accessor.createWatermarkComponent();e.init({containerApi:this._api,group:this.groupPanel}),this.watermark=e,p(this.watermark.element,"pointerdown",()=>{this.isActive||this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.element.appendChild(this.watermark.element)}!i&&this.watermark&&(this.watermark.element.remove(),null===(t=(e=this.watermark).dispose)||void 0===t||t.call(e),this.watermark=void 0)}canDisplayOverlay(e,t,i){const s=new st(e,i,t,o,this.accessor.getPanel(this.id));return this._onUnhandledDragOverEvent.fire(s),s.isAccepted}handleDropEvent(e,t,i,s){if("no-drop-target"===this.locked)return;const n="number"==typeof s?this.panels[s]:void 0,r=new pt({nativeEvent:t,position:i,panel:n,getData:()=>o(),kind:function(){switch(e){case"header":return"number"==typeof s?"tab":"header_space";case"content":return"content"}}(),group:this.groupPanel,api:this._api});if(this._onWillDrop.fire(r),r.defaultPrevented)return;const a=o();if(a&&a.viewId===this.accessor.id){if("content"===e&&a.groupId===this.id){if("center"===i)return;if(null===a.panelId)return}if("header"===e&&a.groupId===this.id&&null===a.panelId)return;if(null===a.panelId){const{groupId:e}=a;return void this._onMove.fire({target:i,groupId:e,index:s,tabGroupId:a.tabGroupId})}if(-1!==this.tabsContainer.indexOf(a.panelId)&&1===this.tabsContainer.size)return;const{groupId:t,panelId:o}=a;if(this.id===t&&!i){if(this.tabsContainer.indexOf(o)===s)return}this._onMove.fire({target:i,groupId:a.groupId,itemId:a.panelId,index:s})}else this._onDidDrop.fire(new dt({nativeEvent:t,position:i,panel:n,getData:()=>o(),group:this.groupPanel,api:this._api}))}updateDragAndDropState(){this.tabsContainer.updateDragAndDropState()}dispose(){var e,t,i;super.dispose(),null===(e=this.watermark)||void 0===e||e.element.remove(),null===(i=null===(t=this.watermark)||void 0===t?void 0:t.dispose)||void 0===i||i.call(t),this.watermark=void 0;for(const e of[...this._tabGroups])e.dispose();for(const e of this._tabGroupDisposables.values())e.dispose();this._tabGroupDisposables.clear();for(const e of this._pendingMicrotaskDisposables)e.dispose();this._pendingMicrotaskDisposables.clear();for(const e of this.panels)e.dispose();this.tabsContainer.dispose(),this.contentContainer.dispose()}}class ct extends ze{constructor(e,t,i){super(e,t),this._onDidConstraintsChangeInternal=new d,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new d,this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new d,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange),i&&this.initialize(i)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}}class mt extends Ie{get priority(){return this._priority}get snap(){return this._snap}get minimumWidth(){return this.__minimumWidth()}get minimumHeight(){return this.__minimumHeight()}get maximumHeight(){return this.__maximumHeight()}get maximumWidth(){return this.__maximumWidth()}__minimumWidth(){const e="function"==typeof this._minimumWidth?this._minimumWidth():this._minimumWidth;return e!==this._evaluatedMinimumWidth&&(this._evaluatedMinimumWidth=e,this.updateConstraints()),e}__maximumWidth(){const e="function"==typeof this._maximumWidth?this._maximumWidth():this._maximumWidth;return e!==this._evaluatedMaximumWidth&&(this._evaluatedMaximumWidth=e,this.updateConstraints()),e}__minimumHeight(){const e="function"==typeof this._minimumHeight?this._minimumHeight():this._minimumHeight;return e!==this._evaluatedMinimumHeight&&(this._evaluatedMinimumHeight=e,this.updateConstraints()),e}__maximumHeight(){const e="function"==typeof this._maximumHeight?this._maximumHeight():this._maximumHeight;return e!==this._evaluatedMaximumHeight&&(this._evaluatedMaximumHeight=e,this.updateConstraints()),e}get isActive(){return this.api.isActive}get isVisible(){return this.api.isVisible}constructor(e,t,i,s){super(e,t,null!=s?s:new ct(e,t)),this._evaluatedMinimumWidth=0,this._evaluatedMaximumWidth=Number.MAX_SAFE_INTEGER,this._evaluatedMinimumHeight=0,this._evaluatedMaximumHeight=Number.MAX_SAFE_INTEGER,this._minimumWidth=0,this._minimumHeight=0,this._maximumWidth=Number.MAX_SAFE_INTEGER,this._maximumHeight=Number.MAX_SAFE_INTEGER,this._snap=!1,this._onDidChange=new d,this.onDidChange=this._onDidChange.event,"number"==typeof(null==i?void 0:i.minimumWidth)&&(this._minimumWidth=i.minimumWidth),"number"==typeof(null==i?void 0:i.maximumWidth)&&(this._maximumWidth=i.maximumWidth),"number"==typeof(null==i?void 0:i.minimumHeight)&&(this._minimumHeight=i.minimumHeight),"number"==typeof(null==i?void 0:i.maximumHeight)&&(this._maximumHeight=i.maximumHeight),this.api.initialize(this),this.addDisposables(this.api.onWillVisibilityChange(e=>{const{isVisible:t}=e,{accessor:i}=this._params;i.setVisible(this,t)}),this.api.onActiveChange(()=>{const{accessor:e}=this._params;e.doSetGroupActive(this)}),this.api.onDidConstraintsChangeInternal(e=>{"number"!=typeof e.minimumWidth&&"function"!=typeof e.minimumWidth||(this._minimumWidth=e.minimumWidth),"number"!=typeof e.minimumHeight&&"function"!=typeof e.minimumHeight||(this._minimumHeight=e.minimumHeight),"number"!=typeof e.maximumWidth&&"function"!=typeof e.maximumWidth||(this._maximumWidth=e.maximumWidth),"number"!=typeof e.maximumHeight&&"function"!=typeof e.maximumHeight||(this._maximumHeight=e.maximumHeight)}),this.api.onDidSizeChange(e=>{this._onDidChange.fire({height:e.height,width:e.width})}),this._onDidChange)}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}init(e){e.maximumHeight&&(this._maximumHeight=e.maximumHeight),e.minimumHeight&&(this._minimumHeight=e.minimumHeight),e.maximumWidth&&(this._maximumWidth=e.maximumWidth),e.minimumWidth&&(this._minimumWidth=e.minimumWidth),this._priority=e.priority,this._snap=!!e.snap,super.init(e),"boolean"==typeof e.isVisible&&this.setVisible(e.isVisible)}updateConstraints(){this.api._onDidConstraintsChange.fire({minimumWidth:this._evaluatedMinimumWidth,maximumWidth:this._evaluatedMaximumWidth,minimumHeight:this._evaluatedMinimumHeight,maximumHeight:this._evaluatedMaximumHeight})}toJSON(){const e=super.toJSON(),t=e=>e===Number.MAX_SAFE_INTEGER?void 0:e,i=e=>e<=0?void 0:e;return Object.assign(Object.assign({},e),{minimumHeight:i(this.minimumHeight),maximumHeight:t(this.maximumHeight),minimumWidth:i(this.minimumWidth),maximumWidth:t(this.maximumWidth),snap:this.snap,priority:this.priority})}}const vt="dockview: DockviewGroupPanelApiImpl not initialized";class gt extends ct{get location(){if(!this._group)throw new Error(vt);return this._group.model.location}constructor(e,t){super(e,"__dockviewgroup__"),this.accessor=t,this._onDidLocationChange=new d,this.onDidLocationChange=this._onDidLocationChange.event,this._onDidActivePanelChange=new d,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onDidCollapsedChange=new d,this.onDidCollapsedChange=this._onDidCollapsedChange.event,this.addDisposables(this._onDidLocationChange,this._onDidActivePanelChange,this._onDidCollapsedChange,this._onDidVisibilityChange.event(e=>{e.isVisible&&this._pendingSize&&(super.setSize(this._pendingSize),this._pendingSize=void 0)}))}setSize(e){this._pendingSize=Object.assign({},e),super.setSize(e)}close(){if(this._group)return this.accessor.removeGroup(this._group)}getWindow(){return"popout"===this.location.type?this.location.getWindow():window}setHeaderPosition(e){if(!this._group)throw new Error(vt);this._group.model.headerPosition=e}getHeaderPosition(){if(!this._group)throw new Error(vt);return this._group.model.headerPosition}moveTo(e){var t,i,s,o;if(!this._group)throw new Error(vt);const n=null!==(t=e.group)&&void 0!==t?t:this.accessor.addGroup({direction:we(null!==(i=e.position)&&void 0!==i?i:"right"),skipSetActive:null!==(s=e.skipSetActive)&&void 0!==s&&s});this.accessor.moveGroupOrPanel({from:{groupId:this._group.id},to:{group:n,position:e.group&&null!==(o=e.position)&&void 0!==o?o:"center",index:e.index},skipSetActive:e.skipSetActive})}maximize(){if(!this._group)throw new Error(vt);"grid"===this.location.type&&this.accessor.maximizeGroup(this._group)}isMaximized(){if(!this._group)throw new Error(vt);return this.accessor.isMaximizedGroup(this._group)}exitMaximized(){if(!this._group)throw new Error(vt);this.isMaximized()&&this.accessor.exitMaximizedGroup()}collapse(){this._group&&this.accessor.setEdgeGroupCollapsed(this._group,!0)}expand(){this._group&&this.accessor.setEdgeGroupCollapsed(this._group,!1)}isCollapsed(){return!!this._group&&this.accessor.isEdgeGroupCollapsed(this._group)}initialize(e){this._group=e}}class _t extends mt{get minimumWidth(){var e;if("number"==typeof this._explicitConstraints.minimumWidth)return this._explicitConstraints.minimumWidth;const t=null===(e=this.activePanel)||void 0===e?void 0:e.minimumWidth;return"number"==typeof t?t:super.__minimumWidth()}get minimumHeight(){var e;if("number"==typeof this._explicitConstraints.minimumHeight)return this._explicitConstraints.minimumHeight;const t=null===(e=this.activePanel)||void 0===e?void 0:e.minimumHeight;return"number"==typeof t?t:super.__minimumHeight()}get maximumWidth(){var e;if("number"==typeof this._explicitConstraints.maximumWidth)return this._explicitConstraints.maximumWidth;const t=null===(e=this.activePanel)||void 0===e?void 0:e.maximumWidth;return"number"==typeof t?t:super.__maximumWidth()}get maximumHeight(){var e;if("number"==typeof this._explicitConstraints.maximumHeight)return this._explicitConstraints.maximumHeight;const t=null===(e=this.activePanel)||void 0===e?void 0:e.maximumHeight;return"number"==typeof t?t:super.__maximumHeight()}get panels(){return this._model.panels}get activePanel(){return this._model.activePanel}get size(){return this._model.size}get model(){return this._model}get locked(){return this._model.locked}set locked(e){this._model.locked=e}get header(){return this._model.header}constructor(e,t,i){var s,o,n,r,a,h;super(t,"groupview_default",{minimumHeight:null!==(o=null===(s=i.constraints)||void 0===s?void 0:s.minimumHeight)&&void 0!==o?o:100,minimumWidth:null!==(r=null===(n=i.constraints)||void 0===n?void 0:n.minimumWidth)&&void 0!==r?r:100,maximumHeight:null===(a=i.constraints)||void 0===a?void 0:a.maximumHeight,maximumWidth:null===(h=i.constraints)||void 0===h?void 0:h.maximumWidth},new gt(t,e)),this._explicitConstraints={},this.api.initialize(this),this._model=new ut(this.element,e,t,i,this),this.addDisposables(this.model.onDidActivePanelChange(e=>{this.api._onDidActivePanelChange.fire(e)}),this.api.onDidConstraintsChangeInternal(e=>{void 0!==e.minimumWidth&&(this._explicitConstraints.minimumWidth="function"==typeof e.minimumWidth?e.minimumWidth():e.minimumWidth),void 0!==e.minimumHeight&&(this._explicitConstraints.minimumHeight="function"==typeof e.minimumHeight?e.minimumHeight():e.minimumHeight),void 0!==e.maximumWidth&&(this._explicitConstraints.maximumWidth="function"==typeof e.maximumWidth?e.maximumWidth():e.maximumWidth),void 0!==e.maximumHeight&&(this._explicitConstraints.maximumHeight="function"==typeof e.maximumHeight?e.maximumHeight():e.maximumHeight)}))}focus(){this.api.isActive||this.api.setActive(),super.focus()}initialize(){this._model.initialize()}setActive(e){super.setActive(e),this.model.setActive(e)}layout(e,t){super.layout(e,t),this.model.layout(e,t)}getComponent(){return this._model}toJSON(){return this.model.toJSON()}}const ft={name:"abyss",className:"dockview-theme-abyss",colorScheme:"dark",tabGroupIndicator:"none"};class bt extends ct{get location(){return this.group.api.location}get title(){return this.panel.title}get isGroupActive(){return this.group.isActive}get renderer(){return this.panel.renderer}set group(e){const t=this._group;this._group!==e&&(this._group=e,this._onDidGroupChange.fire({}),this.setupGroupEventListeners(t),this._onDidLocationChange.fire({location:this.group.api.location}))}get group(){return this._group}get tabComponent(){return this._tabComponent}constructor(e,t,i,s,o){super(e.id,s),this.panel=e,this.accessor=i,this._onDidTitleChange=new d,this.onDidTitleChange=this._onDidTitleChange.event,this._onDidActiveGroupChange=new d,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._onDidGroupChange=new d,this.onDidGroupChange=this._onDidGroupChange.event,this._onDidRendererChange=new d,this.onDidRendererChange=this._onDidRendererChange.event,this._onDidLocationChange=new d,this.onDidLocationChange=this._onDidLocationChange.event,this.groupEventsDisposable=new v,this._tabComponent=o,this.initialize(e),this._group=t,this.setupGroupEventListeners(),this.addDisposables(this.groupEventsDisposable,this._onDidRendererChange,this._onDidTitleChange,this._onDidGroupChange,this._onDidActiveGroupChange,this._onDidLocationChange)}getWindow(){return this.group.api.getWindow()}moveTo(e){var t,i;this.accessor.moveGroupOrPanel({from:{groupId:this._group.id,panelId:this.panel.id},to:{group:null!==(t=e.group)&&void 0!==t?t:this._group,position:e.group&&null!==(i=e.position)&&void 0!==i?i:"center",index:e.index},skipSetActive:e.skipSetActive})}setTitle(e){this.panel.setTitle(e)}setRenderer(e){this.panel.setRenderer(e)}close(){this.group.model.closePanel(this.panel)}maximize(){this.group.api.maximize()}isMaximized(){return this.group.api.isMaximized()}exitMaximized(){this.group.api.exitMaximized()}setupGroupEventListeners(e){var t;let i=null!==(t=null==e?void 0:e.isActive)&&void 0!==t&&t;this.groupEventsDisposable.value=new m(this.group.api.onDidVisibilityChange(e=>{const t=!e.isVisible&&this.isVisible,i=e.isVisible&&!this.isVisible,s=this.group.model.isPanelActive(this.panel);(t||i&&s)&&this._onDidVisibilityChange.fire(e)}),this.group.api.onDidLocationChange(e=>{this.group===this.panel.group&&this._onDidLocationChange.fire(e)}),this.group.api.onDidActiveChange(()=>{this.group===this.panel.group&&i!==this.isGroupActive&&(i=this.isGroupActive,this._onDidActiveGroupChange.fire({isActive:this.isGroupActive}))}))}}class wt extends m{get params(){return this._params}get title(){return this._title}get group(){return this._group}get renderer(){var e;return null!==(e=this._renderer)&&void 0!==e?e:this.accessor.renderer}get minimumWidth(){return this._minimumWidth}get minimumHeight(){return this._minimumHeight}get maximumWidth(){return this._maximumWidth}get maximumHeight(){return this._maximumHeight}constructor(e,t,i,s,o,n,r,a){super(),this.id=e,this.accessor=s,this.containerApi=o,this.view=r,this._renderer=a.renderer,this._group=n,this._minimumWidth=a.minimumWidth,this._minimumHeight=a.minimumHeight,this._maximumWidth=a.maximumWidth,this._maximumHeight=a.maximumHeight,this.api=new bt(this,this._group,s,t,i),this.addDisposables(this.api.onActiveChange(()=>{s.setActivePanel(this)}),this.api.onDidSizeChange(e=>{this.group.api.setSize(e)}),this.api.onDidRendererChange(()=>{this.group.model.rerender(this)}))}init(e){this._params=e.params,this.view.init(Object.assign(Object.assign({},e),{api:this.api,containerApi:this.containerApi})),this.setTitle(e.title)}focus(){const e=new Ge;this.api._onWillFocus.fire(e),e.defaultPrevented||this.api.isActive||this.api.setActive()}toJSON(){return{id:this.id,contentComponent:this.view.contentComponent,tabComponent:this.view.tabComponent,params:Object.keys(this._params||{}).length>0?this._params:void 0,title:this.title,renderer:this._renderer,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,minimumWidth:this._minimumWidth,maximumWidth:this._maximumWidth}}setTitle(e){e!==this.title&&(this._title=e,this.api._onDidTitleChange.fire({title:e}))}setRenderer(e){e!==this.renderer&&(this._renderer=e,this.api._onDidRendererChange.fire({renderer:e}))}update(e){var t;this._params=Object.assign(Object.assign({},null!==(t=this._params)&&void 0!==t?t:{}),e.params);for(const t of Object.keys(e.params))void 0===e.params[t]&&delete this._params[t];this.view.update({params:this._params})}updateFromStateModel(e){var t,i,s;this._maximumHeight=e.maximumHeight,this._minimumHeight=e.minimumHeight,this._maximumWidth=e.maximumWidth,this._minimumWidth=e.minimumWidth,this.update({params:null!==(t=e.params)&&void 0!==t?t:{}}),this.setTitle(null!==(i=e.title)&&void 0!==i?i:this.id),this.setRenderer(null!==(s=e.renderer)&&void 0!==s?s:this.accessor.renderer)}updateParentGroup(e,t){this._group=e,this.api.group=this._group;const i=this._group.model.isPanelActive(this),s=this.group.api.isActive&&i;(null==t?void 0:t.skipSetActive)||this.api.isActive!==s&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&i}),this.api.isVisible!==i&&this.api._onDidVisibilityChange.fire({isVisible:i})}runEvents(){const e=this._group.model.isPanelActive(this),t=this.group.api.isActive&&e;this.api.isActive!==t&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&e}),this.api.isVisible!==e&&this.api._onDidVisibilityChange.fire({isVisible:e})}layout(e,t){this.api._onDidDimensionChange.fire({width:e,height:t}),this.view.layout(e,t)}dispose(){this.api.dispose(),this.view.dispose()}}class Dt extends m{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-default-tab",this._content=document.createElement("div"),this._content.className="dv-default-tab-content",this.action=document.createElement("div"),this.action.className="dv-default-tab-action",this.action.appendChild(et({width:"11",height:"11",viewbox:"0 0 28 28",path:"M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z"})),this._element.appendChild(this._content),this._element.appendChild(this.action),this.render()}init(e){this._title=e.title,this.addDisposables(e.api.onDidTitleChange(e=>{this._title=e.title,this.render()}),p(this.action,"pointerdown",e=>{e.preventDefault()}),p(this.action,"click",t=>{t.defaultPrevented||(t.preventDefault(),e.api.close())})),this.render()}render(){var e;this._content.textContent!==this._title&&(this._content.textContent=null!==(e=this._title)&&void 0!==e?e:"")}}class Ct{get content(){return this._content}get tab(){return this._tab}constructor(e,t,i,s){this.accessor=e,this.id=t,this.contentComponent=i,this.tabComponent=s,this._content=this.createContentComponent(this.id,i),this._tab=this.createTabComponent(this.id,s)}createTabRenderer(e){var t;const i=this.createTabComponent(this.id,this.tabComponent);return this._params&&i.init(Object.assign(Object.assign({},this._params),{tabLocation:e})),this._updateEvent&&(null===(t=i.update)||void 0===t||t.call(i,this._updateEvent)),i}init(e){this._params=e,this.content.init(e),this.tab.init(Object.assign(Object.assign({},e),{tabLocation:"header"}))}layout(e,t){var i,s;null===(s=(i=this.content).layout)||void 0===s||s.call(i,e,t)}update(e){var t,i,s,o;this._updateEvent=e,null===(i=(t=this.content).update)||void 0===i||i.call(t,e),null===(o=(s=this.tab).update)||void 0===o||o.call(s,e)}dispose(){var e,t,i,s;null===(t=(e=this.content).dispose)||void 0===t||t.call(e),null===(s=(i=this.tab).dispose)||void 0===s||s.call(i)}createContentComponent(e,t){return this.accessor.options.createComponent({id:e,name:t})}createTabComponent(e,t){const i=null!=t?t:this.accessor.options.defaultTabComponent;if(i){if(this.accessor.options.createTabComponent){const t=this.accessor.options.createTabComponent({id:e,name:i});return t||new Dt}console.warn(`dockview: tabComponent '${t}' was not found. falling back to the default tab.`)}return new Dt}}class xt{constructor(e){this.accessor=e}fromJSON(e,t){var i,s;const o=e.id,n=e.params,r=e.title,a=e.view,h=a?a.content.id:null!==(i=e.contentComponent)&&void 0!==i?i:"unknown",l=a?null===(s=a.tab)||void 0===s?void 0:s.id:e.tabComponent,d=new Ct(this.accessor,o,h,l),p=new wt(o,h,l,this.accessor,new ve(this.accessor),t,d,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return p.init({title:null!=r?r:o,params:null!=n?n:{}}),p}}class yt extends m{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-watermark"}init(e){}}const St=new class{constructor(){this._orderedList=[]}push(e){this._orderedList=[...this._orderedList.filter(t=>t!==e),e],this.update()}destroy(e){this._orderedList=this._orderedList.filter(t=>t!==e),this.update()}update(){for(let e=0;e<this._orderedList.length;e++)this._orderedList[e].setAttribute("aria-level",`${e}`),this._orderedList[e].style.zIndex=`calc(var(--dv-overlay-z-index, 999) + ${2*e})`}};class Gt extends m{set minimumInViewportWidth(e){this.options.minimumInViewportWidth=e}set minimumInViewportHeight(e){this.options.minimumInViewportHeight=e}get element(){return this._element}get isVisible(){return this._isVisible}constructor(e){super(),this.options=e,this._element=document.createElement("div"),this._onDidChange=new d,this.onDidChange=this._onDidChange.event,this._onDidChangeEnd=new d,this.onDidChangeEnd=this._onDidChangeEnd.event,this.addDisposables(this._onDidChange,this._onDidChangeEnd),this._element.className="dv-resize-container",this._isVisible=!0,this.setupResize("top"),this.setupResize("bottom"),this.setupResize("left"),this.setupResize("right"),this.setupResize("topleft"),this.setupResize("topright"),this.setupResize("bottomleft"),this.setupResize("bottomright"),this._element.appendChild(this.options.content),this.options.container.appendChild(this._element),this.setBounds(Object.assign(Object.assign(Object.assign(Object.assign({height:this.options.height,width:this.options.width},"top"in this.options&&{top:this.options.top}),"bottom"in this.options&&{bottom:this.options.bottom}),"left"in this.options&&{left:this.options.left}),"right"in this.options&&{right:this.options.right})),St.push(this._element)}setVisible(e){e!==this.isVisible&&(this._isVisible=e,w(this.element,"dv-hidden",!this.isVisible))}bringToFront(){St.push(this._element)}setBounds(e={}){"number"==typeof e.height&&(this._element.style.height=`${e.height}px`),"number"==typeof e.width&&(this._element.style.width=`${e.width}px`),"top"in e&&"number"==typeof e.top&&(this._element.style.top=`${e.top}px`,this._element.style.bottom="auto",this.verticalAlignment="top"),"bottom"in e&&"number"==typeof e.bottom&&(this._element.style.bottom=`${e.bottom}px`,this._element.style.top="auto",this.verticalAlignment="bottom"),"left"in e&&"number"==typeof e.left&&(this._element.style.left=`${e.left}px`,this._element.style.right="auto",this.horiziontalAlignment="left"),"right"in e&&"number"==typeof e.right&&(this._element.style.right=`${e.right}px`,this._element.style.left="auto",this.horiziontalAlignment="right");const t=this.options.container.getBoundingClientRect(),i=this._element.getBoundingClientRect(),s=Math.max(0,this.getMinimumWidth(i.width)),o=Math.max(0,this.getMinimumHeight(i.height));if("top"===this.verticalAlignment){const e=M(i.top-t.top,-o,Math.max(0,t.height-i.height+o));this._element.style.top=`${e}px`,this._element.style.bottom="auto"}if("bottom"===this.verticalAlignment){const e=M(t.bottom-i.bottom,-o,Math.max(0,t.height-i.height+o));this._element.style.bottom=`${e}px`,this._element.style.top="auto"}if("left"===this.horiziontalAlignment){const e=M(i.left-t.left,-s,Math.max(0,t.width-i.width+s));this._element.style.left=`${e}px`,this._element.style.right="auto"}if("right"===this.horiziontalAlignment){const e=M(t.right-i.right,-s,Math.max(0,t.width-i.width+s));this._element.style.right=`${e}px`,this._element.style.left="auto"}this._onDidChange.fire()}toJSON(){const e=this.options.container.getBoundingClientRect(),t=this._element.getBoundingClientRect(),i={};return"top"===this.verticalAlignment?i.top=parseFloat(this._element.style.top):"bottom"===this.verticalAlignment?i.bottom=parseFloat(this._element.style.bottom):i.top=t.top-e.top,"left"===this.horiziontalAlignment?i.left=parseFloat(this._element.style.left):"right"===this.horiziontalAlignment?i.right=parseFloat(this._element.style.right):i.left=t.left-e.left,i.width=t.width,i.height=t.height,i}setupDrag(e,t={inDragMode:!1}){const i=new v,s=()=>{let e=null;const t=z();i.value=new m({dispose:()=>{t.release()}},p(window,"pointermove",t=>{const i=this.options.container.getBoundingClientRect(),s=t.clientX-i.left,o=t.clientY-i.top;w(this._element,"dv-resize-container-dragging",!0);const n=this._element.getBoundingClientRect();null===e&&(e={x:t.clientX-n.left,y:t.clientY-n.top});const r=Math.max(0,this.getMinimumWidth(n.width)),a=Math.max(0,this.getMinimumHeight(n.height)),h=M(o-e.y,-a,Math.max(0,i.height-n.height+a)),l=M(e.y-o+i.height-n.height,-a,Math.max(0,i.height-n.height+a)),d=M(s-e.x,-r,Math.max(0,i.width-n.width+r)),p=M(e.x-s+i.width-n.width,-r,Math.max(0,i.width-n.width+r)),u={};h<=l?u.top=h:u.bottom=l,d<=p?u.left=d:u.right=p,this.setBounds(u)}),p(window,"pointerup",()=>{w(this._element,"dv-resize-container-dragging",!1),i.dispose(),this._onDidChangeEnd.fire()}))};this.addDisposables(i,p(e,"pointerdown",e=>{e.defaultPrevented?e.preventDefault():S(e)||s()}),p(this.options.content,"pointerdown",e=>{e.defaultPrevented||S(e)||e.shiftKey&&s()}),p(this.options.content,"pointerdown",()=>{St.push(this._element)},!0)),t.inDragMode&&s()}setupResize(e){const t=document.createElement("div");t.className=`dv-resize-handle-${e}`,this._element.appendChild(t);const i=new v;this.addDisposables(i,p(t,"pointerdown",t=>{t.preventDefault();let s=null;const o=z();i.value=new m(p(window,"pointermove",t=>{const i=this.options.container.getBoundingClientRect(),o=this._element.getBoundingClientRect(),n=t.clientY-i.top,r=t.clientX-i.left;let a,h,l,d,p,u;null===s&&(s={originalY:n,originalHeight:o.height,originalX:r,originalWidth:o.width});const c=()=>{const e=s.originalY+s.originalHeight>i.height?Math.max(0,i.height-Gt.MINIMUM_HEIGHT):Math.max(0,s.originalY+s.originalHeight-Gt.MINIMUM_HEIGHT);a=M(n,0,e),l=s.originalY+s.originalHeight-a,h=i.height-a-l},m=()=>{a=s.originalY-s.originalHeight;const e=a<0&&"number"==typeof this.options.minimumInViewportHeight?-a+this.options.minimumInViewportHeight:Gt.MINIMUM_HEIGHT,t=i.height-Math.max(0,a);l=M(n-a,e,t),h=i.height-a-l},v=()=>{const e=s.originalX+s.originalWidth>i.width?Math.max(0,i.width-Gt.MINIMUM_WIDTH):Math.max(0,s.originalX+s.originalWidth-Gt.MINIMUM_WIDTH);d=M(r,0,e),u=s.originalX+s.originalWidth-d,p=i.width-d-u},g=()=>{d=s.originalX-s.originalWidth;const e=d<0&&"number"==typeof this.options.minimumInViewportWidth?-d+this.options.minimumInViewportWidth:Gt.MINIMUM_WIDTH,t=i.width-Math.max(0,d);u=M(r-d,e,t),p=i.width-d-u};switch(e){case"top":c();break;case"bottom":m();break;case"left":v();break;case"right":g();break;case"topleft":c(),v();break;case"topright":c(),g();break;case"bottomleft":m(),v();break;case"bottomright":m(),g()}const _={};a<=h?_.top=a:_.bottom=h,d<=p?_.left=d:_.right=p,_.height=l,_.width=u,this.setBounds(_)}),{dispose:()=>{o.release()}},p(window,"pointerup",()=>{i.dispose(),this._onDidChangeEnd.fire()}))}))}getMinimumWidth(e){return"number"==typeof this.options.minimumInViewportWidth?e-this.options.minimumInViewportWidth:0}getMinimumHeight(e){return"number"==typeof this.options.minimumInViewportHeight?e-this.options.minimumInViewportHeight:0}dispose(){St.destroy(this._element),this._element.remove(),super.dispose()}}Gt.MINIMUM_HEIGHT=20,Gt.MINIMUM_WIDTH=20;class zt extends m{constructor(e,t){super(),this.group=e,this.overlay=t,this.addDisposables(t)}position(e){this.overlay.setBounds(e)}}const At=100,Pt=100,It=100,Tt=300,Et=300;class Ot{constructor(){this.cache=new Map,this.currentFrameId=0,this.rafId=null}getPosition(e){const t=this.cache.get(e);if(t&&t.frameId===this.currentFrameId)return t.rect;this.scheduleFrameUpdate();const i=G(e);return this.cache.set(e,{rect:i,frameId:this.currentFrameId}),i}invalidate(){this.currentFrameId++}scheduleFrameUpdate(){this.rafId||(this.rafId=requestAnimationFrame(()=>{this.currentFrameId++,this.rafId=null}))}}class Vt extends m{constructor(e,t){super(),this.element=e,this.accessor=t,this.map={},this._disposed=!1,this.positionCache=new Ot,this.pendingUpdates=new Set,this.addDisposables(exports.DockviewDisposable.from(()=>{for(const e of Object.values(this.map))e.disposable.dispose(),e.destroy.dispose();this._disposed=!0}))}updateAllPositions(){if(!this._disposed){this.positionCache.invalidate();for(const e of Object.values(this.map))e.panel.api.isVisible&&e.resize&&e.resize()}}detatch(e){if(this.map[e.api.id]){const{disposable:t,destroy:i}=this.map[e.api.id];return t.dispose(),i.dispose(),delete this.map[e.api.id],!0}return!1}attach(e){const{panel:t,referenceContainer:i}=e;if(!this.map[t.api.id]){const e=function(){const e=document.createElement("div");return e.tabIndex=-1,e}();e.className="dv-render-overlay",e.style.visibility="hidden",this.map[t.api.id]={panel:t,disposable:exports.DockviewDisposable.NONE,destroy:exports.DockviewDisposable.NONE,element:e}}const s=this.map[t.api.id].element;t.view.content.element.parentElement!==s&&s.appendChild(t.view.content.element),s.parentElement!==this.element&&this.element.appendChild(s);const o=()=>{const e=t.api.id;this.pendingUpdates.has(e)||(this.pendingUpdates.add(e),requestAnimationFrame(()=>{if(this.pendingUpdates.delete(e),this.isDisposed||!this.map[e])return;const o=this.positionCache.getPosition(i.element),n=this.positionCache.getPosition(this.element),r=o.left-n.left,a=o.top-n.top,h=o.width,l=o.height;s.style.left=`${r}px`,s.style.top=`${a}px`,s.style.width=`${h}px`,s.style.height=`${l}px`,"hidden"===s.style.visibility&&(s.style.visibility=""),w(s,"dv-render-overlay-float","floating"===t.group.api.location.type)}))},n=()=>{t.api.isVisible&&(this.positionCache.invalidate(),o()),s.style.display=t.api.isVisible?"":"none"},r=new v,a=()=>{"floating"===t.api.location.type?queueMicrotask(()=>{const e=this.accessor.floatingGroups.find(e=>e.group===t.api.group);if(!e)return;const i=e.overlay.element,o=()=>{const e=Number(i.getAttribute("aria-level"));s.style.zIndex=`calc(var(--dv-overlay-z-index, 999) + ${2*e+1})`},n=new MutationObserver(()=>{o()});r.value=exports.DockviewDisposable.from(()=>n.disconnect()),n.observe(i,{attributeFilter:["aria-level"],attributes:!0}),o()}):s.style.zIndex=""},h=new m(r,new _e(s,{onDragEnd:e=>{i.dropTarget.dnd.onDragEnd(e)},onDragEnter:e=>{i.dropTarget.dnd.onDragEnter(e)},onDragLeave:e=>{i.dropTarget.dnd.onDragLeave(e)},onDrop:e=>{i.dropTarget.dnd.onDrop(e)},onDragOver:e=>{i.dropTarget.dnd.onDragOver(e)}}),t.api.onDidVisibilityChange(()=>{n()}),t.api.onDidDimensionsChange(()=>{t.api.isVisible&&o()}),t.api.onDidLocationChange(()=>{a()}));return this.map[t.api.id].destroy=exports.DockviewDisposable.from(()=>{var e;t.view.content.element.parentElement===s&&s.removeChild(t.view.content.element),null===(e=s.parentElement)||void 0===e||e.removeChild(s)}),a(),queueMicrotask(()=>{this.isDisposed||n()}),this.map[t.api.id].disposable.dispose(),this.map[t.api.id].disposable=h,this.map[t.api.id].resize=o,s}}function kt(e,t,i,s){return new(i||(i=Promise))(function(o,n){function r(e){try{h(s.next(e))}catch(e){n(e)}}function a(e){try{h(s.throw(e))}catch(e){n(e)}}function h(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(r,a)}h((s=s.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;class Mt extends m{get window(){var e,t;return null!==(t=null===(e=this._window)||void 0===e?void 0:e.value)&&void 0!==t?t:null}constructor(e,t,i){super(),this.target=e,this.className=t,this.options=i,this._onWillClose=new d,this.onWillClose=this._onWillClose.event,this._onDidClose=new d,this.onDidClose=this._onDidClose.event,this._window=null,this.addDisposables(this._onWillClose,this._onDidClose,{dispose:()=>{this.close()}})}dimensions(){if(!this._window)return null;const e=this._window.value.screenX;return{top:this._window.value.screenY,left:e,width:this._window.value.innerWidth,height:this._window.value.innerHeight}}close(){var e,t;this._window&&(this._onWillClose.fire(),null===(t=(e=this.options).onWillClose)||void 0===t||t.call(e,{id:this.target,window:this._window.value}),this._window.disposable.dispose(),this._window=null,this._onDidClose.fire())}open(){return kt(this,void 0,void 0,function*(){var e,t;if(this._window)throw new Error("instance of popout window is already open");const i=`${this.options.url}`,s=Object.entries({top:this.options.top,left:this.options.left,width:this.options.width,height:this.options.height}).map(([e,t])=>`${e}=${t}`).join(","),o=window.open(i,this.target,s);if(!o)return null;const n=new m;this._window={value:o,disposable:n},n.addDisposables(exports.DockviewDisposable.from(()=>{o.close()}),p(window,"beforeunload",()=>{this.close()}));const r=this.createPopoutWindowContainer();return this.className&&r.classList.add(this.className),null===(t=(e=this.options).onDidOpen)||void 0===t||t.call(e,{id:this.target,window:o}),new Promise((e,t)=>{o.addEventListener("unload",e=>{}),o.addEventListener("load",()=>{try{const t=o.document;t.title=document.title,t.body.appendChild(r),function(e,t){const i=Array.from(t);for(const t of i){if(t.href){const i=e.createElement("link");i.href=t.href,i.type=t.type,i.rel="stylesheet",e.head.appendChild(i)}let i=[];try{t.cssRules&&(i=Array.from(t.cssRules).map(e=>e.cssText))}catch(e){console.warn("dockview: failed to access stylesheet rules due to security restrictions",e)}for(const t of i){const i=e.createElement("style");i.appendChild(e.createTextNode(t)),e.head.appendChild(i)}}}(t,window.document.styleSheets),p(o,"beforeunload",()=>{this.close()}),e(r)}catch(e){t(e)}})})})}createPopoutWindowContainer(){const e=document.createElement("div");return e.classList.add("dv-popout-window"),e.id="dv-popout-window",e.style.position="absolute",e.style.width="100%",e.style.height="100%",e.style.top="0px",e.style.left="0px",e}}class Lt extends m{constructor(e){super(),this.accessor=e,this.init()}init(){const e=new Set,t=new Set;this.addDisposables(this.accessor.onDidAddPanel(t=>{if(e.has(t.api.id))throw new Error(`dockview: Invalid event sequence. [onDidAddPanel] called for panel ${t.api.id} but panel already exists`);e.add(t.api.id)}),this.accessor.onDidRemovePanel(t=>{if(!e.has(t.api.id))throw new Error(`dockview: Invalid event sequence. [onDidRemovePanel] called for panel ${t.api.id} but panel does not exists`);e.delete(t.api.id)}),this.accessor.onDidAddGroup(e=>{if(t.has(e.api.id))throw new Error(`dockview: Invalid event sequence. [onDidAddGroup] called for group ${e.api.id} but group already exists`);t.add(e.api.id)}),this.accessor.onDidRemoveGroup(e=>{if(!t.has(e.api.id))throw new Error(`dockview: Invalid event sequence. [onDidRemoveGroup] called for group ${e.api.id} but group does not exists`);t.delete(e.api.id)}))}}class Nt extends m{constructor(e,t=window){super(),this._active=null,this._activeDisposable=new v,this._root=e,this._window=t,this._element=t.document.createElement("div"),this._element.className="dv-popover-anchor",this._element.style.position="relative",this._root.prepend(this._element),this.addDisposables(exports.DockviewDisposable.from(()=>{this.close()}),this._activeDisposable)}updateRoot(e){e.prepend(this._element),this._root=e}openPopover(e,t){var i;this.close();const s=this._window.document.createElement("div");s.style.position="absolute",s.style.zIndex=null!==(i=t.zIndex)&&void 0!==i?i:"var(--dv-overlay-z-index)",s.appendChild(e);const o=this._element.getBoundingClientRect(),n=o.left,r=o.top;s.style.top=t.y-r+"px",s.style.left=t.x-n+"px",this._element.appendChild(s),this._active=s,this._activeDisposable.value=new m(p(this._window,"pointerdown",e=>{var t;const i=e.target;if(!(i instanceof HTMLElement))return;let o=i;for(;o&&o!==s;)o=null!==(t=null==o?void 0:o.parentElement)&&void 0!==t?t:null;o||this.close()}),p(this._window,"keydown",e=>{"Escape"!==e.key&&"Enter"!==e.key||this.close()}),p(this._window,"resize",()=>{this.close()})),this._window.requestAnimationFrame(()=>{!function(e,t,i={buffer:10}){const s=i.buffer,o=e.getBoundingClientRect(),n=t.getBoundingClientRect();let r=0,a=0;const h=o.left-n.left,l=o.top-n.top,d=o.bottom-n.bottom,p=o.right-n.right;h<s?r=s-h:p>s&&(r=-s-p),l<s?a=s-l:d>s&&(a=-d-s),0===r&&0===a||(e.style.transform=`translate(${r}px, ${a}px)`)}(s,this._root)})}close(){this._active&&(this._active.remove(),this._activeDisposable.dispose(),this._active=null)}}function Rt(e){if(!(e instanceof HTMLElement))return;const t=I(e);return(null==t?void 0:t.style.zIndex)?`calc(${t.style.zIndex} * 2)`:void 0}let Wt=0;const Ht=()=>"dv-ctx-menu-item-"+Wt++;function Ft(e){return"object"==typeof e}function Bt(e,t,i,s){const o=document.createElement("div");return o.className="dv-context-menu-item",o.setAttribute("role","menuitem"),s&&(o.classList.add("dv-context-menu-item--disabled"),o.setAttribute("aria-disabled","true")),o.textContent=e,s||o.addEventListener("click",()=>{i(),t()}),o}function $t(){const e=document.createElement("div");return e.className="dv-context-menu-separator",e.setAttribute("role","separator"),e}function Ut(e){const t=document.createElement("div");t.className="dv-context-menu-rename";const i=document.createElement("input");return i.className="dv-context-menu-rename-input",i.type="text",i.placeholder="Name This Group",i.value=e.label,i.addEventListener("input",()=>{e.setLabel(i.value)}),i.addEventListener("keydown",e=>{"Escape"!==e.key&&"Enter"!==e.key&&e.stopPropagation()}),i.addEventListener("click",e=>{e.stopPropagation()}),t.appendChild(i),requestAnimationFrame(()=>{i.focus(),i.select()}),t}function Jt(e,t){const i=document.createElement("div");if(i.className="dv-context-menu-color-picker",!t.enabled)return i;for(const s of t.entries()){const t=document.createElement("div");t.className="dv-context-menu-color-swatch",t.style.setProperty("--dv-tab-group-color",s.value),s.label&&(t.title=s.label),e.color===s.id&&t.classList.add("dv-context-menu-color-swatch--selected"),t.addEventListener("click",()=>{e.setColor(s.id)}),i.appendChild(t)}return i}class jt{constructor(e){this.accessor=e}show(e,t,i){var s,o;if(!this.accessor.options.getTabContextMenuItems)return;const n=this.accessor.options.getTabContextMenuItems({panel:e,group:t,api:this.accessor.api,event:i});if(0===n.length)return;i.preventDefault();const r=this.accessor.getPopupServiceForGroup(t),a=()=>r.close(),h=document.createElement("div");h.className="dv-context-menu",h.setAttribute("role","menu");for(const i of n)if("separator"===i)h.appendChild($t());else if("close"===i)h.appendChild(Bt("Close",a,()=>e.api.close()));else if("closeOthers"===i)h.appendChild(Bt("Close Others",a,()=>{t.panels.filter(t=>t!==e).forEach(e=>e.api.close())}));else if("closeAll"===i)h.appendChild(Bt("Close All",a,()=>{[...t.panels].forEach(e=>e.api.close())}));else if(Ft(i)&&i.element)h.appendChild(i.element);else if(Ft(i)&&i.component){const n=null===(o=(s=this.accessor.options).createContextMenuItemComponent)||void 0===o?void 0:o.call(s,{id:Ht(),component:i.component});n&&(n.init({panel:e,group:t,api:this.accessor.api,close:a,componentProps:i.componentProps}),h.appendChild(n.element))}else Ft(i)&&i.label&&h.appendChild(Bt(i.label,a,()=>{var e;return null===(e=i.action)||void 0===e?void 0:e.call(i)},i.disabled));r.openPopover(h,{x:i.clientX,y:i.clientY,zIndex:Rt(i.target)})}showForChip(e,t,i){if(!this.accessor.options.getTabGroupChipContextMenuItems)return;const s=this.accessor.options.getTabGroupChipContextMenuItems({tabGroup:e,group:t,api:this.accessor.api,event:i});if(0===s.length)return;i.preventDefault();const o=this.accessor.getPopupServiceForGroup(t),n=()=>o.close(),r=document.createElement("div");r.className="dv-context-menu",r.setAttribute("role","menu");for(const t of s)"separator"===t?r.appendChild($t()):"rename"===t?r.appendChild(Ut(e)):"colorPicker"===t?r.appendChild(Jt(e,this.accessor.tabGroupColorPalette)):Ft(t)&&t.element?r.appendChild(t.element):Ft(t)&&t.label&&r.appendChild(Bt(t.label,n,()=>{var e;return null===(e=t.action)||void 0===e?void 0:e.call(t)},t.disabled));o.openPopover(r,{x:i.clientX,y:i.clientY,zIndex:Rt(i.target)})}}class Zt extends m{get disabled(){return this._disabled}set disabled(e){var t;this.disabled!==e&&(this._disabled=e,e&&(null===(t=this.model)||void 0===t||t.clear()))}get model(){if(!this.disabled)return{clear:()=>{var e;this._model&&(null===(e=this._model.root.parentElement)||void 0===e||e.removeChild(this._model.root)),this._model=void 0},exists:()=>!!this._model,getElements:(e,t)=>{const i=this._outline!==t;if(this._outline=t,this._model)return this._model.changed=i,this._model;const s=this.createContainer(),o=this.createAnchor();if(this._model={root:s,overlay:o,changed:i},s.appendChild(o),this.element.appendChild(s),(null==e?void 0:e.target)instanceof HTMLElement){const t=e.target.getBoundingClientRect(),i=this.element.getBoundingClientRect();o.style.left=t.left-i.left+"px",o.style.top=t.top-i.top+"px"}return this._model}}}constructor(e,t){super(),this.element=e,this._disabled=!1,this._disabled=t.disabled,this.addDisposables(exports.DockviewDisposable.from(()=>{var e;null===(e=this.model)||void 0===e||e.clear()}))}createContainer(){const e=document.createElement("div");return e.className="dv-drop-target-container",e}createAnchor(){const e=document.createElement("div");return e.className="dv-drop-target-anchor",e.style.visibility="hidden",e}}class Yt{get minimumSize(){return this._isCollapsed?this._collapsedSize:this._expandedMinimumSize}get maximumSize(){return this._isCollapsed?this._collapsedSize:this._expandedMaximumSize}get element(){return this._group.element}get isCollapsed(){return this._isCollapsed}get lastExpandedSize(){return this._lastExpandedSize}get collapsedSize(){return this._collapsedSize}constructor(e,t,i){var s,o,n;this._onDidChange=new d,this.onDidChange=this._onDidChange.event,this.snap=!1,this.priority=exports.LayoutPriority.Low,this._isCollapsed=!1,this._group=t,this._orientation=i,t.element.classList.add("dv-edge-group"),t.element.dataset.testid=`dv-edge-group-${e.id}`,this._collapsedSize=null!==(s=e.collapsedSize)&&void 0!==s?s:35,this._expandedMaximumSize=null!==(o=e.maximumSize)&&void 0!==o?o:Number.POSITIVE_INFINITY,this._expandedMinimumSize=void 0!==e.minimumSize?e.minimumSize:this._collapsedSize+50,this._lastExpandedSize=null!==(n=e.initialSize)&&void 0!==n?n:200,e.collapsed&&(this._isCollapsed=!0,t.element.classList.add("dv-edge-collapsed"))}layout(e,t){this._isCollapsed||(this._lastExpandedSize=e),"horizontal"===this._orientation?this._group.layout(e,t):this._group.layout(t,e)}setCollapsed(e){this._isCollapsed!==e&&(this._isCollapsed=e,this._group.element.classList.toggle("dv-edge-collapsed",e))}setVisible(e){}restoreExpandedSize(e){this._lastExpandedSize=e}updateCollapsedSize(e,t){this._collapsedSize=e,this._expandedMinimumSize=t}dispose(){this._onDidChange.dispose()}}class Xt{get element(){return this._dockviewElement}constructor(e,t){this._dockviewElement=e,this._layoutDockview=t,this.priority=exports.LayoutPriority.High,this.minimumSize=100,this.maximumSize=Number.POSITIVE_INFINITY,this._onDidChange=new d,this.onDidChange=this._onDidChange.event}layout(e,t){this._layoutDockview(t,e)}setVisible(e){}dispose(){this._onDidChange.dispose()}}class qt{get element(){return this._element}constructor(e,t=0){this._onDidChange=new d,this.onDidChange=this._onDidChange.event,this.minimumSize=100,this.maximumSize=Number.POSITIVE_INFINITY,this.priority=exports.LayoutPriority.High,this._element=document.createElement("div"),this._element.className="dv-shell-middle-column",this._element.style.height="100%",this._element.style.width="100%",this._splitview=new $(this._element,{orientation:exports.Orientation.VERTICAL,proportionalLayout:!1,margin:t}),this._centerIndex=0,this._splitview.addView(e,{type:"distribute"},0)}addTopView(e,t){this._splitview.addView(e,t,0),this._topIndex=0,this._centerIndex+=1,void 0!==this._bottomIndex&&(this._bottomIndex+=1)}addBottomView(e,t){const i=this._splitview.length;this._splitview.addView(e,t,i),this._bottomIndex=i}removeView(e){const t="top"===e?this._topIndex:this._bottomIndex;void 0!==t&&(this._splitview.removeView(t),"top"===e?(this._topIndex=void 0,this._centerIndex-=1,void 0!==this._bottomIndex&&(this._bottomIndex-=1)):this._bottomIndex=void 0)}layout(e,t){this._splitview.layout(t,e)}setVisible(e){}setViewVisible(e,t){const i="top"===e?this._topIndex:this._bottomIndex;void 0!==i&&this._splitview.setViewVisible(i,t)}isViewVisible(e){const t="top"===e?this._topIndex:this._bottomIndex;return void 0!==t&&this._splitview.isViewVisible(t)}getViewSize(e){const t="top"===e?this._topIndex:this._bottomIndex;return void 0!==t?this._splitview.getViewSize(t):0}resizeView(e,t){const i="top"===e?this._topIndex:this._bottomIndex;void 0!==i&&this._splitview.resizeView(i,t)}updateMargin(e){this._splitview.margin=e}dispose(){this._onDidChange.dispose(),this._splitview.dispose()}}class Kt{constructor(e,t,i,s=0,o=35){this._disposables=new m,this._viewConfigs=new Map,this._currentWidth=0,this._currentHeight=0,this._gap=s,this._defaultCollapsedSize=o,this._shellElement=document.createElement("div"),this._shellElement.className="dv-shell",this._shellElement.style.height="100%",this._shellElement.style.width="100%",this._shellElement.style.position="relative",e.appendChild(this._shellElement);const n=new Xt(t,i);this._middleColumn=new qt(n,s),this._outerSplitview=new $(this._shellElement,{orientation:exports.Orientation.HORIZONTAL,proportionalLayout:!1,margin:s}),this._middleIndex=0,this._outerSplitview.addView(this._middleColumn,{type:"distribute"},0),this._disposables.addDisposables(_(this._shellElement,e=>{const{width:t,height:i}=e.contentRect;this._currentWidth=t,this._currentHeight=i,this.layout(t,i)}),this._outerSplitview,this._middleColumn,n)}get element(){return this._shellElement}addEdgeView(e,t,i){if(this.hasEdgeGroup(e))throw new Error(`dockview: edge group already registered at position '${e}'`);this._viewConfigs.set(e,t);const s=1+(this._viewConfigs.has("left")?1:0)+(this._viewConfigs.has("right")?1:0),o=1+(this._viewConfigs.has("top")?1:0)+(this._viewConfigs.has("bottom")?1:0),n=s>1?this._gap*(s-1)/s:0,r=o>1?this._gap*(o-1)/o:0,a="left"===e||"right"===e,h=a?n:r,l=a?"horizontal":"vertical",d=new Yt(function(e,t,i){var s;const o=(null!==(s=e.collapsedSize)&&void 0!==s?s:t)+i,n=Object.assign(Object.assign({},e),{collapsedSize:o});return void 0!==e.minimumSize&&(n.minimumSize=e.minimumSize+i),n}(Object.assign({collapsedSize:this._defaultCollapsedSize},t),this._defaultCollapsedSize,h),i,l),p=d.isCollapsed?d.collapsedSize:d.lastExpandedSize;switch(e){case"left":this._outerSplitview.addView(d,p,0),this._leftIndex=0,this._middleIndex+=1,void 0!==this._rightIndex&&(this._rightIndex+=1),this._leftView=d;break;case"right":{const e=this._outerSplitview.length;this._outerSplitview.addView(d,p,e),this._rightIndex=e,this._rightView=d}break;case"top":this._middleColumn.addTopView(d,p),this._topView=d;break;case"bottom":this._middleColumn.addBottomView(d,p),this._bottomView=d}return this._disposables.addDisposables(d),this.updateTheme(this._gap,this._defaultCollapsedSize),d}layout(e,t){this._outerSplitview.layout(e,t)}updateTheme(e,t){var i,s,o,n;this._gap=e,this._defaultCollapsedSize=t;const r=1+(this._viewConfigs.has("left")?1:0)+(this._viewConfigs.has("right")?1:0),a=1+(this._viewConfigs.has("top")?1:0)+(this._viewConfigs.has("bottom")?1:0),h=r>1?e*(r-1)/r:0,l=a>1?e*(a-1)/a:0;this._outerSplitview.margin=e,this._middleColumn.updateMargin(e);const d=(e,i,s)=>{var o;const n=(null!==(o=i.collapsedSize)&&void 0!==o?o:t)+s,r=i.minimumSize,a=void 0!==r?r+s:n+50;e.updateCollapsedSize(n,a)},p=this._viewConfigs.get("top");this._topView&&p&&d(this._topView,p,l);const u=this._viewConfigs.get("bottom");this._bottomView&&u&&d(this._bottomView,u,l);const c=this._viewConfigs.get("left");this._leftView&&c&&d(this._leftView,c,h);const m=this._viewConfigs.get("right");this._rightView&&m&&d(this._rightView,m,h),(null===(i=this._leftView)||void 0===i?void 0:i.isCollapsed)&&void 0!==this._leftIndex&&this._outerSplitview.resizeView(this._leftIndex,this._leftView.collapsedSize),(null===(s=this._rightView)||void 0===s?void 0:s.isCollapsed)&&void 0!==this._rightIndex&&this._outerSplitview.resizeView(this._rightIndex,this._rightView.collapsedSize),(null===(o=this._topView)||void 0===o?void 0:o.isCollapsed)&&this._middleColumn.resizeView("top",this._topView.collapsedSize),(null===(n=this._bottomView)||void 0===n?void 0:n.isCollapsed)&&this._middleColumn.resizeView("bottom",this._bottomView.collapsedSize),this._currentWidth>0&&this._currentHeight>0&&this.layout(this._currentWidth,this._currentHeight)}removeEdgeView(e){const t=this._getView(e);if(t){switch(e){case"left":this._outerSplitview.removeView(this._leftIndex),this._leftIndex=void 0,this._leftView=void 0,this._middleIndex-=1,void 0!==this._rightIndex&&(this._rightIndex-=1);break;case"right":this._outerSplitview.removeView(this._rightIndex),this._rightIndex=void 0,this._rightView=void 0;break;case"top":this._middleColumn.removeView("top"),this._topView=void 0;break;case"bottom":this._middleColumn.removeView("bottom"),this._bottomView=void 0}this._disposables.removeDisposable(t),t.dispose(),this._viewConfigs.delete(e),this.updateTheme(this._gap,this._defaultCollapsedSize)}}hasEdgeGroup(e){switch(e){case"top":return void 0!==this._topView;case"bottom":return void 0!==this._bottomView;case"left":return void 0!==this._leftView;case"right":return void 0!==this._rightView}}setEdgeGroupVisible(e,t){switch(e){case"left":void 0!==this._leftIndex&&this._outerSplitview.setViewVisible(this._leftIndex,t);break;case"right":void 0!==this._rightIndex&&this._outerSplitview.setViewVisible(this._rightIndex,t);break;case"top":case"bottom":this._middleColumn.setViewVisible(e,t)}}isEdgeGroupVisible(e){switch(e){case"left":return void 0!==this._leftIndex&&this._outerSplitview.isViewVisible(this._leftIndex);case"right":return void 0!==this._rightIndex&&this._outerSplitview.isViewVisible(this._rightIndex);case"top":case"bottom":return this._middleColumn.isViewVisible(e)}}setEdgeGroupCollapsed(e,t){const i=this._getView(e);if(!i)return;i.setCollapsed(t);const s=t?i.collapsedSize:i.lastExpandedSize;switch(e){case"left":void 0!==this._leftIndex&&this._outerSplitview.resizeView(this._leftIndex,s);break;case"right":void 0!==this._rightIndex&&this._outerSplitview.resizeView(this._rightIndex,s);break;case"top":case"bottom":this._middleColumn.resizeView(e,s)}}isEdgeGroupCollapsed(e){var t,i;return null!==(i=null===(t=this._getView(e))||void 0===t?void 0:t.isCollapsed)&&void 0!==i&&i}_getView(e){switch(e){case"top":return this._topView;case"bottom":return this._bottomView;case"left":return this._leftView;case"right":return this._rightView}}toJSON(){const e={};return this._leftView&&void 0!==this._leftIndex&&(e.left={size:this._leftView.isCollapsed?this._leftView.lastExpandedSize:this._outerSplitview.getViewSize(this._leftIndex),visible:this._outerSplitview.isViewVisible(this._leftIndex),collapsed:this._leftView.isCollapsed||void 0}),this._rightView&&void 0!==this._rightIndex&&(e.right={size:this._rightView.isCollapsed?this._rightView.lastExpandedSize:this._outerSplitview.getViewSize(this._rightIndex),visible:this._outerSplitview.isViewVisible(this._rightIndex),collapsed:this._rightView.isCollapsed||void 0}),this._topView&&(e.top={size:this._topView.isCollapsed?this._topView.lastExpandedSize:this._middleColumn.getViewSize("top"),visible:this._middleColumn.isViewVisible("top"),collapsed:this._topView.isCollapsed||void 0}),this._bottomView&&(e.bottom={size:this._bottomView.isCollapsed?this._bottomView.lastExpandedSize:this._middleColumn.getViewSize("bottom"),visible:this._middleColumn.isViewVisible("bottom"),collapsed:this._bottomView.isCollapsed||void 0}),e}fromJSON(e){var t,i,s,o,n,r,a,h,l,d,p,u,c,m,v,g,_,f,b,w;e.left&&void 0!==this._leftIndex&&(null===(t=this._leftView)||void 0===t||t.restoreExpandedSize(e.left.size),null===(i=this._leftView)||void 0===i||i.setCollapsed(null!==(s=e.left.collapsed)&&void 0!==s&&s),this._outerSplitview.resizeView(this._leftIndex,e.left.collapsed&&null!==(n=null===(o=this._leftView)||void 0===o?void 0:o.collapsedSize)&&void 0!==n?n:e.left.size),e.left.visible||this._outerSplitview.setViewVisible(this._leftIndex,!1)),e.right&&void 0!==this._rightIndex&&(null===(r=this._rightView)||void 0===r||r.restoreExpandedSize(e.right.size),null===(a=this._rightView)||void 0===a||a.setCollapsed(null!==(h=e.right.collapsed)&&void 0!==h&&h),this._outerSplitview.resizeView(this._rightIndex,e.right.collapsed&&null!==(d=null===(l=this._rightView)||void 0===l?void 0:l.collapsedSize)&&void 0!==d?d:e.right.size),e.right.visible||this._outerSplitview.setViewVisible(this._rightIndex,!1)),e.top&&(null===(p=this._topView)||void 0===p||p.restoreExpandedSize(e.top.size),null===(u=this._topView)||void 0===u||u.setCollapsed(null!==(c=e.top.collapsed)&&void 0!==c&&c),this._middleColumn.resizeView("top",e.top.collapsed&&null!==(v=null===(m=this._topView)||void 0===m?void 0:m.collapsedSize)&&void 0!==v?v:e.top.size),e.top.visible||this._middleColumn.setViewVisible("top",!1)),e.bottom&&(null===(g=this._bottomView)||void 0===g||g.restoreExpandedSize(e.bottom.size),null===(_=this._bottomView)||void 0===_||_.setCollapsed(null!==(f=e.bottom.collapsed)&&void 0!==f&&f),this._middleColumn.resizeView("bottom",e.bottom.collapsed&&null!==(w=null===(b=this._bottomView)||void 0===b?void 0:b.collapsedSize)&&void 0!==w?w:e.bottom.size),e.bottom.visible||this._middleColumn.setViewVisible("bottom",!1))}dispose(){var e;this._disposables.dispose(),null===(e=this._shellElement.parentElement)||void 0===e||e.removeChild(this._shellElement)}}const Qt={activationSize:{type:"pixels",value:10},size:{type:"pixels",value:20}};function ei(e){const t=e.from.activePanel;[...e.from.panels].map(t=>{const i=e.from.model.removePanel(t);return e.from.model.renderContainer.detatch(t),i}).forEach(i=>{e.to.model.openPanel(i,{skipSetActive:t!==i,skipSetGroupActive:!0})})}class ti extends pe{get orientation(){return this.gridview.orientation}get totalPanels(){return this.panels.length}get panels(){return this.groups.flatMap(e=>e.panels)}get options(){return this._options}get tabGroupColorPalette(){return this._tabGroupColorPalette}get activePanel(){const e=this.activeGroup;if(e)return e.activePanel}get renderer(){var e;return null!==(e=this.options.defaultRenderer)&&void 0!==e?e:"onlyWhenVisible"}get defaultHeaderPosition(){var e;return null!==(e=this.options.defaultHeaderPosition)&&void 0!==e?e:"top"}get api(){return this._api}get floatingGroups(){return this._floatingGroups}get popoutRestorationPromise(){return this._popoutRestorationPromise}constructor(e,t){var i,s,n,r,a,h;super(e,{proportionalLayout:!0,orientation:exports.Orientation.HORIZONTAL,styles:t.hideBorders?{separatorBorder:"transparent"}:void 0,disableAutoResizing:t.disableAutoResizing,locked:t.locked,margin:null!==(s=null===(i=t.theme)||void 0===i?void 0:i.gap)&&void 0!==s?s:0,className:t.className}),this.nextGroupId=L(),this._deserializer=new xt(this),this._watermark=null,this._popoutPopupServices=new Map,this._onWillDragPanel=new d,this.onWillDragPanel=this._onWillDragPanel.event,this._onWillDragGroup=new d,this.onWillDragGroup=this._onWillDragGroup.event,this._onDidDrop=new d,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new d,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new d,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onUnhandledDragOverEvent=new d,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this._onDidRemovePanel=new d,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidAddPanel=new d,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPopoutGroupSizeChange=new d,this.onDidPopoutGroupSizeChange=this._onDidPopoutGroupSizeChange.event,this._onDidPopoutGroupPositionChange=new d,this.onDidPopoutGroupPositionChange=this._onDidPopoutGroupPositionChange.event,this._onDidOpenPopoutWindowFail=new d,this.onDidOpenPopoutWindowFail=this._onDidOpenPopoutWindowFail.event,this._onDidLayoutFromJSON=new d,this.onDidLayoutFromJSON=this._onDidLayoutFromJSON.event,this._onDidActivePanelChange=new d({replay:!0}),this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onDidMovePanel=new d,this.onDidMovePanel=this._onDidMovePanel.event,this._onDidCreateTabGroup=new d,this.onDidCreateTabGroup=this._onDidCreateTabGroup.event,this._onDidDestroyTabGroup=new d,this.onDidDestroyTabGroup=this._onDidDestroyTabGroup.event,this._onDidAddPanelToTabGroup=new d,this.onDidAddPanelToTabGroup=this._onDidAddPanelToTabGroup.event,this._onDidRemovePanelFromTabGroup=new d,this.onDidRemovePanelFromTabGroup=this._onDidRemovePanelFromTabGroup.event,this._onDidTabGroupChange=new d,this.onDidTabGroupChange=this._onDidTabGroupChange.event,this._onDidTabGroupCollapsedChange=new d,this.onDidTabGroupCollapsedChange=this._onDidTabGroupCollapsedChange.event,this._onDidMaximizedGroupChange=new d,this.onDidMaximizedGroupChange=this._onDidMaximizedGroupChange.event,this._inShellLayout=!1,this._edgeGroups=new Map,this._edgeGroupDisposables=new Map,this._floatingGroups=[],this._popoutGroups=[],this._popoutRestorationPromise=Promise.resolve(),this._onDidRemoveGroup=new d,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new d,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidOptionsChange=new d,this.onDidOptionsChange=this._onDidOptionsChange.event,this._onDidActiveGroupChange=new d,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._moving=!1,this._options=t,this._tabGroupColorPalette=function(e){var t;const i=null!==(t=e.tabGroupColors)&&void 0!==t?t:He,s="off"!==e.tabGroupAccent;return new Fe(i,s)}(t),this.popupService=new Nt(this.element),this.contextMenuController=new jt(this),this._api=new ve(this),this.disableResizing=!0,e.removeChild(this.element),this._shellManager=new Kt(e,this.element,(e,t)=>this._layoutFromShell(e,t),null!==(r=null===(n=t.theme)||void 0===n?void 0:n.gap)&&void 0!==r?r:0,null===(a=t.theme)||void 0===a?void 0:a.edgeGroupCollapsedSize),this.popupService.updateRoot(this._shellManager.element),this._shellThemeClassnames=new A(this._shellManager.element),this.rootDropTargetContainer=new Zt(this._shellManager.element,{disabled:!0}),this.overlayRenderContainer=new Vt(this._shellManager.element,this),this._floatingOverlayHost=document.createElement("div"),this._floatingOverlayHost.className="dv-floating-overlay-host",this._shellManager.element.appendChild(this._floatingOverlayHost),this._rootDropTarget=new xe(this.element,{className:"dv-drop-target-edge",canDisplayOverlay:(e,t)=>{const i=o();if(i)return i.viewId===this.id&&("center"!==t||0===this.gridview.length);if("center"===t&&0!==this.gridview.length)return!1;const s=new st(e,"edge",t,o);return this._onUnhandledDragOverEvent.fire(s),s.isAccepted},acceptedTargetZones:["top","bottom","left","right","center"],overlayModel:null!==(h=t.rootOverlayModel)&&void 0!==h?h:Qt,getOverrideTarget:()=>{var e;return null===(e=this.rootDropTargetContainer)||void 0===e?void 0:e.model}}),this.updateDropTargetModel(t),w(this.gridview.element,"dv-dockview",!0),w(this.element,"dv-debug",!!t.debug),this.updateTheme(),this.updateWatermark(),t.debug&&this.addDisposables(new Lt(this)),this.addDisposables(this.rootDropTargetContainer,this.overlayRenderContainer,this._onWillDragPanel,this._onWillDragGroup,this._onWillShowOverlay,this._onDidActivePanelChange,this._onDidAddPanel,this._onDidRemovePanel,this._onDidLayoutFromJSON,this._onDidDrop,this._onWillDrop,this._onDidMovePanel,this._onDidMovePanel.event(()=>{this.debouncedUpdateAllPositions()}),this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this._onUnhandledDragOverEvent,this._onDidMaximizedGroupChange,this._onDidOptionsChange,this._onDidPopoutGroupSizeChange,this._onDidPopoutGroupPositionChange,this._onDidOpenPopoutWindowFail,this._onDidCreateTabGroup,this._onDidDestroyTabGroup,this._onDidAddPanelToTabGroup,this._onDidRemovePanelFromTabGroup,this._onDidTabGroupChange,this._onDidTabGroupCollapsedChange,this.onDidViewVisibilityChangeMicroTaskQueue(()=>{this.updateWatermark()}),this.onDidAdd(e=>{this._moving||this._onDidAddGroup.fire(e)}),this.onDidRemove(e=>{this._moving||this._onDidRemoveGroup.fire(e)}),this.onDidActiveChange(e=>{this._moving||this._onDidActiveGroupChange.fire(e)}),this.onDidMaximizedChange(e=>{this._onDidMaximizedGroupChange.fire({group:e.panel,isMaximized:e.isMaximized})}),exports.DockviewEvent.any(this.onDidAdd,this.onDidRemove)(()=>{this.updateWatermark()}),exports.DockviewEvent.any(this.onDidAddPanel,this.onDidRemovePanel,this.onDidAddGroup,this.onDidRemove,this.onDidRemoveGroup,this.onDidMovePanel,this.onDidActivePanelChange,this.onDidPopoutGroupPositionChange,this.onDidPopoutGroupSizeChange,this.onDidCreateTabGroup,this.onDidDestroyTabGroup,this.onDidAddPanelToTabGroup,this.onDidRemovePanelFromTabGroup,this.onDidTabGroupChange,this.onDidTabGroupCollapsedChange)(()=>{this._bufferOnDidLayoutChange.fire()}),exports.DockviewDisposable.from(()=>{var e;for(const e of[...this._floatingGroups])e.dispose();for(const e of[...this._popoutGroups])e.disposable.dispose();null===(e=this._shellManager)||void 0===e||e.dispose();for(const e of this._edgeGroupDisposables.values())e.dispose();this._edgeGroupDisposables.clear()}),this._rootDropTarget,this._rootDropTarget.onWillShowOverlay(e=>{this.gridview.length>0&&"center"===e.position||this._onWillShowOverlay.fire(new Le(e,{kind:"edge",panel:void 0,api:this._api,group:void 0,getData:o}))}),this._rootDropTarget.onDrop(e=>{var t;const i=new pt({nativeEvent:e.nativeEvent,position:e.position,panel:void 0,api:this._api,group:void 0,getData:o,kind:"edge"});if(this._onWillDrop.fire(i),i.defaultPrevented)return;const s=o();s?this.moveGroupOrPanel({from:{groupId:s.groupId,panelId:null!==(t=s.panelId)&&void 0!==t?t:void 0},to:{group:this.orthogonalize(e.position),position:"center"}}):this._onDidDrop.fire(new dt({nativeEvent:e.nativeEvent,position:e.position,panel:void 0,api:this._api,group:void 0,getData:o}))}),this._rootDropTarget)}setVisible(e,t){switch(e.api.location.type){case"grid":super.setVisible(e,t);break;case"floating":{const i=this.floatingGroups.find(t=>t.group===e);i&&(i.overlay.setVisible(t),e.api._onDidVisibilityChange.fire({isVisible:t}));break}case"popout":console.warn("dockview: You cannot hide a group that is in a popout window")}}getPopupServiceForGroup(e){var t;return null!==(t=this._popoutPopupServices.get(e.id))&&void 0!==t?t:this.popupService}addPopoutGroup(e,t){var i,s,o,n,r;if(e instanceof _t&&"edge"===e.model.location.type)return Promise.resolve(!1);if(e instanceof wt&&1===e.group.size)return this.addPopoutGroup(e.group,t);const a=function(e){function t(e){const t=[];for(let i=0;i<e.classList.length;i++)t.push(e.classList.item(i));return t}let i,s=e;for(;null!==s&&(i=t(s).find(e=>e.startsWith("dockview-theme-")),"string"!=typeof i);)s=s.parentElement;return i}(this.gridview.element),h=this.element;const l=(null==t?void 0:t.position)?t.position:e instanceof _t?e.element.getBoundingClientRect():e.group?e.group.element.getBoundingClientRect():h.getBoundingClientRect(),u=null!==(s=null===(i=null==t?void 0:t.overridePopoutGroup)||void 0===i?void 0:i.id)&&void 0!==s?s:this.getNextGroupId(),c=new Mt(`${this.id}-${u}`,null!=a?a:"",{url:null!==(r=null!==(o=null==t?void 0:t.popoutUrl)&&void 0!==o?o:null===(n=this.options)||void 0===n?void 0:n.popoutUrl)&&void 0!==r?r:"/popout.html",left:window.screenX+l.left,top:window.screenY+l.top,width:l.width,height:l.height,onDidOpen:null==t?void 0:t.onDidOpen,onWillClose:null==t?void 0:t.onWillClose}),v=new m(c,c.onDidClose(()=>{v.dispose()}));return c.open().then(i=>{var s;if(c.isDisposed)return!1;const o=(null==t?void 0:t.referenceGroup)?t.referenceGroup:e instanceof wt?e.group:e,n=e.api.location.type,r=null!==o.element.parentElement;let a;if(r?(null==t?void 0:t.overridePopoutGroup)?a=t.overridePopoutGroup:(a=this.createGroup({id:u}),i&&this._onDidAddGroup.fire(a)):a=o,null===i)return console.error("dockview: failed to create popout. perhaps you need to allow pop-ups for this website"),v.dispose(),this._onDidOpenPopoutWindowFail.fire(),this.movingLock(()=>ei({from:a,to:o})),o.api.isVisible||o.api.setVisible(!0),!1;const h=document.createElement("div");h.className="dv-overlay-render-container";const l=new Vt(h,this);let g;if(a.model.renderContainer=l,a.layout(c.window.innerWidth,c.window.innerHeight),!(null==t?void 0:t.overridePopoutGroup)&&r)if(e instanceof wt)this.movingLock(()=>{const t=o.model.removePanel(e);a.model.openPanel(t)});else switch(this.movingLock(()=>ei({from:o,to:a})),n){case"grid":o.api.setVisible(!1);break;case"floating":case"popout":g=null===(s=this._floatingGroups.find(t=>t.group.api.id===e.api.id))||void 0===s?void 0:s.overlay.toJSON(),this.removeGroup(o)}i.classList.add("dv-dockview"),i.style.overflow="hidden",i.appendChild(h),i.appendChild(a.element);const _=document.createElement("div"),f=new Zt(_,{disabled:this.rootDropTargetContainer.disabled});i.appendChild(_),a.model.dropTargetContainer=f;const b=new Nt(i,c.window);let w;this._popoutPopupServices.set(a.id,b),v.addDisposables(b,exports.DockviewDisposable.from(()=>{this._popoutPopupServices.delete(a.id)})),a.model.location={type:"popout",getWindow:()=>c.window,popoutUrl:null==t?void 0:t.popoutUrl},r&&"grid"===e.api.location.type&&e.api.setVisible(!1),this.doSetGroupAndPanelActive(a),v.addDisposables(a.api.onDidActiveChange(e=>{var t;e.isActive&&(null===(t=c.window)||void 0===t||t.focus())}),a.api.onWillFocus(()=>{var e;null===(e=c.window)||void 0===e||e.focus()}));const D=r&&o&&this.getPanel(o.id),C={window:c,popoutGroup:a,referenceGroup:D?o.id:void 0,disposable:{dispose:()=>(v.dispose(),w)}},x=function(e){const t=new d;let i,s=e.screenX,o=e.screenY;const n=()=>{if(e.closed)return;const r=e.screenX,a=e.screenY;r===s&&a===o||(clearTimeout(i),i=setTimeout(()=>{t.fire()},100),s=r,o=a),requestAnimationFrame(n)};return n(),t}(c.window);return v.addDisposables(x,function(e,t){let i;return new m(p(e,"resize",()=>{clearTimeout(i),i=setTimeout(()=>{t()},100)}))}(c.window,()=>{this._onDidPopoutGroupSizeChange.fire({width:c.window.innerWidth,height:c.window.innerHeight,group:a})}),x.event(()=>{this._onDidPopoutGroupPositionChange.fire({screenX:c.window.screenX,screenY:c.window.screenX,group:a})}),p(c.window,"resize",()=>{a.layout(c.window.innerWidth,c.window.innerHeight)}),l,exports.DockviewDisposable.from(()=>{if(!this.isDisposed)if(r&&this.getPanel(o.id))this.movingLock(()=>ei({from:a,to:o})),o.api.isVisible||o.api.setVisible(!0),this.getPanel(a.id)&&this.doRemoveGroup(a,{skipPopoutAssociated:!0});else if(this.getPanel(a.id)){a.model.renderContainer=this.overlayRenderContainer,a.model.dropTargetContainer=this.rootDropTargetContainer,w=a;if(!this._popoutGroups.find(e=>e.popoutGroup===a))return;g?this.addFloatingGroup(a,{height:g.height,width:g.width,position:g}):(this.doRemoveGroup(a,{skipDispose:!0,skipActive:!0,skipPopoutReturn:!0}),a.model.location={type:"grid"},this.movingLock(()=>{this.doAddGroup(a,[0])})),this.doSetGroupAndPanelActive(a)}})),this._popoutGroups.push(C),this.updateWatermark(),!0}).catch(e=>(console.error("dockview: failed to create popout.",e),!1))}addFloatingGroup(e,t){var i,s,o,n,r,a;if(e instanceof _t&&"edge"===e.model.location.type)return;let h;if(e instanceof wt)h=this.createGroup(),this._onDidAddGroup.fire(h),this.movingLock(()=>this.removePanel(e,{removeEmptyGroup:!0,skipDispose:!0,skipSetActiveGroup:!0})),this.movingLock(()=>h.model.openPanel(e,{skipSetGroupActive:!0}));else{h=e;const s=null===(i=this._popoutGroups.find(e=>e.popoutGroup===h))||void 0===i?void 0:i.referenceGroup,o=s?this.getPanel(s):void 0;"boolean"==typeof(null==t?void 0:t.skipRemoveGroup)&&t.skipRemoveGroup||(o?(this.movingLock(()=>ei({from:e,to:o})),this.doRemoveGroup(e,{skipPopoutReturn:!0,skipPopoutAssociated:!0}),this.doRemoveGroup(o,{skipDispose:!0}),h=o):this.doRemoveGroup(e,{skipDispose:!0,skipPopoutReturn:!0,skipPopoutAssociated:!1}))}const l=function(){if(null==t?void 0:t.position){const e={};return"left"in t.position?e.left=Math.max(t.position.left,0):"right"in t.position?e.right=Math.max(t.position.right,0):e.left=Pt,"top"in t.position?e.top=Math.max(t.position.top,0):"bottom"in t.position?e.bottom=Math.max(t.position.bottom,0):e.top=It,"number"==typeof t.width?e.width=Math.max(t.width,0):e.width=Tt,"number"==typeof t.height?e.height=Math.max(t.height,0):e.height=Et,e}return{left:"number"==typeof(null==t?void 0:t.x)?Math.max(t.x,0):Pt,top:"number"==typeof(null==t?void 0:t.y)?Math.max(t.y,0):It,width:"number"==typeof(null==t?void 0:t.width)?Math.max(t.width,0):Tt,height:"number"==typeof(null==t?void 0:t.height)?Math.max(t.height,0):Et}}(),d=new Gt(Object.assign(Object.assign({container:null!==(s=this._floatingOverlayHost)&&void 0!==s?s:this.gridview.element,content:h.element},l),{minimumInViewportWidth:"boundedWithinViewport"===this.options.floatingGroupBounds?void 0:null!==(n=null===(o=this.options.floatingGroupBounds)||void 0===o?void 0:o.minimumWidthWithinViewport)&&void 0!==n?n:At,minimumInViewportHeight:"boundedWithinViewport"===this.options.floatingGroupBounds?void 0:null!==(a=null===(r=this.options.floatingGroupBounds)||void 0===r?void 0:r.minimumHeightWithinViewport)&&void 0!==a?a:At})),p=h.element.querySelector(".dv-void-container");if(!p)throw new Error("dockview: failed to find drag handle");d.setupDrag(p,{inDragMode:"boolean"==typeof(null==t?void 0:t.inDragMode)&&t.inDragMode});const u=new zt(h,d),c=new m(h.api.onDidActiveChange(e=>{e.isActive&&d.bringToFront()}),_(h.element,e=>{const{width:t,height:i}=e.contentRect;h.layout(t,i)}));u.addDisposables(d.onDidChange(()=>{h.layout(h.width,h.height)}),d.onDidChangeEnd(()=>{this._bufferOnDidLayoutChange.fire()}),h.onDidChange(e=>{d.setBounds({height:null==e?void 0:e.height,width:null==e?void 0:e.width})}),{dispose:()=>{c.dispose(),k(this._floatingGroups,u),h.model.location={type:"grid"},this.updateWatermark()}}),this._floatingGroups.push(u),h.model.location={type:"floating"},(null==t?void 0:t.skipActiveGroup)||this.doSetGroupAndPanelActive(h),this.updateWatermark()}orthogonalize(e,t){switch(this.gridview.normalize(),e){case"top":case"bottom":this.gridview.orientation===exports.Orientation.HORIZONTAL&&this.gridview.insertOrthogonalSplitviewAtRoot();break;case"left":case"right":this.gridview.orientation===exports.Orientation.VERTICAL&&this.gridview.insertOrthogonalSplitviewAtRoot()}switch(e){case"top":case"left":case"center":return this.createGroupAtLocation([0],void 0,t);case"bottom":case"right":return this.createGroupAtLocation([this.gridview.length],void 0,t);default:throw new Error(`dockview: unsupported position ${e}`)}}updateOptions(e){var t,i,s;if(super.updateOptions(e),"floatingGroupBounds"in e)for(const s of this._floatingGroups){switch(e.floatingGroupBounds){case"boundedWithinViewport":s.overlay.minimumInViewportHeight=void 0,s.overlay.minimumInViewportWidth=void 0;break;case void 0:s.overlay.minimumInViewportHeight=At,s.overlay.minimumInViewportWidth=At;break;default:s.overlay.minimumInViewportHeight=null===(t=e.floatingGroupBounds)||void 0===t?void 0:t.minimumHeightWithinViewport,s.overlay.minimumInViewportWidth=null===(i=e.floatingGroupBounds)||void 0===i?void 0:i.minimumWidthWithinViewport}s.overlay.setBounds()}this.updateDropTargetModel(e);const o=this.options.disableDnd;this._options=Object.assign(Object.assign({},this.options),e);if(o!==this.options.disableDnd&&this.updateDragAndDropState(),"theme"in e&&this.updateTheme(),"createRightHeaderActionComponent"in e||"createLeftHeaderActionComponent"in e||"createPrefixHeaderActionComponent"in e)for(const e of this.groups)e.model.updateHeaderActions();if("tabGroupColors"in e||"tabGroupAccent"in e){this._tabGroupColorPalette.setEntries(null!==(s=this._options.tabGroupColors)&&void 0!==s?s:He),this._tabGroupColorPalette.enabled="off"!==this._options.tabGroupAccent;for(const e of this.groups)e.model.refreshTabGroupAccent()}this._onDidOptionsChange.fire(),this._layoutFromShell(this.gridview.width,this.gridview.height)}layout(e,t,i){if(this._shellManager&&!this._inShellLayout?this._shellManager.layout(e,t):super.layout(e,t,i),this._syncFloatingOverlayHost(),this._floatingGroups)for(const e of this._floatingGroups)e.overlay.setBounds()}_syncFloatingOverlayHost(){if(!this._floatingOverlayHost||!this._shellManager)return;const e=this._shellManager.element.getBoundingClientRect(),t=this.element.getBoundingClientRect(),i=this._floatingOverlayHost;i.style.left=t.left-e.left+"px",i.style.top=t.top-e.top+"px",i.style.width=`${t.width}px`,i.style.height=`${t.height}px`}_layoutFromShell(e,t){this._inShellLayout=!0,this.layout(e,t,!0),this._inShellLayout=!1}forceRelayout(){this._shellManager?this._layoutFromShell(this.width,this.height):super.forceRelayout()}addEdgeGroup(e,t){if(this._edgeGroups.has(e))throw new Error(`dockview: edge group already exists at position '${e}'`);const i=this.createGroup({id:t.id});i.model.location={type:"edge",position:e},i.model.headerPosition=e,this._edgeGroups.set(e,i),this._onDidAddGroup.fire(i);const s=i.model.onDidRemovePanel(()=>{i.model.isEmpty&&this._shellManager.setEdgeGroupCollapsed(e,!0)});return this._edgeGroupDisposables.set(e,s),this._shellManager.addEdgeView(e,t,i),i.api}getEdgeGroup(e){var t;return null===(t=this._edgeGroups.get(e))||void 0===t?void 0:t.api}setEdgeGroupVisible(e,t){this._shellManager.setEdgeGroupVisible(e,t)}isEdgeGroupVisible(e){return this._shellManager.isEdgeGroupVisible(e)}removeEdgeGroup(e){var t;const i=this._edgeGroups.get(e);if(!i)throw new Error(`dockview: no edge group exists at position '${e}'`);for(const e of[...i.panels])this.removePanel(e,{removeEmptyGroup:!1,skipDispose:!1});null===(t=this._edgeGroupDisposables.get(e))||void 0===t||t.dispose(),this._edgeGroupDisposables.delete(e),this._shellManager.removeEdgeView(e),this._edgeGroups.delete(e),i.dispose(),this._groups.delete(i.id),this._onDidRemoveGroup.fire(i)}setEdgeGroupCollapsed(e,t){for(const[i,s]of this._edgeGroups)if(s===e)return this._shellManager.setEdgeGroupCollapsed(i,t),void s.api._onDidCollapsedChange.fire({isCollapsed:t})}isEdgeGroupCollapsed(e){for(const[t,i]of this._edgeGroups)if(i===e)return this._shellManager.isEdgeGroupCollapsed(t);return!1}updateDragAndDropState(){for(const e of this.groups)e.model.updateDragAndDropState()}focus(){var e;null===(e=this.activeGroup)||void 0===e||e.focus()}getGroupPanel(e){return this.panels.find(t=>t.id===e)}setActivePanel(e){e.group.model.openPanel(e),this.doSetGroupAndPanelActive(e.group)}moveToNext(e={}){var t;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.activePanel!==e.group.panels[e.group.panels.length-1])return void e.group.model.moveToNext({suppressRoll:!0});const i=Q(e.group.element),s=null===(t=this.gridview.next(i))||void 0===t?void 0:t.view;this.doSetGroupAndPanelActive(s)}moveToPrevious(e={}){var t;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.activePanel!==e.group.panels[0])return void e.group.model.moveToPrevious({suppressRoll:!0});const i=Q(e.group.element),s=null===(t=this.gridview.previous(i))||void 0===t?void 0:t.view;s&&this.doSetGroupAndPanelActive(s)}toJSON(){var e;const t=this.gridview.serialize(),i=this.panels.reduce((e,t)=>(e[t.id]=t.toJSON(),e),{}),s=this._floatingGroups.map(e=>({data:e.group.toJSON(),position:e.overlay.toJSON()})),o=this._popoutGroups.map(e=>({data:e.popoutGroup.toJSON(),gridReferenceGroup:e.referenceGroup,position:e.window.dimensions(),url:"popout"===e.popoutGroup.api.location.type?e.popoutGroup.api.location.popoutUrl:void 0})),n={grid:t,panels:i,activeGroup:null===(e=this.activeGroup)||void 0===e?void 0:e.id};if(s.length>0&&(n.floatingGroups=s),o.length>0&&(n.popoutGroups=o),this._edgeGroups.size>0){const e=this._shellManager.toJSON();for(const[t,i]of this._edgeGroups){const s=e[t];s&&(s.group=i.toJSON())}n.edgeGroups=e}return n}fromJSON(e,t){var i,s,o;const n=new Map;let r;if(null==t?void 0:t.reuseExistingPanels){r=this.createGroup(),this._groups.delete(r.api.id);const t=Object.keys(e.panels);for(const e of this.panels)t.includes(e.api.id)&&n.set(e.api.id,e);this.movingLock(()=>{Array.from(n.values()).forEach(e=>{this.moveGroupOrPanel({from:{groupId:e.api.group.api.id,panelId:e.api.id},to:{group:r,position:"center"},keepEmptyGroups:!0})})})}if(this.clear(),"object"!=typeof e||null===e)throw new Error("dockview: serialized layout must be a non-null object");const{grid:a,panels:h,activeGroup:l}=e;if("branch"!==a.root.type||!Array.isArray(a.root.data))throw new Error("dockview: root must be of type branch");try{const t=this.width,d=this.height,p=e=>{const{id:t,locked:i,hideHeader:s,headerPosition:o,views:a,activeView:l}=e;if("string"!=typeof t)throw new Error("dockview: group id must be of type string");const d=this.createGroup({id:t,locked:!!i,hideHeader:!!s,headerPosition:o});this._onDidAddGroup.fire(d);const p=[];for(const e of a){const t=n.get(e);if(r&&t)this.movingLock(()=>{r.model.removePanel(t)}),p.push(t),t.updateFromStateModel(h[e]);else{const t=this._deserializer.fromJSON(h[e],d);p.push(t)}}for(let e=0;e<a.length;e++){const t=p[e],i="string"==typeof l&&l===t.id;n.has(t.api.id)?this.movingLock(()=>{d.model.openPanel(t,{skipSetActive:!i,skipSetGroupActive:!0})}):d.model.openPanel(t,{skipSetActive:!i,skipSetGroupActive:!0})}return e.tabGroups&&e.tabGroups.length>0&&d.model.restoreTabGroups(e.tabGroups),!d.activePanel&&d.panels.length>0&&d.model.openPanel(d.panels[d.panels.length-1],{skipSetGroupActive:!0}),d};if(this.gridview.deserialize(a,{fromJSON:e=>p(e.data)}),this._layoutFromShell(t,d),e.edgeGroups){for(const t of["top","bottom","left","right"]){const s=e.edgeGroups[t];if(s&&!this._edgeGroups.has(t)){const e=s.group,o=null!==(i=null==e?void 0:e.id)&&void 0!==i?i:`${t}-group`;this.addEdgeGroup(t,{id:o})}}for(const[t,i]of this._edgeGroups){const s=e.edgeGroups[t],o=null==s?void 0:s.group;if(o){const{views:e,activeView:t}=o,s=[];for(const t of e)if(h[t]){const e=this._deserializer.fromJSON(h[t],i);s.push(e)}for(let e=0;e<s.length;e++){const o=s[e],n=t===o.id;i.model.openPanel(o,{skipSetActive:!n,skipSetGroupActive:!0})}o.tabGroups&&o.tabGroups.length>0&&i.model.restoreTabGroups(o.tabGroups),!i.activePanel&&i.panels.length>0&&i.model.openPanel(i.panels[i.panels.length-1],{skipSetGroupActive:!0})}}this._shellManager.fromJSON(e.edgeGroups)}const u=null!==(s=e.floatingGroups)&&void 0!==s?s:[];for(const e of u){const{data:t,position:i}=e,s=p(t);this.addFloatingGroup(s,{position:i,width:i.width,height:i.height,skipRemoveGroup:!0,inDragMode:!1})}const c=null!==(o=e.popoutGroups)&&void 0!==o?o:[],m=[];c.forEach((e,t)=>{const{data:i,position:s,gridReferenceGroup:o,url:n}=e,r=p(i),a=new Promise(e=>{setTimeout(()=>{this.addPopoutGroup(r,{position:null!=s?s:void 0,overridePopoutGroup:o?r:void 0,referenceGroup:o?this.getPanel(o):void 0,popoutUrl:n}),e()},100*t)});m.push(a)}),this._popoutRestorationPromise=Promise.all(m).then(()=>{});for(const e of this._floatingGroups)e.overlay.setBounds();if("string"==typeof l){const e=this.getPanel(l);e&&this.doSetGroupAndPanelActive(e)}}catch(e){console.error("dockview: failed to deserialize layout. Reverting changes",e);for(const e of this.groups)for(const t of e.panels)this.removePanel(t,{removeEmptyGroup:!1,skipDispose:!1});for(const e of this.groups)e.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e);for(const e of[...this._floatingGroups])e.dispose();throw this.clear(),e}this.updateWatermark(),this.debouncedUpdateAllPositions(),this._onDidLayoutFromJSON.fire()}clear(){const e=Array.from(this._groups.values()).map(e=>e.value),t=!!this.activeGroup;for(const t of e){if([...this._edgeGroups.values()].includes(t)){const e=[...t.panels];for(const t of e)this.removePanel(t,{removeEmptyGroup:!1});continue}this.removeGroup(t,{skipActive:!0})}t&&this.doSetGroupAndPanelActive(void 0),this.gridview.clear()}closeAllGroups(){for(const e of this._groups.entries()){const[t,i]=e;i.value.model.closeAllPanels()}}addPanel(e){var t,i;if(this.panels.find(t=>t.id===e.id))throw new Error(`dockview: panel with id ${e.id} already exists`);let s;if(e.position&&e.floating)throw new Error("dockview: you can only provide one of: position, floating as arguments to .addPanel(...)");const o={width:e.initialWidth,height:e.initialHeight};let n,r;if(e.position)if(nt(e.position)){const t="string"==typeof e.position.referencePanel?this.getGroupPanel(e.position.referencePanel):e.position.referencePanel;if(n=e.position.index,!t)throw new Error(`dockview: referencePanel '${e.position.referencePanel}' does not exist`);s=this.findGroup(t)}else{if(!rt(e.position)){const t=this.orthogonalize(be(e.position.direction)),i=this.createPanel(e,t);return t.model.openPanel(i,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:n}),e.inactive||this.doSetGroupAndPanelActive(t),t.api.setSize({height:null==o?void 0:o.height,width:null==o?void 0:o.width}),i}if(s="string"==typeof e.position.referenceGroup?null===(t=this._groups.get(e.position.referenceGroup))||void 0===t?void 0:t.value:e.position.referenceGroup,n=e.position.index,!s)throw new Error(`dockview: referenceGroup '${e.position.referenceGroup}' does not exist`)}else s=this.activeGroup;if(s){const t=de((null===(i=e.position)||void 0===i?void 0:i.direction)||"within");if(e.floating){const t=this.createGroup();this._onDidAddGroup.fire(t);const i="object"==typeof e.floating&&null!==e.floating?e.floating:{};this.addFloatingGroup(t,Object.assign(Object.assign({},i),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),r=this.createPanel(e,t),t.model.openPanel(r,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:n})}else if("floating"===s.api.location.type||"edge"===s.api.location.type||"center"===t)r=this.createPanel(e,s),s.model.openPanel(r,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:n}),s.api.setSize({width:null==o?void 0:o.width,height:null==o?void 0:o.height}),e.inactive||this.doSetGroupAndPanelActive(s);else{const i=Q(s.element),a=ee(this.gridview.orientation,i,t),h=this.createGroupAtLocation(a,this.orientationAtLocation(a)===exports.Orientation.VERTICAL?null==o?void 0:o.height:null==o?void 0:o.width);r=this.createPanel(e,h),h.model.openPanel(r,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:n}),e.inactive||this.doSetGroupAndPanelActive(h)}}else if(e.floating){const t=this.createGroup();this._onDidAddGroup.fire(t);const i="object"==typeof e.floating&&null!==e.floating?e.floating:{};this.addFloatingGroup(t,Object.assign(Object.assign({},i),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),r=this.createPanel(e,t),t.model.openPanel(r,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:n})}else{const t=this.createGroupAtLocation([0],this.gridview.orientation===exports.Orientation.VERTICAL?null==o?void 0:o.height:null==o?void 0:o.width);r=this.createPanel(e,t),t.model.openPanel(r,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:n}),e.inactive||this.doSetGroupAndPanelActive(t)}return r}removePanel(e,t={removeEmptyGroup:!0}){const i=e.group;if(!i)throw new Error(`dockview: cannot remove panel ${e.id}. it's missing a group.`);i.model.removePanel(e,{skipSetActiveGroup:t.skipSetActiveGroup}),t.skipDispose||(e.group.model.renderContainer.detatch(e),e.dispose()),0===i.size&&t.removeEmptyGroup&&this.removeGroup(i,{skipActive:t.skipSetActiveGroup})}createWatermarkComponent(){return this.options.createWatermarkComponent?this.options.createWatermarkComponent():new yt}updateWatermark(){var e,t,i;if(0===this.groups.filter(e=>"grid"===e.api.location.type&&e.api.isVisible).length){if(!this._watermark){this._watermark=this.createWatermarkComponent(),this._watermark.init({containerApi:new ve(this)});const e=document.createElement("div");e.className="dv-watermark-container",i="watermark-component",e.setAttribute("data-testid",i),e.appendChild(this._watermark.element),this.gridview.element.appendChild(e)}}else this._watermark&&(this._watermark.element.parentElement.remove(),null===(t=(e=this._watermark).dispose)||void 0===t||t.call(e),this._watermark=null)}addGroup(e){var t;if(e){let i;if(at(e)){const t="string"==typeof e.referencePanel?this.panels.find(t=>t.id===e.referencePanel):e.referencePanel;if(!t)throw new Error(`dockview: reference panel ${e.referencePanel} does not exist`);if(i=this.findGroup(t),!i)throw new Error(`dockview: reference group for reference panel ${e.referencePanel} does not exist`)}else{if(!ht(e)){const t=this.orthogonalize(be(e.direction),e);return e.skipSetActive||this.doSetGroupAndPanelActive(t),t}if(i="string"==typeof e.referenceGroup?null===(t=this._groups.get(e.referenceGroup))||void 0===t?void 0:t.value:e.referenceGroup,!i)throw new Error(`dockview: reference group ${e.referenceGroup} does not exist`)}const s=de(e.direction||"within"),o=Q(i.element),n=ee(this.gridview.orientation,o,s),r=this.createGroup(e),a=this.getLocationOrientation(n)===exports.Orientation.VERTICAL?e.initialHeight:e.initialWidth;return this.doAddGroup(r,n,a),e.skipSetActive||this.doSetGroupAndPanelActive(r),r}{const t=this.createGroup(e);return this.doAddGroup(t),this.doSetGroupAndPanelActive(t),t}}getLocationOrientation(e){return e.length%2==0&&this.gridview.orientation===exports.Orientation.HORIZONTAL?exports.Orientation.HORIZONTAL:exports.Orientation.VERTICAL}removeGroup(e,t){this.doRemoveGroup(e,t)}doRemoveGroup(e,t){var i;if([...this._edgeGroups.values()].includes(e))return e;const s=[...e.panels];if(!(null==t?void 0:t.skipDispose))for(const e of s)this.removePanel(e,{removeEmptyGroup:!1,skipDispose:null!==(i=null==t?void 0:t.skipDispose)&&void 0!==i&&i});const o=this.activePanel;if("floating"===e.api.location.type){const i=this._floatingGroups.find(t=>t.group===e);if(i){if((null==t?void 0:t.skipDispose)||(i.group.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e)),k(this._floatingGroups,i),i.dispose(),!(null==t?void 0:t.skipActive)&&this._activeGroup===e){const e=Array.from(this._groups.values());this.doSetGroupAndPanelActive(e.length>0?e[0].value:void 0)}return i.group}throw new Error("dockview: failed to find floating group")}if("popout"===e.api.location.type){const i=this._popoutGroups.find(t=>t.popoutGroup===e);if(i){if(!(null==t?void 0:t.skipDispose)){if(!(null==t?void 0:t.skipPopoutAssociated)){const e=i.referenceGroup?this.getPanel(i.referenceGroup):void 0;e&&0===e.panels.length&&this.removeGroup(e)}i.popoutGroup.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e)}k(this._popoutGroups,i);const s=i.disposable.dispose();if(!(null==t?void 0:t.skipPopoutReturn)&&s&&(this.doAddGroup(s,[0]),this.doSetGroupAndPanelActive(s)),!(null==t?void 0:t.skipActive)&&this._activeGroup===e){const e=Array.from(this._groups.values());this.doSetGroupAndPanelActive(e.length>0?e[0].value:void 0)}return this.updateWatermark(),i.popoutGroup}throw new Error("dockview: failed to find popout group")}const n=super.doRemoveGroup(e,t);return(null==t?void 0:t.skipActive)||this.activePanel!==o&&this._onDidActivePanelChange.fire(this.activePanel),n}debouncedUpdateAllPositions(){void 0!==this._updatePositionsFrameId&&cancelAnimationFrame(this._updatePositionsFrameId),this._updatePositionsFrameId=requestAnimationFrame(()=>{this._updatePositionsFrameId=void 0,this.overlayRenderContainer.updateAllPositions()})}movingLock(e){const t=this._moving;try{return this._moving=!0,e()}finally{this._moving=t}}moveGroupOrPanel(e){var t;const i=e.to.group,s=e.from.groupId,o=e.from.panelId,n=e.to.position,r=e.to.index,a=s?null===(t=this._groups.get(s))||void 0===t?void 0:t.value:void 0;if(!a)throw new Error(`dockview: Failed to find group id ${s}`);if(void 0!==o)if(n&&"center"!==n){const e=Q(i.element),t=ee(this.gridview.orientation,e,n);if(a.size<2){const[e,s]=T(t);if("grid"===a.api.location.type){const t=Q(a.element),[i,n]=T(t);if(E(i,e))return this.gridview.moveView(i,n,s),void this._onDidMovePanel.fire({panel:this.getGroupPanel(o),from:a})}if("popout"===a.api.location.type){const e=this._popoutGroups.find(e=>e.popoutGroup===a),i=this.movingLock(()=>e.popoutGroup.model.removePanel(e.popoutGroup.panels[0],{skipSetActive:!0,skipSetActiveGroup:!0}));this.doRemoveGroup(a,{skipActive:!0});const s=this.createGroupAtLocation(t);return this.movingLock(()=>s.model.openPanel(i,{skipSetActive:!0})),this.doSetGroupAndPanelActive(s),void this._onDidMovePanel.fire({panel:this.getGroupPanel(o),from:a})}if("edge"===a.api.location.type){const e=this.movingLock(()=>a.model.removePanel(o,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!e)throw new Error(`dockview: No panel with id ${o}`);const i=this.createGroupAtLocation(t);return this.movingLock(()=>i.model.openPanel(e,{skipSetGroupActive:!0})),this.doSetGroupAndPanelActive(i),void this._onDidMovePanel.fire({panel:e,from:a})}const r=this.movingLock(()=>this.doRemoveGroup(a,{skipActive:!0,skipDispose:!0})),h=Q(i.element),l=ee(this.gridview.orientation,h,n);this.movingLock(()=>this.doAddGroup(r,l)),this.doSetGroupAndPanelActive(r),this._onDidMovePanel.fire({panel:this.getGroupPanel(o),from:a})}else{const t=this.movingLock(()=>a.model.removePanel(o,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!t)throw new Error(`dockview: No panel with id ${o}`);const i=ee(this.gridview.orientation,e,n),s=this.createGroupAtLocation(i);this.movingLock(()=>s.model.openPanel(t,{skipSetGroupActive:!0})),this.doSetGroupAndPanelActive(s),this._onDidMovePanel.fire({panel:t,from:a})}}else{const t=this.movingLock(()=>a.model.removePanel(o,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!t)throw new Error(`dockview: No panel with id ${o}`);e.keepEmptyGroups||0!==a.model.size||this.doRemoveGroup(a,{skipActive:!0});const s=0===i.model.size;this.movingLock(()=>{var o;return i.model.openPanel(t,{index:r,skipSetActive:null!==(o=e.skipSetActive)&&void 0!==o&&o&&!s,skipSetGroupActive:!0})}),e.skipSetActive||this.doSetGroupAndPanelActive(i),this._onDidMovePanel.fire({panel:t,from:a})}else e.from.tabGroupId?this.moveTabGroupToGroup({sourceGroup:a,tabGroupId:e.from.tabGroupId,destinationGroup:i,destinationTarget:n,destinationIndex:r,skipSetActive:e.skipSetActive,keepEmptyGroups:e.keepEmptyGroups}):this.moveGroup({from:{group:a},to:{group:i,position:n},skipSetActive:e.skipSetActive})}moveTabGroupToGroup(e){const{sourceGroup:t,tabGroupId:i,destinationGroup:s,destinationTarget:o,destinationIndex:n}=e,r=t.model.getTabGroups().find(e=>e.id===i);if(!r||0===r.panelIds.length)return;const a=r.label,h=r.color,l=r.collapsed,d=[...r.panelIds],p=this.movingLock(()=>d.map(e=>t.model.removePanel(e,{skipSetActive:!1,skipSetActiveGroup:!0})).filter(e=>void 0!==e));if(0===p.length)return;e.keepEmptyGroups||0!==t.model.size||t===s||this.doRemoveGroup(t,{skipActive:!0});const u=i=>{this.movingLock(()=>{for(const e of p)i.model.openPanel(e,{index:n,skipSetActive:!0,skipSetGroupActive:!0})});const s=i.model.createTabGroup({label:a,color:h,collapsed:l});for(const e of p)i.model.addPanelToTabGroup(s.id,e.id);e.skipSetActive||this.doSetGroupAndPanelActive(i);for(const e of p)this._onDidMovePanel.fire({panel:e,from:t})};if(o&&"center"!==o){const e=Q(s.element),t=ee(this.gridview.orientation,e,o);u(this.createGroupAtLocation(t))}else u(s)}moveGroup(e){const t=e.from.group,i=e.to.group,s=e.to.position;if("center"===s){const s=t.activePanel,o=this.movingLock(()=>[...t.panels].map(e=>t.model.removePanel(e.id,{skipSetActive:!0})));0===(null==t?void 0:t.model.size)&&this.doRemoveGroup(t,{skipActive:!0}),this.movingLock(()=>{for(const e of o)i.model.openPanel(e,{skipSetActive:e!==s,skipSetGroupActive:!0})}),!0!==e.skipSetActive?this.doSetGroupAndPanelActive(i):this.activePanel||this.doSetGroupAndPanelActive(i)}else{switch(t.api.location.type){case"grid":this.gridview.removeView(Q(t.element));break;case"floating":{const e=this._floatingGroups.find(e=>e.group===t);if(!e)throw new Error("dockview: failed to find floating group");e.dispose();break}case"popout":{const e=this._popoutGroups.find(e=>e.popoutGroup===t);if(!e)throw new Error("dockview: failed to find popout group");const s=this._popoutGroups.indexOf(e);if(s>=0&&this._popoutGroups.splice(s,1),e.referenceGroup){const t=this.getPanel(e.referenceGroup);t&&!t.api.isVisible&&this.doRemoveGroup(t,{skipActive:!0})}e.window.dispose(),"grid"===i.api.location.type?(t.model.renderContainer=this.overlayRenderContainer,t.model.dropTargetContainer=this.rootDropTargetContainer,t.model.location={type:"grid"}):"floating"===i.api.location.type&&(t.model.renderContainer=this.overlayRenderContainer,t.model.dropTargetContainer=this.rootDropTargetContainer,t.model.location={type:"floating"});break}}if("grid"===i.api.location.type){const e=Q(i.element),o=ee(this.gridview.orientation,e,s);let n;switch(this.gridview.orientation){case exports.Orientation.VERTICAL:n=e.length%2==0?t.api.width:t.api.height;break;case exports.Orientation.HORIZONTAL:n=e.length%2==0?t.api.height:t.api.width}this.gridview.addView(t,n,o)}else if("floating"===i.api.location.type){const e=this._floatingGroups.find(e=>e.group===i);if(e){const i=e.overlay.toJSON();let s,o;s="left"in i?i.left+50:"right"in i?Math.max(0,i.right-i.width-50):50,o="top"in i?i.top+50:"bottom"in i?Math.max(0,i.bottom-i.height-50):50,this.addFloatingGroup(t,{height:i.height,width:i.width,position:{left:s,top:o}})}}}if(t.panels.forEach(e=>{this._onDidMovePanel.fire({panel:e,from:t})}),this.debouncedUpdateAllPositions(),!1===e.skipSetActive){const e=null!=i?i:t;this.doSetGroupAndPanelActive(e)}}doSetGroupActive(e){super.doSetGroupActive(e);const t=this.activePanel;this._moving||t===this._onDidActivePanelChange.value||this._onDidActivePanelChange.fire(t)}doSetGroupAndPanelActive(e){super.doSetGroupActive(e);const t=this.activePanel;e&&this.hasMaximizedGroup()&&!this.isMaximizedGroup(e)&&this.exitMaximizedGroup(),this._moving||t===this._onDidActivePanelChange.value||this._onDidActivePanelChange.fire(t)}getNextGroupId(){let e=this.nextGroupId.next();for(;this._groups.has(e);)e=this.nextGroupId.next();return e}createGroup(e){e||(e={});let t=null==e?void 0:e.id;if(t&&this._groups.has(e.id)&&(console.warn(`dockview: Duplicate group id ${null==e?void 0:e.id}. reassigning group id to avoid errors`),t=void 0),!t)for(t=this.nextGroupId.next();this._groups.has(t);)t=this.nextGroupId.next();const i=new _t(this,t,e);if(i.init({params:{},accessor:this}),!this._groups.has(i.id)){const e=new m(i.model.onTabDragStart(e=>{this._onWillDragPanel.fire(e)}),i.model.onGroupDragStart(e=>{this._onWillDragGroup.fire(e)}),i.model.onMove(e=>{const{groupId:t,itemId:s,target:o,index:n,tabGroupId:r}=e;this.moveGroupOrPanel({from:{groupId:t,panelId:s,tabGroupId:r},to:{group:i,position:o,index:n}})}),i.model.onDidDrop(e=>{this._onDidDrop.fire(e)}),i.model.onWillDrop(e=>{this._onWillDrop.fire(e)}),i.model.onWillShowOverlay(e=>{this.options.disableDnd?e.preventDefault():this._onWillShowOverlay.fire(e)}),i.model.onUnhandledDragOverEvent(e=>{this._onUnhandledDragOverEvent.fire(e)}),i.model.onDidAddPanel(e=>{this._moving||this._onDidAddPanel.fire(e.panel)}),i.model.onDidRemovePanel(e=>{this._moving||this._onDidRemovePanel.fire(e.panel)}),i.model.onDidActivePanelChange(e=>{this._moving||e.panel===this.activePanel&&this._onDidActivePanelChange.value!==e.panel&&this._onDidActivePanelChange.fire(e.panel)}),i.model.onDidCreateTabGroup(e=>{this._onDidCreateTabGroup.fire(e)}),i.model.onDidDestroyTabGroup(e=>{this._onDidDestroyTabGroup.fire(e)}),i.model.onDidAddPanelToTabGroup(e=>{this._onDidAddPanelToTabGroup.fire(e)}),i.model.onDidRemovePanelFromTabGroup(e=>{this._onDidRemovePanelFromTabGroup.fire(e)}),i.model.onDidTabGroupChange(e=>{this._onDidTabGroupChange.fire(e)}),i.model.onDidTabGroupCollapsedChange(e=>{this._onDidTabGroupCollapsedChange.fire(e)}),exports.DockviewEvent.any(i.model.onDidPanelTitleChange,i.model.onDidPanelParametersChange)(()=>{this._bufferOnDidLayoutChange.fire()}));this._groups.set(i.id,{value:i,disposable:e})}return i.initialize(),i}createPanel(e,t){var i,s,o;const n=e.component,r=null!==(i=e.tabComponent)&&void 0!==i?i:this.options.defaultTabComponent,a=new Ct(this,e.id,n,r),h=new wt(e.id,n,r,this,this._api,t,a,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return h.init({title:null!==(s=e.title)&&void 0!==s?s:e.id,params:null!==(o=null==e?void 0:e.params)&&void 0!==o?o:{}}),h}createGroupAtLocation(e,t,i){const s=this.createGroup(i);return this.doAddGroup(s,e,t),s}findGroup(e){var t;return null===(t=Array.from(this._groups.values()).find(t=>t.value.model.containsPanel(e)))||void 0===t?void 0:t.value}orientationAtLocation(e){const t=this.gridview.orientation;return e.length%2==1?t:se(t)}updateDropTargetModel(e){"dndEdges"in e&&(this._rootDropTarget.disabled="boolean"==typeof e.dndEdges&&!1===e.dndEdges,"object"==typeof e.dndEdges&&null!==e.dndEdges?this._rootDropTarget.setOverlayModel(e.dndEdges):this._rootDropTarget.setOverlayModel(Qt)),"rootOverlayModel"in e&&this.updateDropTargetModel({dndEdges:e.dndEdges})}updateTheme(){var e,t,i,s,o,n,r,a,h;const l=null!==(e=this._options.theme)&&void 0!==e?e:ft;if(null===(t=this._shellThemeClassnames)||void 0===t||t.setClassNames(l.className),this.gridview.margin=null!==(i=l.gap)&&void 0!==i?i:0,null===(s=this._shellManager)||void 0===s||s.updateTheme(null!==(o=l.gap)&&void 0!==o?o:0,null!==(n=l.edgeGroupCollapsedSize)&&void 0!==n?n:35),void 0!==l.dndOverlayBorder?(this.element.style.setProperty("--dv-drag-over-border",l.dndOverlayBorder),null===(r=this._shellManager)||void 0===r||r.element.style.setProperty("--dv-drag-over-border",l.dndOverlayBorder)):(this.element.style.removeProperty("--dv-drag-over-border"),null===(a=this._shellManager)||void 0===a||a.element.style.removeProperty("--dv-drag-over-border")),"absolute"===l.dndOverlayMounting)this.rootDropTargetContainer.disabled=!1;else this.rootDropTargetContainer.disabled=!0;const d="none"===(null!==(h=l.tabGroupIndicator)&&void 0!==h?h:"wrap");w(this.element,"dv-tab-group-indicator-none",d),this._shellManager&&w(this._shellManager.element,"dv-tab-group-indicator-none",d);for(const e of this.groups)e.model.updateTabGroups()}}class ii extends pe{get orientation(){return this.gridview.orientation}set orientation(e){this.gridview.orientation=e}get options(){return this._options}get deserializer(){return this._deserializer}set deserializer(e){this._deserializer=e}constructor(e,t){var i;super(e,{proportionalLayout:null===(i=t.proportionalLayout)||void 0===i||i,orientation:t.orientation,styles:t.hideBorders?{separatorBorder:"transparent"}:void 0,disableAutoResizing:t.disableAutoResizing,className:t.className}),this._onDidLayoutfromJSON=new d,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidRemoveGroup=new d,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new d,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidActiveGroupChange=new d,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._options=t,this.addDisposables(this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this.onDidAdd(e=>{this._onDidAddGroup.fire(e)}),this.onDidRemove(e=>{this._onDidRemoveGroup.fire(e)}),this.onDidActiveChange(e=>{this._onDidActiveGroupChange.fire(e)}))}updateOptions(e){super.updateOptions(e);const t="string"==typeof e.orientation&&this.gridview.orientation!==e.orientation;this._options=Object.assign(Object.assign({},this.options),e),t&&(this.gridview.orientation=e.orientation),this.layout(this.gridview.width,this.gridview.height,!0)}removePanel(e){this.removeGroup(e)}toJSON(){var e;return{grid:this.gridview.serialize(),activePanel:null===(e=this.activeGroup)||void 0===e?void 0:e.id}}setVisible(e,t){this.gridview.setViewVisible(Q(e.element),t)}setActive(e){this._groups.forEach((t,i)=>{t.value.setActive(e===t.value)})}focus(){var e;null===(e=this.activeGroup)||void 0===e||e.focus()}fromJSON(e){this.clear();const{grid:t,activePanel:i}=e;try{const e=[],s=this.width,o=this.height;if(this.gridview.deserialize(t,{fromJSON:t=>{const{data:i}=t,s=this.options.createComponent({id:i.id,name:i.component});return e.push(()=>s.init({params:i.params,minimumWidth:i.minimumWidth,maximumWidth:i.maximumWidth,minimumHeight:i.minimumHeight,maximumHeight:i.maximumHeight,priority:i.priority,snap:!!i.snap,accessor:this,isVisible:t.visible})),this._onDidAddGroup.fire(s),this.registerPanel(s),s}}),this.layout(s,o,!0),e.forEach(e=>e()),"string"==typeof i){const e=this.getPanel(i);e&&this.doSetGroupActive(e)}}catch(e){for(const e of this.groups)e.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e);throw this.clear(),e}this._onDidLayoutfromJSON.fire()}clear(){const e=this.activeGroup,t=Array.from(this._groups.values());for(const e of t)e.disposable.dispose(),this.doRemoveGroup(e.value,{skipActive:!0});e&&this.doSetGroupActive(void 0),this.gridview.clear()}movePanel(e,t){var i;let s;const o=this.gridview.remove(e),n=null===(i=this._groups.get(t.reference))||void 0===i?void 0:i.value;if(!n)throw new Error(`reference group ${t.reference} does not exist`);const r=de(t.direction);if("center"===r)throw new Error(`${r} not supported as an option`);{const e=Q(n.element);s=ee(this.gridview.orientation,e,r)}this.doAddGroup(o,s,t.size)}addPanel(e){var t,i,s,o;let n=null!==(t=e.location)&&void 0!==t?t:[0];if(null===(i=e.position)||void 0===i?void 0:i.referencePanel){const t=null===(s=this._groups.get(e.position.referencePanel))||void 0===s?void 0:s.value;if(!t)throw new Error(`reference group ${e.position.referencePanel} does not exist`);const i=de(e.position.direction);if("center"===i)throw new Error(`${i} not supported as an option`);{const e=Q(t.element);n=ee(this.gridview.orientation,e,i)}}const r=this.options.createComponent({id:e.id,name:e.component});return r.init({params:null!==(o=e.params)&&void 0!==o?o:{},minimumWidth:e.minimumWidth,maximumWidth:e.maximumWidth,minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight,priority:e.priority,snap:!!e.snap,accessor:this,isVisible:!0}),this.doAddGroup(r,n,e.size),this.registerPanel(r),this.doSetGroupActive(r),r}registerPanel(e){const t=new m(e.api.onDidFocusChange(t=>{t.isFocused&&this._groups.forEach(t=>{const i=t.value;i!==e?i.setActive(!1):i.setActive(!0)})}));this._groups.set(e.id,{value:e,disposable:t})}moveGroup(e,t,i){const s=this.getPanel(t);if(!s)throw new Error("invalid operation");const o=Q(e.element),n=ee(this.gridview.orientation,o,i),[r,a]=T(n),h=Q(s.element),[l,d]=T(h);if(E(l,r))return void this.gridview.moveView(l,d,a);const p=this.doRemoveGroup(s,{skipActive:!0,skipDispose:!0}),u=Q(e.element),c=ee(this.gridview.orientation,u,i);this.doAddGroup(p,c)}removeGroup(e){super.removeGroup(e)}dispose(){super.dispose(),this._onDidLayoutfromJSON.dispose()}}class si extends he{get panels(){return this.splitview.getViews()}get options(){return this._options}get length(){return this._panels.size}get orientation(){return this.splitview.orientation}get splitview(){return this._splitview}set splitview(e){this._splitview&&this._splitview.dispose(),this._splitview=e,this._splitviewChangeDisposable.value=new m(this._splitview.onDidSashEnd(()=>{this._onDidLayoutChange.fire(void 0)}),this._splitview.onDidAddView(e=>this._onDidAddView.fire(e)),this._splitview.onDidRemoveView(e=>this._onDidRemoveView.fire(e)))}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get height(){return this.splitview.orientation===exports.Orientation.HORIZONTAL?this.splitview.orthogonalSize:this.splitview.size}get width(){return this.splitview.orientation===exports.Orientation.HORIZONTAL?this.splitview.size:this.splitview.orthogonalSize}constructor(e,t){var i;super(document.createElement("div"),t.disableAutoResizing),this._splitviewChangeDisposable=new v,this._panels=new Map,this._onDidLayoutfromJSON=new d,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidAddView=new d,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new d,this.onDidRemoveView=this._onDidRemoveView.event,this._onDidLayoutChange=new d,this.onDidLayoutChange=this._onDidLayoutChange.event,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new A(this.element),this._classNames.setClassNames(null!==(i=t.className)&&void 0!==i?i:""),e.appendChild(this.element),this._options=t,this.splitview=new $(this.element,t),this.addDisposables(this._onDidAddView,this._onDidLayoutfromJSON,this._onDidRemoveView,this._onDidLayoutChange)}updateOptions(e){var t,i;"className"in e&&this._classNames.setClassNames(null!==(t=e.className)&&void 0!==t?t:""),"disableResizing"in e&&(this.disableResizing=null!==(i=e.disableAutoResizing)&&void 0!==i&&i),"string"==typeof e.orientation&&(this.splitview.orientation=e.orientation),this._options=Object.assign(Object.assign({},this.options),e),this.splitview.layout(this.splitview.size,this.splitview.orthogonalSize)}focus(){var e;null===(e=this._activePanel)||void 0===e||e.focus()}movePanel(e,t){this.splitview.moveView(e,t)}setVisible(e,t){const i=this.panels.indexOf(e);this.splitview.setViewVisible(i,t)}setActive(e,t){this._activePanel=e,this.panels.filter(t=>t!==e).forEach(e=>{e.api._onDidActiveChange.fire({isActive:!1}),t||e.focus()}),e.api._onDidActiveChange.fire({isActive:!0}),t||e.focus()}removePanel(e,t){const i=this._panels.get(e.id);if(!i)throw new Error(`unknown splitview panel ${e.id}`);i.dispose(),this._panels.delete(e.id);const s=this.panels.findIndex(t=>t===e);this.splitview.removeView(s,t).dispose();const o=this.panels;o.length>0&&this.setActive(o[o.length-1])}getPanel(e){return this.panels.find(t=>t.id===e)}addPanel(e){var t;if(this._panels.has(e.id))throw new Error(`panel ${e.id} already exists`);const i=this.options.createComponent({id:e.id,name:e.component});i.orientation=this.splitview.orientation,i.init({params:null!==(t=e.params)&&void 0!==t?t:{},minimumSize:e.minimumSize,maximumSize:e.maximumSize,snap:e.snap,priority:e.priority,accessor:this});const s="number"==typeof e.size?e.size:exports.Sizing.Distribute,o="number"==typeof e.index?e.index:void 0;return this.splitview.addView(i,s,o),this.doAddView(i),this.setActive(i),i}layout(e,t){const[i,s]=this.splitview.orientation===exports.Orientation.HORIZONTAL?[e,t]:[t,e];this.splitview.layout(i,s)}doAddView(e){const t=e.api.onDidFocusChange(t=>{t.isFocused&&this.setActive(e,!0)});this._panels.set(e.id,t)}toJSON(){var e;return{views:this.splitview.getViews().map((e,t)=>({size:this.splitview.getViewSize(t),data:e.toJSON(),snap:!!e.snap,priority:e.priority})),activeView:null===(e=this._activePanel)||void 0===e?void 0:e.id,size:this.splitview.size,orientation:this.splitview.orientation}}fromJSON(e){this.clear();const{views:t,orientation:i,size:s,activeView:o}=e,n=[],r=this.width,a=this.height;if(this.splitview=new $(this.element,{orientation:i,proportionalLayout:this.options.proportionalLayout,descriptor:{size:s,views:t.map(e=>{const t=e.data;if(this._panels.has(t.id))throw new Error(`panel ${t.id} already exists`);const s=this.options.createComponent({id:t.id,name:t.component});return n.push(()=>{var i;s.init({params:null!==(i=t.params)&&void 0!==i?i:{},minimumSize:t.minimumSize,maximumSize:t.maximumSize,snap:e.snap,priority:e.priority,accessor:this})}),s.orientation=i,this.doAddView(s),setTimeout(()=>{this._onDidAddView.fire(s)},0),{size:e.size,view:s}})}}),this.layout(r,a),n.forEach(e=>e()),"string"==typeof o){const e=this.getPanel(o);e&&this.setActive(e)}this._onDidLayoutfromJSON.fire()}clear(){for(const e of this._panels.values())e.dispose();for(this._panels.clear();this.splitview.length>0;){this.splitview.removeView(0,exports.Sizing.Distribute,!0).dispose()}}dispose(){for(const e of this._panels.values())e.dispose();this._panels.clear();const e=this.splitview.getViews();this._splitviewChangeDisposable.dispose(),this.splitview.dispose();for(const t of e)t.dispose();this.element.remove(),super.dispose()}}class oi extends m{get element(){return this._element}constructor(){super(),this._expandedIcon=et({width:"11",height:"11",viewbox:"0 0 24 15",path:"M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z"}),this._collapsedIcon=tt(),this.disposable=new v,this.apiRef={api:null},this._element=document.createElement("div"),this.element.className="dv-default-header",this._content=document.createElement("span"),this._expander=document.createElement("div"),this._expander.className="dv-pane-header-icon",this.element.appendChild(this._expander),this.element.appendChild(this._content),this.addDisposables(p(this._element,"click",()=>{var e;null===(e=this.apiRef.api)||void 0===e||e.setExpanded(!this.apiRef.api.isExpanded)}))}init(e){this.apiRef.api=e.api,this._content.textContent=e.title,this.updateIcon(),this.disposable.value=e.api.onDidExpansionChange(()=>{this.updateIcon()})}updateIcon(){var e;const t=!!(null===(e=this.apiRef.api)||void 0===e?void 0:e.isExpanded);w(this._expander,"collapsed",!t),t?(this._expander.contains(this._collapsedIcon)&&this._collapsedIcon.remove(),this._expander.contains(this._expandedIcon)||this._expander.appendChild(this._expandedIcon)):(this._expander.contains(this._expandedIcon)&&this._expandedIcon.remove(),this._expander.contains(this._collapsedIcon)||this._expander.appendChild(this._collapsedIcon))}update(e){}dispose(){this.disposable.dispose(),super.dispose()}}const ni=L(),ri=Number.MAX_SAFE_INTEGER;class ai extends Ee{constructor(e){super({accessor:e.accessor,id:e.id,component:e.component,headerComponent:e.headerComponent,orientation:e.orientation,isExpanded:e.isExpanded,disableDnd:e.disableDnd,headerSize:e.headerSize,minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize}),this.options=e}getBodyComponent(){return this.options.body}getHeaderComponent(){return this.options.header}}class hi extends he{get id(){return this._id}get panels(){return this.paneview.getPanes()}set paneview(e){this._paneview=e,this._disposable.value=new m(this._paneview.onDidChange(()=>{this._onDidLayoutChange.fire(void 0)}),this._paneview.onDidAddView(e=>this._onDidAddView.fire(e)),this._paneview.onDidRemoveView(e=>this._onDidRemoveView.fire(e)))}get paneview(){return this._paneview}get minimumSize(){return this.paneview.minimumSize}get maximumSize(){return this.paneview.maximumSize}get height(){return this.paneview.orientation===exports.Orientation.HORIZONTAL?this.paneview.orthogonalSize:this.paneview.size}get width(){return this.paneview.orientation===exports.Orientation.HORIZONTAL?this.paneview.size:this.paneview.orthogonalSize}get options(){return this._options}constructor(e,t){var i;super(document.createElement("div"),t.disableAutoResizing),this._id=ni.next(),this._disposable=new v,this._viewDisposables=new Map,this._onDidLayoutfromJSON=new d,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidLayoutChange=new d,this.onDidLayoutChange=this._onDidLayoutChange.event,this._onDidDrop=new d,this.onDidDrop=this._onDidDrop.event,this._onDidAddView=new d,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new d,this.onDidRemoveView=this._onDidRemoveView.event,this._onUnhandledDragOverEvent=new d,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this.element.style.height="100%",this.element.style.width="100%",this.addDisposables(this._onDidLayoutChange,this._onDidLayoutfromJSON,this._onDidDrop,this._onDidAddView,this._onDidRemoveView,this._onUnhandledDragOverEvent),this._classNames=new A(this.element),this._classNames.setClassNames(null!==(i=t.className)&&void 0!==i?i:""),e.appendChild(this.element),this._options=t,this.paneview=new J(this.element,{orientation:exports.Orientation.VERTICAL}),this.addDisposables(this._disposable)}setVisible(e,t){const i=this.panels.indexOf(e);this.paneview.setViewVisible(i,t)}focus(){}updateOptions(e){var t,i;"className"in e&&this._classNames.setClassNames(null!==(t=e.className)&&void 0!==t?t:""),"disableResizing"in e&&(this.disableResizing=null!==(i=e.disableAutoResizing)&&void 0!==i&&i),this._options=Object.assign(Object.assign({},this.options),e)}addPanel(e){var t,i;const s=this.options.createComponent({id:e.id,name:e.component});let o;e.headerComponent&&this.options.createHeaderComponent&&(o=this.options.createHeaderComponent({id:e.id,name:e.headerComponent})),o||(o=new oi);const n=new ai({id:e.id,component:e.component,headerComponent:e.headerComponent,header:o,body:s,orientation:exports.Orientation.VERTICAL,isExpanded:!!e.isExpanded,disableDnd:!!this.options.disableDnd,accessor:this,headerSize:null!==(t=e.headerSize)&&void 0!==t?t:22,minimumBodySize:0,maximumBodySize:ri});this.doAddPanel(n);const r="number"==typeof e.size?e.size:exports.Sizing.Distribute,a="number"==typeof e.index?e.index:void 0;return n.init({params:null!==(i=e.params)&&void 0!==i?i:{},minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize,isExpanded:e.isExpanded,title:e.title,containerApi:new ce(this),accessor:this}),this.paneview.addPane(n,r,a),n.orientation=this.paneview.orientation,n}removePanel(e){const t=this.panels.findIndex(t=>t===e);this.paneview.removePane(t),this.doRemovePanel(e)}movePanel(e,t){this.paneview.moveView(e,t)}getPanel(e){return this.panels.find(t=>t.id===e)}layout(e,t){const[i,s]=this.paneview.orientation===exports.Orientation.HORIZONTAL?[e,t]:[t,e];this.paneview.layout(i,s)}toJSON(){const e=e=>e===Number.MAX_SAFE_INTEGER||e===Number.POSITIVE_INFINITY?void 0:e;return{views:this.paneview.getPanes().map((t,i)=>{return{size:this.paneview.getViewSize(i),data:t.toJSON(),minimumSize:(s=t.minimumBodySize,s<=0?void 0:s),maximumSize:e(t.maximumBodySize),headerSize:t.headerSize,expanded:t.isExpanded()};var s}),size:this.paneview.size}}fromJSON(e){this.clear();const{views:t,size:i}=e,s=[],o=this.width,n=this.height;this.paneview=new J(this.element,{orientation:exports.Orientation.VERTICAL,descriptor:{size:i,views:t.map(e=>{var t,i,o;const n=e.data,r=this.options.createComponent({id:n.id,name:n.component});let a;n.headerComponent&&this.options.createHeaderComponent&&(a=this.options.createHeaderComponent({id:n.id,name:n.headerComponent})),a||(a=new oi);const h=new ai({id:n.id,component:n.component,headerComponent:n.headerComponent,header:a,body:r,orientation:exports.Orientation.VERTICAL,isExpanded:!!e.expanded,disableDnd:!!this.options.disableDnd,accessor:this,headerSize:null!==(t=e.headerSize)&&void 0!==t?t:22,minimumBodySize:null!==(i=e.minimumSize)&&void 0!==i?i:0,maximumBodySize:null!==(o=e.maximumSize)&&void 0!==o?o:ri});return this.doAddPanel(h),s.push(()=>{var t;h.init({params:null!==(t=n.params)&&void 0!==t?t:{},minimumBodySize:e.minimumSize,maximumBodySize:e.maximumSize,title:n.title,isExpanded:!!e.expanded,containerApi:new ce(this),accessor:this}),h.orientation=this.paneview.orientation}),setTimeout(()=>{this._onDidAddView.fire(h)},0),{size:e.size,view:h}})}}),this.layout(o,n),s.forEach(e=>e()),this._onDidLayoutfromJSON.fire()}clear(){for(const[e,t]of this._viewDisposables.entries())t.dispose();this._viewDisposables.clear(),this.paneview.dispose()}doAddPanel(e){const t=new m(e.onDidDrop(e=>{this._onDidDrop.fire(e)}),e.onUnhandledDragOverEvent(e=>{this._onUnhandledDragOverEvent.fire(e)}));this._viewDisposables.set(e.id,t)}doRemovePanel(e){const t=this._viewDisposables.get(e.id);t&&(t.dispose(),this._viewDisposables.delete(e.id))}dispose(){super.dispose();for(const[e,t]of this._viewDisposables.entries())t.dispose();this._viewDisposables.clear(),this.element.remove(),this.paneview.dispose()}}exports.BaseGrid=pe,exports.ContentContainer=Oe,exports.DEFAULT_TAB_GROUP_COLORS=He,exports.DefaultDockviewDeserialzier=xt,exports.DefaultTab=Dt,exports.DockviewApi=ve,exports.DockviewComponent=ti,exports.DockviewCompositeDisposable=m,exports.DockviewDidDropEvent=dt,exports.DockviewEmitter=d,exports.DockviewGroupPanel=_t,exports.DockviewGroupPanelModel=ut,exports.DockviewMutableDisposable=v,exports.DockviewPanel=wt,exports.DockviewUnhandledDragOverEvent=st,exports.DockviewWillDropEvent=pt,exports.DockviewWillShowOverlayLocationEvent=Le,exports.DraggablePaneviewPanel=Ee,exports.Gridview=re,exports.GridviewApi=me,exports.GridviewComponent=ii,exports.GridviewPanel=mt,exports.PROPERTY_KEYS_DOCKVIEW=ot,exports.PROPERTY_KEYS_GRIDVIEW=ae,exports.PROPERTY_KEYS_PANEVIEW=ye,exports.PROPERTY_KEYS_SPLITVIEW=U,exports.PaneFramework=ai,exports.PaneTransfer=i,exports.PanelTransfer=t,exports.Paneview=J,exports.PaneviewApi=ce,exports.PaneviewComponent=hi,exports.PaneviewPanel=Te,exports.PaneviewUnhandledDragOverEvent=Se,exports.Splitview=$,exports.SplitviewApi=ue,exports.SplitviewComponent=si,exports.SplitviewPanel=class extends Ie{get priority(){return this._priority}set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){const e="function"==typeof this._minimumSize?this._minimumSize():this._minimumSize;return e!==this._evaluatedMinimumSize&&(this._evaluatedMinimumSize=e,this.updateConstraints()),e}get maximumSize(){const e="function"==typeof this._maximumSize?this._maximumSize():this._maximumSize;return e!==this._evaluatedMaximumSize&&(this._evaluatedMaximumSize=e,this.updateConstraints()),e}get snap(){return this._snap}constructor(e,t){super(e,t,new Ae(e,t)),this._evaluatedMinimumSize=0,this._evaluatedMaximumSize=Number.POSITIVE_INFINITY,this._minimumSize=0,this._maximumSize=Number.POSITIVE_INFINITY,this._snap=!1,this._onDidChange=new d,this.onDidChange=this._onDidChange.event,this.api.initialize(this),this.addDisposables(this._onDidChange,this.api.onWillVisibilityChange(e=>{const{isVisible:t}=e,{accessor:i}=this._params;i.setVisible(this,t)}),this.api.onActiveChange(()=>{const{accessor:e}=this._params;e.setActive(this)}),this.api.onDidConstraintsChangeInternal(e=>{"number"!=typeof e.minimumSize&&"function"!=typeof e.minimumSize||(this._minimumSize=e.minimumSize),"number"!=typeof e.maximumSize&&"function"!=typeof e.maximumSize||(this._maximumSize=e.maximumSize),this.updateConstraints()}),this.api.onDidSizeChange(e=>{this._onDidChange.fire({size:e.size})}))}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}layout(e,t){const[i,s]=this.orientation===exports.Orientation.HORIZONTAL?[e,t]:[t,e];super.layout(i,s)}init(e){super.init(e),this._priority=e.priority,e.minimumSize&&(this._minimumSize=e.minimumSize),e.maximumSize&&(this._maximumSize=e.maximumSize),e.snap&&(this._snap=e.snap)}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{minimumSize:(e=this.minimumSize,e<=0?void 0:e),maximumSize:(e=>e===Number.MAX_SAFE_INTEGER||e===Number.POSITIVE_INFINITY?void 0:e)(this.maximumSize)});var e}updateConstraints(){this.api._onDidConstraintsChange.fire({maximumSize:this._evaluatedMaximumSize,minimumSize:this._evaluatedMinimumSize})}},exports.Tab=Me,exports.TabGroupColorPalette=Fe,exports.applyTabGroupAccent=Ue,exports.createDockview=function(e,t){return new ti(e,t).api},exports.createGridview=function(e,t){const i=new ii(e,t);return new me(i)},exports.createPaneview=function(e,t){const i=new hi(e,t);return new ce(i)},exports.createSplitview=function(e,t){const i=new si(e,t);return new ue(i)},exports.directionToPosition=be,exports.getDirectionOrientation=te,exports.getGridLocation=Q,exports.getLocationOrientation=ie,exports.getPaneData=n,exports.getPanelData=o,exports.getRelativeLocation=ee,exports.indexInParent=K,exports.isGridBranchNode=oe,exports.isGroupOptionsWithGroup=ht,exports.isGroupOptionsWithPanel=at,exports.isPanelOptionsWithGroup=rt,exports.isPanelOptionsWithPanel=nt,exports.orthogonal=se,exports.positionToDirection=we,exports.resolveTabGroupAccent=Je,exports.themeAbyss=ft,exports.themeAbyssSpaced={name:"abyssSpaced",className:"dockview-theme-abyss-spaced",colorScheme:"dark",gap:10,edgeGroupCollapsedSize:44,dndOverlayMounting:"absolute",dndPanelOverlay:"group",dndTabIndicator:"line",dndOverlayBorder:"2px solid var(--dv-active-sash-color)"},exports.themeCatppuccinMocha={name:"catppuccinMocha",className:"dockview-theme-catppuccin-mocha",colorScheme:"dark"},exports.themeCatppuccinMochaSpaced={name:"catppuccinMochaSpaced",className:"dockview-theme-catppuccin-mocha-spaced",colorScheme:"dark",gap:10,edgeGroupCollapsedSize:44,dndOverlayMounting:"absolute",dndPanelOverlay:"group",dndTabIndicator:"line",dndOverlayBorder:"2px solid var(--dv-active-sash-color)"},exports.themeDark={name:"dark",className:"dockview-theme-dark",colorScheme:"dark"},exports.themeDracula={name:"dracula",className:"dockview-theme-dracula",colorScheme:"dark"},exports.themeGithubDark={name:"githubDark",className:"dockview-theme-github-dark",colorScheme:"dark"},exports.themeGithubDarkSpaced={name:"githubDarkSpaced",className:"dockview-theme-github-dark-spaced",colorScheme:"dark",gap:10,edgeGroupCollapsedSize:44,dndOverlayMounting:"absolute",dndPanelOverlay:"group",dndTabIndicator:"line",dndOverlayBorder:"2px solid var(--dv-active-sash-color)"},exports.themeGithubLight={name:"githubLight",className:"dockview-theme-github-light",colorScheme:"light"},exports.themeGithubLightSpaced={name:"githubLightSpaced",className:"dockview-theme-github-light-spaced",colorScheme:"light",gap:10,edgeGroupCollapsedSize:44,dndOverlayMounting:"absolute",dndPanelOverlay:"group",dndTabIndicator:"line",dndOverlayBorder:"2px solid var(--dv-active-sash-color)"},exports.themeLight={name:"light",className:"dockview-theme-light",colorScheme:"light"},exports.themeLightSpaced={name:"lightSpaced",className:"dockview-theme-light-spaced",colorScheme:"light",gap:10,edgeGroupCollapsedSize:44,dndOverlayMounting:"absolute",dndPanelOverlay:"group",dndTabIndicator:"line",dndOverlayBorder:"2px solid var(--dv-active-sash-color)"},exports.themeMonokai={name:"monokai",className:"dockview-theme-monokai",colorScheme:"dark"},exports.themeNord={name:"nord",className:"dockview-theme-nord",colorScheme:"dark"},exports.themeNordSpaced={name:"nordSpaced",className:"dockview-theme-nord-spaced",colorScheme:"dark",gap:10,edgeGroupCollapsedSize:44,dndOverlayMounting:"absolute",dndPanelOverlay:"group",dndTabIndicator:"line",dndOverlayBorder:"2px solid var(--dv-active-sash-color)"},exports.themeSolarizedLight={name:"solarizedLight",className:"dockview-theme-solarized-light",colorScheme:"light"},exports.themeSolarizedLightSpaced={name:"solarizedLightSpaced",className:"dockview-theme-solarized-light-spaced",colorScheme:"light",gap:10,edgeGroupCollapsedSize:44,dndOverlayMounting:"absolute",dndPanelOverlay:"group",dndTabIndicator:"line",dndOverlayBorder:"2px solid var(--dv-active-sash-color)"},exports.themeVisualStudio={name:"visualStudio",className:"dockview-theme-vs",colorScheme:"dark",edgeGroupCollapsedSize:22},exports.toTarget=de;
|