diff --git a/client.html b/client.html index 19c6c987..101e4782 100644 --- a/client.html +++ b/client.html @@ -4,4 +4,4 @@ #client_ooclog a { color: white; - }

Loading

Choose your character





Having trouble? Join us on Discord

\ No newline at end of file + }

Loading

Choose your character





Having trouble? Join us on Discord

\ No newline at end of file diff --git a/ui.0a8056a3ae2a0e82fb87.bundle.js.map b/ui.0a8056a3ae2a0e82fb87.bundle.js.map deleted file mode 100644 index e81255b3..00000000 --- a/ui.0a8056a3ae2a0e82fb87.bundle.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ui.0a8056a3ae2a0e82fb87.bundle.js","mappings":"yBACA,MAAeA,UAAsBC,MACjC,WAAAC,CAAYC,EAAcC,EAAcC,GACpCC,MAAM,GAAGH,MAASC,SAAmBG,IAAZF,EAAwB,GAAK,KAAOA,IACjE,EAIG,MAAMG,UAAoBR,EAC7B,WAAAE,CAAYE,EAAcC,GACtBC,MAAM,SAAUF,EAAMC,EAC1B,EAIG,MAAMI,UAA6BT,EACtC,WAAAE,CAAYE,EAAcM,EAAsBL,GAC5CC,MAAM,kBAAmBF,EAAM,GAAGM,SAA4BH,IAAZF,EAAwB,GAAK,KAAOA,IAC1F,EAIG,MAAMM,UAA4BX,EACrC,WAAAE,CAAYE,EAAcC,GACtBC,MAAM,iBAAkBF,EAAMC,EAClC,EAIG,MAAMO,UAAiCZ,EAC1C,WAAAE,CAAYE,EAAcC,GACtBC,MAAM,sBAAuBF,EAAMC,EACvC,ECzBG,IAAUQ,ECNAC,ECMAC,EAoBAC,EAUAC,GF9BjB,SAAiBJ,GAMb,MAAMK,EAA0B,CAC5B,WACA,aACA,2BACA,mBACA,aACA,cACA,gBACA,eACA,eACA,iBACA,kBACA,SACA,QACA,WACA,WACA,SACA,UACA,gBACA,iBACA,KACA,QACA,OACA,SACA,aACA,QACA,mBACA,cACA,WACA,kBACA,iBACA,mBAQEC,EAAwC,EAC1C,GACA,EACA,MACA,SACA,QACA,YACA,QACA,WACA,WACA,sBASJ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,YACN8C,OAAQ,GACR2E,YAAY,EACZuJ,cAAe,WACf5H,MAAO,KACPC,eAAgB,CAAE7B,GAAI,mBAExB,CACExH,KAAM,YACN8C,OAAQ,GACR2E,YAAY,EACZ2B,MAAO,aACP4H,cAAe,WACf3H,eAAgB,CAAE7B,GAAI,gBAG1B,CACExH,KAAM,SACNmH,QAAS,CAAC,CACRnH,KAAM,MACN8C,OAAQ,GACRqE,QAAS,CAAC,CACRnH,KAAM,QACNmH,QAAS,CAAC,CACRnH,KAAM,YACNyH,YAAY,EACZ2B,MAAO,OACP4H,cAAe,WACf3H,eAAgB,CAAE7B,GAAI,aAExB,CACExH,KAAM,YACNyH,YAAY,EACZ2B,MAAO,MACP4H,cAAe,WACf3H,eAAgB,CAAE7B,GAAI,UAG1B,CACExH,KAAM,QACN6C,MAAO,GACPsE,QAAS,CAAC,CACRnH,KAAM,YACNyH,YAAY,EACZ2B,MAAO,QACP4H,cAAe,WACf3H,eAAgB,CAAE7B,GAAI,UAExB,CACExH,KAAM,YACNyH,YAAY,EACZ2B,MAAO,UACP4H,cAAe,WACf3H,eAAgB,CAAE7B,GAAI,gBAI5B,CACExH,KAAM,MACNmH,QAAS,CAAC,CACRnH,KAAM,YACNoJ,MAAO,MACP4H,cAAe,WACf3H,eAAgB,CAAE7B,GAAI,gB","sources":["webpack://webao/./node_modules/golden-layout/src/ts/errors/internal-error.ts","webpack://webao/./node_modules/golden-layout/src/ts/utils/config-minifier.ts","webpack://webao/./node_modules/golden-layout/src/ts/utils/style-constants.ts","webpack://webao/./node_modules/golden-layout/src/ts/utils/types.ts","webpack://webao/./node_modules/golden-layout/src/ts/config/resolved-config.ts","webpack://webao/./node_modules/golden-layout/src/ts/utils/i18n-strings.ts","webpack://webao/./node_modules/golden-layout/src/ts/utils/utils.ts","webpack://webao/./node_modules/golden-layout/src/ts/errors/external-error.ts","webpack://webao/./node_modules/golden-layout/src/ts/config/config.ts","webpack://webao/./node_modules/golden-layout/src/ts/utils/event-emitter.ts","webpack://webao/./node_modules/golden-layout/src/ts/controls/browser-popout.ts","webpack://webao/./node_modules/golden-layout/src/ts/controls/header-button.ts","webpack://webao/./node_modules/golden-layout/src/ts/utils/drag-listener.ts","webpack://webao/./node_modules/golden-layout/src/ts/controls/tab.ts","webpack://webao/./node_modules/golden-layout/src/ts/controls/tabs-container.ts","webpack://webao/./node_modules/golden-layout/src/ts/controls/header.ts","webpack://webao/./node_modules/golden-layout/src/ts/container/component-container.ts","webpack://webao/./node_modules/golden-layout/src/ts/items/content-item.ts","webpack://webao/./node_modules/golden-layout/src/ts/items/component-item.ts","webpack://webao/./node_modules/golden-layout/src/ts/items/component-parentable-item.ts","webpack://webao/./node_modules/golden-layout/src/ts/items/stack.ts","webpack://webao/./node_modules/golden-layout/src/ts/controls/drag-proxy.ts","webpack://webao/./node_modules/golden-layout/src/ts/controls/splitter.ts","webpack://webao/./node_modules/golden-layout/src/ts/items/row-or-column.ts","webpack://webao/./node_modules/golden-layout/src/ts/items/ground-item.ts","webpack://webao/./node_modules/golden-layout/src/ts/controls/drag-source.ts","webpack://webao/./node_modules/golden-layout/src/ts/controls/drop-target-indicator.ts","webpack://webao/./node_modules/golden-layout/src/ts/controls/transition-indicator.ts","webpack://webao/./node_modules/golden-layout/src/ts/utils/event-hub.ts","webpack://webao/./node_modules/golden-layout/src/ts/layout-manager.ts","webpack://webao/./node_modules/golden-layout/src/ts/virtual-layout.ts","webpack://webao/./webAO/ui.js","webpack://webao/./node_modules/golden-layout/src/ts/golden-layout.ts"],"sourcesContent":["/** @internal */\nabstract class InternalError extends Error {\n constructor(type: string, code: string, message?: string) {\n super(`${type}: ${code}${message === undefined ? '' : ': ' + message}`)\n }\n}\n\n/** @internal */\nexport class AssertError extends InternalError {\n constructor(code: string, message?: string) {\n super('Assert', code, message)\n }\n}\n\n/** @internal */\nexport class UnreachableCaseError extends InternalError {\n constructor(code: string, variableValue: never, message?: string) {\n super('UnreachableCase', code, `${variableValue}${message === undefined ? '' : ': ' + message}`)\n }\n}\n\n/** @internal */\nexport class UnexpectedNullError extends InternalError {\n constructor(code: string, message?: string) {\n super('UnexpectedNull', code, message)\n }\n}\n\n/** @internal */\nexport class UnexpectedUndefinedError extends InternalError {\n constructor(code: string, message?: string) {\n super('UnexpectedUndefined', code, message)\n }\n}\n","/**\n * Minifies and unminifies configs by replacing frequent keys\n * and values with one letter substitutes. Config options must\n * retain array position/index, add new options at the end.\n * @internal\n*/\n\nexport namespace ConfigMinifier {\n\n export type YY = 'id' | 'title';\n export const enum XX {\n id = 'id'\n }\n const keys: readonly string[] = [\n 'settings',\n 'hasHeaders',\n 'constrainDragToContainer',\n 'selectionEnabled',\n 'dimensions',\n 'borderWidth',\n 'minItemHeight',\n 'minItemWidth',\n 'headerHeight',\n 'dragProxyWidth',\n 'dragProxyHeight',\n 'labels',\n 'close',\n 'maximise',\n 'minimise',\n 'popout',\n 'content',\n 'componentType',\n 'componentState',\n 'id',\n 'width',\n 'type',\n 'height',\n 'isClosable',\n 'title',\n 'popoutWholeStack',\n 'openPopouts',\n 'parentId',\n 'activeItemIndex',\n 'reorderEnabled',\n 'borderGrabWidth',\n\n\n\n\n //Maximum 36 entries, do not cross this line!\n ];\n\n const values: readonly (boolean | string)[] = [\n true,\n false,\n 'row',\n 'column',\n 'stack',\n 'component',\n 'close',\n 'maximise',\n 'minimise',\n 'open in new window'\n ];\n\n export function checkInitialise(): void {\n if (keys.length > 36) {\n throw new Error('Too many keys in config minifier map');\n }\n }\n\n export function translateObject(from: Record, minify: boolean): Record {\n const to: Record = {};\n for (const key in from) {\n if (from.hasOwnProperty(key)) { // In case something has extended Object prototypes\n let translatedKey: string;\n if (minify) {\n translatedKey = minifyKey(key);\n } else {\n translatedKey = unminifyKey(key);\n }\n\n const fromValue = from[key];\n to[translatedKey] = translateValue(fromValue, minify);\n }\n }\n\n return to;\n }\n\n function translateArray(from: unknown[], minify: boolean) {\n const length = from.length;\n const to = new Array(length);\n for (let i = 0; i < length; i++) {\n // In original code, array indices were numbers and not translated\n const fromValue = from[i];\n to[i] = translateValue(fromValue, minify);\n }\n return to;\n }\n\n function translateValue(from: unknown, minify: boolean) {\n if (typeof from === 'object') {\n if (from === null) {\n return null;\n } else {\n if (Array.isArray(from)) {\n return translateArray(from, minify);\n } else {\n return translateObject(from as Record, minify);\n }\n }\n } else {\n if (minify) {\n return minifyValue(from);\n } else {\n return unminifyValue(from);\n }\n }\n }\n\n function minifyKey(value: string) {\n /**\n * If a value actually is a single character, prefix it\n * with ___ to avoid mistaking it for a minification code\n */\n if (typeof value === 'string' && value.length === 1) {\n return '___' + value;\n }\n \n const index = indexOfKey(value);\n \n /**\n * value not found in the dictionary, return it unmodified\n */\n if (index === -1) {\n return value;\n \n /**\n * value found in dictionary, return its base36 counterpart\n */\n } else {\n return index.toString(36);\n }\n }\n\n function unminifyKey(key: string) {\n /**\n * value is a single character. Assume that it's a translation\n * and return the original value from the dictionary\n */\n if (key.length === 1) {\n return keys[parseInt(key, 36)];\n }\n \n /**\n * value originally was a single character and was prefixed with ___\n * to avoid mistaking it for a translation. Remove the prefix\n * and return the original character\n */\n if (key.substr(0, 3) === '___') {\n return key[3];\n }\n /**\n * value was not minified\n */\n return key;\n }\n\n function minifyValue(value: unknown) {\n /**\n * If a value actually is a single character, prefix it\n * with ___ to avoid mistaking it for a minification code\n */\n if (typeof value === 'string' && value.length === 1) {\n return '___' + value;\n }\n \n const index = indexOfValue(value);\n \n /**\n * value not found in the dictionary, return it unmodified\n */\n if (index === -1) {\n return value;\n \n /**\n * value found in dictionary, return its base36 counterpart\n */\n } else {\n return index.toString(36);\n }\n }\n\n function unminifyValue(value: unknown) {\n /**\n * value is a single character. Assume that it's a translation\n * and return the original value from the dictionary\n */\n if (typeof value === 'string' && value.length === 1) {\n return values[parseInt(value, 36)];\n }\n\n /**\n * value originally was a single character and was prefixed with ___\n * to avoid mistaking it for a translation. Remove the prefix\n * and return the original character\n */\n if (typeof value === 'string' && value.substr(0, 3) === '___') {\n return value[3];\n }\n /**\n * value was not minified\n */\n return value;\n }\n\n function indexOfKey(key: string) {\n for (let i = 0; i < keys.length; i++) {\n if (keys[i] === key) {\n return i;\n }\n }\n return -1;\n }\n\n function indexOfValue(value: unknown) {\n for (let i = 0; i < values.length; i++) {\n if (values[i] === value) {\n return i;\n }\n }\n return -1;\n }\n}\n","/** @public */\nexport namespace StyleConstants {\n export const defaultComponentBaseZIndex = 'auto';\n export const defaultComponentDragZIndex = '32';\n export const defaultComponentStackMaximisedZIndex = '41';\n}\n","import { UnreachableCaseError } from '../errors/internal-error';\nimport { StyleConstants } from './style-constants';\n\n/** @internal */\nexport type WidthOrHeightPropertyName = 'width' | 'height';\n\n/** @internal */\nexport namespace WidthOrHeightPropertyName {\n export const width = 'width';\n export const height = 'height';\n}\n\n/** @internal */\nexport interface WidthAndHeight {\n width: number;\n height: number;\n}\n\n/** @internal */\nexport interface LeftAndTop {\n left: number;\n top: number;\n}\n\n/** @public */\nexport type Side = 'top' | 'left' | 'right' | 'bottom';\n/** @public */\nexport namespace Side {\n export const top = 'top';\n export const left = 'left';\n export const right = 'right';\n export const bottom = 'bottom';\n}\n\n/** @public */\nexport type LogicalZIndex = 'base' | 'drag' | 'stackMaximised';\n/** @public */\nexport namespace LogicalZIndex {\n export const base = 'base';\n export const drag = 'drag';\n export const stackMaximised = 'stackMaximised';\n}\n\n/** @public */\nexport const LogicalZIndexToDefaultMap = {\n base: StyleConstants.defaultComponentBaseZIndex,\n drag: StyleConstants.defaultComponentDragZIndex,\n stackMaximised: StyleConstants.defaultComponentStackMaximisedZIndex,\n}\n\n/** @internal */\nexport interface Rect {\n left: number,\n top: number,\n width: number,\n height: number,\n}\n\n/** @internal */\nexport interface AreaLinkedRect {\n x1: number, // left\n x2: number, // nextLeft\n y1: number, // top\n y2: number, // nextTop\n}\n\n/** @public */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type JsonValue = string | number | boolean | null | Json | object | JsonValueArray;\n/** @public */\nexport interface Json {\n [name: string]: JsonValue;\n}\n/** @public */\nexport type JsonValueArray = Array\n/** @public */\nexport namespace JsonValue {\n export function isJson(value: JsonValue): value is Json {\n return isJsonObject(value);\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-types\n export function isJsonObject(value: JsonValue): value is Json | object {\n return !Array.isArray(value) && value !== null && typeof value === 'object';\n }\n}\n\n/** @public */\nexport type ItemType = 'ground' | 'row' | 'column' | 'stack' | 'component';\n\n/** @public */\nexport namespace ItemType {\n export const ground = 'ground';\n export const row = 'row';\n export const column = 'column';\n export const stack = 'stack';\n export const component = 'component';\n}\n\n/** @public */\nexport type ResponsiveMode = 'none' | 'always' | 'onload';\n/** @public */\nexport namespace ResponsiveMode {\n export const none = 'none';\n export const always = 'always';\n export const onload = 'onload';\n}\n\n/**\n * Length units which can specify the size of a Component Item\n * @public\n */\nexport type SizeUnit = 'px' | '%' | 'fr' | 'em';\n\n/** @public */\nexport enum SizeUnitEnum {\n Pixel = 'px',\n Percent = '%',\n Fractional = 'fr',\n Em = 'em',\n}\n\n/** @public */\nexport namespace SizeUnitEnum {\n export function tryParse(value: string) {\n switch (value) {\n case SizeUnitEnum.Pixel: return SizeUnitEnum.Pixel;\n case SizeUnitEnum.Percent: return SizeUnitEnum.Percent;\n case SizeUnitEnum.Fractional: return SizeUnitEnum.Fractional;\n case SizeUnitEnum.Em: return SizeUnitEnum.Em;\n default: return undefined;\n }\n }\n\n export function format(value: SizeUnitEnum) {\n switch (value) {\n case SizeUnitEnum.Pixel: return SizeUnitEnum.Pixel;\n case SizeUnitEnum.Percent: return SizeUnitEnum.Percent;\n case SizeUnitEnum.Fractional: return SizeUnitEnum.Fractional;\n case SizeUnitEnum.Em: return SizeUnitEnum.Em;\n default:\n throw new UnreachableCaseError('SUEF44998', value);\n }\n }\n}\n","import { AssertError, UnreachableCaseError } from '../errors/internal-error';\nimport { ConfigMinifier } from '../utils/config-minifier';\nimport { ItemType, JsonValue, ResponsiveMode, Side, SizeUnitEnum } from '../utils/types';\nimport { deepExtendValue } from '../utils/utils';\n\n/** @public */\nexport interface ResolvedItemConfig {\n // see ItemConfig for comments\n readonly type: ItemType;\n readonly content: readonly ResolvedItemConfig[];\n readonly size: number;\n readonly sizeUnit: SizeUnitEnum;\n readonly minSize: number | undefined;\n readonly minSizeUnit: SizeUnitEnum;\n // id no longer specifies whether an Item is maximised. This is now done by HeaderItemConfig.maximised\n readonly id: string;\n readonly isClosable: boolean;\n}\n\n/** @public */\nexport namespace ResolvedItemConfig {\n export const defaults: ResolvedItemConfig = {\n type: ItemType.ground, // not really default but need something\n content: [],\n size: 1,\n sizeUnit: SizeUnitEnum.Fractional,\n minSize: undefined,\n minSizeUnit: SizeUnitEnum.Pixel,\n id: '',\n isClosable: true,\n } as const;\n\n /** Creates a copy of the original ResolvedItemConfig using an alternative content if specified */\n export function createCopy(original: ResolvedItemConfig, content?: ResolvedItemConfig[]): ResolvedItemConfig {\n switch (original.type) {\n case ItemType.ground:\n case ItemType.row:\n case ItemType.column:\n return ResolvedRowOrColumnItemConfig.createCopy(original as ResolvedRowOrColumnItemConfig,\n content as ResolvedRowOrColumnItemConfig.ChildItemConfig[]);\n\n case ItemType.stack:\n return ResolvedStackItemConfig.createCopy(original as ResolvedStackItemConfig, content as ResolvedComponentItemConfig[]);\n\n case ItemType.component:\n return ResolvedComponentItemConfig.createCopy(original as ResolvedComponentItemConfig);\n\n default:\n throw new UnreachableCaseError('CICC91354', original.type, 'Invalid Config Item type specified');\n }\n }\n\n export function createDefault(type: ItemType): ResolvedItemConfig {\n switch (type) {\n case ItemType.ground:\n throw new AssertError('CICCDR91562'); // Get default root from LayoutConfig\n case ItemType.row:\n case ItemType.column:\n return ResolvedRowOrColumnItemConfig.createDefault(type);\n\n case ItemType.stack:\n return ResolvedStackItemConfig.createDefault();\n\n case ItemType.component:\n return ResolvedComponentItemConfig.createDefault();\n\n default:\n throw new UnreachableCaseError('CICCDD91563', type, 'Invalid Config Item type specified');\n }\n }\n\n export function isComponentItem(itemConfig: ResolvedItemConfig): itemConfig is ResolvedComponentItemConfig {\n return itemConfig.type === ItemType.component;\n }\n\n export function isStackItem(itemConfig: ResolvedItemConfig): itemConfig is ResolvedStackItemConfig {\n return itemConfig.type === ItemType.stack;\n }\n\n /** @internal */\n export function isGroundItem(itemConfig: ResolvedItemConfig): itemConfig is ResolvedGroundItemConfig {\n return itemConfig.type === ItemType.ground;\n }\n}\n\n// Stack or Component\n/** @public */\nexport interface ResolvedHeaderedItemConfig extends ResolvedItemConfig {\n header: ResolvedHeaderedItemConfig.Header | undefined; // undefined means get header settings from LayoutConfig\n readonly maximised: boolean;\n}\n\n/** @public */\nexport namespace ResolvedHeaderedItemConfig {\n export const defaultMaximised = false;\n\n export interface Header {\n // undefined means get property value from LayoutConfig\n readonly show: false | Side | undefined;\n readonly popout: false | string | undefined;\n readonly maximise: false | string | undefined;\n readonly close: string | undefined;\n readonly minimise: string | undefined;\n readonly tabDropdown: false | string | undefined;\n }\n\n export namespace Header {\n export function createCopy(original: Header | undefined, show?: false | Side): Header | undefined {\n if (original === undefined) {\n return undefined;\n } else {\n return {\n show: show ?? original.show,\n popout: original.popout,\n close: original.close,\n maximise: original.maximise,\n minimise: original.minimise,\n tabDropdown: original.tabDropdown,\n }\n }\n }\n }\n}\n\n/** @public */\nexport interface ResolvedStackItemConfig extends ResolvedHeaderedItemConfig {\n readonly type: 'stack';\n readonly content: ResolvedComponentItemConfig[];\n /** The index of the active item in the Stack. Only undefined if the Stack is empty. */\n readonly activeItemIndex: number | undefined;\n}\n\n/** @public */\nexport namespace ResolvedStackItemConfig {\n export const defaultActiveItemIndex = 0;\n\n export function createCopy(original: ResolvedStackItemConfig, content?: ResolvedComponentItemConfig[]): ResolvedStackItemConfig {\n const result: ResolvedStackItemConfig = {\n type: original.type,\n content: content !== undefined ? copyContent(content) : copyContent(original.content),\n size: original.size,\n sizeUnit: original.sizeUnit,\n minSize: original.minSize,\n minSizeUnit: original.minSizeUnit,\n id: original.id,\n maximised: original.maximised,\n isClosable: original.isClosable,\n activeItemIndex: original.activeItemIndex,\n header: ResolvedHeaderedItemConfig.Header.createCopy(original.header),\n }\n return result;\n }\n\n export function copyContent(original: ResolvedComponentItemConfig[]): ResolvedComponentItemConfig[] {\n const count = original.length;\n const result = new Array(count);\n for (let i = 0; i < count; i++) {\n result[i] = ResolvedItemConfig.createCopy(original[i]) as ResolvedComponentItemConfig;\n }\n return result;\n }\n\n export function createDefault(): ResolvedStackItemConfig {\n const result: ResolvedStackItemConfig = {\n type: ItemType.stack,\n content: [],\n size: ResolvedItemConfig.defaults.size,\n sizeUnit: ResolvedItemConfig.defaults.sizeUnit,\n minSize: ResolvedItemConfig.defaults.minSize,\n minSizeUnit: ResolvedItemConfig.defaults.minSizeUnit,\n id: ResolvedItemConfig.defaults.id,\n maximised: ResolvedHeaderedItemConfig.defaultMaximised,\n isClosable: ResolvedItemConfig.defaults.isClosable,\n activeItemIndex: defaultActiveItemIndex,\n header: undefined,\n }\n return result;\n }\n}\n\n/** @public */\nexport interface ResolvedComponentItemConfig extends ResolvedHeaderedItemConfig {\n // see ComponentItemConfig for comments\n readonly type: 'component';\n readonly content: [];\n readonly title: string;\n readonly reorderEnabled: boolean; // Takes precedence over LayoutConfig.reorderEnabled.\n /**\n * The name of the component as specified in layout.registerComponent. Mandatory if type is 'component'.\n */\n readonly componentType: JsonValue;\n readonly componentState?: JsonValue;\n}\n\n/** @public */\nexport namespace ResolvedComponentItemConfig {\n export const defaultReorderEnabled = true;\n\n export function resolveComponentTypeName(itemConfig: ResolvedComponentItemConfig): string | undefined {\n const componentType = itemConfig.componentType;\n if (typeof componentType === 'string') {\n return componentType;\n } else {\n return undefined;\n }\n }\n\n export function createCopy(original: ResolvedComponentItemConfig): ResolvedComponentItemConfig {\n const result: ResolvedComponentItemConfig = {\n type: original.type,\n content: [],\n size: original.size,\n sizeUnit: original.sizeUnit,\n minSize: original.minSize,\n minSizeUnit: original.minSizeUnit,\n id: original.id,\n maximised: original.maximised,\n isClosable: original.isClosable,\n reorderEnabled: original.reorderEnabled,\n title: original.title,\n header: ResolvedHeaderedItemConfig.Header.createCopy(original.header),\n componentType: original.componentType,\n componentState: deepExtendValue(undefined, original.componentState) as JsonValue,\n }\n return result;\n }\n\n export function createDefault(componentType: JsonValue = '', componentState?: JsonValue, title = ''): ResolvedComponentItemConfig {\n const result: ResolvedComponentItemConfig = {\n type: ItemType.component,\n content: [],\n size: ResolvedItemConfig.defaults.size,\n sizeUnit: ResolvedItemConfig.defaults.sizeUnit,\n minSize: ResolvedItemConfig.defaults.minSize,\n minSizeUnit: ResolvedItemConfig.defaults.minSizeUnit,\n id: ResolvedItemConfig.defaults.id,\n maximised: ResolvedHeaderedItemConfig.defaultMaximised,\n isClosable: ResolvedItemConfig.defaults.isClosable,\n reorderEnabled: ResolvedComponentItemConfig.defaultReorderEnabled,\n title,\n header: undefined,\n componentType,\n componentState,\n }\n return result;\n }\n\n export function copyComponentType(componentType: JsonValue): JsonValue {\n return deepExtendValue({}, componentType) as JsonValue\n }\n}\n\n/** Base for Root or RowOrColumn ItemConfigs\n * @public\n */\nexport interface ResolvedRowOrColumnItemConfig extends ResolvedItemConfig {\n readonly type: 'row' | 'column';\n /** Note that RowOrColumn ResolvedItemConfig contents, can contain ComponentItem itemConfigs. However\n * when ContentItems are created, these ComponentItem itemConfigs will create a Stack with a child ComponentItem.\n */\n readonly content: readonly (ResolvedRowOrColumnItemConfig | ResolvedStackItemConfig | ResolvedComponentItemConfig)[];\n}\n\n/** @public */\nexport namespace ResolvedRowOrColumnItemConfig {\n export type ChildItemConfig = ResolvedRowOrColumnItemConfig | ResolvedStackItemConfig | ResolvedComponentItemConfig;\n\n export function isChildItemConfig(itemConfig: ResolvedItemConfig): itemConfig is ChildItemConfig {\n switch (itemConfig.type) {\n case ItemType.row:\n case ItemType.column:\n case ItemType.stack:\n case ItemType.component:\n return true;\n case ItemType.ground:\n return false;\n default:\n throw new UnreachableCaseError('CROCOSPCICIC13687', itemConfig.type);\n }\n }\n\n export function createCopy(original: ResolvedRowOrColumnItemConfig, content?: ChildItemConfig[]): ResolvedRowOrColumnItemConfig {\n const result: ResolvedRowOrColumnItemConfig = {\n type: original.type,\n content: content !== undefined ? copyContent(content) : copyContent(original.content),\n size: original.size,\n sizeUnit: original.sizeUnit,\n minSize: original.minSize,\n minSizeUnit: original.minSizeUnit,\n id: original.id,\n isClosable: original.isClosable,\n }\n return result;\n }\n\n export function copyContent(original: readonly ChildItemConfig[]): ChildItemConfig[] {\n const count = original.length;\n const result = new Array(count);\n for (let i = 0; i < count; i++) {\n result[i] = ResolvedItemConfig.createCopy(original[i]) as ChildItemConfig;\n }\n return result;\n }\n\n export function createDefault(type: 'row' | 'column'): ResolvedRowOrColumnItemConfig {\n const result: ResolvedRowOrColumnItemConfig = {\n type,\n content: [],\n size: ResolvedItemConfig.defaults.size,\n sizeUnit: ResolvedItemConfig.defaults.sizeUnit,\n minSize: ResolvedItemConfig.defaults.minSize,\n minSizeUnit: ResolvedItemConfig.defaults.minSizeUnit,\n id: ResolvedItemConfig.defaults.id,\n isClosable: ResolvedItemConfig.defaults.isClosable,\n }\n return result;\n }\n}\n\n/**\n * RootItemConfig is the topmost ResolvedItemConfig specified by the user.\n * Note that it does not have a corresponding contentItem. It specifies the one and only child of the Ground ContentItem\n * Note that RootItemConfig can be an ComponentItem itemConfig. However when the Ground ContentItem's child is created\n * a ComponentItem itemConfig will create a Stack with a child ComponentItem.\n * @public\n*/\nexport type ResolvedRootItemConfig = ResolvedRowOrColumnItemConfig | ResolvedStackItemConfig | ResolvedComponentItemConfig;\n\n/** @public */\nexport namespace ResolvedRootItemConfig {\n export function createCopy(config: ResolvedRootItemConfig): ResolvedRootItemConfig {\n return ResolvedItemConfig.createCopy(config) as ResolvedRootItemConfig;\n }\n\n export function isRootItemConfig(itemConfig: ResolvedItemConfig): itemConfig is ResolvedRootItemConfig {\n switch (itemConfig.type) {\n case ItemType.row:\n case ItemType.column:\n case ItemType.stack:\n case ItemType.component:\n return true;\n case ItemType.ground:\n return false;\n default:\n throw new UnreachableCaseError('CROCOSPCICIC13687', itemConfig.type);\n }\n }\n}\n\n/** @internal */\nexport interface ResolvedGroundItemConfig extends ResolvedItemConfig {\n readonly type: 'ground';\n readonly size: 100,\n readonly sizeUnit: SizeUnitEnum.Percent,\n readonly minSize: 0,\n readonly minSizeUnit: SizeUnitEnum.Pixel,\n readonly id: '',\n readonly isClosable: false,\n readonly title: '',\n readonly reorderEnabled: false,\n}\n\n/** @internal */\nexport namespace ResolvedGroundItemConfig {\n export function create(rootItemConfig: ResolvedRootItemConfig | undefined):ResolvedGroundItemConfig {\n const content = rootItemConfig === undefined ? [] : [rootItemConfig];\n return {\n type: ItemType.ground,\n content,\n size: 100,\n sizeUnit: SizeUnitEnum.Percent,\n minSize: 0,\n minSizeUnit: SizeUnitEnum.Pixel,\n id: '',\n isClosable: false,\n title: '',\n reorderEnabled: false,\n }\n }\n}\n\n/** @public */\nexport interface ResolvedLayoutConfig {\n readonly root: ResolvedRootItemConfig | undefined;\n readonly openPopouts: ResolvedPopoutLayoutConfig[];\n readonly dimensions: ResolvedLayoutConfig.Dimensions;\n readonly settings: ResolvedLayoutConfig.Settings;\n readonly header: ResolvedLayoutConfig.Header;\n readonly resolved: true,\n}\n\n/** @public */\nexport namespace ResolvedLayoutConfig {\n export interface Settings {\n // see Config.Settings for comments\n readonly constrainDragToContainer: boolean;\n readonly reorderEnabled: boolean; // also in ResolvedItemConfig which takes precedence\n readonly popoutWholeStack: boolean;\n readonly blockedPopoutsThrowError: boolean;\n /** @deprecated Will be removed in version 3. */\n readonly closePopoutsOnUnload: boolean;\n readonly responsiveMode: ResponsiveMode;\n readonly tabOverlapAllowance: number;\n readonly reorderOnTabMenuClick: boolean;\n readonly tabControlOffset: number;\n readonly popInOnClose: boolean;\n }\n\n export namespace Settings {\n export const defaults: ResolvedLayoutConfig.Settings = {\n constrainDragToContainer: true,\n reorderEnabled: true,\n popoutWholeStack: false,\n blockedPopoutsThrowError: true,\n closePopoutsOnUnload: true,\n responsiveMode: ResponsiveMode.none, // was onload\n tabOverlapAllowance: 0,\n reorderOnTabMenuClick: true,\n tabControlOffset: 10,\n popInOnClose: false,\n } as const;\n\n export function createCopy(original: Settings): Settings {\n return {\n constrainDragToContainer: original.constrainDragToContainer,\n reorderEnabled: original.reorderEnabled,\n popoutWholeStack: original.popoutWholeStack,\n blockedPopoutsThrowError: original.blockedPopoutsThrowError,\n closePopoutsOnUnload: original.closePopoutsOnUnload,\n responsiveMode: original.responsiveMode,\n tabOverlapAllowance: original.tabOverlapAllowance,\n reorderOnTabMenuClick: original.reorderOnTabMenuClick,\n tabControlOffset: original.tabControlOffset,\n popInOnClose: original.popInOnClose,\n }\n }\n }\n\n export interface Dimensions {\n // see LayoutConfig.Dimensions for comments\n readonly borderWidth: number;\n readonly borderGrabWidth: number,\n readonly defaultMinItemHeight: number;\n readonly defaultMinItemHeightUnit: SizeUnitEnum;\n readonly defaultMinItemWidth: number;\n readonly defaultMinItemWidthUnit: SizeUnitEnum;\n readonly headerHeight: number;\n readonly dragProxyWidth: number;\n readonly dragProxyHeight: number;\n }\n\n export namespace Dimensions {\n export function createCopy(original: Dimensions): Dimensions {\n return {\n borderWidth: original.borderWidth,\n borderGrabWidth: original.borderGrabWidth,\n defaultMinItemHeight: original.defaultMinItemHeight,\n defaultMinItemHeightUnit: original.defaultMinItemHeightUnit,\n defaultMinItemWidth: original.defaultMinItemWidth,\n defaultMinItemWidthUnit: original.defaultMinItemWidthUnit,\n headerHeight: original.headerHeight,\n dragProxyWidth: original.dragProxyWidth,\n dragProxyHeight: original.dragProxyHeight,\n }\n }\n\n export const defaults: ResolvedLayoutConfig.Dimensions = {\n borderWidth: 5,\n borderGrabWidth: 5,\n defaultMinItemHeight: 0,\n defaultMinItemHeightUnit: SizeUnitEnum.Pixel,\n defaultMinItemWidth: 10,\n defaultMinItemWidthUnit: SizeUnitEnum.Pixel,\n headerHeight: 20,\n dragProxyWidth: 300,\n dragProxyHeight: 200\n } as const;\n }\n\n export interface Header {\n readonly show: false | Side;\n readonly popout: false | string;\n readonly dock: string;\n readonly maximise: false | string;\n readonly minimise: string;\n readonly close: false | string;\n readonly tabDropdown: false | string;\n }\n\n export namespace Header {\n export function createCopy(original: Header): Header {\n return {\n show: original.show,\n popout: original.popout,\n dock: original.dock,\n close: original.close,\n maximise: original.maximise,\n minimise: original.minimise,\n tabDropdown: original.tabDropdown,\n }\n }\n\n export const defaults: ResolvedLayoutConfig.Header = {\n show: Side.top,\n popout: 'open in new window',\n dock: 'dock',\n maximise: 'maximise',\n minimise: 'minimise',\n close: 'close',\n tabDropdown: 'additional tabs'\n } as const;\n }\n\n export function isPopout(config: ResolvedLayoutConfig): config is ResolvedPopoutLayoutConfig {\n return 'parentId' in config;\n }\n\n export function createDefault(): ResolvedLayoutConfig {\n const result: ResolvedLayoutConfig = {\n root: undefined,\n openPopouts: [],\n dimensions: ResolvedLayoutConfig.Dimensions.defaults,\n settings: ResolvedLayoutConfig.Settings.defaults,\n header: ResolvedLayoutConfig.Header.defaults,\n resolved: true,\n }\n return result;\n }\n\n export function createCopy(config: ResolvedLayoutConfig): ResolvedLayoutConfig {\n if (isPopout(config)) {\n return ResolvedPopoutLayoutConfig.createCopy(config);\n } else {\n const result: ResolvedLayoutConfig = {\n root: config.root === undefined ? undefined : ResolvedRootItemConfig.createCopy(config.root),\n openPopouts: ResolvedLayoutConfig.copyOpenPopouts(config.openPopouts),\n settings: ResolvedLayoutConfig.Settings.createCopy(config.settings),\n dimensions: ResolvedLayoutConfig.Dimensions.createCopy(config.dimensions),\n header: ResolvedLayoutConfig.Header.createCopy(config.header),\n resolved: config.resolved,\n }\n return result;\n }\n }\n\n export function copyOpenPopouts(original: ResolvedPopoutLayoutConfig[]): ResolvedPopoutLayoutConfig[] {\n const count = original.length;\n const result = new Array(count);\n for (let i = 0; i < count; i++) {\n result[i] = ResolvedPopoutLayoutConfig.createCopy(original[i]);\n }\n return result;\n }\n\n /**\n * Takes a GoldenLayout configuration object and\n * replaces its keys and values recursively with\n * one letter counterparts\n */\n export function minifyConfig(layoutConfig: ResolvedLayoutConfig): ResolvedLayoutConfig {\n return ConfigMinifier.translateObject(layoutConfig, true) as ResolvedLayoutConfig;\n }\n\n /**\n * Takes a configuration Object that was previously minified\n * using minifyConfig and returns its original version\n */\n export function unminifyConfig(minifiedConfig: ResolvedLayoutConfig): ResolvedLayoutConfig {\n return ConfigMinifier.translateObject(minifiedConfig, false) as ResolvedLayoutConfig;\n }\n}\n\n/** @public */\nexport interface ResolvedPopoutLayoutConfig extends ResolvedLayoutConfig {\n readonly parentId: string | null;\n readonly indexInParent: number | null;\n readonly window: ResolvedPopoutLayoutConfig.Window;\n}\n\n/** @public */\nexport namespace ResolvedPopoutLayoutConfig {\n export interface Window {\n readonly width: number | null,\n readonly height: number | null,\n readonly left: number | null,\n readonly top: number | null,\n }\n\n export namespace Window {\n export function createCopy(original: Window): Window {\n return {\n width: original.width,\n height: original.height,\n left: original.left,\n top: original.top,\n }\n }\n\n export const defaults: ResolvedPopoutLayoutConfig.Window = {\n width: null,\n height: null,\n left: null,\n top: null,\n } as const;\n }\n\n export function createCopy(original: ResolvedPopoutLayoutConfig): ResolvedPopoutLayoutConfig {\n const result: ResolvedPopoutLayoutConfig = {\n root: original.root === undefined ? undefined : ResolvedRootItemConfig.createCopy(original.root),\n openPopouts: ResolvedLayoutConfig.copyOpenPopouts(original.openPopouts),\n settings: ResolvedLayoutConfig.Settings.createCopy(original.settings),\n dimensions: ResolvedLayoutConfig.Dimensions.createCopy(original.dimensions),\n header: ResolvedLayoutConfig.Header.createCopy(original.header),\n parentId: original.parentId,\n indexInParent: original.indexInParent,\n window: ResolvedPopoutLayoutConfig.Window.createCopy(original.window),\n resolved: original.resolved,\n }\n return result;\n }\n}\n","import { AssertError } from '../errors/internal-error';\n\n/** @public */\nexport const enum I18nStringId {\n PopoutCannotBeCreatedWithGroundItemConfig,\n PleaseRegisterAConstructorFunction,\n ComponentTypeNotRegisteredAndBindComponentEventHandlerNotAssigned,\n ComponentIsAlreadyRegistered,\n ComponentIsNotVirtuable,\n VirtualComponentDoesNotHaveRootHtmlElement,\n ItemConfigIsNotTypeComponent,\n InvalidNumberPartInSizeString,\n UnknownUnitInSizeString,\n UnsupportedUnitInSizeString,\n}\n\n/** @public */\nexport namespace I18nStrings {\n /** @internal */\n let initialised = false;\n\n /** @internal */\n interface Info {\n readonly id: I18nStringId;\n readonly default: string;\n }\n\n /** @internal */\n type InfosObject = { [id in keyof typeof I18nStringId]: Info };\n\n /** @internal */\n const infosObject: InfosObject = {\n PopoutCannotBeCreatedWithGroundItemConfig: {\n id: I18nStringId.PopoutCannotBeCreatedWithGroundItemConfig,\n default: 'Popout cannot be created with ground ItemConfig'\n },\n PleaseRegisterAConstructorFunction: {\n id: I18nStringId.PleaseRegisterAConstructorFunction,\n default: 'Please register a constructor function'\n },\n ComponentTypeNotRegisteredAndBindComponentEventHandlerNotAssigned: {\n id: I18nStringId.ComponentTypeNotRegisteredAndBindComponentEventHandlerNotAssigned,\n default: 'Component type not registered and BindComponentEvent handler not assigned',\n },\n ComponentIsAlreadyRegistered: {\n id: I18nStringId.ComponentIsAlreadyRegistered,\n default: 'Component is already registered',\n },\n ComponentIsNotVirtuable: {\n id: I18nStringId.ComponentIsNotVirtuable,\n default: 'Component is not virtuable. Requires rootHtmlElement field/getter',\n },\n VirtualComponentDoesNotHaveRootHtmlElement: {\n id: I18nStringId.VirtualComponentDoesNotHaveRootHtmlElement,\n default: 'Virtual component does not have getter \"rootHtmlElement\"',\n },\n ItemConfigIsNotTypeComponent: {\n id: I18nStringId.ItemConfigIsNotTypeComponent,\n default: 'ItemConfig is not of type component',\n },\n\n InvalidNumberPartInSizeString: {\n id: I18nStringId.InvalidNumberPartInSizeString,\n default: 'Invalid number part in size string',\n },\n UnknownUnitInSizeString: {\n id: I18nStringId.UnknownUnitInSizeString,\n default: 'Unknown unit in size string',\n },\n UnsupportedUnitInSizeString: {\n id: I18nStringId.UnsupportedUnitInSizeString,\n default: 'Unsupported unit in size string',\n },\n }\n\n export const idCount = Object.keys(infosObject).length;\n /** @internal */\n const infos = Object.values(infosObject);\n\n export function checkInitialise(): void {\n if (!initialised) {\n for (let i = 0; i < idCount; i++) {\n const info = infos[i];\n if (info.id !== i) {\n throw new AssertError('INSI00110', `${i}: ${info.id}`);\n } else {\n i18nStrings[i] = info.default;\n }\n }\n }\n initialised = true;\n }\n}\n\n/** @public */\nexport const i18nStrings = new Array(I18nStrings.idCount);\n","import { WidthAndHeight } from './types';\n\n/** @internal */\nexport function numberToPixels(value: number): string {\n return value.toString(10) + 'px';\n}\n\n/** @internal */\nexport function pixelsToNumber(value: string): number {\n const numberStr = value.replace(\"px\", \"\");\n return parseFloat(numberStr);\n}\n\n/** @internal */\nexport interface SplitStringAtFirstNonNumericCharResult {\n numericPart: string;\n firstNonNumericCharPart: string;\n}\n\n/** @internal */\nexport function splitStringAtFirstNonNumericChar(value: string): SplitStringAtFirstNonNumericCharResult {\n value = value.trimStart();\n\n const length = value.length;\n if (length === 0) {\n return { numericPart: '', firstNonNumericCharPart: '' }\n } else {\n let firstNonDigitPartIndex = length;\n let gotDecimalPoint = false;\n for (let i = 0; i < length; i++) {\n const char = value[i];\n if (!isDigit(char)) {\n if (char !== '.') {\n firstNonDigitPartIndex = i;\n break;\n } else {\n if (gotDecimalPoint) {\n firstNonDigitPartIndex = i;\n break;\n } else {\n gotDecimalPoint = true;\n }\n }\n }\n }\n const digitsPart = value.substring(0, firstNonDigitPartIndex);\n const firstNonDigitPart = value.substring(firstNonDigitPartIndex).trim();\n\n return { numericPart: digitsPart, firstNonNumericCharPart: firstNonDigitPart };\n }\n}\n\n/** @internal */\nexport function isDigit(char: string) {\n return char >= '0' && char <= '9';\n}\n\n/** @internal */\nexport function getElementWidth(element: HTMLElement): number {\n return element.offsetWidth;\n}\n\n/** @internal */\nexport function setElementWidth(element: HTMLElement, width: number): void {\n const widthAsPixels = numberToPixels(width);\n element.style.width = widthAsPixels;\n}\n\n/** @internal */\nexport function getElementHeight(element: HTMLElement): number {\n return element.offsetHeight;\n}\n\n/** @internal */\nexport function setElementHeight(element: HTMLElement, height: number): void {\n const heightAsPixels = numberToPixels(height);\n element.style.height = heightAsPixels;\n}\n\n/** @internal */\nexport function getElementWidthAndHeight(element: HTMLElement): WidthAndHeight {\n return {\n width: element.offsetWidth,\n height: element.offsetHeight,\n };\n}\n\n/** @internal */\nexport function setElementDisplayVisibility(element: HTMLElement, visible: boolean): void {\n if (visible) {\n element.style.display = '';\n } else {\n element.style.display = 'none';\n }\n}\n\n/** @internal */\nexport function ensureElementPositionAbsolute(element: HTMLElement): void {\n const absolutePosition = 'absolute';\n if (element.style.position !== absolutePosition) {\n element.style.position = absolutePosition;\n }\n}\n\n/**\n * Replacement for JQuery $.extend(target, obj)\n * @internal\n*/\nexport function extend(target: Record, obj: Record): Record {\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n target[key] = obj[key];\n }\n }\n return target;\n}\n\n/**\n * Replacement for JQuery $.extend(true, target, obj)\n * @internal\n*/\nexport function deepExtend(target: Record, obj: Record | undefined): Record {\n if (obj !== undefined) {\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n const value = obj[key];\n const existingTarget = target[key];\n target[key] = deepExtendValue(existingTarget, value);\n }\n }\n }\n\n return target;\n}\n\n/** @internal */\nexport function deepExtendValue(existingTarget: unknown, value: unknown): unknown {\n if (typeof value !== 'object') {\n return value;\n } else {\n if (Array.isArray(value)) {\n const length = value.length;\n const targetArray = new Array(length);\n for (let i = 0; i < length; i++) {\n const element = value[i];\n targetArray[i] = deepExtendValue({}, element);\n }\n return targetArray;\n } else {\n if (value === null) {\n return null;\n } else {\n const valueObj = value as Record;\n if (existingTarget === undefined) {\n return deepExtend({}, valueObj); // overwrite\n } else {\n if (typeof existingTarget !== \"object\") {\n return deepExtend({}, valueObj); // overwrite\n } else {\n if (Array.isArray(existingTarget)) {\n return deepExtend({}, valueObj); // overwrite\n } else {\n if (existingTarget === null) {\n return deepExtend({}, valueObj); // overwrite\n } else {\n const existingTargetObj = existingTarget as Record;\n return deepExtend(existingTargetObj, valueObj); // merge\n }\n }\n }\n }\n }\n }\n }\n}\n\n/** @internal */\nexport function removeFromArray(item: T, array: T[]): void {\n const index = array.indexOf(item);\n\n if (index === -1) {\n throw new Error('Can\\'t remove item from array. Item is not in the array');\n }\n\n array.splice(index, 1);\n}\n\n/** @internal */\nexport function getUniqueId(): string {\n return (Math.random() * 1000000000000000)\n .toString(36)\n .replace('.', '');\n}\n\n/** @internal */\nexport function getErrorMessage(e: unknown): string {\n if (e instanceof Error) {\n return e.message;\n } else {\n if (typeof e === 'string') {\n return e;\n } else {\n return 'Unknown Error';\n }\n }\n}\n","/** @public */\nexport abstract class ExternalError extends Error {\n /** @internal */\n constructor(public readonly type: string, message: string) {\n super(message);\n }\n}\n\n/** @public */\nexport class ConfigurationError extends ExternalError {\n /** @internal */\n constructor(message: string, public readonly node?: string) {\n super('Configuration', message);\n }\n}\n\n/** @public */\nexport class PopoutBlockedError extends ExternalError {\n /** @internal */\n constructor(message: string) {\n super('PopoutBlocked', message);\n }\n}\n\n/** @public */\nexport class ApiError extends ExternalError {\n /** @internal */\n constructor(message: string) {\n super('API', message);\n }\n}\n\n/** @public */\nexport class BindError extends ExternalError {\n /** @internal */\n constructor(message: string) {\n super('Bind', message);\n }\n}\n","import { ConfigurationError } from '../errors/external-error';\nimport { AssertError, UnexpectedUndefinedError, UnreachableCaseError } from '../errors/internal-error';\nimport { I18nStringId, i18nStrings } from '../utils/i18n-strings';\nimport { ItemType, JsonValue, ResponsiveMode, Side, SizeUnitEnum } from '../utils/types';\nimport { deepExtendValue, splitStringAtFirstNonNumericChar } from '../utils/utils';\nimport {\n ResolvedComponentItemConfig,\n ResolvedHeaderedItemConfig,\n ResolvedItemConfig,\n ResolvedLayoutConfig,\n ResolvedPopoutLayoutConfig,\n ResolvedRootItemConfig,\n ResolvedRowOrColumnItemConfig,\n ResolvedStackItemConfig\n} from \"./resolved-config\";\n\n/** @public */\nexport interface ItemConfig {\n /**\n * The type of the item. Possible values are 'row', 'column', 'stack', 'component'.\n */\n type: ItemType;\n\n /**\n * An array of configurations for items that will be created as children of this item.\n */\n content?: ItemConfig[];\n\n /**\n * The width of this item, relative to the other children of its parent in percent\n * @deprecated use {@link (ItemConfig:interface).size} instead\n */\n width?: number;\n\n /**\n * The minimum width of this item in pixels\n * CAUTION - Not tested - do not use\n * @deprecated use {@link (ItemConfig:interface).minSize} instead\n */\n minWidth?: number;\n\n /**\n * The height of this item, relative to the other children of its parent in percent\n * @deprecated use {@link (ItemConfig:interface).size} instead\n */\n height?: number;\n\n /**\n * The minimum height of this item in pixels\n * CAUTION - Not tested - do not use\n * @deprecated use {@link (ItemConfig:interface).minSize} instead\n */\n minHeight?: number;\n\n /**\n * The size of this item.\n * For rows, it specifies height. For columns, it specifies width.\n * Has format \\\\<{@link SizeUnit}\\>. Currently only supports units `fr` and `%`.\n *\n * Space is first proportionally allocated to items with sizeUnit `%`.\n * If there is any space left over (less than 100% allocated), then the\n * remainder is allocated to the items with unit `fr` according to the fractional size.\n * If more than 100% is allocated, then an extra 50% is allocated to items with unit `fr` and\n * is allocated to each item according to its fractional size. All item sizes are then adjusted\n * to bring the total back to 100%\n */\n size?: string;\n\n /**\n * The size of this item.\n * For rows, it specifies height. For columns, it specifies width.\n * Has format . Currently only supports units `px`\n */\n minSize?: string;\n\n /**\n * A string that can be used to identify a ContentItem.\n * Do NOT assign an array. This only exists for legacy purposes. If an array is assigned, the first element\n * will become the id.\n */\n id?: string;\n\n /**\n * Determines if the item is closable. If false, the x on the items tab will be hidden and container.close()\n * will return false\n * Default: true\n */\n isClosable?: boolean;\n\n /**\n * The title of the item as displayed on its tab and on popout windows\n * Default: componentType.toString() or ''\n * @deprecated only Component has a title\n */\n title?: string;\n}\n\n/** @public */\nexport namespace ItemConfig {\n /** @internal */\n export const enum SizeWidthHeightSpecificationType {\n None,\n Size,\n WidthOrHeight,\n }\n\n /** @internal */\n export function resolve(itemConfig: ItemConfig, rowAndColumnChildLegacySizeDefault: boolean): ResolvedItemConfig {\n switch (itemConfig.type) {\n case ItemType.ground:\n throw new ConfigurationError('ItemConfig cannot specify type ground', JSON.stringify(itemConfig));\n case ItemType.row:\n case ItemType.column:\n return RowOrColumnItemConfig.resolve(itemConfig as RowOrColumnItemConfig, rowAndColumnChildLegacySizeDefault);\n\n case ItemType.stack:\n return StackItemConfig.resolve(itemConfig as StackItemConfig, rowAndColumnChildLegacySizeDefault);\n\n case ItemType.component:\n return ComponentItemConfig.resolve(itemConfig as ComponentItemConfig, rowAndColumnChildLegacySizeDefault);\n\n default:\n throw new UnreachableCaseError('UCUICR55499', itemConfig.type);\n }\n }\n\n /** @internal */\n export function resolveContent(content: ItemConfig[] | undefined): ResolvedItemConfig[] {\n if (content === undefined) {\n return [];\n } else {\n const count = content.length;\n const result = new Array(count);\n for (let i = 0; i < count; i++) {\n result[i] = ItemConfig.resolve(content[i], false);\n }\n return result;\n }\n }\n\n /** @internal */\n export function resolveId(id: string | string[] | undefined): string {\n if (id === undefined) {\n return ResolvedItemConfig.defaults.id;\n } else {\n if (Array.isArray(id)) {\n if (id.length === 0) {\n return ResolvedItemConfig.defaults.id;\n } else {\n return id[0];\n }\n } else {\n return id;\n }\n }\n }\n\n /** @internal */\n export function resolveSize(\n size: string | undefined,\n width: number | undefined,\n height: number | undefined,\n rowAndColumnChildLegacySizeDefault: boolean):\n SizeWithUnit {\n // Remove support for rowAndColumnChildLegacySizeDefault in a major version release\n\n if (size !== undefined) {\n return parseSize(size, [SizeUnitEnum.Percent, SizeUnitEnum.Fractional]);\n } else {\n if (width !== undefined || height !== undefined) {\n if (width !== undefined) {\n return { size: width, sizeUnit: SizeUnitEnum.Percent };\n } else {\n if (height !== undefined) {\n return { size: height, sizeUnit: SizeUnitEnum.Percent };\n } else {\n throw new UnexpectedUndefinedError('CRS33390');\n }\n }\n } else {\n if (rowAndColumnChildLegacySizeDefault) {\n return { size: 50, sizeUnit: SizeUnitEnum.Percent };\n } else {\n return { size: ResolvedItemConfig.defaults.size, sizeUnit: ResolvedItemConfig.defaults.sizeUnit };\n }\n }\n }\n }\n\n /** @internal */\n export function resolveMinSize(minSize: string | undefined, minWidth: number | undefined, minHeight: number | undefined): UndefinableSizeWithUnit {\n if (minSize !== undefined) {\n return parseSize(minSize, [SizeUnitEnum.Pixel]);\n } else {\n const minWidthDefined = minWidth !== undefined;\n const minHeightDefined = minHeight !== undefined;\n if (minWidthDefined || minHeightDefined) {\n if (minWidthDefined) {\n return { size: minWidth, sizeUnit: SizeUnitEnum.Pixel };\n } else {\n return { size: minHeight, sizeUnit: SizeUnitEnum.Pixel };\n }\n } else {\n return { size: ResolvedItemConfig.defaults.minSize, sizeUnit: ResolvedItemConfig.defaults.minSizeUnit };\n }\n }\n }\n\n /** @internal */\n export function calculateSizeWidthHeightSpecificationType(config: ItemConfig): SizeWidthHeightSpecificationType {\n if (config.size !== undefined) {\n return SizeWidthHeightSpecificationType.Size;\n } else {\n if (config.width !== undefined || config.height !== undefined) {\n return SizeWidthHeightSpecificationType.WidthOrHeight;\n } else {\n return SizeWidthHeightSpecificationType.None;\n }\n }\n }\n\n export function isGround(config: ItemConfig): config is ItemConfig {\n return config.type === ItemType.ground;\n }\n export function isRow(config: ItemConfig): config is ItemConfig {\n return config.type === ItemType.row;\n }\n export function isColumn(config: ItemConfig): config is ItemConfig {\n return config.type === ItemType.column;\n }\n export function isStack(config: ItemConfig): config is ItemConfig {\n return config.type === ItemType.stack;\n }\n export function isComponent(config: ItemConfig): config is ComponentItemConfig {\n return config.type === ItemType.component;\n }\n}\n\n// Stack or Component\n/** @public */\nexport interface HeaderedItemConfig extends ItemConfig {\n /** @deprecated use {@link (HeaderedItemConfig:namespace).(Header:interface).show} instead */\n hasHeaders?: boolean;\n header?: HeaderedItemConfig.Header;\n maximised?: boolean;\n}\n\n/** @public */\nexport namespace HeaderedItemConfig {\n const legacyMaximisedId = '__glMaximised';\n\n export interface Header {\n show?: false | Side;\n popout?: false | string;\n dock?: false | string;\n maximise?: false | string;\n close?: string;\n minimise?: string;\n tabDropdown?: false | string;\n }\n\n export namespace Header {\n export function resolve(header: Header | undefined, hasHeaders: boolean | undefined): ResolvedHeaderedItemConfig.Header | undefined {\n if (header === undefined && hasHeaders === undefined) {\n return undefined;\n } else {\n const result: ResolvedHeaderedItemConfig.Header = {\n show: header?.show ?? (hasHeaders === undefined ? undefined : hasHeaders ? ResolvedLayoutConfig.Header.defaults.show : false),\n popout: header?.popout,\n maximise: header?.maximise,\n close: header?.close,\n minimise: header?.minimise,\n tabDropdown: header?.tabDropdown,\n }\n return result;\n }\n }\n }\n\n /** @internal */\n export function resolveIdAndMaximised(config: HeaderedItemConfig): { id: string, maximised: boolean} {\n let id: string;\n // To support legacy configs with Id saved as an array of string, assign config.id to a type which includes string array\n let legacyId: string | string[] | undefined = config.id;\n let legacyMaximised = false;\n if (legacyId === undefined) {\n id = ResolvedItemConfig.defaults.id;\n } else {\n if (Array.isArray(legacyId)) {\n const idx = legacyId.findIndex((id) => id === legacyMaximisedId)\n if (idx > 0) {\n legacyMaximised = true;\n legacyId = legacyId.splice(idx, 1);\n }\n if (legacyId.length > 0) {\n id = legacyId[0];\n } else {\n id = ResolvedItemConfig.defaults.id;\n }\n } else {\n id = legacyId;\n }\n }\n\n let maximised: boolean;\n if (config.maximised !== undefined) {\n maximised = config.maximised;\n } else {\n maximised = legacyMaximised;\n }\n\n return { id, maximised }\n }\n}\n\n/** @public */\nexport interface StackItemConfig extends HeaderedItemConfig {\n type: 'stack';\n content: ComponentItemConfig[];\n /** The index of the item in content which is to be active*/\n activeItemIndex?: number;\n}\n\n/** @public */\nexport namespace StackItemConfig {\n /** @internal */\n export function resolve(itemConfig: StackItemConfig, rowAndColumnChildLegacySizeDefault: boolean): ResolvedStackItemConfig {\n const { id, maximised } = HeaderedItemConfig.resolveIdAndMaximised(itemConfig);\n const { size, sizeUnit } = ItemConfig.resolveSize(itemConfig.size, itemConfig.width, itemConfig.height, rowAndColumnChildLegacySizeDefault);\n const { size: minSize, sizeUnit: minSizeUnit } = ItemConfig.resolveMinSize(itemConfig.minSize, itemConfig.minWidth, itemConfig.minHeight);\n\n const result: ResolvedStackItemConfig = {\n type: ItemType.stack,\n content: resolveContent(itemConfig.content),\n size,\n sizeUnit,\n minSize,\n minSizeUnit,\n id,\n maximised,\n isClosable: itemConfig.isClosable ?? ResolvedItemConfig.defaults.isClosable,\n activeItemIndex: itemConfig.activeItemIndex ?? ResolvedStackItemConfig.defaultActiveItemIndex,\n header: HeaderedItemConfig.Header.resolve(itemConfig.header, itemConfig.hasHeaders),\n };\n return result;\n }\n\n /** @internal */\n export function fromResolved(resolvedConfig: ResolvedStackItemConfig): StackItemConfig {\n const result: StackItemConfig = {\n type: ItemType.stack,\n content: fromResolvedContent(resolvedConfig.content),\n size: formatSize(resolvedConfig.size, resolvedConfig.sizeUnit),\n minSize: formatUndefinableSize(resolvedConfig.minSize, resolvedConfig.minSizeUnit),\n id: resolvedConfig.id,\n maximised: resolvedConfig.maximised,\n isClosable: resolvedConfig.isClosable,\n activeItemIndex: resolvedConfig.activeItemIndex,\n header: ResolvedHeaderedItemConfig.Header.createCopy(resolvedConfig.header),\n };\n\n return result;\n }\n\n /** @internal */\n function resolveContent(content: ComponentItemConfig[] | undefined): ResolvedComponentItemConfig[] {\n if (content === undefined) {\n return [];\n } else {\n const count = content.length;\n const result = new Array(count);\n for (let i = 0; i < count; i++) {\n const childItemConfig = content[i];\n const itemConfig = ItemConfig.resolve(childItemConfig, false);\n if (!ResolvedItemConfig.isComponentItem(itemConfig)) {\n throw new AssertError('UCUSICRC91114', JSON.stringify(itemConfig));\n } else {\n result[i] = itemConfig;\n }\n }\n return result;\n }\n }\n\n /** @internal */\n function fromResolvedContent(resolvedContent: ResolvedComponentItemConfig[]): ComponentItemConfig[] {\n const count = resolvedContent.length;\n const result = new Array(count);\n for (let i = 0; i < count; i++) {\n const resolvedContentConfig = resolvedContent[i];\n result[i] = ComponentItemConfig.fromResolved(resolvedContentConfig);\n }\n return result;\n }\n}\n\n/** @public */\nexport interface ComponentItemConfig extends HeaderedItemConfig {\n type: 'component';\n readonly content?: [];\n\n /**\n * The title of the item as displayed on its tab and on popout windows\n * Default: componentType.toString() or ''\n */\n title?: string;\n\n /**\n * The type of the component.\n * @deprecated use {@link (ComponentItemConfig:interface).componentType} instead\n */\n componentName?: string;\n\n /**\n * The type of the component.\n * `componentType` must be of type `string` if it is registered with any of the following functions:\n * * {@link (GoldenLayout:class).registerComponent} (deprecated)\n * * {@link (GoldenLayout:class).registerComponentConstructor}\n * * {@link (GoldenLayout:class).registerComponentFactoryFunction}\n */\n componentType: JsonValue;\n /**\n * The state information with which a component will be initialised with.\n * Will be passed to the component constructor function and will be the value returned by\n * container.initialState.\n */\n componentState?: JsonValue;\n\n /**\n * Default: true\n */\n reorderEnabled?: boolean; // Takes precedence over LayoutConfig.reorderEnabled.\n}\n\n/** @public */\nexport namespace ComponentItemConfig {\n /** @internal */\n export function resolve(itemConfig: ComponentItemConfig, rowAndColumnChildLegacySizeDefault: boolean): ResolvedComponentItemConfig {\n let componentType: JsonValue | undefined = itemConfig.componentType;\n if (componentType === undefined) {\n componentType = itemConfig.componentName;\n }\n if (componentType === undefined) {\n throw new Error('ComponentItemConfig.componentType is undefined');\n } else {\n const { id, maximised } = HeaderedItemConfig.resolveIdAndMaximised(itemConfig);\n let title: string;\n if (itemConfig.title === undefined || itemConfig.title === '') {\n title = ComponentItemConfig.componentTypeToTitle(componentType);\n } else {\n title = itemConfig.title;\n }\n const { size, sizeUnit } = ItemConfig.resolveSize(itemConfig.size, itemConfig.width, itemConfig.height, rowAndColumnChildLegacySizeDefault);\n const { size: minSize, sizeUnit: minSizeUnit } = ItemConfig.resolveMinSize(itemConfig.minSize, itemConfig.minWidth, itemConfig.minHeight);\n const result: ResolvedComponentItemConfig = {\n type: itemConfig.type,\n content: [],\n size,\n sizeUnit,\n minSize,\n minSizeUnit,\n id,\n maximised,\n isClosable: itemConfig.isClosable ?? ResolvedItemConfig.defaults.isClosable,\n reorderEnabled: itemConfig.reorderEnabled ?? ResolvedComponentItemConfig.defaultReorderEnabled,\n title,\n header: HeaderedItemConfig.Header.resolve(itemConfig.header, itemConfig.hasHeaders),\n componentType,\n componentState: itemConfig.componentState ?? {},\n };\n return result;\n }\n }\n\n /** @internal */\n export function fromResolved(resolvedConfig: ResolvedComponentItemConfig): ComponentItemConfig {\n const result: ComponentItemConfig = {\n type: ItemType.component,\n size: formatSize(resolvedConfig.size, resolvedConfig.sizeUnit),\n minSize: formatUndefinableSize(resolvedConfig.minSize, resolvedConfig.minSizeUnit),\n id: resolvedConfig.id,\n maximised: resolvedConfig.maximised,\n isClosable: resolvedConfig.isClosable,\n reorderEnabled: resolvedConfig.reorderEnabled,\n title: resolvedConfig.title,\n header: ResolvedHeaderedItemConfig.Header.createCopy(resolvedConfig.header),\n componentType: resolvedConfig.componentType,\n componentState: deepExtendValue(undefined, resolvedConfig.componentState) as JsonValue,\n }\n\n return result;\n }\n\n export function componentTypeToTitle(componentType: JsonValue): string {\n const componentTypeType = typeof componentType;\n switch (componentTypeType) {\n case 'string': return componentType as string;\n case 'number': return (componentType as number).toString();\n case 'boolean': return (componentType as boolean).toString();\n default: return '';\n }\n }\n}\n\n// RowOrColumn\n/** @public */\nexport interface RowOrColumnItemConfig extends ItemConfig {\n type: 'row' | 'column';\n content: (RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig)[];\n}\n\n/** @public */\nexport namespace RowOrColumnItemConfig {\n export type ChildItemConfig = RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig;\n\n export function isChildItemConfig(itemConfig: ItemConfig): itemConfig is ChildItemConfig {\n switch (itemConfig.type) {\n case ItemType.row:\n case ItemType.column:\n case ItemType.stack:\n case ItemType.component:\n return true;\n case ItemType.ground:\n return false;\n default:\n throw new UnreachableCaseError('UROCOSPCICIC13687', itemConfig.type);\n }\n }\n\n /** @internal */\n export function resolve(itemConfig: RowOrColumnItemConfig, rowAndColumnChildLegacySizeDefault: boolean): ResolvedRowOrColumnItemConfig {\n const { size, sizeUnit } = ItemConfig.resolveSize(itemConfig.size, itemConfig.width, itemConfig.height, rowAndColumnChildLegacySizeDefault);\n const { size: minSize, sizeUnit: minSizeUnit } = ItemConfig.resolveMinSize(itemConfig.minSize, itemConfig.minWidth, itemConfig.minHeight);\n const result: ResolvedRowOrColumnItemConfig = {\n type: itemConfig.type,\n content: RowOrColumnItemConfig.resolveContent(itemConfig.content),\n size,\n sizeUnit,\n minSize,\n minSizeUnit,\n id: ItemConfig.resolveId(itemConfig.id),\n isClosable: itemConfig.isClosable ?? ResolvedItemConfig.defaults.isClosable,\n }\n return result;\n }\n\n /** @internal */\n export function fromResolved(resolvedConfig: ResolvedRowOrColumnItemConfig): RowOrColumnItemConfig {\n const result: RowOrColumnItemConfig = {\n type: resolvedConfig.type,\n content: fromResolvedContent(resolvedConfig.content),\n size: formatSize(resolvedConfig.size, resolvedConfig.sizeUnit),\n minSize: formatUndefinableSize(resolvedConfig.minSize, resolvedConfig.minSizeUnit),\n id: resolvedConfig.id,\n isClosable: resolvedConfig.isClosable,\n }\n\n return result;\n }\n\n /** @internal */\n export function resolveContent(content: ChildItemConfig[] | undefined): ResolvedRowOrColumnItemConfig.ChildItemConfig[] {\n if (content === undefined) {\n return [];\n } else {\n const count = content.length;\n const childItemConfigs = new Array(count);\n let widthOrHeightSpecifiedAtLeastOnce = false;\n let sizeSpecifiedAtLeastOnce = false;\n for (let i = 0; i < count; i++) {\n const childItemConfig = content[i];\n if (!RowOrColumnItemConfig.isChildItemConfig(childItemConfig)) {\n throw new ConfigurationError('ItemConfig is not Row, Column or Stack', childItemConfig);\n } else {\n if (!sizeSpecifiedAtLeastOnce) {\n const sizeWidthHeightSpecificationType = ItemConfig.calculateSizeWidthHeightSpecificationType(childItemConfig);\n switch (sizeWidthHeightSpecificationType) {\n case ItemConfig.SizeWidthHeightSpecificationType.None:\n break;\n case ItemConfig.SizeWidthHeightSpecificationType.WidthOrHeight:\n widthOrHeightSpecifiedAtLeastOnce = true;\n break;\n case ItemConfig.SizeWidthHeightSpecificationType.Size:\n sizeSpecifiedAtLeastOnce = true;\n break;\n default:\n throw new UnreachableCaseError('ROCICRC87556', sizeWidthHeightSpecificationType);\n }\n }\n childItemConfigs[i] = childItemConfig;\n }\n }\n\n let legacySizeDefault: boolean;\n if (sizeSpecifiedAtLeastOnce) {\n legacySizeDefault = false;\n } else {\n if (widthOrHeightSpecifiedAtLeastOnce) {\n legacySizeDefault = true;\n } else {\n legacySizeDefault = false;\n }\n }\n\n const result = new Array(count);\n for (let i = 0; i < count; i++) {\n const childItemConfig = childItemConfigs[i];\n const resolvedChildItemConfig = ItemConfig.resolve(childItemConfig, legacySizeDefault);\n if (!ResolvedRowOrColumnItemConfig.isChildItemConfig(resolvedChildItemConfig)) {\n throw new AssertError('UROCOSPIC99512', JSON.stringify(resolvedChildItemConfig));\n } else {\n result[i] = resolvedChildItemConfig;\n }\n }\n return result;\n }\n }\n\n /** @internal */\n function fromResolvedContent(resolvedContent: readonly ResolvedRowOrColumnItemConfig.ChildItemConfig[]): RowOrColumnItemConfig.ChildItemConfig[] {\n const count = resolvedContent.length;\n const result = new Array(count);\n for (let i = 0; i < count; i++) {\n const resolvedContentConfig = resolvedContent[i];\n const type = resolvedContentConfig.type;\n let contentConfig: RowOrColumnItemConfig.ChildItemConfig;\n switch (type) {\n case ItemType.row:\n case ItemType.column:\n contentConfig = RowOrColumnItemConfig.fromResolved(resolvedContentConfig);\n break;\n case ItemType.stack:\n contentConfig = StackItemConfig.fromResolved(resolvedContentConfig);\n break;\n case ItemType.component:\n contentConfig = ComponentItemConfig.fromResolved(resolvedContentConfig);\n break;\n default:\n throw new UnreachableCaseError('ROCICFRC44797', type);\n }\n result[i] = contentConfig;\n }\n return result;\n }\n}\n\n/** @public */\nexport type RootItemConfig = RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig;\n\n/** @public */\nexport namespace RootItemConfig {\n export function isRootItemConfig(itemConfig: ItemConfig): itemConfig is RootItemConfig {\n switch (itemConfig.type) {\n case ItemType.row:\n case ItemType.column:\n case ItemType.stack:\n case ItemType.component:\n return true;\n case ItemType.ground:\n return false;\n default:\n throw new UnreachableCaseError('URICIR23687', itemConfig.type);\n }\n }\n\n /** @internal */\n export function resolve(itemConfig: RootItemConfig | undefined): ResolvedRootItemConfig | undefined {\n if (itemConfig === undefined) {\n return undefined;\n } else {\n const result = ItemConfig.resolve(itemConfig, false);\n if (!ResolvedRootItemConfig.isRootItemConfig(result)) {\n throw new ConfigurationError('ItemConfig is not Row, Column or Stack', JSON.stringify(itemConfig));\n } else {\n return result;\n }\n }\n }\n\n /** @internal */\n export function fromResolvedOrUndefined(resolvedItemConfig: ResolvedRootItemConfig | undefined): RootItemConfig | undefined {\n if (resolvedItemConfig === undefined) {\n return undefined;\n } else {\n const type = resolvedItemConfig.type;\n switch (type) {\n case ItemType.row:\n case ItemType.column:\n return RowOrColumnItemConfig.fromResolved(resolvedItemConfig);\n case ItemType.stack:\n return StackItemConfig.fromResolved(resolvedItemConfig);\n case ItemType.component:\n return ComponentItemConfig.fromResolved(resolvedItemConfig);\n default:\n throw new UnreachableCaseError('RICFROU89921', type);\n }\n }\n }\n}\n\n/** @public */\nexport interface LayoutConfig {\n root: RootItemConfig | undefined;\n /** @deprecated Use {@link (LayoutConfig:interface).root} */\n content?: (RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig)[];\n openPopouts?: PopoutLayoutConfig[];\n dimensions?: LayoutConfig.Dimensions;\n settings?: LayoutConfig.Settings;\n /** @deprecated use {@link (LayoutConfig:interface).header} instead */\n labels?: LayoutConfig.Labels;\n header?: LayoutConfig.Header;\n}\n\n/** Use to specify LayoutConfig with defaults or deserialise a LayoutConfig.\n * Deserialisation will handle backwards compatibility.\n * Note that LayoutConfig should be used for serialisation (not LayoutConfig)\n * @public\n */\nexport namespace LayoutConfig {\n export interface Settings {\n /**\n * @deprecated use ${@link (LayoutConfig:namespace).(Header:interface).show} instead\n */\n hasHeaders?: boolean;\n\n /**\n * Constrains the area in which items can be dragged to the layout's container. Will be set to false\n * automatically when layout.createDragSource() is called.\n * Default: true\n */\n constrainDragToContainer?: boolean;\n\n /**\n * If true, the user can re-arrange the layout by dragging items by their tabs to the desired location.\n * Can be overridden by ItemConfig.reorderEnabled for specific ItemConfigs\n * Default: true\n */\n reorderEnabled?: boolean;\n\n /**\n * Decides what will be opened in a new window if the user clicks the popout icon. If true the entire stack will\n * be transferred to the new window, if false only the active component will be opened.\n * Default: false\n */\n popoutWholeStack?: boolean;\n\n /**\n * Specifies if an error is thrown when a popout is blocked by the browser (e.g. by opening it programmatically).\n * If false, the popout call will fail silently.\n * Default: true\n */\n blockedPopoutsThrowError?: boolean;\n\n /**\n * Specifies if all popouts should be closed when the page that created them is closed. Popouts don't have a\n * strong dependency on their parent and can exist on their own, but can be quite annoying to close by hand. In\n * addition, any changes made to popouts won't be stored after the parent is closed.\n * Default: true\n * @deprecated Will be removed in version 3.\n */\n closePopoutsOnUnload?: boolean;\n\n /**\n * Specifies if the popout icon should be displayed in the header-bar.\n * @deprecated use {@link (LayoutConfig:namespace).(Header:interface).popout} instead\n */\n showPopoutIcon?: boolean;\n\n /**\n * Specifies if the maximise icon should be displayed in the header-bar.\n * @deprecated use {@link (LayoutConfig:namespace).(Header:interface).maximise} instead\n */\n showMaximiseIcon?: boolean;\n\n /**\n * Specifies if the close icon should be displayed in the header-bar.\n * @deprecated use {@link (LayoutConfig:namespace).(Header:interface).close} instead\n */\n showCloseIcon?: boolean;\n\n /**\n * Specifies Responsive Mode (more info needed).\n * Default: none\n */\n responsiveMode?: ResponsiveMode;\n\n /**\n * Specifies Maximum pixel overlap per tab.\n * Default: 0\n */\n tabOverlapAllowance?: number;\n\n /**\n *\n * Default: true\n */\n reorderOnTabMenuClick?: boolean;\n\n /**\n * Default: 10\n */\n tabControlOffset?: number;\n\n /**\n * Specifies whether to pop in elements when closing a popout window.\n * Default: false\n */\n popInOnClose?: boolean;\n }\n\n export namespace Settings {\n export function resolve(settings: Settings | undefined): ResolvedLayoutConfig.Settings {\n const result: ResolvedLayoutConfig.Settings = {\n constrainDragToContainer: settings?.constrainDragToContainer ?? ResolvedLayoutConfig.Settings.defaults.constrainDragToContainer,\n reorderEnabled: settings?.reorderEnabled ?? ResolvedLayoutConfig.Settings.defaults.reorderEnabled,\n popoutWholeStack: settings?.popoutWholeStack ?? ResolvedLayoutConfig.Settings.defaults.popoutWholeStack,\n blockedPopoutsThrowError: settings?.blockedPopoutsThrowError ?? ResolvedLayoutConfig.Settings.defaults.blockedPopoutsThrowError,\n closePopoutsOnUnload: settings?.closePopoutsOnUnload ?? ResolvedLayoutConfig.Settings.defaults.closePopoutsOnUnload,\n responsiveMode: settings?.responsiveMode ?? ResolvedLayoutConfig.Settings.defaults.responsiveMode,\n tabOverlapAllowance: settings?.tabOverlapAllowance ?? ResolvedLayoutConfig.Settings.defaults.tabOverlapAllowance,\n reorderOnTabMenuClick: settings?.reorderOnTabMenuClick ?? ResolvedLayoutConfig.Settings.defaults.reorderOnTabMenuClick,\n tabControlOffset: settings?.tabControlOffset ?? ResolvedLayoutConfig.Settings.defaults.tabControlOffset,\n popInOnClose: settings?.popInOnClose ?? ResolvedLayoutConfig.Settings.defaults.popInOnClose,\n }\n return result;\n }\n }\n\n export interface Dimensions {\n /**\n * The width of the borders between the layout items in pixel. Please note: The actual draggable area is wider\n * than the visible one, making it safe to set this to small values without affecting usability.\n * Default: 5\n */\n borderWidth?: number;\n\n /**\n * Default: 15\n */\n borderGrabWidth?: number,\n\n /**\n * The minimum height an item can be resized to (in pixel).\n * @deprecated use {@link (LayoutConfig:namespace).(Dimensions:interface).defaultMinItemHeight} instead\n */\n minItemHeight?: number;\n\n /**\n * The minimum height an item can be resized to.\n * Default: 0\n */\n defaultMinItemHeight?: string;\n\n /**\n * The minimum width an item can be resized to (in pixel).\n * @deprecated use {@link (LayoutConfig:namespace).(Dimensions:interface).defaultMinItemWidth} instead\n */\n minItemWidth?: number;\n\n /**\n * The minimum width an item can be resized to.\n * Default: 10px\n */\n defaultMinItemWidth?: string;\n\n /**\n * The height of the header elements in pixel. This can be changed, but your theme's header css needs to be\n * adjusted accordingly.\n * Default: 20\n */\n headerHeight?: number;\n\n /**\n * The width of the element that appears when an item is dragged (in pixel).\n * Default: 300\n */\n dragProxyWidth?: number;\n\n /**\n * The height of the element that appears when an item is dragged (in pixel).\n * Default: 200\n */\n dragProxyHeight?: number;\n }\n\n export namespace Dimensions {\n /** @internal */\n export function resolve(dimensions: Dimensions | undefined): ResolvedLayoutConfig.Dimensions {\n const { size: defaultMinItemHeight, sizeUnit: defaultMinItemHeightUnit } = Dimensions.resolveDefaultMinItemHeight(dimensions);\n const { size: defaultMinItemWidth, sizeUnit: defaultMinItemWidthUnit } = Dimensions.resolveDefaultMinItemWidth(dimensions);\n const result: ResolvedLayoutConfig.Dimensions = {\n borderWidth: dimensions?.borderWidth ?? ResolvedLayoutConfig.Dimensions.defaults.borderWidth,\n borderGrabWidth: dimensions?.borderGrabWidth ?? ResolvedLayoutConfig.Dimensions.defaults.borderGrabWidth,\n defaultMinItemHeight,\n defaultMinItemHeightUnit,\n defaultMinItemWidth,\n defaultMinItemWidthUnit,\n headerHeight: dimensions?.headerHeight ?? ResolvedLayoutConfig.Dimensions.defaults.headerHeight,\n dragProxyWidth: dimensions?.dragProxyWidth ?? ResolvedLayoutConfig.Dimensions.defaults.dragProxyWidth,\n dragProxyHeight: dimensions?.dragProxyHeight ?? ResolvedLayoutConfig.Dimensions.defaults.dragProxyHeight,\n }\n return result;\n }\n\n /** @internal */\n export function fromResolved(resolvedDimensions: ResolvedLayoutConfig.Dimensions): Dimensions {\n const result: Dimensions = {\n borderWidth: resolvedDimensions.borderWidth,\n borderGrabWidth: resolvedDimensions.borderGrabWidth,\n defaultMinItemHeight: formatSize(resolvedDimensions.defaultMinItemHeight, resolvedDimensions.defaultMinItemHeightUnit),\n defaultMinItemWidth: formatSize(resolvedDimensions.defaultMinItemWidth, resolvedDimensions.defaultMinItemWidthUnit),\n headerHeight: resolvedDimensions.headerHeight,\n dragProxyWidth: resolvedDimensions.dragProxyWidth,\n dragProxyHeight: resolvedDimensions.dragProxyHeight,\n };\n\n return result;\n }\n\n /** @internal */\n export function resolveDefaultMinItemHeight(dimensions: Dimensions | undefined): SizeWithUnit {\n const height = dimensions?.defaultMinItemHeight;\n if (height === undefined) {\n return { size: ResolvedLayoutConfig.Dimensions.defaults.defaultMinItemHeight, sizeUnit: ResolvedLayoutConfig.Dimensions.defaults.defaultMinItemHeightUnit };\n } else {\n return parseSize(height, [SizeUnitEnum.Pixel]);\n }\n }\n\n /** @internal */\n export function resolveDefaultMinItemWidth(dimensions: Dimensions | undefined): SizeWithUnit {\n const width = dimensions?.defaultMinItemWidth;\n if (width === undefined) {\n return { size: ResolvedLayoutConfig.Dimensions.defaults.defaultMinItemWidth, sizeUnit: ResolvedLayoutConfig.Dimensions.defaults.defaultMinItemWidthUnit };\n } else {\n return parseSize(width, [SizeUnitEnum.Pixel]);\n }\n }\n }\n\n export interface Labels {\n /**\n * @deprecated use {@link (LayoutConfig:namespace).(Header:interface).close} instead\n */\n close?: string;\n\n /**\n * @deprecated use {@link (LayoutConfig:namespace).(Header:interface).maximise} instead\n */\n maximise?: string;\n\n /**\n * @deprecated use {@link (LayoutConfig:namespace).(Header:interface).minimise} instead\n */\n minimise?: string;\n\n /**\n * @deprecated use {@link (LayoutConfig:namespace).(Header:interface).popin} instead\n */\n popin?: string;\n\n /**\n * @deprecated use {@link (LayoutConfig:namespace).(Header:interface).popout} instead\n */\n popout?: string;\n\n /**\n * @deprecated use {@link (LayoutConfig:namespace).(Header:interface).tabDropdown} instead\n */\n tabDropdown?: string;\n }\n\n export interface Header {\n /**\n * Specifies whether header should be displayed, and if so, on which side.\n * If false, the layout will be displayed with splitters only.\n * Default: 'top'\n */\n show?: false | Side;\n /**\n * The tooltip text that appears when hovering over the popout icon or false if popout button not displayed.\n * Default: 'open in new window'\n */\n popout?: false | string;\n /**\n * The tooltip text that appears when hovering over the popin icon.\n * Default: 'pop in'\n */\n popin?: string;\n /**\n * The tooltip text that appears when hovering over the maximise icon or false if maximised button not displayed.\n * Default: 'maximise'\n */\n maximise?: false | string;\n /**\n * The tooltip text that appears when hovering over the close icon.\n * Default: 'close'\n */\n close?: false | string;\n /**\n * The tooltip text that appears when hovering over the minimise icon.\n * Default: 'minimise'\n */\n minimise?: string;\n /**\n *\n * Default: 'additional tabs'\n */\n tabDropdown?: false | string;\n }\n\n export namespace Header {\n /** @internal */\n export function resolve(header: Header | undefined,\n settings: LayoutConfig.Settings | undefined, labels: LayoutConfig.Labels | undefined\n ): ResolvedLayoutConfig.Header {\n let show: false | Side;\n if (header?.show !== undefined) {\n show = header.show;\n } else {\n if (settings !== undefined && settings.hasHeaders !== undefined) {\n show = settings.hasHeaders ? ResolvedLayoutConfig.Header.defaults.show : false;\n } else {\n show = ResolvedLayoutConfig.Header.defaults.show;\n }\n }\n const result: ResolvedLayoutConfig.Header = {\n show,\n popout: header?.popout ?? labels?.popout ??\n (settings?.showPopoutIcon === false ? false : ResolvedLayoutConfig.Header.defaults.popout),\n dock: header?.popin ?? labels?.popin ?? ResolvedLayoutConfig.Header.defaults.dock,\n maximise: header?.maximise ?? labels?.maximise ??\n (settings?.showMaximiseIcon === false ? false : ResolvedLayoutConfig.Header.defaults.maximise),\n close: header?.close ?? labels?.close ??\n (settings?.showCloseIcon === false ? false : ResolvedLayoutConfig.Header.defaults.close),\n minimise: header?.minimise ?? labels?.minimise ?? ResolvedLayoutConfig.Header.defaults.minimise,\n tabDropdown: header?.tabDropdown ?? labels?.tabDropdown ?? ResolvedLayoutConfig.Header.defaults.tabDropdown,\n }\n return result;\n }\n }\n\n export function isPopout(config: LayoutConfig): config is PopoutLayoutConfig {\n return 'parentId' in config || 'indexInParent' in config || 'window' in config;\n }\n\n /** @internal */\n export function resolve(layoutConfig: LayoutConfig): ResolvedLayoutConfig {\n if (isPopout(layoutConfig)) {\n return PopoutLayoutConfig.resolve(layoutConfig);\n } else {\n let root: RootItemConfig | undefined;\n if (layoutConfig.root !== undefined) {\n root = layoutConfig.root;\n } else {\n if (layoutConfig.content !== undefined && layoutConfig.content.length > 0) {\n root = layoutConfig.content[0];\n } else {\n root = undefined;\n }\n }\n const config: ResolvedLayoutConfig = {\n resolved: true,\n root: RootItemConfig.resolve(root),\n openPopouts: LayoutConfig.resolveOpenPopouts(layoutConfig.openPopouts),\n dimensions: LayoutConfig.Dimensions.resolve(layoutConfig.dimensions),\n settings: LayoutConfig.Settings.resolve(layoutConfig.settings),\n header: LayoutConfig.Header.resolve(layoutConfig.header, layoutConfig.settings, layoutConfig.labels),\n }\n return config;\n }\n }\n\n export function fromResolved(config: ResolvedLayoutConfig): LayoutConfig {\n const result: LayoutConfig = {\n root: RootItemConfig.fromResolvedOrUndefined(config.root),\n openPopouts: PopoutLayoutConfig.fromResolvedArray(config.openPopouts),\n settings: ResolvedLayoutConfig.Settings.createCopy(config.settings),\n dimensions: LayoutConfig.Dimensions.fromResolved(config.dimensions),\n header: ResolvedLayoutConfig.Header.createCopy(config.header),\n };\n return result;\n }\n\n export function isResolved(configOrResolvedConfig: ResolvedLayoutConfig | LayoutConfig): configOrResolvedConfig is ResolvedLayoutConfig {\n const config = configOrResolvedConfig as ResolvedLayoutConfig;\n return config.resolved !== undefined && (config.resolved === true);\n }\n\n /** @internal */\n export function resolveOpenPopouts(popoutConfigs: PopoutLayoutConfig[] | undefined): ResolvedPopoutLayoutConfig[] {\n if (popoutConfigs === undefined) {\n return [];\n } else {\n const count = popoutConfigs.length;\n const result = new Array(count);\n for (let i = 0; i < count; i++) {\n result[i] = PopoutLayoutConfig.resolve(popoutConfigs[i]);\n }\n return result;\n }\n }\n}\n\n/** @public */\nexport interface PopoutLayoutConfig extends LayoutConfig {\n /** The id of the element the item will be appended to on popIn\n * If null, append to topmost layout element\n */\n parentId: string | null | undefined;\n /** The position of this element within its parent\n * If null, position is last\n */\n indexInParent: number | null | undefined;\n /** @deprecated use {@link (PopoutLayoutConfig:interface).window} */\n dimensions: PopoutLayoutConfig.Dimensions | undefined; // for backwards compatibility\n window: PopoutLayoutConfig.Window | undefined;\n}\n\n/** @public */\nexport namespace PopoutLayoutConfig {\n // Previous versions kept window information in Dimensions key. Only use for backwards compatibility\n /** @deprecated use {@link (PopoutLayoutConfig:namespace).(Window:interface)} */\n export interface Dimensions extends LayoutConfig.Dimensions {\n /** @deprecated use {@link (PopoutLayoutConfig:namespace).(Window:interface).width} */\n width?: number | null,\n /** @deprecated use {@link (PopoutLayoutConfig:namespace).(Window:interface).height} */\n height?: number | null,\n /** @deprecated use {@link (PopoutLayoutConfig:namespace).(Window:interface).left} */\n left?: number | null,\n /** @deprecated use {@link (PopoutLayoutConfig:namespace).(Window:interface).top} */\n top?: number | null,\n }\n\n export interface Window {\n width?: number,\n height?: number,\n left?: number,\n top?: number,\n }\n\n export namespace Window {\n /** @internal */\n export function resolve(window: Window | undefined,\n dimensions: Dimensions | undefined): ResolvedPopoutLayoutConfig.Window\n {\n let result: ResolvedPopoutLayoutConfig.Window;\n const defaults = ResolvedPopoutLayoutConfig.Window.defaults;\n if (window !== undefined) {\n result = {\n width: window.width ?? defaults.width,\n height: window.height ?? defaults.height,\n left: window.left ?? defaults.left,\n top: window.top ?? defaults.top,\n }\n } else {\n result = {\n width: dimensions?.width ?? defaults.width,\n height: dimensions?.height ?? defaults.height,\n left: dimensions?.left ?? defaults.left,\n top: dimensions?.top ?? defaults.top,\n }\n }\n return result;\n }\n\n /** @internal */\n export function fromResolved(resolvedWindow: ResolvedPopoutLayoutConfig.Window): Window {\n const result: Window = {\n width: resolvedWindow.width === null ? undefined : resolvedWindow.width,\n height: resolvedWindow.height === null ? undefined : resolvedWindow.height,\n left: resolvedWindow.left === null ? undefined : resolvedWindow.left,\n top: resolvedWindow.top === null ? undefined : resolvedWindow.top,\n }\n\n return result;\n }\n }\n\n /** @internal */\n export function resolve(popoutConfig: PopoutLayoutConfig): ResolvedPopoutLayoutConfig {\n let root: RootItemConfig | undefined;\n if (popoutConfig.root !== undefined) {\n root = popoutConfig.root;\n } else {\n if (popoutConfig.content !== undefined && popoutConfig.content.length > 0) {\n root = popoutConfig.content[0];\n } else {\n root = undefined;\n }\n }\n\n const config: ResolvedPopoutLayoutConfig = {\n root: RootItemConfig.resolve(root),\n openPopouts: LayoutConfig.resolveOpenPopouts(popoutConfig.openPopouts),\n dimensions: LayoutConfig.Dimensions.resolve(popoutConfig.dimensions),\n settings: LayoutConfig.Settings.resolve(popoutConfig.settings),\n header: LayoutConfig.Header.resolve(popoutConfig.header, popoutConfig.settings, popoutConfig.labels),\n parentId: popoutConfig.parentId ?? null,\n indexInParent: popoutConfig.indexInParent ?? null,\n window: PopoutLayoutConfig.Window.resolve(popoutConfig.window, popoutConfig.dimensions),\n resolved: true,\n }\n return config;\n }\n\n /** @internal */\n export function fromResolved(resolvedConfig: ResolvedPopoutLayoutConfig): PopoutLayoutConfig {\n const result: PopoutLayoutConfig = {\n root: RootItemConfig.fromResolvedOrUndefined(resolvedConfig.root),\n openPopouts: fromResolvedArray(resolvedConfig.openPopouts),\n dimensions: LayoutConfig.Dimensions.fromResolved(resolvedConfig.dimensions),\n settings: ResolvedLayoutConfig.Settings.createCopy(resolvedConfig.settings),\n header: ResolvedLayoutConfig.Header.createCopy(resolvedConfig.header),\n parentId: resolvedConfig.parentId,\n indexInParent: resolvedConfig.indexInParent,\n window: PopoutLayoutConfig.Window.fromResolved(resolvedConfig.window),\n }\n\n return result;\n }\n\n /** @internal */\n export function fromResolvedArray(resolvedArray: ResolvedPopoutLayoutConfig[]): PopoutLayoutConfig[] {\n const resolvedOpenPopoutCount = resolvedArray.length;\n const result = new Array(resolvedOpenPopoutCount);\n for (let i = 0; i < resolvedOpenPopoutCount; i++) {\n const resolvedOpenPopout = resolvedArray[i];\n result[i] = PopoutLayoutConfig.fromResolved(resolvedOpenPopout);\n }\n\n return result;\n }\n}\n\n/** @internal */\nexport interface SizeWithUnit {\n size: number;\n sizeUnit: SizeUnitEnum;\n}\n\n/** @internal */\nexport interface UndefinableSizeWithUnit {\n size: number | undefined;\n sizeUnit: SizeUnitEnum;\n}\n\n/** @internal */\nexport function parseSize(sizeString: string, allowableSizeUnits: readonly SizeUnitEnum[]): SizeWithUnit {\n const { numericPart: digitsPart, firstNonNumericCharPart: firstNonDigitPart } = splitStringAtFirstNonNumericChar(sizeString);\n const size = Number.parseInt(digitsPart, 10);\n if (isNaN(size)) {\n throw new ConfigurationError(`${i18nStrings[I18nStringId.InvalidNumberPartInSizeString]}: ${sizeString}`);\n } else {\n const sizeUnit = SizeUnitEnum.tryParse(firstNonDigitPart);\n if (sizeUnit === undefined) {\n throw new ConfigurationError(`${i18nStrings[I18nStringId.UnknownUnitInSizeString]}: ${sizeString}`)\n } else {\n if (!allowableSizeUnits.includes(sizeUnit)) {\n throw new ConfigurationError(`${i18nStrings[I18nStringId.UnsupportedUnitInSizeString]}: ${sizeString}`)\n } else {\n return { size, sizeUnit };\n }\n }\n }\n}\n\n/** @internal */\nexport function formatSize(size: number, sizeUnit: SizeUnitEnum) {\n return size.toString(10) + SizeUnitEnum.format(sizeUnit);\n}\n\n/** @internal */\nexport function formatUndefinableSize(size: number| undefined, sizeUnit: SizeUnitEnum) {\n if (size === undefined) {\n return undefined;\n } else {\n return size.toString(10) + SizeUnitEnum.format(sizeUnit);\n }\n}\n\n/** @public @deprecated - use {@link (LayoutConfig:interface)} */\nexport type Config = LayoutConfig;\n","import { BrowserPopout } from '../controls/browser-popout';\nimport { Tab } from '../controls/tab';\nimport { ComponentItem } from '../items/component-item';\n\n/**\n * A generic and very fast EventEmitter implementation. On top of emitting the actual event it emits an\n * {@link (EventEmitter:namespace).ALL_EVENT} event for every event triggered. This allows to hook into it and proxy events forwards\n * @public\n */\nexport class EventEmitter {\n /** @internal */\n private _allEventSubscriptions: EventEmitter.UnknownCallback[] = [];\n /** @internal */\n private _subscriptionsMap = new Map();\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n tryBubbleEvent(name: string, args: unknown[]): void {\n // overridden by ContentItem\n }\n\n /**\n * Emit an event and notify listeners\n *\n * @param eventName - The name of the event\n * @param args - Additional arguments that will be passed to the listener\n */\n emit(eventName: K, ...args: EventEmitter.EventParamsMap[K]): void {\n let subcriptions = this._subscriptionsMap.get(eventName);\n\n if (subcriptions !== undefined) {\n subcriptions = subcriptions.slice();\n for (let i = 0; i < subcriptions.length; i++) {\n const subscription = subcriptions[i];\n subscription(...args);\n }\n }\n\n this.emitAllEvent(eventName, args);\n this.tryBubbleEvent(eventName, args);\n }\n\n /** @internal */\n emitUnknown(eventName: string, ...args: EventEmitter.UnknownParams): void {\n let subs = this._subscriptionsMap.get(eventName);\n\n if (subs !== undefined) {\n subs = subs.slice();\n for (let i = 0; i < subs.length; i++) {\n subs[i](...args);\n }\n }\n\n this.emitAllEvent(eventName, args);\n this.tryBubbleEvent(eventName, args);\n }\n\n /* @internal **/\n emitBaseBubblingEvent(eventName: K): void {\n const event = new EventEmitter.BubblingEvent(eventName, this);\n this.emitUnknown(eventName, event);\n }\n\n /** @internal */\n emitUnknownBubblingEvent(eventName: string): void {\n const event = new EventEmitter.BubblingEvent(eventName, this);\n this.emitUnknown(eventName, event);\n }\n\n /**\n * Removes a listener for an event.\n * @param eventName - The name of the event\n * @param callback - The previously registered callback method (optional)\n */\n removeEventListener(eventName: K, callback: EventEmitter.Callback): void {\n const unknownCallback = callback as EventEmitter.UnknownCallback;\n this.removeUnknownEventListener(eventName, unknownCallback);\n }\n\n off(eventName: K, callback: EventEmitter.Callback): void {\n this.removeEventListener(eventName, callback);\n }\n\n /**\n * Alias for off\n */\n unbind = this.removeEventListener;\n\n /**\n * Alias for emit\n */\n trigger = this.emit;\n\n /**\n * Listen for events\n *\n * @param eventName - The name of the event to listen to\n * @param callback - The callback to execute when the event occurs\n */\n addEventListener(eventName: K, callback: EventEmitter.Callback): void {\n const unknownCallback = callback as EventEmitter.UnknownCallback;\n this.addUnknownEventListener(eventName, unknownCallback);\n }\n\n on(eventName: K, callback: EventEmitter.Callback): void {\n this.addEventListener(eventName, callback);\n }\n\n /** @internal */\n private addUnknownEventListener(eventName: string, callback: EventEmitter.UnknownCallback): void {\n if (eventName === EventEmitter.ALL_EVENT) {\n this._allEventSubscriptions.push(callback);\n } else {\n let subscriptions = this._subscriptionsMap.get(eventName);\n if (subscriptions !== undefined) {\n subscriptions.push(callback);\n } else {\n subscriptions = [callback];\n this._subscriptionsMap.set(eventName, subscriptions);\n }\n }\n }\n\n /** @internal */\n private removeUnknownEventListener(eventName: string, callback: EventEmitter.UnknownCallback): void {\n if (eventName === EventEmitter.ALL_EVENT) {\n this.removeSubscription(eventName, this._allEventSubscriptions, callback);\n } else {\n const subscriptions = this._subscriptionsMap.get(eventName);\n if (subscriptions === undefined) {\n throw new Error('No subscribtions to unsubscribe for event ' + eventName);\n } else {\n this.removeSubscription(eventName, subscriptions, callback);\n }\n }\n }\n\n /** @internal */\n private removeSubscription(eventName: string, subscriptions: EventEmitter.UnknownCallback[], callback: EventEmitter.UnknownCallback) {\n const idx = subscriptions.indexOf(callback);\n if (idx < 0) {\n throw new Error('Nothing to unbind for ' + eventName);\n } else {\n subscriptions.splice(idx, 1);\n }\n }\n\n /** @internal */\n private emitAllEvent(eventName: string, args: unknown[]) {\n const allEventSubscriptionsCount = this._allEventSubscriptions.length;\n if (allEventSubscriptionsCount > 0) {\n const unknownArgs = args.slice() as EventEmitter.UnknownParams;\n unknownArgs.unshift(eventName);\n\n const allEventSubcriptions = this._allEventSubscriptions.slice();\n\n for (let i = 0; i < allEventSubscriptionsCount; i++) {\n allEventSubcriptions[i](...unknownArgs);\n }\n }\n }\n}\n\n/** @public */\nexport namespace EventEmitter {\n /**\n * The name of the event that's triggered for every event\n */\n export const ALL_EVENT = '__all';\n\n export const headerClickEventName = 'stackHeaderClick';\n export const headerTouchStartEventName = 'stackHeaderTouchStart';\n\n /** @internal */\n export type UnknownCallback = (this: void, ...args: UnknownParams) => void;\n export type Callback = (this: void, ...args: EventParamsMap[K]) => void;\n\n export interface EventParamsMap {\n \"__all\": UnknownParams;\n \"activeContentItemChanged\": ComponentItemParam;\n \"close\": NoParams;\n \"closed\": NoParams;\n \"destroy\": NoParams;\n \"drag\": DragParams;\n \"dragStart\": DragStartParams;\n \"dragStop\": DragStopParams;\n \"hide\": NoParams;\n \"initialised\": NoParams;\n \"itemDropped\": ComponentItemParam;\n \"maximised\": NoParams;\n \"minimised\": NoParams;\n \"open\": NoParams;\n \"popIn\": NoParams;\n \"resize\": NoParams;\n \"show\": NoParams;\n /** @deprecated - use show instead */\n \"shown\": NoParams;\n \"stateChanged\": NoParams;\n \"tab\": TabParam;\n \"tabCreated\": TabParam;\n \"titleChanged\": StringParam;\n \"windowClosed\": PopoutParam;\n \"windowOpened\": PopoutParam;\n \"beforeComponentRelease\": BeforeComponentReleaseParams;\n \"beforeItemDestroyed\": BubblingEventParam;\n \"itemCreated\": BubblingEventParam;\n \"itemDestroyed\": BubblingEventParam;\n \"focus\": BubblingEventParam;\n \"blur\": BubblingEventParam;\n \"stackHeaderClick\": ClickBubblingEventParam;\n \"stackHeaderTouchStart\": TouchStartBubblingEventParam;\n \"userBroadcast\": UnknownParams;\n }\n\n export type UnknownParams = unknown[];\n export type NoParams = [];\n export type UnknownParam = [unknown];\n export type PopoutParam = [BrowserPopout];\n export type ComponentItemParam = [ComponentItem];\n export type TabParam = [Tab];\n export type BubblingEventParam = [EventEmitter.BubblingEvent]\n export type StringParam = [string];\n export type DragStartParams = [originalX: number, originalY: number];\n export type DragStopParams = [event: PointerEvent | undefined];\n export type DragParams = [offsetX: number, offsetY: number, event: PointerEvent];\n export type BeforeComponentReleaseParams = [component: unknown];\n export type ClickBubblingEventParam = [ClickBubblingEvent];\n export type TouchStartBubblingEventParam = [TouchStartBubblingEvent];\n\n export class BubblingEvent {\n /** @internal */\n private _isPropagationStopped = false;\n\n get name(): string { return this._name; }\n get target(): EventEmitter { return this._target; }\n /** @deprecated Use {@link (EventEmitter:namespace).(BubblingEvent:class).target} instead */\n get origin(): EventEmitter { return this._target; }\n get isPropagationStopped(): boolean { return this._isPropagationStopped; }\n\n /** @internal */\n constructor(\n /** @internal */\n private readonly _name: string,\n /** @internal */\n private readonly _target: EventEmitter) {\n }\n\n stopPropagation(): void {\n this._isPropagationStopped = true;\n }\n }\n\n export class ClickBubblingEvent extends BubblingEvent {\n get mouseEvent(): MouseEvent { return this._mouseEvent; }\n\n /** @internal */\n constructor(name: string, target: EventEmitter,\n /** @internal */\n private readonly _mouseEvent: MouseEvent\n ) {\n super(name, target);\n }\n }\n\n export class TouchStartBubblingEvent extends BubblingEvent {\n get touchEvent(): TouchEvent { return this._touchEvent; }\n\n /** @internal */\n constructor(name: string, target: EventEmitter,\n /** @internal */\n private readonly _touchEvent: TouchEvent\n ) {\n super(name, target);\n }\n }\n}\n","import { ResolvedLayoutConfig, ResolvedPopoutLayoutConfig } from '../config/resolved-config';\nimport { PopoutBlockedError } from '../errors/external-error';\nimport { UnexpectedNullError, UnexpectedUndefinedError } from '../errors/internal-error';\nimport { ContentItem } from '../items/content-item';\nimport { LayoutManager } from '../layout-manager';\nimport { EventEmitter } from '../utils/event-emitter';\nimport { Rect } from '../utils/types';\nimport { deepExtend, getErrorMessage, getUniqueId } from '../utils/utils';\n\n/**\n * Pops a content item out into a new browser window.\n * This is achieved by\n *\n * - Creating a new configuration with the content item as root element\n * - Serializing and minifying the configuration\n * - Opening the current window's URL with the configuration as a GET parameter\n * - GoldenLayout when opened in the new window will look for the GET parameter\n * and use it instead of the provided configuration\n * @public\n */\n\nexport class BrowserPopout extends EventEmitter {\n /** @internal */\n private _popoutWindow: Window | null;\n /** @internal */\n private _isInitialised;\n /** @internal */\n private _checkReadyInterval: ReturnType | undefined;\n\n /**\n * @param _config - GoldenLayout item config\n * @param _initialWindowSize - A map with width, height, top and left\n * @internal\n */\n constructor(\n /** @internal */\n private _config: ResolvedPopoutLayoutConfig,\n /** @internal */\n private _initialWindowSize: Rect,\n /** @internal */\n private _layoutManager: LayoutManager,\n ) {\n super();\n\n this._isInitialised = false;\n this._popoutWindow = null;\n this.createWindow();\n }\n\n toConfig(): ResolvedPopoutLayoutConfig {\n if (this._isInitialised === false) {\n throw new Error('Can\\'t create config, layout not yet initialised');\n }\n\n const glInstance = this.getGlInstance();\n const glInstanceConfig = glInstance.saveLayout();\n\n let left: number | null;\n let top: number | null;\n if (this._popoutWindow === null) {\n left = null;\n top = null;\n } else {\n left = this._popoutWindow.screenX ?? this._popoutWindow.screenLeft;\n top = this._popoutWindow.screenY ?? this._popoutWindow.screenTop;\n }\n\n const window: ResolvedPopoutLayoutConfig.Window = {\n width: this.getGlInstance().width,\n height: this.getGlInstance().height,\n left,\n top,\n };\n\n const config: ResolvedPopoutLayoutConfig = {\n root: glInstanceConfig.root,\n openPopouts: glInstanceConfig.openPopouts,\n settings: glInstanceConfig.settings,\n dimensions: glInstanceConfig.dimensions,\n header: glInstanceConfig.header,\n window,\n parentId: this._config.parentId,\n indexInParent: this._config.indexInParent,\n resolved: true,\n };\n\n return config;\n }\n\n getGlInstance(): LayoutManager {\n if (this._popoutWindow === null) {\n throw new UnexpectedNullError('BPGGI24693');\n }\n return this._popoutWindow.__glInstance;\n }\n\n /**\n * Retrieves the native BrowserWindow backing this popout.\n * Might throw an UnexpectedNullError exception when the window is not initialized yet.\n * @public\n */\n getWindow(): Window {\n if (this._popoutWindow === null) {\n throw new UnexpectedNullError('BPGW087215');\n }\n return this._popoutWindow;\n }\n\n close(): void {\n if (this.getGlInstance()) {\n this.getGlInstance().closeWindow();\n } else {\n try {\n this.getWindow().close();\n } catch (e) {\n //\n }\n }\n }\n\n /**\n * Returns the popped out item to its original position. If the original\n * parent isn't available anymore it falls back to the layout's topmost element\n */\n popIn(): void {\n let parentItem: ContentItem;\n let index = this._config.indexInParent;\n\n if (!this._config.parentId) {\n return;\n }\n\n /*\n * The deepExtend call seems a bit pointless, but it's crucial to\n * copy the config returned by this.getGlInstance().toConfig()\n * onto a new object. Internet Explorer keeps the references\n * to objects on the child window, resulting in the following error\n * once the child window is closed:\n *\n * The callee (server [not server application]) is not available and disappeared\n */\n const glInstanceLayoutConfig = this.getGlInstance().saveLayout();\n const copiedGlInstanceLayoutConfig = deepExtend({}, glInstanceLayoutConfig) as ResolvedLayoutConfig;\n const copiedRoot = copiedGlInstanceLayoutConfig.root;\n if (copiedRoot === undefined) {\n throw new UnexpectedUndefinedError('BPPIR19998');\n }\n const groundItem = this._layoutManager.groundItem;\n if (groundItem === undefined) {\n throw new UnexpectedUndefinedError('BPPIG34972');\n }\n parentItem = groundItem.getItemsByPopInParentId(this._config.parentId)[0];\n\n /*\n * Fallback if parentItem is not available. Either add it to the topmost\n * item or make it the topmost item if the layout is empty\n */\n if (!parentItem) {\n if (groundItem.contentItems.length > 0) {\n parentItem = groundItem.contentItems[0];\n } else {\n parentItem = groundItem;\n }\n index = 0;\n }\n\n const newContentItem = this._layoutManager.createAndInitContentItem(copiedRoot, parentItem);\n\n parentItem.addChild(newContentItem, index);\n if (this._layoutManager.layoutConfig.settings.popInOnClose) {\n this._onClose();\n } else {\n this.close();\n }\n }\n\n /**\n * Creates the URL and window parameter\n * and opens a new window\n * @internal\n */\n private createWindow(): void {\n const url = this.createUrl();\n\n /**\n * Bogus title to prevent re-usage of existing window with the\n * same title. The actual title will be set by the new window's\n * GoldenLayout instance if it detects that it is in subWindowMode\n */\n const target = Math.floor(Math.random() * 1000000).toString(36);\n\n /**\n * The options as used in the window.open string\n */\n const features = this.serializeWindowFeatures({\n width: this._initialWindowSize.width,\n height: this._initialWindowSize.height,\n innerWidth: this._initialWindowSize.width,\n innerHeight: this._initialWindowSize.height,\n menubar: 'no',\n toolbar: 'no',\n location: 'no',\n personalbar: 'no',\n resizable: 'yes',\n scrollbars: 'no',\n status: 'no'\n });\n\n this._popoutWindow = globalThis.open(url, target, features);\n\n if (!this._popoutWindow) {\n if (this._layoutManager.layoutConfig.settings.blockedPopoutsThrowError === true) {\n const error = new PopoutBlockedError('Popout blocked');\n throw error;\n } else {\n return;\n }\n }\n\n this._popoutWindow.addEventListener('load', () => this.positionWindow(), { passive: true })\n this._popoutWindow.addEventListener('beforeunload', () => {\n if (this._layoutManager.layoutConfig.settings.popInOnClose) {\n this.popIn();\n } else {\n this._onClose();\n }\n }, { passive: true })\n\n /**\n * Polling the childwindow to find out if GoldenLayout has been initialised\n * doesn't seem optimal, but the alternatives - adding a callback to the parent\n * window or raising an event on the window object - both would introduce knowledge\n * about the parent to the child window which we'd rather avoid\n */\n this._checkReadyInterval = setInterval(() => this.checkReady(), 10);\n }\n\n /** @internal */\n private checkReady() {\n if (this._popoutWindow === null) {\n throw new UnexpectedNullError('BPCR01844');\n } else {\n if (this._popoutWindow.__glInstance && this._popoutWindow.__glInstance.isInitialised) {\n this.onInitialised();\n if (this._checkReadyInterval !== undefined) {\n clearInterval(this._checkReadyInterval);\n this._checkReadyInterval = undefined;\n }\n }\n }\n }\n\n /**\n * Serialises a map of key:values to a window options string\n *\n * @param windowOptions -\n *\n * @returns serialised window options\n * @internal\n */\n private serializeWindowFeatures(windowOptions: Record): string {\n const windowOptionsString: string[] = [];\n\n for (const key in windowOptions) {\n windowOptionsString.push(key + '=' + windowOptions[key].toString());\n }\n\n return windowOptionsString.join(',');\n }\n\n /**\n * Creates the URL for the new window, including the\n * config GET parameter\n *\n * @returns URL\n * @internal\n */\n private createUrl(): string {\n const storageKey = 'gl-window-config-' + getUniqueId();\n const config = ResolvedLayoutConfig.minifyConfig(this._config);\n\n try {\n localStorage.setItem(storageKey, JSON.stringify(config));\n } catch (e) {\n throw new Error('Error while writing to localStorage ' + getErrorMessage(e));\n }\n\n const url = new URL(location.href);\n url.searchParams.set('gl-window', storageKey);\n return url.toString();\n }\n\n /**\n * Move the newly created window roughly to\n * where the component used to be.\n * @internal\n */\n private positionWindow() {\n if (this._popoutWindow === null) {\n throw new Error('BrowserPopout.positionWindow: null popoutWindow');\n } else {\n this._popoutWindow.moveTo(this._initialWindowSize.left, this._initialWindowSize.top);\n this._popoutWindow.focus();\n }\n }\n\n /**\n * Callback when the new window is opened and the GoldenLayout instance\n * within it is initialised\n * @internal\n */\n private onInitialised(): void {\n this._isInitialised = true;\n this.getGlInstance().on('popIn', () => this.popIn());\n this.emit('initialised');\n }\n\n /**\n * Invoked 50ms after the window unload event\n * @internal\n */\n private _onClose() {\n setTimeout(() => this.emit('closed'), 50);\n }\n}\n","import { Header } from './header';\n\n/** @internal */\nexport class HeaderButton {\n private _element: HTMLElement;\n private _clickEventListener = (ev: MouseEvent) => this.onClick(ev);\n private _touchStartEventListener = (ev: TouchEvent) => this.onTouchStart(ev);\n\n get element(): HTMLElement { return this._element; }\n\n constructor(private _header: Header, label: string, cssClass: string, private _pushEvent: HeaderButton.PushEvent) {\n this._element = document.createElement('div');\n this._element.classList.add(cssClass);\n this._element.title = label;\n this._header.on('destroy', () => this.destroy());\n this._element.addEventListener('click', this._clickEventListener, { passive: true });\n this._element.addEventListener('touchstart', this._touchStartEventListener, { passive: true });\n this._header.controlsContainerElement.appendChild(this._element);\n }\n\n destroy(): void {\n this._element.removeEventListener('click', this._clickEventListener);\n this._element.removeEventListener('touchstart', this._touchStartEventListener);\n this._element.parentNode?.removeChild(this._element);\n }\n\n private onClick(ev: MouseEvent) {\n this._pushEvent(ev);\n }\n\n private onTouchStart(ev: TouchEvent) {\n this._pushEvent(ev);\n }\n}\n\n/** @internal */\nexport namespace HeaderButton {\n export type PushEvent = (this: void, ev: Event) => void;\n}\n","import { DomConstants } from './dom-constants';\nimport { EventEmitter } from './event-emitter';\n\n/** @internal */\nexport class DragListener extends EventEmitter {\n private _timeout: ReturnType | undefined;\n private _allowableTargets: HTMLElement[];\n private _oDocument: Document;\n private _eBody: HTMLElement;\n private _nDelay: number;\n private _nDistance: number;\n private _nX: number;\n private _nY: number;\n private _nOriginalX: number;\n private _nOriginalY: number;\n private _dragging: boolean;\n private _pointerTracking = false;\n\n private _pointerDownEventListener = (ev: PointerEvent) => this.onPointerDown(ev);\n private _pointerMoveEventListener = (ev: PointerEvent) => this.onPointerMove(ev);\n private _pointerUpEventListener = (ev: PointerEvent) => this.onPointerUp(ev);\n\n constructor(private _eElement: HTMLElement, extraAllowableChildTargets: HTMLElement[]) {\n super();\n\n this._timeout = undefined;\n\n this._allowableTargets = [_eElement, ...extraAllowableChildTargets];\n this._oDocument = document;\n this._eBody = document.body;\n\n /**\n * The delay after which to start the drag in milliseconds\n * Do NOT make too short (previous value of 200 was not long enough for my touchpad)\n * Should generally rely on the mouse move to start drag. Not this delay.\n */\n this._nDelay = 1800;\n\n /**\n * The distance the mouse needs to be moved to qualify as a drag\n * Previous comment: works better with delay only\n * ???\n * Probably somehow needs tuning for different devices\n */\n this._nDistance = 10;\n\n this._nX = 0;\n this._nY = 0;\n\n this._nOriginalX = 0;\n this._nOriginalY = 0;\n\n this._dragging = false;\n\n this._eElement.addEventListener('pointerdown', this._pointerDownEventListener, { passive: true });\n }\n\n destroy(): void {\n this.checkRemovePointerTrackingEventListeners();\n\n this._eElement.removeEventListener('pointerdown', this._pointerDownEventListener);\n }\n\n cancelDrag(): void {\n this.processDragStop(undefined);\n }\n\n private onPointerDown(oEvent: PointerEvent) {\n if (this._allowableTargets.includes(oEvent.target as HTMLElement) && oEvent.isPrimary) {\n const coordinates = this.getPointerCoordinates(oEvent);\n this.processPointerDown(coordinates);\n }\n }\n\n private processPointerDown(coordinates: DragListener.PointerCoordinates) {\n this._nOriginalX = coordinates.x;\n this._nOriginalY = coordinates.y;\n\n this._oDocument.addEventListener('pointermove', this._pointerMoveEventListener);\n this._oDocument.addEventListener('pointerup', this._pointerUpEventListener, { passive: true });\n this._pointerTracking = true;\n\n this._timeout = setTimeout(\n () => {\n try {\n this.startDrag()\n }\n catch (err) {\n console.error(err);\n throw err;\n }\n }\n , this._nDelay);\n }\n\n private onPointerMove(oEvent: PointerEvent) {\n if (this._pointerTracking) {\n this.processDragMove(oEvent);\n oEvent.preventDefault();\n }\n }\n\n private processDragMove(dragEvent: PointerEvent) {\n this._nX = dragEvent.pageX - this._nOriginalX;\n this._nY = dragEvent.pageY - this._nOriginalY;\n\n if (this._dragging === false) {\n if (\n Math.abs(this._nX) > this._nDistance ||\n Math.abs(this._nY) > this._nDistance\n ) {\n this.startDrag();\n }\n }\n\n if (this._dragging) {\n this.emit('drag', this._nX, this._nY, dragEvent);\n }\n }\n\n private onPointerUp(oEvent: PointerEvent) {\n this.processDragStop(oEvent);\n }\n\n private processDragStop(dragEvent?: PointerEvent) {\n if (this._timeout !== undefined) {\n clearTimeout(this._timeout);\n this._timeout = undefined;\n }\n\n this.checkRemovePointerTrackingEventListeners();\n \n if (this._dragging === true) {\n this._eBody.classList.remove(DomConstants.ClassName.Dragging);\n this._eElement.classList.remove(DomConstants.ClassName.Dragging);\n this._oDocument.querySelector('iframe')?.style.setProperty('pointer-events', '');\n this._dragging = false;\n this.emit('dragStop', dragEvent);\n }\n }\n\n private checkRemovePointerTrackingEventListeners(): void {\n if (this._pointerTracking) {\n this._oDocument.removeEventListener('pointermove', this._pointerMoveEventListener);\n this._oDocument.removeEventListener('pointerup', this._pointerUpEventListener);\n this._pointerTracking = false;\n } \n }\n\n private startDrag() {\n if (this._timeout !== undefined) {\n clearTimeout(this._timeout);\n this._timeout = undefined;\n }\n this._dragging = true;\n this._eBody.classList.add(DomConstants.ClassName.Dragging);\n this._eElement.classList.add(DomConstants.ClassName.Dragging);\n this._oDocument.querySelector('iframe')?.style.setProperty('pointer-events', 'none');\n this.emit('dragStart', this._nOriginalX, this._nOriginalY);\n }\n\n private getPointerCoordinates(event: PointerEvent) {\n const result: DragListener.PointerCoordinates = {\n x: event.pageX,\n y: event.pageY\n };\n return result;\n }\n\n}\n\n/** @internal */\nexport namespace DragListener {\n export interface PointerCoordinates {\n x: number,\n y: number,\n }\n}","import { UnexpectedUndefinedError } from '../errors/internal-error';\nimport { ComponentItem } from '../items/component-item';\nimport { LayoutManager } from '../layout-manager';\nimport { DomConstants } from '../utils/dom-constants';\nimport { DragListener } from '../utils/drag-listener';\n\n/**\n * Represents an individual tab within a Stack's header\n * @public\n */\nexport class Tab {\n /** @internal */\n private readonly _element: HTMLDivElement;\n /** @internal */\n private readonly _titleElement: HTMLSpanElement;\n /** @internal */\n private readonly _closeElement: HTMLDivElement | undefined;\n\n /** @internal */\n private _dragListener: DragListener | undefined;\n /** @internal */\n private _isActive = false;\n\n /** @internal */\n private readonly _tabClickListener = (ev: MouseEvent) => this.onTabClickDown(ev);\n /** @internal */\n private readonly _tabTouchStartListener = (ev: TouchEvent) => this.onTabTouchStart(ev);\n /** @internal */\n private readonly _closeClickListener = () => this.onCloseClick();\n /** @internal */\n private readonly _closeTouchStartListener = () => this.onCloseTouchStart();\n // /** @internal */\n // private readonly _closeMouseDownListener = () => this.onCloseMousedown();\n /** @internal */\n private readonly _dragStartListener = (x: number, y: number) => this.onDragStart(x, y);\n /** @internal */\n private readonly _contentItemDestroyListener = () => this.onContentItemDestroy();\n /** @internal */\n private readonly _tabTitleChangedListener = (title: string) => this.setTitle(title)\n\n get isActive(): boolean { return this._isActive; }\n // get header(): Header { return this._header; }\n get componentItem(): ComponentItem { return this._componentItem; }\n /** @deprecated use {@link (Tab:class).componentItem} */\n get contentItem(): ComponentItem { return this._componentItem; }\n get element(): HTMLElement { return this._element; }\n get titleElement(): HTMLElement { return this._titleElement; }\n get closeElement(): HTMLElement | undefined { return this._closeElement; }\n get reorderEnabled(): boolean { return this._dragListener !== undefined; }\n set reorderEnabled(value: boolean) {\n if (value !== this.reorderEnabled) {\n if (value) {\n this.enableReorder();\n } else {\n this.disableReorder();\n }\n }\n }\n\n /** @internal */\n constructor(\n /** @internal */\n private readonly _layoutManager: LayoutManager,\n /** @internal */\n private _componentItem: ComponentItem,\n /** @internal */\n private _closeEvent: Tab.CloseEvent | undefined,\n /** @internal */\n private _focusEvent: Tab.FocusEvent | undefined,\n /** @internal */\n private _dragStartEvent: Tab.DragStartEvent | undefined\n ) {\n this._element = document.createElement('div');\n this._element.classList.add(DomConstants.ClassName.Tab);\n this._titleElement = document.createElement('span'); \n this._titleElement.classList.add(DomConstants.ClassName.Title);\n this._closeElement = document.createElement('div'); \n this._closeElement.classList.add(DomConstants.ClassName.CloseTab);\n this._element.appendChild(this._titleElement);\n this._element.appendChild(this._closeElement);\n\n if (_componentItem.isClosable) {\n this._closeElement.style.display = '';\n } else {\n this._closeElement.style.display = 'none';\n }\n\n this.setTitle(_componentItem.title);\n this._componentItem.on('titleChanged', this._tabTitleChangedListener);\n\n const reorderEnabled = _componentItem.reorderEnabled ?? this._layoutManager.layoutConfig.settings.reorderEnabled;\n\n if (reorderEnabled) {\n this.enableReorder();\n }\n\n this._element.addEventListener('click', this._tabClickListener, { passive: true });\n this._element.addEventListener('touchstart', this._tabTouchStartListener, { passive: true });\n\n if (this._componentItem.isClosable) {\n this._closeElement.addEventListener('click', this._closeClickListener, { passive: true });\n this._closeElement.addEventListener('touchstart', this._closeTouchStartListener, { passive: true });\n // this._closeElement.addEventListener('mousedown', this._closeMouseDownListener, { passive: true });\n } else {\n this._closeElement.remove();\n this._closeElement = undefined;\n }\n\n this._componentItem.setTab(this);\n this._layoutManager.emit('tabCreated', this);\n }\n\n /**\n * Sets the tab's title to the provided string and sets\n * its title attribute to a pure text representation (without\n * html tags) of the same string.\n */\n setTitle(title: string): void {\n this._titleElement.innerText = title;\n this._element.title = title;\n }\n\n /**\n * Sets this tab's active state. To programmatically\n * switch tabs, use Stack.setActiveComponentItem( item ) instead.\n */\n setActive(isActive: boolean): void {\n if (isActive === this._isActive) {\n return;\n }\n this._isActive = isActive;\n\n if (isActive) {\n this._element.classList.add(DomConstants.ClassName.Active);\n } else {\n this._element.classList.remove(DomConstants.ClassName.Active);\n }\n }\n\n /**\n * Destroys the tab\n * @internal\n */\n destroy(): void {\n this._closeEvent = undefined;\n this._focusEvent = undefined;\n this._dragStartEvent = undefined;\n this._element.removeEventListener('click', this._tabClickListener);\n this._element.removeEventListener('touchstart', this._tabTouchStartListener);\n this._closeElement?.removeEventListener('click', this._closeClickListener);\n this._closeElement?.removeEventListener('touchstart', this._closeTouchStartListener);\n // this._closeElement?.removeEventListener('mousedown', this._closeMouseDownListener);\n this._componentItem.off('titleChanged', this._tabTitleChangedListener);\n if (this.reorderEnabled) {\n this.disableReorder();\n }\n this._element.remove();\n }\n\n /** @internal */\n setBlurred(): void {\n this._element.classList.remove(DomConstants.ClassName.Focused);\n this._titleElement.classList.remove(DomConstants.ClassName.Focused);\n }\n\n /** @internal */\n setFocused(): void {\n this._element.classList.add(DomConstants.ClassName.Focused);\n this._titleElement.classList.add(DomConstants.ClassName.Focused);\n }\n\n /**\n * Callback for the DragListener\n * @param x - The tabs absolute x position\n * @param y - The tabs absolute y position\n * @internal\n */\n private onDragStart(x: number, y: number): void {\n if (this._dragListener === undefined) {\n throw new UnexpectedUndefinedError('TODSDLU10093');\n } else {\n if (this._dragStartEvent === undefined) {\n throw new UnexpectedUndefinedError('TODS23309');\n } else {\n this._dragStartEvent(x, y, this._dragListener, this.componentItem);\n }\n }\n\n }\n\n /** @internal */\n private onContentItemDestroy() {\n if (this._dragListener !== undefined) {\n this._dragListener.destroy();\n this._dragListener = undefined;\n }\n }\n\n /**\n * Callback when the tab is clicked\n * @internal\n */\n private onTabClickDown(event: MouseEvent) {\n const target = event.target;\n if (target === this._element || target === this._titleElement) {\n // left mouse button\n if (event.button === 0) {\n // event.stopPropagation();\n this.notifyFocus();\n\n // middle mouse button\n } else if (event.button === 1 && this._componentItem.isClosable) {\n // event.stopPropagation();\n this.notifyClose();\n }\n }\n }\n\n /** @internal */\n private onTabTouchStart(event: TouchEvent) {\n if (event.target === this._element) {\n this.notifyFocus();\n }\n }\n\n /**\n * Callback when the tab's close button is clicked\n * @internal\n */\n private onCloseClick() {\n this.notifyClose();\n }\n\n /** @internal */\n private onCloseTouchStart() {\n this.notifyClose();\n }\n\n /**\n * Callback to capture tab close button mousedown\n * to prevent tab from activating.\n * @internal\n */\n // private onCloseMousedown(): void {\n // // event.stopPropagation();\n // }\n\n /** @internal */\n private notifyClose() {\n if (this._closeEvent === undefined) {\n throw new UnexpectedUndefinedError('TNC15007');\n } else {\n this._closeEvent(this._componentItem);\n }\n }\n\n /** @internal */\n private notifyFocus() {\n if (this._focusEvent === undefined) {\n throw new UnexpectedUndefinedError('TNA15007');\n } else {\n this._focusEvent(this._componentItem);\n }\n }\n\n /** @internal */\n private enableReorder() {\n this._dragListener = new DragListener(this._element, [this._titleElement]);\n this._dragListener.on('dragStart', this._dragStartListener);\n this._componentItem.on('destroy', this._contentItemDestroyListener);\n }\n\n /** @internal */\n private disableReorder() {\n if (this._dragListener === undefined) {\n throw new UnexpectedUndefinedError('TDR87745');\n } else {\n this._componentItem.off('destroy', this._contentItemDestroyListener);\n this._dragListener.off('dragStart', this._dragStartListener);\n this._dragListener = undefined;\n }\n }\n}\n\n/** @public */\nexport namespace Tab {\n /** @internal */\n export type CloseEvent = (componentItem: ComponentItem) => void;\n /** @internal */\n export type FocusEvent = (componentItem: ComponentItem) => void;\n /** @internal */\n export type DragStartEvent = (x: number, y: number, dragListener: DragListener, componentItem: ComponentItem) => void;\n}\n","import { AssertError } from '../errors/internal-error';\nimport { ComponentItem } from '../items/component-item';\nimport { LayoutManager } from '../layout-manager';\nimport { DomConstants } from '../utils/dom-constants';\nimport { DragListener } from '../utils/drag-listener';\nimport { numberToPixels, pixelsToNumber } from '../utils/utils';\nimport { Tab } from './tab';\n\n/** @internal */\nexport class TabsContainer {\n // There is one tab per ComponentItem in stack. However they may not be ordered the same\n private readonly _tabs: Tab[] = [];\n\n private readonly _dropdownElement: HTMLElement;\n private readonly _element: HTMLElement;\n private _lastVisibleTabIndex = -1;\n private _dropdownActive = false;\n\n get tabs(): Tab[] { return this._tabs; }\n get tabCount(): number { return this._tabs.length; }\n get lastVisibleTabIndex(): number { return this._lastVisibleTabIndex; }\n\n get element(): HTMLElement { return this._element; }\n get dropdownElement(): HTMLElement { return this._dropdownElement; }\n get dropdownActive(): boolean { return this._dropdownActive; }\n\n constructor(private _layoutManager: LayoutManager,\n private _componentRemoveEvent: TabsContainer.ComponentItemRemoveEvent,\n private _componentFocusEvent: TabsContainer.ComponentItemFocusEvent,\n private _componentDragStartEvent: TabsContainer.ComponentItemDragStartEvent,\n private _dropdownActiveChangedEvent: TabsContainer.DropdownActiveChangedEvent,\n ) {\n this._element = document.createElement('section');\n this._element.classList.add(DomConstants.ClassName.Tabs);\n\n this._dropdownElement = document.createElement('section');\n this._dropdownElement.classList.add(DomConstants.ClassName.TabDropdownList);\n this._dropdownElement.style.display = 'none';\n }\n\n destroy(): void {\n for (let i = 0; i < this._tabs.length; i++) {\n this._tabs[i].destroy();\n }\n }\n\n /**\n * Creates a new tab and associates it with a contentItem\n * @param index - The position of the tab\n */\n createTab(componentItem: ComponentItem, index: number): void {\n //If there's already a tab relating to the\n //content item, don't do anything\n for (let i = 0; i < this._tabs.length; i++) {\n if (this._tabs[i].componentItem === componentItem) {\n return;\n }\n }\n\n const tab = new Tab(this._layoutManager,\n componentItem,\n (item) => this.handleTabCloseEvent(item),\n (item) => this.handleTabFocusEvent(item),\n (x, y, dragListener, item) => this.handleTabDragStartEvent(x, y, dragListener, item));\n\n if (index === undefined) {\n index = this._tabs.length;\n }\n\n this._tabs.splice(index, 0, tab);\n\n if (index < this._element.childNodes.length) {\n this._element.insertBefore(tab.element, this._element.childNodes[index]);\n } else {\n this._element.appendChild(tab.element);\n }\n }\n\n removeTab(componentItem: ComponentItem): void {\n // componentItem cannot be ActiveComponentItem\n for (let i = 0; i < this._tabs.length; i++) {\n if (this._tabs[i].componentItem === componentItem) {\n const tab = this._tabs[i];\n tab.destroy();\n this._tabs.splice(i, 1);\n return;\n }\n }\n\n throw new Error('contentItem is not controlled by this header');\n }\n\n processActiveComponentChanged(newActiveComponentItem: ComponentItem): void {\n let activeIndex = -1;\n for (let i = 0; i < this._tabs.length; i++) {\n const isActive = this._tabs[i].componentItem === newActiveComponentItem;\n this._tabs[i].setActive(isActive);\n if (isActive) {\n activeIndex = i;\n }\n }\n\n if (activeIndex < 0) {\n throw new AssertError('HSACI56632');\n } else {\n if (this._layoutManager.layoutConfig.settings.reorderOnTabMenuClick) {\n /**\n * If the tab selected was in the dropdown, move everything down one to make way for this one to be the first.\n * This will make sure the most used tabs stay visible.\n */\n if (this._lastVisibleTabIndex !== -1 && activeIndex > this._lastVisibleTabIndex) {\n const activeTab = this._tabs[activeIndex];\n for (let j = activeIndex; j > 0; j--) {\n this._tabs[j] = this._tabs[j - 1];\n }\n this._tabs[0] = activeTab;\n\n // updateTabSizes will always be called after this and it will reposition tab elements\n }\n }\n }\n }\n\n /**\n * Pushes the tabs to the tab dropdown if the available space is not sufficient\n */\n updateTabSizes(availableWidth: number, activeComponentItem: ComponentItem | undefined): void {\n let dropDownActive = false;\n const success = this.tryUpdateTabSizes(dropDownActive, availableWidth, activeComponentItem);\n if (!success) {\n dropDownActive = true;\n // this will always succeed\n this.tryUpdateTabSizes(dropDownActive, availableWidth, activeComponentItem)\n }\n\n if (dropDownActive !== this._dropdownActive) {\n this._dropdownActive = dropDownActive;\n this._dropdownActiveChangedEvent();\n }\n }\n\n tryUpdateTabSizes(dropdownActive: boolean, availableWidth: number, activeComponentItem: ComponentItem | undefined): boolean {\n if (this._tabs.length > 0) {\n if (activeComponentItem === undefined) {\n throw new Error('non-empty tabs must have active component item');\n }\n\n let cumulativeTabWidth = 0;\n let tabOverlapAllowanceExceeded = false;\n const tabOverlapAllowance = this._layoutManager.layoutConfig.settings.tabOverlapAllowance;\n const activeIndex = this._tabs.indexOf(activeComponentItem.tab);\n const activeTab = this._tabs[activeIndex];\n this._lastVisibleTabIndex = -1;\n\n for (let i = 0; i < this._tabs.length; i++) {\n const tabElement = this._tabs[i].element;\n\n //Put the tab in the tabContainer so its true width can be checked\n if (tabElement.parentElement !== this._element) {\n this._element.appendChild(tabElement);\n }\n const tabMarginRightPixels = getComputedStyle(activeTab.element).marginRight;\n const tabMarginRight = pixelsToNumber(tabMarginRightPixels);\n const tabWidth = tabElement.offsetWidth + tabMarginRight;\n\n cumulativeTabWidth += tabWidth;\n\n //Include the active tab's width if it isn't already\n //This is to ensure there is room to show the active tab\n let visibleTabWidth = 0;\n if (activeIndex <= i) {\n visibleTabWidth = cumulativeTabWidth;\n } else {\n const activeTabMarginRightPixels = getComputedStyle(activeTab.element).marginRight;\n const activeTabMarginRight = pixelsToNumber(activeTabMarginRightPixels);\n visibleTabWidth = cumulativeTabWidth + activeTab.element.offsetWidth + activeTabMarginRight;\n }\n\n // If the tabs won't fit, check the overlap allowance.\n if (visibleTabWidth > availableWidth) {\n\n //Once allowance is exceeded, all remaining tabs go to menu.\n if (!tabOverlapAllowanceExceeded) {\n\n //No overlap for first tab or active tab\n //Overlap spreads among non-active, non-first tabs\n let overlap: number;\n if (activeIndex > 0 && activeIndex <= i) {\n overlap = (visibleTabWidth - availableWidth) / (i - 1);\n } else {\n overlap = (visibleTabWidth - availableWidth) / i;\n }\n\n //Check overlap against allowance.\n if (overlap < tabOverlapAllowance) {\n for (let j = 0; j <= i; j++) {\n const marginLeft = (j !== activeIndex && j !== 0) ? '-' + numberToPixels(overlap) : '';\n this._tabs[j].element.style.zIndex = numberToPixels(i - j);\n this._tabs[j].element.style.marginLeft = marginLeft;\n }\n this._lastVisibleTabIndex = i;\n if (tabElement.parentElement !== this._element) {\n this._element.appendChild(tabElement);\n }\n } else {\n tabOverlapAllowanceExceeded = true;\n }\n\n } else if (i === activeIndex) {\n //Active tab should show even if allowance exceeded. (We left room.)\n tabElement.style.zIndex = 'auto';\n tabElement.style.marginLeft = '';\n if (tabElement.parentElement !== this._element) {\n this._element.appendChild(tabElement);\n }\n }\n\n if (tabOverlapAllowanceExceeded && i !== activeIndex) {\n if (dropdownActive) {\n //Tab menu already shown, so we just add to it.\n tabElement.style.zIndex = 'auto';\n tabElement.style.marginLeft = '';\n\n if (tabElement.parentElement !== this._dropdownElement) {\n this._dropdownElement.appendChild(tabElement);\n }\n } else {\n //We now know the tab menu must be shown, so we have to recalculate everything.\n return false;\n }\n }\n\n } else {\n this._lastVisibleTabIndex = i;\n tabElement.style.zIndex = 'auto';\n tabElement.style.marginLeft = '';\n if (tabElement.parentElement !== this._element) {\n this._element.appendChild(tabElement);\n }\n }\n }\n }\n\n return true;\n }\n\n /**\n * Shows drop down for additional tabs when there are too many to display.\n */\n showAdditionalTabsDropdown(): void {\n this._dropdownElement.style.display = '';\n }\n\n /**\n * Hides drop down for additional tabs when there are too many to display.\n */\n hideAdditionalTabsDropdown(): void {\n this._dropdownElement.style.display = 'none';\n }\n\n private handleTabCloseEvent(componentItem: ComponentItem) {\n this._componentRemoveEvent(componentItem);\n }\n\n private handleTabFocusEvent(componentItem: ComponentItem) {\n this._componentFocusEvent(componentItem);\n }\n\n private handleTabDragStartEvent(x: number, y: number, dragListener: DragListener, componentItem: ComponentItem) {\n this._componentDragStartEvent(x, y, dragListener, componentItem);\n }\n\n}\n\n/** @internal */\nexport namespace TabsContainer {\n export type ComponentItemRemoveEvent = (this: void, componentItem: ComponentItem) => void;\n export type ComponentItemFocusEvent = (this: void, componentItem: ComponentItem) => void;\n export type ComponentItemDragStartEvent = (this: void, x: number, y: number, dragListener: DragListener, componentItem: ComponentItem) => void;\n export type DropdownActiveChangedEvent = (this: void) => void;\n}\n","import { UnexpectedUndefinedError } from '../errors/internal-error';\nimport { ComponentItem } from '../items/component-item';\nimport { Stack } from '../items/stack';\nimport { LayoutManager } from '../layout-manager';\nimport { DomConstants } from '../utils/dom-constants';\nimport { DragListener } from '../utils/drag-listener';\nimport { EventEmitter } from '../utils/event-emitter';\nimport { Side } from '../utils/types';\nimport { numberToPixels, setElementDisplayVisibility } from '../utils/utils';\nimport { HeaderButton } from './header-button';\nimport { Tab } from './tab';\nimport { TabsContainer } from './tabs-container';\n\n/**\n * This class represents a header above a Stack ContentItem.\n * @public\n */\nexport class Header extends EventEmitter {\n /** @internal */\n private readonly _tabsContainer: TabsContainer;\n /** @internal */\n private readonly _element: HTMLElement;\n /** @internal */\n private readonly _controlsContainerElement: HTMLElement;\n\n /** @internal */\n private readonly _show: boolean;\n /** @internal */\n private readonly _popoutEnabled: boolean;\n /** @internal */\n private readonly _popoutLabel: string;\n /** @internal */\n private readonly _maximiseEnabled: boolean;\n /** @internal */\n private readonly _maximiseLabel: string;\n /** @internal */\n private readonly _minimiseEnabled: boolean;\n /** @internal */\n private readonly _minimiseLabel: string;\n /** @internal */\n private readonly _closeEnabled: boolean;\n /** @internal */\n private readonly _closeLabel: string;\n /** @internal */\n private readonly _tabDropdownEnabled: boolean;\n /** @internal */\n private readonly _tabDropdownLabel: string;\n\n /** @internal */\n private readonly _tabControlOffset: number;\n\n /** @internal */\n private readonly _clickListener = (ev: MouseEvent) => this.onClick(ev);\n /** @internal */\n private readonly _touchStartListener = (ev: TouchEvent) => this.onTouchStart(ev);\n /** @internal */\n private readonly _documentMouseUpListener: (this: void) => void;\n\n /** @internal */\n private _rowColumnClosable = true;\n /** @internal */\n private _canRemoveComponent: boolean;\n /** @internal */\n private _side: Side;\n /** @internal */\n private _leftRightSided: boolean;\n /** @internal */\n private readonly _closeButton: HeaderButton | null = null;\n /** @internal */\n private readonly _popoutButton: HeaderButton | null = null;\n /** @internal */\n private readonly _tabDropdownButton: HeaderButton;\n /** @internal */\n private readonly _maximiseButton: HeaderButton | undefined;\n // /** @internal */\n // private _activeComponentItem: ComponentItem | null = null; // only used to identify active tab\n\n get show(): boolean { return this._show; }\n get side(): Side { return this._side; }\n get leftRightSided(): boolean { return this._leftRightSided; }\n\n get layoutManager(): LayoutManager { return this._layoutManager; }\n get parent(): Stack { return this._parent; }\n get tabs(): Tab[] { return this._tabsContainer.tabs; }\n get lastVisibleTabIndex(): number { return this._tabsContainer.lastVisibleTabIndex; }\n\n get element(): HTMLElement { return this._element; }\n get tabsContainerElement(): HTMLElement { return this._tabsContainer.element; }\n get controlsContainerElement(): HTMLElement { return this._controlsContainerElement; }\n\n /** @internal */\n constructor(\n /** @internal */\n private _layoutManager: LayoutManager,\n /** @internal */\n private _parent: Stack,\n settings: Header.Settings,\n /** @internal */\n private readonly _configClosable: boolean,\n /** @internal */\n private _getActiveComponentItemEvent: Header.GetActiveComponentItemEvent,\n closeEvent: Header.CloseEvent,\n /** @internal */\n private _popoutEvent: Header.PopoutEvent | undefined,\n /** @internal */\n private _maximiseToggleEvent: Header.MaximiseToggleEvent | undefined,\n /** @internal */\n private _clickEvent: Header.ClickEvent | undefined,\n /** @internal */\n private _touchStartEvent: Header.TouchStartEvent | undefined,\n /** @internal */\n private _componentRemoveEvent: Header.ComponentRemoveEvent | undefined,\n /** @internal */\n private _componentFocusEvent: Header.ComponentFocusEvent | undefined,\n /** @internal */\n private _componentDragStartEvent: Header.ComponentDragStartEvent | undefined,\n ) {\n super();\n\n this._tabsContainer = new TabsContainer(this._layoutManager,\n (item) => this.handleTabInitiatedComponentRemoveEvent(item),\n (item) => this.handleTabInitiatedComponentFocusEvent(item),\n (x, y, dragListener, item) => this.handleTabInitiatedDragStartEvent(x, y, dragListener, item),\n () => this.processTabDropdownActiveChanged(),\n );\n\n this._show = settings.show;\n this._popoutEnabled = settings.popoutEnabled;\n this._popoutLabel = settings.popoutLabel;\n this._maximiseEnabled = settings.maximiseEnabled;\n this._maximiseLabel = settings.maximiseLabel;\n this._minimiseEnabled = settings.minimiseEnabled;\n this._minimiseLabel = settings.minimiseLabel;\n this._closeEnabled = settings.closeEnabled;\n this._closeLabel = settings.closeLabel;\n this._tabDropdownEnabled = settings.tabDropdownEnabled;\n this._tabDropdownLabel = settings.tabDropdownLabel;\n this.setSide(settings.side);\n\n this._canRemoveComponent = this._configClosable;\n\n this._element = document.createElement('section');\n this._element.classList.add(DomConstants.ClassName.Header);\n this._controlsContainerElement = document.createElement('section');\n this._controlsContainerElement.classList.add(DomConstants.ClassName.Controls);\n this._element.appendChild(this._tabsContainer.element);\n this._element.appendChild(this._controlsContainerElement);\n this._element.appendChild(this._tabsContainer.dropdownElement);\n\n this._element.addEventListener('click', this._clickListener, { passive: true });\n this._element.addEventListener('touchstart', this._touchStartListener, { passive: true });\n\n this._documentMouseUpListener = () => this._tabsContainer.hideAdditionalTabsDropdown()\n globalThis.document.addEventListener('mouseup', this._documentMouseUpListener, { passive: true });\n\n this._tabControlOffset = this._layoutManager.layoutConfig.settings.tabControlOffset;\n\n if (this._tabDropdownEnabled) {\n this._tabDropdownButton = new HeaderButton(this, this._tabDropdownLabel, DomConstants.ClassName.TabDropdown,\n () => this._tabsContainer.showAdditionalTabsDropdown()\n );\n }\n\n if (this._popoutEnabled) {\n this._popoutButton = new HeaderButton(this, this._popoutLabel, DomConstants.ClassName.Popout, () => this.handleButtonPopoutEvent());\n }\n\n /**\n * Maximise control - set the component to the full size of the layout\n */\n if (this._maximiseEnabled) {\n this._maximiseButton = new HeaderButton(this, this._maximiseLabel, DomConstants.ClassName.Maximise,\n (ev) => this.handleButtonMaximiseToggleEvent(ev)\n );\n }\n\n /**\n * Close button\n */\n if (this._configClosable) {\n this._closeButton = new HeaderButton(this, this._closeLabel, DomConstants.ClassName.Close, () => closeEvent());\n }\n\n this.processTabDropdownActiveChanged();\n }\n\n /**\n * Destroys the entire header\n * @internal\n */\n destroy(): void {\n this.emit('destroy');\n\n this._popoutEvent = undefined;\n this._maximiseToggleEvent = undefined;\n this._clickEvent = undefined;\n this._touchStartEvent = undefined;\n this._componentRemoveEvent = undefined;\n this._componentFocusEvent = undefined;\n this._componentDragStartEvent = undefined;\n\n this._tabsContainer.destroy();\n\n globalThis.document.removeEventListener('mouseup', this._documentMouseUpListener);\n this._element.remove();\n }\n\n /**\n * Creates a new tab and associates it with a contentItem\n * @param index - The position of the tab\n * @internal\n */\n createTab(componentItem: ComponentItem, index: number): void {\n this._tabsContainer.createTab(componentItem, index);\n }\n\n /**\n * Finds a tab based on the contentItem its associated with and removes it.\n * Cannot remove tab if it has the active ComponentItem\n * @internal\n */\n removeTab(componentItem: ComponentItem): void {\n this._tabsContainer.removeTab(componentItem);\n }\n\n /** @internal */\n processActiveComponentChanged(newActiveComponentItem: ComponentItem): void {\n this._tabsContainer.processActiveComponentChanged(newActiveComponentItem);\n this.updateTabSizes();\n }\n\n /** @internal */\n setSide(value: Side): void {\n this._side = value;\n this._leftRightSided = [Side.right, Side.left].includes(this._side);\n }\n\n /**\n * Programmatically set closability.\n * @param value - Whether to enable/disable closability.\n * @returns Whether the action was successful\n * @internal\n */\n setRowColumnClosable(value: boolean): void {\n this._rowColumnClosable = value;\n this.updateClosability();\n }\n\n /**\n * Updates the header's closability. If a stack/header is able\n * to close, but has a non closable component added to it, the stack is no\n * longer closable until all components are closable.\n * @internal\n */\n updateClosability(): void {\n let isClosable: boolean;\n if (!this._configClosable) {\n isClosable = false;\n } else {\n if (!this._rowColumnClosable) {\n isClosable = false;\n } else {\n isClosable = true;\n const len = this.tabs.length;\n for (let i = 0; i < len; i++) {\n const tab = this._tabsContainer.tabs[i];\n const item = tab.componentItem;\n if (!item.isClosable) {\n isClosable = false;\n break;\n }\n }\n }\n }\n\n if (this._closeButton !== null) {\n setElementDisplayVisibility(this._closeButton.element, isClosable);\n }\n if (this._popoutButton !== null) {\n setElementDisplayVisibility(this._popoutButton.element, isClosable);\n }\n\n this._canRemoveComponent = isClosable || this._tabsContainer.tabCount > 1;\n }\n\n /** @internal */\n applyFocusedValue(value: boolean): void {\n if (value) {\n this._element.classList.add(DomConstants.ClassName.Focused);\n } else {\n this._element.classList.remove(DomConstants.ClassName.Focused);\n }\n }\n\n /** @internal */\n processMaximised(): void {\n if (this._maximiseButton === undefined) {\n throw new UnexpectedUndefinedError('HPMAX16997');\n } else {\n this._maximiseButton.element.setAttribute('title', this._minimiseLabel);\n }\n }\n\n /** @internal */\n processMinimised(): void {\n if (this._maximiseButton === undefined) {\n throw new UnexpectedUndefinedError('HPMIN16997');\n } else {\n this._maximiseButton.element.setAttribute('title', this._maximiseLabel);\n }\n }\n\n /**\n * Pushes the tabs to the tab dropdown if the available space is not sufficient\n * @internal\n */\n updateTabSizes(): void {\n if (this._tabsContainer.tabCount > 0) {\n const headerHeight = this._show ? this._layoutManager.layoutConfig.dimensions.headerHeight : 0;\n\n if (this._leftRightSided) {\n this._element.style.height = '';\n this._element.style.width = numberToPixels(headerHeight);\n } else {\n this._element.style.width = '';\n this._element.style.height = numberToPixels(headerHeight);\n }\n let availableWidth: number;\n if (this._leftRightSided) {\n availableWidth = this._element.offsetHeight - this._controlsContainerElement.offsetHeight - this._tabControlOffset;\n } else {\n availableWidth = this._element.offsetWidth - this._controlsContainerElement.offsetWidth - this._tabControlOffset;\n }\n\n this._tabsContainer.updateTabSizes(availableWidth, this._getActiveComponentItemEvent());\n }\n }\n\n /** @internal */\n private handleTabInitiatedComponentRemoveEvent(componentItem: ComponentItem) {\n if (this._canRemoveComponent) {\n if (this._componentRemoveEvent === undefined) {\n throw new UnexpectedUndefinedError('HHTCE22294');\n } else {\n this._componentRemoveEvent(componentItem);\n }\n }\n }\n\n /** @internal */\n private handleTabInitiatedComponentFocusEvent(componentItem: ComponentItem) {\n if (this._componentFocusEvent === undefined) {\n throw new UnexpectedUndefinedError('HHTAE22294');\n } else {\n this._componentFocusEvent(componentItem);\n }\n }\n\n /** @internal */\n private handleTabInitiatedDragStartEvent(x: number, y: number, dragListener: DragListener, componentItem: ComponentItem) {\n if (!this._canRemoveComponent) {\n dragListener.cancelDrag();\n } else {\n if (this._componentDragStartEvent === undefined) {\n throw new UnexpectedUndefinedError('HHTDSE22294');\n } else {\n this._componentDragStartEvent(x, y, dragListener, componentItem);\n }\n }\n }\n\n /** @internal */\n private processTabDropdownActiveChanged() {\n if (this._tabDropdownButton !== undefined) {\n setElementDisplayVisibility(this._tabDropdownButton.element, this._tabsContainer.dropdownActive);\n }\n }\n\n /** @internal */\n private handleButtonPopoutEvent() {\n if (this._layoutManager.layoutConfig.settings.popoutWholeStack) {\n if (this._popoutEvent === undefined) {\n throw new UnexpectedUndefinedError('HHBPOE17834');\n } else {\n this._popoutEvent();\n }\n } else {\n const activeComponentItem = this._getActiveComponentItemEvent();\n if (activeComponentItem) {\n activeComponentItem.popout();\n }\n // else: if the stack is empty there won't be an active item (and nothing to popout)\n }\n }\n\n /** @internal */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n private handleButtonMaximiseToggleEvent(ev: Event) {\n if (this._maximiseToggleEvent === undefined) {\n throw new UnexpectedUndefinedError('HHBMTE16834');\n } else {\n this._maximiseToggleEvent();\n }\n }\n\n /**\n * Invoked when the header's background is clicked (not it's tabs or controls)\n * @internal\n */\n private onClick(event: MouseEvent) {\n if (event.target === this._element) {\n this.notifyClick(event);\n }\n }\n\n /**\n * Invoked when the header's background is touched (not it's tabs or controls)\n * @internal\n */\n private onTouchStart(event: TouchEvent) {\n if (event.target === this._element) {\n this.notifyTouchStart(event);\n }\n }\n\n /** @internal */\n private notifyClick(ev: MouseEvent) {\n if (this._clickEvent === undefined) {\n throw new UnexpectedUndefinedError('HNHC46834');\n } else {\n this._clickEvent(ev);\n }\n }\n\n /** @internal */\n private notifyTouchStart(ev: TouchEvent) {\n if (this._touchStartEvent === undefined) {\n throw new UnexpectedUndefinedError('HNHTS46834');\n } else {\n this._touchStartEvent(ev);\n }\n }\n}\n\n/** @public */\nexport namespace Header {\n /** @internal */\n export type GetActiveComponentItemEvent = (this: void) => ComponentItem | undefined;\n /** @internal */\n export type CloseEvent = (this: void) => void;\n /** @internal */\n export type PopoutEvent = (this: void) => void;\n /** @internal */\n export type MaximiseToggleEvent = (this: void) => void;\n /** @internal */\n export type ClickEvent = (this: void, ev: MouseEvent) => void;\n /** @internal */\n export type TouchStartEvent = (this: void, ev: TouchEvent) => void;\n /** @internal */\n export type ComponentRemoveEvent = (this: void, componentItem: ComponentItem) => void;\n /** @internal */\n export type ComponentFocusEvent = (this: void, componentItem: ComponentItem) => void;\n /** @internal */\n export type ComponentDragStartEvent = (this: void, x: number, y: number, dragListener: DragListener, componentItem: ComponentItem) => void;\n /** @internal */\n export type StateChangedEvent = (this: void) => void;\n\n /** @internal */\n export interface Settings {\n show: boolean;\n side: Side;\n popoutEnabled: boolean;\n popoutLabel: string;\n maximiseEnabled: boolean;\n maximiseLabel: string;\n minimiseEnabled: boolean;\n minimiseLabel: string;\n closeEnabled: boolean;\n closeLabel: string;\n tabDropdownEnabled: boolean;\n tabDropdownLabel: string;\n }\n}\n","import { ComponentItemConfig, ItemConfig } from '../config/config';\nimport { ResolvedComponentItemConfig } from '../config/resolved-config';\nimport { Tab } from '../controls/tab';\nimport { AssertError, UnexpectedNullError } from '../errors/internal-error';\nimport { ComponentItem } from '../items/component-item';\nimport { ContentItem } from '../items/content-item';\nimport { LayoutManager } from '../layout-manager';\nimport { EventEmitter } from '../utils/event-emitter';\nimport { JsonValue, LogicalZIndex, LogicalZIndexToDefaultMap } from '../utils/types';\nimport { deepExtend, setElementHeight, setElementWidth } from '../utils/utils';\n\n/** @public */\nexport class ComponentContainer extends EventEmitter {\n /** @internal */\n private _componentType: JsonValue;\n /** @internal */\n private _boundComponent: ComponentContainer.BindableComponent;\n /** @internal */\n private _width: number;\n /** @internal */\n private _height: number;\n /** @internal */\n private _isClosable;\n /** @internal */\n private _initialState: JsonValue | undefined;\n /** @internal */\n private _state: JsonValue | undefined;\n /** @internal */\n private _visible;\n /** @internal */\n private _isShownWithZeroDimensions;\n /** @internal */\n private _tab: Tab;\n /** @internal */\n private _stackMaximised = false;\n /** @internal */\n private _logicalZIndex: LogicalZIndex;\n\n stateRequestEvent: ComponentContainer.StateRequestEventHandler | undefined;\n virtualRectingRequiredEvent: ComponentContainer.VirtualRectingRequiredEvent | undefined;\n virtualVisibilityChangeRequiredEvent: ComponentContainer.VirtualVisibilityChangeRequiredEvent | undefined;\n virtualZIndexChangeRequiredEvent: ComponentContainer.VirtualZIndexChangeRequiredEvent | undefined;\n\n get width(): number { return this._width; }\n get height(): number { return this._height; }\n get parent(): ComponentItem { return this._parent; }\n /** @internal @deprecated use {@link (ComponentContainer:class).componentType} */\n get componentName(): JsonValue { return this._componentType; }\n get componentType(): JsonValue { return this._componentType; }\n get virtual(): boolean { return this._boundComponent.virtual; }\n get component(): ComponentContainer.Component { return this._boundComponent.component; }\n get tab(): Tab { return this._tab; }\n get title(): string { return this._parent.title; }\n get layoutManager(): LayoutManager { return this._layoutManager; }\n get isHidden(): boolean { return !this._visible; }\n get visible(): boolean { return this._visible; }\n get state(): JsonValue | undefined { return this._state; }\n /** Return the initial component state */\n get initialState(): JsonValue | undefined { return this._initialState; }\n /** The inner DOM element where the container's content is intended to live in */\n get element(): HTMLElement { return this._element; }\n\n /** @internal */\n constructor(\n /** @internal */\n private readonly _config: ResolvedComponentItemConfig,\n /** @internal */\n private readonly _parent: ComponentItem,\n /** @internal */\n private readonly _layoutManager: LayoutManager,\n /** @internal */\n private readonly _element: HTMLElement,\n /** @internal */\n private readonly _updateItemConfigEvent: ComponentContainer.UpdateItemConfigEventHandler,\n /** @internal */\n private readonly _showEvent: ComponentContainer.ShowEventHandler,\n /** @internal */\n private readonly _hideEvent: ComponentContainer.HideEventHandler,\n /** @internal */\n private readonly _focusEvent: ComponentContainer.FocusEventHandler,\n /** @internal */\n private readonly _blurEvent: ComponentContainer.BlurEventHandler,\n ) {\n super();\n\n this._width = 0;\n this._height = 0;\n this._visible = true;\n this._isShownWithZeroDimensions = true;\n\n this._componentType = _config.componentType;\n this._isClosable = _config.isClosable;\n this._initialState = _config.componentState;\n this._state = this._initialState;\n\n this._boundComponent = this.layoutManager.bindComponent(this, _config);\n\n this.updateElementPositionPropertyFromBoundComponent();\n }\n\n /** @internal */\n destroy(): void {\n this.releaseComponent();\n this.stateRequestEvent = undefined;\n this.emit('destroy');\n }\n\n /** @deprecated use {@link (ComponentContainer:class).element } */\n getElement(): HTMLElement {\n return this._element;\n }\n\n /**\n * Hides the container's component item (and hence, the container) if not already hidden.\n * Emits hide event prior to hiding the container.\n */\n hide(): void {\n this._hideEvent();\n }\n\n /**\n * Shows the container's component item (and hence, the container) if not visible.\n * Emits show event prior to hiding the container.\n */\n show(): void {\n this._showEvent();\n }\n\n /**\n * Focus this component in Layout.\n */\n focus(suppressEvent = false): void {\n this._focusEvent(suppressEvent);\n }\n\n /**\n * Remove focus from this component in Layout.\n */\n blur(suppressEvent = false): void {\n this._blurEvent(suppressEvent);\n }\n\n /**\n * Set the size from within the container. Traverses up\n * the item tree until it finds a row or column element\n * and resizes its items accordingly.\n *\n * If this container isn't a descendant of a row or column\n * it returns false\n * @param width - The new width in pixel\n * @param height - The new height in pixel\n *\n * @returns resizeSuccesful\n *\n * @internal\n */\n setSize(width: number, height: number): boolean {\n let ancestorItem: ContentItem | null = this._parent;\n if (ancestorItem.isColumn || ancestorItem.isRow || ancestorItem.parent === null) {\n throw new AssertError('ICSSPRC', 'ComponentContainer cannot have RowColumn Parent');\n } else {\n let ancestorChildItem: ContentItem;\n do {\n ancestorChildItem = ancestorItem;\n ancestorItem = ancestorItem.parent;\n } while (ancestorItem !== null && !ancestorItem.isColumn && !ancestorItem.isRow);\n\n if (ancestorItem === null) {\n // no Row or Column found\n return false;\n } else {\n // ancestorItem is Row or Column\n const direction = ancestorItem.isColumn ? 'height' : 'width';\n const currentSize = this[direction];\n if (currentSize === null) {\n throw new UnexpectedNullError('ICSSCS11194');\n } else {\n const newSize = direction === 'height' ? height : width;\n\n const totalPixel = currentSize * (1 / (ancestorChildItem.size / 100));\n const percentage = (newSize / totalPixel) * 100;\n const delta = (ancestorChildItem.size - percentage) / (ancestorItem.contentItems.length - 1);\n\n for (let i = 0; i < ancestorItem.contentItems.length; i++) {\n const ancestorItemContentItem = ancestorItem.contentItems[i];\n if (ancestorItemContentItem === ancestorChildItem) {\n ancestorItemContentItem.size = percentage;\n } else {\n ancestorItemContentItem.size += delta;\n }\n }\n\n ancestorItem.updateSize(false);\n\n return true;\n }\n }\n }\n }\n\n /**\n * Closes the container if it is closable. Can be called by\n * both the component within at as well as the contentItem containing\n * it. Emits a close event before the container itself is closed.\n */\n close(): void {\n if (this._isClosable) {\n this.emit('close');\n this._parent.close();\n }\n }\n\n /** Replaces component without affecting layout */\n replaceComponent(itemConfig: ComponentItemConfig): void {\n this.releaseComponent();\n\n if (!ItemConfig.isComponent(itemConfig)) {\n throw new Error('ReplaceComponent not passed a component ItemConfig')\n } else {\n const config = ComponentItemConfig.resolve(itemConfig, false);\n this._initialState = config.componentState;\n this._state = this._initialState;\n this._componentType = config.componentType;\n\n this._updateItemConfigEvent(config);\n\n this._boundComponent = this.layoutManager.bindComponent(this, config);\n this.updateElementPositionPropertyFromBoundComponent();\n\n if (this._boundComponent.virtual) {\n if (this.virtualVisibilityChangeRequiredEvent !== undefined) {\n this.virtualVisibilityChangeRequiredEvent(this, this._visible);\n }\n if (this.virtualRectingRequiredEvent !== undefined) {\n this._layoutManager.fireBeforeVirtualRectingEvent(1);\n try {\n this.virtualRectingRequiredEvent(this, this._width, this._height);\n } finally {\n this._layoutManager.fireAfterVirtualRectingEvent();\n }\n }\n this.setBaseLogicalZIndex();\n }\n\n this.emit('stateChanged');\n }\n }\n\n /**\n * Returns the initial component state or the latest passed in setState()\n * @returns state\n * @deprecated Use {@link (ComponentContainer:class).initialState}\n */\n getState(): JsonValue | undefined {\n return this._state;\n }\n\n /**\n * Merges the provided state into the current one\n * @deprecated Use {@link (ComponentContainer:class).stateRequestEvent}\n */\n extendState(state: Record): void {\n const extendedState = deepExtend(this._state as Record, state);\n this.setState(extendedState as JsonValue);\n }\n\n /**\n * Sets the component state\n * @deprecated Use {@link (ComponentContainer:class).stateRequestEvent}\n */\n setState(state: JsonValue): void {\n this._state = state;\n this._parent.emitBaseBubblingEvent('stateChanged');\n }\n\n /**\n * Set's the components title\n */\n setTitle(title: string): void {\n this._parent.setTitle(title);\n }\n\n /** @internal */\n setTab(tab: Tab): void {\n this._tab = tab;\n this.emit('tab', tab)\n }\n\n /** @internal */\n setVisibility(value: boolean): void {\n if (this._boundComponent.virtual) {\n if (this.virtualVisibilityChangeRequiredEvent !== undefined) {\n this.virtualVisibilityChangeRequiredEvent(this, value);\n }\n }\n\n if (value) {\n if (!this._visible) {\n this._visible = true;\n if (this._height === 0 && this._width === 0) {\n this._isShownWithZeroDimensions = true;\n } else {\n this._isShownWithZeroDimensions = false;\n this.setSizeToNodeSize(this._width, this._height, true);\n this.emitShow();\n }\n } else {\n if (this._isShownWithZeroDimensions && (this._height !== 0 || this._width !== 0)) {\n this._isShownWithZeroDimensions = false;\n this.setSizeToNodeSize(this._width, this._height, true);\n this.emitShow();\n }\n }\n } else {\n if (this._visible) {\n this._visible = false;\n this._isShownWithZeroDimensions = false;\n this.emitHide();\n }\n }\n }\n\n setBaseLogicalZIndex(): void {\n this.setLogicalZIndex(LogicalZIndex.base);\n }\n\n setLogicalZIndex(logicalZIndex: LogicalZIndex): void {\n if (logicalZIndex !== this._logicalZIndex) {\n this._logicalZIndex = logicalZIndex;\n\n this.notifyVirtualZIndexChangeRequired();\n }\n }\n\n /**\n * Set the container's size, but considered temporary (for dragging)\n * so don't emit any events.\n * @internal\n */\n enterDragMode(width: number, height: number): void {\n this._width = width;\n this._height = height;\n setElementWidth(this._element, width);\n setElementHeight(this._element, height);\n\n this.setLogicalZIndex(LogicalZIndex.drag);\n\n this.drag();\n }\n\n /** @internal */\n exitDragMode(): void {\n this.setBaseLogicalZIndex();\n }\n\n /** @internal */\n enterStackMaximised(): void {\n this._stackMaximised = true;\n this.setLogicalZIndex(LogicalZIndex.stackMaximised);\n }\n\n /** @internal */\n exitStackMaximised(): void {\n this.setBaseLogicalZIndex();\n this._stackMaximised = false;\n }\n\n /** @internal */\n drag(): void {\n if (this._boundComponent.virtual) {\n if (this.virtualRectingRequiredEvent !== undefined) {\n this._layoutManager.fireBeforeVirtualRectingEvent(1);\n try {\n this.virtualRectingRequiredEvent(this, this._width, this._height);\n } finally {\n this._layoutManager.fireAfterVirtualRectingEvent();\n }\n }\n }\n }\n\n /**\n * Sets the container's size. Called by the container's component item.\n * To instead set the size programmatically from within the component itself,\n * use the public setSize method\n * @param width - in px\n * @param height - in px\n * @param force - set even if no change\n * @internal\n */\n setSizeToNodeSize(width: number, height: number, force: boolean): void {\n if (width !== this._width || height !== this._height || force) {\n this._width = width;\n this._height = height;\n setElementWidth(this._element, width);\n setElementHeight(this._element, height);\n\n if (this._boundComponent.virtual) {\n this.addVirtualSizedContainerToLayoutManager();\n } else {\n this.emit('resize');\n this.checkShownFromZeroDimensions();\n }\n }\n }\n\n /** @internal */\n notifyVirtualRectingRequired(): void {\n if (this.virtualRectingRequiredEvent !== undefined) {\n this.virtualRectingRequiredEvent(this, this._width, this._height);\n this.emit('resize');\n this.checkShownFromZeroDimensions();\n }\n }\n\n /** @internal */\n private notifyVirtualZIndexChangeRequired(): void {\n if (this.virtualZIndexChangeRequiredEvent !== undefined) {\n const logicalZIndex = this._logicalZIndex;\n const defaultZIndex = LogicalZIndexToDefaultMap[logicalZIndex];\n this.virtualZIndexChangeRequiredEvent(this, logicalZIndex, defaultZIndex);\n }\n }\n\n /** @internal */\n private updateElementPositionPropertyFromBoundComponent() {\n if (this._boundComponent.virtual) {\n this._element.style.position = 'static';\n } else {\n this._element.style.position = ''; // set it back to attribute value\n }\n }\n\n /** @internal */\n private addVirtualSizedContainerToLayoutManager() {\n this._layoutManager.beginVirtualSizedContainerAdding();\n try {\n this._layoutManager.addVirtualSizedContainer(this);\n } finally {\n this._layoutManager.endVirtualSizedContainerAdding();\n }\n }\n\n /** @internal */\n private checkShownFromZeroDimensions() {\n if (this._isShownWithZeroDimensions && (this._height !== 0 || this._width !== 0)) {\n this._isShownWithZeroDimensions = false;\n this.emitShow();\n }\n }\n\n /** @internal */\n private emitShow(): void {\n this.emit('shown');\n this.emit('show');\n }\n\n /** @internal */\n private emitHide(): void {\n this.emit('hide');\n }\n\n /** @internal */\n private releaseComponent() {\n if (this._stackMaximised) {\n this.exitStackMaximised();\n }\n this.emit('beforeComponentRelease', this._boundComponent.component);\n this.layoutManager.unbindComponent(this, this._boundComponent.virtual, this._boundComponent.component);\n }\n}\n\n/** @public @deprecated use {@link ComponentContainer} */\nexport type ItemContainer = ComponentContainer;\n\n/** @public */\nexport namespace ComponentContainer {\n export type Component = unknown;\n\n export interface BindableComponent {\n component: Component;\n virtual: boolean;\n }\n\n export type StateRequestEventHandler = (this: void) => JsonValue | undefined;\n export type VirtualRectingRequiredEvent = (this: void, container: ComponentContainer, width: number, height: number) => void;\n export type VirtualVisibilityChangeRequiredEvent = (this: void, container: ComponentContainer, visible: boolean) => void;\n export type VirtualZIndexChangeRequiredEvent =\n (this: void, container: ComponentContainer, logicalZIndex: LogicalZIndex, defaultZIndex: string) => void;\n /** @internal */\n export type ShowEventHandler = (this: void) => void;\n /** @internal */\n export type HideEventHandler = (this: void) => void;\n /** @internal */\n export type FocusEventHandler = (this: void, suppressEvent: boolean) => void;\n /** @internal */\n export type BlurEventHandler = (this: void, suppressEvent: boolean) => void;\n /** @internal */\n export type UpdateItemConfigEventHandler = (itemConfig: ResolvedComponentItemConfig) => void;\n}\n","import { ResolvedItemConfig } from '../config/resolved-config'\nimport { BrowserPopout } from '../controls/browser-popout'\nimport { AssertError, UnexpectedNullError } from '../errors/internal-error'\nimport { LayoutManager } from '../layout-manager'\nimport { EventEmitter } from '../utils/event-emitter'\nimport { AreaLinkedRect, ItemType, SizeUnitEnum } from '../utils/types'\nimport { getUniqueId, setElementDisplayVisibility } from '../utils/utils'\nimport { ComponentItem } from './component-item'\nimport { ComponentParentableItem } from './component-parentable-item'\nimport { Stack } from './stack'\n\n/**\n * This is the baseclass that all content items inherit from.\n * Most methods provide a subset of what the sub-classes do.\n *\n * It also provides a number of functions for tree traversal\n * @public\n */\n\nexport abstract class ContentItem extends EventEmitter {\n /** @internal */\n private _type: ItemType;\n /** @internal */\n private _id: string;\n /** @internal */\n private _popInParentIds: string[] = [];\n /** @internal */\n private _contentItems: ContentItem[];\n /** @internal */\n private _isClosable;\n /** @internal */\n private _pendingEventPropagations: Record;\n /** @internal */\n private _throttledEvents: string[];\n /** @internal */\n private _isInitialised;\n\n /** @internal */\n size: number;\n /** @internal */\n sizeUnit: SizeUnitEnum;\n /** @internal */\n minSize: number | undefined;\n /** @internal */\n minSizeUnit: SizeUnitEnum;\n\n isGround: boolean\n isRow: boolean\n isColumn: boolean\n isStack: boolean\n isComponent: boolean\n\n get type(): ItemType { return this._type; }\n get id(): string { return this._id; }\n set id(value: string) { this._id = value; }\n /** @internal */\n get popInParentIds(): string[] { return this._popInParentIds; }\n get parent(): ContentItem | null { return this._parent; }\n get contentItems(): ContentItem[] { return this._contentItems; }\n get isClosable(): boolean { return this._isClosable; }\n get element(): HTMLElement { return this._element; }\n get isInitialised(): boolean { return this._isInitialised; }\n\n static isStack(item: ContentItem): item is Stack {\n return item.isStack;\n }\n\n static isComponentItem(item: ContentItem): item is ComponentItem {\n return item.isComponent;\n }\n\n static isComponentParentableItem(item: ContentItem): item is ComponentParentableItem {\n return item.isStack || item.isGround;\n }\n\n /** @internal */\n constructor(public readonly layoutManager: LayoutManager,\n config: ResolvedItemConfig,\n /** @internal */\n private _parent: ContentItem | null,\n /** @internal */\n private readonly _element: HTMLElement\n ) {\n super();\n\n this._type = config.type;\n this._id = config.id;\n\n this._isInitialised = false;\n this.isGround = false;\n this.isRow = false;\n this.isColumn = false;\n this.isStack = false;\n this.isComponent = false;\n\n this.size = config.size;\n this.sizeUnit = config.sizeUnit;\n this.minSize = config.minSize;\n this.minSizeUnit = config.minSizeUnit;\n\n this._isClosable = config.isClosable;\n\n this._pendingEventPropagations = {};\n this._throttledEvents = ['stateChanged'];\n\n this._contentItems = this.createContentItems(config.content);\n }\n\n /**\n * Updaters the size of the component and its children, called recursively\n * @param force - In some cases the size is not updated if it has not changed. In this case, events\n * (such as ComponentContainer.virtualRectingRequiredEvent) are not fired. Setting force to true, ensures the size is updated regardless, and\n * the respective events are fired. This is sometimes necessary when a component's size has not changed but it has become visible, and the\n * relevant events need to be fired.\n * @internal\n */\n abstract updateSize(force: boolean): void;\n\n /**\n * Removes a child node (and its children) from the tree\n * @param contentItem - The child item to remove\n * @param keepChild - Whether to destroy the removed item\n */\n removeChild(contentItem: ContentItem, keepChild = false): void {\n /*\n * Get the position of the item that's to be removed within all content items this node contains\n */\n const index = this._contentItems.indexOf(contentItem);\n\n /*\n * Make sure the content item to be removed is actually a child of this item\n */\n if (index === -1) {\n throw new Error('Can\\'t remove child item. Unknown content item');\n }\n\n /**\n\t\t * Call destroy on the content item.\n\t\t * All children are destroyed as well\n\t\t */\n if (!keepChild) {\n\t\t\tthis._contentItems[index].destroy();\n }\n\n /**\n * Remove the content item from this nodes array of children\n */\n this._contentItems.splice(index, 1);\n\n /**\n * If this node still contains other content items, adjust their size\n */\n if (this._contentItems.length > 0) {\n this.updateSize(false);\n } else {\n /**\n * If this was the last content item, remove this node as well\n */\n if (!this.isGround && this._isClosable === true) {\n if (this._parent === null) {\n throw new UnexpectedNullError('CIUC00874');\n } else {\n this._parent.removeChild(this);\n }\n }\n }\n }\n\n /**\n * Sets up the tree structure for the newly added child\n * The responsibility for the actual DOM manipulations lies\n * with the concrete item\n *\n * @param contentItem -\n * @param index - If omitted item will be appended\n * @param suspendResize - Used by descendent implementations\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n addChild(contentItem: ContentItem, index?: number | null, suspendResize?: boolean): number {\n index ??= this._contentItems.length;\n\n this._contentItems.splice(index, 0, contentItem);\n contentItem.setParent(this);\n\n if (this._isInitialised === true && contentItem._isInitialised === false) {\n contentItem.init();\n }\n\n return index;\n }\n\n /**\n * Replaces oldChild with newChild\n * @param oldChild -\n * @param newChild -\n * @internal\n */\n replaceChild(oldChild: ContentItem, newChild: ContentItem, destroyOldChild = false): void {\n // Do not try to replace ComponentItem - will not work\n const index = this._contentItems.indexOf(oldChild);\n const parentNode = oldChild._element.parentNode;\n\n if (index === -1) {\n throw new AssertError('CIRCI23232', 'Can\\'t replace child. oldChild is not child of this');\n }\n\n if (parentNode === null) {\n throw new UnexpectedNullError('CIRCP23232');\n } else {\n parentNode.replaceChild(newChild._element, oldChild._element);\n\n /*\n * Optionally destroy the old content item\n */\n if (destroyOldChild === true) {\n oldChild._parent = null;\n oldChild.destroy(); // will now also destroy all children of oldChild\n }\n\n /*\n * Wire the new contentItem into the tree\n */\n this._contentItems[index] = newChild;\n newChild.setParent(this);\n // newChild inherits the sizes from the old child:\n newChild.size = oldChild.size;\n newChild.sizeUnit = oldChild.sizeUnit;\n newChild.minSize = oldChild.minSize;\n newChild.minSizeUnit = oldChild.minSizeUnit;\n\n //TODO This doesn't update the config... refactor to leave item nodes untouched after creation\n if (newChild._parent === null) {\n throw new UnexpectedNullError('CIRCNC45699');\n } else {\n if (newChild._parent._isInitialised === true && newChild._isInitialised === false) {\n newChild.init();\n }\n\n this.updateSize(false);\n }\n }\n }\n\n /**\n * Convenience method.\n * Shorthand for this.parent.removeChild( this )\n */\n remove(): void {\n if (this._parent === null) {\n throw new UnexpectedNullError('CIR11110');\n } else {\n this._parent.removeChild(this);\n }\n }\n\n /**\n * Removes the component from the layout and creates a new\n * browser window with the component and its children inside\n */\n popout(): BrowserPopout {\n const parentId = getUniqueId();\n const browserPopout = this.layoutManager.createPopoutFromContentItem(this, undefined, parentId, undefined);\n this.emitBaseBubblingEvent('stateChanged');\n return browserPopout;\n }\n\n abstract toConfig(): ResolvedItemConfig;\n\n /** @internal */\n calculateConfigContent(): ResolvedItemConfig[] {\n const contentItems = this._contentItems;\n const count = contentItems.length;\n const result = new Array(count);\n for (let i = 0; i < count; i++) {\n const item = contentItems[i];\n result[i] = item.toConfig();\n }\n return result;\n }\n\n /** @internal */\n highlightDropZone(x: number, y: number, area: AreaLinkedRect): void {\n const dropTargetIndicator = this.layoutManager.dropTargetIndicator;\n if (dropTargetIndicator === null) {\n throw new UnexpectedNullError('ACIHDZ5593');\n } else {\n dropTargetIndicator.highlightArea(area, 1);\n }\n }\n\n /** @internal */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n onDrop(contentItem: ContentItem, area: ContentItem.Area): void {\n this.addChild(contentItem);\n }\n\n /** @internal */\n show(): void {\n this.layoutManager.beginSizeInvalidation();\n try {\n // Not sure why showAllActiveContentItems() was called. GoldenLayout seems to work fine without it. Left commented code\n // in source in case a reason for it becomes apparent.\n // this.layoutManager.showAllActiveContentItems();\n setElementDisplayVisibility(this._element, true);\n // this.layoutManager.updateSizeFromContainer();\n\n for (let i = 0; i < this._contentItems.length; i++) {\n this._contentItems[i].show();\n }\n } finally {\n this.layoutManager.endSizeInvalidation();\n }\n }\n\n /**\n * Destroys this item ands its children\n * @internal\n */\n destroy(): void {\n for (let i = 0; i < this._contentItems.length; i++) {\n this._contentItems[i].destroy();\n }\n this._contentItems = [];\n\n this.emitBaseBubblingEvent('beforeItemDestroyed');\n this._element.remove();\n this.emitBaseBubblingEvent('itemDestroyed');\n }\n\n /**\n * Returns the area the component currently occupies\n * @internal\n */\n getElementArea(element?: HTMLElement): ContentItem.Area | null {\n element = element ?? this._element;\n\n const rect = element.getBoundingClientRect();\n const top = rect.top + document.body.scrollTop;\n const left = rect.left + document.body.scrollLeft;\n\n const width = rect.width;\n const height = rect.height;\n\n return {\n x1: left,\n y1: top,\n x2: left + width,\n y2: top + height,\n surface: width * height,\n contentItem: this\n };\n }\n\n /**\n * The tree of content items is created in two steps: First all content items are instantiated,\n * then init is called recursively from top to bottem. This is the basic init function,\n * it can be used, extended or overwritten by the content items\n *\n * Its behaviour depends on the content item\n * @internal\n */\n init(): void {\n this._isInitialised = true;\n this.emitBaseBubblingEvent('itemCreated');\n this.emitUnknownBubblingEvent(this.type + 'Created');\n }\n\n /** @internal */\n protected setParent(parent: ContentItem): void {\n this._parent = parent;\n }\n\n /** @internal */\n addPopInParentId(id: string): void {\n if (!this.popInParentIds.includes(id)) {\n this.popInParentIds.push(id);\n }\n }\n\n /** @internal */\n protected initContentItems(): void {\n for (let i = 0; i < this._contentItems.length; i++) {\n this._contentItems[i].init();\n }\n }\n\n /** @internal */\n protected hide(): void {\n this.layoutManager.beginSizeInvalidation();\n try {\n setElementDisplayVisibility(this._element, false);\n // this.layoutManager.updateSizeFromContainer();\n } finally {\n this.layoutManager.endSizeInvalidation();\n }\n }\n\n /** @internal */\n protected updateContentItemsSize(force: boolean): void {\n for (let i = 0; i < this._contentItems.length; i++) {\n this._contentItems[i].updateSize(force);\n }\n }\n\n /**\n * creates all content items for this node at initialisation time\n * PLEASE NOTE, please see addChild for adding contentItems at runtime\n * @internal\n */\n private createContentItems(content: readonly ResolvedItemConfig[]) {\n const count = content.length;\n const result = new Array(count);\n for (let i = 0; i < content.length; i++) {\n result[i] = this.layoutManager.createContentItem(content[i], this);\n }\n return result;\n }\n\n /**\n * Called for every event on the item tree. Decides whether the event is a bubbling\n * event and propagates it to its parent\n *\n * @param name - The name of the event\n * @param event -\n * @internal\n */\n private propagateEvent(name: string, args: unknown[]) {\n if (args.length === 1) {\n const event = args[0];\n if (event instanceof EventEmitter.BubblingEvent &&\n event.isPropagationStopped === false &&\n this._isInitialised === true) {\n\n /**\n * In some cases (e.g. if an element is created from a DragSource) it\n * doesn't have a parent and is not a child of GroundItem. If that's the case\n * propagate the bubbling event from the top level of the substree directly\n * to the layoutManager\n */\n if (this.isGround === false && this._parent) {\n this._parent.emitUnknown(name, event);\n } else {\n this.scheduleEventPropagationToLayoutManager(name, event);\n }\n }\n }\n }\n\n override tryBubbleEvent(name: string, args: unknown[]): void {\n if (args.length === 1) {\n const event = args[0];\n if (event instanceof EventEmitter.BubblingEvent &&\n event.isPropagationStopped === false &&\n this._isInitialised === true\n ) {\n /**\n * In some cases (e.g. if an element is created from a DragSource) it\n * doesn't have a parent and is not a child of GroundItem. If that's the case\n * propagate the bubbling event from the top level of the substree directly\n * to the layoutManager\n */\n if (this.isGround === false && this._parent) {\n this._parent.emitUnknown(name, event);\n } else {\n this.scheduleEventPropagationToLayoutManager(name, event);\n }\n }\n }\n }\n\n /**\n * All raw events bubble up to the Ground element. Some events that\n * are propagated to - and emitted by - the layoutManager however are\n * only string-based, batched and sanitized to make them more usable\n *\n * @param name - The name of the event\n * @internal\n */\n private scheduleEventPropagationToLayoutManager(name: string, event: EventEmitter.BubblingEvent) {\n if (this._throttledEvents.indexOf(name) === -1) {\n this.layoutManager.emitUnknown(name, event);\n } else {\n if (this._pendingEventPropagations[name] !== true) {\n this._pendingEventPropagations[name] = true;\n globalThis.requestAnimationFrame(() => this.propagateEventToLayoutManager(name, event));\n }\n }\n\n }\n\n /**\n * Callback for events scheduled by _scheduleEventPropagationToLayoutManager\n *\n * @param name - The name of the event\n * @internal\n */\n private propagateEventToLayoutManager(name: string, event: EventEmitter.BubblingEvent) {\n this._pendingEventPropagations[name] = false;\n this.layoutManager.emitUnknown(name, event);\n }\n}\n\n/** @public */\nexport namespace ContentItem {\n /** @internal */\n export interface Area extends AreaLinkedRect {\n surface: number;\n contentItem: ContentItem;\n }\n}\n\n/** @public @deprecated Use {@link (ContentItem:class)} */\nexport type AbstractContentItem = ContentItem;\n","import { ResolvedComponentItemConfig, ResolvedHeaderedItemConfig } from '../config/resolved-config';\nimport { ComponentContainer } from '../container/component-container';\nimport { Tab } from '../controls/tab';\nimport { UnexpectedNullError } from '../errors/internal-error';\nimport { LayoutManager } from '../layout-manager';\nimport { DomConstants } from '../utils/dom-constants';\nimport { ItemType, JsonValue } from '../utils/types';\nimport { getElementWidthAndHeight, setElementHeight, setElementWidth } from '../utils/utils';\nimport { ComponentParentableItem } from './component-parentable-item';\nimport { ContentItem } from './content-item';\n\n/** @public */\nexport class ComponentItem extends ContentItem {\n /** @internal */\n private _reorderEnabled: boolean;\n /** @internal */\n private _headerConfig: ResolvedHeaderedItemConfig.Header | undefined;\n /** @internal */\n private _title: string;\n /** @internal */\n private readonly _initialWantMaximise: boolean;\n /** @internal */\n private _container: ComponentContainer;\n /** @internal */\n private _tab: Tab;\n /** @internal */\n private _focused = false;\n\n /** @internal @deprecated use {@link (ComponentItem:class).componentType} */\n get componentName(): JsonValue { return this._container.componentType; }\n get componentType(): JsonValue { return this._container.componentType; }\n get reorderEnabled(): boolean { return this._reorderEnabled; }\n /** @internal */\n get initialWantMaximise(): boolean { return this._initialWantMaximise; }\n get component(): ComponentContainer.Component | undefined { return this._container.component; }\n get container(): ComponentContainer { return this._container; }\n get parentItem(): ComponentParentableItem { return this._parentItem; }\n\n get headerConfig(): ResolvedHeaderedItemConfig.Header | undefined { return this._headerConfig; }\n get title(): string { return this._title; }\n get tab(): Tab { return this._tab; }\n get focused(): boolean { return this._focused; }\n\n /** @internal */\n constructor(\n layoutManager: LayoutManager,\n config: ResolvedComponentItemConfig,\n /** @internal */\n private _parentItem: ComponentParentableItem\n ) {\n super(layoutManager, config, _parentItem, document.createElement('div'));\n\n this.isComponent = true;\n\n this._reorderEnabled = config.reorderEnabled;\n\n this.applyUpdatableConfig(config);\n\n this._initialWantMaximise = config.maximised;\n\n const containerElement = document.createElement('div');\n containerElement.classList.add(DomConstants.ClassName.Content);\n this.element.appendChild(containerElement);\n this._container = new ComponentContainer(config, this, layoutManager, containerElement,\n (itemConfig) => this.handleUpdateItemConfigEvent(itemConfig),\n () => this.show(),\n () => this.hide(),\n (suppressEvent) => this.focus(suppressEvent),\n (suppressEvent) => this.blur(suppressEvent),\n );\n }\n\n /** @internal */\n override destroy(): void {\n this._container.destroy()\n super.destroy();\n }\n\n applyUpdatableConfig(config: ResolvedComponentItemConfig): void {\n this.setTitle(config.title);\n this._headerConfig = config.header;\n }\n\n toConfig(): ResolvedComponentItemConfig {\n const stateRequestEvent = this._container.stateRequestEvent;\n const state = stateRequestEvent === undefined ? this._container.state : stateRequestEvent();\n\n const result: ResolvedComponentItemConfig = {\n type: ItemType.component,\n content: [],\n size: this.size,\n sizeUnit: this.sizeUnit,\n minSize: this.minSize,\n minSizeUnit: this.minSizeUnit,\n id: this.id,\n maximised: false,\n isClosable: this.isClosable,\n reorderEnabled: this._reorderEnabled,\n title: this._title,\n header: ResolvedHeaderedItemConfig.Header.createCopy(this._headerConfig),\n componentType: ResolvedComponentItemConfig.copyComponentType(this.componentType),\n componentState: state,\n }\n\n return result;\n }\n\n close(): void {\n if (this.parent === null) {\n throw new UnexpectedNullError('CIC68883');\n } else {\n this.parent.removeChild(this, false);\n }\n }\n\n // Used by Drag Proxy\n /** @internal */\n enterDragMode(width: number, height: number): void {\n setElementWidth(this.element, width);\n setElementHeight(this.element, height);\n this._container.enterDragMode(width, height);\n }\n\n /** @internal */\n exitDragMode(): void {\n this._container.exitDragMode();\n }\n\n /** @internal */\n enterStackMaximised(): void {\n this._container.enterStackMaximised();\n }\n\n /** @internal */\n exitStackMaximised(): void {\n this._container.exitStackMaximised();\n }\n\n // Used by Drag Proxy\n /** @internal */\n drag(): void {\n this._container.drag();\n }\n\n /** @internal */\n override updateSize(force: boolean): void {\n this.updateNodeSize(force);\n }\n\n /** @internal */\n override init(): void {\n this.updateNodeSize(false);\n\n super.init();\n this._container.emit('open');\n this.initContentItems();\n }\n\n /**\n * Set this component's title\n *\n * @public\n * @param title -\n */\n\n setTitle(title: string): void {\n this._title = title;\n this.emit('titleChanged', title);\n this.emit('stateChanged');\n }\n\n setTab(tab: Tab): void {\n this._tab = tab;\n this.emit('tab', tab)\n this._container.setTab(tab);\n }\n\n /** @internal */\n override hide(): void {\n super.hide();\n this._container.setVisibility(false);\n }\n\n /** @internal */\n override show(): void {\n super.show();\n this._container.setVisibility(true);\n }\n\n /**\n * Focuses the item if it is not already focused\n */\n focus(suppressEvent = false): void {\n this.parentItem.setActiveComponentItem(this, true, suppressEvent);\n }\n\n /** @internal */\n setFocused(suppressEvent: boolean): void {\n this._focused = true;\n this.tab.setFocused();\n if (!suppressEvent) {\n this.emitBaseBubblingEvent('focus');\n }\n }\n\n /**\n * Blurs (defocuses) the item if it is focused\n */\n blur(suppressEvent = false): void {\n if (this._focused) {\n this.layoutManager.setFocusedComponentItem(undefined, suppressEvent);\n }\n }\n\n /** @internal */\n setBlurred(suppressEvent: boolean): void {\n this._focused = false;\n this.tab.setBlurred();\n if (!suppressEvent) {\n this.emitBaseBubblingEvent('blur');\n }\n }\n\n /** @internal */\n protected override setParent(parent: ContentItem): void {\n this._parentItem = parent as ComponentParentableItem;\n super.setParent(parent);\n }\n\n /** @internal */\n private handleUpdateItemConfigEvent(itemConfig: ResolvedComponentItemConfig) {\n this.applyUpdatableConfig(itemConfig);\n }\n\n /** @internal */\n private updateNodeSize(force: boolean): void {\n if (this.element.style.display !== 'none') {\n // Do not update size of hidden components to prevent unwanted reflows\n\n const { width, height } = getElementWidthAndHeight(this.element);\n this._container.setSizeToNodeSize(width, height, force);\n }\n }\n}\n\n/** @public @deprecated use {@link (ComponentItem:class)} */\nexport type Component = ComponentItem;\n\n/** @public */\nexport namespace ComponentItem {\n export type Component = ComponentContainer.Component;\n}\n","import { ComponentItem } from './component-item';\nimport { ContentItem } from './content-item';\n\nexport abstract class ComponentParentableItem extends ContentItem {\n /** @internal */\n private _focused = false;\n\n get focused(): boolean { return this._focused; }\n\n /** @internal */\n setFocusedValue(value: boolean): void {\n this._focused = value;\n }\n\n abstract setActiveComponentItem(item: ComponentItem, focus: boolean, suppressFocusEvent: boolean): void;\n}\n","import { ComponentItemConfig, ItemConfig } from '../config/config';\nimport { ResolvedComponentItemConfig, ResolvedHeaderedItemConfig, ResolvedItemConfig, ResolvedStackItemConfig } from '../config/resolved-config';\nimport { Header } from '../controls/header';\nimport { AssertError, UnexpectedNullError, UnexpectedUndefinedError } from '../errors/internal-error';\nimport { LayoutManager } from '../layout-manager';\nimport { DomConstants } from '../utils/dom-constants';\nimport { DragListener } from '../utils/drag-listener';\nimport { EventEmitter } from '../utils/event-emitter';\nimport { AreaLinkedRect, ItemType, JsonValue, Side, SizeUnitEnum, WidthAndHeight, WidthOrHeightPropertyName } from '../utils/types';\nimport {\n getElementWidthAndHeight,\n numberToPixels,\n setElementDisplayVisibility\n} from '../utils/utils';\nimport { ComponentItem } from './component-item';\nimport { ComponentParentableItem } from './component-parentable-item';\nimport { ContentItem } from './content-item';\n\n/** @public */\nexport class Stack extends ComponentParentableItem {\n /** @internal */\n private readonly _headerConfig: ResolvedHeaderedItemConfig.Header | undefined;\n /** @internal */\n private readonly _header: Header;\n /** @internal */\n private readonly _childElementContainer: HTMLElement;\n /** @internal */\n private readonly _maximisedEnabled: boolean;\n /** @internal */\n private _activeComponentItem: ComponentItem | undefined;\n /** @internal */\n private _dropSegment: Stack.Segment;\n /** @internal */\n private _dropIndex: number;\n /** @internal */\n private _contentAreaDimensions: Stack.ContentAreaDimensions;\n /** @internal */\n private _headerSideChanged = false;\n /** @internal */\n private readonly _initialWantMaximise: boolean;\n /** @internal */\n private _initialActiveItemIndex: number;\n\n /** @internal */\n private _resizeListener = () => this.handleResize();\n /** @internal */\n private _maximisedListener = () => this.handleMaximised();\n /** @internal */\n private _minimisedListener = () => this.handleMinimised();\n\n get childElementContainer(): HTMLElement { return this._childElementContainer; }\n get header(): Header { return this._header; }\n get headerShow(): boolean { return this._header.show; }\n get headerSide(): Side { return this._header.side; }\n get headerLeftRightSided(): boolean { return this._header.leftRightSided; }\n /** @internal */\n get contentAreaDimensions(): Stack.ContentAreaDimensions | undefined { return this._contentAreaDimensions; }\n /** @internal */\n get initialWantMaximise(): boolean { return this._initialWantMaximise; }\n get isMaximised(): boolean { return this === this.layoutManager.maximisedStack; }\n get stackParent(): ContentItem {\n if (!this.parent) {\n throw new Error('Stack should always have a parent');\n }\n return this.parent;\n }\n\n /** @internal */\n constructor(layoutManager: LayoutManager, config: ResolvedStackItemConfig, parent: ContentItem) {\n super(layoutManager, config, parent, Stack.createElement(document));\n\n this._headerConfig = config.header;\n const layoutHeaderConfig = layoutManager.layoutConfig.header;\n const configContent = config.content;\n // If stack has only one component, then we can also check this for header settings\n let componentHeaderConfig: ResolvedHeaderedItemConfig.Header | undefined;\n if (configContent.length !== 1) {\n componentHeaderConfig = undefined;\n } else {\n const firstChildItemConfig = configContent[0];\n componentHeaderConfig = (firstChildItemConfig as ResolvedHeaderedItemConfig).header; // will be undefined if not component (and wont be stack)\n }\n\n this._initialWantMaximise = config.maximised;\n this._initialActiveItemIndex = config.activeItemIndex ?? 0; // make sure defined\n\n // check for defined value for each item in order of Stack (this Item), Component (first child), Manager.\n const show = this._headerConfig?.show ?? componentHeaderConfig?.show ?? layoutHeaderConfig.show;\n const popout = this._headerConfig?.popout ?? componentHeaderConfig?.popout ?? layoutHeaderConfig.popout;\n const maximise = this._headerConfig?.maximise ?? componentHeaderConfig?.maximise ?? layoutHeaderConfig.maximise;\n const close = this._headerConfig?.close ?? componentHeaderConfig?.close ?? layoutHeaderConfig.close;\n const minimise = this._headerConfig?.minimise ?? componentHeaderConfig?.minimise ?? layoutHeaderConfig.minimise;\n const tabDropdown = this._headerConfig?.tabDropdown ?? componentHeaderConfig?.tabDropdown ?? layoutHeaderConfig.tabDropdown;\n this._maximisedEnabled = maximise !== false;\n const headerSettings: Header.Settings = {\n show: show !== false,\n side: show === false ? Side.top : show,\n popoutEnabled: popout !== false,\n popoutLabel: popout === false ? '' : popout,\n maximiseEnabled: this._maximisedEnabled,\n maximiseLabel: maximise === false ? '' : maximise,\n closeEnabled: close !== false,\n closeLabel: close === false ? '' : close,\n minimiseEnabled: true,\n minimiseLabel: minimise,\n tabDropdownEnabled: tabDropdown !== false,\n tabDropdownLabel: tabDropdown === false ? '' : tabDropdown,\n };\n\n this._header = new Header(layoutManager,\n this, headerSettings,\n config.isClosable && close !== false,\n () => this.getActiveComponentItem(),\n () => this.remove(),\n () => this.handlePopoutEvent(),\n () => this.toggleMaximise(),\n (ev) => this.handleHeaderClickEvent(ev),\n (ev) => this.handleHeaderTouchStartEvent(ev),\n (item) => this.handleHeaderComponentRemoveEvent(item),\n (item) => this.handleHeaderComponentFocusEvent(item),\n (x, y, dragListener, item) => this.handleHeaderComponentStartDragEvent(x, y, dragListener, item),\n );\n\n // this._dropZones = {};\n\n this.isStack = true;\n\n this._childElementContainer = document.createElement('section');\n this._childElementContainer.classList.add(DomConstants.ClassName.Items);\n\n this.on('resize', this._resizeListener);\n if (this._maximisedEnabled) {\n this.on('maximised', this._maximisedListener);\n this.on('minimised', this._minimisedListener);\n }\n\n this.element.appendChild(this._header.element);\n this.element.appendChild(this._childElementContainer);\n\n this.setupHeaderPosition();\n this._header.updateClosability();\n }\n\n /** @internal */\n override updateSize(force: boolean): void {\n this.layoutManager.beginVirtualSizedContainerAdding();\n try {\n this.updateNodeSize();\n this.updateContentItemsSize(force);\n } finally {\n this.layoutManager.endVirtualSizedContainerAdding();\n }\n }\n\n /** @internal */\n override init(): void {\n if (this.isInitialised === true) return;\n\n this.updateNodeSize();\n\n for (let i = 0; i < this.contentItems.length; i++) {\n this._childElementContainer.appendChild(this.contentItems[i].element);\n }\n\n super.init();\n\n const contentItems = this.contentItems;\n const contentItemCount = contentItems.length;\n if (contentItemCount > 0) { // contentItemCount will be 0 on drag drop\n if (this._initialActiveItemIndex < 0 || this._initialActiveItemIndex >= contentItemCount) {\n throw new Error(`ActiveItemIndex out of range: ${this._initialActiveItemIndex} id: ${this.id}`);\n } else {\n for (let i = 0; i < contentItemCount; i++) {\n const contentItem = contentItems[i];\n if (!(contentItem instanceof ComponentItem)) {\n throw new Error(`Stack Content Item is not of type ComponentItem: ${i} id: ${this.id}`);\n } else {\n this._header.createTab(contentItem, i);\n contentItem.hide();\n contentItem.container.setBaseLogicalZIndex();\n }\n }\n\n this.setActiveComponentItem(contentItems[this._initialActiveItemIndex] as ComponentItem, false);\n\n this._header.updateTabSizes();\n }\n }\n\n this._header.updateClosability();\n this.initContentItems();\n }\n\n /** @deprecated Use {@link (Stack:class).setActiveComponentItem} */\n setActiveContentItem(item: ContentItem): void {\n if (!ContentItem.isComponentItem(item)) {\n throw new Error('Stack.setActiveContentItem: item is not a ComponentItem');\n } else {\n this.setActiveComponentItem(item, false);\n }\n }\n\n setActiveComponentItem(componentItem: ComponentItem, focus: boolean, suppressFocusEvent = false): void {\n if (this._activeComponentItem !== componentItem) {\n if (this.contentItems.indexOf(componentItem) === -1) {\n throw new Error('componentItem is not a child of this stack');\n } else {\n this.layoutManager.beginSizeInvalidation();\n try {\n if (this._activeComponentItem !== undefined) {\n this._activeComponentItem.hide();\n }\n this._activeComponentItem = componentItem;\n this._header.processActiveComponentChanged(componentItem);\n componentItem.show();\n } finally {\n this.layoutManager.endSizeInvalidation();\n }\n\n this.emit('activeContentItemChanged', componentItem);\n this.layoutManager.emit('activeContentItemChanged', componentItem);\n this.emitStateChangedEvent();\n }\n }\n\n if (this.focused || focus) {\n this.layoutManager.setFocusedComponentItem(componentItem, suppressFocusEvent);\n }\n }\n\n /** @deprecated Use {@link (Stack:class).getActiveComponentItem} */\n getActiveContentItem(): ContentItem | null {\n return this.getActiveComponentItem() ?? null;\n }\n\n getActiveComponentItem(): ComponentItem | undefined {\n return this._activeComponentItem;\n }\n\n /** @internal */\n focusActiveContentItem(): void {\n this._activeComponentItem?.focus();\n }\n\n /** @internal */\n override setFocusedValue(value: boolean): void {\n this._header.applyFocusedValue(value);\n super.setFocusedValue(value);\n }\n\n /** @internal */\n setRowColumnClosable(value: boolean): void {\n this._header.setRowColumnClosable(value);\n }\n\n newComponent(componentType: JsonValue, componentState?: JsonValue, title?: string, index?: number): ComponentItem {\n const itemConfig: ComponentItemConfig = {\n type: 'component',\n componentType,\n componentState,\n title,\n };\n return this.newItem(itemConfig, index) as ComponentItem;\n }\n\n addComponent(componentType: JsonValue, componentState?: JsonValue, title?: string, index?: number): number {\n const itemConfig: ComponentItemConfig = {\n type: 'component',\n componentType,\n componentState,\n title,\n };\n return this.addItem(itemConfig, index);\n }\n\n newItem(itemConfig: ComponentItemConfig, index?: number): ContentItem {\n index = this.addItem(itemConfig, index);\n return this.contentItems[index];\n }\n\n addItem(itemConfig: ComponentItemConfig, index?: number): number {\n this.layoutManager.checkMinimiseMaximisedStack();\n\n const resolvedItemConfig = ItemConfig.resolve(itemConfig, false);\n const contentItem = this.layoutManager.createAndInitContentItem(resolvedItemConfig, this);\n return this.addChild(contentItem, index);\n }\n\n override addChild(contentItem: ContentItem, index?: number, focus = false): number {\n if(index !== undefined && index > this.contentItems.length){\n index -= 1;\n throw new AssertError('SAC99728'); // undisplayChild() removed so this condition should no longer occur\n }\n\n if (!(contentItem instanceof ComponentItem)) {\n throw new AssertError('SACC88532'); // Stacks can only have Component children\n } else {\n index = super.addChild(contentItem, index);\n this._childElementContainer.appendChild(contentItem.element);\n this._header.createTab(contentItem, index);\n this.setActiveComponentItem(contentItem, focus);\n this._header.updateTabSizes();\n this.updateSize(false);\n contentItem.container.setBaseLogicalZIndex();\n this._header.updateClosability();\n this.emitStateChangedEvent();\n return index;\n }\n }\n\n override removeChild(contentItem: ContentItem, keepChild: boolean): void {\n const componentItem = contentItem as ComponentItem;\n const index = this.contentItems.indexOf(componentItem);\n const stackWillBeDeleted = this.contentItems.length === 1;\n\n if (this._activeComponentItem === componentItem) {\n if (componentItem.focused) {\n componentItem.blur();\n }\n if (!stackWillBeDeleted) {\n // At this point we're already sure we have at least one content item left *after*\n // removing contentItem, so we can safely assume index 1 is a valid one if\n // the index of contentItem is 0, otherwise we just use the previous content item.\n const newActiveComponentIdx = index === 0 ? 1 : index - 1;\n this.setActiveComponentItem(this.contentItems[newActiveComponentIdx] as ComponentItem, false);\n }\n }\n\n this._header.removeTab(componentItem);\n\n super.removeChild(componentItem, keepChild);\n\n if (!stackWillBeDeleted) {\n this._header.updateClosability();\n }\n\n this.emitStateChangedEvent();\n }\n\n /**\n * Maximises the Item or minimises it if it is already maximised\n */\n toggleMaximise(): void {\n if (this.isMaximised) {\n this.minimise();\n } else {\n this.maximise();\n }\n }\n\n maximise(): void {\n if (!this.isMaximised) {\n this.layoutManager.setMaximisedStack(this);\n const contentItems = this.contentItems;\n const contentItemCount = contentItems.length;\n for (let i = 0; i < contentItemCount; i++) {\n const contentItem = contentItems[i];\n if (contentItem instanceof ComponentItem) {\n contentItem.enterStackMaximised();\n } else {\n throw new AssertError('SMAXI87773');\n }\n }\n this.emitStateChangedEvent();\n }\n }\n\n minimise(): void {\n if (this.isMaximised) {\n this.layoutManager.setMaximisedStack(undefined);\n const contentItems = this.contentItems;\n const contentItemCount = contentItems.length;\n for (let i = 0; i < contentItemCount; i++) {\n const contentItem = contentItems[i];\n if (contentItem instanceof ComponentItem) {\n contentItem.exitStackMaximised();\n } else {\n throw new AssertError('SMINI87773');\n }\n }\n this.emitStateChangedEvent();\n }\n }\n\n /** @internal */\n override destroy(): void {\n if (this._activeComponentItem?.focused) {\n this._activeComponentItem.blur();\n }\n super.destroy();\n this.off('resize', this._resizeListener);\n if (this._maximisedEnabled) {\n this.off('maximised', this._maximisedListener);\n this.off('minimised', this._minimisedListener);\n }\n this._header.destroy();\n }\n\n toConfig(): ResolvedStackItemConfig {\n let activeItemIndex: number | undefined;\n if (this._activeComponentItem) {\n activeItemIndex = this.contentItems.indexOf(this._activeComponentItem);\n if (activeItemIndex < 0) {\n throw new Error('active component item not found in stack');\n }\n }\n if (this.contentItems.length > 0 && activeItemIndex === undefined) {\n throw new Error('expected non-empty stack to have an active component item');\n } else {\n const result: ResolvedStackItemConfig = {\n type: 'stack',\n content: this.calculateConfigContent() as ResolvedComponentItemConfig[],\n size: this.size,\n sizeUnit: this.sizeUnit,\n minSize: this.minSize,\n minSizeUnit: this.minSizeUnit,\n id: this.id,\n isClosable: this.isClosable,\n maximised: this.isMaximised,\n header: this.createHeaderConfig(),\n activeItemIndex,\n }\n return result;\n }\n }\n\n /**\n * Ok, this one is going to be the tricky one: The user has dropped a {@link (ContentItem:class)} onto this stack.\n *\n * It was dropped on either the stacks header or the top, right, bottom or left bit of the content area\n * (which one of those is stored in this._dropSegment). Now, if the user has dropped on the header the case\n * is relatively clear: We add the item to the existing stack... job done (might be good to have\n * tab reordering at some point, but lets not sweat it right now)\n *\n * If the item was dropped on the content part things are a bit more complicated. If it was dropped on either the\n * top or bottom region we need to create a new column and place the items accordingly.\n * Unless, of course if the stack is already within a column... in which case we want\n * to add the newly created item to the existing column...\n * either prepend or append it, depending on wether its top or bottom.\n *\n * Same thing for rows and left / right drop segments... so in total there are 9 things that can potentially happen\n * (left, top, right, bottom) * is child of the right parent (row, column) + header drop\n *\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n override onDrop(contentItem: ContentItem, area: ContentItem.Area): void {\n /*\n * The item was dropped on the header area. Just add it as a child of this stack and\n * get the hell out of this logic\n */\n if (this._dropSegment === Stack.Segment.Header) {\n this.resetHeaderDropZone();\n if (this._dropIndex === undefined) {\n throw new UnexpectedUndefinedError('SODDI68990');\n } else {\n this.addChild(contentItem, this._dropIndex);\n return;\n }\n }\n\n /*\n * The stack is empty. Let's just add the element.\n */\n if (this._dropSegment === Stack.Segment.Body) {\n this.addChild(contentItem, 0, true);\n return;\n }\n\n /*\n * The item was dropped on the top-, left-, bottom- or right- part of the content. Let's\n * aggregate some conditions to make the if statements later on more readable\n */\n const isVertical = this._dropSegment === Stack.Segment.Top || this._dropSegment === Stack.Segment.Bottom;\n const isHorizontal = this._dropSegment === Stack.Segment.Left || this._dropSegment === Stack.Segment.Right;\n const insertBefore = this._dropSegment === Stack.Segment.Top || this._dropSegment === Stack.Segment.Left;\n const hasCorrectParent = (isVertical && this.stackParent.isColumn) || (isHorizontal && this.stackParent.isRow);\n\n /*\n * The content item can be either a component or a stack. If it is a component, wrap it into a stack\n */\n if (contentItem.isComponent) {\n const itemConfig = ResolvedStackItemConfig.createDefault();\n itemConfig.header = this.createHeaderConfig();\n const stack = this.layoutManager.createAndInitContentItem(itemConfig, this);\n stack.addChild(contentItem);\n contentItem = stack;\n }\n\n\n /*\n * If the contentItem that's being dropped is not dropped on a Stack (cases which just passed above and\n * which would wrap the contentItem in a Stack) we need to check whether contentItem is a RowOrColumn.\n * If it is, we need to re-wrap it in a Stack like it was when it was dragged by its Tab (it was dragged!).\n */\n if(contentItem.type === ItemType.row || contentItem.type === ItemType.column){\n const itemConfig = ResolvedStackItemConfig.createDefault();\n itemConfig.header = this.createHeaderConfig();\n const stack = this.layoutManager.createContentItem(itemConfig, this);\n stack.addChild(contentItem)\n contentItem = stack\n }\n\n /*\n * If the item is dropped on top or bottom of a column or left and right of a row, it's already\n * layd out in the correct way. Just add it as a child\n */\n if (hasCorrectParent) {\n const index = this.stackParent.contentItems.indexOf(this);\n this.stackParent.addChild(contentItem, insertBefore ? index : index + 1, true);\n this.size *= 0.5;\n contentItem.size = this.size;\n contentItem.sizeUnit = this.sizeUnit;\n this.stackParent.updateSize(false);\n /*\n * This handles items that are dropped on top or bottom of a row or left / right of a column. We need\n * to create the appropriate contentItem for them to live in\n */\n } else {\n const type = isVertical ? ItemType.column : ItemType.row;\n const itemConfig = ResolvedItemConfig.createDefault(type) as ResolvedItemConfig;\n const rowOrColumn = this.layoutManager.createContentItem(itemConfig, this);\n this.stackParent.replaceChild(this, rowOrColumn);\n\n rowOrColumn.addChild(contentItem, insertBefore ? 0 : undefined, true);\n rowOrColumn.addChild(this, insertBefore ? undefined : 0, true);\n\n this.size = 50;\n contentItem.size = 50;\n contentItem.sizeUnit = SizeUnitEnum.Percent;\n rowOrColumn.updateSize(false);\n }\n }\n\n /**\n * If the user hovers above the header part of the stack, indicate drop positions for tabs.\n * otherwise indicate which segment of the body the dragged item would be dropped on\n *\n * @param x - Absolute Screen X\n * @param y - Absolute Screen Y\n * @internal\n */\n override highlightDropZone(x: number, y: number): void {\n for (const key in this._contentAreaDimensions) {\n const segment = key as Stack.Segment;\n const area = this._contentAreaDimensions[segment].hoverArea;\n\n if (area.x1 < x && area.x2 > x && area.y1 < y && area.y2 > y) {\n\n if (segment === Stack.Segment.Header) {\n this._dropSegment = Stack.Segment.Header;\n this.highlightHeaderDropZone(this._header.leftRightSided ? y : x);\n } else {\n this.resetHeaderDropZone();\n this.highlightBodyDropZone(segment);\n }\n\n return;\n }\n }\n }\n\n /** @internal */\n getArea(): ContentItem.Area | null {\n if (this.element.style.display === 'none') {\n return null;\n }\n\n const headerArea = super.getElementArea(this._header.element);\n const contentArea = super.getElementArea(this._childElementContainer);\n if (headerArea === null || contentArea === null) {\n throw new UnexpectedNullError('SGAHC13086');\n }\n const contentWidth = contentArea.x2 - contentArea.x1;\n const contentHeight = contentArea.y2 - contentArea.y1;\n\n this._contentAreaDimensions = {\n header: {\n hoverArea: {\n x1: headerArea.x1,\n y1: headerArea.y1,\n x2: headerArea.x2,\n y2: headerArea.y2\n },\n highlightArea: {\n x1: headerArea.x1,\n y1: headerArea.y1,\n x2: headerArea.x2,\n y2: headerArea.y2\n }\n }\n };\n\n /**\n * Highlight the entire body if the stack is empty\n */\n if (this.contentItems.length === 0) {\n\n this._contentAreaDimensions.body = {\n hoverArea: {\n x1: contentArea.x1,\n y1: contentArea.y1,\n x2: contentArea.x2,\n y2: contentArea.y2\n },\n highlightArea: {\n x1: contentArea.x1,\n y1: contentArea.y1,\n x2: contentArea.x2,\n y2: contentArea.y2\n }\n };\n\n return super.getElementArea(this.element);\n } else {\n this._contentAreaDimensions.left = {\n hoverArea: {\n x1: contentArea.x1,\n y1: contentArea.y1,\n x2: contentArea.x1 + contentWidth * 0.25,\n y2: contentArea.y2\n },\n highlightArea: {\n x1: contentArea.x1,\n y1: contentArea.y1,\n x2: contentArea.x1 + contentWidth * 0.5,\n y2: contentArea.y2\n }\n };\n\n this._contentAreaDimensions.top = {\n hoverArea: {\n x1: contentArea.x1 + contentWidth * 0.25,\n y1: contentArea.y1,\n x2: contentArea.x1 + contentWidth * 0.75,\n y2: contentArea.y1 + contentHeight * 0.5\n },\n highlightArea: {\n x1: contentArea.x1,\n y1: contentArea.y1,\n x2: contentArea.x2,\n y2: contentArea.y1 + contentHeight * 0.5\n }\n };\n\n this._contentAreaDimensions.right = {\n hoverArea: {\n x1: contentArea.x1 + contentWidth * 0.75,\n y1: contentArea.y1,\n x2: contentArea.x2,\n y2: contentArea.y2\n },\n highlightArea: {\n x1: contentArea.x1 + contentWidth * 0.5,\n y1: contentArea.y1,\n x2: contentArea.x2,\n y2: contentArea.y2\n }\n };\n\n this._contentAreaDimensions.bottom = {\n hoverArea: {\n x1: contentArea.x1 + contentWidth * 0.25,\n y1: contentArea.y1 + contentHeight * 0.5,\n x2: contentArea.x1 + contentWidth * 0.75,\n y2: contentArea.y2\n },\n highlightArea: {\n x1: contentArea.x1,\n y1: contentArea.y1 + contentHeight * 0.5,\n x2: contentArea.x2,\n y2: contentArea.y2\n }\n };\n\n return super.getElementArea(this.element);\n }\n }\n\n /**\n * Programmatically operate with header position.\n *\n * @param position -\n *\n * @returns previous header position\n * @internal\n */\n positionHeader(position: Side): void {\n if (this._header.side !== position) {\n this._header.setSide(position);\n this._headerSideChanged = true;\n this.setupHeaderPosition();\n }\n }\n\n /** @internal */\n private updateNodeSize(): void {\n if (this.element.style.display !== 'none') {\n const content: WidthAndHeight = getElementWidthAndHeight(this.element);\n\n if (this._header.show) {\n const dimension = this._header.leftRightSided ? WidthOrHeightPropertyName.width : WidthOrHeightPropertyName.height;\n content[dimension] -= this.layoutManager.layoutConfig.dimensions.headerHeight;\n }\n this._childElementContainer.style.width = numberToPixels(content.width);\n this._childElementContainer.style.height = numberToPixels(content.height);\n for (let i = 0; i < this.contentItems.length; i++) {\n this.contentItems[i].element.style.width = numberToPixels(content.width);\n this.contentItems[i].element.style.height = numberToPixels(content.height);\n }\n this.emit('resize');\n this.emitStateChangedEvent();\n }\n }\n\n /** @internal */\n private highlightHeaderDropZone(x: number): void {\n const visibleTabsLength = this._header.lastVisibleTabIndex + 1;\n const tabsContainerElement = this._header.tabsContainerElement;\n const tabsContainerElementChildNodes = tabsContainerElement.childNodes;\n\n // Create shallow copy of childNodes list, excluding DropPlaceHolder, as we will be modifying the childNodes list\n const visibleTabElements = new Array(visibleTabsLength);\n let tabIndex = 0;\n let tabCount = 0;\n while (tabCount < visibleTabsLength) {\n const visibleTabElement = tabsContainerElementChildNodes[tabIndex++] as HTMLElement;\n if (visibleTabElement !== this.layoutManager.tabDropPlaceholder) {\n visibleTabElements[tabCount++] = visibleTabElement;\n }\n }\n\n const dropTargetIndicator = this.layoutManager.dropTargetIndicator;\n if (dropTargetIndicator === null) {\n throw new UnexpectedNullError('SHHDZDTI97110');\n }\n\n let area: AreaLinkedRect;\n\n // Empty stack\n if (visibleTabsLength === 0) {\n const headerRect = this._header.element.getBoundingClientRect();\n const headerTop = headerRect.top + document.body.scrollTop;\n const headerLeft = headerRect.left + document.body.scrollLeft;\n\n area = {\n x1: headerLeft,\n x2: headerLeft + 100,\n y1: headerTop + headerRect.height - 20,\n y2: headerTop + headerRect.height,\n };\n\n this._dropIndex = 0;\n } else {\n let tabIndex = 0;\n // This indicates whether our cursor is exactly over a tab\n let isAboveTab = false;\n let tabTop: number;\n let tabLeft: number;\n let tabWidth: number;\n let tabElement: HTMLElement;\n do {\n tabElement = visibleTabElements[tabIndex] as HTMLElement;\n const tabRect = tabElement.getBoundingClientRect();\n const tabRectTop = tabRect.top + document.body.scrollTop;\n const tabRectLeft = tabRect.left + document.body.scrollLeft;\n\n if (this._header.leftRightSided) {\n tabLeft = tabRectTop;\n tabTop = tabRectLeft;\n tabWidth = tabRect.height;\n } else {\n tabLeft = tabRectLeft;\n tabTop = tabRectTop;\n tabWidth = tabRect.width;\n }\n\n if (x >= tabLeft && x < tabLeft + tabWidth) {\n isAboveTab = true;\n } else {\n tabIndex++;\n }\n } while (tabIndex < visibleTabsLength && !isAboveTab);\n\n // If we're not above any tabs, or to the right of any tab, we are out of the area, so give up\n if (isAboveTab === false && x < tabLeft) {\n return;\n }\n\n const halfX = tabLeft + tabWidth / 2;\n\n if (x < halfX) {\n this._dropIndex = tabIndex;\n tabElement.insertAdjacentElement('beforebegin', this.layoutManager.tabDropPlaceholder);\n } else {\n this._dropIndex = Math.min(tabIndex + 1, visibleTabsLength);\n tabElement.insertAdjacentElement('afterend', this.layoutManager.tabDropPlaceholder);\n }\n\n const tabDropPlaceholderRect = this.layoutManager.tabDropPlaceholder.getBoundingClientRect();\n const tabDropPlaceholderRectTop = tabDropPlaceholderRect.top + document.body.scrollTop;\n const tabDropPlaceholderRectLeft = tabDropPlaceholderRect.left + document.body.scrollLeft;\n const tabDropPlaceholderRectWidth = tabDropPlaceholderRect.width;\n\n if (this._header.leftRightSided) {\n const placeHolderTop = tabDropPlaceholderRectTop;\n area = {\n x1: tabTop,\n x2: tabTop + tabElement.clientHeight,\n y1: placeHolderTop,\n y2: placeHolderTop + tabDropPlaceholderRectWidth,\n };\n } else {\n const placeHolderLeft = tabDropPlaceholderRectLeft;\n\n area = {\n x1: placeHolderLeft,\n x2: placeHolderLeft + tabDropPlaceholderRectWidth,\n y1: tabTop,\n y2: tabTop + tabElement.clientHeight,\n };\n }\n }\n\n dropTargetIndicator.highlightArea(area, 0);\n return;\n }\n\n /** @internal */\n private resetHeaderDropZone() {\n this.layoutManager.tabDropPlaceholder.remove();\n }\n\n /** @internal */\n private setupHeaderPosition() {\n setElementDisplayVisibility(this._header.element, this._header.show);\n this.element.classList.remove(DomConstants.ClassName.Left, DomConstants.ClassName.Right, DomConstants.ClassName.Bottom);\n if (this._header.leftRightSided) {\n this.element.classList.add('lm_' + this._header.side);\n }\n\n //if ([Side.right, Side.bottom].includes(this._header.side)) {\n // // move the header behind the content.\n // this.element.appendChild(this._header.element);\n //}\n this.updateSize(false);\n }\n\n /** @internal */\n private highlightBodyDropZone(segment: Stack.Segment): void {\n if (this._contentAreaDimensions === undefined) {\n throw new UnexpectedUndefinedError('SHBDZC82265');\n } else {\n const highlightArea = this._contentAreaDimensions[segment].highlightArea;\n const dropTargetIndicator = this.layoutManager.dropTargetIndicator;\n if (dropTargetIndicator === null) {\n throw new UnexpectedNullError('SHBDZD96110');\n } else {\n dropTargetIndicator.highlightArea(highlightArea, 1);\n this._dropSegment = segment;\n }\n }\n }\n\n /** @internal */\n private handleResize() {\n this._header.updateTabSizes()\n }\n\n /** @internal */\n private handleMaximised() {\n this._header.processMaximised();\n }\n\n /** @internal */\n private handleMinimised() {\n this._header.processMinimised();\n }\n\n /** @internal */\n private handlePopoutEvent() {\n this.popout();\n }\n\n /** @internal */\n private handleHeaderClickEvent(ev: MouseEvent) {\n const eventName = EventEmitter.headerClickEventName;\n const bubblingEvent = new EventEmitter.ClickBubblingEvent(eventName, this, ev);\n this.emit(eventName, bubblingEvent);\n }\n\n /** @internal */\n private handleHeaderTouchStartEvent(ev: TouchEvent) {\n const eventName = EventEmitter.headerTouchStartEventName;\n const bubblingEvent = new EventEmitter.TouchStartBubblingEvent(eventName, this, ev);\n this.emit(eventName, bubblingEvent);\n }\n\n /** @internal */\n private handleHeaderComponentRemoveEvent(item: ComponentItem) {\n this.removeChild(item, false);\n }\n\n /** @internal */\n private handleHeaderComponentFocusEvent(item: ComponentItem) {\n this.setActiveComponentItem(item, true);\n }\n\n /** @internal */\n private handleHeaderComponentStartDragEvent(x: number, y: number, dragListener: DragListener, componentItem: ComponentItem) {\n if (this.isMaximised === true) {\n this.toggleMaximise();\n }\n this.layoutManager.startComponentDrag(x, y, dragListener, componentItem, this);\n }\n\n /** @internal */\n private createHeaderConfig() {\n if (!this._headerSideChanged) {\n return ResolvedHeaderedItemConfig.Header.createCopy(this._headerConfig);\n } else {\n const show = this._header.show ? this._header.side : false;\n\n let result = ResolvedHeaderedItemConfig.Header.createCopy(this._headerConfig, show);\n if (result === undefined) {\n result = {\n show,\n popout: undefined,\n maximise: undefined,\n close: undefined,\n minimise: undefined,\n tabDropdown: undefined,\n };\n }\n return result;\n }\n }\n\n /** @internal */\n private emitStateChangedEvent() {\n this.emitBaseBubblingEvent('stateChanged');\n }\n}\n\n/** @public */\nexport namespace Stack {\n /** @internal */\n export const enum Segment {\n Header = 'header',\n Body = 'body',\n Left = 'left',\n Right = 'right',\n Top = 'top',\n Bottom = 'bottom',\n }\n\n /** @internal */\n export interface ContentAreaDimension {\n hoverArea: AreaLinkedRect;\n highlightArea: AreaLinkedRect;\n }\n\n /** @internal */\n export type ContentAreaDimensions = {\n [segment: string]: ContentAreaDimension;\n };\n\n /** @internal */\n export function createElement(document: Document): HTMLDivElement {\n const element = document.createElement('div');\n element.classList.add(DomConstants.ClassName.Item);\n element.classList.add(DomConstants.ClassName.Stack);\n return element;\n }\n}\n","import { UnexpectedNullError, UnexpectedUndefinedError } from '../errors/internal-error';\nimport { ComponentItem } from '../items/component-item';\nimport { ContentItem } from '../items/content-item';\nimport { Stack } from '../items/stack';\nimport { LayoutManager } from '../layout-manager';\nimport { DomConstants } from '../utils/dom-constants';\nimport { DragListener } from '../utils/drag-listener';\nimport { EventEmitter } from '../utils/event-emitter';\nimport { Side } from '../utils/types';\nimport {\n numberToPixels\n} from '../utils/utils';\n\n/**\n * This class creates a temporary container\n * for the component whilst it is being dragged\n * and handles drag events\n * @internal\n */\nexport class DragProxy extends EventEmitter {\n private _area: ContentItem.Area | null = null;\n private _lastValidArea: ContentItem.Area | null = null;\n private _minX: number;\n private _minY: number;\n private _maxX: number;\n private _maxY: number;\n private _sided: boolean;\n private _element: HTMLElement;\n private _proxyContainerElement: HTMLElement;\n private _componentItemFocused: boolean;\n\n get element(): HTMLElement { return this._element; }\n\n /**\n * @param x - The initial x position\n * @param y - The initial y position\n * @internal\n */\n constructor(x: number, y: number,\n private readonly _dragListener: DragListener,\n private readonly _layoutManager: LayoutManager,\n private readonly _componentItem: ComponentItem,\n private readonly _originalParent: ContentItem) {\n\n super();\n\n this._dragListener.on('drag', (offsetX, offsetY, event) => this.onDrag(offsetX, offsetY, event));\n this._dragListener.on('dragStop', () => this.onDrop());\n\n this.createDragProxyElements(x, y);\n\n if (this._componentItem.parent === null) {\n // Note that _contentItem will have dummy GroundItem as parent if initiated by a external drag source\n throw new UnexpectedNullError('DPC10097');\n }\n\n this._componentItemFocused = this._componentItem.focused;\n if (this._componentItemFocused) {\n this._componentItem.blur();\n }\n this._componentItem.parent.removeChild(this._componentItem, true);\n\n this.setDimensions();\n\n document.body.appendChild(this._element);\n\n this.determineMinMaxXY();\n this._layoutManager.calculateItemAreas();\n this.setDropPosition(x, y);\n }\n\n /** Create Stack-like structure to contain the dragged component */\n private createDragProxyElements(initialX: number, initialY: number): void {\n this._element = document.createElement('div');\n this._element.classList.add(DomConstants.ClassName.DragProxy);\n const headerElement = document.createElement('div');\n headerElement.classList.add(DomConstants.ClassName.Header);\n const tabsElement = document.createElement('div');\n tabsElement.classList.add(DomConstants.ClassName.Tabs);\n const tabElement = document.createElement('div');\n tabElement.classList.add(DomConstants.ClassName.Tab);\n const titleElement = document.createElement('span');\n titleElement.classList.add(DomConstants.ClassName.Title);\n tabElement.appendChild(titleElement);\n tabsElement.appendChild(tabElement);\n headerElement.appendChild(tabsElement);\n\n this._proxyContainerElement = document.createElement('div');\n this._proxyContainerElement.classList.add(DomConstants.ClassName.Content);\n\n this._element.appendChild(headerElement);\n this._element.appendChild(this._proxyContainerElement);\n\n if (this._originalParent instanceof Stack && this._originalParent.headerShow) {\n this._sided = this._originalParent.headerLeftRightSided;\n this._element.classList.add('lm_' + this._originalParent.headerSide);\n if ([Side.right, Side.bottom].indexOf(this._originalParent.headerSide) >= 0) {\n this._proxyContainerElement.insertAdjacentElement('afterend', headerElement);\n }\n }\n this._element.style.left = numberToPixels(initialX);\n this._element.style.top = numberToPixels(initialY);\n tabElement.setAttribute('title', this._componentItem.title);\n titleElement.insertAdjacentText('afterbegin', this._componentItem.title);\n this._proxyContainerElement.appendChild(this._componentItem.element);\n }\n\n private determineMinMaxXY(): void {\n const groundItem = this._layoutManager.groundItem;\n if (groundItem === undefined) {\n throw new UnexpectedUndefinedError('DPDMMXY73109');\n } else {\n const groundElement = groundItem.element;\n const rect = groundElement.getBoundingClientRect();\n this._minX = rect.left + document.body.scrollLeft;\n this._minY = rect.top + document.body.scrollTop;\n this._maxX = this._minX + rect.width;\n this._maxY = this._minY + rect.height;\n }\n }\n\n /**\n * Callback on every mouseMove event during a drag. Determines if the drag is\n * still within the valid drag area and calls the layoutManager to highlight the\n * current drop area\n *\n * @param offsetX - The difference from the original x position in px\n * @param offsetY - The difference from the original y position in px\n * @param event -\n * @internal\n */\n private onDrag(offsetX: number, offsetY: number, event: PointerEvent) {\n\n const x = event.pageX;\n const y = event.pageY;\n\n this.setDropPosition(x, y);\n this._componentItem.drag();\n }\n\n /**\n * Sets the target position, highlighting the appropriate area\n *\n * @param x - The x position in px\n * @param y - The y position in px\n *\n * @internal\n */\n private setDropPosition(x: number, y: number): void {\n if (this._layoutManager.layoutConfig.settings.constrainDragToContainer) {\n if (x <= this._minX) {\n x = Math.ceil(this._minX);\n } else if (x >= this._maxX) {\n x = Math.floor(this._maxX);\n }\n\n if (y <= this._minY) {\n y = Math.ceil(this._minY);\n } else if (y >= this._maxY) {\n y = Math.floor(this._maxY);\n }\n }\n\n this._element.style.left = numberToPixels(x);\n this._element.style.top = numberToPixels(y);\n this._area = this._layoutManager.getArea(x, y);\n\n if (this._area !== null) {\n this._lastValidArea = this._area;\n this._area.contentItem.highlightDropZone(x, y, this._area);\n }\n }\n\n /**\n * Callback when the drag has finished. Determines the drop area\n * and adds the child to it\n * @internal\n */\n private onDrop(): void {\n const dropTargetIndicator = this._layoutManager.dropTargetIndicator;\n if (dropTargetIndicator === null) {\n throw new UnexpectedNullError('DPOD30011');\n } else {\n dropTargetIndicator.hide();\n }\n\n this._componentItem.exitDragMode();\n\n /*\n * Valid drop area found\n */\n let droppedComponentItem: ComponentItem | undefined;\n if (this._area !== null) {\n droppedComponentItem = this._componentItem;\n this._area.contentItem.onDrop(droppedComponentItem, this._area);\n\n /**\n * No valid drop area available at present, but one has been found before.\n * Use it\n */\n } else if (this._lastValidArea !== null) {\n droppedComponentItem = this._componentItem;\n const newParentContentItem = this._lastValidArea.contentItem;\n newParentContentItem.onDrop(droppedComponentItem, this._lastValidArea);\n\n /**\n * No valid drop area found during the duration of the drag. Return\n * content item to its original position if a original parent is provided.\n * (Which is not the case if the drag had been initiated by createDragSource)\n */\n } else if (this._originalParent) {\n droppedComponentItem = this._componentItem;\n this._originalParent.addChild(droppedComponentItem);\n\n /**\n * The drag didn't ultimately end up with adding the content item to\n * any container. In order to ensure clean up happens, destroy the\n * content item.\n */\n } else {\n this._componentItem.destroy(); // contentItem children are now destroyed as well\n }\n\n this._element.remove();\n\n this._layoutManager.emit('itemDropped', this._componentItem);\n\n if (this._componentItemFocused && droppedComponentItem !== undefined) {\n droppedComponentItem.focus();\n }\n }\n\n /**\n * Updates the Drag Proxy's dimensions\n * @internal\n */\n private setDimensions() {\n const dimensions = this._layoutManager.layoutConfig.dimensions;\n if (dimensions === undefined) {\n throw new Error('DragProxy.setDimensions: dimensions undefined');\n }\n\n let width = dimensions.dragProxyWidth;\n let height = dimensions.dragProxyHeight;\n if (width === undefined || height === undefined) {\n throw new Error('DragProxy.setDimensions: width and/or height undefined');\n }\n\n const headerHeight = this._layoutManager.layoutConfig.header.show === false ? 0 : dimensions.headerHeight;\n this._element.style.width = numberToPixels(width);\n this._element.style.height = numberToPixels(height)\n width -= (this._sided ? headerHeight : 0);\n height -= (!this._sided ? headerHeight : 0);\n this._proxyContainerElement.style.width = numberToPixels(width);\n this._proxyContainerElement.style.height = numberToPixels(height);\n this._componentItem.enterDragMode(width, height);\n this._componentItem.show();\n }\n}\n","import { DomConstants } from '../utils/dom-constants';\nimport { DragListener } from '../utils/drag-listener';\nimport { EventEmitter } from '../utils/event-emitter';\nimport { numberToPixels } from '../utils/utils';\n\n/** @internal */\nexport class Splitter {\n private _grabSize;\n private _dragListener: DragListener;\n\n private readonly _element: HTMLDivElement;\n\n get element(): HTMLDivElement { return this._element; }\n\n constructor(private _isVertical: boolean, private _size: number, grabSize: number) {\n this._grabSize = grabSize < this._size ? this._size : grabSize;\n\n this._element = document.createElement('div');\n this._element.classList.add(DomConstants.ClassName.Splitter);\n const dragHandleElement = document.createElement('div');\n dragHandleElement.classList.add(DomConstants.ClassName.DragHandle);\n\n const handleExcessSize = this._grabSize - this._size;\n const handleExcessPos = handleExcessSize / 2;\n\n if (this._isVertical) {\n dragHandleElement.style.top = numberToPixels(-handleExcessPos);\n dragHandleElement.style.height = numberToPixels(this._size + handleExcessSize);\n this._element.classList.add(DomConstants.ClassName.Vertical);\n this._element.style.height = numberToPixels(this._size);\n } else {\n dragHandleElement.style.left = numberToPixels(-handleExcessPos);\n dragHandleElement.style.width = numberToPixels(this._size + handleExcessSize);\n this._element.classList.add(DomConstants.ClassName.Horizontal);\n this._element.style.width = numberToPixels(this._size);\n }\n\n this._element.appendChild(dragHandleElement);\n\n this._dragListener = new DragListener(this._element, [dragHandleElement]);\n }\n\n destroy(): void {\n this._element.remove();\n }\n\n on(eventName: K, callback: EventEmitter.Callback): void {\n this._dragListener.on(eventName, callback);\n }\n}\n","import { ComponentItemConfig, ItemConfig, RowOrColumnItemConfig, StackItemConfig } from '../config/config'\nimport { ResolvedRowOrColumnItemConfig, ResolvedStackItemConfig } from '../config/resolved-config'\nimport { Splitter } from '../controls/splitter'\nimport { AssertError, UnexpectedNullError } from '../errors/internal-error'\nimport { LayoutManager } from '../layout-manager'\nimport { DomConstants } from '../utils/dom-constants'\nimport { ItemType, JsonValue, SizeUnitEnum, WidthOrHeightPropertyName } from '../utils/types'\nimport {\n getElementHeight,\n getElementWidth,\n getElementWidthAndHeight,\n numberToPixels,\n pixelsToNumber,\n setElementHeight,\n setElementWidth\n} from \"../utils/utils\"\nimport { ComponentItem } from './component-item'\nimport { ContentItem } from './content-item'\n\n/** @public */\nexport class RowOrColumn extends ContentItem {\n /** @internal */\n private readonly _childElementContainer: HTMLElement;\n /** @internal */\n private readonly _configType: 'row' | 'column';\n /** @internal */\n private readonly _isColumn: boolean;\n /** @internal */\n private readonly _splitterSize: number;\n /** @internal */\n private readonly _splitterGrabSize: number;\n /** @internal */\n private readonly _dimension: WidthOrHeightPropertyName;\n /** @internal */\n private readonly _splitter: Splitter[] = [];\n /** @internal */\n private _splitterPosition: number | null;\n /** @internal */\n private _splitterMinPosition: number | null;\n /** @internal */\n private _splitterMaxPosition: number | null;\n\n /** @internal */\n constructor(isColumn: boolean, layoutManager: LayoutManager, config: ResolvedRowOrColumnItemConfig,\n /** @internal */\n private _rowOrColumnParent: ContentItem\n ) {\n super(layoutManager, config, _rowOrColumnParent, RowOrColumn.createElement(document, isColumn));\n\n this.isRow = !isColumn;\n this.isColumn = isColumn;\n\n this._childElementContainer = this.element;\n this._splitterSize = layoutManager.layoutConfig.dimensions.borderWidth;\n this._splitterGrabSize = layoutManager.layoutConfig.dimensions.borderGrabWidth;\n this._isColumn = isColumn;\n this._dimension = isColumn ? 'height' : 'width';\n this._splitterPosition = null;\n this._splitterMinPosition = null;\n this._splitterMaxPosition = null;\n\n switch (config.type) {\n case ItemType.row:\n case ItemType.column:\n this._configType = config.type;\n break;\n default:\n throw new AssertError('ROCCCT00925');\n }\n }\n\n newComponent(componentType: JsonValue, componentState?: JsonValue, title?: string, index?: number): ComponentItem {\n const itemConfig: ComponentItemConfig = {\n type: 'component',\n componentType,\n componentState,\n title,\n };\n return this.newItem(itemConfig, index) as ComponentItem;\n }\n\n addComponent(componentType: JsonValue, componentState?: JsonValue, title?: string, index?: number): number {\n const itemConfig: ComponentItemConfig = {\n type: 'component',\n componentType,\n componentState,\n title,\n };\n return this.addItem(itemConfig, index);\n }\n\n newItem(itemConfig: RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig, index?: number): ContentItem {\n index = this.addItem(itemConfig, index);\n const createdItem = this.contentItems[index];\n\n if (ContentItem.isStack(createdItem) && (ItemConfig.isComponent(itemConfig))) {\n // createdItem is a Stack which was created to hold wanted component. Return component\n return createdItem.contentItems[0];\n } else {\n return createdItem;\n }\n }\n\n addItem(itemConfig: RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig,\n index?: number\n ): number {\n this.layoutManager.checkMinimiseMaximisedStack();\n const resolvedItemConfig = ItemConfig.resolve(itemConfig, false);\n const contentItem = this.layoutManager.createAndInitContentItem(resolvedItemConfig, this);\n return this.addChild(contentItem, index, false);\n }\n\n /**\n * Add a new contentItem to the Row or Column\n *\n * @param contentItem -\n * @param index - The position of the new item within the Row or Column.\n * If no index is provided the item will be added to the end\n * @param suspendResize - If true the items won't be resized. This will leave the item in\n * an inconsistent state and is only intended to be used if multiple\n * children need to be added in one go and resize is called afterwards\n *\n * @returns\n */\n override addChild(contentItem: ContentItem, index?: number, suspendResize?: boolean): number {\n\n // contentItem = this.layoutManager._$normalizeContentItem(contentItem, this);\n\n if (index === undefined) {\n index = this.contentItems.length;\n }\n\n if (this.contentItems.length > 0) {\n const splitterElement = this.createSplitter(Math.max(0, index - 1)).element;\n\n if (index > 0) {\n this.contentItems[index - 1].element.insertAdjacentElement('afterend', splitterElement);\n splitterElement.insertAdjacentElement('afterend', contentItem.element);\n } else {\n this.contentItems[0].element.insertAdjacentElement('beforebegin', splitterElement);\n splitterElement.insertAdjacentElement('beforebegin', contentItem.element);\n }\n } else {\n this._childElementContainer.appendChild(contentItem.element);\n }\n\n super.addChild(contentItem, index);\n\n const newItemSize = (1 / this.contentItems.length) * 100;\n\n if (suspendResize === true) {\n this.emitBaseBubblingEvent('stateChanged');\n return index;\n }\n\n for (let i = 0; i < this.contentItems.length; i++) {\n const indexedContentItem = this.contentItems[i];\n if (indexedContentItem === contentItem) {\n contentItem.size = newItemSize;\n } else {\n const itemSize = indexedContentItem.size *= (100 - newItemSize) / 100;\n indexedContentItem.size = itemSize;\n }\n }\n\n this.updateSize(false);\n this.emitBaseBubblingEvent('stateChanged');\n\n return index;\n }\n\n /**\n * Removes a child of this element\n *\n * @param contentItem -\n * @param keepChild - If true the child will be removed, but not destroyed\n *\n */\n override removeChild(contentItem: ContentItem, keepChild: boolean): void {\n const index = this.contentItems.indexOf(contentItem);\n const splitterIndex = Math.max(index - 1, 0);\n\n if (index === -1) {\n throw new Error('Can\\'t remove child. ContentItem is not child of this Row or Column');\n }\n\n /**\n * Remove the splitter before the item or after if the item happens\n * to be the first in the row/column\n */\n if (this._splitter[splitterIndex]) {\n this._splitter[splitterIndex].destroy();\n this._splitter.splice(splitterIndex, 1);\n }\n\n super.removeChild(contentItem, keepChild);\n\n if (this.contentItems.length === 1 && this.isClosable === true) {\n const childItem = this.contentItems[0];\n this.contentItems.length = 0;\n this._rowOrColumnParent.replaceChild(this, childItem, true);\n } else {\n this.updateSize(false);\n this.emitBaseBubblingEvent('stateChanged');\n }\n }\n\n /**\n * Replaces a child of this Row or Column with another contentItem\n */\n override replaceChild(oldChild: ContentItem, newChild: ContentItem): void {\n const size = oldChild.size;\n super.replaceChild(oldChild, newChild);\n newChild.size = size;\n this.updateSize(false);\n this.emitBaseBubblingEvent('stateChanged');\n }\n\n /**\n * Called whenever the dimensions of this item or one of its parents change\n */\n override updateSize(force: boolean): void {\n this.layoutManager.beginVirtualSizedContainerAdding();\n try {\n this.updateNodeSize();\n this.updateContentItemsSize(force);\n } finally {\n this.layoutManager.endVirtualSizedContainerAdding();\n }\n }\n\n /**\n * Invoked recursively by the layout manager. ContentItem.init appends\n * the contentItem's DOM elements to the container, RowOrColumn init adds splitters\n * in between them\n * @internal\n */\n override init(): void {\n if (this.isInitialised === true) return;\n\n this.updateNodeSize();\n\n for (let i = 0; i < this.contentItems.length; i++) {\n this._childElementContainer.appendChild(this.contentItems[i].element);\n }\n\n super.init();\n\n for (let i = 0; i < this.contentItems.length - 1; i++) {\n this.contentItems[i].element.insertAdjacentElement('afterend', this.createSplitter(i).element);\n }\n\n this.initContentItems();\n }\n\n toConfig(): ResolvedRowOrColumnItemConfig {\n const result: ResolvedRowOrColumnItemConfig = {\n type: this.type as 'row' | 'column',\n content: this.calculateConfigContent() as (ResolvedRowOrColumnItemConfig | ResolvedStackItemConfig)[],\n size: this.size,\n sizeUnit: this.sizeUnit,\n minSize: this.minSize,\n minSizeUnit: this.minSizeUnit,\n id: this.id,\n isClosable: this.isClosable,\n }\n return result;\n }\n\n /** @internal */\n protected override setParent(parent: ContentItem): void {\n this._rowOrColumnParent = parent;\n super.setParent(parent);\n }\n\n /** @internal */\n private updateNodeSize(): void {\n if (this.contentItems.length > 0) {\n this.calculateRelativeSizes();\n this.setAbsoluteSizes();\n }\n this.emitBaseBubblingEvent('stateChanged');\n this.emit('resize');\n }\n\n /**\n * Turns the relative sizes calculated by calculateRelativeSizes into\n * absolute pixel values and applies them to the children's DOM elements\n *\n * Assigns additional pixels to counteract Math.floor\n * @internal\n */\n private setAbsoluteSizes() {\n const absoluteSizes = this.calculateAbsoluteSizes();\n\n for (let i = 0; i < this.contentItems.length; i++) {\n if (absoluteSizes.additionalPixel - i > 0) {\n absoluteSizes.itemSizes[i]++;\n }\n\n if (this._isColumn) {\n setElementWidth(this.contentItems[i].element, absoluteSizes.crossAxisSize);\n setElementHeight(this.contentItems[i].element, absoluteSizes.itemSizes[i]);\n } else {\n setElementWidth(this.contentItems[i].element, absoluteSizes.itemSizes[i]);\n setElementHeight(this.contentItems[i].element, absoluteSizes.crossAxisSize);\n }\n }\n }\n\n /**\n * Calculates the absolute sizes of all of the children of this Item.\n * @returns Set with absolute sizes and additional pixels.\n * @internal\n */\n private calculateAbsoluteSizes(): RowOrColumn.AbsoluteSizes {\n const totalSplitterSize = (this.contentItems.length - 1) * this._splitterSize;\n const { width: elementWidth, height: elementHeight } = getElementWidthAndHeight(this.element);\n\n let totalSize: number;\n let crossAxisSize: number;\n if (this._isColumn) {\n totalSize = elementHeight - totalSplitterSize;\n crossAxisSize = elementWidth;\n } else {\n totalSize = elementWidth - totalSplitterSize;\n crossAxisSize = elementHeight;\n }\n\n let totalAssigned = 0;\n const itemSizes = [];\n\n for (let i = 0; i < this.contentItems.length; i++) {\n const contentItem = this.contentItems[i];\n let itemSize: number;\n if (contentItem.sizeUnit === SizeUnitEnum.Percent) {\n itemSize = Math.floor(totalSize * (contentItem.size / 100));\n } else {\n throw new AssertError('ROCCAS6692');\n }\n\n totalAssigned += itemSize;\n itemSizes.push(itemSize);\n }\n\n const additionalPixel = Math.floor(totalSize - totalAssigned);\n\n return {\n itemSizes,\n additionalPixel,\n totalSize,\n crossAxisSize,\n };\n }\n\n /**\n * Calculates the relative sizes of all children of this Item. The logic\n * is as follows:\n *\n * - Add up the total size of all items that have a configured size\n *\n * - If the total == 100 (check for floating point errors)\n * Excellent, job done\n *\n * - If the total is \\> 100,\n * set the size of items without set dimensions to 1/3 and add this to the total\n * set the size off all items so that the total is hundred relative to their original size\n *\n * - If the total is \\< 100\n * If there are items without set dimensions, distribute the remainder to 100 evenly between them\n * If there are no items without set dimensions, increase all items sizes relative to\n * their original size so that they add up to 100\n *\n * @internal\n */\n private calculateRelativeSizes() {\n\n let total = 0;\n const itemsWithFractionalSize: ContentItem[] = [];\n let totalFractionalSize = 0;\n\n for (let i = 0; i < this.contentItems.length; i++) {\n const contentItem = this.contentItems[i];\n const sizeUnit = contentItem.sizeUnit;\n switch (sizeUnit) {\n case SizeUnitEnum.Percent: {\n total += contentItem.size;\n break;\n }\n case SizeUnitEnum.Fractional: {\n itemsWithFractionalSize.push(contentItem);\n totalFractionalSize += contentItem.size;\n break;\n }\n default:\n throw new AssertError('ROCCRS49110', JSON.stringify(contentItem));\n }\n }\n\n /**\n * Everything adds up to hundred, all good :-)\n */\n if (Math.round(total) === 100) {\n this.respectMinItemSize();\n return;\n } else {\n /**\n * Allocate the remaining size to the items with a fractional size\n */\n if (Math.round(total) < 100 && itemsWithFractionalSize.length > 0) {\n const fractionalAllocatedSize = 100 - total;\n for (let i = 0; i < itemsWithFractionalSize.length; i++) {\n const contentItem = itemsWithFractionalSize[i];\n contentItem.size = fractionalAllocatedSize * (contentItem.size / totalFractionalSize);\n contentItem.sizeUnit = SizeUnitEnum.Percent;\n }\n this.respectMinItemSize();\n return;\n } else {\n\n /**\n * If the total is > 100, but there are also items with a fractional size, assign another 50%\n * to the fractional items\n *\n * This will be reset in the next step\n */\n if (Math.round(total) > 100 && itemsWithFractionalSize.length > 0) {\n for (let i = 0; i < itemsWithFractionalSize.length; i++) {\n const contentItem = itemsWithFractionalSize[i];\n contentItem.size = 50 * (contentItem.size / totalFractionalSize);\n contentItem.sizeUnit = SizeUnitEnum.Percent;\n }\n total += 50;\n }\n\n /**\n * Set every items size relative to 100 relative to its size to total\n */\n for (let i = 0; i < this.contentItems.length; i++) {\n const contentItem = this.contentItems[i];\n contentItem.size = (contentItem.size / total) * 100;\n }\n\n this.respectMinItemSize();\n }\n }\n }\n\n /**\n * Adjusts the column widths to respect the dimensions minItemWidth if set.\n * @internal\n */\n private respectMinItemSize() {\n interface Entry {\n size: number;\n }\n\n const minItemSize = this.calculateContentItemMinSize(this);\n\n if (minItemSize <= 0 || this.contentItems.length <= 1) {\n return;\n } else {\n let totalOverMin = 0;\n let totalUnderMin = 0;\n const entriesOverMin: Entry[] = [];\n const allEntries: Entry[] = [];\n\n const absoluteSizes = this.calculateAbsoluteSizes();\n\n /**\n * Figure out how much we are under the min item size total and how much room we have to use.\n */\n for (let i = 0; i < absoluteSizes.itemSizes.length; i++) {\n const itemSize = absoluteSizes.itemSizes[i];\n\n let entry: Entry;\n if (itemSize < minItemSize) {\n totalUnderMin += minItemSize - itemSize;\n entry = {\n size: minItemSize\n };\n\n } else {\n totalOverMin += itemSize - minItemSize;\n entry = {\n size: itemSize\n };\n entriesOverMin.push(entry);\n }\n\n allEntries.push(entry);\n }\n\n /**\n * If there is nothing under min, or there is not enough over to make up the difference, do nothing.\n */\n if (totalUnderMin === 0 || totalUnderMin > totalOverMin) {\n return;\n } else {\n /**\n * Evenly reduce all columns that are over the min item width to make up the difference.\n */\n const reducePercent = totalUnderMin / totalOverMin;\n let remainingSize = totalUnderMin;\n for (let i = 0; i < entriesOverMin.length; i++) {\n const entry = entriesOverMin[i];\n const reducedSize = Math.round((entry.size - minItemSize) * reducePercent);\n remainingSize -= reducedSize;\n entry.size -= reducedSize;\n }\n\n /**\n * Take anything remaining from the last item.\n */\n if (remainingSize !== 0) {\n allEntries[allEntries.length - 1].size -= remainingSize;\n }\n\n /**\n * Set every items size relative to 100 relative to its size to total\n */\n for (let i = 0; i < this.contentItems.length; i++) {\n const contentItem = this.contentItems[i];\n contentItem.size = (allEntries[i].size / absoluteSizes.totalSize) * 100;\n }\n }\n }\n }\n\n /**\n * Instantiates a new Splitter, binds events to it and adds\n * it to the array of splitters at the position specified as the index argument\n *\n * What it doesn't do though is append the splitter to the DOM\n *\n * @param index - The position of the splitter\n *\n * @returns\n * @internal\n */\n private createSplitter(index: number): Splitter {\n const splitter = new Splitter(this._isColumn, this._splitterSize, this._splitterGrabSize);\n splitter.on('drag', (offsetX, offsetY) => this.onSplitterDrag(splitter, offsetX, offsetY));\n splitter.on('dragStop', () => this.onSplitterDragStop(splitter));\n splitter.on('dragStart', () => this.onSplitterDragStart(splitter));\n this._splitter.splice(index, 0, splitter);\n return splitter;\n }\n\n /**\n * Locates the instance of Splitter in the array of\n * registered splitters and returns a map containing the contentItem\n * before and after the splitters, both of which are affected if the\n * splitter is moved\n *\n * @returns A map of contentItems that the splitter affects\n * @internal\n */\n private getSplitItems(splitter: Splitter) {\n const index = this._splitter.indexOf(splitter);\n\n return {\n before: this.contentItems[index],\n after: this.contentItems[index + 1]\n };\n }\n\n private calculateContentItemMinSize(contentItem: ContentItem) {\n const minSize = contentItem.minSize;\n if (minSize !== undefined) {\n if (contentItem.minSizeUnit === SizeUnitEnum.Pixel) {\n return minSize;\n } else {\n throw new AssertError('ROCGMD98831', JSON.stringify(contentItem));\n }\n } else {\n const dimensions = this.layoutManager.layoutConfig.dimensions;\n return this._isColumn ? dimensions.defaultMinItemHeight : dimensions.defaultMinItemWidth;\n }\n }\n\n /**\n * Gets the minimum dimensions for the given item configuration array\n * @internal\n */\n private calculateContentItemsTotalMinSize(contentItems: readonly ContentItem[]) {\n let totalMinSize = 0;\n\n for (const contentItem of contentItems) {\n totalMinSize += this.calculateContentItemMinSize(contentItem);\n }\n\n return totalMinSize;\n }\n\n /**\n * Invoked when a splitter's dragListener fires dragStart. Calculates the splitters\n * movement area once (so that it doesn't need calculating on every mousemove event)\n * @internal\n */\n private onSplitterDragStart(splitter: Splitter) {\n const items = this.getSplitItems(splitter);\n\n const beforeWidth = pixelsToNumber(items.before.element.style[this._dimension]);\n const afterSize = pixelsToNumber(items.after.element.style[this._dimension]);\n const beforeMinSize = this.calculateContentItemsTotalMinSize(items.before.contentItems);\n const afterMinSize = this.calculateContentItemsTotalMinSize(items.after.contentItems);\n\n this._splitterPosition = 0;\n this._splitterMinPosition = -1 * (beforeWidth - beforeMinSize);\n this._splitterMaxPosition = afterSize - afterMinSize;\n }\n\n /**\n * Invoked when a splitter's DragListener fires drag. Updates the splitter's DOM position,\n * but not the sizes of the elements the splitter controls in order to minimize resize events\n *\n * @param splitter -\n * @param offsetX - Relative pixel values to the splitter's original position. Can be negative\n * @param offsetY - Relative pixel values to the splitter's original position. Can be negative\n * @internal\n */\n private onSplitterDrag(splitter: Splitter, offsetX: number, offsetY: number) {\n let offset = this._isColumn ? offsetY : offsetX;\n\n if (this._splitterMinPosition === null || this._splitterMaxPosition === null) {\n throw new UnexpectedNullError('ROCOSD59226');\n }\n offset = Math.max(offset, this._splitterMinPosition);\n offset = Math.min(offset, this._splitterMaxPosition);\n\n this._splitterPosition = offset;\n const offsetPixels = numberToPixels(offset);\n if (this._isColumn) {\n splitter.element.style.top = offsetPixels;\n } else {\n splitter.element.style.left = offsetPixels;\n }\n }\n\n /**\n * Invoked when a splitter's DragListener fires dragStop. Resets the splitters DOM position,\n * and applies the new sizes to the elements before and after the splitter and their children\n * on the next animation frame\n * @internal\n */\n private onSplitterDragStop(splitter: Splitter) {\n if (this._splitterPosition === null) {\n throw new UnexpectedNullError('ROCOSDS66932');\n } else {\n const items = this.getSplitItems(splitter);\n const sizeBefore = pixelsToNumber(items.before.element.style[this._dimension]);\n const sizeAfter = pixelsToNumber(items.after.element.style[this._dimension]);\n const splitterPositionInRange = (this._splitterPosition + sizeBefore) / (sizeBefore + sizeAfter);\n const totalRelativeSize = items.before.size + items.after.size;\n\n items.before.size = splitterPositionInRange * totalRelativeSize;\n items.after.size = (1 - splitterPositionInRange) * totalRelativeSize;\n\n splitter.element.style.top = numberToPixels(0);\n splitter.element.style.left = numberToPixels(0);\n\n globalThis.requestAnimationFrame(() => this.updateSize(false));\n }\n }\n}\n\n/** @public */\nexport namespace RowOrColumn {\n /** @internal */\n export interface AbsoluteSizes {\n itemSizes: number[],\n additionalPixel: number,\n totalSize: number,\n crossAxisSize: number\n }\n\n /** @internal */\n export function getElementDimensionSize(element: HTMLElement, dimension: WidthOrHeightPropertyName): number {\n if (dimension === 'width') {\n return getElementWidth(element);\n } else {\n return getElementHeight(element);\n }\n }\n\n /** @internal */\n export function setElementDimensionSize(element: HTMLElement, dimension: WidthOrHeightPropertyName, value: number): void {\n if (dimension === 'width') {\n return setElementWidth(element, value);\n } else {\n return setElementHeight(element, value);\n }\n }\n\n /** @internal */\n export function createElement(document: Document, isColumn: boolean): HTMLDivElement {\n const element = document.createElement('div');\n element.classList.add(DomConstants.ClassName.Item);\n if (isColumn) {\n element.classList.add(DomConstants.ClassName.Column);\n } else {\n element.classList.add(DomConstants.ClassName.Row);\n }\n return element;\n }\n}\n","import { ComponentItemConfig, ItemConfig, RowOrColumnItemConfig, StackItemConfig } from '../config/config';\nimport { ResolvedComponentItemConfig, ResolvedGroundItemConfig, ResolvedHeaderedItemConfig, ResolvedItemConfig, ResolvedRootItemConfig, ResolvedStackItemConfig } from '../config/resolved-config';\nimport { AssertError, UnexpectedNullError } from '../errors/internal-error';\nimport { LayoutManager } from '../layout-manager';\nimport { DomConstants } from '../utils/dom-constants';\nimport { AreaLinkedRect, ItemType, SizeUnitEnum } from '../utils/types';\nimport { getElementWidthAndHeight, setElementHeight, setElementWidth } from '../utils/utils';\nimport { ComponentItem } from './component-item';\nimport { ComponentParentableItem } from './component-parentable-item';\nimport { ContentItem } from './content-item';\nimport { RowOrColumn } from './row-or-column';\n\n/**\n * GroundItem is the ContentItem whose one child is the root ContentItem (Root is planted in Ground).\n * (Previously it was called root however this was incorrect as its child is the root item)\n * There is only one instance of GroundItem and it is automatically created by the Layout Manager\n * @internal\n */\nexport class GroundItem extends ComponentParentableItem {\n private readonly _childElementContainer: HTMLElement;\n private readonly _containerElement: HTMLElement;\n\n constructor(layoutManager: LayoutManager, rootItemConfig: ResolvedRootItemConfig | undefined, containerElement: HTMLElement) {\n\n super(layoutManager, ResolvedGroundItemConfig.create(rootItemConfig), null, GroundItem.createElement(document));\n\n this.isGround = true;\n this._childElementContainer = this.element;\n this._containerElement = containerElement;\n\n // insert before any pre-existing content elements\n let before = null;\n while (true) {\n const prev: ChildNode | null =\n before ? before.previousSibling : this._containerElement.lastChild;\n if (prev instanceof Element\n && prev.classList.contains(DomConstants.ClassName.Content)) {\n before = prev;\n } else {\n break;\n }\n }\n this._containerElement.insertBefore(this.element, before);\n }\n\n override init(): void {\n if (this.isInitialised === true) return;\n\n this.updateNodeSize();\n\n for (let i = 0; i < this.contentItems.length; i++) {\n this._childElementContainer.appendChild(this.contentItems[i].element);\n }\n\n super.init();\n\n this.initContentItems();\n }\n\n /**\n * Loads a new Layout\n * Internal only. To load a new layout with API, use {@link (LayoutManager:class).loadLayout}\n */\n loadRoot(rootItemConfig: ResolvedRootItemConfig | undefined): void {\n // Remove existing root if it exists\n this.clearRoot();\n\n if (rootItemConfig !== undefined) {\n const rootContentItem = this.layoutManager.createAndInitContentItem(rootItemConfig, this);\n this.addChild(rootContentItem, 0);\n }\n }\n\n clearRoot(): void {\n // Remove existing root if it exists\n const contentItems = this.contentItems;\n switch (contentItems.length) {\n case 0: {\n return;\n }\n case 1: {\n const existingRootContentItem = contentItems[0];\n existingRootContentItem.remove();\n return;\n }\n default: {\n throw new AssertError('GILR07721');\n }\n }\n }\n\n /**\n * Adds a ContentItem child to root ContentItem.\n * Internal only. To load a add with API, use {@link (LayoutManager:class).addItem}\n * @returns -1 if added as root otherwise index in root ContentItem's content\n */\n addItem(itemConfig: RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig,\n index?: number\n ): number {\n this.layoutManager.checkMinimiseMaximisedStack();\n\n const resolvedItemConfig = ItemConfig.resolve(itemConfig, false);\n let parent: ContentItem;\n if (this.contentItems.length > 0) {\n parent = this.contentItems[0];\n } else {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n parent = this;\n }\n if (parent.isComponent) {\n throw new Error('Cannot add item as child to ComponentItem');\n } else {\n const contentItem = this.layoutManager.createAndInitContentItem(resolvedItemConfig, parent);\n index = parent.addChild(contentItem, index);\n return (parent === this) ? -1 : index;\n }\n }\n\n loadComponentAsRoot(itemConfig: ComponentItemConfig): void {\n // Remove existing root if it exists\n this.clearRoot();\n\n const resolvedItemConfig = ItemConfig.resolve(itemConfig, false) as ResolvedComponentItemConfig;\n\n if (resolvedItemConfig.maximised) {\n throw new Error('Root Component cannot be maximised');\n } else {\n const rootContentItem = new ComponentItem(this.layoutManager, resolvedItemConfig, this);\n rootContentItem.init();\n this.addChild(rootContentItem, 0);\n }\n }\n\n /**\n * Adds a Root ContentItem.\n * Internal only. To replace Root ContentItem with API, use {@link (LayoutManager:class).loadLayout}\n */\n override addChild(contentItem: ContentItem, index?: number): number {\n if (this.contentItems.length > 0) {\n throw new Error('Ground node can only have a single child');\n } else {\n // contentItem = this.layoutManager._$normalizeContentItem(contentItem, this);\n this._childElementContainer.appendChild(contentItem.element);\n index = super.addChild(contentItem, index);\n\n this.updateSize(false);\n this.emitBaseBubblingEvent('stateChanged');\n\n return index;\n }\n }\n\n /** @internal */\n override calculateConfigContent(): ResolvedRootItemConfig[] {\n const contentItems = this.contentItems;\n const count = contentItems.length;\n const result = new Array(count);\n for (let i = 0; i < count; i++) {\n const item = contentItems[i];\n const itemConfig = item.toConfig();\n if (ResolvedRootItemConfig.isRootItemConfig(itemConfig)) {\n result[i] = itemConfig;\n } else {\n throw new AssertError('RCCC66832');\n }\n }\n return result;\n }\n\n /** @internal */\n setSize(width: number, height: number): void {\n if (width === undefined || height === undefined) {\n this.updateSize(false); // For backwards compatibility with v1.x API\n } else {\n setElementWidth(this.element, width);\n setElementHeight(this.element, height);\n\n // GroundItem can be empty\n if (this.contentItems.length > 0) {\n setElementWidth(this.contentItems[0].element, width);\n setElementHeight(this.contentItems[0].element, height);\n }\n\n this.updateContentItemsSize(false);\n }\n }\n\n /**\n * Adds a Root ContentItem.\n * Internal only. To replace Root ContentItem with API, use {@link (LayoutManager:class).updateRootSize}\n */\n override updateSize(force: boolean): void {\n this.layoutManager.beginVirtualSizedContainerAdding();\n try {\n this.updateNodeSize();\n this.updateContentItemsSize(force);\n } finally {\n this.layoutManager.endVirtualSizedContainerAdding();\n }\n }\n\n createSideAreas(): GroundItem.Area[] {\n const areaSize = 50;\n\n const oppositeSides = GroundItem.Area.oppositeSides;\n const result = new Array(Object.keys(oppositeSides).length);\n let idx = 0;\n\n for (const key in oppositeSides) {\n const side = key as keyof GroundItem.Area.Sides;\n const area = this.getElementArea() as GroundItem.Area;\n if (area === null) {\n throw new UnexpectedNullError('RCSA77553');\n } else {\n area.side = side;\n if (oppositeSides[side][1] === '2' )\n area[side] = area[oppositeSides[side]] - areaSize;\n else\n area[side] = area[oppositeSides[side]] + areaSize;\n area.surface = (area.x2 - area.x1) * (area.y2 - area.y1);\n result[idx++] = area;\n }\n }\n\n return result;\n }\n\n override highlightDropZone(x: number, y: number, area: AreaLinkedRect): void {\n this.layoutManager.tabDropPlaceholder.remove();\n super.highlightDropZone(x, y, area);\n }\n\n override onDrop(contentItem: ContentItem, area: GroundItem.Area): void {\n\n if (contentItem.isComponent) {\n const itemConfig = ResolvedStackItemConfig.createDefault();\n // since ResolvedItemConfig.contentItems not set up, we need to add header from Component\n const component = contentItem as ComponentItem;\n itemConfig.header = ResolvedHeaderedItemConfig.Header.createCopy(component.headerConfig);\n const stack = this.layoutManager.createAndInitContentItem(itemConfig, this);\n stack.addChild(contentItem);\n contentItem = stack;\n }\n\n if (this.contentItems.length === 0) {\n this.addChild(contentItem);\n } else {\n /*\n * If the contentItem that's being dropped is not dropped on a Stack (cases which just passed above and\n * which would wrap the contentItem in a Stack) we need to check whether contentItem is a RowOrColumn.\n * If it is, we need to re-wrap it in a Stack like it was when it was dragged by its Tab (it was dragged!).\n */\n if(contentItem.type === ItemType.row || contentItem.type === ItemType.column){\n const itemConfig = ResolvedStackItemConfig.createDefault();\n const stack = this.layoutManager.createContentItem(itemConfig, this);\n stack.addChild(contentItem)\n contentItem = stack\n }\n\n const type = area.side[0] == 'x' ? ItemType.row : ItemType.column;\n const insertBefore = area.side[1] == '2';\n const column = this.contentItems[0];\n if (!(column instanceof RowOrColumn) || column.type !== type) {\n const itemConfig = ResolvedItemConfig.createDefault(type);\n const rowOrColumn = this.layoutManager.createContentItem(itemConfig, this);\n this.replaceChild(column, rowOrColumn);\n rowOrColumn.addChild(contentItem, insertBefore ? 0 : undefined, true);\n rowOrColumn.addChild(column, insertBefore ? undefined : 0, true);\n column.size = 50;\n contentItem.size = 50;\n contentItem.sizeUnit = SizeUnitEnum.Percent;\n rowOrColumn.updateSize(false);\n } else {\n const sibling = column.contentItems[insertBefore ? 0 : column.contentItems.length - 1]\n column.addChild(contentItem, insertBefore ? 0 : undefined, true);\n sibling.size *= 0.5;\n contentItem.size = sibling.size;\n contentItem.sizeUnit = SizeUnitEnum.Percent;\n column.updateSize(false);\n }\n }\n }\n\n // No ContentItem can dock with groundItem. However Stack can have a GroundItem parent and Stack requires that\n // its parent implement dock() function. Accordingly this function is implemented but throws an exception as it should\n // never be called\n dock(): void {\n throw new AssertError('GID87731');\n }\n\n // No ContentItem can dock with groundItem. However Stack can have a GroundItem parent and Stack requires that\n // its parent implement validateDocking() function. Accordingly this function is implemented but throws an exception as it should\n // never be called\n validateDocking(): void {\n throw new AssertError('GIVD87732');\n }\n\n getAllContentItems(): ContentItem[] {\n const result: ContentItem[] = [this];\n this.deepGetAllContentItems(this.contentItems, result);\n return result;\n }\n\n getConfigMaximisedItems(): ContentItem[] {\n const result: ContentItem[] = [];\n this.deepFilterContentItems(this.contentItems, result, (item) => {\n if (ContentItem.isStack(item) && item.initialWantMaximise) {\n return true;\n } else {\n if (ContentItem.isComponentItem(item) && item.initialWantMaximise) {\n return true;\n } else {\n return false;\n }\n }\n });\n\n return result;\n }\n\n getItemsByPopInParentId(popInParentId: string): ContentItem[] {\n const result: ContentItem[] = [];\n this.deepFilterContentItems(this.contentItems, result, (item) => item.popInParentIds.includes(popInParentId));\n return result;\n }\n\n toConfig(): ResolvedItemConfig {\n throw new Error('Cannot generate GroundItem config');\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n setActiveComponentItem(item: ComponentItem, focus: boolean, suppressFocusEvent: boolean): void {\n // only applicable if ComponentItem is root and then it always has focus\n }\n\n private updateNodeSize(): void {\n const { width, height } = getElementWidthAndHeight(this._containerElement);\n\n setElementWidth(this.element, width);\n setElementHeight(this.element, height);\n\n /*\n * GroundItem can be empty\n */\n if (this.contentItems.length > 0) {\n setElementWidth(this.contentItems[0].element, width);\n setElementHeight(this.contentItems[0].element, height);\n }\n }\n\n private deepGetAllContentItems(content: readonly ContentItem[], result: ContentItem[]): void {\n for (let i = 0; i < content.length; i++) {\n const contentItem = content[i];\n result.push(contentItem);\n this.deepGetAllContentItems(contentItem.contentItems, result);\n }\n }\n\n private deepFilterContentItems(content: readonly ContentItem[], result: ContentItem[],\n checkAcceptFtn: ((this: void, item: ContentItem) => boolean)\n ): void {\n for (let i = 0; i < content.length; i++) {\n const contentItem = content[i];\n if (checkAcceptFtn(contentItem)) {\n result.push(contentItem);\n }\n this.deepFilterContentItems(contentItem.contentItems, result, checkAcceptFtn);\n }\n }\n\n}\n\n/** @internal */\nexport namespace GroundItem {\n export interface Area extends ContentItem.Area {\n side: keyof typeof Area.Side;\n }\n\n export namespace Area {\n export const enum Side {\n y2,\n x2,\n y1,\n x1,\n }\n\n export type Sides = { [side in keyof typeof Side]: keyof typeof Side; }\n\n export const oppositeSides: Sides = {\n y2: 'y1',\n x2: 'x1',\n y1: 'y2',\n x1: 'x2',\n };\n }\n\n export function createElement(document: Document): HTMLDivElement {\n const element = document.createElement('div');\n element.classList.add(DomConstants.ClassName.GoldenLayout);\n element.classList.add(DomConstants.ClassName.Item);\n element.classList.add(DomConstants.ClassName.Root);\n return element;\n }\n}\n","import { ComponentItemConfig as ConfigComponentItemConfig } from '../config/config'; // remove alias in version 3\nimport { ResolvedRowOrColumnItemConfig } from \"../config/resolved-config\";\nimport { UnexpectedNullError } from '../errors/internal-error';\nimport { ComponentItem } from '../items/component-item';\nimport { GroundItem } from '../items/ground-item';\nimport { LayoutManager } from '../layout-manager';\nimport { DragListener } from '../utils/drag-listener';\nimport { JsonValue } from '../utils/types';\nimport { DragProxy } from './drag-proxy';\n\n/**\n * Allows for any DOM item to create a component on drag\n * start to be dragged into the Layout\n * @public\n */\nexport class DragSource {\n /** @internal */\n private _dragListener: DragListener | null;\n /** @internal */\n private _dummyGroundContainer: HTMLElement;\n /** @internal */\n private _dummyGroundContentItem: GroundItem;\n\n /** @internal */\n constructor(\n /** @internal */\n private _layoutManager: LayoutManager,\n /** @internal */\n private readonly _element: HTMLElement,\n /** @internal */\n private readonly _extraAllowableChildTargets: HTMLElement[],\n /** @internal @deprecated replace with componentItemConfigOrFtn in version 3 */\n private _componentTypeOrFtn: JsonValue | (() => (DragSource.ComponentItemConfig | ConfigComponentItemConfig)),\n /** @internal @deprecated remove in version 3 */\n private _componentState: JsonValue | undefined,\n /** @internal @deprecated remove in version 3 */\n private _title: string | undefined,\n /** @internal @deprecated remove in version 3 */\n private _id: string | undefined\n ) {\n this._dragListener = null;\n\n this._dummyGroundContainer = document.createElement('div');\n\n const dummyRootItemConfig = ResolvedRowOrColumnItemConfig.createDefault('row');\n this._dummyGroundContentItem = new GroundItem(this._layoutManager, dummyRootItemConfig, this._dummyGroundContainer);\n\n this.createDragListener();\n }\n\n\t/**\n\t * Disposes of the drag listeners so the drag source is not usable any more.\n * @internal\n\t */\n\tdestroy(): void {\n\t\tthis.removeDragListener();\n }\n\n /**\n * Called initially and after every drag\n * @internal\n */\n private createDragListener() {\n this.removeDragListener();\n\n this._dragListener = new DragListener(this._element, this._extraAllowableChildTargets);\n this._dragListener.on('dragStart', (x, y) => this.onDragStart(x, y));\n this._dragListener.on('dragStop', () => this.onDragStop());\n }\n\n /**\n * Callback for the DragListener's dragStart event\n *\n * @param x - The x position of the mouse on dragStart\n * @param y - The x position of the mouse on dragStart\n * @internal\n */\n private onDragStart(x: number, y: number) {\n const type = 'component';\n let dragSourceItemConfig: ConfigComponentItemConfig;\n\n if (typeof this._componentTypeOrFtn === \"function\") {\n const ftnDragSourceItemConfig = this._componentTypeOrFtn() as (DragSource.ComponentItemConfig | ConfigComponentItemConfig);\n // If the componentType property exists, then it is already a ComponentItemConfig so nothing to do\n if (DragSource.isDragSourceComponentItemConfig(ftnDragSourceItemConfig)) {\n dragSourceItemConfig = {\n type,\n componentState: ftnDragSourceItemConfig.state,\n componentType: ftnDragSourceItemConfig.type,\n title: ftnDragSourceItemConfig.title ?? this._title,\n };\n } else {\n dragSourceItemConfig = ftnDragSourceItemConfig;\n }\n } else {\n dragSourceItemConfig = {\n type,\n componentState: this._componentState,\n componentType: this._componentTypeOrFtn,\n title: this._title,\n id: this._id,\n };\n }\n\n // Create a dummy ContentItem only for drag purposes\n // All ContentItems (except for GroundItem) need a parent. When dragging, the parent is not used.\n // Instead of allowing null parents (as Javascript version did), use a temporary dummy GroundItem parent and add ContentItem to that\n // If this does not work, need to create alternative GroundItem class\n\n const resolvedItemConfig = ConfigComponentItemConfig.resolve(dragSourceItemConfig, false);\n\n const componentItem = new ComponentItem(this._layoutManager, resolvedItemConfig, this._dummyGroundContentItem)\n this._dummyGroundContentItem.contentItems.push(componentItem);\n\n if (this._dragListener === null) {\n throw new UnexpectedNullError('DSODSD66746');\n } else {\n const dragProxy = new DragProxy(x, y, this._dragListener, this._layoutManager, componentItem , this._dummyGroundContentItem);\n\n const transitionIndicator = this._layoutManager.transitionIndicator;\n if (transitionIndicator === null) {\n throw new UnexpectedNullError('DSODST66746');\n } else {\n transitionIndicator.transitionElements(this._element, dragProxy.element);\n }\n }\n }\n\n /** @internal */\n private onDragStop() {\n // if (this._dummyGroundContentItem === undefined) {\n // throw new UnexpectedUndefinedError('DSODSDRU08116');\n // } else {\n // this._dummyGroundContentItem._$destroy\n // this._dummyGroundContentItem = undefined;\n // }\n this.createDragListener();\n }\n\n /**\n\t * Called after every drag and when the drag source is being disposed of.\n * @internal\n\t */\n\tprivate removeDragListener() {\n\t\tif (this._dragListener !== null ) {\n this._dragListener.destroy();\n this._dragListener = null;\n\t\t}\n\t}\n}\n\n/** @public */\nexport namespace DragSource {\n /** @deprecated use Config {@link (ComponentItemConfig:interface)} */\n export interface ComponentItemConfig {\n type: JsonValue,\n state?: JsonValue,\n title?: string,\n }\n\n /** @deprecated remove in version 3 */\n export function isDragSourceComponentItemConfig(\n config: DragSource.ComponentItemConfig | ConfigComponentItemConfig\n ): config is DragSource.ComponentItemConfig {\n return !(\"componentType\" in config);\n }\n}\n","import { DomConstants } from '../utils/dom-constants';\nimport { AreaLinkedRect } from '../utils/types';\nimport { numberToPixels, setElementDisplayVisibility } from '../utils/utils';\n\n/** @internal */\nexport class DropTargetIndicator {\n private _element: HTMLElement;\n\n constructor() {\n // Maybe use container instead of Document Body?\n this._element = document.createElement('div');\n this._element.classList.add(DomConstants.ClassName.DropTargetIndicator);\n const innerElement = document.createElement('div');\n innerElement.classList.add(DomConstants.ClassName.Inner);\n this._element.appendChild(innerElement);\n\n document.body.appendChild(this._element);\n }\n\n destroy(): void {\n this._element.remove();\n }\n\n highlightArea(area: AreaLinkedRect, margin: number): void {\n this._element.style.left = numberToPixels(area.x1 + margin);\n this._element.style.top = numberToPixels(area.y1 + margin);\n this._element.style.width = numberToPixels(area.x2 - area.x1 - margin);\n this._element.style.height = numberToPixels(area.y2 - area.y1 - margin);\n this._element.style.display = 'block';\n }\n\n hide(): void {\n setElementDisplayVisibility(this._element, false);\n }\n}\n","import { DomConstants } from '../utils/dom-constants';\nimport { Rect } from '../utils/types';\n\n/** @internal @deprecated To be removed */\nexport class TransitionIndicator {\n private _element: HTMLElement;\n private _toElement: HTMLElement | null;\n private _fromDimensions: null;\n private _totalAnimationDuration: number;\n private _animationStartTime: number | null;\n\n constructor() {\n this._element = document.createElement('div');\n this._element.classList.add(DomConstants.ClassName.TransitionIndicator);\n document.body.appendChild(this._element);\n\n this._toElement = null;\n this._fromDimensions = null;\n this._totalAnimationDuration = 200;\n this._animationStartTime = null;\n }\n\n destroy(): void {\n this._element.remove();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n transitionElements(fromElement: HTMLElement, toElement: HTMLElement): void {\n /**\n * TODO - This is not quite as cool as expected. Review.\n */\n return;\n // this._toElement = toElement;\n // this._animationStartTime = now();\n // this._fromDimensions = this._measure(fromElement);\n // this._fromDimensions.opacity = 0.8;\n // this._element.show().css(this._fromDimensions);\n // animFrame(fnBind(this._nextAnimationFrame, this));\n }\n\n private nextAnimationFrame(): void {\n // if (this._toElement === null || this._fromDimensions === null || this._animationStartTime === null) {\n // throw new UnexpectedNullError('TINAFTD97115');\n // } else {\n // const toDimensions = this.measure(this._toElement);\n // const animationProgress = (now() - this._animationStartTime) / this._totalAnimationDuration;\n // const currentFrameStyles = {};\n // const cssProperty;\n\n // if (animationProgress >= 1) {\n // this._element.style.display = 'none';\n // return;\n // }\n\n // toDimensions.opacity = 0;\n\n // for (const cssProperty in this._fromDimensions) {\n // currentFrameStyles[cssProperty] = this._fromDimensions[cssProperty] +\n // (toDimensions[cssProperty] - this._fromDimensions[cssProperty]) *\n // animationProgress;\n // }\n\n // this._element.css(currentFrameStyles);\n // animFrame(fnBind(this._nextAnimationFrame, this));\n // }\n }\n\n private measure(element: HTMLElement): Rect {\n const rect = element.getBoundingClientRect();\n\n return {\n left: rect.left,\n top: rect.top,\n width: element.offsetWidth,\n height: element.offsetHeight,\n };\n }\n}\n","import { UnexpectedNullError } from '../errors/internal-error';\nimport { LayoutManager } from '../layout-manager';\nimport { EventEmitter } from './event-emitter';\n\n// Add our ChildEvent to WindowEventMap for type safety\n/** @public */\ndeclare global {\n interface WindowEventMap {\n [EventHub.ChildEventName]: CustomEvent;\n }\n}\n\n/**\n * An EventEmitter singleton that propagates events\n * across multiple windows. This is a little bit trickier since\n * windows are allowed to open childWindows in their own right.\n *\n * This means that we deal with a tree of windows. Therefore, we do the event propagation in two phases:\n *\n * - Propagate events from this layout to the parent layout\n * - Repeat until the event arrived at the root layout\n * - Propagate events to this layout and to all children\n * - Repeat until all layouts got the event\n *\n * **WARNING**: Only userBroadcast events are propagated between windows.\n * This means the you have to take care of propagating state changes between windows yourself.\n *\n * @public\n */\nexport class EventHub extends EventEmitter {\n\n /** @internal */\n private _childEventListener = (childEvent: CustomEvent) => this.onEventFromChild(childEvent);\n\n /**\n * Creates a new EventHub instance\n * @param _layoutManager - the layout manager to synchronize between the windows\n * @internal\n */\n constructor(\n /** @internal */\n private _layoutManager: LayoutManager\n ) {\n super();\n globalThis.addEventListener(EventHub.ChildEventName, this._childEventListener, { passive: true });\n }\n\n /**\n * Emit an event and notify listeners\n *\n * @param eventName - The name of the event\n * @param args - Additional arguments that will be passed to the listener\n * @public\n */\n override emit(eventName: K, ...args: EventEmitter.EventParamsMap[K]): void {\n if (eventName === 'userBroadcast') {\n // Explicitly redirect the user broadcast to our overridden method.\n this.emitUserBroadcast(...args);\n } else {\n super.emit(eventName, ...args);\n }\n }\n\n /**\n * Broadcasts a message to all other currently opened windows.\n * @public\n */\n emitUserBroadcast(...args: EventEmitter.UnknownParams): void {\n // Step 1: Bubble up the event\n this.handleUserBroadcastEvent('userBroadcast', args);\n }\n\n /**\n * Destroys the EventHub\n * @internal\n */\n destroy(): void {\n globalThis.removeEventListener(EventHub.ChildEventName, this._childEventListener);\n }\n\n /**\n * Internal processor to process local events.\n * @internal\n */\n private handleUserBroadcastEvent(eventName: string, args: unknown[]) {\n if (this._layoutManager.isSubWindow) {\n // We are a sub window and received an event from one of our children.\n // So propagate it to the Root.\n this.propagateToParent(eventName, args);\n } else {\n // We are the root window, propagate it to the subtree below us.\n this.propagateToThisAndSubtree(eventName, args);\n }\n }\n\n /**\n * Callback for child events raised on the window\n * @internal\n */\n private onEventFromChild(event: CustomEvent) {\n const detail = event.detail;\n this.handleUserBroadcastEvent(detail.eventName, detail.args);\n }\n\n /**\n * Propagates the event to the parent by emitting\n * it on the parent's DOM window\n * @internal\n */\n private propagateToParent(eventName: string, args: unknown[]) {\n const detail: EventHub.ChildEventDetail = {\n layoutManager: this._layoutManager,\n eventName,\n args: args,\n }\n\n const eventInit: EventHub.ChildEventInit = {\n bubbles: true,\n cancelable: true,\n detail,\n };\n\n const event = new CustomEvent(EventHub.ChildEventName, eventInit);\n const opener = globalThis.opener;\n if (opener === null) {\n throw new UnexpectedNullError('EHPTP15778')\n }\n\n opener.dispatchEvent(event);\n }\n\n /**\n * Propagate events to the whole subtree under this event hub.\n * @internal\n */\n private propagateToThisAndSubtree(eventName: string, args: unknown[]) {\n this.emitUnknown(eventName, ...args);\n for (let i = 0; i < this._layoutManager.openPopouts.length; i++) {\n const childGl = this._layoutManager.openPopouts[i].getGlInstance();\n\n if (childGl) {\n childGl.eventHub.propagateToThisAndSubtree(eventName, args);\n }\n }\n }\n}\n\n/** @public */\nexport namespace EventHub {\n\n /** @internal */\n export const ChildEventName = 'gl_child_event';\n\n /** @internal */\n export type ChildEventDetail = {\n layoutManager: LayoutManager;\n eventName: string;\n args: unknown[];\n };\n\n /** @internal */\n export type ChildEventInit = CustomEventInit;\n}\n","import { ComponentItemConfig, ItemConfig, LayoutConfig, RowOrColumnItemConfig, StackItemConfig } from './config/config';\nimport {\n ResolvedComponentItemConfig,\n ResolvedItemConfig,\n ResolvedLayoutConfig,\n ResolvedPopoutLayoutConfig,\n ResolvedRootItemConfig,\n ResolvedRowOrColumnItemConfig,\n ResolvedStackItemConfig\n} from \"./config/resolved-config\";\nimport { ComponentContainer } from './container/component-container';\nimport { BrowserPopout } from './controls/browser-popout';\nimport { DragProxy } from './controls/drag-proxy';\nimport { DragSource } from './controls/drag-source';\nimport { DropTargetIndicator } from './controls/drop-target-indicator';\nimport { TransitionIndicator } from './controls/transition-indicator';\nimport { ConfigurationError } from './errors/external-error';\nimport { AssertError, UnexpectedNullError, UnexpectedUndefinedError, UnreachableCaseError } from './errors/internal-error';\nimport { ComponentItem } from './items/component-item';\nimport { ComponentParentableItem } from './items/component-parentable-item';\nimport { ContentItem } from './items/content-item';\nimport { GroundItem } from './items/ground-item';\nimport { RowOrColumn } from './items/row-or-column';\nimport { Stack } from './items/stack';\nimport { ConfigMinifier } from './utils/config-minifier';\nimport { DomConstants } from './utils/dom-constants';\nimport { DragListener } from './utils/drag-listener';\nimport { EventEmitter } from './utils/event-emitter';\nimport { EventHub } from './utils/event-hub';\nimport { I18nStringId, I18nStrings, i18nStrings } from './utils/i18n-strings';\nimport { ItemType, JsonValue, Rect, ResponsiveMode } from './utils/types';\nimport {\n getElementWidthAndHeight,\n removeFromArray,\n setElementHeight,\n setElementWidth\n} from './utils/utils';\n\n/** @internal */\ndeclare global {\n interface Window {\n __glInstance: LayoutManager;\n }\n}\n\n/**\n * The main class that will be exposed as GoldenLayout.\n */\n\n/** @public */\nexport abstract class LayoutManager extends EventEmitter {\n /** Whether the layout will be automatically be resized to container whenever the container's size is changed\n * Default is true if is the container otherwise false\n * Default will be changed to true for any container in the future\n */\n resizeWithContainerAutomatically = false;\n /** The debounce interval (in milliseconds) used whenever a layout is automatically resized. 0 means next tick */\n resizeDebounceInterval = 100;\n /** Extend the current debounce delay time period if it is triggered during the delay.\n * If this is true, the layout will only resize when its container has stopped being resized.\n * If it is false, the layout will resize at intervals while its container is being resized.\n */\n resizeDebounceExtendedWhenPossible = true;\n\n /** @internal */\n private _containerElement: HTMLElement;\n /** @internal */\n private _isInitialised = false;\n /** @internal */\n private _groundItem: GroundItem | undefined = undefined;\n /** @internal */\n private _openPopouts: BrowserPopout[] = [];\n /** @internal */\n private _dropTargetIndicator: DropTargetIndicator | null = null;\n /** @internal */\n private _transitionIndicator: TransitionIndicator | null = null;\n /** @internal */\n private _resizeTimeoutId: ReturnType | undefined;\n /** @internal */\n private _itemAreas: ContentItem.Area[] = [];\n /** @internal */\n private _maximisedStack: Stack | undefined;\n /** @internal */\n private _maximisePlaceholder = LayoutManager.createMaximisePlaceElement(document);\n /** @internal */\n private _tabDropPlaceholder = LayoutManager.createTabDropPlaceholderElement(document);\n /** @internal */\n private _dragSources: DragSource[] = [];\n /** @internal */\n private _updatingColumnsResponsive = false;\n /** @internal */\n private _firstLoad = true;\n /** @internal */\n private _eventHub = new EventHub(this);\n /** @internal */\n private _width: number | null = null;\n /** @internal */\n private _height: number | null = null;\n /** @internal */\n private _focusedComponentItem: ComponentItem | undefined;\n /** @internal */\n private _virtualSizedContainers: ComponentContainer[] = [];\n /** @internal */\n private _virtualSizedContainerAddingBeginCount = 0;\n /** @internal */\n private _sizeInvalidationBeginCount = 0;\n /** @internal */\n protected _constructorOrSubWindowLayoutConfig: LayoutConfig | undefined; // protected for backwards compatibility\n\n /** @internal */\n private _resizeObserver = new ResizeObserver(() => this.handleContainerResize());\n /** @internal @deprecated to be removed in version 3 */\n private _windowBeforeUnloadListener = () => this.onBeforeUnload();\n /** @internal @deprecated to be removed in version 3 */\n private _windowBeforeUnloadListening = false;\n /** @internal */\n private _maximisedStackBeforeDestroyedListener = (ev: EventEmitter.BubblingEvent) => this.cleanupBeforeMaximisedStackDestroyed(ev);\n\n readonly isSubWindow: boolean;\n layoutConfig: ResolvedLayoutConfig;\n\n beforeVirtualRectingEvent: LayoutManager.BeforeVirtualRectingEvent | undefined;\n afterVirtualRectingEvent: LayoutManager.AfterVirtualRectingEvent | undefined;\n\n get container(): HTMLElement { return this._containerElement; }\n get isInitialised(): boolean { return this._isInitialised; }\n /** @internal */\n get groundItem(): GroundItem | undefined { return this._groundItem; }\n /** @internal @deprecated use {@link (LayoutManager:class).groundItem} instead */\n get root(): GroundItem | undefined { return this._groundItem; }\n get openPopouts(): BrowserPopout[] { return this._openPopouts; }\n /** @internal */\n get dropTargetIndicator(): DropTargetIndicator | null { return this._dropTargetIndicator; }\n /** @internal @deprecated To be removed */\n get transitionIndicator(): TransitionIndicator | null { return this._transitionIndicator; }\n get width(): number | null { return this._width; }\n get height(): number | null { return this._height; }\n /**\n * Retrieves the {@link (EventHub:class)} instance associated with this layout manager.\n * This can be used to propagate events between the windows\n * @public\n */\n get eventHub(): EventHub { return this._eventHub; }\n get rootItem(): ContentItem | undefined {\n if (this._groundItem === undefined) {\n throw new Error('Cannot access rootItem before init');\n } else {\n const groundContentItems = this._groundItem.contentItems;\n if (groundContentItems.length === 0) {\n return undefined;\n } else {\n return this._groundItem.contentItems[0];\n }\n }\n }\n get focusedComponentItem(): ComponentItem | undefined { return this._focusedComponentItem; }\n /** @internal */\n get tabDropPlaceholder(): HTMLElement { return this._tabDropPlaceholder; }\n get maximisedStack(): Stack | undefined { return this._maximisedStack; }\n\n /** @deprecated indicates deprecated constructor use */\n get deprecatedConstructor(): boolean { return !this.isSubWindow && this._constructorOrSubWindowLayoutConfig !== undefined; }\n\n\n /**\n * @param container - A Dom HTML element. Defaults to body\n * @internal\n */\n constructor(parameters: LayoutManager.ConstructorParameters) {\n super();\n\n this.isSubWindow = parameters.isSubWindow;\n\n this._constructorOrSubWindowLayoutConfig = parameters.constructorOrSubWindowLayoutConfig;\n\n I18nStrings.checkInitialise();\n ConfigMinifier.checkInitialise();\n\n if (parameters.containerElement !== undefined) {\n this._containerElement = parameters.containerElement;\n }\n }\n\n /**\n * Destroys the LayoutManager instance itself as well as every ContentItem\n * within it. After this is called nothing should be left of the LayoutManager.\n *\n * This function only needs to be called if an application wishes to destroy the Golden Layout object while\n * a page remains loaded. When a page is unloaded, all resources claimed by Golden Layout will automatically\n * be released.\n */\n destroy(): void {\n if (this._isInitialised) {\n if (this._windowBeforeUnloadListening) {\n globalThis.removeEventListener('beforeunload', this._windowBeforeUnloadListener);\n this._windowBeforeUnloadListening = false;\n }\n\n if (this.layoutConfig.settings.closePopoutsOnUnload === true) {\n this.closeAllOpenPopouts();\n }\n\n this._resizeObserver.disconnect();\n this.checkClearResizeTimeout();\n\n if (this._groundItem !== undefined) {\n this._groundItem.destroy();\n }\n this._tabDropPlaceholder.remove();\n if (this._dropTargetIndicator !== null) {\n this._dropTargetIndicator.destroy();\n }\n if (this._transitionIndicator !== null) {\n this._transitionIndicator.destroy();\n }\n this._eventHub.destroy();\n\n for (const dragSource of this._dragSources) {\n dragSource.destroy();\n }\n this._dragSources = [];\n\n this._isInitialised = false;\n }\n }\n\n /**\n * Takes a GoldenLayout configuration object and\n * replaces its keys and values recursively with\n * one letter codes\n * @deprecated use {@link (ResolvedLayoutConfig:namespace).minifyConfig} instead\n */\n minifyConfig(config: ResolvedLayoutConfig): ResolvedLayoutConfig {\n return ResolvedLayoutConfig.minifyConfig(config);\n }\n\n /**\n * Takes a configuration Object that was previously minified\n * using minifyConfig and returns its original version\n * @deprecated use {@link (ResolvedLayoutConfig:namespace).unminifyConfig} instead\n */\n unminifyConfig(config: ResolvedLayoutConfig): ResolvedLayoutConfig {\n return ResolvedLayoutConfig.unminifyConfig(config);\n }\n\n /** @internal */\n abstract bindComponent(container: ComponentContainer, itemConfig: ResolvedComponentItemConfig): ComponentContainer.BindableComponent;\n /** @internal */\n abstract unbindComponent(container: ComponentContainer, virtual: boolean, component: ComponentContainer.Component | undefined): void;\n\n /**\n * Called from GoldenLayout class. Finishes of init\n * @internal\n */\n init(): void {\n this.setContainer();\n this._dropTargetIndicator = new DropTargetIndicator(/*this.container*/);\n this._transitionIndicator = new TransitionIndicator();\n this.updateSizeFromContainer();\n\n let subWindowRootConfig: ComponentItemConfig | undefined;\n if (this.isSubWindow) {\n if (this._constructorOrSubWindowLayoutConfig === undefined) {\n // SubWindow LayoutConfig should have been generated by constructor\n throw new UnexpectedUndefinedError('LMIU07155');\n } else {\n const root = this._constructorOrSubWindowLayoutConfig.root;\n if (root === undefined) {\n // SubWindow LayoutConfig must not be empty\n throw new AssertError('LMIC07156');\n } else {\n if (ItemConfig.isComponent(root)) {\n subWindowRootConfig = root;\n } else {\n // SubWindow LayoutConfig must have Component as Root\n throw new AssertError('LMIC07157');\n }\n }\n const resolvedLayoutConfig = LayoutConfig.resolve(this._constructorOrSubWindowLayoutConfig);\n // remove root from layoutConfig\n this.layoutConfig = {\n ...resolvedLayoutConfig,\n root: undefined,\n }\n }\n } else {\n if (this._constructorOrSubWindowLayoutConfig === undefined) {\n this.layoutConfig = ResolvedLayoutConfig.createDefault(); // will overwritten be loaded via loadLayout\n } else {\n // backwards compatibility\n this.layoutConfig = LayoutConfig.resolve(this._constructorOrSubWindowLayoutConfig);\n }\n }\n const layoutConfig = this.layoutConfig;\n this._groundItem = new GroundItem(this, layoutConfig.root, this._containerElement);\n this._groundItem.init();\n\n this.checkLoadedLayoutMaximiseItem();\n\n this._resizeObserver.observe(this._containerElement);\n this._isInitialised = true;\n this.adjustColumnsResponsive();\n this.emit('initialised');\n\n if (subWindowRootConfig !== undefined) {\n // must be SubWindow\n this.loadComponentAsRoot(subWindowRootConfig);\n }\n }\n\n /**\n * Loads a new layout\n * @param layoutConfig - New layout to be loaded\n */\n loadLayout(layoutConfig: LayoutConfig): void {\n if (!this.isInitialised) {\n // In case application not correctly using legacy constructor\n throw new Error('GoldenLayout: Need to call init() if LayoutConfig with defined root passed to constructor')\n } else {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMLL11119');\n } else {\n this.createSubWindows(); // still needs to be tested\n\n this.layoutConfig = LayoutConfig.resolve(layoutConfig);\n this._groundItem.loadRoot(this.layoutConfig.root);\n this.checkLoadedLayoutMaximiseItem();\n this.adjustColumnsResponsive();\n }\n }\n }\n\n /**\n * Creates a layout configuration object based on the the current state\n *\n * @public\n * @returns GoldenLayout configuration\n */\n saveLayout(): ResolvedLayoutConfig {\n if (this._isInitialised === false) {\n throw new Error('Can\\'t create config, layout not yet initialised');\n } else {\n\n // if (root !== undefined && !(root instanceof ContentItem)) {\n // throw new Error('Root must be a ContentItem');\n // }\n\n /*\n * Content\n */\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMTC18244');\n } else {\n const groundContent = this._groundItem.calculateConfigContent();\n\n let rootItemConfig: ResolvedRootItemConfig | undefined;\n if (groundContent.length !== 1) {\n rootItemConfig = undefined;\n } else {\n rootItemConfig = groundContent[0];\n }\n\n /*\n * Retrieve config for subwindows\n */\n this.reconcilePopoutWindows();\n const openPopouts: ResolvedPopoutLayoutConfig[] = [];\n for (let i = 0; i < this._openPopouts.length; i++) {\n openPopouts.push(this._openPopouts[i].toConfig());\n }\n\n const config: ResolvedLayoutConfig = {\n root: rootItemConfig,\n openPopouts,\n settings: ResolvedLayoutConfig.Settings.createCopy(this.layoutConfig.settings),\n dimensions: ResolvedLayoutConfig.Dimensions.createCopy(this.layoutConfig.dimensions),\n header: ResolvedLayoutConfig.Header.createCopy(this.layoutConfig.header),\n resolved: true,\n }\n\n return config;\n }\n }\n }\n\n /**\n * Removes any existing layout. Effectively, an empty layout will be loaded.\n */\n\n clear(): void {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMCL11129');\n } else {\n this._groundItem.clearRoot();\n }\n }\n\n /**\n * @deprecated Use {@link (LayoutManager:class).saveLayout}\n */\n toConfig(): ResolvedLayoutConfig {\n return this.saveLayout();\n }\n\n /**\n * Adds a new ComponentItem. Will use default location selectors to ensure a location is found and\n * component is successfully added\n * @param componentTypeName - Name of component type to be created.\n * @param state - Optional initial state to be assigned to component\n * @returns New ComponentItem created.\n */\n newComponent(componentType: JsonValue, componentState?: JsonValue, title?: string): ComponentItem {\n const componentItem = this.newComponentAtLocation(componentType, componentState, title);\n if (componentItem === undefined) {\n throw new AssertError('LMNC65588');\n } else {\n return componentItem;\n }\n }\n\n /**\n * Adds a ComponentItem at the first valid selector location.\n * @param componentTypeName - Name of component type to be created.\n * @param state - Optional initial state to be assigned to component\n * @param locationSelectors - Array of location selectors used to find location in layout where component\n * will be added. First location in array which is valid will be used. If locationSelectors is undefined,\n * {@link (LayoutManager:namespace).defaultLocationSelectors} will be used\n * @returns New ComponentItem created or undefined if no valid location selector was in array.\n */\n newComponentAtLocation(componentType: JsonValue, componentState?: JsonValue, title?: string,\n locationSelectors?: LayoutManager.LocationSelector[]\n ): ComponentItem | undefined{\n if (this._groundItem === undefined) {\n throw new Error('Cannot add component before init');\n } else {\n const location = this.addComponentAtLocation(componentType, componentState, title, locationSelectors);\n if (location === undefined) {\n return undefined;\n } else {\n const createdItem = location.parentItem.contentItems[location.index];\n if (!ContentItem.isComponentItem(createdItem)) {\n throw new AssertError('LMNC992877533');\n } else {\n return createdItem;\n }\n }\n }\n }\n\n /**\n * Adds a new ComponentItem. Will use default location selectors to ensure a location is found and\n * component is successfully added\n * @param componentType - Type of component to be created.\n * @param state - Optional initial state to be assigned to component\n * @returns Location of new ComponentItem created.\n */\n addComponent(componentType: JsonValue, componentState?: JsonValue, title?: string): LayoutManager.Location {\n const location = this.addComponentAtLocation(componentType, componentState, title);\n if (location === undefined) {\n throw new AssertError('LMAC99943');\n } else {\n return location;\n }\n }\n\n /**\n * Adds a ComponentItem at the first valid selector location.\n * @param componentType - Type of component to be created.\n * @param state - Optional initial state to be assigned to component\n * @param locationSelectors - Array of location selectors used to find determine location in layout where component\n * will be added. First location in array which is valid will be used. If undefined,\n * {@link (LayoutManager:namespace).defaultLocationSelectors} will be used.\n * @returns Location of new ComponentItem created or undefined if no valid location selector was in array.\n */\n addComponentAtLocation(componentType: JsonValue, componentState?: JsonValue, title?: string,\n locationSelectors?: readonly LayoutManager.LocationSelector[]\n ): LayoutManager.Location | undefined {\n const itemConfig: ComponentItemConfig = {\n type: 'component',\n componentType,\n componentState,\n title,\n };\n\n return this.addItemAtLocation(itemConfig, locationSelectors);\n }\n\n /**\n * Adds a new ContentItem. Will use default location selectors to ensure a location is found and\n * component is successfully added\n * @param itemConfig - ResolvedItemConfig of child to be added.\n * @returns New ContentItem created.\n */\n newItem(itemConfig: RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig): ContentItem {\n const contentItem = this.newItemAtLocation(itemConfig);\n if (contentItem === undefined) {\n throw new AssertError('LMNC65588');\n } else {\n return contentItem;\n }\n }\n\n /**\n * Adds a new child ContentItem under the root ContentItem. If a root does not exist, then create root ContentItem instead\n * @param itemConfig - ResolvedItemConfig of child to be added.\n * @param locationSelectors - Array of location selectors used to find determine location in layout where ContentItem\n * will be added. First location in array which is valid will be used. If undefined,\n * {@link (LayoutManager:namespace).defaultLocationSelectors} will be used.\n * @returns New ContentItem created or undefined if no valid location selector was in array. */\n newItemAtLocation(itemConfig: RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig,\n locationSelectors?: readonly LayoutManager.LocationSelector[]\n ): ContentItem | undefined {\n if (this._groundItem === undefined) {\n throw new Error('Cannot add component before init');\n } else {\n const location = this.addItemAtLocation(itemConfig, locationSelectors);\n if (location === undefined) {\n return undefined;\n } else {\n const createdItem = location.parentItem.contentItems[location.index];\n return createdItem;\n }\n }\n }\n\n /**\n * Adds a new ContentItem. Will use default location selectors to ensure a location is found and\n * component is successfully added.\n * @param itemConfig - ResolvedItemConfig of child to be added.\n * @returns Location of new ContentItem created. */\n addItem(itemConfig: RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig): LayoutManager.Location {\n const location = this.addItemAtLocation(itemConfig);\n if (location === undefined) {\n throw new AssertError('LMAI99943');\n } else {\n return location;\n }\n }\n\n /**\n * Adds a ContentItem at the first valid selector location.\n * @param itemConfig - ResolvedItemConfig of child to be added.\n * @param locationSelectors - Array of location selectors used to find determine location in layout where ContentItem\n * will be added. First location in array which is valid will be used. If undefined,\n * {@link (LayoutManager:namespace).defaultLocationSelectors} will be used.\n * @returns Location of new ContentItem created or undefined if no valid location selector was in array. */\n addItemAtLocation(itemConfig: RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig,\n locationSelectors?: readonly LayoutManager.LocationSelector[]\n ): LayoutManager.Location | undefined {\n if (this._groundItem === undefined) {\n throw new Error('Cannot add component before init');\n } else {\n if (locationSelectors === undefined) {\n // defaultLocationSelectors should always find a location\n locationSelectors = LayoutManager.defaultLocationSelectors;\n }\n\n const location = this.findFirstLocation(locationSelectors);\n if (location === undefined) {\n return undefined;\n } else {\n let parentItem = location.parentItem;\n let addIdx: number;\n switch (parentItem.type) {\n case ItemType.ground: {\n const groundItem = parentItem as GroundItem;\n addIdx = groundItem.addItem(itemConfig, location.index);\n if (addIdx >= 0) {\n parentItem = this._groundItem.contentItems[0]; // was added to rootItem\n } else {\n addIdx = 0; // was added as rootItem (which is the first and only ContentItem in GroundItem)\n }\n break;\n }\n case ItemType.row:\n case ItemType.column: {\n const rowOrColumn = parentItem as RowOrColumn;\n addIdx = rowOrColumn.addItem(itemConfig, location.index);\n break;\n }\n case ItemType.stack: {\n if (!ItemConfig.isComponent(itemConfig)) {\n throw Error(i18nStrings[I18nStringId.ItemConfigIsNotTypeComponent]);\n } else {\n const stack = parentItem as Stack;\n addIdx = stack.addItem(itemConfig, location.index);\n break;\n }\n }\n case ItemType.component: {\n throw new AssertError('LMAIALC87444602');\n }\n default:\n throw new UnreachableCaseError('LMAIALU98881733', parentItem.type);\n }\n\n if (ItemConfig.isComponent(itemConfig)) {\n // see if stack was inserted\n const item = parentItem.contentItems[addIdx];\n if (ContentItem.isStack(item)) {\n parentItem = item;\n addIdx = 0;\n }\n }\n\n location.parentItem = parentItem;\n location.index = addIdx;\n\n return location;\n }\n }\n }\n\n /** Loads the specified component ResolvedItemConfig as root.\n * This can be used to display a Component all by itself. The layout cannot be changed other than having another new layout loaded.\n * Note that, if this layout is saved and reloaded, it will reload with the Component as a child of a Stack.\n */\n loadComponentAsRoot(itemConfig: ComponentItemConfig): void {\n if (this._groundItem === undefined) {\n throw new Error('Cannot add item before init');\n } else {\n this._groundItem.loadComponentAsRoot(itemConfig);\n }\n }\n\n /** @deprecated Use {@link (LayoutManager:class).setSize} */\n updateSize(width: number, height: number): void {\n this.setSize(width, height);\n }\n\n /**\n * Updates the layout managers size\n *\n * @param width - Width in pixels\n * @param height - Height in pixels\n */\n setSize(width: number, height: number): void {\n this._width = width;\n this._height = height;\n\n if (this._isInitialised === true) {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMUS18881');\n } else {\n this._groundItem.setSize(this._width, this._height);\n\n if (this._maximisedStack) {\n const { width, height } = getElementWidthAndHeight(this._containerElement);\n setElementWidth(this._maximisedStack.element, width);\n setElementHeight(this._maximisedStack.element, height);\n this._maximisedStack.updateSize(false);\n }\n\n this.adjustColumnsResponsive();\n }\n }\n }\n\n /** @internal */\n beginSizeInvalidation(): void {\n this._sizeInvalidationBeginCount++;\n }\n\n /** @internal */\n endSizeInvalidation(): void {\n if (--this._sizeInvalidationBeginCount === 0) {\n this.updateSizeFromContainer();\n }\n }\n\n /** @internal */\n updateSizeFromContainer(): void {\n const { width, height } = getElementWidthAndHeight(this._containerElement);\n this.setSize(width, height);\n }\n\n /**\n * Update the size of the root ContentItem. This will update the size of all contentItems in the tree\n * @param force - In some cases the size is not updated if it has not changed. In this case, events\n * (such as ComponentContainer.virtualRectingRequiredEvent) are not fired. Setting force to true, ensures the size is updated regardless, and\n * the respective events are fired. This is sometimes necessary when a component's size has not changed but it has become visible, and the\n * relevant events need to be fired.\n */\n updateRootSize(force = false): void {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMURS28881');\n } else {\n this._groundItem.updateSize(force);\n }\n }\n\n /** @public */\n createAndInitContentItem(config: ResolvedItemConfig, parent: ContentItem): ContentItem {\n const newItem = this.createContentItem(config, parent);\n newItem.init();\n return newItem;\n }\n\n /**\n * Recursively creates new item tree structures based on a provided\n * ItemConfiguration object\n *\n * @param config - ResolvedItemConfig\n * @param parent - The item the newly created item should be a child of\n * @internal\n */\n createContentItem(config: ResolvedItemConfig, parent: ContentItem): ContentItem {\n if (typeof config.type !== 'string') {\n throw new ConfigurationError('Missing parameter \\'type\\'', JSON.stringify(config));\n }\n\n /**\n * We add an additional stack around every component that's not within a stack anyways.\n */\n if (\n // If this is a component\n ResolvedItemConfig.isComponentItem(config) &&\n\n // and it's not already within a stack\n !(parent instanceof Stack) &&\n\n // and we have a parent\n !!parent &&\n\n // and it's not the topmost item in a new window\n !(this.isSubWindow === true && parent instanceof GroundItem)\n ) {\n const stackConfig: ResolvedStackItemConfig = {\n type: ItemType.stack,\n content: [config],\n size: config.size,\n sizeUnit: config.sizeUnit,\n minSize: config.minSize,\n minSizeUnit: config.minSizeUnit,\n id: config.id,\n maximised: config.maximised,\n isClosable: config.isClosable,\n activeItemIndex: 0,\n header: undefined,\n };\n\n config = stackConfig;\n }\n\n const contentItem = this.createContentItemFromConfig(config, parent);\n return contentItem;\n }\n\n findFirstComponentItemById(id: string): ComponentItem | undefined {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMFFCIBI82446');\n } else {\n return this.findFirstContentItemTypeByIdRecursive(ItemType.component, id, this._groundItem) as ComponentItem;\n }\n }\n\n /**\n * Creates a popout window with the specified content at the specified position\n *\n * @param itemConfigOrContentItem - The content of the popout window's layout manager derived from either\n * a {@link (ContentItem:class)} or {@link (ItemConfig:interface)} or ResolvedItemConfig content (array of {@link (ItemConfig:interface)})\n * @param positionAndSize - The width, height, left and top of Popout window\n * @param parentId -The id of the element this item will be appended to when popIn is called\n * @param indexInParent - The position of this item within its parent element\n */\n\n createPopout(itemConfigOrContentItem: ContentItem | ResolvedRootItemConfig,\n positionAndSize: ResolvedPopoutLayoutConfig.Window,\n parentId: string | null,\n indexInParent: number | null\n ): BrowserPopout {\n if (itemConfigOrContentItem instanceof ContentItem) {\n return this.createPopoutFromContentItem(itemConfigOrContentItem, positionAndSize, parentId, indexInParent);\n } else {\n return this.createPopoutFromItemConfig(itemConfigOrContentItem, positionAndSize, parentId, indexInParent);\n }\n }\n\n /** @internal */\n createPopoutFromContentItem(item: ContentItem,\n window: ResolvedPopoutLayoutConfig.Window | undefined,\n parentId: string | null,\n indexInParent: number | null | undefined,\n ): BrowserPopout {\n /**\n * If the item is the only component within a stack or for some\n * other reason the only child of its parent the parent will be destroyed\n * when the child is removed.\n *\n * In order to support this we move up the tree until we find something\n * that will remain after the item is being popped out\n */\n let parent = item.parent;\n let child = item;\n while (parent !== null && parent.contentItems.length === 1 && !parent.isGround) {\n child = parent;\n parent = parent.parent;\n }\n\n if (parent === null) {\n throw new UnexpectedNullError('LMCPFCI00834');\n } else {\n if (indexInParent === undefined) {\n indexInParent = parent.contentItems.indexOf(child);\n }\n\n if (parentId !== null) {\n parent.addPopInParentId(parentId);\n }\n\n if (window === undefined) {\n const windowLeft = globalThis.screenX || globalThis.screenLeft;\n const windowTop = globalThis.screenY || globalThis.screenTop;\n const offsetLeft = item.element.offsetLeft;\n const offsetTop = item.element.offsetTop\n // const { left: offsetLeft, top: offsetTop } = getJQueryLeftAndTop(item.element);\n const { width, height } = getElementWidthAndHeight(item.element);\n\n window = {\n left: windowLeft + offsetLeft,\n top: windowTop + offsetTop,\n width,\n height,\n };\n }\n\n const itemConfig = item.toConfig();\n item.remove();\n\n if (!ResolvedRootItemConfig.isRootItemConfig(itemConfig)) {\n throw new Error(`${i18nStrings[I18nStringId.PopoutCannotBeCreatedWithGroundItemConfig]}`);\n } else {\n return this.createPopoutFromItemConfig(itemConfig, window, parentId, indexInParent);\n }\n }\n }\n\n /** @internal */\n beginVirtualSizedContainerAdding(): void {\n if (++this._virtualSizedContainerAddingBeginCount === 0) {\n this._virtualSizedContainers.length = 0;\n }\n }\n\n /** @internal */\n addVirtualSizedContainer(container: ComponentContainer): void {\n this._virtualSizedContainers.push(container);\n }\n\n /** @internal */\n endVirtualSizedContainerAdding(): void {\n if (--this._virtualSizedContainerAddingBeginCount === 0) {\n const count = this._virtualSizedContainers.length;\n if (count > 0) {\n this.fireBeforeVirtualRectingEvent(count);\n for (let i = 0; i < count; i++) {\n const container = this._virtualSizedContainers[i];\n container.notifyVirtualRectingRequired();\n }\n this.fireAfterVirtualRectingEvent();\n this._virtualSizedContainers.length = 0;\n }\n }\n }\n\n /** @internal */\n fireBeforeVirtualRectingEvent(count: number): void {\n if (this.beforeVirtualRectingEvent !== undefined) {\n this.beforeVirtualRectingEvent(count);\n }\n }\n\n /** @internal */\n fireAfterVirtualRectingEvent(): void {\n if (this.afterVirtualRectingEvent !== undefined) {\n this.afterVirtualRectingEvent();\n }\n }\n\n /** @internal */\n private createPopoutFromItemConfig(rootItemConfig: ResolvedRootItemConfig,\n window: ResolvedPopoutLayoutConfig.Window,\n parentId: string | null,\n indexInParent: number | null\n ) {\n const layoutConfig = this.toConfig();\n\n const popoutLayoutConfig: ResolvedPopoutLayoutConfig = {\n root: rootItemConfig,\n openPopouts: [],\n settings: layoutConfig.settings,\n dimensions: layoutConfig.dimensions,\n header: layoutConfig.header,\n window,\n parentId,\n indexInParent,\n resolved: true,\n }\n\n return this.createPopoutFromPopoutLayoutConfig(popoutLayoutConfig);\n }\n\n /** @internal */\n createPopoutFromPopoutLayoutConfig(config: ResolvedPopoutLayoutConfig): BrowserPopout {\n const configWindow = config.window;\n const initialWindow: Rect = {\n left: configWindow.left ?? (globalThis.screenX || globalThis.screenLeft + 20),\n top: configWindow.top ?? (globalThis.screenY || globalThis.screenTop + 20),\n width: configWindow.width ?? 500,\n height: configWindow.height ?? 309,\n };\n\n const browserPopout = new BrowserPopout(config, initialWindow, this);\n\n browserPopout.on('initialised', () => this.emit('windowOpened', browserPopout));\n browserPopout.on('closed', () => this.reconcilePopoutWindows());\n\n this._openPopouts.push(browserPopout);\n\n if (this.layoutConfig.settings.closePopoutsOnUnload && !this._windowBeforeUnloadListening) {\n globalThis.addEventListener('beforeunload', this._windowBeforeUnloadListener, { passive: true });\n this._windowBeforeUnloadListening = true;\n }\n\n return browserPopout;\n }\n\n /**\n * Closes all Open Popouts\n * Applications can call this method when a page is unloaded to remove its open popouts\n */\n\n closeAllOpenPopouts() {\n for (let i = 0; i < this._openPopouts.length; i++) {\n this._openPopouts[i].close();\n }\n\n this._openPopouts.length = 0;\n\n if (this._windowBeforeUnloadListening) {\n globalThis.removeEventListener('beforeunload', this._windowBeforeUnloadListener);\n this._windowBeforeUnloadListening = false;\n }\n }\n\n /**\n * Attaches DragListener to any given DOM element\n * and turns it into a way of creating new ComponentItems\n * by 'dragging' the DOM element into the layout\n *\n * @param element - The HTML element which will be listened to for commencement of drag.\n * @param componentTypeOrItemConfigCallback - Type of component to be created, or a callback which will provide the ItemConfig\n * to be used to create the component.\n * @param componentState - Optional initial state of component. This will be ignored if componentTypeOrFtn is a function.\n *\n * @returns an opaque object that identifies the DOM element\n\t * and the attached itemConfig. This can be used in\n\t * removeDragSource() later to get rid of the drag listeners.\n */\n newDragSource(element: HTMLElement, itemConfigCallback: () => (DragSource.ComponentItemConfig | ComponentItemConfig)): DragSource;\n /** @deprecated will be replaced in version 3 with newDragSource(element: HTMLElement, itemConfig: ComponentItemConfig) */\n newDragSource(element: HTMLElement, componentType: JsonValue, componentState?: JsonValue, title?: JsonValue, id?: string): DragSource;\n newDragSource(element: HTMLElement,\n componentTypeOrItemConfigCallback: JsonValue | (() => (DragSource.ComponentItemConfig | ComponentItemConfig)),\n componentState?: JsonValue,\n title?: string,\n id?: string,\n ): DragSource {\n const dragSource = new DragSource(this, element, [], componentTypeOrItemConfigCallback, componentState, title, id);\n this._dragSources.push(dragSource);\n\n return dragSource;\n }\n\n /**\n\t * Removes a DragListener added by createDragSource() so the corresponding\n\t * DOM element is not a drag source any more.\n\t */\n\tremoveDragSource(dragSource: DragSource): void {\n\t\tremoveFromArray(dragSource, this._dragSources );\n\t\tdragSource.destroy();\n }\n\n /** @internal */\n startComponentDrag(x: number, y: number, dragListener: DragListener, componentItem: ComponentItem, stack: Stack): void {\n new DragProxy(\n x,\n y,\n dragListener,\n this,\n componentItem,\n stack\n );\n }\n\n /**\n * Programmatically focuses an item. This focuses the specified component item\n * and the item emits a focus event\n *\n * @param item - The component item to be focused\n * @param suppressEvent - Whether to emit focus event\n */\n focusComponent(item: ComponentItem, suppressEvent = false): void {\n item.focus(suppressEvent);\n }\n\n /**\n * Programmatically blurs (defocuses) the currently focused component.\n * If a component item is focused, then it is blurred and and the item emits a blur event\n *\n * @param item - The component item to be blurred\n * @param suppressEvent - Whether to emit blur event\n */\n clearComponentFocus(suppressEvent = false): void {\n this.setFocusedComponentItem(undefined, suppressEvent);\n }\n\n /**\n * Programmatically focuses a component item or removes focus (blurs) from an existing focused component item.\n *\n * @param item - If defined, specifies the component item to be given focus. If undefined, clear component focus.\n * @param suppressEvents - Whether to emit focus and blur events\n * @internal\n */\n setFocusedComponentItem(item: ComponentItem | undefined, suppressEvents = false): void {\n if (item !== this._focusedComponentItem) {\n\n let newFocusedParentItem: ComponentParentableItem | undefined;\n if (item === undefined) {\n newFocusedParentItem === undefined;\n } else {\n newFocusedParentItem = item.parentItem;\n }\n\n if (this._focusedComponentItem !== undefined) {\n const oldFocusedItem = this._focusedComponentItem;\n this._focusedComponentItem = undefined;\n oldFocusedItem.setBlurred(suppressEvents);\n const oldFocusedParentItem = oldFocusedItem.parentItem;\n if (newFocusedParentItem === oldFocusedParentItem) {\n newFocusedParentItem = undefined;\n } else {\n oldFocusedParentItem.setFocusedValue(false);\n }\n }\n\n if (item !== undefined) {\n this._focusedComponentItem = item;\n item.setFocused(suppressEvents);\n if (newFocusedParentItem !== undefined) {\n newFocusedParentItem.setFocusedValue(true);\n }\n }\n }\n }\n\n /** @internal */\n private createContentItemFromConfig(config: ResolvedItemConfig, parent: ContentItem): ContentItem {\n switch (config.type) {\n case ItemType.ground: throw new AssertError('LMCCIFC68871');\n case ItemType.row: return new RowOrColumn(false, this, config as ResolvedRowOrColumnItemConfig, parent);\n case ItemType.column: return new RowOrColumn(true, this, config as ResolvedRowOrColumnItemConfig, parent);\n case ItemType.stack: return new Stack(this, config as ResolvedStackItemConfig, parent);\n case ItemType.component:\n return new ComponentItem(this, config as ResolvedComponentItemConfig, parent as Stack);\n default:\n throw new UnreachableCaseError('CCC913564', config.type, 'Invalid Config Item type specified');\n }\n }\n\n /**\n * This should only be called from stack component.\n * Stack will look after docking processing associated with maximise/minimise\n * @internal\n **/\n setMaximisedStack(stack: Stack | undefined): void {\n if (stack === undefined) {\n if (this._maximisedStack !== undefined) {\n this.processMinimiseMaximisedStack();\n }\n } else {\n if (stack !== this._maximisedStack) {\n if (this._maximisedStack !== undefined) {\n this.processMinimiseMaximisedStack();\n }\n\n this.processMaximiseStack(stack);\n }\n }\n }\n\n checkMinimiseMaximisedStack(): void {\n if (this._maximisedStack !== undefined) {\n this._maximisedStack.minimise();\n }\n }\n\n // showAllActiveContentItems() was called from ContentItem.show(). Not sure what its purpose was so have commented out\n // Everything seems to work ok without this. Have left commented code just in case there was a reason for it becomes\n // apparent\n\n // /** @internal */\n // showAllActiveContentItems(): void {\n // const allStacks = this.getAllStacks();\n\n // for (let i = 0; i < allStacks.length; i++) {\n // const stack = allStacks[i];\n // const activeContentItem = stack.getActiveComponentItem();\n\n // if (activeContentItem !== undefined) {\n // if (!(activeContentItem instanceof ComponentItem)) {\n // throw new AssertError('LMSAACIS22298');\n // } else {\n // activeContentItem.container.show();\n // }\n // }\n // }\n // }\n\n // hideAllActiveContentItems() was called from ContentItem.hide(). Not sure what its purpose was so have commented out\n // Everything seems to work ok without this. Have left commented code just in case there was a reason for it becomes\n // apparent\n\n // /** @internal */\n // hideAllActiveContentItems(): void {\n // const allStacks = this.getAllStacks();\n\n // for (let i = 0; i < allStacks.length; i++) {\n // const stack = allStacks[i];\n // const activeContentItem = stack.getActiveComponentItem();\n\n // if (activeContentItem !== undefined) {\n // if (!(activeContentItem instanceof ComponentItem)) {\n // throw new AssertError('LMSAACIH22298');\n // } else {\n // activeContentItem.container.hide();\n // }\n // }\n // }\n // }\n\n /** @internal */\n private cleanupBeforeMaximisedStackDestroyed(event: EventEmitter.BubblingEvent) {\n\t\tif (this._maximisedStack !== null && this._maximisedStack === event.target) {\n\t\t\tthis._maximisedStack.off('beforeItemDestroyed', this._maximisedStackBeforeDestroyedListener);\n\t\t\tthis._maximisedStack = undefined;\n\t\t}\n }\n\n /**\n * This method is used to get around sandboxed iframe restrictions.\n * If 'allow-top-navigation' is not specified in the iframe's 'sandbox' attribute\n * (as is the case with codepens) the parent window is forbidden from calling certain\n * methods on the child, such as window.close() or setting document.location.href.\n *\n * This prevented GoldenLayout popouts from popping in in codepens. The fix is to call\n * _$closeWindow on the child window's gl instance which (after a timeout to disconnect\n * the invoking method from the close call) closes itself.\n *\n * @internal\n */\n closeWindow(): void {\n globalThis.setTimeout(() => globalThis.close(), 1);\n }\n\n /** @internal */\n getArea(x: number, y: number): ContentItem.Area | null {\n let matchingArea = null;\n let smallestSurface = Infinity;\n\n for (let i = 0; i < this._itemAreas.length; i++) {\n const area = this._itemAreas[i];\n\n if (\n x >= area.x1 &&\n x < area.x2 && // x2 is not included in area\n y >= area.y1 &&\n y < area.y2 && // y2 is not included in area\n smallestSurface > area.surface\n ) {\n smallestSurface = area.surface;\n matchingArea = area;\n }\n }\n\n return matchingArea;\n }\n\n /** @internal */\n calculateItemAreas(): void {\n const allContentItems = this.getAllContentItems();\n /**\n * If the last item is dragged out, highlight the entire container size to\n * allow to re-drop it. this.ground.contentiItems.length === 0 at this point\n *\n * Don't include ground into the possible drop areas though otherwise since it\n * will used for every gap in the layout, e.g. splitters\n */\n const groundItem = this._groundItem;\n if (groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMCIAR44365');\n } else {\n if (allContentItems.length === 1) {\n // No root ContentItem (just Ground ContentItem)\n const groundArea = groundItem.getElementArea();\n if (groundArea === null) {\n throw new UnexpectedNullError('LMCIARA44365')\n } else {\n this._itemAreas = [groundArea];\n }\n return;\n } else {\n if (groundItem.contentItems[0].isStack) {\n // if root is Stack, then split stack and sides of Layout are same, so skip sides\n this._itemAreas = [];\n } else {\n // sides of layout\n this._itemAreas = groundItem.createSideAreas();\n }\n\n for (let i = 0; i < allContentItems.length; i++) {\n const stack = allContentItems[i];\n if (ContentItem.isStack(stack)) {\n const area = stack.getArea();\n\n if (area === null) {\n continue;\n } else {\n this._itemAreas.push(area);\n const stackContentAreaDimensions = stack.contentAreaDimensions;\n if (stackContentAreaDimensions === undefined) {\n throw new UnexpectedUndefinedError('LMCIASC45599');\n } else {\n const highlightArea = stackContentAreaDimensions.header.highlightArea\n const surface = (highlightArea.x2 - highlightArea.x1) * (highlightArea.y2 - highlightArea.y1);\n\n const header: ContentItem.Area = {\n x1: highlightArea.x1,\n x2: highlightArea.x2,\n y1: highlightArea.y1,\n y2: highlightArea.y2,\n contentItem: stack,\n surface,\n };\n this._itemAreas.push(header);\n }\n }\n }\n }\n }\n }\n }\n\n /**\n * Called as part of loading a new layout (including initial init()).\n * Checks to see layout has a maximised item. If so, it maximises that item.\n * @internal\n */\n private checkLoadedLayoutMaximiseItem() {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMCLLMI43432');\n } else {\n const configMaximisedItems = this._groundItem.getConfigMaximisedItems();\n\n if (configMaximisedItems.length > 0) {\n let item = configMaximisedItems[0];\n if (ContentItem.isComponentItem(item)) {\n const stack = item.parent;\n if (stack === null) {\n throw new UnexpectedNullError('LMXLLMI69999');\n } else {\n item = stack;\n }\n }\n if (!ContentItem.isStack(item)) {\n throw new AssertError('LMCLLMI19993');\n } else {\n item.maximise();\n }\n }\n }\n }\n\n /** @internal */\n private processMaximiseStack(stack: Stack): void {\n this._maximisedStack = stack;\n stack.on('beforeItemDestroyed', this._maximisedStackBeforeDestroyedListener);\n stack.element.classList.add(DomConstants.ClassName.Maximised);\n stack.element.insertAdjacentElement('afterend', this._maximisePlaceholder);\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMMXI19993');\n } else {\n this._groundItem.element.prepend(stack.element);\n const { width, height } = getElementWidthAndHeight(this._containerElement);\n setElementWidth(stack.element, width);\n setElementHeight(stack.element, height);\n stack.updateSize(true);\n stack.focusActiveContentItem();\n this._maximisedStack.emit('maximised');\n this.emit('stateChanged');\n }\n }\n\n /** @internal */\n private processMinimiseMaximisedStack(): void {\n if (this._maximisedStack === undefined) {\n throw new AssertError('LMMMS74422');\n } else {\n const stack = this._maximisedStack;\n if (stack.parent === null) {\n throw new UnexpectedNullError('LMMI13668');\n } else {\n stack.element.classList.remove(DomConstants.ClassName.Maximised);\n this._maximisePlaceholder.insertAdjacentElement('afterend', stack.element);\n this._maximisePlaceholder.remove();\n this.updateRootSize(true);\n this._maximisedStack = undefined;\n stack.off('beforeItemDestroyed', this._maximisedStackBeforeDestroyedListener);\n stack.emit('minimised');\n this.emit('stateChanged');\n }\n }\n }\n\n /**\n * Iterates through the array of open popout windows and removes the ones\n * that are effectively closed. This is necessary due to the lack of reliably\n * listening for window.close / unload events in a cross browser compatible fashion.\n * @internal\n */\n private reconcilePopoutWindows() {\n const openPopouts: BrowserPopout[] = [];\n\n for (let i = 0; i < this._openPopouts.length; i++) {\n if (this._openPopouts[i].getWindow().closed === false) {\n openPopouts.push(this._openPopouts[i]);\n } else {\n this.emit('windowClosed', this._openPopouts[i]);\n }\n }\n\n if (this._openPopouts.length !== openPopouts.length) {\n this._openPopouts = openPopouts;\n this.emit('stateChanged');\n }\n\n }\n\n /**\n * Returns a flattened array of all content items,\n * regardles of level or type\n * @internal\n */\n private getAllContentItems() {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMGACI13130');\n } else {\n return this._groundItem.getAllContentItems();\n }\n }\n\n /**\n * Creates Subwindows (if there are any). Throws an error\n * if popouts are blocked.\n * @internal\n */\n private createSubWindows() {\n for (let i = 0; i < this.layoutConfig.openPopouts.length; i++) {\n const popoutConfig = this.layoutConfig.openPopouts[i];\n this.createPopoutFromPopoutLayoutConfig(popoutConfig);\n }\n }\n\n /**\n * Debounces resize events\n * @internal\n */\n private handleContainerResize(): void {\n if (this.resizeWithContainerAutomatically) {\n this.processResizeWithDebounce();\n }\n }\n\n /**\n * Debounces resize events\n * @internal\n */\n private processResizeWithDebounce(): void {\n if (this.resizeDebounceExtendedWhenPossible) {\n this.checkClearResizeTimeout();\n }\n\n if (this._resizeTimeoutId === undefined) {\n this._resizeTimeoutId = setTimeout(\n () => {\n this._resizeTimeoutId = undefined;\n this.beginSizeInvalidation();\n this.endSizeInvalidation();\n },\n this.resizeDebounceInterval,\n );\n }\n }\n\n private checkClearResizeTimeout() {\n if (this._resizeTimeoutId !== undefined) {\n clearTimeout(this._resizeTimeoutId);\n this._resizeTimeoutId = undefined;\n }\n }\n\n /**\n * Determines what element the layout will be created in\n * @internal\n */\n private setContainer() {\n const bodyElement = document.body;\n const containerElement = this._containerElement ?? bodyElement;\n\n if (containerElement === bodyElement) {\n this.resizeWithContainerAutomatically = true;\n\n const documentElement = document.documentElement;\n documentElement.style.height = '100%';\n documentElement.style.margin = '0';\n documentElement.style.padding = '0';\n documentElement.style.overflow = 'clip';\n bodyElement.style.height = '100%';\n bodyElement.style.margin = '0';\n bodyElement.style.padding = '0';\n bodyElement.style.overflow = 'clip';\n }\n\n this._containerElement = containerElement;\n }\n\n /**\n * Called when the window is closed or the user navigates away\n * from the page\n * @internal\n * @deprecated to be removed in version 3\n */\n private onBeforeUnload(): void {\n this.destroy();\n }\n\n /**\n * Adjusts the number of columns to be lower to fit the screen and still maintain minItemWidth.\n * @internal\n */\n private adjustColumnsResponsive() {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMACR20883');\n } else {\n this._firstLoad = false;\n // If there is no min width set, or not content items, do nothing.\n if (this.useResponsiveLayout() &&\n !this._updatingColumnsResponsive &&\n this._groundItem.contentItems.length > 0 &&\n this._groundItem.contentItems[0].isRow)\n {\n if (this._groundItem === undefined || this._width === null) {\n throw new UnexpectedUndefinedError('LMACR77412');\n } else {\n // If there is only one column, do nothing.\n const columnCount = this._groundItem.contentItems[0].contentItems.length;\n if (columnCount <= 1) {\n return;\n } else {\n // If they all still fit, do nothing.\n const minItemWidth = this.layoutConfig.dimensions.defaultMinItemWidth;\n const totalMinWidth = columnCount * minItemWidth;\n if (totalMinWidth <= this._width) {\n return;\n } else {\n // Prevent updates while it is already happening.\n this._updatingColumnsResponsive = true;\n\n // Figure out how many columns to stack, and put them all in the first stack container.\n const finalColumnCount = Math.max(Math.floor(this._width / minItemWidth), 1);\n const stackColumnCount = columnCount - finalColumnCount;\n\n const rootContentItem = this._groundItem.contentItems[0];\n const allStacks = this.getAllStacks();\n if (allStacks.length === 0) {\n throw new AssertError('LMACRS77413')\n } else {\n const firstStackContainer = allStacks[0];\n for (let i = 0; i < stackColumnCount; i++) {\n // Stack from right.\n const column = rootContentItem.contentItems[rootContentItem.contentItems.length - 1];\n this.addChildContentItemsToContainer(firstStackContainer, column);\n }\n\n this._updatingColumnsResponsive = false;\n }\n }\n }\n }\n }\n }\n }\n\n /**\n * Determines if responsive layout should be used.\n *\n * @returns True if responsive layout should be used; otherwise false.\n * @internal\n */\n private useResponsiveLayout() {\n const settings = this.layoutConfig.settings;\n const alwaysResponsiveMode = settings.responsiveMode === ResponsiveMode.always;\n const onLoadResponsiveModeAndFirst = settings.responsiveMode === ResponsiveMode.onload && this._firstLoad;\n return alwaysResponsiveMode || onLoadResponsiveModeAndFirst;\n }\n\n /**\n * Adds all children of a node to another container recursively.\n * @param container - Container to add child content items to.\n * @param node - Node to search for content items.\n * @internal\n */\n private addChildContentItemsToContainer(container: ContentItem, node: ContentItem) {\n const contentItems = node.contentItems;\n if (node instanceof Stack) {\n for (let i = 0; i < contentItems.length; i++) {\n const item = contentItems[i];\n node.removeChild(item, true);\n container.addChild(item);\n }\n } else {\n for (let i = 0; i < contentItems.length; i++) {\n const item = contentItems[i];\n this.addChildContentItemsToContainer(container, item);\n }\n }\n }\n\n /**\n * Finds all the stacks.\n * @returns The found stack containers.\n * @internal\n */\n private getAllStacks() {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMFASC52778');\n } else {\n const stacks: Stack[] = [];\n this.findAllStacksRecursive(stacks, this._groundItem);\n\n return stacks;\n }\n }\n\n /** @internal */\n private findFirstContentItemType(type: ItemType): ContentItem | undefined {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMFFCIT82446');\n } else {\n return this.findFirstContentItemTypeRecursive(type, this._groundItem);\n }\n }\n\n /** @internal */\n private findFirstContentItemTypeRecursive(type: ItemType, node: ContentItem): ContentItem | undefined {\n const contentItems = node.contentItems;\n const contentItemCount = contentItems.length;\n if (contentItemCount === 0) {\n return undefined;\n } else {\n for (let i = 0; i < contentItemCount; i++) {\n const contentItem = contentItems[i];\n if (contentItem.type === type) {\n return contentItem;\n }\n }\n\n for (let i = 0; i < contentItemCount; i++) {\n const contentItem = contentItems[i];\n const foundContentItem = this.findFirstContentItemTypeRecursive(type, contentItem);\n if (foundContentItem !== undefined) {\n return foundContentItem;\n }\n }\n\n return undefined;\n }\n }\n\n /** @internal */\n private findFirstContentItemTypeByIdRecursive(type: ItemType, id: string, node: ContentItem): ContentItem | undefined {\n const contentItems = node.contentItems;\n const contentItemCount = contentItems.length;\n if (contentItemCount === 0) {\n return undefined;\n } else {\n for (let i = 0; i < contentItemCount; i++) {\n const contentItem = contentItems[i];\n if (contentItem.type === type && contentItem.id === id) {\n return contentItem;\n }\n }\n\n for (let i = 0; i < contentItemCount; i++) {\n const contentItem = contentItems[i];\n const foundContentItem = this.findFirstContentItemTypeByIdRecursive(type, id, contentItem);\n if (foundContentItem !== undefined) {\n return foundContentItem;\n }\n }\n\n return undefined;\n }\n }\n\n /**\n * Finds all the stack containers.\n *\n * @param stacks - Set of containers to populate.\n * @param node - Current node to process.\n * @internal\n */\n private findAllStacksRecursive(stacks: Stack[], node: ContentItem) {\n const contentItems = node.contentItems;\n for (let i = 0; i < contentItems.length; i++) {\n const item = contentItems[i];\n if (item instanceof Stack) {\n stacks.push(item);\n } else {\n if (!item.isComponent) {\n this.findAllStacksRecursive(stacks, item);\n }\n }\n }\n }\n\n /** @internal */\n private findFirstLocation(selectors: readonly LayoutManager.LocationSelector[]): LayoutManager.Location | undefined {\n const count = selectors.length;\n for (let i = 0; i < count; i++) {\n const selector = selectors[i];\n const location = this.findLocation(selector);\n if (location !== undefined) {\n return location;\n }\n }\n return undefined;\n }\n\n /** @internal */\n private findLocation(selector: LayoutManager.LocationSelector): LayoutManager.Location | undefined {\n const selectorIndex = selector.index;\n switch (selector.typeId) {\n case LayoutManager.LocationSelector.TypeId.FocusedItem: {\n if (this._focusedComponentItem === undefined) {\n return undefined\n } else {\n const parentItem = this._focusedComponentItem.parentItem;\n const parentContentItems = parentItem.contentItems;\n const parentContentItemCount = parentContentItems.length;\n if (selectorIndex === undefined) {\n return { parentItem, index: parentContentItemCount };\n } else {\n const focusedIndex = parentContentItems.indexOf(this._focusedComponentItem);\n const index = focusedIndex + selectorIndex;\n if (index < 0 || index > parentContentItemCount) {\n return undefined;\n } else {\n return { parentItem, index };\n }\n }\n }\n }\n case LayoutManager.LocationSelector.TypeId.FocusedStack: {\n if (this._focusedComponentItem === undefined) {\n return undefined\n } else {\n const parentItem = this._focusedComponentItem.parentItem;\n return this.tryCreateLocationFromParentItem(parentItem, selectorIndex);\n }\n }\n case LayoutManager.LocationSelector.TypeId.FirstStack: {\n const parentItem = this.findFirstContentItemType(ItemType.stack);\n if (parentItem === undefined) {\n return undefined;\n } else {\n return this.tryCreateLocationFromParentItem(parentItem, selectorIndex);\n }\n }\n case LayoutManager.LocationSelector.TypeId.FirstRowOrColumn: {\n let parentItem = this.findFirstContentItemType(ItemType.row);\n if (parentItem !== undefined) {\n return this.tryCreateLocationFromParentItem(parentItem, selectorIndex);\n } else {\n parentItem = this.findFirstContentItemType(ItemType.column);\n if (parentItem !== undefined) {\n return this.tryCreateLocationFromParentItem(parentItem, selectorIndex);\n } else {\n return undefined;\n }\n }\n }\n case LayoutManager.LocationSelector.TypeId.FirstRow: {\n const parentItem = this.findFirstContentItemType(ItemType.row);\n if (parentItem === undefined) {\n return undefined;\n } else {\n return this.tryCreateLocationFromParentItem(parentItem, selectorIndex);\n }\n }\n case LayoutManager.LocationSelector.TypeId.FirstColumn: {\n const parentItem = this.findFirstContentItemType(ItemType.column);\n if (parentItem === undefined) {\n return undefined;\n } else {\n return this.tryCreateLocationFromParentItem(parentItem, selectorIndex);\n }\n }\n case LayoutManager.LocationSelector.TypeId.Empty: {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMFLRIF18244');\n } else {\n if (this.rootItem !== undefined) {\n return undefined;\n } else {\n if (selectorIndex === undefined || selectorIndex === 0)\n return { parentItem: this._groundItem, index: 0 };\n else {\n return undefined;\n }\n }\n }\n }\n case LayoutManager.LocationSelector.TypeId.Root: {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMFLF18244');\n } else {\n const groundContentItems = this._groundItem.contentItems;\n if (groundContentItems.length === 0) {\n if (selectorIndex === undefined || selectorIndex === 0)\n return { parentItem: this._groundItem, index: 0 };\n else {\n return undefined;\n }\n } else {\n const parentItem = groundContentItems[0];\n return this.tryCreateLocationFromParentItem(parentItem, selectorIndex);\n }\n }\n }\n }\n }\n\n /** @internal */\n private tryCreateLocationFromParentItem(parentItem: ContentItem,\n selectorIndex: number | undefined\n ): LayoutManager.Location | undefined {\n const parentContentItems = parentItem.contentItems;\n const parentContentItemCount = parentContentItems.length;\n if (selectorIndex === undefined) {\n return { parentItem, index: parentContentItemCount };\n } else {\n if (selectorIndex < 0 || selectorIndex > parentContentItemCount) {\n return undefined;\n } else {\n return { parentItem, index: selectorIndex };\n }\n }\n }\n}\n\n/** @public */\nexport namespace LayoutManager {\n export type BeforeVirtualRectingEvent = (this: void, count: number) => void;\n export type AfterVirtualRectingEvent = (this: void) => void;\n\n /** @internal */\n export interface ConstructorParameters {\n constructorOrSubWindowLayoutConfig: LayoutConfig | undefined;\n isSubWindow: boolean;\n containerElement: HTMLElement | undefined;\n }\n\n /** @internal */\n export function createMaximisePlaceElement(document: Document): HTMLElement {\n const element = document.createElement('div');\n element.classList.add(DomConstants.ClassName.MaximisePlace);\n return element;\n }\n\n /** @internal */\n export function createTabDropPlaceholderElement(document: Document): HTMLElement {\n const element = document.createElement('div');\n element.classList.add(DomConstants.ClassName.DropTabPlaceholder);\n return element;\n }\n\n /**\n * Specifies a location of a ContentItem without referencing the content item.\n * Used to specify where a new item is to be added\n * @public\n */\n export interface Location {\n parentItem: ContentItem;\n index: number;\n }\n\n /**\n * A selector used to specify a unique location in the layout\n * @public\n */\n export interface LocationSelector {\n /** Specifies selector algorithm */\n typeId: LocationSelector.TypeId;\n /** Used by algorithm to determine index in found ContentItem */\n index?: number;\n }\n\n /** @public */\n export namespace LocationSelector {\n export const enum TypeId {\n /** Stack with focused Item. Index specifies offset from index of focused item (eg 1 is the position after focused item) */\n FocusedItem,\n /** Stack with focused Item. Index specfies ContentItems index */\n FocusedStack,\n /** First stack found in layout */\n FirstStack,\n /** First Row or Column found in layout (rows are searched first) */\n FirstRowOrColumn,\n /** First Row in layout */\n FirstRow,\n /** First Column in layout */\n FirstColumn,\n /** Finds a location if layout is empty. The found location will be the root ContentItem. */\n Empty,\n /** Finds root if layout is empty, otherwise a child under root */\n Root,\n }\n }\n\n /**\n * Default LocationSelectors array used if none is specified. Will always find a location.\n * @public\n */\n export const defaultLocationSelectors: readonly LocationSelector[] = [\n { typeId: LocationSelector.TypeId.FocusedStack, index: undefined },\n { typeId: LocationSelector.TypeId.FirstStack, index: undefined },\n { typeId: LocationSelector.TypeId.FirstRowOrColumn, index: undefined },\n { typeId: LocationSelector.TypeId.Root, index: undefined },\n ];\n\n /**\n * LocationSelectors to try to get location next to existing focused item\n * @public\n */\n export const afterFocusedItemIfPossibleLocationSelectors: readonly LocationSelector[] = [\n { typeId: LocationSelector.TypeId.FocusedItem, index: 1 },\n { typeId: LocationSelector.TypeId.FirstStack, index: undefined },\n { typeId: LocationSelector.TypeId.FirstRowOrColumn, index: undefined },\n { typeId: LocationSelector.TypeId.Root, index: undefined },\n ];\n}\n","import { LayoutConfig } from './config/config';\nimport { ResolvedComponentItemConfig, ResolvedLayoutConfig, ResolvedPopoutLayoutConfig } from './config/resolved-config';\nimport { ComponentContainer } from './container/component-container';\nimport { BindError } from './errors/external-error';\nimport { UnexpectedUndefinedError } from './errors/internal-error';\nimport { LayoutManager } from './layout-manager';\nimport { DomConstants } from './utils/dom-constants';\nimport { I18nStringId, i18nStrings } from './utils/i18n-strings';\n\n/** @public */\nexport class VirtualLayout extends LayoutManager {\n /**\n * @deprecated Use {@link (VirtualLayout:class).bindComponentEvent} and\n * {@link (VirtualLayout:class).unbindComponentEvent} with virtual components\n */\n getComponentEvent: VirtualLayout.GetComponentEventHandler | undefined;\n /**\n * @deprecated Use {@link (VirtualLayout:class).bindComponentEvent} and\n * {@link (VirtualLayout:class).unbindComponentEvent} with virtual components\n */\n releaseComponentEvent: VirtualLayout.ReleaseComponentEventHandler | undefined;\n\n bindComponentEvent: VirtualLayout.BindComponentEventHandler | undefined;\n unbindComponentEvent: VirtualLayout.UnbindComponentEventHandler | undefined;\n\n /** @internal @deprecated use while constructor is not determinate */\n private _bindComponentEventHanlderPassedInConstructor = false; // remove when constructor is determinate\n /** @internal @deprecated use while constructor is not determinate */\n private _creationTimeoutPassed = false; // remove when constructor is determinate\n\n /**\n * @param container - A Dom HTML element. Defaults to body\n * @param bindComponentEventHandler - Event handler to bind components\n * @param bindComponentEventHandler - Event handler to unbind components\n * If bindComponentEventHandler is defined, then constructor will be determinate. It will always call the init()\n * function and the init() function will always complete. This means that the bindComponentEventHandler will be called\n * if constructor is for a popout window. Make sure bindComponentEventHandler is ready for events.\n */\n constructor(\n container?: HTMLElement,\n bindComponentEventHandler?: VirtualLayout.BindComponentEventHandler,\n unbindComponentEventHandler?: VirtualLayout.UnbindComponentEventHandler,\n );\n /** @deprecated specify layoutConfig in {@link (LayoutManager:class).loadLayout} */\n constructor(config: LayoutConfig, container?: HTMLElement);\n /** @internal */\n constructor(configOrOptionalContainer: LayoutConfig | HTMLElement | undefined,\n containerOrBindComponentEventHandler: HTMLElement | VirtualLayout.BindComponentEventHandler | undefined,\n unbindComponentEventHandler: VirtualLayout.UnbindComponentEventHandler | undefined,\n skipInit: true,\n );\n /** @internal */\n constructor(configOrOptionalContainer: LayoutConfig | HTMLElement | undefined,\n containerOrBindComponentEventHandler?: HTMLElement | VirtualLayout.BindComponentEventHandler,\n unbindComponentEventHandler?: VirtualLayout.UnbindComponentEventHandler,\n skipInit?: true,\n ) {\n super(VirtualLayout.createLayoutManagerConstructorParameters(configOrOptionalContainer, containerOrBindComponentEventHandler));\n\n if (containerOrBindComponentEventHandler !== undefined) {\n if (typeof containerOrBindComponentEventHandler === 'function') {\n this.bindComponentEvent = containerOrBindComponentEventHandler;\n this._bindComponentEventHanlderPassedInConstructor = true;\n\n if (unbindComponentEventHandler !== undefined) {\n this.unbindComponentEvent = unbindComponentEventHandler;\n }\n }\n }\n\n if (!this._bindComponentEventHanlderPassedInConstructor) {\n // backward compatibility\n\n if (this.isSubWindow) {\n // document.body.style.visibility = 'hidden';\n // Set up layoutConfig since constructor is not determinate and may exit early. Other functions may need\n // this.layoutConfig. this.layoutConfig is again calculated in the same way when init() completes.\n // Remove this when constructor is determinate.\n if (this._constructorOrSubWindowLayoutConfig === undefined) {\n throw new UnexpectedUndefinedError('VLC98823');\n } else {\n const resolvedLayoutConfig = LayoutConfig.resolve(this._constructorOrSubWindowLayoutConfig);\n // remove root from layoutConfig\n this.layoutConfig = {\n ...resolvedLayoutConfig,\n root: undefined,\n }\n }\n }\n }\n\n if (skipInit !== true) {\n if (!this.deprecatedConstructor) {\n this.init();\n }\n }\n }\n\n override destroy(): void {\n this.bindComponentEvent = undefined;\n this.unbindComponentEvent = undefined;\n\n super.destroy();\n }\n\n\n /**\n * Creates the actual layout. Must be called after all initial components\n * are registered. Recurses through the configuration and sets up\n * the item tree.\n *\n * If called before the document is ready it adds itself as a listener\n * to the document.ready event\n * @deprecated LayoutConfig should not be loaded in {@link (LayoutManager:class)} constructor, but rather in a\n * {@link (LayoutManager:class).loadLayout} call. If LayoutConfig is not specified in {@link (LayoutManager:class)} constructor,\n * then init() will be automatically called internally and should not be called externally.\n */\n override init(): void {\n\n /**\n * If the document isn't ready yet, wait for it.\n */\n if (!this._bindComponentEventHanlderPassedInConstructor && (document.readyState === 'loading' || document.body === null)) {\n document.addEventListener('DOMContentLoaded', () => this.init(), { passive: true });\n return;\n }\n\n /**\n * If this is a subwindow, wait a few milliseconds for the original\n * page's js calls to be executed, then replace the bodies content\n * with GoldenLayout\n */\n if (!this._bindComponentEventHanlderPassedInConstructor && this.isSubWindow === true && !this._creationTimeoutPassed) {\n setTimeout(() => this.init(), 7);\n this._creationTimeoutPassed = true;\n return;\n }\n\n if (this.isSubWindow === true) {\n if (!this._bindComponentEventHanlderPassedInConstructor) {\n this.clearHtmlAndAdjustStylesForSubWindow();\n }\n\n // Expose this instance on the window object to allow the opening window to interact with it\n window.__glInstance = this;\n }\n\n super.init();\n }\n\n /**\n * Clears existing HTML and adjusts style to make window suitable to be a popout sub window\n * Curently is automatically called when window is a subWindow and bindComponentEvent is not passed in the constructor\n * If bindComponentEvent is not passed in the constructor, the application must either call this function explicitly or\n * (preferably) make the window suitable as a subwindow.\n * In the future, it is planned that this function is NOT automatically called in any circumstances. Applications will\n * need to determine whether a window is a Golden Layout popout window and either call this function explicitly or\n * hide HTML not relevant to the popout.\n * See apitest for an example of how HTML is hidden when popout windows are displayed\n */\n clearHtmlAndAdjustStylesForSubWindow(): void {\n const headElement = document.head;\n\n const appendNodeLists = new Array>(4);\n appendNodeLists[0] = document.querySelectorAll('body link');\n appendNodeLists[1] = document.querySelectorAll('body style');\n appendNodeLists[2] = document.querySelectorAll('template');\n appendNodeLists[3] = document.querySelectorAll('.gl_keep');\n\n for (let listIdx = 0; listIdx < appendNodeLists.length; listIdx++) {\n const appendNodeList = appendNodeLists[listIdx];\n for (let nodeIdx = 0; nodeIdx < appendNodeList.length; nodeIdx++) {\n const node = appendNodeList[nodeIdx];\n headElement.appendChild(node);\n }\n }\n\n const bodyElement = document.body;\n bodyElement.innerHTML = '';\n bodyElement.style.visibility = 'visible';\n this.checkAddDefaultPopinButton();\n\n /*\n * This seems a bit pointless, but actually causes a reflow/re-evaluation getting around\n * slickgrid's \"Cannot find stylesheet.\" bug in chrome\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const x = document.body.offsetHeight;\n }\n /**\n * Will add button if not popinOnClose specified in settings\n * @returns true if added otherwise false\n */\n checkAddDefaultPopinButton(): boolean {\n if (this.layoutConfig.settings.popInOnClose) {\n return false;\n } else {\n const popInButtonElement = document.createElement('div');\n popInButtonElement.classList.add(DomConstants.ClassName.Popin);\n popInButtonElement.setAttribute('title', this.layoutConfig.header.dock);\n const iconElement = document.createElement('div');\n iconElement.classList.add(DomConstants.ClassName.Icon);\n const bgElement = document.createElement('div');\n bgElement.classList.add(DomConstants.ClassName.Bg);\n popInButtonElement.appendChild(iconElement);\n popInButtonElement.appendChild(bgElement);\n popInButtonElement.addEventListener('click', () => this.emit('popIn'));\n document.body.appendChild(popInButtonElement);\n return true;\n }\n }\n\n /** @internal */\n override bindComponent(container: ComponentContainer, itemConfig: ResolvedComponentItemConfig): ComponentContainer.BindableComponent {\n if (this.bindComponentEvent !== undefined) {\n const bindableComponent = this.bindComponentEvent(container, itemConfig);\n return bindableComponent;\n } else {\n if (this.getComponentEvent !== undefined) {\n return {\n virtual: false,\n component: this.getComponentEvent(container, itemConfig),\n }\n } else {\n // There is no component registered for this type, and we don't have a getComponentEvent defined.\n // This might happen when the user pops out a dialog and the component types are not registered upfront.\n const text = i18nStrings[I18nStringId.ComponentTypeNotRegisteredAndBindComponentEventHandlerNotAssigned];\n const message = `${text}: ${JSON.stringify(itemConfig)}`\n throw new BindError(message);\n }\n }\n }\n\n /** @internal */\n override unbindComponent(container: ComponentContainer, virtual: boolean, component: ComponentContainer.Component | undefined): void {\n if (this.unbindComponentEvent !== undefined) {\n this.unbindComponentEvent(container);\n } else {\n if (!virtual && this.releaseComponentEvent !== undefined) {\n if (component === undefined) {\n throw new UnexpectedUndefinedError('VCUCRCU333998');\n } else {\n this.releaseComponentEvent(container, component);\n }\n }\n }\n }\n}\n\n/** @public */\nexport namespace VirtualLayout {\n /**\n * @deprecated Use virtual components with {@link (VirtualLayout:class).bindComponentEvent} and\n * {@link (VirtualLayout:class).unbindComponentEvent} events.\n */\n export type GetComponentEventHandler =\n (this: void, container: ComponentContainer, itemConfig: ResolvedComponentItemConfig) => ComponentContainer.Component;\n /**\n * @deprecated Use virtual components with {@link (VirtualLayout:class).bindComponentEvent} and\n * {@link (VirtualLayout:class).unbindComponentEvent} events.\n */\n export type ReleaseComponentEventHandler =\n (this: void, container: ComponentContainer, component: ComponentContainer.Component) => void;\n\n export type BindComponentEventHandler =\n (this: void, container: ComponentContainer, itemConfig: ResolvedComponentItemConfig) => ComponentContainer.BindableComponent;\n export type UnbindComponentEventHandler =\n (this: void, container: ComponentContainer) => void;\n\n export type BeforeVirtualRectingEvent = (this: void) => void;\n\n /** @internal\n * Veriable to hold the state whether we already checked if we are running in a sub window.\n * Fixes popout and creation of nested golden-layouts.\n */\n let subWindowChecked = false;\n\n /** @internal */\n export function createLayoutManagerConstructorParameters(configOrOptionalContainer: LayoutConfig | HTMLElement | undefined,\n containerOrBindComponentEventHandler?: HTMLElement | VirtualLayout.BindComponentEventHandler):\n LayoutManager.ConstructorParameters\n {\n const windowConfigKey = subWindowChecked ? null : new URL(document.location.href).searchParams.get('gl-window');\n subWindowChecked = true;\n const isSubWindow = windowConfigKey !== null;\n\n let containerElement: HTMLElement | undefined;\n let config: LayoutConfig | undefined;\n if (windowConfigKey !== null) {\n const windowConfigStr = localStorage.getItem(windowConfigKey);\n if (windowConfigStr === null) {\n throw new Error('Null gl-window Config');\n }\n localStorage.removeItem(windowConfigKey);\n const minifiedWindowConfig = JSON.parse(windowConfigStr) as ResolvedPopoutLayoutConfig;\n const resolvedConfig = ResolvedLayoutConfig.unminifyConfig(minifiedWindowConfig);\n config = LayoutConfig.fromResolved(resolvedConfig)\n\n if (configOrOptionalContainer instanceof HTMLElement) {\n containerElement = configOrOptionalContainer;\n }\n } else {\n if (configOrOptionalContainer === undefined) {\n config = undefined;\n } else {\n if (configOrOptionalContainer instanceof HTMLElement) {\n config = undefined;\n containerElement = configOrOptionalContainer;\n } else {\n // backwards compatibility\n config = configOrOptionalContainer;\n }\n }\n\n if (containerElement === undefined) {\n if (containerOrBindComponentEventHandler instanceof HTMLElement) {\n containerElement = containerOrBindComponentEventHandler;\n }\n }\n }\n\n return {\n constructorOrSubWindowLayoutConfig: config,\n isSubWindow,\n containerElement,\n };\n }\n}\n","/* eslint indent: [\"error\", 2, { \"SwitchCase\": 1 }] */\n/* eslint no-param-reassign: [\"error\",\n{ \"props\": true, \"ignorePropertyModificationsFor\": [\"container\"] }] */\nimport { GoldenLayout } from 'golden-layout';\n\nconst config = {\n settings: {\n showPopoutIcon: false,\n showCloseIcon: false,\n },\n dimensions: {\n minItemHeight: 40,\n },\n content: [{\n type: 'row',\n content: [{\n type: 'column',\n width: 40,\n content: [{\n type: 'component',\n height: 67,\n isClosable: false,\n componentName: 'template',\n title: 'IC',\n componentState: { id: 'client_wrapper' },\n },\n {\n type: 'component',\n height: 33,\n isClosable: false,\n title: 'IC Options',\n componentName: 'template',\n componentState: { id: 'icoptions' },\n }]\n },\n {\n type: 'column',\n content: [{\n type: 'row',\n height: 65,\n content: [{\n type: 'stack',\n content: [{\n type: 'component',\n isClosable: false,\n title: 'Main',\n componentName: 'template',\n componentState: { id: 'mainmenu' },\n },\n {\n type: 'component',\n isClosable: false,\n title: 'Log',\n componentName: 'template',\n componentState: { id: 'log' },\n }],\n },\n {\n type: 'stack',\n width: 30,\n content: [{\n type: 'component',\n isClosable: false,\n title: 'Music',\n componentName: 'template',\n componentState: { id: 'music' },\n },\n {\n type: 'component',\n isClosable: false,\n title: 'Players',\n componentName: 'template',\n componentState: { id: 'players' },\n }],\n }],\n },\n {\n type: 'row',\n content: [{\n type: 'component',\n title: 'OOC',\n componentName: 'template',\n componentState: { id: 'ooc' },\n }],\n }],\n }],\n }],\n};\n\n\nconst configMobile = {\n settings: {\n showPopoutIcon: false,\n showCloseIcon: false,\n },\n dimensions: {\n minItemHeight: 40,\n },\n content: [{\n type: 'row',\n content: [{\n type: 'column',\n content: [{\n type: 'component',\n isClosable: false,\n reorderEnabled: false,\n componentName: 'template',\n title: 'IC',\n componentState: { id: 'client_wrapper' },\n height: 56 // Adjust the height proportion as needed\n },\n {\n type: 'stack',\n height: 44,\n content: [{\n type: 'component',\n isClosable: false,\n reorderEnabled: false,\n title: 'IC Options',\n componentName: 'template',\n componentState: { id: 'icoptions' },\n },\n {\n type: 'component',\n isClosable: false,\n reorderEnabled: false,\n title: 'Main',\n componentName: 'template',\n componentState: { id: 'mainmenu' },\n },\n {\n type: 'component',\n isClosable: false,\n reorderEnabled: false,\n title: 'Log',\n componentName: 'template',\n componentState: { id: 'log' },\n },\n {\n type: 'component',\n isClosable: false,\n reorderEnabled: false,\n title: 'Music',\n componentName: 'template',\n componentState: { id: 'music' },\n },\n {\n type: 'component',\n isClosable: false,\n reorderEnabled: false,\n title: 'OOC',\n componentName: 'template',\n componentState: { id: 'ooc' },\n }]\n }]\n }]\n }]\n}\n\n\nconst isMobileDevice = window.innerWidth <= window.innerHeight; \n\nconst golden = new GoldenLayout();\ngolden.registerComponentFactoryFunction('template', (container, componentState) => {\n const template = document.querySelector(`#${componentState.id}`);\n container.element.innerHTML = template.innerHTML;\n});\nif (isMobileDevice){\n golden.loadLayout(configMobile);\n}\nelse {\n golden.loadLayout(config);\n}\n","import { LayoutConfig } from './config/config';\nimport { ResolvedComponentItemConfig } from './config/resolved-config';\nimport { ComponentContainer } from './container/component-container';\nimport { ApiError, BindError } from './errors/external-error';\nimport { AssertError, UnexpectedUndefinedError } from './errors/internal-error';\nimport { I18nStringId, i18nStrings } from './utils/i18n-strings';\nimport { JsonValue, LogicalZIndex } from './utils/types';\nimport { deepExtendValue, ensureElementPositionAbsolute, numberToPixels, setElementDisplayVisibility, setElementHeight, setElementWidth } from './utils/utils';\nimport { VirtualLayout } from './virtual-layout';\n\n/** @public */\nexport class GoldenLayout extends VirtualLayout {\n /** @internal */\n private _componentTypesMap = new Map();\n /** @internal */\n private _getComponentConstructorFtn: GoldenLayout.GetComponentConstructorCallback;\n\n /** @internal */\n private _registeredComponentMap = new Map();\n /** @internal */\n private _virtuableComponentMap = new Map();\n /** @internal */\n private _goldenLayoutBoundingClientRect: DOMRect;\n\n /** @internal */\n private _containerVirtualRectingRequiredEventListener =\n (container: ComponentContainer, width: number, height: number) => this.handleContainerVirtualRectingRequiredEvent(container, width, height);\n /** @internal */\n private _containerVirtualVisibilityChangeRequiredEventListener =\n (container: ComponentContainer, visible: boolean) => this.handleContainerVirtualVisibilityChangeRequiredEvent(container, visible);\n /** @internal */\n private _containerVirtualZIndexChangeRequiredEventListener =\n (container: ComponentContainer, logicalZIndex: LogicalZIndex, defaultZIndex: string) =>\n this.handleContainerVirtualZIndexChangeRequiredEvent(container, logicalZIndex, defaultZIndex);\n\n /**\n * @param container - A Dom HTML element. Defaults to body\n * @param bindComponentEventHandler - Event handler to bind components\n * @param bindComponentEventHandler - Event handler to unbind components\n * If bindComponentEventHandler is defined, then constructor will be determinate. It will always call the init()\n * function and the init() function will always complete. This means that the bindComponentEventHandler will be called\n * if constructor is for a popout window. Make sure bindComponentEventHandler is ready for events.\n */\n constructor(\n container?: HTMLElement,\n bindComponentEventHandler?: VirtualLayout.BindComponentEventHandler,\n unbindComponentEventHandler?: VirtualLayout.UnbindComponentEventHandler,\n );\n /** @deprecated specify layoutConfig in {@link (LayoutManager:class).loadLayout} */\n constructor(config: LayoutConfig, container?: HTMLElement);\n /** @internal */\n constructor(configOrOptionalContainer: LayoutConfig | HTMLElement | undefined,\n containerOrBindComponentEventHandler?: HTMLElement | VirtualLayout.BindComponentEventHandler,\n unbindComponentEventHandler?: VirtualLayout.UnbindComponentEventHandler,\n ) {\n super(configOrOptionalContainer, containerOrBindComponentEventHandler, unbindComponentEventHandler, true);\n // we told VirtualLayout to not call init() (skipInit set to true) so that Golden Layout can initialise its properties before init is called\n if (!this.deprecatedConstructor) {\n this.init();\n }\n }\n\n /**\n * Register a new component type with the layout manager.\n *\n * @deprecated See {@link https://stackoverflow.com/questions/40922531/how-to-check-if-a-javascript-function-is-a-constructor}\n * instead use {@link (GoldenLayout:class).registerComponentConstructor}\n * or {@link (GoldenLayout:class).registerComponentFactoryFunction}\n */\n registerComponent(name: string,\n componentConstructorOrFactoryFtn: GoldenLayout.ComponentConstructor | GoldenLayout.ComponentFactoryFunction,\n virtual = false\n ): void {\n if (typeof componentConstructorOrFactoryFtn !== 'function') {\n throw new ApiError('registerComponent() componentConstructorOrFactoryFtn parameter is not a function')\n } else {\n if (componentConstructorOrFactoryFtn.hasOwnProperty('prototype')) {\n const componentConstructor = componentConstructorOrFactoryFtn as GoldenLayout.ComponentConstructor;\n this.registerComponentConstructor(name, componentConstructor, virtual);\n } else {\n const componentFactoryFtn = componentConstructorOrFactoryFtn as GoldenLayout.ComponentFactoryFunction;\n this.registerComponentFactoryFunction(name, componentFactoryFtn, virtual);\n }\n }\n }\n\n /**\n * Register a new component type with the layout manager.\n */\n registerComponentConstructor(typeName: string, componentConstructor: GoldenLayout.ComponentConstructor, virtual = false): void {\n if (typeof componentConstructor !== 'function') {\n throw new Error(i18nStrings[I18nStringId.PleaseRegisterAConstructorFunction]);\n }\n\n const existingComponentType = this._componentTypesMap.get(typeName);\n\n if (existingComponentType !== undefined) {\n throw new BindError(`${i18nStrings[I18nStringId.ComponentIsAlreadyRegistered]}: ${typeName}`);\n }\n\n this._componentTypesMap.set(typeName, {\n constructor: componentConstructor,\n factoryFunction: undefined,\n virtual,\n }\n );\n }\n\n /**\n * Register a new component with the layout manager.\n */\n registerComponentFactoryFunction(typeName: string, componentFactoryFunction: GoldenLayout.ComponentFactoryFunction, virtual = false): void {\n if (typeof componentFactoryFunction !== 'function') {\n throw new BindError('Please register a constructor function');\n }\n\n const existingComponentType = this._componentTypesMap.get(typeName);\n\n if (existingComponentType !== undefined) {\n throw new BindError(`${i18nStrings[I18nStringId.ComponentIsAlreadyRegistered]}: ${typeName}`);\n }\n\n this._componentTypesMap.set(typeName, {\n constructor: undefined,\n factoryFunction: componentFactoryFunction,\n virtual,\n }\n );\n }\n\n /**\n * Register a component function with the layout manager. This function should\n * return a constructor for a component based on a config.\n * This function will be called if a component type with the required name is not already registered.\n * It is recommended that applications use the {@link (VirtualLayout:class).getComponentEvent} and\n * {@link (VirtualLayout:class).releaseComponentEvent} instead of registering a constructor callback\n * @deprecated use {@link (GoldenLayout:class).registerGetComponentConstructorCallback}\n */\n registerComponentFunction(callback: GoldenLayout.GetComponentConstructorCallback): void {\n this.registerGetComponentConstructorCallback(callback);\n }\n\n /**\n * Register a callback closure with the layout manager which supplies a Component Constructor.\n * This callback should return a constructor for a component based on a config.\n * This function will be called if a component type with the required name is not already registered.\n * It is recommended that applications use the {@link (VirtualLayout:class).getComponentEvent} and\n * {@link (VirtualLayout:class).releaseComponentEvent} instead of registering a constructor callback\n */\n registerGetComponentConstructorCallback(callback: GoldenLayout.GetComponentConstructorCallback): void {\n if (typeof callback !== 'function') {\n throw new Error('Please register a callback function');\n }\n\n if (this._getComponentConstructorFtn !== undefined) {\n console.warn('Multiple component functions are being registered. Only the final registered function will be used.')\n }\n\n this._getComponentConstructorFtn = callback;\n }\n\n getRegisteredComponentTypeNames(): string[] {\n const typeNamesIterableIterator = this._componentTypesMap.keys();\n return Array.from(typeNamesIterableIterator);\n }\n\n /**\n * Returns a previously registered component instantiator. Attempts to utilize registered\n * component type by first, then falls back to the component constructor callback function (if registered).\n * If neither gets an instantiator, then returns `undefined`.\n * Note that `undefined` will return if config.componentType is not a string\n *\n * @param config - The item config\n * @public\n */\n getComponentInstantiator(config: ResolvedComponentItemConfig): GoldenLayout.ComponentInstantiator | undefined {\n let instantiator: GoldenLayout.ComponentInstantiator | undefined;\n\n const typeName = ResolvedComponentItemConfig.resolveComponentTypeName(config)\n if (typeName !== undefined) {\n instantiator = this._componentTypesMap.get(typeName);\n }\n if (instantiator === undefined) {\n if (this._getComponentConstructorFtn !== undefined) {\n instantiator = {\n constructor: this._getComponentConstructorFtn(config),\n factoryFunction: undefined,\n virtual: false,\n }\n }\n }\n\n return instantiator;\n }\n\n /** @internal */\n override bindComponent(container: ComponentContainer, itemConfig: ResolvedComponentItemConfig): ComponentContainer.BindableComponent {\n let instantiator: GoldenLayout.ComponentInstantiator | undefined;\n\n const typeName = ResolvedComponentItemConfig.resolveComponentTypeName(itemConfig);\n if (typeName !== undefined) {\n instantiator = this._componentTypesMap.get(typeName);\n }\n if (instantiator === undefined) {\n if (this._getComponentConstructorFtn !== undefined) {\n instantiator = {\n constructor: this._getComponentConstructorFtn(itemConfig),\n factoryFunction: undefined,\n virtual: false,\n }\n }\n }\n\n let result: ComponentContainer.BindableComponent;\n if (instantiator !== undefined) {\n const virtual = instantiator.virtual;\n // handle case where component is obtained by name or component constructor callback\n let componentState: JsonValue | undefined;\n if (itemConfig.componentState === undefined) {\n componentState = undefined;\n } else {\n // make copy\n componentState = deepExtendValue({}, itemConfig.componentState) as JsonValue;\n }\n\n let component: ComponentContainer.Component | undefined;\n const componentConstructor = instantiator.constructor;\n if (componentConstructor !== undefined) {\n component = new componentConstructor(container, componentState, virtual);\n } else {\n const factoryFunction = instantiator.factoryFunction;\n if (factoryFunction !== undefined) {\n component = factoryFunction(container, componentState, virtual);\n } else {\n throw new AssertError('LMBCFFU10008');\n }\n }\n\n if (virtual) {\n if (component === undefined) {\n throw new UnexpectedUndefinedError('GLBCVCU988774');\n } else {\n const virtuableComponent = component as GoldenLayout.VirtuableComponent;\n const componentRootElement = virtuableComponent.rootHtmlElement;\n if (componentRootElement === undefined) {\n throw new BindError(`${i18nStrings[I18nStringId.VirtualComponentDoesNotHaveRootHtmlElement]}: ${typeName}`);\n } else {\n ensureElementPositionAbsolute(componentRootElement);\n this.container.appendChild(componentRootElement);\n this._virtuableComponentMap.set(container, virtuableComponent);\n container.virtualRectingRequiredEvent = this._containerVirtualRectingRequiredEventListener;\n container.virtualVisibilityChangeRequiredEvent = this._containerVirtualVisibilityChangeRequiredEventListener;\n container.virtualZIndexChangeRequiredEvent = this._containerVirtualZIndexChangeRequiredEventListener;\n }\n }\n }\n\n this._registeredComponentMap.set(container, component);\n\n result = {\n virtual: instantiator.virtual,\n component,\n };\n\n } else {\n // Use getComponentEvent\n result = super.bindComponent(container, itemConfig);\n }\n\n return result;\n }\n\n /** @internal */\n override unbindComponent(container: ComponentContainer, virtual: boolean, component: ComponentContainer.Component | undefined): void {\n const registeredComponent = this._registeredComponentMap.get(container);\n if (registeredComponent === undefined) {\n super.unbindComponent(container, virtual, component); // was not created from registration so use virtual unbind events\n } else {\n const virtuableComponent = this._virtuableComponentMap.get(container);\n if (virtuableComponent !== undefined) {\n const componentRootElement = virtuableComponent.rootHtmlElement;\n if (componentRootElement === undefined) {\n throw new AssertError('GLUC77743', container.title);\n } else {\n this.container.removeChild(componentRootElement);\n this._virtuableComponentMap.delete(container);\n }\n }\n }\n }\n\n override fireBeforeVirtualRectingEvent(count: number): void {\n this._goldenLayoutBoundingClientRect = this.container.getBoundingClientRect();\n super.fireBeforeVirtualRectingEvent(count);\n }\n\n\n /** @internal */\n private handleContainerVirtualRectingRequiredEvent(container: ComponentContainer, width: number, height: number): void {\n const virtuableComponent = this._virtuableComponentMap.get(container);\n if (virtuableComponent === undefined) {\n throw new UnexpectedUndefinedError('GLHCSCE55933');\n } else {\n const rootElement = virtuableComponent.rootHtmlElement;\n if (rootElement === undefined) {\n throw new BindError(i18nStrings[I18nStringId.ComponentIsNotVirtuable] + ' ' + container.title);\n } else {\n const containerBoundingClientRect = container.element.getBoundingClientRect();\n const left = containerBoundingClientRect.left - this._goldenLayoutBoundingClientRect.left;\n rootElement.style.left = numberToPixels(left);\n const top = containerBoundingClientRect.top - this._goldenLayoutBoundingClientRect.top;\n rootElement.style.top = numberToPixels(top);\n setElementWidth(rootElement, width);\n setElementHeight(rootElement, height);\n }\n }\n }\n\n /** @internal */\n private handleContainerVirtualVisibilityChangeRequiredEvent(container: ComponentContainer, visible: boolean): void {\n const virtuableComponent = this._virtuableComponentMap.get(container);\n if (virtuableComponent === undefined) {\n throw new UnexpectedUndefinedError('GLHCVVCRE55934');\n } else {\n const rootElement = virtuableComponent.rootHtmlElement;\n if (rootElement === undefined) {\n throw new BindError(i18nStrings[I18nStringId.ComponentIsNotVirtuable] + ' ' + container.title);\n } else {\n setElementDisplayVisibility(rootElement, visible);\n }\n }\n }\n\n /** @internal */\n private handleContainerVirtualZIndexChangeRequiredEvent(container: ComponentContainer, logicalZIndex: LogicalZIndex, defaultZIndex: string) {\n const virtuableComponent = this._virtuableComponentMap.get(container);\n if (virtuableComponent === undefined) {\n throw new UnexpectedUndefinedError('GLHCVZICRE55935');\n } else {\n const rootElement = virtuableComponent.rootHtmlElement;\n if (rootElement === undefined) {\n throw new BindError(i18nStrings[I18nStringId.ComponentIsNotVirtuable] + ' ' + container.title);\n } else {\n rootElement.style.zIndex = defaultZIndex;\n }\n }\n }\n}\n\n/** @public */\nexport namespace GoldenLayout {\n export interface VirtuableComponent {\n rootHtmlElement: HTMLElement;\n }\n\n export type ComponentConstructor = new(container: ComponentContainer, state: JsonValue | undefined, virtual: boolean) => ComponentContainer.Component;\n export type ComponentFactoryFunction = (container: ComponentContainer, state: JsonValue | undefined, virtual: boolean) => ComponentContainer.Component | undefined;\n export type GetComponentConstructorCallback = (this: void, config: ResolvedComponentItemConfig) => ComponentConstructor;\n\n export interface ComponentInstantiator {\n constructor: ComponentConstructor | undefined;\n factoryFunction: ComponentFactoryFunction | undefined;\n virtual: boolean;\n }\n}\n"],"names":["InternalError","Error","constructor","type","code","message","super","undefined","AssertError","UnreachableCaseError","variableValue","UnexpectedNullError","UnexpectedUndefinedError","ConfigMinifier","StyleConstants","WidthOrHeightPropertyName","Side","LogicalZIndex","keys","values","translateObject","from","minify","to","key","hasOwnProperty","translatedKey","minifyKey","unminifyKey","fromValue","translateValue","Array","isArray","length","i","translateArray","value","index","indexOfValue","toString","minifyValue","parseInt","substr","indexOfKey","checkInitialise","defaultComponentBaseZIndex","defaultComponentDragZIndex","defaultComponentStackMaximisedZIndex","width","height","top","left","right","bottom","base","drag","stackMaximised","LogicalZIndexToDefaultMap","JsonValue","ItemType","ResponsiveMode","SizeUnitEnum","ResolvedItemConfig","ResolvedHeaderedItemConfig","ResolvedStackItemConfig","ResolvedComponentItemConfig","ResolvedRowOrColumnItemConfig","ResolvedRootItemConfig","ResolvedGroundItemConfig","ResolvedLayoutConfig","ResolvedPopoutLayoutConfig","I18nStrings","numberToPixels","pixelsToNumber","numberStr","replace","parseFloat","isDigit","char","setElementWidth","element","widthAsPixels","style","setElementHeight","heightAsPixels","getElementWidthAndHeight","offsetWidth","offsetHeight","setElementDisplayVisibility","visible","display","deepExtend","target","obj","existingTarget","deepExtendValue","targetArray","valueObj","getUniqueId","Math","random","isJsonObject","isJson","ground","row","column","stack","component","none","always","onload","tryParse","Pixel","Percent","Fractional","Em","format","defaults","content","size","sizeUnit","minSize","minSizeUnit","id","isClosable","createCopy","original","createDefault","isComponentItem","itemConfig","isStackItem","isGroundItem","Header","defaultMaximised","show","popout","close","maximise","minimise","tabDropdown","copyContent","count","result","defaultActiveItemIndex","maximised","activeItemIndex","header","defaultReorderEnabled","resolveComponentTypeName","componentType","reorderEnabled","title","componentState","copyComponentType","isChildItemConfig","config","isRootItemConfig","create","rootItemConfig","Settings","Dimensions","isPopout","constrainDragToContainer","popoutWholeStack","blockedPopoutsThrowError","closePopoutsOnUnload","responsiveMode","tabOverlapAllowance","reorderOnTabMenuClick","tabControlOffset","popInOnClose","borderWidth","borderGrabWidth","defaultMinItemHeight","defaultMinItemHeightUnit","defaultMinItemWidth","defaultMinItemWidthUnit","headerHeight","dragProxyWidth","dragProxyHeight","dock","root","openPopouts","dimensions","settings","resolved","copyOpenPopouts","minifyConfig","layoutConfig","unminifyConfig","minifiedConfig","Window","parentId","indexInParent","window","ExternalError","ConfigurationError","node","PopoutBlockedError","ApiError","BindError","initialised","infosObject","PopoutCannotBeCreatedWithGroundItemConfig","default","PleaseRegisterAConstructorFunction","ComponentTypeNotRegisteredAndBindComponentEventHandlerNotAssigned","ComponentIsAlreadyRegistered","ComponentIsNotVirtuable","VirtualComponentDoesNotHaveRootHtmlElement","ItemConfigIsNotTypeComponent","InvalidNumberPartInSizeString","UnknownUnitInSizeString","UnsupportedUnitInSizeString","idCount","Object","infos","info","i18nStrings","ItemConfig","HeaderedItemConfig","StackItemConfig","ComponentItemConfig","RowOrColumnItemConfig","RootItemConfig","LayoutConfig","PopoutLayoutConfig","parseSize","sizeString","allowableSizeUnits","numericPart","digitsPart","firstNonNumericCharPart","firstNonDigitPart","trimStart","firstNonDigitPartIndex","gotDecimalPoint","substring","trim","splitStringAtFirstNonNumericChar","Number","isNaN","includes","formatSize","formatUndefinableSize","resolve","rowAndColumnChildLegacySizeDefault","JSON","stringify","resolveContent","resolveId","resolveSize","resolveMinSize","minWidth","minHeight","minWidthDefined","calculateSizeWidthHeightSpecificationType","isGround","isRow","isColumn","isStack","isComponent","hasHeaders","resolveIdAndMaximised","legacyId","legacyMaximised","idx","findIndex","splice","childItemConfig","fromResolvedContent","resolvedContent","resolvedContentConfig","fromResolved","resolvedConfig","componentName","componentTypeToTitle","contentConfig","childItemConfigs","legacySizeDefault","widthOrHeightSpecifiedAtLeastOnce","sizeSpecifiedAtLeastOnce","sizeWidthHeightSpecificationType","resolvedChildItemConfig","fromResolvedOrUndefined","resolvedItemConfig","resolveDefaultMinItemHeight","resolveDefaultMinItemWidth","resolvedDimensions","labels","showPopoutIcon","popin","showMaximiseIcon","showCloseIcon","resolveOpenPopouts","fromResolvedArray","isResolved","configOrResolvedConfig","popoutConfigs","resolvedArray","resolvedOpenPopoutCount","resolvedOpenPopout","resolvedWindow","popoutConfig","EventEmitter","_allEventSubscriptions","_subscriptionsMap","Map","unbind","this","removeEventListener","trigger","emit","tryBubbleEvent","name","args","eventName","subcriptions","get","slice","subscription","emitAllEvent","emitUnknown","subs","emitBaseBubblingEvent","event","BubblingEvent","emitUnknownBubblingEvent","callback","unknownCallback","removeUnknownEventListener","off","addEventListener","addUnknownEventListener","on","ALL_EVENT","push","subscriptions","set","removeSubscription","indexOf","allEventSubscriptionsCount","unknownArgs","unshift","allEventSubcriptions","headerClickEventName","headerTouchStartEventName","_name","_target","_isPropagationStopped","origin","isPropagationStopped","stopPropagation","ClickBubblingEvent","_mouseEvent","mouseEvent","TouchStartBubblingEvent","_touchEvent","touchEvent","BrowserPopout","_config","_initialWindowSize","_layoutManager","_isInitialised","_popoutWindow","createWindow","toConfig","glInstanceConfig","getGlInstance","saveLayout","screenX","screenLeft","screenY","screenTop","__glInstance","getWindow","closeWindow","e","popIn","parentItem","copiedRoot","groundItem","getItemsByPopInParentId","contentItems","newContentItem","createAndInitContentItem","addChild","_onClose","url","createUrl","floor","features","serializeWindowFeatures","innerWidth","innerHeight","menubar","toolbar","location","personalbar","resizable","scrollbars","status","globalThis","open","positionWindow","passive","_checkReadyInterval","setInterval","checkReady","isInitialised","onInitialised","clearInterval","windowOptions","windowOptionsString","join","storageKey","localStorage","setItem","getErrorMessage","URL","href","searchParams","moveTo","focus","setTimeout","HeaderButton","_header","label","cssClass","_pushEvent","_clickEventListener","ev","onClick","_touchStartEventListener","onTouchStart","_element","document","createElement","classList","add","destroy","controlsContainerElement","appendChild","parentNode","removeChild","DragListener","_eElement","extraAllowableChildTargets","_pointerTracking","_pointerDownEventListener","onPointerDown","_pointerMoveEventListener","onPointerMove","_pointerUpEventListener","onPointerUp","_timeout","_allowableTargets","_oDocument","_eBody","body","_nDelay","_nDistance","_nX","_nY","_nOriginalX","_nOriginalY","_dragging","checkRemovePointerTrackingEventListeners","cancelDrag","processDragStop","oEvent","isPrimary","coordinates","getPointerCoordinates","processPointerDown","x","y","startDrag","err","console","error","processDragMove","preventDefault","dragEvent","pageX","pageY","abs","clearTimeout","remove","querySelector","setProperty","Tab","_componentItem","_closeEvent","_focusEvent","_dragStartEvent","_isActive","_tabClickListener","onTabClickDown","_tabTouchStartListener","onTabTouchStart","_closeClickListener","onCloseClick","_closeTouchStartListener","onCloseTouchStart","_dragStartListener","onDragStart","_contentItemDestroyListener","onContentItemDestroy","_tabTitleChangedListener","setTitle","_titleElement","_closeElement","enableReorder","setTab","isActive","componentItem","contentItem","titleElement","closeElement","_dragListener","disableReorder","innerText","setActive","setBlurred","setFocused","button","notifyFocus","notifyClose","TabsContainer","_componentRemoveEvent","_componentFocusEvent","_componentDragStartEvent","_dropdownActiveChangedEvent","_tabs","_lastVisibleTabIndex","_dropdownActive","_dropdownElement","tabs","tabCount","lastVisibleTabIndex","dropdownElement","dropdownActive","createTab","tab","item","handleTabCloseEvent","handleTabFocusEvent","dragListener","handleTabDragStartEvent","childNodes","insertBefore","removeTab","processActiveComponentChanged","newActiveComponentItem","activeIndex","activeTab","j","updateTabSizes","availableWidth","activeComponentItem","dropDownActive","tryUpdateTabSizes","cumulativeTabWidth","tabOverlapAllowanceExceeded","tabElement","parentElement","tabMarginRight","getComputedStyle","marginRight","visibleTabWidth","activeTabMarginRight","zIndex","marginLeft","overlap","showAdditionalTabsDropdown","hideAdditionalTabsDropdown","_parent","_configClosable","_getActiveComponentItemEvent","closeEvent","_popoutEvent","_maximiseToggleEvent","_clickEvent","_touchStartEvent","_clickListener","_touchStartListener","_rowColumnClosable","_closeButton","_popoutButton","_tabsContainer","handleTabInitiatedComponentRemoveEvent","handleTabInitiatedComponentFocusEvent","handleTabInitiatedDragStartEvent","processTabDropdownActiveChanged","_show","_popoutEnabled","popoutEnabled","_popoutLabel","popoutLabel","_maximiseEnabled","maximiseEnabled","_maximiseLabel","maximiseLabel","_minimiseEnabled","minimiseEnabled","_minimiseLabel","minimiseLabel","_closeEnabled","closeEnabled","_closeLabel","closeLabel","_tabDropdownEnabled","tabDropdownEnabled","_tabDropdownLabel","tabDropdownLabel","setSide","side","_canRemoveComponent","_controlsContainerElement","_documentMouseUpListener","_tabControlOffset","_tabDropdownButton","handleButtonPopoutEvent","_maximiseButton","handleButtonMaximiseToggleEvent","_side","leftRightSided","_leftRightSided","layoutManager","parent","tabsContainerElement","setRowColumnClosable","updateClosability","len","applyFocusedValue","processMaximised","setAttribute","processMinimised","notifyClick","notifyTouchStart","ComponentContainer","_updateItemConfigEvent","_showEvent","_hideEvent","_blurEvent","_stackMaximised","_width","_height","_visible","_isShownWithZeroDimensions","_componentType","_isClosable","_initialState","_state","_boundComponent","bindComponent","updateElementPositionPropertyFromBoundComponent","virtual","_tab","isHidden","state","initialState","releaseComponent","stateRequestEvent","getElement","hide","suppressEvent","blur","setSize","ancestorItem","ancestorChildItem","direction","currentSize","percentage","delta","ancestorItemContentItem","updateSize","replaceComponent","virtualVisibilityChangeRequiredEvent","virtualRectingRequiredEvent","fireBeforeVirtualRectingEvent","fireAfterVirtualRectingEvent","setBaseLogicalZIndex","getState","extendState","extendedState","setState","setVisibility","setSizeToNodeSize","emitShow","emitHide","setLogicalZIndex","logicalZIndex","_logicalZIndex","notifyVirtualZIndexChangeRequired","enterDragMode","exitDragMode","enterStackMaximised","exitStackMaximised","force","addVirtualSizedContainerToLayoutManager","checkShownFromZeroDimensions","notifyVirtualRectingRequired","virtualZIndexChangeRequiredEvent","defaultZIndex","position","beginVirtualSizedContainerAdding","addVirtualSizedContainer","endVirtualSizedContainerAdding","unbindComponent","ContentItem","_popInParentIds","_type","_id","_pendingEventPropagations","_throttledEvents","_contentItems","createContentItems","popInParentIds","isComponentParentableItem","keepChild","suspendResize","setParent","init","replaceChild","oldChild","newChild","destroyOldChild","browserPopout","createPopoutFromContentItem","calculateConfigContent","highlightDropZone","area","dropTargetIndicator","highlightArea","onDrop","beginSizeInvalidation","endSizeInvalidation","getElementArea","rect","getBoundingClientRect","scrollTop","scrollLeft","x1","y1","x2","y2","surface","addPopInParentId","initContentItems","updateContentItemsSize","createContentItem","propagateEvent","scheduleEventPropagationToLayoutManager","requestAnimationFrame","propagateEventToLayoutManager","ComponentItem","_parentItem","_focused","_reorderEnabled","applyUpdatableConfig","_initialWantMaximise","containerElement","_container","handleUpdateItemConfigEvent","initialWantMaximise","container","headerConfig","_headerConfig","_title","focused","updateNodeSize","setActiveComponentItem","setFocusedComponentItem","ComponentParentableItem","setFocusedValue","Stack","_headerSideChanged","_resizeListener","handleResize","_maximisedListener","handleMaximised","_minimisedListener","handleMinimised","layoutHeaderConfig","configContent","componentHeaderConfig","_initialActiveItemIndex","_maximisedEnabled","headerSettings","getActiveComponentItem","handlePopoutEvent","toggleMaximise","handleHeaderClickEvent","handleHeaderTouchStartEvent","handleHeaderComponentRemoveEvent","handleHeaderComponentFocusEvent","handleHeaderComponentStartDragEvent","_childElementContainer","setupHeaderPosition","childElementContainer","headerShow","headerSide","headerLeftRightSided","contentAreaDimensions","_contentAreaDimensions","isMaximised","maximisedStack","stackParent","contentItemCount","setActiveContentItem","suppressFocusEvent","_activeComponentItem","emitStateChangedEvent","getActiveContentItem","focusActiveContentItem","newComponent","newItem","addComponent","addItem","checkMinimiseMaximisedStack","stackWillBeDeleted","newActiveComponentIdx","setMaximisedStack","createHeaderConfig","_dropSegment","resetHeaderDropZone","_dropIndex","isVertical","isHorizontal","hasCorrectParent","rowOrColumn","segment","hoverArea","highlightHeaderDropZone","highlightBodyDropZone","getArea","headerArea","contentArea","contentWidth","contentHeight","positionHeader","visibleTabsLength","tabsContainerElementChildNodes","visibleTabElements","tabIndex","visibleTabElement","tabDropPlaceholder","headerRect","headerTop","headerLeft","tabTop","tabLeft","tabWidth","isAboveTab","tabRect","tabRectTop","tabRectLeft","insertAdjacentElement","min","tabDropPlaceholderRect","tabDropPlaceholderRectTop","tabDropPlaceholderRectLeft","tabDropPlaceholderRectWidth","placeHolderTop","clientHeight","bubblingEvent","startComponentDrag","DragProxy","_originalParent","_area","_lastValidArea","offsetX","offsetY","onDrag","createDragProxyElements","_componentItemFocused","setDimensions","determineMinMaxXY","calculateItemAreas","setDropPosition","initialX","initialY","headerElement","tabsElement","_proxyContainerElement","_sided","insertAdjacentText","_minX","_minY","_maxX","_maxY","ceil","droppedComponentItem","Splitter","_isVertical","_size","grabSize","_grabSize","dragHandleElement","handleExcessSize","handleExcessPos","RowOrColumn","_rowOrColumnParent","_splitter","_splitterSize","_splitterGrabSize","_isColumn","_dimension","_splitterPosition","_splitterMinPosition","_splitterMaxPosition","_configType","createdItem","splitterElement","createSplitter","max","newItemSize","indexedContentItem","itemSize","splitterIndex","childItem","calculateRelativeSizes","setAbsoluteSizes","absoluteSizes","calculateAbsoluteSizes","additionalPixel","itemSizes","crossAxisSize","totalSplitterSize","elementWidth","elementHeight","totalSize","totalAssigned","total","itemsWithFractionalSize","totalFractionalSize","round","fractionalAllocatedSize","respectMinItemSize","minItemSize","calculateContentItemMinSize","totalOverMin","totalUnderMin","entriesOverMin","allEntries","entry","reducePercent","remainingSize","reducedSize","splitter","onSplitterDrag","onSplitterDragStop","onSplitterDragStart","getSplitItems","before","after","calculateContentItemsTotalMinSize","totalMinSize","items","beforeWidth","afterSize","beforeMinSize","afterMinSize","offset","offsetPixels","sizeBefore","sizeAfter","splitterPositionInRange","totalRelativeSize","getElementDimensionSize","dimension","getElementWidth","getElementHeight","setElementDimensionSize","GroundItem","_containerElement","prev","previousSibling","lastChild","Element","contains","loadRoot","clearRoot","rootContentItem","loadComponentAsRoot","createSideAreas","oppositeSides","Area","sibling","validateDocking","getAllContentItems","deepGetAllContentItems","getConfigMaximisedItems","deepFilterContentItems","popInParentId","checkAcceptFtn","DragSource","_extraAllowableChildTargets","_componentTypeOrFtn","_componentState","_dummyGroundContainer","dummyRootItemConfig","_dummyGroundContentItem","createDragListener","removeDragListener","onDragStop","dragSourceItemConfig","ftnDragSourceItemConfig","isDragSourceComponentItemConfig","dragProxy","transitionIndicator","transitionElements","DropTargetIndicator","innerElement","margin","TransitionIndicator","_toElement","_fromDimensions","_totalAnimationDuration","_animationStartTime","fromElement","toElement","nextAnimationFrame","measure","EventHub","_childEventListener","childEvent","onEventFromChild","ChildEventName","emitUserBroadcast","handleUserBroadcastEvent","isSubWindow","propagateToParent","propagateToThisAndSubtree","detail","eventInit","bubbles","cancelable","CustomEvent","opener","dispatchEvent","childGl","eventHub","LayoutManager","parameters","resizeWithContainerAutomatically","resizeDebounceInterval","resizeDebounceExtendedWhenPossible","_groundItem","_openPopouts","_dropTargetIndicator","_transitionIndicator","_itemAreas","_maximisePlaceholder","createMaximisePlaceElement","_tabDropPlaceholder","createTabDropPlaceholderElement","_dragSources","_updatingColumnsResponsive","_firstLoad","_eventHub","_virtualSizedContainers","_virtualSizedContainerAddingBeginCount","_sizeInvalidationBeginCount","_resizeObserver","ResizeObserver","handleContainerResize","_windowBeforeUnloadListener","onBeforeUnload","_windowBeforeUnloadListening","_maximisedStackBeforeDestroyedListener","cleanupBeforeMaximisedStackDestroyed","_constructorOrSubWindowLayoutConfig","constructorOrSubWindowLayoutConfig","rootItem","focusedComponentItem","_focusedComponentItem","_maximisedStack","deprecatedConstructor","closeAllOpenPopouts","disconnect","checkClearResizeTimeout","dragSource","subWindowRootConfig","setContainer","updateSizeFromContainer","resolvedLayoutConfig","checkLoadedLayoutMaximiseItem","observe","adjustColumnsResponsive","loadLayout","createSubWindows","groundContent","reconcilePopoutWindows","clear","newComponentAtLocation","locationSelectors","addComponentAtLocation","addItemAtLocation","newItemAtLocation","defaultLocationSelectors","findFirstLocation","addIdx","updateRootSize","createContentItemFromConfig","findFirstComponentItemById","findFirstContentItemTypeByIdRecursive","createPopout","itemConfigOrContentItem","positionAndSize","createPopoutFromItemConfig","child","windowLeft","windowTop","offsetLeft","offsetTop","beforeVirtualRectingEvent","afterVirtualRectingEvent","popoutLayoutConfig","createPopoutFromPopoutLayoutConfig","configWindow","initialWindow","newDragSource","componentTypeOrItemConfigCallback","removeDragSource","array","removeFromArray","focusComponent","clearComponentFocus","suppressEvents","newFocusedParentItem","oldFocusedItem","oldFocusedParentItem","processMinimiseMaximisedStack","processMaximiseStack","matchingArea","smallestSurface","Infinity","allContentItems","stackContentAreaDimensions","groundArea","configMaximisedItems","prepend","closed","processResizeWithDebounce","_resizeTimeoutId","bodyElement","documentElement","padding","overflow","useResponsiveLayout","columnCount","minItemWidth","stackColumnCount","allStacks","getAllStacks","firstStackContainer","addChildContentItemsToContainer","alwaysResponsiveMode","onLoadResponsiveModeAndFirst","stacks","findAllStacksRecursive","findFirstContentItemType","findFirstContentItemTypeRecursive","foundContentItem","selectors","selector","findLocation","selectorIndex","typeId","parentContentItems","parentContentItemCount","tryCreateLocationFromParentItem","groundContentItems","afterFocusedItemIfPossibleLocationSelectors","VirtualLayout","configOrOptionalContainer","containerOrBindComponentEventHandler","unbindComponentEventHandler","skipInit","createLayoutManagerConstructorParameters","_bindComponentEventHanlderPassedInConstructor","_creationTimeoutPassed","bindComponentEvent","unbindComponentEvent","readyState","clearHtmlAndAdjustStylesForSubWindow","headElement","head","appendNodeLists","querySelectorAll","listIdx","appendNodeList","nodeIdx","innerHTML","visibility","checkAddDefaultPopinButton","popInButtonElement","iconElement","bgElement","getComponentEvent","releaseComponentEvent","subWindowChecked","windowConfigKey","windowConfigStr","getItem","removeItem","minifiedWindowConfig","parse","HTMLElement","isMobileDevice","golden","_componentTypesMap","_registeredComponentMap","_virtuableComponentMap","_containerVirtualRectingRequiredEventListener","handleContainerVirtualRectingRequiredEvent","_containerVirtualVisibilityChangeRequiredEventListener","handleContainerVirtualVisibilityChangeRequiredEvent","_containerVirtualZIndexChangeRequiredEventListener","handleContainerVirtualZIndexChangeRequiredEvent","registerComponent","componentConstructorOrFactoryFtn","componentConstructor","registerComponentConstructor","componentFactoryFtn","registerComponentFactoryFunction","typeName","factoryFunction","componentFactoryFunction","registerComponentFunction","registerGetComponentConstructorCallback","_getComponentConstructorFtn","warn","getRegisteredComponentTypeNames","typeNamesIterableIterator","getComponentInstantiator","instantiator","virtuableComponent","componentRootElement","rootHtmlElement","absolutePosition","ensureElementPositionAbsolute","delete","_goldenLayoutBoundingClientRect","rootElement","containerBoundingClientRect","template","concat","minItemHeight"],"sourceRoot":""} \ No newline at end of file diff --git a/ui.0a8056a3ae2a0e82fb87.bundle.js b/ui.4113389f7da483319971.bundle.js similarity index 99% rename from ui.0a8056a3ae2a0e82fb87.bundle.js rename to ui.4113389f7da483319971.bundle.js index da33cab8..15e2bc29 100644 --- a/ui.0a8056a3ae2a0e82fb87.bundle.js +++ b/ui.4113389f7da483319971.bundle.js @@ -1,2 +1,2 @@ -!function(){"use strict";class t extends Error{constructor(t,e,i){super(`${t}: ${e}${void 0===i?"":": "+i}`)}}class e extends t{constructor(t,e){super("Assert",t,e)}}class i extends t{constructor(t,e,i){super("UnreachableCase",t,`${e}${void 0===i?"":": "+i}`)}}class n extends t{constructor(t,e){super("UnexpectedNull",t,e)}}class o extends t{constructor(t,e){super("UnexpectedUndefined",t,e)}}var s,r,a,l,h;!function(t){const e=["settings","hasHeaders","constrainDragToContainer","selectionEnabled","dimensions","borderWidth","minItemHeight","minItemWidth","headerHeight","dragProxyWidth","dragProxyHeight","labels","close","maximise","minimise","popout","content","componentType","componentState","id","width","type","height","isClosable","title","popoutWholeStack","openPopouts","parentId","activeItemIndex","reorderEnabled","borderGrabWidth"],i=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function n(t,e){const i={};for(const n in t)if(t.hasOwnProperty(n)){let a;a=e?s(n):r(n);const l=t[n];i[a]=o(l,e)}return i}function o(t,e){return"object"==typeof t?null===t?null:Array.isArray(t)?function(t,e){const i=t.length,n=new Array(i);for(let s=0;s36)throw new Error("Too many keys in config minifier map")},t.translateObject=n}(s||(s={})),function(t){t.defaultComponentBaseZIndex="auto",t.defaultComponentDragZIndex="32",t.defaultComponentStackMaximisedZIndex="41"}(r||(r={})),function(t){t.width="width",t.height="height"}(a||(a={})),function(t){t.top="top",t.left="left",t.right="right",t.bottom="bottom"}(l||(l={})),function(t){t.base="base",t.drag="drag",t.stackMaximised="stackMaximised"}(h||(h={}));const d={base:r.defaultComponentBaseZIndex,drag:r.defaultComponentDragZIndex,stackMaximised:r.defaultComponentStackMaximisedZIndex};var c,m,u,p,g,_,f,v,C,y,w,I,b,S;function E(t){return t.toString(10)+"px"}function x(t){const e=t.replace("px","");return parseFloat(e)}function z(t){return t>="0"&&t<="9"}function M(t,e){const i=E(e);t.style.width=i}function L(t,e){const i=E(e);t.style.height=i}function P(t){return{width:t.offsetWidth,height:t.offsetHeight}}function T(t,e){t.style.display=e?"":"none"}function A(t,e){if(void 0!==e)for(const i in e)if(e.hasOwnProperty(i)){const n=e[i],o=t[i];t[i]=D(o,n)}return t}function D(t,e){if("object"!=typeof e)return e;if(Array.isArray(e)){const t=e.length,i=new Array(t);for(let n=0;n"__glMaximised"===t));t>0&&(o=!0,n=n.splice(t,1)),e=n.length>0?n[0]:g.defaults.id}else e=n;return i=void 0!==t.maximised?t.maximised:o,{id:e,maximised:i}}}(N||(N={})),function(t){function i(t){if(void 0===t)return[];{const i=t.length,n=new Array(i);for(let o=0;o0?e.content[0]:void 0,{resolved:!0,root:q.resolve(i),openPopouts:t.resolveOpenPopouts(e.openPopouts),dimensions:t.Dimensions.resolve(e.dimensions),settings:t.Settings.resolve(e.settings),header:t.Header.resolve(e.header,e.settings,e.labels)}}},t.fromResolved=function(e){return{root:q.fromResolvedOrUndefined(e.root),openPopouts:X.fromResolvedArray(e.openPopouts),settings:I.Settings.createCopy(e.settings),dimensions:t.Dimensions.fromResolved(e.dimensions),header:I.Header.createCopy(e.header)}},t.isResolved=function(t){const e=t;return void 0!==e.resolved&&!0===e.resolved},t.resolveOpenPopouts=function(t){if(void 0===t)return[];{const e=t.length,i=new Array(e);for(let n=0;n0?e.content[0]:void 0,{root:q.resolve(o),openPopouts:j.resolveOpenPopouts(e.openPopouts),dimensions:j.Dimensions.resolve(e.dimensions),settings:j.Settings.resolve(e.settings),header:j.Header.resolve(e.header,e.settings,e.labels),parentId:null!==(i=e.parentId)&&void 0!==i?i:null,indexInParent:null!==(n=e.indexInParent)&&void 0!==n?n:null,window:t.Window.resolve(e.window,e.dimensions),resolved:!0}},t.fromResolved=function(e){return{root:q.fromResolvedOrUndefined(e.root),openPopouts:i(e.openPopouts),dimensions:j.Dimensions.fromResolved(e.dimensions),settings:I.Settings.createCopy(e.settings),header:I.Header.createCopy(e.header),parentId:e.parentId,indexInParent:e.indexInParent,window:t.Window.fromResolved(e.window)}},t.fromResolvedArray=i}(X||(X={}));class K{constructor(){this._allEventSubscriptions=[],this._subscriptionsMap=new Map,this.unbind=this.removeEventListener,this.trigger=this.emit}tryBubbleEvent(t,e){}emit(t,...e){let i=this._subscriptionsMap.get(t);if(void 0!==i){i=i.slice();for(let t=0;t0){const n=e.slice();n.unshift(t);const o=this._allEventSubscriptions.slice();for(let t=0;t0?n.contentItems[0]:n,e=0);const s=this._layoutManager.createAndInitContentItem(i,t);t.addChild(s,e),this._layoutManager.layoutConfig.settings.popInOnClose?this._onClose():this.close()}createWindow(){const t=this.createUrl(),e=Math.floor(1e6*Math.random()).toString(36),i=this.serializeWindowFeatures({width:this._initialWindowSize.width,height:this._initialWindowSize.height,innerWidth:this._initialWindowSize.width,innerHeight:this._initialWindowSize.height,menubar:"no",toolbar:"no",location:"no",personalbar:"no",resizable:"yes",scrollbars:"no",status:"no"});if(this._popoutWindow=globalThis.open(t,e,i),this._popoutWindow)this._popoutWindow.addEventListener("load",(()=>this.positionWindow()),{passive:!0}),this._popoutWindow.addEventListener("beforeunload",(()=>{this._layoutManager.layoutConfig.settings.popInOnClose?this.popIn():this._onClose()}),{passive:!0}),this._checkReadyInterval=setInterval((()=>this.checkReady()),10);else if(!0===this._layoutManager.layoutConfig.settings.blockedPopoutsThrowError)throw new H("Popout blocked")}checkReady(){if(null===this._popoutWindow)throw new n("BPCR01844");this._popoutWindow.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this.onInitialised(),void 0!==this._checkReadyInterval&&(clearInterval(this._checkReadyInterval),this._checkReadyInterval=void 0))}serializeWindowFeatures(t){const e=[];for(const i in t)e.push(i+"="+t[i].toString());return e.join(",")}createUrl(){const t="gl-window-config-"+k(),e=I.minifyConfig(this._config);try{localStorage.setItem(t,JSON.stringify(e))}catch(t){throw new Error("Error while writing to localStorage "+function(t){return t instanceof Error?t.message:"string"==typeof t?t:"Unknown Error"}(t))}const i=new URL(location.href);return i.searchParams.set("gl-window",t),i.toString()}positionWindow(){if(null===this._popoutWindow)throw new Error("BrowserPopout.positionWindow: null popoutWindow");this._popoutWindow.moveTo(this._initialWindowSize.left,this._initialWindowSize.top),this._popoutWindow.focus()}onInitialised(){this._isInitialised=!0,this.getGlInstance().on("popIn",(()=>this.popIn())),this.emit("initialised")}_onClose(){setTimeout((()=>this.emit("closed")),50)}}class tt{constructor(t,e,i,n){this._header=t,this._pushEvent=n,this._clickEventListener=t=>this.onClick(t),this._touchStartEventListener=t=>this.onTouchStart(t),this._element=document.createElement("div"),this._element.classList.add(i),this._element.title=e,this._header.on("destroy",(()=>this.destroy())),this._element.addEventListener("click",this._clickEventListener,{passive:!0}),this._element.addEventListener("touchstart",this._touchStartEventListener,{passive:!0}),this._header.controlsContainerElement.appendChild(this._element)}get element(){return this._element}destroy(){var t;this._element.removeEventListener("click",this._clickEventListener),this._element.removeEventListener("touchstart",this._touchStartEventListener),null===(t=this._element.parentNode)||void 0===t||t.removeChild(this._element)}onClick(t){this._pushEvent(t)}onTouchStart(t){this._pushEvent(t)}}class et extends K{constructor(t,e){super(),this._eElement=t,this._pointerTracking=!1,this._pointerDownEventListener=t=>this.onPointerDown(t),this._pointerMoveEventListener=t=>this.onPointerMove(t),this._pointerUpEventListener=t=>this.onPointerUp(t),this._timeout=void 0,this._allowableTargets=[t,...e],this._oDocument=document,this._eBody=document.body,this._nDelay=1800,this._nDistance=10,this._nX=0,this._nY=0,this._nOriginalX=0,this._nOriginalY=0,this._dragging=!1,this._eElement.addEventListener("pointerdown",this._pointerDownEventListener,{passive:!0})}destroy(){this.checkRemovePointerTrackingEventListeners(),this._eElement.removeEventListener("pointerdown",this._pointerDownEventListener)}cancelDrag(){this.processDragStop(void 0)}onPointerDown(t){if(this._allowableTargets.includes(t.target)&&t.isPrimary){const e=this.getPointerCoordinates(t);this.processPointerDown(e)}}processPointerDown(t){this._nOriginalX=t.x,this._nOriginalY=t.y,this._oDocument.addEventListener("pointermove",this._pointerMoveEventListener),this._oDocument.addEventListener("pointerup",this._pointerUpEventListener,{passive:!0}),this._pointerTracking=!0,this._timeout=setTimeout((()=>{try{this.startDrag()}catch(t){throw console.error(t),t}}),this._nDelay)}onPointerMove(t){this._pointerTracking&&(this.processDragMove(t),t.preventDefault())}processDragMove(t){this._nX=t.pageX-this._nOriginalX,this._nY=t.pageY-this._nOriginalY,!1===this._dragging&&(Math.abs(this._nX)>this._nDistance||Math.abs(this._nY)>this._nDistance)&&this.startDrag(),this._dragging&&this.emit("drag",this._nX,this._nY,t)}onPointerUp(t){this.processDragStop(t)}processDragStop(t){var e;void 0!==this._timeout&&(clearTimeout(this._timeout),this._timeout=void 0),this.checkRemovePointerTrackingEventListeners(),!0===this._dragging&&(this._eBody.classList.remove("lm_dragging"),this._eElement.classList.remove("lm_dragging"),null===(e=this._oDocument.querySelector("iframe"))||void 0===e||e.style.setProperty("pointer-events",""),this._dragging=!1,this.emit("dragStop",t))}checkRemovePointerTrackingEventListeners(){this._pointerTracking&&(this._oDocument.removeEventListener("pointermove",this._pointerMoveEventListener),this._oDocument.removeEventListener("pointerup",this._pointerUpEventListener),this._pointerTracking=!1)}startDrag(){var t;void 0!==this._timeout&&(clearTimeout(this._timeout),this._timeout=void 0),this._dragging=!0,this._eBody.classList.add("lm_dragging"),this._eElement.classList.add("lm_dragging"),null===(t=this._oDocument.querySelector("iframe"))||void 0===t||t.style.setProperty("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)}getPointerCoordinates(t){return{x:t.pageX,y:t.pageY}}}class it{constructor(t,e,i,n,o){var s;this._layoutManager=t,this._componentItem=e,this._closeEvent=i,this._focusEvent=n,this._dragStartEvent=o,this._isActive=!1,this._tabClickListener=t=>this.onTabClickDown(t),this._tabTouchStartListener=t=>this.onTabTouchStart(t),this._closeClickListener=()=>this.onCloseClick(),this._closeTouchStartListener=()=>this.onCloseTouchStart(),this._dragStartListener=(t,e)=>this.onDragStart(t,e),this._contentItemDestroyListener=()=>this.onContentItemDestroy(),this._tabTitleChangedListener=t=>this.setTitle(t),this._element=document.createElement("div"),this._element.classList.add("lm_tab"),this._titleElement=document.createElement("span"),this._titleElement.classList.add("lm_title"),this._closeElement=document.createElement("div"),this._closeElement.classList.add("lm_close_tab"),this._element.appendChild(this._titleElement),this._element.appendChild(this._closeElement),e.isClosable?this._closeElement.style.display="":this._closeElement.style.display="none",this.setTitle(e.title),this._componentItem.on("titleChanged",this._tabTitleChangedListener),(null!==(s=e.reorderEnabled)&&void 0!==s?s:this._layoutManager.layoutConfig.settings.reorderEnabled)&&this.enableReorder(),this._element.addEventListener("click",this._tabClickListener,{passive:!0}),this._element.addEventListener("touchstart",this._tabTouchStartListener,{passive:!0}),this._componentItem.isClosable?(this._closeElement.addEventListener("click",this._closeClickListener,{passive:!0}),this._closeElement.addEventListener("touchstart",this._closeTouchStartListener,{passive:!0})):(this._closeElement.remove(),this._closeElement=void 0),this._componentItem.setTab(this),this._layoutManager.emit("tabCreated",this)}get isActive(){return this._isActive}get componentItem(){return this._componentItem}get contentItem(){return this._componentItem}get element(){return this._element}get titleElement(){return this._titleElement}get closeElement(){return this._closeElement}get reorderEnabled(){return void 0!==this._dragListener}set reorderEnabled(t){t!==this.reorderEnabled&&(t?this.enableReorder():this.disableReorder())}setTitle(t){this._titleElement.innerText=t,this._element.title=t}setActive(t){t!==this._isActive&&(this._isActive=t,t?this._element.classList.add("lm_active"):this._element.classList.remove("lm_active"))}destroy(){var t,e;this._closeEvent=void 0,this._focusEvent=void 0,this._dragStartEvent=void 0,this._element.removeEventListener("click",this._tabClickListener),this._element.removeEventListener("touchstart",this._tabTouchStartListener),null===(t=this._closeElement)||void 0===t||t.removeEventListener("click",this._closeClickListener),null===(e=this._closeElement)||void 0===e||e.removeEventListener("touchstart",this._closeTouchStartListener),this._componentItem.off("titleChanged",this._tabTitleChangedListener),this.reorderEnabled&&this.disableReorder(),this._element.remove()}setBlurred(){this._element.classList.remove("lm_focused"),this._titleElement.classList.remove("lm_focused")}setFocused(){this._element.classList.add("lm_focused"),this._titleElement.classList.add("lm_focused")}onDragStart(t,e){if(void 0===this._dragListener)throw new o("TODSDLU10093");if(void 0===this._dragStartEvent)throw new o("TODS23309");this._dragStartEvent(t,e,this._dragListener,this.componentItem)}onContentItemDestroy(){void 0!==this._dragListener&&(this._dragListener.destroy(),this._dragListener=void 0)}onTabClickDown(t){const e=t.target;e!==this._element&&e!==this._titleElement||(0===t.button?this.notifyFocus():1===t.button&&this._componentItem.isClosable&&this.notifyClose())}onTabTouchStart(t){t.target===this._element&&this.notifyFocus()}onCloseClick(){this.notifyClose()}onCloseTouchStart(){this.notifyClose()}notifyClose(){if(void 0===this._closeEvent)throw new o("TNC15007");this._closeEvent(this._componentItem)}notifyFocus(){if(void 0===this._focusEvent)throw new o("TNA15007");this._focusEvent(this._componentItem)}enableReorder(){this._dragListener=new et(this._element,[this._titleElement]),this._dragListener.on("dragStart",this._dragStartListener),this._componentItem.on("destroy",this._contentItemDestroyListener)}disableReorder(){if(void 0===this._dragListener)throw new o("TDR87745");this._componentItem.off("destroy",this._contentItemDestroyListener),this._dragListener.off("dragStart",this._dragStartListener),this._dragListener=void 0}}class nt{constructor(t,e,i,n,o){this._layoutManager=t,this._componentRemoveEvent=e,this._componentFocusEvent=i,this._componentDragStartEvent=n,this._dropdownActiveChangedEvent=o,this._tabs=[],this._lastVisibleTabIndex=-1,this._dropdownActive=!1,this._element=document.createElement("section"),this._element.classList.add("lm_tabs"),this._dropdownElement=document.createElement("section"),this._dropdownElement.classList.add("lm_tabdropdown_list"),this._dropdownElement.style.display="none"}get tabs(){return this._tabs}get tabCount(){return this._tabs.length}get lastVisibleTabIndex(){return this._lastVisibleTabIndex}get element(){return this._element}get dropdownElement(){return this._dropdownElement}get dropdownActive(){return this._dropdownActive}destroy(){for(let t=0;tthis.handleTabCloseEvent(t)),(t=>this.handleTabFocusEvent(t)),((t,e,i,n)=>this.handleTabDragStartEvent(t,e,i,n)));void 0===e&&(e=this._tabs.length),this._tabs.splice(e,0,i),ethis._lastVisibleTabIndex){const t=this._tabs[i];for(let t=i;t>0;t--)this._tabs[t]=this._tabs[t-1];this._tabs[0]=t}}updateTabSizes(t,e){let i=!1;this.tryUpdateTabSizes(i,t,e)||(i=!0,this.tryUpdateTabSizes(i,t,e)),i!==this._dropdownActive&&(this._dropdownActive=i,this._dropdownActiveChangedEvent())}tryUpdateTabSizes(t,e,i){if(this._tabs.length>0){if(void 0===i)throw new Error("non-empty tabs must have active component item");let n=0,o=!1;const s=this._layoutManager.layoutConfig.settings.tabOverlapAllowance,r=this._tabs.indexOf(i.tab),a=this._tabs[r];this._lastVisibleTabIndex=-1;for(let i=0;ie){if(o)i===r&&(l.style.zIndex="auto",l.style.marginLeft="",l.parentElement!==this._element&&this._element.appendChild(l));else{let t;if(t=r>0&&r<=i?(d-e)/(i-1):(d-e)/i,tthis.onClick(t),this._touchStartListener=t=>this.onTouchStart(t),this._rowColumnClosable=!0,this._closeButton=null,this._popoutButton=null,this._tabsContainer=new nt(this._layoutManager,(t=>this.handleTabInitiatedComponentRemoveEvent(t)),(t=>this.handleTabInitiatedComponentFocusEvent(t)),((t,e,i,n)=>this.handleTabInitiatedDragStartEvent(t,e,i,n)),(()=>this.processTabDropdownActiveChanged())),this._show=i.show,this._popoutEnabled=i.popoutEnabled,this._popoutLabel=i.popoutLabel,this._maximiseEnabled=i.maximiseEnabled,this._maximiseLabel=i.maximiseLabel,this._minimiseEnabled=i.minimiseEnabled,this._minimiseLabel=i.minimiseLabel,this._closeEnabled=i.closeEnabled,this._closeLabel=i.closeLabel,this._tabDropdownEnabled=i.tabDropdownEnabled,this._tabDropdownLabel=i.tabDropdownLabel,this.setSide(i.side),this._canRemoveComponent=this._configClosable,this._element=document.createElement("section"),this._element.classList.add("lm_header"),this._controlsContainerElement=document.createElement("section"),this._controlsContainerElement.classList.add("lm_controls"),this._element.appendChild(this._tabsContainer.element),this._element.appendChild(this._controlsContainerElement),this._element.appendChild(this._tabsContainer.dropdownElement),this._element.addEventListener("click",this._clickListener,{passive:!0}),this._element.addEventListener("touchstart",this._touchStartListener,{passive:!0}),this._documentMouseUpListener=()=>this._tabsContainer.hideAdditionalTabsDropdown(),globalThis.document.addEventListener("mouseup",this._documentMouseUpListener,{passive:!0}),this._tabControlOffset=this._layoutManager.layoutConfig.settings.tabControlOffset,this._tabDropdownEnabled&&(this._tabDropdownButton=new tt(this,this._tabDropdownLabel,"lm_tabdropdown",(()=>this._tabsContainer.showAdditionalTabsDropdown()))),this._popoutEnabled&&(this._popoutButton=new tt(this,this._popoutLabel,"lm_popout",(()=>this.handleButtonPopoutEvent()))),this._maximiseEnabled&&(this._maximiseButton=new tt(this,this._maximiseLabel,"lm_maximise",(t=>this.handleButtonMaximiseToggleEvent(t)))),this._configClosable&&(this._closeButton=new tt(this,this._closeLabel,"lm_close",(()=>s()))),this.processTabDropdownActiveChanged()}get show(){return this._show}get side(){return this._side}get leftRightSided(){return this._leftRightSided}get layoutManager(){return this._layoutManager}get parent(){return this._parent}get tabs(){return this._tabsContainer.tabs}get lastVisibleTabIndex(){return this._tabsContainer.lastVisibleTabIndex}get element(){return this._element}get tabsContainerElement(){return this._tabsContainer.element}get controlsContainerElement(){return this._controlsContainerElement}destroy(){this.emit("destroy"),this._popoutEvent=void 0,this._maximiseToggleEvent=void 0,this._clickEvent=void 0,this._touchStartEvent=void 0,this._componentRemoveEvent=void 0,this._componentFocusEvent=void 0,this._componentDragStartEvent=void 0,this._tabsContainer.destroy(),globalThis.document.removeEventListener("mouseup",this._documentMouseUpListener),this._element.remove()}createTab(t,e){this._tabsContainer.createTab(t,e)}removeTab(t){this._tabsContainer.removeTab(t)}processActiveComponentChanged(t){this._tabsContainer.processActiveComponentChanged(t),this.updateTabSizes()}setSide(t){this._side=t,this._leftRightSided=[l.right,l.left].includes(this._side)}setRowColumnClosable(t){this._rowColumnClosable=t,this.updateClosability()}updateClosability(){let t;if(this._configClosable)if(this._rowColumnClosable){t=!0;const e=this.tabs.length;for(let i=0;i1}applyFocusedValue(t){t?this._element.classList.add("lm_focused"):this._element.classList.remove("lm_focused")}processMaximised(){if(void 0===this._maximiseButton)throw new o("HPMAX16997");this._maximiseButton.element.setAttribute("title",this._minimiseLabel)}processMinimised(){if(void 0===this._maximiseButton)throw new o("HPMIN16997");this._maximiseButton.element.setAttribute("title",this._maximiseLabel)}updateTabSizes(){if(this._tabsContainer.tabCount>0){const t=this._show?this._layoutManager.layoutConfig.dimensions.headerHeight:0;let e;this._leftRightSided?(this._element.style.height="",this._element.style.width=E(t)):(this._element.style.width="",this._element.style.height=E(t)),e=this._leftRightSided?this._element.offsetHeight-this._controlsContainerElement.offsetHeight-this._tabControlOffset:this._element.offsetWidth-this._controlsContainerElement.offsetWidth-this._tabControlOffset,this._tabsContainer.updateTabSizes(e,this._getActiveComponentItemEvent())}}handleTabInitiatedComponentRemoveEvent(t){if(this._canRemoveComponent){if(void 0===this._componentRemoveEvent)throw new o("HHTCE22294");this._componentRemoveEvent(t)}}handleTabInitiatedComponentFocusEvent(t){if(void 0===this._componentFocusEvent)throw new o("HHTAE22294");this._componentFocusEvent(t)}handleTabInitiatedDragStartEvent(t,e,i,n){if(this._canRemoveComponent){if(void 0===this._componentDragStartEvent)throw new o("HHTDSE22294");this._componentDragStartEvent(t,e,i,n)}else i.cancelDrag()}processTabDropdownActiveChanged(){void 0!==this._tabDropdownButton&&T(this._tabDropdownButton.element,this._tabsContainer.dropdownActive)}handleButtonPopoutEvent(){if(this._layoutManager.layoutConfig.settings.popoutWholeStack){if(void 0===this._popoutEvent)throw new o("HHBPOE17834");this._popoutEvent()}else{const t=this._getActiveComponentItemEvent();t&&t.popout()}}handleButtonMaximiseToggleEvent(t){if(void 0===this._maximiseToggleEvent)throw new o("HHBMTE16834");this._maximiseToggleEvent()}onClick(t){t.target===this._element&&this.notifyClick(t)}onTouchStart(t){t.target===this._element&&this.notifyTouchStart(t)}notifyClick(t){if(void 0===this._clickEvent)throw new o("HNHC46834");this._clickEvent(t)}notifyTouchStart(t){if(void 0===this._touchStartEvent)throw new o("HNHTS46834");this._touchStartEvent(t)}}class st extends K{constructor(t,e,i,n,o,s,r,a,l){super(),this._config=t,this._parent=e,this._layoutManager=i,this._element=n,this._updateItemConfigEvent=o,this._showEvent=s,this._hideEvent=r,this._focusEvent=a,this._blurEvent=l,this._stackMaximised=!1,this._width=0,this._height=0,this._visible=!0,this._isShownWithZeroDimensions=!0,this._componentType=t.componentType,this._isClosable=t.isClosable,this._initialState=t.componentState,this._state=this._initialState,this._boundComponent=this.layoutManager.bindComponent(this,t),this.updateElementPositionPropertyFromBoundComponent()}get width(){return this._width}get height(){return this._height}get parent(){return this._parent}get componentName(){return this._componentType}get componentType(){return this._componentType}get virtual(){return this._boundComponent.virtual}get component(){return this._boundComponent.component}get tab(){return this._tab}get title(){return this._parent.title}get layoutManager(){return this._layoutManager}get isHidden(){return!this._visible}get visible(){return this._visible}get state(){return this._state}get initialState(){return this._initialState}get element(){return this._element}destroy(){this.releaseComponent(),this.stateRequestEvent=void 0,this.emit("destroy")}getElement(){return this._element}hide(){this._hideEvent()}show(){this._showEvent()}focus(t=!1){this._focusEvent(t)}blur(t=!1){this._blurEvent(t)}setSize(t,i){let o=this._parent;if(o.isColumn||o.isRow||null===o.parent)throw new e("ICSSPRC","ComponentContainer cannot have RowColumn Parent");{let e;do{e=o,o=o.parent}while(null!==o&&!o.isColumn&&!o.isRow);if(null===o)return!1;{const s=o.isColumn?"height":"width",r=this[s];if(null===r)throw new n("ICSSCS11194");{const n=("height"===s?i:t)/(r*(1/(e.size/100)))*100,a=(e.size-n)/(o.contentItems.length-1);for(let t=0;t0)this.updateSize(!1);else if(!this.isGround&&!0===this._isClosable){if(null===this._parent)throw new n("CIUC00874");this._parent.removeChild(this)}}addChild(t,e,i){return null!=e||(e=this._contentItems.length),this._contentItems.splice(e,0,t),t.setParent(this),!0===this._isInitialised&&!1===t._isInitialised&&t.init(),e}replaceChild(t,i,o=!1){const s=this._contentItems.indexOf(t),r=t._element.parentNode;if(-1===s)throw new e("CIRCI23232","Can't replace child. oldChild is not child of this");if(null===r)throw new n("CIRCP23232");if(r.replaceChild(i._element,t._element),!0===o&&(t._parent=null,t.destroy()),this._contentItems[s]=i,i.setParent(this),i.size=t.size,i.sizeUnit=t.sizeUnit,i.minSize=t.minSize,i.minSizeUnit=t.minSizeUnit,null===i._parent)throw new n("CIRCNC45699");!0===i._parent._isInitialised&&!1===i._isInitialised&&i.init(),this.updateSize(!1)}remove(){if(null===this._parent)throw new n("CIR11110");this._parent.removeChild(this)}popout(){const t=k(),e=this.layoutManager.createPopoutFromContentItem(this,void 0,t,void 0);return this.emitBaseBubblingEvent("stateChanged"),e}calculateConfigContent(){const t=this._contentItems,e=t.length,i=new Array(e);for(let n=0;nthis.propagateEventToLayoutManager(t,e))))}propagateEventToLayoutManager(t,e){this._pendingEventPropagations[t]=!1,this.layoutManager.emitUnknown(t,e)}}class at extends rt{constructor(t,e,i){super(t,e,i,document.createElement("div")),this._parentItem=i,this._focused=!1,this.isComponent=!0,this._reorderEnabled=e.reorderEnabled,this.applyUpdatableConfig(e),this._initialWantMaximise=e.maximised;const n=document.createElement("div");n.classList.add("lm_content"),this.element.appendChild(n),this._container=new st(e,this,t,n,(t=>this.handleUpdateItemConfigEvent(t)),(()=>this.show()),(()=>this.hide()),(t=>this.focus(t)),(t=>this.blur(t)))}get componentName(){return this._container.componentType}get componentType(){return this._container.componentType}get reorderEnabled(){return this._reorderEnabled}get initialWantMaximise(){return this._initialWantMaximise}get component(){return this._container.component}get container(){return this._container}get parentItem(){return this._parentItem}get headerConfig(){return this._headerConfig}get title(){return this._title}get tab(){return this._tab}get focused(){return this._focused}destroy(){this._container.destroy(),super.destroy()}applyUpdatableConfig(t){this.setTitle(t.title),this._headerConfig=t.header}toConfig(){const t=this._container.stateRequestEvent,e=void 0===t?this._container.state:t();return{type:m.component,content:[],size:this.size,sizeUnit:this.sizeUnit,minSize:this.minSize,minSizeUnit:this.minSizeUnit,id:this.id,maximised:!1,isClosable:this.isClosable,reorderEnabled:this._reorderEnabled,title:this._title,header:_.Header.createCopy(this._headerConfig),componentType:v.copyComponentType(this.componentType),componentState:e}}close(){if(null===this.parent)throw new n("CIC68883");this.parent.removeChild(this,!1)}enterDragMode(t,e){M(this.element,t),L(this.element,e),this._container.enterDragMode(t,e)}exitDragMode(){this._container.exitDragMode()}enterStackMaximised(){this._container.enterStackMaximised()}exitStackMaximised(){this._container.exitStackMaximised()}drag(){this._container.drag()}updateSize(t){this.updateNodeSize(t)}init(){this.updateNodeSize(!1),super.init(),this._container.emit("open"),this.initContentItems()}setTitle(t){this._title=t,this.emit("titleChanged",t),this.emit("stateChanged")}setTab(t){this._tab=t,this.emit("tab",t),this._container.setTab(t)}hide(){super.hide(),this._container.setVisibility(!1)}show(){super.show(),this._container.setVisibility(!0)}focus(t=!1){this.parentItem.setActiveComponentItem(this,!0,t)}setFocused(t){this._focused=!0,this.tab.setFocused(),t||this.emitBaseBubblingEvent("focus")}blur(t=!1){this._focused&&this.layoutManager.setFocusedComponentItem(void 0,t)}setBlurred(t){this._focused=!1,this.tab.setBlurred(),t||this.emitBaseBubblingEvent("blur")}setParent(t){this._parentItem=t,super.setParent(t)}handleUpdateItemConfigEvent(t){this.applyUpdatableConfig(t)}updateNodeSize(t){if("none"!==this.element.style.display){const{width:e,height:i}=P(this.element);this._container.setSizeToNodeSize(e,i,t)}}}class lt extends rt{constructor(){super(...arguments),this._focused=!1}get focused(){return this._focused}setFocusedValue(t){this._focused=t}}class ht extends lt{constructor(t,e,i){var n,o,s,r,a,h,d,c,m,u,p,g,_,f,v,C,y,w,I;super(t,e,i,ht.createElement(document)),this._headerSideChanged=!1,this._resizeListener=()=>this.handleResize(),this._maximisedListener=()=>this.handleMaximised(),this._minimisedListener=()=>this.handleMinimised(),this._headerConfig=e.header;const b=t.layoutConfig.header,S=e.content;let E;E=1!==S.length?void 0:S[0].header,this._initialWantMaximise=e.maximised,this._initialActiveItemIndex=null!==(n=e.activeItemIndex)&&void 0!==n?n:0;const x=null!==(r=null!==(s=null===(o=this._headerConfig)||void 0===o?void 0:o.show)&&void 0!==s?s:null==E?void 0:E.show)&&void 0!==r?r:b.show,z=null!==(d=null!==(h=null===(a=this._headerConfig)||void 0===a?void 0:a.popout)&&void 0!==h?h:null==E?void 0:E.popout)&&void 0!==d?d:b.popout,M=null!==(u=null!==(m=null===(c=this._headerConfig)||void 0===c?void 0:c.maximise)&&void 0!==m?m:null==E?void 0:E.maximise)&&void 0!==u?u:b.maximise,L=null!==(_=null!==(g=null===(p=this._headerConfig)||void 0===p?void 0:p.close)&&void 0!==g?g:null==E?void 0:E.close)&&void 0!==_?_:b.close,P=null!==(C=null!==(v=null===(f=this._headerConfig)||void 0===f?void 0:f.minimise)&&void 0!==v?v:null==E?void 0:E.minimise)&&void 0!==C?C:b.minimise,T=null!==(I=null!==(w=null===(y=this._headerConfig)||void 0===y?void 0:y.tabDropdown)&&void 0!==w?w:null==E?void 0:E.tabDropdown)&&void 0!==I?I:b.tabDropdown;this._maximisedEnabled=!1!==M;const A={show:!1!==x,side:!1===x?l.top:x,popoutEnabled:!1!==z,popoutLabel:!1===z?"":z,maximiseEnabled:this._maximisedEnabled,maximiseLabel:!1===M?"":M,closeEnabled:!1!==L,closeLabel:!1===L?"":L,minimiseEnabled:!0,minimiseLabel:P,tabDropdownEnabled:!1!==T,tabDropdownLabel:!1===T?"":T};this._header=new ot(t,this,A,e.isClosable&&!1!==L,(()=>this.getActiveComponentItem()),(()=>this.remove()),(()=>this.handlePopoutEvent()),(()=>this.toggleMaximise()),(t=>this.handleHeaderClickEvent(t)),(t=>this.handleHeaderTouchStartEvent(t)),(t=>this.handleHeaderComponentRemoveEvent(t)),(t=>this.handleHeaderComponentFocusEvent(t)),((t,e,i,n)=>this.handleHeaderComponentStartDragEvent(t,e,i,n))),this.isStack=!0,this._childElementContainer=document.createElement("section"),this._childElementContainer.classList.add("lm_items"),this.on("resize",this._resizeListener),this._maximisedEnabled&&(this.on("maximised",this._maximisedListener),this.on("minimised",this._minimisedListener)),this.element.appendChild(this._header.element),this.element.appendChild(this._childElementContainer),this.setupHeaderPosition(),this._header.updateClosability()}get childElementContainer(){return this._childElementContainer}get header(){return this._header}get headerShow(){return this._header.show}get headerSide(){return this._header.side}get headerLeftRightSided(){return this._header.leftRightSided}get contentAreaDimensions(){return this._contentAreaDimensions}get initialWantMaximise(){return this._initialWantMaximise}get isMaximised(){return this===this.layoutManager.maximisedStack}get stackParent(){if(!this.parent)throw new Error("Stack should always have a parent");return this.parent}updateSize(t){this.layoutManager.beginVirtualSizedContainerAdding();try{this.updateNodeSize(),this.updateContentItemsSize(t)}finally{this.layoutManager.endVirtualSizedContainerAdding()}}init(){if(!0===this.isInitialised)return;this.updateNodeSize();for(let t=0;t0){if(this._initialActiveItemIndex<0||this._initialActiveItemIndex>=e)throw new Error(`ActiveItemIndex out of range: ${this._initialActiveItemIndex} id: ${this.id}`);for(let i=0;ithis.contentItems.length)throw i-=1,new e("SAC99728");if(t instanceof at)return i=super.addChild(t,i),this._childElementContainer.appendChild(t.element),this._header.createTab(t,i),this.setActiveComponentItem(t,n),this._header.updateTabSizes(),this.updateSize(!1),t.container.setBaseLogicalZIndex(),this._header.updateClosability(),this.emitStateChangedEvent(),i;throw new e("SACC88532")}removeChild(t,e){const i=t,n=this.contentItems.indexOf(i),o=1===this.contentItems.length;if(this._activeComponentItem===i&&(i.focused&&i.blur(),!o)){const t=0===n?1:n-1;this.setActiveComponentItem(this.contentItems[t],!1)}this._header.removeTab(i),super.removeChild(i,e),o||this._header.updateClosability(),this.emitStateChangedEvent()}toggleMaximise(){this.isMaximised?this.minimise():this.maximise()}maximise(){if(!this.isMaximised){this.layoutManager.setMaximisedStack(this);const t=this.contentItems,i=t.length;for(let n=0;n0&&void 0===t)throw new Error("expected non-empty stack to have an active component item");return{type:"stack",content:this.calculateConfigContent(),size:this.size,sizeUnit:this.sizeUnit,minSize:this.minSize,minSizeUnit:this.minSizeUnit,id:this.id,isClosable:this.isClosable,maximised:this.isMaximised,header:this.createHeaderConfig(),activeItemIndex:t}}onDrop(t,e){if("header"===this._dropSegment){if(this.resetHeaderDropZone(),void 0===this._dropIndex)throw new o("SODDI68990");return void this.addChild(t,this._dropIndex)}if("body"===this._dropSegment)return void this.addChild(t,0,!0);const i="top"===this._dropSegment||"bottom"===this._dropSegment,n="left"===this._dropSegment||"right"===this._dropSegment,s="top"===this._dropSegment||"left"===this._dropSegment,r=i&&this.stackParent.isColumn||n&&this.stackParent.isRow;if(t.isComponent){const e=f.createDefault();e.header=this.createHeaderConfig();const i=this.layoutManager.createAndInitContentItem(e,this);i.addChild(t),t=i}if(t.type===m.row||t.type===m.column){const e=f.createDefault();e.header=this.createHeaderConfig();const i=this.layoutManager.createContentItem(e,this);i.addChild(t),t=i}if(r){const e=this.stackParent.contentItems.indexOf(this);this.stackParent.addChild(t,s?e:e+1,!0),this.size*=.5,t.size=this.size,t.sizeUnit=this.sizeUnit,this.stackParent.updateSize(!1)}else{const e=i?m.column:m.row,n=g.createDefault(e),o=this.layoutManager.createContentItem(n,this);this.stackParent.replaceChild(this,o),o.addChild(t,s?0:void 0,!0),o.addChild(this,s?void 0:0,!0),this.size=50,t.size=50,t.sizeUnit=p.Percent,o.updateSize(!1)}}highlightDropZone(t,e){for(const i in this._contentAreaDimensions){const n=i,o=this._contentAreaDimensions[n].hoverArea;if(o.x1t&&o.y1e)return void("header"===n?(this._dropSegment="header",this.highlightHeaderDropZone(this._header.leftRightSided?e:t)):(this.resetHeaderDropZone(),this.highlightBodyDropZone(n)))}}getArea(){if("none"===this.element.style.display)return null;const t=super.getElementArea(this._header.element),e=super.getElementArea(this._childElementContainer);if(null===t||null===e)throw new n("SGAHC13086");const i=e.x2-e.x1,o=e.y2-e.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}}},0===this.contentItems.length?(this._contentAreaDimensions.body={hoverArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}},super.getElementArea(this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:e.x1,y1:e.y1,x2:e.x1+.25*i,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x1+.5*i,y2:e.y2}},this._contentAreaDimensions.top={hoverArea:{x1:e.x1+.25*i,y1:e.y1,x2:e.x1+.75*i,y2:e.y1+.5*o},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y1+.5*o}},this._contentAreaDimensions.right={hoverArea:{x1:e.x1+.75*i,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1+.5*i,y1:e.y1,x2:e.x2,y2:e.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:e.x1+.25*i,y1:e.y1+.5*o,x2:e.x1+.75*i,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1+.5*o,x2:e.x2,y2:e.y2}},super.getElementArea(this.element))}positionHeader(t){this._header.side!==t&&(this._header.setSide(t),this._headerSideChanged=!0,this.setupHeaderPosition())}updateNodeSize(){if("none"!==this.element.style.display){const t=P(this.element);this._header.show&&(t[this._header.leftRightSided?a.width:a.height]-=this.layoutManager.layoutConfig.dimensions.headerHeight),this._childElementContainer.style.width=E(t.width),this._childElementContainer.style.height=E(t.height);for(let e=0;e=n&&tthis.onDrag(t,e,i))),this._dragListener.on("dragStop",(()=>this.onDrop())),this.createDragProxyElements(t,e),null===this._componentItem.parent)throw new n("DPC10097");this._componentItemFocused=this._componentItem.focused,this._componentItemFocused&&this._componentItem.blur(),this._componentItem.parent.removeChild(this._componentItem,!0),this.setDimensions(),document.body.appendChild(this._element),this.determineMinMaxXY(),this._layoutManager.calculateItemAreas(),this.setDropPosition(t,e)}get element(){return this._element}createDragProxyElements(t,e){this._element=document.createElement("div"),this._element.classList.add("lm_dragProxy");const i=document.createElement("div");i.classList.add("lm_header");const n=document.createElement("div");n.classList.add("lm_tabs");const o=document.createElement("div");o.classList.add("lm_tab");const s=document.createElement("span");s.classList.add("lm_title"),o.appendChild(s),n.appendChild(o),i.appendChild(n),this._proxyContainerElement=document.createElement("div"),this._proxyContainerElement.classList.add("lm_content"),this._element.appendChild(i),this._element.appendChild(this._proxyContainerElement),this._originalParent instanceof ht&&this._originalParent.headerShow&&(this._sided=this._originalParent.headerLeftRightSided,this._element.classList.add("lm_"+this._originalParent.headerSide),[l.right,l.bottom].indexOf(this._originalParent.headerSide)>=0&&this._proxyContainerElement.insertAdjacentElement("afterend",i)),this._element.style.left=E(t),this._element.style.top=E(e),o.setAttribute("title",this._componentItem.title),s.insertAdjacentText("afterbegin",this._componentItem.title),this._proxyContainerElement.appendChild(this._componentItem.element)}determineMinMaxXY(){const t=this._layoutManager.groundItem;if(void 0===t)throw new o("DPDMMXY73109");{const e=t.element.getBoundingClientRect();this._minX=e.left+document.body.scrollLeft,this._minY=e.top+document.body.scrollTop,this._maxX=this._minX+e.width,this._maxY=this._minY+e.height}}onDrag(t,e,i){const n=i.pageX,o=i.pageY;this.setDropPosition(n,o),this._componentItem.drag()}setDropPosition(t,e){this._layoutManager.layoutConfig.settings.constrainDragToContainer&&(t<=this._minX?t=Math.ceil(this._minX):t>=this._maxX&&(t=Math.floor(this._maxX)),e<=this._minY?e=Math.ceil(this._minY):e>=this._maxY&&(e=Math.floor(this._maxY))),this._element.style.left=E(t),this._element.style.top=E(e),this._area=this._layoutManager.getArea(t,e),null!==this._area&&(this._lastValidArea=this._area,this._area.contentItem.highlightDropZone(t,e,this._area))}onDrop(){const t=this._layoutManager.dropTargetIndicator;if(null===t)throw new n("DPOD30011");let e;t.hide(),this._componentItem.exitDragMode(),null!==this._area?(e=this._componentItem,this._area.contentItem.onDrop(e,this._area)):null!==this._lastValidArea?(e=this._componentItem,this._lastValidArea.contentItem.onDrop(e,this._lastValidArea)):this._originalParent?(e=this._componentItem,this._originalParent.addChild(e)):this._componentItem.destroy(),this._element.remove(),this._layoutManager.emit("itemDropped",this._componentItem),this._componentItemFocused&&void 0!==e&&e.focus()}setDimensions(){const t=this._layoutManager.layoutConfig.dimensions;if(void 0===t)throw new Error("DragProxy.setDimensions: dimensions undefined");let e=t.dragProxyWidth,i=t.dragProxyHeight;if(void 0===e||void 0===i)throw new Error("DragProxy.setDimensions: width and/or height undefined");const n=!1===this._layoutManager.layoutConfig.header.show?0:t.headerHeight;this._element.style.width=E(e),this._element.style.height=E(i),e-=this._sided?n:0,i-=this._sided?0:n,this._proxyContainerElement.style.width=E(e),this._proxyContainerElement.style.height=E(i),this._componentItem.enterDragMode(e,i),this._componentItem.show()}}class ct{constructor(t,e,i){this._isVertical=t,this._size=e,this._grabSize=i0){const i=this.createSplitter(Math.max(0,e-1)).element;e>0?(this.contentItems[e-1].element.insertAdjacentElement("afterend",i),i.insertAdjacentElement("afterend",t.element)):(this.contentItems[0].element.insertAdjacentElement("beforebegin",i),i.insertAdjacentElement("beforebegin",t.element))}else this._childElementContainer.appendChild(t.element);super.addChild(t,e);const n=1/this.contentItems.length*100;if(!0===i)return this.emitBaseBubblingEvent("stateChanged"),e;for(let e=0;e0&&(this.calculateRelativeSizes(),this.setAbsoluteSizes()),this.emitBaseBubblingEvent("stateChanged"),this.emit("resize")}setAbsoluteSizes(){const t=this.calculateAbsoluteSizes();for(let e=0;e0&&t.itemSizes[e]++,this._isColumn?(M(this.contentItems[e].element,t.crossAxisSize),L(this.contentItems[e].element,t.itemSizes[e])):(M(this.contentItems[e].element,t.itemSizes[e]),L(this.contentItems[e].element,t.crossAxisSize))}calculateAbsoluteSizes(){const t=(this.contentItems.length-1)*this._splitterSize,{width:i,height:n}=P(this.element);let o,s;this._isColumn?(o=n-t,s=i):(o=i-t,s=n);let r=0;const a=[];for(let t=0;t0){const e=100-t;for(let t=0;t100&&i.length>0){for(let t=0;te)return;{const r=i/e;let a=i;for(let e=0;ethis.onSplitterDrag(e,t,i))),e.on("dragStop",(()=>this.onSplitterDragStop(e))),e.on("dragStart",(()=>this.onSplitterDragStart(e))),this._splitter.splice(t,0,e),e}getSplitItems(t){const e=this._splitter.indexOf(t);return{before:this.contentItems[e],after:this.contentItems[e+1]}}calculateContentItemMinSize(t){const i=t.minSize;if(void 0!==i){if(t.minSizeUnit===p.Pixel)return i;throw new e("ROCGMD98831",JSON.stringify(t))}{const t=this.layoutManager.layoutConfig.dimensions;return this._isColumn?t.defaultMinItemHeight:t.defaultMinItemWidth}}calculateContentItemsTotalMinSize(t){let e=0;for(const i of t)e+=this.calculateContentItemMinSize(i);return e}onSplitterDragStart(t){const e=this.getSplitItems(t),i=x(e.before.element.style[this._dimension]),n=x(e.after.element.style[this._dimension]),o=this.calculateContentItemsTotalMinSize(e.before.contentItems),s=this.calculateContentItemsTotalMinSize(e.after.contentItems);this._splitterPosition=0,this._splitterMinPosition=-1*(i-o),this._splitterMaxPosition=n-s}onSplitterDrag(t,e,i){let o=this._isColumn?i:e;if(null===this._splitterMinPosition||null===this._splitterMaxPosition)throw new n("ROCOSD59226");o=Math.max(o,this._splitterMinPosition),o=Math.min(o,this._splitterMaxPosition),this._splitterPosition=o;const s=E(o);this._isColumn?t.element.style.top=s:t.element.style.left=s}onSplitterDragStop(t){if(null===this._splitterPosition)throw new n("ROCOSDS66932");{const e=this.getSplitItems(t),i=x(e.before.element.style[this._dimension]),n=x(e.after.element.style[this._dimension]),o=(this._splitterPosition+i)/(i+n),s=e.before.size+e.after.size;e.before.size=o*s,e.after.size=(1-o)*s,t.element.style.top=E(0),t.element.style.left=E(0),globalThis.requestAnimationFrame((()=>this.updateSize(!1)))}}}!function(t){t.getElementDimensionSize=function(t,e){return"width"===e?function(t){return t.offsetWidth}(t):function(t){return t.offsetHeight}(t)},t.setElementDimensionSize=function(t,e,i){return"width"===e?M(t,i):L(t,i)},t.createElement=function(t,e){const i=t.createElement("div");return i.classList.add("lm_item"),e?i.classList.add("lm_column"):i.classList.add("lm_row"),i}}(mt||(mt={}));class ut extends lt{constructor(t,e,i){super(t,w.create(e),null,ut.createElement(document)),this.isGround=!0,this._childElementContainer=this.element,this._containerElement=i;let n=null;for(;;){const t=n?n.previousSibling:this._containerElement.lastChild;if(!(t instanceof Element&&t.classList.contains("lm_content")))break;n=t}this._containerElement.insertBefore(this.element,n)}init(){if(!0!==this.isInitialised){this.updateNodeSize();for(let t=0;t0?this.contentItems[0]:this,n.isComponent)throw new Error("Cannot add item as child to ComponentItem");{const t=this.layoutManager.createAndInitContentItem(i,n);return e=n.addChild(t,e),n===this?-1:e}}loadComponentAsRoot(t){this.clearRoot();const e=F.resolve(t,!1);if(e.maximised)throw new Error("Root Component cannot be maximised");{const t=new at(this.layoutManager,e,this);t.init(),this.addChild(t,0)}}addChild(t,e){if(this.contentItems.length>0)throw new Error("Ground node can only have a single child");return this._childElementContainer.appendChild(t.element),e=super.addChild(t,e),this.updateSize(!1),this.emitBaseBubblingEvent("stateChanged"),e}calculateConfigContent(){const t=this.contentItems,i=t.length,n=new Array(i);for(let o=0;o0&&(M(this.contentItems[0].element,t),L(this.contentItems[0].element,e)),this.updateContentItemsSize(!1))}updateSize(t){this.layoutManager.beginVirtualSizedContainerAdding();try{this.updateNodeSize(),this.updateContentItemsSize(t)}finally{this.layoutManager.endVirtualSizedContainerAdding()}}createSideAreas(){const t=ut.Area.oppositeSides,e=new Array(Object.keys(t).length);let i=0;for(const o in t){const s=o,r=this.getElementArea();if(null===r)throw new n("RCSA77553");r.side=s,"2"===t[s][1]?r[s]=r[t[s]]-50:r[s]=r[t[s]]+50,r.surface=(r.x2-r.x1)*(r.y2-r.y1),e[i++]=r}return e}highlightDropZone(t,e,i){this.layoutManager.tabDropPlaceholder.remove(),super.highlightDropZone(t,e,i)}onDrop(t,e){if(t.isComponent){const e=f.createDefault(),i=t;e.header=_.Header.createCopy(i.headerConfig);const n=this.layoutManager.createAndInitContentItem(e,this);n.addChild(t),t=n}if(0===this.contentItems.length)this.addChild(t);else{if(t.type===m.row||t.type===m.column){const e=f.createDefault(),i=this.layoutManager.createContentItem(e,this);i.addChild(t),t=i}const i="x"==e.side[0]?m.row:m.column,n="2"==e.side[1],o=this.contentItems[0];if(o instanceof mt&&o.type===i){const e=o.contentItems[n?0:o.contentItems.length-1];o.addChild(t,n?0:void 0,!0),e.size*=.5,t.size=e.size,t.sizeUnit=p.Percent,o.updateSize(!1)}else{const e=g.createDefault(i),s=this.layoutManager.createContentItem(e,this);this.replaceChild(o,s),s.addChild(t,n?0:void 0,!0),s.addChild(o,n?void 0:0,!0),o.size=50,t.size=50,t.sizeUnit=p.Percent,s.updateSize(!1)}}}dock(){throw new e("GID87731")}validateDocking(){throw new e("GIVD87732")}getAllContentItems(){const t=[this];return this.deepGetAllContentItems(this.contentItems,t),t}getConfigMaximisedItems(){const t=[];return this.deepFilterContentItems(this.contentItems,t,(t=>!(!rt.isStack(t)||!t.initialWantMaximise)||!(!rt.isComponentItem(t)||!t.initialWantMaximise))),t}getItemsByPopInParentId(t){const e=[];return this.deepFilterContentItems(this.contentItems,e,(e=>e.popInParentIds.includes(t))),e}toConfig(){throw new Error("Cannot generate GroundItem config")}setActiveComponentItem(t,e,i){}updateNodeSize(){const{width:t,height:e}=P(this._containerElement);M(this.element,t),L(this.element,e),this.contentItems.length>0&&(M(this.contentItems[0].element,t),L(this.contentItems[0].element,e))}deepGetAllContentItems(t,e){for(let i=0;ithis.onDragStart(t,e))),this._dragListener.on("dragStop",(()=>this.onDragStop()))}onDragStart(t,e){var i;const o="component";let s;if("function"==typeof this._componentTypeOrFtn){const t=this._componentTypeOrFtn();s=pt.isDragSourceComponentItemConfig(t)?{type:o,componentState:t.state,componentType:t.type,title:null!==(i=t.title)&&void 0!==i?i:this._title}:t}else s={type:o,componentState:this._componentState,componentType:this._componentTypeOrFtn,title:this._title,id:this._id};const r=G.resolve(s,!1),a=new at(this._layoutManager,r,this._dummyGroundContentItem);if(this._dummyGroundContentItem.contentItems.push(a),null===this._dragListener)throw new n("DSODSD66746");{const i=new dt(t,e,this._dragListener,this._layoutManager,a,this._dummyGroundContentItem),o=this._layoutManager.transitionIndicator;if(null===o)throw new n("DSODST66746");o.transitionElements(this._element,i.element)}}onDragStop(){this.createDragListener()}removeDragListener(){null!==this._dragListener&&(this._dragListener.destroy(),this._dragListener=null)}}!function(t){t.isDragSourceComponentItemConfig=function(t){return!("componentType"in t)}}(pt||(pt={}));class gt{constructor(){this._element=document.createElement("div"),this._element.classList.add("lm_dropTargetIndicator");const t=document.createElement("div");t.classList.add("lm_inner"),this._element.appendChild(t),document.body.appendChild(this._element)}destroy(){this._element.remove()}highlightArea(t,e){this._element.style.left=E(t.x1+e),this._element.style.top=E(t.y1+e),this._element.style.width=E(t.x2-t.x1-e),this._element.style.height=E(t.y2-t.y1-e),this._element.style.display="block"}hide(){T(this._element,!1)}}class _t{constructor(){this._element=document.createElement("div"),this._element.classList.add("lm_transition_indicator"),document.body.appendChild(this._element),this._toElement=null,this._fromDimensions=null,this._totalAnimationDuration=200,this._animationStartTime=null}destroy(){this._element.remove()}transitionElements(t,e){}nextAnimationFrame(){}measure(t){const e=t.getBoundingClientRect();return{left:e.left,top:e.top,width:t.offsetWidth,height:t.offsetHeight}}}class ft extends K{constructor(t){super(),this._layoutManager=t,this._childEventListener=t=>this.onEventFromChild(t),globalThis.addEventListener(ft.ChildEventName,this._childEventListener,{passive:!0})}emit(t,...e){"userBroadcast"===t?this.emitUserBroadcast(...e):super.emit(t,...e)}emitUserBroadcast(...t){this.handleUserBroadcastEvent("userBroadcast",t)}destroy(){globalThis.removeEventListener(ft.ChildEventName,this._childEventListener)}handleUserBroadcastEvent(t,e){this._layoutManager.isSubWindow?this.propagateToParent(t,e):this.propagateToThisAndSubtree(t,e)}onEventFromChild(t){const e=t.detail;this.handleUserBroadcastEvent(e.eventName,e.args)}propagateToParent(t,e){const i={bubbles:!0,cancelable:!0,detail:{layoutManager:this._layoutManager,eventName:t,args:e}},o=new CustomEvent(ft.ChildEventName,i),s=globalThis.opener;if(null===s)throw new n("EHPTP15778");s.dispatchEvent(o)}propagateToThisAndSubtree(t,e){this.emitUnknown(t,...e);for(let i=0;ithis.handleContainerResize())),this._windowBeforeUnloadListener=()=>this.onBeforeUnload(),this._windowBeforeUnloadListening=!1,this._maximisedStackBeforeDestroyedListener=t=>this.cleanupBeforeMaximisedStackDestroyed(t),this.isSubWindow=t.isSubWindow,this._constructorOrSubWindowLayoutConfig=t.constructorOrSubWindowLayoutConfig,S.checkInitialise(),s.checkInitialise(),void 0!==t.containerElement&&(this._containerElement=t.containerElement)}get container(){return this._containerElement}get isInitialised(){return this._isInitialised}get groundItem(){return this._groundItem}get root(){return this._groundItem}get openPopouts(){return this._openPopouts}get dropTargetIndicator(){return this._dropTargetIndicator}get transitionIndicator(){return this._transitionIndicator}get width(){return this._width}get height(){return this._height}get eventHub(){return this._eventHub}get rootItem(){if(void 0===this._groundItem)throw new Error("Cannot access rootItem before init");return 0===this._groundItem.contentItems.length?void 0:this._groundItem.contentItems[0]}get focusedComponentItem(){return this._focusedComponentItem}get tabDropPlaceholder(){return this._tabDropPlaceholder}get maximisedStack(){return this._maximisedStack}get deprecatedConstructor(){return!this.isSubWindow&&void 0!==this._constructorOrSubWindowLayoutConfig}destroy(){if(this._isInitialised){this._windowBeforeUnloadListening&&(globalThis.removeEventListener("beforeunload",this._windowBeforeUnloadListener),this._windowBeforeUnloadListening=!1),!0===this.layoutConfig.settings.closePopoutsOnUnload&&this.closeAllOpenPopouts(),this._resizeObserver.disconnect(),this.checkClearResizeTimeout(),void 0!==this._groundItem&&this._groundItem.destroy(),this._tabDropPlaceholder.remove(),null!==this._dropTargetIndicator&&this._dropTargetIndicator.destroy(),null!==this._transitionIndicator&&this._transitionIndicator.destroy(),this._eventHub.destroy();for(const t of this._dragSources)t.destroy();this._dragSources=[],this._isInitialised=!1}}minifyConfig(t){return I.minifyConfig(t)}unminifyConfig(t){return I.unminifyConfig(t)}init(){let t;if(this.setContainer(),this._dropTargetIndicator=new gt,this._transitionIndicator=new _t,this.updateSizeFromContainer(),this.isSubWindow){if(void 0===this._constructorOrSubWindowLayoutConfig)throw new o("LMIU07155");{const i=this._constructorOrSubWindowLayoutConfig.root;if(void 0===i)throw new e("LMIC07156");if(!F.isComponent(i))throw new e("LMIC07157");t=i;const n=j.resolve(this._constructorOrSubWindowLayoutConfig);this.layoutConfig=Object.assign(Object.assign({},n),{root:void 0})}}else void 0===this._constructorOrSubWindowLayoutConfig?this.layoutConfig=I.createDefault():this.layoutConfig=j.resolve(this._constructorOrSubWindowLayoutConfig);const i=this.layoutConfig;this._groundItem=new ut(this,i.root,this._containerElement),this._groundItem.init(),this.checkLoadedLayoutMaximiseItem(),this._resizeObserver.observe(this._containerElement),this._isInitialised=!0,this.adjustColumnsResponsive(),this.emit("initialised"),void 0!==t&&this.loadComponentAsRoot(t)}loadLayout(t){if(!this.isInitialised)throw new Error("GoldenLayout: Need to call init() if LayoutConfig with defined root passed to constructor");if(void 0===this._groundItem)throw new o("LMLL11119");this.createSubWindows(),this.layoutConfig=j.resolve(t),this._groundItem.loadRoot(this.layoutConfig.root),this.checkLoadedLayoutMaximiseItem(),this.adjustColumnsResponsive()}saveLayout(){if(!1===this._isInitialised)throw new Error("Can't create config, layout not yet initialised");if(void 0===this._groundItem)throw new o("LMTC18244");{const t=this._groundItem.calculateConfigContent();let e;e=1!==t.length?void 0:t[0],this.reconcilePopoutWindows();const i=[];for(let t=0;t=0?s=this._groundItem.contentItems[0]:n=0;break;case m.row:case m.column:n=s.addItem(t,o.index);break;case m.stack:if(F.isComponent(t)){n=s.addItem(t,o.index);break}throw Error(O[6]);case m.component:throw new e("LMAIALC87444602");default:throw new i("LMAIALU98881733",s.type)}if(F.isComponent(t)){const t=s.contentItems[n];rt.isStack(t)&&(s=t,n=0)}return o.parentItem=s,o.index=n,o}}}loadComponentAsRoot(t){if(void 0===this._groundItem)throw new Error("Cannot add item before init");this._groundItem.loadComponentAsRoot(t)}updateSize(t,e){this.setSize(t,e)}setSize(t,e){if(this._width=t,this._height=e,!0===this._isInitialised){if(void 0===this._groundItem)throw new o("LMUS18881");if(this._groundItem.setSize(this._width,this._height),this._maximisedStack){const{width:t,height:e}=P(this._containerElement);M(this._maximisedStack.element,t),L(this._maximisedStack.element,e),this._maximisedStack.updateSize(!1)}this.adjustColumnsResponsive()}}beginSizeInvalidation(){this._sizeInvalidationBeginCount++}endSizeInvalidation(){0==--this._sizeInvalidationBeginCount&&this.updateSizeFromContainer()}updateSizeFromContainer(){const{width:t,height:e}=P(this._containerElement);this.setSize(t,e)}updateRootSize(t=!1){if(void 0===this._groundItem)throw new o("LMURS28881");this._groundItem.updateSize(t)}createAndInitContentItem(t,e){const i=this.createContentItem(t,e);return i.init(),i}createContentItem(t,e){if("string"!=typeof t.type)throw new U("Missing parameter 'type'",JSON.stringify(t));return!g.isComponentItem(t)||e instanceof ht||!e||!0===this.isSubWindow&&e instanceof ut||(t={type:m.stack,content:[t],size:t.size,sizeUnit:t.sizeUnit,minSize:t.minSize,minSizeUnit:t.minSizeUnit,id:t.id,maximised:t.maximised,isClosable:t.isClosable,activeItemIndex:0,header:void 0}),this.createContentItemFromConfig(t,e)}findFirstComponentItemById(t){if(void 0===this._groundItem)throw new o("LMFFCIBI82446");return this.findFirstContentItemTypeByIdRecursive(m.component,t,this._groundItem)}createPopout(t,e,i,n){return t instanceof rt?this.createPopoutFromContentItem(t,e,i,n):this.createPopoutFromItemConfig(t,e,i,n)}createPopoutFromContentItem(t,e,i,o){let s=t.parent,r=t;for(;null!==s&&1===s.contentItems.length&&!s.isGround;)r=s,s=s.parent;if(null===s)throw new n("LMCPFCI00834");{if(void 0===o&&(o=s.contentItems.indexOf(r)),null!==i&&s.addPopInParentId(i),void 0===e){const i=globalThis.screenX||globalThis.screenLeft,n=globalThis.screenY||globalThis.screenTop,o=t.element.offsetLeft,s=t.element.offsetTop,{width:r,height:a}=P(t.element);e={left:i+o,top:n+s,width:r,height:a}}const n=t.toConfig();if(t.remove(),y.isRootItemConfig(n))return this.createPopoutFromItemConfig(n,e,i,o);throw new Error(`${O[0]}`)}}beginVirtualSizedContainerAdding(){0==++this._virtualSizedContainerAddingBeginCount&&(this._virtualSizedContainers.length=0)}addVirtualSizedContainer(t){this._virtualSizedContainers.push(t)}endVirtualSizedContainerAdding(){if(0==--this._virtualSizedContainerAddingBeginCount){const t=this._virtualSizedContainers.length;if(t>0){this.fireBeforeVirtualRectingEvent(t);for(let e=0;ethis.emit("windowOpened",a))),a.on("closed",(()=>this.reconcilePopoutWindows())),this._openPopouts.push(a),this.layoutConfig.settings.closePopoutsOnUnload&&!this._windowBeforeUnloadListening&&(globalThis.addEventListener("beforeunload",this._windowBeforeUnloadListener,{passive:!0}),this._windowBeforeUnloadListening=!0),a}closeAllOpenPopouts(){for(let t=0;tglobalThis.close()),1)}getArea(t,e){let i=null,n=1/0;for(let o=0;o=s.x1&&t=s.y1&&es.surface&&(n=s.surface,i=s)}return i}calculateItemAreas(){const t=this.getAllContentItems(),e=this._groundItem;if(void 0===e)throw new o("LMCIAR44365");if(1!==t.length){e.contentItems[0].isStack?this._itemAreas=[]:this._itemAreas=e.createSideAreas();for(let e=0;e0){let i=t[0];if(rt.isComponentItem(i)){const t=i.parent;if(null===t)throw new n("LMXLLMI69999");i=t}if(!rt.isStack(i))throw new e("LMCLLMI19993");i.maximise()}}}processMaximiseStack(t){if(this._maximisedStack=t,t.on("beforeItemDestroyed",this._maximisedStackBeforeDestroyedListener),t.element.classList.add("lm_maximised"),t.element.insertAdjacentElement("afterend",this._maximisePlaceholder),void 0===this._groundItem)throw new o("LMMXI19993");{this._groundItem.element.prepend(t.element);const{width:e,height:i}=P(this._containerElement);M(t.element,e),L(t.element,i),t.updateSize(!0),t.focusActiveContentItem(),this._maximisedStack.emit("maximised"),this.emit("stateChanged")}}processMinimiseMaximisedStack(){if(void 0===this._maximisedStack)throw new e("LMMMS74422");{const t=this._maximisedStack;if(null===t.parent)throw new n("LMMI13668");t.element.classList.remove("lm_maximised"),this._maximisePlaceholder.insertAdjacentElement("afterend",t.element),this._maximisePlaceholder.remove(),this.updateRootSize(!0),this._maximisedStack=void 0,t.off("beforeItemDestroyed",this._maximisedStackBeforeDestroyedListener),t.emit("minimised"),this.emit("stateChanged")}}reconcilePopoutWindows(){const t=[];for(let e=0;e{this._resizeTimeoutId=void 0,this.beginSizeInvalidation(),this.endSizeInvalidation()}),this.resizeDebounceInterval))}checkClearResizeTimeout(){void 0!==this._resizeTimeoutId&&(clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=void 0)}setContainer(){var t;const e=document.body,i=null!==(t=this._containerElement)&&void 0!==t?t:e;if(i===e){this.resizeWithContainerAutomatically=!0;const t=document.documentElement;t.style.height="100%",t.style.margin="0",t.style.padding="0",t.style.overflow="clip",e.style.height="100%",e.style.margin="0",e.style.padding="0",e.style.overflow="clip"}this._containerElement=i}onBeforeUnload(){this.destroy()}adjustColumnsResponsive(){if(void 0===this._groundItem)throw new o("LMACR20883");if(this._firstLoad=!1,this.useResponsiveLayout()&&!this._updatingColumnsResponsive&&this._groundItem.contentItems.length>0&&this._groundItem.contentItems[0].isRow){if(void 0===this._groundItem||null===this._width)throw new o("LMACR77412");{const t=this._groundItem.contentItems[0].contentItems.length;if(t<=1)return;{const i=this.layoutConfig.dimensions.defaultMinItemWidth;if(t*i<=this._width)return;{this._updatingColumnsResponsive=!0;const n=t-Math.max(Math.floor(this._width/i),1),o=this._groundItem.contentItems[0],s=this.getAllStacks();if(0===s.length)throw new e("LMACRS77413");{const t=s[0];for(let e=0;en?void 0:{parentItem:t,index:o}}}case 1:if(void 0===this._focusedComponentItem)return;{const t=this._focusedComponentItem.parentItem;return this.tryCreateLocationFromParentItem(t,e)}case 2:{const t=this.findFirstContentItemType(m.stack);return void 0===t?void 0:this.tryCreateLocationFromParentItem(t,e)}case 3:{let t=this.findFirstContentItemType(m.row);return void 0!==t?this.tryCreateLocationFromParentItem(t,e):(t=this.findFirstContentItemType(m.column),void 0!==t?this.tryCreateLocationFromParentItem(t,e):void 0)}case 4:{const t=this.findFirstContentItemType(m.row);return void 0===t?void 0:this.tryCreateLocationFromParentItem(t,e)}case 5:{const t=this.findFirstContentItemType(m.column);return void 0===t?void 0:this.tryCreateLocationFromParentItem(t,e)}case 6:if(void 0===this._groundItem)throw new o("LMFLRIF18244");return void 0!==this.rootItem?void 0:void 0===e||0===e?{parentItem:this._groundItem,index:0}:void 0;case 7:if(void 0===this._groundItem)throw new o("LMFLF18244");{const t=this._groundItem.contentItems;if(0===t.length)return void 0===e||0===e?{parentItem:this._groundItem,index:0}:void 0;{const i=t[0];return this.tryCreateLocationFromParentItem(i,e)}}}}tryCreateLocationFromParentItem(t,e){const i=t.contentItems.length;return void 0===e?{parentItem:t,index:i}:e<0||e>i?void 0:{parentItem:t,index:e}}}!function(t){t.createMaximisePlaceElement=function(t){const e=t.createElement("div");return e.classList.add("lm_maximise_place"),e},t.createTabDropPlaceholderElement=function(t){const e=t.createElement("div");return e.classList.add("lm_drop_tab_placeholder"),e},t.defaultLocationSelectors=[{typeId:1,index:void 0},{typeId:2,index:void 0},{typeId:3,index:void 0},{typeId:7,index:void 0}],t.afterFocusedItemIfPossibleLocationSelectors=[{typeId:0,index:1},{typeId:2,index:void 0},{typeId:3,index:void 0},{typeId:7,index:void 0}]}(vt||(vt={}));class Ct extends vt{constructor(t,e,i,n){if(super(Ct.createLayoutManagerConstructorParameters(t,e)),this._bindComponentEventHanlderPassedInConstructor=!1,this._creationTimeoutPassed=!1,void 0!==e&&"function"==typeof e&&(this.bindComponentEvent=e,this._bindComponentEventHanlderPassedInConstructor=!0,void 0!==i&&(this.unbindComponentEvent=i)),!this._bindComponentEventHanlderPassedInConstructor&&this.isSubWindow){if(void 0===this._constructorOrSubWindowLayoutConfig)throw new o("VLC98823");{const t=j.resolve(this._constructorOrSubWindowLayoutConfig);this.layoutConfig=Object.assign(Object.assign({},t),{root:void 0})}}!0!==n&&(this.deprecatedConstructor||this.init())}destroy(){this.bindComponentEvent=void 0,this.unbindComponentEvent=void 0,super.destroy()}init(){if(this._bindComponentEventHanlderPassedInConstructor||"loading"!==document.readyState&&null!==document.body){if(!this._bindComponentEventHanlderPassedInConstructor&&!0===this.isSubWindow&&!this._creationTimeoutPassed)return setTimeout((()=>this.init()),7),void(this._creationTimeoutPassed=!0);!0===this.isSubWindow&&(this._bindComponentEventHanlderPassedInConstructor||this.clearHtmlAndAdjustStylesForSubWindow(),window.__glInstance=this),super.init()}else document.addEventListener("DOMContentLoaded",(()=>this.init()),{passive:!0})}clearHtmlAndAdjustStylesForSubWindow(){const t=document.head,e=new Array(4);e[0]=document.querySelectorAll("body link"),e[1]=document.querySelectorAll("body style"),e[2]=document.querySelectorAll("template"),e[3]=document.querySelectorAll(".gl_keep");for(let i=0;ithis.emit("popIn"))),document.body.appendChild(t),!0}}bindComponent(t,e){if(void 0!==this.bindComponentEvent)return this.bindComponentEvent(t,e);if(void 0!==this.getComponentEvent)return{virtual:!1,component:this.getComponentEvent(t,e)};{const t=`${O[2]}: ${JSON.stringify(e)}`;throw new B(t)}}unbindComponent(t,e,i){if(void 0!==this.unbindComponentEvent)this.unbindComponentEvent(t);else if(!e&&void 0!==this.releaseComponentEvent){if(void 0===i)throw new o("VCUCRCU333998");this.releaseComponentEvent(t,i)}}}!function(t){let e=!1;t.createLayoutManagerConstructorParameters=function(t,i){const n=e?null:new URL(document.location.href).searchParams.get("gl-window");e=!0;const o=null!==n;let s,r;if(null!==n){const e=localStorage.getItem(n);if(null===e)throw new Error("Null gl-window Config");localStorage.removeItem(n);const i=JSON.parse(e),o=I.unminifyConfig(i);r=j.fromResolved(o),t instanceof HTMLElement&&(s=t)}else void 0===t?r=void 0:t instanceof HTMLElement?(r=void 0,s=t):r=t,void 0===s&&i instanceof HTMLElement&&(s=i);return{constructorOrSubWindowLayoutConfig:r,isSubWindow:o,containerElement:s}}}(Ct||(Ct={}));var yt=window.innerWidth<=window.innerHeight,wt=new class extends Ct{constructor(t,e,i){super(t,e,i,!0),this._componentTypesMap=new Map,this._registeredComponentMap=new Map,this._virtuableComponentMap=new Map,this._containerVirtualRectingRequiredEventListener=(t,e,i)=>this.handleContainerVirtualRectingRequiredEvent(t,e,i),this._containerVirtualVisibilityChangeRequiredEventListener=(t,e)=>this.handleContainerVirtualVisibilityChangeRequiredEvent(t,e),this._containerVirtualZIndexChangeRequiredEventListener=(t,e,i)=>this.handleContainerVirtualZIndexChangeRequiredEvent(t,e,i),this.deprecatedConstructor||this.init()}registerComponent(t,e,i=!1){if("function"!=typeof e)throw new W("registerComponent() componentConstructorOrFactoryFtn parameter is not a function");if(e.hasOwnProperty("prototype")){const n=e;this.registerComponentConstructor(t,n,i)}else{const n=e;this.registerComponentFactoryFunction(t,n,i)}}registerComponentConstructor(t,e,i=!1){if("function"!=typeof e)throw new Error(O[1]);if(void 0!==this._componentTypesMap.get(t))throw new B(`${O[3]}: ${t}`);this._componentTypesMap.set(t,{constructor:e,factoryFunction:void 0,virtual:i})}registerComponentFactoryFunction(t,e,i=!1){if("function"!=typeof e)throw new B("Please register a constructor function");if(void 0!==this._componentTypesMap.get(t))throw new B(`${O[3]}: ${t}`);this._componentTypesMap.set(t,{constructor:void 0,factoryFunction:e,virtual:i})}registerComponentFunction(t){this.registerGetComponentConstructorCallback(t)}registerGetComponentConstructorCallback(t){if("function"!=typeof t)throw new Error("Please register a callback function");void 0!==this._getComponentConstructorFtn&&console.warn("Multiple component functions are being registered. Only the final registered function will be used."),this._getComponentConstructorFtn=t}getRegisteredComponentTypeNames(){const t=this._componentTypesMap.keys();return Array.from(t)}getComponentInstantiator(t){let e;const i=v.resolveComponentTypeName(t);return void 0!==i&&(e=this._componentTypesMap.get(i)),void 0===e&&void 0!==this._getComponentConstructorFtn&&(e={constructor:this._getComponentConstructorFtn(t),factoryFunction:void 0,virtual:!1}),e}bindComponent(t,i){let n;const s=v.resolveComponentTypeName(i);let r;if(void 0!==s&&(n=this._componentTypesMap.get(s)),void 0===n&&void 0!==this._getComponentConstructorFtn&&(n={constructor:this._getComponentConstructorFtn(i),factoryFunction:void 0,virtual:!1}),void 0!==n){const a=n.virtual;let l,h;l=void 0===i.componentState?void 0:D({},i.componentState);const d=n.constructor;if(void 0!==d)h=new d(t,l,a);else{const i=n.factoryFunction;if(void 0===i)throw new e("LMBCFFU10008");h=i(t,l,a)}if(a){if(void 0===h)throw new o("GLBCVCU988774");{const e=h,i=e.rootHtmlElement;if(void 0===i)throw new B(`${O[5]}: ${s}`);!function(t){const e="absolute";t.style.position!==e&&(t.style.position=e)}(i),this.container.appendChild(i),this._virtuableComponentMap.set(t,e),t.virtualRectingRequiredEvent=this._containerVirtualRectingRequiredEventListener,t.virtualVisibilityChangeRequiredEvent=this._containerVirtualVisibilityChangeRequiredEventListener,t.virtualZIndexChangeRequiredEvent=this._containerVirtualZIndexChangeRequiredEventListener}}this._registeredComponentMap.set(t,h),r={virtual:n.virtual,component:h}}else r=super.bindComponent(t,i);return r}unbindComponent(t,i,n){if(void 0===this._registeredComponentMap.get(t))super.unbindComponent(t,i,n);else{const i=this._virtuableComponentMap.get(t);if(void 0!==i){const n=i.rootHtmlElement;if(void 0===n)throw new e("GLUC77743",t.title);this.container.removeChild(n),this._virtuableComponentMap.delete(t)}}}fireBeforeVirtualRectingEvent(t){this._goldenLayoutBoundingClientRect=this.container.getBoundingClientRect(),super.fireBeforeVirtualRectingEvent(t)}handleContainerVirtualRectingRequiredEvent(t,e,i){const n=this._virtuableComponentMap.get(t);if(void 0===n)throw new o("GLHCSCE55933");{const o=n.rootHtmlElement;if(void 0===o)throw new B(O[4]+" "+t.title);{const n=t.element.getBoundingClientRect(),s=n.left-this._goldenLayoutBoundingClientRect.left;o.style.left=E(s);const r=n.top-this._goldenLayoutBoundingClientRect.top;o.style.top=E(r),M(o,e),L(o,i)}}}handleContainerVirtualVisibilityChangeRequiredEvent(t,e){const i=this._virtuableComponentMap.get(t);if(void 0===i)throw new o("GLHCVVCRE55934");{const n=i.rootHtmlElement;if(void 0===n)throw new B(O[4]+" "+t.title);T(n,e)}}handleContainerVirtualZIndexChangeRequiredEvent(t,e,i){const n=this._virtuableComponentMap.get(t);if(void 0===n)throw new o("GLHCVZICRE55935");{const e=n.rootHtmlElement;if(void 0===e)throw new B(O[4]+" "+t.title);e.style.zIndex=i}}};wt.registerComponentFactoryFunction("template",(function(t,e){var i=document.querySelector("#".concat(e.id));t.element.innerHTML=i.innerHTML})),yt?wt.loadLayout({settings:{showPopoutIcon:!1,showCloseIcon:!1},dimensions:{minItemHeight:40},content:[{type:"row",content:[{type:"column",content:[{type:"component",isClosable:!1,reorderEnabled:!1,componentName:"template",title:"IC",componentState:{id:"client_wrapper"},height:56},{type:"stack",height:44,content:[{type:"component",isClosable:!1,reorderEnabled:!1,title:"IC Options",componentName:"template",componentState:{id:"icoptions"}},{type:"component",isClosable:!1,reorderEnabled:!1,title:"Main",componentName:"template",componentState:{id:"mainmenu"}},{type:"component",isClosable:!1,reorderEnabled:!1,title:"Log",componentName:"template",componentState:{id:"log"}},{type:"component",isClosable:!1,reorderEnabled:!1,title:"Music",componentName:"template",componentState:{id:"music"}},{type:"component",isClosable:!1,reorderEnabled:!1,title:"OOC",componentName:"template",componentState:{id:"ooc"}}]}]}]}]}):wt.loadLayout({settings:{showPopoutIcon:!1,showCloseIcon:!1},dimensions:{minItemHeight:40},content:[{type:"row",content:[{type:"column",width:40,content:[{type:"component",height:67,isClosable:!1,componentName:"template",title:"IC",componentState:{id:"client_wrapper"}},{type:"component",height:33,isClosable:!1,title:"IC Options",componentName:"template",componentState:{id:"icoptions"}}]},{type:"column",content:[{type:"row",height:65,content:[{type:"stack",content:[{type:"component",isClosable:!1,title:"Main",componentName:"template",componentState:{id:"mainmenu"}},{type:"component",isClosable:!1,title:"Log",componentName:"template",componentState:{id:"log"}}]},{type:"stack",width:30,content:[{type:"component",isClosable:!1,title:"Music",componentName:"template",componentState:{id:"music"}},{type:"component",isClosable:!1,title:"Players",componentName:"template",componentState:{id:"players"}}]}]},{type:"row",content:[{type:"component",title:"OOC",componentName:"template",componentState:{id:"ooc"}}]}]}]}]})}(); -//# sourceMappingURL=ui.0a8056a3ae2a0e82fb87.bundle.js.map \ No newline at end of file +!function(){"use strict";class t extends Error{constructor(t,e,i){super(`${t}: ${e}${void 0===i?"":": "+i}`)}}class e extends t{constructor(t,e){super("Assert",t,e)}}class i extends t{constructor(t,e,i){super("UnreachableCase",t,`${e}${void 0===i?"":": "+i}`)}}class n extends t{constructor(t,e){super("UnexpectedNull",t,e)}}class o extends t{constructor(t,e){super("UnexpectedUndefined",t,e)}}var s,r,a,l,h;!function(t){const e=["settings","hasHeaders","constrainDragToContainer","selectionEnabled","dimensions","borderWidth","minItemHeight","minItemWidth","headerHeight","dragProxyWidth","dragProxyHeight","labels","close","maximise","minimise","popout","content","componentType","componentState","id","width","type","height","isClosable","title","popoutWholeStack","openPopouts","parentId","activeItemIndex","reorderEnabled","borderGrabWidth"],i=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function n(t,e){const i={};for(const n in t)if(t.hasOwnProperty(n)){let a;a=e?s(n):r(n);const l=t[n];i[a]=o(l,e)}return i}function o(t,e){return"object"==typeof t?null===t?null:Array.isArray(t)?function(t,e){const i=t.length,n=new Array(i);for(let s=0;s36)throw new Error("Too many keys in config minifier map")},t.translateObject=n}(s||(s={})),function(t){t.defaultComponentBaseZIndex="auto",t.defaultComponentDragZIndex="32",t.defaultComponentStackMaximisedZIndex="41"}(r||(r={})),function(t){t.width="width",t.height="height"}(a||(a={})),function(t){t.top="top",t.left="left",t.right="right",t.bottom="bottom"}(l||(l={})),function(t){t.base="base",t.drag="drag",t.stackMaximised="stackMaximised"}(h||(h={}));const d={base:r.defaultComponentBaseZIndex,drag:r.defaultComponentDragZIndex,stackMaximised:r.defaultComponentStackMaximisedZIndex};var c,m,u,p,g,_,f,v,C,y,w,I,b,S;function E(t){return t.toString(10)+"px"}function x(t){const e=t.replace("px","");return parseFloat(e)}function z(t){return t>="0"&&t<="9"}function M(t,e){const i=E(e);t.style.width=i}function L(t,e){const i=E(e);t.style.height=i}function P(t){return{width:t.offsetWidth,height:t.offsetHeight}}function T(t,e){t.style.display=e?"":"none"}function A(t,e){if(void 0!==e)for(const i in e)if(e.hasOwnProperty(i)){const n=e[i],o=t[i];t[i]=D(o,n)}return t}function D(t,e){if("object"!=typeof e)return e;if(Array.isArray(e)){const t=e.length,i=new Array(t);for(let n=0;n"__glMaximised"===t));t>0&&(o=!0,n=n.splice(t,1)),e=n.length>0?n[0]:g.defaults.id}else e=n;return i=void 0!==t.maximised?t.maximised:o,{id:e,maximised:i}}}(N||(N={})),function(t){function i(t){if(void 0===t)return[];{const i=t.length,n=new Array(i);for(let o=0;o0?e.content[0]:void 0,{resolved:!0,root:q.resolve(i),openPopouts:t.resolveOpenPopouts(e.openPopouts),dimensions:t.Dimensions.resolve(e.dimensions),settings:t.Settings.resolve(e.settings),header:t.Header.resolve(e.header,e.settings,e.labels)}}},t.fromResolved=function(e){return{root:q.fromResolvedOrUndefined(e.root),openPopouts:X.fromResolvedArray(e.openPopouts),settings:I.Settings.createCopy(e.settings),dimensions:t.Dimensions.fromResolved(e.dimensions),header:I.Header.createCopy(e.header)}},t.isResolved=function(t){const e=t;return void 0!==e.resolved&&!0===e.resolved},t.resolveOpenPopouts=function(t){if(void 0===t)return[];{const e=t.length,i=new Array(e);for(let n=0;n0?e.content[0]:void 0,{root:q.resolve(o),openPopouts:j.resolveOpenPopouts(e.openPopouts),dimensions:j.Dimensions.resolve(e.dimensions),settings:j.Settings.resolve(e.settings),header:j.Header.resolve(e.header,e.settings,e.labels),parentId:null!==(i=e.parentId)&&void 0!==i?i:null,indexInParent:null!==(n=e.indexInParent)&&void 0!==n?n:null,window:t.Window.resolve(e.window,e.dimensions),resolved:!0}},t.fromResolved=function(e){return{root:q.fromResolvedOrUndefined(e.root),openPopouts:i(e.openPopouts),dimensions:j.Dimensions.fromResolved(e.dimensions),settings:I.Settings.createCopy(e.settings),header:I.Header.createCopy(e.header),parentId:e.parentId,indexInParent:e.indexInParent,window:t.Window.fromResolved(e.window)}},t.fromResolvedArray=i}(X||(X={}));class K{constructor(){this._allEventSubscriptions=[],this._subscriptionsMap=new Map,this.unbind=this.removeEventListener,this.trigger=this.emit}tryBubbleEvent(t,e){}emit(t,...e){let i=this._subscriptionsMap.get(t);if(void 0!==i){i=i.slice();for(let t=0;t0){const n=e.slice();n.unshift(t);const o=this._allEventSubscriptions.slice();for(let t=0;t0?n.contentItems[0]:n,e=0);const s=this._layoutManager.createAndInitContentItem(i,t);t.addChild(s,e),this._layoutManager.layoutConfig.settings.popInOnClose?this._onClose():this.close()}createWindow(){const t=this.createUrl(),e=Math.floor(1e6*Math.random()).toString(36),i=this.serializeWindowFeatures({width:this._initialWindowSize.width,height:this._initialWindowSize.height,innerWidth:this._initialWindowSize.width,innerHeight:this._initialWindowSize.height,menubar:"no",toolbar:"no",location:"no",personalbar:"no",resizable:"yes",scrollbars:"no",status:"no"});if(this._popoutWindow=globalThis.open(t,e,i),this._popoutWindow)this._popoutWindow.addEventListener("load",(()=>this.positionWindow()),{passive:!0}),this._popoutWindow.addEventListener("beforeunload",(()=>{this._layoutManager.layoutConfig.settings.popInOnClose?this.popIn():this._onClose()}),{passive:!0}),this._checkReadyInterval=setInterval((()=>this.checkReady()),10);else if(!0===this._layoutManager.layoutConfig.settings.blockedPopoutsThrowError)throw new H("Popout blocked")}checkReady(){if(null===this._popoutWindow)throw new n("BPCR01844");this._popoutWindow.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this.onInitialised(),void 0!==this._checkReadyInterval&&(clearInterval(this._checkReadyInterval),this._checkReadyInterval=void 0))}serializeWindowFeatures(t){const e=[];for(const i in t)e.push(i+"="+t[i].toString());return e.join(",")}createUrl(){const t="gl-window-config-"+k(),e=I.minifyConfig(this._config);try{localStorage.setItem(t,JSON.stringify(e))}catch(t){throw new Error("Error while writing to localStorage "+function(t){return t instanceof Error?t.message:"string"==typeof t?t:"Unknown Error"}(t))}const i=new URL(location.href);return i.searchParams.set("gl-window",t),i.toString()}positionWindow(){if(null===this._popoutWindow)throw new Error("BrowserPopout.positionWindow: null popoutWindow");this._popoutWindow.moveTo(this._initialWindowSize.left,this._initialWindowSize.top),this._popoutWindow.focus()}onInitialised(){this._isInitialised=!0,this.getGlInstance().on("popIn",(()=>this.popIn())),this.emit("initialised")}_onClose(){setTimeout((()=>this.emit("closed")),50)}}class tt{constructor(t,e,i,n){this._header=t,this._pushEvent=n,this._clickEventListener=t=>this.onClick(t),this._touchStartEventListener=t=>this.onTouchStart(t),this._element=document.createElement("div"),this._element.classList.add(i),this._element.title=e,this._header.on("destroy",(()=>this.destroy())),this._element.addEventListener("click",this._clickEventListener,{passive:!0}),this._element.addEventListener("touchstart",this._touchStartEventListener,{passive:!0}),this._header.controlsContainerElement.appendChild(this._element)}get element(){return this._element}destroy(){var t;this._element.removeEventListener("click",this._clickEventListener),this._element.removeEventListener("touchstart",this._touchStartEventListener),null===(t=this._element.parentNode)||void 0===t||t.removeChild(this._element)}onClick(t){this._pushEvent(t)}onTouchStart(t){this._pushEvent(t)}}class et extends K{constructor(t,e){super(),this._eElement=t,this._pointerTracking=!1,this._pointerDownEventListener=t=>this.onPointerDown(t),this._pointerMoveEventListener=t=>this.onPointerMove(t),this._pointerUpEventListener=t=>this.onPointerUp(t),this._timeout=void 0,this._allowableTargets=[t,...e],this._oDocument=document,this._eBody=document.body,this._nDelay=1800,this._nDistance=10,this._nX=0,this._nY=0,this._nOriginalX=0,this._nOriginalY=0,this._dragging=!1,this._eElement.addEventListener("pointerdown",this._pointerDownEventListener,{passive:!0})}destroy(){this.checkRemovePointerTrackingEventListeners(),this._eElement.removeEventListener("pointerdown",this._pointerDownEventListener)}cancelDrag(){this.processDragStop(void 0)}onPointerDown(t){if(this._allowableTargets.includes(t.target)&&t.isPrimary){const e=this.getPointerCoordinates(t);this.processPointerDown(e)}}processPointerDown(t){this._nOriginalX=t.x,this._nOriginalY=t.y,this._oDocument.addEventListener("pointermove",this._pointerMoveEventListener),this._oDocument.addEventListener("pointerup",this._pointerUpEventListener,{passive:!0}),this._pointerTracking=!0,this._timeout=setTimeout((()=>{try{this.startDrag()}catch(t){throw console.error(t),t}}),this._nDelay)}onPointerMove(t){this._pointerTracking&&(this.processDragMove(t),t.preventDefault())}processDragMove(t){this._nX=t.pageX-this._nOriginalX,this._nY=t.pageY-this._nOriginalY,!1===this._dragging&&(Math.abs(this._nX)>this._nDistance||Math.abs(this._nY)>this._nDistance)&&this.startDrag(),this._dragging&&this.emit("drag",this._nX,this._nY,t)}onPointerUp(t){this.processDragStop(t)}processDragStop(t){var e;void 0!==this._timeout&&(clearTimeout(this._timeout),this._timeout=void 0),this.checkRemovePointerTrackingEventListeners(),!0===this._dragging&&(this._eBody.classList.remove("lm_dragging"),this._eElement.classList.remove("lm_dragging"),null===(e=this._oDocument.querySelector("iframe"))||void 0===e||e.style.setProperty("pointer-events",""),this._dragging=!1,this.emit("dragStop",t))}checkRemovePointerTrackingEventListeners(){this._pointerTracking&&(this._oDocument.removeEventListener("pointermove",this._pointerMoveEventListener),this._oDocument.removeEventListener("pointerup",this._pointerUpEventListener),this._pointerTracking=!1)}startDrag(){var t;void 0!==this._timeout&&(clearTimeout(this._timeout),this._timeout=void 0),this._dragging=!0,this._eBody.classList.add("lm_dragging"),this._eElement.classList.add("lm_dragging"),null===(t=this._oDocument.querySelector("iframe"))||void 0===t||t.style.setProperty("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)}getPointerCoordinates(t){return{x:t.pageX,y:t.pageY}}}class it{constructor(t,e,i,n,o){var s;this._layoutManager=t,this._componentItem=e,this._closeEvent=i,this._focusEvent=n,this._dragStartEvent=o,this._isActive=!1,this._tabClickListener=t=>this.onTabClickDown(t),this._tabTouchStartListener=t=>this.onTabTouchStart(t),this._closeClickListener=()=>this.onCloseClick(),this._closeTouchStartListener=()=>this.onCloseTouchStart(),this._dragStartListener=(t,e)=>this.onDragStart(t,e),this._contentItemDestroyListener=()=>this.onContentItemDestroy(),this._tabTitleChangedListener=t=>this.setTitle(t),this._element=document.createElement("div"),this._element.classList.add("lm_tab"),this._titleElement=document.createElement("span"),this._titleElement.classList.add("lm_title"),this._closeElement=document.createElement("div"),this._closeElement.classList.add("lm_close_tab"),this._element.appendChild(this._titleElement),this._element.appendChild(this._closeElement),e.isClosable?this._closeElement.style.display="":this._closeElement.style.display="none",this.setTitle(e.title),this._componentItem.on("titleChanged",this._tabTitleChangedListener),(null!==(s=e.reorderEnabled)&&void 0!==s?s:this._layoutManager.layoutConfig.settings.reorderEnabled)&&this.enableReorder(),this._element.addEventListener("click",this._tabClickListener,{passive:!0}),this._element.addEventListener("touchstart",this._tabTouchStartListener,{passive:!0}),this._componentItem.isClosable?(this._closeElement.addEventListener("click",this._closeClickListener,{passive:!0}),this._closeElement.addEventListener("touchstart",this._closeTouchStartListener,{passive:!0})):(this._closeElement.remove(),this._closeElement=void 0),this._componentItem.setTab(this),this._layoutManager.emit("tabCreated",this)}get isActive(){return this._isActive}get componentItem(){return this._componentItem}get contentItem(){return this._componentItem}get element(){return this._element}get titleElement(){return this._titleElement}get closeElement(){return this._closeElement}get reorderEnabled(){return void 0!==this._dragListener}set reorderEnabled(t){t!==this.reorderEnabled&&(t?this.enableReorder():this.disableReorder())}setTitle(t){this._titleElement.innerText=t,this._element.title=t}setActive(t){t!==this._isActive&&(this._isActive=t,t?this._element.classList.add("lm_active"):this._element.classList.remove("lm_active"))}destroy(){var t,e;this._closeEvent=void 0,this._focusEvent=void 0,this._dragStartEvent=void 0,this._element.removeEventListener("click",this._tabClickListener),this._element.removeEventListener("touchstart",this._tabTouchStartListener),null===(t=this._closeElement)||void 0===t||t.removeEventListener("click",this._closeClickListener),null===(e=this._closeElement)||void 0===e||e.removeEventListener("touchstart",this._closeTouchStartListener),this._componentItem.off("titleChanged",this._tabTitleChangedListener),this.reorderEnabled&&this.disableReorder(),this._element.remove()}setBlurred(){this._element.classList.remove("lm_focused"),this._titleElement.classList.remove("lm_focused")}setFocused(){this._element.classList.add("lm_focused"),this._titleElement.classList.add("lm_focused")}onDragStart(t,e){if(void 0===this._dragListener)throw new o("TODSDLU10093");if(void 0===this._dragStartEvent)throw new o("TODS23309");this._dragStartEvent(t,e,this._dragListener,this.componentItem)}onContentItemDestroy(){void 0!==this._dragListener&&(this._dragListener.destroy(),this._dragListener=void 0)}onTabClickDown(t){const e=t.target;e!==this._element&&e!==this._titleElement||(0===t.button?this.notifyFocus():1===t.button&&this._componentItem.isClosable&&this.notifyClose())}onTabTouchStart(t){t.target===this._element&&this.notifyFocus()}onCloseClick(){this.notifyClose()}onCloseTouchStart(){this.notifyClose()}notifyClose(){if(void 0===this._closeEvent)throw new o("TNC15007");this._closeEvent(this._componentItem)}notifyFocus(){if(void 0===this._focusEvent)throw new o("TNA15007");this._focusEvent(this._componentItem)}enableReorder(){this._dragListener=new et(this._element,[this._titleElement]),this._dragListener.on("dragStart",this._dragStartListener),this._componentItem.on("destroy",this._contentItemDestroyListener)}disableReorder(){if(void 0===this._dragListener)throw new o("TDR87745");this._componentItem.off("destroy",this._contentItemDestroyListener),this._dragListener.off("dragStart",this._dragStartListener),this._dragListener=void 0}}class nt{constructor(t,e,i,n,o){this._layoutManager=t,this._componentRemoveEvent=e,this._componentFocusEvent=i,this._componentDragStartEvent=n,this._dropdownActiveChangedEvent=o,this._tabs=[],this._lastVisibleTabIndex=-1,this._dropdownActive=!1,this._element=document.createElement("section"),this._element.classList.add("lm_tabs"),this._dropdownElement=document.createElement("section"),this._dropdownElement.classList.add("lm_tabdropdown_list"),this._dropdownElement.style.display="none"}get tabs(){return this._tabs}get tabCount(){return this._tabs.length}get lastVisibleTabIndex(){return this._lastVisibleTabIndex}get element(){return this._element}get dropdownElement(){return this._dropdownElement}get dropdownActive(){return this._dropdownActive}destroy(){for(let t=0;tthis.handleTabCloseEvent(t)),(t=>this.handleTabFocusEvent(t)),((t,e,i,n)=>this.handleTabDragStartEvent(t,e,i,n)));void 0===e&&(e=this._tabs.length),this._tabs.splice(e,0,i),ethis._lastVisibleTabIndex){const t=this._tabs[i];for(let t=i;t>0;t--)this._tabs[t]=this._tabs[t-1];this._tabs[0]=t}}updateTabSizes(t,e){let i=!1;this.tryUpdateTabSizes(i,t,e)||(i=!0,this.tryUpdateTabSizes(i,t,e)),i!==this._dropdownActive&&(this._dropdownActive=i,this._dropdownActiveChangedEvent())}tryUpdateTabSizes(t,e,i){if(this._tabs.length>0){if(void 0===i)throw new Error("non-empty tabs must have active component item");let n=0,o=!1;const s=this._layoutManager.layoutConfig.settings.tabOverlapAllowance,r=this._tabs.indexOf(i.tab),a=this._tabs[r];this._lastVisibleTabIndex=-1;for(let i=0;ie){if(o)i===r&&(l.style.zIndex="auto",l.style.marginLeft="",l.parentElement!==this._element&&this._element.appendChild(l));else{let t;if(t=r>0&&r<=i?(d-e)/(i-1):(d-e)/i,tthis.onClick(t),this._touchStartListener=t=>this.onTouchStart(t),this._rowColumnClosable=!0,this._closeButton=null,this._popoutButton=null,this._tabsContainer=new nt(this._layoutManager,(t=>this.handleTabInitiatedComponentRemoveEvent(t)),(t=>this.handleTabInitiatedComponentFocusEvent(t)),((t,e,i,n)=>this.handleTabInitiatedDragStartEvent(t,e,i,n)),(()=>this.processTabDropdownActiveChanged())),this._show=i.show,this._popoutEnabled=i.popoutEnabled,this._popoutLabel=i.popoutLabel,this._maximiseEnabled=i.maximiseEnabled,this._maximiseLabel=i.maximiseLabel,this._minimiseEnabled=i.minimiseEnabled,this._minimiseLabel=i.minimiseLabel,this._closeEnabled=i.closeEnabled,this._closeLabel=i.closeLabel,this._tabDropdownEnabled=i.tabDropdownEnabled,this._tabDropdownLabel=i.tabDropdownLabel,this.setSide(i.side),this._canRemoveComponent=this._configClosable,this._element=document.createElement("section"),this._element.classList.add("lm_header"),this._controlsContainerElement=document.createElement("section"),this._controlsContainerElement.classList.add("lm_controls"),this._element.appendChild(this._tabsContainer.element),this._element.appendChild(this._controlsContainerElement),this._element.appendChild(this._tabsContainer.dropdownElement),this._element.addEventListener("click",this._clickListener,{passive:!0}),this._element.addEventListener("touchstart",this._touchStartListener,{passive:!0}),this._documentMouseUpListener=()=>this._tabsContainer.hideAdditionalTabsDropdown(),globalThis.document.addEventListener("mouseup",this._documentMouseUpListener,{passive:!0}),this._tabControlOffset=this._layoutManager.layoutConfig.settings.tabControlOffset,this._tabDropdownEnabled&&(this._tabDropdownButton=new tt(this,this._tabDropdownLabel,"lm_tabdropdown",(()=>this._tabsContainer.showAdditionalTabsDropdown()))),this._popoutEnabled&&(this._popoutButton=new tt(this,this._popoutLabel,"lm_popout",(()=>this.handleButtonPopoutEvent()))),this._maximiseEnabled&&(this._maximiseButton=new tt(this,this._maximiseLabel,"lm_maximise",(t=>this.handleButtonMaximiseToggleEvent(t)))),this._configClosable&&(this._closeButton=new tt(this,this._closeLabel,"lm_close",(()=>s()))),this.processTabDropdownActiveChanged()}get show(){return this._show}get side(){return this._side}get leftRightSided(){return this._leftRightSided}get layoutManager(){return this._layoutManager}get parent(){return this._parent}get tabs(){return this._tabsContainer.tabs}get lastVisibleTabIndex(){return this._tabsContainer.lastVisibleTabIndex}get element(){return this._element}get tabsContainerElement(){return this._tabsContainer.element}get controlsContainerElement(){return this._controlsContainerElement}destroy(){this.emit("destroy"),this._popoutEvent=void 0,this._maximiseToggleEvent=void 0,this._clickEvent=void 0,this._touchStartEvent=void 0,this._componentRemoveEvent=void 0,this._componentFocusEvent=void 0,this._componentDragStartEvent=void 0,this._tabsContainer.destroy(),globalThis.document.removeEventListener("mouseup",this._documentMouseUpListener),this._element.remove()}createTab(t,e){this._tabsContainer.createTab(t,e)}removeTab(t){this._tabsContainer.removeTab(t)}processActiveComponentChanged(t){this._tabsContainer.processActiveComponentChanged(t),this.updateTabSizes()}setSide(t){this._side=t,this._leftRightSided=[l.right,l.left].includes(this._side)}setRowColumnClosable(t){this._rowColumnClosable=t,this.updateClosability()}updateClosability(){let t;if(this._configClosable)if(this._rowColumnClosable){t=!0;const e=this.tabs.length;for(let i=0;i1}applyFocusedValue(t){t?this._element.classList.add("lm_focused"):this._element.classList.remove("lm_focused")}processMaximised(){if(void 0===this._maximiseButton)throw new o("HPMAX16997");this._maximiseButton.element.setAttribute("title",this._minimiseLabel)}processMinimised(){if(void 0===this._maximiseButton)throw new o("HPMIN16997");this._maximiseButton.element.setAttribute("title",this._maximiseLabel)}updateTabSizes(){if(this._tabsContainer.tabCount>0){const t=this._show?this._layoutManager.layoutConfig.dimensions.headerHeight:0;let e;this._leftRightSided?(this._element.style.height="",this._element.style.width=E(t)):(this._element.style.width="",this._element.style.height=E(t)),e=this._leftRightSided?this._element.offsetHeight-this._controlsContainerElement.offsetHeight-this._tabControlOffset:this._element.offsetWidth-this._controlsContainerElement.offsetWidth-this._tabControlOffset,this._tabsContainer.updateTabSizes(e,this._getActiveComponentItemEvent())}}handleTabInitiatedComponentRemoveEvent(t){if(this._canRemoveComponent){if(void 0===this._componentRemoveEvent)throw new o("HHTCE22294");this._componentRemoveEvent(t)}}handleTabInitiatedComponentFocusEvent(t){if(void 0===this._componentFocusEvent)throw new o("HHTAE22294");this._componentFocusEvent(t)}handleTabInitiatedDragStartEvent(t,e,i,n){if(this._canRemoveComponent){if(void 0===this._componentDragStartEvent)throw new o("HHTDSE22294");this._componentDragStartEvent(t,e,i,n)}else i.cancelDrag()}processTabDropdownActiveChanged(){void 0!==this._tabDropdownButton&&T(this._tabDropdownButton.element,this._tabsContainer.dropdownActive)}handleButtonPopoutEvent(){if(this._layoutManager.layoutConfig.settings.popoutWholeStack){if(void 0===this._popoutEvent)throw new o("HHBPOE17834");this._popoutEvent()}else{const t=this._getActiveComponentItemEvent();t&&t.popout()}}handleButtonMaximiseToggleEvent(t){if(void 0===this._maximiseToggleEvent)throw new o("HHBMTE16834");this._maximiseToggleEvent()}onClick(t){t.target===this._element&&this.notifyClick(t)}onTouchStart(t){t.target===this._element&&this.notifyTouchStart(t)}notifyClick(t){if(void 0===this._clickEvent)throw new o("HNHC46834");this._clickEvent(t)}notifyTouchStart(t){if(void 0===this._touchStartEvent)throw new o("HNHTS46834");this._touchStartEvent(t)}}class st extends K{constructor(t,e,i,n,o,s,r,a,l){super(),this._config=t,this._parent=e,this._layoutManager=i,this._element=n,this._updateItemConfigEvent=o,this._showEvent=s,this._hideEvent=r,this._focusEvent=a,this._blurEvent=l,this._stackMaximised=!1,this._width=0,this._height=0,this._visible=!0,this._isShownWithZeroDimensions=!0,this._componentType=t.componentType,this._isClosable=t.isClosable,this._initialState=t.componentState,this._state=this._initialState,this._boundComponent=this.layoutManager.bindComponent(this,t),this.updateElementPositionPropertyFromBoundComponent()}get width(){return this._width}get height(){return this._height}get parent(){return this._parent}get componentName(){return this._componentType}get componentType(){return this._componentType}get virtual(){return this._boundComponent.virtual}get component(){return this._boundComponent.component}get tab(){return this._tab}get title(){return this._parent.title}get layoutManager(){return this._layoutManager}get isHidden(){return!this._visible}get visible(){return this._visible}get state(){return this._state}get initialState(){return this._initialState}get element(){return this._element}destroy(){this.releaseComponent(),this.stateRequestEvent=void 0,this.emit("destroy")}getElement(){return this._element}hide(){this._hideEvent()}show(){this._showEvent()}focus(t=!1){this._focusEvent(t)}blur(t=!1){this._blurEvent(t)}setSize(t,i){let o=this._parent;if(o.isColumn||o.isRow||null===o.parent)throw new e("ICSSPRC","ComponentContainer cannot have RowColumn Parent");{let e;do{e=o,o=o.parent}while(null!==o&&!o.isColumn&&!o.isRow);if(null===o)return!1;{const s=o.isColumn?"height":"width",r=this[s];if(null===r)throw new n("ICSSCS11194");{const n=("height"===s?i:t)/(r*(1/(e.size/100)))*100,a=(e.size-n)/(o.contentItems.length-1);for(let t=0;t0)this.updateSize(!1);else if(!this.isGround&&!0===this._isClosable){if(null===this._parent)throw new n("CIUC00874");this._parent.removeChild(this)}}addChild(t,e,i){return null!=e||(e=this._contentItems.length),this._contentItems.splice(e,0,t),t.setParent(this),!0===this._isInitialised&&!1===t._isInitialised&&t.init(),e}replaceChild(t,i,o=!1){const s=this._contentItems.indexOf(t),r=t._element.parentNode;if(-1===s)throw new e("CIRCI23232","Can't replace child. oldChild is not child of this");if(null===r)throw new n("CIRCP23232");if(r.replaceChild(i._element,t._element),!0===o&&(t._parent=null,t.destroy()),this._contentItems[s]=i,i.setParent(this),i.size=t.size,i.sizeUnit=t.sizeUnit,i.minSize=t.minSize,i.minSizeUnit=t.minSizeUnit,null===i._parent)throw new n("CIRCNC45699");!0===i._parent._isInitialised&&!1===i._isInitialised&&i.init(),this.updateSize(!1)}remove(){if(null===this._parent)throw new n("CIR11110");this._parent.removeChild(this)}popout(){const t=k(),e=this.layoutManager.createPopoutFromContentItem(this,void 0,t,void 0);return this.emitBaseBubblingEvent("stateChanged"),e}calculateConfigContent(){const t=this._contentItems,e=t.length,i=new Array(e);for(let n=0;nthis.propagateEventToLayoutManager(t,e))))}propagateEventToLayoutManager(t,e){this._pendingEventPropagations[t]=!1,this.layoutManager.emitUnknown(t,e)}}class at extends rt{constructor(t,e,i){super(t,e,i,document.createElement("div")),this._parentItem=i,this._focused=!1,this.isComponent=!0,this._reorderEnabled=e.reorderEnabled,this.applyUpdatableConfig(e),this._initialWantMaximise=e.maximised;const n=document.createElement("div");n.classList.add("lm_content"),this.element.appendChild(n),this._container=new st(e,this,t,n,(t=>this.handleUpdateItemConfigEvent(t)),(()=>this.show()),(()=>this.hide()),(t=>this.focus(t)),(t=>this.blur(t)))}get componentName(){return this._container.componentType}get componentType(){return this._container.componentType}get reorderEnabled(){return this._reorderEnabled}get initialWantMaximise(){return this._initialWantMaximise}get component(){return this._container.component}get container(){return this._container}get parentItem(){return this._parentItem}get headerConfig(){return this._headerConfig}get title(){return this._title}get tab(){return this._tab}get focused(){return this._focused}destroy(){this._container.destroy(),super.destroy()}applyUpdatableConfig(t){this.setTitle(t.title),this._headerConfig=t.header}toConfig(){const t=this._container.stateRequestEvent,e=void 0===t?this._container.state:t();return{type:m.component,content:[],size:this.size,sizeUnit:this.sizeUnit,minSize:this.minSize,minSizeUnit:this.minSizeUnit,id:this.id,maximised:!1,isClosable:this.isClosable,reorderEnabled:this._reorderEnabled,title:this._title,header:_.Header.createCopy(this._headerConfig),componentType:v.copyComponentType(this.componentType),componentState:e}}close(){if(null===this.parent)throw new n("CIC68883");this.parent.removeChild(this,!1)}enterDragMode(t,e){M(this.element,t),L(this.element,e),this._container.enterDragMode(t,e)}exitDragMode(){this._container.exitDragMode()}enterStackMaximised(){this._container.enterStackMaximised()}exitStackMaximised(){this._container.exitStackMaximised()}drag(){this._container.drag()}updateSize(t){this.updateNodeSize(t)}init(){this.updateNodeSize(!1),super.init(),this._container.emit("open"),this.initContentItems()}setTitle(t){this._title=t,this.emit("titleChanged",t),this.emit("stateChanged")}setTab(t){this._tab=t,this.emit("tab",t),this._container.setTab(t)}hide(){super.hide(),this._container.setVisibility(!1)}show(){super.show(),this._container.setVisibility(!0)}focus(t=!1){this.parentItem.setActiveComponentItem(this,!0,t)}setFocused(t){this._focused=!0,this.tab.setFocused(),t||this.emitBaseBubblingEvent("focus")}blur(t=!1){this._focused&&this.layoutManager.setFocusedComponentItem(void 0,t)}setBlurred(t){this._focused=!1,this.tab.setBlurred(),t||this.emitBaseBubblingEvent("blur")}setParent(t){this._parentItem=t,super.setParent(t)}handleUpdateItemConfigEvent(t){this.applyUpdatableConfig(t)}updateNodeSize(t){if("none"!==this.element.style.display){const{width:e,height:i}=P(this.element);this._container.setSizeToNodeSize(e,i,t)}}}class lt extends rt{constructor(){super(...arguments),this._focused=!1}get focused(){return this._focused}setFocusedValue(t){this._focused=t}}class ht extends lt{constructor(t,e,i){var n,o,s,r,a,h,d,c,m,u,p,g,_,f,v,C,y,w,I;super(t,e,i,ht.createElement(document)),this._headerSideChanged=!1,this._resizeListener=()=>this.handleResize(),this._maximisedListener=()=>this.handleMaximised(),this._minimisedListener=()=>this.handleMinimised(),this._headerConfig=e.header;const b=t.layoutConfig.header,S=e.content;let E;E=1!==S.length?void 0:S[0].header,this._initialWantMaximise=e.maximised,this._initialActiveItemIndex=null!==(n=e.activeItemIndex)&&void 0!==n?n:0;const x=null!==(r=null!==(s=null===(o=this._headerConfig)||void 0===o?void 0:o.show)&&void 0!==s?s:null==E?void 0:E.show)&&void 0!==r?r:b.show,z=null!==(d=null!==(h=null===(a=this._headerConfig)||void 0===a?void 0:a.popout)&&void 0!==h?h:null==E?void 0:E.popout)&&void 0!==d?d:b.popout,M=null!==(u=null!==(m=null===(c=this._headerConfig)||void 0===c?void 0:c.maximise)&&void 0!==m?m:null==E?void 0:E.maximise)&&void 0!==u?u:b.maximise,L=null!==(_=null!==(g=null===(p=this._headerConfig)||void 0===p?void 0:p.close)&&void 0!==g?g:null==E?void 0:E.close)&&void 0!==_?_:b.close,P=null!==(C=null!==(v=null===(f=this._headerConfig)||void 0===f?void 0:f.minimise)&&void 0!==v?v:null==E?void 0:E.minimise)&&void 0!==C?C:b.minimise,T=null!==(I=null!==(w=null===(y=this._headerConfig)||void 0===y?void 0:y.tabDropdown)&&void 0!==w?w:null==E?void 0:E.tabDropdown)&&void 0!==I?I:b.tabDropdown;this._maximisedEnabled=!1!==M;const A={show:!1!==x,side:!1===x?l.top:x,popoutEnabled:!1!==z,popoutLabel:!1===z?"":z,maximiseEnabled:this._maximisedEnabled,maximiseLabel:!1===M?"":M,closeEnabled:!1!==L,closeLabel:!1===L?"":L,minimiseEnabled:!0,minimiseLabel:P,tabDropdownEnabled:!1!==T,tabDropdownLabel:!1===T?"":T};this._header=new ot(t,this,A,e.isClosable&&!1!==L,(()=>this.getActiveComponentItem()),(()=>this.remove()),(()=>this.handlePopoutEvent()),(()=>this.toggleMaximise()),(t=>this.handleHeaderClickEvent(t)),(t=>this.handleHeaderTouchStartEvent(t)),(t=>this.handleHeaderComponentRemoveEvent(t)),(t=>this.handleHeaderComponentFocusEvent(t)),((t,e,i,n)=>this.handleHeaderComponentStartDragEvent(t,e,i,n))),this.isStack=!0,this._childElementContainer=document.createElement("section"),this._childElementContainer.classList.add("lm_items"),this.on("resize",this._resizeListener),this._maximisedEnabled&&(this.on("maximised",this._maximisedListener),this.on("minimised",this._minimisedListener)),this.element.appendChild(this._header.element),this.element.appendChild(this._childElementContainer),this.setupHeaderPosition(),this._header.updateClosability()}get childElementContainer(){return this._childElementContainer}get header(){return this._header}get headerShow(){return this._header.show}get headerSide(){return this._header.side}get headerLeftRightSided(){return this._header.leftRightSided}get contentAreaDimensions(){return this._contentAreaDimensions}get initialWantMaximise(){return this._initialWantMaximise}get isMaximised(){return this===this.layoutManager.maximisedStack}get stackParent(){if(!this.parent)throw new Error("Stack should always have a parent");return this.parent}updateSize(t){this.layoutManager.beginVirtualSizedContainerAdding();try{this.updateNodeSize(),this.updateContentItemsSize(t)}finally{this.layoutManager.endVirtualSizedContainerAdding()}}init(){if(!0===this.isInitialised)return;this.updateNodeSize();for(let t=0;t0){if(this._initialActiveItemIndex<0||this._initialActiveItemIndex>=e)throw new Error(`ActiveItemIndex out of range: ${this._initialActiveItemIndex} id: ${this.id}`);for(let i=0;ithis.contentItems.length)throw i-=1,new e("SAC99728");if(t instanceof at)return i=super.addChild(t,i),this._childElementContainer.appendChild(t.element),this._header.createTab(t,i),this.setActiveComponentItem(t,n),this._header.updateTabSizes(),this.updateSize(!1),t.container.setBaseLogicalZIndex(),this._header.updateClosability(),this.emitStateChangedEvent(),i;throw new e("SACC88532")}removeChild(t,e){const i=t,n=this.contentItems.indexOf(i),o=1===this.contentItems.length;if(this._activeComponentItem===i&&(i.focused&&i.blur(),!o)){const t=0===n?1:n-1;this.setActiveComponentItem(this.contentItems[t],!1)}this._header.removeTab(i),super.removeChild(i,e),o||this._header.updateClosability(),this.emitStateChangedEvent()}toggleMaximise(){this.isMaximised?this.minimise():this.maximise()}maximise(){if(!this.isMaximised){this.layoutManager.setMaximisedStack(this);const t=this.contentItems,i=t.length;for(let n=0;n0&&void 0===t)throw new Error("expected non-empty stack to have an active component item");return{type:"stack",content:this.calculateConfigContent(),size:this.size,sizeUnit:this.sizeUnit,minSize:this.minSize,minSizeUnit:this.minSizeUnit,id:this.id,isClosable:this.isClosable,maximised:this.isMaximised,header:this.createHeaderConfig(),activeItemIndex:t}}onDrop(t,e){if("header"===this._dropSegment){if(this.resetHeaderDropZone(),void 0===this._dropIndex)throw new o("SODDI68990");return void this.addChild(t,this._dropIndex)}if("body"===this._dropSegment)return void this.addChild(t,0,!0);const i="top"===this._dropSegment||"bottom"===this._dropSegment,n="left"===this._dropSegment||"right"===this._dropSegment,s="top"===this._dropSegment||"left"===this._dropSegment,r=i&&this.stackParent.isColumn||n&&this.stackParent.isRow;if(t.isComponent){const e=f.createDefault();e.header=this.createHeaderConfig();const i=this.layoutManager.createAndInitContentItem(e,this);i.addChild(t),t=i}if(t.type===m.row||t.type===m.column){const e=f.createDefault();e.header=this.createHeaderConfig();const i=this.layoutManager.createContentItem(e,this);i.addChild(t),t=i}if(r){const e=this.stackParent.contentItems.indexOf(this);this.stackParent.addChild(t,s?e:e+1,!0),this.size*=.5,t.size=this.size,t.sizeUnit=this.sizeUnit,this.stackParent.updateSize(!1)}else{const e=i?m.column:m.row,n=g.createDefault(e),o=this.layoutManager.createContentItem(n,this);this.stackParent.replaceChild(this,o),o.addChild(t,s?0:void 0,!0),o.addChild(this,s?void 0:0,!0),this.size=50,t.size=50,t.sizeUnit=p.Percent,o.updateSize(!1)}}highlightDropZone(t,e){for(const i in this._contentAreaDimensions){const n=i,o=this._contentAreaDimensions[n].hoverArea;if(o.x1t&&o.y1e)return void("header"===n?(this._dropSegment="header",this.highlightHeaderDropZone(this._header.leftRightSided?e:t)):(this.resetHeaderDropZone(),this.highlightBodyDropZone(n)))}}getArea(){if("none"===this.element.style.display)return null;const t=super.getElementArea(this._header.element),e=super.getElementArea(this._childElementContainer);if(null===t||null===e)throw new n("SGAHC13086");const i=e.x2-e.x1,o=e.y2-e.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}}},0===this.contentItems.length?(this._contentAreaDimensions.body={hoverArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}},super.getElementArea(this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:e.x1,y1:e.y1,x2:e.x1+.25*i,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x1+.5*i,y2:e.y2}},this._contentAreaDimensions.top={hoverArea:{x1:e.x1+.25*i,y1:e.y1,x2:e.x1+.75*i,y2:e.y1+.5*o},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y1+.5*o}},this._contentAreaDimensions.right={hoverArea:{x1:e.x1+.75*i,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1+.5*i,y1:e.y1,x2:e.x2,y2:e.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:e.x1+.25*i,y1:e.y1+.5*o,x2:e.x1+.75*i,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1+.5*o,x2:e.x2,y2:e.y2}},super.getElementArea(this.element))}positionHeader(t){this._header.side!==t&&(this._header.setSide(t),this._headerSideChanged=!0,this.setupHeaderPosition())}updateNodeSize(){if("none"!==this.element.style.display){const t=P(this.element);this._header.show&&(t[this._header.leftRightSided?a.width:a.height]-=this.layoutManager.layoutConfig.dimensions.headerHeight),this._childElementContainer.style.width=E(t.width),this._childElementContainer.style.height=E(t.height);for(let e=0;e=n&&tthis.onDrag(t,e,i))),this._dragListener.on("dragStop",(()=>this.onDrop())),this.createDragProxyElements(t,e),null===this._componentItem.parent)throw new n("DPC10097");this._componentItemFocused=this._componentItem.focused,this._componentItemFocused&&this._componentItem.blur(),this._componentItem.parent.removeChild(this._componentItem,!0),this.setDimensions(),document.body.appendChild(this._element),this.determineMinMaxXY(),this._layoutManager.calculateItemAreas(),this.setDropPosition(t,e)}get element(){return this._element}createDragProxyElements(t,e){this._element=document.createElement("div"),this._element.classList.add("lm_dragProxy");const i=document.createElement("div");i.classList.add("lm_header");const n=document.createElement("div");n.classList.add("lm_tabs");const o=document.createElement("div");o.classList.add("lm_tab");const s=document.createElement("span");s.classList.add("lm_title"),o.appendChild(s),n.appendChild(o),i.appendChild(n),this._proxyContainerElement=document.createElement("div"),this._proxyContainerElement.classList.add("lm_content"),this._element.appendChild(i),this._element.appendChild(this._proxyContainerElement),this._originalParent instanceof ht&&this._originalParent.headerShow&&(this._sided=this._originalParent.headerLeftRightSided,this._element.classList.add("lm_"+this._originalParent.headerSide),[l.right,l.bottom].indexOf(this._originalParent.headerSide)>=0&&this._proxyContainerElement.insertAdjacentElement("afterend",i)),this._element.style.left=E(t),this._element.style.top=E(e),o.setAttribute("title",this._componentItem.title),s.insertAdjacentText("afterbegin",this._componentItem.title),this._proxyContainerElement.appendChild(this._componentItem.element)}determineMinMaxXY(){const t=this._layoutManager.groundItem;if(void 0===t)throw new o("DPDMMXY73109");{const e=t.element.getBoundingClientRect();this._minX=e.left+document.body.scrollLeft,this._minY=e.top+document.body.scrollTop,this._maxX=this._minX+e.width,this._maxY=this._minY+e.height}}onDrag(t,e,i){const n=i.pageX,o=i.pageY;this.setDropPosition(n,o),this._componentItem.drag()}setDropPosition(t,e){this._layoutManager.layoutConfig.settings.constrainDragToContainer&&(t<=this._minX?t=Math.ceil(this._minX):t>=this._maxX&&(t=Math.floor(this._maxX)),e<=this._minY?e=Math.ceil(this._minY):e>=this._maxY&&(e=Math.floor(this._maxY))),this._element.style.left=E(t),this._element.style.top=E(e),this._area=this._layoutManager.getArea(t,e),null!==this._area&&(this._lastValidArea=this._area,this._area.contentItem.highlightDropZone(t,e,this._area))}onDrop(){const t=this._layoutManager.dropTargetIndicator;if(null===t)throw new n("DPOD30011");let e;t.hide(),this._componentItem.exitDragMode(),null!==this._area?(e=this._componentItem,this._area.contentItem.onDrop(e,this._area)):null!==this._lastValidArea?(e=this._componentItem,this._lastValidArea.contentItem.onDrop(e,this._lastValidArea)):this._originalParent?(e=this._componentItem,this._originalParent.addChild(e)):this._componentItem.destroy(),this._element.remove(),this._layoutManager.emit("itemDropped",this._componentItem),this._componentItemFocused&&void 0!==e&&e.focus()}setDimensions(){const t=this._layoutManager.layoutConfig.dimensions;if(void 0===t)throw new Error("DragProxy.setDimensions: dimensions undefined");let e=t.dragProxyWidth,i=t.dragProxyHeight;if(void 0===e||void 0===i)throw new Error("DragProxy.setDimensions: width and/or height undefined");const n=!1===this._layoutManager.layoutConfig.header.show?0:t.headerHeight;this._element.style.width=E(e),this._element.style.height=E(i),e-=this._sided?n:0,i-=this._sided?0:n,this._proxyContainerElement.style.width=E(e),this._proxyContainerElement.style.height=E(i),this._componentItem.enterDragMode(e,i),this._componentItem.show()}}class ct{constructor(t,e,i){this._isVertical=t,this._size=e,this._grabSize=i0){const i=this.createSplitter(Math.max(0,e-1)).element;e>0?(this.contentItems[e-1].element.insertAdjacentElement("afterend",i),i.insertAdjacentElement("afterend",t.element)):(this.contentItems[0].element.insertAdjacentElement("beforebegin",i),i.insertAdjacentElement("beforebegin",t.element))}else this._childElementContainer.appendChild(t.element);super.addChild(t,e);const n=1/this.contentItems.length*100;if(!0===i)return this.emitBaseBubblingEvent("stateChanged"),e;for(let e=0;e0&&(this.calculateRelativeSizes(),this.setAbsoluteSizes()),this.emitBaseBubblingEvent("stateChanged"),this.emit("resize")}setAbsoluteSizes(){const t=this.calculateAbsoluteSizes();for(let e=0;e0&&t.itemSizes[e]++,this._isColumn?(M(this.contentItems[e].element,t.crossAxisSize),L(this.contentItems[e].element,t.itemSizes[e])):(M(this.contentItems[e].element,t.itemSizes[e]),L(this.contentItems[e].element,t.crossAxisSize))}calculateAbsoluteSizes(){const t=(this.contentItems.length-1)*this._splitterSize,{width:i,height:n}=P(this.element);let o,s;this._isColumn?(o=n-t,s=i):(o=i-t,s=n);let r=0;const a=[];for(let t=0;t0){const e=100-t;for(let t=0;t100&&i.length>0){for(let t=0;te)return;{const r=i/e;let a=i;for(let e=0;ethis.onSplitterDrag(e,t,i))),e.on("dragStop",(()=>this.onSplitterDragStop(e))),e.on("dragStart",(()=>this.onSplitterDragStart(e))),this._splitter.splice(t,0,e),e}getSplitItems(t){const e=this._splitter.indexOf(t);return{before:this.contentItems[e],after:this.contentItems[e+1]}}calculateContentItemMinSize(t){const i=t.minSize;if(void 0!==i){if(t.minSizeUnit===p.Pixel)return i;throw new e("ROCGMD98831",JSON.stringify(t))}{const t=this.layoutManager.layoutConfig.dimensions;return this._isColumn?t.defaultMinItemHeight:t.defaultMinItemWidth}}calculateContentItemsTotalMinSize(t){let e=0;for(const i of t)e+=this.calculateContentItemMinSize(i);return e}onSplitterDragStart(t){const e=this.getSplitItems(t),i=x(e.before.element.style[this._dimension]),n=x(e.after.element.style[this._dimension]),o=this.calculateContentItemsTotalMinSize(e.before.contentItems),s=this.calculateContentItemsTotalMinSize(e.after.contentItems);this._splitterPosition=0,this._splitterMinPosition=-1*(i-o),this._splitterMaxPosition=n-s}onSplitterDrag(t,e,i){let o=this._isColumn?i:e;if(null===this._splitterMinPosition||null===this._splitterMaxPosition)throw new n("ROCOSD59226");o=Math.max(o,this._splitterMinPosition),o=Math.min(o,this._splitterMaxPosition),this._splitterPosition=o;const s=E(o);this._isColumn?t.element.style.top=s:t.element.style.left=s}onSplitterDragStop(t){if(null===this._splitterPosition)throw new n("ROCOSDS66932");{const e=this.getSplitItems(t),i=x(e.before.element.style[this._dimension]),n=x(e.after.element.style[this._dimension]),o=(this._splitterPosition+i)/(i+n),s=e.before.size+e.after.size;e.before.size=o*s,e.after.size=(1-o)*s,t.element.style.top=E(0),t.element.style.left=E(0),globalThis.requestAnimationFrame((()=>this.updateSize(!1)))}}}!function(t){t.getElementDimensionSize=function(t,e){return"width"===e?function(t){return t.offsetWidth}(t):function(t){return t.offsetHeight}(t)},t.setElementDimensionSize=function(t,e,i){return"width"===e?M(t,i):L(t,i)},t.createElement=function(t,e){const i=t.createElement("div");return i.classList.add("lm_item"),e?i.classList.add("lm_column"):i.classList.add("lm_row"),i}}(mt||(mt={}));class ut extends lt{constructor(t,e,i){super(t,w.create(e),null,ut.createElement(document)),this.isGround=!0,this._childElementContainer=this.element,this._containerElement=i;let n=null;for(;;){const t=n?n.previousSibling:this._containerElement.lastChild;if(!(t instanceof Element&&t.classList.contains("lm_content")))break;n=t}this._containerElement.insertBefore(this.element,n)}init(){if(!0!==this.isInitialised){this.updateNodeSize();for(let t=0;t0?this.contentItems[0]:this,n.isComponent)throw new Error("Cannot add item as child to ComponentItem");{const t=this.layoutManager.createAndInitContentItem(i,n);return e=n.addChild(t,e),n===this?-1:e}}loadComponentAsRoot(t){this.clearRoot();const e=F.resolve(t,!1);if(e.maximised)throw new Error("Root Component cannot be maximised");{const t=new at(this.layoutManager,e,this);t.init(),this.addChild(t,0)}}addChild(t,e){if(this.contentItems.length>0)throw new Error("Ground node can only have a single child");return this._childElementContainer.appendChild(t.element),e=super.addChild(t,e),this.updateSize(!1),this.emitBaseBubblingEvent("stateChanged"),e}calculateConfigContent(){const t=this.contentItems,i=t.length,n=new Array(i);for(let o=0;o0&&(M(this.contentItems[0].element,t),L(this.contentItems[0].element,e)),this.updateContentItemsSize(!1))}updateSize(t){this.layoutManager.beginVirtualSizedContainerAdding();try{this.updateNodeSize(),this.updateContentItemsSize(t)}finally{this.layoutManager.endVirtualSizedContainerAdding()}}createSideAreas(){const t=ut.Area.oppositeSides,e=new Array(Object.keys(t).length);let i=0;for(const o in t){const s=o,r=this.getElementArea();if(null===r)throw new n("RCSA77553");r.side=s,"2"===t[s][1]?r[s]=r[t[s]]-50:r[s]=r[t[s]]+50,r.surface=(r.x2-r.x1)*(r.y2-r.y1),e[i++]=r}return e}highlightDropZone(t,e,i){this.layoutManager.tabDropPlaceholder.remove(),super.highlightDropZone(t,e,i)}onDrop(t,e){if(t.isComponent){const e=f.createDefault(),i=t;e.header=_.Header.createCopy(i.headerConfig);const n=this.layoutManager.createAndInitContentItem(e,this);n.addChild(t),t=n}if(0===this.contentItems.length)this.addChild(t);else{if(t.type===m.row||t.type===m.column){const e=f.createDefault(),i=this.layoutManager.createContentItem(e,this);i.addChild(t),t=i}const i="x"==e.side[0]?m.row:m.column,n="2"==e.side[1],o=this.contentItems[0];if(o instanceof mt&&o.type===i){const e=o.contentItems[n?0:o.contentItems.length-1];o.addChild(t,n?0:void 0,!0),e.size*=.5,t.size=e.size,t.sizeUnit=p.Percent,o.updateSize(!1)}else{const e=g.createDefault(i),s=this.layoutManager.createContentItem(e,this);this.replaceChild(o,s),s.addChild(t,n?0:void 0,!0),s.addChild(o,n?void 0:0,!0),o.size=50,t.size=50,t.sizeUnit=p.Percent,s.updateSize(!1)}}}dock(){throw new e("GID87731")}validateDocking(){throw new e("GIVD87732")}getAllContentItems(){const t=[this];return this.deepGetAllContentItems(this.contentItems,t),t}getConfigMaximisedItems(){const t=[];return this.deepFilterContentItems(this.contentItems,t,(t=>!(!rt.isStack(t)||!t.initialWantMaximise)||!(!rt.isComponentItem(t)||!t.initialWantMaximise))),t}getItemsByPopInParentId(t){const e=[];return this.deepFilterContentItems(this.contentItems,e,(e=>e.popInParentIds.includes(t))),e}toConfig(){throw new Error("Cannot generate GroundItem config")}setActiveComponentItem(t,e,i){}updateNodeSize(){const{width:t,height:e}=P(this._containerElement);M(this.element,t),L(this.element,e),this.contentItems.length>0&&(M(this.contentItems[0].element,t),L(this.contentItems[0].element,e))}deepGetAllContentItems(t,e){for(let i=0;ithis.onDragStart(t,e))),this._dragListener.on("dragStop",(()=>this.onDragStop()))}onDragStart(t,e){var i;const o="component";let s;if("function"==typeof this._componentTypeOrFtn){const t=this._componentTypeOrFtn();s=pt.isDragSourceComponentItemConfig(t)?{type:o,componentState:t.state,componentType:t.type,title:null!==(i=t.title)&&void 0!==i?i:this._title}:t}else s={type:o,componentState:this._componentState,componentType:this._componentTypeOrFtn,title:this._title,id:this._id};const r=G.resolve(s,!1),a=new at(this._layoutManager,r,this._dummyGroundContentItem);if(this._dummyGroundContentItem.contentItems.push(a),null===this._dragListener)throw new n("DSODSD66746");{const i=new dt(t,e,this._dragListener,this._layoutManager,a,this._dummyGroundContentItem),o=this._layoutManager.transitionIndicator;if(null===o)throw new n("DSODST66746");o.transitionElements(this._element,i.element)}}onDragStop(){this.createDragListener()}removeDragListener(){null!==this._dragListener&&(this._dragListener.destroy(),this._dragListener=null)}}!function(t){t.isDragSourceComponentItemConfig=function(t){return!("componentType"in t)}}(pt||(pt={}));class gt{constructor(){this._element=document.createElement("div"),this._element.classList.add("lm_dropTargetIndicator");const t=document.createElement("div");t.classList.add("lm_inner"),this._element.appendChild(t),document.body.appendChild(this._element)}destroy(){this._element.remove()}highlightArea(t,e){this._element.style.left=E(t.x1+e),this._element.style.top=E(t.y1+e),this._element.style.width=E(t.x2-t.x1-e),this._element.style.height=E(t.y2-t.y1-e),this._element.style.display="block"}hide(){T(this._element,!1)}}class _t{constructor(){this._element=document.createElement("div"),this._element.classList.add("lm_transition_indicator"),document.body.appendChild(this._element),this._toElement=null,this._fromDimensions=null,this._totalAnimationDuration=200,this._animationStartTime=null}destroy(){this._element.remove()}transitionElements(t,e){}nextAnimationFrame(){}measure(t){const e=t.getBoundingClientRect();return{left:e.left,top:e.top,width:t.offsetWidth,height:t.offsetHeight}}}class ft extends K{constructor(t){super(),this._layoutManager=t,this._childEventListener=t=>this.onEventFromChild(t),globalThis.addEventListener(ft.ChildEventName,this._childEventListener,{passive:!0})}emit(t,...e){"userBroadcast"===t?this.emitUserBroadcast(...e):super.emit(t,...e)}emitUserBroadcast(...t){this.handleUserBroadcastEvent("userBroadcast",t)}destroy(){globalThis.removeEventListener(ft.ChildEventName,this._childEventListener)}handleUserBroadcastEvent(t,e){this._layoutManager.isSubWindow?this.propagateToParent(t,e):this.propagateToThisAndSubtree(t,e)}onEventFromChild(t){const e=t.detail;this.handleUserBroadcastEvent(e.eventName,e.args)}propagateToParent(t,e){const i={bubbles:!0,cancelable:!0,detail:{layoutManager:this._layoutManager,eventName:t,args:e}},o=new CustomEvent(ft.ChildEventName,i),s=globalThis.opener;if(null===s)throw new n("EHPTP15778");s.dispatchEvent(o)}propagateToThisAndSubtree(t,e){this.emitUnknown(t,...e);for(let i=0;ithis.handleContainerResize())),this._windowBeforeUnloadListener=()=>this.onBeforeUnload(),this._windowBeforeUnloadListening=!1,this._maximisedStackBeforeDestroyedListener=t=>this.cleanupBeforeMaximisedStackDestroyed(t),this.isSubWindow=t.isSubWindow,this._constructorOrSubWindowLayoutConfig=t.constructorOrSubWindowLayoutConfig,S.checkInitialise(),s.checkInitialise(),void 0!==t.containerElement&&(this._containerElement=t.containerElement)}get container(){return this._containerElement}get isInitialised(){return this._isInitialised}get groundItem(){return this._groundItem}get root(){return this._groundItem}get openPopouts(){return this._openPopouts}get dropTargetIndicator(){return this._dropTargetIndicator}get transitionIndicator(){return this._transitionIndicator}get width(){return this._width}get height(){return this._height}get eventHub(){return this._eventHub}get rootItem(){if(void 0===this._groundItem)throw new Error("Cannot access rootItem before init");return 0===this._groundItem.contentItems.length?void 0:this._groundItem.contentItems[0]}get focusedComponentItem(){return this._focusedComponentItem}get tabDropPlaceholder(){return this._tabDropPlaceholder}get maximisedStack(){return this._maximisedStack}get deprecatedConstructor(){return!this.isSubWindow&&void 0!==this._constructorOrSubWindowLayoutConfig}destroy(){if(this._isInitialised){this._windowBeforeUnloadListening&&(globalThis.removeEventListener("beforeunload",this._windowBeforeUnloadListener),this._windowBeforeUnloadListening=!1),!0===this.layoutConfig.settings.closePopoutsOnUnload&&this.closeAllOpenPopouts(),this._resizeObserver.disconnect(),this.checkClearResizeTimeout(),void 0!==this._groundItem&&this._groundItem.destroy(),this._tabDropPlaceholder.remove(),null!==this._dropTargetIndicator&&this._dropTargetIndicator.destroy(),null!==this._transitionIndicator&&this._transitionIndicator.destroy(),this._eventHub.destroy();for(const t of this._dragSources)t.destroy();this._dragSources=[],this._isInitialised=!1}}minifyConfig(t){return I.minifyConfig(t)}unminifyConfig(t){return I.unminifyConfig(t)}init(){let t;if(this.setContainer(),this._dropTargetIndicator=new gt,this._transitionIndicator=new _t,this.updateSizeFromContainer(),this.isSubWindow){if(void 0===this._constructorOrSubWindowLayoutConfig)throw new o("LMIU07155");{const i=this._constructorOrSubWindowLayoutConfig.root;if(void 0===i)throw new e("LMIC07156");if(!F.isComponent(i))throw new e("LMIC07157");t=i;const n=j.resolve(this._constructorOrSubWindowLayoutConfig);this.layoutConfig=Object.assign(Object.assign({},n),{root:void 0})}}else void 0===this._constructorOrSubWindowLayoutConfig?this.layoutConfig=I.createDefault():this.layoutConfig=j.resolve(this._constructorOrSubWindowLayoutConfig);const i=this.layoutConfig;this._groundItem=new ut(this,i.root,this._containerElement),this._groundItem.init(),this.checkLoadedLayoutMaximiseItem(),this._resizeObserver.observe(this._containerElement),this._isInitialised=!0,this.adjustColumnsResponsive(),this.emit("initialised"),void 0!==t&&this.loadComponentAsRoot(t)}loadLayout(t){if(!this.isInitialised)throw new Error("GoldenLayout: Need to call init() if LayoutConfig with defined root passed to constructor");if(void 0===this._groundItem)throw new o("LMLL11119");this.createSubWindows(),this.layoutConfig=j.resolve(t),this._groundItem.loadRoot(this.layoutConfig.root),this.checkLoadedLayoutMaximiseItem(),this.adjustColumnsResponsive()}saveLayout(){if(!1===this._isInitialised)throw new Error("Can't create config, layout not yet initialised");if(void 0===this._groundItem)throw new o("LMTC18244");{const t=this._groundItem.calculateConfigContent();let e;e=1!==t.length?void 0:t[0],this.reconcilePopoutWindows();const i=[];for(let t=0;t=0?s=this._groundItem.contentItems[0]:n=0;break;case m.row:case m.column:n=s.addItem(t,o.index);break;case m.stack:if(F.isComponent(t)){n=s.addItem(t,o.index);break}throw Error(O[6]);case m.component:throw new e("LMAIALC87444602");default:throw new i("LMAIALU98881733",s.type)}if(F.isComponent(t)){const t=s.contentItems[n];rt.isStack(t)&&(s=t,n=0)}return o.parentItem=s,o.index=n,o}}}loadComponentAsRoot(t){if(void 0===this._groundItem)throw new Error("Cannot add item before init");this._groundItem.loadComponentAsRoot(t)}updateSize(t,e){this.setSize(t,e)}setSize(t,e){if(this._width=t,this._height=e,!0===this._isInitialised){if(void 0===this._groundItem)throw new o("LMUS18881");if(this._groundItem.setSize(this._width,this._height),this._maximisedStack){const{width:t,height:e}=P(this._containerElement);M(this._maximisedStack.element,t),L(this._maximisedStack.element,e),this._maximisedStack.updateSize(!1)}this.adjustColumnsResponsive()}}beginSizeInvalidation(){this._sizeInvalidationBeginCount++}endSizeInvalidation(){0==--this._sizeInvalidationBeginCount&&this.updateSizeFromContainer()}updateSizeFromContainer(){const{width:t,height:e}=P(this._containerElement);this.setSize(t,e)}updateRootSize(t=!1){if(void 0===this._groundItem)throw new o("LMURS28881");this._groundItem.updateSize(t)}createAndInitContentItem(t,e){const i=this.createContentItem(t,e);return i.init(),i}createContentItem(t,e){if("string"!=typeof t.type)throw new U("Missing parameter 'type'",JSON.stringify(t));return!g.isComponentItem(t)||e instanceof ht||!e||!0===this.isSubWindow&&e instanceof ut||(t={type:m.stack,content:[t],size:t.size,sizeUnit:t.sizeUnit,minSize:t.minSize,minSizeUnit:t.minSizeUnit,id:t.id,maximised:t.maximised,isClosable:t.isClosable,activeItemIndex:0,header:void 0}),this.createContentItemFromConfig(t,e)}findFirstComponentItemById(t){if(void 0===this._groundItem)throw new o("LMFFCIBI82446");return this.findFirstContentItemTypeByIdRecursive(m.component,t,this._groundItem)}createPopout(t,e,i,n){return t instanceof rt?this.createPopoutFromContentItem(t,e,i,n):this.createPopoutFromItemConfig(t,e,i,n)}createPopoutFromContentItem(t,e,i,o){let s=t.parent,r=t;for(;null!==s&&1===s.contentItems.length&&!s.isGround;)r=s,s=s.parent;if(null===s)throw new n("LMCPFCI00834");{if(void 0===o&&(o=s.contentItems.indexOf(r)),null!==i&&s.addPopInParentId(i),void 0===e){const i=globalThis.screenX||globalThis.screenLeft,n=globalThis.screenY||globalThis.screenTop,o=t.element.offsetLeft,s=t.element.offsetTop,{width:r,height:a}=P(t.element);e={left:i+o,top:n+s,width:r,height:a}}const n=t.toConfig();if(t.remove(),y.isRootItemConfig(n))return this.createPopoutFromItemConfig(n,e,i,o);throw new Error(`${O[0]}`)}}beginVirtualSizedContainerAdding(){0==++this._virtualSizedContainerAddingBeginCount&&(this._virtualSizedContainers.length=0)}addVirtualSizedContainer(t){this._virtualSizedContainers.push(t)}endVirtualSizedContainerAdding(){if(0==--this._virtualSizedContainerAddingBeginCount){const t=this._virtualSizedContainers.length;if(t>0){this.fireBeforeVirtualRectingEvent(t);for(let e=0;ethis.emit("windowOpened",a))),a.on("closed",(()=>this.reconcilePopoutWindows())),this._openPopouts.push(a),this.layoutConfig.settings.closePopoutsOnUnload&&!this._windowBeforeUnloadListening&&(globalThis.addEventListener("beforeunload",this._windowBeforeUnloadListener,{passive:!0}),this._windowBeforeUnloadListening=!0),a}closeAllOpenPopouts(){for(let t=0;tglobalThis.close()),1)}getArea(t,e){let i=null,n=1/0;for(let o=0;o=s.x1&&t=s.y1&&es.surface&&(n=s.surface,i=s)}return i}calculateItemAreas(){const t=this.getAllContentItems(),e=this._groundItem;if(void 0===e)throw new o("LMCIAR44365");if(1!==t.length){e.contentItems[0].isStack?this._itemAreas=[]:this._itemAreas=e.createSideAreas();for(let e=0;e0){let i=t[0];if(rt.isComponentItem(i)){const t=i.parent;if(null===t)throw new n("LMXLLMI69999");i=t}if(!rt.isStack(i))throw new e("LMCLLMI19993");i.maximise()}}}processMaximiseStack(t){if(this._maximisedStack=t,t.on("beforeItemDestroyed",this._maximisedStackBeforeDestroyedListener),t.element.classList.add("lm_maximised"),t.element.insertAdjacentElement("afterend",this._maximisePlaceholder),void 0===this._groundItem)throw new o("LMMXI19993");{this._groundItem.element.prepend(t.element);const{width:e,height:i}=P(this._containerElement);M(t.element,e),L(t.element,i),t.updateSize(!0),t.focusActiveContentItem(),this._maximisedStack.emit("maximised"),this.emit("stateChanged")}}processMinimiseMaximisedStack(){if(void 0===this._maximisedStack)throw new e("LMMMS74422");{const t=this._maximisedStack;if(null===t.parent)throw new n("LMMI13668");t.element.classList.remove("lm_maximised"),this._maximisePlaceholder.insertAdjacentElement("afterend",t.element),this._maximisePlaceholder.remove(),this.updateRootSize(!0),this._maximisedStack=void 0,t.off("beforeItemDestroyed",this._maximisedStackBeforeDestroyedListener),t.emit("minimised"),this.emit("stateChanged")}}reconcilePopoutWindows(){const t=[];for(let e=0;e{this._resizeTimeoutId=void 0,this.beginSizeInvalidation(),this.endSizeInvalidation()}),this.resizeDebounceInterval))}checkClearResizeTimeout(){void 0!==this._resizeTimeoutId&&(clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=void 0)}setContainer(){var t;const e=document.body,i=null!==(t=this._containerElement)&&void 0!==t?t:e;if(i===e){this.resizeWithContainerAutomatically=!0;const t=document.documentElement;t.style.height="100%",t.style.margin="0",t.style.padding="0",t.style.overflow="clip",e.style.height="100%",e.style.margin="0",e.style.padding="0",e.style.overflow="clip"}this._containerElement=i}onBeforeUnload(){this.destroy()}adjustColumnsResponsive(){if(void 0===this._groundItem)throw new o("LMACR20883");if(this._firstLoad=!1,this.useResponsiveLayout()&&!this._updatingColumnsResponsive&&this._groundItem.contentItems.length>0&&this._groundItem.contentItems[0].isRow){if(void 0===this._groundItem||null===this._width)throw new o("LMACR77412");{const t=this._groundItem.contentItems[0].contentItems.length;if(t<=1)return;{const i=this.layoutConfig.dimensions.defaultMinItemWidth;if(t*i<=this._width)return;{this._updatingColumnsResponsive=!0;const n=t-Math.max(Math.floor(this._width/i),1),o=this._groundItem.contentItems[0],s=this.getAllStacks();if(0===s.length)throw new e("LMACRS77413");{const t=s[0];for(let e=0;en?void 0:{parentItem:t,index:o}}}case 1:if(void 0===this._focusedComponentItem)return;{const t=this._focusedComponentItem.parentItem;return this.tryCreateLocationFromParentItem(t,e)}case 2:{const t=this.findFirstContentItemType(m.stack);return void 0===t?void 0:this.tryCreateLocationFromParentItem(t,e)}case 3:{let t=this.findFirstContentItemType(m.row);return void 0!==t?this.tryCreateLocationFromParentItem(t,e):(t=this.findFirstContentItemType(m.column),void 0!==t?this.tryCreateLocationFromParentItem(t,e):void 0)}case 4:{const t=this.findFirstContentItemType(m.row);return void 0===t?void 0:this.tryCreateLocationFromParentItem(t,e)}case 5:{const t=this.findFirstContentItemType(m.column);return void 0===t?void 0:this.tryCreateLocationFromParentItem(t,e)}case 6:if(void 0===this._groundItem)throw new o("LMFLRIF18244");return void 0!==this.rootItem?void 0:void 0===e||0===e?{parentItem:this._groundItem,index:0}:void 0;case 7:if(void 0===this._groundItem)throw new o("LMFLF18244");{const t=this._groundItem.contentItems;if(0===t.length)return void 0===e||0===e?{parentItem:this._groundItem,index:0}:void 0;{const i=t[0];return this.tryCreateLocationFromParentItem(i,e)}}}}tryCreateLocationFromParentItem(t,e){const i=t.contentItems.length;return void 0===e?{parentItem:t,index:i}:e<0||e>i?void 0:{parentItem:t,index:e}}}!function(t){t.createMaximisePlaceElement=function(t){const e=t.createElement("div");return e.classList.add("lm_maximise_place"),e},t.createTabDropPlaceholderElement=function(t){const e=t.createElement("div");return e.classList.add("lm_drop_tab_placeholder"),e},t.defaultLocationSelectors=[{typeId:1,index:void 0},{typeId:2,index:void 0},{typeId:3,index:void 0},{typeId:7,index:void 0}],t.afterFocusedItemIfPossibleLocationSelectors=[{typeId:0,index:1},{typeId:2,index:void 0},{typeId:3,index:void 0},{typeId:7,index:void 0}]}(vt||(vt={}));class Ct extends vt{constructor(t,e,i,n){if(super(Ct.createLayoutManagerConstructorParameters(t,e)),this._bindComponentEventHanlderPassedInConstructor=!1,this._creationTimeoutPassed=!1,void 0!==e&&"function"==typeof e&&(this.bindComponentEvent=e,this._bindComponentEventHanlderPassedInConstructor=!0,void 0!==i&&(this.unbindComponentEvent=i)),!this._bindComponentEventHanlderPassedInConstructor&&this.isSubWindow){if(void 0===this._constructorOrSubWindowLayoutConfig)throw new o("VLC98823");{const t=j.resolve(this._constructorOrSubWindowLayoutConfig);this.layoutConfig=Object.assign(Object.assign({},t),{root:void 0})}}!0!==n&&(this.deprecatedConstructor||this.init())}destroy(){this.bindComponentEvent=void 0,this.unbindComponentEvent=void 0,super.destroy()}init(){if(this._bindComponentEventHanlderPassedInConstructor||"loading"!==document.readyState&&null!==document.body){if(!this._bindComponentEventHanlderPassedInConstructor&&!0===this.isSubWindow&&!this._creationTimeoutPassed)return setTimeout((()=>this.init()),7),void(this._creationTimeoutPassed=!0);!0===this.isSubWindow&&(this._bindComponentEventHanlderPassedInConstructor||this.clearHtmlAndAdjustStylesForSubWindow(),window.__glInstance=this),super.init()}else document.addEventListener("DOMContentLoaded",(()=>this.init()),{passive:!0})}clearHtmlAndAdjustStylesForSubWindow(){const t=document.head,e=new Array(4);e[0]=document.querySelectorAll("body link"),e[1]=document.querySelectorAll("body style"),e[2]=document.querySelectorAll("template"),e[3]=document.querySelectorAll(".gl_keep");for(let i=0;ithis.emit("popIn"))),document.body.appendChild(t),!0}}bindComponent(t,e){if(void 0!==this.bindComponentEvent)return this.bindComponentEvent(t,e);if(void 0!==this.getComponentEvent)return{virtual:!1,component:this.getComponentEvent(t,e)};{const t=`${O[2]}: ${JSON.stringify(e)}`;throw new B(t)}}unbindComponent(t,e,i){if(void 0!==this.unbindComponentEvent)this.unbindComponentEvent(t);else if(!e&&void 0!==this.releaseComponentEvent){if(void 0===i)throw new o("VCUCRCU333998");this.releaseComponentEvent(t,i)}}}!function(t){let e=!1;t.createLayoutManagerConstructorParameters=function(t,i){const n=e?null:new URL(document.location.href).searchParams.get("gl-window");e=!0;const o=null!==n;let s,r;if(null!==n){const e=localStorage.getItem(n);if(null===e)throw new Error("Null gl-window Config");localStorage.removeItem(n);const i=JSON.parse(e),o=I.unminifyConfig(i);r=j.fromResolved(o),t instanceof HTMLElement&&(s=t)}else void 0===t?r=void 0:t instanceof HTMLElement?(r=void 0,s=t):r=t,void 0===s&&i instanceof HTMLElement&&(s=i);return{constructorOrSubWindowLayoutConfig:r,isSubWindow:o,containerElement:s}}}(Ct||(Ct={}));var yt=window.innerWidth<=window.innerHeight,wt=new class extends Ct{constructor(t,e,i){super(t,e,i,!0),this._componentTypesMap=new Map,this._registeredComponentMap=new Map,this._virtuableComponentMap=new Map,this._containerVirtualRectingRequiredEventListener=(t,e,i)=>this.handleContainerVirtualRectingRequiredEvent(t,e,i),this._containerVirtualVisibilityChangeRequiredEventListener=(t,e)=>this.handleContainerVirtualVisibilityChangeRequiredEvent(t,e),this._containerVirtualZIndexChangeRequiredEventListener=(t,e,i)=>this.handleContainerVirtualZIndexChangeRequiredEvent(t,e,i),this.deprecatedConstructor||this.init()}registerComponent(t,e,i=!1){if("function"!=typeof e)throw new W("registerComponent() componentConstructorOrFactoryFtn parameter is not a function");if(e.hasOwnProperty("prototype")){const n=e;this.registerComponentConstructor(t,n,i)}else{const n=e;this.registerComponentFactoryFunction(t,n,i)}}registerComponentConstructor(t,e,i=!1){if("function"!=typeof e)throw new Error(O[1]);if(void 0!==this._componentTypesMap.get(t))throw new B(`${O[3]}: ${t}`);this._componentTypesMap.set(t,{constructor:e,factoryFunction:void 0,virtual:i})}registerComponentFactoryFunction(t,e,i=!1){if("function"!=typeof e)throw new B("Please register a constructor function");if(void 0!==this._componentTypesMap.get(t))throw new B(`${O[3]}: ${t}`);this._componentTypesMap.set(t,{constructor:void 0,factoryFunction:e,virtual:i})}registerComponentFunction(t){this.registerGetComponentConstructorCallback(t)}registerGetComponentConstructorCallback(t){if("function"!=typeof t)throw new Error("Please register a callback function");void 0!==this._getComponentConstructorFtn&&console.warn("Multiple component functions are being registered. Only the final registered function will be used."),this._getComponentConstructorFtn=t}getRegisteredComponentTypeNames(){const t=this._componentTypesMap.keys();return Array.from(t)}getComponentInstantiator(t){let e;const i=v.resolveComponentTypeName(t);return void 0!==i&&(e=this._componentTypesMap.get(i)),void 0===e&&void 0!==this._getComponentConstructorFtn&&(e={constructor:this._getComponentConstructorFtn(t),factoryFunction:void 0,virtual:!1}),e}bindComponent(t,i){let n;const s=v.resolveComponentTypeName(i);let r;if(void 0!==s&&(n=this._componentTypesMap.get(s)),void 0===n&&void 0!==this._getComponentConstructorFtn&&(n={constructor:this._getComponentConstructorFtn(i),factoryFunction:void 0,virtual:!1}),void 0!==n){const a=n.virtual;let l,h;l=void 0===i.componentState?void 0:D({},i.componentState);const d=n.constructor;if(void 0!==d)h=new d(t,l,a);else{const i=n.factoryFunction;if(void 0===i)throw new e("LMBCFFU10008");h=i(t,l,a)}if(a){if(void 0===h)throw new o("GLBCVCU988774");{const e=h,i=e.rootHtmlElement;if(void 0===i)throw new B(`${O[5]}: ${s}`);!function(t){const e="absolute";t.style.position!==e&&(t.style.position=e)}(i),this.container.appendChild(i),this._virtuableComponentMap.set(t,e),t.virtualRectingRequiredEvent=this._containerVirtualRectingRequiredEventListener,t.virtualVisibilityChangeRequiredEvent=this._containerVirtualVisibilityChangeRequiredEventListener,t.virtualZIndexChangeRequiredEvent=this._containerVirtualZIndexChangeRequiredEventListener}}this._registeredComponentMap.set(t,h),r={virtual:n.virtual,component:h}}else r=super.bindComponent(t,i);return r}unbindComponent(t,i,n){if(void 0===this._registeredComponentMap.get(t))super.unbindComponent(t,i,n);else{const i=this._virtuableComponentMap.get(t);if(void 0!==i){const n=i.rootHtmlElement;if(void 0===n)throw new e("GLUC77743",t.title);this.container.removeChild(n),this._virtuableComponentMap.delete(t)}}}fireBeforeVirtualRectingEvent(t){this._goldenLayoutBoundingClientRect=this.container.getBoundingClientRect(),super.fireBeforeVirtualRectingEvent(t)}handleContainerVirtualRectingRequiredEvent(t,e,i){const n=this._virtuableComponentMap.get(t);if(void 0===n)throw new o("GLHCSCE55933");{const o=n.rootHtmlElement;if(void 0===o)throw new B(O[4]+" "+t.title);{const n=t.element.getBoundingClientRect(),s=n.left-this._goldenLayoutBoundingClientRect.left;o.style.left=E(s);const r=n.top-this._goldenLayoutBoundingClientRect.top;o.style.top=E(r),M(o,e),L(o,i)}}}handleContainerVirtualVisibilityChangeRequiredEvent(t,e){const i=this._virtuableComponentMap.get(t);if(void 0===i)throw new o("GLHCVVCRE55934");{const n=i.rootHtmlElement;if(void 0===n)throw new B(O[4]+" "+t.title);T(n,e)}}handleContainerVirtualZIndexChangeRequiredEvent(t,e,i){const n=this._virtuableComponentMap.get(t);if(void 0===n)throw new o("GLHCVZICRE55935");{const e=n.rootHtmlElement;if(void 0===e)throw new B(O[4]+" "+t.title);e.style.zIndex=i}}};wt.registerComponentFactoryFunction("template",(function(t,e){var i=document.querySelector("#".concat(e.id));t.element.innerHTML=i.innerHTML})),yt?wt.loadLayout({settings:{showPopoutIcon:!1,showCloseIcon:!1},dimensions:{minItemHeight:40},content:[{type:"row",content:[{type:"column",content:[{type:"component",isClosable:!1,reorderEnabled:!1,componentName:"template",title:"IC",componentState:{id:"client_wrapper"},height:56},{type:"stack",height:44,content:[{type:"component",isClosable:!1,reorderEnabled:!1,title:"IC Options",componentName:"template",componentState:{id:"icoptions"}},{type:"component",isClosable:!1,reorderEnabled:!1,title:"Main",componentName:"template",componentState:{id:"mainmenu"}},{type:"component",isClosable:!1,reorderEnabled:!1,title:"Log",componentName:"template",componentState:{id:"log"}},{type:"component",isClosable:!1,reorderEnabled:!1,title:"Music",componentName:"template",componentState:{id:"music"}},{type:"component",isClosable:!0,title:"Players",componentName:"template",componentState:{id:"players"}},{type:"component",isClosable:!1,reorderEnabled:!1,title:"OOC",componentName:"template",componentState:{id:"ooc"}}]}]}]}]}):wt.loadLayout({settings:{showPopoutIcon:!1,showCloseIcon:!1},dimensions:{minItemHeight:40},content:[{type:"row",content:[{type:"column",width:40,content:[{type:"component",height:67,isClosable:!1,componentName:"template",title:"IC",componentState:{id:"client_wrapper"}},{type:"component",height:33,isClosable:!1,title:"IC Options",componentName:"template",componentState:{id:"icoptions"}}]},{type:"column",content:[{type:"row",height:65,content:[{type:"stack",content:[{type:"component",isClosable:!1,title:"Main",componentName:"template",componentState:{id:"mainmenu"}},{type:"component",isClosable:!1,title:"Log",componentName:"template",componentState:{id:"log"}}]},{type:"stack",width:30,content:[{type:"component",isClosable:!1,title:"Music",componentName:"template",componentState:{id:"music"}},{type:"component",isClosable:!0,title:"Players",componentName:"template",componentState:{id:"players"}}]}]},{type:"row",content:[{type:"component",title:"OOC",componentName:"template",componentState:{id:"ooc"}}]}]}]}]})}(); +//# sourceMappingURL=ui.4113389f7da483319971.bundle.js.map \ No newline at end of file diff --git a/ui.4113389f7da483319971.bundle.js.map b/ui.4113389f7da483319971.bundle.js.map new file mode 100644 index 00000000..09016f13 --- /dev/null +++ b/ui.4113389f7da483319971.bundle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ui.4113389f7da483319971.bundle.js","mappings":"yBACA,MAAeA,UAAsBC,MACjC,WAAAC,CAAYC,EAAcC,EAAcC,GACpCC,MAAM,GAAGH,MAASC,SAAmBG,IAAZF,EAAwB,GAAK,KAAOA,IACjE,EAIG,MAAMG,U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cAAe,WACf3H,eAAgB,CAAE7B,GAAI,UAG1B,CACExH,KAAM,QACN6C,MAAO,GACPsE,QAAS,CAAC,CACRnH,KAAM,YACNyH,YAAY,EACZ2B,MAAO,QACP4H,cAAe,WACf3H,eAAgB,CAAE7B,GAAI,UAExB,CACExH,KAAM,YACNyH,YAAY,EACZ2B,MAAO,UACP4H,cAAe,WACf3H,eAAgB,CAAE7B,GAAI,gBAI5B,CACExH,KAAM,MACNmH,QAAS,CAAC,CACRnH,KAAM,YACNoJ,MAAO,MACP4H,cAAe,WACf3H,eAAgB,CAAE7B,GAAI,gB","sources":["webpack://webao/./node_modules/golden-layout/src/ts/errors/internal-error.ts","webpack://webao/./node_modules/golden-layout/src/ts/utils/config-minifier.ts","webpack://webao/./node_modules/golden-layout/src/ts/utils/style-constants.ts","webpack://webao/./node_modules/golden-layout/src/ts/utils/types.ts","webpack://webao/./node_modules/golden-layout/src/ts/config/resolved-config.ts","webpack://webao/./node_modules/golden-layout/src/ts/utils/i18n-strings.ts","webpack://webao/./node_modules/golden-layout/src/ts/utils/utils.ts","webpack://webao/./node_modules/golden-layout/src/ts/errors/external-error.ts","webpack://webao/./node_modules/golden-layout/src/ts/config/config.ts","webpack://webao/./node_modules/golden-layout/src/ts/utils/event-emitter.ts","webpack://webao/./node_modules/golden-layout/src/ts/controls/browser-popout.ts","webpack://webao/./node_modules/golden-layout/src/ts/controls/header-button.ts","webpack://webao/./node_modules/golden-layout/src/ts/utils/drag-listener.ts","webpack://webao/./node_modules/golden-layout/src/ts/controls/tab.ts","webpack://webao/./node_modules/golden-layout/src/ts/controls/tabs-container.ts","webpack://webao/./node_modules/golden-layout/src/ts/controls/header.ts","webpack://webao/./node_modules/golden-layout/src/ts/container/component-container.ts","webpack://webao/./node_modules/golden-layout/src/ts/items/content-item.ts","webpack://webao/./node_modules/golden-layout/src/ts/items/component-item.ts","webpack://webao/./node_modules/golden-layout/src/ts/items/component-parentable-item.ts","webpack://webao/./node_modules/golden-layout/src/ts/items/stack.ts","webpack://webao/./node_modules/golden-layout/src/ts/controls/drag-proxy.ts","webpack://webao/./node_modules/golden-layout/src/ts/controls/splitter.ts","webpack://webao/./node_modules/golden-layout/src/ts/items/row-or-column.ts","webpack://webao/./node_modules/golden-layout/src/ts/items/ground-item.ts","webpack://webao/./node_modules/golden-layout/src/ts/controls/drag-source.ts","webpack://webao/./node_modules/golden-layout/src/ts/controls/drop-target-indicator.ts","webpack://webao/./node_modules/golden-layout/src/ts/controls/transition-indicator.ts","webpack://webao/./node_modules/golden-layout/src/ts/utils/event-hub.ts","webpack://webao/./node_modules/golden-layout/src/ts/layout-manager.ts","webpack://webao/./node_modules/golden-layout/src/ts/virtual-layout.ts","webpack://webao/./webAO/ui.js","webpack://webao/./node_modules/golden-layout/src/ts/golden-layout.ts"],"sourcesContent":["/** @internal */\nabstract class InternalError extends Error {\n constructor(type: string, code: string, message?: string) {\n super(`${type}: ${code}${message === undefined ? '' : ': ' + message}`)\n }\n}\n\n/** @internal */\nexport class AssertError extends InternalError {\n constructor(code: string, message?: string) {\n super('Assert', code, message)\n }\n}\n\n/** @internal */\nexport class UnreachableCaseError extends InternalError {\n constructor(code: string, variableValue: never, message?: string) {\n super('UnreachableCase', code, `${variableValue}${message === undefined ? '' : ': ' + message}`)\n }\n}\n\n/** @internal */\nexport class UnexpectedNullError extends InternalError {\n constructor(code: string, message?: string) {\n super('UnexpectedNull', code, message)\n }\n}\n\n/** @internal */\nexport class UnexpectedUndefinedError extends InternalError {\n constructor(code: string, message?: string) {\n super('UnexpectedUndefined', code, message)\n }\n}\n","/**\n * Minifies and unminifies configs by replacing frequent keys\n * and values with one letter substitutes. Config options must\n * retain array position/index, add new options at the end.\n * @internal\n*/\n\nexport namespace ConfigMinifier {\n\n export type YY = 'id' | 'title';\n export const enum XX {\n id = 'id'\n }\n const keys: readonly string[] = [\n 'settings',\n 'hasHeaders',\n 'constrainDragToContainer',\n 'selectionEnabled',\n 'dimensions',\n 'borderWidth',\n 'minItemHeight',\n 'minItemWidth',\n 'headerHeight',\n 'dragProxyWidth',\n 'dragProxyHeight',\n 'labels',\n 'close',\n 'maximise',\n 'minimise',\n 'popout',\n 'content',\n 'componentType',\n 'componentState',\n 'id',\n 'width',\n 'type',\n 'height',\n 'isClosable',\n 'title',\n 'popoutWholeStack',\n 'openPopouts',\n 'parentId',\n 'activeItemIndex',\n 'reorderEnabled',\n 'borderGrabWidth',\n\n\n\n\n //Maximum 36 entries, do not cross this line!\n ];\n\n const values: readonly (boolean | string)[] = [\n true,\n false,\n 'row',\n 'column',\n 'stack',\n 'component',\n 'close',\n 'maximise',\n 'minimise',\n 'open in new window'\n ];\n\n export function checkInitialise(): void {\n if (keys.length > 36) {\n throw new Error('Too many keys in config minifier map');\n }\n }\n\n export function translateObject(from: Record, minify: boolean): Record {\n const to: Record = {};\n for (const key in from) {\n if (from.hasOwnProperty(key)) { // In case something has extended Object prototypes\n let translatedKey: string;\n if (minify) {\n translatedKey = minifyKey(key);\n } else {\n translatedKey = unminifyKey(key);\n }\n\n const fromValue = from[key];\n to[translatedKey] = translateValue(fromValue, minify);\n }\n }\n\n return to;\n }\n\n function translateArray(from: unknown[], minify: boolean) {\n const length = from.length;\n const to = new Array(length);\n for (let i = 0; i < length; i++) {\n // In original code, array indices were numbers and not translated\n const fromValue = from[i];\n to[i] = translateValue(fromValue, minify);\n }\n return to;\n }\n\n function translateValue(from: unknown, minify: boolean) {\n if (typeof from === 'object') {\n if (from === null) {\n return null;\n } else {\n if (Array.isArray(from)) {\n return translateArray(from, minify);\n } else {\n return translateObject(from as Record, minify);\n }\n }\n } else {\n if (minify) {\n return minifyValue(from);\n } else {\n return unminifyValue(from);\n }\n }\n }\n\n function minifyKey(value: string) {\n /**\n * If a value actually is a single character, prefix it\n * with ___ to avoid mistaking it for a minification code\n */\n if (typeof value === 'string' && value.length === 1) {\n return '___' + value;\n }\n \n const index = indexOfKey(value);\n \n /**\n * value not found in the dictionary, return it unmodified\n */\n if (index === -1) {\n return value;\n \n /**\n * value found in dictionary, return its base36 counterpart\n */\n } else {\n return index.toString(36);\n }\n }\n\n function unminifyKey(key: string) {\n /**\n * value is a single character. Assume that it's a translation\n * and return the original value from the dictionary\n */\n if (key.length === 1) {\n return keys[parseInt(key, 36)];\n }\n \n /**\n * value originally was a single character and was prefixed with ___\n * to avoid mistaking it for a translation. Remove the prefix\n * and return the original character\n */\n if (key.substr(0, 3) === '___') {\n return key[3];\n }\n /**\n * value was not minified\n */\n return key;\n }\n\n function minifyValue(value: unknown) {\n /**\n * If a value actually is a single character, prefix it\n * with ___ to avoid mistaking it for a minification code\n */\n if (typeof value === 'string' && value.length === 1) {\n return '___' + value;\n }\n \n const index = indexOfValue(value);\n \n /**\n * value not found in the dictionary, return it unmodified\n */\n if (index === -1) {\n return value;\n \n /**\n * value found in dictionary, return its base36 counterpart\n */\n } else {\n return index.toString(36);\n }\n }\n\n function unminifyValue(value: unknown) {\n /**\n * value is a single character. Assume that it's a translation\n * and return the original value from the dictionary\n */\n if (typeof value === 'string' && value.length === 1) {\n return values[parseInt(value, 36)];\n }\n\n /**\n * value originally was a single character and was prefixed with ___\n * to avoid mistaking it for a translation. Remove the prefix\n * and return the original character\n */\n if (typeof value === 'string' && value.substr(0, 3) === '___') {\n return value[3];\n }\n /**\n * value was not minified\n */\n return value;\n }\n\n function indexOfKey(key: string) {\n for (let i = 0; i < keys.length; i++) {\n if (keys[i] === key) {\n return i;\n }\n }\n return -1;\n }\n\n function indexOfValue(value: unknown) {\n for (let i = 0; i < values.length; i++) {\n if (values[i] === value) {\n return i;\n }\n }\n return -1;\n }\n}\n","/** @public */\nexport namespace StyleConstants {\n export const defaultComponentBaseZIndex = 'auto';\n export const defaultComponentDragZIndex = '32';\n export const defaultComponentStackMaximisedZIndex = '41';\n}\n","import { UnreachableCaseError } from '../errors/internal-error';\nimport { StyleConstants } from './style-constants';\n\n/** @internal */\nexport type WidthOrHeightPropertyName = 'width' | 'height';\n\n/** @internal */\nexport namespace WidthOrHeightPropertyName {\n export const width = 'width';\n export const height = 'height';\n}\n\n/** @internal */\nexport interface WidthAndHeight {\n width: number;\n height: number;\n}\n\n/** @internal */\nexport interface LeftAndTop {\n left: number;\n top: number;\n}\n\n/** @public */\nexport type Side = 'top' | 'left' | 'right' | 'bottom';\n/** @public */\nexport namespace Side {\n export const top = 'top';\n export const left = 'left';\n export const right = 'right';\n export const bottom = 'bottom';\n}\n\n/** @public */\nexport type LogicalZIndex = 'base' | 'drag' | 'stackMaximised';\n/** @public */\nexport namespace LogicalZIndex {\n export const base = 'base';\n export const drag = 'drag';\n export const stackMaximised = 'stackMaximised';\n}\n\n/** @public */\nexport const LogicalZIndexToDefaultMap = {\n base: StyleConstants.defaultComponentBaseZIndex,\n drag: StyleConstants.defaultComponentDragZIndex,\n stackMaximised: StyleConstants.defaultComponentStackMaximisedZIndex,\n}\n\n/** @internal */\nexport interface Rect {\n left: number,\n top: number,\n width: number,\n height: number,\n}\n\n/** @internal */\nexport interface AreaLinkedRect {\n x1: number, // left\n x2: number, // nextLeft\n y1: number, // top\n y2: number, // nextTop\n}\n\n/** @public */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type JsonValue = string | number | boolean | null | Json | object | JsonValueArray;\n/** @public */\nexport interface Json {\n [name: string]: JsonValue;\n}\n/** @public */\nexport type JsonValueArray = Array\n/** @public */\nexport namespace JsonValue {\n export function isJson(value: JsonValue): value is Json {\n return isJsonObject(value);\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-types\n export function isJsonObject(value: JsonValue): value is Json | object {\n return !Array.isArray(value) && value !== null && typeof value === 'object';\n }\n}\n\n/** @public */\nexport type ItemType = 'ground' | 'row' | 'column' | 'stack' | 'component';\n\n/** @public */\nexport namespace ItemType {\n export const ground = 'ground';\n export const row = 'row';\n export const column = 'column';\n export const stack = 'stack';\n export const component = 'component';\n}\n\n/** @public */\nexport type ResponsiveMode = 'none' | 'always' | 'onload';\n/** @public */\nexport namespace ResponsiveMode {\n export const none = 'none';\n export const always = 'always';\n export const onload = 'onload';\n}\n\n/**\n * Length units which can specify the size of a Component Item\n * @public\n */\nexport type SizeUnit = 'px' | '%' | 'fr' | 'em';\n\n/** @public */\nexport enum SizeUnitEnum {\n Pixel = 'px',\n Percent = '%',\n Fractional = 'fr',\n Em = 'em',\n}\n\n/** @public */\nexport namespace SizeUnitEnum {\n export function tryParse(value: string) {\n switch (value) {\n case SizeUnitEnum.Pixel: return SizeUnitEnum.Pixel;\n case SizeUnitEnum.Percent: return SizeUnitEnum.Percent;\n case SizeUnitEnum.Fractional: return SizeUnitEnum.Fractional;\n case SizeUnitEnum.Em: return SizeUnitEnum.Em;\n default: return undefined;\n }\n }\n\n export function format(value: SizeUnitEnum) {\n switch (value) {\n case SizeUnitEnum.Pixel: return SizeUnitEnum.Pixel;\n case SizeUnitEnum.Percent: return SizeUnitEnum.Percent;\n case SizeUnitEnum.Fractional: return SizeUnitEnum.Fractional;\n case SizeUnitEnum.Em: return SizeUnitEnum.Em;\n default:\n throw new UnreachableCaseError('SUEF44998', value);\n }\n }\n}\n","import { AssertError, UnreachableCaseError } from '../errors/internal-error';\nimport { ConfigMinifier } from '../utils/config-minifier';\nimport { ItemType, JsonValue, ResponsiveMode, Side, SizeUnitEnum } from '../utils/types';\nimport { deepExtendValue } from '../utils/utils';\n\n/** @public */\nexport interface ResolvedItemConfig {\n // see ItemConfig for comments\n readonly type: ItemType;\n readonly content: readonly ResolvedItemConfig[];\n readonly size: number;\n readonly sizeUnit: SizeUnitEnum;\n readonly minSize: number | undefined;\n readonly minSizeUnit: SizeUnitEnum;\n // id no longer specifies whether an Item is maximised. This is now done by HeaderItemConfig.maximised\n readonly id: string;\n readonly isClosable: boolean;\n}\n\n/** @public */\nexport namespace ResolvedItemConfig {\n export const defaults: ResolvedItemConfig = {\n type: ItemType.ground, // not really default but need something\n content: [],\n size: 1,\n sizeUnit: SizeUnitEnum.Fractional,\n minSize: undefined,\n minSizeUnit: SizeUnitEnum.Pixel,\n id: '',\n isClosable: true,\n } as const;\n\n /** Creates a copy of the original ResolvedItemConfig using an alternative content if specified */\n export function createCopy(original: ResolvedItemConfig, content?: ResolvedItemConfig[]): ResolvedItemConfig {\n switch (original.type) {\n case ItemType.ground:\n case ItemType.row:\n case ItemType.column:\n return ResolvedRowOrColumnItemConfig.createCopy(original as ResolvedRowOrColumnItemConfig,\n content as ResolvedRowOrColumnItemConfig.ChildItemConfig[]);\n\n case ItemType.stack:\n return ResolvedStackItemConfig.createCopy(original as ResolvedStackItemConfig, content as ResolvedComponentItemConfig[]);\n\n case ItemType.component:\n return ResolvedComponentItemConfig.createCopy(original as ResolvedComponentItemConfig);\n\n default:\n throw new UnreachableCaseError('CICC91354', original.type, 'Invalid Config Item type specified');\n }\n }\n\n export function createDefault(type: ItemType): ResolvedItemConfig {\n switch (type) {\n case ItemType.ground:\n throw new AssertError('CICCDR91562'); // Get default root from LayoutConfig\n case ItemType.row:\n case ItemType.column:\n return ResolvedRowOrColumnItemConfig.createDefault(type);\n\n case ItemType.stack:\n return ResolvedStackItemConfig.createDefault();\n\n case ItemType.component:\n return ResolvedComponentItemConfig.createDefault();\n\n default:\n throw new UnreachableCaseError('CICCDD91563', type, 'Invalid Config Item type specified');\n }\n }\n\n export function isComponentItem(itemConfig: ResolvedItemConfig): itemConfig is ResolvedComponentItemConfig {\n return itemConfig.type === ItemType.component;\n }\n\n export function isStackItem(itemConfig: ResolvedItemConfig): itemConfig is ResolvedStackItemConfig {\n return itemConfig.type === ItemType.stack;\n }\n\n /** @internal */\n export function isGroundItem(itemConfig: ResolvedItemConfig): itemConfig is ResolvedGroundItemConfig {\n return itemConfig.type === ItemType.ground;\n }\n}\n\n// Stack or Component\n/** @public */\nexport interface ResolvedHeaderedItemConfig extends ResolvedItemConfig {\n header: ResolvedHeaderedItemConfig.Header | undefined; // undefined means get header settings from LayoutConfig\n readonly maximised: boolean;\n}\n\n/** @public */\nexport namespace ResolvedHeaderedItemConfig {\n export const defaultMaximised = false;\n\n export interface Header {\n // undefined means get property value from LayoutConfig\n readonly show: false | Side | undefined;\n readonly popout: false | string | undefined;\n readonly maximise: false | string | undefined;\n readonly close: string | undefined;\n readonly minimise: string | undefined;\n readonly tabDropdown: false | string | undefined;\n }\n\n export namespace Header {\n export function createCopy(original: Header | undefined, show?: false | Side): Header | undefined {\n if (original === undefined) {\n return undefined;\n } else {\n return {\n show: show ?? original.show,\n popout: original.popout,\n close: original.close,\n maximise: original.maximise,\n minimise: original.minimise,\n tabDropdown: original.tabDropdown,\n }\n }\n }\n }\n}\n\n/** @public */\nexport interface ResolvedStackItemConfig extends ResolvedHeaderedItemConfig {\n readonly type: 'stack';\n readonly content: ResolvedComponentItemConfig[];\n /** The index of the active item in the Stack. Only undefined if the Stack is empty. */\n readonly activeItemIndex: number | undefined;\n}\n\n/** @public */\nexport namespace ResolvedStackItemConfig {\n export const defaultActiveItemIndex = 0;\n\n export function createCopy(original: ResolvedStackItemConfig, content?: ResolvedComponentItemConfig[]): ResolvedStackItemConfig {\n const result: ResolvedStackItemConfig = {\n type: original.type,\n content: content !== undefined ? copyContent(content) : copyContent(original.content),\n size: original.size,\n sizeUnit: original.sizeUnit,\n minSize: original.minSize,\n minSizeUnit: original.minSizeUnit,\n id: original.id,\n maximised: original.maximised,\n isClosable: original.isClosable,\n activeItemIndex: original.activeItemIndex,\n header: ResolvedHeaderedItemConfig.Header.createCopy(original.header),\n }\n return result;\n }\n\n export function copyContent(original: ResolvedComponentItemConfig[]): ResolvedComponentItemConfig[] {\n const count = original.length;\n const result = new Array(count);\n for (let i = 0; i < count; i++) {\n result[i] = ResolvedItemConfig.createCopy(original[i]) as ResolvedComponentItemConfig;\n }\n return result;\n }\n\n export function createDefault(): ResolvedStackItemConfig {\n const result: ResolvedStackItemConfig = {\n type: ItemType.stack,\n content: [],\n size: ResolvedItemConfig.defaults.size,\n sizeUnit: ResolvedItemConfig.defaults.sizeUnit,\n minSize: ResolvedItemConfig.defaults.minSize,\n minSizeUnit: ResolvedItemConfig.defaults.minSizeUnit,\n id: ResolvedItemConfig.defaults.id,\n maximised: ResolvedHeaderedItemConfig.defaultMaximised,\n isClosable: ResolvedItemConfig.defaults.isClosable,\n activeItemIndex: defaultActiveItemIndex,\n header: undefined,\n }\n return result;\n }\n}\n\n/** @public */\nexport interface ResolvedComponentItemConfig extends ResolvedHeaderedItemConfig {\n // see ComponentItemConfig for comments\n readonly type: 'component';\n readonly content: [];\n readonly title: string;\n readonly reorderEnabled: boolean; // Takes precedence over LayoutConfig.reorderEnabled.\n /**\n * The name of the component as specified in layout.registerComponent. Mandatory if type is 'component'.\n */\n readonly componentType: JsonValue;\n readonly componentState?: JsonValue;\n}\n\n/** @public */\nexport namespace ResolvedComponentItemConfig {\n export const defaultReorderEnabled = true;\n\n export function resolveComponentTypeName(itemConfig: ResolvedComponentItemConfig): string | undefined {\n const componentType = itemConfig.componentType;\n if (typeof componentType === 'string') {\n return componentType;\n } else {\n return undefined;\n }\n }\n\n export function createCopy(original: ResolvedComponentItemConfig): ResolvedComponentItemConfig {\n const result: ResolvedComponentItemConfig = {\n type: original.type,\n content: [],\n size: original.size,\n sizeUnit: original.sizeUnit,\n minSize: original.minSize,\n minSizeUnit: original.minSizeUnit,\n id: original.id,\n maximised: original.maximised,\n isClosable: original.isClosable,\n reorderEnabled: original.reorderEnabled,\n title: original.title,\n header: ResolvedHeaderedItemConfig.Header.createCopy(original.header),\n componentType: original.componentType,\n componentState: deepExtendValue(undefined, original.componentState) as JsonValue,\n }\n return result;\n }\n\n export function createDefault(componentType: JsonValue = '', componentState?: JsonValue, title = ''): ResolvedComponentItemConfig {\n const result: ResolvedComponentItemConfig = {\n type: ItemType.component,\n content: [],\n size: ResolvedItemConfig.defaults.size,\n sizeUnit: ResolvedItemConfig.defaults.sizeUnit,\n minSize: ResolvedItemConfig.defaults.minSize,\n minSizeUnit: ResolvedItemConfig.defaults.minSizeUnit,\n id: ResolvedItemConfig.defaults.id,\n maximised: ResolvedHeaderedItemConfig.defaultMaximised,\n isClosable: ResolvedItemConfig.defaults.isClosable,\n reorderEnabled: ResolvedComponentItemConfig.defaultReorderEnabled,\n title,\n header: undefined,\n componentType,\n componentState,\n }\n return result;\n }\n\n export function copyComponentType(componentType: JsonValue): JsonValue {\n return deepExtendValue({}, componentType) as JsonValue\n }\n}\n\n/** Base for Root or RowOrColumn ItemConfigs\n * @public\n */\nexport interface ResolvedRowOrColumnItemConfig extends ResolvedItemConfig {\n readonly type: 'row' | 'column';\n /** Note that RowOrColumn ResolvedItemConfig contents, can contain ComponentItem itemConfigs. However\n * when ContentItems are created, these ComponentItem itemConfigs will create a Stack with a child ComponentItem.\n */\n readonly content: readonly (ResolvedRowOrColumnItemConfig | ResolvedStackItemConfig | ResolvedComponentItemConfig)[];\n}\n\n/** @public */\nexport namespace ResolvedRowOrColumnItemConfig {\n export type ChildItemConfig = ResolvedRowOrColumnItemConfig | ResolvedStackItemConfig | ResolvedComponentItemConfig;\n\n export function isChildItemConfig(itemConfig: ResolvedItemConfig): itemConfig is ChildItemConfig {\n switch (itemConfig.type) {\n case ItemType.row:\n case ItemType.column:\n case ItemType.stack:\n case ItemType.component:\n return true;\n case ItemType.ground:\n return false;\n default:\n throw new UnreachableCaseError('CROCOSPCICIC13687', itemConfig.type);\n }\n }\n\n export function createCopy(original: ResolvedRowOrColumnItemConfig, content?: ChildItemConfig[]): ResolvedRowOrColumnItemConfig {\n const result: ResolvedRowOrColumnItemConfig = {\n type: original.type,\n content: content !== undefined ? copyContent(content) : copyContent(original.content),\n size: original.size,\n sizeUnit: original.sizeUnit,\n minSize: original.minSize,\n minSizeUnit: original.minSizeUnit,\n id: original.id,\n isClosable: original.isClosable,\n }\n return result;\n }\n\n export function copyContent(original: readonly ChildItemConfig[]): ChildItemConfig[] {\n const count = original.length;\n const result = new Array(count);\n for (let i = 0; i < count; i++) {\n result[i] = ResolvedItemConfig.createCopy(original[i]) as ChildItemConfig;\n }\n return result;\n }\n\n export function createDefault(type: 'row' | 'column'): ResolvedRowOrColumnItemConfig {\n const result: ResolvedRowOrColumnItemConfig = {\n type,\n content: [],\n size: ResolvedItemConfig.defaults.size,\n sizeUnit: ResolvedItemConfig.defaults.sizeUnit,\n minSize: ResolvedItemConfig.defaults.minSize,\n minSizeUnit: ResolvedItemConfig.defaults.minSizeUnit,\n id: ResolvedItemConfig.defaults.id,\n isClosable: ResolvedItemConfig.defaults.isClosable,\n }\n return result;\n }\n}\n\n/**\n * RootItemConfig is the topmost ResolvedItemConfig specified by the user.\n * Note that it does not have a corresponding contentItem. It specifies the one and only child of the Ground ContentItem\n * Note that RootItemConfig can be an ComponentItem itemConfig. However when the Ground ContentItem's child is created\n * a ComponentItem itemConfig will create a Stack with a child ComponentItem.\n * @public\n*/\nexport type ResolvedRootItemConfig = ResolvedRowOrColumnItemConfig | ResolvedStackItemConfig | ResolvedComponentItemConfig;\n\n/** @public */\nexport namespace ResolvedRootItemConfig {\n export function createCopy(config: ResolvedRootItemConfig): ResolvedRootItemConfig {\n return ResolvedItemConfig.createCopy(config) as ResolvedRootItemConfig;\n }\n\n export function isRootItemConfig(itemConfig: ResolvedItemConfig): itemConfig is ResolvedRootItemConfig {\n switch (itemConfig.type) {\n case ItemType.row:\n case ItemType.column:\n case ItemType.stack:\n case ItemType.component:\n return true;\n case ItemType.ground:\n return false;\n default:\n throw new UnreachableCaseError('CROCOSPCICIC13687', itemConfig.type);\n }\n }\n}\n\n/** @internal */\nexport interface ResolvedGroundItemConfig extends ResolvedItemConfig {\n readonly type: 'ground';\n readonly size: 100,\n readonly sizeUnit: SizeUnitEnum.Percent,\n readonly minSize: 0,\n readonly minSizeUnit: SizeUnitEnum.Pixel,\n readonly id: '',\n readonly isClosable: false,\n readonly title: '',\n readonly reorderEnabled: false,\n}\n\n/** @internal */\nexport namespace ResolvedGroundItemConfig {\n export function create(rootItemConfig: ResolvedRootItemConfig | undefined):ResolvedGroundItemConfig {\n const content = rootItemConfig === undefined ? [] : [rootItemConfig];\n return {\n type: ItemType.ground,\n content,\n size: 100,\n sizeUnit: SizeUnitEnum.Percent,\n minSize: 0,\n minSizeUnit: SizeUnitEnum.Pixel,\n id: '',\n isClosable: false,\n title: '',\n reorderEnabled: false,\n }\n }\n}\n\n/** @public */\nexport interface ResolvedLayoutConfig {\n readonly root: ResolvedRootItemConfig | undefined;\n readonly openPopouts: ResolvedPopoutLayoutConfig[];\n readonly dimensions: ResolvedLayoutConfig.Dimensions;\n readonly settings: ResolvedLayoutConfig.Settings;\n readonly header: ResolvedLayoutConfig.Header;\n readonly resolved: true,\n}\n\n/** @public */\nexport namespace ResolvedLayoutConfig {\n export interface Settings {\n // see Config.Settings for comments\n readonly constrainDragToContainer: boolean;\n readonly reorderEnabled: boolean; // also in ResolvedItemConfig which takes precedence\n readonly popoutWholeStack: boolean;\n readonly blockedPopoutsThrowError: boolean;\n /** @deprecated Will be removed in version 3. */\n readonly closePopoutsOnUnload: boolean;\n readonly responsiveMode: ResponsiveMode;\n readonly tabOverlapAllowance: number;\n readonly reorderOnTabMenuClick: boolean;\n readonly tabControlOffset: number;\n readonly popInOnClose: boolean;\n }\n\n export namespace Settings {\n export const defaults: ResolvedLayoutConfig.Settings = {\n constrainDragToContainer: true,\n reorderEnabled: true,\n popoutWholeStack: false,\n blockedPopoutsThrowError: true,\n closePopoutsOnUnload: true,\n responsiveMode: ResponsiveMode.none, // was onload\n tabOverlapAllowance: 0,\n reorderOnTabMenuClick: true,\n tabControlOffset: 10,\n popInOnClose: false,\n } as const;\n\n export function createCopy(original: Settings): Settings {\n return {\n constrainDragToContainer: original.constrainDragToContainer,\n reorderEnabled: original.reorderEnabled,\n popoutWholeStack: original.popoutWholeStack,\n blockedPopoutsThrowError: original.blockedPopoutsThrowError,\n closePopoutsOnUnload: original.closePopoutsOnUnload,\n responsiveMode: original.responsiveMode,\n tabOverlapAllowance: original.tabOverlapAllowance,\n reorderOnTabMenuClick: original.reorderOnTabMenuClick,\n tabControlOffset: original.tabControlOffset,\n popInOnClose: original.popInOnClose,\n }\n }\n }\n\n export interface Dimensions {\n // see LayoutConfig.Dimensions for comments\n readonly borderWidth: number;\n readonly borderGrabWidth: number,\n readonly defaultMinItemHeight: number;\n readonly defaultMinItemHeightUnit: SizeUnitEnum;\n readonly defaultMinItemWidth: number;\n readonly defaultMinItemWidthUnit: SizeUnitEnum;\n readonly headerHeight: number;\n readonly dragProxyWidth: number;\n readonly dragProxyHeight: number;\n }\n\n export namespace Dimensions {\n export function createCopy(original: Dimensions): Dimensions {\n return {\n borderWidth: original.borderWidth,\n borderGrabWidth: original.borderGrabWidth,\n defaultMinItemHeight: original.defaultMinItemHeight,\n defaultMinItemHeightUnit: original.defaultMinItemHeightUnit,\n defaultMinItemWidth: original.defaultMinItemWidth,\n defaultMinItemWidthUnit: original.defaultMinItemWidthUnit,\n headerHeight: original.headerHeight,\n dragProxyWidth: original.dragProxyWidth,\n dragProxyHeight: original.dragProxyHeight,\n }\n }\n\n export const defaults: ResolvedLayoutConfig.Dimensions = {\n borderWidth: 5,\n borderGrabWidth: 5,\n defaultMinItemHeight: 0,\n defaultMinItemHeightUnit: SizeUnitEnum.Pixel,\n defaultMinItemWidth: 10,\n defaultMinItemWidthUnit: SizeUnitEnum.Pixel,\n headerHeight: 20,\n dragProxyWidth: 300,\n dragProxyHeight: 200\n } as const;\n }\n\n export interface Header {\n readonly show: false | Side;\n readonly popout: false | string;\n readonly dock: string;\n readonly maximise: false | string;\n readonly minimise: string;\n readonly close: false | string;\n readonly tabDropdown: false | string;\n }\n\n export namespace Header {\n export function createCopy(original: Header): Header {\n return {\n show: original.show,\n popout: original.popout,\n dock: original.dock,\n close: original.close,\n maximise: original.maximise,\n minimise: original.minimise,\n tabDropdown: original.tabDropdown,\n }\n }\n\n export const defaults: ResolvedLayoutConfig.Header = {\n show: Side.top,\n popout: 'open in new window',\n dock: 'dock',\n maximise: 'maximise',\n minimise: 'minimise',\n close: 'close',\n tabDropdown: 'additional tabs'\n } as const;\n }\n\n export function isPopout(config: ResolvedLayoutConfig): config is ResolvedPopoutLayoutConfig {\n return 'parentId' in config;\n }\n\n export function createDefault(): ResolvedLayoutConfig {\n const result: ResolvedLayoutConfig = {\n root: undefined,\n openPopouts: [],\n dimensions: ResolvedLayoutConfig.Dimensions.defaults,\n settings: ResolvedLayoutConfig.Settings.defaults,\n header: ResolvedLayoutConfig.Header.defaults,\n resolved: true,\n }\n return result;\n }\n\n export function createCopy(config: ResolvedLayoutConfig): ResolvedLayoutConfig {\n if (isPopout(config)) {\n return ResolvedPopoutLayoutConfig.createCopy(config);\n } else {\n const result: ResolvedLayoutConfig = {\n root: config.root === undefined ? undefined : ResolvedRootItemConfig.createCopy(config.root),\n openPopouts: ResolvedLayoutConfig.copyOpenPopouts(config.openPopouts),\n settings: ResolvedLayoutConfig.Settings.createCopy(config.settings),\n dimensions: ResolvedLayoutConfig.Dimensions.createCopy(config.dimensions),\n header: ResolvedLayoutConfig.Header.createCopy(config.header),\n resolved: config.resolved,\n }\n return result;\n }\n }\n\n export function copyOpenPopouts(original: ResolvedPopoutLayoutConfig[]): ResolvedPopoutLayoutConfig[] {\n const count = original.length;\n const result = new Array(count);\n for (let i = 0; i < count; i++) {\n result[i] = ResolvedPopoutLayoutConfig.createCopy(original[i]);\n }\n return result;\n }\n\n /**\n * Takes a GoldenLayout configuration object and\n * replaces its keys and values recursively with\n * one letter counterparts\n */\n export function minifyConfig(layoutConfig: ResolvedLayoutConfig): ResolvedLayoutConfig {\n return ConfigMinifier.translateObject(layoutConfig, true) as ResolvedLayoutConfig;\n }\n\n /**\n * Takes a configuration Object that was previously minified\n * using minifyConfig and returns its original version\n */\n export function unminifyConfig(minifiedConfig: ResolvedLayoutConfig): ResolvedLayoutConfig {\n return ConfigMinifier.translateObject(minifiedConfig, false) as ResolvedLayoutConfig;\n }\n}\n\n/** @public */\nexport interface ResolvedPopoutLayoutConfig extends ResolvedLayoutConfig {\n readonly parentId: string | null;\n readonly indexInParent: number | null;\n readonly window: ResolvedPopoutLayoutConfig.Window;\n}\n\n/** @public */\nexport namespace ResolvedPopoutLayoutConfig {\n export interface Window {\n readonly width: number | null,\n readonly height: number | null,\n readonly left: number | null,\n readonly top: number | null,\n }\n\n export namespace Window {\n export function createCopy(original: Window): Window {\n return {\n width: original.width,\n height: original.height,\n left: original.left,\n top: original.top,\n }\n }\n\n export const defaults: ResolvedPopoutLayoutConfig.Window = {\n width: null,\n height: null,\n left: null,\n top: null,\n } as const;\n }\n\n export function createCopy(original: ResolvedPopoutLayoutConfig): ResolvedPopoutLayoutConfig {\n const result: ResolvedPopoutLayoutConfig = {\n root: original.root === undefined ? undefined : ResolvedRootItemConfig.createCopy(original.root),\n openPopouts: ResolvedLayoutConfig.copyOpenPopouts(original.openPopouts),\n settings: ResolvedLayoutConfig.Settings.createCopy(original.settings),\n dimensions: ResolvedLayoutConfig.Dimensions.createCopy(original.dimensions),\n header: ResolvedLayoutConfig.Header.createCopy(original.header),\n parentId: original.parentId,\n indexInParent: original.indexInParent,\n window: ResolvedPopoutLayoutConfig.Window.createCopy(original.window),\n resolved: original.resolved,\n }\n return result;\n }\n}\n","import { AssertError } from '../errors/internal-error';\n\n/** @public */\nexport const enum I18nStringId {\n PopoutCannotBeCreatedWithGroundItemConfig,\n PleaseRegisterAConstructorFunction,\n ComponentTypeNotRegisteredAndBindComponentEventHandlerNotAssigned,\n ComponentIsAlreadyRegistered,\n ComponentIsNotVirtuable,\n VirtualComponentDoesNotHaveRootHtmlElement,\n ItemConfigIsNotTypeComponent,\n InvalidNumberPartInSizeString,\n UnknownUnitInSizeString,\n UnsupportedUnitInSizeString,\n}\n\n/** @public */\nexport namespace I18nStrings {\n /** @internal */\n let initialised = false;\n\n /** @internal */\n interface Info {\n readonly id: I18nStringId;\n readonly default: string;\n }\n\n /** @internal */\n type InfosObject = { [id in keyof typeof I18nStringId]: Info };\n\n /** @internal */\n const infosObject: InfosObject = {\n PopoutCannotBeCreatedWithGroundItemConfig: {\n id: I18nStringId.PopoutCannotBeCreatedWithGroundItemConfig,\n default: 'Popout cannot be created with ground ItemConfig'\n },\n PleaseRegisterAConstructorFunction: {\n id: I18nStringId.PleaseRegisterAConstructorFunction,\n default: 'Please register a constructor function'\n },\n ComponentTypeNotRegisteredAndBindComponentEventHandlerNotAssigned: {\n id: I18nStringId.ComponentTypeNotRegisteredAndBindComponentEventHandlerNotAssigned,\n default: 'Component type not registered and BindComponentEvent handler not assigned',\n },\n ComponentIsAlreadyRegistered: {\n id: I18nStringId.ComponentIsAlreadyRegistered,\n default: 'Component is already registered',\n },\n ComponentIsNotVirtuable: {\n id: I18nStringId.ComponentIsNotVirtuable,\n default: 'Component is not virtuable. Requires rootHtmlElement field/getter',\n },\n VirtualComponentDoesNotHaveRootHtmlElement: {\n id: I18nStringId.VirtualComponentDoesNotHaveRootHtmlElement,\n default: 'Virtual component does not have getter \"rootHtmlElement\"',\n },\n ItemConfigIsNotTypeComponent: {\n id: I18nStringId.ItemConfigIsNotTypeComponent,\n default: 'ItemConfig is not of type component',\n },\n\n InvalidNumberPartInSizeString: {\n id: I18nStringId.InvalidNumberPartInSizeString,\n default: 'Invalid number part in size string',\n },\n UnknownUnitInSizeString: {\n id: I18nStringId.UnknownUnitInSizeString,\n default: 'Unknown unit in size string',\n },\n UnsupportedUnitInSizeString: {\n id: I18nStringId.UnsupportedUnitInSizeString,\n default: 'Unsupported unit in size string',\n },\n }\n\n export const idCount = Object.keys(infosObject).length;\n /** @internal */\n const infos = Object.values(infosObject);\n\n export function checkInitialise(): void {\n if (!initialised) {\n for (let i = 0; i < idCount; i++) {\n const info = infos[i];\n if (info.id !== i) {\n throw new AssertError('INSI00110', `${i}: ${info.id}`);\n } else {\n i18nStrings[i] = info.default;\n }\n }\n }\n initialised = true;\n }\n}\n\n/** @public */\nexport const i18nStrings = new Array(I18nStrings.idCount);\n","import { WidthAndHeight } from './types';\n\n/** @internal */\nexport function numberToPixels(value: number): string {\n return value.toString(10) + 'px';\n}\n\n/** @internal */\nexport function pixelsToNumber(value: string): number {\n const numberStr = value.replace(\"px\", \"\");\n return parseFloat(numberStr);\n}\n\n/** @internal */\nexport interface SplitStringAtFirstNonNumericCharResult {\n numericPart: string;\n firstNonNumericCharPart: string;\n}\n\n/** @internal */\nexport function splitStringAtFirstNonNumericChar(value: string): SplitStringAtFirstNonNumericCharResult {\n value = value.trimStart();\n\n const length = value.length;\n if (length === 0) {\n return { numericPart: '', firstNonNumericCharPart: '' }\n } else {\n let firstNonDigitPartIndex = length;\n let gotDecimalPoint = false;\n for (let i = 0; i < length; i++) {\n const char = value[i];\n if (!isDigit(char)) {\n if (char !== '.') {\n firstNonDigitPartIndex = i;\n break;\n } else {\n if (gotDecimalPoint) {\n firstNonDigitPartIndex = i;\n break;\n } else {\n gotDecimalPoint = true;\n }\n }\n }\n }\n const digitsPart = value.substring(0, firstNonDigitPartIndex);\n const firstNonDigitPart = value.substring(firstNonDigitPartIndex).trim();\n\n return { numericPart: digitsPart, firstNonNumericCharPart: firstNonDigitPart };\n }\n}\n\n/** @internal */\nexport function isDigit(char: string) {\n return char >= '0' && char <= '9';\n}\n\n/** @internal */\nexport function getElementWidth(element: HTMLElement): number {\n return element.offsetWidth;\n}\n\n/** @internal */\nexport function setElementWidth(element: HTMLElement, width: number): void {\n const widthAsPixels = numberToPixels(width);\n element.style.width = widthAsPixels;\n}\n\n/** @internal */\nexport function getElementHeight(element: HTMLElement): number {\n return element.offsetHeight;\n}\n\n/** @internal */\nexport function setElementHeight(element: HTMLElement, height: number): void {\n const heightAsPixels = numberToPixels(height);\n element.style.height = heightAsPixels;\n}\n\n/** @internal */\nexport function getElementWidthAndHeight(element: HTMLElement): WidthAndHeight {\n return {\n width: element.offsetWidth,\n height: element.offsetHeight,\n };\n}\n\n/** @internal */\nexport function setElementDisplayVisibility(element: HTMLElement, visible: boolean): void {\n if (visible) {\n element.style.display = '';\n } else {\n element.style.display = 'none';\n }\n}\n\n/** @internal */\nexport function ensureElementPositionAbsolute(element: HTMLElement): void {\n const absolutePosition = 'absolute';\n if (element.style.position !== absolutePosition) {\n element.style.position = absolutePosition;\n }\n}\n\n/**\n * Replacement for JQuery $.extend(target, obj)\n * @internal\n*/\nexport function extend(target: Record, obj: Record): Record {\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n target[key] = obj[key];\n }\n }\n return target;\n}\n\n/**\n * Replacement for JQuery $.extend(true, target, obj)\n * @internal\n*/\nexport function deepExtend(target: Record, obj: Record | undefined): Record {\n if (obj !== undefined) {\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n const value = obj[key];\n const existingTarget = target[key];\n target[key] = deepExtendValue(existingTarget, value);\n }\n }\n }\n\n return target;\n}\n\n/** @internal */\nexport function deepExtendValue(existingTarget: unknown, value: unknown): unknown {\n if (typeof value !== 'object') {\n return value;\n } else {\n if (Array.isArray(value)) {\n const length = value.length;\n const targetArray = new Array(length);\n for (let i = 0; i < length; i++) {\n const element = value[i];\n targetArray[i] = deepExtendValue({}, element);\n }\n return targetArray;\n } else {\n if (value === null) {\n return null;\n } else {\n const valueObj = value as Record;\n if (existingTarget === undefined) {\n return deepExtend({}, valueObj); // overwrite\n } else {\n if (typeof existingTarget !== \"object\") {\n return deepExtend({}, valueObj); // overwrite\n } else {\n if (Array.isArray(existingTarget)) {\n return deepExtend({}, valueObj); // overwrite\n } else {\n if (existingTarget === null) {\n return deepExtend({}, valueObj); // overwrite\n } else {\n const existingTargetObj = existingTarget as Record;\n return deepExtend(existingTargetObj, valueObj); // merge\n }\n }\n }\n }\n }\n }\n }\n}\n\n/** @internal */\nexport function removeFromArray(item: T, array: T[]): void {\n const index = array.indexOf(item);\n\n if (index === -1) {\n throw new Error('Can\\'t remove item from array. Item is not in the array');\n }\n\n array.splice(index, 1);\n}\n\n/** @internal */\nexport function getUniqueId(): string {\n return (Math.random() * 1000000000000000)\n .toString(36)\n .replace('.', '');\n}\n\n/** @internal */\nexport function getErrorMessage(e: unknown): string {\n if (e instanceof Error) {\n return e.message;\n } else {\n if (typeof e === 'string') {\n return e;\n } else {\n return 'Unknown Error';\n }\n }\n}\n","/** @public */\nexport abstract class ExternalError extends Error {\n /** @internal */\n constructor(public readonly type: string, message: string) {\n super(message);\n }\n}\n\n/** @public */\nexport class ConfigurationError extends ExternalError {\n /** @internal */\n constructor(message: string, public readonly node?: string) {\n super('Configuration', message);\n }\n}\n\n/** @public */\nexport class PopoutBlockedError extends ExternalError {\n /** @internal */\n constructor(message: string) {\n super('PopoutBlocked', message);\n }\n}\n\n/** @public */\nexport class ApiError extends ExternalError {\n /** @internal */\n constructor(message: string) {\n super('API', message);\n }\n}\n\n/** @public */\nexport class BindError extends ExternalError {\n /** @internal */\n constructor(message: string) {\n super('Bind', message);\n }\n}\n","import { ConfigurationError } from '../errors/external-error';\nimport { AssertError, UnexpectedUndefinedError, UnreachableCaseError } from '../errors/internal-error';\nimport { I18nStringId, i18nStrings } from '../utils/i18n-strings';\nimport { ItemType, JsonValue, ResponsiveMode, Side, SizeUnitEnum } from '../utils/types';\nimport { deepExtendValue, splitStringAtFirstNonNumericChar } from '../utils/utils';\nimport {\n ResolvedComponentItemConfig,\n ResolvedHeaderedItemConfig,\n ResolvedItemConfig,\n ResolvedLayoutConfig,\n ResolvedPopoutLayoutConfig,\n ResolvedRootItemConfig,\n ResolvedRowOrColumnItemConfig,\n ResolvedStackItemConfig\n} from \"./resolved-config\";\n\n/** @public */\nexport interface ItemConfig {\n /**\n * The type of the item. Possible values are 'row', 'column', 'stack', 'component'.\n */\n type: ItemType;\n\n /**\n * An array of configurations for items that will be created as children of this item.\n */\n content?: ItemConfig[];\n\n /**\n * The width of this item, relative to the other children of its parent in percent\n * @deprecated use {@link (ItemConfig:interface).size} instead\n */\n width?: number;\n\n /**\n * The minimum width of this item in pixels\n * CAUTION - Not tested - do not use\n * @deprecated use {@link (ItemConfig:interface).minSize} instead\n */\n minWidth?: number;\n\n /**\n * The height of this item, relative to the other children of its parent in percent\n * @deprecated use {@link (ItemConfig:interface).size} instead\n */\n height?: number;\n\n /**\n * The minimum height of this item in pixels\n * CAUTION - Not tested - do not use\n * @deprecated use {@link (ItemConfig:interface).minSize} instead\n */\n minHeight?: number;\n\n /**\n * The size of this item.\n * For rows, it specifies height. For columns, it specifies width.\n * Has format \\\\<{@link SizeUnit}\\>. Currently only supports units `fr` and `%`.\n *\n * Space is first proportionally allocated to items with sizeUnit `%`.\n * If there is any space left over (less than 100% allocated), then the\n * remainder is allocated to the items with unit `fr` according to the fractional size.\n * If more than 100% is allocated, then an extra 50% is allocated to items with unit `fr` and\n * is allocated to each item according to its fractional size. All item sizes are then adjusted\n * to bring the total back to 100%\n */\n size?: string;\n\n /**\n * The size of this item.\n * For rows, it specifies height. For columns, it specifies width.\n * Has format . Currently only supports units `px`\n */\n minSize?: string;\n\n /**\n * A string that can be used to identify a ContentItem.\n * Do NOT assign an array. This only exists for legacy purposes. If an array is assigned, the first element\n * will become the id.\n */\n id?: string;\n\n /**\n * Determines if the item is closable. If false, the x on the items tab will be hidden and container.close()\n * will return false\n * Default: true\n */\n isClosable?: boolean;\n\n /**\n * The title of the item as displayed on its tab and on popout windows\n * Default: componentType.toString() or ''\n * @deprecated only Component has a title\n */\n title?: string;\n}\n\n/** @public */\nexport namespace ItemConfig {\n /** @internal */\n export const enum SizeWidthHeightSpecificationType {\n None,\n Size,\n WidthOrHeight,\n }\n\n /** @internal */\n export function resolve(itemConfig: ItemConfig, rowAndColumnChildLegacySizeDefault: boolean): ResolvedItemConfig {\n switch (itemConfig.type) {\n case ItemType.ground:\n throw new ConfigurationError('ItemConfig cannot specify type ground', JSON.stringify(itemConfig));\n case ItemType.row:\n case ItemType.column:\n return RowOrColumnItemConfig.resolve(itemConfig as RowOrColumnItemConfig, rowAndColumnChildLegacySizeDefault);\n\n case ItemType.stack:\n return StackItemConfig.resolve(itemConfig as StackItemConfig, rowAndColumnChildLegacySizeDefault);\n\n case ItemType.component:\n return ComponentItemConfig.resolve(itemConfig as ComponentItemConfig, rowAndColumnChildLegacySizeDefault);\n\n default:\n throw new UnreachableCaseError('UCUICR55499', itemConfig.type);\n }\n }\n\n /** @internal */\n export function resolveContent(content: ItemConfig[] | undefined): ResolvedItemConfig[] {\n if (content === undefined) {\n return [];\n } else {\n const count = content.length;\n const result = new Array(count);\n for (let i = 0; i < count; i++) {\n result[i] = ItemConfig.resolve(content[i], false);\n }\n return result;\n }\n }\n\n /** @internal */\n export function resolveId(id: string | string[] | undefined): string {\n if (id === undefined) {\n return ResolvedItemConfig.defaults.id;\n } else {\n if (Array.isArray(id)) {\n if (id.length === 0) {\n return ResolvedItemConfig.defaults.id;\n } else {\n return id[0];\n }\n } else {\n return id;\n }\n }\n }\n\n /** @internal */\n export function resolveSize(\n size: string | undefined,\n width: number | undefined,\n height: number | undefined,\n rowAndColumnChildLegacySizeDefault: boolean):\n SizeWithUnit {\n // Remove support for rowAndColumnChildLegacySizeDefault in a major version release\n\n if (size !== undefined) {\n return parseSize(size, [SizeUnitEnum.Percent, SizeUnitEnum.Fractional]);\n } else {\n if (width !== undefined || height !== undefined) {\n if (width !== undefined) {\n return { size: width, sizeUnit: SizeUnitEnum.Percent };\n } else {\n if (height !== undefined) {\n return { size: height, sizeUnit: SizeUnitEnum.Percent };\n } else {\n throw new UnexpectedUndefinedError('CRS33390');\n }\n }\n } else {\n if (rowAndColumnChildLegacySizeDefault) {\n return { size: 50, sizeUnit: SizeUnitEnum.Percent };\n } else {\n return { size: ResolvedItemConfig.defaults.size, sizeUnit: ResolvedItemConfig.defaults.sizeUnit };\n }\n }\n }\n }\n\n /** @internal */\n export function resolveMinSize(minSize: string | undefined, minWidth: number | undefined, minHeight: number | undefined): UndefinableSizeWithUnit {\n if (minSize !== undefined) {\n return parseSize(minSize, [SizeUnitEnum.Pixel]);\n } else {\n const minWidthDefined = minWidth !== undefined;\n const minHeightDefined = minHeight !== undefined;\n if (minWidthDefined || minHeightDefined) {\n if (minWidthDefined) {\n return { size: minWidth, sizeUnit: SizeUnitEnum.Pixel };\n } else {\n return { size: minHeight, sizeUnit: SizeUnitEnum.Pixel };\n }\n } else {\n return { size: ResolvedItemConfig.defaults.minSize, sizeUnit: ResolvedItemConfig.defaults.minSizeUnit };\n }\n }\n }\n\n /** @internal */\n export function calculateSizeWidthHeightSpecificationType(config: ItemConfig): SizeWidthHeightSpecificationType {\n if (config.size !== undefined) {\n return SizeWidthHeightSpecificationType.Size;\n } else {\n if (config.width !== undefined || config.height !== undefined) {\n return SizeWidthHeightSpecificationType.WidthOrHeight;\n } else {\n return SizeWidthHeightSpecificationType.None;\n }\n }\n }\n\n export function isGround(config: ItemConfig): config is ItemConfig {\n return config.type === ItemType.ground;\n }\n export function isRow(config: ItemConfig): config is ItemConfig {\n return config.type === ItemType.row;\n }\n export function isColumn(config: ItemConfig): config is ItemConfig {\n return config.type === ItemType.column;\n }\n export function isStack(config: ItemConfig): config is ItemConfig {\n return config.type === ItemType.stack;\n }\n export function isComponent(config: ItemConfig): config is ComponentItemConfig {\n return config.type === ItemType.component;\n }\n}\n\n// Stack or Component\n/** @public */\nexport interface HeaderedItemConfig extends ItemConfig {\n /** @deprecated use {@link (HeaderedItemConfig:namespace).(Header:interface).show} instead */\n hasHeaders?: boolean;\n header?: HeaderedItemConfig.Header;\n maximised?: boolean;\n}\n\n/** @public */\nexport namespace HeaderedItemConfig {\n const legacyMaximisedId = '__glMaximised';\n\n export interface Header {\n show?: false | Side;\n popout?: false | string;\n dock?: false | string;\n maximise?: false | string;\n close?: string;\n minimise?: string;\n tabDropdown?: false | string;\n }\n\n export namespace Header {\n export function resolve(header: Header | undefined, hasHeaders: boolean | undefined): ResolvedHeaderedItemConfig.Header | undefined {\n if (header === undefined && hasHeaders === undefined) {\n return undefined;\n } else {\n const result: ResolvedHeaderedItemConfig.Header = {\n show: header?.show ?? (hasHeaders === undefined ? undefined : hasHeaders ? ResolvedLayoutConfig.Header.defaults.show : false),\n popout: header?.popout,\n maximise: header?.maximise,\n close: header?.close,\n minimise: header?.minimise,\n tabDropdown: header?.tabDropdown,\n }\n return result;\n }\n }\n }\n\n /** @internal */\n export function resolveIdAndMaximised(config: HeaderedItemConfig): { id: string, maximised: boolean} {\n let id: string;\n // To support legacy configs with Id saved as an array of string, assign config.id to a type which includes string array\n let legacyId: string | string[] | undefined = config.id;\n let legacyMaximised = false;\n if (legacyId === undefined) {\n id = ResolvedItemConfig.defaults.id;\n } else {\n if (Array.isArray(legacyId)) {\n const idx = legacyId.findIndex((id) => id === legacyMaximisedId)\n if (idx > 0) {\n legacyMaximised = true;\n legacyId = legacyId.splice(idx, 1);\n }\n if (legacyId.length > 0) {\n id = legacyId[0];\n } else {\n id = ResolvedItemConfig.defaults.id;\n }\n } else {\n id = legacyId;\n }\n }\n\n let maximised: boolean;\n if (config.maximised !== undefined) {\n maximised = config.maximised;\n } else {\n maximised = legacyMaximised;\n }\n\n return { id, maximised }\n }\n}\n\n/** @public */\nexport interface StackItemConfig extends HeaderedItemConfig {\n type: 'stack';\n content: ComponentItemConfig[];\n /** The index of the item in content which is to be active*/\n activeItemIndex?: number;\n}\n\n/** @public */\nexport namespace StackItemConfig {\n /** @internal */\n export function resolve(itemConfig: StackItemConfig, rowAndColumnChildLegacySizeDefault: boolean): ResolvedStackItemConfig {\n const { id, maximised } = HeaderedItemConfig.resolveIdAndMaximised(itemConfig);\n const { size, sizeUnit } = ItemConfig.resolveSize(itemConfig.size, itemConfig.width, itemConfig.height, rowAndColumnChildLegacySizeDefault);\n const { size: minSize, sizeUnit: minSizeUnit } = ItemConfig.resolveMinSize(itemConfig.minSize, itemConfig.minWidth, itemConfig.minHeight);\n\n const result: ResolvedStackItemConfig = {\n type: ItemType.stack,\n content: resolveContent(itemConfig.content),\n size,\n sizeUnit,\n minSize,\n minSizeUnit,\n id,\n maximised,\n isClosable: itemConfig.isClosable ?? ResolvedItemConfig.defaults.isClosable,\n activeItemIndex: itemConfig.activeItemIndex ?? ResolvedStackItemConfig.defaultActiveItemIndex,\n header: HeaderedItemConfig.Header.resolve(itemConfig.header, itemConfig.hasHeaders),\n };\n return result;\n }\n\n /** @internal */\n export function fromResolved(resolvedConfig: ResolvedStackItemConfig): StackItemConfig {\n const result: StackItemConfig = {\n type: ItemType.stack,\n content: fromResolvedContent(resolvedConfig.content),\n size: formatSize(resolvedConfig.size, resolvedConfig.sizeUnit),\n minSize: formatUndefinableSize(resolvedConfig.minSize, resolvedConfig.minSizeUnit),\n id: resolvedConfig.id,\n maximised: resolvedConfig.maximised,\n isClosable: resolvedConfig.isClosable,\n activeItemIndex: resolvedConfig.activeItemIndex,\n header: ResolvedHeaderedItemConfig.Header.createCopy(resolvedConfig.header),\n };\n\n return result;\n }\n\n /** @internal */\n function resolveContent(content: ComponentItemConfig[] | undefined): ResolvedComponentItemConfig[] {\n if (content === undefined) {\n return [];\n } else {\n const count = content.length;\n const result = new Array(count);\n for (let i = 0; i < count; i++) {\n const childItemConfig = content[i];\n const itemConfig = ItemConfig.resolve(childItemConfig, false);\n if (!ResolvedItemConfig.isComponentItem(itemConfig)) {\n throw new AssertError('UCUSICRC91114', JSON.stringify(itemConfig));\n } else {\n result[i] = itemConfig;\n }\n }\n return result;\n }\n }\n\n /** @internal */\n function fromResolvedContent(resolvedContent: ResolvedComponentItemConfig[]): ComponentItemConfig[] {\n const count = resolvedContent.length;\n const result = new Array(count);\n for (let i = 0; i < count; i++) {\n const resolvedContentConfig = resolvedContent[i];\n result[i] = ComponentItemConfig.fromResolved(resolvedContentConfig);\n }\n return result;\n }\n}\n\n/** @public */\nexport interface ComponentItemConfig extends HeaderedItemConfig {\n type: 'component';\n readonly content?: [];\n\n /**\n * The title of the item as displayed on its tab and on popout windows\n * Default: componentType.toString() or ''\n */\n title?: string;\n\n /**\n * The type of the component.\n * @deprecated use {@link (ComponentItemConfig:interface).componentType} instead\n */\n componentName?: string;\n\n /**\n * The type of the component.\n * `componentType` must be of type `string` if it is registered with any of the following functions:\n * * {@link (GoldenLayout:class).registerComponent} (deprecated)\n * * {@link (GoldenLayout:class).registerComponentConstructor}\n * * {@link (GoldenLayout:class).registerComponentFactoryFunction}\n */\n componentType: JsonValue;\n /**\n * The state information with which a component will be initialised with.\n * Will be passed to the component constructor function and will be the value returned by\n * container.initialState.\n */\n componentState?: JsonValue;\n\n /**\n * Default: true\n */\n reorderEnabled?: boolean; // Takes precedence over LayoutConfig.reorderEnabled.\n}\n\n/** @public */\nexport namespace ComponentItemConfig {\n /** @internal */\n export function resolve(itemConfig: ComponentItemConfig, rowAndColumnChildLegacySizeDefault: boolean): ResolvedComponentItemConfig {\n let componentType: JsonValue | undefined = itemConfig.componentType;\n if (componentType === undefined) {\n componentType = itemConfig.componentName;\n }\n if (componentType === undefined) {\n throw new Error('ComponentItemConfig.componentType is undefined');\n } else {\n const { id, maximised } = HeaderedItemConfig.resolveIdAndMaximised(itemConfig);\n let title: string;\n if (itemConfig.title === undefined || itemConfig.title === '') {\n title = ComponentItemConfig.componentTypeToTitle(componentType);\n } else {\n title = itemConfig.title;\n }\n const { size, sizeUnit } = ItemConfig.resolveSize(itemConfig.size, itemConfig.width, itemConfig.height, rowAndColumnChildLegacySizeDefault);\n const { size: minSize, sizeUnit: minSizeUnit } = ItemConfig.resolveMinSize(itemConfig.minSize, itemConfig.minWidth, itemConfig.minHeight);\n const result: ResolvedComponentItemConfig = {\n type: itemConfig.type,\n content: [],\n size,\n sizeUnit,\n minSize,\n minSizeUnit,\n id,\n maximised,\n isClosable: itemConfig.isClosable ?? ResolvedItemConfig.defaults.isClosable,\n reorderEnabled: itemConfig.reorderEnabled ?? ResolvedComponentItemConfig.defaultReorderEnabled,\n title,\n header: HeaderedItemConfig.Header.resolve(itemConfig.header, itemConfig.hasHeaders),\n componentType,\n componentState: itemConfig.componentState ?? {},\n };\n return result;\n }\n }\n\n /** @internal */\n export function fromResolved(resolvedConfig: ResolvedComponentItemConfig): ComponentItemConfig {\n const result: ComponentItemConfig = {\n type: ItemType.component,\n size: formatSize(resolvedConfig.size, resolvedConfig.sizeUnit),\n minSize: formatUndefinableSize(resolvedConfig.minSize, resolvedConfig.minSizeUnit),\n id: resolvedConfig.id,\n maximised: resolvedConfig.maximised,\n isClosable: resolvedConfig.isClosable,\n reorderEnabled: resolvedConfig.reorderEnabled,\n title: resolvedConfig.title,\n header: ResolvedHeaderedItemConfig.Header.createCopy(resolvedConfig.header),\n componentType: resolvedConfig.componentType,\n componentState: deepExtendValue(undefined, resolvedConfig.componentState) as JsonValue,\n }\n\n return result;\n }\n\n export function componentTypeToTitle(componentType: JsonValue): string {\n const componentTypeType = typeof componentType;\n switch (componentTypeType) {\n case 'string': return componentType as string;\n case 'number': return (componentType as number).toString();\n case 'boolean': return (componentType as boolean).toString();\n default: return '';\n }\n }\n}\n\n// RowOrColumn\n/** @public */\nexport interface RowOrColumnItemConfig extends ItemConfig {\n type: 'row' | 'column';\n content: (RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig)[];\n}\n\n/** @public */\nexport namespace RowOrColumnItemConfig {\n export type ChildItemConfig = RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig;\n\n export function isChildItemConfig(itemConfig: ItemConfig): itemConfig is ChildItemConfig {\n switch (itemConfig.type) {\n case ItemType.row:\n case ItemType.column:\n case ItemType.stack:\n case ItemType.component:\n return true;\n case ItemType.ground:\n return false;\n default:\n throw new UnreachableCaseError('UROCOSPCICIC13687', itemConfig.type);\n }\n }\n\n /** @internal */\n export function resolve(itemConfig: RowOrColumnItemConfig, rowAndColumnChildLegacySizeDefault: boolean): ResolvedRowOrColumnItemConfig {\n const { size, sizeUnit } = ItemConfig.resolveSize(itemConfig.size, itemConfig.width, itemConfig.height, rowAndColumnChildLegacySizeDefault);\n const { size: minSize, sizeUnit: minSizeUnit } = ItemConfig.resolveMinSize(itemConfig.minSize, itemConfig.minWidth, itemConfig.minHeight);\n const result: ResolvedRowOrColumnItemConfig = {\n type: itemConfig.type,\n content: RowOrColumnItemConfig.resolveContent(itemConfig.content),\n size,\n sizeUnit,\n minSize,\n minSizeUnit,\n id: ItemConfig.resolveId(itemConfig.id),\n isClosable: itemConfig.isClosable ?? ResolvedItemConfig.defaults.isClosable,\n }\n return result;\n }\n\n /** @internal */\n export function fromResolved(resolvedConfig: ResolvedRowOrColumnItemConfig): RowOrColumnItemConfig {\n const result: RowOrColumnItemConfig = {\n type: resolvedConfig.type,\n content: fromResolvedContent(resolvedConfig.content),\n size: formatSize(resolvedConfig.size, resolvedConfig.sizeUnit),\n minSize: formatUndefinableSize(resolvedConfig.minSize, resolvedConfig.minSizeUnit),\n id: resolvedConfig.id,\n isClosable: resolvedConfig.isClosable,\n }\n\n return result;\n }\n\n /** @internal */\n export function resolveContent(content: ChildItemConfig[] | undefined): ResolvedRowOrColumnItemConfig.ChildItemConfig[] {\n if (content === undefined) {\n return [];\n } else {\n const count = content.length;\n const childItemConfigs = new Array(count);\n let widthOrHeightSpecifiedAtLeastOnce = false;\n let sizeSpecifiedAtLeastOnce = false;\n for (let i = 0; i < count; i++) {\n const childItemConfig = content[i];\n if (!RowOrColumnItemConfig.isChildItemConfig(childItemConfig)) {\n throw new ConfigurationError('ItemConfig is not Row, Column or Stack', childItemConfig);\n } else {\n if (!sizeSpecifiedAtLeastOnce) {\n const sizeWidthHeightSpecificationType = ItemConfig.calculateSizeWidthHeightSpecificationType(childItemConfig);\n switch (sizeWidthHeightSpecificationType) {\n case ItemConfig.SizeWidthHeightSpecificationType.None:\n break;\n case ItemConfig.SizeWidthHeightSpecificationType.WidthOrHeight:\n widthOrHeightSpecifiedAtLeastOnce = true;\n break;\n case ItemConfig.SizeWidthHeightSpecificationType.Size:\n sizeSpecifiedAtLeastOnce = true;\n break;\n default:\n throw new UnreachableCaseError('ROCICRC87556', sizeWidthHeightSpecificationType);\n }\n }\n childItemConfigs[i] = childItemConfig;\n }\n }\n\n let legacySizeDefault: boolean;\n if (sizeSpecifiedAtLeastOnce) {\n legacySizeDefault = false;\n } else {\n if (widthOrHeightSpecifiedAtLeastOnce) {\n legacySizeDefault = true;\n } else {\n legacySizeDefault = false;\n }\n }\n\n const result = new Array(count);\n for (let i = 0; i < count; i++) {\n const childItemConfig = childItemConfigs[i];\n const resolvedChildItemConfig = ItemConfig.resolve(childItemConfig, legacySizeDefault);\n if (!ResolvedRowOrColumnItemConfig.isChildItemConfig(resolvedChildItemConfig)) {\n throw new AssertError('UROCOSPIC99512', JSON.stringify(resolvedChildItemConfig));\n } else {\n result[i] = resolvedChildItemConfig;\n }\n }\n return result;\n }\n }\n\n /** @internal */\n function fromResolvedContent(resolvedContent: readonly ResolvedRowOrColumnItemConfig.ChildItemConfig[]): RowOrColumnItemConfig.ChildItemConfig[] {\n const count = resolvedContent.length;\n const result = new Array(count);\n for (let i = 0; i < count; i++) {\n const resolvedContentConfig = resolvedContent[i];\n const type = resolvedContentConfig.type;\n let contentConfig: RowOrColumnItemConfig.ChildItemConfig;\n switch (type) {\n case ItemType.row:\n case ItemType.column:\n contentConfig = RowOrColumnItemConfig.fromResolved(resolvedContentConfig);\n break;\n case ItemType.stack:\n contentConfig = StackItemConfig.fromResolved(resolvedContentConfig);\n break;\n case ItemType.component:\n contentConfig = ComponentItemConfig.fromResolved(resolvedContentConfig);\n break;\n default:\n throw new UnreachableCaseError('ROCICFRC44797', type);\n }\n result[i] = contentConfig;\n }\n return result;\n }\n}\n\n/** @public */\nexport type RootItemConfig = RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig;\n\n/** @public */\nexport namespace RootItemConfig {\n export function isRootItemConfig(itemConfig: ItemConfig): itemConfig is RootItemConfig {\n switch (itemConfig.type) {\n case ItemType.row:\n case ItemType.column:\n case ItemType.stack:\n case ItemType.component:\n return true;\n case ItemType.ground:\n return false;\n default:\n throw new UnreachableCaseError('URICIR23687', itemConfig.type);\n }\n }\n\n /** @internal */\n export function resolve(itemConfig: RootItemConfig | undefined): ResolvedRootItemConfig | undefined {\n if (itemConfig === undefined) {\n return undefined;\n } else {\n const result = ItemConfig.resolve(itemConfig, false);\n if (!ResolvedRootItemConfig.isRootItemConfig(result)) {\n throw new ConfigurationError('ItemConfig is not Row, Column or Stack', JSON.stringify(itemConfig));\n } else {\n return result;\n }\n }\n }\n\n /** @internal */\n export function fromResolvedOrUndefined(resolvedItemConfig: ResolvedRootItemConfig | undefined): RootItemConfig | undefined {\n if (resolvedItemConfig === undefined) {\n return undefined;\n } else {\n const type = resolvedItemConfig.type;\n switch (type) {\n case ItemType.row:\n case ItemType.column:\n return RowOrColumnItemConfig.fromResolved(resolvedItemConfig);\n case ItemType.stack:\n return StackItemConfig.fromResolved(resolvedItemConfig);\n case ItemType.component:\n return ComponentItemConfig.fromResolved(resolvedItemConfig);\n default:\n throw new UnreachableCaseError('RICFROU89921', type);\n }\n }\n }\n}\n\n/** @public */\nexport interface LayoutConfig {\n root: RootItemConfig | undefined;\n /** @deprecated Use {@link (LayoutConfig:interface).root} */\n content?: (RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig)[];\n openPopouts?: PopoutLayoutConfig[];\n dimensions?: LayoutConfig.Dimensions;\n settings?: LayoutConfig.Settings;\n /** @deprecated use {@link (LayoutConfig:interface).header} instead */\n labels?: LayoutConfig.Labels;\n header?: LayoutConfig.Header;\n}\n\n/** Use to specify LayoutConfig with defaults or deserialise a LayoutConfig.\n * Deserialisation will handle backwards compatibility.\n * Note that LayoutConfig should be used for serialisation (not LayoutConfig)\n * @public\n */\nexport namespace LayoutConfig {\n export interface Settings {\n /**\n * @deprecated use ${@link (LayoutConfig:namespace).(Header:interface).show} instead\n */\n hasHeaders?: boolean;\n\n /**\n * Constrains the area in which items can be dragged to the layout's container. Will be set to false\n * automatically when layout.createDragSource() is called.\n * Default: true\n */\n constrainDragToContainer?: boolean;\n\n /**\n * If true, the user can re-arrange the layout by dragging items by their tabs to the desired location.\n * Can be overridden by ItemConfig.reorderEnabled for specific ItemConfigs\n * Default: true\n */\n reorderEnabled?: boolean;\n\n /**\n * Decides what will be opened in a new window if the user clicks the popout icon. If true the entire stack will\n * be transferred to the new window, if false only the active component will be opened.\n * Default: false\n */\n popoutWholeStack?: boolean;\n\n /**\n * Specifies if an error is thrown when a popout is blocked by the browser (e.g. by opening it programmatically).\n * If false, the popout call will fail silently.\n * Default: true\n */\n blockedPopoutsThrowError?: boolean;\n\n /**\n * Specifies if all popouts should be closed when the page that created them is closed. Popouts don't have a\n * strong dependency on their parent and can exist on their own, but can be quite annoying to close by hand. In\n * addition, any changes made to popouts won't be stored after the parent is closed.\n * Default: true\n * @deprecated Will be removed in version 3.\n */\n closePopoutsOnUnload?: boolean;\n\n /**\n * Specifies if the popout icon should be displayed in the header-bar.\n * @deprecated use {@link (LayoutConfig:namespace).(Header:interface).popout} instead\n */\n showPopoutIcon?: boolean;\n\n /**\n * Specifies if the maximise icon should be displayed in the header-bar.\n * @deprecated use {@link (LayoutConfig:namespace).(Header:interface).maximise} instead\n */\n showMaximiseIcon?: boolean;\n\n /**\n * Specifies if the close icon should be displayed in the header-bar.\n * @deprecated use {@link (LayoutConfig:namespace).(Header:interface).close} instead\n */\n showCloseIcon?: boolean;\n\n /**\n * Specifies Responsive Mode (more info needed).\n * Default: none\n */\n responsiveMode?: ResponsiveMode;\n\n /**\n * Specifies Maximum pixel overlap per tab.\n * Default: 0\n */\n tabOverlapAllowance?: number;\n\n /**\n *\n * Default: true\n */\n reorderOnTabMenuClick?: boolean;\n\n /**\n * Default: 10\n */\n tabControlOffset?: number;\n\n /**\n * Specifies whether to pop in elements when closing a popout window.\n * Default: false\n */\n popInOnClose?: boolean;\n }\n\n export namespace Settings {\n export function resolve(settings: Settings | undefined): ResolvedLayoutConfig.Settings {\n const result: ResolvedLayoutConfig.Settings = {\n constrainDragToContainer: settings?.constrainDragToContainer ?? ResolvedLayoutConfig.Settings.defaults.constrainDragToContainer,\n reorderEnabled: settings?.reorderEnabled ?? ResolvedLayoutConfig.Settings.defaults.reorderEnabled,\n popoutWholeStack: settings?.popoutWholeStack ?? ResolvedLayoutConfig.Settings.defaults.popoutWholeStack,\n blockedPopoutsThrowError: settings?.blockedPopoutsThrowError ?? ResolvedLayoutConfig.Settings.defaults.blockedPopoutsThrowError,\n closePopoutsOnUnload: settings?.closePopoutsOnUnload ?? ResolvedLayoutConfig.Settings.defaults.closePopoutsOnUnload,\n responsiveMode: settings?.responsiveMode ?? ResolvedLayoutConfig.Settings.defaults.responsiveMode,\n tabOverlapAllowance: settings?.tabOverlapAllowance ?? ResolvedLayoutConfig.Settings.defaults.tabOverlapAllowance,\n reorderOnTabMenuClick: settings?.reorderOnTabMenuClick ?? ResolvedLayoutConfig.Settings.defaults.reorderOnTabMenuClick,\n tabControlOffset: settings?.tabControlOffset ?? ResolvedLayoutConfig.Settings.defaults.tabControlOffset,\n popInOnClose: settings?.popInOnClose ?? ResolvedLayoutConfig.Settings.defaults.popInOnClose,\n }\n return result;\n }\n }\n\n export interface Dimensions {\n /**\n * The width of the borders between the layout items in pixel. Please note: The actual draggable area is wider\n * than the visible one, making it safe to set this to small values without affecting usability.\n * Default: 5\n */\n borderWidth?: number;\n\n /**\n * Default: 15\n */\n borderGrabWidth?: number,\n\n /**\n * The minimum height an item can be resized to (in pixel).\n * @deprecated use {@link (LayoutConfig:namespace).(Dimensions:interface).defaultMinItemHeight} instead\n */\n minItemHeight?: number;\n\n /**\n * The minimum height an item can be resized to.\n * Default: 0\n */\n defaultMinItemHeight?: string;\n\n /**\n * The minimum width an item can be resized to (in pixel).\n * @deprecated use {@link (LayoutConfig:namespace).(Dimensions:interface).defaultMinItemWidth} instead\n */\n minItemWidth?: number;\n\n /**\n * The minimum width an item can be resized to.\n * Default: 10px\n */\n defaultMinItemWidth?: string;\n\n /**\n * The height of the header elements in pixel. This can be changed, but your theme's header css needs to be\n * adjusted accordingly.\n * Default: 20\n */\n headerHeight?: number;\n\n /**\n * The width of the element that appears when an item is dragged (in pixel).\n * Default: 300\n */\n dragProxyWidth?: number;\n\n /**\n * The height of the element that appears when an item is dragged (in pixel).\n * Default: 200\n */\n dragProxyHeight?: number;\n }\n\n export namespace Dimensions {\n /** @internal */\n export function resolve(dimensions: Dimensions | undefined): ResolvedLayoutConfig.Dimensions {\n const { size: defaultMinItemHeight, sizeUnit: defaultMinItemHeightUnit } = Dimensions.resolveDefaultMinItemHeight(dimensions);\n const { size: defaultMinItemWidth, sizeUnit: defaultMinItemWidthUnit } = Dimensions.resolveDefaultMinItemWidth(dimensions);\n const result: ResolvedLayoutConfig.Dimensions = {\n borderWidth: dimensions?.borderWidth ?? ResolvedLayoutConfig.Dimensions.defaults.borderWidth,\n borderGrabWidth: dimensions?.borderGrabWidth ?? ResolvedLayoutConfig.Dimensions.defaults.borderGrabWidth,\n defaultMinItemHeight,\n defaultMinItemHeightUnit,\n defaultMinItemWidth,\n defaultMinItemWidthUnit,\n headerHeight: dimensions?.headerHeight ?? ResolvedLayoutConfig.Dimensions.defaults.headerHeight,\n dragProxyWidth: dimensions?.dragProxyWidth ?? ResolvedLayoutConfig.Dimensions.defaults.dragProxyWidth,\n dragProxyHeight: dimensions?.dragProxyHeight ?? ResolvedLayoutConfig.Dimensions.defaults.dragProxyHeight,\n }\n return result;\n }\n\n /** @internal */\n export function fromResolved(resolvedDimensions: ResolvedLayoutConfig.Dimensions): Dimensions {\n const result: Dimensions = {\n borderWidth: resolvedDimensions.borderWidth,\n borderGrabWidth: resolvedDimensions.borderGrabWidth,\n defaultMinItemHeight: formatSize(resolvedDimensions.defaultMinItemHeight, resolvedDimensions.defaultMinItemHeightUnit),\n defaultMinItemWidth: formatSize(resolvedDimensions.defaultMinItemWidth, resolvedDimensions.defaultMinItemWidthUnit),\n headerHeight: resolvedDimensions.headerHeight,\n dragProxyWidth: resolvedDimensions.dragProxyWidth,\n dragProxyHeight: resolvedDimensions.dragProxyHeight,\n };\n\n return result;\n }\n\n /** @internal */\n export function resolveDefaultMinItemHeight(dimensions: Dimensions | undefined): SizeWithUnit {\n const height = dimensions?.defaultMinItemHeight;\n if (height === undefined) {\n return { size: ResolvedLayoutConfig.Dimensions.defaults.defaultMinItemHeight, sizeUnit: ResolvedLayoutConfig.Dimensions.defaults.defaultMinItemHeightUnit };\n } else {\n return parseSize(height, [SizeUnitEnum.Pixel]);\n }\n }\n\n /** @internal */\n export function resolveDefaultMinItemWidth(dimensions: Dimensions | undefined): SizeWithUnit {\n const width = dimensions?.defaultMinItemWidth;\n if (width === undefined) {\n return { size: ResolvedLayoutConfig.Dimensions.defaults.defaultMinItemWidth, sizeUnit: ResolvedLayoutConfig.Dimensions.defaults.defaultMinItemWidthUnit };\n } else {\n return parseSize(width, [SizeUnitEnum.Pixel]);\n }\n }\n }\n\n export interface Labels {\n /**\n * @deprecated use {@link (LayoutConfig:namespace).(Header:interface).close} instead\n */\n close?: string;\n\n /**\n * @deprecated use {@link (LayoutConfig:namespace).(Header:interface).maximise} instead\n */\n maximise?: string;\n\n /**\n * @deprecated use {@link (LayoutConfig:namespace).(Header:interface).minimise} instead\n */\n minimise?: string;\n\n /**\n * @deprecated use {@link (LayoutConfig:namespace).(Header:interface).popin} instead\n */\n popin?: string;\n\n /**\n * @deprecated use {@link (LayoutConfig:namespace).(Header:interface).popout} instead\n */\n popout?: string;\n\n /**\n * @deprecated use {@link (LayoutConfig:namespace).(Header:interface).tabDropdown} instead\n */\n tabDropdown?: string;\n }\n\n export interface Header {\n /**\n * Specifies whether header should be displayed, and if so, on which side.\n * If false, the layout will be displayed with splitters only.\n * Default: 'top'\n */\n show?: false | Side;\n /**\n * The tooltip text that appears when hovering over the popout icon or false if popout button not displayed.\n * Default: 'open in new window'\n */\n popout?: false | string;\n /**\n * The tooltip text that appears when hovering over the popin icon.\n * Default: 'pop in'\n */\n popin?: string;\n /**\n * The tooltip text that appears when hovering over the maximise icon or false if maximised button not displayed.\n * Default: 'maximise'\n */\n maximise?: false | string;\n /**\n * The tooltip text that appears when hovering over the close icon.\n * Default: 'close'\n */\n close?: false | string;\n /**\n * The tooltip text that appears when hovering over the minimise icon.\n * Default: 'minimise'\n */\n minimise?: string;\n /**\n *\n * Default: 'additional tabs'\n */\n tabDropdown?: false | string;\n }\n\n export namespace Header {\n /** @internal */\n export function resolve(header: Header | undefined,\n settings: LayoutConfig.Settings | undefined, labels: LayoutConfig.Labels | undefined\n ): ResolvedLayoutConfig.Header {\n let show: false | Side;\n if (header?.show !== undefined) {\n show = header.show;\n } else {\n if (settings !== undefined && settings.hasHeaders !== undefined) {\n show = settings.hasHeaders ? ResolvedLayoutConfig.Header.defaults.show : false;\n } else {\n show = ResolvedLayoutConfig.Header.defaults.show;\n }\n }\n const result: ResolvedLayoutConfig.Header = {\n show,\n popout: header?.popout ?? labels?.popout ??\n (settings?.showPopoutIcon === false ? false : ResolvedLayoutConfig.Header.defaults.popout),\n dock: header?.popin ?? labels?.popin ?? ResolvedLayoutConfig.Header.defaults.dock,\n maximise: header?.maximise ?? labels?.maximise ??\n (settings?.showMaximiseIcon === false ? false : ResolvedLayoutConfig.Header.defaults.maximise),\n close: header?.close ?? labels?.close ??\n (settings?.showCloseIcon === false ? false : ResolvedLayoutConfig.Header.defaults.close),\n minimise: header?.minimise ?? labels?.minimise ?? ResolvedLayoutConfig.Header.defaults.minimise,\n tabDropdown: header?.tabDropdown ?? labels?.tabDropdown ?? ResolvedLayoutConfig.Header.defaults.tabDropdown,\n }\n return result;\n }\n }\n\n export function isPopout(config: LayoutConfig): config is PopoutLayoutConfig {\n return 'parentId' in config || 'indexInParent' in config || 'window' in config;\n }\n\n /** @internal */\n export function resolve(layoutConfig: LayoutConfig): ResolvedLayoutConfig {\n if (isPopout(layoutConfig)) {\n return PopoutLayoutConfig.resolve(layoutConfig);\n } else {\n let root: RootItemConfig | undefined;\n if (layoutConfig.root !== undefined) {\n root = layoutConfig.root;\n } else {\n if (layoutConfig.content !== undefined && layoutConfig.content.length > 0) {\n root = layoutConfig.content[0];\n } else {\n root = undefined;\n }\n }\n const config: ResolvedLayoutConfig = {\n resolved: true,\n root: RootItemConfig.resolve(root),\n openPopouts: LayoutConfig.resolveOpenPopouts(layoutConfig.openPopouts),\n dimensions: LayoutConfig.Dimensions.resolve(layoutConfig.dimensions),\n settings: LayoutConfig.Settings.resolve(layoutConfig.settings),\n header: LayoutConfig.Header.resolve(layoutConfig.header, layoutConfig.settings, layoutConfig.labels),\n }\n return config;\n }\n }\n\n export function fromResolved(config: ResolvedLayoutConfig): LayoutConfig {\n const result: LayoutConfig = {\n root: RootItemConfig.fromResolvedOrUndefined(config.root),\n openPopouts: PopoutLayoutConfig.fromResolvedArray(config.openPopouts),\n settings: ResolvedLayoutConfig.Settings.createCopy(config.settings),\n dimensions: LayoutConfig.Dimensions.fromResolved(config.dimensions),\n header: ResolvedLayoutConfig.Header.createCopy(config.header),\n };\n return result;\n }\n\n export function isResolved(configOrResolvedConfig: ResolvedLayoutConfig | LayoutConfig): configOrResolvedConfig is ResolvedLayoutConfig {\n const config = configOrResolvedConfig as ResolvedLayoutConfig;\n return config.resolved !== undefined && (config.resolved === true);\n }\n\n /** @internal */\n export function resolveOpenPopouts(popoutConfigs: PopoutLayoutConfig[] | undefined): ResolvedPopoutLayoutConfig[] {\n if (popoutConfigs === undefined) {\n return [];\n } else {\n const count = popoutConfigs.length;\n const result = new Array(count);\n for (let i = 0; i < count; i++) {\n result[i] = PopoutLayoutConfig.resolve(popoutConfigs[i]);\n }\n return result;\n }\n }\n}\n\n/** @public */\nexport interface PopoutLayoutConfig extends LayoutConfig {\n /** The id of the element the item will be appended to on popIn\n * If null, append to topmost layout element\n */\n parentId: string | null | undefined;\n /** The position of this element within its parent\n * If null, position is last\n */\n indexInParent: number | null | undefined;\n /** @deprecated use {@link (PopoutLayoutConfig:interface).window} */\n dimensions: PopoutLayoutConfig.Dimensions | undefined; // for backwards compatibility\n window: PopoutLayoutConfig.Window | undefined;\n}\n\n/** @public */\nexport namespace PopoutLayoutConfig {\n // Previous versions kept window information in Dimensions key. Only use for backwards compatibility\n /** @deprecated use {@link (PopoutLayoutConfig:namespace).(Window:interface)} */\n export interface Dimensions extends LayoutConfig.Dimensions {\n /** @deprecated use {@link (PopoutLayoutConfig:namespace).(Window:interface).width} */\n width?: number | null,\n /** @deprecated use {@link (PopoutLayoutConfig:namespace).(Window:interface).height} */\n height?: number | null,\n /** @deprecated use {@link (PopoutLayoutConfig:namespace).(Window:interface).left} */\n left?: number | null,\n /** @deprecated use {@link (PopoutLayoutConfig:namespace).(Window:interface).top} */\n top?: number | null,\n }\n\n export interface Window {\n width?: number,\n height?: number,\n left?: number,\n top?: number,\n }\n\n export namespace Window {\n /** @internal */\n export function resolve(window: Window | undefined,\n dimensions: Dimensions | undefined): ResolvedPopoutLayoutConfig.Window\n {\n let result: ResolvedPopoutLayoutConfig.Window;\n const defaults = ResolvedPopoutLayoutConfig.Window.defaults;\n if (window !== undefined) {\n result = {\n width: window.width ?? defaults.width,\n height: window.height ?? defaults.height,\n left: window.left ?? defaults.left,\n top: window.top ?? defaults.top,\n }\n } else {\n result = {\n width: dimensions?.width ?? defaults.width,\n height: dimensions?.height ?? defaults.height,\n left: dimensions?.left ?? defaults.left,\n top: dimensions?.top ?? defaults.top,\n }\n }\n return result;\n }\n\n /** @internal */\n export function fromResolved(resolvedWindow: ResolvedPopoutLayoutConfig.Window): Window {\n const result: Window = {\n width: resolvedWindow.width === null ? undefined : resolvedWindow.width,\n height: resolvedWindow.height === null ? undefined : resolvedWindow.height,\n left: resolvedWindow.left === null ? undefined : resolvedWindow.left,\n top: resolvedWindow.top === null ? undefined : resolvedWindow.top,\n }\n\n return result;\n }\n }\n\n /** @internal */\n export function resolve(popoutConfig: PopoutLayoutConfig): ResolvedPopoutLayoutConfig {\n let root: RootItemConfig | undefined;\n if (popoutConfig.root !== undefined) {\n root = popoutConfig.root;\n } else {\n if (popoutConfig.content !== undefined && popoutConfig.content.length > 0) {\n root = popoutConfig.content[0];\n } else {\n root = undefined;\n }\n }\n\n const config: ResolvedPopoutLayoutConfig = {\n root: RootItemConfig.resolve(root),\n openPopouts: LayoutConfig.resolveOpenPopouts(popoutConfig.openPopouts),\n dimensions: LayoutConfig.Dimensions.resolve(popoutConfig.dimensions),\n settings: LayoutConfig.Settings.resolve(popoutConfig.settings),\n header: LayoutConfig.Header.resolve(popoutConfig.header, popoutConfig.settings, popoutConfig.labels),\n parentId: popoutConfig.parentId ?? null,\n indexInParent: popoutConfig.indexInParent ?? null,\n window: PopoutLayoutConfig.Window.resolve(popoutConfig.window, popoutConfig.dimensions),\n resolved: true,\n }\n return config;\n }\n\n /** @internal */\n export function fromResolved(resolvedConfig: ResolvedPopoutLayoutConfig): PopoutLayoutConfig {\n const result: PopoutLayoutConfig = {\n root: RootItemConfig.fromResolvedOrUndefined(resolvedConfig.root),\n openPopouts: fromResolvedArray(resolvedConfig.openPopouts),\n dimensions: LayoutConfig.Dimensions.fromResolved(resolvedConfig.dimensions),\n settings: ResolvedLayoutConfig.Settings.createCopy(resolvedConfig.settings),\n header: ResolvedLayoutConfig.Header.createCopy(resolvedConfig.header),\n parentId: resolvedConfig.parentId,\n indexInParent: resolvedConfig.indexInParent,\n window: PopoutLayoutConfig.Window.fromResolved(resolvedConfig.window),\n }\n\n return result;\n }\n\n /** @internal */\n export function fromResolvedArray(resolvedArray: ResolvedPopoutLayoutConfig[]): PopoutLayoutConfig[] {\n const resolvedOpenPopoutCount = resolvedArray.length;\n const result = new Array(resolvedOpenPopoutCount);\n for (let i = 0; i < resolvedOpenPopoutCount; i++) {\n const resolvedOpenPopout = resolvedArray[i];\n result[i] = PopoutLayoutConfig.fromResolved(resolvedOpenPopout);\n }\n\n return result;\n }\n}\n\n/** @internal */\nexport interface SizeWithUnit {\n size: number;\n sizeUnit: SizeUnitEnum;\n}\n\n/** @internal */\nexport interface UndefinableSizeWithUnit {\n size: number | undefined;\n sizeUnit: SizeUnitEnum;\n}\n\n/** @internal */\nexport function parseSize(sizeString: string, allowableSizeUnits: readonly SizeUnitEnum[]): SizeWithUnit {\n const { numericPart: digitsPart, firstNonNumericCharPart: firstNonDigitPart } = splitStringAtFirstNonNumericChar(sizeString);\n const size = Number.parseInt(digitsPart, 10);\n if (isNaN(size)) {\n throw new ConfigurationError(`${i18nStrings[I18nStringId.InvalidNumberPartInSizeString]}: ${sizeString}`);\n } else {\n const sizeUnit = SizeUnitEnum.tryParse(firstNonDigitPart);\n if (sizeUnit === undefined) {\n throw new ConfigurationError(`${i18nStrings[I18nStringId.UnknownUnitInSizeString]}: ${sizeString}`)\n } else {\n if (!allowableSizeUnits.includes(sizeUnit)) {\n throw new ConfigurationError(`${i18nStrings[I18nStringId.UnsupportedUnitInSizeString]}: ${sizeString}`)\n } else {\n return { size, sizeUnit };\n }\n }\n }\n}\n\n/** @internal */\nexport function formatSize(size: number, sizeUnit: SizeUnitEnum) {\n return size.toString(10) + SizeUnitEnum.format(sizeUnit);\n}\n\n/** @internal */\nexport function formatUndefinableSize(size: number| undefined, sizeUnit: SizeUnitEnum) {\n if (size === undefined) {\n return undefined;\n } else {\n return size.toString(10) + SizeUnitEnum.format(sizeUnit);\n }\n}\n\n/** @public @deprecated - use {@link (LayoutConfig:interface)} */\nexport type Config = LayoutConfig;\n","import { BrowserPopout } from '../controls/browser-popout';\nimport { Tab } from '../controls/tab';\nimport { ComponentItem } from '../items/component-item';\n\n/**\n * A generic and very fast EventEmitter implementation. On top of emitting the actual event it emits an\n * {@link (EventEmitter:namespace).ALL_EVENT} event for every event triggered. This allows to hook into it and proxy events forwards\n * @public\n */\nexport class EventEmitter {\n /** @internal */\n private _allEventSubscriptions: EventEmitter.UnknownCallback[] = [];\n /** @internal */\n private _subscriptionsMap = new Map();\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n tryBubbleEvent(name: string, args: unknown[]): void {\n // overridden by ContentItem\n }\n\n /**\n * Emit an event and notify listeners\n *\n * @param eventName - The name of the event\n * @param args - Additional arguments that will be passed to the listener\n */\n emit(eventName: K, ...args: EventEmitter.EventParamsMap[K]): void {\n let subcriptions = this._subscriptionsMap.get(eventName);\n\n if (subcriptions !== undefined) {\n subcriptions = subcriptions.slice();\n for (let i = 0; i < subcriptions.length; i++) {\n const subscription = subcriptions[i];\n subscription(...args);\n }\n }\n\n this.emitAllEvent(eventName, args);\n this.tryBubbleEvent(eventName, args);\n }\n\n /** @internal */\n emitUnknown(eventName: string, ...args: EventEmitter.UnknownParams): void {\n let subs = this._subscriptionsMap.get(eventName);\n\n if (subs !== undefined) {\n subs = subs.slice();\n for (let i = 0; i < subs.length; i++) {\n subs[i](...args);\n }\n }\n\n this.emitAllEvent(eventName, args);\n this.tryBubbleEvent(eventName, args);\n }\n\n /* @internal **/\n emitBaseBubblingEvent(eventName: K): void {\n const event = new EventEmitter.BubblingEvent(eventName, this);\n this.emitUnknown(eventName, event);\n }\n\n /** @internal */\n emitUnknownBubblingEvent(eventName: string): void {\n const event = new EventEmitter.BubblingEvent(eventName, this);\n this.emitUnknown(eventName, event);\n }\n\n /**\n * Removes a listener for an event.\n * @param eventName - The name of the event\n * @param callback - The previously registered callback method (optional)\n */\n removeEventListener(eventName: K, callback: EventEmitter.Callback): void {\n const unknownCallback = callback as EventEmitter.UnknownCallback;\n this.removeUnknownEventListener(eventName, unknownCallback);\n }\n\n off(eventName: K, callback: EventEmitter.Callback): void {\n this.removeEventListener(eventName, callback);\n }\n\n /**\n * Alias for off\n */\n unbind = this.removeEventListener;\n\n /**\n * Alias for emit\n */\n trigger = this.emit;\n\n /**\n * Listen for events\n *\n * @param eventName - The name of the event to listen to\n * @param callback - The callback to execute when the event occurs\n */\n addEventListener(eventName: K, callback: EventEmitter.Callback): void {\n const unknownCallback = callback as EventEmitter.UnknownCallback;\n this.addUnknownEventListener(eventName, unknownCallback);\n }\n\n on(eventName: K, callback: EventEmitter.Callback): void {\n this.addEventListener(eventName, callback);\n }\n\n /** @internal */\n private addUnknownEventListener(eventName: string, callback: EventEmitter.UnknownCallback): void {\n if (eventName === EventEmitter.ALL_EVENT) {\n this._allEventSubscriptions.push(callback);\n } else {\n let subscriptions = this._subscriptionsMap.get(eventName);\n if (subscriptions !== undefined) {\n subscriptions.push(callback);\n } else {\n subscriptions = [callback];\n this._subscriptionsMap.set(eventName, subscriptions);\n }\n }\n }\n\n /** @internal */\n private removeUnknownEventListener(eventName: string, callback: EventEmitter.UnknownCallback): void {\n if (eventName === EventEmitter.ALL_EVENT) {\n this.removeSubscription(eventName, this._allEventSubscriptions, callback);\n } else {\n const subscriptions = this._subscriptionsMap.get(eventName);\n if (subscriptions === undefined) {\n throw new Error('No subscribtions to unsubscribe for event ' + eventName);\n } else {\n this.removeSubscription(eventName, subscriptions, callback);\n }\n }\n }\n\n /** @internal */\n private removeSubscription(eventName: string, subscriptions: EventEmitter.UnknownCallback[], callback: EventEmitter.UnknownCallback) {\n const idx = subscriptions.indexOf(callback);\n if (idx < 0) {\n throw new Error('Nothing to unbind for ' + eventName);\n } else {\n subscriptions.splice(idx, 1);\n }\n }\n\n /** @internal */\n private emitAllEvent(eventName: string, args: unknown[]) {\n const allEventSubscriptionsCount = this._allEventSubscriptions.length;\n if (allEventSubscriptionsCount > 0) {\n const unknownArgs = args.slice() as EventEmitter.UnknownParams;\n unknownArgs.unshift(eventName);\n\n const allEventSubcriptions = this._allEventSubscriptions.slice();\n\n for (let i = 0; i < allEventSubscriptionsCount; i++) {\n allEventSubcriptions[i](...unknownArgs);\n }\n }\n }\n}\n\n/** @public */\nexport namespace EventEmitter {\n /**\n * The name of the event that's triggered for every event\n */\n export const ALL_EVENT = '__all';\n\n export const headerClickEventName = 'stackHeaderClick';\n export const headerTouchStartEventName = 'stackHeaderTouchStart';\n\n /** @internal */\n export type UnknownCallback = (this: void, ...args: UnknownParams) => void;\n export type Callback = (this: void, ...args: EventParamsMap[K]) => void;\n\n export interface EventParamsMap {\n \"__all\": UnknownParams;\n \"activeContentItemChanged\": ComponentItemParam;\n \"close\": NoParams;\n \"closed\": NoParams;\n \"destroy\": NoParams;\n \"drag\": DragParams;\n \"dragStart\": DragStartParams;\n \"dragStop\": DragStopParams;\n \"hide\": NoParams;\n \"initialised\": NoParams;\n \"itemDropped\": ComponentItemParam;\n \"maximised\": NoParams;\n \"minimised\": NoParams;\n \"open\": NoParams;\n \"popIn\": NoParams;\n \"resize\": NoParams;\n \"show\": NoParams;\n /** @deprecated - use show instead */\n \"shown\": NoParams;\n \"stateChanged\": NoParams;\n \"tab\": TabParam;\n \"tabCreated\": TabParam;\n \"titleChanged\": StringParam;\n \"windowClosed\": PopoutParam;\n \"windowOpened\": PopoutParam;\n \"beforeComponentRelease\": BeforeComponentReleaseParams;\n \"beforeItemDestroyed\": BubblingEventParam;\n \"itemCreated\": BubblingEventParam;\n \"itemDestroyed\": BubblingEventParam;\n \"focus\": BubblingEventParam;\n \"blur\": BubblingEventParam;\n \"stackHeaderClick\": ClickBubblingEventParam;\n \"stackHeaderTouchStart\": TouchStartBubblingEventParam;\n \"userBroadcast\": UnknownParams;\n }\n\n export type UnknownParams = unknown[];\n export type NoParams = [];\n export type UnknownParam = [unknown];\n export type PopoutParam = [BrowserPopout];\n export type ComponentItemParam = [ComponentItem];\n export type TabParam = [Tab];\n export type BubblingEventParam = [EventEmitter.BubblingEvent]\n export type StringParam = [string];\n export type DragStartParams = [originalX: number, originalY: number];\n export type DragStopParams = [event: PointerEvent | undefined];\n export type DragParams = [offsetX: number, offsetY: number, event: PointerEvent];\n export type BeforeComponentReleaseParams = [component: unknown];\n export type ClickBubblingEventParam = [ClickBubblingEvent];\n export type TouchStartBubblingEventParam = [TouchStartBubblingEvent];\n\n export class BubblingEvent {\n /** @internal */\n private _isPropagationStopped = false;\n\n get name(): string { return this._name; }\n get target(): EventEmitter { return this._target; }\n /** @deprecated Use {@link (EventEmitter:namespace).(BubblingEvent:class).target} instead */\n get origin(): EventEmitter { return this._target; }\n get isPropagationStopped(): boolean { return this._isPropagationStopped; }\n\n /** @internal */\n constructor(\n /** @internal */\n private readonly _name: string,\n /** @internal */\n private readonly _target: EventEmitter) {\n }\n\n stopPropagation(): void {\n this._isPropagationStopped = true;\n }\n }\n\n export class ClickBubblingEvent extends BubblingEvent {\n get mouseEvent(): MouseEvent { return this._mouseEvent; }\n\n /** @internal */\n constructor(name: string, target: EventEmitter,\n /** @internal */\n private readonly _mouseEvent: MouseEvent\n ) {\n super(name, target);\n }\n }\n\n export class TouchStartBubblingEvent extends BubblingEvent {\n get touchEvent(): TouchEvent { return this._touchEvent; }\n\n /** @internal */\n constructor(name: string, target: EventEmitter,\n /** @internal */\n private readonly _touchEvent: TouchEvent\n ) {\n super(name, target);\n }\n }\n}\n","import { ResolvedLayoutConfig, ResolvedPopoutLayoutConfig } from '../config/resolved-config';\nimport { PopoutBlockedError } from '../errors/external-error';\nimport { UnexpectedNullError, UnexpectedUndefinedError } from '../errors/internal-error';\nimport { ContentItem } from '../items/content-item';\nimport { LayoutManager } from '../layout-manager';\nimport { EventEmitter } from '../utils/event-emitter';\nimport { Rect } from '../utils/types';\nimport { deepExtend, getErrorMessage, getUniqueId } from '../utils/utils';\n\n/**\n * Pops a content item out into a new browser window.\n * This is achieved by\n *\n * - Creating a new configuration with the content item as root element\n * - Serializing and minifying the configuration\n * - Opening the current window's URL with the configuration as a GET parameter\n * - GoldenLayout when opened in the new window will look for the GET parameter\n * and use it instead of the provided configuration\n * @public\n */\n\nexport class BrowserPopout extends EventEmitter {\n /** @internal */\n private _popoutWindow: Window | null;\n /** @internal */\n private _isInitialised;\n /** @internal */\n private _checkReadyInterval: ReturnType | undefined;\n\n /**\n * @param _config - GoldenLayout item config\n * @param _initialWindowSize - A map with width, height, top and left\n * @internal\n */\n constructor(\n /** @internal */\n private _config: ResolvedPopoutLayoutConfig,\n /** @internal */\n private _initialWindowSize: Rect,\n /** @internal */\n private _layoutManager: LayoutManager,\n ) {\n super();\n\n this._isInitialised = false;\n this._popoutWindow = null;\n this.createWindow();\n }\n\n toConfig(): ResolvedPopoutLayoutConfig {\n if (this._isInitialised === false) {\n throw new Error('Can\\'t create config, layout not yet initialised');\n }\n\n const glInstance = this.getGlInstance();\n const glInstanceConfig = glInstance.saveLayout();\n\n let left: number | null;\n let top: number | null;\n if (this._popoutWindow === null) {\n left = null;\n top = null;\n } else {\n left = this._popoutWindow.screenX ?? this._popoutWindow.screenLeft;\n top = this._popoutWindow.screenY ?? this._popoutWindow.screenTop;\n }\n\n const window: ResolvedPopoutLayoutConfig.Window = {\n width: this.getGlInstance().width,\n height: this.getGlInstance().height,\n left,\n top,\n };\n\n const config: ResolvedPopoutLayoutConfig = {\n root: glInstanceConfig.root,\n openPopouts: glInstanceConfig.openPopouts,\n settings: glInstanceConfig.settings,\n dimensions: glInstanceConfig.dimensions,\n header: glInstanceConfig.header,\n window,\n parentId: this._config.parentId,\n indexInParent: this._config.indexInParent,\n resolved: true,\n };\n\n return config;\n }\n\n getGlInstance(): LayoutManager {\n if (this._popoutWindow === null) {\n throw new UnexpectedNullError('BPGGI24693');\n }\n return this._popoutWindow.__glInstance;\n }\n\n /**\n * Retrieves the native BrowserWindow backing this popout.\n * Might throw an UnexpectedNullError exception when the window is not initialized yet.\n * @public\n */\n getWindow(): Window {\n if (this._popoutWindow === null) {\n throw new UnexpectedNullError('BPGW087215');\n }\n return this._popoutWindow;\n }\n\n close(): void {\n if (this.getGlInstance()) {\n this.getGlInstance().closeWindow();\n } else {\n try {\n this.getWindow().close();\n } catch (e) {\n //\n }\n }\n }\n\n /**\n * Returns the popped out item to its original position. If the original\n * parent isn't available anymore it falls back to the layout's topmost element\n */\n popIn(): void {\n let parentItem: ContentItem;\n let index = this._config.indexInParent;\n\n if (!this._config.parentId) {\n return;\n }\n\n /*\n * The deepExtend call seems a bit pointless, but it's crucial to\n * copy the config returned by this.getGlInstance().toConfig()\n * onto a new object. Internet Explorer keeps the references\n * to objects on the child window, resulting in the following error\n * once the child window is closed:\n *\n * The callee (server [not server application]) is not available and disappeared\n */\n const glInstanceLayoutConfig = this.getGlInstance().saveLayout();\n const copiedGlInstanceLayoutConfig = deepExtend({}, glInstanceLayoutConfig) as ResolvedLayoutConfig;\n const copiedRoot = copiedGlInstanceLayoutConfig.root;\n if (copiedRoot === undefined) {\n throw new UnexpectedUndefinedError('BPPIR19998');\n }\n const groundItem = this._layoutManager.groundItem;\n if (groundItem === undefined) {\n throw new UnexpectedUndefinedError('BPPIG34972');\n }\n parentItem = groundItem.getItemsByPopInParentId(this._config.parentId)[0];\n\n /*\n * Fallback if parentItem is not available. Either add it to the topmost\n * item or make it the topmost item if the layout is empty\n */\n if (!parentItem) {\n if (groundItem.contentItems.length > 0) {\n parentItem = groundItem.contentItems[0];\n } else {\n parentItem = groundItem;\n }\n index = 0;\n }\n\n const newContentItem = this._layoutManager.createAndInitContentItem(copiedRoot, parentItem);\n\n parentItem.addChild(newContentItem, index);\n if (this._layoutManager.layoutConfig.settings.popInOnClose) {\n this._onClose();\n } else {\n this.close();\n }\n }\n\n /**\n * Creates the URL and window parameter\n * and opens a new window\n * @internal\n */\n private createWindow(): void {\n const url = this.createUrl();\n\n /**\n * Bogus title to prevent re-usage of existing window with the\n * same title. The actual title will be set by the new window's\n * GoldenLayout instance if it detects that it is in subWindowMode\n */\n const target = Math.floor(Math.random() * 1000000).toString(36);\n\n /**\n * The options as used in the window.open string\n */\n const features = this.serializeWindowFeatures({\n width: this._initialWindowSize.width,\n height: this._initialWindowSize.height,\n innerWidth: this._initialWindowSize.width,\n innerHeight: this._initialWindowSize.height,\n menubar: 'no',\n toolbar: 'no',\n location: 'no',\n personalbar: 'no',\n resizable: 'yes',\n scrollbars: 'no',\n status: 'no'\n });\n\n this._popoutWindow = globalThis.open(url, target, features);\n\n if (!this._popoutWindow) {\n if (this._layoutManager.layoutConfig.settings.blockedPopoutsThrowError === true) {\n const error = new PopoutBlockedError('Popout blocked');\n throw error;\n } else {\n return;\n }\n }\n\n this._popoutWindow.addEventListener('load', () => this.positionWindow(), { passive: true })\n this._popoutWindow.addEventListener('beforeunload', () => {\n if (this._layoutManager.layoutConfig.settings.popInOnClose) {\n this.popIn();\n } else {\n this._onClose();\n }\n }, { passive: true })\n\n /**\n * Polling the childwindow to find out if GoldenLayout has been initialised\n * doesn't seem optimal, but the alternatives - adding a callback to the parent\n * window or raising an event on the window object - both would introduce knowledge\n * about the parent to the child window which we'd rather avoid\n */\n this._checkReadyInterval = setInterval(() => this.checkReady(), 10);\n }\n\n /** @internal */\n private checkReady() {\n if (this._popoutWindow === null) {\n throw new UnexpectedNullError('BPCR01844');\n } else {\n if (this._popoutWindow.__glInstance && this._popoutWindow.__glInstance.isInitialised) {\n this.onInitialised();\n if (this._checkReadyInterval !== undefined) {\n clearInterval(this._checkReadyInterval);\n this._checkReadyInterval = undefined;\n }\n }\n }\n }\n\n /**\n * Serialises a map of key:values to a window options string\n *\n * @param windowOptions -\n *\n * @returns serialised window options\n * @internal\n */\n private serializeWindowFeatures(windowOptions: Record): string {\n const windowOptionsString: string[] = [];\n\n for (const key in windowOptions) {\n windowOptionsString.push(key + '=' + windowOptions[key].toString());\n }\n\n return windowOptionsString.join(',');\n }\n\n /**\n * Creates the URL for the new window, including the\n * config GET parameter\n *\n * @returns URL\n * @internal\n */\n private createUrl(): string {\n const storageKey = 'gl-window-config-' + getUniqueId();\n const config = ResolvedLayoutConfig.minifyConfig(this._config);\n\n try {\n localStorage.setItem(storageKey, JSON.stringify(config));\n } catch (e) {\n throw new Error('Error while writing to localStorage ' + getErrorMessage(e));\n }\n\n const url = new URL(location.href);\n url.searchParams.set('gl-window', storageKey);\n return url.toString();\n }\n\n /**\n * Move the newly created window roughly to\n * where the component used to be.\n * @internal\n */\n private positionWindow() {\n if (this._popoutWindow === null) {\n throw new Error('BrowserPopout.positionWindow: null popoutWindow');\n } else {\n this._popoutWindow.moveTo(this._initialWindowSize.left, this._initialWindowSize.top);\n this._popoutWindow.focus();\n }\n }\n\n /**\n * Callback when the new window is opened and the GoldenLayout instance\n * within it is initialised\n * @internal\n */\n private onInitialised(): void {\n this._isInitialised = true;\n this.getGlInstance().on('popIn', () => this.popIn());\n this.emit('initialised');\n }\n\n /**\n * Invoked 50ms after the window unload event\n * @internal\n */\n private _onClose() {\n setTimeout(() => this.emit('closed'), 50);\n }\n}\n","import { Header } from './header';\n\n/** @internal */\nexport class HeaderButton {\n private _element: HTMLElement;\n private _clickEventListener = (ev: MouseEvent) => this.onClick(ev);\n private _touchStartEventListener = (ev: TouchEvent) => this.onTouchStart(ev);\n\n get element(): HTMLElement { return this._element; }\n\n constructor(private _header: Header, label: string, cssClass: string, private _pushEvent: HeaderButton.PushEvent) {\n this._element = document.createElement('div');\n this._element.classList.add(cssClass);\n this._element.title = label;\n this._header.on('destroy', () => this.destroy());\n this._element.addEventListener('click', this._clickEventListener, { passive: true });\n this._element.addEventListener('touchstart', this._touchStartEventListener, { passive: true });\n this._header.controlsContainerElement.appendChild(this._element);\n }\n\n destroy(): void {\n this._element.removeEventListener('click', this._clickEventListener);\n this._element.removeEventListener('touchstart', this._touchStartEventListener);\n this._element.parentNode?.removeChild(this._element);\n }\n\n private onClick(ev: MouseEvent) {\n this._pushEvent(ev);\n }\n\n private onTouchStart(ev: TouchEvent) {\n this._pushEvent(ev);\n }\n}\n\n/** @internal */\nexport namespace HeaderButton {\n export type PushEvent = (this: void, ev: Event) => void;\n}\n","import { DomConstants } from './dom-constants';\nimport { EventEmitter } from './event-emitter';\n\n/** @internal */\nexport class DragListener extends EventEmitter {\n private _timeout: ReturnType | undefined;\n private _allowableTargets: HTMLElement[];\n private _oDocument: Document;\n private _eBody: HTMLElement;\n private _nDelay: number;\n private _nDistance: number;\n private _nX: number;\n private _nY: number;\n private _nOriginalX: number;\n private _nOriginalY: number;\n private _dragging: boolean;\n private _pointerTracking = false;\n\n private _pointerDownEventListener = (ev: PointerEvent) => this.onPointerDown(ev);\n private _pointerMoveEventListener = (ev: PointerEvent) => this.onPointerMove(ev);\n private _pointerUpEventListener = (ev: PointerEvent) => this.onPointerUp(ev);\n\n constructor(private _eElement: HTMLElement, extraAllowableChildTargets: HTMLElement[]) {\n super();\n\n this._timeout = undefined;\n\n this._allowableTargets = [_eElement, ...extraAllowableChildTargets];\n this._oDocument = document;\n this._eBody = document.body;\n\n /**\n * The delay after which to start the drag in milliseconds\n * Do NOT make too short (previous value of 200 was not long enough for my touchpad)\n * Should generally rely on the mouse move to start drag. Not this delay.\n */\n this._nDelay = 1800;\n\n /**\n * The distance the mouse needs to be moved to qualify as a drag\n * Previous comment: works better with delay only\n * ???\n * Probably somehow needs tuning for different devices\n */\n this._nDistance = 10;\n\n this._nX = 0;\n this._nY = 0;\n\n this._nOriginalX = 0;\n this._nOriginalY = 0;\n\n this._dragging = false;\n\n this._eElement.addEventListener('pointerdown', this._pointerDownEventListener, { passive: true });\n }\n\n destroy(): void {\n this.checkRemovePointerTrackingEventListeners();\n\n this._eElement.removeEventListener('pointerdown', this._pointerDownEventListener);\n }\n\n cancelDrag(): void {\n this.processDragStop(undefined);\n }\n\n private onPointerDown(oEvent: PointerEvent) {\n if (this._allowableTargets.includes(oEvent.target as HTMLElement) && oEvent.isPrimary) {\n const coordinates = this.getPointerCoordinates(oEvent);\n this.processPointerDown(coordinates);\n }\n }\n\n private processPointerDown(coordinates: DragListener.PointerCoordinates) {\n this._nOriginalX = coordinates.x;\n this._nOriginalY = coordinates.y;\n\n this._oDocument.addEventListener('pointermove', this._pointerMoveEventListener);\n this._oDocument.addEventListener('pointerup', this._pointerUpEventListener, { passive: true });\n this._pointerTracking = true;\n\n this._timeout = setTimeout(\n () => {\n try {\n this.startDrag()\n }\n catch (err) {\n console.error(err);\n throw err;\n }\n }\n , this._nDelay);\n }\n\n private onPointerMove(oEvent: PointerEvent) {\n if (this._pointerTracking) {\n this.processDragMove(oEvent);\n oEvent.preventDefault();\n }\n }\n\n private processDragMove(dragEvent: PointerEvent) {\n this._nX = dragEvent.pageX - this._nOriginalX;\n this._nY = dragEvent.pageY - this._nOriginalY;\n\n if (this._dragging === false) {\n if (\n Math.abs(this._nX) > this._nDistance ||\n Math.abs(this._nY) > this._nDistance\n ) {\n this.startDrag();\n }\n }\n\n if (this._dragging) {\n this.emit('drag', this._nX, this._nY, dragEvent);\n }\n }\n\n private onPointerUp(oEvent: PointerEvent) {\n this.processDragStop(oEvent);\n }\n\n private processDragStop(dragEvent?: PointerEvent) {\n if (this._timeout !== undefined) {\n clearTimeout(this._timeout);\n this._timeout = undefined;\n }\n\n this.checkRemovePointerTrackingEventListeners();\n \n if (this._dragging === true) {\n this._eBody.classList.remove(DomConstants.ClassName.Dragging);\n this._eElement.classList.remove(DomConstants.ClassName.Dragging);\n this._oDocument.querySelector('iframe')?.style.setProperty('pointer-events', '');\n this._dragging = false;\n this.emit('dragStop', dragEvent);\n }\n }\n\n private checkRemovePointerTrackingEventListeners(): void {\n if (this._pointerTracking) {\n this._oDocument.removeEventListener('pointermove', this._pointerMoveEventListener);\n this._oDocument.removeEventListener('pointerup', this._pointerUpEventListener);\n this._pointerTracking = false;\n } \n }\n\n private startDrag() {\n if (this._timeout !== undefined) {\n clearTimeout(this._timeout);\n this._timeout = undefined;\n }\n this._dragging = true;\n this._eBody.classList.add(DomConstants.ClassName.Dragging);\n this._eElement.classList.add(DomConstants.ClassName.Dragging);\n this._oDocument.querySelector('iframe')?.style.setProperty('pointer-events', 'none');\n this.emit('dragStart', this._nOriginalX, this._nOriginalY);\n }\n\n private getPointerCoordinates(event: PointerEvent) {\n const result: DragListener.PointerCoordinates = {\n x: event.pageX,\n y: event.pageY\n };\n return result;\n }\n\n}\n\n/** @internal */\nexport namespace DragListener {\n export interface PointerCoordinates {\n x: number,\n y: number,\n }\n}","import { UnexpectedUndefinedError } from '../errors/internal-error';\nimport { ComponentItem } from '../items/component-item';\nimport { LayoutManager } from '../layout-manager';\nimport { DomConstants } from '../utils/dom-constants';\nimport { DragListener } from '../utils/drag-listener';\n\n/**\n * Represents an individual tab within a Stack's header\n * @public\n */\nexport class Tab {\n /** @internal */\n private readonly _element: HTMLDivElement;\n /** @internal */\n private readonly _titleElement: HTMLSpanElement;\n /** @internal */\n private readonly _closeElement: HTMLDivElement | undefined;\n\n /** @internal */\n private _dragListener: DragListener | undefined;\n /** @internal */\n private _isActive = false;\n\n /** @internal */\n private readonly _tabClickListener = (ev: MouseEvent) => this.onTabClickDown(ev);\n /** @internal */\n private readonly _tabTouchStartListener = (ev: TouchEvent) => this.onTabTouchStart(ev);\n /** @internal */\n private readonly _closeClickListener = () => this.onCloseClick();\n /** @internal */\n private readonly _closeTouchStartListener = () => this.onCloseTouchStart();\n // /** @internal */\n // private readonly _closeMouseDownListener = () => this.onCloseMousedown();\n /** @internal */\n private readonly _dragStartListener = (x: number, y: number) => this.onDragStart(x, y);\n /** @internal */\n private readonly _contentItemDestroyListener = () => this.onContentItemDestroy();\n /** @internal */\n private readonly _tabTitleChangedListener = (title: string) => this.setTitle(title)\n\n get isActive(): boolean { return this._isActive; }\n // get header(): Header { return this._header; }\n get componentItem(): ComponentItem { return this._componentItem; }\n /** @deprecated use {@link (Tab:class).componentItem} */\n get contentItem(): ComponentItem { return this._componentItem; }\n get element(): HTMLElement { return this._element; }\n get titleElement(): HTMLElement { return this._titleElement; }\n get closeElement(): HTMLElement | undefined { return this._closeElement; }\n get reorderEnabled(): boolean { return this._dragListener !== undefined; }\n set reorderEnabled(value: boolean) {\n if (value !== this.reorderEnabled) {\n if (value) {\n this.enableReorder();\n } else {\n this.disableReorder();\n }\n }\n }\n\n /** @internal */\n constructor(\n /** @internal */\n private readonly _layoutManager: LayoutManager,\n /** @internal */\n private _componentItem: ComponentItem,\n /** @internal */\n private _closeEvent: Tab.CloseEvent | undefined,\n /** @internal */\n private _focusEvent: Tab.FocusEvent | undefined,\n /** @internal */\n private _dragStartEvent: Tab.DragStartEvent | undefined\n ) {\n this._element = document.createElement('div');\n this._element.classList.add(DomConstants.ClassName.Tab);\n this._titleElement = document.createElement('span'); \n this._titleElement.classList.add(DomConstants.ClassName.Title);\n this._closeElement = document.createElement('div'); \n this._closeElement.classList.add(DomConstants.ClassName.CloseTab);\n this._element.appendChild(this._titleElement);\n this._element.appendChild(this._closeElement);\n\n if (_componentItem.isClosable) {\n this._closeElement.style.display = '';\n } else {\n this._closeElement.style.display = 'none';\n }\n\n this.setTitle(_componentItem.title);\n this._componentItem.on('titleChanged', this._tabTitleChangedListener);\n\n const reorderEnabled = _componentItem.reorderEnabled ?? this._layoutManager.layoutConfig.settings.reorderEnabled;\n\n if (reorderEnabled) {\n this.enableReorder();\n }\n\n this._element.addEventListener('click', this._tabClickListener, { passive: true });\n this._element.addEventListener('touchstart', this._tabTouchStartListener, { passive: true });\n\n if (this._componentItem.isClosable) {\n this._closeElement.addEventListener('click', this._closeClickListener, { passive: true });\n this._closeElement.addEventListener('touchstart', this._closeTouchStartListener, { passive: true });\n // this._closeElement.addEventListener('mousedown', this._closeMouseDownListener, { passive: true });\n } else {\n this._closeElement.remove();\n this._closeElement = undefined;\n }\n\n this._componentItem.setTab(this);\n this._layoutManager.emit('tabCreated', this);\n }\n\n /**\n * Sets the tab's title to the provided string and sets\n * its title attribute to a pure text representation (without\n * html tags) of the same string.\n */\n setTitle(title: string): void {\n this._titleElement.innerText = title;\n this._element.title = title;\n }\n\n /**\n * Sets this tab's active state. To programmatically\n * switch tabs, use Stack.setActiveComponentItem( item ) instead.\n */\n setActive(isActive: boolean): void {\n if (isActive === this._isActive) {\n return;\n }\n this._isActive = isActive;\n\n if (isActive) {\n this._element.classList.add(DomConstants.ClassName.Active);\n } else {\n this._element.classList.remove(DomConstants.ClassName.Active);\n }\n }\n\n /**\n * Destroys the tab\n * @internal\n */\n destroy(): void {\n this._closeEvent = undefined;\n this._focusEvent = undefined;\n this._dragStartEvent = undefined;\n this._element.removeEventListener('click', this._tabClickListener);\n this._element.removeEventListener('touchstart', this._tabTouchStartListener);\n this._closeElement?.removeEventListener('click', this._closeClickListener);\n this._closeElement?.removeEventListener('touchstart', this._closeTouchStartListener);\n // this._closeElement?.removeEventListener('mousedown', this._closeMouseDownListener);\n this._componentItem.off('titleChanged', this._tabTitleChangedListener);\n if (this.reorderEnabled) {\n this.disableReorder();\n }\n this._element.remove();\n }\n\n /** @internal */\n setBlurred(): void {\n this._element.classList.remove(DomConstants.ClassName.Focused);\n this._titleElement.classList.remove(DomConstants.ClassName.Focused);\n }\n\n /** @internal */\n setFocused(): void {\n this._element.classList.add(DomConstants.ClassName.Focused);\n this._titleElement.classList.add(DomConstants.ClassName.Focused);\n }\n\n /**\n * Callback for the DragListener\n * @param x - The tabs absolute x position\n * @param y - The tabs absolute y position\n * @internal\n */\n private onDragStart(x: number, y: number): void {\n if (this._dragListener === undefined) {\n throw new UnexpectedUndefinedError('TODSDLU10093');\n } else {\n if (this._dragStartEvent === undefined) {\n throw new UnexpectedUndefinedError('TODS23309');\n } else {\n this._dragStartEvent(x, y, this._dragListener, this.componentItem);\n }\n }\n\n }\n\n /** @internal */\n private onContentItemDestroy() {\n if (this._dragListener !== undefined) {\n this._dragListener.destroy();\n this._dragListener = undefined;\n }\n }\n\n /**\n * Callback when the tab is clicked\n * @internal\n */\n private onTabClickDown(event: MouseEvent) {\n const target = event.target;\n if (target === this._element || target === this._titleElement) {\n // left mouse button\n if (event.button === 0) {\n // event.stopPropagation();\n this.notifyFocus();\n\n // middle mouse button\n } else if (event.button === 1 && this._componentItem.isClosable) {\n // event.stopPropagation();\n this.notifyClose();\n }\n }\n }\n\n /** @internal */\n private onTabTouchStart(event: TouchEvent) {\n if (event.target === this._element) {\n this.notifyFocus();\n }\n }\n\n /**\n * Callback when the tab's close button is clicked\n * @internal\n */\n private onCloseClick() {\n this.notifyClose();\n }\n\n /** @internal */\n private onCloseTouchStart() {\n this.notifyClose();\n }\n\n /**\n * Callback to capture tab close button mousedown\n * to prevent tab from activating.\n * @internal\n */\n // private onCloseMousedown(): void {\n // // event.stopPropagation();\n // }\n\n /** @internal */\n private notifyClose() {\n if (this._closeEvent === undefined) {\n throw new UnexpectedUndefinedError('TNC15007');\n } else {\n this._closeEvent(this._componentItem);\n }\n }\n\n /** @internal */\n private notifyFocus() {\n if (this._focusEvent === undefined) {\n throw new UnexpectedUndefinedError('TNA15007');\n } else {\n this._focusEvent(this._componentItem);\n }\n }\n\n /** @internal */\n private enableReorder() {\n this._dragListener = new DragListener(this._element, [this._titleElement]);\n this._dragListener.on('dragStart', this._dragStartListener);\n this._componentItem.on('destroy', this._contentItemDestroyListener);\n }\n\n /** @internal */\n private disableReorder() {\n if (this._dragListener === undefined) {\n throw new UnexpectedUndefinedError('TDR87745');\n } else {\n this._componentItem.off('destroy', this._contentItemDestroyListener);\n this._dragListener.off('dragStart', this._dragStartListener);\n this._dragListener = undefined;\n }\n }\n}\n\n/** @public */\nexport namespace Tab {\n /** @internal */\n export type CloseEvent = (componentItem: ComponentItem) => void;\n /** @internal */\n export type FocusEvent = (componentItem: ComponentItem) => void;\n /** @internal */\n export type DragStartEvent = (x: number, y: number, dragListener: DragListener, componentItem: ComponentItem) => void;\n}\n","import { AssertError } from '../errors/internal-error';\nimport { ComponentItem } from '../items/component-item';\nimport { LayoutManager } from '../layout-manager';\nimport { DomConstants } from '../utils/dom-constants';\nimport { DragListener } from '../utils/drag-listener';\nimport { numberToPixels, pixelsToNumber } from '../utils/utils';\nimport { Tab } from './tab';\n\n/** @internal */\nexport class TabsContainer {\n // There is one tab per ComponentItem in stack. However they may not be ordered the same\n private readonly _tabs: Tab[] = [];\n\n private readonly _dropdownElement: HTMLElement;\n private readonly _element: HTMLElement;\n private _lastVisibleTabIndex = -1;\n private _dropdownActive = false;\n\n get tabs(): Tab[] { return this._tabs; }\n get tabCount(): number { return this._tabs.length; }\n get lastVisibleTabIndex(): number { return this._lastVisibleTabIndex; }\n\n get element(): HTMLElement { return this._element; }\n get dropdownElement(): HTMLElement { return this._dropdownElement; }\n get dropdownActive(): boolean { return this._dropdownActive; }\n\n constructor(private _layoutManager: LayoutManager,\n private _componentRemoveEvent: TabsContainer.ComponentItemRemoveEvent,\n private _componentFocusEvent: TabsContainer.ComponentItemFocusEvent,\n private _componentDragStartEvent: TabsContainer.ComponentItemDragStartEvent,\n private _dropdownActiveChangedEvent: TabsContainer.DropdownActiveChangedEvent,\n ) {\n this._element = document.createElement('section');\n this._element.classList.add(DomConstants.ClassName.Tabs);\n\n this._dropdownElement = document.createElement('section');\n this._dropdownElement.classList.add(DomConstants.ClassName.TabDropdownList);\n this._dropdownElement.style.display = 'none';\n }\n\n destroy(): void {\n for (let i = 0; i < this._tabs.length; i++) {\n this._tabs[i].destroy();\n }\n }\n\n /**\n * Creates a new tab and associates it with a contentItem\n * @param index - The position of the tab\n */\n createTab(componentItem: ComponentItem, index: number): void {\n //If there's already a tab relating to the\n //content item, don't do anything\n for (let i = 0; i < this._tabs.length; i++) {\n if (this._tabs[i].componentItem === componentItem) {\n return;\n }\n }\n\n const tab = new Tab(this._layoutManager,\n componentItem,\n (item) => this.handleTabCloseEvent(item),\n (item) => this.handleTabFocusEvent(item),\n (x, y, dragListener, item) => this.handleTabDragStartEvent(x, y, dragListener, item));\n\n if (index === undefined) {\n index = this._tabs.length;\n }\n\n this._tabs.splice(index, 0, tab);\n\n if (index < this._element.childNodes.length) {\n this._element.insertBefore(tab.element, this._element.childNodes[index]);\n } else {\n this._element.appendChild(tab.element);\n }\n }\n\n removeTab(componentItem: ComponentItem): void {\n // componentItem cannot be ActiveComponentItem\n for (let i = 0; i < this._tabs.length; i++) {\n if (this._tabs[i].componentItem === componentItem) {\n const tab = this._tabs[i];\n tab.destroy();\n this._tabs.splice(i, 1);\n return;\n }\n }\n\n throw new Error('contentItem is not controlled by this header');\n }\n\n processActiveComponentChanged(newActiveComponentItem: ComponentItem): void {\n let activeIndex = -1;\n for (let i = 0; i < this._tabs.length; i++) {\n const isActive = this._tabs[i].componentItem === newActiveComponentItem;\n this._tabs[i].setActive(isActive);\n if (isActive) {\n activeIndex = i;\n }\n }\n\n if (activeIndex < 0) {\n throw new AssertError('HSACI56632');\n } else {\n if (this._layoutManager.layoutConfig.settings.reorderOnTabMenuClick) {\n /**\n * If the tab selected was in the dropdown, move everything down one to make way for this one to be the first.\n * This will make sure the most used tabs stay visible.\n */\n if (this._lastVisibleTabIndex !== -1 && activeIndex > this._lastVisibleTabIndex) {\n const activeTab = this._tabs[activeIndex];\n for (let j = activeIndex; j > 0; j--) {\n this._tabs[j] = this._tabs[j - 1];\n }\n this._tabs[0] = activeTab;\n\n // updateTabSizes will always be called after this and it will reposition tab elements\n }\n }\n }\n }\n\n /**\n * Pushes the tabs to the tab dropdown if the available space is not sufficient\n */\n updateTabSizes(availableWidth: number, activeComponentItem: ComponentItem | undefined): void {\n let dropDownActive = false;\n const success = this.tryUpdateTabSizes(dropDownActive, availableWidth, activeComponentItem);\n if (!success) {\n dropDownActive = true;\n // this will always succeed\n this.tryUpdateTabSizes(dropDownActive, availableWidth, activeComponentItem)\n }\n\n if (dropDownActive !== this._dropdownActive) {\n this._dropdownActive = dropDownActive;\n this._dropdownActiveChangedEvent();\n }\n }\n\n tryUpdateTabSizes(dropdownActive: boolean, availableWidth: number, activeComponentItem: ComponentItem | undefined): boolean {\n if (this._tabs.length > 0) {\n if (activeComponentItem === undefined) {\n throw new Error('non-empty tabs must have active component item');\n }\n\n let cumulativeTabWidth = 0;\n let tabOverlapAllowanceExceeded = false;\n const tabOverlapAllowance = this._layoutManager.layoutConfig.settings.tabOverlapAllowance;\n const activeIndex = this._tabs.indexOf(activeComponentItem.tab);\n const activeTab = this._tabs[activeIndex];\n this._lastVisibleTabIndex = -1;\n\n for (let i = 0; i < this._tabs.length; i++) {\n const tabElement = this._tabs[i].element;\n\n //Put the tab in the tabContainer so its true width can be checked\n if (tabElement.parentElement !== this._element) {\n this._element.appendChild(tabElement);\n }\n const tabMarginRightPixels = getComputedStyle(activeTab.element).marginRight;\n const tabMarginRight = pixelsToNumber(tabMarginRightPixels);\n const tabWidth = tabElement.offsetWidth + tabMarginRight;\n\n cumulativeTabWidth += tabWidth;\n\n //Include the active tab's width if it isn't already\n //This is to ensure there is room to show the active tab\n let visibleTabWidth = 0;\n if (activeIndex <= i) {\n visibleTabWidth = cumulativeTabWidth;\n } else {\n const activeTabMarginRightPixels = getComputedStyle(activeTab.element).marginRight;\n const activeTabMarginRight = pixelsToNumber(activeTabMarginRightPixels);\n visibleTabWidth = cumulativeTabWidth + activeTab.element.offsetWidth + activeTabMarginRight;\n }\n\n // If the tabs won't fit, check the overlap allowance.\n if (visibleTabWidth > availableWidth) {\n\n //Once allowance is exceeded, all remaining tabs go to menu.\n if (!tabOverlapAllowanceExceeded) {\n\n //No overlap for first tab or active tab\n //Overlap spreads among non-active, non-first tabs\n let overlap: number;\n if (activeIndex > 0 && activeIndex <= i) {\n overlap = (visibleTabWidth - availableWidth) / (i - 1);\n } else {\n overlap = (visibleTabWidth - availableWidth) / i;\n }\n\n //Check overlap against allowance.\n if (overlap < tabOverlapAllowance) {\n for (let j = 0; j <= i; j++) {\n const marginLeft = (j !== activeIndex && j !== 0) ? '-' + numberToPixels(overlap) : '';\n this._tabs[j].element.style.zIndex = numberToPixels(i - j);\n this._tabs[j].element.style.marginLeft = marginLeft;\n }\n this._lastVisibleTabIndex = i;\n if (tabElement.parentElement !== this._element) {\n this._element.appendChild(tabElement);\n }\n } else {\n tabOverlapAllowanceExceeded = true;\n }\n\n } else if (i === activeIndex) {\n //Active tab should show even if allowance exceeded. (We left room.)\n tabElement.style.zIndex = 'auto';\n tabElement.style.marginLeft = '';\n if (tabElement.parentElement !== this._element) {\n this._element.appendChild(tabElement);\n }\n }\n\n if (tabOverlapAllowanceExceeded && i !== activeIndex) {\n if (dropdownActive) {\n //Tab menu already shown, so we just add to it.\n tabElement.style.zIndex = 'auto';\n tabElement.style.marginLeft = '';\n\n if (tabElement.parentElement !== this._dropdownElement) {\n this._dropdownElement.appendChild(tabElement);\n }\n } else {\n //We now know the tab menu must be shown, so we have to recalculate everything.\n return false;\n }\n }\n\n } else {\n this._lastVisibleTabIndex = i;\n tabElement.style.zIndex = 'auto';\n tabElement.style.marginLeft = '';\n if (tabElement.parentElement !== this._element) {\n this._element.appendChild(tabElement);\n }\n }\n }\n }\n\n return true;\n }\n\n /**\n * Shows drop down for additional tabs when there are too many to display.\n */\n showAdditionalTabsDropdown(): void {\n this._dropdownElement.style.display = '';\n }\n\n /**\n * Hides drop down for additional tabs when there are too many to display.\n */\n hideAdditionalTabsDropdown(): void {\n this._dropdownElement.style.display = 'none';\n }\n\n private handleTabCloseEvent(componentItem: ComponentItem) {\n this._componentRemoveEvent(componentItem);\n }\n\n private handleTabFocusEvent(componentItem: ComponentItem) {\n this._componentFocusEvent(componentItem);\n }\n\n private handleTabDragStartEvent(x: number, y: number, dragListener: DragListener, componentItem: ComponentItem) {\n this._componentDragStartEvent(x, y, dragListener, componentItem);\n }\n\n}\n\n/** @internal */\nexport namespace TabsContainer {\n export type ComponentItemRemoveEvent = (this: void, componentItem: ComponentItem) => void;\n export type ComponentItemFocusEvent = (this: void, componentItem: ComponentItem) => void;\n export type ComponentItemDragStartEvent = (this: void, x: number, y: number, dragListener: DragListener, componentItem: ComponentItem) => void;\n export type DropdownActiveChangedEvent = (this: void) => void;\n}\n","import { UnexpectedUndefinedError } from '../errors/internal-error';\nimport { ComponentItem } from '../items/component-item';\nimport { Stack } from '../items/stack';\nimport { LayoutManager } from '../layout-manager';\nimport { DomConstants } from '../utils/dom-constants';\nimport { DragListener } from '../utils/drag-listener';\nimport { EventEmitter } from '../utils/event-emitter';\nimport { Side } from '../utils/types';\nimport { numberToPixels, setElementDisplayVisibility } from '../utils/utils';\nimport { HeaderButton } from './header-button';\nimport { Tab } from './tab';\nimport { TabsContainer } from './tabs-container';\n\n/**\n * This class represents a header above a Stack ContentItem.\n * @public\n */\nexport class Header extends EventEmitter {\n /** @internal */\n private readonly _tabsContainer: TabsContainer;\n /** @internal */\n private readonly _element: HTMLElement;\n /** @internal */\n private readonly _controlsContainerElement: HTMLElement;\n\n /** @internal */\n private readonly _show: boolean;\n /** @internal */\n private readonly _popoutEnabled: boolean;\n /** @internal */\n private readonly _popoutLabel: string;\n /** @internal */\n private readonly _maximiseEnabled: boolean;\n /** @internal */\n private readonly _maximiseLabel: string;\n /** @internal */\n private readonly _minimiseEnabled: boolean;\n /** @internal */\n private readonly _minimiseLabel: string;\n /** @internal */\n private readonly _closeEnabled: boolean;\n /** @internal */\n private readonly _closeLabel: string;\n /** @internal */\n private readonly _tabDropdownEnabled: boolean;\n /** @internal */\n private readonly _tabDropdownLabel: string;\n\n /** @internal */\n private readonly _tabControlOffset: number;\n\n /** @internal */\n private readonly _clickListener = (ev: MouseEvent) => this.onClick(ev);\n /** @internal */\n private readonly _touchStartListener = (ev: TouchEvent) => this.onTouchStart(ev);\n /** @internal */\n private readonly _documentMouseUpListener: (this: void) => void;\n\n /** @internal */\n private _rowColumnClosable = true;\n /** @internal */\n private _canRemoveComponent: boolean;\n /** @internal */\n private _side: Side;\n /** @internal */\n private _leftRightSided: boolean;\n /** @internal */\n private readonly _closeButton: HeaderButton | null = null;\n /** @internal */\n private readonly _popoutButton: HeaderButton | null = null;\n /** @internal */\n private readonly _tabDropdownButton: HeaderButton;\n /** @internal */\n private readonly _maximiseButton: HeaderButton | undefined;\n // /** @internal */\n // private _activeComponentItem: ComponentItem | null = null; // only used to identify active tab\n\n get show(): boolean { return this._show; }\n get side(): Side { return this._side; }\n get leftRightSided(): boolean { return this._leftRightSided; }\n\n get layoutManager(): LayoutManager { return this._layoutManager; }\n get parent(): Stack { return this._parent; }\n get tabs(): Tab[] { return this._tabsContainer.tabs; }\n get lastVisibleTabIndex(): number { return this._tabsContainer.lastVisibleTabIndex; }\n\n get element(): HTMLElement { return this._element; }\n get tabsContainerElement(): HTMLElement { return this._tabsContainer.element; }\n get controlsContainerElement(): HTMLElement { return this._controlsContainerElement; }\n\n /** @internal */\n constructor(\n /** @internal */\n private _layoutManager: LayoutManager,\n /** @internal */\n private _parent: Stack,\n settings: Header.Settings,\n /** @internal */\n private readonly _configClosable: boolean,\n /** @internal */\n private _getActiveComponentItemEvent: Header.GetActiveComponentItemEvent,\n closeEvent: Header.CloseEvent,\n /** @internal */\n private _popoutEvent: Header.PopoutEvent | undefined,\n /** @internal */\n private _maximiseToggleEvent: Header.MaximiseToggleEvent | undefined,\n /** @internal */\n private _clickEvent: Header.ClickEvent | undefined,\n /** @internal */\n private _touchStartEvent: Header.TouchStartEvent | undefined,\n /** @internal */\n private _componentRemoveEvent: Header.ComponentRemoveEvent | undefined,\n /** @internal */\n private _componentFocusEvent: Header.ComponentFocusEvent | undefined,\n /** @internal */\n private _componentDragStartEvent: Header.ComponentDragStartEvent | undefined,\n ) {\n super();\n\n this._tabsContainer = new TabsContainer(this._layoutManager,\n (item) => this.handleTabInitiatedComponentRemoveEvent(item),\n (item) => this.handleTabInitiatedComponentFocusEvent(item),\n (x, y, dragListener, item) => this.handleTabInitiatedDragStartEvent(x, y, dragListener, item),\n () => this.processTabDropdownActiveChanged(),\n );\n\n this._show = settings.show;\n this._popoutEnabled = settings.popoutEnabled;\n this._popoutLabel = settings.popoutLabel;\n this._maximiseEnabled = settings.maximiseEnabled;\n this._maximiseLabel = settings.maximiseLabel;\n this._minimiseEnabled = settings.minimiseEnabled;\n this._minimiseLabel = settings.minimiseLabel;\n this._closeEnabled = settings.closeEnabled;\n this._closeLabel = settings.closeLabel;\n this._tabDropdownEnabled = settings.tabDropdownEnabled;\n this._tabDropdownLabel = settings.tabDropdownLabel;\n this.setSide(settings.side);\n\n this._canRemoveComponent = this._configClosable;\n\n this._element = document.createElement('section');\n this._element.classList.add(DomConstants.ClassName.Header);\n this._controlsContainerElement = document.createElement('section');\n this._controlsContainerElement.classList.add(DomConstants.ClassName.Controls);\n this._element.appendChild(this._tabsContainer.element);\n this._element.appendChild(this._controlsContainerElement);\n this._element.appendChild(this._tabsContainer.dropdownElement);\n\n this._element.addEventListener('click', this._clickListener, { passive: true });\n this._element.addEventListener('touchstart', this._touchStartListener, { passive: true });\n\n this._documentMouseUpListener = () => this._tabsContainer.hideAdditionalTabsDropdown()\n globalThis.document.addEventListener('mouseup', this._documentMouseUpListener, { passive: true });\n\n this._tabControlOffset = this._layoutManager.layoutConfig.settings.tabControlOffset;\n\n if (this._tabDropdownEnabled) {\n this._tabDropdownButton = new HeaderButton(this, this._tabDropdownLabel, DomConstants.ClassName.TabDropdown,\n () => this._tabsContainer.showAdditionalTabsDropdown()\n );\n }\n\n if (this._popoutEnabled) {\n this._popoutButton = new HeaderButton(this, this._popoutLabel, DomConstants.ClassName.Popout, () => this.handleButtonPopoutEvent());\n }\n\n /**\n * Maximise control - set the component to the full size of the layout\n */\n if (this._maximiseEnabled) {\n this._maximiseButton = new HeaderButton(this, this._maximiseLabel, DomConstants.ClassName.Maximise,\n (ev) => this.handleButtonMaximiseToggleEvent(ev)\n );\n }\n\n /**\n * Close button\n */\n if (this._configClosable) {\n this._closeButton = new HeaderButton(this, this._closeLabel, DomConstants.ClassName.Close, () => closeEvent());\n }\n\n this.processTabDropdownActiveChanged();\n }\n\n /**\n * Destroys the entire header\n * @internal\n */\n destroy(): void {\n this.emit('destroy');\n\n this._popoutEvent = undefined;\n this._maximiseToggleEvent = undefined;\n this._clickEvent = undefined;\n this._touchStartEvent = undefined;\n this._componentRemoveEvent = undefined;\n this._componentFocusEvent = undefined;\n this._componentDragStartEvent = undefined;\n\n this._tabsContainer.destroy();\n\n globalThis.document.removeEventListener('mouseup', this._documentMouseUpListener);\n this._element.remove();\n }\n\n /**\n * Creates a new tab and associates it with a contentItem\n * @param index - The position of the tab\n * @internal\n */\n createTab(componentItem: ComponentItem, index: number): void {\n this._tabsContainer.createTab(componentItem, index);\n }\n\n /**\n * Finds a tab based on the contentItem its associated with and removes it.\n * Cannot remove tab if it has the active ComponentItem\n * @internal\n */\n removeTab(componentItem: ComponentItem): void {\n this._tabsContainer.removeTab(componentItem);\n }\n\n /** @internal */\n processActiveComponentChanged(newActiveComponentItem: ComponentItem): void {\n this._tabsContainer.processActiveComponentChanged(newActiveComponentItem);\n this.updateTabSizes();\n }\n\n /** @internal */\n setSide(value: Side): void {\n this._side = value;\n this._leftRightSided = [Side.right, Side.left].includes(this._side);\n }\n\n /**\n * Programmatically set closability.\n * @param value - Whether to enable/disable closability.\n * @returns Whether the action was successful\n * @internal\n */\n setRowColumnClosable(value: boolean): void {\n this._rowColumnClosable = value;\n this.updateClosability();\n }\n\n /**\n * Updates the header's closability. If a stack/header is able\n * to close, but has a non closable component added to it, the stack is no\n * longer closable until all components are closable.\n * @internal\n */\n updateClosability(): void {\n let isClosable: boolean;\n if (!this._configClosable) {\n isClosable = false;\n } else {\n if (!this._rowColumnClosable) {\n isClosable = false;\n } else {\n isClosable = true;\n const len = this.tabs.length;\n for (let i = 0; i < len; i++) {\n const tab = this._tabsContainer.tabs[i];\n const item = tab.componentItem;\n if (!item.isClosable) {\n isClosable = false;\n break;\n }\n }\n }\n }\n\n if (this._closeButton !== null) {\n setElementDisplayVisibility(this._closeButton.element, isClosable);\n }\n if (this._popoutButton !== null) {\n setElementDisplayVisibility(this._popoutButton.element, isClosable);\n }\n\n this._canRemoveComponent = isClosable || this._tabsContainer.tabCount > 1;\n }\n\n /** @internal */\n applyFocusedValue(value: boolean): void {\n if (value) {\n this._element.classList.add(DomConstants.ClassName.Focused);\n } else {\n this._element.classList.remove(DomConstants.ClassName.Focused);\n }\n }\n\n /** @internal */\n processMaximised(): void {\n if (this._maximiseButton === undefined) {\n throw new UnexpectedUndefinedError('HPMAX16997');\n } else {\n this._maximiseButton.element.setAttribute('title', this._minimiseLabel);\n }\n }\n\n /** @internal */\n processMinimised(): void {\n if (this._maximiseButton === undefined) {\n throw new UnexpectedUndefinedError('HPMIN16997');\n } else {\n this._maximiseButton.element.setAttribute('title', this._maximiseLabel);\n }\n }\n\n /**\n * Pushes the tabs to the tab dropdown if the available space is not sufficient\n * @internal\n */\n updateTabSizes(): void {\n if (this._tabsContainer.tabCount > 0) {\n const headerHeight = this._show ? this._layoutManager.layoutConfig.dimensions.headerHeight : 0;\n\n if (this._leftRightSided) {\n this._element.style.height = '';\n this._element.style.width = numberToPixels(headerHeight);\n } else {\n this._element.style.width = '';\n this._element.style.height = numberToPixels(headerHeight);\n }\n let availableWidth: number;\n if (this._leftRightSided) {\n availableWidth = this._element.offsetHeight - this._controlsContainerElement.offsetHeight - this._tabControlOffset;\n } else {\n availableWidth = this._element.offsetWidth - this._controlsContainerElement.offsetWidth - this._tabControlOffset;\n }\n\n this._tabsContainer.updateTabSizes(availableWidth, this._getActiveComponentItemEvent());\n }\n }\n\n /** @internal */\n private handleTabInitiatedComponentRemoveEvent(componentItem: ComponentItem) {\n if (this._canRemoveComponent) {\n if (this._componentRemoveEvent === undefined) {\n throw new UnexpectedUndefinedError('HHTCE22294');\n } else {\n this._componentRemoveEvent(componentItem);\n }\n }\n }\n\n /** @internal */\n private handleTabInitiatedComponentFocusEvent(componentItem: ComponentItem) {\n if (this._componentFocusEvent === undefined) {\n throw new UnexpectedUndefinedError('HHTAE22294');\n } else {\n this._componentFocusEvent(componentItem);\n }\n }\n\n /** @internal */\n private handleTabInitiatedDragStartEvent(x: number, y: number, dragListener: DragListener, componentItem: ComponentItem) {\n if (!this._canRemoveComponent) {\n dragListener.cancelDrag();\n } else {\n if (this._componentDragStartEvent === undefined) {\n throw new UnexpectedUndefinedError('HHTDSE22294');\n } else {\n this._componentDragStartEvent(x, y, dragListener, componentItem);\n }\n }\n }\n\n /** @internal */\n private processTabDropdownActiveChanged() {\n if (this._tabDropdownButton !== undefined) {\n setElementDisplayVisibility(this._tabDropdownButton.element, this._tabsContainer.dropdownActive);\n }\n }\n\n /** @internal */\n private handleButtonPopoutEvent() {\n if (this._layoutManager.layoutConfig.settings.popoutWholeStack) {\n if (this._popoutEvent === undefined) {\n throw new UnexpectedUndefinedError('HHBPOE17834');\n } else {\n this._popoutEvent();\n }\n } else {\n const activeComponentItem = this._getActiveComponentItemEvent();\n if (activeComponentItem) {\n activeComponentItem.popout();\n }\n // else: if the stack is empty there won't be an active item (and nothing to popout)\n }\n }\n\n /** @internal */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n private handleButtonMaximiseToggleEvent(ev: Event) {\n if (this._maximiseToggleEvent === undefined) {\n throw new UnexpectedUndefinedError('HHBMTE16834');\n } else {\n this._maximiseToggleEvent();\n }\n }\n\n /**\n * Invoked when the header's background is clicked (not it's tabs or controls)\n * @internal\n */\n private onClick(event: MouseEvent) {\n if (event.target === this._element) {\n this.notifyClick(event);\n }\n }\n\n /**\n * Invoked when the header's background is touched (not it's tabs or controls)\n * @internal\n */\n private onTouchStart(event: TouchEvent) {\n if (event.target === this._element) {\n this.notifyTouchStart(event);\n }\n }\n\n /** @internal */\n private notifyClick(ev: MouseEvent) {\n if (this._clickEvent === undefined) {\n throw new UnexpectedUndefinedError('HNHC46834');\n } else {\n this._clickEvent(ev);\n }\n }\n\n /** @internal */\n private notifyTouchStart(ev: TouchEvent) {\n if (this._touchStartEvent === undefined) {\n throw new UnexpectedUndefinedError('HNHTS46834');\n } else {\n this._touchStartEvent(ev);\n }\n }\n}\n\n/** @public */\nexport namespace Header {\n /** @internal */\n export type GetActiveComponentItemEvent = (this: void) => ComponentItem | undefined;\n /** @internal */\n export type CloseEvent = (this: void) => void;\n /** @internal */\n export type PopoutEvent = (this: void) => void;\n /** @internal */\n export type MaximiseToggleEvent = (this: void) => void;\n /** @internal */\n export type ClickEvent = (this: void, ev: MouseEvent) => void;\n /** @internal */\n export type TouchStartEvent = (this: void, ev: TouchEvent) => void;\n /** @internal */\n export type ComponentRemoveEvent = (this: void, componentItem: ComponentItem) => void;\n /** @internal */\n export type ComponentFocusEvent = (this: void, componentItem: ComponentItem) => void;\n /** @internal */\n export type ComponentDragStartEvent = (this: void, x: number, y: number, dragListener: DragListener, componentItem: ComponentItem) => void;\n /** @internal */\n export type StateChangedEvent = (this: void) => void;\n\n /** @internal */\n export interface Settings {\n show: boolean;\n side: Side;\n popoutEnabled: boolean;\n popoutLabel: string;\n maximiseEnabled: boolean;\n maximiseLabel: string;\n minimiseEnabled: boolean;\n minimiseLabel: string;\n closeEnabled: boolean;\n closeLabel: string;\n tabDropdownEnabled: boolean;\n tabDropdownLabel: string;\n }\n}\n","import { ComponentItemConfig, ItemConfig } from '../config/config';\nimport { ResolvedComponentItemConfig } from '../config/resolved-config';\nimport { Tab } from '../controls/tab';\nimport { AssertError, UnexpectedNullError } from '../errors/internal-error';\nimport { ComponentItem } from '../items/component-item';\nimport { ContentItem } from '../items/content-item';\nimport { LayoutManager } from '../layout-manager';\nimport { EventEmitter } from '../utils/event-emitter';\nimport { JsonValue, LogicalZIndex, LogicalZIndexToDefaultMap } from '../utils/types';\nimport { deepExtend, setElementHeight, setElementWidth } from '../utils/utils';\n\n/** @public */\nexport class ComponentContainer extends EventEmitter {\n /** @internal */\n private _componentType: JsonValue;\n /** @internal */\n private _boundComponent: ComponentContainer.BindableComponent;\n /** @internal */\n private _width: number;\n /** @internal */\n private _height: number;\n /** @internal */\n private _isClosable;\n /** @internal */\n private _initialState: JsonValue | undefined;\n /** @internal */\n private _state: JsonValue | undefined;\n /** @internal */\n private _visible;\n /** @internal */\n private _isShownWithZeroDimensions;\n /** @internal */\n private _tab: Tab;\n /** @internal */\n private _stackMaximised = false;\n /** @internal */\n private _logicalZIndex: LogicalZIndex;\n\n stateRequestEvent: ComponentContainer.StateRequestEventHandler | undefined;\n virtualRectingRequiredEvent: ComponentContainer.VirtualRectingRequiredEvent | undefined;\n virtualVisibilityChangeRequiredEvent: ComponentContainer.VirtualVisibilityChangeRequiredEvent | undefined;\n virtualZIndexChangeRequiredEvent: ComponentContainer.VirtualZIndexChangeRequiredEvent | undefined;\n\n get width(): number { return this._width; }\n get height(): number { return this._height; }\n get parent(): ComponentItem { return this._parent; }\n /** @internal @deprecated use {@link (ComponentContainer:class).componentType} */\n get componentName(): JsonValue { return this._componentType; }\n get componentType(): JsonValue { return this._componentType; }\n get virtual(): boolean { return this._boundComponent.virtual; }\n get component(): ComponentContainer.Component { return this._boundComponent.component; }\n get tab(): Tab { return this._tab; }\n get title(): string { return this._parent.title; }\n get layoutManager(): LayoutManager { return this._layoutManager; }\n get isHidden(): boolean { return !this._visible; }\n get visible(): boolean { return this._visible; }\n get state(): JsonValue | undefined { return this._state; }\n /** Return the initial component state */\n get initialState(): JsonValue | undefined { return this._initialState; }\n /** The inner DOM element where the container's content is intended to live in */\n get element(): HTMLElement { return this._element; }\n\n /** @internal */\n constructor(\n /** @internal */\n private readonly _config: ResolvedComponentItemConfig,\n /** @internal */\n private readonly _parent: ComponentItem,\n /** @internal */\n private readonly _layoutManager: LayoutManager,\n /** @internal */\n private readonly _element: HTMLElement,\n /** @internal */\n private readonly _updateItemConfigEvent: ComponentContainer.UpdateItemConfigEventHandler,\n /** @internal */\n private readonly _showEvent: ComponentContainer.ShowEventHandler,\n /** @internal */\n private readonly _hideEvent: ComponentContainer.HideEventHandler,\n /** @internal */\n private readonly _focusEvent: ComponentContainer.FocusEventHandler,\n /** @internal */\n private readonly _blurEvent: ComponentContainer.BlurEventHandler,\n ) {\n super();\n\n this._width = 0;\n this._height = 0;\n this._visible = true;\n this._isShownWithZeroDimensions = true;\n\n this._componentType = _config.componentType;\n this._isClosable = _config.isClosable;\n this._initialState = _config.componentState;\n this._state = this._initialState;\n\n this._boundComponent = this.layoutManager.bindComponent(this, _config);\n\n this.updateElementPositionPropertyFromBoundComponent();\n }\n\n /** @internal */\n destroy(): void {\n this.releaseComponent();\n this.stateRequestEvent = undefined;\n this.emit('destroy');\n }\n\n /** @deprecated use {@link (ComponentContainer:class).element } */\n getElement(): HTMLElement {\n return this._element;\n }\n\n /**\n * Hides the container's component item (and hence, the container) if not already hidden.\n * Emits hide event prior to hiding the container.\n */\n hide(): void {\n this._hideEvent();\n }\n\n /**\n * Shows the container's component item (and hence, the container) if not visible.\n * Emits show event prior to hiding the container.\n */\n show(): void {\n this._showEvent();\n }\n\n /**\n * Focus this component in Layout.\n */\n focus(suppressEvent = false): void {\n this._focusEvent(suppressEvent);\n }\n\n /**\n * Remove focus from this component in Layout.\n */\n blur(suppressEvent = false): void {\n this._blurEvent(suppressEvent);\n }\n\n /**\n * Set the size from within the container. Traverses up\n * the item tree until it finds a row or column element\n * and resizes its items accordingly.\n *\n * If this container isn't a descendant of a row or column\n * it returns false\n * @param width - The new width in pixel\n * @param height - The new height in pixel\n *\n * @returns resizeSuccesful\n *\n * @internal\n */\n setSize(width: number, height: number): boolean {\n let ancestorItem: ContentItem | null = this._parent;\n if (ancestorItem.isColumn || ancestorItem.isRow || ancestorItem.parent === null) {\n throw new AssertError('ICSSPRC', 'ComponentContainer cannot have RowColumn Parent');\n } else {\n let ancestorChildItem: ContentItem;\n do {\n ancestorChildItem = ancestorItem;\n ancestorItem = ancestorItem.parent;\n } while (ancestorItem !== null && !ancestorItem.isColumn && !ancestorItem.isRow);\n\n if (ancestorItem === null) {\n // no Row or Column found\n return false;\n } else {\n // ancestorItem is Row or Column\n const direction = ancestorItem.isColumn ? 'height' : 'width';\n const currentSize = this[direction];\n if (currentSize === null) {\n throw new UnexpectedNullError('ICSSCS11194');\n } else {\n const newSize = direction === 'height' ? height : width;\n\n const totalPixel = currentSize * (1 / (ancestorChildItem.size / 100));\n const percentage = (newSize / totalPixel) * 100;\n const delta = (ancestorChildItem.size - percentage) / (ancestorItem.contentItems.length - 1);\n\n for (let i = 0; i < ancestorItem.contentItems.length; i++) {\n const ancestorItemContentItem = ancestorItem.contentItems[i];\n if (ancestorItemContentItem === ancestorChildItem) {\n ancestorItemContentItem.size = percentage;\n } else {\n ancestorItemContentItem.size += delta;\n }\n }\n\n ancestorItem.updateSize(false);\n\n return true;\n }\n }\n }\n }\n\n /**\n * Closes the container if it is closable. Can be called by\n * both the component within at as well as the contentItem containing\n * it. Emits a close event before the container itself is closed.\n */\n close(): void {\n if (this._isClosable) {\n this.emit('close');\n this._parent.close();\n }\n }\n\n /** Replaces component without affecting layout */\n replaceComponent(itemConfig: ComponentItemConfig): void {\n this.releaseComponent();\n\n if (!ItemConfig.isComponent(itemConfig)) {\n throw new Error('ReplaceComponent not passed a component ItemConfig')\n } else {\n const config = ComponentItemConfig.resolve(itemConfig, false);\n this._initialState = config.componentState;\n this._state = this._initialState;\n this._componentType = config.componentType;\n\n this._updateItemConfigEvent(config);\n\n this._boundComponent = this.layoutManager.bindComponent(this, config);\n this.updateElementPositionPropertyFromBoundComponent();\n\n if (this._boundComponent.virtual) {\n if (this.virtualVisibilityChangeRequiredEvent !== undefined) {\n this.virtualVisibilityChangeRequiredEvent(this, this._visible);\n }\n if (this.virtualRectingRequiredEvent !== undefined) {\n this._layoutManager.fireBeforeVirtualRectingEvent(1);\n try {\n this.virtualRectingRequiredEvent(this, this._width, this._height);\n } finally {\n this._layoutManager.fireAfterVirtualRectingEvent();\n }\n }\n this.setBaseLogicalZIndex();\n }\n\n this.emit('stateChanged');\n }\n }\n\n /**\n * Returns the initial component state or the latest passed in setState()\n * @returns state\n * @deprecated Use {@link (ComponentContainer:class).initialState}\n */\n getState(): JsonValue | undefined {\n return this._state;\n }\n\n /**\n * Merges the provided state into the current one\n * @deprecated Use {@link (ComponentContainer:class).stateRequestEvent}\n */\n extendState(state: Record): void {\n const extendedState = deepExtend(this._state as Record, state);\n this.setState(extendedState as JsonValue);\n }\n\n /**\n * Sets the component state\n * @deprecated Use {@link (ComponentContainer:class).stateRequestEvent}\n */\n setState(state: JsonValue): void {\n this._state = state;\n this._parent.emitBaseBubblingEvent('stateChanged');\n }\n\n /**\n * Set's the components title\n */\n setTitle(title: string): void {\n this._parent.setTitle(title);\n }\n\n /** @internal */\n setTab(tab: Tab): void {\n this._tab = tab;\n this.emit('tab', tab)\n }\n\n /** @internal */\n setVisibility(value: boolean): void {\n if (this._boundComponent.virtual) {\n if (this.virtualVisibilityChangeRequiredEvent !== undefined) {\n this.virtualVisibilityChangeRequiredEvent(this, value);\n }\n }\n\n if (value) {\n if (!this._visible) {\n this._visible = true;\n if (this._height === 0 && this._width === 0) {\n this._isShownWithZeroDimensions = true;\n } else {\n this._isShownWithZeroDimensions = false;\n this.setSizeToNodeSize(this._width, this._height, true);\n this.emitShow();\n }\n } else {\n if (this._isShownWithZeroDimensions && (this._height !== 0 || this._width !== 0)) {\n this._isShownWithZeroDimensions = false;\n this.setSizeToNodeSize(this._width, this._height, true);\n this.emitShow();\n }\n }\n } else {\n if (this._visible) {\n this._visible = false;\n this._isShownWithZeroDimensions = false;\n this.emitHide();\n }\n }\n }\n\n setBaseLogicalZIndex(): void {\n this.setLogicalZIndex(LogicalZIndex.base);\n }\n\n setLogicalZIndex(logicalZIndex: LogicalZIndex): void {\n if (logicalZIndex !== this._logicalZIndex) {\n this._logicalZIndex = logicalZIndex;\n\n this.notifyVirtualZIndexChangeRequired();\n }\n }\n\n /**\n * Set the container's size, but considered temporary (for dragging)\n * so don't emit any events.\n * @internal\n */\n enterDragMode(width: number, height: number): void {\n this._width = width;\n this._height = height;\n setElementWidth(this._element, width);\n setElementHeight(this._element, height);\n\n this.setLogicalZIndex(LogicalZIndex.drag);\n\n this.drag();\n }\n\n /** @internal */\n exitDragMode(): void {\n this.setBaseLogicalZIndex();\n }\n\n /** @internal */\n enterStackMaximised(): void {\n this._stackMaximised = true;\n this.setLogicalZIndex(LogicalZIndex.stackMaximised);\n }\n\n /** @internal */\n exitStackMaximised(): void {\n this.setBaseLogicalZIndex();\n this._stackMaximised = false;\n }\n\n /** @internal */\n drag(): void {\n if (this._boundComponent.virtual) {\n if (this.virtualRectingRequiredEvent !== undefined) {\n this._layoutManager.fireBeforeVirtualRectingEvent(1);\n try {\n this.virtualRectingRequiredEvent(this, this._width, this._height);\n } finally {\n this._layoutManager.fireAfterVirtualRectingEvent();\n }\n }\n }\n }\n\n /**\n * Sets the container's size. Called by the container's component item.\n * To instead set the size programmatically from within the component itself,\n * use the public setSize method\n * @param width - in px\n * @param height - in px\n * @param force - set even if no change\n * @internal\n */\n setSizeToNodeSize(width: number, height: number, force: boolean): void {\n if (width !== this._width || height !== this._height || force) {\n this._width = width;\n this._height = height;\n setElementWidth(this._element, width);\n setElementHeight(this._element, height);\n\n if (this._boundComponent.virtual) {\n this.addVirtualSizedContainerToLayoutManager();\n } else {\n this.emit('resize');\n this.checkShownFromZeroDimensions();\n }\n }\n }\n\n /** @internal */\n notifyVirtualRectingRequired(): void {\n if (this.virtualRectingRequiredEvent !== undefined) {\n this.virtualRectingRequiredEvent(this, this._width, this._height);\n this.emit('resize');\n this.checkShownFromZeroDimensions();\n }\n }\n\n /** @internal */\n private notifyVirtualZIndexChangeRequired(): void {\n if (this.virtualZIndexChangeRequiredEvent !== undefined) {\n const logicalZIndex = this._logicalZIndex;\n const defaultZIndex = LogicalZIndexToDefaultMap[logicalZIndex];\n this.virtualZIndexChangeRequiredEvent(this, logicalZIndex, defaultZIndex);\n }\n }\n\n /** @internal */\n private updateElementPositionPropertyFromBoundComponent() {\n if (this._boundComponent.virtual) {\n this._element.style.position = 'static';\n } else {\n this._element.style.position = ''; // set it back to attribute value\n }\n }\n\n /** @internal */\n private addVirtualSizedContainerToLayoutManager() {\n this._layoutManager.beginVirtualSizedContainerAdding();\n try {\n this._layoutManager.addVirtualSizedContainer(this);\n } finally {\n this._layoutManager.endVirtualSizedContainerAdding();\n }\n }\n\n /** @internal */\n private checkShownFromZeroDimensions() {\n if (this._isShownWithZeroDimensions && (this._height !== 0 || this._width !== 0)) {\n this._isShownWithZeroDimensions = false;\n this.emitShow();\n }\n }\n\n /** @internal */\n private emitShow(): void {\n this.emit('shown');\n this.emit('show');\n }\n\n /** @internal */\n private emitHide(): void {\n this.emit('hide');\n }\n\n /** @internal */\n private releaseComponent() {\n if (this._stackMaximised) {\n this.exitStackMaximised();\n }\n this.emit('beforeComponentRelease', this._boundComponent.component);\n this.layoutManager.unbindComponent(this, this._boundComponent.virtual, this._boundComponent.component);\n }\n}\n\n/** @public @deprecated use {@link ComponentContainer} */\nexport type ItemContainer = ComponentContainer;\n\n/** @public */\nexport namespace ComponentContainer {\n export type Component = unknown;\n\n export interface BindableComponent {\n component: Component;\n virtual: boolean;\n }\n\n export type StateRequestEventHandler = (this: void) => JsonValue | undefined;\n export type VirtualRectingRequiredEvent = (this: void, container: ComponentContainer, width: number, height: number) => void;\n export type VirtualVisibilityChangeRequiredEvent = (this: void, container: ComponentContainer, visible: boolean) => void;\n export type VirtualZIndexChangeRequiredEvent =\n (this: void, container: ComponentContainer, logicalZIndex: LogicalZIndex, defaultZIndex: string) => void;\n /** @internal */\n export type ShowEventHandler = (this: void) => void;\n /** @internal */\n export type HideEventHandler = (this: void) => void;\n /** @internal */\n export type FocusEventHandler = (this: void, suppressEvent: boolean) => void;\n /** @internal */\n export type BlurEventHandler = (this: void, suppressEvent: boolean) => void;\n /** @internal */\n export type UpdateItemConfigEventHandler = (itemConfig: ResolvedComponentItemConfig) => void;\n}\n","import { ResolvedItemConfig } from '../config/resolved-config'\nimport { BrowserPopout } from '../controls/browser-popout'\nimport { AssertError, UnexpectedNullError } from '../errors/internal-error'\nimport { LayoutManager } from '../layout-manager'\nimport { EventEmitter } from '../utils/event-emitter'\nimport { AreaLinkedRect, ItemType, SizeUnitEnum } from '../utils/types'\nimport { getUniqueId, setElementDisplayVisibility } from '../utils/utils'\nimport { ComponentItem } from './component-item'\nimport { ComponentParentableItem } from './component-parentable-item'\nimport { Stack } from './stack'\n\n/**\n * This is the baseclass that all content items inherit from.\n * Most methods provide a subset of what the sub-classes do.\n *\n * It also provides a number of functions for tree traversal\n * @public\n */\n\nexport abstract class ContentItem extends EventEmitter {\n /** @internal */\n private _type: ItemType;\n /** @internal */\n private _id: string;\n /** @internal */\n private _popInParentIds: string[] = [];\n /** @internal */\n private _contentItems: ContentItem[];\n /** @internal */\n private _isClosable;\n /** @internal */\n private _pendingEventPropagations: Record;\n /** @internal */\n private _throttledEvents: string[];\n /** @internal */\n private _isInitialised;\n\n /** @internal */\n size: number;\n /** @internal */\n sizeUnit: SizeUnitEnum;\n /** @internal */\n minSize: number | undefined;\n /** @internal */\n minSizeUnit: SizeUnitEnum;\n\n isGround: boolean\n isRow: boolean\n isColumn: boolean\n isStack: boolean\n isComponent: boolean\n\n get type(): ItemType { return this._type; }\n get id(): string { return this._id; }\n set id(value: string) { this._id = value; }\n /** @internal */\n get popInParentIds(): string[] { return this._popInParentIds; }\n get parent(): ContentItem | null { return this._parent; }\n get contentItems(): ContentItem[] { return this._contentItems; }\n get isClosable(): boolean { return this._isClosable; }\n get element(): HTMLElement { return this._element; }\n get isInitialised(): boolean { return this._isInitialised; }\n\n static isStack(item: ContentItem): item is Stack {\n return item.isStack;\n }\n\n static isComponentItem(item: ContentItem): item is ComponentItem {\n return item.isComponent;\n }\n\n static isComponentParentableItem(item: ContentItem): item is ComponentParentableItem {\n return item.isStack || item.isGround;\n }\n\n /** @internal */\n constructor(public readonly layoutManager: LayoutManager,\n config: ResolvedItemConfig,\n /** @internal */\n private _parent: ContentItem | null,\n /** @internal */\n private readonly _element: HTMLElement\n ) {\n super();\n\n this._type = config.type;\n this._id = config.id;\n\n this._isInitialised = false;\n this.isGround = false;\n this.isRow = false;\n this.isColumn = false;\n this.isStack = false;\n this.isComponent = false;\n\n this.size = config.size;\n this.sizeUnit = config.sizeUnit;\n this.minSize = config.minSize;\n this.minSizeUnit = config.minSizeUnit;\n\n this._isClosable = config.isClosable;\n\n this._pendingEventPropagations = {};\n this._throttledEvents = ['stateChanged'];\n\n this._contentItems = this.createContentItems(config.content);\n }\n\n /**\n * Updaters the size of the component and its children, called recursively\n * @param force - In some cases the size is not updated if it has not changed. In this case, events\n * (such as ComponentContainer.virtualRectingRequiredEvent) are not fired. Setting force to true, ensures the size is updated regardless, and\n * the respective events are fired. This is sometimes necessary when a component's size has not changed but it has become visible, and the\n * relevant events need to be fired.\n * @internal\n */\n abstract updateSize(force: boolean): void;\n\n /**\n * Removes a child node (and its children) from the tree\n * @param contentItem - The child item to remove\n * @param keepChild - Whether to destroy the removed item\n */\n removeChild(contentItem: ContentItem, keepChild = false): void {\n /*\n * Get the position of the item that's to be removed within all content items this node contains\n */\n const index = this._contentItems.indexOf(contentItem);\n\n /*\n * Make sure the content item to be removed is actually a child of this item\n */\n if (index === -1) {\n throw new Error('Can\\'t remove child item. Unknown content item');\n }\n\n /**\n\t\t * Call destroy on the content item.\n\t\t * All children are destroyed as well\n\t\t */\n if (!keepChild) {\n\t\t\tthis._contentItems[index].destroy();\n }\n\n /**\n * Remove the content item from this nodes array of children\n */\n this._contentItems.splice(index, 1);\n\n /**\n * If this node still contains other content items, adjust their size\n */\n if (this._contentItems.length > 0) {\n this.updateSize(false);\n } else {\n /**\n * If this was the last content item, remove this node as well\n */\n if (!this.isGround && this._isClosable === true) {\n if (this._parent === null) {\n throw new UnexpectedNullError('CIUC00874');\n } else {\n this._parent.removeChild(this);\n }\n }\n }\n }\n\n /**\n * Sets up the tree structure for the newly added child\n * The responsibility for the actual DOM manipulations lies\n * with the concrete item\n *\n * @param contentItem -\n * @param index - If omitted item will be appended\n * @param suspendResize - Used by descendent implementations\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n addChild(contentItem: ContentItem, index?: number | null, suspendResize?: boolean): number {\n index ??= this._contentItems.length;\n\n this._contentItems.splice(index, 0, contentItem);\n contentItem.setParent(this);\n\n if (this._isInitialised === true && contentItem._isInitialised === false) {\n contentItem.init();\n }\n\n return index;\n }\n\n /**\n * Replaces oldChild with newChild\n * @param oldChild -\n * @param newChild -\n * @internal\n */\n replaceChild(oldChild: ContentItem, newChild: ContentItem, destroyOldChild = false): void {\n // Do not try to replace ComponentItem - will not work\n const index = this._contentItems.indexOf(oldChild);\n const parentNode = oldChild._element.parentNode;\n\n if (index === -1) {\n throw new AssertError('CIRCI23232', 'Can\\'t replace child. oldChild is not child of this');\n }\n\n if (parentNode === null) {\n throw new UnexpectedNullError('CIRCP23232');\n } else {\n parentNode.replaceChild(newChild._element, oldChild._element);\n\n /*\n * Optionally destroy the old content item\n */\n if (destroyOldChild === true) {\n oldChild._parent = null;\n oldChild.destroy(); // will now also destroy all children of oldChild\n }\n\n /*\n * Wire the new contentItem into the tree\n */\n this._contentItems[index] = newChild;\n newChild.setParent(this);\n // newChild inherits the sizes from the old child:\n newChild.size = oldChild.size;\n newChild.sizeUnit = oldChild.sizeUnit;\n newChild.minSize = oldChild.minSize;\n newChild.minSizeUnit = oldChild.minSizeUnit;\n\n //TODO This doesn't update the config... refactor to leave item nodes untouched after creation\n if (newChild._parent === null) {\n throw new UnexpectedNullError('CIRCNC45699');\n } else {\n if (newChild._parent._isInitialised === true && newChild._isInitialised === false) {\n newChild.init();\n }\n\n this.updateSize(false);\n }\n }\n }\n\n /**\n * Convenience method.\n * Shorthand for this.parent.removeChild( this )\n */\n remove(): void {\n if (this._parent === null) {\n throw new UnexpectedNullError('CIR11110');\n } else {\n this._parent.removeChild(this);\n }\n }\n\n /**\n * Removes the component from the layout and creates a new\n * browser window with the component and its children inside\n */\n popout(): BrowserPopout {\n const parentId = getUniqueId();\n const browserPopout = this.layoutManager.createPopoutFromContentItem(this, undefined, parentId, undefined);\n this.emitBaseBubblingEvent('stateChanged');\n return browserPopout;\n }\n\n abstract toConfig(): ResolvedItemConfig;\n\n /** @internal */\n calculateConfigContent(): ResolvedItemConfig[] {\n const contentItems = this._contentItems;\n const count = contentItems.length;\n const result = new Array(count);\n for (let i = 0; i < count; i++) {\n const item = contentItems[i];\n result[i] = item.toConfig();\n }\n return result;\n }\n\n /** @internal */\n highlightDropZone(x: number, y: number, area: AreaLinkedRect): void {\n const dropTargetIndicator = this.layoutManager.dropTargetIndicator;\n if (dropTargetIndicator === null) {\n throw new UnexpectedNullError('ACIHDZ5593');\n } else {\n dropTargetIndicator.highlightArea(area, 1);\n }\n }\n\n /** @internal */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n onDrop(contentItem: ContentItem, area: ContentItem.Area): void {\n this.addChild(contentItem);\n }\n\n /** @internal */\n show(): void {\n this.layoutManager.beginSizeInvalidation();\n try {\n // Not sure why showAllActiveContentItems() was called. GoldenLayout seems to work fine without it. Left commented code\n // in source in case a reason for it becomes apparent.\n // this.layoutManager.showAllActiveContentItems();\n setElementDisplayVisibility(this._element, true);\n // this.layoutManager.updateSizeFromContainer();\n\n for (let i = 0; i < this._contentItems.length; i++) {\n this._contentItems[i].show();\n }\n } finally {\n this.layoutManager.endSizeInvalidation();\n }\n }\n\n /**\n * Destroys this item ands its children\n * @internal\n */\n destroy(): void {\n for (let i = 0; i < this._contentItems.length; i++) {\n this._contentItems[i].destroy();\n }\n this._contentItems = [];\n\n this.emitBaseBubblingEvent('beforeItemDestroyed');\n this._element.remove();\n this.emitBaseBubblingEvent('itemDestroyed');\n }\n\n /**\n * Returns the area the component currently occupies\n * @internal\n */\n getElementArea(element?: HTMLElement): ContentItem.Area | null {\n element = element ?? this._element;\n\n const rect = element.getBoundingClientRect();\n const top = rect.top + document.body.scrollTop;\n const left = rect.left + document.body.scrollLeft;\n\n const width = rect.width;\n const height = rect.height;\n\n return {\n x1: left,\n y1: top,\n x2: left + width,\n y2: top + height,\n surface: width * height,\n contentItem: this\n };\n }\n\n /**\n * The tree of content items is created in two steps: First all content items are instantiated,\n * then init is called recursively from top to bottem. This is the basic init function,\n * it can be used, extended or overwritten by the content items\n *\n * Its behaviour depends on the content item\n * @internal\n */\n init(): void {\n this._isInitialised = true;\n this.emitBaseBubblingEvent('itemCreated');\n this.emitUnknownBubblingEvent(this.type + 'Created');\n }\n\n /** @internal */\n protected setParent(parent: ContentItem): void {\n this._parent = parent;\n }\n\n /** @internal */\n addPopInParentId(id: string): void {\n if (!this.popInParentIds.includes(id)) {\n this.popInParentIds.push(id);\n }\n }\n\n /** @internal */\n protected initContentItems(): void {\n for (let i = 0; i < this._contentItems.length; i++) {\n this._contentItems[i].init();\n }\n }\n\n /** @internal */\n protected hide(): void {\n this.layoutManager.beginSizeInvalidation();\n try {\n setElementDisplayVisibility(this._element, false);\n // this.layoutManager.updateSizeFromContainer();\n } finally {\n this.layoutManager.endSizeInvalidation();\n }\n }\n\n /** @internal */\n protected updateContentItemsSize(force: boolean): void {\n for (let i = 0; i < this._contentItems.length; i++) {\n this._contentItems[i].updateSize(force);\n }\n }\n\n /**\n * creates all content items for this node at initialisation time\n * PLEASE NOTE, please see addChild for adding contentItems at runtime\n * @internal\n */\n private createContentItems(content: readonly ResolvedItemConfig[]) {\n const count = content.length;\n const result = new Array(count);\n for (let i = 0; i < content.length; i++) {\n result[i] = this.layoutManager.createContentItem(content[i], this);\n }\n return result;\n }\n\n /**\n * Called for every event on the item tree. Decides whether the event is a bubbling\n * event and propagates it to its parent\n *\n * @param name - The name of the event\n * @param event -\n * @internal\n */\n private propagateEvent(name: string, args: unknown[]) {\n if (args.length === 1) {\n const event = args[0];\n if (event instanceof EventEmitter.BubblingEvent &&\n event.isPropagationStopped === false &&\n this._isInitialised === true) {\n\n /**\n * In some cases (e.g. if an element is created from a DragSource) it\n * doesn't have a parent and is not a child of GroundItem. If that's the case\n * propagate the bubbling event from the top level of the substree directly\n * to the layoutManager\n */\n if (this.isGround === false && this._parent) {\n this._parent.emitUnknown(name, event);\n } else {\n this.scheduleEventPropagationToLayoutManager(name, event);\n }\n }\n }\n }\n\n override tryBubbleEvent(name: string, args: unknown[]): void {\n if (args.length === 1) {\n const event = args[0];\n if (event instanceof EventEmitter.BubblingEvent &&\n event.isPropagationStopped === false &&\n this._isInitialised === true\n ) {\n /**\n * In some cases (e.g. if an element is created from a DragSource) it\n * doesn't have a parent and is not a child of GroundItem. If that's the case\n * propagate the bubbling event from the top level of the substree directly\n * to the layoutManager\n */\n if (this.isGround === false && this._parent) {\n this._parent.emitUnknown(name, event);\n } else {\n this.scheduleEventPropagationToLayoutManager(name, event);\n }\n }\n }\n }\n\n /**\n * All raw events bubble up to the Ground element. Some events that\n * are propagated to - and emitted by - the layoutManager however are\n * only string-based, batched and sanitized to make them more usable\n *\n * @param name - The name of the event\n * @internal\n */\n private scheduleEventPropagationToLayoutManager(name: string, event: EventEmitter.BubblingEvent) {\n if (this._throttledEvents.indexOf(name) === -1) {\n this.layoutManager.emitUnknown(name, event);\n } else {\n if (this._pendingEventPropagations[name] !== true) {\n this._pendingEventPropagations[name] = true;\n globalThis.requestAnimationFrame(() => this.propagateEventToLayoutManager(name, event));\n }\n }\n\n }\n\n /**\n * Callback for events scheduled by _scheduleEventPropagationToLayoutManager\n *\n * @param name - The name of the event\n * @internal\n */\n private propagateEventToLayoutManager(name: string, event: EventEmitter.BubblingEvent) {\n this._pendingEventPropagations[name] = false;\n this.layoutManager.emitUnknown(name, event);\n }\n}\n\n/** @public */\nexport namespace ContentItem {\n /** @internal */\n export interface Area extends AreaLinkedRect {\n surface: number;\n contentItem: ContentItem;\n }\n}\n\n/** @public @deprecated Use {@link (ContentItem:class)} */\nexport type AbstractContentItem = ContentItem;\n","import { ResolvedComponentItemConfig, ResolvedHeaderedItemConfig } from '../config/resolved-config';\nimport { ComponentContainer } from '../container/component-container';\nimport { Tab } from '../controls/tab';\nimport { UnexpectedNullError } from '../errors/internal-error';\nimport { LayoutManager } from '../layout-manager';\nimport { DomConstants } from '../utils/dom-constants';\nimport { ItemType, JsonValue } from '../utils/types';\nimport { getElementWidthAndHeight, setElementHeight, setElementWidth } from '../utils/utils';\nimport { ComponentParentableItem } from './component-parentable-item';\nimport { ContentItem } from './content-item';\n\n/** @public */\nexport class ComponentItem extends ContentItem {\n /** @internal */\n private _reorderEnabled: boolean;\n /** @internal */\n private _headerConfig: ResolvedHeaderedItemConfig.Header | undefined;\n /** @internal */\n private _title: string;\n /** @internal */\n private readonly _initialWantMaximise: boolean;\n /** @internal */\n private _container: ComponentContainer;\n /** @internal */\n private _tab: Tab;\n /** @internal */\n private _focused = false;\n\n /** @internal @deprecated use {@link (ComponentItem:class).componentType} */\n get componentName(): JsonValue { return this._container.componentType; }\n get componentType(): JsonValue { return this._container.componentType; }\n get reorderEnabled(): boolean { return this._reorderEnabled; }\n /** @internal */\n get initialWantMaximise(): boolean { return this._initialWantMaximise; }\n get component(): ComponentContainer.Component | undefined { return this._container.component; }\n get container(): ComponentContainer { return this._container; }\n get parentItem(): ComponentParentableItem { return this._parentItem; }\n\n get headerConfig(): ResolvedHeaderedItemConfig.Header | undefined { return this._headerConfig; }\n get title(): string { return this._title; }\n get tab(): Tab { return this._tab; }\n get focused(): boolean { return this._focused; }\n\n /** @internal */\n constructor(\n layoutManager: LayoutManager,\n config: ResolvedComponentItemConfig,\n /** @internal */\n private _parentItem: ComponentParentableItem\n ) {\n super(layoutManager, config, _parentItem, document.createElement('div'));\n\n this.isComponent = true;\n\n this._reorderEnabled = config.reorderEnabled;\n\n this.applyUpdatableConfig(config);\n\n this._initialWantMaximise = config.maximised;\n\n const containerElement = document.createElement('div');\n containerElement.classList.add(DomConstants.ClassName.Content);\n this.element.appendChild(containerElement);\n this._container = new ComponentContainer(config, this, layoutManager, containerElement,\n (itemConfig) => this.handleUpdateItemConfigEvent(itemConfig),\n () => this.show(),\n () => this.hide(),\n (suppressEvent) => this.focus(suppressEvent),\n (suppressEvent) => this.blur(suppressEvent),\n );\n }\n\n /** @internal */\n override destroy(): void {\n this._container.destroy()\n super.destroy();\n }\n\n applyUpdatableConfig(config: ResolvedComponentItemConfig): void {\n this.setTitle(config.title);\n this._headerConfig = config.header;\n }\n\n toConfig(): ResolvedComponentItemConfig {\n const stateRequestEvent = this._container.stateRequestEvent;\n const state = stateRequestEvent === undefined ? this._container.state : stateRequestEvent();\n\n const result: ResolvedComponentItemConfig = {\n type: ItemType.component,\n content: [],\n size: this.size,\n sizeUnit: this.sizeUnit,\n minSize: this.minSize,\n minSizeUnit: this.minSizeUnit,\n id: this.id,\n maximised: false,\n isClosable: this.isClosable,\n reorderEnabled: this._reorderEnabled,\n title: this._title,\n header: ResolvedHeaderedItemConfig.Header.createCopy(this._headerConfig),\n componentType: ResolvedComponentItemConfig.copyComponentType(this.componentType),\n componentState: state,\n }\n\n return result;\n }\n\n close(): void {\n if (this.parent === null) {\n throw new UnexpectedNullError('CIC68883');\n } else {\n this.parent.removeChild(this, false);\n }\n }\n\n // Used by Drag Proxy\n /** @internal */\n enterDragMode(width: number, height: number): void {\n setElementWidth(this.element, width);\n setElementHeight(this.element, height);\n this._container.enterDragMode(width, height);\n }\n\n /** @internal */\n exitDragMode(): void {\n this._container.exitDragMode();\n }\n\n /** @internal */\n enterStackMaximised(): void {\n this._container.enterStackMaximised();\n }\n\n /** @internal */\n exitStackMaximised(): void {\n this._container.exitStackMaximised();\n }\n\n // Used by Drag Proxy\n /** @internal */\n drag(): void {\n this._container.drag();\n }\n\n /** @internal */\n override updateSize(force: boolean): void {\n this.updateNodeSize(force);\n }\n\n /** @internal */\n override init(): void {\n this.updateNodeSize(false);\n\n super.init();\n this._container.emit('open');\n this.initContentItems();\n }\n\n /**\n * Set this component's title\n *\n * @public\n * @param title -\n */\n\n setTitle(title: string): void {\n this._title = title;\n this.emit('titleChanged', title);\n this.emit('stateChanged');\n }\n\n setTab(tab: Tab): void {\n this._tab = tab;\n this.emit('tab', tab)\n this._container.setTab(tab);\n }\n\n /** @internal */\n override hide(): void {\n super.hide();\n this._container.setVisibility(false);\n }\n\n /** @internal */\n override show(): void {\n super.show();\n this._container.setVisibility(true);\n }\n\n /**\n * Focuses the item if it is not already focused\n */\n focus(suppressEvent = false): void {\n this.parentItem.setActiveComponentItem(this, true, suppressEvent);\n }\n\n /** @internal */\n setFocused(suppressEvent: boolean): void {\n this._focused = true;\n this.tab.setFocused();\n if (!suppressEvent) {\n this.emitBaseBubblingEvent('focus');\n }\n }\n\n /**\n * Blurs (defocuses) the item if it is focused\n */\n blur(suppressEvent = false): void {\n if (this._focused) {\n this.layoutManager.setFocusedComponentItem(undefined, suppressEvent);\n }\n }\n\n /** @internal */\n setBlurred(suppressEvent: boolean): void {\n this._focused = false;\n this.tab.setBlurred();\n if (!suppressEvent) {\n this.emitBaseBubblingEvent('blur');\n }\n }\n\n /** @internal */\n protected override setParent(parent: ContentItem): void {\n this._parentItem = parent as ComponentParentableItem;\n super.setParent(parent);\n }\n\n /** @internal */\n private handleUpdateItemConfigEvent(itemConfig: ResolvedComponentItemConfig) {\n this.applyUpdatableConfig(itemConfig);\n }\n\n /** @internal */\n private updateNodeSize(force: boolean): void {\n if (this.element.style.display !== 'none') {\n // Do not update size of hidden components to prevent unwanted reflows\n\n const { width, height } = getElementWidthAndHeight(this.element);\n this._container.setSizeToNodeSize(width, height, force);\n }\n }\n}\n\n/** @public @deprecated use {@link (ComponentItem:class)} */\nexport type Component = ComponentItem;\n\n/** @public */\nexport namespace ComponentItem {\n export type Component = ComponentContainer.Component;\n}\n","import { ComponentItem } from './component-item';\nimport { ContentItem } from './content-item';\n\nexport abstract class ComponentParentableItem extends ContentItem {\n /** @internal */\n private _focused = false;\n\n get focused(): boolean { return this._focused; }\n\n /** @internal */\n setFocusedValue(value: boolean): void {\n this._focused = value;\n }\n\n abstract setActiveComponentItem(item: ComponentItem, focus: boolean, suppressFocusEvent: boolean): void;\n}\n","import { ComponentItemConfig, ItemConfig } from '../config/config';\nimport { ResolvedComponentItemConfig, ResolvedHeaderedItemConfig, ResolvedItemConfig, ResolvedStackItemConfig } from '../config/resolved-config';\nimport { Header } from '../controls/header';\nimport { AssertError, UnexpectedNullError, UnexpectedUndefinedError } from '../errors/internal-error';\nimport { LayoutManager } from '../layout-manager';\nimport { DomConstants } from '../utils/dom-constants';\nimport { DragListener } from '../utils/drag-listener';\nimport { EventEmitter } from '../utils/event-emitter';\nimport { AreaLinkedRect, ItemType, JsonValue, Side, SizeUnitEnum, WidthAndHeight, WidthOrHeightPropertyName } from '../utils/types';\nimport {\n getElementWidthAndHeight,\n numberToPixels,\n setElementDisplayVisibility\n} from '../utils/utils';\nimport { ComponentItem } from './component-item';\nimport { ComponentParentableItem } from './component-parentable-item';\nimport { ContentItem } from './content-item';\n\n/** @public */\nexport class Stack extends ComponentParentableItem {\n /** @internal */\n private readonly _headerConfig: ResolvedHeaderedItemConfig.Header | undefined;\n /** @internal */\n private readonly _header: Header;\n /** @internal */\n private readonly _childElementContainer: HTMLElement;\n /** @internal */\n private readonly _maximisedEnabled: boolean;\n /** @internal */\n private _activeComponentItem: ComponentItem | undefined;\n /** @internal */\n private _dropSegment: Stack.Segment;\n /** @internal */\n private _dropIndex: number;\n /** @internal */\n private _contentAreaDimensions: Stack.ContentAreaDimensions;\n /** @internal */\n private _headerSideChanged = false;\n /** @internal */\n private readonly _initialWantMaximise: boolean;\n /** @internal */\n private _initialActiveItemIndex: number;\n\n /** @internal */\n private _resizeListener = () => this.handleResize();\n /** @internal */\n private _maximisedListener = () => this.handleMaximised();\n /** @internal */\n private _minimisedListener = () => this.handleMinimised();\n\n get childElementContainer(): HTMLElement { return this._childElementContainer; }\n get header(): Header { return this._header; }\n get headerShow(): boolean { return this._header.show; }\n get headerSide(): Side { return this._header.side; }\n get headerLeftRightSided(): boolean { return this._header.leftRightSided; }\n /** @internal */\n get contentAreaDimensions(): Stack.ContentAreaDimensions | undefined { return this._contentAreaDimensions; }\n /** @internal */\n get initialWantMaximise(): boolean { return this._initialWantMaximise; }\n get isMaximised(): boolean { return this === this.layoutManager.maximisedStack; }\n get stackParent(): ContentItem {\n if (!this.parent) {\n throw new Error('Stack should always have a parent');\n }\n return this.parent;\n }\n\n /** @internal */\n constructor(layoutManager: LayoutManager, config: ResolvedStackItemConfig, parent: ContentItem) {\n super(layoutManager, config, parent, Stack.createElement(document));\n\n this._headerConfig = config.header;\n const layoutHeaderConfig = layoutManager.layoutConfig.header;\n const configContent = config.content;\n // If stack has only one component, then we can also check this for header settings\n let componentHeaderConfig: ResolvedHeaderedItemConfig.Header | undefined;\n if (configContent.length !== 1) {\n componentHeaderConfig = undefined;\n } else {\n const firstChildItemConfig = configContent[0];\n componentHeaderConfig = (firstChildItemConfig as ResolvedHeaderedItemConfig).header; // will be undefined if not component (and wont be stack)\n }\n\n this._initialWantMaximise = config.maximised;\n this._initialActiveItemIndex = config.activeItemIndex ?? 0; // make sure defined\n\n // check for defined value for each item in order of Stack (this Item), Component (first child), Manager.\n const show = this._headerConfig?.show ?? componentHeaderConfig?.show ?? layoutHeaderConfig.show;\n const popout = this._headerConfig?.popout ?? componentHeaderConfig?.popout ?? layoutHeaderConfig.popout;\n const maximise = this._headerConfig?.maximise ?? componentHeaderConfig?.maximise ?? layoutHeaderConfig.maximise;\n const close = this._headerConfig?.close ?? componentHeaderConfig?.close ?? layoutHeaderConfig.close;\n const minimise = this._headerConfig?.minimise ?? componentHeaderConfig?.minimise ?? layoutHeaderConfig.minimise;\n const tabDropdown = this._headerConfig?.tabDropdown ?? componentHeaderConfig?.tabDropdown ?? layoutHeaderConfig.tabDropdown;\n this._maximisedEnabled = maximise !== false;\n const headerSettings: Header.Settings = {\n show: show !== false,\n side: show === false ? Side.top : show,\n popoutEnabled: popout !== false,\n popoutLabel: popout === false ? '' : popout,\n maximiseEnabled: this._maximisedEnabled,\n maximiseLabel: maximise === false ? '' : maximise,\n closeEnabled: close !== false,\n closeLabel: close === false ? '' : close,\n minimiseEnabled: true,\n minimiseLabel: minimise,\n tabDropdownEnabled: tabDropdown !== false,\n tabDropdownLabel: tabDropdown === false ? '' : tabDropdown,\n };\n\n this._header = new Header(layoutManager,\n this, headerSettings,\n config.isClosable && close !== false,\n () => this.getActiveComponentItem(),\n () => this.remove(),\n () => this.handlePopoutEvent(),\n () => this.toggleMaximise(),\n (ev) => this.handleHeaderClickEvent(ev),\n (ev) => this.handleHeaderTouchStartEvent(ev),\n (item) => this.handleHeaderComponentRemoveEvent(item),\n (item) => this.handleHeaderComponentFocusEvent(item),\n (x, y, dragListener, item) => this.handleHeaderComponentStartDragEvent(x, y, dragListener, item),\n );\n\n // this._dropZones = {};\n\n this.isStack = true;\n\n this._childElementContainer = document.createElement('section');\n this._childElementContainer.classList.add(DomConstants.ClassName.Items);\n\n this.on('resize', this._resizeListener);\n if (this._maximisedEnabled) {\n this.on('maximised', this._maximisedListener);\n this.on('minimised', this._minimisedListener);\n }\n\n this.element.appendChild(this._header.element);\n this.element.appendChild(this._childElementContainer);\n\n this.setupHeaderPosition();\n this._header.updateClosability();\n }\n\n /** @internal */\n override updateSize(force: boolean): void {\n this.layoutManager.beginVirtualSizedContainerAdding();\n try {\n this.updateNodeSize();\n this.updateContentItemsSize(force);\n } finally {\n this.layoutManager.endVirtualSizedContainerAdding();\n }\n }\n\n /** @internal */\n override init(): void {\n if (this.isInitialised === true) return;\n\n this.updateNodeSize();\n\n for (let i = 0; i < this.contentItems.length; i++) {\n this._childElementContainer.appendChild(this.contentItems[i].element);\n }\n\n super.init();\n\n const contentItems = this.contentItems;\n const contentItemCount = contentItems.length;\n if (contentItemCount > 0) { // contentItemCount will be 0 on drag drop\n if (this._initialActiveItemIndex < 0 || this._initialActiveItemIndex >= contentItemCount) {\n throw new Error(`ActiveItemIndex out of range: ${this._initialActiveItemIndex} id: ${this.id}`);\n } else {\n for (let i = 0; i < contentItemCount; i++) {\n const contentItem = contentItems[i];\n if (!(contentItem instanceof ComponentItem)) {\n throw new Error(`Stack Content Item is not of type ComponentItem: ${i} id: ${this.id}`);\n } else {\n this._header.createTab(contentItem, i);\n contentItem.hide();\n contentItem.container.setBaseLogicalZIndex();\n }\n }\n\n this.setActiveComponentItem(contentItems[this._initialActiveItemIndex] as ComponentItem, false);\n\n this._header.updateTabSizes();\n }\n }\n\n this._header.updateClosability();\n this.initContentItems();\n }\n\n /** @deprecated Use {@link (Stack:class).setActiveComponentItem} */\n setActiveContentItem(item: ContentItem): void {\n if (!ContentItem.isComponentItem(item)) {\n throw new Error('Stack.setActiveContentItem: item is not a ComponentItem');\n } else {\n this.setActiveComponentItem(item, false);\n }\n }\n\n setActiveComponentItem(componentItem: ComponentItem, focus: boolean, suppressFocusEvent = false): void {\n if (this._activeComponentItem !== componentItem) {\n if (this.contentItems.indexOf(componentItem) === -1) {\n throw new Error('componentItem is not a child of this stack');\n } else {\n this.layoutManager.beginSizeInvalidation();\n try {\n if (this._activeComponentItem !== undefined) {\n this._activeComponentItem.hide();\n }\n this._activeComponentItem = componentItem;\n this._header.processActiveComponentChanged(componentItem);\n componentItem.show();\n } finally {\n this.layoutManager.endSizeInvalidation();\n }\n\n this.emit('activeContentItemChanged', componentItem);\n this.layoutManager.emit('activeContentItemChanged', componentItem);\n this.emitStateChangedEvent();\n }\n }\n\n if (this.focused || focus) {\n this.layoutManager.setFocusedComponentItem(componentItem, suppressFocusEvent);\n }\n }\n\n /** @deprecated Use {@link (Stack:class).getActiveComponentItem} */\n getActiveContentItem(): ContentItem | null {\n return this.getActiveComponentItem() ?? null;\n }\n\n getActiveComponentItem(): ComponentItem | undefined {\n return this._activeComponentItem;\n }\n\n /** @internal */\n focusActiveContentItem(): void {\n this._activeComponentItem?.focus();\n }\n\n /** @internal */\n override setFocusedValue(value: boolean): void {\n this._header.applyFocusedValue(value);\n super.setFocusedValue(value);\n }\n\n /** @internal */\n setRowColumnClosable(value: boolean): void {\n this._header.setRowColumnClosable(value);\n }\n\n newComponent(componentType: JsonValue, componentState?: JsonValue, title?: string, index?: number): ComponentItem {\n const itemConfig: ComponentItemConfig = {\n type: 'component',\n componentType,\n componentState,\n title,\n };\n return this.newItem(itemConfig, index) as ComponentItem;\n }\n\n addComponent(componentType: JsonValue, componentState?: JsonValue, title?: string, index?: number): number {\n const itemConfig: ComponentItemConfig = {\n type: 'component',\n componentType,\n componentState,\n title,\n };\n return this.addItem(itemConfig, index);\n }\n\n newItem(itemConfig: ComponentItemConfig, index?: number): ContentItem {\n index = this.addItem(itemConfig, index);\n return this.contentItems[index];\n }\n\n addItem(itemConfig: ComponentItemConfig, index?: number): number {\n this.layoutManager.checkMinimiseMaximisedStack();\n\n const resolvedItemConfig = ItemConfig.resolve(itemConfig, false);\n const contentItem = this.layoutManager.createAndInitContentItem(resolvedItemConfig, this);\n return this.addChild(contentItem, index);\n }\n\n override addChild(contentItem: ContentItem, index?: number, focus = false): number {\n if(index !== undefined && index > this.contentItems.length){\n index -= 1;\n throw new AssertError('SAC99728'); // undisplayChild() removed so this condition should no longer occur\n }\n\n if (!(contentItem instanceof ComponentItem)) {\n throw new AssertError('SACC88532'); // Stacks can only have Component children\n } else {\n index = super.addChild(contentItem, index);\n this._childElementContainer.appendChild(contentItem.element);\n this._header.createTab(contentItem, index);\n this.setActiveComponentItem(contentItem, focus);\n this._header.updateTabSizes();\n this.updateSize(false);\n contentItem.container.setBaseLogicalZIndex();\n this._header.updateClosability();\n this.emitStateChangedEvent();\n return index;\n }\n }\n\n override removeChild(contentItem: ContentItem, keepChild: boolean): void {\n const componentItem = contentItem as ComponentItem;\n const index = this.contentItems.indexOf(componentItem);\n const stackWillBeDeleted = this.contentItems.length === 1;\n\n if (this._activeComponentItem === componentItem) {\n if (componentItem.focused) {\n componentItem.blur();\n }\n if (!stackWillBeDeleted) {\n // At this point we're already sure we have at least one content item left *after*\n // removing contentItem, so we can safely assume index 1 is a valid one if\n // the index of contentItem is 0, otherwise we just use the previous content item.\n const newActiveComponentIdx = index === 0 ? 1 : index - 1;\n this.setActiveComponentItem(this.contentItems[newActiveComponentIdx] as ComponentItem, false);\n }\n }\n\n this._header.removeTab(componentItem);\n\n super.removeChild(componentItem, keepChild);\n\n if (!stackWillBeDeleted) {\n this._header.updateClosability();\n }\n\n this.emitStateChangedEvent();\n }\n\n /**\n * Maximises the Item or minimises it if it is already maximised\n */\n toggleMaximise(): void {\n if (this.isMaximised) {\n this.minimise();\n } else {\n this.maximise();\n }\n }\n\n maximise(): void {\n if (!this.isMaximised) {\n this.layoutManager.setMaximisedStack(this);\n const contentItems = this.contentItems;\n const contentItemCount = contentItems.length;\n for (let i = 0; i < contentItemCount; i++) {\n const contentItem = contentItems[i];\n if (contentItem instanceof ComponentItem) {\n contentItem.enterStackMaximised();\n } else {\n throw new AssertError('SMAXI87773');\n }\n }\n this.emitStateChangedEvent();\n }\n }\n\n minimise(): void {\n if (this.isMaximised) {\n this.layoutManager.setMaximisedStack(undefined);\n const contentItems = this.contentItems;\n const contentItemCount = contentItems.length;\n for (let i = 0; i < contentItemCount; i++) {\n const contentItem = contentItems[i];\n if (contentItem instanceof ComponentItem) {\n contentItem.exitStackMaximised();\n } else {\n throw new AssertError('SMINI87773');\n }\n }\n this.emitStateChangedEvent();\n }\n }\n\n /** @internal */\n override destroy(): void {\n if (this._activeComponentItem?.focused) {\n this._activeComponentItem.blur();\n }\n super.destroy();\n this.off('resize', this._resizeListener);\n if (this._maximisedEnabled) {\n this.off('maximised', this._maximisedListener);\n this.off('minimised', this._minimisedListener);\n }\n this._header.destroy();\n }\n\n toConfig(): ResolvedStackItemConfig {\n let activeItemIndex: number | undefined;\n if (this._activeComponentItem) {\n activeItemIndex = this.contentItems.indexOf(this._activeComponentItem);\n if (activeItemIndex < 0) {\n throw new Error('active component item not found in stack');\n }\n }\n if (this.contentItems.length > 0 && activeItemIndex === undefined) {\n throw new Error('expected non-empty stack to have an active component item');\n } else {\n const result: ResolvedStackItemConfig = {\n type: 'stack',\n content: this.calculateConfigContent() as ResolvedComponentItemConfig[],\n size: this.size,\n sizeUnit: this.sizeUnit,\n minSize: this.minSize,\n minSizeUnit: this.minSizeUnit,\n id: this.id,\n isClosable: this.isClosable,\n maximised: this.isMaximised,\n header: this.createHeaderConfig(),\n activeItemIndex,\n }\n return result;\n }\n }\n\n /**\n * Ok, this one is going to be the tricky one: The user has dropped a {@link (ContentItem:class)} onto this stack.\n *\n * It was dropped on either the stacks header or the top, right, bottom or left bit of the content area\n * (which one of those is stored in this._dropSegment). Now, if the user has dropped on the header the case\n * is relatively clear: We add the item to the existing stack... job done (might be good to have\n * tab reordering at some point, but lets not sweat it right now)\n *\n * If the item was dropped on the content part things are a bit more complicated. If it was dropped on either the\n * top or bottom region we need to create a new column and place the items accordingly.\n * Unless, of course if the stack is already within a column... in which case we want\n * to add the newly created item to the existing column...\n * either prepend or append it, depending on wether its top or bottom.\n *\n * Same thing for rows and left / right drop segments... so in total there are 9 things that can potentially happen\n * (left, top, right, bottom) * is child of the right parent (row, column) + header drop\n *\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n override onDrop(contentItem: ContentItem, area: ContentItem.Area): void {\n /*\n * The item was dropped on the header area. Just add it as a child of this stack and\n * get the hell out of this logic\n */\n if (this._dropSegment === Stack.Segment.Header) {\n this.resetHeaderDropZone();\n if (this._dropIndex === undefined) {\n throw new UnexpectedUndefinedError('SODDI68990');\n } else {\n this.addChild(contentItem, this._dropIndex);\n return;\n }\n }\n\n /*\n * The stack is empty. Let's just add the element.\n */\n if (this._dropSegment === Stack.Segment.Body) {\n this.addChild(contentItem, 0, true);\n return;\n }\n\n /*\n * The item was dropped on the top-, left-, bottom- or right- part of the content. Let's\n * aggregate some conditions to make the if statements later on more readable\n */\n const isVertical = this._dropSegment === Stack.Segment.Top || this._dropSegment === Stack.Segment.Bottom;\n const isHorizontal = this._dropSegment === Stack.Segment.Left || this._dropSegment === Stack.Segment.Right;\n const insertBefore = this._dropSegment === Stack.Segment.Top || this._dropSegment === Stack.Segment.Left;\n const hasCorrectParent = (isVertical && this.stackParent.isColumn) || (isHorizontal && this.stackParent.isRow);\n\n /*\n * The content item can be either a component or a stack. If it is a component, wrap it into a stack\n */\n if (contentItem.isComponent) {\n const itemConfig = ResolvedStackItemConfig.createDefault();\n itemConfig.header = this.createHeaderConfig();\n const stack = this.layoutManager.createAndInitContentItem(itemConfig, this);\n stack.addChild(contentItem);\n contentItem = stack;\n }\n\n\n /*\n * If the contentItem that's being dropped is not dropped on a Stack (cases which just passed above and\n * which would wrap the contentItem in a Stack) we need to check whether contentItem is a RowOrColumn.\n * If it is, we need to re-wrap it in a Stack like it was when it was dragged by its Tab (it was dragged!).\n */\n if(contentItem.type === ItemType.row || contentItem.type === ItemType.column){\n const itemConfig = ResolvedStackItemConfig.createDefault();\n itemConfig.header = this.createHeaderConfig();\n const stack = this.layoutManager.createContentItem(itemConfig, this);\n stack.addChild(contentItem)\n contentItem = stack\n }\n\n /*\n * If the item is dropped on top or bottom of a column or left and right of a row, it's already\n * layd out in the correct way. Just add it as a child\n */\n if (hasCorrectParent) {\n const index = this.stackParent.contentItems.indexOf(this);\n this.stackParent.addChild(contentItem, insertBefore ? index : index + 1, true);\n this.size *= 0.5;\n contentItem.size = this.size;\n contentItem.sizeUnit = this.sizeUnit;\n this.stackParent.updateSize(false);\n /*\n * This handles items that are dropped on top or bottom of a row or left / right of a column. We need\n * to create the appropriate contentItem for them to live in\n */\n } else {\n const type = isVertical ? ItemType.column : ItemType.row;\n const itemConfig = ResolvedItemConfig.createDefault(type) as ResolvedItemConfig;\n const rowOrColumn = this.layoutManager.createContentItem(itemConfig, this);\n this.stackParent.replaceChild(this, rowOrColumn);\n\n rowOrColumn.addChild(contentItem, insertBefore ? 0 : undefined, true);\n rowOrColumn.addChild(this, insertBefore ? undefined : 0, true);\n\n this.size = 50;\n contentItem.size = 50;\n contentItem.sizeUnit = SizeUnitEnum.Percent;\n rowOrColumn.updateSize(false);\n }\n }\n\n /**\n * If the user hovers above the header part of the stack, indicate drop positions for tabs.\n * otherwise indicate which segment of the body the dragged item would be dropped on\n *\n * @param x - Absolute Screen X\n * @param y - Absolute Screen Y\n * @internal\n */\n override highlightDropZone(x: number, y: number): void {\n for (const key in this._contentAreaDimensions) {\n const segment = key as Stack.Segment;\n const area = this._contentAreaDimensions[segment].hoverArea;\n\n if (area.x1 < x && area.x2 > x && area.y1 < y && area.y2 > y) {\n\n if (segment === Stack.Segment.Header) {\n this._dropSegment = Stack.Segment.Header;\n this.highlightHeaderDropZone(this._header.leftRightSided ? y : x);\n } else {\n this.resetHeaderDropZone();\n this.highlightBodyDropZone(segment);\n }\n\n return;\n }\n }\n }\n\n /** @internal */\n getArea(): ContentItem.Area | null {\n if (this.element.style.display === 'none') {\n return null;\n }\n\n const headerArea = super.getElementArea(this._header.element);\n const contentArea = super.getElementArea(this._childElementContainer);\n if (headerArea === null || contentArea === null) {\n throw new UnexpectedNullError('SGAHC13086');\n }\n const contentWidth = contentArea.x2 - contentArea.x1;\n const contentHeight = contentArea.y2 - contentArea.y1;\n\n this._contentAreaDimensions = {\n header: {\n hoverArea: {\n x1: headerArea.x1,\n y1: headerArea.y1,\n x2: headerArea.x2,\n y2: headerArea.y2\n },\n highlightArea: {\n x1: headerArea.x1,\n y1: headerArea.y1,\n x2: headerArea.x2,\n y2: headerArea.y2\n }\n }\n };\n\n /**\n * Highlight the entire body if the stack is empty\n */\n if (this.contentItems.length === 0) {\n\n this._contentAreaDimensions.body = {\n hoverArea: {\n x1: contentArea.x1,\n y1: contentArea.y1,\n x2: contentArea.x2,\n y2: contentArea.y2\n },\n highlightArea: {\n x1: contentArea.x1,\n y1: contentArea.y1,\n x2: contentArea.x2,\n y2: contentArea.y2\n }\n };\n\n return super.getElementArea(this.element);\n } else {\n this._contentAreaDimensions.left = {\n hoverArea: {\n x1: contentArea.x1,\n y1: contentArea.y1,\n x2: contentArea.x1 + contentWidth * 0.25,\n y2: contentArea.y2\n },\n highlightArea: {\n x1: contentArea.x1,\n y1: contentArea.y1,\n x2: contentArea.x1 + contentWidth * 0.5,\n y2: contentArea.y2\n }\n };\n\n this._contentAreaDimensions.top = {\n hoverArea: {\n x1: contentArea.x1 + contentWidth * 0.25,\n y1: contentArea.y1,\n x2: contentArea.x1 + contentWidth * 0.75,\n y2: contentArea.y1 + contentHeight * 0.5\n },\n highlightArea: {\n x1: contentArea.x1,\n y1: contentArea.y1,\n x2: contentArea.x2,\n y2: contentArea.y1 + contentHeight * 0.5\n }\n };\n\n this._contentAreaDimensions.right = {\n hoverArea: {\n x1: contentArea.x1 + contentWidth * 0.75,\n y1: contentArea.y1,\n x2: contentArea.x2,\n y2: contentArea.y2\n },\n highlightArea: {\n x1: contentArea.x1 + contentWidth * 0.5,\n y1: contentArea.y1,\n x2: contentArea.x2,\n y2: contentArea.y2\n }\n };\n\n this._contentAreaDimensions.bottom = {\n hoverArea: {\n x1: contentArea.x1 + contentWidth * 0.25,\n y1: contentArea.y1 + contentHeight * 0.5,\n x2: contentArea.x1 + contentWidth * 0.75,\n y2: contentArea.y2\n },\n highlightArea: {\n x1: contentArea.x1,\n y1: contentArea.y1 + contentHeight * 0.5,\n x2: contentArea.x2,\n y2: contentArea.y2\n }\n };\n\n return super.getElementArea(this.element);\n }\n }\n\n /**\n * Programmatically operate with header position.\n *\n * @param position -\n *\n * @returns previous header position\n * @internal\n */\n positionHeader(position: Side): void {\n if (this._header.side !== position) {\n this._header.setSide(position);\n this._headerSideChanged = true;\n this.setupHeaderPosition();\n }\n }\n\n /** @internal */\n private updateNodeSize(): void {\n if (this.element.style.display !== 'none') {\n const content: WidthAndHeight = getElementWidthAndHeight(this.element);\n\n if (this._header.show) {\n const dimension = this._header.leftRightSided ? WidthOrHeightPropertyName.width : WidthOrHeightPropertyName.height;\n content[dimension] -= this.layoutManager.layoutConfig.dimensions.headerHeight;\n }\n this._childElementContainer.style.width = numberToPixels(content.width);\n this._childElementContainer.style.height = numberToPixels(content.height);\n for (let i = 0; i < this.contentItems.length; i++) {\n this.contentItems[i].element.style.width = numberToPixels(content.width);\n this.contentItems[i].element.style.height = numberToPixels(content.height);\n }\n this.emit('resize');\n this.emitStateChangedEvent();\n }\n }\n\n /** @internal */\n private highlightHeaderDropZone(x: number): void {\n const visibleTabsLength = this._header.lastVisibleTabIndex + 1;\n const tabsContainerElement = this._header.tabsContainerElement;\n const tabsContainerElementChildNodes = tabsContainerElement.childNodes;\n\n // Create shallow copy of childNodes list, excluding DropPlaceHolder, as we will be modifying the childNodes list\n const visibleTabElements = new Array(visibleTabsLength);\n let tabIndex = 0;\n let tabCount = 0;\n while (tabCount < visibleTabsLength) {\n const visibleTabElement = tabsContainerElementChildNodes[tabIndex++] as HTMLElement;\n if (visibleTabElement !== this.layoutManager.tabDropPlaceholder) {\n visibleTabElements[tabCount++] = visibleTabElement;\n }\n }\n\n const dropTargetIndicator = this.layoutManager.dropTargetIndicator;\n if (dropTargetIndicator === null) {\n throw new UnexpectedNullError('SHHDZDTI97110');\n }\n\n let area: AreaLinkedRect;\n\n // Empty stack\n if (visibleTabsLength === 0) {\n const headerRect = this._header.element.getBoundingClientRect();\n const headerTop = headerRect.top + document.body.scrollTop;\n const headerLeft = headerRect.left + document.body.scrollLeft;\n\n area = {\n x1: headerLeft,\n x2: headerLeft + 100,\n y1: headerTop + headerRect.height - 20,\n y2: headerTop + headerRect.height,\n };\n\n this._dropIndex = 0;\n } else {\n let tabIndex = 0;\n // This indicates whether our cursor is exactly over a tab\n let isAboveTab = false;\n let tabTop: number;\n let tabLeft: number;\n let tabWidth: number;\n let tabElement: HTMLElement;\n do {\n tabElement = visibleTabElements[tabIndex] as HTMLElement;\n const tabRect = tabElement.getBoundingClientRect();\n const tabRectTop = tabRect.top + document.body.scrollTop;\n const tabRectLeft = tabRect.left + document.body.scrollLeft;\n\n if (this._header.leftRightSided) {\n tabLeft = tabRectTop;\n tabTop = tabRectLeft;\n tabWidth = tabRect.height;\n } else {\n tabLeft = tabRectLeft;\n tabTop = tabRectTop;\n tabWidth = tabRect.width;\n }\n\n if (x >= tabLeft && x < tabLeft + tabWidth) {\n isAboveTab = true;\n } else {\n tabIndex++;\n }\n } while (tabIndex < visibleTabsLength && !isAboveTab);\n\n // If we're not above any tabs, or to the right of any tab, we are out of the area, so give up\n if (isAboveTab === false && x < tabLeft) {\n return;\n }\n\n const halfX = tabLeft + tabWidth / 2;\n\n if (x < halfX) {\n this._dropIndex = tabIndex;\n tabElement.insertAdjacentElement('beforebegin', this.layoutManager.tabDropPlaceholder);\n } else {\n this._dropIndex = Math.min(tabIndex + 1, visibleTabsLength);\n tabElement.insertAdjacentElement('afterend', this.layoutManager.tabDropPlaceholder);\n }\n\n const tabDropPlaceholderRect = this.layoutManager.tabDropPlaceholder.getBoundingClientRect();\n const tabDropPlaceholderRectTop = tabDropPlaceholderRect.top + document.body.scrollTop;\n const tabDropPlaceholderRectLeft = tabDropPlaceholderRect.left + document.body.scrollLeft;\n const tabDropPlaceholderRectWidth = tabDropPlaceholderRect.width;\n\n if (this._header.leftRightSided) {\n const placeHolderTop = tabDropPlaceholderRectTop;\n area = {\n x1: tabTop,\n x2: tabTop + tabElement.clientHeight,\n y1: placeHolderTop,\n y2: placeHolderTop + tabDropPlaceholderRectWidth,\n };\n } else {\n const placeHolderLeft = tabDropPlaceholderRectLeft;\n\n area = {\n x1: placeHolderLeft,\n x2: placeHolderLeft + tabDropPlaceholderRectWidth,\n y1: tabTop,\n y2: tabTop + tabElement.clientHeight,\n };\n }\n }\n\n dropTargetIndicator.highlightArea(area, 0);\n return;\n }\n\n /** @internal */\n private resetHeaderDropZone() {\n this.layoutManager.tabDropPlaceholder.remove();\n }\n\n /** @internal */\n private setupHeaderPosition() {\n setElementDisplayVisibility(this._header.element, this._header.show);\n this.element.classList.remove(DomConstants.ClassName.Left, DomConstants.ClassName.Right, DomConstants.ClassName.Bottom);\n if (this._header.leftRightSided) {\n this.element.classList.add('lm_' + this._header.side);\n }\n\n //if ([Side.right, Side.bottom].includes(this._header.side)) {\n // // move the header behind the content.\n // this.element.appendChild(this._header.element);\n //}\n this.updateSize(false);\n }\n\n /** @internal */\n private highlightBodyDropZone(segment: Stack.Segment): void {\n if (this._contentAreaDimensions === undefined) {\n throw new UnexpectedUndefinedError('SHBDZC82265');\n } else {\n const highlightArea = this._contentAreaDimensions[segment].highlightArea;\n const dropTargetIndicator = this.layoutManager.dropTargetIndicator;\n if (dropTargetIndicator === null) {\n throw new UnexpectedNullError('SHBDZD96110');\n } else {\n dropTargetIndicator.highlightArea(highlightArea, 1);\n this._dropSegment = segment;\n }\n }\n }\n\n /** @internal */\n private handleResize() {\n this._header.updateTabSizes()\n }\n\n /** @internal */\n private handleMaximised() {\n this._header.processMaximised();\n }\n\n /** @internal */\n private handleMinimised() {\n this._header.processMinimised();\n }\n\n /** @internal */\n private handlePopoutEvent() {\n this.popout();\n }\n\n /** @internal */\n private handleHeaderClickEvent(ev: MouseEvent) {\n const eventName = EventEmitter.headerClickEventName;\n const bubblingEvent = new EventEmitter.ClickBubblingEvent(eventName, this, ev);\n this.emit(eventName, bubblingEvent);\n }\n\n /** @internal */\n private handleHeaderTouchStartEvent(ev: TouchEvent) {\n const eventName = EventEmitter.headerTouchStartEventName;\n const bubblingEvent = new EventEmitter.TouchStartBubblingEvent(eventName, this, ev);\n this.emit(eventName, bubblingEvent);\n }\n\n /** @internal */\n private handleHeaderComponentRemoveEvent(item: ComponentItem) {\n this.removeChild(item, false);\n }\n\n /** @internal */\n private handleHeaderComponentFocusEvent(item: ComponentItem) {\n this.setActiveComponentItem(item, true);\n }\n\n /** @internal */\n private handleHeaderComponentStartDragEvent(x: number, y: number, dragListener: DragListener, componentItem: ComponentItem) {\n if (this.isMaximised === true) {\n this.toggleMaximise();\n }\n this.layoutManager.startComponentDrag(x, y, dragListener, componentItem, this);\n }\n\n /** @internal */\n private createHeaderConfig() {\n if (!this._headerSideChanged) {\n return ResolvedHeaderedItemConfig.Header.createCopy(this._headerConfig);\n } else {\n const show = this._header.show ? this._header.side : false;\n\n let result = ResolvedHeaderedItemConfig.Header.createCopy(this._headerConfig, show);\n if (result === undefined) {\n result = {\n show,\n popout: undefined,\n maximise: undefined,\n close: undefined,\n minimise: undefined,\n tabDropdown: undefined,\n };\n }\n return result;\n }\n }\n\n /** @internal */\n private emitStateChangedEvent() {\n this.emitBaseBubblingEvent('stateChanged');\n }\n}\n\n/** @public */\nexport namespace Stack {\n /** @internal */\n export const enum Segment {\n Header = 'header',\n Body = 'body',\n Left = 'left',\n Right = 'right',\n Top = 'top',\n Bottom = 'bottom',\n }\n\n /** @internal */\n export interface ContentAreaDimension {\n hoverArea: AreaLinkedRect;\n highlightArea: AreaLinkedRect;\n }\n\n /** @internal */\n export type ContentAreaDimensions = {\n [segment: string]: ContentAreaDimension;\n };\n\n /** @internal */\n export function createElement(document: Document): HTMLDivElement {\n const element = document.createElement('div');\n element.classList.add(DomConstants.ClassName.Item);\n element.classList.add(DomConstants.ClassName.Stack);\n return element;\n }\n}\n","import { UnexpectedNullError, UnexpectedUndefinedError } from '../errors/internal-error';\nimport { ComponentItem } from '../items/component-item';\nimport { ContentItem } from '../items/content-item';\nimport { Stack } from '../items/stack';\nimport { LayoutManager } from '../layout-manager';\nimport { DomConstants } from '../utils/dom-constants';\nimport { DragListener } from '../utils/drag-listener';\nimport { EventEmitter } from '../utils/event-emitter';\nimport { Side } from '../utils/types';\nimport {\n numberToPixels\n} from '../utils/utils';\n\n/**\n * This class creates a temporary container\n * for the component whilst it is being dragged\n * and handles drag events\n * @internal\n */\nexport class DragProxy extends EventEmitter {\n private _area: ContentItem.Area | null = null;\n private _lastValidArea: ContentItem.Area | null = null;\n private _minX: number;\n private _minY: number;\n private _maxX: number;\n private _maxY: number;\n private _sided: boolean;\n private _element: HTMLElement;\n private _proxyContainerElement: HTMLElement;\n private _componentItemFocused: boolean;\n\n get element(): HTMLElement { return this._element; }\n\n /**\n * @param x - The initial x position\n * @param y - The initial y position\n * @internal\n */\n constructor(x: number, y: number,\n private readonly _dragListener: DragListener,\n private readonly _layoutManager: LayoutManager,\n private readonly _componentItem: ComponentItem,\n private readonly _originalParent: ContentItem) {\n\n super();\n\n this._dragListener.on('drag', (offsetX, offsetY, event) => this.onDrag(offsetX, offsetY, event));\n this._dragListener.on('dragStop', () => this.onDrop());\n\n this.createDragProxyElements(x, y);\n\n if (this._componentItem.parent === null) {\n // Note that _contentItem will have dummy GroundItem as parent if initiated by a external drag source\n throw new UnexpectedNullError('DPC10097');\n }\n\n this._componentItemFocused = this._componentItem.focused;\n if (this._componentItemFocused) {\n this._componentItem.blur();\n }\n this._componentItem.parent.removeChild(this._componentItem, true);\n\n this.setDimensions();\n\n document.body.appendChild(this._element);\n\n this.determineMinMaxXY();\n this._layoutManager.calculateItemAreas();\n this.setDropPosition(x, y);\n }\n\n /** Create Stack-like structure to contain the dragged component */\n private createDragProxyElements(initialX: number, initialY: number): void {\n this._element = document.createElement('div');\n this._element.classList.add(DomConstants.ClassName.DragProxy);\n const headerElement = document.createElement('div');\n headerElement.classList.add(DomConstants.ClassName.Header);\n const tabsElement = document.createElement('div');\n tabsElement.classList.add(DomConstants.ClassName.Tabs);\n const tabElement = document.createElement('div');\n tabElement.classList.add(DomConstants.ClassName.Tab);\n const titleElement = document.createElement('span');\n titleElement.classList.add(DomConstants.ClassName.Title);\n tabElement.appendChild(titleElement);\n tabsElement.appendChild(tabElement);\n headerElement.appendChild(tabsElement);\n\n this._proxyContainerElement = document.createElement('div');\n this._proxyContainerElement.classList.add(DomConstants.ClassName.Content);\n\n this._element.appendChild(headerElement);\n this._element.appendChild(this._proxyContainerElement);\n\n if (this._originalParent instanceof Stack && this._originalParent.headerShow) {\n this._sided = this._originalParent.headerLeftRightSided;\n this._element.classList.add('lm_' + this._originalParent.headerSide);\n if ([Side.right, Side.bottom].indexOf(this._originalParent.headerSide) >= 0) {\n this._proxyContainerElement.insertAdjacentElement('afterend', headerElement);\n }\n }\n this._element.style.left = numberToPixels(initialX);\n this._element.style.top = numberToPixels(initialY);\n tabElement.setAttribute('title', this._componentItem.title);\n titleElement.insertAdjacentText('afterbegin', this._componentItem.title);\n this._proxyContainerElement.appendChild(this._componentItem.element);\n }\n\n private determineMinMaxXY(): void {\n const groundItem = this._layoutManager.groundItem;\n if (groundItem === undefined) {\n throw new UnexpectedUndefinedError('DPDMMXY73109');\n } else {\n const groundElement = groundItem.element;\n const rect = groundElement.getBoundingClientRect();\n this._minX = rect.left + document.body.scrollLeft;\n this._minY = rect.top + document.body.scrollTop;\n this._maxX = this._minX + rect.width;\n this._maxY = this._minY + rect.height;\n }\n }\n\n /**\n * Callback on every mouseMove event during a drag. Determines if the drag is\n * still within the valid drag area and calls the layoutManager to highlight the\n * current drop area\n *\n * @param offsetX - The difference from the original x position in px\n * @param offsetY - The difference from the original y position in px\n * @param event -\n * @internal\n */\n private onDrag(offsetX: number, offsetY: number, event: PointerEvent) {\n\n const x = event.pageX;\n const y = event.pageY;\n\n this.setDropPosition(x, y);\n this._componentItem.drag();\n }\n\n /**\n * Sets the target position, highlighting the appropriate area\n *\n * @param x - The x position in px\n * @param y - The y position in px\n *\n * @internal\n */\n private setDropPosition(x: number, y: number): void {\n if (this._layoutManager.layoutConfig.settings.constrainDragToContainer) {\n if (x <= this._minX) {\n x = Math.ceil(this._minX);\n } else if (x >= this._maxX) {\n x = Math.floor(this._maxX);\n }\n\n if (y <= this._minY) {\n y = Math.ceil(this._minY);\n } else if (y >= this._maxY) {\n y = Math.floor(this._maxY);\n }\n }\n\n this._element.style.left = numberToPixels(x);\n this._element.style.top = numberToPixels(y);\n this._area = this._layoutManager.getArea(x, y);\n\n if (this._area !== null) {\n this._lastValidArea = this._area;\n this._area.contentItem.highlightDropZone(x, y, this._area);\n }\n }\n\n /**\n * Callback when the drag has finished. Determines the drop area\n * and adds the child to it\n * @internal\n */\n private onDrop(): void {\n const dropTargetIndicator = this._layoutManager.dropTargetIndicator;\n if (dropTargetIndicator === null) {\n throw new UnexpectedNullError('DPOD30011');\n } else {\n dropTargetIndicator.hide();\n }\n\n this._componentItem.exitDragMode();\n\n /*\n * Valid drop area found\n */\n let droppedComponentItem: ComponentItem | undefined;\n if (this._area !== null) {\n droppedComponentItem = this._componentItem;\n this._area.contentItem.onDrop(droppedComponentItem, this._area);\n\n /**\n * No valid drop area available at present, but one has been found before.\n * Use it\n */\n } else if (this._lastValidArea !== null) {\n droppedComponentItem = this._componentItem;\n const newParentContentItem = this._lastValidArea.contentItem;\n newParentContentItem.onDrop(droppedComponentItem, this._lastValidArea);\n\n /**\n * No valid drop area found during the duration of the drag. Return\n * content item to its original position if a original parent is provided.\n * (Which is not the case if the drag had been initiated by createDragSource)\n */\n } else if (this._originalParent) {\n droppedComponentItem = this._componentItem;\n this._originalParent.addChild(droppedComponentItem);\n\n /**\n * The drag didn't ultimately end up with adding the content item to\n * any container. In order to ensure clean up happens, destroy the\n * content item.\n */\n } else {\n this._componentItem.destroy(); // contentItem children are now destroyed as well\n }\n\n this._element.remove();\n\n this._layoutManager.emit('itemDropped', this._componentItem);\n\n if (this._componentItemFocused && droppedComponentItem !== undefined) {\n droppedComponentItem.focus();\n }\n }\n\n /**\n * Updates the Drag Proxy's dimensions\n * @internal\n */\n private setDimensions() {\n const dimensions = this._layoutManager.layoutConfig.dimensions;\n if (dimensions === undefined) {\n throw new Error('DragProxy.setDimensions: dimensions undefined');\n }\n\n let width = dimensions.dragProxyWidth;\n let height = dimensions.dragProxyHeight;\n if (width === undefined || height === undefined) {\n throw new Error('DragProxy.setDimensions: width and/or height undefined');\n }\n\n const headerHeight = this._layoutManager.layoutConfig.header.show === false ? 0 : dimensions.headerHeight;\n this._element.style.width = numberToPixels(width);\n this._element.style.height = numberToPixels(height)\n width -= (this._sided ? headerHeight : 0);\n height -= (!this._sided ? headerHeight : 0);\n this._proxyContainerElement.style.width = numberToPixels(width);\n this._proxyContainerElement.style.height = numberToPixels(height);\n this._componentItem.enterDragMode(width, height);\n this._componentItem.show();\n }\n}\n","import { DomConstants } from '../utils/dom-constants';\nimport { DragListener } from '../utils/drag-listener';\nimport { EventEmitter } from '../utils/event-emitter';\nimport { numberToPixels } from '../utils/utils';\n\n/** @internal */\nexport class Splitter {\n private _grabSize;\n private _dragListener: DragListener;\n\n private readonly _element: HTMLDivElement;\n\n get element(): HTMLDivElement { return this._element; }\n\n constructor(private _isVertical: boolean, private _size: number, grabSize: number) {\n this._grabSize = grabSize < this._size ? this._size : grabSize;\n\n this._element = document.createElement('div');\n this._element.classList.add(DomConstants.ClassName.Splitter);\n const dragHandleElement = document.createElement('div');\n dragHandleElement.classList.add(DomConstants.ClassName.DragHandle);\n\n const handleExcessSize = this._grabSize - this._size;\n const handleExcessPos = handleExcessSize / 2;\n\n if (this._isVertical) {\n dragHandleElement.style.top = numberToPixels(-handleExcessPos);\n dragHandleElement.style.height = numberToPixels(this._size + handleExcessSize);\n this._element.classList.add(DomConstants.ClassName.Vertical);\n this._element.style.height = numberToPixels(this._size);\n } else {\n dragHandleElement.style.left = numberToPixels(-handleExcessPos);\n dragHandleElement.style.width = numberToPixels(this._size + handleExcessSize);\n this._element.classList.add(DomConstants.ClassName.Horizontal);\n this._element.style.width = numberToPixels(this._size);\n }\n\n this._element.appendChild(dragHandleElement);\n\n this._dragListener = new DragListener(this._element, [dragHandleElement]);\n }\n\n destroy(): void {\n this._element.remove();\n }\n\n on(eventName: K, callback: EventEmitter.Callback): void {\n this._dragListener.on(eventName, callback);\n }\n}\n","import { ComponentItemConfig, ItemConfig, RowOrColumnItemConfig, StackItemConfig } from '../config/config'\nimport { ResolvedRowOrColumnItemConfig, ResolvedStackItemConfig } from '../config/resolved-config'\nimport { Splitter } from '../controls/splitter'\nimport { AssertError, UnexpectedNullError } from '../errors/internal-error'\nimport { LayoutManager } from '../layout-manager'\nimport { DomConstants } from '../utils/dom-constants'\nimport { ItemType, JsonValue, SizeUnitEnum, WidthOrHeightPropertyName } from '../utils/types'\nimport {\n getElementHeight,\n getElementWidth,\n getElementWidthAndHeight,\n numberToPixels,\n pixelsToNumber,\n setElementHeight,\n setElementWidth\n} from \"../utils/utils\"\nimport { ComponentItem } from './component-item'\nimport { ContentItem } from './content-item'\n\n/** @public */\nexport class RowOrColumn extends ContentItem {\n /** @internal */\n private readonly _childElementContainer: HTMLElement;\n /** @internal */\n private readonly _configType: 'row' | 'column';\n /** @internal */\n private readonly _isColumn: boolean;\n /** @internal */\n private readonly _splitterSize: number;\n /** @internal */\n private readonly _splitterGrabSize: number;\n /** @internal */\n private readonly _dimension: WidthOrHeightPropertyName;\n /** @internal */\n private readonly _splitter: Splitter[] = [];\n /** @internal */\n private _splitterPosition: number | null;\n /** @internal */\n private _splitterMinPosition: number | null;\n /** @internal */\n private _splitterMaxPosition: number | null;\n\n /** @internal */\n constructor(isColumn: boolean, layoutManager: LayoutManager, config: ResolvedRowOrColumnItemConfig,\n /** @internal */\n private _rowOrColumnParent: ContentItem\n ) {\n super(layoutManager, config, _rowOrColumnParent, RowOrColumn.createElement(document, isColumn));\n\n this.isRow = !isColumn;\n this.isColumn = isColumn;\n\n this._childElementContainer = this.element;\n this._splitterSize = layoutManager.layoutConfig.dimensions.borderWidth;\n this._splitterGrabSize = layoutManager.layoutConfig.dimensions.borderGrabWidth;\n this._isColumn = isColumn;\n this._dimension = isColumn ? 'height' : 'width';\n this._splitterPosition = null;\n this._splitterMinPosition = null;\n this._splitterMaxPosition = null;\n\n switch (config.type) {\n case ItemType.row:\n case ItemType.column:\n this._configType = config.type;\n break;\n default:\n throw new AssertError('ROCCCT00925');\n }\n }\n\n newComponent(componentType: JsonValue, componentState?: JsonValue, title?: string, index?: number): ComponentItem {\n const itemConfig: ComponentItemConfig = {\n type: 'component',\n componentType,\n componentState,\n title,\n };\n return this.newItem(itemConfig, index) as ComponentItem;\n }\n\n addComponent(componentType: JsonValue, componentState?: JsonValue, title?: string, index?: number): number {\n const itemConfig: ComponentItemConfig = {\n type: 'component',\n componentType,\n componentState,\n title,\n };\n return this.addItem(itemConfig, index);\n }\n\n newItem(itemConfig: RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig, index?: number): ContentItem {\n index = this.addItem(itemConfig, index);\n const createdItem = this.contentItems[index];\n\n if (ContentItem.isStack(createdItem) && (ItemConfig.isComponent(itemConfig))) {\n // createdItem is a Stack which was created to hold wanted component. Return component\n return createdItem.contentItems[0];\n } else {\n return createdItem;\n }\n }\n\n addItem(itemConfig: RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig,\n index?: number\n ): number {\n this.layoutManager.checkMinimiseMaximisedStack();\n const resolvedItemConfig = ItemConfig.resolve(itemConfig, false);\n const contentItem = this.layoutManager.createAndInitContentItem(resolvedItemConfig, this);\n return this.addChild(contentItem, index, false);\n }\n\n /**\n * Add a new contentItem to the Row or Column\n *\n * @param contentItem -\n * @param index - The position of the new item within the Row or Column.\n * If no index is provided the item will be added to the end\n * @param suspendResize - If true the items won't be resized. This will leave the item in\n * an inconsistent state and is only intended to be used if multiple\n * children need to be added in one go and resize is called afterwards\n *\n * @returns\n */\n override addChild(contentItem: ContentItem, index?: number, suspendResize?: boolean): number {\n\n // contentItem = this.layoutManager._$normalizeContentItem(contentItem, this);\n\n if (index === undefined) {\n index = this.contentItems.length;\n }\n\n if (this.contentItems.length > 0) {\n const splitterElement = this.createSplitter(Math.max(0, index - 1)).element;\n\n if (index > 0) {\n this.contentItems[index - 1].element.insertAdjacentElement('afterend', splitterElement);\n splitterElement.insertAdjacentElement('afterend', contentItem.element);\n } else {\n this.contentItems[0].element.insertAdjacentElement('beforebegin', splitterElement);\n splitterElement.insertAdjacentElement('beforebegin', contentItem.element);\n }\n } else {\n this._childElementContainer.appendChild(contentItem.element);\n }\n\n super.addChild(contentItem, index);\n\n const newItemSize = (1 / this.contentItems.length) * 100;\n\n if (suspendResize === true) {\n this.emitBaseBubblingEvent('stateChanged');\n return index;\n }\n\n for (let i = 0; i < this.contentItems.length; i++) {\n const indexedContentItem = this.contentItems[i];\n if (indexedContentItem === contentItem) {\n contentItem.size = newItemSize;\n } else {\n const itemSize = indexedContentItem.size *= (100 - newItemSize) / 100;\n indexedContentItem.size = itemSize;\n }\n }\n\n this.updateSize(false);\n this.emitBaseBubblingEvent('stateChanged');\n\n return index;\n }\n\n /**\n * Removes a child of this element\n *\n * @param contentItem -\n * @param keepChild - If true the child will be removed, but not destroyed\n *\n */\n override removeChild(contentItem: ContentItem, keepChild: boolean): void {\n const index = this.contentItems.indexOf(contentItem);\n const splitterIndex = Math.max(index - 1, 0);\n\n if (index === -1) {\n throw new Error('Can\\'t remove child. ContentItem is not child of this Row or Column');\n }\n\n /**\n * Remove the splitter before the item or after if the item happens\n * to be the first in the row/column\n */\n if (this._splitter[splitterIndex]) {\n this._splitter[splitterIndex].destroy();\n this._splitter.splice(splitterIndex, 1);\n }\n\n super.removeChild(contentItem, keepChild);\n\n if (this.contentItems.length === 1 && this.isClosable === true) {\n const childItem = this.contentItems[0];\n this.contentItems.length = 0;\n this._rowOrColumnParent.replaceChild(this, childItem, true);\n } else {\n this.updateSize(false);\n this.emitBaseBubblingEvent('stateChanged');\n }\n }\n\n /**\n * Replaces a child of this Row or Column with another contentItem\n */\n override replaceChild(oldChild: ContentItem, newChild: ContentItem): void {\n const size = oldChild.size;\n super.replaceChild(oldChild, newChild);\n newChild.size = size;\n this.updateSize(false);\n this.emitBaseBubblingEvent('stateChanged');\n }\n\n /**\n * Called whenever the dimensions of this item or one of its parents change\n */\n override updateSize(force: boolean): void {\n this.layoutManager.beginVirtualSizedContainerAdding();\n try {\n this.updateNodeSize();\n this.updateContentItemsSize(force);\n } finally {\n this.layoutManager.endVirtualSizedContainerAdding();\n }\n }\n\n /**\n * Invoked recursively by the layout manager. ContentItem.init appends\n * the contentItem's DOM elements to the container, RowOrColumn init adds splitters\n * in between them\n * @internal\n */\n override init(): void {\n if (this.isInitialised === true) return;\n\n this.updateNodeSize();\n\n for (let i = 0; i < this.contentItems.length; i++) {\n this._childElementContainer.appendChild(this.contentItems[i].element);\n }\n\n super.init();\n\n for (let i = 0; i < this.contentItems.length - 1; i++) {\n this.contentItems[i].element.insertAdjacentElement('afterend', this.createSplitter(i).element);\n }\n\n this.initContentItems();\n }\n\n toConfig(): ResolvedRowOrColumnItemConfig {\n const result: ResolvedRowOrColumnItemConfig = {\n type: this.type as 'row' | 'column',\n content: this.calculateConfigContent() as (ResolvedRowOrColumnItemConfig | ResolvedStackItemConfig)[],\n size: this.size,\n sizeUnit: this.sizeUnit,\n minSize: this.minSize,\n minSizeUnit: this.minSizeUnit,\n id: this.id,\n isClosable: this.isClosable,\n }\n return result;\n }\n\n /** @internal */\n protected override setParent(parent: ContentItem): void {\n this._rowOrColumnParent = parent;\n super.setParent(parent);\n }\n\n /** @internal */\n private updateNodeSize(): void {\n if (this.contentItems.length > 0) {\n this.calculateRelativeSizes();\n this.setAbsoluteSizes();\n }\n this.emitBaseBubblingEvent('stateChanged');\n this.emit('resize');\n }\n\n /**\n * Turns the relative sizes calculated by calculateRelativeSizes into\n * absolute pixel values and applies them to the children's DOM elements\n *\n * Assigns additional pixels to counteract Math.floor\n * @internal\n */\n private setAbsoluteSizes() {\n const absoluteSizes = this.calculateAbsoluteSizes();\n\n for (let i = 0; i < this.contentItems.length; i++) {\n if (absoluteSizes.additionalPixel - i > 0) {\n absoluteSizes.itemSizes[i]++;\n }\n\n if (this._isColumn) {\n setElementWidth(this.contentItems[i].element, absoluteSizes.crossAxisSize);\n setElementHeight(this.contentItems[i].element, absoluteSizes.itemSizes[i]);\n } else {\n setElementWidth(this.contentItems[i].element, absoluteSizes.itemSizes[i]);\n setElementHeight(this.contentItems[i].element, absoluteSizes.crossAxisSize);\n }\n }\n }\n\n /**\n * Calculates the absolute sizes of all of the children of this Item.\n * @returns Set with absolute sizes and additional pixels.\n * @internal\n */\n private calculateAbsoluteSizes(): RowOrColumn.AbsoluteSizes {\n const totalSplitterSize = (this.contentItems.length - 1) * this._splitterSize;\n const { width: elementWidth, height: elementHeight } = getElementWidthAndHeight(this.element);\n\n let totalSize: number;\n let crossAxisSize: number;\n if (this._isColumn) {\n totalSize = elementHeight - totalSplitterSize;\n crossAxisSize = elementWidth;\n } else {\n totalSize = elementWidth - totalSplitterSize;\n crossAxisSize = elementHeight;\n }\n\n let totalAssigned = 0;\n const itemSizes = [];\n\n for (let i = 0; i < this.contentItems.length; i++) {\n const contentItem = this.contentItems[i];\n let itemSize: number;\n if (contentItem.sizeUnit === SizeUnitEnum.Percent) {\n itemSize = Math.floor(totalSize * (contentItem.size / 100));\n } else {\n throw new AssertError('ROCCAS6692');\n }\n\n totalAssigned += itemSize;\n itemSizes.push(itemSize);\n }\n\n const additionalPixel = Math.floor(totalSize - totalAssigned);\n\n return {\n itemSizes,\n additionalPixel,\n totalSize,\n crossAxisSize,\n };\n }\n\n /**\n * Calculates the relative sizes of all children of this Item. The logic\n * is as follows:\n *\n * - Add up the total size of all items that have a configured size\n *\n * - If the total == 100 (check for floating point errors)\n * Excellent, job done\n *\n * - If the total is \\> 100,\n * set the size of items without set dimensions to 1/3 and add this to the total\n * set the size off all items so that the total is hundred relative to their original size\n *\n * - If the total is \\< 100\n * If there are items without set dimensions, distribute the remainder to 100 evenly between them\n * If there are no items without set dimensions, increase all items sizes relative to\n * their original size so that they add up to 100\n *\n * @internal\n */\n private calculateRelativeSizes() {\n\n let total = 0;\n const itemsWithFractionalSize: ContentItem[] = [];\n let totalFractionalSize = 0;\n\n for (let i = 0; i < this.contentItems.length; i++) {\n const contentItem = this.contentItems[i];\n const sizeUnit = contentItem.sizeUnit;\n switch (sizeUnit) {\n case SizeUnitEnum.Percent: {\n total += contentItem.size;\n break;\n }\n case SizeUnitEnum.Fractional: {\n itemsWithFractionalSize.push(contentItem);\n totalFractionalSize += contentItem.size;\n break;\n }\n default:\n throw new AssertError('ROCCRS49110', JSON.stringify(contentItem));\n }\n }\n\n /**\n * Everything adds up to hundred, all good :-)\n */\n if (Math.round(total) === 100) {\n this.respectMinItemSize();\n return;\n } else {\n /**\n * Allocate the remaining size to the items with a fractional size\n */\n if (Math.round(total) < 100 && itemsWithFractionalSize.length > 0) {\n const fractionalAllocatedSize = 100 - total;\n for (let i = 0; i < itemsWithFractionalSize.length; i++) {\n const contentItem = itemsWithFractionalSize[i];\n contentItem.size = fractionalAllocatedSize * (contentItem.size / totalFractionalSize);\n contentItem.sizeUnit = SizeUnitEnum.Percent;\n }\n this.respectMinItemSize();\n return;\n } else {\n\n /**\n * If the total is > 100, but there are also items with a fractional size, assign another 50%\n * to the fractional items\n *\n * This will be reset in the next step\n */\n if (Math.round(total) > 100 && itemsWithFractionalSize.length > 0) {\n for (let i = 0; i < itemsWithFractionalSize.length; i++) {\n const contentItem = itemsWithFractionalSize[i];\n contentItem.size = 50 * (contentItem.size / totalFractionalSize);\n contentItem.sizeUnit = SizeUnitEnum.Percent;\n }\n total += 50;\n }\n\n /**\n * Set every items size relative to 100 relative to its size to total\n */\n for (let i = 0; i < this.contentItems.length; i++) {\n const contentItem = this.contentItems[i];\n contentItem.size = (contentItem.size / total) * 100;\n }\n\n this.respectMinItemSize();\n }\n }\n }\n\n /**\n * Adjusts the column widths to respect the dimensions minItemWidth if set.\n * @internal\n */\n private respectMinItemSize() {\n interface Entry {\n size: number;\n }\n\n const minItemSize = this.calculateContentItemMinSize(this);\n\n if (minItemSize <= 0 || this.contentItems.length <= 1) {\n return;\n } else {\n let totalOverMin = 0;\n let totalUnderMin = 0;\n const entriesOverMin: Entry[] = [];\n const allEntries: Entry[] = [];\n\n const absoluteSizes = this.calculateAbsoluteSizes();\n\n /**\n * Figure out how much we are under the min item size total and how much room we have to use.\n */\n for (let i = 0; i < absoluteSizes.itemSizes.length; i++) {\n const itemSize = absoluteSizes.itemSizes[i];\n\n let entry: Entry;\n if (itemSize < minItemSize) {\n totalUnderMin += minItemSize - itemSize;\n entry = {\n size: minItemSize\n };\n\n } else {\n totalOverMin += itemSize - minItemSize;\n entry = {\n size: itemSize\n };\n entriesOverMin.push(entry);\n }\n\n allEntries.push(entry);\n }\n\n /**\n * If there is nothing under min, or there is not enough over to make up the difference, do nothing.\n */\n if (totalUnderMin === 0 || totalUnderMin > totalOverMin) {\n return;\n } else {\n /**\n * Evenly reduce all columns that are over the min item width to make up the difference.\n */\n const reducePercent = totalUnderMin / totalOverMin;\n let remainingSize = totalUnderMin;\n for (let i = 0; i < entriesOverMin.length; i++) {\n const entry = entriesOverMin[i];\n const reducedSize = Math.round((entry.size - minItemSize) * reducePercent);\n remainingSize -= reducedSize;\n entry.size -= reducedSize;\n }\n\n /**\n * Take anything remaining from the last item.\n */\n if (remainingSize !== 0) {\n allEntries[allEntries.length - 1].size -= remainingSize;\n }\n\n /**\n * Set every items size relative to 100 relative to its size to total\n */\n for (let i = 0; i < this.contentItems.length; i++) {\n const contentItem = this.contentItems[i];\n contentItem.size = (allEntries[i].size / absoluteSizes.totalSize) * 100;\n }\n }\n }\n }\n\n /**\n * Instantiates a new Splitter, binds events to it and adds\n * it to the array of splitters at the position specified as the index argument\n *\n * What it doesn't do though is append the splitter to the DOM\n *\n * @param index - The position of the splitter\n *\n * @returns\n * @internal\n */\n private createSplitter(index: number): Splitter {\n const splitter = new Splitter(this._isColumn, this._splitterSize, this._splitterGrabSize);\n splitter.on('drag', (offsetX, offsetY) => this.onSplitterDrag(splitter, offsetX, offsetY));\n splitter.on('dragStop', () => this.onSplitterDragStop(splitter));\n splitter.on('dragStart', () => this.onSplitterDragStart(splitter));\n this._splitter.splice(index, 0, splitter);\n return splitter;\n }\n\n /**\n * Locates the instance of Splitter in the array of\n * registered splitters and returns a map containing the contentItem\n * before and after the splitters, both of which are affected if the\n * splitter is moved\n *\n * @returns A map of contentItems that the splitter affects\n * @internal\n */\n private getSplitItems(splitter: Splitter) {\n const index = this._splitter.indexOf(splitter);\n\n return {\n before: this.contentItems[index],\n after: this.contentItems[index + 1]\n };\n }\n\n private calculateContentItemMinSize(contentItem: ContentItem) {\n const minSize = contentItem.minSize;\n if (minSize !== undefined) {\n if (contentItem.minSizeUnit === SizeUnitEnum.Pixel) {\n return minSize;\n } else {\n throw new AssertError('ROCGMD98831', JSON.stringify(contentItem));\n }\n } else {\n const dimensions = this.layoutManager.layoutConfig.dimensions;\n return this._isColumn ? dimensions.defaultMinItemHeight : dimensions.defaultMinItemWidth;\n }\n }\n\n /**\n * Gets the minimum dimensions for the given item configuration array\n * @internal\n */\n private calculateContentItemsTotalMinSize(contentItems: readonly ContentItem[]) {\n let totalMinSize = 0;\n\n for (const contentItem of contentItems) {\n totalMinSize += this.calculateContentItemMinSize(contentItem);\n }\n\n return totalMinSize;\n }\n\n /**\n * Invoked when a splitter's dragListener fires dragStart. Calculates the splitters\n * movement area once (so that it doesn't need calculating on every mousemove event)\n * @internal\n */\n private onSplitterDragStart(splitter: Splitter) {\n const items = this.getSplitItems(splitter);\n\n const beforeWidth = pixelsToNumber(items.before.element.style[this._dimension]);\n const afterSize = pixelsToNumber(items.after.element.style[this._dimension]);\n const beforeMinSize = this.calculateContentItemsTotalMinSize(items.before.contentItems);\n const afterMinSize = this.calculateContentItemsTotalMinSize(items.after.contentItems);\n\n this._splitterPosition = 0;\n this._splitterMinPosition = -1 * (beforeWidth - beforeMinSize);\n this._splitterMaxPosition = afterSize - afterMinSize;\n }\n\n /**\n * Invoked when a splitter's DragListener fires drag. Updates the splitter's DOM position,\n * but not the sizes of the elements the splitter controls in order to minimize resize events\n *\n * @param splitter -\n * @param offsetX - Relative pixel values to the splitter's original position. Can be negative\n * @param offsetY - Relative pixel values to the splitter's original position. Can be negative\n * @internal\n */\n private onSplitterDrag(splitter: Splitter, offsetX: number, offsetY: number) {\n let offset = this._isColumn ? offsetY : offsetX;\n\n if (this._splitterMinPosition === null || this._splitterMaxPosition === null) {\n throw new UnexpectedNullError('ROCOSD59226');\n }\n offset = Math.max(offset, this._splitterMinPosition);\n offset = Math.min(offset, this._splitterMaxPosition);\n\n this._splitterPosition = offset;\n const offsetPixels = numberToPixels(offset);\n if (this._isColumn) {\n splitter.element.style.top = offsetPixels;\n } else {\n splitter.element.style.left = offsetPixels;\n }\n }\n\n /**\n * Invoked when a splitter's DragListener fires dragStop. Resets the splitters DOM position,\n * and applies the new sizes to the elements before and after the splitter and their children\n * on the next animation frame\n * @internal\n */\n private onSplitterDragStop(splitter: Splitter) {\n if (this._splitterPosition === null) {\n throw new UnexpectedNullError('ROCOSDS66932');\n } else {\n const items = this.getSplitItems(splitter);\n const sizeBefore = pixelsToNumber(items.before.element.style[this._dimension]);\n const sizeAfter = pixelsToNumber(items.after.element.style[this._dimension]);\n const splitterPositionInRange = (this._splitterPosition + sizeBefore) / (sizeBefore + sizeAfter);\n const totalRelativeSize = items.before.size + items.after.size;\n\n items.before.size = splitterPositionInRange * totalRelativeSize;\n items.after.size = (1 - splitterPositionInRange) * totalRelativeSize;\n\n splitter.element.style.top = numberToPixels(0);\n splitter.element.style.left = numberToPixels(0);\n\n globalThis.requestAnimationFrame(() => this.updateSize(false));\n }\n }\n}\n\n/** @public */\nexport namespace RowOrColumn {\n /** @internal */\n export interface AbsoluteSizes {\n itemSizes: number[],\n additionalPixel: number,\n totalSize: number,\n crossAxisSize: number\n }\n\n /** @internal */\n export function getElementDimensionSize(element: HTMLElement, dimension: WidthOrHeightPropertyName): number {\n if (dimension === 'width') {\n return getElementWidth(element);\n } else {\n return getElementHeight(element);\n }\n }\n\n /** @internal */\n export function setElementDimensionSize(element: HTMLElement, dimension: WidthOrHeightPropertyName, value: number): void {\n if (dimension === 'width') {\n return setElementWidth(element, value);\n } else {\n return setElementHeight(element, value);\n }\n }\n\n /** @internal */\n export function createElement(document: Document, isColumn: boolean): HTMLDivElement {\n const element = document.createElement('div');\n element.classList.add(DomConstants.ClassName.Item);\n if (isColumn) {\n element.classList.add(DomConstants.ClassName.Column);\n } else {\n element.classList.add(DomConstants.ClassName.Row);\n }\n return element;\n }\n}\n","import { ComponentItemConfig, ItemConfig, RowOrColumnItemConfig, StackItemConfig } from '../config/config';\nimport { ResolvedComponentItemConfig, ResolvedGroundItemConfig, ResolvedHeaderedItemConfig, ResolvedItemConfig, ResolvedRootItemConfig, ResolvedStackItemConfig } from '../config/resolved-config';\nimport { AssertError, UnexpectedNullError } from '../errors/internal-error';\nimport { LayoutManager } from '../layout-manager';\nimport { DomConstants } from '../utils/dom-constants';\nimport { AreaLinkedRect, ItemType, SizeUnitEnum } from '../utils/types';\nimport { getElementWidthAndHeight, setElementHeight, setElementWidth } from '../utils/utils';\nimport { ComponentItem } from './component-item';\nimport { ComponentParentableItem } from './component-parentable-item';\nimport { ContentItem } from './content-item';\nimport { RowOrColumn } from './row-or-column';\n\n/**\n * GroundItem is the ContentItem whose one child is the root ContentItem (Root is planted in Ground).\n * (Previously it was called root however this was incorrect as its child is the root item)\n * There is only one instance of GroundItem and it is automatically created by the Layout Manager\n * @internal\n */\nexport class GroundItem extends ComponentParentableItem {\n private readonly _childElementContainer: HTMLElement;\n private readonly _containerElement: HTMLElement;\n\n constructor(layoutManager: LayoutManager, rootItemConfig: ResolvedRootItemConfig | undefined, containerElement: HTMLElement) {\n\n super(layoutManager, ResolvedGroundItemConfig.create(rootItemConfig), null, GroundItem.createElement(document));\n\n this.isGround = true;\n this._childElementContainer = this.element;\n this._containerElement = containerElement;\n\n // insert before any pre-existing content elements\n let before = null;\n while (true) {\n const prev: ChildNode | null =\n before ? before.previousSibling : this._containerElement.lastChild;\n if (prev instanceof Element\n && prev.classList.contains(DomConstants.ClassName.Content)) {\n before = prev;\n } else {\n break;\n }\n }\n this._containerElement.insertBefore(this.element, before);\n }\n\n override init(): void {\n if (this.isInitialised === true) return;\n\n this.updateNodeSize();\n\n for (let i = 0; i < this.contentItems.length; i++) {\n this._childElementContainer.appendChild(this.contentItems[i].element);\n }\n\n super.init();\n\n this.initContentItems();\n }\n\n /**\n * Loads a new Layout\n * Internal only. To load a new layout with API, use {@link (LayoutManager:class).loadLayout}\n */\n loadRoot(rootItemConfig: ResolvedRootItemConfig | undefined): void {\n // Remove existing root if it exists\n this.clearRoot();\n\n if (rootItemConfig !== undefined) {\n const rootContentItem = this.layoutManager.createAndInitContentItem(rootItemConfig, this);\n this.addChild(rootContentItem, 0);\n }\n }\n\n clearRoot(): void {\n // Remove existing root if it exists\n const contentItems = this.contentItems;\n switch (contentItems.length) {\n case 0: {\n return;\n }\n case 1: {\n const existingRootContentItem = contentItems[0];\n existingRootContentItem.remove();\n return;\n }\n default: {\n throw new AssertError('GILR07721');\n }\n }\n }\n\n /**\n * Adds a ContentItem child to root ContentItem.\n * Internal only. To load a add with API, use {@link (LayoutManager:class).addItem}\n * @returns -1 if added as root otherwise index in root ContentItem's content\n */\n addItem(itemConfig: RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig,\n index?: number\n ): number {\n this.layoutManager.checkMinimiseMaximisedStack();\n\n const resolvedItemConfig = ItemConfig.resolve(itemConfig, false);\n let parent: ContentItem;\n if (this.contentItems.length > 0) {\n parent = this.contentItems[0];\n } else {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n parent = this;\n }\n if (parent.isComponent) {\n throw new Error('Cannot add item as child to ComponentItem');\n } else {\n const contentItem = this.layoutManager.createAndInitContentItem(resolvedItemConfig, parent);\n index = parent.addChild(contentItem, index);\n return (parent === this) ? -1 : index;\n }\n }\n\n loadComponentAsRoot(itemConfig: ComponentItemConfig): void {\n // Remove existing root if it exists\n this.clearRoot();\n\n const resolvedItemConfig = ItemConfig.resolve(itemConfig, false) as ResolvedComponentItemConfig;\n\n if (resolvedItemConfig.maximised) {\n throw new Error('Root Component cannot be maximised');\n } else {\n const rootContentItem = new ComponentItem(this.layoutManager, resolvedItemConfig, this);\n rootContentItem.init();\n this.addChild(rootContentItem, 0);\n }\n }\n\n /**\n * Adds a Root ContentItem.\n * Internal only. To replace Root ContentItem with API, use {@link (LayoutManager:class).loadLayout}\n */\n override addChild(contentItem: ContentItem, index?: number): number {\n if (this.contentItems.length > 0) {\n throw new Error('Ground node can only have a single child');\n } else {\n // contentItem = this.layoutManager._$normalizeContentItem(contentItem, this);\n this._childElementContainer.appendChild(contentItem.element);\n index = super.addChild(contentItem, index);\n\n this.updateSize(false);\n this.emitBaseBubblingEvent('stateChanged');\n\n return index;\n }\n }\n\n /** @internal */\n override calculateConfigContent(): ResolvedRootItemConfig[] {\n const contentItems = this.contentItems;\n const count = contentItems.length;\n const result = new Array(count);\n for (let i = 0; i < count; i++) {\n const item = contentItems[i];\n const itemConfig = item.toConfig();\n if (ResolvedRootItemConfig.isRootItemConfig(itemConfig)) {\n result[i] = itemConfig;\n } else {\n throw new AssertError('RCCC66832');\n }\n }\n return result;\n }\n\n /** @internal */\n setSize(width: number, height: number): void {\n if (width === undefined || height === undefined) {\n this.updateSize(false); // For backwards compatibility with v1.x API\n } else {\n setElementWidth(this.element, width);\n setElementHeight(this.element, height);\n\n // GroundItem can be empty\n if (this.contentItems.length > 0) {\n setElementWidth(this.contentItems[0].element, width);\n setElementHeight(this.contentItems[0].element, height);\n }\n\n this.updateContentItemsSize(false);\n }\n }\n\n /**\n * Adds a Root ContentItem.\n * Internal only. To replace Root ContentItem with API, use {@link (LayoutManager:class).updateRootSize}\n */\n override updateSize(force: boolean): void {\n this.layoutManager.beginVirtualSizedContainerAdding();\n try {\n this.updateNodeSize();\n this.updateContentItemsSize(force);\n } finally {\n this.layoutManager.endVirtualSizedContainerAdding();\n }\n }\n\n createSideAreas(): GroundItem.Area[] {\n const areaSize = 50;\n\n const oppositeSides = GroundItem.Area.oppositeSides;\n const result = new Array(Object.keys(oppositeSides).length);\n let idx = 0;\n\n for (const key in oppositeSides) {\n const side = key as keyof GroundItem.Area.Sides;\n const area = this.getElementArea() as GroundItem.Area;\n if (area === null) {\n throw new UnexpectedNullError('RCSA77553');\n } else {\n area.side = side;\n if (oppositeSides[side][1] === '2' )\n area[side] = area[oppositeSides[side]] - areaSize;\n else\n area[side] = area[oppositeSides[side]] + areaSize;\n area.surface = (area.x2 - area.x1) * (area.y2 - area.y1);\n result[idx++] = area;\n }\n }\n\n return result;\n }\n\n override highlightDropZone(x: number, y: number, area: AreaLinkedRect): void {\n this.layoutManager.tabDropPlaceholder.remove();\n super.highlightDropZone(x, y, area);\n }\n\n override onDrop(contentItem: ContentItem, area: GroundItem.Area): void {\n\n if (contentItem.isComponent) {\n const itemConfig = ResolvedStackItemConfig.createDefault();\n // since ResolvedItemConfig.contentItems not set up, we need to add header from Component\n const component = contentItem as ComponentItem;\n itemConfig.header = ResolvedHeaderedItemConfig.Header.createCopy(component.headerConfig);\n const stack = this.layoutManager.createAndInitContentItem(itemConfig, this);\n stack.addChild(contentItem);\n contentItem = stack;\n }\n\n if (this.contentItems.length === 0) {\n this.addChild(contentItem);\n } else {\n /*\n * If the contentItem that's being dropped is not dropped on a Stack (cases which just passed above and\n * which would wrap the contentItem in a Stack) we need to check whether contentItem is a RowOrColumn.\n * If it is, we need to re-wrap it in a Stack like it was when it was dragged by its Tab (it was dragged!).\n */\n if(contentItem.type === ItemType.row || contentItem.type === ItemType.column){\n const itemConfig = ResolvedStackItemConfig.createDefault();\n const stack = this.layoutManager.createContentItem(itemConfig, this);\n stack.addChild(contentItem)\n contentItem = stack\n }\n\n const type = area.side[0] == 'x' ? ItemType.row : ItemType.column;\n const insertBefore = area.side[1] == '2';\n const column = this.contentItems[0];\n if (!(column instanceof RowOrColumn) || column.type !== type) {\n const itemConfig = ResolvedItemConfig.createDefault(type);\n const rowOrColumn = this.layoutManager.createContentItem(itemConfig, this);\n this.replaceChild(column, rowOrColumn);\n rowOrColumn.addChild(contentItem, insertBefore ? 0 : undefined, true);\n rowOrColumn.addChild(column, insertBefore ? undefined : 0, true);\n column.size = 50;\n contentItem.size = 50;\n contentItem.sizeUnit = SizeUnitEnum.Percent;\n rowOrColumn.updateSize(false);\n } else {\n const sibling = column.contentItems[insertBefore ? 0 : column.contentItems.length - 1]\n column.addChild(contentItem, insertBefore ? 0 : undefined, true);\n sibling.size *= 0.5;\n contentItem.size = sibling.size;\n contentItem.sizeUnit = SizeUnitEnum.Percent;\n column.updateSize(false);\n }\n }\n }\n\n // No ContentItem can dock with groundItem. However Stack can have a GroundItem parent and Stack requires that\n // its parent implement dock() function. Accordingly this function is implemented but throws an exception as it should\n // never be called\n dock(): void {\n throw new AssertError('GID87731');\n }\n\n // No ContentItem can dock with groundItem. However Stack can have a GroundItem parent and Stack requires that\n // its parent implement validateDocking() function. Accordingly this function is implemented but throws an exception as it should\n // never be called\n validateDocking(): void {\n throw new AssertError('GIVD87732');\n }\n\n getAllContentItems(): ContentItem[] {\n const result: ContentItem[] = [this];\n this.deepGetAllContentItems(this.contentItems, result);\n return result;\n }\n\n getConfigMaximisedItems(): ContentItem[] {\n const result: ContentItem[] = [];\n this.deepFilterContentItems(this.contentItems, result, (item) => {\n if (ContentItem.isStack(item) && item.initialWantMaximise) {\n return true;\n } else {\n if (ContentItem.isComponentItem(item) && item.initialWantMaximise) {\n return true;\n } else {\n return false;\n }\n }\n });\n\n return result;\n }\n\n getItemsByPopInParentId(popInParentId: string): ContentItem[] {\n const result: ContentItem[] = [];\n this.deepFilterContentItems(this.contentItems, result, (item) => item.popInParentIds.includes(popInParentId));\n return result;\n }\n\n toConfig(): ResolvedItemConfig {\n throw new Error('Cannot generate GroundItem config');\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n setActiveComponentItem(item: ComponentItem, focus: boolean, suppressFocusEvent: boolean): void {\n // only applicable if ComponentItem is root and then it always has focus\n }\n\n private updateNodeSize(): void {\n const { width, height } = getElementWidthAndHeight(this._containerElement);\n\n setElementWidth(this.element, width);\n setElementHeight(this.element, height);\n\n /*\n * GroundItem can be empty\n */\n if (this.contentItems.length > 0) {\n setElementWidth(this.contentItems[0].element, width);\n setElementHeight(this.contentItems[0].element, height);\n }\n }\n\n private deepGetAllContentItems(content: readonly ContentItem[], result: ContentItem[]): void {\n for (let i = 0; i < content.length; i++) {\n const contentItem = content[i];\n result.push(contentItem);\n this.deepGetAllContentItems(contentItem.contentItems, result);\n }\n }\n\n private deepFilterContentItems(content: readonly ContentItem[], result: ContentItem[],\n checkAcceptFtn: ((this: void, item: ContentItem) => boolean)\n ): void {\n for (let i = 0; i < content.length; i++) {\n const contentItem = content[i];\n if (checkAcceptFtn(contentItem)) {\n result.push(contentItem);\n }\n this.deepFilterContentItems(contentItem.contentItems, result, checkAcceptFtn);\n }\n }\n\n}\n\n/** @internal */\nexport namespace GroundItem {\n export interface Area extends ContentItem.Area {\n side: keyof typeof Area.Side;\n }\n\n export namespace Area {\n export const enum Side {\n y2,\n x2,\n y1,\n x1,\n }\n\n export type Sides = { [side in keyof typeof Side]: keyof typeof Side; }\n\n export const oppositeSides: Sides = {\n y2: 'y1',\n x2: 'x1',\n y1: 'y2',\n x1: 'x2',\n };\n }\n\n export function createElement(document: Document): HTMLDivElement {\n const element = document.createElement('div');\n element.classList.add(DomConstants.ClassName.GoldenLayout);\n element.classList.add(DomConstants.ClassName.Item);\n element.classList.add(DomConstants.ClassName.Root);\n return element;\n }\n}\n","import { ComponentItemConfig as ConfigComponentItemConfig } from '../config/config'; // remove alias in version 3\nimport { ResolvedRowOrColumnItemConfig } from \"../config/resolved-config\";\nimport { UnexpectedNullError } from '../errors/internal-error';\nimport { ComponentItem } from '../items/component-item';\nimport { GroundItem } from '../items/ground-item';\nimport { LayoutManager } from '../layout-manager';\nimport { DragListener } from '../utils/drag-listener';\nimport { JsonValue } from '../utils/types';\nimport { DragProxy } from './drag-proxy';\n\n/**\n * Allows for any DOM item to create a component on drag\n * start to be dragged into the Layout\n * @public\n */\nexport class DragSource {\n /** @internal */\n private _dragListener: DragListener | null;\n /** @internal */\n private _dummyGroundContainer: HTMLElement;\n /** @internal */\n private _dummyGroundContentItem: GroundItem;\n\n /** @internal */\n constructor(\n /** @internal */\n private _layoutManager: LayoutManager,\n /** @internal */\n private readonly _element: HTMLElement,\n /** @internal */\n private readonly _extraAllowableChildTargets: HTMLElement[],\n /** @internal @deprecated replace with componentItemConfigOrFtn in version 3 */\n private _componentTypeOrFtn: JsonValue | (() => (DragSource.ComponentItemConfig | ConfigComponentItemConfig)),\n /** @internal @deprecated remove in version 3 */\n private _componentState: JsonValue | undefined,\n /** @internal @deprecated remove in version 3 */\n private _title: string | undefined,\n /** @internal @deprecated remove in version 3 */\n private _id: string | undefined\n ) {\n this._dragListener = null;\n\n this._dummyGroundContainer = document.createElement('div');\n\n const dummyRootItemConfig = ResolvedRowOrColumnItemConfig.createDefault('row');\n this._dummyGroundContentItem = new GroundItem(this._layoutManager, dummyRootItemConfig, this._dummyGroundContainer);\n\n this.createDragListener();\n }\n\n\t/**\n\t * Disposes of the drag listeners so the drag source is not usable any more.\n * @internal\n\t */\n\tdestroy(): void {\n\t\tthis.removeDragListener();\n }\n\n /**\n * Called initially and after every drag\n * @internal\n */\n private createDragListener() {\n this.removeDragListener();\n\n this._dragListener = new DragListener(this._element, this._extraAllowableChildTargets);\n this._dragListener.on('dragStart', (x, y) => this.onDragStart(x, y));\n this._dragListener.on('dragStop', () => this.onDragStop());\n }\n\n /**\n * Callback for the DragListener's dragStart event\n *\n * @param x - The x position of the mouse on dragStart\n * @param y - The x position of the mouse on dragStart\n * @internal\n */\n private onDragStart(x: number, y: number) {\n const type = 'component';\n let dragSourceItemConfig: ConfigComponentItemConfig;\n\n if (typeof this._componentTypeOrFtn === \"function\") {\n const ftnDragSourceItemConfig = this._componentTypeOrFtn() as (DragSource.ComponentItemConfig | ConfigComponentItemConfig);\n // If the componentType property exists, then it is already a ComponentItemConfig so nothing to do\n if (DragSource.isDragSourceComponentItemConfig(ftnDragSourceItemConfig)) {\n dragSourceItemConfig = {\n type,\n componentState: ftnDragSourceItemConfig.state,\n componentType: ftnDragSourceItemConfig.type,\n title: ftnDragSourceItemConfig.title ?? this._title,\n };\n } else {\n dragSourceItemConfig = ftnDragSourceItemConfig;\n }\n } else {\n dragSourceItemConfig = {\n type,\n componentState: this._componentState,\n componentType: this._componentTypeOrFtn,\n title: this._title,\n id: this._id,\n };\n }\n\n // Create a dummy ContentItem only for drag purposes\n // All ContentItems (except for GroundItem) need a parent. When dragging, the parent is not used.\n // Instead of allowing null parents (as Javascript version did), use a temporary dummy GroundItem parent and add ContentItem to that\n // If this does not work, need to create alternative GroundItem class\n\n const resolvedItemConfig = ConfigComponentItemConfig.resolve(dragSourceItemConfig, false);\n\n const componentItem = new ComponentItem(this._layoutManager, resolvedItemConfig, this._dummyGroundContentItem)\n this._dummyGroundContentItem.contentItems.push(componentItem);\n\n if (this._dragListener === null) {\n throw new UnexpectedNullError('DSODSD66746');\n } else {\n const dragProxy = new DragProxy(x, y, this._dragListener, this._layoutManager, componentItem , this._dummyGroundContentItem);\n\n const transitionIndicator = this._layoutManager.transitionIndicator;\n if (transitionIndicator === null) {\n throw new UnexpectedNullError('DSODST66746');\n } else {\n transitionIndicator.transitionElements(this._element, dragProxy.element);\n }\n }\n }\n\n /** @internal */\n private onDragStop() {\n // if (this._dummyGroundContentItem === undefined) {\n // throw new UnexpectedUndefinedError('DSODSDRU08116');\n // } else {\n // this._dummyGroundContentItem._$destroy\n // this._dummyGroundContentItem = undefined;\n // }\n this.createDragListener();\n }\n\n /**\n\t * Called after every drag and when the drag source is being disposed of.\n * @internal\n\t */\n\tprivate removeDragListener() {\n\t\tif (this._dragListener !== null ) {\n this._dragListener.destroy();\n this._dragListener = null;\n\t\t}\n\t}\n}\n\n/** @public */\nexport namespace DragSource {\n /** @deprecated use Config {@link (ComponentItemConfig:interface)} */\n export interface ComponentItemConfig {\n type: JsonValue,\n state?: JsonValue,\n title?: string,\n }\n\n /** @deprecated remove in version 3 */\n export function isDragSourceComponentItemConfig(\n config: DragSource.ComponentItemConfig | ConfigComponentItemConfig\n ): config is DragSource.ComponentItemConfig {\n return !(\"componentType\" in config);\n }\n}\n","import { DomConstants } from '../utils/dom-constants';\nimport { AreaLinkedRect } from '../utils/types';\nimport { numberToPixels, setElementDisplayVisibility } from '../utils/utils';\n\n/** @internal */\nexport class DropTargetIndicator {\n private _element: HTMLElement;\n\n constructor() {\n // Maybe use container instead of Document Body?\n this._element = document.createElement('div');\n this._element.classList.add(DomConstants.ClassName.DropTargetIndicator);\n const innerElement = document.createElement('div');\n innerElement.classList.add(DomConstants.ClassName.Inner);\n this._element.appendChild(innerElement);\n\n document.body.appendChild(this._element);\n }\n\n destroy(): void {\n this._element.remove();\n }\n\n highlightArea(area: AreaLinkedRect, margin: number): void {\n this._element.style.left = numberToPixels(area.x1 + margin);\n this._element.style.top = numberToPixels(area.y1 + margin);\n this._element.style.width = numberToPixels(area.x2 - area.x1 - margin);\n this._element.style.height = numberToPixels(area.y2 - area.y1 - margin);\n this._element.style.display = 'block';\n }\n\n hide(): void {\n setElementDisplayVisibility(this._element, false);\n }\n}\n","import { DomConstants } from '../utils/dom-constants';\nimport { Rect } from '../utils/types';\n\n/** @internal @deprecated To be removed */\nexport class TransitionIndicator {\n private _element: HTMLElement;\n private _toElement: HTMLElement | null;\n private _fromDimensions: null;\n private _totalAnimationDuration: number;\n private _animationStartTime: number | null;\n\n constructor() {\n this._element = document.createElement('div');\n this._element.classList.add(DomConstants.ClassName.TransitionIndicator);\n document.body.appendChild(this._element);\n\n this._toElement = null;\n this._fromDimensions = null;\n this._totalAnimationDuration = 200;\n this._animationStartTime = null;\n }\n\n destroy(): void {\n this._element.remove();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n transitionElements(fromElement: HTMLElement, toElement: HTMLElement): void {\n /**\n * TODO - This is not quite as cool as expected. Review.\n */\n return;\n // this._toElement = toElement;\n // this._animationStartTime = now();\n // this._fromDimensions = this._measure(fromElement);\n // this._fromDimensions.opacity = 0.8;\n // this._element.show().css(this._fromDimensions);\n // animFrame(fnBind(this._nextAnimationFrame, this));\n }\n\n private nextAnimationFrame(): void {\n // if (this._toElement === null || this._fromDimensions === null || this._animationStartTime === null) {\n // throw new UnexpectedNullError('TINAFTD97115');\n // } else {\n // const toDimensions = this.measure(this._toElement);\n // const animationProgress = (now() - this._animationStartTime) / this._totalAnimationDuration;\n // const currentFrameStyles = {};\n // const cssProperty;\n\n // if (animationProgress >= 1) {\n // this._element.style.display = 'none';\n // return;\n // }\n\n // toDimensions.opacity = 0;\n\n // for (const cssProperty in this._fromDimensions) {\n // currentFrameStyles[cssProperty] = this._fromDimensions[cssProperty] +\n // (toDimensions[cssProperty] - this._fromDimensions[cssProperty]) *\n // animationProgress;\n // }\n\n // this._element.css(currentFrameStyles);\n // animFrame(fnBind(this._nextAnimationFrame, this));\n // }\n }\n\n private measure(element: HTMLElement): Rect {\n const rect = element.getBoundingClientRect();\n\n return {\n left: rect.left,\n top: rect.top,\n width: element.offsetWidth,\n height: element.offsetHeight,\n };\n }\n}\n","import { UnexpectedNullError } from '../errors/internal-error';\nimport { LayoutManager } from '../layout-manager';\nimport { EventEmitter } from './event-emitter';\n\n// Add our ChildEvent to WindowEventMap for type safety\n/** @public */\ndeclare global {\n interface WindowEventMap {\n [EventHub.ChildEventName]: CustomEvent;\n }\n}\n\n/**\n * An EventEmitter singleton that propagates events\n * across multiple windows. This is a little bit trickier since\n * windows are allowed to open childWindows in their own right.\n *\n * This means that we deal with a tree of windows. Therefore, we do the event propagation in two phases:\n *\n * - Propagate events from this layout to the parent layout\n * - Repeat until the event arrived at the root layout\n * - Propagate events to this layout and to all children\n * - Repeat until all layouts got the event\n *\n * **WARNING**: Only userBroadcast events are propagated between windows.\n * This means the you have to take care of propagating state changes between windows yourself.\n *\n * @public\n */\nexport class EventHub extends EventEmitter {\n\n /** @internal */\n private _childEventListener = (childEvent: CustomEvent) => this.onEventFromChild(childEvent);\n\n /**\n * Creates a new EventHub instance\n * @param _layoutManager - the layout manager to synchronize between the windows\n * @internal\n */\n constructor(\n /** @internal */\n private _layoutManager: LayoutManager\n ) {\n super();\n globalThis.addEventListener(EventHub.ChildEventName, this._childEventListener, { passive: true });\n }\n\n /**\n * Emit an event and notify listeners\n *\n * @param eventName - The name of the event\n * @param args - Additional arguments that will be passed to the listener\n * @public\n */\n override emit(eventName: K, ...args: EventEmitter.EventParamsMap[K]): void {\n if (eventName === 'userBroadcast') {\n // Explicitly redirect the user broadcast to our overridden method.\n this.emitUserBroadcast(...args);\n } else {\n super.emit(eventName, ...args);\n }\n }\n\n /**\n * Broadcasts a message to all other currently opened windows.\n * @public\n */\n emitUserBroadcast(...args: EventEmitter.UnknownParams): void {\n // Step 1: Bubble up the event\n this.handleUserBroadcastEvent('userBroadcast', args);\n }\n\n /**\n * Destroys the EventHub\n * @internal\n */\n destroy(): void {\n globalThis.removeEventListener(EventHub.ChildEventName, this._childEventListener);\n }\n\n /**\n * Internal processor to process local events.\n * @internal\n */\n private handleUserBroadcastEvent(eventName: string, args: unknown[]) {\n if (this._layoutManager.isSubWindow) {\n // We are a sub window and received an event from one of our children.\n // So propagate it to the Root.\n this.propagateToParent(eventName, args);\n } else {\n // We are the root window, propagate it to the subtree below us.\n this.propagateToThisAndSubtree(eventName, args);\n }\n }\n\n /**\n * Callback for child events raised on the window\n * @internal\n */\n private onEventFromChild(event: CustomEvent) {\n const detail = event.detail;\n this.handleUserBroadcastEvent(detail.eventName, detail.args);\n }\n\n /**\n * Propagates the event to the parent by emitting\n * it on the parent's DOM window\n * @internal\n */\n private propagateToParent(eventName: string, args: unknown[]) {\n const detail: EventHub.ChildEventDetail = {\n layoutManager: this._layoutManager,\n eventName,\n args: args,\n }\n\n const eventInit: EventHub.ChildEventInit = {\n bubbles: true,\n cancelable: true,\n detail,\n };\n\n const event = new CustomEvent(EventHub.ChildEventName, eventInit);\n const opener = globalThis.opener;\n if (opener === null) {\n throw new UnexpectedNullError('EHPTP15778')\n }\n\n opener.dispatchEvent(event);\n }\n\n /**\n * Propagate events to the whole subtree under this event hub.\n * @internal\n */\n private propagateToThisAndSubtree(eventName: string, args: unknown[]) {\n this.emitUnknown(eventName, ...args);\n for (let i = 0; i < this._layoutManager.openPopouts.length; i++) {\n const childGl = this._layoutManager.openPopouts[i].getGlInstance();\n\n if (childGl) {\n childGl.eventHub.propagateToThisAndSubtree(eventName, args);\n }\n }\n }\n}\n\n/** @public */\nexport namespace EventHub {\n\n /** @internal */\n export const ChildEventName = 'gl_child_event';\n\n /** @internal */\n export type ChildEventDetail = {\n layoutManager: LayoutManager;\n eventName: string;\n args: unknown[];\n };\n\n /** @internal */\n export type ChildEventInit = CustomEventInit;\n}\n","import { ComponentItemConfig, ItemConfig, LayoutConfig, RowOrColumnItemConfig, StackItemConfig } from './config/config';\nimport {\n ResolvedComponentItemConfig,\n ResolvedItemConfig,\n ResolvedLayoutConfig,\n ResolvedPopoutLayoutConfig,\n ResolvedRootItemConfig,\n ResolvedRowOrColumnItemConfig,\n ResolvedStackItemConfig\n} from \"./config/resolved-config\";\nimport { ComponentContainer } from './container/component-container';\nimport { BrowserPopout } from './controls/browser-popout';\nimport { DragProxy } from './controls/drag-proxy';\nimport { DragSource } from './controls/drag-source';\nimport { DropTargetIndicator } from './controls/drop-target-indicator';\nimport { TransitionIndicator } from './controls/transition-indicator';\nimport { ConfigurationError } from './errors/external-error';\nimport { AssertError, UnexpectedNullError, UnexpectedUndefinedError, UnreachableCaseError } from './errors/internal-error';\nimport { ComponentItem } from './items/component-item';\nimport { ComponentParentableItem } from './items/component-parentable-item';\nimport { ContentItem } from './items/content-item';\nimport { GroundItem } from './items/ground-item';\nimport { RowOrColumn } from './items/row-or-column';\nimport { Stack } from './items/stack';\nimport { ConfigMinifier } from './utils/config-minifier';\nimport { DomConstants } from './utils/dom-constants';\nimport { DragListener } from './utils/drag-listener';\nimport { EventEmitter } from './utils/event-emitter';\nimport { EventHub } from './utils/event-hub';\nimport { I18nStringId, I18nStrings, i18nStrings } from './utils/i18n-strings';\nimport { ItemType, JsonValue, Rect, ResponsiveMode } from './utils/types';\nimport {\n getElementWidthAndHeight,\n removeFromArray,\n setElementHeight,\n setElementWidth\n} from './utils/utils';\n\n/** @internal */\ndeclare global {\n interface Window {\n __glInstance: LayoutManager;\n }\n}\n\n/**\n * The main class that will be exposed as GoldenLayout.\n */\n\n/** @public */\nexport abstract class LayoutManager extends EventEmitter {\n /** Whether the layout will be automatically be resized to container whenever the container's size is changed\n * Default is true if is the container otherwise false\n * Default will be changed to true for any container in the future\n */\n resizeWithContainerAutomatically = false;\n /** The debounce interval (in milliseconds) used whenever a layout is automatically resized. 0 means next tick */\n resizeDebounceInterval = 100;\n /** Extend the current debounce delay time period if it is triggered during the delay.\n * If this is true, the layout will only resize when its container has stopped being resized.\n * If it is false, the layout will resize at intervals while its container is being resized.\n */\n resizeDebounceExtendedWhenPossible = true;\n\n /** @internal */\n private _containerElement: HTMLElement;\n /** @internal */\n private _isInitialised = false;\n /** @internal */\n private _groundItem: GroundItem | undefined = undefined;\n /** @internal */\n private _openPopouts: BrowserPopout[] = [];\n /** @internal */\n private _dropTargetIndicator: DropTargetIndicator | null = null;\n /** @internal */\n private _transitionIndicator: TransitionIndicator | null = null;\n /** @internal */\n private _resizeTimeoutId: ReturnType | undefined;\n /** @internal */\n private _itemAreas: ContentItem.Area[] = [];\n /** @internal */\n private _maximisedStack: Stack | undefined;\n /** @internal */\n private _maximisePlaceholder = LayoutManager.createMaximisePlaceElement(document);\n /** @internal */\n private _tabDropPlaceholder = LayoutManager.createTabDropPlaceholderElement(document);\n /** @internal */\n private _dragSources: DragSource[] = [];\n /** @internal */\n private _updatingColumnsResponsive = false;\n /** @internal */\n private _firstLoad = true;\n /** @internal */\n private _eventHub = new EventHub(this);\n /** @internal */\n private _width: number | null = null;\n /** @internal */\n private _height: number | null = null;\n /** @internal */\n private _focusedComponentItem: ComponentItem | undefined;\n /** @internal */\n private _virtualSizedContainers: ComponentContainer[] = [];\n /** @internal */\n private _virtualSizedContainerAddingBeginCount = 0;\n /** @internal */\n private _sizeInvalidationBeginCount = 0;\n /** @internal */\n protected _constructorOrSubWindowLayoutConfig: LayoutConfig | undefined; // protected for backwards compatibility\n\n /** @internal */\n private _resizeObserver = new ResizeObserver(() => this.handleContainerResize());\n /** @internal @deprecated to be removed in version 3 */\n private _windowBeforeUnloadListener = () => this.onBeforeUnload();\n /** @internal @deprecated to be removed in version 3 */\n private _windowBeforeUnloadListening = false;\n /** @internal */\n private _maximisedStackBeforeDestroyedListener = (ev: EventEmitter.BubblingEvent) => this.cleanupBeforeMaximisedStackDestroyed(ev);\n\n readonly isSubWindow: boolean;\n layoutConfig: ResolvedLayoutConfig;\n\n beforeVirtualRectingEvent: LayoutManager.BeforeVirtualRectingEvent | undefined;\n afterVirtualRectingEvent: LayoutManager.AfterVirtualRectingEvent | undefined;\n\n get container(): HTMLElement { return this._containerElement; }\n get isInitialised(): boolean { return this._isInitialised; }\n /** @internal */\n get groundItem(): GroundItem | undefined { return this._groundItem; }\n /** @internal @deprecated use {@link (LayoutManager:class).groundItem} instead */\n get root(): GroundItem | undefined { return this._groundItem; }\n get openPopouts(): BrowserPopout[] { return this._openPopouts; }\n /** @internal */\n get dropTargetIndicator(): DropTargetIndicator | null { return this._dropTargetIndicator; }\n /** @internal @deprecated To be removed */\n get transitionIndicator(): TransitionIndicator | null { return this._transitionIndicator; }\n get width(): number | null { return this._width; }\n get height(): number | null { return this._height; }\n /**\n * Retrieves the {@link (EventHub:class)} instance associated with this layout manager.\n * This can be used to propagate events between the windows\n * @public\n */\n get eventHub(): EventHub { return this._eventHub; }\n get rootItem(): ContentItem | undefined {\n if (this._groundItem === undefined) {\n throw new Error('Cannot access rootItem before init');\n } else {\n const groundContentItems = this._groundItem.contentItems;\n if (groundContentItems.length === 0) {\n return undefined;\n } else {\n return this._groundItem.contentItems[0];\n }\n }\n }\n get focusedComponentItem(): ComponentItem | undefined { return this._focusedComponentItem; }\n /** @internal */\n get tabDropPlaceholder(): HTMLElement { return this._tabDropPlaceholder; }\n get maximisedStack(): Stack | undefined { return this._maximisedStack; }\n\n /** @deprecated indicates deprecated constructor use */\n get deprecatedConstructor(): boolean { return !this.isSubWindow && this._constructorOrSubWindowLayoutConfig !== undefined; }\n\n\n /**\n * @param container - A Dom HTML element. Defaults to body\n * @internal\n */\n constructor(parameters: LayoutManager.ConstructorParameters) {\n super();\n\n this.isSubWindow = parameters.isSubWindow;\n\n this._constructorOrSubWindowLayoutConfig = parameters.constructorOrSubWindowLayoutConfig;\n\n I18nStrings.checkInitialise();\n ConfigMinifier.checkInitialise();\n\n if (parameters.containerElement !== undefined) {\n this._containerElement = parameters.containerElement;\n }\n }\n\n /**\n * Destroys the LayoutManager instance itself as well as every ContentItem\n * within it. After this is called nothing should be left of the LayoutManager.\n *\n * This function only needs to be called if an application wishes to destroy the Golden Layout object while\n * a page remains loaded. When a page is unloaded, all resources claimed by Golden Layout will automatically\n * be released.\n */\n destroy(): void {\n if (this._isInitialised) {\n if (this._windowBeforeUnloadListening) {\n globalThis.removeEventListener('beforeunload', this._windowBeforeUnloadListener);\n this._windowBeforeUnloadListening = false;\n }\n\n if (this.layoutConfig.settings.closePopoutsOnUnload === true) {\n this.closeAllOpenPopouts();\n }\n\n this._resizeObserver.disconnect();\n this.checkClearResizeTimeout();\n\n if (this._groundItem !== undefined) {\n this._groundItem.destroy();\n }\n this._tabDropPlaceholder.remove();\n if (this._dropTargetIndicator !== null) {\n this._dropTargetIndicator.destroy();\n }\n if (this._transitionIndicator !== null) {\n this._transitionIndicator.destroy();\n }\n this._eventHub.destroy();\n\n for (const dragSource of this._dragSources) {\n dragSource.destroy();\n }\n this._dragSources = [];\n\n this._isInitialised = false;\n }\n }\n\n /**\n * Takes a GoldenLayout configuration object and\n * replaces its keys and values recursively with\n * one letter codes\n * @deprecated use {@link (ResolvedLayoutConfig:namespace).minifyConfig} instead\n */\n minifyConfig(config: ResolvedLayoutConfig): ResolvedLayoutConfig {\n return ResolvedLayoutConfig.minifyConfig(config);\n }\n\n /**\n * Takes a configuration Object that was previously minified\n * using minifyConfig and returns its original version\n * @deprecated use {@link (ResolvedLayoutConfig:namespace).unminifyConfig} instead\n */\n unminifyConfig(config: ResolvedLayoutConfig): ResolvedLayoutConfig {\n return ResolvedLayoutConfig.unminifyConfig(config);\n }\n\n /** @internal */\n abstract bindComponent(container: ComponentContainer, itemConfig: ResolvedComponentItemConfig): ComponentContainer.BindableComponent;\n /** @internal */\n abstract unbindComponent(container: ComponentContainer, virtual: boolean, component: ComponentContainer.Component | undefined): void;\n\n /**\n * Called from GoldenLayout class. Finishes of init\n * @internal\n */\n init(): void {\n this.setContainer();\n this._dropTargetIndicator = new DropTargetIndicator(/*this.container*/);\n this._transitionIndicator = new TransitionIndicator();\n this.updateSizeFromContainer();\n\n let subWindowRootConfig: ComponentItemConfig | undefined;\n if (this.isSubWindow) {\n if (this._constructorOrSubWindowLayoutConfig === undefined) {\n // SubWindow LayoutConfig should have been generated by constructor\n throw new UnexpectedUndefinedError('LMIU07155');\n } else {\n const root = this._constructorOrSubWindowLayoutConfig.root;\n if (root === undefined) {\n // SubWindow LayoutConfig must not be empty\n throw new AssertError('LMIC07156');\n } else {\n if (ItemConfig.isComponent(root)) {\n subWindowRootConfig = root;\n } else {\n // SubWindow LayoutConfig must have Component as Root\n throw new AssertError('LMIC07157');\n }\n }\n const resolvedLayoutConfig = LayoutConfig.resolve(this._constructorOrSubWindowLayoutConfig);\n // remove root from layoutConfig\n this.layoutConfig = {\n ...resolvedLayoutConfig,\n root: undefined,\n }\n }\n } else {\n if (this._constructorOrSubWindowLayoutConfig === undefined) {\n this.layoutConfig = ResolvedLayoutConfig.createDefault(); // will overwritten be loaded via loadLayout\n } else {\n // backwards compatibility\n this.layoutConfig = LayoutConfig.resolve(this._constructorOrSubWindowLayoutConfig);\n }\n }\n const layoutConfig = this.layoutConfig;\n this._groundItem = new GroundItem(this, layoutConfig.root, this._containerElement);\n this._groundItem.init();\n\n this.checkLoadedLayoutMaximiseItem();\n\n this._resizeObserver.observe(this._containerElement);\n this._isInitialised = true;\n this.adjustColumnsResponsive();\n this.emit('initialised');\n\n if (subWindowRootConfig !== undefined) {\n // must be SubWindow\n this.loadComponentAsRoot(subWindowRootConfig);\n }\n }\n\n /**\n * Loads a new layout\n * @param layoutConfig - New layout to be loaded\n */\n loadLayout(layoutConfig: LayoutConfig): void {\n if (!this.isInitialised) {\n // In case application not correctly using legacy constructor\n throw new Error('GoldenLayout: Need to call init() if LayoutConfig with defined root passed to constructor')\n } else {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMLL11119');\n } else {\n this.createSubWindows(); // still needs to be tested\n\n this.layoutConfig = LayoutConfig.resolve(layoutConfig);\n this._groundItem.loadRoot(this.layoutConfig.root);\n this.checkLoadedLayoutMaximiseItem();\n this.adjustColumnsResponsive();\n }\n }\n }\n\n /**\n * Creates a layout configuration object based on the the current state\n *\n * @public\n * @returns GoldenLayout configuration\n */\n saveLayout(): ResolvedLayoutConfig {\n if (this._isInitialised === false) {\n throw new Error('Can\\'t create config, layout not yet initialised');\n } else {\n\n // if (root !== undefined && !(root instanceof ContentItem)) {\n // throw new Error('Root must be a ContentItem');\n // }\n\n /*\n * Content\n */\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMTC18244');\n } else {\n const groundContent = this._groundItem.calculateConfigContent();\n\n let rootItemConfig: ResolvedRootItemConfig | undefined;\n if (groundContent.length !== 1) {\n rootItemConfig = undefined;\n } else {\n rootItemConfig = groundContent[0];\n }\n\n /*\n * Retrieve config for subwindows\n */\n this.reconcilePopoutWindows();\n const openPopouts: ResolvedPopoutLayoutConfig[] = [];\n for (let i = 0; i < this._openPopouts.length; i++) {\n openPopouts.push(this._openPopouts[i].toConfig());\n }\n\n const config: ResolvedLayoutConfig = {\n root: rootItemConfig,\n openPopouts,\n settings: ResolvedLayoutConfig.Settings.createCopy(this.layoutConfig.settings),\n dimensions: ResolvedLayoutConfig.Dimensions.createCopy(this.layoutConfig.dimensions),\n header: ResolvedLayoutConfig.Header.createCopy(this.layoutConfig.header),\n resolved: true,\n }\n\n return config;\n }\n }\n }\n\n /**\n * Removes any existing layout. Effectively, an empty layout will be loaded.\n */\n\n clear(): void {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMCL11129');\n } else {\n this._groundItem.clearRoot();\n }\n }\n\n /**\n * @deprecated Use {@link (LayoutManager:class).saveLayout}\n */\n toConfig(): ResolvedLayoutConfig {\n return this.saveLayout();\n }\n\n /**\n * Adds a new ComponentItem. Will use default location selectors to ensure a location is found and\n * component is successfully added\n * @param componentTypeName - Name of component type to be created.\n * @param state - Optional initial state to be assigned to component\n * @returns New ComponentItem created.\n */\n newComponent(componentType: JsonValue, componentState?: JsonValue, title?: string): ComponentItem {\n const componentItem = this.newComponentAtLocation(componentType, componentState, title);\n if (componentItem === undefined) {\n throw new AssertError('LMNC65588');\n } else {\n return componentItem;\n }\n }\n\n /**\n * Adds a ComponentItem at the first valid selector location.\n * @param componentTypeName - Name of component type to be created.\n * @param state - Optional initial state to be assigned to component\n * @param locationSelectors - Array of location selectors used to find location in layout where component\n * will be added. First location in array which is valid will be used. If locationSelectors is undefined,\n * {@link (LayoutManager:namespace).defaultLocationSelectors} will be used\n * @returns New ComponentItem created or undefined if no valid location selector was in array.\n */\n newComponentAtLocation(componentType: JsonValue, componentState?: JsonValue, title?: string,\n locationSelectors?: LayoutManager.LocationSelector[]\n ): ComponentItem | undefined{\n if (this._groundItem === undefined) {\n throw new Error('Cannot add component before init');\n } else {\n const location = this.addComponentAtLocation(componentType, componentState, title, locationSelectors);\n if (location === undefined) {\n return undefined;\n } else {\n const createdItem = location.parentItem.contentItems[location.index];\n if (!ContentItem.isComponentItem(createdItem)) {\n throw new AssertError('LMNC992877533');\n } else {\n return createdItem;\n }\n }\n }\n }\n\n /**\n * Adds a new ComponentItem. Will use default location selectors to ensure a location is found and\n * component is successfully added\n * @param componentType - Type of component to be created.\n * @param state - Optional initial state to be assigned to component\n * @returns Location of new ComponentItem created.\n */\n addComponent(componentType: JsonValue, componentState?: JsonValue, title?: string): LayoutManager.Location {\n const location = this.addComponentAtLocation(componentType, componentState, title);\n if (location === undefined) {\n throw new AssertError('LMAC99943');\n } else {\n return location;\n }\n }\n\n /**\n * Adds a ComponentItem at the first valid selector location.\n * @param componentType - Type of component to be created.\n * @param state - Optional initial state to be assigned to component\n * @param locationSelectors - Array of location selectors used to find determine location in layout where component\n * will be added. First location in array which is valid will be used. If undefined,\n * {@link (LayoutManager:namespace).defaultLocationSelectors} will be used.\n * @returns Location of new ComponentItem created or undefined if no valid location selector was in array.\n */\n addComponentAtLocation(componentType: JsonValue, componentState?: JsonValue, title?: string,\n locationSelectors?: readonly LayoutManager.LocationSelector[]\n ): LayoutManager.Location | undefined {\n const itemConfig: ComponentItemConfig = {\n type: 'component',\n componentType,\n componentState,\n title,\n };\n\n return this.addItemAtLocation(itemConfig, locationSelectors);\n }\n\n /**\n * Adds a new ContentItem. Will use default location selectors to ensure a location is found and\n * component is successfully added\n * @param itemConfig - ResolvedItemConfig of child to be added.\n * @returns New ContentItem created.\n */\n newItem(itemConfig: RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig): ContentItem {\n const contentItem = this.newItemAtLocation(itemConfig);\n if (contentItem === undefined) {\n throw new AssertError('LMNC65588');\n } else {\n return contentItem;\n }\n }\n\n /**\n * Adds a new child ContentItem under the root ContentItem. If a root does not exist, then create root ContentItem instead\n * @param itemConfig - ResolvedItemConfig of child to be added.\n * @param locationSelectors - Array of location selectors used to find determine location in layout where ContentItem\n * will be added. First location in array which is valid will be used. If undefined,\n * {@link (LayoutManager:namespace).defaultLocationSelectors} will be used.\n * @returns New ContentItem created or undefined if no valid location selector was in array. */\n newItemAtLocation(itemConfig: RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig,\n locationSelectors?: readonly LayoutManager.LocationSelector[]\n ): ContentItem | undefined {\n if (this._groundItem === undefined) {\n throw new Error('Cannot add component before init');\n } else {\n const location = this.addItemAtLocation(itemConfig, locationSelectors);\n if (location === undefined) {\n return undefined;\n } else {\n const createdItem = location.parentItem.contentItems[location.index];\n return createdItem;\n }\n }\n }\n\n /**\n * Adds a new ContentItem. Will use default location selectors to ensure a location is found and\n * component is successfully added.\n * @param itemConfig - ResolvedItemConfig of child to be added.\n * @returns Location of new ContentItem created. */\n addItem(itemConfig: RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig): LayoutManager.Location {\n const location = this.addItemAtLocation(itemConfig);\n if (location === undefined) {\n throw new AssertError('LMAI99943');\n } else {\n return location;\n }\n }\n\n /**\n * Adds a ContentItem at the first valid selector location.\n * @param itemConfig - ResolvedItemConfig of child to be added.\n * @param locationSelectors - Array of location selectors used to find determine location in layout where ContentItem\n * will be added. First location in array which is valid will be used. If undefined,\n * {@link (LayoutManager:namespace).defaultLocationSelectors} will be used.\n * @returns Location of new ContentItem created or undefined if no valid location selector was in array. */\n addItemAtLocation(itemConfig: RowOrColumnItemConfig | StackItemConfig | ComponentItemConfig,\n locationSelectors?: readonly LayoutManager.LocationSelector[]\n ): LayoutManager.Location | undefined {\n if (this._groundItem === undefined) {\n throw new Error('Cannot add component before init');\n } else {\n if (locationSelectors === undefined) {\n // defaultLocationSelectors should always find a location\n locationSelectors = LayoutManager.defaultLocationSelectors;\n }\n\n const location = this.findFirstLocation(locationSelectors);\n if (location === undefined) {\n return undefined;\n } else {\n let parentItem = location.parentItem;\n let addIdx: number;\n switch (parentItem.type) {\n case ItemType.ground: {\n const groundItem = parentItem as GroundItem;\n addIdx = groundItem.addItem(itemConfig, location.index);\n if (addIdx >= 0) {\n parentItem = this._groundItem.contentItems[0]; // was added to rootItem\n } else {\n addIdx = 0; // was added as rootItem (which is the first and only ContentItem in GroundItem)\n }\n break;\n }\n case ItemType.row:\n case ItemType.column: {\n const rowOrColumn = parentItem as RowOrColumn;\n addIdx = rowOrColumn.addItem(itemConfig, location.index);\n break;\n }\n case ItemType.stack: {\n if (!ItemConfig.isComponent(itemConfig)) {\n throw Error(i18nStrings[I18nStringId.ItemConfigIsNotTypeComponent]);\n } else {\n const stack = parentItem as Stack;\n addIdx = stack.addItem(itemConfig, location.index);\n break;\n }\n }\n case ItemType.component: {\n throw new AssertError('LMAIALC87444602');\n }\n default:\n throw new UnreachableCaseError('LMAIALU98881733', parentItem.type);\n }\n\n if (ItemConfig.isComponent(itemConfig)) {\n // see if stack was inserted\n const item = parentItem.contentItems[addIdx];\n if (ContentItem.isStack(item)) {\n parentItem = item;\n addIdx = 0;\n }\n }\n\n location.parentItem = parentItem;\n location.index = addIdx;\n\n return location;\n }\n }\n }\n\n /** Loads the specified component ResolvedItemConfig as root.\n * This can be used to display a Component all by itself. The layout cannot be changed other than having another new layout loaded.\n * Note that, if this layout is saved and reloaded, it will reload with the Component as a child of a Stack.\n */\n loadComponentAsRoot(itemConfig: ComponentItemConfig): void {\n if (this._groundItem === undefined) {\n throw new Error('Cannot add item before init');\n } else {\n this._groundItem.loadComponentAsRoot(itemConfig);\n }\n }\n\n /** @deprecated Use {@link (LayoutManager:class).setSize} */\n updateSize(width: number, height: number): void {\n this.setSize(width, height);\n }\n\n /**\n * Updates the layout managers size\n *\n * @param width - Width in pixels\n * @param height - Height in pixels\n */\n setSize(width: number, height: number): void {\n this._width = width;\n this._height = height;\n\n if (this._isInitialised === true) {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMUS18881');\n } else {\n this._groundItem.setSize(this._width, this._height);\n\n if (this._maximisedStack) {\n const { width, height } = getElementWidthAndHeight(this._containerElement);\n setElementWidth(this._maximisedStack.element, width);\n setElementHeight(this._maximisedStack.element, height);\n this._maximisedStack.updateSize(false);\n }\n\n this.adjustColumnsResponsive();\n }\n }\n }\n\n /** @internal */\n beginSizeInvalidation(): void {\n this._sizeInvalidationBeginCount++;\n }\n\n /** @internal */\n endSizeInvalidation(): void {\n if (--this._sizeInvalidationBeginCount === 0) {\n this.updateSizeFromContainer();\n }\n }\n\n /** @internal */\n updateSizeFromContainer(): void {\n const { width, height } = getElementWidthAndHeight(this._containerElement);\n this.setSize(width, height);\n }\n\n /**\n * Update the size of the root ContentItem. This will update the size of all contentItems in the tree\n * @param force - In some cases the size is not updated if it has not changed. In this case, events\n * (such as ComponentContainer.virtualRectingRequiredEvent) are not fired. Setting force to true, ensures the size is updated regardless, and\n * the respective events are fired. This is sometimes necessary when a component's size has not changed but it has become visible, and the\n * relevant events need to be fired.\n */\n updateRootSize(force = false): void {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMURS28881');\n } else {\n this._groundItem.updateSize(force);\n }\n }\n\n /** @public */\n createAndInitContentItem(config: ResolvedItemConfig, parent: ContentItem): ContentItem {\n const newItem = this.createContentItem(config, parent);\n newItem.init();\n return newItem;\n }\n\n /**\n * Recursively creates new item tree structures based on a provided\n * ItemConfiguration object\n *\n * @param config - ResolvedItemConfig\n * @param parent - The item the newly created item should be a child of\n * @internal\n */\n createContentItem(config: ResolvedItemConfig, parent: ContentItem): ContentItem {\n if (typeof config.type !== 'string') {\n throw new ConfigurationError('Missing parameter \\'type\\'', JSON.stringify(config));\n }\n\n /**\n * We add an additional stack around every component that's not within a stack anyways.\n */\n if (\n // If this is a component\n ResolvedItemConfig.isComponentItem(config) &&\n\n // and it's not already within a stack\n !(parent instanceof Stack) &&\n\n // and we have a parent\n !!parent &&\n\n // and it's not the topmost item in a new window\n !(this.isSubWindow === true && parent instanceof GroundItem)\n ) {\n const stackConfig: ResolvedStackItemConfig = {\n type: ItemType.stack,\n content: [config],\n size: config.size,\n sizeUnit: config.sizeUnit,\n minSize: config.minSize,\n minSizeUnit: config.minSizeUnit,\n id: config.id,\n maximised: config.maximised,\n isClosable: config.isClosable,\n activeItemIndex: 0,\n header: undefined,\n };\n\n config = stackConfig;\n }\n\n const contentItem = this.createContentItemFromConfig(config, parent);\n return contentItem;\n }\n\n findFirstComponentItemById(id: string): ComponentItem | undefined {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMFFCIBI82446');\n } else {\n return this.findFirstContentItemTypeByIdRecursive(ItemType.component, id, this._groundItem) as ComponentItem;\n }\n }\n\n /**\n * Creates a popout window with the specified content at the specified position\n *\n * @param itemConfigOrContentItem - The content of the popout window's layout manager derived from either\n * a {@link (ContentItem:class)} or {@link (ItemConfig:interface)} or ResolvedItemConfig content (array of {@link (ItemConfig:interface)})\n * @param positionAndSize - The width, height, left and top of Popout window\n * @param parentId -The id of the element this item will be appended to when popIn is called\n * @param indexInParent - The position of this item within its parent element\n */\n\n createPopout(itemConfigOrContentItem: ContentItem | ResolvedRootItemConfig,\n positionAndSize: ResolvedPopoutLayoutConfig.Window,\n parentId: string | null,\n indexInParent: number | null\n ): BrowserPopout {\n if (itemConfigOrContentItem instanceof ContentItem) {\n return this.createPopoutFromContentItem(itemConfigOrContentItem, positionAndSize, parentId, indexInParent);\n } else {\n return this.createPopoutFromItemConfig(itemConfigOrContentItem, positionAndSize, parentId, indexInParent);\n }\n }\n\n /** @internal */\n createPopoutFromContentItem(item: ContentItem,\n window: ResolvedPopoutLayoutConfig.Window | undefined,\n parentId: string | null,\n indexInParent: number | null | undefined,\n ): BrowserPopout {\n /**\n * If the item is the only component within a stack or for some\n * other reason the only child of its parent the parent will be destroyed\n * when the child is removed.\n *\n * In order to support this we move up the tree until we find something\n * that will remain after the item is being popped out\n */\n let parent = item.parent;\n let child = item;\n while (parent !== null && parent.contentItems.length === 1 && !parent.isGround) {\n child = parent;\n parent = parent.parent;\n }\n\n if (parent === null) {\n throw new UnexpectedNullError('LMCPFCI00834');\n } else {\n if (indexInParent === undefined) {\n indexInParent = parent.contentItems.indexOf(child);\n }\n\n if (parentId !== null) {\n parent.addPopInParentId(parentId);\n }\n\n if (window === undefined) {\n const windowLeft = globalThis.screenX || globalThis.screenLeft;\n const windowTop = globalThis.screenY || globalThis.screenTop;\n const offsetLeft = item.element.offsetLeft;\n const offsetTop = item.element.offsetTop\n // const { left: offsetLeft, top: offsetTop } = getJQueryLeftAndTop(item.element);\n const { width, height } = getElementWidthAndHeight(item.element);\n\n window = {\n left: windowLeft + offsetLeft,\n top: windowTop + offsetTop,\n width,\n height,\n };\n }\n\n const itemConfig = item.toConfig();\n item.remove();\n\n if (!ResolvedRootItemConfig.isRootItemConfig(itemConfig)) {\n throw new Error(`${i18nStrings[I18nStringId.PopoutCannotBeCreatedWithGroundItemConfig]}`);\n } else {\n return this.createPopoutFromItemConfig(itemConfig, window, parentId, indexInParent);\n }\n }\n }\n\n /** @internal */\n beginVirtualSizedContainerAdding(): void {\n if (++this._virtualSizedContainerAddingBeginCount === 0) {\n this._virtualSizedContainers.length = 0;\n }\n }\n\n /** @internal */\n addVirtualSizedContainer(container: ComponentContainer): void {\n this._virtualSizedContainers.push(container);\n }\n\n /** @internal */\n endVirtualSizedContainerAdding(): void {\n if (--this._virtualSizedContainerAddingBeginCount === 0) {\n const count = this._virtualSizedContainers.length;\n if (count > 0) {\n this.fireBeforeVirtualRectingEvent(count);\n for (let i = 0; i < count; i++) {\n const container = this._virtualSizedContainers[i];\n container.notifyVirtualRectingRequired();\n }\n this.fireAfterVirtualRectingEvent();\n this._virtualSizedContainers.length = 0;\n }\n }\n }\n\n /** @internal */\n fireBeforeVirtualRectingEvent(count: number): void {\n if (this.beforeVirtualRectingEvent !== undefined) {\n this.beforeVirtualRectingEvent(count);\n }\n }\n\n /** @internal */\n fireAfterVirtualRectingEvent(): void {\n if (this.afterVirtualRectingEvent !== undefined) {\n this.afterVirtualRectingEvent();\n }\n }\n\n /** @internal */\n private createPopoutFromItemConfig(rootItemConfig: ResolvedRootItemConfig,\n window: ResolvedPopoutLayoutConfig.Window,\n parentId: string | null,\n indexInParent: number | null\n ) {\n const layoutConfig = this.toConfig();\n\n const popoutLayoutConfig: ResolvedPopoutLayoutConfig = {\n root: rootItemConfig,\n openPopouts: [],\n settings: layoutConfig.settings,\n dimensions: layoutConfig.dimensions,\n header: layoutConfig.header,\n window,\n parentId,\n indexInParent,\n resolved: true,\n }\n\n return this.createPopoutFromPopoutLayoutConfig(popoutLayoutConfig);\n }\n\n /** @internal */\n createPopoutFromPopoutLayoutConfig(config: ResolvedPopoutLayoutConfig): BrowserPopout {\n const configWindow = config.window;\n const initialWindow: Rect = {\n left: configWindow.left ?? (globalThis.screenX || globalThis.screenLeft + 20),\n top: configWindow.top ?? (globalThis.screenY || globalThis.screenTop + 20),\n width: configWindow.width ?? 500,\n height: configWindow.height ?? 309,\n };\n\n const browserPopout = new BrowserPopout(config, initialWindow, this);\n\n browserPopout.on('initialised', () => this.emit('windowOpened', browserPopout));\n browserPopout.on('closed', () => this.reconcilePopoutWindows());\n\n this._openPopouts.push(browserPopout);\n\n if (this.layoutConfig.settings.closePopoutsOnUnload && !this._windowBeforeUnloadListening) {\n globalThis.addEventListener('beforeunload', this._windowBeforeUnloadListener, { passive: true });\n this._windowBeforeUnloadListening = true;\n }\n\n return browserPopout;\n }\n\n /**\n * Closes all Open Popouts\n * Applications can call this method when a page is unloaded to remove its open popouts\n */\n\n closeAllOpenPopouts() {\n for (let i = 0; i < this._openPopouts.length; i++) {\n this._openPopouts[i].close();\n }\n\n this._openPopouts.length = 0;\n\n if (this._windowBeforeUnloadListening) {\n globalThis.removeEventListener('beforeunload', this._windowBeforeUnloadListener);\n this._windowBeforeUnloadListening = false;\n }\n }\n\n /**\n * Attaches DragListener to any given DOM element\n * and turns it into a way of creating new ComponentItems\n * by 'dragging' the DOM element into the layout\n *\n * @param element - The HTML element which will be listened to for commencement of drag.\n * @param componentTypeOrItemConfigCallback - Type of component to be created, or a callback which will provide the ItemConfig\n * to be used to create the component.\n * @param componentState - Optional initial state of component. This will be ignored if componentTypeOrFtn is a function.\n *\n * @returns an opaque object that identifies the DOM element\n\t * and the attached itemConfig. This can be used in\n\t * removeDragSource() later to get rid of the drag listeners.\n */\n newDragSource(element: HTMLElement, itemConfigCallback: () => (DragSource.ComponentItemConfig | ComponentItemConfig)): DragSource;\n /** @deprecated will be replaced in version 3 with newDragSource(element: HTMLElement, itemConfig: ComponentItemConfig) */\n newDragSource(element: HTMLElement, componentType: JsonValue, componentState?: JsonValue, title?: JsonValue, id?: string): DragSource;\n newDragSource(element: HTMLElement,\n componentTypeOrItemConfigCallback: JsonValue | (() => (DragSource.ComponentItemConfig | ComponentItemConfig)),\n componentState?: JsonValue,\n title?: string,\n id?: string,\n ): DragSource {\n const dragSource = new DragSource(this, element, [], componentTypeOrItemConfigCallback, componentState, title, id);\n this._dragSources.push(dragSource);\n\n return dragSource;\n }\n\n /**\n\t * Removes a DragListener added by createDragSource() so the corresponding\n\t * DOM element is not a drag source any more.\n\t */\n\tremoveDragSource(dragSource: DragSource): void {\n\t\tremoveFromArray(dragSource, this._dragSources );\n\t\tdragSource.destroy();\n }\n\n /** @internal */\n startComponentDrag(x: number, y: number, dragListener: DragListener, componentItem: ComponentItem, stack: Stack): void {\n new DragProxy(\n x,\n y,\n dragListener,\n this,\n componentItem,\n stack\n );\n }\n\n /**\n * Programmatically focuses an item. This focuses the specified component item\n * and the item emits a focus event\n *\n * @param item - The component item to be focused\n * @param suppressEvent - Whether to emit focus event\n */\n focusComponent(item: ComponentItem, suppressEvent = false): void {\n item.focus(suppressEvent);\n }\n\n /**\n * Programmatically blurs (defocuses) the currently focused component.\n * If a component item is focused, then it is blurred and and the item emits a blur event\n *\n * @param item - The component item to be blurred\n * @param suppressEvent - Whether to emit blur event\n */\n clearComponentFocus(suppressEvent = false): void {\n this.setFocusedComponentItem(undefined, suppressEvent);\n }\n\n /**\n * Programmatically focuses a component item or removes focus (blurs) from an existing focused component item.\n *\n * @param item - If defined, specifies the component item to be given focus. If undefined, clear component focus.\n * @param suppressEvents - Whether to emit focus and blur events\n * @internal\n */\n setFocusedComponentItem(item: ComponentItem | undefined, suppressEvents = false): void {\n if (item !== this._focusedComponentItem) {\n\n let newFocusedParentItem: ComponentParentableItem | undefined;\n if (item === undefined) {\n newFocusedParentItem === undefined;\n } else {\n newFocusedParentItem = item.parentItem;\n }\n\n if (this._focusedComponentItem !== undefined) {\n const oldFocusedItem = this._focusedComponentItem;\n this._focusedComponentItem = undefined;\n oldFocusedItem.setBlurred(suppressEvents);\n const oldFocusedParentItem = oldFocusedItem.parentItem;\n if (newFocusedParentItem === oldFocusedParentItem) {\n newFocusedParentItem = undefined;\n } else {\n oldFocusedParentItem.setFocusedValue(false);\n }\n }\n\n if (item !== undefined) {\n this._focusedComponentItem = item;\n item.setFocused(suppressEvents);\n if (newFocusedParentItem !== undefined) {\n newFocusedParentItem.setFocusedValue(true);\n }\n }\n }\n }\n\n /** @internal */\n private createContentItemFromConfig(config: ResolvedItemConfig, parent: ContentItem): ContentItem {\n switch (config.type) {\n case ItemType.ground: throw new AssertError('LMCCIFC68871');\n case ItemType.row: return new RowOrColumn(false, this, config as ResolvedRowOrColumnItemConfig, parent);\n case ItemType.column: return new RowOrColumn(true, this, config as ResolvedRowOrColumnItemConfig, parent);\n case ItemType.stack: return new Stack(this, config as ResolvedStackItemConfig, parent);\n case ItemType.component:\n return new ComponentItem(this, config as ResolvedComponentItemConfig, parent as Stack);\n default:\n throw new UnreachableCaseError('CCC913564', config.type, 'Invalid Config Item type specified');\n }\n }\n\n /**\n * This should only be called from stack component.\n * Stack will look after docking processing associated with maximise/minimise\n * @internal\n **/\n setMaximisedStack(stack: Stack | undefined): void {\n if (stack === undefined) {\n if (this._maximisedStack !== undefined) {\n this.processMinimiseMaximisedStack();\n }\n } else {\n if (stack !== this._maximisedStack) {\n if (this._maximisedStack !== undefined) {\n this.processMinimiseMaximisedStack();\n }\n\n this.processMaximiseStack(stack);\n }\n }\n }\n\n checkMinimiseMaximisedStack(): void {\n if (this._maximisedStack !== undefined) {\n this._maximisedStack.minimise();\n }\n }\n\n // showAllActiveContentItems() was called from ContentItem.show(). Not sure what its purpose was so have commented out\n // Everything seems to work ok without this. Have left commented code just in case there was a reason for it becomes\n // apparent\n\n // /** @internal */\n // showAllActiveContentItems(): void {\n // const allStacks = this.getAllStacks();\n\n // for (let i = 0; i < allStacks.length; i++) {\n // const stack = allStacks[i];\n // const activeContentItem = stack.getActiveComponentItem();\n\n // if (activeContentItem !== undefined) {\n // if (!(activeContentItem instanceof ComponentItem)) {\n // throw new AssertError('LMSAACIS22298');\n // } else {\n // activeContentItem.container.show();\n // }\n // }\n // }\n // }\n\n // hideAllActiveContentItems() was called from ContentItem.hide(). Not sure what its purpose was so have commented out\n // Everything seems to work ok without this. Have left commented code just in case there was a reason for it becomes\n // apparent\n\n // /** @internal */\n // hideAllActiveContentItems(): void {\n // const allStacks = this.getAllStacks();\n\n // for (let i = 0; i < allStacks.length; i++) {\n // const stack = allStacks[i];\n // const activeContentItem = stack.getActiveComponentItem();\n\n // if (activeContentItem !== undefined) {\n // if (!(activeContentItem instanceof ComponentItem)) {\n // throw new AssertError('LMSAACIH22298');\n // } else {\n // activeContentItem.container.hide();\n // }\n // }\n // }\n // }\n\n /** @internal */\n private cleanupBeforeMaximisedStackDestroyed(event: EventEmitter.BubblingEvent) {\n\t\tif (this._maximisedStack !== null && this._maximisedStack === event.target) {\n\t\t\tthis._maximisedStack.off('beforeItemDestroyed', this._maximisedStackBeforeDestroyedListener);\n\t\t\tthis._maximisedStack = undefined;\n\t\t}\n }\n\n /**\n * This method is used to get around sandboxed iframe restrictions.\n * If 'allow-top-navigation' is not specified in the iframe's 'sandbox' attribute\n * (as is the case with codepens) the parent window is forbidden from calling certain\n * methods on the child, such as window.close() or setting document.location.href.\n *\n * This prevented GoldenLayout popouts from popping in in codepens. The fix is to call\n * _$closeWindow on the child window's gl instance which (after a timeout to disconnect\n * the invoking method from the close call) closes itself.\n *\n * @internal\n */\n closeWindow(): void {\n globalThis.setTimeout(() => globalThis.close(), 1);\n }\n\n /** @internal */\n getArea(x: number, y: number): ContentItem.Area | null {\n let matchingArea = null;\n let smallestSurface = Infinity;\n\n for (let i = 0; i < this._itemAreas.length; i++) {\n const area = this._itemAreas[i];\n\n if (\n x >= area.x1 &&\n x < area.x2 && // x2 is not included in area\n y >= area.y1 &&\n y < area.y2 && // y2 is not included in area\n smallestSurface > area.surface\n ) {\n smallestSurface = area.surface;\n matchingArea = area;\n }\n }\n\n return matchingArea;\n }\n\n /** @internal */\n calculateItemAreas(): void {\n const allContentItems = this.getAllContentItems();\n /**\n * If the last item is dragged out, highlight the entire container size to\n * allow to re-drop it. this.ground.contentiItems.length === 0 at this point\n *\n * Don't include ground into the possible drop areas though otherwise since it\n * will used for every gap in the layout, e.g. splitters\n */\n const groundItem = this._groundItem;\n if (groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMCIAR44365');\n } else {\n if (allContentItems.length === 1) {\n // No root ContentItem (just Ground ContentItem)\n const groundArea = groundItem.getElementArea();\n if (groundArea === null) {\n throw new UnexpectedNullError('LMCIARA44365')\n } else {\n this._itemAreas = [groundArea];\n }\n return;\n } else {\n if (groundItem.contentItems[0].isStack) {\n // if root is Stack, then split stack and sides of Layout are same, so skip sides\n this._itemAreas = [];\n } else {\n // sides of layout\n this._itemAreas = groundItem.createSideAreas();\n }\n\n for (let i = 0; i < allContentItems.length; i++) {\n const stack = allContentItems[i];\n if (ContentItem.isStack(stack)) {\n const area = stack.getArea();\n\n if (area === null) {\n continue;\n } else {\n this._itemAreas.push(area);\n const stackContentAreaDimensions = stack.contentAreaDimensions;\n if (stackContentAreaDimensions === undefined) {\n throw new UnexpectedUndefinedError('LMCIASC45599');\n } else {\n const highlightArea = stackContentAreaDimensions.header.highlightArea\n const surface = (highlightArea.x2 - highlightArea.x1) * (highlightArea.y2 - highlightArea.y1);\n\n const header: ContentItem.Area = {\n x1: highlightArea.x1,\n x2: highlightArea.x2,\n y1: highlightArea.y1,\n y2: highlightArea.y2,\n contentItem: stack,\n surface,\n };\n this._itemAreas.push(header);\n }\n }\n }\n }\n }\n }\n }\n\n /**\n * Called as part of loading a new layout (including initial init()).\n * Checks to see layout has a maximised item. If so, it maximises that item.\n * @internal\n */\n private checkLoadedLayoutMaximiseItem() {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMCLLMI43432');\n } else {\n const configMaximisedItems = this._groundItem.getConfigMaximisedItems();\n\n if (configMaximisedItems.length > 0) {\n let item = configMaximisedItems[0];\n if (ContentItem.isComponentItem(item)) {\n const stack = item.parent;\n if (stack === null) {\n throw new UnexpectedNullError('LMXLLMI69999');\n } else {\n item = stack;\n }\n }\n if (!ContentItem.isStack(item)) {\n throw new AssertError('LMCLLMI19993');\n } else {\n item.maximise();\n }\n }\n }\n }\n\n /** @internal */\n private processMaximiseStack(stack: Stack): void {\n this._maximisedStack = stack;\n stack.on('beforeItemDestroyed', this._maximisedStackBeforeDestroyedListener);\n stack.element.classList.add(DomConstants.ClassName.Maximised);\n stack.element.insertAdjacentElement('afterend', this._maximisePlaceholder);\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMMXI19993');\n } else {\n this._groundItem.element.prepend(stack.element);\n const { width, height } = getElementWidthAndHeight(this._containerElement);\n setElementWidth(stack.element, width);\n setElementHeight(stack.element, height);\n stack.updateSize(true);\n stack.focusActiveContentItem();\n this._maximisedStack.emit('maximised');\n this.emit('stateChanged');\n }\n }\n\n /** @internal */\n private processMinimiseMaximisedStack(): void {\n if (this._maximisedStack === undefined) {\n throw new AssertError('LMMMS74422');\n } else {\n const stack = this._maximisedStack;\n if (stack.parent === null) {\n throw new UnexpectedNullError('LMMI13668');\n } else {\n stack.element.classList.remove(DomConstants.ClassName.Maximised);\n this._maximisePlaceholder.insertAdjacentElement('afterend', stack.element);\n this._maximisePlaceholder.remove();\n this.updateRootSize(true);\n this._maximisedStack = undefined;\n stack.off('beforeItemDestroyed', this._maximisedStackBeforeDestroyedListener);\n stack.emit('minimised');\n this.emit('stateChanged');\n }\n }\n }\n\n /**\n * Iterates through the array of open popout windows and removes the ones\n * that are effectively closed. This is necessary due to the lack of reliably\n * listening for window.close / unload events in a cross browser compatible fashion.\n * @internal\n */\n private reconcilePopoutWindows() {\n const openPopouts: BrowserPopout[] = [];\n\n for (let i = 0; i < this._openPopouts.length; i++) {\n if (this._openPopouts[i].getWindow().closed === false) {\n openPopouts.push(this._openPopouts[i]);\n } else {\n this.emit('windowClosed', this._openPopouts[i]);\n }\n }\n\n if (this._openPopouts.length !== openPopouts.length) {\n this._openPopouts = openPopouts;\n this.emit('stateChanged');\n }\n\n }\n\n /**\n * Returns a flattened array of all content items,\n * regardles of level or type\n * @internal\n */\n private getAllContentItems() {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMGACI13130');\n } else {\n return this._groundItem.getAllContentItems();\n }\n }\n\n /**\n * Creates Subwindows (if there are any). Throws an error\n * if popouts are blocked.\n * @internal\n */\n private createSubWindows() {\n for (let i = 0; i < this.layoutConfig.openPopouts.length; i++) {\n const popoutConfig = this.layoutConfig.openPopouts[i];\n this.createPopoutFromPopoutLayoutConfig(popoutConfig);\n }\n }\n\n /**\n * Debounces resize events\n * @internal\n */\n private handleContainerResize(): void {\n if (this.resizeWithContainerAutomatically) {\n this.processResizeWithDebounce();\n }\n }\n\n /**\n * Debounces resize events\n * @internal\n */\n private processResizeWithDebounce(): void {\n if (this.resizeDebounceExtendedWhenPossible) {\n this.checkClearResizeTimeout();\n }\n\n if (this._resizeTimeoutId === undefined) {\n this._resizeTimeoutId = setTimeout(\n () => {\n this._resizeTimeoutId = undefined;\n this.beginSizeInvalidation();\n this.endSizeInvalidation();\n },\n this.resizeDebounceInterval,\n );\n }\n }\n\n private checkClearResizeTimeout() {\n if (this._resizeTimeoutId !== undefined) {\n clearTimeout(this._resizeTimeoutId);\n this._resizeTimeoutId = undefined;\n }\n }\n\n /**\n * Determines what element the layout will be created in\n * @internal\n */\n private setContainer() {\n const bodyElement = document.body;\n const containerElement = this._containerElement ?? bodyElement;\n\n if (containerElement === bodyElement) {\n this.resizeWithContainerAutomatically = true;\n\n const documentElement = document.documentElement;\n documentElement.style.height = '100%';\n documentElement.style.margin = '0';\n documentElement.style.padding = '0';\n documentElement.style.overflow = 'clip';\n bodyElement.style.height = '100%';\n bodyElement.style.margin = '0';\n bodyElement.style.padding = '0';\n bodyElement.style.overflow = 'clip';\n }\n\n this._containerElement = containerElement;\n }\n\n /**\n * Called when the window is closed or the user navigates away\n * from the page\n * @internal\n * @deprecated to be removed in version 3\n */\n private onBeforeUnload(): void {\n this.destroy();\n }\n\n /**\n * Adjusts the number of columns to be lower to fit the screen and still maintain minItemWidth.\n * @internal\n */\n private adjustColumnsResponsive() {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMACR20883');\n } else {\n this._firstLoad = false;\n // If there is no min width set, or not content items, do nothing.\n if (this.useResponsiveLayout() &&\n !this._updatingColumnsResponsive &&\n this._groundItem.contentItems.length > 0 &&\n this._groundItem.contentItems[0].isRow)\n {\n if (this._groundItem === undefined || this._width === null) {\n throw new UnexpectedUndefinedError('LMACR77412');\n } else {\n // If there is only one column, do nothing.\n const columnCount = this._groundItem.contentItems[0].contentItems.length;\n if (columnCount <= 1) {\n return;\n } else {\n // If they all still fit, do nothing.\n const minItemWidth = this.layoutConfig.dimensions.defaultMinItemWidth;\n const totalMinWidth = columnCount * minItemWidth;\n if (totalMinWidth <= this._width) {\n return;\n } else {\n // Prevent updates while it is already happening.\n this._updatingColumnsResponsive = true;\n\n // Figure out how many columns to stack, and put them all in the first stack container.\n const finalColumnCount = Math.max(Math.floor(this._width / minItemWidth), 1);\n const stackColumnCount = columnCount - finalColumnCount;\n\n const rootContentItem = this._groundItem.contentItems[0];\n const allStacks = this.getAllStacks();\n if (allStacks.length === 0) {\n throw new AssertError('LMACRS77413')\n } else {\n const firstStackContainer = allStacks[0];\n for (let i = 0; i < stackColumnCount; i++) {\n // Stack from right.\n const column = rootContentItem.contentItems[rootContentItem.contentItems.length - 1];\n this.addChildContentItemsToContainer(firstStackContainer, column);\n }\n\n this._updatingColumnsResponsive = false;\n }\n }\n }\n }\n }\n }\n }\n\n /**\n * Determines if responsive layout should be used.\n *\n * @returns True if responsive layout should be used; otherwise false.\n * @internal\n */\n private useResponsiveLayout() {\n const settings = this.layoutConfig.settings;\n const alwaysResponsiveMode = settings.responsiveMode === ResponsiveMode.always;\n const onLoadResponsiveModeAndFirst = settings.responsiveMode === ResponsiveMode.onload && this._firstLoad;\n return alwaysResponsiveMode || onLoadResponsiveModeAndFirst;\n }\n\n /**\n * Adds all children of a node to another container recursively.\n * @param container - Container to add child content items to.\n * @param node - Node to search for content items.\n * @internal\n */\n private addChildContentItemsToContainer(container: ContentItem, node: ContentItem) {\n const contentItems = node.contentItems;\n if (node instanceof Stack) {\n for (let i = 0; i < contentItems.length; i++) {\n const item = contentItems[i];\n node.removeChild(item, true);\n container.addChild(item);\n }\n } else {\n for (let i = 0; i < contentItems.length; i++) {\n const item = contentItems[i];\n this.addChildContentItemsToContainer(container, item);\n }\n }\n }\n\n /**\n * Finds all the stacks.\n * @returns The found stack containers.\n * @internal\n */\n private getAllStacks() {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMFASC52778');\n } else {\n const stacks: Stack[] = [];\n this.findAllStacksRecursive(stacks, this._groundItem);\n\n return stacks;\n }\n }\n\n /** @internal */\n private findFirstContentItemType(type: ItemType): ContentItem | undefined {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMFFCIT82446');\n } else {\n return this.findFirstContentItemTypeRecursive(type, this._groundItem);\n }\n }\n\n /** @internal */\n private findFirstContentItemTypeRecursive(type: ItemType, node: ContentItem): ContentItem | undefined {\n const contentItems = node.contentItems;\n const contentItemCount = contentItems.length;\n if (contentItemCount === 0) {\n return undefined;\n } else {\n for (let i = 0; i < contentItemCount; i++) {\n const contentItem = contentItems[i];\n if (contentItem.type === type) {\n return contentItem;\n }\n }\n\n for (let i = 0; i < contentItemCount; i++) {\n const contentItem = contentItems[i];\n const foundContentItem = this.findFirstContentItemTypeRecursive(type, contentItem);\n if (foundContentItem !== undefined) {\n return foundContentItem;\n }\n }\n\n return undefined;\n }\n }\n\n /** @internal */\n private findFirstContentItemTypeByIdRecursive(type: ItemType, id: string, node: ContentItem): ContentItem | undefined {\n const contentItems = node.contentItems;\n const contentItemCount = contentItems.length;\n if (contentItemCount === 0) {\n return undefined;\n } else {\n for (let i = 0; i < contentItemCount; i++) {\n const contentItem = contentItems[i];\n if (contentItem.type === type && contentItem.id === id) {\n return contentItem;\n }\n }\n\n for (let i = 0; i < contentItemCount; i++) {\n const contentItem = contentItems[i];\n const foundContentItem = this.findFirstContentItemTypeByIdRecursive(type, id, contentItem);\n if (foundContentItem !== undefined) {\n return foundContentItem;\n }\n }\n\n return undefined;\n }\n }\n\n /**\n * Finds all the stack containers.\n *\n * @param stacks - Set of containers to populate.\n * @param node - Current node to process.\n * @internal\n */\n private findAllStacksRecursive(stacks: Stack[], node: ContentItem) {\n const contentItems = node.contentItems;\n for (let i = 0; i < contentItems.length; i++) {\n const item = contentItems[i];\n if (item instanceof Stack) {\n stacks.push(item);\n } else {\n if (!item.isComponent) {\n this.findAllStacksRecursive(stacks, item);\n }\n }\n }\n }\n\n /** @internal */\n private findFirstLocation(selectors: readonly LayoutManager.LocationSelector[]): LayoutManager.Location | undefined {\n const count = selectors.length;\n for (let i = 0; i < count; i++) {\n const selector = selectors[i];\n const location = this.findLocation(selector);\n if (location !== undefined) {\n return location;\n }\n }\n return undefined;\n }\n\n /** @internal */\n private findLocation(selector: LayoutManager.LocationSelector): LayoutManager.Location | undefined {\n const selectorIndex = selector.index;\n switch (selector.typeId) {\n case LayoutManager.LocationSelector.TypeId.FocusedItem: {\n if (this._focusedComponentItem === undefined) {\n return undefined\n } else {\n const parentItem = this._focusedComponentItem.parentItem;\n const parentContentItems = parentItem.contentItems;\n const parentContentItemCount = parentContentItems.length;\n if (selectorIndex === undefined) {\n return { parentItem, index: parentContentItemCount };\n } else {\n const focusedIndex = parentContentItems.indexOf(this._focusedComponentItem);\n const index = focusedIndex + selectorIndex;\n if (index < 0 || index > parentContentItemCount) {\n return undefined;\n } else {\n return { parentItem, index };\n }\n }\n }\n }\n case LayoutManager.LocationSelector.TypeId.FocusedStack: {\n if (this._focusedComponentItem === undefined) {\n return undefined\n } else {\n const parentItem = this._focusedComponentItem.parentItem;\n return this.tryCreateLocationFromParentItem(parentItem, selectorIndex);\n }\n }\n case LayoutManager.LocationSelector.TypeId.FirstStack: {\n const parentItem = this.findFirstContentItemType(ItemType.stack);\n if (parentItem === undefined) {\n return undefined;\n } else {\n return this.tryCreateLocationFromParentItem(parentItem, selectorIndex);\n }\n }\n case LayoutManager.LocationSelector.TypeId.FirstRowOrColumn: {\n let parentItem = this.findFirstContentItemType(ItemType.row);\n if (parentItem !== undefined) {\n return this.tryCreateLocationFromParentItem(parentItem, selectorIndex);\n } else {\n parentItem = this.findFirstContentItemType(ItemType.column);\n if (parentItem !== undefined) {\n return this.tryCreateLocationFromParentItem(parentItem, selectorIndex);\n } else {\n return undefined;\n }\n }\n }\n case LayoutManager.LocationSelector.TypeId.FirstRow: {\n const parentItem = this.findFirstContentItemType(ItemType.row);\n if (parentItem === undefined) {\n return undefined;\n } else {\n return this.tryCreateLocationFromParentItem(parentItem, selectorIndex);\n }\n }\n case LayoutManager.LocationSelector.TypeId.FirstColumn: {\n const parentItem = this.findFirstContentItemType(ItemType.column);\n if (parentItem === undefined) {\n return undefined;\n } else {\n return this.tryCreateLocationFromParentItem(parentItem, selectorIndex);\n }\n }\n case LayoutManager.LocationSelector.TypeId.Empty: {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMFLRIF18244');\n } else {\n if (this.rootItem !== undefined) {\n return undefined;\n } else {\n if (selectorIndex === undefined || selectorIndex === 0)\n return { parentItem: this._groundItem, index: 0 };\n else {\n return undefined;\n }\n }\n }\n }\n case LayoutManager.LocationSelector.TypeId.Root: {\n if (this._groundItem === undefined) {\n throw new UnexpectedUndefinedError('LMFLF18244');\n } else {\n const groundContentItems = this._groundItem.contentItems;\n if (groundContentItems.length === 0) {\n if (selectorIndex === undefined || selectorIndex === 0)\n return { parentItem: this._groundItem, index: 0 };\n else {\n return undefined;\n }\n } else {\n const parentItem = groundContentItems[0];\n return this.tryCreateLocationFromParentItem(parentItem, selectorIndex);\n }\n }\n }\n }\n }\n\n /** @internal */\n private tryCreateLocationFromParentItem(parentItem: ContentItem,\n selectorIndex: number | undefined\n ): LayoutManager.Location | undefined {\n const parentContentItems = parentItem.contentItems;\n const parentContentItemCount = parentContentItems.length;\n if (selectorIndex === undefined) {\n return { parentItem, index: parentContentItemCount };\n } else {\n if (selectorIndex < 0 || selectorIndex > parentContentItemCount) {\n return undefined;\n } else {\n return { parentItem, index: selectorIndex };\n }\n }\n }\n}\n\n/** @public */\nexport namespace LayoutManager {\n export type BeforeVirtualRectingEvent = (this: void, count: number) => void;\n export type AfterVirtualRectingEvent = (this: void) => void;\n\n /** @internal */\n export interface ConstructorParameters {\n constructorOrSubWindowLayoutConfig: LayoutConfig | undefined;\n isSubWindow: boolean;\n containerElement: HTMLElement | undefined;\n }\n\n /** @internal */\n export function createMaximisePlaceElement(document: Document): HTMLElement {\n const element = document.createElement('div');\n element.classList.add(DomConstants.ClassName.MaximisePlace);\n return element;\n }\n\n /** @internal */\n export function createTabDropPlaceholderElement(document: Document): HTMLElement {\n const element = document.createElement('div');\n element.classList.add(DomConstants.ClassName.DropTabPlaceholder);\n return element;\n }\n\n /**\n * Specifies a location of a ContentItem without referencing the content item.\n * Used to specify where a new item is to be added\n * @public\n */\n export interface Location {\n parentItem: ContentItem;\n index: number;\n }\n\n /**\n * A selector used to specify a unique location in the layout\n * @public\n */\n export interface LocationSelector {\n /** Specifies selector algorithm */\n typeId: LocationSelector.TypeId;\n /** Used by algorithm to determine index in found ContentItem */\n index?: number;\n }\n\n /** @public */\n export namespace LocationSelector {\n export const enum TypeId {\n /** Stack with focused Item. Index specifies offset from index of focused item (eg 1 is the position after focused item) */\n FocusedItem,\n /** Stack with focused Item. Index specfies ContentItems index */\n FocusedStack,\n /** First stack found in layout */\n FirstStack,\n /** First Row or Column found in layout (rows are searched first) */\n FirstRowOrColumn,\n /** First Row in layout */\n FirstRow,\n /** First Column in layout */\n FirstColumn,\n /** Finds a location if layout is empty. The found location will be the root ContentItem. */\n Empty,\n /** Finds root if layout is empty, otherwise a child under root */\n Root,\n }\n }\n\n /**\n * Default LocationSelectors array used if none is specified. Will always find a location.\n * @public\n */\n export const defaultLocationSelectors: readonly LocationSelector[] = [\n { typeId: LocationSelector.TypeId.FocusedStack, index: undefined },\n { typeId: LocationSelector.TypeId.FirstStack, index: undefined },\n { typeId: LocationSelector.TypeId.FirstRowOrColumn, index: undefined },\n { typeId: LocationSelector.TypeId.Root, index: undefined },\n ];\n\n /**\n * LocationSelectors to try to get location next to existing focused item\n * @public\n */\n export const afterFocusedItemIfPossibleLocationSelectors: readonly LocationSelector[] = [\n { typeId: LocationSelector.TypeId.FocusedItem, index: 1 },\n { typeId: LocationSelector.TypeId.FirstStack, index: undefined },\n { typeId: LocationSelector.TypeId.FirstRowOrColumn, index: undefined },\n { typeId: LocationSelector.TypeId.Root, index: undefined },\n ];\n}\n","import { LayoutConfig } from './config/config';\nimport { ResolvedComponentItemConfig, ResolvedLayoutConfig, ResolvedPopoutLayoutConfig } from './config/resolved-config';\nimport { ComponentContainer } from './container/component-container';\nimport { BindError } from './errors/external-error';\nimport { UnexpectedUndefinedError } from './errors/internal-error';\nimport { LayoutManager } from './layout-manager';\nimport { DomConstants } from './utils/dom-constants';\nimport { I18nStringId, i18nStrings } from './utils/i18n-strings';\n\n/** @public */\nexport class VirtualLayout extends LayoutManager {\n /**\n * @deprecated Use {@link (VirtualLayout:class).bindComponentEvent} and\n * {@link (VirtualLayout:class).unbindComponentEvent} with virtual components\n */\n getComponentEvent: VirtualLayout.GetComponentEventHandler | undefined;\n /**\n * @deprecated Use {@link (VirtualLayout:class).bindComponentEvent} and\n * {@link (VirtualLayout:class).unbindComponentEvent} with virtual components\n */\n releaseComponentEvent: VirtualLayout.ReleaseComponentEventHandler | undefined;\n\n bindComponentEvent: VirtualLayout.BindComponentEventHandler | undefined;\n unbindComponentEvent: VirtualLayout.UnbindComponentEventHandler | undefined;\n\n /** @internal @deprecated use while constructor is not determinate */\n private _bindComponentEventHanlderPassedInConstructor = false; // remove when constructor is determinate\n /** @internal @deprecated use while constructor is not determinate */\n private _creationTimeoutPassed = false; // remove when constructor is determinate\n\n /**\n * @param container - A Dom HTML element. Defaults to body\n * @param bindComponentEventHandler - Event handler to bind components\n * @param bindComponentEventHandler - Event handler to unbind components\n * If bindComponentEventHandler is defined, then constructor will be determinate. It will always call the init()\n * function and the init() function will always complete. This means that the bindComponentEventHandler will be called\n * if constructor is for a popout window. Make sure bindComponentEventHandler is ready for events.\n */\n constructor(\n container?: HTMLElement,\n bindComponentEventHandler?: VirtualLayout.BindComponentEventHandler,\n unbindComponentEventHandler?: VirtualLayout.UnbindComponentEventHandler,\n );\n /** @deprecated specify layoutConfig in {@link (LayoutManager:class).loadLayout} */\n constructor(config: LayoutConfig, container?: HTMLElement);\n /** @internal */\n constructor(configOrOptionalContainer: LayoutConfig | HTMLElement | undefined,\n containerOrBindComponentEventHandler: HTMLElement | VirtualLayout.BindComponentEventHandler | undefined,\n unbindComponentEventHandler: VirtualLayout.UnbindComponentEventHandler | undefined,\n skipInit: true,\n );\n /** @internal */\n constructor(configOrOptionalContainer: LayoutConfig | HTMLElement | undefined,\n containerOrBindComponentEventHandler?: HTMLElement | VirtualLayout.BindComponentEventHandler,\n unbindComponentEventHandler?: VirtualLayout.UnbindComponentEventHandler,\n skipInit?: true,\n ) {\n super(VirtualLayout.createLayoutManagerConstructorParameters(configOrOptionalContainer, containerOrBindComponentEventHandler));\n\n if (containerOrBindComponentEventHandler !== undefined) {\n if (typeof containerOrBindComponentEventHandler === 'function') {\n this.bindComponentEvent = containerOrBindComponentEventHandler;\n this._bindComponentEventHanlderPassedInConstructor = true;\n\n if (unbindComponentEventHandler !== undefined) {\n this.unbindComponentEvent = unbindComponentEventHandler;\n }\n }\n }\n\n if (!this._bindComponentEventHanlderPassedInConstructor) {\n // backward compatibility\n\n if (this.isSubWindow) {\n // document.body.style.visibility = 'hidden';\n // Set up layoutConfig since constructor is not determinate and may exit early. Other functions may need\n // this.layoutConfig. this.layoutConfig is again calculated in the same way when init() completes.\n // Remove this when constructor is determinate.\n if (this._constructorOrSubWindowLayoutConfig === undefined) {\n throw new UnexpectedUndefinedError('VLC98823');\n } else {\n const resolvedLayoutConfig = LayoutConfig.resolve(this._constructorOrSubWindowLayoutConfig);\n // remove root from layoutConfig\n this.layoutConfig = {\n ...resolvedLayoutConfig,\n root: undefined,\n }\n }\n }\n }\n\n if (skipInit !== true) {\n if (!this.deprecatedConstructor) {\n this.init();\n }\n }\n }\n\n override destroy(): void {\n this.bindComponentEvent = undefined;\n this.unbindComponentEvent = undefined;\n\n super.destroy();\n }\n\n\n /**\n * Creates the actual layout. Must be called after all initial components\n * are registered. Recurses through the configuration and sets up\n * the item tree.\n *\n * If called before the document is ready it adds itself as a listener\n * to the document.ready event\n * @deprecated LayoutConfig should not be loaded in {@link (LayoutManager:class)} constructor, but rather in a\n * {@link (LayoutManager:class).loadLayout} call. If LayoutConfig is not specified in {@link (LayoutManager:class)} constructor,\n * then init() will be automatically called internally and should not be called externally.\n */\n override init(): void {\n\n /**\n * If the document isn't ready yet, wait for it.\n */\n if (!this._bindComponentEventHanlderPassedInConstructor && (document.readyState === 'loading' || document.body === null)) {\n document.addEventListener('DOMContentLoaded', () => this.init(), { passive: true });\n return;\n }\n\n /**\n * If this is a subwindow, wait a few milliseconds for the original\n * page's js calls to be executed, then replace the bodies content\n * with GoldenLayout\n */\n if (!this._bindComponentEventHanlderPassedInConstructor && this.isSubWindow === true && !this._creationTimeoutPassed) {\n setTimeout(() => this.init(), 7);\n this._creationTimeoutPassed = true;\n return;\n }\n\n if (this.isSubWindow === true) {\n if (!this._bindComponentEventHanlderPassedInConstructor) {\n this.clearHtmlAndAdjustStylesForSubWindow();\n }\n\n // Expose this instance on the window object to allow the opening window to interact with it\n window.__glInstance = this;\n }\n\n super.init();\n }\n\n /**\n * Clears existing HTML and adjusts style to make window suitable to be a popout sub window\n * Curently is automatically called when window is a subWindow and bindComponentEvent is not passed in the constructor\n * If bindComponentEvent is not passed in the constructor, the application must either call this function explicitly or\n * (preferably) make the window suitable as a subwindow.\n * In the future, it is planned that this function is NOT automatically called in any circumstances. Applications will\n * need to determine whether a window is a Golden Layout popout window and either call this function explicitly or\n * hide HTML not relevant to the popout.\n * See apitest for an example of how HTML is hidden when popout windows are displayed\n */\n clearHtmlAndAdjustStylesForSubWindow(): void {\n const headElement = document.head;\n\n const appendNodeLists = new Array>(4);\n appendNodeLists[0] = document.querySelectorAll('body link');\n appendNodeLists[1] = document.querySelectorAll('body style');\n appendNodeLists[2] = document.querySelectorAll('template');\n appendNodeLists[3] = document.querySelectorAll('.gl_keep');\n\n for (let listIdx = 0; listIdx < appendNodeLists.length; listIdx++) {\n const appendNodeList = appendNodeLists[listIdx];\n for (let nodeIdx = 0; nodeIdx < appendNodeList.length; nodeIdx++) {\n const node = appendNodeList[nodeIdx];\n headElement.appendChild(node);\n }\n }\n\n const bodyElement = document.body;\n bodyElement.innerHTML = '';\n bodyElement.style.visibility = 'visible';\n this.checkAddDefaultPopinButton();\n\n /*\n * This seems a bit pointless, but actually causes a reflow/re-evaluation getting around\n * slickgrid's \"Cannot find stylesheet.\" bug in chrome\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const x = document.body.offsetHeight;\n }\n /**\n * Will add button if not popinOnClose specified in settings\n * @returns true if added otherwise false\n */\n checkAddDefaultPopinButton(): boolean {\n if (this.layoutConfig.settings.popInOnClose) {\n return false;\n } else {\n const popInButtonElement = document.createElement('div');\n popInButtonElement.classList.add(DomConstants.ClassName.Popin);\n popInButtonElement.setAttribute('title', this.layoutConfig.header.dock);\n const iconElement = document.createElement('div');\n iconElement.classList.add(DomConstants.ClassName.Icon);\n const bgElement = document.createElement('div');\n bgElement.classList.add(DomConstants.ClassName.Bg);\n popInButtonElement.appendChild(iconElement);\n popInButtonElement.appendChild(bgElement);\n popInButtonElement.addEventListener('click', () => this.emit('popIn'));\n document.body.appendChild(popInButtonElement);\n return true;\n }\n }\n\n /** @internal */\n override bindComponent(container: ComponentContainer, itemConfig: ResolvedComponentItemConfig): ComponentContainer.BindableComponent {\n if (this.bindComponentEvent !== undefined) {\n const bindableComponent = this.bindComponentEvent(container, itemConfig);\n return bindableComponent;\n } else {\n if (this.getComponentEvent !== undefined) {\n return {\n virtual: false,\n component: this.getComponentEvent(container, itemConfig),\n }\n } else {\n // There is no component registered for this type, and we don't have a getComponentEvent defined.\n // This might happen when the user pops out a dialog and the component types are not registered upfront.\n const text = i18nStrings[I18nStringId.ComponentTypeNotRegisteredAndBindComponentEventHandlerNotAssigned];\n const message = `${text}: ${JSON.stringify(itemConfig)}`\n throw new BindError(message);\n }\n }\n }\n\n /** @internal */\n override unbindComponent(container: ComponentContainer, virtual: boolean, component: ComponentContainer.Component | undefined): void {\n if (this.unbindComponentEvent !== undefined) {\n this.unbindComponentEvent(container);\n } else {\n if (!virtual && this.releaseComponentEvent !== undefined) {\n if (component === undefined) {\n throw new UnexpectedUndefinedError('VCUCRCU333998');\n } else {\n this.releaseComponentEvent(container, component);\n }\n }\n }\n }\n}\n\n/** @public */\nexport namespace VirtualLayout {\n /**\n * @deprecated Use virtual components with {@link (VirtualLayout:class).bindComponentEvent} and\n * {@link (VirtualLayout:class).unbindComponentEvent} events.\n */\n export type GetComponentEventHandler =\n (this: void, container: ComponentContainer, itemConfig: ResolvedComponentItemConfig) => ComponentContainer.Component;\n /**\n * @deprecated Use virtual components with {@link (VirtualLayout:class).bindComponentEvent} and\n * {@link (VirtualLayout:class).unbindComponentEvent} events.\n */\n export type ReleaseComponentEventHandler =\n (this: void, container: ComponentContainer, component: ComponentContainer.Component) => void;\n\n export type BindComponentEventHandler =\n (this: void, container: ComponentContainer, itemConfig: ResolvedComponentItemConfig) => ComponentContainer.BindableComponent;\n export type UnbindComponentEventHandler =\n (this: void, container: ComponentContainer) => void;\n\n export type BeforeVirtualRectingEvent = (this: void) => void;\n\n /** @internal\n * Veriable to hold the state whether we already checked if we are running in a sub window.\n * Fixes popout and creation of nested golden-layouts.\n */\n let subWindowChecked = false;\n\n /** @internal */\n export function createLayoutManagerConstructorParameters(configOrOptionalContainer: LayoutConfig | HTMLElement | undefined,\n containerOrBindComponentEventHandler?: HTMLElement | VirtualLayout.BindComponentEventHandler):\n LayoutManager.ConstructorParameters\n {\n const windowConfigKey = subWindowChecked ? null : new URL(document.location.href).searchParams.get('gl-window');\n subWindowChecked = true;\n const isSubWindow = windowConfigKey !== null;\n\n let containerElement: HTMLElement | undefined;\n let config: LayoutConfig | undefined;\n if (windowConfigKey !== null) {\n const windowConfigStr = localStorage.getItem(windowConfigKey);\n if (windowConfigStr === null) {\n throw new Error('Null gl-window Config');\n }\n localStorage.removeItem(windowConfigKey);\n const minifiedWindowConfig = JSON.parse(windowConfigStr) as ResolvedPopoutLayoutConfig;\n const resolvedConfig = ResolvedLayoutConfig.unminifyConfig(minifiedWindowConfig);\n config = LayoutConfig.fromResolved(resolvedConfig)\n\n if (configOrOptionalContainer instanceof HTMLElement) {\n containerElement = configOrOptionalContainer;\n }\n } else {\n if (configOrOptionalContainer === undefined) {\n config = undefined;\n } else {\n if (configOrOptionalContainer instanceof HTMLElement) {\n config = undefined;\n containerElement = configOrOptionalContainer;\n } else {\n // backwards compatibility\n config = configOrOptionalContainer;\n }\n }\n\n if (containerElement === undefined) {\n if (containerOrBindComponentEventHandler instanceof HTMLElement) {\n containerElement = containerOrBindComponentEventHandler;\n }\n }\n }\n\n return {\n constructorOrSubWindowLayoutConfig: config,\n isSubWindow,\n containerElement,\n };\n }\n}\n","/* eslint indent: [\"error\", 2, { \"SwitchCase\": 1 }] */\n/* eslint no-param-reassign: [\"error\",\n{ \"props\": true, \"ignorePropertyModificationsFor\": [\"container\"] }] */\nimport { GoldenLayout } from 'golden-layout';\n\nconst config = {\n settings: {\n showPopoutIcon: false,\n showCloseIcon: false,\n },\n dimensions: {\n minItemHeight: 40,\n },\n content: [{\n type: 'row',\n content: [{\n type: 'column',\n width: 40,\n content: [{\n type: 'component',\n height: 67,\n isClosable: false,\n componentName: 'template',\n title: 'IC',\n componentState: { id: 'client_wrapper' },\n },\n {\n type: 'component',\n height: 33,\n isClosable: false,\n title: 'IC Options',\n componentName: 'template',\n componentState: { id: 'icoptions' },\n }]\n },\n {\n type: 'column',\n content: [{\n type: 'row',\n height: 65,\n content: [{\n type: 'stack',\n content: [{\n type: 'component',\n isClosable: false,\n title: 'Main',\n componentName: 'template',\n componentState: { id: 'mainmenu' },\n },\n {\n type: 'component',\n isClosable: false,\n title: 'Log',\n componentName: 'template',\n componentState: { id: 'log' },\n }],\n },\n {\n type: 'stack',\n width: 30,\n content: [{\n type: 'component',\n isClosable: false,\n title: 'Music',\n componentName: 'template',\n componentState: { id: 'music' },\n },\n {\n type: 'component',\n isClosable: true,\n title: 'Players',\n componentName: 'template',\n componentState: { id: 'players' },\n }],\n }],\n },\n {\n type: 'row',\n content: [{\n type: 'component',\n title: 'OOC',\n componentName: 'template',\n componentState: { id: 'ooc' },\n }],\n }],\n }],\n }],\n};\n\n\nconst configMobile = {\n settings: {\n showPopoutIcon: false,\n showCloseIcon: false,\n },\n dimensions: {\n minItemHeight: 40,\n },\n content: [{\n type: 'row',\n content: [{\n type: 'column',\n content: [{\n type: 'component',\n isClosable: false,\n reorderEnabled: false,\n componentName: 'template',\n title: 'IC',\n componentState: { id: 'client_wrapper' },\n height: 56 // Adjust the height proportion as needed\n },\n {\n type: 'stack',\n height: 44,\n content: [{\n type: 'component',\n isClosable: false,\n reorderEnabled: false,\n title: 'IC Options',\n componentName: 'template',\n componentState: { id: 'icoptions' },\n },\n {\n type: 'component',\n isClosable: false,\n reorderEnabled: false,\n title: 'Main',\n componentName: 'template',\n componentState: { id: 'mainmenu' },\n },\n {\n type: 'component',\n isClosable: false,\n reorderEnabled: false,\n title: 'Log',\n componentName: 'template',\n componentState: { id: 'log' },\n },\n {\n type: 'component',\n isClosable: false,\n reorderEnabled: false,\n title: 'Music',\n componentName: 'template',\n componentState: { id: 'music' },\n },\n {\n type: 'component',\n isClosable: true,\n title: 'Players',\n componentName: 'template',\n componentState: { id: 'players' },\n },\n {\n type: 'component',\n isClosable: false,\n reorderEnabled: false,\n title: 'OOC',\n componentName: 'template',\n componentState: { id: 'ooc' },\n }]\n }]\n }]\n }]\n}\n\n\nconst isMobileDevice = window.innerWidth <= window.innerHeight; \n\nconst golden = new GoldenLayout();\ngolden.registerComponentFactoryFunction('template', (container, componentState) => {\n const template = document.querySelector(`#${componentState.id}`);\n container.element.innerHTML = template.innerHTML;\n});\nif (isMobileDevice){\n golden.loadLayout(configMobile);\n}\nelse {\n golden.loadLayout(config);\n}\n","import { LayoutConfig } from './config/config';\nimport { ResolvedComponentItemConfig } from './config/resolved-config';\nimport { ComponentContainer } from './container/component-container';\nimport { ApiError, BindError } from './errors/external-error';\nimport { AssertError, UnexpectedUndefinedError } from './errors/internal-error';\nimport { I18nStringId, i18nStrings } from './utils/i18n-strings';\nimport { JsonValue, LogicalZIndex } from './utils/types';\nimport { deepExtendValue, ensureElementPositionAbsolute, numberToPixels, setElementDisplayVisibility, setElementHeight, setElementWidth } from './utils/utils';\nimport { VirtualLayout } from './virtual-layout';\n\n/** @public */\nexport class GoldenLayout extends VirtualLayout {\n /** @internal */\n private _componentTypesMap = new Map();\n /** @internal */\n private _getComponentConstructorFtn: GoldenLayout.GetComponentConstructorCallback;\n\n /** @internal */\n private _registeredComponentMap = new Map();\n /** @internal */\n private _virtuableComponentMap = new Map();\n /** @internal */\n private _goldenLayoutBoundingClientRect: DOMRect;\n\n /** @internal */\n private _containerVirtualRectingRequiredEventListener =\n (container: ComponentContainer, width: number, height: number) => this.handleContainerVirtualRectingRequiredEvent(container, width, height);\n /** @internal */\n private _containerVirtualVisibilityChangeRequiredEventListener =\n (container: ComponentContainer, visible: boolean) => this.handleContainerVirtualVisibilityChangeRequiredEvent(container, visible);\n /** @internal */\n private _containerVirtualZIndexChangeRequiredEventListener =\n (container: ComponentContainer, logicalZIndex: LogicalZIndex, defaultZIndex: string) =>\n this.handleContainerVirtualZIndexChangeRequiredEvent(container, logicalZIndex, defaultZIndex);\n\n /**\n * @param container - A Dom HTML element. Defaults to body\n * @param bindComponentEventHandler - Event handler to bind components\n * @param bindComponentEventHandler - Event handler to unbind components\n * If bindComponentEventHandler is defined, then constructor will be determinate. It will always call the init()\n * function and the init() function will always complete. This means that the bindComponentEventHandler will be called\n * if constructor is for a popout window. Make sure bindComponentEventHandler is ready for events.\n */\n constructor(\n container?: HTMLElement,\n bindComponentEventHandler?: VirtualLayout.BindComponentEventHandler,\n unbindComponentEventHandler?: VirtualLayout.UnbindComponentEventHandler,\n );\n /** @deprecated specify layoutConfig in {@link (LayoutManager:class).loadLayout} */\n constructor(config: LayoutConfig, container?: HTMLElement);\n /** @internal */\n constructor(configOrOptionalContainer: LayoutConfig | HTMLElement | undefined,\n containerOrBindComponentEventHandler?: HTMLElement | VirtualLayout.BindComponentEventHandler,\n unbindComponentEventHandler?: VirtualLayout.UnbindComponentEventHandler,\n ) {\n super(configOrOptionalContainer, containerOrBindComponentEventHandler, unbindComponentEventHandler, true);\n // we told VirtualLayout to not call init() (skipInit set to true) so that Golden Layout can initialise its properties before init is called\n if (!this.deprecatedConstructor) {\n this.init();\n }\n }\n\n /**\n * Register a new component type with the layout manager.\n *\n * @deprecated See {@link https://stackoverflow.com/questions/40922531/how-to-check-if-a-javascript-function-is-a-constructor}\n * instead use {@link (GoldenLayout:class).registerComponentConstructor}\n * or {@link (GoldenLayout:class).registerComponentFactoryFunction}\n */\n registerComponent(name: string,\n componentConstructorOrFactoryFtn: GoldenLayout.ComponentConstructor | GoldenLayout.ComponentFactoryFunction,\n virtual = false\n ): void {\n if (typeof componentConstructorOrFactoryFtn !== 'function') {\n throw new ApiError('registerComponent() componentConstructorOrFactoryFtn parameter is not a function')\n } else {\n if (componentConstructorOrFactoryFtn.hasOwnProperty('prototype')) {\n const componentConstructor = componentConstructorOrFactoryFtn as GoldenLayout.ComponentConstructor;\n this.registerComponentConstructor(name, componentConstructor, virtual);\n } else {\n const componentFactoryFtn = componentConstructorOrFactoryFtn as GoldenLayout.ComponentFactoryFunction;\n this.registerComponentFactoryFunction(name, componentFactoryFtn, virtual);\n }\n }\n }\n\n /**\n * Register a new component type with the layout manager.\n */\n registerComponentConstructor(typeName: string, componentConstructor: GoldenLayout.ComponentConstructor, virtual = false): void {\n if (typeof componentConstructor !== 'function') {\n throw new Error(i18nStrings[I18nStringId.PleaseRegisterAConstructorFunction]);\n }\n\n const existingComponentType = this._componentTypesMap.get(typeName);\n\n if (existingComponentType !== undefined) {\n throw new BindError(`${i18nStrings[I18nStringId.ComponentIsAlreadyRegistered]}: ${typeName}`);\n }\n\n this._componentTypesMap.set(typeName, {\n constructor: componentConstructor,\n factoryFunction: undefined,\n virtual,\n }\n );\n }\n\n /**\n * Register a new component with the layout manager.\n */\n registerComponentFactoryFunction(typeName: string, componentFactoryFunction: GoldenLayout.ComponentFactoryFunction, virtual = false): void {\n if (typeof componentFactoryFunction !== 'function') {\n throw new BindError('Please register a constructor function');\n }\n\n const existingComponentType = this._componentTypesMap.get(typeName);\n\n if (existingComponentType !== undefined) {\n throw new BindError(`${i18nStrings[I18nStringId.ComponentIsAlreadyRegistered]}: ${typeName}`);\n }\n\n this._componentTypesMap.set(typeName, {\n constructor: undefined,\n factoryFunction: componentFactoryFunction,\n virtual,\n }\n );\n }\n\n /**\n * Register a component function with the layout manager. This function should\n * return a constructor for a component based on a config.\n * This function will be called if a component type with the required name is not already registered.\n * It is recommended that applications use the {@link (VirtualLayout:class).getComponentEvent} and\n * {@link (VirtualLayout:class).releaseComponentEvent} instead of registering a constructor callback\n * @deprecated use {@link (GoldenLayout:class).registerGetComponentConstructorCallback}\n */\n registerComponentFunction(callback: GoldenLayout.GetComponentConstructorCallback): void {\n this.registerGetComponentConstructorCallback(callback);\n }\n\n /**\n * Register a callback closure with the layout manager which supplies a Component Constructor.\n * This callback should return a constructor for a component based on a config.\n * This function will be called if a component type with the required name is not already registered.\n * It is recommended that applications use the {@link (VirtualLayout:class).getComponentEvent} and\n * {@link (VirtualLayout:class).releaseComponentEvent} instead of registering a constructor callback\n */\n registerGetComponentConstructorCallback(callback: GoldenLayout.GetComponentConstructorCallback): void {\n if (typeof callback !== 'function') {\n throw new Error('Please register a callback function');\n }\n\n if (this._getComponentConstructorFtn !== undefined) {\n console.warn('Multiple component functions are being registered. Only the final registered function will be used.')\n }\n\n this._getComponentConstructorFtn = callback;\n }\n\n getRegisteredComponentTypeNames(): string[] {\n const typeNamesIterableIterator = this._componentTypesMap.keys();\n return Array.from(typeNamesIterableIterator);\n }\n\n /**\n * Returns a previously registered component instantiator. Attempts to utilize registered\n * component type by first, then falls back to the component constructor callback function (if registered).\n * If neither gets an instantiator, then returns `undefined`.\n * Note that `undefined` will return if config.componentType is not a string\n *\n * @param config - The item config\n * @public\n */\n getComponentInstantiator(config: ResolvedComponentItemConfig): GoldenLayout.ComponentInstantiator | undefined {\n let instantiator: GoldenLayout.ComponentInstantiator | undefined;\n\n const typeName = ResolvedComponentItemConfig.resolveComponentTypeName(config)\n if (typeName !== undefined) {\n instantiator = this._componentTypesMap.get(typeName);\n }\n if (instantiator === undefined) {\n if (this._getComponentConstructorFtn !== undefined) {\n instantiator = {\n constructor: this._getComponentConstructorFtn(config),\n factoryFunction: undefined,\n virtual: false,\n }\n }\n }\n\n return instantiator;\n }\n\n /** @internal */\n override bindComponent(container: ComponentContainer, itemConfig: ResolvedComponentItemConfig): ComponentContainer.BindableComponent {\n let instantiator: GoldenLayout.ComponentInstantiator | undefined;\n\n const typeName = ResolvedComponentItemConfig.resolveComponentTypeName(itemConfig);\n if (typeName !== undefined) {\n instantiator = this._componentTypesMap.get(typeName);\n }\n if (instantiator === undefined) {\n if (this._getComponentConstructorFtn !== undefined) {\n instantiator = {\n constructor: this._getComponentConstructorFtn(itemConfig),\n factoryFunction: undefined,\n virtual: false,\n }\n }\n }\n\n let result: ComponentContainer.BindableComponent;\n if (instantiator !== undefined) {\n const virtual = instantiator.virtual;\n // handle case where component is obtained by name or component constructor callback\n let componentState: JsonValue | undefined;\n if (itemConfig.componentState === undefined) {\n componentState = undefined;\n } else {\n // make copy\n componentState = deepExtendValue({}, itemConfig.componentState) as JsonValue;\n }\n\n let component: ComponentContainer.Component | undefined;\n const componentConstructor = instantiator.constructor;\n if (componentConstructor !== undefined) {\n component = new componentConstructor(container, componentState, virtual);\n } else {\n const factoryFunction = instantiator.factoryFunction;\n if (factoryFunction !== undefined) {\n component = factoryFunction(container, componentState, virtual);\n } else {\n throw new AssertError('LMBCFFU10008');\n }\n }\n\n if (virtual) {\n if (component === undefined) {\n throw new UnexpectedUndefinedError('GLBCVCU988774');\n } else {\n const virtuableComponent = component as GoldenLayout.VirtuableComponent;\n const componentRootElement = virtuableComponent.rootHtmlElement;\n if (componentRootElement === undefined) {\n throw new BindError(`${i18nStrings[I18nStringId.VirtualComponentDoesNotHaveRootHtmlElement]}: ${typeName}`);\n } else {\n ensureElementPositionAbsolute(componentRootElement);\n this.container.appendChild(componentRootElement);\n this._virtuableComponentMap.set(container, virtuableComponent);\n container.virtualRectingRequiredEvent = this._containerVirtualRectingRequiredEventListener;\n container.virtualVisibilityChangeRequiredEvent = this._containerVirtualVisibilityChangeRequiredEventListener;\n container.virtualZIndexChangeRequiredEvent = this._containerVirtualZIndexChangeRequiredEventListener;\n }\n }\n }\n\n this._registeredComponentMap.set(container, component);\n\n result = {\n virtual: instantiator.virtual,\n component,\n };\n\n } else {\n // Use getComponentEvent\n result = super.bindComponent(container, itemConfig);\n }\n\n return result;\n }\n\n /** @internal */\n override unbindComponent(container: ComponentContainer, virtual: boolean, component: ComponentContainer.Component | undefined): void {\n const registeredComponent = this._registeredComponentMap.get(container);\n if (registeredComponent === undefined) {\n super.unbindComponent(container, virtual, component); // was not created from registration so use virtual unbind events\n } else {\n const virtuableComponent = this._virtuableComponentMap.get(container);\n if (virtuableComponent !== undefined) {\n const componentRootElement = virtuableComponent.rootHtmlElement;\n if (componentRootElement === undefined) {\n throw new AssertError('GLUC77743', container.title);\n } else {\n this.container.removeChild(componentRootElement);\n this._virtuableComponentMap.delete(container);\n }\n }\n }\n }\n\n override fireBeforeVirtualRectingEvent(count: number): void {\n this._goldenLayoutBoundingClientRect = this.container.getBoundingClientRect();\n super.fireBeforeVirtualRectingEvent(count);\n }\n\n\n /** @internal */\n private handleContainerVirtualRectingRequiredEvent(container: ComponentContainer, width: number, height: number): void {\n const virtuableComponent = this._virtuableComponentMap.get(container);\n if (virtuableComponent === undefined) {\n throw new UnexpectedUndefinedError('GLHCSCE55933');\n } else {\n const rootElement = virtuableComponent.rootHtmlElement;\n if (rootElement === undefined) {\n throw new BindError(i18nStrings[I18nStringId.ComponentIsNotVirtuable] + ' ' + container.title);\n } else {\n const containerBoundingClientRect = container.element.getBoundingClientRect();\n const left = containerBoundingClientRect.left - this._goldenLayoutBoundingClientRect.left;\n rootElement.style.left = numberToPixels(left);\n const top = containerBoundingClientRect.top - this._goldenLayoutBoundingClientRect.top;\n rootElement.style.top = numberToPixels(top);\n setElementWidth(rootElement, width);\n setElementHeight(rootElement, height);\n }\n }\n }\n\n /** @internal */\n private handleContainerVirtualVisibilityChangeRequiredEvent(container: ComponentContainer, visible: boolean): void {\n const virtuableComponent = this._virtuableComponentMap.get(container);\n if (virtuableComponent === undefined) {\n throw new UnexpectedUndefinedError('GLHCVVCRE55934');\n } else {\n const rootElement = virtuableComponent.rootHtmlElement;\n if (rootElement === undefined) {\n throw new BindError(i18nStrings[I18nStringId.ComponentIsNotVirtuable] + ' ' + container.title);\n } else {\n setElementDisplayVisibility(rootElement, visible);\n }\n }\n }\n\n /** @internal */\n private handleContainerVirtualZIndexChangeRequiredEvent(container: ComponentContainer, logicalZIndex: LogicalZIndex, defaultZIndex: string) {\n const virtuableComponent = this._virtuableComponentMap.get(container);\n if (virtuableComponent === undefined) {\n throw new UnexpectedUndefinedError('GLHCVZICRE55935');\n } else {\n const rootElement = virtuableComponent.rootHtmlElement;\n if (rootElement === undefined) {\n throw new BindError(i18nStrings[I18nStringId.ComponentIsNotVirtuable] + ' ' + container.title);\n } else {\n rootElement.style.zIndex = defaultZIndex;\n }\n }\n }\n}\n\n/** @public */\nexport namespace GoldenLayout {\n export interface VirtuableComponent {\n rootHtmlElement: HTMLElement;\n }\n\n export type ComponentConstructor = new(container: ComponentContainer, state: JsonValue | undefined, virtual: boolean) => ComponentContainer.Component;\n export type ComponentFactoryFunction = (container: ComponentContainer, state: JsonValue | undefined, virtual: boolean) => ComponentContainer.Component | undefined;\n export type GetComponentConstructorCallback = (this: void, config: ResolvedComponentItemConfig) => ComponentConstructor;\n\n export interface ComponentInstantiator {\n constructor: ComponentConstructor | undefined;\n factoryFunction: ComponentFactoryFunction | undefined;\n virtual: boolean;\n }\n}\n"],"names":["InternalError","Error","constructor","type","code","message","super","undefined","AssertError","UnreachableCaseError","variableValue","UnexpectedNullError","UnexpectedUndefinedError","ConfigMinifier","StyleConstants","WidthOrHeightPropertyName","Side","LogicalZIndex","keys","values","translateObject","from","minify","to","key","hasOwnProperty","translatedKey","minifyKey","unminifyKey","fromValue","translateValue","Array","isArray","length","i","translateArray","value","index","indexOfValue","toString","minifyValue","parseInt","substr","indexOfKey","checkInitialise","defaultComponentBaseZIndex","defaultComponentDragZIndex","defaultComponentStackMaximisedZIndex","width","height","top","left","right","bottom","base","drag","stackMaximised","LogicalZIndexToDefaultMap","JsonValue","ItemType","ResponsiveMode","SizeUnitEnum","ResolvedItemConfig","ResolvedHeaderedItemConfig","ResolvedStackItemConfig","ResolvedComponentItemConfig","ResolvedRowOrColumnItemConfig","ResolvedRootItemConfig","ResolvedGroundItemConfig","ResolvedLayoutConfig","ResolvedPopoutLayoutConfig","I18nStrings","numberToPixels","pixelsToNumber","numberStr","replace","parseFloat","isDigit","char","setElementWidth","element","widthAsPixels","style","setElementHeight","heightAsPixels","getElementWidthAndHeight","offsetWidth","offsetHeight","setElementDisplayVisibility","visible","display","deepExtend","target","obj","existingTarget","deepExtendValue","targetArray","valueObj","getUniqueId","Math","random","isJsonObject","isJson","ground","row","column","stack","component","none","always","onload","tryParse","Pixel","Percent","Fractional","Em","format","defaults","content","size","sizeUnit","minSize","minSizeUnit","id","isClosable","createCopy","original","createDefault","isComponentItem","itemConfig","isStackItem","isGroundItem","Header","defaultMaximised","show","popout","close","maximise","minimise","tabDropdown","copyContent","count","result","defaultActiveItemIndex","maximised","activeItemIndex","header","defaultReorderEnabled","resolveComponentTypeName","componentType","reorderEnabled","title","componentState","copyComponentType","isChildItemConfig","config","isRootItemConfig","create","rootItemConfig","Settings","Dimensions","isPopout","constrainDragToContainer","popoutWholeStack","blockedPopoutsThrowError","closePopoutsOnUnload","responsiveMode","tabOverlapAllowance","reorderOnTabMenuClick","tabControlOffset","popInOnClose","borderWidth","borderGrabWidth","defaultMinItemHeight","defaultMinItemHeightUnit","defaultMinItemWidth","defaultMinItemWidthUnit","headerHeight","dragProxyWidth","dragProxyHeight","dock","root","openPopouts","dimensions","settings","resolved","copyOpenPopouts","minifyConfig","layoutConfig","unminifyConfig","minifiedConfig","Window","parentId","indexInParent","window","ExternalError","ConfigurationError","node","PopoutBlockedError","ApiError","BindError","initialised","infosObject","PopoutCannotBeCreatedWithGroundItemConfig","default","PleaseRegisterAConstructorFunction","ComponentTypeNotRegisteredAndBindComponentEventHandlerNotAssigned","ComponentIsAlreadyRegistered","ComponentIsNotVirtuable","VirtualComponentDoesNotHaveRootHtmlElement","ItemConfigIsNotTypeComponent","InvalidNumberPartInSizeString","UnknownUnitInSizeString","UnsupportedUnitInSizeString","idCount","Object","infos","info","i18nStrings","ItemConfig","HeaderedItemConfig","StackItemConfig","ComponentItemConfig","RowOrColumnItemConfig","RootItemConfig","LayoutConfig","PopoutLayoutConfig","parseSize","sizeString","allowableSizeUnits","numericPart","digitsPart","firstNonNumericCharPart","firstNonDigitPart","trimStart","firstNonDigitPartIndex","gotDecimalPoint","substring","trim","splitStringAtFirstNonNumericChar","Number","isNaN","includes","formatSize","formatUndefinableSize","resolve","rowAndColumnChildLegacySizeDefault","JSON","stringify","resolveContent","resolveId","resolveSize","resolveMinSize","minWidth","minHeight","minWidthDefined","calculateSizeWidthHeightSpecificationType","isGround","isRow","isColumn","isStack","isComponent","hasHeaders","resolveIdAndMaximised","legacyId","legacyMaximised","idx","findIndex","splice","childItemConfig","fromResolvedContent","resolvedContent","resolvedContentConfig","fromResolved","resolvedConfig","componentName","componentTypeToTitle","contentConfig","childItemConfigs","legacySizeDefault","widthOrHeightSpecifiedAtLeastOnce","sizeSpecifiedAtLeastOnce","sizeWidthHeightSpecificationType","resolvedChildItemConfig","fromResolvedOrUndefined","resolvedItemConfig","resolveDefaultMinItemHeight","resolveDefaultMinItemWidth","resolvedDimensions","labels","showPopoutIcon","popin","showMaximiseIcon","showCloseIcon","resolveOpenPopouts","fromResolvedArray","isResolved","configOrResolvedConfig","popoutConfigs","resolvedArray","resolvedOpenPopoutCount","resolvedOpenPopout","resolvedWindow","popoutConfig","EventEmitter","_allEventSubscriptions","_subscriptionsMap","Map","unbind","this","removeEventListener","trigger","emit","tryBubbleEvent","name","args","eventName","subcriptions","get","slice","subscription","emitAllEvent","emitUnknown","subs","emitBaseBubblingEvent","event","BubblingEvent","emitUnknownBubblingEvent","callback","unknownCallback","removeUnknownEventListener","off","addEventListener","addUnknownEventListener","on","ALL_EVENT","push","subscriptions","set","removeSubscription","indexOf","allEventSubscriptionsCount","unknownArgs","unshift","allEventSubcriptions","headerClickEventName","headerTouchStartEventName","_name","_target","_isPropagationStopped","origin","isPropagationStopped","stopPropagation","ClickBubblingEvent","_mouseEvent","mouseEvent","TouchStartBubblingEvent","_touchEvent","touchEvent","BrowserPopout","_config","_initialWindowSize","_layoutManager","_isInitialised","_popoutWindow","createWindow","toConfig","glInstanceConfig","getGlInstance","saveLayout","screenX","screenLeft","screenY","screenTop","__glInstance","getWindow","closeWindow","e","popIn","parentItem","copiedRoot","groundItem","getItemsByPopInParentId","contentItems","newContentItem","createAndInitContentItem","addChild","_onClose","url","createUrl","floor","features","serializeWindowFeatures","innerWidth","innerHeight","menubar","toolbar","location","personalbar","resizable","scrollbars","status","globalThis","open","positionWindow","passive","_checkReadyInterval","setInterval","checkReady","isInitialised","onInitialised","clearInterval","windowOptions","windowOptionsString","join","storageKey","localStorage","setItem","getErrorMessage","URL","href","searchParams","moveTo","focus","setTimeout","HeaderButton","_header","label","cssClass","_pushEvent","_clickEventListener","ev","onClick","_touchStartEventListener","onTouchStart","_element","document","createElement","classList","add","destroy","controlsContainerElement","appendChild","parentNode","removeChild","DragListener","_eElement","extraAllowableChildTargets","_pointerTracking","_pointerDownEventListener","onPointerDown","_pointerMoveEventListener","onPointerMove","_pointerUpEventListener","onPointerUp","_timeout","_allowableTargets","_oDocument","_eBody","body","_nDelay","_nDistance","_nX","_nY","_nOriginalX","_nOriginalY","_dragging","checkRemovePointerTrackingEventListeners","cancelDrag","processDragStop","oEvent","isPrimary","coordinates","getPointerCoordinates","processPointerDown","x","y","startDrag","err","console","error","processDragMove","preventDefault","dragEvent","pageX","pageY","abs","clearTimeout","remove","querySelector","setProperty","Tab","_componentItem","_closeEvent","_focusEvent","_dragStartEvent","_isActive","_tabClickListener","onTabClickDown","_tabTouchStartListener","onTabTouchStart","_closeClickListener","onCloseClick","_closeTouchStartListener","onCloseTouchStart","_dragStartListener","onDragStart","_contentItemDestroyListener","onContentItemDestroy","_tabTitleChangedListener","setTitle","_titleElement","_closeElement","enableReorder","setTab","isActive","componentItem","contentItem","titleElement","closeElement","_dragListener","disableReorder","innerText","setActive","setBlurred","setFocused","button","notifyFocus","notifyClose","TabsContainer","_componentRemoveEvent","_componentFocusEvent","_componentDragStartEvent","_dropdownActiveChangedEvent","_tabs","_lastVisibleTabIndex","_dropdownActive","_dropdownElement","tabs","tabCount","lastVisibleTabIndex","dropdownElement","dropdownActive","createTab","tab","item","handleTabCloseEvent","handleTabFocusEvent","dragListener","handleTabDragStartEvent","childNodes","insertBefore","removeTab","processActiveComponentChanged","newActiveComponentItem","activeIndex","activeTab","j","updateTabSizes","availableWidth","activeComponentItem","dropDownActive","tryUpdateTabSizes","cumulativeTabWidth","tabOverlapAllowanceExceeded","tabElement","parentElement","tabMarginRight","getComputedStyle","marginRight","visibleTabWidth","activeTabMarginRight","zIndex","marginLeft","overlap","showAdditionalTabsDropdown","hideAdditionalTabsDropdown","_parent","_configClosable","_getActiveComponentItemEvent","closeEvent","_popoutEvent","_maximiseToggleEvent","_clickEvent","_touchStartEvent","_clickListener","_touchStartListener","_rowColumnClosable","_closeButton","_popoutButton","_tabsContainer","handleTabInitiatedComponentRemoveEvent","handleTabInitiatedComponentFocusEvent","handleTabInitiatedDragStartEvent","processTabDropdownActiveChanged","_show","_popoutEnabled","popoutEnabled","_popoutLabel","popoutLabel","_maximiseEnabled","maximiseEnabled","_maximiseLabel","maximiseLabel","_minimiseEnabled","minimiseEnabled","_minimiseLabel","minimiseLabel","_closeEnabled","closeEnabled","_closeLabel","closeLabel","_tabDropdownEnabled","tabDropdownEnabled","_tabDropdownLabel","tabDropdownLabel","setSide","side","_canRemoveComponent","_controlsContainerElement","_documentMouseUpListener","_tabControlOffset","_tabDropdownButton","handleButtonPopoutEvent","_maximiseButton","handleButtonMaximiseToggleEvent","_side","leftRightSided","_leftRightSided","layoutManager","parent","tabsContainerElement","setRowColumnClosable","updateClosability","len","applyFocusedValue","processMaximised","setAttribute","processMinimised","notifyClick","notifyTouchStart","ComponentContainer","_updateItemConfigEvent","_showEvent","_hideEvent","_blurEvent","_stackMaximised","_width","_height","_visible","_isShownWithZeroDimensions","_componentType","_isClosable","_initialState","_state","_boundComponent","bindComponent","updateElementPositionPropertyFromBoundComponent","virtual","_tab","isHidden","state","initialState","releaseComponent","stateRequestEvent","getElement","hide","suppressEvent","blur","setSize","ancestorItem","ancestorChildItem","direction","currentSize","percentage","delta","ancestorItemContentItem","updateSize","replaceComponent","virtualVisibilityChangeRequiredEvent","virtualRectingRequiredEvent","fireBeforeVirtualRectingEvent","fireAfterVirtualRectingEvent","setBaseLogicalZIndex","getState","extendState","extendedState","setState","setVisibility","setSizeToNodeSize","emitShow","emitHide","setLogicalZIndex","logicalZIndex","_logicalZIndex","notifyVirtualZIndexChangeRequired","enterDragMode","exitDragMode","enterStackMaximised","exitStackMaximised","force","addVirtualSizedContainerToLayoutManager","checkShownFromZeroDimensions","notifyVirtualRectingRequired","virtualZIndexChangeRequiredEvent","defaultZIndex","position","beginVirtualSizedContainerAdding","addVirtualSizedContainer","endVirtualSizedContainerAdding","unbindComponent","ContentItem","_popInParentIds","_type","_id","_pendingEventPropagations","_throttledEvents","_contentItems","createContentItems","popInParentIds","isComponentParentableItem","keepChild","suspendResize","setParent","init","replaceChild","oldChild","newChild","destroyOldChild","browserPopout","createPopoutFromContentItem","calculateConfigContent","highlightDropZone","area","dropTargetIndicator","highlightArea","onDrop","beginSizeInvalidation","endSizeInvalidation","getElementArea","rect","getBoundingClientRect","scrollTop","scrollLeft","x1","y1","x2","y2","surface","addPopInParentId","initContentItems","updateContentItemsSize","createContentItem","propagateEvent","scheduleEventPropagationToLayoutManager","requestAnimationFrame","propagateEventToLayoutManager","ComponentItem","_parentItem","_focused","_reorderEnabled","applyUpdatableConfig","_initialWantMaximise","containerElement","_container","handleUpdateItemConfigEvent","initialWantMaximise","container","headerConfig","_headerConfig","_title","focused","updateNodeSize","setActiveComponentItem","setFocusedComponentItem","ComponentParentableItem","setFocusedValue","Stack","_headerSideChanged","_resizeListener","handleResize","_maximisedListener","handleMaximised","_minimisedListener","handleMinimised","layoutHeaderConfig","configContent","componentHeaderConfig","_initialActiveItemIndex","_maximisedEnabled","headerSettings","getActiveComponentItem","handlePopoutEvent","toggleMaximise","handleHeaderClickEvent","handleHeaderTouchStartEvent","handleHeaderComponentRemoveEvent","handleHeaderComponentFocusEvent","handleHeaderComponentStartDragEvent","_childElementContainer","setupHeaderPosition","childElementContainer","headerShow","headerSide","headerLeftRightSided","contentAreaDimensions","_contentAreaDimensions","isMaximised","maximisedStack","stackParent","contentItemCount","setActiveContentItem","suppressFocusEvent","_activeComponentItem","emitStateChangedEvent","getActiveContentItem","focusActiveContentItem","newComponent","newItem","addComponent","addItem","checkMinimiseMaximisedStack","stackWillBeDeleted","newActiveComponentIdx","setMaximisedStack","createHeaderConfig","_dropSegment","resetHeaderDropZone","_dropIndex","isVertical","isHorizontal","hasCorrectParent","rowOrColumn","segment","hoverArea","highlightHeaderDropZone","highlightBodyDropZone","getArea","headerArea","contentArea","contentWidth","contentHeight","positionHeader","visibleTabsLength","tabsContainerElementChildNodes","visibleTabElements","tabIndex","visibleTabElement","tabDropPlaceholder","headerRect","headerTop","headerLeft","tabTop","tabLeft","tabWidth","isAboveTab","tabRect","tabRectTop","tabRectLeft","insertAdjacentElement","min","tabDropPlaceholderRect","tabDropPlaceholderRectTop","tabDropPlaceholderRectLeft","tabDropPlaceholderRectWidth","placeHolderTop","clientHeight","bubblingEvent","startComponentDrag","DragProxy","_originalParent","_area","_lastValidArea","offsetX","offsetY","onDrag","createDragProxyElements","_componentItemFocused","setDimensions","determineMinMaxXY","calculateItemAreas","setDropPosition","initialX","initialY","headerElement","tabsElement","_proxyContainerElement","_sided","insertAdjacentText","_minX","_minY","_maxX","_maxY","ceil","droppedComponentItem","Splitter","_isVertical","_size","grabSize","_grabSize","dragHandleElement","handleExcessSize","handleExcessPos","RowOrColumn","_rowOrColumnParent","_splitter","_splitterSize","_splitterGrabSize","_isColumn","_dimension","_splitterPosition","_splitterMinPosition","_splitterMaxPosition","_configType","createdItem","splitterElement","createSplitter","max","newItemSize","indexedContentItem","itemSize","splitterIndex","childItem","calculateRelativeSizes","setAbsoluteSizes","absoluteSizes","calculateAbsoluteSizes","additionalPixel","itemSizes","crossAxisSize","totalSplitterSize","elementWidth","elementHeight","totalSize","totalAssigned","total","itemsWithFractionalSize","totalFractionalSize","round","fractionalAllocatedSize","respectMinItemSize","minItemSize","calculateContentItemMinSize","totalOverMin","totalUnderMin","entriesOverMin","allEntries","entry","reducePercent","remainingSize","reducedSize","splitter","onSplitterDrag","onSplitterDragStop","onSplitterDragStart","getSplitItems","before","after","calculateContentItemsTotalMinSize","totalMinSize","items","beforeWidth","afterSize","beforeMinSize","afterMinSize","offset","offsetPixels","sizeBefore","sizeAfter","splitterPositionInRange","totalRelativeSize","getElementDimensionSize","dimension","getElementWidth","getElementHeight","setElementDimensionSize","GroundItem","_containerElement","prev","previousSibling","lastChild","Element","contains","loadRoot","clearRoot","rootContentItem","loadComponentAsRoot","createSideAreas","oppositeSides","Area","sibling","validateDocking","getAllContentItems","deepGetAllContentItems","getConfigMaximisedItems","deepFilterContentItems","popInParentId","checkAcceptFtn","DragSource","_extraAllowableChildTargets","_componentTypeOrFtn","_componentState","_dummyGroundContainer","dummyRootItemConfig","_dummyGroundContentItem","createDragListener","removeDragListener","onDragStop","dragSourceItemConfig","ftnDragSourceItemConfig","isDragSourceComponentItemConfig","dragProxy","transitionIndicator","transitionElements","DropTargetIndicator","innerElement","margin","TransitionIndicator","_toElement","_fromDimensions","_totalAnimationDuration","_animationStartTime","fromElement","toElement","nextAnimationFrame","measure","EventHub","_childEventListener","childEvent","onEventFromChild","ChildEventName","emitUserBroadcast","handleUserBroadcastEvent","isSubWindow","propagateToParent","propagateToThisAndSubtree","detail","eventInit","bubbles","cancelable","CustomEvent","opener","dispatchEvent","childGl","eventHub","LayoutManager","parameters","resizeWithContainerAutomatically","resizeDebounceInterval","resizeDebounceExtendedWhenPossible","_groundItem","_openPopouts","_dropTargetIndicator","_transitionIndicator","_itemAreas","_maximisePlaceholder","createMaximisePlaceElement","_tabDropPlaceholder","createTabDropPlaceholderElement","_dragSources","_updatingColumnsResponsive","_firstLoad","_eventHub","_virtualSizedContainers","_virtualSizedContainerAddingBeginCount","_sizeInvalidationBeginCount","_resizeObserver","ResizeObserver","handleContainerResize","_windowBeforeUnloadListener","onBeforeUnload","_windowBeforeUnloadListening","_maximisedStackBeforeDestroyedListener","cleanupBeforeMaximisedStackDestroyed","_constructorOrSubWindowLayoutConfig","constructorOrSubWindowLayoutConfig","rootItem","focusedComponentItem","_focusedComponentItem","_maximisedStack","deprecatedConstructor","closeAllOpenPopouts","disconnect","checkClearResizeTimeout","dragSource","subWindowRootConfig","setContainer","updateSizeFromContainer","resolvedLayoutConfig","checkLoadedLayoutMaximiseItem","observe","adjustColumnsResponsive","loadLayout","createSubWindows","groundContent","reconcilePopoutWindows","clear","newComponentAtLocation","locationSelectors","addComponentAtLocation","addItemAtLocation","newItemAtLocation","defaultLocationSelectors","findFirstLocation","addIdx","updateRootSize","createContentItemFromConfig","findFirstComponentItemById","findFirstContentItemTypeByIdRecursive","createPopout","itemConfigOrContentItem","positionAndSize","createPopoutFromItemConfig","child","windowLeft","windowTop","offsetLeft","offsetTop","beforeVirtualRectingEvent","afterVirtualRectingEvent","popoutLayoutConfig","createPopoutFromPopoutLayoutConfig","configWindow","initialWindow","newDragSource","componentTypeOrItemConfigCallback","removeDragSource","array","removeFromArray","focusComponent","clearComponentFocus","suppressEvents","newFocusedParentItem","oldFocusedItem","oldFocusedParentItem","processMinimiseMaximisedStack","processMaximiseStack","matchingArea","smallestSurface","Infinity","allContentItems","stackContentAreaDimensions","groundArea","configMaximisedItems","prepend","closed","processResizeWithDebounce","_resizeTimeoutId","bodyElement","documentElement","padding","overflow","useResponsiveLayout","columnCount","minItemWidth","stackColumnCount","allStacks","getAllStacks","firstStackContainer","addChildContentItemsToContainer","alwaysResponsiveMode","onLoadResponsiveModeAndFirst","stacks","findAllStacksRecursive","findFirstContentItemType","findFirstContentItemTypeRecursive","foundContentItem","selectors","selector","findLocation","selectorIndex","typeId","parentContentItems","parentContentItemCount","tryCreateLocationFromParentItem","groundContentItems","afterFocusedItemIfPossibleLocationSelectors","VirtualLayout","configOrOptionalContainer","containerOrBindComponentEventHandler","unbindComponentEventHandler","skipInit","createLayoutManagerConstructorParameters","_bindComponentEventHanlderPassedInConstructor","_creationTimeoutPassed","bindComponentEvent","unbindComponentEvent","readyState","clearHtmlAndAdjustStylesForSubWindow","headElement","head","appendNodeLists","querySelectorAll","listIdx","appendNodeList","nodeIdx","innerHTML","visibility","checkAddDefaultPopinButton","popInButtonElement","iconElement","bgElement","getComponentEvent","releaseComponentEvent","subWindowChecked","windowConfigKey","windowConfigStr","getItem","removeItem","minifiedWindowConfig","parse","HTMLElement","isMobileDevice","golden","_componentTypesMap","_registeredComponentMap","_virtuableComponentMap","_containerVirtualRectingRequiredEventListener","handleContainerVirtualRectingRequiredEvent","_containerVirtualVisibilityChangeRequiredEventListener","handleContainerVirtualVisibilityChangeRequiredEvent","_containerVirtualZIndexChangeRequiredEventListener","handleContainerVirtualZIndexChangeRequiredEvent","registerComponent","componentConstructorOrFactoryFtn","componentConstructor","registerComponentConstructor","componentFactoryFtn","registerComponentFactoryFunction","typeName","factoryFunction","componentFactoryFunction","registerComponentFunction","registerGetComponentConstructorCallback","_getComponentConstructorFtn","warn","getRegisteredComponentTypeNames","typeNamesIterableIterator","getComponentInstantiator","instantiator","virtuableComponent","componentRootElement","rootHtmlElement","absolutePosition","ensureElementPositionAbsolute","delete","_goldenLayoutBoundingClientRect","rootElement","containerBoundingClientRect","template","concat","minItemHeight"],"sourceRoot":""} \ No newline at end of file