@morgan-stanley/desktopjs
Advanced tools
Comparing version 3.12.0 to 3.13.1
@@ -1,2 +0,2 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).desktopJS={})}(this,function(u){"use strict";var i=function(t,n){return(i=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 r(t,n){function e(){this.constructor=t}i(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}function v(r,s,a,u){return new(a||(a=Promise))(function(t,n){function e(t){try{o(u.next(t))}catch(t){n(t)}}function i(t){try{o(u.throw(t))}catch(t){n(t)}}function o(n){n.done?t(n.value):new a(function(t){t(n.value)}).then(e,i)}o((u=u.apply(r,s||[])).next())})}function g(e,i){var o,r,s,t,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[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(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,r&&(s=2&n[0]?r.return:n[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,n[1])).done)return s;switch(r=0,s&&(n=[2&n[0],s.value]),n[0]){case 0:case 1:s=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,r=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(!(s=0<(s=a.trys).length&&s[s.length-1])&&(6===n[0]||2===n[0])){a=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){a.label=n[1];break}if(6===n[0]&&a.label<s[1]){a.label=s[1],s=n;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(n);break}s[2]&&a.ops.pop(),a.trys.pop();continue}n=i.call(e,a)}catch(t){n=[6,t],r=0}finally{o=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,t])}}}var s=function(t,n,e){this.sender=t,this.name=n,this.innerEvent=e},o=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(i,o){var r=this;return function(t){var n=new s(r,i,t);r.preProcessArgs(n);var e=o(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 i=e.indexOf(n);0<=i&&e.splice(i,1)}return this},r.prototype.listeners=function(t){return this.eventListeners[t]||[]},r.prototype.emit=function(t,n){for(var e=0,i=this.listeners(t);e<i.length;e++){(0,i[e])(n)}},Object.defineProperty(r,"ipc",{set:function(t){t&&t.subscribe(r.staticEventName,function(t,n){r.emit(n.eventName,n.eventArgs)})},enumerable:!1,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 i=e.indexOf(n);0<=i&&e.splice(i,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 i=0,o=r.listeners(t);i<o.length;i++){(0,o[i])(n)}},r.staticEventListeners=new Map,r.staticEventName="desktopJS.static-event",r}(),a=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 r(n,t),n}(s),p=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return r(i,e),i.prototype.getInfo=function(){return v(this,void 0,Promise,function(){return g(this,function(t){return[2,void 0]})})},i.prototype.ready=function(){return Promise.resolve()},Object.defineProperty(i,"ipc",{get:function(){return i._ipc},set:function(t){o.ipc=i._ipc=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"ipc",{get:function(){return i.ipc},set:function(t){i.ipc=t},enumerable:!1,configurable:!0}),i.prototype.addListener=function(t,n){return e.prototype.addListener.call(this,t,n)},i.prototype.removeListener=function(t,n){return e.prototype.removeListener.call(this,t,n)},i.prototype.emit=function(t,n){e.prototype.emit.call(this,t,n)},i.addListener=function(t,n){o.addListener(i.staticEventScopePrefix+t,n)},i.removeListener=function(t,n){o.removeListener(i.staticEventScopePrefix+t,n)},i.emit=function(t,n){o.emit(i.staticEventScopePrefix+t,n,i.ipc)},i.listeners=function(t){return o.listeners(i.staticEventScopePrefix+t)},i.staticEventScopePrefix="container-",i.windowOptionsPropertyKey="desktopJS-options",i}(o),n=function(n){function i(){var t=null!==n&&n.apply(this,arguments)||this;return t.uuid=a.newGuid(),t.storage="undefined"!=typeof window&&window?window.localStorage:void 0,t}return r(i,n),i.prototype.showNotification=function(t,n){throw new TypeError("Notifications not supported by this container")},i.prototype.addTrayIcon=function(t,n,e){throw new TypeError("Tray icons are not supported by this container.")},i.prototype.getLayoutFromStorage=function(t){return JSON.parse(this.storage.getItem(i.layoutsPropertyKey))[t]},i.prototype.saveLayoutToStorage=function(t,n){var e=JSON.parse(this.storage.getItem(i.layoutsPropertyKey))||{};n.name||(n.name=t),e[t]=n,this.storage.setItem(i.layoutsPropertyKey,JSON.stringify(e)),this.emit("layout-saved",{sender:this,name:"layout-saved",layout:n,layoutName:n.name}),p.emit("layout-saved",{name:"layout-saved",layout:n,layoutName:n.name})},i.prototype.deleteLayoutFromStorage=function(t){var n=JSON.parse(this.storage.getItem(i.layoutsPropertyKey))||{},e=n[t];e&&(delete n[t],this.storage.setItem(i.layoutsPropertyKey,JSON.stringify(n)),this.emit("layout-deleted",{sender:this,name:"layout-deleted",layoutName:e.name}),p.emit("layout-deleted",{name:"layout-deleted",layoutName:e.name}))},i.prototype.loadLayout=function(d){return v(this,void 0,Promise,function(){var o,n,e,i,r,s,a,u,c=this;return g(this,function(t){switch(t.label){case 0:return[4,this.closeAllWindows(!0)];case 1:if(t.sent(),!(null==(o="string"==typeof d?this.getLayoutFromStorage(d):d)?void 0:o.windows))return[3,3];for(n=[],e=0,i=o.windows;e<i.length;e++)r=i[e],(s=Object.assign(r.options||{},r.bounds)).name=r.name,r.main?(this.getMainWindow().setBounds(r.bounds),n.push(Promise.resolve(this.getMainWindow()))):n.push(this.createWindow(r.url,s));return[4,Promise.all(n)];case 2:return a=t.sent(),u=new Map,a.forEach(function(e){var t=o.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 i=!1;if(u.forEach(function(t,n){!i&&0<=t.indexOf(e.id)&&(i=!0)}),!i){var n=t?t.group:void 0;n&&0<n.length&&u.set(e,n.filter(function(t){return t!==e.id}))}}),u.forEach(function(t,e){t.forEach(function(n){c.getWindowByName(o.windows.find(function(t){return t.id===n}).name).then(function(t){t.joinGroup(e)})})}),this.emit("layout-loaded",{sender:this,name:"layout-loaded",layout:o,layoutName:o.name}),p.emit("layout-loaded",{name:"layout-loaded",layout:o,layoutName:o.name}),[2,o];case 3:throw new Error("Layout does not exist or is invalid")}})})},i.prototype.saveLayout=function(e){return v(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return[4,this.buildLayout()];case 1:return n=t.sent(),this.saveLayoutToStorage(e,n),[2,n]}})})},i.prototype.deleteLayout=function(n){return v(this,void 0,void 0,function(){return g(this,function(t){return[2,this.deleteLayoutFromStorage(n)]})})},i.prototype.getLayouts=function(){return v(this,void 0,Promise,function(){var n,e;return g(this,function(t){return(n=this.storage.getItem(i.layoutsPropertyKey))?(e=JSON.parse(n),[2,Object.getOwnPropertyNames(e).map(function(t){return e[t]})]):[2]})})},i.prototype.log=function(e,i){return v(this,void 0,void 0,function(){var n;return g(this,function(t){switch(e){case"debug":case"warn":case"error":n=console[e];break;default:n=console.log}return n&&n(i),[2]})})},i.layoutsPropertyKey="desktopJS-layouts",i}(p),c=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 i=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 i=Array(t),o=0;for(n=0;n<e;n++)for(var r=arguments[n],s=0,a=r.length;s<a;s++,o++)i[o]=r[s];return i}([i],t))}}return e}return r(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),h=function(t,n,e){this.topic=t,this.listener=n,this.options=e},e=function(){},d=function(){},f=function(){},l=function(){function e(t,n){this.title=t,this.options=n}return e.requestPermission=function(n){return v(this,void 0,Promise,function(){return g(this,function(t){return n&&n(e.permission),[2,e.permission]})})},e.permission="granted",e}(),w=function(){};u.ObjectTransform=void 0,(u.ObjectTransform||(u.ObjectTransform={})).transformProperties=function(t,n){var e={};if(t)for(var i in t)try{i in n?e[n[i].target]=n[i].convert?n[i].convert(t[i],t,e):t[i]:e[i]=t[i]}catch(t){console.error("Error transforming property '"+i+"'")}return e};var y,m=function(){function t(t,n,e,i){this.x=t,this.y=n,this.width=e,this.height=i}return Object.defineProperty(t.prototype,"right",{get:function(){return t.getRight(this)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return t.getBottom(this)},enumerable:!1,configurable:!0}),t.getRight=function(t){return t.x+t.width},t.getBottom=function(t){return t.y+t.height},t}(),b=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r(n,t),n}(s),W=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r(n,t),n}(b),P=function(i){function e(t){var n=i.call(this)||this;return n.innerWindow=t,n}return r(e,i),Object.defineProperty(e.prototype,"allowGrouping",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.getGroup=function(){return v(this,void 0,Promise,function(){return g(this,function(t){return[2,[]]})})},e.prototype.joinGroup=function(t){return v(this,void 0,Promise,function(){return g(this,function(t){throw new Error("Not supported")})})},e.prototype.leaveGroup=function(){return v(this,void 0,Promise,function(){return g(this,function(t){return[2]})})},e.prototype.bringToFront=function(){return this.focus()},e.prototype.getState=function(){return v(this,void 0,Promise,function(){return g(this,function(t){return[2]})})},e.prototype.setState=function(t){return v(this,void 0,Promise,function(){return g(this,function(t){return[2]})})},Object.defineProperty(e.prototype,"nativeWindow",{get:function(){},enumerable:!1,configurable:!0}),e.prototype.addListener=function(t,n){var e=this.registerAndWrapListener(t,n);return this.attachListener(t,e),i.prototype.addListener.call(this,t,e)},e.prototype.removeListener=function(t,n){var e=this.unwrapAndUnRegisterListener(n)||n;return this.detachListener(t,e),i.prototype.removeListener.call(this,t,e)},e.addListener=function(t,n){o.addListener(e.staticEventScopePrefix+t,n)},e.removeListener=function(t,n){o.removeListener(e.staticEventScopePrefix+t,n)},e.emit=function(t,n){o.emit(e.staticEventScopePrefix+t,n,p.ipc)},e.listeners=function(t){return o.listeners(e.staticEventScopePrefix+t)},e.staticEventScopePrefix="containerwindow-",e}(o),x=function(){},S=function(t){this.windows=[],this.name=t};function L(){return"undefined"!=typeof window&&window.fin}u.WindowStateTracking=void 0,(y=u.WindowStateTracking||(u.WindowStateTracking={}))[y.None=0]="None",y[y.Main=1]="Main",y[y.Group=2]="Group";var O=function(){function t(t,n){this.windowStateTracking=u.WindowStateTracking.None,this.container=t,n&&"windowStateTracking"in n&&(this.windowStateTracking=n.windowStateTracking),this.attach()}return t.prototype.attach=function(t){var i=this;t?(t.addListener(L()?"minimized":"minimize",function(n){return v(i,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this.windowStateTracking&u.WindowStateTracking.Main&&this.container.getMainWindow().id===n.sender.id?[4,this.container.getAllWindows()]:[3,2];case 1:t.sent().forEach(function(t){return t.minimize()}),t.label=2;case 2:return this.windowStateTracking&u.WindowStateTracking.Group?[4,n.sender.getGroup()]:[3,4];case 3:t.sent().forEach(function(t){return t.minimize()}),t.label=4;case 4:return[2]}})})}),t.addListener(L()?"restored":"restore",function(n){return v(i,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this.windowStateTracking&u.WindowStateTracking.Main&&this.container.getMainWindow().id===n.sender.id?[4,this.container.getAllWindows()]:[3,2];case 1:t.sent().forEach(function(t){return t.restore()}),t.label=2;case 2:return this.windowStateTracking&u.WindowStateTracking.Group?[4,n.sender.getGroup()]:[3,4];case 3:t.sent().forEach(function(t){return t.restore()}),t.label=4;case 4:return[2]}})})})):(P.addListener("window-created",function(e){return v(i,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return this.container&&this.container.getWindowById?[4,this.container.getWindowById(e.windowId)]:[3,2];case 1:n=t.sent(),this.attach(n),t.label=2;case 2:return[2]}})})}),this.container&&this.container.getAllWindows().then(function(t){t.forEach(function(t){return i.attach(t)})}))},t}(),E=function(i){function t(t,n){var e=i.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 r(t,i),t.prototype.onAttached=function(t){var n=this;t.innerWindow&&t.innerWindow.disableFrame&&t.innerWindow.disableFrame(),L()?(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;i.prototype.attach.call(this,n),n&&n.getOptions().then(function(t){t&&void 0!==t.snap&&!1===t.snap||(e.onAttached(n),n.addListener(L()?"disabled-frame-bounds-changing":"move",function(t){return e.onMoving(t)}))})},t.prototype.onMoving=function(y){return v(this,void 0,void 0,function(){var n,e,i,o,r,s,a,u,c,d,p,h,f,l,w=this;return g(this,function(t){switch(t.label){case 0:return n=y.sender.id,this.snappingWindow===n?[2]:[4,(e=y.sender).getOptions()];case 1:return(i=t.sent())&&void 0!==i.snap&&!1===i.snap?[2]:[4,e.getGroup()];case 2:return o=t.sent(),L()?(s=new m(y.innerEvent.left,y.innerEvent.top,y.innerEvent.width,y.innerEvent.height),[3,5]):[3,3];case 3:return[4,e.getBounds()];case 4:s=t.sent(),t.label=5;case 5:return r=s,0<o.length?(L()&&this.moveWindow(e,r),[2]):[4,this.container.getAllWindows()];case 6:return a=t.sent(),u=a.filter(function(t){return n!==t.id}).map(function(e){return v(w,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return n={window:e},[4,e.getBounds()];case 1:return n.bounds=t.sent(),[4,e.getOptions()];case 2:return[2,(n.options=t.sent(),n)]}})})}),[4,Promise.all(u)];case 7:for(c=t.sent(),d=!1,h=0,f=c.filter(function(t){return!(t.options&&void 0!==t.options.snap&&!1===t.options.snap)});h<f.length;h++)l=f[h],(p=this.getSnapBounds(p||r,l.bounds))?(d=!0,this.showGroupingHint(l.window),this.moveWindow(y.sender,p)):this.hideGroupingHint(l.window);return!d&&L()&&this.moveWindow(y.sender,r),[2]}})})},t.prototype.moveWindow=function(n,e){return v(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:this.snappingWindow=n.id,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,n.setBounds(e)];case 2:case 3:return t.sent(),[3,4];case 4:return this.snappingWindow=void 0,[2]}})})},t.prototype.onMoved=function(e){var n=this;if(this.autoGrouping){var t=Array.from(this.targetGroup,function(t){t[0];var e=t[1];return v(n,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return n={window:e},[4,e.getGroup()];case 1:return[2,(n.isGrouped=0<t.sent().length,n)]}})})});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){var n,e;null===(e=null===(n=t.innerWindow)||void 0===n?void 0:n.updateOptions)||void 0===e||e.call(n,{opacity:.75}),this.targetGroup.set(t.id,t)},t.prototype.hideGroupingHint=function(t){var n,e;null===(e=null===(n=t.innerWindow)||void 0===n?void 0:n.updateOptions)||void 0===e||e.call(n,{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,i,o,r,s,a,u,c;if(this.isHorizontallyAligned(t,n)&&(e=Math.abs(t.x-(n.right-this.snapOffset))<this.snapThreshold,i=Math.abs(t.x-n.x)<this.snapThreshold,o=Math.abs(t.right-this.snapOffset-n.x)<this.snapThreshold,r=Math.abs(t.right-n.right)<this.snapThreshold),this.isVerticallyAligned(t,n)&&(s=Math.abs(t.y-(n.bottom-this.snapOffset))<this.snapThreshold,a=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||o||s||u){var d=t.x,p=t.y;return e?d=n.x+n.width-this.snapOffset:i&&(d=n.x),o?d=n.x-t.width+this.snapOffset:r&&(d=n.x+n.width-t.width),s?p=n.y+n.height-Math.floor(this.snapOffset/2):a&&(p=n.y),u?p=n.y-t.height+Math.floor(this.snapOffset/2):c&&(p=n.y+n.height-t.height),new m(d,p,t.width,t.height)}},t}(O),M=function(){},T=function(){};u.Default=void 0,function(t){var e={close:"unload"},n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r(n,t),Object.defineProperty(n.prototype,"id",{get:function(){return this.innerWindow[d.windowUuidPropertyKey]},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"name",{get:function(){return this.innerWindow[d.windowNamePropertyKey]},enumerable:!1,configurable:!0}),n.prototype.load=function(n,t){return v(this,void 0,void 0,function(){return g(this,function(t){return this.innerWindow.location.replace(n),[2]})})},n.prototype.focus=function(){return v(this,void 0,void 0,function(){return g(this,function(t){return this.innerWindow.focus(),[2]})})},n.prototype.show=function(){return v(this,void 0,void 0,function(){return g(this,function(t){return[2]})})},n.prototype.hide=function(){return v(this,void 0,void 0,function(){return g(this,function(t){return[2]})})},n.prototype.close=function(){return v(this,void 0,void 0,function(){return g(this,function(t){return this.innerWindow.close(),[2]})})},n.prototype.minimize=function(){return v(this,void 0,void 0,function(){return g(this,function(t){return this.innerWindow.minimize(),[2]})})},n.prototype.maximize=function(){return v(this,void 0,void 0,function(){return g(this,function(t){return this.innerWindow.maximize(),[2]})})},n.prototype.restore=function(){return v(this,void 0,void 0,function(){return g(this,function(t){return this.innerWindow.restore(),[2]})})},n.prototype.isShowing=function(){return v(this,void 0,void 0,function(){return g(this,function(t){return[2,!0]})})},n.prototype.getSnapshot=function(){return v(this,void 0,Promise,function(){return g(this,function(t){throw new Error("getSnapshot requires an implementation.")})})},n.prototype.flash=function(t,n){return v(this,void 0,void 0,function(){return g(this,function(t){throw new Error("Not supported")})})},n.prototype.getParent=function(){return v(this,void 0,Promise,function(){return g(this,function(t){return[2,null]})})},n.prototype.setParent=function(t){return v(this,void 0,void 0,function(){return g(this,function(t){return[2]})})},n.prototype.getBounds=function(){return v(this,void 0,void 0,function(){return g(this,function(t){return[2,new m(this.innerWindow.screenX,this.innerWindow.screenY,this.innerWindow.outerWidth,this.innerWindow.outerHeight)]})})},n.prototype.setBounds=function(n){return v(this,void 0,void 0,function(){return g(this,function(t){return this.innerWindow.moveTo(n.x,n.y),this.innerWindow.resizeTo(n.width,n.height),[2]})})},n.prototype.getOptions=function(){return v(this,void 0,void 0,function(){return g(this,function(t){return[2,this.innerWindow[p.windowOptionsPropertyKey]]})})},n.prototype.getState=function(){var n,e;return v(this,void 0,void 0,function(){return g(this,function(t){return[2,null===(e=null===(n=this.nativeWindow)||void 0===n?void 0:n.getState)||void 0===e?void 0:e.call(n)]})})},n.prototype.setState=function(e){var i,o;return v(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return n=null===(o=null===(i=this.nativeWindow)||void 0===i?void 0:i.setState)||void 0===o?void 0:o.call(i,e),this.emit("state-changed",{name:"state-changed",sender:this,state:e}),P.emit("state-changed",{name:"state-changed",windowId:this.id,state:e}),[4,n];case 1:return t.sent(),[2]}})})},n.prototype.attachListener=function(t,n){this.innerWindow.addEventListener(e[t]||t,n)},n.prototype.detachListener=function(t,n){this.innerWindow.removeEventListener(e[t]||t,n)},Object.defineProperty(n.prototype,"nativeWindow",{get:function(){return this.innerWindow},enumerable:!1,configurable:!0}),n}(P);t.DefaultContainerWindow=n;var i=function(){function c(t){this.container=t}return c.prototype.subscribe=function(s,a,t){var e,i;return v(this,void 0,void 0,function(){var n,r=this;return g(this,function(t){return n=new h(s,function(t){if(t.origin===r.container.globalWindow.location.origin){var n=t.data,e=n.source,i=n.topic,o=n.message;e===c.messageSource&&s===i&&a({topic:s},o)}}),null===(i=null===(e=this.container.globalWindow)||void 0===e?void 0:e.addEventListener)||void 0===i||i.call(e,"message",n.listener),[2,n]})})},c.prototype.unsubscribe=function(n){return v(this,void 0,void 0,function(){return g(this,function(t){return[2,this.container.globalWindow.removeEventListener("message",n.listener)]})})},c.prototype.publish=function(r,s,a){var u;return v(this,void 0,void 0,function(){var n,e,i,o;return g(this,function(t){if(n=this.container.globalWindow?this.container.globalWindow[d.windowsPropertyKey]||(null===(u=this.container.globalWindow.opener)||void 0===u?void 0:u[d.windowsPropertyKey]):[])for(e in n)i=n[e],null!=a&&a.name&&a.name!==i[d.windowNamePropertyKey]||(o=(null==a?void 0:a.targetOrigin)||this.container.globalWindow.location.origin,i.postMessage({source:c.messageSource,topic:r,message:s},o));return[2]})})},c.messageSource="desktopJS",c}();t.DefaultMessageBus=i;var d=function(e){function d(t){var n=e.call(this,t)||this;return n.windowOptionsMap=d.defaultWindowOptionsMap,n.hostType="Default",n.ipc=n.createMessageBus(),!n.globalWindow||d.windowsPropertyKey in n.globalWindow||(n.globalWindow[d.windowsPropertyKey]={root:n.globalWindow},n.globalWindow[d.windowNamePropertyKey]=n.globalWindow[d.windowUuidPropertyKey]=d.rootWindowUuid),n.screen=new o(n.globalWindow),n}return r(d,e),d.prototype.createMessageBus=function(){return new i(this)},d.prototype.setOptions=function(t){},d.prototype.getOptions=function(){return v(this,void 0,Promise,function(){return g(this,function(t){return[2,{}]})})},d.prototype.getInfo=function(){return v(this,void 0,Promise,function(){return g(this,function(t){return[2,this.globalWindow.navigator.appVersion]})})},d.prototype.getMainWindow=function(){if(!this.mainWindow){var t=this.globalWindow[d.windowsPropertyKey].root;this.mainWindow=t?this.wrapWindow(t):null}return this.mainWindow},d.prototype.getCurrentWindow=function(){return this.wrapWindow(this.globalWindow)},d.prototype.getWindowOptions=function(t){return u.ObjectTransform.transformProperties(t,this.windowOptionsMap)},d.prototype.wrapWindow=function(t){return new n(t)},d.prototype.onOpen=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];var i=t.apply(this.globalWindow,n),o=a.newGuid();try{var r=this.globalWindow[d.windowsPropertyKey];(r[o]=i)[d.windowUuidPropertyKey]=o,i.addEventListener("beforeunload",function(){i.addEventListener("unload",function(){delete r[o]})}),i[d.windowsPropertyKey]=r}catch(t){this.log("warn","Error tracking new window, '"+t.message+"'")}return p.emit("window-created",{name:"window-created",windowId:o}),P.emit("window-created",{name:"window-created",windowId:o}),i},d.prototype.createWindow=function(u,c){return v(this,void 0,Promise,function(){var n,e,i,o,r,s,a;return g(this,function(t){if(e="_blank",i=this.getWindowOptions(c)){for(o in i)n=(n||"")+o+"="+i[o]+",";i&&"target"in i&&(e=i.target)}r=this.globalWindow.open(u,e,n),s=!0;try{r[p.windowOptionsPropertyKey]=c,r[d.windowNamePropertyKey]=i.name}catch(t){s=!1,this.log("warn","Error proprogating properties to new window, '"+t.message+"'")}return a=this.wrapWindow(r),this.emit("window-created",{sender:this,name:"window-created",window:a,windowId:s?a.id:void 0,windowName:i.name}),[2,a]})})},d.prototype.showNotification=function(n,e){var i=this;"Notification"in this.globalWindow?this.globalWindow.Notification.requestPermission(function(t){"denied"===t?i.log("warn","Notifications not permitted"):"granted"===t&&new i.globalWindow.Notification(n,e)}):this.log("warn","Notifications not supported")},d.prototype.closeAllWindows=function(o){return void 0===o&&(o=!1),v(this,void 0,void 0,function(){var n,e,i;return g(this,function(t){for(e in n=this.globalWindow[d.windowsPropertyKey])i=n[e],o&&this.globalWindow===i||i.close();return[2]})})},d.prototype.getAllWindows=function(){return v(this,void 0,void 0,function(){var n,e,i;return g(this,function(t){for(i in n=[],e=this.globalWindow[d.windowsPropertyKey])n.push(this.wrapWindow(e[i]));return[2,n]})})},d.prototype.getWindowById=function(e){return v(this,void 0,Promise,function(){var n;return g(this,function(t){return[2,(n=this.globalWindow[d.windowsPropertyKey][e])?this.wrapWindow(n):null]})})},d.prototype.getWindowByName=function(i){return v(this,void 0,Promise,function(){var n,e;return g(this,function(t){for(e in n=this.globalWindow[d.windowsPropertyKey])if(n[e][d.windowNamePropertyKey]===i)return[2,this.wrapWindow(n[e])];return[2,null]})})},d.prototype.buildLayout=function(){return v(this,void 0,void 0,function(){var a,n,e=this;return g(this,function(t){switch(t.label){case 0:return a=new S,n=[],[4,this.getAllWindows()];case 1:return t.sent().forEach(function(o){var r=o.nativeWindow;try{var s=r[p.windowOptionsPropertyKey];if(s&&"persist"in s&&!s.persist)return;n.push(v(e,void 0,void 0,function(){var n,e,i;return g(this,function(t){switch(t.label){case 0:return this.globalWindow===r?[3,2]:(e=(n=a.windows).push,i={name:o.name,url:r&&r.location?r.location.toString():void 0,id:o.id,bounds:{x:r.screenX,y:r.screenY,width:r.innerWidth,height:r.innerHeight},options:s},[4,o.getState()]);case 1:e.apply(n,[(i.state=t.sent(),i)]),t.label=2;case 2:return[2]}})}))}catch(t){e.log("warn","Error while accessing window so skipping, '"+t.message+"'")}}),[4,Promise.all(n)];case 2:return t.sent(),[2,a]}})})},d.windowsPropertyKey="desktopJS-windows",d.windowUuidPropertyKey="desktopJS-uuid",d.windowNamePropertyKey="desktopJS-name",d.rootWindowUuid="root",d.defaultWindowOptionsMap={x:{target:"left"},y:{target:"top"}},d}(c);t.DefaultContainer=d;var o=function(){function t(t){this.window=t}return t.prototype.getPrimaryDisplay=function(){return v(this,void 0,void 0,function(){var n;return g(this,function(t){return(n=new T).scaleFactor=this.window.devicePixelRatio,n.id="Current",n.bounds=new m(this.window.screen.availLeft,this.window.screen.availTop,this.window.screen.width,this.window.screen.height),n.workArea=new m(this.window.screen.availLeft,this.window.screen.availTop,this.window.screen.availWidth,this.window.screen.availHeight),[2,n]})})},t.prototype.getAllDisplays=function(){return v(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this.getPrimaryDisplay()];case 1:return[2,[t.sent()]]}})})},t.prototype.getMousePosition=function(){return v(this,void 0,void 0,function(){return g(this,function(t){return[2,{x:this.window.event.screenX,y:this.window.event.screenY}]})})},t}()}(u.Default||(u.Default={}));var k=function(){},N=[];u.container=void 0;var G=function(){},A=function(){};u.Container=p,u.ContainerBase=n,u.ContainerNotification=l,u.ContainerRegistration=k,u.ContainerWindow=P,u.Display=T,u.EventArgs=s,u.EventEmitter=o,u.GlobalShortcutManager=A,u.GroupWindowManager=O,u.Guid=a,u.LayoutEventArgs=t,u.MenuItem=d,u.MessageBusOptions=e,u.MessageBusSubscription=h,u.NotificationOptions=f,u.PersistedWindow=x,u.PersistedWindowLayout=S,u.Point=M,u.PropertyMap=w,u.Rectangle=m,u.SnapAssistWindowManager=E,u.TrayIconDetails=G,u.WebContainerBase=c,u.WindowEventArgs=b,u.WindowGroupEventArgs=W,u.clearRegistry=function(){N.splice(0,N.length),u.container=void 0},u.registerContainer=function(t,n){N.push({id:t,registration:n})},u.resolveContainer=function(t,n){var e,i,o=!1,r=n;if("boolean"==typeof t?o=t:r=t,!o&&u.container)return u.container;try{for(var s=0;s<N.length;s++){i=N[s].id;var a=N[s].registration;e=a.condition(r)?a:e}u.container=e?e.create(r):void 0}catch(t){console.error("Error resolving container '"+i+"' : "+t.toString())}finally{u.container=u.container||new u.Default.DefaultContainer}return u.container},u.version="3.12.0",Object.defineProperty(u,"__esModule",{value:!0})}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).desktopJS={})}(this,function(u){"use strict";var i=function(t,n){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])})(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}i(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}function w(t,s,a,u){return new(a=a||Promise)(function(e,n){function i(t){try{r(u.next(t))}catch(t){n(t)}}function o(t){try{r(u.throw(t))}catch(t){n(t)}}function r(t){var n;t.done?e(t.value):((n=t.value)instanceof a?n:new a(function(t){t(n)})).then(i,o)}r((u=u.apply(t,s||[])).next())})}function y(i,o){var r,s,a,u={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},c={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function t(e){return function(t){var n=[e,t];if(r)throw new TypeError("Generator is already executing.");for(;u=c&&n[c=0]?0:u;)try{if(r=1,s&&(a=2&n[0]?s.return:n[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,n[1])).done)return a;switch(s=0,(n=a?[2&n[0],a.value]:n)[0]){case 0:case 1:a=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,s=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(!(a=0<(a=u.trys).length&&a[a.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!a||n[1]>a[0]&&n[1]<a[3])){u.label=n[1];break}if(6===n[0]&&u.label<a[1]){u.label=a[1],a=n;break}if(a&&u.label<a[2]){u.label=a[2],u.ops.push(n);break}a[2]&&u.ops.pop(),u.trys.pop();continue}n=o.call(i,u)}catch(t){n=[6,t],s=0}finally{r=a=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}}var r=function(t,n,e){this.sender=t,this.name=n,this.innerEvent=e},e=(s.prototype.addListener=function(t,n){return(this.eventListeners[t]=this.eventListeners[t]||[]).push(n),this},s.prototype.registerAndWrapListener=function(t,n){t=this.wrapListener(t,n);return this.wrappedListeners.set(n,t),t},s.prototype.wrapListener=function(e,i){var o=this;return function(t){var t=new r(o,e,t),n=(o.preProcessArgs(t),i(t));return o.postProcessArgs(t),n}},s.prototype.preProcessArgs=function(t){},s.prototype.postProcessArgs=function(t){t&&void 0!==t.returnValue&&(t.innerEvent.returnValue=t.returnValue)},s.prototype.unwrapAndUnRegisterListener=function(t){var n=this.wrappedListeners.get(t);return n&&this.wrappedListeners.delete(t),n},s.prototype.removeListener=function(t,n){t=this.listeners(t);return t&&0<=(n=t.indexOf(n))&&t.splice(n,1),this},s.prototype.listeners=function(t){return this.eventListeners[t]||[]},s.prototype.emit=function(t,n){for(var e=0,i=this.listeners(t);e<i.length;e++)(0,i[e])(n)},Object.defineProperty(s,"ipc",{set:function(t){t&&t.subscribe(s.staticEventName,function(t,n){s.emit(n.eventName,n.eventArgs)})},enumerable:!1,configurable:!0}),s.addListener=function(t,n){(this.staticEventListeners[t]=this.staticEventListeners[t]||[]).push(n)},s.removeListener=function(t,n){t=s.listeners(t);t&&0<=(n=t.indexOf(n))&&t.splice(n,1)},s.listeners=function(t){return this.staticEventListeners[t]||[]},s.emit=function(t,n,e){if(e&&e.publish)e.publish(s.staticEventName,{eventName:t,eventArgs:n});else for(var i=0,o=s.listeners(t);i<o.length;i++)(0,o[i])(n)},s.staticEventListeners=new Map,s.staticEventName="desktopJS.static-event",s);function s(){this.eventListeners=new Map,this.wrappedListeners=new Map}B.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)})};var a=B;function B(){}t(H,n=r);var n,I=H;function H(){return null!==n&&n.apply(this,arguments)||this}t(c,o=e),c.prototype.getInfo=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2,void 0]})})},c.prototype.ready=function(){return Promise.resolve()},Object.defineProperty(c,"ipc",{get:function(){return c._ipc},set:function(t){e.ipc=c._ipc=t},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"ipc",{get:function(){return c.ipc},set:function(t){c.ipc=t},enumerable:!1,configurable:!0}),c.prototype.addListener=function(t,n){return o.prototype.addListener.call(this,t,n)},c.prototype.removeListener=function(t,n){return o.prototype.removeListener.call(this,t,n)},c.prototype.emit=function(t,n){o.prototype.emit.call(this,t,n)},c.addListener=function(t,n){e.addListener(c.staticEventScopePrefix+t,n)},c.removeListener=function(t,n){e.removeListener(c.staticEventScopePrefix+t,n)},c.emit=function(t,n){e.emit(c.staticEventScopePrefix+t,n,c.ipc)},c.listeners=function(t){return e.listeners(c.staticEventScopePrefix+t)},c.staticEventScopePrefix="container-",c.windowOptionsPropertyKey="desktopJS-options";var o,p=c;function c(){return null!==o&&o.apply(this,arguments)||this}t(h,d=p),h.prototype.showNotification=function(t,n){throw new TypeError("Notifications not supported by this container")},h.prototype.addTrayIcon=function(t,n,e){throw new TypeError("Tray icons are not supported by this container.")},h.prototype.getLayoutFromStorage=function(t){return JSON.parse(this.storage.getItem(h.layoutsPropertyKey))[t]},h.prototype.saveLayoutToStorage=function(t,n){var e=JSON.parse(this.storage.getItem(h.layoutsPropertyKey))||{};n.name||(n.name=t),e[t]=n,this.storage.setItem(h.layoutsPropertyKey,JSON.stringify(e)),this.emit("layout-saved",{sender:this,name:"layout-saved",layout:n,layoutName:n.name}),p.emit("layout-saved",{name:"layout-saved",layout:n,layoutName:n.name})},h.prototype.deleteLayoutFromStorage=function(t){var n=JSON.parse(this.storage.getItem(h.layoutsPropertyKey))||{},e=n[t];e&&(delete n[t],this.storage.setItem(h.layoutsPropertyKey,JSON.stringify(n)),this.emit("layout-deleted",{sender:this,name:"layout-deleted",layoutName:e.name}),p.emit("layout-deleted",{name:"layout-deleted",layoutName:e.name}))},h.prototype.loadLayout=function(d){return w(this,void 0,void 0,function(){var o,n,e,i,r,s,a,u,c=this;return y(this,function(t){switch(t.label){case 0:return[4,this.closeAllWindows(!0)];case 1:if(t.sent(),null==(o="string"==typeof d?this.getLayoutFromStorage(d):d)||!o.windows)return[3,3];for(n=[],e=0,i=o.windows;e<i.length;e++)r=i[e],(s=Object.assign(r.options||{},r.bounds)).name=r.name,r.main?(this.getMainWindow().setBounds(r.bounds),n.push(Promise.resolve(this.getMainWindow()))):n.push(this.createWindow(r.url,s));return[4,Promise.all(n)];case 2:return a=t.sent(),u=new Map,a.forEach(function(e){var t=o.windows.find(function(t){return t.name===e.name}),i=(t&&t.state&&e.setState&&e.setState(t.state).catch(function(t){return c.log("error","Error invoking setState: "+t)}),!1);u.forEach(function(t,n){!i&&0<=t.indexOf(e.id)&&(i=!0)}),i||(t=t?t.group:void 0)&&0<t.length&&u.set(e,t.filter(function(t){return t!==e.id}))}),u.forEach(function(t,e){t.forEach(function(n){c.getWindowByName(o.windows.find(function(t){return t.id===n}).name).then(function(t){t.joinGroup(e)})})}),this.emit("layout-loaded",{sender:this,name:"layout-loaded",layout:o,layoutName:o.name}),p.emit("layout-loaded",{name:"layout-loaded",layout:o,layoutName:o.name}),[2,o];case 3:throw new Error("Layout does not exist or is invalid")}})})},h.prototype.saveLayout=function(e){return w(this,void 0,void 0,function(){var n;return y(this,function(t){switch(t.label){case 0:return[4,this.buildLayout()];case 1:return n=t.sent(),this.saveLayoutToStorage(e,n),[2,n]}})})},h.prototype.deleteLayout=function(n){return w(this,void 0,void 0,function(){return y(this,function(t){return[2,this.deleteLayoutFromStorage(n)]})})},h.prototype.getLayouts=function(){return w(this,void 0,void 0,function(){var n,e;return y(this,function(t){return(n=this.storage.getItem(h.layoutsPropertyKey))?(e=JSON.parse(n),[2,Object.getOwnPropertyNames(e).map(function(t){return e[t]})]):[2]})})},h.prototype.log=function(e,i){return w(this,void 0,void 0,function(){var n;return y(this,function(t){switch(e){case"debug":case"warn":case"error":n=console[e];break;default:n=console.log}return n&&n(i),[2]})})},h.layoutsPropertyKey="desktopJS-layouts";var d,C=h;function h(){var t=null!==d&&d.apply(this,arguments)||this;return t.uuid=a.newGuid(),t.storage="undefined"!=typeof window&&window?window.localStorage:void 0,t}t(l,D=C),l.prototype.onOpen=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return t.apply(this.globalWindow,n)},l.prototype.ensureAbsoluteUrl=function(t){return this.linkHelper?(this.linkHelper.href=t,this.linkHelper.href):t};var D,J=l;function l(t){var e,i=D.call(this)||this;i.globalWindow=t||"undefined"!=typeof window&&window||null,i.linkHelper={href:"unknown"};try{i.linkHelper=i.globalWindow.top.document.createElement("a")}catch(t){}return i.globalWindow&&(e=i.globalWindow.open,i.globalWindow.open=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return i.onOpen.apply(i,function(t,n,e){if(e||2===arguments.length)for(var i,o=0,r=n.length;o<r;o++)!i&&o in n||((i=i||Array.prototype.slice.call(n,0,o))[o]=n[o]);return t.concat(i||Array.prototype.slice.call(n))}([e],t,!1))}),i}function _(){}function z(){}function F(){}var U=function(t,n,e){this.topic=t,this.listener=n,this.options=e},R=(f.requestPermission=function(n){return w(this,void 0,void 0,function(){return y(this,function(t){return n&&n(f.permission),[2,f.permission]})})},f.permission="granted",f);function f(t,n){this.title=t,this.options=n}function V(){}u.ObjectTransform=void 0,(u.ObjectTransform||(u.ObjectTransform={})).transformProperties=function(t,n){var e={};if(t)for(var i in t)try{i in n?e[n[i].target]=n[i].convert?n[i].convert(t[i],t,e):t[i]:e[i]=t[i]}catch(t){console.error("Error transforming property '"+i+"'")}return e},Object.defineProperty(g.prototype,"right",{get:function(){return g.getRight(this)},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"bottom",{get:function(){return g.getBottom(this)},enumerable:!1,configurable:!0}),g.getRight=function(t){return t.x+t.width},g.getBottom=function(t){return t.y+t.height};var v=g;function g(t,n,e,i){this.x=t,this.y=n,this.width=e,this.height=i}t(X,m=r);var m,q=X;function X(){return null!==m&&m.apply(this,arguments)||this}t(Q,b=q);var b,Y=Q;function Q(){return null!==b&&b.apply(this,arguments)||this}t(x,W=e),Object.defineProperty(x.prototype,"allowGrouping",{get:function(){return!1},enumerable:!1,configurable:!0}),x.prototype.getGroup=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2,[]]})})},x.prototype.joinGroup=function(t){return w(this,void 0,void 0,function(){return y(this,function(t){throw new Error("Not supported")})})},x.prototype.leaveGroup=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2]})})},x.prototype.bringToFront=function(){return this.focus()},x.prototype.getState=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2]})})},x.prototype.setState=function(t){return w(this,void 0,void 0,function(){return y(this,function(t){return[2]})})},Object.defineProperty(x.prototype,"nativeWindow",{get:function(){},enumerable:!1,configurable:!0}),x.prototype.addListener=function(t,n){n=this.registerAndWrapListener(t,n);return this.attachListener(t,n),W.prototype.addListener.call(this,t,n)},x.prototype.removeListener=function(t,n){n=this.unwrapAndUnRegisterListener(n)||n;return this.detachListener(t,n),W.prototype.removeListener.call(this,t,n)},x.addListener=function(t,n){e.addListener(x.staticEventScopePrefix+t,n)},x.removeListener=function(t,n){e.removeListener(x.staticEventScopePrefix+t,n)},x.emit=function(t,n){e.emit(x.staticEventScopePrefix+t,n,p.ipc)},x.listeners=function(t){return e.listeners(x.staticEventScopePrefix+t)},x.staticEventScopePrefix="containerwindow-";var W,P=x;function x(t){var n=W.call(this)||this;return n.innerWindow=t,n}function Z(){}var $=function(t){this.windows=[],this.name=t};function S(){return"undefined"!=typeof window&&window.fin}u.WindowStateTracking=void 0,(L=u.WindowStateTracking||(u.WindowStateTracking={}))[L.None=0]="None",L[L.Main=1]="Main",L[L.Group=2]="Group";tt.prototype.attach=function(t){var i=this;t?(t.addListener(S()?"minimized":"minimize",function(n){return w(i,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return this.windowStateTracking&u.WindowStateTracking.Main&&this.container.getMainWindow().id===n.sender.id?[4,this.container.getAllWindows()]:[3,2];case 1:t.sent().forEach(function(t){return t.minimize()}),t.label=2;case 2:return this.windowStateTracking&u.WindowStateTracking.Group?[4,n.sender.getGroup()]:[3,4];case 3:t.sent().forEach(function(t){return t.minimize()}),t.label=4;case 4:return[2]}})})}),t.addListener(S()?"restored":"restore",function(n){return w(i,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return this.windowStateTracking&u.WindowStateTracking.Main&&this.container.getMainWindow().id===n.sender.id?[4,this.container.getAllWindows()]:[3,2];case 1:t.sent().forEach(function(t){return t.restore()}),t.label=2;case 2:return this.windowStateTracking&u.WindowStateTracking.Group?[4,n.sender.getGroup()]:[3,4];case 3:t.sent().forEach(function(t){return t.restore()}),t.label=4;case 4:return[2]}})})})):(P.addListener("window-created",function(e){return w(i,void 0,void 0,function(){var n;return y(this,function(t){switch(t.label){case 0:return this.container&&this.container.getWindowById?[4,this.container.getWindowById(e.windowId)]:[3,2];case 1:n=t.sent(),this.attach(n),t.label=2;case 2:return[2]}})})}),this.container&&this.container.getAllWindows().then(function(t){t.forEach(function(t){return i.attach(t)})}))};var L=tt;function tt(t,n){this.windowStateTracking=u.WindowStateTracking.None,this.container=t,n&&"windowStateTracking"in n&&(this.windowStateTracking=n.windowStateTracking),this.attach()}t(E,O=L),E.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)})},E.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)}))})},E.prototype.onMoving=function(f){return w(this,void 0,void 0,function(){var n,e,i,o,r,s,a,u,c,d,p,h,l=this;return y(this,function(t){switch(t.label){case 0:return(n=f.sender.id,this.snappingWindow===n)?[2]:[4,(e=f.sender).getOptions()];case 1:return(s=t.sent())&&void 0!==s.snap&&!1===s.snap?[2]:[4,e.getGroup()];case 2:return(i=t.sent(),S())?(r=new v(f.innerEvent.left,f.innerEvent.top,f.innerEvent.width,f.innerEvent.height),[3,5]):[3,3];case 3:return[4,e.getBounds()];case 4:r=t.sent(),t.label=5;case 5:return o=r,0<i.length?(S()&&this.moveWindow(e,o),[2]):[4,this.container.getAllWindows()];case 6:return s=t.sent(),a=s.filter(function(t){return n!==t.id}).map(function(e){return w(l,void 0,void 0,function(){var n;return y(this,function(t){switch(t.label){case 0:return n={window:e},[4,e.getBounds()];case 1:return n.bounds=t.sent(),[4,e.getOptions()];case 2:return[2,(n.options=t.sent(),n)]}})})}),[4,Promise.all(a)];case 7:for(a=t.sent(),u=!1,d=0,p=a.filter(function(t){return!(t.options&&void 0!==t.options.snap&&!1===t.options.snap)});d<p.length;d++)h=p[d],(c=this.getSnapBounds(c||o,h.bounds))?(u=!0,this.showGroupingHint(h.window),this.moveWindow(f.sender,c)):this.hideGroupingHint(h.window);return!u&&S()&&this.moveWindow(f.sender,o),[2]}})})},E.prototype.moveWindow=function(n,e){return w(this,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:this.snappingWindow=n.id,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,n.setBounds(e)];case 2:case 3:return t.sent(),[3,4];case 4:return this.snappingWindow=void 0,[2]}})})},E.prototype.onMoved=function(e){var t,n=this;this.autoGrouping&&(t=Array.from(this.targetGroup,function(t){t[0];var e=t[1];return w(n,void 0,void 0,function(){var n;return y(this,function(t){switch(t.label){case 0:return n={window:e},[4,e.getGroup()];case 1:return[2,(n.isGrouped=0<t.sent().length,n)]}})})}),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()},E.prototype.showGroupingHint=function(t){var n,e;null!=(e=null==(n=t.innerWindow)?void 0:n.updateOptions)&&e.call(n,{opacity:.75}),this.targetGroup.set(t.id,t)},E.prototype.hideGroupingHint=function(t){var n,e;null!=(e=null==(n=t.innerWindow)?void 0:n.updateOptions)&&e.call(n,{opacity:1}),this.targetGroup.delete(t.id)},E.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},E.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},E.prototype.getSnapBounds=function(t,n){var e,i,o,r,s,a,u,c,d,p;if(this.isHorizontallyAligned(t,n)&&(e=Math.abs(t.x-(n.right-this.snapOffset))<this.snapThreshold,i=Math.abs(t.x-n.x)<this.snapThreshold,o=Math.abs(t.right-this.snapOffset-n.x)<this.snapThreshold,r=Math.abs(t.right-n.right)<this.snapThreshold),this.isVerticallyAligned(t,n)&&(s=Math.abs(t.y-(n.bottom-this.snapOffset))<this.snapThreshold,a=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||o||s||u)return d=t.x,p=t.y,e?d=n.x+n.width-this.snapOffset:i&&(d=n.x),o?d=n.x-t.width+this.snapOffset:r&&(d=n.x+n.width-t.width),s?p=n.y+n.height-Math.floor(this.snapOffset/2):a&&(p=n.y),u?p=n.y-t.height+Math.floor(this.snapOffset/2):c&&(p=n.y+n.height-t.height),new v(d,p,t.width,t.height)};var O,nt=E;function E(t,n){t=O.call(this,t,n)||this;return t.autoGrouping=!0,t.snapThreshold=15,t.snapOffset=15,t.targetGroup=new Map,n&&("snapThreshold"in n&&(t.snapThreshold=n.snapThreshold),"snapOffset"in n&&(t.snapOffset=n.snapOffset),"autoGrouping"in n&&(t.autoGrouping=n.autoGrouping)),t}function et(){}var M,it=function(){},T=(u.Default=void 0,u.Default||(u.Default={})),ot={close:"unload"},rt=(t(k,M=P),Object.defineProperty(k.prototype,"id",{get:function(){return this.innerWindow[G.windowUuidPropertyKey]},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"name",{get:function(){return this.innerWindow[G.windowNamePropertyKey]},enumerable:!1,configurable:!0}),k.prototype.load=function(n,t){return w(this,void 0,void 0,function(){return y(this,function(t){return this.innerWindow.location.replace(n),[2]})})},k.prototype.focus=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return this.innerWindow.focus(),[2]})})},k.prototype.show=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2]})})},k.prototype.hide=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2]})})},k.prototype.close=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return this.innerWindow.close(),[2]})})},k.prototype.minimize=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return this.innerWindow.minimize(),[2]})})},k.prototype.maximize=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return this.innerWindow.maximize(),[2]})})},k.prototype.restore=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return this.innerWindow.restore(),[2]})})},k.prototype.isShowing=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2,!0]})})},k.prototype.getSnapshot=function(){return w(this,void 0,void 0,function(){return y(this,function(t){throw new Error("getSnapshot requires an implementation.")})})},k.prototype.flash=function(t,n){return w(this,void 0,void 0,function(){return y(this,function(t){throw new Error("Not supported")})})},k.prototype.getParent=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2,null]})})},k.prototype.setParent=function(t){return w(this,void 0,void 0,function(){return y(this,function(t){return[2]})})},k.prototype.getBounds=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2,new v(this.innerWindow.screenX,this.innerWindow.screenY,this.innerWindow.outerWidth,this.innerWindow.outerHeight)]})})},k.prototype.setBounds=function(n){return w(this,void 0,void 0,function(){return y(this,function(t){return this.innerWindow.moveTo(n.x,n.y),this.innerWindow.resizeTo(n.width,n.height),[2]})})},k.prototype.getOptions=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2,this.innerWindow[p.windowOptionsPropertyKey]]})})},k.prototype.getState=function(){var n,e;return w(this,void 0,void 0,function(){return y(this,function(t){return[2,null==(e=null==(n=this.nativeWindow)?void 0:n.getState)?void 0:e.call(n)]})})},k.prototype.setState=function(e){var i,o;return w(this,void 0,void 0,function(){var n;return y(this,function(t){switch(t.label){case 0:return n=null==(o=null==(i=this.nativeWindow)?void 0:i.setState)?void 0:o.call(i,e),this.emit("state-changed",{name:"state-changed",sender:this,state:e}),P.emit("state-changed",{name:"state-changed",windowId:this.id,state:e}),[4,n];case 1:return t.sent(),[2]}})})},k.prototype.attachListener=function(t,n){this.innerWindow.addEventListener(ot[t]||t,n)},k.prototype.detachListener=function(t,n){this.innerWindow.removeEventListener(ot[t]||t,n)},Object.defineProperty(k.prototype,"nativeWindow",{get:function(){return this.innerWindow},enumerable:!1,configurable:!0}),k);function k(){return null!==M&&M.apply(this,arguments)||this}T.DefaultContainerWindow=rt,N.prototype.subscribe=function(o,r,t){var e,s;return w(this,void 0,void 0,function(){var n,i=this;return y(this,function(t){return n=new U(o,function(t){var n,e;t.origin===i.container.globalWindow.location.origin&&(n=(t=t.data).source,e=t.topic,t=t.message,n===N.messageSource&&o===e&&r({topic:o},t))}),null!=(s=null==(e=this.container.globalWindow)?void 0:e.addEventListener)&&s.call(e,"message",n.listener),[2,n]})})},N.prototype.unsubscribe=function(n){return w(this,void 0,void 0,function(){return y(this,function(t){return[2,this.container.globalWindow.removeEventListener("message",n.listener)]})})},N.prototype.publish=function(r,s,a){var u;return w(this,void 0,void 0,function(){var n,e,i,o;return y(this,function(t){if(n=this.container.globalWindow?this.container.globalWindow[G.windowsPropertyKey]||(null==(u=this.container.globalWindow.opener)?void 0:u[G.windowsPropertyKey]):[])for(e in n)i=n[e],null!=a&&a.name&&a.name!==i[G.windowNamePropertyKey]||(o=(null==a?void 0:a.targetOrigin)||this.container.globalWindow.location.origin,i.postMessage({source:N.messageSource,topic:r,message:s},o));return[2]})})},N.messageSource="desktopJS";var st=N;function N(t){this.container=t}T.DefaultMessageBus=st,t(A,at=J),A.prototype.createMessageBus=function(){return new st(this)},A.prototype.setOptions=function(t){},A.prototype.getOptions=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2,{}]})})},A.prototype.getInfo=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2,this.globalWindow.navigator.appVersion]})})},A.prototype.getMainWindow=function(){var t;return this.mainWindow||(t=this.globalWindow[A.windowsPropertyKey].root,this.mainWindow=t?this.wrapWindow(t):null),this.mainWindow},A.prototype.getCurrentWindow=function(){return this.wrapWindow(this.globalWindow)},A.prototype.getWindowOptions=function(t){return u.ObjectTransform.transformProperties(t,this.windowOptionsMap)},A.prototype.wrapWindow=function(t){return new rt(t)},A.prototype.onOpen=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];var i=t.apply(this.globalWindow,n);if(i){var o=a.newGuid();try{var r=this.globalWindow[A.windowsPropertyKey];(r[o]=i)[A.windowUuidPropertyKey]=o,i.addEventListener("beforeunload",function(){i.addEventListener("unload",function(){delete r[o]})}),i[A.windowsPropertyKey]=r}catch(t){this.log("warn","Error tracking new window, '".concat(t.message,"'"))}p.emit("window-created",{name:"window-created",windowId:o}),P.emit("window-created",{name:"window-created",windowId:o})}return i},A.prototype.createWindow=function(s,a){return w(this,void 0,void 0,function(){var n,e,i,o,r;return y(this,function(t){if(r="_blank",e=this.getWindowOptions(a)){for(i in e)n=(n||"")+i+"="+e[i]+",";e&&"target"in e&&(r=e.target)}r=this.globalWindow.open(s,r,n),o=!0;try{r[p.windowOptionsPropertyKey]=a,r[A.windowNamePropertyKey]=e.name}catch(t){o=!1,this.log("warn","Error propagating properties to new window, '".concat(t.message,"'"))}return r=this.wrapWindow(r),this.emit("window-created",{sender:this,name:"window-created",window:r,windowId:o?r.id:void 0,windowName:e.name}),[2,r]})})},A.prototype.showNotification=function(n,e){var i=this;"Notification"in this.globalWindow?this.globalWindow.Notification.requestPermission(function(t){"denied"===t?i.log("warn","Notifications not permitted"):"granted"===t&&new i.globalWindow.Notification(n,e)}):this.log("warn","Notifications not supported")},A.prototype.closeAllWindows=function(o){return void 0===o&&(o=!1),w(this,void 0,void 0,function(){var n,e,i;return y(this,function(t){for(e in n=this.globalWindow[A.windowsPropertyKey])i=n[e],o&&this.globalWindow===i||i.close();return[2]})})},A.prototype.getAllWindows=function(){return w(this,void 0,void 0,function(){var n,e,i;return y(this,function(t){for(i in n=[],e=this.globalWindow[A.windowsPropertyKey])n.push(this.wrapWindow(e[i]));return[2,n]})})},A.prototype.getWindowById=function(e){return w(this,void 0,void 0,function(){var n;return y(this,function(t){return[2,(n=this.globalWindow[A.windowsPropertyKey][e])?this.wrapWindow(n):null]})})},A.prototype.getWindowByName=function(i){return w(this,void 0,void 0,function(){var n,e;return y(this,function(t){for(e in n=this.globalWindow[A.windowsPropertyKey])if(n[e][A.windowNamePropertyKey]===i)return[2,this.wrapWindow(n[e])];return[2,null]})})},A.prototype.buildLayout=function(){return w(this,void 0,void 0,function(){var a,n,e=this;return y(this,function(t){switch(t.label){case 0:return a=new $,n=[],[4,this.getAllWindows()];case 1:return t.sent().forEach(function(o){var r=o.nativeWindow;try{var s=r[p.windowOptionsPropertyKey];if(s&&"persist"in s&&!s.persist)return;n.push(w(e,void 0,void 0,function(){var n,e,i;return y(this,function(t){switch(t.label){case 0:return this.globalWindow===r?[3,2]:(e=(n=a.windows).push,i={name:o.name,url:r&&r.location?r.location.toString():void 0,id:o.id,bounds:{x:r.screenX,y:r.screenY,width:r.innerWidth,height:r.innerHeight},options:s},[4,o.getState()]);case 1:e.apply(n,[(i.state=t.sent(),i)]),t.label=2;case 2:return[2]}})}))}catch(t){e.log("warn","Error while accessing window so skipping, '".concat(t.message,"'"))}}),[4,Promise.all(n)];case 2:return t.sent(),[2,a]}})})},A.windowsPropertyKey="desktopJS-windows",A.windowUuidPropertyKey="desktopJS-uuid",A.windowNamePropertyKey="desktopJS-name",A.rootWindowUuid="root",A.defaultWindowOptionsMap={x:{target:"left"},y:{target:"top"}};var at,G=A;function A(t){t=at.call(this,t)||this;return t.windowOptionsMap=A.defaultWindowOptionsMap,t.hostType="Default",t.ipc=t.createMessageBus(),!t.globalWindow||A.windowsPropertyKey in t.globalWindow||(t.globalWindow[A.windowsPropertyKey]={root:t.globalWindow},t.globalWindow[A.windowNamePropertyKey]=t.globalWindow[A.windowUuidPropertyKey]=A.rootWindowUuid),t.screen=new ut(t.globalWindow),t}T.DefaultContainer=G,K.prototype.getPrimaryDisplay=function(){return w(this,void 0,void 0,function(){var n;return y(this,function(t){return(n=new it).scaleFactor=this.window.devicePixelRatio,n.id="Current",n.bounds=new v(this.window.screen.availLeft,this.window.screen.availTop,this.window.screen.width,this.window.screen.height),n.workArea=new v(this.window.screen.availLeft,this.window.screen.availTop,this.window.screen.availWidth,this.window.screen.availHeight),[2,n]})})},K.prototype.getAllDisplays=function(){return w(this,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return[4,this.getPrimaryDisplay()];case 1:return[2,[t.sent()]]}})})},K.prototype.getMousePosition=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2,{x:this.window.event.screenX,y:this.window.event.screenY}]})})};var ut=K;function K(t){this.window=t}function ct(){}var j=[];u.container=void 0;function dt(){}function pt(){}u.Container=p,u.ContainerBase=C,u.ContainerNotification=R,u.ContainerRegistration=ct,u.ContainerWindow=P,u.Display=it,u.EventArgs=r,u.EventEmitter=e,u.GlobalShortcutManager=pt,u.GroupWindowManager=L,u.Guid=a,u.LayoutEventArgs=I,u.MenuItem=z,u.MessageBusOptions=_,u.MessageBusSubscription=U,u.NotificationOptions=F,u.PersistedWindow=Z,u.PersistedWindowLayout=$,u.Point=et,u.PropertyMap=V,u.Rectangle=v,u.SnapAssistWindowManager=nt,u.TrayIconDetails=dt,u.WebContainerBase=J,u.WindowEventArgs=q,u.WindowGroupEventArgs=Y,u.clearRegistry=function(){j.splice(0,j.length),u.container=void 0},u.registerContainer=function(t,n){j.push({id:t,registration:n})},u.resolveContainer=function(t,n){var e=!1,i=n;if("boolean"==typeof t?e=t:i=t,e||!u.container)try{for(var o=0;o<j.length;o++)var r=j[o].id,s=j[o].registration,a=s.condition(i)?s:a;u.container=a?a.create(i):void 0}catch(t){console.error("Error resolving container '".concat(r,"' : ").concat(t.toString()))}finally{u.container=u.container||new u.Default.DefaultContainer}return u.container},u.version="3.13.1",Object.defineProperty(u,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=desktop.min.js.map |
@@ -1,2 +0,2 @@ | ||
var desktopJS=function(u){"use strict";var i=function(t,n){return(i=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 r(t,n){function e(){this.constructor=t}i(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}function v(r,s,a,u){return new(a||(a=Promise))(function(t,n){function e(t){try{o(u.next(t))}catch(t){n(t)}}function i(t){try{o(u.throw(t))}catch(t){n(t)}}function o(n){n.done?t(n.value):new a(function(t){t(n.value)}).then(e,i)}o((u=u.apply(r,s||[])).next())})}function g(e,i){var o,r,s,t,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[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(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,r&&(s=2&n[0]?r.return:n[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,n[1])).done)return s;switch(r=0,s&&(n=[2&n[0],s.value]),n[0]){case 0:case 1:s=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,r=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(!(s=0<(s=a.trys).length&&s[s.length-1])&&(6===n[0]||2===n[0])){a=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){a.label=n[1];break}if(6===n[0]&&a.label<s[1]){a.label=s[1],s=n;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(n);break}s[2]&&a.ops.pop(),a.trys.pop();continue}n=i.call(e,a)}catch(t){n=[6,t],r=0}finally{o=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,t])}}}var s=function(t,n,e){this.sender=t,this.name=n,this.innerEvent=e},o=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(i,o){var r=this;return function(t){var n=new s(r,i,t);r.preProcessArgs(n);var e=o(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 i=e.indexOf(n);0<=i&&e.splice(i,1)}return this},r.prototype.listeners=function(t){return this.eventListeners[t]||[]},r.prototype.emit=function(t,n){for(var e=0,i=this.listeners(t);e<i.length;e++){(0,i[e])(n)}},Object.defineProperty(r,"ipc",{set:function(t){t&&t.subscribe(r.staticEventName,function(t,n){r.emit(n.eventName,n.eventArgs)})},enumerable:!1,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 i=e.indexOf(n);0<=i&&e.splice(i,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 i=0,o=r.listeners(t);i<o.length;i++){(0,o[i])(n)}},r.staticEventListeners=new Map,r.staticEventName="desktopJS.static-event",r}(),a=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 r(n,t),n}(s),p=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return r(i,e),i.prototype.getInfo=function(){return v(this,void 0,Promise,function(){return g(this,function(t){return[2,void 0]})})},i.prototype.ready=function(){return Promise.resolve()},Object.defineProperty(i,"ipc",{get:function(){return i._ipc},set:function(t){o.ipc=i._ipc=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"ipc",{get:function(){return i.ipc},set:function(t){i.ipc=t},enumerable:!1,configurable:!0}),i.prototype.addListener=function(t,n){return e.prototype.addListener.call(this,t,n)},i.prototype.removeListener=function(t,n){return e.prototype.removeListener.call(this,t,n)},i.prototype.emit=function(t,n){e.prototype.emit.call(this,t,n)},i.addListener=function(t,n){o.addListener(i.staticEventScopePrefix+t,n)},i.removeListener=function(t,n){o.removeListener(i.staticEventScopePrefix+t,n)},i.emit=function(t,n){o.emit(i.staticEventScopePrefix+t,n,i.ipc)},i.listeners=function(t){return o.listeners(i.staticEventScopePrefix+t)},i.staticEventScopePrefix="container-",i.windowOptionsPropertyKey="desktopJS-options",i}(o),n=function(n){function i(){var t=null!==n&&n.apply(this,arguments)||this;return t.uuid=a.newGuid(),t.storage="undefined"!=typeof window&&window?window.localStorage:void 0,t}return r(i,n),i.prototype.showNotification=function(t,n){throw new TypeError("Notifications not supported by this container")},i.prototype.addTrayIcon=function(t,n,e){throw new TypeError("Tray icons are not supported by this container.")},i.prototype.getLayoutFromStorage=function(t){return JSON.parse(this.storage.getItem(i.layoutsPropertyKey))[t]},i.prototype.saveLayoutToStorage=function(t,n){var e=JSON.parse(this.storage.getItem(i.layoutsPropertyKey))||{};n.name||(n.name=t),e[t]=n,this.storage.setItem(i.layoutsPropertyKey,JSON.stringify(e)),this.emit("layout-saved",{sender:this,name:"layout-saved",layout:n,layoutName:n.name}),p.emit("layout-saved",{name:"layout-saved",layout:n,layoutName:n.name})},i.prototype.deleteLayoutFromStorage=function(t){var n=JSON.parse(this.storage.getItem(i.layoutsPropertyKey))||{},e=n[t];e&&(delete n[t],this.storage.setItem(i.layoutsPropertyKey,JSON.stringify(n)),this.emit("layout-deleted",{sender:this,name:"layout-deleted",layoutName:e.name}),p.emit("layout-deleted",{name:"layout-deleted",layoutName:e.name}))},i.prototype.loadLayout=function(d){return v(this,void 0,Promise,function(){var o,n,e,i,r,s,a,u,c=this;return g(this,function(t){switch(t.label){case 0:return[4,this.closeAllWindows(!0)];case 1:if(t.sent(),!(null==(o="string"==typeof d?this.getLayoutFromStorage(d):d)?void 0:o.windows))return[3,3];for(n=[],e=0,i=o.windows;e<i.length;e++)r=i[e],(s=Object.assign(r.options||{},r.bounds)).name=r.name,r.main?(this.getMainWindow().setBounds(r.bounds),n.push(Promise.resolve(this.getMainWindow()))):n.push(this.createWindow(r.url,s));return[4,Promise.all(n)];case 2:return a=t.sent(),u=new Map,a.forEach(function(e){var t=o.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 i=!1;if(u.forEach(function(t,n){!i&&0<=t.indexOf(e.id)&&(i=!0)}),!i){var n=t?t.group:void 0;n&&0<n.length&&u.set(e,n.filter(function(t){return t!==e.id}))}}),u.forEach(function(t,e){t.forEach(function(n){c.getWindowByName(o.windows.find(function(t){return t.id===n}).name).then(function(t){t.joinGroup(e)})})}),this.emit("layout-loaded",{sender:this,name:"layout-loaded",layout:o,layoutName:o.name}),p.emit("layout-loaded",{name:"layout-loaded",layout:o,layoutName:o.name}),[2,o];case 3:throw new Error("Layout does not exist or is invalid")}})})},i.prototype.saveLayout=function(e){return v(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return[4,this.buildLayout()];case 1:return n=t.sent(),this.saveLayoutToStorage(e,n),[2,n]}})})},i.prototype.deleteLayout=function(n){return v(this,void 0,void 0,function(){return g(this,function(t){return[2,this.deleteLayoutFromStorage(n)]})})},i.prototype.getLayouts=function(){return v(this,void 0,Promise,function(){var n,e;return g(this,function(t){return(n=this.storage.getItem(i.layoutsPropertyKey))?(e=JSON.parse(n),[2,Object.getOwnPropertyNames(e).map(function(t){return e[t]})]):[2]})})},i.prototype.log=function(e,i){return v(this,void 0,void 0,function(){var n;return g(this,function(t){switch(e){case"debug":case"warn":case"error":n=console[e];break;default:n=console.log}return n&&n(i),[2]})})},i.layoutsPropertyKey="desktopJS-layouts",i}(p),c=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 i=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 i=Array(t),o=0;for(n=0;n<e;n++)for(var r=arguments[n],s=0,a=r.length;s<a;s++,o++)i[o]=r[s];return i}([i],t))}}return e}return r(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),h=function(t,n,e){this.topic=t,this.listener=n,this.options=e},e=function(){},d=function(){},f=function(){},l=function(){function e(t,n){this.title=t,this.options=n}return e.requestPermission=function(n){return v(this,void 0,Promise,function(){return g(this,function(t){return n&&n(e.permission),[2,e.permission]})})},e.permission="granted",e}(),w=function(){};u.ObjectTransform=void 0,(u.ObjectTransform||(u.ObjectTransform={})).transformProperties=function(t,n){var e={};if(t)for(var i in t)try{i in n?e[n[i].target]=n[i].convert?n[i].convert(t[i],t,e):t[i]:e[i]=t[i]}catch(t){console.error("Error transforming property '"+i+"'")}return e};var y,m=function(){function t(t,n,e,i){this.x=t,this.y=n,this.width=e,this.height=i}return Object.defineProperty(t.prototype,"right",{get:function(){return t.getRight(this)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return t.getBottom(this)},enumerable:!1,configurable:!0}),t.getRight=function(t){return t.x+t.width},t.getBottom=function(t){return t.y+t.height},t}(),b=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r(n,t),n}(s),W=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r(n,t),n}(b),P=function(i){function e(t){var n=i.call(this)||this;return n.innerWindow=t,n}return r(e,i),Object.defineProperty(e.prototype,"allowGrouping",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.getGroup=function(){return v(this,void 0,Promise,function(){return g(this,function(t){return[2,[]]})})},e.prototype.joinGroup=function(t){return v(this,void 0,Promise,function(){return g(this,function(t){throw new Error("Not supported")})})},e.prototype.leaveGroup=function(){return v(this,void 0,Promise,function(){return g(this,function(t){return[2]})})},e.prototype.bringToFront=function(){return this.focus()},e.prototype.getState=function(){return v(this,void 0,Promise,function(){return g(this,function(t){return[2]})})},e.prototype.setState=function(t){return v(this,void 0,Promise,function(){return g(this,function(t){return[2]})})},Object.defineProperty(e.prototype,"nativeWindow",{get:function(){},enumerable:!1,configurable:!0}),e.prototype.addListener=function(t,n){var e=this.registerAndWrapListener(t,n);return this.attachListener(t,e),i.prototype.addListener.call(this,t,e)},e.prototype.removeListener=function(t,n){var e=this.unwrapAndUnRegisterListener(n)||n;return this.detachListener(t,e),i.prototype.removeListener.call(this,t,e)},e.addListener=function(t,n){o.addListener(e.staticEventScopePrefix+t,n)},e.removeListener=function(t,n){o.removeListener(e.staticEventScopePrefix+t,n)},e.emit=function(t,n){o.emit(e.staticEventScopePrefix+t,n,p.ipc)},e.listeners=function(t){return o.listeners(e.staticEventScopePrefix+t)},e.staticEventScopePrefix="containerwindow-",e}(o),x=function(){},S=function(t){this.windows=[],this.name=t};function L(){return"undefined"!=typeof window&&window.fin}u.WindowStateTracking=void 0,(y=u.WindowStateTracking||(u.WindowStateTracking={}))[y.None=0]="None",y[y.Main=1]="Main",y[y.Group=2]="Group";var O=function(){function t(t,n){this.windowStateTracking=u.WindowStateTracking.None,this.container=t,n&&"windowStateTracking"in n&&(this.windowStateTracking=n.windowStateTracking),this.attach()}return t.prototype.attach=function(t){var i=this;t?(t.addListener(L()?"minimized":"minimize",function(n){return v(i,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this.windowStateTracking&u.WindowStateTracking.Main&&this.container.getMainWindow().id===n.sender.id?[4,this.container.getAllWindows()]:[3,2];case 1:t.sent().forEach(function(t){return t.minimize()}),t.label=2;case 2:return this.windowStateTracking&u.WindowStateTracking.Group?[4,n.sender.getGroup()]:[3,4];case 3:t.sent().forEach(function(t){return t.minimize()}),t.label=4;case 4:return[2]}})})}),t.addListener(L()?"restored":"restore",function(n){return v(i,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return this.windowStateTracking&u.WindowStateTracking.Main&&this.container.getMainWindow().id===n.sender.id?[4,this.container.getAllWindows()]:[3,2];case 1:t.sent().forEach(function(t){return t.restore()}),t.label=2;case 2:return this.windowStateTracking&u.WindowStateTracking.Group?[4,n.sender.getGroup()]:[3,4];case 3:t.sent().forEach(function(t){return t.restore()}),t.label=4;case 4:return[2]}})})})):(P.addListener("window-created",function(e){return v(i,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return this.container&&this.container.getWindowById?[4,this.container.getWindowById(e.windowId)]:[3,2];case 1:n=t.sent(),this.attach(n),t.label=2;case 2:return[2]}})})}),this.container&&this.container.getAllWindows().then(function(t){t.forEach(function(t){return i.attach(t)})}))},t}(),E=function(i){function t(t,n){var e=i.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 r(t,i),t.prototype.onAttached=function(t){var n=this;t.innerWindow&&t.innerWindow.disableFrame&&t.innerWindow.disableFrame(),L()?(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;i.prototype.attach.call(this,n),n&&n.getOptions().then(function(t){t&&void 0!==t.snap&&!1===t.snap||(e.onAttached(n),n.addListener(L()?"disabled-frame-bounds-changing":"move",function(t){return e.onMoving(t)}))})},t.prototype.onMoving=function(y){return v(this,void 0,void 0,function(){var n,e,i,o,r,s,a,u,c,d,p,h,f,l,w=this;return g(this,function(t){switch(t.label){case 0:return n=y.sender.id,this.snappingWindow===n?[2]:[4,(e=y.sender).getOptions()];case 1:return(i=t.sent())&&void 0!==i.snap&&!1===i.snap?[2]:[4,e.getGroup()];case 2:return o=t.sent(),L()?(s=new m(y.innerEvent.left,y.innerEvent.top,y.innerEvent.width,y.innerEvent.height),[3,5]):[3,3];case 3:return[4,e.getBounds()];case 4:s=t.sent(),t.label=5;case 5:return r=s,0<o.length?(L()&&this.moveWindow(e,r),[2]):[4,this.container.getAllWindows()];case 6:return a=t.sent(),u=a.filter(function(t){return n!==t.id}).map(function(e){return v(w,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return n={window:e},[4,e.getBounds()];case 1:return n.bounds=t.sent(),[4,e.getOptions()];case 2:return[2,(n.options=t.sent(),n)]}})})}),[4,Promise.all(u)];case 7:for(c=t.sent(),d=!1,h=0,f=c.filter(function(t){return!(t.options&&void 0!==t.options.snap&&!1===t.options.snap)});h<f.length;h++)l=f[h],(p=this.getSnapBounds(p||r,l.bounds))?(d=!0,this.showGroupingHint(l.window),this.moveWindow(y.sender,p)):this.hideGroupingHint(l.window);return!d&&L()&&this.moveWindow(y.sender,r),[2]}})})},t.prototype.moveWindow=function(n,e){return v(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:this.snappingWindow=n.id,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,n.setBounds(e)];case 2:case 3:return t.sent(),[3,4];case 4:return this.snappingWindow=void 0,[2]}})})},t.prototype.onMoved=function(e){var n=this;if(this.autoGrouping){var t=Array.from(this.targetGroup,function(t){t[0];var e=t[1];return v(n,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return n={window:e},[4,e.getGroup()];case 1:return[2,(n.isGrouped=0<t.sent().length,n)]}})})});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){var n,e;null===(e=null===(n=t.innerWindow)||void 0===n?void 0:n.updateOptions)||void 0===e||e.call(n,{opacity:.75}),this.targetGroup.set(t.id,t)},t.prototype.hideGroupingHint=function(t){var n,e;null===(e=null===(n=t.innerWindow)||void 0===n?void 0:n.updateOptions)||void 0===e||e.call(n,{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,i,o,r,s,a,u,c;if(this.isHorizontallyAligned(t,n)&&(e=Math.abs(t.x-(n.right-this.snapOffset))<this.snapThreshold,i=Math.abs(t.x-n.x)<this.snapThreshold,o=Math.abs(t.right-this.snapOffset-n.x)<this.snapThreshold,r=Math.abs(t.right-n.right)<this.snapThreshold),this.isVerticallyAligned(t,n)&&(s=Math.abs(t.y-(n.bottom-this.snapOffset))<this.snapThreshold,a=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||o||s||u){var d=t.x,p=t.y;return e?d=n.x+n.width-this.snapOffset:i&&(d=n.x),o?d=n.x-t.width+this.snapOffset:r&&(d=n.x+n.width-t.width),s?p=n.y+n.height-Math.floor(this.snapOffset/2):a&&(p=n.y),u?p=n.y-t.height+Math.floor(this.snapOffset/2):c&&(p=n.y+n.height-t.height),new m(d,p,t.width,t.height)}},t}(O),M=function(){},T=function(){};u.Default=void 0,function(t){var e={close:"unload"},n=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r(n,t),Object.defineProperty(n.prototype,"id",{get:function(){return this.innerWindow[d.windowUuidPropertyKey]},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"name",{get:function(){return this.innerWindow[d.windowNamePropertyKey]},enumerable:!1,configurable:!0}),n.prototype.load=function(n,t){return v(this,void 0,void 0,function(){return g(this,function(t){return this.innerWindow.location.replace(n),[2]})})},n.prototype.focus=function(){return v(this,void 0,void 0,function(){return g(this,function(t){return this.innerWindow.focus(),[2]})})},n.prototype.show=function(){return v(this,void 0,void 0,function(){return g(this,function(t){return[2]})})},n.prototype.hide=function(){return v(this,void 0,void 0,function(){return g(this,function(t){return[2]})})},n.prototype.close=function(){return v(this,void 0,void 0,function(){return g(this,function(t){return this.innerWindow.close(),[2]})})},n.prototype.minimize=function(){return v(this,void 0,void 0,function(){return g(this,function(t){return this.innerWindow.minimize(),[2]})})},n.prototype.maximize=function(){return v(this,void 0,void 0,function(){return g(this,function(t){return this.innerWindow.maximize(),[2]})})},n.prototype.restore=function(){return v(this,void 0,void 0,function(){return g(this,function(t){return this.innerWindow.restore(),[2]})})},n.prototype.isShowing=function(){return v(this,void 0,void 0,function(){return g(this,function(t){return[2,!0]})})},n.prototype.getSnapshot=function(){return v(this,void 0,Promise,function(){return g(this,function(t){throw new Error("getSnapshot requires an implementation.")})})},n.prototype.flash=function(t,n){return v(this,void 0,void 0,function(){return g(this,function(t){throw new Error("Not supported")})})},n.prototype.getParent=function(){return v(this,void 0,Promise,function(){return g(this,function(t){return[2,null]})})},n.prototype.setParent=function(t){return v(this,void 0,void 0,function(){return g(this,function(t){return[2]})})},n.prototype.getBounds=function(){return v(this,void 0,void 0,function(){return g(this,function(t){return[2,new m(this.innerWindow.screenX,this.innerWindow.screenY,this.innerWindow.outerWidth,this.innerWindow.outerHeight)]})})},n.prototype.setBounds=function(n){return v(this,void 0,void 0,function(){return g(this,function(t){return this.innerWindow.moveTo(n.x,n.y),this.innerWindow.resizeTo(n.width,n.height),[2]})})},n.prototype.getOptions=function(){return v(this,void 0,void 0,function(){return g(this,function(t){return[2,this.innerWindow[p.windowOptionsPropertyKey]]})})},n.prototype.getState=function(){var n,e;return v(this,void 0,void 0,function(){return g(this,function(t){return[2,null===(e=null===(n=this.nativeWindow)||void 0===n?void 0:n.getState)||void 0===e?void 0:e.call(n)]})})},n.prototype.setState=function(e){var i,o;return v(this,void 0,void 0,function(){var n;return g(this,function(t){switch(t.label){case 0:return n=null===(o=null===(i=this.nativeWindow)||void 0===i?void 0:i.setState)||void 0===o?void 0:o.call(i,e),this.emit("state-changed",{name:"state-changed",sender:this,state:e}),P.emit("state-changed",{name:"state-changed",windowId:this.id,state:e}),[4,n];case 1:return t.sent(),[2]}})})},n.prototype.attachListener=function(t,n){this.innerWindow.addEventListener(e[t]||t,n)},n.prototype.detachListener=function(t,n){this.innerWindow.removeEventListener(e[t]||t,n)},Object.defineProperty(n.prototype,"nativeWindow",{get:function(){return this.innerWindow},enumerable:!1,configurable:!0}),n}(P);t.DefaultContainerWindow=n;var i=function(){function c(t){this.container=t}return c.prototype.subscribe=function(s,a,t){var e,i;return v(this,void 0,void 0,function(){var n,r=this;return g(this,function(t){return n=new h(s,function(t){if(t.origin===r.container.globalWindow.location.origin){var n=t.data,e=n.source,i=n.topic,o=n.message;e===c.messageSource&&s===i&&a({topic:s},o)}}),null===(i=null===(e=this.container.globalWindow)||void 0===e?void 0:e.addEventListener)||void 0===i||i.call(e,"message",n.listener),[2,n]})})},c.prototype.unsubscribe=function(n){return v(this,void 0,void 0,function(){return g(this,function(t){return[2,this.container.globalWindow.removeEventListener("message",n.listener)]})})},c.prototype.publish=function(r,s,a){var u;return v(this,void 0,void 0,function(){var n,e,i,o;return g(this,function(t){if(n=this.container.globalWindow?this.container.globalWindow[d.windowsPropertyKey]||(null===(u=this.container.globalWindow.opener)||void 0===u?void 0:u[d.windowsPropertyKey]):[])for(e in n)i=n[e],null!=a&&a.name&&a.name!==i[d.windowNamePropertyKey]||(o=(null==a?void 0:a.targetOrigin)||this.container.globalWindow.location.origin,i.postMessage({source:c.messageSource,topic:r,message:s},o));return[2]})})},c.messageSource="desktopJS",c}();t.DefaultMessageBus=i;var d=function(e){function d(t){var n=e.call(this,t)||this;return n.windowOptionsMap=d.defaultWindowOptionsMap,n.hostType="Default",n.ipc=n.createMessageBus(),!n.globalWindow||d.windowsPropertyKey in n.globalWindow||(n.globalWindow[d.windowsPropertyKey]={root:n.globalWindow},n.globalWindow[d.windowNamePropertyKey]=n.globalWindow[d.windowUuidPropertyKey]=d.rootWindowUuid),n.screen=new o(n.globalWindow),n}return r(d,e),d.prototype.createMessageBus=function(){return new i(this)},d.prototype.setOptions=function(t){},d.prototype.getOptions=function(){return v(this,void 0,Promise,function(){return g(this,function(t){return[2,{}]})})},d.prototype.getInfo=function(){return v(this,void 0,Promise,function(){return g(this,function(t){return[2,this.globalWindow.navigator.appVersion]})})},d.prototype.getMainWindow=function(){if(!this.mainWindow){var t=this.globalWindow[d.windowsPropertyKey].root;this.mainWindow=t?this.wrapWindow(t):null}return this.mainWindow},d.prototype.getCurrentWindow=function(){return this.wrapWindow(this.globalWindow)},d.prototype.getWindowOptions=function(t){return u.ObjectTransform.transformProperties(t,this.windowOptionsMap)},d.prototype.wrapWindow=function(t){return new n(t)},d.prototype.onOpen=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];var i=t.apply(this.globalWindow,n),o=a.newGuid();try{var r=this.globalWindow[d.windowsPropertyKey];(r[o]=i)[d.windowUuidPropertyKey]=o,i.addEventListener("beforeunload",function(){i.addEventListener("unload",function(){delete r[o]})}),i[d.windowsPropertyKey]=r}catch(t){this.log("warn","Error tracking new window, '"+t.message+"'")}return p.emit("window-created",{name:"window-created",windowId:o}),P.emit("window-created",{name:"window-created",windowId:o}),i},d.prototype.createWindow=function(u,c){return v(this,void 0,Promise,function(){var n,e,i,o,r,s,a;return g(this,function(t){if(e="_blank",i=this.getWindowOptions(c)){for(o in i)n=(n||"")+o+"="+i[o]+",";i&&"target"in i&&(e=i.target)}r=this.globalWindow.open(u,e,n),s=!0;try{r[p.windowOptionsPropertyKey]=c,r[d.windowNamePropertyKey]=i.name}catch(t){s=!1,this.log("warn","Error proprogating properties to new window, '"+t.message+"'")}return a=this.wrapWindow(r),this.emit("window-created",{sender:this,name:"window-created",window:a,windowId:s?a.id:void 0,windowName:i.name}),[2,a]})})},d.prototype.showNotification=function(n,e){var i=this;"Notification"in this.globalWindow?this.globalWindow.Notification.requestPermission(function(t){"denied"===t?i.log("warn","Notifications not permitted"):"granted"===t&&new i.globalWindow.Notification(n,e)}):this.log("warn","Notifications not supported")},d.prototype.closeAllWindows=function(o){return void 0===o&&(o=!1),v(this,void 0,void 0,function(){var n,e,i;return g(this,function(t){for(e in n=this.globalWindow[d.windowsPropertyKey])i=n[e],o&&this.globalWindow===i||i.close();return[2]})})},d.prototype.getAllWindows=function(){return v(this,void 0,void 0,function(){var n,e,i;return g(this,function(t){for(i in n=[],e=this.globalWindow[d.windowsPropertyKey])n.push(this.wrapWindow(e[i]));return[2,n]})})},d.prototype.getWindowById=function(e){return v(this,void 0,Promise,function(){var n;return g(this,function(t){return[2,(n=this.globalWindow[d.windowsPropertyKey][e])?this.wrapWindow(n):null]})})},d.prototype.getWindowByName=function(i){return v(this,void 0,Promise,function(){var n,e;return g(this,function(t){for(e in n=this.globalWindow[d.windowsPropertyKey])if(n[e][d.windowNamePropertyKey]===i)return[2,this.wrapWindow(n[e])];return[2,null]})})},d.prototype.buildLayout=function(){return v(this,void 0,void 0,function(){var a,n,e=this;return g(this,function(t){switch(t.label){case 0:return a=new S,n=[],[4,this.getAllWindows()];case 1:return t.sent().forEach(function(o){var r=o.nativeWindow;try{var s=r[p.windowOptionsPropertyKey];if(s&&"persist"in s&&!s.persist)return;n.push(v(e,void 0,void 0,function(){var n,e,i;return g(this,function(t){switch(t.label){case 0:return this.globalWindow===r?[3,2]:(e=(n=a.windows).push,i={name:o.name,url:r&&r.location?r.location.toString():void 0,id:o.id,bounds:{x:r.screenX,y:r.screenY,width:r.innerWidth,height:r.innerHeight},options:s},[4,o.getState()]);case 1:e.apply(n,[(i.state=t.sent(),i)]),t.label=2;case 2:return[2]}})}))}catch(t){e.log("warn","Error while accessing window so skipping, '"+t.message+"'")}}),[4,Promise.all(n)];case 2:return t.sent(),[2,a]}})})},d.windowsPropertyKey="desktopJS-windows",d.windowUuidPropertyKey="desktopJS-uuid",d.windowNamePropertyKey="desktopJS-name",d.rootWindowUuid="root",d.defaultWindowOptionsMap={x:{target:"left"},y:{target:"top"}},d}(c);t.DefaultContainer=d;var o=function(){function t(t){this.window=t}return t.prototype.getPrimaryDisplay=function(){return v(this,void 0,void 0,function(){var n;return g(this,function(t){return(n=new T).scaleFactor=this.window.devicePixelRatio,n.id="Current",n.bounds=new m(this.window.screen.availLeft,this.window.screen.availTop,this.window.screen.width,this.window.screen.height),n.workArea=new m(this.window.screen.availLeft,this.window.screen.availTop,this.window.screen.availWidth,this.window.screen.availHeight),[2,n]})})},t.prototype.getAllDisplays=function(){return v(this,void 0,void 0,function(){return g(this,function(t){switch(t.label){case 0:return[4,this.getPrimaryDisplay()];case 1:return[2,[t.sent()]]}})})},t.prototype.getMousePosition=function(){return v(this,void 0,void 0,function(){return g(this,function(t){return[2,{x:this.window.event.screenX,y:this.window.event.screenY}]})})},t}()}(u.Default||(u.Default={}));var k=function(){},N=[];u.container=void 0;var G=function(){},A=function(){};return u.Container=p,u.ContainerBase=n,u.ContainerNotification=l,u.ContainerRegistration=k,u.ContainerWindow=P,u.Display=T,u.EventArgs=s,u.EventEmitter=o,u.GlobalShortcutManager=A,u.GroupWindowManager=O,u.Guid=a,u.LayoutEventArgs=t,u.MenuItem=d,u.MessageBusOptions=e,u.MessageBusSubscription=h,u.NotificationOptions=f,u.PersistedWindow=x,u.PersistedWindowLayout=S,u.Point=M,u.PropertyMap=w,u.Rectangle=m,u.SnapAssistWindowManager=E,u.TrayIconDetails=G,u.WebContainerBase=c,u.WindowEventArgs=b,u.WindowGroupEventArgs=W,u.clearRegistry=function(){N.splice(0,N.length),u.container=void 0},u.registerContainer=function(t,n){N.push({id:t,registration:n})},u.resolveContainer=function(t,n){var e,i,o=!1,r=n;if("boolean"==typeof t?o=t:r=t,!o&&u.container)return u.container;try{for(var s=0;s<N.length;s++){i=N[s].id;var a=N[s].registration;e=a.condition(r)?a:e}u.container=e?e.create(r):void 0}catch(t){console.error("Error resolving container '"+i+"' : "+t.toString())}finally{u.container=u.container||new u.Default.DefaultContainer}return u.container},u.version="3.12.0",Object.defineProperty(u,"__esModule",{value:!0}),u}({}); | ||
var desktopJS=function(u){"use strict";var i=function(t,n){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])})(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}i(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}function w(t,s,a,u){return new(a=a||Promise)(function(e,n){function i(t){try{r(u.next(t))}catch(t){n(t)}}function o(t){try{r(u.throw(t))}catch(t){n(t)}}function r(t){var n;t.done?e(t.value):((n=t.value)instanceof a?n:new a(function(t){t(n)})).then(i,o)}r((u=u.apply(t,s||[])).next())})}function y(i,o){var r,s,a,u={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},c={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function t(e){return function(t){var n=[e,t];if(r)throw new TypeError("Generator is already executing.");for(;u=c&&n[c=0]?0:u;)try{if(r=1,s&&(a=2&n[0]?s.return:n[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,n[1])).done)return a;switch(s=0,(n=a?[2&n[0],a.value]:n)[0]){case 0:case 1:a=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,s=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(!(a=0<(a=u.trys).length&&a[a.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!a||n[1]>a[0]&&n[1]<a[3])){u.label=n[1];break}if(6===n[0]&&u.label<a[1]){u.label=a[1],a=n;break}if(a&&u.label<a[2]){u.label=a[2],u.ops.push(n);break}a[2]&&u.ops.pop(),u.trys.pop();continue}n=o.call(i,u)}catch(t){n=[6,t],s=0}finally{r=a=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}}}var r=function(t,n,e){this.sender=t,this.name=n,this.innerEvent=e},e=(s.prototype.addListener=function(t,n){return(this.eventListeners[t]=this.eventListeners[t]||[]).push(n),this},s.prototype.registerAndWrapListener=function(t,n){t=this.wrapListener(t,n);return this.wrappedListeners.set(n,t),t},s.prototype.wrapListener=function(e,i){var o=this;return function(t){var t=new r(o,e,t),n=(o.preProcessArgs(t),i(t));return o.postProcessArgs(t),n}},s.prototype.preProcessArgs=function(t){},s.prototype.postProcessArgs=function(t){t&&void 0!==t.returnValue&&(t.innerEvent.returnValue=t.returnValue)},s.prototype.unwrapAndUnRegisterListener=function(t){var n=this.wrappedListeners.get(t);return n&&this.wrappedListeners.delete(t),n},s.prototype.removeListener=function(t,n){t=this.listeners(t);return t&&0<=(n=t.indexOf(n))&&t.splice(n,1),this},s.prototype.listeners=function(t){return this.eventListeners[t]||[]},s.prototype.emit=function(t,n){for(var e=0,i=this.listeners(t);e<i.length;e++)(0,i[e])(n)},Object.defineProperty(s,"ipc",{set:function(t){t&&t.subscribe(s.staticEventName,function(t,n){s.emit(n.eventName,n.eventArgs)})},enumerable:!1,configurable:!0}),s.addListener=function(t,n){(this.staticEventListeners[t]=this.staticEventListeners[t]||[]).push(n)},s.removeListener=function(t,n){t=s.listeners(t);t&&0<=(n=t.indexOf(n))&&t.splice(n,1)},s.listeners=function(t){return this.staticEventListeners[t]||[]},s.emit=function(t,n,e){if(e&&e.publish)e.publish(s.staticEventName,{eventName:t,eventArgs:n});else for(var i=0,o=s.listeners(t);i<o.length;i++)(0,o[i])(n)},s.staticEventListeners=new Map,s.staticEventName="desktopJS.static-event",s);function s(){this.eventListeners=new Map,this.wrappedListeners=new Map}B.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)})};var a=B;function B(){}t(H,n=r);var n,I=H;function H(){return null!==n&&n.apply(this,arguments)||this}t(c,o=e),c.prototype.getInfo=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2,void 0]})})},c.prototype.ready=function(){return Promise.resolve()},Object.defineProperty(c,"ipc",{get:function(){return c._ipc},set:function(t){e.ipc=c._ipc=t},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"ipc",{get:function(){return c.ipc},set:function(t){c.ipc=t},enumerable:!1,configurable:!0}),c.prototype.addListener=function(t,n){return o.prototype.addListener.call(this,t,n)},c.prototype.removeListener=function(t,n){return o.prototype.removeListener.call(this,t,n)},c.prototype.emit=function(t,n){o.prototype.emit.call(this,t,n)},c.addListener=function(t,n){e.addListener(c.staticEventScopePrefix+t,n)},c.removeListener=function(t,n){e.removeListener(c.staticEventScopePrefix+t,n)},c.emit=function(t,n){e.emit(c.staticEventScopePrefix+t,n,c.ipc)},c.listeners=function(t){return e.listeners(c.staticEventScopePrefix+t)},c.staticEventScopePrefix="container-",c.windowOptionsPropertyKey="desktopJS-options";var o,p=c;function c(){return null!==o&&o.apply(this,arguments)||this}t(h,d=p),h.prototype.showNotification=function(t,n){throw new TypeError("Notifications not supported by this container")},h.prototype.addTrayIcon=function(t,n,e){throw new TypeError("Tray icons are not supported by this container.")},h.prototype.getLayoutFromStorage=function(t){return JSON.parse(this.storage.getItem(h.layoutsPropertyKey))[t]},h.prototype.saveLayoutToStorage=function(t,n){var e=JSON.parse(this.storage.getItem(h.layoutsPropertyKey))||{};n.name||(n.name=t),e[t]=n,this.storage.setItem(h.layoutsPropertyKey,JSON.stringify(e)),this.emit("layout-saved",{sender:this,name:"layout-saved",layout:n,layoutName:n.name}),p.emit("layout-saved",{name:"layout-saved",layout:n,layoutName:n.name})},h.prototype.deleteLayoutFromStorage=function(t){var n=JSON.parse(this.storage.getItem(h.layoutsPropertyKey))||{},e=n[t];e&&(delete n[t],this.storage.setItem(h.layoutsPropertyKey,JSON.stringify(n)),this.emit("layout-deleted",{sender:this,name:"layout-deleted",layoutName:e.name}),p.emit("layout-deleted",{name:"layout-deleted",layoutName:e.name}))},h.prototype.loadLayout=function(d){return w(this,void 0,void 0,function(){var o,n,e,i,r,s,a,u,c=this;return y(this,function(t){switch(t.label){case 0:return[4,this.closeAllWindows(!0)];case 1:if(t.sent(),null==(o="string"==typeof d?this.getLayoutFromStorage(d):d)||!o.windows)return[3,3];for(n=[],e=0,i=o.windows;e<i.length;e++)r=i[e],(s=Object.assign(r.options||{},r.bounds)).name=r.name,r.main?(this.getMainWindow().setBounds(r.bounds),n.push(Promise.resolve(this.getMainWindow()))):n.push(this.createWindow(r.url,s));return[4,Promise.all(n)];case 2:return a=t.sent(),u=new Map,a.forEach(function(e){var t=o.windows.find(function(t){return t.name===e.name}),i=(t&&t.state&&e.setState&&e.setState(t.state).catch(function(t){return c.log("error","Error invoking setState: "+t)}),!1);u.forEach(function(t,n){!i&&0<=t.indexOf(e.id)&&(i=!0)}),i||(t=t?t.group:void 0)&&0<t.length&&u.set(e,t.filter(function(t){return t!==e.id}))}),u.forEach(function(t,e){t.forEach(function(n){c.getWindowByName(o.windows.find(function(t){return t.id===n}).name).then(function(t){t.joinGroup(e)})})}),this.emit("layout-loaded",{sender:this,name:"layout-loaded",layout:o,layoutName:o.name}),p.emit("layout-loaded",{name:"layout-loaded",layout:o,layoutName:o.name}),[2,o];case 3:throw new Error("Layout does not exist or is invalid")}})})},h.prototype.saveLayout=function(e){return w(this,void 0,void 0,function(){var n;return y(this,function(t){switch(t.label){case 0:return[4,this.buildLayout()];case 1:return n=t.sent(),this.saveLayoutToStorage(e,n),[2,n]}})})},h.prototype.deleteLayout=function(n){return w(this,void 0,void 0,function(){return y(this,function(t){return[2,this.deleteLayoutFromStorage(n)]})})},h.prototype.getLayouts=function(){return w(this,void 0,void 0,function(){var n,e;return y(this,function(t){return(n=this.storage.getItem(h.layoutsPropertyKey))?(e=JSON.parse(n),[2,Object.getOwnPropertyNames(e).map(function(t){return e[t]})]):[2]})})},h.prototype.log=function(e,i){return w(this,void 0,void 0,function(){var n;return y(this,function(t){switch(e){case"debug":case"warn":case"error":n=console[e];break;default:n=console.log}return n&&n(i),[2]})})},h.layoutsPropertyKey="desktopJS-layouts";var d,C=h;function h(){var t=null!==d&&d.apply(this,arguments)||this;return t.uuid=a.newGuid(),t.storage="undefined"!=typeof window&&window?window.localStorage:void 0,t}t(l,D=C),l.prototype.onOpen=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return t.apply(this.globalWindow,n)},l.prototype.ensureAbsoluteUrl=function(t){return this.linkHelper?(this.linkHelper.href=t,this.linkHelper.href):t};var D,J=l;function l(t){var e,i=D.call(this)||this;i.globalWindow=t||"undefined"!=typeof window&&window||null,i.linkHelper={href:"unknown"};try{i.linkHelper=i.globalWindow.top.document.createElement("a")}catch(t){}return i.globalWindow&&(e=i.globalWindow.open,i.globalWindow.open=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return i.onOpen.apply(i,function(t,n,e){if(e||2===arguments.length)for(var i,o=0,r=n.length;o<r;o++)!i&&o in n||((i=i||Array.prototype.slice.call(n,0,o))[o]=n[o]);return t.concat(i||Array.prototype.slice.call(n))}([e],t,!1))}),i}function _(){}function z(){}function F(){}var U=function(t,n,e){this.topic=t,this.listener=n,this.options=e},R=(f.requestPermission=function(n){return w(this,void 0,void 0,function(){return y(this,function(t){return n&&n(f.permission),[2,f.permission]})})},f.permission="granted",f);function f(t,n){this.title=t,this.options=n}function V(){}u.ObjectTransform=void 0,(u.ObjectTransform||(u.ObjectTransform={})).transformProperties=function(t,n){var e={};if(t)for(var i in t)try{i in n?e[n[i].target]=n[i].convert?n[i].convert(t[i],t,e):t[i]:e[i]=t[i]}catch(t){console.error("Error transforming property '"+i+"'")}return e},Object.defineProperty(g.prototype,"right",{get:function(){return g.getRight(this)},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"bottom",{get:function(){return g.getBottom(this)},enumerable:!1,configurable:!0}),g.getRight=function(t){return t.x+t.width},g.getBottom=function(t){return t.y+t.height};var v=g;function g(t,n,e,i){this.x=t,this.y=n,this.width=e,this.height=i}t(X,m=r);var m,q=X;function X(){return null!==m&&m.apply(this,arguments)||this}t(Q,b=q);var b,Y=Q;function Q(){return null!==b&&b.apply(this,arguments)||this}t(x,W=e),Object.defineProperty(x.prototype,"allowGrouping",{get:function(){return!1},enumerable:!1,configurable:!0}),x.prototype.getGroup=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2,[]]})})},x.prototype.joinGroup=function(t){return w(this,void 0,void 0,function(){return y(this,function(t){throw new Error("Not supported")})})},x.prototype.leaveGroup=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2]})})},x.prototype.bringToFront=function(){return this.focus()},x.prototype.getState=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2]})})},x.prototype.setState=function(t){return w(this,void 0,void 0,function(){return y(this,function(t){return[2]})})},Object.defineProperty(x.prototype,"nativeWindow",{get:function(){},enumerable:!1,configurable:!0}),x.prototype.addListener=function(t,n){n=this.registerAndWrapListener(t,n);return this.attachListener(t,n),W.prototype.addListener.call(this,t,n)},x.prototype.removeListener=function(t,n){n=this.unwrapAndUnRegisterListener(n)||n;return this.detachListener(t,n),W.prototype.removeListener.call(this,t,n)},x.addListener=function(t,n){e.addListener(x.staticEventScopePrefix+t,n)},x.removeListener=function(t,n){e.removeListener(x.staticEventScopePrefix+t,n)},x.emit=function(t,n){e.emit(x.staticEventScopePrefix+t,n,p.ipc)},x.listeners=function(t){return e.listeners(x.staticEventScopePrefix+t)},x.staticEventScopePrefix="containerwindow-";var W,P=x;function x(t){var n=W.call(this)||this;return n.innerWindow=t,n}function Z(){}var $=function(t){this.windows=[],this.name=t};function S(){return"undefined"!=typeof window&&window.fin}u.WindowStateTracking=void 0,(L=u.WindowStateTracking||(u.WindowStateTracking={}))[L.None=0]="None",L[L.Main=1]="Main",L[L.Group=2]="Group";tt.prototype.attach=function(t){var i=this;t?(t.addListener(S()?"minimized":"minimize",function(n){return w(i,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return this.windowStateTracking&u.WindowStateTracking.Main&&this.container.getMainWindow().id===n.sender.id?[4,this.container.getAllWindows()]:[3,2];case 1:t.sent().forEach(function(t){return t.minimize()}),t.label=2;case 2:return this.windowStateTracking&u.WindowStateTracking.Group?[4,n.sender.getGroup()]:[3,4];case 3:t.sent().forEach(function(t){return t.minimize()}),t.label=4;case 4:return[2]}})})}),t.addListener(S()?"restored":"restore",function(n){return w(i,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return this.windowStateTracking&u.WindowStateTracking.Main&&this.container.getMainWindow().id===n.sender.id?[4,this.container.getAllWindows()]:[3,2];case 1:t.sent().forEach(function(t){return t.restore()}),t.label=2;case 2:return this.windowStateTracking&u.WindowStateTracking.Group?[4,n.sender.getGroup()]:[3,4];case 3:t.sent().forEach(function(t){return t.restore()}),t.label=4;case 4:return[2]}})})})):(P.addListener("window-created",function(e){return w(i,void 0,void 0,function(){var n;return y(this,function(t){switch(t.label){case 0:return this.container&&this.container.getWindowById?[4,this.container.getWindowById(e.windowId)]:[3,2];case 1:n=t.sent(),this.attach(n),t.label=2;case 2:return[2]}})})}),this.container&&this.container.getAllWindows().then(function(t){t.forEach(function(t){return i.attach(t)})}))};var L=tt;function tt(t,n){this.windowStateTracking=u.WindowStateTracking.None,this.container=t,n&&"windowStateTracking"in n&&(this.windowStateTracking=n.windowStateTracking),this.attach()}t(E,O=L),E.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)})},E.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)}))})},E.prototype.onMoving=function(f){return w(this,void 0,void 0,function(){var n,e,i,o,r,s,a,u,c,d,p,h,l=this;return y(this,function(t){switch(t.label){case 0:return(n=f.sender.id,this.snappingWindow===n)?[2]:[4,(e=f.sender).getOptions()];case 1:return(s=t.sent())&&void 0!==s.snap&&!1===s.snap?[2]:[4,e.getGroup()];case 2:return(i=t.sent(),S())?(r=new v(f.innerEvent.left,f.innerEvent.top,f.innerEvent.width,f.innerEvent.height),[3,5]):[3,3];case 3:return[4,e.getBounds()];case 4:r=t.sent(),t.label=5;case 5:return o=r,0<i.length?(S()&&this.moveWindow(e,o),[2]):[4,this.container.getAllWindows()];case 6:return s=t.sent(),a=s.filter(function(t){return n!==t.id}).map(function(e){return w(l,void 0,void 0,function(){var n;return y(this,function(t){switch(t.label){case 0:return n={window:e},[4,e.getBounds()];case 1:return n.bounds=t.sent(),[4,e.getOptions()];case 2:return[2,(n.options=t.sent(),n)]}})})}),[4,Promise.all(a)];case 7:for(a=t.sent(),u=!1,d=0,p=a.filter(function(t){return!(t.options&&void 0!==t.options.snap&&!1===t.options.snap)});d<p.length;d++)h=p[d],(c=this.getSnapBounds(c||o,h.bounds))?(u=!0,this.showGroupingHint(h.window),this.moveWindow(f.sender,c)):this.hideGroupingHint(h.window);return!u&&S()&&this.moveWindow(f.sender,o),[2]}})})},E.prototype.moveWindow=function(n,e){return w(this,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:this.snappingWindow=n.id,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,n.setBounds(e)];case 2:case 3:return t.sent(),[3,4];case 4:return this.snappingWindow=void 0,[2]}})})},E.prototype.onMoved=function(e){var t,n=this;this.autoGrouping&&(t=Array.from(this.targetGroup,function(t){t[0];var e=t[1];return w(n,void 0,void 0,function(){var n;return y(this,function(t){switch(t.label){case 0:return n={window:e},[4,e.getGroup()];case 1:return[2,(n.isGrouped=0<t.sent().length,n)]}})})}),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()},E.prototype.showGroupingHint=function(t){var n,e;null!=(e=null==(n=t.innerWindow)?void 0:n.updateOptions)&&e.call(n,{opacity:.75}),this.targetGroup.set(t.id,t)},E.prototype.hideGroupingHint=function(t){var n,e;null!=(e=null==(n=t.innerWindow)?void 0:n.updateOptions)&&e.call(n,{opacity:1}),this.targetGroup.delete(t.id)},E.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},E.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},E.prototype.getSnapBounds=function(t,n){var e,i,o,r,s,a,u,c,d,p;if(this.isHorizontallyAligned(t,n)&&(e=Math.abs(t.x-(n.right-this.snapOffset))<this.snapThreshold,i=Math.abs(t.x-n.x)<this.snapThreshold,o=Math.abs(t.right-this.snapOffset-n.x)<this.snapThreshold,r=Math.abs(t.right-n.right)<this.snapThreshold),this.isVerticallyAligned(t,n)&&(s=Math.abs(t.y-(n.bottom-this.snapOffset))<this.snapThreshold,a=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||o||s||u)return d=t.x,p=t.y,e?d=n.x+n.width-this.snapOffset:i&&(d=n.x),o?d=n.x-t.width+this.snapOffset:r&&(d=n.x+n.width-t.width),s?p=n.y+n.height-Math.floor(this.snapOffset/2):a&&(p=n.y),u?p=n.y-t.height+Math.floor(this.snapOffset/2):c&&(p=n.y+n.height-t.height),new v(d,p,t.width,t.height)};var O,nt=E;function E(t,n){t=O.call(this,t,n)||this;return t.autoGrouping=!0,t.snapThreshold=15,t.snapOffset=15,t.targetGroup=new Map,n&&("snapThreshold"in n&&(t.snapThreshold=n.snapThreshold),"snapOffset"in n&&(t.snapOffset=n.snapOffset),"autoGrouping"in n&&(t.autoGrouping=n.autoGrouping)),t}function et(){}var M,it=function(){},T=(u.Default=void 0,u.Default||(u.Default={})),ot={close:"unload"},rt=(t(k,M=P),Object.defineProperty(k.prototype,"id",{get:function(){return this.innerWindow[G.windowUuidPropertyKey]},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"name",{get:function(){return this.innerWindow[G.windowNamePropertyKey]},enumerable:!1,configurable:!0}),k.prototype.load=function(n,t){return w(this,void 0,void 0,function(){return y(this,function(t){return this.innerWindow.location.replace(n),[2]})})},k.prototype.focus=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return this.innerWindow.focus(),[2]})})},k.prototype.show=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2]})})},k.prototype.hide=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2]})})},k.prototype.close=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return this.innerWindow.close(),[2]})})},k.prototype.minimize=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return this.innerWindow.minimize(),[2]})})},k.prototype.maximize=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return this.innerWindow.maximize(),[2]})})},k.prototype.restore=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return this.innerWindow.restore(),[2]})})},k.prototype.isShowing=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2,!0]})})},k.prototype.getSnapshot=function(){return w(this,void 0,void 0,function(){return y(this,function(t){throw new Error("getSnapshot requires an implementation.")})})},k.prototype.flash=function(t,n){return w(this,void 0,void 0,function(){return y(this,function(t){throw new Error("Not supported")})})},k.prototype.getParent=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2,null]})})},k.prototype.setParent=function(t){return w(this,void 0,void 0,function(){return y(this,function(t){return[2]})})},k.prototype.getBounds=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2,new v(this.innerWindow.screenX,this.innerWindow.screenY,this.innerWindow.outerWidth,this.innerWindow.outerHeight)]})})},k.prototype.setBounds=function(n){return w(this,void 0,void 0,function(){return y(this,function(t){return this.innerWindow.moveTo(n.x,n.y),this.innerWindow.resizeTo(n.width,n.height),[2]})})},k.prototype.getOptions=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2,this.innerWindow[p.windowOptionsPropertyKey]]})})},k.prototype.getState=function(){var n,e;return w(this,void 0,void 0,function(){return y(this,function(t){return[2,null==(e=null==(n=this.nativeWindow)?void 0:n.getState)?void 0:e.call(n)]})})},k.prototype.setState=function(e){var i,o;return w(this,void 0,void 0,function(){var n;return y(this,function(t){switch(t.label){case 0:return n=null==(o=null==(i=this.nativeWindow)?void 0:i.setState)?void 0:o.call(i,e),this.emit("state-changed",{name:"state-changed",sender:this,state:e}),P.emit("state-changed",{name:"state-changed",windowId:this.id,state:e}),[4,n];case 1:return t.sent(),[2]}})})},k.prototype.attachListener=function(t,n){this.innerWindow.addEventListener(ot[t]||t,n)},k.prototype.detachListener=function(t,n){this.innerWindow.removeEventListener(ot[t]||t,n)},Object.defineProperty(k.prototype,"nativeWindow",{get:function(){return this.innerWindow},enumerable:!1,configurable:!0}),k);function k(){return null!==M&&M.apply(this,arguments)||this}T.DefaultContainerWindow=rt,N.prototype.subscribe=function(o,r,t){var e,s;return w(this,void 0,void 0,function(){var n,i=this;return y(this,function(t){return n=new U(o,function(t){var n,e;t.origin===i.container.globalWindow.location.origin&&(n=(t=t.data).source,e=t.topic,t=t.message,n===N.messageSource&&o===e&&r({topic:o},t))}),null!=(s=null==(e=this.container.globalWindow)?void 0:e.addEventListener)&&s.call(e,"message",n.listener),[2,n]})})},N.prototype.unsubscribe=function(n){return w(this,void 0,void 0,function(){return y(this,function(t){return[2,this.container.globalWindow.removeEventListener("message",n.listener)]})})},N.prototype.publish=function(r,s,a){var u;return w(this,void 0,void 0,function(){var n,e,i,o;return y(this,function(t){if(n=this.container.globalWindow?this.container.globalWindow[G.windowsPropertyKey]||(null==(u=this.container.globalWindow.opener)?void 0:u[G.windowsPropertyKey]):[])for(e in n)i=n[e],null!=a&&a.name&&a.name!==i[G.windowNamePropertyKey]||(o=(null==a?void 0:a.targetOrigin)||this.container.globalWindow.location.origin,i.postMessage({source:N.messageSource,topic:r,message:s},o));return[2]})})},N.messageSource="desktopJS";var st=N;function N(t){this.container=t}T.DefaultMessageBus=st,t(A,at=J),A.prototype.createMessageBus=function(){return new st(this)},A.prototype.setOptions=function(t){},A.prototype.getOptions=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2,{}]})})},A.prototype.getInfo=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2,this.globalWindow.navigator.appVersion]})})},A.prototype.getMainWindow=function(){var t;return this.mainWindow||(t=this.globalWindow[A.windowsPropertyKey].root,this.mainWindow=t?this.wrapWindow(t):null),this.mainWindow},A.prototype.getCurrentWindow=function(){return this.wrapWindow(this.globalWindow)},A.prototype.getWindowOptions=function(t){return u.ObjectTransform.transformProperties(t,this.windowOptionsMap)},A.prototype.wrapWindow=function(t){return new rt(t)},A.prototype.onOpen=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];var i=t.apply(this.globalWindow,n);if(i){var o=a.newGuid();try{var r=this.globalWindow[A.windowsPropertyKey];(r[o]=i)[A.windowUuidPropertyKey]=o,i.addEventListener("beforeunload",function(){i.addEventListener("unload",function(){delete r[o]})}),i[A.windowsPropertyKey]=r}catch(t){this.log("warn","Error tracking new window, '".concat(t.message,"'"))}p.emit("window-created",{name:"window-created",windowId:o}),P.emit("window-created",{name:"window-created",windowId:o})}return i},A.prototype.createWindow=function(s,a){return w(this,void 0,void 0,function(){var n,e,i,o,r;return y(this,function(t){if(r="_blank",e=this.getWindowOptions(a)){for(i in e)n=(n||"")+i+"="+e[i]+",";e&&"target"in e&&(r=e.target)}r=this.globalWindow.open(s,r,n),o=!0;try{r[p.windowOptionsPropertyKey]=a,r[A.windowNamePropertyKey]=e.name}catch(t){o=!1,this.log("warn","Error propagating properties to new window, '".concat(t.message,"'"))}return r=this.wrapWindow(r),this.emit("window-created",{sender:this,name:"window-created",window:r,windowId:o?r.id:void 0,windowName:e.name}),[2,r]})})},A.prototype.showNotification=function(n,e){var i=this;"Notification"in this.globalWindow?this.globalWindow.Notification.requestPermission(function(t){"denied"===t?i.log("warn","Notifications not permitted"):"granted"===t&&new i.globalWindow.Notification(n,e)}):this.log("warn","Notifications not supported")},A.prototype.closeAllWindows=function(o){return void 0===o&&(o=!1),w(this,void 0,void 0,function(){var n,e,i;return y(this,function(t){for(e in n=this.globalWindow[A.windowsPropertyKey])i=n[e],o&&this.globalWindow===i||i.close();return[2]})})},A.prototype.getAllWindows=function(){return w(this,void 0,void 0,function(){var n,e,i;return y(this,function(t){for(i in n=[],e=this.globalWindow[A.windowsPropertyKey])n.push(this.wrapWindow(e[i]));return[2,n]})})},A.prototype.getWindowById=function(e){return w(this,void 0,void 0,function(){var n;return y(this,function(t){return[2,(n=this.globalWindow[A.windowsPropertyKey][e])?this.wrapWindow(n):null]})})},A.prototype.getWindowByName=function(i){return w(this,void 0,void 0,function(){var n,e;return y(this,function(t){for(e in n=this.globalWindow[A.windowsPropertyKey])if(n[e][A.windowNamePropertyKey]===i)return[2,this.wrapWindow(n[e])];return[2,null]})})},A.prototype.buildLayout=function(){return w(this,void 0,void 0,function(){var a,n,e=this;return y(this,function(t){switch(t.label){case 0:return a=new $,n=[],[4,this.getAllWindows()];case 1:return t.sent().forEach(function(o){var r=o.nativeWindow;try{var s=r[p.windowOptionsPropertyKey];if(s&&"persist"in s&&!s.persist)return;n.push(w(e,void 0,void 0,function(){var n,e,i;return y(this,function(t){switch(t.label){case 0:return this.globalWindow===r?[3,2]:(e=(n=a.windows).push,i={name:o.name,url:r&&r.location?r.location.toString():void 0,id:o.id,bounds:{x:r.screenX,y:r.screenY,width:r.innerWidth,height:r.innerHeight},options:s},[4,o.getState()]);case 1:e.apply(n,[(i.state=t.sent(),i)]),t.label=2;case 2:return[2]}})}))}catch(t){e.log("warn","Error while accessing window so skipping, '".concat(t.message,"'"))}}),[4,Promise.all(n)];case 2:return t.sent(),[2,a]}})})},A.windowsPropertyKey="desktopJS-windows",A.windowUuidPropertyKey="desktopJS-uuid",A.windowNamePropertyKey="desktopJS-name",A.rootWindowUuid="root",A.defaultWindowOptionsMap={x:{target:"left"},y:{target:"top"}};var at,G=A;function A(t){t=at.call(this,t)||this;return t.windowOptionsMap=A.defaultWindowOptionsMap,t.hostType="Default",t.ipc=t.createMessageBus(),!t.globalWindow||A.windowsPropertyKey in t.globalWindow||(t.globalWindow[A.windowsPropertyKey]={root:t.globalWindow},t.globalWindow[A.windowNamePropertyKey]=t.globalWindow[A.windowUuidPropertyKey]=A.rootWindowUuid),t.screen=new ut(t.globalWindow),t}T.DefaultContainer=G,K.prototype.getPrimaryDisplay=function(){return w(this,void 0,void 0,function(){var n;return y(this,function(t){return(n=new it).scaleFactor=this.window.devicePixelRatio,n.id="Current",n.bounds=new v(this.window.screen.availLeft,this.window.screen.availTop,this.window.screen.width,this.window.screen.height),n.workArea=new v(this.window.screen.availLeft,this.window.screen.availTop,this.window.screen.availWidth,this.window.screen.availHeight),[2,n]})})},K.prototype.getAllDisplays=function(){return w(this,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return[4,this.getPrimaryDisplay()];case 1:return[2,[t.sent()]]}})})},K.prototype.getMousePosition=function(){return w(this,void 0,void 0,function(){return y(this,function(t){return[2,{x:this.window.event.screenX,y:this.window.event.screenY}]})})};var ut=K;function K(t){this.window=t}function ct(){}var j=[];u.container=void 0;function dt(){}function pt(){}return u.Container=p,u.ContainerBase=C,u.ContainerNotification=R,u.ContainerRegistration=ct,u.ContainerWindow=P,u.Display=it,u.EventArgs=r,u.EventEmitter=e,u.GlobalShortcutManager=pt,u.GroupWindowManager=L,u.Guid=a,u.LayoutEventArgs=I,u.MenuItem=z,u.MessageBusOptions=_,u.MessageBusSubscription=U,u.NotificationOptions=F,u.PersistedWindow=Z,u.PersistedWindowLayout=$,u.Point=et,u.PropertyMap=V,u.Rectangle=v,u.SnapAssistWindowManager=nt,u.TrayIconDetails=dt,u.WebContainerBase=J,u.WindowEventArgs=q,u.WindowGroupEventArgs=Y,u.clearRegistry=function(){j.splice(0,j.length),u.container=void 0},u.registerContainer=function(t,n){j.push({id:t,registration:n})},u.resolveContainer=function(t,n){var e=!1,i=n;if("boolean"==typeof t?e=t:i=t,e||!u.container)try{for(var o=0;o<j.length;o++)var r=j[o].id,s=j[o].registration,a=s.condition(i)?s:a;u.container=a?a.create(i):void 0}catch(t){console.error("Error resolving container '".concat(r,"' : ").concat(t.toString()))}finally{u.container=u.container||new u.Default.DefaultContainer}return u.container},u.version="3.13.1",Object.defineProperty(u,"__esModule",{value:!0}),u}({}); | ||
//# sourceMappingURL=desktop.min.js.map |
@@ -5,3 +5,3 @@ { | ||
"description": "Library for abstracting common container hosting", | ||
"version": "3.12.0", | ||
"version": "3.13.1", | ||
"publishConfig": { | ||
@@ -16,3 +16,3 @@ "access": "public" | ||
"type": "git", | ||
"url": "https://github.com/MorganStanley/desktopJS.git" | ||
"url": "git+https://github.com/MorganStanley/desktopJS.git" | ||
}, | ||
@@ -35,14 +35,9 @@ "bugs": { | ||
"clean": "gulp clean", | ||
"build:lerna": "gulp build:lerna", | ||
"build:workspaces": "gulp build:workspaces", | ||
"build": "gulp build", | ||
"test": "gulp test", | ||
"watch": "gulp watch", | ||
"deploy": "npm publish", | ||
"prepublishOnly": "copyfiles ../../README.md . -u 2" | ||
}, | ||
"devDependencies": { | ||
"@types/jasmine": "^3.5.11", | ||
"copyfiles": "^2.3.0", | ||
"gulp": "^4.0.2" | ||
} | ||
"homepage": "https://github.com/MorganStanley/desktopJS#readme" | ||
} |
![desktopJS](https://raw.githubusercontent.com/wiki/MorganStanley/desktopJS/images/logo.png) | ||
========== | ||
![Lifecycle Active](https://badgen.net/badge/Lifecycle/Active/green) | ||
[![npm version](https://badge.fury.io/js/%40morgan-stanley%2Fdesktopjs.svg)](https://www.npmjs.com/package/@morgan-stanley/desktopjs) | ||
@@ -4,0 +5,0 @@ [![Build Status](https://github.com/MorganStanley/desktopJS/actions/workflows/continuous-integration.yml/badge.svg?event=push)](https://github.com/MorganStanley/desktopJS/actions/workflows/continuous-integration.yml) |
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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
0
39
5000
0
99
692587