@openfin/core-web 0.46.55 → 0.46.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ import{L as t,a as e,_ as i,b as n,i as o,g as s,c as r,e as a,d as l,f as h,r as d,h as c}from"./main-d9c62b11.js";import u from"events";import*as m from"he";import{v4 as p}from"uuid";import"es-toolkit";const f=Symbol("exposedProperties"),g=t=>(e,i,n)=>{e[f]=e[f]||[],e[f].push({key:i,descriptor:n,options:t})};class v{constructor(t){this.strategy=t,this.exposeInstance=async(t,e)=>{const i=(n=t,n?.[f]||n?.prototype?.[f]||[]);var n;const o=await Promise.all(i.map(async({key:i,options:n})=>({key:i,options:await this.strategy.exposeFunction(t[i].bind(t),{key:i,options:n,meta:e})})));await this.strategy.exposeMeta(e,o)}}}class y{constructor(t){this.channelProviderOrClient=t,this.exposeFunction=async(t,e)=>{const{key:i,options:n,meta:o}=e,{id:s}=o,r=`${s}.${n?.action||i}`;return await this.channelProviderOrClient.register(r,async({args:e})=>t(...e)),{action:r}},this.exposeMeta=async({id:t},e)=>{const i=`api-meta:${t}`;await this.channelProviderOrClient.register(i,()=>({props:e}))}}}const _=(t,[e,i])=>({...t,[e]:i});async function w(t,e){let i;return i=e instanceof Map?[...e.entries()]:Object.entries(e),async function(t,e){return(await Promise.all(e.map(async([e,i])=>[e,await t(i,e)]))).reduce(_,{})}(t,i)}function C(t,e,i){if("openfin"===t.environment.type){const{uuid:n,name:o}=t.environment.getCurrentEntityIdentity(),s=`window/${e}/${n}-${o}`,r={layoutIdentity:{layoutName:i,uuid:n,name:o},topic:"window"};t.environment.raiseEvent(s,r)}}function b(t,e){return(t=>"type"in t&&"component"===t.type)(e)?t(e):{...e,content:e.content?.map(e=>b(t,e))}}class I extends Error{constructor(t){super(`Layout snapshot for ${t} could not be generated, layout ${t} is not ready or may be destroyed`),this.type=I.type}static isLayoutNotReadyError(t){return"object"==typeof t&&"type"in t&&t.type===I.type}}I.type="LayoutSnapshotError";var E,S,T,x,L=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},A=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)};class M{constructor(t){S.set(this,void 0),T.set(this,new Map),L(this,S,t,"f")}size(){return A(this,T,"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 M.createLayout(this,{layoutName:e,layout:i}),C(A(this,S,"f").getWire(),"layout-snapshot-applied",e)}async showLayout({layoutName:t}){}async getLayoutSnapshot(){return{layouts:(await Promise.all(Array.from(A(this,T,"f").entries()).map(async([t,e])=>{try{return{layoutName:t,snapshot:await e.getFrameSnapshot()}}catch(e){if(I.isLayoutNotReadyError(e))return void console.info(`Layout ${t} ommited from snapshot`,e.message);throw e}}))).reduce((t,e)=>e?{...t,[e.layoutName]:e.snapshot}:t,{})}}async removeLayout({layoutName:t}){}getLayoutIdentityForView(t){const e=[...A(this,T,"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 A(M,E,"m",x).call(M,this,t).isVisible()}resolveLayoutIdentity(t){if(t&&"layoutName"in t)return t;const e=[...A(this,T,"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 A(M,E,"m",x).call(M,t,i.layoutName)}static async handleSharedView(t,e,i){await w(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)}},A(t,T,"f"))}static async handleLastViewRemoved(t,e){await t.removeLayout(e),await A(t,S,"f").handleLastViewRemoved(t)}static async destroyLayout(t,{layoutName:e}){await A(M,E,"m",x).call(M,t,e).destroy(),A(t,T,"f").delete(e),C(A(t,S,"f").getWire(),"layout-destroyed",e)}static async createLayout(t,e){const{layoutName:i}=e;if(A(t,T,"f").has(i))throw new Error(`Layout name ${i} already exists`);const n=await A(t,S,"f").createLayout(e,t);return C(A(t,S,"f").getWire(),"layout-created",i),n}static registerLayout(t,e,i){A(t,T,"f").set(e,i)}static getAllLayouts(t){return[...A(t,T,"f").values()]}static setInitialSnapshot(t,e){A(t,S,"f").setInitialSnapshot(e)}static createClosedConstructor(...t){return class extends M{constructor(){super(...t)}}}}E=M,S=new WeakMap,T=new WeakMap,x=function(t,e){const i=A(t,T,"f").get(e);if(!i)throw new Error(`[layout-manager] getLayoutByName: Could not locate layout with name '${e}'`);return i};class z{constructor(){this.valueToKey=new Map,this.keyToValue=new Map,this.setUnique=(t,e)=>{if(this.hasKey(t)||this.hasValue(e))throw new Error("Key or value already in the map.");this.keyToValue.set(t,e),this.valueToKey.set(e,t)},this.getKey=t=>{const e=this.valueToKey.get(t);if(!e)throw new Error("Value not found in the map.");return e},this.deleteKey=t=>{const e=this.getValue(t);return this.keyToValue.delete(t),this.valueToKey.delete(e),e},this.deleteValue=t=>{const e=this.getKey(t);return this.keyToValue.delete(e),this.valueToKey.delete(t),e},this.hasKey=t=>this.keyToValue.has(t),this.hasValue=t=>this.valueToKey.has(t)}getValue(t){const e=this.keyToValue.get(t);if(!e)throw new Error("Key not found in the map.");return e}}class D{constructor(){this.contentItemCache=new z,this.contentItemCacheId=0,this.createCacheKey=()=>{const t=`entity-${this.contentItemCacheId.toString()}`;return this.contentItemCacheId+=1,t},this.hasKey=t=>this.contentItemCache.hasKey(t),this.getItemOrUndefined=t=>{try{return this.getContentItemOrThrow(t)}catch(t){return}},this.getContentItemOrThrow=(t,e)=>{if(!this.contentItemCache.hasKey(t))throw new Error("Layout component has been destroyed or detached from the current layout.");const i=this.contentItemCache.getValue(t);if(e&&!e.includes(i.type))throw new Error(`Layout item is not the expected type. Expected ${e.join(", ")}, got ${i.type}.`);return i},this.evictIfPresent=t=>{this.contentItemCache.hasKey(t)&&this.contentItemCache.deleteKey(t)},this.getOrCreateEntityId=t=>{if(this.contentItemCache.hasValue(t))return this.contentItemCache.getKey(t);t.onDestroyed(()=>{this.contentItemCache.hasValue(t)&&this.contentItemCache.deleteValue(t)});const e=this.createCacheKey();return this.contentItemCache.setUnique(e,t),e}}static getSingleInstance(){return D.singleton.getValue()}}D.singleton=new t(()=>new D);const k=(t,e)=>{const{parent:i}=t;if(t.isRoot()||!i)return;const n=["top","bottom"].includes(e)?"column":"row",o=["top","left"].includes(e)?-1:1;if(i.type===n){const e=i.contentItems.indexOf(t)+o;if(e>=0&&e<i.contentItems.length)return i.contentItems[e]}return k(i,e)};var P,O,R=function(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,i,r):o(e,i))||r);return s>3&&r&&Object.defineProperty(e,i,r),r};class B{constructor(t,e,i){this.wire=t,this.layoutManager=e,this.layoutContentCache=i,this.analytics=t=>{this.wire.sendAction(`layout-controller-${t}`).catch(()=>{})},this.getLayoutIdentityForViewOrThrow=async t=>{const e=this.layoutManager.getLayoutIdentityForView(t);if(!e)throw new Error(`View identity ${t.name} is not attached to any layouts.`);return e},this.getRoot=async t=>{this.analytics("get-root");const e=(await this.getLayout(t)).getRoot();return{type:e.type,entityId:this.layoutContentCache.getOrCreateEntityId(e)}},this.getStackByView=async t=>{this.analytics("get-stack-by-view");const e=await this.getLayoutIdentityForViewOrThrow(t),i=(await this.getLayout(e)).getStackByView(t);if("stack"===i?.type)return{entityId:this.layoutContentCache.getOrCreateEntityId(i),type:"stack"}},this.getStackViews=t=>{this.analytics("get-stack-views");return this.layoutContentCache.getContentItemOrThrow(t,["stack"]).contentItems.map(t=>({name:t.viewName,uuid:this.wire.me.uuid}))},this.isRoot=t=>{this.analytics("is-root");return this.layoutContentCache.getContentItemOrThrow(t).isRoot()},this.exists=t=>(this.analytics("exists"),this.layoutContentCache.hasKey(t)),this.addViewToStack=async(t,e,{index:i,displayState:n}={index:0,displayState:"focused"})=>{this.analytics("add-view-to-stack");const o=this.layoutContentCache.getContentItemOrThrow(t);if(i&&i>o.contentItems.length+1)throw new Error(`Index '${i}' out of range, please exclude the index or specify a number between 0 and ${o.contentItems.length}`);const s={id:t,index:i,displayState:n},{identity:r}=await o.layout.platformCreateView(e,{location:s});return r},this.findViewInStack=(t,e)=>t.contentItems.find(t=>t.viewName===e.name),this.removeViewFromStack=async(t,e)=>{this.analytics("remove-view-from-stack");const i=this.layoutContentCache.getContentItemOrThrow(t,["stack"]),n=this.findViewInStack(i,e);if(!n)throw new Error(`Tried to remove a view ('${e.name}') which does not belong to the stack.`);const o=i.contentItems.length<=1;await n.layout.platformCloseView(e),(o||0===i.contentItems.length)&&this.layoutContentCache.evictIfPresent(t)},this.createAdjacentStack=async(t,e,{position:i="right"}={})=>{if(this.analytics("create-adjacent-stack"),!Array.isArray(e)||0===e.length)throw new Error('The parameter "views" must be an array with at least 1 element.');if(!["top","bottom","left","right"].includes(i))throw new Error(`Invalid position '${i}' specified.`);const n=this.layoutContentCache.getContentItemOrThrow(t).createAdjacentStack({position:i}),o=this.layoutContentCache.getOrCreateEntityId(n);return await Promise.all(e.reverse().map(t=>this.addViewToStack(o,t))),o},this.getAdjacentStacks=async({targetId:t,edge:e})=>{this.analytics("get-adjacent-stacks");return((t,e)=>{const i=["top","bottom"].includes(e)?"row":"column",n=o=>"stack"===o.type?((t,e,i)=>{const n=t.getBounds(),o=e.getBounds();return!(!n||!o)&&(["top","bottom"].includes(i)?!(n.right<o.left||n.left>o.right):!(n.bottom<o.top||n.top>o.bottom))})(t,o,e)?[o]:[]:"root"===o.type||"ground"===o.type?[]:o.type===i?o.contentItems.map(t=>n(t)).flat():o.type!==i?["top","right"].includes(e)?n(o.contentItems[o.contentItems.length-1]):n(o.contentItems[0]):[],o=k(t,e);return o?n(o):[]})(this.layoutContentCache.getContentItemOrThrow(t),e).map(t=>({entityId:this.layoutContentCache.getOrCreateEntityId(t)}))},this.setStackActiveView=async(t,e)=>{this.analytics("set-stack-active-view");const i=this.layoutContentCache.getContentItemOrThrow(t,["stack"]),n=this.findViewInStack(i,e);if(!n)throw new Error(`Tried to set a view ('${e.name}') as active when it does not belong to the stack.`);i.setActiveContentItem(n,!0)}}async getLayout(t){const e=await M.resolveLayout(this.layoutManager,t);if(!e)throw new Error(`Could not resolve target layout identity ${JSON.stringify(t)}`);return e}getContent(t){this.analytics("get-content");return this.layoutContentCache.getContentItemOrThrow(t,["column","row"]).contentItems.map(t=>({type:t.type,entityId:this.layoutContentCache.getOrCreateEntityId(t)}))}getParent(t){this.analytics("get-parent");const e=this.layoutContentCache.getContentItemOrThrow(t);if(!e.isRoot())return e.parent?.contentItems.includes(e)?{type:e.parent.type,entityId:this.layoutContentCache.getOrCreateEntityId(e.parent)}:void 0}}async function V(t,i){const n=t.getFin(),o=await n.Platform.getCurrentSync().getClient(),s=new y(o);await new v(s).exposeInstance(new B(t,i,D.getSingleInstance()),{id:e}),await async function(t,e){const i=t=>async i=>{const n=await M.resolveLayout(e,i.target);if(!n)throw new Error(`Could not resolve the layout target from payload ${JSON.stringify(i)}`);return t(n,i)},n=(e,n)=>{t.register(e,i(n))},o=(t,e)=>{n(t,e)};n("replace-view",(t,e)=>t.replaceView(e)),n("replace-layout",(t,{layout:e})=>t.replaceLayout(e)),n("add-view",(t,e)=>t.insertView(e)),o("layout-add-view",(t,{viewOptions:e,location:i,targetView:n})=>t.platformCreateView(e,{location:i,targetView:n})),n("close-view",(t,e)=>t.cleanupView(e.viewIdentity)),o("layout-close-view",(t,e)=>t.platformCloseView(e.viewIdentity)),n("apply-preset-layout",(t,e)=>t.applyPreset(e)),n("get-layout-views",t=>t.getCurrentViews()),n("get-frame-snapshot",t=>t.getFrameSnapshot()),n("is-visible",t=>t.isVisible()),n("destroy",t=>t.destroy()),t.register("get-layout-snapshot",()=>e.getLayoutSnapshot())}(o,i)}R([g()],B.prototype,"getLayoutIdentityForViewOrThrow",void 0),R([g()],B.prototype,"getRoot",void 0),R([g()],B.prototype,"getStackByView",void 0),R([g()],B.prototype,"getStackViews",void 0),R([g()],B.prototype,"getContent",null),R([g()],B.prototype,"getParent",null),R([g()],B.prototype,"isRoot",void 0),R([g()],B.prototype,"exists",void 0),R([g()],B.prototype,"addViewToStack",void 0),R([g()],B.prototype,"removeViewFromStack",void 0),R([g()],B.prototype,"createAdjacentStack",void 0),R([g()],B.prototype,"getAdjacentStacks",void 0),R([g()],B.prototype,"setStackActiveView",void 0);class H{constructor(t){this.container=t,P.set(this,new Map)}get element(){return this.container}register(t,e){i(this,P,"f").set(t,e)}unregister(t){i(this,P,"f").delete(t)}get(t){return i(this,P,"f").get(t)}has(t){return i(this,P,"f").has(t)}destroy(){i(this,P,"f").forEach(t=>t.destroy()),i(this,P,"f").clear()}}P=new WeakMap;class N{}class W{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}))}}class U extends Error{constructor(t,e){super(e),this.type=t}}class F extends U{constructor(t,e){super("Configuration",t),this.node=e}}class $ extends U{constructor(t){super("PopoutBlocked",t)}}class q extends U{constructor(t){super("API",t)}}class j extends U{constructor(t){super("Bind",t)}}class G extends Error{constructor(t,e,i){super(`${t}: ${e}${void 0===i?"":": "+i}`)}}class Z extends G{constructor(t,e){super("Assert",t,e)}}class K extends G{constructor(t,e,i){super("UnreachableCase",t,`${e}${void 0===i?"":": "+i}`)}}class Y extends G{constructor(t,e){super("UnexpectedNull",t,e)}}class X extends G{constructor(t,e){super("UnexpectedUndefined",t,e)}}!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}`);J[e]=t.default}e=!0}}(O||(O={}));const J=new Array(O.idCount);var Q,tt,et,it;!function(t){t.defaultComponentBaseZIndex="auto",t.defaultComponentDragZIndex="32",t.defaultComponentStackMaximisedZIndex="41"}(Q||(Q={})),function(t){t.width="width",t.height="height"}(tt||(tt={})),function(t){t.top="top",t.left="left",t.right="right",t.bottom="bottom"}(et||(et={})),function(t){t.base="base",t.drag="drag",t.stackMaximised="stackMaximised"}(it||(it={}));const nt={base:Q.defaultComponentBaseZIndex,drag:Q.defaultComponentDragZIndex,stackMaximised:Q.defaultComponentStackMaximisedZIndex};var ot,st,rt,at,lt,ht,dt,ct,ut,mt,pt,ft,gt,vt,yt,_t,wt,Ct,bt,It,Et,St,Tt,xt,Lt,At,Mt,zt,Dt,kt,Pt,Ot,Rt,Bt,Vt,Ht,Nt,Wt;function Ut(t){return t.toString(10)+"px"}function Ft(t){const e=t.replace("px","");return parseFloat(e)}function $t(t){return t>="0"&&t<="9"}function qt(t,e){const i=Ut(e);t.style.width=i}function jt(t,e){const i=Ut(e);t.style.height=i}function Gt(t){return{width:t.offsetWidth,height:t.offsetHeight}}function Zt(t){const e=getComputedStyle(t);return{width:t.clientWidth-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight),height:t.clientHeight-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom)}}function Kt(t,e){t.style.display=e?"":"none"}function Yt(t,e){if(void 0!==e)for(const i in e)if(e.hasOwnProperty(i)){const n=e[i],o=t[i];t[i]=Xt(o,n)}return t}function Xt(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]=Xt({},t)}return i}if(null===e)return null;{const i=e;if(void 0===t)return Yt({},i);if("object"!=typeof t)return Yt({},i);if(Array.isArray(t))return Yt({},i);if(null===t)return Yt({},i);return Yt(t,i)}}function Jt(){return(1e15*Math.random()).toString(36).replace(".","")}function Qt(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(!$t(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 F(`${J[7]}: ${t}`);{const i=at.tryParse(n);if(void 0===i)throw new F(`${J[8]}: ${t}`);if(e.includes(i))return{size:o,sizeUnit:i};throw new F(`${J[9]}: ${t}`)}}function te(t,e){return t.toString(10)+at.format(e)}function ee(t,e){return void 0===t?void 0:t.toString(10)+at.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}(ot||(ot={})),function(t){t.ground="ground",t.row="row",t.column="column",t.stack="stack",t.component="component"}(st||(st={})),function(t){t.none="none",t.always="always",t.onload="onload"}(rt||(rt={})),function(t){t.Pixel="px",t.Percent="%",t.Fractional="fr",t.Em="em"}(at||(at={})),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 K("SUEF44998",e)}}}(at||(at={})),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","icon"],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}(lt||(lt={})),function(t){t.defaults={type:st.ground,content:[],size:1,sizeUnit:at.Fractional,minSize:void 0,minSizeUnit:at.Pixel,id:"",isClosable:!0},t.createCopy=function(t,e){switch(t.type){case st.ground:case st.row:case st.column:return mt.createCopy(t,e);case st.stack:return ct.createCopy(t,e);case st.component:return ut.createCopy(t);default:throw new K("CICC91354",t.type,"Invalid Config Item type specified")}},t.createDefault=function(t){switch(t){case st.ground:throw new Z("CICCDR91562");case st.row:case st.column:return mt.createDefault(t);case st.stack:return ct.createDefault();case st.component:return ut.createDefault();default:throw new K("CICCDD91563",t,"Invalid Config Item type specified")}},t.isComponentItem=function(t){return t.type===st.component},t.isStackItem=function(t){return t.type===st.stack},t.isGroundItem=function(t){return t.type===st.ground}}(ht||(ht={})),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={}))}(dt||(dt={})),function(t){function e(t){const e=t.length,i=new Array(e);for(let n=0;n<e;n++)i[n]=ht.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:dt.Header.createCopy(t.header)}},t.copyContent=e,t.createDefault=function(){return{type:st.stack,content:[],size:ht.defaults.size,sizeUnit:ht.defaults.sizeUnit,minSize:ht.defaults.minSize,minSizeUnit:ht.defaults.minSizeUnit,id:ht.defaults.id,maximised:dt.defaultMaximised,isClosable:ht.defaults.isClosable,activeItemIndex:t.defaultActiveItemIndex,header:void 0}}}(ct||(ct={})),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:dt.Header.createCopy(t.header),componentType:t.componentType,componentState:Xt(void 0,t.componentState),icon:t.icon}},t.createDefault=function(e="",i,n=""){return{type:st.component,content:[],size:ht.defaults.size,sizeUnit:ht.defaults.sizeUnit,minSize:ht.defaults.minSize,minSizeUnit:ht.defaults.minSizeUnit,id:ht.defaults.id,maximised:dt.defaultMaximised,isClosable:ht.defaults.isClosable,reorderEnabled:t.defaultReorderEnabled,title:n,header:void 0,componentType:e,componentState:i}},t.copyComponentType=function(t){return Xt({},t)}}(ut||(ut={})),function(t){function e(t){const e=t.length,i=new Array(e);for(let n=0;n<e;n++)i[n]=ht.createCopy(t[n]);return i}t.isChildItemConfig=function(t){switch(t.type){case st.row:case st.column:case st.stack:case st.component:return!0;case st.ground:return!1;default:throw new K("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:ht.defaults.size,sizeUnit:ht.defaults.sizeUnit,minSize:ht.defaults.minSize,minSizeUnit:ht.defaults.minSizeUnit,id:ht.defaults.id,isClosable:ht.defaults.isClosable}}}(mt||(mt={})),function(t){t.createCopy=function(t){return ht.createCopy(t)},t.isRootItemConfig=function(t){switch(t.type){case st.row:case st.column:case st.stack:case st.component:return!0;case st.ground:return!1;default:throw new K("CROCOSPCICIC13687",t.type)}}}(pt||(pt={})),function(t){t.create=function(t){const e=void 0===t?[]:[t];return{type:st.ground,content:e,size:100,sizeUnit:at.Percent,minSize:0,minSizeUnit:at.Pixel,id:"",isClosable:!1,title:"",reorderEnabled:!1}}}(ft||(ft={})),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:rt.none,tabOverlapAllowance:0,reorderOnTabMenuClick:!0,tabControlOffset:10,popInOnClose:!1,disableTabOverflowDropdown:!1,tabOverflowBehavior:"dropdown",useHtml5Drag:!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,disableTabOverflowDropdown:t.disableTabOverflowDropdown,tabOverflowBehavior:t.tabOverflowBehavior,useHtml5Drag:t.useHtml5Drag}},(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:at.Pixel,defaultMinItemWidth:10,defaultMinItemWidthUnit:at.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:et.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)?vt.createCopy(e):{root:void 0===e.root?void 0:pt.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]=vt.createCopy(t[n]);return i},t.minifyConfig=function(t){return lt.translateObject(t,!0)},t.unminifyConfig=function(t){return lt.translateObject(t,!1)}}(gt||(gt={})),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:pt.createCopy(e.root),openPopouts:gt.copyOpenPopouts(e.openPopouts),settings:gt.Settings.createCopy(e.settings),dimensions:gt.Dimensions.createCopy(e.dimensions),header:gt.Header.createCopy(e.header),parentId:e.parentId,indexInParent:e.indexInParent,window:t.Window.createCopy(e.window),resolved:e.resolved}}}(vt||(vt={})),function(t){t.resolve=function(t,e){switch(t.type){case st.ground:throw new F("ItemConfig cannot specify type ground",JSON.stringify(t));case st.row:case st.column:return bt.resolve(t,e);case st.stack:return wt.resolve(t,e);case st.component:return Ct.resolve(t,e);default:throw new K("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?ht.defaults.id:Array.isArray(t)?0===t.length?ht.defaults.id:t[0]:t},t.resolveSize=function(t,e,i,n){if(void 0!==t)return Qt(t,[at.Percent,at.Fractional]);if(void 0!==e||void 0!==i){if(void 0!==e)return{size:e,sizeUnit:at.Percent};if(void 0!==i)return{size:i,sizeUnit:at.Percent};throw new X("CRS33390")}return n?{size:50,sizeUnit:at.Percent}:{size:ht.defaults.size,sizeUnit:ht.defaults.sizeUnit}},t.resolveMinSize=function(t,e,i){if(void 0!==t)return Qt(t,[at.Pixel]);{const t=void 0!==e;return t||void 0!==i?t?{size:e,sizeUnit:at.Pixel}:{size:i,sizeUnit:at.Pixel}:{size:ht.defaults.minSize,sizeUnit:ht.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===st.ground},t.isRow=function(t){return t.type===st.row},t.isColumn=function(t){return t.type===st.column},t.isStack=function(t){return t.type===st.stack},t.isComponent=function(t){return t.type===st.component}}(yt||(yt={})),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&&gt.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=ht.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]:ht.defaults.id}else e=n;return i=void 0!==t.maximised?t.maximised:o,{id:e,maximised:i}}}(_t||(_t={})),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=yt.resolve(e,!1);if(!ht.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]=Ct.fromResolved(e)}return i}t.resolve=function(t,i){var n,o;const{id:s,maximised:r}=_t.resolveIdAndMaximised(t),{size:a,sizeUnit:l}=yt.resolveSize(t.size,t.width,t.height,i),{size:h,sizeUnit:d}=yt.resolveMinSize(t.minSize,t.minWidth,t.minHeight);return{type:st.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:ht.defaults.isClosable,activeItemIndex:null!==(o=t.activeItemIndex)&&void 0!==o?o:ct.defaultActiveItemIndex,header:_t.Header.resolve(t.header,t.hasHeaders)}},t.fromResolved=function(t){return{type:st.stack,content:i(t.content),size:te(t.size,t.sizeUnit),minSize:ee(t.minSize,t.minSizeUnit),id:t.id,maximised:t.maximised,isClosable:t.isClosable,activeItemIndex:t.activeItemIndex,header:dt.Header.createCopy(t.header)}}}(wt||(wt={})),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}=_t.resolveIdAndMaximised(e);let h;h=void 0===e.title||""===e.title?t.componentTypeToTitle(r):e.title;const{size:d,sizeUnit:c}=yt.resolveSize(e.size,e.width,e.height,i),{size:u,sizeUnit:m}=yt.resolveMinSize(e.minSize,e.minWidth,e.minHeight);return{type:e.type,content:[],size:d,sizeUnit:c,minSize:u,minSizeUnit:m,id:a,maximised:l,isClosable:null!==(n=e.isClosable)&&void 0!==n?n:ht.defaults.isClosable,reorderEnabled:null!==(o=e.reorderEnabled)&&void 0!==o?o:ut.defaultReorderEnabled,title:h,header:_t.Header.resolve(e.header,e.hasHeaders),componentType:r,componentState:null!==(s=e.componentState)&&void 0!==s?s:{},icon:e.icon}}},t.fromResolved=function(t){const e={type:st.component,size:te(t.size,t.sizeUnit),minSize:ee(t.minSize,t.minSizeUnit),id:t.id,maximised:t.maximised,isClosable:t.isClosable,reorderEnabled:t.reorderEnabled,title:t.title,header:dt.Header.createCopy(t.header),componentType:t.componentType,componentState:Xt(void 0,t.componentState)};return void 0!==t.icon&&(e.icon=t.icon),e},t.componentTypeToTitle=function(t){switch(typeof t){case"string":return t;case"number":case"boolean":return t.toString();default:return""}}}(Ct||(Ct={})),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 st.row:case st.column:r=t.fromResolved(i);break;case st.stack:r=wt.fromResolved(i);break;case st.component:r=Ct.fromResolved(i);break;default:throw new K("ROCICFRC44797",s)}n[o]=r}return n}t.isChildItemConfig=function(t){switch(t.type){case st.row:case st.column:case st.stack:case st.component:return!0;case st.ground:return!1;default:throw new K("UROCOSPCICIC13687",t.type)}},t.resolve=function(e,i){var n;const{size:o,sizeUnit:s}=yt.resolveSize(e.size,e.width,e.height,i),{size:r,sizeUnit:a}=yt.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:yt.resolveId(e.id),isClosable:null!==(n=e.isClosable)&&void 0!==n?n:ht.defaults.isClosable}},t.fromResolved=function(t){return{type:t.type,content:e(t.content),size:te(t.size,t.sizeUnit),minSize:ee(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 F("ItemConfig is not Row, Column or Stack",i);if(!r){const t=yt.calculateSizeWidthHeightSpecificationType(i);switch(t){case 0:break;case 2:s=!0;break;case 1:r=!0;break;default:throw new K("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=yt.resolve(e,o);if(!mt.isChildItemConfig(i))throw new Z("UROCOSPIC99512",JSON.stringify(i));a[t]=i}return a}}}(bt||(bt={})),function(t){t.isRootItemConfig=function(t){switch(t.type){case st.row:case st.column:case st.stack:case st.component:return!0;case st.ground:return!1;default:throw new K("URICIR23687",t.type)}},t.resolve=function(t){if(void 0!==t){const e=yt.resolve(t,!1);if(pt.isRootItemConfig(e))return e;throw new F("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 st.row:case st.column:return bt.fromResolved(t);case st.stack:return wt.fromResolved(t);case st.component:return Ct.fromResolved(t);default:throw new K("RICFROU89921",e)}}}}(It||(It={})),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,c,u,m;return{constrainDragToContainer:null!==(e=null==t?void 0:t.constrainDragToContainer)&&void 0!==e?e:gt.Settings.defaults.constrainDragToContainer,reorderEnabled:null!==(i=null==t?void 0:t.reorderEnabled)&&void 0!==i?i:gt.Settings.defaults.reorderEnabled,popoutWholeStack:null!==(n=null==t?void 0:t.popoutWholeStack)&&void 0!==n?n:gt.Settings.defaults.popoutWholeStack,blockedPopoutsThrowError:null!==(o=null==t?void 0:t.blockedPopoutsThrowError)&&void 0!==o?o:gt.Settings.defaults.blockedPopoutsThrowError,closePopoutsOnUnload:null!==(s=null==t?void 0:t.closePopoutsOnUnload)&&void 0!==s?s:gt.Settings.defaults.closePopoutsOnUnload,responsiveMode:null!==(r=null==t?void 0:t.responsiveMode)&&void 0!==r?r:gt.Settings.defaults.responsiveMode,tabOverlapAllowance:null!==(a=null==t?void 0:t.tabOverlapAllowance)&&void 0!==a?a:gt.Settings.defaults.tabOverlapAllowance,reorderOnTabMenuClick:null!==(l=null==t?void 0:t.reorderOnTabMenuClick)&&void 0!==l?l:gt.Settings.defaults.reorderOnTabMenuClick,tabControlOffset:null!==(h=null==t?void 0:t.tabControlOffset)&&void 0!==h?h:gt.Settings.defaults.tabControlOffset,popInOnClose:null!==(d=null==t?void 0:t.popInOnClose)&&void 0!==d?d:gt.Settings.defaults.popInOnClose,disableTabOverflowDropdown:null!==(c=null==t?void 0:t.disableTabOverflowDropdown)&&void 0!==c?c:gt.Settings.defaults.disableTabOverflowDropdown,tabOverflowBehavior:null!==(u=null==t?void 0:t.tabOverflowBehavior)&&void 0!==u?u:gt.Settings.defaults.tabOverflowBehavior,useHtml5Drag:null!==(m=null==t?void 0:t.useHtml5Drag)&&void 0!==m?m:gt.Settings.defaults.useHtml5Drag}},(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:gt.Dimensions.defaults.borderWidth,borderGrabWidth:null!==(n=null==t?void 0:t.borderGrabWidth)&&void 0!==n?n:gt.Dimensions.defaults.borderGrabWidth,defaultMinItemHeight:a,defaultMinItemHeightUnit:l,defaultMinItemWidth:h,defaultMinItemWidthUnit:d,headerHeight:null!==(o=null==t?void 0:t.headerHeight)&&void 0!==o?o:gt.Dimensions.defaults.headerHeight,dragProxyWidth:null!==(s=null==t?void 0:t.dragProxyWidth)&&void 0!==s?s:gt.Dimensions.defaults.dragProxyWidth,dragProxyHeight:null!==(r=null==t?void 0:t.dragProxyHeight)&&void 0!==r?r:gt.Dimensions.defaults.dragProxyHeight}},e.fromResolved=function(t){return{borderWidth:t.borderWidth,borderGrabWidth:t.borderGrabWidth,defaultMinItemHeight:te(t.defaultMinItemHeight,t.defaultMinItemHeightUnit),defaultMinItemWidth:te(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:gt.Dimensions.defaults.defaultMinItemHeight,sizeUnit:gt.Dimensions.defaults.defaultMinItemHeightUnit}:Qt(e,[at.Pixel])},e.resolveDefaultMinItemWidth=function(t){const e=null==t?void 0:t.defaultMinItemWidth;return void 0===e?{size:gt.Dimensions.defaults.defaultMinItemWidth,sizeUnit:gt.Dimensions.defaults.defaultMinItemWidthUnit}:Qt(e,[at.Pixel])},function(t){t.resolve=function(t,e,i){var n,o,s,r,a,l,h,d,c,u,m,p;let f;return f=void 0!==(null==t?void 0:t.show)?t.show:void 0!==e&&void 0!==e.hasHeaders?!!e.hasHeaders&&gt.Header.defaults.show:gt.Header.defaults.show,{show:f,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)&&gt.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:gt.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)&&gt.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)&&gt.Header.defaults.close,minimise:null!==(u=null!==(c=null==t?void 0:t.minimise)&&void 0!==c?c:null==i?void 0:i.minimise)&&void 0!==u?u:gt.Header.defaults.minimise,tabDropdown:null!==(p=null!==(m=null==t?void 0:t.tabDropdown)&&void 0!==m?m:null==i?void 0:i.tabDropdown)&&void 0!==p?p:gt.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:It.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:It.fromResolvedOrUndefined(e.root),openPopouts:St.fromResolvedArray(e.openPopouts),settings:gt.Settings.createCopy(e.settings),dimensions:t.Dimensions.fromResolved(e.dimensions),header:gt.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}}}(Et||(Et={})),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=vt.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:It.resolve(o),openPopouts:Et.resolveOpenPopouts(e.openPopouts),dimensions:Et.Dimensions.resolve(e.dimensions),settings:Et.Settings.resolve(e.settings),header:Et.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:It.fromResolvedOrUndefined(e.root),openPopouts:i(e.openPopouts),dimensions:Et.Dimensions.fromResolved(e.dimensions),settings:gt.Settings.createCopy(e.settings),header:gt.Header.createCopy(e.header),parentId:e.parentId,indexInParent:e.indexInParent,window:t.Window.fromResolved(e.window)}},t.fromResolvedArray=i}(St||(St={}));class ie{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 ie.BubblingEvent(t,this);this.emitUnknown(t,e)}emitUnknownBubblingEvent(t){const e=new ie.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===ie.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===ie.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{get name(){return this._name}get target(){return this._target}get origin(){return this._target}get isPropagationStopped(){return this._isPropagationStopped}constructor(t,e){this._name=t,this._target=e,this._isPropagationStopped=!1}stopPropagation(){this._isPropagationStopped=!0}}t.BubblingEvent=e;t.ClickBubblingEvent=class extends e{get mouseEvent(){return this._mouseEvent}constructor(t,e,i){super(t,e),this._mouseEvent=i}};t.TouchStartBubblingEvent=class extends e{get touchEvent(){return this._touchEvent}constructor(t,e,i){super(t,e),this._touchEvent=i}}}(ie||(ie={}));class ne extends ie{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}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()}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 Y("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(),!yt.isComponent(t))throw new Error("ReplaceComponent not passed a component ItemConfig");{const e=Ct.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=Yt(this._state,t);this.setState(e)}setState(t,e={preventEmit:!1}){this._state=t,e.preventEmit||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(it.base)}setLogicalZIndex(t){t!==this._logicalZIndex&&(this._logicalZIndex=t,this.notifyVirtualZIndexChangeRequired())}enterDragMode(t,e){this._width=t,this._height=e,qt(this._element,t),jt(this._element,e),this.setLogicalZIndex(it.drag),this.drag()}exitDragMode(){this.setBaseLogicalZIndex()}enterStackMaximised(){this._stackMaximised=!0,this.setLogicalZIndex(it.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,qt(this._element,t),jt(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=nt[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 oe extends ie{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 Y("BPGGI24693");return this._popoutWindow.__glInstance}getWindow(){if(null===this._popoutWindow)throw new Y("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=Yt({},this.getGlInstance().saveLayout()).root;if(void 0===i)throw new X("BPPIR19998");const n=this._layoutManager.groundItem;if(void 0===n)throw new X("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 $("Popout blocked")}}checkReady(){if(null===this._popoutWindow)throw new Y("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-"+Jt(),e=gt.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 se extends ie{constructor(t,e,i=!1){super(),this._eElement=t,this._pointerTracking=!1,this._html5DragTracking=!1,this._destroyPending=!1,this._pointerDownEventListener=t=>this.onPointerDown(t),this._pointerMoveEventListener=t=>this.onPointerMove(t),this._pointerUpEventListener=t=>this.onPointerUp(t),this._html5DragStartListener=t=>this.onHtml5DragStart(t),this._html5DragOverListener=t=>this.onHtml5DragOver(t),this._html5DragEndListener=t=>this.onHtml5DragEnd(t),this._timeout=void 0,this._useHtml5Drag=i,this._allowableTargets=[t,...e],this._oDocument=document,this._eBody=document.body,this._nDelay=1800,this._nDistance=1,this._nX=0,this._nY=0,this._nOriginalX=0,this._nOriginalY=0,this._dragging=!1,i?(this._eElement.setAttribute("draggable","true"),this._eElement.addEventListener("dragstart",this._html5DragStartListener)):this._eElement.addEventListener("pointerdown",this._pointerDownEventListener,{passive:!0})}destroy(){this._dragging?this._destroyPending=!0:(this._originalRemove&&(this._eElement.remove=this._originalRemove,this._originalRemove=void 0),this._useHtml5Drag?(this._eElement.removeAttribute("draggable"),this._eElement.removeEventListener("dragstart",this._html5DragStartListener),this.checkRemoveHtml5DragListeners()):(this.checkRemovePointerTrackingEventListeners(),this._eElement.removeEventListener("pointerdown",this._pointerDownEventListener)))}cancelDrag(){this.processDragStop(void 0)}onPointerDown(t){if(this._allowableTargets.includes(t.target)&&t.isPrimary){this._nPointerId=t.pointerId;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.processPointerDragMove(t),t.preventDefault())}processPointerDragMove(t){this._nX=t.pageX-this._nOriginalX,this._nY=t.pageY-this._nOriginalY,this._lastPointerEvent=t,!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)}onHtml5DragStart(t){if(t.dataTransfer){t.dataTransfer.effectAllowed="move";const e=this._eElement.getBoundingClientRect(),i=t.clientX-e.left,n=t.clientY-e.top;t.dataTransfer.setDragImage(this._eElement,i,n)}this.decorateDragPayload&&this.decorateDragPayload(t),this._nOriginalX=t.pageX,this._nOriginalY=t.pageY,this._eElement.addEventListener("dragend",this._html5DragEndListener),this._oDocument.addEventListener("dragover",this._html5DragOverListener,!0),this._html5DragTracking=!0,this.startDrag()}onHtml5DragOver(t){0===t.screenX&&0===t.screenY||(this._nX=t.pageX-this._nOriginalX,this._nY=t.pageY-this._nOriginalY,this._dragging&&this.emit("drag",this._nX,this._nY,t))}onHtml5DragEnd(t){this.processDragStop(t)}processDragStop(t){var e;void 0!==this._timeout&&(clearTimeout(this._timeout),this._timeout=void 0),void 0!==this._dragEmitInterval&&(clearInterval(this._dragEmitInterval),this._dragEmitInterval=void 0),this._useHtml5Drag?this.checkRemoveHtml5DragListeners():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._originalRemove&&(this._eElement.remove=this._originalRemove,this._originalRemove=void 0,this._eElement.remove()),this.emit("dragStop",t)),this._destroyPending&&(this._destroyPending=!1,this.destroy())}checkRemovePointerTrackingEventListeners(){if(this._pointerTracking&&(this._oDocument.removeEventListener("pointermove",this._pointerMoveEventListener),this._oDocument.removeEventListener("pointerup",this._pointerUpEventListener),this._pointerTracking=!1),void 0!==this._nPointerId){try{this._eBody.releasePointerCapture(this._nPointerId)}catch(t){}this._nPointerId=void 0}}checkRemoveHtml5DragListeners(){this._html5DragTracking&&(this._oDocument.removeEventListener("dragover",this._html5DragOverListener,!0),this._eElement.removeEventListener("dragend",this._html5DragEndListener),this._html5DragTracking=!1)}startDrag(){var t;void 0!==this._timeout&&(clearTimeout(this._timeout),this._timeout=void 0),this._useHtml5Drag||void 0===this._nPointerId||this._eBody.setPointerCapture(this._nPointerId),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._useHtml5Drag&&(this._originalRemove=this._eElement.remove.bind(this._eElement),this._eElement.remove=()=>{this._eElement.style.visibility="hidden",this._eElement.style.position="absolute",this._eElement.style.pointerEvents="none"}),this._useHtml5Drag?setTimeout(()=>this.emit("dragStart",this._nOriginalX,this._nOriginalY),0):this.emit("dragStart",this._nOriginalX,this._nOriginalY),this._useHtml5Drag||(this._dragEmitInterval=setInterval(()=>{this._dragging&&this._lastPointerEvent&&this.emit("drag",this._nX,this._nY,this._lastPointerEvent)},16))}getPointerCoordinates(t){return{x:t.pageX,y:t.pageY}}}class re extends ie{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}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)}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 Y("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 Y("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 Y("CIRCNC45699");!0===e._parent._isInitialised&&!1===e._isInitialised&&e.init(),this.updateSize(!1)}remove(){if(null===this._parent)throw new Y("CIR11110");this._parent.removeChild(this)}popout(){const t=Jt(),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 Y("ACIHDZ5593");n.highlightArea(i,1)}onDrop(t,e){this.addChild(t)}show(){this.layoutManager.beginSizeInvalidation();try{Kt(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{Kt(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 ie.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 ie.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 ae extends re{get componentName(){return this._container.componentType}get componentType(){return this._container.componentType}get reorderEnabled(){return this._reorderEnabled}set reorderEnabled(t){this._reorderEnabled=t,this._tabReady&&(this._tab.reorderEnabled=t)}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}constructor(t,e,i){super(t,e,i,document.createElement("div")),this._parentItem=i,this._tabReady=!1,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 ne(e,this,t,n,t=>this.handleUpdateItemConfigEvent(t),()=>this.show(),()=>this.hide(),t=>this.focus(t),t=>this.blur(t))}destroy(){this._container.destroy(),super.destroy()}applyUpdatableConfig(t){var e;this.setTitle(t.title),this._headerConfig=t.header,this._icon=t.icon,this._tabReady&&this._tab.setIcon(null!==(e=this._icon)&&void 0!==e?e:null)}toConfig(){const t=this._container.stateRequestEvent,e=void 0===t?this._container.state:t();return Object.assign({type:st.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:dt.Header.createCopy(this._headerConfig),componentType:ut.copyComponentType(this.componentType),componentState:e},void 0!==this._icon?{icon:this._icon}:{})}close(){if(null===this.parent)throw new Y("CIC68883");this.parent.removeChild(this,!1)}enterDragMode(t,e){qt(this.element,t),jt(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){var e;this._tab=t,this._tabReady=!0,this.emit("tab",t),this._container.setTab(t),this._tab.setIcon(null!==(e=this._icon)&&void 0!==e?e:null)}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}=Gt(this.element);this._container.setSizeToNodeSize(e,i,t)}}}class le extends re{constructor(){super(...arguments),this._focused=!1}get focused(){return this._focused}setFocusedValue(t){this._focused=t}}class he{get element(){return this._element}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=Ut(-s),n.style.height=Ut(this._size+o),this._element.classList.add("lm_vertical"),this._element.style.height=Ut(this._size)):(n.style.left=Ut(-s),n.style.width=Ut(this._size+o),this._element.classList.add("lm_horizontal"),this._element.style.width=Ut(this._size)),this._element.appendChild(n),this._dragListener=new se(this._element,[n])}destroy(){this._element.remove()}on(t,e){this._dragListener.on(t,e)}}class de extends re{constructor(t,e,i,n){switch(super(e,i,n,de.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 st.row:case st.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 re.isStack(i)&&yt.isComponent(t)?i.contentItems[0]:i}addItem(t,e){this.layoutManager.checkMinimiseMaximisedStack();const i=yt.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?(qt(this.contentItems[e].element,t.crossAxisSize),jt(this.contentItems[e].element,t.itemSizes[e])):(qt(this.contentItems[e].element,t.itemSizes[e]),jt(this.contentItems[e].element,t.crossAxisSize))}calculateAbsoluteSizes(){const t=(this.contentItems.length-1)*this._splitterSize,{width:e,height:i}=Gt(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!==at.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 at.Percent:t+=o.size;break;case at.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=at.Percent}return void this.respectMinItemSize()}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=at.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 he(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===at.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=Ft(e.before.element.style[this._dimension]),n=Ft(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 Y("ROCOSD59226");n=Math.max(n,this._splitterMinPosition),n=Math.min(n,this._splitterMaxPosition),this._splitterPosition=n;const o=Ut(n);this._isColumn?t.element.style.top=o:t.element.style.left=o}onSplitterDragStop(t){if(null===this._splitterPosition)throw new Y("ROCOSDS66932");{const e=this.getSplitItems(t),i=Ft(e.before.element.style[this._dimension]),n=Ft(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=Ut(0),t.element.style.left=Ut(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?qt(t,i):jt(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}}(de||(de={}));class ce extends le{constructor(t,e,i){super(t,ft.create(e),null,ce.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=yt.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=yt.resolve(t,!1);if(e.maximised)throw new Error("Root Component cannot be maximised");{const t=new ae(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(!pt.isRootItemConfig(e))throw new Z("RCCC66832");i[n]=e}return i}setSize(t,e){void 0===t||void 0===e?this.updateSize(!1):(qt(this.element,t),jt(this.element,e),this.contentItems.length>0&&(qt(this.contentItems[0].element,t),jt(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=ce.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 Y("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=ct.createDefault(),i=t;e.header=dt.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===st.row||t.type===st.column){const e=ct.createDefault(),i=this.layoutManager.createContentItem(e,this);i.addChild(t),t=i}const i="x"==e.side[0]?st.row:st.column,n="2"==e.side[1],o=this.contentItems[0];if(o instanceof de&&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=at.Percent,o.updateSize(!1)}else{const e=ht.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=at.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=>!(!re.isStack(t)||!t.initialWantMaximise)||!(!re.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}=Zt(this._containerElement);qt(this.element,t),jt(this.element,e),this.contentItems.length>0&&(qt(this.contentItems[0].element,t),jt(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}}(ce||(ce={}));class ue{get element(){return i(this,kt,"f")}constructor(t,e,o,s){Tt.add(this),xt.set(this,null),Lt.set(this,null),At.set(this,void 0),Mt.set(this,void 0),zt.set(this,void 0),Dt.set(this,void 0),kt.set(this,void 0),Pt.set(this,void 0),Ot.set(this,void 0),Rt.set(this,void 0),Bt.set(this,!1),Vt.set(this,!1),n(this,Rt,o,"f"),n(this,Ot,i(this,Tt,"m",Ht).call(this,s),"f"),n(this,kt,document.createElement("div"),"f"),i(this,kt,"f").classList.add("lm_dragProxy");const r=document.createElement("div");r.classList.add("lm_header");const a=document.createElement("div");a.classList.add("lm_tabs");const l=document.createElement("div");l.classList.add("lm_tab");const h=document.createElement("span");h.classList.add("lm_title");const d=document.createElement("div");d.classList.add("lm_close_tab"),l.appendChild(h),l.appendChild(d),a.appendChild(l),r.appendChild(a),n(this,Pt,document.createElement("div"),"f"),i(this,Pt,"f").classList.add("lm_content"),i(this,kt,"f").appendChild(r),i(this,kt,"f").appendChild(i(this,Pt,"f")),i(this,kt,"f").style.left=Ut(t),i(this,kt,"f").style.top=Ut(e),l.setAttribute("title",i(this,Ot,"f").title),h.insertAdjacentText("afterbegin",i(this,Ot,"f").title),i(this,Pt,"f").appendChild(i(this,Ot,"f").element),i(this,Tt,"m",Wt).call(this),i(this,Rt,"f").layoutConfig.settings.useHtml5Drag&&(i(this,kt,"f").style.display="none"),document.body.appendChild(i(this,kt,"f")),i(this,Tt,"m",Nt).call(this),i(this,Rt,"f").calculateItemAreas(),this.setDropPosition(t,e)}setDropPosition(t,e){var o;i(this,Bt,"f")||i(this,Vt,"f")||(i(this,Rt,"f").layoutConfig.settings.constrainDragToContainer&&(t<=i(this,At,"f")?t=Math.ceil(i(this,At,"f")):t>=i(this,zt,"f")&&(t=Math.floor(i(this,zt,"f"))),e<=i(this,Mt,"f")?e=Math.ceil(i(this,Mt,"f")):e>=i(this,Dt,"f")&&(e=Math.floor(i(this,Dt,"f")))),i(this,kt,"f").style.left=Ut(t),i(this,kt,"f").style.top=Ut(e),n(this,xt,i(this,Rt,"f").getArea(t,e),"f"),i(this,Ot,"f").drag(),null!==i(this,xt,"f")?(n(this,Lt,i(this,xt,"f"),"f"),i(this,xt,"f").contentItem.highlightDropZone(t,e,i(this,xt,"f"))):null===(o=i(this,Rt,"f").dropTargetIndicator)||void 0===o||o.hide())}completeDrop(){var t;if(i(this,Bt,"f")||i(this,Vt,"f"))return;n(this,Vt,!0,"f");const e=i(this,Rt,"f").dropTargetIndicator;if(null===e)throw new Y("EDPCD30011");e.hide(),i(this,Ot,"f").exitDragMode();const o=null!==(t=i(this,xt,"f"))&&void 0!==t?t:i(this,Lt,"f");null!==o?(o.contentItem.onDrop(i(this,Ot,"f"),o),i(this,Rt,"f").emit("itemDropped",i(this,Ot,"f"))):i(this,Ot,"f").destroy(),i(this,kt,"f").remove()}cancelDrag(){var t;i(this,Bt,"f")||i(this,Vt,"f")||(n(this,Bt,!0,"f"),null===(t=i(this,Rt,"f").dropTargetIndicator)||void 0===t||t.hide(),i(this,Rt,"f").tabDropPlaceholder.remove(),i(this,Ot,"f").exitDragMode(),i(this,kt,"f").remove(),i(this,Ot,"f").destroy())}}xt=new WeakMap,Lt=new WeakMap,At=new WeakMap,Mt=new WeakMap,zt=new WeakMap,Dt=new WeakMap,kt=new WeakMap,Pt=new WeakMap,Ot=new WeakMap,Rt=new WeakMap,Bt=new WeakMap,Vt=new WeakMap,Tt=new WeakSet,Ht=function(t){const e=document.createElement("div"),n=mt.createDefault("row"),o=new ce(i(this,Rt,"f"),n,e),s=Ct.resolve(t,!1),r=new ae(i(this,Rt,"f"),s,o);return o.contentItems.push(r),o.removeChild(r,!0),r},Nt=function(){const t=i(this,Rt,"f").groundItem;if(void 0===t)throw new X("EDPDMMXY73109");const e=t.element.getBoundingClientRect();n(this,At,e.left+document.body.scrollLeft,"f"),n(this,Mt,e.top+document.body.scrollTop,"f"),n(this,zt,i(this,At,"f")+e.width,"f"),n(this,Dt,i(this,Mt,"f")+e.height,"f")},Wt=function(){const t=i(this,Rt,"f").layoutConfig.dimensions;if(void 0===t)throw new Error("ExternalDragProxy.setDimensions: dimensions undefined");let e=t.dragProxyWidth,n=t.dragProxyHeight;if(void 0===e||void 0===n)throw new Error("ExternalDragProxy.setDimensions: width and/or height undefined");const o=!1===i(this,Rt,"f").layoutConfig.header.show?0:t.headerHeight;i(this,kt,"f").style.width=Ut(e),i(this,kt,"f").style.height=Ut(n),n-=o,i(this,Pt,"f").style.width=Ut(e),i(this,Pt,"f").style.height=Ut(n),i(this,Ot,"f").enterDragMode(e,n),i(this,Ot,"f").show()};class me{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.createDragListener()}destroy(){this.removeDragListener()}createDragListener(){this.removeDragListener(),this._dragListener=new se(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=me.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};if(null===this._dragListener)throw new Y("DSODSD66746");const s=new ue(t,e,this._layoutManager,o);this._dragListener.on("drag",(t,e,i)=>{s.setDropPosition(i.pageX,i.pageY)}),this._dragListener.on("dragStop",()=>s.completeDrop());const r=this._layoutManager.transitionIndicator;if(null===r)throw new Y("DSODST66746");r.transitionElements(this._element,s.element)}onDragStop(){this.createDragListener()}removeDragListener(){null!==this._dragListener&&(this._dragListener.destroy(),this._dragListener=null)}}!function(t){t.isDragSourceComponentItemConfig=function(t){return!("componentType"in t)}}(me||(me={}));class pe{get element(){return this._element}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)}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 fe{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())}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=t=>this.onCloseTouchStart(t),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)):(this._closeElement.remove(),this._closeElement=void 0),this._componentItem.setTab(this),this._layoutManager.emit("tabCreated",this)}setTitle(t){this._titleElement.innerText=t,this._element.title=t.replace(/<[^>]+>/g,"")}setIcon(t,e){if(null===t||""===t)return void(this._iconElement&&(this._iconElement.style.display="none"));if(!this._iconElement){const t=document.createElement("img");t.classList.add("lm_tab_icon"),t.alt="",t.setAttribute("aria-hidden","true"),t.draggable=!1,t.style.pointerEvents="none",this._iconElement=t,this._element.insertBefore(t,this._titleElement)}const i=this._iconElement;this.attachIconErrorHandler(i,null!=e?e:null),i.src=t,i.style.display=""}attachIconErrorHandler(t,e=null){t.onerror=()=>{e?(t.src=e,t.onerror=()=>{t.src="",t.onerror=null}):(t.src="",t.onerror=null)}}setActive(t){t!==this._isActive&&(this._isActive=t,t?(this._element.classList.add("lm_active"),this._element.scrollIntoView({behavior:"smooth"})):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 X("TODSDLU10093");if(void 0===this._dragStartEvent)throw new X("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&&e!==this._iconElement||(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(t){t.preventDefault(),this.notifyClose()}notifyClose(){if(void 0===this._closeEvent)throw new X("TNC15007");this._closeEvent(this._componentItem)}notifyFocus(){if(void 0===this._focusEvent)throw new X("TNA15007");this._focusEvent(this._componentItem)}enableReorder(){const t=this._layoutManager.layoutConfig.settings.useHtml5Drag;this._dragListener=new se(this._element,[this._titleElement],t),this._dragListener.on("dragStart",this._dragStartListener),this._componentItem.on("destroy",this._contentItemDestroyListener)}disableReorder(){if(void 0===this._dragListener)throw new X("TDR87745");this._componentItem.off("destroy",this._contentItemDestroyListener),this._dragListener.off("dragStart",this._dragStartListener),this._dragListener.destroy(),this._dragListener=void 0}}class ge{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}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");const s=this._layoutManager.layoutConfig.settings;this._useFlexDropdown="scroll"!==s.tabOverflowBehavior&&!s.disableTabOverflowDropdown,"scroll"===s.tabOverflowBehavior&&this.element.addEventListener("wheel",t=>{const{deltaX:e,deltaY:i}=t;Math.abs(i)>Math.abs(e)&&(this._element.scrollLeft+=i-e)},{passive:!0}),this._useFlexDropdown&&(this._resizeObserver=new ResizeObserver(()=>this._reconcileDropdown()),this._resizeObserver.observe(this._element)),this._dropdownElement=document.createElement("section"),this._dropdownElement.classList.add("lm_tabdropdown_list"),this._dropdownElement.style.display="none"}destroy(){var t;null===(t=this._resizeObserver)||void 0===t||t.disconnect();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 fe(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(),this._tabs.splice(e,1),this._lastVisibleTabIndex>=this._tabs.length&&(this._lastVisibleTabIndex=this._tabs.length-1),void("scroll"===this._layoutManager.layoutConfig.settings.tabOverflowBehavior?this._kickScrollWrapperAnimation():this._useFlexDropdown&&this._reconcileDropdown())}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");{const{reorderOnTabMenuClick:t,tabOverflowBehavior:i}=this._layoutManager.layoutConfig.settings;if(t&&"scroll"!==i){const t=this._tabs[e];if(t.element.parentElement===this._dropdownElement){for(let t=e;t>0;t--)this._tabs[t]=this._tabs[t-1];this._tabs[0]=t}}}}updateTabSizes(t,e){if(this._useFlexDropdown)return void this._reconcileDropdown();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=Ft(getComputedStyle(a.element).marginRight);n+=l.offsetWidth+h;let d=0;if(r<=i)d=n;else{const t=Ft(getComputedStyle(a.element).marginRight);d=n+a.element.offsetWidth+t}if(d>e&&!this._layoutManager.layoutConfig.settings.disableTabOverflowDropdown){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?"-"+Ut(t):"";this._tabs[e].element.style.zIndex=Ut(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"}_reconcileDropdown(){if(0===this._tabs.length)return;for(const t of this._tabs)this._element.appendChild(t.element);const t=this._element.scrollWidth,e=this._element.clientWidth;if(t<=e)return this._dropdownActive&&(this._dropdownActive=!1,this._dropdownActiveChangedEvent()),void(this._lastVisibleTabIndex=this._tabs.length-1);const i=new Array(this._tabs.length);for(let t=0;t<this._tabs.length;t++){const e=this._tabs[t].element,n=Ft(getComputedStyle(e).marginRight);i[t]=e.offsetWidth+n}const n=this._tabs.findIndex(t=>t.element.classList.contains("lm_active"));let o=0,s=this._tabs.length;for(let t=0;t<this._tabs.length;t++){o+=i[t];let r=o;if(n>t&&(r+=i[n]),r>e){s=t;break}}const r=[];for(let t=this._tabs.length-1;t>=s;t--)t!==n&&r.push(this._tabs[t]);for(const t of r)this._element.removeChild(t.element);for(let t=r.length-1;t>=0;t--)this._dropdownElement.appendChild(r[t].element);this._lastVisibleTabIndex=-1;for(let t=this._tabs.length-1;t>=0;t--)if(!r.includes(this._tabs[t])){this._lastVisibleTabIndex=t;break}const a=this._dropdownActive;this._dropdownActive=r.length>0,a!==this._dropdownActive&&this._dropdownActiveChangedEvent()}handleTabCloseEvent(t){this._componentRemoveEvent(t)}handleTabFocusEvent(t){this._componentFocusEvent(t)}handleTabDragStartEvent(t,e,i,n){this._componentDragStartEvent(t,e,i,n)}_kickScrollWrapperAnimation(){const t=this._element;t.style.animationPlayState="paused",t.offsetWidth,t.style.removeProperty("animation-play-state")}}class ve extends ie{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}constructor(t,e,i,n,o,s,r,a,l,h,d,c,u){if(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=u,this._clickListener=t=>this.onClick(t),this._touchStartListener=t=>this.onTouchStart(t),this._rowColumnClosable=!0,this._closeButton=null,this._popoutButton=null,this._tabsContainer=new ge(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"),"scroll"===this._layoutManager.layoutConfig.settings.tabOverflowBehavior){const t=document.createElement("div");t.classList.add("lm_tabs_scroll_shadow"),t.appendChild(this._tabsContainer.element),this._element.appendChild(t)}else 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 pe(this,this._tabDropdownLabel,"lm_tabdropdown",()=>this._tabsContainer.showAdditionalTabsDropdown())),this._popoutEnabled&&(this._popoutButton=new pe(this,this._popoutLabel,"lm_popout",()=>this.handleButtonPopoutEvent())),this._maximiseEnabled&&(this._maximiseButton=new pe(this,this._maximiseLabel,"lm_maximise",t=>this.handleButtonMaximiseToggleEvent(t))),this._configClosable&&(this._closeButton=new pe(this,this._closeLabel,"lm_close",()=>s())),this.processTabDropdownActiveChanged()}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=[et.right,et.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&&Kt(this._closeButton.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 X("HPMAX16997");this._maximiseButton.element.setAttribute("title",this._minimiseLabel)}processMinimised(){if(void 0===this._maximiseButton)throw new X("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=Ut(t)):(this._element.style.width="",this._element.style.height=Ut(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 X("HHTCE22294");this._componentRemoveEvent(t)}}handleTabInitiatedComponentFocusEvent(t){if(void 0===this._componentFocusEvent)throw new X("HHTAE22294");this._componentFocusEvent(t)}handleTabInitiatedDragStartEvent(t,e,i,n){if(void 0===this._componentDragStartEvent)throw new X("HHTDSE22294");this._componentDragStartEvent(t,e,i,n)}processTabDropdownActiveChanged(){void 0!==this._tabDropdownButton&&Kt(this._tabDropdownButton.element,this._tabsContainer.dropdownActive)}handleButtonPopoutEvent(){if(this._layoutManager.layoutConfig.settings.popoutWholeStack){if(void 0===this._popoutEvent)throw new X("HHBPOE17834");this._popoutEvent()}else{const t=this._getActiveComponentItemEvent();t&&t.popout()}}handleButtonMaximiseToggleEvent(t){if(void 0===this._maximiseToggleEvent)throw new X("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 X("HNHC46834");this._clickEvent(t)}notifyTouchStart(t){if(void 0===this._touchStartEvent)throw new X("HNHTS46834");this._touchStartEvent(t)}}class ye extends le{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}constructor(t,e,i){var n,o,s,r,a,l,h,d,c,u,m,p,f,g,v,y,_,w,C;super(t,e,i,ye.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 E;if(1!==I.length)E=void 0;else{E=I[0].header}this._initialWantMaximise=e.maximised,this._initialActiveItemIndex=null!==(n=e.activeItemIndex)&&void 0!==n?n:0;const S=null!==(r=null!==(s=null===(o=this._headerConfig)||void 0===o?void 0:o.show)&&void 0!==s?s:null==E?void 0:E.show)&&void 0!==r?r:b.show,T=null!==(h=null!==(l=null===(a=this._headerConfig)||void 0===a?void 0:a.popout)&&void 0!==l?l:null==E?void 0:E.popout)&&void 0!==h?h:b.popout,x=null!==(u=null!==(c=null===(d=this._headerConfig)||void 0===d?void 0:d.maximise)&&void 0!==c?c:null==E?void 0:E.maximise)&&void 0!==u?u:b.maximise,L=null!==(f=null!==(p=null===(m=this._headerConfig)||void 0===m?void 0:m.close)&&void 0!==p?p:null==E?void 0:E.close)&&void 0!==f?f:b.close,A=null!==(y=null!==(v=null===(g=this._headerConfig)||void 0===g?void 0:g.minimise)&&void 0!==v?v:null==E?void 0:E.minimise)&&void 0!==y?y:b.minimise,M=null!==(C=null!==(w=null===(_=this._headerConfig)||void 0===_?void 0:_.tabDropdown)&&void 0!==w?w:null==E?void 0:E.tabDropdown)&&void 0!==C?C:b.tabDropdown;this._maximisedEnabled=!1!==x;const z={show:!1!==S,side:!1===S?et.top:S,popoutEnabled:!1!==T,popoutLabel:!1===T?"":T,maximiseEnabled:this._maximisedEnabled,maximiseLabel:!1===x?"":x,closeEnabled:!1!==L,closeLabel:!1===L?"":L,minimiseEnabled:!0,minimiseLabel:A,tabDropdownEnabled:!1!==M,tabDropdownLabel:!1===M?"":M};this._header=new ve(t,this,z,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()}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 ae))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,e=!1){if(!re.isComponentItem(t))throw new Error("Stack.setActiveContentItem: item is not a ComponentItem");this.setActiveComponentItem(t,!1,!1,e)}setActiveComponentItem(t,e,i=!1,n=!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,n),this.layoutManager.emit("activeContentItemChanged",t,n),this.emitStateChangedEvent()}n||!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,o){const s={type:"component",componentType:t,componentState:e,title:i};return this.newItem(s,n,o)}addComponent(t,e,i,n){const o={type:"component",componentType:t,componentState:e,title:i};return this.addItem(o,n)}newItem(t,e,i){return e=this.addItem(t,e,i),this.contentItems[e]}addItem(t,e,i){this.layoutManager.checkMinimiseMaximisedStack();const n=yt.resolve(t,!1),o=this.layoutManager.createAndInitContentItem(n,this);return this.addChild(o,e,!1,null==i||i)}addChild(t,e,i=!1,n=!0){if(void 0!==e&&e>this.contentItems.length&&(e=this.contentItems.length),t instanceof ae){const o=0===this.contentItems.length;return e=super.addChild(t,e),this._childElementContainer.appendChild(t.element),this._header.createTab(t,e),n||o?this.setActiveComponentItem(t,i):t.hide(),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)if(i.focused&&i.blur(),o)this._activeComponentItem=void 0;else{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 ae))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 ae))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 X("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=ct.createDefault();e.header=this.createHeaderConfig();const i=this.layoutManager.createAndInitContentItem(e,this);i.addChild(t),t=i}if(t.type===st.row||t.type===st.column){const e=ct.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?st.column:st.row,n=ht.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=at.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 Y("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=Gt(this.element);if(this._header.show){t[this._header.leftRightSided?tt.width:tt.height]-=this.layoutManager.layoutConfig.dimensions.headerHeight}this._childElementContainer.style.width=Ut(t.width),this._childElementContainer.style.height=Ut(t.height);for(let e=0;e<this.contentItems.length;e++)this.contentItems[e].element.style.width=Ut(t.width),this.contentItems[e].element.style.height=Ut(t.height);this.emit("resize"),this.emitStateChangedEvent()}}highlightHeaderDropZone(t){var e,i;const n=this._header.lastVisibleTabIndex+1,o=this._header.tabsContainerElement,s=o.childNodes,r=[];for(let t=0;t<s.length&&r.length<n;t++){const i=s[t];i!==this.layoutManager.tabDropPlaceholder&&"hidden"!==(null===(e=i.style)||void 0===e?void 0:e.visibility)&&r.push(i)}const a=this.layoutManager.dropTargetIndicator;if(null===a)throw new Y("SHHDZDTI97110");const l=r.length;if(0===l)return this._dropIndex=0,o.appendChild(this.layoutManager.tabDropPlaceholder),void a.highlightElement(this.layoutManager.tabDropPlaceholder,0);{if("scroll"===this.layoutManager.layoutConfig.settings.tabOverflowBehavior){const e=12,i=this._header.tabsContainerElement,n=i.getBoundingClientRect();t-n.left<e?i.scrollBy({left:-1}):n.right-t<e&&i.scrollBy({left:1})}let e,n,o,s=0,a=!1;do{o=r[s];const i=o.getBoundingClientRect(),l=i.top+document.body.scrollTop,h=i.left+document.body.scrollLeft;this._header.leftRightSided?(e=l,n=i.height):(e=h,n=i.width),t>=e&&t<e+n?a=!0:s++}while(s<l&&!a);if(!1===a&&t<e)return;const h=e+n/2,d=this.layoutManager.tabDropPlaceholder,c=this._header.tabs.findIndex(t=>t.element===o),u=c>=0?c:s,m=t<h?u:u+1;m===this._dropIndex&&d.parentElement||(this._dropIndex=m,t<h?o.insertAdjacentElement("beforebegin",d):o.insertAdjacentElement("afterend",d),null===(i=this.layoutManager.dropTargetIndicator)||void 0===i||i.highlightElement(d,0))}}resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}setupHeaderPosition(){Kt(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 X("SHBDZC82265");{const e=this._contentAreaDimensions[t].highlightArea,i=this.layoutManager.dropTargetIndicator;if(null===i)throw new Y("SHBDZD96110");i.highlightArea(e,1),this._dropSegment=t}}handleResize(){
2
+ //! this._header.updateTabSizes()
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=ie.headerClickEventName,i=new ie.ClickBubblingEvent(e,this,t);this.emit(e,i)}handleHeaderTouchStartEvent(t){const e=ie.headerTouchStartEventName,i=new ie.TouchStartBubblingEvent(e,this,t);this.emit(e,i)}handleHeaderComponentRemoveEvent(t){this.removeChild(t,!1)}handleHeaderComponentFocusEvent(t){this.setActiveComponentItem(t,!1,!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=dt.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 dt.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}}(ye||(ye={}));class _e{constructor(t,e,i){this._dragListener=t,this._layoutManager=e,this._componentItem=i,this._componentItemFocused=this._componentItem.focused,this._componentItemFocused&&this._componentItem.blur(),this._dragListener.on("dragStop",()=>this.onDragStop())}onDragStop(){var t;null===(t=this._layoutManager.dropTargetIndicator)||void 0===t||t.hide(),this._layoutManager.emit("itemDropped",this._componentItem),this._componentItemFocused&&this._componentItem.focus()}onDrop(){console.warn("Drop forcing only supported by tear out drag proxy")}setDropPosition(t,e){console.warn("Drop forcing only supported by tear out drag proxy")}cancel(){var t;null===(t=this._layoutManager.dropTargetIndicator)||void 0===t||t.hide(),this._componentItemFocused&&this._componentItem.focus()}}class we{get element(){return this._element}constructor(t,e,i,n,o,s){if(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(i)),this._dragListener.on("dragStop",()=>this.onDrop()),null===this._componentItem.parent)throw new Y("DPC10097");this.createDragProxyElements(t,e),this._componentItemFocused=this._componentItem.focused,this._componentItemFocused&&this._componentItem.blur(),this._componentItem.parent.removeChild(this._componentItem,!0),this.setDimensions(),this._layoutManager.layoutConfig.settings.useHtml5Drag&&(this._element.style.display="none"),document.body.appendChild(this._element),this.determineMinMaxXY(),this._layoutManager.calculateItemAreas(),this.setDropPosition(t,e)}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"),o.classList.add("lm_active");const s=document.createElement("span");s.classList.add("lm_title");const r=document.createElement("div");r.classList.add("lm_close_tab"),o.appendChild(s),o.appendChild(r),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 ye&&this._originalParent.headerShow&&(this._sided=this._originalParent.headerLeftRightSided,this._element.classList.add("lm_"+this._originalParent.headerSide),[et.right,et.bottom].indexOf(this._originalParent.headerSide)>=0&&this._proxyContainerElement.insertAdjacentElement("afterend",i)),this._element.style.left=Ut(t),this._element.style.top=Ut(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 X("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){this.setDropPosition(t.pageX,t.pageY),this._componentItem.drag()}setDropPosition(t,e){var i;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=Ut(t),this._element.style.top=Ut(e),this._area=this._layoutManager.getArea(t,e),null!==this._area?(this._lastValidArea=this._area,this._area.contentItem.highlightDropZone(t,e,this._area)):null===(i=this._layoutManager.dropTargetIndicator)||void 0===i||i.hide()}onDrop(){const t=this._layoutManager.dropTargetIndicator;if(null===t)throw new Y("DPOD30011");let e;t.hide(),this._componentItem.exitDragMode(),null!==this._area?(e=this._componentItem,this._area.contentItem.onDrop(e,this._area)):null!==this._lastValidArea?(e=this._componentItem,this._lastValidArea.contentItem.onDrop(e,this._lastValidArea)):this._originalParent?(e=this._componentItem,this._originalParent.addChild(e)):this._componentItem.destroy(),this._element.remove(),this._layoutManager.emit("itemDropped",this._componentItem),this._componentItemFocused&&void 0!==e&&e.focus()}cancel(){var t;null===(t=this._layoutManager.dropTargetIndicator)||void 0===t||t.hide(),this._componentItem.exitDragMode(),this._element.remove()}setDimensions(){const t=this._layoutManager.layoutConfig.dimensions;if(void 0===t)throw new Error("TearOutDragProxy.setDimensions: dimensions undefined");let e=t.dragProxyWidth,i=t.dragProxyHeight;if(void 0===e||void 0===i)throw new Error("TearOutDragProxy.setDimensions: width and/or height undefined");const n=!1===this._layoutManager.layoutConfig.header.show?0:t.headerHeight;this._element.style.width=Ut(e),this._element.style.height=Ut(i),e-=this._sided?n:0,i-=this._sided?0:n,this._proxyContainerElement.style.width=Ut(e),this._proxyContainerElement.style.height=Ut(i),this._componentItem.enterDragMode(e,i),this._componentItem.show()}}function Ce(t,e,i,n,o,s){return function(t,e){const i=t.parent,n=e.groundItem;return null!=n&&i instanceof ye&&1===i.contentItems.length&&1===n.getAllContentItems().filter(t=>t.isComponent).length}(o,n)?new _e(i,n,o):new we(t,e,i,n,o,s)}class be{get element(){return this._element}constructor(){this.targetElement=null,this.observeInterval=null,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.clearHighlightedElement(),this._element.remove()}highlightArea(t,e){this.clearHighlightedElement(),this.highlightAreaInternal(t,e)}highlightAreaInternal(t,e){const i=t.x1+e,n=t.y1+e,o=t.x2-t.x1-e,s=t.y2-t.y1-e;this._element.style.left=Ut(i),this._element.style.top=Ut(n),this._element.style.width=Ut(o),this._element.style.height=Ut(s),this._element.style.display="block",this._element.dispatchEvent(new CustomEvent("drop-area-highlighted",{detail:{bounds:{left:i,top:n,width:o,height:s}}}))}highlightElement(t,e){if(this.targetElement===t)return;this.clearHighlightedElement(),this.targetElement=t;const i=t.getBoundingClientRect(),n={x1:i.left,y1:i.top,x2:i.right,y2:i.bottom};this.highlightAreaInternal(n,e),this.observeInterval=setInterval(()=>{const i=t.getBoundingClientRect(),n={x1:i.left,y1:i.top,x2:i.right,y2:i.bottom};this.highlightAreaInternal(n,e)},16)}clearHighlightedElement(){this.observeInterval&&(clearInterval(this.observeInterval),this.observeInterval=null),this.targetElement=null}hide(){Kt(this._element,!1),this.clearHighlightedElement(),this._element.dispatchEvent(new CustomEvent("drop-area-hidden"))}}class Ie{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 Ee extends ie{constructor(t){super(),this._layoutManager=t,this._childEventListener=t=>this.onEventFromChild(t),globalThis.addEventListener(Ee.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(Ee.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(Ee.ChildEventName,i),o=globalThis.opener;if(null===o)throw new Y("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"}(Ee||(Ee={}));class Se extends ie{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}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=Se.createMaximisePlaceElement(document),this._tabDropPlaceholder=Se.createTabDropPlaceholderElement(document),this._dragSources=[],this._updatingColumnsResponsive=!1,this._firstLoad=!0,this._eventHub=new Ee(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,O.checkInitialise(),lt.checkInitialise(),void 0!==t.containerElement&&(this._containerElement=t.containerElement)}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 gt.minifyConfig(t)}unminifyConfig(t){return gt.unminifyConfig(t)}init(){let t;if(this.setContainer(),this._dropTargetIndicator=new be,this._transitionIndicator=new Ie,this.updateSizeFromContainer(),this.isSubWindow){if(void 0===this._constructorOrSubWindowLayoutConfig)throw new X("LMIU07155");{const e=this._constructorOrSubWindowLayoutConfig.root;if(void 0===e)throw new Z("LMIC07156");if(!yt.isComponent(e))throw new Z("LMIC07157");t=e;const i=Et.resolve(this._constructorOrSubWindowLayoutConfig);this.layoutConfig=Object.assign(Object.assign({},i),{root:void 0})}}else void 0===this._constructorOrSubWindowLayoutConfig?this.layoutConfig=gt.createDefault():this.layoutConfig=Et.resolve(this._constructorOrSubWindowLayoutConfig);const e=this.layoutConfig;this._groundItem=new ce(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 X("LMLL11119");this.createSubWindows(),this.layoutConfig=Et.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 X("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:gt.Settings.createCopy(this.layoutConfig.settings),dimensions:gt.Dimensions.createCopy(this.layoutConfig.dimensions),header:gt.Header.createCopy(this.layoutConfig.header),resolved:!0}}}clear(){if(void 0===this._groundItem)throw new X("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(re.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="component"===t.type?Se.defaultLocationSelectors:Se.defaultNonComponentSelectors);const i=this.findFirstLocation(e);if(void 0===i)return;{let e,n=i.parentItem;switch(n.type){case st.ground:e=n.addItem(t,i.index),e>=0?n=this._groundItem.contentItems[0]:e=0;break;case st.row:case st.column:e=n.addItem(t,i.index);break;case st.stack:if(yt.isComponent(t)){e=n.addItem(t,i.index);break}throw Error(J[6]);case st.component:throw new Z("LMAIALC87444602");default:throw new K("LMAIALU98881733",n.type)}if(yt.isComponent(t)){const t=n.contentItems[e];re.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 X("LMUS18881");this._groundItem.setSize(this._width,this._height),this._maximisedStack&&(qt(this._maximisedStack.element,this._width),jt(this._maximisedStack.element,this._height),this._maximisedStack.updateSize(!1)),this.adjustColumnsResponsive()}}beginSizeInvalidation(){this._sizeInvalidationBeginCount++}endSizeInvalidation(){0===--this._sizeInvalidationBeginCount&&this.updateSizeFromContainer()}updateSizeFromContainer(){const{width:t,height:e}=Zt(this._containerElement);this.setSize(t,e)}updateRootSize(t=!1){if(void 0===this._groundItem)throw new X("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 F("Missing parameter 'type'",JSON.stringify(t));if(ht.isComponentItem(t)&&!(e instanceof ye)&&e&&!(!0===this.isSubWindow&&e instanceof ce)){t={type:st.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 X("LMFFCIBI82446");return this.findFirstContentItemTypeByIdRecursive(st.component,t,this._groundItem)}createPopout(t,e,i,n){return t instanceof re?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 Y("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}=Gt(t.element);e={left:i+o,top:n+s,width:r,height:a}}const r=t.toConfig();if(t.remove(),pt.isRootItemConfig(r))return this.createPopoutFromItemConfig(r,e,i,n);throw new Error(`${J[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 oe(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 me(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){Ce(t,e,i,this,n,o)}createExternalDragProxy(t,e,i){return new ue(t,e,this,i)}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 st.ground:throw new Z("LMCCIFC68871");case st.row:return new de(!1,this,t,e);case st.column:return new de(!0,this,t,e);case st.stack:return new ye(this,t,e);case st.component:return new ae(this,t,e);default:throw new K("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 X("LMCIAR44365");if(1===t.length){const t=e.getElementArea();if(null===t)throw new Y("LMCIARA44365");return void(this._itemAreas=[t])}e.contentItems[0].isStack?this._itemAreas=[]:this._itemAreas=e.createSideAreas();for(let e=0;e<t.length;e++){const i=t[e];if(re.isStack(i)){const t=i.getArea();if(null===t)continue;{this._itemAreas.push(t);const e=i.contentAreaDimensions;if(void 0===e)throw new X("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)}}}}}checkLoadedLayoutMaximiseItem(){if(void 0===this._groundItem)throw new X("LMCLLMI43432");{const t=this._groundItem.getConfigMaximisedItems();if(t.length>0){let e=t[0];if(re.isComponentItem(e)){const t=e.parent;if(null===t)throw new Y("LMXLLMI69999");e=t}if(!re.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 X("LMMXI19993");this._groundItem.element.prepend(t.element),null!==this._width&&null!==this._height&&(qt(t.element,this._width),jt(t.element,this._height)),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 Y("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 X("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 X("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 X("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===rt.always,i=t.responsiveMode===rt.onload&&this._firstLoad;return e||i}addChildContentItemsToContainer(t,e){const i=e.contentItems;if(e instanceof ye)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 X("LMFASC52778");{const t=[];return this.findAllStacksRecursive(t,this._groundItem),t}}findFirstContentItemType(t){if(void 0===this._groundItem)throw new X("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 ye?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(st.stack);return void 0===t?void 0:this.tryCreateLocationFromParentItem(t,e)}case 3:{let t=this.findFirstContentItemType(st.row);return void 0!==t?this.tryCreateLocationFromParentItem(t,e):(t=this.findFirstContentItemType(st.column),void 0!==t?this.tryCreateLocationFromParentItem(t,e):void 0)}case 4:{const t=this.findFirstContentItemType(st.row);return void 0===t?void 0:this.tryCreateLocationFromParentItem(t,e)}case 5:{const t=this.findFirstContentItemType(st.column);return void 0===t?void 0:this.tryCreateLocationFromParentItem(t,e)}case 6:if(void 0===this._groundItem)throw new X("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 X("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.defaultNonComponentSelectors=[{typeId:3,index:void 0},{typeId:7,index:void 0}],t.defaultLocationSelectors=[{typeId:1,index:void 0},{typeId:2,index:void 0},...t.defaultNonComponentSelectors],t.afterFocusedItemIfPossibleLocationSelectors=[{typeId:0,index:1},{typeId:2,index:void 0},{typeId:3,index:void 0},{typeId:7,index:void 0}]}(Se||(Se={}));class Te extends Se{constructor(t,e,i,n){if(super(Te.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 X("VLC98823");{const t=Et.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=`${J[2]}: ${JSON.stringify(e)}`;throw new j(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 X("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=gt.unminifyConfig(i);r=Et.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}}}(Te||(Te={}));class xe extends Te{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 q("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(J[1]);if(void 0!==this._componentTypesMap.get(t))throw new j(`${J[3]}: ${t}`);this._componentTypesMap.set(t,{constructor:e,factoryFunction:void 0,virtual:i})}registerComponentFactoryFunction(t,e,i=!1){if("function"!=typeof e)throw new j("Please register a constructor function");if(void 0!==this._componentTypesMap.get(t))throw new j(`${J[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=ut.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=ut.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:Xt({},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 X("GLBCVCU988774");{const e=a,i=e.rootHtmlElement;if(void 0===i)throw new j(`${J[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 X("GLHCSCE55933");{const o=n.rootHtmlElement;if(void 0===o)throw new j(J[4]+" "+t.title);{const n=t.element.getBoundingClientRect(),s=n.left-this._goldenLayoutBoundingClientRect.left;o.style.left=Ut(s);const r=n.top-this._goldenLayoutBoundingClientRect.top;o.style.top=Ut(r),qt(o,e),jt(o,i)}}}handleContainerVirtualVisibilityChangeRequiredEvent(t,e){const i=this._virtuableComponentMap.get(t);if(void 0===i)throw new X("GLHCVVCRE55934");{const n=i.rootHtmlElement;if(void 0===n)throw new j(J[4]+" "+t.title);Kt(n,e)}}handleContainerVirtualZIndexChangeRequiredEvent(t,e,i){const n=this._virtuableComponentMap.get(t);if(void 0===n)throw new X("GLHCVZICRE55935");{const e=n.rootHtmlElement;if(void 0===e)throw new j(J[4]+" "+t.title);e.style.zIndex=i}}}const Le={show:"top",popout:!1,close:"close-tab-unused"},Ae={headerHeight:31},Me={hasHeaders:!0,reorderEnabled:!0,showMaximiseIcon:!1},ze={popoutWholeStack:!1,constrainDragToContainer:!1,constrainDragToHeaders:!1,preventDragout:!1,showPopoutIcon:!1,showCloseIcon:!1,blockedPopoutsThrowError:!0,closePopoutsOnUnload:!0,selectionEnabled:!1};var De,ke,Pe,Oe;class Re{constructor(t){De.set(this,void 0),ke.set(this,void 0),Pe.set(this,void 0),Oe.set(this,void 0),this.handleResize=t=>{t.forEach(t=>this.resizeElement(t.target))},this.handleMutation=()=>{i(this,Oe,"f").layoutViewsByContainerElement.forEach(t=>{this.resizeElement(t.container.element)})},this.handleIntersection=t=>{t.forEach(t=>{t.isIntersecting&&this.handleMutation()})},n(this,Oe,t,"f"),n(this,De,new ResizeObserver(this.handleResize),"f"),n(this,ke,new MutationObserver(this.handleMutation),"f"),n(this,Pe,new IntersectionObserver(this.handleIntersection,{root:null,rootMargin:"0px",threshold:Array.from({length:1001},(t,e)=>e/1e3)}),"f")}observeMutations(t){i(this,ke,"f")?.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]})}destroy(){i(this,De,"f").disconnect(),i(this,ke,"f").disconnect(),i(this,Pe,"f").disconnect()}observeContainer(t){i(this,De,"f").observe(t)}unobserveContainer(t){i(this,De,"f").unobserve(t)}observeIntersection(t){i(this,Pe,"f").observe(t)}unobserveIntersection(t){i(this,Pe,"f").unobserve(t)}resizeElement(t){const e=i(this,Oe,"f").layoutViewsByContainerElement.get(t);e&&e.resize()}}De=new WeakMap,ke=new WeakMap,Pe=new WeakMap,Oe=new WeakMap;class Be{constructor(t,e,i){this._item=t,this._layout=e,this._wrap=i}get raw(){return this._item}get layout(){return this._layout}get type(){return this._item.type}get contentItems(){return(this._item.contentItems??[]).map(t=>this._wrap(t))}get parent(){const t=this._item.parent;return t?this._wrap(t):null}setActiveContentItem(t,e){if("stack"!==this.type)throw new Error(`Cannot call setActiveContentItem from a non-stack item: ${this.type}`);this._item.setActiveContentItem(t.raw,e)}static wrapInternal(t,e,i){const n=Be.wrapCache.get(e);if(n)return n;const o=new t(e,i,e=>Be.wrapInternal(t,e,i));return Be.wrapCache.set(e,o),o}}Be.wrapCache=new WeakMap;const Ve=t=>!!t&&"contentItems"in t&&(t.isRow||t.isColumn);class He extends Be{isRoot(){return!!this._item.parent?.isGround}getBounds(){return this._item.element.getBoundingClientRect()}get viewName(){if(this._item.isComponent){const{component:t}=this._item;return t.identity.name}throw new Error("View name not found")}onDestroyed(t){const e=({target:i})=>{i===this._item&&(t(),this._item.off("itemDestroyed",e))};this._item.on("itemDestroyed",e)}createAdjacentStack({position:t="right"}={}){const e=this.raw;if(e.parent){const i=["top","bottom"].includes(t)?"column":"row",n=["left","top"].includes(t)?1:0,o=Ve(e.parent)?e.parent:e.layoutManager,s=o,r=e.parent.contentItems.indexOf(e);e.parent.isGround&&e.parent.removeChild(e,!0);const a=o.newItem({type:i,content:[{type:"stack",content:[]}]},r);if(!a)throw new Error("createAdjacentStack: Failed to create new container");const l=a.contentItems[0];return a.addChild(this.raw,n),Ve(s)&&s.removeChild(e,!0),this._wrap(l)}throw new Error("Cannot create adjacent stack if no parent exists.")}static wrap(t,e){return Be.wrapInternal(He,t,e)}}var Ne={},We={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.restoreComponentItems=t.updateComponentItems=t.normalizeLayout=t.DUPLICATE_PROP_PREFIX=void 0,t.DUPLICATE_PROP_PREFIX="initial_";t.normalizeLayout=e=>{for(const i of e){if("component"===i.type&&"componentState"in i){const{componentState:t,...e}=i;"object"==typeof i.componentState&&(i.componentState={...i.componentState,...e})}if("stack"===i.type&&i.content&&"activeItemIndex"in i){const t=i.content.length,e=i.activeItemIndex;0===t?delete i.activeItemIndex:e<0?i.activeItemIndex=0:e>t-1&&(i.activeItemIndex=t-1)}i.content&&(0,t.normalizeLayout)(i.content)}},t.updateComponentItems=function e(i=[],n){for(const o of i)"component"===o.type?Object.keys(n).forEach(e=>{e in o&&(o.componentState={[`${t.DUPLICATE_PROP_PREFIX}${e}`]:o[e],...o.componentState??{}}),o[e]=n[e]}):o.content&&e(o.content,n)},t.restoreComponentItems=function e(i=[],n,o){for(const s of i)if("component"===s.type)Object.keys(n).forEach(e=>{const i=`${t.DUPLICATE_PROP_PREFIX}${e}`;if(s.componentState&&i in s.componentState)return s[e]=s.componentState[i],void delete s.componentState[i];s[e]=n[e]});else{if(s.size&&("row"===o||"column"===o)){const t="row"===o?"width":"height",e=s.size;s[t]=parseFloat(e)}s.content&&e(s.content,n,s.type)}}}(We);var Ue,Fe={};Ue=Fe,Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.applyTabOverflowSetting=Ue.mergeOpenFinSettings=Ue.extractOpenFinSettings=Ue.OPENFIN_ONLY_SETTINGS=void 0,Ue.OPENFIN_ONLY_SETTINGS=["newTabButtonUrl","preventSplitterResize","constrainDragToHeaders","preventDragIn","preventDragOut","defaultFaviconUrl","showFavicons"],Ue.extractOpenFinSettings=function(t){const e={},i={...t};for(const t of Ue.OPENFIN_ONLY_SETTINGS)t in i&&(e[t]=i[t],delete i[t]);return{gl2Settings:i,openFinSettings:e}},Ue.mergeOpenFinSettings=function(t,e){const i={...t};for(const t of Ue.OPENFIN_ONLY_SETTINGS)t in e&&(i[t]=e[t]);return i},Ue.applyTabOverflowSetting=function(t){"scroll"===t.tabOverflowBehavior&&(t.disableTabOverflowDropdown=!0)};var $e={},qe={};function je(t){const e={...t};t.content&&(t.content.length>0&&(1===t.content.length?e.root=Ke(t.content[0],void 0,t.maximisedItemId):e.root=Ke({type:"row",content:t.content},void 0,t.maximisedItemId)),delete e.content),delete e.maximisedItemId,t.openPopouts&&(e.openPopouts=t.openPopouts.map(Qe)),t.dimensions&&(e.dimensions=function(t){const e={...t};void 0===e.defaultMinItemWidth&&void 0!==e.minItemWidth&&(e.defaultMinItemWidth=`${e.minItemWidth}px`);void 0===e.defaultMinItemHeight&&void 0!==e.minItemHeight&&(e.defaultMinItemHeight=`${e.minItemHeight}px`);return delete e.minItemWidth,delete e.minItemHeight,e}(t.dimensions));const i={close:t.labels?.close,maximise:t.labels?.maximise,minimise:t.labels?.minimise,popout:t.labels?.popout,tabDropdown:t.labels?.tabDropdown};return void 0!==t.settings?.hasHeaders&&(i.show=!!t.settings.hasHeaders&&"top"),(t.header||Object.values(i).some(t=>void 0!==t))&&(e.header={...i,...t.header??{}},!0===e.header.show&&(e.header.show="top")),t.labels&&delete e.labels,e}function Ge(t){const e={...t};if("root"in t&&(e.content=t.root?[Ye(t.root)]:[],delete e.root,e.content[0]&&function(t){const e={found:!1};return Je(t,e),e.found}(e.content[0])?e.maximisedItemId=Ze:delete e.maximisedItemId),t.openPopouts&&(e.openPopouts=t.openPopouts.map(ti)),t.dimensions&&(e.dimensions=function(t){const e={...t};if(void 0===e.minItemWidth&&void 0!==e.defaultMinItemWidth){const t=ei(e.defaultMinItemWidth);void 0!==t&&(e.minItemWidth=t,delete e.defaultMinItemWidth)}if(void 0===e.minItemHeight&&void 0!==e.defaultMinItemHeight){const t=ei(e.defaultMinItemHeight);void 0!==t&&(e.minItemHeight=t,delete e.defaultMinItemHeight)}return e}(t.dimensions)),t.header){const i={close:"string"==typeof t.header.close?t.header.close:t.labels?.close,maximise:"string"==typeof t.header.maximise?t.header.maximise:t.labels?.maximise,minimise:"string"==typeof t.header.minimise?t.header.minimise:t.labels?.minimise,popout:"string"==typeof t.header.popout?t.header.popout:t.labels?.popout,tabDropdown:"string"==typeof t.header.tabDropdown?t.header.tabDropdown:t.labels?.tabDropdown};Object.values(i).some(t=>void 0!==t)&&(e.labels=i);const n={...t.settings??{}};void 0!==t.header.show&&(n.hasHeaders=!1!==t.header.show),!1===t.header.close&&(n.showCloseIcon=!1),!1===t.header.maximise&&(n.showMaximiseIcon=!1),!1===t.header.popout&&(n.showPopoutIcon=!1),!1===t.header.tabDropdown&&(n.disableTabOverflowDropdown=!0),Object.keys(n).length>0&&(e.settings=n),delete e.header}return e}Object.defineProperty(qe,"__esModule",{value:!0}),qe.gl2ToGL1=qe.gl1ToGL2=qe.detectConfigVersion=void 0,qe.detectConfigVersion=function(t){return void 0!==t.root?"gl2":void 0!==t.content?"gl1":"unknown"},qe.gl1ToGL2=je,qe.gl2ToGL1=Ge;const Ze="__glMaximised";function Ke(t,e,i){const n={...t};if("component"===n.type){const t=n;t.componentType="view",delete t.componentName}if("stack"===n.type&&void 0!==n.hasHeaders&&(n.header={show:n.header?.show??(!!n.hasHeaders&&"top"),...n.header},delete n.hasHeaders),function(t,e){return!!e&&(Array.isArray(t.id)?t.id.includes(e):t.id===e)}(n,i)&&(n.maximised=!0,n.id=function(t,e){if(!e)return t;if(Array.isArray(t)){const i=t.filter(t=>t!==e);if(0===i.length)return;return 1===i.length?i[0]:i}return t===e?void 0:t}(n.id,i)),!("size"in n)||void 0===n.size){const t="column"===e?n.height??n.width:n.width??n.height;void 0!==t&&(n.size=`${t}%`,delete n.width,delete n.height)}if("content"in n&&Array.isArray(n.content)){const t=n.type;n.content=n.content.map(e=>Ke(e,t,i))}if("stack"===n.type&&"content"in n&&Array.isArray(n.content)){n.content=n.content.flatMap(t=>"stack"===t.type&&"content"in t&&Array.isArray(t.content)?t.content:[t]);if(n.content.filter(t=>"row"===t.type||"column"===t.type).length>0&&1===n.content.length){const t={...n.content[0]};return n.size&&!t.size&&(t.size=n.size),n.id&&!t.id&&(t.id=n.id),t}}if("stack"===n.type){const t=n,e=t.content?.length??0;0===e?delete t.activeItemIndex:void 0!==t.activeItemIndex&&t.activeItemIndex>e-1&&(t.activeItemIndex=e-1)}return n}function Ye(t,e){const i={...t};if("component"===i.type){const t=i;t.componentName="view",delete t.componentType}if("stack"===i.type&&void 0!==i.header?.show){i.hasHeaders=!1!==i.header.show;const t={...i.header};delete t.show,Object.keys(t).length>0?i.header=t:delete i.header}if(!(!("size"in i)||void 0===i.size||"width"in i&&void 0!==i.width||"height"in i&&void 0!==i.height)){const t=i.size,n=t.match(/^([\d.]+)\s*%$/);if(n){const t=parseFloat(n[1]);"column"===e?i.height=t:i.width=t,delete i.size}else void 0===e&&/^([\d.]+)\s*fr$/i.test(t)&&(i.width=100,delete i.size)}if("content"in i&&Array.isArray(i.content)){const t=i.type,e=i.content.map(e=>Ye(e,t));i.content=e,"row"!==t&&"column"!==t||function(t,e){const i=[],n=[];let o=0;for(const s of t){const t=s,r="string"==typeof t.size?t.size.match(/^([\d.]+)\s*fr$/i):null;if(r)i.push({item:t,fr:parseFloat(r[1])});else{const i="column"===e?t.height:t.width;"number"==typeof i&&(o+=i,n.push({item:t,percent:i}))}}if(0===i.length)return;const s=i.reduce((t,e)=>t+e.fr,0);if(s<=0)return;if(Math.round(o)<100){const t=100-o;for(const n of i)Xe(n.item,e,n.fr/s*t),delete n.item.size;return}const r=Math.round(o)>100?50:0,a=o+r,l=a>0?100/a:0;for(const t of n)Xe(t.item,e,t.percent*l);for(const t of i){const i=r*(t.fr/s)*l;Xe(t.item,e,i),delete t.item.size}}(e,t)}return i}function Xe(t,e,i){"column"===e?t.height=i:t.width=i}function Je(t,e){const i=t;if(e.found||"stack"!==t.type&&"component"!==t.type||!0!==i.maximised||(t.id=function(t){return void 0===t?Ze:Array.isArray(t)?t.includes(Ze)?t:[...t,Ze]:t===Ze?t:[t,Ze]}(t.id),e.found=!0),delete i.maximised,"content"in t&&Array.isArray(t.content))for(const i of t.content)Je(i,e)}function Qe(t){const e=je(t);var i;return e.window||(i=e.dimensions,void 0===i?.width&&void 0===i?.height&&void 0===i?.left&&void 0===i?.top)||(e.window={width:e.dimensions?.width??void 0,height:e.dimensions?.height??void 0,left:e.dimensions?.left??void 0,top:e.dimensions?.top??void 0},e.dimensions=function(t){if(!t)return;const e={...t};return delete e.width,delete e.height,delete e.left,delete e.top,Object.keys(e).length>0?e:void 0}(e.dimensions)),e}function ti(t){const e=Ge(t);return e.window&&(e.dimensions={...e.dimensions??{},...e.window},delete e.window),e}function ei(t){const e=t.match(/^(\d+(?:\.\d+)?)\s*px$/i);return e?parseFloat(e[1]):void 0}Object.defineProperty($e,"__esModule",{value:!0}),$e.validateSnapshot=void 0;const ii=qe,ni=new Set(["row","column","stack","component"]),oi=/^(\d+(?:\.\d+)?)\s*(%|fr|px|em|rem)$/,si=new Set(["%","fr"]),ri=new Set(["px"]);function ai(t,e,i,n){return{code:t,severity:"error",message:e,path:i,autoRepair:n}}function li(t,e,i,n){return{code:t,severity:"warning",message:e,path:i,autoRepair:n}}function hi(t){const e=[];if(!t||"object"!=typeof t)return{valid:!1,version:"unknown",issues:[ai("NOT_OBJECT","Config must be an object","")]};const i=t,n=(0,ii.detectConfigVersion)(i),o="gl2"===n&&i.root?[i.root]:i.content??[];0===o.length&&e.push(li("EMPTY_LAYOUT","Layout has no content items","root")),di(o,"root",null,e),i.dimensions&&function(t,e){const i=t,n=["minItemWidth","minItemHeight"];for(const t of n)"string"==typeof i[t]&&e.push(ai("INVALID_DIMENSION",`${t} must be a number`,`dimensions.${t}`));for(const t of["defaultMinItemWidth","defaultMinItemHeight"])"string"==typeof i[t]&&ci(i[t],`dimensions.${t}`,ri,'"50px"',e)}(i.dimensions,e),function(t,e){t?.forEach((t,i)=>{const n=`openPopouts[${i}]`;if(!t||"object"!=typeof t)return void e.push(ai("INVALID_POPOUT","Popout config must be an object",n));const o=hi(t);for(const t of o.issues)e.push({...t,path:t.path?`${n}.${t.path}`:n})})}(i.openPopouts,e);return{valid:e.every(t=>"error"!==t.severity),version:n,issues:e}}function di(t,e,i,n){t.forEach((t,o)=>{const s=`${e}[${o}]`,r=t.type;if("ground"===r)return void n.push(ai("ITEM_TYPE_GROUND",'Items cannot specify type "ground" (reserved for internal use)',s));if("string"!=typeof r)return void n.push(ai("TYPE_NOT_STRING","Item type must be a string, got "+typeof r,s));if(!ni.has(r))return void n.push(ai("INVALID_ITEM_TYPE",`Unknown item type "${r}". Must be row, column, stack, or component`,s));"component"===r&&(t.componentType||t.componentName||n.push(ai("MISSING_COMPONENT_TYPE","Component must have componentType or componentName",s)));const a=Array.isArray(t.content)?t.content:void 0;if("stack"===r&&a&&a.forEach((t,e)=>{t.type&&"component"!==t.type&&n.push(ai("STACK_NON_COMPONENT_CHILD",`Stack children must be type "component", found "${t.type}"`,`${s}.content[${e}]`))}),"stack"===r&&"activeItemIndex"in t){const e=a?.length??0,i=t.activeItemIndex;e>0&&(i<0||i>=e)&&n.push(li("ACTIVE_INDEX_OOB",`activeItemIndex ${i} out of range [0, ${e-1}]`,s,`Clamp to ${Math.min(Math.max(0,i),e-1)}`))}"string"==typeof t.size&&ci(t.size,`${s}.size`,si,'"50%" or "1fr"',n),"string"==typeof t.minSize&&ci(t.minSize,`${s}.minSize`,ri,'"50px"',n),"row"!==r&&"column"!==r||a&&0!==a.length||n.push(li("EMPTY_CONTAINER",`${r} has no content items`,s)),"stack"===r&&(a&&0!==a.length||n.push(li("EMPTY_STACK","Stack has no content items",s))),null===i&&"component"===r&&!0===t.maximised&&n.push(ai("ROOT_COMPONENT_MAXIMISED","Root-level component cannot have maximised=true",s)),a&&di(a,`${s}.content`,r,n)})}function ci(t,e,i,n,o){if("string"!=typeof t)return void o.push(ai("INVALID_SIZE","Size must be a string, got "+typeof t,e));const s=t.match(oi);if(!s)return void o.push(ai("INVALID_SIZE",`Cannot parse size "${t}". Expected format: ${n}`,e));const r=parseFloat(s[1]);if(Number.isNaN(r))return void o.push(ai("INVALID_SIZE",`Size "${t}" has invalid numeric part`,e));const a=s[2];i.has(a)||o.push(ai("INVALID_SIZE",`Size "${t}" uses unsupported unit "${a}"`,e))}$e.validateSnapshot=hi,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSnapshot=t.OPENFIN_ONLY_SETTINGS=t.restoreComponentItems=t.updateComponentItems=t.normalizeLayout=void 0;var e=We;Object.defineProperty(t,"normalizeLayout",{enumerable:!0,get:function(){return e.normalizeLayout}}),Object.defineProperty(t,"updateComponentItems",{enumerable:!0,get:function(){return e.updateComponentItems}}),Object.defineProperty(t,"restoreComponentItems",{enumerable:!0,get:function(){return e.restoreComponentItems}});var i=Fe;Object.defineProperty(t,"OPENFIN_ONLY_SETTINGS",{enumerable:!0,get:function(){return i.OPENFIN_ONLY_SETTINGS}});var n=$e;Object.defineProperty(t,"validateSnapshot",{enumerable:!0,get:function(){return n.validateSnapshot}})}(Ne);const ui=Ne.updateComponentItems,mi=Ne.restoreComponentItems,pi=Ne.normalizeLayout;function fi(t){return t&&"string"==typeof t?function(t){let e=t,i="",n=0;for(;e!==i&&n<10;)i=e,e=m.decode(e),n++;return n>=10?"Unknown Title":e}(t):t}const gi=t=>class extends t{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#i=!1,this.favicon=null}#t;#e;#i;#n(t){this.favicon=t,this.dispatchEvent(new CustomEvent("page-favicon-updated",{detail:{favicon:t}}))}#o(){const t=this.iframe;if(t&&t.contentDocument?.head&&t.contentWindow&&window.top&&o(t.contentWindow.window,window.top)&&(this.#t=s(t.contentDocument.head,t=>this.dispatchEvent(new CustomEvent("page-title-updated",{detail:{title:t}}))),this.dispatchEvent(new CustomEvent("page-title-updated",{detail:{title:t.contentDocument.title}})),this.showFavicon)){this.#e=r(t.contentDocument.head,t=>this.#n(t));const e=t.contentDocument.querySelector('link[rel~="icon"]')?.href;e&&this.#n(e)}}#s(){this.#t&&(this.#t.disconnect(),this.#t=null),this.#e&&(this.#e.disconnect(),this.#e=null)}get lastKnownUrl(){return this.iframe?.contentDocument?.location.href}getOrDiscoverFavicon(){if(!this.#i)return Promise.resolve(null);const t=this.iframe;if(!t)return Promise.resolve(null);return!!(t.contentDocument?.head&&t.contentWindow&&window.top&&o(t.contentWindow,window.top))&&t.contentDocument?(this.#e||(this.#e=r(t.contentDocument.head,t=>this.#n(t))),Promise.resolve(t.contentDocument.querySelector('link[rel~="icon"]')?.href??null)):Promise.resolve(null)}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.");if(!this.iframe){const t=document.createElement("iframe");t.addEventListener("load",()=>{this.#i=!0,this.#o()}),t.addEventListener("unload",()=>{this.#s()}),t.src=this.src,this.allow&&(t.allow=this.allow),t.style.height="100%",t.style.width="100%",t.style.border="none",this.forceFrameName?t.setAttribute("name",this.forceFrameName):t.setAttribute("name",a({brokerUrl:this.brokerUrl,name:this.name,uuid:this.uuid,providerId:this.providerId,contextGroup:this.contextGroup},"of-frame")),t.setAttribute("id",this.name),this.appendChild(t)}}get iframe(){return this.querySelector(`iframe[id="${this.name}"]`)}get title(){return this.getAttribute("title")??this.iframe?.title??""}set title(t){this.setAttribute("title",t),this.iframe&&(this.iframe.title=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)}get allow(){return this.getAttribute("allow")}set allow(t){t&&this.setAttribute("allow",t)}get showFavicon(){return this.hasAttribute("of-show-favicon")}set showFavicon(t){t?this.setAttribute("of-show-favicon",""):this.removeAttribute("of-show-favicon")}static get observedAttributes(){return["name"]}};class vi{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",gi(HTMLElement));const yi=l.getLogger("of-view");class _i{constructor(t,e,i,n){const{url:o,web:s,interop:r,name:a}=t;if(this.identity={uuid:e,name:a??`internal-generated-view-${p()}`},this.componentState=t,this.state={...t},void 0===o)return void(this.ofViewElement=null);this.state.url=o;const l={"of-broker":i.brokerUrl,"of-uuid":e,"of-name":this.identity.name,src:o};s?.frameName&&(l.forceFrameName=s.frameName);const h=r?.currentContextGroup??i.interopConfig?.currentContextGroup;h&&(l["of-context-group"]=h),i.interopConfig?.providerId&&(l["of-provider-id"]=i.interopConfig.providerId),t.permissions?.webAPIs&&(l.allow=t.permissions.webAPIs.reduce((t,e)=>{const i=(t=>{switch(t){case"clipboard-read":return"clipboard-read";case"clipboard-sanitized-write":return"clipboard-write";default:return""}})(e);return i?`${t} ${i} *;`.trim():t},""),yi.debug(`Applying webAPIs: ${l.allow}`)),this.ofViewElement=vi.create(l),this.ofViewElement.style.position="absolute",n.appendChild(this.ofViewElement)}hide(){this.ofViewElement&&(this.ofViewElement.style.display="none")}show(){this.ofViewElement&&(this.ofViewElement.style.display="block")}setTitle(t){this.ofViewElement&&(this.ofViewElement.title=t)}get lastKnownUrl(){return this.ofViewElement?.lastKnownUrl}get favicon(){return this.ofViewElement?.favicon??null}destroy(){this.ofViewElement?.remove()}}var wi,Ci,bi,Ii,Ei,Si,Ti,xi;const Li=l.getLogger("view-component");class Ai{constructor(t,e,o){this.container=t,this.ofView=e,wi.add(this),Ci.set(this,!1),bi.set(this,null),Ii.set(this,null),Ei.set(this,void 0),t.element.setAttribute("of-name",e.identity.name),t.element.id=`container-${e.identity.name}`,t.parent.id=e.identity.name,n(this,Ei,o?.defaultFaviconUrl??null,"f"),"view"!==t.parent.title&&(e.state.title=t.parent.title),i(this,wi,"m",Si).call(this),i(this,wi,"m",Ti).call(this,o)}get identity(){return this.ofView.identity}get componentState(){return this.ofView.componentState}setFavicon(t){t&&this.ofView.ofViewElement&&(this.ofView.ofViewElement.favicon=t),this.container.tab&&(this.ofView.componentState?.icon?this.container.tab.setIcon(this.ofView.componentState?.icon,i(this,Ei,"f")):t?this.container.tab.setIcon(t,i(this,Ei,"f")):this.container.tab.setIcon(i(this,Ei,"f")))}setTitle(t){const e=fi("options"===this.ofView.state.titlePriority?this.ofView.state.title||this.ofView.identity.name:t||this.ofView.state.title||this.ofView.lastKnownUrl||this.ofView.state.url);e&&(Li.debug(`${this.ofView.identity.name} setting title to ${e}`),this.container.parent.setTitle(e),this.ofView.setTitle(e))}isActive(){return this.container.tab?.element.className.includes("lm_active")??!1}isDragging(){return this.container.tab?.element.className.includes("lm_dragging")??!1}setIsMinimised(t){n(this,Ci,t,"f")}focusContent(){const t=this.ofView.ofViewElement?.iframe;t?.contentWindow?t.contentWindow.focus():t?t.focus():this.ofView.ofViewElement?.focus()}toggleZIndex(t){this.ofView.ofViewElement&&(this.ofView.ofViewElement.style.zIndex=t?"99":"")}resize(){const t=this.ofView.ofViewElement;if(!t)return;if(this.isDragging()||i(this,Ci,"f"))return void(t.style.display="none");const e=this.container.element.getBoundingClientRect();0!==e.width&&0!==e.height?(t.style.position="absolute",t.style.height=`${e.height}px`,t.style.width=`${e.width}px`,t.style.inset=`${e.top}px ${e.right}px ${e.bottom}px ${e.left}px`,t.style.display="block"):t.style.display="none"}closeView(){this.container.close()}destroy(){const t=this.ofView.ofViewElement;t&&(i(this,bi,"f")&&(t.removeEventListener("page-title-updated",i(this,bi,"f")),n(this,bi,null,"f")),i(this,Ii,"f")&&(t.removeEventListener("page-favicon-updated",i(this,Ii,"f")),n(this,Ii,null,"f"))),this.ofView.hide()}}Ci=new WeakMap,bi=new WeakMap,Ii=new WeakMap,Ei=new WeakMap,wi=new WeakSet,Si=function(){this.container.on("hide",()=>{this.ofView.hide()}),this.container.on("show",()=>{this.ofView.show(),this.resize()})},Ti=function(t){if(this.ofView.ofViewElement){this.setTitle(this.ofView.state.title),n(this,bi,t=>{const{detail:e}=t,i="options"===this.ofView.state.titlePriority?this.ofView.state.title:e.title;this.setTitle(i)},"f"),this.ofView.ofViewElement.addEventListener("page-title-updated",i(this,bi,"f"));const e=!1!==t?.showFavicons;this.ofView.ofViewElement.showFavicon=e,e&&(n(this,Ii,t=>{const e=t.detail?.favicon;this.setFavicon(e)},"f"),this.ofView.ofViewElement.addEventListener("page-favicon-updated",i(this,Ii,"f"))),this.ofView.show()}else i(this,wi,"m",xi).call(this)},xi=function(){const t=document.createElement("div");t.setAttribute("style","padding: 20px"),t.innerText="No URL provided",this.container.element.appendChild(t)};const Mi=["active-tab","add-tab-button"],zi=["inactive-tab","active-tab","active-tab-close-button","inactive-tab-close-button","add-tab-button"],Di={tabNavigation:Mi,arrowNavigation:zi,enableDeleteKeyClose:!1,enableHomeEndNavigation:!1,announceTabChanges:!0,focusOnCloseStrategy:"next",ariaLabels:void 0},ki="lm_tab",Pi="lm_active",Oi={TABS_CONTAINER:`.${"lm_tabs"}`,TAB:`.${ki}`,ACTIVE_TAB:`.${ki}.${Pi}`,CLOSE_BUTTON:`.${"lm_close_tab"}`,ADD_TAB_BUTTON:".newTabButton, .addTabButton",TAB_TITLE:`.${"lm_title"}`,VIEW_CONTAINER:`.${"lm_content"}`,HEADER:`.${"lm_header"}`};var Ri,Bi,Vi,Hi,Ni,Wi,Ui,Fi,$i,qi,ji=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},Gi=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)};class Zi{constructor(t,e){Ri.add(this),Bi.set(this,void 0),Vi.set(this,void 0),Hi.set(this,null),ji(this,Bi,t,"f"),ji(this,Vi,e,"f"),Gi(this,Vi,"f").announceTabChanges&&Gi(this,Ri,"m",qi).call(this)}updateOptions(t){ji(this,Vi,t,"f"),Gi(this,Vi,"f").announceTabChanges?Gi(this,Ri,"m",qi).call(this):Gi(this,Hi,"f")&&(Gi(this,Hi,"f").remove(),ji(this,Hi,null,"f"))}announce(t){Gi(this,Vi,"f").announceTabChanges&&Gi(this,Hi,"f")&&(Gi(this,Hi,"f").textContent="",requestAnimationFrame(()=>{Gi(this,Hi,"f")&&(Gi(this,Hi,"f").textContent=t)}))}destroy(){Gi(this,Hi,"f")?.remove(),ji(this,Hi,null,"f")}initializeTabGroup(t){t.setAttribute("role","tablist")}initializeTab(t,e,i,n,o){const s=`tab-${e}`,r=`container-${e}`;t.id||(t.id=s),t.setAttribute("role","tab"),t.setAttribute("aria-controls",r),t.setAttribute("aria-selected",String(i));const a=Gi(this,Ri,"m",Ni).call(this,t),l=Gi(this,Ri,"m",Ui).call(this,a,i,n,o);t.setAttribute("aria-label",l);const h=t.querySelector(Oi.CLOSE_BUTTON);h&&this.initializeCloseButton(h,a,i)}initializeCloseButton(t,e,i){t.setAttribute("role","button");const n=Gi(this,Ri,"m",Fi).call(this,e,i);t.setAttribute("aria-label",n)}initializeAddTabButton(t,e){t.setAttribute("role","button");const i=Gi(this,Ri,"m",$i).call(this,e);t.setAttribute("aria-label",i)}initializeViewContainer(t,e){const i=`container-${e}`,n=`tab-${e}`,o=t.matches(Oi.VIEW_CONTAINER)?t:t.querySelector(Oi.VIEW_CONTAINER),s=Gi(this,Bi,"f").querySelector(`.lm_content[of-name="${e}"]`)??o;s&&(document.querySelectorAll(`[id="${i}"]`).forEach(t=>{t!==s&&t.removeAttribute("id")}),s.id=i,s.setAttribute("role","tabpanel"),s.setAttribute("aria-labelledby",n),s.setAttribute("tabindex","-1"))}updateTabSelection(t,e,i){const n=i??t.querySelectorAll(Oi.TAB),o=n.length;let s="";n.forEach((t,i)=>{const n=t,r=n===e;n.setAttribute("aria-selected",String(r));const a=Gi(this,Ri,"m",Ni).call(this,n);r&&(s=a);const l=Gi(this,Ri,"m",Ui).call(this,a,r,i,o);n.setAttribute("aria-label",l)}),s&&this.announce(`Selected: ${s}`)}refreshTabLabel(t){const e=t.closest(Oi.TABS_CONTAINER);if(!e)return;const i=e.querySelectorAll(Oi.TAB),n=i.length,o=Array.from(i).indexOf(t);if(-1===o)return;const s=t.classList.contains(Pi),r=Gi(this,Ri,"m",Ni).call(this,t);t.setAttribute("aria-label",Gi(this,Ri,"m",Ui).call(this,r,s,o,n));const a=t.querySelector(Oi.CLOSE_BUTTON);a&&a.setAttribute("aria-label",Gi(this,Ri,"m",Fi).call(this,r,s))}refreshAllLabels(){Gi(this,Bi,"f").querySelectorAll(Oi.TABS_CONTAINER).forEach(t=>{const e=t.querySelectorAll(Oi.TAB);e.forEach(t=>this.refreshTabLabel(t));const i=t.closest(Oi.HEADER),n=i?.querySelector(Oi.ADD_TAB_BUTTON)||t.querySelector(Oi.ADD_TAB_BUTTON)||t.closest(".lm_stack")?.querySelector(Oi.ADD_TAB_BUTTON);n&&n.setAttribute("aria-label",Gi(this,Ri,"m",$i).call(this,e.length))})}}Bi=new WeakMap,Vi=new WeakMap,Hi=new WeakMap,Ri=new WeakSet,Ni=function(t){const e=t.querySelector(Oi.TAB_TITLE);return e?.textContent?.trim()||""},Wi=function(){return{arrowNavigationEnabled:(Gi(this,Vi,"f").arrowNavigation?.length??0)>0,deleteKeyCloseEnabled:Gi(this,Vi,"f").enableDeleteKeyClose??!1,homeEndNavigationEnabled:Gi(this,Vi,"f").enableHomeEndNavigation??!1}},Ui=function(t,e,i,n){const o={...Gi(this,Ri,"m",Wi).call(this),title:t,isActive:e,tabIndex:i,tabCount:n},{ariaLabels:s}=Gi(this,Vi,"f"),r=e?s?.activeTab:s?.inactiveTab;return"function"==typeof r?r(o):"string"==typeof r?r:e?(t=>{const e=[t.title];if(t.arrowNavigationEnabled&&e.push("use arrow keys to navigate"),t.deleteKeyCloseEnabled){const t="undefined"!=typeof navigator?navigator:void 0,i="macOS"===t?.userAgentData?.platform||t?.platform?.startsWith("Mac");e.push(i?"press Backspace to close":"press Delete to close")}return e.join(", ")})(o):(t=>t.title)(o)},Fi=function(t,e){const i={...Gi(this,Ri,"m",Wi).call(this),title:t,isActive:e},n=Gi(this,Vi,"f").ariaLabels?.closeButton;return"function"==typeof n?n(i):"string"==typeof n?n:(t=>`Close ${t.title}`)(i)},$i=function(t){const e={...Gi(this,Ri,"m",Wi).call(this),tabCount:t},i=Gi(this,Vi,"f").ariaLabels?.addTabButton;return"function"==typeof i?i(e):"string"==typeof i?i:"Add new tab"},qi=function(){Gi(this,Hi,"f")||(ji(this,Hi,document.createElement("span"),"f"),Gi(this,Hi,"f").setAttribute("role","status"),Gi(this,Hi,"f").setAttribute("aria-live","polite"),Gi(this,Hi,"f").setAttribute("aria-atomic","true"),Object.assign(Gi(this,Hi,"f").style,{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"}),Gi(this,Bi,"f").appendChild(Gi(this,Hi,"f")))};var Ki,Yi,Xi,Ji,Qi,tn,en,nn,on,sn,rn,an,ln,hn,dn,cn,un,mn,pn,fn,gn,vn=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},yn=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)};class _n{constructor(t,e,i){Ki.add(this),Yi.set(this,void 0),Xi.set(this,void 0),Ji.set(this,void 0),Qi.set(this,void 0),tn.set(this,void 0),en.set(this,void 0),vn(this,Yi,t,"f"),vn(this,Xi,e,"f"),vn(this,Ji,i.onTabClose,"f"),vn(this,Qi,i.onTabActivate,"f"),vn(this,tn,i.onAddTab,"f"),vn(this,en,yn(this,Ki,"m",nn).bind(this),"f"),yn(this,Yi,"f").addEventListener("keydown",yn(this,en,"f"))}updateOptions(t){vn(this,Xi,t,"f"),yn(this,Ki,"m",fn).call(this)}destroy(){yn(this,Yi,"f").removeEventListener("keydown",yn(this,en,"f"))}initializeTabGroup(t){yn(this,Ki,"m",gn).call(this,t)}updateActiveTab(t,e,i){const n=yn(this,Xi,"f").tabNavigation??Mi;(i??t.querySelectorAll(Oi.TAB)).forEach(t=>{t.setAttribute("tabindex","-1")}),n.includes("active-tab")&&e.setAttribute("tabindex","0");t.querySelectorAll(Oi.CLOSE_BUTTON).forEach(t=>{t.setAttribute("tabindex","-1")});const o=yn(this,Ki,"m",mn).call(this,t);if(o){const t=n.includes("add-tab-button");o.setAttribute("tabindex",t?"0":"-1")}}}Yi=new WeakMap,Xi=new WeakMap,Ji=new WeakMap,Qi=new WeakMap,tn=new WeakMap,en=new WeakMap,Ki=new WeakSet,nn=function(t){const e=t.target,i=e.matches(Oi.TAB),n=e.matches(Oi.CLOSE_BUTTON),o=e.matches(Oi.ADD_TAB_BUTTON);if(i||n||o)switch(t.key){case"ArrowLeft":case"ArrowRight":yn(this,Ki,"m",on).call(this,t,e);break;case"Enter":case" ":if(t.ctrlKey||t.metaKey||t.altKey||t.shiftKey)break;yn(this,Ki,"m",sn).call(this,t,e);break;case"Delete":case"Backspace":yn(this,Ki,"m",rn).call(this,t,e);break;case"Home":case"End":yn(this,Ki,"m",an).call(this,t,e)}},on=function(t,e){const i=yn(this,Xi,"f").arrowNavigation??zi;if(0===i.length)return;const n=yn(this,Ki,"m",un).call(this,e);if(!n)return;const o=yn(this,Ki,"m",hn).call(this,n,i);if(0===o.length)return;const s=o.indexOf(e);if(-1===s)return;t.preventDefault();o[(s+("ArrowRight"===t.key?1:-1)+o.length)%o.length].focus()},sn=function(t,e){if(t.preventDefault(),e.matches(Oi.TAB))yn(this,Qi,"f").call(this,e);else if(e.matches(Oi.CLOSE_BUTTON)){if(!yn(this,Ki,"m",cn).call(this,e))return;const t=e.closest(Oi.TAB);if(t){const e=yn(this,Ki,"m",pn).call(this,t);e&&(yn(this,Ki,"m",ln).call(this,t),yn(this,Ji,"f").call(this,e))}}else e.matches(Oi.ADD_TAB_BUTTON)&&yn(this,tn,"f").call(this,e)},rn=function(t,e){if(!yn(this,Xi,"f").enableDeleteKeyClose)return;if(!e.matches(Oi.TAB))return;t.preventDefault();const i=yn(this,Ki,"m",pn).call(this,e);i&&(yn(this,Ki,"m",ln).call(this,e),yn(this,Ji,"f").call(this,i))},an=function(t,e){if(!yn(this,Xi,"f").enableHomeEndNavigation)return;const i=yn(this,Xi,"f").arrowNavigation??zi;if(0===i.length)return;const n=yn(this,Ki,"m",un).call(this,e);if(!n)return;const o=yn(this,Ki,"m",hn).call(this,n,i);if(0===o.length)return;t.preventDefault();("Home"===t.key?o[0]:o[o.length-1]).focus()},ln=function(t){const e=yn(this,Ki,"m",un).call(this,t);if(!e)return;const i=Array.from(e.querySelectorAll(Oi.TAB)),n=i.indexOf(t);if(-1===n)return;if(i.length<=1)return;let o=null;const s=yn(this,Xi,"f").focusOnCloseStrategy??"next",r=i[(n+1)%i.length],a=i[(n-1+i.length)%i.length];switch(s){case"next":o=r;break;case"previous":o=a;break;case"active":o=e.querySelector(Oi.ACTIVE_TAB),o===t&&(o=r)}o&&setTimeout(()=>o?.focus(),0)},hn=function(t,e){const i=[],n=Array.from(t.querySelectorAll(Oi.TAB)),o=t.querySelector(Oi.ACTIVE_TAB);if(n.forEach(t=>{const n=t===o;(n&&e.includes("active-tab")||!n&&e.includes("inactive-tab"))&&i.push(t);const s=t.querySelector(Oi.CLOSE_BUTTON);s&&yn(this,Ki,"m",dn).call(this,t,s)&&(n&&e.includes("active-tab-close-button")||!n&&e.includes("inactive-tab-close-button"))&&i.push(s)}),e.includes("add-tab-button")){const e=yn(this,Ki,"m",mn).call(this,t);e&&yn(this,Ki,"m",cn).call(this,e)&&i.push(e)}return i},dn=function(t,e){return"false"!==t.getAttribute("data-is-closable")&&yn(this,Ki,"m",cn).call(this,e)},cn=function(t){if("true"===t.getAttribute("aria-hidden"))return!1;const e=window.getComputedStyle(t);return"none"!==e.display&&"hidden"!==e.visibility&&t.getClientRects().length>0},un=function(t){const e=t.closest(Oi.TAB);if(e)return e.closest(Oi.TABS_CONTAINER);if(t.matches(Oi.ADD_TAB_BUTTON)){const e=t.closest(Oi.HEADER);if(e)return e.querySelector(Oi.TABS_CONTAINER);const i=t.closest(".lm_stack");return i?.querySelector(Oi.TABS_CONTAINER)}return t.closest(Oi.TABS_CONTAINER)},mn=function(t){const e=t.querySelector(Oi.ADD_TAB_BUTTON);if(e)return e;const i=t.closest(Oi.HEADER),n=i?.querySelector(Oi.ADD_TAB_BUTTON);if(n)return n;const o=t.closest(".lm_stack");return o?.querySelector(Oi.ADD_TAB_BUTTON)},pn=function(t){const e=t.getAttribute("data-view-name");if(e)return e;const{id:i}=t;return i?.startsWith("tab-")?i.substring(4):null},fn=function(){yn(this,Yi,"f").querySelectorAll(Oi.TABS_CONTAINER).forEach(t=>{yn(this,Ki,"m",gn).call(this,t)})},gn=function(t){const e=yn(this,Xi,"f").tabNavigation??Mi,i=t.querySelectorAll(Oi.TAB),n=t.querySelector(Oi.ACTIVE_TAB);i.forEach(t=>{const i=t,o=i===n;o&&e.includes("active-tab")||!o&&e.includes("inactive-tab")?i.setAttribute("tabindex","0"):i.setAttribute("tabindex","-1");const s=i.querySelector(Oi.CLOSE_BUTTON);s&&s.setAttribute("tabindex","-1")});const o=yn(this,Ki,"m",mn).call(this,t);if(o){const t=e.includes("add-tab-button");o.setAttribute("tabindex",t?"0":"-1")}};var wn,Cn,bn,In,En,Sn,Tn,xn,Ln,An=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},Mn=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)};class zn{constructor(t,e,i){wn.add(this),Cn.set(this,void 0),bn.set(this,void 0),In.set(this,void 0),En.set(this,void 0),Sn.set(this,void 0),An(this,Cn,t,"f"),An(this,bn,e??{},"f"),An(this,In,Mn(this,wn,"m",Tn).call(this,Mn(this,bn,"f").viewTabOptions),"f"),An(this,En,new Zi(t,Mn(this,In,"f")),"f"),An(this,Sn,new _n(t,Mn(this,In,"f"),i),"f")}updateAccessibilityOptions(t){An(this,bn,{...Mn(this,bn,"f"),...t,viewTabOptions:{...Mn(this,bn,"f").viewTabOptions,...t.viewTabOptions}},"f"),An(this,In,Mn(this,wn,"m",Tn).call(this,Mn(this,bn,"f").viewTabOptions),"f"),Mn(this,En,"f").updateOptions(Mn(this,In,"f")),Mn(this,Sn,"f").updateOptions(Mn(this,In,"f")),Mn(this,En,"f").refreshAllLabels()}initializeStack(t){const e=t.querySelector(Oi.TABS_CONTAINER);if(!e)return;Mn(this,En,"f").initializeTabGroup(e),Mn(this,Sn,"f").initializeTabGroup(e);const i=e.querySelector(Oi.ADD_TAB_BUTTON)??e.closest(Oi.HEADER)?.querySelector(Oi.ADD_TAB_BUTTON)??t.querySelector(Oi.ADD_TAB_BUTTON);if(i){const t=e.querySelectorAll(Oi.TAB).length;Mn(this,En,"f").initializeAddTabButton(i,t)}}initializeTab(t,e){const i=t.closest(Oi.TABS_CONTAINER);if(!i)return;const n=i.querySelectorAll(Oi.TAB),o=Array.from(n).indexOf(t),s=n.length,r=t.classList.contains(Pi);Mn(this,En,"f").initializeTab(t,e,r,o,s),r&&Mn(this,Sn,"f").updateActiveTab(i,t)}initializeViewContainer(t,e){Mn(this,En,"f").initializeViewContainer(t,e)}handleTabSelectionChange(t,e){const i=t.querySelectorAll(Oi.TAB);Mn(this,En,"f").updateTabSelection(t,e,i),Mn(this,Sn,"f").updateActiveTab(t,e,i)}refreshTabLabel(t){Mn(this,En,"f").refreshTabLabel(t)}initializeAddButton(t,e){Mn(this,En,"f").initializeAddTabButton(t,e)}destroy(){Mn(this,En,"f").destroy(),Mn(this,Sn,"f").destroy()}getSyncApi(){return{updateAccessibilityOptions:this.updateAccessibilityOptions.bind(this)}}}Cn=new WeakMap,bn=new WeakMap,In=new WeakMap,En=new WeakMap,Sn=new WeakMap,wn=new WeakSet,Tn=function(t){return t?{tabNavigation:t.tabNavigation??Di.tabNavigation,arrowNavigation:t.arrowNavigation??Di.arrowNavigation,enableDeleteKeyClose:t.enableDeleteKeyClose??Di.enableDeleteKeyClose,enableHomeEndNavigation:t.enableHomeEndNavigation??Di.enableHomeEndNavigation,announceTabChanges:t.announceTabChanges??Di.announceTabChanges,focusOnCloseStrategy:t.focusOnCloseStrategy??Di.focusOnCloseStrategy,ariaLabels:t.ariaLabels}:{...Di}};const Dn="newTabButton";class kn extends N{createTabButton(t){const e=document.createElement("div");return e.title="New Tab",e.className=Dn,e.classList.add("addTabButton"),e.setAttribute("data-testid","add-new-tab"),e.addEventListener("click",()=>{const e=this.layoutContentCache.getOrCreateEntityId(He.wrap(t,this)),i=t.contentItems.length;this.platformCreateView({url:this.config.settings?.newTabButtonUrl},{location:{id:e,index:i}})}),e}ensurePlusButtonLast(t,e){let i=t.querySelector(`.${Dn}`);i||(i=this.getNewTabButton(t,e)),i!==t.lastElementChild&&t.appendChild(i)}focusTabContentFromHeaderTarget(t){const e=t.classList.contains("lm_tab")?t:t.closest(".lm_tab")??t.closest(".lm_header")?.querySelector(".lm_tab.lm_active")??this.container.querySelector(".lm_tab.lm_active")??void 0,n=e?.getAttribute("data-view-name")??e?.id?.replace("tab-","");if(!n)return!1;const o=i(this,xn,"m",Ln).call(this,n),s=this.layout.findFirstComponentItemById(n)??o?.container.parent;return!!(s&&s.parent?.isStack&&o)&&(s.parent.setActiveComponentItem(s,!0),o.focusContent(),requestAnimationFrame(()=>o.focusContent()),!0)}resolveStackFromAddButtonTarget(t){if(!t.matches(".newTabButton, .addTabButton"))return;const e=i=>{if(i){if(ye.isStack(i)&&i.header?.element.contains(t))return i;if(i.contentItems)for(const t of i.contentItems){const i=e(t);if(i)return i}}};return e(this.layout.rootItem??void 0)}static overrideConfig(t){const e={...Me,...t.settings,...ze};return t.content&&pi(t.content),e.reorderEnabled?ui(t.content,{isClosable:!0}):ui(t.content,{reorderEnabled:!1}),"scroll"===e?.tabOverflowBehavior&&(e.disableTabOverflowDropdown=!0),{dimensions:Ae,...t,settings:e,header:{...Le,show:!1!==t.settings?.hasHeaders&&Le.show}}}constructor(t,e,i,{options:n},o,s,r=null,a){if(super(),this.identity=t,this.container=e,this.initialConfig=i,this.layoutManager=o,this.platformProvider=s,this.viewHost=r,xn.add(this),this.layoutViewsByContainerElement=new Map,this.events=new u,this.shadowContainer=null,this.layoutContentCache=D.getSingleInstance(),this.reparentingViews=new Set,this.stolenViews=new Set,this.goldenLayoutDestroyed=!1,this.tabsObservers=new WeakMap,this.accessibilityController=null,this.focusContentHotkey={enabled:!0,key:"enter",requireCtrl:!1,requireMeta:!1,requireAlt:!1,requireShift:!1,requireCtrlOrMeta:!0},this.normalizeHotkeyKey=t=>t.trim().toLowerCase(),this.resolveFocusContentHotkey=t=>{if(!1===t)return void(this.focusContentHotkey={enabled:!1,key:"enter",requireCtrl:!1,requireMeta:!1,requireAlt:!1,requireShift:!1,requireCtrlOrMeta:!1});const e=(t??"Mod+Enter").split("+").map(t=>t.trim().toLowerCase()).filter(Boolean),i=e.find(t=>!["ctrl","control","meta","cmd","command","alt","shift","mod","cmdorctrl","ctrlormeta"].includes(t));this.focusContentHotkey={enabled:!0,key:this.normalizeHotkeyKey(i??"enter"),requireCtrl:e.includes("ctrl")||e.includes("control"),requireMeta:e.includes("meta")||e.includes("cmd")||e.includes("command"),requireAlt:e.includes("alt"),requireShift:e.includes("shift"),requireCtrlOrMeta:e.includes("mod")||e.includes("cmdorctrl")||e.includes("ctrlormeta")}},this.matchesFocusContentHotkey=t=>{if(!this.focusContentHotkey.enabled)return!1;if(this.normalizeHotkeyKey(t.key)!==this.focusContentHotkey.key)return!1;const{requireCtrl:e,requireMeta:i,requireAlt:n,requireShift:o,requireCtrlOrMeta:s}=this.focusContentHotkey;if(s&&!t.ctrlKey&&!t.metaKey)return!1;if(e&&!t.ctrlKey)return!1;if(i&&!t.metaKey)return!1;if(n&&!t.altKey)return!1;if(o&&!t.shiftKey)return!1;const r=i||s;return!(!e&&!s&&t.ctrlKey)&&(!(!r&&t.metaKey)&&(!(!n&&t.altKey)&&!(!o&&t.shiftKey)))},this.getNewTabButton=(t,e)=>{let i=t.querySelector(`.${Dn}`);return i||(i=this.createTabButton(e)),i},this.ensureNewTabButton=t=>{if(!this.config?.settings?.newTabButtonUrl||!this.config?.settings.hasHeaders)return;const e=t.header?.element.querySelector(".lm_tabs");if(e){if("scroll"===this.config.settings?.tabOverflowBehavior){let i=t.header?.element.querySelector(`.${Dn}`);if(i)return void(this.accessibilityController&&this.accessibilityController.initializeStack(t.element));const n=this.createTabButton(t);return e.parentElement?.insertAdjacentElement("afterend",n),void(this.accessibilityController&&this.accessibilityController.initializeStack(t.element))}if(this.ensurePlusButtonLast(e,t),this.accessibilityController&&this.accessibilityController.initializeStack(t.element),!this.tabsObservers.has(e)){const i=new MutationObserver(()=>this.ensurePlusButtonLast(e,t));i.observe(e,{childList:!0}),this.tabsObservers.set(e,i),t.on("destroy",()=>{i.disconnect(),this.tabsObservers.delete(e)})}}},this.addNewTabButtons=()=>{const t=e=>{e&&(ye.isStack(e)&&this.ensureNewTabButton(e),e.contentItems&&e.contentItems.forEach(t))};t(this.layout.rootItem)},this.onHeaderKeyDown=t=>{const e=t.target;if(!e)return;if(this.matchesFocusContentHotkey(t)){t.preventDefault();return void(this.focusTabContentFromHeaderTarget(e)&&t.stopPropagation())}if(this.accessibilityController)return;if(!("Enter"===t.key||" "===t.key))return;(e.classList.contains("lm_tab")||e.classList.contains("lm_close_tab")||e.classList.contains("newTabButton")||e.classList.contains("addTabButton"))&&(t.preventDefault(),e.click())},this.createViewComponent=(t,e)=>{const i=e,n=e.name??i.name;if(n)for(const t of M.getAllLayouts(this.layoutManager))if(t.identity.layoutName!==this.identity.layoutName){const e=t.getCurrentViews().find(t=>t.name===n);e&&(t.stolenViews.add(e.name),t.platformCloseView(e).catch(console.error))}let o;n&&this.viewHost?.has(n)?o=this.viewHost.get(n):n&&kn.reparentedViews.has(n)?(o=kn.reparentedViews.get(n),kn.reparentedViews.delete(n),o.ofViewElement&&this.iframeContainer.appendChild(o.ofViewElement)):(o=new _i(i,this.identity.uuid,this.options,this.iframeContainer),this.viewHost?.register(o.identity.name,o));const s=new Ai(t,o,this.initialConfig.settings);return this.layoutViewsByContainerElement.set(t.element,s),this.resizeController.observeContainer(t.element),s},this.domEmitter=new W(e),this.viewHost)this.iframeContainer=this.viewHost.element;else{const t=document.createElement("div");t.id=`openfin-layout-iframe-container-${this.identity.layoutName}`,this.iframeContainer=t}this.layout=new xe(this.container),this.layout.resizeWithContainerAutomatically=!0,this.options=n,this.layout.registerComponent("view",this.createViewComponent),this.setupListeners(),s.registerEmitter(t.layoutName,this.events),this.container.addEventListener("keydown",this.onHeaderKeyDown),this.initializeAccessibility(a),this.resolveFocusContentHotkey(a?.focusContentHotkey),this.resizeController=new Re(this);const l=kn.overrideConfig(i);this.config=l,this.layout.loadLayout(l),this.viewHost||(this.shadowContainer=document.createElement("div"),this.shadowContainer.id=`openfin-layout-shadow-container-${this.identity.layoutName}`,this.shadowContainer.attachShadow({mode:"open",delegatesFocus:!1}).appendChild(this.iframeContainer),this.container.appendChild(this.shadowContainer)),this.resizeController.observeMutations(this.container),this.resizeController.observeIntersection(this.container),this.setupStyles(),this.addNewTabButtons()}getStackByView({name:t}){const e=this.layout.findFirstComponentItemById(t);if(e?.parent&&e?.parent?.isStack)return He.wrap(e.parent,this)}getRoot(){return He.wrap(this.layout.rootItem,this)}async platformCloseView(t){const e=i(this,xn,"m",Ln).call(this,t.name);if(!e)throw new Error(`View with name: ${t.name} not found in layout.`);e.closeView()}async platformCreateView(t,{location:e,targetView:i}={}){if(i)throw new Error("TargetView not supported in web");const n={options:this.platformProvider.normalizeOptions(t),target:this.identity,location:e};return this.insertView(n)}setupStyles(){this.container.setAttribute("data-openfin-layout-name",this.identity.layoutName);const t=this.container.querySelector(".lm_goldenlayout");if(!t)return void console.warn("Layout div not found cannot apply settings");t.setAttribute("data-layout-name",this.identity.layoutName),this.config.settings?.hasHeaders?t.setAttribute("data-settings-has-headers","true"):t.removeAttribute("data-settings-has-headers"),this.initialConfig.settings?.preventSplitterResize?t.setAttribute("data-settings-prevent-splitter-resize","true"):t.removeAttribute("data-settings-prevent-splitter-resize");const e=this.config.settings;"scroll"===e?.tabOverflowBehavior?t.setAttribute("data-settings-tab-overflow","scroll"):e?.disableTabOverflowDropdown?t.removeAttribute("data-settings-tab-overflow"):t.setAttribute("data-settings-tab-overflow","dropdown")}async insertView({options:t,location:e,targetView:i}){if(t?.name){const e=t.uuid;await M.handleSharedView(this.layoutManager,this.identity,{name:t.name,uuid:"string"==typeof e?e:this.identity.uuid})}const n=e?this.layoutContentCache.getItemOrUndefined(e.id):void 0,o=i?this.layoutContentCache.getItemOrUndefined(i.name):void 0,s=this.layout.rootItem,r=s?He.wrap(s,this):void 0,a=n??o??r;let l;if(void 0===a)l=this.layout.newItem({type:"stack",content:[]});else if(ye.isStack(a.raw))l=a.raw;else{if(!Ve(a.raw))throw new Error("Cannot add a view at the requested location");l=a.raw.newItem({type:"stack",content:[]})}const h=Math.min(l.contentItems.length,e?.index??l.contentItems.length);let d=this.layout.findFirstComponentItemById(t.name);const c="background"!==(e?.displayState??"focused");if(d)d.parent&&d.parent.removeChild(d,!0),l.addChild(d,h,!1,c);else{const e=kn.reparentedViews.get(t.name)?.state.title??this.viewHost?.get(t.name)?.state.title;d=l.newComponent("view",t,t.title??e??t.url??"Default Title",h,c)}d.reorderEnabled=this.layout.layoutConfig.settings.reorderEnabled,this.ensureNewTabButton(l);const u=d.component.identity;return Promise.resolve({identity:u})}async replaceView({viewToReplace:t,newView:e}){const i=this.getStackByView(t);if(!i)throw new Error(`View with name: ${t.name} not found in layout.`);const n=i.contentItems.findIndex(e=>e.viewName===t.name);if(-1===n)throw new Error(`View with name: ${t.name} not found in layout.`);if(t.name!==e.name){const o=this.layoutContentCache.getOrCreateEntityId(i),{identity:s}=await this.platformCreateView(e,{location:{id:o,index:n}});return await this.platformCloseView(t),{identity:s}}throw new Error("Cannot replace a view with itself")}replaceLayout(t){throw new Error("Method not implemented.")}async cleanupView(t){}applyPreset(t){throw new Error("Method not implemented.")}getCurrentViews(){return[...this.layoutViewsByContainerElement.values()].map(t=>t.identity)}async getFrameSnapshot(){if(this.goldenLayoutDestroyed)throw new I(this.identity.layoutName);return function(t,e){if(t.root){t.root.content&&mi([t.root],{componentName:"view",isClosable:!0});const e=t.root;t.content=[e],delete t.root}if(e.settings)for(const i of Ne.OPENFIN_ONLY_SETTINGS)i in e.settings&&!(i in t.settings)&&(t.settings[i]=e.settings[i]);return t}(Et.fromResolved(this.layout.toConfig()),this.config)}isVisible(){return(0!==(t=this.container).offsetWidth||0!==t.offsetHeight)&&"hidden"!==window.getComputedStyle(t).visibility&&t.offsetTop>=0&&t.offsetLeft>=0&&t.offsetTop<=window.innerHeight&&t.offsetLeft<=window.innerWidth;var t}get showFavIcons(){return!1!==this.config.settings?.showFavicons}async onViewDetached({viewIdentity:t}){this.reparentingViews.add(t.name),await this.platformCloseView(t)}initializeAccessibility(t){this.resolveFocusContentHotkey(t?.focusContentHotkey),this.accessibilityController=new zn(this.container,t,{onTabClose:t=>{this.platformCloseView({uuid:this.identity.uuid,name:t})},onTabActivate:t=>{const e=t.getAttribute("data-view-name")||t.id?.replace("tab-","");if(e){const t=i(this,xn,"m",Ln).call(this,e),n=this.layout.findFirstComponentItemById(e)??t?.container.parent;n&&n.parent?.isStack&&n.parent.setActiveComponentItem(n,!0)}},onAddTab:t=>{if(this.config.settings?.newTabButtonUrl){const e=this.resolveStackFromAddButtonTarget(t);if(e){const t=this.layoutContentCache.getOrCreateEntityId(He.wrap(e,this));return void this.platformCreateView({url:this.config.settings.newTabButtonUrl},{location:{id:t,index:e.contentItems.length}})}this.platformCreateView({url:this.config.settings.newTabButtonUrl})}}});const e=this.accessibilityController.getSyncApi();return{updateAccessibilityOptions:t=>{this.resolveFocusContentHotkey(t.focusContentHotkey),e.updateAccessibilityOptions(t)}}}getSyncApi(){if(this.accessibilityController){const t=this.accessibilityController.getSyncApi();return{updateAccessibilityOptions:e=>{this.resolveFocusContentHotkey(e.focusContentHotkey),t.updateAccessibilityOptions(e)}}}return{updateAccessibilityOptions:t=>{this.resolveFocusContentHotkey(t.focusContentHotkey)}}}async destroy(){this.accessibilityController?.destroy(),this.platformProvider.unregisterEmitter(this.identity.layoutName),this.container.removeEventListener("keydown",this.onHeaderKeyDown),this.goldenLayoutDestroyed||(this.goldenLayoutDestroyed=!0,this.layout.destroy()),this.viewHost||this.iframeContainer.remove(),this.resizeController.destroy(),this.layoutViewsByContainerElement.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 e=t.componentItem.component;!1===e.componentState.initial_isClosable&&t.element.setAttribute("data-is-closable","false"),t.element.setAttribute("data-view-name",e.identity.name),t.element.id=`tab-${e.identity.name}`;const i=this.showFavIcons,n=e.componentState?.icon??t.componentItem.toConfig().icon,o=i?e.ofView.favicon:null,s=i?this.config.settings?.defaultFaviconUrl??null:null,r=n??o??s??null;if(t.setIcon(r),i&&!o){const t=e.ofView.ofViewElement;t&&t.getOrDiscoverFavicon().then(t=>{t&&e.setFavicon(t)})}if(this.domEmitter.dispatchLocalEvent("tab-created",e.identity),this.accessibilityController){this.accessibilityController.initializeTab(t.element,e.identity.name);const i=()=>this.accessibilityController?.refreshTabLabel(t.element);t.componentItem.on("titleChanged",i),t.componentItem.on("destroy",()=>t.componentItem.off("titleChanged",i))}}),this.layout.on("itemCreated",({target:t})=>{const e=t;if(re.isComponentItem(e)){const t=e.component;this.domEmitter.dispatchLocalEvent("container-created",t.identity),this.accessibilityController&&this.accessibilityController.initializeViewContainer(e.element,t.identity.name)}ye.isStack(e)&&(e.toggleMaximise=()=>this.toggleMaximise(e),this.ensureNewTabButton(e),this.accessibilityController&&(this.accessibilityController.initializeStack(e.element),e.on("activeContentItemChanged",()=>{if(this.accessibilityController){const t=e.getActiveComponentItem();if(t){const i=e.header?.element.querySelector(".lm_tabs"),n=t.tab?.element;i&&n&&this.accessibilityController.handleTabSelectionChange(i,n)}}})))}),this.layout.on("itemDestroyed",t=>{const e=t.target;if(re.isComponentItem(e)){const t=e.component;this.removeViewComponent(t)}}),this.layout.on("itemDropped",()=>{this.handleDragEnd()}),this.events.on("page-title-updated",({data:{identity:t,title:e}})=>{if(this.identity.uuid===t.uuid){const n=i(this,xn,"m",Ln).call(this,t.name);n?.setTitle(e)}}),!1!==this.initialConfig.settings?.showFavicons&&this.events.on("page-favicon-updated",({data:t})=>{if(!t?.identity||"string"!=typeof t.favicon)return;const{identity:e,favicon:n}=t;if(this.identity.uuid!==e.uuid)return;const o=i(this,xn,"m",Ln).call(this,e.name);o&&o.identity.name===e.name&&o.setFavicon(n)})}handleDragStart(){this.iframeContainer.style.pointerEvents="none"}handleDragEnd(){this.iframeContainer.style.pointerEvents=""}toggleMaximise(t){const e=(t,e)=>{const i=this.layout.findFirstComponentItemById(t.identity.name);return i&&i.parent&&i.parent.isStack&&i.parent.element===e},i=[...this.layoutViewsByContainerElement.values()].filter(i=>!e(i,t.element)),n=[...this.layoutViewsByContainerElement.values()].find(i=>i.isActive()&&e(i,t.element)),o=(t,e)=>{t?.toggleZIndex(e)},s=t=>{i.forEach(e=>e.setIsMinimised(t))};t.isMaximised?(t.minimise(),o(n,!1),s(!1)):(s(!0),t.maximise(),o(n,!0))}removeViewComponent(t){return this.layoutViewsByContainerElement.delete(t.container.element),this.resizeController.unobserveContainer(t.container.element),this.stolenViews.has(t.identity.name)?(this.stolenViews.delete(t.identity.name),t.destroy(),t.ofView.destroy(),this.viewHost?.unregister(t.identity.name),void(0!==this.getCurrentViews().length||this.goldenLayoutDestroyed||(this.goldenLayoutDestroyed=!0,M.handleLastViewRemoved(this.layoutManager,this.identity)))):this.reparentingViews.has(t.identity.name)?(this.reparentingViews.delete(t.identity.name),t.ofView.state.title=t.container.parent.title,this.viewHost||kn.reparentedViews.set(t.identity.name,t.ofView),void t.destroy()):(t.destroy(),t.ofView.destroy(),this.viewHost?.unregister(t.identity.name),this.platformProvider.closeView(t.identity.name),void(0!==this.getCurrentViews().length||this.goldenLayoutDestroyed||(this.goldenLayoutDestroyed=!0,M.handleLastViewRemoved(this.layoutManager,this.identity))))}}xn=new WeakSet,Ln=function(t){return[...this.layoutViewsByContainerElement.values()].find(e=>e.identity.name===t)},kn.reparentedViews=new Map;class Pn{constructor(t,e,i,n,o){this.wire=t,this.connectConfig=e,this.provider=i,this.fallbackContainer=n,this.viewHost=null,h.setGlobalLogLevel(e.logLevel),o&&(this.viewHost=new H(o))}async createLayout(t,e){if(!("container"in t)&&!this.fallbackContainer)throw new Error("Container property is not optional in web");const{layoutName:i}=t,n=t,o=this.provider.initLayoutViews(n),s=n.container??this.fallbackContainer,r={...this.wire.me,layoutName:i},a=n.accessibilityOptions??this.connectConfig.platform.accessibilityOptions,l=new kn(r,s,o,this.connectConfig,e,this.provider,this.viewHost,a);return M.registerLayout(e,i,l),this.fallbackContainer=null,l.getSyncApi()}async getLayoutSnapshot(t){return t.getLayoutSnapshot()}async handleLastViewRemoved(t){}getWire(){return this.wire}}class On{static async init(t){const e=t.getFin().InterApplicationBus.Channel,i=await e.create(`custom-frame-${t.me.uuid}`);i.setDefaultAction(async(t,{target:e,opts:n},o)=>{const s=i.connections.find(t=>t.name===e.name);if(s)return i.dispatch(s,t,{...n,target:e});throw new Error(`Client with name ${e.name} not found`)}),await d(i,"layout-relay");const n=await e.create(c(t));return new On(t,n)}constructor(t,e){this.wire=t,this.dataChannelProvider=e,this.emitters=new Map,this.viewNames=new Set,e.register("page-title-updated",t=>{[...this.emitters.values()].forEach(e=>{e.emit("page-title-updated",t)})}),e.register("page-favicon-updated",t=>{[...this.emitters.values()].forEach(e=>{e.emit("page-favicon-updated",t)})})}registerEmitter(t,e){this.emitters.set(t,e)}unregisterEmitter(t){this.emitters.delete(t)}normalizeOptions(t,e="default"){const i=this.wire.me.uuid;let{name:n=`internal-generated-view-${p()}`}=t;return n.match(/^internal-generated-view-/)&&this.viewNames.has(n)&&"duplicate"===e&&(n=`internal-generated-view-${p()}`),this.viewNames.add(n),{...t,name:n,uuid:i}}closeView(t){this.viewNames.delete(t)}initLayoutViews({layout:t,multiInstanceViewBehavior:e}){return b(t=>{if("component"===t.type&&t.componentState){const i=this.normalizeOptions(t.componentState,e);return{...t,componentState:i}}return t},t)}}var Rn;const Bn=t=>t;class Vn{constructor(t){Rn.set(this,void 0),this.initLayoutManager=async(t,e,{container:n,layoutManagerOverride:o,sharedViewContainer:s})=>{const r=await On.init(e),a=o??Bn,l=new Pn(e,i(this,Rn,"f"),r,n,s),h=new(a(M.createClosedConstructor(l)));return await V(e,h),h},this.applyLayoutSnapshot=async(t,e,n)=>{await e.applyLayoutSnapshot(i(this,Rn,"f").platform.layoutSnapshot)},this.createLayout=async(t,e)=>M.createLayout(t,e),this.destroyLayout=async(t,e)=>M.destroyLayout(t,e),n(this,Rn,t,"f")}}Rn=new WeakMap;export{Vn as WebLayoutEntryPoint};