@interopio/workspaces-api 3.2.1 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).workspaces=e.workspaces||{},e.workspaces.min=t())}(this,(function(){"use strict";function e(e,t,i,o){return new(i||(i=Promise))((function(r,n){function s(e){try{d(o.next(e))}catch(e){n(e)}}function a(e){try{d(o.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}d((o=o.apply(e,t||[])).next())}))}function t(e){if(e&&e.errorHandling&&"function"!=typeof e.errorHandling&&"log"!==e.errorHandling&&"silent"!==e.errorHandling&&"throw"!==e.errorHandling)throw new Error('Invalid options passed to createRegistry. Prop errorHandling should be ["log" | "silent" | "throw" | (err) => void], but '+typeof e.errorHandling+" was passed");var t=e&&"function"==typeof e.errorHandling&&e.errorHandling,i={};function o(i,o){var r=i instanceof Error?i:new Error(i);if(t)t(r);else{var n='[ERROR] callback-registry: User callback for key "'+o+'" failed: '+r.stack;if(e)switch(e.errorHandling){case"log":return console.error(n);case"silent":return;case"throw":throw new Error(n)}console.error(n)}}return{add:function(e,t,r){var n=i[e];return n||(n=[],i[e]=n),n.push(t),r&&setTimeout((function(){r.forEach((function(r){var n;if(null===(n=i[e])||void 0===n?void 0:n.includes(t))try{Array.isArray(r)?t.apply(void 0,r):t.apply(void 0,[r])}catch(t){o(t,e)}}))}),0),function(){var o=i[e];o&&(0===(o=o.reduce((function(e,i,o){return i===t&&e.length===o||e.push(i),e}),[])).length?delete i[e]:i[e]=o)}},execute:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n=i[e];if(!n||0===n.length)return[];var s=[];return n.forEach((function(i){try{var r=i.apply(void 0,t);s.push(r)}catch(t){s.push(void 0),o(t,e)}})),s},clear:function(){i={}},clearKey:function(e){i[e]&&delete i[e]}}}t.default=t;var i=t,o=function(e){return{ok:!0,result:e}},r=function(e){return{ok:!1,error:e}},n=function(e){return!0===e.ok?Promise.resolve(e.result):Promise.reject(e.error)},s=function(e){if(!0===e.ok)return e.result;throw e.error},a=function(e,t){return!0===t.ok?o(e(t.result)):t},d=function(e,t,i){return!1===t.ok?t:!1===i.ok?i:o(e(t.result,i.result))},c=function(e,t){return!0===t.ok?t:r(e(t.error))},l=function(e,t){return!0===t.ok?e(t.result):t},u=function(){return u=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},u.apply(this,arguments)};function h(e,t){if(e===t)return!0;if(null===e&&null===t)return!0;if(typeof e!=typeof t)return!1;if("object"==typeof e){if(Array.isArray(e)){if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(var i=0;i<e.length;i++)if(!h(e[i],t[i]))return!1;return!0}var o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(i=0;i<o.length;i++){if(!t.hasOwnProperty(o[i]))return!1;if(!h(e[o[i]],t[o[i]]))return!1}return!0}}var p=function(e){return Array.isArray(e)},m=function(e){return"object"==typeof e&&null!==e&&!p(e)},w=function(e,t){return"expected "+e+", got "+function(e){switch(typeof e){case"string":return"a string";case"number":return"a number";case"boolean":return"a boolean";case"undefined":return"undefined";case"object":return e instanceof Array?"an array":null===e?"null":"an object";default:return JSON.stringify(e)}}(t)},g=function(e){return e.map((function(e){return"string"==typeof e?"."+e:"["+e+"]"})).join("")},f=function(e,t){var i=t.at,o=function(e,t){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(i[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(i[o[r]]=e[o[r]])}return i}(t,["at"]);return u({at:e+(i||"")},o)},y=function(){function e(t){var i=this;this.decode=t,this.run=function(e){return c((function(t){return{kind:"DecoderError",input:e,at:"input"+(t.at||""),message:t.message||""}}),i.decode(e))},this.runPromise=function(e){return n(i.run(e))},this.runWithException=function(e){return s(i.run(e))},this.map=function(t){return new e((function(e){return a(t,i.decode(e))}))},this.andThen=function(t){return new e((function(e){return l((function(i){return t(i).decode(e)}),i.decode(e))}))},this.where=function(t,o){return i.andThen((function(i){return t(i)?e.succeed(i):e.fail(o)}))}}return e.string=function(){return new e((function(e){return"string"==typeof e?o(e):r({message:w("a string",e)})}))},e.number=function(){return new e((function(e){return"number"==typeof e?o(e):r({message:w("a number",e)})}))},e.boolean=function(){return new e((function(e){return"boolean"==typeof e?o(e):r({message:w("a boolean",e)})}))},e.constant=function(t){return new e((function(e){return h(e,t)?o(t):r({message:"expected "+JSON.stringify(t)+", got "+JSON.stringify(e)})}))},e.object=function(t){return new e((function(e){if(m(e)&&t){var i={};for(var n in t)if(t.hasOwnProperty(n)){var s=t[n].decode(e[n]);if(!0!==s.ok)return void 0===e[n]?r({message:"the key '"+n+"' is required but was not present"}):r(f("."+n,s.error));void 0!==s.result&&(i[n]=s.result)}return o(i)}return m(e)?o(e):r({message:w("an object",e)})}))},e.array=function(t){return new e((function(e){if(p(e)&&t){return e.reduce((function(e,i,o){return d((function(e,t){return e.concat([t])}),e,function(e,i){return c((function(e){return f("["+i+"]",e)}),t.decode(e))}(i,o))}),o([]))}return p(e)?o(e):r({message:w("an array",e)})}))},e.tuple=function(t){return new e((function(e){if(p(e)){if(e.length!==t.length)return r({message:"expected a tuple of length "+t.length+", got one of length "+e.length});for(var i=[],n=0;n<t.length;n++){var s=t[n].decode(e[n]);if(!s.ok)return r(f("["+n+"]",s.error));i[n]=s.result}return o(i)}return r({message:w("a tuple of length "+t.length,e)})}))},e.union=function(t,i){for(var o=[],r=2;r<arguments.length;r++)o[r-2]=arguments[r];return e.oneOf.apply(e,[t,i].concat(o))},e.intersection=function(t,i){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return new e((function(e){return[t,i].concat(r).reduce((function(t,i){return d(Object.assign,t,i.decode(e))}),o({}))}))},e.anyJson=function(){return new e((function(e){return o(e)}))},e.unknownJson=function(){return new e((function(e){return o(e)}))},e.dict=function(t){return new e((function(e){if(m(e)){var i={};for(var n in e)if(e.hasOwnProperty(n)){var s=t.decode(e[n]);if(!0!==s.ok)return r(f("."+n,s.error));i[n]=s.result}return o(i)}return r({message:w("an object",e)})}))},e.optional=function(t){return new e((function(e){return null==e?o(void 0):t.decode(e)}))},e.oneOf=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return new e((function(e){for(var i=[],o=0;o<t.length;o++){var n=t[o].decode(e);if(!0===n.ok)return n;i[o]=n.error}var s=i.map((function(e){return"at error"+(e.at||"")+": "+e.message})).join('", "');return r({message:'expected a value matching one of the decoders, got the errors ["'+s+'"]'})}))},e.withDefault=function(t,i){return new e((function(e){return o(function(e,t){return!0===t.ok?t.result:e}(t,i.decode(e)))}))},e.valueAt=function(t,i){return new e((function(e){for(var o=e,n=0;n<t.length;n++){if(void 0===o)return r({at:g(t.slice(0,n+1)),message:"path does not exist"});if("string"==typeof t[n]&&!m(o))return r({at:g(t.slice(0,n+1)),message:w("an object",o)});if("number"==typeof t[n]&&!p(o))return r({at:g(t.slice(0,n+1)),message:w("an array",o)});o=o[t[n]]}return c((function(e){return void 0===o?{at:g(t),message:"path does not exist"}:f(g(t),e)}),i.decode(o))}))},e.succeed=function(t){return new e((function(e){return o(t)}))},e.fail=function(t){return new e((function(e){return r({message:t})}))},e.lazy=function(t){return new e((function(e){return t().decode(e)}))},e}(),v=y.string,k=y.number,b=y.boolean,W=y.anyJson;y.unknownJson;var I=y.constant,x=y.object,S=y.array;y.tuple,y.dict;var D=y.optional,C=y.oneOf;y.union;var E=y.intersection;y.withDefault,y.valueAt,y.succeed,y.fail;var B=y.lazy;const T=v().where((e=>e.length>0),"Expected a non-empty string"),M=k().where((e=>e>=0),"Expected a non-negative number"),R=k().where((e=>e>0),"Expected a positive number"),A=x({inWorkspace:b()}),L=C(I("workspace"),I("row"),I("column"),I("group")),F=C(I("row"),I("column"),I("group")),P=C(I("maximized"),I("minimized"),I("normal")),z=C(I("workspace")),H=(e,t)=>{const i=typeof e;if(t&&"function"!==i&&"undefined"!==i)throw new Error(`Provided argument must be either undefined or of type function, provided: ${i}`);if(!t&&"function"!==i)throw new Error(`Provided argument must be of type function, provided: ${i}`)},$=D(x({saveLayout:D(b())})),O=x({name:T}),j=x({minWidth:D(k()),maxWidth:D(k()),minHeight:D(k()),maxHeight:D(k()),allowExtract:D(b()),allowReorder:D(b()),showCloseButton:D(b())}),_=x({minWidth:D(k()),maxWidth:D(k()),minHeight:D(k()),maxHeight:D(k()),allowExtract:D(b()),allowReorder:D(b()),allowDrop:D(b()),allowDropHeader:D(b()),allowDropLeft:D(b()),allowDropRight:D(b()),allowDropTop:D(b()),allowDropBottom:D(b()),showMaximizeButton:D(b()),showEjectButton:D(b()),showAddWindowButton:D(b())}),G=x({minHeight:D(k()),maxHeight:D(k()),allowDrop:D(b()),allowSplitters:D(b()),isPinned:D(b()),maximizationBoundary:D(b())}),N=x({minWidth:D(k()),maxWidth:D(k()),allowDrop:D(b()),allowSplitters:D(b()),isPinned:D(b()),maximizationBoundary:D(b())}),J=x({type:D(I("window")),appName:D(T),windowId:D(T),context:D(W()),config:D(j)}),U=x({type:I("window"),appName:D(T),windowId:D(T),context:D(W()),config:D(j)}),K=D(x({type:D(F),children:D(B((()=>S(C(J,K))))),config:D(W())})),q=x({type:I("column"),children:D(B((()=>S(C(U,X))))),config:D(N)}),Q=x({type:I("row"),children:D(B((()=>S(C(U,X))))),config:D(G)}),V=x({type:I("group"),children:D(B((()=>S(C(U,X))))),config:D(_)}),X=C(V,q,Q);C(v().where((e=>"maximized"===e.toLowerCase()),"Expected a case insensitive variation of 'maximized'"),v().where((e=>"normal"===e.toLowerCase()),"Expected a case insensitive variation of 'normal'"));const Y=x({bounds:D(x({left:D(k()),top:D(k()),width:D(M),height:D(M)})),frameId:D(T)}),Z=C(I("direct"),I("delayed"),I("lazy")),ee=D(x({app:D(T),context:D(W()),loadingStrategy:D(Z),title:D(T),reuseWorkspaceId:D(T),frameId:D(T),applicationName:D(T),lockdown:D(b()),activateFrame:D(b()),newFrame:D(C(Y,b())),noTabHeader:D(b()),inMemoryLayout:D(b()),icon:D(T),isPinned:D(b()),isSelected:D(b()),positionIndex:D(M),allowSystemHibernation:D(b())})),te=x({name:T,restoreOptions:D(ee)}),ie=x({children:D(S(C(J,X))),context:D(W()),config:D(x({title:D(T),position:D(M),isFocused:D(b()),noTabHeader:D(b()),reuseWorkspaceId:D(T),loadingStrategy:D(Z),allowDrop:D(b()),allowDropLeft:D(b()),allowDropTop:D(b()),allowDropRight:D(b()),allowDropBottom:D(b()),allowSystemHibernation:D(b()),allowExtract:D(b()),allowWindowReorder:D(b()),showSaveButton:D(b()),allowWorkspaceTabReorder:D(b()),allowWorkspaceTabExtract:D(b()),showCloseButton:D(b()),allowSplitters:D(b()),showWindowCloseButtons:D(b()),showEjectButtons:D(b()),showAddWindowButtons:D(b()),icon:D(T),isPinned:D(b()),isSelected:D(b()),positionIndex:D(M)})),frame:D(x({reuseFrameId:D(T),applicationName:D(T),newFrame:D(C(b(),Y))}))}),oe=x({workspaceId:T}),re=x({name:T,restoreOptions:D(ee)}),ne=D(x({applicationName:D(v()),frameConfig:D(Y),context:D(x()),layoutComponentId:D(T)})),se=x({workspaces:S(C(D(ie),D(re)))}),ae=x({frameId:T,workspaces:S(C(ie,re))}),de=x({type:L,definition:D(C(ie,K))}),ce=E(ie,x({saveConfig:D(x({saveLayout:D(b())}))})),le=x({itemId:T}),ue=x({context:D(x())}),he=x({id:T,isFocused:D(b()),isInitialized:D(b()),initializationContext:D(ue)});x({type:F,id:T,frameId:T,workspaceId:T,positionIndex:k()});const pe=C(I("frame"),I("workspace"),I("container"),I("window")),me=x({type:pe,branch:T}),we=C(I("opened"),I("closing"),I("closed"),I("focus"),I("added"),I("loaded"),I("removed"),I("childrenUpdate"),I("containerChange"),I("maximized"),I("restored"),I("minimized"),I("normal"),I("selected"),I("lock-configuration-changed"),I("hibernated"),I("resumed")),ge=x({frameId:T,title:T,positionIndex:M,name:T,layoutName:D(T),isHibernated:D(b()),isSelected:D(b()),allowDrop:D(b()),allowSystemHibernation:D(b()),allowExtract:D(b()),allowWindowReorder:D(b()),allowSplitters:D(b()),showCloseButton:D(b()),showSaveButton:D(b()),allowWorkspaceTabReorder:D(b()),allowWorkspaceTabExtract:D(b()),allowDropLeft:D(b()),allowDropTop:D(b()),allowDropRight:D(b()),allowDropBottom:D(b()),minWidth:D(k()),maxWidth:D(k()),minHeight:D(k()),maxHeight:D(k()),showAddWindowButtons:D(b()),showEjectButtons:D(b()),showWindowCloseButtons:D(b()),widthInPx:D(k()),heightInPx:D(k()),isPinned:D(b())}),fe=x({frameId:T,workspaceId:T,positionIndex:k(),minWidth:D(k()),maxWidth:D(k()),minHeight:D(k()),maxHeight:D(k())}),ye=W(),ve=E(fe,x({windowId:D(T),isMaximized:D(b()),isFocused:b(),isSelected:D(b()),title:D(v()),appName:D(T),allowExtract:D(b()),allowReorder:D(b()),showCloseButton:D(b()),minWidth:D(k()),minHeight:D(k()),maxWidth:D(k()),maxHeight:D(k()),widthInPx:D(k()),heightInPx:D(k()),context:D(W())})),ke=x({id:D(T),config:ye,children:D(B((()=>S(We)))),type:C(I("row"),I("column"),I("group"))}),be=x({id:D(T),config:ve,type:I("window")}),We=C(be,ke),Ie=x({id:T,config:ge,children:S(We),frameSummary:he,context:D(W())}),xe=x({type:I("window"),config:x({appName:T,windowId:D(T),context:D(W()),url:D(T),title:D(v()),allowExtract:D(b()),allowReorder:D(b()),showCloseButton:D(b()),minWidth:D(k()),minHeight:D(k()),maxWidth:D(k()),maxHeight:D(k()),isMaximized:D(b())})}),Se=x({type:I("group"),config:W(),children:S(C(xe))}),De=x({type:I("column"),config:W(),children:S(C(Se,xe,B((()=>De)),B((()=>Ce))))}),Ce=x({type:I("row"),config:W(),children:S(C(De,Se,xe,B((()=>Ce))))}),Ee=x({name:T,type:I("Workspace"),metadata:D(W()),components:S(x({type:I("Workspace"),application:D(v()),state:x({config:W(),context:W(),children:S(C(Ce,De,Se,xe))})}))}),Be=x({layout:Ee,mode:C(I("replace"),I("merge"))}),Te=x({layouts:S(Ee),mode:C(I("replace"),I("merge"))}),Me=x({layouts:S(Ee)}),Re=x({id:T,isFocused:D(b()),isInitialized:D(b()),initializationContext:D(ue)}),Ae=x({summaries:S(Re)}),Le=x({id:T,config:ge}),Fe=x({summaries:S(Le)}),Pe=x({id:T,config:W(),workspaces:S(Ie)}),ze=x({name:T,applicationName:D(v())}),He=x({summaries:S(ze)}),$e=x({windowId:T}),Oe=W(),je=x({state:P}),_e=x({top:k(),left:k(),width:M,height:M}),Ge=x({bounds:_e}),Ne=x({icon:D(T)}),Je=x({id:D(T)}),Ue=x({isSupported:b()}),Ke=x({width:D(R),height:D(R),relative:D(b())}),qe=x({top:D(k()),left:D(k()),relative:D(b())}),Qe=x({itemId:T}),Ve=x({itemId:T,excludeIds:D(b())}),Xe=x({frameId:T,requestedState:P}),Ye=x({itemId:T,title:T}),Ze=x({itemId:T,containerId:T}),et=E(Qe,Ke),tt=x({itemId:T,enabled:b()}),it=E(Qe,qe);x({id:T,type:F});const ot=x({definition:J,parentId:T,parentType:L}),rt=x({definition:X,parentId:T,parentType:L}),nt=x({itemId:T,windowId:D(T)}),st=x({live:b()}),at=x({type:C(I("row"),I("column")),workspaceId:T}),dt=x({type:C(I("row"),I("column")),itemId:T}),ct=x({itemId:T,config:ye}),lt=x({frameSummary:he,frameBounds:D(_e)}),ut=x({workspaceSummary:Le,frameSummary:he,workspaceSnapshot:D(Ie),frameBounds:D(_e)}),ht=x({containerSummary:ct}),pt=x({windowSummary:x({itemId:T,parentId:T,config:ve})}),mt=x({name:T,workspaceId:T,saveContext:D(b()),metadata:D(x())}),wt=x({allowDrop:D(b()),allowDropLeft:D(b()),allowDropTop:D(b()),allowDropRight:D(b()),allowDropBottom:D(b()),allowSystemHibernation:D(b()),allowExtract:D(b()),allowWindowReorder:D(b()),allowSplitters:D(b()),showCloseButton:D(b()),showSaveButton:D(b()),allowWorkspaceTabReorder:D(b()),allowWorkspaceTabExtract:D(b()),showWindowCloseButtons:D(b()),showAddWindowButtons:D(b()),showEjectButtons:D(b())}),gt=x({workspaceId:T,config:D(wt)}),ft=x({allowExtract:D(b()),allowReorder:D(b()),showCloseButton:D(b())}),yt=x({width:D(M),height:D(M)}),vt=x({windowPlacementId:T,config:D(ft)}),kt=x({allowDrop:D(b()),allowSplitters:D(b())}),bt=x({allowDrop:D(b()),allowSplitters:D(b())}),Wt=x({allowExtract:D(b()),allowReorder:D(b()),allowDrop:D(b()),allowDropLeft:D(b()),allowDropRight:D(b()),allowDropTop:D(b()),allowDropBottom:D(b()),allowDropHeader:D(b()),showMaximizeButton:D(b()),showEjectButton:D(b()),showAddWindowButton:D(b())}),It=x({itemId:T,type:I("row"),config:D(kt)}),xt=x({itemId:T,type:I("column"),config:D(bt)}),St=x({itemId:T,type:I("group"),config:D(Wt)}),Dt=C(It,xt,St),Ct=x({workspaceId:T,icon:D(T)}),Et=x({workspaceId:T,icon:D(T)}),Bt=D(x({icon:D(T)})),Tt=x({shortcut:T,frameId:T}),Mt=x({shortcut:T,frameId:T}),Rt=x({enabled:b()}),At=x({itemId:T,type:z}),Lt=x({operation:T}),Ft="T42.Web.Platform.Control",Pt="T42.Web.Platform.WSP.Stream",zt={control:{name:"T42.Workspaces.Control",isStream:!1},frameStream:{name:"T42.Workspaces.Stream.Frame",isStream:!0},workspaceStream:{name:"T42.Workspaces.Stream.Workspace",isStream:!0},containerStream:{name:"T42.Workspaces.Stream.Container",isStream:!0},windowStream:{name:"T42.Workspaces.Stream.Window",isStream:!0}},Ht={control:{name:"T42.Workspaces.Client.Control",isStream:!1}},$t={frame:{name:"T42.Workspaces.Stream.Frame",payloadDecoder:lt},workspace:{name:"T42.Workspaces.Stream.Workspace",payloadDecoder:ut},container:{name:"T42.Workspaces.Stream.Container",payloadDecoder:ht},window:{name:"T42.Workspaces.Stream.Window",payloadDecoder:pt}},Ot={shortcutClicked:{name:"shortcutClicked",argsDecoder:Mt,resultDecoder:Oe}},jt={ping:{name:"ping",resultDecoder:st},isWindowInWorkspace:{name:"isWindowInWorkspace",argsDecoder:Qe,resultDecoder:A},createWorkspace:{name:"createWorkspace",resultDecoder:Ie,argsDecoder:ce},createFrame:{name:"createFrame",resultDecoder:Re,argsDecoder:ne},initFrame:{name:"initFrame",resultDecoder:Oe,argsDecoder:ae},getAllFramesSummaries:{name:"getAllFramesSummaries",resultDecoder:Ae},getFrameSummary:{name:"getFrameSummary",resultDecoder:he,argsDecoder:le},getAllWorkspacesSummaries:{name:"getAllWorkspacesSummaries",resultDecoder:Fe},getWorkspaceSnapshot:{name:"getWorkspaceSnapshot",resultDecoder:Ie,argsDecoder:Qe},getAllLayoutsSummaries:{name:"getAllLayoutsSummaries",resultDecoder:He},openWorkspace:{name:"openWorkspace",argsDecoder:te,resultDecoder:Ie},deleteLayout:{name:"deleteLayout",resultDecoder:Oe,argsDecoder:O},saveLayout:{name:"saveLayout",resultDecoder:Ee,argsDecoder:mt},importLayout:{name:"importLayout",resultDecoder:Oe,argsDecoder:Be},importLayouts:{name:"importLayouts",resultDecoder:Oe,argsDecoder:Te},exportAllLayouts:{name:"exportAllLayouts",resultDecoder:Me},restoreItem:{name:"restoreItem",argsDecoder:Qe,resultDecoder:Oe},maximizeItem:{name:"maximizeItem",argsDecoder:Qe,resultDecoder:Oe},focusItem:{name:"focusItem",argsDecoder:Qe,resultDecoder:Oe},closeItem:{name:"closeItem",argsDecoder:Qe,resultDecoder:Oe},resizeItem:{name:"resizeItem",argsDecoder:et,resultDecoder:Oe},setMaximizationBoundary:{name:"setMaximizationBoundary",argsDecoder:tt,resultDecoder:Oe},changeFrameState:{name:"changeFrameState",argsDecoder:Xe,resultDecoder:Oe},getFrameState:{name:"getFrameState",argsDecoder:Qe,resultDecoder:je},getFrameBounds:{name:"getFrameBounds",argsDecoder:Qe,resultDecoder:Ge},moveFrame:{name:"moveFrame",argsDecoder:it,resultDecoder:Oe},getFrameSnapshot:{name:"getFrameSnapshot",argsDecoder:Ve,resultDecoder:Pe},forceLoadWindow:{name:"forceLoadWindow",argsDecoder:Qe,resultDecoder:$e},ejectWindow:{name:"ejectWindow",argsDecoder:Qe,resultDecoder:$e},setItemTitle:{name:"setItemTitle",argsDecoder:Ye,resultDecoder:Oe},moveWindowTo:{name:"moveWindowTo",argsDecoder:Ze,resultDecoder:Oe},addWindow:{name:"addWindow",argsDecoder:ot,resultDecoder:nt},addContainer:{name:"addContainer",argsDecoder:rt,resultDecoder:nt},bundleWorkspace:{name:"bundleWorkspace",argsDecoder:at,resultDecoder:Oe},bundleItem:{name:"bundleItem",argsDecoder:dt,resultDecoder:Oe},hibernateWorkspace:{name:"hibernateWorkspace",argsDecoder:oe,resultDecoder:Oe},resumeWorkspace:{name:"resumeWorkspace",argsDecoder:oe,resultDecoder:Oe},lockWorkspace:{name:"lockWorkspace",argsDecoder:gt,resultDecoder:Oe},lockWindow:{name:"lockWindow",argsDecoder:vt,resultDecoder:Oe},lockContainer:{name:"lockContainer",argsDecoder:Dt,resultDecoder:Oe},pinWorkspace:{name:"pinWorkspace",argsDecoder:Ct,resultDecoder:Oe},unpinWorkspace:{name:"unpinWorkspace",argsDecoder:oe,resultDecoder:Oe},getWorkspaceIcon:{name:"getWorkspaceIcon",argsDecoder:oe,resultDecoder:Ne},setWorkspaceIcon:{name:"setWorkspaceIcon",argsDecoder:Et,resultDecoder:Oe},registerShortcut:{name:"registerShortcut",argsDecoder:Tt,resultDecoder:Oe},unregisterShortcut:{name:"unregisterShortcut",argsDecoder:Tt,resultDecoder:Oe},showLoadingAnimation:{name:"showLoadingAnimation",argsDecoder:At,resultDecoder:Oe},hideLoadingAnimation:{name:"hideLoadingAnimation",argsDecoder:At,resultDecoder:Oe},getPlatformFrameId:{name:"getPlatformFrameId",resultDecoder:Je},operationCheck:{name:"operationCheck",argsDecoder:Lt,resultDecoder:Ue}};class _t{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}class Gt{constructor(e,t){this.transport=e,this.registry=t,this.activeSubscriptions=[],this.pendingSubScriptions=[]}createCoreEventSubscription(){return e(this,void 0,void 0,(function*(){yield this.transport.coreSubscriptionReady(this.handleCoreEvent.bind(this))}))}handleCoreSubscription(e){const t=`${e.eventType}-${e.action}`,i=e.scope,o=e.scopeId;return this.registry.add(t,(t=>{var r,n,s,a,d,c;const l={type:i,id:o},u={frame:(null===(r=t.frameSummary)||void 0===r?void 0:r.id)||(null===(n=t.windowSummary)||void 0===n?void 0:n.config.frameId),workspace:(null===(s=t.workspaceSummary)||void 0===s?void 0:s.id)||(null===(a=t.windowSummary)||void 0===a?void 0:a.config.workspaceId),container:null===(d=t.containerSummary)||void 0===d?void 0:d.itemId,window:null===(c=t.windowSummary)||void 0===c?void 0:c.itemId};this.checkScopeMatch(l,u)&&e.callback(t)}))}send(t,i){return e(this,void 0,void 0,(function*(){const e=Object.values(jt).find((e=>e.name===t));if(!e)throw new Error(`Cannot find definition for operation name: ${t}`);if(e.argsDecoder)try{e.argsDecoder.runWithException(i)}catch(e){throw new Error(`Unexpected internal outgoing validation error: ${e.message}, for input: ${JSON.stringify(e.input)}, for operation ${t}`)}try{const t=yield this.transport.transmitControl(e.name,i);return e.resultDecoder.runWithException(t),t}catch(e){if(e.kind)throw new Error(`Unexpected internal incoming validation error: ${e.message}, for input: ${JSON.stringify(e.input)}, for operation ${t}`);throw new Error(e.message)}}))}subscribe(t){return e(this,void 0,void 0,(function*(){const e=this.getPendingSubscription(t);e&&(yield e.promise);let i=this.getActiveSubscription(t);const o=this.getRegistryKey(t);if(!i){const e=new _t,o={streamType:t.eventType,level:t.scope,levelId:t.scopeId,promise:e.promise};this.pendingSubScriptions.push(o);try{const r=$t[t.eventType],n=yield this.transport.subscribe(r.name,this.getBranchKey(t),t.eventType);n.onData((e=>{const t=e.data,i=me.run(e.requestArguments),o=we.run(t.action);if(!i.ok||!o.ok)return;const r=i.result.type,n=`${r}-${i.result.branch}-${o.result}`,s=$t[r].payloadDecoder.run(t.payload);s.ok&&this.registry.execute(n,s.result)})),i={streamType:t.eventType,level:t.scope,levelId:t.scopeId,callbacksCount:0,gdSub:n},this.activeSubscriptions.push(i),e.resolve()}catch(t){throw e.reject(t),t}finally{this.removePendingSubscription(o)}}const r=this.registry.add(o,t.callback);return++i.callbacksCount,()=>{r(),--i.callbacksCount,0===i.callbacksCount&&(i.gdSub.close(),this.activeSubscriptions.splice(this.activeSubscriptions.indexOf(i),1))}}))}onOperation(e){return this.transport.onInternalMethodInvoked("control",((t,i)=>{const o=t.operation,r=t.data,n=Object.values(Ot).find((e=>e.name===o));if(!n)throw new Error(`Cannot find definition for operation name: ${o}`);if(n.argsDecoder)try{n.argsDecoder.runWithException(r)}catch(e){throw new Error(`Unexpected internal outgoing validation error: ${e.message}, for input: ${JSON.stringify(e.input)}, for operation ${o}`)}e(t,i)}))}checkScopeMatch(e,t){return"global"===e.type||("frame"===e.type&&e.id===t.frame||("workspace"===e.type&&e.id===t.workspace||("container"===e.type&&e.id===t.container||"window"===e.type&&e.id===t.window)))}handleCoreEvent(e){const t=e.data;try{const e=we.runWithException(t.action),i=pe.runWithException(t.type),o=$t[i].payloadDecoder.runWithException(t.payload),r=`${i}-${e}`;this.registry.execute(r,o)}catch(e){console.warn(`Cannot handle event with data ${JSON.stringify(t)}, because of validation error: ${e.message}`)}}getBranchKey(e){return"global"===e.scope?e.scope:`${e.scope}_${e.scopeId}`}getRegistryKey(e){return`${e.eventType}-${this.getBranchKey(e)}-${e.action}`}getActiveSubscription(e){return this.activeSubscriptions.find((t=>t.streamType===e.eventType&&t.level===e.scope&&t.levelId===e.scopeId))}getPendingSubscription(e){return this.pendingSubScriptions.find((t=>t.streamType===e.eventType&&t.level===e.scope&&t.levelId===e.scopeId))}removePendingSubscription(e){const t=this.pendingSubScriptions.indexOf(e);t>=0&&this.pendingSubScriptions.splice(t,1)}}class Nt{constructor(e,t){this.agm=e,this.registry=t,this.defaultTransportTimeout=3e4,this.coreEventMethodInitiated=!1}initiate(t){return e(this,void 0,void 0,(function*(){if(window.glue42gd||window.iodesktop)return yield Promise.all(Object.values(zt).map((e=>this.verifyMethodLive(e.name)))),void(yield Promise.all(Object.keys(Ht).map((e=>this.registerMethod(e)))));const e=(window.glue42core||window.iobrowser).communicationId;yield Promise.all([this.verifyMethodLive(Ft,e),this.verifyMethodLive(Pt,e)]),yield this.transmitControl("frameHello",{windowId:t})}))}coreSubscriptionReady(e){return this.coreEventMethodInitiated||this.subscribePlatform(e),this.corePlatformSubPromise}subscribePlatform(e){this.coreEventMethodInitiated=!0;const t=(window.glue42core||window.iobrowser).communicationId;this.corePlatformSubPromise=this.agm.subscribe(Pt,t?{target:{instance:t}}:void 0),this.corePlatformSubPromise.then((t=>{t.onData((t=>e(t.data)))}))}subscribe(t,i,o){return e(this,void 0,void 0,(function*(){const e={branch:i,type:o};let r;try{r=yield this.agm.subscribe(t,{arguments:e})}catch(e){const o=`Internal subscription error! Error details: stream - ${t}, branch: ${i}. Internal message: ${e.message}`;throw new Error(o)}return r}))}transmitControl(t,i){return e(this,void 0,void 0,(function*(){const e=window.glue42gd||window.iodesktop,o=window.glue42core||window.iobrowser,r=e?{operation:t,operationArguments:i}:{operation:t,domain:"workspaces",data:i},n=e?zt.control.name:Ft,s=e?void 0:o.communicationId;let a;const d=`Internal Workspaces Communication Error. Attempted operation: ${JSON.stringify(r)}. `;try{if(a=yield this.agm.invoke(n,r,s?{instance:s}:"best",{methodResponseTimeoutMs:this.defaultTransportTimeout}),!a)throw new Error("Received unsupported result from GD - empty result");if(!Array.isArray(a.all_return_values)||0===a.all_return_values.length)throw new Error("Received unsupported result from GD - empty values collection")}catch(e){if(e&&e.all_errors&&e.all_errors.length){const t=e.all_errors[0].message;throw new Error(`${d} -> Inner message: ${t}`)}throw new Error(`${d} -> Inner message: ${e.message}`)}return a.all_return_values[0].returned}))}onInternalMethodInvoked(e,t){return this.registry.add(e,t)}verifyMethodLive(e,t){return i=()=>new Promise((i=>{if(this.agm.methods().some((i=>{const o=i.name===e,r=!t||i.getServers().some((e=>e.instance===t));return o&&r})))return void i();const o=this.agm.serverMethodAdded((r=>{const n=r.method,s=r.server,a=!t||s.instance===t;n.name===e&&a&&(o(),i())}))})),o=15e3,r="Timeout waiting for the Workspaces communication channels",new Promise(((e,t)=>{let n=!0;const s=setTimeout((()=>{n&&(n=!1,t(r||`Promise timeout hit: ${o}`))}),o);i().then((t=>{n&&(n=!1,clearTimeout(s),e(t))})).catch((e=>{n&&(n=!1,clearTimeout(s),t(e))}))}));var i,o,r}registerMethod(e){const t=Ht[e];return this.agm.register(t.name,((t,i)=>{this.registry.execute(e,t,i)}))}}const Jt=new WeakMap;class Ut{constructor(e,t){const i=t.wrapChildren(e.children);delete e.children,Jt.set(this,{base:t,children:i,definition:e})}get type(){return Jt.get(this).definition.type}addColumn(e){return Jt.get(this).base.add("column",Jt.get(this).children,e)}addRow(e){return Jt.get(this).base.add("row",Jt.get(this).children,e)}addGroup(e){return Jt.get(this).base.add("group",Jt.get(this).children,e)}addWindow(e){return Jt.get(this).base.addWindow(Jt.get(this).children,e),this}serialize(){const e=Jt.get(this).definition;return e.children=Jt.get(this).base.serializeChildren(Jt.get(this).children),e}}class Kt{constructor(e){this.getBuilder=e}wrapChildren(e){return e.map((e=>"window"===e.type?e:this.getBuilder({type:e.type,definition:e})))}add(e,t,i){const o=K.runWithException(i),r=this.getBuilder({type:e,definition:o});return t.push(r),r}addWindow(e,t){const i=J.runWithException(t);i.type="window",e.push(i)}serializeChildren(e){return e.map((e=>e instanceof Ut?e.serialize():e))}}const qt=new WeakMap;class Qt{constructor(e,t,i){const o=t.wrapChildren(e.children);delete e.children,qt.set(this,{base:t,children:o,definition:e,controller:i})}addColumn(e){const t=qt.get(this).children;if(!t.every((e=>e instanceof Ut&&"column"===e.type)))throw new Error("Cannot add a column to this workspace, because there are already children of another type");return qt.get(this).base.add("column",t,e)}addRow(e){const t=qt.get(this).children;if(!t.every((e=>e instanceof Ut&&"row"===e.type)))throw new Error("Cannot add a row to this workspace, because there are already children of another type");return qt.get(this).base.add("row",t,e)}addGroup(e){const t=qt.get(this).children;if(0!==t.length)throw new Error("Cannot add a group to this workspace, because there are already defined children.");return qt.get(this).base.add("group",t,e)}addWindow(e){const t=qt.get(this).children;if(0!==t.length)throw new Error("Cannot add a window to this workspace, because there are already defined children.");return qt.get(this).base.addWindow(t,e),this}getChildAt(e){M.runWithException(e);return qt.get(this).children[e]}create(t){return e(this,void 0,void 0,(function*(){const e=$.runWithException(t),i=qt.get(this).definition;i.children=qt.get(this).base.serializeChildren(qt.get(this).children);return qt.get(this).controller.createWorkspace(i,e)}))}}const Vt=new WeakMap,Xt=e=>Vt.get(e).base;class Yt{constructor(e){Vt.set(this,{base:e})}get type(){return"row"}get id(){return Xt(this).getId(this)}get frameId(){return Xt(this).getFrameId(this)}get workspaceId(){return Xt(this).getWorkspaceId(this)}get positionIndex(){return Xt(this).getPositionIndex(this)}get children(){return Xt(this).getAllChildren(this)}get parent(){return Xt(this).getMyParent(this)}get frame(){return Xt(this).getMyFrame(this)}get workspace(){return Xt(this).getMyWorkspace(this)}get allowDrop(){return Xt(this).getAllowDrop(this)}get allowSplitters(){return Xt(this).getAllowSplitters(this)}get minWidth(){return Xt(this).getMinWidth(this)}get minHeight(){return Xt(this).getMinHeight(this)}get maxWidth(){return Xt(this).getMaxWidth(this)}get maxHeight(){return Xt(this).getMaxHeight(this)}get width(){return Xt(this).getWidthInPx(this)}get height(){return Xt(this).getHeightInPx(this)}get isPinned(){return Xt(this).getIsPinned(this)}get isMaximized(){return Xt(this).getIsMaximized(this)}get maximizationBoundary(){return Xt(this).getMaximizationBoundary(this)}addWindow(e){return Xt(this).addWindow(this,e,"row")}addGroup(t){return e(this,void 0,void 0,(function*(){if((null==t?void 0:t.type)&&"group"!==t.type)throw new Error(`Expected a group definition, but received ${t.type}`);return Xt(this).addParent(this,"group","row",t)}))}addColumn(t){return e(this,void 0,void 0,(function*(){if((null==t?void 0:t.type)&&"column"!==t.type)throw new Error(`Expected a column definition, but received ${t.type}`);return Xt(this).addParent(this,"column","row",t)}))}addRow(){return e(this,void 0,void 0,(function*(){throw new Error("Adding rows as row children is not supported")}))}removeChild(e){return Xt(this).removeChild(this,e)}maximize(){return Xt(this).maximize(this)}restore(){return Xt(this).restore(this)}close(){return Xt(this).close(this)}lock(e){let t;if("function"==typeof e){t=e({allowDrop:this.allowDrop,allowSplitters:this.allowSplitters})}else t=e;const i=void 0===t?void 0:kt.runWithException(t);return Xt(this).lockContainer(this,i)}setHeight(t){return e(this,void 0,void 0,(function*(){return M.runWithException(t),Xt(this).setHeight(this,t)}))}onLockConfigurationChanged(t){return e(this,void 0,void 0,(function*(){H(t);const i={callback:()=>e(this,void 0,void 0,(function*(){yield this.workspace.refreshReference(),t({allowDrop:this.allowDrop,allowSplitters:this.allowSplitters})})),action:"lock-configuration-changed",eventType:"container",scope:"container"};return yield Xt(this).processLocalSubscription(this,i)}))}setMaximizationBoundary(t){return e(this,void 0,void 0,(function*(){const e=Rt.runWithException(t);return Xt(this).setMaximizationBoundary(this,e)}))}}const Zt=new WeakMap,ei=e=>Zt.get(e).base;class ti{constructor(e){Zt.set(this,{base:e})}get type(){return"column"}get id(){return ei(this).getId(this)}get frameId(){return ei(this).getFrameId(this)}get workspaceId(){return ei(this).getWorkspaceId(this)}get positionIndex(){return ei(this).getPositionIndex(this)}get children(){return ei(this).getAllChildren(this)}get parent(){return ei(this).getMyParent(this)}get frame(){return ei(this).getMyFrame(this)}get workspace(){return ei(this).getMyWorkspace(this)}get allowDrop(){return ei(this).getAllowDrop(this)}get allowSplitters(){return ei(this).getAllowSplitters(this)}get minWidth(){return ei(this).getMinWidth(this)}get minHeight(){return ei(this).getMinHeight(this)}get maxWidth(){return ei(this).getMaxWidth(this)}get maxHeight(){return ei(this).getMaxHeight(this)}get width(){return ei(this).getWidthInPx(this)}get height(){return ei(this).getHeightInPx(this)}get isPinned(){return ei(this).getIsPinned(this)}get isMaximized(){return ei(this).getIsMaximized(this)}get maximizationBoundary(){return ei(this).getMaximizationBoundary(this)}addWindow(e){return ei(this).addWindow(this,e,"column")}addGroup(t){return e(this,void 0,void 0,(function*(){if((null==t?void 0:t.type)&&"group"!==t.type)throw new Error(`Expected a group definition, but received ${t.type}`);return ei(this).addParent(this,"group","column",t)}))}addColumn(){return e(this,void 0,void 0,(function*(){throw new Error("Adding columns as column children is not supported")}))}addRow(t){return e(this,void 0,void 0,(function*(){if((null==t?void 0:t.type)&&"row"!==t.type)throw new Error(`Expected a row definition, but received ${t.type}`);return ei(this).addParent(this,"row","column",t)}))}removeChild(e){return ei(this).removeChild(this,e)}maximize(){return ei(this).maximize(this)}restore(){return ei(this).restore(this)}close(){return ei(this).close(this)}lock(e){let t;if("function"==typeof e){t=e({allowDrop:this.allowDrop,allowSplitters:this.allowSplitters})}else t=e;const i=void 0===t?void 0:bt.runWithException(t);return ei(this).lockContainer(this,i)}setWidth(t){return e(this,void 0,void 0,(function*(){return M.runWithException(t),ei(this).setWidth(this,t)}))}onLockConfigurationChanged(t){return e(this,void 0,void 0,(function*(){H(t);const i={callback:()=>e(this,void 0,void 0,(function*(){yield this.workspace.refreshReference(),t({allowDrop:this.allowDrop,allowSplitters:this.allowSplitters})})),action:"lock-configuration-changed",eventType:"container",scope:"container"};return yield ei(this).processLocalSubscription(this,i)}))}setMaximizationBoundary(t){return e(this,void 0,void 0,(function*(){const e=Rt.runWithException(t);return ei(this).setMaximizationBoundary(this,e)}))}}const ii=new WeakMap,oi=e=>ii.get(e).base;class ri{constructor(e){ii.set(this,{base:e})}get type(){return"group"}get id(){return oi(this).getId(this)}get frameId(){return oi(this).getFrameId(this)}get workspaceId(){return oi(this).getWorkspaceId(this)}get positionIndex(){return oi(this).getPositionIndex(this)}get children(){return oi(this).getAllChildren(this)}get parent(){return oi(this).getMyParent(this)}get frame(){return oi(this).getMyFrame(this)}get workspace(){return oi(this).getMyWorkspace(this)}get allowExtract(){return oi(this).getAllowExtract(this)}get allowReorder(){return oi(this).getAllowReorder(this)}get allowDropLeft(){return oi(this).getAllowDropLeft(this)}get allowDropRight(){return oi(this).getAllowDropRight(this)}get allowDropTop(){return oi(this).getAllowDropTop(this)}get allowDropBottom(){return oi(this).getAllowDropBottom(this)}get allowDropHeader(){return oi(this).getAllowDropHeader(this)}get allowDrop(){return oi(this).getAllowDrop(this)}get showMaximizeButton(){return oi(this).getShowMaximizeButton(this)}get showEjectButton(){return oi(this).getShowEjectButton(this)}get showAddWindowButton(){return oi(this).getShowAddWindowButton(this)}get minWidth(){return oi(this).getMinWidth(this)}get minHeight(){return oi(this).getMinHeight(this)}get maxWidth(){return oi(this).getMaxWidth(this)}get maxHeight(){return oi(this).getMaxHeight(this)}get width(){return oi(this).getWidthInPx(this)}get height(){return oi(this).getHeightInPx(this)}get isMaximized(){return oi(this).getIsMaximized(this)}addWindow(e){return oi(this).addWindow(this,e,"group")}addGroup(){return e(this,void 0,void 0,(function*(){throw new Error("Adding groups as group child is not supported")}))}addColumn(){return e(this,void 0,void 0,(function*(){throw new Error("Adding columns as group child is not supported")}))}addRow(){return e(this,void 0,void 0,(function*(){throw new Error("Adding rows as group child is not supported")}))}removeChild(e){return oi(this).removeChild(this,e)}maximize(){return oi(this).maximize(this)}restore(){return oi(this).restore(this)}close(){return oi(this).close(this)}lock(e){let t;if("function"==typeof e){t=e({allowDrop:this.allowDrop,allowDropHeader:this.allowDropHeader,allowDropLeft:this.allowDropLeft,allowDropRight:this.allowDropRight,allowDropTop:this.allowDropTop,allowDropBottom:this.allowDropBottom,allowExtract:this.allowExtract,allowReorder:this.allowReorder,showAddWindowButton:this.showAddWindowButton,showEjectButton:this.showEjectButton,showMaximizeButton:this.showMaximizeButton})}else t=e;const i=void 0===t?void 0:Wt.runWithException(t);return oi(this).lockContainer(this,i)}setSize(t){return e(this,void 0,void 0,(function*(){const e=yt.runWithException(t);if(!e.width&&!e.height)throw new Error("Expected either width or height to be passed.");return oi(this).setSize(this,t.width,t.height)}))}bundleToRow(){return e(this,void 0,void 0,(function*(){yield oi(this).bundleTo(this,"row"),yield this.workspace.refreshReference()}))}bundleToColumn(){return e(this,void 0,void 0,(function*(){yield oi(this).bundleTo(this,"column"),yield this.workspace.refreshReference()}))}onLockConfigurationChanged(t){return e(this,void 0,void 0,(function*(){H(t);const i={callback:()=>e(this,void 0,void 0,(function*(){yield this.workspace.refreshReference(),t({allowDrop:this.allowDrop,allowDropHeader:this.allowDropHeader,allowDropLeft:this.allowDropLeft,allowDropTop:this.allowDropTop,allowDropRight:this.allowDropRight,allowDropBottom:this.allowDropBottom,allowExtract:this.allowExtract,allowReorder:this.allowReorder,showAddWindowButton:this.showAddWindowButton,showEjectButton:this.showEjectButton,showMaximizeButton:this.showMaximizeButton})})),action:"lock-configuration-changed",eventType:"container",scope:"container"};return yield oi(this).processLocalSubscription(this,i)}))}}const ni=new WeakMap,si=e=>ni.get(e).manager.getWorkspaceData(e),ai=e=>ni.get(e).manager;class di{constructor(e){ni.set(this,{manager:e})}get id(){return si(this).id}get frameId(){return si(this).config.frameId}get positionIndex(){return si(this).config.positionIndex}get title(){return si(this).config.title}get layoutName(){return si(this).config.layoutName}get isHibernated(){return si(this).config.isHibernated}get isSelected(){return si(this).config.isSelected}get children(){return si(this).children}get frame(){return si(this).frame}get allowSplitters(){return si(this).config.allowSplitters}get allowSystemHibernation(){return si(this).config.allowSystemHibernation}get allowDrop(){return si(this).config.allowDrop}get allowDropLeft(){return si(this).config.allowDropLeft}get allowDropTop(){return si(this).config.allowDropTop}get allowDropRight(){return si(this).config.allowDropRight}get allowDropBottom(){return si(this).config.allowDropBottom}get allowExtract(){return si(this).config.allowExtract}get allowWindowReorder(){return si(this).config.allowWindowReorder}get showCloseButton(){return si(this).config.showCloseButton}get showSaveButton(){return si(this).config.showSaveButton}get allowWorkspaceTabReorder(){return si(this).config.allowWorkspaceTabReorder}get allowWorkspaceTabExtract(){return si(this).config.allowWorkspaceTabExtract}get minWidth(){return si(this).config.minWidth}get minHeight(){return si(this).config.minHeight}get maxWidth(){return si(this).config.maxWidth}get maxHeight(){return si(this).config.maxHeight}get width(){return si(this).config.widthInPx}get height(){return si(this).config.heightInPx}get showWindowCloseButtons(){return si(this).config.showWindowCloseButtons}get showEjectButtons(){return si(this).config.showEjectButtons}get showAddWindowButtons(){return si(this).config.showAddWindowButtons}get isPinned(){return si(this).config.isPinned}removeChild(t){return e(this,void 0,void 0,(function*(){H(t);const e=this.children.find(t);e&&(yield e.close(),yield this.refreshReference())}))}remove(t){return e(this,void 0,void 0,(function*(){H(t);const e=si(this).controller.iterateFindChild(this.children,t);yield e.close(),yield this.refreshReference()}))}focus(){return e(this,void 0,void 0,(function*(){yield si(this).controller.focusItem(this.id),yield this.refreshReference()}))}close(){return e(this,void 0,void 0,(function*(){const e=si(this).controller,t=yield si(this).frame.workspaces(),i=(yield e.getPlatformFrameId()).id;if(1===t.length&&t.every((e=>e.id===this.id))&&i!==this.frame.id)return this.frame.close();yield e.closeItem(this.id)}))}snapshot(){return si(this).controller.getSnapshot(this.id,"workspace")}saveLayout(t,i){return e(this,void 0,void 0,(function*(){T.runWithException(t),yield si(this).controller.saveLayout({name:t,workspaceId:this.id,saveContext:null==i?void 0:i.saveContext,metadata:null==i?void 0:i.metadata})}))}setTitle(t){return e(this,void 0,void 0,(function*(){T.runWithException(t);const e=si(this).controller;yield e.setItemTitle(this.id,t),yield this.refreshReference()}))}getContext(){return si(this).controller.getWorkspaceContext(this.id)}setContext(e){return si(this).controller.setWorkspaceContext(this.id,e)}updateContext(e){return si(this).controller.updateWorkspaceContext(this.id,e)}onContextUpdated(e){return si(this).controller.subscribeWorkspaceContextUpdated(this.id,e)}refreshReference(){return e(this,void 0,void 0,(function*(){const e=yield si(this).controller.getSnapshot(this.id,"workspace"),t=si(this).controller.flatChildren(si(this).children),i=si(this).controller.refreshChildren({existingChildren:t,workspace:this,parent:this,children:e.children}),o=this.frame;let r;if(o.id===e.config.frameId)ai(this).remapFrame(o,e.frameSummary),r=o;else{const t={summary:e.frameSummary};r=si(this).ioc.getModel("frame",t)}ai(this).remapWorkspace(this,{config:e.config,children:i,frame:r})}))}getIcon(){return e(this,void 0,void 0,(function*(){return si(this).controller.getWorkspaceIcon(this.id)}))}setIcon(t){return e(this,void 0,void 0,(function*(){return si(this).controller.setWorkspaceIcon(this.id,t)}))}getBox(e){H(e);const t=si(this).children;return si(this).controller.iterateFindChild(t,(t=>"window"!==t.type&&e(t)))}getAllBoxes(e){H(e,!0);const t=si(this).children,i=si(this).controller.iterateFilterChildren(t,(e=>"window"!==e.type));return e?i.filter(e):i}getRow(e){return H(e),this.getBox((t=>"row"===t.type&&e(t)))}getAllRows(e){return H(e,!0),e?this.getAllBoxes((t=>"row"===t.type&&e(t))):this.getAllBoxes((e=>"row"===e.type))}getColumn(e){return H(e),this.getBox((t=>"column"===t.type&&e(t)))}getAllColumns(e){return H(e,!0),e?this.getAllBoxes((t=>"column"===t.type&&e(t))):this.getAllBoxes((e=>"column"===e.type))}getGroup(e){return H(e),this.getBox((t=>"group"===t.type&&e(t)))}getAllGroups(e){return H(e,!0),e?this.getAllBoxes((t=>"group"===t.type&&e(t))):this.getAllBoxes((e=>"group"===e.type))}getWindow(e){H(e);const t=si(this).children;return si(this).controller.iterateFindChild(t,(t=>"window"===t.type&&e(t)))}getAllWindows(e){H(e,!0);const t=si(this).children,i=si(this).controller.iterateFilterChildren(t,(e=>"window"===e.type));return e?i.filter(e):i}addRow(e){return si(this).base.addParent(this,"row","workspace",e)}addColumn(e){return si(this).base.addParent(this,"column","workspace",e)}addGroup(e){return si(this).base.addParent(this,"group","workspace",e)}addWindow(e){return si(this).base.addWindow(this,e,"workspace")}bundleToRow(){return e(this,void 0,void 0,(function*(){yield si(this).controller.bundleWorkspaceTo("row",this.id),yield this.refreshReference()}))}bundleToColumn(){return e(this,void 0,void 0,(function*(){yield si(this).controller.bundleWorkspaceTo("column",this.id),yield this.refreshReference()}))}hibernate(){return e(this,void 0,void 0,(function*(){yield si(this).controller.hibernateWorkspace(this.id),yield this.refreshReference()}))}resume(){return e(this,void 0,void 0,(function*(){yield si(this).controller.resumeWorkspace(this.id),yield this.refreshReference()}))}lock(t){return e(this,void 0,void 0,(function*(){let e;if("function"==typeof t){const i={allowDrop:this.allowDrop,allowDropLeft:this.allowDropLeft,allowDropTop:this.allowDropTop,allowDropRight:this.allowDropRight,allowDropBottom:this.allowDropBottom,allowSystemHibernation:this.allowSystemHibernation,allowExtract:this.allowExtract,allowWindowReorder:this.allowWindowReorder,allowSplitters:this.allowSplitters,showCloseButton:this.showCloseButton,showSaveButton:this.showSaveButton,allowWorkspaceTabReorder:this.allowWorkspaceTabReorder,allowWorkspaceTabExtract:this.allowWorkspaceTabExtract,showAddWindowButtons:this.showAddWindowButtons,showEjectButtons:this.showEjectButtons,showWindowCloseButtons:this.showWindowCloseButtons};e=t(i)}else e=t;const i=void 0===e?void 0:wt.runWithException(e);yield si(this).controller.lockWorkspace(this.id,i),yield this.refreshReference()}))}pin(t){return e(this,void 0,void 0,(function*(){Bt.runWithException(t),yield si(this).controller.pinWorkspace(this.id,null==t?void 0:t.icon),yield this.refreshReference()}))}unpin(){return e(this,void 0,void 0,(function*(){yield si(this).controller.unpinWorkspace(this.id),yield this.refreshReference()}))}showLoadingAnimation(){return e(this,void 0,void 0,(function*(){if(!(window.glue42gd||window.iodesktop))throw new Error("Not supported in IO Connect Browser");yield si(this).controller.showWorkspaceLoadingAnimation(this.id)}))}hideLoadingAnimation(){return e(this,void 0,void 0,(function*(){if(!(window.glue42gd||window.iodesktop))throw new Error("Not supported in IO Connect Browser");yield si(this).controller.hideWorkspaceLoadingAnimation(this.id)}))}onClosed(t){return e(this,void 0,void 0,(function*(){H(t);const i=si(this).id,o={action:"closed",eventType:"workspace",scope:"workspace",scopeId:i,callback:i=>e(this,void 0,void 0,(function*(){t({frameId:i.frameSummary.id,workspaceId:i.workspaceSummary.id,frameBounds:i.frameBounds})}))};return yield si(this).controller.processLocalSubscription(o,i)}))}onHibernated(t){return e(this,void 0,void 0,(function*(){H(t);const i=si(this).id,o={action:"hibernated",eventType:"workspace",scope:"workspace",scopeId:i,callback:()=>e(this,void 0,void 0,(function*(){yield this.refreshReference(),t()}))};return yield si(this).controller.processLocalSubscription(o,i)}))}onResumed(t){return e(this,void 0,void 0,(function*(){H(t);const i=si(this).id,o={action:"resumed",eventType:"workspace",scope:"workspace",scopeId:i,callback:()=>e(this,void 0,void 0,(function*(){yield this.refreshReference(),t()}))};return yield si(this).controller.processLocalSubscription(o,i)}))}onWindowAdded(t){return e(this,void 0,void 0,(function*(){H(t);const i=si(this).id,o={action:"added",eventType:"window",scope:"workspace",scopeId:i,callback:i=>e(this,void 0,void 0,(function*(){yield this.refreshReference();const e=this.getBox((e=>e.id===i.windowSummary.parentId)).children.find((e=>"window"===e.type&&e.elementId===i.windowSummary.itemId));t(e)}))};return yield si(this).controller.processLocalSubscription(o,i)}))}onWindowRemoved(t){return e(this,void 0,void 0,(function*(){H(t);const i=si(this).id,o={action:"removed",eventType:"window",scope:"workspace",scopeId:i,callback:i=>e(this,void 0,void 0,(function*(){yield this.refreshReference();const{windowId:e,workspaceId:o,frameId:r}=i.windowSummary.config;t({windowId:e,workspaceId:o,frameId:r})}))};return yield si(this).controller.processLocalSubscription(o,i)}))}onWindowLoaded(t){return e(this,void 0,void 0,(function*(){H(t);const i=si(this).id,o={action:"loaded",eventType:"window",scope:"workspace",scopeId:i,callback:i=>e(this,void 0,void 0,(function*(){yield this.refreshReference();const e=this.getWindow((e=>e.id&&e.id===i.windowSummary.config.windowId));t(e)}))};return yield si(this).controller.processLocalSubscription(o,i)}))}onWindowMaximized(t){return e(this,void 0,void 0,(function*(){H(t);const i=si(this).id,o={action:"maximized",eventType:"window",scope:"workspace",scopeId:i,callback:i=>e(this,void 0,void 0,(function*(){yield this.refreshReference();const e=this.getBox((e=>e.id===i.windowSummary.parentId)).children.find((e=>"window"===e.type&&e.elementId===i.windowSummary.itemId));t(e)}))};return yield si(this).controller.processLocalSubscription(o,i)}))}onWindowRestored(t){return e(this,void 0,void 0,(function*(){H(t);const i=si(this).id,o={action:"restored",eventType:"window",scope:"workspace",scopeId:i,callback:i=>e(this,void 0,void 0,(function*(){yield this.refreshReference();const e=this.getBox((e=>e.id===i.windowSummary.parentId)).children.find((e=>"window"===e.type&&e.elementId===i.windowSummary.itemId));t(e)}))};return yield si(this).controller.processLocalSubscription(o,i)}))}onWindowSelected(t){return e(this,void 0,void 0,(function*(){H(t);const i=si(this).id,o={action:"selected",eventType:"window",scope:"workspace",scopeId:i,callback:i=>e(this,void 0,void 0,(function*(){yield this.refreshReference();const e=this.getBox((e=>e.id===i.windowSummary.parentId)).children.find((e=>"window"===e.type&&e.elementId===i.windowSummary.itemId));t(e)}))};return yield si(this).controller.processLocalSubscription(o,i)}))}onLockConfigurationChanged(t){return e(this,void 0,void 0,(function*(){H(t);const i=si(this).id,o={action:"lock-configuration-changed",eventType:"workspace",scope:"workspace",scopeId:i,callback:()=>e(this,void 0,void 0,(function*(){yield this.refreshReference(),t({allowDrop:this.allowDrop,allowDropLeft:this.allowDropLeft,allowDropTop:this.allowDropTop,allowDropRight:this.allowDropRight,allowDropBottom:this.allowDropBottom,allowSystemHibernation:this.allowSystemHibernation,allowExtract:this.allowExtract,allowSplitters:this.allowSplitters,allowWindowReorder:this.allowWindowReorder,allowWorkspaceTabExtract:this.allowWorkspaceTabExtract,allowWorkspaceTabReorder:this.allowWorkspaceTabReorder,showAddWindowButtons:this.showAddWindowButtons,showCloseButton:this.showCloseButton,showEjectButtons:this.showEjectButtons,showSaveButton:this.showSaveButton,showWindowCloseButtons:this.showWindowCloseButtons})}))};return yield si(this).controller.processLocalSubscription(o,i)}))}}const ci=new WeakMap,li=e=>ci.get(e).manager.getWindowData(e);class ui{constructor(e){ci.set(this,{manager:e})}get id(){return li(this).config.windowId}get elementId(){return li(this).id}get type(){return"window"}get frameId(){return li(this).frame.id}get workspaceId(){return li(this).workspace.id}get positionIndex(){return li(this).config.positionIndex}get isMaximized(){return li(this).config.isMaximized}get isLoaded(){return li(this).controller.checkIsWindowLoaded(this.id)}get isSelected(){return li(this).config.isSelected}get focused(){return this.getGdWindow().isFocused}get title(){return li(this).config.title}get allowExtract(){return li(this).config.allowExtract}get allowReorder(){return li(this).config.allowReorder}get showCloseButton(){return li(this).config.showCloseButton}get width(){return li(this).config.widthInPx}get height(){return li(this).config.heightInPx}get minWidth(){return li(this).config.minWidth}get minHeight(){return li(this).config.minHeight}get maxWidth(){return li(this).config.maxWidth}get maxHeight(){return li(this).config.maxHeight}get workspace(){return li(this).workspace}get frame(){return li(this).frame}get parent(){return li(this).parent}get appName(){return li(this).config.appName}forceLoad(){return e(this,void 0,void 0,(function*(){if(this.isLoaded)return;const e=li(this).controller,t=li(this).id,i=yield e.forceLoadWindow(t);li(this).config.windowId=i,yield this.workspace.refreshReference()}))}focus(){return e(this,void 0,void 0,(function*(){const e=li(this).id,t=li(this).controller;yield t.focusItem(e),yield this.workspace.refreshReference()}))}close(){return e(this,void 0,void 0,(function*(){const e=li(this).id,t=li(this).controller;yield t.closeItem(e),yield li(this).parent.removeChild((t=>t.id===e)),yield this.workspace.refreshReference()}))}setTitle(t){return e(this,void 0,void 0,(function*(){T.runWithException(t);const e=li(this).id,i=li(this).controller;yield i.setItemTitle(e,t),yield this.workspace.refreshReference()}))}maximize(){return e(this,void 0,void 0,(function*(){const e=li(this).id,t=li(this).controller;yield t.maximizeItem(e),yield this.workspace.refreshReference()}))}restore(){return e(this,void 0,void 0,(function*(){const e=li(this).id,t=li(this).controller;yield t.restoreItem(e),yield this.workspace.refreshReference()}))}eject(){return e(this,void 0,void 0,(function*(){if(!this.isLoaded)throw new Error("Cannot eject this window, because it is not loaded yet");const e=li(this).id,t=yield li(this).controller.ejectWindow(e);return li(this).config.windowId=t,yield this.workspace.refreshReference(),this.getGdWindow()}))}getGdWindow(){if(!this.isLoaded)throw new Error("Cannot fetch this GD window, because the window is not yet loaded");const e=li(this).config.windowId;return li(this).controller.getGDWindow(e)}moveTo(t){return e(this,void 0,void 0,(function*(){if(!(t instanceof Yt||t instanceof ti||t instanceof ri))throw new Error("Cannot add to the provided parent, because the provided parent is not an instance of Row, Column or Group");const e=li(this).id,i=li(this).controller;if(!(yield i.getParent((e=>e.id===t.id))))throw new Error("Cannot move the window to the selected parent, because this parent does not exist.");yield i.moveWindowTo(e,t.id),yield this.workspace.refreshReference()}))}lock(t){return e(this,void 0,void 0,(function*(){let e;if("function"==typeof t){const i={allowExtract:this.allowExtract,allowReorder:this.allowReorder,showCloseButton:this.showCloseButton};e=t(i)}else e=t;const i=void 0===e?void 0:ft.runWithException(e),o=li(this).id;yield li(this).controller.lockWindow(o,i),yield this.workspace.refreshReference()}))}setSize(t){return e(this,void 0,void 0,(function*(){const e=yt.runWithException(t);if(!e.width&&!e.height)throw new Error("Expected either width or height to be passed.");const i=li(this).id,o=li(this).controller;yield o.resizeItem(i,{height:e.height,width:e.width,relative:!1}),yield this.workspace.refreshReference()}))}onRemoved(t){return e(this,void 0,void 0,(function*(){H(t);const i=li(this).id,o={callback:()=>e(this,void 0,void 0,(function*(){yield this.workspace.refreshReference(),t()})),action:"removed",eventType:"window",scope:"window"};return yield li(this).controller.processLocalSubscription(o,i)}))}onLockConfigurationChanged(t){return e(this,void 0,void 0,(function*(){H(t);const i=li(this).id,o={callback:()=>e(this,void 0,void 0,(function*(){yield this.workspace.refreshReference(),t({allowExtract:this.allowExtract,allowReorder:this.allowReorder,showCloseButton:this.showCloseButton})})),action:"lock-configuration-changed",eventType:"window",scope:"window"};return yield li(this).controller.processLocalSubscription(o,i)}))}}const hi=new WeakMap,pi=e=>hi.get(e).manager.getFrameData(e);class mi{constructor(e){hi.set(this,{manager:e})}registerShortcut(t,i){return e(this,void 0,void 0,(function*(){T.runWithException(t),H(i);const e=pi(this).summary.id;return yield pi(this).controller.registerShortcut(t,e,i)}))}get id(){return pi(this).summary.id}get isInitialized(){return pi(this).summary.isInitialized}getBounds(){const e=pi(this).summary.id;return pi(this).controller.getFrameBounds(e)}resize(t){return e(this,void 0,void 0,(function*(){const e=Ke.runWithException(t),i=pi(this).summary.id;return pi(this).controller.resizeItem(i,e)}))}move(t){return e(this,void 0,void 0,(function*(){const e=qe.runWithException(t),i=pi(this).summary.id;return pi(this).controller.moveFrame(i,e)}))}focus(){const e=pi(this).summary.id;return pi(this).controller.focusItem(e)}state(){return e(this,void 0,void 0,(function*(){if(!(window.glue42gd||window.iodesktop))throw new Error("State operations are not supported in IO Connect Browser");const e=pi(this).summary.id;return pi(this).controller.getFrameState(e)}))}minimize(){return e(this,void 0,void 0,(function*(){if(!(window.glue42gd||window.iodesktop))throw new Error("State operations are not supported in IO Connect Browser");const e=pi(this).summary.id;return pi(this).controller.changeFrameState(e,"minimized")}))}maximize(){return e(this,void 0,void 0,(function*(){if(!(window.glue42gd||window.iodesktop))throw new Error("State operations are not supported in IO Connect Browser");const e=pi(this).summary.id;return pi(this).controller.changeFrameState(e,"maximized")}))}restore(){return e(this,void 0,void 0,(function*(){if(!(window.glue42gd||window.iodesktop))throw new Error("State operations are not supported in IO Connect Browser");const e=pi(this).summary.id;return pi(this).controller.changeFrameState(e,"normal")}))}close(){const e=pi(this).summary.id;return pi(this).controller.closeItem(e)}snapshot(){const e=pi(this).summary.id;return pi(this).controller.getSnapshot(e,"frame")}workspaces(){return e(this,void 0,void 0,(function*(){return pi(this).controller.getWorkspacesByFrameId(this.id)}))}getConstraints(){return e(this,void 0,void 0,(function*(){const e=pi(this).controller,t=pi(this).summary.id;return e.getFrameConstraints(t)}))}restoreWorkspace(t,i){return e(this,void 0,void 0,(function*(){T.runWithException(t);const e=ee.runWithException(i);return pi(this).controller.restoreWorkspace(t,e)}))}createWorkspace(e,t){const i=ie.runWithException(e),o=$.runWithException(t);return pi(this).controller.createWorkspace(i,o)}init(t){return e(this,void 0,void 0,(function*(){if(se.runWithException(t),pi(this).summary.isInitialized)throw new Error("The frame has already been initialized");return pi(this).controller.initFrame(this.id,t)}))}onClosed(t){return e(this,void 0,void 0,(function*(){H(t);const e=pi(this).summary.id,i={callback:e=>{t({frameId:e.frameSummary.id,frameBounds:e.frameBounds})},action:"closed",eventType:"frame",scope:"frame"};return yield pi(this).controller.processLocalSubscription(i,e)}))}onMaximized(t){return e(this,void 0,void 0,(function*(){H(t);const e=pi(this).summary.id,i={callback:()=>{t()},action:"maximized",eventType:"frame",scope:"frame"};return yield pi(this).controller.processLocalSubscription(i,e)}))}onMinimized(t){return e(this,void 0,void 0,(function*(){H(t);const e=pi(this).summary.id,i={callback:()=>{t()},action:"minimized",eventType:"frame",scope:"frame"};return yield pi(this).controller.processLocalSubscription(i,e)}))}onNormal(t){return e(this,void 0,void 0,(function*(){H(t);const e=pi(this).summary.id,i={callback:()=>{t()},action:"normal",eventType:"frame",scope:"frame"};return yield pi(this).controller.processLocalSubscription(i,e)}))}onWorkspaceOpened(t){return e(this,void 0,void 0,(function*(){H(t);const i=pi(this).summary.id,o={callback:i=>e(this,void 0,void 0,(function*(){const e=yield pi(this).controller.transformStreamPayloadToWorkspace(i);t(e)})),action:"opened",eventType:"workspace",scope:"frame"};return yield pi(this).controller.processLocalSubscription(o,i)}))}onWorkspaceSelected(t){return e(this,void 0,void 0,(function*(){H(t);const i=pi(this).summary.id,o={callback:i=>e(this,void 0,void 0,(function*(){const e=yield pi(this).controller.getWorkspaceById(i.workspaceSummary.id);t(e)})),action:"selected",eventType:"workspace",scope:"frame"};return yield pi(this).controller.processLocalSubscription(o,i)}))}onWorkspaceClosed(t){return e(this,void 0,void 0,(function*(){H(t);const e=pi(this).summary.id,i={callback:e=>{t({frameId:e.frameSummary.id,workspaceId:e.workspaceSummary.id,frameBounds:e.frameBounds})},action:"closed",eventType:"workspace",scope:"frame"};return yield pi(this).controller.processLocalSubscription(i,e)}))}onWindowAdded(t){return e(this,void 0,void 0,(function*(){H(t);const i=pi(this).summary.id,o={callback:i=>e(this,void 0,void 0,(function*(){const e=(yield pi(this).controller.getParent((e=>e.id===i.windowSummary.parentId))).children.find((e=>"window"===e.type&&e.positionIndex===i.windowSummary.config.positionIndex));t(e)})),action:"added",eventType:"window",scope:"frame"};return yield pi(this).controller.processLocalSubscription(o,i)}))}onWindowRemoved(t){return e(this,void 0,void 0,(function*(){H(t);const e=pi(this).summary.id,i={callback:e=>{const{windowId:i,workspaceId:o,frameId:r}=e.windowSummary.config;t({windowId:i,workspaceId:o,frameId:r})},action:"removed",eventType:"window",scope:"frame"};return yield pi(this).controller.processLocalSubscription(i,e)}))}onWindowLoaded(t){return e(this,void 0,void 0,(function*(){H(t);const i=pi(this).summary.id,o={callback:i=>e(this,void 0,void 0,(function*(){const e=(yield pi(this).controller.getParent((e=>e.id===i.windowSummary.parentId))).children.find((e=>"window"===e.type&&e.positionIndex===i.windowSummary.config.positionIndex));t(e)})),action:"loaded",eventType:"window",scope:"frame"};return yield pi(this).controller.processLocalSubscription(o,i)}))}onInitializationRequested(t){return e(this,void 0,void 0,(function*(){return H(t),this.isInitialized||t(pi(this).summary.initializationContext),()=>{}}))}onFocusChanged(t){return e(this,void 0,void 0,(function*(){H(t);const e=pi(this),{id:i}=e.summary,o={callback:e=>{t({isFocused:e.frameSummary.isFocused})},action:"focus",eventType:"frame",scope:"frame"};return yield e.controller.processLocalSubscription(o,i)}))}}class wi{constructor(){this.parentsData=new WeakMap,this.workspacesData=new WeakMap,this.windowsData=new WeakMap,this.framesData=new WeakMap}deleteData(e){e instanceof ui&&this.windowsData.delete(e),e instanceof di&&this.workspacesData.delete(e),(e instanceof Yt||e instanceof ti||e instanceof ri)&&this.parentsData.delete(e),e instanceof mi&&this.framesData.delete(e)}setWindowData(e,t){this.windowsData.set(e,t)}setWorkspaceData(e,t){this.workspacesData.set(e,t)}setParentData(e,t){this.parentsData.set(e,t)}setFrameData(e,t){this.framesData.set(e,t)}getWindowData(e){return this.windowsData.get(e)}getWorkspaceData(e){return this.workspacesData.get(e)}getParentData(e){return this.parentsData.get(e)}getFrameData(e){return this.framesData.get(e)}remapChild(e,t){if(e instanceof ui){const i=this.windowsData.get(e);i.parent=t.parent||i.parent,i.config=t.config||i.config}if(e instanceof Yt||e instanceof ti||e instanceof ri){const i=this.parentsData.get(e);i.parent=t.parent||i.parent,i.config=t.config||i.config,i.children=t.children||i.children}}remapFrame(e,t){this.framesData.get(e).summary=t}remapWorkspace(e,t){const i=this.workspacesData.get(e);i.frame=t.frame||i.frame,i.config=t.config||i.config,i.children=t.children||i.children}}const gi=new WeakMap,fi=(e,t)=>{const i=gi.get(e).manager;return t instanceof di?i.getWorkspaceData(t):gi.get(e).manager.getParentData(t)};class yi{constructor(e){gi.set(this,{manager:e})}getId(e){return fi(this,e).id}getPositionIndex(e){return fi(this,e).config.positionIndex}getWorkspaceId(e){const t=fi(this,e);return t.config.workspaceId||t.workspace.id}getFrameId(e){return fi(this,e).frame.id}getAllChildren(e,t){H(t,!0);const i=fi(this,e).children;return void 0===t?i:i.filter(t)}getMyParent(e){return e instanceof di?e:fi(this,e).parent}getMyFrame(e){return fi(this,e).frame}getMyWorkspace(e){return e instanceof di?e:fi(this,e).workspace}addWindow(t,i,o){return e(this,void 0,void 0,(function*(){if(!i.appName&&!i.windowId)throw new Error("The window definition should contain either an appName or a windowId");const e=J.runWithException(i),r=fi(this,t).controller,n=yield r.add("window",fi(this,t).id,o,e);if(t instanceof di)return yield t.refreshReference(),t.getWindow((e=>e.elementId===n.itemId));const s=this.getMyWorkspace(t);return yield s.refreshReference(),s.getWindow((e=>e.elementId===n.itemId))}))}addParent(t,i,o,r){return e(this,void 0,void 0,(function*(){const e=this.transformDefinition(i,r),n=fi(this,t).controller,s=(yield n.add("container",fi(this,t).id,o,e)).itemId;if(t instanceof di)return yield t.refreshReference(),t.getBox((e=>e.id===s));const a=this.getMyWorkspace(t);return yield a.refreshReference(),a.getBox((e=>e.id===s))}))}removeChild(t,i){return e(this,void 0,void 0,(function*(){H(i);const e=this.getAllChildren(t).find(i);e&&(yield e.close(),t instanceof di?yield t.refreshReference():yield this.getMyWorkspace(t).refreshReference())}))}maximize(t){return e(this,void 0,void 0,(function*(){const{controller:e,id:i}=fi(this,t);yield e.maximizeItem(i),yield this.getMyWorkspace(t.parent).refreshReference()}))}restore(t){return e(this,void 0,void 0,(function*(){const{controller:e,id:i}=fi(this,t);yield e.restoreItem(i),yield this.getMyWorkspace(t.parent).refreshReference()}))}close(t){return e(this,void 0,void 0,(function*(){const e=fi(this,t),i=fi(this,t).controller;yield i.closeItem(e.id),yield this.getMyWorkspace(e.parent).refreshReference()}))}lockContainer(t,i){return e(this,void 0,void 0,(function*(){const e=fi(this,t),o=fi(this,t).controller;yield o.lockContainer(e.id,t.type,i),yield this.getMyWorkspace(e.parent).refreshReference()}))}getAllowDrop(e){return fi(this,e).config.allowDrop}getAllowDropLeft(e){const t=fi(this,e);if("group"!==t.type)throw new Error(`Property allowDropLeft is available only for groups and not on ${e.type} ${e.id}`);return t.config.allowDropLeft}getAllowDropRight(e){const t=fi(this,e);if("group"!==t.type)throw new Error(`Property allowDropRight is available only for groups and not on ${e.type} ${e.id}`);return t.config.allowDropRight}getAllowDropTop(e){const t=fi(this,e);if("group"!==t.type)throw new Error(`Property allowDropTop is available only for groups and not on ${e.type} ${e.id}`);return t.config.allowDropTop}getAllowDropBottom(e){const t=fi(this,e);if("group"!==t.type)throw new Error(`Property allowDropBottom is available only for groups and not on ${e.type} ${e.id}`);return t.config.allowDropBottom}getAllowDropHeader(e){const t=fi(this,e);if("group"!==t.type)throw new Error(`Property allowDropHeader is available only for groups and not on ${e.type} ${e.id}`);return t.config.allowDropHeader}getAllowSplitters(e){const t=fi(this,e);if("group"===t.type)throw new Error(`Cannot get allow splitters from private data ${t.type}`);return t.config.allowSplitters}getAllowExtract(e){const t=fi(this,e);if("group"!==t.type)throw new Error(`Cannot get allow extract from private data ${t.type} with config ${"workspace"!==t.type?t.config.type:""}`);return t.config.allowExtract}getAllowReorder(e){const t=fi(this,e);if("group"!==t.type)throw new Error(`Cannot get allow extract from private data ${t.type} with config ${"workspace"!==t.type?t.config.type:""}`);return t.config.allowReorder}getShowMaximizeButton(e){const t=fi(this,e);if("group"!==t.type)throw new Error(`Cannot get show maximize button from private data${t.type} with config ${"workspace"!==t.type?t.config.type:""}`);return t.config.showMaximizeButton}getShowEjectButton(e){const t=fi(this,e);if("group"!==t.type)throw new Error(`Cannot get show eject button from private data${t.type} with config ${"workspace"!==t.type?t.config.type:""}`);return t.config.showEjectButton}getShowAddWindowButton(e){const t=fi(this,e);if("group"!==t.type)throw new Error(`Cannot get add window button from private data${t.type} with config ${"workspace"!==t.type?t.config.type:""}`);return t.config.showAddWindowButton}getMinWidth(e){return fi(this,e).config.minWidth}getMaxWidth(e){return fi(this,e).config.maxWidth}getMinHeight(e){return fi(this,e).config.minHeight}getMaxHeight(e){return fi(this,e).config.maxHeight}getWidthInPx(e){return fi(this,e).config.widthInPx}getHeightInPx(e){return fi(this,e).config.heightInPx}getIsPinned(e){return fi(this,e).config.isPinned}getIsMaximized(e){return fi(this,e).config.isMaximized}getMaximizationBoundary(e){return fi(this,e).config.maximizationBoundary}setHeight(t,i){return e(this,void 0,void 0,(function*(){const e=fi(this,t),{controller:o,id:r}=e;yield o.resizeItem(r,{height:i}),yield this.getMyWorkspace(e.parent).refreshReference()}))}setWidth(t,i){return e(this,void 0,void 0,(function*(){const e=fi(this,t),{controller:o,id:r}=e;yield o.resizeItem(r,{width:i}),yield this.getMyWorkspace(e.parent).refreshReference()}))}setSize(t,i,o){return e(this,void 0,void 0,(function*(){const e=fi(this,t),{controller:r,id:n}=e;yield r.resizeItem(n,{width:i,height:o}),yield this.getMyWorkspace(e.parent).refreshReference()}))}setMaximizationBoundary(t,i){return e(this,void 0,void 0,(function*(){const e=fi(this,t),{controller:o,id:r}=e;yield o.setMaximizationBoundary(r,i),yield this.getMyWorkspace(e.parent).refreshReference()}))}bundleTo(t,i){return e(this,void 0,void 0,(function*(){const e=fi(this,t),{controller:o,id:r}=e;yield o.bundleItemTo(i,r)}))}processLocalSubscription(t,i){return e(this,void 0,void 0,(function*(){return fi(this,t).controller.processLocalSubscription(i,this.getId(t))}))}transformDefinition(e,t){let i;return void 0===t?i={type:e,children:[]}:t instanceof Ut?i=t.serialize():(void 0===t.type&&(t.type=e),i=X.runWithException(t),i.children=i.children||[]),i}}class vi{constructor(e,t,i,o){this.ioc=e,this.windows=t,this.contexts=i,this.layouts=o}get bridge(){return this.ioc.bridge}get privateDataManager(){return this.ioc.privateDataManager}checkIsWindowLoaded(e){return!!e&&this.windows.list().some((t=>t.id===e))}createWorkspace(t){return e(this,void 0,void 0,(function*(){const e=yield this.bridge.send(jt.createWorkspace.name,t),i={summary:e.frameSummary},o={frame:this.ioc.getModel("frame",i),snapshot:e};return this.ioc.getModel("workspace",o)}))}createEmptyFrame(t){return e(this,void 0,void 0,(function*(){const e={summary:yield this.bridge.send(jt.createFrame.name,t)};return this.ioc.getModel("frame",e)}))}initFrame(t,i){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.initFrame.name,Object.assign({frameId:t},i))}))}restoreWorkspace(t,i){return e(this,void 0,void 0,(function*(){const e=yield this.bridge.send(jt.openWorkspace.name,{name:t,restoreOptions:i}),o={summary:yield this.bridge.send(jt.getFrameSummary.name,{itemId:e.config.frameId})},r={frame:this.ioc.getModel("frame",o),snapshot:e};return this.ioc.getModel("workspace",r)}))}add(t,i,o,r){return e(this,void 0,void 0,(function*(){let e;const n={definition:r,parentId:i,parentType:o};if("window"===t)e=jt.addWindow.name;else{if("container"!==t)throw new Error(`Unrecognized add type: ${t}`);e=jt.addContainer.name}return yield this.bridge.send(e,n)}))}getFrame(t){return e(this,void 0,void 0,(function*(){const e={summary:yield this.bridge.send(jt.getFrameSummary.name,{itemId:t})};return this.ioc.getModel("frame",e)}))}getFrames(e,t){return e.reduce(((e,i)=>{const o={summary:i},r=this.ioc.getModel("frame",o);return t&&!t(r)||e.push(r),e}),[])}getAllWorkspaceSummaries(...e){return e.reduce(((e,t)=>(e.push(...t.summaries),e)),[]).map((e=>Object.assign({},{id:e.id,width:e.config.widthInPx,height:e.config.heightInPx},e.config)))}handleOnSaved(e){const t=t=>{"Workspace"===t.type&&e(t)},i=this.layouts.onAdded(t),o=this.layouts.onChanged(t);return()=>{i(),o()}}handleOnRemoved(e){return this.layouts.onRemoved((t=>{"Workspace"===t.type&&e(t)}))}importLayouts(t,i){return e(this,void 0,void 0,(function*(){yield this.layouts.import(t,i)}))}transformStreamPayloadToWorkspace(t){return e(this,void 0,void 0,(function*(){const e={summary:t.frameSummary},i={frame:this.ioc.getModel("frame",e),snapshot:t.workspaceSnapshot||(yield this.bridge.send(jt.getWorkspaceSnapshot.name,{itemId:t.workspaceSummary.id}))};return this.ioc.getModel("workspace",i)}))}fetchWorkspace(t){return e(this,void 0,void 0,(function*(){const e=yield this.bridge.send(jt.getWorkspaceSnapshot.name,{itemId:t}),i={summary:e.frameSummary},o={frame:this.ioc.getModel("frame",i),snapshot:e};return this.ioc.getModel("workspace",o)}))}bundleWorkspaceTo(t,i){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.bundleWorkspace.name,{type:t,workspaceId:i})}))}bundleItemTo(t,i){return e(this,void 0,void 0,(function*(){if(!(yield this.isOperationSupported(jt.bundleItem.name)))throw new Error(`Operation ${jt.bundleItem.name} is not supported. Ensure that you are running the latest version of all packages`);yield this.bridge.send(jt.bundleItem.name,{type:t,itemId:i})}))}getWorkspaceContext(e){const t=`___workspace___${e}`;return this.contexts.get(t)}setWorkspaceContext(e,t){const i=`___workspace___${e}`;return this.contexts.set(i,t)}updateWorkspaceContext(e,t){const i=`___workspace___${e}`;return this.contexts.update(i,t)}subscribeWorkspaceContextUpdated(e,t){const i=`___workspace___${e}`;return this.contexts.subscribe(i,t)}restoreItem(t){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.restoreItem.name,{itemId:t})}))}maximizeItem(t){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.maximizeItem.name,{itemId:t})}))}focusItem(t){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.focusItem.name,{itemId:t})}))}closeItem(t){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.closeItem.name,{itemId:t})}))}resizeItem(t,i){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.resizeItem.name,Object.assign({},{itemId:t},i))}))}setMaximizationBoundary(t,i){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.setMaximizationBoundary.name,Object.assign({},{itemId:t},i))}))}showWorkspaceLoadingAnimation(t){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.showLoadingAnimation.name,{itemId:t,type:"workspace"})}))}hideWorkspaceLoadingAnimation(t){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.hideLoadingAnimation.name,{itemId:t,type:"workspace"})}))}moveFrame(t,i){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.moveFrame.name,Object.assign({},{itemId:t},i))}))}getGDWindow(e){return this.windows.list().find((t=>t.id===e))}forceLoadWindow(t){return e(this,void 0,void 0,(function*(){return(yield this.bridge.send(jt.forceLoadWindow.name,{itemId:t})).windowId}))}ejectWindow(t){return e(this,void 0,void 0,(function*(){return yield this.bridge.send(jt.ejectWindow.name,{itemId:t})}))}moveWindowTo(t,i){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.moveWindowTo.name,{itemId:t,containerId:i})}))}getSnapshot(t,i){return e(this,void 0,void 0,(function*(){let e;return"workspace"===i?e=yield this.bridge.send(jt.getWorkspaceSnapshot.name,{itemId:t}):"frame"===i&&(e=yield this.bridge.send(jt.getFrameSnapshot.name,{itemId:t})),e}))}setItemTitle(t,i){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.setItemTitle.name,{itemId:t,title:i})}))}refreshChildren(e){const{parent:t,children:i,existingChildren:o,workspace:r}=e;if(t instanceof ui||"window"===t.type)return;const n=i.map((e=>{let i=o.find((t=>"window"===t.type?t.elementId===e.id:t.id===e.id));if(i)this.privateDataManager.remapChild(i,{parent:t,children:[],config:e.config});else{let o;o="window"===e.type?{id:e.id,parent:t,frame:r.frame,workspace:r,config:e.config}:{id:e.id,parent:t,frame:r.frame,workspace:r,config:e.config,children:[]},i=this.ioc.getModel(e.type,o)}return"window"!==e.type&&this.refreshChildren({workspace:r,existingChildren:o,children:e.children,parent:i}),i}));return t instanceof di||this.privateDataManager.remapChild(t,{children:n}),n}iterateFindChild(e,t){let i=e.find((e=>t(e)));return i||(e.some((e=>!(e instanceof ui)&&(i=this.iterateFindChild(e.children,t),!!i||void 0))),i)}iterateFilterChildren(e,t){const i=e.filter((e=>t(e))),o=e.reduce(((e,i)=>(i instanceof ui||e.push(...this.iterateFilterChildren(i.children,t)),e)),[]);return i.push(...o),i}notifyWindowAdded(e){return new Promise((t=>{if(this.windows.list().some((t=>t.id===e)))return t();const i=this.windows.onWindowAdded((o=>{o.id===e&&(i&&i(),t())}))}))}hibernateWorkspace(t){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.hibernateWorkspace.name,{workspaceId:t})}))}resumeWorkspace(t){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.resumeWorkspace.name,{workspaceId:t})}))}lockWorkspace(t,i){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.lockWorkspace.name,{workspaceId:t,config:i})}))}lockWindow(t,i){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.lockWindow.name,{windowPlacementId:t,config:i})}))}lockContainer(t,i,o){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.lockContainer.name,{itemId:t,type:i,config:o})}))}pinWorkspace(t,i){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.pinWorkspace.name,{workspaceId:t,icon:i})}))}unpinWorkspace(t){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.unpinWorkspace.name,{workspaceId:t})}))}getWorkspaceIcon(t){return e(this,void 0,void 0,(function*(){return(yield this.bridge.send(jt.getWorkspaceIcon.name,{workspaceId:t})).icon}))}setWorkspaceIcon(e,t){return this.bridge.send(jt.setWorkspaceIcon.name,{workspaceId:e,icon:t})}getPlatformFrameId(){return e(this,void 0,void 0,(function*(){try{return yield this.bridge.send(jt.getPlatformFrameId.name,{})}catch(e){return{}}}))}isOperationSupported(t){return e(this,void 0,void 0,(function*(){return window.glue42gd||window.iodesktop?{isSupported:!0}:yield this.bridge.send(jt.operationCheck.name,{operation:t})}))}}class ki{constructor(e,t,i){this.bridge=e,this.base=t,this.shortcutsController=i}checkIsWindowLoaded(e){return this.base.checkIsWindowLoaded(e)}checkIsInSwimlane(t){return e(this,void 0,void 0,(function*(){return(yield this.bridge.send(jt.isWindowInWorkspace.name,{itemId:t})).inWorkspace}))}createWorkspace(t,i){return e(this,void 0,void 0,(function*(){const e=Object.assign({},t,{saveConfig:i});return yield this.base.createWorkspace(e)}))}createEmptyFrame(t){return e(this,void 0,void 0,(function*(){return yield this.base.createEmptyFrame(t)}))}initFrame(t,i){return e(this,void 0,void 0,(function*(){return this.base.initFrame(t,i)}))}restoreWorkspace(t,i){return e(this,void 0,void 0,(function*(){if(!(yield this.getLayoutSummaries()).some((e=>e.name===t)))throw new Error(`This layout: ${t} cannot be restored, because it doesn't exist.`);if(null==i?void 0:i.frameId){if(!(yield this.bridge.send(jt.getAllFramesSummaries.name)).summaries.some((e=>e.id===i.frameId)))throw new Error(`Cannot reuse the frame with id: ${i.frameId}, because there is no frame with that ID found`)}return yield this.base.restoreWorkspace(t,i)}))}add(t,i,o,r){return e(this,void 0,void 0,(function*(){return yield this.base.add(t,i,o,r)}))}processLocalSubscription(e,t){return window.glue42gd||window.iodesktop?this.handleEnterpriseLocalSubscription(e,t):this.handleCoreLocalSubscription(e,t)}processGlobalSubscription(e,t,i){return window.glue42gd||window.iodesktop?this.handleEnterpriseGlobalSubscription(e,t,i):this.handleCoreGlobalSubscription(e,t,i)}getFrame(t){return e(this,void 0,void 0,(function*(){if(t.windowId)return yield this.base.getFrame(t.windowId);if(t.predicate)return(yield this.getFrames(t.predicate))[0];throw new Error(`The provided selector is not valid: ${JSON.stringify(t)}`)}))}getFrames(t){return e(this,void 0,void 0,(function*(){const e=yield this.bridge.send(jt.getAllFramesSummaries.name);return this.base.getFrames(e.summaries,t)}))}getWorkspaceById(e){return this.base.fetchWorkspace(e)}getWorkspaceByWindowId(t){return e(this,void 0,void 0,(function*(){return window.glue42gd||window.iodesktop?this.base.fetchWorkspace(t):(yield this.getWorkspaces((e=>!!e.getWindow((e=>e.id===t)))))[0]}))}transformStreamPayloadToWorkspace(e){return this.base.transformStreamPayloadToWorkspace(e)}getWorkspace(t){return e(this,void 0,void 0,(function*(){let e;return yield this.iterateWorkspaces(((i,o)=>{t(i)&&(e=i,o())})),e}))}getWorkspaces(t){return e(this,void 0,void 0,(function*(){const e=[];return yield this.iterateWorkspaces((i=>{t&&!t(i)||e.push(i)})),e}))}getWorkspacesByFrameId(t){return e(this,void 0,void 0,(function*(){const e=(yield this.getAllWorkspaceSummaries()).filter((e=>e.frameId===t));return yield Promise.all(e.map((e=>this.base.fetchWorkspace(e.id))))}))}getAllWorkspaceSummaries(){return e(this,void 0,void 0,(function*(){const e=yield this.bridge.send(jt.getAllWorkspacesSummaries.name,{});return this.base.getAllWorkspaceSummaries(e)}))}getWindow(t){return e(this,void 0,void 0,(function*(){let e;return yield this.iterateWorkspaces(((i,o)=>{const r=i.getWindow(t);r&&(e=r,o())})),e}))}getParent(t){return e(this,void 0,void 0,(function*(){let e;return yield this.iterateWorkspaces(((i,o)=>{const r=i.getBox(t);r&&(e=r,o())})),e}))}getLayoutSummaries(){return e(this,void 0,void 0,(function*(){return(yield this.bridge.send(jt.getAllLayoutsSummaries.name)).summaries}))}deleteLayout(t){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.deleteLayout.name,{name:t})}))}exportLayout(t){return e(this,void 0,void 0,(function*(){return(yield this.bridge.send(jt.exportAllLayouts.name)).layouts.reduce(((e,i)=>(t&&!t(i)||e.push(i),e)),[])}))}saveLayout(t){return e(this,void 0,void 0,(function*(){return yield this.bridge.send(jt.saveLayout.name,t)}))}importLayouts(t,i){return e(this,void 0,void 0,(function*(){if(window.glue42gd||window.iodesktop)try{yield this.bridge.send(jt.importLayouts.name,{layouts:t,mode:i})}catch(e){yield Promise.all(t.map((e=>this.bridge.send(jt.importLayout.name,{layout:e,mode:i}))))}else yield this.base.importLayouts(t,i)}))}handleOnSaved(e){return this.base.handleOnSaved(e)}handleOnRemoved(e){return this.base.handleOnRemoved(e)}bundleWorkspaceTo(t,i){return e(this,void 0,void 0,(function*(){return yield this.base.bundleWorkspaceTo(t,i)}))}bundleItemTo(t,i){return e(this,void 0,void 0,(function*(){return yield this.base.bundleItemTo(t,i)}))}getWorkspaceContext(e){return this.base.getWorkspaceContext(e)}setWorkspaceContext(e,t){return this.base.setWorkspaceContext(e,t)}updateWorkspaceContext(e,t){return this.base.updateWorkspaceContext(e,t)}subscribeWorkspaceContextUpdated(e,t){return this.base.subscribeWorkspaceContextUpdated(e,t)}restoreItem(t){return e(this,void 0,void 0,(function*(){return yield this.base.restoreItem(t)}))}maximizeItem(t){return e(this,void 0,void 0,(function*(){return yield this.base.maximizeItem(t)}))}focusItem(t){return e(this,void 0,void 0,(function*(){return yield this.base.focusItem(t)}))}changeFrameState(t,i){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.changeFrameState.name,{frameId:t,requestedState:i})}))}getFrameBounds(t){return e(this,void 0,void 0,(function*(){return(yield this.bridge.send(jt.getFrameBounds.name,{itemId:t})).bounds}))}getFrameState(t){return e(this,void 0,void 0,(function*(){return(yield this.bridge.send(jt.getFrameState.name,{itemId:t})).state}))}closeItem(t){return e(this,void 0,void 0,(function*(){return yield this.base.closeItem(t)}))}resizeItem(t,i){return e(this,void 0,void 0,(function*(){return yield this.base.resizeItem(t,i)}))}setMaximizationBoundary(t,i){return e(this,void 0,void 0,(function*(){return yield this.base.setMaximizationBoundary(t,i)}))}showWorkspaceLoadingAnimation(t){return e(this,void 0,void 0,(function*(){return yield this.base.showWorkspaceLoadingAnimation(t)}))}hideWorkspaceLoadingAnimation(t){return e(this,void 0,void 0,(function*(){return yield this.base.hideWorkspaceLoadingAnimation(t)}))}moveFrame(t,i){return e(this,void 0,void 0,(function*(){return yield this.base.moveFrame(t,i)}))}getGDWindow(e){return this.base.getGDWindow(e)}forceLoadWindow(t){return e(this,void 0,void 0,(function*(){const e=yield this.base.forceLoadWindow(t);return yield this.base.notifyWindowAdded(e),e}))}ejectWindow(t){return e(this,void 0,void 0,(function*(){const e=(yield this.base.ejectWindow(t)).windowId;return yield this.base.notifyWindowAdded(e),e}))}moveWindowTo(t,i){return e(this,void 0,void 0,(function*(){return yield this.base.moveWindowTo(t,i)}))}getSnapshot(t,i){return e(this,void 0,void 0,(function*(){return yield this.base.getSnapshot(t,i)}))}setItemTitle(t,i){return e(this,void 0,void 0,(function*(){return yield this.base.setItemTitle(t,i)}))}flatChildren(e){return e.reduce(((e,t)=>(e.push(t),"window"!==t.type&&e.push(...this.flatChildren(t.children)),e)),[])}refreshChildren(e){return this.base.refreshChildren(e)}iterateFindChild(e,t){return this.base.iterateFindChild(e,t)}iterateFilterChildren(e,t){return this.base.iterateFilterChildren(e,t)}hibernateWorkspace(e){return this.base.hibernateWorkspace(e)}resumeWorkspace(e){return this.base.resumeWorkspace(e)}lockWorkspace(e,t){return this.base.lockWorkspace(e,t)}lockWindow(e,t){return this.base.lockWindow(e,t)}lockContainer(e,t,i){return this.base.lockContainer(e,t,i)}pinWorkspace(e,t){return this.base.pinWorkspace(e,t)}unpinWorkspace(e){return this.base.unpinWorkspace(e)}getWorkspaceIcon(e){return this.base.getWorkspaceIcon(e)}setWorkspaceIcon(e,t){return this.base.setWorkspaceIcon(e,t)}getFrameConstraints(t){return e(this,void 0,void 0,(function*(){const e=yield this.getSnapshot(t,"frame");return{minWidth:e.config.minWidth,maxWidth:e.config.maxWidth,minHeight:e.config.minHeight,maxHeight:e.config.maxHeight}}))}registerShortcut(e,t,i){return this.shortcutsController.registerShortcut(e,t,i)}getPlatformFrameId(){return this.base.getPlatformFrameId()}handleCoreLocalSubscription(t,i){return e(this,void 0,void 0,(function*(){if(yield this.bridge.createCoreEventSubscription(),t.scopeId=t.scopeId||i,"window"===t.eventType&&"loaded"===t.action){const i=t.callback,o=t=>e(this,void 0,void 0,(function*(){yield this.base.notifyWindowAdded(t.windowSummary.config.windowId),i(t)}));t.callback=o}return this.bridge.handleCoreSubscription(t)}))}handleEnterpriseLocalSubscription(t,i){if(t.scopeId=t.scopeId||i,"window"===t.eventType&&"loaded"===t.action){const i=t.callback,o=t=>e(this,void 0,void 0,(function*(){yield this.base.notifyWindowAdded(t.windowSummary.config.windowId),i(t)}));t.callback=o}return this.bridge.subscribe(t)}handleCoreGlobalSubscription(t,i,o){return e(this,void 0,void 0,(function*(){yield this.bridge.createCoreEventSubscription();const r={eventType:i,callback:t,action:o,scope:"global"};if("window"===i&&"loaded"===o){const i=i=>e(this,void 0,void 0,(function*(){yield this.base.notifyWindowAdded(i.windowSummary.config.windowId),t(i)}));r.callback=i}return this.bridge.handleCoreSubscription(r)}))}handleEnterpriseGlobalSubscription(t,i,o){const r={eventType:i,callback:t,action:o,scope:"global"};if("window"===i&&"loaded"===o){const i=i=>e(this,void 0,void 0,(function*(){yield this.base.notifyWindowAdded(i.windowSummary.config.windowId),t(i)}));r.callback=i}return this.bridge.subscribe(r)}iterateWorkspaces(t){return e(this,void 0,void 0,(function*(){let e=!1;const i=()=>{e=!0},o=yield this.getAllWorkspaceSummaries();for(const r of o){if(e)return;const o=yield this.base.fetchWorkspace(r.id);t(o,i)}}))}}class bi{constructor(e){this.bridge=e,this._shortcuts=i(),this.bridge.onOperation(((e,t)=>{if(e.operation===Ot.shortcutClicked.name){const t=e.data;this._shortcuts.execute(`${t.frameId}-${t.shortcut}`)}}))}registerShortcut(t,i,o){return e(this,void 0,void 0,(function*(){yield this.bridge.send(jt.registerShortcut.name,{shortcut:t,frameId:i});const e=this._shortcuts.add(`${i}-${t}`,o);return()=>{e(),this.bridge.send(jt.unregisterShortcut.name,{shortcut:t,frameId:i})}}))}}class Wi{constructor(e,t,i,o){this.agm=e,this.windows=t,this.layouts=i,this.contexts=o}get baseController(){return this._baseController||(this._baseController=new vi(this,this.windows,this.contexts,this.layouts)),this._baseController}get controller(){return this._controllerInstance||(this._controllerInstance=new ki(this.bridge,this.baseController,this.shortcutsController)),this._controllerInstance}get shortcutsController(){return this._shortcutsController||(this._shortcutsController=new bi(this.bridge)),this._shortcutsController}get bridge(){return this._bridgeInstance||(this._bridgeInstance=new Gt(this.transport,i())),this._bridgeInstance}get transport(){return this._transportInstance||(this._transportInstance=new Nt(this.agm,i())),this._transportInstance}get privateDataManager(){return this._privateDataManagerInstance||(this._privateDataManagerInstance=new wi),this._privateDataManagerInstance}get parentBase(){return this._parentBaseInstance||(this._parentBaseInstance=new yi(this.privateDataManager)),this._parentBaseInstance}initiate(t){return e(this,void 0,void 0,(function*(){yield this.transport.initiate(t)}))}getModel(e,t){switch(e){case"frame":{const e=new mi(this.privateDataManager),{summary:i}=t,o={summary:i,controller:this.controller};return this.privateDataManager.setFrameData(e,o),e}case"window":{const{id:e,parent:i,frame:o,workspace:r,config:n}=t,s={type:"window",controller:this.controller,config:n,id:e,parent:i,frame:o,workspace:r},a=new ui(this.privateDataManager);return this.privateDataManager.setWindowData(a,s),a}case"row":case"column":case"group":{const{id:i,children:o,parent:r,frame:n,workspace:s,config:a}=t,d="column"===e?new ti(this.parentBase):"row"===e?new Yt(this.parentBase):new ri(this.parentBase),c=this.buildChildren(o,n,s,d),l={id:i,parent:r,frame:n,workspace:s,config:a,type:e,controller:this.controller,children:c};return this.privateDataManager.setParentData(d,l),d}case"workspace":{const{snapshot:e,frame:i}=t,o=new di(this.privateDataManager),r=this.buildChildren(e.children,i,o,o),n={id:e.id,type:"workspace",config:e.config,base:this.parentBase,controller:this.controller,children:r,frame:i,ioc:this};return this.privateDataManager.setWorkspaceData(o,n),o}default:throw new Error(`Unrecognized type: ${e}`)}}getBuilder(e){e.definition=e.definition||{},Array.isArray(e.definition.children)||(e.definition.children=[]);const t=new Kt(this.getBuilder.bind(this));switch(e.type){case"workspace":return new Qt(e.definition,t,this.controller);case"row":case"column":case"group":return e.definition.type=e.type,new Ut(e.definition,t);default:throw new Error(`Unexpected Builder creation error, provided config: ${JSON.stringify(e)}`)}}buildChildren(e,t,i,o){return e.map((e=>{switch(e.type){case"window":return this.getModel("window",{id:e.id,config:e.config,frame:t,workspace:i,parent:o});case"column":case"row":case"group":return this.getModel(e.type,{id:e.id,config:e.config,children:e.children,frame:t,workspace:i,parent:o});default:throw new Error(`Unsupported child type: ${e.type}`)}}))}}const Ii=t=>e(void 0,void 0,void 0,(function*(){const i=new Wi(t.agm,t.windows,t.layouts,t.contexts),o=t.interop.instance.windowId;yield i.initiate(o),t.workspaces=((t,i)=>{const o=i.controller,r=t=>e(void 0,void 0,void 0,(function*(){return H(t,!0),o.getFrames(t)})),n=t=>e(void 0,void 0,void 0,(function*(){return H(t),yield o.processGlobalSubscription((e=>{const o={summary:e.frameSummary},r=i.getModel("frame",o);t(r)}),"frame","opened")}));return{inWorkspace:()=>{const e=t.windows.my().id;if(!e)throw new Error("Cannot get my frame, because my id is undefined.");return o.checkIsInSwimlane(e)},getBuilder:e=>{const t=de.runWithException(e);return i.getBuilder(t)},getMyFrame:()=>e(void 0,void 0,void 0,(function*(){const e=t.windows.my().id;if(!e)throw new Error("Cannot get my frame, because my id is undefined.");if(!(yield o.checkIsInSwimlane(e)))throw new Error("Cannot fetch your frame, because this window is not in a workspace");return o.getFrame({windowId:e})})),getFrame:t=>e(void 0,void 0,void 0,(function*(){return H(t),o.getFrame({predicate:t})})),getAllFrames:r,getAllWorkspacesSummaries:()=>o.getAllWorkspaceSummaries(),getMyWorkspace:()=>e(void 0,void 0,void 0,(function*(){const e=t.windows.my().id;if(!e)throw new Error("Cannot get my workspace, because my id is undefined.");if(!(yield o.checkIsInSwimlane(e)))throw new Error("Cannot fetch your workspace, because this window is not in a workspace");return yield o.getWorkspaceByWindowId(e)})),getWorkspace:t=>e(void 0,void 0,void 0,(function*(){return H(t),(yield o.getWorkspaces(t))[0]})),getWorkspaceById:t=>e(void 0,void 0,void 0,(function*(){return T.runWithException(t),o.getWorkspaceById(t)})),getAllWorkspaces:e=>(H(e,!0),o.getWorkspaces(e)),getWindow:t=>e(void 0,void 0,void 0,(function*(){return H(t),o.getWindow(t)})),getBox:t=>e(void 0,void 0,void 0,(function*(){return H(t),o.getParent(t)})),restoreWorkspace:(t,i)=>e(void 0,void 0,void 0,(function*(){T.runWithException(t);const e=ee.runWithException(i);return o.restoreWorkspace(t,e)})),createWorkspace:(t,i)=>e(void 0,void 0,void 0,(function*(){const e=ie.runWithException(t),r=$.runWithException(i);return o.createWorkspace(e,r)})),createEmptyFrame:t=>e(void 0,void 0,void 0,(function*(){const e=ne.runWithException(t);return o.createEmptyFrame(null!=e?e:{})})),waitForFrame:t=>e(void 0,void 0,void 0,(function*(){return T.runWithException(t),new Promise(((e,i)=>{let o=()=>{};n((i=>{i.id===t&&(e(i),o())})).then((e=>(o=e,r()))).then((i=>{const r=i.find((e=>e.id===t));r&&(e(r),o())})).catch(i)}))})),layouts:{getSummaries:()=>o.getLayoutSummaries(),delete:t=>e(void 0,void 0,void 0,(function*(){return T.runWithException(t),o.deleteLayout(t)})),export:t=>e(void 0,void 0,void 0,(function*(){return H(t,!0),o.exportLayout(t)})),import:(t,i="replace")=>e(void 0,void 0,void 0,(function*(){if(!Array.isArray(t))throw new Error(`The provided layouts argument is not an array: ${JSON.stringify(t)}`);return t.forEach((e=>Ee.runWithException(e))),o.importLayouts(t,i)})),save:t=>e(void 0,void 0,void 0,(function*(){const e=mt.runWithException(t);return o.saveLayout(e)})),onSaved:t=>e(void 0,void 0,void 0,(function*(){return H(t),o.handleOnSaved(t)})),onRemoved:t=>e(void 0,void 0,void 0,(function*(){return H(t),o.handleOnRemoved(t)}))},onFrameOpened:n,onFrameClosed:t=>e(void 0,void 0,void 0,(function*(){return H(t),yield o.processGlobalSubscription((e=>{t({frameId:e.frameSummary.id,frameBounds:e.frameBounds})}),"frame","closed")})),onWorkspaceOpened:t=>e(void 0,void 0,void 0,(function*(){return H(t),yield o.processGlobalSubscription((i=>e(void 0,void 0,void 0,(function*(){const e=yield o.transformStreamPayloadToWorkspace(i);t(e)}))),"workspace","opened")})),onWorkspaceClosed:t=>e(void 0,void 0,void 0,(function*(){return H(t),yield o.processGlobalSubscription((e=>{t({frameId:e.frameSummary.id,workspaceId:e.workspaceSummary.id,frameBounds:e.frameBounds})}),"workspace","closed")})),onWorkspaceHibernated:t=>e(void 0,void 0,void 0,(function*(){return H(t),yield o.processGlobalSubscription((i=>e(void 0,void 0,void 0,(function*(){const e=yield o.transformStreamPayloadToWorkspace(i);t(e)}))),"workspace","hibernated")})),onWorkspaceResumed:t=>e(void 0,void 0,void 0,(function*(){return H(t),yield o.processGlobalSubscription((i=>e(void 0,void 0,void 0,(function*(){const e=yield o.transformStreamPayloadToWorkspace(i);t(e)}))),"workspace","resumed")})),onWindowAdded:t=>e(void 0,void 0,void 0,(function*(){return H(t),yield o.processGlobalSubscription((r=>e(void 0,void 0,void 0,(function*(){const e=yield o.getSnapshot(r.windowSummary.config.workspaceId,"workspace"),n={summary:e.frameSummary},s={frame:i.getModel("frame",n),snapshot:e},a=i.getModel("workspace",s).getBox((e=>e.id===r.windowSummary.parentId)).children.find((e=>"window"===e.type&&e.elementId===r.windowSummary.itemId));t(a)}))),"window","added")})),onWindowLoaded:t=>e(void 0,void 0,void 0,(function*(){return H(t),yield o.processGlobalSubscription((r=>e(void 0,void 0,void 0,(function*(){const e=yield o.getSnapshot(r.windowSummary.config.workspaceId,"workspace"),n={summary:e.frameSummary},s={frame:i.getModel("frame",n),snapshot:e},a=i.getModel("workspace",s).getWindow((e=>e.id&&e.id===r.windowSummary.config.windowId));t(a)}))),"window","loaded")})),onWindowRemoved:t=>e(void 0,void 0,void 0,(function*(){return H(t),yield o.processGlobalSubscription((e=>{const{windowId:i,workspaceId:o,frameId:r}=e.windowSummary.config;t({windowId:i,workspaceId:o,frameId:r})}),"window","removed")})),onWindowMaximized:t=>e(void 0,void 0,void 0,(function*(){return H(t),yield o.processGlobalSubscription((r=>e(void 0,void 0,void 0,(function*(){const e=yield o.getSnapshot(r.windowSummary.config.workspaceId,"workspace"),n={summary:e.frameSummary},s={frame:i.getModel("frame",n),snapshot:e},a=i.getModel("workspace",s).getBox((e=>e.id===r.windowSummary.parentId)).children.find((e=>"window"===e.type&&e.elementId===r.windowSummary.itemId));t(a)}))),"window","maximized")})),onWindowRestored:t=>e(void 0,void 0,void 0,(function*(){return H(t),yield o.processGlobalSubscription((r=>e(void 0,void 0,void 0,(function*(){const e=yield o.getSnapshot(r.windowSummary.config.workspaceId,"workspace"),n={summary:e.frameSummary},s={frame:i.getModel("frame",n),snapshot:e},a=i.getModel("workspace",s).getBox((e=>e.id===r.windowSummary.parentId)).children.find((e=>"window"===e.type&&e.elementId===r.windowSummary.itemId));t(a)}))),"window","restored")})),onWindowSelected:t=>e(void 0,void 0,void 0,(function*(){return H(t),yield o.processGlobalSubscription((r=>e(void 0,void 0,void 0,(function*(){const e=yield o.getSnapshot(r.windowSummary.config.workspaceId,"workspace"),n={summary:e.frameSummary},s={frame:i.getModel("frame",n),snapshot:e},a=i.getModel("workspace",s).getBox((e=>e.id===r.windowSummary.parentId)).children.find((e=>"window"===e.type&&e.elementId===r.windowSummary.itemId));t(a)}))),"window","selected")})),version:"3.2.1"}})(t,i)}));return"undefined"!=typeof window&&(window.IOWorkspaces=Ii),Ii}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).workspaces=e.workspaces||{},e.workspaces.min=t())}(this,(function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function t(e){if(e&&e.errorHandling&&"function"!=typeof e.errorHandling&&"log"!==e.errorHandling&&"silent"!==e.errorHandling&&"throw"!==e.errorHandling)throw new Error('Invalid options passed to createRegistry. Prop errorHandling should be ["log" | "silent" | "throw" | (err) => void], but '+typeof e.errorHandling+" was passed");var t=e&&"function"==typeof e.errorHandling&&e.errorHandling,r={};function o(r,o){var n=r instanceof Error?r:new Error(r);if(t)t(n);else{var i='[ERROR] callback-registry: User callback for key "'+o+'" failed: '+n.stack;if(e)switch(e.errorHandling){case"log":return console.error(i);case"silent":return;case"throw":throw new Error(i)}console.error(i)}}return{add:function(e,t,n){var i=r[e];return i||(i=[],r[e]=i),i.push(t),n&&setTimeout((function(){n.forEach((function(n){var i;if(null===(i=r[e])||void 0===i?void 0:i.includes(t))try{Array.isArray(n)?t.apply(void 0,n):t.apply(void 0,[n])}catch(t){o(t,e)}}))}),0),function(){var o=r[e];o&&(0===(o=o.reduce((function(e,r,o){return r===t&&e.length===o||e.push(r),e}),[])).length?delete r[e]:r[e]=o)}},execute:function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=r[e];if(!i||0===i.length)return[];var a=[];return i.forEach((function(r){try{var n=r.apply(void 0,t);a.push(n)}catch(t){a.push(void 0),o(t,e)}})),a},clear:function(){r={}},clearKey:function(e){r[e]&&delete r[e]}}}t.default=t;var r=e(t),o=function(e){return{ok:!0,result:e}},n=function(e){return{ok:!1,error:e}},i=function(e,t,r){return!1===t.ok?t:!1===r.ok?r:o(e(t.result,r.result))},a=function(e,t){return!0===t.ok?t:n(e(t.error))},s=function(){return s=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},s.apply(this,arguments)};function c(e,t){if(e===t)return!0;if(null===e&&null===t)return!0;if(typeof e!=typeof t)return!1;if("object"==typeof e){if(Array.isArray(e)){if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!c(e[r],t[r]))return!1;return!0}var o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(r=0;r<o.length;r++){if(!t.hasOwnProperty(o[r]))return!1;if(!c(e[o[r]],t[o[r]]))return!1}return!0}}var d=function(e){return Array.isArray(e)},l=function(e){return"object"==typeof e&&null!==e&&!d(e)},h=function(e,t){return"expected "+e+", got "+function(e){switch(typeof e){case"string":return"a string";case"number":return"a number";case"boolean":return"a boolean";case"undefined":return"undefined";case"object":return e instanceof Array?"an array":null===e?"null":"an object";default:return JSON.stringify(e)}}(t)},u=function(e){return e.map((function(e){return"string"==typeof e?"."+e:"["+e+"]"})).join("")},w=function(e,t){var r=t.at,o=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r}(t,["at"]);return s({at:e+(r||"")},o)},p=function(){function e(t){var r=this;this.decode=t,this.run=function(e){return a((function(t){return{kind:"DecoderError",input:e,at:"input"+(t.at||""),message:t.message||""}}),r.decode(e))},this.runPromise=function(e){return!0===(t=r.run(e)).ok?Promise.resolve(t.result):Promise.reject(t.error);var t},this.runWithException=function(e){return function(e){if(!0===e.ok)return e.result;throw e.error}(r.run(e))},this.map=function(t){return new e((function(e){return function(e,t){return!0===t.ok?o(e(t.result)):t}(t,r.decode(e))}))},this.andThen=function(t){return new e((function(e){return function(e,t){return!0===t.ok?e(t.result):t}((function(r){return t(r).decode(e)}),r.decode(e))}))},this.where=function(t,o){return r.andThen((function(r){return t(r)?e.succeed(r):e.fail(o)}))}}return e.string=function(){return new e((function(e){return"string"==typeof e?o(e):n({message:h("a string",e)})}))},e.number=function(){return new e((function(e){return"number"==typeof e?o(e):n({message:h("a number",e)})}))},e.boolean=function(){return new e((function(e){return"boolean"==typeof e?o(e):n({message:h("a boolean",e)})}))},e.constant=function(t){return new e((function(e){return c(e,t)?o(t):n({message:"expected "+JSON.stringify(t)+", got "+JSON.stringify(e)})}))},e.object=function(t){return new e((function(e){if(l(e)&&t){var r={};for(var i in t)if(t.hasOwnProperty(i)){var a=t[i].decode(e[i]);if(!0!==a.ok)return void 0===e[i]?n({message:"the key '"+i+"' is required but was not present"}):n(w("."+i,a.error));void 0!==a.result&&(r[i]=a.result)}return o(r)}return l(e)?o(e):n({message:h("an object",e)})}))},e.array=function(t){return new e((function(e){if(d(e)&&t){return e.reduce((function(e,r,o){return i((function(e,t){return e.concat([t])}),e,function(e,r){return a((function(e){return w("["+r+"]",e)}),t.decode(e))}(r,o))}),o([]))}return d(e)?o(e):n({message:h("an array",e)})}))},e.tuple=function(t){return new e((function(e){if(d(e)){if(e.length!==t.length)return n({message:"expected a tuple of length "+t.length+", got one of length "+e.length});for(var r=[],i=0;i<t.length;i++){var a=t[i].decode(e[i]);if(!a.ok)return n(w("["+i+"]",a.error));r[i]=a.result}return o(r)}return n({message:h("a tuple of length "+t.length,e)})}))},e.union=function(t,r){for(var o=[],n=2;n<arguments.length;n++)o[n-2]=arguments[n];return e.oneOf.apply(e,[t,r].concat(o))},e.intersection=function(t,r){for(var n=[],a=2;a<arguments.length;a++)n[a-2]=arguments[a];return new e((function(e){return[t,r].concat(n).reduce((function(t,r){return i(Object.assign,t,r.decode(e))}),o({}))}))},e.anyJson=function(){return new e((function(e){return o(e)}))},e.unknownJson=function(){return new e((function(e){return o(e)}))},e.dict=function(t){return new e((function(e){if(l(e)){var r={};for(var i in e)if(e.hasOwnProperty(i)){var a=t.decode(e[i]);if(!0!==a.ok)return n(w("."+i,a.error));r[i]=a.result}return o(r)}return n({message:h("an object",e)})}))},e.optional=function(t){return new e((function(e){return null==e?o(void 0):t.decode(e)}))},e.oneOf=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return new e((function(e){for(var r=[],o=0;o<t.length;o++){var i=t[o].decode(e);if(!0===i.ok)return i;r[o]=i.error}var a=r.map((function(e){return"at error"+(e.at||"")+": "+e.message})).join('", "');return n({message:'expected a value matching one of the decoders, got the errors ["'+a+'"]'})}))},e.withDefault=function(t,r){return new e((function(e){return o(function(e,t){return!0===t.ok?t.result:e}(t,r.decode(e)))}))},e.valueAt=function(t,r){return new e((function(e){for(var o=e,i=0;i<t.length;i++){if(void 0===o)return n({at:u(t.slice(0,i+1)),message:"path does not exist"});if("string"==typeof t[i]&&!l(o))return n({at:u(t.slice(0,i+1)),message:h("an object",o)});if("number"==typeof t[i]&&!d(o))return n({at:u(t.slice(0,i+1)),message:h("an array",o)});o=o[t[i]]}return a((function(e){return void 0===o?{at:u(t),message:"path does not exist"}:w(u(t),e)}),r.decode(o))}))},e.succeed=function(t){return new e((function(e){return o(t)}))},e.fail=function(t){return new e((function(e){return n({message:t})}))},e.lazy=function(t){return new e((function(e){return t().decode(e)}))},e}(),m=p.string,g=p.number,f=p.boolean,y=p.anyJson;p.unknownJson;var k=p.constant,b=p.object,W=p.array;p.tuple,p.dict;var I=p.optional,x=p.oneOf;p.union;var S=p.intersection;p.withDefault,p.valueAt,p.succeed,p.fail;var D=p.lazy;const v=m().where((e=>e.length>0),"Expected a non-empty string"),C=g().where((e=>e>=0),"Expected a non-negative number"),E=g().where((e=>e>0),"Expected a positive number"),B=b({inWorkspace:f()}),T=x(k("workspace"),k("row"),k("column"),k("group")),M=x(k("row"),k("column"),k("group")),R=x(k("maximized"),k("minimized"),k("normal")),A=x(k("workspace")),L=(e,t)=>{const r=typeof e;if(t&&"function"!==r&&"undefined"!==r)throw new Error(`Provided argument must be either undefined or of type function, provided: ${r}`);if(!t&&"function"!==r)throw new Error(`Provided argument must be of type function, provided: ${r}`)},P=I(b({saveLayout:I(f())})),F=b({name:v}),z=b({minWidth:I(g()),maxWidth:I(g()),minHeight:I(g()),maxHeight:I(g()),allowExtract:I(f()),allowReorder:I(f()),showCloseButton:I(f())}),H=b({minWidth:I(g()),maxWidth:I(g()),minHeight:I(g()),maxHeight:I(g()),allowExtract:I(f()),allowReorder:I(f()),allowDrop:I(f()),allowDropHeader:I(f()),allowDropLeft:I(f()),allowDropRight:I(f()),allowDropTop:I(f()),allowDropBottom:I(f()),showMaximizeButton:I(f()),showEjectButton:I(f()),showAddWindowButton:I(f())}),$=b({minHeight:I(g()),maxHeight:I(g()),allowDrop:I(f()),allowSplitters:I(f()),isPinned:I(f()),maximizationBoundary:I(f())}),O=b({minWidth:I(g()),maxWidth:I(g()),allowDrop:I(f()),allowSplitters:I(f()),isPinned:I(f()),maximizationBoundary:I(f())}),_=b({type:I(k("window")),appName:I(v),windowId:I(v),context:I(y()),config:I(z)}),j=b({type:k("window"),appName:I(v),windowId:I(v),context:I(y()),config:I(z)}),G=I(b({type:I(M),children:I(D((()=>W(x(_,G))))),config:I(y())})),N=b({type:k("column"),children:I(D((()=>W(x(j,K))))),config:I(O)}),J=b({type:k("row"),children:I(D((()=>W(x(j,K))))),config:I($)}),U=b({type:k("group"),children:I(D((()=>W(x(j,K))))),config:I(H)}),K=x(U,N,J);x(m().where((e=>"maximized"===e.toLowerCase()),"Expected a case insensitive variation of 'maximized'"),m().where((e=>"normal"===e.toLowerCase()),"Expected a case insensitive variation of 'normal'"));const q=b({bounds:I(b({left:I(g()),top:I(g()),width:I(C),height:I(C)})),frameId:I(v)}),Q=x(k("direct"),k("delayed"),k("lazy")),V=I(b({app:I(v),context:I(y()),loadingStrategy:I(Q),title:I(v),reuseWorkspaceId:I(v),frameId:I(v),applicationName:I(v),lockdown:I(f()),activateFrame:I(f()),newFrame:I(x(q,f())),noTabHeader:I(f()),inMemoryLayout:I(f()),icon:I(v),isPinned:I(f()),isSelected:I(f()),positionIndex:I(C),allowSystemHibernation:I(f())})),X=b({name:v,restoreOptions:I(V)}),Y=b({children:I(W(x(_,K))),context:I(y()),config:I(b({title:I(v),position:I(C),isFocused:I(f()),noTabHeader:I(f()),reuseWorkspaceId:I(v),loadingStrategy:I(Q),allowDrop:I(f()),allowDropLeft:I(f()),allowDropTop:I(f()),allowDropRight:I(f()),allowDropBottom:I(f()),allowSystemHibernation:I(f()),allowExtract:I(f()),allowWindowReorder:I(f()),showSaveButton:I(f()),allowWorkspaceTabReorder:I(f()),allowWorkspaceTabExtract:I(f()),showCloseButton:I(f()),allowSplitters:I(f()),showWindowCloseButtons:I(f()),showEjectButtons:I(f()),showAddWindowButtons:I(f()),icon:I(v),isPinned:I(f()),isSelected:I(f()),positionIndex:I(C)})),frame:I(b({activate:I(f()),reuseFrameId:I(v),applicationName:I(v),newFrame:I(x(f(),q))}))}),Z=b({workspaceId:v}),ee=b({name:v,restoreOptions:I(V)}),te=I(b({applicationName:I(m()),frameConfig:I(q),context:I(b()),layoutComponentId:I(v)})),re=b({workspaces:W(x(I(Y),I(ee)))}),oe=b({frameId:v,workspaces:W(x(Y,ee))}),ne=b({type:T,definition:I(x(Y,G))}),ie=S(Y,b({saveConfig:I(b({saveLayout:I(f())}))})),ae=b({itemId:v}),se=b({context:I(b())}),ce=b({id:v,isFocused:I(f()),isInitialized:I(f()),initializationContext:I(se)});b({type:M,id:v,frameId:v,workspaceId:v,positionIndex:g()});const de=x(k("frame"),k("workspace"),k("container"),k("window")),le=b({type:de,branch:v}),he=x(k("opened"),k("closing"),k("closed"),k("focus"),k("added"),k("loaded"),k("removed"),k("childrenUpdate"),k("containerChange"),k("maximized"),k("restored"),k("minimized"),k("normal"),k("selected"),k("lock-configuration-changed"),k("hibernated"),k("resumed")),ue=b({frameId:v,title:v,positionIndex:C,name:v,layoutName:I(v),isHibernated:I(f()),isSelected:I(f()),allowDrop:I(f()),allowSystemHibernation:I(f()),allowExtract:I(f()),allowWindowReorder:I(f()),allowSplitters:I(f()),showCloseButton:I(f()),showSaveButton:I(f()),allowWorkspaceTabReorder:I(f()),allowWorkspaceTabExtract:I(f()),allowDropLeft:I(f()),allowDropTop:I(f()),allowDropRight:I(f()),allowDropBottom:I(f()),minWidth:I(g()),maxWidth:I(g()),minHeight:I(g()),maxHeight:I(g()),showAddWindowButtons:I(f()),showEjectButtons:I(f()),showWindowCloseButtons:I(f()),widthInPx:I(g()),heightInPx:I(g()),isPinned:I(f())}),we=b({frameId:v,workspaceId:v,positionIndex:g(),minWidth:I(g()),maxWidth:I(g()),minHeight:I(g()),maxHeight:I(g())}),pe=y(),me=S(we,b({windowId:I(v),isMaximized:I(f()),isFocused:f(),isSelected:I(f()),title:I(m()),appName:I(v),allowExtract:I(f()),allowReorder:I(f()),showCloseButton:I(f()),minWidth:I(g()),minHeight:I(g()),maxWidth:I(g()),maxHeight:I(g()),widthInPx:I(g()),heightInPx:I(g()),context:I(y())})),ge=b({id:I(v),config:pe,children:I(D((()=>W(ye)))),type:x(k("row"),k("column"),k("group"))}),fe=b({id:I(v),config:me,type:k("window")}),ye=x(fe,ge),ke=b({id:v,config:ue,children:W(ye),frameSummary:ce,context:I(y())}),be=b({type:k("window"),config:b({appName:v,windowId:I(v),context:I(y()),url:I(v),title:I(m()),allowExtract:I(f()),allowReorder:I(f()),showCloseButton:I(f()),minWidth:I(g()),minHeight:I(g()),maxWidth:I(g()),maxHeight:I(g()),isMaximized:I(f())})}),We=b({type:k("group"),config:y(),children:W(x(be))}),Ie=b({type:k("column"),config:y(),children:W(x(We,be,D((()=>Ie)),D((()=>xe))))}),xe=b({type:k("row"),config:y(),children:W(x(Ie,We,be,D((()=>xe))))}),Se=b({name:v,type:k("Workspace"),metadata:I(y()),components:W(b({type:k("Workspace"),application:I(m()),state:b({config:y(),context:y(),children:W(x(xe,Ie,We,be))})}))}),De=b({layout:Se,mode:x(k("replace"),k("merge"))}),ve=b({layouts:W(Se),mode:x(k("replace"),k("merge"))}),Ce=b({layouts:W(Se)}),Ee=b({id:v,isFocused:I(f()),isInitialized:I(f()),initializationContext:I(se)}),Be=b({summaries:W(Ee)}),Te=b({id:v,config:ue}),Me=b({summaries:W(Te)}),Re=b({id:v,config:y(),workspaces:W(ke)}),Ae=b({name:v,applicationName:I(m())}),Le=b({summaries:W(Ae)}),Pe=b({windowId:v}),Fe=y(),ze=b({state:R}),He=b({top:g(),left:g(),width:C,height:C}),$e=b({bounds:He}),Oe=b({icon:I(v)}),_e=b({id:I(v)}),je=b({isSupported:f()}),Ge=b({width:I(E),height:I(E),relative:I(f())}),Ne=b({top:I(g()),left:I(g()),relative:I(f())}),Je=b({itemId:v}),Ue=b({itemId:v,excludeIds:I(f())}),Ke=b({frameId:v,requestedState:R}),qe=b({itemId:v,title:v}),Qe=b({itemId:v,containerId:v}),Ve=S(Je,Ge),Xe=b({itemId:v,enabled:f()}),Ye=S(Je,Ne);b({id:v,type:M});const Ze=b({definition:_,parentId:v,parentType:T}),et=b({definition:K,parentId:v,parentType:T}),tt=b({itemId:v,windowId:I(v)}),rt=b({live:f()}),ot=b({type:x(k("row"),k("column")),workspaceId:v}),nt=b({type:x(k("row"),k("column")),itemId:v}),it=b({itemId:v,config:pe}),at=b({frameSummary:ce,frameBounds:I(He)}),st=b({workspaceSummary:Te,frameSummary:ce,workspaceSnapshot:I(ke),frameBounds:I(He)}),ct=b({containerSummary:it}),dt=b({windowSummary:b({itemId:v,parentId:v,config:me})}),lt=b({name:v,workspaceId:v,saveContext:I(f()),metadata:I(b())}),ht=b({allowDrop:I(f()),allowDropLeft:I(f()),allowDropTop:I(f()),allowDropRight:I(f()),allowDropBottom:I(f()),allowSystemHibernation:I(f()),allowExtract:I(f()),allowWindowReorder:I(f()),allowSplitters:I(f()),showCloseButton:I(f()),showSaveButton:I(f()),allowWorkspaceTabReorder:I(f()),allowWorkspaceTabExtract:I(f()),showWindowCloseButtons:I(f()),showAddWindowButtons:I(f()),showEjectButtons:I(f())}),ut=b({workspaceId:v,config:I(ht)}),wt=b({allowExtract:I(f()),allowReorder:I(f()),showCloseButton:I(f())}),pt=b({width:I(C),height:I(C)}),mt=b({windowPlacementId:v,config:I(wt)}),gt=b({allowDrop:I(f()),allowSplitters:I(f())}),ft=b({allowDrop:I(f()),allowSplitters:I(f())}),yt=b({allowExtract:I(f()),allowReorder:I(f()),allowDrop:I(f()),allowDropLeft:I(f()),allowDropRight:I(f()),allowDropTop:I(f()),allowDropBottom:I(f()),allowDropHeader:I(f()),showMaximizeButton:I(f()),showEjectButton:I(f()),showAddWindowButton:I(f())}),kt=b({itemId:v,type:k("row"),config:I(gt)}),bt=b({itemId:v,type:k("column"),config:I(ft)}),Wt=b({itemId:v,type:k("group"),config:I(yt)}),It=x(kt,bt,Wt),xt=b({workspaceId:v,icon:I(v)}),St=b({workspaceId:v,icon:I(v)}),Dt=I(b({icon:I(v)})),vt=b({shortcut:v,frameId:v}),Ct=b({shortcut:v,frameId:v}),Et=b({enabled:f()}),Bt=b({itemId:v,type:A}),Tt=b({operation:v}),Mt="T42.Web.Platform.Control",Rt="T42.Web.Platform.WSP.Stream",At={control:{name:"T42.Workspaces.Control",isStream:!1},frameStream:{name:"T42.Workspaces.Stream.Frame",isStream:!0},workspaceStream:{name:"T42.Workspaces.Stream.Workspace",isStream:!0},containerStream:{name:"T42.Workspaces.Stream.Container",isStream:!0},windowStream:{name:"T42.Workspaces.Stream.Window",isStream:!0}},Lt={control:{name:"T42.Workspaces.Client.Control",isStream:!1}},Pt={frame:{name:"T42.Workspaces.Stream.Frame",payloadDecoder:at},workspace:{name:"T42.Workspaces.Stream.Workspace",payloadDecoder:st},container:{name:"T42.Workspaces.Stream.Container",payloadDecoder:ct},window:{name:"T42.Workspaces.Stream.Window",payloadDecoder:dt}},Ft={shortcutClicked:{name:"shortcutClicked",argsDecoder:Ct,resultDecoder:Fe}},zt={ping:{name:"ping",resultDecoder:rt},isWindowInWorkspace:{name:"isWindowInWorkspace",argsDecoder:Je,resultDecoder:B},createWorkspace:{name:"createWorkspace",resultDecoder:ke,argsDecoder:ie},createFrame:{name:"createFrame",resultDecoder:Ee,argsDecoder:te},initFrame:{name:"initFrame",resultDecoder:Fe,argsDecoder:oe},getAllFramesSummaries:{name:"getAllFramesSummaries",resultDecoder:Be},getFrameSummary:{name:"getFrameSummary",resultDecoder:ce,argsDecoder:ae},getAllWorkspacesSummaries:{name:"getAllWorkspacesSummaries",resultDecoder:Me},getWorkspaceSnapshot:{name:"getWorkspaceSnapshot",resultDecoder:ke,argsDecoder:Je},getAllLayoutsSummaries:{name:"getAllLayoutsSummaries",resultDecoder:Le},openWorkspace:{name:"openWorkspace",argsDecoder:X,resultDecoder:ke},deleteLayout:{name:"deleteLayout",resultDecoder:Fe,argsDecoder:F},saveLayout:{name:"saveLayout",resultDecoder:Se,argsDecoder:lt},importLayout:{name:"importLayout",resultDecoder:Fe,argsDecoder:De},importLayouts:{name:"importLayouts",resultDecoder:Fe,argsDecoder:ve},exportAllLayouts:{name:"exportAllLayouts",resultDecoder:Ce},restoreItem:{name:"restoreItem",argsDecoder:Je,resultDecoder:Fe},maximizeItem:{name:"maximizeItem",argsDecoder:Je,resultDecoder:Fe},focusItem:{name:"focusItem",argsDecoder:Je,resultDecoder:Fe},closeItem:{name:"closeItem",argsDecoder:Je,resultDecoder:Fe},resizeItem:{name:"resizeItem",argsDecoder:Ve,resultDecoder:Fe},setMaximizationBoundary:{name:"setMaximizationBoundary",argsDecoder:Xe,resultDecoder:Fe},changeFrameState:{name:"changeFrameState",argsDecoder:Ke,resultDecoder:Fe},getFrameState:{name:"getFrameState",argsDecoder:Je,resultDecoder:ze},getFrameBounds:{name:"getFrameBounds",argsDecoder:Je,resultDecoder:$e},moveFrame:{name:"moveFrame",argsDecoder:Ye,resultDecoder:Fe},getFrameSnapshot:{name:"getFrameSnapshot",argsDecoder:Ue,resultDecoder:Re},forceLoadWindow:{name:"forceLoadWindow",argsDecoder:Je,resultDecoder:Pe},ejectWindow:{name:"ejectWindow",argsDecoder:Je,resultDecoder:Pe},setItemTitle:{name:"setItemTitle",argsDecoder:qe,resultDecoder:Fe},moveWindowTo:{name:"moveWindowTo",argsDecoder:Qe,resultDecoder:Fe},addWindow:{name:"addWindow",argsDecoder:Ze,resultDecoder:tt},addContainer:{name:"addContainer",argsDecoder:et,resultDecoder:tt},bundleWorkspace:{name:"bundleWorkspace",argsDecoder:ot,resultDecoder:Fe},bundleItem:{name:"bundleItem",argsDecoder:nt,resultDecoder:Fe},hibernateWorkspace:{name:"hibernateWorkspace",argsDecoder:Z,resultDecoder:Fe},resumeWorkspace:{name:"resumeWorkspace",argsDecoder:Z,resultDecoder:Fe},lockWorkspace:{name:"lockWorkspace",argsDecoder:ut,resultDecoder:Fe},lockWindow:{name:"lockWindow",argsDecoder:mt,resultDecoder:Fe},lockContainer:{name:"lockContainer",argsDecoder:It,resultDecoder:Fe},pinWorkspace:{name:"pinWorkspace",argsDecoder:xt,resultDecoder:Fe},unpinWorkspace:{name:"unpinWorkspace",argsDecoder:Z,resultDecoder:Fe},getWorkspaceIcon:{name:"getWorkspaceIcon",argsDecoder:Z,resultDecoder:Oe},setWorkspaceIcon:{name:"setWorkspaceIcon",argsDecoder:St,resultDecoder:Fe},registerShortcut:{name:"registerShortcut",argsDecoder:vt,resultDecoder:Fe},unregisterShortcut:{name:"unregisterShortcut",argsDecoder:vt,resultDecoder:Fe},showLoadingAnimation:{name:"showLoadingAnimation",argsDecoder:Bt,resultDecoder:Fe},hideLoadingAnimation:{name:"hideLoadingAnimation",argsDecoder:Bt,resultDecoder:Fe},getPlatformFrameId:{name:"getPlatformFrameId",resultDecoder:_e},operationCheck:{name:"operationCheck",argsDecoder:Tt,resultDecoder:je}};class Ht{resolve;reject;promise;constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}class $t{transport;registry;activeSubscriptions=[];pendingSubScriptions=[];constructor(e,t){this.transport=e,this.registry=t}async createCoreEventSubscription(){await this.transport.coreSubscriptionReady(this.handleCoreEvent.bind(this))}handleCoreSubscription(e){const t=`${e.eventType}-${e.action}`,r=e.scope,o=e.scopeId;return this.registry.add(t,(t=>{const n={type:r,id:o},i={frame:t.frameSummary?.id||t.windowSummary?.config.frameId,workspace:t.workspaceSummary?.id||t.windowSummary?.config.workspaceId,container:t.containerSummary?.itemId,window:t.windowSummary?.itemId};this.checkScopeMatch(n,i)&&e.callback(t)}))}async send(e,t){const r=Object.values(zt).find((t=>t.name===e));if(!r)throw new Error(`Cannot find definition for operation name: ${e}`);if(r.argsDecoder)try{r.argsDecoder.runWithException(t)}catch(t){throw new Error(`Unexpected internal outgoing validation error: ${t.message}, for input: ${JSON.stringify(t.input)}, for operation ${e}`)}try{const e=await this.transport.transmitControl(r.name,t);return r.resultDecoder.runWithException(e),e}catch(t){if(t.kind)throw new Error(`Unexpected internal incoming validation error: ${t.message}, for input: ${JSON.stringify(t.input)}, for operation ${e}`);throw new Error(t.message)}}async subscribe(e){const t=this.getPendingSubscription(e);t&&await t.promise;let r=this.getActiveSubscription(e);const o=this.getRegistryKey(e);if(!r){const t=new Ht,o={streamType:e.eventType,level:e.scope,levelId:e.scopeId,promise:t.promise};this.pendingSubScriptions.push(o);try{const o=Pt[e.eventType],n=await this.transport.subscribe(o.name,this.getBranchKey(e),e.eventType);n.onData((e=>{const t=e.data,r=le.run(e.requestArguments),o=he.run(t.action);if(!r.ok||!o.ok)return;const n=r.result.type,i=`${n}-${r.result.branch}-${o.result}`,a=Pt[n].payloadDecoder.run(t.payload);a.ok&&this.registry.execute(i,a.result)})),r={streamType:e.eventType,level:e.scope,levelId:e.scopeId,callbacksCount:0,gdSub:n},this.activeSubscriptions.push(r),t.resolve()}catch(e){throw t.reject(e),e}finally{this.removePendingSubscription(o)}}const n=this.registry.add(o,e.callback);return++r.callbacksCount,()=>{n(),--r.callbacksCount,0===r.callbacksCount&&(r.gdSub.close(),this.activeSubscriptions.splice(this.activeSubscriptions.indexOf(r),1))}}onOperation(e){return this.transport.onInternalMethodInvoked("control",((t,r)=>{const o=t.operation,n=t.data,i=Object.values(Ft).find((e=>e.name===o));if(!i)throw new Error(`Cannot find definition for operation name: ${o}`);if(i.argsDecoder)try{i.argsDecoder.runWithException(n)}catch(e){throw new Error(`Unexpected internal outgoing validation error: ${e.message}, for input: ${JSON.stringify(e.input)}, for operation ${o}`)}e(t,r)}))}checkScopeMatch(e,t){return"global"===e.type||("frame"===e.type&&e.id===t.frame||("workspace"===e.type&&e.id===t.workspace||("container"===e.type&&e.id===t.container||"window"===e.type&&e.id===t.window)))}handleCoreEvent(e){const t=e.data;try{const e=he.runWithException(t.action),r=de.runWithException(t.type),o=Pt[r].payloadDecoder.runWithException(t.payload),n=`${r}-${e}`;this.registry.execute(n,o)}catch(e){console.warn(`Cannot handle event with data ${JSON.stringify(t)}, because of validation error: ${e.message}`)}}getBranchKey(e){return"global"===e.scope?e.scope:`${e.scope}_${e.scopeId}`}getRegistryKey(e){return`${e.eventType}-${this.getBranchKey(e)}-${e.action}`}getActiveSubscription(e){return this.activeSubscriptions.find((t=>t.streamType===e.eventType&&t.level===e.scope&&t.levelId===e.scopeId))}getPendingSubscription(e){return this.pendingSubScriptions.find((t=>t.streamType===e.eventType&&t.level===e.scope&&t.levelId===e.scopeId))}removePendingSubscription(e){const t=this.pendingSubScriptions.indexOf(e);t>=0&&this.pendingSubScriptions.splice(t,1)}}class Ot{agm;registry;defaultTransportTimeout=3e4;coreEventMethodInitiated=!1;corePlatformSubPromise;constructor(e,t){this.agm=e,this.registry=t}async initiate(e){if(window.glue42gd||window.iodesktop)return await Promise.all(Object.values(At).map((e=>this.verifyMethodLive(e.name)))),void await Promise.all(Object.keys(Lt).map((e=>this.registerMethod(e))));const t=(window.glue42core||window.iobrowser).communicationId;await Promise.all([this.verifyMethodLive(Mt,t),this.verifyMethodLive(Rt,t)]),await this.transmitControl("frameHello",{windowId:e})}coreSubscriptionReady(e){return this.coreEventMethodInitiated||this.subscribePlatform(e),this.corePlatformSubPromise}subscribePlatform(e){this.coreEventMethodInitiated=!0;const t=(window.glue42core||window.iobrowser).communicationId;this.corePlatformSubPromise=this.agm.subscribe(Rt,t?{target:{instance:t}}:void 0),this.corePlatformSubPromise.then((t=>{t.onData((t=>e(t.data)))}))}async subscribe(e,t,r){const o={branch:t,type:r};let n;try{n=await this.agm.subscribe(e,{arguments:o})}catch(r){const o=`Internal subscription error! Error details: stream - ${e}, branch: ${t}. Internal message: ${r.message}`;throw new Error(o)}return n}async transmitControl(e,t){const r=window.glue42gd||window.iodesktop,o=window.glue42core||window.iobrowser,n=r?{operation:e,operationArguments:t}:{operation:e,domain:"workspaces",data:t},i=r?At.control.name:Mt,a=r?void 0:o.communicationId;let s;const c=`Internal Workspaces Communication Error. Attempted operation: ${JSON.stringify(n)}. `;try{if(s=await this.agm.invoke(i,n,a?{instance:a}:"best",{methodResponseTimeoutMs:this.defaultTransportTimeout}),!s)throw new Error("Received unsupported result from GD - empty result");if(!Array.isArray(s.all_return_values)||0===s.all_return_values.length)throw new Error("Received unsupported result from GD - empty values collection")}catch(e){if(e&&e.all_errors&&e.all_errors.length){const t=e.all_errors[0].message;throw new Error(`${c} -> Inner message: ${t}`)}throw new Error(`${c} -> Inner message: ${e.message}`)}return s.all_return_values[0].returned}onInternalMethodInvoked(e,t){return this.registry.add(e,t)}verifyMethodLive(e,t){return r=()=>new Promise((r=>{if(this.agm.methods().some((r=>{const o=r.name===e,n=!t||r.getServers().some((e=>e.instance===t));return o&&n})))return void r();const o=this.agm.serverMethodAdded((n=>{const i=n.method,a=n.server,s=!t||a.instance===t;i.name===e&&s&&(o(),r())}))})),o=15e3,n="Timeout waiting for the Workspaces communication channels",new Promise(((e,t)=>{let i=!0;const a=setTimeout((()=>{i&&(i=!1,t(n||`Promise timeout hit: ${o}`))}),o);r().then((t=>{i&&(i=!1,clearTimeout(a),e(t))})).catch((e=>{i&&(i=!1,clearTimeout(a),t(e))}))}));var r,o,n}registerMethod(e){const t=Lt[e];return this.agm.register(t.name,((t,r)=>{this.registry.execute(e,t,r)}))}}const _t=new WeakMap;class jt{constructor(e,t){const r=t.wrapChildren(e.children);delete e.children,_t.set(this,{base:t,children:r,definition:e})}get type(){return _t.get(this).definition.type}addColumn(e){return _t.get(this).base.add("column",_t.get(this).children,e)}addRow(e){return _t.get(this).base.add("row",_t.get(this).children,e)}addGroup(e){return _t.get(this).base.add("group",_t.get(this).children,e)}addWindow(e){return _t.get(this).base.addWindow(_t.get(this).children,e),this}serialize(){const e=_t.get(this).definition;return e.children=_t.get(this).base.serializeChildren(_t.get(this).children),e}}class Gt{getBuilder;constructor(e){this.getBuilder=e}wrapChildren(e){return e.map((e=>"window"===e.type?e:this.getBuilder({type:e.type,definition:e})))}add(e,t,r){const o=G.runWithException(r),n=this.getBuilder({type:e,definition:o});return t.push(n),n}addWindow(e,t){const r=_.runWithException(t);r.type="window",e.push(r)}serializeChildren(e){return e.map((e=>e instanceof jt?e.serialize():e))}}const Nt=new WeakMap;class Jt{constructor(e,t,r){const o=t.wrapChildren(e.children);delete e.children,Nt.set(this,{base:t,children:o,definition:e,controller:r})}addColumn(e){const t=Nt.get(this).children;if(!t.every((e=>e instanceof jt&&"column"===e.type)))throw new Error("Cannot add a column to this workspace, because there are already children of another type");return Nt.get(this).base.add("column",t,e)}addRow(e){const t=Nt.get(this).children;if(!t.every((e=>e instanceof jt&&"row"===e.type)))throw new Error("Cannot add a row to this workspace, because there are already children of another type");return Nt.get(this).base.add("row",t,e)}addGroup(e){const t=Nt.get(this).children;if(0!==t.length)throw new Error("Cannot add a group to this workspace, because there are already defined children.");return Nt.get(this).base.add("group",t,e)}addWindow(e){const t=Nt.get(this).children;if(0!==t.length)throw new Error("Cannot add a window to this workspace, because there are already defined children.");return Nt.get(this).base.addWindow(t,e),this}getChildAt(e){C.runWithException(e);return Nt.get(this).children[e]}async create(e){const t=P.runWithException(e),r=Nt.get(this).definition;r.children=Nt.get(this).base.serializeChildren(Nt.get(this).children);return Nt.get(this).controller.createWorkspace(r,t)}}const Ut=new WeakMap,Kt=e=>Ut.get(e).base;class qt{constructor(e){Ut.set(this,{base:e})}get type(){return"row"}get id(){return Kt(this).getId(this)}get frameId(){return Kt(this).getFrameId(this)}get workspaceId(){return Kt(this).getWorkspaceId(this)}get positionIndex(){return Kt(this).getPositionIndex(this)}get children(){return Kt(this).getAllChildren(this)}get parent(){return Kt(this).getMyParent(this)}get frame(){return Kt(this).getMyFrame(this)}get workspace(){return Kt(this).getMyWorkspace(this)}get allowDrop(){return Kt(this).getAllowDrop(this)}get allowSplitters(){return Kt(this).getAllowSplitters(this)}get minWidth(){return Kt(this).getMinWidth(this)}get minHeight(){return Kt(this).getMinHeight(this)}get maxWidth(){return Kt(this).getMaxWidth(this)}get maxHeight(){return Kt(this).getMaxHeight(this)}get width(){return Kt(this).getWidthInPx(this)}get height(){return Kt(this).getHeightInPx(this)}get isPinned(){return Kt(this).getIsPinned(this)}get isMaximized(){return Kt(this).getIsMaximized(this)}get maximizationBoundary(){return Kt(this).getMaximizationBoundary(this)}addWindow(e){return Kt(this).addWindow(this,e,"row")}async addGroup(e){if(e?.type&&"group"!==e.type)throw new Error(`Expected a group definition, but received ${e.type}`);return Kt(this).addParent(this,"group","row",e)}async addColumn(e){if(e?.type&&"column"!==e.type)throw new Error(`Expected a column definition, but received ${e.type}`);return Kt(this).addParent(this,"column","row",e)}async addRow(){throw new Error("Adding rows as row children is not supported")}removeChild(e){return Kt(this).removeChild(this,e)}maximize(){return Kt(this).maximize(this)}restore(){return Kt(this).restore(this)}close(){return Kt(this).close(this)}lock(e){let t;if("function"==typeof e){t=e({allowDrop:this.allowDrop,allowSplitters:this.allowSplitters})}else t=e;const r=void 0===t?void 0:gt.runWithException(t);return Kt(this).lockContainer(this,r)}async setHeight(e){return C.runWithException(e),Kt(this).setHeight(this,e)}async onLockConfigurationChanged(e){L(e);const t={callback:async()=>{await this.workspace.refreshReference(),e({allowDrop:this.allowDrop,allowSplitters:this.allowSplitters})},action:"lock-configuration-changed",eventType:"container",scope:"container"};return await Kt(this).processLocalSubscription(this,t)}async setMaximizationBoundary(e){const t=Et.runWithException(e);return Kt(this).setMaximizationBoundary(this,t)}}const Qt=new WeakMap,Vt=e=>Qt.get(e).base;class Xt{constructor(e){Qt.set(this,{base:e})}get type(){return"column"}get id(){return Vt(this).getId(this)}get frameId(){return Vt(this).getFrameId(this)}get workspaceId(){return Vt(this).getWorkspaceId(this)}get positionIndex(){return Vt(this).getPositionIndex(this)}get children(){return Vt(this).getAllChildren(this)}get parent(){return Vt(this).getMyParent(this)}get frame(){return Vt(this).getMyFrame(this)}get workspace(){return Vt(this).getMyWorkspace(this)}get allowDrop(){return Vt(this).getAllowDrop(this)}get allowSplitters(){return Vt(this).getAllowSplitters(this)}get minWidth(){return Vt(this).getMinWidth(this)}get minHeight(){return Vt(this).getMinHeight(this)}get maxWidth(){return Vt(this).getMaxWidth(this)}get maxHeight(){return Vt(this).getMaxHeight(this)}get width(){return Vt(this).getWidthInPx(this)}get height(){return Vt(this).getHeightInPx(this)}get isPinned(){return Vt(this).getIsPinned(this)}get isMaximized(){return Vt(this).getIsMaximized(this)}get maximizationBoundary(){return Vt(this).getMaximizationBoundary(this)}addWindow(e){return Vt(this).addWindow(this,e,"column")}async addGroup(e){if(e?.type&&"group"!==e.type)throw new Error(`Expected a group definition, but received ${e.type}`);return Vt(this).addParent(this,"group","column",e)}async addColumn(){throw new Error("Adding columns as column children is not supported")}async addRow(e){if(e?.type&&"row"!==e.type)throw new Error(`Expected a row definition, but received ${e.type}`);return Vt(this).addParent(this,"row","column",e)}removeChild(e){return Vt(this).removeChild(this,e)}maximize(){return Vt(this).maximize(this)}restore(){return Vt(this).restore(this)}close(){return Vt(this).close(this)}lock(e){let t;if("function"==typeof e){t=e({allowDrop:this.allowDrop,allowSplitters:this.allowSplitters})}else t=e;const r=void 0===t?void 0:ft.runWithException(t);return Vt(this).lockContainer(this,r)}async setWidth(e){return C.runWithException(e),Vt(this).setWidth(this,e)}async onLockConfigurationChanged(e){L(e);const t={callback:async()=>{await this.workspace.refreshReference(),e({allowDrop:this.allowDrop,allowSplitters:this.allowSplitters})},action:"lock-configuration-changed",eventType:"container",scope:"container"};return await Vt(this).processLocalSubscription(this,t)}async setMaximizationBoundary(e){const t=Et.runWithException(e);return Vt(this).setMaximizationBoundary(this,t)}}const Yt=new WeakMap,Zt=e=>Yt.get(e).base;class er{constructor(e){Yt.set(this,{base:e})}get type(){return"group"}get id(){return Zt(this).getId(this)}get frameId(){return Zt(this).getFrameId(this)}get workspaceId(){return Zt(this).getWorkspaceId(this)}get positionIndex(){return Zt(this).getPositionIndex(this)}get children(){return Zt(this).getAllChildren(this)}get parent(){return Zt(this).getMyParent(this)}get frame(){return Zt(this).getMyFrame(this)}get workspace(){return Zt(this).getMyWorkspace(this)}get allowExtract(){return Zt(this).getAllowExtract(this)}get allowReorder(){return Zt(this).getAllowReorder(this)}get allowDropLeft(){return Zt(this).getAllowDropLeft(this)}get allowDropRight(){return Zt(this).getAllowDropRight(this)}get allowDropTop(){return Zt(this).getAllowDropTop(this)}get allowDropBottom(){return Zt(this).getAllowDropBottom(this)}get allowDropHeader(){return Zt(this).getAllowDropHeader(this)}get allowDrop(){return Zt(this).getAllowDrop(this)}get showMaximizeButton(){return Zt(this).getShowMaximizeButton(this)}get showEjectButton(){return Zt(this).getShowEjectButton(this)}get showAddWindowButton(){return Zt(this).getShowAddWindowButton(this)}get minWidth(){return Zt(this).getMinWidth(this)}get minHeight(){return Zt(this).getMinHeight(this)}get maxWidth(){return Zt(this).getMaxWidth(this)}get maxHeight(){return Zt(this).getMaxHeight(this)}get width(){return Zt(this).getWidthInPx(this)}get height(){return Zt(this).getHeightInPx(this)}get isMaximized(){return Zt(this).getIsMaximized(this)}addWindow(e){return Zt(this).addWindow(this,e,"group")}async addGroup(){throw new Error("Adding groups as group child is not supported")}async addColumn(){throw new Error("Adding columns as group child is not supported")}async addRow(){throw new Error("Adding rows as group child is not supported")}removeChild(e){return Zt(this).removeChild(this,e)}maximize(){return Zt(this).maximize(this)}restore(){return Zt(this).restore(this)}close(){return Zt(this).close(this)}lock(e){let t;if("function"==typeof e){t=e({allowDrop:this.allowDrop,allowDropHeader:this.allowDropHeader,allowDropLeft:this.allowDropLeft,allowDropRight:this.allowDropRight,allowDropTop:this.allowDropTop,allowDropBottom:this.allowDropBottom,allowExtract:this.allowExtract,allowReorder:this.allowReorder,showAddWindowButton:this.showAddWindowButton,showEjectButton:this.showEjectButton,showMaximizeButton:this.showMaximizeButton})}else t=e;const r=void 0===t?void 0:yt.runWithException(t);return Zt(this).lockContainer(this,r)}async setSize(e){const t=pt.runWithException(e);if(!t.width&&!t.height)throw new Error("Expected either width or height to be passed.");return Zt(this).setSize(this,e.width,e.height)}async bundleToRow(){await Zt(this).bundleTo(this,"row"),await this.workspace.refreshReference()}async bundleToColumn(){await Zt(this).bundleTo(this,"column"),await this.workspace.refreshReference()}async onLockConfigurationChanged(e){L(e);const t={callback:async()=>{await this.workspace.refreshReference(),e({allowDrop:this.allowDrop,allowDropHeader:this.allowDropHeader,allowDropLeft:this.allowDropLeft,allowDropTop:this.allowDropTop,allowDropRight:this.allowDropRight,allowDropBottom:this.allowDropBottom,allowExtract:this.allowExtract,allowReorder:this.allowReorder,showAddWindowButton:this.showAddWindowButton,showEjectButton:this.showEjectButton,showMaximizeButton:this.showMaximizeButton})},action:"lock-configuration-changed",eventType:"container",scope:"container"};return await Zt(this).processLocalSubscription(this,t)}}const tr=new WeakMap,rr=e=>tr.get(e).manager.getWorkspaceData(e),or=e=>tr.get(e).manager;class nr{constructor(e){tr.set(this,{manager:e})}get id(){return rr(this).id}get frameId(){return rr(this).config.frameId}get positionIndex(){return rr(this).config.positionIndex}get title(){return rr(this).config.title}get layoutName(){return rr(this).config.layoutName}get isHibernated(){return rr(this).config.isHibernated}get isSelected(){return rr(this).config.isSelected}get children(){return rr(this).children}get frame(){return rr(this).frame}get allowSplitters(){return rr(this).config.allowSplitters}get allowSystemHibernation(){return rr(this).config.allowSystemHibernation}get allowDrop(){return rr(this).config.allowDrop}get allowDropLeft(){return rr(this).config.allowDropLeft}get allowDropTop(){return rr(this).config.allowDropTop}get allowDropRight(){return rr(this).config.allowDropRight}get allowDropBottom(){return rr(this).config.allowDropBottom}get allowExtract(){return rr(this).config.allowExtract}get allowWindowReorder(){return rr(this).config.allowWindowReorder}get showCloseButton(){return rr(this).config.showCloseButton}get showSaveButton(){return rr(this).config.showSaveButton}get allowWorkspaceTabReorder(){return rr(this).config.allowWorkspaceTabReorder}get allowWorkspaceTabExtract(){return rr(this).config.allowWorkspaceTabExtract}get minWidth(){return rr(this).config.minWidth}get minHeight(){return rr(this).config.minHeight}get maxWidth(){return rr(this).config.maxWidth}get maxHeight(){return rr(this).config.maxHeight}get width(){return rr(this).config.widthInPx}get height(){return rr(this).config.heightInPx}get showWindowCloseButtons(){return rr(this).config.showWindowCloseButtons}get showEjectButtons(){return rr(this).config.showEjectButtons}get showAddWindowButtons(){return rr(this).config.showAddWindowButtons}get isPinned(){return rr(this).config.isPinned}async removeChild(e){L(e);const t=this.children.find(e);t&&(await t.close(),await this.refreshReference())}async remove(e){L(e);const t=rr(this).controller.iterateFindChild(this.children,e);await t.close(),await this.refreshReference()}async focus(){await rr(this).controller.focusItem(this.id),await this.refreshReference()}async close(){const e=rr(this).controller,t=await rr(this).frame.workspaces(),r=(await e.getPlatformFrameId()).id;if(1===t.length&&t.every((e=>e.id===this.id))&&r!==this.frame.id)return this.frame.close();await e.closeItem(this.id)}snapshot(){return rr(this).controller.getSnapshot(this.id,"workspace")}async saveLayout(e,t){v.runWithException(e),await rr(this).controller.saveLayout({name:e,workspaceId:this.id,saveContext:t?.saveContext,metadata:t?.metadata})}async setTitle(e){v.runWithException(e);const t=rr(this).controller;await t.setItemTitle(this.id,e),await this.refreshReference()}getContext(){return rr(this).controller.getWorkspaceContext(this.id)}setContext(e){return rr(this).controller.setWorkspaceContext(this.id,e)}updateContext(e){return rr(this).controller.updateWorkspaceContext(this.id,e)}onContextUpdated(e){return rr(this).controller.subscribeWorkspaceContextUpdated(this.id,e)}async refreshReference(){const e=await rr(this).controller.getSnapshot(this.id,"workspace"),t=rr(this).controller.flatChildren(rr(this).children),r=rr(this).controller.refreshChildren({existingChildren:t,workspace:this,parent:this,children:e.children}),o=this.frame;let n;if(o.id===e.config.frameId)or(this).remapFrame(o,e.frameSummary),n=o;else{const t={summary:e.frameSummary};n=rr(this).ioc.getModel("frame",t)}or(this).remapWorkspace(this,{config:e.config,children:r,frame:n})}async getIcon(){return rr(this).controller.getWorkspaceIcon(this.id)}async setIcon(e){return rr(this).controller.setWorkspaceIcon(this.id,e)}getBox(e){L(e);const t=rr(this).children;return rr(this).controller.iterateFindChild(t,(t=>"window"!==t.type&&e(t)))}getAllBoxes(e){L(e,!0);const t=rr(this).children,r=rr(this).controller.iterateFilterChildren(t,(e=>"window"!==e.type));return e?r.filter(e):r}getRow(e){return L(e),this.getBox((t=>"row"===t.type&&e(t)))}getAllRows(e){return L(e,!0),e?this.getAllBoxes((t=>"row"===t.type&&e(t))):this.getAllBoxes((e=>"row"===e.type))}getColumn(e){return L(e),this.getBox((t=>"column"===t.type&&e(t)))}getAllColumns(e){return L(e,!0),e?this.getAllBoxes((t=>"column"===t.type&&e(t))):this.getAllBoxes((e=>"column"===e.type))}getGroup(e){return L(e),this.getBox((t=>"group"===t.type&&e(t)))}getAllGroups(e){return L(e,!0),e?this.getAllBoxes((t=>"group"===t.type&&e(t))):this.getAllBoxes((e=>"group"===e.type))}getWindow(e){L(e);const t=rr(this).children;return rr(this).controller.iterateFindChild(t,(t=>"window"===t.type&&e(t)))}getAllWindows(e){L(e,!0);const t=rr(this).children,r=rr(this).controller.iterateFilterChildren(t,(e=>"window"===e.type));return e?r.filter(e):r}addRow(e){return rr(this).base.addParent(this,"row","workspace",e)}addColumn(e){return rr(this).base.addParent(this,"column","workspace",e)}addGroup(e){return rr(this).base.addParent(this,"group","workspace",e)}addWindow(e){return rr(this).base.addWindow(this,e,"workspace")}async bundleToRow(){await rr(this).controller.bundleWorkspaceTo("row",this.id),await this.refreshReference()}async bundleToColumn(){await rr(this).controller.bundleWorkspaceTo("column",this.id),await this.refreshReference()}async hibernate(){await rr(this).controller.hibernateWorkspace(this.id),await this.refreshReference()}async resume(){await rr(this).controller.resumeWorkspace(this.id),await this.refreshReference()}async lock(e){let t;if("function"==typeof e){t=e({allowDrop:this.allowDrop,allowDropLeft:this.allowDropLeft,allowDropTop:this.allowDropTop,allowDropRight:this.allowDropRight,allowDropBottom:this.allowDropBottom,allowSystemHibernation:this.allowSystemHibernation,allowExtract:this.allowExtract,allowWindowReorder:this.allowWindowReorder,allowSplitters:this.allowSplitters,showCloseButton:this.showCloseButton,showSaveButton:this.showSaveButton,allowWorkspaceTabReorder:this.allowWorkspaceTabReorder,allowWorkspaceTabExtract:this.allowWorkspaceTabExtract,showAddWindowButtons:this.showAddWindowButtons,showEjectButtons:this.showEjectButtons,showWindowCloseButtons:this.showWindowCloseButtons})}else t=e;const r=void 0===t?void 0:ht.runWithException(t);await rr(this).controller.lockWorkspace(this.id,r),await this.refreshReference()}async pin(e){Dt.runWithException(e),await rr(this).controller.pinWorkspace(this.id,e?.icon),await this.refreshReference()}async unpin(){await rr(this).controller.unpinWorkspace(this.id),await this.refreshReference()}async showLoadingAnimation(){if(!(window.glue42gd||window.iodesktop))throw new Error("Not supported in IO Connect Browser");await rr(this).controller.showWorkspaceLoadingAnimation(this.id)}async hideLoadingAnimation(){if(!(window.glue42gd||window.iodesktop))throw new Error("Not supported in IO Connect Browser");await rr(this).controller.hideWorkspaceLoadingAnimation(this.id)}async onClosed(e){L(e);const t=rr(this).id,r={action:"closed",eventType:"workspace",scope:"workspace",scopeId:t,callback:async t=>{e({frameId:t.frameSummary.id,workspaceId:t.workspaceSummary.id,frameBounds:t.frameBounds})}};return await rr(this).controller.processLocalSubscription(r,t)}async onHibernated(e){L(e);const t=rr(this).id,r={action:"hibernated",eventType:"workspace",scope:"workspace",scopeId:t,callback:async()=>{await this.refreshReference(),e()}};return await rr(this).controller.processLocalSubscription(r,t)}async onResumed(e){L(e);const t=rr(this).id,r={action:"resumed",eventType:"workspace",scope:"workspace",scopeId:t,callback:async()=>{await this.refreshReference(),e()}};return await rr(this).controller.processLocalSubscription(r,t)}async onWindowAdded(e){L(e);const t=rr(this).id,r={action:"added",eventType:"window",scope:"workspace",scopeId:t,callback:async t=>{await this.refreshReference();const r=this.getBox((e=>e.id===t.windowSummary.parentId)).children.find((e=>"window"===e.type&&e.elementId===t.windowSummary.itemId));e(r)}};return await rr(this).controller.processLocalSubscription(r,t)}async onWindowRemoved(e){L(e);const t=rr(this).id,r={action:"removed",eventType:"window",scope:"workspace",scopeId:t,callback:async t=>{await this.refreshReference();const{windowId:r,workspaceId:o,frameId:n}=t.windowSummary.config;e({windowId:r,workspaceId:o,frameId:n})}};return await rr(this).controller.processLocalSubscription(r,t)}async onWindowLoaded(e){L(e);const t=rr(this).id,r={action:"loaded",eventType:"window",scope:"workspace",scopeId:t,callback:async t=>{await this.refreshReference();const r=this.getWindow((e=>e.id&&e.id===t.windowSummary.config.windowId));e(r)}};return await rr(this).controller.processLocalSubscription(r,t)}async onWindowMaximized(e){L(e);const t=rr(this).id,r={action:"maximized",eventType:"window",scope:"workspace",scopeId:t,callback:async t=>{await this.refreshReference();const r=this.getBox((e=>e.id===t.windowSummary.parentId)).children.find((e=>"window"===e.type&&e.elementId===t.windowSummary.itemId));e(r)}};return await rr(this).controller.processLocalSubscription(r,t)}async onWindowRestored(e){L(e);const t=rr(this).id,r={action:"restored",eventType:"window",scope:"workspace",scopeId:t,callback:async t=>{await this.refreshReference();const r=this.getBox((e=>e.id===t.windowSummary.parentId)).children.find((e=>"window"===e.type&&e.elementId===t.windowSummary.itemId));e(r)}};return await rr(this).controller.processLocalSubscription(r,t)}async onWindowSelected(e){L(e);const t=rr(this).id,r={action:"selected",eventType:"window",scope:"workspace",scopeId:t,callback:async t=>{await this.refreshReference();const r=this.getBox((e=>e.id===t.windowSummary.parentId)).children.find((e=>"window"===e.type&&e.elementId===t.windowSummary.itemId));e(r)}};return await rr(this).controller.processLocalSubscription(r,t)}async onLockConfigurationChanged(e){L(e);const t=rr(this).id,r={action:"lock-configuration-changed",eventType:"workspace",scope:"workspace",scopeId:t,callback:async()=>{await this.refreshReference(),e({allowDrop:this.allowDrop,allowDropLeft:this.allowDropLeft,allowDropTop:this.allowDropTop,allowDropRight:this.allowDropRight,allowDropBottom:this.allowDropBottom,allowSystemHibernation:this.allowSystemHibernation,allowExtract:this.allowExtract,allowSplitters:this.allowSplitters,allowWindowReorder:this.allowWindowReorder,allowWorkspaceTabExtract:this.allowWorkspaceTabExtract,allowWorkspaceTabReorder:this.allowWorkspaceTabReorder,showAddWindowButtons:this.showAddWindowButtons,showCloseButton:this.showCloseButton,showEjectButtons:this.showEjectButtons,showSaveButton:this.showSaveButton,showWindowCloseButtons:this.showWindowCloseButtons})}};return await rr(this).controller.processLocalSubscription(r,t)}}const ir=new WeakMap,ar=e=>ir.get(e).manager.getWindowData(e);class sr{constructor(e){ir.set(this,{manager:e})}get id(){return ar(this).config.windowId}get elementId(){return ar(this).id}get type(){return"window"}get frameId(){return ar(this).frame.id}get workspaceId(){return ar(this).workspace.id}get positionIndex(){return ar(this).config.positionIndex}get isMaximized(){return ar(this).config.isMaximized}get isLoaded(){return ar(this).controller.checkIsWindowLoaded(this.id)}get isSelected(){return ar(this).config.isSelected}get focused(){return this.getGdWindow().isFocused}get title(){return ar(this).config.title}get allowExtract(){return ar(this).config.allowExtract}get allowReorder(){return ar(this).config.allowReorder}get showCloseButton(){return ar(this).config.showCloseButton}get width(){return ar(this).config.widthInPx}get height(){return ar(this).config.heightInPx}get minWidth(){return ar(this).config.minWidth}get minHeight(){return ar(this).config.minHeight}get maxWidth(){return ar(this).config.maxWidth}get maxHeight(){return ar(this).config.maxHeight}get workspace(){return ar(this).workspace}get frame(){return ar(this).frame}get parent(){return ar(this).parent}get appName(){return ar(this).config.appName}async forceLoad(){if(this.isLoaded)return;const e=ar(this).controller,t=ar(this).id,r=await e.forceLoadWindow(t);ar(this).config.windowId=r,await this.workspace.refreshReference()}async focus(){const e=ar(this).id,t=ar(this).controller;await t.focusItem(e),await this.workspace.refreshReference()}async close(){const e=ar(this).id,t=ar(this).controller;await t.closeItem(e),await ar(this).parent.removeChild((t=>t.id===e)),await this.workspace.refreshReference()}async setTitle(e){v.runWithException(e);const t=ar(this).id,r=ar(this).controller;await r.setItemTitle(t,e),await this.workspace.refreshReference()}async maximize(){const e=ar(this).id,t=ar(this).controller;await t.maximizeItem(e),await this.workspace.refreshReference()}async restore(){const e=ar(this).id,t=ar(this).controller;await t.restoreItem(e),await this.workspace.refreshReference()}async eject(){if(!this.isLoaded)throw new Error("Cannot eject this window, because it is not loaded yet");const e=ar(this).id,t=await ar(this).controller.ejectWindow(e);return ar(this).config.windowId=t,await this.workspace.refreshReference(),this.getGdWindow()}getGdWindow(){if(!this.isLoaded)throw new Error("Cannot fetch this GD window, because the window is not yet loaded");const e=ar(this).config.windowId;return ar(this).controller.getGDWindow(e)}async moveTo(e){if(!(e instanceof qt||e instanceof Xt||e instanceof er))throw new Error("Cannot add to the provided parent, because the provided parent is not an instance of Row, Column or Group");const t=ar(this).id,r=ar(this).controller;if(!await r.getParent((t=>t.id===e.id)))throw new Error("Cannot move the window to the selected parent, because this parent does not exist.");await r.moveWindowTo(t,e.id),await this.workspace.refreshReference()}async lock(e){let t;if("function"==typeof e){t=e({allowExtract:this.allowExtract,allowReorder:this.allowReorder,showCloseButton:this.showCloseButton})}else t=e;const r=void 0===t?void 0:wt.runWithException(t),o=ar(this).id;await ar(this).controller.lockWindow(o,r),await this.workspace.refreshReference()}async setSize(e){const t=pt.runWithException(e);if(!t.width&&!t.height)throw new Error("Expected either width or height to be passed.");const r=ar(this).id,o=ar(this).controller;await o.resizeItem(r,{height:t.height,width:t.width,relative:!1}),await this.workspace.refreshReference()}async onRemoved(e){L(e);const t=ar(this).id,r={callback:async()=>{await this.workspace.refreshReference(),e()},action:"removed",eventType:"window",scope:"window"};return await ar(this).controller.processLocalSubscription(r,t)}async onLockConfigurationChanged(e){L(e);const t=ar(this).id,r={callback:async()=>{await this.workspace.refreshReference(),e({allowExtract:this.allowExtract,allowReorder:this.allowReorder,showCloseButton:this.showCloseButton})},action:"lock-configuration-changed",eventType:"window",scope:"window"};return await ar(this).controller.processLocalSubscription(r,t)}}const cr=new WeakMap,dr=e=>cr.get(e).manager.getFrameData(e);class lr{constructor(e){cr.set(this,{manager:e})}async registerShortcut(e,t){v.runWithException(e),L(t);const r=dr(this).summary.id;return await dr(this).controller.registerShortcut(e,r,t)}get id(){return dr(this).summary.id}get isInitialized(){return dr(this).summary.isInitialized}getBounds(){const e=dr(this).summary.id;return dr(this).controller.getFrameBounds(e)}async resize(e){const t=Ge.runWithException(e),r=dr(this).summary.id;return dr(this).controller.resizeItem(r,t)}async move(e){const t=Ne.runWithException(e),r=dr(this).summary.id;return dr(this).controller.moveFrame(r,t)}focus(){const e=dr(this).summary.id;return dr(this).controller.focusItem(e)}async state(){if(!(window.glue42gd||window.iodesktop))throw new Error("State operations are not supported in IO Connect Browser");const e=dr(this).summary.id;return dr(this).controller.getFrameState(e)}async minimize(){if(!(window.glue42gd||window.iodesktop))throw new Error("State operations are not supported in IO Connect Browser");const e=dr(this).summary.id;return dr(this).controller.changeFrameState(e,"minimized")}async maximize(){if(!(window.glue42gd||window.iodesktop))throw new Error("State operations are not supported in IO Connect Browser");const e=dr(this).summary.id;return dr(this).controller.changeFrameState(e,"maximized")}async restore(){if(!(window.glue42gd||window.iodesktop))throw new Error("State operations are not supported in IO Connect Browser");const e=dr(this).summary.id;return dr(this).controller.changeFrameState(e,"normal")}close(){const e=dr(this).summary.id;return dr(this).controller.closeItem(e)}snapshot(){const e=dr(this).summary.id;return dr(this).controller.getSnapshot(e,"frame")}async workspaces(){return dr(this).controller.getWorkspacesByFrameId(this.id)}async getConstraints(){const e=dr(this).controller,t=dr(this).summary.id;return e.getFrameConstraints(t)}async restoreWorkspace(e,t){v.runWithException(e);const r=V.runWithException(t);return dr(this).controller.restoreWorkspace(e,r)}createWorkspace(e,t){const r=Y.runWithException(e),o=P.runWithException(t);return dr(this).controller.createWorkspace(r,o)}async init(e){if(re.runWithException(e),dr(this).summary.isInitialized)throw new Error("The frame has already been initialized");return dr(this).controller.initFrame(this.id,e)}async onClosed(e){L(e);const t=dr(this).summary.id,r={callback:t=>{e({frameId:t.frameSummary.id,frameBounds:t.frameBounds})},action:"closed",eventType:"frame",scope:"frame"};return await dr(this).controller.processLocalSubscription(r,t)}async onMaximized(e){L(e);const t=dr(this).summary.id,r={callback:()=>{e()},action:"maximized",eventType:"frame",scope:"frame"};return await dr(this).controller.processLocalSubscription(r,t)}async onMinimized(e){L(e);const t=dr(this).summary.id,r={callback:()=>{e()},action:"minimized",eventType:"frame",scope:"frame"};return await dr(this).controller.processLocalSubscription(r,t)}async onNormal(e){L(e);const t=dr(this).summary.id,r={callback:()=>{e()},action:"normal",eventType:"frame",scope:"frame"};return await dr(this).controller.processLocalSubscription(r,t)}async onWorkspaceOpened(e){L(e);const t=dr(this).summary.id,r={callback:async t=>{const r=await dr(this).controller.transformStreamPayloadToWorkspace(t);e(r)},action:"opened",eventType:"workspace",scope:"frame"};return await dr(this).controller.processLocalSubscription(r,t)}async onWorkspaceSelected(e){L(e);const t=dr(this).summary.id,r={callback:async t=>{const r=await dr(this).controller.getWorkspaceById(t.workspaceSummary.id);e(r)},action:"selected",eventType:"workspace",scope:"frame"};return await dr(this).controller.processLocalSubscription(r,t)}async onWorkspaceClosed(e){L(e);const t=dr(this).summary.id,r={callback:t=>{e({frameId:t.frameSummary.id,workspaceId:t.workspaceSummary.id,frameBounds:t.frameBounds})},action:"closed",eventType:"workspace",scope:"frame"};return await dr(this).controller.processLocalSubscription(r,t)}async onWindowAdded(e){L(e);const t=dr(this).summary.id,r={callback:async t=>{const r=(await dr(this).controller.getParent((e=>e.id===t.windowSummary.parentId))).children.find((e=>"window"===e.type&&e.positionIndex===t.windowSummary.config.positionIndex));e(r)},action:"added",eventType:"window",scope:"frame"};return await dr(this).controller.processLocalSubscription(r,t)}async onWindowRemoved(e){L(e);const t=dr(this).summary.id,r={callback:t=>{const{windowId:r,workspaceId:o,frameId:n}=t.windowSummary.config;e({windowId:r,workspaceId:o,frameId:n})},action:"removed",eventType:"window",scope:"frame"};return await dr(this).controller.processLocalSubscription(r,t)}async onWindowLoaded(e){L(e);const t=dr(this).summary.id,r={callback:async t=>{const r=(await dr(this).controller.getParent((e=>e.id===t.windowSummary.parentId))).children.find((e=>"window"===e.type&&e.positionIndex===t.windowSummary.config.positionIndex));e(r)},action:"loaded",eventType:"window",scope:"frame"};return await dr(this).controller.processLocalSubscription(r,t)}async onInitializationRequested(e){return L(e),this.isInitialized||e(dr(this).summary.initializationContext),()=>{}}async onFocusChanged(e){L(e);const t=dr(this),{id:r}=t.summary,o={callback:t=>{e({isFocused:t.frameSummary.isFocused})},action:"focus",eventType:"frame",scope:"frame"};return await t.controller.processLocalSubscription(o,r)}}class hr{parentsData=new WeakMap;workspacesData=new WeakMap;windowsData=new WeakMap;framesData=new WeakMap;deleteData(e){e instanceof sr&&this.windowsData.delete(e),e instanceof nr&&this.workspacesData.delete(e),(e instanceof qt||e instanceof Xt||e instanceof er)&&this.parentsData.delete(e),e instanceof lr&&this.framesData.delete(e)}setWindowData(e,t){this.windowsData.set(e,t)}setWorkspaceData(e,t){this.workspacesData.set(e,t)}setParentData(e,t){this.parentsData.set(e,t)}setFrameData(e,t){this.framesData.set(e,t)}getWindowData(e){return this.windowsData.get(e)}getWorkspaceData(e){return this.workspacesData.get(e)}getParentData(e){return this.parentsData.get(e)}getFrameData(e){return this.framesData.get(e)}remapChild(e,t){if(e instanceof sr){const r=this.windowsData.get(e);r.parent=t.parent||r.parent,r.config=t.config||r.config}if(e instanceof qt||e instanceof Xt||e instanceof er){const r=this.parentsData.get(e);r.parent=t.parent||r.parent,r.config=t.config||r.config,r.children=t.children||r.children}}remapFrame(e,t){this.framesData.get(e).summary=t}remapWorkspace(e,t){const r=this.workspacesData.get(e);r.frame=t.frame||r.frame,r.config=t.config||r.config,r.children=t.children||r.children}}const ur=new WeakMap,wr=(e,t)=>{const r=ur.get(e).manager;return t instanceof nr?r.getWorkspaceData(t):ur.get(e).manager.getParentData(t)};class pr{frameId;workspaceId;positionIndex;constructor(e){ur.set(this,{manager:e})}getId(e){return wr(this,e).id}getPositionIndex(e){return wr(this,e).config.positionIndex}getWorkspaceId(e){const t=wr(this,e);return t.config.workspaceId||t.workspace.id}getFrameId(e){return wr(this,e).frame.id}getAllChildren(e,t){L(t,!0);const r=wr(this,e).children;return void 0===t?r:r.filter(t)}getMyParent(e){return e instanceof nr?e:wr(this,e).parent}getMyFrame(e){return wr(this,e).frame}getMyWorkspace(e){return e instanceof nr?e:wr(this,e).workspace}async addWindow(e,t,r){if(!t.appName&&!t.windowId)throw new Error("The window definition should contain either an appName or a windowId");const o=_.runWithException(t),n=wr(this,e).controller,i=await n.add("window",wr(this,e).id,r,o);if(e instanceof nr)return await e.refreshReference(),e.getWindow((e=>e.elementId===i.itemId));const a=this.getMyWorkspace(e);return await a.refreshReference(),a.getWindow((e=>e.elementId===i.itemId))}async addParent(e,t,r,o){const n=this.transformDefinition(t,o),i=wr(this,e).controller,a=(await i.add("container",wr(this,e).id,r,n)).itemId;if(e instanceof nr)return await e.refreshReference(),e.getBox((e=>e.id===a));const s=this.getMyWorkspace(e);return await s.refreshReference(),s.getBox((e=>e.id===a))}async removeChild(e,t){L(t);const r=this.getAllChildren(e).find(t);r&&(await r.close(),e instanceof nr?await e.refreshReference():await this.getMyWorkspace(e).refreshReference())}async maximize(e){const{controller:t,id:r}=wr(this,e);await t.maximizeItem(r),await this.getMyWorkspace(e.parent).refreshReference()}async restore(e){const{controller:t,id:r}=wr(this,e);await t.restoreItem(r),await this.getMyWorkspace(e.parent).refreshReference()}async close(e){const t=wr(this,e),r=wr(this,e).controller;await r.closeItem(t.id),await this.getMyWorkspace(t.parent).refreshReference()}async lockContainer(e,t){const r=wr(this,e),o=wr(this,e).controller;await o.lockContainer(r.id,e.type,t),await this.getMyWorkspace(r.parent).refreshReference()}getAllowDrop(e){return wr(this,e).config.allowDrop}getAllowDropLeft(e){const t=wr(this,e);if("group"!==t.type)throw new Error(`Property allowDropLeft is available only for groups and not on ${e.type} ${e.id}`);return t.config.allowDropLeft}getAllowDropRight(e){const t=wr(this,e);if("group"!==t.type)throw new Error(`Property allowDropRight is available only for groups and not on ${e.type} ${e.id}`);return t.config.allowDropRight}getAllowDropTop(e){const t=wr(this,e);if("group"!==t.type)throw new Error(`Property allowDropTop is available only for groups and not on ${e.type} ${e.id}`);return t.config.allowDropTop}getAllowDropBottom(e){const t=wr(this,e);if("group"!==t.type)throw new Error(`Property allowDropBottom is available only for groups and not on ${e.type} ${e.id}`);return t.config.allowDropBottom}getAllowDropHeader(e){const t=wr(this,e);if("group"!==t.type)throw new Error(`Property allowDropHeader is available only for groups and not on ${e.type} ${e.id}`);return t.config.allowDropHeader}getAllowSplitters(e){const t=wr(this,e);if("group"===t.type)throw new Error(`Cannot get allow splitters from private data ${t.type}`);return t.config.allowSplitters}getAllowExtract(e){const t=wr(this,e);if("group"!==t.type)throw new Error(`Cannot get allow extract from private data ${t.type} with config ${"workspace"!==t.type?t.config.type:""}`);return t.config.allowExtract}getAllowReorder(e){const t=wr(this,e);if("group"!==t.type)throw new Error(`Cannot get allow extract from private data ${t.type} with config ${"workspace"!==t.type?t.config.type:""}`);return t.config.allowReorder}getShowMaximizeButton(e){const t=wr(this,e);if("group"!==t.type)throw new Error(`Cannot get show maximize button from private data${t.type} with config ${"workspace"!==t.type?t.config.type:""}`);return t.config.showMaximizeButton}getShowEjectButton(e){const t=wr(this,e);if("group"!==t.type)throw new Error(`Cannot get show eject button from private data${t.type} with config ${"workspace"!==t.type?t.config.type:""}`);return t.config.showEjectButton}getShowAddWindowButton(e){const t=wr(this,e);if("group"!==t.type)throw new Error(`Cannot get add window button from private data${t.type} with config ${"workspace"!==t.type?t.config.type:""}`);return t.config.showAddWindowButton}getMinWidth(e){return wr(this,e).config.minWidth}getMaxWidth(e){return wr(this,e).config.maxWidth}getMinHeight(e){return wr(this,e).config.minHeight}getMaxHeight(e){return wr(this,e).config.maxHeight}getWidthInPx(e){return wr(this,e).config.widthInPx}getHeightInPx(e){return wr(this,e).config.heightInPx}getIsPinned(e){return wr(this,e).config.isPinned}getIsMaximized(e){return wr(this,e).config.isMaximized}getMaximizationBoundary(e){return wr(this,e).config.maximizationBoundary}async setHeight(e,t){const r=wr(this,e),{controller:o,id:n}=r;await o.resizeItem(n,{height:t}),await this.getMyWorkspace(r.parent).refreshReference()}async setWidth(e,t){const r=wr(this,e),{controller:o,id:n}=r;await o.resizeItem(n,{width:t}),await this.getMyWorkspace(r.parent).refreshReference()}async setSize(e,t,r){const o=wr(this,e),{controller:n,id:i}=o;await n.resizeItem(i,{width:t,height:r}),await this.getMyWorkspace(o.parent).refreshReference()}async setMaximizationBoundary(e,t){const r=wr(this,e),{controller:o,id:n}=r;await o.setMaximizationBoundary(n,t),await this.getMyWorkspace(r.parent).refreshReference()}async bundleTo(e,t){const r=wr(this,e),{controller:o,id:n}=r;await o.bundleItemTo(t,n)}async processLocalSubscription(e,t){return wr(this,e).controller.processLocalSubscription(t,this.getId(e))}transformDefinition(e,t){let r;return void 0===t?r={type:e,children:[]}:t instanceof jt?r=t.serialize():(void 0===t.type&&(t.type=e),r=K.runWithException(t),r.children=r.children||[]),r}}class mr{ioc;windows;contexts;layouts;constructor(e,t,r,o){this.ioc=e,this.windows=t,this.contexts=r,this.layouts=o}get bridge(){return this.ioc.bridge}get privateDataManager(){return this.ioc.privateDataManager}checkIsWindowLoaded(e){return!!e&&this.windows.list().some((t=>t.id===e))}async createWorkspace(e){const t=await this.bridge.send(zt.createWorkspace.name,e),r={summary:t.frameSummary},o={frame:this.ioc.getModel("frame",r),snapshot:t};return this.ioc.getModel("workspace",o)}async createEmptyFrame(e){const t={summary:await this.bridge.send(zt.createFrame.name,e)};return this.ioc.getModel("frame",t)}async initFrame(e,t){await this.bridge.send(zt.initFrame.name,{frameId:e,...t})}async restoreWorkspace(e,t){const r=await this.bridge.send(zt.openWorkspace.name,{name:e,restoreOptions:t}),o={summary:await this.bridge.send(zt.getFrameSummary.name,{itemId:r.config.frameId})},n={frame:this.ioc.getModel("frame",o),snapshot:r};return this.ioc.getModel("workspace",n)}async add(e,t,r,o){let n;const i={definition:o,parentId:t,parentType:r};if("window"===e)n=zt.addWindow.name;else{if("container"!==e)throw new Error(`Unrecognized add type: ${e}`);n=zt.addContainer.name}return await this.bridge.send(n,i)}async getFrame(e){const t={summary:await this.bridge.send(zt.getFrameSummary.name,{itemId:e})};return this.ioc.getModel("frame",t)}getFrames(e,t){return e.reduce(((e,r)=>{const o={summary:r},n=this.ioc.getModel("frame",o);return t&&!t(n)||e.push(n),e}),[])}getAllWorkspaceSummaries(...e){return e.reduce(((e,t)=>(e.push(...t.summaries),e)),[]).map((e=>Object.assign({},{id:e.id,width:e.config.widthInPx,height:e.config.heightInPx},e.config)))}handleOnSaved(e){const t=t=>{"Workspace"===t.type&&e(t)},r=this.layouts.onAdded(t),o=this.layouts.onChanged(t);return()=>{r(),o()}}handleOnRemoved(e){return this.layouts.onRemoved((t=>{"Workspace"===t.type&&e(t)}))}async importLayouts(e,t){await this.layouts.import(e,t)}async transformStreamPayloadToWorkspace(e){const t={summary:e.frameSummary},r={frame:this.ioc.getModel("frame",t),snapshot:e.workspaceSnapshot||await this.bridge.send(zt.getWorkspaceSnapshot.name,{itemId:e.workspaceSummary.id})};return this.ioc.getModel("workspace",r)}async fetchWorkspace(e){const t=await this.bridge.send(zt.getWorkspaceSnapshot.name,{itemId:e}),r={summary:t.frameSummary},o={frame:this.ioc.getModel("frame",r),snapshot:t};return this.ioc.getModel("workspace",o)}async bundleWorkspaceTo(e,t){await this.bridge.send(zt.bundleWorkspace.name,{type:e,workspaceId:t})}async bundleItemTo(e,t){if(!await this.isOperationSupported(zt.bundleItem.name))throw new Error(`Operation ${zt.bundleItem.name} is not supported. Ensure that you are running the latest version of all packages`);await this.bridge.send(zt.bundleItem.name,{type:e,itemId:t})}getWorkspaceContext(e){const t=`___workspace___${e}`;return this.contexts.get(t)}setWorkspaceContext(e,t){const r=`___workspace___${e}`;return this.contexts.set(r,t)}updateWorkspaceContext(e,t){const r=`___workspace___${e}`;return this.contexts.update(r,t)}subscribeWorkspaceContextUpdated(e,t){const r=`___workspace___${e}`;return this.contexts.subscribe(r,t)}async restoreItem(e){await this.bridge.send(zt.restoreItem.name,{itemId:e})}async maximizeItem(e){await this.bridge.send(zt.maximizeItem.name,{itemId:e})}async focusItem(e){await this.bridge.send(zt.focusItem.name,{itemId:e})}async closeItem(e){await this.bridge.send(zt.closeItem.name,{itemId:e})}async resizeItem(e,t){await this.bridge.send(zt.resizeItem.name,Object.assign({},{itemId:e},t))}async setMaximizationBoundary(e,t){await this.bridge.send(zt.setMaximizationBoundary.name,Object.assign({},{itemId:e},t))}async showWorkspaceLoadingAnimation(e){await this.bridge.send(zt.showLoadingAnimation.name,{itemId:e,type:"workspace"})}async hideWorkspaceLoadingAnimation(e){await this.bridge.send(zt.hideLoadingAnimation.name,{itemId:e,type:"workspace"})}async moveFrame(e,t){await this.bridge.send(zt.moveFrame.name,Object.assign({},{itemId:e},t))}getGDWindow(e){return this.windows.list().find((t=>t.id===e))}async forceLoadWindow(e){return(await this.bridge.send(zt.forceLoadWindow.name,{itemId:e})).windowId}async ejectWindow(e){return await this.bridge.send(zt.ejectWindow.name,{itemId:e})}async moveWindowTo(e,t){await this.bridge.send(zt.moveWindowTo.name,{itemId:e,containerId:t})}async getSnapshot(e,t){let r;return"workspace"===t?r=await this.bridge.send(zt.getWorkspaceSnapshot.name,{itemId:e}):"frame"===t&&(r=await this.bridge.send(zt.getFrameSnapshot.name,{itemId:e})),r}async setItemTitle(e,t){await this.bridge.send(zt.setItemTitle.name,{itemId:e,title:t})}refreshChildren(e){const{parent:t,children:r,existingChildren:o,workspace:n}=e;if(t instanceof sr||"window"===t.type)return;const i=r.map((e=>{let r=o.find((t=>"window"===t.type?t.elementId===e.id:t.id===e.id));if(r)this.privateDataManager.remapChild(r,{parent:t,children:[],config:e.config});else{let o;o="window"===e.type?{id:e.id,parent:t,frame:n.frame,workspace:n,config:e.config}:{id:e.id,parent:t,frame:n.frame,workspace:n,config:e.config,children:[]},r=this.ioc.getModel(e.type,o)}return"window"!==e.type&&this.refreshChildren({workspace:n,existingChildren:o,children:e.children,parent:r}),r}));return t instanceof nr||this.privateDataManager.remapChild(t,{children:i}),i}iterateFindChild(e,t){let r=e.find((e=>t(e)));return r||(e.some((e=>!(e instanceof sr)&&(r=this.iterateFindChild(e.children,t),!!r||void 0))),r)}iterateFilterChildren(e,t){const r=e.filter((e=>t(e))),o=e.reduce(((e,r)=>(r instanceof sr||e.push(...this.iterateFilterChildren(r.children,t)),e)),[]);return r.push(...o),r}notifyWindowAdded(e){return new Promise((t=>{if(this.windows.list().some((t=>t.id===e)))return t();const r=this.windows.onWindowAdded((o=>{o.id===e&&(r&&r(),t())}))}))}async hibernateWorkspace(e){await this.bridge.send(zt.hibernateWorkspace.name,{workspaceId:e})}async resumeWorkspace(e){await this.bridge.send(zt.resumeWorkspace.name,{workspaceId:e})}async lockWorkspace(e,t){await this.bridge.send(zt.lockWorkspace.name,{workspaceId:e,config:t})}async lockWindow(e,t){await this.bridge.send(zt.lockWindow.name,{windowPlacementId:e,config:t})}async lockContainer(e,t,r){await this.bridge.send(zt.lockContainer.name,{itemId:e,type:t,config:r})}async pinWorkspace(e,t){await this.bridge.send(zt.pinWorkspace.name,{workspaceId:e,icon:t})}async unpinWorkspace(e){await this.bridge.send(zt.unpinWorkspace.name,{workspaceId:e})}async getWorkspaceIcon(e){return(await this.bridge.send(zt.getWorkspaceIcon.name,{workspaceId:e})).icon}setWorkspaceIcon(e,t){return this.bridge.send(zt.setWorkspaceIcon.name,{workspaceId:e,icon:t})}async getPlatformFrameId(){try{return await this.bridge.send(zt.getPlatformFrameId.name,{})}catch(e){return{}}}async isOperationSupported(e){return window.glue42gd||window.iodesktop?{isSupported:!0}:await this.bridge.send(zt.operationCheck.name,{operation:e})}}class gr{bridge;base;shortcutsController;constructor(e,t,r){this.bridge=e,this.base=t,this.shortcutsController=r}checkIsWindowLoaded(e){return this.base.checkIsWindowLoaded(e)}async checkIsInSwimlane(e){return(await this.bridge.send(zt.isWindowInWorkspace.name,{itemId:e})).inWorkspace}async createWorkspace(e,t){const r=Object.assign({},e,{saveConfig:t});return await this.base.createWorkspace(r)}async createEmptyFrame(e){return await this.base.createEmptyFrame(e)}async initFrame(e,t){return this.base.initFrame(e,t)}async restoreWorkspace(e,t){if(!(await this.getLayoutSummaries()).some((t=>t.name===e)))throw new Error(`This layout: ${e} cannot be restored, because it doesn't exist.`);if(t?.frameId){if(!(await this.bridge.send(zt.getAllFramesSummaries.name)).summaries.some((e=>e.id===t.frameId)))throw new Error(`Cannot reuse the frame with id: ${t.frameId}, because there is no frame with that ID found`)}return await this.base.restoreWorkspace(e,t)}async add(e,t,r,o){return await this.base.add(e,t,r,o)}processLocalSubscription(e,t){return window.glue42gd||window.iodesktop?this.handleEnterpriseLocalSubscription(e,t):this.handleCoreLocalSubscription(e,t)}processGlobalSubscription(e,t,r){return window.glue42gd||window.iodesktop?this.handleEnterpriseGlobalSubscription(e,t,r):this.handleCoreGlobalSubscription(e,t,r)}async getFrame(e){if(e.windowId)return await this.base.getFrame(e.windowId);if(e.predicate)return(await this.getFrames(e.predicate))[0];throw new Error(`The provided selector is not valid: ${JSON.stringify(e)}`)}async getFrames(e){const t=await this.bridge.send(zt.getAllFramesSummaries.name);return this.base.getFrames(t.summaries,e)}getWorkspaceById(e){return this.base.fetchWorkspace(e)}async getWorkspaceByWindowId(e){return window.glue42gd||window.iodesktop?this.base.fetchWorkspace(e):(await this.getWorkspaces((t=>!!t.getWindow((t=>t.id===e)))))[0]}transformStreamPayloadToWorkspace(e){return this.base.transformStreamPayloadToWorkspace(e)}async getWorkspace(e){let t;return await this.iterateWorkspaces(((r,o)=>{e(r)&&(t=r,o())})),t}async getWorkspaces(e){const t=[];return await this.iterateWorkspaces((r=>{e&&!e(r)||t.push(r)})),t}async getWorkspacesByFrameId(e){const t=(await this.getAllWorkspaceSummaries()).filter((t=>t.frameId===e));return await Promise.all(t.map((e=>this.base.fetchWorkspace(e.id))))}async getAllWorkspaceSummaries(){const e=await this.bridge.send(zt.getAllWorkspacesSummaries.name,{});return this.base.getAllWorkspaceSummaries(e)}async getWindow(e){let t;return await this.iterateWorkspaces(((r,o)=>{const n=r.getWindow(e);n&&(t=n,o())})),t}async getParent(e){let t;return await this.iterateWorkspaces(((r,o)=>{const n=r.getBox(e);n&&(t=n,o())})),t}async getLayoutSummaries(){return(await this.bridge.send(zt.getAllLayoutsSummaries.name)).summaries}async deleteLayout(e){await this.bridge.send(zt.deleteLayout.name,{name:e})}async exportLayout(e){return(await this.bridge.send(zt.exportAllLayouts.name)).layouts.reduce(((t,r)=>(e&&!e(r)||t.push(r),t)),[])}async saveLayout(e){return await this.bridge.send(zt.saveLayout.name,e)}async importLayouts(e,t){if(window.glue42gd||window.iodesktop)try{await this.bridge.send(zt.importLayouts.name,{layouts:e,mode:t})}catch(r){await Promise.all(e.map((e=>this.bridge.send(zt.importLayout.name,{layout:e,mode:t}))))}else await this.base.importLayouts(e,t)}handleOnSaved(e){return this.base.handleOnSaved(e)}handleOnRemoved(e){return this.base.handleOnRemoved(e)}async bundleWorkspaceTo(e,t){return await this.base.bundleWorkspaceTo(e,t)}async bundleItemTo(e,t){return await this.base.bundleItemTo(e,t)}getWorkspaceContext(e){return this.base.getWorkspaceContext(e)}setWorkspaceContext(e,t){return this.base.setWorkspaceContext(e,t)}updateWorkspaceContext(e,t){return this.base.updateWorkspaceContext(e,t)}subscribeWorkspaceContextUpdated(e,t){return this.base.subscribeWorkspaceContextUpdated(e,t)}async restoreItem(e){return await this.base.restoreItem(e)}async maximizeItem(e){return await this.base.maximizeItem(e)}async focusItem(e){return await this.base.focusItem(e)}async changeFrameState(e,t){await this.bridge.send(zt.changeFrameState.name,{frameId:e,requestedState:t})}async getFrameBounds(e){return(await this.bridge.send(zt.getFrameBounds.name,{itemId:e})).bounds}async getFrameState(e){return(await this.bridge.send(zt.getFrameState.name,{itemId:e})).state}async closeItem(e){return await this.base.closeItem(e)}async resizeItem(e,t){return await this.base.resizeItem(e,t)}async setMaximizationBoundary(e,t){return await this.base.setMaximizationBoundary(e,t)}async showWorkspaceLoadingAnimation(e){return await this.base.showWorkspaceLoadingAnimation(e)}async hideWorkspaceLoadingAnimation(e){return await this.base.hideWorkspaceLoadingAnimation(e)}async moveFrame(e,t){return await this.base.moveFrame(e,t)}getGDWindow(e){return this.base.getGDWindow(e)}async forceLoadWindow(e){const t=await this.base.forceLoadWindow(e);return await this.base.notifyWindowAdded(t),t}async ejectWindow(e){const t=(await this.base.ejectWindow(e)).windowId;return await this.base.notifyWindowAdded(t),t}async moveWindowTo(e,t){return await this.base.moveWindowTo(e,t)}async getSnapshot(e,t){return await this.base.getSnapshot(e,t)}async setItemTitle(e,t){return await this.base.setItemTitle(e,t)}flatChildren(e){return e.reduce(((e,t)=>(e.push(t),"window"!==t.type&&e.push(...this.flatChildren(t.children)),e)),[])}refreshChildren(e){return this.base.refreshChildren(e)}iterateFindChild(e,t){return this.base.iterateFindChild(e,t)}iterateFilterChildren(e,t){return this.base.iterateFilterChildren(e,t)}hibernateWorkspace(e){return this.base.hibernateWorkspace(e)}resumeWorkspace(e){return this.base.resumeWorkspace(e)}lockWorkspace(e,t){return this.base.lockWorkspace(e,t)}lockWindow(e,t){return this.base.lockWindow(e,t)}lockContainer(e,t,r){return this.base.lockContainer(e,t,r)}pinWorkspace(e,t){return this.base.pinWorkspace(e,t)}unpinWorkspace(e){return this.base.unpinWorkspace(e)}getWorkspaceIcon(e){return this.base.getWorkspaceIcon(e)}setWorkspaceIcon(e,t){return this.base.setWorkspaceIcon(e,t)}async getFrameConstraints(e){const t=await this.getSnapshot(e,"frame");return{minWidth:t.config.minWidth,maxWidth:t.config.maxWidth,minHeight:t.config.minHeight,maxHeight:t.config.maxHeight}}registerShortcut(e,t,r){return this.shortcutsController.registerShortcut(e,t,r)}getPlatformFrameId(){return this.base.getPlatformFrameId()}async handleCoreLocalSubscription(e,t){if(await this.bridge.createCoreEventSubscription(),e.scopeId=e.scopeId||t,"window"===e.eventType&&"loaded"===e.action){const t=e.callback,r=async e=>{await this.base.notifyWindowAdded(e.windowSummary.config.windowId),t(e)};e.callback=r}return this.bridge.handleCoreSubscription(e)}handleEnterpriseLocalSubscription(e,t){if(e.scopeId=e.scopeId||t,"window"===e.eventType&&"loaded"===e.action){const t=e.callback,r=async e=>{await this.base.notifyWindowAdded(e.windowSummary.config.windowId),t(e)};e.callback=r}return this.bridge.subscribe(e)}async handleCoreGlobalSubscription(e,t,r){await this.bridge.createCoreEventSubscription();const o={eventType:t,callback:e,action:r,scope:"global"};if("window"===t&&"loaded"===r){const t=async t=>{await this.base.notifyWindowAdded(t.windowSummary.config.windowId),e(t)};o.callback=t}return this.bridge.handleCoreSubscription(o)}handleEnterpriseGlobalSubscription(e,t,r){const o={eventType:t,callback:e,action:r,scope:"global"};if("window"===t&&"loaded"===r){const t=async t=>{await this.base.notifyWindowAdded(t.windowSummary.config.windowId),e(t)};o.callback=t}return this.bridge.subscribe(o)}async iterateWorkspaces(e){let t=!1;const r=()=>{t=!0},o=await this.getAllWorkspaceSummaries();for(const n of o){if(t)return;e(await this.base.fetchWorkspace(n.id),r)}}}class fr{bridge;_shortcuts=r();constructor(e){this.bridge=e,this.bridge.onOperation(((e,t)=>{if(e.operation===Ft.shortcutClicked.name){const t=e.data;this._shortcuts.execute(`${t.frameId}-${t.shortcut}`)}}))}async registerShortcut(e,t,r){await this.bridge.send(zt.registerShortcut.name,{shortcut:e,frameId:t});const o=this._shortcuts.add(`${t}-${e}`,r);return()=>{o(),this.bridge.send(zt.unregisterShortcut.name,{shortcut:e,frameId:t})}}}class yr{agm;windows;layouts;contexts;_controllerInstance;_bridgeInstance;_transportInstance;_privateDataManagerInstance;_parentBaseInstance;_baseController;_shortcutsController;constructor(e,t,r,o){this.agm=e,this.windows=t,this.layouts=r,this.contexts=o}get baseController(){return this._baseController||(this._baseController=new mr(this,this.windows,this.contexts,this.layouts)),this._baseController}get controller(){return this._controllerInstance||(this._controllerInstance=new gr(this.bridge,this.baseController,this.shortcutsController)),this._controllerInstance}get shortcutsController(){return this._shortcutsController||(this._shortcutsController=new fr(this.bridge)),this._shortcutsController}get bridge(){return this._bridgeInstance||(this._bridgeInstance=new $t(this.transport,r())),this._bridgeInstance}get transport(){return this._transportInstance||(this._transportInstance=new Ot(this.agm,r())),this._transportInstance}get privateDataManager(){return this._privateDataManagerInstance||(this._privateDataManagerInstance=new hr),this._privateDataManagerInstance}get parentBase(){return this._parentBaseInstance||(this._parentBaseInstance=new pr(this.privateDataManager)),this._parentBaseInstance}async initiate(e){await this.transport.initiate(e)}getModel(e,t){switch(e){case"frame":{const e=new lr(this.privateDataManager),{summary:r}=t,o={summary:r,controller:this.controller};return this.privateDataManager.setFrameData(e,o),e}case"window":{const{id:e,parent:r,frame:o,workspace:n,config:i}=t,a={type:"window",controller:this.controller,config:i,id:e,parent:r,frame:o,workspace:n},s=new sr(this.privateDataManager);return this.privateDataManager.setWindowData(s,a),s}case"row":case"column":case"group":{const{id:r,children:o,parent:n,frame:i,workspace:a,config:s}=t,c="column"===e?new Xt(this.parentBase):"row"===e?new qt(this.parentBase):new er(this.parentBase),d=this.buildChildren(o,i,a,c),l={id:r,parent:n,frame:i,workspace:a,config:s,type:e,controller:this.controller,children:d};return this.privateDataManager.setParentData(c,l),c}case"workspace":{const{snapshot:e,frame:r}=t,o=new nr(this.privateDataManager),n=this.buildChildren(e.children,r,o,o),i={id:e.id,type:"workspace",config:e.config,base:this.parentBase,controller:this.controller,children:n,frame:r,ioc:this};return this.privateDataManager.setWorkspaceData(o,i),o}default:throw new Error(`Unrecognized type: ${e}`)}}getBuilder(e){e.definition=e.definition||{},Array.isArray(e.definition.children)||(e.definition.children=[]);const t=new Gt(this.getBuilder.bind(this));switch(e.type){case"workspace":return new Jt(e.definition,t,this.controller);case"row":case"column":case"group":return e.definition.type=e.type,new jt(e.definition,t);default:throw new Error(`Unexpected Builder creation error, provided config: ${JSON.stringify(e)}`)}}buildChildren(e,t,r,o){return e.map((e=>{switch(e.type){case"window":return this.getModel("window",{id:e.id,config:e.config,frame:t,workspace:r,parent:o});case"column":case"row":case"group":return this.getModel(e.type,{id:e.id,config:e.config,children:e.children,frame:t,workspace:r,parent:o});default:throw new Error(`Unsupported child type: ${e.type}`)}}))}}const kr=async e=>{const t=new yr(e.agm,e.windows,e.layouts,e.contexts),r=e.interop.instance.windowId;await t.initiate(r),e.workspaces=((e,t)=>{const r=t.controller,o=async e=>(L(e,!0),r.getFrames(e)),n=async e=>(L(e),await r.processGlobalSubscription((r=>{const o={summary:r.frameSummary},n=t.getModel("frame",o);e(n)}),"frame","opened"));return{inWorkspace:()=>{const t=e.windows.my().id;if(!t)throw new Error("Cannot get my frame, because my id is undefined.");return r.checkIsInSwimlane(t)},getBuilder:e=>{const r=ne.runWithException(e);return t.getBuilder(r)},getMyFrame:async()=>{const t=e.windows.my().id;if(!t)throw new Error("Cannot get my frame, because my id is undefined.");if(!await r.checkIsInSwimlane(t))throw new Error("Cannot fetch your frame, because this window is not in a workspace");return r.getFrame({windowId:t})},getFrame:async e=>(L(e),r.getFrame({predicate:e})),getAllFrames:o,getAllWorkspacesSummaries:()=>r.getAllWorkspaceSummaries(),getMyWorkspace:async()=>{const t=e.windows.my().id;if(!t)throw new Error("Cannot get my workspace, because my id is undefined.");if(!await r.checkIsInSwimlane(t))throw new Error("Cannot fetch your workspace, because this window is not in a workspace");return await r.getWorkspaceByWindowId(t)},getWorkspace:async e=>(L(e),(await r.getWorkspaces(e))[0]),getWorkspaceById:async e=>(v.runWithException(e),r.getWorkspaceById(e)),getAllWorkspaces:e=>(L(e,!0),r.getWorkspaces(e)),getWindow:async e=>(L(e),r.getWindow(e)),getBox:async e=>(L(e),r.getParent(e)),restoreWorkspace:async(e,t)=>{v.runWithException(e);const o=V.runWithException(t);return r.restoreWorkspace(e,o)},createWorkspace:async(e,t)=>{const o=Y.runWithException(e),n=P.runWithException(t);return r.createWorkspace(o,n)},createEmptyFrame:async e=>{const t=te.runWithException(e);return r.createEmptyFrame(t??{})},waitForFrame:async e=>(v.runWithException(e),new Promise(((t,r)=>{let i=()=>{};n((r=>{r.id===e&&(t(r),i())})).then((e=>(i=e,o()))).then((r=>{const o=r.find((t=>t.id===e));o&&(t(o),i())})).catch(r)}))),layouts:{getSummaries:()=>r.getLayoutSummaries(),delete:async e=>(v.runWithException(e),r.deleteLayout(e)),export:async e=>(L(e,!0),r.exportLayout(e)),import:async(e,t="replace")=>{if(!Array.isArray(e))throw new Error(`The provided layouts argument is not an array: ${JSON.stringify(e)}`);return e.forEach((e=>Se.runWithException(e))),r.importLayouts(e,t)},save:async e=>{const t=lt.runWithException(e);return r.saveLayout(t)},onSaved:async e=>(L(e),r.handleOnSaved(e)),onRemoved:async e=>(L(e),r.handleOnRemoved(e))},onFrameOpened:n,onFrameClosed:async e=>(L(e),await r.processGlobalSubscription((t=>{e({frameId:t.frameSummary.id,frameBounds:t.frameBounds})}),"frame","closed")),onWorkspaceOpened:async e=>(L(e),await r.processGlobalSubscription((async t=>{const o=await r.transformStreamPayloadToWorkspace(t);e(o)}),"workspace","opened")),onWorkspaceClosed:async e=>(L(e),await r.processGlobalSubscription((t=>{e({frameId:t.frameSummary.id,workspaceId:t.workspaceSummary.id,frameBounds:t.frameBounds})}),"workspace","closed")),onWorkspaceHibernated:async e=>(L(e),await r.processGlobalSubscription((async t=>{const o=await r.transformStreamPayloadToWorkspace(t);e(o)}),"workspace","hibernated")),onWorkspaceResumed:async e=>(L(e),await r.processGlobalSubscription((async t=>{const o=await r.transformStreamPayloadToWorkspace(t);e(o)}),"workspace","resumed")),onWindowAdded:async e=>(L(e),await r.processGlobalSubscription((async o=>{const n=await r.getSnapshot(o.windowSummary.config.workspaceId,"workspace"),i={summary:n.frameSummary},a={frame:t.getModel("frame",i),snapshot:n},s=t.getModel("workspace",a).getBox((e=>e.id===o.windowSummary.parentId)).children.find((e=>"window"===e.type&&e.elementId===o.windowSummary.itemId));e(s)}),"window","added")),onWindowLoaded:async e=>(L(e),await r.processGlobalSubscription((async o=>{const n=await r.getSnapshot(o.windowSummary.config.workspaceId,"workspace"),i={summary:n.frameSummary},a={frame:t.getModel("frame",i),snapshot:n},s=t.getModel("workspace",a).getWindow((e=>e.id&&e.id===o.windowSummary.config.windowId));e(s)}),"window","loaded")),onWindowRemoved:async e=>(L(e),await r.processGlobalSubscription((t=>{const{windowId:r,workspaceId:o,frameId:n}=t.windowSummary.config;e({windowId:r,workspaceId:o,frameId:n})}),"window","removed")),onWindowMaximized:async e=>(L(e),await r.processGlobalSubscription((async o=>{const n=await r.getSnapshot(o.windowSummary.config.workspaceId,"workspace"),i={summary:n.frameSummary},a={frame:t.getModel("frame",i),snapshot:n},s=t.getModel("workspace",a).getBox((e=>e.id===o.windowSummary.parentId)).children.find((e=>"window"===e.type&&e.elementId===o.windowSummary.itemId));e(s)}),"window","maximized")),onWindowRestored:async e=>(L(e),await r.processGlobalSubscription((async o=>{const n=await r.getSnapshot(o.windowSummary.config.workspaceId,"workspace"),i={summary:n.frameSummary},a={frame:t.getModel("frame",i),snapshot:n},s=t.getModel("workspace",a).getBox((e=>e.id===o.windowSummary.parentId)).children.find((e=>"window"===e.type&&e.elementId===o.windowSummary.itemId));e(s)}),"window","restored")),onWindowSelected:async e=>(L(e),await r.processGlobalSubscription((async o=>{const n=await r.getSnapshot(o.windowSummary.config.workspaceId,"workspace"),i={summary:n.frameSummary},a={frame:t.getModel("frame",i),snapshot:n},s=t.getModel("workspace",a).getBox((e=>e.id===o.windowSummary.parentId)).children.find((e=>"window"===e.type&&e.elementId===o.windowSummary.itemId));e(s)}),"window","selected")),version:"3.2.2"}})(e,t)};return"undefined"!=typeof window&&(window.IOWorkspaces=kr),kr}));
package/package.json CHANGED
@@ -1,52 +1,38 @@
1
1
  {
2
- "name": "@interopio/workspaces-api",
3
- "version": "3.2.1",
4
- "description": "IOConnect Workspaces API",
5
- "main": "dist/workspaces.umd.js",
6
- "module": "dist/workspaces.es.js",
7
- "types": "./workspaces.d.ts",
8
- "keywords": [
9
- "glue",
10
- "glue42",
11
- "desktop",
12
- "workspaces",
13
- "interop.io",
14
- "io.connect browser",
15
- "io.connect desktop"
16
- ],
17
- "homepage": "https://interop.io/",
18
- "scripts": {
19
- "test": "echo no tests found",
20
- "build": "rollup -c",
21
- "audit": "echo no audit found",
22
- "audit:V1": "node ../../scripts/audit/index.js",
23
- "preversion": "npm run build && npm run test && npm run audit",
24
- "version": "npm run build"
25
- },
26
- "author": {
27
- "name": "Interop.IO",
28
- "url": "https://interop.io/"
29
- },
30
- "license": "MIT",
31
- "dependencies": {
32
- "@interopio/core": "^6.2.1",
33
- "callback-registry": "^2.5.2",
34
- "decoder-validate": "0.0.2",
35
- "nanoid": "^4.0.0"
36
- },
37
- "publishConfig": {
38
- "access": "public"
39
- },
40
- "devDependencies": {
41
- "@rollup/plugin-commonjs": "^23.0.5",
42
- "@rollup/plugin-json": "^5.0.2",
43
- "@rollup/plugin-node-resolve": "^15.0.1",
44
- "@rollup/plugin-terser": "^0.2.0",
45
- "rollup": "^3.7.4",
46
- "rollup-plugin-delete": "^2.0.0",
47
- "rollup-plugin-typescript2": "^0.34.1",
48
- "tslint": "^6.1.3",
49
- "typescript": "^4.9.4"
50
- },
51
- "gitHead": "f3b8cc14a29d17a3f3dc196a9200b826a7d5f1d9"
2
+ "name": "@interopio/workspaces-api",
3
+ "version": "3.2.2",
4
+ "description": "IOConnect Workspaces API",
5
+ "main": "dist/workspaces.umd.js",
6
+ "module": "dist/workspaces.es.js",
7
+ "types": "./workspaces.d.ts",
8
+ "keywords": [
9
+ "glue",
10
+ "glue42",
11
+ "desktop",
12
+ "workspaces",
13
+ "interop.io",
14
+ "io.connect browser",
15
+ "io.connect desktop"
16
+ ],
17
+ "homepage": "https://interop.io/",
18
+ "scripts": {
19
+ "test": "echo no tests found",
20
+ "build": "rollup -c",
21
+ "audit": "echo no audit found",
22
+ "audit:V1": "node ../../scripts/audit/index.js",
23
+ "preversion": "npm run build && npm run test && npm run audit",
24
+ "version": "npm run build"
25
+ },
26
+ "author": {
27
+ "name": "Interop.IO",
28
+ "url": "https://interop.io/"
29
+ },
30
+ "license": "MIT",
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "devDependencies": {
35
+ "@interopio/core": "^6.2.2"
36
+ },
37
+ "gitHead": "ca51340ed407172a1db52832ba5827c593754dc5"
52
38
  }
package/rollup.config.js CHANGED
@@ -1,4 +1,4 @@
1
- const typescript = require('rollup-plugin-typescript2');
1
+ const typescript = require('@rollup/plugin-typescript');
2
2
  const terser = require('@rollup/plugin-terser');
3
3
  const commonjs = require('@rollup/plugin-commonjs');
4
4
  const resolve = require('@rollup/plugin-node-resolve');
@@ -320,6 +320,7 @@ export const workspaceDefinitionDecoder: Decoder<IOConnectWorkspaces.WorkspaceDe
320
320
  positionIndex: optional(nonNegativeNumberDecoder)
321
321
  })),
322
322
  frame: optional(object({
323
+ activate: optional(boolean()),
323
324
  reuseFrameId: optional(nonEmptyStringDecoder),
324
325
  applicationName: optional(nonEmptyStringDecoder),
325
326
  newFrame: optional(oneOf<boolean | IOConnectWorkspaces.NewFrameConfig>(
package/workspaces.d.ts CHANGED
@@ -160,6 +160,11 @@ export namespace IOConnectWorkspaces {
160
160
  * Specifies where in the frame should the workspace be placed
161
161
  */
162
162
  positionIndex?: number;
163
+
164
+ /**
165
+ * Controls the users ability to activate the Workspaces frame when the workspace is restored (available only for **io.Connect Desktop**). Defaults to the configuration passed in the workspaces.json or to false.
166
+ */
167
+ activateFrame?: boolean;
163
168
  }
164
169
 
165
170
  /** An object containing the bounds of a frame */
@@ -551,6 +556,9 @@ export namespace IOConnectWorkspaces {
551
556
  }
552
557
 
553
558
  export interface FrameTargetingOptions {
559
+ /** If true the frame will be activated when the operation is executed (available only for **io.Connect Desktop**). Defaults to the configuration passed in the workspaces.json or to false. */
560
+ activate?: boolean;
561
+
554
562
  /** A string id of an existing frame. If provided, this workspace will be opened in that specific frame */
555
563
  reuseFrameId?: string;
556
564