@openfin/core-web 0.40.17 → 0.40.20
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
|
|
1
|
-
"use strict";var t=require("./main-d6fac73a.js"),e=require("uuid");require("buffer/"),require("events"),require("lodash/cloneDeep"),require("lodash/isEqual");var i={},n={};Object.defineProperty(n,"__esModule",{value:!0}),n.mapValuesAsync=n.mapEntriesAsync=void 0;const o=(t,[e,i])=>({...t,[e]:i});async function s(t,e){return(await Promise.all(e.map((async([e,i])=>[e,await t(i,e)])))).reduce(o,{})}n.mapEntriesAsync=s,n.mapValuesAsync=async function(t,e){let i;return i=e instanceof Map?[...e.entries()]:Object.entries(e),s(t,i)};var r,a,l,h,d=t.commonjsGlobal&&t.commonjsGlobal.__classPrivateFieldSet||function(t,e,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(t,i):o?o.value=i:e.set(t,i),i},c=t.commonjsGlobal&&t.commonjsGlobal.__classPrivateFieldGet||function(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)};Object.defineProperty(i,"__esModule",{value:!0});var m=i.DefaultLayoutManager=void 0;const u=n;class p{constructor(t){a.set(this,void 0),l.set(this,new Map),d(this,a,t,"f")}size(){return c(this,l,"f").size}async applyLayoutSnapshot({layouts:t}){if(Object.keys(t).length>1)throw new Error("[LayoutManager] Tried to call applyLayoutSnapshot with more than 1 layout. When implementing multiple layouts via overridden LayoutManager class, you must override and fully implement the applyLayoutSnapshot method without calling super.applyLayoutSnapshot().");const[[e,i]]=Object.entries(t);await p.createLayout(this,{layoutName:e,layout:i})}async showLayout({layoutName:t}){}async getLayoutSnapshot(){return{layouts:await(0,u.mapValuesAsync)((t=>t.getFrameSnapshot()),c(this,l,"f"))}}async removeLayout({layoutName:t}){}getLayoutIdentityForView(t){const e=[...c(this,l,"f").values()].find((e=>e.getCurrentViews().some((e=>e.name===t.name&&e.uuid===t.uuid))));return e?.identity??void 0}isLayoutVisible({layoutName:t}){return c(p,r,"m",h).call(p,this,t).isVisible()}resolveLayoutIdentity(t){if(t&&"layoutName"in t)return t;const e=[...c(this,l,"f").values()];if(1===e.length)return e[0].identity;const i=e.find((t=>t.isVisible()));return i?.identity??void 0}static async resolveLayout(t,e){const i=t.resolveLayoutIdentity(e);if(void 0===i||!("layoutName"in i))throw new Error("[layout-manager] resolveLayout: Could not resolve the layout identity. Make sure you include 'layoutName' in the identity object.");return c(p,r,"m",h).call(p,t,i.layoutName)}static async handleSharedView(t,e,i){await(0,u.mapValuesAsync)((async t=>{if(t.identity.layoutName!==e.layoutName){const e=t.getCurrentViews().find((t=>t.name===i.name));e&&await t.onViewDetached({viewIdentity:e,target:null}).catch(console.error)}}),c(t,l,"f"))}static async handleLastViewRemoved(t,e){await t.removeLayout(e),await c(t,a,"f").handleLastViewRemoved(t)}static async destroyLayout(t,{layoutName:e}){await c(p,r,"m",h).call(p,t,e).destroy(),c(t,l,"f").delete(e)}static async createLayout(t,e){const{layoutName:i}=e;if(c(t,l,"f").has(i))throw new Error(`Layout name ${i} already exists`);await c(t,a,"f").createLayout(e,t)}static registerLayout(t,e,i){c(t,l,"f").set(e,i)}static getAllLayouts(t){return[...c(t,l,"f").values()]}static setInitialSnapshot(t,e){c(t,a,"f").setInitialSnapshot(e)}static createClosedConstructor(...t){return class extends p{constructor(){super(...t)}}}}m=i.DefaultLayoutManager=p,r=p,a=new WeakMap,l=new WeakMap,h=function(t,e){const i=c(t,l,"f").get(e);if(!i)throw new Error(`[layout-manager] getLayoutByName: Could not locate layout with name '${e}'`);return i};var g={};Object.defineProperty(g,"__esModule",{value:!0});var f=g.BaseLayout=void 0;f=g.BaseLayout=class{};var _={};Object.defineProperty(_,"__esModule",{value:!0});var v=_.DOMEmitter=void 0;v=_.DOMEmitter=class{constructor(t){this.container=t}dispatchLocalEvent(t,e){const i={...e,type:t,tabSelector:`tab-${e.name}`,containerSelector:`container-${e.name}`,topic:"openfin-DOM-event"};this.container.dispatchEvent(new CustomEvent(t,{detail:i}))}};var C={};Object.defineProperty(C,"__esModule",{value:!0});var y=C.isVisible=void 0;y=C.isVisible=t=>(0!==t.offsetWidth||0!==t.offsetHeight)&&"hidden"!==window.getComputedStyle(t).visibility&&t.offsetTop>=0&&t.offsetLeft>=0&&t.offsetTop<=window.innerHeight&&t.offsetLeft<=window.innerWidth;class w extends Error{constructor(t,e){super(e),this.type=t}}class b extends w{constructor(t,e){super("Configuration",t),this.node=e}}class I extends w{constructor(t){super("PopoutBlocked",t)}}class S extends w{constructor(t){super("API",t)}}class E extends w{constructor(t){super("Bind",t)}}class x extends Error{constructor(t,e,i){super(`${t}: ${e}${void 0===i?"":": "+i}`)}}class z extends x{constructor(t,e){super("Assert",t,e)}}class L extends x{constructor(t,e,i){super("UnreachableCase",t,`${e}${void 0===i?"":": "+i}`)}}class M extends x{constructor(t,e){super("UnexpectedNull",t,e)}}class P extends x{constructor(t,e){super("UnexpectedUndefined",t,e)}}var T;!function(t){let e=!1;const i={PopoutCannotBeCreatedWithGroundItemConfig:{id:0,default:"Popout cannot be created with ground ItemConfig"},PleaseRegisterAConstructorFunction:{id:1,default:"Please register a constructor function"},ComponentTypeNotRegisteredAndBindComponentEventHandlerNotAssigned:{id:2,default:"Component type not registered and BindComponentEvent handler not assigned"},ComponentIsAlreadyRegistered:{id:3,default:"Component is already registered"},ComponentIsNotVirtuable:{id:4,default:"Component is not virtuable. Requires rootHtmlElement field/getter"},VirtualComponentDoesNotHaveRootHtmlElement:{id:5,default:'Virtual component does not have getter "rootHtmlElement"'},ItemConfigIsNotTypeComponent:{id:6,default:"ItemConfig is not of type component"},InvalidNumberPartInSizeString:{id:7,default:"Invalid number part in size string"},UnknownUnitInSizeString:{id:8,default:"Unknown unit in size string"},UnsupportedUnitInSizeString:{id:9,default:"Unsupported unit in size string"}};t.idCount=Object.keys(i).length;const n=Object.values(i);t.checkInitialise=function(){if(!e)for(let e=0;e<t.idCount;e++){const t=n[e];if(t.id!==e)throw new z("INSI00110",`${e}: ${t.id}`);A[e]=t.default}e=!0}}(T||(T={}));const A=new Array(T.idCount);var D,k,R,U;!function(t){t.defaultComponentBaseZIndex="auto",t.defaultComponentDragZIndex="32",t.defaultComponentStackMaximisedZIndex="41"}(D||(D={})),function(t){t.width="width",t.height="height"}(k||(k={})),function(t){t.top="top",t.left="left",t.right="right",t.bottom="bottom"}(R||(R={})),function(t){t.base="base",t.drag="drag",t.stackMaximised="stackMaximised"}(U||(U={}));const H={base:D.defaultComponentBaseZIndex,drag:D.defaultComponentDragZIndex,stackMaximised:D.defaultComponentStackMaximisedZIndex};var W,B,O,F,V,N,G,Z,$,j,q,X,Y,J,K,Q,tt,et,it,nt,ot,st;function rt(t){return t.toString(10)+"px"}function at(t){const e=t.replace("px","");return parseFloat(e)}function lt(t){return t>="0"&&t<="9"}function ht(t,e){const i=rt(e);t.style.width=i}function dt(t,e){const i=rt(e);t.style.height=i}function ct(t){return{width:t.offsetWidth,height:t.offsetHeight}}function mt(t,e){t.style.display=e?"":"none"}function ut(t,e){if(void 0!==e)for(const i in e)if(e.hasOwnProperty(i)){const n=e[i],o=t[i];t[i]=pt(o,n)}return t}function pt(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<t;n++){const t=e[n];i[n]=pt({},t)}return i}if(null===e)return null;{const i=e;if(void 0===t)return ut({},i);if("object"!=typeof t)return ut({},i);if(Array.isArray(t))return ut({},i);if(null===t)return ut({},i);return ut(t,i)}}function gt(){return(1e15*Math.random()).toString(36).replace(".","")}function ft(t,e){const{numericPart:i,firstNonNumericCharPart:n}=function(t){const e=(t=t.trimStart()).length;if(0===e)return{numericPart:"",firstNonNumericCharPart:""};{let i=e,n=!1;for(let o=0;o<e;o++){const e=t[o];if(!lt(e)){if("."!==e){i=o;break}if(n){i=o;break}n=!0}}return{numericPart:t.substring(0,i),firstNonNumericCharPart:t.substring(i).trim()}}}(t),o=Number.parseInt(i,10);if(isNaN(o))throw new b(`${A[7]}: ${t}`);{const i=F.tryParse(n);if(void 0===i)throw new b(`${A[8]}: ${t}`);if(e.includes(i))return{size:o,sizeUnit:i};throw new b(`${A[9]}: ${t}`)}}function _t(t,e){return t.toString(10)+F.format(e)}function vt(t,e){return void 0===t?void 0:t.toString(10)+F.format(e)}!function(t){function e(t){return!Array.isArray(t)&&null!==t&&"object"==typeof t}t.isJson=function(t){return e(t)},t.isJsonObject=e}(W||(W={})),function(t){t.ground="ground",t.row="row",t.column="column",t.stack="stack",t.component="component"}(B||(B={})),function(t){t.none="none",t.always="always",t.onload="onload"}(O||(O={})),function(t){t.Pixel="px",t.Percent="%",t.Fractional="fr",t.Em="em"}(F||(F={})),function(t){t.tryParse=function(e){switch(e){case t.Pixel:return t.Pixel;case t.Percent:return t.Percent;case t.Fractional:return t.Fractional;case t.Em:return t.Em;default:return}},t.format=function(e){switch(e){case t.Pixel:return t.Pixel;case t.Percent:return t.Percent;case t.Fractional:return t.Fractional;case t.Em:return t.Em;default:throw new L("SUEF44998",e)}}}(F||(F={})),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;s<i;s++){const i=t[s];n[s]=o(i,e)}return n}(t,e):n(t,e):e?function(t){if("string"==typeof t&&1===t.length)return"___"+t;const e=function(t){for(let e=0;e<i.length;e++)if(i[e]===t)return e;return-1}(t);return-1===e?t:e.toString(36)}(t):function(t){if("string"==typeof t&&1===t.length)return i[parseInt(t,36)];if("string"==typeof t&&"___"===t.substr(0,3))return t[3];return t}(t)}function s(t){if("string"==typeof t&&1===t.length)return"___"+t;const i=function(t){for(let i=0;i<e.length;i++)if(e[i]===t)return i;return-1}(t);return-1===i?t:i.toString(36)}function r(t){return 1===t.length?e[parseInt(t,36)]:"___"===t.substr(0,3)?t[3]:t}t.checkInitialise=function(){if(e.length>36)throw new Error("Too many keys in config minifier map")},t.translateObject=n}(V||(V={})),function(t){t.defaults={type:B.ground,content:[],size:1,sizeUnit:F.Fractional,minSize:void 0,minSizeUnit:F.Pixel,id:"",isClosable:!0},t.createCopy=function(t,e){switch(t.type){case B.ground:case B.row:case B.column:return j.createCopy(t,e);case B.stack:return Z.createCopy(t,e);case B.component:return $.createCopy(t);default:throw new L("CICC91354",t.type,"Invalid Config Item type specified")}},t.createDefault=function(t){switch(t){case B.ground:throw new z("CICCDR91562");case B.row:case B.column:return j.createDefault(t);case B.stack:return Z.createDefault();case B.component:return $.createDefault();default:throw new L("CICCDD91563",t,"Invalid Config Item type specified")}},t.isComponentItem=function(t){return t.type===B.component},t.isStackItem=function(t){return t.type===B.stack},t.isGroundItem=function(t){return t.type===B.ground}}(N||(N={})),function(t){t.defaultMaximised=!1,function(t){t.createCopy=function(t,e){return void 0===t?void 0:{show:null!=e?e:t.show,popout:t.popout,close:t.close,maximise:t.maximise,minimise:t.minimise,tabDropdown:t.tabDropdown}}}(t.Header||(t.Header={}))}(G||(G={})),function(t){function e(t){const e=t.length,i=new Array(e);for(let n=0;n<e;n++)i[n]=N.createCopy(t[n]);return i}t.defaultActiveItemIndex=0,t.createCopy=function(t,i){return{type:t.type,content:e(void 0!==i?i:t.content),size:t.size,sizeUnit:t.sizeUnit,minSize:t.minSize,minSizeUnit:t.minSizeUnit,id:t.id,maximised:t.maximised,isClosable:t.isClosable,activeItemIndex:t.activeItemIndex,header:G.Header.createCopy(t.header)}},t.copyContent=e,t.createDefault=function(){return{type:B.stack,content:[],size:N.defaults.size,sizeUnit:N.defaults.sizeUnit,minSize:N.defaults.minSize,minSizeUnit:N.defaults.minSizeUnit,id:N.defaults.id,maximised:G.defaultMaximised,isClosable:N.defaults.isClosable,activeItemIndex:t.defaultActiveItemIndex,header:void 0}}}(Z||(Z={})),function(t){t.defaultReorderEnabled=!0,t.resolveComponentTypeName=function(t){const e=t.componentType;return"string"==typeof e?e:void 0},t.createCopy=function(t){return{type:t.type,content:[],size:t.size,sizeUnit:t.sizeUnit,minSize:t.minSize,minSizeUnit:t.minSizeUnit,id:t.id,maximised:t.maximised,isClosable:t.isClosable,reorderEnabled:t.reorderEnabled,title:t.title,header:G.Header.createCopy(t.header),componentType:t.componentType,componentState:pt(void 0,t.componentState)}},t.createDefault=function(e="",i,n=""){return{type:B.component,content:[],size:N.defaults.size,sizeUnit:N.defaults.sizeUnit,minSize:N.defaults.minSize,minSizeUnit:N.defaults.minSizeUnit,id:N.defaults.id,maximised:G.defaultMaximised,isClosable:N.defaults.isClosable,reorderEnabled:t.defaultReorderEnabled,title:n,header:void 0,componentType:e,componentState:i}},t.copyComponentType=function(t){return pt({},t)}}($||($={})),function(t){function e(t){const e=t.length,i=new Array(e);for(let n=0;n<e;n++)i[n]=N.createCopy(t[n]);return i}t.isChildItemConfig=function(t){switch(t.type){case B.row:case B.column:case B.stack:case B.component:return!0;case B.ground:return!1;default:throw new L("CROCOSPCICIC13687",t.type)}},t.createCopy=function(t,i){return{type:t.type,content:e(void 0!==i?i:t.content),size:t.size,sizeUnit:t.sizeUnit,minSize:t.minSize,minSizeUnit:t.minSizeUnit,id:t.id,isClosable:t.isClosable}},t.copyContent=e,t.createDefault=function(t){return{type:t,content:[],size:N.defaults.size,sizeUnit:N.defaults.sizeUnit,minSize:N.defaults.minSize,minSizeUnit:N.defaults.minSizeUnit,id:N.defaults.id,isClosable:N.defaults.isClosable}}}(j||(j={})),function(t){t.createCopy=function(t){return N.createCopy(t)},t.isRootItemConfig=function(t){switch(t.type){case B.row:case B.column:case B.stack:case B.component:return!0;case B.ground:return!1;default:throw new L("CROCOSPCICIC13687",t.type)}}}(q||(q={})),function(t){t.create=function(t){const e=void 0===t?[]:[t];return{type:B.ground,content:e,size:100,sizeUnit:F.Percent,minSize:0,minSizeUnit:F.Pixel,id:"",isClosable:!1,title:"",reorderEnabled:!1}}}(X||(X={})),function(t){var e,i;function n(t){return"parentId"in t}(e=t.Settings||(t.Settings={})).defaults={constrainDragToContainer:!0,reorderEnabled:!0,popoutWholeStack:!1,blockedPopoutsThrowError:!0,closePopoutsOnUnload:!0,responsiveMode:O.none,tabOverlapAllowance:0,reorderOnTabMenuClick:!0,tabControlOffset:10,popInOnClose:!1},e.createCopy=function(t){return{constrainDragToContainer:t.constrainDragToContainer,reorderEnabled:t.reorderEnabled,popoutWholeStack:t.popoutWholeStack,blockedPopoutsThrowError:t.blockedPopoutsThrowError,closePopoutsOnUnload:t.closePopoutsOnUnload,responsiveMode:t.responsiveMode,tabOverlapAllowance:t.tabOverlapAllowance,reorderOnTabMenuClick:t.reorderOnTabMenuClick,tabControlOffset:t.tabControlOffset,popInOnClose:t.popInOnClose}},(i=t.Dimensions||(t.Dimensions={})).createCopy=function(t){return{borderWidth:t.borderWidth,borderGrabWidth:t.borderGrabWidth,defaultMinItemHeight:t.defaultMinItemHeight,defaultMinItemHeightUnit:t.defaultMinItemHeightUnit,defaultMinItemWidth:t.defaultMinItemWidth,defaultMinItemWidthUnit:t.defaultMinItemWidthUnit,headerHeight:t.headerHeight,dragProxyWidth:t.dragProxyWidth,dragProxyHeight:t.dragProxyHeight}},i.defaults={borderWidth:5,borderGrabWidth:5,defaultMinItemHeight:0,defaultMinItemHeightUnit:F.Pixel,defaultMinItemWidth:10,defaultMinItemWidthUnit:F.Pixel,headerHeight:20,dragProxyWidth:300,dragProxyHeight:200},function(t){t.createCopy=function(t){return{show:t.show,popout:t.popout,dock:t.dock,close:t.close,maximise:t.maximise,minimise:t.minimise,tabDropdown:t.tabDropdown}},t.defaults={show:R.top,popout:"open in new window",dock:"dock",maximise:"maximise",minimise:"minimise",close:"close",tabDropdown:"additional tabs"}}(t.Header||(t.Header={})),t.isPopout=n,t.createDefault=function(){return{root:void 0,openPopouts:[],dimensions:t.Dimensions.defaults,settings:t.Settings.defaults,header:t.Header.defaults,resolved:!0}},t.createCopy=function(e){return n(e)?J.createCopy(e):{root:void 0===e.root?void 0:q.createCopy(e.root),openPopouts:t.copyOpenPopouts(e.openPopouts),settings:t.Settings.createCopy(e.settings),dimensions:t.Dimensions.createCopy(e.dimensions),header:t.Header.createCopy(e.header),resolved:e.resolved}},t.copyOpenPopouts=function(t){const e=t.length,i=new Array(e);for(let n=0;n<e;n++)i[n]=J.createCopy(t[n]);return i},t.minifyConfig=function(t){return V.translateObject(t,!0)},t.unminifyConfig=function(t){return V.translateObject(t,!1)}}(Y||(Y={})),function(t){var e;(e=t.Window||(t.Window={})).createCopy=function(t){return{width:t.width,height:t.height,left:t.left,top:t.top}},e.defaults={width:null,height:null,left:null,top:null},t.createCopy=function(e){return{root:void 0===e.root?void 0:q.createCopy(e.root),openPopouts:Y.copyOpenPopouts(e.openPopouts),settings:Y.Settings.createCopy(e.settings),dimensions:Y.Dimensions.createCopy(e.dimensions),header:Y.Header.createCopy(e.header),parentId:e.parentId,indexInParent:e.indexInParent,window:t.Window.createCopy(e.window),resolved:e.resolved}}}(J||(J={})),function(t){t.resolve=function(t,e){switch(t.type){case B.ground:throw new b("ItemConfig cannot specify type ground",JSON.stringify(t));case B.row:case B.column:return it.resolve(t,e);case B.stack:return tt.resolve(t,e);case B.component:return et.resolve(t,e);default:throw new L("UCUICR55499",t.type)}},t.resolveContent=function(e){if(void 0===e)return[];{const i=e.length,n=new Array(i);for(let o=0;o<i;o++)n[o]=t.resolve(e[o],!1);return n}},t.resolveId=function(t){return void 0===t?N.defaults.id:Array.isArray(t)?0===t.length?N.defaults.id:t[0]:t},t.resolveSize=function(t,e,i,n){if(void 0!==t)return ft(t,[F.Percent,F.Fractional]);if(void 0!==e||void 0!==i){if(void 0!==e)return{size:e,sizeUnit:F.Percent};if(void 0!==i)return{size:i,sizeUnit:F.Percent};throw new P("CRS33390")}return n?{size:50,sizeUnit:F.Percent}:{size:N.defaults.size,sizeUnit:N.defaults.sizeUnit}},t.resolveMinSize=function(t,e,i){if(void 0!==t)return ft(t,[F.Pixel]);{const t=void 0!==e;return t||void 0!==i?t?{size:e,sizeUnit:F.Pixel}:{size:i,sizeUnit:F.Pixel}:{size:N.defaults.minSize,sizeUnit:N.defaults.minSizeUnit}}},t.calculateSizeWidthHeightSpecificationType=function(t){return void 0!==t.size?1:void 0!==t.width||void 0!==t.height?2:0},t.isGround=function(t){return t.type===B.ground},t.isRow=function(t){return t.type===B.row},t.isColumn=function(t){return t.type===B.column},t.isStack=function(t){return t.type===B.stack},t.isComponent=function(t){return t.type===B.component}}(K||(K={})),function(t){!function(t){t.resolve=function(t,e){var i;if(void 0!==t||void 0!==e){return{show:null!==(i=null==t?void 0:t.show)&&void 0!==i?i:void 0===e?void 0:!!e&&Y.Header.defaults.show,popout:null==t?void 0:t.popout,maximise:null==t?void 0:t.maximise,close:null==t?void 0:t.close,minimise:null==t?void 0:t.minimise,tabDropdown:null==t?void 0:t.tabDropdown}}}}(t.Header||(t.Header={})),t.resolveIdAndMaximised=function(t){let e,i,n=t.id,o=!1;if(void 0===n)e=N.defaults.id;else if(Array.isArray(n)){const t=n.findIndex((t=>"__glMaximised"===t));t>0&&(o=!0,n=n.splice(t,1)),e=n.length>0?n[0]:N.defaults.id}else e=n;return i=void 0!==t.maximised?t.maximised:o,{id:e,maximised:i}}}(Q||(Q={})),function(t){function e(t){if(void 0===t)return[];{const e=t.length,i=new Array(e);for(let n=0;n<e;n++){const e=t[n],o=K.resolve(e,!1);if(!N.isComponentItem(o))throw new z("UCUSICRC91114",JSON.stringify(o));i[n]=o}return i}}function i(t){const e=t.length,i=new Array(e);for(let n=0;n<e;n++){const e=t[n];i[n]=et.fromResolved(e)}return i}t.resolve=function(t,i){var n,o;const{id:s,maximised:r}=Q.resolveIdAndMaximised(t),{size:a,sizeUnit:l}=K.resolveSize(t.size,t.width,t.height,i),{size:h,sizeUnit:d}=K.resolveMinSize(t.minSize,t.minWidth,t.minHeight);return{type:B.stack,content:e(t.content),size:a,sizeUnit:l,minSize:h,minSizeUnit:d,id:s,maximised:r,isClosable:null!==(n=t.isClosable)&&void 0!==n?n:N.defaults.isClosable,activeItemIndex:null!==(o=t.activeItemIndex)&&void 0!==o?o:Z.defaultActiveItemIndex,header:Q.Header.resolve(t.header,t.hasHeaders)}},t.fromResolved=function(t){return{type:B.stack,content:i(t.content),size:_t(t.size,t.sizeUnit),minSize:vt(t.minSize,t.minSizeUnit),id:t.id,maximised:t.maximised,isClosable:t.isClosable,activeItemIndex:t.activeItemIndex,header:G.Header.createCopy(t.header)}}}(tt||(tt={})),function(t){t.resolve=function(e,i){var n,o,s;let r=e.componentType;if(void 0===r&&(r=e.componentName),void 0===r)throw new Error("ComponentItemConfig.componentType is undefined");{const{id:a,maximised:l}=Q.resolveIdAndMaximised(e);let h;h=void 0===e.title||""===e.title?t.componentTypeToTitle(r):e.title;const{size:d,sizeUnit:c}=K.resolveSize(e.size,e.width,e.height,i),{size:m,sizeUnit:u}=K.resolveMinSize(e.minSize,e.minWidth,e.minHeight);return{type:e.type,content:[],size:d,sizeUnit:c,minSize:m,minSizeUnit:u,id:a,maximised:l,isClosable:null!==(n=e.isClosable)&&void 0!==n?n:N.defaults.isClosable,reorderEnabled:null!==(o=e.reorderEnabled)&&void 0!==o?o:$.defaultReorderEnabled,title:h,header:Q.Header.resolve(e.header,e.hasHeaders),componentType:r,componentState:null!==(s=e.componentState)&&void 0!==s?s:{}}}},t.fromResolved=function(t){return{type:B.component,size:_t(t.size,t.sizeUnit),minSize:vt(t.minSize,t.minSizeUnit),id:t.id,maximised:t.maximised,isClosable:t.isClosable,reorderEnabled:t.reorderEnabled,title:t.title,header:G.Header.createCopy(t.header),componentType:t.componentType,componentState:pt(void 0,t.componentState)}},t.componentTypeToTitle=function(t){switch(typeof t){case"string":return t;case"number":case"boolean":return t.toString();default:return""}}}(et||(et={})),function(t){function e(e){const i=e.length,n=new Array(i);for(let o=0;o<i;o++){const i=e[o],s=i.type;let r;switch(s){case B.row:case B.column:r=t.fromResolved(i);break;case B.stack:r=tt.fromResolved(i);break;case B.component:r=et.fromResolved(i);break;default:throw new L("ROCICFRC44797",s)}n[o]=r}return n}t.isChildItemConfig=function(t){switch(t.type){case B.row:case B.column:case B.stack:case B.component:return!0;case B.ground:return!1;default:throw new L("UROCOSPCICIC13687",t.type)}},t.resolve=function(e,i){var n;const{size:o,sizeUnit:s}=K.resolveSize(e.size,e.width,e.height,i),{size:r,sizeUnit:a}=K.resolveMinSize(e.minSize,e.minWidth,e.minHeight);return{type:e.type,content:t.resolveContent(e.content),size:o,sizeUnit:s,minSize:r,minSizeUnit:a,id:K.resolveId(e.id),isClosable:null!==(n=e.isClosable)&&void 0!==n?n:N.defaults.isClosable}},t.fromResolved=function(t){return{type:t.type,content:e(t.content),size:_t(t.size,t.sizeUnit),minSize:vt(t.minSize,t.minSizeUnit),id:t.id,isClosable:t.isClosable}},t.resolveContent=function(e){if(void 0===e)return[];{const i=e.length,n=new Array(i);let o,s=!1,r=!1;for(let o=0;o<i;o++){const i=e[o];if(!t.isChildItemConfig(i))throw new b("ItemConfig is not Row, Column or Stack",i);if(!r){const t=K.calculateSizeWidthHeightSpecificationType(i);switch(t){case 0:break;case 2:s=!0;break;case 1:r=!0;break;default:throw new L("ROCICRC87556",t)}}n[o]=i}o=!r&&!!s;const a=new Array(i);for(let t=0;t<i;t++){const e=n[t],i=K.resolve(e,o);if(!j.isChildItemConfig(i))throw new z("UROCOSPIC99512",JSON.stringify(i));a[t]=i}return a}}}(it||(it={})),function(t){t.isRootItemConfig=function(t){switch(t.type){case B.row:case B.column:case B.stack:case B.component:return!0;case B.ground:return!1;default:throw new L("URICIR23687",t.type)}},t.resolve=function(t){if(void 0!==t){const e=K.resolve(t,!1);if(q.isRootItemConfig(e))return e;throw new b("ItemConfig is not Row, Column or Stack",JSON.stringify(t))}},t.fromResolvedOrUndefined=function(t){if(void 0!==t){const e=t.type;switch(e){case B.row:case B.column:return it.fromResolved(t);case B.stack:return tt.fromResolved(t);case B.component:return et.fromResolved(t);default:throw new L("RICFROU89921",e)}}}}(nt||(nt={})),function(t){var e;function i(t){return"parentId"in t||"indexInParent"in t||"window"in t}(t.Settings||(t.Settings={})).resolve=function(t){var e,i,n,o,s,r,a,l,h,d;return{constrainDragToContainer:null!==(e=null==t?void 0:t.constrainDragToContainer)&&void 0!==e?e:Y.Settings.defaults.constrainDragToContainer,reorderEnabled:null!==(i=null==t?void 0:t.reorderEnabled)&&void 0!==i?i:Y.Settings.defaults.reorderEnabled,popoutWholeStack:null!==(n=null==t?void 0:t.popoutWholeStack)&&void 0!==n?n:Y.Settings.defaults.popoutWholeStack,blockedPopoutsThrowError:null!==(o=null==t?void 0:t.blockedPopoutsThrowError)&&void 0!==o?o:Y.Settings.defaults.blockedPopoutsThrowError,closePopoutsOnUnload:null!==(s=null==t?void 0:t.closePopoutsOnUnload)&&void 0!==s?s:Y.Settings.defaults.closePopoutsOnUnload,responsiveMode:null!==(r=null==t?void 0:t.responsiveMode)&&void 0!==r?r:Y.Settings.defaults.responsiveMode,tabOverlapAllowance:null!==(a=null==t?void 0:t.tabOverlapAllowance)&&void 0!==a?a:Y.Settings.defaults.tabOverlapAllowance,reorderOnTabMenuClick:null!==(l=null==t?void 0:t.reorderOnTabMenuClick)&&void 0!==l?l:Y.Settings.defaults.reorderOnTabMenuClick,tabControlOffset:null!==(h=null==t?void 0:t.tabControlOffset)&&void 0!==h?h:Y.Settings.defaults.tabControlOffset,popInOnClose:null!==(d=null==t?void 0:t.popInOnClose)&&void 0!==d?d:Y.Settings.defaults.popInOnClose}},(e=t.Dimensions||(t.Dimensions={})).resolve=function(t){var i,n,o,s,r;const{size:a,sizeUnit:l}=e.resolveDefaultMinItemHeight(t),{size:h,sizeUnit:d}=e.resolveDefaultMinItemWidth(t);return{borderWidth:null!==(i=null==t?void 0:t.borderWidth)&&void 0!==i?i:Y.Dimensions.defaults.borderWidth,borderGrabWidth:null!==(n=null==t?void 0:t.borderGrabWidth)&&void 0!==n?n:Y.Dimensions.defaults.borderGrabWidth,defaultMinItemHeight:a,defaultMinItemHeightUnit:l,defaultMinItemWidth:h,defaultMinItemWidthUnit:d,headerHeight:null!==(o=null==t?void 0:t.headerHeight)&&void 0!==o?o:Y.Dimensions.defaults.headerHeight,dragProxyWidth:null!==(s=null==t?void 0:t.dragProxyWidth)&&void 0!==s?s:Y.Dimensions.defaults.dragProxyWidth,dragProxyHeight:null!==(r=null==t?void 0:t.dragProxyHeight)&&void 0!==r?r:Y.Dimensions.defaults.dragProxyHeight}},e.fromResolved=function(t){return{borderWidth:t.borderWidth,borderGrabWidth:t.borderGrabWidth,defaultMinItemHeight:_t(t.defaultMinItemHeight,t.defaultMinItemHeightUnit),defaultMinItemWidth:_t(t.defaultMinItemWidth,t.defaultMinItemWidthUnit),headerHeight:t.headerHeight,dragProxyWidth:t.dragProxyWidth,dragProxyHeight:t.dragProxyHeight}},e.resolveDefaultMinItemHeight=function(t){const e=null==t?void 0:t.defaultMinItemHeight;return void 0===e?{size:Y.Dimensions.defaults.defaultMinItemHeight,sizeUnit:Y.Dimensions.defaults.defaultMinItemHeightUnit}:ft(e,[F.Pixel])},e.resolveDefaultMinItemWidth=function(t){const e=null==t?void 0:t.defaultMinItemWidth;return void 0===e?{size:Y.Dimensions.defaults.defaultMinItemWidth,sizeUnit:Y.Dimensions.defaults.defaultMinItemWidthUnit}:ft(e,[F.Pixel])},function(t){t.resolve=function(t,e,i){var n,o,s,r,a,l,h,d,c,m,u,p;let g;return g=void 0!==(null==t?void 0:t.show)?t.show:void 0!==e&&void 0!==e.hasHeaders?!!e.hasHeaders&&Y.Header.defaults.show:Y.Header.defaults.show,{show:g,popout:null!==(o=null!==(n=null==t?void 0:t.popout)&&void 0!==n?n:null==i?void 0:i.popout)&&void 0!==o?o:!1!==(null==e?void 0:e.showPopoutIcon)&&Y.Header.defaults.popout,dock:null!==(r=null!==(s=null==t?void 0:t.popin)&&void 0!==s?s:null==i?void 0:i.popin)&&void 0!==r?r:Y.Header.defaults.dock,maximise:null!==(l=null!==(a=null==t?void 0:t.maximise)&&void 0!==a?a:null==i?void 0:i.maximise)&&void 0!==l?l:!1!==(null==e?void 0:e.showMaximiseIcon)&&Y.Header.defaults.maximise,close:null!==(d=null!==(h=null==t?void 0:t.close)&&void 0!==h?h:null==i?void 0:i.close)&&void 0!==d?d:!1!==(null==e?void 0:e.showCloseIcon)&&Y.Header.defaults.close,minimise:null!==(m=null!==(c=null==t?void 0:t.minimise)&&void 0!==c?c:null==i?void 0:i.minimise)&&void 0!==m?m:Y.Header.defaults.minimise,tabDropdown:null!==(p=null!==(u=null==t?void 0:t.tabDropdown)&&void 0!==u?u:null==i?void 0:i.tabDropdown)&&void 0!==p?p:Y.Header.defaults.tabDropdown}}}(t.Header||(t.Header={})),t.isPopout=i,t.resolve=function(e){if(i(e))return st.resolve(e);{let i;i=void 0!==e.root?e.root:void 0!==e.content&&e.content.length>0?e.content[0]:void 0;return{resolved:!0,root:nt.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:nt.fromResolvedOrUndefined(e.root),openPopouts:st.fromResolvedArray(e.openPopouts),settings:Y.Settings.createCopy(e.settings),dimensions:t.Dimensions.fromResolved(e.dimensions),header:Y.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;n<e;n++)i[n]=st.resolve(t[n]);return i}}}(ot||(ot={})),function(t){var e;function i(e){const i=e.length,n=new Array(i);for(let o=0;o<i;o++){const i=e[o];n[o]=t.fromResolved(i)}return n}(e=t.Window||(t.Window={})).resolve=function(t,e){var i,n,o,s,r,a,l,h;let d;const c=J.Window.defaults;return d=void 0!==t?{width:null!==(i=t.width)&&void 0!==i?i:c.width,height:null!==(n=t.height)&&void 0!==n?n:c.height,left:null!==(o=t.left)&&void 0!==o?o:c.left,top:null!==(s=t.top)&&void 0!==s?s:c.top}:{width:null!==(r=null==e?void 0:e.width)&&void 0!==r?r:c.width,height:null!==(a=null==e?void 0:e.height)&&void 0!==a?a:c.height,left:null!==(l=null==e?void 0:e.left)&&void 0!==l?l:c.left,top:null!==(h=null==e?void 0:e.top)&&void 0!==h?h:c.top},d},e.fromResolved=function(t){return{width:null===t.width?void 0:t.width,height:null===t.height?void 0:t.height,left:null===t.left?void 0:t.left,top:null===t.top?void 0:t.top}},t.resolve=function(e){var i,n;let o;return o=void 0!==e.root?e.root:void 0!==e.content&&e.content.length>0?e.content[0]:void 0,{root:nt.resolve(o),openPopouts:ot.resolveOpenPopouts(e.openPopouts),dimensions:ot.Dimensions.resolve(e.dimensions),settings:ot.Settings.resolve(e.settings),header:ot.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:nt.fromResolvedOrUndefined(e.root),openPopouts:i(e.openPopouts),dimensions:ot.Dimensions.fromResolved(e.dimensions),settings:Y.Settings.createCopy(e.settings),header:Y.Header.createCopy(e.header),parentId:e.parentId,indexInParent:e.indexInParent,window:t.Window.fromResolved(e.window)}},t.fromResolvedArray=i}(st||(st={}));class Ct{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;t<i.length;t++){(0,i[t])(...e)}}this.emitAllEvent(t,e),this.tryBubbleEvent(t,e)}emitUnknown(t,...e){let i=this._subscriptionsMap.get(t);if(void 0!==i){i=i.slice();for(let t=0;t<i.length;t++)i[t](...e)}this.emitAllEvent(t,e),this.tryBubbleEvent(t,e)}emitBaseBubblingEvent(t){const e=new Ct.BubblingEvent(t,this);this.emitUnknown(t,e)}emitUnknownBubblingEvent(t){const e=new Ct.BubblingEvent(t,this);this.emitUnknown(t,e)}removeEventListener(t,e){const i=e;this.removeUnknownEventListener(t,i)}off(t,e){this.removeEventListener(t,e)}addEventListener(t,e){const i=e;this.addUnknownEventListener(t,i)}on(t,e){this.addEventListener(t,e)}addUnknownEventListener(t,e){if(t===Ct.ALL_EVENT)this._allEventSubscriptions.push(e);else{let i=this._subscriptionsMap.get(t);void 0!==i?i.push(e):(i=[e],this._subscriptionsMap.set(t,i))}}removeUnknownEventListener(t,e){if(t===Ct.ALL_EVENT)this.removeSubscription(t,this._allEventSubscriptions,e);else{const i=this._subscriptionsMap.get(t);if(void 0===i)throw new Error("No subscribtions to unsubscribe for event "+t);this.removeSubscription(t,i,e)}}removeSubscription(t,e,i){const n=e.indexOf(i);if(n<0)throw new Error("Nothing to unbind for "+t);e.splice(n,1)}emitAllEvent(t,e){const i=this._allEventSubscriptions.length;if(i>0){const n=e.slice();n.unshift(t);const o=this._allEventSubscriptions.slice();for(let t=0;t<i;t++)o[t](...n)}}}!function(t){t.ALL_EVENT="__all",t.headerClickEventName="stackHeaderClick",t.headerTouchStartEventName="stackHeaderTouchStart";class e{constructor(t,e){this._name=t,this._target=e,this._isPropagationStopped=!1}get name(){return this._name}get target(){return this._target}get origin(){return this._target}get isPropagationStopped(){return this._isPropagationStopped}stopPropagation(){this._isPropagationStopped=!0}}t.BubblingEvent=e;t.ClickBubblingEvent=class extends e{constructor(t,e,i){super(t,e),this._mouseEvent=i}get mouseEvent(){return this._mouseEvent}};t.TouchStartBubblingEvent=class extends e{constructor(t,e,i){super(t,e),this._touchEvent=i}get touchEvent(){return this._touchEvent}}}(Ct||(Ct={}));class yt extends Ct{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,e){let i=this._parent;if(i.isColumn||i.isRow||null===i.parent)throw new z("ICSSPRC","ComponentContainer cannot have RowColumn Parent");{let n;do{n=i,i=i.parent}while(null!==i&&!i.isColumn&&!i.isRow);if(null===i)return!1;{const o=i.isColumn?"height":"width",s=this[o];if(null===s)throw new M("ICSSCS11194");{const r=("height"===o?e:t)/(s*(1/(n.size/100)))*100,a=(n.size-r)/(i.contentItems.length-1);for(let t=0;t<i.contentItems.length;t++){const e=i.contentItems[t];e===n?e.size=r:e.size+=a}return i.updateSize(!1),!0}}}}close(){this._isClosable&&(this.emit("close"),this._parent.close())}replaceComponent(t){if(this.releaseComponent(),!K.isComponent(t))throw new Error("ReplaceComponent not passed a component ItemConfig");{const e=et.resolve(t,!1);if(this._initialState=e.componentState,this._state=this._initialState,this._componentType=e.componentType,this._updateItemConfigEvent(e),this._boundComponent=this.layoutManager.bindComponent(this,e),this.updateElementPositionPropertyFromBoundComponent(),this._boundComponent.virtual){if(void 0!==this.virtualVisibilityChangeRequiredEvent&&this.virtualVisibilityChangeRequiredEvent(this,this._visible),void 0!==this.virtualRectingRequiredEvent){this._layoutManager.fireBeforeVirtualRectingEvent(1);try{this.virtualRectingRequiredEvent(this,this._width,this._height)}finally{this._layoutManager.fireAfterVirtualRectingEvent()}}this.setBaseLogicalZIndex()}this.emit("stateChanged")}}getState(){return this._state}extendState(t){const e=ut(this._state,t);this.setState(e)}setState(t){this._state=t,this._parent.emitBaseBubblingEvent("stateChanged")}setTitle(t){this._parent.setTitle(t)}setTab(t){this._tab=t,this.emit("tab",t)}setVisibility(t){this._boundComponent.virtual&&void 0!==this.virtualVisibilityChangeRequiredEvent&&this.virtualVisibilityChangeRequiredEvent(this,t),t?this._visible?!this._isShownWithZeroDimensions||0===this._height&&0===this._width||(this._isShownWithZeroDimensions=!1,this.setSizeToNodeSize(this._width,this._height,!0),this.emitShow()):(this._visible=!0,0===this._height&&0===this._width?this._isShownWithZeroDimensions=!0:(this._isShownWithZeroDimensions=!1,this.setSizeToNodeSize(this._width,this._height,!0),this.emitShow())):this._visible&&(this._visible=!1,this._isShownWithZeroDimensions=!1,this.emitHide())}setBaseLogicalZIndex(){this.setLogicalZIndex(U.base)}setLogicalZIndex(t){t!==this._logicalZIndex&&(this._logicalZIndex=t,this.notifyVirtualZIndexChangeRequired())}enterDragMode(t,e){this._width=t,this._height=e,ht(this._element,t),dt(this._element,e),this.setLogicalZIndex(U.drag),this.drag()}exitDragMode(){this.setBaseLogicalZIndex()}enterStackMaximised(){this._stackMaximised=!0,this.setLogicalZIndex(U.stackMaximised)}exitStackMaximised(){this.setBaseLogicalZIndex(),this._stackMaximised=!1}drag(){if(this._boundComponent.virtual&&void 0!==this.virtualRectingRequiredEvent){this._layoutManager.fireBeforeVirtualRectingEvent(1);try{this.virtualRectingRequiredEvent(this,this._width,this._height)}finally{this._layoutManager.fireAfterVirtualRectingEvent()}}}setSizeToNodeSize(t,e,i){(t!==this._width||e!==this._height||i)&&(this._width=t,this._height=e,ht(this._element,t),dt(this._element,e),this._boundComponent.virtual?this.addVirtualSizedContainerToLayoutManager():(this.emit("resize"),this.checkShownFromZeroDimensions()))}notifyVirtualRectingRequired(){void 0!==this.virtualRectingRequiredEvent&&(this.virtualRectingRequiredEvent(this,this._width,this._height),this.emit("resize"),this.checkShownFromZeroDimensions())}notifyVirtualZIndexChangeRequired(){if(void 0!==this.virtualZIndexChangeRequiredEvent){const t=this._logicalZIndex,e=H[t];this.virtualZIndexChangeRequiredEvent(this,t,e)}}updateElementPositionPropertyFromBoundComponent(){this._boundComponent.virtual?this._element.style.position="static":this._element.style.position=""}addVirtualSizedContainerToLayoutManager(){this._layoutManager.beginVirtualSizedContainerAdding();try{this._layoutManager.addVirtualSizedContainer(this)}finally{this._layoutManager.endVirtualSizedContainerAdding()}}checkShownFromZeroDimensions(){!this._isShownWithZeroDimensions||0===this._height&&0===this._width||(this._isShownWithZeroDimensions=!1,this.emitShow())}emitShow(){this.emit("shown"),this.emit("show")}emitHide(){this.emit("hide")}releaseComponent(){this._stackMaximised&&this.exitStackMaximised(),this.emit("beforeComponentRelease",this._boundComponent.component),this.layoutManager.unbindComponent(this,this._boundComponent.virtual,this._boundComponent.component)}}class wt extends Ct{constructor(t,e,i){super(),this._config=t,this._initialWindowSize=e,this._layoutManager=i,this._isInitialised=!1,this._popoutWindow=null,this.createWindow()}toConfig(){var t,e;if(!1===this._isInitialised)throw new Error("Can't create config, layout not yet initialised");const i=this.getGlInstance().saveLayout();let n,o;null===this._popoutWindow?(n=null,o=null):(n=null!==(t=this._popoutWindow.screenX)&&void 0!==t?t:this._popoutWindow.screenLeft,o=null!==(e=this._popoutWindow.screenY)&&void 0!==e?e:this._popoutWindow.screenTop);const s={width:this.getGlInstance().width,height:this.getGlInstance().height,left:n,top:o};return{root:i.root,openPopouts:i.openPopouts,settings:i.settings,dimensions:i.dimensions,header:i.header,window:s,parentId:this._config.parentId,indexInParent:this._config.indexInParent,resolved:!0}}getGlInstance(){if(null===this._popoutWindow)throw new M("BPGGI24693");return this._popoutWindow.__glInstance}getWindow(){if(null===this._popoutWindow)throw new M("BPGW087215");return this._popoutWindow}close(){if(this.getGlInstance())this.getGlInstance().closeWindow();else try{this.getWindow().close()}catch(t){}}popIn(){let t,e=this._config.indexInParent;if(!this._config.parentId)return;const i=ut({},this.getGlInstance().saveLayout()).root;if(void 0===i)throw new P("BPPIR19998");const n=this._layoutManager.groundItem;if(void 0===n)throw new P("BPPIG34972");t=n.getItemsByPopInParentId(this._config.parentId)[0],t||(t=n.contentItems.length>0?n.contentItems[0]:n,e=0);const o=this._layoutManager.createAndInitContentItem(i,t);t.addChild(o,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 I("Popout blocked")}}checkReady(){if(null===this._popoutWindow)throw new M("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-"+gt(),e=Y.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 bt extends Ct{constructor(t,e,i,n){super(),this.layoutManager=t,this._parent=i,this._element=n,this._popInParentIds=[],this._type=e.type,this._id=e.id,this._isInitialised=!1,this.isGround=!1,this.isRow=!1,this.isColumn=!1,this.isStack=!1,this.isComponent=!1,this.size=e.size,this.sizeUnit=e.sizeUnit,this.minSize=e.minSize,this.minSizeUnit=e.minSizeUnit,this._isClosable=e.isClosable,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this._contentItems=this.createContentItems(e.content)}get type(){return this._type}get id(){return this._id}set id(t){this._id=t}get popInParentIds(){return this._popInParentIds}get parent(){return this._parent}get contentItems(){return this._contentItems}get isClosable(){return this._isClosable}get element(){return this._element}get isInitialised(){return this._isInitialised}static isStack(t){return t.isStack}static isComponentItem(t){return t.isComponent}static isComponentParentableItem(t){return t.isStack||t.isGround}removeChild(t,e=!1){const i=this._contentItems.indexOf(t);if(-1===i)throw new Error("Can't remove child item. Unknown content item");if(e||this._contentItems[i].destroy(),this._contentItems.splice(i,1),this._contentItems.length>0)this.updateSize(!1);else if(!this.isGround&&!0===this._isClosable){if(null===this._parent)throw new M("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,e,i=!1){const n=this._contentItems.indexOf(t),o=t._element.parentNode;if(-1===n)throw new z("CIRCI23232","Can't replace child. oldChild is not child of this");if(null===o)throw new M("CIRCP23232");if(o.replaceChild(e._element,t._element),!0===i&&(t._parent=null,t.destroy()),this._contentItems[n]=e,e.setParent(this),e.size=t.size,e.sizeUnit=t.sizeUnit,e.minSize=t.minSize,e.minSizeUnit=t.minSizeUnit,null===e._parent)throw new M("CIRCNC45699");!0===e._parent._isInitialised&&!1===e._isInitialised&&e.init(),this.updateSize(!1)}remove(){if(null===this._parent)throw new M("CIR11110");this._parent.removeChild(this)}popout(){const t=gt(),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;n<e;n++){const e=t[n];i[n]=e.toConfig()}return i}highlightDropZone(t,e,i){const n=this.layoutManager.dropTargetIndicator;if(null===n)throw new M("ACIHDZ5593");n.highlightArea(i,1)}onDrop(t,e){this.addChild(t)}show(){this.layoutManager.beginSizeInvalidation();try{mt(this._element,!0);for(let t=0;t<this._contentItems.length;t++)this._contentItems[t].show()}finally{this.layoutManager.endSizeInvalidation()}}destroy(){for(let t=0;t<this._contentItems.length;t++)this._contentItems[t].destroy();this._contentItems=[],this.emitBaseBubblingEvent("beforeItemDestroyed"),this._element.remove(),this.emitBaseBubblingEvent("itemDestroyed")}getElementArea(t){const e=(t=null!=t?t:this._element).getBoundingClientRect(),i=e.top+document.body.scrollTop,n=e.left+document.body.scrollLeft,o=e.width,s=e.height;return{x1:n,y1:i,x2:n+o,y2:i+s,surface:o*s,contentItem:this}}init(){this._isInitialised=!0,this.emitBaseBubblingEvent("itemCreated"),this.emitUnknownBubblingEvent(this.type+"Created")}setParent(t){this._parent=t}addPopInParentId(t){this.popInParentIds.includes(t)||this.popInParentIds.push(t)}initContentItems(){for(let t=0;t<this._contentItems.length;t++)this._contentItems[t].init()}hide(){this.layoutManager.beginSizeInvalidation();try{mt(this._element,!1)}finally{this.layoutManager.endSizeInvalidation()}}updateContentItemsSize(t){for(let e=0;e<this._contentItems.length;e++)this._contentItems[e].updateSize(t)}createContentItems(t){const e=t.length,i=new Array(e);for(let e=0;e<t.length;e++)i[e]=this.layoutManager.createContentItem(t[e],this);return i}propagateEvent(t,e){if(1===e.length){const i=e[0];i instanceof Ct.BubblingEvent&&!1===i.isPropagationStopped&&!0===this._isInitialised&&(!1===this.isGround&&this._parent?this._parent.emitUnknown(t,i):this.scheduleEventPropagationToLayoutManager(t,i))}}tryBubbleEvent(t,e){if(1===e.length){const i=e[0];i instanceof Ct.BubblingEvent&&!1===i.isPropagationStopped&&!0===this._isInitialised&&(!1===this.isGround&&this._parent?this._parent.emitUnknown(t,i):this.scheduleEventPropagationToLayoutManager(t,i))}}scheduleEventPropagationToLayoutManager(t,e){-1===this._throttledEvents.indexOf(t)?this.layoutManager.emitUnknown(t,e):!0!==this._pendingEventPropagations[t]&&(this._pendingEventPropagations[t]=!0,globalThis.requestAnimationFrame((()=>this.propagateEventToLayoutManager(t,e))))}propagateEventToLayoutManager(t,e){this._pendingEventPropagations[t]=!1,this.layoutManager.emitUnknown(t,e)}}class It extends bt{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 yt(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:B.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:G.Header.createCopy(this._headerConfig),componentType:$.copyComponentType(this.componentType),componentState:e}}close(){if(null===this.parent)throw new M("CIC68883");this.parent.removeChild(this,!1)}enterDragMode(t,e){ht(this.element,t),dt(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}=ct(this.element);this._container.setSizeToNodeSize(e,i,t)}}}class St extends bt{constructor(){super(...arguments),this._focused=!1}get focused(){return this._focused}setFocusedValue(t){this._focused=t}}class Et extends Ct{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 xt{constructor(t,e,i){this._isVertical=t,this._size=e,this._grabSize=i<this._size?this._size:i,this._element=document.createElement("div"),this._element.classList.add("lm_splitter");const n=document.createElement("div");n.classList.add("lm_drag_handle");const o=this._grabSize-this._size,s=o/2;this._isVertical?(n.style.top=rt(-s),n.style.height=rt(this._size+o),this._element.classList.add("lm_vertical"),this._element.style.height=rt(this._size)):(n.style.left=rt(-s),n.style.width=rt(this._size+o),this._element.classList.add("lm_horizontal"),this._element.style.width=rt(this._size)),this._element.appendChild(n),this._dragListener=new Et(this._element,[n])}get element(){return this._element}destroy(){this._element.remove()}on(t,e){this._dragListener.on(t,e)}}class zt extends bt{constructor(t,e,i,n){switch(super(e,i,n,zt.createElement(document,t)),this._rowOrColumnParent=n,this._splitter=[],this.isRow=!t,this.isColumn=t,this._childElementContainer=this.element,this._splitterSize=e.layoutConfig.dimensions.borderWidth,this._splitterGrabSize=e.layoutConfig.dimensions.borderGrabWidth,this._isColumn=t,this._dimension=t?"height":"width",this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null,i.type){case B.row:case B.column:this._configType=i.type;break;default:throw new z("ROCCCT00925")}}newComponent(t,e,i,n){const o={type:"component",componentType:t,componentState:e,title:i};return this.newItem(o,n)}addComponent(t,e,i,n){const o={type:"component",componentType:t,componentState:e,title:i};return this.addItem(o,n)}newItem(t,e){e=this.addItem(t,e);const i=this.contentItems[e];return bt.isStack(i)&&K.isComponent(t)?i.contentItems[0]:i}addItem(t,e){this.layoutManager.checkMinimiseMaximisedStack();const i=K.resolve(t,!1),n=this.layoutManager.createAndInitContentItem(i,this);return this.addChild(n,e,!1)}addChild(t,e,i){if(void 0===e&&(e=this.contentItems.length),this.contentItems.length>0){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;e<this.contentItems.length;e++){const i=this.contentItems[e];if(i===t)t.size=n;else{const t=i.size*=(100-n)/100;i.size=t}}return this.updateSize(!1),this.emitBaseBubblingEvent("stateChanged"),e}removeChild(t,e){const i=this.contentItems.indexOf(t),n=Math.max(i-1,0);if(-1===i)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");if(this._splitter[n]&&(this._splitter[n].destroy(),this._splitter.splice(n,1)),super.removeChild(t,e),1===this.contentItems.length&&!0===this.isClosable){const t=this.contentItems[0];this.contentItems.length=0,this._rowOrColumnParent.replaceChild(this,t,!0)}else this.updateSize(!1),this.emitBaseBubblingEvent("stateChanged")}replaceChild(t,e){const i=t.size;super.replaceChild(t,e),e.size=i,this.updateSize(!1),this.emitBaseBubblingEvent("stateChanged")}updateSize(t){this.layoutManager.beginVirtualSizedContainerAdding();try{this.updateNodeSize(),this.updateContentItemsSize(t)}finally{this.layoutManager.endVirtualSizedContainerAdding()}}init(){if(!0!==this.isInitialised){this.updateNodeSize();for(let t=0;t<this.contentItems.length;t++)this._childElementContainer.appendChild(this.contentItems[t].element);super.init();for(let t=0;t<this.contentItems.length-1;t++)this.contentItems[t].element.insertAdjacentElement("afterend",this.createSplitter(t).element);this.initContentItems()}}toConfig(){return{type:this.type,content:this.calculateConfigContent(),size:this.size,sizeUnit:this.sizeUnit,minSize:this.minSize,minSizeUnit:this.minSizeUnit,id:this.id,isClosable:this.isClosable}}setParent(t){this._rowOrColumnParent=t,super.setParent(t)}updateNodeSize(){this.contentItems.length>0&&(this.calculateRelativeSizes(),this.setAbsoluteSizes()),this.emitBaseBubblingEvent("stateChanged"),this.emit("resize")}setAbsoluteSizes(){const t=this.calculateAbsoluteSizes();for(let e=0;e<this.contentItems.length;e++)t.additionalPixel-e>0&&t.itemSizes[e]++,this._isColumn?(ht(this.contentItems[e].element,t.crossAxisSize),dt(this.contentItems[e].element,t.itemSizes[e])):(ht(this.contentItems[e].element,t.itemSizes[e]),dt(this.contentItems[e].element,t.crossAxisSize))}calculateAbsoluteSizes(){const t=(this.contentItems.length-1)*this._splitterSize,{width:e,height:i}=ct(this.element);let n,o;this._isColumn?(n=i-t,o=e):(n=e-t,o=i);let s=0;const r=[];for(let t=0;t<this.contentItems.length;t++){const e=this.contentItems[t];let i;if(e.sizeUnit!==F.Percent)throw new z("ROCCAS6692");i=Math.floor(n*(e.size/100)),s+=i,r.push(i)}return{itemSizes:r,additionalPixel:Math.floor(n-s),totalSize:n,crossAxisSize:o}}calculateRelativeSizes(){let t=0;const e=[];let i=0;for(let n=0;n<this.contentItems.length;n++){const o=this.contentItems[n];switch(o.sizeUnit){case F.Percent:t+=o.size;break;case F.Fractional:e.push(o),i+=o.size;break;default:throw new z("ROCCRS49110",JSON.stringify(o))}}if(100!==Math.round(t))if(Math.round(t)<100&&e.length>0){const n=100-t;for(let t=0;t<e.length;t++){const o=e[t];o.size=n*(o.size/i),o.sizeUnit=F.Percent}this.respectMinItemSize()}else{if(Math.round(t)>100&&e.length>0){for(let t=0;t<e.length;t++){const n=e[t];n.size=n.size/i*50,n.sizeUnit=F.Percent}t+=50}for(let e=0;e<this.contentItems.length;e++){const i=this.contentItems[e];i.size=i.size/t*100}this.respectMinItemSize()}else this.respectMinItemSize()}respectMinItemSize(){const t=this.calculateContentItemMinSize(this);if(!(t<=0||this.contentItems.length<=1)){let e=0,i=0;const n=[],o=[],s=this.calculateAbsoluteSizes();for(let r=0;r<s.itemSizes.length;r++){const a=s.itemSizes[r];let l;a<t?(i+=t-a,l={size:t}):(e+=a-t,l={size:a},n.push(l)),o.push(l)}if(0===i||i>e)return;{const r=i/e;let a=i;for(let e=0;e<n.length;e++){const i=n[e],o=Math.round((i.size-t)*r);a-=o,i.size-=o}0!==a&&(o[o.length-1].size-=a);for(let t=0;t<this.contentItems.length;t++){this.contentItems[t].size=o[t].size/s.totalSize*100}}}}createSplitter(t){const e=new xt(this._isColumn,this._splitterSize,this._splitterGrabSize);return e.on("drag",((t,i)=>this.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 e=t.minSize;if(void 0!==e){if(t.minSizeUnit===F.Pixel)return e;throw new z("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=at(e.before.element.style[this._dimension]),n=at(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 n=this._isColumn?i:e;if(null===this._splitterMinPosition||null===this._splitterMaxPosition)throw new M("ROCOSD59226");n=Math.max(n,this._splitterMinPosition),n=Math.min(n,this._splitterMaxPosition),this._splitterPosition=n;const o=rt(n);this._isColumn?t.element.style.top=o:t.element.style.left=o}onSplitterDragStop(t){if(null===this._splitterPosition)throw new M("ROCOSDS66932");{const e=this.getSplitItems(t),i=at(e.before.element.style[this._dimension]),n=at(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=rt(0),t.element.style.left=rt(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?ht(t,i):dt(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}}(zt||(zt={}));class Lt extends St{constructor(t,e,i){super(t,X.create(e),null,Lt.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;t<this.contentItems.length;t++)this._childElementContainer.appendChild(this.contentItems[t].element);super.init(),this.initContentItems()}}loadRoot(t){if(this.clearRoot(),void 0!==t){const e=this.layoutManager.createAndInitContentItem(t,this);this.addChild(e,0)}}clearRoot(){const t=this.contentItems;switch(t.length){case 0:return;case 1:return void t[0].remove();default:throw new z("GILR07721")}}addItem(t,e){this.layoutManager.checkMinimiseMaximisedStack();const i=K.resolve(t,!1);let n;if(n=this.contentItems.length>0?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=K.resolve(t,!1);if(e.maximised)throw new Error("Root Component cannot be maximised");{const t=new It(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,e=t.length,i=new Array(e);for(let n=0;n<e;n++){const e=t[n].toConfig();if(!q.isRootItemConfig(e))throw new z("RCCC66832");i[n]=e}return i}setSize(t,e){void 0===t||void 0===e?this.updateSize(!1):(ht(this.element,t),dt(this.element,e),this.contentItems.length>0&&(ht(this.contentItems[0].element,t),dt(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=Lt.Area.oppositeSides,e=new Array(Object.keys(t).length);let i=0;for(const n in t){const o=n,s=this.getElementArea();if(null===s)throw new M("RCSA77553");s.side=o,"2"===t[o][1]?s[o]=s[t[o]]-50:s[o]=s[t[o]]+50,s.surface=(s.x2-s.x1)*(s.y2-s.y1),e[i++]=s}return e}highlightDropZone(t,e,i){this.layoutManager.tabDropPlaceholder.remove(),super.highlightDropZone(t,e,i)}onDrop(t,e){if(t.isComponent){const e=Z.createDefault(),i=t;e.header=G.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===B.row||t.type===B.column){const e=Z.createDefault(),i=this.layoutManager.createContentItem(e,this);i.addChild(t),t=i}const i="x"==e.side[0]?B.row:B.column,n="2"==e.side[1],o=this.contentItems[0];if(o instanceof zt&&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=F.Percent,o.updateSize(!1)}else{const e=N.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=F.Percent,s.updateSize(!1)}}}dock(){throw new z("GID87731")}validateDocking(){throw new z("GIVD87732")}getAllContentItems(){const t=[this];return this.deepGetAllContentItems(this.contentItems,t),t}getConfigMaximisedItems(){const t=[];return this.deepFilterContentItems(this.contentItems,t,(t=>!(!bt.isStack(t)||!t.initialWantMaximise)||!(!bt.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}=ct(this._containerElement);ht(this.element,t),dt(this.element,e),this.contentItems.length>0&&(ht(this.contentItems[0].element,t),dt(this.contentItems[0].element,e))}deepGetAllContentItems(t,e){for(let i=0;i<t.length;i++){const n=t[i];e.push(n),this.deepGetAllContentItems(n.contentItems,e)}}deepFilterContentItems(t,e,i){for(let n=0;n<t.length;n++){const o=t[n];i(o)&&e.push(o),this.deepFilterContentItems(o.contentItems,e,i)}}}!function(t){(t.Area||(t.Area={})).oppositeSides={y2:"y1",x2:"x1",y1:"y2",x1:"x2"},t.createElement=function(t){const e=t.createElement("div");return e.classList.add("lm_goldenlayout"),e.classList.add("lm_item"),e.classList.add("lm_root"),e}}(Lt||(Lt={}));class Mt{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 Pt{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 P("TODSDLU10093");if(void 0===this._dragStartEvent)throw new P("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 P("TNC15007");this._closeEvent(this._componentItem)}notifyFocus(){if(void 0===this._focusEvent)throw new P("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 P("TDR87745");this._componentItem.off("destroy",this._contentItemDestroyListener),this._dragListener.off("dragStart",this._dragStartListener),this._dragListener=void 0}}class Tt{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;t<this._tabs.length;t++)this._tabs[t].destroy()}createTab(t,e){for(let e=0;e<this._tabs.length;e++)if(this._tabs[e].componentItem===t)return;const i=new Pt(this._layoutManager,t,(t=>this.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),e<this._element.childNodes.length?this._element.insertBefore(i.element,this._element.childNodes[e]):this._element.appendChild(i.element)}removeTab(t){for(let e=0;e<this._tabs.length;e++)if(this._tabs[e].componentItem===t){return this._tabs[e].destroy(),void this._tabs.splice(e,1)}throw new Error("contentItem is not controlled by this header")}processActiveComponentChanged(t){let e=-1;for(let i=0;i<this._tabs.length;i++){const n=this._tabs[i].componentItem===t;this._tabs[i].setActive(n),n&&(e=i)}if(e<0)throw new z("HSACI56632");if(this._layoutManager.layoutConfig.settings.reorderOnTabMenuClick&&-1!==this._lastVisibleTabIndex&&e>this._lastVisibleTabIndex){const t=this._tabs[e];for(let t=e;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;i<this._tabs.length;i++){const l=this._tabs[i].element;l.parentElement!==this._element&&this._element.appendChild(l);const h=at(getComputedStyle(a.element).marginRight);n+=l.offsetWidth+h;let d=0;if(r<=i)d=n;else{const t=at(getComputedStyle(a.element).marginRight);d=n+a.element.offsetWidth+t}if(d>e){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,t<s){for(let e=0;e<=i;e++){const n=e!==r&&0!==e?"-"+rt(t):"";this._tabs[e].element.style.zIndex=rt(i-e),this._tabs[e].element.style.marginLeft=n}this._lastVisibleTabIndex=i,l.parentElement!==this._element&&this._element.appendChild(l)}else o=!0}if(o&&i!==r){if(!t)return!1;l.style.zIndex="auto",l.style.marginLeft="",l.parentElement!==this._dropdownElement&&this._dropdownElement.appendChild(l)}}else this._lastVisibleTabIndex=i,l.style.zIndex="auto",l.style.marginLeft="",l.parentElement!==this._element&&this._element.appendChild(l)}}return!0}showAdditionalTabsDropdown(){this._dropdownElement.style.display=""}hideAdditionalTabsDropdown(){this._dropdownElement.style.display="none"}handleTabCloseEvent(t){this._componentRemoveEvent(t)}handleTabFocusEvent(t){this._componentFocusEvent(t)}handleTabDragStartEvent(t,e,i,n){this._componentDragStartEvent(t,e,i,n)}}class At extends Ct{constructor(t,e,i,n,o,s,r,a,l,h,d,c,m){super(),this._layoutManager=t,this._parent=e,this._configClosable=n,this._getActiveComponentItemEvent=o,this._popoutEvent=r,this._maximiseToggleEvent=a,this._clickEvent=l,this._touchStartEvent=h,this._componentRemoveEvent=d,this._componentFocusEvent=c,this._componentDragStartEvent=m,this._clickListener=t=>this.onClick(t),this._touchStartListener=t=>this.onTouchStart(t),this._rowColumnClosable=!0,this._closeButton=null,this._popoutButton=null,this._tabsContainer=new Tt(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 Mt(this,this._tabDropdownLabel,"lm_tabdropdown",(()=>this._tabsContainer.showAdditionalTabsDropdown()))),this._popoutEnabled&&(this._popoutButton=new Mt(this,this._popoutLabel,"lm_popout",(()=>this.handleButtonPopoutEvent()))),this._maximiseEnabled&&(this._maximiseButton=new Mt(this,this._maximiseLabel,"lm_maximise",(t=>this.handleButtonMaximiseToggleEvent(t)))),this._configClosable&&(this._closeButton=new Mt(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=[R.right,R.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;i<e;i++){if(!this._tabsContainer.tabs[i].componentItem.isClosable){t=!1;break}}}else t=!1;else t=!1;null!==this._closeButton&&mt(this._closeButton.element,t),null!==this._popoutButton&&mt(this._popoutButton.element,t),this._canRemoveComponent=t||this._tabsContainer.tabCount>1}applyFocusedValue(t){t?this._element.classList.add("lm_focused"):this._element.classList.remove("lm_focused")}processMaximised(){if(void 0===this._maximiseButton)throw new P("HPMAX16997");this._maximiseButton.element.setAttribute("title",this._minimiseLabel)}processMinimised(){if(void 0===this._maximiseButton)throw new P("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=rt(t)):(this._element.style.width="",this._element.style.height=rt(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 P("HHTCE22294");this._componentRemoveEvent(t)}}handleTabInitiatedComponentFocusEvent(t){if(void 0===this._componentFocusEvent)throw new P("HHTAE22294");this._componentFocusEvent(t)}handleTabInitiatedDragStartEvent(t,e,i,n){if(this._canRemoveComponent){if(void 0===this._componentDragStartEvent)throw new P("HHTDSE22294");this._componentDragStartEvent(t,e,i,n)}else i.cancelDrag()}processTabDropdownActiveChanged(){void 0!==this._tabDropdownButton&&mt(this._tabDropdownButton.element,this._tabsContainer.dropdownActive)}handleButtonPopoutEvent(){if(this._layoutManager.layoutConfig.settings.popoutWholeStack){if(void 0===this._popoutEvent)throw new P("HHBPOE17834");this._popoutEvent()}else{const t=this._getActiveComponentItemEvent();t&&t.popout()}}handleButtonMaximiseToggleEvent(t){if(void 0===this._maximiseToggleEvent)throw new P("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 P("HNHC46834");this._clickEvent(t)}notifyTouchStart(t){if(void 0===this._touchStartEvent)throw new P("HNHTS46834");this._touchStartEvent(t)}}class Dt extends St{constructor(t,e,i){var n,o,s,r,a,l,h,d,c,m,u,p,g,f,_,v,C,y,w;super(t,e,i,Dt.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,I=e.content;let S;if(1!==I.length)S=void 0;else{S=I[0].header}this._initialWantMaximise=e.maximised,this._initialActiveItemIndex=null!==(n=e.activeItemIndex)&&void 0!==n?n:0;const E=null!==(r=null!==(s=null===(o=this._headerConfig)||void 0===o?void 0:o.show)&&void 0!==s?s:null==S?void 0:S.show)&&void 0!==r?r:b.show,x=null!==(h=null!==(l=null===(a=this._headerConfig)||void 0===a?void 0:a.popout)&&void 0!==l?l:null==S?void 0:S.popout)&&void 0!==h?h:b.popout,z=null!==(m=null!==(c=null===(d=this._headerConfig)||void 0===d?void 0:d.maximise)&&void 0!==c?c:null==S?void 0:S.maximise)&&void 0!==m?m:b.maximise,L=null!==(g=null!==(p=null===(u=this._headerConfig)||void 0===u?void 0:u.close)&&void 0!==p?p:null==S?void 0:S.close)&&void 0!==g?g:b.close,M=null!==(v=null!==(_=null===(f=this._headerConfig)||void 0===f?void 0:f.minimise)&&void 0!==_?_:null==S?void 0:S.minimise)&&void 0!==v?v:b.minimise,P=null!==(w=null!==(y=null===(C=this._headerConfig)||void 0===C?void 0:C.tabDropdown)&&void 0!==y?y:null==S?void 0:S.tabDropdown)&&void 0!==w?w:b.tabDropdown;this._maximisedEnabled=!1!==z;const T={show:!1!==E,side:!1===E?R.top:E,popoutEnabled:!1!==x,popoutLabel:!1===x?"":x,maximiseEnabled:this._maximisedEnabled,maximiseLabel:!1===z?"":z,closeEnabled:!1!==L,closeLabel:!1===L?"":L,minimiseEnabled:!0,minimiseLabel:M,tabDropdownEnabled:!1!==P,tabDropdownLabel:!1===P?"":P};this._header=new At(t,this,T,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;t<this.contentItems.length;t++)this._childElementContainer.appendChild(this.contentItems[t].element);super.init();const t=this.contentItems,e=t.length;if(e>0){if(this._initialActiveItemIndex<0||this._initialActiveItemIndex>=e)throw new Error(`ActiveItemIndex out of range: ${this._initialActiveItemIndex} id: ${this.id}`);for(let i=0;i<e;i++){const e=t[i];if(!(e instanceof It))throw new Error(`Stack Content Item is not of type ComponentItem: ${i} id: ${this.id}`);this._header.createTab(e,i),e.hide(),e.container.setBaseLogicalZIndex()}this.setActiveComponentItem(t[this._initialActiveItemIndex],!1),this._header.updateTabSizes()}this._header.updateClosability(),this.initContentItems()}setActiveContentItem(t){if(!bt.isComponentItem(t))throw new Error("Stack.setActiveContentItem: item is not a ComponentItem");this.setActiveComponentItem(t,!1)}setActiveComponentItem(t,e,i=!1){if(this._activeComponentItem!==t){if(-1===this.contentItems.indexOf(t))throw new Error("componentItem is not a child of this stack");this.layoutManager.beginSizeInvalidation();try{void 0!==this._activeComponentItem&&this._activeComponentItem.hide(),this._activeComponentItem=t,this._header.processActiveComponentChanged(t),t.show()}finally{this.layoutManager.endSizeInvalidation()}this.emit("activeContentItemChanged",t),this.layoutManager.emit("activeContentItemChanged",t),this.emitStateChangedEvent()}(this.focused||e)&&this.layoutManager.setFocusedComponentItem(t,i)}getActiveContentItem(){var t;return null!==(t=this.getActiveComponentItem())&&void 0!==t?t:null}getActiveComponentItem(){return this._activeComponentItem}focusActiveContentItem(){var t;null===(t=this._activeComponentItem)||void 0===t||t.focus()}setFocusedValue(t){this._header.applyFocusedValue(t),super.setFocusedValue(t)}setRowColumnClosable(t){this._header.setRowColumnClosable(t)}newComponent(t,e,i,n){const o={type:"component",componentType:t,componentState:e,title:i};return this.newItem(o,n)}addComponent(t,e,i,n){const o={type:"component",componentType:t,componentState:e,title:i};return this.addItem(o,n)}newItem(t,e){return e=this.addItem(t,e),this.contentItems[e]}addItem(t,e){this.layoutManager.checkMinimiseMaximisedStack();const i=K.resolve(t,!1),n=this.layoutManager.createAndInitContentItem(i,this);return this.addChild(n,e)}addChild(t,e,i=!1){if(void 0!==e&&e>this.contentItems.length)throw e-=1,new z("SAC99728");if(t instanceof It)return e=super.addChild(t,e),this._childElementContainer.appendChild(t.element),this._header.createTab(t,e),this.setActiveComponentItem(t,i),this._header.updateTabSizes(),this.updateSize(!1),t.container.setBaseLogicalZIndex(),this._header.updateClosability(),this.emitStateChangedEvent(),e;throw new z("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,e=t.length;for(let i=0;i<e;i++){const e=t[i];if(!(e instanceof It))throw new z("SMAXI87773");e.enterStackMaximised()}this.emitStateChangedEvent()}}minimise(){if(this.isMaximised){this.layoutManager.setMaximisedStack(void 0);const t=this.contentItems,e=t.length;for(let i=0;i<e;i++){const e=t[i];if(!(e instanceof It))throw new z("SMINI87773");e.exitStackMaximised()}this.emitStateChangedEvent()}}destroy(){var t;(null===(t=this._activeComponentItem)||void 0===t?void 0:t.focused)&&this._activeComponentItem.blur(),super.destroy(),this.off("resize",this._resizeListener),this._maximisedEnabled&&(this.off("maximised",this._maximisedListener),this.off("minimised",this._minimisedListener)),this._header.destroy()}toConfig(){let t;if(this._activeComponentItem&&(t=this.contentItems.indexOf(this._activeComponentItem),t<0))throw new Error("active component item not found in stack");if(this.contentItems.length>0&&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 P("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,o="top"===this._dropSegment||"left"===this._dropSegment,s=i&&this.stackParent.isColumn||n&&this.stackParent.isRow;if(t.isComponent){const e=Z.createDefault();e.header=this.createHeaderConfig();const i=this.layoutManager.createAndInitContentItem(e,this);i.addChild(t),t=i}if(t.type===B.row||t.type===B.column){const e=Z.createDefault();e.header=this.createHeaderConfig();const i=this.layoutManager.createContentItem(e,this);i.addChild(t),t=i}if(s){const e=this.stackParent.contentItems.indexOf(this);this.stackParent.addChild(t,o?e:e+1,!0),this.size*=.5,t.size=this.size,t.sizeUnit=this.sizeUnit,this.stackParent.updateSize(!1)}else{const e=i?B.column:B.row,n=N.createDefault(e),s=this.layoutManager.createContentItem(n,this);this.stackParent.replaceChild(this,s),s.addChild(t,o?0:void 0,!0),s.addChild(this,o?void 0:0,!0),this.size=50,t.size=50,t.sizeUnit=F.Percent,s.updateSize(!1)}}highlightDropZone(t,e){for(const i in this._contentAreaDimensions){const n=i,o=this._contentAreaDimensions[n].hoverArea;if(o.x1<t&&o.x2>t&&o.y1<e&&o.y2>e)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 M("SGAHC13086");const i=e.x2-e.x1,n=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*n},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y1+.5*n}},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*n,x2:e.x1+.75*i,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1+.5*n,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=ct(this.element);if(this._header.show){t[this._header.leftRightSided?k.width:k.height]-=this.layoutManager.layoutConfig.dimensions.headerHeight}this._childElementContainer.style.width=rt(t.width),this._childElementContainer.style.height=rt(t.height);for(let e=0;e<this.contentItems.length;e++)this.contentItems[e].element.style.width=rt(t.width),this.contentItems[e].element.style.height=rt(t.height);this.emit("resize"),this.emitStateChangedEvent()}}highlightHeaderDropZone(t){const e=this._header.lastVisibleTabIndex+1,i=this._header.tabsContainerElement.childNodes,n=new Array(e);let o=0,s=0;for(;s<e;){const t=i[o++];t!==this.layoutManager.tabDropPlaceholder&&(n[s++]=t)}const r=this.layoutManager.dropTargetIndicator;if(null===r)throw new M("SHHDZDTI97110");let a;if(0===e){const t=this._header.element.getBoundingClientRect(),e=t.top+document.body.scrollTop,i=t.left+document.body.scrollLeft;a={x1:i,x2:i+100,y1:e+t.height-20,y2:e+t.height},this._dropIndex=0}else{let i,o,s,r,l=0,h=!1;do{r=n[l];const e=r.getBoundingClientRect(),a=e.top+document.body.scrollTop,d=e.left+document.body.scrollLeft;this._header.leftRightSided?(o=a,i=d,s=e.height):(o=d,i=a,s=e.width),t>=o&&t<o+s?h=!0:l++}while(l<e&&!h);if(!1===h&&t<o)return;t<o+s/2?(this._dropIndex=l,r.insertAdjacentElement("beforebegin",this.layoutManager.tabDropPlaceholder)):(this._dropIndex=Math.min(l+1,e),r.insertAdjacentElement("afterend",this.layoutManager.tabDropPlaceholder));const d=this.layoutManager.tabDropPlaceholder.getBoundingClientRect(),c=d.top+document.body.scrollTop,m=d.left+document.body.scrollLeft,u=d.width;if(this._header.leftRightSided){const t=c;a={x1:i,x2:i+r.clientHeight,y1:t,y2:t+u}}else{a={x1:m,x2:m+u,y1:i,y2:i+r.clientHeight}}}r.highlightArea(a,0)}resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}setupHeaderPosition(){mt(this._header.element,this._header.show),this.element.classList.remove("lm_left","lm_right","lm_bottom"),this._header.leftRightSided&&this.element.classList.add("lm_"+this._header.side),this.updateSize(!1)}highlightBodyDropZone(t){if(void 0===this._contentAreaDimensions)throw new P("SHBDZC82265");{const e=this._contentAreaDimensions[t].highlightArea,i=this.layoutManager.dropTargetIndicator;if(null===i)throw new M("SHBDZD96110");i.highlightArea(e,1),this._dropSegment=t}}handleResize(){
|
1
|
+
"use strict";var t=require("./main-aa066a34.js"),e=require("uuid");require("buffer/"),require("events"),require("lodash/cloneDeep"),require("lodash/isEqual");var i={},n={};Object.defineProperty(n,"__esModule",{value:!0}),n.mapValuesAsync=n.mapEntriesAsync=void 0;const o=(t,[e,i])=>({...t,[e]:i});async function s(t,e){return(await Promise.all(e.map((async([e,i])=>[e,await t(i,e)])))).reduce(o,{})}n.mapEntriesAsync=s,n.mapValuesAsync=async function(t,e){let i;return i=e instanceof Map?[...e.entries()]:Object.entries(e),s(t,i)};var r,a,l,h,d=t.commonjsGlobal&&t.commonjsGlobal.__classPrivateFieldSet||function(t,e,i,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(t,i):o?o.value=i:e.set(t,i),i},c=t.commonjsGlobal&&t.commonjsGlobal.__classPrivateFieldGet||function(t,e,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)};Object.defineProperty(i,"__esModule",{value:!0});var m=i.DefaultLayoutManager=void 0;const u=n;class p{constructor(t){a.set(this,void 0),l.set(this,new Map),d(this,a,t,"f")}size(){return c(this,l,"f").size}async applyLayoutSnapshot({layouts:t}){if(Object.keys(t).length>1)throw new Error("[LayoutManager] Tried to call applyLayoutSnapshot with more than 1 layout. When implementing multiple layouts via overridden LayoutManager class, you must override and fully implement the applyLayoutSnapshot method without calling super.applyLayoutSnapshot().");const[[e,i]]=Object.entries(t);await p.createLayout(this,{layoutName:e,layout:i})}async showLayout({layoutName:t}){}async getLayoutSnapshot(){return{layouts:await(0,u.mapValuesAsync)((t=>t.getFrameSnapshot()),c(this,l,"f"))}}async removeLayout({layoutName:t}){}getLayoutIdentityForView(t){const e=[...c(this,l,"f").values()].find((e=>e.getCurrentViews().some((e=>e.name===t.name&&e.uuid===t.uuid))));return e?.identity??void 0}isLayoutVisible({layoutName:t}){return c(p,r,"m",h).call(p,this,t).isVisible()}resolveLayoutIdentity(t){if(t&&"layoutName"in t)return t;const e=[...c(this,l,"f").values()];if(1===e.length)return e[0].identity;const i=e.find((t=>t.isVisible()));return i?.identity??void 0}static async resolveLayout(t,e){const i=t.resolveLayoutIdentity(e);if(void 0===i||!("layoutName"in i))throw new Error("[layout-manager] resolveLayout: Could not resolve the layout identity. Make sure you include 'layoutName' in the identity object.");return c(p,r,"m",h).call(p,t,i.layoutName)}static async handleSharedView(t,e,i){await(0,u.mapValuesAsync)((async t=>{if(t.identity.layoutName!==e.layoutName){const e=t.getCurrentViews().find((t=>t.name===i.name));e&&await t.onViewDetached({viewIdentity:e,target:null}).catch(console.error)}}),c(t,l,"f"))}static async handleLastViewRemoved(t,e){await t.removeLayout(e),await c(t,a,"f").handleLastViewRemoved(t)}static async destroyLayout(t,{layoutName:e}){await c(p,r,"m",h).call(p,t,e).destroy(),c(t,l,"f").delete(e)}static async createLayout(t,e){const{layoutName:i}=e;if(c(t,l,"f").has(i))throw new Error(`Layout name ${i} already exists`);await c(t,a,"f").createLayout(e,t)}static registerLayout(t,e,i){c(t,l,"f").set(e,i)}static getAllLayouts(t){return[...c(t,l,"f").values()]}static setInitialSnapshot(t,e){c(t,a,"f").setInitialSnapshot(e)}static createClosedConstructor(...t){return class extends p{constructor(){super(...t)}}}}m=i.DefaultLayoutManager=p,r=p,a=new WeakMap,l=new WeakMap,h=function(t,e){const i=c(t,l,"f").get(e);if(!i)throw new Error(`[layout-manager] getLayoutByName: Could not locate layout with name '${e}'`);return i};var g={};Object.defineProperty(g,"__esModule",{value:!0});var f=g.BaseLayout=void 0;f=g.BaseLayout=class{};var _={};Object.defineProperty(_,"__esModule",{value:!0});var v=_.DOMEmitter=void 0;v=_.DOMEmitter=class{constructor(t){this.container=t}dispatchLocalEvent(t,e){const i={...e,type:t,tabSelector:`tab-${e.name}`,containerSelector:`container-${e.name}`,topic:"openfin-DOM-event"};this.container.dispatchEvent(new CustomEvent(t,{detail:i}))}};var C={};Object.defineProperty(C,"__esModule",{value:!0});var y=C.isVisible=void 0;y=C.isVisible=t=>(0!==t.offsetWidth||0!==t.offsetHeight)&&"hidden"!==window.getComputedStyle(t).visibility&&t.offsetTop>=0&&t.offsetLeft>=0&&t.offsetTop<=window.innerHeight&&t.offsetLeft<=window.innerWidth;class w extends Error{constructor(t,e){super(e),this.type=t}}class b extends w{constructor(t,e){super("Configuration",t),this.node=e}}class I extends w{constructor(t){super("PopoutBlocked",t)}}class S extends w{constructor(t){super("API",t)}}class E extends w{constructor(t){super("Bind",t)}}class x extends Error{constructor(t,e,i){super(`${t}: ${e}${void 0===i?"":": "+i}`)}}class z extends x{constructor(t,e){super("Assert",t,e)}}class L extends x{constructor(t,e,i){super("UnreachableCase",t,`${e}${void 0===i?"":": "+i}`)}}class M extends x{constructor(t,e){super("UnexpectedNull",t,e)}}class P extends x{constructor(t,e){super("UnexpectedUndefined",t,e)}}var T;!function(t){let e=!1;const i={PopoutCannotBeCreatedWithGroundItemConfig:{id:0,default:"Popout cannot be created with ground ItemConfig"},PleaseRegisterAConstructorFunction:{id:1,default:"Please register a constructor function"},ComponentTypeNotRegisteredAndBindComponentEventHandlerNotAssigned:{id:2,default:"Component type not registered and BindComponentEvent handler not assigned"},ComponentIsAlreadyRegistered:{id:3,default:"Component is already registered"},ComponentIsNotVirtuable:{id:4,default:"Component is not virtuable. Requires rootHtmlElement field/getter"},VirtualComponentDoesNotHaveRootHtmlElement:{id:5,default:'Virtual component does not have getter "rootHtmlElement"'},ItemConfigIsNotTypeComponent:{id:6,default:"ItemConfig is not of type component"},InvalidNumberPartInSizeString:{id:7,default:"Invalid number part in size string"},UnknownUnitInSizeString:{id:8,default:"Unknown unit in size string"},UnsupportedUnitInSizeString:{id:9,default:"Unsupported unit in size string"}};t.idCount=Object.keys(i).length;const n=Object.values(i);t.checkInitialise=function(){if(!e)for(let e=0;e<t.idCount;e++){const t=n[e];if(t.id!==e)throw new z("INSI00110",`${e}: ${t.id}`);A[e]=t.default}e=!0}}(T||(T={}));const A=new Array(T.idCount);var D,k,R,U;!function(t){t.defaultComponentBaseZIndex="auto",t.defaultComponentDragZIndex="32",t.defaultComponentStackMaximisedZIndex="41"}(D||(D={})),function(t){t.width="width",t.height="height"}(k||(k={})),function(t){t.top="top",t.left="left",t.right="right",t.bottom="bottom"}(R||(R={})),function(t){t.base="base",t.drag="drag",t.stackMaximised="stackMaximised"}(U||(U={}));const H={base:D.defaultComponentBaseZIndex,drag:D.defaultComponentDragZIndex,stackMaximised:D.defaultComponentStackMaximisedZIndex};var W,B,O,F,V,N,G,Z,$,j,q,X,Y,J,K,Q,tt,et,it,nt,ot,st;function rt(t){return t.toString(10)+"px"}function at(t){const e=t.replace("px","");return parseFloat(e)}function lt(t){return t>="0"&&t<="9"}function ht(t,e){const i=rt(e);t.style.width=i}function dt(t,e){const i=rt(e);t.style.height=i}function ct(t){return{width:t.offsetWidth,height:t.offsetHeight}}function mt(t,e){t.style.display=e?"":"none"}function ut(t,e){if(void 0!==e)for(const i in e)if(e.hasOwnProperty(i)){const n=e[i],o=t[i];t[i]=pt(o,n)}return t}function pt(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<t;n++){const t=e[n];i[n]=pt({},t)}return i}if(null===e)return null;{const i=e;if(void 0===t)return ut({},i);if("object"!=typeof t)return ut({},i);if(Array.isArray(t))return ut({},i);if(null===t)return ut({},i);return ut(t,i)}}function gt(){return(1e15*Math.random()).toString(36).replace(".","")}function ft(t,e){const{numericPart:i,firstNonNumericCharPart:n}=function(t){const e=(t=t.trimStart()).length;if(0===e)return{numericPart:"",firstNonNumericCharPart:""};{let i=e,n=!1;for(let o=0;o<e;o++){const e=t[o];if(!lt(e)){if("."!==e){i=o;break}if(n){i=o;break}n=!0}}return{numericPart:t.substring(0,i),firstNonNumericCharPart:t.substring(i).trim()}}}(t),o=Number.parseInt(i,10);if(isNaN(o))throw new b(`${A[7]}: ${t}`);{const i=F.tryParse(n);if(void 0===i)throw new b(`${A[8]}: ${t}`);if(e.includes(i))return{size:o,sizeUnit:i};throw new b(`${A[9]}: ${t}`)}}function _t(t,e){return t.toString(10)+F.format(e)}function vt(t,e){return void 0===t?void 0:t.toString(10)+F.format(e)}!function(t){function e(t){return!Array.isArray(t)&&null!==t&&"object"==typeof t}t.isJson=function(t){return e(t)},t.isJsonObject=e}(W||(W={})),function(t){t.ground="ground",t.row="row",t.column="column",t.stack="stack",t.component="component"}(B||(B={})),function(t){t.none="none",t.always="always",t.onload="onload"}(O||(O={})),function(t){t.Pixel="px",t.Percent="%",t.Fractional="fr",t.Em="em"}(F||(F={})),function(t){t.tryParse=function(e){switch(e){case t.Pixel:return t.Pixel;case t.Percent:return t.Percent;case t.Fractional:return t.Fractional;case t.Em:return t.Em;default:return}},t.format=function(e){switch(e){case t.Pixel:return t.Pixel;case t.Percent:return t.Percent;case t.Fractional:return t.Fractional;case t.Em:return t.Em;default:throw new L("SUEF44998",e)}}}(F||(F={})),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;s<i;s++){const i=t[s];n[s]=o(i,e)}return n}(t,e):n(t,e):e?function(t){if("string"==typeof t&&1===t.length)return"___"+t;const e=function(t){for(let e=0;e<i.length;e++)if(i[e]===t)return e;return-1}(t);return-1===e?t:e.toString(36)}(t):function(t){if("string"==typeof t&&1===t.length)return i[parseInt(t,36)];if("string"==typeof t&&"___"===t.substr(0,3))return t[3];return t}(t)}function s(t){if("string"==typeof t&&1===t.length)return"___"+t;const i=function(t){for(let i=0;i<e.length;i++)if(e[i]===t)return i;return-1}(t);return-1===i?t:i.toString(36)}function r(t){return 1===t.length?e[parseInt(t,36)]:"___"===t.substr(0,3)?t[3]:t}t.checkInitialise=function(){if(e.length>36)throw new Error("Too many keys in config minifier map")},t.translateObject=n}(V||(V={})),function(t){t.defaults={type:B.ground,content:[],size:1,sizeUnit:F.Fractional,minSize:void 0,minSizeUnit:F.Pixel,id:"",isClosable:!0},t.createCopy=function(t,e){switch(t.type){case B.ground:case B.row:case B.column:return j.createCopy(t,e);case B.stack:return Z.createCopy(t,e);case B.component:return $.createCopy(t);default:throw new L("CICC91354",t.type,"Invalid Config Item type specified")}},t.createDefault=function(t){switch(t){case B.ground:throw new z("CICCDR91562");case B.row:case B.column:return j.createDefault(t);case B.stack:return Z.createDefault();case B.component:return $.createDefault();default:throw new L("CICCDD91563",t,"Invalid Config Item type specified")}},t.isComponentItem=function(t){return t.type===B.component},t.isStackItem=function(t){return t.type===B.stack},t.isGroundItem=function(t){return t.type===B.ground}}(N||(N={})),function(t){t.defaultMaximised=!1,function(t){t.createCopy=function(t,e){return void 0===t?void 0:{show:null!=e?e:t.show,popout:t.popout,close:t.close,maximise:t.maximise,minimise:t.minimise,tabDropdown:t.tabDropdown}}}(t.Header||(t.Header={}))}(G||(G={})),function(t){function e(t){const e=t.length,i=new Array(e);for(let n=0;n<e;n++)i[n]=N.createCopy(t[n]);return i}t.defaultActiveItemIndex=0,t.createCopy=function(t,i){return{type:t.type,content:e(void 0!==i?i:t.content),size:t.size,sizeUnit:t.sizeUnit,minSize:t.minSize,minSizeUnit:t.minSizeUnit,id:t.id,maximised:t.maximised,isClosable:t.isClosable,activeItemIndex:t.activeItemIndex,header:G.Header.createCopy(t.header)}},t.copyContent=e,t.createDefault=function(){return{type:B.stack,content:[],size:N.defaults.size,sizeUnit:N.defaults.sizeUnit,minSize:N.defaults.minSize,minSizeUnit:N.defaults.minSizeUnit,id:N.defaults.id,maximised:G.defaultMaximised,isClosable:N.defaults.isClosable,activeItemIndex:t.defaultActiveItemIndex,header:void 0}}}(Z||(Z={})),function(t){t.defaultReorderEnabled=!0,t.resolveComponentTypeName=function(t){const e=t.componentType;return"string"==typeof e?e:void 0},t.createCopy=function(t){return{type:t.type,content:[],size:t.size,sizeUnit:t.sizeUnit,minSize:t.minSize,minSizeUnit:t.minSizeUnit,id:t.id,maximised:t.maximised,isClosable:t.isClosable,reorderEnabled:t.reorderEnabled,title:t.title,header:G.Header.createCopy(t.header),componentType:t.componentType,componentState:pt(void 0,t.componentState)}},t.createDefault=function(e="",i,n=""){return{type:B.component,content:[],size:N.defaults.size,sizeUnit:N.defaults.sizeUnit,minSize:N.defaults.minSize,minSizeUnit:N.defaults.minSizeUnit,id:N.defaults.id,maximised:G.defaultMaximised,isClosable:N.defaults.isClosable,reorderEnabled:t.defaultReorderEnabled,title:n,header:void 0,componentType:e,componentState:i}},t.copyComponentType=function(t){return pt({},t)}}($||($={})),function(t){function e(t){const e=t.length,i=new Array(e);for(let n=0;n<e;n++)i[n]=N.createCopy(t[n]);return i}t.isChildItemConfig=function(t){switch(t.type){case B.row:case B.column:case B.stack:case B.component:return!0;case B.ground:return!1;default:throw new L("CROCOSPCICIC13687",t.type)}},t.createCopy=function(t,i){return{type:t.type,content:e(void 0!==i?i:t.content),size:t.size,sizeUnit:t.sizeUnit,minSize:t.minSize,minSizeUnit:t.minSizeUnit,id:t.id,isClosable:t.isClosable}},t.copyContent=e,t.createDefault=function(t){return{type:t,content:[],size:N.defaults.size,sizeUnit:N.defaults.sizeUnit,minSize:N.defaults.minSize,minSizeUnit:N.defaults.minSizeUnit,id:N.defaults.id,isClosable:N.defaults.isClosable}}}(j||(j={})),function(t){t.createCopy=function(t){return N.createCopy(t)},t.isRootItemConfig=function(t){switch(t.type){case B.row:case B.column:case B.stack:case B.component:return!0;case B.ground:return!1;default:throw new L("CROCOSPCICIC13687",t.type)}}}(q||(q={})),function(t){t.create=function(t){const e=void 0===t?[]:[t];return{type:B.ground,content:e,size:100,sizeUnit:F.Percent,minSize:0,minSizeUnit:F.Pixel,id:"",isClosable:!1,title:"",reorderEnabled:!1}}}(X||(X={})),function(t){var e,i;function n(t){return"parentId"in t}(e=t.Settings||(t.Settings={})).defaults={constrainDragToContainer:!0,reorderEnabled:!0,popoutWholeStack:!1,blockedPopoutsThrowError:!0,closePopoutsOnUnload:!0,responsiveMode:O.none,tabOverlapAllowance:0,reorderOnTabMenuClick:!0,tabControlOffset:10,popInOnClose:!1},e.createCopy=function(t){return{constrainDragToContainer:t.constrainDragToContainer,reorderEnabled:t.reorderEnabled,popoutWholeStack:t.popoutWholeStack,blockedPopoutsThrowError:t.blockedPopoutsThrowError,closePopoutsOnUnload:t.closePopoutsOnUnload,responsiveMode:t.responsiveMode,tabOverlapAllowance:t.tabOverlapAllowance,reorderOnTabMenuClick:t.reorderOnTabMenuClick,tabControlOffset:t.tabControlOffset,popInOnClose:t.popInOnClose}},(i=t.Dimensions||(t.Dimensions={})).createCopy=function(t){return{borderWidth:t.borderWidth,borderGrabWidth:t.borderGrabWidth,defaultMinItemHeight:t.defaultMinItemHeight,defaultMinItemHeightUnit:t.defaultMinItemHeightUnit,defaultMinItemWidth:t.defaultMinItemWidth,defaultMinItemWidthUnit:t.defaultMinItemWidthUnit,headerHeight:t.headerHeight,dragProxyWidth:t.dragProxyWidth,dragProxyHeight:t.dragProxyHeight}},i.defaults={borderWidth:5,borderGrabWidth:5,defaultMinItemHeight:0,defaultMinItemHeightUnit:F.Pixel,defaultMinItemWidth:10,defaultMinItemWidthUnit:F.Pixel,headerHeight:20,dragProxyWidth:300,dragProxyHeight:200},function(t){t.createCopy=function(t){return{show:t.show,popout:t.popout,dock:t.dock,close:t.close,maximise:t.maximise,minimise:t.minimise,tabDropdown:t.tabDropdown}},t.defaults={show:R.top,popout:"open in new window",dock:"dock",maximise:"maximise",minimise:"minimise",close:"close",tabDropdown:"additional tabs"}}(t.Header||(t.Header={})),t.isPopout=n,t.createDefault=function(){return{root:void 0,openPopouts:[],dimensions:t.Dimensions.defaults,settings:t.Settings.defaults,header:t.Header.defaults,resolved:!0}},t.createCopy=function(e){return n(e)?J.createCopy(e):{root:void 0===e.root?void 0:q.createCopy(e.root),openPopouts:t.copyOpenPopouts(e.openPopouts),settings:t.Settings.createCopy(e.settings),dimensions:t.Dimensions.createCopy(e.dimensions),header:t.Header.createCopy(e.header),resolved:e.resolved}},t.copyOpenPopouts=function(t){const e=t.length,i=new Array(e);for(let n=0;n<e;n++)i[n]=J.createCopy(t[n]);return i},t.minifyConfig=function(t){return V.translateObject(t,!0)},t.unminifyConfig=function(t){return V.translateObject(t,!1)}}(Y||(Y={})),function(t){var e;(e=t.Window||(t.Window={})).createCopy=function(t){return{width:t.width,height:t.height,left:t.left,top:t.top}},e.defaults={width:null,height:null,left:null,top:null},t.createCopy=function(e){return{root:void 0===e.root?void 0:q.createCopy(e.root),openPopouts:Y.copyOpenPopouts(e.openPopouts),settings:Y.Settings.createCopy(e.settings),dimensions:Y.Dimensions.createCopy(e.dimensions),header:Y.Header.createCopy(e.header),parentId:e.parentId,indexInParent:e.indexInParent,window:t.Window.createCopy(e.window),resolved:e.resolved}}}(J||(J={})),function(t){t.resolve=function(t,e){switch(t.type){case B.ground:throw new b("ItemConfig cannot specify type ground",JSON.stringify(t));case B.row:case B.column:return it.resolve(t,e);case B.stack:return tt.resolve(t,e);case B.component:return et.resolve(t,e);default:throw new L("UCUICR55499",t.type)}},t.resolveContent=function(e){if(void 0===e)return[];{const i=e.length,n=new Array(i);for(let o=0;o<i;o++)n[o]=t.resolve(e[o],!1);return n}},t.resolveId=function(t){return void 0===t?N.defaults.id:Array.isArray(t)?0===t.length?N.defaults.id:t[0]:t},t.resolveSize=function(t,e,i,n){if(void 0!==t)return ft(t,[F.Percent,F.Fractional]);if(void 0!==e||void 0!==i){if(void 0!==e)return{size:e,sizeUnit:F.Percent};if(void 0!==i)return{size:i,sizeUnit:F.Percent};throw new P("CRS33390")}return n?{size:50,sizeUnit:F.Percent}:{size:N.defaults.size,sizeUnit:N.defaults.sizeUnit}},t.resolveMinSize=function(t,e,i){if(void 0!==t)return ft(t,[F.Pixel]);{const t=void 0!==e;return t||void 0!==i?t?{size:e,sizeUnit:F.Pixel}:{size:i,sizeUnit:F.Pixel}:{size:N.defaults.minSize,sizeUnit:N.defaults.minSizeUnit}}},t.calculateSizeWidthHeightSpecificationType=function(t){return void 0!==t.size?1:void 0!==t.width||void 0!==t.height?2:0},t.isGround=function(t){return t.type===B.ground},t.isRow=function(t){return t.type===B.row},t.isColumn=function(t){return t.type===B.column},t.isStack=function(t){return t.type===B.stack},t.isComponent=function(t){return t.type===B.component}}(K||(K={})),function(t){!function(t){t.resolve=function(t,e){var i;if(void 0!==t||void 0!==e){return{show:null!==(i=null==t?void 0:t.show)&&void 0!==i?i:void 0===e?void 0:!!e&&Y.Header.defaults.show,popout:null==t?void 0:t.popout,maximise:null==t?void 0:t.maximise,close:null==t?void 0:t.close,minimise:null==t?void 0:t.minimise,tabDropdown:null==t?void 0:t.tabDropdown}}}}(t.Header||(t.Header={})),t.resolveIdAndMaximised=function(t){let e,i,n=t.id,o=!1;if(void 0===n)e=N.defaults.id;else if(Array.isArray(n)){const t=n.findIndex((t=>"__glMaximised"===t));t>0&&(o=!0,n=n.splice(t,1)),e=n.length>0?n[0]:N.defaults.id}else e=n;return i=void 0!==t.maximised?t.maximised:o,{id:e,maximised:i}}}(Q||(Q={})),function(t){function e(t){if(void 0===t)return[];{const e=t.length,i=new Array(e);for(let n=0;n<e;n++){const e=t[n],o=K.resolve(e,!1);if(!N.isComponentItem(o))throw new z("UCUSICRC91114",JSON.stringify(o));i[n]=o}return i}}function i(t){const e=t.length,i=new Array(e);for(let n=0;n<e;n++){const e=t[n];i[n]=et.fromResolved(e)}return i}t.resolve=function(t,i){var n,o;const{id:s,maximised:r}=Q.resolveIdAndMaximised(t),{size:a,sizeUnit:l}=K.resolveSize(t.size,t.width,t.height,i),{size:h,sizeUnit:d}=K.resolveMinSize(t.minSize,t.minWidth,t.minHeight);return{type:B.stack,content:e(t.content),size:a,sizeUnit:l,minSize:h,minSizeUnit:d,id:s,maximised:r,isClosable:null!==(n=t.isClosable)&&void 0!==n?n:N.defaults.isClosable,activeItemIndex:null!==(o=t.activeItemIndex)&&void 0!==o?o:Z.defaultActiveItemIndex,header:Q.Header.resolve(t.header,t.hasHeaders)}},t.fromResolved=function(t){return{type:B.stack,content:i(t.content),size:_t(t.size,t.sizeUnit),minSize:vt(t.minSize,t.minSizeUnit),id:t.id,maximised:t.maximised,isClosable:t.isClosable,activeItemIndex:t.activeItemIndex,header:G.Header.createCopy(t.header)}}}(tt||(tt={})),function(t){t.resolve=function(e,i){var n,o,s;let r=e.componentType;if(void 0===r&&(r=e.componentName),void 0===r)throw new Error("ComponentItemConfig.componentType is undefined");{const{id:a,maximised:l}=Q.resolveIdAndMaximised(e);let h;h=void 0===e.title||""===e.title?t.componentTypeToTitle(r):e.title;const{size:d,sizeUnit:c}=K.resolveSize(e.size,e.width,e.height,i),{size:m,sizeUnit:u}=K.resolveMinSize(e.minSize,e.minWidth,e.minHeight);return{type:e.type,content:[],size:d,sizeUnit:c,minSize:m,minSizeUnit:u,id:a,maximised:l,isClosable:null!==(n=e.isClosable)&&void 0!==n?n:N.defaults.isClosable,reorderEnabled:null!==(o=e.reorderEnabled)&&void 0!==o?o:$.defaultReorderEnabled,title:h,header:Q.Header.resolve(e.header,e.hasHeaders),componentType:r,componentState:null!==(s=e.componentState)&&void 0!==s?s:{}}}},t.fromResolved=function(t){return{type:B.component,size:_t(t.size,t.sizeUnit),minSize:vt(t.minSize,t.minSizeUnit),id:t.id,maximised:t.maximised,isClosable:t.isClosable,reorderEnabled:t.reorderEnabled,title:t.title,header:G.Header.createCopy(t.header),componentType:t.componentType,componentState:pt(void 0,t.componentState)}},t.componentTypeToTitle=function(t){switch(typeof t){case"string":return t;case"number":case"boolean":return t.toString();default:return""}}}(et||(et={})),function(t){function e(e){const i=e.length,n=new Array(i);for(let o=0;o<i;o++){const i=e[o],s=i.type;let r;switch(s){case B.row:case B.column:r=t.fromResolved(i);break;case B.stack:r=tt.fromResolved(i);break;case B.component:r=et.fromResolved(i);break;default:throw new L("ROCICFRC44797",s)}n[o]=r}return n}t.isChildItemConfig=function(t){switch(t.type){case B.row:case B.column:case B.stack:case B.component:return!0;case B.ground:return!1;default:throw new L("UROCOSPCICIC13687",t.type)}},t.resolve=function(e,i){var n;const{size:o,sizeUnit:s}=K.resolveSize(e.size,e.width,e.height,i),{size:r,sizeUnit:a}=K.resolveMinSize(e.minSize,e.minWidth,e.minHeight);return{type:e.type,content:t.resolveContent(e.content),size:o,sizeUnit:s,minSize:r,minSizeUnit:a,id:K.resolveId(e.id),isClosable:null!==(n=e.isClosable)&&void 0!==n?n:N.defaults.isClosable}},t.fromResolved=function(t){return{type:t.type,content:e(t.content),size:_t(t.size,t.sizeUnit),minSize:vt(t.minSize,t.minSizeUnit),id:t.id,isClosable:t.isClosable}},t.resolveContent=function(e){if(void 0===e)return[];{const i=e.length,n=new Array(i);let o,s=!1,r=!1;for(let o=0;o<i;o++){const i=e[o];if(!t.isChildItemConfig(i))throw new b("ItemConfig is not Row, Column or Stack",i);if(!r){const t=K.calculateSizeWidthHeightSpecificationType(i);switch(t){case 0:break;case 2:s=!0;break;case 1:r=!0;break;default:throw new L("ROCICRC87556",t)}}n[o]=i}o=!r&&!!s;const a=new Array(i);for(let t=0;t<i;t++){const e=n[t],i=K.resolve(e,o);if(!j.isChildItemConfig(i))throw new z("UROCOSPIC99512",JSON.stringify(i));a[t]=i}return a}}}(it||(it={})),function(t){t.isRootItemConfig=function(t){switch(t.type){case B.row:case B.column:case B.stack:case B.component:return!0;case B.ground:return!1;default:throw new L("URICIR23687",t.type)}},t.resolve=function(t){if(void 0!==t){const e=K.resolve(t,!1);if(q.isRootItemConfig(e))return e;throw new b("ItemConfig is not Row, Column or Stack",JSON.stringify(t))}},t.fromResolvedOrUndefined=function(t){if(void 0!==t){const e=t.type;switch(e){case B.row:case B.column:return it.fromResolved(t);case B.stack:return tt.fromResolved(t);case B.component:return et.fromResolved(t);default:throw new L("RICFROU89921",e)}}}}(nt||(nt={})),function(t){var e;function i(t){return"parentId"in t||"indexInParent"in t||"window"in t}(t.Settings||(t.Settings={})).resolve=function(t){var e,i,n,o,s,r,a,l,h,d;return{constrainDragToContainer:null!==(e=null==t?void 0:t.constrainDragToContainer)&&void 0!==e?e:Y.Settings.defaults.constrainDragToContainer,reorderEnabled:null!==(i=null==t?void 0:t.reorderEnabled)&&void 0!==i?i:Y.Settings.defaults.reorderEnabled,popoutWholeStack:null!==(n=null==t?void 0:t.popoutWholeStack)&&void 0!==n?n:Y.Settings.defaults.popoutWholeStack,blockedPopoutsThrowError:null!==(o=null==t?void 0:t.blockedPopoutsThrowError)&&void 0!==o?o:Y.Settings.defaults.blockedPopoutsThrowError,closePopoutsOnUnload:null!==(s=null==t?void 0:t.closePopoutsOnUnload)&&void 0!==s?s:Y.Settings.defaults.closePopoutsOnUnload,responsiveMode:null!==(r=null==t?void 0:t.responsiveMode)&&void 0!==r?r:Y.Settings.defaults.responsiveMode,tabOverlapAllowance:null!==(a=null==t?void 0:t.tabOverlapAllowance)&&void 0!==a?a:Y.Settings.defaults.tabOverlapAllowance,reorderOnTabMenuClick:null!==(l=null==t?void 0:t.reorderOnTabMenuClick)&&void 0!==l?l:Y.Settings.defaults.reorderOnTabMenuClick,tabControlOffset:null!==(h=null==t?void 0:t.tabControlOffset)&&void 0!==h?h:Y.Settings.defaults.tabControlOffset,popInOnClose:null!==(d=null==t?void 0:t.popInOnClose)&&void 0!==d?d:Y.Settings.defaults.popInOnClose}},(e=t.Dimensions||(t.Dimensions={})).resolve=function(t){var i,n,o,s,r;const{size:a,sizeUnit:l}=e.resolveDefaultMinItemHeight(t),{size:h,sizeUnit:d}=e.resolveDefaultMinItemWidth(t);return{borderWidth:null!==(i=null==t?void 0:t.borderWidth)&&void 0!==i?i:Y.Dimensions.defaults.borderWidth,borderGrabWidth:null!==(n=null==t?void 0:t.borderGrabWidth)&&void 0!==n?n:Y.Dimensions.defaults.borderGrabWidth,defaultMinItemHeight:a,defaultMinItemHeightUnit:l,defaultMinItemWidth:h,defaultMinItemWidthUnit:d,headerHeight:null!==(o=null==t?void 0:t.headerHeight)&&void 0!==o?o:Y.Dimensions.defaults.headerHeight,dragProxyWidth:null!==(s=null==t?void 0:t.dragProxyWidth)&&void 0!==s?s:Y.Dimensions.defaults.dragProxyWidth,dragProxyHeight:null!==(r=null==t?void 0:t.dragProxyHeight)&&void 0!==r?r:Y.Dimensions.defaults.dragProxyHeight}},e.fromResolved=function(t){return{borderWidth:t.borderWidth,borderGrabWidth:t.borderGrabWidth,defaultMinItemHeight:_t(t.defaultMinItemHeight,t.defaultMinItemHeightUnit),defaultMinItemWidth:_t(t.defaultMinItemWidth,t.defaultMinItemWidthUnit),headerHeight:t.headerHeight,dragProxyWidth:t.dragProxyWidth,dragProxyHeight:t.dragProxyHeight}},e.resolveDefaultMinItemHeight=function(t){const e=null==t?void 0:t.defaultMinItemHeight;return void 0===e?{size:Y.Dimensions.defaults.defaultMinItemHeight,sizeUnit:Y.Dimensions.defaults.defaultMinItemHeightUnit}:ft(e,[F.Pixel])},e.resolveDefaultMinItemWidth=function(t){const e=null==t?void 0:t.defaultMinItemWidth;return void 0===e?{size:Y.Dimensions.defaults.defaultMinItemWidth,sizeUnit:Y.Dimensions.defaults.defaultMinItemWidthUnit}:ft(e,[F.Pixel])},function(t){t.resolve=function(t,e,i){var n,o,s,r,a,l,h,d,c,m,u,p;let g;return g=void 0!==(null==t?void 0:t.show)?t.show:void 0!==e&&void 0!==e.hasHeaders?!!e.hasHeaders&&Y.Header.defaults.show:Y.Header.defaults.show,{show:g,popout:null!==(o=null!==(n=null==t?void 0:t.popout)&&void 0!==n?n:null==i?void 0:i.popout)&&void 0!==o?o:!1!==(null==e?void 0:e.showPopoutIcon)&&Y.Header.defaults.popout,dock:null!==(r=null!==(s=null==t?void 0:t.popin)&&void 0!==s?s:null==i?void 0:i.popin)&&void 0!==r?r:Y.Header.defaults.dock,maximise:null!==(l=null!==(a=null==t?void 0:t.maximise)&&void 0!==a?a:null==i?void 0:i.maximise)&&void 0!==l?l:!1!==(null==e?void 0:e.showMaximiseIcon)&&Y.Header.defaults.maximise,close:null!==(d=null!==(h=null==t?void 0:t.close)&&void 0!==h?h:null==i?void 0:i.close)&&void 0!==d?d:!1!==(null==e?void 0:e.showCloseIcon)&&Y.Header.defaults.close,minimise:null!==(m=null!==(c=null==t?void 0:t.minimise)&&void 0!==c?c:null==i?void 0:i.minimise)&&void 0!==m?m:Y.Header.defaults.minimise,tabDropdown:null!==(p=null!==(u=null==t?void 0:t.tabDropdown)&&void 0!==u?u:null==i?void 0:i.tabDropdown)&&void 0!==p?p:Y.Header.defaults.tabDropdown}}}(t.Header||(t.Header={})),t.isPopout=i,t.resolve=function(e){if(i(e))return st.resolve(e);{let i;i=void 0!==e.root?e.root:void 0!==e.content&&e.content.length>0?e.content[0]:void 0;return{resolved:!0,root:nt.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:nt.fromResolvedOrUndefined(e.root),openPopouts:st.fromResolvedArray(e.openPopouts),settings:Y.Settings.createCopy(e.settings),dimensions:t.Dimensions.fromResolved(e.dimensions),header:Y.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;n<e;n++)i[n]=st.resolve(t[n]);return i}}}(ot||(ot={})),function(t){var e;function i(e){const i=e.length,n=new Array(i);for(let o=0;o<i;o++){const i=e[o];n[o]=t.fromResolved(i)}return n}(e=t.Window||(t.Window={})).resolve=function(t,e){var i,n,o,s,r,a,l,h;let d;const c=J.Window.defaults;return d=void 0!==t?{width:null!==(i=t.width)&&void 0!==i?i:c.width,height:null!==(n=t.height)&&void 0!==n?n:c.height,left:null!==(o=t.left)&&void 0!==o?o:c.left,top:null!==(s=t.top)&&void 0!==s?s:c.top}:{width:null!==(r=null==e?void 0:e.width)&&void 0!==r?r:c.width,height:null!==(a=null==e?void 0:e.height)&&void 0!==a?a:c.height,left:null!==(l=null==e?void 0:e.left)&&void 0!==l?l:c.left,top:null!==(h=null==e?void 0:e.top)&&void 0!==h?h:c.top},d},e.fromResolved=function(t){return{width:null===t.width?void 0:t.width,height:null===t.height?void 0:t.height,left:null===t.left?void 0:t.left,top:null===t.top?void 0:t.top}},t.resolve=function(e){var i,n;let o;return o=void 0!==e.root?e.root:void 0!==e.content&&e.content.length>0?e.content[0]:void 0,{root:nt.resolve(o),openPopouts:ot.resolveOpenPopouts(e.openPopouts),dimensions:ot.Dimensions.resolve(e.dimensions),settings:ot.Settings.resolve(e.settings),header:ot.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:nt.fromResolvedOrUndefined(e.root),openPopouts:i(e.openPopouts),dimensions:ot.Dimensions.fromResolved(e.dimensions),settings:Y.Settings.createCopy(e.settings),header:Y.Header.createCopy(e.header),parentId:e.parentId,indexInParent:e.indexInParent,window:t.Window.fromResolved(e.window)}},t.fromResolvedArray=i}(st||(st={}));class Ct{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;t<i.length;t++){(0,i[t])(...e)}}this.emitAllEvent(t,e),this.tryBubbleEvent(t,e)}emitUnknown(t,...e){let i=this._subscriptionsMap.get(t);if(void 0!==i){i=i.slice();for(let t=0;t<i.length;t++)i[t](...e)}this.emitAllEvent(t,e),this.tryBubbleEvent(t,e)}emitBaseBubblingEvent(t){const e=new Ct.BubblingEvent(t,this);this.emitUnknown(t,e)}emitUnknownBubblingEvent(t){const e=new Ct.BubblingEvent(t,this);this.emitUnknown(t,e)}removeEventListener(t,e){const i=e;this.removeUnknownEventListener(t,i)}off(t,e){this.removeEventListener(t,e)}addEventListener(t,e){const i=e;this.addUnknownEventListener(t,i)}on(t,e){this.addEventListener(t,e)}addUnknownEventListener(t,e){if(t===Ct.ALL_EVENT)this._allEventSubscriptions.push(e);else{let i=this._subscriptionsMap.get(t);void 0!==i?i.push(e):(i=[e],this._subscriptionsMap.set(t,i))}}removeUnknownEventListener(t,e){if(t===Ct.ALL_EVENT)this.removeSubscription(t,this._allEventSubscriptions,e);else{const i=this._subscriptionsMap.get(t);if(void 0===i)throw new Error("No subscribtions to unsubscribe for event "+t);this.removeSubscription(t,i,e)}}removeSubscription(t,e,i){const n=e.indexOf(i);if(n<0)throw new Error("Nothing to unbind for "+t);e.splice(n,1)}emitAllEvent(t,e){const i=this._allEventSubscriptions.length;if(i>0){const n=e.slice();n.unshift(t);const o=this._allEventSubscriptions.slice();for(let t=0;t<i;t++)o[t](...n)}}}!function(t){t.ALL_EVENT="__all",t.headerClickEventName="stackHeaderClick",t.headerTouchStartEventName="stackHeaderTouchStart";class e{constructor(t,e){this._name=t,this._target=e,this._isPropagationStopped=!1}get name(){return this._name}get target(){return this._target}get origin(){return this._target}get isPropagationStopped(){return this._isPropagationStopped}stopPropagation(){this._isPropagationStopped=!0}}t.BubblingEvent=e;t.ClickBubblingEvent=class extends e{constructor(t,e,i){super(t,e),this._mouseEvent=i}get mouseEvent(){return this._mouseEvent}};t.TouchStartBubblingEvent=class extends e{constructor(t,e,i){super(t,e),this._touchEvent=i}get touchEvent(){return this._touchEvent}}}(Ct||(Ct={}));class yt extends Ct{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,e){let i=this._parent;if(i.isColumn||i.isRow||null===i.parent)throw new z("ICSSPRC","ComponentContainer cannot have RowColumn Parent");{let n;do{n=i,i=i.parent}while(null!==i&&!i.isColumn&&!i.isRow);if(null===i)return!1;{const o=i.isColumn?"height":"width",s=this[o];if(null===s)throw new M("ICSSCS11194");{const r=("height"===o?e:t)/(s*(1/(n.size/100)))*100,a=(n.size-r)/(i.contentItems.length-1);for(let t=0;t<i.contentItems.length;t++){const e=i.contentItems[t];e===n?e.size=r:e.size+=a}return i.updateSize(!1),!0}}}}close(){this._isClosable&&(this.emit("close"),this._parent.close())}replaceComponent(t){if(this.releaseComponent(),!K.isComponent(t))throw new Error("ReplaceComponent not passed a component ItemConfig");{const e=et.resolve(t,!1);if(this._initialState=e.componentState,this._state=this._initialState,this._componentType=e.componentType,this._updateItemConfigEvent(e),this._boundComponent=this.layoutManager.bindComponent(this,e),this.updateElementPositionPropertyFromBoundComponent(),this._boundComponent.virtual){if(void 0!==this.virtualVisibilityChangeRequiredEvent&&this.virtualVisibilityChangeRequiredEvent(this,this._visible),void 0!==this.virtualRectingRequiredEvent){this._layoutManager.fireBeforeVirtualRectingEvent(1);try{this.virtualRectingRequiredEvent(this,this._width,this._height)}finally{this._layoutManager.fireAfterVirtualRectingEvent()}}this.setBaseLogicalZIndex()}this.emit("stateChanged")}}getState(){return this._state}extendState(t){const e=ut(this._state,t);this.setState(e)}setState(t){this._state=t,this._parent.emitBaseBubblingEvent("stateChanged")}setTitle(t){this._parent.setTitle(t)}setTab(t){this._tab=t,this.emit("tab",t)}setVisibility(t){this._boundComponent.virtual&&void 0!==this.virtualVisibilityChangeRequiredEvent&&this.virtualVisibilityChangeRequiredEvent(this,t),t?this._visible?!this._isShownWithZeroDimensions||0===this._height&&0===this._width||(this._isShownWithZeroDimensions=!1,this.setSizeToNodeSize(this._width,this._height,!0),this.emitShow()):(this._visible=!0,0===this._height&&0===this._width?this._isShownWithZeroDimensions=!0:(this._isShownWithZeroDimensions=!1,this.setSizeToNodeSize(this._width,this._height,!0),this.emitShow())):this._visible&&(this._visible=!1,this._isShownWithZeroDimensions=!1,this.emitHide())}setBaseLogicalZIndex(){this.setLogicalZIndex(U.base)}setLogicalZIndex(t){t!==this._logicalZIndex&&(this._logicalZIndex=t,this.notifyVirtualZIndexChangeRequired())}enterDragMode(t,e){this._width=t,this._height=e,ht(this._element,t),dt(this._element,e),this.setLogicalZIndex(U.drag),this.drag()}exitDragMode(){this.setBaseLogicalZIndex()}enterStackMaximised(){this._stackMaximised=!0,this.setLogicalZIndex(U.stackMaximised)}exitStackMaximised(){this.setBaseLogicalZIndex(),this._stackMaximised=!1}drag(){if(this._boundComponent.virtual&&void 0!==this.virtualRectingRequiredEvent){this._layoutManager.fireBeforeVirtualRectingEvent(1);try{this.virtualRectingRequiredEvent(this,this._width,this._height)}finally{this._layoutManager.fireAfterVirtualRectingEvent()}}}setSizeToNodeSize(t,e,i){(t!==this._width||e!==this._height||i)&&(this._width=t,this._height=e,ht(this._element,t),dt(this._element,e),this._boundComponent.virtual?this.addVirtualSizedContainerToLayoutManager():(this.emit("resize"),this.checkShownFromZeroDimensions()))}notifyVirtualRectingRequired(){void 0!==this.virtualRectingRequiredEvent&&(this.virtualRectingRequiredEvent(this,this._width,this._height),this.emit("resize"),this.checkShownFromZeroDimensions())}notifyVirtualZIndexChangeRequired(){if(void 0!==this.virtualZIndexChangeRequiredEvent){const t=this._logicalZIndex,e=H[t];this.virtualZIndexChangeRequiredEvent(this,t,e)}}updateElementPositionPropertyFromBoundComponent(){this._boundComponent.virtual?this._element.style.position="static":this._element.style.position=""}addVirtualSizedContainerToLayoutManager(){this._layoutManager.beginVirtualSizedContainerAdding();try{this._layoutManager.addVirtualSizedContainer(this)}finally{this._layoutManager.endVirtualSizedContainerAdding()}}checkShownFromZeroDimensions(){!this._isShownWithZeroDimensions||0===this._height&&0===this._width||(this._isShownWithZeroDimensions=!1,this.emitShow())}emitShow(){this.emit("shown"),this.emit("show")}emitHide(){this.emit("hide")}releaseComponent(){this._stackMaximised&&this.exitStackMaximised(),this.emit("beforeComponentRelease",this._boundComponent.component),this.layoutManager.unbindComponent(this,this._boundComponent.virtual,this._boundComponent.component)}}class wt extends Ct{constructor(t,e,i){super(),this._config=t,this._initialWindowSize=e,this._layoutManager=i,this._isInitialised=!1,this._popoutWindow=null,this.createWindow()}toConfig(){var t,e;if(!1===this._isInitialised)throw new Error("Can't create config, layout not yet initialised");const i=this.getGlInstance().saveLayout();let n,o;null===this._popoutWindow?(n=null,o=null):(n=null!==(t=this._popoutWindow.screenX)&&void 0!==t?t:this._popoutWindow.screenLeft,o=null!==(e=this._popoutWindow.screenY)&&void 0!==e?e:this._popoutWindow.screenTop);const s={width:this.getGlInstance().width,height:this.getGlInstance().height,left:n,top:o};return{root:i.root,openPopouts:i.openPopouts,settings:i.settings,dimensions:i.dimensions,header:i.header,window:s,parentId:this._config.parentId,indexInParent:this._config.indexInParent,resolved:!0}}getGlInstance(){if(null===this._popoutWindow)throw new M("BPGGI24693");return this._popoutWindow.__glInstance}getWindow(){if(null===this._popoutWindow)throw new M("BPGW087215");return this._popoutWindow}close(){if(this.getGlInstance())this.getGlInstance().closeWindow();else try{this.getWindow().close()}catch(t){}}popIn(){let t,e=this._config.indexInParent;if(!this._config.parentId)return;const i=ut({},this.getGlInstance().saveLayout()).root;if(void 0===i)throw new P("BPPIR19998");const n=this._layoutManager.groundItem;if(void 0===n)throw new P("BPPIG34972");t=n.getItemsByPopInParentId(this._config.parentId)[0],t||(t=n.contentItems.length>0?n.contentItems[0]:n,e=0);const o=this._layoutManager.createAndInitContentItem(i,t);t.addChild(o,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 I("Popout blocked")}}checkReady(){if(null===this._popoutWindow)throw new M("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-"+gt(),e=Y.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 bt extends Ct{constructor(t,e,i,n){super(),this.layoutManager=t,this._parent=i,this._element=n,this._popInParentIds=[],this._type=e.type,this._id=e.id,this._isInitialised=!1,this.isGround=!1,this.isRow=!1,this.isColumn=!1,this.isStack=!1,this.isComponent=!1,this.size=e.size,this.sizeUnit=e.sizeUnit,this.minSize=e.minSize,this.minSizeUnit=e.minSizeUnit,this._isClosable=e.isClosable,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this._contentItems=this.createContentItems(e.content)}get type(){return this._type}get id(){return this._id}set id(t){this._id=t}get popInParentIds(){return this._popInParentIds}get parent(){return this._parent}get contentItems(){return this._contentItems}get isClosable(){return this._isClosable}get element(){return this._element}get isInitialised(){return this._isInitialised}static isStack(t){return t.isStack}static isComponentItem(t){return t.isComponent}static isComponentParentableItem(t){return t.isStack||t.isGround}removeChild(t,e=!1){const i=this._contentItems.indexOf(t);if(-1===i)throw new Error("Can't remove child item. Unknown content item");if(e||this._contentItems[i].destroy(),this._contentItems.splice(i,1),this._contentItems.length>0)this.updateSize(!1);else if(!this.isGround&&!0===this._isClosable){if(null===this._parent)throw new M("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,e,i=!1){const n=this._contentItems.indexOf(t),o=t._element.parentNode;if(-1===n)throw new z("CIRCI23232","Can't replace child. oldChild is not child of this");if(null===o)throw new M("CIRCP23232");if(o.replaceChild(e._element,t._element),!0===i&&(t._parent=null,t.destroy()),this._contentItems[n]=e,e.setParent(this),e.size=t.size,e.sizeUnit=t.sizeUnit,e.minSize=t.minSize,e.minSizeUnit=t.minSizeUnit,null===e._parent)throw new M("CIRCNC45699");!0===e._parent._isInitialised&&!1===e._isInitialised&&e.init(),this.updateSize(!1)}remove(){if(null===this._parent)throw new M("CIR11110");this._parent.removeChild(this)}popout(){const t=gt(),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;n<e;n++){const e=t[n];i[n]=e.toConfig()}return i}highlightDropZone(t,e,i){const n=this.layoutManager.dropTargetIndicator;if(null===n)throw new M("ACIHDZ5593");n.highlightArea(i,1)}onDrop(t,e){this.addChild(t)}show(){this.layoutManager.beginSizeInvalidation();try{mt(this._element,!0);for(let t=0;t<this._contentItems.length;t++)this._contentItems[t].show()}finally{this.layoutManager.endSizeInvalidation()}}destroy(){for(let t=0;t<this._contentItems.length;t++)this._contentItems[t].destroy();this._contentItems=[],this.emitBaseBubblingEvent("beforeItemDestroyed"),this._element.remove(),this.emitBaseBubblingEvent("itemDestroyed")}getElementArea(t){const e=(t=null!=t?t:this._element).getBoundingClientRect(),i=e.top+document.body.scrollTop,n=e.left+document.body.scrollLeft,o=e.width,s=e.height;return{x1:n,y1:i,x2:n+o,y2:i+s,surface:o*s,contentItem:this}}init(){this._isInitialised=!0,this.emitBaseBubblingEvent("itemCreated"),this.emitUnknownBubblingEvent(this.type+"Created")}setParent(t){this._parent=t}addPopInParentId(t){this.popInParentIds.includes(t)||this.popInParentIds.push(t)}initContentItems(){for(let t=0;t<this._contentItems.length;t++)this._contentItems[t].init()}hide(){this.layoutManager.beginSizeInvalidation();try{mt(this._element,!1)}finally{this.layoutManager.endSizeInvalidation()}}updateContentItemsSize(t){for(let e=0;e<this._contentItems.length;e++)this._contentItems[e].updateSize(t)}createContentItems(t){const e=t.length,i=new Array(e);for(let e=0;e<t.length;e++)i[e]=this.layoutManager.createContentItem(t[e],this);return i}propagateEvent(t,e){if(1===e.length){const i=e[0];i instanceof Ct.BubblingEvent&&!1===i.isPropagationStopped&&!0===this._isInitialised&&(!1===this.isGround&&this._parent?this._parent.emitUnknown(t,i):this.scheduleEventPropagationToLayoutManager(t,i))}}tryBubbleEvent(t,e){if(1===e.length){const i=e[0];i instanceof Ct.BubblingEvent&&!1===i.isPropagationStopped&&!0===this._isInitialised&&(!1===this.isGround&&this._parent?this._parent.emitUnknown(t,i):this.scheduleEventPropagationToLayoutManager(t,i))}}scheduleEventPropagationToLayoutManager(t,e){-1===this._throttledEvents.indexOf(t)?this.layoutManager.emitUnknown(t,e):!0!==this._pendingEventPropagations[t]&&(this._pendingEventPropagations[t]=!0,globalThis.requestAnimationFrame((()=>this.propagateEventToLayoutManager(t,e))))}propagateEventToLayoutManager(t,e){this._pendingEventPropagations[t]=!1,this.layoutManager.emitUnknown(t,e)}}class It extends bt{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 yt(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:B.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:G.Header.createCopy(this._headerConfig),componentType:$.copyComponentType(this.componentType),componentState:e}}close(){if(null===this.parent)throw new M("CIC68883");this.parent.removeChild(this,!1)}enterDragMode(t,e){ht(this.element,t),dt(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}=ct(this.element);this._container.setSizeToNodeSize(e,i,t)}}}class St extends bt{constructor(){super(...arguments),this._focused=!1}get focused(){return this._focused}setFocusedValue(t){this._focused=t}}class Et extends Ct{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 xt{constructor(t,e,i){this._isVertical=t,this._size=e,this._grabSize=i<this._size?this._size:i,this._element=document.createElement("div"),this._element.classList.add("lm_splitter");const n=document.createElement("div");n.classList.add("lm_drag_handle");const o=this._grabSize-this._size,s=o/2;this._isVertical?(n.style.top=rt(-s),n.style.height=rt(this._size+o),this._element.classList.add("lm_vertical"),this._element.style.height=rt(this._size)):(n.style.left=rt(-s),n.style.width=rt(this._size+o),this._element.classList.add("lm_horizontal"),this._element.style.width=rt(this._size)),this._element.appendChild(n),this._dragListener=new Et(this._element,[n])}get element(){return this._element}destroy(){this._element.remove()}on(t,e){this._dragListener.on(t,e)}}class zt extends bt{constructor(t,e,i,n){switch(super(e,i,n,zt.createElement(document,t)),this._rowOrColumnParent=n,this._splitter=[],this.isRow=!t,this.isColumn=t,this._childElementContainer=this.element,this._splitterSize=e.layoutConfig.dimensions.borderWidth,this._splitterGrabSize=e.layoutConfig.dimensions.borderGrabWidth,this._isColumn=t,this._dimension=t?"height":"width",this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null,i.type){case B.row:case B.column:this._configType=i.type;break;default:throw new z("ROCCCT00925")}}newComponent(t,e,i,n){const o={type:"component",componentType:t,componentState:e,title:i};return this.newItem(o,n)}addComponent(t,e,i,n){const o={type:"component",componentType:t,componentState:e,title:i};return this.addItem(o,n)}newItem(t,e){e=this.addItem(t,e);const i=this.contentItems[e];return bt.isStack(i)&&K.isComponent(t)?i.contentItems[0]:i}addItem(t,e){this.layoutManager.checkMinimiseMaximisedStack();const i=K.resolve(t,!1),n=this.layoutManager.createAndInitContentItem(i,this);return this.addChild(n,e,!1)}addChild(t,e,i){if(void 0===e&&(e=this.contentItems.length),this.contentItems.length>0){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;e<this.contentItems.length;e++){const i=this.contentItems[e];if(i===t)t.size=n;else{const t=i.size*=(100-n)/100;i.size=t}}return this.updateSize(!1),this.emitBaseBubblingEvent("stateChanged"),e}removeChild(t,e){const i=this.contentItems.indexOf(t),n=Math.max(i-1,0);if(-1===i)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");if(this._splitter[n]&&(this._splitter[n].destroy(),this._splitter.splice(n,1)),super.removeChild(t,e),1===this.contentItems.length&&!0===this.isClosable){const t=this.contentItems[0];this.contentItems.length=0,this._rowOrColumnParent.replaceChild(this,t,!0)}else this.updateSize(!1),this.emitBaseBubblingEvent("stateChanged")}replaceChild(t,e){const i=t.size;super.replaceChild(t,e),e.size=i,this.updateSize(!1),this.emitBaseBubblingEvent("stateChanged")}updateSize(t){this.layoutManager.beginVirtualSizedContainerAdding();try{this.updateNodeSize(),this.updateContentItemsSize(t)}finally{this.layoutManager.endVirtualSizedContainerAdding()}}init(){if(!0!==this.isInitialised){this.updateNodeSize();for(let t=0;t<this.contentItems.length;t++)this._childElementContainer.appendChild(this.contentItems[t].element);super.init();for(let t=0;t<this.contentItems.length-1;t++)this.contentItems[t].element.insertAdjacentElement("afterend",this.createSplitter(t).element);this.initContentItems()}}toConfig(){return{type:this.type,content:this.calculateConfigContent(),size:this.size,sizeUnit:this.sizeUnit,minSize:this.minSize,minSizeUnit:this.minSizeUnit,id:this.id,isClosable:this.isClosable}}setParent(t){this._rowOrColumnParent=t,super.setParent(t)}updateNodeSize(){this.contentItems.length>0&&(this.calculateRelativeSizes(),this.setAbsoluteSizes()),this.emitBaseBubblingEvent("stateChanged"),this.emit("resize")}setAbsoluteSizes(){const t=this.calculateAbsoluteSizes();for(let e=0;e<this.contentItems.length;e++)t.additionalPixel-e>0&&t.itemSizes[e]++,this._isColumn?(ht(this.contentItems[e].element,t.crossAxisSize),dt(this.contentItems[e].element,t.itemSizes[e])):(ht(this.contentItems[e].element,t.itemSizes[e]),dt(this.contentItems[e].element,t.crossAxisSize))}calculateAbsoluteSizes(){const t=(this.contentItems.length-1)*this._splitterSize,{width:e,height:i}=ct(this.element);let n,o;this._isColumn?(n=i-t,o=e):(n=e-t,o=i);let s=0;const r=[];for(let t=0;t<this.contentItems.length;t++){const e=this.contentItems[t];let i;if(e.sizeUnit!==F.Percent)throw new z("ROCCAS6692");i=Math.floor(n*(e.size/100)),s+=i,r.push(i)}return{itemSizes:r,additionalPixel:Math.floor(n-s),totalSize:n,crossAxisSize:o}}calculateRelativeSizes(){let t=0;const e=[];let i=0;for(let n=0;n<this.contentItems.length;n++){const o=this.contentItems[n];switch(o.sizeUnit){case F.Percent:t+=o.size;break;case F.Fractional:e.push(o),i+=o.size;break;default:throw new z("ROCCRS49110",JSON.stringify(o))}}if(100!==Math.round(t))if(Math.round(t)<100&&e.length>0){const n=100-t;for(let t=0;t<e.length;t++){const o=e[t];o.size=n*(o.size/i),o.sizeUnit=F.Percent}this.respectMinItemSize()}else{if(Math.round(t)>100&&e.length>0){for(let t=0;t<e.length;t++){const n=e[t];n.size=n.size/i*50,n.sizeUnit=F.Percent}t+=50}for(let e=0;e<this.contentItems.length;e++){const i=this.contentItems[e];i.size=i.size/t*100}this.respectMinItemSize()}else this.respectMinItemSize()}respectMinItemSize(){const t=this.calculateContentItemMinSize(this);if(!(t<=0||this.contentItems.length<=1)){let e=0,i=0;const n=[],o=[],s=this.calculateAbsoluteSizes();for(let r=0;r<s.itemSizes.length;r++){const a=s.itemSizes[r];let l;a<t?(i+=t-a,l={size:t}):(e+=a-t,l={size:a},n.push(l)),o.push(l)}if(0===i||i>e)return;{const r=i/e;let a=i;for(let e=0;e<n.length;e++){const i=n[e],o=Math.round((i.size-t)*r);a-=o,i.size-=o}0!==a&&(o[o.length-1].size-=a);for(let t=0;t<this.contentItems.length;t++){this.contentItems[t].size=o[t].size/s.totalSize*100}}}}createSplitter(t){const e=new xt(this._isColumn,this._splitterSize,this._splitterGrabSize);return e.on("drag",((t,i)=>this.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 e=t.minSize;if(void 0!==e){if(t.minSizeUnit===F.Pixel)return e;throw new z("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=at(e.before.element.style[this._dimension]),n=at(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 n=this._isColumn?i:e;if(null===this._splitterMinPosition||null===this._splitterMaxPosition)throw new M("ROCOSD59226");n=Math.max(n,this._splitterMinPosition),n=Math.min(n,this._splitterMaxPosition),this._splitterPosition=n;const o=rt(n);this._isColumn?t.element.style.top=o:t.element.style.left=o}onSplitterDragStop(t){if(null===this._splitterPosition)throw new M("ROCOSDS66932");{const e=this.getSplitItems(t),i=at(e.before.element.style[this._dimension]),n=at(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=rt(0),t.element.style.left=rt(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?ht(t,i):dt(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}}(zt||(zt={}));class Lt extends St{constructor(t,e,i){super(t,X.create(e),null,Lt.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;t<this.contentItems.length;t++)this._childElementContainer.appendChild(this.contentItems[t].element);super.init(),this.initContentItems()}}loadRoot(t){if(this.clearRoot(),void 0!==t){const e=this.layoutManager.createAndInitContentItem(t,this);this.addChild(e,0)}}clearRoot(){const t=this.contentItems;switch(t.length){case 0:return;case 1:return void t[0].remove();default:throw new z("GILR07721")}}addItem(t,e){this.layoutManager.checkMinimiseMaximisedStack();const i=K.resolve(t,!1);let n;if(n=this.contentItems.length>0?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=K.resolve(t,!1);if(e.maximised)throw new Error("Root Component cannot be maximised");{const t=new It(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,e=t.length,i=new Array(e);for(let n=0;n<e;n++){const e=t[n].toConfig();if(!q.isRootItemConfig(e))throw new z("RCCC66832");i[n]=e}return i}setSize(t,e){void 0===t||void 0===e?this.updateSize(!1):(ht(this.element,t),dt(this.element,e),this.contentItems.length>0&&(ht(this.contentItems[0].element,t),dt(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=Lt.Area.oppositeSides,e=new Array(Object.keys(t).length);let i=0;for(const n in t){const o=n,s=this.getElementArea();if(null===s)throw new M("RCSA77553");s.side=o,"2"===t[o][1]?s[o]=s[t[o]]-50:s[o]=s[t[o]]+50,s.surface=(s.x2-s.x1)*(s.y2-s.y1),e[i++]=s}return e}highlightDropZone(t,e,i){this.layoutManager.tabDropPlaceholder.remove(),super.highlightDropZone(t,e,i)}onDrop(t,e){if(t.isComponent){const e=Z.createDefault(),i=t;e.header=G.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===B.row||t.type===B.column){const e=Z.createDefault(),i=this.layoutManager.createContentItem(e,this);i.addChild(t),t=i}const i="x"==e.side[0]?B.row:B.column,n="2"==e.side[1],o=this.contentItems[0];if(o instanceof zt&&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=F.Percent,o.updateSize(!1)}else{const e=N.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=F.Percent,s.updateSize(!1)}}}dock(){throw new z("GID87731")}validateDocking(){throw new z("GIVD87732")}getAllContentItems(){const t=[this];return this.deepGetAllContentItems(this.contentItems,t),t}getConfigMaximisedItems(){const t=[];return this.deepFilterContentItems(this.contentItems,t,(t=>!(!bt.isStack(t)||!t.initialWantMaximise)||!(!bt.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}=ct(this._containerElement);ht(this.element,t),dt(this.element,e),this.contentItems.length>0&&(ht(this.contentItems[0].element,t),dt(this.contentItems[0].element,e))}deepGetAllContentItems(t,e){for(let i=0;i<t.length;i++){const n=t[i];e.push(n),this.deepGetAllContentItems(n.contentItems,e)}}deepFilterContentItems(t,e,i){for(let n=0;n<t.length;n++){const o=t[n];i(o)&&e.push(o),this.deepFilterContentItems(o.contentItems,e,i)}}}!function(t){(t.Area||(t.Area={})).oppositeSides={y2:"y1",x2:"x1",y1:"y2",x1:"x2"},t.createElement=function(t){const e=t.createElement("div");return e.classList.add("lm_goldenlayout"),e.classList.add("lm_item"),e.classList.add("lm_root"),e}}(Lt||(Lt={}));class Mt{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 Pt{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 P("TODSDLU10093");if(void 0===this._dragStartEvent)throw new P("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 P("TNC15007");this._closeEvent(this._componentItem)}notifyFocus(){if(void 0===this._focusEvent)throw new P("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 P("TDR87745");this._componentItem.off("destroy",this._contentItemDestroyListener),this._dragListener.off("dragStart",this._dragStartListener),this._dragListener=void 0}}class Tt{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;t<this._tabs.length;t++)this._tabs[t].destroy()}createTab(t,e){for(let e=0;e<this._tabs.length;e++)if(this._tabs[e].componentItem===t)return;const i=new Pt(this._layoutManager,t,(t=>this.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),e<this._element.childNodes.length?this._element.insertBefore(i.element,this._element.childNodes[e]):this._element.appendChild(i.element)}removeTab(t){for(let e=0;e<this._tabs.length;e++)if(this._tabs[e].componentItem===t){return this._tabs[e].destroy(),void this._tabs.splice(e,1)}throw new Error("contentItem is not controlled by this header")}processActiveComponentChanged(t){let e=-1;for(let i=0;i<this._tabs.length;i++){const n=this._tabs[i].componentItem===t;this._tabs[i].setActive(n),n&&(e=i)}if(e<0)throw new z("HSACI56632");if(this._layoutManager.layoutConfig.settings.reorderOnTabMenuClick&&-1!==this._lastVisibleTabIndex&&e>this._lastVisibleTabIndex){const t=this._tabs[e];for(let t=e;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;i<this._tabs.length;i++){const l=this._tabs[i].element;l.parentElement!==this._element&&this._element.appendChild(l);const h=at(getComputedStyle(a.element).marginRight);n+=l.offsetWidth+h;let d=0;if(r<=i)d=n;else{const t=at(getComputedStyle(a.element).marginRight);d=n+a.element.offsetWidth+t}if(d>e){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,t<s){for(let e=0;e<=i;e++){const n=e!==r&&0!==e?"-"+rt(t):"";this._tabs[e].element.style.zIndex=rt(i-e),this._tabs[e].element.style.marginLeft=n}this._lastVisibleTabIndex=i,l.parentElement!==this._element&&this._element.appendChild(l)}else o=!0}if(o&&i!==r){if(!t)return!1;l.style.zIndex="auto",l.style.marginLeft="",l.parentElement!==this._dropdownElement&&this._dropdownElement.appendChild(l)}}else this._lastVisibleTabIndex=i,l.style.zIndex="auto",l.style.marginLeft="",l.parentElement!==this._element&&this._element.appendChild(l)}}return!0}showAdditionalTabsDropdown(){this._dropdownElement.style.display=""}hideAdditionalTabsDropdown(){this._dropdownElement.style.display="none"}handleTabCloseEvent(t){this._componentRemoveEvent(t)}handleTabFocusEvent(t){this._componentFocusEvent(t)}handleTabDragStartEvent(t,e,i,n){this._componentDragStartEvent(t,e,i,n)}}class At extends Ct{constructor(t,e,i,n,o,s,r,a,l,h,d,c,m){super(),this._layoutManager=t,this._parent=e,this._configClosable=n,this._getActiveComponentItemEvent=o,this._popoutEvent=r,this._maximiseToggleEvent=a,this._clickEvent=l,this._touchStartEvent=h,this._componentRemoveEvent=d,this._componentFocusEvent=c,this._componentDragStartEvent=m,this._clickListener=t=>this.onClick(t),this._touchStartListener=t=>this.onTouchStart(t),this._rowColumnClosable=!0,this._closeButton=null,this._popoutButton=null,this._tabsContainer=new Tt(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 Mt(this,this._tabDropdownLabel,"lm_tabdropdown",(()=>this._tabsContainer.showAdditionalTabsDropdown()))),this._popoutEnabled&&(this._popoutButton=new Mt(this,this._popoutLabel,"lm_popout",(()=>this.handleButtonPopoutEvent()))),this._maximiseEnabled&&(this._maximiseButton=new Mt(this,this._maximiseLabel,"lm_maximise",(t=>this.handleButtonMaximiseToggleEvent(t)))),this._configClosable&&(this._closeButton=new Mt(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=[R.right,R.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;i<e;i++){if(!this._tabsContainer.tabs[i].componentItem.isClosable){t=!1;break}}}else t=!1;else t=!1;null!==this._closeButton&&mt(this._closeButton.element,t),null!==this._popoutButton&&mt(this._popoutButton.element,t),this._canRemoveComponent=t||this._tabsContainer.tabCount>1}applyFocusedValue(t){t?this._element.classList.add("lm_focused"):this._element.classList.remove("lm_focused")}processMaximised(){if(void 0===this._maximiseButton)throw new P("HPMAX16997");this._maximiseButton.element.setAttribute("title",this._minimiseLabel)}processMinimised(){if(void 0===this._maximiseButton)throw new P("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=rt(t)):(this._element.style.width="",this._element.style.height=rt(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 P("HHTCE22294");this._componentRemoveEvent(t)}}handleTabInitiatedComponentFocusEvent(t){if(void 0===this._componentFocusEvent)throw new P("HHTAE22294");this._componentFocusEvent(t)}handleTabInitiatedDragStartEvent(t,e,i,n){if(this._canRemoveComponent){if(void 0===this._componentDragStartEvent)throw new P("HHTDSE22294");this._componentDragStartEvent(t,e,i,n)}else i.cancelDrag()}processTabDropdownActiveChanged(){void 0!==this._tabDropdownButton&&mt(this._tabDropdownButton.element,this._tabsContainer.dropdownActive)}handleButtonPopoutEvent(){if(this._layoutManager.layoutConfig.settings.popoutWholeStack){if(void 0===this._popoutEvent)throw new P("HHBPOE17834");this._popoutEvent()}else{const t=this._getActiveComponentItemEvent();t&&t.popout()}}handleButtonMaximiseToggleEvent(t){if(void 0===this._maximiseToggleEvent)throw new P("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 P("HNHC46834");this._clickEvent(t)}notifyTouchStart(t){if(void 0===this._touchStartEvent)throw new P("HNHTS46834");this._touchStartEvent(t)}}class Dt extends St{constructor(t,e,i){var n,o,s,r,a,l,h,d,c,m,u,p,g,f,_,v,C,y,w;super(t,e,i,Dt.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,I=e.content;let S;if(1!==I.length)S=void 0;else{S=I[0].header}this._initialWantMaximise=e.maximised,this._initialActiveItemIndex=null!==(n=e.activeItemIndex)&&void 0!==n?n:0;const E=null!==(r=null!==(s=null===(o=this._headerConfig)||void 0===o?void 0:o.show)&&void 0!==s?s:null==S?void 0:S.show)&&void 0!==r?r:b.show,x=null!==(h=null!==(l=null===(a=this._headerConfig)||void 0===a?void 0:a.popout)&&void 0!==l?l:null==S?void 0:S.popout)&&void 0!==h?h:b.popout,z=null!==(m=null!==(c=null===(d=this._headerConfig)||void 0===d?void 0:d.maximise)&&void 0!==c?c:null==S?void 0:S.maximise)&&void 0!==m?m:b.maximise,L=null!==(g=null!==(p=null===(u=this._headerConfig)||void 0===u?void 0:u.close)&&void 0!==p?p:null==S?void 0:S.close)&&void 0!==g?g:b.close,M=null!==(v=null!==(_=null===(f=this._headerConfig)||void 0===f?void 0:f.minimise)&&void 0!==_?_:null==S?void 0:S.minimise)&&void 0!==v?v:b.minimise,P=null!==(w=null!==(y=null===(C=this._headerConfig)||void 0===C?void 0:C.tabDropdown)&&void 0!==y?y:null==S?void 0:S.tabDropdown)&&void 0!==w?w:b.tabDropdown;this._maximisedEnabled=!1!==z;const T={show:!1!==E,side:!1===E?R.top:E,popoutEnabled:!1!==x,popoutLabel:!1===x?"":x,maximiseEnabled:this._maximisedEnabled,maximiseLabel:!1===z?"":z,closeEnabled:!1!==L,closeLabel:!1===L?"":L,minimiseEnabled:!0,minimiseLabel:M,tabDropdownEnabled:!1!==P,tabDropdownLabel:!1===P?"":P};this._header=new At(t,this,T,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;t<this.contentItems.length;t++)this._childElementContainer.appendChild(this.contentItems[t].element);super.init();const t=this.contentItems,e=t.length;if(e>0){if(this._initialActiveItemIndex<0||this._initialActiveItemIndex>=e)throw new Error(`ActiveItemIndex out of range: ${this._initialActiveItemIndex} id: ${this.id}`);for(let i=0;i<e;i++){const e=t[i];if(!(e instanceof It))throw new Error(`Stack Content Item is not of type ComponentItem: ${i} id: ${this.id}`);this._header.createTab(e,i),e.hide(),e.container.setBaseLogicalZIndex()}this.setActiveComponentItem(t[this._initialActiveItemIndex],!1),this._header.updateTabSizes()}this._header.updateClosability(),this.initContentItems()}setActiveContentItem(t){if(!bt.isComponentItem(t))throw new Error("Stack.setActiveContentItem: item is not a ComponentItem");this.setActiveComponentItem(t,!1)}setActiveComponentItem(t,e,i=!1){if(this._activeComponentItem!==t){if(-1===this.contentItems.indexOf(t))throw new Error("componentItem is not a child of this stack");this.layoutManager.beginSizeInvalidation();try{void 0!==this._activeComponentItem&&this._activeComponentItem.hide(),this._activeComponentItem=t,this._header.processActiveComponentChanged(t),t.show()}finally{this.layoutManager.endSizeInvalidation()}this.emit("activeContentItemChanged",t),this.layoutManager.emit("activeContentItemChanged",t),this.emitStateChangedEvent()}(this.focused||e)&&this.layoutManager.setFocusedComponentItem(t,i)}getActiveContentItem(){var t;return null!==(t=this.getActiveComponentItem())&&void 0!==t?t:null}getActiveComponentItem(){return this._activeComponentItem}focusActiveContentItem(){var t;null===(t=this._activeComponentItem)||void 0===t||t.focus()}setFocusedValue(t){this._header.applyFocusedValue(t),super.setFocusedValue(t)}setRowColumnClosable(t){this._header.setRowColumnClosable(t)}newComponent(t,e,i,n){const o={type:"component",componentType:t,componentState:e,title:i};return this.newItem(o,n)}addComponent(t,e,i,n){const o={type:"component",componentType:t,componentState:e,title:i};return this.addItem(o,n)}newItem(t,e){return e=this.addItem(t,e),this.contentItems[e]}addItem(t,e){this.layoutManager.checkMinimiseMaximisedStack();const i=K.resolve(t,!1),n=this.layoutManager.createAndInitContentItem(i,this);return this.addChild(n,e)}addChild(t,e,i=!1){if(void 0!==e&&e>this.contentItems.length)throw e-=1,new z("SAC99728");if(t instanceof It)return e=super.addChild(t,e),this._childElementContainer.appendChild(t.element),this._header.createTab(t,e),this.setActiveComponentItem(t,i),this._header.updateTabSizes(),this.updateSize(!1),t.container.setBaseLogicalZIndex(),this._header.updateClosability(),this.emitStateChangedEvent(),e;throw new z("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,e=t.length;for(let i=0;i<e;i++){const e=t[i];if(!(e instanceof It))throw new z("SMAXI87773");e.enterStackMaximised()}this.emitStateChangedEvent()}}minimise(){if(this.isMaximised){this.layoutManager.setMaximisedStack(void 0);const t=this.contentItems,e=t.length;for(let i=0;i<e;i++){const e=t[i];if(!(e instanceof It))throw new z("SMINI87773");e.exitStackMaximised()}this.emitStateChangedEvent()}}destroy(){var t;(null===(t=this._activeComponentItem)||void 0===t?void 0:t.focused)&&this._activeComponentItem.blur(),super.destroy(),this.off("resize",this._resizeListener),this._maximisedEnabled&&(this.off("maximised",this._maximisedListener),this.off("minimised",this._minimisedListener)),this._header.destroy()}toConfig(){let t;if(this._activeComponentItem&&(t=this.contentItems.indexOf(this._activeComponentItem),t<0))throw new Error("active component item not found in stack");if(this.contentItems.length>0&&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 P("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,o="top"===this._dropSegment||"left"===this._dropSegment,s=i&&this.stackParent.isColumn||n&&this.stackParent.isRow;if(t.isComponent){const e=Z.createDefault();e.header=this.createHeaderConfig();const i=this.layoutManager.createAndInitContentItem(e,this);i.addChild(t),t=i}if(t.type===B.row||t.type===B.column){const e=Z.createDefault();e.header=this.createHeaderConfig();const i=this.layoutManager.createContentItem(e,this);i.addChild(t),t=i}if(s){const e=this.stackParent.contentItems.indexOf(this);this.stackParent.addChild(t,o?e:e+1,!0),this.size*=.5,t.size=this.size,t.sizeUnit=this.sizeUnit,this.stackParent.updateSize(!1)}else{const e=i?B.column:B.row,n=N.createDefault(e),s=this.layoutManager.createContentItem(n,this);this.stackParent.replaceChild(this,s),s.addChild(t,o?0:void 0,!0),s.addChild(this,o?void 0:0,!0),this.size=50,t.size=50,t.sizeUnit=F.Percent,s.updateSize(!1)}}highlightDropZone(t,e){for(const i in this._contentAreaDimensions){const n=i,o=this._contentAreaDimensions[n].hoverArea;if(o.x1<t&&o.x2>t&&o.y1<e&&o.y2>e)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 M("SGAHC13086");const i=e.x2-e.x1,n=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*n},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y1+.5*n}},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*n,x2:e.x1+.75*i,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1+.5*n,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=ct(this.element);if(this._header.show){t[this._header.leftRightSided?k.width:k.height]-=this.layoutManager.layoutConfig.dimensions.headerHeight}this._childElementContainer.style.width=rt(t.width),this._childElementContainer.style.height=rt(t.height);for(let e=0;e<this.contentItems.length;e++)this.contentItems[e].element.style.width=rt(t.width),this.contentItems[e].element.style.height=rt(t.height);this.emit("resize"),this.emitStateChangedEvent()}}highlightHeaderDropZone(t){const e=this._header.lastVisibleTabIndex+1,i=this._header.tabsContainerElement.childNodes,n=new Array(e);let o=0,s=0;for(;s<e;){const t=i[o++];t!==this.layoutManager.tabDropPlaceholder&&(n[s++]=t)}const r=this.layoutManager.dropTargetIndicator;if(null===r)throw new M("SHHDZDTI97110");let a;if(0===e){const t=this._header.element.getBoundingClientRect(),e=t.top+document.body.scrollTop,i=t.left+document.body.scrollLeft;a={x1:i,x2:i+100,y1:e+t.height-20,y2:e+t.height},this._dropIndex=0}else{let i,o,s,r,l=0,h=!1;do{r=n[l];const e=r.getBoundingClientRect(),a=e.top+document.body.scrollTop,d=e.left+document.body.scrollLeft;this._header.leftRightSided?(o=a,i=d,s=e.height):(o=d,i=a,s=e.width),t>=o&&t<o+s?h=!0:l++}while(l<e&&!h);if(!1===h&&t<o)return;t<o+s/2?(this._dropIndex=l,r.insertAdjacentElement("beforebegin",this.layoutManager.tabDropPlaceholder)):(this._dropIndex=Math.min(l+1,e),r.insertAdjacentElement("afterend",this.layoutManager.tabDropPlaceholder));const d=this.layoutManager.tabDropPlaceholder.getBoundingClientRect(),c=d.top+document.body.scrollTop,m=d.left+document.body.scrollLeft,u=d.width;if(this._header.leftRightSided){const t=c;a={x1:i,x2:i+r.clientHeight,y1:t,y2:t+u}}else{a={x1:m,x2:m+u,y1:i,y2:i+r.clientHeight}}}r.highlightArea(a,0)}resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}setupHeaderPosition(){mt(this._header.element,this._header.show),this.element.classList.remove("lm_left","lm_right","lm_bottom"),this._header.leftRightSided&&this.element.classList.add("lm_"+this._header.side),this.updateSize(!1)}highlightBodyDropZone(t){if(void 0===this._contentAreaDimensions)throw new P("SHBDZC82265");{const e=this._contentAreaDimensions[t].highlightArea,i=this.layoutManager.dropTargetIndicator;if(null===i)throw new M("SHBDZD96110");i.highlightArea(e,1),this._dropSegment=t}}handleResize(){
|
2
2
|
//! this._header.updateTabSizes()
|
3
3
|
"block"===getComputedStyle(this.layoutManager.container).display&&this._header.updateTabSizes()}handleMaximised(){this._header.processMaximised()}handleMinimised(){this._header.processMinimised()}handlePopoutEvent(){this.popout()}handleHeaderClickEvent(t){const e=Ct.headerClickEventName,i=new Ct.ClickBubblingEvent(e,this,t);this.emit(e,i)}handleHeaderTouchStartEvent(t){const e=Ct.headerTouchStartEventName,i=new Ct.TouchStartBubblingEvent(e,this,t);this.emit(e,i)}handleHeaderComponentRemoveEvent(t){this.removeChild(t,!1)}handleHeaderComponentFocusEvent(t){this.setActiveComponentItem(t,!0)}handleHeaderComponentStartDragEvent(t,e,i,n){!0===this.isMaximised&&this.toggleMaximise(),this.layoutManager.startComponentDrag(t,e,i,n,this)}createHeaderConfig(){if(this._headerSideChanged){const t=!!this._header.show&&this._header.side;let e=G.Header.createCopy(this._headerConfig,t);return void 0===e&&(e={show:t,popout:void 0,maximise:void 0,close:void 0,minimise:void 0,tabDropdown:void 0}),e}return G.Header.createCopy(this._headerConfig)}emitStateChangedEvent(){this.emitBaseBubblingEvent("stateChanged")}}!function(t){t.createElement=function(t){const e=t.createElement("div");return e.classList.add("lm_item"),e.classList.add("lm_stack"),e}}(Dt||(Dt={}));class kt extends Ct{constructor(t,e,i,n,o,s){if(super(),this._dragListener=i,this._layoutManager=n,this._componentItem=o,this._originalParent=s,this._area=null,this._lastValidArea=null,this._dragListener.on("drag",((t,e,i)=>this.onDrag(t,e,i))),this._dragListener.on("dragStop",(()=>this.onDrop())),this.createDragProxyElements(t,e),null===this._componentItem.parent)throw new M("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 Dt&&this._originalParent.headerShow&&(this._sided=this._originalParent.headerLeftRightSided,this._element.classList.add("lm_"+this._originalParent.headerSide),[R.right,R.bottom].indexOf(this._originalParent.headerSide)>=0&&this._proxyContainerElement.insertAdjacentElement("afterend",i)),this._element.style.left=rt(t),this._element.style.top=rt(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 P("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=rt(t),this._element.style.top=rt(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 M("DPOD30011");let e;if(t.hide(),this._componentItem.exitDragMode(),null!==this._area)e=this._componentItem,this._area.contentItem.onDrop(e,this._area);else if(null!==this._lastValidArea){e=this._componentItem;this._lastValidArea.contentItem.onDrop(e,this._lastValidArea)}else 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=rt(e),this._element.style.height=rt(i),e-=this._sided?n:0,i-=this._sided?0:n,this._proxyContainerElement.style.width=rt(e),this._proxyContainerElement.style.height=rt(i),this._componentItem.enterDragMode(e,i),this._componentItem.show()}}class Rt{constructor(t,e,i,n,o,s,r){this._layoutManager=t,this._element=e,this._extraAllowableChildTargets=i,this._componentTypeOrFtn=n,this._componentState=o,this._title=s,this._id=r,this._dragListener=null,this._dummyGroundContainer=document.createElement("div");const a=j.createDefault("row");this._dummyGroundContentItem=new Lt(this._layoutManager,a,this._dummyGroundContainer),this.createDragListener()}destroy(){this.removeDragListener()}createDragListener(){this.removeDragListener(),this._dragListener=new Et(this._element,this._extraAllowableChildTargets),this._dragListener.on("dragStart",((t,e)=>this.onDragStart(t,e))),this._dragListener.on("dragStop",(()=>this.onDragStop()))}onDragStart(t,e){var i;const n="component";let o;if("function"==typeof this._componentTypeOrFtn){const t=this._componentTypeOrFtn();o=Rt.isDragSourceComponentItemConfig(t)?{type:n,componentState:t.state,componentType:t.type,title:null!==(i=t.title)&&void 0!==i?i:this._title}:t}else o={type:n,componentState:this._componentState,componentType:this._componentTypeOrFtn,title:this._title,id:this._id};const s=et.resolve(o,!1),r=new It(this._layoutManager,s,this._dummyGroundContentItem);if(this._dummyGroundContentItem.contentItems.push(r),null===this._dragListener)throw new M("DSODSD66746");{const i=new kt(t,e,this._dragListener,this._layoutManager,r,this._dummyGroundContentItem),n=this._layoutManager.transitionIndicator;if(null===n)throw new M("DSODST66746");n.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)}}(Rt||(Rt={}));class Ut{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=rt(t.x1+e),this._element.style.top=rt(t.y1+e),this._element.style.width=rt(t.x2-t.x1-e),this._element.style.height=rt(t.y2-t.y1-e),this._element.style.display="block"}hide(){mt(this._element,!1)}}class Ht{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 Wt extends Ct{constructor(t){super(),this._layoutManager=t,this._childEventListener=t=>this.onEventFromChild(t),globalThis.addEventListener(Wt.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(Wt.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}},n=new CustomEvent(Wt.ChildEventName,i),o=globalThis.opener;if(null===o)throw new M("EHPTP15778");o.dispatchEvent(n)}propagateToThisAndSubtree(t,e){this.emitUnknown(t,...e);for(let i=0;i<this._layoutManager.openPopouts.length;i++){const n=this._layoutManager.openPopouts[i].getGlInstance();n&&n.eventHub.propagateToThisAndSubtree(t,e)}}}!function(t){t.ChildEventName="gl_child_event"}(Wt||(Wt={}));class Bt extends Ct{constructor(t){super(),this.resizeWithContainerAutomatically=!1,this.resizeDebounceInterval=100,this.resizeDebounceExtendedWhenPossible=!0,this._isInitialised=!1,this._groundItem=void 0,this._openPopouts=[],this._dropTargetIndicator=null,this._transitionIndicator=null,this._itemAreas=[],this._maximisePlaceholder=Bt.createMaximisePlaceElement(document),this._tabDropPlaceholder=Bt.createTabDropPlaceholderElement(document),this._dragSources=[],this._updatingColumnsResponsive=!1,this._firstLoad=!0,this._eventHub=new Wt(this),this._width=null,this._height=null,this._virtualSizedContainers=[],this._virtualSizedContainerAddingBeginCount=0,this._sizeInvalidationBeginCount=0,this._resizeObserver=new ResizeObserver((()=>this.handleContainerResize())),this._windowBeforeUnloadListener=()=>this.onBeforeUnload(),this._windowBeforeUnloadListening=!1,this._maximisedStackBeforeDestroyedListener=t=>this.cleanupBeforeMaximisedStackDestroyed(t),this.isSubWindow=t.isSubWindow,this._constructorOrSubWindowLayoutConfig=t.constructorOrSubWindowLayoutConfig,T.checkInitialise(),V.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 Y.minifyConfig(t)}unminifyConfig(t){return Y.unminifyConfig(t)}init(){let t;if(this.setContainer(),this._dropTargetIndicator=new Ut,this._transitionIndicator=new Ht,this.updateSizeFromContainer(),this.isSubWindow){if(void 0===this._constructorOrSubWindowLayoutConfig)throw new P("LMIU07155");{const e=this._constructorOrSubWindowLayoutConfig.root;if(void 0===e)throw new z("LMIC07156");if(!K.isComponent(e))throw new z("LMIC07157");t=e;const i=ot.resolve(this._constructorOrSubWindowLayoutConfig);this.layoutConfig=Object.assign(Object.assign({},i),{root:void 0})}}else void 0===this._constructorOrSubWindowLayoutConfig?this.layoutConfig=Y.createDefault():this.layoutConfig=ot.resolve(this._constructorOrSubWindowLayoutConfig);const e=this.layoutConfig;this._groundItem=new Lt(this,e.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 P("LMLL11119");this.createSubWindows(),this.layoutConfig=ot.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 P("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<this._openPopouts.length;t++)i.push(this._openPopouts[t].toConfig());return{root:e,openPopouts:i,settings:Y.Settings.createCopy(this.layoutConfig.settings),dimensions:Y.Dimensions.createCopy(this.layoutConfig.dimensions),header:Y.Header.createCopy(this.layoutConfig.header),resolved:!0}}}clear(){if(void 0===this._groundItem)throw new P("LMCL11129");this._groundItem.clearRoot()}toConfig(){return this.saveLayout()}newComponent(t,e,i){const n=this.newComponentAtLocation(t,e,i);if(void 0===n)throw new z("LMNC65588");return n}newComponentAtLocation(t,e,i,n){if(void 0===this._groundItem)throw new Error("Cannot add component before init");{const o=this.addComponentAtLocation(t,e,i,n);if(void 0===o)return;{const t=o.parentItem.contentItems[o.index];if(bt.isComponentItem(t))return t;throw new z("LMNC992877533")}}}addComponent(t,e,i){const n=this.addComponentAtLocation(t,e,i);if(void 0===n)throw new z("LMAC99943");return n}addComponentAtLocation(t,e,i,n){const o={type:"component",componentType:t,componentState:e,title:i};return this.addItemAtLocation(o,n)}newItem(t){const e=this.newItemAtLocation(t);if(void 0===e)throw new z("LMNC65588");return e}newItemAtLocation(t,e){if(void 0===this._groundItem)throw new Error("Cannot add component before init");{const i=this.addItemAtLocation(t,e);if(void 0===i)return;return i.parentItem.contentItems[i.index]}}addItem(t){const e=this.addItemAtLocation(t);if(void 0===e)throw new z("LMAI99943");return e}addItemAtLocation(t,e){if(void 0===this._groundItem)throw new Error("Cannot add component before init");{void 0===e&&(e=Bt.defaultLocationSelectors);const i=this.findFirstLocation(e);if(void 0===i)return;{let e,n=i.parentItem;switch(n.type){case B.ground:e=n.addItem(t,i.index),e>=0?n=this._groundItem.contentItems[0]:e=0;break;case B.row:case B.column:e=n.addItem(t,i.index);break;case B.stack:if(K.isComponent(t)){e=n.addItem(t,i.index);break}throw Error(A[6]);case B.component:throw new z("LMAIALC87444602");default:throw new L("LMAIALU98881733",n.type)}if(K.isComponent(t)){const t=n.contentItems[e];bt.isStack(t)&&(n=t,e=0)}return i.parentItem=n,i.index=e,i}}}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 P("LMUS18881");if(this._groundItem.setSize(this._width,this._height),this._maximisedStack){const{width:t,height:e}=ct(this._containerElement);ht(this._maximisedStack.element,t),dt(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}=ct(this._containerElement);this.setSize(t,e)}updateRootSize(t=!1){if(void 0===this._groundItem)throw new P("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 b("Missing parameter 'type'",JSON.stringify(t));if(N.isComponentItem(t)&&!(e instanceof Dt)&&e&&!(!0===this.isSubWindow&&e instanceof Lt)){t={type:B.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}}return this.createContentItemFromConfig(t,e)}findFirstComponentItemById(t){if(void 0===this._groundItem)throw new P("LMFFCIBI82446");return this.findFirstContentItemTypeByIdRecursive(B.component,t,this._groundItem)}createPopout(t,e,i,n){return t instanceof bt?this.createPopoutFromContentItem(t,e,i,n):this.createPopoutFromItemConfig(t,e,i,n)}createPopoutFromContentItem(t,e,i,n){let o=t.parent,s=t;for(;null!==o&&1===o.contentItems.length&&!o.isGround;)s=o,o=o.parent;if(null===o)throw new M("LMCPFCI00834");{if(void 0===n&&(n=o.contentItems.indexOf(s)),null!==i&&o.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}=ct(t.element);e={left:i+o,top:n+s,width:r,height:a}}const r=t.toConfig();if(t.remove(),q.isRootItemConfig(r))return this.createPopoutFromItemConfig(r,e,i,n);throw new Error(`${A[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;e<t;e++){this._virtualSizedContainers[e].notifyVirtualRectingRequired()}this.fireAfterVirtualRectingEvent(),this._virtualSizedContainers.length=0}}}fireBeforeVirtualRectingEvent(t){void 0!==this.beforeVirtualRectingEvent&&this.beforeVirtualRectingEvent(t)}fireAfterVirtualRectingEvent(){void 0!==this.afterVirtualRectingEvent&&this.afterVirtualRectingEvent()}createPopoutFromItemConfig(t,e,i,n){const o=this.toConfig(),s={root:t,openPopouts:[],settings:o.settings,dimensions:o.dimensions,header:o.header,window:e,parentId:i,indexInParent:n,resolved:!0};return this.createPopoutFromPopoutLayoutConfig(s)}createPopoutFromPopoutLayoutConfig(t){var e,i,n,o;const s=t.window,r={left:null!==(e=s.left)&&void 0!==e?e:globalThis.screenX||globalThis.screenLeft+20,top:null!==(i=s.top)&&void 0!==i?i:globalThis.screenY||globalThis.screenTop+20,width:null!==(n=s.width)&&void 0!==n?n:500,height:null!==(o=s.height)&&void 0!==o?o:309},a=new wt(t,r,this);return a.on("initialised",(()=>this.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;t<this._openPopouts.length;t++)this._openPopouts[t].close();this._openPopouts.length=0,this._windowBeforeUnloadListening&&(globalThis.removeEventListener("beforeunload",this._windowBeforeUnloadListener),this._windowBeforeUnloadListening=!1)}newDragSource(t,e,i,n,o){const s=new Rt(this,t,[],e,i,n,o);return this._dragSources.push(s),s}removeDragSource(t){!function(t,e){const i=e.indexOf(t);if(-1===i)throw new Error("Can't remove item from array. Item is not in the array");e.splice(i,1)}(t,this._dragSources),t.destroy()}startComponentDrag(t,e,i,n,o){new kt(t,e,i,this,n,o)}focusComponent(t,e=!1){t.focus(e)}clearComponentFocus(t=!1){this.setFocusedComponentItem(void 0,t)}setFocusedComponentItem(t,e=!1){if(t!==this._focusedComponentItem){let i;if(void 0===t||(i=t.parentItem),void 0!==this._focusedComponentItem){const t=this._focusedComponentItem;this._focusedComponentItem=void 0,t.setBlurred(e);const n=t.parentItem;i===n?i=void 0:n.setFocusedValue(!1)}void 0!==t&&(this._focusedComponentItem=t,t.setFocused(e),void 0!==i&&i.setFocusedValue(!0))}}createContentItemFromConfig(t,e){switch(t.type){case B.ground:throw new z("LMCCIFC68871");case B.row:return new zt(!1,this,t,e);case B.column:return new zt(!0,this,t,e);case B.stack:return new Dt(this,t,e);case B.component:return new It(this,t,e);default:throw new L("CCC913564",t.type,"Invalid Config Item type specified")}}setMaximisedStack(t){void 0===t?void 0!==this._maximisedStack&&this.processMinimiseMaximisedStack():t!==this._maximisedStack&&(void 0!==this._maximisedStack&&this.processMinimiseMaximisedStack(),this.processMaximiseStack(t))}checkMinimiseMaximisedStack(){void 0!==this._maximisedStack&&this._maximisedStack.minimise()}cleanupBeforeMaximisedStackDestroyed(t){null!==this._maximisedStack&&this._maximisedStack===t.target&&(this._maximisedStack.off("beforeItemDestroyed",this._maximisedStackBeforeDestroyedListener),this._maximisedStack=void 0)}closeWindow(){globalThis.setTimeout((()=>globalThis.close()),1)}getArea(t,e){let i=null,n=1/0;for(let o=0;o<this._itemAreas.length;o++){const s=this._itemAreas[o];t>=s.x1&&t<s.x2&&e>=s.y1&&e<s.y2&&n>s.surface&&(n=s.surface,i=s)}return i}calculateItemAreas(){const t=this.getAllContentItems(),e=this._groundItem;if(void 0===e)throw new P("LMCIAR44365");if(1!==t.length){e.contentItems[0].isStack?this._itemAreas=[]:this._itemAreas=e.createSideAreas();for(let e=0;e<t.length;e++){const i=t[e];if(bt.isStack(i)){const t=i.getArea();if(null===t)continue;{this._itemAreas.push(t);const e=i.contentAreaDimensions;if(void 0===e)throw new P("LMCIASC45599");{const t=e.header.highlightArea,n=(t.x2-t.x1)*(t.y2-t.y1),o={x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2,contentItem:i,surface:n};this._itemAreas.push(o)}}}}}else{const t=e.getElementArea();if(null===t)throw new M("LMCIARA44365");this._itemAreas=[t]}}checkLoadedLayoutMaximiseItem(){if(void 0===this._groundItem)throw new P("LMCLLMI43432");{const t=this._groundItem.getConfigMaximisedItems();if(t.length>0){let e=t[0];if(bt.isComponentItem(e)){const t=e.parent;if(null===t)throw new M("LMXLLMI69999");e=t}if(!bt.isStack(e))throw new z("LMCLLMI19993");e.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 P("LMMXI19993");{this._groundItem.element.prepend(t.element);const{width:e,height:i}=ct(this._containerElement);ht(t.element,e),dt(t.element,i),t.updateSize(!0),t.focusActiveContentItem(),this._maximisedStack.emit("maximised"),this.emit("stateChanged")}}processMinimiseMaximisedStack(){if(void 0===this._maximisedStack)throw new z("LMMMS74422");{const t=this._maximisedStack;if(null===t.parent)throw new M("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._openPopouts.length;e++)!1===this._openPopouts[e].getWindow().closed?t.push(this._openPopouts[e]):this.emit("windowClosed",this._openPopouts[e]);this._openPopouts.length!==t.length&&(this._openPopouts=t,this.emit("stateChanged"))}getAllContentItems(){if(void 0===this._groundItem)throw new P("LMGACI13130");return this._groundItem.getAllContentItems()}createSubWindows(){for(let t=0;t<this.layoutConfig.openPopouts.length;t++){const e=this.layoutConfig.openPopouts[t];this.createPopoutFromPopoutLayoutConfig(e)}}handleContainerResize(){this.resizeWithContainerAutomatically&&this.processResizeWithDebounce()}processResizeWithDebounce(){this.resizeDebounceExtendedWhenPossible&&this.checkClearResizeTimeout(),void 0===this._resizeTimeoutId&&(this._resizeTimeoutId=setTimeout((()=>{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 P("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 P("LMACR77412");{const t=this._groundItem.contentItems[0].contentItems.length;if(t<=1)return;{const e=this.layoutConfig.dimensions.defaultMinItemWidth;if(t*e<=this._width)return;{this._updatingColumnsResponsive=!0;const i=t-Math.max(Math.floor(this._width/e),1),n=this._groundItem.contentItems[0],o=this.getAllStacks();if(0===o.length)throw new z("LMACRS77413");{const t=o[0];for(let e=0;e<i;e++){const e=n.contentItems[n.contentItems.length-1];this.addChildContentItemsToContainer(t,e)}this._updatingColumnsResponsive=!1}}}}}}useResponsiveLayout(){const t=this.layoutConfig.settings,e=t.responsiveMode===O.always,i=t.responsiveMode===O.onload&&this._firstLoad;return e||i}addChildContentItemsToContainer(t,e){const i=e.contentItems;if(e instanceof Dt)for(let n=0;n<i.length;n++){const o=i[n];e.removeChild(o,!0),t.addChild(o)}else for(let e=0;e<i.length;e++){const n=i[e];this.addChildContentItemsToContainer(t,n)}}getAllStacks(){if(void 0===this._groundItem)throw new P("LMFASC52778");{const t=[];return this.findAllStacksRecursive(t,this._groundItem),t}}findFirstContentItemType(t){if(void 0===this._groundItem)throw new P("LMFFCIT82446");return this.findFirstContentItemTypeRecursive(t,this._groundItem)}findFirstContentItemTypeRecursive(t,e){const i=e.contentItems,n=i.length;if(0!==n){for(let e=0;e<n;e++){const n=i[e];if(n.type===t)return n}for(let e=0;e<n;e++){const n=i[e],o=this.findFirstContentItemTypeRecursive(t,n);if(void 0!==o)return o}}}findFirstContentItemTypeByIdRecursive(t,e,i){const n=i.contentItems,o=n.length;if(0!==o){for(let i=0;i<o;i++){const o=n[i];if(o.type===t&&o.id===e)return o}for(let i=0;i<o;i++){const o=n[i],s=this.findFirstContentItemTypeByIdRecursive(t,e,o);if(void 0!==s)return s}}}findAllStacksRecursive(t,e){const i=e.contentItems;for(let e=0;e<i.length;e++){const n=i[e];n instanceof Dt?t.push(n):n.isComponent||this.findAllStacksRecursive(t,n)}}findFirstLocation(t){const e=t.length;for(let i=0;i<e;i++){const e=t[i],n=this.findLocation(e);if(void 0!==n)return n}}findLocation(t){const e=t.index;switch(t.typeId){case 0:if(void 0===this._focusedComponentItem)return;{const t=this._focusedComponentItem.parentItem,i=t.contentItems,n=i.length;if(void 0===e)return{parentItem:t,index:n};{const o=i.indexOf(this._focusedComponentItem)+e;return o<0||o>n?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(B.stack);return void 0===t?void 0:this.tryCreateLocationFromParentItem(t,e)}case 3:{let t=this.findFirstContentItemType(B.row);return void 0!==t?this.tryCreateLocationFromParentItem(t,e):(t=this.findFirstContentItemType(B.column),void 0!==t?this.tryCreateLocationFromParentItem(t,e):void 0)}case 4:{const t=this.findFirstContentItemType(B.row);return void 0===t?void 0:this.tryCreateLocationFromParentItem(t,e)}case 5:{const t=this.findFirstContentItemType(B.column);return void 0===t?void 0:this.tryCreateLocationFromParentItem(t,e)}case 6:if(void 0===this._groundItem)throw new P("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 P("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}]}(Bt||(Bt={}));class Ot extends Bt{constructor(t,e,i,n){if(super(Ot.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 P("VLC98823");{const t=ot.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;i<e.length;i++){const n=e[i];for(let e=0;e<n.length;e++){const i=n[e];t.appendChild(i)}}const i=document.body;i.innerHTML="",i.style.visibility="visible",this.checkAddDefaultPopinButton(),document.body.offsetHeight}checkAddDefaultPopinButton(){if(this.layoutConfig.settings.popInOnClose)return!1;{const t=document.createElement("div");t.classList.add("lm_popin"),t.setAttribute("title",this.layoutConfig.header.dock);const e=document.createElement("div");e.classList.add("lm_icon");const i=document.createElement("div");return i.classList.add("lm_bg"),t.appendChild(e),t.appendChild(i),t.addEventListener("click",(()=>this.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=`${A[2]}: ${JSON.stringify(e)}`;throw new E(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 P("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=Y.unminifyConfig(i);r=ot.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}}}(Ot||(Ot={}));class Ft extends Ot{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 S("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(A[1]);if(void 0!==this._componentTypesMap.get(t))throw new E(`${A[3]}: ${t}`);this._componentTypesMap.set(t,{constructor:e,factoryFunction:void 0,virtual:i})}registerComponentFactoryFunction(t,e,i=!1){if("function"!=typeof e)throw new E("Please register a constructor function");if(void 0!==this._componentTypesMap.get(t))throw new E(`${A[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=$.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,e){let i;const n=$.resolveComponentTypeName(e);let o;if(void 0!==n&&(i=this._componentTypesMap.get(n)),void 0===i&&void 0!==this._getComponentConstructorFtn&&(i={constructor:this._getComponentConstructorFtn(e),factoryFunction:void 0,virtual:!1}),void 0!==i){const s=i.virtual;let r,a;r=void 0===e.componentState?void 0:pt({},e.componentState);const l=i.constructor;if(void 0!==l)a=new l(t,r,s);else{const e=i.factoryFunction;if(void 0===e)throw new z("LMBCFFU10008");a=e(t,r,s)}if(s){if(void 0===a)throw new P("GLBCVCU988774");{const e=a,i=e.rootHtmlElement;if(void 0===i)throw new E(`${A[5]}: ${n}`);!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,a),o={virtual:i.virtual,component:a}}else o=super.bindComponent(t,e);return o}unbindComponent(t,e,i){if(void 0===this._registeredComponentMap.get(t))super.unbindComponent(t,e,i);else{const e=this._virtuableComponentMap.get(t);if(void 0!==e){const i=e.rootHtmlElement;if(void 0===i)throw new z("GLUC77743",t.title);this.container.removeChild(i),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 P("GLHCSCE55933");{const o=n.rootHtmlElement;if(void 0===o)throw new E(A[4]+" "+t.title);{const n=t.element.getBoundingClientRect(),s=n.left-this._goldenLayoutBoundingClientRect.left;o.style.left=rt(s);const r=n.top-this._goldenLayoutBoundingClientRect.top;o.style.top=rt(r),ht(o,e),dt(o,i)}}}handleContainerVirtualVisibilityChangeRequiredEvent(t,e){const i=this._virtuableComponentMap.get(t);if(void 0===i)throw new P("GLHCVVCRE55934");{const n=i.rootHtmlElement;if(void 0===n)throw new E(A[4]+" "+t.title);mt(n,e)}}handleContainerVirtualZIndexChangeRequiredEvent(t,e,i){const n=this._virtuableComponentMap.get(t);if(void 0===n)throw new P("GLHCVZICRE55935");{const e=n.rootHtmlElement;if(void 0===e)throw new E(A[4]+" "+t.title);e.style.zIndex=i}}}const Vt="initial_",Nt={show:"top",popout:!1,maximise:!1,close:"close-tab-unused"},Gt={headerHeight:31},Zt={hasHeaders:!0,reorderEnabled:!0},$t={popoutWholeStack:!1,constrainDragToContainer:!1,constrainDragToHeaders:!1,preventDragout:!1,showMaximiseIcon:!1,showPopoutIcon:!1,showCloseIcon:!1,blockedPopoutsThrowError:!0,closePopoutsOnUnload:!0,selectionEnabled:!1};var jt,qt;class Xt{constructor(e){this.layout=e,jt.set(this,void 0),qt.set(this,void 0),this.handleResize=t=>{t.forEach((t=>this.resizeElement(t.target)))},this.handleMutation=()=>{this.layout.viewComponentsByContainerElement.forEach((t=>{this.resizeElement(t.container.element)}))},t.__classPrivateFieldSet(this,jt,new ResizeObserver(this.handleResize),"f"),t.__classPrivateFieldSet(this,qt,new MutationObserver(this.handleMutation),"f")}observeMutations(e){t.__classPrivateFieldGet(this,qt,"f")?.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]})}destroy(){t.__classPrivateFieldGet(this,jt,"f").disconnect(),t.__classPrivateFieldGet(this,qt,"f").disconnect()}observeContainer(e){t.__classPrivateFieldGet(this,jt,"f").observe(e)}unobserveContainer(e){t.__classPrivateFieldGet(this,jt,"f").unobserve(e)}resizeElement(t){const e=this.layout.viewComponentsByContainerElement.get(t);e&&e.resize()}}function Yt(t=[],e){for(const i of t)"component"===i.type?Object.keys(e).forEach((t=>{t in i&&(i.componentState={[`${Vt}${t}`]:i[t],...i.componentState}),i[t]=e[t]})):Yt(i.content,e)}function Jt(t=[],e,i){for(const n of t)if("component"===n.type)Object.keys(e).forEach((t=>{if(`${Vt}${t}`in n.componentState)return n[t]=n.componentState[`${Vt}${t}`],void delete n.componentState[`${Vt}${t}`];n[t]=e[t]}));else{if(n.size&&("row"===i||"column"===i)){n["row"===i?"width":"height"]=n.size?.includes(".")?parseFloat(n.size):parseInt(n.size)}Jt(n.content,e,n.type)}}function Kt(t){if(t.root){t.root.content&&Jt([t.root],{componentName:"view",isClosable:!0});const e=t.root;t.content=[e],delete t.root}return t}jt=new WeakMap,qt=new WeakMap;const Qt=e=>class extends e{connectedCallback(){if(!this.name||!this.uuid)throw new Error("<of-view> Name or uuid attribute missing");if(!this.src)throw new Error("<of-view> missing 'src' attribute.");this.#t||(this.#t=document.createElement("iframe"),this.#t.src=this.src,this.#t.style.height="100%",this.#t.style.width="100%",this.#t.style.border="none",this.forceFrameName?this.#t.setAttribute("name",this.forceFrameName):this.#t.setAttribute("name",t.encodeOptions({brokerUrl:this.brokerUrl,name:this.name,uuid:this.uuid,providerId:this.providerId,contextGroup:this.contextGroup},"of-frame")),this.#t.setAttribute("id",this.name),this.appendChild(this.#t))}#t;get brokerUrl(){return this.getAttribute("of-broker")}set brokerUrl(t){t&&this.setAttribute("of-broker",t)}get name(){return this.getAttribute("of-name")}set name(t){t&&this.setAttribute("of-name",t)}get forceFrameName(){return this.getAttribute("forceFrameName")}set forceFrameName(t){t&&this.setAttribute("forceFrameName",t)}get uuid(){return this.getAttribute("of-uuid")}set uuid(t){t&&this.setAttribute("of-uuid",t)}get src(){return this.getAttribute("src")}set src(t){t&&this.setAttribute("src",t)}get providerId(){return this.getAttribute("of-provider-id")}set providerId(t){t&&this.setAttribute("of-provider-id",t)}get contextGroup(){return this.getAttribute("of-context-group")}set contextGroup(t){t&&this.setAttribute("of-context-group",t)}static get observedAttributes(){return["name"]}};class te{static create(t){const e=document.createElement("of-view");return Object.entries(t).forEach((([t,i])=>{e.setAttribute(t,i)})),e}}customElements.define("of-view",Qt(HTMLElement));class ee{constructor(t,i,n,{brokerUrl:o,interopConfig:s},r){this.container=t,this.config=i,this.ofView=null,this.isDragging=()=>this.container.tab.element?.className.includes("lm_dragging")??!1;const{url:a,web:l,interop:h}=i||{},d=`internal-generated-view-${e.v4()}`;if(this.identity={uuid:n,name:d},this.container.element.setAttribute("of-name",d),this.container.element.id=`container-${d}`,void 0===a)return void this.handleUrlMissing();const c=this.updateTitleIfNotSet(a),m={"of-broker":o,"of-uuid":n,"of-name":d,src:a};l?.frameName&&(m.forceFrameName=l.frameName);const u=h?.currentContextGroup??s?.currentContextGroup;u&&(m["of-context-group"]=u),s?.providerId&&(m["of-provider-id"]=s?.providerId),this.ofView=te.create(m),this.ofView.title=c??`Iframe: ${a}`,r.appendChild(this.ofView),this.ofView.style.position="absolute"}updateTitleIfNotSet(t){return"view"===this.container.parent.title&&this.container.parent.setTitle(t),this.container.parent.title}handleUrlMissing(){const t=document.createElement("div");t.setAttribute("style","padding: 20px");t.innerText="No URL provided",this.container.element.appendChild(t)}destroy(){this.ofView?.remove(),this.ofView=null}resize(){if(this.ofView){if(this.isDragging())return void(this.ofView.style.display="none");const t=this.container.element.getBoundingClientRect();this.ofView.style.position="absolute",this.ofView.style.height=`${t.height}px`,this.ofView.style.width=`${t.width}px`,this.ofView.style.inset=`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`,this.ofView.style.display="block"}}}class ie extends f{getStackByView(t){throw new Error("Method not implemented.")}getRoot(){throw new Error("Method not implemented.")}static overrideConfig(t){const e={...Zt,...t.settings,...$t};return e.reorderEnabled?Yt(t.content,{isClosable:!0}):Yt(t.content,{reorderEnabled:!1}),{dimensions:Gt,...t,settings:e,header:{...Nt,show:!1!==t.settings?.hasHeaders&&Nt.show}}}constructor(t,e,i,{options:n},o){super(),this.identity=t,this.container=e,this.initialConfig=i,this.layoutManager=o,this.viewComponentsByContainerElement=new Map,this.createViewComponent=(t,e)=>{const i=new ee(t,e,this.identity.uuid,this.options,this.iframeContainer);return e&&!1===e[`${Vt}isClosable`]&&this.stylesheet.insertRule(`#tab-${i.identity.name} .lm_close_tab { display: none; }`),this.viewComponentsByContainerElement.set(t.element,i),this.resizeController.observeContainer(t.element),i},this.iframeContainer=document.createElement("div"),this.iframeContainer.id=`openfin-layout-iframe-container-${this.identity.layoutName}`,this.domEmitter=new v(e),this.setupStylesheets(),this.layout=new Ft(this.container),this.layout.resizeWithContainerAutomatically=!0,this.options=n,this.layout.registerComponent("view",this.createViewComponent),this.setupListeners(),this.resizeController=new Xt(this),this.layout.loadLayout(ie.overrideConfig(i));const s=document.createElement("div");s.id=`openfin-layout-shadow-container-${this.identity.layoutName}`,s.attachShadow({mode:"open",delegatesFocus:!1}).appendChild(this.iframeContainer),this.container.appendChild(s),this.resizeController.observeMutations(this.container)}setupStylesheets(){if(this.container.setAttribute("data-openfin-layout-name",this.identity.layoutName),this.stylesheet=new CSSStyleSheet,this.stylesheet.insertRule(".lm_close { display: none; }"),document.adoptedStyleSheets.push(this.stylesheet),this.initialConfig.settings?.preventSplitterResize){const t=`\n [data-openfin-layout-name='${this.identity.layoutName}'] .lm_splitter {\n pointer-events: none;\n }`;this.stylesheet.insertRule(t)}}addView(t){throw new Error("Method not implemented.")}replaceView({viewToReplace:t,newView:e}){throw new Error("Method not implemented.")}replaceLayout(t){throw new Error("Method not implemented.")}closeView(t){throw new Error("Method not implemented.")}applyPreset(t){throw new Error("Method not implemented.")}getCurrentViews(){return[...this.viewComponentsByContainerElement.values()].map((t=>t.identity))}async getFrameSnapshot(){return Kt(ot.fromResolved(this.layout.toConfig()))}isVisible(){return y(this.container)}async onViewDetached(){throw new Error("Method not implemented.")}async destroy(){this.layout.destroy(),this.iframeContainer.remove(),this.resizeController.destroy(),document.adoptedStyleSheets=document.adoptedStyleSheets.filter((t=>t!==this.stylesheet)),this.viewComponentsByContainerElement.clear()}setupListeners(){this.container.addEventListener("pointerdown",(t=>{if(t.target instanceof HTMLElement){const e=t.target.classList;["lm_tab","lm_title","lm_splitter","lm_drag_handle"].some((t=>e.contains(t)))&&(this.handleDragStart(),2===t.button&&t.stopPropagation())}}),!0),document.addEventListener("pointerup",(()=>this.handleDragEnd()),!0),this.layout.on("tabCreated",(t=>{const i=t.componentItem.container.element.getAttribute("of-name")??e.v4(),n={name:i,uuid:i};t.element.id=`tab-${i}`,this.domEmitter.dispatchLocalEvent("tab-created",n)})),this.layout.on("itemCreated",(({target:t})=>{const i=t;if(!i.isComponent)return;const n=i.element.querySelector("[of-name]")?.getAttribute("of-name")??e.v4(),o={name:n,uuid:n};this.domEmitter.dispatchLocalEvent("container-created",o)})),this.layout.on("itemDestroyed",(t=>{if(!t.target.isComponent)return;const e=t.target;this.removeViewComponent(e.component)})),this.layout.on("itemDropped",(()=>{this.handleDragEnd()}))}handleDragStart(){this.iframeContainer.style.pointerEvents="none"}handleDragEnd(){this.iframeContainer.style.pointerEvents=""}removeViewComponent(t){if(t.config&&!1===t.config[`${Vt}isClosable`]){const e=[...this.stylesheet.cssRules].findIndex((e=>e.cssText.includes(`#tab-${t.identity.name}`)));this.stylesheet.deleteRule(e)}t.destroy(),this.viewComponentsByContainerElement.delete(t.container.element),this.resizeController.unobserveContainer(t.container.element);0===this.getCurrentViews().length&&m.handleLastViewRemoved(this.layoutManager,this.identity)}}class ne{constructor(t,e,i){this.windowIdentity=t,this.connectConfig=e,this.fallbackContainer=i}async createLayout(t,e){if(!("container"in t)&&!this.fallbackContainer)throw new Error("Container property is not optional in web");const{layout:i,layoutName:n}=t,o=t.container??this.fallbackContainer,s={...this.windowIdentity,layoutName:n};this.webLayout=new ie(s,o,i,this.connectConfig,e),m.registerLayout(e,n,this.webLayout),this.fallbackContainer=null}async getLayoutSnapshot(t){return t.getLayoutSnapshot()}async handleLastViewRemoved(t){}}var oe;const se=t=>t;oe=new WeakMap,exports.WebLayoutEntryPoint=class{constructor(e){oe.set(this,void 0),this.initLayoutManager=async(e,i,{container:n,layoutManagerOverride:o})=>{const s=o??se,r=new ne(i.me,t.__classPrivateFieldGet(this,oe,"f"),n);return new(s(m.createClosedConstructor(r)))},this.applyLayoutSnapshot=async(e,i,n)=>{await i.applyLayoutSnapshot(t.__classPrivateFieldGet(this,oe,"f").platform.layoutSnapshot)},this.createLayout=async(t,e)=>m.createLayout(t,e),this.destroyLayout=async(t,e)=>m.destroyLayout(t,e),t.__classPrivateFieldSet(this,oe,e,"f")}};
|