Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@morgan-stanley/desktopjs

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@morgan-stanley/desktopjs - npm Package Compare versions

Comparing version 3.6.0 to 3.7.0

2

dist/desktop.min.js

@@ -1,2 +0,2 @@

!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n=n||self).desktopJS={})}(this,function(c){"use strict";var o=function(n,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)t.hasOwnProperty(e)&&(n[e]=t[e])})(n,t)};function s(n,t){function e(){this.constructor=n}o(n,t),n.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}function w(e,o){var i,r,a,n,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return n={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function t(t){return function(n){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,r&&(a=2&t[0]?r.return:t[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,t[1])).done)return a;switch(r=0,a&&(t=[2&t[0],a.value]),t[0]){case 0:case 1:a=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,r=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]<a[3])){s.label=t[1];break}if(6===t[0]&&s.label<a[1]){s.label=a[1],a=t;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(t);break}a[2]&&s.ops.pop(),s.trys.pop();continue}t=o.call(e,s)}catch(n){t=[6,n],r=0}finally{i=a=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,n])}}}var a=function(n,t,e){this.sender=n,this.name=t,this.innerEvent=e},i=function(){function r(){this.eventListeners=new Map,this.wrappedListeners=new Map}return r.prototype.addListener=function(n,t){return(this.eventListeners[n]=this.eventListeners[n]||[]).push(t),this},r.prototype.registerAndWrapListener=function(n,t){var e=this.wrapListener(n,t);return this.wrappedListeners.set(t,e),e},r.prototype.wrapListener=function(o,i){var r=this;return function(n){var t=new a(r,o,n);r.preProcessArgs(t);var e=i(t);return r.postProcessArgs(t),e}},r.prototype.preProcessArgs=function(n){},r.prototype.postProcessArgs=function(n){n&&void 0!==n.returnValue&&(n.innerEvent.returnValue=n.returnValue)},r.prototype.unwrapAndUnRegisterListener=function(n){var t=this.wrappedListeners.get(n);return t&&this.wrappedListeners.delete(n),t},r.prototype.removeListener=function(n,t){var e=this.listeners(n);if(e){var o=e.indexOf(t);0<=o&&e.splice(o,1)}return this},r.prototype.listeners=function(n){return this.eventListeners[n]||[]},r.prototype.emit=function(n,t){for(var e=0,o=this.listeners(n);e<o.length;e++){(0,o[e])(t)}},Object.defineProperty(r,"ipc",{set:function(n){n&&n.subscribe(r.staticEventName,function(n,t){r.emit(t.eventName,t.eventArgs)})},enumerable:!0,configurable:!0}),r.addListener=function(n,t){(this.staticEventListeners[n]=this.staticEventListeners[n]||[]).push(t)},r.removeListener=function(n,t){var e=r.listeners(n);if(e){var o=e.indexOf(t);0<=o&&e.splice(o,1)}},r.listeners=function(n){return this.staticEventListeners[n]||[]},r.emit=function(n,t,e){if(e&&e.publish)e.publish(r.staticEventName,{eventName:n,eventArgs:t});else for(var o=0,i=r.listeners(n);o<i.length;o++){(0,i[o])(t)}},r.staticEventListeners=new Map,r.staticEventName="desktopJS.static-event",r}(),p=function(){function n(){}return n.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=16*Math.random()|0;return("x"==n?t:3&t|8).toString(16)})},n}(),n=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return s(t,n),t}(a),h=function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return s(o,e),o.prototype.getInfo=function(){return Promise.resolve(void 0)},o.prototype.ready=function(){return Promise.resolve()},Object.defineProperty(o,"ipc",{get:function(){return o._ipc},set:function(n){i.ipc=o._ipc=n},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"ipc",{get:function(){return o.ipc},set:function(n){o.ipc=n},enumerable:!0,configurable:!0}),o.prototype.addListener=function(n,t){return e.prototype.addListener.call(this,n,t)},o.prototype.removeListener=function(n,t){return e.prototype.removeListener.call(this,n,t)},o.prototype.emit=function(n,t){e.prototype.emit.call(this,n,t)},o.addListener=function(n,t){i.addListener(o.staticEventScopePrefix+n,t)},o.removeListener=function(n,t){i.removeListener(o.staticEventScopePrefix+n,t)},o.emit=function(n,t){i.emit(o.staticEventScopePrefix+n,t,o.ipc)},o.listeners=function(n){return i.listeners(o.staticEventScopePrefix+n)},o.staticEventScopePrefix="container-",o.windowOptionsPropertyKey="desktopJS-options",o}(i),t=function(t){function r(){var n=null!==t&&t.apply(this,arguments)||this;return n.uuid=p.newGuid(),n.storage="undefined"!=typeof window&&window?window.localStorage:void 0,n}return s(r,t),r.prototype.showNotification=function(n,t){throw new TypeError("Notifications not supported by this container")},r.prototype.addTrayIcon=function(n,t,e){throw new TypeError("Tray icons are not supported by this container.")},r.prototype.getLayoutFromStorage=function(n){return JSON.parse(this.storage.getItem(r.layoutsPropertyKey))[n]},r.prototype.saveLayoutToStorage=function(n,t){var e=JSON.parse(this.storage.getItem(r.layoutsPropertyKey))||{};t.name||(t.name=n),e[n]=t,this.storage.setItem(r.layoutsPropertyKey,JSON.stringify(e)),this.emit("layout-saved",{sender:this,name:"layout-saved",layout:t,layoutName:t.name}),h.emit("layout-saved",{name:"layout-saved",layout:t,layoutName:t.name})},r.prototype.loadLayout=function(u){var c=this;return new Promise(function(a,s){c.closeAllWindows(!0).then(function(){var r="string"==typeof u?c.getLayoutFromStorage(u):u;if(r&&r.windows){for(var n=[],t=0,e=r.windows;t<e.length;t++){var o=e[t],i=Object.assign(o.options||{},o.bounds);i.name=o.name,o.main?(c.getMainWindow().setBounds(o.bounds),n.push(Promise.resolve(c.getMainWindow()))):n.push(c.createWindow(o.url,i))}Promise.all(n).then(function(n){var i=new Map;n.forEach(function(e){var n=r.windows.find(function(n){return n.name===e.name});n&&n.state&&e.setState&&e.setState(n.state).catch(function(n){return c.log("error","Error invoking setState: "+n)});var o=!1;if(i.forEach(function(n,t){!o&&0<=n.indexOf(e.id)&&(o=!0)}),!o){var t=n?n.group:void 0;t&&0<t.length&&i.set(e,t.filter(function(n){return n!==e.id}))}}),i.forEach(function(n,e){n.forEach(function(t){c.getWindowByName(r.windows.find(function(n){return n.id===t}).name).then(function(n){n.joinGroup(e)})})})}),c.emit("layout-loaded",{sender:c,name:"layout-loaded",layout:r,layoutName:r.name}),h.emit("layout-loaded",{name:"layout-loaded",layout:r,layoutName:r.name}),a(r)}else s("Layout does not exist or is invalid")})})},r.prototype.saveLayout=function(e){var o=this;return new Promise(function(t,n){o.buildLayout().then(function(n){o.saveLayoutToStorage(e,n),t(n)}).catch(n)})},r.prototype.getLayouts=function(){var i=this;return new Promise(function(n,t){var e=i.storage.getItem(r.layoutsPropertyKey);if(e){var o=JSON.parse(e);n(Object.getOwnPropertyNames(o).map(function(n){return o[n]}))}n(void 0)})},r.prototype.log=function(e,o){return new Promise(function(n){var t;switch(e){case"debug":t=console.debug;break;case"warn":t=console.warn;break;case"error":t=console.error;break;default:t=console.log}t&&t(o),n()})},r.layoutsPropertyKey="desktopJS-layouts",r}(h),r=function(t){function n(n){var e=t.call(this)||this;e.globalWindow=n||"undefined"!=typeof window&&window||null,e.linkHelper={href:"unknown"};try{e.linkHelper=e.globalWindow.top.document.createElement("a")}catch(n){}if(e.globalWindow){var o=e.globalWindow.open;e.globalWindow.open=function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return e.onOpen.apply(e,[o].concat(n))}}return e}return s(n,t),n.prototype.onOpen=function(n){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];return n.apply(this.globalWindow,t)},n.prototype.ensureAbsoluteUrl=function(n){return this.linkHelper?(this.linkHelper.href=n,this.linkHelper.href):n},n}(t),d=function(n,t,e){this.topic=n,this.listener=t,this.options=e},e=function(){},u=function(){},f=function(){},l=function(){function t(n,t){}return t.requestPermission=function(n){return n&&n(t.permission),Promise.resolve(t.permission)},t.permission="granted",t}(),y=function(){};(c.ObjectTransform||(c.ObjectTransform={})).transformProperties=function(n,t){var e={};if(n)for(var o in n)try{o in t?e[t[o].target]=t[o].convert?t[o].convert(n[o],n,e):n[o]:e[o]=n[o]}catch(n){console.error("Error transforming property '"+o+"'")}return e};var g,v=function(){function n(n,t,e,o){this.x=n,this.y=t,this.width=e,this.height=o}return Object.defineProperty(n.prototype,"right",{get:function(){return n.getRight(this)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"bottom",{get:function(){return n.getBottom(this)},enumerable:!0,configurable:!0}),n.getRight=function(n){return n.x+n.width},n.getBottom=function(n){return n.y+n.height},n}(),m=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return s(t,n),t}(a),b=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return s(t,n),t}(m),W=function(o){function e(n){var t=o.call(this)||this;return t.innerWindow=n,t}return s(e,o),Object.defineProperty(e.prototype,"allowGrouping",{get:function(){return!1},enumerable:!0,configurable:!0}),e.prototype.getGroup=function(){return Promise.resolve([])},e.prototype.joinGroup=function(n){return Promise.reject("Not supported")},e.prototype.leaveGroup=function(){return Promise.resolve()},e.prototype.bringToFront=function(){return this.focus()},e.prototype.getState=function(){return Promise.resolve(void 0)},e.prototype.setState=function(n){return Promise.resolve()},Object.defineProperty(e.prototype,"nativeWindow",{get:function(){},enumerable:!0,configurable:!0}),e.prototype.addListener=function(n,t){var e=this.registerAndWrapListener(n,t);return this.attachListener(n,e),o.prototype.addListener.call(this,n,e)},e.prototype.removeListener=function(n,t){var e=this.unwrapAndUnRegisterListener(t)||t;return this.detachListener(n,e),o.prototype.removeListener.call(this,n,e)},e.addListener=function(n,t){i.addListener(e.staticEventScopePrefix+n,t)},e.removeListener=function(n,t){i.removeListener(e.staticEventScopePrefix+n,t)},e.emit=function(n,t){i.emit(e.staticEventScopePrefix+n,t,h.ipc)},e.listeners=function(n){return i.listeners(e.staticEventScopePrefix+n)},e.staticEventScopePrefix="containerwindow-",e}(i),P=function(){},x=function(n){this.windows=[],this.name=n};function S(){return"undefined"!=typeof window&&window.fin}(g=c.WindowStateTracking||(c.WindowStateTracking={}))[g.None=0]="None",g[g.Main=1]="Main",g[g.Group=2]="Group";var L=function(){function n(n,t){this.windowStateTracking=c.WindowStateTracking.None,this.container=n,t&&"windowStateTracking"in t&&(this.windowStateTracking=t.windowStateTracking),this.attach()}return n.prototype.attach=function(n){var t=this;n?(n.addListener(S()?"minimized":"minimize",function(n){t.windowStateTracking&c.WindowStateTracking.Main&&t.container.getMainWindow().id===n.sender.id&&t.container.getAllWindows().then(function(n){n.forEach(function(n){return n.minimize()})}),t.windowStateTracking&c.WindowStateTracking.Group&&n.sender.getGroup().then(function(n){n.forEach(function(n){return n.minimize()})})}),n.addListener(S()?"restored":"restore",function(n){t.windowStateTracking&c.WindowStateTracking.Main&&t.container.getMainWindow().id===n.sender.id&&t.container.getAllWindows().then(function(n){n.forEach(function(n){return n.restore()})}),t.windowStateTracking&c.WindowStateTracking.Group&&n.sender.getGroup().then(function(n){n.forEach(function(n){return n.restore()})})})):(W.addListener("window-created",function(n){t.container&&t.container.getWindowById&&t.container.getWindowById(n.windowId).then(function(n){t.attach(n)})}),this.container&&this.container.getAllWindows().then(function(n){n.forEach(function(n){return t.attach(n)})}))},n}(),O=function(o){function n(n,t){var e=o.call(this,n,t)||this;return e.autoGrouping=!0,e.snapThreshold=15,e.snapOffset=15,e.targetGroup=new Map,t&&("snapThreshold"in t&&(e.snapThreshold=t.snapThreshold),"snapOffset"in t&&(e.snapOffset=t.snapOffset),"autoGrouping"in t&&(e.autoGrouping=t.autoGrouping)),e}return s(n,o),n.prototype.onAttached=function(n){var t=this;n.innerWindow&&n.innerWindow.disableFrame&&n.innerWindow.disableFrame(),S()?(n.addListener("disabled-frame-bounds-changed",function(){return t.onMoved(n)}),n.addListener("frame-enabled",function(){return n.innerWindow.disableFrame()})):n.innerWindow&&n.innerWindow.hookWindowMessage&&n.innerWindow.hookWindowMessage(562,function(){return t.onMoved(n)})},n.prototype.attach=function(t){var e=this;o.prototype.attach.call(this,t),t&&t.getOptions().then(function(n){n&&void 0!==n.snap&&!1===n.snap||(e.onAttached(t),t.addListener(S()?"disabled-frame-bounds-changing":"move",function(n){return e.onMoving(n)}))})},n.prototype.onMoving=function(s){var u=this,e=s.sender.id;this.snappingWindow!==e&&s.sender.getOptions().then(function(n){n&&void 0!==n.snap&&!1===n.snap||s.sender.getGroup().then(function(n){(S()?Promise.resolve(new v(s.innerEvent.left,s.innerEvent.top,s.innerEvent.width,s.innerEvent.height)):s.sender.getBounds()).then(function(a){if(0<n.length)S()&&u.moveWindow(s.sender,a);else{var t=[];u.container.getAllWindows().then(function(n){n.filter(function(n){return e!==n.id}).forEach(function(o){t.push(new Promise(function(e){o.getOptions().then(function(t){o.getBounds().then(function(n){return e({window:o,bounds:n,options:t})})})}))}),Promise.all(t).then(function(n){for(var t,e=!1,o=0,i=n.filter(function(n){return!(n.options&&void 0!==n.options.snap&&!1===n.options.snap)});o<i.length;o++){var r=i[o];(t=u.getSnapBounds(t||a,r.bounds))?(e=!0,u.showGroupingHint(r.window),u.moveWindow(s.sender,t)):u.hideGroupingHint(r.window)}!e&&S()&&u.moveWindow(s.sender,a)})})}})})})},n.prototype.moveWindow=function(n,t){var e=this;this.snappingWindow=n.id,n.setBounds(t).then(function(){return e.snappingWindow=void 0},function(){return e.snappingWindow=void 0})},n.prototype.onMoved=function(e){var t=this;if(this.autoGrouping){var n=[];this.targetGroup.forEach(function(e){return n.push(new Promise(function(t){e.getGroup().then(function(n){return t({window:e,isGrouped:0<n.length})})}))}),Promise.all(n).then(function(n){0<n.length&&e.joinGroup(n[0].window);for(var t=1;t<n.length;t++)n[t].isGrouped||n[t].window.joinGroup(e)})}this.targetGroup.forEach(function(n){return t.hideGroupingHint(n)}),this.targetGroup.clear()},n.prototype.showGroupingHint=function(n){n.innerWindow&&n.innerWindow.updateOptions&&n.innerWindow.updateOptions({opacity:.75}),this.targetGroup.set(n.id,n)},n.prototype.hideGroupingHint=function(n){n.innerWindow&&n.innerWindow.updateOptions&&n.innerWindow.updateOptions({opacity:1}),this.targetGroup.delete(n.id)},n.prototype.isHorizontallyAligned=function(n,t){return n.y>=t.y&&n.y<=t.bottom||n.bottom>=t.y&&n.bottom<=t.bottom||n.y<=t.y&&n.bottom>=t.bottom},n.prototype.isVerticallyAligned=function(n,t){return n.x>=t.x&&n.x<=t.right||n.right>=t.x&&n.right<=t.right||n.x<=t.x&&n.right>=t.right},n.prototype.getSnapBounds=function(n,t){var e,o,i,r,a,s,u,c;if(this.isHorizontallyAligned(n,t)&&(e=Math.abs(n.x-(t.right-this.snapOffset))<this.snapThreshold,o=Math.abs(n.x-t.x)<this.snapThreshold,i=Math.abs(n.right-this.snapOffset-t.x)<this.snapThreshold,r=Math.abs(n.right-t.right)<this.snapThreshold),this.isVerticallyAligned(n,t)&&(a=Math.abs(n.y-(t.bottom-this.snapOffset))<this.snapThreshold,s=Math.abs(n.y-t.y)<this.snapThreshold,u=Math.abs(n.bottom-this.snapOffset-t.y)<this.snapThreshold,c=Math.abs(n.bottom-t.bottom)<this.snapThreshold),e||i||a||u){var p=n.x,d=n.y;return e?p=t.x+t.width-this.snapOffset:o&&(p=t.x),i?p=t.x-n.width+this.snapOffset:r&&(p=t.x+t.width-n.width),a?d=t.y+t.height-Math.floor(this.snapOffset/2):s&&(d=t.y),u?d=t.y-n.height+Math.floor(this.snapOffset/2):c&&(d=t.y+t.height-n.height),new v(p,d,n.width,n.height)}},n}(L),E=function(){},M=function(){};!function(n){var e={close:"unload"},t=function(t){function n(n){return t.call(this,n)||this}return s(n,t),Object.defineProperty(n.prototype,"id",{get:function(){return this.innerWindow[a.windowUuidPropertyKey]},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"name",{get:function(){return this.innerWindow[a.windowNamePropertyKey]},enumerable:!0,configurable:!0}),n.prototype.load=function(t,n){var e=this;return new Promise(function(n){e.innerWindow.location.replace(t),n()})},n.prototype.focus=function(){return this.innerWindow.focus(),Promise.resolve()},n.prototype.show=function(){return Promise.resolve()},n.prototype.hide=function(){return Promise.resolve()},n.prototype.close=function(){return this.innerWindow.close(),Promise.resolve()},n.prototype.minimize=function(){var t=this;return new Promise(function(n){t.innerWindow.minimize(),n()})},n.prototype.maximize=function(){var t=this;return new Promise(function(n){t.innerWindow.maximize(),n()})},n.prototype.restore=function(){var t=this;return new Promise(function(n){t.innerWindow.restore(),n()})},n.prototype.isShowing=function(){return Promise.resolve(!0)},n.prototype.getSnapshot=function(){return Promise.reject("getSnapshot requires an implementation.")},n.prototype.flash=function(n,t){return Promise.reject("Not supported")},n.prototype.getBounds=function(){var t=this;return new Promise(function(n){n(new v(t.innerWindow.screenX,t.innerWindow.screenY,t.innerWindow.outerWidth,t.innerWindow.outerHeight))})},n.prototype.setBounds=function(t){var e=this;return new Promise(function(n){e.innerWindow.moveTo(t.x,t.y),e.innerWindow.resizeTo(t.width,t.height),n()})},n.prototype.getOptions=function(){var e=this;return new Promise(function(n,t){n(e.innerWindow[h.windowOptionsPropertyKey])})},n.prototype.getState=function(){var t=this;return new Promise(function(n){t.nativeWindow&&t.nativeWindow.getState?n(t.nativeWindow.getState()):n(void 0)})},n.prototype.setState=function(t){var e=this;return new Promise(function(n){e.nativeWindow&&e.nativeWindow.setState&&e.nativeWindow.setState(t),n()}).then(function(){e.emit("state-changed",{name:"state-changed",sender:e,state:t}),W.emit("state-changed",{name:"state-changed",windowId:e.id,state:t})})},n.prototype.attachListener=function(n,t){this.innerWindow.addEventListener(e[n]||n,t)},n.prototype.detachListener=function(n,t){this.innerWindow.removeEventListener(e[n]||n,t)},Object.defineProperty(n.prototype,"nativeWindow",{get:function(){return this.innerWindow},enumerable:!0,configurable:!0}),n}(W);n.DefaultContainerWindow=t;var o=function(){function u(n){this.container=n}return u.prototype.subscribe=function(r,a,n){var s=this;return new Promise(function(n,t){var e=new d(r,function(n){if(n.origin===s.container.globalWindow.location.origin){var t=n.data,e=t.source,o=t.topic,i=t.message;e===u.messageSource&&r===o&&a({topic:r},i)}});s.container.globalWindow&&s.container.globalWindow.addEventListener&&s.container.globalWindow.addEventListener("message",e.listener),n(e)})},u.prototype.unsubscribe=function(n){return Promise.resolve(this.container.globalWindow.removeEventListener("message",n.listener))},u.prototype.publish=function(n,t,e){var o=this.container.globalWindow?this.container.globalWindow[a.windowsPropertyKey]||this.container.globalWindow.opener&&this.container.globalWindow.opener[a.windowsPropertyKey]:[];if(o)for(var i in o){var r=o[i];e&&e.name&&e.name!==r[a.windowNamePropertyKey]||r.location.origin===this.container.globalWindow.location.origin&&r.postMessage({source:u.messageSource,topic:n,message:t},this.container.globalWindow.location.origin)}return Promise.resolve()},u.messageSource="desktopJS",u}();n.DefaultMessageBus=o;var a=function(e){function u(n){var t=e.call(this,n)||this;return t.windowOptionsMap=u.defaultWindowOptionsMap,t.hostType="Default",t.ipc=t.createMessageBus(),!t.globalWindow||u.windowsPropertyKey in t.globalWindow||(t.globalWindow[u.windowsPropertyKey]={root:t.globalWindow},t.globalWindow[u.windowNamePropertyKey]=t.globalWindow[u.windowUuidPropertyKey]=u.rootWindowUuid),t.screen=new i(t.globalWindow),t}return s(u,e),u.prototype.createMessageBus=function(){return new o(this)},u.prototype.getInfo=function(){return Promise.resolve(this.globalWindow.navigator.appVersion)},u.prototype.getMainWindow=function(){if(!this.mainWindow){var n=this.globalWindow[u.windowsPropertyKey].root;this.mainWindow=n?this.wrapWindow(n):null}return this.mainWindow},u.prototype.getCurrentWindow=function(){return this.wrapWindow(this.globalWindow)},u.prototype.getWindowOptions=function(n){return c.ObjectTransform.transformProperties(n,this.windowOptionsMap)},u.prototype.wrapWindow=function(n){return new t(n)},u.prototype.onOpen=function(n){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];var o=n.apply(this.globalWindow,t),i=this.globalWindow[u.windowsPropertyKey],r=o[u.windowUuidPropertyKey]=p.newGuid();return(i[r]=o).addEventListener("beforeunload",function(){o.addEventListener("unload",function(){delete i[r]})}),o[u.windowsPropertyKey]=i,h.emit("window-created",{name:"window-created",windowId:r}),W.emit("window-created",{name:"window-created",windowId:r}),o},u.prototype.createWindow=function(n,t){var e,o="_blank",i=this.getWindowOptions(t);if(i){for(var r in i)e=(e||"")+r+"="+i[r]+",";i&&"target"in i&&(o=i.target)}var a=this.globalWindow.open(n,o,e);a[h.windowOptionsPropertyKey]=t,a[u.windowNamePropertyKey]=i.name;var s=this.wrapWindow(a);return this.emit("window-created",{sender:this,name:"window-created",window:s,windowId:s.id,windowName:i.name}),Promise.resolve(s)},u.prototype.showNotification=function(t,e){var o=this;"Notification"in this.globalWindow?this.globalWindow.Notification.requestPermission(function(n){"denied"===n?console.warn("Notifications not permitted"):"granted"===n&&new o.globalWindow.Notification(t,e)}):console.warn("Notifications not supported")},u.prototype.closeAllWindows=function(r){var a=this;return new Promise(function(n,t){var e=a.globalWindow[u.windowsPropertyKey];for(var o in e){var i=e[o];r&&a.globalWindow===i||i.close()}n()})},u.prototype.getAllWindows=function(){var r=this;return new Promise(function(n,t){var e=[],o=r.globalWindow[u.windowsPropertyKey];for(var i in o)e.push(r.wrapWindow(o[i]));n(e)})},u.prototype.getWindowById=function(o){var i=this;return new Promise(function(n,t){var e=i.globalWindow[u.windowsPropertyKey][o];n(e?i.wrapWindow(e):null)})},u.prototype.getWindowByName=function(i){var r=this;return new Promise(function(n,t){var e=r.globalWindow[u.windowsPropertyKey];for(var o in e)if(e[o][u.windowNamePropertyKey]===i)return void n(r.wrapWindow(e[o]));n(null)})},u.prototype.buildLayout=function(){var f=this,l=new x;return new Promise(function(t,e){var o=[];f.getAllWindows().then(function(n){n.forEach(function(c){var p=c.nativeWindow,d=p[h.windowOptionsPropertyKey];d&&"persist"in d&&!d.persist||o.push(new Promise(function(i){return r=f,u=function(){var t,e,o;return w(this,function(n){switch(n.label){case 0:return this.globalWindow===p?[3,2]:(e=(t=l.windows).push,o={name:c.name,url:p&&p.location?p.location.toString():void 0,id:c.id,bounds:{x:p.screenX,y:p.screenY,width:p.outerWidth,height:p.outerHeight},options:d},[4,c.getState()]);case 1:e.apply(t,[(o.state=n.sent(),o)]),n.label=2;case 2:return i(),[2]}})},new((s=a=void 0)||(s=Promise))(function(n,t){function e(n){try{i(u.next(n))}catch(n){t(n)}}function o(n){try{i(u.throw(n))}catch(n){t(n)}}function i(t){t.done?n(t.value):new s(function(n){n(t.value)}).then(e,o)}i((u=u.apply(r,a||[])).next())});var r,a,s,u}))}),Promise.all(o).then(function(){t(l)}).catch(e)})})},u.windowsPropertyKey="desktopJS-windows",u.windowUuidPropertyKey="desktopJS-uuid",u.windowNamePropertyKey="desktopJS-name",u.rootWindowUuid="root",u.defaultWindowOptionsMap={x:{target:"left"},y:{target:"top"}},u}(r);n.DefaultContainer=a;var i=function(){function n(n){this.window=n}return n.prototype.getPrimaryDisplay=function(){var e=this;return new Promise(function(n){var t=new M;t.scaleFactor=e.window.devicePixelRatio,t.id="Current",t.bounds=new v(e.window.screen.availLeft,e.window.screen.availTop,e.window.screen.width,e.window.screen.height),t.workArea=new v(e.window.screen.availLeft,e.window.screen.availTop,e.window.screen.availWidth,e.window.screen.availHeight),n(t)})},n.prototype.getAllDisplays=function(){var n=this;return new Promise(function(t){n.getPrimaryDisplay().then(function(n){return t([n])})})},n.prototype.getMousePosition=function(){var e=this;return new Promise(function(n,t){n({x:e.window.event.screenX,y:e.window.event.screenY})})},n}()}(c.Default||(c.Default={}));var T=function(){},k=[];var G=function(){},N=function(){};c.Container=h,c.ContainerBase=t,c.ContainerNotification=l,c.ContainerRegistration=T,c.ContainerWindow=W,c.Display=M,c.EventArgs=a,c.EventEmitter=i,c.GlobalShortcutManager=N,c.GroupWindowManager=L,c.Guid=p,c.LayoutEventArgs=n,c.MenuItem=u,c.MessageBusOptions=e,c.MessageBusSubscription=d,c.NotificationOptions=f,c.PersistedWindow=P,c.PersistedWindowLayout=x,c.Point=E,c.PropertyMap=y,c.Rectangle=v,c.SnapAssistWindowManager=O,c.TrayIconDetails=G,c.WebContainerBase=r,c.WindowEventArgs=m,c.WindowGroupEventArgs=b,c.clearRegistry=function(){k.splice(0,k.length),c.container=void 0},c.registerContainer=function(n,t){k.push({id:n,registration:t})},c.resolveContainer=function(n,t){var e,o,i=!1,r=t;if("boolean"==typeof n?i=n:r=n,!i&&c.container)return c.container;try{for(var a=0;a<k.length;a++){o=k[a].id;var s=k[a].registration;e=s.condition(r)?s:e}c.container=e.create(r)}catch(n){console.error("Error resolving container '"+o+"' : "+n.toString())}finally{c.container=c.container||new c.Default.DefaultContainer}return c.container},c.version="3.6.0",Object.defineProperty(c,"__esModule",{value:!0})});
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).desktopJS={})}(this,function(c){"use strict";var o=function(t,n){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e])})(t,n)};function s(t,n){function e(){this.constructor=t}o(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}function w(e,o){var i,r,a,t,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return t={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function n(n){return function(t){return function(n){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,r&&(a=2&n[0]?r.return:n[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,n[1])).done)return a;switch(r=0,a&&(n=[2&n[0],a.value]),n[0]){case 0:case 1:a=n;break;case 4:return s.label++,{value:n[1],done:!1};case 5:s.label++,r=n[1],n=[0];continue;case 7:n=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===n[0]||2===n[0])){s=0;continue}if(3===n[0]&&(!a||n[1]>a[0]&&n[1]<a[3])){s.label=n[1];break}if(6===n[0]&&s.label<a[1]){s.label=a[1],a=n;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(n);break}a[2]&&s.ops.pop(),s.trys.pop();continue}n=o.call(e,s)}catch(t){n=[6,t],r=0}finally{i=a=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,t])}}}var a=function(t,n,e){this.sender=t,this.name=n,this.innerEvent=e},i=function(){function r(){this.eventListeners=new Map,this.wrappedListeners=new Map}return r.prototype.addListener=function(t,n){return(this.eventListeners[t]=this.eventListeners[t]||[]).push(n),this},r.prototype.registerAndWrapListener=function(t,n){var e=this.wrapListener(t,n);return this.wrappedListeners.set(n,e),e},r.prototype.wrapListener=function(o,i){var r=this;return function(t){var n=new a(r,o,t);r.preProcessArgs(n);var e=i(n);return r.postProcessArgs(n),e}},r.prototype.preProcessArgs=function(t){},r.prototype.postProcessArgs=function(t){t&&void 0!==t.returnValue&&(t.innerEvent.returnValue=t.returnValue)},r.prototype.unwrapAndUnRegisterListener=function(t){var n=this.wrappedListeners.get(t);return n&&this.wrappedListeners.delete(t),n},r.prototype.removeListener=function(t,n){var e=this.listeners(t);if(e){var o=e.indexOf(n);0<=o&&e.splice(o,1)}return this},r.prototype.listeners=function(t){return this.eventListeners[t]||[]},r.prototype.emit=function(t,n){for(var e=0,o=this.listeners(t);e<o.length;e++){(0,o[e])(n)}},Object.defineProperty(r,"ipc",{set:function(t){t&&t.subscribe(r.staticEventName,function(t,n){r.emit(n.eventName,n.eventArgs)})},enumerable:!0,configurable:!0}),r.addListener=function(t,n){(this.staticEventListeners[t]=this.staticEventListeners[t]||[]).push(n)},r.removeListener=function(t,n){var e=r.listeners(t);if(e){var o=e.indexOf(n);0<=o&&e.splice(o,1)}},r.listeners=function(t){return this.staticEventListeners[t]||[]},r.emit=function(t,n,e){if(e&&e.publish)e.publish(r.staticEventName,{eventName:t,eventArgs:n});else for(var o=0,i=r.listeners(t);o<i.length;o++){(0,i[o])(n)}},r.staticEventListeners=new Map,r.staticEventName="desktopJS.static-event",r}(),p=function(){function t(){}return t.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=16*Math.random()|0;return("x"==t?n:3&n|8).toString(16)})},t}(),t=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return s(n,t),n}(a),h=function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return s(o,e),o.prototype.getInfo=function(){return Promise.resolve(void 0)},o.prototype.ready=function(){return Promise.resolve()},Object.defineProperty(o,"ipc",{get:function(){return o._ipc},set:function(t){i.ipc=o._ipc=t},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"ipc",{get:function(){return o.ipc},set:function(t){o.ipc=t},enumerable:!0,configurable:!0}),o.prototype.addListener=function(t,n){return e.prototype.addListener.call(this,t,n)},o.prototype.removeListener=function(t,n){return e.prototype.removeListener.call(this,t,n)},o.prototype.emit=function(t,n){e.prototype.emit.call(this,t,n)},o.addListener=function(t,n){i.addListener(o.staticEventScopePrefix+t,n)},o.removeListener=function(t,n){i.removeListener(o.staticEventScopePrefix+t,n)},o.emit=function(t,n){i.emit(o.staticEventScopePrefix+t,n,o.ipc)},o.listeners=function(t){return i.listeners(o.staticEventScopePrefix+t)},o.staticEventScopePrefix="container-",o.windowOptionsPropertyKey="desktopJS-options",o}(i),n=function(n){function r(){var t=null!==n&&n.apply(this,arguments)||this;return t.uuid=p.newGuid(),t.storage="undefined"!=typeof window&&window?window.localStorage:void 0,t}return s(r,n),r.prototype.showNotification=function(t,n){throw new TypeError("Notifications not supported by this container")},r.prototype.addTrayIcon=function(t,n,e){throw new TypeError("Tray icons are not supported by this container.")},r.prototype.getLayoutFromStorage=function(t){return JSON.parse(this.storage.getItem(r.layoutsPropertyKey))[t]},r.prototype.saveLayoutToStorage=function(t,n){var e=JSON.parse(this.storage.getItem(r.layoutsPropertyKey))||{};n.name||(n.name=t),e[t]=n,this.storage.setItem(r.layoutsPropertyKey,JSON.stringify(e)),this.emit("layout-saved",{sender:this,name:"layout-saved",layout:n,layoutName:n.name}),h.emit("layout-saved",{name:"layout-saved",layout:n,layoutName:n.name})},r.prototype.deleteLayoutFromStorage=function(t){var n=JSON.parse(this.storage.getItem(r.layoutsPropertyKey))||{},e=n[t];e&&(delete n[t],this.storage.setItem(r.layoutsPropertyKey,JSON.stringify(n)),this.emit("layout-deleted",{sender:this,name:"layout-deleted",layoutName:e.name}),h.emit("layout-deleted",{name:"layout-deleted",layoutName:e.name}))},r.prototype.loadLayout=function(u){var c=this;return new Promise(function(a,s){c.closeAllWindows(!0).then(function(){var r="string"==typeof u?c.getLayoutFromStorage(u):u;if(r&&r.windows){for(var t=[],n=0,e=r.windows;n<e.length;n++){var o=e[n],i=Object.assign(o.options||{},o.bounds);i.name=o.name,o.main?(c.getMainWindow().setBounds(o.bounds),t.push(Promise.resolve(c.getMainWindow()))):t.push(c.createWindow(o.url,i))}Promise.all(t).then(function(t){var i=new Map;t.forEach(function(e){var t=r.windows.find(function(t){return t.name===e.name});t&&t.state&&e.setState&&e.setState(t.state).catch(function(t){return c.log("error","Error invoking setState: "+t)});var o=!1;if(i.forEach(function(t,n){!o&&0<=t.indexOf(e.id)&&(o=!0)}),!o){var n=t?t.group:void 0;n&&0<n.length&&i.set(e,n.filter(function(t){return t!==e.id}))}}),i.forEach(function(t,e){t.forEach(function(n){c.getWindowByName(r.windows.find(function(t){return t.id===n}).name).then(function(t){t.joinGroup(e)})})})}),c.emit("layout-loaded",{sender:c,name:"layout-loaded",layout:r,layoutName:r.name}),h.emit("layout-loaded",{name:"layout-loaded",layout:r,layoutName:r.name}),a(r)}else s("Layout does not exist or is invalid")})})},r.prototype.saveLayout=function(e){var o=this;return new Promise(function(n,t){o.buildLayout().then(function(t){o.saveLayoutToStorage(e,t),n(t)}).catch(t)})},r.prototype.deleteLayout=function(e){var o=this;return new Promise(function(t,n){t(o.deleteLayoutFromStorage(e))})},r.prototype.getLayouts=function(){var i=this;return new Promise(function(t,n){var e=i.storage.getItem(r.layoutsPropertyKey);if(e){var o=JSON.parse(e);t(Object.getOwnPropertyNames(o).map(function(t){return o[t]}))}t(void 0)})},r.prototype.log=function(e,o){return new Promise(function(t){var n;switch(e){case"debug":n=console.debug;break;case"warn":n=console.warn;break;case"error":n=console.error;break;default:n=console.log}n&&n(o),t()})},r.layoutsPropertyKey="desktopJS-layouts",r}(h),r=function(n){function t(t){var e=n.call(this)||this;e.globalWindow=t||"undefined"!=typeof window&&window||null,e.linkHelper={href:"unknown"};try{e.linkHelper=e.globalWindow.top.document.createElement("a")}catch(t){}if(e.globalWindow){var o=e.globalWindow.open;e.globalWindow.open=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.onOpen.apply(e,function(){for(var t=0,n=0,e=arguments.length;n<e;n++)t+=arguments[n].length;var o=Array(t),i=0;for(n=0;n<e;n++)for(var r=arguments[n],a=0,s=r.length;a<s;a++,i++)o[i]=r[a];return o}([o],t))}}return e}return s(t,n),t.prototype.onOpen=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return t.apply(this.globalWindow,n)},t.prototype.ensureAbsoluteUrl=function(t){return this.linkHelper?(this.linkHelper.href=t,this.linkHelper.href):t},t}(n),d=function(t,n,e){this.topic=t,this.listener=n,this.options=e},e=function(){},u=function(){},f=function(){},l=function(){function n(t,n){}return n.requestPermission=function(t){return t&&t(n.permission),Promise.resolve(n.permission)},n.permission="granted",n}(),y=function(){};(c.ObjectTransform||(c.ObjectTransform={})).transformProperties=function(t,n){var e={};if(t)for(var o in t)try{o in n?e[n[o].target]=n[o].convert?n[o].convert(t[o],t,e):t[o]:e[o]=t[o]}catch(t){console.error("Error transforming property '"+o+"'")}return e};var g,v=function(){function t(t,n,e,o){this.x=t,this.y=n,this.width=e,this.height=o}return Object.defineProperty(t.prototype,"right",{get:function(){return t.getRight(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return t.getBottom(this)},enumerable:!0,configurable:!0}),t.getRight=function(t){return t.x+t.width},t.getBottom=function(t){return t.y+t.height},t}(),m=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return s(n,t),n}(a),b=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return s(n,t),n}(m),W=function(o){function e(t){var n=o.call(this)||this;return n.innerWindow=t,n}return s(e,o),Object.defineProperty(e.prototype,"allowGrouping",{get:function(){return!1},enumerable:!0,configurable:!0}),e.prototype.getGroup=function(){return Promise.resolve([])},e.prototype.joinGroup=function(t){return Promise.reject("Not supported")},e.prototype.leaveGroup=function(){return Promise.resolve()},e.prototype.bringToFront=function(){return this.focus()},e.prototype.getState=function(){return Promise.resolve(void 0)},e.prototype.setState=function(t){return Promise.resolve()},Object.defineProperty(e.prototype,"nativeWindow",{get:function(){},enumerable:!0,configurable:!0}),e.prototype.addListener=function(t,n){var e=this.registerAndWrapListener(t,n);return this.attachListener(t,e),o.prototype.addListener.call(this,t,e)},e.prototype.removeListener=function(t,n){var e=this.unwrapAndUnRegisterListener(n)||n;return this.detachListener(t,e),o.prototype.removeListener.call(this,t,e)},e.addListener=function(t,n){i.addListener(e.staticEventScopePrefix+t,n)},e.removeListener=function(t,n){i.removeListener(e.staticEventScopePrefix+t,n)},e.emit=function(t,n){i.emit(e.staticEventScopePrefix+t,n,h.ipc)},e.listeners=function(t){return i.listeners(e.staticEventScopePrefix+t)},e.staticEventScopePrefix="containerwindow-",e}(i),P=function(){},x=function(t){this.windows=[],this.name=t};function S(){return"undefined"!=typeof window&&window.fin}(g=c.WindowStateTracking||(c.WindowStateTracking={}))[g.None=0]="None",g[g.Main=1]="Main",g[g.Group=2]="Group";var L=function(){function t(t,n){this.windowStateTracking=c.WindowStateTracking.None,this.container=t,n&&"windowStateTracking"in n&&(this.windowStateTracking=n.windowStateTracking),this.attach()}return t.prototype.attach=function(t){var n=this;t?(t.addListener(S()?"minimized":"minimize",function(t){n.windowStateTracking&c.WindowStateTracking.Main&&n.container.getMainWindow().id===t.sender.id&&n.container.getAllWindows().then(function(t){t.forEach(function(t){return t.minimize()})}),n.windowStateTracking&c.WindowStateTracking.Group&&t.sender.getGroup().then(function(t){t.forEach(function(t){return t.minimize()})})}),t.addListener(S()?"restored":"restore",function(t){n.windowStateTracking&c.WindowStateTracking.Main&&n.container.getMainWindow().id===t.sender.id&&n.container.getAllWindows().then(function(t){t.forEach(function(t){return t.restore()})}),n.windowStateTracking&c.WindowStateTracking.Group&&t.sender.getGroup().then(function(t){t.forEach(function(t){return t.restore()})})})):(W.addListener("window-created",function(t){n.container&&n.container.getWindowById&&n.container.getWindowById(t.windowId).then(function(t){n.attach(t)})}),this.container&&this.container.getAllWindows().then(function(t){t.forEach(function(t){return n.attach(t)})}))},t}(),O=function(o){function t(t,n){var e=o.call(this,t,n)||this;return e.autoGrouping=!0,e.snapThreshold=15,e.snapOffset=15,e.targetGroup=new Map,n&&("snapThreshold"in n&&(e.snapThreshold=n.snapThreshold),"snapOffset"in n&&(e.snapOffset=n.snapOffset),"autoGrouping"in n&&(e.autoGrouping=n.autoGrouping)),e}return s(t,o),t.prototype.onAttached=function(t){var n=this;t.innerWindow&&t.innerWindow.disableFrame&&t.innerWindow.disableFrame(),S()?(t.addListener("disabled-frame-bounds-changed",function(){return n.onMoved(t)}),t.addListener("frame-enabled",function(){return t.innerWindow.disableFrame()})):t.innerWindow&&t.innerWindow.hookWindowMessage&&t.innerWindow.hookWindowMessage(562,function(){return n.onMoved(t)})},t.prototype.attach=function(n){var e=this;o.prototype.attach.call(this,n),n&&n.getOptions().then(function(t){t&&void 0!==t.snap&&!1===t.snap||(e.onAttached(n),n.addListener(S()?"disabled-frame-bounds-changing":"move",function(t){return e.onMoving(t)}))})},t.prototype.onMoving=function(s){var u=this,e=s.sender.id;this.snappingWindow!==e&&s.sender.getOptions().then(function(t){t&&void 0!==t.snap&&!1===t.snap||s.sender.getGroup().then(function(t){(S()?Promise.resolve(new v(s.innerEvent.left,s.innerEvent.top,s.innerEvent.width,s.innerEvent.height)):s.sender.getBounds()).then(function(a){if(0<t.length)S()&&u.moveWindow(s.sender,a);else{var n=[];u.container.getAllWindows().then(function(t){t.filter(function(t){return e!==t.id}).forEach(function(o){n.push(new Promise(function(e){o.getOptions().then(function(n){o.getBounds().then(function(t){return e({window:o,bounds:t,options:n})})})}))}),Promise.all(n).then(function(t){for(var n,e=!1,o=0,i=t.filter(function(t){return!(t.options&&void 0!==t.options.snap&&!1===t.options.snap)});o<i.length;o++){var r=i[o];(n=u.getSnapBounds(n||a,r.bounds))?(e=!0,u.showGroupingHint(r.window),u.moveWindow(s.sender,n)):u.hideGroupingHint(r.window)}!e&&S()&&u.moveWindow(s.sender,a)})})}})})})},t.prototype.moveWindow=function(t,n){var e=this;this.snappingWindow=t.id,t.setBounds(n).then(function(){return e.snappingWindow=void 0},function(){return e.snappingWindow=void 0})},t.prototype.onMoved=function(e){var n=this;if(this.autoGrouping){var t=[];this.targetGroup.forEach(function(e){return t.push(new Promise(function(n){e.getGroup().then(function(t){return n({window:e,isGrouped:0<t.length})})}))}),Promise.all(t).then(function(t){0<t.length&&e.joinGroup(t[0].window);for(var n=1;n<t.length;n++)t[n].isGrouped||t[n].window.joinGroup(e)})}this.targetGroup.forEach(function(t){return n.hideGroupingHint(t)}),this.targetGroup.clear()},t.prototype.showGroupingHint=function(t){t.innerWindow&&t.innerWindow.updateOptions&&t.innerWindow.updateOptions({opacity:.75}),this.targetGroup.set(t.id,t)},t.prototype.hideGroupingHint=function(t){t.innerWindow&&t.innerWindow.updateOptions&&t.innerWindow.updateOptions({opacity:1}),this.targetGroup.delete(t.id)},t.prototype.isHorizontallyAligned=function(t,n){return t.y>=n.y&&t.y<=n.bottom||t.bottom>=n.y&&t.bottom<=n.bottom||t.y<=n.y&&t.bottom>=n.bottom},t.prototype.isVerticallyAligned=function(t,n){return t.x>=n.x&&t.x<=n.right||t.right>=n.x&&t.right<=n.right||t.x<=n.x&&t.right>=n.right},t.prototype.getSnapBounds=function(t,n){var e,o,i,r,a,s,u,c;if(this.isHorizontallyAligned(t,n)&&(e=Math.abs(t.x-(n.right-this.snapOffset))<this.snapThreshold,o=Math.abs(t.x-n.x)<this.snapThreshold,i=Math.abs(t.right-this.snapOffset-n.x)<this.snapThreshold,r=Math.abs(t.right-n.right)<this.snapThreshold),this.isVerticallyAligned(t,n)&&(a=Math.abs(t.y-(n.bottom-this.snapOffset))<this.snapThreshold,s=Math.abs(t.y-n.y)<this.snapThreshold,u=Math.abs(t.bottom-this.snapOffset-n.y)<this.snapThreshold,c=Math.abs(t.bottom-n.bottom)<this.snapThreshold),e||i||a||u){var p=t.x,d=t.y;return e?p=n.x+n.width-this.snapOffset:o&&(p=n.x),i?p=n.x-t.width+this.snapOffset:r&&(p=n.x+n.width-t.width),a?d=n.y+n.height-Math.floor(this.snapOffset/2):s&&(d=n.y),u?d=n.y-t.height+Math.floor(this.snapOffset/2):c&&(d=n.y+n.height-t.height),new v(p,d,t.width,t.height)}},t}(L),E=function(){},M=function(){};!function(t){var e={close:"unload"},n=function(n){function t(t){return n.call(this,t)||this}return s(t,n),Object.defineProperty(t.prototype,"id",{get:function(){return this.innerWindow[a.windowUuidPropertyKey]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this.innerWindow[a.windowNamePropertyKey]},enumerable:!0,configurable:!0}),t.prototype.load=function(n,t){var e=this;return new Promise(function(t){e.innerWindow.location.replace(n),t()})},t.prototype.focus=function(){return this.innerWindow.focus(),Promise.resolve()},t.prototype.show=function(){return Promise.resolve()},t.prototype.hide=function(){return Promise.resolve()},t.prototype.close=function(){return this.innerWindow.close(),Promise.resolve()},t.prototype.minimize=function(){var n=this;return new Promise(function(t){n.innerWindow.minimize(),t()})},t.prototype.maximize=function(){var n=this;return new Promise(function(t){n.innerWindow.maximize(),t()})},t.prototype.restore=function(){var n=this;return new Promise(function(t){n.innerWindow.restore(),t()})},t.prototype.isShowing=function(){return Promise.resolve(!0)},t.prototype.getSnapshot=function(){return Promise.reject("getSnapshot requires an implementation.")},t.prototype.flash=function(t,n){return Promise.reject("Not supported")},t.prototype.getBounds=function(){var n=this;return new Promise(function(t){t(new v(n.innerWindow.screenX,n.innerWindow.screenY,n.innerWindow.outerWidth,n.innerWindow.outerHeight))})},t.prototype.setBounds=function(n){var e=this;return new Promise(function(t){e.innerWindow.moveTo(n.x,n.y),e.innerWindow.resizeTo(n.width,n.height),t()})},t.prototype.getOptions=function(){var e=this;return new Promise(function(t,n){t(e.innerWindow[h.windowOptionsPropertyKey])})},t.prototype.getState=function(){var n=this;return new Promise(function(t){n.nativeWindow&&n.nativeWindow.getState?t(n.nativeWindow.getState()):t(void 0)})},t.prototype.setState=function(n){var e=this;return new Promise(function(t){e.nativeWindow&&e.nativeWindow.setState&&e.nativeWindow.setState(n),t()}).then(function(){e.emit("state-changed",{name:"state-changed",sender:e,state:n}),W.emit("state-changed",{name:"state-changed",windowId:e.id,state:n})})},t.prototype.attachListener=function(t,n){this.innerWindow.addEventListener(e[t]||t,n)},t.prototype.detachListener=function(t,n){this.innerWindow.removeEventListener(e[t]||t,n)},Object.defineProperty(t.prototype,"nativeWindow",{get:function(){return this.innerWindow},enumerable:!0,configurable:!0}),t}(W);t.DefaultContainerWindow=n;var o=function(){function u(t){this.container=t}return u.prototype.subscribe=function(r,a,t){var s=this;return new Promise(function(t,n){var e=new d(r,function(t){if(t.origin===s.container.globalWindow.location.origin){var n=t.data,e=n.source,o=n.topic,i=n.message;e===u.messageSource&&r===o&&a({topic:r},i)}});s.container.globalWindow&&s.container.globalWindow.addEventListener&&s.container.globalWindow.addEventListener("message",e.listener),t(e)})},u.prototype.unsubscribe=function(t){return Promise.resolve(this.container.globalWindow.removeEventListener("message",t.listener))},u.prototype.publish=function(t,n,e){var o=this.container.globalWindow?this.container.globalWindow[a.windowsPropertyKey]||this.container.globalWindow.opener&&this.container.globalWindow.opener[a.windowsPropertyKey]:[];if(o)for(var i in o){var r=o[i];e&&e.name&&e.name!==r[a.windowNamePropertyKey]||r.location.origin===this.container.globalWindow.location.origin&&r.postMessage({source:u.messageSource,topic:t,message:n},this.container.globalWindow.location.origin)}return Promise.resolve()},u.messageSource="desktopJS",u}();t.DefaultMessageBus=o;var a=function(e){function u(t){var n=e.call(this,t)||this;return n.windowOptionsMap=u.defaultWindowOptionsMap,n.hostType="Default",n.ipc=n.createMessageBus(),!n.globalWindow||u.windowsPropertyKey in n.globalWindow||(n.globalWindow[u.windowsPropertyKey]={root:n.globalWindow},n.globalWindow[u.windowNamePropertyKey]=n.globalWindow[u.windowUuidPropertyKey]=u.rootWindowUuid),n.screen=new i(n.globalWindow),n}return s(u,e),u.prototype.createMessageBus=function(){return new o(this)},u.prototype.getInfo=function(){return Promise.resolve(this.globalWindow.navigator.appVersion)},u.prototype.getMainWindow=function(){if(!this.mainWindow){var t=this.globalWindow[u.windowsPropertyKey].root;this.mainWindow=t?this.wrapWindow(t):null}return this.mainWindow},u.prototype.getCurrentWindow=function(){return this.wrapWindow(this.globalWindow)},u.prototype.getWindowOptions=function(t){return c.ObjectTransform.transformProperties(t,this.windowOptionsMap)},u.prototype.wrapWindow=function(t){return new n(t)},u.prototype.onOpen=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];var o=t.apply(this.globalWindow,n),i=this.globalWindow[u.windowsPropertyKey],r=o[u.windowUuidPropertyKey]=p.newGuid();return(i[r]=o).addEventListener("beforeunload",function(){o.addEventListener("unload",function(){delete i[r]})}),o[u.windowsPropertyKey]=i,h.emit("window-created",{name:"window-created",windowId:r}),W.emit("window-created",{name:"window-created",windowId:r}),o},u.prototype.createWindow=function(t,n){var e,o="_blank",i=this.getWindowOptions(n);if(i){for(var r in i)e=(e||"")+r+"="+i[r]+",";i&&"target"in i&&(o=i.target)}var a=this.globalWindow.open(t,o,e);a[h.windowOptionsPropertyKey]=n,a[u.windowNamePropertyKey]=i.name;var s=this.wrapWindow(a);return this.emit("window-created",{sender:this,name:"window-created",window:s,windowId:s.id,windowName:i.name}),Promise.resolve(s)},u.prototype.showNotification=function(n,e){var o=this;"Notification"in this.globalWindow?this.globalWindow.Notification.requestPermission(function(t){"denied"===t?console.warn("Notifications not permitted"):"granted"===t&&new o.globalWindow.Notification(n,e)}):console.warn("Notifications not supported")},u.prototype.closeAllWindows=function(r){var a=this;return new Promise(function(t,n){var e=a.globalWindow[u.windowsPropertyKey];for(var o in e){var i=e[o];r&&a.globalWindow===i||i.close()}t()})},u.prototype.getAllWindows=function(){var r=this;return new Promise(function(t,n){var e=[],o=r.globalWindow[u.windowsPropertyKey];for(var i in o)e.push(r.wrapWindow(o[i]));t(e)})},u.prototype.getWindowById=function(o){var i=this;return new Promise(function(t,n){var e=i.globalWindow[u.windowsPropertyKey][o];t(e?i.wrapWindow(e):null)})},u.prototype.getWindowByName=function(i){var r=this;return new Promise(function(t,n){var e=r.globalWindow[u.windowsPropertyKey];for(var o in e)if(e[o][u.windowNamePropertyKey]===i)return void t(r.wrapWindow(e[o]));t(null)})},u.prototype.buildLayout=function(){var f=this,l=new x;return new Promise(function(n,e){var o=[];f.getAllWindows().then(function(t){t.forEach(function(c){var p=c.nativeWindow,d=p[h.windowOptionsPropertyKey];d&&"persist"in d&&!d.persist||o.push(new Promise(function(i){return r=f,u=function(){var n,e,o;return w(this,function(t){switch(t.label){case 0:return this.globalWindow===p?[3,2]:(e=(n=l.windows).push,o={name:c.name,url:p&&p.location?p.location.toString():void 0,id:c.id,bounds:{x:p.screenX,y:p.screenY,width:p.outerWidth,height:p.outerHeight},options:d},[4,c.getState()]);case 1:e.apply(n,[(o.state=t.sent(),o)]),t.label=2;case 2:return i(),[2]}})},new((s=a=void 0)||(s=Promise))(function(t,n){function e(t){try{i(u.next(t))}catch(t){n(t)}}function o(t){try{i(u.throw(t))}catch(t){n(t)}}function i(n){n.done?t(n.value):new s(function(t){t(n.value)}).then(e,o)}i((u=u.apply(r,a||[])).next())});var r,a,s,u}))}),Promise.all(o).then(function(){n(l)}).catch(e)})})},u.windowsPropertyKey="desktopJS-windows",u.windowUuidPropertyKey="desktopJS-uuid",u.windowNamePropertyKey="desktopJS-name",u.rootWindowUuid="root",u.defaultWindowOptionsMap={x:{target:"left"},y:{target:"top"}},u}(r);t.DefaultContainer=a;var i=function(){function t(t){this.window=t}return t.prototype.getPrimaryDisplay=function(){var e=this;return new Promise(function(t){var n=new M;n.scaleFactor=e.window.devicePixelRatio,n.id="Current",n.bounds=new v(e.window.screen.availLeft,e.window.screen.availTop,e.window.screen.width,e.window.screen.height),n.workArea=new v(e.window.screen.availLeft,e.window.screen.availTop,e.window.screen.availWidth,e.window.screen.availHeight),t(n)})},t.prototype.getAllDisplays=function(){var t=this;return new Promise(function(n){t.getPrimaryDisplay().then(function(t){return n([t])})})},t.prototype.getMousePosition=function(){var e=this;return new Promise(function(t,n){t({x:e.window.event.screenX,y:e.window.event.screenY})})},t}()}(c.Default||(c.Default={}));var T=function(){},N=[];var k=function(){},G=function(){};c.Container=h,c.ContainerBase=n,c.ContainerNotification=l,c.ContainerRegistration=T,c.ContainerWindow=W,c.Display=M,c.EventArgs=a,c.EventEmitter=i,c.GlobalShortcutManager=G,c.GroupWindowManager=L,c.Guid=p,c.LayoutEventArgs=t,c.MenuItem=u,c.MessageBusOptions=e,c.MessageBusSubscription=d,c.NotificationOptions=f,c.PersistedWindow=P,c.PersistedWindowLayout=x,c.Point=E,c.PropertyMap=y,c.Rectangle=v,c.SnapAssistWindowManager=O,c.TrayIconDetails=k,c.WebContainerBase=r,c.WindowEventArgs=m,c.WindowGroupEventArgs=b,c.clearRegistry=function(){N.splice(0,N.length),c.container=void 0},c.registerContainer=function(t,n){N.push({id:t,registration:n})},c.resolveContainer=function(t,n){var e,o,i=!1,r=n;if("boolean"==typeof t?i=t:r=t,!i&&c.container)return c.container;try{for(var a=0;a<N.length;a++){o=N[a].id;var s=N[a].registration;e=s.condition(r)?s:e}c.container=e.create(r)}catch(t){console.error("Error resolving container '"+o+"' : "+t.toString())}finally{c.container=c.container||new c.Default.DefaultContainer}return c.container},c.version="3.7.0",Object.defineProperty(c,"__esModule",{value:!0})});
//# sourceMappingURL=desktop.min.js.map

@@ -12,3 +12,3 @@ // Generated by dts-bundle v0.7.3

*/
export type ContainerEventType = "window-created" | "layout-loaded" | "layout-saved";
export type ContainerEventType = "window-created" | "layout-loaded" | "layout-saved" | "layout-deleted";
export class LayoutEventArgs extends EventArgs {

@@ -44,2 +44,3 @@ readonly layout?: PersistedWindowLayout;

abstract loadLayout(layout: string | PersistedWindowLayout): Promise<PersistedWindowLayout>;
abstract deleteLayout(layout: string): Promise<void>;
abstract getLayouts(): Promise<PersistedWindowLayout[]>;

@@ -57,7 +58,9 @@ /**

abstract getWindowByName(name: string): Promise<ContainerWindow | null>;
static ipc: MessageBus;
static get ipc(): MessageBus;
static set ipc(value: MessageBus);
/**
* A messaging bus for sending and receiving messages
*/
ipc: MessageBus;
get ipc(): MessageBus;
set ipc(value: MessageBus);
/**

@@ -96,2 +99,3 @@ * Persistent storage

protected saveLayoutToStorage(name: string, layout: PersistedWindowLayout): void;
protected deleteLayoutFromStorage(name: string): void;
protected abstract closeAllWindows(excludeSelf?: Boolean): Promise<void>;

@@ -101,2 +105,3 @@ loadLayout(layout: string | PersistedWindowLayout): Promise<PersistedWindowLayout>;

saveLayout(name: string): Promise<PersistedWindowLayout>;
deleteLayout(name: string): Promise<void>;
getLayouts(): Promise<PersistedWindowLayout[]>;

@@ -169,3 +174,3 @@ /**

*/
static ipc: MessageBus;
static set ipc(value: MessageBus);
/**

@@ -446,4 +451,4 @@ * Registers an event listener on the specified static event.

readonly height: number;
readonly right: number;
readonly bottom: number;
get right(): number;
get bottom(): number;
static getRight(r: Rectangle): number;

@@ -496,3 +501,3 @@ static getBottom(r: Rectangle): number;

abstract setBounds(bounds: Rectangle): Promise<void>;
readonly allowGrouping: boolean;
get allowGrouping(): boolean;
getGroup(): Promise<ContainerWindow[]>;

@@ -510,3 +515,3 @@ joinGroup(target: ContainerWindow): Promise<void>;

*/
readonly nativeWindow: Window;
get nativeWindow(): Window;
/**

@@ -591,2 +596,6 @@ * Override to provide custom container logic for adding an event handler.

getLayouts(): Promise<PersistedWindowLayout[]>;
/** Persists a window layout
* @param {string} name - Name of the window layout to delete
*/
deleteLayout(name: string): Promise<void>;
}

@@ -673,4 +682,4 @@ /** Represents a persisted window in a layout */

constructor(wrap: any);
readonly id: string;
readonly name: string;
get id(): string;
get name(): string;
load(url: string, options?: any): Promise<void>;

@@ -694,3 +703,3 @@ focus(): Promise<void>;

protected detachListener(eventName: string, listener: (...args: any[]) => void): void;
readonly nativeWindow: Window;
get nativeWindow(): Window;
}

@@ -697,0 +706,0 @@ /**

@@ -5,3 +5,3 @@ {

"description": "Library for abstracting common container hosting",
"version": "3.6.0",
"version": "3.7.0",
"publishConfig": {

@@ -8,0 +8,0 @@ "access": "public"

![desktopJS](https://raw.githubusercontent.com/wiki/morgan-stanley/desktopJS/images/logo.png)
==========
[![npm version](https://badge.fury.io/js/%40morgan-stanley%2Fdesktopjs.svg)](https://www.npmjs.com/package/@morgan-stanley/desktopjs)
[![Build Status](https://travis-ci.org/Morgan-Stanley/desktopJS.svg?branch=master)](https://travis-ci.org/Morgan-Stanley/desktopJS)
[![Build Status](https://travis-ci.com/Morgan-Stanley/desktopJS.svg?branch=master)](https://travis-ci.com/Morgan-Stanley/desktopJS?branch=master)
[![codecov](https://codecov.io/gh/Morgan-Stanley/desktopJS/branch/master/graph/badge.svg)](https://codecov.io/gh/Morgan-Stanley/desktopJS)

@@ -6,0 +6,0 @@ [![Greenkeeper badge](https://badges.greenkeeper.io/Morgan-Stanley/desktopJS.svg)](https://greenkeeper.io/)

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc