@remixproject/engine
Advanced tools
Comparing version 0.3.0-alpha.2 to 0.3.0-alpha.3
import { ExternalProfile, Profile } from '../../utils/src/types/profile'; | ||
import { Message } from '../../utils/src/types/message'; | ||
import { Plugin } from './plugin/abstract'; | ||
import { Plugin, PluginOptions } from './plugin/abstract'; | ||
/** List of available gateways for decentralised storage */ | ||
export declare const defaultGateways: { | ||
'ipfs://': (url: any, name: any) => string; | ||
'swarm://': (url: any, _: any) => string; | ||
'swarm://': (url: any, name: any) => string; | ||
}; | ||
/** Transform the URL to use a gateway if decentralised storage is specified */ | ||
export declare function transformUrl(url: string, name: string): any; | ||
export declare function transformUrl({ url, name }: Profile & ExternalProfile): any; | ||
export interface PluginConnectorOptions extends PluginOptions { | ||
transformUrl?: (profile: Profile & ExternalProfile) => string; | ||
} | ||
export declare abstract class PluginConnector extends Plugin { | ||
@@ -15,2 +18,3 @@ protected loaded: boolean; | ||
protected pendingRequest: Record<number, (result: any, error: Error | string) => void>; | ||
protected options: PluginConnectorOptions; | ||
profile: Profile & ExternalProfile; | ||
@@ -32,2 +36,4 @@ constructor(profile: Profile & ExternalProfile); | ||
deactivate(): void; | ||
/** Set options for an external plugin */ | ||
setOptions(options?: Partial<PluginConnectorOptions>): void; | ||
/** Call a method from this plugin */ | ||
@@ -34,0 +40,0 @@ protected callPluginMethod(key: string, payload?: any[]): Promise<any>; |
import { BasePluginManager } from "../plugin/manager"; | ||
import { Plugin } from '../plugin/abstract'; | ||
import { Plugin, PluginOptions } from '../plugin/abstract'; | ||
import { Profile } from "../../../utils"; | ||
export declare class Engine { | ||
@@ -11,2 +12,4 @@ private manager; | ||
onRegistration?(plugin: Plugin): void; | ||
/** Update the options of the plugin when beeing registered */ | ||
setPluginOption?(profile: Profile): PluginOptions; | ||
constructor(manager: BasePluginManager); | ||
@@ -13,0 +16,0 @@ /** Wait for the engine to have loaded the manager */ |
@@ -7,2 +7,6 @@ import { Api, EventKey, EventParams, MethodKey, MethodParams, EventCallback, ApiMap, Profile, PluginRequest, PluginApi, IPluginService, PluginBase } from '../../../utils'; | ||
} | ||
export interface PluginOptions { | ||
/** The time to wait for a call to be executed before going to next call in the queue */ | ||
queueTimeout?: number; | ||
} | ||
export declare class Plugin<T extends Api = any, App extends ApiMap = any> implements PluginBase<T, App> { | ||
@@ -15,2 +19,3 @@ profile: Profile<T>; | ||
protected app: PluginApi<App>; | ||
protected options: PluginOptions; | ||
onRegistration?(): void; | ||
@@ -25,2 +30,3 @@ onActivation?(): void; | ||
deactivate(): void; | ||
setOptions(options?: Partial<PluginOptions>): void; | ||
/** Call a method from this plugin */ | ||
@@ -27,0 +33,0 @@ protected callPluginMethod(key: string, args: any[]): any; |
import { ExternalProfile, Profile } from '../../../utils/src/types/profile'; | ||
import { Message } from '../../../utils/src/types/message'; | ||
import { Plugin } from './abstract'; | ||
import { Plugin, PluginOptions } from './abstract'; | ||
/** List of available gateways for decentralised storage */ | ||
export declare const defaultGateways: { | ||
'ipfs://': (url: any, name: any) => string; | ||
'swarm://': (url: any, _: any) => string; | ||
'swarm://': (url: any, name: any) => string; | ||
}; | ||
/** Transform the URL to use a gateway if decentralised storage is specified */ | ||
export declare function transformUrl(url: string, name: string): any; | ||
export declare function transformUrl({ url, name }: Profile & ExternalProfile): any; | ||
export interface ExternalPluginOptions extends PluginOptions { | ||
transformUrl: (profile: Profile & ExternalProfile) => string; | ||
} | ||
export declare abstract class ExternalPlugin extends Plugin { | ||
@@ -15,2 +18,3 @@ protected loaded: boolean; | ||
protected pendingRequest: Record<number, (result: any, error: Error | string) => void>; | ||
protected options: Partial<ExternalPluginOptions>; | ||
profile: Profile & ExternalProfile; | ||
@@ -20,2 +24,4 @@ constructor(profile: Profile & ExternalProfile); | ||
deactivate(): void; | ||
/** Set options for an external plugin */ | ||
setOptions(options?: Partial<ExternalPluginOptions>): void; | ||
/** Call a method from this plugin */ | ||
@@ -22,0 +28,0 @@ protected callPluginMethod(key: string, payload?: any[]): Promise<any>; |
@@ -9,5 +9,5 @@ import { Profile } from "../../../utils"; | ||
isActive(name: string): Promise<boolean>; | ||
canCall(from: Profile, to: Profile, method: string): Promise<boolean>; | ||
toggleActive(name: string): any; | ||
addProfile(profile: Partial<Profile>): any; | ||
canCall(from: Profile, to: Profile, method: string): Promise<boolean>; | ||
canActivate(from: Profile, to: Profile): Promise<boolean>; | ||
@@ -14,0 +14,0 @@ } & Plugin; |
import { Message, ExternalProfile, Profile } from '../../../utils'; | ||
import { ExternalPlugin } from './external'; | ||
interface WebsocketOptions { | ||
import { ExternalPlugin, ExternalPluginOptions } from './external'; | ||
interface WebsocketOptions extends ExternalPluginOptions { | ||
/** Time (in ms) to wait before reconnection after connection closed */ | ||
@@ -17,2 +17,3 @@ reconnectDelay: number; | ||
deactivate(): void; | ||
setOptions(options?: Partial<WebsocketOptions>): void; | ||
/** Try to reconnect to net websocket if closes */ | ||
@@ -19,0 +20,0 @@ protected reconnect(): void; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.pluginEngine=t():e.pluginEngine=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=14)}([function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),a=function(){function e(e){this.profile=e,this.activateService={},this.requestQueue=[]}return Object.defineProperty(e.prototype,"name",{get:function(){return this.profile.name},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"methods",{get:function(){return this.profile.methods},set:function(e){this.profile.methods=e},enumerable:!0,configurable:!0}),e.prototype.activate=function(){this.onActivation&&this.onActivation()},e.prototype.deactivate=function(){this.onDeactivation&&this.onDeactivation()},e.prototype.callPluginMethod=function(e,t){var n=this.currentRequest&&this.currentRequest.path,r=o.getMethodPath(e,n);if(!(r in this))throw new Error("Method "+r+" is not implemented by "+this.profile.name);return this[r].apply(this,t)},e.prototype.addRequest=function(e,t,n){var o=this;return new Promise(function(a,s){o.requestQueue.push(function(){return r(o,void 0,void 0,function(){var r,o,u,c,l,f=this;return i(this,function(i){switch(i.label){case 0:this.currentRequest=e,r=!1,o=function(){r&&s("call to plugin has timed out "+f.profile.name+" - "+t+" - "+JSON.stringify(f.currentRequest)),delete f.currentRequest,f.requestQueue.shift(),0!==f.requestQueue.length&&f.requestQueue[0]()},u=setTimeout(function(){r=!0,o()},1e4),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.callPluginMethod(t,n)];case 2:return c=i.sent(),r?[2]:(delete this.currentRequest,a(c),[3,4]);case 3:return l=i.sent(),s(l),[3,4];case 4:return clearTimeout(u),o(),[2]}})})}),1===o.requestQueue.length&&o.requestQueue[0]()})},e.prototype.askUserPermission=function(e,t){if(!this.currentRequest)return Promise.resolve(!0);if(this.methods.includes(e)){var n=this.currentRequest.from,r=this.name;return this.call("manager","canCall",n,r,e,t)}return Promise.resolve(!1)},e.prototype.createService=function(e,t){return r(this,void 0,void 0,function(){var n;return i(this,function(r){switch(r.label){case 0:if(this.methods&&this.methods.includes(e))throw new Error("A service cannot have the same name as an exposed method");return n=o.createService(e,t),[4,o.activateService(this,n)];case 1:return r.sent(),[2,n]}})})},e.prototype.prepareService=function(e,t){var n=this;return this.activateService[e]=function(){return r(n,void 0,void 0,function(){var n,r;return i(this,function(i){switch(i.label){case 0:if(this.methods&&this.methods.includes(e))throw new Error("A service cannot have the same name as an exposed method");return[4,t()];case 1:return n=i.sent(),r=o.createService(e,n),[4,o.activateService(this,r)];case 2:return i.sent(),delete this.activateService[e],[2,r]}})})}},e.prototype.on=function(e,t,n){throw new Error('Cannot use method "on" from plugin "'+this.name+'". It is not registered in the engine yet.')},e.prototype.once=function(e,t,n){throw new Error('Cannot use method "once" from plugin "'+this.name+'". It is not registered in the engine yet.')},e.prototype.off=function(e,t){throw new Error('Cannot use method "off" from plugin "'+this.name+'". It is not registered in the engine yet.')},e.prototype.call=function(e,t){for(var n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];return r(this,void 0,void 0,function(){return i(this,function(e){throw new Error('Cannot use method "call" from plugin "'+this.name+'". It is not registered in the engine yet.')})})},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];throw new Error('Cannot use method "emit" from plugin "'+this.name+'". It is not registered in the engine yet.')},e}();t.Plugin=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(18))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(21))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(22))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(23))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(24))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(25))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(30))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(26))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(27))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(28))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(29))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getMethodPath=function(e,t){if(!t)return e;var n=t.split(".");return n.shift(),n.push(e),n.join(".")},t.getRootPath=function(e){return e.split(".").shift()}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},a=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r};Object.defineProperty(t,"__esModule",{value:!0});var s=n(12),u=function(){function e(){}return e.prototype.emit=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];(t=this.plugin).emit.apply(t,a([e],n))},e.prototype.createService=function(e,t){return i(this,void 0,void 0,function(){var n,r;return o(this,function(i){switch(i.label){case 0:if(this.methods.includes(e))throw new Error("A service cannot have the same name as an exposed method");return n=this.path+"."+e,r=l(n,t),[4,f(this.plugin,r)];case 1:return i.sent(),[2,r]}})})},e.prototype.prepareService=function(e,t){var n=this;if(this.methods.includes(e))throw new Error("A service cannot have the same name as an exposed method");var r=this.path+"."+e;this.plugin.activateService[r]=function(){return i(n,void 0,void 0,function(){var e,n;return o(this,function(i){switch(i.label){case 0:return e=t(),n=l(r,e),[4,f(this.plugin,n)];case 1:return i.sent(),delete this.plugin.activateService[r],[2,n]}})})}},e}();function c(e){if(e.methods){for(var n=0,r=e.methods;n<r.length;n++){var i=r[n];if(!(i in e))throw new Error("Method "+i+" is not part of serivce")}return e.methods}if(t.isPluginService(e)){var o=Object.getPrototypeOf(e);return Object.getOwnPropertyNames(o).filter(function(e){return"constructor"!==e&&!e.startsWith("_")})}return Object.getOwnPropertyNames(e).filter(function(t){return"function"==typeof e[t]&&!t.startsWith("_")})}function l(e,n){if(n.path&&s.getRootPath(n.path)!==e)throw new Error("Service path "+n.path+" is different from the one provided: "+e);for(var i=c(n),o=0,a=i;o<a.length;o++){var u=a[o];if(!(u in n))throw new Error("Method "+u+" is not part of service "+e)}return t.isPluginService(n)?(n.methods||(n.methods=i),n):r(r({},n),{methods:i,path:e})}function f(e,t){e.methods=a(e.methods||[],t.methods);for(var n=0,r=c(t);n<r.length;n++){var i=r[n];e[t.path+"."+i]=t[i].bind(t)}return e.call("manager","updateProfile",{methods:e.methods})}t.PluginService=u,t.isPluginService=function(e){return e instanceof u},t.getMethods=c,t.createService=l,t.activateService=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(15))},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(16)),r(n(38)),r(n(43)),r(n(13))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(17))},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},o=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r};Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),s=function(){function e(e){var t=this;this.manager=e,this.plugins={},this.events={},this.listeners={},this.isLoaded=!1,this.plugins.manager=e,this.manager.engineActivatePlugin=function(e){return t.activatePlugin(e)},this.manager.engineDeactivatePlugin=function(e){return t.deactivatePlugin(e)},e.activatePlugin("manager").then(function(){t.isLoaded=!0,t.managerLoaded&&t.managerLoaded()})}return e.prototype.onload=function(e){return r(this,void 0,void 0,function(){var t=this;return i(this,function(n){return[2,new Promise(function(n,r){t.isLoaded?(n(),e&&e()):t.managerLoaded=function(){n(),e&&e(),delete t.managerLoaded}})]})})},e.prototype.broadcast=function(e,t){for(var n=this,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var o=a.listenEvent(e,t);this.listeners[o]&&(this.listeners[o]||[]).forEach(function(i){var a;if(!n.events[i][o])throw new Error("Plugin "+i+" should be listening on event "+t+" from "+e+". But no callback have been found");(a=n.events[i])[o].apply(a,r)})},e.prototype.addListener=function(e,t,n,r){var i=a.listenEvent(t,n);this.events[e][i]||(this.events[e][i]=r),this.listeners[i]||(this.listeners[i]=[]),this.listeners[i].includes(e)||this.listeners[i].push(e)},e.prototype.removeListener=function(e,t,n){var r=a.listenEvent(t,n);this.listeners[r]=this.listeners[r].filter(function(t){return t!==e}),delete this.events[e][r]},e.prototype.listenOnce=function(e,t,n,r){var i=this;this.addListener(e,t,n,function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];r.apply(void 0,o),i.removeListener(e,t,n)})},e.prototype.callMethod=function(e,t,n){for(var o=[],a=3;a<arguments.length;a++)o[a-3]=arguments[a];return r(this,void 0,void 0,function(){var r,a,s,u,c,l,f;return i(this,function(i){switch(i.label){case 0:if(r=t.split(".").shift(),!this.plugins[r])throw new Error("Cannot call "+r+" from "+e+", because "+r+" is not registered");return[4,Promise.all([this.manager.getProfile(r),this.manager.getProfile(e)])];case 1:return a=i.sent(),s=a[0],u=a[1],[4,this.manager.isActive(r)];case 2:return i.sent()?[3,6]:[4,this.manager.canActivate(u,s)];case 3:return i.sent()?[4,this.manager.toggleActive(r)]:[3,5];case 4:return i.sent(),[3,6];case 5:throw new Error(u.name+" cannot call "+n+" of "+r+", because "+r+" is not activated yet");case 6:if(!s.methods.includes(n))throw c='Cannot call method "'+n+'" of "'+r+'" from "'+e+'", because "'+n+'" is not exposed.',l="Here is the list of exposed methods: "+s.methods.map(function(e){return'"'+e+'"'}).join(","),new Error(c+" "+l);return f={from:e,path:t},[2,this.plugins[r].addRequest(f,n,o)]}})})},e.prototype.createApp=function(e){return r(this,void 0,void 0,function(){var t,n=this;return i(this,function(r){switch(r.label){case 0:return t=Object.keys(this.plugins).map(function(e){return n.manager.getProfile(e)}),[4,Promise.all(t)];case 1:return[2,r.sent().reduce(function(t,r){return t[r.name]=(r.methods||[]).reduce(function(t,i){return t[i]=function(){for(var t=[],a=0;a<arguments.length;a++)t[a]=arguments[a];return n.callMethod.apply(n,o([e,r.name,i],t))},t},{on:function(t,i){return n.addListener(e,r.name,t,i)},once:function(t,i){return n.listenOnce(e,r.name,t,i)},off:function(t){return n.removeListener(e,r.name,t)},profile:r}),t},{})]}})})},e.prototype.activatePlugin=function(e){return r(this,void 0,void 0,function(){var t,n,r,a=this;return i(this,function(i){switch(i.label){case 0:if(!this.plugins[e])throw new Error("Cannot active plugin "+e+" because it's not registered yet");return[4,this.manager.isActive(e)];case 1:return i.sent()?[2]:(t=this.plugins[e],this.events[e]={},t.on=function(t,n,r){a.addListener(e,t,n,r)},t.once=function(t,n,r){a.listenOnce(e,t,n,r)},t.off=function(t,n){a.removeListener(e,t,n)},t.emit=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];a.broadcast.apply(a,o([e,t],n))},t.call=function(t,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];return a.callMethod.apply(a,o([e,t,n],r))},n=t,r="app",[4,this.createApp(e)]);case 2:return n[r]=i.sent(),t.createApp=function(){return a.createApp(e)},[4,t.activate()];case 3:return i.sent(),[2]}})})},e.prototype.deactivatePlugin=function(e){return r(this,void 0,void 0,function(){var t,n=this;return i(this,function(r){switch(r.label){case 0:if(!this.plugins[e])throw new Error("Cannot deactive plugin "+e+" because it's not registered yet");return[4,this.manager.isActive(e)];case 1:return r.sent()?[4,(t=this.plugins[e]).deactivate()]:[2];case 2:return r.sent(),this.updateErrorHandler(t),delete t.app,delete t.createApp,delete this.events[e],Object.keys(this.listeners).forEach(function(t){n.listeners[t].forEach(function(r,i){r===e&&n.listeners[t].splice(i,1)})}),[2]}})})},e.prototype.updateErrorHandler=function(e){var t=function(e){return"Plugin "+name+" is currently deactivated. "+e+". Activate "+name+" first."};e.call=function(e,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];throw new Error(t("It cannot call method "+n+" of plugin "+e+"."))},e.on=function(e,n){throw new Error(t("It cannot listen on event "+n+" of plugin "+e+"."))},e.once=function(e,n){throw new Error(t("It cannot listen on event "+n+" of plugin "+e+"."))},e.off=function(e,n){throw new Error(t("All event listeners are already removed."))},e.emit=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];throw new Error(t("It cannot emit the event "+e))}},e.prototype.register=function(e){var t=this,n=function(e){if(t.plugins[e.name])throw new Error("Plugin "+e.name+" is already register.");return t.plugins[e.name]=e,t.manager.addProfile(e.profile),t.updateErrorHandler(e),e.onRegistration&&e.onRegistration(),t.onRegistration&&t.onRegistration(e),e.name};return Array.isArray(e)?e.map(function(e){return n(e)}):n(e)},e.prototype.isRegistered=function(e){return!!this.plugins[e]},e}();t.Engine=s},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(19)),r(n(20)),r(n(35)),r(n(12)),r(n(13))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callEvent=function(e,t,n){return"["+e+"] "+t+"-"+n},t.listenEvent=function(e,t){return"["+e+"] "+t}},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(2)),r(n(3)),r(n(4)),r(n(5)),r(n(6)),r(n(8)),r(n(9)),r(n(10)),r(n(11)),r(n(7)),r(n(31)),r(n(34))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.compilerProfile={name:"compiler",methods:["compile","getCompilationResult"],events:["compilationFinished"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.editorProfile={name:"editor",methods:["discardHighlight","highlight"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.filSystemProfile={name:"fs",methods:["getCurrentFile","getFile","getFolder","setFile","switchFile"],events:["currentFileChanged"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.networkProfile={name:"network",methods:["addNetwork","detectNetwork","getEndpoint","getNetworkProvider","removeNetwork"],events:["providerChanged"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.udappProfile={name:"udapp",methods:["createVMAccount","getAccounts","sendTransaction"],events:["newTransaction"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.themeProfile={name:"theme",methods:[],events:["themeChanged"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unitTestProfile={name:"unitTest",methods:["testFromPath","testFromSource"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.contentImportProfile={name:"contentImport",methods:["resolve"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.settingsProfile={name:"settings",methods:["getGithubAccessToken"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pluginManagerProfile={name:"manager",methods:["getProfile","updateProfile","activatePlugin","deactivatePlugin","canCall"]}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),o=n(4),a=n(3),s=n(5),u=n(6),c=n(8),l=n(9),f=n(10),h=n(11),p=n(32),d=n(7);t.remixApi=Object.freeze({manager:d.pluginManagerProfile,solidity:r(r({},i.compilerProfile),{name:"solidity"}),fileManager:r(r({},o.filSystemProfile),{name:"fileManager"}),solidityUnitTesting:r(r({},l.unitTestProfile),{name:"solidityUnitTesting"}),editor:a.editorProfile,network:s.networkProfile,udapp:u.udappProfile,contentImport:f.contentImportProfile,settings:h.settingsProfile,theme:c.themeProfile}),t.remixProfiles=Object.freeze({manager:d.pluginManagerProfile,solidity:r(r({},i.compilerProfile),{name:"solidity"}),fileManager:r(r({},o.filSystemProfile),{name:"fileManager"}),git:r(r({},p.gitProfile),{name:"git"}),solidityUnitTesting:r(r({},l.unitTestProfile),{name:"solidityUnitTesting"}),editor:a.editorProfile,network:s.networkProfile,udapp:u.udappProfile,contentImport:f.contentImportProfile,settings:h.settingsProfile,theme:c.themeProfile})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(33))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.gitProfile={name:"remixd.git",methods:["clone","checkout","init","add","commit","fetch","pull","push","reset","status","remote","log"]}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),o=n(4),a=n(3),s=n(5),u=n(6),c=n(7);t.standardProfiles=Object.freeze({manager:c.pluginManagerProfile,solidity:r(r({},i.compilerProfile),{name:"solidity"}),fileManager:r(r({},o.filSystemProfile),{name:"fileManager"}),editor:a.editorProfile,network:s.networkProfile,udapp:u.udappProfile})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(36))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(37))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boxProfile={name:"box",methods:["login","isEnabled","getUserAddress","openSpace","closeSpace","isSpaceOpened","getSpacePrivateValue","setSpacePrivateValue","getSpacePublicValue","setSpacePublicValue","getSpacePublicData","getSpaceName"],events:["enabled","loggedIn","loggedOut","spaceClosed","spaceOpened"]}},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(0)),r(n(39)),r(n(40)),r(n(41)),r(n(42))},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},a=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r};Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(t){var n=Array.from(new Set(a(t.methods||[],["currentFocus","focus","addView","removeView"])));return e.call(this,o(o({},t),{methods:n}))||this}return i(t,e),t}(n(0).Plugin);t.HostPlugin=s},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},s=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r};Object.defineProperty(t,"__esModule",{value:!0});var u=n(0);function c(e){return!!e.location}t.isViewLibrary=c;var l=function(e){function t(t,n){var r=e.call(this,n)||this;if(r.library=t,r.profile=n,n.methods.forEach(function(e){if(!t[e])throw new Error("Method "+e+" is exposed by LibraryPlugin "+n.name+". But library doesn't expose this method")}),r.isView=c(n),r.isView&&!r.render)throw new Error("Profile "+n.name+" define the location "+n.location+', but method "render" is not implemented');return r}return i(t,e),t.prototype.activate=function(){return o(this,void 0,void 0,function(){var t=this;return a(this,function(n){switch(n.label){case 0:return this.isView?[4,this.call(this.profile.location,"addView",this.profile,this.render())]:[3,2];case 1:n.sent(),n.label=2;case 2:if(e.prototype.activate.call(this),this.profile.notifications){if(!this.library.events||!this.library.events.emit)throw new Error('"events" object from Library of plugin '+this.name+' should implement "emit"');Object.keys(this.profile.notifications).forEach(function(e){t.profile.notifications[e].forEach(function(n){t.on(e,n,function(r){var i;return(i=t.library.events).emit.apply(i,s(["["+e+"] "+n],r))})})})}if(this.profile.events){if(!this.library.events||!this.library.events.emit)throw new Error('"events" object from Library of plugin '+this.name+' should implement "emit"');this.profile.events.forEach(function(e){t.library.events.on(e,function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return t.emit.apply(t,s([e],n))})})}return[2]}})})},t.prototype.deactivate=function(){var t=this;this.isView&&this.call(this.profile.location,"removeView",this.profile),this.profile.notifications&&Object.keys(this.profile.notifications).forEach(function(e){t.profile.notifications[e].forEach(function(n){return t.off(e,n)})}),this.profile.events&&this.library.events.off&&this.profile.events.forEach(function(e){return t.library.events.off(e)}),e.prototype.deactivate.call(this)},t.prototype.callPluginMethod=function(e,t){var n;if(!this.library[e])throw new Error("LibraryPlugin "+this.name+" doesn't expose method "+e);return(n=this.library)[e].apply(n,t)},t}(u.Plugin);t.LibraryPlugin=l},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(0);t.isView=function(e){return!!e.location};var u=function(e){function t(t){var n=e.call(this,t)||this;return n.profile=t,n}return i(t,e),t.prototype.activate=function(){return o(this,void 0,void 0,function(){return a(this,function(t){switch(t.label){case 0:return[4,this.call(this.profile.location,"addView",this.profile,this.render())];case 1:return t.sent(),e.prototype.activate.call(this),[2]}})})},t.prototype.deactivate=function(){this.call(this.profile.location,"removeView",this.profile),e.prototype.deactivate.call(this)},t}(s.Plugin);t.ViewPlugin=u},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var u=n(1),c=n(0);t.managerMethods=["getProfile","updateProfile","activatePlugin","deactivatePlugin","canCall"];var l=function(e){function n(n){void 0===n&&(n=u.pluginManagerProfile);var r=e.call(this,n)||this;return r.profiles={},r.actives=[],r.methods=t.managerMethods,r.profiles[n.name]=n,r}return i(n,e),Object.defineProperty(n.prototype,"requestFrom",{get:function(){return this.currentRequest?this.currentRequest.from:"manager"},enumerable:!0,configurable:!0}),n.prototype.getProfile=function(e){return a(this,void 0,void 0,function(){return s(this,function(t){return[2,this.profiles[e]]})})},n.prototype.updateProfile=function(e){if(e){if(e.name&&e.name!==this.requestFrom)throw new Error("A plugin cannot change its name.");var t=this.requestFrom;if(!this.profiles[t])throw new Error("Plugin "+t+" is not register, you cannot update it's profile.");if(e.url&&e.url!==this.profiles[t].url)throw new Error("Url from Profile cannot be updated.");this.profiles[t]=o(o({},this.profiles[t]),e),this.emit("profileUpdated",this.profiles[t])}},n.prototype.addProfile=function(e){if(this.profiles[e.name])throw new Error("Plugin "+e.name+" already exist");this.profiles[e.name]=e,this.emit("profileAdded",e),this.onProfileAdded&&this.onProfileAdded(e)},n.prototype.isActive=function(e){return a(this,void 0,void 0,function(){return s(this,function(t){return[2,this.actives.includes(e)]})})},n.prototype.activatePlugin=function(e){return a(this,void 0,void 0,function(){var t,n=this;return s(this,function(r){return t=function(e){return a(n,void 0,void 0,function(){var t,n,r;return s(this,function(i){switch(i.label){case 0:return[4,this.isActive(e)];case 1:return i.sent()?[2]:[4,Promise.all([this.getProfile(e),this.getProfile(this.requestFrom)])];case 2:return t=i.sent(),n=t[0],r=t[1],[4,this.canActivate(r,n)];case 3:return i.sent()?[4,this.toggleActive(e)]:[3,5];case 4:return i.sent(),[3,6];case 5:throw new Error("Plugin "+this.requestFrom+" has no right to activate plugin "+e);case 6:return[2]}})})},[2,Array.isArray(e)?Promise.all(e.map(t)):t(e)]})})},n.prototype.deactivatePlugin=function(e){return a(this,void 0,void 0,function(){var t,n=this;return s(this,function(r){return t=function(e){return a(n,void 0,void 0,function(){var t,n,r;return s(this,function(i){switch(i.label){case 0:return[4,this.isActive(e)];case 1:return i.sent()?[4,Promise.all([this.getProfile(e),this.getProfile(this.requestFrom)])]:[2];case 2:return t=i.sent(),n=t[0],r=t[1],[4,this.canDeactivate(r,n)];case 3:return i.sent()?[4,this.toggleActive(e)]:[3,5];case 4:return i.sent(),[3,6];case 5:throw new Error("Plugin "+this.requestFrom+" has no right to deactivate plugin "+e);case 6:return[2]}})})},[2,Array.isArray(e)?Promise.all(e.map(t)):t(e)]})})},n.prototype.toggleActive=function(e){return a(this,void 0,void 0,function(){var t,n=this;return s(this,function(r){return t=function(e){return a(n,void 0,void 0,function(){var t,n,r;return s(this,function(i){switch(i.label){case 0:return[4,Promise.all([this.isActive(e),this.getProfile(e)])];case 1:return t=i.sent(),n=t[0],r=t[1],n?[4,this.engineDeactivatePlugin(e)]:[3,3];case 2:return i.sent(),this.actives=this.actives.filter(function(t){return t!==e}),this.emit("pluginDeactivated",r),this.onPluginDeactivated&&this.onPluginDeactivated(r),[3,5];case 3:return[4,this.engineActivatePlugin(e)];case 4:i.sent(),this.actives.push(e),this.emit("pluginActivated",r),this.onPluginActivated&&this.onPluginActivated(r),i.label=5;case 5:return[2]}})})},[2,Array.isArray(e)?Promise.all(e.map(t)):t(e)]})})},n.prototype.canActivate=function(e,t){return a(this,void 0,void 0,function(){return s(this,function(e){return[2,!0]})})},n.prototype.canDeactivate=function(e,t){return a(this,void 0,void 0,function(){return s(this,function(t){return"manager"===e.name?[2,!0]:[2,!1]})})},n.prototype.canCall=function(e,t,n,r){return a(this,void 0,void 0,function(){return s(this,function(e){return[2,!0]})})},n}(c.Plugin);t.PluginManager=l},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},u=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r};Object.defineProperty(t,"__esModule",{value:!0});var c=n(0);function l(e,n){var r=Object.keys(t.defaultGateways).find(function(t){return e.startsWith(t)});return r?t.defaultGateways[r](e,n):e}t.defaultGateways={"ipfs://":function(e,t){return"https://"+t+".dyn.plugin.remixproject.org/ipfs/"+e.replace("ipfs://","")},"swarm://":function(e,t){return"https://swarm-gateways.net/bzz-raw://"+e.replace("swarm://","")}},t.transformUrl=l;var f=function(e){function t(t){var n=e.call(this,t)||this;return n.id=0,n.pendingRequest={},n}return i(t,e),t.prototype.activate=function(){var e=this.profile,t=e.url,n=e.name;this.connect(l(t,n))},t.prototype.deactivate=function(){this.loaded=!1,this.disconnect(),e.prototype.deactivate.call(this)},t.prototype.callPluginMethod=function(e,t){var n=this;void 0===t&&(t=[]);var r=this.id++,i=this.currentRequest,o=this.name,a=new Promise(function(e,t){n.pendingRequest[r]=function(n,r){return r?t(r):e(n)}});return this.send({id:r,action:"request",key:e,payload:t,requestInfo:i,name:o}),a},t.prototype.handshake=function(){return a(this,void 0,void 0,function(){var e;return s(this,function(t){switch(t.label){case 0:return this.loaded?[3,2]:[4,this.callPluginMethod("handshake",[this.profile.name])];case 1:e=t.sent(),this.call("manager","updateProfile",this.profile),this.loaded=!0,e&&(this.profile.methods=e),t.label=2;case 2:return[2]}})})},t.prototype.getMessage=function(e){return a(this,void 0,void 0,function(){var t,n,r,i,a,c,l,f,h,p,d,v=this;return s(this,function(s){switch(s.label){case 0:if("request"===e.action&&"handshake"===e.key)return[2,this.handshake()];switch(e.action){case"on":case"listen":return[3,1];case"off":return[3,2];case"once":return[3,3];case"emit":case"notification":return[3,4];case"call":case"request":return[3,5];case"response":return[3,10]}return[3,11];case 1:return t=e.name,n=e.key,"notification",this.on(t,n,function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return v.send({action:"notification",name:t,key:n,payload:e})}),[3,12];case 2:return r=e.name,i=e.key,this.off(r,i),[3,12];case 3:return a=e.name,c=e.key,"notification",this.once(a,c,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v.send({action:"notification",name:a,key:c,payload:e})}),[3,12];case 4:return e.payload?(this.emit.apply(this,u([e.key],e.payload)),[3,12]):[3,12];case 5:l="response",s.label=6;case 6:return s.trys.push([6,8,,9]),[4,this.call.apply(this,u([e.name,e.key],e.payload))];case 7:return p=s.sent(),d=void 0,this.send(o(o({},e),{action:l,payload:p,error:d})),[3,9];case 8:return f=s.sent(),p=void 0,d=f.message,this.send(o(o({},e),{action:l,payload:p,error:d})),[3,9];case 9:return[3,12];case 10:return h=e.id,p=e.payload,d=e.error,this.pendingRequest[h](p,d),delete this.pendingRequest[h],[3,12];case 11:throw new Error("Message should be a notification, request or response");case 12:return[2]}})})},t}(c.Plugin);t.PluginConnector=f}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.pluginEngine=t():e.pluginEngine=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=14)}([function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(1),a=function(){function e(e){this.profile=e,this.activateService={},this.requestQueue=[],this.options={}}return Object.defineProperty(e.prototype,"name",{get:function(){return this.profile.name},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"methods",{get:function(){return this.profile.methods},set:function(e){this.profile.methods=e},enumerable:!0,configurable:!0}),e.prototype.activate=function(){this.onActivation&&this.onActivation()},e.prototype.deactivate=function(){this.onDeactivation&&this.onDeactivation()},e.prototype.setOptions=function(e){void 0===e&&(e={}),this.options=r(r({},this.options),e)},e.prototype.callPluginMethod=function(e,t){var n=this.currentRequest&&this.currentRequest.path,r=s.getMethodPath(e,n);if(!(r in this))throw new Error("Method "+r+" is not implemented by "+this.profile.name);return this[r].apply(this,t)},e.prototype.addRequest=function(e,t,n){var r=this;return new Promise(function(s,a){r.requestQueue.push(function(){return i(r,void 0,void 0,function(){var r,i,u,c,l,f=this;return o(this,function(o){switch(o.label){case 0:this.currentRequest=e,r=!1,i=function(){r&&a("call to plugin has timed out "+f.profile.name+" - "+t+" - "+JSON.stringify(f.currentRequest)),delete f.currentRequest,f.requestQueue.shift(),0!==f.requestQueue.length&&f.requestQueue[0]()},u=setTimeout(function(){r=!0,i()},this.options.queueTimeout||1e4),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.callPluginMethod(t,n)];case 2:return c=o.sent(),r?[2]:(delete this.currentRequest,s(c),[3,4]);case 3:return l=o.sent(),a(l),[3,4];case 4:return clearTimeout(u),i(),[2]}})})}),1===r.requestQueue.length&&r.requestQueue[0]()})},e.prototype.askUserPermission=function(e,t){if(!this.currentRequest)return Promise.resolve(!0);if(this.methods.includes(e)){var n=this.currentRequest.from,r=this.name;return this.call("manager","canCall",n,r,e,t)}return Promise.resolve(!1)},e.prototype.createService=function(e,t){return i(this,void 0,void 0,function(){var n;return o(this,function(r){switch(r.label){case 0:if(this.methods&&this.methods.includes(e))throw new Error("A service cannot have the same name as an exposed method");return n=s.createService(e,t),[4,s.activateService(this,n)];case 1:return r.sent(),[2,n]}})})},e.prototype.prepareService=function(e,t){var n=this;return this.activateService[e]=function(){return i(n,void 0,void 0,function(){var n,r;return o(this,function(i){switch(i.label){case 0:if(this.methods&&this.methods.includes(e))throw new Error("A service cannot have the same name as an exposed method");return[4,t()];case 1:return n=i.sent(),r=s.createService(e,n),[4,s.activateService(this,r)];case 2:return i.sent(),delete this.activateService[e],[2,r]}})})}},e.prototype.on=function(e,t,n){throw new Error('Cannot use method "on" from plugin "'+this.name+'". It is not registered in the engine yet.')},e.prototype.once=function(e,t,n){throw new Error('Cannot use method "once" from plugin "'+this.name+'". It is not registered in the engine yet.')},e.prototype.off=function(e,t){throw new Error('Cannot use method "off" from plugin "'+this.name+'". It is not registered in the engine yet.')},e.prototype.call=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return i(this,void 0,void 0,function(){return o(this,function(e){throw new Error('Cannot use method "call" from plugin "'+this.name+'". It is not registered in the engine yet.')})})},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];throw new Error('Cannot use method "emit" from plugin "'+this.name+'". It is not registered in the engine yet.')},e}();t.Plugin=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(18))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(21))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(22))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(23))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(24))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(25))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(30))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(26))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(27))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(28))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(29))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getMethodPath=function(e,t){if(!t)return e;var n=t.split(".");return n.shift(),n.push(e),n.join(".")},t.getRootPath=function(e){return e.split(".").shift()}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},s=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r};Object.defineProperty(t,"__esModule",{value:!0});var a=n(12),u=function(){function e(){}return e.prototype.emit=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];(t=this.plugin).emit.apply(t,s([e],n))},e.prototype.createService=function(e,t){return i(this,void 0,void 0,function(){var n,r;return o(this,function(i){switch(i.label){case 0:if(this.methods.includes(e))throw new Error("A service cannot have the same name as an exposed method");return n=this.path+"."+e,r=l(n,t),[4,f(this.plugin,r)];case 1:return i.sent(),[2,r]}})})},e.prototype.prepareService=function(e,t){var n=this;if(this.methods.includes(e))throw new Error("A service cannot have the same name as an exposed method");var r=this.path+"."+e;this.plugin.activateService[r]=function(){return i(n,void 0,void 0,function(){var e,n;return o(this,function(i){switch(i.label){case 0:return e=t(),n=l(r,e),[4,f(this.plugin,n)];case 1:return i.sent(),delete this.plugin.activateService[r],[2,n]}})})}},e}();function c(e){if(e.methods){for(var n=0,r=e.methods;n<r.length;n++){var i=r[n];if(!(i in e))throw new Error("Method "+i+" is not part of serivce")}return e.methods}if(t.isPluginService(e)){var o=Object.getPrototypeOf(e);return Object.getOwnPropertyNames(o).filter(function(e){return"constructor"!==e&&!e.startsWith("_")})}return Object.getOwnPropertyNames(e).filter(function(t){return"function"==typeof e[t]&&!t.startsWith("_")})}function l(e,n){if(n.path&&a.getRootPath(n.path)!==e)throw new Error("Service path "+n.path+" is different from the one provided: "+e);for(var i=c(n),o=0,s=i;o<s.length;o++){var u=s[o];if(!(u in n))throw new Error("Method "+u+" is not part of service "+e)}return t.isPluginService(n)?(n.methods||(n.methods=i),n):r(r({},n),{methods:i,path:e})}function f(e,t){e.methods=s(e.methods||[],t.methods);for(var n=0,r=c(t);n<r.length;n++){var i=r[n];e[t.path+"."+i]=t[i].bind(t)}return e.call("manager","updateProfile",{methods:e.methods})}t.PluginService=u,t.isPluginService=function(e){return e instanceof u},t.getMethods=c,t.createService=l,t.activateService=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(15))},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(16)),r(n(38)),r(n(43)),r(n(13))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(17))},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},o=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r};Object.defineProperty(t,"__esModule",{value:!0});var s=n(1),a=function(){function e(e){var t=this;this.manager=e,this.plugins={},this.events={},this.listeners={},this.isLoaded=!1,this.plugins.manager=e,this.manager.engineActivatePlugin=function(e){return t.activatePlugin(e)},this.manager.engineDeactivatePlugin=function(e){return t.deactivatePlugin(e)},e.activatePlugin("manager").then(function(){t.isLoaded=!0,t.managerLoaded&&t.managerLoaded()})}return e.prototype.onload=function(e){return r(this,void 0,void 0,function(){var t=this;return i(this,function(n){return[2,new Promise(function(n,r){t.isLoaded?(n(),e&&e()):t.managerLoaded=function(){n(),e&&e(),delete t.managerLoaded}})]})})},e.prototype.broadcast=function(e,t){for(var n=this,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var o=s.listenEvent(e,t);this.listeners[o]&&(this.listeners[o]||[]).forEach(function(i){var s;if(!n.events[i][o])throw new Error("Plugin "+i+" should be listening on event "+t+" from "+e+". But no callback have been found");(s=n.events[i])[o].apply(s,r)})},e.prototype.addListener=function(e,t,n,r){var i=s.listenEvent(t,n);this.events[e][i]||(this.events[e][i]=r),this.listeners[i]||(this.listeners[i]=[]),this.listeners[i].includes(e)||this.listeners[i].push(e)},e.prototype.removeListener=function(e,t,n){var r=s.listenEvent(t,n);this.listeners[r]=this.listeners[r].filter(function(t){return t!==e}),delete this.events[e][r]},e.prototype.listenOnce=function(e,t,n,r){var i=this;this.addListener(e,t,n,function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];r.apply(void 0,o),i.removeListener(e,t,n)})},e.prototype.callMethod=function(e,t,n){for(var o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return r(this,void 0,void 0,function(){var r,s,a,u,c,l,f;return i(this,function(i){switch(i.label){case 0:if(r=t.split(".").shift(),!this.plugins[r])throw new Error("Cannot call "+r+" from "+e+", because "+r+" is not registered");return[4,Promise.all([this.manager.getProfile(r),this.manager.getProfile(e)])];case 1:return s=i.sent(),a=s[0],u=s[1],[4,this.manager.isActive(r)];case 2:return i.sent()?[3,6]:[4,this.manager.canActivate(u,a)];case 3:return i.sent()?[4,this.manager.toggleActive(r)]:[3,5];case 4:return i.sent(),[3,6];case 5:throw new Error(u.name+" cannot call "+n+" of "+r+", because "+r+" is not activated yet");case 6:if(!a.methods.includes(n))throw c='Cannot call method "'+n+'" of "'+r+'" from "'+e+'", because "'+n+'" is not exposed.',l="Here is the list of exposed methods: "+a.methods.map(function(e){return'"'+e+'"'}).join(","),new Error(c+" "+l);return f={from:e,path:t},[2,this.plugins[r].addRequest(f,n,o)]}})})},e.prototype.createApp=function(e){return r(this,void 0,void 0,function(){var t,n=this;return i(this,function(r){switch(r.label){case 0:return t=Object.keys(this.plugins).map(function(e){return n.manager.getProfile(e)}),[4,Promise.all(t)];case 1:return[2,r.sent().reduce(function(t,r){return t[r.name]=(r.methods||[]).reduce(function(t,i){return t[i]=function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];return n.callMethod.apply(n,o([e,r.name,i],t))},t},{on:function(t,i){return n.addListener(e,r.name,t,i)},once:function(t,i){return n.listenOnce(e,r.name,t,i)},off:function(t){return n.removeListener(e,r.name,t)},profile:r}),t},{})]}})})},e.prototype.activatePlugin=function(e){return r(this,void 0,void 0,function(){var t,n,r,s=this;return i(this,function(i){switch(i.label){case 0:if(!this.plugins[e])throw new Error("Cannot active plugin "+e+" because it's not registered yet");return[4,this.manager.isActive(e)];case 1:return i.sent()?[2]:(t=this.plugins[e],this.events[e]={},t.on=function(t,n,r){s.addListener(e,t,n,r)},t.once=function(t,n,r){s.listenOnce(e,t,n,r)},t.off=function(t,n){s.removeListener(e,t,n)},t.emit=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];s.broadcast.apply(s,o([e,t],n))},t.call=function(t,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];return s.callMethod.apply(s,o([e,t,n],r))},n=t,r="app",[4,this.createApp(e)]);case 2:return n[r]=i.sent(),t.createApp=function(){return s.createApp(e)},[4,t.activate()];case 3:return i.sent(),[2]}})})},e.prototype.deactivatePlugin=function(e){return r(this,void 0,void 0,function(){var t,n=this;return i(this,function(r){switch(r.label){case 0:if(!this.plugins[e])throw new Error("Cannot deactive plugin "+e+" because it's not registered yet");return[4,this.manager.isActive(e)];case 1:return r.sent()?[4,(t=this.plugins[e]).deactivate()]:[2];case 2:return r.sent(),this.updateErrorHandler(t),delete t.app,delete t.createApp,delete this.events[e],Object.keys(this.listeners).forEach(function(t){n.listeners[t].forEach(function(r,i){r===e&&n.listeners[t].splice(i,1)})}),[2]}})})},e.prototype.updateErrorHandler=function(e){var t=function(e){return"Plugin "+name+" is currently deactivated. "+e+". Activate "+name+" first."};e.call=function(e,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];throw new Error(t("It cannot call method "+n+" of plugin "+e+"."))},e.on=function(e,n){throw new Error(t("It cannot listen on event "+n+" of plugin "+e+"."))},e.once=function(e,n){throw new Error(t("It cannot listen on event "+n+" of plugin "+e+"."))},e.off=function(e,n){throw new Error(t("All event listeners are already removed."))},e.emit=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];throw new Error(t("It cannot emit the event "+e))}},e.prototype.register=function(e){var t=this,n=function(e){if(t.plugins[e.name])throw new Error("Plugin "+e.name+" is already register.");if(t.plugins[e.name]=e,t.manager.addProfile(e.profile),t.updateErrorHandler(e),t.setPluginOption){var n=t.setPluginOption(e.profile);e.setOptions(n)}return e.onRegistration&&e.onRegistration(),t.onRegistration&&t.onRegistration(e),e.name};return Array.isArray(e)?e.map(function(e){return n(e)}):n(e)},e.prototype.isRegistered=function(e){return!!this.plugins[e]},e}();t.Engine=a},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(19)),r(n(20)),r(n(35)),r(n(12)),r(n(13))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callEvent=function(e,t,n){return"["+e+"] "+t+"-"+n},t.listenEvent=function(e,t){return"["+e+"] "+t}},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(2)),r(n(3)),r(n(4)),r(n(5)),r(n(6)),r(n(8)),r(n(9)),r(n(10)),r(n(11)),r(n(7)),r(n(31)),r(n(34))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.compilerProfile={name:"compiler",methods:["compile","getCompilationResult"],events:["compilationFinished"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.editorProfile={name:"editor",methods:["discardHighlight","highlight"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.filSystemProfile={name:"fs",methods:["getCurrentFile","getFile","getFolder","setFile","switchFile"],events:["currentFileChanged"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.networkProfile={name:"network",methods:["addNetwork","detectNetwork","getEndpoint","getNetworkProvider","removeNetwork"],events:["providerChanged"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.udappProfile={name:"udapp",methods:["createVMAccount","getAccounts","sendTransaction"],events:["newTransaction"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.themeProfile={name:"theme",methods:[],events:["themeChanged"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unitTestProfile={name:"unitTest",methods:["testFromPath","testFromSource"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.contentImportProfile={name:"contentImport",methods:["resolve"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.settingsProfile={name:"settings",methods:["getGithubAccessToken"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pluginManagerProfile={name:"manager",methods:["getProfile","updateProfile","activatePlugin","deactivatePlugin","canCall"]}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),o=n(4),s=n(3),a=n(5),u=n(6),c=n(8),l=n(9),f=n(10),h=n(11),p=n(32),d=n(7);t.remixApi=Object.freeze({manager:d.pluginManagerProfile,solidity:r(r({},i.compilerProfile),{name:"solidity"}),fileManager:r(r({},o.filSystemProfile),{name:"fileManager"}),solidityUnitTesting:r(r({},l.unitTestProfile),{name:"solidityUnitTesting"}),editor:s.editorProfile,network:a.networkProfile,udapp:u.udappProfile,contentImport:f.contentImportProfile,settings:h.settingsProfile,theme:c.themeProfile}),t.remixProfiles=Object.freeze({manager:d.pluginManagerProfile,solidity:r(r({},i.compilerProfile),{name:"solidity"}),fileManager:r(r({},o.filSystemProfile),{name:"fileManager"}),git:r(r({},p.gitProfile),{name:"git"}),solidityUnitTesting:r(r({},l.unitTestProfile),{name:"solidityUnitTesting"}),editor:s.editorProfile,network:a.networkProfile,udapp:u.udappProfile,contentImport:f.contentImportProfile,settings:h.settingsProfile,theme:c.themeProfile})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(33))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.gitProfile={name:"remixd.git",methods:["clone","checkout","init","add","commit","fetch","pull","push","reset","status","remote","log"]}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),o=n(4),s=n(3),a=n(5),u=n(6),c=n(7);t.standardProfiles=Object.freeze({manager:c.pluginManagerProfile,solidity:r(r({},i.compilerProfile),{name:"solidity"}),fileManager:r(r({},o.filSystemProfile),{name:"fileManager"}),editor:s.editorProfile,network:a.networkProfile,udapp:u.udappProfile})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(36))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(37))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boxProfile={name:"box",methods:["login","isEnabled","getUserAddress","openSpace","closeSpace","isSpaceOpened","getSpacePrivateValue","setSpacePrivateValue","getSpacePublicValue","setSpacePublicValue","getSpacePublicData","getSpaceName"],events:["enabled","loggedIn","loggedOut","spaceClosed","spaceOpened"]}},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(0)),r(n(39)),r(n(40)),r(n(41)),r(n(42))},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},s=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r};Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(t){var n=Array.from(new Set(s(t.methods||[],["currentFocus","focus","addView","removeView"])));return e.call(this,o(o({},t),{methods:n}))||this}return i(t,e),t}(n(0).Plugin);t.HostPlugin=a},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},a=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r};Object.defineProperty(t,"__esModule",{value:!0});var u=n(0);function c(e){return!!e.location}t.isViewLibrary=c;var l=function(e){function t(t,n){var r=e.call(this,n)||this;if(r.library=t,r.profile=n,n.methods.forEach(function(e){if(!t[e])throw new Error("Method "+e+" is exposed by LibraryPlugin "+n.name+". But library doesn't expose this method")}),r.isView=c(n),r.isView&&!r.render)throw new Error("Profile "+n.name+" define the location "+n.location+', but method "render" is not implemented');return r}return i(t,e),t.prototype.activate=function(){return o(this,void 0,void 0,function(){var t=this;return s(this,function(n){switch(n.label){case 0:return this.isView?[4,this.call(this.profile.location,"addView",this.profile,this.render())]:[3,2];case 1:n.sent(),n.label=2;case 2:if(e.prototype.activate.call(this),this.profile.notifications){if(!this.library.events||!this.library.events.emit)throw new Error('"events" object from Library of plugin '+this.name+' should implement "emit"');Object.keys(this.profile.notifications).forEach(function(e){t.profile.notifications[e].forEach(function(n){t.on(e,n,function(r){var i;return(i=t.library.events).emit.apply(i,a(["["+e+"] "+n],r))})})})}if(this.profile.events){if(!this.library.events||!this.library.events.emit)throw new Error('"events" object from Library of plugin '+this.name+' should implement "emit"');this.profile.events.forEach(function(e){t.library.events.on(e,function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return t.emit.apply(t,a([e],n))})})}return[2]}})})},t.prototype.deactivate=function(){var t=this;this.isView&&this.call(this.profile.location,"removeView",this.profile),this.profile.notifications&&Object.keys(this.profile.notifications).forEach(function(e){t.profile.notifications[e].forEach(function(n){return t.off(e,n)})}),this.profile.events&&this.library.events.off&&this.profile.events.forEach(function(e){return t.library.events.off(e)}),e.prototype.deactivate.call(this)},t.prototype.callPluginMethod=function(e,t){var n;if(!this.library[e])throw new Error("LibraryPlugin "+this.name+" doesn't expose method "+e);return(n=this.library)[e].apply(n,t)},t}(u.Plugin);t.LibraryPlugin=l},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(0);t.isView=function(e){return!!e.location};var u=function(e){function t(t){var n=e.call(this,t)||this;return n.profile=t,n}return i(t,e),t.prototype.activate=function(){return o(this,void 0,void 0,function(){return s(this,function(t){switch(t.label){case 0:return[4,this.call(this.profile.location,"addView",this.profile,this.render())];case 1:return t.sent(),e.prototype.activate.call(this),[2]}})})},t.prototype.deactivate=function(){this.call(this.profile.location,"removeView",this.profile),e.prototype.deactivate.call(this)},t}(a.Plugin);t.ViewPlugin=u},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var u=n(1),c=n(0);t.managerMethods=["getProfile","updateProfile","activatePlugin","deactivatePlugin","isActive","canCall"];var l=function(e){function n(n){void 0===n&&(n=u.pluginManagerProfile);var r=e.call(this,n)||this;return r.profiles={},r.actives=[],r.methods=t.managerMethods,r.profiles[n.name]=n,r}return i(n,e),Object.defineProperty(n.prototype,"requestFrom",{get:function(){return this.currentRequest?this.currentRequest.from:"manager"},enumerable:!0,configurable:!0}),n.prototype.getProfile=function(e){return s(this,void 0,void 0,function(){return a(this,function(t){return[2,this.profiles[e]]})})},n.prototype.updateProfile=function(e){if(e){if(e.name&&e.name!==this.requestFrom)throw new Error("A plugin cannot change its name.");var t=this.requestFrom;if(!this.profiles[t])throw new Error("Plugin "+t+" is not register, you cannot update it's profile.");if(e.url&&e.url!==this.profiles[t].url)throw new Error("Url from Profile cannot be updated.");this.profiles[t]=o(o({},this.profiles[t]),e),this.emit("profileUpdated",this.profiles[t])}},n.prototype.addProfile=function(e){if(this.profiles[e.name])throw new Error("Plugin "+e.name+" already exist");this.profiles[e.name]=e,this.emit("profileAdded",e),this.onProfileAdded&&this.onProfileAdded(e)},n.prototype.isActive=function(e){return s(this,void 0,void 0,function(){return a(this,function(t){return[2,this.actives.includes(e)]})})},n.prototype.activatePlugin=function(e){return s(this,void 0,void 0,function(){var t,n=this;return a(this,function(r){return t=function(e){return s(n,void 0,void 0,function(){var t,n,r;return a(this,function(i){switch(i.label){case 0:return[4,this.isActive(e)];case 1:return i.sent()?[2]:[4,Promise.all([this.getProfile(e),this.getProfile(this.requestFrom)])];case 2:return t=i.sent(),n=t[0],r=t[1],[4,this.canActivate(r,n)];case 3:return i.sent()?[4,this.toggleActive(e)]:[3,5];case 4:return i.sent(),[3,6];case 5:throw new Error("Plugin "+this.requestFrom+" has no right to activate plugin "+e);case 6:return[2]}})})},[2,Array.isArray(e)?Promise.all(e.map(t)):t(e)]})})},n.prototype.deactivatePlugin=function(e){return s(this,void 0,void 0,function(){var t,n=this;return a(this,function(r){return t=function(e){return s(n,void 0,void 0,function(){var t,n,r;return a(this,function(i){switch(i.label){case 0:return[4,this.isActive(e)];case 1:return i.sent()?[4,Promise.all([this.getProfile(e),this.getProfile(this.requestFrom)])]:[2];case 2:return t=i.sent(),n=t[0],r=t[1],[4,this.canDeactivate(r,n)];case 3:return i.sent()?[4,this.toggleActive(e)]:[3,5];case 4:return i.sent(),[3,6];case 5:throw new Error("Plugin "+this.requestFrom+" has no right to deactivate plugin "+e);case 6:return[2]}})})},[2,Array.isArray(e)?Promise.all(e.map(t)):t(e)]})})},n.prototype.toggleActive=function(e){return s(this,void 0,void 0,function(){var t,n=this;return a(this,function(r){return t=function(e){return s(n,void 0,void 0,function(){var t,n,r;return a(this,function(i){switch(i.label){case 0:return[4,Promise.all([this.isActive(e),this.getProfile(e)])];case 1:return t=i.sent(),n=t[0],r=t[1],n?[4,this.engineDeactivatePlugin(e)]:[3,3];case 2:return i.sent(),this.actives=this.actives.filter(function(t){return t!==e}),this.emit("pluginDeactivated",r),this.onPluginDeactivated&&this.onPluginDeactivated(r),[3,5];case 3:return[4,this.engineActivatePlugin(e)];case 4:i.sent(),this.actives.push(e),this.emit("pluginActivated",r),this.onPluginActivated&&this.onPluginActivated(r),i.label=5;case 5:return[2]}})})},[2,Array.isArray(e)?Promise.all(e.map(t)):t(e)]})})},n.prototype.canActivate=function(e,t){return s(this,void 0,void 0,function(){return a(this,function(e){return[2,!0]})})},n.prototype.canDeactivate=function(e,t){return s(this,void 0,void 0,function(){return a(this,function(t){return"manager"===e.name?[2,!0]:[2,!1]})})},n.prototype.canCall=function(e,t,n,r){return s(this,void 0,void 0,function(){return a(this,function(e){return[2,!0]})})},n}(c.Plugin);t.PluginManager=l},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},u=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r};Object.defineProperty(t,"__esModule",{value:!0});var c=n(0);function l(e){var n=e.url,r=e.name,i=Object.keys(t.defaultGateways).find(function(e){return n.startsWith(e)});return i?t.defaultGateways[i](n,r):n}t.defaultGateways={"ipfs://":function(e,t){return"https://"+t+".dyn.plugin.remixproject.org/ipfs/"+e.replace("ipfs://","")},"swarm://":function(e,t){return"https://swarm-gateways.net/bzz-raw://"+e.replace("swarm://","")}},t.transformUrl=l;var f=function(e){function t(t){var n=e.call(this,t)||this;return n.id=0,n.pendingRequest={},n}return i(t,e),t.prototype.activate=function(){var e=this.options.transformUrl?this.options.transformUrl(this.profile):l(this.profile);this.connect(e)},t.prototype.deactivate=function(){this.loaded=!1,this.disconnect(),e.prototype.deactivate.call(this)},t.prototype.setOptions=function(t){void 0===t&&(t={}),e.prototype.setOptions.call(this,t)},t.prototype.callPluginMethod=function(e,t){var n=this;void 0===t&&(t=[]);var r=this.id++,i=this.currentRequest,o=this.name,s=new Promise(function(e,t){n.pendingRequest[r]=function(n,r){return r?t(r):e(n)}});return this.send({id:r,action:"request",key:e,payload:t,requestInfo:i,name:o}),s},t.prototype.handshake=function(){return s(this,void 0,void 0,function(){var e;return a(this,function(t){switch(t.label){case 0:return this.loaded?[3,2]:[4,this.callPluginMethod("handshake",[this.profile.name])];case 1:e=t.sent(),this.call("manager","updateProfile",this.profile),this.loaded=!0,e&&(this.profile.methods=e),t.label=2;case 2:return[2]}})})},t.prototype.getMessage=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,s,c,l,f,h,p,d,v=this;return a(this,function(a){switch(a.label){case 0:if("request"===e.action&&"handshake"===e.key)return[2,this.handshake()];switch(e.action){case"on":case"listen":return[3,1];case"off":return[3,2];case"once":return[3,3];case"emit":case"notification":return[3,4];case"call":case"request":return[3,5];case"response":return[3,10]}return[3,11];case 1:return t=e.name,n=e.key,"notification",this.on(t,n,function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return v.send({action:"notification",name:t,key:n,payload:e})}),[3,12];case 2:return r=e.name,i=e.key,this.off(r,i),[3,12];case 3:return s=e.name,c=e.key,"notification",this.once(s,c,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v.send({action:"notification",name:s,key:c,payload:e})}),[3,12];case 4:return e.payload?(this.emit.apply(this,u([e.key],e.payload)),[3,12]):[3,12];case 5:l="response",a.label=6;case 6:return a.trys.push([6,8,,9]),[4,this.call.apply(this,u([e.name,e.key],e.payload))];case 7:return p=a.sent(),d=void 0,this.send(o(o({},e),{action:l,payload:p,error:d})),[3,9];case 8:return f=a.sent(),p=void 0,d=f.message,this.send(o(o({},e),{action:l,payload:p,error:d})),[3,9];case 9:return[3,12];case 10:return h=e.id,p=e.payload,d=e.error,this.pendingRequest[h](p,d),delete this.pendingRequest[h],[3,12];case 11:throw new Error("Message should be a notification, request or response");case 12:return[2]}})})},t}(c.Plugin);t.PluginConnector=f}])}); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(global,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=14)}([function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),a=function(){function e(e){this.profile=e,this.activateService={},this.requestQueue=[]}return Object.defineProperty(e.prototype,"name",{get:function(){return this.profile.name},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"methods",{get:function(){return this.profile.methods},set:function(e){this.profile.methods=e},enumerable:!0,configurable:!0}),e.prototype.activate=function(){this.onActivation&&this.onActivation()},e.prototype.deactivate=function(){this.onDeactivation&&this.onDeactivation()},e.prototype.callPluginMethod=function(e,t){var n=this.currentRequest&&this.currentRequest.path,r=o.getMethodPath(e,n);if(!(r in this))throw new Error("Method "+r+" is not implemented by "+this.profile.name);return this[r].apply(this,t)},e.prototype.addRequest=function(e,t,n){var o=this;return new Promise(function(a,s){o.requestQueue.push(function(){return r(o,void 0,void 0,function(){var r,o,u,c,l,f=this;return i(this,function(i){switch(i.label){case 0:this.currentRequest=e,r=!1,o=function(){r&&s("call to plugin has timed out "+f.profile.name+" - "+t+" - "+JSON.stringify(f.currentRequest)),delete f.currentRequest,f.requestQueue.shift(),0!==f.requestQueue.length&&f.requestQueue[0]()},u=setTimeout(function(){r=!0,o()},1e4),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.callPluginMethod(t,n)];case 2:return c=i.sent(),r?[2]:(delete this.currentRequest,a(c),[3,4]);case 3:return l=i.sent(),s(l),[3,4];case 4:return clearTimeout(u),o(),[2]}})})}),1===o.requestQueue.length&&o.requestQueue[0]()})},e.prototype.askUserPermission=function(e,t){if(!this.currentRequest)return Promise.resolve(!0);if(this.methods.includes(e)){var n=this.currentRequest.from,r=this.name;return this.call("manager","canCall",n,r,e,t)}return Promise.resolve(!1)},e.prototype.createService=function(e,t){return r(this,void 0,void 0,function(){var n;return i(this,function(r){switch(r.label){case 0:if(this.methods&&this.methods.includes(e))throw new Error("A service cannot have the same name as an exposed method");return n=o.createService(e,t),[4,o.activateService(this,n)];case 1:return r.sent(),[2,n]}})})},e.prototype.prepareService=function(e,t){var n=this;return this.activateService[e]=function(){return r(n,void 0,void 0,function(){var n,r;return i(this,function(i){switch(i.label){case 0:if(this.methods&&this.methods.includes(e))throw new Error("A service cannot have the same name as an exposed method");return[4,t()];case 1:return n=i.sent(),r=o.createService(e,n),[4,o.activateService(this,r)];case 2:return i.sent(),delete this.activateService[e],[2,r]}})})}},e.prototype.on=function(e,t,n){throw new Error('Cannot use method "on" from plugin "'+this.name+'". It is not registered in the engine yet.')},e.prototype.once=function(e,t,n){throw new Error('Cannot use method "once" from plugin "'+this.name+'". It is not registered in the engine yet.')},e.prototype.off=function(e,t){throw new Error('Cannot use method "off" from plugin "'+this.name+'". It is not registered in the engine yet.')},e.prototype.call=function(e,t){for(var n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];return r(this,void 0,void 0,function(){return i(this,function(e){throw new Error('Cannot use method "call" from plugin "'+this.name+'". It is not registered in the engine yet.')})})},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];throw new Error('Cannot use method "emit" from plugin "'+this.name+'". It is not registered in the engine yet.')},e}();t.Plugin=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(18))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(21))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(22))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(23))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(24))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(25))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(30))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(26))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(27))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(28))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(29))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getMethodPath=function(e,t){if(!t)return e;var n=t.split(".");return n.shift(),n.push(e),n.join(".")},t.getRootPath=function(e){return e.split(".").shift()}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},a=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r};Object.defineProperty(t,"__esModule",{value:!0});var s=n(12),u=function(){function e(){}return e.prototype.emit=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];(t=this.plugin).emit.apply(t,a([e],n))},e.prototype.createService=function(e,t){return i(this,void 0,void 0,function(){var n,r;return o(this,function(i){switch(i.label){case 0:if(this.methods.includes(e))throw new Error("A service cannot have the same name as an exposed method");return n=this.path+"."+e,r=l(n,t),[4,f(this.plugin,r)];case 1:return i.sent(),[2,r]}})})},e.prototype.prepareService=function(e,t){var n=this;if(this.methods.includes(e))throw new Error("A service cannot have the same name as an exposed method");var r=this.path+"."+e;this.plugin.activateService[r]=function(){return i(n,void 0,void 0,function(){var e,n;return o(this,function(i){switch(i.label){case 0:return e=t(),n=l(r,e),[4,f(this.plugin,n)];case 1:return i.sent(),delete this.plugin.activateService[r],[2,n]}})})}},e}();function c(e){if(e.methods){for(var n=0,r=e.methods;n<r.length;n++){var i=r[n];if(!(i in e))throw new Error("Method "+i+" is not part of serivce")}return e.methods}if(t.isPluginService(e)){var o=Object.getPrototypeOf(e);return Object.getOwnPropertyNames(o).filter(function(e){return"constructor"!==e&&!e.startsWith("_")})}return Object.getOwnPropertyNames(e).filter(function(t){return"function"==typeof e[t]&&!t.startsWith("_")})}function l(e,n){if(n.path&&s.getRootPath(n.path)!==e)throw new Error("Service path "+n.path+" is different from the one provided: "+e);for(var i=c(n),o=0,a=i;o<a.length;o++){var u=a[o];if(!(u in n))throw new Error("Method "+u+" is not part of service "+e)}return t.isPluginService(n)?(n.methods||(n.methods=i),n):r(r({},n),{methods:i,path:e})}function f(e,t){e.methods=a(e.methods||[],t.methods);for(var n=0,r=c(t);n<r.length;n++){var i=r[n];e[t.path+"."+i]=t[i].bind(t)}return e.call("manager","updateProfile",{methods:e.methods})}t.PluginService=u,t.isPluginService=function(e){return e instanceof u},t.getMethods=c,t.createService=l,t.activateService=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(15))},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(16)),r(n(38)),r(n(43)),r(n(13))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(17))},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},o=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r};Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),s=function(){function e(e){var t=this;this.manager=e,this.plugins={},this.events={},this.listeners={},this.isLoaded=!1,this.plugins.manager=e,this.manager.engineActivatePlugin=function(e){return t.activatePlugin(e)},this.manager.engineDeactivatePlugin=function(e){return t.deactivatePlugin(e)},e.activatePlugin("manager").then(function(){t.isLoaded=!0,t.managerLoaded&&t.managerLoaded()})}return e.prototype.onload=function(e){return r(this,void 0,void 0,function(){var t=this;return i(this,function(n){return[2,new Promise(function(n,r){t.isLoaded?(n(),e&&e()):t.managerLoaded=function(){n(),e&&e(),delete t.managerLoaded}})]})})},e.prototype.broadcast=function(e,t){for(var n=this,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var o=a.listenEvent(e,t);this.listeners[o]&&(this.listeners[o]||[]).forEach(function(i){var a;if(!n.events[i][o])throw new Error("Plugin "+i+" should be listening on event "+t+" from "+e+". But no callback have been found");(a=n.events[i])[o].apply(a,r)})},e.prototype.addListener=function(e,t,n,r){var i=a.listenEvent(t,n);this.events[e][i]||(this.events[e][i]=r),this.listeners[i]||(this.listeners[i]=[]),this.listeners[i].includes(e)||this.listeners[i].push(e)},e.prototype.removeListener=function(e,t,n){var r=a.listenEvent(t,n);this.listeners[r]=this.listeners[r].filter(function(t){return t!==e}),delete this.events[e][r]},e.prototype.listenOnce=function(e,t,n,r){var i=this;this.addListener(e,t,n,function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];r.apply(void 0,o),i.removeListener(e,t,n)})},e.prototype.callMethod=function(e,t,n){for(var o=[],a=3;a<arguments.length;a++)o[a-3]=arguments[a];return r(this,void 0,void 0,function(){var r,a,s,u,c,l,f;return i(this,function(i){switch(i.label){case 0:if(r=t.split(".").shift(),!this.plugins[r])throw new Error("Cannot call "+r+" from "+e+", because "+r+" is not registered");return[4,Promise.all([this.manager.getProfile(r),this.manager.getProfile(e)])];case 1:return a=i.sent(),s=a[0],u=a[1],[4,this.manager.isActive(r)];case 2:return i.sent()?[3,6]:[4,this.manager.canActivate(u,s)];case 3:return i.sent()?[4,this.manager.toggleActive(r)]:[3,5];case 4:return i.sent(),[3,6];case 5:throw new Error(u.name+" cannot call "+n+" of "+r+", because "+r+" is not activated yet");case 6:if(!s.methods.includes(n))throw c='Cannot call method "'+n+'" of "'+r+'" from "'+e+'", because "'+n+'" is not exposed.',l="Here is the list of exposed methods: "+s.methods.map(function(e){return'"'+e+'"'}).join(","),new Error(c+" "+l);return f={from:e,path:t},[2,this.plugins[r].addRequest(f,n,o)]}})})},e.prototype.createApp=function(e){return r(this,void 0,void 0,function(){var t,n=this;return i(this,function(r){switch(r.label){case 0:return t=Object.keys(this.plugins).map(function(e){return n.manager.getProfile(e)}),[4,Promise.all(t)];case 1:return[2,r.sent().reduce(function(t,r){return t[r.name]=(r.methods||[]).reduce(function(t,i){return t[i]=function(){for(var t=[],a=0;a<arguments.length;a++)t[a]=arguments[a];return n.callMethod.apply(n,o([e,r.name,i],t))},t},{on:function(t,i){return n.addListener(e,r.name,t,i)},once:function(t,i){return n.listenOnce(e,r.name,t,i)},off:function(t){return n.removeListener(e,r.name,t)},profile:r}),t},{})]}})})},e.prototype.activatePlugin=function(e){return r(this,void 0,void 0,function(){var t,n,r,a=this;return i(this,function(i){switch(i.label){case 0:if(!this.plugins[e])throw new Error("Cannot active plugin "+e+" because it's not registered yet");return[4,this.manager.isActive(e)];case 1:return i.sent()?[2]:(t=this.plugins[e],this.events[e]={},t.on=function(t,n,r){a.addListener(e,t,n,r)},t.once=function(t,n,r){a.listenOnce(e,t,n,r)},t.off=function(t,n){a.removeListener(e,t,n)},t.emit=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];a.broadcast.apply(a,o([e,t],n))},t.call=function(t,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];return a.callMethod.apply(a,o([e,t,n],r))},n=t,r="app",[4,this.createApp(e)]);case 2:return n[r]=i.sent(),t.createApp=function(){return a.createApp(e)},[4,t.activate()];case 3:return i.sent(),[2]}})})},e.prototype.deactivatePlugin=function(e){return r(this,void 0,void 0,function(){var t,n=this;return i(this,function(r){switch(r.label){case 0:if(!this.plugins[e])throw new Error("Cannot deactive plugin "+e+" because it's not registered yet");return[4,this.manager.isActive(e)];case 1:return r.sent()?[4,(t=this.plugins[e]).deactivate()]:[2];case 2:return r.sent(),this.updateErrorHandler(t),delete t.app,delete t.createApp,delete this.events[e],Object.keys(this.listeners).forEach(function(t){n.listeners[t].forEach(function(r,i){r===e&&n.listeners[t].splice(i,1)})}),[2]}})})},e.prototype.updateErrorHandler=function(e){var t=function(e){return"Plugin "+name+" is currently deactivated. "+e+". Activate "+name+" first."};e.call=function(e,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];throw new Error(t("It cannot call method "+n+" of plugin "+e+"."))},e.on=function(e,n){throw new Error(t("It cannot listen on event "+n+" of plugin "+e+"."))},e.once=function(e,n){throw new Error(t("It cannot listen on event "+n+" of plugin "+e+"."))},e.off=function(e,n){throw new Error(t("All event listeners are already removed."))},e.emit=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];throw new Error(t("It cannot emit the event "+e))}},e.prototype.register=function(e){var t=this,n=function(e){if(t.plugins[e.name])throw new Error("Plugin "+e.name+" is already register.");return t.plugins[e.name]=e,t.manager.addProfile(e.profile),t.updateErrorHandler(e),e.onRegistration&&e.onRegistration(),t.onRegistration&&t.onRegistration(e),e.name};return Array.isArray(e)?e.map(function(e){return n(e)}):n(e)},e.prototype.isRegistered=function(e){return!!this.plugins[e]},e}();t.Engine=s},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(19)),r(n(20)),r(n(35)),r(n(12)),r(n(13))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callEvent=function(e,t,n){return"["+e+"] "+t+"-"+n},t.listenEvent=function(e,t){return"["+e+"] "+t}},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(2)),r(n(3)),r(n(4)),r(n(5)),r(n(6)),r(n(8)),r(n(9)),r(n(10)),r(n(11)),r(n(7)),r(n(31)),r(n(34))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.compilerProfile={name:"compiler",methods:["compile","getCompilationResult"],events:["compilationFinished"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.editorProfile={name:"editor",methods:["discardHighlight","highlight"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.filSystemProfile={name:"fs",methods:["getCurrentFile","getFile","getFolder","setFile","switchFile"],events:["currentFileChanged"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.networkProfile={name:"network",methods:["addNetwork","detectNetwork","getEndpoint","getNetworkProvider","removeNetwork"],events:["providerChanged"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.udappProfile={name:"udapp",methods:["createVMAccount","getAccounts","sendTransaction"],events:["newTransaction"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.themeProfile={name:"theme",methods:[],events:["themeChanged"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unitTestProfile={name:"unitTest",methods:["testFromPath","testFromSource"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.contentImportProfile={name:"contentImport",methods:["resolve"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.settingsProfile={name:"settings",methods:["getGithubAccessToken"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pluginManagerProfile={name:"manager",methods:["getProfile","updateProfile","activatePlugin","deactivatePlugin","canCall"]}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),o=n(4),a=n(3),s=n(5),u=n(6),c=n(8),l=n(9),f=n(10),h=n(11),p=n(32),d=n(7);t.remixApi=Object.freeze({manager:d.pluginManagerProfile,solidity:r(r({},i.compilerProfile),{name:"solidity"}),fileManager:r(r({},o.filSystemProfile),{name:"fileManager"}),solidityUnitTesting:r(r({},l.unitTestProfile),{name:"solidityUnitTesting"}),editor:a.editorProfile,network:s.networkProfile,udapp:u.udappProfile,contentImport:f.contentImportProfile,settings:h.settingsProfile,theme:c.themeProfile}),t.remixProfiles=Object.freeze({manager:d.pluginManagerProfile,solidity:r(r({},i.compilerProfile),{name:"solidity"}),fileManager:r(r({},o.filSystemProfile),{name:"fileManager"}),git:r(r({},p.gitProfile),{name:"git"}),solidityUnitTesting:r(r({},l.unitTestProfile),{name:"solidityUnitTesting"}),editor:a.editorProfile,network:s.networkProfile,udapp:u.udappProfile,contentImport:f.contentImportProfile,settings:h.settingsProfile,theme:c.themeProfile})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(33))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.gitProfile={name:"remixd.git",methods:["clone","checkout","init","add","commit","fetch","pull","push","reset","status","remote","log"]}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),o=n(4),a=n(3),s=n(5),u=n(6),c=n(7);t.standardProfiles=Object.freeze({manager:c.pluginManagerProfile,solidity:r(r({},i.compilerProfile),{name:"solidity"}),fileManager:r(r({},o.filSystemProfile),{name:"fileManager"}),editor:a.editorProfile,network:s.networkProfile,udapp:u.udappProfile})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(36))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(37))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boxProfile={name:"box",methods:["login","isEnabled","getUserAddress","openSpace","closeSpace","isSpaceOpened","getSpacePrivateValue","setSpacePrivateValue","getSpacePublicValue","setSpacePublicValue","getSpacePublicData","getSpaceName"],events:["enabled","loggedIn","loggedOut","spaceClosed","spaceOpened"]}},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(0)),r(n(39)),r(n(40)),r(n(41)),r(n(42))},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},a=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r};Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(t){var n=Array.from(new Set(a(t.methods||[],["currentFocus","focus","addView","removeView"])));return e.call(this,o(o({},t),{methods:n}))||this}return i(t,e),t}(n(0).Plugin);t.HostPlugin=s},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},s=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r};Object.defineProperty(t,"__esModule",{value:!0});var u=n(0);function c(e){return!!e.location}t.isViewLibrary=c;var l=function(e){function t(t,n){var r=e.call(this,n)||this;if(r.library=t,r.profile=n,n.methods.forEach(function(e){if(!t[e])throw new Error("Method "+e+" is exposed by LibraryPlugin "+n.name+". But library doesn't expose this method")}),r.isView=c(n),r.isView&&!r.render)throw new Error("Profile "+n.name+" define the location "+n.location+', but method "render" is not implemented');return r}return i(t,e),t.prototype.activate=function(){return o(this,void 0,void 0,function(){var t=this;return a(this,function(n){switch(n.label){case 0:return this.isView?[4,this.call(this.profile.location,"addView",this.profile,this.render())]:[3,2];case 1:n.sent(),n.label=2;case 2:if(e.prototype.activate.call(this),this.profile.notifications){if(!this.library.events||!this.library.events.emit)throw new Error('"events" object from Library of plugin '+this.name+' should implement "emit"');Object.keys(this.profile.notifications).forEach(function(e){t.profile.notifications[e].forEach(function(n){t.on(e,n,function(r){var i;return(i=t.library.events).emit.apply(i,s(["["+e+"] "+n],r))})})})}if(this.profile.events){if(!this.library.events||!this.library.events.emit)throw new Error('"events" object from Library of plugin '+this.name+' should implement "emit"');this.profile.events.forEach(function(e){t.library.events.on(e,function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return t.emit.apply(t,s([e],n))})})}return[2]}})})},t.prototype.deactivate=function(){var t=this;this.isView&&this.call(this.profile.location,"removeView",this.profile),this.profile.notifications&&Object.keys(this.profile.notifications).forEach(function(e){t.profile.notifications[e].forEach(function(n){return t.off(e,n)})}),this.profile.events&&this.library.events.off&&this.profile.events.forEach(function(e){return t.library.events.off(e)}),e.prototype.deactivate.call(this)},t.prototype.callPluginMethod=function(e,t){var n;if(!this.library[e])throw new Error("LibraryPlugin "+this.name+" doesn't expose method "+e);return(n=this.library)[e].apply(n,t)},t}(u.Plugin);t.LibraryPlugin=l},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(0);t.isView=function(e){return!!e.location};var u=function(e){function t(t){var n=e.call(this,t)||this;return n.profile=t,n}return i(t,e),t.prototype.activate=function(){return o(this,void 0,void 0,function(){return a(this,function(t){switch(t.label){case 0:return[4,this.call(this.profile.location,"addView",this.profile,this.render())];case 1:return t.sent(),e.prototype.activate.call(this),[2]}})})},t.prototype.deactivate=function(){this.call(this.profile.location,"removeView",this.profile),e.prototype.deactivate.call(this)},t}(s.Plugin);t.ViewPlugin=u},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var u=n(1),c=n(0);t.managerMethods=["getProfile","updateProfile","activatePlugin","deactivatePlugin","canCall"];var l=function(e){function n(n){void 0===n&&(n=u.pluginManagerProfile);var r=e.call(this,n)||this;return r.profiles={},r.actives=[],r.methods=t.managerMethods,r.profiles[n.name]=n,r}return i(n,e),Object.defineProperty(n.prototype,"requestFrom",{get:function(){return this.currentRequest?this.currentRequest.from:"manager"},enumerable:!0,configurable:!0}),n.prototype.getProfile=function(e){return a(this,void 0,void 0,function(){return s(this,function(t){return[2,this.profiles[e]]})})},n.prototype.updateProfile=function(e){if(e){if(e.name&&e.name!==this.requestFrom)throw new Error("A plugin cannot change its name.");var t=this.requestFrom;if(!this.profiles[t])throw new Error("Plugin "+t+" is not register, you cannot update it's profile.");if(e.url&&e.url!==this.profiles[t].url)throw new Error("Url from Profile cannot be updated.");this.profiles[t]=o(o({},this.profiles[t]),e),this.emit("profileUpdated",this.profiles[t])}},n.prototype.addProfile=function(e){if(this.profiles[e.name])throw new Error("Plugin "+e.name+" already exist");this.profiles[e.name]=e,this.emit("profileAdded",e),this.onProfileAdded&&this.onProfileAdded(e)},n.prototype.isActive=function(e){return a(this,void 0,void 0,function(){return s(this,function(t){return[2,this.actives.includes(e)]})})},n.prototype.activatePlugin=function(e){return a(this,void 0,void 0,function(){var t,n=this;return s(this,function(r){return t=function(e){return a(n,void 0,void 0,function(){var t,n,r;return s(this,function(i){switch(i.label){case 0:return[4,this.isActive(e)];case 1:return i.sent()?[2]:[4,Promise.all([this.getProfile(e),this.getProfile(this.requestFrom)])];case 2:return t=i.sent(),n=t[0],r=t[1],[4,this.canActivate(r,n)];case 3:return i.sent()?[4,this.toggleActive(e)]:[3,5];case 4:return i.sent(),[3,6];case 5:throw new Error("Plugin "+this.requestFrom+" has no right to activate plugin "+e);case 6:return[2]}})})},[2,Array.isArray(e)?Promise.all(e.map(t)):t(e)]})})},n.prototype.deactivatePlugin=function(e){return a(this,void 0,void 0,function(){var t,n=this;return s(this,function(r){return t=function(e){return a(n,void 0,void 0,function(){var t,n,r;return s(this,function(i){switch(i.label){case 0:return[4,this.isActive(e)];case 1:return i.sent()?[4,Promise.all([this.getProfile(e),this.getProfile(this.requestFrom)])]:[2];case 2:return t=i.sent(),n=t[0],r=t[1],[4,this.canDeactivate(r,n)];case 3:return i.sent()?[4,this.toggleActive(e)]:[3,5];case 4:return i.sent(),[3,6];case 5:throw new Error("Plugin "+this.requestFrom+" has no right to deactivate plugin "+e);case 6:return[2]}})})},[2,Array.isArray(e)?Promise.all(e.map(t)):t(e)]})})},n.prototype.toggleActive=function(e){return a(this,void 0,void 0,function(){var t,n=this;return s(this,function(r){return t=function(e){return a(n,void 0,void 0,function(){var t,n,r;return s(this,function(i){switch(i.label){case 0:return[4,Promise.all([this.isActive(e),this.getProfile(e)])];case 1:return t=i.sent(),n=t[0],r=t[1],n?[4,this.engineDeactivatePlugin(e)]:[3,3];case 2:return i.sent(),this.actives=this.actives.filter(function(t){return t!==e}),this.emit("pluginDeactivated",r),this.onPluginDeactivated&&this.onPluginDeactivated(r),[3,5];case 3:return[4,this.engineActivatePlugin(e)];case 4:i.sent(),this.actives.push(e),this.emit("pluginActivated",r),this.onPluginActivated&&this.onPluginActivated(r),i.label=5;case 5:return[2]}})})},[2,Array.isArray(e)?Promise.all(e.map(t)):t(e)]})})},n.prototype.canActivate=function(e,t){return a(this,void 0,void 0,function(){return s(this,function(e){return[2,!0]})})},n.prototype.canDeactivate=function(e,t){return a(this,void 0,void 0,function(){return s(this,function(t){return"manager"===e.name?[2,!0]:[2,!1]})})},n.prototype.canCall=function(e,t,n,r){return a(this,void 0,void 0,function(){return s(this,function(e){return[2,!0]})})},n}(c.Plugin);t.PluginManager=l},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},a=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},u=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r};Object.defineProperty(t,"__esModule",{value:!0});var c=n(0);function l(e,n){var r=Object.keys(t.defaultGateways).find(function(t){return e.startsWith(t)});return r?t.defaultGateways[r](e,n):e}t.defaultGateways={"ipfs://":function(e,t){return"https://"+t+".dyn.plugin.remixproject.org/ipfs/"+e.replace("ipfs://","")},"swarm://":function(e,t){return"https://swarm-gateways.net/bzz-raw://"+e.replace("swarm://","")}},t.transformUrl=l;var f=function(e){function t(t){var n=e.call(this,t)||this;return n.id=0,n.pendingRequest={},n}return i(t,e),t.prototype.activate=function(){var e=this.profile,t=e.url,n=e.name;this.connect(l(t,n))},t.prototype.deactivate=function(){this.loaded=!1,this.disconnect(),e.prototype.deactivate.call(this)},t.prototype.callPluginMethod=function(e,t){var n=this;void 0===t&&(t=[]);var r=this.id++,i=this.currentRequest,o=this.name,a=new Promise(function(e,t){n.pendingRequest[r]=function(n,r){return r?t(r):e(n)}});return this.send({id:r,action:"request",key:e,payload:t,requestInfo:i,name:o}),a},t.prototype.handshake=function(){return a(this,void 0,void 0,function(){var e;return s(this,function(t){switch(t.label){case 0:return this.loaded?[3,2]:[4,this.callPluginMethod("handshake",[this.profile.name])];case 1:e=t.sent(),this.call("manager","updateProfile",this.profile),this.loaded=!0,e&&(this.profile.methods=e),t.label=2;case 2:return[2]}})})},t.prototype.getMessage=function(e){return a(this,void 0,void 0,function(){var t,n,r,i,a,c,l,f,h,p,d,v=this;return s(this,function(s){switch(s.label){case 0:if("request"===e.action&&"handshake"===e.key)return[2,this.handshake()];switch(e.action){case"on":case"listen":return[3,1];case"off":return[3,2];case"once":return[3,3];case"emit":case"notification":return[3,4];case"call":case"request":return[3,5];case"response":return[3,10]}return[3,11];case 1:return t=e.name,n=e.key,"notification",this.on(t,n,function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return v.send({action:"notification",name:t,key:n,payload:e})}),[3,12];case 2:return r=e.name,i=e.key,this.off(r,i),[3,12];case 3:return a=e.name,c=e.key,"notification",this.once(a,c,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v.send({action:"notification",name:a,key:c,payload:e})}),[3,12];case 4:return e.payload?(this.emit.apply(this,u([e.key],e.payload)),[3,12]):[3,12];case 5:l="response",s.label=6;case 6:return s.trys.push([6,8,,9]),[4,this.call.apply(this,u([e.name,e.key],e.payload))];case 7:return p=s.sent(),d=void 0,this.send(o(o({},e),{action:l,payload:p,error:d})),[3,9];case 8:return f=s.sent(),p=void 0,d=f.message,this.send(o(o({},e),{action:l,payload:p,error:d})),[3,9];case 9:return[3,12];case 10:return h=e.id,p=e.payload,d=e.error,this.pendingRequest[h](p,d),delete this.pendingRequest[h],[3,12];case 11:throw new Error("Message should be a notification, request or response");case 12:return[2]}})})},t}(c.Plugin);t.PluginConnector=f}])}); | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(global,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=14)}([function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var s=n(1),a=function(){function e(e){this.profile=e,this.activateService={},this.requestQueue=[],this.options={}}return Object.defineProperty(e.prototype,"name",{get:function(){return this.profile.name},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"methods",{get:function(){return this.profile.methods},set:function(e){this.profile.methods=e},enumerable:!0,configurable:!0}),e.prototype.activate=function(){this.onActivation&&this.onActivation()},e.prototype.deactivate=function(){this.onDeactivation&&this.onDeactivation()},e.prototype.setOptions=function(e){void 0===e&&(e={}),this.options=r(r({},this.options),e)},e.prototype.callPluginMethod=function(e,t){var n=this.currentRequest&&this.currentRequest.path,r=s.getMethodPath(e,n);if(!(r in this))throw new Error("Method "+r+" is not implemented by "+this.profile.name);return this[r].apply(this,t)},e.prototype.addRequest=function(e,t,n){var r=this;return new Promise(function(s,a){r.requestQueue.push(function(){return i(r,void 0,void 0,function(){var r,i,u,c,l,f=this;return o(this,function(o){switch(o.label){case 0:this.currentRequest=e,r=!1,i=function(){r&&a("call to plugin has timed out "+f.profile.name+" - "+t+" - "+JSON.stringify(f.currentRequest)),delete f.currentRequest,f.requestQueue.shift(),0!==f.requestQueue.length&&f.requestQueue[0]()},u=setTimeout(function(){r=!0,i()},this.options.queueTimeout||1e4),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.callPluginMethod(t,n)];case 2:return c=o.sent(),r?[2]:(delete this.currentRequest,s(c),[3,4]);case 3:return l=o.sent(),a(l),[3,4];case 4:return clearTimeout(u),i(),[2]}})})}),1===r.requestQueue.length&&r.requestQueue[0]()})},e.prototype.askUserPermission=function(e,t){if(!this.currentRequest)return Promise.resolve(!0);if(this.methods.includes(e)){var n=this.currentRequest.from,r=this.name;return this.call("manager","canCall",n,r,e,t)}return Promise.resolve(!1)},e.prototype.createService=function(e,t){return i(this,void 0,void 0,function(){var n;return o(this,function(r){switch(r.label){case 0:if(this.methods&&this.methods.includes(e))throw new Error("A service cannot have the same name as an exposed method");return n=s.createService(e,t),[4,s.activateService(this,n)];case 1:return r.sent(),[2,n]}})})},e.prototype.prepareService=function(e,t){var n=this;return this.activateService[e]=function(){return i(n,void 0,void 0,function(){var n,r;return o(this,function(i){switch(i.label){case 0:if(this.methods&&this.methods.includes(e))throw new Error("A service cannot have the same name as an exposed method");return[4,t()];case 1:return n=i.sent(),r=s.createService(e,n),[4,s.activateService(this,r)];case 2:return i.sent(),delete this.activateService[e],[2,r]}})})}},e.prototype.on=function(e,t,n){throw new Error('Cannot use method "on" from plugin "'+this.name+'". It is not registered in the engine yet.')},e.prototype.once=function(e,t,n){throw new Error('Cannot use method "once" from plugin "'+this.name+'". It is not registered in the engine yet.')},e.prototype.off=function(e,t){throw new Error('Cannot use method "off" from plugin "'+this.name+'". It is not registered in the engine yet.')},e.prototype.call=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return i(this,void 0,void 0,function(){return o(this,function(e){throw new Error('Cannot use method "call" from plugin "'+this.name+'". It is not registered in the engine yet.')})})},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];throw new Error('Cannot use method "emit" from plugin "'+this.name+'". It is not registered in the engine yet.')},e}();t.Plugin=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(18))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(21))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(22))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(23))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(24))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(25))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(30))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(26))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(27))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(28))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(29))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getMethodPath=function(e,t){if(!t)return e;var n=t.split(".");return n.shift(),n.push(e),n.join(".")},t.getRootPath=function(e){return e.split(".").shift()}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},s=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r};Object.defineProperty(t,"__esModule",{value:!0});var a=n(12),u=function(){function e(){}return e.prototype.emit=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];(t=this.plugin).emit.apply(t,s([e],n))},e.prototype.createService=function(e,t){return i(this,void 0,void 0,function(){var n,r;return o(this,function(i){switch(i.label){case 0:if(this.methods.includes(e))throw new Error("A service cannot have the same name as an exposed method");return n=this.path+"."+e,r=l(n,t),[4,f(this.plugin,r)];case 1:return i.sent(),[2,r]}})})},e.prototype.prepareService=function(e,t){var n=this;if(this.methods.includes(e))throw new Error("A service cannot have the same name as an exposed method");var r=this.path+"."+e;this.plugin.activateService[r]=function(){return i(n,void 0,void 0,function(){var e,n;return o(this,function(i){switch(i.label){case 0:return e=t(),n=l(r,e),[4,f(this.plugin,n)];case 1:return i.sent(),delete this.plugin.activateService[r],[2,n]}})})}},e}();function c(e){if(e.methods){for(var n=0,r=e.methods;n<r.length;n++){var i=r[n];if(!(i in e))throw new Error("Method "+i+" is not part of serivce")}return e.methods}if(t.isPluginService(e)){var o=Object.getPrototypeOf(e);return Object.getOwnPropertyNames(o).filter(function(e){return"constructor"!==e&&!e.startsWith("_")})}return Object.getOwnPropertyNames(e).filter(function(t){return"function"==typeof e[t]&&!t.startsWith("_")})}function l(e,n){if(n.path&&a.getRootPath(n.path)!==e)throw new Error("Service path "+n.path+" is different from the one provided: "+e);for(var i=c(n),o=0,s=i;o<s.length;o++){var u=s[o];if(!(u in n))throw new Error("Method "+u+" is not part of service "+e)}return t.isPluginService(n)?(n.methods||(n.methods=i),n):r(r({},n),{methods:i,path:e})}function f(e,t){e.methods=s(e.methods||[],t.methods);for(var n=0,r=c(t);n<r.length;n++){var i=r[n];e[t.path+"."+i]=t[i].bind(t)}return e.call("manager","updateProfile",{methods:e.methods})}t.PluginService=u,t.isPluginService=function(e){return e instanceof u},t.getMethods=c,t.createService=l,t.activateService=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(15))},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(16)),r(n(38)),r(n(43)),r(n(13))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(17))},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},o=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r};Object.defineProperty(t,"__esModule",{value:!0});var s=n(1),a=function(){function e(e){var t=this;this.manager=e,this.plugins={},this.events={},this.listeners={},this.isLoaded=!1,this.plugins.manager=e,this.manager.engineActivatePlugin=function(e){return t.activatePlugin(e)},this.manager.engineDeactivatePlugin=function(e){return t.deactivatePlugin(e)},e.activatePlugin("manager").then(function(){t.isLoaded=!0,t.managerLoaded&&t.managerLoaded()})}return e.prototype.onload=function(e){return r(this,void 0,void 0,function(){var t=this;return i(this,function(n){return[2,new Promise(function(n,r){t.isLoaded?(n(),e&&e()):t.managerLoaded=function(){n(),e&&e(),delete t.managerLoaded}})]})})},e.prototype.broadcast=function(e,t){for(var n=this,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var o=s.listenEvent(e,t);this.listeners[o]&&(this.listeners[o]||[]).forEach(function(i){var s;if(!n.events[i][o])throw new Error("Plugin "+i+" should be listening on event "+t+" from "+e+". But no callback have been found");(s=n.events[i])[o].apply(s,r)})},e.prototype.addListener=function(e,t,n,r){var i=s.listenEvent(t,n);this.events[e][i]||(this.events[e][i]=r),this.listeners[i]||(this.listeners[i]=[]),this.listeners[i].includes(e)||this.listeners[i].push(e)},e.prototype.removeListener=function(e,t,n){var r=s.listenEvent(t,n);this.listeners[r]=this.listeners[r].filter(function(t){return t!==e}),delete this.events[e][r]},e.prototype.listenOnce=function(e,t,n,r){var i=this;this.addListener(e,t,n,function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];r.apply(void 0,o),i.removeListener(e,t,n)})},e.prototype.callMethod=function(e,t,n){for(var o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return r(this,void 0,void 0,function(){var r,s,a,u,c,l,f;return i(this,function(i){switch(i.label){case 0:if(r=t.split(".").shift(),!this.plugins[r])throw new Error("Cannot call "+r+" from "+e+", because "+r+" is not registered");return[4,Promise.all([this.manager.getProfile(r),this.manager.getProfile(e)])];case 1:return s=i.sent(),a=s[0],u=s[1],[4,this.manager.isActive(r)];case 2:return i.sent()?[3,6]:[4,this.manager.canActivate(u,a)];case 3:return i.sent()?[4,this.manager.toggleActive(r)]:[3,5];case 4:return i.sent(),[3,6];case 5:throw new Error(u.name+" cannot call "+n+" of "+r+", because "+r+" is not activated yet");case 6:if(!a.methods.includes(n))throw c='Cannot call method "'+n+'" of "'+r+'" from "'+e+'", because "'+n+'" is not exposed.',l="Here is the list of exposed methods: "+a.methods.map(function(e){return'"'+e+'"'}).join(","),new Error(c+" "+l);return f={from:e,path:t},[2,this.plugins[r].addRequest(f,n,o)]}})})},e.prototype.createApp=function(e){return r(this,void 0,void 0,function(){var t,n=this;return i(this,function(r){switch(r.label){case 0:return t=Object.keys(this.plugins).map(function(e){return n.manager.getProfile(e)}),[4,Promise.all(t)];case 1:return[2,r.sent().reduce(function(t,r){return t[r.name]=(r.methods||[]).reduce(function(t,i){return t[i]=function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];return n.callMethod.apply(n,o([e,r.name,i],t))},t},{on:function(t,i){return n.addListener(e,r.name,t,i)},once:function(t,i){return n.listenOnce(e,r.name,t,i)},off:function(t){return n.removeListener(e,r.name,t)},profile:r}),t},{})]}})})},e.prototype.activatePlugin=function(e){return r(this,void 0,void 0,function(){var t,n,r,s=this;return i(this,function(i){switch(i.label){case 0:if(!this.plugins[e])throw new Error("Cannot active plugin "+e+" because it's not registered yet");return[4,this.manager.isActive(e)];case 1:return i.sent()?[2]:(t=this.plugins[e],this.events[e]={},t.on=function(t,n,r){s.addListener(e,t,n,r)},t.once=function(t,n,r){s.listenOnce(e,t,n,r)},t.off=function(t,n){s.removeListener(e,t,n)},t.emit=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];s.broadcast.apply(s,o([e,t],n))},t.call=function(t,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];return s.callMethod.apply(s,o([e,t,n],r))},n=t,r="app",[4,this.createApp(e)]);case 2:return n[r]=i.sent(),t.createApp=function(){return s.createApp(e)},[4,t.activate()];case 3:return i.sent(),[2]}})})},e.prototype.deactivatePlugin=function(e){return r(this,void 0,void 0,function(){var t,n=this;return i(this,function(r){switch(r.label){case 0:if(!this.plugins[e])throw new Error("Cannot deactive plugin "+e+" because it's not registered yet");return[4,this.manager.isActive(e)];case 1:return r.sent()?[4,(t=this.plugins[e]).deactivate()]:[2];case 2:return r.sent(),this.updateErrorHandler(t),delete t.app,delete t.createApp,delete this.events[e],Object.keys(this.listeners).forEach(function(t){n.listeners[t].forEach(function(r,i){r===e&&n.listeners[t].splice(i,1)})}),[2]}})})},e.prototype.updateErrorHandler=function(e){var t=function(e){return"Plugin "+name+" is currently deactivated. "+e+". Activate "+name+" first."};e.call=function(e,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];throw new Error(t("It cannot call method "+n+" of plugin "+e+"."))},e.on=function(e,n){throw new Error(t("It cannot listen on event "+n+" of plugin "+e+"."))},e.once=function(e,n){throw new Error(t("It cannot listen on event "+n+" of plugin "+e+"."))},e.off=function(e,n){throw new Error(t("All event listeners are already removed."))},e.emit=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];throw new Error(t("It cannot emit the event "+e))}},e.prototype.register=function(e){var t=this,n=function(e){if(t.plugins[e.name])throw new Error("Plugin "+e.name+" is already register.");if(t.plugins[e.name]=e,t.manager.addProfile(e.profile),t.updateErrorHandler(e),t.setPluginOption){var n=t.setPluginOption(e.profile);e.setOptions(n)}return e.onRegistration&&e.onRegistration(),t.onRegistration&&t.onRegistration(e),e.name};return Array.isArray(e)?e.map(function(e){return n(e)}):n(e)},e.prototype.isRegistered=function(e){return!!this.plugins[e]},e}();t.Engine=a},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(19)),r(n(20)),r(n(35)),r(n(12)),r(n(13))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.callEvent=function(e,t,n){return"["+e+"] "+t+"-"+n},t.listenEvent=function(e,t){return"["+e+"] "+t}},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(2)),r(n(3)),r(n(4)),r(n(5)),r(n(6)),r(n(8)),r(n(9)),r(n(10)),r(n(11)),r(n(7)),r(n(31)),r(n(34))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.compilerProfile={name:"compiler",methods:["compile","getCompilationResult"],events:["compilationFinished"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.editorProfile={name:"editor",methods:["discardHighlight","highlight"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.filSystemProfile={name:"fs",methods:["getCurrentFile","getFile","getFolder","setFile","switchFile"],events:["currentFileChanged"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.networkProfile={name:"network",methods:["addNetwork","detectNetwork","getEndpoint","getNetworkProvider","removeNetwork"],events:["providerChanged"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.udappProfile={name:"udapp",methods:["createVMAccount","getAccounts","sendTransaction"],events:["newTransaction"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.themeProfile={name:"theme",methods:[],events:["themeChanged"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unitTestProfile={name:"unitTest",methods:["testFromPath","testFromSource"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.contentImportProfile={name:"contentImport",methods:["resolve"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.settingsProfile={name:"settings",methods:["getGithubAccessToken"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.pluginManagerProfile={name:"manager",methods:["getProfile","updateProfile","activatePlugin","deactivatePlugin","canCall"]}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),o=n(4),s=n(3),a=n(5),u=n(6),c=n(8),l=n(9),f=n(10),h=n(11),p=n(32),d=n(7);t.remixApi=Object.freeze({manager:d.pluginManagerProfile,solidity:r(r({},i.compilerProfile),{name:"solidity"}),fileManager:r(r({},o.filSystemProfile),{name:"fileManager"}),solidityUnitTesting:r(r({},l.unitTestProfile),{name:"solidityUnitTesting"}),editor:s.editorProfile,network:a.networkProfile,udapp:u.udappProfile,contentImport:f.contentImportProfile,settings:h.settingsProfile,theme:c.themeProfile}),t.remixProfiles=Object.freeze({manager:d.pluginManagerProfile,solidity:r(r({},i.compilerProfile),{name:"solidity"}),fileManager:r(r({},o.filSystemProfile),{name:"fileManager"}),git:r(r({},p.gitProfile),{name:"git"}),solidityUnitTesting:r(r({},l.unitTestProfile),{name:"solidityUnitTesting"}),editor:s.editorProfile,network:a.networkProfile,udapp:u.udappProfile,contentImport:f.contentImportProfile,settings:h.settingsProfile,theme:c.themeProfile})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(33))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.gitProfile={name:"remixd.git",methods:["clone","checkout","init","add","commit","fetch","pull","push","reset","status","remote","log"]}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),o=n(4),s=n(3),a=n(5),u=n(6),c=n(7);t.standardProfiles=Object.freeze({manager:c.pluginManagerProfile,solidity:r(r({},i.compilerProfile),{name:"solidity"}),fileManager:r(r({},o.filSystemProfile),{name:"fileManager"}),editor:s.editorProfile,network:a.networkProfile,udapp:u.udappProfile})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(36))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}(n(37))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.boxProfile={name:"box",methods:["login","isEnabled","getUserAddress","openSpace","closeSpace","isSpaceOpened","getSpacePrivateValue","setSpacePrivateValue","getSpacePublicValue","setSpacePublicValue","getSpacePublicData","getSpaceName"],events:["enabled","loggedIn","loggedOut","spaceClosed","spaceOpened"]}},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(0)),r(n(39)),r(n(40)),r(n(41)),r(n(42))},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},s=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r};Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(t){var n=Array.from(new Set(s(t.methods||[],["currentFocus","focus","addView","removeView"])));return e.call(this,o(o({},t),{methods:n}))||this}return i(t,e),t}(n(0).Plugin);t.HostPlugin=a},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},a=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r};Object.defineProperty(t,"__esModule",{value:!0});var u=n(0);function c(e){return!!e.location}t.isViewLibrary=c;var l=function(e){function t(t,n){var r=e.call(this,n)||this;if(r.library=t,r.profile=n,n.methods.forEach(function(e){if(!t[e])throw new Error("Method "+e+" is exposed by LibraryPlugin "+n.name+". But library doesn't expose this method")}),r.isView=c(n),r.isView&&!r.render)throw new Error("Profile "+n.name+" define the location "+n.location+', but method "render" is not implemented');return r}return i(t,e),t.prototype.activate=function(){return o(this,void 0,void 0,function(){var t=this;return s(this,function(n){switch(n.label){case 0:return this.isView?[4,this.call(this.profile.location,"addView",this.profile,this.render())]:[3,2];case 1:n.sent(),n.label=2;case 2:if(e.prototype.activate.call(this),this.profile.notifications){if(!this.library.events||!this.library.events.emit)throw new Error('"events" object from Library of plugin '+this.name+' should implement "emit"');Object.keys(this.profile.notifications).forEach(function(e){t.profile.notifications[e].forEach(function(n){t.on(e,n,function(r){var i;return(i=t.library.events).emit.apply(i,a(["["+e+"] "+n],r))})})})}if(this.profile.events){if(!this.library.events||!this.library.events.emit)throw new Error('"events" object from Library of plugin '+this.name+' should implement "emit"');this.profile.events.forEach(function(e){t.library.events.on(e,function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return t.emit.apply(t,a([e],n))})})}return[2]}})})},t.prototype.deactivate=function(){var t=this;this.isView&&this.call(this.profile.location,"removeView",this.profile),this.profile.notifications&&Object.keys(this.profile.notifications).forEach(function(e){t.profile.notifications[e].forEach(function(n){return t.off(e,n)})}),this.profile.events&&this.library.events.off&&this.profile.events.forEach(function(e){return t.library.events.off(e)}),e.prototype.deactivate.call(this)},t.prototype.callPluginMethod=function(e,t){var n;if(!this.library[e])throw new Error("LibraryPlugin "+this.name+" doesn't expose method "+e);return(n=this.library)[e].apply(n,t)},t}(u.Plugin);t.LibraryPlugin=l},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(0);t.isView=function(e){return!!e.location};var u=function(e){function t(t){var n=e.call(this,t)||this;return n.profile=t,n}return i(t,e),t.prototype.activate=function(){return o(this,void 0,void 0,function(){return s(this,function(t){switch(t.label){case 0:return[4,this.call(this.profile.location,"addView",this.profile,this.render())];case 1:return t.sent(),e.prototype.activate.call(this),[2]}})})},t.prototype.deactivate=function(){this.call(this.profile.location,"removeView",this.profile),e.prototype.deactivate.call(this)},t}(a.Plugin);t.ViewPlugin=u},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var u=n(1),c=n(0);t.managerMethods=["getProfile","updateProfile","activatePlugin","deactivatePlugin","isActive","canCall"];var l=function(e){function n(n){void 0===n&&(n=u.pluginManagerProfile);var r=e.call(this,n)||this;return r.profiles={},r.actives=[],r.methods=t.managerMethods,r.profiles[n.name]=n,r}return i(n,e),Object.defineProperty(n.prototype,"requestFrom",{get:function(){return this.currentRequest?this.currentRequest.from:"manager"},enumerable:!0,configurable:!0}),n.prototype.getProfile=function(e){return s(this,void 0,void 0,function(){return a(this,function(t){return[2,this.profiles[e]]})})},n.prototype.updateProfile=function(e){if(e){if(e.name&&e.name!==this.requestFrom)throw new Error("A plugin cannot change its name.");var t=this.requestFrom;if(!this.profiles[t])throw new Error("Plugin "+t+" is not register, you cannot update it's profile.");if(e.url&&e.url!==this.profiles[t].url)throw new Error("Url from Profile cannot be updated.");this.profiles[t]=o(o({},this.profiles[t]),e),this.emit("profileUpdated",this.profiles[t])}},n.prototype.addProfile=function(e){if(this.profiles[e.name])throw new Error("Plugin "+e.name+" already exist");this.profiles[e.name]=e,this.emit("profileAdded",e),this.onProfileAdded&&this.onProfileAdded(e)},n.prototype.isActive=function(e){return s(this,void 0,void 0,function(){return a(this,function(t){return[2,this.actives.includes(e)]})})},n.prototype.activatePlugin=function(e){return s(this,void 0,void 0,function(){var t,n=this;return a(this,function(r){return t=function(e){return s(n,void 0,void 0,function(){var t,n,r;return a(this,function(i){switch(i.label){case 0:return[4,this.isActive(e)];case 1:return i.sent()?[2]:[4,Promise.all([this.getProfile(e),this.getProfile(this.requestFrom)])];case 2:return t=i.sent(),n=t[0],r=t[1],[4,this.canActivate(r,n)];case 3:return i.sent()?[4,this.toggleActive(e)]:[3,5];case 4:return i.sent(),[3,6];case 5:throw new Error("Plugin "+this.requestFrom+" has no right to activate plugin "+e);case 6:return[2]}})})},[2,Array.isArray(e)?Promise.all(e.map(t)):t(e)]})})},n.prototype.deactivatePlugin=function(e){return s(this,void 0,void 0,function(){var t,n=this;return a(this,function(r){return t=function(e){return s(n,void 0,void 0,function(){var t,n,r;return a(this,function(i){switch(i.label){case 0:return[4,this.isActive(e)];case 1:return i.sent()?[4,Promise.all([this.getProfile(e),this.getProfile(this.requestFrom)])]:[2];case 2:return t=i.sent(),n=t[0],r=t[1],[4,this.canDeactivate(r,n)];case 3:return i.sent()?[4,this.toggleActive(e)]:[3,5];case 4:return i.sent(),[3,6];case 5:throw new Error("Plugin "+this.requestFrom+" has no right to deactivate plugin "+e);case 6:return[2]}})})},[2,Array.isArray(e)?Promise.all(e.map(t)):t(e)]})})},n.prototype.toggleActive=function(e){return s(this,void 0,void 0,function(){var t,n=this;return a(this,function(r){return t=function(e){return s(n,void 0,void 0,function(){var t,n,r;return a(this,function(i){switch(i.label){case 0:return[4,Promise.all([this.isActive(e),this.getProfile(e)])];case 1:return t=i.sent(),n=t[0],r=t[1],n?[4,this.engineDeactivatePlugin(e)]:[3,3];case 2:return i.sent(),this.actives=this.actives.filter(function(t){return t!==e}),this.emit("pluginDeactivated",r),this.onPluginDeactivated&&this.onPluginDeactivated(r),[3,5];case 3:return[4,this.engineActivatePlugin(e)];case 4:i.sent(),this.actives.push(e),this.emit("pluginActivated",r),this.onPluginActivated&&this.onPluginActivated(r),i.label=5;case 5:return[2]}})})},[2,Array.isArray(e)?Promise.all(e.map(t)):t(e)]})})},n.prototype.canActivate=function(e,t){return s(this,void 0,void 0,function(){return a(this,function(e){return[2,!0]})})},n.prototype.canDeactivate=function(e,t){return s(this,void 0,void 0,function(){return a(this,function(t){return"manager"===e.name?[2,!0]:[2,!1]})})},n.prototype.canCall=function(e,t,n,r){return s(this,void 0,void 0,function(){return a(this,function(e){return[2,!0]})})},n}(c.Plugin);t.PluginManager=l},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}u((r=r.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},u=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r};Object.defineProperty(t,"__esModule",{value:!0});var c=n(0);function l(e){var n=e.url,r=e.name,i=Object.keys(t.defaultGateways).find(function(e){return n.startsWith(e)});return i?t.defaultGateways[i](n,r):n}t.defaultGateways={"ipfs://":function(e,t){return"https://"+t+".dyn.plugin.remixproject.org/ipfs/"+e.replace("ipfs://","")},"swarm://":function(e,t){return"https://swarm-gateways.net/bzz-raw://"+e.replace("swarm://","")}},t.transformUrl=l;var f=function(e){function t(t){var n=e.call(this,t)||this;return n.id=0,n.pendingRequest={},n}return i(t,e),t.prototype.activate=function(){var e=this.options.transformUrl?this.options.transformUrl(this.profile):l(this.profile);this.connect(e)},t.prototype.deactivate=function(){this.loaded=!1,this.disconnect(),e.prototype.deactivate.call(this)},t.prototype.setOptions=function(t){void 0===t&&(t={}),e.prototype.setOptions.call(this,t)},t.prototype.callPluginMethod=function(e,t){var n=this;void 0===t&&(t=[]);var r=this.id++,i=this.currentRequest,o=this.name,s=new Promise(function(e,t){n.pendingRequest[r]=function(n,r){return r?t(r):e(n)}});return this.send({id:r,action:"request",key:e,payload:t,requestInfo:i,name:o}),s},t.prototype.handshake=function(){return s(this,void 0,void 0,function(){var e;return a(this,function(t){switch(t.label){case 0:return this.loaded?[3,2]:[4,this.callPluginMethod("handshake",[this.profile.name])];case 1:e=t.sent(),this.call("manager","updateProfile",this.profile),this.loaded=!0,e&&(this.profile.methods=e),t.label=2;case 2:return[2]}})})},t.prototype.getMessage=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,s,c,l,f,h,p,d,v=this;return a(this,function(a){switch(a.label){case 0:if("request"===e.action&&"handshake"===e.key)return[2,this.handshake()];switch(e.action){case"on":case"listen":return[3,1];case"off":return[3,2];case"once":return[3,3];case"emit":case"notification":return[3,4];case"call":case"request":return[3,5];case"response":return[3,10]}return[3,11];case 1:return t=e.name,n=e.key,"notification",this.on(t,n,function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return v.send({action:"notification",name:t,key:n,payload:e})}),[3,12];case 2:return r=e.name,i=e.key,this.off(r,i),[3,12];case 3:return s=e.name,c=e.key,"notification",this.once(s,c,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return v.send({action:"notification",name:s,key:c,payload:e})}),[3,12];case 4:return e.payload?(this.emit.apply(this,u([e.key],e.payload)),[3,12]):[3,12];case 5:l="response",a.label=6;case 6:return a.trys.push([6,8,,9]),[4,this.call.apply(this,u([e.name,e.key],e.payload))];case 7:return p=a.sent(),d=void 0,this.send(o(o({},e),{action:l,payload:p,error:d})),[3,9];case 8:return f=a.sent(),p=void 0,d=f.message,this.send(o(o({},e),{action:l,payload:p,error:d})),[3,9];case 9:return[3,12];case 10:return h=e.id,p=e.payload,d=e.error,this.pendingRequest[h](p,d),delete this.pendingRequest[h],[3,12];case 11:throw new Error("Message should be a notification, request or response");case 12:return[2]}})})},t}(c.Plugin);t.PluginConnector=f}])}); |
export * from './utils' | ||
export * from './engine' | ||
export * from './engine' |
@@ -5,2 +5,3 @@ import { MethodKey, Api, ApiMap, EventKey } from './api'; | ||
name: string; | ||
displayName?: string; | ||
methods?: MethodKey<T>[]; | ||
@@ -7,0 +8,0 @@ permission?: boolean; |
{ | ||
"name": "@remixproject/engine", | ||
"version": "0.3.0-alpha.2", | ||
"version": "0.3.0-alpha.3", | ||
"description": "Plugin Engine that power Remix IDE", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
@@ -20,3 +20,12 @@ # Engine | ||
## Connectors | ||
Connectors wrap a connection between the engine & an external plugin. | ||
Examples of connectors: | ||
- Iframe | ||
- ChildProcess | ||
- Websocket | ||
See [how to create your own connector](doc/connector/readme). | ||
## Getting started | ||
@@ -23,0 +32,0 @@ ``` |
144133
1349
141