UNPKG

@interopio/workspaces-api

Version:

IOConnect Workspaces API

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