UNPKG

@interopio/workspaces-api

Version:

IOConnect Workspaces API

1 lines 90.5 kB
!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,S=p.oneOf;p.union;var x=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=S(k("keepInside"),k("autoEject")),M=b({inWorkspace:f()}),T=S(k("workspace"),k("row"),k("column"),k("group")),R=S(k("row"),k("column"),k("group")),L=S(k("maximized"),k("minimized"),k("normal")),A=S(k("workspace")),P=(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}`)},F=I(b({saveLayout:I(f())})),z=b({name:v}),H=b({minWidth:I(g()),maxWidth:I(g()),minHeight:I(g()),maxHeight:I(g()),allowExtract:I(f()),allowReorder:I(f()),showCloseButton:I(f())}),$=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())}),O=b({minHeight:I(g()),maxHeight:I(g()),allowDrop:I(f()),allowSplitters:I(f()),isPinned:I(f()),maximizationBoundary:I(f())}),_=b({minWidth:I(g()),maxWidth:I(g()),allowDrop:I(f()),allowSplitters:I(f()),isPinned:I(f()),maximizationBoundary:I(f())}),j=b({type:I(k("window")),appName:I(v),windowId:I(v),context:I(y()),config:I(H)}),G=b({type:k("window"),appName:I(v),windowId:I(v),context:I(y()),config:I(H)}),N=I(b({type:I(R),children:I(D((()=>W(S(j,N))))),config:I(y())})),J=b({type:k("column"),children:I(D((()=>W(S(G,q))))),config:I(_)}),U=b({type:k("row"),children:I(D((()=>W(S(G,q))))),config:I(O)}),K=b({type:k("group"),children:I(D((()=>W(S(G,q))))),config:I($)}),q=S(K,J,U);S(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)}),V=S(k("direct"),k("delayed"),k("lazy")),X=I(b({app:I(v),context:I(y()),loadingStrategy:I(V),title:I(v),reuseWorkspaceId:I(v),frameId:I(v),applicationName:I(v),lockdown:I(f()),activateFrame:I(f()),newFrame:I(S(Q,f())),noTabHeader:I(f()),inMemoryLayout:I(f()),icon:I(v),isPinned:I(f()),isSelected:I(f()),positionIndex:I(C),allowSystemHibernation:I(f())})),Y=b({name:v,restoreOptions:I(X)}),Z=b({children:I(W(S(j,q))),context:I(y()),config:I(b({title:I(v),position:I(C),isFocused:I(f()),noTabHeader:I(f()),reuseWorkspaceId:I(v),loadingStrategy:I(V),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),windowDragMode:I(B)})),frame:I(b({activate:I(f()),reuseFrameId:I(v),applicationName:I(v),newFrame:I(S(f(),Q))}))}),ee=b({workspaceId:v}),te=b({name:v,restoreOptions:I(X)}),re=I(b({applicationName:I(m()),frameConfig:I(Q),context:I(b()),layoutComponentId:I(v)})),oe=b({workspaces:W(S(I(Z),I(te)))}),ne=b({frameId:v,workspaces:W(S(Z,te))}),ie=b({type:T,definition:I(S(Z,N))}),ae=x(Z,b({saveConfig:I(b({saveLayout:I(f())}))})),se=b({itemId:v}),ce=b({context:I(b())}),de=b({id:v,isFocused:I(f()),isInitialized:I(f()),initializationContext:I(ce)});b({type:R,id:v,frameId:v,workspaceId:v,positionIndex:g()});const le=S(k("frame"),k("workspace"),k("container"),k("window")),he=b({type:le,branch:v}),ue=S(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")),we=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()),windowDragMode:I(B),loadingStrategy:I(V)}),pe=b({frameId:v,workspaceId:v,positionIndex:g(),minWidth:I(g()),maxWidth:I(g()),minHeight:I(g()),maxHeight:I(g())}),me=y(),ge=x(pe,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())})),fe=b({id:I(v),config:me,children:I(D((()=>W(ke)))),type:S(k("row"),k("column"),k("group"))}),ye=b({id:I(v),config:ge,type:k("window")}),ke=S(ye,fe),be=b({id:v,config:we,children:W(ke),frameSummary:de,context:I(y())}),We=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())})}),Ie=b({type:k("group"),config:y(),children:W(S(We))}),Se=b({type:k("column"),config:y(),children:W(S(Ie,We,D((()=>Se)),D((()=>xe))))}),xe=b({type:k("row"),config:y(),children:W(S(Se,Ie,We,D((()=>xe))))}),De=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(S(xe,Se,Ie,We))})}))}),ve=b({layout:De,mode:S(k("replace"),k("merge"))}),Ce=b({layouts:W(De),mode:S(k("replace"),k("merge"))}),Ee=b({layouts:W(De)}),Be=b({id:v,isFocused:I(f()),isInitialized:I(f()),initializationContext:I(ce)}),Me=b({summaries:W(Be)}),Te=b({id:v,config:we}),Re=b({summaries:W(Te)}),Le=b({id:v,config:y(),workspaces:W(be)}),Ae=b({name:v,applicationName:I(m())}),Pe=b({summaries:W(Ae)}),Fe=b({windowId:v}),ze=y(),He=b({state:L}),$e=b({top:g(),left:g(),width:C,height:C}),Oe=b({bounds:$e}),_e=b({icon:I(v)}),je=b({id:I(v)}),Ge=b({isSupported:f()}),Ne=b({width:I(E),height:I(E),relative:I(f())}),Je=b({top:I(g()),left:I(g()),relative:I(f())}),Ue=b({itemId:v}),Ke=b({itemId:v,excludeIds:I(f())}),qe=b({frameId:v,requestedState:L}),Qe=b({itemId:v,title:v}),Ve=b({itemId:v,containerId:v}),Xe=x(Ue,Ne),Ye=b({itemId:v,enabled:f()}),Ze=x(Ue,Je);b({id:v,type:R});const et=b({definition:j,parentId:v,parentType:T}),tt=b({definition:q,parentId:v,parentType:T}),rt=b({itemId:v,windowId:I(v)}),ot=b({live:f()}),nt=b({type:S(k("row"),k("column")),workspaceId:v}),it=b({type:S(k("row"),k("column")),itemId:v}),at=b({itemId:v,config:me}),st=b({frameSummary:de,frameBounds:I($e)}),ct=b({workspaceSummary:Te,frameSummary:de,workspaceSnapshot:I(be),frameBounds:I($e)}),dt=b({containerSummary:at}),lt=b({windowSummary:b({itemId:v,parentId:v,config:ge})}),ht=b({name:v,workspaceId:v,saveContext:I(f()),allowMultiple:I(f()),metadata:I(b())}),ut=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())}),wt=b({workspaceId:v,config:I(ut)}),pt=b({allowExtract:I(f()),allowReorder:I(f()),showCloseButton:I(f())}),mt=b({width:I(C),height:I(C)}),gt=b({windowPlacementId:v,config:I(pt)}),ft=b({allowDrop:I(f()),allowSplitters:I(f())}),yt=b({allowDrop:I(f()),allowSplitters:I(f())}),kt=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())}),bt=b({itemId:v,type:k("row"),config:I(ft)}),Wt=b({itemId:v,type:k("column"),config:I(yt)}),It=b({itemId:v,type:k("group"),config:I(kt)}),St=S(bt,Wt,It),xt=b({workspaceId:v,icon:I(v)}),Dt=b({workspaceId:v,icon:I(v)}),vt=I(b({icon:I(v)})),Ct=b({shortcut:v,frameId:v}),Et=b({shortcut:v,frameId:v}),Bt=b({enabled:f()}),Mt=b({itemId:v,type:A}),Tt=b({operation:v}),Rt=b({itemId:v,dragMode:B}),Lt=b({itemId:v,strategy:V}),At="T42.Web.Platform.Control",Pt="T42.Web.Platform.WSP.Stream",Ft={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}},zt={control:{name:"T42.Workspaces.Client.Control",isStream:!1}},Ht={frame:{name:"T42.Workspaces.Stream.Frame",payloadDecoder:st},workspace:{name:"T42.Workspaces.Stream.Workspace",payloadDecoder:ct},container:{name:"T42.Workspaces.Stream.Container",payloadDecoder:dt},window:{name:"T42.Workspaces.Stream.Window",payloadDecoder:lt}},$t={shortcutClicked:{name:"shortcutClicked",argsDecoder:Et,resultDecoder:ze}},Ot={ping:{name:"ping",resultDecoder:ot},isWindowInWorkspace:{name:"isWindowInWorkspace",argsDecoder:Ue,resultDecoder:M},createWorkspace:{name:"createWorkspace",resultDecoder:be,argsDecoder:ae},createFrame:{name:"createFrame",resultDecoder:Be,argsDecoder:re},initFrame:{name:"initFrame",resultDecoder:ze,argsDecoder:ne},getAllFramesSummaries:{name:"getAllFramesSummaries",resultDecoder:Me},getFrameSummary:{name:"getFrameSummary",resultDecoder:de,argsDecoder:se},getAllWorkspacesSummaries:{name:"getAllWorkspacesSummaries",resultDecoder:Re},getWorkspaceSnapshot:{name:"getWorkspaceSnapshot",resultDecoder:be,argsDecoder:Ue},getAllLayoutsSummaries:{name:"getAllLayoutsSummaries",resultDecoder:Pe},openWorkspace:{name:"openWorkspace",argsDecoder:Y,resultDecoder:be},deleteLayout:{name:"deleteLayout",resultDecoder:ze,argsDecoder:z},saveLayout:{name:"saveLayout",resultDecoder:De,argsDecoder:ht},importLayout:{name:"importLayout",resultDecoder:ze,argsDecoder:ve},importLayouts:{name:"importLayouts",resultDecoder:ze,argsDecoder:Ce},exportAllLayouts:{name:"exportAllLayouts",resultDecoder:Ee},restoreItem:{name:"restoreItem",argsDecoder:Ue,resultDecoder:ze},maximizeItem:{name:"maximizeItem",argsDecoder:Ue,resultDecoder:ze},focusItem:{name:"focusItem",argsDecoder:Ue,resultDecoder:ze},closeItem:{name:"closeItem",argsDecoder:Ue,resultDecoder:ze},resizeItem:{name:"resizeItem",argsDecoder:Xe,resultDecoder:ze},setMaximizationBoundary:{name:"setMaximizationBoundary",argsDecoder:Ye,resultDecoder:ze},changeFrameState:{name:"changeFrameState",argsDecoder:qe,resultDecoder:ze},getFrameState:{name:"getFrameState",argsDecoder:Ue,resultDecoder:He},getFrameBounds:{name:"getFrameBounds",argsDecoder:Ue,resultDecoder:Oe},moveFrame:{name:"moveFrame",argsDecoder:Ze,resultDecoder:ze},getFrameSnapshot:{name:"getFrameSnapshot",argsDecoder:Ke,resultDecoder:Le},forceLoadWindow:{name:"forceLoadWindow",argsDecoder:Ue,resultDecoder:Fe},ejectWindow:{name:"ejectWindow",argsDecoder:Ue,resultDecoder:Fe},setItemTitle:{name:"setItemTitle",argsDecoder:Qe,resultDecoder:ze},moveWindowTo:{name:"moveWindowTo",argsDecoder:Ve,resultDecoder:ze},addWindow:{name:"addWindow",argsDecoder:et,resultDecoder:rt},addContainer:{name:"addContainer",argsDecoder:tt,resultDecoder:rt},bundleWorkspace:{name:"bundleWorkspace",argsDecoder:nt,resultDecoder:ze},bundleItem:{name:"bundleItem",argsDecoder:it,resultDecoder:ze},hibernateWorkspace:{name:"hibernateWorkspace",argsDecoder:ee,resultDecoder:ze},resumeWorkspace:{name:"resumeWorkspace",argsDecoder:ee,resultDecoder:ze},lockWorkspace:{name:"lockWorkspace",argsDecoder:wt,resultDecoder:ze},lockWindow:{name:"lockWindow",argsDecoder:gt,resultDecoder:ze},lockContainer:{name:"lockContainer",argsDecoder:St,resultDecoder:ze},pinWorkspace:{name:"pinWorkspace",argsDecoder:xt,resultDecoder:ze},unpinWorkspace:{name:"unpinWorkspace",argsDecoder:ee,resultDecoder:ze},getWorkspaceIcon:{name:"getWorkspaceIcon",argsDecoder:ee,resultDecoder:_e},setWorkspaceIcon:{name:"setWorkspaceIcon",argsDecoder:Dt,resultDecoder:ze},registerShortcut:{name:"registerShortcut",argsDecoder:Ct,resultDecoder:ze},unregisterShortcut:{name:"unregisterShortcut",argsDecoder:Ct,resultDecoder:ze},showLoadingAnimation:{name:"showLoadingAnimation",argsDecoder:Mt,resultDecoder:ze},hideLoadingAnimation:{name:"hideLoadingAnimation",argsDecoder:Mt,resultDecoder:ze},getPlatformFrameId:{name:"getPlatformFrameId",resultDecoder:je},operationCheck:{name:"operationCheck",argsDecoder:Tt,resultDecoder:Ge},setWindowDragMode:{name:"setWindowDragMode",argsDecoder:Rt,resultDecoder:ze},setLoadingStrategy:{name:"setLoadingStrategy",argsDecoder:Lt,resultDecoder:ze}};class _t{resolve;reject;promise;constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}class jt{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(Ot).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 _t,o={streamType:e.eventType,level:e.scope,levelId:e.scopeId,promise:t.promise};this.pendingSubScriptions.push(o);try{const o=Ht[e.eventType],n=await this.transport.subscribe(o.name,this.getBranchKey(e),e.eventType);n.onData((e=>{const t=e.data,r=he.run(e.requestArguments),o=ue.run(t.action);if(!r.ok||!o.ok)return;const n=r.result.type,i=`${n}-${r.result.branch}-${o.result}`,a=Ht[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($t).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=ue.runWithException(t.action),r=le.runWithException(t.type),o=Ht[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)}}const Gt=()=>"undefined"==typeof window||(window.glue42gd||window.iodesktop),Nt=()=>"undefined"==typeof window?null:window.glue42core||window.iobrowser;class Jt{agm;registry;defaultTransportTimeout=12e4;coreEventMethodInitiated=!1;corePlatformSubPromise;constructor(e,t){this.agm=e,this.registry=t}async initiate(e){if(Gt())return await Promise.all(Object.values(Ft).map((e=>this.verifyMethodLive(e.name)))),void await Promise.all(Object.keys(zt).map((e=>this.registerMethod(e))));const t=Nt().communicationId;await Promise.all([this.verifyMethodLive(At,t),this.verifyMethodLive(Pt,t)]),await this.transmitControl("frameHello",{windowId:e})}coreSubscriptionReady(e){return this.coreEventMethodInitiated||this.subscribePlatform(e),this.corePlatformSubPromise}subscribePlatform(e){this.coreEventMethodInitiated=!0;const t=Nt().communicationId;this.corePlatformSubPromise=this.agm.subscribe(Pt,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=Gt()?{operation:e,operationArguments:t}:{operation:e,domain:"workspaces",data:t},o=Gt()?Ft.control.name:At,n=Gt()?void 0:Nt().communicationId;let i;const a=`Internal Workspaces Communication Error. Attempted operation: ${JSON.stringify(r)}. `;try{if(i=await this.agm.invoke(o,r,n?{instance:n}:"best",{methodResponseTimeoutMs:this.defaultTransportTimeout}),!i)throw new Error("Received unsupported result from GD - empty result");if(!Array.isArray(i.all_return_values)||0===i.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(`${a} -> Inner message: ${t}`)}throw new Error(`${a} -> Inner message: ${e.message}`)}return i.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))}),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=zt[e];return this.agm.register(t.name,((t,r)=>{this.registry.execute(e,t,r)}))}}const Ut=new WeakMap;class Kt{constructor(e,t){const r=t.wrapChildren(e.children);delete e.children,Ut.set(this,{base:t,children:r,definition:e})}get type(){return Ut.get(this).definition.type}addColumn(e){return Ut.get(this).base.add("column",Ut.get(this).children,e)}addRow(e){return Ut.get(this).base.add("row",Ut.get(this).children,e)}addGroup(e){return Ut.get(this).base.add("group",Ut.get(this).children,e)}addWindow(e){return Ut.get(this).base.addWindow(Ut.get(this).children,e),this}serialize(){const e=Ut.get(this).definition;return e.children=Ut.get(this).base.serializeChildren(Ut.get(this).children),e}}class qt{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=N.runWithException(r),n=this.getBuilder({type:e,definition:o});return t.push(n),n}addWindow(e,t){const r=j.runWithException(t);r.type="window",e.push(r)}serializeChildren(e){return e.map((e=>e instanceof Kt?e.serialize():e))}}const Qt=new WeakMap;class Vt{constructor(e,t,r){const o=t.wrapChildren(e.children);delete e.children,Qt.set(this,{base:t,children:o,definition:e,controller:r})}addColumn(e){const t=Qt.get(this).children;if(!t.every((e=>e instanceof Kt&&"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 Kt&&"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){C.runWithException(e);return Qt.get(this).children[e]}async create(e){const t=F.runWithException(e),r=Qt.get(this).definition;r.children=Qt.get(this).base.serializeChildren(Qt.get(this).children);return Qt.get(this).controller.createWorkspace(r,t)}}const Xt=new WeakMap,Yt=e=>Xt.get(e).base;class Zt{constructor(e){Xt.set(this,{base:e})}get type(){return"row"}get id(){return Yt(this).getId(this)}get frameId(){return Yt(this).getFrameId(this)}get workspaceId(){return Yt(this).getWorkspaceId(this)}get positionIndex(){return Yt(this).getPositionIndex(this)}get children(){return Yt(this).getAllChildren(this)}get parent(){return Yt(this).getMyParent(this)}get frame(){return Yt(this).getMyFrame(this)}get workspace(){return Yt(this).getMyWorkspace(this)}get allowDrop(){return Yt(this).getAllowDrop(this)}get allowSplitters(){return Yt(this).getAllowSplitters(this)}get minWidth(){return Yt(this).getMinWidth(this)}get minHeight(){return Yt(this).getMinHeight(this)}get maxWidth(){return Yt(this).getMaxWidth(this)}get maxHeight(){return Yt(this).getMaxHeight(this)}get width(){return Yt(this).getWidthInPx(this)}get height(){return Yt(this).getHeightInPx(this)}get isPinned(){return Yt(this).getIsPinned(this)}get isMaximized(){return Yt(this).getIsMaximized(this)}get maximizationBoundary(){return Yt(this).getMaximizationBoundary(this)}addWindow(e){return Yt(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 Yt(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 Yt(this).addParent(this,"column","row",e)}async addRow(){throw new Error("Adding rows as row children is not supported")}removeChild(e){return Yt(this).removeChild(this,e)}maximize(){return Yt(this).maximize(this)}restore(){return Yt(this).restore(this)}close(){return Yt(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 Yt(this).lockContainer(this,r)}async setHeight(e){return C.runWithException(e),Yt(this).setHeight(this,e)}async onLockConfigurationChanged(e){P(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 Yt(this).processLocalSubscription(this,t)}async setMaximizationBoundary(e){const t=Bt.runWithException(e);return Yt(this).setMaximizationBoundary(this,t)}}const er=new WeakMap,tr=e=>er.get(e).base;class rr{constructor(e){er.set(this,{base:e})}get type(){return"column"}get id(){return tr(this).getId(this)}get frameId(){return tr(this).getFrameId(this)}get workspaceId(){return tr(this).getWorkspaceId(this)}get positionIndex(){return tr(this).getPositionIndex(this)}get children(){return tr(this).getAllChildren(this)}get parent(){return tr(this).getMyParent(this)}get frame(){return tr(this).getMyFrame(this)}get workspace(){return tr(this).getMyWorkspace(this)}get allowDrop(){return tr(this).getAllowDrop(this)}get allowSplitters(){return tr(this).getAllowSplitters(this)}get minWidth(){return tr(this).getMinWidth(this)}get minHeight(){return tr(this).getMinHeight(this)}get maxWidth(){return tr(this).getMaxWidth(this)}get maxHeight(){return tr(this).getMaxHeight(this)}get width(){return tr(this).getWidthInPx(this)}get height(){return tr(this).getHeightInPx(this)}get isPinned(){return tr(this).getIsPinned(this)}get isMaximized(){return tr(this).getIsMaximized(this)}get maximizationBoundary(){return tr(this).getMaximizationBoundary(this)}addWindow(e){return tr(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 tr(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 tr(this).addParent(this,"row","column",e)}removeChild(e){return tr(this).removeChild(this,e)}maximize(){return tr(this).maximize(this)}restore(){return tr(this).restore(this)}close(){return tr(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:yt.runWithException(t);return tr(this).lockContainer(this,r)}async setWidth(e){return C.runWithException(e),tr(this).setWidth(this,e)}async onLockConfigurationChanged(e){P(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 tr(this).processLocalSubscription(this,t)}async setMaximizationBoundary(e){const t=Bt.runWithException(e);return tr(this).setMaximizationBoundary(this,t)}}const or=new WeakMap,nr=e=>or.get(e).base;class ir{constructor(e){or.set(this,{base:e})}get type(){return"group"}get id(){return nr(this).getId(this)}get frameId(){return nr(this).getFrameId(this)}get workspaceId(){return nr(this).getWorkspaceId(this)}get positionIndex(){return nr(this).getPositionIndex(this)}get children(){return nr(this).getAllChildren(this)}get parent(){return nr(this).getMyParent(this)}get frame(){return nr(this).getMyFrame(this)}get workspace(){return nr(this).getMyWorkspace(this)}get allowExtract(){return nr(this).getAllowExtract(this)}get allowReorder(){return nr(this).getAllowReorder(this)}get allowDropLeft(){return nr(this).getAllowDropLeft(this)}get allowDropRight(){return nr(this).getAllowDropRight(this)}get allowDropTop(){return nr(this).getAllowDropTop(this)}get allowDropBottom(){return nr(this).getAllowDropBottom(this)}get allowDropHeader(){return nr(this).getAllowDropHeader(this)}get allowDrop(){return nr(this).getAllowDrop(this)}get showMaximizeButton(){return nr(this).getShowMaximizeButton(this)}get showEjectButton(){return nr(this).getShowEjectButton(this)}get showAddWindowButton(){return nr(this).getShowAddWindowButton(this)}get minWidth(){return nr(this).getMinWidth(this)}get minHeight(){return nr(this).getMinHeight(this)}get maxWidth(){return nr(this).getMaxWidth(this)}get maxHeight(){return nr(this).getMaxHeight(this)}get width(){return nr(this).getWidthInPx(this)}get height(){return nr(this).getHeightInPx(this)}get isMaximized(){return nr(this).getIsMaximized(this)}addWindow(e){return nr(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 nr(this).removeChild(this,e)}maximize(){return nr(this).maximize(this)}restore(){return nr(this).restore(this)}close(){return nr(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:kt.runWithException(t);return nr(this).lockContainer(this,r)}async setSize(e){const t=mt.runWithException(e);if(!t.width&&!t.height)throw new Error("Expected either width or height to be passed.");return nr(this).setSize(this,e.width,e.height)}async bundleToRow(){await nr(this).bundleTo(this,"row"),await this.workspace.refreshReference()}async bundleToColumn(){await nr(this).bundleTo(this,"column"),await this.workspace.refreshReference()}async onLockConfigurationChanged(e){P(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 nr(this).processLocalSubscription(this,t)}}const ar=new WeakMap,sr=e=>ar.get(e).manager.getWorkspaceData(e),cr=e=>ar.get(e).manager;class dr{constructor(e){ar.set(this,{manager:e})}get id(){return sr(this).id}get frameId(){return sr(this).config.frameId}get positionIndex(){return sr(this).config.positionIndex}get title(){return sr(this).config.title}get layoutName(){return sr(this).config.layoutName}get isHibernated(){return sr(this).config.isHibernated}get isSelected(){return sr(this).config.isSelected}get children(){return sr(this).children}get frame(){return sr(this).frame}get allowSplitters(){return sr(this).config.allowSplitters}get allowSystemHibernation(){return sr(this).config.allowSystemHibernation}get allowDrop(){return sr(this).config.allowDrop}get allowDropLeft(){return sr(this).config.allowDropLeft}get allowDropTop(){return sr(this).config.allowDropTop}get allowDropRight(){return sr(this).config.allowDropRight}get allowDropBottom(){return sr(this).config.allowDropBottom}get allowExtract(){return sr(this).config.allowExtract}get allowWindowReorder(){return sr(this).config.allowWindowReorder}get showCloseButton(){return sr(this).config.showCloseButton}get showSaveButton(){return sr(this).config.showSaveButton}get allowWorkspaceTabReorder(){return sr(this).config.allowWorkspaceTabReorder}get allowWorkspaceTabExtract(){return sr(this).config.allowWorkspaceTabExtract}get minWidth(){return sr(this).config.minWidth}get minHeight(){return sr(this).config.minHeight}get maxWidth(){return sr(this).config.maxWidth}get maxHeight(){return sr(this).config.maxHeight}get width(){return sr(this).config.widthInPx}get height(){return sr(this).config.heightInPx}get showWindowCloseButtons(){return sr(this).config.showWindowCloseButtons}get showEjectButtons(){return sr(this).config.showEjectButtons}get showAddWindowButtons(){return sr(this).config.showAddWindowButtons}get isPinned(){return sr(this).config.isPinned}get windowDragMode(){return Gt()?sr(this).config.windowDragMode:"keepInside"}get loadingStrategy(){return Gt()||console.warn("The workspace.loadingStrategy property is not supported in IO Connect Browser"),sr(this).config.loadingStrategy}async setLoadingStrategy(e){if(!Gt())throw new Error("Not supported in IO Connect Browser");const t=sr(this).controller;await t.setLoadingStrategy(this.id,e),await this.refreshReference()}async removeChild(e){P(e);const t=this.children.find(e);t&&(await t.close(),await this.refreshReference())}async remove(e){P(e);const t=sr(this).controller.iterateFindChild(this.children,e);await t.close(),await this.refreshReference()}async focus(){await sr(this).controller.focusItem(this.id),await this.refreshReference()}async close(){const e=sr(this).controller,t=await sr(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 sr(this).controller.getSnapshot(this.id,"workspace")}async saveLayout(e,t){v.runWithException(e),await sr(this).controller.saveLayout({name:e,workspaceId:this.id,saveContext:t?.saveContext,metadata:t?.metadata,allowMultiple:t?.allowMultiple})}async setTitle(e){v.runWithException(e);const t=sr(this).controller;await t.setItemTitle(this.id,e),await this.refreshReference()}getContext(){return sr(this).controller.getWorkspaceContext(this.id)}setContext(e){return sr(this).controller.setWorkspaceContext(this.id,e)}updateContext(e){return sr(this).controller.updateWorkspaceContext(this.id,e)}onContextUpdated(e){return sr(this).controller.subscribeWorkspaceContextUpdated(this.id,e)}async refreshReference(){const e=await sr(this).controller.getSnapshot(this.id,"workspace"),t=sr(this).controller.flatChildren(sr(this).children),r=sr(this).controller.refreshChildren({existingChildren:t,workspace:this,parent:this,children:e.children}),o=this.frame;let n;if(o.id===e.config.frameId)cr(this).remapFrame(o,e.frameSummary),n=o;else{const t={summary:e.frameSummary};n=sr(this).ioc.getModel("frame",t)}cr(this).remapWorkspace(this,{config:e.config,children:r,frame:n})}async getIcon(){return sr(this).controller.getWorkspaceIcon(this.id)}async setIcon(e){return sr(this).controller.setWorkspaceIcon(this.id,e)}getBox(e){P(e);const t=sr(this).children;return sr(this).controller.iterateFindChild(t,(t=>"window"!==t.type&&e(t)))}getAllBoxes(e){P(e,!0);const t=sr(this).children,r=sr(this).controller.iterateFilterChildren(t,(e=>"window"!==e.type));return e?r.filter(e):r}getRow(e){return P(e),this.getBox((t=>"row"===t.type&&e(t)))}getAllRows(e){return P(e,!0),e?this.getAllBoxes((t=>"row"===t.type&&e(t))):this.getAllBoxes((e=>"row"===e.type))}getColumn(e){return P(e),this.getBox((t=>"column"===t.type&&e(t)))}getAllColumns(e){return P(e,!0),e?this.getAllBoxes((t=>"column"===t.type&&e(t))):this.getAllBoxes((e=>"column"===e.type))}getGroup(e){return P(e),this.getBox((t=>"group"===t.type&&e(t)))}getAllGroups(e){return P(e,!0),e?this.getAllBoxes((t=>"group"===t.type&&e(t))):this.getAllBoxes((e=>"group"===e.type))}getWindow(e){P(e);const t=sr(this).children;return sr(this).controller.iterateFindChild(t,(t=>"window"===t.type&&e(t)))}getAllWindows(e){P(e,!0);const t=sr(this).children,r=sr(this).controller.iterateFilterChildren(t,(e=>"window"===e.type));return e?r.filter(e):r}addRow(e){return sr(this).base.addParent(this,"row","workspace",e)}addColumn(e){return sr(this).base.addParent(this,"column","workspace",e)}addGroup(e){return sr(this).base.addParent(this,"group","workspace",e)}addWindow(e){return sr(this).base.addWindow(this,e,"workspace")}async bundleToRow(){await sr(this).controller.bundleWorkspaceTo("row",this.id),await this.refreshReference()}async bundleToColumn(){await sr(this).controller.bundleWorkspaceTo("column",this.id),await this.refreshReference()}async hibernate(){await sr(this).controller.hibernateWorkspace(this.id),await this.refreshReference()}async resume(){await sr(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:ut.runWithException(t);await sr(this).controller.lockWorkspace(this.id,r),await this.refreshReference()}async pin(e){vt.runWithException(e),await sr(this).controller.pinWorkspace(this.id,e?.icon),await this.refreshReference()}async unpin(){await sr(this).controller.unpinWorkspace(this.id),await this.refreshReference()}async showLoadingAnimation(){if(!Gt())throw new Error("Not supported in IO Connect Browser");await sr(this).controller.showWorkspaceLoadingAnimation(this.id)}async hideLoadingAnimation(){if(!Gt())throw new Error("Not supported in IO Connect Browser");await sr(this).controller.hideWorkspaceLoadingAnimation(this.id)}async setWindowDragMode(e){if(!Gt())throw new Error("Not supported in IO Connect Browser");B.runWithException(e),await sr(this).controller.setWindowDragMode(this.id,e),await this.refreshReference()}async onClosed(e){P(e);const t=sr(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 sr(this).controller.processLocalSubscription(r,t)}async onHibernated(e){P(e);const t=sr(this).id,r={action:"hibernated",eventType:"workspace",scope:"workspace",scopeId:t,callback:async()=>{await this.refreshReference(),e()}};return await sr(this).controller.processLocalSubscription(r,t)}async onResumed(e){P(e);const t=sr(this).id,r={action:"resumed",eventType:"workspace",scope:"workspace",scopeId:t,callback:async()=>{await this.refreshReference(),e()}};return await sr(this).controller.processLocalSubscription(r,t)}async onWindowAdded(e){P(e);const t=sr(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 sr(this).controller.processLocalSubscription(r,t)}async onWindowRemoved(e){P(e);const t=sr(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 sr(this).controller.processLocalSubscription(r,t)}async onWindowLoaded(e){P(e);const t=sr(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 sr(this).controller.processLocalSubscription(r,t)}async onWindowMaximized(e){P(e);const t=sr(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 sr(this).controller.processLocalSubscription(r,t)}async onWindowRestored(e){P(e);const t=sr(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 sr(this).controller.processLocalSubscription(r,t)}async onWindowSelected(e){P(e);const t=sr(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 sr(this).controller.processLocalSubscription(r,t)}async onLockConfigurationChanged(e){P(e);const t=sr(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 sr(this).controller.processLocalSubscription(r,t)}}const lr=new WeakMap,hr=e=>lr.get(e).manager.getWindowData(e);class ur{constructor(e){lr.set(this,{manager:e})}get id(){return hr(this).config.windowId}get elementId(){return hr(this).id}get type(){ret