dockview-react 6.6.0 → 7.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/dist/cjs/dockview/defaultTab.d.ts +7 -0
  2. package/dist/cjs/dockview/defaultTab.js +99 -0
  3. package/dist/cjs/dockview/dockview.d.ts +33 -0
  4. package/dist/cjs/dockview/dockview.js +285 -0
  5. package/dist/cjs/dockview/headerActionsRenderer.d.ts +24 -0
  6. package/dist/cjs/dockview/headerActionsRenderer.js +86 -0
  7. package/dist/cjs/dockview/reactContentPart.d.ts +21 -0
  8. package/dist/cjs/dockview/reactContentPart.js +52 -0
  9. package/dist/cjs/dockview/reactContextMenuItemPart.d.ts +14 -0
  10. package/dist/cjs/dockview/reactContextMenuItemPart.js +31 -0
  11. package/dist/cjs/dockview/reactGroupDragGhostPart.d.ts +20 -0
  12. package/dist/cjs/dockview/reactGroupDragGhostPart.js +32 -0
  13. package/dist/cjs/dockview/reactHeaderPart.d.ts +17 -0
  14. package/dist/cjs/dockview/reactHeaderPart.js +46 -0
  15. package/dist/cjs/dockview/reactTabGroupChipPart.d.ts +23 -0
  16. package/dist/cjs/dockview/reactTabGroupChipPart.js +36 -0
  17. package/dist/cjs/dockview/reactWatermarkPart.d.ts +18 -0
  18. package/dist/cjs/dockview/reactWatermarkPart.js +47 -0
  19. package/dist/cjs/gridview/gridview.d.ts +17 -0
  20. package/dist/cjs/gridview/gridview.js +105 -0
  21. package/dist/cjs/gridview/view.d.ts +9 -0
  22. package/dist/cjs/gridview/view.js +41 -0
  23. package/dist/cjs/index.d.ts +9 -0
  24. package/dist/cjs/index.js +7 -0
  25. package/dist/cjs/paneview/paneview.d.ts +20 -0
  26. package/dist/cjs/paneview/paneview.js +137 -0
  27. package/dist/cjs/paneview/view.d.ts +19 -0
  28. package/dist/cjs/paneview/view.js +44 -0
  29. package/dist/cjs/react.d.ts +35 -0
  30. package/dist/cjs/react.js +183 -0
  31. package/dist/cjs/splitview/splitview.d.ts +17 -0
  32. package/dist/cjs/splitview/splitview.js +105 -0
  33. package/dist/cjs/splitview/view.d.ts +9 -0
  34. package/dist/cjs/splitview/view.js +39 -0
  35. package/dist/cjs/svg.d.ts +3 -0
  36. package/dist/cjs/svg.js +15 -0
  37. package/dist/cjs/types.d.ts +4 -0
  38. package/dist/cjs/types.js +2 -0
  39. package/dist/dockview-react.js +21650 -11
  40. package/dist/dockview-react.min.js +21 -2
  41. package/dist/dockview-react.min.js.map +1 -1
  42. package/dist/esm/dockview/defaultTab.d.ts +7 -0
  43. package/dist/esm/dockview/defaultTab.js +65 -0
  44. package/dist/esm/dockview/dockview.d.ts +33 -0
  45. package/dist/esm/dockview/dockview.js +252 -0
  46. package/dist/esm/dockview/headerActionsRenderer.d.ts +24 -0
  47. package/dist/esm/dockview/headerActionsRenderer.js +72 -0
  48. package/dist/esm/dockview/reactContentPart.d.ts +21 -0
  49. package/dist/esm/dockview/reactContentPart.js +43 -0
  50. package/dist/esm/dockview/reactContextMenuItemPart.d.ts +14 -0
  51. package/dist/esm/dockview/reactContextMenuItemPart.js +22 -0
  52. package/dist/esm/dockview/reactGroupDragGhostPart.d.ts +20 -0
  53. package/dist/esm/dockview/reactGroupDragGhostPart.js +23 -0
  54. package/dist/esm/dockview/reactHeaderPart.d.ts +17 -0
  55. package/dist/esm/dockview/reactHeaderPart.js +37 -0
  56. package/dist/esm/dockview/reactTabGroupChipPart.d.ts +23 -0
  57. package/dist/esm/dockview/reactTabGroupChipPart.js +27 -0
  58. package/dist/esm/dockview/reactWatermarkPart.d.ts +18 -0
  59. package/dist/esm/dockview/reactWatermarkPart.js +38 -0
  60. package/dist/esm/gridview/gridview.d.ts +17 -0
  61. package/dist/esm/gridview/gridview.js +72 -0
  62. package/dist/esm/gridview/view.d.ts +9 -0
  63. package/dist/esm/gridview/view.js +19 -0
  64. package/dist/esm/index.d.ts +9 -0
  65. package/dist/esm/index.js +7 -0
  66. package/dist/esm/paneview/paneview.d.ts +20 -0
  67. package/dist/esm/paneview/paneview.js +104 -0
  68. package/dist/esm/paneview/view.d.ts +19 -0
  69. package/dist/esm/paneview/view.js +35 -0
  70. package/dist/esm/react.d.ts +35 -0
  71. package/dist/esm/react.js +134 -0
  72. package/dist/esm/splitview/splitview.d.ts +17 -0
  73. package/dist/esm/splitview/splitview.js +72 -0
  74. package/dist/esm/splitview/view.d.ts +9 -0
  75. package/dist/esm/splitview/view.js +17 -0
  76. package/dist/esm/svg.d.ts +3 -0
  77. package/dist/esm/svg.js +7 -0
  78. package/dist/esm/types.d.ts +4 -0
  79. package/dist/esm/types.js +1 -0
  80. package/dist/package/main.cjs.js +1037 -5
  81. package/dist/package/main.cjs.min.js +2 -2
  82. package/dist/package/main.esm.min.mjs +2 -8
  83. package/dist/package/main.esm.mjs +1027 -1
  84. package/dist/styles/dockview.css +275 -13
  85. package/package.json +15 -2
@@ -1 +1 @@
1
- {"version":3,"file":"dockview-react.min.js","sources":["../../../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode"],"mappings":";;;;;;qSAAA,SAAqBA,EAAKC,YACnBA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAgC,oBAAbC,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBW,CAqBzD","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"dockview-react.min.js","sources":["../../dockview-core/dist/package/main.esm.mjs","../../../node_modules/style-inject/dist/style-inject.es.js","../../dockview/dist/package/main.esm.mjs","../src/react.ts","../src/dockview/reactContentPart.ts","../src/dockview/reactHeaderPart.ts","../src/dockview/reactWatermarkPart.ts","../src/dockview/headerActionsRenderer.ts","../src/dockview/reactContextMenuItemPart.ts","../src/dockview/reactTabGroupChipPart.ts","../src/dockview/reactGroupDragGhostPart.ts","../src/dockview/dockview.tsx","../../../node_modules/tslib/tslib.es6.js","../src/svg.tsx","../src/splitview/view.ts","../src/splitview/splitview.tsx","../src/gridview/view.ts","../src/gridview/gridview.tsx","../src/paneview/view.ts","../src/paneview/paneview.tsx","../src/dockview/defaultTab.tsx"],"sourcesContent":["/**\n * dockview-core\n * @version 7.0.2\n * @link https://github.com/mathuo/dockview\n * @license MIT\n */\nclass TransferObject {\n}\nclass PanelTransfer extends TransferObject {\n constructor(viewId, groupId, panelId, tabGroupId) {\n super();\n this.viewId = viewId;\n this.groupId = groupId;\n this.panelId = panelId;\n this.tabGroupId = tabGroupId;\n }\n}\nclass PaneTransfer extends TransferObject {\n constructor(viewId, paneId) {\n super();\n this.viewId = viewId;\n this.paneId = paneId;\n }\n}\n/**\n * A singleton to store transfer data during drag & drop operations that are only valid within the application.\n */\nclass LocalSelectionTransfer {\n constructor() {\n // protect against external instantiation\n }\n static getInstance() {\n return LocalSelectionTransfer.INSTANCE;\n }\n hasData(proto) {\n return proto && proto === this.proto;\n }\n clearData(proto) {\n if (this.hasData(proto)) {\n this.proto = undefined;\n this.data = undefined;\n }\n }\n getData(proto) {\n if (this.hasData(proto)) {\n return this.data;\n }\n return undefined;\n }\n setData(data, proto) {\n if (proto) {\n this.data = data;\n this.proto = proto;\n }\n }\n}\nLocalSelectionTransfer.INSTANCE = new LocalSelectionTransfer();\nfunction getPanelData() {\n const panelTransfer = LocalSelectionTransfer.getInstance();\n const isPanelEvent = panelTransfer.hasData(PanelTransfer.prototype);\n if (!isPanelEvent) {\n return undefined;\n }\n return panelTransfer.getData(PanelTransfer.prototype)[0];\n}\nfunction getPaneData() {\n const paneTransfer = LocalSelectionTransfer.getInstance();\n const isPanelEvent = paneTransfer.hasData(PaneTransfer.prototype);\n if (!isPanelEvent) {\n return undefined;\n }\n return paneTransfer.getData(PaneTransfer.prototype)[0];\n}\n\nvar Disposable;\n(function (Disposable) {\n Disposable.NONE = {\n dispose: () => {\n // noop\n },\n };\n function from(func) {\n return {\n dispose: () => {\n func();\n },\n };\n }\n Disposable.from = from;\n})(Disposable || (Disposable = {}));\nclass CompositeDisposable {\n get isDisposed() {\n return this._isDisposed;\n }\n constructor(...args) {\n this._isDisposed = false;\n this._disposables = new Set(args);\n }\n addDisposables(...args) {\n args.forEach((arg) => this._disposables.add(arg));\n }\n removeDisposable(disposable) {\n this._disposables.delete(disposable);\n }\n dispose() {\n if (this._isDisposed) {\n return;\n }\n this._isDisposed = true;\n this._disposables.forEach((arg) => arg.dispose());\n this._disposables.clear();\n }\n}\nclass MutableDisposable {\n constructor() {\n this._disposable = Disposable.NONE;\n }\n set value(disposable) {\n if (this._disposable) {\n this._disposable.dispose();\n }\n this._disposable = disposable;\n }\n dispose() {\n if (this._disposable) {\n this._disposable.dispose();\n this._disposable = Disposable.NONE;\n }\n }\n}\n\nvar Event;\n(function (Event) {\n Event.any = (...children) => {\n return (listener) => {\n const disposables = children.map((child) => child(listener));\n return {\n dispose: () => {\n disposables.forEach((d) => {\n d.dispose();\n });\n },\n };\n };\n };\n})(Event || (Event = {}));\nclass DockviewEvent {\n constructor() {\n this._defaultPrevented = false;\n }\n get defaultPrevented() {\n return this._defaultPrevented;\n }\n preventDefault() {\n this._defaultPrevented = true;\n }\n}\nclass AcceptableEvent {\n constructor() {\n this._isAccepted = false;\n }\n get isAccepted() {\n return this._isAccepted;\n }\n accept() {\n this._isAccepted = true;\n }\n}\nclass LeakageMonitor {\n constructor() {\n this.events = new Map();\n }\n get size() {\n return this.events.size;\n }\n add(event, stacktrace) {\n this.events.set(event, stacktrace);\n }\n delete(event) {\n this.events.delete(event);\n }\n clear() {\n this.events.clear();\n }\n}\nclass Stacktrace {\n static create() {\n var _a;\n return new Stacktrace((_a = new Error().stack) !== null && _a !== void 0 ? _a : '');\n }\n constructor(value) {\n this.value = value;\n }\n print() {\n console.warn('dockview: stacktrace', this.value);\n }\n}\nclass Listener {\n constructor(callback, stacktrace) {\n this.callback = callback;\n this.stacktrace = stacktrace;\n }\n}\n// relatively simple event emitter taken from https://github.com/microsoft/vscode/blob/master/src/vs/base/common/event.ts\nclass Emitter {\n static setLeakageMonitorEnabled(isEnabled) {\n if (isEnabled !== Emitter.ENABLE_TRACKING) {\n Emitter.MEMORY_LEAK_WATCHER.clear();\n }\n Emitter.ENABLE_TRACKING = isEnabled;\n }\n get value() {\n return this._last;\n }\n constructor(options) {\n this.options = options;\n this._listeners = [];\n this._disposed = false;\n this._pauseTokens = new Set();\n }\n get event() {\n if (!this._event) {\n this._event = (callback) => {\n var _a;\n if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.replay) && this._last !== undefined) {\n callback(this._last);\n }\n const listener = new Listener(callback, Emitter.ENABLE_TRACKING ? Stacktrace.create() : undefined);\n this._listeners.push(listener);\n return {\n dispose: () => {\n const index = this._listeners.indexOf(listener);\n if (index > -1) {\n this._listeners.splice(index, 1);\n }\n else if (Emitter.ENABLE_TRACKING) ;\n },\n };\n };\n if (Emitter.ENABLE_TRACKING) {\n Emitter.MEMORY_LEAK_WATCHER.add(this._event, Stacktrace.create());\n }\n }\n return this._event;\n }\n fire(e) {\n var _a;\n if (this._pauseTokens.size > 0) {\n // while paused, the event is dropped entirely — `_last` is not\n // updated, so replay subscribers won't see values fired during a pause\n return;\n }\n if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.replay) {\n this._last = e;\n }\n for (const listener of this._listeners) {\n listener.callback(e);\n }\n }\n pause() {\n const token = {};\n this._pauseTokens.add(token);\n return Disposable.from(() => this._pauseTokens.delete(token));\n }\n dispose() {\n if (!this._disposed) {\n this._disposed = true;\n if (this._listeners.length > 0) {\n if (Emitter.ENABLE_TRACKING) {\n queueMicrotask(() => {\n var _a;\n // don't check until stack of execution is completed to allow for out-of-order disposals within the same execution block\n for (const listener of this._listeners) {\n console.warn('dockview: stacktrace', (_a = listener.stacktrace) === null || _a === void 0 ? void 0 : _a.print());\n }\n });\n }\n this._listeners = [];\n }\n if (Emitter.ENABLE_TRACKING && this._event) {\n Emitter.MEMORY_LEAK_WATCHER.delete(this._event);\n }\n }\n }\n}\nEmitter.ENABLE_TRACKING = false;\nEmitter.MEMORY_LEAK_WATCHER = new LeakageMonitor();\nfunction addDisposableListener(element, type, listener, options) {\n element.addEventListener(type, listener, options);\n return {\n dispose: () => {\n element.removeEventListener(type, listener, options);\n },\n };\n}\n/**\n *\n * Event Emitter that fires events from a Microtask callback, only one event will fire per event-loop cycle.\n *\n * It's kind of like using an `asapScheduler` in RxJs with additional logic to only fire once per event-loop cycle.\n * This implementation exists to avoid external dependencies.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask\n * @see https://rxjs.dev/api/index/const/asapScheduler\n */\nclass AsapEvent {\n constructor() {\n this._onFired = new Emitter();\n this._currentFireCount = 0;\n this._queued = false;\n this.onEvent = (e) => {\n /**\n * when the event is first subscribed to take note of the current fire count\n */\n const fireCountAtTimeOfEventSubscription = this._currentFireCount;\n return this._onFired.event(() => {\n /**\n * if the current fire count is greater than the fire count at event subscription\n * then the event has been fired since we subscribed and it's ok to \"on_next\" the event.\n *\n * if the count is not greater then what we are recieving is an event from the microtask\n * queue that was triggered before we actually subscribed and therfore we should ignore it.\n */\n if (this._currentFireCount > fireCountAtTimeOfEventSubscription) {\n e();\n }\n });\n };\n }\n fire() {\n this._currentFireCount++;\n if (this._queued) {\n return;\n }\n this._queued = true;\n queueMicrotask(() => {\n this._queued = false;\n this._onFired.fire();\n });\n }\n dispose() {\n this._onFired.dispose();\n }\n}\n\nclass OverflowObserver extends CompositeDisposable {\n constructor(el) {\n super();\n this._onDidChange = new Emitter();\n this.onDidChange = this._onDidChange.event;\n this._value = null;\n this.addDisposables(this._onDidChange, watchElementResize(el, (entry) => {\n const hasScrollX = entry.target.scrollWidth > entry.target.clientWidth;\n const hasScrollY = entry.target.scrollHeight > entry.target.clientHeight;\n this._value = { hasScrollX, hasScrollY };\n this._onDidChange.fire(this._value);\n }));\n }\n}\nfunction watchElementResize(element, cb) {\n const observer = new ResizeObserver((entires) => {\n /**\n * Fast browser window resize produces Error: ResizeObserver loop limit exceeded.\n * The error isn't visible in browser console, doesn't affect functionality, but degrades performance.\n * See https://stackoverflow.com/questions/49384120/resizeobserver-loop-limit-exceeded/58701523#58701523\n */\n requestAnimationFrame(() => {\n const firstEntry = entires[0];\n cb(firstEntry);\n });\n });\n observer.observe(element);\n return {\n dispose: () => {\n observer.unobserve(element);\n observer.disconnect();\n },\n };\n}\nconst removeClasses = (element, ...classes) => {\n for (const classname of classes) {\n if (element.classList.contains(classname)) {\n element.classList.remove(classname);\n }\n }\n};\nconst addClasses = (element, ...classes) => {\n for (const classname of classes) {\n if (!element.classList.contains(classname)) {\n element.classList.add(classname);\n }\n }\n};\nconst toggleClass = (element, className, isToggled) => {\n const hasClass = element.classList.contains(className);\n if (isToggled && !hasClass) {\n element.classList.add(className);\n }\n if (!isToggled && hasClass) {\n element.classList.remove(className);\n }\n};\nfunction isAncestor(testChild, testAncestor) {\n while (testChild) {\n if (testChild === testAncestor) {\n return true;\n }\n testChild = testChild.parentNode;\n }\n return false;\n}\nfunction trackFocus(element) {\n return new FocusTracker(element);\n}\n/**\n * Track focus on an element. Ensure tabIndex is set when an HTMLElement is not focusable by default\n */\nclass FocusTracker extends CompositeDisposable {\n constructor(element) {\n super();\n this._onDidFocus = new Emitter();\n this.onDidFocus = this._onDidFocus.event;\n this._onDidBlur = new Emitter();\n this.onDidBlur = this._onDidBlur.event;\n this.addDisposables(this._onDidFocus, this._onDidBlur);\n let hasFocus = isAncestor(document.activeElement, element);\n let loosingFocus = false;\n const onFocus = () => {\n loosingFocus = false;\n if (!hasFocus) {\n hasFocus = true;\n this._onDidFocus.fire();\n }\n };\n const onBlur = () => {\n if (hasFocus) {\n loosingFocus = true;\n window.setTimeout(() => {\n if (loosingFocus) {\n loosingFocus = false;\n hasFocus = false;\n this._onDidBlur.fire();\n }\n }, 0);\n }\n };\n this._refreshStateHandler = () => {\n const currentNodeHasFocus = isAncestor(document.activeElement, element);\n if (currentNodeHasFocus !== hasFocus) {\n if (hasFocus) {\n onBlur();\n }\n else {\n onFocus();\n }\n }\n };\n this.addDisposables(addDisposableListener(element, 'focus', onFocus, true));\n this.addDisposables(addDisposableListener(element, 'blur', onBlur, true));\n }\n refreshState() {\n this._refreshStateHandler();\n }\n}\n// quasi: apparently, but not really; seemingly\nconst QUASI_PREVENT_DEFAULT_KEY = 'dv-quasiPreventDefault';\n// mark an event directly for other listeners to check\nfunction quasiPreventDefault(event) {\n event[QUASI_PREVENT_DEFAULT_KEY] = true;\n}\n// check if this event has been marked\nfunction quasiDefaultPrevented(event) {\n return event[QUASI_PREVENT_DEFAULT_KEY];\n}\nfunction addStyles(document, styleSheetList, options = {}) {\n const styleSheets = Array.from(styleSheetList);\n const { nonce } = options;\n const resolvedNonce = typeof nonce === 'function' ? nonce(document) : nonce;\n for (const styleSheet of styleSheets) {\n if (styleSheet.href) {\n const link = document.createElement('link');\n link.href = styleSheet.href;\n link.type = styleSheet.type;\n link.rel = 'stylesheet';\n document.head.appendChild(link);\n // The <link> will load and apply its rules in the target\n // document. Reading cssRules here would duplicate them\n // (and throws for cross-origin sheets).\n continue;\n }\n let cssTexts = [];\n try {\n if (styleSheet.cssRules) {\n cssTexts = Array.from(styleSheet.cssRules).map((rule) => rule.cssText);\n }\n }\n catch (err) {\n console.warn('dockview: failed to access stylesheet rules due to security restrictions', err);\n }\n const fragment = document.createDocumentFragment();\n for (const rule of cssTexts) {\n const style = document.createElement('style');\n if (resolvedNonce) {\n style.setAttribute('nonce', resolvedNonce);\n }\n style.appendChild(document.createTextNode(rule));\n fragment.appendChild(style);\n }\n document.head.appendChild(fragment);\n }\n}\nfunction getDomNodePagePosition(domNode) {\n const { left, top, width, height } = domNode.getBoundingClientRect();\n return {\n left: left + window.scrollX,\n top: top + window.scrollY,\n width: width,\n height: height,\n };\n}\n/**\n * Check whether an element is in the DOM (including the Shadow DOM)\n * @see https://terodox.tech/how-to-tell-if-an-element-is-in-the-dom-including-the-shadow-dom/\n */\nfunction isInDocument(element) {\n let currentElement = element;\n while (currentElement === null || currentElement === void 0 ? void 0 : currentElement.parentNode) {\n if (currentElement.parentNode === document) {\n return true;\n }\n else if (currentElement.parentNode instanceof DocumentFragment) {\n // handle shadow DOMs\n currentElement = currentElement.parentNode.host;\n }\n else {\n currentElement = currentElement.parentNode;\n }\n }\n return false;\n}\nfunction addTestId(element, id) {\n element.setAttribute('data-testid', id);\n}\n/**\n * Should be more efficient than element.querySelectorAll(\"*\") since there\n * is no need to store every element in-memory using this approach\n */\nfunction allTagsNamesInclusiveOfShadowDoms(tagNames, rootNode) {\n const iframes = [];\n function findIframesInNode(node) {\n if (node.nodeType === Node.ELEMENT_NODE) {\n if (tagNames.includes(node.tagName)) {\n iframes.push(node);\n }\n if (node.shadowRoot) {\n findIframesInNode(node.shadowRoot);\n }\n for (const child of node.children) {\n findIframesInNode(child);\n }\n }\n }\n // Document → walk from its root element. Element → walk from itself.\n const startEl = rootNode instanceof Document\n ? rootNode.documentElement\n : rootNode;\n findIframesInNode(startEl);\n return iframes;\n}\nfunction disableIframePointEvents(rootNode = document) {\n const iframes = allTagsNamesInclusiveOfShadowDoms(['IFRAME', 'WEBVIEW'], rootNode);\n const original = new WeakMap(); // don't hold onto HTMLElement references longer than required\n for (const iframe of iframes) {\n original.set(iframe, iframe.style.pointerEvents);\n iframe.style.pointerEvents = 'none';\n }\n return {\n release: () => {\n var _a;\n for (const iframe of iframes) {\n iframe.style.pointerEvents = (_a = original.get(iframe)) !== null && _a !== void 0 ? _a : 'auto';\n }\n iframes.splice(0, iframes.length); // don't hold onto HTMLElement references longer than required\n },\n };\n}\nfunction getDockviewTheme(element) {\n function toClassList(element) {\n const list = [];\n for (let i = 0; i < element.classList.length; i++) {\n list.push(element.classList.item(i));\n }\n return list;\n }\n let theme = undefined;\n let parent = element;\n while (parent !== null) {\n theme = toClassList(parent).find((cls) => cls.startsWith('dockview-theme-'));\n if (typeof theme === 'string') {\n break;\n }\n parent = parent.parentElement;\n }\n return theme;\n}\nclass Classnames {\n constructor(element) {\n this.element = element;\n this._classNames = [];\n }\n setClassNames(classNames) {\n for (const className of this._classNames) {\n toggleClass(this.element, className, false);\n }\n this._classNames = classNames\n .split(' ')\n .filter((v) => v.trim().length > 0);\n for (const className of this._classNames) {\n toggleClass(this.element, className, true);\n }\n }\n}\nconst DEBOUCE_DELAY = 100;\nfunction isChildEntirelyVisibleWithinParent(child, parent) {\n const childPosition = getDomNodePagePosition(child);\n const parentPosition = getDomNodePagePosition(parent);\n // Check horizontal visibility\n if (childPosition.left < parentPosition.left) {\n return false;\n }\n if (childPosition.left + childPosition.width >\n parentPosition.left + parentPosition.width) {\n return false;\n }\n // Check vertical visibility\n if (childPosition.top < parentPosition.top) {\n return false;\n }\n if (childPosition.top + childPosition.height >\n parentPosition.top + parentPosition.height) {\n return false;\n }\n return true;\n}\nfunction onDidWindowMoveEnd(window) {\n const emitter = new Emitter();\n let previousScreenX = window.screenX;\n let previousScreenY = window.screenY;\n let timeout;\n const checkMovement = () => {\n if (window.closed) {\n return;\n }\n const currentScreenX = window.screenX;\n const currentScreenY = window.screenY;\n if (currentScreenX !== previousScreenX ||\n currentScreenY !== previousScreenY) {\n clearTimeout(timeout);\n timeout = setTimeout(() => {\n emitter.fire();\n }, DEBOUCE_DELAY);\n previousScreenX = currentScreenX;\n previousScreenY = currentScreenY;\n }\n requestAnimationFrame(checkMovement);\n };\n checkMovement();\n return emitter;\n}\nfunction onDidWindowResizeEnd(element, cb) {\n let resizeTimeout;\n const disposable = new CompositeDisposable(addDisposableListener(element, 'resize', () => {\n clearTimeout(resizeTimeout);\n resizeTimeout = setTimeout(() => {\n cb();\n }, DEBOUCE_DELAY);\n }));\n return disposable;\n}\nfunction shiftAbsoluteElementIntoView(element, root, options = { buffer: 10 }) {\n const buffer = options.buffer;\n const rect = element.getBoundingClientRect();\n const rootRect = root.getBoundingClientRect();\n let translateX = 0;\n let translateY = 0;\n const left = rect.left - rootRect.left;\n const top = rect.top - rootRect.top;\n const bottom = rect.bottom - rootRect.bottom;\n const right = rect.right - rootRect.right;\n // Check horizontal overflow\n if (left < buffer) {\n translateX = buffer - left;\n }\n else if (right > buffer) {\n translateX = -buffer - right;\n }\n // Check vertical overflow\n if (top < buffer) {\n translateY = buffer - top;\n }\n else if (bottom > buffer) {\n translateY = -bottom - buffer;\n }\n // Apply the translation if needed\n if (translateX !== 0 || translateY !== 0) {\n element.style.transform = `translate(${translateX}px, ${translateY}px)`;\n }\n}\nfunction findRelativeZIndexParent(el) {\n let tmp = el;\n while (tmp && (tmp.style.zIndex === 'auto' || tmp.style.zIndex === '')) {\n tmp = tmp.parentElement;\n }\n return tmp;\n}\n\nfunction tail(arr) {\n if (arr.length === 0) {\n throw new Error('Invalid tail call');\n }\n return [arr.slice(0, arr.length - 1), arr[arr.length - 1]];\n}\nfunction sequenceEquals(arr1, arr2) {\n if (arr1.length !== arr2.length) {\n return false;\n }\n for (let i = 0; i < arr1.length; i++) {\n if (arr1[i] !== arr2[i]) {\n return false;\n }\n }\n return true;\n}\n/**\n * Pushes an element to the start of the array, if found.\n */\nfunction pushToStart(arr, value) {\n const index = arr.indexOf(value);\n if (index > -1) {\n arr.splice(index, 1);\n arr.unshift(value);\n }\n}\n/**\n * Pushes an element to the end of the array, if found.\n */\nfunction pushToEnd(arr, value) {\n const index = arr.indexOf(value);\n if (index > -1) {\n arr.splice(index, 1);\n arr.push(value);\n }\n}\nfunction firstIndex(array, fn) {\n for (let i = 0; i < array.length; i++) {\n const element = array[i];\n if (fn(element)) {\n return i;\n }\n }\n return -1;\n}\nfunction remove(array, value) {\n const index = array.findIndex((t) => t === value);\n if (index > -1) {\n array.splice(index, 1);\n return true;\n }\n return false;\n}\n\nconst clamp = (value, min, max) => {\n if (min > max) {\n /**\n * caveat: an error should be thrown here if this was a proper `clamp` function but we need to handle\n * cases where `min` > `max` and in those cases return `min`.\n */\n return min;\n }\n return Math.min(max, Math.max(value, min));\n};\nconst sequentialNumberGenerator = () => {\n let value = 1;\n return { next: () => (value++).toString() };\n};\nconst range = (from, to) => {\n const result = [];\n if (typeof to !== 'number') {\n to = from;\n from = 0;\n }\n if (from <= to) {\n for (let i = from; i < to; i++) {\n result.push(i);\n }\n }\n else {\n for (let i = from; i > to; i--) {\n result.push(i);\n }\n }\n return result;\n};\n\nclass ViewItem {\n set size(size) {\n this._size = size;\n }\n get size() {\n return this._size;\n }\n get cachedVisibleSize() {\n return this._cachedVisibleSize;\n }\n get visible() {\n return typeof this._cachedVisibleSize === 'undefined';\n }\n get minimumSize() {\n return this.visible ? this.view.minimumSize : 0;\n }\n get viewMinimumSize() {\n return this.view.minimumSize;\n }\n get maximumSize() {\n return this.visible ? this.view.maximumSize : 0;\n }\n get viewMaximumSize() {\n return this.view.maximumSize;\n }\n get priority() {\n return this.view.priority;\n }\n get snap() {\n return !!this.view.snap;\n }\n set enabled(enabled) {\n this.container.style.pointerEvents = enabled ? '' : 'none';\n }\n constructor(container, view, size, disposable) {\n this.container = container;\n this.view = view;\n this.disposable = disposable;\n this._cachedVisibleSize = undefined;\n if (typeof size === 'number') {\n this._size = size;\n this._cachedVisibleSize = undefined;\n container.classList.add('visible');\n }\n else {\n this._size = 0;\n this._cachedVisibleSize = size.cachedVisibleSize;\n }\n }\n setVisible(visible, size) {\n var _a;\n if (visible === this.visible) {\n return;\n }\n if (visible) {\n this.size = clamp((_a = this._cachedVisibleSize) !== null && _a !== void 0 ? _a : 0, this.viewMinimumSize, this.viewMaximumSize);\n this._cachedVisibleSize = undefined;\n }\n else {\n this._cachedVisibleSize =\n typeof size === 'number' ? size : this.size;\n this.size = 0;\n }\n this.container.classList.toggle('visible', visible);\n if (this.view.setVisible) {\n this.view.setVisible(visible);\n }\n }\n dispose() {\n this.disposable.dispose();\n return this.view;\n }\n}\n\n/*---------------------------------------------------------------------------------------------\n * Accreditation: This file is largly based upon the MIT licenced VSCode sourcecode found at:\n * https://github.com/microsoft/vscode/tree/main/src/vs/base/browser/ui/splitview\n *--------------------------------------------------------------------------------------------*/\nvar Orientation;\n(function (Orientation) {\n Orientation[\"HORIZONTAL\"] = \"HORIZONTAL\";\n Orientation[\"VERTICAL\"] = \"VERTICAL\";\n})(Orientation || (Orientation = {}));\nvar SashState;\n(function (SashState) {\n SashState[SashState[\"MAXIMUM\"] = 0] = \"MAXIMUM\";\n SashState[SashState[\"MINIMUM\"] = 1] = \"MINIMUM\";\n SashState[SashState[\"DISABLED\"] = 2] = \"DISABLED\";\n SashState[SashState[\"ENABLED\"] = 3] = \"ENABLED\";\n})(SashState || (SashState = {}));\nvar LayoutPriority;\n(function (LayoutPriority) {\n LayoutPriority[\"Low\"] = \"low\";\n LayoutPriority[\"High\"] = \"high\";\n LayoutPriority[\"Normal\"] = \"normal\";\n})(LayoutPriority || (LayoutPriority = {}));\nvar Sizing;\n(function (Sizing) {\n Sizing.Distribute = { type: 'distribute' };\n function Split(index) {\n return { type: 'split', index };\n }\n Sizing.Split = Split;\n function Invisible(cachedVisibleSize) {\n return { type: 'invisible', cachedVisibleSize };\n }\n Sizing.Invisible = Invisible;\n})(Sizing || (Sizing = {}));\nclass Splitview {\n get contentSize() {\n return this._contentSize;\n }\n get size() {\n return this._size;\n }\n set size(value) {\n this._size = value;\n }\n get orthogonalSize() {\n return this._orthogonalSize;\n }\n set orthogonalSize(value) {\n this._orthogonalSize = value;\n }\n get length() {\n return this.viewItems.length;\n }\n get proportions() {\n return this._proportions ? [...this._proportions] : undefined;\n }\n get orientation() {\n return this._orientation;\n }\n set orientation(value) {\n this._orientation = value;\n const tmp = this.size;\n this.size = this.orthogonalSize;\n this.orthogonalSize = tmp;\n removeClasses(this.element, 'dv-horizontal', 'dv-vertical');\n this.element.classList.add(this.orientation == Orientation.HORIZONTAL\n ? 'dv-horizontal'\n : 'dv-vertical');\n }\n get minimumSize() {\n return this.viewItems.reduce((r, item) => r + item.minimumSize, 0);\n }\n get maximumSize() {\n return this.length === 0\n ? Number.POSITIVE_INFINITY\n : this.viewItems.reduce((r, item) => r + item.maximumSize, 0);\n }\n get startSnappingEnabled() {\n return this._startSnappingEnabled;\n }\n set startSnappingEnabled(startSnappingEnabled) {\n if (this._startSnappingEnabled === startSnappingEnabled) {\n return;\n }\n this._startSnappingEnabled = startSnappingEnabled;\n this.updateSashEnablement();\n }\n get endSnappingEnabled() {\n return this._endSnappingEnabled;\n }\n set endSnappingEnabled(endSnappingEnabled) {\n if (this._endSnappingEnabled === endSnappingEnabled) {\n return;\n }\n this._endSnappingEnabled = endSnappingEnabled;\n this.updateSashEnablement();\n }\n get disabled() {\n return this._disabled;\n }\n set disabled(value) {\n this._disabled = value;\n toggleClass(this.element, 'dv-splitview-disabled', value);\n }\n get margin() {\n return this._margin;\n }\n set margin(value) {\n this._margin = value;\n toggleClass(this.element, 'dv-splitview-has-margin', value !== 0);\n }\n constructor(container, options) {\n var _a, _b;\n this.container = container;\n this.viewItems = [];\n this.sashes = [];\n this._size = 0;\n this._orthogonalSize = 0;\n this._contentSize = 0;\n this._proportions = undefined;\n this._startSnappingEnabled = true;\n this._endSnappingEnabled = true;\n this._disabled = false;\n this._margin = 0;\n this._onDidSashEnd = new Emitter();\n this.onDidSashEnd = this._onDidSashEnd.event;\n this._onDidAddView = new Emitter();\n this.onDidAddView = this._onDidAddView.event;\n this._onDidRemoveView = new Emitter();\n this.onDidRemoveView = this._onDidRemoveView.event;\n this.resize = (index, delta, sizes = this.viewItems.map((x) => x.size), lowPriorityIndexes, highPriorityIndexes, overloadMinDelta = Number.NEGATIVE_INFINITY, overloadMaxDelta = Number.POSITIVE_INFINITY, snapBefore, snapAfter) => {\n if (index < 0 || index > this.viewItems.length) {\n return 0;\n }\n const upIndexes = range(index, -1);\n const downIndexes = range(index + 1, this.viewItems.length);\n //\n if (highPriorityIndexes) {\n for (const i of highPriorityIndexes) {\n pushToStart(upIndexes, i);\n pushToStart(downIndexes, i);\n }\n }\n if (lowPriorityIndexes) {\n for (const i of lowPriorityIndexes) {\n pushToEnd(upIndexes, i);\n pushToEnd(downIndexes, i);\n }\n }\n //\n const upItems = upIndexes.map((i) => this.viewItems[i]);\n const upSizes = upIndexes.map((i) => sizes[i]);\n //\n const downItems = downIndexes.map((i) => this.viewItems[i]);\n const downSizes = downIndexes.map((i) => sizes[i]);\n //\n const minDeltaUp = upIndexes.reduce((_, i) => _ + this.viewItems[i].minimumSize - sizes[i], 0);\n const maxDeltaUp = upIndexes.reduce((_, i) => _ + this.viewItems[i].maximumSize - sizes[i], 0);\n //\n const maxDeltaDown = downIndexes.length === 0\n ? Number.POSITIVE_INFINITY\n : downIndexes.reduce((_, i) => _ + sizes[i] - this.viewItems[i].minimumSize, 0);\n const minDeltaDown = downIndexes.length === 0\n ? Number.NEGATIVE_INFINITY\n : downIndexes.reduce((_, i) => _ + sizes[i] - this.viewItems[i].maximumSize, 0);\n //\n const minDelta = Math.max(minDeltaUp, minDeltaDown);\n const maxDelta = Math.min(maxDeltaDown, maxDeltaUp);\n //\n let snapped = false;\n if (snapBefore) {\n const snapView = this.viewItems[snapBefore.index];\n const visible = delta >= snapBefore.limitDelta;\n snapped = visible !== snapView.visible;\n snapView.setVisible(visible, snapBefore.size);\n }\n if (!snapped && snapAfter) {\n const snapView = this.viewItems[snapAfter.index];\n const visible = delta < snapAfter.limitDelta;\n snapped = visible !== snapView.visible;\n snapView.setVisible(visible, snapAfter.size);\n }\n if (snapped) {\n return this.resize(index, delta, sizes, lowPriorityIndexes, highPriorityIndexes, overloadMinDelta, overloadMaxDelta);\n }\n //\n const tentativeDelta = clamp(delta, minDelta, maxDelta);\n let actualDelta = 0;\n //\n let deltaUp = tentativeDelta;\n for (let i = 0; i < upItems.length; i++) {\n const item = upItems[i];\n const size = clamp(upSizes[i] + deltaUp, item.minimumSize, item.maximumSize);\n const viewDelta = size - upSizes[i];\n actualDelta += viewDelta;\n deltaUp -= viewDelta;\n item.size = size;\n }\n //\n let deltaDown = actualDelta;\n for (let i = 0; i < downItems.length; i++) {\n const item = downItems[i];\n const size = clamp(downSizes[i] - deltaDown, item.minimumSize, item.maximumSize);\n const viewDelta = size - downSizes[i];\n deltaDown += viewDelta;\n item.size = size;\n }\n //\n return delta;\n };\n this._orientation = (_a = options.orientation) !== null && _a !== void 0 ? _a : Orientation.VERTICAL;\n this.element = this.createContainer();\n this.margin = (_b = options.margin) !== null && _b !== void 0 ? _b : 0;\n this.proportionalLayout =\n options.proportionalLayout === undefined\n ? true\n : !!options.proportionalLayout;\n this.viewContainer = this.createViewContainer();\n this.sashContainer = this.createSashContainer();\n this.element.appendChild(this.sashContainer);\n this.element.appendChild(this.viewContainer);\n this.container.appendChild(this.element);\n this.style(options.styles);\n // We have an existing set of view, add them now\n if (options.descriptor) {\n this._size = options.descriptor.size;\n options.descriptor.views.forEach((viewDescriptor, index) => {\n const sizing = viewDescriptor.visible === undefined ||\n viewDescriptor.visible\n ? viewDescriptor.size\n : {\n type: 'invisible',\n cachedVisibleSize: viewDescriptor.size,\n };\n const view = viewDescriptor.view;\n this.addView(view, sizing, index, true\n // true skip layout\n );\n });\n // Initialize content size and proportions for first layout\n this._contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);\n this.saveProportions();\n }\n }\n style(styles) {\n if ((styles === null || styles === void 0 ? void 0 : styles.separatorBorder) === 'transparent') {\n removeClasses(this.element, 'dv-separator-border');\n this.element.style.removeProperty('--dv-separator-border');\n }\n else {\n addClasses(this.element, 'dv-separator-border');\n if (styles === null || styles === void 0 ? void 0 : styles.separatorBorder) {\n this.element.style.setProperty('--dv-separator-border', styles.separatorBorder);\n }\n }\n }\n isViewVisible(index) {\n if (index < 0 || index >= this.viewItems.length) {\n throw new Error('Index out of bounds');\n }\n const viewItem = this.viewItems[index];\n return viewItem.visible;\n }\n setViewVisible(index, visible) {\n if (index < 0 || index >= this.viewItems.length) {\n throw new Error('Index out of bounds');\n }\n const viewItem = this.viewItems[index];\n viewItem.setVisible(visible, viewItem.size);\n this.distributeEmptySpace(index);\n this.layoutViews();\n this.saveProportions();\n }\n getViewSize(index) {\n if (index < 0 || index >= this.viewItems.length) {\n return -1;\n }\n return this.viewItems[index].size;\n }\n resizeView(index, size) {\n if (index < 0 || index >= this.viewItems.length) {\n return;\n }\n const indexes = range(this.viewItems.length).filter((i) => i !== index);\n const lowPriorityIndexes = [\n ...indexes.filter((i) => this.viewItems[i].priority === LayoutPriority.Low),\n index,\n ];\n const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === LayoutPriority.High);\n const item = this.viewItems[index];\n size = Math.round(size);\n size = clamp(size, item.minimumSize, Math.min(item.maximumSize, this._size));\n item.size = size;\n this.relayout(lowPriorityIndexes, highPriorityIndexes);\n }\n getViews() {\n return this.viewItems.map((x) => x.view);\n }\n onDidChange(item, size) {\n const index = this.viewItems.indexOf(item);\n if (index < 0 || index >= this.viewItems.length) {\n return;\n }\n size = typeof size === 'number' ? size : item.size;\n size = clamp(size, item.minimumSize, item.maximumSize);\n item.size = size;\n const indexes = range(this.viewItems.length).filter((i) => i !== index);\n const lowPriorityIndexes = [\n ...indexes.filter((i) => this.viewItems[i].priority === LayoutPriority.Low),\n index,\n ];\n const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === LayoutPriority.High);\n /**\n * add this view we are changing to the low-index list since we have determined the size\n * here and don't want it changed\n */\n this.relayout([...lowPriorityIndexes, index], highPriorityIndexes);\n }\n addView(view, size = { type: 'distribute' }, index = this.viewItems.length, skipLayout) {\n const container = document.createElement('div');\n container.className = 'dv-view';\n container.appendChild(view.element);\n let viewSize;\n if (typeof size === 'number') {\n viewSize = size;\n }\n else if (size.type === 'split') {\n viewSize = this.getViewSize(size.index) / 2;\n }\n else if (size.type === 'invisible') {\n viewSize = { cachedVisibleSize: size.cachedVisibleSize };\n }\n else {\n viewSize = view.minimumSize;\n }\n const disposable = view.onDidChange((newSize) => this.onDidChange(viewItem, newSize.size));\n const viewItem = new ViewItem(container, view, viewSize, {\n dispose: () => {\n disposable.dispose();\n this.viewContainer.removeChild(container);\n },\n });\n if (index === this.viewItems.length) {\n this.viewContainer.appendChild(container);\n }\n else {\n this.viewContainer.insertBefore(container, this.viewContainer.children.item(index));\n }\n this.viewItems.splice(index, 0, viewItem);\n if (this.viewItems.length > 1) {\n //add sash\n const sash = document.createElement('div');\n sash.className = 'dv-sash';\n const onPointerStart = (event) => {\n for (const item of this.viewItems) {\n item.enabled = false;\n }\n const iframes = disableIframePointEvents();\n const start = this._orientation === Orientation.HORIZONTAL\n ? event.clientX\n : event.clientY;\n const sashIndex = firstIndex(this.sashes, (s) => s.container === sash);\n //\n const sizes = this.viewItems.map((x) => x.size);\n //\n let snapBefore;\n let snapAfter;\n const upIndexes = range(sashIndex, -1);\n const downIndexes = range(sashIndex + 1, this.viewItems.length);\n const minDeltaUp = upIndexes.reduce((r, i) => r + (this.viewItems[i].minimumSize - sizes[i]), 0);\n const maxDeltaUp = upIndexes.reduce((r, i) => r + (this.viewItems[i].viewMaximumSize - sizes[i]), 0);\n const maxDeltaDown = downIndexes.length === 0\n ? Number.POSITIVE_INFINITY\n : downIndexes.reduce((r, i) => r +\n (sizes[i] - this.viewItems[i].minimumSize), 0);\n const minDeltaDown = downIndexes.length === 0\n ? Number.NEGATIVE_INFINITY\n : downIndexes.reduce((r, i) => r +\n (sizes[i] -\n this.viewItems[i].viewMaximumSize), 0);\n const minDelta = Math.max(minDeltaUp, minDeltaDown);\n const maxDelta = Math.min(maxDeltaDown, maxDeltaUp);\n const snapBeforeIndex = this.findFirstSnapIndex(upIndexes);\n const snapAfterIndex = this.findFirstSnapIndex(downIndexes);\n if (typeof snapBeforeIndex === 'number') {\n const snappedViewItem = this.viewItems[snapBeforeIndex];\n const halfSize = Math.floor(snappedViewItem.viewMinimumSize / 2);\n snapBefore = {\n index: snapBeforeIndex,\n limitDelta: snappedViewItem.visible\n ? minDelta - halfSize\n : minDelta + halfSize,\n size: snappedViewItem.size,\n };\n }\n if (typeof snapAfterIndex === 'number') {\n const snappedViewItem = this.viewItems[snapAfterIndex];\n const halfSize = Math.floor(snappedViewItem.viewMinimumSize / 2);\n snapAfter = {\n index: snapAfterIndex,\n limitDelta: snappedViewItem.visible\n ? maxDelta + halfSize\n : maxDelta - halfSize,\n size: snappedViewItem.size,\n };\n }\n const onPointerMove = (event) => {\n const current = this._orientation === Orientation.HORIZONTAL\n ? event.clientX\n : event.clientY;\n const delta = current - start;\n this.resize(sashIndex, delta, sizes, undefined, undefined, minDelta, maxDelta, snapBefore, snapAfter);\n this.distributeEmptySpace();\n this.layoutViews();\n };\n const end = () => {\n for (const item of this.viewItems) {\n item.enabled = true;\n }\n iframes.release();\n this.saveProportions();\n document.removeEventListener('pointermove', onPointerMove);\n document.removeEventListener('pointerup', end);\n document.removeEventListener('pointercancel', end);\n document.removeEventListener('contextmenu', end);\n this._onDidSashEnd.fire(undefined);\n };\n document.addEventListener('pointermove', onPointerMove);\n document.addEventListener('pointerup', end);\n document.addEventListener('pointercancel', end);\n document.addEventListener('contextmenu', end);\n };\n sash.addEventListener('pointerdown', onPointerStart);\n const sashItem = {\n container: sash,\n disposable: () => {\n sash.removeEventListener('pointerdown', onPointerStart);\n this.sashContainer.removeChild(sash);\n },\n };\n this.sashContainer.appendChild(sash);\n this.sashes.push(sashItem);\n }\n if (!skipLayout) {\n this.relayout([index]);\n }\n if (!skipLayout &&\n typeof size !== 'number' &&\n size.type === 'distribute') {\n this.distributeViewSizes();\n }\n this._onDidAddView.fire(view);\n }\n distributeViewSizes() {\n const flexibleViewItems = [];\n let flexibleSize = 0;\n for (const item of this.viewItems) {\n if (item.maximumSize - item.minimumSize > 0) {\n flexibleViewItems.push(item);\n flexibleSize += item.size;\n }\n }\n const size = Math.floor(flexibleSize / flexibleViewItems.length);\n for (const item of flexibleViewItems) {\n item.size = clamp(size, item.minimumSize, item.maximumSize);\n }\n const indexes = range(this.viewItems.length);\n const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === LayoutPriority.Low);\n const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === LayoutPriority.High);\n this.relayout(lowPriorityIndexes, highPriorityIndexes);\n }\n removeView(index, sizing, skipLayout = false) {\n // Remove view\n const viewItem = this.viewItems.splice(index, 1)[0];\n viewItem.dispose();\n // Remove sash\n if (this.viewItems.length >= 1) {\n const sashIndex = Math.max(index - 1, 0);\n const sashItem = this.sashes.splice(sashIndex, 1)[0];\n sashItem.disposable();\n }\n if (!skipLayout) {\n this.relayout();\n }\n if (sizing && sizing.type === 'distribute') {\n this.distributeViewSizes();\n }\n this._onDidRemoveView.fire(viewItem.view);\n return viewItem.view;\n }\n getViewCachedVisibleSize(index) {\n if (index < 0 || index >= this.viewItems.length) {\n throw new Error('Index out of bounds');\n }\n const viewItem = this.viewItems[index];\n return viewItem.cachedVisibleSize;\n }\n moveView(from, to) {\n const cachedVisibleSize = this.getViewCachedVisibleSize(from);\n const sizing = typeof cachedVisibleSize === 'undefined'\n ? this.getViewSize(from)\n : Sizing.Invisible(cachedVisibleSize);\n const view = this.removeView(from, undefined, true);\n this.addView(view, sizing, to);\n }\n layout(size, orthogonalSize) {\n const previousSize = Math.max(this.size, this._contentSize);\n this.size = size;\n this.orthogonalSize = orthogonalSize;\n if (!this.proportions) {\n const indexes = range(this.viewItems.length);\n const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === LayoutPriority.Low);\n const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === LayoutPriority.High);\n this.resize(this.viewItems.length - 1, size - previousSize, undefined, lowPriorityIndexes, highPriorityIndexes);\n }\n else {\n let total = 0;\n for (let i = 0; i < this.viewItems.length; i++) {\n const item = this.viewItems[i];\n const proportion = this.proportions[i];\n if (typeof proportion === 'number') {\n total += proportion;\n }\n else {\n size -= item.size;\n }\n }\n for (let i = 0; i < this.viewItems.length; i++) {\n const item = this.viewItems[i];\n const proportion = this.proportions[i];\n if (typeof proportion === 'number' && total > 0) {\n item.size = clamp(Math.round((proportion * size) / total), item.minimumSize, item.maximumSize);\n }\n }\n }\n this.distributeEmptySpace();\n this.layoutViews();\n }\n relayout(lowPriorityIndexes, highPriorityIndexes) {\n const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);\n this.resize(this.viewItems.length - 1, this._size - contentSize, undefined, lowPriorityIndexes, highPriorityIndexes);\n this.distributeEmptySpace();\n this.layoutViews();\n this.saveProportions();\n }\n distributeEmptySpace(lowPriorityIndex) {\n const contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);\n let emptyDelta = this.size - contentSize;\n const indexes = range(this.viewItems.length - 1, -1);\n const lowPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === LayoutPriority.Low);\n const highPriorityIndexes = indexes.filter((i) => this.viewItems[i].priority === LayoutPriority.High);\n for (const index of highPriorityIndexes) {\n pushToStart(indexes, index);\n }\n for (const index of lowPriorityIndexes) {\n pushToEnd(indexes, index);\n }\n if (typeof lowPriorityIndex === 'number') {\n pushToEnd(indexes, lowPriorityIndex);\n }\n for (let i = 0; emptyDelta !== 0 && i < indexes.length; i++) {\n const item = this.viewItems[indexes[i]];\n const size = clamp(item.size + emptyDelta, item.minimumSize, item.maximumSize);\n const viewDelta = size - item.size;\n emptyDelta -= viewDelta;\n item.size = size;\n }\n }\n saveProportions() {\n if (this.proportionalLayout && this._contentSize > 0) {\n this._proportions = this.viewItems.map((i) => i.visible ? i.size / this._contentSize : undefined);\n }\n }\n /**\n * Margin explain:\n *\n * For `n` views in a splitview there will be `n-1` margins `m`.\n *\n * To fit the margins each view must reduce in size by `(m * (n - 1)) / n`.\n *\n * For each view `i` the offet must be adjusted by `m * i/(n - 1)`.\n */\n layoutViews() {\n this._contentSize = this.viewItems.reduce((r, i) => r + i.size, 0);\n this.updateSashEnablement();\n if (this.viewItems.length === 0) {\n return;\n }\n const visibleViewItems = this.viewItems.filter((i) => i.visible);\n const sashCount = Math.max(0, visibleViewItems.length - 1);\n const marginReducedSize = (this.margin * sashCount) / Math.max(1, visibleViewItems.length);\n let totalLeftOffset = 0;\n const viewLeftOffsets = [];\n const sashWidth = 4; // hardcoded in css\n const runningVisiblePanelCount = this.viewItems.reduce((arr, viewItem, i) => {\n const flag = viewItem.visible ? 1 : 0;\n if (i === 0) {\n arr.push(flag);\n }\n else {\n arr.push(arr[i - 1] + flag);\n }\n return arr;\n }, []);\n // calculate both view and cash positions\n this.viewItems.forEach((view, i) => {\n totalLeftOffset += this.viewItems[i].size;\n viewLeftOffsets.push(totalLeftOffset);\n const size = view.visible ? view.size - marginReducedSize : 0;\n const visiblePanelsBeforeThisView = Math.max(0, runningVisiblePanelCount[i] - 1);\n const offset = i === 0 || visiblePanelsBeforeThisView === 0\n ? 0\n : viewLeftOffsets[i - 1] +\n (visiblePanelsBeforeThisView / sashCount) *\n marginReducedSize;\n if (i < this.viewItems.length - 1) {\n // calculate sash position\n const newSize = view.visible\n ? offset + size - sashWidth / 2 + this.margin / 2\n : offset;\n if (this._orientation === Orientation.HORIZONTAL) {\n this.sashes[i].container.style.left = `${newSize}px`;\n this.sashes[i].container.style.top = `0px`;\n }\n if (this._orientation === Orientation.VERTICAL) {\n this.sashes[i].container.style.left = `0px`;\n this.sashes[i].container.style.top = `${newSize}px`;\n }\n }\n // calculate view position\n if (this._orientation === Orientation.HORIZONTAL) {\n view.container.style.width = `${size}px`;\n view.container.style.left = `${offset}px`;\n view.container.style.top = '';\n view.container.style.height = '';\n }\n if (this._orientation === Orientation.VERTICAL) {\n view.container.style.height = `${size}px`;\n view.container.style.top = `${offset}px`;\n view.container.style.width = '';\n view.container.style.left = '';\n }\n view.view.layout(view.size - marginReducedSize, this._orthogonalSize);\n });\n }\n findFirstSnapIndex(indexes) {\n // visible views first\n for (const index of indexes) {\n const viewItem = this.viewItems[index];\n if (!viewItem.visible) {\n continue;\n }\n if (viewItem.snap) {\n return index;\n }\n }\n // then, hidden views\n for (const index of indexes) {\n const viewItem = this.viewItems[index];\n if (viewItem.visible &&\n viewItem.maximumSize - viewItem.minimumSize > 0) {\n return undefined;\n }\n if (!viewItem.visible && viewItem.snap) {\n return index;\n }\n }\n return undefined;\n }\n updateSashEnablement() {\n let previous = false;\n const collapsesDown = this.viewItems.map((i) => (previous = i.size - i.minimumSize > 0 || previous));\n previous = false;\n const expandsDown = this.viewItems.map((i) => (previous = i.maximumSize - i.size > 0 || previous));\n const reverseViews = [...this.viewItems].reverse();\n previous = false;\n const collapsesUp = reverseViews\n .map((i) => (previous = i.size - i.minimumSize > 0 || previous))\n .reverse();\n previous = false;\n const expandsUp = reverseViews\n .map((i) => (previous = i.maximumSize - i.size > 0 || previous))\n .reverse();\n let position = 0;\n for (let index = 0; index < this.sashes.length; index++) {\n const sash = this.sashes[index];\n const viewItem = this.viewItems[index];\n position += viewItem.size;\n const min = !(collapsesDown[index] && expandsUp[index + 1]);\n const max = !(expandsDown[index] && collapsesUp[index + 1]);\n if (min && max) {\n const upIndexes = range(index, -1);\n const downIndexes = range(index + 1, this.viewItems.length);\n const snapBeforeIndex = this.findFirstSnapIndex(upIndexes);\n const snapAfterIndex = this.findFirstSnapIndex(downIndexes);\n const snappedBefore = typeof snapBeforeIndex === 'number' &&\n !this.viewItems[snapBeforeIndex].visible;\n const snappedAfter = typeof snapAfterIndex === 'number' &&\n !this.viewItems[snapAfterIndex].visible;\n if (snappedBefore &&\n collapsesUp[index] &&\n (position > 0 || this.startSnappingEnabled)) {\n this.updateSash(sash, SashState.MINIMUM);\n }\n else if (snappedAfter &&\n collapsesDown[index] &&\n (position < this._contentSize || this.endSnappingEnabled)) {\n this.updateSash(sash, SashState.MAXIMUM);\n }\n else {\n this.updateSash(sash, SashState.DISABLED);\n }\n }\n else if (min && !max) {\n this.updateSash(sash, SashState.MINIMUM);\n }\n else if (!min && max) {\n this.updateSash(sash, SashState.MAXIMUM);\n }\n else {\n this.updateSash(sash, SashState.ENABLED);\n }\n }\n }\n updateSash(sash, state) {\n toggleClass(sash.container, 'dv-disabled', state === SashState.DISABLED);\n toggleClass(sash.container, 'dv-enabled', state === SashState.ENABLED);\n toggleClass(sash.container, 'dv-maximum', state === SashState.MAXIMUM);\n toggleClass(sash.container, 'dv-minimum', state === SashState.MINIMUM);\n }\n createViewContainer() {\n const element = document.createElement('div');\n element.className = 'dv-view-container';\n return element;\n }\n createSashContainer() {\n const element = document.createElement('div');\n element.className = 'dv-sash-container';\n return element;\n }\n createContainer() {\n const element = document.createElement('div');\n const orientationClassname = this._orientation === Orientation.HORIZONTAL\n ? 'dv-horizontal'\n : 'dv-vertical';\n element.className = `dv-split-view-container ${orientationClassname}`;\n return element;\n }\n dispose() {\n this._onDidSashEnd.dispose();\n this._onDidAddView.dispose();\n this._onDidRemoveView.dispose();\n for (let i = 0; i < this.element.children.length; i++) {\n if (this.element.children.item(i) === this.element) {\n this.element.removeChild(this.element);\n break;\n }\n }\n for (const viewItem of this.viewItems) {\n viewItem.dispose();\n }\n this.element.remove();\n }\n}\n\nconst PROPERTY_KEYS_SPLITVIEW = (() => {\n /**\n * by readong the keys from an empty value object TypeScript will error\n * when we add or remove new properties to `DockviewOptions`\n */\n const properties = {\n orientation: undefined,\n descriptor: undefined,\n proportionalLayout: undefined,\n styles: undefined,\n margin: undefined,\n disableAutoResizing: undefined,\n className: undefined,\n };\n return Object.keys(properties);\n})();\n\nclass Paneview extends CompositeDisposable {\n get onDidAddView() {\n return this.splitview.onDidAddView;\n }\n get onDidRemoveView() {\n return this.splitview.onDidRemoveView;\n }\n get minimumSize() {\n return this.splitview.minimumSize;\n }\n get maximumSize() {\n return this.splitview.maximumSize;\n }\n get orientation() {\n return this.splitview.orientation;\n }\n get size() {\n return this.splitview.size;\n }\n get orthogonalSize() {\n return this.splitview.orthogonalSize;\n }\n constructor(container, options) {\n var _a;\n super();\n this.paneItems = [];\n this.skipAnimation = false;\n this._onDidChange = new Emitter();\n this.onDidChange = this._onDidChange.event;\n this._orientation = (_a = options.orientation) !== null && _a !== void 0 ? _a : Orientation.VERTICAL;\n this.element = document.createElement('div');\n this.element.className = 'dv-pane-container';\n container.appendChild(this.element);\n this.splitview = new Splitview(this.element, {\n orientation: this._orientation,\n proportionalLayout: false,\n descriptor: options.descriptor,\n });\n // if we've added views from the descriptor we need to\n // add the panes to our Pane array and setup animation\n this.getPanes().forEach((pane) => {\n const disposable = new CompositeDisposable(pane.onDidChangeExpansionState(() => {\n this.setupAnimation();\n this._onDidChange.fire(undefined);\n }));\n const paneItem = {\n pane,\n disposable: {\n dispose: () => {\n disposable.dispose();\n },\n },\n };\n this.paneItems.push(paneItem);\n pane.orthogonalSize = this.splitview.orthogonalSize;\n });\n this.addDisposables(this._onDidChange, this.splitview.onDidSashEnd(() => {\n this._onDidChange.fire(undefined);\n }), this.splitview.onDidAddView(() => {\n this._onDidChange.fire();\n }), this.splitview.onDidRemoveView(() => {\n this._onDidChange.fire();\n }));\n }\n setViewVisible(index, visible) {\n this.splitview.setViewVisible(index, visible);\n }\n addPane(pane, size, index = this.splitview.length, skipLayout = false) {\n const disposable = pane.onDidChangeExpansionState(() => {\n this.setupAnimation();\n this._onDidChange.fire(undefined);\n });\n const paneItem = {\n pane,\n disposable: {\n dispose: () => {\n disposable.dispose();\n },\n },\n };\n this.paneItems.splice(index, 0, paneItem);\n pane.orthogonalSize = this.splitview.orthogonalSize;\n this.splitview.addView(pane, size, index, skipLayout);\n }\n getViewSize(index) {\n return this.splitview.getViewSize(index);\n }\n getPanes() {\n return this.splitview.getViews();\n }\n removePane(index, options = { skipDispose: false }) {\n const paneItem = this.paneItems.splice(index, 1)[0];\n this.splitview.removeView(index);\n if (!options.skipDispose) {\n paneItem.disposable.dispose();\n paneItem.pane.dispose();\n }\n return paneItem;\n }\n moveView(from, to) {\n if (from === to) {\n return;\n }\n const view = this.removePane(from, { skipDispose: true });\n this.skipAnimation = true;\n try {\n this.addPane(view.pane, view.pane.size, to, false);\n }\n finally {\n this.skipAnimation = false;\n }\n }\n layout(size, orthogonalSize) {\n this.splitview.layout(size, orthogonalSize);\n }\n setupAnimation() {\n if (this.skipAnimation) {\n return;\n }\n if (this.animationTimer) {\n clearTimeout(this.animationTimer);\n this.animationTimer = undefined;\n }\n addClasses(this.element, 'dv-animated');\n this.animationTimer = setTimeout(() => {\n this.animationTimer = undefined;\n removeClasses(this.element, 'dv-animated');\n }, 200);\n }\n dispose() {\n super.dispose();\n if (this.animationTimer) {\n clearTimeout(this.animationTimer);\n this.animationTimer = undefined;\n }\n this.paneItems.forEach((paneItem) => {\n paneItem.disposable.dispose();\n paneItem.pane.dispose();\n });\n this.paneItems = [];\n this.splitview.dispose();\n this.element.remove();\n }\n}\n\n/*---------------------------------------------------------------------------------------------\n * Accreditation: This file is largly based upon the MIT licenced VSCode sourcecode found at:\n * https://github.com/microsoft/vscode/tree/main/src/vs/base/browser/ui/grid\n *--------------------------------------------------------------------------------------------*/\nclass LeafNode {\n get minimumWidth() {\n return this.view.minimumWidth;\n }\n get maximumWidth() {\n return this.view.maximumWidth;\n }\n get minimumHeight() {\n return this.view.minimumHeight;\n }\n get maximumHeight() {\n return this.view.maximumHeight;\n }\n get priority() {\n return this.view.priority;\n }\n get snap() {\n return this.view.snap;\n }\n get minimumSize() {\n return this.orientation === Orientation.HORIZONTAL\n ? this.minimumHeight\n : this.minimumWidth;\n }\n get maximumSize() {\n return this.orientation === Orientation.HORIZONTAL\n ? this.maximumHeight\n : this.maximumWidth;\n }\n get minimumOrthogonalSize() {\n return this.orientation === Orientation.HORIZONTAL\n ? this.minimumWidth\n : this.minimumHeight;\n }\n get maximumOrthogonalSize() {\n return this.orientation === Orientation.HORIZONTAL\n ? this.maximumWidth\n : this.maximumHeight;\n }\n get orthogonalSize() {\n return this._orthogonalSize;\n }\n get size() {\n return this._size;\n }\n get element() {\n return this.view.element;\n }\n get width() {\n return this.orientation === Orientation.HORIZONTAL\n ? this.orthogonalSize\n : this.size;\n }\n get height() {\n return this.orientation === Orientation.HORIZONTAL\n ? this.size\n : this.orthogonalSize;\n }\n constructor(view, orientation, orthogonalSize, size = 0) {\n this.view = view;\n this.orientation = orientation;\n this._onDidChange = new Emitter();\n this.onDidChange = this._onDidChange.event;\n this._orthogonalSize = orthogonalSize;\n this._size = size;\n this._disposable = this.view.onDidChange((event) => {\n if (event) {\n this._onDidChange.fire({\n size: this.orientation === Orientation.VERTICAL\n ? event.width\n : event.height,\n orthogonalSize: this.orientation === Orientation.VERTICAL\n ? event.height\n : event.width,\n });\n }\n else {\n this._onDidChange.fire({});\n }\n });\n }\n setVisible(visible) {\n if (this.view.setVisible) {\n this.view.setVisible(visible);\n }\n }\n layout(size, orthogonalSize) {\n this._size = size;\n this._orthogonalSize = orthogonalSize;\n this.view.layout(this.width, this.height);\n }\n dispose() {\n this._onDidChange.dispose();\n this._disposable.dispose();\n }\n}\n\n/*---------------------------------------------------------------------------------------------\n * Accreditation: This file is largly based upon the MIT licenced VSCode sourcecode found at:\n * https://github.com/microsoft/vscode/tree/main/src/vs/base/browser/ui/grid\n *--------------------------------------------------------------------------------------------*/\nclass BranchNode extends CompositeDisposable {\n get width() {\n return this.orientation === Orientation.HORIZONTAL\n ? this.size\n : this.orthogonalSize;\n }\n get height() {\n return this.orientation === Orientation.HORIZONTAL\n ? this.orthogonalSize\n : this.size;\n }\n get minimumSize() {\n return this.children.length === 0\n ? 0\n : Math.max(...this.children.map((c, index) => this.splitview.isViewVisible(index)\n ? c.minimumOrthogonalSize\n : 0));\n }\n get maximumSize() {\n return Math.min(...this.children.map((c, index) => this.splitview.isViewVisible(index)\n ? c.maximumOrthogonalSize\n : Number.POSITIVE_INFINITY));\n }\n get minimumOrthogonalSize() {\n return this.splitview.minimumSize;\n }\n get maximumOrthogonalSize() {\n return this.splitview.maximumSize;\n }\n get orthogonalSize() {\n return this._orthogonalSize;\n }\n get size() {\n return this._size;\n }\n get minimumWidth() {\n return this.orientation === Orientation.HORIZONTAL\n ? this.minimumOrthogonalSize\n : this.minimumSize;\n }\n get minimumHeight() {\n return this.orientation === Orientation.HORIZONTAL\n ? this.minimumSize\n : this.minimumOrthogonalSize;\n }\n get maximumWidth() {\n return this.orientation === Orientation.HORIZONTAL\n ? this.maximumOrthogonalSize\n : this.maximumSize;\n }\n get maximumHeight() {\n return this.orientation === Orientation.HORIZONTAL\n ? this.maximumSize\n : this.maximumOrthogonalSize;\n }\n get priority() {\n if (this.children.length === 0) {\n return LayoutPriority.Normal;\n }\n const priorities = this.children.map((c) => typeof c.priority === 'undefined'\n ? LayoutPriority.Normal\n : c.priority);\n if (priorities.some((p) => p === LayoutPriority.High)) {\n return LayoutPriority.High;\n }\n else if (priorities.some((p) => p === LayoutPriority.Low)) {\n return LayoutPriority.Low;\n }\n return LayoutPriority.Normal;\n }\n get disabled() {\n return this.splitview.disabled;\n }\n set disabled(value) {\n this.splitview.disabled = value;\n }\n get margin() {\n return this.splitview.margin;\n }\n set margin(value) {\n this.splitview.margin = value;\n this.children.forEach((child) => {\n if (child instanceof BranchNode) {\n child.margin = value;\n }\n });\n }\n constructor(orientation, proportionalLayout, styles, size, orthogonalSize, disabled, margin, childDescriptors) {\n super();\n this.orientation = orientation;\n this.proportionalLayout = proportionalLayout;\n this.styles = styles;\n this._childrenDisposable = Disposable.NONE;\n this.children = [];\n this._onDidChange = new Emitter();\n this.onDidChange = this._onDidChange.event;\n this._onDidVisibilityChange = new Emitter();\n this.onDidVisibilityChange = this._onDidVisibilityChange.event;\n this._orthogonalSize = orthogonalSize;\n this._size = size;\n this.element = document.createElement('div');\n this.element.className = 'dv-branch-node';\n if (!childDescriptors) {\n this.splitview = new Splitview(this.element, {\n orientation: this.orientation,\n proportionalLayout,\n styles,\n margin,\n });\n this.splitview.layout(this.size, this.orthogonalSize);\n }\n else {\n const descriptor = {\n views: childDescriptors.map((childDescriptor) => {\n return {\n view: childDescriptor.node,\n size: childDescriptor.node.size,\n visible: childDescriptor.node instanceof LeafNode &&\n childDescriptor.visible !== undefined\n ? childDescriptor.visible\n : true,\n };\n }),\n size: this.orthogonalSize,\n };\n this.children = childDescriptors.map((c) => c.node);\n this.splitview = new Splitview(this.element, {\n orientation: this.orientation,\n descriptor,\n proportionalLayout,\n styles,\n margin,\n });\n }\n this.disabled = disabled;\n this.addDisposables(this._onDidChange, this._onDidVisibilityChange, this.splitview.onDidSashEnd(() => {\n this._onDidChange.fire({});\n }));\n this.setupChildrenEvents();\n }\n setVisible(_visible) {\n // noop\n }\n isChildVisible(index) {\n if (index < 0 || index >= this.children.length) {\n throw new Error('Invalid index');\n }\n return this.splitview.isViewVisible(index);\n }\n setChildVisible(index, visible) {\n if (index < 0 || index >= this.children.length) {\n throw new Error('Invalid index');\n }\n if (this.splitview.isViewVisible(index) === visible) {\n return;\n }\n const wereAllChildrenHidden = this.splitview.contentSize === 0;\n this.splitview.setViewVisible(index, visible);\n // }\n const areAllChildrenHidden = this.splitview.contentSize === 0;\n // If all children are hidden then the parent should hide the entire splitview\n // If the entire splitview is hidden then the parent should show the splitview when a child is shown\n if ((visible && wereAllChildrenHidden) ||\n (!visible && areAllChildrenHidden)) {\n this._onDidVisibilityChange.fire({ visible });\n }\n }\n moveChild(from, to) {\n if (from === to) {\n return;\n }\n if (from < 0 || from >= this.children.length) {\n throw new Error('Invalid from index');\n }\n if (from < to) {\n to--;\n }\n this.splitview.moveView(from, to);\n const child = this._removeChild(from);\n this._addChild(child, to);\n }\n getChildSize(index) {\n if (index < 0 || index >= this.children.length) {\n throw new Error('Invalid index');\n }\n return this.splitview.getViewSize(index);\n }\n resizeChild(index, size) {\n if (index < 0 || index >= this.children.length) {\n throw new Error('Invalid index');\n }\n this.splitview.resizeView(index, size);\n }\n layout(size, orthogonalSize) {\n this._size = orthogonalSize;\n this._orthogonalSize = size;\n this.splitview.layout(orthogonalSize, size);\n }\n addChild(node, size, index, skipLayout) {\n if (index < 0 || index > this.children.length) {\n throw new Error('Invalid index');\n }\n this.splitview.addView(node, size, index, skipLayout);\n this._addChild(node, index);\n }\n getChildCachedVisibleSize(index) {\n if (index < 0 || index >= this.children.length) {\n throw new Error('Invalid index');\n }\n return this.splitview.getViewCachedVisibleSize(index);\n }\n removeChild(index, sizing) {\n if (index < 0 || index >= this.children.length) {\n throw new Error('Invalid index');\n }\n this.splitview.removeView(index, sizing);\n return this._removeChild(index);\n }\n _addChild(node, index) {\n this.children.splice(index, 0, node);\n this.setupChildrenEvents();\n }\n _removeChild(index) {\n const [child] = this.children.splice(index, 1);\n this.setupChildrenEvents();\n return child;\n }\n setupChildrenEvents() {\n this._childrenDisposable.dispose();\n this._childrenDisposable = new CompositeDisposable(Event.any(...this.children.map((c) => c.onDidChange))((e) => {\n /**\n * indicate a change has occured to allows any re-rendering but don't bubble\n * event because that was specific to this branch\n */\n this._onDidChange.fire({ size: e.orthogonalSize });\n }), ...this.children.map((c, i) => {\n if (c instanceof BranchNode) {\n return c.onDidVisibilityChange(({ visible }) => {\n this.setChildVisible(i, visible);\n });\n }\n return Disposable.NONE;\n }));\n }\n dispose() {\n this._childrenDisposable.dispose();\n this.splitview.dispose();\n this.children.forEach((child) => child.dispose());\n super.dispose();\n }\n}\n\n/*---------------------------------------------------------------------------------------------\n * Accreditation: This file is largly based upon the MIT licenced VSCode sourcecode found at:\n * https://github.com/microsoft/vscode/tree/main/src/vs/base/browser/ui/grid\n *--------------------------------------------------------------------------------------------*/\nfunction findLeaf(candiateNode, last) {\n if (candiateNode instanceof LeafNode) {\n return candiateNode;\n }\n if (candiateNode instanceof BranchNode) {\n return findLeaf(candiateNode.children[last ? candiateNode.children.length - 1 : 0], last);\n }\n throw new Error('invalid node');\n}\nfunction cloneNode(node, size, orthogonalSize) {\n if (node instanceof BranchNode) {\n const result = new BranchNode(node.orientation, node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled, node.margin);\n for (let i = node.children.length - 1; i >= 0; i--) {\n const child = node.children[i];\n result.addChild(cloneNode(child, child.size, child.orthogonalSize), child.size, 0, true);\n }\n return result;\n }\n else {\n return new LeafNode(node.view, node.orientation, orthogonalSize);\n }\n}\nfunction flipNode(node, size, orthogonalSize) {\n if (node instanceof BranchNode) {\n const result = new BranchNode(orthogonal(node.orientation), node.proportionalLayout, node.styles, size, orthogonalSize, node.disabled, node.margin);\n let totalSize = 0;\n for (let i = node.children.length - 1; i >= 0; i--) {\n const child = node.children[i];\n const childSize = child instanceof BranchNode ? child.orthogonalSize : child.size;\n let newSize = node.size === 0\n ? 0\n : Math.round((size * childSize) / node.size);\n totalSize += newSize;\n // The last view to add should adjust to rounding errors\n if (i === 0) {\n newSize += size - totalSize;\n }\n result.addChild(flipNode(child, orthogonalSize, newSize), newSize, 0, true);\n }\n return result;\n }\n else {\n return new LeafNode(node.view, orthogonal(node.orientation), orthogonalSize);\n }\n}\nfunction indexInParent(element) {\n const parentElement = element.parentElement;\n if (!parentElement) {\n throw new Error('Invalid grid element');\n }\n let el = parentElement.firstElementChild;\n let index = 0;\n while (el !== element && el !== parentElement.lastElementChild && el) {\n el = el.nextElementSibling;\n index++;\n }\n return index;\n}\n/**\n * Find the grid location of a specific DOM element by traversing the parent\n * chain and finding each child index on the way.\n *\n * This will break as soon as DOM structures of the Splitview or Gridview change.\n */\nfunction getGridLocation(element) {\n const parentElement = element.parentElement;\n if (!parentElement) {\n throw new Error('Invalid grid element');\n }\n if (/\\bdv-grid-view\\b/.test(parentElement.className)) {\n return [];\n }\n const index = indexInParent(parentElement);\n const ancestor = parentElement.parentElement.parentElement.parentElement;\n return [...getGridLocation(ancestor), index];\n}\nfunction getRelativeLocation(rootOrientation, location, direction) {\n const orientation = getLocationOrientation(rootOrientation, location);\n const directionOrientation = getDirectionOrientation(direction);\n if (orientation === directionOrientation) {\n const [rest, _index] = tail(location);\n let index = _index;\n if (direction === 'right' || direction === 'bottom') {\n index += 1;\n }\n return [...rest, index];\n }\n else {\n const index = direction === 'right' || direction === 'bottom' ? 1 : 0;\n return [...location, index];\n }\n}\nfunction getDirectionOrientation(direction) {\n return direction === 'top' || direction === 'bottom'\n ? Orientation.VERTICAL\n : Orientation.HORIZONTAL;\n}\nfunction getLocationOrientation(rootOrientation, location) {\n return location.length % 2 === 0\n ? orthogonal(rootOrientation)\n : rootOrientation;\n}\nconst orthogonal = (orientation) => orientation === Orientation.HORIZONTAL\n ? Orientation.VERTICAL\n : Orientation.HORIZONTAL;\nfunction isGridBranchNode(node) {\n return !!node.children;\n}\nconst serializeBranchNode = (node, orientation) => {\n const size = orientation === Orientation.VERTICAL ? node.box.width : node.box.height;\n if (!isGridBranchNode(node)) {\n if (typeof node.cachedVisibleSize === 'number') {\n return {\n type: 'leaf',\n data: node.view.toJSON(),\n size: node.cachedVisibleSize,\n visible: false,\n };\n }\n return { type: 'leaf', data: node.view.toJSON(), size };\n }\n return {\n type: 'branch',\n data: node.children.map((c) => serializeBranchNode(c, orthogonal(orientation))),\n size,\n };\n};\nclass Gridview {\n get length() {\n return this._root ? this._root.children.length : 0;\n }\n get orientation() {\n return this.root.orientation;\n }\n set orientation(orientation) {\n if (this.root.orientation === orientation) {\n return;\n }\n const { size, orthogonalSize } = this.root;\n this.root = flipNode(this.root, orthogonalSize, size);\n this.root.layout(size, orthogonalSize);\n }\n get width() {\n return this.root.width;\n }\n get height() {\n return this.root.height;\n }\n get minimumWidth() {\n return this.root.minimumWidth;\n }\n get minimumHeight() {\n return this.root.minimumHeight;\n }\n get maximumWidth() {\n return this.root.maximumHeight;\n }\n get maximumHeight() {\n return this.root.maximumHeight;\n }\n get locked() {\n return this._locked;\n }\n set locked(value) {\n this._locked = value;\n const branch = [this.root];\n /**\n * simple depth-first-search to cover all nodes\n *\n * @see https://en.wikipedia.org/wiki/Depth-first_search\n */\n while (branch.length > 0) {\n const node = branch.pop();\n if (node instanceof BranchNode) {\n node.disabled = value;\n branch.push(...node.children);\n }\n }\n }\n get margin() {\n return this._margin;\n }\n set margin(value) {\n this._margin = value;\n this.root.margin = value;\n }\n maximizedView() {\n var _a;\n return (_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf.view;\n }\n hasMaximizedView() {\n return this._maximizedNode !== undefined;\n }\n maximizeView(view) {\n var _a;\n const location = getGridLocation(view.element);\n const [_, node] = this.getNode(location);\n if (!(node instanceof LeafNode)) {\n return;\n }\n if (((_a = this._maximizedNode) === null || _a === void 0 ? void 0 : _a.leaf) === node) {\n return;\n }\n if (this.hasMaximizedView()) {\n this.exitMaximizedView();\n }\n serializeBranchNode(this.getView(), this.orientation);\n const hiddenOnMaximize = [];\n function hideAllViewsBut(parent, exclude) {\n for (let i = 0; i < parent.children.length; i++) {\n const child = parent.children[i];\n if (child instanceof LeafNode) {\n if (child !== exclude) {\n if (parent.isChildVisible(i)) {\n parent.setChildVisible(i, false);\n }\n else {\n hiddenOnMaximize.push(child);\n }\n }\n }\n else {\n hideAllViewsBut(child, exclude);\n }\n }\n }\n hideAllViewsBut(this.root, node);\n this._maximizedNode = { leaf: node, hiddenOnMaximize };\n this._onDidMaximizedNodeChange.fire({\n view: node.view,\n isMaximized: true,\n });\n }\n exitMaximizedView() {\n if (!this._maximizedNode) {\n return;\n }\n const hiddenOnMaximize = this._maximizedNode.hiddenOnMaximize;\n function showViewsInReverseOrder(parent) {\n for (let index = parent.children.length - 1; index >= 0; index--) {\n const child = parent.children[index];\n if (child instanceof LeafNode) {\n if (!hiddenOnMaximize.includes(child)) {\n parent.setChildVisible(index, true);\n }\n }\n else {\n showViewsInReverseOrder(child);\n }\n }\n }\n showViewsInReverseOrder(this.root);\n const tmp = this._maximizedNode.leaf;\n this._maximizedNode = undefined;\n this._onDidMaximizedNodeChange.fire({\n view: tmp.view,\n isMaximized: false,\n });\n }\n serialize() {\n const maximizedView = this.maximizedView();\n let maxmizedViewLocation;\n if (maximizedView) {\n /**\n * The minimum information we can get away with in order to serialize a maxmized view is it's location within the grid\n * which is represented as a branch of indices\n */\n maxmizedViewLocation = getGridLocation(maximizedView.element);\n }\n /**\n * We pause the onDidMaximizedNodeChange events because this method needs to\n * call `this.exitMaximizedView()`. We don't want this to invoke any listeners\n * since we undo it before leaving this method\n */\n const pauseToken = this._onDidMaximizedNodeChange.pause();\n try {\n if (this.hasMaximizedView()) {\n /**\n * the saved layout cannot be in its maxmized state otherwise all of the underlying\n * view dimensions will be wrong\n *\n * To counteract this we temporaily remove the maximized view to compute the serialized output\n * of the grid before adding back the maxmized view as to not alter the layout from the users\n * perspective when `.toJSON()` is called\n */\n this.exitMaximizedView();\n }\n const root = serializeBranchNode(this.getView(), this.orientation);\n const result = {\n root,\n width: this.width,\n height: this.height,\n orientation: this.orientation,\n };\n if (maxmizedViewLocation) {\n result.maximizedNode = {\n location: maxmizedViewLocation,\n };\n }\n if (maximizedView) {\n // replace any maximzied view that was removed for serialization purposes\n this.maximizeView(maximizedView);\n }\n return result;\n }\n finally {\n pauseToken.dispose();\n }\n }\n dispose() {\n this.disposable.dispose();\n this._onDidChange.dispose();\n this._onDidMaximizedNodeChange.dispose();\n this._onDidViewVisibilityChange.dispose();\n this.root.dispose();\n this._maximizedNode = undefined;\n this.element.remove();\n }\n clear() {\n const orientation = this.root.orientation;\n this.root = new BranchNode(orientation, this.proportionalLayout, this.styles, this.root.size, this.root.orthogonalSize, this.locked, this.margin);\n }\n deserialize(json, deserializer) {\n const orientation = json.orientation;\n const height = orientation === Orientation.VERTICAL ? json.height : json.width;\n this._deserialize(json.root, orientation, deserializer, height);\n /**\n * The deserialied layout must be positioned through this.layout(...)\n * before any maximizedNode can be positioned\n */\n this.layout(json.width, json.height);\n if (json.maximizedNode) {\n const location = json.maximizedNode.location;\n const [_, node] = this.getNode(location);\n if (!(node instanceof LeafNode)) {\n return;\n }\n this.maximizeView(node.view);\n }\n }\n _deserialize(root, orientation, deserializer, orthogonalSize) {\n this.root = this._deserializeNode(root, orientation, deserializer, orthogonalSize);\n }\n _deserializeNode(node, orientation, deserializer, orthogonalSize) {\n var _a;\n let result;\n if (node.type === 'branch') {\n const serializedChildren = node.data;\n const children = serializedChildren.map((serializedChild) => {\n return {\n node: this._deserializeNode(serializedChild, orthogonal(orientation), deserializer, node.size),\n visible: serializedChild.visible,\n };\n });\n result = new BranchNode(orientation, this.proportionalLayout, this.styles, node.size, // <- orthogonal size - flips at each depth\n orthogonalSize, // <- size - flips at each depth,\n this.locked, this.margin, children);\n }\n else {\n const view = deserializer.fromJSON(node);\n if (typeof node.visible === 'boolean') {\n (_a = view.setVisible) === null || _a === void 0 ? void 0 : _a.call(view, node.visible);\n }\n result = new LeafNode(view, orientation, orthogonalSize, node.size);\n }\n return result;\n }\n get root() {\n return this._root;\n }\n set root(root) {\n const oldRoot = this._root;\n if (oldRoot) {\n oldRoot.dispose();\n this._maximizedNode = undefined;\n this.element.removeChild(oldRoot.element);\n }\n this._root = root;\n this.element.appendChild(this._root.element);\n this.disposable.value = this._root.onDidChange((e) => {\n this._onDidChange.fire(e);\n });\n }\n normalize() {\n if (!this._root) {\n return;\n }\n if (this._root.children.length !== 1) {\n return;\n }\n const oldRoot = this.root;\n // can remove one level of redundant branching if there is only a single child\n const childReference = oldRoot.children[0];\n if (childReference instanceof LeafNode) {\n return;\n }\n oldRoot.element.remove();\n const child = oldRoot.removeChild(0); // Remove child to prevent double disposal\n oldRoot.dispose(); // Dispose old root (won't dispose removed child)\n child.dispose(); // Dispose the removed child\n this._root = cloneNode(childReference, childReference.size, childReference.orthogonalSize);\n this.element.appendChild(this._root.element);\n this.disposable.value = this._root.onDidChange((e) => {\n this._onDidChange.fire(e);\n });\n }\n /**\n * If the root is orientated as a VERTICAL node then nest the existing root within a new HORIZIONTAL root node\n * If the root is orientated as a HORIZONTAL node then nest the existing root within a new VERITCAL root node\n */\n insertOrthogonalSplitviewAtRoot() {\n if (!this._root) {\n return;\n }\n const oldRoot = this.root;\n oldRoot.element.remove();\n this._root = new BranchNode(orthogonal(oldRoot.orientation), this.proportionalLayout, this.styles, this.root.orthogonalSize, this.root.size, this.locked, this.margin);\n if (oldRoot.children.length === 0) ;\n else if (oldRoot.children.length === 1) {\n // can remove one level of redundant branching if there is only a single child\n const childReference = oldRoot.children[0];\n const child = oldRoot.removeChild(0); // remove to prevent disposal when disposing of unwanted root\n child.dispose();\n oldRoot.dispose();\n this._root.addChild(\n /**\n * the child node will have the same orientation as the new root since\n * we are removing the inbetween node.\n * the entire 'tree' must be flipped recursively to ensure that the orientation\n * flips at each level\n */\n flipNode(childReference, childReference.orthogonalSize, childReference.size), Sizing.Distribute, 0);\n }\n else {\n this._root.addChild(oldRoot, Sizing.Distribute, 0);\n }\n this.element.appendChild(this._root.element);\n this.disposable.value = this._root.onDidChange((e) => {\n this._onDidChange.fire(e);\n });\n }\n next(location) {\n return this.progmaticSelect(location);\n }\n previous(location) {\n return this.progmaticSelect(location, true);\n }\n getView(location) {\n const node = location ? this.getNode(location)[1] : this.root;\n return this._getViews(node, this.orientation);\n }\n _getViews(node, orientation, cachedVisibleSize) {\n const box = { height: node.height, width: node.width };\n if (node instanceof LeafNode) {\n return { box, view: node.view, cachedVisibleSize };\n }\n const children = [];\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n const nodeCachedVisibleSize = node.getChildCachedVisibleSize(i);\n children.push(this._getViews(child, orthogonal(orientation), nodeCachedVisibleSize));\n }\n return { box, children };\n }\n progmaticSelect(location, reverse = false) {\n const [path, node] = this.getNode(location);\n if (!(node instanceof LeafNode)) {\n throw new Error('invalid location');\n }\n for (let i = path.length - 1; i > -1; i--) {\n const n = path[i];\n const l = location[i] || 0;\n const canProgressInCurrentLevel = reverse\n ? l - 1 > -1\n : l + 1 < n.children.length;\n if (canProgressInCurrentLevel) {\n return findLeaf(n.children[reverse ? l - 1 : l + 1], reverse);\n }\n }\n return findLeaf(this.root, reverse);\n }\n constructor(proportionalLayout, styles, orientation, locked, margin) {\n this.proportionalLayout = proportionalLayout;\n this.styles = styles;\n this._locked = false;\n this._margin = 0;\n this._maximizedNode = undefined;\n this.disposable = new MutableDisposable();\n this._onDidChange = new Emitter();\n this.onDidChange = this._onDidChange.event;\n this._onDidViewVisibilityChange = new Emitter();\n this.onDidViewVisibilityChange = this._onDidViewVisibilityChange.event;\n this._onDidMaximizedNodeChange = new Emitter();\n this.onDidMaximizedNodeChange = this._onDidMaximizedNodeChange.event;\n this.element = document.createElement('div');\n this.element.className = 'dv-grid-view';\n this._locked = locked !== null && locked !== void 0 ? locked : false;\n this._margin = margin !== null && margin !== void 0 ? margin : 0;\n this.root = new BranchNode(orientation, proportionalLayout, styles, 0, 0, this.locked, this.margin);\n }\n isViewVisible(location) {\n const [rest, index] = tail(location);\n const [, parent] = this.getNode(rest);\n if (!(parent instanceof BranchNode)) {\n throw new Error('Invalid from location');\n }\n return parent.isChildVisible(index);\n }\n setViewVisible(location, visible) {\n if (this.hasMaximizedView()) {\n this.exitMaximizedView();\n }\n const [rest, index] = tail(location);\n const [, parent] = this.getNode(rest);\n if (!(parent instanceof BranchNode)) {\n throw new Error('Invalid from location');\n }\n this._onDidViewVisibilityChange.fire();\n parent.setChildVisible(index, visible);\n }\n moveView(parentLocation, from, to) {\n if (this.hasMaximizedView()) {\n this.exitMaximizedView();\n }\n const [, parent] = this.getNode(parentLocation);\n if (!(parent instanceof BranchNode)) {\n throw new Error('Invalid location');\n }\n parent.moveChild(from, to);\n }\n addView(view, size, location) {\n if (this.hasMaximizedView()) {\n this.exitMaximizedView();\n }\n const [rest, index] = tail(location);\n const [pathToParent, parent] = this.getNode(rest);\n if (parent instanceof BranchNode) {\n const node = new LeafNode(view, orthogonal(parent.orientation), parent.orthogonalSize);\n parent.addChild(node, size, index);\n }\n else {\n const [grandParent, ..._] = [...pathToParent].reverse();\n const [parentIndex, ...__] = [...rest].reverse();\n let newSiblingSize = 0;\n const newSiblingCachedVisibleSize = grandParent.getChildCachedVisibleSize(parentIndex);\n if (typeof newSiblingCachedVisibleSize === 'number') {\n newSiblingSize = Sizing.Invisible(newSiblingCachedVisibleSize);\n }\n const child = grandParent.removeChild(parentIndex);\n child.dispose();\n const newParent = new BranchNode(parent.orientation, this.proportionalLayout, this.styles, parent.size, parent.orthogonalSize, this.locked, this.margin);\n grandParent.addChild(newParent, parent.size, parentIndex);\n const newSibling = new LeafNode(parent.view, grandParent.orientation, parent.size);\n newParent.addChild(newSibling, newSiblingSize, 0);\n if (typeof size !== 'number' && size.type === 'split') {\n size = { type: 'split', index: 0 };\n }\n const node = new LeafNode(view, grandParent.orientation, parent.size);\n newParent.addChild(node, size, index);\n }\n }\n remove(view, sizing) {\n const location = getGridLocation(view.element);\n return this.removeView(location, sizing);\n }\n removeView(location, sizing) {\n if (this.hasMaximizedView()) {\n this.exitMaximizedView();\n }\n const [rest, index] = tail(location);\n const [pathToParent, parent] = this.getNode(rest);\n if (!(parent instanceof BranchNode)) {\n throw new Error('Invalid location');\n }\n const nodeToRemove = parent.children[index];\n if (!(nodeToRemove instanceof LeafNode)) {\n throw new Error('Invalid location');\n }\n parent.removeChild(index, sizing);\n nodeToRemove.dispose();\n if (parent.children.length !== 1) {\n return nodeToRemove.view;\n }\n // if the parent has only one child and we know the parent is a BranchNode we can make the tree\n // more efficiently spaced by replacing the parent BranchNode with the child.\n // if that child is a LeafNode then we simply replace the BranchNode with the child otherwise if the child\n // is a BranchNode too we should spread it's children into the grandparent.\n // refer to the remaining child as the sibling\n const sibling = parent.children[0];\n if (pathToParent.length === 0) {\n // if the parent is root\n if (sibling instanceof LeafNode) {\n // if the sibling is a leaf node no action is required\n return nodeToRemove.view;\n }\n // otherwise the sibling is a branch node. since the parent is the root and the root has only one child\n // which is a branch node we can just set this branch node to be the new root node\n // for good housekeeping we'll removing the sibling from it's existing tree\n parent.removeChild(0, sizing);\n // and set that sibling node to be root\n this.root = sibling;\n return nodeToRemove.view;\n }\n // otherwise the parent is apart of a large sub-tree\n const [grandParent, ..._] = [...pathToParent].reverse();\n const [parentIndex, ...__] = [...rest].reverse();\n const isSiblingVisible = parent.isChildVisible(0);\n // either way we need to remove the sibling from it's existing tree\n parent.removeChild(0, sizing);\n // note the sizes of all of the grandparents children\n const sizes = grandParent.children.map((_size, i) => grandParent.getChildSize(i));\n // remove the parent from the grandparent since we are moving the sibling to take the parents place\n // this parent is no longer used and can be disposed of\n grandParent.removeChild(parentIndex, sizing).dispose();\n if (sibling instanceof BranchNode) {\n // replace the parent with the siblings children\n sizes.splice(parentIndex, 1, ...sibling.children.map((c) => c.size));\n // and add those siblings to the grandparent\n for (let i = 0; i < sibling.children.length; i++) {\n const child = sibling.children[i];\n grandParent.addChild(child, child.size, parentIndex + i);\n }\n /**\n * clean down the branch node since we need to dipose of it and\n * when .dispose() it called on a branch it will dispose of any\n * views it is holding onto.\n */\n while (sibling.children.length > 0) {\n sibling.removeChild(0);\n }\n }\n else {\n // otherwise create a new leaf node and add that to the grandparent\n const newSibling = new LeafNode(sibling.view, orthogonal(sibling.orientation), sibling.size);\n const siblingSizing = isSiblingVisible\n ? sibling.orthogonalSize\n : Sizing.Invisible(sibling.orthogonalSize);\n grandParent.addChild(newSibling, siblingSizing, parentIndex);\n }\n // the containing node of the sibling is no longer required and can be disposed of\n sibling.dispose();\n // resize everything\n for (let i = 0; i < sizes.length; i++) {\n grandParent.resizeChild(i, sizes[i]);\n }\n return nodeToRemove.view;\n }\n layout(width, height) {\n const [size, orthogonalSize] = this.root.orientation === Orientation.HORIZONTAL\n ? [height, width]\n : [width, height];\n this.root.layout(size, orthogonalSize);\n }\n getNode(location, node = this.root, path = []) {\n if (location.length === 0) {\n return [path, node];\n }\n if (!(node instanceof BranchNode)) {\n throw new Error('Invalid location');\n }\n const [index, ...rest] = location;\n if (index < 0 || index >= node.children.length) {\n throw new Error('Invalid location');\n }\n const child = node.children[index];\n path.push(node);\n return this.getNode(rest, child, path);\n }\n}\n\nconst PROPERTY_KEYS_GRIDVIEW = (() => {\n /**\n * by readong the keys from an empty value object TypeScript will error\n * when we add or remove new properties to `DockviewOptions`\n */\n const properties = {\n disableAutoResizing: undefined,\n proportionalLayout: undefined,\n orientation: undefined,\n hideBorders: undefined,\n className: undefined,\n };\n return Object.keys(properties);\n})();\n\nclass Resizable extends CompositeDisposable {\n get element() {\n return this._element;\n }\n get disableResizing() {\n return this._disableResizing;\n }\n set disableResizing(value) {\n this._disableResizing = value;\n }\n constructor(parentElement, disableResizing = false) {\n super();\n this._lastWidth = -1;\n this._lastHeight = -1;\n this._disableResizing = disableResizing;\n this._element = parentElement;\n this.addDisposables(watchElementResize(this._element, (entry) => {\n if (this.isDisposed) {\n /**\n * resize is delayed through requestAnimationFrame so there is a small chance\n * the component has already been disposed of\n */\n return;\n }\n if (this.disableResizing) {\n return;\n }\n if (!this._element.offsetParent) {\n /**\n * offsetParent === null is equivalent to display: none being set on the element or one\n * of it's parents. In the display: none case the size will become (0, 0) which we do\n * not want to propagate.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent\n *\n * You could use checkVisibility() but at the time of writing it's not supported across\n * all Browsers\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/checkVisibility\n */\n return;\n }\n if (!isInDocument(this._element)) {\n /**\n * since the event is dispatched through requestAnimationFrame there is a small chance\n * the component is no longer attached to the DOM, if that is the case the dimensions\n * are mostly likely all zero and meaningless. we should skip this case.\n */\n return;\n }\n // Round to integers to absorb sub-pixel jitter from\n // fractional devicePixelRatio (e.g. multi-monitor setups),\n // which would otherwise re-fire layout in a feedback loop.\n const width = Math.round(entry.contentRect.width);\n const height = Math.round(entry.contentRect.height);\n if (width === this._lastWidth && height === this._lastHeight) {\n return;\n }\n this._lastWidth = width;\n this._lastHeight = height;\n this.layout(width, height);\n }));\n }\n}\n\nconst nextLayoutId$1 = sequentialNumberGenerator();\nfunction toTarget(direction) {\n switch (direction) {\n case 'left':\n return 'left';\n case 'right':\n return 'right';\n case 'above':\n return 'top';\n case 'below':\n return 'bottom';\n case 'within':\n default:\n return 'center';\n }\n}\nclass BaseGrid extends Resizable {\n get id() {\n return this._id;\n }\n get size() {\n return this._groups.size;\n }\n get groups() {\n return Array.from(this._groups.values()).map((_) => _.value);\n }\n get width() {\n return this.gridview.width;\n }\n get height() {\n return this.gridview.height;\n }\n get minimumHeight() {\n return this.gridview.minimumHeight;\n }\n get maximumHeight() {\n return this.gridview.maximumHeight;\n }\n get minimumWidth() {\n return this.gridview.minimumWidth;\n }\n get maximumWidth() {\n return this.gridview.maximumWidth;\n }\n get activeGroup() {\n return this._activeGroup;\n }\n get locked() {\n return this.gridview.locked;\n }\n set locked(value) {\n this.gridview.locked = value;\n }\n constructor(container, options) {\n var _a;\n super(document.createElement('div'), options.disableAutoResizing);\n this._id = nextLayoutId$1.next();\n this._groups = new Map();\n this._onDidRemove = new Emitter();\n this.onDidRemove = this._onDidRemove.event;\n this._onDidAdd = new Emitter();\n this.onDidAdd = this._onDidAdd.event;\n this._onDidMaximizedChange = new Emitter();\n this.onDidMaximizedChange = this._onDidMaximizedChange.event;\n this._onDidActiveChange = new Emitter();\n this.onDidActiveChange = this._onDidActiveChange.event;\n this._bufferOnDidLayoutChange = new AsapEvent();\n this.onDidLayoutChange = this._bufferOnDidLayoutChange.onEvent;\n this._onDidViewVisibilityChangeMicroTaskQueue = new AsapEvent();\n this.onDidViewVisibilityChangeMicroTaskQueue = this._onDidViewVisibilityChangeMicroTaskQueue.onEvent;\n this.element.style.height = '100%';\n this.element.style.width = '100%';\n this._classNames = new Classnames(this.element);\n this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');\n // the container is owned by the third-party, do not modify/delete it\n container.appendChild(this.element);\n this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation, options.locked, options.margin);\n this.gridview.locked = !!options.locked;\n this.element.appendChild(this.gridview.element);\n this.layout(0, 0, true); // set some elements height/widths\n this.addDisposables(this.gridview.onDidMaximizedNodeChange((event) => {\n this._onDidMaximizedChange.fire({\n panel: event.view,\n isMaximized: event.isMaximized,\n });\n }), this.gridview.onDidViewVisibilityChange(() => this._onDidViewVisibilityChangeMicroTaskQueue.fire()), this.onDidViewVisibilityChangeMicroTaskQueue(() => {\n this.forceRelayout();\n }), Disposable.from(() => {\n var _a;\n (_a = this.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.element);\n }), this.gridview.onDidChange(() => {\n this._bufferOnDidLayoutChange.fire();\n }), Event.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {\n this._bufferOnDidLayoutChange.fire();\n }), this._onDidMaximizedChange, this._onDidViewVisibilityChangeMicroTaskQueue, this._bufferOnDidLayoutChange);\n }\n setVisible(panel, visible) {\n this.gridview.setViewVisible(getGridLocation(panel.element), visible);\n this._bufferOnDidLayoutChange.fire();\n }\n isVisible(panel) {\n return this.gridview.isViewVisible(getGridLocation(panel.element));\n }\n updateOptions(options) {\n var _a, _b, _c, _d;\n if (typeof options.proportionalLayout === 'boolean') ;\n if (options.orientation) {\n this.gridview.orientation = options.orientation;\n }\n if ('disableResizing' in options) {\n this.disableResizing = (_a = options.disableAutoResizing) !== null && _a !== void 0 ? _a : false;\n }\n if ('locked' in options) {\n this.locked = (_b = options.locked) !== null && _b !== void 0 ? _b : false;\n }\n if ('margin' in options) {\n this.gridview.margin = (_c = options.margin) !== null && _c !== void 0 ? _c : 0;\n }\n if ('className' in options) {\n this._classNames.setClassNames((_d = options.className) !== null && _d !== void 0 ? _d : '');\n }\n }\n maximizeGroup(panel) {\n this.gridview.maximizeView(panel);\n this.doSetGroupActive(panel);\n }\n isMaximizedGroup(panel) {\n return this.gridview.maximizedView() === panel;\n }\n exitMaximizedGroup() {\n this.gridview.exitMaximizedView();\n }\n hasMaximizedGroup() {\n return this.gridview.hasMaximizedView();\n }\n doAddGroup(group, location = [0], size, gridview = this.gridview) {\n gridview.addView(group, size !== null && size !== void 0 ? size : Sizing.Distribute, location);\n this._onDidAdd.fire(group);\n }\n doRemoveGroup(group, options) {\n if (!this._groups.has(group.id)) {\n throw new Error('invalid operation');\n }\n const item = this._groups.get(group.id);\n const view = this.gridview.remove(group, Sizing.Distribute);\n if (item && !(options === null || options === void 0 ? void 0 : options.skipDispose)) {\n item.disposable.dispose();\n item.value.dispose();\n this._groups.delete(group.id);\n this._onDidRemove.fire(group);\n }\n if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {\n const groups = Array.from(this._groups.values());\n this.doSetGroupActive(groups.length > 0 ? groups[0].value : undefined);\n }\n return view;\n }\n getPanel(id) {\n var _a;\n return (_a = this._groups.get(id)) === null || _a === void 0 ? void 0 : _a.value;\n }\n doSetGroupActive(group) {\n if (this._activeGroup === group) {\n return;\n }\n if (this._activeGroup) {\n this._activeGroup.setActive(false);\n }\n if (group) {\n group.setActive(true);\n }\n this._activeGroup = group;\n this._onDidActiveChange.fire(group);\n }\n removeGroup(group) {\n this.doRemoveGroup(group);\n }\n moveToNext(options) {\n var _a;\n if (!options) {\n options = {};\n }\n if (!options.group) {\n if (!this.activeGroup) {\n return;\n }\n options.group = this.activeGroup;\n }\n const location = getGridLocation(options.group.element);\n const next = (_a = this.gridview.next(location)) === null || _a === void 0 ? void 0 : _a.view;\n this.doSetGroupActive(next);\n }\n moveToPrevious(options) {\n var _a;\n if (!options) {\n options = {};\n }\n if (!options.group) {\n if (!this.activeGroup) {\n return;\n }\n options.group = this.activeGroup;\n }\n const location = getGridLocation(options.group.element);\n const next = (_a = this.gridview.previous(location)) === null || _a === void 0 ? void 0 : _a.view;\n this.doSetGroupActive(next);\n }\n forceRelayout() {\n this.layout(this.width, this.height, true);\n }\n layout(width, height, forceResize) {\n const different = forceResize || width !== this.width || height !== this.height;\n if (!different) {\n return;\n }\n this.gridview.element.style.height = `${height}px`;\n this.gridview.element.style.width = `${width}px`;\n this.gridview.layout(width, height);\n }\n dispose() {\n this._onDidActiveChange.dispose();\n this._onDidAdd.dispose();\n this._onDidRemove.dispose();\n for (const group of this.groups) {\n group.dispose();\n }\n this.gridview.dispose();\n super.dispose();\n }\n}\n\nclass SplitviewApi {\n /**\n * The minimum size the component can reach where size is measured in the direction of orientation provided.\n */\n get minimumSize() {\n return this.component.minimumSize;\n }\n /**\n * The maximum size the component can reach where size is measured in the direction of orientation provided.\n */\n get maximumSize() {\n return this.component.maximumSize;\n }\n /**\n * Width of the component.\n */\n get width() {\n return this.component.width;\n }\n /**\n * Height of the component.\n */\n get height() {\n return this.component.height;\n }\n /**\n * The current number of panels.\n */\n get length() {\n return this.component.length;\n }\n /**\n * The current orientation of the component.\n */\n get orientation() {\n return this.component.orientation;\n }\n /**\n * The list of current panels.\n */\n get panels() {\n return this.component.panels;\n }\n /**\n * Invoked after a layout is loaded through the `fromJSON` method.\n */\n get onDidLayoutFromJSON() {\n return this.component.onDidLayoutFromJSON;\n }\n /**\n * Invoked whenever any aspect of the layout changes.\n * If listening to this event it may be worth debouncing ouputs.\n */\n get onDidLayoutChange() {\n return this.component.onDidLayoutChange;\n }\n /**\n * Invoked when a view is added.\n */\n get onDidAddView() {\n return this.component.onDidAddView;\n }\n /**\n * Invoked when a view is removed.\n */\n get onDidRemoveView() {\n return this.component.onDidRemoveView;\n }\n constructor(component) {\n this.component = component;\n }\n /**\n * Removes an existing panel and optionally provide a `Sizing` method\n * for the subsequent resize.\n */\n removePanel(panel, sizing) {\n this.component.removePanel(panel, sizing);\n }\n /**\n * Focus the component.\n */\n focus() {\n this.component.focus();\n }\n /**\n * Get the reference to a panel given it's `string` id.\n */\n getPanel(id) {\n return this.component.getPanel(id);\n }\n /**\n * Layout the panel with a width and height.\n */\n layout(width, height) {\n return this.component.layout(width, height);\n }\n /**\n * Add a new panel and return the created instance.\n */\n addPanel(options) {\n return this.component.addPanel(options);\n }\n /**\n * Move a panel given it's current and desired index.\n */\n movePanel(from, to) {\n this.component.movePanel(from, to);\n }\n /**\n * Deserialize a layout to built a splitivew.\n */\n fromJSON(data) {\n this.component.fromJSON(data);\n }\n /** Serialize a layout */\n toJSON() {\n return this.component.toJSON();\n }\n /**\n * Remove all panels and clear the component.\n */\n clear() {\n this.component.clear();\n }\n /**\n * Update configuratable options.\n */\n updateOptions(options) {\n this.component.updateOptions(options);\n }\n /**\n * Release resources and teardown component. Do not call when using framework versions of dockview.\n */\n dispose() {\n this.component.dispose();\n }\n}\nclass PaneviewApi {\n /**\n * The minimum size the component can reach where size is measured in the direction of orientation provided.\n */\n get minimumSize() {\n return this.component.minimumSize;\n }\n /**\n * The maximum size the component can reach where size is measured in the direction of orientation provided.\n */\n get maximumSize() {\n return this.component.maximumSize;\n }\n /**\n * Width of the component.\n */\n get width() {\n return this.component.width;\n }\n /**\n * Height of the component.\n */\n get height() {\n return this.component.height;\n }\n /**\n * All panel objects.\n */\n get panels() {\n return this.component.panels;\n }\n /**\n * Invoked when any layout change occures, an aggregation of many events.\n */\n get onDidLayoutChange() {\n return this.component.onDidLayoutChange;\n }\n /**\n * Invoked after a layout is deserialzied using the `fromJSON` method.\n */\n get onDidLayoutFromJSON() {\n return this.component.onDidLayoutFromJSON;\n }\n /**\n * Invoked when a panel is added. May be called multiple times when moving panels.\n */\n get onDidAddView() {\n return this.component.onDidAddView;\n }\n /**\n * Invoked when a panel is removed. May be called multiple times when moving panels.\n */\n get onDidRemoveView() {\n return this.component.onDidRemoveView;\n }\n /**\n * Invoked when a Drag'n'Drop event occurs that the component was unable to handle. Exposed for custom Drag'n'Drop functionality.\n */\n get onDidDrop() {\n return this.component.onDidDrop;\n }\n get onUnhandledDragOver() {\n return this.component.onUnhandledDragOver;\n }\n constructor(component) {\n this.component = component;\n }\n /**\n * Remove a panel given the panel object.\n */\n removePanel(panel) {\n this.component.removePanel(panel);\n }\n /**\n * Get a panel object given a `string` id. May return `undefined`.\n */\n getPanel(id) {\n return this.component.getPanel(id);\n }\n /**\n * Move a panel given it's current and desired index.\n */\n movePanel(from, to) {\n this.component.movePanel(from, to);\n }\n /**\n * Focus the component. Will try to focus an active panel if one exists.\n */\n focus() {\n this.component.focus();\n }\n /**\n * Force resize the component to an exact width and height. Read about auto-resizing before using.\n */\n layout(width, height) {\n this.component.layout(width, height);\n }\n /**\n * Add a panel and return the created object.\n */\n addPanel(options) {\n return this.component.addPanel(options);\n }\n /**\n * Create a component from a serialized object.\n */\n fromJSON(data) {\n this.component.fromJSON(data);\n }\n /**\n * Create a serialized object of the current component.\n */\n toJSON() {\n return this.component.toJSON();\n }\n /**\n * Reset the component back to an empty and default state.\n */\n clear() {\n this.component.clear();\n }\n /**\n * Update configuratable options.\n */\n updateOptions(options) {\n this.component.updateOptions(options);\n }\n /**\n * Release resources and teardown component. Do not call when using framework versions of dockview.\n */\n dispose() {\n this.component.dispose();\n }\n}\nclass GridviewApi {\n /**\n * Width of the component.\n */\n get width() {\n return this.component.width;\n }\n /**\n * Height of the component.\n */\n get height() {\n return this.component.height;\n }\n /**\n * Minimum height of the component.\n */\n get minimumHeight() {\n return this.component.minimumHeight;\n }\n /**\n * Maximum height of the component.\n */\n get maximumHeight() {\n return this.component.maximumHeight;\n }\n /**\n * Minimum width of the component.\n */\n get minimumWidth() {\n return this.component.minimumWidth;\n }\n /**\n * Maximum width of the component.\n */\n get maximumWidth() {\n return this.component.maximumWidth;\n }\n /**\n * Invoked when any layout change occures, an aggregation of many events.\n */\n get onDidLayoutChange() {\n return this.component.onDidLayoutChange;\n }\n /**\n * Invoked when a panel is added. May be called multiple times when moving panels.\n */\n get onDidAddPanel() {\n return this.component.onDidAddGroup;\n }\n /**\n * Invoked when a panel is removed. May be called multiple times when moving panels.\n */\n get onDidRemovePanel() {\n return this.component.onDidRemoveGroup;\n }\n /**\n * Invoked when the active panel changes. May be undefined if no panel is active.\n */\n get onDidActivePanelChange() {\n return this.component.onDidActiveGroupChange;\n }\n /**\n * Invoked after a layout is deserialzied using the `fromJSON` method.\n */\n get onDidLayoutFromJSON() {\n return this.component.onDidLayoutFromJSON;\n }\n /**\n * All panel objects.\n */\n get panels() {\n return this.component.groups;\n }\n /**\n * Current orientation. Can be changed after initialization.\n */\n get orientation() {\n return this.component.orientation;\n }\n set orientation(value) {\n this.component.updateOptions({ orientation: value });\n }\n constructor(component) {\n this.component = component;\n }\n /**\n * Focus the component. Will try to focus an active panel if one exists.\n */\n focus() {\n this.component.focus();\n }\n /**\n * Force resize the component to an exact width and height. Read about auto-resizing before using.\n */\n layout(width, height, force = false) {\n this.component.layout(width, height, force);\n }\n /**\n * Add a panel and return the created object.\n */\n addPanel(options) {\n return this.component.addPanel(options);\n }\n /**\n * Remove a panel given the panel object.\n */\n removePanel(panel, sizing) {\n this.component.removePanel(panel, sizing);\n }\n /**\n * Move a panel in a particular direction relative to another panel.\n */\n movePanel(panel, options) {\n this.component.movePanel(panel, options);\n }\n /**\n * Get a panel object given a `string` id. May return `undefined`.\n */\n getPanel(id) {\n return this.component.getPanel(id);\n }\n /**\n * Create a component from a serialized object.\n */\n fromJSON(data) {\n return this.component.fromJSON(data);\n }\n /**\n * Create a serialized object of the current component.\n */\n toJSON() {\n return this.component.toJSON();\n }\n /**\n * Reset the component back to an empty and default state.\n */\n clear() {\n this.component.clear();\n }\n updateOptions(options) {\n this.component.updateOptions(options);\n }\n /**\n * Release resources and teardown component. Do not call when using framework versions of dockview.\n */\n dispose() {\n this.component.dispose();\n }\n}\nclass DockviewApi {\n /**\n * The unique identifier for this instance. Used to manage scope of Drag'n'Drop events.\n */\n get id() {\n return this.component.id;\n }\n /**\n * Width of the component.\n */\n get width() {\n return this.component.width;\n }\n /**\n * Height of the component.\n */\n get height() {\n return this.component.height;\n }\n /**\n * Minimum height of the component.\n */\n get minimumHeight() {\n return this.component.minimumHeight;\n }\n /**\n * Maximum height of the component.\n */\n get maximumHeight() {\n return this.component.maximumHeight;\n }\n /**\n * Minimum width of the component.\n */\n get minimumWidth() {\n return this.component.minimumWidth;\n }\n /**\n * Maximum width of the component.\n */\n get maximumWidth() {\n return this.component.maximumWidth;\n }\n /**\n * Total number of groups.\n */\n get size() {\n return this.component.size;\n }\n /**\n * The active tab-group color palette. Reflects the configured\n * `tabGroupColors` option, or the built-in defaults when unset.\n * Useful for custom chip renderers that want to roll their own\n * picker UI.\n */\n get tabGroupColors() {\n return this.component.tabGroupColorPalette.entries();\n }\n /**\n * Total number of panels.\n */\n get totalPanels() {\n return this.component.totalPanels;\n }\n /**\n * Invoked when the active group changes. May be undefined if no group is active.\n */\n get onDidActiveGroupChange() {\n return this.component.onDidActiveGroupChange;\n }\n /**\n * Invoked when a group is added. May be called multiple times when moving groups.\n */\n get onDidAddGroup() {\n return this.component.onDidAddGroup;\n }\n /**\n * Invoked when a group is removed. May be called multiple times when moving groups.\n */\n get onDidRemoveGroup() {\n return this.component.onDidRemoveGroup;\n }\n /**\n * Invoked when the active panel changes. The event carries the active\n * `panel` (may be undefined if no panel is active) and the\n * {@link DockviewOrigin} (`'user'` vs `'api'`) of the change.\n */\n get onDidActivePanelChange() {\n return this.component.onDidActivePanelChange;\n }\n /**\n * Invoked when a panel is added. May be called multiple times when moving panels.\n */\n get onDidAddPanel() {\n return this.component.onDidAddPanel;\n }\n /**\n * Invoked when a panel is removed. May be called multiple times when moving panels.\n */\n get onDidRemovePanel() {\n return this.component.onDidRemovePanel;\n }\n get onDidMovePanel() {\n return this.component.onDidMovePanel;\n }\n /**\n * Invoked after a layout is deserialzied using the `fromJSON` method.\n */\n get onDidLayoutFromJSON() {\n return this.component.onDidLayoutFromJSON;\n }\n /**\n * Invoked when any layout change occures, an aggregation of many events.\n */\n get onDidLayoutChange() {\n return this.component.onDidLayoutChange;\n }\n /**\n * Invoked when a Drag'n'Drop event occurs that the component was unable to handle. Exposed for custom Drag'n'Drop functionality.\n */\n get onDidDrop() {\n return this.component.onDidDrop;\n }\n /**\n * Invoked when a Drag'n'Drop event occurs but before dockview handles it giving the user an opportunity to intecept and\n * prevent the event from occuring using the standard `preventDefault()` syntax.\n *\n * Preventing certain events may causes unexpected behaviours, use carefully.\n */\n get onWillDrop() {\n return this.component.onWillDrop;\n }\n /**\n * Fires before each top-level structural layout mutation (add / remove /\n * move / float / popout / maximize / load / clear). Compound operations\n * (e.g. a drag) fire once. Pair with `onDidMutateLayout` to bracket a\n * change — useful for undo/redo, autosave and dirty-tracking.\n */\n get onWillMutateLayout() {\n return this.component.onWillMutateLayout;\n }\n /** Fires after each top-level structural layout mutation. See `onWillMutateLayout`. */\n get onDidMutateLayout() {\n return this.component.onDidMutateLayout;\n }\n /**\n * Invoked before an overlay is shown indicating a drop target.\n *\n * Calling `event.preventDefault()` will prevent the overlay being shown and prevent\n * the any subsequent drop event.\n */\n get onWillShowOverlay() {\n return this.component.onWillShowOverlay;\n }\n /**\n * Invoked before a group is dragged.\n *\n * Calling `event.nativeEvent.preventDefault()` will prevent the group drag starting.\n *\n */\n get onWillDragGroup() {\n return this.component.onWillDragGroup;\n }\n /**\n * Invoked before a panel is dragged.\n *\n * Calling `event.nativeEvent.preventDefault()` will prevent the panel drag starting.\n */\n get onWillDragPanel() {\n return this.component.onWillDragPanel;\n }\n get onUnhandledDragOver() {\n return this.component.onUnhandledDragOver;\n }\n get onDidPopoutGroupSizeChange() {\n return this.component.onDidPopoutGroupSizeChange;\n }\n get onDidPopoutGroupPositionChange() {\n return this.component.onDidPopoutGroupPositionChange;\n }\n /**\n * Fires when a popout group successfully opens in its own window, carrying\n * the live `Window` handle. Use it to route focus or attach per-document\n * listeners. Enumerate the current popouts at any time with `getPopouts()`.\n */\n get onDidAddPopoutGroup() {\n return this.component.onDidAddPopoutGroup;\n }\n /**\n * Fires when a popout group is removed — whether the user closed its window\n * or it was docked back programmatically. Symmetric with\n * {@link onDidAddPopoutGroup}; not fired during component disposal.\n */\n get onDidRemovePopoutGroup() {\n return this.component.onDidRemovePopoutGroup;\n }\n get onDidOpenPopoutWindowFail() {\n return this.component.onDidOpenPopoutWindowFail;\n }\n /** Enumerate the popout groups currently open in their own windows. */\n getPopouts() {\n return this.component.getPopouts();\n }\n /**\n * Invoked when a tab group is created in any group.\n */\n get onDidCreateTabGroup() {\n return this.component.onDidCreateTabGroup;\n }\n /**\n * Invoked when a tab group is destroyed in any group.\n */\n get onDidDestroyTabGroup() {\n return this.component.onDidDestroyTabGroup;\n }\n /**\n * Invoked when a panel is added to a tab group.\n */\n get onDidAddPanelToTabGroup() {\n return this.component.onDidAddPanelToTabGroup;\n }\n /**\n * Invoked when a panel is removed from a tab group.\n */\n get onDidRemovePanelFromTabGroup() {\n return this.component.onDidRemovePanelFromTabGroup;\n }\n /**\n * Invoked when a tab group's properties (label, color) change.\n */\n get onDidTabGroupChange() {\n return this.component.onDidTabGroupChange;\n }\n /**\n * Invoked when a tab group is collapsed or expanded.\n */\n get onDidTabGroupCollapsedChange() {\n return this.component.onDidTabGroupCollapsedChange;\n }\n /**\n * All panel objects.\n */\n get panels() {\n return this.component.panels;\n }\n /**\n * All group objects.\n */\n get groups() {\n return this.component.groups;\n }\n /**\n * The nearest grid group in a spatial direction from `group`, comparing\n * group centre points — e.g. the group visually to the left. Floating and\n * popout groups are ignored. Returns `undefined` when there is no group in\n * that direction. Pair with `group.api.boundingBox` to build your own\n * spatial navigation.\n */\n adjacentGroupInDirection(group, direction) {\n return this.component.adjacentGroupInDirection(group, direction);\n }\n /**\n * Active panel object.\n */\n get activePanel() {\n return this.component.activePanel;\n }\n /**\n * Active group object.\n */\n get activeGroup() {\n return this.component.activeGroup;\n }\n constructor(component) {\n this.component = component;\n }\n /**\n * Focus the component. Will try to focus an active panel if one exists.\n */\n focus() {\n this.component.focus();\n }\n /**\n * Get a panel object given a `string` id. May return `undefined`.\n */\n getPanel(id) {\n return this.component.getGroupPanel(id);\n }\n /**\n * Force resize the component to an exact width and height. Read about auto-resizing before using.\n */\n layout(width, height, force = false) {\n this.component.layout(width, height, force);\n }\n /**\n * Add a panel and return the created object.\n */\n addPanel(options) {\n return this.component.withOrigin('api', () => this.component.addPanel(options));\n }\n /**\n * Remove a panel given the panel object.\n */\n removePanel(panel) {\n this.component.withOrigin('api', () => this.component.removePanel(panel));\n }\n /**\n * Add a group and return the created object.\n */\n addGroup(options) {\n return this.component.addGroup(options);\n }\n /**\n * Close all groups and panels.\n */\n closeAllGroups() {\n return this.component.withOrigin('api', () => this.component.closeAllGroups());\n }\n /**\n * Remove a group and any panels within the group.\n */\n removeGroup(group) {\n this.component.withOrigin('api', () => this.component.removeGroup(group));\n }\n /**\n * Get a group object given a `string` id. May return undefined.\n */\n getGroup(id) {\n return this.component.getPanel(id);\n }\n /**\n * Add a floating group\n */\n addFloatingGroup(item, options) {\n return this.component.withOrigin('api', () => this.component.addFloatingGroup(item, options));\n }\n /**\n * Create a component from a serialized object.\n */\n fromJSON(data, options) {\n this.component.withOrigin('api', () => this.component.fromJSON(data, options));\n }\n /**\n * Create a serialized object of the current component.\n */\n toJSON() {\n return this.component.toJSON();\n }\n /**\n * Reset the component back to an empty and default state.\n */\n clear() {\n this.component.withOrigin('api', () => this.component.clear());\n }\n /**\n * Move the focus progmatically to the next panel or group.\n */\n moveToNext(options) {\n this.component.moveToNext(options);\n }\n /**\n * Move the focus progmatically to the previous panel or group.\n */\n moveToPrevious(options) {\n this.component.moveToPrevious(options);\n }\n maximizeGroup(panel) {\n this.component.maximizeGroup(panel.group);\n }\n hasMaximizedGroup() {\n return this.component.hasMaximizedGroup();\n }\n exitMaximizedGroup() {\n this.component.exitMaximizedGroup();\n }\n get onDidMaximizedGroupChange() {\n return this.component.onDidMaximizedGroupChange;\n }\n /**\n * Add a popout group in a new Window\n */\n addPopoutGroup(item, options) {\n return this.component.withOrigin('api', () => this.component.addPopoutGroup(item, options));\n }\n /**\n * Add an edge group at the given position. Returns the group panel API\n * for the newly created group. Throws if a group already exists there.\n */\n addEdgeGroup(position, options) {\n return this.component.addEdgeGroup(position, options);\n }\n /**\n * Get the group panel API for an edge group at the given position.\n * Returns `undefined` if no edge group is configured at that position.\n */\n getEdgeGroup(position) {\n return this.component.getEdgeGroup(position);\n }\n /**\n * Set the visibility of an edge group.\n */\n setEdgeGroupVisible(position, visible) {\n this.component.setEdgeGroupVisible(position, visible);\n }\n /**\n * Check whether an edge group is currently visible.\n */\n isEdgeGroupVisible(position) {\n return this.component.isEdgeGroupVisible(position);\n }\n /**\n * Remove an edge group and reclaim its slot in the layout.\n * All panels inside the group are disposed. Throws if no group exists at position.\n */\n removeEdgeGroup(position) {\n this.component.removeEdgeGroup(position);\n }\n updateOptions(options) {\n this.component.updateOptions(options);\n }\n // === Tab Group API ===\n _getGroupModel(groupId) {\n const group = this.component.getPanel(groupId);\n if (!group) {\n throw new Error(`dockview: group '${groupId}' not found`);\n }\n return group.model;\n }\n createTabGroup(options) {\n const model = this._getGroupModel(options.groupId);\n return this.component.withOrigin('api', () => model.createTabGroup({\n label: options.label,\n color: options.color,\n componentParams: options.componentParams,\n }));\n }\n dissolveTabGroup(options) {\n const model = this._getGroupModel(options.groupId);\n this.component.withOrigin('api', () => model.dissolveTabGroup(options.tabGroupId));\n }\n addPanelToTabGroup(options) {\n const model = this._getGroupModel(options.groupId);\n this.component.withOrigin('api', () => model.addPanelToTabGroup(options.tabGroupId, options.panelId, options.index));\n }\n removePanelFromTabGroup(options) {\n const model = this._getGroupModel(options.groupId);\n this.component.withOrigin('api', () => model.removePanelFromTabGroup(options.panelId));\n }\n getTabGroups(options) {\n const model = this._getGroupModel(options.groupId);\n return model.getTabGroups();\n }\n getTabGroupForPanel(options) {\n const model = this._getGroupModel(options.groupId);\n return model.getTabGroupForPanel(options.panelId);\n }\n moveTabGroup(options) {\n const model = this._getGroupModel(options.groupId);\n model.moveTabGroup(options.tabGroupId, options.index);\n }\n /**\n * Release resources and teardown component. Do not call when using framework versions of dockview.\n */\n dispose() {\n this.component.dispose();\n }\n}\n\nclass DragAndDropObserver extends CompositeDisposable {\n constructor(element, callbacks) {\n super();\n this.element = element;\n this.callbacks = callbacks;\n this.target = null;\n this.registerListeners();\n }\n onDragEnter(e) {\n this.target = e.target;\n this.callbacks.onDragEnter(e);\n }\n onDragOver(e) {\n e.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome)\n if (this.callbacks.onDragOver) {\n this.callbacks.onDragOver(e);\n }\n }\n onDragLeave(e) {\n if (this.target === e.target) {\n this.target = null;\n this.callbacks.onDragLeave(e);\n }\n }\n onDragEnd(e) {\n this.target = null;\n this.callbacks.onDragEnd(e);\n }\n onDrop(e) {\n this.callbacks.onDrop(e);\n }\n registerListeners() {\n this.addDisposables(addDisposableListener(this.element, 'dragenter', (e) => {\n this.onDragEnter(e);\n }, true));\n this.addDisposables(addDisposableListener(this.element, 'dragover', (e) => {\n this.onDragOver(e);\n }, true));\n this.addDisposables(addDisposableListener(this.element, 'dragleave', (e) => {\n this.onDragLeave(e);\n }));\n this.addDisposables(addDisposableListener(this.element, 'dragend', (e) => {\n this.onDragEnd(e);\n }));\n this.addDisposables(addDisposableListener(this.element, 'drop', (e) => {\n this.onDrop(e);\n }));\n }\n}\n\n// Two render paths: in-place (dropzone appended to drop element) and\n// anchored (overlay rendered into an external anchor container).\nconst DEFAULT_SIZE = { value: 50, type: 'percentage' };\nconst SMALL_WIDTH_BOUNDARY = 100;\nconst SMALL_HEIGHT_BOUNDARY = 100;\nfunction createOverlayElements() {\n const dropzone = document.createElement('div');\n dropzone.className = 'dv-drop-target-dropzone';\n const selection = document.createElement('div');\n selection.className = 'dv-drop-target-selection';\n dropzone.appendChild(selection);\n return { dropzone, selection };\n}\nfunction computeOverlayShape(quadrant, width, height, overlayModel) {\n var _a, _b, _c;\n const smallWidthBoundary = (_a = overlayModel === null || overlayModel === void 0 ? void 0 : overlayModel.smallWidthBoundary) !== null && _a !== void 0 ? _a : SMALL_WIDTH_BOUNDARY;\n const smallHeightBoundary = (_b = overlayModel === null || overlayModel === void 0 ? void 0 : overlayModel.smallHeightBoundary) !== null && _b !== void 0 ? _b : SMALL_HEIGHT_BOUNDARY;\n const isSmallX = width < smallWidthBoundary;\n const isSmallY = height < smallHeightBoundary;\n const isLeft = quadrant === 'left';\n const isRight = quadrant === 'right';\n const isTop = quadrant === 'top';\n const isBottom = quadrant === 'bottom';\n const rightClass = !isSmallX && isRight;\n const leftClass = !isSmallX && isLeft;\n const topClass = !isSmallY && isTop;\n const bottomClass = !isSmallY && isBottom;\n let size = 1;\n const sizeOptions = (_c = overlayModel === null || overlayModel === void 0 ? void 0 : overlayModel.size) !== null && _c !== void 0 ? _c : DEFAULT_SIZE;\n if (sizeOptions.type === 'percentage') {\n size = clamp(sizeOptions.value, 0, 100) / 100;\n }\n else {\n if (rightClass || leftClass) {\n size = clamp(0, sizeOptions.value, width) / width;\n }\n if (topClass || bottomClass) {\n size = clamp(0, sizeOptions.value, height) / height;\n }\n }\n return {\n isSmallX,\n isSmallY,\n isLeft,\n isRight,\n isTop,\n isBottom,\n rightClass,\n leftClass,\n topClass,\n bottomClass,\n size,\n };\n}\nfunction renderInPlaceOverlay(overlay, quadrant, width, height, overlayModel) {\n const shape = computeOverlayShape(quadrant, width, height, overlayModel);\n const { rightClass, leftClass, topClass, bottomClass, size } = shape;\n const box = { top: '0px', left: '0px', width: '100%', height: '100%' };\n if (rightClass) {\n box.left = `${100 * (1 - size)}%`;\n box.width = `${100 * size}%`;\n }\n else if (leftClass) {\n box.width = `${100 * size}%`;\n }\n else if (topClass) {\n box.height = `${100 * size}%`;\n }\n else if (bottomClass) {\n box.top = `${100 * (1 - size)}%`;\n box.height = `${100 * size}%`;\n }\n if (shape.isSmallX && shape.isLeft) {\n box.width = '4px';\n }\n if (shape.isSmallX && shape.isRight) {\n box.left = `${width - 4}px`;\n box.width = '4px';\n }\n if (shape.isSmallY && shape.isTop) {\n box.height = '4px';\n }\n if (shape.isSmallY && shape.isBottom) {\n box.top = `${height - 4}px`;\n box.height = '4px';\n }\n overlay.style.top = box.top;\n overlay.style.left = box.left;\n overlay.style.width = box.width;\n overlay.style.height = box.height;\n overlay.style.visibility = 'visible';\n if (!overlay.style.transform || overlay.style.transform === '') {\n overlay.style.transform = 'translate3d(0, 0, 0)';\n }\n const isLine = (shape.isSmallX && (shape.isLeft || shape.isRight)) ||\n (shape.isSmallY && (shape.isTop || shape.isBottom));\n toggleClass(overlay, 'dv-drop-target-small-vertical', shape.isSmallY);\n toggleClass(overlay, 'dv-drop-target-small-horizontal', shape.isSmallX);\n toggleClass(overlay, 'dv-drop-target-selection-line', isLine);\n toggleClass(overlay, 'dv-drop-target-left', shape.isLeft);\n toggleClass(overlay, 'dv-drop-target-right', shape.isRight);\n toggleClass(overlay, 'dv-drop-target-top', shape.isTop);\n toggleClass(overlay, 'dv-drop-target-bottom', shape.isBottom);\n toggleClass(overlay, 'dv-drop-target-center', quadrant === 'center');\n}\nfunction checkAnchoredBoundsChanged(overlay, bounds) {\n const topPx = `${Math.round(bounds.top)}px`;\n const leftPx = `${Math.round(bounds.left)}px`;\n const widthPx = `${Math.round(bounds.width)}px`;\n const heightPx = `${Math.round(bounds.height)}px`;\n return (overlay.style.top !== topPx ||\n overlay.style.left !== leftPx ||\n overlay.style.width !== widthPx ||\n overlay.style.height !== heightPx);\n}\nfunction applyAnchoredBounds(overlay, bounds) {\n overlay.style.top = `${Math.round(bounds.top)}px`;\n overlay.style.left = `${Math.round(bounds.left)}px`;\n overlay.style.width = `${Math.round(bounds.width)}px`;\n overlay.style.height = `${Math.round(bounds.height)}px`;\n overlay.style.visibility = 'visible';\n if (!overlay.style.transform || overlay.style.transform === '') {\n overlay.style.transform = 'translate3d(0, 0, 0)';\n }\n}\n/** `boundsChanged: false` lets callers skip redundant work on tight drag loops. */\nfunction renderAnchoredOverlay(args) {\n const shape = computeOverlayShape(args.quadrant, args.width, args.height, args.overlayModel);\n const { rightClass, leftClass, topClass, bottomClass, size } = shape;\n const elBox = args.outlineElement.getBoundingClientRect();\n const ta = args.targetModel.getElements(undefined, args.outlineElement);\n const el = ta.root;\n const overlay = ta.overlay;\n const bigbox = el.getBoundingClientRect();\n const rootTop = elBox.top - bigbox.top;\n const rootLeft = elBox.left - bigbox.left;\n const box = {\n top: rootTop,\n left: rootLeft,\n width: args.width,\n height: args.height,\n };\n if (rightClass) {\n box.left = rootLeft + args.width * (1 - size);\n box.width = args.width * size;\n }\n else if (leftClass) {\n box.width = args.width * size;\n }\n else if (topClass) {\n box.height = args.height * size;\n }\n else if (bottomClass) {\n box.top = rootTop + args.height * (1 - size);\n box.height = args.height * size;\n }\n if (shape.isSmallX && shape.isLeft) {\n box.width = 4;\n }\n if (shape.isSmallX && shape.isRight) {\n box.left = rootLeft + args.width - 4;\n box.width = 4;\n }\n if (shape.isSmallY && shape.isTop) {\n box.height = 4;\n }\n if (shape.isSmallY && shape.isBottom) {\n box.top = rootTop + args.height - 4;\n box.height = 4;\n }\n if (!checkAnchoredBoundsChanged(overlay, box)) {\n return { boundsChanged: false, targetChanged: ta.changed };\n }\n applyAnchoredBounds(overlay, box);\n overlay.className = `dv-drop-target-anchor${args.className ? ` ${args.className}` : ''}`;\n toggleClass(overlay, 'dv-drop-target-left', shape.isLeft);\n toggleClass(overlay, 'dv-drop-target-right', shape.isRight);\n toggleClass(overlay, 'dv-drop-target-top', shape.isTop);\n toggleClass(overlay, 'dv-drop-target-bottom', shape.isBottom);\n toggleClass(overlay, 'dv-drop-target-anchor-line', (shape.isSmallX && (shape.isLeft || shape.isRight)) ||\n (shape.isSmallY && (shape.isTop || shape.isBottom)));\n toggleClass(overlay, 'dv-drop-target-center', args.quadrant === 'center');\n if (ta.changed) {\n toggleClass(overlay, 'dv-drop-target-anchor-container-changed', true);\n setTimeout(() => {\n toggleClass(overlay, 'dv-drop-target-anchor-container-changed', false);\n }, 10);\n }\n return { boundsChanged: true, targetChanged: ta.changed };\n}\n\nclass WillShowOverlayEvent extends DockviewEvent {\n get nativeEvent() {\n return this.options.nativeEvent;\n }\n get position() {\n return this.options.position;\n }\n constructor(options) {\n super();\n this.options = options;\n }\n}\nfunction directionToPosition(direction) {\n switch (direction) {\n case 'above':\n return 'top';\n case 'below':\n return 'bottom';\n case 'left':\n return 'left';\n case 'right':\n return 'right';\n case 'within':\n return 'center';\n default:\n throw new Error(`invalid direction '${direction}'`);\n }\n}\nfunction positionToDirection(position) {\n switch (position) {\n case 'top':\n return 'above';\n case 'bottom':\n return 'below';\n case 'left':\n return 'left';\n case 'right':\n return 'right';\n case 'center':\n return 'within';\n default:\n throw new Error(`invalid position '${position}'`);\n }\n}\nconst DEFAULT_ACTIVATION_SIZE$1 = {\n value: 20,\n type: 'percentage',\n};\nclass Droptarget extends CompositeDisposable {\n get disabled() {\n return this._disabled;\n }\n set disabled(value) {\n this._disabled = value;\n }\n get state() {\n return this._state;\n }\n constructor(element, options) {\n super();\n this.element = element;\n this.options = options;\n this._onDrop = new Emitter();\n this.onDrop = this._onDrop.event;\n this._onWillShowOverlay = new Emitter();\n this.onWillShowOverlay = this._onWillShowOverlay.event;\n this._disabled = false;\n // use a set to take advantage of #<set>.has\n this._acceptedTargetZonesSet = new Set(this.options.acceptedTargetZones);\n this.dnd = new DragAndDropObserver(this.element, {\n onDragEnter: () => {\n var _a, _b, _c;\n (_c = (_b = (_a = this.options).getOverrideTarget) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c.getElements();\n },\n onDragOver: (e) => {\n var _a, _b, _c, _d, _e, _f, _g;\n Droptarget.ACTUAL_TARGET = this;\n const overrideTarget = (_b = (_a = this.options).getOverrideTarget) === null || _b === void 0 ? void 0 : _b.call(_a);\n if (this._acceptedTargetZonesSet.size === 0) {\n if (overrideTarget) {\n return;\n }\n this.removeDropTarget();\n return;\n }\n const target = (_e = (_d = (_c = this.options).getOverlayOutline) === null || _d === void 0 ? void 0 : _d.call(_c)) !== null && _e !== void 0 ? _e : this.element;\n const width = target.offsetWidth;\n const height = target.offsetHeight;\n if (width === 0 || height === 0) {\n return; // avoid div!0\n }\n const rect = e.currentTarget.getBoundingClientRect();\n const x = ((_f = e.clientX) !== null && _f !== void 0 ? _f : 0) - rect.left;\n const y = ((_g = e.clientY) !== null && _g !== void 0 ? _g : 0) - rect.top;\n const quadrant = this.calculateQuadrant(this._acceptedTargetZonesSet, x, y, width, height);\n /**\n * If the event has already been used by another DropTarget instance\n * then don't show a second drop target, only one target should be\n * active at any one time\n */\n if (this.isAlreadyUsed(e) || quadrant === null) {\n // no drop target should be displayed\n this.removeDropTarget();\n return;\n }\n if (!this.options.canDisplayOverlay(e, quadrant)) {\n if (overrideTarget) {\n return;\n }\n this.removeDropTarget();\n return;\n }\n const willShowOverlayEvent = new WillShowOverlayEvent({\n nativeEvent: e,\n position: quadrant,\n });\n /**\n * Provide an opportunity to prevent the overlay appearing and in turn\n * any dnd behaviours\n */\n this._onWillShowOverlay.fire(willShowOverlayEvent);\n if (willShowOverlayEvent.defaultPrevented) {\n this.removeDropTarget();\n return;\n }\n this.markAsUsed(e);\n if (overrideTarget) ;\n else if (!this.targetElement) {\n const els = createOverlayElements();\n this.targetElement = els.dropzone;\n this.overlayElement = els.selection;\n this._state = 'center';\n target.classList.add('dv-drop-target');\n target.append(this.targetElement);\n }\n this.toggleClasses(quadrant, width, height);\n this._state = quadrant;\n },\n onDragLeave: () => {\n var _a, _b;\n const target = (_b = (_a = this.options).getOverrideTarget) === null || _b === void 0 ? void 0 : _b.call(_a);\n if (target) {\n return;\n }\n this.removeDropTarget();\n },\n onDragEnd: (e) => {\n var _a, _b;\n const target = (_b = (_a = this.options).getOverrideTarget) === null || _b === void 0 ? void 0 : _b.call(_a);\n if (target && Droptarget.ACTUAL_TARGET === this) {\n if (this._state) {\n // only stop the propagation of the event if we are dealing with it\n // which is only when the target has state\n e.stopPropagation();\n this._onDrop.fire({\n position: this._state,\n nativeEvent: e,\n });\n }\n }\n this.removeDropTarget();\n target === null || target === void 0 ? void 0 : target.clear();\n },\n onDrop: (e) => {\n var _a, _b, _c;\n e.preventDefault();\n const state = this._state;\n this.removeDropTarget();\n (_c = (_b = (_a = this.options).getOverrideTarget) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c.clear();\n if (state) {\n // only stop the propagation of the event if we are dealing with it\n // which is only when the target has state\n e.stopPropagation();\n this._onDrop.fire({ position: state, nativeEvent: e });\n }\n },\n });\n this.addDisposables(this._onDrop, this._onWillShowOverlay, this.dnd);\n }\n setTargetZones(acceptedTargetZones) {\n this._acceptedTargetZonesSet = new Set(acceptedTargetZones);\n }\n setOverlayModel(model) {\n this.options.overlayModel = model;\n }\n dispose() {\n this.removeDropTarget();\n super.dispose();\n }\n /**\n * Add a property to the event object for other potential listeners to check\n */\n markAsUsed(event) {\n event[Droptarget.USED_EVENT_ID] = true;\n }\n /**\n * Check is the event has already been used by another instance of DropTarget\n */\n isAlreadyUsed(event) {\n const value = event[Droptarget.USED_EVENT_ID];\n return typeof value === 'boolean' && value;\n }\n toggleClasses(quadrant, width, height) {\n var _a, _b, _c, _d, _e;\n const target = (_b = (_a = this.options).getOverrideTarget) === null || _b === void 0 ? void 0 : _b.call(_a);\n if (target) {\n const outlineEl = (_e = (_d = (_c = this.options).getOverlayOutline) === null || _d === void 0 ? void 0 : _d.call(_c)) !== null && _e !== void 0 ? _e : this.element;\n renderAnchoredOverlay({\n outlineElement: outlineEl,\n targetModel: target,\n quadrant,\n width,\n height,\n overlayModel: this.options.overlayModel,\n className: this.options.className,\n });\n return;\n }\n if (!this.overlayElement) {\n return;\n }\n renderInPlaceOverlay(this.overlayElement, quadrant, width, height, this.options.overlayModel);\n }\n calculateQuadrant(overlayType, x, y, width, height) {\n var _a, _b;\n const activationSizeOptions = (_b = (_a = this.options.overlayModel) === null || _a === void 0 ? void 0 : _a.activationSize) !== null && _b !== void 0 ? _b : DEFAULT_ACTIVATION_SIZE$1;\n const isPercentage = activationSizeOptions.type === 'percentage';\n if (isPercentage) {\n return calculateQuadrantAsPercentage(overlayType, x, y, width, height, activationSizeOptions.value);\n }\n return calculateQuadrantAsPixels(overlayType, x, y, width, height, activationSizeOptions.value);\n }\n removeDropTarget() {\n var _a;\n if (this.targetElement) {\n this._state = undefined;\n (_a = this.targetElement.parentElement) === null || _a === void 0 ? void 0 : _a.classList.remove('dv-drop-target');\n this.targetElement.remove();\n this.targetElement = undefined;\n this.overlayElement = undefined;\n }\n }\n /**\n * Render the drop overlay at `position` without a live drag, so keyboard\n * docking shows the exact same preview as a mouse drag. Mirrors the\n * `onDragOver` render path (in-place or anchored). Pair with `clearOverlay`.\n */\n showOverlay(position) {\n var _a, _b, _c, _d, _e;\n const overrideTarget = (_b = (_a = this.options).getOverrideTarget) === null || _b === void 0 ? void 0 : _b.call(_a);\n const target = (_e = (_d = (_c = this.options).getOverlayOutline) === null || _d === void 0 ? void 0 : _d.call(_c)) !== null && _e !== void 0 ? _e : this.element;\n const width = target.offsetWidth;\n const height = target.offsetHeight;\n if (!overrideTarget && !this.targetElement) {\n const els = createOverlayElements();\n this.targetElement = els.dropzone;\n this.overlayElement = els.selection;\n target.classList.add('dv-drop-target');\n target.append(this.targetElement);\n }\n this.toggleClasses(position, width, height);\n this._state = position;\n }\n /** Clear an overlay shown via {@link showOverlay} (in-place or anchored). */\n clearOverlay() {\n var _a, _b, _c;\n this.removeDropTarget();\n (_c = (_b = (_a = this.options).getOverrideTarget) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c.clear();\n this._state = undefined;\n }\n}\nDroptarget.USED_EVENT_ID = '__dockview_droptarget_event_is_used__';\nfunction calculateQuadrantAsPercentage(overlayType, x, y, width, height, threshold) {\n const xp = (100 * x) / width;\n const yp = (100 * y) / height;\n if (overlayType.has('left') && xp < threshold) {\n return 'left';\n }\n if (overlayType.has('right') && xp > 100 - threshold) {\n return 'right';\n }\n if (overlayType.has('top') && yp < threshold) {\n return 'top';\n }\n if (overlayType.has('bottom') && yp > 100 - threshold) {\n return 'bottom';\n }\n if (!overlayType.has('center')) {\n return null;\n }\n return 'center';\n}\nfunction calculateQuadrantAsPixels(overlayType, x, y, width, height, threshold) {\n if (overlayType.has('left') && x < threshold) {\n return 'left';\n }\n if (overlayType.has('right') && x > width - threshold) {\n return 'right';\n }\n if (overlayType.has('top') && y < threshold) {\n return 'top';\n }\n if (overlayType.has('bottom') && y > height - threshold) {\n return 'bottom';\n }\n if (!overlayType.has('center')) {\n return null;\n }\n return 'center';\n}\n\nfunction addGhostImage(dataTransfer, ghostElement, options) {\n var _a, _b;\n // class dockview provides to force ghost image to be drawn on a different layer and prevent weird rendering issues\n addClasses(ghostElement, 'dv-dragged');\n // move the element off-screen initially otherwise it may in some cases be rendered at (0,0) momentarily\n ghostElement.style.top = '-9999px';\n document.body.appendChild(ghostElement);\n dataTransfer.setDragImage(ghostElement, (_a = options === null || options === void 0 ? void 0 : options.x) !== null && _a !== void 0 ? _a : 0, (_b = options === null || options === void 0 ? void 0 : options.y) !== null && _b !== void 0 ? _b : 0);\n setTimeout(() => {\n removeClasses(ghostElement, 'dv-dragged');\n ghostElement.remove();\n }, 0);\n}\n\n/**\n * Singleton — only one pointer-driven drag active at a time.\n *\n * State is shared across every Dockview instance on the page. Targets\n * from instance B receive hit-tests from drags originating in instance A;\n * that's intentional for cross-instance drops since `LocalSelectionTransfer`\n * is also process-wide. The corollary is that every Tabs subscriber to\n * `onDragMove` fires for every pointer drag globally — each subscriber\n * hit-tests against its own DOM, so this is O(N) per pointermove where N\n * is the number of registered listeners across all instances.\n */\nclass PointerDragController extends CompositeDisposable {\n static getInstance() {\n if (!PointerDragController._instance) {\n PointerDragController._instance = new PointerDragController();\n }\n return PointerDragController._instance;\n }\n constructor() {\n super();\n this._targets = new Set();\n /** Kept in sync with `_targets` so hit-testing is allocation-free. */\n this._targetByElement = new Map();\n this._onDragStart = new Emitter();\n this.onDragStart = this._onDragStart.event;\n this._onDragMove = new Emitter();\n this.onDragMove = this._onDragMove.event;\n this._onDragEnd = new Emitter();\n this.onDragEnd = this._onDragEnd.event;\n this.addDisposables(this._onDragStart, this._onDragMove, this._onDragEnd);\n }\n get active() {\n return this._active;\n }\n registerTarget(target) {\n this._targets.add(target);\n this._targetByElement.set(target.element, target);\n return {\n dispose: () => {\n this._targets.delete(target);\n if (this._targetByElement.get(target.element) === target) {\n this._targetByElement.delete(target.element);\n }\n if (this._currentTarget === target) {\n this._currentTarget = undefined;\n }\n },\n };\n }\n beginDrag(args) {\n var _a, _b, _c;\n if (this._active) {\n this.cancel();\n }\n const { pointerEvent, source } = args;\n // Call `getData()` before mutating controller state — a throw\n // here would otherwise leave `_active` populated with no window\n // listeners installed, blocking every subsequent drag.\n const dataDisposable = args.getData();\n this._active = {\n pointerId: pointerEvent.pointerId,\n startX: pointerEvent.clientX,\n startY: pointerEvent.clientY,\n source,\n };\n this._onDragMoveCallback = args.onDragMove;\n this._onDragEndCallback = args.onDragEnd;\n this._dataDisposable = dataDisposable;\n this._ghost = args.ghost;\n // Iframes capture pointermove once the cursor crosses into them,\n // which would freeze the drag from the parent window's POV.\n this._iframeShield = disableIframePointEvents((_a = source.ownerDocument) !== null && _a !== void 0 ? _a : document);\n const startEvent = {\n clientX: pointerEvent.clientX,\n clientY: pointerEvent.clientY,\n pointerEvent,\n };\n this._onDragStart.fire(startEvent);\n // Source's owning window — popout drags fire on their own window,\n // not the main one.\n const targetWindow = (_c = (_b = source.ownerDocument) === null || _b === void 0 ? void 0 : _b.defaultView) !== null && _c !== void 0 ? _c : window;\n this._moveListener = addDisposableListener(targetWindow, 'pointermove', (e) => {\n if (!this._active || e.pointerId !== this._active.pointerId) {\n return;\n }\n this._handleMove(e);\n });\n this._upListener = addDisposableListener(targetWindow, 'pointerup', (e) => {\n if (!this._active || e.pointerId !== this._active.pointerId) {\n return;\n }\n this._handleEnd(e, true);\n });\n this._cancelListener = addDisposableListener(targetWindow, 'pointercancel', (e) => {\n if (!this._active || e.pointerId !== this._active.pointerId) {\n return;\n }\n this._handleEnd(e, false);\n });\n }\n cancel() {\n var _a, _b;\n if (!this._active) {\n return;\n }\n (_a = this._currentTarget) === null || _a === void 0 ? void 0 : _a.handleDragLeave();\n this._teardown();\n (_b = this._dataDisposable) === null || _b === void 0 ? void 0 : _b.dispose();\n this._dataDisposable = undefined;\n }\n _findTargetUnder(x, y) {\n var _a, _b;\n // `elementsFromPoint` is topmost-first; walk up to find the closest\n // registered ancestor (so a tab beats the layout-root that contains it).\n // Use the source's owning document so popout drags hit their own targets.\n const sourceDoc = (_b = (_a = this._active) === null || _a === void 0 ? void 0 : _a.source.ownerDocument) !== null && _b !== void 0 ? _b : document;\n const elements = sourceDoc.elementsFromPoint(x, y);\n for (const el of elements) {\n let current = el;\n while (current) {\n const target = this._targetByElement.get(current);\n if (target) {\n return target;\n }\n current = current.parentElement;\n }\n }\n return undefined;\n }\n _handleMove(e) {\n var _a, _b, _c;\n (_a = this._ghost) === null || _a === void 0 ? void 0 : _a.update(e.clientX, e.clientY);\n const dragEvent = {\n clientX: e.clientX,\n clientY: e.clientY,\n pointerEvent: e,\n };\n const newTarget = this._findTargetUnder(e.clientX, e.clientY);\n if (newTarget !== this._currentTarget) {\n (_b = this._currentTarget) === null || _b === void 0 ? void 0 : _b.handleDragLeave();\n this._currentTarget = newTarget;\n }\n if (newTarget) {\n newTarget.handleDragOver(dragEvent);\n }\n (_c = this._onDragMoveCallback) === null || _c === void 0 ? void 0 : _c.call(this, dragEvent);\n this._onDragMove.fire(dragEvent);\n }\n _handleEnd(e, dropped) {\n var _a;\n const dragEvent = {\n clientX: e.clientX,\n clientY: e.clientY,\n pointerEvent: e,\n };\n if (dropped && this._currentTarget) {\n this._currentTarget.handleDrop(dragEvent);\n }\n else {\n (_a = this._currentTarget) === null || _a === void 0 ? void 0 : _a.handleDragLeave();\n }\n const onEnd = this._onDragEndCallback;\n const dataDisposable = this._dataDisposable;\n this._teardown();\n this._dataDisposable = undefined;\n // Defer disposal so drop handlers can still read the transfer data.\n setTimeout(() => dataDisposable === null || dataDisposable === void 0 ? void 0 : dataDisposable.dispose(), 0);\n onEnd === null || onEnd === void 0 ? void 0 : onEnd(dragEvent, dropped);\n this._onDragEnd.fire(dragEvent);\n }\n _teardown() {\n var _a, _b, _c, _d, _e;\n this._currentTarget = undefined;\n this._active = undefined;\n this._onDragMoveCallback = undefined;\n this._onDragEndCallback = undefined;\n (_a = this._ghost) === null || _a === void 0 ? void 0 : _a.dispose();\n this._ghost = undefined;\n (_b = this._iframeShield) === null || _b === void 0 ? void 0 : _b.release();\n this._iframeShield = undefined;\n (_c = this._moveListener) === null || _c === void 0 ? void 0 : _c.dispose();\n (_d = this._upListener) === null || _d === void 0 ? void 0 : _d.dispose();\n (_e = this._cancelListener) === null || _e === void 0 ? void 0 : _e.dispose();\n this._moveListener = undefined;\n this._upListener = undefined;\n this._cancelListener = undefined;\n }\n}\n\nconst DEFAULT_ACTIVATION_SIZE = {\n value: 20,\n type: 'percentage',\n};\n/** Pointer-driven counterpart to `Droptarget` with identical visual output. */\nclass PointerDropTarget extends CompositeDisposable {\n get disabled() {\n return this._disabled;\n }\n set disabled(value) {\n this._disabled = value;\n if (value) {\n this._removeOverlay();\n }\n }\n get state() {\n return this._state;\n }\n constructor(element, options) {\n super();\n this.element = element;\n this.options = options;\n this._onDrop = new Emitter();\n this.onDrop = this._onDrop.event;\n this._onWillShowOverlay = new Emitter();\n this.onWillShowOverlay = this._onWillShowOverlay.event;\n this._disabled = false;\n this._acceptedTargetZonesSet = new Set(options.acceptedTargetZones);\n const handle = {\n element: this.element,\n handleDragOver: (e) => this._onDragOver(e),\n handleDragLeave: () => this._onDragLeave(),\n handleDrop: (e) => this._onDropEvent(e),\n };\n this.addDisposables(this._onDrop, this._onWillShowOverlay, PointerDragController.getInstance().registerTarget(handle));\n }\n setTargetZones(zones) {\n this._acceptedTargetZonesSet = new Set(zones);\n }\n setOverlayModel(model) {\n this.options.overlayModel = model;\n }\n dispose() {\n this._removeOverlay();\n super.dispose();\n }\n _onDragOver(event) {\n var _a, _b, _c, _d, _e;\n if (this._disabled) {\n this._removeOverlay();\n return;\n }\n const overrideTarget = (_b = (_a = this.options).getOverrideTarget) === null || _b === void 0 ? void 0 : _b.call(_a);\n if (this._acceptedTargetZonesSet.size === 0) {\n if (overrideTarget) {\n return;\n }\n this._removeOverlay();\n return;\n }\n const outlineEl = (_e = (_d = (_c = this.options).getOverlayOutline) === null || _d === void 0 ? void 0 : _d.call(_c)) !== null && _e !== void 0 ? _e : this.element;\n const width = outlineEl.offsetWidth;\n const height = outlineEl.offsetHeight;\n if (width === 0 || height === 0) {\n return;\n }\n const rect = outlineEl.getBoundingClientRect();\n const x = event.clientX - rect.left;\n const y = event.clientY - rect.top;\n const quadrant = this._calculateQuadrant(x, y, width, height);\n if (quadrant === null) {\n this._removeOverlay();\n return;\n }\n if (!this.options.canDisplayOverlay(event.pointerEvent, quadrant)) {\n if (overrideTarget) {\n return;\n }\n this._removeOverlay();\n return;\n }\n const willShow = new WillShowOverlayEvent({\n nativeEvent: event.pointerEvent,\n position: quadrant,\n });\n this._onWillShowOverlay.fire(willShow);\n if (willShow.defaultPrevented) {\n this._removeOverlay();\n return;\n }\n if (overrideTarget) {\n renderAnchoredOverlay({\n outlineElement: outlineEl,\n targetModel: overrideTarget,\n quadrant,\n width,\n height,\n overlayModel: this.options.overlayModel,\n className: this.options.className,\n });\n this._state = quadrant;\n return;\n }\n if (!this._targetElement) {\n const els = createOverlayElements();\n this._targetElement = els.dropzone;\n this._overlayElement = els.selection;\n this._state = 'center';\n this.element.classList.add('dv-drop-target');\n this.element.append(this._targetElement);\n }\n if (this._overlayElement) {\n renderInPlaceOverlay(this._overlayElement, quadrant, width, height, this.options.overlayModel);\n }\n this._state = quadrant;\n }\n _onDragLeave() {\n var _a, _b;\n const overrideTarget = (_b = (_a = this.options).getOverrideTarget) === null || _b === void 0 ? void 0 : _b.call(_a);\n // Anchor target owns its own lifecycle; just clear our latched\n // state so a subsequent pointerup doesn't fire a stale drop.\n if (overrideTarget) {\n this._state = undefined;\n overrideTarget.clear();\n return;\n }\n this._removeOverlay();\n }\n _onDropEvent(event) {\n var _a, _b;\n const state = this._state;\n const overrideTarget = (_b = (_a = this.options).getOverrideTarget) === null || _b === void 0 ? void 0 : _b.call(_a);\n this._removeOverlay();\n overrideTarget === null || overrideTarget === void 0 ? void 0 : overrideTarget.clear();\n if (state) {\n this._onDrop.fire({\n position: state,\n nativeEvent: event.pointerEvent,\n });\n }\n }\n _calculateQuadrant(x, y, width, height) {\n var _a, _b;\n const activation = (_b = (_a = this.options.overlayModel) === null || _a === void 0 ? void 0 : _a.activationSize) !== null && _b !== void 0 ? _b : DEFAULT_ACTIVATION_SIZE;\n if (activation.type === 'percentage') {\n return calculateQuadrantAsPercentage(this._acceptedTargetZonesSet, x, y, width, height, activation.value);\n }\n return calculateQuadrantAsPixels(this._acceptedTargetZonesSet, x, y, width, height, activation.value);\n }\n _removeOverlay() {\n var _a;\n if (this._targetElement) {\n this._state = undefined;\n (_a = this._targetElement.parentElement) === null || _a === void 0 ? void 0 : _a.classList.remove('dv-drop-target');\n this._targetElement.remove();\n this._targetElement = undefined;\n this._overlayElement = undefined;\n }\n else {\n this._state = undefined;\n }\n }\n}\n\nconst DEFAULT_THRESHOLD = 5;\nconst DEFAULT_TOUCH_INITIATION_DELAY = 250;\nconst DEFAULT_PRESS_TOLERANCE = 8;\n/**\n * Pointer-event drag source. Waits for movement past `threshold` (and\n * touch-only `touchInitiationDelay`) before promoting to a drag so taps\n * pass through unaffected.\n */\nclass PointerDragSource extends CompositeDisposable {\n constructor(element, options) {\n var _a;\n super();\n this.element = element;\n this.options = options;\n this._disabled = false;\n this._armed = false;\n this._startX = 0;\n this._startY = 0;\n this._touchOnly = (_a = options.touchOnly) !== null && _a !== void 0 ? _a : true;\n this.addDisposables(addDisposableListener(this.element, 'pointerdown', (e) => {\n this._onPointerDown(e);\n }));\n }\n setDisabled(value) {\n this._disabled = value;\n if (value) {\n this._cancelPending();\n }\n }\n /**\n * `false` lets the pointer source also handle mouse pointers; used when\n * `dndStrategy: 'pointer'` to drive every input type through this path.\n */\n setTouchOnly(value) {\n if (this._touchOnly === value) {\n return;\n }\n this._touchOnly = value;\n // A pending mouse-tracked drag should be abandoned if we re-enable\n // the touch-only filter mid-flight.\n if (value) {\n this._cancelPending();\n }\n }\n _shouldHandle(event) {\n var _a, _b;\n if (this._disabled) {\n return false;\n }\n // Pointer-type filter runs before isCancelled — consumer state read\n // by isCancelled may not be populated for events we'll never handle.\n if (this._touchOnly &&\n event.pointerType !== 'touch' &&\n event.pointerType !== 'pen') {\n return false;\n }\n if ((_b = (_a = this.options).isCancelled) === null || _b === void 0 ? void 0 : _b.call(_a, event)) {\n return false;\n }\n return true;\n }\n _onPointerDown(event) {\n var _a, _b, _c, _d, _e;\n if (!this._shouldHandle(event)) {\n return;\n }\n // Defensive: a fresh pointerdown supersedes any in-flight tracking.\n this._cancelPending();\n this._pendingPointerId = event.pointerId;\n this._startX = event.clientX;\n this._startY = event.clientY;\n this._startEvent = event;\n const isTouch = event.pointerType === 'touch' || event.pointerType === 'pen';\n // Touch waits a short window so a still finger can press-and-hold\n // before drifting; once the timer fires, any motion past `threshold`\n // begins the drag.\n const initiationDelayOpt = this.options.touchInitiationDelay;\n const initiationDelay = (_a = (typeof initiationDelayOpt === 'function'\n ? initiationDelayOpt()\n : initiationDelayOpt)) !== null && _a !== void 0 ? _a : DEFAULT_TOUCH_INITIATION_DELAY;\n this._armed = !isTouch || initiationDelay <= 0;\n if (isTouch && initiationDelay > 0 && isFinite(initiationDelay)) {\n this._armTimer = setTimeout(() => {\n this._armTimer = undefined;\n this._armed = true;\n }, initiationDelay);\n }\n const threshold = (_b = this.options.threshold) !== null && _b !== void 0 ? _b : DEFAULT_THRESHOLD;\n const pressToleranceOpt = this.options.pressTolerance;\n const pressTolerance = (_c = (typeof pressToleranceOpt === 'function'\n ? pressToleranceOpt()\n : pressToleranceOpt)) !== null && _c !== void 0 ? _c : DEFAULT_PRESS_TOLERANCE;\n // Source's owning window — popout drags fire on their own window.\n const targetWindow = (_e = (_d = this.element.ownerDocument) === null || _d === void 0 ? void 0 : _d.defaultView) !== null && _e !== void 0 ? _e : window;\n this._pendingMoveListener = addDisposableListener(targetWindow, 'pointermove', (moveEvent) => {\n if (moveEvent.pointerId !== this._pendingPointerId) {\n return;\n }\n const dx = moveEvent.clientX - this._startX;\n const dy = moveEvent.clientY - this._startY;\n const distance = Math.hypot(dx, dy);\n if (this._armed) {\n if (distance >= threshold) {\n this._beginDrag(moveEvent);\n }\n return;\n }\n // Pre-arm phase: a flick past `pressTolerance` in any\n // direction is treated as drag intent. The element opts out\n // of native scroll via `touch-action: none`; container-level\n // scrolling lives on the surrounding strip's empty space.\n if (distance > pressTolerance) {\n this._beginDrag(moveEvent);\n }\n });\n this._pendingUpListener = addDisposableListener(targetWindow, 'pointerup', (upEvent) => {\n if (upEvent.pointerId !== this._pendingPointerId) {\n return;\n }\n this._cancelPending();\n });\n this._pendingCancelListener = addDisposableListener(targetWindow, 'pointercancel', (cancelEvent) => {\n if (cancelEvent.pointerId !== this._pendingPointerId) {\n return;\n }\n this._cancelPending();\n });\n }\n /** For sibling gesture detectors (e.g. LongPressDetector) to dismiss a pending drag. */\n cancelPending() {\n this._cancelPending();\n }\n _cancelPending() {\n var _a, _b, _c;\n this._pendingPointerId = undefined;\n if (this._armTimer !== undefined) {\n clearTimeout(this._armTimer);\n this._armTimer = undefined;\n }\n this._armed = false;\n (_a = this._pendingMoveListener) === null || _a === void 0 ? void 0 : _a.dispose();\n (_b = this._pendingUpListener) === null || _b === void 0 ? void 0 : _b.dispose();\n (_c = this._pendingCancelListener) === null || _c === void 0 ? void 0 : _c.dispose();\n this._pendingMoveListener = undefined;\n this._pendingUpListener = undefined;\n this._pendingCancelListener = undefined;\n this._startEvent = undefined;\n }\n _beginDrag(triggerEvent) {\n var _a, _b, _c, _d, _e;\n const startEvent = (_a = this._startEvent) !== null && _a !== void 0 ? _a : triggerEvent;\n this._cancelPending();\n (_c = (_b = this.options).onDragStart) === null || _c === void 0 ? void 0 : _c.call(_b, startEvent);\n const ghost = (_e = (_d = this.options).createGhost) === null || _e === void 0 ? void 0 : _e.call(_d, startEvent);\n PointerDragController.getInstance().beginDrag({\n pointerEvent: triggerEvent,\n source: this.element,\n getData: () => this.options.getData(startEvent),\n ghost,\n onDragMove: this.options.onDragMove,\n onDragEnd: this.options.onDragEnd,\n });\n }\n dispose() {\n this._cancelPending();\n super.dispose();\n }\n}\n\n/**\n * Floating clone that follows the pointer; appended to the owning\n * document's body with `pointer-events: none` so it doesn't intercept\n * hit-testing.\n */\nclass PointerGhost {\n constructor(opts) {\n var _a, _b, _c, _d, _e;\n this._disposed = false;\n this.element = opts.element;\n this.offsetX = (_a = opts.offsetX) !== null && _a !== void 0 ? _a : 0;\n this.offsetY = (_b = opts.offsetY) !== null && _b !== void 0 ? _b : 0;\n // Animate via transform (see update); position:fixed for scroll-independence.\n this.element.style.position = 'fixed';\n this.element.style.left = '0px';\n this.element.style.top = '0px';\n this.element.style.pointerEvents = 'none';\n this.element.style.zIndex = '99999';\n this.element.style.opacity = String((_c = opts.opacity) !== null && _c !== void 0 ? _c : 0.8);\n this.element.style.willChange = 'transform';\n this.element.style.transform = `translate3d(${opts.initialX - this.offsetX}px, ${opts.initialY - this.offsetY}px, 0)`;\n const ownerDocument = (_e = (_d = opts.owner) === null || _d === void 0 ? void 0 : _d.ownerDocument) !== null && _e !== void 0 ? _e : document;\n ownerDocument.body.appendChild(this.element);\n }\n update(clientX, clientY) {\n if (this._disposed) {\n return;\n }\n // translate3d composites on the GPU — no layout per pointermove.\n this.element.style.transform = `translate3d(${clientX - this.offsetX}px, ${clientY - this.offsetY}px, 0)`;\n }\n dispose() {\n if (this._disposed) {\n return;\n }\n this._disposed = true;\n this.element.remove();\n }\n}\n\n/**\n * HTML5 drag source. Listens for the native `dragstart` event, calls\n * `getData` to populate transfer, optionally renders the ghost via\n * `setDragImage`, fires `onDragStart` / `onDragEnd`, and tears down the\n * transfer disposer after `dragend`.\n */\nclass Html5DragSource extends CompositeDisposable {\n constructor(el, opts) {\n super();\n this.el = el;\n this.opts = opts;\n this._dataDisposable = new MutableDisposable();\n this._pointerEventsDisposable = new MutableDisposable();\n this._disabled = !!opts.disabled;\n this.addDisposables(this._dataDisposable, this._pointerEventsDisposable, addDisposableListener(this.el, 'dragstart', (event) => {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\n if (event.defaultPrevented ||\n this._disabled ||\n ((_b = (_a = this.opts).isCancelled) === null || _b === void 0 ? void 0 : _b.call(_a, event))) {\n event.preventDefault();\n return;\n }\n // Iframes capture pointermove once the cursor enters them,\n // which freezes drag tracking from the parent window's\n // POV. Shield the source's owning document so popout-window\n // drags shield the popout, not the main window.\n const iframes = disableIframePointEvents((_c = this.el.ownerDocument) !== null && _c !== void 0 ? _c : document);\n this._pointerEventsDisposable.value = {\n dispose: () => iframes.release(),\n };\n this.el.classList.add('dv-dragged');\n setTimeout(() => this.el.classList.remove('dv-dragged'), 0);\n this._dataDisposable.value = this.opts.getData(event);\n const ghost = (_e = (_d = this.opts).createGhost) === null || _e === void 0 ? void 0 : _e.call(_d, event);\n if (ghost && event.dataTransfer) {\n addGhostImage(event.dataTransfer, ghost.element, {\n x: (_f = ghost.offsetX) !== null && _f !== void 0 ? _f : 0,\n y: (_g = ghost.offsetY) !== null && _g !== void 0 ? _g : 0,\n });\n if (ghost.dispose) {\n // addGhostImage removes the element from the DOM on\n // the next tick; dispose the framework renderer on\n // the same schedule.\n const disposeGhost = ghost.dispose;\n setTimeout(() => disposeGhost(), 0);\n }\n }\n if (event.dataTransfer) {\n event.dataTransfer.effectAllowed = 'move';\n // Some third-party DnD libs (e.g. react-dnd) cancel the\n // dragstart when `dataTransfer.types` is empty.\n if (event.dataTransfer.items.length === 0) {\n event.dataTransfer.setData('text/plain', '');\n }\n }\n (_j = (_h = this.opts).onDragStart) === null || _j === void 0 ? void 0 : _j.call(_h, event);\n }), addDisposableListener(this.el, 'dragend', (event) => {\n var _a, _b;\n this._pointerEventsDisposable.dispose();\n // Defer disposal so drop handlers can still read the\n // transfer payload before it clears.\n setTimeout(() => this._dataDisposable.dispose(), 0);\n (_b = (_a = this.opts).onDragEnd) === null || _b === void 0 ? void 0 : _b.call(_a, event);\n }));\n }\n setDisabled(value) {\n this._disabled = value;\n }\n setTouchOnly(_) {\n // No-op — HTML5 path can't filter by pointer type.\n }\n cancelPending() {\n // No-op — HTML5 has no pre-arm phase to cancel.\n }\n}\nclass Html5DragBackend {\n constructor() {\n this.kind = 'html5';\n }\n createDropTarget(element, options) {\n return new Droptarget(element, options);\n }\n createDragSource(element, options) {\n return new Html5DragSource(element, options);\n }\n}\nclass PointerDragBackend {\n constructor() {\n this.kind = 'pointer';\n }\n createDropTarget(element, options) {\n return new PointerDropTarget(element, options);\n }\n createDragSource(element, options) {\n const pointerCreateGhost = options.createGhost\n ? (event) => {\n const spec = options.createGhost(event);\n if (!spec) {\n return undefined;\n }\n const ghost = new PointerGhost({\n element: spec.element,\n initialX: event.clientX,\n initialY: event.clientY,\n offsetX: spec.offsetX,\n offsetY: spec.offsetY,\n owner: element,\n });\n if (spec.dispose) {\n const baseDispose = ghost.dispose.bind(ghost);\n const disposeSpec = spec.dispose;\n ghost.dispose = () => {\n baseDispose();\n disposeSpec();\n };\n }\n return ghost;\n }\n : undefined;\n const source = new PointerDragSource(element, {\n getData: options.getData,\n isCancelled: options.isCancelled,\n onDragStart: options.onDragStart,\n onDragEnd: options.onDragEnd\n ? (event) => options.onDragEnd(event.pointerEvent)\n : undefined,\n createGhost: pointerCreateGhost,\n touchOnly: options.touchOnly,\n touchInitiationDelay: options.touchInitiationDelay,\n pressTolerance: options.pressTolerance,\n threshold: options.threshold,\n });\n if (options.disabled) {\n source.setDisabled(true);\n }\n return source;\n }\n}\nconst html5Backend = new Html5DragBackend();\nconst pointerBackend = new PointerDragBackend();\n\nconst PROPERTY_KEYS_PANEVIEW = (() => {\n /**\n * by readong the keys from an empty value object TypeScript will error\n * when we add or remove new properties to `DockviewOptions`\n */\n const properties = {\n disableAutoResizing: undefined,\n disableDnd: undefined,\n className: undefined,\n };\n return Object.keys(properties);\n})();\nclass PaneviewUnhandledDragOverEvent extends AcceptableEvent {\n constructor(nativeEvent, position, getData, panel) {\n super();\n this.nativeEvent = nativeEvent;\n this.position = position;\n this.getData = getData;\n this.panel = panel;\n }\n}\n\nclass WillFocusEvent extends DockviewEvent {\n constructor() {\n super();\n }\n}\n/**\n * A core api implementation that should be used across all panel-like objects\n */\nclass PanelApiImpl extends CompositeDisposable {\n get isFocused() {\n return this._isFocused;\n }\n get isActive() {\n return this._isActive;\n }\n get isVisible() {\n return this._isVisible;\n }\n get width() {\n return this._width;\n }\n get height() {\n return this._height;\n }\n constructor(id, component) {\n super();\n this.id = id;\n this.component = component;\n this._isFocused = false;\n this._isActive = false;\n this._isVisible = true;\n this._width = 0;\n this._height = 0;\n this._parameters = {};\n this.panelUpdatesDisposable = new MutableDisposable();\n this._onDidDimensionChange = new Emitter();\n this.onDidDimensionsChange = this._onDidDimensionChange.event;\n this._onDidChangeFocus = new Emitter();\n this.onDidFocusChange = this._onDidChangeFocus.event;\n //\n this._onWillFocus = new Emitter();\n this.onWillFocus = this._onWillFocus.event;\n //\n this._onDidVisibilityChange = new Emitter();\n this.onDidVisibilityChange = this._onDidVisibilityChange.event;\n this._onWillVisibilityChange = new Emitter();\n this.onWillVisibilityChange = this._onWillVisibilityChange.event;\n this._onDidActiveChange = new Emitter();\n this.onDidActiveChange = this._onDidActiveChange.event;\n this._onActiveChange = new Emitter();\n this.onActiveChange = this._onActiveChange.event;\n this._onDidParametersChange = new Emitter();\n this.onDidParametersChange = this._onDidParametersChange.event;\n this.addDisposables(this.onDidFocusChange((event) => {\n this._isFocused = event.isFocused;\n }), this.onDidActiveChange((event) => {\n this._isActive = event.isActive;\n }), this.onDidVisibilityChange((event) => {\n this._isVisible = event.isVisible;\n }), this.onDidDimensionsChange((event) => {\n this._width = event.width;\n this._height = event.height;\n }), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onWillFocus, this._onWillVisibilityChange, this._onDidParametersChange);\n }\n getParameters() {\n return this._parameters;\n }\n initialize(panel) {\n this.panelUpdatesDisposable.value = this._onDidParametersChange.event((parameters) => {\n this._parameters = parameters;\n panel.update({\n params: parameters,\n });\n });\n }\n setVisible(isVisible) {\n this._onWillVisibilityChange.fire({ isVisible });\n }\n setActive() {\n this._onActiveChange.fire();\n }\n updateParameters(parameters) {\n this._onDidParametersChange.fire(parameters);\n }\n}\n\nclass SplitviewPanelApiImpl extends PanelApiImpl {\n //\n constructor(id, component) {\n super(id, component);\n this._onDidConstraintsChangeInternal = new Emitter();\n this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;\n //\n this._onDidConstraintsChange = new Emitter({\n replay: true,\n });\n this.onDidConstraintsChange = this._onDidConstraintsChange.event;\n //\n this._onDidSizeChange = new Emitter();\n this.onDidSizeChange = this._onDidSizeChange.event;\n this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);\n }\n setConstraints(value) {\n this._onDidConstraintsChangeInternal.fire(value);\n }\n setSize(event) {\n this._onDidSizeChange.fire(event);\n }\n}\n\nclass PaneviewPanelApiImpl extends SplitviewPanelApiImpl {\n set pane(pane) {\n this._pane = pane;\n }\n constructor(id, component) {\n super(id, component);\n this._onDidExpansionChange = new Emitter({\n replay: true,\n });\n this.onDidExpansionChange = this._onDidExpansionChange.event;\n this._onMouseEnter = new Emitter({});\n this.onMouseEnter = this._onMouseEnter.event;\n this._onMouseLeave = new Emitter({});\n this.onMouseLeave = this._onMouseLeave.event;\n this.addDisposables(this._onDidExpansionChange, this._onMouseEnter, this._onMouseLeave);\n }\n setExpanded(isExpanded) {\n var _a;\n (_a = this._pane) === null || _a === void 0 ? void 0 : _a.setExpanded(isExpanded);\n }\n get isExpanded() {\n var _a;\n return !!((_a = this._pane) === null || _a === void 0 ? void 0 : _a.isExpanded());\n }\n}\n\nclass BasePanelView extends CompositeDisposable {\n get element() {\n return this._element;\n }\n get width() {\n return this._width;\n }\n get height() {\n return this._height;\n }\n get params() {\n var _a;\n return (_a = this._params) === null || _a === void 0 ? void 0 : _a.params;\n }\n constructor(id, component, api) {\n super();\n this.id = id;\n this.component = component;\n this.api = api;\n this._height = 0;\n this._width = 0;\n this._element = document.createElement('div');\n this._element.tabIndex = -1;\n this._element.style.outline = 'none';\n this._element.style.height = '100%';\n this._element.style.width = '100%';\n this._element.style.overflow = 'hidden';\n const focusTracker = trackFocus(this._element);\n this.addDisposables(this.api, focusTracker.onDidFocus(() => {\n this.api._onDidChangeFocus.fire({ isFocused: true });\n }), focusTracker.onDidBlur(() => {\n this.api._onDidChangeFocus.fire({ isFocused: false });\n }), focusTracker);\n }\n focus() {\n const event = new WillFocusEvent();\n this.api._onWillFocus.fire(event);\n if (event.defaultPrevented) {\n return;\n }\n this._element.focus();\n }\n layout(width, height) {\n this._width = width;\n this._height = height;\n this.api._onDidDimensionChange.fire({ width, height });\n if (this.part) {\n if (this._params) {\n this.part.update(this._params.params);\n }\n }\n }\n init(parameters) {\n this._params = parameters;\n this.part = this.getComponent();\n }\n update(event) {\n var _a, _b;\n // merge the new parameters with the existing parameters\n this._params = Object.assign(Object.assign({}, this._params), { params: Object.assign(Object.assign({}, (_a = this._params) === null || _a === void 0 ? void 0 : _a.params), event.params) });\n /**\n * delete new keys that have a value of undefined,\n * allow values of null\n */\n for (const key of Object.keys(event.params)) {\n if (event.params[key] === undefined) {\n delete this._params.params[key];\n }\n }\n // update the view with the updated props\n (_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this._params.params });\n }\n toJSON() {\n var _a, _b;\n const params = (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {};\n return {\n id: this.id,\n component: this.component,\n params: Object.keys(params).length > 0 ? params : undefined,\n };\n }\n dispose() {\n var _a;\n this.api.dispose();\n (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();\n super.dispose();\n }\n}\n\nclass PaneviewPanel extends BasePanelView {\n set orientation(value) {\n this._orientation = value;\n }\n get orientation() {\n return this._orientation;\n }\n get minimumSize() {\n const headerSize = this.headerSize;\n const expanded = this.isExpanded();\n const minimumBodySize = expanded ? this._minimumBodySize : 0;\n return headerSize + minimumBodySize;\n }\n get maximumSize() {\n const headerSize = this.headerSize;\n const expanded = this.isExpanded();\n const maximumBodySize = expanded ? this._maximumBodySize : 0;\n return headerSize + maximumBodySize;\n }\n get size() {\n return this._size;\n }\n get orthogonalSize() {\n return this._orthogonalSize;\n }\n set orthogonalSize(size) {\n this._orthogonalSize = size;\n }\n get minimumBodySize() {\n return this._minimumBodySize;\n }\n set minimumBodySize(value) {\n this._minimumBodySize = typeof value === 'number' ? value : 0;\n }\n get maximumBodySize() {\n return this._maximumBodySize;\n }\n set maximumBodySize(value) {\n this._maximumBodySize =\n typeof value === 'number' ? value : Number.POSITIVE_INFINITY;\n }\n get headerVisible() {\n return this._headerVisible;\n }\n set headerVisible(value) {\n this._headerVisible = value;\n this.header.style.display = value ? '' : 'none';\n }\n constructor(options) {\n super(options.id, options.component, new PaneviewPanelApiImpl(options.id, options.component));\n this._onDidChangeExpansionState = new Emitter({ replay: true });\n this.onDidChangeExpansionState = this._onDidChangeExpansionState.event;\n this._onDidChange = new Emitter();\n this.onDidChange = this._onDidChange.event;\n this._orthogonalSize = 0;\n this._size = 0;\n this._isExpanded = false;\n this.api.pane = this; // TODO cannot use 'this' before 'super'\n this.api.initialize(this);\n this.headerSize = options.headerSize;\n this.headerComponent = options.headerComponent;\n this._minimumBodySize = options.minimumBodySize;\n this._maximumBodySize = options.maximumBodySize;\n this._isExpanded = options.isExpanded;\n this._headerVisible = options.isHeaderVisible;\n this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value\n this._orientation = options.orientation;\n this.element.classList.add('dv-pane');\n this.addDisposables(this.api.onWillVisibilityChange((event) => {\n const { isVisible } = event;\n const { accessor } = this._params;\n accessor.setVisible(this, isVisible);\n }), this.api.onDidSizeChange((event) => {\n this._onDidChange.fire({ size: event.size });\n }), addDisposableListener(this.element, 'mouseenter', (ev) => {\n this.api._onMouseEnter.fire(ev);\n }), addDisposableListener(this.element, 'mouseleave', (ev) => {\n this.api._onMouseLeave.fire(ev);\n }));\n this.addDisposables(this._onDidChangeExpansionState, this.onDidChangeExpansionState((isPanelExpanded) => {\n this.api._onDidExpansionChange.fire({\n isExpanded: isPanelExpanded,\n });\n }), this.api.onDidFocusChange((e) => {\n if (!this.header) {\n return;\n }\n if (e.isFocused) {\n addClasses(this.header, 'focused');\n }\n else {\n removeClasses(this.header, 'focused');\n }\n }));\n this.renderOnce();\n }\n setVisible(isVisible) {\n this.api._onDidVisibilityChange.fire({ isVisible });\n }\n setActive(isActive) {\n this.api._onDidActiveChange.fire({ isActive });\n }\n isExpanded() {\n return this._isExpanded;\n }\n setExpanded(expanded) {\n if (this._isExpanded === expanded) {\n return;\n }\n this._isExpanded = expanded;\n if (expanded) {\n if (this.animationTimer) {\n clearTimeout(this.animationTimer);\n }\n if (this.body) {\n this.element.appendChild(this.body);\n }\n }\n else {\n this.animationTimer = setTimeout(() => {\n var _a;\n (_a = this.body) === null || _a === void 0 ? void 0 : _a.remove();\n }, 200);\n }\n this._onDidChange.fire(expanded ? { size: this.width } : {});\n this._onDidChangeExpansionState.fire(expanded);\n }\n layout(size, orthogonalSize) {\n this._size = size;\n this._orthogonalSize = orthogonalSize;\n const [width, height] = this.orientation === Orientation.HORIZONTAL\n ? [size, orthogonalSize]\n : [orthogonalSize, size];\n super.layout(width, height);\n }\n init(parameters) {\n var _a, _b;\n super.init(parameters);\n if (typeof parameters.minimumBodySize === 'number') {\n this.minimumBodySize = parameters.minimumBodySize;\n }\n if (typeof parameters.maximumBodySize === 'number') {\n this.maximumBodySize = parameters.maximumBodySize;\n }\n this.bodyPart = this.getBodyComponent();\n this.headerPart = this.getHeaderComponent();\n this.bodyPart.init(Object.assign(Object.assign({}, parameters), { api: this.api }));\n this.headerPart.init(Object.assign(Object.assign({}, parameters), { api: this.api }));\n (_a = this.body) === null || _a === void 0 ? void 0 : _a.append(this.bodyPart.element);\n (_b = this.header) === null || _b === void 0 ? void 0 : _b.append(this.headerPart.element);\n if (typeof parameters.isExpanded === 'boolean') {\n this.setExpanded(parameters.isExpanded);\n }\n }\n toJSON() {\n const params = this._params;\n return Object.assign(Object.assign({}, super.toJSON()), { headerComponent: this.headerComponent, title: params.title });\n }\n renderOnce() {\n this.header = document.createElement('div');\n this.header.tabIndex = 0;\n this.header.className = 'dv-pane-header';\n this.header.style.height = `${this.headerSize}px`;\n this.header.style.lineHeight = `${this.headerSize}px`;\n this.header.style.minHeight = `${this.headerSize}px`;\n this.header.style.maxHeight = `${this.headerSize}px`;\n this.element.appendChild(this.header);\n this.body = document.createElement('div');\n this.body.className = 'dv-pane-body';\n this.element.appendChild(this.body);\n }\n // TODO slightly hacky by-pass of the component to create a body and header component\n getComponent() {\n return {\n update: (params) => {\n var _a, _b;\n (_a = this.bodyPart) === null || _a === void 0 ? void 0 : _a.update({ params });\n (_b = this.headerPart) === null || _b === void 0 ? void 0 : _b.update({ params });\n },\n dispose: () => {\n var _a, _b;\n (_a = this.bodyPart) === null || _a === void 0 ? void 0 : _a.dispose();\n (_b = this.headerPart) === null || _b === void 0 ? void 0 : _b.dispose();\n },\n };\n }\n}\n\nclass DraggablePaneviewPanel extends PaneviewPanel {\n constructor(options) {\n super({\n id: options.id,\n component: options.component,\n headerComponent: options.headerComponent,\n orientation: options.orientation,\n isExpanded: options.isExpanded,\n isHeaderVisible: true,\n headerSize: options.headerSize,\n minimumBodySize: options.minimumBodySize,\n maximumBodySize: options.maximumBodySize,\n });\n this._onDidDrop = new Emitter();\n this.onDidDrop = this._onDidDrop.event;\n this._onUnhandledDragOver = new Emitter();\n this.onUnhandledDragOver = this._onUnhandledDragOver.event;\n this.accessor = options.accessor;\n this.addDisposables(this._onDidDrop, this._onUnhandledDragOver);\n if (!options.disableDnd) {\n this.initDragFeatures();\n }\n }\n initDragFeatures() {\n if (!this.header) {\n return;\n }\n const id = this.id;\n const accessorId = this.accessor.id;\n this.header.draggable = true;\n const sharedDragOptions = {\n getData: () => {\n LocalSelectionTransfer.getInstance().setData([new PaneTransfer(accessorId, id)], PaneTransfer.prototype);\n return {\n dispose: () => {\n LocalSelectionTransfer.getInstance().clearData(PaneTransfer.prototype);\n },\n };\n },\n };\n this.html5DragSource = html5Backend.createDragSource(this.header, sharedDragOptions);\n this.pointerDragSource = pointerBackend.createDragSource(this.header, sharedDragOptions);\n const canDisplayOverlay = (event, position) => {\n const data = getPaneData();\n if (data) {\n if (data.paneId !== this.id &&\n data.viewId === this.accessor.id) {\n return true;\n }\n }\n const firedEvent = new PaneviewUnhandledDragOverEvent(event, position, getPaneData, this);\n this._onUnhandledDragOver.fire(firedEvent);\n return firedEvent.isAccepted;\n };\n const dropTargetOptions = {\n acceptedTargetZones: ['top', 'bottom'],\n overlayModel: {\n activationSize: { type: 'percentage', value: 50 },\n },\n canDisplayOverlay,\n };\n this.target = html5Backend.createDropTarget(this.element, dropTargetOptions);\n this.pointerTarget = pointerBackend.createDropTarget(this.element, dropTargetOptions);\n this.addDisposables(this._onDidDrop, this.html5DragSource, this.pointerDragSource, this.target, this.pointerTarget, this.target.onDrop((event) => {\n this.onDrop(event);\n }), this.pointerTarget.onDrop((event) => {\n this.onDrop(event);\n }));\n }\n onDrop(event) {\n const data = getPaneData();\n if (!data || data.viewId !== this.accessor.id) {\n // if there is no local drag event for this panel\n // or if the drag event was creating by another Paneview instance\n this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, api: new PaneviewApi(this.accessor), getData: getPaneData }));\n return;\n }\n const containerApi = this._params\n .containerApi;\n const panelId = data.paneId;\n const existingPanel = containerApi.getPanel(panelId);\n if (!existingPanel) {\n // if the panel doesn't exist\n this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: getPaneData, api: new PaneviewApi(this.accessor) }));\n return;\n }\n const allPanels = containerApi.panels;\n const fromIndex = allPanels.indexOf(existingPanel);\n let toIndex = containerApi.panels.indexOf(this);\n if (event.position === 'left' || event.position === 'top') {\n toIndex = Math.max(0, toIndex - 1);\n }\n if (event.position === 'right' || event.position === 'bottom') {\n if (fromIndex > toIndex) {\n toIndex++;\n }\n toIndex = Math.min(allPanels.length - 1, toIndex);\n }\n containerApi.movePanel(fromIndex, toIndex);\n }\n}\n\nlet _contentId = 0;\n/** Stable DOM id so each tab's `aria-controls` can reference its tabpanel. */\nconst nextContentId = () => `dv-tabpanel-${_contentId++}`;\nclass ContentContainer extends CompositeDisposable {\n get element() {\n return this._element;\n }\n constructor(accessor, group) {\n var _a, _b, _c, _d, _e, _f, _g;\n super();\n this.accessor = accessor;\n this.group = group;\n this.disposable = new MutableDisposable();\n this._onDidFocus = new Emitter();\n this.onDidFocus = this._onDidFocus.event;\n this._onDidBlur = new Emitter();\n this.onDidBlur = this._onDidBlur.event;\n this._element = document.createElement('div');\n this._element.className = 'dv-content-container';\n this._element.tabIndex = -1;\n // WAI-ARIA Tabs pattern: the single content area per group is the\n // tabpanel; `aria-labelledby` is pointed at the active tab in\n // `setLabelledBy` (driven from the group model on activation).\n this._element.id = nextContentId();\n this._element.setAttribute('role', 'tabpanel');\n this.addDisposables(this._onDidFocus, this._onDidBlur);\n // Resolve the override anchor dynamically: a group can be relocated\n // between roots (grid / floating / popout) after construction, and the\n // popout anchor in particular lives in another window — a value\n // captured here would mount overlays in the wrong window.\n const getOverrideTarget = () => { var _a; return (_a = group.dropTargetContainer) === null || _a === void 0 ? void 0 : _a.model; };\n const canDisplayOverlay = (event, position) => {\n if (this.group.locked === 'no-drop-target' ||\n (this.group.locked && position === 'center')) {\n return false;\n }\n const data = getPanelData();\n if (!data &&\n event.shiftKey &&\n this.group.location.type !== 'floating') {\n return false;\n }\n if (data && data.viewId === this.accessor.id) {\n return true;\n }\n return this.group.canDisplayOverlay(event, position, 'content');\n };\n // `dropTarget` stays the concrete `Droptarget` (not via the backend\n // factory) because overlayRenderContainer forwards HTML5 drag events\n // through `dropTarget.dnd` — that field is not part of `IDropTarget`.\n this.dropTarget = new Droptarget(this.element, {\n getOverlayOutline: () => {\n var _a;\n return ((_a = accessor.options.theme) === null || _a === void 0 ? void 0 : _a.dndPanelOverlay) === 'group'\n ? this.element.parentElement\n : null;\n },\n className: 'dv-drop-target-content',\n acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],\n canDisplayOverlay,\n getOverrideTarget,\n overlayModel: (_b = (_a = this.accessor).resolveDropOverlayModel) === null || _b === void 0 ? void 0 : _b.call(_a, 'content'),\n });\n this.pointerDropTarget = pointerBackend.createDropTarget(this.element, {\n acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],\n canDisplayOverlay,\n getOverlayOutline: () => {\n var _a;\n return ((_a = accessor.options.theme) === null || _a === void 0 ? void 0 : _a.dndPanelOverlay) === 'group'\n ? this.element.parentElement\n : null;\n },\n className: 'dv-drop-target-content',\n getOverrideTarget,\n overlayModel: (_d = (_c = this.accessor).resolveDropOverlayModel) === null || _d === void 0 ? void 0 : _d.call(_c, 'content'),\n });\n this.addDisposables(this.dropTarget, this.pointerDropTarget, \n // Re-apply the app-supplied overlay model when options change.\n // `{}` resets to the built-in default (all fields optional).\n (_g = (_f = (_e = this.accessor).onDidOptionsChange) === null || _f === void 0 ? void 0 : _f.call(_e, () => {\n var _a, _b, _c;\n const model = (_c = (_b = (_a = this.accessor).resolveDropOverlayModel) === null || _b === void 0 ? void 0 : _b.call(_a, 'content')) !== null && _c !== void 0 ? _c : {};\n this.dropTarget.setOverlayModel(model);\n this.pointerDropTarget.setOverlayModel(model);\n })) !== null && _g !== void 0 ? _g : Disposable.NONE);\n }\n show() {\n this.element.style.display = '';\n }\n hide() {\n this.element.style.display = 'none';\n }\n setLabelledBy(tabElementId) {\n if (tabElementId) {\n this._element.setAttribute('aria-labelledby', tabElementId);\n }\n else {\n this._element.removeAttribute('aria-labelledby');\n }\n }\n renderPanel(panel, options = { asActive: true }) {\n var _a, _b, _c, _d;\n const doRender = options.asActive ||\n (this.panel && this.group.isPanelActive(this.panel));\n if (this.panel &&\n this.panel.view.content.element.parentElement === this._element) {\n /**\n * If the currently attached panel is mounted directly to the content then remove it\n */\n this._element.removeChild(this.panel.view.content.element);\n (_b = (_a = this.panel.view.content).onHide) === null || _b === void 0 ? void 0 : _b.call(_a);\n }\n this.panel = panel;\n let container;\n switch (panel.api.renderer) {\n case 'onlyWhenVisible':\n this.group.renderContainer.detatch(panel);\n if (this.panel) {\n if (doRender) {\n this._element.appendChild(this.panel.view.content.element);\n (_d = (_c = this.panel.view.content).onShow) === null || _d === void 0 ? void 0 : _d.call(_c);\n }\n }\n container = this._element;\n break;\n case 'always':\n if (panel.view.content.element.parentElement === this._element) {\n this._element.removeChild(panel.view.content.element);\n }\n container = this.group.renderContainer.attach({\n panel,\n referenceContainer: this,\n });\n break;\n default:\n throw new Error(`dockview: invalid renderer type '${panel.api.renderer}'`);\n }\n if (doRender) {\n const focusTracker = trackFocus(container);\n this.focusTracker = focusTracker;\n const disposable = new CompositeDisposable();\n disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));\n this.disposable.value = disposable;\n }\n }\n openPanel(panel) {\n if (this.panel === panel) {\n return;\n }\n this.renderPanel(panel);\n }\n layout(_width, _height) {\n // noop\n }\n closePanel() {\n var _a, _b, _c;\n if (this.panel) {\n if (this.panel.api.renderer === 'onlyWhenVisible') {\n (_a = this.panel.view.content.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.panel.view.content.element);\n (_c = (_b = this.panel.view.content).onHide) === null || _c === void 0 ? void 0 : _c.call(_b);\n }\n }\n this.panel = undefined;\n }\n dispose() {\n this.disposable.dispose();\n super.dispose();\n }\n /**\n * Refresh the focus tracker state to handle cases where focus state\n * gets out of sync due to programmatic panel activation\n */\n refreshFocusState() {\n var _a;\n if ((_a = this.focusTracker) === null || _a === void 0 ? void 0 : _a.refreshState) {\n this.focusTracker.refreshState();\n }\n }\n}\n\nconst DEFAULT_DELAY = 500;\nconst DEFAULT_TOLERANCE = 8;\n/**\n * Passive — does not consume the pointer; movement past `tolerance`\n * cancels silently so a sibling `PointerDragSource` can take over.\n */\nclass LongPressDetector extends CompositeDisposable {\n constructor(element, options) {\n super();\n this.element = element;\n this.options = options;\n this._startX = 0;\n this._startY = 0;\n this.addDisposables(addDisposableListener(this.element, 'pointerdown', (e) => {\n this._onPointerDown(e);\n }));\n }\n _onPointerDown(event) {\n var _a, _b, _c, _d, _e;\n const touchOnly = (_a = this.options.touchOnly) !== null && _a !== void 0 ? _a : true;\n if (touchOnly &&\n event.pointerType !== 'touch' &&\n event.pointerType !== 'pen') {\n return;\n }\n // Defensive — supersede any in-flight press.\n this._cancelPending();\n this._pointerId = event.pointerId;\n this._startX = event.clientX;\n this._startY = event.clientY;\n const delay = (_b = this.options.delay) !== null && _b !== void 0 ? _b : DEFAULT_DELAY;\n const tolerance = (_c = this.options.tolerance) !== null && _c !== void 0 ? _c : DEFAULT_TOLERANCE;\n // Source's owning window — popout drags fire on their own window.\n const targetWindow = (_e = (_d = this.element.ownerDocument) === null || _d === void 0 ? void 0 : _d.defaultView) !== null && _e !== void 0 ? _e : window;\n this._timer = setTimeout(() => {\n this._timer = undefined;\n this._cancelPending();\n // Touch browsers synthesize a compatibility `contextmenu` event\n // for long-press. preventDefault on the original pointerdown is\n // too late (already dispatched), so install a one-shot\n // capture-phase guard for the next contextmenu. Without this,\n // consumers that don't preventDefault inside their onLongPress\n // (or that early-return before doing so) leak the browser's\n // native menu on top of theirs.\n this._installContextMenuGuard(targetWindow);\n // Same idea for `click`: when the user releases their finger\n // after the long-press, touch browsers dispatch a `click` to\n // the element the touch ended on (the source). Consumers\n // typically wire click to a primary action (e.g. tab activate,\n // tab-group chip collapse-toggle). Without this guard, the\n // long-press immediately fires both the context menu AND the\n // primary action — and the action's side effects (e.g. a chip\n // collapse animation) read as a screen wobble while the menu\n // is supposed to be open. Scoped to the source element so\n // clicks on menu items elsewhere remain effective.\n this._installClickGuard(targetWindow);\n this.options.onLongPress(event);\n }, delay);\n this._moveListener = addDisposableListener(targetWindow, 'pointermove', (moveEvent) => {\n if (moveEvent.pointerId !== this._pointerId) {\n return;\n }\n const dx = moveEvent.clientX - this._startX;\n const dy = moveEvent.clientY - this._startY;\n if (Math.hypot(dx, dy) > tolerance) {\n this._cancelPending();\n }\n });\n this._upListener = addDisposableListener(targetWindow, 'pointerup', (upEvent) => {\n if (upEvent.pointerId !== this._pointerId) {\n return;\n }\n this._cancelPending();\n });\n this._cancelListener = addDisposableListener(targetWindow, 'pointercancel', (cancelEvent) => {\n if (cancelEvent.pointerId !== this._pointerId) {\n return;\n }\n this._cancelPending();\n });\n }\n _installContextMenuGuard(targetWindow) {\n let guard;\n const timeout = setTimeout(() => guard === null || guard === void 0 ? void 0 : guard.dispose(), 500);\n guard = addDisposableListener(targetWindow, 'contextmenu', (event) => {\n event.preventDefault();\n clearTimeout(timeout);\n guard === null || guard === void 0 ? void 0 : guard.dispose();\n }, { capture: true });\n }\n _installClickGuard(targetWindow) {\n let guard;\n const timeout = setTimeout(() => guard === null || guard === void 0 ? void 0 : guard.dispose(), 500);\n guard = addDisposableListener(targetWindow, 'click', (event) => {\n // Only suppress clicks targeted at the long-pressed element\n // or its descendants. A user tap on a context menu item (or\n // anywhere else) still gets through unchanged.\n const target = event.target;\n if (target && this.element.contains(target)) {\n event.preventDefault();\n event.stopPropagation();\n }\n clearTimeout(timeout);\n guard === null || guard === void 0 ? void 0 : guard.dispose();\n }, { capture: true });\n }\n _cancelPending() {\n var _a, _b, _c;\n if (this._timer !== undefined) {\n clearTimeout(this._timer);\n this._timer = undefined;\n }\n this._pointerId = undefined;\n (_a = this._moveListener) === null || _a === void 0 ? void 0 : _a.dispose();\n (_b = this._upListener) === null || _b === void 0 ? void 0 : _b.dispose();\n (_c = this._cancelListener) === null || _c === void 0 ? void 0 : _c.dispose();\n this._moveListener = undefined;\n this._upListener = undefined;\n this._cancelListener = undefined;\n }\n dispose() {\n this._cancelPending();\n super.dispose();\n }\n}\n\nfunction resolveDndCapabilities(options) {\n if (options.disableDnd) {\n return { html5: false, pointer: false, pointerHandlesMouse: false };\n }\n switch (options.dndStrategy) {\n case 'pointer':\n return { html5: false, pointer: true, pointerHandlesMouse: true };\n case 'html5':\n return { html5: true, pointer: false, pointerHandlesMouse: false };\n case 'auto':\n case undefined:\n default:\n // On touch-primary devices (phones / basic tablets) HTML5 DnD's\n // native long-press intercepts the gesture before our pointer\n // backend can react — Android Chrome launches a system drag with\n // its half-transparent thumbnail, and the long-press context menu\n // never opens. Disable HTML5 there so the pointer backend owns\n // every gesture. Hybrid devices (touchscreen laptops, Surface,\n // iPad with mouse) keep both backends — mouse uses HTML5, touch\n // falls back to whichever backend the underlying element wired.\n return isCoarsePrimaryInput$1()\n ? { html5: false, pointer: true, pointerHandlesMouse: true }\n : { html5: true, pointer: true, pointerHandlesMouse: false };\n }\n}\nfunction isCoarsePrimaryInput$1() {\n if (typeof window === 'undefined' || !window.matchMedia) {\n return false;\n }\n // Coarse pointer without any fine pointer = phone-class device. A laptop\n // touchscreen reports both, and we want HTML5 to remain available there\n // because a real mouse is also plugged in.\n const coarse = window.matchMedia('(pointer: coarse)').matches;\n const fine = window.matchMedia('(pointer: fine)').matches;\n return coarse && !fine;\n}\n\nlet _tabId = 0;\n/** Stable DOM id referenced by the tabpanel's `aria-labelledby`. */\nconst nextTabId = () => `dv-tab-${_tabId++}`;\nclass Tab extends CompositeDisposable {\n get element() {\n return this._element;\n }\n constructor(panel, accessor, group) {\n var _a, _b;\n super();\n this.panel = panel;\n this.accessor = accessor;\n this.group = group;\n this.content = undefined;\n this.panelTransfer = LocalSelectionTransfer.getInstance();\n this._direction = 'horizontal';\n this._onPointDown = new Emitter();\n this.onPointerDown = this._onPointDown.event;\n this._onTabClick = new Emitter();\n this.onTabClick = this._onTabClick.event;\n this._onDropped = new Emitter();\n this.onDrop = this._onDropped.event;\n this._onDragStart = new Emitter();\n this.onDragStart = this._onDragStart.event;\n this._onDragEnd = new Emitter();\n this.onDragEnd = this._onDragEnd.event;\n const caps = resolveDndCapabilities(this.accessor.options);\n this._element = document.createElement('div');\n this._element.className = 'dv-tab';\n // Roving tabindex (WAI-ARIA Tabs pattern): only the active tab is in\n // the tab order; `setActive` flips this. Inactive tabs are reachable\n // via arrow keys, handled by the tab strip.\n this._element.tabIndex = -1;\n this._element.draggable = caps.html5;\n // WAI-ARIA Tabs pattern. `aria-controls` points at the group's single\n // tabpanel (the content container); `aria-selected` tracks activation.\n this._element.id = nextTabId();\n this._element.setAttribute('role', 'tab');\n this._element.setAttribute('aria-selected', 'false');\n const contentContainerId = (_b = (_a = this.group) === null || _a === void 0 ? void 0 : _a.model) === null || _b === void 0 ? void 0 : _b.contentContainerId;\n if (contentContainerId) {\n this._element.setAttribute('aria-controls', contentContainerId);\n }\n toggleClass(this.element, 'dv-inactive-tab', true);\n const canDisplayOverlay = (event, position) => {\n var _a;\n if (this.group.locked) {\n return false;\n }\n const data = getPanelData();\n if (data && this.accessor.id === data.viewId) {\n // Smooth-reorder takes over the in-flight visual when active,\n // so individual tab overlays are suppressed for internal drags.\n if (((_a = this.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabAnimation) === 'smooth') {\n return false;\n }\n return true;\n }\n return this.group.model.canDisplayOverlay(event, position, 'tab');\n };\n this.dropTarget = html5Backend.createDropTarget(this._element, {\n acceptedTargetZones: ['left', 'right'],\n overlayModel: this._buildOverlayModel(),\n canDisplayOverlay,\n getOverrideTarget: () => { var _a; return (_a = group.model.dropTargetContainer) === null || _a === void 0 ? void 0 : _a.model; },\n });\n this.pointerDropTarget = pointerBackend.createDropTarget(this._element, {\n acceptedTargetZones: ['left', 'right'],\n overlayModel: this._buildOverlayModel(),\n canDisplayOverlay,\n getOverrideTarget: () => { var _a; return (_a = group.model.dropTargetContainer) === null || _a === void 0 ? void 0 : _a.model; },\n });\n const sharedDragOptions = {\n getData: () => {\n this.panelTransfer.setData([\n new PanelTransfer(this.accessor.id, this.group.id, this.panel.id),\n ], PanelTransfer.prototype);\n return {\n dispose: () => {\n this.panelTransfer.clearData(PanelTransfer.prototype);\n },\n };\n },\n // 30/-10 matches the HTML5 setDragImage offset that has been\n // shipped for years; pointer backend wraps in PointerGhost,\n // HTML5 backend feeds into setDragImage.\n createGhost: () => ({\n element: this._buildGhostElement(),\n offsetX: 30,\n offsetY: -10,\n }),\n onDragStart: (event) => {\n var _a;\n this._onDragStart.fire(event);\n if (!(event instanceof PointerEvent) &&\n ((_a = this.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabAnimation) === 'smooth') {\n // Delay collapse to next frame so the browser\n // captures the full drag image first.\n requestAnimationFrame(() => {\n toggleClass(this.element, 'dv-tab--dragging', true);\n });\n }\n },\n onDragEnd: (event) => {\n this._onDragEnd.fire(event);\n },\n };\n this.html5DragSource = html5Backend.createDragSource(this._element, Object.assign(Object.assign({}, sharedDragOptions), { disabled: !caps.html5 }));\n this.pointerDragSource = pointerBackend.createDragSource(this._element, Object.assign(Object.assign({}, sharedDragOptions), { disabled: !caps.pointer, touchOnly: !caps.pointerHandlesMouse, isCancelled: () => !resolveDndCapabilities(this.accessor.options).pointer }));\n // Both droptargets feed the same downstream stream; consumers don't\n // need to know which path produced the overlay.\n this.onWillShowOverlay = Event.any(this.dropTarget.onWillShowOverlay, this.pointerDropTarget.onWillShowOverlay);\n this.addDisposables(this._onPointDown, this._onTabClick, this._onDropped, this._onDragStart, this._onDragEnd, this.accessor.onDidOptionsChange(() => {\n const model = this._buildOverlayModel();\n this.dropTarget.setOverlayModel(model);\n this.pointerDropTarget.setOverlayModel(model);\n }), addDisposableListener(this._element, 'dragend', () => {\n // The shared onDragEnd handler already fires _onDragEnd via\n // the HTML5 backend; just strip the dragging class here.\n toggleClass(this.element, 'dv-tab--dragging', false);\n }), this.html5DragSource, addDisposableListener(this._element, 'pointerdown', (event) => {\n this._onPointDown.fire(event);\n }), addDisposableListener(this._element, 'click', (event) => {\n this._onTabClick.fire(event);\n }), addDisposableListener(this._element, 'contextmenu', (event) => {\n var _a;\n (_a = this.accessor.contextMenuService) === null || _a === void 0 ? void 0 : _a.show(this.panel, this.group, event);\n }), new LongPressDetector(this._element, {\n onLongPress: (event) => {\n var _a;\n // Don't let a subsequent finger move arm a drag on top\n // of the just-opened menu.\n this.pointerDragSource.cancelPending();\n (_a = this.accessor.contextMenuService) === null || _a === void 0 ? void 0 : _a.show(this.panel, this.group, event);\n },\n }), this.dropTarget.onDrop((event) => {\n this._onDropped.fire(event);\n }), this.pointerDropTarget.onDrop((event) => {\n this._onDropped.fire(event);\n }), this.dropTarget, this.pointerDropTarget, this.pointerDragSource);\n }\n setActive(isActive) {\n toggleClass(this.element, 'dv-active-tab', isActive);\n toggleClass(this.element, 'dv-inactive-tab', !isActive);\n this._element.setAttribute('aria-selected', isActive ? 'true' : 'false');\n // Roving tabindex anchors to the active tab; arrow-key navigation in\n // the tab strip moves the rover from there.\n this._element.tabIndex = isActive ? 0 : -1;\n }\n setContent(part) {\n if (this.content) {\n this._element.removeChild(this.content.element);\n }\n this.content = part;\n this._element.appendChild(this.content.element);\n }\n _buildOverlayModel() {\n var _a, _b, _c;\n // An app-supplied model (the dropOverlayModel option) takes precedence\n // over the theme-derived default for this tab.\n const custom = (_b = (_a = this.accessor).resolveDropOverlayModel) === null || _b === void 0 ? void 0 : _b.call(_a, 'tab', this.group);\n if (custom) {\n return custom;\n }\n // 'line' themes render a 4px insertion strip at the tab edge via the\n // anchor container's small-boundary path. 'fill' themes render a\n // half-width highlighted area, so we disable the small-boundary path\n // entirely (boundary = 0 ⟹ isSmall always false).\n const smallBoundary = ((_c = this.accessor.options.theme) === null || _c === void 0 ? void 0 : _c.dndTabIndicator) === 'line'\n ? Number.POSITIVE_INFINITY\n : 0;\n return {\n activationSize: { value: 50, type: 'percentage' },\n smallWidthBoundary: smallBoundary,\n smallHeightBoundary: smallBoundary,\n };\n }\n setDirection(direction) {\n this._direction = direction;\n const zones = direction === 'vertical' ? ['top', 'bottom'] : ['left', 'right'];\n this.dropTarget.setTargetZones(zones);\n this.pointerDropTarget.setTargetZones(zones);\n }\n updateDragAndDropState() {\n const caps = resolveDndCapabilities(this.accessor.options);\n this._element.draggable = caps.html5;\n this.html5DragSource.setDisabled(!caps.html5);\n this.pointerDragSource.setDisabled(!caps.pointer);\n this.pointerDragSource.setTouchOnly(!caps.pointerHandlesMouse);\n }\n /**\n * Vertical tabs are flipped to horizontal so the ghost stays readable\n * during the drag rather than appearing sideways-rotated.\n */\n _buildGhostElement() {\n const style = getComputedStyle(this.element);\n const newNode = this.element.cloneNode(true);\n const isVertical = this._direction === 'vertical';\n const verticalSkip = new Set([\n 'writing-mode',\n 'inline-size',\n 'block-size',\n 'min-inline-size',\n 'min-block-size',\n 'max-inline-size',\n 'max-block-size',\n 'margin-inline',\n 'margin-inline-start',\n 'margin-inline-end',\n 'margin-block',\n 'margin-block-start',\n 'margin-block-end',\n 'padding-inline',\n 'padding-inline-start',\n 'padding-inline-end',\n 'padding-block',\n 'padding-block-start',\n 'padding-block-end',\n ]);\n Array.from(style).forEach((key) => {\n if (isVertical && verticalSkip.has(key)) {\n return;\n }\n newNode.style.setProperty(key, style.getPropertyValue(key), style.getPropertyPriority(key));\n });\n if (isVertical) {\n newNode.style.setProperty('writing-mode', 'horizontal-tb');\n newNode.style.setProperty('width', style.height);\n newNode.style.setProperty('height', style.width);\n }\n newNode.style.position = 'absolute';\n newNode.classList.add('dv-tab-ghost-drag');\n return newNode;\n }\n}\n\nclass DockviewWillShowOverlayLocationEvent {\n get kind() {\n return this.options.kind;\n }\n /** Narrow with `instanceof DragEvent` before reading `dataTransfer`. */\n get nativeEvent() {\n return this.event.nativeEvent;\n }\n get position() {\n return this.event.position;\n }\n get defaultPrevented() {\n return this.event.defaultPrevented;\n }\n get panel() {\n return this.options.panel;\n }\n get api() {\n return this.options.api;\n }\n get group() {\n return this.options.group;\n }\n preventDefault() {\n this.event.preventDefault();\n }\n getData() {\n return this.options.getData();\n }\n constructor(event, options) {\n this.event = event;\n this.options = options;\n }\n}\n\n// Floating-group redock via touch: require a deliberate long press so the\n// \"move the float around\" gesture doesn't double-trigger the redock ghost.\n// Infinity pressTolerance disables the pre-arm flick override; any motion\n// during the wait is treated as drag-the-float, not redock intent.\nconst FLOATING_REDOCK_INITIATION_DELAY_MS = 500;\n/**\n * The drag-source half of a group drag handle: html5 + pointer drag sources\n * that publish a group-level `PanelTransfer`, the \"Multiple Panels (N)\" ghost,\n * and the floating-group disambiguation that keeps the redock gesture from\n * firing alongside the overlay's move-the-float gesture.\n *\n * Shared by the tab-bar void container and the dedicated floating title bar so\n * both grab handles redock identically.\n */\nclass GroupDragSource extends CompositeDisposable {\n // Resolved lazily so a retargetable handle (the floating title bar) always\n // drags the window's *current* anchor group, not the one captured here.\n get group() {\n return this.groupAccessor();\n }\n constructor(options) {\n var _a, _b, _c;\n super();\n this.panelTransfer = LocalSelectionTransfer.getInstance();\n this._onDragStart = new Emitter();\n this.onDragStart = this._onDragStart.event;\n this._element = options.element;\n this.accessor = options.accessor;\n const group = options.group;\n this.groupAccessor = typeof group === 'function' ? group : () => group;\n this.isFloatingMoveHandle =\n (_a = options.isFloatingMoveHandle) !== null && _a !== void 0 ? _a : (() => true);\n const caps = resolveDndCapabilities(this.accessor.options);\n this._element.draggable = caps.html5;\n toggleClass(this._element, 'dv-draggable', caps.html5 || caps.pointer);\n this.addDisposables(this._onDragStart);\n const buildMultiPanelsGhost = () => {\n const ghostEl = document.createElement('div');\n const style = window.getComputedStyle(this._element);\n const bgColor = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-background-color');\n const color = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-color');\n ghostEl.style.backgroundColor = bgColor;\n ghostEl.style.color = color;\n ghostEl.style.padding = '2px 8px';\n ghostEl.style.height = '24px';\n ghostEl.style.fontSize = '11px';\n ghostEl.style.lineHeight = '20px';\n ghostEl.style.borderRadius = '12px';\n ghostEl.style.whiteSpace = 'nowrap';\n ghostEl.style.boxSizing = 'border-box';\n // HTML5 setDragImage snapshots the element as appended to the\n // document; a default block-level div would stretch to the\n // body's width and render as a viewport-wide bar.\n ghostEl.style.display = 'inline-block';\n ghostEl.textContent = `Multiple Panels (${this.group.size})`;\n return ghostEl;\n };\n const buildGhostSpec = () => {\n var _a, _b;\n // The custom-ghost resolution (createGroupDragGhostComponent) is\n // owned by the AdvancedDnD module; core keeps the default chip and\n // falls back to it when no custom ghost is produced (incl. when\n // the module is absent).\n const customGhost = (_b = (_a = this.accessor).buildGroupDragGhost) === null || _b === void 0 ? void 0 : _b.call(_a, this.group);\n if (customGhost) {\n return customGhost;\n }\n return {\n element: buildMultiPanelsGhost(),\n offsetX: 30,\n offsetY: -10,\n };\n };\n const sharedDragOptions = {\n getData: () => {\n this.panelTransfer.setData([new PanelTransfer(this.accessor.id, this.group.id, null)], PanelTransfer.prototype);\n return {\n dispose: () => {\n this.panelTransfer.clearData(PanelTransfer.prototype);\n },\n };\n },\n createGhost: buildGhostSpec,\n onDragStart: (event) => {\n this._onDragStart.fire(event);\n },\n };\n this.html5DragSource = html5Backend.createDragSource(this._element, Object.assign(Object.assign({}, sharedDragOptions), { disabled: !caps.html5, isCancelled: (event) => {\n // HTML5: when this element is the floating window's move\n // handle, redock needs shift+drag (otherwise click-and-drag\n // conflicts with moving the float). A non-move-handle (e.g. the\n // void container when a title bar moves the float) redocks with\n // a plain drag, like a group in the main grid.\n if (this.group.api.location.type === 'floating' &&\n this.isFloatingMoveHandle() &&\n !event.shiftKey) {\n return true;\n }\n if (this.group.api.location.type === 'edge' &&\n this.group.size === 0) {\n return true;\n }\n return false;\n } }));\n // Only the move handle needs the touch disambiguation; other handles\n // redock with the normal grid press behaviour.\n const isFloating = () => {\n var _a, _b, _c;\n return ((_c = (_b = (_a = this.group) === null || _a === void 0 ? void 0 : _a.api) === null || _b === void 0 ? void 0 : _b.location) === null || _c === void 0 ? void 0 : _c.type) === 'floating' &&\n this.isFloatingMoveHandle();\n };\n this.pointerDragSource = pointerBackend.createDragSource(this._element, Object.assign(Object.assign({}, sharedDragOptions), { disabled: !caps.pointer, touchOnly: !caps.pointerHandlesMouse, \n // Floating groups share this element with the overlay's\n // move-the-float drag. Without a longer hold + tolerance\n // override, both gestures commit simultaneously and the\n // user sees the float follow their finger *and* a ghost.\n touchInitiationDelay: () => isFloating() ? FLOATING_REDOCK_INITIATION_DELAY_MS : 250, pressTolerance: () => (isFloating() ? Infinity : 8), isCancelled: () => {\n if (!resolveDndCapabilities(this.accessor.options).pointer) {\n return true;\n }\n // Pointer: long-press IS the deliberate gesture, so\n // floating groups don't need the shift gate.\n if (this.group.api.location.type === 'edge' &&\n this.group.size === 0) {\n return true;\n }\n return false;\n }, onDragStart: (event) => {\n var _a;\n // Redock just committed — abort any in-flight overlay\n // move so the float stops following the finger while\n // the ghost takes over.\n (_a = this.getFloatingOverlay()) === null || _a === void 0 ? void 0 : _a.cancelPendingDrag();\n this._onDragStart.fire(event);\n } }));\n // Mirror direction: once the overlay's move-the-float gesture has\n // actually moved something, cancel the pending redock arm so the\n // ghost doesn't appear mid-drag if the user holds past 500ms.\n const overlayMoveSub = new MutableDisposable();\n const refreshOverlayMoveSub = () => {\n const overlay = this.getFloatingOverlay();\n overlayMoveSub.value = overlay\n ? overlay.onDidStartMoving(() => {\n this.pointerDragSource.cancelPending();\n })\n : Disposable.NONE;\n };\n refreshOverlayMoveSub();\n this.addDisposables(overlayMoveSub);\n const locationChange = (_c = (_b = this.group) === null || _b === void 0 ? void 0 : _b.api) === null || _c === void 0 ? void 0 : _c.onDidLocationChange;\n if (locationChange) {\n this.addDisposables(locationChange(refreshOverlayMoveSub));\n }\n this.addDisposables(this.html5DragSource, this.pointerDragSource);\n }\n updateDragAndDropState() {\n const caps = resolveDndCapabilities(this.accessor.options);\n this._element.draggable = caps.html5;\n toggleClass(this._element, 'dv-draggable', caps.html5 || caps.pointer);\n this.html5DragSource.setDisabled(!caps.html5);\n this.pointerDragSource.setDisabled(!caps.pointer);\n this.pointerDragSource.setTouchOnly(!caps.pointerHandlesMouse);\n }\n getFloatingOverlay() {\n var _a, _b;\n if (!this.group) {\n return undefined;\n }\n return (_b = (_a = this.accessor.floatingGroups) === null || _a === void 0 ? void 0 : _a.find((fg) => fg.group === this.group)) === null || _b === void 0 ? void 0 : _b.overlay;\n }\n}\n\nclass VoidContainer extends CompositeDisposable {\n get element() {\n return this._element;\n }\n constructor(accessor, group) {\n var _a, _b, _c, _d, _e, _f, _g;\n super();\n this.accessor = accessor;\n this.group = group;\n this._onDrop = new Emitter();\n this.onDrop = this._onDrop.event;\n this._onDragStart = new Emitter();\n this.onDragStart = this._onDragStart.event;\n this._element = document.createElement('div');\n this._element.className = 'dv-void-container';\n this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'pointerdown', () => {\n this.accessor.doSetGroupActive(this.group);\n }), \n // Shift+pointerdown marks the event so the group's overlay\n // drag (move-by-floating) sees it was consumed and doesn't\n // fire alongside the HTML5 drag. quasiPreventDefault sets the\n // marker without calling preventDefault — that would also\n // block dragstart, which we need to fire.\n addDisposableListener(this._element, 'pointerdown', (e) => {\n if (e.shiftKey) {\n quasiPreventDefault(e);\n }\n }, true));\n // The drag-source (move-the-float disambiguation, redock ghost and\n // group-level PanelTransfer) is shared with the floating title bar.\n this.dragSource = new GroupDragSource({\n element: this._element,\n accessor: this.accessor,\n group: this.group,\n // The void container is the float's move handle only when there is\n // no dedicated title bar. When a title bar moves the float (the\n // overlay is `.dv-resize-container-with-titlebar`), the void\n // container redocks with a plain drag, like a group in the grid.\n isFloatingMoveHandle: () => !this._element.closest('.dv-resize-container-with-titlebar'),\n });\n const canDisplayOverlay = (event, position) => {\n if (this.group.api.locked) {\n // Dropping on the void/header space adds the panel\n // to this group, which `locked` is meant to prevent\n // (both `true` and `'no-drop-target'`).\n return false;\n }\n const data = getPanelData();\n if (data && this.accessor.id === data.viewId) {\n return true;\n }\n return group.model.canDisplayOverlay(event, position, 'header_space');\n };\n this.dropTarget = html5Backend.createDropTarget(this._element, {\n acceptedTargetZones: ['center'],\n canDisplayOverlay,\n getOverrideTarget: () => { var _a; return (_a = group.model.dropTargetContainer) === null || _a === void 0 ? void 0 : _a.model; },\n overlayModel: (_b = (_a = this.accessor).resolveDropOverlayModel) === null || _b === void 0 ? void 0 : _b.call(_a, 'header_space', this.group),\n });\n this.pointerDropTarget = pointerBackend.createDropTarget(this._element, {\n acceptedTargetZones: ['center'],\n canDisplayOverlay,\n getOverrideTarget: () => { var _a; return (_a = group.model.dropTargetContainer) === null || _a === void 0 ? void 0 : _a.model; },\n overlayModel: (_d = (_c = this.accessor).resolveDropOverlayModel) === null || _d === void 0 ? void 0 : _d.call(_c, 'header_space', this.group),\n });\n this.onWillShowOverlay = Event.any(this.dropTarget.onWillShowOverlay, this.pointerDropTarget.onWillShowOverlay);\n this.addDisposables(this.dragSource, this.dragSource.onDragStart((event) => {\n this._onDragStart.fire(event);\n }), this.dropTarget.onDrop((event) => {\n this._onDrop.fire(event);\n }), this.pointerDropTarget.onDrop((event) => {\n this._onDrop.fire(event);\n }), this.dropTarget, this.pointerDropTarget, \n // Re-apply the app-supplied overlay model when options change.\n // `{}` resets to the built-in default (all fields optional).\n (_g = (_f = (_e = this.accessor).onDidOptionsChange) === null || _f === void 0 ? void 0 : _f.call(_e, () => {\n var _a, _b, _c;\n const model = (_c = (_b = (_a = this.accessor).resolveDropOverlayModel) === null || _b === void 0 ? void 0 : _b.call(_a, 'header_space', this.group)) !== null && _c !== void 0 ? _c : {};\n this.dropTarget.setOverlayModel(model);\n this.pointerDropTarget.setOverlayModel(model);\n })) !== null && _g !== void 0 ? _g : Disposable.NONE);\n }\n updateDragAndDropState() {\n this.dragSource.updateDragAndDropState();\n }\n}\n\nclass Scrollbar extends CompositeDisposable {\n get element() {\n return this._element;\n }\n get orientation() {\n return this._orientation;\n }\n set orientation(value) {\n if (this._orientation === value) {\n return;\n }\n this._scrollOffset = 0;\n this._orientation = value;\n removeClasses(this._scrollbar, 'dv-scrollbar-vertical', 'dv-scrollbar-horizontal');\n if (value === 'vertical') {\n addClasses(this._scrollbar, 'dv-scrollbar-vertical');\n }\n else {\n addClasses(this._scrollbar, 'dv-scrollbar-horizontal');\n }\n }\n constructor(scrollableElement) {\n super();\n this.scrollableElement = scrollableElement;\n this._scrollOffset = 0;\n this._orientation = 'horizontal';\n this._element = document.createElement('div');\n this._element.className = 'dv-scrollable';\n this._scrollbar = document.createElement('div');\n this._scrollbar.className = 'dv-scrollbar dv-scrollbar-horizontal';\n this.element.appendChild(scrollableElement);\n this.element.appendChild(this._scrollbar);\n this.addDisposables(addDisposableListener(this.element, 'wheel', (event) => {\n this._scrollOffset += event.deltaY * Scrollbar.MouseWheelSpeed;\n this.calculateScrollbarStyles();\n }), addDisposableListener(this._scrollbar, 'pointerdown', (event) => {\n event.preventDefault();\n toggleClass(this.element, 'dv-scrollable-scrolling', true);\n const originalClient = this._orientation === 'horizontal'\n ? event.clientX\n : event.clientY;\n const originalScrollOffset = this._scrollOffset;\n const onPointerMove = (event) => {\n const delta = this._orientation === 'horizontal'\n ? event.clientX - originalClient\n : event.clientY - originalClient;\n const clientSize = this._orientation === 'horizontal'\n ? this.element.clientWidth\n : this.element.clientHeight;\n const scrollSize = this._orientation === 'horizontal'\n ? this.scrollableElement.scrollWidth\n : this.scrollableElement.scrollHeight;\n const p = clientSize / scrollSize;\n this._scrollOffset = originalScrollOffset + delta / p;\n this.calculateScrollbarStyles();\n };\n const onEnd = () => {\n toggleClass(this.element, 'dv-scrollable-scrolling', false);\n document.removeEventListener('pointermove', onPointerMove);\n document.removeEventListener('pointerup', onEnd);\n document.removeEventListener('pointercancel', onEnd);\n };\n document.addEventListener('pointermove', onPointerMove);\n document.addEventListener('pointerup', onEnd);\n document.addEventListener('pointercancel', onEnd);\n }), addDisposableListener(this.element, 'scroll', () => {\n this.calculateScrollbarStyles();\n }), addDisposableListener(this.scrollableElement, 'scroll', () => {\n this._scrollOffset =\n this._orientation === 'horizontal'\n ? this.scrollableElement.scrollLeft\n : this.scrollableElement.scrollTop;\n this.calculateScrollbarStyles();\n }), watchElementResize(this.element, () => {\n toggleClass(this.element, 'dv-scrollable-resizing', true);\n if (this._animationTimer) {\n clearTimeout(this._animationTimer);\n }\n this._animationTimer = setTimeout(() => {\n clearTimeout(this._animationTimer);\n toggleClass(this.element, 'dv-scrollable-resizing', false);\n }, 500);\n this.calculateScrollbarStyles();\n }));\n }\n calculateScrollbarStyles() {\n const clientSize = this._orientation === 'horizontal'\n ? this.element.clientWidth\n : this.element.clientHeight;\n const scrollSize = this._orientation === 'horizontal'\n ? this.scrollableElement.scrollWidth\n : this.scrollableElement.scrollHeight;\n const hasScrollbar = scrollSize > clientSize;\n if (hasScrollbar) {\n const px = clientSize * (clientSize / scrollSize);\n if (this._orientation === 'horizontal') {\n this._scrollbar.style.width = `${px}px`;\n this._scrollbar.style.height = '';\n }\n else {\n this._scrollbar.style.height = `${px}px`;\n this._scrollbar.style.width = '';\n }\n this._scrollOffset = clamp(this._scrollOffset, 0, scrollSize - clientSize);\n if (this._orientation === 'horizontal') {\n this.scrollableElement.scrollLeft = this._scrollOffset;\n }\n else {\n this.scrollableElement.scrollTop = this._scrollOffset;\n }\n const percentageComplete = this._scrollOffset / (scrollSize - clientSize);\n if (this._orientation === 'horizontal') {\n this._scrollbar.style.left = `${(clientSize - px) * percentageComplete}px`;\n this._scrollbar.style.top = '';\n }\n else {\n this._scrollbar.style.top = `${(clientSize - px) * percentageComplete}px`;\n this._scrollbar.style.left = '';\n }\n }\n else {\n if (this._orientation === 'horizontal') {\n this._scrollbar.style.width = '0px';\n this._scrollbar.style.left = '0px';\n }\n else {\n this._scrollbar.style.height = '0px';\n this._scrollbar.style.top = '0px';\n }\n this._scrollOffset = 0;\n }\n }\n}\nScrollbar.MouseWheelSpeed = 1;\n\nconst DEFAULT_TAB_GROUP_COLORS = [\n { id: 'grey', value: 'var(--dv-tab-group-color-grey)', label: 'Grey' },\n { id: 'blue', value: 'var(--dv-tab-group-color-blue)', label: 'Blue' },\n { id: 'red', value: 'var(--dv-tab-group-color-red)', label: 'Red' },\n {\n id: 'yellow',\n value: 'var(--dv-tab-group-color-yellow)',\n label: 'Yellow',\n },\n { id: 'green', value: 'var(--dv-tab-group-color-green)', label: 'Green' },\n { id: 'pink', value: 'var(--dv-tab-group-color-pink)', label: 'Pink' },\n {\n id: 'purple',\n value: 'var(--dv-tab-group-color-purple)',\n label: 'Purple',\n },\n { id: 'cyan', value: 'var(--dv-tab-group-color-cyan)', label: 'Cyan' },\n {\n id: 'orange',\n value: 'var(--dv-tab-group-color-orange)',\n label: 'Orange',\n },\n];\n/**\n * Runtime palette for tab-group color accents.\n *\n * Resolves a stored `color` string to a CSS color expression, with three\n * fall-through modes:\n * 1. `id` matches an entry → entry's `value`\n * 2. `id` doesn't match → `id` itself (raw CSS literal pass-through)\n * 3. `id` is empty or undefined → undefined (caller skips assignment)\n *\n * When `enabled` is false the palette returns undefined for everything; this\n * is the `tabGroupAccent: 'off'` opt-out path.\n */\nclass TabGroupColorPalette {\n constructor(entries, enabled = true) {\n this._entries = entries.slice();\n this._byId = new Map(entries.map((e) => [e.id, e]));\n this._enabled = enabled;\n }\n get enabled() {\n return this._enabled;\n }\n set enabled(value) {\n this._enabled = value;\n }\n /**\n * Replace the entry list in place. Used by `updateOptions` so that\n * existing palette references (held by chips, indicators, etc.) see\n * the new palette without needing to be re-wired.\n */\n setEntries(entries) {\n this._entries = entries.slice();\n this._byId = new Map(entries.map((e) => [e.id, e]));\n }\n entries() {\n return this._entries;\n }\n has(id) {\n return this._byId.has(id);\n }\n get(id) {\n return this._byId.get(id);\n }\n /** First entry's id; used as the default when a color is unset. */\n defaultId() {\n var _a;\n return (_a = this._entries[0]) === null || _a === void 0 ? void 0 : _a.id;\n }\n /**\n * Resolve a stored color to its CSS value, or undefined if no value\n * should be written (palette disabled, or color empty/undefined).\n */\n resolveValue(color) {\n if (!this._enabled || !color) {\n return undefined;\n }\n const entry = this._byId.get(color);\n return entry ? entry.value : color;\n }\n}\nlet _fallbackPalette;\n/**\n * Lazy-built palette used when the accessor isn't available (test mocks,\n * isolated chip construction). Production code paths always pass a real\n * palette through.\n */\nfunction getFallbackPalette() {\n if (!_fallbackPalette) {\n _fallbackPalette = new TabGroupColorPalette(DEFAULT_TAB_GROUP_COLORS, true);\n }\n return _fallbackPalette;\n}\n/**\n * Set the `--dv-tab-group-color` custom property on `el` to the resolved\n * accent value, or remove it when the palette is disabled / color is unset.\n */\nfunction applyTabGroupAccent(el, color, palette) {\n const value = (palette !== null && palette !== void 0 ? palette : getFallbackPalette()).resolveValue(color);\n if (value === undefined) {\n el.style.removeProperty('--dv-tab-group-color');\n }\n else {\n el.style.setProperty('--dv-tab-group-color', value);\n }\n}\n/**\n * Return the resolved CSS color for a tab group, or undefined when the\n * palette is disabled or no color is set. Use this when you need the raw\n * value to assign to a non-custom-property style (e.g. SVG stroke,\n * backgroundColor on the indicator underline).\n */\nfunction resolveTabGroupAccent(color, palette) {\n return (palette !== null && palette !== void 0 ? palette : getFallbackPalette()).resolveValue(color);\n}\n\n/**\n * Visual chip for a tab group. Owns the DOM element, label, click /\n * context-menu interactions, and exposes a long-press gesture as a\n * second `onContextMenu` source. Drag-and-drop wiring lives in\n * `TabGroupManager` — the manager constructs the drag sources on this\n * chip's element so it can include tabs-list context (custom group\n * drag image, tab-group transfer payload).\n */\nclass TabGroupChip extends CompositeDisposable {\n get element() {\n return this._element;\n }\n constructor(_palette) {\n super();\n this._palette = _palette;\n this._onClick = new Emitter();\n this.onClick = this._onClick.event;\n this._onContextMenu = new Emitter();\n /** Fires on right-click and on touch long-press. */\n this.onContextMenu = this._onContextMenu.event;\n this._element = document.createElement('div');\n this._element.className = 'dv-tab-group-chip';\n this._element.tabIndex = 0;\n this._label = document.createElement('span');\n this._label.className = 'dv-tab-group-chip-label';\n this._element.appendChild(this._label);\n this.addDisposables(this._onClick, this._onContextMenu, new LongPressDetector(this._element, {\n onLongPress: (event) => {\n this._onContextMenu.fire(event);\n },\n }), addDisposableListener(this._element, 'click', (event) => {\n this._onClick.fire(event);\n }), addDisposableListener(this._element, 'contextmenu', (event) => {\n this._onContextMenu.fire(event);\n }));\n }\n init(params) {\n this._tabGroup = params.tabGroup;\n this.updateColor(params.tabGroup.color);\n this.updateLabel(params.tabGroup.label);\n this.updateCollapsed(params.tabGroup.collapsed);\n this.addDisposables(params.tabGroup.onDidChange(() => {\n if (this._tabGroup) {\n this.updateColor(this._tabGroup.color);\n this.updateLabel(this._tabGroup.label);\n }\n }), params.tabGroup.onDidCollapseChange((collapsed) => {\n this.updateCollapsed(collapsed);\n }), this._onClick.event(() => {\n var _a;\n (_a = this._tabGroup) === null || _a === void 0 ? void 0 : _a.toggle();\n }));\n }\n update(params) {\n this._tabGroup = params.tabGroup;\n this.updateColor(params.tabGroup.color);\n this.updateLabel(params.tabGroup.label);\n this.updateCollapsed(params.tabGroup.collapsed);\n }\n updateColor(color) {\n var _a;\n applyTabGroupAccent(this._element, color, this._palette);\n toggleClass(this._element, 'dv-tab-group-chip--accent-off', ((_a = this._palette) === null || _a === void 0 ? void 0 : _a.enabled) === false);\n }\n updateLabel(label) {\n this._label.textContent = label;\n toggleClass(this._label, 'dv-tab-group-chip-label--empty', !label);\n }\n updateCollapsed(collapsed) {\n toggleClass(this._element, 'dv-tab-group-chip--collapsed', collapsed);\n }\n}\n\n/**\n * Shared positioning logic for tab group indicators.\n * Subclasses implement `applyShape` to control the visual output.\n */\nclass BaseTabGroupIndicator {\n get underlines() {\n return this._underlines;\n }\n constructor(_ctx) {\n this._ctx = _ctx;\n this._underlines = new Map();\n this._rafId = null;\n }\n positionUnderlines() {\n requestAnimationFrame(() => {\n this._positionUnderlinesSync();\n });\n }\n /**\n * Continuously reposition underlines every frame for the duration\n * of a tab transition (~200ms), so the underline tracks tab sizes.\n */\n trackUnderlines() {\n if (this._rafId !== null) {\n cancelAnimationFrame(this._rafId);\n }\n const start = performance.now();\n const duration = 250; // slightly longer than transition to ensure we catch the end\n const tick = () => {\n this._positionUnderlinesSync();\n if (performance.now() - start < duration) {\n this._rafId = requestAnimationFrame(tick);\n }\n else {\n this._rafId = null;\n }\n };\n this._rafId = requestAnimationFrame(tick);\n }\n syncUnderlineElements(activeGroupIds) {\n // Ensure underline elements exist for active groups\n for (const groupId of activeGroupIds) {\n if (!this._underlines.has(groupId)) {\n const underline = document.createElement('div');\n underline.className = 'dv-tab-group-underline';\n this._ctx.tabsList.appendChild(underline);\n this._underlines.set(groupId, underline);\n }\n }\n // Remove underlines for dissolved groups\n for (const [groupId, el] of this._underlines) {\n if (!activeGroupIds.has(groupId)) {\n el.remove();\n this._underlines.delete(groupId);\n }\n }\n }\n getUnderline(groupId) {\n return this._underlines.get(groupId);\n }\n dispose() {\n if (this._rafId !== null) {\n cancelAnimationFrame(this._rafId);\n this._rafId = null;\n }\n for (const [, el] of this._underlines) {\n el.remove();\n }\n this._underlines.clear();\n }\n _positionUnderlinesSync() {\n const containerRect = this._ctx.tabsList.getBoundingClientRect();\n const tabGroups = this._ctx.getTabGroups();\n const isVertical = this._ctx.getDirection() === 'vertical';\n const containerCrossSize = isVertical\n ? containerRect.width\n : containerRect.height;\n const activePanelId = this._ctx.getActivePanelId();\n const tabMap = this._ctx.getTabMap();\n for (const tg of tabGroups) {\n const underline = this._underlines.get(tg.id);\n if (!underline) {\n continue;\n }\n const panelIds = tg.panelIds;\n if (panelIds.length === 0) {\n underline.style.display = 'none';\n continue;\n }\n underline.style.display = '';\n const chipEl = this._ctx.getChipElement(tg.id);\n // In vertical mode, compute top/bottom edges; in horizontal, left/right.\n let startEdge;\n if (chipEl) {\n const chipRect = chipEl.getBoundingClientRect();\n const chipStyle = getComputedStyle(chipEl);\n const leadingMargin = isVertical\n ? Number.parseFloat(chipStyle.marginTop) || 0\n : Number.parseFloat(chipStyle.marginLeft) || 0;\n startEdge = isVertical\n ? chipRect.top - containerRect.top - leadingMargin\n : chipRect.left - containerRect.left - leadingMargin;\n }\n else {\n const firstPanelId = panelIds[0];\n const firstTabEntry = tabMap.get(firstPanelId);\n if (firstTabEntry) {\n const firstRect = firstTabEntry.value.element.getBoundingClientRect();\n startEdge = isVertical\n ? firstRect.top - containerRect.top\n : firstRect.left - containerRect.left;\n }\n else {\n startEdge = 0;\n }\n }\n // Measure the actual last tab position (follows CSS transitions in real-time)\n const lastPanelId = panelIds[panelIds.length - 1];\n const lastTabEntry = tabMap.get(lastPanelId);\n if (!lastTabEntry) {\n if (isVertical) {\n underline.style.top = `${startEdge}px`;\n underline.style.height = '0px';\n underline.style.left = '';\n underline.style.width = '';\n }\n else {\n underline.style.left = `${startEdge}px`;\n underline.style.width = '0px';\n underline.style.top = '';\n underline.style.height = '';\n }\n continue;\n }\n const lastTabRect = lastTabEntry.value.element.getBoundingClientRect();\n let endEdge = isVertical\n ? lastTabRect.bottom - containerRect.top\n : lastTabRect.right - containerRect.left;\n let span = endEdge - startEdge;\n // During collapse or expand: converge both edges toward chip center\n const isAnimating = tg.collapsed ||\n tg.panelIds.some((pid) => {\n const te = tabMap.get(pid);\n return (te &&\n te.value.element.classList.contains('dv-tab--group-expanding'));\n });\n if (isAnimating && chipEl) {\n const chipRect = chipEl.getBoundingClientRect();\n const chipCenter = isVertical\n ? chipRect.top + chipRect.height / 2 - containerRect.top\n : chipRect.left + chipRect.width / 2 - containerRect.left;\n // Sum of current visible tab sizes (shrinking or growing)\n let currentTabSize = 0;\n let fullTabSize = 0;\n for (const pid of tg.panelIds) {\n const te = tabMap.get(pid);\n if (!te)\n continue;\n const el = te.value.element;\n if (isVertical) {\n currentTabSize += el.getBoundingClientRect().height;\n fullTabSize += el.scrollHeight;\n }\n else {\n currentTabSize += el.getBoundingClientRect().width;\n fullTabSize += el.scrollWidth;\n }\n }\n // progress: 0 when tabs at 0 size, 1 when fully open\n const progress = fullTabSize > 0\n ? Math.min(1, currentTabSize / fullTabSize)\n : 0;\n // Interpolate start and end edges toward chip center\n startEdge = chipCenter + (startEdge - chipCenter) * progress;\n endEdge = chipCenter + (endEdge - chipCenter) * progress;\n span = Math.max(0, endEdge - startEdge);\n }\n if (isVertical) {\n underline.style.top = `${startEdge}px`;\n underline.style.height = `${Math.max(0, span)}px`;\n // Clear horizontal properties\n underline.style.left = '';\n underline.style.width = '';\n }\n else {\n underline.style.left = `${startEdge}px`;\n underline.style.width = `${Math.max(0, span)}px`;\n // Clear vertical properties\n underline.style.top = '';\n underline.style.height = '';\n }\n this.applyShape(underline, tg, startEdge, span, containerCrossSize, activePanelId, containerRect, isVertical);\n }\n }\n}\n/**\n * Chrome-style wrap-around indicator using SVG paths.\n */\nclass WrapTabGroupIndicator extends BaseTabGroupIndicator {\n _applyStraightLine(svg, path, underline, t, mainSize, isVertical) {\n if (isVertical) {\n svg.setAttribute('width', String(t));\n svg.setAttribute('height', String(mainSize));\n underline.style.width = `${t}px`;\n underline.style.height = `${mainSize}px`;\n path.setAttribute('d', `M ${t / 2},0 L ${t / 2},${mainSize}`);\n }\n else {\n svg.setAttribute('width', String(mainSize));\n svg.setAttribute('height', String(t));\n underline.style.width = `${mainSize}px`;\n underline.style.height = `${t}px`;\n path.setAttribute('d', `M 0,${t / 2} L ${mainSize},${t / 2}`);\n }\n }\n /**\n * Chrome-style wrap-around underline: a stroked SVG path that runs\n * along the bottom (or left edge in vertical mode), curving up and\n * over the active tab with rounded corners.\n *\n * The SVG and path elements are created once per underline and reused;\n * only the `d`, `stroke`, and viewport attributes are updated each frame.\n */\n applyShape(underline, tg, groupStart, groupSpan, containerCrossSize, activePanelId, containerRect, isVertical) {\n const t = 2; // line thickness in px\n const crossSize = containerCrossSize;\n const mainSize = groupSpan;\n const color = resolveTabGroupAccent(tg.color, this._ctx.getColorPalette());\n if (mainSize <= 0 || crossSize <= 0 || color === undefined) {\n underline.style.display = 'none';\n return;\n }\n underline.style.display = '';\n // Find the active tab within this group\n let activeTabEntry;\n if (activePanelId && tg.panelIds.includes(activePanelId)) {\n activeTabEntry = this._ctx.getTabMap().get(activePanelId);\n }\n // Ensure SVG + path child exists (created once, reused)\n let svg = underline.firstElementChild;\n let path;\n if (!svg || svg.tagName !== 'svg') {\n underline.replaceChildren();\n svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n svg.style.display = 'block';\n path = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n path.setAttribute('fill', 'none');\n svg.appendChild(path);\n underline.appendChild(svg);\n }\n else {\n path = svg.firstElementChild;\n }\n path.setAttribute('stroke', color);\n path.setAttribute('stroke-width', String(t));\n if (!activeTabEntry) {\n this._applyStraightLine(svg, path, underline, t, mainSize, isVertical);\n return;\n }\n const activeRect = activeTabEntry.value.element.getBoundingClientRect();\n // Compute active tab start/end relative to the group start\n let aStart;\n let aEnd;\n if (isVertical) {\n aStart = Math.max(0, activeRect.top - containerRect.top - groupStart);\n aEnd = Math.min(mainSize, activeRect.bottom - containerRect.top - groupStart);\n }\n else {\n aStart = Math.max(0, activeRect.left - containerRect.left - groupStart);\n aEnd = Math.min(mainSize, activeRect.right - containerRect.left - groupStart);\n }\n if (aEnd <= aStart) {\n this._applyStraightLine(svg, path, underline, t, mainSize, isVertical);\n return;\n }\n const r = 6; // corner radius\n const half = t / 2;\n const headerPosition = this._ctx.getHeaderPosition();\n if (isVertical) {\n const svgW = crossSize;\n const svgH = mainSize;\n svg.setAttribute('width', String(svgW));\n svg.setAttribute('height', String(svgH));\n underline.style.width = `${svgW}px`;\n underline.style.height = `${svgH}px`;\n // right header: indicator on the left edge (invert x sides)\n const isRightHeader = headerPosition === 'right';\n const xNear = isRightHeader ? svgW - half : half;\n const xFar = isRightHeader ? half : svgW - half;\n const cd = isRightHeader ? -1 : 1; // curve direction\n const d = [\n `M ${xNear},0`,\n `L ${xNear},${aStart - r}`,\n `Q ${xNear},${aStart} ${xNear + cd * r},${aStart}`,\n `L ${xFar - cd * r},${aStart}`,\n `Q ${xFar},${aStart} ${xFar},${aStart + r}`,\n `L ${xFar},${aEnd - r}`,\n `Q ${xFar},${aEnd} ${xFar - cd * r},${aEnd}`,\n `L ${xNear + cd * r},${aEnd}`,\n `Q ${xNear},${aEnd} ${xNear},${aEnd + r}`,\n `L ${xNear},${svgH}`,\n ].join(' ');\n path.setAttribute('d', d);\n }\n else {\n const svgW = mainSize;\n const svgH = crossSize;\n svg.setAttribute('width', String(svgW));\n svg.setAttribute('height', String(svgH));\n underline.style.width = `${svgW}px`;\n underline.style.height = `${svgH}px`;\n // bottom header: indicator on the top edge (invert y sides)\n const isBottomHeader = headerPosition === 'bottom';\n const yNear = isBottomHeader ? half : svgH - half;\n const yFar = isBottomHeader ? svgH - half : half;\n const cd = isBottomHeader ? 1 : -1; // curve direction\n const d = [\n `M 0,${yNear}`,\n `L ${aStart - r},${yNear}`,\n `Q ${aStart},${yNear} ${aStart},${yNear + cd * r}`,\n `L ${aStart},${yFar - cd * r}`,\n `Q ${aStart},${yFar} ${aStart + r},${yFar}`,\n `L ${aEnd - r},${yFar}`,\n `Q ${aEnd},${yFar} ${aEnd},${yFar - cd * r}`,\n `L ${aEnd},${yNear + cd * r}`,\n `Q ${aEnd},${yNear} ${aEnd + r},${yNear}`,\n `L ${svgW},${yNear}`,\n ].join(' ');\n path.setAttribute('d', d);\n }\n }\n}\n/**\n * Flat continuous bar indicator — no wrap-around, just a colored line\n * spanning the full tab group width.\n */\nclass NoneTabGroupIndicator extends BaseTabGroupIndicator {\n applyShape(underline, tg, _startEdge, span, _containerCrossSize, _activePanelId, _containerRect, isVertical) {\n const t = 2; // line thickness in px\n const color = resolveTabGroupAccent(tg.color, this._ctx.getColorPalette());\n if (span <= 0 || color === undefined) {\n underline.style.display = 'none';\n return;\n }\n underline.style.display = '';\n // Clear any SVG content left over from a mode switch\n if (underline.firstElementChild) {\n underline.replaceChildren();\n }\n underline.style.backgroundColor = color;\n if (isVertical) {\n underline.style.width = `${t}px`;\n underline.style.height = `${span}px`;\n }\n else {\n underline.style.width = `${span}px`;\n underline.style.height = `${t}px`;\n }\n }\n}\n\nconst EMPTY_MAP = new Map();\nclass TabGroupManager {\n get chipRenderers() {\n return this._chipRenderers;\n }\n get groupUnderlines() {\n var _a, _b;\n return (_b = (_a = this._indicator) === null || _a === void 0 ? void 0 : _a.underlines) !== null && _b !== void 0 ? _b : EMPTY_MAP;\n }\n get skipNextCollapseAnimation() {\n return this._skipNextCollapseAnimation;\n }\n set skipNextCollapseAnimation(value) {\n this._skipNextCollapseAnimation = value;\n }\n constructor(_ctx, _callbacks) {\n this._ctx = _ctx;\n this._callbacks = _callbacks;\n this._chipRenderers = new Map();\n this._indicator = null;\n this._skipNextCollapseAnimation = false;\n this._pendingTransitionCleanups = new Map();\n }\n /**\n * Synchronize chip elements and CSS classes for all tab groups\n * in the parent group model. Call after any tab group mutation.\n */\n update() {\n const model = this._ctx.group.model;\n const tabGroups = model.getTabGroups();\n // Track which group IDs are still active\n const activeGroupIds = new Set();\n for (const tabGroup of tabGroups) {\n activeGroupIds.add(tabGroup.id);\n this._ensureChipForGroup(tabGroup);\n this._positionChipForGroup(tabGroup);\n }\n // Remove chips for dissolved/destroyed groups\n for (const [groupId, entry] of this._chipRenderers) {\n if (!activeGroupIds.has(groupId)) {\n entry.chip.element.remove();\n entry.chip.dispose();\n entry.disposable.dispose();\n this._chipRenderers.delete(groupId);\n }\n }\n // Update CSS classes on all tabs\n this._updateTabGroupClasses();\n }\n /**\n * Re-read the active palette and re-apply colors to chips, tabs and\n * the indicator. Called when `tabGroupColors` / `tabGroupAccent`\n * options change at runtime.\n */\n refreshAccents() {\n var _a, _b;\n for (const tabGroup of this._ctx.group.model.getTabGroups()) {\n const entry = this._chipRenderers.get(tabGroup.id);\n (_b = entry === null || entry === void 0 ? void 0 : (_a = entry.chip).update) === null || _b === void 0 ? void 0 : _b.call(_a, { tabGroup });\n }\n this._updateTabGroupClasses();\n }\n positionAllChips() {\n if (this._chipRenderers.size === 0) {\n return;\n }\n for (const tabGroup of this._ctx.group.model.getTabGroups()) {\n this._positionChipForGroup(tabGroup);\n }\n }\n updateDirection() {\n const isVertical = this._ctx.getDirection() === 'vertical';\n for (const [, entry] of this._chipRenderers) {\n entry.dropTarget.setTargetZones(isVertical ? ['top'] : ['left']);\n }\n }\n snapshotChipWidths() {\n const widths = new Map();\n for (const [groupId, entry] of this._chipRenderers) {\n widths.set(groupId, entry.chip.element.getBoundingClientRect().width);\n }\n return widths;\n }\n positionUnderlines() {\n var _a;\n (_a = this._indicator) === null || _a === void 0 ? void 0 : _a.positionUnderlines();\n }\n trackUnderlines() {\n var _a;\n (_a = this._indicator) === null || _a === void 0 ? void 0 : _a.trackUnderlines();\n }\n setGroupDragImage(event, tabGroup, chipEl) {\n if (!event.dataTransfer) {\n return;\n }\n const isVertical = this._ctx.getDirection() === 'vertical';\n // Clone the entire tabs list so cloned nodes inherit all\n // theme styles, CSS variables and class-based rules.\n const clone = this._ctx.tabsList.cloneNode(true);\n if (isVertical) {\n // Force horizontal orientation for the drag ghost by\n // removing vertical CSS classes and overriding writing-mode.\n clone.classList.remove('dv-tabs-container-vertical', 'dv-vertical');\n clone.classList.add('dv-horizontal');\n clone.style.writingMode = 'horizontal-tb';\n clone.style.height = `${this._ctx.tabsList.offsetWidth}px`;\n }\n else {\n clone.style.height = `${this._ctx.tabsList.offsetHeight}px`;\n }\n clone.style.width = 'auto';\n clone.style.overflow = 'visible';\n clone.style.pointerEvents = 'none';\n // Remove all elements except the chip so the drag ghost\n // shows only the chip regardless of the group's expanded state.\n const children = Array.from(clone.children);\n const realChildren = Array.from(this._ctx.tabsList.children);\n for (let i = children.length - 1; i >= 0; i--) {\n const real = realChildren[i];\n if (real === chipEl) {\n continue; // keep the chip only\n }\n children[i].remove();\n }\n // Wrap the clone in a minimal ancestor chain so that CSS\n // selectors like `.dv-groupview.dv-active-group > .dv-tabs-and-actions-container .dv-tabs-container > .dv-tab`\n // match the cloned tabs and apply correct color/background.\n const wrapper = document.createElement('div');\n wrapper.className = 'dv-groupview dv-active-group';\n wrapper.style.position = 'fixed';\n wrapper.style.top = '-10000px';\n wrapper.style.left = '0px';\n wrapper.style.height = 'auto';\n wrapper.style.width = 'auto';\n wrapper.style.pointerEvents = 'none';\n const actionsWrapper = document.createElement('div');\n actionsWrapper.className = 'dv-tabs-and-actions-container';\n actionsWrapper.style.height = 'auto';\n actionsWrapper.style.width = 'auto';\n wrapper.appendChild(actionsWrapper);\n actionsWrapper.appendChild(clone);\n // Append inside the dockview root so CSS variables are inherited\n this._ctx.accessor.element.appendChild(wrapper);\n // Compute cursor offset relative to the wrapper element.\n // The cloned chip is the first .dv-tab-group-chip in the clone.\n const clonedChip = clone.querySelector('.dv-tab-group-chip');\n const chipRect = chipEl.getBoundingClientRect();\n const cursorInChipX = event.clientX - chipRect.left;\n const cursorInChipY = event.clientY - chipRect.top;\n if (clonedChip) {\n const clonedChipRect = clonedChip.getBoundingClientRect();\n const wrapperRect = wrapper.getBoundingClientRect();\n const offsetX = clonedChipRect.left - wrapperRect.left + cursorInChipX;\n const offsetY = clonedChipRect.top - wrapperRect.top + cursorInChipY;\n event.dataTransfer.setDragImage(wrapper, offsetX, offsetY);\n }\n else {\n event.dataTransfer.setDragImage(wrapper, cursorInChipX, cursorInChipY);\n }\n // Clean up after the browser captures the image\n requestAnimationFrame(() => {\n wrapper.remove();\n });\n }\n cleanupTransition(panelId) {\n var _a;\n (_a = this._pendingTransitionCleanups.get(panelId)) === null || _a === void 0 ? void 0 : _a();\n this._pendingTransitionCleanups.delete(panelId);\n }\n updateDragAndDropState() {\n const caps = resolveDndCapabilities(this._ctx.accessor.options);\n for (const entry of this._chipRenderers.values()) {\n entry.chip.element.draggable = caps.html5;\n entry.html5DragSource.setDisabled(!caps.html5);\n entry.pointerDragSource.setDisabled(!caps.pointer);\n entry.pointerDragSource.setTouchOnly(!caps.pointerHandlesMouse);\n }\n }\n /**\n * Synchronously dispose the chip drag sources for an in-flight chip\n * drag. Called from `_commitGroupMove` so the transfer payload +\n * iframe shield are released BEFORE the cross-group move detaches\n * the chip (chip dispose is scheduled on a microtask via\n * `_scheduleTabGroupUpdate`, which is too late for callers that read\n * `getPanelData()` synchronously after the move). Idempotent — the\n * subsequent `update()` will also dispose the sources.\n */\n disposeChipDrag(tabGroupId) {\n var _a, _b;\n const entry = this._chipRenderers.get(tabGroupId);\n if (!entry) {\n return;\n }\n // Optional-chained because tests may inject minimal entries\n // that skip the manager's normal `_ensureChipForGroup` flow.\n (_a = entry.html5DragSource) === null || _a === void 0 ? void 0 : _a.dispose();\n (_b = entry.pointerDragSource) === null || _b === void 0 ? void 0 : _b.dispose();\n }\n /** Cloned chip rect used as the pointer follow-finger ghost. */\n _buildChipGhostElement(chipEl) {\n const style = getComputedStyle(chipEl);\n const clone = chipEl.cloneNode(true);\n Array.from(style).forEach((key) => {\n clone.style.setProperty(key, style.getPropertyValue(key), style.getPropertyPriority(key));\n });\n clone.style.position = 'absolute';\n return clone;\n }\n disposeAll() {\n var _a;\n (_a = this._indicator) === null || _a === void 0 ? void 0 : _a.dispose();\n this._indicator = null;\n for (const [, cleanup] of this._pendingTransitionCleanups) {\n cleanup();\n }\n this._pendingTransitionCleanups.clear();\n for (const [, entry] of this._chipRenderers) {\n entry.chip.element.remove();\n entry.chip.dispose();\n entry.disposable.dispose();\n }\n this._chipRenderers.clear();\n }\n _ensureIndicator() {\n var _a, _b;\n const mode = (_b = (_a = this._ctx.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabGroupIndicator) !== null && _b !== void 0 ? _b : 'wrap';\n const Ctor = mode === 'none' ? NoneTabGroupIndicator : WrapTabGroupIndicator;\n // Re-create if the indicator type changed (e.g. theme switch)\n if (this._indicator && !(this._indicator instanceof Ctor)) {\n this._indicator.dispose();\n this._indicator = null;\n }\n if (!this._indicator) {\n this._indicator = new Ctor({\n tabsList: this._ctx.tabsList,\n getTabGroups: () => this._ctx.group.model.getTabGroups(),\n getActivePanelId: () => { var _a; return (_a = this._ctx.group.activePanel) === null || _a === void 0 ? void 0 : _a.id; },\n getTabMap: () => this._ctx.getTabMap(),\n getChipElement: (id) => { var _a; return (_a = this._chipRenderers.get(id)) === null || _a === void 0 ? void 0 : _a.chip.element; },\n getDirection: () => this._ctx.getDirection(),\n getHeaderPosition: () => this._ctx.group.model.headerPosition,\n getColorPalette: () => this._ctx.accessor.tabGroupColorPalette,\n });\n }\n }\n _ensureChipForGroup(tabGroup) {\n if (this._chipRenderers.has(tabGroup.id)) {\n return;\n }\n const createChip = this._ctx.accessor.options.createTabGroupChipComponent;\n const chip = createChip\n ? createChip(tabGroup)\n : new TabGroupChip(this._ctx.accessor.tabGroupColorPalette);\n chip.init({ tabGroup, api: this._ctx.accessor.api });\n const caps = resolveDndCapabilities(this._ctx.accessor.options);\n chip.element.draggable = caps.html5;\n const panelTransfer = LocalSelectionTransfer.getInstance();\n // Shared `getData` for both backends. Sets a group-level\n // PanelTransfer (panelId=null, tabGroupId identifies the group).\n // The returned disposer clears it on drag end.\n const getData = () => {\n panelTransfer.setData([\n new PanelTransfer(this._ctx.accessor.id, this._ctx.group.id, null, tabGroup.id),\n ], PanelTransfer.prototype);\n return {\n dispose: () => {\n panelTransfer.clearData(PanelTransfer.prototype);\n },\n };\n };\n // The chip's HTML5 drag image is the cloned tabs list (chip only),\n // mounted inside the dockview root for CSS-variable inheritance and\n // positioned against the chip's in-place rect. Layout-dependent\n // offset means we set the drag image directly in `onDragStart`\n // (inside the dragstart handler) rather than via the generic\n // `createGhost` factory, which only knows about ghost specs that\n // can be appended to `document.body`.\n const html5DragSource = html5Backend.createDragSource(chip.element, {\n getData,\n disabled: !caps.html5,\n isCancelled: () => !resolveDndCapabilities(this._ctx.accessor.options).html5,\n onDragStart: (event) => {\n // Type guard via `dataTransfer` — `instanceof DragEvent`\n // would throw in jsdom which doesn't ship a DragEvent\n // constructor.\n if ('dataTransfer' in event && event.dataTransfer) {\n this.setGroupDragImage(event, tabGroup, chip.element);\n }\n this._callbacks.onChipDragStart(tabGroup, chip, event);\n },\n onDragEnd: (event) => {\n var _a, _b;\n (_b = (_a = this._callbacks).onChipDragEnd) === null || _b === void 0 ? void 0 : _b.call(_a, tabGroup, chip, event);\n },\n });\n // Synchronous panelTransfer cleanup directly on the chip element.\n // `Html5DragSource`'s dragend defers data disposal via `setTimeout(0)`\n // so drop handlers can read the payload — but a chip drag that\n // ends via `moveGroupOrPanel` (no actual drop event) needs the\n // singleton cleared immediately, otherwise a synchronous\n // `getPanelData()` after the move still sees the stale chip\n // payload. Attached directly (not via `addDisposableListener`) so\n // the listener survives chip disposal in the detach-then-dragend\n // cross-group path; `once: true` auto-removes after the single\n // dragend that we care about. (#1254)\n chip.element.addEventListener('dragend', () => {\n panelTransfer.clearData(PanelTransfer.prototype);\n }, { once: true });\n const pointerDragSource = pointerBackend.createDragSource(chip.element, {\n getData,\n disabled: !caps.pointer,\n touchOnly: !caps.pointerHandlesMouse,\n isCancelled: () => !resolveDndCapabilities(this._ctx.accessor.options).pointer,\n createGhost: () => ({\n element: this._buildChipGhostElement(chip.element),\n offsetX: 8,\n offsetY: 8,\n }),\n onDragStart: (event) => {\n this._callbacks.onChipDragStart(tabGroup, chip, event);\n },\n });\n const disposables = [\n tabGroup.onDidChange(() => {\n var _a;\n (_a = chip.update) === null || _a === void 0 ? void 0 : _a.call(chip, { tabGroup });\n this._updateTabGroupClasses();\n }),\n tabGroup.onDidPanelChange(() => {\n this._positionChipForGroup(tabGroup);\n this._updateTabGroupClasses();\n }),\n tabGroup.onDidCollapseChange(() => {\n this._updateTabGroupClasses();\n }),\n html5DragSource,\n pointerDragSource,\n ];\n // Context menu: built-in TabGroupChip already aggregates right-click\n // + touch long-press into `onContextMenu`. Custom chip renderers\n // don't, so attach a long-press detector and contextmenu listener\n // directly on their element.\n const onContextMenu = (event) => {\n // A long-press on a chip should preempt the in-flight pointer\n // drag and open the menu instead.\n pointerDragSource.cancelPending();\n this._callbacks.onChipContextMenu(tabGroup, event);\n };\n if (chip instanceof TabGroupChip) {\n disposables.push(chip.onContextMenu(onContextMenu));\n }\n else {\n disposables.push(new LongPressDetector(chip.element, {\n onLongPress: onContextMenu,\n }), addDisposableListener(chip.element, 'contextmenu', onContextMenu));\n }\n // The chip sits before its group's first tab in the DOM, so it\n // covers the \"drop before the group\" position. Without a drop\n // target here, dropping a tab over the chip is a dead zone —\n // particularly visible when the group is first in the tabs list\n // and there's no preceding tab whose right zone covers position 0.\n // The smooth animation path already shifts the chip's margin to\n // open a gap, so suppress the overlay in that mode.\n const isVertical = this._ctx.getDirection() === 'vertical';\n const dropTarget = new Droptarget(chip.element, {\n acceptedTargetZones: isVertical ? ['top'] : ['left'],\n overlayModel: {\n activationSize: { value: 100, type: 'percentage' },\n },\n canDisplayOverlay: (event, position) => {\n var _a;\n if (this._ctx.group.locked) {\n return false;\n }\n if (this._ctx.accessor.options.disableDnd) {\n return false;\n }\n const data = getPanelData();\n if (data && this._ctx.accessor.id === data.viewId) {\n if (((_a = this._ctx.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabAnimation) ===\n 'smooth') {\n return false;\n }\n return true;\n }\n return this._ctx.group.model.canDisplayOverlay(event, position, 'tab');\n },\n });\n disposables.push(dropTarget, dropTarget.onDrop((event) => {\n this._callbacks.onChipDrop(tabGroup, event);\n }));\n const disposable = new CompositeDisposable(...disposables);\n this._chipRenderers.set(tabGroup.id, {\n chip,\n html5DragSource,\n pointerDragSource,\n disposable,\n dropTarget,\n });\n // Group is born collapsed (cross-group drop, layout restore, etc.):\n // its tabs are about to be added without the collapsed class. Skip\n // the animation in the upcoming _updateTabGroupClasses call so they\n // apply the class instantly instead of transitioning from expanded.\n if (tabGroup.collapsed) {\n this._skipNextCollapseAnimation = true;\n }\n }\n _positionChipForGroup(tabGroup) {\n const entry = this._chipRenderers.get(tabGroup.id);\n if (!entry) {\n return;\n }\n const chipEl = entry.chip.element;\n const panelIds = tabGroup.panelIds;\n if (panelIds.length === 0) {\n chipEl.remove();\n return;\n }\n // Find the first tab element of this group\n const firstPanelId = panelIds[0];\n const firstTabEntry = this._ctx.getTabMap().get(firstPanelId);\n if (!firstTabEntry) {\n chipEl.remove();\n return;\n }\n // Insert chip before the first tab of the group\n const firstTabEl = firstTabEntry.value.element;\n if (chipEl.nextSibling !== firstTabEl) {\n this._ctx.tabsList.insertBefore(chipEl, firstTabEl);\n }\n }\n _updateTabGroupClasses() {\n var _a;\n const model = this._ctx.group.model;\n const tabGroups = model.getTabGroups();\n const tabs = this._ctx.getTabs();\n const tabMap = this._ctx.getTabMap();\n let hasAnimation = false;\n // Build a lookup: panelId → tabGroup\n const panelGroupMap = new Map();\n for (const tg of tabGroups) {\n for (const pid of tg.panelIds) {\n panelGroupMap.set(pid, tg);\n }\n }\n for (const tabEntry of tabs) {\n const tab = tabEntry.value;\n const panelId = tab.panel.id;\n const tg = panelGroupMap.get(panelId);\n const isGrouped = !!tg;\n toggleClass(tab.element, 'dv-tab--grouped', isGrouped);\n if (tg) {\n const ids = tg.panelIds;\n const isFirst = ids[0] === panelId;\n const isLast = ids[ids.length - 1] === panelId;\n toggleClass(tab.element, 'dv-tab--group-first', isFirst);\n toggleClass(tab.element, 'dv-tab--group-last', isLast);\n // Expose the resolved group color as a CSS custom property\n // so pure-CSS themes can use it for borders, backgrounds, etc.\n applyTabGroupAccent(tab.element, tg.color, this._ctx.accessor.tabGroupColorPalette);\n // Collapse / expand with animation\n const isCollapsed = tab.element.classList.contains('dv-tab--group-collapsed');\n if (!tg.collapsed && isCollapsed) {\n // Collapsed → expanding: animate back\n hasAnimation = true;\n tab.element.classList.remove('dv-tab--group-collapsed');\n tab.element.classList.add('dv-tab--group-expanding');\n // Clean up any previous transitionend listener\n // from a rapid collapse/expand cycle\n (_a = this._pendingTransitionCleanups.get(panelId)) === null || _a === void 0 ? void 0 : _a();\n const onEnd = () => {\n tab.element.classList.remove('dv-tab--group-expanding');\n tab.element.style.removeProperty('width');\n tab.element.removeEventListener('transitionend', onEnd);\n clearTimeout(fallbackTimer);\n this._pendingTransitionCleanups.delete(panelId);\n };\n // Fallback in case transitionend never fires\n // (e.g. element removed from DOM mid-transition)\n const fallbackTimer = setTimeout(onEnd, 300);\n this._pendingTransitionCleanups.set(panelId, onEnd);\n tab.element.addEventListener('transitionend', onEnd);\n }\n }\n else {\n toggleClass(tab.element, 'dv-tab--group-first', false);\n toggleClass(tab.element, 'dv-tab--group-last', false);\n tab.element.classList.remove('dv-tab--group-collapsed', 'dv-tab--group-expanding');\n tab.element.style.removeProperty('width');\n tab.element.style.removeProperty('--dv-tab-group-color');\n }\n }\n // Track active group IDs for underline/collapse handling\n const activeGroupIds = new Set();\n // Handle collapse animation per group\n for (const tg of tabGroups) {\n activeGroupIds.add(tg.id);\n // Collapse animation\n const hasNewCollapse = tg.collapsed &&\n tg.panelIds.some((pid) => {\n const te = tabMap.get(pid);\n return (te &&\n !te.value.element.classList.contains('dv-tab--group-collapsed'));\n });\n if (hasNewCollapse) {\n if (this._skipNextCollapseAnimation) {\n // Apply collapsed state instantly (no animation).\n // Disable transitions so the CSS transition on\n // dv-tab--group-collapsed doesn't fire.\n const affected = [];\n for (const pid of tg.panelIds) {\n const te = tabMap.get(pid);\n if (te) {\n te.value.element.style.transition = 'none';\n te.value.element.classList.add('dv-tab--group-collapsed');\n affected.push(te.value.element);\n }\n }\n if (affected.length > 0) {\n void affected[0].offsetHeight; // single reflow\n for (const el of affected) {\n el.style.removeProperty('transition');\n }\n }\n }\n else {\n hasAnimation = true;\n const isVert = this._ctx.getDirection() === 'vertical';\n for (const pid of tg.panelIds) {\n const te = tabMap.get(pid);\n if (te &&\n !te.value.element.classList.contains('dv-tab--group-collapsed')) {\n const rect = te.value.element.getBoundingClientRect();\n if (isVert) {\n te.value.element.style.height = `${rect.height}px`;\n }\n else {\n te.value.element.style.width = `${rect.width}px`;\n }\n void te.value.element.offsetHeight; // force reflow\n te.value.element.classList.add('dv-tab--group-collapsed');\n }\n }\n }\n }\n }\n this._skipNextCollapseAnimation = false;\n // Sync indicator underlines and position them\n this._ensureIndicator();\n if (this._indicator) {\n this._indicator.syncUnderlineElements(activeGroupIds);\n if (hasAnimation) {\n this._indicator.trackUnderlines();\n }\n else {\n this._indicator.positionUnderlines();\n }\n }\n }\n}\n\nclass Tabs extends CompositeDisposable {\n get showTabsOverflowControl() {\n return this._showTabsOverflowControl;\n }\n set showTabsOverflowControl(value) {\n if (this._showTabsOverflowControl == value) {\n return;\n }\n this._showTabsOverflowControl = value;\n if (value) {\n const observer = new OverflowObserver(this._tabsList);\n this._observerDisposable.value = new CompositeDisposable(observer, observer.onDidChange((event) => {\n const hasOverflow = event.hasScrollX || event.hasScrollY;\n this.toggleDropdown({ reset: !hasOverflow });\n if (this._tabGroupManager.groupUnderlines.size > 0) {\n this._tabGroupManager.positionUnderlines();\n }\n }), addDisposableListener(this._tabsList, 'scroll', () => {\n this.toggleDropdown({ reset: false });\n if (this._tabGroupManager.groupUnderlines.size > 0) {\n this._tabGroupManager.positionUnderlines();\n }\n }));\n }\n }\n get element() {\n return this._element;\n }\n set voidContainer(el) {\n var _a;\n (_a = this._voidContainerListeners) === null || _a === void 0 ? void 0 : _a.dispose();\n this._voidContainerListeners = null;\n this._voidContainer = el;\n if (el) {\n this._voidContainerListeners = new CompositeDisposable(addDisposableListener(el, 'dragover', (event) => {\n if (this._animState) {\n event.preventDefault();\n }\n }), addDisposableListener(el, 'drop', (event) => {\n var _a;\n if (((_a = this._animState) === null || _a === void 0 ? void 0 : _a.sourceTabGroupId) &&\n this._animState.currentInsertionIndex !== null) {\n event.preventDefault();\n event.stopPropagation();\n this.handleVoidDrop();\n }\n }));\n }\n }\n /**\n * Handle a drop that occurred on the void container (empty header\n * space to the right of the tabs). Returns `true` if the drop was\n * consumed by an active group drag, `false` otherwise.\n */\n handleVoidDrop() {\n var _a, _b;\n if (!((_a = this._animState) === null || _a === void 0 ? void 0 : _a.sourceTabGroupId)) {\n return false;\n }\n const sourceTabGroupId = this._animState.sourceTabGroupId;\n const insertionIndex = (_b = this._animState.currentInsertionIndex) !== null && _b !== void 0 ? _b : this._tabs.length;\n this._animState = null;\n this._commitGroupMove(sourceTabGroupId, insertionIndex);\n return true;\n }\n get panels() {\n return this._tabs.map((_) => _.value.panel.id);\n }\n get size() {\n return this._tabs.length;\n }\n get tabs() {\n return this._tabs.map((_) => _.value);\n }\n get direction() {\n return this._direction;\n }\n set direction(value) {\n if (this._direction === value) {\n return;\n }\n this._direction = value;\n this._tabsList.setAttribute('aria-orientation', value === 'vertical' ? 'vertical' : 'horizontal');\n if (this._scrollbar) {\n this._scrollbar.orientation = value;\n }\n removeClasses(this._tabsList, 'dv-horizontal', 'dv-vertical');\n if (value === 'vertical') {\n addClasses(this._tabsList, 'dv-tabs-container-vertical', 'dv-vertical');\n }\n else {\n removeClasses(this._tabsList, 'dv-tabs-container-vertical');\n addClasses(this._tabsList, 'dv-horizontal');\n }\n for (const tab of this._tabs) {\n tab.value.setDirection(value);\n }\n this._tabGroupManager.updateDirection();\n }\n constructor(group, accessor, options) {\n super();\n this.group = group;\n this.accessor = accessor;\n this._observerDisposable = new MutableDisposable();\n this._scrollbar = null;\n this._tabs = [];\n this._tabMap = new Map();\n this.selectedIndex = -1;\n this._showTabsOverflowControl = false;\n this._direction = 'horizontal';\n this._animState = null;\n this._pendingMarginCleanups = new Map();\n this._pendingCollapse = false;\n this._flipTransitionCleanup = null;\n this._voidContainer = null;\n this._voidContainerListeners = null;\n this._extendedDropZone = null;\n this._pointerInsideTabsList = false;\n this._onTabDragStart = new Emitter();\n this.onTabDragStart = this._onTabDragStart.event;\n this._onDrop = new Emitter();\n this.onDrop = this._onDrop.event;\n this._onWillShowOverlay = new Emitter();\n this.onWillShowOverlay = this._onWillShowOverlay.event;\n this._onOverflowTabsChange = new Emitter();\n this.onOverflowTabsChange = this._onOverflowTabsChange.event;\n this._tabsList = document.createElement('div');\n this._tabsList.className = 'dv-tabs-container';\n // WAI-ARIA Tabs pattern: the strip of tabs is the tablist.\n this._tabsList.setAttribute('role', 'tablist');\n this._tabsList.setAttribute('aria-orientation', this._direction === 'vertical' ? 'vertical' : 'horizontal');\n this.showTabsOverflowControl = options.showTabsOverflowControl;\n if (accessor.options.scrollbars === 'native') {\n this._element = this._tabsList;\n }\n else {\n this._scrollbar = new Scrollbar(this._tabsList);\n this._scrollbar.orientation = this.direction;\n this._element = this._scrollbar.element;\n this.addDisposables(this._scrollbar);\n }\n this._tabGroupManager = new TabGroupManager({\n group: this.group,\n accessor: this.accessor,\n tabsList: this._tabsList,\n getTabs: () => this._tabs,\n getTabMap: () => this._tabMap,\n getDirection: () => this._direction,\n }, {\n onChipContextMenu: (tabGroup, event) => {\n var _a;\n (_a = this.accessor.contextMenuService) === null || _a === void 0 ? void 0 : _a.showForChip(tabGroup, this.group, event);\n },\n onChipDragStart: (tabGroup, chip, event) => {\n this._handleChipDragStart(tabGroup, chip, event);\n },\n onChipDragEnd: () => {\n // HTML5 chip dragend (incl. cancels). The Html5DragSource\n // owns the listener on the chip element, so this fires\n // even if the chip was detached cross-group — the\n // element keeps its listeners until the source is\n // disposed. resetDragAnimation is a no-op after a\n // successful drop (anim state already null) thanks to\n // the gating inside it.\n this.resetDragAnimation();\n },\n onChipDrop: (tabGroup, event) => {\n this._handleChipDrop(tabGroup, event);\n },\n });\n this.addDisposables(this._onOverflowTabsChange, this._observerDisposable, this._onWillShowOverlay, this._onDrop, this._onTabDragStart, {\n dispose: () => {\n var _a;\n (_a = this._flipTransitionCleanup) === null || _a === void 0 ? void 0 : _a.call(this);\n },\n }, \n // Pointer-side cleanup: when any pointer drag ends, tear\n // down smooth-reorder anim state the dragover bridge may\n // have installed. The chip's pointer drag source handles\n // its own transfer payload + iframe-shield cleanup.\n PointerDragController.getInstance().onDragEnd(() => {\n this._pointerInsideTabsList = false;\n this.resetDragAnimation();\n }), \n // Pointer-event mirror of the HTML5 dragover / dragleave handlers\n // below. Drives smooth-reorder for `dndStrategy: 'pointer'` and\n // for touch drags in `'auto'`.\n PointerDragController.getInstance().onDragMove((e) => {\n this._handlePointerDragMove(e.clientX, e.clientY);\n }), addDisposableListener(this.element, 'pointerdown', (event) => {\n if (event.defaultPrevented) {\n return;\n }\n const isLeftClick = event.button === 0;\n if (isLeftClick) {\n this.accessor.doSetGroupActive(this.group);\n }\n }), \n // Trackpad / wheel forwarding. The strip scrolls along its own\n // axis (x for horizontal headers, y for vertical), so deltaY\n // from a plain mouse wheel maps onto the strip's axis too —\n // this gives the VS Code-style \"scroll over tab bar to page\n // through tabs\" feel. We only consume the event when the strip\n // is actually overflowing in the direction the user wheeled in,\n // so a wheel at the edge of a non-overflowing strip still\n // bubbles up and scrolls the page. `{ passive: false }` is\n // required because we call preventDefault().\n addDisposableListener(this._tabsList, 'wheel', (event) => {\n const isVertical = this._direction === 'vertical';\n const primary = isVertical\n ? event.deltaY || event.deltaX\n : event.deltaX || event.deltaY;\n if (primary === 0) {\n return;\n }\n const max = isVertical\n ? this._tabsList.scrollHeight -\n this._tabsList.clientHeight\n : this._tabsList.scrollWidth -\n this._tabsList.clientWidth;\n if (max <= 0) {\n return;\n }\n const current = isVertical\n ? this._tabsList.scrollTop\n : this._tabsList.scrollLeft;\n // At the edge in the wheel direction: let the page\n // scroll instead of trapping the gesture.\n if ((primary < 0 && current <= 0) ||\n (primary > 0 && current >= max)) {\n return;\n }\n event.preventDefault();\n // Custom-scrollbar mode wraps the tabs list and installs\n // its own wheel listener that rewrites scrollLeft from a\n // deltaY-only tracker. Without stopPropagation that\n // handler would clobber our deltaX-aware update.\n event.stopPropagation();\n if (isVertical) {\n this._tabsList.scrollTop = current + primary;\n }\n else {\n this._tabsList.scrollLeft = current + primary;\n }\n }, { passive: false }), \n // WAI-ARIA Tabs keyboard pattern: arrow keys move the roving\n // focus along the strip, Home/End jump to the ends, and\n // Enter/Space activate the focused tab (manual activation, so\n // arrowing through tabs doesn't switch panels until committed).\n addDisposableListener(this._tabsList, 'keydown', (event) => {\n this._onKeyDown(event);\n }), addDisposableListener(this._tabsList, 'dragover', (event) => {\n if (this._processDragOver(event.clientX)) {\n // Allow `drop` to fire on the tabs list container.\n event.preventDefault();\n }\n }, true), addDisposableListener(this._tabsList, 'dragleave', (event) => {\n this._processDragLeave(event.relatedTarget);\n }, true), addDisposableListener(this._tabsList, 'dragend', () => {\n this.resetDragAnimation();\n }), addDisposableListener(this._tabsList, 'drop', (event) => {\n var _a, _b, _c;\n if (!this._animState ||\n this._animState.currentInsertionIndex === null) {\n return;\n }\n // In non-smooth mode only handle group drags here;\n // individual tab drops are handled by tab Droptargets.\n if (((_a = this.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabAnimation) !==\n 'smooth' &&\n !this._animState.sourceTabGroupId) {\n return;\n }\n event.stopPropagation();\n event.preventDefault();\n // The capturing stopPropagation above prevents the\n // individual tab's Droptarget.onDrop from firing, so\n // the anchor overlay won't be cleared by that path.\n // Clear it explicitly here before processing the drop.\n (_c = (_b = this.group.model.dropTargetContainer) === null || _b === void 0 ? void 0 : _b.model) === null || _c === void 0 ? void 0 : _c.clear();\n const animState = this._animState;\n this._animState = null;\n this._pendingCollapse = false;\n // Handle group drag (entire group repositioned)\n if (animState.sourceTabGroupId) {\n this._commitGroupMove(animState.sourceTabGroupId, animState.currentInsertionIndex);\n return;\n }\n const insertionIndex = animState.currentInsertionIndex;\n const sourceIndex = animState.sourceIndex;\n const adjustedIndex = insertionIndex -\n (sourceIndex !== -1 && sourceIndex < insertionIndex\n ? 1\n : 0);\n const sourceCurrentGroup = this.group.model.getTabGroupForPanel(animState.sourceTabId);\n if (adjustedIndex === sourceIndex &&\n !animState.targetTabGroupId &&\n !sourceCurrentGroup) {\n this._uncollapsSourceTab(animState.sourceTabId);\n this.resetTabTransforms();\n return;\n }\n this._uncollapsSourceTab(animState.sourceTabId);\n const firstPositions = this.snapshotTabPositions();\n this.resetTabTransforms();\n this._onDrop.fire({\n event,\n index: adjustedIndex,\n targetTabGroupId: animState.targetTabGroupId,\n });\n this.runFlipAnimation(firstPositions, animState.sourceTabId, animState.sourceIndex === -1, {\n from: Math.min(sourceIndex, adjustedIndex),\n to: Math.max(sourceIndex, adjustedIndex),\n });\n }, true), Disposable.from(() => {\n var _a;\n (_a = this._voidContainerListeners) === null || _a === void 0 ? void 0 : _a.dispose();\n this.resetDragAnimation();\n this._tabGroupManager.disposeAll();\n for (const { value, disposable } of this._tabs) {\n disposable.dispose();\n value.dispose();\n }\n this._tabs = [];\n this._tabMap.clear();\n }));\n }\n indexOf(id) {\n return this._tabs.findIndex((tab) => tab.value.panel.id === id);\n }\n /** DOM id of the tab element for a panel — for the tabpanel's `aria-labelledby`. */\n getTabId(panelId) {\n var _a;\n return (_a = this._tabMap.get(panelId)) === null || _a === void 0 ? void 0 : _a.value.element.id;\n }\n isActive(tab) {\n return (this.selectedIndex > -1 &&\n this._tabs[this.selectedIndex].value === tab);\n }\n _onKeyDown(event) {\n // Only handle when a tab element itself is focused — never hijack keys\n // typed inside a custom tab renderer's own controls (inputs etc.).\n const index = this._tabs.findIndex((tab) => tab.value.element === event.target);\n if (index === -1) {\n return;\n }\n const isVertical = this._direction === 'vertical';\n const nextKey = isVertical ? 'ArrowDown' : 'ArrowRight';\n const prevKey = isVertical ? 'ArrowUp' : 'ArrowLeft';\n const last = this._tabs.length - 1;\n switch (event.key) {\n case nextKey:\n event.preventDefault();\n this._focusTab(Math.min(index + 1, last));\n break;\n case prevKey:\n event.preventDefault();\n this._focusTab(Math.max(index - 1, 0));\n break;\n case 'Home':\n event.preventDefault();\n this._focusTab(0);\n break;\n case 'End':\n event.preventDefault();\n this._focusTab(last);\n break;\n case 'Enter':\n case ' ':\n // Manual activation of the focused tab.\n event.preventDefault();\n this.accessor.withOrigin('user', () => this._tabs[index].value.panel.api.setActive());\n break;\n case 'Delete':\n case 'Backspace':\n // Close the focused tab (Backspace covers macOS, where the\n // primary delete key reports as Backspace).\n event.preventDefault();\n this._closeTab(index);\n break;\n }\n }\n /**\n * Close the tab at `index` and move roving focus to a neighbouring tab so\n * keyboard focus stays in the tablist.\n */\n _closeTab(index) {\n var _a, _b, _c, _d, _e;\n const tab = (_a = this._tabs[index]) === null || _a === void 0 ? void 0 : _a.value;\n if (!tab) {\n return;\n }\n // Resolve the post-close focus target before closing mutates the list:\n // prefer the next tab, otherwise the previous.\n const neighbourId = (_e = ((_c = (_b = this._tabs[index + 1]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : (_d = this._tabs[index - 1]) === null || _d === void 0 ? void 0 : _d.value)) === null || _e === void 0 ? void 0 : _e.panel.id;\n tab.panel.api.close();\n if (neighbourId !== undefined) {\n const nextIndex = this._tabs.findIndex((t) => t.value.panel.id === neighbourId);\n if (nextIndex > -1) {\n this._focusTab(nextIndex);\n }\n }\n }\n /** Move the roving focus to the tab at `index` (updates tabindex + DOM focus). */\n _focusTab(index) {\n for (let i = 0; i < this._tabs.length; i++) {\n this._tabs[i].value.element.tabIndex = i === index ? 0 : -1;\n }\n this._tabs[index].value.element.focus();\n }\n /** Move DOM focus to the active tab — the entry point into the tablist. */\n focusActiveTab() {\n var _a;\n if (this._tabs.length === 0) {\n return;\n }\n const activeId = (_a = this.group.activePanel) === null || _a === void 0 ? void 0 : _a.id;\n const activeIndex = activeId\n ? this._tabs.findIndex((t) => t.value.panel.id === activeId)\n : -1;\n this._focusTab(activeIndex > -1 ? activeIndex : 0);\n }\n setActivePanel(panel) {\n const isVertical = this._direction === 'vertical';\n let running = 0;\n for (const tab of this._tabs) {\n const isActivePanel = panel.id === tab.value.panel.id;\n tab.value.setActive(isActivePanel);\n if (isActivePanel) {\n const element = tab.value.element;\n const parentElement = element.parentElement;\n if (isVertical) {\n if (running < parentElement.scrollTop ||\n running + element.clientHeight >\n parentElement.scrollTop + parentElement.clientHeight) {\n parentElement.scrollTop = running;\n }\n }\n else {\n if (running < parentElement.scrollLeft ||\n running + element.clientWidth >\n parentElement.scrollLeft + parentElement.clientWidth) {\n parentElement.scrollLeft = running;\n }\n }\n }\n running += isVertical\n ? tab.value.element.clientHeight\n : tab.value.element.clientWidth;\n }\n // Reposition underlines so the wrap-around follows the new active tab\n if (this._tabGroupManager.groupUnderlines.size > 0) {\n this._tabGroupManager.positionUnderlines();\n }\n }\n openPanel(panel, index = this._tabs.length) {\n if (this._tabMap.has(panel.id)) {\n return;\n }\n const tab = new Tab(panel, this.accessor, this.group);\n tab.setContent(panel.view.tab);\n if (this._direction !== 'horizontal') {\n tab.setDirection(this._direction);\n }\n const disposable = new CompositeDisposable(tab.onDragStart((event) => {\n var _a;\n this._onTabDragStart.fire({ nativeEvent: event, panel });\n // Both HTML5 and pointer drags initialize _animState. Cleanup\n // is wired in both paths: HTML5 via dragend/drop on _tabsList,\n // pointer via PointerDragController.onDragEnd subscriptions.\n if (((_a = this.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabAnimation) === 'smooth') {\n const tabWidth = tab.element.getBoundingClientRect().width;\n const sourceIndex = this._tabs.findIndex((x) => x.value === tab);\n this._animState = {\n sourceTabId: panel.id,\n sourceIndex,\n tabPositions: this.snapshotTabPositions(),\n chipPositions: this._tabGroupManager.snapshotChipWidths(),\n currentInsertionIndex: null,\n targetTabGroupId: null,\n sourceTabGroupId: null,\n sourceGroupPanelIds: null,\n sourceChipWidth: 0,\n cursorOffsetFromDragLeft: tabWidth / 2,\n sourceGapWidth: tabWidth,\n containerLeft: this._tabsList.getBoundingClientRect().left,\n };\n // Collapse the source tab after the browser captures the\n // drag image, then open the gap at the source position in\n // the same paint frame — no visual jump.\n // Both collapse and gap must be instant (no transition).\n this._pendingCollapse = true;\n requestAnimationFrame(() => {\n var _a;\n var _b;\n this._pendingCollapse = false;\n if (!this._animState) {\n return;\n }\n // Collapse source tab instantly (no transition)\n tab.element.style.transition = 'none';\n toggleClass(tab.element, 'dv-tab--dragging', true);\n void tab.element.offsetHeight; // force reflow\n (_a = (_b = this._animState).currentInsertionIndex) !== null && _a !== void 0 ? _a : (_b.currentInsertionIndex = sourceIndex);\n // Apply gap with transitions disabled on the target\n this.applyDragOverTransforms(true);\n // Re-enable transitions for subsequent moves\n tab.element.style.removeProperty('transition');\n });\n }\n }), tab.onTabClick((event) => {\n if (event.defaultPrevented) {\n return;\n }\n if (this.group.api.location.type !== 'edge') {\n return;\n }\n if (this.group.activePanel === panel) {\n // Clicking the active tab toggles expansion\n if (this.group.api.isCollapsed()) {\n this.group.api.expand();\n }\n else {\n this.group.api.collapse();\n }\n }\n else {\n // Clicking a non-active tab switches the active tab.\n // If the group is collapsed, also expand it.\n this.group.model.openPanel(panel);\n if (this.group.api.isCollapsed()) {\n this.group.api.expand();\n }\n }\n }), tab.onPointerDown((event) => {\n if (event.defaultPrevented) {\n return;\n }\n const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;\n const isFloatingWithOnePanel = this.group.api.location.type === 'floating' &&\n this.size === 1;\n if (isFloatingGroupsEnabled &&\n !isFloatingWithOnePanel &&\n event.shiftKey) {\n event.preventDefault();\n const panel = this.accessor.getGroupPanel(tab.panel.id);\n const { top, left } = tab.element.getBoundingClientRect();\n const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();\n this.accessor.addFloatingGroup(panel, {\n x: left - rootLeft,\n y: top - rootTop,\n inDragMode: true,\n });\n return;\n }\n switch (event.button) {\n case 0:\n if (this.group.api.location.type === 'edge') ;\n else {\n if (this.group.activePanel !== panel) {\n this.group.model.openPanel(panel);\n }\n }\n break;\n }\n }), tab.onDrop((event) => {\n var _a, _b, _c, _d;\n const animState = this._animState;\n this._animState = null;\n this._pendingCollapse = false;\n const tabIndex = this._tabs.findIndex((x) => x.value === tab);\n if (animState) {\n const dropIndex = event.position === 'right' ? tabIndex + 1 : tabIndex;\n if (animState.sourceTabGroupId) {\n this._commitGroupMove(animState.sourceTabGroupId, (_a = animState.currentInsertionIndex) !== null && _a !== void 0 ? _a : dropIndex);\n return;\n }\n this._uncollapsSourceTab(animState.sourceTabId);\n const firstPositions = this.snapshotTabPositions();\n this.resetTabTransforms();\n this._onDrop.fire({\n event: event.nativeEvent,\n index: dropIndex,\n targetTabGroupId: animState.targetTabGroupId,\n });\n if (((_b = this.accessor.options.theme) === null || _b === void 0 ? void 0 : _b.tabAnimation) === 'smooth') {\n this.runFlipAnimation(firstPositions, animState.sourceTabId, animState.sourceIndex === -1, animState.sourceIndex !== -1\n ? {\n from: Math.min(animState.sourceIndex, dropIndex),\n to: Math.max(animState.sourceIndex, dropIndex),\n }\n : undefined);\n }\n }\n else {\n // Compute insertion index based on which half of the tab\n // the pointer is over, then adjust for same-group removal:\n // when the source tab sits before the insertion point,\n // removing it shifts all subsequent indices down by one.\n const afterPosition = this._direction === 'vertical' ? 'bottom' : 'right';\n const insertionIndex = event.position === afterPosition\n ? tabIndex + 1\n : tabIndex;\n const data = getPanelData();\n const sourceIndex = data\n ? this._tabs.findIndex((x) => x.value.panel.id === data.panelId)\n : -1;\n const adjustedIndex = insertionIndex -\n (sourceIndex !== -1 && sourceIndex < insertionIndex\n ? 1\n : 0);\n const targetTabGroupId = (_d = (_c = this.group.model.getTabGroupForPanel(tab.panel.id)) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : null;\n this._onDrop.fire({\n event: event.nativeEvent,\n index: adjustedIndex,\n targetTabGroupId,\n });\n }\n }), tab.onWillShowOverlay((event) => {\n this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {\n kind: 'tab',\n panel: this.group.activePanel,\n api: this.accessor.api,\n group: this.group,\n getData: getPanelData,\n }));\n }));\n const value = { value: tab, disposable };\n this.addTab(value, index);\n // A new tab may have been inserted between a chip and its\n // group's first tab — reposition all chips to stay correct.\n this._tabGroupManager.positionAllChips();\n // If a tab was added during active drag, refresh positions\n if (this._animState) {\n this._animState.tabPositions = this.snapshotTabPositions();\n this._animState.chipPositions =\n this._tabGroupManager.snapshotChipWidths();\n this.applyDragOverTransforms();\n }\n }\n delete(id) {\n var _a;\n if (((_a = this._animState) === null || _a === void 0 ? void 0 : _a.sourceTabId) === id) {\n this.resetTabTransforms();\n this._animState = null;\n }\n // Force-clean any pending transitionend listener\n this._tabGroupManager.cleanupTransition(id);\n const index = this.indexOf(id);\n const tabToRemove = this._tabs.splice(index, 1)[0];\n this._tabMap.delete(id);\n if (tabToRemove) {\n const { value, disposable } = tabToRemove;\n disposable.dispose();\n value.dispose();\n value.element.remove();\n }\n // If a non-source tab was removed during active drag, refresh positions\n if (this._animState) {\n this._animState.tabPositions = this.snapshotTabPositions();\n this._animState.chipPositions =\n this._tabGroupManager.snapshotChipWidths();\n this.applyDragOverTransforms();\n }\n }\n addTab(tab, index = this._tabs.length) {\n if (index < 0 || index > this._tabs.length) {\n throw new Error('invalid location');\n }\n // Use the tab element at `index` as the reference node rather than\n // `children[index]`, because `_tabsList` may contain non-tab children\n // (e.g. group chips, underlines) that shift the DOM indices.\n const refNode = index < this._tabs.length ? this._tabs[index].value.element : null;\n this._tabsList.insertBefore(tab.value.element, refNode);\n this._tabs = [\n ...this._tabs.slice(0, index),\n tab,\n ...this._tabs.slice(index),\n ];\n this._tabMap.set(tab.value.panel.id, tab);\n if (this.selectedIndex < 0) {\n this.selectedIndex = index;\n }\n }\n toggleDropdown(options) {\n if (options.reset) {\n this._onOverflowTabsChange.fire({\n tabs: [],\n tabGroups: [],\n reset: true,\n });\n return;\n }\n const tabs = this._tabs\n .filter((tab) => !isChildEntirelyVisibleWithinParent(tab.value.element, this._tabsList))\n .map((x) => x.value.panel.id);\n // Detect tab groups whose chip is clipped or whose tabs are all\n // in the overflow set (e.g. collapsed groups scrolled out of view).\n const overflowTabSet = new Set(tabs);\n const tabGroups = [];\n for (const tg of this.group.model.getTabGroups()) {\n const chipEntry = this._tabGroupManager.chipRenderers.get(tg.id);\n const chipClipped = chipEntry &&\n !isChildEntirelyVisibleWithinParent(chipEntry.chip.element, this._tabsList);\n // A group is in overflow if its chip is clipped OR all its\n // visible tabs are in the overflow set.\n const allTabsOverflow = tg.panelIds.length > 0 &&\n tg.panelIds.every((pid) => overflowTabSet.has(pid));\n if (chipClipped || allTabsOverflow) {\n tabGroups.push(tg.id);\n // For collapsed groups whose chip is clipped, ensure all\n // member tabs are included in the overflow list so they\n // appear in the dropdown.\n if (tg.collapsed) {\n for (const pid of tg.panelIds) {\n if (!overflowTabSet.has(pid)) {\n overflowTabSet.add(pid);\n tabs.push(pid);\n }\n }\n }\n }\n }\n this._onOverflowTabsChange.fire({ tabs, tabGroups, reset: false });\n }\n updateDragAndDropState() {\n for (const tab of this._tabs) {\n tab.value.updateDragAndDropState();\n }\n this._tabGroupManager.updateDragAndDropState();\n }\n /**\n * Synchronize chip elements and CSS classes for all tab groups\n * in the parent group model. Call after any tab group mutation.\n */\n updateTabGroups() {\n this._tabGroupManager.update();\n }\n refreshTabGroupAccent() {\n this._tabGroupManager.refreshAccents();\n }\n /**\n * Tabs-list-specific side effects of a chip drag start. The chip's\n * drag sources (constructed by `TabGroupManager`) own the transfer\n * payload, iframe shielding, dataTransfer setup, and the HTML5 drag\n * image. This method just sets up the smooth-reorder anim state and\n * collapses the source-group tabs in the tabs list.\n */\n _handleChipDragStart(tabGroup, chip, event) {\n var _a;\n const firstPanelId = tabGroup.panelIds[0];\n const firstIdx = firstPanelId\n ? this._tabs.findIndex((t) => t.value.panel.id === firstPanelId)\n : -1;\n const chipRect = chip.element.getBoundingClientRect();\n // Compute total group width (chip + all tabs)\n let groupGapWidth = chipRect.width;\n for (const pid of tabGroup.panelIds) {\n const tabEntry = this._tabMap.get(pid);\n if (tabEntry) {\n groupGapWidth +=\n tabEntry.value.element.getBoundingClientRect().width;\n }\n }\n this._animState = {\n sourceTabId: '',\n sourceIndex: firstIdx,\n tabPositions: this.snapshotTabPositions(),\n chipPositions: this._tabGroupManager.snapshotChipWidths(),\n currentInsertionIndex: null,\n targetTabGroupId: null,\n sourceTabGroupId: tabGroup.id,\n sourceGroupPanelIds: new Set(tabGroup.panelIds),\n sourceChipWidth: chipRect.width,\n cursorOffsetFromDragLeft: event.clientX - chipRect.left,\n sourceGapWidth: groupGapWidth,\n containerLeft: this._tabsList.getBoundingClientRect().left,\n };\n if (((_a = this.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabAnimation) !== 'smooth') {\n return;\n }\n // Collapse group tabs + chip after the browser captures the drag\n // image, then open the gap at the source position — all instant\n // (no transitions).\n const groupPanelIds = new Set(tabGroup.panelIds);\n this._pendingCollapse = true;\n requestAnimationFrame(() => {\n var _a;\n var _b;\n this._pendingCollapse = false;\n if (!this._animState) {\n return;\n }\n // Collapse all group tabs instantly\n for (const t of this._tabs) {\n if (groupPanelIds.has(t.value.panel.id)) {\n t.value.element.style.transition = 'none';\n toggleClass(t.value.element, 'dv-tab--dragging', true);\n }\n }\n // Collapse the group chip instantly\n const chipEntry = this._tabGroupManager.chipRenderers.get(tabGroup.id);\n if (chipEntry) {\n chipEntry.chip.element.style.transition = 'none';\n toggleClass(chipEntry.chip.element, 'dv-tab-group-chip--dragging', true);\n }\n // Single reflow for the entire batch\n void this._tabsList.offsetHeight;\n const underline = this._tabGroupManager.groupUnderlines.get(tabGroup.id);\n if (underline) {\n underline.style.display = 'none';\n }\n (_a = (_b = this._animState).currentInsertionIndex) !== null && _a !== void 0 ? _a : (_b.currentInsertionIndex = firstIdx);\n this.applyDragOverTransforms(true);\n for (const t of this._tabs) {\n if (groupPanelIds.has(t.value.panel.id)) {\n t.value.element.style.removeProperty('transition');\n }\n }\n if (chipEntry) {\n chipEntry.chip.element.style.removeProperty('transition');\n }\n });\n }\n /**\n * A drop on a tab group chip means \"insert before this group\". Resolve to\n * the index of the group's first tab, adjusting for same-group removal\n * (when the source tab is currently to the left of the target slot, its\n * removal shifts the insertion index down by one). Always clears\n * `targetTabGroupId` so the dropped tab lands outside the group.\n */\n _handleChipDrop(tabGroup, event) {\n const firstPanelId = tabGroup.panelIds[0];\n if (!firstPanelId) {\n return;\n }\n const insertionIndex = this._tabs.findIndex((x) => x.value.panel.id === firstPanelId);\n if (insertionIndex === -1) {\n return;\n }\n const data = getPanelData();\n const sourceIndex = data && data.groupId === this.group.id && data.panelId\n ? this._tabs.findIndex((x) => x.value.panel.id === data.panelId)\n : -1;\n const adjustedIndex = insertionIndex -\n (sourceIndex !== -1 && sourceIndex < insertionIndex ? 1 : 0);\n this._onDrop.fire({\n event: event.nativeEvent,\n index: adjustedIndex,\n targetTabGroupId: null,\n });\n }\n /**\n * Sets the broader container that is part of the same logical drop surface\n * as this tab list (e.g. the full header element). When a dragleave from\n * the tabs list lands inside this container, `_animState` is preserved so\n * that external dragover listeners can continue the animation.\n */\n setExtendedDropZone(el) {\n this._extendedDropZone = el;\n }\n /**\n * Allows external elements (e.g. void container, left actions) to push an\n * insertion index into the animation while the cursor is outside the tabs\n * list itself. Pass `null` to clear the indicator.\n */\n setExternalInsertionIndex(index) {\n if (!this._animState) {\n return;\n }\n if (index === this._animState.currentInsertionIndex) {\n return;\n }\n this._animState.currentInsertionIndex = index;\n this.applyDragOverTransforms();\n }\n /**\n * Called when the drag cursor leaves the entire header area (not just the\n * tabs list). Clears animation state for cross-group drags, which never\n * receive a `dragend` event on this tab list.\n */\n clearExternalAnimState() {\n if (!this._animState) {\n return;\n }\n this.resetTabTransforms();\n if (this._animState.sourceIndex === -1) {\n this._animState = null;\n }\n else {\n this._animState.currentInsertionIndex = null;\n }\n }\n snapshotTabPositions() {\n const positions = new Map();\n for (const tab of this._tabs) {\n positions.set(tab.value.panel.id, tab.value.element.getBoundingClientRect());\n }\n return positions;\n }\n getAverageTabWidth() {\n if (this._tabs.length === 0) {\n return 0;\n }\n const isVertical = this._direction === 'vertical';\n let total = 0;\n for (const tab of this._tabs) {\n const rect = tab.value.element.getBoundingClientRect();\n total += isVertical ? rect.height : rect.width;\n }\n return total / this._tabs.length;\n }\n /**\n * Pointer-event entry point. The HTML5 path enters via the per-element\n * `dragover` listener; this one hit-tests the global pointer-drag\n * position against the tabs list and routes through the same shared\n * `_processDragOver` / `_processDragLeave` helpers.\n */\n _handlePointerDragMove(clientX, clientY) {\n var _a;\n const sourceDoc = (_a = this._tabsList.ownerDocument) !== null && _a !== void 0 ? _a : document;\n const elAtPoint = sourceDoc.elementFromPoint(clientX, clientY);\n const inside = !!elAtPoint &&\n (this._tabsList.contains(elAtPoint) ||\n (!!this._extendedDropZone &&\n this._extendedDropZone.contains(elAtPoint)));\n if (!inside) {\n if (this._pointerInsideTabsList) {\n this._pointerInsideTabsList = false;\n this._processDragLeave(elAtPoint);\n }\n return;\n }\n this._pointerInsideTabsList = true;\n this._processDragOver(clientX);\n }\n /**\n * Shared body of the dragover entry point. Refreshes stale anim state\n * for a changed drag identity, initializes anim state for incoming\n * cross-group drags, and dispatches to the gap-following math in\n * `handleDragOver`. Returns true when this tabs list has taken\n * ownership of the drag — HTML5 callers use this to gate\n * `event.preventDefault()`.\n */\n _processDragOver(clientX) {\n var _a, _b, _c, _d;\n if (this.accessor.options.disableDnd) {\n return false;\n }\n // Stale-state guard: if a previous drag's anim state is still here\n // but the current drag is a different identity, drop the stale one\n // so the new drag starts from a clean slate.\n if (this._animState) {\n const data = getPanelData();\n if ((data === null || data === void 0 ? void 0 : data.tabGroupId) &&\n data.groupId !== this.group.id &&\n this._animState.sourceTabGroupId !== data.tabGroupId) {\n this._animState = null;\n }\n }\n if (!this._animState) {\n const data = getPanelData();\n // In default animation mode, individual tab drops are handled\n // by per-tab Droptargets; only chip drags need tabs-list-level\n // handling so drops on void space still work.\n if (((_a = this.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabAnimation) === 'default' &&\n !(data === null || data === void 0 ? void 0 : data.tabGroupId)) {\n return false;\n }\n if (data &&\n (data.panelId || data.tabGroupId) &&\n data.groupId !== this.group.id) {\n const avgWidth = this.getAverageTabWidth();\n if (data.tabGroupId) {\n // External group drag — look up the source group to\n // size the gap.\n const sourceGroup = this.accessor.getPanel(data.groupId);\n const sourceTg = sourceGroup === null || sourceGroup === void 0 ? void 0 : sourceGroup.model.getTabGroups().find((tg) => tg.id === data.tabGroupId);\n const panelCount = (_b = sourceTg === null || sourceTg === void 0 ? void 0 : sourceTg.panelIds.length) !== null && _b !== void 0 ? _b : 1;\n const groupGapWidth = avgWidth * panelCount + avgWidth;\n this._animState = {\n sourceTabId: '',\n sourceIndex: -1,\n tabPositions: this.snapshotTabPositions(),\n chipPositions: this._tabGroupManager.snapshotChipWidths(),\n currentInsertionIndex: null,\n targetTabGroupId: null,\n sourceTabGroupId: data.tabGroupId,\n sourceGroupPanelIds: sourceTg\n ? new Set(sourceTg.panelIds)\n : new Set(),\n sourceChipWidth: avgWidth,\n cursorOffsetFromDragLeft: groupGapWidth / 2,\n sourceGapWidth: groupGapWidth,\n containerLeft: this._tabsList.getBoundingClientRect().left,\n };\n }\n else {\n this._animState = {\n sourceTabId: data.panelId,\n sourceIndex: -1,\n tabPositions: this.snapshotTabPositions(),\n chipPositions: this._tabGroupManager.snapshotChipWidths(),\n currentInsertionIndex: null,\n targetTabGroupId: null,\n sourceTabGroupId: null,\n sourceGroupPanelIds: null,\n sourceChipWidth: 0,\n cursorOffsetFromDragLeft: avgWidth / 2,\n sourceGapWidth: avgWidth,\n containerLeft: this._tabsList.getBoundingClientRect().left,\n };\n }\n }\n else {\n return false;\n }\n }\n // For intra-group drag (sourceIndex >= 0) the gap animation is the\n // sole visual indicator — clear any stale anchor overlay that may\n // have been set while the cursor was over the panel content area or\n // another zone. External drags (sourceIndex === -1) leave the\n // overlay to the individual tab Droptargets so cross-group\n // animation is not disrupted.\n if (this._animState.sourceIndex !== -1) {\n (_d = (_c = this.group.model.dropTargetContainer) === null || _c === void 0 ? void 0 : _c.model) === null || _d === void 0 ? void 0 : _d.clear();\n }\n this.handleDragOver({ clientX });\n return true;\n }\n /**\n * Shared body of the dragleave entry point. Preserves anim state when\n * the drag moves between tabs-list children, into the extended drop\n * zone, or into the void container; tears it down otherwise.\n */\n _processDragLeave(related) {\n var _a, _b, _c;\n if (!this._animState) {\n return;\n }\n // Moves between children of the tabs list aren't real leaves.\n if (related && this._tabsList.contains(related)) {\n return;\n }\n // Moving into the broader drop zone (e.g. void container, left\n // actions) — keep anim state alive so external listeners can\n // continue the gap animation.\n if (related && ((_a = this._extendedDropZone) === null || _a === void 0 ? void 0 : _a.contains(related))) {\n this.resetTabTransforms();\n this._animState.currentInsertionIndex = null;\n return;\n }\n // Leaving toward the void container (empty header space to the\n // right): keep anim state so a drop can still land at the end.\n const isVoid = this._voidContainer &&\n related &&\n (related === this._voidContainer ||\n this._voidContainer.contains(related));\n if (isVoid) {\n return;\n }\n this.resetTabTransforms();\n if (this._animState.sourceIndex === -1) {\n (_c = (_b = this.group.model.dropTargetContainer) === null || _b === void 0 ? void 0 : _b.model) === null || _c === void 0 ? void 0 : _c.clear();\n this._animState = null;\n }\n else {\n this._animState.currentInsertionIndex = null;\n }\n }\n handleDragOver(event) {\n var _a, _b, _c, _d, _e;\n if (!this._animState) {\n return;\n }\n const mouseX = event.clientX;\n let insertionIndex = null;\n let targetTabGroupId = null;\n const sourceGroupPanelIds = this._animState.sourceGroupPanelIds;\n // Accumulation approach: compute where the drag image's left edge\n // would be, then walk tabs left-to-right using their original widths.\n // A tab fits to the left of the gap if the cumulative width of all\n // preceding non-source tabs <= available space.\n const dragLeftEdge = mouseX - this._animState.cursorOffsetFromDragLeft;\n const availableSpace = dragLeftEdge - this._animState.containerLeft;\n let accWidth = 0;\n // Build lookup: first panel ID of each non-source group → group ID\n // so we can add chip widths when we encounter a group's first tab.\n const firstPanelToGroup = new Map();\n if (this._tabGroupManager.chipRenderers.size > 0) {\n const tabGroups = this.group.model.getTabGroups();\n for (const tg of tabGroups) {\n if (tg.id === this._animState.sourceTabGroupId) {\n continue;\n }\n if (tg.panelIds.length > 0) {\n firstPanelToGroup.set(tg.panelIds[0], tg.id);\n }\n }\n }\n for (let i = 0; i < this._tabs.length; i++) {\n const tab = this._tabs[i].value;\n if (tab.panel.id === this._animState.sourceTabId) {\n continue;\n }\n if (sourceGroupPanelIds === null || sourceGroupPanelIds === void 0 ? void 0 : sourceGroupPanelIds.has(tab.panel.id)) {\n continue;\n }\n // If this tab is the first of a non-source group, include\n // the chip width (which sits before it in the DOM).\n const groupId = firstPanelToGroup.get(tab.panel.id);\n if (groupId) {\n const chipWidth = (_a = this._animState.chipPositions.get(groupId)) !== null && _a !== void 0 ? _a : 0;\n if (accWidth + chipWidth > availableSpace) {\n // Chip alone overflows — gap goes before this group\n insertionIndex !== null && insertionIndex !== void 0 ? insertionIndex : (insertionIndex = i);\n break;\n }\n accWidth += chipWidth;\n }\n // Use original width (before collapse/transforms)\n const origRect = this._animState.tabPositions.get(tab.panel.id);\n const tabWidth = origRect\n ? origRect.width\n : tab.element.getBoundingClientRect().width;\n // Shift at the midpoint: a tab moves left once the drag image\n // covers half of it (like Chrome's tab drag behavior).\n if (accWidth + tabWidth / 2 <= availableSpace) {\n accWidth += tabWidth;\n insertionIndex = i + 1;\n }\n else {\n insertionIndex !== null && insertionIndex !== void 0 ? insertionIndex : (insertionIndex = i);\n break;\n }\n }\n // Determine which tab group (if any) the insertion index falls within.\n //\n // We use snapshot-based positions (accWidth from the accumulation loop\n // above) to compute original chip boundaries. This avoids reading\n // getBoundingClientRect() on chips whose live position is shifted by\n // the drag gap margin, which caused oscillation / visual jumps.\n if (insertionIndex !== null &&\n this._tabGroupManager.chipRenderers.size > 0) {\n const isGroupDrag = !!this._animState.sourceTabGroupId;\n const tabGroups = this.group.model.getTabGroups();\n // Rebuild the accumulated width up to insertionIndex so we know\n // the original right edge of the chip (if any) that precedes it.\n // We walk exactly the same way as the accumulation loop above.\n let accUpTo = 0;\n for (let i = 0; i < this._tabs.length; i++) {\n const tab = this._tabs[i].value;\n if (tab.panel.id === this._animState.sourceTabId) {\n continue;\n }\n if (sourceGroupPanelIds === null || sourceGroupPanelIds === void 0 ? void 0 : sourceGroupPanelIds.has(tab.panel.id)) {\n continue;\n }\n if (i >= insertionIndex) {\n break;\n }\n const gid = firstPanelToGroup.get(tab.panel.id);\n if (gid) {\n accUpTo += (_b = this._animState.chipPositions.get(gid)) !== null && _b !== void 0 ? _b : 0;\n }\n const origRect = this._animState.tabPositions.get(tab.panel.id);\n accUpTo += origRect\n ? origRect.width\n : tab.element.getBoundingClientRect().width;\n }\n for (const tg of tabGroups) {\n // Build effective panel list: exclude the source tab\n // so that dragging a tab out of its own group doesn't\n // inflate the group's index range.\n const effectivePanelIds = tg.panelIds.filter((pid) => pid !== this._animState.sourceTabId &&\n !(sourceGroupPanelIds === null || sourceGroupPanelIds === void 0 ? void 0 : sourceGroupPanelIds.has(pid)));\n if (effectivePanelIds.length === 0) {\n continue;\n }\n const firstIdx = this._tabs.findIndex((t) => t.value.panel.id === effectivePanelIds[0]);\n const lastIdx = this._tabs.findIndex((t) => t.value.panel.id ===\n effectivePanelIds[effectivePanelIds.length - 1]);\n if (firstIdx === -1 || lastIdx === -1) {\n continue;\n }\n const isInsideRange = insertionIndex >= firstIdx && insertionIndex <= lastIdx;\n const isJustBeforeGroup = !isInsideRange && insertionIndex === firstIdx - 1;\n if (!isInsideRange && !isJustBeforeGroup) {\n continue;\n }\n if (isGroupDrag && isInsideRange) {\n // A group cannot be dropped inside another group.\n // Snap the insertion index to just before or just\n // after this group based on cursor position relative\n // to the group's midpoint. Only applies when the\n // insertion would land *inside* the group — for\n // `isJustBeforeGroup`, the index is already outside\n // (immediately left of the group) and is a valid\n // drop position, so leave it untouched (issue #1264).\n const groupMid = (firstIdx + lastIdx + 1) / 2;\n if (insertionIndex < groupMid) {\n insertionIndex = firstIdx;\n }\n else {\n insertionIndex = lastIdx + 1;\n }\n // targetTabGroupId stays null\n break;\n }\n if (isGroupDrag && isJustBeforeGroup) {\n // Cursor is just before the group — accept this\n // index as-is. Groups can be dropped at the slot\n // immediately left of another group's first tab.\n break;\n }\n if (isJustBeforeGroup) {\n // Check whether only the source tab (or source group\n // tabs) sits between insertionIndex and firstIdx.\n // If so, the source is being dragged away from that\n // slot, so we ARE effectively \"just before\" the group\n // and should still allow dropping into position 0.\n let allInBetweenAreSource = true;\n for (let j = insertionIndex; j < firstIdx; j++) {\n const pid = this._tabs[j].value.panel.id;\n if (pid !== this._animState.sourceTabId &&\n !(sourceGroupPanelIds === null || sourceGroupPanelIds === void 0 ? void 0 : sourceGroupPanelIds.has(pid))) {\n allInBetweenAreSource = false;\n break;\n }\n }\n if (!allInBetweenAreSource) {\n continue;\n }\n const chipWidth = (_c = this._animState.chipPositions.get(tg.id)) !== null && _c !== void 0 ? _c : 0;\n const threshold = tg.collapsed\n ? this._animState.containerLeft +\n accUpTo +\n chipWidth / 2\n : this._animState.containerLeft + accUpTo + chipWidth;\n if (mouseX >= threshold) {\n insertionIndex = firstIdx;\n targetTabGroupId = tg.id;\n }\n break;\n }\n if (isInsideRange) {\n const chipWidth = (_d = this._animState.chipPositions.get(tg.id)) !== null && _d !== void 0 ? _d : 0;\n const chipOriginalRight = this._animState.containerLeft + accUpTo + chipWidth;\n if (insertionIndex === firstIdx) {\n if (mouseX >= chipOriginalRight) {\n targetTabGroupId = tg.id;\n }\n }\n else {\n targetTabGroupId = tg.id;\n }\n break;\n }\n }\n }\n if (insertionIndex === this._animState.currentInsertionIndex &&\n targetTabGroupId === this._animState.targetTabGroupId) {\n return;\n }\n this._animState.currentInsertionIndex = insertionIndex;\n this._animState.targetTabGroupId = targetTabGroupId;\n if (((_e = this.accessor.options.theme) === null || _e === void 0 ? void 0 : _e.tabAnimation) === 'smooth') {\n this.applyDragOverTransforms();\n }\n }\n /**\n * Batch-remove a CSS class from multiple elements instantly,\n * forcing only a single reflow for the entire batch.\n */\n _removeClassInstantlyBatch(elements, cls) {\n const affected = [];\n for (const el of elements) {\n if (el.classList.contains(cls)) {\n el.style.transition = 'none';\n toggleClass(el, cls, false);\n affected.push(el);\n }\n }\n if (affected.length > 0) {\n void affected[0].offsetHeight; // single reflow for entire batch\n for (const el of affected) {\n el.style.removeProperty('transition');\n }\n }\n }\n /**\n * Remove `dv-tab--dragging` from the source tab instantly so it\n * regains its real width before FLIP snapshots.\n */\n _uncollapsSourceTab(sourceTabId) {\n const entry = this._tabMap.get(sourceTabId);\n if (entry) {\n this._removeClassInstantlyBatch([entry.value.element], 'dv-tab--dragging');\n }\n }\n applyDragOverTransforms(skipTransition = false) {\n if (!this._animState ||\n this._animState.currentInsertionIndex === null) {\n this.resetTabTransforms();\n return;\n }\n // Don't apply transforms until the source tab has been collapsed\n // in the rAF callback — otherwise the gap + visible source = jump.\n if (this._pendingCollapse) {\n return;\n }\n const insertionIndex = this._animState.currentInsertionIndex;\n // For group drags, gap = sum of all group member widths\n let gapWidth;\n const sourceGroupPanelIds = this._animState.sourceGroupPanelIds;\n if (this._animState.sourceTabGroupId && sourceGroupPanelIds) {\n gapWidth = this._animState.sourceGapWidth;\n }\n else {\n const sourceRect = this._animState.tabPositions.get(this._animState.sourceTabId);\n gapWidth = sourceRect\n ? sourceRect.width\n : this.getAverageTabWidth();\n }\n // When the insertion lands at or before a group's first tab, shift\n // the chip so the gap appears before the entire group.\n //\n // Two cases:\n // 1. targetTabGroupId is null (standalone drop) — always shift chip.\n // 2. targetTabGroupId is set AND the group is collapsed — shift chip\n // because the collapsed tabs are invisible, so putting the gap on\n // them has no visual effect.\n let chipToShift = null;\n if (this._tabGroupManager.chipRenderers.size > 0) {\n const tabGroups = this.group.model.getTabGroups();\n for (const tg of tabGroups) {\n if (tg.id === this._animState.sourceTabGroupId)\n continue;\n // Skip the group that the dragged tab belongs to — the\n // gap should appear after the chip (where the tab was),\n // not before it.\n if (tg.panelIds.includes(this._animState.sourceTabId))\n continue;\n const effectivePids = tg.panelIds.filter((pid) => pid !== this._animState.sourceTabId &&\n !(sourceGroupPanelIds === null || sourceGroupPanelIds === void 0 ? void 0 : sourceGroupPanelIds.has(pid)));\n if (effectivePids.length === 0)\n continue;\n const firstIdx = this._tabs.findIndex((t) => t.value.panel.id === effectivePids[0]);\n // Only consider chip-shifting when dropping outside the\n // group, or when dropping inside a collapsed group (whose\n // tabs are invisible).\n const shouldShiftChip = !this._animState.targetTabGroupId ||\n (this._animState.targetTabGroupId === tg.id &&\n tg.collapsed);\n if (!shouldShiftChip)\n continue;\n if (firstIdx >= insertionIndex) {\n let hasTabs = false;\n for (let j = insertionIndex; j < firstIdx; j++) {\n const pid = this._tabs[j].value.panel.id;\n if (pid === this._animState.sourceTabId)\n continue;\n if (sourceGroupPanelIds === null || sourceGroupPanelIds === void 0 ? void 0 : sourceGroupPanelIds.has(pid))\n continue;\n hasTabs = true;\n break;\n }\n if (!hasTabs) {\n const chipEntry = this._tabGroupManager.chipRenderers.get(tg.id);\n if (chipEntry) {\n chipToShift = chipEntry.chip.element;\n }\n }\n break;\n }\n }\n }\n // Helper: pick the correct shifting class for tabs vs chips.\n const shiftingClass = (el) => el.classList.contains('dv-tab-group-chip')\n ? 'dv-tab-group-chip--shifting'\n : 'dv-tab--shifting';\n // Helper: apply a margin-left value to an element, optionally\n // bypassing CSS transitions for instant positioning.\n const setMargin = (el, value) => {\n if (skipTransition) {\n el.style.transition = 'none';\n el.style.marginLeft = value;\n void el.offsetHeight;\n el.style.removeProperty('transition');\n }\n else {\n el.style.marginLeft = value;\n }\n toggleClass(el, shiftingClass(el), true);\n };\n const clearMargin = (el) => {\n const cls = shiftingClass(el);\n // Remove any previous pending listener for this element\n const prev = this._pendingMarginCleanups.get(el);\n if (prev) {\n prev();\n }\n if (skipTransition || !el.style.marginLeft) {\n el.style.removeProperty('margin-left');\n toggleClass(el, cls, false);\n }\n else {\n el.style.marginLeft = '0px';\n toggleClass(el, cls, true);\n const onEnd = () => {\n el.style.removeProperty('margin-left');\n toggleClass(el, cls, false);\n el.removeEventListener('transitionend', onEnd);\n clearTimeout(fallbackTimer);\n this._pendingMarginCleanups.delete(el);\n };\n // Fallback in case transitionend never fires\n // (e.g. element removed from DOM mid-transition)\n const fallbackTimer = setTimeout(onEnd, 300);\n this._pendingMarginCleanups.set(el, onEnd);\n el.addEventListener('transitionend', onEnd);\n }\n };\n let gapApplied = false;\n // Reset all non-source chip margins first\n for (const [groupId, entry] of this._tabGroupManager.chipRenderers) {\n if (groupId === this._animState.sourceTabGroupId)\n continue;\n clearMargin(entry.chip.element);\n }\n // Apply gap to chip if insertion is before a group\n if (chipToShift) {\n setMargin(chipToShift, `${gapWidth}px`);\n gapApplied = true;\n }\n for (let i = 0; i < this._tabs.length; i++) {\n const tab = this._tabs[i].value;\n if (tab.panel.id === this._animState.sourceTabId) {\n continue;\n }\n if (sourceGroupPanelIds === null || sourceGroupPanelIds === void 0 ? void 0 : sourceGroupPanelIds.has(tab.panel.id)) {\n continue;\n }\n if (!gapApplied && i >= insertionIndex) {\n setMargin(tab.element, `${gapWidth}px`);\n gapApplied = true;\n }\n else {\n clearMargin(tab.element);\n }\n }\n // Reposition underlines to follow shifted chips/tabs\n this._tabGroupManager.trackUnderlines();\n }\n resetTabTransforms() {\n // Cancel any pending margin transitionend listeners\n for (const [, cleanup] of this._pendingMarginCleanups) {\n cleanup();\n }\n this._pendingMarginCleanups.clear();\n for (const tab of this._tabs) {\n tab.value.element.style.removeProperty('margin-left');\n tab.value.element.style.removeProperty('margin-right');\n tab.value.element.style.removeProperty('margin-top');\n tab.value.element.style.removeProperty('margin-bottom');\n tab.value.element.style.removeProperty('transform');\n toggleClass(tab.value.element, 'dv-tab--shifting', false);\n }\n for (const [, entry] of this._tabGroupManager.chipRenderers) {\n entry.chip.element.style.removeProperty('margin-left');\n toggleClass(entry.chip.element, 'dv-tab-group-chip--shifting', false);\n }\n this._tabGroupManager.positionUnderlines();\n }\n /**\n * Commit a group-drag drop: clear drag classes, move the group\n * in the model, and run a FLIP animation.\n */\n _commitGroupMove(sourceTabGroupId, insertionIndex) {\n var _a, _b;\n // Read transfer data first.\n const data = getPanelData();\n // Synchronously dispose the source chip's drag sources, which\n // clears the panelTransfer payload + iframe shield. Cross-group\n // moves dissolve the source chip on a microtask, which is too\n // late: a synchronous `getPanelData()` after this method (or any\n // sibling dragover handler firing in the same tick) would\n // otherwise see stale data still referencing the old tabGroupId.\n this._tabGroupManager.disposeChipDrag(sourceTabGroupId);\n // Check if the tab group exists in this group (within-group reorder)\n // or in another group (cross-group move).\n const isLocal = this.group.model\n .getTabGroups()\n .some((tg) => tg.id === sourceTabGroupId);\n if (isLocal) {\n if (((_a = this.accessor.options.theme) === null || _a === void 0 ? void 0 : _a.tabAnimation) === 'smooth') {\n this._clearGroupDragClasses(sourceTabGroupId);\n const firstPositions = this.snapshotTabPositions();\n this.resetTabTransforms();\n this.group.model.moveTabGroup(sourceTabGroupId, insertionIndex);\n this.runFlipAnimation(firstPositions, '', false);\n }\n else {\n this._tabGroupManager.skipNextCollapseAnimation = true;\n this.group.model.moveTabGroup(sourceTabGroupId, insertionIndex);\n }\n }\n else if (data) {\n // Cross-group: delegate to the component-level move which\n // handles panel transfer and tab group recreation.\n // Use the REAL tab group ID from transfer data, not the\n // potentially stale one from _animState.\n //\n // Clear any inline gap margin / shifting class applied to\n // destination tabs during dragover. Cross-group moves don't\n // run the FLIP path, and `moveGroupOrPanel` only inserts new\n // panels — it doesn't recreate existing destination tabs, so\n // their inline `margin-left` would otherwise persist as a\n // visible gap (issue #1243).\n this.resetTabTransforms();\n this.accessor.moveGroupOrPanel({\n from: {\n groupId: data.groupId,\n tabGroupId: (_b = data.tabGroupId) !== null && _b !== void 0 ? _b : sourceTabGroupId,\n },\n to: {\n group: this.group,\n position: 'center',\n index: insertionIndex,\n },\n });\n }\n }\n _clearGroupDragClasses(sourceTabGroupId) {\n const chipEntry = this._tabGroupManager.chipRenderers.get(sourceTabGroupId);\n if (chipEntry) {\n this._removeClassInstantlyBatch([chipEntry.chip.element], 'dv-tab-group-chip--dragging');\n }\n this._removeClassInstantlyBatch(this._tabs.map((t) => t.value.element), 'dv-tab--dragging');\n // Restore underline\n const underline = this._tabGroupManager.groupUnderlines.get(sourceTabGroupId);\n if (underline) {\n underline.style.removeProperty('display');\n }\n // The subsequent moveTabGroup will re-create tabs and call\n // updateTabGroups → _updateTabGroupClasses. For collapsed groups\n // the new tabs don't have dv-tab--group-collapsed yet, which\n // would trigger the collapse animation. Skip it.\n this._tabGroupManager.skipNextCollapseAnimation = true;\n }\n resetDragAnimation() {\n this._pendingCollapse = false;\n // After a drop, `tab.onDrop` consumes _animState (sets it to null)\n // and immediately calls `runFlipAnimation`, which sets transforms\n // and queues an rAF to trigger the CSS transition. dragend fires\n // synchronously on the source element BEFORE that rAF runs — if\n // we cleared transforms here we'd clobber the in-flight FLIP, so\n // gate the cleanup on _animState still being set (i.e. drag was\n // cancelled rather than dropped).\n if (this._animState) {\n this.resetTabTransforms();\n if (this._animState.sourceTabGroupId) {\n this._clearGroupDragClasses(this._animState.sourceTabGroupId);\n }\n else {\n this._removeClassInstantlyBatch(this._tabs.map((t) => t.value.element), 'dv-tab--dragging');\n }\n this._animState = null;\n // Restore any hidden underlines from group drags.\n for (const [, el] of this._tabGroupManager.groupUnderlines) {\n el.style.removeProperty('display');\n }\n }\n }\n runFlipAnimation(firstPositions, sourceTabId, isCrossGroup = false, animRange) {\n const isVertical = this._direction === 'vertical';\n let hasAnimation = false;\n for (let i = 0; i < this._tabs.length; i++) {\n const tab = this._tabs[i];\n const panelId = tab.value.panel.id;\n if (panelId === sourceTabId) {\n if (isCrossGroup) {\n // Newly inserted tab: slide in from the end\n const rect = tab.value.element.getBoundingClientRect();\n tab.value.element.style.transform = isVertical\n ? `translateY(${rect.height}px)`\n : `translateX(${rect.width}px)`;\n toggleClass(tab.value.element, 'dv-tab--shifting', true);\n hasAnimation = true;\n }\n continue;\n }\n // Skip tabs outside the affected range (they don't logically move)\n if (animRange !== undefined &&\n (i < animRange.from || i > animRange.to)) {\n continue;\n }\n const firstRect = firstPositions.get(panelId);\n if (!firstRect) {\n continue;\n }\n const lastRect = tab.value.element.getBoundingClientRect();\n const delta = isVertical\n ? firstRect.top - lastRect.top\n : firstRect.left - lastRect.left;\n if (Math.abs(delta) < 1) {\n continue;\n }\n tab.value.element.style.transform = isVertical\n ? `translateY(${delta}px)`\n : `translateX(${delta}px)`;\n toggleClass(tab.value.element, 'dv-tab--shifting', true);\n hasAnimation = true;\n }\n if (!hasAnimation) {\n return;\n }\n requestAnimationFrame(() => {\n var _a;\n for (const tab of this._tabs) {\n if (tab.value.element.style.transform) {\n tab.value.element.style.transform = '';\n }\n }\n // Track underlines during the FLIP transition so they\n // follow tabs as they slide to their final positions.\n this._tabGroupManager.trackUnderlines();\n // Clean up any previous flip transition listener\n (_a = this._flipTransitionCleanup) === null || _a === void 0 ? void 0 : _a.call(this);\n const onTransitionEnd = (event) => {\n if (event.propertyName === 'transform') {\n cleanup();\n for (const tab of this._tabs) {\n toggleClass(tab.value.element, 'dv-tab--shifting', false);\n }\n // Final reposition after animation settles\n this._tabGroupManager.positionUnderlines();\n }\n };\n const cleanup = () => {\n this._tabsList.removeEventListener('transitionend', onTransitionEnd);\n this._flipTransitionCleanup = null;\n };\n this._flipTransitionCleanup = cleanup;\n this._tabsList.addEventListener('transitionend', onTransitionEnd);\n });\n }\n}\n\nconst createSvgElementFromPath = (params) => {\n const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n svg.setAttributeNS(null, 'height', params.height);\n svg.setAttributeNS(null, 'width', params.width);\n svg.setAttributeNS(null, 'viewBox', params.viewbox);\n svg.setAttributeNS(null, 'aria-hidden', 'false');\n svg.setAttributeNS(null, 'focusable', 'false');\n svg.classList.add('dv-svg');\n const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n path.setAttributeNS(null, 'd', params.path);\n svg.appendChild(path);\n return svg;\n};\nconst createCloseButton = () => createSvgElementFromPath({\n width: '11',\n height: '11',\n viewbox: '0 0 28 28',\n 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',\n});\nconst createExpandMoreButton = () => createSvgElementFromPath({\n width: '11',\n height: '11',\n viewbox: '0 0 24 15',\n path: 'M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z',\n});\nconst createChevronRightButton = () => createSvgElementFromPath({\n width: '11',\n height: '11',\n viewbox: '0 0 15 25',\n path: 'M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z',\n});\n\nfunction createDropdownElementHandle() {\n const el = document.createElement('div');\n el.className = 'dv-tabs-overflow-dropdown-default';\n const text = document.createElement('span');\n text.textContent = ``;\n const icon = createChevronRightButton();\n el.appendChild(icon);\n el.appendChild(text);\n return {\n element: el,\n update: (params) => {\n text.textContent = `${params.tabs}`;\n },\n };\n}\n\nclass TabsContainer extends CompositeDisposable {\n get onTabDragStart() {\n return this.tabs.onTabDragStart;\n }\n get panels() {\n return this.tabs.panels;\n }\n get size() {\n return this.tabs.size;\n }\n get hidden() {\n return this._hidden;\n }\n set hidden(value) {\n this._hidden = value;\n this.element.style.display = value ? 'none' : '';\n }\n get direction() {\n return this._direction;\n }\n set direction(value) {\n this._direction = value;\n if (value === 'vertical') {\n addClasses(this._element, 'dv-groupview-header-vertical');\n addClasses(this.rightActionsContainer, 'dv-right-actions-container-vertical');\n this.tabs.direction = value;\n }\n else {\n removeClasses(this._element, 'dv-groupview-header-vertical');\n removeClasses(this.rightActionsContainer, 'dv-right-actions-container-vertical');\n this.tabs.direction = value;\n }\n }\n get element() {\n return this._element;\n }\n constructor(accessor, group) {\n super();\n this.accessor = accessor;\n this.group = group;\n this._hidden = false;\n this._direction = 'horizontal';\n this.dropdownPart = null;\n this._overflowTabs = [];\n this._overflowTabGroups = [];\n this._dropdownDisposable = new MutableDisposable();\n this._onDrop = new Emitter();\n this.onDrop = this._onDrop.event;\n this._onGroupDragStart = new Emitter();\n this.onGroupDragStart = this._onGroupDragStart.event;\n this._onWillShowOverlay = new Emitter();\n this.onWillShowOverlay = this._onWillShowOverlay.event;\n this._element = document.createElement('div');\n this._element.className = 'dv-tabs-and-actions-container';\n toggleClass(this._element, 'dv-full-width-single-tab', this.accessor.options.singleTabMode === 'fullwidth');\n this.rightActionsContainer = document.createElement('div');\n this.rightActionsContainer.className = 'dv-right-actions-container';\n this.leftActionsContainer = document.createElement('div');\n this.leftActionsContainer.className = 'dv-left-actions-container';\n this.preActionsContainer = document.createElement('div');\n this.preActionsContainer.className = 'dv-pre-actions-container';\n this.tabs = new Tabs(group, accessor, {\n showTabsOverflowControl: !accessor.options.disableTabsOverflowList,\n });\n this.voidContainer = new VoidContainer(this.accessor, this.group);\n this.tabs.voidContainer = this.voidContainer.element;\n this._element.appendChild(this.preActionsContainer);\n this._element.appendChild(this.tabs.element);\n this._element.appendChild(this.leftActionsContainer);\n this._element.appendChild(this.voidContainer.element);\n this._element.appendChild(this.rightActionsContainer);\n this.tabs.setExtendedDropZone(this._element);\n this.addDisposables(this.tabs.onDrop((e) => this._onDrop.fire(e)), this.tabs.onWillShowOverlay((e) => this._onWillShowOverlay.fire(e)), accessor.onDidOptionsChange(() => {\n this.tabs.showTabsOverflowControl =\n !accessor.options.disableTabsOverflowList;\n }), this.tabs.onOverflowTabsChange((event) => {\n this.toggleDropdown(event);\n }), this.tabs, this._onWillShowOverlay, this._onDrop, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {\n this._onGroupDragStart.fire({\n nativeEvent: event,\n group: this.group,\n });\n }), this.voidContainer.onDrop((event) => {\n // If an active group drag is in progress, let Tabs handle it\n if (this.tabs.handleVoidDrop()) {\n return;\n }\n this._onDrop.fire({\n event: event.nativeEvent,\n index: this.tabs.size,\n });\n }), this.voidContainer.onWillShowOverlay((event) => {\n this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {\n kind: 'header_space',\n panel: this.group.activePanel,\n api: this.accessor.api,\n group: this.group,\n getData: getPanelData,\n }));\n }), addDisposableListener(this.leftActionsContainer, 'dragleave', (event) => {\n const related = event.relatedTarget;\n if (!this.leftActionsContainer.contains(related) &&\n !this._element.contains(related)) {\n // Left the header entirely\n this.tabs.clearExternalAnimState();\n }\n }), addDisposableListener(this.voidContainer.element, 'dragleave', (event) => {\n const related = event.relatedTarget;\n if (!this.voidContainer.element.contains(related)) {\n if (this._element.contains(related)) {\n // Moved to another part of the header — keep state\n this.tabs.setExternalInsertionIndex(null);\n }\n else {\n // Left the header entirely\n this.tabs.clearExternalAnimState();\n }\n }\n }), addDisposableListener(this.voidContainer.element, 'pointerdown', (event) => {\n if (event.defaultPrevented) {\n return;\n }\n const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;\n if (isFloatingGroupsEnabled &&\n event.shiftKey &&\n this.group.api.location.type !== 'floating' &&\n this.group.api.location.type !== 'edge') {\n event.preventDefault();\n const { top, left } = this.element.getBoundingClientRect();\n const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();\n this.accessor.addFloatingGroup(this.group, {\n x: left - rootLeft + 20,\n y: top - rootTop + 20,\n inDragMode: true,\n });\n }\n }));\n }\n show() {\n if (!this.hidden) {\n this.element.style.display = '';\n }\n }\n hide() {\n this._element.style.display = 'none';\n }\n setRightActionsElement(element) {\n if (this.rightActions === element) {\n return;\n }\n if (this.rightActions) {\n this.rightActions.remove();\n this.rightActions = undefined;\n }\n if (element) {\n this.rightActionsContainer.appendChild(element);\n this.rightActions = element;\n }\n }\n setLeftActionsElement(element) {\n if (this.leftActions === element) {\n return;\n }\n if (this.leftActions) {\n this.leftActions.remove();\n this.leftActions = undefined;\n }\n if (element) {\n this.leftActionsContainer.appendChild(element);\n this.leftActions = element;\n }\n }\n setPrefixActionsElement(element) {\n if (this.preActions === element) {\n return;\n }\n if (this.preActions) {\n this.preActions.remove();\n this.preActions = undefined;\n }\n if (element) {\n this.preActionsContainer.appendChild(element);\n this.preActions = element;\n }\n }\n isActive(tab) {\n return this.tabs.isActive(tab);\n }\n indexOf(id) {\n return this.tabs.indexOf(id);\n }\n getTabId(panelId) {\n return this.tabs.getTabId(panelId);\n }\n setActive(_isGroupActive) {\n // noop\n }\n delete(id) {\n this.tabs.delete(id);\n this.updateClassnames();\n }\n setActivePanel(panel) {\n this.tabs.setActivePanel(panel);\n }\n focusActiveTab() {\n this.tabs.focusActiveTab();\n }\n openPanel(panel, index = this.tabs.size) {\n this.tabs.openPanel(panel, index);\n this.updateClassnames();\n }\n closePanel(panel) {\n this.delete(panel.id);\n }\n updateClassnames() {\n toggleClass(this._element, 'dv-single-tab', this.size === 1);\n }\n toggleDropdown(options) {\n const tabs = options.reset ? [] : options.tabs;\n const tabGroups = options.reset ? [] : options.tabGroups;\n this._overflowTabs = tabs;\n this._overflowTabGroups = tabGroups;\n const totalCount = this._overflowTabs.length;\n if (totalCount > 0 && this.dropdownPart) {\n this.dropdownPart.update({ tabs: totalCount });\n return;\n }\n if (totalCount === 0) {\n this._dropdownDisposable.dispose();\n return;\n }\n const root = document.createElement('div');\n root.className = 'dv-tabs-overflow-dropdown-root';\n const part = createDropdownElementHandle();\n part.update({ tabs: totalCount });\n this.dropdownPart = part;\n root.appendChild(part.element);\n this.rightActionsContainer.prepend(root);\n this._dropdownDisposable.value = new CompositeDisposable(Disposable.from(() => {\n var _a, _b;\n root.remove();\n (_b = (_a = this.dropdownPart) === null || _a === void 0 ? void 0 : _a.dispose) === null || _b === void 0 ? void 0 : _b.call(_a);\n this.dropdownPart = null;\n }), addDisposableListener(root, 'pointerdown', (event) => {\n event.preventDefault();\n }, { capture: true }), addDisposableListener(root, 'click', (event) => {\n const el = document.createElement('div');\n el.style.overflow = 'auto';\n el.className = 'dv-tabs-overflow-container';\n // Build lookup: panelId → tabGroup for overflow groups\n const overflowGroupSet = new Set(this._overflowTabGroups);\n const allTabGroups = this.group.model.getTabGroups();\n const panelToGroup = new Map();\n for (const tg of allTabGroups) {\n if (overflowGroupSet.has(tg.id)) {\n for (const pid of tg.panelIds) {\n panelToGroup.set(pid, tg);\n }\n }\n }\n // Track which groups have already been rendered\n const renderedGroups = new Set();\n for (const tab of this.tabs.tabs.filter((tab) => this._overflowTabs.includes(tab.panel.id))) {\n const tg = panelToGroup.get(tab.panel.id);\n // If this tab belongs to an overflow group, render the\n // group header before its first member tab.\n if (tg && !renderedGroups.has(tg.id)) {\n renderedGroups.add(tg.id);\n const groupHeader = document.createElement('div');\n groupHeader.className = 'dv-tabs-overflow-group-header';\n const colorDot = document.createElement('span');\n colorDot.className = 'dv-tabs-overflow-group-color';\n applyTabGroupAccent(colorDot, tg.color, this.accessor.tabGroupColorPalette);\n groupHeader.appendChild(colorDot);\n const labelSpan = document.createElement('span');\n labelSpan.className = 'dv-tabs-overflow-group-label';\n labelSpan.textContent = tg.label || tg.id;\n groupHeader.appendChild(labelSpan);\n if (tg.collapsed) {\n const badge = document.createElement('span');\n badge.className =\n 'dv-tabs-overflow-group-collapsed-badge';\n badge.textContent = `${tg.panelIds.length}`;\n groupHeader.appendChild(badge);\n }\n groupHeader.addEventListener('click', () => {\n this.accessor\n .getPopupServiceForGroup(this.group)\n .close();\n if (tg.collapsed) {\n tg.expand();\n }\n // Activate the first panel in the group\n const firstPanelId = tg.panelIds[0];\n if (firstPanelId) {\n const panel = this.group.panels.find((p) => p.id === firstPanelId);\n this.accessor.withOrigin('user', () => panel === null || panel === void 0 ? void 0 : panel.api.setActive());\n }\n });\n el.appendChild(groupHeader);\n }\n const panelObject = this.group.panels.find((panel) => panel === tab.panel);\n const tabComponent = panelObject.view.createTabRenderer('headerOverflow');\n const child = tabComponent.element;\n const wrapper = document.createElement('div');\n toggleClass(wrapper, 'dv-tab', true);\n toggleClass(wrapper, 'dv-active-tab', panelObject.api.isActive);\n toggleClass(wrapper, 'dv-inactive-tab', !panelObject.api.isActive);\n if (tg) {\n toggleClass(wrapper, 'dv-tab--grouped', true);\n }\n wrapper.addEventListener('click', (event) => {\n this.accessor\n .getPopupServiceForGroup(this.group)\n .close();\n if (event.defaultPrevented) {\n return;\n }\n if (tg === null || tg === void 0 ? void 0 : tg.collapsed) {\n tg.expand();\n }\n tab.element.scrollIntoView();\n this.accessor.withOrigin('user', () => tab.panel.api.setActive());\n });\n wrapper.appendChild(child);\n el.appendChild(wrapper);\n }\n const relativeParent = findRelativeZIndexParent(root);\n this.accessor\n .getPopupServiceForGroup(this.group)\n .openPopover(el, {\n x: event.clientX,\n y: event.clientY,\n zIndex: (relativeParent === null || relativeParent === void 0 ? void 0 : relativeParent.style.zIndex)\n ? `calc(${relativeParent.style.zIndex} * 2)`\n : undefined,\n });\n }));\n }\n updateDragAndDropState() {\n this.tabs.updateDragAndDropState();\n this.voidContainer.updateDragAndDropState();\n }\n updateTabGroups() {\n this.tabs.updateTabGroups();\n }\n refreshTabGroupAccent() {\n this.tabs.refreshTabGroupAccent();\n }\n}\n\nclass DockviewUnhandledDragOverEvent extends AcceptableEvent {\n constructor(nativeEvent, target, position, getData, group) {\n super();\n this.nativeEvent = nativeEvent;\n this.target = target;\n this.position = position;\n this.getData = getData;\n this.group = group;\n }\n}\nconst PROPERTY_KEYS_DOCKVIEW = (() => {\n /**\n * by readong the keys from an empty value object TypeScript will error\n * when we add or remove new properties to `DockviewOptions`\n */\n const properties = {\n disableAutoResizing: undefined,\n hideBorders: undefined,\n singleTabMode: undefined,\n disableFloatingGroups: undefined,\n floatingGroupBounds: undefined,\n transformFloatingGroupDrag: undefined,\n floatingGroupDragHandle: undefined,\n popoutUrl: undefined,\n nonce: undefined,\n defaultRenderer: undefined,\n defaultHeaderPosition: undefined,\n debug: undefined,\n locked: undefined,\n disableDnd: undefined,\n dndStrategy: undefined,\n className: undefined,\n noPanelsOverlay: undefined,\n dndEdges: undefined,\n theme: undefined,\n disableTabsOverflowList: undefined,\n scrollbars: undefined,\n getTabContextMenuItems: undefined,\n getTabGroupChipContextMenuItems: undefined,\n createTabGroupChipComponent: undefined,\n createGroupDragGhostComponent: undefined,\n dropOverlayModel: undefined,\n announcements: undefined,\n getAnnouncement: undefined,\n announcer: undefined,\n messages: undefined,\n keyboardNavigation: undefined,\n tabGroupColors: undefined,\n tabGroupAccent: undefined,\n };\n return Object.keys(properties);\n})();\nfunction isPanelOptionsWithPanel(data) {\n if (data.referencePanel) {\n return true;\n }\n return false;\n}\nfunction isPanelOptionsWithGroup(data) {\n if (data.referenceGroup) {\n return true;\n }\n return false;\n}\nfunction isGroupOptionsWithPanel(data) {\n if (data.referencePanel) {\n return true;\n }\n return false;\n}\nfunction isGroupOptionsWithGroup(data) {\n if (data.referenceGroup) {\n return true;\n }\n return false;\n}\n\nclass TabGroup extends CompositeDisposable {\n get label() {\n return this._label;\n }\n get color() {\n return this._color;\n }\n get componentParams() {\n return this._componentParams;\n }\n setLabel(value) {\n if (this.isDisposed || this._label === value) {\n return;\n }\n this._label = value;\n this._onDidChange.fire();\n }\n setColor(value) {\n if (this.isDisposed) {\n return;\n }\n const next = value === '' ? undefined : value;\n if (this._color === next) {\n return;\n }\n this._color = next;\n this._onDidChange.fire();\n }\n setComponentParams(value) {\n if (this.isDisposed) {\n return;\n }\n this._componentParams = value;\n this._onDidChange.fire();\n }\n get collapsed() {\n return this._collapsed;\n }\n get panelIds() {\n return this._panelIds;\n }\n get size() {\n return this._panelIds.length;\n }\n get isEmpty() {\n return this._panelIds.length === 0;\n }\n constructor(id, options) {\n var _a, _b;\n super();\n this.id = id;\n this._collapsed = false;\n this._panelIds = [];\n this._onDidChange = new Emitter();\n this.onDidChange = this._onDidChange.event;\n this._onDidPanelChange = new Emitter();\n this.onDidPanelChange = this._onDidPanelChange.event;\n this._onDidCollapseChange = new Emitter();\n this.onDidCollapseChange = this._onDidCollapseChange.event;\n this._onDidDestroy = new Emitter();\n this.onDidDestroy = this._onDidDestroy.event;\n this._label = (_a = options === null || options === void 0 ? void 0 : options.label) !== null && _a !== void 0 ? _a : '';\n this._color = (options === null || options === void 0 ? void 0 : options.color) === '' ? undefined : options === null || options === void 0 ? void 0 : options.color;\n this._collapsed = (_b = options === null || options === void 0 ? void 0 : options.collapsed) !== null && _b !== void 0 ? _b : false;\n this._componentParams = options === null || options === void 0 ? void 0 : options.componentParams;\n this.addDisposables(this._onDidChange, this._onDidPanelChange, this._onDidCollapseChange, this._onDidDestroy);\n }\n addPanel(panelId, index) {\n if (this.isDisposed) {\n return;\n }\n if (this._panelIds.includes(panelId)) {\n return;\n }\n const insertIndex = index !== undefined\n ? Math.max(0, Math.min(index, this._panelIds.length))\n : this._panelIds.length;\n this._panelIds.splice(insertIndex, 0, panelId);\n this._onDidPanelChange.fire({ panelId, type: 'add' });\n }\n removePanel(panelId) {\n if (this.isDisposed) {\n return false;\n }\n const index = this._panelIds.indexOf(panelId);\n if (index === -1) {\n return false;\n }\n this._panelIds.splice(index, 1);\n this._onDidPanelChange.fire({ panelId, type: 'remove' });\n return true;\n }\n indexOfPanel(panelId) {\n return this._panelIds.indexOf(panelId);\n }\n containsPanel(panelId) {\n return this._panelIds.includes(panelId);\n }\n collapse() {\n if (this.isDisposed || this._collapsed) {\n return;\n }\n this._collapsed = true;\n this._onDidCollapseChange.fire(true);\n }\n expand() {\n if (this.isDisposed || !this._collapsed) {\n return;\n }\n this._collapsed = false;\n this._onDidCollapseChange.fire(false);\n }\n toggle() {\n if (this._collapsed) {\n this.expand();\n }\n else {\n this.collapse();\n }\n }\n toJSON() {\n const result = {\n id: this.id,\n collapsed: this._collapsed,\n panelIds: [...this._panelIds],\n };\n if (this._label) {\n result.label = this._label;\n }\n if (this._color !== undefined) {\n result.color = this._color;\n }\n if (this._componentParams !== undefined) {\n result.componentParams = this._componentParams;\n }\n return result;\n }\n dispose() {\n this._onDidDestroy.fire();\n super.dispose();\n }\n}\n\nclass DockviewDidDropEvent extends DockviewEvent {\n /**\n * `PointerEvent` for touch drags has no `dataTransfer`; use\n * `getData()` for the dockview payload regardless of input method.\n */\n get nativeEvent() {\n return this.options.nativeEvent;\n }\n get position() {\n return this.options.position;\n }\n get panel() {\n return this.options.panel;\n }\n get group() {\n return this.options.group;\n }\n get api() {\n return this.options.api;\n }\n constructor(options) {\n super();\n this.options = options;\n }\n getData() {\n return this.options.getData();\n }\n}\nclass DockviewWillDropEvent extends DockviewDidDropEvent {\n get kind() {\n return this._kind;\n }\n constructor(options) {\n super(options);\n this._kind = options.kind;\n }\n}\nclass DockviewGroupPanelModel extends CompositeDisposable {\n get tabGroups() {\n return this._tabGroups;\n }\n get element() {\n throw new Error('dockview: not supported');\n }\n get activePanel() {\n return this._activePanel;\n }\n /** DOM id of the content container (the group's tabpanel), referenced by each tab's `aria-controls`. */\n get contentContainerId() {\n return this.contentContainer.element.id;\n }\n /** The group's content drop target — lets keyboard docking preview a drop here. */\n get contentDropTarget() {\n return this.contentContainer.dropTarget;\n }\n get locked() {\n return this._locked;\n }\n set locked(value) {\n this._locked = value;\n toggleClass(this.container, 'dv-locked-groupview', value === 'no-drop-target' || value);\n }\n get isActive() {\n return this._isGroupActive;\n }\n get panels() {\n return this._panels;\n }\n get size() {\n return this._panels.length;\n }\n get isEmpty() {\n return this._panels.length === 0;\n }\n get hasWatermark() {\n return !!(this.watermark && this.container.contains(this.watermark.element));\n }\n get header() {\n return this.tabsContainer;\n }\n get isContentFocused() {\n if (!document.activeElement) {\n return false;\n }\n return isAncestor(document.activeElement, this.contentContainer.element);\n }\n get headerPosition() {\n var _a;\n return (_a = this._headerPosition) !== null && _a !== void 0 ? _a : 'top';\n }\n set headerPosition(value) {\n var _a;\n this._headerPosition = value;\n removeClasses(this.container, 'dv-groupview-header-top', 'dv-groupview-header-bottom', 'dv-groupview-header-left', 'dv-groupview-header-right');\n addClasses(this.container, `dv-groupview-header-${value}`);\n const direction = value === 'top' || value === 'bottom' ? 'horizontal' : 'vertical';\n this.tabsContainer.direction = direction;\n this.header.direction = direction;\n // resize the active panel to fit the new header direction\n // if not, the panel will overflow the tabs container\n if ((_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.layout) {\n this._activePanel.layout(this._width, this._height);\n }\n this.updateHeaderActions();\n }\n get location() {\n return this._location;\n }\n set location(value) {\n this._location = value;\n toggleClass(this.container, 'dv-groupview-floating', false);\n toggleClass(this.container, 'dv-groupview-popout', false);\n toggleClass(this.container, 'dv-groupview-edge', false);\n // Mouse and touch drop targets must agree on accepted zones.\n const applyZones = (zones) => {\n this.contentContainer.dropTarget.setTargetZones(zones);\n this.contentContainer.pointerDropTarget.setTargetZones(zones);\n };\n switch (value.type) {\n case 'grid':\n applyZones(['top', 'bottom', 'left', 'right', 'center']);\n break;\n case 'floating':\n // Floating windows host their own nested gridview, so an edge\n // drop splits the window's layout just like the main grid.\n applyZones(['top', 'bottom', 'left', 'right', 'center']);\n toggleClass(this.container, 'dv-groupview-floating', true);\n break;\n case 'popout':\n // Popout windows host their own nested gridview, so an edge\n // drop splits the window's layout just like the main grid.\n applyZones(['top', 'bottom', 'left', 'right', 'center']);\n toggleClass(this.container, 'dv-groupview-popout', true);\n break;\n case 'edge':\n applyZones(['center']);\n toggleClass(this.container, 'dv-groupview-edge', true);\n break;\n }\n this.groupPanel.api._onDidLocationChange.fire({\n location: this.location,\n });\n }\n constructor(container, accessor, id, options, groupPanel) {\n var _a, _b;\n super();\n this.container = container;\n this.accessor = accessor;\n this.id = id;\n this.options = options;\n this.groupPanel = groupPanel;\n this._isGroupActive = false;\n this._locked = false;\n this._location = { type: 'grid' };\n this.mostRecentlyUsed = [];\n this._overwriteRenderContainer = null;\n this._overwriteDropTargetContainer = null;\n this._onDidChange = new Emitter();\n this.onDidChange = this._onDidChange.event;\n this._width = 0;\n this._height = 0;\n this._panels = [];\n this._panelDisposables = new Map();\n this._tabGroupDisposables = new Map();\n this._pendingMicrotaskDisposables = new Set();\n this._onMove = new Emitter();\n this.onMove = this._onMove.event;\n this._onDidDrop = new Emitter();\n this.onDidDrop = this._onDidDrop.event;\n this._onWillDrop = new Emitter();\n this.onWillDrop = this._onWillDrop.event;\n this._onWillShowOverlay = new Emitter();\n this.onWillShowOverlay = this._onWillShowOverlay.event;\n this._onTabDragStart = new Emitter();\n this.onTabDragStart = this._onTabDragStart.event;\n this._onGroupDragStart = new Emitter();\n this.onGroupDragStart = this._onGroupDragStart.event;\n this._onDidAddPanel = new Emitter();\n this.onDidAddPanel = this._onDidAddPanel.event;\n this._onDidPanelTitleChange = new Emitter();\n this.onDidPanelTitleChange = this._onDidPanelTitleChange.event;\n this._onDidPanelParametersChange = new Emitter();\n this.onDidPanelParametersChange = this._onDidPanelParametersChange.event;\n this._onDidRemovePanel = new Emitter();\n this.onDidRemovePanel = this._onDidRemovePanel.event;\n this._onDidActivePanelChange = new Emitter();\n this.onDidActivePanelChange = this._onDidActivePanelChange.event;\n this._onUnhandledDragOver = new Emitter();\n this.onUnhandledDragOver = this._onUnhandledDragOver.event;\n this._tabGroups = [];\n this._tabGroupMap = new Map();\n this._panelToTabGroup = new Map();\n this._tabGroupIdCounter = 0;\n this._pendingTabGroupUpdate = false;\n this._onDidCreateTabGroup = new Emitter();\n this.onDidCreateTabGroup = this._onDidCreateTabGroup.event;\n this._onDidDestroyTabGroup = new Emitter();\n this.onDidDestroyTabGroup = this._onDidDestroyTabGroup.event;\n this._onDidAddPanelToTabGroup = new Emitter();\n this.onDidAddPanelToTabGroup = this._onDidAddPanelToTabGroup.event;\n this._onDidRemovePanelFromTabGroup = new Emitter();\n this.onDidRemovePanelFromTabGroup = this._onDidRemovePanelFromTabGroup.event;\n this._onDidTabGroupChange = new Emitter();\n this.onDidTabGroupChange = this._onDidTabGroupChange.event;\n this._onDidTabGroupCollapsedChange = new Emitter();\n this.onDidTabGroupCollapsedChange = this._onDidTabGroupCollapsedChange.event;\n toggleClass(this.container, 'dv-groupview', true);\n // Each group is a navigable region, labelled by its active panel\n // (see `updateAccessibleLabel`, driven on activation / title change).\n this.container.setAttribute('role', 'region');\n this._api = new DockviewApi(this.accessor);\n this.tabsContainer = new TabsContainer(this.accessor, this.groupPanel);\n this.contentContainer = new ContentContainer(this.accessor, this);\n container.append(this.tabsContainer.element, this.contentContainer.element);\n this.header.hidden = !!options.hideHeader;\n this.locked = (_a = options.locked) !== null && _a !== void 0 ? _a : false;\n this.headerPosition =\n (_b = options.headerPosition) !== null && _b !== void 0 ? _b : accessor.defaultHeaderPosition;\n this.addDisposables(\n // Keep the region's accessible name in sync when the active\n // panel's title changes (no-op when a non-active title changes).\n this._onDidPanelTitleChange.event(() => this.updateAccessibleLabel()), this._onTabDragStart, this._onGroupDragStart, this._onWillShowOverlay, this.tabsContainer.onTabDragStart((event) => {\n this._onTabDragStart.fire(event);\n }), this.tabsContainer.onGroupDragStart((event) => {\n this._onGroupDragStart.fire(event);\n }), this.tabsContainer.onDrop((event) => {\n var _a;\n // Capture panel data before handleDropEvent (which may trigger moves)\n const dragData = getPanelData();\n const draggedPanelId = (_a = dragData === null || dragData === void 0 ? void 0 : dragData.panelId) !== null && _a !== void 0 ? _a : null;\n this.handleDropEvent('header', event.event, 'center', event.index);\n // Update tab group membership after the move completes\n if (draggedPanelId && event.targetTabGroupId) {\n // Compute the local index within the target tab group\n // from the global panel index so the panel is inserted\n // at the correct position, not just appended.\n const tabGroup = this._tabGroupMap.get(event.targetTabGroupId);\n let localIndex;\n if (tabGroup) {\n const globalIdx = this._panels.findIndex((p) => p.id === draggedPanelId);\n if (globalIdx !== -1) {\n // Count how many of this group's panels\n // appear before the dragged panel\n localIndex = 0;\n for (const pid of tabGroup.panelIds) {\n const pidIdx = this._panels.findIndex((p) => p.id === pid);\n if (pidIdx < globalIdx) {\n localIndex++;\n }\n }\n }\n }\n this.addPanelToTabGroup(event.targetTabGroupId, draggedPanelId, localIndex);\n }\n else if (draggedPanelId && event.targetTabGroupId === null) {\n // Dropped outside any group — remove from current group\n this.removePanelFromTabGroup(draggedPanelId);\n }\n }), this.contentContainer.onDidFocus(() => {\n this.accessor.doSetGroupActive(this.groupPanel);\n }), this.contentContainer.onDidBlur(() => {\n // noop\n }), this.contentContainer.dropTarget.onDrop((event) => {\n this.handleDropEvent('content', event.nativeEvent, event.position);\n }), this.contentContainer.pointerDropTarget.onDrop((event) => {\n this.handleDropEvent('content', event.nativeEvent, event.position);\n }), this.tabsContainer.onWillShowOverlay((event) => {\n this._onWillShowOverlay.fire(event);\n }), this.contentContainer.dropTarget.onWillShowOverlay((event) => {\n this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {\n kind: 'content',\n panel: this.activePanel,\n api: this._api,\n group: this.groupPanel,\n getData: getPanelData,\n }));\n }), this.contentContainer.pointerDropTarget.onWillShowOverlay((event) => {\n this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {\n kind: 'content',\n panel: this.activePanel,\n api: this._api,\n group: this.groupPanel,\n getData: getPanelData,\n }));\n }), this._onMove, this._onDidChange, this._onDidDrop, this._onWillDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange, this._onUnhandledDragOver, this._onDidPanelTitleChange, this._onDidPanelParametersChange, this._onDidCreateTabGroup, this._onDidDestroyTabGroup, this._onDidAddPanelToTabGroup, this._onDidRemovePanelFromTabGroup, this._onDidTabGroupChange, this._onDidTabGroupCollapsedChange, this._onDidCreateTabGroup.event(() => {\n this._scheduleTabGroupUpdate();\n }), this._onDidDestroyTabGroup.event(() => {\n this._scheduleTabGroupUpdate();\n }), this._onDidAddPanelToTabGroup.event(() => {\n this._scheduleTabGroupUpdate();\n }), this._onDidRemovePanelFromTabGroup.event(() => {\n this._scheduleTabGroupUpdate();\n }), this._onDidTabGroupChange.event(() => {\n this._scheduleTabGroupUpdate();\n }), this._onDidTabGroupCollapsedChange.event(() => {\n this._scheduleTabGroupUpdate();\n }));\n }\n _scheduleTabGroupUpdate() {\n if (this._pendingTabGroupUpdate) {\n return;\n }\n this._pendingTabGroupUpdate = true;\n queueMicrotask(() => {\n this._pendingTabGroupUpdate = false;\n if (!this.isDisposed) {\n this.tabsContainer.updateTabGroups();\n }\n });\n }\n /**\n * Bracket a tab-group mutation as a layout transaction. `accessor` is\n * always a full {@link DockviewComponent} in production; the optional-call\n * fallback keeps partial test doubles (which omit `mutation`) working.\n * When nested inside a larger operation (a drag-driven move, fromJSON\n * restore) the component's depth counter folds it into the outer one.\n */\n _bracketTabGroupMutation(func) {\n return this.accessor.mutation\n ? this.accessor.mutation('tab-group', func)\n : func();\n }\n createTabGroup(options) {\n return this._bracketTabGroupMutation(() => this._doCreateTabGroup(options));\n }\n _doCreateTabGroup(options) {\n var _a;\n const id = (_a = options === null || options === void 0 ? void 0 : options.id) !== null && _a !== void 0 ? _a : `tg-${this.id}-${this._tabGroupIdCounter++}`;\n const tabGroup = new TabGroup(id, {\n label: options === null || options === void 0 ? void 0 : options.label,\n color: options === null || options === void 0 ? void 0 : options.color,\n collapsed: options === null || options === void 0 ? void 0 : options.collapsed,\n componentParams: options === null || options === void 0 ? void 0 : options.componentParams,\n });\n this._tabGroups.push(tabGroup);\n this._tabGroupMap.set(id, tabGroup);\n this._tabGroupDisposables.set(id, new CompositeDisposable(tabGroup.onDidChange(() => {\n this._onDidTabGroupChange.fire({ tabGroup });\n }), tabGroup.onDidCollapseChange((isCollapsed) => {\n if (isCollapsed) {\n this._handleGroupCollapse(tabGroup);\n }\n else {\n this._handleGroupExpand(tabGroup);\n }\n this._onDidTabGroupCollapsedChange.fire({\n tabGroup,\n });\n }), tabGroup.onDidDestroy(() => {\n this._removeTabGroupInternal(tabGroup);\n })));\n this._onDidCreateTabGroup.fire({ tabGroup });\n return tabGroup;\n }\n dissolveTabGroup(tabGroupId) {\n const tabGroup = this._tabGroupMap.get(tabGroupId);\n if (!tabGroup) {\n return;\n }\n this._bracketTabGroupMutation(() => {\n // Remove all panels from the group (they stay in the flat panel list)\n const panelIds = [...tabGroup.panelIds];\n for (const panelId of panelIds) {\n tabGroup.removePanel(panelId);\n this._panelToTabGroup.delete(panelId);\n this._onDidRemovePanelFromTabGroup.fire({ tabGroup, panelId });\n }\n tabGroup.dispose();\n });\n }\n addPanelToTabGroup(tabGroupId, panelId, index) {\n const tabGroup = this._tabGroupMap.get(tabGroupId);\n if (!tabGroup) {\n return;\n }\n // Ensure the panel actually exists in this group model\n if (!this._panels.some((p) => p.id === panelId)) {\n return;\n }\n // Remove from any existing group first\n const existingGroup = this.getTabGroupForPanel(panelId);\n if (existingGroup && existingGroup.id === tabGroupId) {\n return; // already in this group — no mutation\n }\n this._bracketTabGroupMutation(() => {\n if (existingGroup) {\n this.removePanelFromTabGroup(panelId);\n }\n tabGroup.addPanel(panelId, index);\n this._panelToTabGroup.set(panelId, tabGroup);\n // Enforce contiguity: move the panel in the flat _panels array\n // to the correct global position matching its group-local index\n this._enforceContiguity(tabGroup, panelId);\n this._onDidAddPanelToTabGroup.fire({ tabGroup, panelId });\n });\n }\n /**\n * Move a panel to a new index within its tab group.\n * Updates both the group's panelIds order and the flat _panels array.\n */\n movePanelWithinGroup(tabGroupId, panelId, newIndex) {\n const tabGroup = this._tabGroupMap.get(tabGroupId);\n if (!tabGroup || !tabGroup.containsPanel(panelId)) {\n return;\n }\n // Remove and re-add at new index within the group\n tabGroup.removePanel(panelId);\n tabGroup.addPanel(panelId, newIndex);\n // Re-enforce contiguity in the flat array\n this._enforceContiguity(tabGroup, panelId);\n this.tabsContainer.updateTabGroups();\n }\n /**\n * Move a panel from one tab group to another.\n */\n movePanelBetweenGroups(sourcePanelId, targetTabGroupId, targetIndex) {\n const sourceGroup = this._findTabGroupForPanel(sourcePanelId);\n const targetGroup = this._tabGroupMap.get(targetTabGroupId);\n if (!targetGroup) {\n return;\n }\n if (sourceGroup) {\n sourceGroup.removePanel(sourcePanelId);\n this._panelToTabGroup.delete(sourcePanelId);\n this._onDidRemovePanelFromTabGroup.fire({\n tabGroup: sourceGroup,\n panelId: sourcePanelId,\n });\n // Auto-destroy empty source group\n if (sourceGroup.isEmpty) {\n sourceGroup.dispose();\n }\n }\n targetGroup.addPanel(sourcePanelId, targetIndex);\n this._panelToTabGroup.set(sourcePanelId, targetGroup);\n this._enforceContiguity(targetGroup, sourcePanelId);\n this._onDidAddPanelToTabGroup.fire({\n tabGroup: targetGroup,\n panelId: sourcePanelId,\n });\n }\n /**\n * Move an entire tab group to a new position in the tab bar.\n * The group's internal panel order is preserved.\n */\n moveTabGroup(tabGroupId, targetIndex) {\n const tabGroup = this._tabGroupMap.get(tabGroupId);\n if (!tabGroup || tabGroup.panelIds.length === 0) {\n return;\n }\n // Collect group panels in their current order\n const groupPanelIds = new Set(tabGroup.panelIds);\n const groupPanels = tabGroup.panelIds\n .map((pid) => this._panels.find((p) => p.id === pid))\n .filter((p) => p !== undefined);\n if (groupPanels.length === 0) {\n return;\n }\n // Count how many group panels sit before the target index so\n // we can compensate after removing them from the array.\n let groupPanelsBefore = 0;\n for (let i = 0; i < Math.min(targetIndex, this._panels.length); i++) {\n if (groupPanelIds.has(this._panels[i].id)) {\n groupPanelsBefore++;\n }\n }\n // Remove group panels from the flat array\n for (const panel of groupPanels) {\n const idx = this._panels.indexOf(panel);\n if (idx !== -1) {\n this._panels.splice(idx, 1);\n }\n }\n // Adjust target index to account for removed panels\n const adjustedIndex = targetIndex - groupPanelsBefore;\n // Clamp target index to valid range after removal\n const insertAt = Math.max(0, Math.min(adjustedIndex, this._panels.length));\n // Insert group panels at the target position\n this._panels.splice(insertAt, 0, ...groupPanels);\n // Rebuild the tabs container to match new order\n for (const panel of this._panels) {\n this.tabsContainer.delete(panel.id);\n }\n for (let i = 0; i < this._panels.length; i++) {\n this.tabsContainer.openPanel(this._panels[i], i);\n }\n this.tabsContainer.updateTabGroups();\n }\n /**\n * Ensure a panel is at the correct global index in _panels\n * to maintain contiguity of its tab group members.\n */\n _enforceContiguity(tabGroup, panelId) {\n const panel = this._panels.find((p) => p.id === panelId);\n if (!panel) {\n return;\n }\n const localIndex = tabGroup.indexOfPanel(panelId);\n const globalIndex = this._computeGlobalIndex(tabGroup, localIndex);\n const currentIndex = this._panels.indexOf(panel);\n if (currentIndex === globalIndex) {\n return;\n }\n // Move panel in the flat array\n this._panels.splice(currentIndex, 1);\n const adjustedIndex = globalIndex > currentIndex ? globalIndex - 1 : globalIndex;\n this._panels.splice(adjustedIndex, 0, panel);\n // Reorder in the tabs container to match\n this.tabsContainer.delete(panelId);\n this.tabsContainer.openPanel(panel, adjustedIndex);\n }\n /**\n * Compute the global index in _panels for a group-local index.\n * Finds where the group's panels start in the flat array and offsets.\n */\n _computeGlobalIndex(tabGroup, localIndex) {\n const groupPanelIds = tabGroup.panelIds;\n if (groupPanelIds.length <= 1) {\n // Only one panel (the one being added), keep current position\n const panel = this._panels.find((p) => p.id === groupPanelIds[0]);\n return panel ? this._panels.indexOf(panel) : this._panels.length;\n }\n // Find the first existing group member (other than the one at localIndex)\n // to anchor the group position\n for (let i = 0; i < groupPanelIds.length; i++) {\n if (i === localIndex) {\n continue;\n }\n const existingPanel = this._panels.find((p) => p.id === groupPanelIds[i]);\n if (existingPanel) {\n const existingGlobalIndex = this._panels.indexOf(existingPanel);\n // Offset based on relative position within group\n return Math.max(0, existingGlobalIndex + (localIndex - i));\n }\n }\n return this._panels.length;\n }\n removePanelFromTabGroup(panelId) {\n const tabGroup = this._findTabGroupForPanel(panelId);\n if (!tabGroup) {\n return;\n }\n this._bracketTabGroupMutation(() => {\n tabGroup.removePanel(panelId);\n this._panelToTabGroup.delete(panelId);\n this._onDidRemovePanelFromTabGroup.fire({ tabGroup, panelId });\n // Auto-destroy empty groups\n if (tabGroup.isEmpty) {\n tabGroup.dispose();\n }\n });\n }\n getTabGroups() {\n return this._tabGroups;\n }\n updateTabGroups() {\n this.tabsContainer.updateTabGroups();\n }\n refreshTabGroupAccent() {\n this.tabsContainer.refreshTabGroupAccent();\n }\n refreshWatermark() {\n var _a, _b;\n if (this.watermark) {\n this.watermark.element.remove();\n (_b = (_a = this.watermark).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);\n this.watermark = undefined;\n }\n this.updateContainer();\n }\n getTabGroupForPanel(panelId) {\n return this._findTabGroupForPanel(panelId);\n }\n _findTabGroupForPanel(panelId) {\n return this._panelToTabGroup.get(panelId);\n }\n _removeTabGroupInternal(tabGroup) {\n const index = this._tabGroups.indexOf(tabGroup);\n if (index !== -1) {\n this._tabGroups.splice(index, 1);\n this._tabGroupMap.delete(tabGroup.id);\n for (const panelId of tabGroup.panelIds) {\n this._panelToTabGroup.delete(panelId);\n }\n this._onDidDestroyTabGroup.fire({ tabGroup });\n // Dispose the external listeners (onDidChange, onDidCollapseChange)\n // we registered on this group. We cannot dispose synchronously\n // here because this method runs inside the onDidDestroy fire\n // loop — disposing the CompositeDisposable that holds the\n // onDidDestroy subscription would splice listeners mid-iteration.\n // Schedule cleanup on the next microtask instead.\n const tabGroupDisposable = this._tabGroupDisposables.get(tabGroup.id);\n this._tabGroupDisposables.delete(tabGroup.id);\n if (tabGroupDisposable) {\n this._pendingMicrotaskDisposables.add(tabGroupDisposable);\n queueMicrotask(() => {\n this._pendingMicrotaskDisposables.delete(tabGroupDisposable);\n tabGroupDisposable.dispose();\n });\n }\n }\n }\n _handleGroupCollapse(tabGroup) {\n if (!this._activePanel) {\n return;\n }\n // Only act if the active panel belongs to the collapsed group\n if (!tabGroup.containsPanel(this._activePanel.id)) {\n return;\n }\n const activePanelIndex = this._panels.indexOf(this._activePanel);\n // Search right first, then left, for a visible (non-collapsed-group) panel\n for (let i = activePanelIndex + 1; i < this._panels.length; i++) {\n const candidate = this._panels[i];\n const candidateGroup = this._findTabGroupForPanel(candidate.id);\n if (!candidateGroup || !candidateGroup.collapsed) {\n this.doSetActivePanel(candidate);\n this.updateContainer();\n return;\n }\n }\n for (let i = activePanelIndex - 1; i >= 0; i--) {\n const candidate = this._panels[i];\n const candidateGroup = this._findTabGroupForPanel(candidate.id);\n if (!candidateGroup || !candidateGroup.collapsed) {\n this.doSetActivePanel(candidate);\n this.updateContainer();\n return;\n }\n }\n // All tabs are in collapsed groups — show watermark\n this.contentContainer.closePanel();\n this.doSetActivePanel(undefined);\n this.updateContainer();\n }\n _handleGroupExpand(tabGroup) {\n if (this._activePanel) {\n return;\n }\n // Watermark is showing because all groups were collapsed.\n // Activate the first panel in the newly expanded group.\n const firstPanelId = tabGroup.panelIds[0];\n if (firstPanelId) {\n const panel = this._panels.find((p) => p.id === firstPanelId);\n if (panel) {\n this.doSetActivePanel(panel);\n this.updateContainer();\n }\n }\n }\n /** Restore tab groups from serialized data (used by fromJSON) */\n restoreTabGroups(serializedGroups) {\n // Bump counter past any restored numeric suffixes to avoid ID collisions\n for (const data of serializedGroups) {\n const match = data.id.match(/-(\\d+)$/);\n if (match) {\n const num = parseInt(match[1], 10) + 1;\n if (num > this._tabGroupIdCounter) {\n this._tabGroupIdCounter = num;\n }\n }\n }\n for (const data of serializedGroups) {\n const tabGroup = this.createTabGroup({\n id: data.id,\n label: data.label,\n color: data.color,\n componentParams: data.componentParams,\n });\n const concreteGroup = this._tabGroupMap.get(tabGroup.id);\n for (const panelId of data.panelIds) {\n // Only add panels that actually exist in this group model\n if (this._panels.some((p) => p.id === panelId)) {\n tabGroup.addPanel(panelId);\n this._panelToTabGroup.set(panelId, concreteGroup);\n this._enforceContiguity(concreteGroup, panelId);\n }\n }\n if (data.collapsed) {\n tabGroup.collapse();\n }\n // Auto-destroy if no valid panels were added\n if (tabGroup.isEmpty) {\n tabGroup.dispose();\n }\n }\n }\n focusContent() {\n this.contentContainer.element.focus();\n }\n focusActiveTab() {\n this.tabsContainer.focusActiveTab();\n }\n set renderContainer(value) {\n this.panels.forEach((panel) => {\n this.renderContainer.detatch(panel);\n });\n this._overwriteRenderContainer = value;\n this.panels.forEach((panel) => {\n this.rerender(panel);\n });\n }\n get renderContainer() {\n var _a;\n return ((_a = this._overwriteRenderContainer) !== null && _a !== void 0 ? _a : this.accessor.overlayRenderContainer);\n }\n set dropTargetContainer(value) {\n this._overwriteDropTargetContainer = value;\n }\n get dropTargetContainer() {\n var _a;\n return ((_a = this._overwriteDropTargetContainer) !== null && _a !== void 0 ? _a : this.accessor.rootDropTargetContainer);\n }\n initialize() {\n if (this.options.panels) {\n this.options.panels.forEach((panel) => {\n this.doAddPanel(panel);\n });\n }\n if (this.options.activePanel) {\n this.openPanel(this.options.activePanel);\n }\n // must be run after the constructor otherwise this.parent may not be\n // correctly initialized\n this.setActive(this.isActive, true);\n this.updateContainer();\n this.updateHeaderActions();\n }\n updateHeaderActions() {\n var _a;\n (_a = this.accessor.headerActionsService) === null || _a === void 0 ? void 0 : _a.refresh(this.groupPanel);\n }\n attachHeaderAction(slot, element) {\n switch (slot) {\n case 'left':\n this.tabsContainer.setLeftActionsElement(element);\n break;\n case 'right':\n this.tabsContainer.setRightActionsElement(element);\n break;\n case 'prefix':\n this.tabsContainer.setPrefixActionsElement(element);\n break;\n }\n }\n rerender(panel) {\n this.contentContainer.renderPanel(panel, { asActive: false });\n }\n indexOf(panel) {\n return this.tabsContainer.indexOf(panel.id);\n }\n toJSON() {\n var _a;\n const result = {\n views: this.tabsContainer.panels,\n activeView: (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.id,\n id: this.id,\n };\n if (this.locked !== false) {\n result.locked = this.locked;\n }\n if (this.header.hidden) {\n result.hideHeader = true;\n }\n if (this.headerPosition !== 'top') {\n result.headerPosition = this.headerPosition;\n }\n if (this._tabGroups.length > 0) {\n result.tabGroups = this._tabGroups.map((tg) => tg.toJSON());\n }\n return result;\n }\n moveToNext(options) {\n if (!options) {\n options = {};\n }\n if (!options.panel) {\n options.panel = this.activePanel;\n }\n const index = options.panel ? this.panels.indexOf(options.panel) : -1;\n let normalizedIndex;\n if (index < this.panels.length - 1) {\n normalizedIndex = index + 1;\n }\n else if (!options.suppressRoll) {\n normalizedIndex = 0;\n }\n else {\n return;\n }\n this.openPanel(this.panels[normalizedIndex]);\n }\n moveToPrevious(options) {\n if (!options) {\n options = {};\n }\n if (!options.panel) {\n options.panel = this.activePanel;\n }\n if (!options.panel) {\n return;\n }\n const index = this.panels.indexOf(options.panel);\n let normalizedIndex;\n if (index > 0) {\n normalizedIndex = index - 1;\n }\n else if (!options.suppressRoll) {\n normalizedIndex = this.panels.length - 1;\n }\n else {\n return;\n }\n this.openPanel(this.panels[normalizedIndex]);\n }\n containsPanel(panel) {\n return this.panels.includes(panel);\n }\n init(_params) {\n //noop\n }\n update(_params) {\n //noop\n }\n focus() {\n var _a;\n (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();\n }\n openPanel(panel, options = {}) {\n /**\n * set the panel group\n * add the panel\n * check if group active\n * check if panel active\n */\n if (typeof options.index !== 'number' ||\n options.index > this.panels.length) {\n options.index = this.panels.length;\n }\n const skipSetActive = !!options.skipSetActive;\n // ensure the group is updated before we fire any events\n panel.updateParentGroup(this.groupPanel, {\n skipSetActive: options.skipSetActive,\n });\n this.doAddPanel(panel, options.index, {\n skipSetActive: skipSetActive,\n });\n if (this._activePanel === panel) {\n this.contentContainer.renderPanel(panel, { asActive: true });\n return;\n }\n if (!skipSetActive) {\n this.doSetActivePanel(panel);\n }\n if (!options.skipSetGroupActive) {\n this.accessor.doSetGroupActive(this.groupPanel);\n }\n if (!options.skipSetActive) {\n this.updateContainer();\n }\n }\n removePanel(groupItemOrId, options = {\n skipSetActive: false,\n }) {\n const id = typeof groupItemOrId === 'string'\n ? groupItemOrId\n : groupItemOrId.id;\n const panelToRemove = this._panels.find((panel) => panel.id === id);\n if (!panelToRemove) {\n throw new Error('invalid operation');\n }\n return this._removePanel(panelToRemove, options);\n }\n closeAllPanels() {\n if (this.panels.length > 0) {\n // take a copy since we will be edting the array as we iterate through\n const arrPanelCpy = [...this.panels];\n for (const panel of arrPanelCpy) {\n this.doClose(panel);\n }\n }\n else {\n this.accessor.removeGroup(this.groupPanel);\n }\n }\n closePanel(panel) {\n this.doClose(panel);\n }\n doClose(panel) {\n const isLast = this.panels.length === 1 && this.accessor.groups.length === 1;\n this.accessor.removePanel(panel, isLast && this.accessor.options.noPanelsOverlay === 'emptyGroup'\n ? { removeEmptyGroup: false }\n : undefined);\n }\n isPanelActive(panel) {\n return this._activePanel === panel;\n }\n updateActions(element) {\n this.tabsContainer.setRightActionsElement(element);\n }\n setActive(isGroupActive, force = false) {\n if (!force && this.isActive === isGroupActive) {\n return;\n }\n this._isGroupActive = isGroupActive;\n toggleClass(this.container, 'dv-active-group', isGroupActive);\n toggleClass(this.container, 'dv-inactive-group', !isGroupActive);\n this.tabsContainer.setActive(this.isActive);\n if (!this._activePanel && this.panels.length > 0) {\n const candidate = this._panels.find((p) => {\n const tg = this._findTabGroupForPanel(p.id);\n return !tg || !tg.collapsed;\n });\n if (candidate) {\n this.doSetActivePanel(candidate);\n }\n }\n this.updateContainer();\n }\n layout(width, height) {\n var _a;\n this._width = width;\n this._height = height;\n this.contentContainer.layout(this._width, this._height);\n if ((_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.layout) {\n this._activePanel.layout(this._width, this._height);\n }\n }\n _removePanel(panel, options) {\n const isActivePanel = this._activePanel === panel;\n this.doRemovePanel(panel);\n if (isActivePanel && this.panels.length > 0) {\n const nextPanel = this.mostRecentlyUsed[0];\n this.openPanel(nextPanel, {\n skipSetActive: options.skipSetActive,\n skipSetGroupActive: options.skipSetActiveGroup,\n });\n }\n if (this._activePanel && this.panels.length === 0) {\n this.doSetActivePanel(undefined);\n }\n if (!options.skipSetActive) {\n this.updateContainer();\n }\n return panel;\n }\n doRemovePanel(panel) {\n const index = this.panels.indexOf(panel);\n if (this._activePanel === panel) {\n this.contentContainer.closePanel();\n }\n this.tabsContainer.delete(panel.id);\n this._panels.splice(index, 1);\n if (this.mostRecentlyUsed.includes(panel)) {\n const index = this.mostRecentlyUsed.indexOf(panel);\n this.mostRecentlyUsed.splice(index, 1);\n }\n const disposable = this._panelDisposables.get(panel.id);\n if (disposable) {\n disposable.dispose();\n this._panelDisposables.delete(panel.id);\n }\n // Remove panel from its tab group (auto-destroys empty groups)\n this.removePanelFromTabGroup(panel.id);\n this._onDidRemovePanel.fire({ panel });\n }\n doAddPanel(panel, index = this.panels.length, options = { skipSetActive: false }) {\n const existingPanel = this._panels.indexOf(panel);\n const hasExistingPanel = existingPanel > -1;\n this.tabsContainer.show();\n this.contentContainer.show();\n this.tabsContainer.openPanel(panel, index);\n if (!options.skipSetActive) {\n this.contentContainer.openPanel(panel);\n }\n else if (panel.api.renderer === 'always') {\n this.contentContainer.renderPanel(panel, { asActive: false });\n }\n if (hasExistingPanel) {\n // TODO - need to ensure ordering hasn't changed and if it has need to re-order this.panels\n return;\n }\n this.updateMru(panel);\n this.panels.splice(index, 0, panel);\n this._panelDisposables.set(panel.id, new CompositeDisposable(panel.api.onDidTitleChange((event) => this._onDidPanelTitleChange.fire(event)), panel.api.onDidParametersChange((event) => this._onDidPanelParametersChange.fire(event))));\n this._onDidAddPanel.fire({ panel });\n }\n doSetActivePanel(panel) {\n var _a, _b, _c;\n if (this._activePanel === panel) {\n return;\n }\n this._activePanel = panel;\n if (panel) {\n this.tabsContainer.setActivePanel(panel);\n // Point the tabpanel's `aria-labelledby` at the now-active tab.\n this.contentContainer.setLabelledBy(this.tabsContainer.getTabId(panel.id));\n this.contentContainer.openPanel(panel);\n panel.layout(this._width, this._height);\n this.updateMru(panel);\n // Refresh focus state to handle programmatic activation without DOM focus change\n this.contentContainer.refreshFocusState();\n this._onDidActivePanelChange.fire({\n panel,\n // `currentOrigin` is always present on the real component;\n // default to 'user' for minimal test accessors.\n origin: (_c = (_b = (_a = this.accessor).currentOrigin) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : 'user',\n });\n }\n this.updateAccessibleLabel();\n }\n /** Label the group region with its active panel's title (the WAI-ARIA region name). */\n updateAccessibleLabel() {\n var _a;\n const title = (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.title;\n if (title) {\n this.container.setAttribute('aria-label', title);\n }\n else {\n this.container.removeAttribute('aria-label');\n }\n }\n updateMru(panel) {\n if (this.mostRecentlyUsed.includes(panel)) {\n this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);\n }\n this.mostRecentlyUsed = [panel, ...this.mostRecentlyUsed];\n }\n updateContainer() {\n var _a, _b;\n this.panels.forEach((panel) => panel.runEvents());\n const shouldShowWatermark = this.isEmpty || !this._activePanel;\n if (shouldShowWatermark && !this.watermark) {\n const watermark = this.accessor.createWatermarkComponent();\n watermark.init({\n containerApi: this._api,\n group: this.groupPanel,\n });\n this.watermark = watermark;\n addDisposableListener(this.watermark.element, 'pointerdown', () => {\n if (!this.isActive) {\n this.accessor.doSetGroupActive(this.groupPanel);\n }\n });\n this.contentContainer.element.appendChild(this.watermark.element);\n }\n if (!shouldShowWatermark && this.watermark) {\n this.watermark.element.remove();\n (_b = (_a = this.watermark).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);\n this.watermark = undefined;\n }\n }\n canDisplayOverlay(event, position, target) {\n const firedEvent = new DockviewUnhandledDragOverEvent(event, target, position, getPanelData, this.accessor.getPanel(this.id));\n this._onUnhandledDragOver.fire(firedEvent);\n return firedEvent.isAccepted;\n }\n handleDropEvent(type, event, position, index) {\n if (this.locked === 'no-drop-target') {\n return;\n }\n function getKind() {\n switch (type) {\n case 'header':\n return typeof index === 'number' ? 'tab' : 'header_space';\n case 'content':\n return 'content';\n }\n }\n const panel = typeof index === 'number' ? this.panels[index] : undefined;\n const willDropEvent = new DockviewWillDropEvent({\n nativeEvent: event,\n position,\n panel,\n getData: () => getPanelData(),\n kind: getKind(),\n group: this.groupPanel,\n api: this._api,\n });\n this._onWillDrop.fire(willDropEvent);\n if (willDropEvent.defaultPrevented) {\n return;\n }\n const data = getPanelData();\n if (data && data.viewId === this.accessor.id) {\n if (type === 'content') {\n if (data.groupId === this.id) {\n // don't allow to drop on self for center position\n if (position === 'center') {\n return;\n }\n if (data.panelId === null && !data.tabGroupId) {\n // Full-group drops on self are a no-op.\n // Tab-group drags are partial moves: an edge drop\n // splits the layout and creates a new group.\n return;\n }\n }\n }\n if (type === 'header') {\n if (data.groupId === this.id) {\n if (data.panelId === null && !data.tabGroupId) {\n return;\n }\n }\n }\n if (data.panelId === null) {\n // this is a group move dnd event\n const { groupId } = data;\n this._onMove.fire({\n target: position,\n groupId: groupId,\n index,\n tabGroupId: data.tabGroupId,\n });\n return;\n }\n const fromSameGroup = this.tabsContainer.indexOf(data.panelId) !== -1;\n if (fromSameGroup && this.tabsContainer.size === 1) {\n return;\n }\n const { groupId, panelId } = data;\n const isSameGroup = this.id === groupId;\n if (isSameGroup && !position) {\n const oldIndex = this.tabsContainer.indexOf(panelId);\n if (oldIndex === index) {\n return;\n }\n }\n this._onMove.fire({\n target: position,\n groupId: data.groupId,\n itemId: data.panelId,\n index,\n });\n }\n else {\n this._onDidDrop.fire(new DockviewDidDropEvent({\n nativeEvent: event,\n position,\n panel,\n getData: () => getPanelData(),\n group: this.groupPanel,\n api: this._api,\n }));\n }\n }\n updateDragAndDropState() {\n this.tabsContainer.updateDragAndDropState();\n }\n dispose() {\n var _a, _b, _c;\n super.dispose();\n (_a = this.watermark) === null || _a === void 0 ? void 0 : _a.element.remove();\n (_c = (_b = this.watermark) === null || _b === void 0 ? void 0 : _b.dispose) === null || _c === void 0 ? void 0 : _c.call(_b);\n this.watermark = undefined;\n // Dispose all tab groups\n for (const tabGroup of [...this._tabGroups]) {\n tabGroup.dispose();\n }\n for (const disposable of this._tabGroupDisposables.values()) {\n disposable.dispose();\n }\n this._tabGroupDisposables.clear();\n // Dispose any microtask-deferred disposables that haven't run yet\n for (const disposable of this._pendingMicrotaskDisposables) {\n disposable.dispose();\n }\n this._pendingMicrotaskDisposables.clear();\n for (const panel of this.panels) {\n panel.dispose();\n }\n this.tabsContainer.dispose();\n this.contentContainer.dispose();\n }\n}\n\nclass GridviewPanelApiImpl extends PanelApiImpl {\n constructor(id, component, panel) {\n super(id, component);\n this._onDidConstraintsChangeInternal = new Emitter();\n this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;\n this._onDidConstraintsChange = new Emitter();\n this.onDidConstraintsChange = this._onDidConstraintsChange.event;\n this._onDidSizeChange = new Emitter();\n this.onDidSizeChange = this._onDidSizeChange.event;\n this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);\n if (panel) {\n this.initialize(panel);\n }\n }\n setConstraints(value) {\n this._onDidConstraintsChangeInternal.fire(value);\n }\n setSize(event) {\n this._onDidSizeChange.fire(event);\n }\n}\n\nclass GridviewPanel extends BasePanelView {\n get priority() {\n return this._priority;\n }\n get snap() {\n return this._snap;\n }\n get minimumWidth() {\n /**\n * defer to protected function to allow subclasses to override easily.\n * see https://github.com/microsoft/TypeScript/issues/338\n */\n return this.__minimumWidth();\n }\n get minimumHeight() {\n /**\n * defer to protected function to allow subclasses to override easily.\n * see https://github.com/microsoft/TypeScript/issues/338\n */\n return this.__minimumHeight();\n }\n get maximumHeight() {\n /**\n * defer to protected function to allow subclasses to override easily.\n * see https://github.com/microsoft/TypeScript/issues/338\n */\n return this.__maximumHeight();\n }\n get maximumWidth() {\n /**\n * defer to protected function to allow subclasses to override easily.\n * see https://github.com/microsoft/TypeScript/issues/338\n */\n return this.__maximumWidth();\n }\n __minimumWidth() {\n const width = typeof this._minimumWidth === 'function'\n ? this._minimumWidth()\n : this._minimumWidth;\n if (width !== this._evaluatedMinimumWidth) {\n this._evaluatedMinimumWidth = width;\n this.updateConstraints();\n }\n return width;\n }\n __maximumWidth() {\n const width = typeof this._maximumWidth === 'function'\n ? this._maximumWidth()\n : this._maximumWidth;\n if (width !== this._evaluatedMaximumWidth) {\n this._evaluatedMaximumWidth = width;\n this.updateConstraints();\n }\n return width;\n }\n __minimumHeight() {\n const height = typeof this._minimumHeight === 'function'\n ? this._minimumHeight()\n : this._minimumHeight;\n if (height !== this._evaluatedMinimumHeight) {\n this._evaluatedMinimumHeight = height;\n this.updateConstraints();\n }\n return height;\n }\n __maximumHeight() {\n const height = typeof this._maximumHeight === 'function'\n ? this._maximumHeight()\n : this._maximumHeight;\n if (height !== this._evaluatedMaximumHeight) {\n this._evaluatedMaximumHeight = height;\n this.updateConstraints();\n }\n return height;\n }\n get isActive() {\n return this.api.isActive;\n }\n get isVisible() {\n return this.api.isVisible;\n }\n constructor(id, component, options, api) {\n super(id, component, api !== null && api !== void 0 ? api : new GridviewPanelApiImpl(id, component));\n this._evaluatedMinimumWidth = 0;\n this._evaluatedMaximumWidth = Number.MAX_SAFE_INTEGER;\n this._evaluatedMinimumHeight = 0;\n this._evaluatedMaximumHeight = Number.MAX_SAFE_INTEGER;\n this._minimumWidth = 0;\n this._minimumHeight = 0;\n this._maximumWidth = Number.MAX_SAFE_INTEGER;\n this._maximumHeight = Number.MAX_SAFE_INTEGER;\n this._snap = false;\n this._onDidChange = new Emitter();\n this.onDidChange = this._onDidChange.event;\n if (typeof (options === null || options === void 0 ? void 0 : options.minimumWidth) === 'number') {\n this._minimumWidth = options.minimumWidth;\n }\n if (typeof (options === null || options === void 0 ? void 0 : options.maximumWidth) === 'number') {\n this._maximumWidth = options.maximumWidth;\n }\n if (typeof (options === null || options === void 0 ? void 0 : options.minimumHeight) === 'number') {\n this._minimumHeight = options.minimumHeight;\n }\n if (typeof (options === null || options === void 0 ? void 0 : options.maximumHeight) === 'number') {\n this._maximumHeight = options.maximumHeight;\n }\n this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement\n this.addDisposables(this.api.onWillVisibilityChange((event) => {\n const { isVisible } = event;\n const { accessor } = this._params;\n accessor.setVisible(this, isVisible);\n }), this.api.onActiveChange(() => {\n const { accessor } = this._params;\n accessor.doSetGroupActive(this);\n }), this.api.onDidConstraintsChangeInternal((event) => {\n if (typeof event.minimumWidth === 'number' ||\n typeof event.minimumWidth === 'function') {\n this._minimumWidth = event.minimumWidth;\n }\n if (typeof event.minimumHeight === 'number' ||\n typeof event.minimumHeight === 'function') {\n this._minimumHeight = event.minimumHeight;\n }\n if (typeof event.maximumWidth === 'number' ||\n typeof event.maximumWidth === 'function') {\n this._maximumWidth = event.maximumWidth;\n }\n if (typeof event.maximumHeight === 'number' ||\n typeof event.maximumHeight === 'function') {\n this._maximumHeight = event.maximumHeight;\n }\n }), this.api.onDidSizeChange((event) => {\n this._onDidChange.fire({\n height: event.height,\n width: event.width,\n });\n }), this._onDidChange);\n }\n setVisible(isVisible) {\n this.api._onDidVisibilityChange.fire({ isVisible });\n }\n setActive(isActive) {\n this.api._onDidActiveChange.fire({ isActive });\n }\n init(parameters) {\n if (parameters.maximumHeight) {\n this._maximumHeight = parameters.maximumHeight;\n }\n if (parameters.minimumHeight) {\n this._minimumHeight = parameters.minimumHeight;\n }\n if (parameters.maximumWidth) {\n this._maximumWidth = parameters.maximumWidth;\n }\n if (parameters.minimumWidth) {\n this._minimumWidth = parameters.minimumWidth;\n }\n this._priority = parameters.priority;\n this._snap = !!parameters.snap;\n super.init(parameters);\n if (typeof parameters.isVisible === 'boolean') {\n this.setVisible(parameters.isVisible);\n }\n }\n updateConstraints() {\n this.api._onDidConstraintsChange.fire({\n minimumWidth: this._evaluatedMinimumWidth,\n maximumWidth: this._evaluatedMaximumWidth,\n minimumHeight: this._evaluatedMinimumHeight,\n maximumHeight: this._evaluatedMaximumHeight,\n });\n }\n toJSON() {\n const state = super.toJSON();\n const maximum = (value) => value === Number.MAX_SAFE_INTEGER ? undefined : value;\n const minimum = (value) => (value <= 0 ? undefined : value);\n return Object.assign(Object.assign({}, state), { minimumHeight: minimum(this.minimumHeight), maximumHeight: maximum(this.maximumHeight), minimumWidth: minimum(this.minimumWidth), maximumWidth: maximum(this.maximumWidth), snap: this.snap, priority: this.priority });\n }\n}\n\nconst NOT_INITIALIZED_MESSAGE = 'dockview: DockviewGroupPanelApiImpl not initialized';\nclass DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {\n get location() {\n if (!this._group) {\n throw new Error(NOT_INITIALIZED_MESSAGE);\n }\n return this._group.model.location;\n }\n /**\n * The group's bounding box relative to the top-left of the dockview root,\n * in pixels. Covers grid and floating groups; returns `undefined` for a\n * popout group (it lives in a separate window). Reflects the live rendered\n * geometry, so it is only meaningful once the layout has been sized.\n */\n get boundingBox() {\n if (!this._group || this._group.model.location.type === 'popout') {\n return undefined;\n }\n const root = this.accessor.element.getBoundingClientRect();\n const rect = this._group.element.getBoundingClientRect();\n return {\n left: rect.left - root.left,\n top: rect.top - root.top,\n width: rect.width,\n height: rect.height,\n };\n }\n get locked() {\n if (!this._group) {\n throw new Error(NOT_INITIALIZED_MESSAGE);\n }\n return this._group.locked;\n }\n set locked(value) {\n if (!this._group) {\n throw new Error(NOT_INITIALIZED_MESSAGE);\n }\n this._group.locked = value;\n }\n constructor(id, accessor) {\n super(id, '__dockviewgroup__');\n this.accessor = accessor;\n this._onDidLocationChange = new Emitter();\n this.onDidLocationChange = this._onDidLocationChange.event;\n this._onDidActivePanelChange = new Emitter();\n this.onDidActivePanelChange = this._onDidActivePanelChange.event;\n this._onDidCollapsedChange = new Emitter();\n this.onDidCollapsedChange = this._onDidCollapsedChange.event;\n this.addDisposables(this._onDidLocationChange, this._onDidActivePanelChange, this._onDidCollapsedChange, this._onDidVisibilityChange.event((event) => {\n // When becoming visible, apply any pending size change\n if (event.isVisible && this._pendingSize) {\n super.setSize(this._pendingSize);\n this._pendingSize = undefined;\n }\n }));\n }\n setSize(event) {\n // Always store the requested size\n this._pendingSize = Object.assign({}, event);\n // Apply the size change immediately\n super.setSize(event);\n }\n close() {\n if (!this._group) {\n return;\n }\n return this.accessor.removeGroup(this._group);\n }\n getWindow() {\n return this.location.type === 'popout'\n ? this.location.getWindow()\n : window;\n }\n setHeaderPosition(position) {\n if (!this._group) {\n throw new Error(NOT_INITIALIZED_MESSAGE);\n }\n this._group.model.headerPosition = position;\n }\n getHeaderPosition() {\n if (!this._group) {\n throw new Error(NOT_INITIALIZED_MESSAGE);\n }\n return this._group.model.headerPosition;\n }\n moveTo(options) {\n var _a, _b, _c, _d;\n if (!this._group) {\n throw new Error(NOT_INITIALIZED_MESSAGE);\n }\n const group = (_a = options.group) !== null && _a !== void 0 ? _a : this.accessor.addGroup({\n direction: positionToDirection((_b = options.position) !== null && _b !== void 0 ? _b : 'right'),\n skipSetActive: (_c = options.skipSetActive) !== null && _c !== void 0 ? _c : false,\n });\n this.accessor.moveGroupOrPanel({\n from: { groupId: this._group.id },\n to: {\n group,\n position: options.group\n ? ((_d = options.position) !== null && _d !== void 0 ? _d : 'center')\n : 'center',\n index: options.index,\n },\n skipSetActive: options.skipSetActive,\n });\n }\n maximize() {\n if (!this._group) {\n throw new Error(NOT_INITIALIZED_MESSAGE);\n }\n if (this.location.type !== 'grid') {\n // only grid groups can be maximized\n return;\n }\n this.accessor.maximizeGroup(this._group);\n }\n isMaximized() {\n if (!this._group) {\n throw new Error(NOT_INITIALIZED_MESSAGE);\n }\n return this.accessor.isMaximizedGroup(this._group);\n }\n exitMaximized() {\n if (!this._group) {\n throw new Error(NOT_INITIALIZED_MESSAGE);\n }\n if (this.isMaximized()) {\n this.accessor.exitMaximizedGroup();\n }\n }\n collapse() {\n if (!this._group) {\n return;\n }\n this.accessor.setEdgeGroupCollapsed(this._group, true);\n }\n expand() {\n if (!this._group) {\n return;\n }\n this.accessor.setEdgeGroupCollapsed(this._group, false);\n }\n isCollapsed() {\n if (!this._group) {\n return false;\n }\n return this.accessor.isEdgeGroupCollapsed(this._group);\n }\n initialize(group) {\n this._group = group;\n }\n}\n\nconst MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH = 100;\nconst MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT = 100;\nclass DockviewGroupPanel extends GridviewPanel {\n get minimumWidth() {\n var _a;\n // Check for explicitly set group constraint first\n if (typeof this._explicitConstraints.minimumWidth === 'number') {\n return this._explicitConstraints.minimumWidth;\n }\n const activePanelMinimumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumWidth;\n if (typeof activePanelMinimumWidth === 'number') {\n return activePanelMinimumWidth;\n }\n return super.__minimumWidth();\n }\n get minimumHeight() {\n var _a;\n // Check for explicitly set group constraint first\n if (typeof this._explicitConstraints.minimumHeight === 'number') {\n return this._explicitConstraints.minimumHeight;\n }\n const activePanelMinimumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.minimumHeight;\n if (typeof activePanelMinimumHeight === 'number') {\n return activePanelMinimumHeight;\n }\n return super.__minimumHeight();\n }\n get maximumWidth() {\n var _a;\n // Check for explicitly set group constraint first\n if (typeof this._explicitConstraints.maximumWidth === 'number') {\n return this._explicitConstraints.maximumWidth;\n }\n const activePanelMaximumWidth = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumWidth;\n if (typeof activePanelMaximumWidth === 'number') {\n return activePanelMaximumWidth;\n }\n return super.__maximumWidth();\n }\n get maximumHeight() {\n var _a;\n // Check for explicitly set group constraint first\n if (typeof this._explicitConstraints.maximumHeight === 'number') {\n return this._explicitConstraints.maximumHeight;\n }\n const activePanelMaximumHeight = (_a = this.activePanel) === null || _a === void 0 ? void 0 : _a.maximumHeight;\n if (typeof activePanelMaximumHeight === 'number') {\n return activePanelMaximumHeight;\n }\n return super.__maximumHeight();\n }\n get panels() {\n return this._model.panels;\n }\n get activePanel() {\n return this._model.activePanel;\n }\n get size() {\n return this._model.size;\n }\n get model() {\n return this._model;\n }\n get locked() {\n return this._model.locked;\n }\n set locked(value) {\n this._model.locked = value;\n }\n get header() {\n return this._model.header;\n }\n constructor(accessor, id, options) {\n var _a, _b, _c, _d, _e, _f;\n super(id, 'groupview_default', {\n minimumHeight: (_b = (_a = options.constraints) === null || _a === void 0 ? void 0 : _a.minimumHeight) !== null && _b !== void 0 ? _b : MINIMUM_DOCKVIEW_GROUP_PANEL_HEIGHT,\n minimumWidth: (_d = (_c = options.constraints) === null || _c === void 0 ? void 0 : _c.minimumWidth) !== null && _d !== void 0 ? _d : MINIMUM_DOCKVIEW_GROUP_PANEL_WIDTH,\n maximumHeight: (_e = options.constraints) === null || _e === void 0 ? void 0 : _e.maximumHeight,\n maximumWidth: (_f = options.constraints) === null || _f === void 0 ? void 0 : _f.maximumWidth,\n }, new DockviewGroupPanelApiImpl(id, accessor));\n // Track explicitly set constraints to override panel constraints\n this._explicitConstraints = {};\n this.api.initialize(this); // cannot use 'this' after after 'super' call\n this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);\n this.addDisposables(this.model.onDidActivePanelChange((event) => {\n this.api._onDidActivePanelChange.fire(event);\n }), this.api.onDidConstraintsChangeInternal((event) => {\n // Track explicitly set constraints to override panel constraints\n // Extract numeric values from functions or values\n if (event.minimumWidth !== undefined) {\n this._explicitConstraints.minimumWidth =\n typeof event.minimumWidth === 'function'\n ? event.minimumWidth()\n : event.minimumWidth;\n }\n if (event.minimumHeight !== undefined) {\n this._explicitConstraints.minimumHeight =\n typeof event.minimumHeight === 'function'\n ? event.minimumHeight()\n : event.minimumHeight;\n }\n if (event.maximumWidth !== undefined) {\n this._explicitConstraints.maximumWidth =\n typeof event.maximumWidth === 'function'\n ? event.maximumWidth()\n : event.maximumWidth;\n }\n if (event.maximumHeight !== undefined) {\n this._explicitConstraints.maximumHeight =\n typeof event.maximumHeight === 'function'\n ? event.maximumHeight()\n : event.maximumHeight;\n }\n }));\n }\n focus() {\n if (!this.api.isActive) {\n this.api.setActive();\n }\n super.focus();\n }\n initialize() {\n this._model.initialize();\n }\n setActive(isActive) {\n super.setActive(isActive);\n this.model.setActive(isActive);\n }\n layout(width, height) {\n super.layout(width, height);\n this.model.layout(width, height);\n }\n getComponent() {\n return this._model;\n }\n toJSON() {\n return this.model.toJSON();\n }\n}\n\nconst themeDark = {\n name: 'dark',\n className: 'dockview-theme-dark',\n colorScheme: 'dark',\n};\nconst themeLight = {\n name: 'light',\n className: 'dockview-theme-light',\n colorScheme: 'light',\n};\nconst themeVisualStudio = {\n name: 'visualStudio',\n className: 'dockview-theme-vs',\n colorScheme: 'dark',\n // --dv-tabs-and-actions-container-height is 20px, but the VS theme applies\n // box-sizing: content-box + border-bottom: 2px, so the rendered strip is 22px.\n edgeGroupCollapsedSize: 22,\n};\nconst themeAbyss = {\n name: 'abyss',\n className: 'dockview-theme-abyss',\n colorScheme: 'dark',\n tabGroupIndicator: 'none',\n};\nconst themeDracula = {\n name: 'dracula',\n className: 'dockview-theme-dracula',\n colorScheme: 'dark',\n};\nconst themeAbyssSpaced = {\n name: 'abyssSpaced',\n className: 'dockview-theme-abyss-spaced',\n colorScheme: 'dark',\n gap: 10,\n edgeGroupCollapsedSize: 44,\n dndOverlayMounting: 'absolute',\n dndPanelOverlay: 'group',\n dndTabIndicator: 'line',\n dndOverlayBorder: '2px solid var(--dv-active-sash-color)',\n};\nconst themeLightSpaced = {\n name: 'lightSpaced',\n className: 'dockview-theme-light-spaced',\n colorScheme: 'light',\n gap: 10,\n edgeGroupCollapsedSize: 44,\n dndOverlayMounting: 'absolute',\n dndPanelOverlay: 'group',\n dndTabIndicator: 'line',\n dndOverlayBorder: '2px solid var(--dv-active-sash-color)',\n};\nconst themeNord = {\n name: 'nord',\n className: 'dockview-theme-nord',\n colorScheme: 'dark',\n};\nconst themeNordSpaced = {\n name: 'nordSpaced',\n className: 'dockview-theme-nord-spaced',\n colorScheme: 'dark',\n gap: 10,\n edgeGroupCollapsedSize: 44,\n dndOverlayMounting: 'absolute',\n dndPanelOverlay: 'group',\n dndTabIndicator: 'line',\n dndOverlayBorder: '2px solid var(--dv-active-sash-color)',\n};\nconst themeCatppuccinMocha = {\n name: 'catppuccinMocha',\n className: 'dockview-theme-catppuccin-mocha',\n colorScheme: 'dark',\n};\nconst themeCatppuccinMochaSpaced = {\n name: 'catppuccinMochaSpaced',\n className: 'dockview-theme-catppuccin-mocha-spaced',\n colorScheme: 'dark',\n gap: 10,\n edgeGroupCollapsedSize: 44,\n dndOverlayMounting: 'absolute',\n dndPanelOverlay: 'group',\n dndTabIndicator: 'line',\n dndOverlayBorder: '2px solid var(--dv-active-sash-color)',\n};\nconst themeMonokai = {\n name: 'monokai',\n className: 'dockview-theme-monokai',\n colorScheme: 'dark',\n};\nconst themeSolarizedLight = {\n name: 'solarizedLight',\n className: 'dockview-theme-solarized-light',\n colorScheme: 'light',\n};\nconst themeSolarizedLightSpaced = {\n name: 'solarizedLightSpaced',\n className: 'dockview-theme-solarized-light-spaced',\n colorScheme: 'light',\n gap: 10,\n edgeGroupCollapsedSize: 44,\n dndOverlayMounting: 'absolute',\n dndPanelOverlay: 'group',\n dndTabIndicator: 'line',\n dndOverlayBorder: '2px solid var(--dv-active-sash-color)',\n};\nconst themeGithubDark = {\n name: 'githubDark',\n className: 'dockview-theme-github-dark',\n colorScheme: 'dark',\n};\nconst themeGithubDarkSpaced = {\n name: 'githubDarkSpaced',\n className: 'dockview-theme-github-dark-spaced',\n colorScheme: 'dark',\n gap: 10,\n edgeGroupCollapsedSize: 44,\n dndOverlayMounting: 'absolute',\n dndPanelOverlay: 'group',\n dndTabIndicator: 'line',\n dndOverlayBorder: '2px solid var(--dv-active-sash-color)',\n};\nconst themeGithubLight = {\n name: 'githubLight',\n className: 'dockview-theme-github-light',\n colorScheme: 'light',\n};\nconst themeGithubLightSpaced = {\n name: 'githubLightSpaced',\n className: 'dockview-theme-github-light-spaced',\n colorScheme: 'light',\n gap: 10,\n edgeGroupCollapsedSize: 44,\n dndOverlayMounting: 'absolute',\n dndPanelOverlay: 'group',\n dndTabIndicator: 'line',\n dndOverlayBorder: '2px solid var(--dv-active-sash-color)',\n};\n\nclass DockviewPanelApiImpl extends GridviewPanelApiImpl {\n get location() {\n return this.group.api.location;\n }\n get title() {\n return this.panel.title;\n }\n get isGroupActive() {\n return this.group.isActive;\n }\n get renderer() {\n return this.panel.renderer;\n }\n set group(value) {\n const oldGroup = this._group;\n if (this._group !== value) {\n this._group = value;\n this._onDidGroupChange.fire({});\n this.setupGroupEventListeners(oldGroup);\n this._onDidLocationChange.fire({\n location: this.group.api.location,\n });\n }\n }\n get group() {\n return this._group;\n }\n get tabComponent() {\n return this._tabComponent;\n }\n constructor(panel, group, accessor, component, tabComponent) {\n super(panel.id, component);\n this.panel = panel;\n this.accessor = accessor;\n this._onDidTitleChange = new Emitter();\n this.onDidTitleChange = this._onDidTitleChange.event;\n this._onDidActiveGroupChange = new Emitter();\n this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;\n this._onDidGroupChange = new Emitter();\n this.onDidGroupChange = this._onDidGroupChange.event;\n this._onDidRendererChange = new Emitter();\n this.onDidRendererChange = this._onDidRendererChange.event;\n this._onDidLocationChange = new Emitter();\n this.onDidLocationChange = this._onDidLocationChange.event;\n this.groupEventsDisposable = new MutableDisposable();\n this._tabComponent = tabComponent;\n this.initialize(panel);\n this._group = group;\n this.setupGroupEventListeners();\n this.addDisposables(this.groupEventsDisposable, this._onDidRendererChange, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange, this._onDidLocationChange);\n }\n getWindow() {\n return this.group.api.getWindow();\n }\n setActive() {\n // A bare `panel.api.setActive()` from application code is a\n // programmatic activation. Tag it `'api'` so `onDidActivePanelChange`\n // reports the correct origin; user-gesture call sites that route\n // through here wrap the call in `withOrigin('user')` first, which wins.\n this.accessor.withOrigin('api', () => super.setActive());\n }\n moveTo(options) {\n var _a, _b;\n this.accessor.moveGroupOrPanel({\n from: { groupId: this._group.id, panelId: this.panel.id },\n to: {\n group: (_a = options.group) !== null && _a !== void 0 ? _a : this._group,\n position: options.group\n ? ((_b = options.position) !== null && _b !== void 0 ? _b : 'center')\n : 'center',\n index: options.index,\n },\n skipSetActive: options.skipSetActive,\n });\n }\n setTitle(title) {\n this.panel.setTitle(title);\n }\n setRenderer(renderer) {\n this.panel.setRenderer(renderer);\n }\n close() {\n this.group.model.closePanel(this.panel);\n }\n maximize() {\n this.group.api.maximize();\n }\n isMaximized() {\n return this.group.api.isMaximized();\n }\n exitMaximized() {\n this.group.api.exitMaximized();\n }\n setupGroupEventListeners(previousGroup) {\n var _a;\n let _trackGroupActive = (_a = previousGroup === null || previousGroup === void 0 ? void 0 : previousGroup.isActive) !== null && _a !== void 0 ? _a : false; // prevent duplicate events with same state\n this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidVisibilityChange((event) => {\n const hasBecomeHidden = !event.isVisible && this.isVisible;\n const hasBecomeVisible = event.isVisible && !this.isVisible;\n const isActivePanel = this.group.model.isPanelActive(this.panel);\n if (hasBecomeHidden || (hasBecomeVisible && isActivePanel)) {\n this._onDidVisibilityChange.fire(event);\n }\n }), this.group.api.onDidLocationChange((event) => {\n if (this.group !== this.panel.group) {\n return;\n }\n this._onDidLocationChange.fire(event);\n }), this.group.api.onDidActiveChange(() => {\n if (this.group !== this.panel.group) {\n return;\n }\n if (_trackGroupActive !== this.isGroupActive) {\n _trackGroupActive = this.isGroupActive;\n this._onDidActiveGroupChange.fire({\n isActive: this.isGroupActive,\n });\n }\n }));\n }\n}\n\nclass DockviewPanel extends CompositeDisposable {\n get params() {\n return this._params;\n }\n get title() {\n return this._title;\n }\n get group() {\n return this._group;\n }\n get renderer() {\n var _a;\n return (_a = this._renderer) !== null && _a !== void 0 ? _a : this.accessor.renderer;\n }\n get minimumWidth() {\n return this._minimumWidth;\n }\n get minimumHeight() {\n return this._minimumHeight;\n }\n get maximumWidth() {\n return this._maximumWidth;\n }\n get maximumHeight() {\n return this._maximumHeight;\n }\n constructor(id, component, tabComponent, accessor, containerApi, group, view, options) {\n super();\n this.id = id;\n this.accessor = accessor;\n this.containerApi = containerApi;\n this.view = view;\n this._renderer = options.renderer;\n this._group = group;\n this._minimumWidth = options.minimumWidth;\n this._minimumHeight = options.minimumHeight;\n this._maximumWidth = options.maximumWidth;\n this._maximumHeight = options.maximumHeight;\n this.api = new DockviewPanelApiImpl(this, this._group, accessor, component, tabComponent);\n this.addDisposables(this.api.onActiveChange(() => {\n accessor.setActivePanel(this);\n }), this.api.onDidSizeChange((event) => {\n // forward the resize event to the group since if you want to resize a panel\n // you are actually just resizing the panels parent which is the group\n this.group.api.setSize(event);\n }), this.api.onDidRendererChange(() => {\n this.group.model.rerender(this);\n }));\n }\n init(params) {\n this._params = params.params;\n this.view.init(Object.assign(Object.assign({}, params), { api: this.api, containerApi: this.containerApi }));\n this.setTitle(params.title);\n }\n focus() {\n const event = new WillFocusEvent();\n this.api._onWillFocus.fire(event);\n if (event.defaultPrevented) {\n return;\n }\n if (!this.api.isActive) {\n this.api.setActive();\n }\n }\n toJSON() {\n return {\n id: this.id,\n contentComponent: this.view.contentComponent,\n tabComponent: this.view.tabComponent,\n params: Object.keys(this._params || {}).length > 0\n ? this._params\n : undefined,\n title: this.title,\n renderer: this._renderer,\n minimumHeight: this._minimumHeight,\n maximumHeight: this._maximumHeight,\n minimumWidth: this._minimumWidth,\n maximumWidth: this._maximumWidth,\n };\n }\n setTitle(title) {\n const didTitleChange = title !== this.title;\n if (didTitleChange) {\n this._title = title;\n // keep the view-model's cached init params in sync so that tab\n // renderers constructed lazily (e.g. the header overflow\n // dropdown via createTabRenderer) see the updated title\n // (#914).\n this.view.setTitle(title);\n this.api._onDidTitleChange.fire({ title });\n }\n }\n setRenderer(renderer) {\n const didChange = renderer !== this.renderer;\n if (didChange) {\n this._renderer = renderer;\n this.api._onDidRendererChange.fire({\n renderer: renderer,\n });\n }\n }\n update(event) {\n var _a;\n // merge the new parameters with the existing parameters\n this._params = Object.assign(Object.assign({}, ((_a = this._params) !== null && _a !== void 0 ? _a : {})), event.params);\n /**\n * delete new keys that have a value of undefined,\n * allow values of null\n */\n for (const key of Object.keys(event.params)) {\n if (event.params[key] === undefined) {\n delete this._params[key];\n }\n }\n // update the view with the updated props\n this.view.update({\n params: this._params,\n });\n }\n updateFromStateModel(state) {\n var _a, _b, _c;\n this._maximumHeight = state.maximumHeight;\n this._minimumHeight = state.minimumHeight;\n this._maximumWidth = state.maximumWidth;\n this._minimumWidth = state.minimumWidth;\n this.update({ params: (_a = state.params) !== null && _a !== void 0 ? _a : {} });\n this.setTitle((_b = state.title) !== null && _b !== void 0 ? _b : this.id);\n this.setRenderer((_c = state.renderer) !== null && _c !== void 0 ? _c : this.accessor.renderer);\n // state.contentComponent;\n // state.tabComponent;\n }\n updateParentGroup(group, options) {\n this._group = group;\n this.api.group = this._group;\n const isPanelVisible = this._group.model.isPanelActive(this);\n const isActive = this.group.api.isActive && isPanelVisible;\n if (!(options === null || options === void 0 ? void 0 : options.skipSetActive)) {\n if (this.api.isActive !== isActive) {\n this.api._onDidActiveChange.fire({\n isActive: this.group.api.isActive && isPanelVisible,\n });\n }\n }\n if (this.api.isVisible !== isPanelVisible) {\n this.api._onDidVisibilityChange.fire({\n isVisible: isPanelVisible,\n });\n }\n }\n runEvents() {\n const isPanelVisible = this._group.model.isPanelActive(this);\n const isActive = this.group.api.isActive && isPanelVisible;\n if (this.api.isActive !== isActive) {\n this.api._onDidActiveChange.fire({\n isActive: this.group.api.isActive && isPanelVisible,\n });\n }\n if (this.api.isVisible !== isPanelVisible) {\n this.api._onDidVisibilityChange.fire({\n isVisible: isPanelVisible,\n });\n }\n }\n layout(width, height) {\n // TODO: Can we somehow do height without header height or indicate what the header height is?\n this.api._onDidDimensionChange.fire({\n width,\n height: height,\n });\n this.view.layout(width, height);\n }\n dispose() {\n this.api.dispose();\n this.view.dispose();\n }\n}\n\nclass DefaultTab extends CompositeDisposable {\n get element() {\n return this._element;\n }\n constructor() {\n super();\n this._element = document.createElement('div');\n this._element.className = 'dv-default-tab';\n this._content = document.createElement('div');\n this._content.className = 'dv-default-tab-content';\n this.action = document.createElement('div');\n this.action.className = 'dv-default-tab-action';\n this.action.appendChild(createCloseButton());\n this._element.appendChild(this._content);\n this._element.appendChild(this.action);\n this.render();\n }\n init(params) {\n this._title = params.title;\n this.addDisposables(params.api.onDidTitleChange((event) => {\n this._title = event.title;\n this.render();\n }), addDisposableListener(this.action, 'pointerdown', (ev) => {\n ev.preventDefault();\n }), addDisposableListener(this.action, 'click', (ev) => {\n if (ev.defaultPrevented) {\n return;\n }\n ev.preventDefault();\n params.api.close();\n }));\n this.render();\n }\n render() {\n var _a;\n if (this._content.textContent !== this._title) {\n this._content.textContent = (_a = this._title) !== null && _a !== void 0 ? _a : '';\n }\n }\n}\n\nclass DockviewPanelModel {\n get content() {\n return this._content;\n }\n get tab() {\n return this._tab;\n }\n constructor(accessor, id, contentComponent, tabComponent) {\n this.accessor = accessor;\n this.id = id;\n this.contentComponent = contentComponent;\n this.tabComponent = tabComponent;\n this._content = this.createContentComponent(this.id, contentComponent);\n this._tab = this.createTabComponent(this.id, tabComponent);\n }\n createTabRenderer(tabLocation) {\n var _a;\n const cmp = this.createTabComponent(this.id, this.tabComponent);\n if (this._params) {\n cmp.init(Object.assign(Object.assign({}, this._params), { tabLocation }));\n }\n if (this._updateEvent) {\n (_a = cmp.update) === null || _a === void 0 ? void 0 : _a.call(cmp, this._updateEvent);\n }\n return cmp;\n }\n init(params) {\n this._params = params;\n this.content.init(params);\n this.tab.init(Object.assign(Object.assign({}, params), { tabLocation: 'header' }));\n }\n setTitle(title) {\n // keep the cached init params in sync so that tab renderers created\n // lazily after the title changes (e.g. for the header overflow\n // dropdown) see the current title rather than the stale original.\n if (this._params) {\n this._params.title = title;\n }\n }\n layout(width, height) {\n var _a, _b;\n (_b = (_a = this.content).layout) === null || _b === void 0 ? void 0 : _b.call(_a, width, height);\n }\n update(event) {\n var _a, _b, _c, _d;\n this._updateEvent = event;\n (_b = (_a = this.content).update) === null || _b === void 0 ? void 0 : _b.call(_a, event);\n (_d = (_c = this.tab).update) === null || _d === void 0 ? void 0 : _d.call(_c, event);\n }\n dispose() {\n var _a, _b, _c, _d;\n (_b = (_a = this.content).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);\n (_d = (_c = this.tab).dispose) === null || _d === void 0 ? void 0 : _d.call(_c);\n }\n createContentComponent(id, componentName) {\n return this.accessor.options.createComponent({\n id,\n name: componentName,\n });\n }\n createTabComponent(id, componentName) {\n const name = componentName !== null && componentName !== void 0 ? componentName : this.accessor.options.defaultTabComponent;\n if (name) {\n if (this.accessor.options.createTabComponent) {\n const component = this.accessor.options.createTabComponent({\n id,\n name,\n });\n if (component) {\n return component;\n }\n else {\n return new DefaultTab();\n }\n }\n console.warn(`dockview: tabComponent '${componentName}' was not found. falling back to the default tab.`);\n }\n return new DefaultTab();\n }\n}\n\nclass DefaultDockviewDeserialzier {\n constructor(accessor) {\n this.accessor = accessor;\n }\n fromJSON(panelData, group) {\n var _a, _b;\n const panelId = panelData.id;\n const params = panelData.params;\n const title = panelData.title;\n const viewData = panelData.view;\n const contentComponent = viewData\n ? viewData.content.id\n : ((_a = panelData.contentComponent) !== null && _a !== void 0 ? _a : 'unknown');\n const tabComponent = viewData\n ? (_b = viewData.tab) === null || _b === void 0 ? void 0 : _b.id\n : panelData.tabComponent;\n const view = new DockviewPanelModel(this.accessor, panelId, contentComponent, tabComponent);\n const panel = new DockviewPanel(panelId, contentComponent, tabComponent, this.accessor, new DockviewApi(this.accessor), group, view, {\n renderer: panelData.renderer,\n minimumWidth: panelData.minimumWidth,\n minimumHeight: panelData.minimumHeight,\n maximumWidth: panelData.maximumWidth,\n maximumHeight: panelData.maximumHeight,\n });\n panel.init({\n title: title !== null && title !== void 0 ? title : panelId,\n params: params !== null && params !== void 0 ? params : {},\n });\n return panel;\n }\n}\n\nclass Watermark extends CompositeDisposable {\n get element() {\n return this._element;\n }\n constructor() {\n super();\n this._element = document.createElement('div');\n this._element.className = 'dv-watermark';\n }\n init(_params) {\n // noop\n }\n}\n\nclass AriaLevelTracker {\n constructor() {\n this._orderedList = [];\n }\n push(element) {\n this._orderedList = [\n ...this._orderedList.filter((item) => item !== element),\n element,\n ];\n this.update();\n }\n destroy(element) {\n this._orderedList = this._orderedList.filter((item) => item !== element);\n this.update();\n }\n update() {\n for (let i = 0; i < this._orderedList.length; i++) {\n this._orderedList[i].setAttribute('aria-level', `${i}`);\n this._orderedList[i].style.zIndex =\n `calc(var(--dv-overlay-z-index, 999) + ${i * 2})`;\n }\n }\n}\nconst arialLevelTracker = new AriaLevelTracker();\nclass Overlay extends CompositeDisposable {\n set minimumInViewportWidth(value) {\n this.options.minimumInViewportWidth = value;\n }\n set minimumInViewportHeight(value) {\n this.options.minimumInViewportHeight = value;\n }\n get element() {\n return this._element;\n }\n get isVisible() {\n return this._isVisible;\n }\n /**\n * Height of the optional drag-handle header, or 0 when none is present.\n * Used to translate between the overlay's outer box and the content area\n * available to the group beneath the header.\n */\n get headerHeight() {\n var _a, _b;\n return (_b = (_a = this.options.header) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0;\n }\n constructor(options) {\n super();\n this.options = options;\n this._element = document.createElement('div');\n this._onDidChange = new Emitter();\n this.onDidChange = this._onDidChange.event;\n this._onDidChangeEnd = new Emitter();\n this.onDidChangeEnd = this._onDidChangeEnd.event;\n this._onDidStartMoving = new Emitter();\n /** Fires once per drag, the first time the float actually moves. */\n this.onDidStartMoving = this._onDidStartMoving.event;\n this._dragMove = new MutableDisposable();\n this._dragCancelled = false;\n this.addDisposables(this._onDidChange, this._onDidChangeEnd, this._onDidStartMoving, this._dragMove);\n this._element.className = 'dv-resize-container';\n // Floating groups are non-modal dialogs over the layout. The contained\n // group(s) carry their own `role=\"region\"` + label, so the dialog\n // itself only needs role + modality here.\n this._element.setAttribute('role', 'dialog');\n this._element.setAttribute('aria-modal', 'false');\n this._isVisible = true;\n this.setupResize('top');\n this.setupResize('bottom');\n this.setupResize('left');\n this.setupResize('right');\n this.setupResize('topleft');\n this.setupResize('topright');\n this.setupResize('bottomleft');\n this.setupResize('bottomright');\n if (this.options.header) {\n toggleClass(this._element, 'dv-resize-container-with-titlebar', true);\n this._element.appendChild(this.options.header);\n }\n this._element.appendChild(this.options.content);\n this.options.container.appendChild(this._element);\n // if input bad resize within acceptable boundaries\n 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 })));\n arialLevelTracker.push(this._element);\n }\n setVisible(isVisible) {\n if (isVisible === this.isVisible) {\n return;\n }\n this._isVisible = isVisible;\n toggleClass(this.element, 'dv-hidden', !this.isVisible);\n }\n bringToFront() {\n arialLevelTracker.push(this._element);\n }\n setBounds(bounds = {}) {\n if (typeof bounds.height === 'number') {\n this._element.style.height = `${bounds.height}px`;\n }\n if (typeof bounds.width === 'number') {\n this._element.style.width = `${bounds.width}px`;\n }\n if ('top' in bounds && typeof bounds.top === 'number') {\n this._element.style.top = `${bounds.top}px`;\n this._element.style.bottom = 'auto';\n this.verticalAlignment = 'top';\n }\n if ('bottom' in bounds && typeof bounds.bottom === 'number') {\n this._element.style.bottom = `${bounds.bottom}px`;\n this._element.style.top = 'auto';\n this.verticalAlignment = 'bottom';\n }\n if ('left' in bounds && typeof bounds.left === 'number') {\n this._element.style.left = `${bounds.left}px`;\n this._element.style.right = 'auto';\n this.horiziontalAlignment = 'left';\n }\n if ('right' in bounds && typeof bounds.right === 'number') {\n this._element.style.right = `${bounds.right}px`;\n this._element.style.left = 'auto';\n this.horiziontalAlignment = 'right';\n }\n const containerRect = this.options.container.getBoundingClientRect();\n const overlayRect = this._element.getBoundingClientRect();\n // region: ensure bounds within allowable limits\n // a minimum width of minimumViewportWidth must be inside the viewport\n const xOffset = Math.max(0, this.getMinimumWidth(overlayRect.width));\n // a minimum height of minimumViewportHeight must be inside the viewport\n const yOffset = Math.max(0, this.getMinimumHeight(overlayRect.height));\n if (this.verticalAlignment === 'top') {\n const top = clamp(overlayRect.top - containerRect.top, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));\n this._element.style.top = `${top}px`;\n this._element.style.bottom = 'auto';\n }\n if (this.verticalAlignment === 'bottom') {\n const bottom = clamp(containerRect.bottom - overlayRect.bottom, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));\n this._element.style.bottom = `${bottom}px`;\n this._element.style.top = 'auto';\n }\n if (this.horiziontalAlignment === 'left') {\n const left = clamp(overlayRect.left - containerRect.left, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));\n this._element.style.left = `${left}px`;\n this._element.style.right = 'auto';\n }\n if (this.horiziontalAlignment === 'right') {\n const right = clamp(containerRect.right - overlayRect.right, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));\n this._element.style.right = `${right}px`;\n this._element.style.left = 'auto';\n }\n this._onDidChange.fire();\n }\n toJSON() {\n const container = this.options.container.getBoundingClientRect();\n const element = this._element.getBoundingClientRect();\n const result = {};\n if (this.verticalAlignment === 'top') {\n result.top = parseFloat(this._element.style.top);\n }\n else if (this.verticalAlignment === 'bottom') {\n result.bottom = parseFloat(this._element.style.bottom);\n }\n else {\n result.top = element.top - container.top;\n }\n if (this.horiziontalAlignment === 'left') {\n result.left = parseFloat(this._element.style.left);\n }\n else if (this.horiziontalAlignment === 'right') {\n result.right = parseFloat(this._element.style.right);\n }\n else {\n result.left = element.left - container.left;\n }\n result.width = element.width;\n result.height = element.height;\n return result;\n }\n /**\n * Abort an in-flight move-the-float drag. Used by the void container\n * when a redock long-press fires after the move started, so the ghost\n * gesture wins without the float continuing to follow the finger.\n * Does not emit `onDidChangeEnd` because no change is being committed.\n */\n cancelPendingDrag() {\n if (!this._dragMove.value) {\n return;\n }\n this._dragCancelled = true;\n toggleClass(this._element, 'dv-resize-container-dragging', false);\n this._dragMove.value = Disposable.NONE;\n }\n setupDrag(dragTarget, options = { inDragMode: false }) {\n const track = (captureTarget, pointerId) => {\n var _a, _b, _c;\n let offset = null;\n let hasMoved = false;\n this._dragCancelled = false;\n // Snapshot once per drag — siblings don't move while this one drags.\n const siblingBoxes = this.options.transformDragPosition\n ? ((_c = (_b = (_a = this.options).getSiblingBoxes) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : [])\n : [];\n const iframes = disableIframePointEvents();\n if (captureTarget &&\n typeof pointerId === 'number' &&\n typeof captureTarget.setPointerCapture === 'function') {\n try {\n captureTarget.setPointerCapture(pointerId);\n }\n catch (_d) {\n // ignore – non-fatal if the browser refuses capture\n }\n }\n const end = () => {\n toggleClass(this._element, 'dv-resize-container-dragging', false);\n this._dragMove.value = Disposable.NONE;\n this._onDidChangeEnd.fire();\n };\n this._dragMove.value = new CompositeDisposable({\n dispose: () => {\n iframes.release();\n if (captureTarget &&\n typeof pointerId === 'number' &&\n typeof captureTarget.releasePointerCapture ===\n 'function') {\n try {\n captureTarget.releasePointerCapture(pointerId);\n }\n catch (_a) {\n // ignore – pointer may already be released\n }\n }\n },\n }, addDisposableListener(window, 'pointermove', (e) => {\n if (this._dragCancelled) {\n return;\n }\n const containerRect = this.options.container.getBoundingClientRect();\n const x = e.clientX - containerRect.left;\n const y = e.clientY - containerRect.top;\n toggleClass(this._element, 'dv-resize-container-dragging', true);\n const overlayRect = this._element.getBoundingClientRect();\n if (offset === null) {\n offset = {\n x: e.clientX - overlayRect.left,\n y: e.clientY - overlayRect.top,\n };\n }\n const xOffset = Math.max(0, this.getMinimumWidth(overlayRect.width));\n const yOffset = Math.max(0, this.getMinimumHeight(overlayRect.height));\n let proposedTop = y - offset.y;\n let proposedLeft = x - offset.x;\n // Let a consumer nudge the proposed position (snapping,\n // custom bounds) before the container clamp below.\n if (this.options.transformDragPosition) {\n const adjusted = this.options.transformDragPosition({\n proposed: {\n top: proposedTop,\n left: proposedLeft,\n width: overlayRect.width,\n height: overlayRect.height,\n },\n container: {\n width: containerRect.width,\n height: containerRect.height,\n },\n others: siblingBoxes,\n });\n if (adjusted) {\n proposedTop = adjusted.top;\n proposedLeft = adjusted.left;\n }\n }\n const maxTop = Math.max(0, containerRect.height - overlayRect.height + yOffset);\n const maxLeft = Math.max(0, containerRect.width - overlayRect.width + xOffset);\n const top = clamp(proposedTop, -yOffset, maxTop);\n const bottom = clamp(containerRect.height - overlayRect.height - proposedTop, -yOffset, maxTop);\n const left = clamp(proposedLeft, -xOffset, maxLeft);\n const right = clamp(containerRect.width - overlayRect.width - proposedLeft, -xOffset, maxLeft);\n const bounds = {};\n // Anchor to top or to bottom depending on which one is closer\n if (top <= bottom) {\n bounds.top = top;\n }\n else {\n bounds.bottom = bottom;\n }\n // Anchor to left or to right depending on which one is closer\n if (left <= right) {\n bounds.left = left;\n }\n else {\n bounds.right = right;\n }\n this.setBounds(bounds);\n if (!hasMoved) {\n hasMoved = true;\n this._onDidStartMoving.fire();\n }\n }), addDisposableListener(window, 'pointerup', end), addDisposableListener(window, 'pointercancel', end));\n };\n this.addDisposables(addDisposableListener(dragTarget, 'pointerdown', (event) => {\n if (event.defaultPrevented) {\n event.preventDefault();\n return;\n }\n // if somebody has marked this event then treat as a defaultPrevented\n // without actually calling event.preventDefault()\n if (quasiDefaultPrevented(event)) {\n return;\n }\n track(dragTarget, event.pointerId);\n }), addDisposableListener(this.options.content, 'pointerdown', (event) => {\n if (event.defaultPrevented) {\n return;\n }\n // if somebody has marked this event then treat as a defaultPrevented\n // without actually calling event.preventDefault()\n if (quasiDefaultPrevented(event)) {\n return;\n }\n if (event.shiftKey) {\n track(this.options.content, event.pointerId);\n }\n }), addDisposableListener(this.options.content, 'pointerdown', () => {\n arialLevelTracker.push(this._element);\n }, true));\n if (options.inDragMode) {\n track();\n }\n }\n setupResize(direction) {\n const resizeHandleElement = document.createElement('div');\n resizeHandleElement.className = `dv-resize-handle-${direction}`;\n this._element.appendChild(resizeHandleElement);\n const move = new MutableDisposable();\n this.addDisposables(move, addDisposableListener(resizeHandleElement, 'pointerdown', (e) => {\n e.preventDefault();\n let startPosition = null;\n const iframes = disableIframePointEvents();\n const pointerId = e.pointerId;\n if (typeof resizeHandleElement.setPointerCapture === 'function') {\n try {\n resizeHandleElement.setPointerCapture(pointerId);\n }\n catch (_a) {\n // ignore – non-fatal if the browser refuses capture\n }\n }\n const end = () => {\n move.dispose();\n this._onDidChangeEnd.fire();\n };\n move.value = new CompositeDisposable(addDisposableListener(window, 'pointermove', (e) => {\n const containerRect = this.options.container.getBoundingClientRect();\n const overlayRect = this._element.getBoundingClientRect();\n const y = e.clientY - containerRect.top;\n const x = e.clientX - containerRect.left;\n if (startPosition === null) {\n // record the initial dimensions since as all subsequence moves are relative to this\n startPosition = {\n originalY: y,\n originalHeight: overlayRect.height,\n originalX: x,\n originalWidth: overlayRect.width,\n };\n }\n let top = undefined;\n let bottom = undefined;\n let height = undefined;\n let left = undefined;\n let right = undefined;\n let width = undefined;\n const moveTop = () => {\n // When dragging top handle, constrain top position to prevent oversizing\n const maxTop = startPosition.originalY +\n startPosition.originalHeight >\n containerRect.height\n ? Math.max(0, containerRect.height -\n Overlay.MINIMUM_HEIGHT)\n : Math.max(0, startPosition.originalY +\n startPosition.originalHeight -\n Overlay.MINIMUM_HEIGHT);\n top = clamp(y, 0, maxTop);\n height =\n startPosition.originalY +\n startPosition.originalHeight -\n top;\n bottom = containerRect.height - top - height;\n };\n const moveBottom = () => {\n top =\n startPosition.originalY -\n startPosition.originalHeight;\n // When dragging bottom handle, constrain height to container height\n const minHeight = top < 0 &&\n typeof this.options.minimumInViewportHeight ===\n 'number'\n ? -top +\n this.options.minimumInViewportHeight\n : Overlay.MINIMUM_HEIGHT;\n const maxHeight = containerRect.height - Math.max(0, top);\n height = clamp(y - top, minHeight, maxHeight);\n bottom = containerRect.height - top - height;\n };\n const moveLeft = () => {\n const maxLeft = startPosition.originalX +\n startPosition.originalWidth >\n containerRect.width\n ? Math.max(0, containerRect.width -\n Overlay.MINIMUM_WIDTH) // Prevent extending beyong right edge\n : Math.max(0, startPosition.originalX +\n startPosition.originalWidth -\n Overlay.MINIMUM_WIDTH);\n left = clamp(x, 0, maxLeft); // min is 0 (Not -Infinity) to prevent dragging beyond left edge\n width =\n startPosition.originalX +\n startPosition.originalWidth -\n left;\n right = containerRect.width - left - width;\n };\n const moveRight = () => {\n left =\n startPosition.originalX -\n startPosition.originalWidth;\n // When dragging right handle, constrain width to container width\n const minWidth = left < 0 &&\n typeof this.options.minimumInViewportWidth ===\n 'number'\n ? -left +\n this.options.minimumInViewportWidth\n : Overlay.MINIMUM_WIDTH;\n const maxWidth = containerRect.width - Math.max(0, left);\n width = clamp(x - left, minWidth, maxWidth);\n right = containerRect.width - left - width;\n };\n switch (direction) {\n case 'top':\n moveTop();\n break;\n case 'bottom':\n moveBottom();\n break;\n case 'left':\n moveLeft();\n break;\n case 'right':\n moveRight();\n break;\n case 'topleft':\n moveTop();\n moveLeft();\n break;\n case 'topright':\n moveTop();\n moveRight();\n break;\n case 'bottomleft':\n moveBottom();\n moveLeft();\n break;\n case 'bottomright':\n moveBottom();\n moveRight();\n break;\n }\n const bounds = {};\n // Anchor to top or to bottom depending on which one is closer\n if (top <= bottom) {\n bounds.top = top;\n }\n else {\n bounds.bottom = bottom;\n }\n // Anchor to left or to right depending on which one is closer\n if (left <= right) {\n bounds.left = left;\n }\n else {\n bounds.right = right;\n }\n bounds.height = height;\n bounds.width = width;\n this.setBounds(bounds);\n }), {\n dispose: () => {\n iframes.release();\n if (typeof resizeHandleElement.releasePointerCapture ===\n 'function') {\n try {\n resizeHandleElement.releasePointerCapture(pointerId);\n }\n catch (_a) {\n // ignore – pointer may already be released\n }\n }\n },\n }, addDisposableListener(window, 'pointerup', end), addDisposableListener(window, 'pointercancel', end));\n }));\n }\n getMinimumWidth(width) {\n if (typeof this.options.minimumInViewportWidth === 'number') {\n return width - this.options.minimumInViewportWidth;\n }\n return 0;\n }\n getMinimumHeight(height) {\n if (typeof this.options.minimumInViewportHeight === 'number') {\n return height - this.options.minimumInViewportHeight;\n }\n return 0;\n }\n dispose() {\n arialLevelTracker.destroy(this._element);\n this._element.remove();\n super.dispose();\n }\n}\nOverlay.MINIMUM_HEIGHT = 20;\nOverlay.MINIMUM_WIDTH = 20;\n\n/**\n * A dedicated, blank drag handle rendered above a floating group's tab bar.\n *\n * It plays the same dual role the tab-bar void container plays today: a plain\n * pointer-drag moves the floating window (wired by the overlay via\n * `setupDrag`), while a shift+drag (mouse) or long-press (touch) detaches the\n * group to redock it into the grid. The redock half is provided by the shared\n * {@link GroupDragSource}; the move half is owned by the overlay.\n *\n * The bar is intentionally contentless — styling is driven entirely through\n * the `--dv-floating-titlebar-*` theme variables.\n */\nclass FloatingTitleBar extends CompositeDisposable {\n get element() {\n return this._element;\n }\n /** The window's current anchor group — the one this bar drags/activates. */\n get group() {\n return this._group;\n }\n /**\n * Retarget the bar at a new anchor group. Called when the original anchor\n * leaves a multi-group floating window and another member is promoted, so\n * the bar keeps activating/redocking a group that actually lives here.\n */\n setGroup(group) {\n this._group = group;\n }\n constructor(accessor, group) {\n super();\n this.accessor = accessor;\n this._onDragStart = new Emitter();\n this.onDragStart = this._onDragStart.event;\n this._group = group;\n this._element = document.createElement('div');\n this._element.className = 'dv-floating-titlebar';\n this.addDisposables(this._onDragStart, addDisposableListener(this._element, 'pointerdown', () => {\n this.accessor.doSetGroupActive(this._group);\n }), \n // Shift+pointerdown marks the event so the overlay's\n // move-the-float drag doesn't fire alongside the HTML5 redock\n // drag. See VoidContainer for the same disambiguation.\n addDisposableListener(this._element, 'pointerdown', (e) => {\n if (e.shiftKey) {\n quasiPreventDefault(e);\n }\n }, true));\n this.dragSource = new GroupDragSource({\n element: this._element,\n accessor: this.accessor,\n // resolve lazily so the drag source follows anchor reassignment\n group: () => this._group,\n });\n this.addDisposables(this.dragSource, this.dragSource.onDragStart((event) => {\n this._onDragStart.fire(event);\n }));\n }\n updateDragAndDropState() {\n this.dragSource.updateDragAndDropState();\n }\n}\n\n/**\n * Internal module system for dockview.\n *\n * Modules are feature bundles that register services into the dockview\n * component. `registerModules(...)` is the one public entry point — it lets a\n * sibling package contribute modules that `DockviewComponent` picks up at\n * construction. The richer opt-in surface (a per-component `modules` option,\n * framework wrappers) is still reserved for a future version; the module\n * authoring API (`defineModule`, the service contracts) remains internal.\n */\n/**\n * Typed helper for defining a module. Enforces that the factory's return\n * type matches the slot in ServiceCollection at compile time, replacing\n * the manual cast each module file would otherwise need.\n */\nfunction defineModule(config) {\n return {\n moduleName: config.name,\n services: {\n [config.serviceKey]: config.create,\n },\n init: config.init\n ? (host, services) => config.init(host, services[config.serviceKey])\n : undefined,\n dependsOn: config.dependsOn,\n };\n}\nconst _warnedMissingModule = new Set();\n/**\n * Returns the service if its module is registered, otherwise logs a\n * deduplicated console error and returns `undefined`. Modelled on AG Grid's\n * `assertModuleRegistered`: missing modules never throw — they degrade the\n * affected feature to a no-op so consuming applications don't crash in\n * production.\n *\n * Use at public-API entry points where the caller wants to surface which\n * module is missing. For internal/lifecycle paths, plain `?.` chaining on\n * the service slot is preferred — no log, just a silent no-op.\n */\nfunction assertModule(service, moduleName, context) {\n if (service !== undefined) {\n return service;\n }\n const key = `${moduleName}|${context !== null && context !== void 0 ? context : ''}`;\n if (_warnedMissingModule.has(key)) {\n return undefined;\n }\n _warnedMissingModule.add(key);\n const where = context ? ` for ${context}` : '';\n // eslint-disable-next-line no-console\n console.error(`dockview: module \"${moduleName}\" is not registered${where}.`);\n return undefined;\n}\nclass ModuleRegistry {\n constructor() {\n this._modules = new Map();\n this._services = {};\n this._initDisposables = [];\n }\n get services() {\n return this._services;\n }\n register(module) {\n if (this._modules.has(module.moduleName)) {\n return;\n }\n if (module.dependsOn) {\n for (const dep of module.dependsOn) {\n this.register(dep);\n }\n }\n this._modules.set(module.moduleName, module);\n }\n initialize(host) {\n for (const module of this._modules.values()) {\n if (!module.services) {\n continue;\n }\n for (const [name, factory] of Object.entries(module.services)) {\n this._services[name] = factory(host);\n }\n }\n }\n postConstruct(host) {\n for (const module of this._modules.values()) {\n if (module.init) {\n this._initDisposables.push(module.init(host, this._services));\n }\n }\n }\n has(moduleName) {\n return this._modules.has(moduleName);\n }\n dispose() {\n // Tear down init() subscriptions first so they stop firing into\n // services that are about to be disposed.\n for (const disposable of this._initDisposables) {\n disposable.dispose();\n }\n this._initDisposables.length = 0;\n for (const service of Object.values(this._services)) {\n if (service !== undefined &&\n typeof service.dispose === 'function') {\n service.dispose();\n }\n }\n }\n}\n/**\n * Process-global list of modules registered via {@link registerModules}.\n * `DockviewComponent` appends these to its built-in set at construction, so\n * importing a package that calls `registerModules(...)` (e.g. `dockview`)\n * makes those modules available to every component in the process —\n * modelled on AG Grid's `ModuleRegistry.registerModules`.\n */\nconst _globalModules = [];\n/**\n * Register modules globally. Idempotent per `moduleName` — registering the\n * same module twice is a no-op. Intended to be called once at import time by\n * the package that bundles a given set of modules.\n */\nfunction registerModules(modules) {\n for (const module of modules) {\n if (_globalModules.some((m) => m.moduleName === module.moduleName)) {\n continue;\n }\n _globalModules.push(module);\n }\n}\n/**\n * Returns the globally-registered modules (a copy). `DockviewComponent` reads\n * this to extend its built-in module set.\n */\nfunction getRegisteredModules() {\n return [..._globalModules];\n}\n/**\n * For tests — clears the global module registry.\n */\nfunction clearRegisteredModules() {\n _globalModules.length = 0;\n}\n/**\n * This marker exists for ONE purpose: a developer warning about the v7 package\n * renames. It has no functional effect on dockview's behaviour. Following the\n * renames, `dockview-core` is internal and `dockview` is the public JavaScript\n * package; `dockview` calls {@link markDockviewPackageLoaded} on import so that\n * `dockview-core` can detect — and warn about — being used directly.\n */\nlet _dockviewPackageLoaded = false;\n/**\n * Called once by the `dockview` package on import, solely so `dockview-core`\n * can warn when it is used directly (see above). Not used for anything else.\n */\nfunction markDockviewPackageLoaded() {\n _dockviewPackageLoaded = true;\n}\n/**\n * Whether the `dockview` package has been loaded in this process. Used only to\n * gate the \"don't use dockview-core directly\" developer warning.\n */\nfunction isDockviewPackageLoaded() {\n return _dockviewPackageLoaded;\n}\n\nconst DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE = 100;\nconst DEFAULT_FLOATING_GROUP_POSITION = {\n left: 100,\n top: 100,\n width: 300,\n height: 300,\n};\nconst DESERIALIZATION_POPOUT_DELAY_MS = 100;\n\nclass DockviewFloatingGroupPanel extends CompositeDisposable {\n /**\n * The window's representative/anchor group. A floating window can host a\n * nested layout of several groups; the anchor is used for back-compat\n * single-group APIs and is reassigned if it leaves the window.\n */\n get group() {\n return this._group;\n }\n /**\n * Register the dedicated title bar (if any) so anchor reassignment keeps\n * its drag handle pointed at a group that still lives in this window.\n */\n setTitleBar(titleBar) {\n this._titleBar = titleBar;\n }\n setAnchorGroup(group) {\n var _a;\n this._group = group;\n (_a = this._titleBar) === null || _a === void 0 ? void 0 : _a.setGroup(group);\n }\n constructor(group, overlay, \n /**\n * The floating window hosts its own gridview so it can hold a nested\n * splitview layout of groups, not just a single group.\n */\n gridview) {\n super();\n this.overlay = overlay;\n this.gridview = gridview;\n this._group = group;\n this.addDisposables(overlay, {\n // The gridview owns the floating window's DOM subtree (mounted as\n // the overlay's content). Disposing it tears down the splitview;\n // it does NOT dispose the leaf views (groups) — their lifecycle is\n // owned by the component's `_groups` map.\n dispose: () => this.gridview.dispose(),\n });\n }\n position(bounds) {\n this.overlay.setBounds(bounds);\n }\n}\n\nclass FloatingGroupService {\n get floatingGroups() {\n return this._floatingGroups;\n }\n constructor(host) {\n this._floatingGroups = [];\n this._host = host;\n }\n add(group, overlay, gridview) {\n const floatingGroupPanel = new DockviewFloatingGroupPanel(group, overlay, gridview);\n const disposable = new CompositeDisposable(group.api.onDidActiveChange((event) => {\n if (event.isActive) {\n overlay.bringToFront();\n }\n }), (() => {\n // The floating window's nested gridview fills the overlay\n // beneath the (optional) title bar; size it from its own\n // measured box so it follows the overlay as the user drags\n // / resizes the window.\n let lastWidth = -1;\n let lastHeight = -1;\n return watchElementResize(gridview.element, (entry) => {\n const width = Math.round(entry.contentRect.width);\n const height = Math.round(entry.contentRect.height);\n if (width === lastWidth && height === lastHeight) {\n return;\n }\n lastWidth = width;\n lastHeight = height;\n gridview.layout(width, height);\n });\n })());\n // Floating windows are non-modal dialogs (role set in Overlay). Give\n // the dialog an accessible name from the representative group's active\n // panel, refreshed as the active panel changes. An untitled panel\n // leaves the dialog unnamed rather than hard-coding a label string.\n const updateDialogLabel = () => {\n var _a;\n const title = (_a = group.activePanel) === null || _a === void 0 ? void 0 : _a.title;\n if (title) {\n overlay.element.setAttribute('aria-label', title);\n }\n else {\n overlay.element.removeAttribute('aria-label');\n }\n };\n updateDialogLabel();\n floatingGroupPanel.addDisposables(group.api.onDidActivePanelChange(() => updateDialogLabel()), overlay.onDidChange(() => {\n gridview.layout(gridview.width, gridview.height);\n }), overlay.onDidChangeEnd(() => {\n this._host.fireLayoutChange();\n }), group.onDidChange((event) => {\n // `event.height` is the group's requested *content* height.\n // When a dedicated title bar is present the overlay's outer\n // box is taller by the header, so add it back to preserve the\n // requested content size.\n overlay.setBounds({\n height: typeof (event === null || event === void 0 ? void 0 : event.height) === 'number'\n ? event.height + overlay.headerHeight\n : event === null || event === void 0 ? void 0 : event.height,\n width: event === null || event === void 0 ? void 0 : event.width,\n });\n }), {\n dispose: () => {\n disposable.dispose();\n remove(this._floatingGroups, floatingGroupPanel);\n group.model.location = { type: 'grid' };\n },\n });\n this._floatingGroups.push(floatingGroupPanel);\n return floatingGroupPanel;\n }\n findByGroup(group) {\n // A floating window may host several groups in a nested gridview, so\n // match by membership (DOM containment) rather than only the anchor\n // group. `floating.group === group` covers the brief window before the\n // anchor's element is attached to the gridview.\n return this._floatingGroups.find((floating) => floating.group === group ||\n floating.gridview.element.contains(group.element));\n }\n serialize() {\n return this._floatingGroups.map((floating) => {\n const grid = floating.gridview.serialize();\n const position = floating.overlay.toJSON();\n const root = grid.root;\n // A single-group window keeps the legacy `data` shape so layouts\n // round-trip byte-stably and older readers keep working; only\n // genuine multi-group windows emit the nested `grid` form.\n if (root.type === 'branch' &&\n root.data.length === 1 &&\n root.data[0].type === 'leaf') {\n return {\n data: root.data[0].data,\n position,\n };\n }\n return { grid, position };\n });\n }\n constrainBounds() {\n for (const floating of this._floatingGroups) {\n floating.overlay.setBounds();\n }\n }\n updateBounds(options) {\n var _a, _b;\n if (!('floatingGroupBounds' in options)) {\n return;\n }\n for (const group of this._floatingGroups) {\n switch (options.floatingGroupBounds) {\n case 'boundedWithinViewport':\n group.overlay.minimumInViewportHeight = undefined;\n group.overlay.minimumInViewportWidth = undefined;\n break;\n case undefined:\n group.overlay.minimumInViewportHeight =\n DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE;\n group.overlay.minimumInViewportWidth =\n DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE;\n break;\n default:\n group.overlay.minimumInViewportHeight =\n (_a = options.floatingGroupBounds) === null || _a === void 0 ? void 0 : _a.minimumHeightWithinViewport;\n group.overlay.minimumInViewportWidth =\n (_b = options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;\n }\n group.overlay.setBounds();\n }\n }\n disposeAll() {\n for (const floating of [...this._floatingGroups]) {\n floating.dispose();\n }\n }\n dispose() {\n this.disposeAll();\n }\n}\nconst FloatingGroupModule = defineModule({\n name: 'FloatingGroup',\n serviceKey: 'floatingGroupService',\n create: (host) => new FloatingGroupService(host),\n});\n\nclass PopoutWindowService {\n constructor(host) {\n this._entries = [];\n this._popupServices = new Map();\n this._restorationCleanups = new Set();\n this._restorationPromise = Promise.resolve();\n this._onDidRemove = new Emitter();\n this.onDidRemove = this._onDidRemove.event;\n this._host = host;\n }\n get entries() {\n return this._entries;\n }\n get restorationPromise() {\n return this._restorationPromise;\n }\n add(entry) {\n this._entries.push(entry);\n }\n remove(entry) {\n // Fire only on a genuine removal, and not while the host component is\n // tearing down (consumers don't want popout-removed events during\n // dispose).\n if (remove(this._entries, entry) && !this._host.isDisposed) {\n this._onDidRemove.fire(entry);\n }\n }\n findByGroup(group) {\n // A popout window may host several groups in a nested gridview, so\n // match by membership (DOM containment) rather than only the anchor.\n return this._entries.find((entry) => entry.popoutGroup === group ||\n entry.gridview.element.contains(group.element));\n }\n findReferenceGroupId(group) {\n var _a;\n return (_a = this._entries.find((entry) => entry.popoutGroup === group)) === null || _a === void 0 ? void 0 : _a.referenceGroup;\n }\n /**\n * The popout window's innerWidth/innerHeight are often 0/stale until it has\n * painted, and the nested gridview lays its children out to the size passed\n * to layout() (a plain group fills via CSS instead). To stop content\n * rendering into a zero box until a manual resize — and to avoid the race a\n * fixed number of animation frames had — observe the gridview element with\n * a ResizeObserver created in the POPOUT window's OWN realm. A parent-realm\n * observer fires unreliably across the window boundary; a same-realm one\n * fires reliably, including the initial observation once the window is\n * sized.\n *\n * @returns a disposable that disconnects the observer, or `undefined` when\n * the popout realm has no ResizeObserver (e.g. jsdom).\n */\n observeGridviewSize(popoutWindow, gridview, overlayRenderContainer) {\n var _a;\n const PopoutResizeObserver = (_a = popoutWindow.window) === null || _a === void 0 ? void 0 : _a.ResizeObserver;\n if (!PopoutResizeObserver) {\n return undefined;\n }\n let lastWidth = -1;\n let lastHeight = -1;\n const relayout = () => {\n const win = popoutWindow.window;\n if (this._host.isDisposed || !win || win.closed) {\n return;\n }\n const width = Math.round(gridview.element.clientWidth);\n const height = Math.round(gridview.element.clientHeight);\n if (width === lastWidth && height === lastHeight) {\n return;\n }\n lastWidth = width;\n lastHeight = height;\n if (width > 0 && height > 0) {\n gridview.layout(width, height);\n }\n overlayRenderContainer.updateAllPositions();\n };\n const observer = new PopoutResizeObserver(() => {\n var _a;\n // Defer out of the observer callback into the popout's own frame to\n // size against the settled layout and to avoid resize-loop warnings.\n const raf = (_a = popoutWindow.window) === null || _a === void 0 ? void 0 : _a.requestAnimationFrame;\n if (raf) {\n raf.call(popoutWindow.window, relayout);\n }\n else {\n relayout();\n }\n });\n observer.observe(gridview.element);\n return { dispose: () => observer.disconnect() };\n }\n getPopupService(groupId) {\n return this._popupServices.get(groupId);\n }\n setPopupService(groupId, service) {\n this._popupServices.set(groupId, service);\n }\n deletePopupService(groupId) {\n this._popupServices.delete(groupId);\n }\n scheduleRestoration(delayMs, work, onCancel) {\n return new Promise((resolve) => {\n const cleanup = () => {\n this._restorationCleanups.delete(cleanup);\n clearTimeout(handle);\n onCancel === null || onCancel === void 0 ? void 0 : onCancel();\n resolve();\n };\n const handle = setTimeout(() => {\n this._restorationCleanups.delete(cleanup);\n // Guard against the component being disposed before this\n // timer fires. Under React StrictMode the component is\n // mounted -> disposed -> remounted, and without this guard\n // the first instance's queued restoration would open a\n // second popout window. See issue #851.\n if (this._host.isDisposed) {\n resolve();\n return;\n }\n work();\n resolve();\n }, delayMs);\n this._restorationCleanups.add(cleanup);\n });\n }\n finishRestoration(promises) {\n this._restorationPromise = Promise.all(promises).then(() => void 0);\n }\n cancelPendingRestorations() {\n for (const cleanup of [...this._restorationCleanups]) {\n cleanup();\n }\n this._restorationCleanups.clear();\n }\n serialize() {\n return this._entries.map((entry) => {\n const grid = entry.gridview.serialize();\n const root = grid.root;\n const url = entry.popoutGroup.api.location.type === 'popout'\n ? entry.popoutGroup.api.location.popoutUrl\n : undefined;\n const base = {\n gridReferenceGroup: entry.referenceGroup,\n position: entry.window.dimensions(),\n url,\n };\n // Single-group window keeps the legacy `data` shape so layouts\n // round-trip byte-stably and older readers keep working.\n if (root.type === 'branch' &&\n root.data.length === 1 &&\n root.data[0].type === 'leaf') {\n return Object.assign(Object.assign({}, base), { data: root.data[0].data });\n }\n return Object.assign(Object.assign({}, base), { grid });\n });\n }\n disposeAll() {\n for (const entry of [...this._entries]) {\n entry.disposable.dispose();\n }\n }\n dispose() {\n this.cancelPendingRestorations();\n this.disposeAll();\n this._onDidRemove.dispose();\n }\n}\nconst PopoutWindowModule = defineModule({\n name: 'PopoutWindow',\n serviceKey: 'popoutWindowService',\n create: (host) => new PopoutWindowService(host),\n});\n\nclass WatermarkService {\n constructor(host) {\n this._watermark = null;\n this._host = host;\n }\n update() {\n if (this._host.hasVisibleGridGroup()) {\n this._unmount();\n return;\n }\n if (this._watermark) {\n return;\n }\n this._watermark = this._host.createWatermarkComponent();\n this._watermark.init({ containerApi: this._host.api });\n const container = document.createElement('div');\n container.className = 'dv-watermark-container';\n addTestId(container, 'watermark-component');\n container.appendChild(this._watermark.element);\n this._host.mountElement.appendChild(container);\n }\n refresh() {\n this._unmount();\n this.update();\n }\n _unmount() {\n var _a, _b;\n if (!this._watermark) {\n return;\n }\n this._watermark.element.parentElement.remove();\n (_b = (_a = this._watermark).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);\n this._watermark = null;\n }\n dispose() {\n this._unmount();\n }\n}\nconst WatermarkModule = defineModule({\n name: 'Watermark',\n serviceKey: 'watermarkService',\n create: (host) => new WatermarkService(host),\n init: (host, service) => {\n // Initial evaluation reflects the watermark state at construction time.\n service.update();\n return new CompositeDisposable(Event.any(host.onDidAdd, host.onDidRemove)(() => {\n service.update();\n }), host.onDidViewVisibilityChangeMicroTaskQueue(() => {\n service.update();\n }));\n },\n});\n\nclass EdgeGroupService {\n constructor() {\n this._edgeGroups = new Map();\n this._edgeGroupDisposables = new Map();\n }\n // No constructor needed — the host is currently unused. The\n // IEdgeGroupServiceHost slot stays for symmetry with the other modules\n // and to leave room for future host callbacks.\n add(position, group, autoCollapseDisposable) {\n this._edgeGroups.set(position, group);\n this._edgeGroupDisposables.set(position, autoCollapseDisposable);\n }\n remove(position) {\n var _a;\n (_a = this._edgeGroupDisposables.get(position)) === null || _a === void 0 ? void 0 : _a.dispose();\n this._edgeGroupDisposables.delete(position);\n this._edgeGroups.delete(position);\n }\n get(position) {\n return this._edgeGroups.get(position);\n }\n has(position) {\n return this._edgeGroups.has(position);\n }\n hasAny() {\n return this._edgeGroups.size > 0;\n }\n entries() {\n return this._edgeGroups.entries();\n }\n includes(group) {\n for (const edgeGroup of this._edgeGroups.values()) {\n if (edgeGroup === group) {\n return true;\n }\n }\n return false;\n }\n findPositionOf(group) {\n for (const [position, edgeGroup] of this._edgeGroups) {\n if (edgeGroup === group) {\n return position;\n }\n }\n return undefined;\n }\n disposeAll() {\n for (const disposable of this._edgeGroupDisposables.values()) {\n disposable.dispose();\n }\n this._edgeGroupDisposables.clear();\n this._edgeGroups.clear();\n }\n dispose() {\n this.disposeAll();\n }\n}\nconst EdgeGroupModule = defineModule({\n name: 'EdgeGroup',\n serviceKey: 'edgeGroupService',\n create: () => new EdgeGroupService(),\n});\n\nconst DEFAULT_ROOT_OVERLAY_MODEL = {\n activationSize: { type: 'pixels', value: 10 },\n size: { type: 'pixels', value: 20 },\n};\nclass RootDropTargetService {\n constructor(host) {\n const canDisplayOverlay = (event, position) => {\n const data = getPanelData();\n if (data) {\n if (data.viewId !== host.id) {\n return false;\n }\n if (position === 'center') {\n // center drop target only allowed if no panels in primary\n // grid; floating panels are allowed\n return host.isGridEmpty();\n }\n return true;\n }\n if (position === 'center' && !host.isGridEmpty()) {\n // for external events only show the four-corner drag overlays,\n // disable center so external drag events can fall through to\n // the group and panel drop target handlers\n return false;\n }\n return host.dispatchUnhandledDragOver(event, position);\n };\n const overlayModel = typeof host.options.dndEdges === 'object' &&\n host.options.dndEdges !== null\n ? host.options.dndEdges\n : DEFAULT_ROOT_OVERLAY_MODEL;\n this._html5Target = html5Backend.createDropTarget(host.element, {\n className: 'dv-drop-target-edge',\n canDisplayOverlay,\n acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],\n overlayModel,\n getOverrideTarget: () => host.rootDropTargetOverrideTarget(),\n });\n this._pointerTarget = pointerBackend.createDropTarget(host.element, {\n className: 'dv-drop-target-edge',\n canDisplayOverlay,\n acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],\n overlayModel,\n getOverrideTarget: () => host.rootDropTargetOverrideTarget(),\n });\n this.onWillShowOverlay = Event.any(this._html5Target.onWillShowOverlay, this._pointerTarget.onWillShowOverlay);\n this.onDrop = Event.any(this._html5Target.onDrop, this._pointerTarget.onDrop);\n // Apply initial-state options now that the targets exist; setOptions\n // handles dndEdges (disable + overlay model) and late changes.\n this.setOptions(host.options);\n }\n setOptions(options) {\n if ('dndEdges' in options) {\n const disabled = typeof options.dndEdges === 'boolean' &&\n options.dndEdges === false;\n this._html5Target.disabled = disabled;\n this._pointerTarget.disabled = disabled;\n if (typeof options.dndEdges === 'object' &&\n options.dndEdges !== null) {\n this._html5Target.setOverlayModel(options.dndEdges);\n this._pointerTarget.setOverlayModel(options.dndEdges);\n }\n else {\n this._html5Target.setOverlayModel(DEFAULT_ROOT_OVERLAY_MODEL);\n this._pointerTarget.setOverlayModel(DEFAULT_ROOT_OVERLAY_MODEL);\n }\n }\n }\n dispose() {\n this._html5Target.dispose();\n this._pointerTarget.dispose();\n }\n}\nconst RootDropTargetModule = defineModule({\n name: 'RootDropTarget',\n serviceKey: 'rootDropTargetService',\n create: (host) => new RootDropTargetService(host),\n});\n\nconst SLOT_OPTION_KEY = {\n left: 'createLeftHeaderActionComponent',\n right: 'createRightHeaderActionComponent',\n prefix: 'createPrefixHeaderActionComponent',\n};\nclass HeaderActionsService {\n constructor(host) {\n this._perGroup = new Map();\n this._host = host;\n }\n refresh(group) {\n // The headerPosition setter on DockviewGroupPanelModel fires inside\n // the model's constructor — before the parent DockviewGroupPanel has\n // assigned its `_model` field, and in tests where the parent panel\n // may be null. Skip; DockviewGroupPanel.initialize() will refresh\n // once construction completes for real groups.\n if (!(group === null || group === void 0 ? void 0 : group.model)) {\n return;\n }\n const state = this._ensureState(group);\n this._refreshSlot('left', group, state.left);\n this._refreshSlot('right', group, state.right);\n this._refreshSlot('prefix', group, state.prefix);\n }\n refreshAll() {\n for (const group of this._host.groups) {\n this.refresh(group);\n }\n }\n disposeGroup(group) {\n const state = this._perGroup.get(group);\n if (!state) {\n return;\n }\n state.left.dispose();\n state.right.dispose();\n state.prefix.dispose();\n this._perGroup.delete(group);\n }\n dispose() {\n for (const group of [...this._perGroup.keys()]) {\n this.disposeGroup(group);\n }\n }\n _ensureState(group) {\n let state = this._perGroup.get(group);\n if (!state) {\n state = {\n left: new MutableDisposable(),\n right: new MutableDisposable(),\n prefix: new MutableDisposable(),\n };\n this._perGroup.set(group, state);\n }\n return state;\n }\n _refreshSlot(slot, group, disposable) {\n const factory = this._host.options[SLOT_OPTION_KEY[slot]];\n if (factory) {\n const renderer = factory(group);\n disposable.value = renderer;\n renderer.init({\n containerApi: this._host.api,\n api: group.api,\n group,\n });\n group.model.attachHeaderAction(slot, renderer.element);\n }\n else {\n disposable.dispose();\n group.model.attachHeaderAction(slot, undefined);\n }\n }\n}\nconst HeaderActionsModule = defineModule({\n name: 'HeaderActions',\n serviceKey: 'headerActionsService',\n create: (host) => new HeaderActionsService(host),\n init: (host, service) => {\n return new CompositeDisposable(host.onDidRemoveGroup((group) => {\n service.disposeGroup(group);\n }));\n },\n});\n\n/** Where a drop position lands, phrased for the *edge prompt*. */\nfunction edgeWhere(position, target) {\n return position === 'center'\n ? `Tab into ${target}`\n : `Split ${position} of ${target}`;\n}\n/** Where a drop position landed, phrased for the *commit* sentence. */\nfunction committedWhere(position, target) {\n return position === 'center'\n ? `docked into ${target}`\n : `split ${position} of ${target}`;\n}\nconst DEFAULT_MESSAGES = {\n panelOpened: (title) => `${title} opened`,\n panelClosed: (title) => `${title} closed`,\n groupMaximized: (title) => `${title} maximized`,\n groupRestored: (title) => `${title} restored`,\n groupFloated: (title) => `${title} floated`,\n groupDocked: (title) => `${title} docked`,\n groupPoppedOut: (title) => `${title} opened in a new window`,\n movePickTarget: (source, target, current, total) => `Moving ${source}. Target ${target}, ${current} of ${total}. Enter to choose where, Escape to cancel.`,\n movePickEdge: (position, target) => `${edgeWhere(position, target)}. Arrows to change, Enter to confirm, Escape to go back.`,\n moveCommitted: (source, target, position) => `${source} ${committedWhere(position, target)}.`,\n moveCancelled: () => `Move cancelled.`,\n moveNotAllowed: () => `That move is not allowed.`,\n};\n/** Merge an app's partial overrides over the English defaults. */\nfunction resolveMessages(overrides) {\n return overrides ? Object.assign(Object.assign({}, DEFAULT_MESSAGES), overrides) : DEFAULT_MESSAGES;\n}\n\n/** Bulk transactions whose per-panel events should not each be announced. */\nconst isBulk = (kind) => kind === 'load' || kind === 'clear';\nfunction createLiveRegion(politeness) {\n const el = document.createElement('div');\n el.className =\n politeness === 'assertive'\n ? 'dv-live-region-assertive'\n : 'dv-live-region';\n // assertive interrupts the SR (errors / cancellations); polite waits for a\n // pause (routine status). `alert` implies assertive, `status` implies polite.\n el.setAttribute('role', politeness === 'assertive' ? 'alert' : 'status');\n el.setAttribute('aria-live', politeness);\n el.setAttribute('aria-atomic', 'true');\n // Visually hidden but kept in the accessibility tree (never display:none /\n // visibility:hidden, which would drop it from AT). Standard clip pattern.\n Object.assign(el.style, {\n position: 'absolute',\n width: '1px',\n height: '1px',\n margin: '-1px',\n padding: '0',\n overflow: 'hidden',\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(50%)',\n whiteSpace: 'nowrap',\n border: '0',\n });\n return el;\n}\n/**\n * Narrates layout state changes to screen readers via visually-hidden\n * `aria-live` regions. Free / core (WCAG 4.1.3). Announces panel open/close +\n * the shared `announce()` sink (the accessibility module narrates docking here too).\n * Two regions: a **polite** one for routine status and an **assertive** one\n * for errors/cancellations. The bulk load/clear burst is suppressed via the\n * mutation-transaction events, and an app can take over delivery entirely with\n * the `announcer` option.\n */\nclass LiveRegionService extends CompositeDisposable {\n constructor(host) {\n super();\n this._suppressDepth = 0;\n this._locationSubs = new Map();\n this._host = host;\n this._polite = createLiveRegion('polite');\n this._assertive = createLiveRegion('assertive');\n host.element.appendChild(this._polite);\n host.element.appendChild(this._assertive);\n this.addDisposables({ dispose: () => this._polite.remove() }, { dispose: () => this._assertive.remove() }, host.onDidAddPanel((panel) => this._announce(panel, 'open')), host.onDidRemovePanel((panel) => this._announce(panel, 'close')), \n // Bracket bulk transactions so a fromJSON / clear doesn't announce\n // every nested add/remove.\n host.onWillMutateLayout((e) => {\n if (isBulk(e.kind)) {\n this._suppressDepth++;\n }\n }), host.onDidMutateLayout((e) => {\n if (isBulk(e.kind)) {\n this._suppressDepth = Math.max(0, this._suppressDepth - 1);\n }\n }), host.onDidMaximizedGroupChange((e) => {\n const panel = e.group.activePanel;\n if (panel) {\n this._announce(panel, e.isMaximized ? 'maximize' : 'restore');\n }\n }), \n // Narrate a group floating / docking back / popping out. A group is\n // born in the grid then transitions, so track each group's previous\n // location and ignore the no-op initial `-> grid`.\n host.onDidAddGroup((group) => this._trackLocation(group)), host.onDidRemoveGroup((group) => {\n var _a;\n (_a = this._locationSubs.get(group.id)) === null || _a === void 0 ? void 0 : _a.dispose();\n this._locationSubs.delete(group.id);\n }), {\n dispose: () => {\n this._locationSubs.forEach((sub) => sub.dispose());\n this._locationSubs.clear();\n },\n });\n }\n _trackLocation(group) {\n let prev = group.api.location.type;\n const sub = group.api.onDidLocationChange((e) => {\n const next = e.location.type;\n if (next === prev) {\n return;\n }\n prev = next;\n const panel = group.activePanel;\n if (!panel) {\n return;\n }\n const kind = next === 'floating'\n ? 'float'\n : next === 'popout'\n ? 'popout'\n : 'dock';\n this._announce(panel, kind);\n });\n this._locationSubs.set(group.id, sub);\n }\n announce(message, politeness = 'polite') {\n // Opt-out (read live so `updateOptions({ announcements })` applies).\n if (this._host.options.announcements === false ||\n this._suppressDepth > 0 ||\n !message) {\n return;\n }\n // Apps can route announcements into their own SR system instead of the\n // built-in regions (e.g. a shared app-wide live region).\n const announcer = this._host.options.announcer;\n if (announcer) {\n announcer({ message, politeness });\n return;\n }\n // Clearing first forces SRs to re-announce an identical message.\n const region = politeness === 'assertive' ? this._assertive : this._polite;\n region.textContent = '';\n region.textContent = message;\n }\n _announce(panel, kind) {\n var _a, _b;\n // The app may localise/override the message, suppress it (null / ''),\n // or fall through to the default (undefined).\n const custom = (_b = (_a = this._host.options).getAnnouncement) === null || _b === void 0 ? void 0 : _b.call(_a, { kind, panel });\n if (custom === null || custom === '') {\n return;\n }\n this.announce(custom !== null && custom !== void 0 ? custom : this._defaultMessage(panel, kind));\n }\n _defaultMessage(panel, kind) {\n var _a;\n const m = resolveMessages(this._host.options.messages);\n const name = (_a = panel.title) !== null && _a !== void 0 ? _a : panel.id;\n switch (kind) {\n case 'open':\n return m.panelOpened(name);\n case 'close':\n return m.panelClosed(name);\n case 'maximize':\n return m.groupMaximized(name);\n case 'restore':\n return m.groupRestored(name);\n case 'float':\n return m.groupFloated(name);\n case 'dock':\n return m.groupDocked(name);\n case 'popout':\n return m.groupPoppedOut(name);\n }\n }\n}\nconst LiveRegionModule = defineModule({\n name: 'LiveRegion',\n serviceKey: 'liveRegionService',\n create: (host) => new LiveRegionService(host),\n});\n\n/**\n * Internal list of the built-in modules that ship with the core. Registered\n * automatically by DockviewComponent at construction time; not exported from\n * the package. Additional modules contributed by sibling packages (via\n * `registerModules(...)`) are appended at construction.\n */\nconst AllModules = [\n FloatingGroupModule,\n PopoutWindowModule,\n WatermarkModule,\n EdgeGroupModule,\n RootDropTargetModule,\n HeaderActionsModule,\n LiveRegionModule,\n];\n\nclass PositionCache {\n constructor() {\n this.cache = new Map();\n this.currentFrameId = 0;\n this.rafId = null;\n }\n getPosition(element) {\n const cached = this.cache.get(element);\n if (cached && cached.frameId === this.currentFrameId) {\n return cached.rect;\n }\n this.scheduleFrameUpdate();\n const rect = getDomNodePagePosition(element);\n this.cache.set(element, { rect, frameId: this.currentFrameId });\n return rect;\n }\n invalidate() {\n this.currentFrameId++;\n }\n scheduleFrameUpdate() {\n if (this.rafId)\n return;\n this.rafId = requestAnimationFrame(() => {\n this.currentFrameId++;\n this.rafId = null;\n });\n }\n}\nfunction createFocusableElement() {\n const element = document.createElement('div');\n element.tabIndex = -1;\n return element;\n}\nclass OverlayRenderContainer extends CompositeDisposable {\n constructor(element, accessor) {\n super();\n this.element = element;\n this.accessor = accessor;\n this.map = {};\n this._disposed = false;\n this.positionCache = new PositionCache();\n this.pendingUpdates = new Set();\n this.addDisposables(Disposable.from(() => {\n for (const value of Object.values(this.map)) {\n value.disposable.dispose();\n value.destroy.dispose();\n }\n this._disposed = true;\n }));\n }\n updateAllPositions() {\n if (this._disposed) {\n return;\n }\n // Invalidate position cache to force recalculation\n this.positionCache.invalidate();\n // Call resize function directly for all visible panels\n for (const entry of Object.values(this.map)) {\n if (entry.panel.api.isVisible && entry.resize) {\n entry.resize();\n }\n }\n }\n detatch(panel) {\n if (this.map[panel.api.id]) {\n const { disposable, destroy } = this.map[panel.api.id];\n disposable.dispose();\n destroy.dispose();\n delete this.map[panel.api.id];\n return true;\n }\n return false;\n }\n attach(options) {\n const { panel, referenceContainer } = options;\n if (!this.map[panel.api.id]) {\n const element = createFocusableElement();\n element.className = 'dv-render-overlay';\n // Hide until the first RAF-based position is applied to prevent a\n // one-frame flash at position 0,0 when the element is first attached.\n element.style.visibility = 'hidden';\n this.map[panel.api.id] = {\n panel,\n disposable: Disposable.NONE,\n destroy: Disposable.NONE,\n element,\n };\n }\n const focusContainer = this.map[panel.api.id].element;\n // Capture the content element now so the destroy disposable below\n // does not re-query the renderer's `element` getter during teardown.\n // Some framework adapters (e.g. dockview-angular) tear down their\n // backing renderer before this disposable fires; reading through the\n // getter at that point can throw.\n const contentElement = panel.view.content.element;\n if (contentElement.parentElement !== focusContainer) {\n focusContainer.appendChild(contentElement);\n }\n if (focusContainer.parentElement !== this.element) {\n this.element.appendChild(focusContainer);\n }\n const resize = () => {\n const panelId = panel.api.id;\n if (this.pendingUpdates.has(panelId)) {\n return; // Update already scheduled\n }\n this.pendingUpdates.add(panelId);\n requestAnimationFrame(() => {\n this.pendingUpdates.delete(panelId);\n if (this.isDisposed || !this.map[panelId]) {\n return;\n }\n const box = this.positionCache.getPosition(referenceContainer.element);\n const box2 = this.positionCache.getPosition(this.element);\n // Use traditional positioning for overlay containers\n const left = box.left - box2.left;\n const top = box.top - box2.top;\n const width = box.width;\n const height = box.height;\n focusContainer.style.left = `${left}px`;\n focusContainer.style.top = `${top}px`;\n focusContainer.style.width = `${width}px`;\n focusContainer.style.height = `${height}px`;\n // Sync visibility/pointer-events with the panel's current\n // visibility at paint time. visibilityChanged() may have\n // flipped to hidden between scheduling this rAF and now;\n // unconditionally clearing `visibility:hidden` here would\n // leave a hidden panel visually visible at a stale position,\n // because onDidDimensionsChange skips non-visible panels and\n // never recomputes their box on subsequent resizes.\n if (panel.api.isVisible) {\n focusContainer.style.visibility = '';\n focusContainer.style.pointerEvents = '';\n }\n else {\n focusContainer.style.visibility = 'hidden';\n focusContainer.style.pointerEvents = 'none';\n }\n toggleClass(focusContainer, 'dv-render-overlay-float', panel.group.api.location.type === 'floating');\n });\n };\n const visibilityChanged = () => {\n if (panel.api.isVisible) {\n this.positionCache.invalidate();\n resize();\n focusContainer.style.pointerEvents = '';\n }\n else {\n focusContainer.style.visibility = 'hidden';\n focusContainer.style.pointerEvents = 'none';\n }\n };\n const observerDisposable = new MutableDisposable();\n const correctLayerPosition = () => {\n if (panel.api.location.type === 'floating') {\n queueMicrotask(() => {\n const floatingGroup = this.accessor.floatingGroups.find((group) => group.group === panel.api.group);\n if (!floatingGroup) {\n return;\n }\n const element = floatingGroup.overlay.element;\n const update = () => {\n const level = Number(element.getAttribute('aria-level'));\n focusContainer.style.zIndex = `calc(var(--dv-overlay-z-index, 999) + ${level * 2 + 1})`;\n };\n const observer = new MutationObserver(() => {\n update();\n });\n observerDisposable.value = Disposable.from(() => observer.disconnect());\n observer.observe(element, {\n attributeFilter: ['aria-level'],\n attributes: true,\n });\n update();\n });\n }\n else {\n focusContainer.style.zIndex = ''; // reset the z-index, perhaps CSS will take over here\n }\n };\n const disposable = new CompositeDisposable(observerDisposable, \n /**\n * since container is positioned absoutely we must explicitly forward\n * the dnd events for the expect behaviours to continue to occur in terms of dnd\n *\n * the dnd observer does not need to be conditional on whether the panel is visible since\n * non-visible panels have 'pointer-events: none' and in such case the dnd observer will not fire.\n */\n new DragAndDropObserver(focusContainer, {\n onDragEnd: (e) => {\n referenceContainer.dropTarget.dnd.onDragEnd(e);\n },\n onDragEnter: (e) => {\n referenceContainer.dropTarget.dnd.onDragEnter(e);\n },\n onDragLeave: (e) => {\n referenceContainer.dropTarget.dnd.onDragLeave(e);\n },\n onDrop: (e) => {\n referenceContainer.dropTarget.dnd.onDrop(e);\n },\n onDragOver: (e) => {\n referenceContainer.dropTarget.dnd.onDragOver(e);\n },\n }), panel.api.onDidVisibilityChange(() => {\n /**\n * Control the visibility of the content, however even when not visible (display: none)\n * the content is still maintained within the DOM hence DOM specific attributes\n * such as scroll position are maintained when next made visible.\n */\n visibilityChanged();\n }), panel.api.onDidDimensionsChange(() => {\n if (!panel.api.isVisible) {\n return;\n }\n resize();\n }), panel.api.onDidLocationChange(() => {\n correctLayerPosition();\n }));\n this.map[panel.api.id].destroy = Disposable.from(() => {\n var _a;\n if (contentElement.parentElement === focusContainer) {\n focusContainer.removeChild(contentElement);\n }\n (_a = focusContainer.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(focusContainer);\n });\n correctLayerPosition();\n queueMicrotask(() => {\n if (this.isDisposed) {\n return;\n }\n /**\n * wait until everything has finished in the current stack-frame call before\n * calling the first resize as other size-altering events may still occur before\n * the end of the stack-frame.\n */\n visibilityChanged();\n });\n // dispose of logic asoccciated with previous reference-container\n this.map[panel.api.id].disposable.dispose();\n // and reset the disposable to the active reference-container\n this.map[panel.api.id].disposable = disposable;\n // store the resize function for direct access\n this.map[panel.api.id].resize = resize;\n return focusContainer;\n }\n}\n\n/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\n\r\nfunction __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\ntypeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\n\n/**\n * Reject popout URLs that aren't same-origin http(s). Blocks `javascript:`,\n * `data:`, `blob:`, `vbscript:`, and cross-origin URLs that would otherwise\n * execute in a context the browser still associates with the opener via\n * `window.opener`.\n */\nfunction assertSameOriginPopoutUrl(url) {\n let resolved;\n try {\n resolved = new URL(url, window.location.href);\n }\n catch (_a) {\n throw new Error(`dockview: invalid popout URL: ${url}`);\n }\n const protocolOk = resolved.protocol === 'http:' || resolved.protocol === 'https:';\n if (!protocolOk || resolved.origin !== window.location.origin) {\n throw new Error(`dockview: popout URL must be same-origin http(s); got: ${url}`);\n }\n}\nclass PopoutWindow extends CompositeDisposable {\n get window() {\n var _a, _b;\n return (_b = (_a = this._window) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null;\n }\n constructor(target, className, options) {\n super();\n this.target = target;\n this.className = className;\n this.options = options;\n this._onWillClose = new Emitter();\n this.onWillClose = this._onWillClose.event;\n this._onDidClose = new Emitter();\n this.onDidClose = this._onDidClose.event;\n this._window = null;\n this.addDisposables(this._onWillClose, this._onDidClose, {\n dispose: () => {\n this.close();\n },\n });\n }\n dimensions() {\n if (!this._window) {\n return null;\n }\n const left = this._window.value.screenX;\n const top = this._window.value.screenY;\n const width = this._window.value.innerWidth;\n const height = this._window.value.innerHeight;\n return { top, left, width, height };\n }\n close() {\n var _a, _b;\n if (this._window) {\n this._onWillClose.fire();\n (_b = (_a = this.options).onWillClose) === null || _b === void 0 ? void 0 : _b.call(_a, {\n id: this.target,\n window: this._window.value,\n });\n this._window.disposable.dispose();\n this._window = null;\n this._onDidClose.fire();\n }\n }\n open() {\n return __awaiter(this, void 0, void 0, function* () {\n var _a, _b;\n if (this._window) {\n throw new Error('instance of popout window is already open');\n }\n const url = `${this.options.url}`;\n assertSameOriginPopoutUrl(url);\n const features = Object.entries({\n top: this.options.top,\n left: this.options.left,\n width: this.options.width,\n height: this.options.height,\n })\n .map(([key, value]) => `${key}=${value}`)\n .join(',');\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/open\n */\n const externalWindow = window.open(url, this.target, features);\n if (!externalWindow) {\n /**\n * Popup blocked\n */\n return null;\n }\n const disposable = new CompositeDisposable();\n this._window = { value: externalWindow, disposable };\n disposable.addDisposables(Disposable.from(() => {\n externalWindow.close();\n }), addDisposableListener(window, 'beforeunload', () => {\n /**\n * before the main window closes we should close this popup too\n * to be good citizens\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event\n */\n this.close();\n }));\n const container = this.createPopoutWindowContainer();\n if (this.className) {\n container.classList.add(this.className);\n }\n (_b = (_a = this.options).onDidOpen) === null || _b === void 0 ? void 0 : _b.call(_a, {\n id: this.target,\n window: externalWindow,\n });\n return new Promise((resolve, reject) => {\n externalWindow.addEventListener('unload', (e) => {\n // if page fails to load before unloading\n // this.close();\n });\n externalWindow.addEventListener('load', () => {\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event\n */\n try {\n const externalDocument = externalWindow.document;\n externalDocument.title = document.title;\n externalDocument.body.appendChild(container);\n addStyles(externalDocument, window.document.styleSheets, {\n nonce: this.options.nonce,\n });\n /**\n * beforeunload must be registered after load for reasons I could not determine\n * otherwise the beforeunload event will not fire when the window is closed\n */\n addDisposableListener(externalWindow, 'beforeunload', () => {\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event\n */\n this.close();\n });\n resolve(container);\n }\n catch (err) {\n // only except this is the DOM isn't setup. e.g. in a in correctly configured test\n reject(err);\n }\n });\n });\n });\n }\n createPopoutWindowContainer() {\n const el = document.createElement('div');\n el.classList.add('dv-popout-window');\n el.id = 'dv-popout-window';\n el.style.position = 'absolute';\n el.style.width = '100%';\n el.style.height = '100%';\n el.style.top = '0px';\n el.style.left = '0px';\n return el;\n }\n}\n\nclass StrictEventsSequencing extends CompositeDisposable {\n constructor(accessor) {\n super();\n this.accessor = accessor;\n this.init();\n }\n init() {\n const panels = new Set();\n const groups = new Set();\n this.addDisposables(this.accessor.onDidAddPanel((panel) => {\n if (panels.has(panel.api.id)) {\n throw new Error(`dockview: Invalid event sequence. [onDidAddPanel] called for panel ${panel.api.id} but panel already exists`);\n }\n else {\n panels.add(panel.api.id);\n }\n }), this.accessor.onDidRemovePanel((panel) => {\n if (!panels.has(panel.api.id)) {\n throw new Error(`dockview: Invalid event sequence. [onDidRemovePanel] called for panel ${panel.api.id} but panel does not exists`);\n }\n else {\n panels.delete(panel.api.id);\n }\n }), this.accessor.onDidAddGroup((group) => {\n if (groups.has(group.api.id)) {\n throw new Error(`dockview: Invalid event sequence. [onDidAddGroup] called for group ${group.api.id} but group already exists`);\n }\n else {\n groups.add(group.api.id);\n }\n }), this.accessor.onDidRemoveGroup((group) => {\n if (!groups.has(group.api.id)) {\n throw new Error(`dockview: Invalid event sequence. [onDidRemoveGroup] called for group ${group.api.id} but group does not exists`);\n }\n else {\n groups.delete(group.api.id);\n }\n }));\n }\n}\n\nfunction isCoarsePrimaryInput(win) {\n if (!win.matchMedia) {\n return false;\n }\n const coarse = win.matchMedia('(pointer: coarse)').matches;\n const fine = win.matchMedia('(pointer: fine)').matches;\n return coarse && !fine;\n}\nclass PopupService extends CompositeDisposable {\n constructor(root, win = window) {\n super();\n this._active = null;\n this._activeDisposable = new MutableDisposable();\n this._root = root;\n this._window = win;\n this._element = win.document.createElement('div');\n this._element.className = 'dv-popover-anchor';\n this._element.style.position = 'relative';\n this._root.prepend(this._element);\n this.addDisposables(Disposable.from(() => {\n this.close();\n }), this._activeDisposable);\n }\n /**\n * Move the popup anchor into a new root element. Call this when a shell\n * wraps the dockview component so that edge-group overflow dropdowns\n * position correctly relative to the full layout area.\n */\n updateRoot(newRoot) {\n newRoot.prepend(this._element);\n this._root = newRoot;\n }\n openPopover(element, position) {\n var _a;\n this.close();\n const wrapper = this._window.document.createElement('div');\n wrapper.style.position = 'absolute';\n wrapper.style.zIndex = (_a = position.zIndex) !== null && _a !== void 0 ? _a : 'var(--dv-overlay-z-index)';\n wrapper.appendChild(element);\n const anchorBox = this._element.getBoundingClientRect();\n const offsetX = anchorBox.left;\n const offsetY = anchorBox.top;\n wrapper.style.top = `${position.y - offsetY}px`;\n wrapper.style.left = `${position.x - offsetX}px`;\n this._element.appendChild(wrapper);\n this._active = wrapper;\n // Outside-pointerdown dismissal is suppressed for a short grace\n // window after opening. Touch long-press callers (chip / tab context\n // menus) open the popover while the user's finger is still pressing\n // the source element — Android Chrome can dispatch a follow-up\n // synthetic pointerdown tied to the gesture, and the release-then-\n // retap motion can land just outside the wrapper. Either would\n // dismiss the popover before the user can see or interact with it.\n // The grace window is short enough that intentional outside taps\n // still feel responsive.\n const openedAt = Date.now();\n const POINTERDOWN_GRACE_MS = 200;\n this._activeDisposable.value = new CompositeDisposable(addDisposableListener(this._window, 'pointerdown', (event) => {\n var _a;\n if (Date.now() - openedAt < POINTERDOWN_GRACE_MS) {\n return;\n }\n const target = event.target;\n if (!(target instanceof HTMLElement)) {\n return;\n }\n let el = target;\n while (el && el !== wrapper) {\n el = (_a = el === null || el === void 0 ? void 0 : el.parentElement) !== null && _a !== void 0 ? _a : null;\n }\n if (el) {\n return; // clicked within popover\n }\n this.close();\n }), addDisposableListener(this._window, 'keydown', (event) => {\n if (event.key === 'Escape' || event.key === 'Enter') {\n this.close();\n }\n }), addDisposableListener(this._window, 'resize', () => {\n // On touch-primary devices, common interactions resize the\n // window: on-screen keyboard pop, orientation change, browser\n // address-bar collapse. None of these mean \"the user wants\n // the popover dismissed\". Specifically, focusing the chip\n // context menu's rename input pops the keyboard, which would\n // otherwise close the menu the moment the user goes to edit\n // it. Desktop / hybrid input keeps the existing behaviour —\n // there a resize genuinely means the user has resized the\n // window and the popover position is now stale.\n if (isCoarsePrimaryInput(this._window)) {\n return;\n }\n this.close();\n }));\n this._window.requestAnimationFrame(() => {\n shiftAbsoluteElementIntoView(wrapper, this._root);\n });\n }\n close() {\n if (this._active) {\n this._active.remove();\n this._activeDisposable.dispose();\n this._active = null;\n }\n }\n}\n\nclass DropTargetAnchorContainer extends CompositeDisposable {\n get disabled() {\n return this._disabled;\n }\n set disabled(value) {\n var _a;\n if (this.disabled === value) {\n return;\n }\n this._disabled = value;\n if (value) {\n (_a = this.model) === null || _a === void 0 ? void 0 : _a.clear();\n }\n }\n get model() {\n if (this.disabled) {\n return undefined;\n }\n return {\n clear: () => {\n var _a;\n if (this._model) {\n (_a = this._model.root.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this._model.root);\n }\n this._model = undefined;\n },\n exists: () => {\n return !!this._model;\n },\n getElements: (event, outline) => {\n const changed = this._outline !== outline;\n this._outline = outline;\n if (this._model) {\n this._model.changed = changed;\n return this._model;\n }\n const container = this.createContainer();\n const anchor = this.createAnchor();\n this._model = { root: container, overlay: anchor, changed };\n container.appendChild(anchor);\n this.element.appendChild(container);\n if ((event === null || event === void 0 ? void 0 : event.target) instanceof HTMLElement) {\n const targetBox = event.target.getBoundingClientRect();\n const box = this.element.getBoundingClientRect();\n anchor.style.left = `${targetBox.left - box.left}px`;\n anchor.style.top = `${targetBox.top - box.top}px`;\n }\n return this._model;\n },\n };\n }\n constructor(element, options) {\n super();\n this.element = element;\n this._disabled = false;\n this._disabled = options.disabled;\n this.addDisposables(Disposable.from(() => {\n var _a;\n (_a = this.model) === null || _a === void 0 ? void 0 : _a.clear();\n }));\n }\n createContainer() {\n const el = document.createElement('div');\n el.className = 'dv-drop-target-container';\n return el;\n }\n createAnchor() {\n const el = document.createElement('div');\n el.className = 'dv-drop-target-anchor';\n el.style.visibility = 'hidden';\n return el;\n }\n}\n\nclass EdgeGroupView {\n get minimumSize() {\n // When collapsed, lock size to collapsedSize so sash can't drag it open\n return this._isCollapsed\n ? this._collapsedSize\n : this._expandedMinimumSize;\n }\n get maximumSize() {\n // When collapsed, lock size to collapsedSize so sash can't drag it open\n return this._isCollapsed\n ? this._collapsedSize\n : this._expandedMaximumSize;\n }\n get element() {\n return this._group.element;\n }\n get isCollapsed() {\n return this._isCollapsed;\n }\n get lastExpandedSize() {\n return this._lastExpandedSize;\n }\n get collapsedSize() {\n return this._collapsedSize;\n }\n constructor(options, group, orientation) {\n var _a, _b, _c;\n this._onDidChange = new Emitter();\n this.onDidChange = this._onDidChange.event;\n this.snap = false;\n this.priority = LayoutPriority.Low;\n this._isCollapsed = false;\n this._group = group;\n this._orientation = orientation;\n group.element.classList.add('dv-edge-group');\n group.element.dataset.testid = `dv-edge-group-${options.id}`;\n this._collapsedSize = (_a = options.collapsedSize) !== null && _a !== void 0 ? _a : 35;\n this._expandedMaximumSize =\n (_b = options.maximumSize) !== null && _b !== void 0 ? _b : Number.POSITIVE_INFINITY;\n // If the caller explicitly provides a minimumSize, respect it.\n // Otherwise fall back to collapsedSize + 50 so the expanded state is\n // visually distinguishable from the collapsed state.\n this._expandedMinimumSize =\n options.minimumSize !== undefined\n ? options.minimumSize\n : this._collapsedSize + 50;\n this._lastExpandedSize = (_c = options.initialSize) !== null && _c !== void 0 ? _c : 200;\n if (options.collapsed) {\n this._isCollapsed = true;\n group.element.classList.add('dv-edge-collapsed');\n }\n }\n layout(size, orthogonalSize) {\n // Track the last expanded size so we can restore it after collapsing\n if (!this._isCollapsed) {\n this._lastExpandedSize = size;\n }\n // horizontal (left/right): size=width, orthogonalSize=height → layout(width, height)\n // vertical (top/bottom): size=height, orthogonalSize=width → layout(width, height)\n if (this._orientation === 'horizontal') {\n this._group.layout(size, orthogonalSize);\n }\n else {\n this._group.layout(orthogonalSize, size);\n }\n }\n setCollapsed(collapsed) {\n if (this._isCollapsed === collapsed) {\n return;\n }\n this._isCollapsed = collapsed;\n this._group.element.classList.toggle('dv-edge-collapsed', collapsed);\n // ShellManager calls resizeView directly after this; no _onDidChange needed\n }\n setVisible(_visible) {\n // visibility is managed by the parent splitview\n }\n /**\n * Restore the last-expanded size from serialized state without triggering\n * a layout. Must be called before setCollapsed(true) during fromJSON so\n * that expanding after deserialization restores the correct size.\n */\n restoreExpandedSize(size) {\n this._lastExpandedSize = size;\n }\n /**\n * Apply new effective collapsed and expanded-minimum sizes after a theme\n * or gap change. The caller (ShellManager) is responsible for computing\n * the correct values from the original config and the new gap.\n */\n updateCollapsedSize(newCollapsedSize, newExpandedMinimumSize) {\n this._collapsedSize = newCollapsedSize;\n this._expandedMinimumSize = newExpandedMinimumSize;\n }\n dispose() {\n this._onDidChange.dispose();\n }\n}\nclass CenterView {\n get element() {\n return this._dockviewElement;\n }\n constructor(_dockviewElement, _layoutDockview) {\n this._dockviewElement = _dockviewElement;\n this._layoutDockview = _layoutDockview;\n this.priority = LayoutPriority.High;\n this.minimumSize = 100;\n this.maximumSize = Number.POSITIVE_INFINITY;\n this._onDidChange = new Emitter();\n this.onDidChange = this._onDidChange.event;\n }\n layout(size, orthogonalSize) {\n // Lives in a VERTICAL middle-column splitview:\n // size = height alloc, orthogonalSize = width\n this._layoutDockview(orthogonalSize, size);\n }\n setVisible(_visible) {\n // center is always visible\n }\n dispose() {\n this._onDidChange.dispose();\n }\n}\n/**\n * The vertical centre column: top (optional) | center | bottom (optional).\n * This view sits between the left and right edge panels in the outer\n * horizontal splitview, so its primary axis is width (horizontal).\n */\nclass MiddleColumnView {\n get element() {\n return this._element;\n }\n constructor(centerView, gap = 0) {\n this._onDidChange = new Emitter();\n this.onDidChange = this._onDidChange.event;\n this.minimumSize = 100;\n this.maximumSize = Number.POSITIVE_INFINITY;\n this.priority = LayoutPriority.High;\n this._element = document.createElement('div');\n this._element.className = 'dv-shell-middle-column';\n this._element.style.height = '100%';\n this._element.style.width = '100%';\n this._splitview = new Splitview(this._element, {\n orientation: Orientation.VERTICAL,\n proportionalLayout: false,\n margin: gap,\n });\n this._centerIndex = 0;\n this._splitview.addView(centerView, { type: 'distribute' }, 0);\n }\n addTopView(view, initialSize) {\n // Insert before center\n this._splitview.addView(view, initialSize, 0);\n this._topIndex = 0;\n this._centerIndex += 1;\n if (this._bottomIndex !== undefined) {\n this._bottomIndex += 1;\n }\n }\n addBottomView(view, initialSize) {\n // Append after center (and any existing bottom — shouldn't happen but safe)\n const newIndex = this._splitview.length;\n this._splitview.addView(view, initialSize, newIndex);\n this._bottomIndex = newIndex;\n }\n removeView(position) {\n const index = position === 'top' ? this._topIndex : this._bottomIndex;\n if (index === undefined) {\n return;\n }\n this._splitview.removeView(index);\n if (position === 'top') {\n this._topIndex = undefined;\n // center (and bottom if present) shift down by one\n this._centerIndex -= 1;\n if (this._bottomIndex !== undefined) {\n this._bottomIndex -= 1;\n }\n }\n else {\n this._bottomIndex = undefined;\n // center and top are unaffected\n }\n }\n layout(size, orthogonalSize) {\n // Outer horizontal splitview: size = width, orthogonalSize = height\n // Inner vertical splitview: layout(height, width)\n this._splitview.layout(orthogonalSize, size);\n }\n setVisible(_visible) {\n // middle column is always visible\n }\n setViewVisible(position, visible) {\n const index = position === 'top' ? this._topIndex : this._bottomIndex;\n if (index !== undefined) {\n this._splitview.setViewVisible(index, visible);\n }\n }\n isViewVisible(position) {\n const index = position === 'top' ? this._topIndex : this._bottomIndex;\n if (index !== undefined) {\n return this._splitview.isViewVisible(index);\n }\n return false;\n }\n getViewSize(position) {\n const index = position === 'top' ? this._topIndex : this._bottomIndex;\n if (index !== undefined) {\n return this._splitview.getViewSize(index);\n }\n return 0;\n }\n resizeView(position, size) {\n const index = position === 'top' ? this._topIndex : this._bottomIndex;\n if (index !== undefined) {\n this._splitview.resizeView(index, size);\n }\n }\n updateMargin(gap) {\n this._splitview.margin = gap;\n }\n dispose() {\n this._onDidChange.dispose();\n this._splitview.dispose();\n }\n}\nfunction adjustedOpts(base, defaultCollapsed, gapAdd) {\n var _a;\n const effectiveCollapsed = ((_a = base.collapsedSize) !== null && _a !== void 0 ? _a : defaultCollapsed) + gapAdd;\n const result = Object.assign(Object.assign({}, base), { collapsedSize: effectiveCollapsed });\n if (base.minimumSize !== undefined) {\n result.minimumSize = base.minimumSize + gapAdd;\n }\n return result;\n}\nclass ShellManager {\n constructor(container, dockviewElement, layoutGrid, gap = 0, defaultCollapsedSize = 35) {\n this._disposables = new CompositeDisposable();\n // Retained for updateTheme() recalculations.\n this._viewConfigs = new Map();\n this._currentWidth = 0;\n this._currentHeight = 0;\n this._gap = gap;\n this._defaultCollapsedSize = defaultCollapsedSize;\n this._shellElement = document.createElement('div');\n this._shellElement.className = 'dv-shell';\n this._shellElement.style.height = '100%';\n this._shellElement.style.width = '100%';\n this._shellElement.style.position = 'relative';\n container.appendChild(this._shellElement);\n const centerView = new CenterView(dockviewElement, layoutGrid);\n this._middleColumn = new MiddleColumnView(centerView, gap);\n this._outerSplitview = new Splitview(this._shellElement, {\n orientation: Orientation.HORIZONTAL,\n proportionalLayout: false,\n margin: gap,\n });\n this._middleIndex = 0;\n this._outerSplitview.addView(this._middleColumn, { type: 'distribute' }, 0);\n this._disposables.addDisposables(watchElementResize(this._shellElement, (entry) => {\n const width = Math.round(entry.contentRect.width);\n const height = Math.round(entry.contentRect.height);\n if (width === this._currentWidth &&\n height === this._currentHeight) {\n return;\n }\n this._currentWidth = width;\n this._currentHeight = height;\n this.layout(width, height);\n }), this._outerSplitview, this._middleColumn, centerView);\n }\n get element() {\n return this._shellElement;\n }\n /**\n * Add an edge group view at the given position. The view wraps the\n * provided group element inside the shell's splitview layout.\n * Throws if a group at this position is already registered.\n */\n addEdgeView(position, options, group) {\n if (this.hasEdgeGroup(position)) {\n throw new Error(`dockview: edge group already registered at position '${position}'`);\n }\n this._viewConfigs.set(position, options);\n // Recompute gap adjustments now that _viewConfigs has grown.\n const outerN = 1 +\n (this._viewConfigs.has('left') ? 1 : 0) +\n (this._viewConfigs.has('right') ? 1 : 0);\n const innerN = 1 +\n (this._viewConfigs.has('top') ? 1 : 0) +\n (this._viewConfigs.has('bottom') ? 1 : 0);\n const outerGapAdd = outerN > 1 ? (this._gap * (outerN - 1)) / outerN : 0;\n const innerGapAdd = innerN > 1 ? (this._gap * (innerN - 1)) / innerN : 0;\n const isHorizontal = position === 'left' || position === 'right';\n const gapAdd = isHorizontal ? outerGapAdd : innerGapAdd;\n const orientation = isHorizontal ? 'horizontal' : 'vertical';\n const view = new EdgeGroupView(adjustedOpts(Object.assign({ collapsedSize: this._defaultCollapsedSize }, options), this._defaultCollapsedSize, gapAdd), group, orientation);\n const initialSize = view.isCollapsed\n ? view.collapsedSize\n : view.lastExpandedSize;\n switch (position) {\n case 'left':\n // Insert before the middle column\n this._outerSplitview.addView(view, initialSize, 0);\n this._leftIndex = 0;\n this._middleIndex += 1;\n if (this._rightIndex !== undefined) {\n this._rightIndex += 1;\n }\n this._leftView = view;\n break;\n case 'right':\n // Append after the middle column\n {\n const idx = this._outerSplitview.length;\n this._outerSplitview.addView(view, initialSize, idx);\n this._rightIndex = idx;\n this._rightView = view;\n }\n break;\n case 'top':\n this._middleColumn.addTopView(view, initialSize);\n this._topView = view;\n break;\n case 'bottom':\n this._middleColumn.addBottomView(view, initialSize);\n this._bottomView = view;\n break;\n }\n this._disposables.addDisposables(view);\n // Recalculate gap adjustments for all views now that n has changed.\n // updateTheme already guards the layout() call by _currentWidth/_currentHeight.\n this.updateTheme(this._gap, this._defaultCollapsedSize);\n return view;\n }\n layout(width, height) {\n // Outer splitview is HORIZONTAL: layout(size=width, orthogonalSize=height)\n this._outerSplitview.layout(width, height);\n }\n /**\n * Called when the active theme changes. Updates splitview margins and\n * edge-group collapsed sizes so the layout matches the new theme's gap\n * and tab-strip dimensions.\n */\n updateTheme(gap, defaultCollapsedSize) {\n var _a, _b, _c, _d;\n this._gap = gap;\n this._defaultCollapsedSize = defaultCollapsedSize;\n const outerN = 1 +\n (this._viewConfigs.has('left') ? 1 : 0) +\n (this._viewConfigs.has('right') ? 1 : 0);\n const innerN = 1 +\n (this._viewConfigs.has('top') ? 1 : 0) +\n (this._viewConfigs.has('bottom') ? 1 : 0);\n const outerGapAdd = outerN > 1 ? (gap * (outerN - 1)) / outerN : 0;\n const innerGapAdd = innerN > 1 ? (gap * (innerN - 1)) / innerN : 0;\n // Update splitview margins.\n this._outerSplitview.margin = gap;\n this._middleColumn.updateMargin(gap);\n // Recompute effective collapsed sizes from the original config values.\n const updateView = (view, baseCfg, gapAdd) => {\n var _a;\n const baseCS = (_a = baseCfg.collapsedSize) !== null && _a !== void 0 ? _a : defaultCollapsedSize;\n const newCS = baseCS + gapAdd;\n const baseMS = baseCfg.minimumSize;\n const newMS = baseMS !== undefined ? baseMS + gapAdd : newCS + 50;\n view.updateCollapsedSize(newCS, newMS);\n };\n const topCfg = this._viewConfigs.get('top');\n if (this._topView && topCfg) {\n updateView(this._topView, topCfg, innerGapAdd);\n }\n const bottomCfg = this._viewConfigs.get('bottom');\n if (this._bottomView && bottomCfg) {\n updateView(this._bottomView, bottomCfg, innerGapAdd);\n }\n const leftCfg = this._viewConfigs.get('left');\n if (this._leftView && leftCfg) {\n updateView(this._leftView, leftCfg, outerGapAdd);\n }\n const rightCfg = this._viewConfigs.get('right');\n if (this._rightView && rightCfg) {\n updateView(this._rightView, rightCfg, outerGapAdd);\n }\n // Resize currently-collapsed groups to their new collapsed size so\n // they immediately match the new theme's tab-strip dimensions.\n if (((_a = this._leftView) === null || _a === void 0 ? void 0 : _a.isCollapsed) && this._leftIndex !== undefined) {\n this._outerSplitview.resizeView(this._leftIndex, this._leftView.collapsedSize);\n }\n if (((_b = this._rightView) === null || _b === void 0 ? void 0 : _b.isCollapsed) && this._rightIndex !== undefined) {\n this._outerSplitview.resizeView(this._rightIndex, this._rightView.collapsedSize);\n }\n if ((_c = this._topView) === null || _c === void 0 ? void 0 : _c.isCollapsed) {\n this._middleColumn.resizeView('top', this._topView.collapsedSize);\n }\n if ((_d = this._bottomView) === null || _d === void 0 ? void 0 : _d.isCollapsed) {\n this._middleColumn.resizeView('bottom', this._bottomView.collapsedSize);\n }\n // Re-run layout with the current shell dimensions.\n if (this._currentWidth > 0 && this._currentHeight > 0) {\n this.layout(this._currentWidth, this._currentHeight);\n }\n }\n removeEdgeView(position) {\n const view = this._getView(position);\n if (!view) {\n return;\n }\n switch (position) {\n case 'left':\n this._outerSplitview.removeView(this._leftIndex);\n this._leftIndex = undefined;\n this._leftView = undefined;\n // middle and right shift left by one\n this._middleIndex -= 1;\n if (this._rightIndex !== undefined) {\n this._rightIndex -= 1;\n }\n break;\n case 'right':\n this._outerSplitview.removeView(this._rightIndex);\n this._rightIndex = undefined;\n this._rightView = undefined;\n break;\n case 'top':\n this._middleColumn.removeView('top');\n this._topView = undefined;\n break;\n case 'bottom':\n this._middleColumn.removeView('bottom');\n this._bottomView = undefined;\n break;\n }\n // Deregister before disposing to avoid double-dispose when ShellManager\n // itself is eventually disposed.\n this._disposables.removeDisposable(view);\n view.dispose();\n this._viewConfigs.delete(position);\n // Recalculate gap adjustments for remaining views.\n this.updateTheme(this._gap, this._defaultCollapsedSize);\n }\n hasEdgeGroup(position) {\n switch (position) {\n case 'top':\n return this._topView !== undefined;\n case 'bottom':\n return this._bottomView !== undefined;\n case 'left':\n return this._leftView !== undefined;\n case 'right':\n return this._rightView !== undefined;\n }\n }\n setEdgeGroupVisible(position, visible) {\n switch (position) {\n case 'left':\n if (this._leftIndex !== undefined) {\n this._outerSplitview.setViewVisible(this._leftIndex, visible);\n }\n break;\n case 'right':\n if (this._rightIndex !== undefined) {\n this._outerSplitview.setViewVisible(this._rightIndex, visible);\n }\n break;\n case 'top':\n case 'bottom':\n this._middleColumn.setViewVisible(position, visible);\n break;\n }\n }\n isEdgeGroupVisible(position) {\n switch (position) {\n case 'left':\n if (this._leftIndex !== undefined) {\n return this._outerSplitview.isViewVisible(this._leftIndex);\n }\n return false;\n case 'right':\n if (this._rightIndex !== undefined) {\n return this._outerSplitview.isViewVisible(this._rightIndex);\n }\n return false;\n case 'top':\n case 'bottom':\n return this._middleColumn.isViewVisible(position);\n }\n }\n setEdgeGroupCollapsed(position, collapsed) {\n const view = this._getView(position);\n if (!view) {\n return;\n }\n view.setCollapsed(collapsed);\n const targetSize = collapsed\n ? view.collapsedSize\n : view.lastExpandedSize;\n switch (position) {\n case 'left':\n if (this._leftIndex !== undefined) {\n this._outerSplitview.resizeView(this._leftIndex, targetSize);\n }\n break;\n case 'right':\n if (this._rightIndex !== undefined) {\n this._outerSplitview.resizeView(this._rightIndex, targetSize);\n }\n break;\n case 'top':\n case 'bottom':\n this._middleColumn.resizeView(position, targetSize);\n break;\n }\n }\n isEdgeGroupCollapsed(position) {\n var _a, _b;\n return (_b = (_a = this._getView(position)) === null || _a === void 0 ? void 0 : _a.isCollapsed) !== null && _b !== void 0 ? _b : false;\n }\n _getView(position) {\n switch (position) {\n case 'top':\n return this._topView;\n case 'bottom':\n return this._bottomView;\n case 'left':\n return this._leftView;\n case 'right':\n return this._rightView;\n }\n }\n toJSON() {\n const edgeGroups = {};\n if (this._leftView && this._leftIndex !== undefined) {\n edgeGroups.left = {\n size: this._leftView.isCollapsed\n ? this._leftView.lastExpandedSize\n : this._outerSplitview.getViewSize(this._leftIndex),\n visible: this._outerSplitview.isViewVisible(this._leftIndex),\n collapsed: this._leftView.isCollapsed || undefined,\n };\n }\n if (this._rightView && this._rightIndex !== undefined) {\n edgeGroups.right = {\n size: this._rightView.isCollapsed\n ? this._rightView.lastExpandedSize\n : this._outerSplitview.getViewSize(this._rightIndex),\n visible: this._outerSplitview.isViewVisible(this._rightIndex),\n collapsed: this._rightView.isCollapsed || undefined,\n };\n }\n if (this._topView) {\n edgeGroups.top = {\n size: this._topView.isCollapsed\n ? this._topView.lastExpandedSize\n : this._middleColumn.getViewSize('top'),\n visible: this._middleColumn.isViewVisible('top'),\n collapsed: this._topView.isCollapsed || undefined,\n };\n }\n if (this._bottomView) {\n edgeGroups.bottom = {\n size: this._bottomView.isCollapsed\n ? this._bottomView.lastExpandedSize\n : this._middleColumn.getViewSize('bottom'),\n visible: this._middleColumn.isViewVisible('bottom'),\n collapsed: this._bottomView.isCollapsed || undefined,\n };\n }\n return edgeGroups;\n }\n fromJSON(data) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;\n if (data.left && this._leftIndex !== undefined) {\n // Always restore the expanded size first. toJSON always records the\n // expanded size (even when collapsed), so restoredExpandedSize must\n // be applied before setCollapsed locks min/max to collapsedSize.\n (_a = this._leftView) === null || _a === void 0 ? void 0 : _a.restoreExpandedSize(data.left.size);\n (_b = this._leftView) === null || _b === void 0 ? void 0 : _b.setCollapsed((_c = data.left.collapsed) !== null && _c !== void 0 ? _c : false);\n this._outerSplitview.resizeView(this._leftIndex, data.left.collapsed\n ? ((_e = (_d = this._leftView) === null || _d === void 0 ? void 0 : _d.collapsedSize) !== null && _e !== void 0 ? _e : data.left.size)\n : data.left.size);\n if (!data.left.visible) {\n this._outerSplitview.setViewVisible(this._leftIndex, false);\n }\n }\n if (data.right && this._rightIndex !== undefined) {\n (_f = this._rightView) === null || _f === void 0 ? void 0 : _f.restoreExpandedSize(data.right.size);\n (_g = this._rightView) === null || _g === void 0 ? void 0 : _g.setCollapsed((_h = data.right.collapsed) !== null && _h !== void 0 ? _h : false);\n this._outerSplitview.resizeView(this._rightIndex, data.right.collapsed\n ? ((_k = (_j = this._rightView) === null || _j === void 0 ? void 0 : _j.collapsedSize) !== null && _k !== void 0 ? _k : data.right.size)\n : data.right.size);\n if (!data.right.visible) {\n this._outerSplitview.setViewVisible(this._rightIndex, false);\n }\n }\n if (data.top) {\n (_l = this._topView) === null || _l === void 0 ? void 0 : _l.restoreExpandedSize(data.top.size);\n (_m = this._topView) === null || _m === void 0 ? void 0 : _m.setCollapsed((_o = data.top.collapsed) !== null && _o !== void 0 ? _o : false);\n this._middleColumn.resizeView('top', data.top.collapsed\n ? ((_q = (_p = this._topView) === null || _p === void 0 ? void 0 : _p.collapsedSize) !== null && _q !== void 0 ? _q : data.top.size)\n : data.top.size);\n if (!data.top.visible) {\n this._middleColumn.setViewVisible('top', false);\n }\n }\n if (data.bottom) {\n (_r = this._bottomView) === null || _r === void 0 ? void 0 : _r.restoreExpandedSize(data.bottom.size);\n (_s = this._bottomView) === null || _s === void 0 ? void 0 : _s.setCollapsed((_t = data.bottom.collapsed) !== null && _t !== void 0 ? _t : false);\n this._middleColumn.resizeView('bottom', data.bottom.collapsed\n ? ((_v = (_u = this._bottomView) === null || _u === void 0 ? void 0 : _u.collapsedSize) !== null && _v !== void 0 ? _v : data.bottom.size)\n : data.bottom.size);\n if (!data.bottom.visible) {\n this._middleColumn.setViewVisible('bottom', false);\n }\n }\n }\n dispose() {\n var _a;\n this._disposables.dispose();\n (_a = this._shellElement.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this._shellElement);\n }\n}\n\nfunction buildTabGroupColorPalette(options) {\n var _a;\n const entries = (_a = options.tabGroupColors) !== null && _a !== void 0 ? _a : DEFAULT_TAB_GROUP_COLORS;\n const enabled = options.tabGroupAccent !== 'off';\n return new TabGroupColorPalette(entries, enabled);\n}\nfunction moveGroupWithoutDestroying(options) {\n const activePanel = options.from.activePanel;\n const panels = [...options.from.panels].map((panel) => {\n const removedPanel = options.from.model.removePanel(panel);\n options.from.model.renderContainer.detatch(panel);\n return removedPanel;\n });\n panels.forEach((panel) => {\n options.to.model.openPanel(panel, {\n skipSetActive: activePanel !== panel,\n skipSetGroupActive: true,\n });\n });\n}\nlet _hasWarnedUsingCoreDirectly = false;\n/**\n * `dockview-core` is an internal package. The public `dockview` package calls\n * `markDockviewPackageLoaded()` on import; if that marker is absent the consumer\n * is using `dockview-core` directly, so emit a one-time console warning\n * steering them to `dockview`.\n *\n * Suppressed in production builds: it is a development-time nudge and most\n * bundlers inline `process.env.NODE_ENV` so the branch is dropped entirely. The\n * `typeof process` guard keeps this safe in plain browser/UMD contexts where\n * `process` is undefined.\n */\nfunction warnIfUsingCoreDirectly() {\n if (typeof process !== 'undefined' &&\n process.env &&\n process.env.NODE_ENV === 'production') {\n return;\n }\n if (_hasWarnedUsingCoreDirectly || isDockviewPackageLoaded()) {\n return;\n }\n _hasWarnedUsingCoreDirectly = true;\n console.warn('dockview: do not use \"dockview-core\" directly — it is an internal ' +\n 'package. Use the \"dockview\" package, the JavaScript version of ' +\n 'dockview, instead. This notice is shown once.');\n}\nclass DockviewComponent extends BaseGrid {\n fireDidCreateTabGroup(event) {\n this._onDidCreateTabGroup.fire(event);\n }\n fireDidDestroyTabGroup(event) {\n this._onDidDestroyTabGroup.fire(event);\n }\n fireDidAddPanelToTabGroup(event) {\n this._onDidAddPanelToTabGroup.fire(event);\n }\n fireDidRemovePanelFromTabGroup(event) {\n this._onDidRemovePanelFromTabGroup.fire(event);\n }\n fireDidTabGroupChange(event) {\n this._onDidTabGroupChange.fire(event);\n }\n fireDidTabGroupCollapsedChange(event) {\n this._onDidTabGroupCollapsedChange.fire(event);\n }\n get orientation() {\n return this.gridview.orientation;\n }\n get totalPanels() {\n return this.panels.length;\n }\n get panels() {\n return this.groups.flatMap((group) => group.panels);\n }\n get options() {\n return this._options;\n }\n get tabGroupColorPalette() {\n return this._tabGroupColorPalette;\n }\n get activePanel() {\n const activeGroup = this.activeGroup;\n if (!activeGroup) {\n return undefined;\n }\n return activeGroup.activePanel;\n }\n get renderer() {\n var _a;\n return (_a = this.options.defaultRenderer) !== null && _a !== void 0 ? _a : 'onlyWhenVisible';\n }\n get defaultHeaderPosition() {\n var _a;\n return (_a = this.options.defaultHeaderPosition) !== null && _a !== void 0 ? _a : 'top';\n }\n get api() {\n return this._api;\n }\n get floatingGroups() {\n var _a, _b, _c;\n return ((_c = (_b = (_a = this._moduleRegistry) === null || _a === void 0 ? void 0 : _a.services.floatingGroupService) === null || _b === void 0 ? void 0 : _b.floatingGroups) !== null && _c !== void 0 ? _c : []);\n }\n /**\n * Boxes of the floating groups other than `exclude`, in coordinates\n * relative to the floating overlay container. Supplied to a\n * `transformFloatingGroupDrag` callback as `context.others` so it can\n * align the dragged float against its siblings.\n */\n _gatherFloatingGroupBoxes(exclude) {\n var _a;\n const container = (_a = this._floatingOverlayHost) !== null && _a !== void 0 ? _a : this.gridview.element;\n const containerRect = container.getBoundingClientRect();\n return this.floatingGroups\n .filter((floating) => floating.group !== exclude)\n .map((floating) => {\n const rect = floating.overlay.element.getBoundingClientRect();\n return {\n left: rect.left - containerRect.left,\n top: rect.top - containerRect.top,\n width: rect.width,\n height: rect.height,\n };\n });\n }\n get _floatingGroupService() {\n return this._moduleRegistry.services.floatingGroupService;\n }\n get _popoutWindowService() {\n return this._moduleRegistry.services.popoutWindowService;\n }\n get _watermarkService() {\n // Tier 1 module — optional. Callers must `?.`-guard so the module\n // can be removed from AllModules without crashing the component.\n return this._moduleRegistry.services.watermarkService;\n }\n get _edgeGroupService() {\n return this._moduleRegistry.services.edgeGroupService;\n }\n get _rootDropTargetService() {\n // Optional like every other module service — RootDropTargetModule can be\n // removed from the registered set without crashing the component.\n return this._moduleRegistry.services.rootDropTargetService;\n }\n get _advancedDnDService() {\n // Optional — callers `?.`-guard so the module can be removed from\n // AllModules. Absent ⇒ the onWill* hooks simply don't fire (≡ no\n // subscriber), which is invisible to apps not customising DnD.\n return this._moduleRegistry.services.advancedDnDService;\n }\n get headerActionsService() {\n return this._moduleRegistry.services.headerActionsService;\n }\n isGridEmpty() {\n return this.gridview.length === 0;\n }\n rootDropTargetOverrideTarget() {\n var _a;\n return (_a = this.rootDropTargetContainer) === null || _a === void 0 ? void 0 : _a.model;\n }\n dispatchUnhandledDragOver(nativeEvent, position) {\n const event = new DockviewUnhandledDragOverEvent(nativeEvent, 'edge', position, getPanelData);\n this._onUnhandledDragOver.fire(event);\n return event.isAccepted;\n }\n // IAdvancedDnDHost — the emitters stay here so the public onWill* event\n // shape is unchanged; AdvancedDnDService routes the per-group fires\n // through these. Engine guards (e.g. disableDnd) run on the component\n // ahead of the dispatch.\n fireWillDragPanel(event) {\n this._onWillDragPanel.fire(event);\n }\n fireWillDragGroup(event) {\n this._onWillDragGroup.fire(event);\n }\n fireWillDrop(event) {\n this._onWillDrop.fire(event);\n }\n fireWillShowOverlay(event) {\n this._onWillShowOverlay.fire(event);\n }\n /**\n * Resolve the custom group drag ghost (via the AdvancedDnD module), or\n * `undefined` to fall back to the default chip. Returns `undefined` when\n * the module is absent — the default ghost then renders.\n */\n buildGroupDragGhost(group) {\n var _a;\n return (_a = this._advancedDnDService) === null || _a === void 0 ? void 0 : _a.buildGroupDragGhost(group);\n }\n /**\n * Resolve the app-supplied drop overlay model (via the AdvancedDnD module)\n * for a group drop target, or `undefined` to keep the target's default.\n */\n resolveDropOverlayModel(location, group) {\n var _a;\n return (_a = this._advancedDnDService) === null || _a === void 0 ? void 0 : _a.resolveOverlayModel(location, group);\n }\n // IAccessibilityHost — keyboard docking reaches the AdvancedDnD preview +\n // LiveRegion announcer through these so the service stays decoupled.\n /** Outermost element — the shell (incl. edge groups) once built, else the gridview. */\n get rootElement() {\n var _a, _b;\n return (_b = (_a = this._shellManager) === null || _a === void 0 ? void 0 : _a.element) !== null && _b !== void 0 ? _b : this.element;\n }\n /**\n * The next / previous group in gridview (spatial) order, wrapping round.\n * The keyboard accessibility module's focus navigation is built on this\n * primitive — the only piece that needs the grid internals; the rest of\n * the navigation logic lives in the AccessibilityService.\n */\n adjacentGroup(group, reverse) {\n var _a;\n // gridview traversal only covers grid groups; a floating/popout group\n // isn't in the grid, so there's no adjacent grid group to step to.\n if (group.api.location.type !== 'grid') {\n return undefined;\n }\n const location = getGridLocation(group.element);\n return ((_a = (reverse\n ? this.gridview.previous(location)\n : this.gridview.next(location))) === null || _a === void 0 ? void 0 : _a.view);\n }\n /**\n * The nearest grid group in a spatial direction from `group`, by\n * comparing group centre points. Floating and popout groups sit outside\n * the grid's geometry and are ignored. Returns `undefined` when there is\n * no group in that direction.\n */\n adjacentGroupInDirection(group, direction) {\n if (group.api.location.type !== 'grid') {\n return undefined;\n }\n const from = group.element.getBoundingClientRect();\n const fromX = from.left + from.width / 2;\n const fromY = from.top + from.height / 2;\n let best;\n let bestDistance = Number.POSITIVE_INFINITY;\n for (const candidate of this.groups) {\n if (candidate === group || candidate.api.location.type !== 'grid') {\n continue;\n }\n const rect = candidate.element.getBoundingClientRect();\n const dx = rect.left + rect.width / 2 - fromX;\n const dy = rect.top + rect.height / 2 - fromY;\n // Require the candidate to sit predominantly in the asked-for\n // direction (dominant axis), so 'left' ignores a group that's\n // mostly above/below.\n const inDirection = direction === 'left'\n ? dx < 0 && Math.abs(dx) >= Math.abs(dy)\n : direction === 'right'\n ? dx > 0 && Math.abs(dx) >= Math.abs(dy)\n : direction === 'up'\n ? dy < 0 && Math.abs(dy) >= Math.abs(dx)\n : dy > 0 && Math.abs(dy) >= Math.abs(dx);\n if (!inDirection) {\n continue;\n }\n const distance = dx * dx + dy * dy;\n if (distance < bestDistance) {\n bestDistance = distance;\n best = candidate;\n }\n }\n return best;\n }\n showDropPreview(group, position) {\n var _a, _b;\n return ((_b = (_a = this._advancedDnDService) === null || _a === void 0 ? void 0 : _a.showPreviewOverlay(group, position)) !== null && _b !== void 0 ? _b : Disposable.NONE);\n }\n announce(message) {\n var _a;\n (_a = this._moduleRegistry.services.liveRegionService) === null || _a === void 0 ? void 0 : _a.announce(message);\n }\n dockPanel(panel, group, position) {\n this.moveGroupOrPanel({\n from: { groupId: panel.group.id, panelId: panel.id },\n to: { group, position },\n });\n }\n get contextMenuService() {\n // Owned by ContextMenuModule — undefined when the module is not\n // registered, so callers must `?.`-guard.\n return this._moduleRegistry.services.contextMenuService;\n }\n get mountElement() {\n return this.gridview.element;\n }\n hasVisibleGridGroup() {\n return this.groups.some((group) => group.api.location.type === 'grid' && group.api.isVisible);\n }\n fireLayoutChange() {\n this._bufferOnDidLayoutChange.fire();\n }\n /**\n * Promise that resolves when all popout groups from the last fromJSON call are restored.\n * Useful for tests that need to wait for delayed popout creation.\n */\n get popoutRestorationPromise() {\n var _a, _b;\n return ((_b = (_a = this._popoutWindowService) === null || _a === void 0 ? void 0 : _a.restorationPromise) !== null && _b !== void 0 ? _b : Promise.resolve());\n }\n constructor(container, options) {\n var _a, _b, _c, _d, _e;\n super(container, {\n proportionalLayout: true,\n orientation: Orientation.HORIZONTAL,\n styles: options.hideBorders\n ? { separatorBorder: 'transparent' }\n : undefined,\n disableAutoResizing: options.disableAutoResizing,\n locked: options.locked,\n margin: (_b = (_a = options.theme) === null || _a === void 0 ? void 0 : _a.gap) !== null && _b !== void 0 ? _b : 0,\n className: options.className,\n });\n this.nextGroupId = sequentialNumberGenerator();\n this._deserializer = new DefaultDockviewDeserialzier(this);\n this._moduleRegistry = new ModuleRegistry();\n this._onWillDragPanel = new Emitter();\n this.onWillDragPanel = this._onWillDragPanel.event;\n this._onWillDragGroup = new Emitter();\n this.onWillDragGroup = this._onWillDragGroup.event;\n this._onDidDrop = new Emitter();\n this.onDidDrop = this._onDidDrop.event;\n this._onWillDrop = new Emitter();\n this.onWillDrop = this._onWillDrop.event;\n // Transaction boundary bracketing each top-level structural mutation.\n // Compound operations (e.g. a drag that relocates a panel) nest via the\n // depth counter and bracket as a single transaction. See `mutation()`.\n this._mutationDepth = 0;\n // Current operation origin. Defaults to `'user'`; the DockviewApi boundary\n // flips it to `'api'` for the duration of a programmatic call via\n // `withOrigin`. Nested operations inherit the outermost origin (tracked by\n // `_originDepth`, independent of mutation bracketing so it also covers\n // active-panel changes that are not structural mutations).\n this._origin = 'user';\n this._originDepth = 0;\n this._onWillMutateLayout = new Emitter();\n this.onWillMutateLayout = this._onWillMutateLayout.event;\n this._onDidMutateLayout = new Emitter();\n this.onDidMutateLayout = this._onDidMutateLayout.event;\n this._onWillShowOverlay = new Emitter();\n this.onWillShowOverlay = this._onWillShowOverlay.event;\n this._onUnhandledDragOver = new Emitter();\n this.onUnhandledDragOver = this._onUnhandledDragOver.event;\n this._onDidRemovePanel = new Emitter();\n this.onDidRemovePanel = this._onDidRemovePanel.event;\n this._onDidAddPanel = new Emitter();\n this.onDidAddPanel = this._onDidAddPanel.event;\n this._onDidPopoutGroupSizeChange = new Emitter();\n this.onDidPopoutGroupSizeChange = this._onDidPopoutGroupSizeChange.event;\n this._onDidPopoutGroupPositionChange = new Emitter();\n this.onDidPopoutGroupPositionChange = this._onDidPopoutGroupPositionChange.event;\n this._onDidAddPopoutGroup = new Emitter();\n this.onDidAddPopoutGroup = this._onDidAddPopoutGroup.event;\n this._onDidRemovePopoutGroup = new Emitter();\n this.onDidRemovePopoutGroup = this._onDidRemovePopoutGroup.event;\n this._onDidOpenPopoutWindowFail = new Emitter();\n this.onDidOpenPopoutWindowFail = this._onDidOpenPopoutWindowFail.event;\n this._onDidLayoutFromJSON = new Emitter();\n this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;\n this._onDidActivePanelChange = new Emitter({ replay: true });\n this.onDidActivePanelChange = this._onDidActivePanelChange.event;\n this._onDidMovePanel = new Emitter();\n this.onDidMovePanel = this._onDidMovePanel.event;\n this._onDidCreateTabGroup = new Emitter();\n this.onDidCreateTabGroup = this._onDidCreateTabGroup.event;\n this._onDidDestroyTabGroup = new Emitter();\n this.onDidDestroyTabGroup = this._onDidDestroyTabGroup.event;\n this._onDidAddPanelToTabGroup = new Emitter();\n this.onDidAddPanelToTabGroup = this._onDidAddPanelToTabGroup.event;\n this._onDidRemovePanelFromTabGroup = new Emitter();\n this.onDidRemovePanelFromTabGroup = this._onDidRemovePanelFromTabGroup.event;\n this._onDidTabGroupChange = new Emitter();\n this.onDidTabGroupChange = this._onDidTabGroupChange.event;\n this._onDidTabGroupCollapsedChange = new Emitter();\n this.onDidTabGroupCollapsedChange = this._onDidTabGroupCollapsedChange.event;\n this._onDidMaximizedGroupChange = new Emitter();\n this.onDidMaximizedGroupChange = this._onDidMaximizedGroupChange.event;\n this._inShellLayout = false;\n this._onDidRemoveGroup = new Emitter();\n this.onDidRemoveGroup = this._onDidRemoveGroup.event;\n this._onDidAddGroup = new Emitter();\n this.onDidAddGroup = this._onDidAddGroup.event;\n this._onDidOptionsChange = new Emitter();\n this.onDidOptionsChange = this._onDidOptionsChange.event;\n this._onDidActiveGroupChange = new Emitter();\n this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;\n this._moving = false;\n this._options = options;\n this._tabGroupColorPalette = buildTabGroupColorPalette(options);\n // Internal seam: defaults to the full set, but tests can supply a\n // subset to assert every module is independently removable (and the\n // opt-in module API will build on this later). Not part of the public\n // options surface.\n const explicitModules = options\n .modules;\n const modules = explicitModules !== null && explicitModules !== void 0 ? explicitModules : [\n ...AllModules,\n ...getRegisteredModules(),\n ];\n for (const module of modules) {\n this._moduleRegistry.register(module);\n }\n this._moduleRegistry.initialize(this);\n // Surface popout removal symmetrically with `onDidAddPopoutGroup`. The\n // service is the single point every removal path funnels through — a\n // genuine window close and an explicit removal alike — and it suppresses\n // the event during component teardown.\n const popoutWindowService = this._popoutWindowService;\n if (popoutWindowService) {\n this.addDisposables(popoutWindowService.onDidRemove((entry) => {\n this._onDidRemovePopoutGroup.fire({\n id: entry.popoutGroup.id,\n group: entry.popoutGroup,\n window: entry.getWindow(),\n });\n }));\n }\n // Purely a developer warning (no functional effect): nudge anyone using\n // the internal `dockview-core` package directly towards `dockview`.\n warnIfUsingCoreDirectly();\n this.popupService = new PopupService(this.element);\n this._api = new DockviewApi(this);\n // The shell always wraps the dockview element so edge groups can be\n // added at any time via addEdgeGroup() without re-parenting the DOM.\n this.disableResizing = true;\n container.removeChild(this.element);\n this._shellManager = new ShellManager(container, this.element, (w, h) => this._layoutFromShell(w, h), (_d = (_c = options.theme) === null || _c === void 0 ? void 0 : _c.gap) !== null && _d !== void 0 ? _d : 0, (_e = options.theme) === null || _e === void 0 ? void 0 : _e.edgeGroupCollapsedSize);\n // The shell wraps the dockview element, so move the popup anchor\n // into the shell so overflow dropdowns in edge groups position correctly\n this.popupService.updateRoot(this._shellManager.element);\n this._shellThemeClassnames = new Classnames(this._shellManager.element);\n // Anchor the overlay container to the shell element so that edge groups\n // (which live outside this.element in the shell layout) are covered when\n // dndOverlayMounting is 'absolute'.\n this.rootDropTargetContainer = new DropTargetAnchorContainer(this._shellManager.element, { disabled: true });\n this.overlayRenderContainer = new OverlayRenderContainer(this._shellManager.element, this);\n // Hosted in the shell (not inside `.dv-dockview`) so floating overlays\n // share a stacking context with `dv-render-overlay` panels; sized to\n // mirror the gridview rect so saved positions remain valid.\n this._floatingOverlayHost = document.createElement('div');\n this._floatingOverlayHost.className = 'dv-floating-overlay-host';\n this._shellManager.element.appendChild(this._floatingOverlayHost);\n toggleClass(this.gridview.element, 'dv-dockview', true);\n toggleClass(this.element, 'dv-debug', !!options.debug);\n this.updateTheme();\n if (options.debug) {\n this.addDisposables(new StrictEventsSequencing(this));\n }\n 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._onWillMutateLayout, this._onDidMutateLayout, this._onDidMovePanel, this._onDidMovePanel.event(() => {\n /**\n * Update overlay positions after DOM layout completes to prevent 0×0 dimensions.\n * With defaultRenderer=\"always\" this results in panel content not showing after move operations.\n * Debounced to avoid multiple calls when moving groups with multiple panels.\n */\n this.debouncedUpdateAllPositions();\n }), this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this._onUnhandledDragOver, this._onDidMaximizedGroupChange, this._onDidPopoutGroupSizeChange, this._onDidPopoutGroupPositionChange, this._onDidAddPopoutGroup, this._onDidRemovePopoutGroup, this._onDidOpenPopoutWindowFail, this._onDidCreateTabGroup, this._onDidDestroyTabGroup, this._onDidAddPanelToTabGroup, this._onDidRemovePanelFromTabGroup, this._onDidTabGroupChange, this._onDidTabGroupCollapsedChange, Event.any(this.onDidPopoutGroupSizeChange, this.onDidPopoutGroupPositionChange, this.onDidCreateTabGroup, this.onDidDestroyTabGroup, this.onDidAddPanelToTabGroup, this.onDidRemovePanelFromTabGroup, this.onDidTabGroupChange, this.onDidTabGroupCollapsedChange)(() => {\n // Popout size/position and tab-group mutations persist as layout changes.\n this.fireLayoutChange();\n }), this._onDidOptionsChange, this.onDidAdd((event) => {\n if (!this._moving) {\n this._onDidAddGroup.fire(event);\n }\n }), this.onDidRemove((event) => {\n if (!this._moving) {\n this._onDidRemoveGroup.fire(event);\n }\n }), this.onDidActiveChange((event) => {\n if (!this._moving) {\n this._onDidActiveGroupChange.fire(event);\n }\n }), this.onDidMaximizedChange((event) => {\n this._onDidMaximizedGroupChange.fire({\n group: event.panel,\n isMaximized: event.isMaximized,\n });\n }), Event.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidAddGroup, this.onDidRemove, this.onDidRemoveGroup, this.onDidMovePanel, this.onDidActivePanelChange)(() => {\n this._bufferOnDidLayoutChange.fire();\n }), Disposable.from(() => {\n var _a;\n // Registry disposes init() subscriptions then every module\n // service that implements IDisposable. The order matters so\n // init handlers stop firing into services about to be torn\n // down. Includes popout-restoration timer cancellation that\n // resolves promises so awaiters of popoutRestorationPromise\n // don't hang. See issue #851.\n this._moduleRegistry.dispose();\n (_a = this._shellManager) === null || _a === void 0 ? void 0 : _a.dispose();\n }));\n // Root edge-drop wiring lives with its (optional) module — guard it so\n // the module is independently removable.\n const rootDropTarget = this._rootDropTargetService;\n if (rootDropTarget) {\n this.addDisposables(rootDropTarget.onWillShowOverlay((event) => {\n if (this.gridview.length > 0 &&\n event.position === 'center') {\n // option only available when no panels in primary grid\n return;\n }\n this._onWillShowOverlay.fire(new DockviewWillShowOverlayLocationEvent(event, {\n kind: 'edge',\n panel: undefined,\n api: this._api,\n group: undefined,\n getData: getPanelData,\n }));\n }), rootDropTarget.onDrop((event) => {\n var _a;\n const willDropEvent = new DockviewWillDropEvent({\n nativeEvent: event.nativeEvent,\n position: event.position,\n panel: undefined,\n api: this._api,\n group: undefined,\n getData: getPanelData,\n kind: 'edge',\n });\n this._onWillDrop.fire(willDropEvent);\n if (willDropEvent.defaultPrevented) {\n return;\n }\n const data = getPanelData();\n if (data) {\n this.moveGroupOrPanel({\n from: {\n groupId: data.groupId,\n panelId: (_a = data.panelId) !== null && _a !== void 0 ? _a : undefined,\n },\n to: {\n group: this.orthogonalize(event.position),\n position: 'center',\n },\n });\n }\n else {\n this._onDidDrop.fire(new DockviewDidDropEvent({\n nativeEvent: event.nativeEvent,\n position: event.position,\n panel: undefined,\n api: this._api,\n group: undefined,\n getData: getPanelData,\n }));\n }\n }));\n }\n // Final module wiring: runs after the host is fully constructed.\n // Modules subscribe to host events here so the component doesn't\n // need to manually invoke them at scattered call sites.\n this._moduleRegistry.postConstruct(this);\n }\n setVisible(panel, visible) {\n switch (panel.api.location.type) {\n case 'grid':\n super.setVisible(panel, visible);\n break;\n case 'floating': {\n const item = this.floatingGroups.find((floatingGroup) => floatingGroup.group === panel);\n if (item) {\n item.overlay.setVisible(visible);\n panel.api._onDidVisibilityChange.fire({\n isVisible: visible,\n });\n }\n break;\n }\n case 'popout':\n console.warn('dockview: You cannot hide a group that is in a popout window');\n break;\n }\n }\n /**\n * Returns the {@link PopupService} that should host popovers (context\n * menus, tab overflow menus) for the given group. Popout groups have their\n * own service rooted in their popout window so the popover renders there\n * and dismisses on events from that window.\n */\n getPopupServiceForGroup(group) {\n var _a, _b;\n return ((_b = (_a = this._popoutWindowService) === null || _a === void 0 ? void 0 : _a.getPopupService(group.id)) !== null && _b !== void 0 ? _b : this.popupService);\n }\n addPopoutGroup(itemToPopout, options) {\n // The transaction brackets the synchronous structural change; the\n // popout window opens asynchronously after it resolves.\n return this.mutation('popout', () => this._doAddPopoutGroup(itemToPopout, options));\n }\n /** Enumerate the popout groups currently open in their own windows. */\n getPopouts() {\n var _a, _b;\n return ((_b = (_a = this._popoutWindowService) === null || _a === void 0 ? void 0 : _a.entries.map((entry) => ({\n id: entry.popoutGroup.id,\n group: entry.popoutGroup,\n window: entry.getWindow(),\n }))) !== null && _b !== void 0 ? _b : []);\n }\n _doAddPopoutGroup(itemToPopout, options) {\n var _a, _b, _c, _d, _e;\n const service = assertModule(this._popoutWindowService, 'PopoutWindow', 'api.addPopoutGroup');\n if (!service) {\n return Promise.resolve(false);\n }\n if (itemToPopout instanceof DockviewGroupPanel &&\n itemToPopout.model.location.type === 'edge') {\n // edge groups are permanent structural elements and cannot be popped out\n return Promise.resolve(false);\n }\n if (itemToPopout instanceof DockviewPanel &&\n itemToPopout.group.size === 1) {\n return this.addPopoutGroup(itemToPopout.group, options);\n }\n const theme = getDockviewTheme(this.gridview.element);\n const element = this.element;\n function getBox() {\n if (options === null || options === void 0 ? void 0 : options.position) {\n return options.position;\n }\n if (itemToPopout instanceof DockviewGroupPanel) {\n return itemToPopout.element.getBoundingClientRect();\n }\n if (itemToPopout.group) {\n return itemToPopout.group.element.getBoundingClientRect();\n }\n return element.getBoundingClientRect();\n }\n const box = getBox();\n const groupId = (_b = (_a = options === null || options === void 0 ? void 0 : options.overridePopoutGroup) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : this.getNextGroupId();\n // Resolve the configured popout URL once (per-call override → global\n // option). Recorded on the entry / group locations so it survives\n // serialization; the '/popout.html' default is applied only when\n // actually opening the window, not baked into saved layouts.\n const resolvedPopoutUrl = (_c = options === null || options === void 0 ? void 0 : options.popoutUrl) !== null && _c !== void 0 ? _c : (_d = this.options) === null || _d === void 0 ? void 0 : _d.popoutUrl;\n const _window = new PopoutWindow(`${this.id}-${groupId}`, // unique id\n theme !== null && theme !== void 0 ? theme : '', {\n url: resolvedPopoutUrl !== null && resolvedPopoutUrl !== void 0 ? resolvedPopoutUrl : '/popout.html',\n left: window.screenX + box.left,\n top: window.screenY + box.top,\n width: box.width,\n height: box.height,\n onDidOpen: options === null || options === void 0 ? void 0 : options.onDidOpen,\n onWillClose: options === null || options === void 0 ? void 0 : options.onWillClose,\n nonce: (_e = this.options) === null || _e === void 0 ? void 0 : _e.nonce,\n });\n const popoutWindowDisposable = new CompositeDisposable(_window, _window.onDidClose(() => {\n popoutWindowDisposable.dispose();\n }));\n return _window\n .open()\n .then((popoutContainer) => {\n var _a, _b, _c;\n if (_window.isDisposed) {\n return false;\n }\n const referenceGroup = (options === null || options === void 0 ? void 0 : options.referenceGroup)\n ? options.referenceGroup\n : itemToPopout instanceof DockviewPanel\n ? itemToPopout.group\n : itemToPopout;\n const referenceLocation = itemToPopout.api.location.type;\n /**\n * The group that is being added doesn't already exist within the DOM, the most likely occurrence\n * of this case is when being called from the `fromJSON(...)` method\n */\n const isGroupAddedToDom = referenceGroup.element.parentElement !== null;\n let group;\n if (options === null || options === void 0 ? void 0 : options.overridePopoutGridview) {\n // Restoring a multi-group window: the anchor group is\n // already built inside the supplied gridview.\n group = (_a = options.overridePopoutGroup) !== null && _a !== void 0 ? _a : referenceGroup;\n }\n else if (!isGroupAddedToDom) {\n group = referenceGroup;\n }\n else if (options === null || options === void 0 ? void 0 : options.overridePopoutGroup) {\n group = options.overridePopoutGroup;\n }\n else {\n group = this.createGroup({ id: groupId });\n if (popoutContainer) {\n this._onDidAddGroup.fire(group);\n }\n }\n if (popoutContainer === null) {\n this.handleBlockedPopout({\n group,\n referenceGroup,\n options,\n popoutWindowDisposable,\n });\n return false;\n }\n const gready = document.createElement('div');\n gready.className = 'dv-overlay-render-container';\n const overlayRenderContainer = new OverlayRenderContainer(gready, this);\n group.model.renderContainer = overlayRenderContainer;\n // The popout window hosts its own gridview so it can grow into\n // a nested splitview layout. The window starts with the single\n // anchor group; further groups arrive via drag-and-drop. On\n // restore a pre-populated gridview is supplied instead.\n const popoutGridview = (_b = options === null || options === void 0 ? void 0 : options.overridePopoutGridview) !== null && _b !== void 0 ? _b : this.createNestedGridview();\n if (!(options === null || options === void 0 ? void 0 : options.overridePopoutGridview)) {\n popoutGridview.addView(group, Sizing.Distribute, [0]);\n }\n // Fill the popout window. Unlike the main grid (explicit px) and\n // floating windows (CSS inside .dv-resize-container), the popout\n // gridview has no sizing context, so without this it collapses\n // to 0 height and nothing renders.\n popoutGridview.element.style.width = '100%';\n popoutGridview.element.style.height = '100%';\n popoutGridview.layout(_window.window.innerWidth, _window.window.innerHeight);\n // Guarded so the teardown's re-entrant paths (window close\n // re-enters via the anchor's doRemoveGroup) never double-dispose.\n let popoutGridviewDisposed = false;\n const disposePopoutGridview = () => {\n if (!popoutGridviewDisposed) {\n popoutGridviewDisposed = true;\n popoutGridview.dispose();\n }\n };\n let floatingBox;\n if (!(options === null || options === void 0 ? void 0 : options.overridePopoutGroup) &&\n !(options === null || options === void 0 ? void 0 : options.overridePopoutGridview) &&\n isGroupAddedToDom) {\n if (itemToPopout instanceof DockviewPanel) {\n this.movingLock(() => {\n const panel = referenceGroup.model.removePanel(itemToPopout);\n group.model.openPanel(panel);\n });\n }\n else {\n this.movingLock(() => moveGroupWithoutDestroying({\n from: referenceGroup,\n to: group,\n }));\n switch (referenceLocation) {\n case 'grid':\n referenceGroup.api.setVisible(false);\n break;\n case 'floating':\n case 'popout':\n floatingBox = (_c = this.floatingGroups\n .find((value) => value.group.api.id ===\n itemToPopout.api.id)) === null || _c === void 0 ? void 0 : _c.overlay.toJSON();\n this.removeGroup(referenceGroup);\n break;\n }\n }\n }\n popoutContainer.classList.add('dv-dockview');\n popoutContainer.style.overflow = 'hidden';\n popoutContainer.appendChild(gready);\n popoutContainer.appendChild(popoutGridview.element);\n const anchor = document.createElement('div');\n const dropTargetContainer = new DropTargetAnchorContainer(anchor, { disabled: this.rootDropTargetContainer.disabled });\n popoutContainer.appendChild(anchor);\n group.model.dropTargetContainer = dropTargetContainer;\n // Each popout group needs its own popover service so that\n // tab context menus, chip menus, and tab overflow menus\n // render in the popout window (not the main window) and\n // their pointerdown/keydown listeners fire on the right\n // window for outside-click and Escape dismissal.\n const popoutPopupService = new PopupService(popoutContainer, _window.window);\n service.setPopupService(group.id, popoutPopupService);\n popoutWindowDisposable.addDisposables(popoutPopupService, Disposable.from(() => {\n service.deletePopupService(group.id);\n }));\n group.model.location = {\n type: 'popout',\n getWindow: () => _window.window,\n popoutUrl: resolvedPopoutUrl,\n };\n if (options === null || options === void 0 ? void 0 : options.overridePopoutGridview) {\n // Restored multi-group window. Wire every member (including\n // the anchor) to this window's containers and popout\n // location now that the gridview is attached and laid out —\n // re-setting renderContainer forces a re-render at the right\n // time so 'always'-rendered content positions in this\n // window rather than where it was first created.\n const members = this.groups.filter((candidate) => popoutGridview.element.contains(candidate.element));\n for (const member of members) {\n member.model.renderContainer = overlayRenderContainer;\n member.model.dropTargetContainer = dropTargetContainer;\n member.model.location = {\n type: 'popout',\n getWindow: () => _window.window,\n popoutUrl: resolvedPopoutUrl,\n };\n }\n }\n if (isGroupAddedToDom &&\n itemToPopout.api.location.type === 'grid') {\n itemToPopout.api.setVisible(false);\n }\n this.doSetGroupAndPanelActive(group);\n const resizeObserverDisposable = service.observeGridviewSize(_window, popoutGridview, overlayRenderContainer);\n if (resizeObserverDisposable) {\n popoutWindowDisposable.addDisposables(resizeObserverDisposable);\n }\n popoutWindowDisposable.addDisposables(group.api.onDidActiveChange((event) => {\n var _a;\n if (event.isActive) {\n (_a = _window.window) === null || _a === void 0 ? void 0 : _a.focus();\n }\n }), group.api.onWillFocus(() => {\n var _a;\n (_a = _window.window) === null || _a === void 0 ? void 0 : _a.focus();\n }));\n // Holder so the close teardown (extracted below) can publish\n // the group that was returned to the main grid back to the\n // entry's `dispose()` contract.\n const closeResult = {};\n const isValidReferenceGroup = isGroupAddedToDom &&\n referenceGroup &&\n this.getPanel(referenceGroup.id);\n const value = {\n window: _window,\n popoutGroup: group,\n gridview: popoutGridview,\n overlayRenderContainer,\n dropTargetContainer,\n getWindow: () => _window.window,\n popoutUrl: resolvedPopoutUrl,\n referenceGroup: isValidReferenceGroup\n ? referenceGroup.id\n : undefined,\n disposable: {\n dispose: () => {\n popoutWindowDisposable.dispose();\n return closeResult.returnedGroup;\n },\n },\n };\n const _onDidWindowPositionChange = onDidWindowMoveEnd(_window.window);\n popoutWindowDisposable.addDisposables(_onDidWindowPositionChange, onDidWindowResizeEnd(_window.window, () => {\n this._onDidPopoutGroupSizeChange.fire({\n width: _window.window.innerWidth,\n height: _window.window.innerHeight,\n group,\n });\n }), _onDidWindowPositionChange.event(() => {\n this._onDidPopoutGroupPositionChange.fire({\n screenX: _window.window.screenX,\n screenY: _window.window.screenX,\n group,\n });\n }), addDisposableListener(_window.window, 'resize', () => {\n popoutGridview.layout(_window.window.innerWidth, _window.window.innerHeight);\n }), overlayRenderContainer, Disposable.from(() => this.disposePopoutWindow({\n group,\n referenceGroup,\n popoutGridview,\n isGroupAddedToDom,\n floatingBox,\n disposePopoutGridview,\n closeResult,\n })));\n service.add(value);\n this._onDidAddPopoutGroup.fire({\n id: value.popoutGroup.id,\n group: value.popoutGroup,\n window: value.getWindow(),\n });\n return true;\n })\n .catch((err) => {\n console.error('dockview: failed to create popout.', err);\n return false;\n });\n }\n /**\n * The popout window was blocked (e.g. by the browser's popup blocker —\n * common when restoring popouts on load). Fall back gracefully so the\n * group(s) end up valid and visible in the main grid rather than as\n * orphans that later crash clear()/remove().\n */\n handleBlockedPopout(params) {\n const { group, referenceGroup, options, popoutWindowDisposable } = params;\n console.error('dockview: failed to create popout. perhaps you need to allow pop-ups for this website');\n popoutWindowDisposable.dispose();\n this._onDidOpenPopoutWindowFail.fire();\n if (options === null || options === void 0 ? void 0 : options.overridePopoutGridview) {\n // Restoring a multi-group popout window: its nested gridview was\n // built up-front but never attached to a window. Dock every member\n // into the main grid so no group is lost, then discard the\n // detached gridview.\n const blockedGridview = options.overridePopoutGridview;\n const members = this.groups.filter((candidate) => blockedGridview.element.contains(candidate.element));\n for (const member of members) {\n this.movingLock(() => {\n blockedGridview.remove(member);\n this.redockGroupToMainGrid(member);\n });\n }\n blockedGridview.dispose();\n if (referenceGroup && !referenceGroup.api.isVisible) {\n referenceGroup.api.setVisible(true);\n }\n return;\n }\n if (group === referenceGroup) {\n // No separate grid group to return to (e.g. restoring a popout\n // straight from JSON) — dock this group into the main grid.\n if (!this.gridview.element.contains(group.element)) {\n this.movingLock(() => this.doAddGroup(group, [0]));\n group.model.location = { type: 'grid' };\n }\n }\n else {\n // A fresh group was created for the popout — return its panels to\n // the reference group and discard the now-empty popout group so it\n // doesn't linger as an orphan.\n this.movingLock(() => moveGroupWithoutDestroying({\n from: group,\n to: referenceGroup,\n }));\n if (group.model.size === 0 && this._groups.has(group.id)) {\n group.dispose();\n this._groups.delete(group.id);\n this._onDidRemoveGroup.fire(group);\n }\n }\n if (!referenceGroup.api.isVisible) {\n referenceGroup.api.setVisible(true);\n }\n }\n /**\n * Wire a group that has been displaced from a floating / popout window back\n * to the main grid's render & drop-target containers and dock it at the\n * root. The caller is responsible for first detaching it from its old\n * gridview — the detach strategy differs between the window-teardown path\n * (`doRemoveGroup`) and the blocked-window path (`gridview.remove`).\n */\n redockGroupToMainGrid(group) {\n group.model.renderContainer = this.overlayRenderContainer;\n group.model.dropTargetContainer = this.rootDropTargetContainer;\n group.model.location = { type: 'grid' };\n this.doAddGroup(group, [0]);\n }\n /**\n * Teardown for a popout window's `popoutWindowDisposable`. Runs when the\n * window closes (by user, by `removeGroup`, or by component disposal):\n * relocates every member group back to the main grid (or to a floating\n * window when the anchor came from one), then disposes the nested gridview.\n * `closeResult.returnedGroup` is read by the entry's `dispose()` contract.\n */\n disposePopoutWindow(params) {\n var _a;\n const { group, referenceGroup, popoutGridview, isGroupAddedToDom, floatingBox, disposePopoutGridview, closeResult, } = params;\n if (this.isDisposed) {\n // cleanup may run after instance is disposed; just tear down the\n // nested gridview.\n disposePopoutGridview();\n return;\n }\n // Distinguish a genuine window close from an explicit `removeGroup`:\n // the explicit-removal paths remove the service entry *before* this\n // disposable runs. Key off the stable `popoutGridview` rather than the\n // captured `group`, which may no longer be the window's anchor (it can\n // have been dragged out, promoting another member to anchor).\n const genuineClose = !!((_a = this._popoutWindowService) === null || _a === void 0 ? void 0 : _a.entries.find((entry) => entry.gridview === popoutGridview));\n // The groups still living in this window, resolved from the gridview so\n // a reassigned anchor doesn't hide surviving members.\n const members = this.groups.filter((candidate) => popoutGridview.element.contains(candidate.element));\n const anchorPresent = members.includes(group);\n const anchorIsSoleMember = anchorPresent && members.length === 1;\n // On a genuine close, relocate every member that ISN'T the captured\n // anchor back to the main grid. The captured anchor (if still here) gets\n // the reference-return / re-float treatment below. Explicit removal\n // relocates via its own path, so the loop is skipped for it.\n if (genuineClose) {\n for (const member of members) {\n if (member === group) {\n continue;\n }\n this.movingLock(() => {\n this.doRemoveGroup(member, {\n skipDispose: true,\n skipActive: true,\n skipPopoutReturn: true,\n });\n this.redockGroupToMainGrid(member);\n });\n }\n }\n if (anchorPresent &&\n isGroupAddedToDom &&\n this.getPanel(referenceGroup.id)) {\n this.movingLock(() => moveGroupWithoutDestroying({\n from: group,\n to: referenceGroup,\n }));\n if (!referenceGroup.api.isVisible) {\n referenceGroup.api.setVisible(true);\n }\n if (this.getPanel(group.id)) {\n this.doRemoveGroup(group, {\n skipPopoutAssociated: true,\n });\n }\n }\n else if (anchorPresent && this.getPanel(group.id)) {\n group.model.renderContainer = this.overlayRenderContainer;\n group.model.dropTargetContainer = this.rootDropTargetContainer;\n closeResult.returnedGroup = group;\n if (!genuineClose) {\n /**\n * If this popout group was explicitly removed then we shouldn't run the additional\n * steps. The explicit remover re-docks the returned group itself; here we only hand\n * it back (above) and tear down the nested gridview.\n */\n disposePopoutGridview();\n return;\n }\n // Re-float only restores the pre-popout state of a SINGLE popped-out\n // group. A multi-group window must not be split (anchor re-floats\n // while the rest dock to the grid), so dock the anchor to the grid\n // alongside the other members once they're no longer alone.\n if (floatingBox && anchorIsSoleMember) {\n this.addFloatingGroup(group, {\n height: floatingBox.height,\n width: floatingBox.width,\n position: floatingBox,\n });\n }\n else {\n this.doRemoveGroup(group, {\n skipDispose: true,\n skipActive: true,\n skipPopoutReturn: true,\n });\n group.model.location = { type: 'grid' };\n this.movingLock(() => {\n // suppress group add events since the group already exists\n this.doAddGroup(group, [0]);\n });\n }\n this.doSetGroupAndPanelActive(group);\n }\n // All members have been relocated out; tear down the window's nested\n // gridview (does not dispose the leaf views — their lifecycle stays\n // with `_groups`).\n disposePopoutGridview();\n }\n addFloatingGroup(item, options) {\n this.mutation('float', () => this._doAddFloatingGroup(item, options));\n }\n _doAddFloatingGroup(item, options) {\n var _a;\n const service = assertModule(this._floatingGroupService, 'FloatingGroup', 'api.addFloatingGroup');\n if (!service) {\n return;\n }\n if (item instanceof DockviewGroupPanel &&\n item.model.location.type === 'edge') {\n // edge groups are permanent structural elements and cannot be floated\n return;\n }\n let group;\n if (item instanceof DockviewPanel) {\n group = this.createGroup();\n this._onDidAddGroup.fire(group);\n this.movingLock(() => this.removePanel(item, {\n removeEmptyGroup: true,\n skipDispose: true,\n skipSetActiveGroup: true,\n }));\n this.movingLock(() => group.model.openPanel(item, { skipSetGroupActive: true }));\n }\n else {\n group = item;\n const popoutReferenceGroupId = (_a = this._popoutWindowService) === null || _a === void 0 ? void 0 : _a.findReferenceGroupId(group);\n const popoutReferenceGroup = popoutReferenceGroupId\n ? this.getPanel(popoutReferenceGroupId)\n : undefined;\n const skip = typeof (options === null || options === void 0 ? void 0 : options.skipRemoveGroup) === 'boolean' &&\n options.skipRemoveGroup;\n if (!skip) {\n if (popoutReferenceGroup) {\n this.movingLock(() => moveGroupWithoutDestroying({\n from: item,\n to: popoutReferenceGroup,\n }));\n this.doRemoveGroup(item, {\n skipPopoutReturn: true,\n skipPopoutAssociated: true,\n });\n this.doRemoveGroup(popoutReferenceGroup, {\n skipDispose: true,\n });\n group = popoutReferenceGroup;\n }\n else {\n this.doRemoveGroup(item, {\n skipDispose: true,\n skipPopoutReturn: true,\n skipPopoutAssociated: false,\n });\n }\n }\n }\n function getAnchoredBox() {\n if (options === null || options === void 0 ? void 0 : options.position) {\n const result = {};\n if ('left' in options.position) {\n result.left = Math.max(options.position.left, 0);\n }\n else if ('right' in options.position) {\n result.right = Math.max(options.position.right, 0);\n }\n else {\n result.left = DEFAULT_FLOATING_GROUP_POSITION.left;\n }\n if ('top' in options.position) {\n result.top = Math.max(options.position.top, 0);\n }\n else if ('bottom' in options.position) {\n result.bottom = Math.max(options.position.bottom, 0);\n }\n else {\n result.top = DEFAULT_FLOATING_GROUP_POSITION.top;\n }\n if (typeof options.width === 'number') {\n result.width = Math.max(options.width, 0);\n }\n else {\n result.width = DEFAULT_FLOATING_GROUP_POSITION.width;\n }\n if (typeof options.height === 'number') {\n result.height = Math.max(options.height, 0);\n }\n else {\n result.height = DEFAULT_FLOATING_GROUP_POSITION.height;\n }\n return result;\n }\n return {\n left: typeof (options === null || options === void 0 ? void 0 : options.x) === 'number'\n ? Math.max(options.x, 0)\n : DEFAULT_FLOATING_GROUP_POSITION.left,\n top: typeof (options === null || options === void 0 ? void 0 : options.y) === 'number'\n ? Math.max(options.y, 0)\n : DEFAULT_FLOATING_GROUP_POSITION.top,\n width: typeof (options === null || options === void 0 ? void 0 : options.width) === 'number'\n ? Math.max(options.width, 0)\n : DEFAULT_FLOATING_GROUP_POSITION.width,\n height: typeof (options === null || options === void 0 ? void 0 : options.height) === 'number'\n ? Math.max(options.height, 0)\n : DEFAULT_FLOATING_GROUP_POSITION.height,\n };\n }\n const anchoredBox = getAnchoredBox();\n // The floating window hosts its own gridview so it can grow into a\n // nested splitview layout. The window starts with the single anchor\n // group; further groups are added via drag-and-drop.\n const floatingGridview = this.createNestedGridview();\n floatingGridview.addView(group, Sizing.Distribute, [0]);\n this.mountFloatingWindow(floatingGridview, group, [group], anchoredBox, {\n dragHandle: options === null || options === void 0 ? void 0 : options.dragHandle,\n inDragMode: options === null || options === void 0 ? void 0 : options.inDragMode,\n skipActiveGroup: options === null || options === void 0 ? void 0 : options.skipActiveGroup,\n });\n }\n /**\n * Build an empty gridview configured to match the main grid's styling, for\n * hosting a nested layout inside a floating or popout window.\n */\n createNestedGridview(orientation = Orientation.HORIZONTAL) {\n var _a, _b;\n return new Gridview(true, this.options.hideBorders\n ? { separatorBorder: 'transparent' }\n : undefined, orientation, false, (_b = (_a = this.options.theme) === null || _a === void 0 ? void 0 : _a.gap) !== null && _b !== void 0 ? _b : 0);\n }\n /**\n * Wrap a (populated) floating gridview in an overlay window: title bar /\n * move handle, drag wiring, the floating-group service entry and the\n * `floating` location tag for every member group.\n */\n mountFloatingWindow(floatingGridview, anchorGroup, members, anchoredBox, options) {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n const service = assertModule(this._floatingGroupService, 'FloatingGroup', 'api.addFloatingGroup');\n if (!service) {\n return;\n }\n const dragHandleMode = (_b = (_a = options === null || options === void 0 ? void 0 : options.dragHandle) !== null && _a !== void 0 ? _a : this.options.floatingGroupDragHandle) !== null && _b !== void 0 ? _b : 'titlebar';\n // `'titlebar'` renders a dedicated grab bar above the tab bar and uses\n // it as the move handle; `'tabbar'` falls back to moving via the\n // tab-bar void container.\n const titleBar = dragHandleMode === 'titlebar'\n ? new FloatingTitleBar(this, anchorGroup)\n : undefined;\n const overlay = new Overlay(Object.assign(Object.assign({ container: (_c = this._floatingOverlayHost) !== null && _c !== void 0 ? _c : this.gridview.element, content: floatingGridview.element, header: titleBar === null || titleBar === void 0 ? void 0 : titleBar.element }, anchoredBox), { minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'\n ? undefined\n : ((_e = (_d = this.options.floatingGroupBounds) === null || _d === void 0 ? void 0 : _d.minimumWidthWithinViewport) !== null && _e !== void 0 ? _e : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE), minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'\n ? undefined\n : ((_g = (_f = this.options.floatingGroupBounds) === null || _f === void 0 ? void 0 : _f.minimumHeightWithinViewport) !== null && _g !== void 0 ? _g : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE), transformDragPosition: this.options.transformFloatingGroupDrag\n ? (context) => this.options.transformFloatingGroupDrag({\n group: anchorGroup,\n proposed: context.proposed,\n container: context.container,\n others: context.others,\n })\n : undefined, getSiblingBoxes: () => this._gatherFloatingGroupBoxes(anchorGroup) }));\n const dragHandle = (_h = titleBar === null || titleBar === void 0 ? void 0 : titleBar.element) !== null && _h !== void 0 ? _h : anchorGroup.element.querySelector('.dv-void-container');\n if (!dragHandle) {\n throw new Error('dockview: failed to find drag handle');\n }\n overlay.setupDrag(dragHandle, {\n inDragMode: typeof (options === null || options === void 0 ? void 0 : options.inDragMode) === 'boolean'\n ? options.inDragMode\n : false,\n });\n const floatingGroupPanel = service.add(anchorGroup, overlay, floatingGridview);\n if (titleBar) {\n // Tie the title bar's lifetime to the floating window and surface\n // its redock drag through the same public `onWillDragGroup` event\n // the tab-bar handle uses. Register it so anchor reassignment (when\n // the original anchor leaves a multi-group window) retargets the\n // bar at a group that still lives here.\n floatingGroupPanel.setTitleBar(titleBar);\n floatingGroupPanel.addDisposables(titleBar, Disposable.from(() => floatingGroupPanel.setTitleBar(undefined)), titleBar.onDragStart((event) => {\n this._onWillDragGroup.fire({\n nativeEvent: event,\n group: floatingGroupPanel.group,\n });\n }));\n }\n for (const member of members) {\n member.model.location = { type: 'floating' };\n }\n if (!(options === null || options === void 0 ? void 0 : options.skipActiveGroup)) {\n this.doSetGroupAndPanelActive(anchorGroup);\n }\n }\n orthogonalize(position, options) {\n this.gridview.normalize();\n switch (position) {\n case 'top':\n case 'bottom':\n if (this.gridview.orientation === Orientation.HORIZONTAL) {\n // we need to add to a vertical splitview but the current root is a horizontal splitview.\n // insert a vertical splitview at the root level and add the existing view as a child\n this.gridview.insertOrthogonalSplitviewAtRoot();\n }\n break;\n case 'left':\n case 'right':\n if (this.gridview.orientation === Orientation.VERTICAL) {\n // we need to add to a horizontal splitview but the current root is a vertical splitview.\n // insert a horiziontal splitview at the root level and add the existing view as a child\n this.gridview.insertOrthogonalSplitviewAtRoot();\n }\n break;\n }\n switch (position) {\n case 'top':\n case 'left':\n case 'center':\n return this.createGroupAtLocation([0], undefined, options); // insert into first position\n case 'bottom':\n case 'right':\n return this.createGroupAtLocation([this.gridview.length], undefined, options); // insert into last position\n default:\n throw new Error(`dockview: unsupported position ${position}`);\n }\n }\n updateOptions(options) {\n var _a, _b, _c, _d, _e;\n super.updateOptions(options);\n (_a = this._floatingGroupService) === null || _a === void 0 ? void 0 : _a.updateBounds(options);\n (_b = this._rootDropTargetService) === null || _b === void 0 ? void 0 : _b.setOptions(options);\n const oldDisableDnd = this.options.disableDnd;\n const oldDndStrategy = this.options.dndStrategy;\n this._options = Object.assign(Object.assign({}, this.options), options);\n const newDisableDnd = this.options.disableDnd;\n const newDndStrategy = this.options.dndStrategy;\n if (oldDisableDnd !== newDisableDnd ||\n oldDndStrategy !== newDndStrategy) {\n this.updateDragAndDropState();\n }\n if ('theme' in options) {\n this.updateTheme();\n }\n if ('createRightHeaderActionComponent' in options ||\n 'createLeftHeaderActionComponent' in options ||\n 'createPrefixHeaderActionComponent' in options) {\n (_c = this.headerActionsService) === null || _c === void 0 ? void 0 : _c.refreshAll();\n }\n if ('createWatermarkComponent' in options) {\n (_d = this._watermarkService) === null || _d === void 0 ? void 0 : _d.refresh();\n for (const group of this.groups) {\n group.model.refreshWatermark();\n }\n }\n if ('tabGroupColors' in options || 'tabGroupAccent' in options) {\n this._tabGroupColorPalette.setEntries((_e = this._options.tabGroupColors) !== null && _e !== void 0 ? _e : DEFAULT_TAB_GROUP_COLORS);\n this._tabGroupColorPalette.enabled =\n this._options.tabGroupAccent !== 'off';\n for (const group of this.groups) {\n group.model.refreshTabGroupAccent();\n }\n }\n this._onDidOptionsChange.fire();\n this._layoutFromShell(this.gridview.width, this.gridview.height);\n }\n layout(width, height, forceResize) {\n var _a, _b;\n if (this._shellManager && !this._inShellLayout) {\n this._shellManager.layout(width, height);\n }\n else {\n super.layout(width, height, forceResize);\n }\n this._syncFloatingOverlayHost();\n // floatingGroupService may be undefined during super() (BaseGrid calls\n // layout(0, 0) before subclass field initialisers run).\n (_b = (_a = this._moduleRegistry) === null || _a === void 0 ? void 0 : _a.services.floatingGroupService) === null || _b === void 0 ? void 0 : _b.constrainBounds();\n }\n _syncFloatingOverlayHost() {\n if (!this._floatingOverlayHost || !this._shellManager) {\n return;\n }\n const shellRect = this._shellManager.element.getBoundingClientRect();\n const gridRect = this.element.getBoundingClientRect();\n const host = this._floatingOverlayHost;\n host.style.left = `${gridRect.left - shellRect.left}px`;\n host.style.top = `${gridRect.top - shellRect.top}px`;\n host.style.width = `${gridRect.width}px`;\n host.style.height = `${gridRect.height}px`;\n }\n _layoutFromShell(width, height) {\n this._inShellLayout = true;\n this.layout(width, height, true);\n this._inShellLayout = false;\n }\n forceRelayout() {\n if (this._shellManager) {\n this._layoutFromShell(this.width, this.height);\n }\n else {\n super.forceRelayout();\n }\n }\n addEdgeGroup(position, options) {\n const service = assertModule(this._edgeGroupService, 'EdgeGroup', 'api.addEdgeGroup');\n if (!service) {\n throw new Error(`dockview: EdgeGroup module is not registered`);\n }\n if (service.has(position)) {\n throw new Error(`dockview: edge group already exists at position '${position}'`);\n }\n return this.mutation('add', () => {\n const group = this.createGroup({ id: options.id });\n group.model.location = { type: 'edge', position };\n group.model.headerPosition = position;\n // Collapse when the group becomes empty\n const autoCollapseDisposable = group.model.onDidRemovePanel(() => {\n if (group.model.isEmpty) {\n this.setEdgeGroupCollapsed(group, true);\n }\n });\n service.add(position, group, autoCollapseDisposable);\n this._onDidAddGroup.fire(group);\n this._shellManager.addEdgeView(position, options, group);\n return group.api;\n });\n }\n getEdgeGroup(position) {\n var _a, _b;\n return (_b = (_a = this._edgeGroupService) === null || _a === void 0 ? void 0 : _a.get(position)) === null || _b === void 0 ? void 0 : _b.api;\n }\n setEdgeGroupVisible(position, visible) {\n this._shellManager.setEdgeGroupVisible(position, visible);\n }\n isEdgeGroupVisible(position) {\n return this._shellManager.isEdgeGroupVisible(position);\n }\n removeEdgeGroup(position) {\n const service = assertModule(this._edgeGroupService, 'EdgeGroup', 'api.removeEdgeGroup');\n if (!service) {\n return;\n }\n const group = service.get(position);\n if (!group) {\n throw new Error(`dockview: no edge group exists at position '${position}'`);\n }\n // One transaction — the per-panel removals below nest via the depth\n // counter, so consumers see a single edge-group removal.\n this.mutation('remove', () => {\n // Remove panels inside the group first\n for (const panel of [...group.panels]) {\n this.removePanel(panel, {\n removeEmptyGroup: false,\n skipDispose: false,\n });\n }\n // Remove from the shell splitview\n this._shellManager.removeEdgeView(position);\n // Clean up service-tracked state + group itself\n service.remove(position);\n group.dispose();\n this._groups.delete(group.id);\n this._onDidRemoveGroup.fire(group);\n });\n }\n setEdgeGroupCollapsed(group, collapsed) {\n var _a;\n const position = (_a = this._edgeGroupService) === null || _a === void 0 ? void 0 : _a.findPositionOf(group);\n if (!position) {\n return;\n }\n if (this._shellManager.isEdgeGroupCollapsed(position) === collapsed) {\n // Skip the splitview resize on a no-op: with non-zero theme gap,\n // redundant resizeView calls accumulate rounding drift that\n // gradually shrinks the group.\n return;\n }\n this._shellManager.setEdgeGroupCollapsed(position, collapsed);\n group.api._onDidCollapsedChange.fire({ isCollapsed: collapsed });\n }\n isEdgeGroupCollapsed(group) {\n var _a;\n const position = (_a = this._edgeGroupService) === null || _a === void 0 ? void 0 : _a.findPositionOf(group);\n return position\n ? this._shellManager.isEdgeGroupCollapsed(position)\n : false;\n }\n updateDragAndDropState() {\n // Update draggable state for all tabs and void containers\n for (const group of this.groups) {\n group.model.updateDragAndDropState();\n }\n }\n focus() {\n var _a;\n (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();\n }\n getGroupPanel(id) {\n return this.panels.find((panel) => panel.id === id);\n }\n setActivePanel(panel) {\n panel.group.model.openPanel(panel);\n this.doSetGroupAndPanelActive(panel.group);\n }\n moveToNext(options = {}) {\n var _a;\n if (!options.group) {\n if (!this.activeGroup) {\n return;\n }\n options.group = this.activeGroup;\n }\n if (options.includePanel && options.group) {\n if (options.group.activePanel !==\n options.group.panels[options.group.panels.length - 1]) {\n options.group.model.moveToNext({ suppressRoll: true });\n return;\n }\n }\n const location = getGridLocation(options.group.element);\n const next = (_a = this.gridview.next(location)) === null || _a === void 0 ? void 0 : _a.view;\n this.doSetGroupAndPanelActive(next);\n }\n moveToPrevious(options = {}) {\n var _a;\n if (!options.group) {\n if (!this.activeGroup) {\n return;\n }\n options.group = this.activeGroup;\n }\n if (options.includePanel && options.group) {\n if (options.group.activePanel !== options.group.panels[0]) {\n options.group.model.moveToPrevious({ suppressRoll: true });\n return;\n }\n }\n const location = getGridLocation(options.group.element);\n const next = (_a = this.gridview.previous(location)) === null || _a === void 0 ? void 0 : _a.view;\n if (next) {\n this.doSetGroupAndPanelActive(next);\n }\n }\n /**\n * Serialize the current state of the layout\n *\n * @returns A JSON respresentation of the layout\n */\n toJSON() {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n const data = this.gridview.serialize();\n const panels = this.panels.reduce((collection, panel) => {\n collection[panel.id] = panel.toJSON();\n return collection;\n }, {});\n const floats = (_b = (_a = this._floatingGroupService) === null || _a === void 0 ? void 0 : _a.serialize()) !== null && _b !== void 0 ? _b : [];\n const popoutGroups = (_d = (_c = this._popoutWindowService) === null || _c === void 0 ? void 0 : _c.serialize()) !== null && _d !== void 0 ? _d : [];\n const result = {\n grid: data,\n panels,\n activeGroup: (_e = this.activeGroup) === null || _e === void 0 ? void 0 : _e.id,\n };\n if (floats.length > 0) {\n result.floatingGroups = floats;\n }\n if (popoutGroups.length > 0) {\n result.popoutGroups = popoutGroups;\n }\n const edgeEntries = (_g = (_f = this._edgeGroupService) === null || _f === void 0 ? void 0 : _f.entries()) !== null && _g !== void 0 ? _g : [];\n if ((_h = this._edgeGroupService) === null || _h === void 0 ? void 0 : _h.hasAny()) {\n const shellSerialized = this._shellManager.toJSON();\n // Augment each entry with the serialized group state\n for (const [position, group] of edgeEntries) {\n const entry = shellSerialized[position];\n if (entry) {\n entry.group = group.toJSON();\n }\n }\n result.edgeGroups = shellSerialized;\n }\n return result;\n }\n fromJSON(data, options) {\n // One 'load' transaction for the whole deserialization — the many\n // nested add/remove mutations join it via the depth counter.\n this.mutation('load', () => this._doFromJSON(data, options));\n }\n _doFromJSON(data, options) {\n var _a, _b, _c, _d, _e, _f, _g;\n // Cancel any popout-restoration timers queued by a previous fromJSON\n // that haven't fired yet. The cancel path also disposes orphan groups\n // registered in _groups synchronously but never parented into a popout\n // window — otherwise the upcoming clear() would call gridview.remove()\n // on an unparented element and throw \"Invalid grid element\". See\n // issue #1304.\n (_a = this._popoutWindowService) === null || _a === void 0 ? void 0 : _a.cancelPendingRestorations();\n const existingPanels = new Map();\n let tempGroup;\n if (options === null || options === void 0 ? void 0 : options.reuseExistingPanels) {\n /**\n * What are we doing here?\n *\n * 1. Create a temporary group to hold any panels that currently exist and that also exist in the new layout\n * 2. Remove that temporary group from the group mapping so that it doesn't get cleared when we clear the layout\n */\n tempGroup = this.createGroup();\n this._groups.delete(tempGroup.api.id);\n const newPanels = Object.keys(data.panels);\n for (const panel of this.panels) {\n if (newPanels.includes(panel.api.id)) {\n existingPanels.set(panel.api.id, panel);\n }\n }\n this.movingLock(() => {\n Array.from(existingPanels.values()).forEach((panel) => {\n this.moveGroupOrPanel({\n from: {\n groupId: panel.api.group.api.id,\n panelId: panel.api.id,\n },\n to: {\n group: tempGroup,\n position: 'center',\n },\n keepEmptyGroups: true,\n });\n });\n });\n }\n this.clear();\n if (typeof data !== 'object' || data === null) {\n throw new Error('dockview: serialized layout must be a non-null object');\n }\n const { grid, panels, activeGroup } = data;\n if (grid.root.type !== 'branch' || !Array.isArray(grid.root.data)) {\n throw new Error('dockview: root must be of type branch');\n }\n try {\n // take note of the existing dimensions\n const width = this.width;\n const height = this.height;\n const createGroupFromSerializedState = (data) => {\n const { id, locked, hideHeader, headerPosition, views, activeView, } = data;\n if (typeof id !== 'string') {\n throw new Error('dockview: group id must be of type string');\n }\n const group = this.createGroup({\n id,\n locked: !!locked,\n hideHeader: !!hideHeader,\n headerPosition,\n });\n this._onDidAddGroup.fire(group);\n const createdPanels = [];\n for (const child of views) {\n /**\n * Run the deserializer step seperately since this may fail to due corrupted external state.\n * In running this section first we avoid firing lots of 'add' events in the event of a failure\n * due to a corruption of input data.\n */\n const existingPanel = existingPanels.get(child);\n if (tempGroup && existingPanel) {\n this.movingLock(() => {\n tempGroup.model.removePanel(existingPanel);\n });\n createdPanels.push(existingPanel);\n existingPanel.updateFromStateModel(panels[child]);\n }\n else {\n const panel = this._deserializer.fromJSON(panels[child], group);\n createdPanels.push(panel);\n }\n }\n for (let i = 0; i < views.length; i++) {\n const panel = createdPanels[i];\n const isActive = typeof activeView === 'string' &&\n activeView === panel.id;\n const hasExisting = existingPanels.has(panel.api.id);\n if (hasExisting) {\n this.movingLock(() => {\n group.model.openPanel(panel, {\n skipSetActive: !isActive,\n skipSetGroupActive: true,\n });\n });\n }\n else {\n group.model.openPanel(panel, {\n skipSetActive: !isActive,\n skipSetGroupActive: true,\n });\n }\n }\n // Restore tab groups before activating a fallback panel so\n // that collapsed groups can clear the active panel correctly.\n if (data.tabGroups && data.tabGroups.length > 0) {\n group.model.restoreTabGroups(data.tabGroups);\n }\n if (!group.activePanel && group.panels.length > 0) {\n group.model.openPanel(group.panels[group.panels.length - 1], {\n skipSetGroupActive: true,\n });\n }\n return group;\n };\n this.gridview.deserialize(grid, {\n fromJSON: (node) => {\n return createGroupFromSerializedState(node.data);\n },\n });\n this._layoutFromShell(width, height);\n if (data.edgeGroups) {\n this.deserializeEdgeGroups(data.edgeGroups, panels);\n }\n this.deserializeFloatingWindows((_b = data.floatingGroups) !== null && _b !== void 0 ? _b : [], createGroupFromSerializedState);\n const popoutPromises = this.deserializePopoutWindows((_c = data.popoutGroups) !== null && _c !== void 0 ? _c : [], createGroupFromSerializedState);\n (_d = this._popoutWindowService) === null || _d === void 0 ? void 0 : _d.finishRestoration(popoutPromises);\n (_e = this._floatingGroupService) === null || _e === void 0 ? void 0 : _e.constrainBounds();\n if (typeof activeGroup === 'string') {\n const panel = this.getPanel(activeGroup);\n if (panel) {\n this.doSetGroupAndPanelActive(panel);\n }\n }\n // `gridview.deserialize()` rebuilds the grid without firing the\n // BaseGrid add events the watermark module reacts to, so the\n // watermark mounted during `clear()` would otherwise persist over\n // the restored layout. Re-evaluate now the layout is in place.\n (_f = this._watermarkService) === null || _f === void 0 ? void 0 : _f.update();\n }\n catch (err) {\n console.error('dockview: failed to deserialize layout. Reverting changes', err);\n /**\n * Takes all the successfully created groups and remove all of their panels.\n */\n for (const group of this.groups) {\n for (const panel of group.panels) {\n this.removePanel(panel, {\n removeEmptyGroup: false,\n skipDispose: false,\n });\n }\n }\n /**\n * To remove a group we cannot call this.removeGroup(...) since this makes assumptions about\n * the underlying HTMLElement existing in the Gridview.\n */\n for (const group of this.groups) {\n group.dispose();\n this._groups.delete(group.id);\n this._onDidRemoveGroup.fire(group);\n }\n (_g = this._floatingGroupService) === null || _g === void 0 ? void 0 : _g.disposeAll();\n // fires clean-up events and clears the underlying HTML gridview.\n this.clear();\n /**\n * even though we have cleaned-up we still want to inform the caller of their error\n * and we'll do this through re-throwing the original error since afterall you would\n * expect trying to load a corrupted layout to result in an error and not silently fail...\n */\n throw err;\n }\n // Force position updates for always visible panels after DOM layout is complete\n this.debouncedUpdateAllPositions();\n this._onDidLayoutFromJSON.fire();\n }\n /**\n * Rebuild a floating / popout window's nested gridview from its serialized\n * tree, collecting the member groups (in deserialization order) so the\n * caller can mount or restore the window.\n */\n deserializeNestedGridview(grid, createGroup) {\n const gridview = this.createNestedGridview(grid.orientation);\n const members = [];\n gridview.deserialize(grid, {\n fromJSON: (node) => {\n const group = createGroup(node.data);\n members.push(group);\n return group;\n },\n });\n return { gridview, members };\n }\n deserializeEdgeGroups(edgeGroups, panels) {\n var _a;\n const edgeService = assertModule(this._edgeGroupService, 'EdgeGroup', 'fromJSON edge restoration');\n if (!edgeService) {\n return;\n }\n // Auto-create edge groups for positions in the serialized state that\n // don't already have a group registered (e.g. when fromJSON is called\n // before the user has called addEdgeGroup).\n for (const _position of [\n 'top',\n 'bottom',\n 'left',\n 'right',\n ]) {\n const fixedData = edgeGroups[_position];\n if (fixedData && !edgeService.has(_position)) {\n const groupState = fixedData.group;\n const id = (_a = groupState === null || groupState === void 0 ? void 0 : groupState.id) !== null && _a !== void 0 ? _a : `${_position}-group`;\n this.addEdgeGroup(_position, { id });\n }\n }\n // Restore panel contents of edge groups\n for (const [position, edgeGroup] of edgeService.entries()) {\n const edgeData = edgeGroups[position];\n const groupState = edgeData === null || edgeData === void 0 ? void 0 : edgeData.group;\n if (groupState) {\n const { views, activeView } = groupState;\n const createdPanels = [];\n for (const panelId of views) {\n if (panels[panelId]) {\n const panel = this._deserializer.fromJSON(panels[panelId], edgeGroup);\n createdPanels.push(panel);\n }\n }\n for (let i = 0; i < createdPanels.length; i++) {\n const panel = createdPanels[i];\n const isActive = activeView === panel.id;\n edgeGroup.model.openPanel(panel, {\n skipSetActive: !isActive,\n skipSetGroupActive: true,\n });\n }\n // Restore tab groups before activating a fallback panel\n if (groupState.tabGroups && groupState.tabGroups.length > 0) {\n edgeGroup.model.restoreTabGroups(groupState.tabGroups);\n }\n if (!edgeGroup.activePanel && edgeGroup.panels.length > 0) {\n edgeGroup.model.openPanel(edgeGroup.panels[edgeGroup.panels.length - 1], { skipSetGroupActive: true });\n }\n }\n }\n this._shellManager.fromJSON(edgeGroups);\n }\n deserializeFloatingWindows(serialized, createGroup) {\n for (const serializedFloatingGroup of serialized) {\n const { data, grid, position } = serializedFloatingGroup;\n if (grid) {\n // Multi-group window: rebuild the window's nested gridview from\n // its serialized tree.\n const { gridview: floatingGridview, members } = this.deserializeNestedGridview(grid, createGroup);\n if (members.length === 0) {\n continue;\n }\n this.mountFloatingWindow(floatingGridview, members[0], members, position, { inDragMode: false });\n }\n else if (data) {\n const group = createGroup(data);\n this.addFloatingGroup(group, {\n position: position,\n width: position.width,\n height: position.height,\n skipRemoveGroup: true,\n inDragMode: false,\n });\n }\n }\n }\n deserializePopoutWindows(serialized, createGroup) {\n const popoutService = serialized.length > 0\n ? assertModule(this._popoutWindowService, 'PopoutWindow', 'fromJSON popout restoration')\n : this._popoutWindowService;\n if (!popoutService) {\n return [];\n }\n // Queue popup group creation with delays to avoid browser blocking\n return serialized.flatMap((serializedPopoutGroup, index) => {\n const { data, grid, position, gridReferenceGroup, url } = serializedPopoutGroup;\n // Multi-group popout windows rebuild their nested gridview from the\n // serialized tree; single-group windows use the legacy single-group\n // path.\n let overridePopoutGridview;\n let members = [];\n if (grid) {\n const built = this.deserializeNestedGridview(grid, createGroup);\n overridePopoutGridview = built.gridview;\n members = built.members;\n if (members.length === 0) {\n // A serialized window with no groups: nothing to restore.\n // Mirror the floating path's guard and discard the empty\n // gridview rather than passing an undefined anchor to\n // addPopoutGroup.\n overridePopoutGridview.dispose();\n return [];\n }\n }\n const group = grid ? members[0] : createGroup(data);\n return popoutService.scheduleRestoration(index * DESERIALIZATION_POPOUT_DELAY_MS, () => {\n this.addPopoutGroup(group, {\n position: position !== null && position !== void 0 ? position : undefined,\n overridePopoutGroup: gridReferenceGroup\n ? group\n : undefined,\n overridePopoutGridview,\n referenceGroup: gridReferenceGroup\n ? this.getPanel(gridReferenceGroup)\n : undefined,\n popoutUrl: url,\n });\n }, () => {\n // The group was registered in _groups synchronously but the\n // timer that would parent it into the popout window never\n // ran. Dispose the orphan here so the next clear() doesn't\n // trip over an unparented element. See issue #1304.\n for (const orphan of members.length > 0\n ? members\n : [group]) {\n if (!this.isDisposed &&\n this._groups.has(orphan.id) &&\n orphan.element.parentElement === null) {\n for (const panel of [...orphan.panels]) {\n this.removePanel(panel, {\n removeEmptyGroup: false,\n });\n }\n orphan.dispose();\n this._groups.delete(orphan.id);\n this._onDidRemoveGroup.fire(orphan);\n }\n }\n });\n });\n }\n clear() {\n this.mutation('clear', () => this._doClear());\n }\n _doClear() {\n var _a;\n const groups = Array.from(this._groups.values()).map((_) => _.value);\n const hasActiveGroup = !!this.activeGroup;\n for (const group of groups) {\n if ((_a = this._edgeGroupService) === null || _a === void 0 ? void 0 : _a.includes(group)) {\n // Edge groups are structural - only clear their panels, not the group itself\n const panels = [...group.panels];\n for (const panel of panels) {\n this.removePanel(panel, { removeEmptyGroup: false });\n }\n continue;\n }\n // remove the group will automatically remove the panels\n this.removeGroup(group, { skipActive: true });\n }\n if (hasActiveGroup) {\n this.doSetGroupAndPanelActive(undefined);\n }\n this.gridview.clear();\n }\n closeAllGroups() {\n // One transaction — the per-panel removals inside nest via the depth\n // counter, so consumers (undo, announcements) see a single mutation.\n this.mutation('remove', () => {\n for (const entry of this._groups.entries()) {\n const [_, group] = entry;\n group.value.model.closeAllPanels();\n }\n });\n }\n addPanel(options) {\n return this.mutation('add', () => this._doAddPanel(options));\n }\n _doAddPanel(options) {\n var _a, _b;\n if (this.panels.find((_) => _.id === options.id)) {\n throw new Error(`dockview: panel with id ${options.id} already exists`);\n }\n let referenceGroup;\n if (options.position && options.floating) {\n throw new Error('dockview: you can only provide one of: position, floating as arguments to .addPanel(...)');\n }\n const initial = {\n width: options.initialWidth,\n height: options.initialHeight,\n };\n let index;\n if (options.position) {\n if (isPanelOptionsWithPanel(options.position)) {\n const referencePanel = typeof options.position.referencePanel === 'string'\n ? this.getGroupPanel(options.position.referencePanel)\n : options.position.referencePanel;\n index = options.position.index;\n if (!referencePanel) {\n throw new Error(`dockview: referencePanel '${options.position.referencePanel}' does not exist`);\n }\n referenceGroup = this.findGroup(referencePanel);\n }\n else if (isPanelOptionsWithGroup(options.position)) {\n referenceGroup =\n typeof options.position.referenceGroup === 'string'\n ? (_a = this._groups.get(options.position.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value\n : options.position.referenceGroup;\n index = options.position.index;\n if (!referenceGroup) {\n throw new Error(`dockview: referenceGroup '${options.position.referenceGroup}' does not exist`);\n }\n }\n else {\n const group = this.orthogonalize(directionToPosition(options.position.direction));\n const panel = this.createPanel(options, group);\n group.model.openPanel(panel, {\n skipSetActive: options.inactive,\n skipSetGroupActive: options.inactive,\n index,\n });\n if (!options.inactive) {\n this.doSetGroupAndPanelActive(group);\n }\n group.api.setSize({\n height: initial === null || initial === void 0 ? void 0 : initial.height,\n width: initial === null || initial === void 0 ? void 0 : initial.width,\n });\n return panel;\n }\n }\n else {\n referenceGroup = this.activeGroup;\n }\n let panel;\n if (referenceGroup) {\n const target = toTarget(((_b = options.position) === null || _b === void 0 ? void 0 : _b.direction) || 'within');\n if (options.floating) {\n const group = this.createGroup();\n this._onDidAddGroup.fire(group);\n const floatingGroupOptions = typeof options.floating === 'object' &&\n options.floating !== null\n ? options.floating\n : {};\n this.addFloatingGroup(group, Object.assign(Object.assign({}, floatingGroupOptions), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));\n panel = this.createPanel(options, group);\n group.model.openPanel(panel, {\n skipSetActive: options.inactive,\n skipSetGroupActive: options.inactive,\n index,\n });\n }\n else if (referenceGroup.api.location.type === 'floating' ||\n referenceGroup.api.location.type === 'edge' ||\n target === 'center') {\n panel = this.createPanel(options, referenceGroup);\n referenceGroup.model.openPanel(panel, {\n skipSetActive: options.inactive,\n skipSetGroupActive: options.inactive,\n index,\n });\n referenceGroup.api.setSize({\n width: initial === null || initial === void 0 ? void 0 : initial.width,\n height: initial === null || initial === void 0 ? void 0 : initial.height,\n });\n if (!options.inactive) {\n this.doSetGroupAndPanelActive(referenceGroup);\n }\n }\n else {\n const location = getGridLocation(referenceGroup.element);\n const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);\n const group = this.createGroupAtLocation(relativeLocation, this.orientationAtLocation(relativeLocation) ===\n Orientation.VERTICAL\n ? initial === null || initial === void 0 ? void 0 : initial.height\n : initial === null || initial === void 0 ? void 0 : initial.width);\n panel = this.createPanel(options, group);\n group.model.openPanel(panel, {\n skipSetActive: options.inactive,\n skipSetGroupActive: options.inactive,\n index,\n });\n if (!options.inactive) {\n this.doSetGroupAndPanelActive(group);\n }\n }\n }\n else if (options.floating) {\n const group = this.createGroup();\n this._onDidAddGroup.fire(group);\n const coordinates = typeof options.floating === 'object' &&\n options.floating !== null\n ? options.floating\n : {};\n this.addFloatingGroup(group, Object.assign(Object.assign({}, coordinates), { inDragMode: false, skipRemoveGroup: true, skipActiveGroup: true }));\n panel = this.createPanel(options, group);\n group.model.openPanel(panel, {\n skipSetActive: options.inactive,\n skipSetGroupActive: options.inactive,\n index,\n });\n }\n else {\n const group = this.createGroupAtLocation([0], this.gridview.orientation === Orientation.VERTICAL\n ? initial === null || initial === void 0 ? void 0 : initial.height\n : initial === null || initial === void 0 ? void 0 : initial.width);\n panel = this.createPanel(options, group);\n group.model.openPanel(panel, {\n skipSetActive: options.inactive,\n skipSetGroupActive: options.inactive,\n index,\n });\n if (!options.inactive) {\n this.doSetGroupAndPanelActive(group);\n }\n }\n return panel;\n }\n removePanel(panel, options = {\n removeEmptyGroup: true,\n }) {\n this.mutation('remove', () => this._doRemovePanel(panel, options));\n }\n _doRemovePanel(panel, options = {\n removeEmptyGroup: true,\n }) {\n const group = panel.group;\n if (!group) {\n throw new Error(`dockview: cannot remove panel ${panel.id}. it's missing a group.`);\n }\n group.model.removePanel(panel, {\n skipSetActiveGroup: options.skipSetActiveGroup,\n });\n if (!options.skipDispose) {\n panel.group.model.renderContainer.detatch(panel);\n panel.dispose();\n }\n if (group.size === 0 && options.removeEmptyGroup) {\n this.removeGroup(group, { skipActive: options.skipSetActiveGroup });\n }\n }\n createWatermarkComponent() {\n if (this.options.createWatermarkComponent) {\n return this.options.createWatermarkComponent();\n }\n return new Watermark();\n }\n addGroup(options) {\n return this.mutation('add', () => this._doAddGroup(options));\n }\n _doAddGroup(options) {\n var _a;\n if (options) {\n let referenceGroup;\n if (isGroupOptionsWithPanel(options)) {\n const referencePanel = typeof options.referencePanel === 'string'\n ? this.panels.find((panel) => panel.id === options.referencePanel)\n : options.referencePanel;\n if (!referencePanel) {\n throw new Error(`dockview: reference panel ${options.referencePanel} does not exist`);\n }\n referenceGroup = this.findGroup(referencePanel);\n if (!referenceGroup) {\n throw new Error(`dockview: reference group for reference panel ${options.referencePanel} does not exist`);\n }\n }\n else if (isGroupOptionsWithGroup(options)) {\n referenceGroup =\n typeof options.referenceGroup === 'string'\n ? (_a = this._groups.get(options.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value\n : options.referenceGroup;\n if (!referenceGroup) {\n throw new Error(`dockview: reference group ${options.referenceGroup} does not exist`);\n }\n }\n else {\n const group = this.orthogonalize(directionToPosition(options.direction), options);\n if (!options.skipSetActive) {\n this.doSetGroupAndPanelActive(group);\n }\n return group;\n }\n const target = toTarget(options.direction || 'within');\n const location = getGridLocation(referenceGroup.element);\n const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);\n const group = this.createGroup(options);\n const size = this.getLocationOrientation(relativeLocation) ===\n Orientation.VERTICAL\n ? options.initialHeight\n : options.initialWidth;\n this.doAddGroup(group, relativeLocation, size);\n if (!options.skipSetActive) {\n this.doSetGroupAndPanelActive(group);\n }\n return group;\n }\n else {\n const group = this.createGroup(options);\n this.doAddGroup(group);\n this.doSetGroupAndPanelActive(group);\n return group;\n }\n }\n getLocationOrientation(location) {\n return location.length % 2 == 0 &&\n this.gridview.orientation === Orientation.HORIZONTAL\n ? Orientation.HORIZONTAL\n : Orientation.VERTICAL;\n }\n removeGroup(group, options) {\n this.mutation('remove', () => this.doRemoveGroup(group, options));\n }\n /**\n * Detach a single group from the nested gridview of its floating / popout\n * window, keeping the window and its remaining members alive, and reassign\n * the window's anchor if the detached group was it.\n *\n * @returns `true` if the group was detached from a multi-member window;\n * `false` if `group` is not in a nested window, or is the window's only\n * member — in which case the caller is responsible for disposing the whole\n * window.\n */\n detachFromNestedWindow(group) {\n var _a, _b;\n const floating = (_a = this._floatingGroupService) === null || _a === void 0 ? void 0 : _a.findByGroup(group);\n if (floating) {\n const members = this.nestedWindowMembers(group);\n if (members.length <= 1) {\n return false;\n }\n floating.gridview.remove(group);\n if (floating.group === group) {\n // The anchor left; promote a remaining member.\n floating.setAnchorGroup(members.find((m) => m !== group));\n }\n return true;\n }\n const popout = (_b = this._popoutWindowService) === null || _b === void 0 ? void 0 : _b.findByGroup(group);\n if (popout) {\n const members = this.nestedWindowMembers(group);\n if (members.length <= 1) {\n return false;\n }\n popout.gridview.remove(group);\n if (popout.popoutGroup === group) {\n // The anchor left; promote a remaining member.\n popout.popoutGroup = members.find((m) => m !== group);\n }\n return true;\n }\n return false;\n }\n /**\n * Dispose a group and forget it: remove it from `_groups` and fire the\n * removed event.\n */\n disposeGroupRecord(group) {\n group.dispose();\n this._groups.delete(group.id);\n this._onDidRemoveGroup.fire(group);\n }\n /**\n * When `removed` was the active group, fall the active selection back to\n * the first remaining group (or clear it when none remain).\n */\n activateFallbackGroupIfRemoved(removed, skipActive) {\n if (!skipActive && this._activeGroup === removed) {\n const groups = Array.from(this._groups.values());\n this.doSetGroupAndPanelActive(groups.length > 0 ? groups[0].value : undefined);\n }\n }\n doRemoveGroup(group, options) {\n var _a, _b, _c, _d, _e;\n // Edge groups are permanent structural elements - never remove them from the layout\n if ((_a = this._edgeGroupService) === null || _a === void 0 ? void 0 : _a.includes(group)) {\n return group;\n }\n const panels = [...group.panels]; // reassign since group panels will mutate\n if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {\n for (const panel of panels) {\n this.removePanel(panel, {\n removeEmptyGroup: false,\n skipDispose: (_b = options === null || options === void 0 ? void 0 : options.skipDispose) !== null && _b !== void 0 ? _b : false,\n });\n }\n }\n const activePanel = this.activePanel;\n if (group.api.location.type === 'floating') {\n const floatingGroup = (_c = this._floatingGroupService) === null || _c === void 0 ? void 0 : _c.findByGroup(group);\n if (!floatingGroup) {\n throw new Error('dockview: failed to find floating group');\n }\n if (this.detachFromNestedWindow(group)) {\n // The floating window hosts other groups and stays alive —\n // finalize just this group.\n if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {\n this.disposeGroupRecord(group);\n }\n else {\n // Relocation: reset location so the destination root can\n // re-tag it.\n group.model.location = { type: 'grid' };\n }\n this.activateFallbackGroupIfRemoved(group, options === null || options === void 0 ? void 0 : options.skipActive);\n return group;\n }\n // Last group leaving — dispose the whole floating window.\n if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {\n this.disposeGroupRecord(group);\n }\n // floatingGroup.dispose() removes itself from the service array\n floatingGroup.dispose();\n this.activateFallbackGroupIfRemoved(group, options === null || options === void 0 ? void 0 : options.skipActive);\n return group;\n }\n if (group.api.location.type === 'popout') {\n const selectedGroup = (_d = this._popoutWindowService) === null || _d === void 0 ? void 0 : _d.findByGroup(group);\n if (!selectedGroup) {\n throw new Error('dockview: failed to find popout group');\n }\n if (this.detachFromNestedWindow(group)) {\n // The popout window hosts other groups and stays alive —\n // finalize just this group.\n if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {\n this.disposeGroupRecord(group);\n }\n else {\n // Relocation: reset location so the destination root can\n // re-tag it.\n group.model.location = { type: 'grid' };\n }\n this.activateFallbackGroupIfRemoved(group, options === null || options === void 0 ? void 0 : options.skipActive);\n return group;\n }\n // Last group leaving — tear the whole popout window down.\n if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {\n if (!(options === null || options === void 0 ? void 0 : options.skipPopoutAssociated)) {\n const refGroup = selectedGroup.referenceGroup\n ? this.getPanel(selectedGroup.referenceGroup)\n : undefined;\n if (refGroup && refGroup.panels.length === 0) {\n this.removeGroup(refGroup);\n }\n }\n selectedGroup.popoutGroup.dispose();\n this._groups.delete(group.id);\n this._onDidRemoveGroup.fire(group);\n }\n (_e = this._popoutWindowService) === null || _e === void 0 ? void 0 : _e.remove(selectedGroup);\n const removedGroup = selectedGroup.disposable.dispose();\n if (!(options === null || options === void 0 ? void 0 : options.skipPopoutReturn) && removedGroup) {\n this.doAddGroup(removedGroup, [0]);\n this.doSetGroupAndPanelActive(removedGroup);\n }\n this.activateFallbackGroupIfRemoved(group, options === null || options === void 0 ? void 0 : options.skipActive);\n return selectedGroup.popoutGroup;\n }\n // A `grid`-location group whose element isn't actually in the gridview\n // is an orphan — e.g. a popout-destined group created during fromJSON\n // whose window hasn't opened yet, swept up by clear()/a re-entrant\n // fromJSON. `gridview.remove()` would throw \"Invalid grid element\", so\n // dispose it directly.\n if (!this.gridview.element.contains(group.element)) {\n if (!(options === null || options === void 0 ? void 0 : options.skipDispose)) {\n const item = this._groups.get(group.id);\n item === null || item === void 0 ? void 0 : item.disposable.dispose();\n this.disposeGroupRecord(group);\n }\n this.activateFallbackGroupIfRemoved(group, options === null || options === void 0 ? void 0 : options.skipActive);\n return group;\n }\n const re = super.doRemoveGroup(group, options);\n if (!(options === null || options === void 0 ? void 0 : options.skipActive)) {\n if (this.activePanel !== activePanel) {\n this.fireActivePanelChange(this.activePanel);\n }\n }\n return re;\n }\n debouncedUpdateAllPositions() {\n if (this._updatePositionsFrameId !== undefined) {\n cancelAnimationFrame(this._updatePositionsFrameId);\n }\n this._updatePositionsFrameId = requestAnimationFrame(() => {\n var _a, _b;\n this._updatePositionsFrameId = undefined;\n this.overlayRenderContainer.updateAllPositions();\n // Popout windows have their own render containers; reposition those\n // too so panels moved/split within a popout are laid out (the main\n // container only covers grid + floating, which share it).\n for (const entry of (_b = (_a = this._popoutWindowService) === null || _a === void 0 ? void 0 : _a.entries) !== null && _b !== void 0 ? _b : []) {\n entry.overlayRenderContainer.updateAllPositions();\n }\n });\n }\n movingLock(func) {\n const isMoving = this._moving;\n try {\n this._moving = true;\n return func();\n }\n finally {\n this._moving = isMoving;\n }\n }\n /**\n * Bracket a structural mutation with `onWillMutateLayout` /\n * `onDidMutateLayout`. Re-entrant: nested calls (a compound operation such\n * as a drag that relocates a panel) join the outermost transaction, so the\n * events fire exactly once around the whole operation. `kind` reflects the\n * outermost mutation.\n */\n mutation(kind, func) {\n const outer = this._mutationDepth === 0;\n const origin = this._origin;\n if (outer) {\n this._onWillMutateLayout.fire({ kind, origin });\n }\n this._mutationDepth++;\n try {\n return func();\n }\n finally {\n this._mutationDepth--;\n if (outer) {\n this._onDidMutateLayout.fire({ kind, origin });\n }\n }\n }\n /**\n * The origin of the operation currently in progress (`'user'` by default).\n * Read inside a `mutation()` or active-panel change to learn whether the\n * change was driven by application code (via the {@link DockviewApi}) or a\n * user gesture.\n */\n currentOrigin() {\n return this._origin;\n }\n /**\n * Run `func` with the operation origin set to `origin`, restoring the\n * previous value afterwards. Used by the DockviewApi boundary to tag\n * programmatic operations as `'api'`, and by user-gesture handlers to tag\n * `'user'`. Only the outermost caller sets the origin — a nested call (or a\n * call made while a mutation is already in flight) keeps whatever the\n * enclosing operation established, so the trigger always wins.\n */\n withOrigin(origin, func) {\n if (this._originDepth > 0 || this._mutationDepth > 0) {\n return func();\n }\n const previous = this._origin;\n this._origin = origin;\n this._originDepth++;\n try {\n return func();\n }\n finally {\n this._originDepth--;\n this._origin = previous;\n }\n }\n /**\n * Fire `onDidActivePanelChange` with the panel and the current operation\n * {@link DockviewOrigin}. Callers keep their own dedupe guards.\n */\n fireActivePanelChange(panel) {\n this._onDidActivePanelChange.fire({ panel, origin: this._origin });\n }\n moveGroupOrPanel(options) {\n this.mutation('move', () => this._doMoveGroupOrPanel(options));\n }\n _doMoveGroupOrPanel(options) {\n var _a, _b;\n const destinationGroup = options.to.group;\n const sourceGroupId = options.from.groupId;\n const sourceItemId = options.from.panelId;\n const destinationTarget = options.to.position;\n const destinationIndex = options.to.index;\n const sourceGroup = sourceGroupId\n ? (_a = this._groups.get(sourceGroupId)) === null || _a === void 0 ? void 0 : _a.value\n : undefined;\n if (!sourceGroup) {\n throw new Error(`dockview: Failed to find group id ${sourceGroupId}`);\n }\n if (sourceItemId === undefined) {\n if (options.from.tabGroupId) {\n /**\n * Moving a tab group (subset of panels) into another group\n */\n this.moveTabGroupToGroup({\n sourceGroup,\n tabGroupId: options.from.tabGroupId,\n destinationGroup,\n destinationTarget,\n destinationIndex,\n skipSetActive: options.skipSetActive,\n keepEmptyGroups: options.keepEmptyGroups,\n });\n }\n else {\n /**\n * Moving an entire group into another group\n */\n this.moveGroup({\n from: { group: sourceGroup },\n to: {\n group: destinationGroup,\n position: destinationTarget,\n },\n skipSetActive: options.skipSetActive,\n });\n }\n return;\n }\n if (!destinationTarget || destinationTarget === 'center') {\n /**\n * Dropping a panel within another group\n */\n const removedPanel = this.movingLock(() => sourceGroup.model.removePanel(sourceItemId, {\n skipSetActive: false,\n skipSetActiveGroup: true,\n }));\n if (!removedPanel) {\n throw new Error(`dockview: No panel with id ${sourceItemId}`);\n }\n if (!options.keepEmptyGroups && sourceGroup.model.size === 0) {\n // remove the group and do not set a new group as active\n this.doRemoveGroup(sourceGroup, { skipActive: true });\n }\n // Check if destination group is empty - if so, force render the component\n const isDestinationGroupEmpty = destinationGroup.model.size === 0;\n this.movingLock(() => {\n var _a;\n return destinationGroup.model.openPanel(removedPanel, {\n index: destinationIndex,\n skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) &&\n !isDestinationGroupEmpty,\n skipSetGroupActive: true,\n });\n });\n if (!options.skipSetActive) {\n this.doSetGroupAndPanelActive(destinationGroup);\n }\n this._onDidMovePanel.fire({\n panel: removedPanel,\n from: sourceGroup,\n });\n }\n else {\n /**\n * Dropping a panel to the extremities of a group which will place that panel\n * into an adjacent group\n */\n // The destination group may live in the main grid or in a floating\n // window's nested gridview — resolve which root we are dropping\n // into so locations/orientation are computed against it.\n const destinationGridview = this.getGridviewForGroup(destinationGroup);\n const referenceLocation = getGridLocation(destinationGroup.element);\n const targetLocation = getRelativeLocation(destinationGridview.orientation, referenceLocation, destinationTarget);\n if (sourceGroup.size < 2) {\n /**\n * If we are moving from a group which only has one panel left we will consider\n * moving the group itself rather than moving the panel into a newly created group\n */\n const [targetParentLocation, to] = tail(targetLocation);\n if (sourceGroup.api.location.type === 'grid' &&\n destinationGridview === this.gridview) {\n const sourceLocation = getGridLocation(sourceGroup.element);\n const [sourceParentLocation, from] = tail(sourceLocation);\n if (sequenceEquals(sourceParentLocation, targetParentLocation)) {\n // special case when 'swapping' two views within same grid location\n // if a group has one tab - we are essentially moving the 'group'\n // which is equivalent to swapping two views in this case\n this.gridview.moveView(sourceParentLocation, from, to);\n this._onDidMovePanel.fire({\n panel: this.getGroupPanel(sourceItemId),\n from: sourceGroup,\n });\n return;\n }\n }\n if (sourceGroup.api.location.type === 'popout' &&\n this.nestedWindowMembers(sourceGroup).length <= 1) {\n /**\n * the source group is the only group in a popout window and\n * has a single panel\n *\n * 1. remove the panel from the group without triggering any events\n * 2. remove the popout group — this may cascade-remove the empty\n * reference group it left behind in the main grid (see\n * doRemoveGroup for popout groups), which can shift grid indices\n * 3. recompute the target location now that the grid is stable\n * 4. create a new group at the recomputed location and add that panel\n *\n * Multi-group popout windows fall through to the generic\n * detach-and-re-add path so the window stays alive.\n */\n const popoutGroup = (_b = this._popoutWindowService) === null || _b === void 0 ? void 0 : _b.findByGroup(sourceGroup);\n if (!popoutGroup) {\n return;\n }\n const removedPanel = this.movingLock(() => popoutGroup.popoutGroup.model.removePanel(popoutGroup.popoutGroup.panels[0], {\n skipSetActive: true,\n skipSetActiveGroup: true,\n }));\n this.doRemoveGroup(sourceGroup, { skipActive: true });\n const updatedTargetLocation = getRelativeLocation(destinationGridview.orientation, getGridLocation(destinationGroup.element), destinationTarget);\n const newGroup = this.createGroupAtLocation(updatedTargetLocation, undefined, undefined, destinationGridview);\n this.movingLock(() => newGroup.model.openPanel(removedPanel, {\n skipSetActive: true,\n }));\n this.doSetGroupAndPanelActive(newGroup);\n this._onDidMovePanel.fire({\n panel: this.getGroupPanel(sourceItemId),\n from: sourceGroup,\n });\n return;\n }\n if (sourceGroup.api.location.type === 'edge') {\n /**\n * Edge groups are permanent structural elements — never move the\n * group itself. Instead extract the panel and create a new grid group,\n * leaving the edge slot intact (same behaviour as the size >= 2 path).\n */\n const removedPanel = this.movingLock(() => sourceGroup.model.removePanel(sourceItemId, {\n skipSetActive: false,\n skipSetActiveGroup: true,\n }));\n if (!removedPanel) {\n throw new Error(`dockview: No panel with id ${sourceItemId}`);\n }\n const newGroup = this.createGroupAtLocation(targetLocation, undefined, undefined, destinationGridview);\n this.movingLock(() => newGroup.model.openPanel(removedPanel, {\n skipSetGroupActive: true,\n }));\n this.doSetGroupAndPanelActive(newGroup);\n this._onDidMovePanel.fire({\n panel: removedPanel,\n from: sourceGroup,\n });\n return;\n }\n // source group will become empty so delete the group\n const targetGroup = this.movingLock(() => this.doRemoveGroup(sourceGroup, {\n skipActive: true,\n skipDispose: true,\n }));\n // after deleting the group we need to re-evaulate the ref location\n const updatedReferenceLocation = getGridLocation(destinationGroup.element);\n const location = getRelativeLocation(destinationGridview.orientation, updatedReferenceLocation, destinationTarget);\n this.movingLock(() => this.doAddGroup(targetGroup, location, undefined, destinationGridview));\n this.setGroupLocationForRoot(targetGroup, destinationGridview);\n this.doSetGroupAndPanelActive(targetGroup);\n this._onDidMovePanel.fire({\n panel: this.getGroupPanel(sourceItemId),\n from: sourceGroup,\n });\n }\n else {\n /**\n * The group we are removing from has many panels, we need to remove the panels we are moving,\n * create a new group, add the panels to that new group and add the new group in an appropiate position\n */\n const removedPanel = this.movingLock(() => sourceGroup.model.removePanel(sourceItemId, {\n skipSetActive: false,\n skipSetActiveGroup: true,\n }));\n if (!removedPanel) {\n throw new Error(`dockview: No panel with id ${sourceItemId}`);\n }\n const dropLocation = getRelativeLocation(destinationGridview.orientation, referenceLocation, destinationTarget);\n const group = this.createGroupAtLocation(dropLocation, undefined, undefined, destinationGridview);\n this.movingLock(() => group.model.openPanel(removedPanel, {\n skipSetGroupActive: true,\n }));\n this.doSetGroupAndPanelActive(group);\n this._onDidMovePanel.fire({\n panel: removedPanel,\n from: sourceGroup,\n });\n }\n }\n }\n moveTabGroupToGroup(options) {\n const { sourceGroup, tabGroupId, destinationGroup, destinationTarget, destinationIndex, } = options;\n const tabGroup = sourceGroup.model\n .getTabGroups()\n .find((tg) => tg.id === tabGroupId);\n if (!tabGroup || tabGroup.panelIds.length === 0) {\n return;\n }\n // Snapshot tab group metadata before removing panels\n const label = tabGroup.label;\n const color = tabGroup.color;\n const collapsed = tabGroup.collapsed;\n const componentParams = tabGroup.componentParams;\n const panelIds = [...tabGroup.panelIds];\n // Capture the destination's grid location BEFORE potentially\n // removing the source group, in case source === destination and\n // the source becomes empty after panel removal.\n const referenceLocation = destinationTarget && destinationTarget !== 'center'\n ? getGridLocation(destinationGroup.element)\n : undefined;\n // Remove panels from the source group\n const removedPanels = this.movingLock(() => panelIds\n .map((pid) => sourceGroup.model.removePanel(pid, {\n skipSetActive: false,\n skipSetActiveGroup: true,\n }))\n .filter((p) => p !== undefined));\n if (removedPanels.length === 0) {\n return;\n }\n const addPanelsToGroup = (targetGroup) => {\n this.movingLock(() => {\n for (const panel of removedPanels) {\n targetGroup.model.openPanel(panel, {\n index: destinationIndex,\n skipSetActive: true,\n skipSetGroupActive: true,\n });\n }\n });\n // Recreate the tab group in the destination\n const newTabGroup = targetGroup.model.createTabGroup({\n label,\n color,\n collapsed,\n componentParams,\n });\n for (const panel of removedPanels) {\n targetGroup.model.addPanelToTabGroup(newTabGroup.id, panel.id);\n }\n if (!options.skipSetActive) {\n this.doSetGroupAndPanelActive(targetGroup);\n }\n for (const panel of removedPanels) {\n this._onDidMovePanel.fire({\n panel,\n from: sourceGroup,\n });\n }\n };\n let targetGroup;\n if (!destinationTarget ||\n destinationTarget === 'center' ||\n !referenceLocation) {\n targetGroup = destinationGroup;\n }\n else {\n const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, destinationTarget);\n targetGroup = this.createGroupAtLocation(dropLocation);\n }\n // Remove the source group if it became empty. We compare against\n // the actual targetGroup (which is a freshly-created group for\n // edge drops) rather than the originally-passed destinationGroup,\n // so a tab-group drag onto its own group's edge still cleans up\n // the now-empty source.\n if (!options.keepEmptyGroups &&\n sourceGroup.model.size === 0 &&\n sourceGroup !== targetGroup) {\n this.doRemoveGroup(sourceGroup, { skipActive: true });\n }\n addPanelsToGroup(targetGroup);\n }\n moveGroup(options) {\n this.mutation('move', () => this._doMoveGroup(options));\n }\n // Bracket maximize/restore as a 'maximize' transaction. The maximized node\n // is serialized by the gridview (`SerializedGridview.maximizedNode`), so\n // the state round-trips through toJSON/fromJSON and is restorable on undo.\n // When the exit is a side-effect of another bracketed operation (e.g. a\n // move that activates a different group) the depth counter folds it in.\n maximizeGroup(panel) {\n this.mutation('maximize', () => super.maximizeGroup(panel));\n }\n exitMaximizedGroup() {\n this.mutation('maximize', () => super.exitMaximizedGroup());\n }\n _doMoveGroup(options) {\n var _a, _b, _c;\n const from = options.from.group;\n const to = options.to.group;\n const target = options.to.position;\n // The group whose panels end up at the target. For non-edge moves\n // we relocate `from` itself; for edge moves we move panels into a\n // freshly created group so the edge slot stays anchored.\n let source = from;\n if (target === 'center') {\n const activePanel = from.activePanel;\n // Snapshot tab group metadata before removing panels so we\n // can recreate the tab groups in the destination after the\n // panels are merged in.\n const tabGroupSnapshots = from.model.getTabGroups().map((tg) => ({\n label: tg.label,\n color: tg.color,\n collapsed: tg.collapsed,\n componentParams: tg.componentParams,\n panelIds: [...tg.panelIds],\n }));\n const panels = this.movingLock(() => [...from.panels].map((p) => from.model.removePanel(p.id, {\n skipSetActive: true,\n })));\n if ((from === null || from === void 0 ? void 0 : from.model.size) === 0) {\n this.doRemoveGroup(from, { skipActive: true });\n }\n this.movingLock(() => {\n for (const panel of panels) {\n to.model.openPanel(panel, {\n skipSetActive: panel !== activePanel,\n skipSetGroupActive: true,\n });\n }\n });\n for (const snapshot of tabGroupSnapshots) {\n const newTabGroup = to.model.createTabGroup({\n label: snapshot.label,\n color: snapshot.color,\n collapsed: snapshot.collapsed,\n componentParams: snapshot.componentParams,\n });\n for (const panelId of snapshot.panelIds) {\n to.model.addPanelToTabGroup(newTabGroup.id, panelId);\n }\n }\n // Ensure group becomes active after move\n if (options.skipSetActive !== true) {\n // For center moves (merges), we need to ensure the target group is active\n // unless explicitly told not to (skipSetActive: true)\n this.doSetGroupAndPanelActive(to);\n }\n else if (!this.activePanel) {\n // Even with skipSetActive: true, ensure there's an active panel if none exists\n // This maintains basic functionality while respecting skipSetActive\n this.doSetGroupAndPanelActive(to);\n }\n }\n else {\n if (from.api.location.type === 'edge') {\n /**\n * Edge groups are permanent structural elements and must\n * stay anchored in their edge slot. Move the panels into a\n * new group; the auto-collapse listener registered in\n * addEdgeGroup will collapse the now-empty edge slot once\n * the last panel leaves. The placement code below then\n * positions `source` like any other moved group.\n */\n const activePanel = from.activePanel;\n // Snapshot tab group metadata so the new group inherits\n // the tab grouping from the edge slot.\n const tabGroupSnapshots = from.model\n .getTabGroups()\n .map((tg) => ({\n label: tg.label,\n color: tg.color,\n collapsed: tg.collapsed,\n componentParams: tg.componentParams,\n panelIds: [...tg.panelIds],\n }));\n const movedPanels = this.movingLock(() => [...from.panels].map((p) => from.model.removePanel(p.id, { skipSetActive: true })));\n source = this.createGroup();\n // The new source group enters the layout via gridview.addView\n // below, which bypasses doAddGroup and so doesn't fire\n // BaseGrid._onDidAdd. Modules (TabGroupChips, etc.) drive\n // per-group attachment off _onDidAddGroup, so we fire it\n // explicitly here — matches the pattern in addFloatingGroup\n // and addEdgeGroup.\n this._onDidAddGroup.fire(source);\n this.movingLock(() => {\n for (const panel of movedPanels) {\n source.model.openPanel(panel, {\n skipSetActive: panel !== activePanel,\n skipSetGroupActive: true,\n });\n }\n });\n for (const snapshot of tabGroupSnapshots) {\n const newTabGroup = source.model.createTabGroup({\n label: snapshot.label,\n color: snapshot.color,\n collapsed: snapshot.collapsed,\n componentParams: snapshot.componentParams,\n });\n for (const panelId of snapshot.panelIds) {\n source.model.addPanelToTabGroup(newTabGroup.id, panelId);\n }\n }\n }\n else {\n switch (from.api.location.type) {\n case 'grid':\n this.gridview.removeView(getGridLocation(from.element));\n break;\n case 'floating': {\n const selectedFloatingGroup = (_a = this._floatingGroupService) === null || _a === void 0 ? void 0 : _a.findByGroup(from);\n if (!selectedFloatingGroup) {\n throw new Error('dockview: failed to find floating group');\n }\n // Detach just this group from the floating window's\n // nested gridview, keeping the window (and its other\n // groups) alive. If it was the only member, dispose the\n // whole window.\n if (!this.detachFromNestedWindow(from)) {\n selectedFloatingGroup.dispose();\n }\n break;\n }\n case 'popout': {\n const selectedPopoutGroup = (_b = this._popoutWindowService) === null || _b === void 0 ? void 0 : _b.findByGroup(from);\n if (!selectedPopoutGroup) {\n throw new Error('dockview: failed to find popout group');\n }\n // Detach just this group from the popout window's\n // nested gridview, keeping the window + its other groups\n // alive. Destination containers/location are applied by\n // the placement block below.\n if (this.detachFromNestedWindow(from)) {\n break;\n }\n // Last group leaving — tear the window down. Remove from\n // the service first to prevent automatic restoration.\n (_c = this._popoutWindowService) === null || _c === void 0 ? void 0 : _c.remove(selectedPopoutGroup);\n // Clean up the reference group (ghost) if it exists and is hidden\n if (selectedPopoutGroup.referenceGroup) {\n const referenceGroup = this.getPanel(selectedPopoutGroup.referenceGroup);\n if (referenceGroup &&\n !referenceGroup.api.isVisible) {\n this.doRemoveGroup(referenceGroup, {\n skipActive: true,\n });\n }\n }\n // Dispose the window without triggering restoration. The\n // placement block below applies the destination\n // location and containers to `from`.\n selectedPopoutGroup.window.dispose();\n break;\n }\n }\n }\n // Place `source` next to `to`, in whichever gridview root `to`\n // lives in. When `to` is inside a floating / popout window this\n // splits that window's nested layout rather than spawning a new one.\n if (to.api.location.type === 'grid' ||\n to.api.location.type === 'floating' ||\n to.api.location.type === 'popout') {\n const destGridview = this.getGridviewForGroup(to);\n const referenceLocation = getGridLocation(to.element);\n const dropLocation = getRelativeLocation(destGridview.orientation, referenceLocation, target);\n let size;\n switch (destGridview.orientation) {\n case Orientation.VERTICAL:\n size =\n referenceLocation.length % 2 == 0\n ? from.api.width\n : from.api.height;\n break;\n case Orientation.HORIZONTAL:\n size =\n referenceLocation.length % 2 == 0\n ? from.api.height\n : from.api.width;\n break;\n }\n destGridview.addView(source, size, dropLocation);\n this.setGroupLocationForRoot(source, destGridview);\n }\n }\n source.panels.forEach((panel) => {\n this._onDidMovePanel.fire({ panel, from });\n });\n this.debouncedUpdateAllPositions();\n // Ensure group becomes active after move\n if (options.skipSetActive === false) {\n // Only activate when explicitly requested (skipSetActive: false)\n // Use 'to' group for non-center moves since 'from' may have been destroyed\n const targetGroup = to !== null && to !== void 0 ? to : from;\n this.doSetGroupAndPanelActive(targetGroup);\n }\n else if (source !== from && options.skipSetActive !== true) {\n // Edge group moves create a fresh `source` group; activate it\n // by default so the moved panels receive focus.\n this.doSetGroupAndPanelActive(source);\n }\n }\n doSetGroupActive(group) {\n var _a;\n super.doSetGroupActive(group);\n const activePanel = this.activePanel;\n if (!this._moving &&\n activePanel !== ((_a = this._onDidActivePanelChange.value) === null || _a === void 0 ? void 0 : _a.panel)) {\n this.fireActivePanelChange(activePanel);\n }\n }\n doSetGroupAndPanelActive(group) {\n var _a;\n super.doSetGroupActive(group);\n const activePanel = this.activePanel;\n if (group &&\n this.hasMaximizedGroup() &&\n !this.isMaximizedGroup(group)) {\n this.exitMaximizedGroup();\n }\n if (!this._moving &&\n activePanel !== ((_a = this._onDidActivePanelChange.value) === null || _a === void 0 ? void 0 : _a.panel)) {\n this.fireActivePanelChange(activePanel);\n }\n }\n getNextGroupId() {\n let id = this.nextGroupId.next();\n while (this._groups.has(id)) {\n id = this.nextGroupId.next();\n }\n return id;\n }\n createGroup(options) {\n if (!options) {\n options = {};\n }\n let id = options === null || options === void 0 ? void 0 : options.id;\n if (id && this._groups.has(options.id)) {\n console.warn(`dockview: Duplicate group id ${options === null || options === void 0 ? void 0 : options.id}. reassigning group id to avoid errors`);\n id = undefined;\n }\n if (!id) {\n id = this.nextGroupId.next();\n while (this._groups.has(id)) {\n id = this.nextGroupId.next();\n }\n }\n const view = new DockviewGroupPanel(this, id, options);\n view.init({ params: {}, accessor: this });\n if (!this._groups.has(view.id)) {\n const disposable = new CompositeDisposable(view.model.onTabDragStart((event) => {\n var _a;\n (_a = this._advancedDnDService) === null || _a === void 0 ? void 0 : _a.dispatchWillDragPanel(event);\n }), view.model.onGroupDragStart((event) => {\n var _a;\n (_a = this._advancedDnDService) === null || _a === void 0 ? void 0 : _a.dispatchWillDragGroup(event);\n }), view.model.onMove((event) => {\n const { groupId, itemId, target, index, tabGroupId } = event;\n this.moveGroupOrPanel({\n from: {\n groupId: groupId,\n panelId: itemId,\n tabGroupId,\n },\n to: {\n group: view,\n position: target,\n index,\n },\n });\n }), view.model.onDidDrop((event) => {\n this._onDidDrop.fire(event);\n }), view.model.onWillDrop((event) => {\n var _a;\n (_a = this._advancedDnDService) === null || _a === void 0 ? void 0 : _a.dispatchWillDrop(event);\n }), view.model.onWillShowOverlay((event) => {\n var _a;\n if (this.options.disableDnd) {\n // Engine policy — stays in core, ahead of any\n // customisation dispatch.\n event.preventDefault();\n return;\n }\n (_a = this._advancedDnDService) === null || _a === void 0 ? void 0 : _a.dispatchWillShowOverlay(event);\n }), view.model.onUnhandledDragOver((event) => {\n this._onUnhandledDragOver.fire(event);\n }), view.model.onDidAddPanel((event) => {\n if (this._moving) {\n return;\n }\n this._onDidAddPanel.fire(event.panel);\n }), view.model.onDidRemovePanel((event) => {\n if (this._moving) {\n return;\n }\n this._onDidRemovePanel.fire(event.panel);\n }), view.model.onDidActivePanelChange((event) => {\n var _a;\n if (this._moving) {\n return;\n }\n if (event.panel !== this.activePanel) {\n return;\n }\n if (((_a = this._onDidActivePanelChange.value) === null || _a === void 0 ? void 0 : _a.panel) !==\n event.panel) {\n this.fireActivePanelChange(event.panel);\n }\n }), Event.any(view.model.onDidPanelTitleChange, view.model.onDidPanelParametersChange)(() => {\n this._bufferOnDidLayoutChange.fire();\n }));\n this._groups.set(view.id, { value: view, disposable });\n }\n // TODO: must be called after the above listeners have been setup, not an ideal pattern\n view.initialize();\n return view;\n }\n createPanel(options, group) {\n var _a, _b, _c;\n const contentComponent = options.component;\n const tabComponent = (_a = options.tabComponent) !== null && _a !== void 0 ? _a : this.options.defaultTabComponent;\n const view = new DockviewPanelModel(this, options.id, contentComponent, tabComponent);\n const panel = new DockviewPanel(options.id, contentComponent, tabComponent, this, this._api, group, view, {\n renderer: options.renderer,\n minimumWidth: options.minimumWidth,\n minimumHeight: options.minimumHeight,\n maximumWidth: options.maximumWidth,\n maximumHeight: options.maximumHeight,\n });\n panel.init({\n title: (_b = options.title) !== null && _b !== void 0 ? _b : options.id,\n params: (_c = options === null || options === void 0 ? void 0 : options.params) !== null && _c !== void 0 ? _c : {},\n });\n return panel;\n }\n createGroupAtLocation(location, size, options, gridview = this.gridview) {\n const group = this.createGroup(options);\n this.doAddGroup(group, location, size, gridview);\n this.setGroupLocationForRoot(group, gridview);\n return group;\n }\n /**\n * Tag a group with the location and render / drop-target containers\n * matching the gridview root it now lives in: the main grid, a floating\n * window (shares the main containers), or a popout window (uses its own\n * window-local containers).\n */\n setGroupLocationForRoot(group, gridview) {\n var _a;\n const popout = (_a = this._popoutWindowService) === null || _a === void 0 ? void 0 : _a.entries.find((entry) => entry.gridview === gridview);\n if (popout) {\n if (group.model.renderContainer !== popout.overlayRenderContainer) {\n group.model.renderContainer = popout.overlayRenderContainer;\n }\n group.model.dropTargetContainer = popout.dropTargetContainer;\n group.model.location = {\n type: 'popout',\n getWindow: popout.getWindow,\n popoutUrl: popout.popoutUrl,\n };\n return;\n }\n // grid / floating both render through the main containers\n if (group.model.renderContainer !== this.overlayRenderContainer) {\n group.model.renderContainer = this.overlayRenderContainer;\n }\n group.model.dropTargetContainer = this.rootDropTargetContainer;\n group.model.location =\n gridview === this.gridview\n ? { type: 'grid' }\n : { type: 'floating' };\n }\n /**\n * Resolve which gridview root currently owns a group: the main grid, or\n * the nested gridview of the floating / popout window it lives in.\n */\n getGridviewForGroup(group) {\n var _a, _b;\n const floating = (_a = this._floatingGroupService) === null || _a === void 0 ? void 0 : _a.findByGroup(group);\n if (floating) {\n return floating.gridview;\n }\n // Use findByGroup (anchor-identity OR containment) for symmetry with\n // the floating branch — it also resolves an anchor whose element is\n // briefly detached from the gridview during a move/restore.\n const popout = (_b = this._popoutWindowService) === null || _b === void 0 ? void 0 : _b.findByGroup(group);\n if (popout) {\n return popout.gridview;\n }\n return this.gridview;\n }\n /**\n * The groups that live within the same floating / popout window as `group`\n * (including `group` itself). Empty when `group` is in the main grid.\n */\n nestedWindowMembers(group) {\n const gridview = this.getGridviewForGroup(group);\n if (gridview === this.gridview) {\n return [];\n }\n return this.groups.filter((candidate) => gridview.element.contains(candidate.element));\n }\n findGroup(panel) {\n var _a;\n return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;\n }\n orientationAtLocation(location) {\n const rootOrientation = this.gridview.orientation;\n return location.length % 2 == 1\n ? rootOrientation\n : orthogonal(rootOrientation);\n }\n updateTheme() {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;\n const theme = (_a = this._options.theme) !== null && _a !== void 0 ? _a : themeAbyss;\n // Apply the theme class only to the shell so edge groups and the\n // main grid both inherit its CSS custom properties via the cascade.\n // Re-declaring it on `.dv-dockview` would block consumer overrides\n // set on the shell from reaching the dockview subtree.\n (_b = this._shellThemeClassnames) === null || _b === void 0 ? void 0 : _b.setClassNames(theme.className);\n const gap = (_c = theme.gap) !== null && _c !== void 0 ? _c : 0;\n this.gridview.margin = gap;\n // Floating / popout windows host their own nested gridviews; keep their\n // gap in sync with the main grid when the theme changes at runtime.\n for (const floating of this.floatingGroups) {\n floating.gridview.margin = gap;\n }\n for (const entry of (_e = (_d = this._popoutWindowService) === null || _d === void 0 ? void 0 : _d.entries) !== null && _e !== void 0 ? _e : []) {\n entry.gridview.margin = gap;\n }\n (_f = this._shellManager) === null || _f === void 0 ? void 0 : _f.updateTheme(gap, (_g = theme.edgeGroupCollapsedSize) !== null && _g !== void 0 ? _g : 35);\n if (theme.dndOverlayBorder !== undefined) {\n this.element.style.setProperty('--dv-drag-over-border', theme.dndOverlayBorder);\n (_h = this._shellManager) === null || _h === void 0 ? void 0 : _h.element.style.setProperty('--dv-drag-over-border', theme.dndOverlayBorder);\n }\n else {\n this.element.style.removeProperty('--dv-drag-over-border');\n (_j = this._shellManager) === null || _j === void 0 ? void 0 : _j.element.style.removeProperty('--dv-drag-over-border');\n }\n switch (theme.dndOverlayMounting) {\n case 'absolute':\n this.rootDropTargetContainer.disabled = false;\n break;\n case 'relative':\n default:\n this.rootDropTargetContainer.disabled = true;\n break;\n }\n // Toggle a CSS class so theme stylesheets can scope pure-CSS\n // tab group indicator rules to the 'none' mode only.\n const indicatorNone = ((_k = theme.tabGroupIndicator) !== null && _k !== void 0 ? _k : 'wrap') === 'none';\n toggleClass(this.element, 'dv-tab-group-indicator-none', indicatorNone);\n if (this._shellManager) {\n toggleClass(this._shellManager.element, 'dv-tab-group-indicator-none', indicatorNone);\n }\n // Re-render tab group indicators so the new tabGroupIndicator mode takes effect\n for (const group of this.groups) {\n group.model.updateTabGroups();\n }\n }\n}\n\nclass GridviewComponent extends BaseGrid {\n get orientation() {\n return this.gridview.orientation;\n }\n set orientation(value) {\n this.gridview.orientation = value;\n }\n get options() {\n return this._options;\n }\n get deserializer() {\n return this._deserializer;\n }\n set deserializer(value) {\n this._deserializer = value;\n }\n constructor(container, options) {\n var _a;\n super(container, {\n proportionalLayout: (_a = options.proportionalLayout) !== null && _a !== void 0 ? _a : true,\n orientation: options.orientation,\n styles: options.hideBorders\n ? { separatorBorder: 'transparent' }\n : undefined,\n disableAutoResizing: options.disableAutoResizing,\n className: options.className,\n });\n this._onDidLayoutfromJSON = new Emitter();\n this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;\n this._onDidRemoveGroup = new Emitter();\n this.onDidRemoveGroup = this._onDidRemoveGroup.event;\n this._onDidAddGroup = new Emitter();\n this.onDidAddGroup = this._onDidAddGroup.event;\n this._onDidActiveGroupChange = new Emitter();\n this.onDidActiveGroupChange = this._onDidActiveGroupChange.event;\n this._options = options;\n this.addDisposables(this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this.onDidAdd((event) => {\n this._onDidAddGroup.fire(event);\n }), this.onDidRemove((event) => {\n this._onDidRemoveGroup.fire(event);\n }), this.onDidActiveChange((event) => {\n this._onDidActiveGroupChange.fire(event);\n }));\n }\n updateOptions(options) {\n super.updateOptions(options);\n const hasOrientationChanged = typeof options.orientation === 'string' &&\n this.gridview.orientation !== options.orientation;\n this._options = Object.assign(Object.assign({}, this.options), options);\n if (hasOrientationChanged) {\n this.gridview.orientation = options.orientation;\n }\n this.layout(this.gridview.width, this.gridview.height, true);\n }\n removePanel(panel) {\n this.removeGroup(panel);\n }\n /**\n * Serialize the current state of the layout\n *\n * @returns A JSON respresentation of the layout\n */\n toJSON() {\n var _a;\n const data = this.gridview.serialize();\n return {\n grid: data,\n activePanel: (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.id,\n };\n }\n setVisible(panel, visible) {\n this.gridview.setViewVisible(getGridLocation(panel.element), visible);\n }\n setActive(panel) {\n this._groups.forEach((value, _key) => {\n value.value.setActive(panel === value.value);\n });\n }\n focus() {\n var _a;\n (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();\n }\n fromJSON(serializedGridview) {\n this.clear();\n const { grid, activePanel } = serializedGridview;\n try {\n const queue = [];\n // take note of the existing dimensions\n const width = this.width;\n const height = this.height;\n this.gridview.deserialize(grid, {\n fromJSON: (node) => {\n const { data } = node;\n const view = this.options.createComponent({\n id: data.id,\n name: data.component,\n });\n queue.push(() => view.init({\n params: data.params,\n minimumWidth: data.minimumWidth,\n maximumWidth: data.maximumWidth,\n minimumHeight: data.minimumHeight,\n maximumHeight: data.maximumHeight,\n priority: data.priority,\n snap: !!data.snap,\n accessor: this,\n isVisible: node.visible,\n }));\n this._onDidAddGroup.fire(view);\n this.registerPanel(view);\n return view;\n },\n });\n this.layout(width, height, true);\n queue.forEach((f) => f());\n if (typeof activePanel === 'string') {\n const panel = this.getPanel(activePanel);\n if (panel) {\n this.doSetGroupActive(panel);\n }\n }\n }\n catch (err) {\n /**\n * To remove a group we cannot call this.removeGroup(...) since this makes assumptions about\n * the underlying HTMLElement existing in the Gridview.\n */\n for (const group of this.groups) {\n group.dispose();\n this._groups.delete(group.id);\n this._onDidRemoveGroup.fire(group);\n }\n // fires clean-up events and clears the underlying HTML gridview.\n this.clear();\n /**\n * even though we have cleaned-up we still want to inform the caller of their error\n * and we'll do this through re-throwing the original error since afterall you would\n * expect trying to load a corrupted layout to result in an error and not silently fail...\n */\n throw err;\n }\n this._onDidLayoutfromJSON.fire();\n }\n clear() {\n const hasActiveGroup = this.activeGroup;\n const groups = Array.from(this._groups.values()); // reassign since group panels will mutate\n for (const group of groups) {\n group.disposable.dispose();\n this.doRemoveGroup(group.value, { skipActive: true });\n }\n if (hasActiveGroup) {\n this.doSetGroupActive(undefined);\n }\n this.gridview.clear();\n }\n movePanel(panel, options) {\n var _a;\n let relativeLocation;\n const removedPanel = this.gridview.remove(panel);\n const referenceGroup = (_a = this._groups.get(options.reference)) === null || _a === void 0 ? void 0 : _a.value;\n if (!referenceGroup) {\n throw new Error(`reference group ${options.reference} does not exist`);\n }\n const target = toTarget(options.direction);\n if (target === 'center') {\n throw new Error(`${target} not supported as an option`);\n }\n else {\n const location = getGridLocation(referenceGroup.element);\n relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);\n }\n this.doAddGroup(removedPanel, relativeLocation, options.size);\n }\n addPanel(options) {\n var _a, _b, _c, _d;\n let relativeLocation = (_a = options.location) !== null && _a !== void 0 ? _a : [0];\n if ((_b = options.position) === null || _b === void 0 ? void 0 : _b.referencePanel) {\n const referenceGroup = (_c = this._groups.get(options.position.referencePanel)) === null || _c === void 0 ? void 0 : _c.value;\n if (!referenceGroup) {\n throw new Error(`reference group ${options.position.referencePanel} does not exist`);\n }\n const target = toTarget(options.position.direction);\n if (target === 'center') {\n throw new Error(`${target} not supported as an option`);\n }\n else {\n const location = getGridLocation(referenceGroup.element);\n relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);\n }\n }\n const view = this.options.createComponent({\n id: options.id,\n name: options.component,\n });\n view.init({\n params: (_d = options.params) !== null && _d !== void 0 ? _d : {},\n minimumWidth: options.minimumWidth,\n maximumWidth: options.maximumWidth,\n minimumHeight: options.minimumHeight,\n maximumHeight: options.maximumHeight,\n priority: options.priority,\n snap: !!options.snap,\n accessor: this,\n isVisible: true,\n });\n this.doAddGroup(view, relativeLocation, options.size);\n this.registerPanel(view);\n this.doSetGroupActive(view);\n return view;\n }\n registerPanel(panel) {\n const disposable = new CompositeDisposable(panel.api.onDidFocusChange((event) => {\n if (!event.isFocused) {\n return;\n }\n this._groups.forEach((groupItem) => {\n const group = groupItem.value;\n if (group !== panel) {\n group.setActive(false);\n }\n else {\n group.setActive(true);\n }\n });\n }));\n this._groups.set(panel.id, {\n value: panel,\n disposable,\n });\n }\n moveGroup(referenceGroup, groupId, target) {\n const sourceGroup = this.getPanel(groupId);\n if (!sourceGroup) {\n throw new Error('invalid operation');\n }\n const referenceLocation = getGridLocation(referenceGroup.element);\n const targetLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);\n const [targetParentLocation, to] = tail(targetLocation);\n const sourceLocation = getGridLocation(sourceGroup.element);\n const [sourceParentLocation, from] = tail(sourceLocation);\n if (sequenceEquals(sourceParentLocation, targetParentLocation)) {\n // special case when 'swapping' two views within same grid location\n // if a group has one tab - we are essentially moving the 'group'\n // which is equivalent to swapping two views in this case\n this.gridview.moveView(sourceParentLocation, from, to);\n return;\n }\n // source group will become empty so delete the group\n const targetGroup = this.doRemoveGroup(sourceGroup, {\n skipActive: true,\n skipDispose: true,\n });\n // after deleting the group we need to re-evaulate the ref location\n const updatedReferenceLocation = getGridLocation(referenceGroup.element);\n const location = getRelativeLocation(this.gridview.orientation, updatedReferenceLocation, target);\n this.doAddGroup(targetGroup, location);\n }\n removeGroup(group) {\n super.removeGroup(group);\n }\n dispose() {\n super.dispose();\n this._onDidLayoutfromJSON.dispose();\n }\n}\n\n/**\n * A high-level implementation of splitview that works using 'panels'\n */\nclass SplitviewComponent extends Resizable {\n get panels() {\n return this.splitview.getViews();\n }\n get options() {\n return this._options;\n }\n get length() {\n return this._panels.size;\n }\n get orientation() {\n return this.splitview.orientation;\n }\n get splitview() {\n return this._splitview;\n }\n set splitview(value) {\n if (this._splitview) {\n this._splitview.dispose();\n }\n this._splitview = value;\n this._splitviewChangeDisposable.value = new CompositeDisposable(this._splitview.onDidSashEnd(() => {\n this._onDidLayoutChange.fire(undefined);\n }), this._splitview.onDidAddView((e) => this._onDidAddView.fire(e)), this._splitview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));\n }\n get minimumSize() {\n return this.splitview.minimumSize;\n }\n get maximumSize() {\n return this.splitview.maximumSize;\n }\n get height() {\n return this.splitview.orientation === Orientation.HORIZONTAL\n ? this.splitview.orthogonalSize\n : this.splitview.size;\n }\n get width() {\n return this.splitview.orientation === Orientation.HORIZONTAL\n ? this.splitview.size\n : this.splitview.orthogonalSize;\n }\n constructor(container, options) {\n var _a;\n super(document.createElement('div'), options.disableAutoResizing);\n this._splitviewChangeDisposable = new MutableDisposable();\n this._panels = new Map();\n this._onDidLayoutfromJSON = new Emitter();\n this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;\n this._onDidAddView = new Emitter();\n this.onDidAddView = this._onDidAddView.event;\n this._onDidRemoveView = new Emitter();\n this.onDidRemoveView = this._onDidRemoveView.event;\n this._onDidLayoutChange = new Emitter();\n this.onDidLayoutChange = this._onDidLayoutChange.event;\n this.element.style.height = '100%';\n this.element.style.width = '100%';\n this._classNames = new Classnames(this.element);\n this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');\n // the container is owned by the third-party, do not modify/delete it\n container.appendChild(this.element);\n this._options = options;\n this.splitview = new Splitview(this.element, options);\n this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);\n }\n updateOptions(options) {\n var _a, _b;\n if ('className' in options) {\n this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');\n }\n if ('disableResizing' in options) {\n this.disableResizing = (_b = options.disableAutoResizing) !== null && _b !== void 0 ? _b : false;\n }\n if (typeof options.orientation === 'string') {\n this.splitview.orientation = options.orientation;\n }\n this._options = Object.assign(Object.assign({}, this.options), options);\n this.splitview.layout(this.splitview.size, this.splitview.orthogonalSize);\n }\n focus() {\n var _a;\n (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();\n }\n movePanel(from, to) {\n this.splitview.moveView(from, to);\n }\n setVisible(panel, visible) {\n const index = this.panels.indexOf(panel);\n this.splitview.setViewVisible(index, visible);\n }\n setActive(panel, skipFocus) {\n this._activePanel = panel;\n this.panels\n .filter((v) => v !== panel)\n .forEach((v) => {\n v.api._onDidActiveChange.fire({ isActive: false });\n if (!skipFocus) {\n v.focus();\n }\n });\n panel.api._onDidActiveChange.fire({ isActive: true });\n if (!skipFocus) {\n panel.focus();\n }\n }\n removePanel(panel, sizing) {\n const item = this._panels.get(panel.id);\n if (!item) {\n throw new Error(`unknown splitview panel ${panel.id}`);\n }\n item.dispose();\n this._panels.delete(panel.id);\n const index = this.panels.findIndex((_) => _ === panel);\n const removedView = this.splitview.removeView(index, sizing);\n removedView.dispose();\n const panels = this.panels;\n if (panels.length > 0) {\n this.setActive(panels[panels.length - 1]);\n }\n }\n getPanel(id) {\n return this.panels.find((view) => view.id === id);\n }\n addPanel(options) {\n var _a;\n if (this._panels.has(options.id)) {\n throw new Error(`panel ${options.id} already exists`);\n }\n const view = this.options.createComponent({\n id: options.id,\n name: options.component,\n });\n view.orientation = this.splitview.orientation;\n view.init({\n params: (_a = options.params) !== null && _a !== void 0 ? _a : {},\n minimumSize: options.minimumSize,\n maximumSize: options.maximumSize,\n snap: options.snap,\n priority: options.priority,\n accessor: this,\n });\n const size = typeof options.size === 'number' ? options.size : Sizing.Distribute;\n const index = typeof options.index === 'number' ? options.index : undefined;\n this.splitview.addView(view, size, index);\n this.doAddView(view);\n this.setActive(view);\n return view;\n }\n layout(width, height) {\n const [size, orthogonalSize] = this.splitview.orientation === Orientation.HORIZONTAL\n ? [width, height]\n : [height, width];\n this.splitview.layout(size, orthogonalSize);\n }\n doAddView(view) {\n const disposable = view.api.onDidFocusChange((event) => {\n if (!event.isFocused) {\n return;\n }\n this.setActive(view, true);\n });\n this._panels.set(view.id, disposable);\n }\n toJSON() {\n var _a;\n const views = this.splitview\n .getViews()\n .map((view, i) => {\n const size = this.splitview.getViewSize(i);\n return {\n size,\n data: view.toJSON(),\n snap: !!view.snap,\n priority: view.priority,\n };\n });\n return {\n views,\n activeView: (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.id,\n size: this.splitview.size,\n orientation: this.splitview.orientation,\n };\n }\n fromJSON(serializedSplitview) {\n this.clear();\n const { views, orientation, size, activeView } = serializedSplitview;\n const queue = [];\n // take note of the existing dimensions\n const width = this.width;\n const height = this.height;\n this.splitview = new Splitview(this.element, {\n orientation,\n proportionalLayout: this.options.proportionalLayout,\n descriptor: {\n size,\n views: views.map((view) => {\n const data = view.data;\n if (this._panels.has(data.id)) {\n throw new Error(`panel ${data.id} already exists`);\n }\n const panel = this.options.createComponent({\n id: data.id,\n name: data.component,\n });\n queue.push(() => {\n var _a;\n panel.init({\n params: (_a = data.params) !== null && _a !== void 0 ? _a : {},\n minimumSize: data.minimumSize,\n maximumSize: data.maximumSize,\n snap: view.snap,\n priority: view.priority,\n accessor: this,\n });\n });\n panel.orientation = orientation;\n this.doAddView(panel);\n setTimeout(() => {\n // the original onDidAddView events are missed since they are fired before we can subcribe to them\n this._onDidAddView.fire(panel);\n }, 0);\n return { size: view.size, view: panel };\n }),\n },\n });\n this.layout(width, height);\n queue.forEach((f) => f());\n if (typeof activeView === 'string') {\n const panel = this.getPanel(activeView);\n if (panel) {\n this.setActive(panel);\n }\n }\n this._onDidLayoutfromJSON.fire();\n }\n clear() {\n for (const disposable of this._panels.values()) {\n disposable.dispose();\n }\n this._panels.clear();\n while (this.splitview.length > 0) {\n const view = this.splitview.removeView(0, Sizing.Distribute, true);\n view.dispose();\n }\n }\n dispose() {\n for (const disposable of this._panels.values()) {\n disposable.dispose();\n }\n this._panels.clear();\n const views = this.splitview.getViews();\n this._splitviewChangeDisposable.dispose();\n this.splitview.dispose();\n for (const view of views) {\n view.dispose();\n }\n this.element.remove();\n super.dispose();\n }\n}\n\nclass DefaultHeader extends CompositeDisposable {\n get element() {\n return this._element;\n }\n constructor() {\n super();\n this._expandedIcon = createExpandMoreButton();\n this._collapsedIcon = createChevronRightButton();\n this.disposable = new MutableDisposable();\n this.apiRef = {\n api: null,\n };\n this._element = document.createElement('div');\n this.element.className = 'dv-default-header';\n this._content = document.createElement('span');\n this._expander = document.createElement('div');\n this._expander.className = 'dv-pane-header-icon';\n this.element.appendChild(this._expander);\n this.element.appendChild(this._content);\n this.addDisposables(addDisposableListener(this._element, 'click', () => {\n var _a;\n (_a = this.apiRef.api) === null || _a === void 0 ? void 0 : _a.setExpanded(!this.apiRef.api.isExpanded);\n }));\n }\n init(params) {\n this.apiRef.api = params.api;\n this._content.textContent = params.title;\n this.updateIcon();\n this.disposable.value = params.api.onDidExpansionChange(() => {\n this.updateIcon();\n });\n }\n updateIcon() {\n var _a;\n const isExpanded = !!((_a = this.apiRef.api) === null || _a === void 0 ? void 0 : _a.isExpanded);\n toggleClass(this._expander, 'collapsed', !isExpanded);\n if (isExpanded) {\n if (this._expander.contains(this._collapsedIcon)) {\n this._collapsedIcon.remove();\n }\n if (!this._expander.contains(this._expandedIcon)) {\n this._expander.appendChild(this._expandedIcon);\n }\n }\n else {\n if (this._expander.contains(this._expandedIcon)) {\n this._expandedIcon.remove();\n }\n if (!this._expander.contains(this._collapsedIcon)) {\n this._expander.appendChild(this._collapsedIcon);\n }\n }\n }\n update(_params) {\n //\n }\n dispose() {\n this.disposable.dispose();\n super.dispose();\n }\n}\n\nconst nextLayoutId = sequentialNumberGenerator();\nconst HEADER_SIZE = 22;\nconst MINIMUM_BODY_SIZE = 0;\nconst MAXIMUM_BODY_SIZE = Number.MAX_SAFE_INTEGER;\nclass PaneFramework extends DraggablePaneviewPanel {\n constructor(options) {\n super({\n accessor: options.accessor,\n id: options.id,\n component: options.component,\n headerComponent: options.headerComponent,\n orientation: options.orientation,\n isExpanded: options.isExpanded,\n disableDnd: options.disableDnd,\n headerSize: options.headerSize,\n minimumBodySize: options.minimumBodySize,\n maximumBodySize: options.maximumBodySize,\n });\n this.options = options;\n }\n getBodyComponent() {\n return this.options.body;\n }\n getHeaderComponent() {\n return this.options.header;\n }\n}\nclass PaneviewComponent extends Resizable {\n get id() {\n return this._id;\n }\n get panels() {\n return this.paneview.getPanes();\n }\n set paneview(value) {\n this._paneview = value;\n this._disposable.value = new CompositeDisposable(this._paneview.onDidChange(() => {\n this._onDidLayoutChange.fire(undefined);\n }), this._paneview.onDidAddView((e) => this._onDidAddView.fire(e)), this._paneview.onDidRemoveView((e) => this._onDidRemoveView.fire(e)));\n }\n get paneview() {\n return this._paneview;\n }\n get minimumSize() {\n return this.paneview.minimumSize;\n }\n get maximumSize() {\n return this.paneview.maximumSize;\n }\n get height() {\n return this.paneview.orientation === Orientation.HORIZONTAL\n ? this.paneview.orthogonalSize\n : this.paneview.size;\n }\n get width() {\n return this.paneview.orientation === Orientation.HORIZONTAL\n ? this.paneview.size\n : this.paneview.orthogonalSize;\n }\n get options() {\n return this._options;\n }\n constructor(container, options) {\n var _a;\n super(document.createElement('div'), options.disableAutoResizing);\n this._id = nextLayoutId.next();\n this._disposable = new MutableDisposable();\n this._viewDisposables = new Map();\n this._onDidLayoutfromJSON = new Emitter();\n this.onDidLayoutFromJSON = this._onDidLayoutfromJSON.event;\n this._onDidLayoutChange = new Emitter();\n this.onDidLayoutChange = this._onDidLayoutChange.event;\n this._onDidDrop = new Emitter();\n this.onDidDrop = this._onDidDrop.event;\n this._onDidAddView = new Emitter();\n this.onDidAddView = this._onDidAddView.event;\n this._onDidRemoveView = new Emitter();\n this.onDidRemoveView = this._onDidRemoveView.event;\n this._onUnhandledDragOver = new Emitter();\n this.onUnhandledDragOver = this._onUnhandledDragOver.event;\n this.element.style.height = '100%';\n this.element.style.width = '100%';\n this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView, this._onUnhandledDragOver);\n this._classNames = new Classnames(this.element);\n this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');\n // the container is owned by the third-party, do not modify/delete it\n container.appendChild(this.element);\n this._options = options;\n this.paneview = new Paneview(this.element, {\n // only allow paneview in the vertical orientation for now\n orientation: Orientation.VERTICAL,\n });\n this.addDisposables(this._disposable);\n }\n setVisible(panel, visible) {\n const index = this.panels.indexOf(panel);\n this.paneview.setViewVisible(index, visible);\n }\n focus() {\n //noop\n }\n updateOptions(options) {\n var _a, _b;\n if ('className' in options) {\n this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');\n }\n if ('disableResizing' in options) {\n this.disableResizing = (_b = options.disableAutoResizing) !== null && _b !== void 0 ? _b : false;\n }\n this._options = Object.assign(Object.assign({}, this.options), options);\n }\n addPanel(options) {\n var _a, _b;\n const body = this.options.createComponent({\n id: options.id,\n name: options.component,\n });\n let header;\n if (options.headerComponent && this.options.createHeaderComponent) {\n header = this.options.createHeaderComponent({\n id: options.id,\n name: options.headerComponent,\n });\n }\n if (!header) {\n header = new DefaultHeader();\n }\n const view = new PaneFramework({\n id: options.id,\n component: options.component,\n headerComponent: options.headerComponent,\n header,\n body,\n orientation: Orientation.VERTICAL,\n isExpanded: !!options.isExpanded,\n disableDnd: !!this.options.disableDnd,\n accessor: this,\n headerSize: (_a = options.headerSize) !== null && _a !== void 0 ? _a : HEADER_SIZE,\n minimumBodySize: MINIMUM_BODY_SIZE,\n maximumBodySize: MAXIMUM_BODY_SIZE,\n });\n this.doAddPanel(view);\n const size = typeof options.size === 'number' ? options.size : Sizing.Distribute;\n const index = typeof options.index === 'number' ? options.index : undefined;\n view.init({\n params: (_b = options.params) !== null && _b !== void 0 ? _b : {},\n minimumBodySize: options.minimumBodySize,\n maximumBodySize: options.maximumBodySize,\n isExpanded: options.isExpanded,\n title: options.title,\n containerApi: new PaneviewApi(this),\n accessor: this,\n });\n this.paneview.addPane(view, size, index);\n view.orientation = this.paneview.orientation;\n return view;\n }\n removePanel(panel) {\n const views = this.panels;\n const index = views.findIndex((_) => _ === panel);\n this.paneview.removePane(index);\n this.doRemovePanel(panel);\n }\n movePanel(from, to) {\n this.paneview.moveView(from, to);\n }\n getPanel(id) {\n return this.panels.find((view) => view.id === id);\n }\n layout(width, height) {\n const [size, orthogonalSize] = this.paneview.orientation === Orientation.HORIZONTAL\n ? [width, height]\n : [height, width];\n this.paneview.layout(size, orthogonalSize);\n }\n toJSON() {\n const maximum = (value) => value === Number.MAX_SAFE_INTEGER ||\n value === Number.POSITIVE_INFINITY\n ? undefined\n : value;\n const minimum = (value) => (value <= 0 ? undefined : value);\n const views = this.paneview\n .getPanes()\n .map((view, i) => {\n const size = this.paneview.getViewSize(i);\n return {\n size,\n data: view.toJSON(),\n minimumSize: minimum(view.minimumBodySize),\n maximumSize: maximum(view.maximumBodySize),\n headerSize: view.headerSize,\n expanded: view.isExpanded(),\n };\n });\n return {\n views,\n size: this.paneview.size,\n };\n }\n fromJSON(serializedPaneview) {\n this.clear();\n const { views, size } = serializedPaneview;\n const queue = [];\n // take note of the existing dimensions\n const width = this.width;\n const height = this.height;\n this.paneview = new Paneview(this.element, {\n orientation: Orientation.VERTICAL,\n descriptor: {\n size,\n views: views.map((view) => {\n var _a, _b, _c;\n const data = view.data;\n const body = this.options.createComponent({\n id: data.id,\n name: data.component,\n });\n let header;\n if (data.headerComponent &&\n this.options.createHeaderComponent) {\n header = this.options.createHeaderComponent({\n id: data.id,\n name: data.headerComponent,\n });\n }\n if (!header) {\n header = new DefaultHeader();\n }\n const panel = new PaneFramework({\n id: data.id,\n component: data.component,\n headerComponent: data.headerComponent,\n header,\n body,\n orientation: Orientation.VERTICAL,\n isExpanded: !!view.expanded,\n disableDnd: !!this.options.disableDnd,\n accessor: this,\n headerSize: (_a = view.headerSize) !== null && _a !== void 0 ? _a : HEADER_SIZE,\n minimumBodySize: (_b = view.minimumSize) !== null && _b !== void 0 ? _b : MINIMUM_BODY_SIZE,\n maximumBodySize: (_c = view.maximumSize) !== null && _c !== void 0 ? _c : MAXIMUM_BODY_SIZE,\n });\n this.doAddPanel(panel);\n queue.push(() => {\n var _a;\n panel.init({\n params: (_a = data.params) !== null && _a !== void 0 ? _a : {},\n minimumBodySize: view.minimumSize,\n maximumBodySize: view.maximumSize,\n title: data.title,\n isExpanded: !!view.expanded,\n containerApi: new PaneviewApi(this),\n accessor: this,\n });\n panel.orientation = this.paneview.orientation;\n });\n setTimeout(() => {\n // the original onDidAddView events are missed since they are fired before we can subcribe to them\n this._onDidAddView.fire(panel);\n }, 0);\n return { size: view.size, view: panel };\n }),\n },\n });\n this.layout(width, height);\n queue.forEach((f) => f());\n this._onDidLayoutfromJSON.fire();\n }\n clear() {\n for (const [_, value] of this._viewDisposables.entries()) {\n value.dispose();\n }\n this._viewDisposables.clear();\n this.paneview.dispose();\n }\n doAddPanel(panel) {\n const disposable = new CompositeDisposable(panel.onDidDrop((event) => {\n this._onDidDrop.fire(event);\n }), panel.onUnhandledDragOver((event) => {\n this._onUnhandledDragOver.fire(event);\n }));\n this._viewDisposables.set(panel.id, disposable);\n }\n doRemovePanel(panel) {\n const disposable = this._viewDisposables.get(panel.id);\n if (disposable) {\n disposable.dispose();\n this._viewDisposables.delete(panel.id);\n }\n }\n dispose() {\n super.dispose();\n for (const [_, value] of this._viewDisposables.entries()) {\n value.dispose();\n }\n this._viewDisposables.clear();\n this.element.remove();\n this.paneview.dispose();\n }\n}\n\nclass SplitviewPanel extends BasePanelView {\n get priority() {\n return this._priority;\n }\n set orientation(value) {\n this._orientation = value;\n }\n get orientation() {\n return this._orientation;\n }\n get minimumSize() {\n const size = typeof this._minimumSize === 'function'\n ? this._minimumSize()\n : this._minimumSize;\n if (size !== this._evaluatedMinimumSize) {\n this._evaluatedMinimumSize = size;\n this.updateConstraints();\n }\n return size;\n }\n get maximumSize() {\n const size = typeof this._maximumSize === 'function'\n ? this._maximumSize()\n : this._maximumSize;\n if (size !== this._evaluatedMaximumSize) {\n this._evaluatedMaximumSize = size;\n this.updateConstraints();\n }\n return size;\n }\n get snap() {\n return this._snap;\n }\n constructor(id, componentName) {\n super(id, componentName, new SplitviewPanelApiImpl(id, componentName));\n this._evaluatedMinimumSize = 0;\n this._evaluatedMaximumSize = Number.POSITIVE_INFINITY;\n this._minimumSize = 0;\n this._maximumSize = Number.POSITIVE_INFINITY;\n this._snap = false;\n this._onDidChange = new Emitter();\n this.onDidChange = this._onDidChange.event;\n this.api.initialize(this);\n this.addDisposables(this._onDidChange, this.api.onWillVisibilityChange((event) => {\n const { isVisible } = event;\n const { accessor } = this._params;\n accessor.setVisible(this, isVisible);\n }), this.api.onActiveChange(() => {\n const { accessor } = this._params;\n accessor.setActive(this);\n }), this.api.onDidConstraintsChangeInternal((event) => {\n if (typeof event.minimumSize === 'number' ||\n typeof event.minimumSize === 'function') {\n this._minimumSize = event.minimumSize;\n }\n if (typeof event.maximumSize === 'number' ||\n typeof event.maximumSize === 'function') {\n this._maximumSize = event.maximumSize;\n }\n this.updateConstraints();\n }), this.api.onDidSizeChange((event) => {\n this._onDidChange.fire({ size: event.size });\n }));\n }\n setVisible(isVisible) {\n this.api._onDidVisibilityChange.fire({ isVisible });\n }\n setActive(isActive) {\n this.api._onDidActiveChange.fire({ isActive });\n }\n layout(size, orthogonalSize) {\n const [width, height] = this.orientation === Orientation.HORIZONTAL\n ? [size, orthogonalSize]\n : [orthogonalSize, size];\n super.layout(width, height);\n }\n init(parameters) {\n super.init(parameters);\n this._priority = parameters.priority;\n if (parameters.minimumSize) {\n this._minimumSize = parameters.minimumSize;\n }\n if (parameters.maximumSize) {\n this._maximumSize = parameters.maximumSize;\n }\n if (parameters.snap) {\n this._snap = parameters.snap;\n }\n }\n toJSON() {\n const maximum = (value) => value === Number.MAX_SAFE_INTEGER ||\n value === Number.POSITIVE_INFINITY\n ? undefined\n : value;\n const minimum = (value) => (value <= 0 ? undefined : value);\n return Object.assign(Object.assign({}, super.toJSON()), { minimumSize: minimum(this.minimumSize), maximumSize: maximum(this.maximumSize) });\n }\n updateConstraints() {\n this.api._onDidConstraintsChange.fire({\n maximumSize: this._evaluatedMaximumSize,\n minimumSize: this._evaluatedMinimumSize,\n });\n }\n}\n\nfunction createDockview(element, options) {\n const component = new DockviewComponent(element, options);\n return component.api;\n}\nfunction createSplitview(element, options) {\n const component = new SplitviewComponent(element, options);\n return new SplitviewApi(component);\n}\nfunction createGridview(element, options) {\n const component = new GridviewComponent(element, options);\n return new GridviewApi(component);\n}\nfunction createPaneview(element, options) {\n const component = new PaneviewComponent(element, options);\n return new PaneviewApi(component);\n}\n\nexport { BaseGrid, ContentContainer, DEFAULT_TAB_GROUP_COLORS, DefaultDockviewDeserialzier, DefaultTab, DockviewApi, DockviewComponent, CompositeDisposable as DockviewCompositeDisposable, DockviewDidDropEvent, Disposable as DockviewDisposable, Emitter as DockviewEmitter, Event as DockviewEvent, DockviewGroupPanel, DockviewGroupPanelModel, MutableDisposable as DockviewMutableDisposable, DockviewPanel, DockviewUnhandledDragOverEvent, DockviewWillDropEvent, DockviewWillShowOverlayLocationEvent, DraggablePaneviewPanel, Gridview, GridviewApi, GridviewComponent, GridviewPanel, LayoutPriority, LiveRegionModule, Orientation, PROPERTY_KEYS_DOCKVIEW, PROPERTY_KEYS_GRIDVIEW, PROPERTY_KEYS_PANEVIEW, PROPERTY_KEYS_SPLITVIEW, PaneFramework, PaneTransfer, PanelTransfer, Paneview, PaneviewApi, PaneviewComponent, PaneviewPanel, PaneviewUnhandledDragOverEvent, SashState, Sizing, Splitview, SplitviewApi, SplitviewComponent, SplitviewPanel, Tab, TabGroupColorPalette, applyTabGroupAccent, clearRegisteredModules, createDockview, createGridview, createPaneview, createSplitview, defineModule, directionToPosition, findRelativeZIndexParent, getDirectionOrientation, getGridLocation, getLocationOrientation, getPaneData, getPanelData, getRegisteredModules, getRelativeLocation, indexInParent, isDockviewPackageLoaded, isGridBranchNode, isGroupOptionsWithGroup, isGroupOptionsWithPanel, isPanelOptionsWithGroup, isPanelOptionsWithPanel, markDockviewPackageLoaded, orthogonal, positionToDirection, registerModules, resolveMessages, resolveTabGroupAccent, themeAbyss, themeAbyssSpaced, themeCatppuccinMocha, themeCatppuccinMochaSpaced, themeDark, themeDracula, themeGithubDark, themeGithubDarkSpaced, themeGithubLight, themeGithubLightSpaced, themeLight, themeLightSpaced, themeMonokai, themeNord, themeNordSpaced, themeSolarizedLight, themeSolarizedLightSpaced, themeVisualStudio, toTarget };\n","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","/**\n * dockview\n * @version 7.0.2\n * @link https://github.com/mathuo/dockview\n * @license MIT\n */\nimport { defineModule, DockviewCompositeDisposable, DockviewDisposable, findRelativeZIndexParent, LiveRegionModule, resolveMessages, registerModules, markDockviewPackageLoaded } from 'dockview-core';\nexport * from 'dockview-core';\n\n/**\n * dockview-modules\n * @version 7.0.2\n * @link https://github.com/mathuo/dockview\n * @license MIT\n */\n\nclass TabGroupChipsService {\n constructor(host) {\n this._host = host;\n }\n attachToGroup(group) {\n return new DockviewCompositeDisposable(group.model.onDidCreateTabGroup((e) => {\n this._host.fireDidCreateTabGroup(e);\n }), group.model.onDidDestroyTabGroup((e) => {\n this._host.fireDidDestroyTabGroup(e);\n }), group.model.onDidAddPanelToTabGroup((e) => {\n this._host.fireDidAddPanelToTabGroup(e);\n }), group.model.onDidRemovePanelFromTabGroup((e) => {\n this._host.fireDidRemovePanelFromTabGroup(e);\n }), group.model.onDidTabGroupChange((e) => {\n this._host.fireDidTabGroupChange(e);\n }), group.model.onDidTabGroupCollapsedChange((e) => {\n this._host.fireDidTabGroupCollapsedChange(e);\n }));\n }\n dispose() {\n // No internal state to tear down — emitters live on the host.\n }\n}\nconst TabGroupChipsModule = defineModule({\n name: 'TabGroupChips',\n serviceKey: 'tabGroupChipsService',\n create: (host) => new TabGroupChipsService(host),\n init: (host, service) => {\n // Self-attach to existing and future groups; tear down when groups\n // are removed. Component doesn't need to know about this wiring.\n const perGroupDisposables = new Map();\n return new DockviewCompositeDisposable(host.onDidAddGroup((group) => {\n perGroupDisposables.set(group, service.attachToGroup(group));\n }), host.onDidRemoveGroup((group) => {\n var _a;\n (_a = perGroupDisposables.get(group)) === null || _a === void 0 ? void 0 : _a.dispose();\n perGroupDisposables.delete(group);\n }), {\n dispose: () => {\n for (const d of perGroupDisposables.values()) {\n d.dispose();\n }\n perGroupDisposables.clear();\n },\n });\n },\n});\n\nfunction popoverZIndexFor(target) {\n if (!(target instanceof HTMLElement)) {\n return undefined;\n }\n // Floating overlays live in the shell as siblings of the popover anchor\n // and the AriaLevelTracker sets their inline z-index. Without this, a\n // popover opened from inside a floating group would render behind it\n // because they share the shell stacking context.\n const relativeParent = findRelativeZIndexParent(target);\n return (relativeParent === null || relativeParent === void 0 ? void 0 : relativeParent.style.zIndex)\n ? `calc(${relativeParent.style.zIndex} * 2)`\n : undefined;\n}\nlet _nextId = 0;\nconst nextContextMenuItemId = () => `dv-ctx-menu-item-${_nextId++}`;\nfunction isItemConfig(item) {\n return typeof item === 'object';\n}\nfunction buildItem(label, close, action, disabled) {\n const el = document.createElement('div');\n el.className = 'dv-context-menu-item';\n el.setAttribute('role', 'menuitem');\n if (disabled) {\n el.classList.add('dv-context-menu-item--disabled');\n el.setAttribute('aria-disabled', 'true');\n }\n el.textContent = label;\n if (!disabled) {\n el.addEventListener('click', () => {\n action();\n close();\n });\n }\n return el;\n}\nfunction buildSeparator() {\n const el = document.createElement('div');\n el.className = 'dv-context-menu-separator';\n el.setAttribute('role', 'separator');\n return el;\n}\nfunction isCoarsePrimaryInput() {\n if (typeof window === 'undefined' || !window.matchMedia) {\n return false;\n }\n const coarse = window.matchMedia('(pointer: coarse)').matches;\n const fine = window.matchMedia('(pointer: fine)').matches;\n return coarse && !fine;\n}\nfunction buildRenameInput(tabGroup) {\n const wrapper = document.createElement('div');\n wrapper.className = 'dv-context-menu-rename';\n const input = document.createElement('input');\n input.className = 'dv-context-menu-rename-input';\n input.type = 'text';\n input.placeholder = 'Name This Group';\n input.value = tabGroup.label;\n input.addEventListener('input', () => {\n tabGroup.setLabel(input.value);\n });\n input.addEventListener('keydown', (e) => {\n if (e.key !== 'Escape' && e.key !== 'Enter') {\n e.stopPropagation();\n }\n });\n input.addEventListener('click', (e) => {\n e.stopPropagation();\n });\n wrapper.appendChild(input);\n // Skip auto-focus on touch-primary devices: focusing the input pops the\n // on-screen keyboard, which fires `window resize`, which `PopupService`\n // listens to and uses to dismiss the popover — so the menu opens, the\n // keyboard appears, and the menu immediately closes before the user can\n // type. The user can still tap the input to focus it intentionally.\n if (!isCoarsePrimaryInput()) {\n requestAnimationFrame(() => {\n input.focus();\n input.select();\n });\n }\n return wrapper;\n}\nfunction buildColorPicker(tabGroup, palette) {\n const wrapper = document.createElement('div');\n wrapper.className = 'dv-context-menu-color-picker';\n if (!palette.enabled) {\n // Opt-out: render no swatches. Returning a wrapper rather than null\n // keeps the call site simple; the wrapper is empty and visually inert.\n return wrapper;\n }\n for (const entry of palette.entries()) {\n const swatch = document.createElement('div');\n swatch.className = 'dv-context-menu-color-swatch';\n // Use a CSS custom property rather than setting `backgroundColor`\n // directly: the IDL setter validates the value against a color\n // grammar and rejects `var(...)` references in some environments\n // (notably jsdom; some browsers have historically had similar\n // quirks). The matching SCSS rule reads the var at use time.\n swatch.style.setProperty('--dv-tab-group-color', entry.value);\n if (entry.label) {\n swatch.title = entry.label;\n }\n if (tabGroup.color === entry.id) {\n swatch.classList.add('dv-context-menu-color-swatch--selected');\n }\n swatch.addEventListener('click', () => {\n tabGroup.setColor(entry.id);\n });\n wrapper.appendChild(swatch);\n }\n return wrapper;\n}\nclass ContextMenuController {\n constructor(accessor) {\n this.accessor = accessor;\n }\n show(panel, group, event) {\n var _a, _b;\n if (!this.accessor.options.getTabContextMenuItems) {\n return;\n }\n const items = this.accessor.options.getTabContextMenuItems({\n panel,\n group,\n api: this.accessor.api,\n event,\n });\n if (items.length === 0) {\n return;\n }\n event.preventDefault();\n const popupService = this.accessor.getPopupServiceForGroup(group);\n const close = () => popupService.close();\n const menuEl = document.createElement('div');\n menuEl.className = 'dv-context-menu';\n menuEl.setAttribute('role', 'menu');\n for (const item of items) {\n if (item === 'separator') {\n menuEl.appendChild(buildSeparator());\n }\n else if (item === 'close') {\n menuEl.appendChild(buildItem('Close', close, () => panel.api.close()));\n }\n else if (item === 'closeOthers') {\n menuEl.appendChild(buildItem('Close Others', close, () => {\n group.panels\n .filter((p) => p !== panel)\n .forEach((p) => p.api.close());\n }));\n }\n else if (item === 'closeAll') {\n menuEl.appendChild(buildItem('Close All', close, () => {\n [...group.panels].forEach((p) => p.api.close());\n }));\n }\n else if (isItemConfig(item) && item.element) {\n menuEl.appendChild(item.element);\n }\n else if (isItemConfig(item) && item.component) {\n const renderer = (_b = (_a = this.accessor.options).createContextMenuItemComponent) === null || _b === void 0 ? void 0 : _b.call(_a, {\n id: nextContextMenuItemId(),\n component: item.component,\n });\n if (renderer) {\n renderer.init({\n panel,\n group,\n api: this.accessor.api,\n close,\n componentProps: item.componentProps,\n });\n menuEl.appendChild(renderer.element);\n }\n }\n else if (isItemConfig(item) && item.label) {\n menuEl.appendChild(buildItem(item.label, close, () => { var _a; return (_a = item.action) === null || _a === void 0 ? void 0 : _a.call(item); }, item.disabled));\n }\n }\n popupService.openPopover(menuEl, {\n x: event.clientX,\n y: event.clientY,\n zIndex: popoverZIndexFor(event.target),\n });\n }\n showForChip(tabGroup, group, event) {\n if (!this.accessor.options.getTabGroupChipContextMenuItems) {\n return;\n }\n const items = this.accessor.options.getTabGroupChipContextMenuItems({\n tabGroup,\n group,\n api: this.accessor.api,\n event,\n });\n if (items.length === 0) {\n return;\n }\n event.preventDefault();\n const popupService = this.accessor.getPopupServiceForGroup(group);\n const close = () => popupService.close();\n const menuEl = document.createElement('div');\n menuEl.className = 'dv-context-menu';\n menuEl.setAttribute('role', 'menu');\n for (const item of items) {\n if (item === 'separator') {\n menuEl.appendChild(buildSeparator());\n }\n else if (item === 'rename') {\n menuEl.appendChild(buildRenameInput(tabGroup));\n }\n else if (item === 'colorPicker') {\n menuEl.appendChild(buildColorPicker(tabGroup, this.accessor.tabGroupColorPalette));\n }\n else if (isItemConfig(item) && item.element) {\n menuEl.appendChild(item.element);\n }\n else if (isItemConfig(item) && item.label) {\n menuEl.appendChild(buildItem(item.label, close, () => { var _a; return (_a = item.action) === null || _a === void 0 ? void 0 : _a.call(item); }, item.disabled));\n }\n }\n popupService.openPopover(menuEl, {\n x: event.clientX,\n y: event.clientY,\n zIndex: popoverZIndexFor(event.target),\n });\n }\n}\nconst ContextMenuModule = defineModule({\n name: 'ContextMenu',\n serviceKey: 'contextMenuService',\n create: (host) => new ContextMenuController(host),\n});\n\n/** Cursor offset of the group drag ghost, matched to the long-shipped default. */\nconst GROUP_DRAG_GHOST_OFFSET_X = 30;\nconst GROUP_DRAG_GHOST_OFFSET_Y = -10;\n/**\n * The narrow surface the {@link AdvancedDnDService} needs from the host\n * (the `DockviewComponent`).\n *\n * The `onWill*` emitters stay on the component so the public event shape is\n * unchanged whether or not this module is registered — the service is only the\n * dispatch point those fires are routed through. Engine policy (e.g. the\n * `disableDnd` guard) stays on the component, ahead of the dispatch.\n */\n/**\n * Owns the dispatch of the advanced drag-and-drop hooks — `onWillDragPanel`,\n * `onWillDragGroup`, `onWillDrop` and `onWillShowOverlay`.\n *\n * At this stage the service is a thin dispatcher that forwards to the host's\n * emitters; the customisation surface it gates (custom drop overlays, custom\n * group drag ghosts, hook veto/transform behaviour) is currently inlined in\n * core and is extracted into this service in later phases. Routing the\n * dispatch through a module slot is what lets that customisation layer move\n * into a separately-distributed package in a future major version without\n * changing the public event surface.\n *\n * The service holds no drag state of its own — the gesture is driven by the\n * DnD backends, and the per-group subscriptions live on the component's group\n * lifecycle (so groups created mid-move are not missed).\n */\nclass AdvancedDnDService {\n constructor(host) {\n this.host = host;\n }\n dispatchWillDragPanel(event) {\n this.host.fireWillDragPanel(event);\n }\n dispatchWillDragGroup(event) {\n this.host.fireWillDragGroup(event);\n }\n dispatchWillDrop(event) {\n this.host.fireWillDrop(event);\n }\n dispatchWillShowOverlay(event) {\n this.host.fireWillShowOverlay(event);\n }\n buildGroupDragGhost(group) {\n const createGhost = this.host.options.createGroupDragGhostComponent;\n if (!createGhost) {\n return undefined;\n }\n const renderer = createGhost(group);\n renderer.init({ group, api: this.host.api });\n return {\n element: renderer.element,\n offsetX: GROUP_DRAG_GHOST_OFFSET_X,\n offsetY: GROUP_DRAG_GHOST_OFFSET_Y,\n dispose: renderer.dispose ? () => { var _a; return (_a = renderer.dispose) === null || _a === void 0 ? void 0 : _a.call(renderer); } : undefined,\n };\n }\n resolveOverlayModel(location, group) {\n var _a, _b;\n return (_b = (_a = this.host.options).dropOverlayModel) === null || _b === void 0 ? void 0 : _b.call(_a, { location, group });\n }\n showPreviewOverlay(group, position) {\n const target = group.model.contentDropTarget;\n target.showOverlay(position);\n return DockviewDisposable.from(() => target.clearOverlay());\n }\n dispose() {\n // no-op — see class doc: the service holds no state to tear down.\n }\n}\nconst AdvancedDnDModule = defineModule({\n name: 'AdvancedDnD',\n serviceKey: 'advancedDnDService',\n create: (host) => new AdvancedDnDService(host),\n});\n\n/**\n * Marks (on the dockview root element) that a keyboard move is in progress, so\n * the default navigation listener stands down while the advanced docking module\n * drives the keys. A neutral DOM signal keeps the two listeners coordinated\n * without either service holding a reference to the other.\n */\nconst KEYBOARD_MOVE_ATTRIBUTE = 'data-dv-kbd-moving';\n/**\n * Does `e` match a binding string like `'ctrl+]'` / `'shift+f6'`? Modifiers are\n * matched exactly (a binding without `shift` will not fire while Shift is held),\n * and the final part is compared to `KeyboardEvent.key`, lower-cased.\n */\nfunction matchesBinding(e, binding) {\n const parts = binding.toLowerCase().split('+');\n const key = parts[parts.length - 1];\n const mods = parts.slice(0, -1);\n return (e.ctrlKey === mods.includes('ctrl') &&\n e.shiftKey === mods.includes('shift') &&\n e.altKey === mods.includes('alt') &&\n e.metaKey === (mods.includes('meta') || mods.includes('cmd')) &&\n e.key.toLowerCase() === key);\n}\n/**\n * Resolve the `keyboardNavigation` opt-in to its options object, or `undefined`\n * when keyboard support is off. Both keyboard modules read the same opt-in.\n */\nfunction readKeyboardNavigation(options) {\n const opt = options.keyboardNavigation;\n if (!opt) {\n return undefined;\n }\n return opt === true ? {} : opt;\n}\n\nconst DEFAULT_KEYMAP$1 = {\n nextTab: 'ctrl+]',\n prevTab: 'ctrl+[',\n focusNextGroup: 'f6',\n focusPrevGroup: 'shift+f6',\n focusTabs: 'ctrl+shift+\\\\',\n};\n/**\n * Keyboard navigation & focus management — operate the dock without a mouse.\n * Opt-in via `keyboardNavigation`, with a rebindable {@link DockviewKeybindings}\n * keymap.\n *\n * - **Switch tab** (`Ctrl+]` / `Ctrl+[`) — cycle the focused group's tabs.\n * - **Focus group** (`F6` / `Shift+F6`) — move focus to the next / previous\n * group in sequence.\n * - **Focus the tab strip** (`Ctrl+Shift+\\`) — jump focus from panel content to\n * the active group's tab strip (the strip's roving-tabindex takes over).\n * - **Focus restore on close** — when removing a panel/group pulls focus out of\n * the dock, focus returns to the neighbour the layout just activated instead\n * of being stranded on `<body>`.\n * - **Floating `Esc`** — `Esc` inside a floating group returns focus to the\n * control that had it before entering the float (polite: bubble phase,\n * respects `defaultPrevented`, so panel content keeps `Esc`).\n * - **Floating Tab-containment** — Tab wraps within the floating group so focus\n * doesn't leak to the grid behind it.\n *\n * Stands down while an advanced keyboard move is in progress (see\n * {@link KEYBOARD_MOVE_ATTRIBUTE}) so the docking module owns the keys then.\n */\nclass AccessibilityService extends DockviewCompositeDisposable {\n constructor(host) {\n super();\n this.host = host;\n this._focusWasInside = false;\n // Listen on the document (capture) rather than the dockview element:\n // edge groups live in the shell *outside* the gridview, and the shell\n // is created after this service, so a fixed element would miss them.\n const doc = host.rootElement.ownerDocument;\n const onKeyDown = (e) => this._onKeyDown(e);\n doc.addEventListener('keydown', onKeyDown, true);\n // Remember the last control focused in the main dock (outside any\n // float) so Esc inside a floating group can return focus to its\n // invoking control. Observe-only — never consumes.\n const onFocusIn = (e) => {\n const t = e.target;\n if (t instanceof HTMLElement &&\n this.host.rootElement.contains(t) &&\n !t.closest('[role=\"dialog\"]')) {\n this._lastNonFloatFocus = t;\n }\n };\n doc.addEventListener('focusin', onFocusIn, true);\n // Esc-from-float restore runs in the BUBBLE phase and respects\n // defaultPrevented, so panel content that uses Esc keeps priority.\n const onEscape = (e) => this._onFloatingEscape(e);\n doc.addEventListener('keydown', onEscape, false);\n this.addDisposables({\n dispose: () => doc.removeEventListener('keydown', onKeyDown, true),\n }, {\n dispose: () => doc.removeEventListener('focusin', onFocusIn, true),\n }, {\n dispose: () => doc.removeEventListener('keydown', onEscape, false),\n }, \n // When a close pulls focus out of the dock, return it to the\n // neighbour the component just activated rather than leaving it\n // stranded on <body>. Snapshot before the teardown (focus still on\n // the closing panel), restore after.\n host.onWillMutateLayout((e) => {\n if (e.kind === 'remove' && this._nav) {\n this._focusWasInside = this._isFocusInside();\n }\n }), host.onDidMutateLayout((e) => {\n if (e.kind === 'remove' &&\n this._nav &&\n this._focusWasInside &&\n !this._isFocusInside()) {\n this._restoreFocus();\n }\n }));\n }\n get _moveActive() {\n return this.host.rootElement.hasAttribute(KEYBOARD_MOVE_ATTRIBUTE);\n }\n _isFocusInside() {\n const active = this.host.rootElement.ownerDocument.activeElement;\n return active instanceof Node && this.host.rootElement.contains(active);\n }\n _onFloatingEscape(e) {\n if (!this._nav ||\n this._moveActive ||\n e.defaultPrevented ||\n e.key !== 'Escape') {\n return;\n }\n const target = e.target;\n if (!(target instanceof Element)) {\n return;\n }\n // Only when focus is inside one of *this* dock's floating groups.\n const float = target.closest('[role=\"dialog\"]');\n if (!float || !this.host.rootElement.contains(float)) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n this._returnFocusFromFloat();\n }\n /**\n * Keep Tab inside the floating group that holds focus: at the last tabbable\n * Tab wraps to the first, at the first Shift+Tab wraps to the last. Returns\n * true if it handled the event. No-op outside a float.\n */\n _trapFloatTab(e) {\n const target = e.target;\n if (!(target instanceof Element)) {\n return false;\n }\n const float = target.closest('[role=\"dialog\"]');\n if (!float || !this.host.rootElement.contains(float)) {\n return false;\n }\n // Always manage Tab inside a float, never just at the boundary: focus\n // often sits on non-tabbable plumbing (the content container, which is\n // tabindex=\"-1\"), and the browser's default Tab from there escapes to\n // the grid behind. Drive the cursor through the float's tabbables\n // ourselves and swallow the default so it can't leak out.\n e.preventDefault();\n const tabbables = this._tabbables(float);\n if (tabbables.length === 0) {\n return true;\n }\n const active = float.ownerDocument.activeElement;\n const index = active instanceof HTMLElement ? tabbables.indexOf(active) : -1;\n const n = tabbables.length;\n const next = index === -1\n ? e.shiftKey\n ? n - 1\n : 0\n : (index + (e.shiftKey ? -1 : 1) + n) % n;\n tabbables[next].focus();\n return true;\n }\n _tabbables(root) {\n const nodes = root.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), ' +\n 'select:not([disabled]), textarea:not([disabled]), [tabindex]');\n // tabIndex >= 0 keeps naturally-focusable controls and roving anchors\n // (the active tab) while dropping tabindex=\"-1\" plumbing (content\n // containers, inactive tabs).\n return Array.from(nodes).filter((el) => el.tabIndex >= 0);\n }\n _returnFocusFromFloat() {\n var _a;\n const prev = this._lastNonFloatFocus;\n if (prev &&\n prev.isConnected &&\n this.host.rootElement.contains(prev) &&\n !prev.closest('[role=\"dialog\"]')) {\n prev.focus();\n return;\n }\n // Invoking control is gone — fall back to a grid group's content.\n (_a = this.host.groups\n .find((g) => g.api.location.type === 'grid')) === null || _a === void 0 ? void 0 : _a.model.focusContent();\n }\n get _nav() {\n return readKeyboardNavigation(this.host.options);\n }\n get _keymap() {\n var _a;\n return Object.assign(Object.assign({}, DEFAULT_KEYMAP$1), (_a = this._nav) === null || _a === void 0 ? void 0 : _a.keymap);\n }\n _onKeyDown(e) {\n if (!this._nav) {\n return;\n }\n // Stand down while the docking module is driving a keyboard move.\n if (this._moveActive) {\n return;\n }\n // Only act on events originating inside *this* dockview.\n if (!(e.target instanceof Node) ||\n !this.host.rootElement.contains(e.target)) {\n return;\n }\n // Trap Tab within a floating group so focus doesn't leak to the grid\n // behind it (the float is non-modal, but its Tab order should be).\n if (e.key === 'Tab' && this._trapFloatTab(e)) {\n return;\n }\n const keymap = this._keymap;\n if (matchesBinding(e, keymap.nextTab)) {\n this._consume(e);\n this._switchTab(false);\n }\n else if (matchesBinding(e, keymap.prevTab)) {\n this._consume(e);\n this._switchTab(true);\n }\n else if (matchesBinding(e, keymap.focusNextGroup)) {\n this._consume(e);\n this._cycleGroup(false);\n }\n else if (matchesBinding(e, keymap.focusPrevGroup)) {\n this._consume(e);\n this._cycleGroup(true);\n }\n else if (matchesBinding(e, keymap.focusTabs)) {\n this._consume(e);\n this._focusTabs();\n }\n }\n // --- navigation (uses the public group API + the adjacentGroup primitive) ---\n _focusTabs() {\n var _a;\n // Jump from panel content to the active group's tab strip; the\n // tablist's own roving-tabindex handler takes over from there.\n (_a = this.host.activeGroup) === null || _a === void 0 ? void 0 : _a.model.focusActiveTab();\n }\n _switchTab(reverse) {\n const group = this.host.activeGroup;\n if (!group) {\n return;\n }\n if (reverse) {\n group.model.moveToPrevious();\n }\n else {\n group.model.moveToNext();\n }\n // Keep DOM focus inside the dock: switching hides the previously\n // focused content, which would otherwise drop focus to <body> and\n // leave the keymap unable to see the next key.\n group.model.focusContent();\n }\n _cycleGroup(reverse) {\n const current = this.host.activeGroup;\n const target = current\n ? this.host.adjacentGroup(current, reverse)\n : this.host.groups[0];\n this._focusGroup(target);\n }\n _focusGroup(target) {\n if (!target) {\n return;\n }\n target.api.setActive();\n target.model.focusContent();\n }\n /** Return DOM focus to the active group's content, keeping it in the dock. */\n _restoreFocus() {\n var _a;\n (_a = this.host.activeGroup) === null || _a === void 0 ? void 0 : _a.model.focusContent();\n }\n _consume(e) {\n e.preventDefault();\n e.stopPropagation();\n }\n}\nconst AccessibilityModule = defineModule({\n name: 'Accessibility',\n serviceKey: 'accessibilityService',\n create: (host) => new AccessibilityService(host),\n});\n\nconst EDGE_FROM_KEY = {\n ArrowLeft: 'left',\n ArrowRight: 'right',\n ArrowUp: 'top',\n ArrowDown: 'bottom',\n};\nconst DEFAULT_KEYMAP = {\n focusGroupLeft: 'ctrl+shift+arrowleft',\n focusGroupRight: 'ctrl+shift+arrowright',\n focusGroupUp: 'ctrl+shift+arrowup',\n focusGroupDown: 'ctrl+shift+arrowdown',\n dock: 'ctrl+m',\n};\n/**\n * Advanced keyboard control — drive the layout itself without a mouse. Opt-in\n * via `keyboardNavigation` (shared with the default navigation module).\n *\n * - **Spatial group focus** (`Ctrl+Shift+Arrows`) — move focus to the visually\n * adjacent group via the `adjacentGroupInDirection` geometry primitive.\n * - **Keyboard docking** (`Ctrl+M`) — arms a two-phase move of the active panel\n * with a live drop preview + screen-reader narration:\n * 1. PICK TARGET — arrows cycle the groups (incl. the panel's own, so a tab\n * can be split out); `Enter` selects one.\n * 2. PICK EDGE — arrows choose a split edge (left/right/top/bottom) or the\n * centre (tab-into); `Enter` commits, `Escape` steps back.\n * `Escape` from the target phase cancels.\n *\n * While a move is in progress it marks the root with\n * {@link KEYBOARD_MOVE_ATTRIBUTE} so the default navigation listener stands\n * down and the move keys aren't double-handled.\n */\nclass KeyboardDockingService extends DockviewCompositeDisposable {\n constructor(host) {\n super();\n this.host = host;\n this._move = null;\n // Capture phase, on the document — matches the navigation listener so\n // edge groups (outside the gridview) are covered.\n const doc = host.rootElement.ownerDocument;\n const onKeyDown = (e) => this._onKeyDown(e);\n doc.addEventListener('keydown', onKeyDown, true);\n this.addDisposables({ dispose: () => this._exit() }, {\n dispose: () => doc.removeEventListener('keydown', onKeyDown, true),\n });\n }\n get _enabled() {\n return !!readKeyboardNavigation(this.host.options);\n }\n get _keymap() {\n var _a, _b, _c, _d, _e, _f, _g;\n // The public `keyboardNavigation.keymap` carries the default-navigation\n // bindings; this module's bindings are read from the same object when\n // present (so a consumer can rebind them too).\n const overrides = ((_b = (_a = readKeyboardNavigation(this.host.options)) === null || _a === void 0 ? void 0 : _a.keymap) !== null && _b !== void 0 ? _b : {});\n return {\n focusGroupLeft: (_c = overrides.focusGroupLeft) !== null && _c !== void 0 ? _c : DEFAULT_KEYMAP.focusGroupLeft,\n focusGroupRight: (_d = overrides.focusGroupRight) !== null && _d !== void 0 ? _d : DEFAULT_KEYMAP.focusGroupRight,\n focusGroupUp: (_e = overrides.focusGroupUp) !== null && _e !== void 0 ? _e : DEFAULT_KEYMAP.focusGroupUp,\n focusGroupDown: (_f = overrides.focusGroupDown) !== null && _f !== void 0 ? _f : DEFAULT_KEYMAP.focusGroupDown,\n dock: (_g = overrides.dock) !== null && _g !== void 0 ? _g : DEFAULT_KEYMAP.dock,\n };\n }\n get _messages() {\n return resolveMessages(this.host.options.messages);\n }\n _onKeyDown(e) {\n if (!this._enabled) {\n return;\n }\n if (this._move) {\n this._onMoveKey(e);\n return;\n }\n // Only act on events originating inside *this* dockview.\n if (!(e.target instanceof Node) ||\n !this.host.rootElement.contains(e.target)) {\n return;\n }\n const keymap = this._keymap;\n if (matchesBinding(e, keymap.dock)) {\n this._enterMoveMode(e);\n }\n else if (matchesBinding(e, keymap.focusGroupLeft)) {\n this._consume(e);\n this._focusGroupInDirection('left');\n }\n else if (matchesBinding(e, keymap.focusGroupRight)) {\n this._consume(e);\n this._focusGroupInDirection('right');\n }\n else if (matchesBinding(e, keymap.focusGroupUp)) {\n this._consume(e);\n this._focusGroupInDirection('up');\n }\n else if (matchesBinding(e, keymap.focusGroupDown)) {\n this._consume(e);\n this._focusGroupInDirection('down');\n }\n }\n // --- spatial focus ---\n _focusGroupInDirection(direction) {\n const current = this.host.activeGroup;\n if (!current) {\n return;\n }\n // Geometry lives on the host as the shared `adjacentGroupInDirection`\n // primitive (also public on the api), so mouse and keyboard navigation\n // agree on what \"the group to the left\" is.\n this._focusGroup(this.host.adjacentGroupInDirection(current, direction));\n }\n _focusGroup(target) {\n if (!target) {\n return;\n }\n target.api.setActive();\n target.model.focusContent();\n }\n _restoreFocus() {\n var _a;\n (_a = this.host.activeGroup) === null || _a === void 0 ? void 0 : _a.model.focusContent();\n }\n // --- keyboard docking (move mode) ---\n _enterMoveMode(e) {\n const source = this.host.activePanel;\n const groups = this.host.groups;\n if (!source || groups.length === 0) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n // Start on the panel's own group so a single group of tabs can still\n // split a tab out via the edge phase.\n const groupIndex = Math.max(0, groups.indexOf(source.group));\n this._move = {\n source,\n groups,\n groupIndex,\n phase: 'target',\n position: 'center',\n };\n // Signal the navigation module to stand down while the move runs.\n this.host.rootElement.setAttribute(KEYBOARD_MOVE_ATTRIBUTE, '');\n this._render();\n }\n _onMoveKey(e) {\n const move = this._move;\n if (e.key === 'Escape') {\n this._consume(e);\n if (move.phase === 'edge') {\n move.phase = 'target';\n move.position = 'center';\n this._render();\n }\n else {\n this._exit();\n this.host.announce(this._messages.moveCancelled());\n this._restoreFocus();\n }\n return;\n }\n if (e.key === 'Enter') {\n this._consume(e);\n if (move.phase === 'target') {\n move.phase = 'edge';\n move.position = 'center';\n this._render();\n }\n else {\n this._commit();\n }\n return;\n }\n if (move.phase === 'target') {\n const n = move.groups.length;\n if (e.key === 'ArrowRight' || e.key === 'ArrowDown') {\n this._consume(e);\n move.groupIndex = (move.groupIndex + 1) % n;\n this._render();\n }\n else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') {\n this._consume(e);\n move.groupIndex = (move.groupIndex - 1 + n) % n;\n this._render();\n }\n return;\n }\n // edge phase\n const edge = EDGE_FROM_KEY[e.key];\n if (edge) {\n this._consume(e);\n move.position = edge;\n this._render();\n }\n else if (e.key === ' ' || e.key === 'c' || e.key === 'C') {\n this._consume(e);\n move.position = 'center';\n this._render();\n }\n }\n _render() {\n var _a, _b;\n const move = this._move;\n const group = move.groups[move.groupIndex];\n this._clearPreview();\n this._preview = this.host.showDropPreview(group, move.position);\n const name = (_b = (_a = group.activePanel) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : group.id;\n const m = this._messages;\n if (move.phase === 'target') {\n this.host.announce(m.movePickTarget(this._label(move.source), name, move.groupIndex + 1, move.groups.length));\n }\n else {\n this.host.announce(m.movePickEdge(move.position, name));\n }\n }\n _commit() {\n var _a, _b;\n const move = this._move;\n const group = move.groups[move.groupIndex];\n const position = move.position;\n const source = move.source;\n const name = (_b = (_a = group.activePanel) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : group.id;\n const m = this._messages;\n this._exit();\n try {\n this.host.dockPanel(source, group, position);\n this.host.announce(m.moveCommitted(this._label(source), name, position));\n }\n catch (_c) {\n this.host.announce(m.moveNotAllowed());\n }\n // The move re-renders the grid; pull focus back into the dock so the\n // keymap keeps working without a click.\n this._restoreFocus();\n }\n _exit() {\n this._clearPreview();\n this._move = null;\n this.host.rootElement.removeAttribute(KEYBOARD_MOVE_ATTRIBUTE);\n }\n _clearPreview() {\n var _a;\n (_a = this._preview) === null || _a === void 0 ? void 0 : _a.dispose();\n this._preview = undefined;\n }\n _consume(e) {\n e.preventDefault();\n e.stopPropagation();\n }\n _label(panel) {\n var _a;\n return (_a = panel.title) !== null && _a !== void 0 ? _a : panel.id;\n }\n}\ndefineModule({\n name: 'KeyboardDocking',\n serviceKey: 'keyboardDockingService',\n create: (host) => new KeyboardDockingService(host),\n dependsOn: [AdvancedDnDModule, LiveRegionModule],\n});\n\n/**\n * The set of modules provided by this package. `dockview` registers these via\n * `registerModules(Modules)` so they are available to every component.\n */\nconst Modules = [\n TabGroupChipsModule,\n ContextMenuModule,\n AdvancedDnDModule,\n AccessibilityModule,\n];\n\n/**\n * `dockview` is the batteries-included entry point: it re-exports the core API\n * and registers the separable feature modules so every component gets the full\n * feature set out of the box. Consumers who want only the core can depend on\n * `dockview-core` directly.\n */\nregisterModules(Modules);\n// Mark the public package as loaded so `dockview-core` doesn't warn about\n// direct usage. Purely drives that developer warning — no functional effect.\nmarkDockviewPackageLoaded();\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport { DockviewDisposable, } from 'dockview';\n/**\n * This component is intended to interface between vanilla-js and React hence we need to be\n * creative in how we update props.\n * A ref of the component is exposed with an update method; which when called stores the props\n * as a ref within this component and forcefully triggers a re-render of the component using\n * the ref of props we just set on the renderered component as the props passed to the inner\n * component\n */\nconst ReactComponentBridge = (props, ref) => {\n const [, triggerRender] = React.useState(0);\n const _props = React.useRef(props.componentProps);\n React.useImperativeHandle(ref, () => ({\n update: (componentProps) => {\n _props.current = Object.assign(Object.assign({}, _props.current), componentProps);\n /**\n * setting a arbitrary piece of state within this component will\n * trigger a re-render.\n * we use this rather than updating through a prop since we can\n * pass a ref into the vanilla-js world.\n *\n * Use a monotonic counter rather than `Date.now()` so two\n * updates within the same millisecond still produce distinct\n * state values and avoid React's bailout.\n */\n triggerRender((n) => n + 1);\n },\n }), []);\n return React.createElement(props.component, _props.current);\n};\nReactComponentBridge.displayName = 'DockviewReactJsBridge';\n/**\n * Since we are storing the React.Portal references in a rendered array they\n * require a key property like any other React element rendered in an array\n * to prevent excessive re-rendering\n */\nconst uniquePortalKeyGenerator = (() => {\n let value = 1;\n return { next: () => `dockview_react_portal_key_${(value++).toString()}` };\n})();\nexport const ReactPartContext = React.createContext({});\nexport class ReactPart {\n constructor(parent, portalStore, component, parameters, context) {\n this.parent = parent;\n this.portalStore = portalStore;\n this.component = component;\n this.parameters = parameters;\n this.context = context;\n this._initialProps = {};\n this.disposed = false;\n this.createPortal();\n }\n update(props) {\n if (this.disposed) {\n throw new Error('invalid operation: resource is already disposed');\n }\n if (!this.componentInstance) {\n // if the component is yet to be mounted store the props\n this._initialProps = Object.assign(Object.assign({}, this._initialProps), props);\n }\n else {\n this.componentInstance.update(props);\n }\n }\n createPortal() {\n if (this.disposed) {\n throw new Error('invalid operation: resource is already disposed');\n }\n if (!isReactComponent(this.component)) {\n /**\n * we know this isn't a React.FunctionComponent so throw an error here.\n * if we do not intercept then React library will throw a very obsure error\n * for the same reason... at least at this point we will emit a sensible stacktrace.\n */\n throw new Error('Dockview: Only React.memo(...), React.ForwardRef(...) and functional components are accepted as components');\n }\n const bridgeComponent = React.createElement(React.forwardRef(ReactComponentBridge), {\n component: this\n .component,\n componentProps: this.parameters,\n ref: (element) => {\n this.componentInstance = element;\n if (Object.keys(this._initialProps).length > 0) {\n this.componentInstance.update(this._initialProps);\n this._initialProps = {}; // don't keep a reference to the users object once no longer required\n }\n },\n });\n const node = this.context\n ? React.createElement(ReactPartContext.Provider, { value: this.context }, bridgeComponent)\n : bridgeComponent;\n const portal = ReactDOM.createPortal(node, this.parent, uniquePortalKeyGenerator.next());\n this.ref = {\n portal,\n disposable: this.portalStore.addPortal(portal),\n };\n }\n dispose() {\n var _a;\n (_a = this.ref) === null || _a === void 0 ? void 0 : _a.disposable.dispose();\n this.disposed = true;\n }\n}\n/**\n * A React Hook that returns an array of portals to be rendered by the user of this hook\n * and a disposable function to add a portal. Calling dispose removes this portal from the\n * portal array\n */\nexport const usePortalsLifecycle = () => {\n const [portals, setPortals] = React.useState([]);\n React.useDebugValue(`Portal count: ${portals.length}`);\n const addPortal = React.useCallback((portal) => {\n setPortals((existingPortals) => [...existingPortals, portal]);\n let disposed = false;\n return DockviewDisposable.from(() => {\n if (disposed) {\n throw new Error('invalid operation: resource already disposed');\n }\n disposed = true;\n setPortals((existingPortals) => existingPortals.filter((p) => p !== portal));\n });\n }, []);\n return [portals, addPortal];\n};\nexport function isReactComponent(component) {\n /**\n * Yes, we could use \"react-is\" but that would introduce an unwanted peer dependency\n * so for now we will check in a rather crude fashion...\n */\n return (typeof component === 'function' /** Functional Componnts */ ||\n !!(component === null || component === void 0 ? void 0 : component.$$typeof) /** React.memo(...) Components */);\n}\n","import { ReactPart } from '../react';\nimport { DockviewEmitter, } from 'dockview';\nexport class ReactPanelContentPart {\n get element() {\n return this._element;\n }\n constructor(id, component, reactPortalStore) {\n this.id = id;\n this.component = component;\n this.reactPortalStore = reactPortalStore;\n this._onDidFocus = new DockviewEmitter();\n this.onDidFocus = this._onDidFocus.event;\n this._onDidBlur = new DockviewEmitter();\n this.onDidBlur = this._onDidBlur.event;\n this._element = document.createElement('div');\n this._element.className = 'dv-react-part';\n this._element.style.height = '100%';\n this._element.style.width = '100%';\n }\n focus() {\n // TODO\n }\n init(parameters) {\n this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {\n params: parameters.params,\n api: parameters.api,\n containerApi: parameters.containerApi,\n });\n }\n update(event) {\n var _a;\n (_a = this.part) === null || _a === void 0 ? void 0 : _a.update({ params: event.params });\n }\n layout(_width, _height) {\n // noop\n }\n dispose() {\n var _a;\n this._onDidFocus.dispose();\n this._onDidBlur.dispose();\n (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();\n }\n}\n","import { ReactPart } from '../react';\nexport class ReactPanelHeaderPart {\n get element() {\n return this._element;\n }\n constructor(id, component, reactPortalStore) {\n this.id = id;\n this.component = component;\n this.reactPortalStore = reactPortalStore;\n this._element = document.createElement('div');\n this._element.className = 'dv-react-part';\n this._element.style.height = '100%';\n this._element.style.width = '100%';\n }\n focus() {\n //noop\n }\n init(parameters) {\n this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {\n params: parameters.params,\n api: parameters.api,\n containerApi: parameters.containerApi,\n tabLocation: parameters.tabLocation,\n });\n }\n update(event) {\n var _a;\n (_a = this.part) === null || _a === void 0 ? void 0 : _a.update({ params: event.params });\n }\n layout(_width, _height) {\n // noop - retrieval from api\n }\n dispose() {\n var _a;\n (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();\n }\n}\n","import { ReactPart } from '../react';\nexport class ReactWatermarkPart {\n get element() {\n return this._element;\n }\n constructor(id, component, reactPortalStore) {\n this.id = id;\n this.component = component;\n this.reactPortalStore = reactPortalStore;\n this._element = document.createElement('div');\n this._element.className = 'dv-react-part';\n this._element.style.height = '100%';\n this._element.style.width = '100%';\n }\n init(parameters) {\n this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {\n group: parameters.group,\n containerApi: parameters.containerApi,\n });\n }\n focus() {\n // noop\n }\n update(params) {\n var _a, _b, _c;\n if (this.parameters) {\n this.parameters.params = params.params;\n }\n (_a = this.part) === null || _a === void 0 ? void 0 : _a.update({ params: (_c = (_b = this.parameters) === null || _b === void 0 ? void 0 : _b.params) !== null && _c !== void 0 ? _c : {} });\n }\n layout(_width, _height) {\n // noop - retrieval from api\n }\n dispose() {\n var _a;\n (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();\n }\n}\n","import { ReactPart } from '../react';\nimport { DockviewCompositeDisposable, DockviewMutableDisposable, } from 'dockview';\nexport class ReactHeaderActionsRendererPart {\n get element() {\n return this._element;\n }\n get part() {\n return this._part;\n }\n constructor(component, reactPortalStore, _group) {\n this.component = component;\n this.reactPortalStore = reactPortalStore;\n this._group = _group;\n this.mutableDisposable = new DockviewMutableDisposable();\n this._element = document.createElement('div');\n this._element.className = 'dv-react-part';\n this._element.style.height = '100%';\n this._element.style.width = '100%';\n }\n init(parameters) {\n this.mutableDisposable.value = new DockviewCompositeDisposable(this._group.model.onDidAddPanel(() => {\n this.updatePanels();\n }), this._group.model.onDidRemovePanel(() => {\n this.updatePanels();\n }), this._group.model.onDidActivePanelChange(() => {\n this.updateActivePanel();\n }), parameters.api.onDidActiveChange(() => {\n this.updateGroupActive();\n }), parameters.api.onDidLocationChange((event) => {\n this.updateLocation(event.location);\n }));\n this._part = new ReactPart(this.element, this.reactPortalStore, this.component, {\n api: parameters.api,\n containerApi: parameters.containerApi,\n panels: this._group.model.panels,\n activePanel: this._group.model.activePanel,\n isGroupActive: this._group.api.isActive,\n group: this._group,\n headerPosition: this._group.model.headerPosition,\n location: parameters.api.location,\n });\n }\n dispose() {\n var _a;\n this.mutableDisposable.dispose();\n (_a = this._part) === null || _a === void 0 ? void 0 : _a.dispose();\n }\n update(event) {\n var _a;\n (_a = this._part) === null || _a === void 0 ? void 0 : _a.update(event.params);\n }\n updatePanels() {\n this.update({ params: { panels: this._group.model.panels } });\n }\n updateActivePanel() {\n this.update({\n params: {\n activePanel: this._group.model.activePanel,\n },\n });\n }\n updateGroupActive() {\n this.update({\n params: {\n isGroupActive: this._group.api.isActive,\n },\n });\n }\n updateLocation(location) {\n this.update({ params: { location } });\n }\n}\n","import { ReactPart } from '../react';\nexport class ReactContextMenuItemPart {\n get element() {\n return this._element;\n }\n constructor(id, component, reactPortalStore) {\n this.id = id;\n this.component = component;\n this.reactPortalStore = reactPortalStore;\n this._element = document.createElement('div');\n this._element.className = 'dv-react-part';\n this._element.style.height = '100%';\n this._element.style.width = '100%';\n }\n init(props) {\n this.part = new ReactPart(this._element, this.reactPortalStore, this.component, props);\n }\n dispose() {\n var _a;\n (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();\n }\n}\n","import { ReactPart } from '../react';\nexport class ReactTabGroupChipPart {\n get element() {\n return this._element;\n }\n constructor(component, reactPortalStore) {\n this.component = component;\n this.reactPortalStore = reactPortalStore;\n this._element = document.createElement('div');\n this._element.className = 'dv-react-part';\n this._element.style.display = 'inline-flex';\n }\n init(params) {\n this.part = new ReactPart(this._element, this.reactPortalStore, this.component, {\n tabGroup: params.tabGroup,\n api: params.api,\n });\n }\n update(params) {\n var _a;\n (_a = this.part) === null || _a === void 0 ? void 0 : _a.update({ tabGroup: params.tabGroup });\n }\n dispose() {\n var _a;\n (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();\n }\n}\n","import { ReactPart } from '../react';\nexport class ReactGroupDragGhostPart {\n get element() {\n return this._element;\n }\n constructor(component, reactPortalStore) {\n this.component = component;\n this.reactPortalStore = reactPortalStore;\n this._element = document.createElement('div');\n this._element.className = 'dv-react-part';\n this._element.style.display = 'inline-flex';\n }\n init(params) {\n this.part = new ReactPart(this._element, this.reactPortalStore, this.component, {\n group: params.group,\n api: params.api,\n });\n }\n dispose() {\n var _a;\n (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();\n }\n}\n","import React from 'react';\nimport { PROPERTY_KEYS_DOCKVIEW, createDockview, } from 'dockview';\nimport { ReactPanelContentPart } from './reactContentPart';\nimport { ReactPanelHeaderPart } from './reactHeaderPart';\nimport { usePortalsLifecycle } from '../react';\nimport { ReactWatermarkPart } from './reactWatermarkPart';\nimport { ReactHeaderActionsRendererPart } from './headerActionsRenderer';\nimport { ReactContextMenuItemPart } from './reactContextMenuItemPart';\nimport { ReactTabGroupChipPart, } from './reactTabGroupChipPart';\nimport { ReactGroupDragGhostPart, } from './reactGroupDragGhostPart';\nfunction createGroupControlElement(component, store) {\n return component\n ? (groupPanel) => {\n return new ReactHeaderActionsRendererPart(component, store, groupPanel);\n }\n : undefined;\n}\nconst DEFAULT_REACT_TAB = 'props.defaultTabComponent';\nfunction extractCoreOptions(props) {\n const coreOptions = PROPERTY_KEYS_DOCKVIEW.reduce((obj, key) => {\n if (key in props) {\n obj[key] = props[key];\n }\n return obj;\n }, {});\n return coreOptions;\n}\nexport const DockviewReact = React.forwardRef((props, ref) => {\n const domRef = React.useRef(null);\n const dockviewRef = React.useRef(undefined);\n const [portals, addPortal] = usePortalsLifecycle();\n React.useImperativeHandle(ref, () => domRef.current, []);\n const prevProps = React.useRef({});\n React.useEffect(() => {\n const changes = {};\n PROPERTY_KEYS_DOCKVIEW.forEach((propKey) => {\n const key = propKey;\n const propValue = props[key];\n if (key in props && propValue !== prevProps.current[key]) {\n changes[key] = propValue;\n }\n });\n if (dockviewRef.current) {\n dockviewRef.current.updateOptions(changes);\n }\n else {\n // not yet fully initialized\n }\n prevProps.current = props;\n }, PROPERTY_KEYS_DOCKVIEW.map((key) => props[key]));\n React.useEffect(() => {\n var _a;\n if (!domRef.current) {\n return;\n }\n const frameworkTabComponents = (_a = props.tabComponents) !== null && _a !== void 0 ? _a : {};\n if (props.defaultTabComponent) {\n frameworkTabComponents[DEFAULT_REACT_TAB] =\n props.defaultTabComponent;\n }\n const frameworkOptions = {\n createLeftHeaderActionComponent: createGroupControlElement(props.leftHeaderActionsComponent, { addPortal }),\n createRightHeaderActionComponent: createGroupControlElement(props.rightHeaderActionsComponent, { addPortal }),\n createPrefixHeaderActionComponent: createGroupControlElement(props.prefixHeaderActionsComponent, { addPortal }),\n createComponent: (options) => {\n return new ReactPanelContentPart(options.id, props.components[options.name], {\n addPortal,\n });\n },\n createTabComponent(options) {\n return new ReactPanelHeaderPart(options.id, frameworkTabComponents[options.name], {\n addPortal,\n });\n },\n createWatermarkComponent: props.watermarkComponent\n ? () => {\n return new ReactWatermarkPart('watermark', props.watermarkComponent, {\n addPortal,\n });\n }\n : undefined,\n defaultTabComponent: props.defaultTabComponent\n ? DEFAULT_REACT_TAB\n : undefined,\n createContextMenuItemComponent: (options) => {\n if (!options.component) {\n return undefined;\n }\n return new ReactContextMenuItemPart(options.id, options.component, { addPortal });\n },\n };\n const coreOptions = extractCoreOptions(props);\n if (props.tabGroupChipComponent) {\n const chipComponent = props.tabGroupChipComponent;\n coreOptions.createTabGroupChipComponent = () => {\n return new ReactTabGroupChipPart(chipComponent, {\n addPortal,\n });\n };\n }\n if (props.groupDragGhostComponent) {\n const ghostComponent = props.groupDragGhostComponent;\n coreOptions.createGroupDragGhostComponent = () => {\n return new ReactGroupDragGhostPart(ghostComponent, {\n addPortal,\n });\n };\n }\n const api = createDockview(domRef.current, Object.assign(Object.assign({}, coreOptions), frameworkOptions));\n const { clientWidth, clientHeight } = domRef.current;\n api.layout(clientWidth, clientHeight);\n if (props.onReady) {\n props.onReady({ api });\n }\n dockviewRef.current = api;\n return () => {\n dockviewRef.current = undefined;\n api.dispose();\n };\n }, []);\n React.useEffect(() => {\n if (!dockviewRef.current) {\n return () => {\n // noop\n };\n }\n const disposable = dockviewRef.current.onDidDrop((event) => {\n if (props.onDidDrop) {\n props.onDidDrop(event);\n }\n });\n return () => {\n disposable.dispose();\n };\n }, [props.onDidDrop]);\n React.useEffect(() => {\n if (!dockviewRef.current) {\n return () => {\n // noop\n };\n }\n const disposable = dockviewRef.current.onWillDrop((event) => {\n if (props.onWillDrop) {\n props.onWillDrop(event);\n }\n });\n return () => {\n disposable.dispose();\n };\n }, [props.onWillDrop]);\n React.useEffect(() => {\n if (!dockviewRef.current) {\n return;\n }\n dockviewRef.current.updateOptions({\n createTabGroupChipComponent: props.tabGroupChipComponent\n ? () => {\n return new ReactTabGroupChipPart(props.tabGroupChipComponent, {\n addPortal,\n });\n }\n : undefined,\n });\n }, [props.tabGroupChipComponent]);\n React.useEffect(() => {\n if (!dockviewRef.current) {\n return;\n }\n dockviewRef.current.updateOptions({\n createGroupDragGhostComponent: props.groupDragGhostComponent\n ? () => {\n return new ReactGroupDragGhostPart(props.groupDragGhostComponent, {\n addPortal,\n });\n }\n : undefined,\n });\n }, [props.groupDragGhostComponent]);\n React.useEffect(() => {\n if (!dockviewRef.current) {\n return;\n }\n dockviewRef.current.updateOptions({\n createComponent: (options) => {\n return new ReactPanelContentPart(options.id, props.components[options.name], {\n addPortal,\n });\n },\n });\n }, [props.components]);\n React.useEffect(() => {\n var _a;\n if (!dockviewRef.current) {\n return;\n }\n const frameworkTabComponents = (_a = props.tabComponents) !== null && _a !== void 0 ? _a : {};\n if (props.defaultTabComponent) {\n frameworkTabComponents[DEFAULT_REACT_TAB] =\n props.defaultTabComponent;\n }\n dockviewRef.current.updateOptions({\n defaultTabComponent: props.defaultTabComponent\n ? DEFAULT_REACT_TAB\n : undefined,\n createTabComponent(options) {\n return new ReactPanelHeaderPart(options.id, frameworkTabComponents[options.name], {\n addPortal,\n });\n },\n });\n }, [props.tabComponents, props.defaultTabComponent]);\n React.useEffect(() => {\n if (!dockviewRef.current) {\n return;\n }\n dockviewRef.current.updateOptions({\n createWatermarkComponent: props.watermarkComponent\n ? () => {\n return new ReactWatermarkPart('watermark', props.watermarkComponent, {\n addPortal,\n });\n }\n : undefined,\n });\n }, [props.watermarkComponent]);\n React.useEffect(() => {\n if (!dockviewRef.current) {\n return;\n }\n dockviewRef.current.updateOptions({\n createRightHeaderActionComponent: createGroupControlElement(props.rightHeaderActionsComponent, { addPortal }),\n });\n }, [props.rightHeaderActionsComponent]);\n React.useEffect(() => {\n if (!dockviewRef.current) {\n return;\n }\n dockviewRef.current.updateOptions({\n createLeftHeaderActionComponent: createGroupControlElement(props.leftHeaderActionsComponent, { addPortal }),\n });\n }, [props.leftHeaderActionsComponent]);\n React.useEffect(() => {\n if (!dockviewRef.current) {\n return;\n }\n dockviewRef.current.updateOptions({\n createPrefixHeaderActionComponent: createGroupControlElement(props.prefixHeaderActionsComponent, { addPortal }),\n });\n }, [props.prefixHeaderActionsComponent]);\n return (React.createElement(\"div\", { style: { height: '100%', width: '100%' }, ref: domRef }, portals));\n});\nDockviewReact.displayName = 'DockviewComponent';\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","import React from 'react';\nexport const CloseButton = () => (React.createElement(\"svg\", { height: \"11\", width: \"11\", viewBox: \"0 0 28 28\", \"aria-hidden\": 'false', focusable: false, className: \"dv-svg\" },\n React.createElement(\"path\", { d: \"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\" })));\nexport const ExpandMore = () => {\n return (React.createElement(\"svg\", { width: \"11\", height: \"11\", viewBox: \"0 0 24 15\", \"aria-hidden\": 'false', focusable: false, className: \"dv-svg\" },\n React.createElement(\"path\", { d: \"M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z\" })));\n};\n","import { SplitviewApi, SplitviewPanel, } from 'dockview';\nimport { ReactPart } from '../react';\nexport class ReactPanelView extends SplitviewPanel {\n constructor(id, component, reactComponent, reactPortalStore) {\n super(id, component);\n this.reactComponent = reactComponent;\n this.reactPortalStore = reactPortalStore;\n }\n getComponent() {\n var _a, _b;\n return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {\n params: (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {},\n api: this.api,\n containerApi: new SplitviewApi(this._params.accessor),\n });\n }\n}\n","import React from 'react';\nimport { createSplitview, PROPERTY_KEYS_SPLITVIEW, } from 'dockview';\nimport { usePortalsLifecycle } from '../react';\nimport { ReactPanelView } from './view';\nfunction extractCoreOptions(props) {\n const coreOptions = PROPERTY_KEYS_SPLITVIEW.reduce((obj, key) => {\n if (key in props) {\n obj[key] = props[key];\n }\n return obj;\n }, {});\n return coreOptions;\n}\nexport const SplitviewReact = React.forwardRef((props, ref) => {\n const domRef = React.useRef(null);\n const splitviewRef = React.useRef(undefined);\n const [portals, addPortal] = usePortalsLifecycle();\n React.useImperativeHandle(ref, () => domRef.current, []);\n const prevProps = React.useRef({});\n React.useEffect(() => {\n const changes = {};\n PROPERTY_KEYS_SPLITVIEW.forEach((propKey) => {\n const key = propKey;\n const propValue = props[key];\n if (key in props && propValue !== prevProps.current[key]) {\n changes[key] = propValue;\n }\n });\n if (splitviewRef.current) {\n splitviewRef.current.updateOptions(changes);\n }\n else {\n // not yet fully initialized\n }\n prevProps.current = props;\n }, PROPERTY_KEYS_SPLITVIEW.map((key) => props[key]));\n React.useEffect(() => {\n if (!domRef.current) {\n return () => {\n // noop\n };\n }\n const frameworkOptions = {\n createComponent: (options) => {\n return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });\n },\n };\n const api = createSplitview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));\n const { clientWidth, clientHeight } = domRef.current;\n api.layout(clientWidth, clientHeight);\n if (props.onReady) {\n props.onReady({ api });\n }\n splitviewRef.current = api;\n return () => {\n splitviewRef.current = undefined;\n api.dispose();\n };\n }, []);\n React.useEffect(() => {\n if (!splitviewRef.current) {\n return;\n }\n splitviewRef.current.updateOptions({\n createComponent: (options) => {\n return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });\n },\n });\n }, [props.components]);\n return (React.createElement(\"div\", { style: { height: '100%', width: '100%' }, ref: domRef }, portals));\n});\nSplitviewReact.displayName = 'SplitviewComponent';\n","import { GridviewApi, GridviewPanel, } from 'dockview';\nimport { ReactPart } from '../react';\nexport class ReactGridPanelView extends GridviewPanel {\n constructor(id, component, reactComponent, reactPortalStore) {\n super(id, component);\n this.reactComponent = reactComponent;\n this.reactPortalStore = reactPortalStore;\n }\n getComponent() {\n var _a, _b;\n return new ReactPart(this.element, this.reactPortalStore, this.reactComponent, {\n params: (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {},\n api: this.api,\n // TODO: fix casting hack\n containerApi: new GridviewApi(this._params\n .accessor),\n });\n }\n}\n","import React from 'react';\nimport { createGridview, PROPERTY_KEYS_GRIDVIEW, } from 'dockview';\nimport { ReactGridPanelView } from './view';\nimport { usePortalsLifecycle } from '../react';\nfunction extractCoreOptions(props) {\n const coreOptions = PROPERTY_KEYS_GRIDVIEW.reduce((obj, key) => {\n if (key in props) {\n obj[key] = props[key];\n }\n return obj;\n }, {});\n return coreOptions;\n}\nexport const GridviewReact = React.forwardRef((props, ref) => {\n const domRef = React.useRef(null);\n const gridviewRef = React.useRef(undefined);\n const [portals, addPortal] = usePortalsLifecycle();\n React.useImperativeHandle(ref, () => domRef.current, []);\n const prevProps = React.useRef({});\n React.useEffect(() => {\n const changes = {};\n PROPERTY_KEYS_GRIDVIEW.forEach((propKey) => {\n const key = propKey;\n const propValue = props[key];\n if (key in props && propValue !== prevProps.current[key]) {\n changes[key] = propValue;\n }\n });\n if (gridviewRef.current) {\n gridviewRef.current.updateOptions(changes);\n }\n else {\n // not yet fully initialized\n }\n prevProps.current = props;\n }, PROPERTY_KEYS_GRIDVIEW.map((key) => props[key]));\n React.useEffect(() => {\n if (!domRef.current) {\n return () => {\n // noop\n };\n }\n const frameworkOptions = {\n createComponent: (options) => {\n return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });\n },\n };\n const api = createGridview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));\n const { clientWidth, clientHeight } = domRef.current;\n api.layout(clientWidth, clientHeight);\n if (props.onReady) {\n props.onReady({ api });\n }\n gridviewRef.current = api;\n return () => {\n gridviewRef.current = undefined;\n api.dispose();\n };\n }, []);\n React.useEffect(() => {\n if (!gridviewRef.current) {\n return;\n }\n gridviewRef.current.updateOptions({\n createComponent: (options) => {\n return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });\n },\n });\n }, [props.components]);\n return (React.createElement(\"div\", { style: { height: '100%', width: '100%' }, ref: domRef }, portals));\n});\nGridviewReact.displayName = 'GridviewComponent';\n","import { ReactPart } from '../react';\nexport class PanePanelSection {\n get element() {\n return this._element;\n }\n constructor(id, component, reactPortalStore) {\n this.id = id;\n this.component = component;\n this.reactPortalStore = reactPortalStore;\n this._element = document.createElement('div');\n this._element.style.height = '100%';\n this._element.style.width = '100%';\n }\n init(parameters) {\n this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {\n params: parameters.params,\n api: parameters.api,\n title: parameters.title,\n containerApi: parameters.containerApi,\n });\n }\n toJSON() {\n return {\n id: this.id,\n };\n }\n update(params) {\n var _a;\n (_a = this.part) === null || _a === void 0 ? void 0 : _a.update(params.params);\n }\n dispose() {\n var _a;\n (_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();\n }\n}\n","import React from 'react';\nimport { createPaneview, PROPERTY_KEYS_PANEVIEW, } from 'dockview';\nimport { usePortalsLifecycle } from '../react';\nimport { PanePanelSection } from './view';\nfunction extractCoreOptions(props) {\n const coreOptions = PROPERTY_KEYS_PANEVIEW.reduce((obj, key) => {\n if (key in props) {\n obj[key] = props[key];\n }\n return obj;\n }, {});\n return coreOptions;\n}\nexport const PaneviewReact = React.forwardRef((props, ref) => {\n const domRef = React.useRef(null);\n const paneviewRef = React.useRef(undefined);\n const [portals, addPortal] = usePortalsLifecycle();\n React.useImperativeHandle(ref, () => domRef.current, []);\n const prevProps = React.useRef({});\n React.useEffect(() => {\n const changes = {};\n PROPERTY_KEYS_PANEVIEW.forEach((propKey) => {\n const key = propKey;\n const propValue = props[key];\n if (key in props && propValue !== prevProps.current[key]) {\n changes[key] = propValue;\n }\n });\n if (paneviewRef.current) {\n paneviewRef.current.updateOptions(changes);\n }\n else {\n // not yet fully initialized\n }\n prevProps.current = props;\n }, PROPERTY_KEYS_PANEVIEW.map((key) => props[key]));\n React.useEffect(() => {\n var _a;\n if (!domRef.current) {\n return () => {\n // noop\n };\n }\n const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};\n const frameworkOptions = {\n createComponent: (options) => {\n return new PanePanelSection(options.id, props.components[options.name], { addPortal });\n },\n createHeaderComponent: (options) => {\n return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });\n },\n };\n const api = createPaneview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));\n const { clientWidth, clientHeight } = domRef.current;\n api.layout(clientWidth, clientHeight);\n if (props.onReady) {\n props.onReady({ api });\n }\n paneviewRef.current = api;\n return () => {\n paneviewRef.current = undefined;\n api.dispose();\n };\n }, []);\n React.useEffect(() => {\n if (!paneviewRef.current) {\n return;\n }\n paneviewRef.current.updateOptions({\n createComponent: (options) => {\n return new PanePanelSection(options.id, props.components[options.name], { addPortal });\n },\n });\n }, [props.components]);\n React.useEffect(() => {\n var _a;\n if (!paneviewRef.current) {\n return;\n }\n const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};\n paneviewRef.current.updateOptions({\n createHeaderComponent: (options) => {\n return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });\n },\n });\n }, [props.headerComponents]);\n React.useEffect(() => {\n if (!paneviewRef.current) {\n return () => {\n // noop\n };\n }\n const disposable = paneviewRef.current.onDidDrop((event) => {\n if (props.onDidDrop) {\n props.onDidDrop(event);\n }\n });\n return () => {\n disposable.dispose();\n };\n }, [props.onDidDrop]);\n return (React.createElement(\"div\", { style: { height: '100%', width: '100%' }, ref: domRef }, portals));\n});\nPaneviewReact.displayName = 'PaneviewComponent';\n","import { __rest } from \"tslib\";\nimport React from 'react';\nimport { CloseButton } from '../svg';\nfunction useTitle(api) {\n const [title, setTitle] = React.useState(api.title);\n React.useEffect(() => {\n const disposable = api.onDidTitleChange((event) => {\n setTitle(event.title);\n });\n // Depending on the order in which React effects are run, the title may already be out of sync (cf. issue #1003).\n if (title !== api.title) {\n setTitle(api.title);\n }\n return () => {\n disposable.dispose();\n };\n }, [api]);\n return title;\n}\nexport const DockviewDefaultTab = (_a) => {\n var { api, containerApi: _containerApi, params: _params, hideClose, closeActionOverride, onPointerDown, onPointerUp, onPointerLeave, tabLocation } = _a, rest = __rest(_a, [\"api\", \"containerApi\", \"params\", \"hideClose\", \"closeActionOverride\", \"onPointerDown\", \"onPointerUp\", \"onPointerLeave\", \"tabLocation\"]);\n const title = useTitle(api);\n const isMiddleMouseButton = React.useRef(false);\n const onClose = React.useCallback((event) => {\n event.preventDefault();\n if (closeActionOverride) {\n closeActionOverride();\n }\n else {\n api.close();\n }\n }, [api, closeActionOverride]);\n const onBtnPointerDown = React.useCallback((event) => {\n event.preventDefault();\n }, []);\n const _onPointerDown = React.useCallback((event) => {\n isMiddleMouseButton.current = event.button === 1;\n onPointerDown === null || onPointerDown === void 0 ? void 0 : onPointerDown(event);\n }, [onPointerDown]);\n const _onPointerUp = React.useCallback((event) => {\n if (isMiddleMouseButton && event.button === 1 && !hideClose) {\n isMiddleMouseButton.current = false;\n onClose(event);\n }\n onPointerUp === null || onPointerUp === void 0 ? void 0 : onPointerUp(event);\n }, [onPointerUp, onClose, hideClose]);\n const _onPointerLeave = React.useCallback((event) => {\n isMiddleMouseButton.current = false;\n onPointerLeave === null || onPointerLeave === void 0 ? void 0 : onPointerLeave(event);\n }, [onPointerLeave]);\n return (React.createElement(\"div\", Object.assign({ \"data-testid\": \"dockview-dv-default-tab\" }, rest, { onPointerDown: _onPointerDown, onPointerUp: _onPointerUp, onPointerLeave: _onPointerLeave, className: \"dv-default-tab\" }),\n React.createElement(\"span\", { className: \"dv-default-tab-content\" }, title),\n !hideClose && (React.createElement(\"div\", { className: \"dv-default-tab-action\", onPointerDown: onBtnPointerDown, onClick: onClose },\n React.createElement(CloseButton, null)))));\n};\n"],"names":["Disposable","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","TransferObject","PanelTransfer","constructor","viewId","groupId","panelId","tabGroupId","super","this","PaneTransfer","paneId","LocalSelectionTransfer","getInstance","INSTANCE","hasData","proto","clearData","undefined","data","getData","setData","getPanelData","panelTransfer","prototype","getPaneData","paneTransfer","NONE","dispose","from","func","CompositeDisposable","isDisposed","_isDisposed","args","_disposables","Set","addDisposables","forEach","arg","add","removeDisposable","disposable","delete","clear","MutableDisposable","_disposable","value","Event","any","children","listener","disposables","map","child","d","DockviewEvent","_defaultPrevented","defaultPrevented","preventDefault","AcceptableEvent","_isAccepted","isAccepted","accept","Stacktrace","create","_a","Error","stack","print","console","warn","Listener","callback","stacktrace","Emitter","setLeakageMonitorEnabled","isEnabled","ENABLE_TRACKING","MEMORY_LEAK_WATCHER","_last","options","_listeners","_disposed","_pauseTokens","event","_event","replay","push","index","indexOf","splice","fire","e","size","pause","token","length","queueMicrotask","addDisposableListener","element","addEventListener","removeEventListener","events","Map","set","AsapEvent","_onFired","_currentFireCount","_queued","onEvent","fireCountAtTimeOfEventSubscription","OverflowObserver","el","_onDidChange","onDidChange","_value","watchElementResize","entry","hasScrollX","target","scrollWidth","clientWidth","hasScrollY","scrollHeight","clientHeight","cb","observer","ResizeObserver","entires","requestAnimationFrame","firstEntry","observe","unobserve","disconnect","removeClasses","classes","classname","classList","contains","remove","addClasses","toggleClass","className","isToggled","hasClass","isAncestor","testChild","testAncestor","parentNode","trackFocus","FocusTracker","_onDidFocus","onDidFocus","_onDidBlur","onDidBlur","hasFocus","activeElement","loosingFocus","onFocus","onBlur","window","setTimeout","_refreshStateHandler","refreshState","QUASI_PREVENT_DEFAULT_KEY","quasiPreventDefault","quasiDefaultPrevented","getDomNodePagePosition","domNode","left","top","width","height","getBoundingClientRect","scrollX","scrollY","disableIframePointEvents","rootNode","iframes","tagNames","findIframesInNode","node","nodeType","Node","ELEMENT_NODE","includes","tagName","shadowRoot","Document","documentElement","allTagsNamesInclusiveOfShadowDoms","original","WeakMap","iframe","pointerEvents","release","get","Classnames","_classNames","setClassNames","classNames","split","filter","v","trim","isChildEntirelyVisibleWithinParent","parent","childPosition","parentPosition","findRelativeZIndexParent","tmp","zIndex","parentElement","tail","arr","slice","sequenceEquals","arr1","arr2","i","pushToStart","unshift","pushToEnd","array","findIndex","t","clamp","min","max","Math","sequentialNumberGenerator","next","toString","range","to","result","ViewItem","_size","cachedVisibleSize","_cachedVisibleSize","visible","minimumSize","view","viewMinimumSize","maximumSize","viewMaximumSize","priority","snap","enabled","container","setVisible","toggle","Orientation","SashState","LayoutPriority","Sizing","Distribute","Split","Invisible","Splitview","contentSize","_contentSize","orthogonalSize","_orthogonalSize","viewItems","proportions","_proportions","orientation","_orientation","HORIZONTAL","reduce","r","item","Number","POSITIVE_INFINITY","startSnappingEnabled","_startSnappingEnabled","updateSashEnablement","endSnappingEnabled","_endSnappingEnabled","disabled","_disabled","margin","_margin","_b","sashes","_onDidSashEnd","onDidSashEnd","_onDidAddView","onDidAddView","_onDidRemoveView","onDidRemoveView","resize","delta","sizes","x","lowPriorityIndexes","highPriorityIndexes","overloadMinDelta","NEGATIVE_INFINITY","overloadMaxDelta","snapBefore","snapAfter","upIndexes","downIndexes","upItems","upSizes","downItems","downSizes","minDeltaUp","_","maxDeltaUp","maxDeltaDown","minDeltaDown","minDelta","maxDelta","snapped","snapView","limitDelta","actualDelta","deltaUp","viewDelta","deltaDown","VERTICAL","createContainer","proportionalLayout","viewContainer","createViewContainer","sashContainer","createSashContainer","styles","descriptor","views","viewDescriptor","sizing","addView","saveProportions","separatorBorder","removeProperty","setProperty","isViewVisible","setViewVisible","viewItem","distributeEmptySpace","layoutViews","getViewSize","resizeView","indexes","Low","High","round","relayout","getViews","skipLayout","viewSize","newSize","removeChild","sash","onPointerStart","start","clientX","clientY","sashIndex","fn","firstIndex","s","snapBeforeIndex","findFirstSnapIndex","snapAfterIndex","snappedViewItem","halfSize","floor","onPointerMove","end","sashItem","distributeViewSizes","flexibleViewItems","flexibleSize","removeView","getViewCachedVisibleSize","moveView","layout","previousSize","total","proportion","lowPriorityIndex","emptyDelta","visibleViewItems","sashCount","marginReducedSize","totalLeftOffset","viewLeftOffsets","runningVisiblePanelCount","flag","visiblePanelsBeforeThisView","offset","sashWidth","previous","collapsesDown","expandsDown","reverseViews","reverse","collapsesUp","expandsUp","position","snappedBefore","snappedAfter","updateSash","MINIMUM","MAXIMUM","DISABLED","ENABLED","state","orientationClassname","PROPERTY_KEYS_SPLITVIEW","properties","disableAutoResizing","Object","keys","Paneview","splitview","paneItems","skipAnimation","getPanes","pane","onDidChangeExpansionState","setupAnimation","paneItem","addPane","removePane","skipDispose","animationTimer","clearTimeout","LeafNode","minimumWidth","maximumWidth","minimumHeight","maximumHeight","minimumOrthogonalSize","maximumOrthogonalSize","BranchNode","c","Normal","priorities","some","p","childDescriptors","_childrenDisposable","_onDidVisibilityChange","onDidVisibilityChange","childDescriptor","setupChildrenEvents","_visible","isChildVisible","setChildVisible","wereAllChildrenHidden","areAllChildrenHidden","moveChild","_removeChild","_addChild","getChildSize","resizeChild","addChild","getChildCachedVisibleSize","findLeaf","candiateNode","last","cloneNode","flipNode","orthogonal","totalSize","childSize","indexInParent","firstElementChild","lastElementChild","nextElementSibling","getGridLocation","test","getRelativeLocation","rootOrientation","location","direction","getLocationOrientation","getDirectionOrientation","rest","_index","isGridBranchNode","serializeBranchNode","box","toJSON","Gridview","_root","root","locked","_locked","branch","pop","maximizedView","_maximizedNode","leaf","hasMaximizedView","maximizeView","getNode","exitMaximizedView","getView","hiddenOnMaximize","hideAllViewsBut","exclude","_onDidMaximizedNodeChange","isMaximized","showViewsInReverseOrder","serialize","maxmizedViewLocation","pauseToken","maximizedNode","_onDidViewVisibilityChange","deserialize","json","deserializer","_deserialize","_deserializeNode","serializedChild","fromJSON","call","oldRoot","normalize","childReference","insertOrthogonalSplitviewAtRoot","progmaticSelect","_getViews","nodeCachedVisibleSize","path","n","l","onDidViewVisibilityChange","onDidMaximizedNodeChange","parentLocation","pathToParent","grandParent","parentIndex","__","newSiblingSize","newSiblingCachedVisibleSize","newParent","newSibling","nodeToRemove","sibling","isSiblingVisible","siblingSizing","PROPERTY_KEYS_GRIDVIEW","hideBorders","Resizable","_element","disableResizing","_disableResizing","_lastWidth","_lastHeight","offsetParent","currentElement","DocumentFragment","host","isInDocument","contentRect","nextLayoutId$1","toTarget","BaseGrid","id","_id","_groups","groups","Array","values","gridview","activeGroup","_activeGroup","_onDidRemove","onDidRemove","_onDidAdd","onDidAdd","_onDidMaximizedChange","onDidMaximizedChange","_onDidActiveChange","onDidActiveChange","_bufferOnDidLayoutChange","onDidLayoutChange","_onDidViewVisibilityChangeMicroTaskQueue","onDidViewVisibilityChangeMicroTaskQueue","panel","forceRelayout","isVisible","updateOptions","_c","_d","maximizeGroup","doSetGroupActive","isMaximizedGroup","exitMaximizedGroup","hasMaximizedGroup","doAddGroup","group","doRemoveGroup","has","skipActive","getPanel","setActive","removeGroup","moveToNext","moveToPrevious","forceResize","SplitviewApi","component","panels","onDidLayoutFromJSON","removePanel","focus","addPanel","movePanel","PaneviewApi","onDidDrop","onUnhandledDragOver","GridviewApi","onDidAddPanel","onDidAddGroup","onDidRemovePanel","onDidRemoveGroup","onDidActivePanelChange","onDidActiveGroupChange","force","DockviewApi","tabGroupColors","tabGroupColorPalette","entries","totalPanels","onDidMovePanel","onWillDrop","onWillMutateLayout","onDidMutateLayout","onWillShowOverlay","onWillDragGroup","onWillDragPanel","onDidPopoutGroupSizeChange","onDidPopoutGroupPositionChange","onDidAddPopoutGroup","onDidRemovePopoutGroup","onDidOpenPopoutWindowFail","getPopouts","onDidCreateTabGroup","onDidDestroyTabGroup","onDidAddPanelToTabGroup","onDidRemovePanelFromTabGroup","onDidTabGroupChange","onDidTabGroupCollapsedChange","adjacentGroupInDirection","activePanel","getGroupPanel","withOrigin","addGroup","closeAllGroups","getGroup","addFloatingGroup","onDidMaximizedGroupChange","addPopoutGroup","addEdgeGroup","getEdgeGroup","setEdgeGroupVisible","isEdgeGroupVisible","removeEdgeGroup","_getGroupModel","model","createTabGroup","label","color","componentParams","dissolveTabGroup","addPanelToTabGroup","removePanelFromTabGroup","getTabGroups","getTabGroupForPanel","moveTabGroup","DragAndDropObserver","callbacks","registerListeners","onDragEnter","onDragOver","onDragLeave","onDragEnd","onDrop","DEFAULT_SIZE","createOverlayElements","dropzone","selection","computeOverlayShape","quadrant","overlayModel","isSmallX","smallWidthBoundary","isSmallY","smallHeightBoundary","isLeft","isRight","isTop","isBottom","rightClass","leftClass","topClass","bottomClass","sizeOptions","renderInPlaceOverlay","overlay","shape","visibility","transform","isLine","renderAnchoredOverlay","elBox","outlineElement","ta","targetModel","getElements","bigbox","rootTop","rootLeft","bounds","topPx","leftPx","widthPx","heightPx","checkAnchoredBoundsChanged","applyAnchoredBounds","changed","boundsChanged","targetChanged","WillShowOverlayEvent","nativeEvent","directionToPosition","positionToDirection","DEFAULT_ACTIVATION_SIZE$1","Droptarget","_state","_onDrop","_onWillShowOverlay","_acceptedTargetZonesSet","acceptedTargetZones","dnd","getOverrideTarget","_e","_f","_g","ACTUAL_TARGET","overrideTarget","removeDropTarget","getOverlayOutline","offsetWidth","offsetHeight","rect","currentTarget","y","calculateQuadrant","isAlreadyUsed","canDisplayOverlay","willShowOverlayEvent","markAsUsed","targetElement","els","overlayElement","append","toggleClasses","stopPropagation","setTargetZones","setOverlayModel","USED_EVENT_ID","overlayType","activationSizeOptions","activationSize","calculateQuadrantAsPercentage","calculateQuadrantAsPixels","showOverlay","clearOverlay","threshold","xp","yp","PointerDragController","_instance","_targets","_targetByElement","_onDragStart","onDragStart","_onDragMove","onDragMove","_onDragEnd","active","_active","registerTarget","_currentTarget","beginDrag","cancel","pointerEvent","source","dataDisposable","pointerId","startX","startY","_onDragMoveCallback","_onDragEndCallback","_dataDisposable","_ghost","ghost","_iframeShield","ownerDocument","startEvent","targetWindow","defaultView","_moveListener","_handleMove","_upListener","_handleEnd","_cancelListener","handleDragLeave","_teardown","_findTargetUnder","elements","elementsFromPoint","current","update","dragEvent","newTarget","handleDragOver","dropped","handleDrop","onEnd","DEFAULT_ACTIVATION_SIZE","PointerDropTarget","_removeOverlay","handle","_onDragOver","_onDragLeave","_onDropEvent","zones","outlineEl","_calculateQuadrant","willShow","_targetElement","_overlayElement","activation","PointerDragSource","_armed","_startX","_startY","_touchOnly","touchOnly","_onPointerDown","setDisabled","_cancelPending","setTouchOnly","_shouldHandle","pointerType","isCancelled","_pendingPointerId","_startEvent","isTouch","initiationDelayOpt","touchInitiationDelay","initiationDelay","isFinite","_armTimer","pressToleranceOpt","pressTolerance","_pendingMoveListener","moveEvent","dx","dy","distance","hypot","_beginDrag","_pendingUpListener","upEvent","_pendingCancelListener","cancelEvent","cancelPending","triggerEvent","createGhost","PointerGhost","opts","offsetX","offsetY","opacity","String","willChange","initialX","initialY","owner","body","Html5DragSource","_pointerEventsDisposable","_h","_j","dataTransfer","ghostElement","setDragImage","addGhostImage","disposeGhost","effectAllowed","items","html5Backend","kind","createDropTarget","createDragSource","pointerBackend","pointerCreateGhost","spec","baseDispose","bind","disposeSpec","PROPERTY_KEYS_PANEVIEW","disableDnd","PaneviewUnhandledDragOverEvent","WillFocusEvent","PanelApiImpl","isFocused","_isFocused","isActive","_isActive","_isVisible","_width","_height","_parameters","panelUpdatesDisposable","_onDidDimensionChange","onDidDimensionsChange","_onDidChangeFocus","onDidFocusChange","_onWillFocus","onWillFocus","_onWillVisibilityChange","onWillVisibilityChange","_onActiveChange","onActiveChange","_onDidParametersChange","onDidParametersChange","getParameters","initialize","parameters","params","updateParameters","SplitviewPanelApiImpl","_onDidConstraintsChangeInternal","onDidConstraintsChangeInternal","_onDidConstraintsChange","onDidConstraintsChange","_onDidSizeChange","onDidSizeChange","setConstraints","setSize","PaneviewPanelApiImpl","_pane","_onDidExpansionChange","onDidExpansionChange","_onMouseEnter","onMouseEnter","_onMouseLeave","onMouseLeave","setExpanded","isExpanded","BasePanelView","_params","api","tabIndex","outline","overflow","focusTracker","part","init","getComponent","assign","key","PaneviewPanel","headerSize","_minimumBodySize","_maximumBodySize","minimumBodySize","maximumBodySize","headerVisible","_headerVisible","header","display","_onDidChangeExpansionState","_isExpanded","headerComponent","isHeaderVisible","accessor","ev","isPanelExpanded","renderOnce","expanded","bodyPart","getBodyComponent","headerPart","getHeaderComponent","title","lineHeight","minHeight","maxHeight","DraggablePaneviewPanel","_onDidDrop","_onUnhandledDragOver","initDragFeatures","accessorId","draggable","sharedDragOptions","html5DragSource","pointerDragSource","dropTargetOptions","firedEvent","pointerTarget","containerApi","existingPanel","allPanels","fromIndex","toIndex","_contentId","ContentContainer","setAttribute","dropTargetContainer","shiftKey","dropTarget","theme","dndPanelOverlay","resolveDropOverlayModel","pointerDropTarget","onDidOptionsChange","show","hide","setLabelledBy","tabElementId","removeAttribute","renderPanel","asActive","doRender","isPanelActive","content","onHide","renderer","renderContainer","detatch","onShow","attach","referenceContainer","openPanel","closePanel","refreshFocusState","LongPressDetector","_pointerId","delay","tolerance","_timer","_installContextMenuGuard","_installClickGuard","onLongPress","guard","timeout","capture","resolveDndCapabilities","html5","pointer","pointerHandlesMouse","dndStrategy","matchMedia","coarse","matches","fine","isCoarsePrimaryInput$1","_tabId","Tab","_direction","_onPointDown","onPointerDown","_onTabClick","onTabClick","_onDropped","caps","contentContainerId","tabAnimation","_buildOverlayModel","_buildGhostElement","PointerEvent","contextMenuService","setContent","custom","smallBoundary","dndTabIndicator","setDirection","updateDragAndDropState","getComputedStyle","newNode","isVertical","verticalSkip","getPropertyValue","getPropertyPriority","DockviewWillShowOverlayLocationEvent","GroupDragSource","groupAccessor","isFloatingMoveHandle","buildMultiPanelsGhost","ghostEl","bgColor","backgroundColor","padding","fontSize","borderRadius","whiteSpace","boxSizing","textContent","customGhost","buildGroupDragGhost","isFloating","Infinity","getFloatingOverlay","cancelPendingDrag","overlayMoveSub","refreshOverlayMoveSub","onDidStartMoving","locationChange","onDidLocationChange","floatingGroups","find","fg","VoidContainer","dragSource","closest","Scrollbar","_scrollOffset","_scrollbar","scrollableElement","deltaY","MouseWheelSpeed","calculateScrollbarStyles","originalClient","originalScrollOffset","scrollLeft","scrollTop","_animationTimer","clientSize","scrollSize","px","percentageComplete","DEFAULT_TAB_GROUP_COLORS","TabGroupColorPalette","_entries","_byId","_enabled","setEntries","defaultId","resolveValue","_fallbackPalette","getFallbackPalette","applyTabGroupAccent","palette","resolveTabGroupAccent","TabGroupChip","_palette","_onClick","onClick","_onContextMenu","onContextMenu","_label","_tabGroup","tabGroup","updateColor","updateLabel","updateCollapsed","collapsed","onDidCollapseChange","BaseTabGroupIndicator","underlines","_underlines","_ctx","_rafId","positionUnderlines","_positionUnderlinesSync","trackUnderlines","cancelAnimationFrame","performance","now","tick","syncUnderlineElements","activeGroupIds","underline","tabsList","getUnderline","containerRect","tabGroups","getDirection","containerCrossSize","activePanelId","getActivePanelId","tabMap","getTabMap","tg","panelIds","chipEl","getChipElement","startEdge","chipRect","chipStyle","leadingMargin","parseFloat","marginTop","marginLeft","firstPanelId","firstTabEntry","firstRect","lastPanelId","lastTabEntry","lastTabRect","endEdge","bottom","right","span","pid","te","chipCenter","currentTabSize","fullTabSize","progress","applyShape","WrapTabGroupIndicator","_applyStraightLine","svg","mainSize","groupStart","groupSpan","crossSize","getColorPalette","activeTabEntry","replaceChildren","createElementNS","activeRect","aStart","aEnd","headerPosition","getHeaderPosition","svgW","svgH","isRightHeader","xNear","xFar","cd","join","isBottomHeader","yNear","yFar","NoneTabGroupIndicator","_startEdge","_containerCrossSize","_activePanelId","_containerRect","EMPTY_MAP","TabGroupManager","chipRenderers","_chipRenderers","groupUnderlines","_indicator","skipNextCollapseAnimation","_skipNextCollapseAnimation","_callbacks","_pendingTransitionCleanups","_ensureChipForGroup","_positionChipForGroup","chip","_updateTabGroupClasses","refreshAccents","positionAllChips","updateDirection","snapshotChipWidths","widths","setGroupDragImage","clone","writingMode","realChildren","wrapper","actionsWrapper","clonedChip","querySelector","cursorInChipX","cursorInChipY","clonedChipRect","wrapperRect","cleanupTransition","disposeChipDrag","_buildChipGhostElement","disposeAll","cleanup","_ensureIndicator","Ctor","tabGroupIndicator","createChip","createTabGroupChipComponent","onChipDragStart","onChipDragEnd","once","onDidPanelChange","onChipContextMenu","onChipDrop","firstTabEl","nextSibling","tabs","getTabs","hasAnimation","panelGroupMap","tabEntry","tab","isGrouped","ids","isFirst","isLast","isCollapsed","fallbackTimer","affected","transition","isVert","Tabs","showTabsOverflowControl","_showTabsOverflowControl","_tabsList","_observerDisposable","hasOverflow","toggleDropdown","reset","_tabGroupManager","voidContainer","_voidContainerListeners","_voidContainer","_animState","sourceTabGroupId","currentInsertionIndex","handleVoidDrop","insertionIndex","_tabs","_commitGroupMove","_tabMap","selectedIndex","_pendingMarginCleanups","_pendingCollapse","_flipTransitionCleanup","_extendedDropZone","_pointerInsideTabsList","_onTabDragStart","onTabDragStart","_onOverflowTabsChange","onOverflowTabsChange","scrollbars","showForChip","_handleChipDragStart","resetDragAnimation","_handleChipDrop","_handlePointerDragMove","button","primary","deltaX","passive","_onKeyDown","_processDragOver","_processDragLeave","relatedTarget","animState","sourceIndex","adjustedIndex","sourceCurrentGroup","sourceTabId","targetTabGroupId","_uncollapsSourceTab","resetTabTransforms","firstPositions","snapshotTabPositions","runFlipAnimation","getTabId","nextKey","prevKey","_focusTab","_closeTab","neighbourId","close","nextIndex","focusActiveTab","activeId","activeIndex","setActivePanel","running","isActivePanel","tabWidth","tabPositions","chipPositions","sourceGroupPanelIds","sourceChipWidth","cursorOffsetFromDragLeft","sourceGapWidth","containerLeft","applyDragOverTransforms","expand","collapse","isFloatingGroupsEnabled","disableFloatingGroups","isFloatingWithOnePanel","inDragMode","dropIndex","afterPosition","addTab","tabToRemove","refNode","overflowTabSet","chipEntry","chipClipped","allTabsOverflow","every","updateTabGroups","refreshTabGroupAccent","firstIdx","groupGapWidth","groupPanelIds","setExtendedDropZone","setExternalInsertionIndex","clearExternalAnimState","positions","getAverageTabWidth","elAtPoint","elementFromPoint","avgWidth","sourceGroup","sourceTg","related","mouseX","availableSpace","accWidth","firstPanelToGroup","chipWidth","origRect","isGroupDrag","accUpTo","gid","effectivePanelIds","lastIdx","isInsideRange","isJustBeforeGroup","allInBetweenAreSource","j","chipOriginalRight","_removeClassInstantlyBatch","cls","skipTransition","gapWidth","sourceRect","chipToShift","effectivePids","hasTabs","shiftingClass","setMargin","clearMargin","prev","gapApplied","_clearGroupDragClasses","moveGroupOrPanel","isCrossGroup","animRange","lastRect","abs","onTransitionEnd","propertyName","createSvgElementFromPath","setAttributeNS","viewbox","createChevronRightButton","TabsContainer","hidden","_hidden","rightActionsContainer","dropdownPart","_overflowTabs","_overflowTabGroups","_dropdownDisposable","_onGroupDragStart","onGroupDragStart","singleTabMode","leftActionsContainer","preActionsContainer","disableTabsOverflowList","setRightActionsElement","rightActions","setLeftActionsElement","leftActions","setPrefixActionsElement","preActions","_isGroupActive","updateClassnames","totalCount","text","icon","createDropdownElementHandle","prepend","overflowGroupSet","allTabGroups","panelToGroup","renderedGroups","groupHeader","colorDot","labelSpan","badge","getPopupServiceForGroup","panelObject","createTabRenderer","scrollIntoView","relativeParent","openPopover","DockviewUnhandledDragOverEvent","PROPERTY_KEYS_DOCKVIEW","floatingGroupBounds","transformFloatingGroupDrag","floatingGroupDragHandle","popoutUrl","nonce","defaultRenderer","defaultHeaderPosition","debug","noPanelsOverlay","dndEdges","getTabContextMenuItems","getTabGroupChipContextMenuItems","createGroupDragGhostComponent","dropOverlayModel","announcements","getAnnouncement","announcer","messages","keyboardNavigation","tabGroupAccent","isPanelOptionsWithPanel","referencePanel","isPanelOptionsWithGroup","referenceGroup","isGroupOptionsWithPanel","isGroupOptionsWithGroup","TabGroup","_color","_componentParams","setLabel","setColor","setComponentParams","_collapsed","_panelIds","isEmpty","_onDidPanelChange","_onDidCollapseChange","_onDidDestroy","onDidDestroy","insertIndex","indexOfPanel","containsPanel","DockviewDidDropEvent","DockviewWillDropEvent","_kind","DockviewGroupPanelModel","_tabGroups","_activePanel","contentContainer","contentDropTarget","_panels","hasWatermark","watermark","tabsContainer","isContentFocused","_headerPosition","updateHeaderActions","_location","applyZones","groupPanel","_onDidLocationChange","mostRecentlyUsed","_overwriteRenderContainer","_overwriteDropTargetContainer","_panelDisposables","_tabGroupDisposables","_pendingMicrotaskDisposables","_onMove","onMove","_onWillDrop","_onDidAddPanel","_onDidPanelTitleChange","onDidPanelTitleChange","_onDidPanelParametersChange","onDidPanelParametersChange","_onDidRemovePanel","_onDidActivePanelChange","_tabGroupMap","_panelToTabGroup","_tabGroupIdCounter","_pendingTabGroupUpdate","_onDidCreateTabGroup","_onDidDestroyTabGroup","_onDidAddPanelToTabGroup","_onDidRemovePanelFromTabGroup","_onDidTabGroupChange","_onDidTabGroupCollapsedChange","_api","hideHeader","updateAccessibleLabel","dragData","draggedPanelId","handleDropEvent","localIndex","globalIdx","_scheduleTabGroupUpdate","_bracketTabGroupMutation","mutation","_doCreateTabGroup","_handleGroupCollapse","_handleGroupExpand","_removeTabGroupInternal","existingGroup","_enforceContiguity","movePanelWithinGroup","newIndex","movePanelBetweenGroups","sourcePanelId","targetIndex","_findTabGroupForPanel","targetGroup","groupPanels","groupPanelsBefore","idx","globalIndex","_computeGlobalIndex","currentIndex","existingGlobalIndex","refreshWatermark","updateContainer","tabGroupDisposable","activePanelIndex","candidate","candidateGroup","doSetActivePanel","restoreTabGroups","serializedGroups","match","num","parseInt","concreteGroup","focusContent","rerender","overlayRenderContainer","rootDropTargetContainer","doAddPanel","headerActionsService","refresh","attachHeaderAction","slot","activeView","normalizedIndex","suppressRoll","skipSetActive","updateParentGroup","skipSetGroupActive","groupItemOrId","panelToRemove","_removePanel","closeAllPanels","arrPanelCpy","doClose","removeEmptyGroup","updateActions","isGroupActive","doRemovePanel","nextPanel","skipSetActiveGroup","hasExistingPanel","updateMru","onDidTitleChange","origin","currentOrigin","runEvents","shouldShowWatermark","createWatermarkComponent","willDropEvent","getKind","itemId","GridviewPanelApiImpl","GridviewPanel","_priority","_snap","__minimumWidth","__minimumHeight","__maximumHeight","__maximumWidth","_minimumWidth","_evaluatedMinimumWidth","updateConstraints","_maximumWidth","_evaluatedMaximumWidth","_minimumHeight","_evaluatedMinimumHeight","_maximumHeight","_evaluatedMaximumHeight","MAX_SAFE_INTEGER","maximum","minimum","NOT_INITIALIZED_MESSAGE","DockviewGroupPanelApiImpl","_group","boundingBox","_onDidCollapsedChange","onDidCollapsedChange","_pendingSize","getWindow","setHeaderPosition","moveTo","maximize","exitMaximized","setEdgeGroupCollapsed","isEdgeGroupCollapsed","DockviewGroupPanel","_explicitConstraints","activePanelMinimumWidth","activePanelMinimumHeight","activePanelMaximumWidth","activePanelMaximumHeight","_model","constraints","themeAbyss","name","colorScheme","DockviewPanelApiImpl","oldGroup","_onDidGroupChange","setupGroupEventListeners","tabComponent","_tabComponent","_onDidTitleChange","_onDidActiveGroupChange","onDidGroupChange","_onDidRendererChange","onDidRendererChange","groupEventsDisposable","setTitle","setRenderer","previousGroup","_trackGroupActive","hasBecomeHidden","hasBecomeVisible","DockviewPanel","_title","_renderer","contentComponent","updateFromStateModel","isPanelVisible","DefaultTab","_content","action","render","DockviewPanelModel","_tab","createContentComponent","createTabComponent","tabLocation","cmp","_updateEvent","componentName","createComponent","defaultTabComponent","DefaultDockviewDeserialzier","panelData","viewData","Watermark","arialLevelTracker","_orderedList","destroy","Overlay","minimumInViewportWidth","minimumInViewportHeight","headerHeight","_onDidChangeEnd","onDidChangeEnd","_onDidStartMoving","_dragMove","_dragCancelled","setupResize","setBounds","bringToFront","verticalAlignment","horiziontalAlignment","overlayRect","xOffset","getMinimumWidth","yOffset","getMinimumHeight","setupDrag","dragTarget","track","captureTarget","hasMoved","siblingBoxes","transformDragPosition","getSiblingBoxes","setPointerCapture","releasePointerCapture","proposedTop","proposedLeft","adjusted","proposed","others","maxTop","maxLeft","resizeHandleElement","move","startPosition","originalY","originalHeight","originalX","originalWidth","moveTop","MINIMUM_HEIGHT","moveBottom","moveLeft","MINIMUM_WIDTH","moveRight","minWidth","maxWidth","FloatingTitleBar","setGroup","defineModule","config","moduleName","services","serviceKey","dependsOn","_warnedMissingModule","assertModule","service","context","where","error","ModuleRegistry","_modules","_services","_initDisposables","register","module","dep","factory","postConstruct","_globalModules","registerModules","modules","m","getRegisteredModules","_dockviewPackageLoaded","markDockviewPackageLoaded","isDockviewPackageLoaded","DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE","DEFAULT_FLOATING_GROUP_POSITION","DockviewFloatingGroupPanel","setTitleBar","titleBar","_titleBar","setAnchorGroup","FloatingGroupService","_floatingGroups","_host","floatingGroupPanel","lastWidth","lastHeight","updateDialogLabel","fireLayoutChange","findByGroup","floating","grid","constrainBounds","updateBounds","minimumHeightWithinViewport","minimumWidthWithinViewport","FloatingGroupModule","PopoutWindowService","_popupServices","_restorationCleanups","_restorationPromise","Promise","resolve","restorationPromise","popoutGroup","findReferenceGroupId","observeGridviewSize","popoutWindow","PopoutResizeObserver","win","closed","updateAllPositions","raf","getPopupService","setPopupService","deletePopupService","scheduleRestoration","delayMs","work","onCancel","finishRestoration","promises","all","then","cancelPendingRestorations","url","base","gridReferenceGroup","dimensions","PopoutWindowModule","WatermarkService","_watermark","hasVisibleGridGroup","_unmount","mountElement","WatermarkModule","EdgeGroupService","_edgeGroups","_edgeGroupDisposables","autoCollapseDisposable","hasAny","edgeGroup","findPositionOf","EdgeGroupModule","DEFAULT_ROOT_OVERLAY_MODEL","RootDropTargetService","isGridEmpty","dispatchUnhandledDragOver","_html5Target","rootDropTargetOverrideTarget","_pointerTarget","setOptions","RootDropTargetModule","SLOT_OPTION_KEY","prefix","HeaderActionsService","_perGroup","_ensureState","_refreshSlot","refreshAll","disposeGroup","HeaderActionsModule","DEFAULT_MESSAGES","panelOpened","panelClosed","groupMaximized","groupRestored","groupFloated","groupDocked","groupPoppedOut","movePickTarget","movePickEdge","edgeWhere","moveCommitted","committedWhere","moveCancelled","moveNotAllowed","resolveMessages","overrides","isBulk","createLiveRegion","politeness","clip","clipPath","border","LiveRegionService","_suppressDepth","_locationSubs","_polite","_assertive","_announce","_trackLocation","sub","announce","message","region","_defaultMessage","LiveRegionModule","AllModules","PositionCache","cache","currentFrameId","rafId","getPosition","cached","frameId","scheduleFrameUpdate","invalidate","OverlayRenderContainer","positionCache","pendingUpdates","createFocusableElement","focusContainer","contentElement","box2","visibilityChanged","observerDisposable","correctLayerPosition","floatingGroup","level","getAttribute","MutationObserver","attributeFilter","attributes","__awaiter","thisArg","_arguments","P","generator","reject","fulfilled","step","rejected","done","apply","SuppressedError","PopoutWindow","_window","_onWillClose","onWillClose","_onDidClose","onDidClose","screenX","screenY","innerWidth","innerHeight","open","resolved","URL","href","protocol","assertSameOriginPopoutUrl","features","externalWindow","createPopoutWindowContainer","onDidOpen","externalDocument","styleSheetList","styleSheets","resolvedNonce","link","rel","cssTexts","cssRules","rule","err","fragment","createDocumentFragment","addStyles","StrictEventsSequencing","PopupService","_activeDisposable","updateRoot","newRoot","anchorBox","openedAt","Date","HTMLElement","isCoarsePrimaryInput","buffer","rootRect","translateX","translateY","shiftAbsoluteElementIntoView","DropTargetAnchorContainer","exists","_outline","anchor","createAnchor","targetBox","EdgeGroupView","_isCollapsed","_collapsedSize","_expandedMinimumSize","_expandedMaximumSize","lastExpandedSize","_lastExpandedSize","collapsedSize","dataset","testid","initialSize","setCollapsed","restoreExpandedSize","updateCollapsedSize","newCollapsedSize","newExpandedMinimumSize","CenterView","_dockviewElement","_layoutDockview","MiddleColumnView","centerView","gap","_splitview","_centerIndex","addTopView","_topIndex","_bottomIndex","addBottomView","updateMargin","ShellManager","dockviewElement","layoutGrid","defaultCollapsedSize","_viewConfigs","_currentWidth","_currentHeight","_gap","_defaultCollapsedSize","_shellElement","_middleColumn","_outerSplitview","_middleIndex","addEdgeView","hasEdgeGroup","outerN","innerN","outerGapAdd","innerGapAdd","isHorizontal","gapAdd","defaultCollapsed","effectiveCollapsed","adjustedOpts","_leftIndex","_rightIndex","_leftView","_rightView","_topView","_bottomView","updateTheme","updateView","baseCfg","newCS","baseMS","newMS","topCfg","bottomCfg","leftCfg","rightCfg","removeEdgeView","_getView","targetSize","edgeGroups","_k","_l","_m","_o","_p","_q","_r","_s","_t","_u","_v","moveGroupWithoutDestroying","removedPanel","_hasWarnedUsingCoreDirectly","DockviewComponent","fireDidCreateTabGroup","fireDidDestroyTabGroup","fireDidAddPanelToTabGroup","fireDidRemovePanelFromTabGroup","fireDidTabGroupChange","fireDidTabGroupCollapsedChange","flatMap","_options","_tabGroupColorPalette","_moduleRegistry","floatingGroupService","_gatherFloatingGroupBoxes","_floatingOverlayHost","_floatingGroupService","_popoutWindowService","popoutWindowService","_watermarkService","watermarkService","_edgeGroupService","edgeGroupService","_rootDropTargetService","rootDropTargetService","_advancedDnDService","advancedDnDService","fireWillDragPanel","_onWillDragPanel","fireWillDragGroup","_onWillDragGroup","fireWillDrop","fireWillShowOverlay","resolveOverlayModel","rootElement","_shellManager","adjacentGroup","fromX","fromY","best","bestDistance","showDropPreview","showPreviewOverlay","liveRegionService","dockPanel","popoutRestorationPromise","nextGroupId","_deserializer","_mutationDepth","_origin","_originDepth","_onWillMutateLayout","_onDidMutateLayout","_onDidPopoutGroupSizeChange","_onDidPopoutGroupPositionChange","_onDidAddPopoutGroup","_onDidRemovePopoutGroup","_onDidOpenPopoutWindowFail","_onDidLayoutFromJSON","_onDidMovePanel","_onDidMaximizedGroupChange","_inShellLayout","_onDidRemoveGroup","_onDidAddGroup","_onDidOptionsChange","_moving","buildTabGroupColorPalette","explicitModules","process","env","NODE_ENV","popupService","w","h","_layoutFromShell","edgeGroupCollapsedSize","_shellThemeClassnames","debouncedUpdateAllPositions","rootDropTarget","orthogonalize","itemToPopout","_doAddPopoutGroup","toClassList","list","startsWith","getDockviewTheme","overridePopoutGroup","getNextGroupId","resolvedPopoutUrl","popoutWindowDisposable","popoutContainer","referenceLocation","isGroupAddedToDom","overridePopoutGridview","createGroup","handleBlockedPopout","gready","popoutGridview","createNestedGridview","popoutGridviewDisposed","disposePopoutGridview","floatingBox","movingLock","popoutPopupService","members","member","doSetGroupAndPanelActive","resizeObserverDisposable","closeResult","isValidReferenceGroup","returnedGroup","_onDidWindowPositionChange","emitter","previousScreenX","previousScreenY","checkMovement","currentScreenX","currentScreenY","onDidWindowMoveEnd","resizeTimeout","onDidWindowResizeEnd","disposePopoutWindow","catch","blockedGridview","redockGroupToMainGrid","genuineClose","anchorPresent","anchorIsSoleMember","skipPopoutReturn","skipPopoutAssociated","_doAddFloatingGroup","popoutReferenceGroupId","popoutReferenceGroup","skipRemoveGroup","anchoredBox","getAnchoredBox","floatingGridview","mountFloatingWindow","dragHandle","skipActiveGroup","anchorGroup","createGroupAtLocation","oldDisableDnd","oldDndStrategy","newDisableDnd","newDndStrategy","_syncFloatingOverlayHost","shellRect","gridRect","includePanel","collection","floats","popoutGroups","edgeEntries","shellSerialized","_doFromJSON","existingPanels","tempGroup","reuseExistingPanels","newPanels","keepEmptyGroups","isArray","createGroupFromSerializedState","createdPanels","deserializeEdgeGroups","deserializeFloatingWindows","popoutPromises","deserializePopoutWindows","deserializeNestedGridview","edgeService","_position","fixedData","groupState","edgeData","serialized","serializedFloatingGroup","popoutService","serializedPopoutGroup","built","orphan","_doClear","hasActiveGroup","_doAddPanel","initial","initialWidth","initialHeight","findGroup","createPanel","inactive","floatingGroupOptions","relativeLocation","orientationAtLocation","coordinates","_doRemovePanel","_doAddGroup","detachFromNestedWindow","nestedWindowMembers","popout","disposeGroupRecord","activateFallbackGroupIfRemoved","removed","selectedGroup","refGroup","removedGroup","re","fireActivePanelChange","_updatePositionsFrameId","isMoving","outer","_doMoveGroupOrPanel","destinationGroup","sourceGroupId","sourceItemId","destinationTarget","destinationIndex","destinationGridview","getGridviewForGroup","targetLocation","targetParentLocation","sourceLocation","sourceParentLocation","updatedTargetLocation","newGroup","updatedReferenceLocation","setGroupLocationForRoot","dropLocation","isDestinationGroupEmpty","moveTabGroupToGroup","moveGroup","removedPanels","newTabGroup","addPanelsToGroup","_doMoveGroup","tabGroupSnapshots","snapshot","movedPanels","selectedFloatingGroup","selectedPopoutGroup","destGridview","dispatchWillDragPanel","dispatchWillDragGroup","dispatchWillDrop","dispatchWillShowOverlay","dndOverlayBorder","dndOverlayMounting","indicatorNone","GridviewComponent","_onDidLayoutfromJSON","hasOrientationChanged","_key","serializedGridview","queue","registerPanel","f","reference","groupItem","SplitviewComponent","_splitviewChangeDisposable","_onDidLayoutChange","skipFocus","doAddView","serializedSplitview","DefaultHeader","_expandedIcon","_collapsedIcon","apiRef","_expander","updateIcon","nextLayoutId","MAXIMUM_BODY_SIZE","PaneFramework","PaneviewComponent","paneview","_paneview","_viewDisposables","createHeaderComponent","serializedPaneview","SplitviewPanel","_minimumSize","_evaluatedMinimumSize","_maximumSize","_evaluatedMaximumSize","createDockview","createSplitview","createGridview","createPaneview","TabGroupChipsService","attachToGroup","DockviewCompositeDisposable","TabGroupChipsModule","perGroupDisposables","popoverZIndexFor","_nextId","nextContextMenuItemId","isItemConfig","buildItem","buildSeparator","buildRenameInput","input","placeholder","select","buildColorPicker","swatch","ContextMenuController","menuEl","createContextMenuItemComponent","componentProps","ContextMenuModule","AdvancedDnDService","DockviewDisposable","AdvancedDnDModule","KEYBOARD_MOVE_ATTRIBUTE","matchesBinding","binding","parts","toLowerCase","mods","ctrlKey","altKey","metaKey","readKeyboardNavigation","opt","DEFAULT_KEYMAP$1","nextTab","prevTab","focusNextGroup","focusPrevGroup","focusTabs","AccessibilityService","_focusWasInside","doc","onKeyDown","onFocusIn","_lastNonFloatFocus","onEscape","_onFloatingEscape","_nav","_isFocusInside","_restoreFocus","_moveActive","hasAttribute","Element","float","_returnFocusFromFloat","_trapFloatTab","tabbables","_tabbables","nodes","querySelectorAll","isConnected","g","_keymap","keymap","_consume","_switchTab","_cycleGroup","_focusTabs","_focusGroup","AccessibilityModule","EDGE_FROM_KEY","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","DEFAULT_KEYMAP","KeyboardDockingService","_move","_exit","focusGroupLeft","focusGroupRight","focusGroupUp","focusGroupDown","dock","_messages","_onMoveKey","_enterMoveMode","_focusGroupInDirection","groupIndex","phase","_render","_commit","edge","_clearPreview","_preview","ReactComponentBridge","props","triggerRender","React","useState","_props","useRef","useImperativeHandle","displayName","uniquePortalKeyGenerator","ReactPartContext","createContext","ReactPart","portalStore","_initialProps","disposed","createPortal","componentInstance","isReactComponent","bridgeComponent","forwardRef","Provider","portal","ReactDOM","addPortal","usePortalsLifecycle","portals","setPortals","useDebugValue","useCallback","existingPortals","$$typeof","ReactPanelContentPart","reactPortalStore","DockviewEmitter","ReactPanelHeaderPart","ReactWatermarkPart","ReactHeaderActionsRendererPart","_part","mutableDisposable","DockviewMutableDisposable","updatePanels","updateActivePanel","updateGroupActive","updateLocation","ReactContextMenuItemPart","ReactTabGroupChipPart","ReactGroupDragGhostPart","createGroupControlElement","store","DEFAULT_REACT_TAB","DockviewReact","domRef","dockviewRef","prevProps","useEffect","changes","propKey","propValue","frameworkTabComponents","tabComponents","frameworkOptions","createLeftHeaderActionComponent","leftHeaderActionsComponent","createRightHeaderActionComponent","rightHeaderActionsComponent","createPrefixHeaderActionComponent","prefixHeaderActionsComponent","components","watermarkComponent","coreOptions","obj","extractCoreOptions","tabGroupChipComponent","chipComponent","groupDragGhostComponent","ghostComponent","onReady","CloseButton","viewBox","focusable","ReactPanelView","reactComponent","SplitviewReact","splitviewRef","ReactGridPanelView","GridviewReact","gridviewRef","PanePanelSection","PaneviewReact","paneviewRef","headerComponents","_containerApi","hideClose","closeActionOverride","onPointerUp","onPointerLeave","hasOwnProperty","getOwnPropertySymbols","propertyIsEnumerable","__rest","useTitle","isMiddleMouseButton","onClose","onBtnPointerDown","_onPointerUp","_onPointerLeave"],"mappings":";;;;;;6UA2EWA,GC3EX,SAAqBC,EAAKC,YACnBA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAgC,oBAAbC,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBW,CAqBzD;;;;;;;ADnBA,MAAMe,GAEN,MAAMC,UAAsBD,EACxB,WAAAE,CAAYC,EAAQC,EAASC,EAASC,GAClCC,QACAC,KAAKL,OAASA,EACdK,KAAKJ,QAAUA,EACfI,KAAKH,QAAUA,EACfG,KAAKF,WAAaA,CACtB,EAEJ,MAAMG,UAAqBT,EACvB,WAAAE,CAAYC,EAAQO,GAChBH,QACAC,KAAKL,OAASA,EACdK,KAAKE,OAASA,CAClB,EAKJ,MAAMC,EACF,WAAAT,GAEA,CACA,kBAAOU,GACH,OAAOD,EAAuBE,QAClC,C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D,YAAa,uBAqBI,CACjBD,KAAM,UACNhjD,UAAW,yBACXijD,YAAa,0BA6EO,CACpBD,KAAM,aACNhjD,UAAW,6BACXijD,YAAa,gCAEa,CAC1BD,KAAM,mBACNhjD,UAAW,oCACXijD,YAAa,OACb6W,IAAK,GACL2I,uBAAwB,GACxByK,mBAAoB,WACpB91C,gBAAiB,QACjB+D,gBAAiB,OACjB8xC,iBAAkB,4DAEG,CACrBjqB,KAAM,cACNhjD,UAAW,8BACXijD,YAAa,kCAEc,CAC3BD,KAAM,oBACNhjD,UAAW,qCACXijD,YAAa,QACb6W,IAAK,GACL2I,uBAAwB,GACxByK,mBAAoB,WACpB91C,gBAAiB,QACjB+D,gBAAiB,OACjB8xC,iBAAkB,sDAjIH,CACfjqB,KAAM,QACNhjD,UAAW,uBACXijD,YAAa,4BAgCQ,CACrBD,KAAM,cACNhjD,UAAW,8BACXijD,YAAa,QACb6W,IAAK,GACL2I,uBAAwB,GACxByK,mBAAoB,WACpB91C,gBAAiB,QACjB+D,gBAAiB,OACjB8xC,iBAAkB,wDAkCD,CACjBjqB,KAAM,UACNhjD,UAAW,yBACXijD,YAAa,oBAnCC,CACdD,KAAM,OACNhjD,UAAW,sBACXijD,YAAa,0BAEO,CACpBD,KAAM,aACNhjD,UAAW,6BACXijD,YAAa,OACb6W,IAAK,GACL2I,uBAAwB,GACxByK,mBAAoB,WACpB91C,gBAAiB,QACjB+D,gBAAiB,OACjB8xC,iBAAkB,+DAuBM,CACxBjqB,KAAM,iBACNhjD,UAAW,iCACXijD,YAAa,qCAEiB,CAC9BD,KAAM,uBACNhjD,UAAW,wCACXijD,YAAa,QACb6W,IAAK,GACL2I,uBAAwB,GACxByK,mBAAoB,WACpB91C,gBAAiB,QACjB+D,gBAAiB,OACjB8xC,iBAAkB,6DA5FI,CACtBjqB,KAAM,eACNhjD,UAAW,oBACXijD,YAAa,OAGbwf,uBAAwB","x_google_ignoreList":[1,12]}