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

@wixc3/engine-core

Package Overview
Dependencies
Maintainers
146
Versions
333
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wixc3/engine-core - npm Package Compare versions

Comparing version 8.2.9 to 8.2.13

2

cjs/communication.feature.d.ts

@@ -17,3 +17,3 @@ import { Communication } from './com/communication';

maxLogMessages: number;
publicPath: string;
publicPath?: string;
}

@@ -20,0 +20,0 @@ declare const _default: Feature<"COM", any[], {

@@ -21,4 +21,3 @@ "use strict";

topology: {},
resolvedContexts: {},
publicPath: '/'
resolvedContexts: {}
}, (a, b) => (Object.assign(Object.assign(Object.assign({}, a), b), { topology: Object.assign(Object.assign({}, a.topology), b.topology), resolvedContexts: Object.assign(Object.assign({}, a.resolvedContexts), b.resolvedContexts) }))),

@@ -25,0 +24,0 @@ loggerTransports: slot_1.Slot.withType().defineEntity(env_1.Universal),

@@ -23,4 +23,5 @@ import { RuntimeEngine } from './runtime-engine';

envName: string;
publicPath?: string;
}
export declare function runEngineApp({ featureName, featureLoaders, config, options, envName }: IRunEngineAppOptions): Promise<{
export declare function runEngineApp({ featureName, featureLoaders, config, options, envName, publicPath }: IRunEngineAppOptions): Promise<{
dispose(): Promise<void>;

@@ -27,0 +28,0 @@ }>;

@@ -14,3 +14,3 @@ "use strict";

exports.getFeaturesDeep = (feature) => helpers_1.flattenTree(feature, f => f.dependencies);
async function runEngineApp({ featureName, featureLoaders, config = [], options, envName }) {
async function runEngineApp({ featureName, featureLoaders, config = [], options, envName, publicPath }) {
const featureNames = Object.keys(featureLoaders);

@@ -27,3 +27,3 @@ const rootFeatureLoader = featureName && featureLoaders[featureName];

const [runningFeature] = allFeatures;
const engine = new runtime_engine_1.RuntimeEngine([communication_feature_1.default.use({ config: { resolvedContexts } }), ...config], options).run(runningFeature, envName);
const engine = new runtime_engine_1.RuntimeEngine([communication_feature_1.default.use({ config: { resolvedContexts, publicPath } }), ...config], options).run(runningFeature, envName);
return {

@@ -30,0 +30,0 @@ async dispose() {

{
"name": "@wixc3/engine-core",
"version": "8.2.9",
"version": "8.2.13",
"main": "cjs/index.js",

@@ -5,0 +5,0 @@ "types": "cjs/index.d.ts",

@@ -21,3 +21,3 @@ import { BaseHost } from './com/base-host';

maxLogMessages: number;
publicPath: string;
publicPath?: string;
}

@@ -34,4 +34,3 @@

topology: {},
resolvedContexts: {},
publicPath: '/'
resolvedContexts: {}
},

@@ -38,0 +37,0 @@ (a: IComConfig, b: Partial<IComConfig>) => ({

@@ -32,2 +32,3 @@ import COM from './communication.feature';

envName: string;
publicPath?: string;
}

@@ -40,3 +41,4 @@

options,
envName
envName,
publicPath
}: IRunEngineAppOptions) {

@@ -58,3 +60,3 @@ const featureNames = Object.keys(featureLoaders);

const engine = new RuntimeEngine([COM.use({ config: { resolvedContexts } }), ...config], options).run(
const engine = new RuntimeEngine([COM.use({ config: { resolvedContexts, publicPath } }), ...config], options).run(
runningFeature,

@@ -61,0 +63,0 @@ envName

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

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("socket.io-client")):"function"==typeof define&&define.amd?define(["socket.io-client"],e):"object"==typeof exports?exports.EngineCore=e(require("socket.io-client")):t.EngineCore=e(t.io)}(globalThis,(function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=28)}([function(t,e,n){"use strict";n.d(e,"f",(function(){return r})),n.d(e,"c",(function(){return i})),n.d(e,"d",(function(){return s})),n.d(e,"b",(function(){return o})),n.d(e,"e",(function(){return a})),n.d(e,"h",(function(){return c})),n.d(e,"g",(function(){return u})),n.d(e,"a",(function(){return d}));const r=Symbol("RUN"),i=Symbol("DISPOSE"),s=Symbol("IDENTIFY_API"),o=Symbol("CREATE"),a=Symbol("REGISTER_VALUE"),c=Symbol("SERVICE_CONFIG"),u=Symbol("RUN_OPTIONS"),d=Symbol("CONFIGURABLE")},function(t,e,n){"use strict";n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return s})),n.d(e,"f",(function(){return o})),n.d(e,"a",(function(){return a})),n.d(e,"d",(function(){return c})),n.d(e,"h",(function(){return u})),n.d(e,"e",(function(){return d})),n.d(e,"k",(function(){return l})),n.d(e,"l",(function(){return h})),n.d(e,"g",(function(){return f})),n.d(e,"j",(function(){return p})),n.d(e,"i",(function(){return g}));var r=n(6);class i{constructor(t,e,n){this.env=t,this.envType=e,this.endpointType=n}}class s{constructor(t,e,n){this.env=t,this.activeEnvironmentName=e,this.runtimeEnvType=n}}const o=new i("<Universal>","window","multi"),a=new i("<All>","window","multi"),c=new i("<None>","window","multi"),u=new Set([o.env,a.env]);class d extends i{constructor(t,e){if(super(t,"context","single"),this.environments=e,0===e.length)throw new Error(`Contextual Environment ${t} initiated without child environments`)}useContext(t){return new s(this.env,t,this.getEnvironmentById(t).envType)}withContext(){return{type:Object(r.a)(this.env+" context")}}getEnvironmentById(t){return this.environments.find(({env:e})=>e===t)}}function l(t){const e=new Set;if(Array.isArray(t))for(const n of t)e.add(n.env);else"string"==typeof t?e.add(t):e.add(t.env);return e}function h(t,e){const n=new Set,r=t=>{e.has(t)?n.add(t):e.add(t)};if(Array.isArray(t))for(const e of t)r(e.env);else r("string"==typeof t?t:t.env);return[...n]}function f(t){return"string"==typeof t?t:t.env}function p(t,e){return Array.isArray(t)?t.some(t=>e.has(t.env)):"string"==typeof t?e.has(t):e.has(t.env)}function g(t){return p(t,u)}},function(t,e,n){"use strict";function r(){let t,e;return{promise:new Promise((n,r)=>{t=n,e=r}),resolve:t,reject:e}}class i{constructor(){this.map=new Map}get size(){return Array.from(this.map.values()).map(({size:t})=>t).reduce((t,e)=>t+e,0)}get(t){return this.map.get(t)}add(t,e){const n=this.map.get(t);return n?n.add(e):this.map.set(t,new Set([e])),this}clear(){this.map.clear()}delete(t,e){const n=this.map.get(t);if(n){const r=n.delete(e);return 0===n.size&&this.map.delete(t),r}return!1}deleteKey(t){return this.map.delete(t)}has(t,e){const n=this.map.get(t);return!!n&&n.has(e)}hasKey(t){const e=this.map.get(t);return!!e&&e.size>0}[Symbol.iterator](){return this.entries()}*entries(){const{map:t}=this;for(const[e,n]of t.entries())for(const t of n)yield[e,t]}*values(){const{map:t}=this;for(const e of t.values())for(const t of e)yield t}keys(){return this.map.keys()}}class s{constructor(){this.listeners=new i,this.listenersOnce=new i}on(t,e){this.listeners.add(t,e)}subscribe(t,e){this.on(t,e)}once(t,e){this.listenersOnce.add(t,e)}off(t,e){this.listeners.delete(t,e),this.listenersOnce.delete(t,e)}unsubscribe(t,e){this.off(t,e)}emit(t,e){const n=this.listeners.get(t);if(n)for(const t of n)t(e);const r=this.listenersOnce.get(t);if(r){for(const t of r)t(e);this.listenersOnce.deleteKey(t)}}clear(){this.listeners.clear(),this.listenersOnce.clear()}}const o=()=>!0;function a(t,e,n=o){const r=new Set,i=new Set,s=[t];for(;s.length;){const t=s.shift();i.has(t)||(i.add(t),n(t)&&r.add(t),s.push(...e(t)))}return r}n.d(e,"c",(function(){return r})),n.d(e,"a",(function(){return s})),n.d(e,"b",(function(){return i})),n.d(e,"e",(function(){return o})),n.d(e,"d",(function(){return a}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r;n(0);!function(t){t[t.DEBUG=0]="DEBUG",t[t.INFO=1]="INFO",t[t.WARN=2]="WARN",t[t.ERROR=3]="ERROR"}(r||(r={}))},function(t,e,n){"use strict";n.d(e,"b",(function(){return r})),n.d(e,"c",(function(){return i})),n.d(e,"h",(function(){return s})),n.d(e,"j",(function(){return o})),n.d(e,"a",(function(){return a})),n.d(e,"f",(function(){return c})),n.d(e,"g",(function(){return u})),n.d(e,"d",(function(){return d})),n.d(e,"i",(function(){return l})),n.d(e,"e",(function(){return h})),n.d(e,"k",(function(){return f}));const r=(t,e)=>`Could not register same id ${t} as ${e}`,i=t=>`Com with id "${t}" is already running.`,s=t=>`Remote call failed with error: "${t.error}" from "${t.from}"`,o=t=>`Unknown callback id "${t.callbackId}" in message:\n${JSON.stringify(t)}`,a=(t,e,n)=>`Callback timeout "${t}" at ${e} on message:\n${JSON.stringify(n)}`,c=(t,e)=>`Destination environment ${t} is not registered. available environments: [${e}]`,u=t=>`Not implemented forward for ${t.type}`,d=(t,e)=>`Missing communication context for "${t}" when ${e}`,l=t=>`Environment with id ${t} can only spawned once`,h=(t,e)=>`Missing ${t} when trying to get remote service api proxy for ${e}`;function f(t){console.error(t)}},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(6),i=n(0);class s{constructor(t,e){this.providedFrom=t,this.visibleAt=e,this.mode="input",this.type=Object(r.a)(),this.proxyType=Object(r.a)(),this.remoteAccess=!1}[i.e](t,e,n,r,i){return n}}},function(t,e,n){"use strict";function r(t){return Symbol(t)}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(0),i=n(1),s=n(17);class o extends s.a{constructor(t,e,n,r={}){super(t,e,n),this.providedFrom=t,this.visibleAt=e,this.remoteAccess=n,this.options=r}static withType(){return{defineEntity:t=>new o(t,t,!1)}}allowRemoteAccess(t){return new o(this.providedFrom,i.a,!0,t)}[r.e](t,e,n,r,s){if(this.remoteAccess){const{communication:o}=t.getCOM().api,a=t.entityID(r,s),c=Object(i.k)(this.providedFrom),u=o.getEnvironmentName();if(c.has(u)||c.has(i.f.env)){if(!e)throw new Error("service is not provide in runtime");o.registerAPI({id:a},e)}return n||this.getApiProxy(t,a)}return e}[r.b](t,e,n){if(this.remoteAccess)return this.getApiProxy(t,t.entityID(e,n))}getApiProxy(t,e){const{communication:n}=t.getCOM().api,r=function(t){if(function(t){return t&&t.endpointType&&"single"===t.endpointType}(t))return t.env}(this.providedFrom);return r?n.apiProxy({id:r},{id:e},this.options):{get(t){return n.apiProxy(t,{id:e},this.options)}}}}},function(t,e,n){"use strict";(function(t){var r=n(9),i=n(12),s=n(14),o=n(15),a=n(1),c=n(16),u=n(7),d=n(18),l=n(0),h=n(3);e.a=new c.a({id:"COM",api:{config:o.a.withType().defineEntity({id:"",loggerSeverity:h.a.DEBUG,maxLogMessages:100,topology:{},resolvedContexts:{},publicPath:"/"},(t,e)=>Object.assign(Object.assign(Object.assign({},t),e),{topology:Object.assign(Object.assign({},t.topology),e.topology),resolvedContexts:Object.assign(Object.assign({},t.resolvedContexts),e.resolvedContexts)})),loggerTransports:d.b.withType().defineEntity(a.f),loggerService:u.a.withType().defineEntity(a.f),spawn:u.a.withType().defineEntity(a.a),manage:u.a.withType().defineEntity(a.a),connect:u.a.withType().defineEntity(a.a),spawnOrConnect:u.a.withType().defineEntity(a.a),communication:u.a.withType().defineEntity(a.a)}}).setup(a.f,({config:{host:e,id:n,topology:o,maxLogMessages:a,loggerSeverity:c,logToConsole:u,resolvedContexts:d,publicPath:h},loggerTransports:f,[l.g]:p})=>{const g=void 0!==t&&"browser"!==t.title,m=n||e&&e.name||"undefined"!=typeof self&&self.name||"main",v={warnOnSlow:p.has("warnOnSlow"),publicPath:h},b=new i.a(g?e||new r.a:self,m,o,d,g,v);return{loggerService:new s.a(f,{environment:b.getEnvironmentId()},{severity:c,maxLogMessages:a,logToConsole:u}),communication:b,spawn:b.spawn.bind(b),connect:b.connect.bind(b),spawnOrConnect:b.spawnOrConnect.bind(b),manage:b.manage.bind(b)}})}).call(this,n(29))},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));class r{constructor(){this.name="base-host",this.parent=null,this.handlers=new Map}addEventListener(t,e,n){const r=this.handlers.get(t);r?r.add(e):this.handlers.set(t,new Set([e]))}removeEventListener(t,e,n){const r=this.handlers.get(t);r&&r.delete(e)}postMessage(t){this.emitMessageHandlers(t)}open(){const t=new r;return t.parent=this,t}emitMessageHandlers(t){for(const e of this.handlers.get("message")||[])e({data:t})}}},function(t,e,n){"use strict";function r(t){return"undefined"!=typeof Worker&&t instanceof Worker||"undefined"!=typeof WorkerGlobalScope&&t instanceof WorkerGlobalScope}function i(t){return"undefined"!=typeof Window&&t instanceof Window}function s(t){return"undefined"!=typeof HTMLIFrameElement&&t instanceof HTMLIFrameElement}n.d(e,"d",(function(){return r})),n.d(e,"c",(function(){return i})),n.d(e,"b",(function(){return s})),n.d(e,"a",(function(){return o}));class o{constructor(){this.ids={}}next(t){return this.ids[t]=this.ids[t]||0,t+this.ids[t]++}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(8),i=n(0);class s{constructor(t=[],e=new Map){this.runOptions=e,this.features=new Map,this.running=!1,this.topLevelConfigMap=this.createConfigMap(t)}get(t){const e=this.features.get(t);if(e)return e;throw new Error("missing feature")}run(t,e){if(this.running)throw new Error("Engine already running!");this.running=!0,Array.isArray(t)||(t=[t]);for(const n of t)this.initFeature(n,e);for(const n of t)this.runFeature(n,e);return this}initFeature(t,e){let n=this.features.get(t);return n||(n=t[i.b](this,e)),n}runFeature(t,e){const n=this.features.get(t);if(!n)throw new Error("Could not find running feature: "+t.id);n[i.f](this,e)}async dispose(t,e){const n=this.features.get(t);n&&(await n[i.c](this,e),this.features.delete(t))}getTopLevelConfig(t,e){return this.topLevelConfigMap[this.entityID(t,e)]||[]}entityID(t,e){return`${t}.${e}`}getCOM(){return this.get(r.a)}createConfigMap(t){const e={};for(const[n,r]of t)for(const[t,i]of Object.entries(r)){const r=this.entityID(n,t);e[r]=e[r]||[],e[r].push(i)}return e}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return u})),n.d(e,"b",(function(){return p}));var r=n(4),i=n(10),s=n(0),o=n(2),a=n(9),c=n(13);class u{constructor(t,e,n={},s={},a=!1,c){this.topology=n,this.resolvedContexts=s,this.isServer=a,this.idsCounter=new i.a,this.callbackTimeout=12e4,this.slowThreshold=5e3,this.callbacks={},this.environments={},this.pendingEnvs=new Map,this.pendingMessages=new o.b,this.handlers=new Map,this.eventDispatchers={},this.apis={},this.apisOverrides={},this.handleEvent=({data:t})=>{this.handleMessage(t).catch(r.k)},this.options=Object.assign({warnOnSlow:!1,publicPath:""},c),this.rootEnvId=e,this.rootEnvName=e.split("/")[0],this.registerMessageHandler(t),this.registerEnv(e,t),this.environments["*"]={id:e,host:t},this.post(this.getPostEndpoint(t),{type:"ready",from:e,to:"*",origin:e})}registerEnv(t,e){if(this.environments[t])throw new Error(Object(r.b)(t,"Environment"));this.environments[t]={id:t,host:e}}registerAPI({id:t},e){if(this.apis[t])throw new Error(Object(r.b)(t,"RemoteService"));return this.apis[t]=e,this.applyApiDirectives(t,e),e}async spawnOrConnect(t){const e=this.resolvedContexts[t.env],n=t.environments.find(t=>t.env===e);return n.env=t.env,"node"===n.envType?this.connect(n):this.spawn(n)}getEnvironmentContext(t){return this.resolvedContexts[t.env]}async spawn(t,e){const{endpointType:n,env:r,envType:i}=t,s="single"===n?r:this.generateEnvInstanceID(r);return await("worker"===i?this.useWorker(d(r,s,this.options.publicPath),s):this.useWindow(e,s,l(r,s,this.options.publicPath))),{id:s}}async manage(t,e,n){const{endpointType:r,env:i}=t,s="single"===r?i:this.generateEnvInstanceID(i);return await this.useIframe(e,s,h(i,s,this.options.publicPath,n)),{id:s}}async useIframe(t,e,n){const i=t.contentWindow;if(!i)throw new Error("cannot spawn detached iframe.");await this.changeLocation(i,t,e,n);const s=`${this.rootEnvId}__${e}_`,o=async()=>{for(const t of this.handlers.keys())t.startsWith(s)&&await this.reconnectHandler(e,this.parseHandlerId(t,s))};t.addEventListener("load",()=>{this.envReady(e).then(o).catch(r.k)}),this.registerEnv(e,i),await this.envReady(e)}async connect(t){const{env:e,envType:n}=t,r=this.topology[e];if(!r)throw new Error(`Could not find ${n} topology for ${e}`);const i=e,s=new c.a(r);return this.registerMessageHandler(s),this.registerEnv(i,s),await s.connected,{id:i,onDisconnect:t=>{s.subscribers.listeners.add("disconnect",t)}}}apiProxy(t,{id:e},n={}){return new Proxy(Object.create(null),{get:(r,i)=>{if("string"==typeof i){let s=r[i];return s||(s=async(...r)=>this.callMethod((await t).id,e,i,r,this.rootEnvId,n),r[i]=s),s}}})}registerMessageHandler(t){t.addEventListener("message",this.handleEvent,!0)}generateEnvInstanceID(t){return this.idsCounter.next(`${t}/`)}callMethod(t,e,n,r,i,s){return new Promise((o,a)=>{var c,u;const d=(null===(c=s[n])||void 0===c?void 0:c.emitOnly)?void 0:this.idsCounter.next("c");if(this.isListenCall(r)||(null===(u=s[n])||void 0===u?void 0:u.removeAllListeners))this.addOrRemoveListener(t,e,n,d,i,s,r[0],o,a);else{const s={to:t,from:this.rootEnvId,type:"call",data:{api:e,method:n,args:r},callbackId:d,origin:i};this.callWithCallback(t,s,d,o,a)}})}async handleMessage(t){const e=this.environments[t.to];if(e)if(e.id===this.rootEnvId)switch(t.type){case"call":await this.handleCall(t);break;case"callback":this.handleCallback(t);break;case"event":this.handleEventMessage(t);break;case"listen":await this.handleListen(t);break;case"unlisten":await this.handleUnListen(t);break;case"ready":this.handleReady(t)}else await this.forwardMessage(t,e);else this.unhandledMessage(t)}async useWorker(t,e){this.registerMessageHandler(t),this.registerEnv(e,t),await this.envReady(e)}async useWindow(t,e,n){const r=Object(i.b)(t)?t.contentWindow:t;if(!r)throw new Error("cannot spawn detached iframe.");await this.injectScript(r,e,n),this.registerEnv(e,r),await this.envReady(e)}dispose(){for(const{host:t}of Object.values(this.environments))t.removeEventListener("message",this.handleEvent,!0)}getEnvironmentId(){return this.rootEnvId}getEnvironmentName(){return this.rootEnvName}parseHandlerId(t,e){const[n,r]=t.slice(e.length).split("@");return{api:n,method:r,handlerId:t}}reconnectHandler(t,e){return new Promise((n,r)=>{const i={to:t,from:this.rootEnvId,type:"listen",data:e,callbackId:this.idsCounter.next("c"),origin:this.rootEnvId};this.createCallbackRecord(i,i.callbackId,n,r),this.sendTo(t,i)})}applyApiDirectives(t,e){const n=e[s.h];if(n){this.apisOverrides[t]={};for(const r of Object.keys(n)){const i=n[r](e);i.proxyFunction&&(this.apisOverrides[t][r]=i.proxyFunction)}}}envReady(t){return new Promise(e=>{this.pendingEnvs.set(t,()=>e())})}async forwardMessage(t,e){if("call"!==t.type)throw new Error(Object(r.g)(t));{const n=await this.callMethod(e.id,t.data.api,t.data.method,t.data.args,t.origin,{});t.callbackId&&this.sendTo(t.from,{from:t.to,type:"callback",to:t.from,data:n,callbackId:t.callbackId,origin:t.to})}}changeLocation(t,e,n,r){return new Promise((i,s)=>{t.name=n;const o=()=>{e.removeEventListener("load",o),i()};e.addEventListener("load",o),e.addEventListener("error",()=>s()),t.location.href=r})}apiCall(t,e,n,r){return this.apisOverrides[e]&&this.apisOverrides[e][n]?this.apisOverrides[e][n](t,...r):this.apis[e][n](...r)}unhandledMessage(t){}addOrRemoveListener(t,e,n,r,i,s,o,a,c){var u,d,l,h;const f=(null===(u=s[n])||void 0===u?void 0:u.removeAllListeners)||(null===(d=s[n])||void 0===d?void 0:d.removeListener);if(f){const u=this.getHandlerId(t,e,f),d=this.handlers.get(u);if(!d)throw new Error("Cannot Remove handler "+u);if(null===(l=s[n])||void 0===l?void 0:l.removeListener){const t=d.indexOf(o);-1!==t&&d.splice(t,1)}else d.length=0;if(0===d.length){const s={to:t,from:this.rootEnvId,type:"unlisten",data:{api:e,method:n,handlerId:u},callbackId:r,origin:i};this.callWithCallback(t,s,r,a,c)}else a()}else{if(null===(h=s[n])||void 0===h||!h.listener)throw new Error(`cannot add listenr to unconfigured method ${e} ${n}`);{const s=this.handlers.get(this.getHandlerId(t,e,n));if(s&&0!==s.length)s.push(o),a();else{const s={to:t,from:this.rootEnvId,type:"listen",data:{api:e,method:n,handlerId:this.createHandlerRecord(t,e,n,o)},callbackId:r,origin:i};this.callWithCallback(t,s,r,a,c)}}}}callWithCallback(t,e,n,r,i){this.sendTo(t,e),n?this.createCallbackRecord(e,e.callbackId,r,i):r()}sendTo(t,e){const n=this.resolveMessageTarget(t);if(!n)throw new Error(Object(r.f)(t,Object.keys(this.environments)));this.pendingEnvs.get(t)?this.pendingMessages.add(t,()=>this.post(n,e)):this.post(n,e)}post(t,e){Object(i.d)(t)?t.postMessage(e):t.postMessage(e,"*")}resolveMessageTarget(t){let e=this.environments[t];if(e&&e.id!==this.rootEnvId)return e.host;{e||(e=this.environments[this.rootEnvId]);const t=e.host;return t instanceof a.a?t.parent||t:this.getPostEndpoint(t)}}getPostEndpoint(t){return Object(i.c)(t)?t.opener||t.parent:t}handleEventMessage(t){const e=this.handlers.get(t.handlerId);if(e)for(const n of e)n(...t.data)}handleReady({from:t}){const e=this.pendingEnvs.get(t);if(e){this.pendingEnvs.delete(t);const n=this.pendingMessages.get(t);if(n){for(const t of n)t();this.pendingMessages.deleteKey(t)}e()}}async handleUnListen(t){const e=this.eventDispatchers[t.data.handlerId];if(e){delete this.eventDispatchers[t.data.handlerId];const n=await this.apiCall(t.origin,t.data.api,t.data.method,[e]);t.callbackId&&this.sendTo(t.from,{to:t.from,from:this.rootEnvId,type:"callback",data:n,callbackId:t.callbackId,origin:this.rootEnvId})}}async handleListen(t){try{const e=this.eventDispatchers[t.data.handlerId]||this.createDispatcher(t.from,t),n=await this.apiCall(t.origin,t.data.api,t.data.method,[e]);t.callbackId&&this.sendTo(t.from,{to:t.from,from:this.rootEnvId,type:"callback",data:n,callbackId:t.callbackId,origin:this.rootEnvId})}catch(e){this.sendTo(t.from,{to:t.from,from:this.rootEnvId,type:"callback",error:String(e),callbackId:t.callbackId,origin:this.rootEnvId})}}async handleCall(t){try{const e=await this.apiCall(t.origin,t.data.api,t.data.method,t.data.args);t.callbackId&&this.sendTo(t.from,{to:t.from,from:this.rootEnvId,type:"callback",data:e,callbackId:t.callbackId,origin:this.rootEnvId})}catch(e){this.sendTo(t.from,{to:t.from,from:this.rootEnvId,type:"callback",error:String(e.stack),callbackId:t.callbackId,origin:this.rootEnvId})}}handleCallback(t){const e=t.callbackId?this.callbacks[t.callbackId]:null;if(e)t.error?e.reject(new Error(Object(r.h)(t))):e.resolve(t.data);else if(t.callbackId)throw new Error(Object(r.j)(f(t)))}createDispatcher(t,e){const n=e.data.handlerId;return this.eventDispatchers[n]=(...n)=>{this.sendTo(t,{to:t,from:this.rootEnvId,type:"event",data:n,handlerId:e.data.handlerId,origin:this.rootEnvId})}}isListenCall(t){return"function"==typeof t[0]&&1===t.length}getHandlerId(t,e,n){return`${this.rootEnvId}__${t}_${e}@${n}`}createHandlerRecord(t,e,n,r){const i=this.getHandlerId(t,e,n),s=this.handlers.get(i);return s?s.push(r):this.handlers.set(i,[r]),i}createCallbackRecord(t,e,n,i){const s=t=>{delete this.callbacks[e],i(t)};this.options.warnOnSlow&&setTimeout(()=>{this.callbacks[e]&&console.error(Object(r.a)(e,this.rootEnvId,f(t)))},this.slowThreshold);const o=setTimeout(()=>{s(new Error(Object(r.a)(e,this.rootEnvId,f(t))))},this.callbackTimeout);this.callbacks[e]={timerId:o,resolve:t=>{delete this.callbacks[e],clearTimeout(o),n(t)},reject:s}}injectScript(t,e,n){return new Promise((r,i)=>{t.name=e;const s=t.document.createElement("script");s.src=n,s.onload=()=>r(t),s.onerror=t=>i(t),t.document.head.appendChild(s)})}}const d=(t,e,n="")=>new Worker(`${n}${t}.webworker.js${location.search}`,{name:e}),l=(t,e,n="")=>`${n}${t}.web.js${location.search}`,h=(t,e,n="",r)=>`${n}${t}.html${location.search}${null!=r?r:""}`,f=t=>{if("call"===(t=Object.assign({},t)).type||"callback"===t.type){const{data:e}=t;e&&e.args&&(e.args=void 0)}return t};function p(t,e,n){if("string"!=typeof t)throw"onMethod ref must be a string";return Object.assign({[t]:{listener:!0},[e]:{removeListener:t}},n?{[n]:{removeAllListeners:t}}:void 0)}},function(t,e,n){"use strict";n.d(e,"a",(function(){return a}));var r=n(27),i=n.n(r),s=n(9),o=n(2);class a extends s.a{constructor(t){super(),this.subscribers=new o.a;const{promise:e,resolve:n}=Object(o.c)();this.connected=e,this.socketClient=i.a.connect(t),this.socketClient.on("connect",()=>{n(),this.socketClient.on("message",t=>{this.emitMessageHandlers(t)})}),this.socketClient.on("disconnect",()=>{this.subscribers.emit("disconnect",void 0),this.socketClient.close()})}postMessage(t){this.socketClient.emit("message",t)}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(2),i=n(3);class s extends r.a{constructor(t=[],e={},n={severity:i.a.DEBUG}){super(),this.transports=t,this.baseMetadata=e,this.config=n,this.messages=[],this.debug=t=>this.log(t,i.a.DEBUG),this.info=t=>this.log(t,i.a.INFO),this.warn=t=>this.log(t,i.a.WARN),this.error=t=>this.log(t,i.a.ERROR)}getMessages(){return this.messages}logMessage(t){if(t.level>=this.config.severity){this.addToMessages(t),this.emit("message",t),this.config.logToConsole&&function({message:t,metadata:e={},level:n}){switch(n){case i.a.DEBUG:console.log(t,e);break;case i.a.INFO:console.info(t,e);break;case i.a.WARN:console.warn(t,e);break;case i.a.ERROR:console.error(t,e)}}(t);for(const e of this.transports)e.handleMessage(t)}}clearMessages(){this.messages=[]}log(t,e){const{value:n,metadata:r}=function(t){const e={value:""};if("function"==typeof t){const n=t();"string"==typeof n?e.value=n:(e.value=n.value,e.metadata=n.metadata||e.metadata)}else"string"==typeof t?e.value=t:(e.value=t.value,e.metadata=t.metadata);return e}(t);this.logMessage({message:n,timestamp:Date.now(),level:e,metadata:Object.assign({base:this.baseMetadata},r)})}addToMessages(t){this.messages.length+1>this.config.maxLogMessages&&this.messages.shift(),this.messages.push(t)}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(0),i=n(1),s=n(5);class o extends s.a{constructor(t,e=((t,e)=>Object.assign(Object.assign({},t),e)),n=i.a){super(i.a,n),this.defaultValue=t,this.mergeConfig=e}static withType(){return{defineEntity:(t,e,n)=>new o(t,e,n)}}[r.b](t,e,n){return t.getTopLevelConfig(e,n).reduce((t,e)=>this.mergeConfig(t,e),this.defaultValue)}[r.e](t,e,n,r,i){return n}}},function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"a",(function(){return a}));var r=n(0),i=n(1),s=n(2);class o{constructor(t,e,n){this.feature=t,this.api=e,this.dependencies=n,this.running=!1,this.runHandlers=new s.b,this.disposeHandlers=new s.b}addRunHandler(t,e){this.runHandlers.add(e,t)}addOnDisposeHandler(t,e){this.disposeHandlers.add(e,t)}[r.f](t,e){if(this.running)return;this.running=!0;for(const n of this.feature.dependencies)t.runFeature(n,e);const n=this.runHandlers.get(e)||[];for(const t of n)t()}async[r.c](t,e){for(const n of this.feature.dependencies)await t.dispose(n,e);const n=this.disposeHandlers.get(e)||new Set;for(const t of n)await t()}}class a{constructor(t){this.asEntity=this,this.environmentIml=new Set,this.setupHandlers=new s.b,this.contextHandlers=new Map,this.id=t.id,this.dependencies=t.dependencies||[],this.api=t.api||{},this.context=t.context||{},this.identifyApis()}setup(t,e){return function(t,e,n){const r=Object(i.l)(t,n);if(r.length)throw new Error(`Feature can only have single setup for each environment. ${e} Feature already implements: ${r}`)}(t,this.id,this.environmentIml),this.setupHandlers.add(Object(i.g)(t),e),this}use(t){return[this.id,t]}setupContext(t,e,n){return function(t,e,n){const r=n.get(t);if(r)throw new Error(`Feature can only have single setupContext for each context id. ${e} Feature already implements: ${String(t)}\n${r}`)}(e,this.id,this.contextHandlers),this.contextHandlers.set(e,n),this}[r.b](t,e){const n={},s={},a={},c={},u={},d={},l=Object.entries(this.api),h=l.filter(([t,e])=>"input"!==e.mode&&Object(i.i)(e.providedFrom)),f=new o(this,a,n);t.features.set(this,f);for(const r of this.dependencies)n[r.id]=t.initFeature(r,e),s[r.id]=n[r.id].api;for(const[e,n]of l){const i=n[r.b](t,this.id,e);void 0!==i&&(c[e]=i)}const p=Object.assign(Object.assign({},c),{id:this.id,run(t){f.addRunHandler(t,e)},onDispose(t){f.addOnDisposeHandler(t,e)},[r.g]:t.runOptions}),g={dispose:()=>{}};for(const[t,e]of this.contextHandlers){const n=e(s);d[t]=Object.assign(Object.assign({},g),n)}const m=[],v=this.setupHandlers.get("<Universal>"),b=this.setupHandlers.get("<All>"),y=this.setupHandlers.get(e);v&&m.push(...v),b&&m.push(...b),y&&m.push(...y);for(const t of m){const e=t(p,s,d);if(e){for(const[t]of h)p[t]=e[t];Object.assign(u,e)}}for(const[e,n]of l){const i=n[r.e](t,u[e],c[e],this.id,e);void 0!==i&&(a[e]=i)}return f}identifyApis(){for(const[t,e]of Object.entries(this.api)){const n=e[r.d];n&&n.call(e,this.id,t)}}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(6);n(0);class i{constructor(t,e,n){this.providedFrom=t,this.visibleAt=e,this.remoteAccess=n,this.mode="output",this.type=Object(r.a)(),this.proxyType=Object(r.a)()}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return s})),n.d(e,"b",(function(){return o}));var r=n(0),i=n(5);class s{constructor(){this.items=[],this.callbacks=new Set}register(t){this.items.push(t);for(const e of this.callbacks)e(t)}[Symbol.iterator](){return this.items[Symbol.iterator]()}subscribe(t){this.callbacks.add(t)}unSubscribe(t){this.callbacks.delete(t)}stream(t){for(const e of this)t(e);return this.subscribe(t),()=>this.unSubscribe(t)}}class o extends i.a{static withType(){return{defineEntity:t=>new o(t,t)}}[r.b](){return new s}}},function(t,e,n){"use strict";n.r(e);var r=n(9);n.d(e,"BaseHost",(function(){return r.a}));var i=n(12);n.d(e,"Communication",(function(){return i.a})),n.d(e,"decalreComEmitter",(function(){return i.b}));var s=n(4);n.d(e,"DUPLICATE_REGISTER",(function(){return s.b})),n.d(e,"GLOBAL_REF",(function(){return s.c})),n.d(e,"REMOTE_CALL_FAILED",(function(){return s.h})),n.d(e,"UNKNOWN_CALLBACK_ID",(function(){return s.j})),n.d(e,"CALLBACK_TIMEOUT",(function(){return s.a})),n.d(e,"MISSING_ENV",(function(){return s.f})),n.d(e,"MISSING_FORWARD_FOR_MESSAGE",(function(){return s.g})),n.d(e,"MISSING_COM_CONTEXT",(function(){return s.d})),n.d(e,"SPAWNED_MORE_THEN_ONCE",(function(){return s.i})),n.d(e,"MISSING_CONTEXT_FOR_API_PROXY",(function(){return s.e})),n.d(e,"reportError",(function(){return s.k}));var o=n(10);n.d(e,"isWorkerContext",(function(){return o.d})),n.d(e,"isWindow",(function(){return o.c})),n.d(e,"isIframe",(function(){return o.b})),n.d(e,"MultiCounter",(function(){return o.a}));var a=n(14);n.d(e,"LoggerService",(function(){return a.a}));var c=n(20);for(var u in c)["BaseHost","Communication","decalreComEmitter","DUPLICATE_REGISTER","GLOBAL_REF","REMOTE_CALL_FAILED","UNKNOWN_CALLBACK_ID","CALLBACK_TIMEOUT","MISSING_ENV","MISSING_FORWARD_FOR_MESSAGE","MISSING_COM_CONTEXT","SPAWNED_MORE_THEN_ONCE","MISSING_CONTEXT_FOR_API_PROXY","reportError","isWorkerContext","isWindow","isIframe","MultiCounter","LoggerService","default"].indexOf(u)<0&&function(t){n.d(e,t,(function(){return c[t]}))}(u);var d=n(21);n.d(e,"multiTenantMethod",(function(){return d.a}));n(22);var l=n(13);n.d(e,"WsClientHost",(function(){return l.a}));var h=n(23);n.d(e,"ManagedIframe",(function(){return h.a}))},function(t,e){},function(t,e,n){"use strict";function r(t){return e=>({getArgs:function([t,...e]){return e},proxyFunction:function(...n){if("function"==typeof t)return t.call(e,...n);throw new Error("No Such function")}})}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";n(0)},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));class r{constructor(t){this.host=t,this.decode=t=>JSON.parse(t),this.encode=t=>JSON.stringify(t),this.createHashParams=t=>`#${this.encode(t)}`}getHashParams(){const t=this.getContentWindow();return t.location.hash.length?this.decode(decodeURIComponent(t.location.hash.slice(1))):void 0}onHashChange(t){this.getContentWindow().addEventListener("hashchange",t)}getContentWindow(){if(!this.host)throw new Error("Target is not connected to the DOM");return this.host}offHashChange(t){this.getContentWindow().removeEventListener("hashchange",t)}updateHashParams(t){this.getContentWindow().location.hash=this.createHashParams(t)}}},function(t,e){},function(t,e,n){"use strict";n.d(e,"c",(function(){return o})),n.d(e,"a",(function(){return a})),n.d(e,"d",(function(){return c})),n.d(e,"b",(function(){return u}));var r=n(8),i=n(11),s=n(2);function o({entryFeature:t,topLevelConfig:e=[],envName:n="",runOptions:r}){return new i.a(e,r).run(t,n)}const a=t=>Object(s.d)(t,t=>t.dependencies);async function c({featureName:t,featureLoaders:e,config:n=[],options:s,envName:o}){const a=Object.keys(e),c=t&&e[t];if(!c)throw new Error(`cannot find feature "${t}". available features: ${a.join(", ")}`);const{resolvedContexts:u}=c,d=await Promise.all([c.load(u),...c.depFeatures.map(t=>e[t].load(u))]),[l]=d,h=new i.a([r.a.use({config:{resolvedContexts:u}}),...n],s).run(l,o);return{async dispose(){for(const t of d)await h.dispose(t,o)}}}function u(t){for(;t.parent&&t.parent!==t;)t=t.parent;return t}},function(t,e,n){"use strict";var r=n(15),i=n(1),s=n(16),o=n(5),a=n(0);class c{constructor(){this.items=new Map,this.callbacks=new Set}register(t,e){this.items.set(t,e);for(const n of this.callbacks)n(t,e)}[Symbol.iterator](){return this.items[Symbol.iterator]()}subscribe(t){this.callbacks.add(t)}unSubscribe(t){this.callbacks.delete(t)}stream(t){for(const[e,n]of this)t(e,n);return this.subscribe(t),()=>this.unSubscribe(t)}get(t){return this.items.get(t)||null}values(){return this.items.values()}}class u extends o.a{static withType(){return{defineEntity:t=>new u(t,t)}}[a.b](){return new c}}function d(t,e){const n=t.indexOf(e);return n<0?1/0:n}function l(t,e){return t<e?-1:t>e?1:0}function h(t,e){return(n,r)=>t(n,r)||e(n,r)}const{hasOwnProperty:f}=Object.prototype;class p{constructor(){this.items=[],this.callbacks=new Set,this.compareFunction=(t,e)=>0}register(t){this.items.push(t),this.sortItems();for(const e of this.callbacks)e(t)}[Symbol.iterator](){return this.items[Symbol.iterator]()}subscribe(t){this.callbacks.add(t)}unSubscribe(t){this.callbacks.delete(t)}stream(t){for(const e of this)t(e);return this.subscribe(t),()=>this.unSubscribe(t)}setItems(t){return this.items=t,this.sortItems(),this}setSortingOrder(t){return this.compareFunction=function(t){let e=(t,e)=>0;for(const n in t)if(f.call(t,n)){const[r,i]=t[n];e=h(e,!0===i?(t,e)=>l(e[r],t[r]):!1===i?(t,e)=>l(t[r],e[r]):(t,e)=>d(i,t[r])-d(i,e[r]))}return e}(t),this.sortItems(),this}sortItems(){this.items.sort(this.compareFunction)}}class g extends o.a{static withType(){return{defineEntity:t=>new g(t,t)}}[a.b](){return new p}}var m=n(17),v=n(7),b=n(18);n.d(e,"b",(function(){return r.a})),n.d(e,"c",(function(){return i.b})),n.d(e,"d",(function(){return i.c})),n.d(e,"r",(function(){return i.f})),n.d(e,"a",(function(){return i.a})),n.d(e,"j",(function(){return i.d})),n.d(e,"t",(function(){return i.h})),n.d(e,"p",(function(){return i.e})),n.d(e,"w",(function(){return i.k})),n.d(e,"x",(function(){return i.l})),n.d(e,"s",(function(){return i.g})),n.d(e,"v",(function(){return i.j})),n.d(e,"u",(function(){return i.i})),n.d(e,"n",(function(){return s.b})),n.d(e,"e",(function(){return s.a})),n.d(e,"f",(function(){return o.a})),n.d(e,"h",(function(){return c})),n.d(e,"i",(function(){return u})),n.d(e,"k",(function(){return p})),n.d(e,"l",(function(){return g})),n.d(e,"g",(function(){return m.a})),n.d(e,"o",(function(){return v.a})),n.d(e,"m",(function(){return b.a})),n.d(e,"q",(function(){return b.b}))},function(e,n){e.exports=t},function(t,e,n){"use strict";n.r(e);var r=n(19);for(var i in r)["COM","default"].indexOf(i)<0&&function(t){n.d(e,t,(function(){return r[t]}))}(i);var s=n(2);n.d(e,"deferred",(function(){return s.c})),n.d(e,"EventEmitter",(function(){return s.a})),n.d(e,"SetMultiMap",(function(){return s.b})),n.d(e,"returnsTrue",(function(){return s.e})),n.d(e,"flattenTree",(function(){return s.d}));var o=n(26);n.d(e,"Config",(function(){return o.b})),n.d(e,"Environment",(function(){return o.c})),n.d(e,"EnvironmentContext",(function(){return o.d})),n.d(e,"Universal",(function(){return o.r})),n.d(e,"AllEnvironments",(function(){return o.a})),n.d(e,"NoEnvironments",(function(){return o.j})),n.d(e,"globallyProvidingEnvironments",(function(){return o.t})),n.d(e,"SingleEndpointContextualEnvironment",(function(){return o.p})),n.d(e,"normEnvVisibility",(function(){return o.w})),n.d(e,"testEnvironmentCollision",(function(){return o.x})),n.d(e,"getEnvName",(function(){return o.s})),n.d(e,"isProvidedFrom",(function(){return o.v})),n.d(e,"isGloballyProvided",(function(){return o.u})),n.d(e,"RuntimeFeature",(function(){return o.n})),n.d(e,"Feature",(function(){return o.e})),n.d(e,"FeatureInput",(function(){return o.f})),n.d(e,"MapRegistry",(function(){return o.h})),n.d(e,"MapSlot",(function(){return o.i})),n.d(e,"OrderedRegistry",(function(){return o.k})),n.d(e,"OrderedSlot",(function(){return o.l})),n.d(e,"FeatureOutput",(function(){return o.g})),n.d(e,"Service",(function(){return o.o})),n.d(e,"Registry",(function(){return o.m})),n.d(e,"Slot",(function(){return o.q}));var a=n(24);for(var i in a)["COM","deferred","EventEmitter","SetMultiMap","returnsTrue","flattenTree","Config","Environment","EnvironmentContext","Universal","AllEnvironments","NoEnvironments","globallyProvidingEnvironments","SingleEndpointContextualEnvironment","normEnvVisibility","testEnvironmentCollision","getEnvName","isProvidedFrom","isGloballyProvided","RuntimeFeature","Feature","FeatureInput","MapRegistry","MapSlot","OrderedRegistry","OrderedSlot","FeatureOutput","Service","Registry","Slot","default"].indexOf(i)<0&&function(t){n.d(e,t,(function(){return a[t]}))}(i);var c=n(6);n.d(e,"runtimeType",(function(){return c.a}));var u=n(25);n.d(e,"run",(function(){return u.c})),n.d(e,"getFeaturesDeep",(function(){return u.a})),n.d(e,"runEngineApp",(function(){return u.d})),n.d(e,"getTopWindow",(function(){return u.b}));var d=n(11);n.d(e,"RuntimeEngine",(function(){return d.a}));var l=n(0);n.d(e,"RUN",(function(){return l.f})),n.d(e,"DISPOSE",(function(){return l.c})),n.d(e,"IDENTIFY_API",(function(){return l.d})),n.d(e,"CREATE_RUNTIME",(function(){return l.b})),n.d(e,"REGISTER_VALUE",(function(){return l.e})),n.d(e,"SERVICE_CONFIG",(function(){return l.h})),n.d(e,"RUN_OPTIONS",(function(){return l.g})),n.d(e,"CONFIGURABLE",(function(){return l.a}));var h=n(3);n.d(e,"LogLevel",(function(){return h.a}));var f=n(8);n.d(e,"COM",(function(){return f.a}))},function(t,e){var n,r,i=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(t){n=s}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(t){r=o}}();var c,u=[],d=!1,l=-1;function h(){d&&c&&(d=!1,c.length?u=c.concat(u):l=-1,u.length&&f())}function f(){if(!d){var t=a(h);d=!0;for(var e=u.length;e;){for(c=u,u=[];++l<e;)c&&c[l].run();l=-1,e=u.length}c=null,d=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function g(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new p(t,e)),1!==u.length||d||a(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.prependListener=g,i.prependOnceListener=g,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}}])}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("socket.io-client")):"function"==typeof define&&define.amd?define(["socket.io-client"],e):"object"==typeof exports?exports.EngineCore=e(require("socket.io-client")):t.EngineCore=e(t.io)}(globalThis,(function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=28)}([function(t,e,n){"use strict";n.d(e,"f",(function(){return r})),n.d(e,"c",(function(){return i})),n.d(e,"d",(function(){return s})),n.d(e,"b",(function(){return o})),n.d(e,"e",(function(){return a})),n.d(e,"h",(function(){return c})),n.d(e,"g",(function(){return u})),n.d(e,"a",(function(){return d}));const r=Symbol("RUN"),i=Symbol("DISPOSE"),s=Symbol("IDENTIFY_API"),o=Symbol("CREATE"),a=Symbol("REGISTER_VALUE"),c=Symbol("SERVICE_CONFIG"),u=Symbol("RUN_OPTIONS"),d=Symbol("CONFIGURABLE")},function(t,e,n){"use strict";n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return s})),n.d(e,"f",(function(){return o})),n.d(e,"a",(function(){return a})),n.d(e,"d",(function(){return c})),n.d(e,"h",(function(){return u})),n.d(e,"e",(function(){return d})),n.d(e,"k",(function(){return l})),n.d(e,"l",(function(){return h})),n.d(e,"g",(function(){return f})),n.d(e,"j",(function(){return p})),n.d(e,"i",(function(){return g}));var r=n(6);class i{constructor(t,e,n){this.env=t,this.envType=e,this.endpointType=n}}class s{constructor(t,e,n){this.env=t,this.activeEnvironmentName=e,this.runtimeEnvType=n}}const o=new i("<Universal>","window","multi"),a=new i("<All>","window","multi"),c=new i("<None>","window","multi"),u=new Set([o.env,a.env]);class d extends i{constructor(t,e){if(super(t,"context","single"),this.environments=e,0===e.length)throw new Error(`Contextual Environment ${t} initiated without child environments`)}useContext(t){return new s(this.env,t,this.getEnvironmentById(t).envType)}withContext(){return{type:Object(r.a)(this.env+" context")}}getEnvironmentById(t){return this.environments.find(({env:e})=>e===t)}}function l(t){const e=new Set;if(Array.isArray(t))for(const n of t)e.add(n.env);else"string"==typeof t?e.add(t):e.add(t.env);return e}function h(t,e){const n=new Set,r=t=>{e.has(t)?n.add(t):e.add(t)};if(Array.isArray(t))for(const e of t)r(e.env);else r("string"==typeof t?t:t.env);return[...n]}function f(t){return"string"==typeof t?t:t.env}function p(t,e){return Array.isArray(t)?t.some(t=>e.has(t.env)):"string"==typeof t?e.has(t):e.has(t.env)}function g(t){return p(t,u)}},function(t,e,n){"use strict";function r(){let t,e;return{promise:new Promise((n,r)=>{t=n,e=r}),resolve:t,reject:e}}class i{constructor(){this.map=new Map}get size(){return Array.from(this.map.values()).map(({size:t})=>t).reduce((t,e)=>t+e,0)}get(t){return this.map.get(t)}add(t,e){const n=this.map.get(t);return n?n.add(e):this.map.set(t,new Set([e])),this}clear(){this.map.clear()}delete(t,e){const n=this.map.get(t);if(n){const r=n.delete(e);return 0===n.size&&this.map.delete(t),r}return!1}deleteKey(t){return this.map.delete(t)}has(t,e){const n=this.map.get(t);return!!n&&n.has(e)}hasKey(t){const e=this.map.get(t);return!!e&&e.size>0}[Symbol.iterator](){return this.entries()}*entries(){const{map:t}=this;for(const[e,n]of t.entries())for(const t of n)yield[e,t]}*values(){const{map:t}=this;for(const e of t.values())for(const t of e)yield t}keys(){return this.map.keys()}}class s{constructor(){this.listeners=new i,this.listenersOnce=new i}on(t,e){this.listeners.add(t,e)}subscribe(t,e){this.on(t,e)}once(t,e){this.listenersOnce.add(t,e)}off(t,e){this.listeners.delete(t,e),this.listenersOnce.delete(t,e)}unsubscribe(t,e){this.off(t,e)}emit(t,e){const n=this.listeners.get(t);if(n)for(const t of n)t(e);const r=this.listenersOnce.get(t);if(r){for(const t of r)t(e);this.listenersOnce.deleteKey(t)}}clear(){this.listeners.clear(),this.listenersOnce.clear()}}const o=()=>!0;function a(t,e,n=o){const r=new Set,i=new Set,s=[t];for(;s.length;){const t=s.shift();i.has(t)||(i.add(t),n(t)&&r.add(t),s.push(...e(t)))}return r}n.d(e,"c",(function(){return r})),n.d(e,"a",(function(){return s})),n.d(e,"b",(function(){return i})),n.d(e,"e",(function(){return o})),n.d(e,"d",(function(){return a}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r;n(0);!function(t){t[t.DEBUG=0]="DEBUG",t[t.INFO=1]="INFO",t[t.WARN=2]="WARN",t[t.ERROR=3]="ERROR"}(r||(r={}))},function(t,e,n){"use strict";n.d(e,"b",(function(){return r})),n.d(e,"c",(function(){return i})),n.d(e,"h",(function(){return s})),n.d(e,"j",(function(){return o})),n.d(e,"a",(function(){return a})),n.d(e,"f",(function(){return c})),n.d(e,"g",(function(){return u})),n.d(e,"d",(function(){return d})),n.d(e,"i",(function(){return l})),n.d(e,"e",(function(){return h})),n.d(e,"k",(function(){return f}));const r=(t,e)=>`Could not register same id ${t} as ${e}`,i=t=>`Com with id "${t}" is already running.`,s=t=>`Remote call failed with error: "${t.error}" from "${t.from}"`,o=t=>`Unknown callback id "${t.callbackId}" in message:\n${JSON.stringify(t)}`,a=(t,e,n)=>`Callback timeout "${t}" at ${e} on message:\n${JSON.stringify(n)}`,c=(t,e)=>`Destination environment ${t} is not registered. available environments: [${e}]`,u=t=>`Not implemented forward for ${t.type}`,d=(t,e)=>`Missing communication context for "${t}" when ${e}`,l=t=>`Environment with id ${t} can only spawned once`,h=(t,e)=>`Missing ${t} when trying to get remote service api proxy for ${e}`;function f(t){console.error(t)}},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(6),i=n(0);class s{constructor(t,e){this.providedFrom=t,this.visibleAt=e,this.mode="input",this.type=Object(r.a)(),this.proxyType=Object(r.a)(),this.remoteAccess=!1}[i.e](t,e,n,r,i){return n}}},function(t,e,n){"use strict";function r(t){return Symbol(t)}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(0),i=n(1),s=n(17);class o extends s.a{constructor(t,e,n,r={}){super(t,e,n),this.providedFrom=t,this.visibleAt=e,this.remoteAccess=n,this.options=r}static withType(){return{defineEntity:t=>new o(t,t,!1)}}allowRemoteAccess(t){return new o(this.providedFrom,i.a,!0,t)}[r.e](t,e,n,r,s){if(this.remoteAccess){const{communication:o}=t.getCOM().api,a=t.entityID(r,s),c=Object(i.k)(this.providedFrom),u=o.getEnvironmentName();if(c.has(u)||c.has(i.f.env)){if(!e)throw new Error("service is not provide in runtime");o.registerAPI({id:a},e)}return n||this.getApiProxy(t,a)}return e}[r.b](t,e,n){if(this.remoteAccess)return this.getApiProxy(t,t.entityID(e,n))}getApiProxy(t,e){const{communication:n}=t.getCOM().api,r=function(t){if(function(t){return t&&t.endpointType&&"single"===t.endpointType}(t))return t.env}(this.providedFrom);return r?n.apiProxy({id:r},{id:e},this.options):{get(t){return n.apiProxy(t,{id:e},this.options)}}}}},function(t,e,n){"use strict";(function(t){var r=n(9),i=n(12),s=n(14),o=n(15),a=n(1),c=n(16),u=n(7),d=n(18),l=n(0),h=n(3);e.a=new c.a({id:"COM",api:{config:o.a.withType().defineEntity({id:"",loggerSeverity:h.a.DEBUG,maxLogMessages:100,topology:{},resolvedContexts:{}},(t,e)=>Object.assign(Object.assign(Object.assign({},t),e),{topology:Object.assign(Object.assign({},t.topology),e.topology),resolvedContexts:Object.assign(Object.assign({},t.resolvedContexts),e.resolvedContexts)})),loggerTransports:d.b.withType().defineEntity(a.f),loggerService:u.a.withType().defineEntity(a.f),spawn:u.a.withType().defineEntity(a.a),manage:u.a.withType().defineEntity(a.a),connect:u.a.withType().defineEntity(a.a),spawnOrConnect:u.a.withType().defineEntity(a.a),communication:u.a.withType().defineEntity(a.a)}}).setup(a.f,({config:{host:e,id:n,topology:o,maxLogMessages:a,loggerSeverity:c,logToConsole:u,resolvedContexts:d,publicPath:h},loggerTransports:f,[l.g]:p})=>{const g=void 0!==t&&"browser"!==t.title,m=n||e&&e.name||"undefined"!=typeof self&&self.name||"main",v={warnOnSlow:p.has("warnOnSlow"),publicPath:h},b=new i.a(g?e||new r.a:self,m,o,d,g,v);return{loggerService:new s.a(f,{environment:b.getEnvironmentId()},{severity:c,maxLogMessages:a,logToConsole:u}),communication:b,spawn:b.spawn.bind(b),connect:b.connect.bind(b),spawnOrConnect:b.spawnOrConnect.bind(b),manage:b.manage.bind(b)}})}).call(this,n(29))},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));class r{constructor(){this.name="base-host",this.parent=null,this.handlers=new Map}addEventListener(t,e,n){const r=this.handlers.get(t);r?r.add(e):this.handlers.set(t,new Set([e]))}removeEventListener(t,e,n){const r=this.handlers.get(t);r&&r.delete(e)}postMessage(t){this.emitMessageHandlers(t)}open(){const t=new r;return t.parent=this,t}emitMessageHandlers(t){for(const e of this.handlers.get("message")||[])e({data:t})}}},function(t,e,n){"use strict";function r(t){return"undefined"!=typeof Worker&&t instanceof Worker||"undefined"!=typeof WorkerGlobalScope&&t instanceof WorkerGlobalScope}function i(t){return"undefined"!=typeof Window&&t instanceof Window}function s(t){return"undefined"!=typeof HTMLIFrameElement&&t instanceof HTMLIFrameElement}n.d(e,"d",(function(){return r})),n.d(e,"c",(function(){return i})),n.d(e,"b",(function(){return s})),n.d(e,"a",(function(){return o}));class o{constructor(){this.ids={}}next(t){return this.ids[t]=this.ids[t]||0,t+this.ids[t]++}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(8),i=n(0);class s{constructor(t=[],e=new Map){this.runOptions=e,this.features=new Map,this.running=!1,this.topLevelConfigMap=this.createConfigMap(t)}get(t){const e=this.features.get(t);if(e)return e;throw new Error("missing feature")}run(t,e){if(this.running)throw new Error("Engine already running!");this.running=!0,Array.isArray(t)||(t=[t]);for(const n of t)this.initFeature(n,e);for(const n of t)this.runFeature(n,e);return this}initFeature(t,e){let n=this.features.get(t);return n||(n=t[i.b](this,e)),n}runFeature(t,e){const n=this.features.get(t);if(!n)throw new Error("Could not find running feature: "+t.id);n[i.f](this,e)}async dispose(t,e){const n=this.features.get(t);n&&(await n[i.c](this,e),this.features.delete(t))}getTopLevelConfig(t,e){return this.topLevelConfigMap[this.entityID(t,e)]||[]}entityID(t,e){return`${t}.${e}`}getCOM(){return this.get(r.a)}createConfigMap(t){const e={};for(const[n,r]of t)for(const[t,i]of Object.entries(r)){const r=this.entityID(n,t);e[r]=e[r]||[],e[r].push(i)}return e}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return u})),n.d(e,"b",(function(){return p}));var r=n(4),i=n(10),s=n(0),o=n(2),a=n(9),c=n(13);class u{constructor(t,e,n={},s={},a=!1,c){this.topology=n,this.resolvedContexts=s,this.isServer=a,this.idsCounter=new i.a,this.callbackTimeout=12e4,this.slowThreshold=5e3,this.callbacks={},this.environments={},this.pendingEnvs=new Map,this.pendingMessages=new o.b,this.handlers=new Map,this.eventDispatchers={},this.apis={},this.apisOverrides={},this.handleEvent=({data:t})=>{this.handleMessage(t).catch(r.k)},this.options=Object.assign({warnOnSlow:!1,publicPath:""},c),this.rootEnvId=e,this.rootEnvName=e.split("/")[0],this.registerMessageHandler(t),this.registerEnv(e,t),this.environments["*"]={id:e,host:t},this.post(this.getPostEndpoint(t),{type:"ready",from:e,to:"*",origin:e})}registerEnv(t,e){if(this.environments[t])throw new Error(Object(r.b)(t,"Environment"));this.environments[t]={id:t,host:e}}registerAPI({id:t},e){if(this.apis[t])throw new Error(Object(r.b)(t,"RemoteService"));return this.apis[t]=e,this.applyApiDirectives(t,e),e}async spawnOrConnect(t){const e=this.resolvedContexts[t.env],n=t.environments.find(t=>t.env===e);return n.env=t.env,"node"===n.envType?this.connect(n):this.spawn(n)}getEnvironmentContext(t){return this.resolvedContexts[t.env]}async spawn(t,e){const{endpointType:n,env:r,envType:i}=t,s="single"===n?r:this.generateEnvInstanceID(r);return await("worker"===i?this.useWorker(d(r,s,this.options.publicPath),s):this.useWindow(e,s,l(r,s,this.options.publicPath))),{id:s}}async manage(t,e,n){const{endpointType:r,env:i}=t,s="single"===r?i:this.generateEnvInstanceID(i);return await this.useIframe(e,s,h(i,s,this.options.publicPath,n)),{id:s}}async useIframe(t,e,n){const i=t.contentWindow;if(!i)throw new Error("cannot spawn detached iframe.");await this.changeLocation(i,t,e,n);const s=`${this.rootEnvId}__${e}_`,o=async()=>{for(const t of this.handlers.keys())t.startsWith(s)&&await this.reconnectHandler(e,this.parseHandlerId(t,s))};t.addEventListener("load",()=>{this.envReady(e).then(o).catch(r.k)}),this.registerEnv(e,i),await this.envReady(e)}async connect(t){const{env:e,envType:n}=t,r=this.topology[e];if(!r)throw new Error(`Could not find ${n} topology for ${e}`);const i=e,s=new c.a(r);return this.registerMessageHandler(s),this.registerEnv(i,s),await s.connected,{id:i,onDisconnect:t=>{s.subscribers.listeners.add("disconnect",t)}}}apiProxy(t,{id:e},n={}){return new Proxy(Object.create(null),{get:(r,i)=>{if("string"==typeof i){let s=r[i];return s||(s=async(...r)=>this.callMethod((await t).id,e,i,r,this.rootEnvId,n),r[i]=s),s}}})}registerMessageHandler(t){t.addEventListener("message",this.handleEvent,!0)}generateEnvInstanceID(t){return this.idsCounter.next(`${t}/`)}callMethod(t,e,n,r,i,s){return new Promise((o,a)=>{var c,u;const d=(null===(c=s[n])||void 0===c?void 0:c.emitOnly)?void 0:this.idsCounter.next("c");if(this.isListenCall(r)||(null===(u=s[n])||void 0===u?void 0:u.removeAllListeners))this.addOrRemoveListener(t,e,n,d,i,s,r[0],o,a);else{const s={to:t,from:this.rootEnvId,type:"call",data:{api:e,method:n,args:r},callbackId:d,origin:i};this.callWithCallback(t,s,d,o,a)}})}async handleMessage(t){const e=this.environments[t.to];if(e)if(e.id===this.rootEnvId)switch(t.type){case"call":await this.handleCall(t);break;case"callback":this.handleCallback(t);break;case"event":this.handleEventMessage(t);break;case"listen":await this.handleListen(t);break;case"unlisten":await this.handleUnListen(t);break;case"ready":this.handleReady(t)}else await this.forwardMessage(t,e);else this.unhandledMessage(t)}async useWorker(t,e){this.registerMessageHandler(t),this.registerEnv(e,t),await this.envReady(e)}async useWindow(t,e,n){const r=Object(i.b)(t)?t.contentWindow:t;if(!r)throw new Error("cannot spawn detached iframe.");await this.injectScript(r,e,n),this.registerEnv(e,r),await this.envReady(e)}dispose(){for(const{host:t}of Object.values(this.environments))t.removeEventListener("message",this.handleEvent,!0)}getEnvironmentId(){return this.rootEnvId}getEnvironmentName(){return this.rootEnvName}parseHandlerId(t,e){const[n,r]=t.slice(e.length).split("@");return{api:n,method:r,handlerId:t}}reconnectHandler(t,e){return new Promise((n,r)=>{const i={to:t,from:this.rootEnvId,type:"listen",data:e,callbackId:this.idsCounter.next("c"),origin:this.rootEnvId};this.createCallbackRecord(i,i.callbackId,n,r),this.sendTo(t,i)})}applyApiDirectives(t,e){const n=e[s.h];if(n){this.apisOverrides[t]={};for(const r of Object.keys(n)){const i=n[r](e);i.proxyFunction&&(this.apisOverrides[t][r]=i.proxyFunction)}}}envReady(t){return new Promise(e=>{this.pendingEnvs.set(t,()=>e())})}async forwardMessage(t,e){if("call"!==t.type)throw new Error(Object(r.g)(t));{const n=await this.callMethod(e.id,t.data.api,t.data.method,t.data.args,t.origin,{});t.callbackId&&this.sendTo(t.from,{from:t.to,type:"callback",to:t.from,data:n,callbackId:t.callbackId,origin:t.to})}}changeLocation(t,e,n,r){return new Promise((i,s)=>{t.name=n;const o=()=>{e.removeEventListener("load",o),i()};e.addEventListener("load",o),e.addEventListener("error",()=>s()),t.location.href=r})}apiCall(t,e,n,r){return this.apisOverrides[e]&&this.apisOverrides[e][n]?this.apisOverrides[e][n](t,...r):this.apis[e][n](...r)}unhandledMessage(t){}addOrRemoveListener(t,e,n,r,i,s,o,a,c){var u,d,l,h;const f=(null===(u=s[n])||void 0===u?void 0:u.removeAllListeners)||(null===(d=s[n])||void 0===d?void 0:d.removeListener);if(f){const u=this.getHandlerId(t,e,f),d=this.handlers.get(u);if(!d)throw new Error("Cannot Remove handler "+u);if(null===(l=s[n])||void 0===l?void 0:l.removeListener){const t=d.indexOf(o);-1!==t&&d.splice(t,1)}else d.length=0;if(0===d.length){const s={to:t,from:this.rootEnvId,type:"unlisten",data:{api:e,method:n,handlerId:u},callbackId:r,origin:i};this.callWithCallback(t,s,r,a,c)}else a()}else{if(null===(h=s[n])||void 0===h||!h.listener)throw new Error(`cannot add listenr to unconfigured method ${e} ${n}`);{const s=this.handlers.get(this.getHandlerId(t,e,n));if(s&&0!==s.length)s.push(o),a();else{const s={to:t,from:this.rootEnvId,type:"listen",data:{api:e,method:n,handlerId:this.createHandlerRecord(t,e,n,o)},callbackId:r,origin:i};this.callWithCallback(t,s,r,a,c)}}}}callWithCallback(t,e,n,r,i){this.sendTo(t,e),n?this.createCallbackRecord(e,e.callbackId,r,i):r()}sendTo(t,e){const n=this.resolveMessageTarget(t);if(!n)throw new Error(Object(r.f)(t,Object.keys(this.environments)));this.pendingEnvs.get(t)?this.pendingMessages.add(t,()=>this.post(n,e)):this.post(n,e)}post(t,e){Object(i.d)(t)?t.postMessage(e):t.postMessage(e,"*")}resolveMessageTarget(t){let e=this.environments[t];if(e&&e.id!==this.rootEnvId)return e.host;{e||(e=this.environments[this.rootEnvId]);const t=e.host;return t instanceof a.a?t.parent||t:this.getPostEndpoint(t)}}getPostEndpoint(t){return Object(i.c)(t)?t.opener||t.parent:t}handleEventMessage(t){const e=this.handlers.get(t.handlerId);if(e)for(const n of e)n(...t.data)}handleReady({from:t}){const e=this.pendingEnvs.get(t);if(e){this.pendingEnvs.delete(t);const n=this.pendingMessages.get(t);if(n){for(const t of n)t();this.pendingMessages.deleteKey(t)}e()}}async handleUnListen(t){const e=this.eventDispatchers[t.data.handlerId];if(e){delete this.eventDispatchers[t.data.handlerId];const n=await this.apiCall(t.origin,t.data.api,t.data.method,[e]);t.callbackId&&this.sendTo(t.from,{to:t.from,from:this.rootEnvId,type:"callback",data:n,callbackId:t.callbackId,origin:this.rootEnvId})}}async handleListen(t){try{const e=this.eventDispatchers[t.data.handlerId]||this.createDispatcher(t.from,t),n=await this.apiCall(t.origin,t.data.api,t.data.method,[e]);t.callbackId&&this.sendTo(t.from,{to:t.from,from:this.rootEnvId,type:"callback",data:n,callbackId:t.callbackId,origin:this.rootEnvId})}catch(e){this.sendTo(t.from,{to:t.from,from:this.rootEnvId,type:"callback",error:String(e),callbackId:t.callbackId,origin:this.rootEnvId})}}async handleCall(t){try{const e=await this.apiCall(t.origin,t.data.api,t.data.method,t.data.args);t.callbackId&&this.sendTo(t.from,{to:t.from,from:this.rootEnvId,type:"callback",data:e,callbackId:t.callbackId,origin:this.rootEnvId})}catch(e){this.sendTo(t.from,{to:t.from,from:this.rootEnvId,type:"callback",error:String(e.stack),callbackId:t.callbackId,origin:this.rootEnvId})}}handleCallback(t){const e=t.callbackId?this.callbacks[t.callbackId]:null;if(e)t.error?e.reject(new Error(Object(r.h)(t))):e.resolve(t.data);else if(t.callbackId)throw new Error(Object(r.j)(f(t)))}createDispatcher(t,e){const n=e.data.handlerId;return this.eventDispatchers[n]=(...n)=>{this.sendTo(t,{to:t,from:this.rootEnvId,type:"event",data:n,handlerId:e.data.handlerId,origin:this.rootEnvId})}}isListenCall(t){return"function"==typeof t[0]&&1===t.length}getHandlerId(t,e,n){return`${this.rootEnvId}__${t}_${e}@${n}`}createHandlerRecord(t,e,n,r){const i=this.getHandlerId(t,e,n),s=this.handlers.get(i);return s?s.push(r):this.handlers.set(i,[r]),i}createCallbackRecord(t,e,n,i){const s=t=>{delete this.callbacks[e],i(t)};this.options.warnOnSlow&&setTimeout(()=>{this.callbacks[e]&&console.error(Object(r.a)(e,this.rootEnvId,f(t)))},this.slowThreshold);const o=setTimeout(()=>{s(new Error(Object(r.a)(e,this.rootEnvId,f(t))))},this.callbackTimeout);this.callbacks[e]={timerId:o,resolve:t=>{delete this.callbacks[e],clearTimeout(o),n(t)},reject:s}}injectScript(t,e,n){return new Promise((r,i)=>{t.name=e;const s=t.document.createElement("script");s.src=n,s.onload=()=>r(t),s.onerror=t=>i(t),t.document.head.appendChild(s)})}}const d=(t,e,n="")=>new Worker(`${n}${t}.webworker.js${location.search}`,{name:e}),l=(t,e,n="")=>`${n}${t}.web.js${location.search}`,h=(t,e,n="",r)=>`${n}${t}.html${location.search}${null!=r?r:""}`,f=t=>{if("call"===(t=Object.assign({},t)).type||"callback"===t.type){const{data:e}=t;e&&e.args&&(e.args=void 0)}return t};function p(t,e,n){if("string"!=typeof t)throw"onMethod ref must be a string";return Object.assign({[t]:{listener:!0},[e]:{removeListener:t}},n?{[n]:{removeAllListeners:t}}:void 0)}},function(t,e,n){"use strict";n.d(e,"a",(function(){return a}));var r=n(27),i=n.n(r),s=n(9),o=n(2);class a extends s.a{constructor(t){super(),this.subscribers=new o.a;const{promise:e,resolve:n}=Object(o.c)();this.connected=e,this.socketClient=i.a.connect(t),this.socketClient.on("connect",()=>{n(),this.socketClient.on("message",t=>{this.emitMessageHandlers(t)})}),this.socketClient.on("disconnect",()=>{this.subscribers.emit("disconnect",void 0),this.socketClient.close()})}postMessage(t){this.socketClient.emit("message",t)}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(2),i=n(3);class s extends r.a{constructor(t=[],e={},n={severity:i.a.DEBUG}){super(),this.transports=t,this.baseMetadata=e,this.config=n,this.messages=[],this.debug=t=>this.log(t,i.a.DEBUG),this.info=t=>this.log(t,i.a.INFO),this.warn=t=>this.log(t,i.a.WARN),this.error=t=>this.log(t,i.a.ERROR)}getMessages(){return this.messages}logMessage(t){if(t.level>=this.config.severity){this.addToMessages(t),this.emit("message",t),this.config.logToConsole&&function({message:t,metadata:e={},level:n}){switch(n){case i.a.DEBUG:console.log(t,e);break;case i.a.INFO:console.info(t,e);break;case i.a.WARN:console.warn(t,e);break;case i.a.ERROR:console.error(t,e)}}(t);for(const e of this.transports)e.handleMessage(t)}}clearMessages(){this.messages=[]}log(t,e){const{value:n,metadata:r}=function(t){const e={value:""};if("function"==typeof t){const n=t();"string"==typeof n?e.value=n:(e.value=n.value,e.metadata=n.metadata||e.metadata)}else"string"==typeof t?e.value=t:(e.value=t.value,e.metadata=t.metadata);return e}(t);this.logMessage({message:n,timestamp:Date.now(),level:e,metadata:Object.assign({base:this.baseMetadata},r)})}addToMessages(t){this.messages.length+1>this.config.maxLogMessages&&this.messages.shift(),this.messages.push(t)}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(0),i=n(1),s=n(5);class o extends s.a{constructor(t,e=((t,e)=>Object.assign(Object.assign({},t),e)),n=i.a){super(i.a,n),this.defaultValue=t,this.mergeConfig=e}static withType(){return{defineEntity:(t,e,n)=>new o(t,e,n)}}[r.b](t,e,n){return t.getTopLevelConfig(e,n).reduce((t,e)=>this.mergeConfig(t,e),this.defaultValue)}[r.e](t,e,n,r,i){return n}}},function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"a",(function(){return a}));var r=n(0),i=n(1),s=n(2);class o{constructor(t,e,n){this.feature=t,this.api=e,this.dependencies=n,this.running=!1,this.runHandlers=new s.b,this.disposeHandlers=new s.b}addRunHandler(t,e){this.runHandlers.add(e,t)}addOnDisposeHandler(t,e){this.disposeHandlers.add(e,t)}[r.f](t,e){if(this.running)return;this.running=!0;for(const n of this.feature.dependencies)t.runFeature(n,e);const n=this.runHandlers.get(e)||[];for(const t of n)t()}async[r.c](t,e){for(const n of this.feature.dependencies)await t.dispose(n,e);const n=this.disposeHandlers.get(e)||new Set;for(const t of n)await t()}}class a{constructor(t){this.asEntity=this,this.environmentIml=new Set,this.setupHandlers=new s.b,this.contextHandlers=new Map,this.id=t.id,this.dependencies=t.dependencies||[],this.api=t.api||{},this.context=t.context||{},this.identifyApis()}setup(t,e){return function(t,e,n){const r=Object(i.l)(t,n);if(r.length)throw new Error(`Feature can only have single setup for each environment. ${e} Feature already implements: ${r}`)}(t,this.id,this.environmentIml),this.setupHandlers.add(Object(i.g)(t),e),this}use(t){return[this.id,t]}setupContext(t,e,n){return function(t,e,n){const r=n.get(t);if(r)throw new Error(`Feature can only have single setupContext for each context id. ${e} Feature already implements: ${String(t)}\n${r}`)}(e,this.id,this.contextHandlers),this.contextHandlers.set(e,n),this}[r.b](t,e){const n={},s={},a={},c={},u={},d={},l=Object.entries(this.api),h=l.filter(([t,e])=>"input"!==e.mode&&Object(i.i)(e.providedFrom)),f=new o(this,a,n);t.features.set(this,f);for(const r of this.dependencies)n[r.id]=t.initFeature(r,e),s[r.id]=n[r.id].api;for(const[e,n]of l){const i=n[r.b](t,this.id,e);void 0!==i&&(c[e]=i)}const p=Object.assign(Object.assign({},c),{id:this.id,run(t){f.addRunHandler(t,e)},onDispose(t){f.addOnDisposeHandler(t,e)},[r.g]:t.runOptions}),g={dispose:()=>{}};for(const[t,e]of this.contextHandlers){const n=e(s);d[t]=Object.assign(Object.assign({},g),n)}const m=[],v=this.setupHandlers.get("<Universal>"),b=this.setupHandlers.get("<All>"),y=this.setupHandlers.get(e);v&&m.push(...v),b&&m.push(...b),y&&m.push(...y);for(const t of m){const e=t(p,s,d);if(e){for(const[t]of h)p[t]=e[t];Object.assign(u,e)}}for(const[e,n]of l){const i=n[r.e](t,u[e],c[e],this.id,e);void 0!==i&&(a[e]=i)}return f}identifyApis(){for(const[t,e]of Object.entries(this.api)){const n=e[r.d];n&&n.call(e,this.id,t)}}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(6);n(0);class i{constructor(t,e,n){this.providedFrom=t,this.visibleAt=e,this.remoteAccess=n,this.mode="output",this.type=Object(r.a)(),this.proxyType=Object(r.a)()}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return s})),n.d(e,"b",(function(){return o}));var r=n(0),i=n(5);class s{constructor(){this.items=[],this.callbacks=new Set}register(t){this.items.push(t);for(const e of this.callbacks)e(t)}[Symbol.iterator](){return this.items[Symbol.iterator]()}subscribe(t){this.callbacks.add(t)}unSubscribe(t){this.callbacks.delete(t)}stream(t){for(const e of this)t(e);return this.subscribe(t),()=>this.unSubscribe(t)}}class o extends i.a{static withType(){return{defineEntity:t=>new o(t,t)}}[r.b](){return new s}}},function(t,e,n){"use strict";n.r(e);var r=n(9);n.d(e,"BaseHost",(function(){return r.a}));var i=n(12);n.d(e,"Communication",(function(){return i.a})),n.d(e,"decalreComEmitter",(function(){return i.b}));var s=n(4);n.d(e,"DUPLICATE_REGISTER",(function(){return s.b})),n.d(e,"GLOBAL_REF",(function(){return s.c})),n.d(e,"REMOTE_CALL_FAILED",(function(){return s.h})),n.d(e,"UNKNOWN_CALLBACK_ID",(function(){return s.j})),n.d(e,"CALLBACK_TIMEOUT",(function(){return s.a})),n.d(e,"MISSING_ENV",(function(){return s.f})),n.d(e,"MISSING_FORWARD_FOR_MESSAGE",(function(){return s.g})),n.d(e,"MISSING_COM_CONTEXT",(function(){return s.d})),n.d(e,"SPAWNED_MORE_THEN_ONCE",(function(){return s.i})),n.d(e,"MISSING_CONTEXT_FOR_API_PROXY",(function(){return s.e})),n.d(e,"reportError",(function(){return s.k}));var o=n(10);n.d(e,"isWorkerContext",(function(){return o.d})),n.d(e,"isWindow",(function(){return o.c})),n.d(e,"isIframe",(function(){return o.b})),n.d(e,"MultiCounter",(function(){return o.a}));var a=n(14);n.d(e,"LoggerService",(function(){return a.a}));var c=n(20);for(var u in c)["BaseHost","Communication","decalreComEmitter","DUPLICATE_REGISTER","GLOBAL_REF","REMOTE_CALL_FAILED","UNKNOWN_CALLBACK_ID","CALLBACK_TIMEOUT","MISSING_ENV","MISSING_FORWARD_FOR_MESSAGE","MISSING_COM_CONTEXT","SPAWNED_MORE_THEN_ONCE","MISSING_CONTEXT_FOR_API_PROXY","reportError","isWorkerContext","isWindow","isIframe","MultiCounter","LoggerService","default"].indexOf(u)<0&&function(t){n.d(e,t,(function(){return c[t]}))}(u);var d=n(21);n.d(e,"multiTenantMethod",(function(){return d.a}));n(22);var l=n(13);n.d(e,"WsClientHost",(function(){return l.a}));var h=n(23);n.d(e,"ManagedIframe",(function(){return h.a}))},function(t,e){},function(t,e,n){"use strict";function r(t){return e=>({getArgs:function([t,...e]){return e},proxyFunction:function(...n){if("function"==typeof t)return t.call(e,...n);throw new Error("No Such function")}})}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";n(0)},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));class r{constructor(t){this.host=t,this.decode=t=>JSON.parse(t),this.encode=t=>JSON.stringify(t),this.createHashParams=t=>`#${this.encode(t)}`}getHashParams(){const t=this.getContentWindow();return t.location.hash.length?this.decode(decodeURIComponent(t.location.hash.slice(1))):void 0}onHashChange(t){this.getContentWindow().addEventListener("hashchange",t)}getContentWindow(){if(!this.host)throw new Error("Target is not connected to the DOM");return this.host}offHashChange(t){this.getContentWindow().removeEventListener("hashchange",t)}updateHashParams(t){this.getContentWindow().location.hash=this.createHashParams(t)}}},function(t,e){},function(t,e,n){"use strict";n.d(e,"c",(function(){return o})),n.d(e,"a",(function(){return a})),n.d(e,"d",(function(){return c})),n.d(e,"b",(function(){return u}));var r=n(8),i=n(11),s=n(2);function o({entryFeature:t,topLevelConfig:e=[],envName:n="",runOptions:r}){return new i.a(e,r).run(t,n)}const a=t=>Object(s.d)(t,t=>t.dependencies);async function c({featureName:t,featureLoaders:e,config:n=[],options:s,envName:o,publicPath:a}){const c=Object.keys(e),u=t&&e[t];if(!u)throw new Error(`cannot find feature "${t}". available features: ${c.join(", ")}`);const{resolvedContexts:d}=u,l=await Promise.all([u.load(d),...u.depFeatures.map(t=>e[t].load(d))]),[h]=l,f=new i.a([r.a.use({config:{resolvedContexts:d,publicPath:a}}),...n],s).run(h,o);return{async dispose(){for(const t of l)await f.dispose(t,o)}}}function u(t){for(;t.parent&&t.parent!==t;)t=t.parent;return t}},function(t,e,n){"use strict";var r=n(15),i=n(1),s=n(16),o=n(5),a=n(0);class c{constructor(){this.items=new Map,this.callbacks=new Set}register(t,e){this.items.set(t,e);for(const n of this.callbacks)n(t,e)}[Symbol.iterator](){return this.items[Symbol.iterator]()}subscribe(t){this.callbacks.add(t)}unSubscribe(t){this.callbacks.delete(t)}stream(t){for(const[e,n]of this)t(e,n);return this.subscribe(t),()=>this.unSubscribe(t)}get(t){return this.items.get(t)||null}values(){return this.items.values()}}class u extends o.a{static withType(){return{defineEntity:t=>new u(t,t)}}[a.b](){return new c}}function d(t,e){const n=t.indexOf(e);return n<0?1/0:n}function l(t,e){return t<e?-1:t>e?1:0}function h(t,e){return(n,r)=>t(n,r)||e(n,r)}const{hasOwnProperty:f}=Object.prototype;class p{constructor(){this.items=[],this.callbacks=new Set,this.compareFunction=(t,e)=>0}register(t){this.items.push(t),this.sortItems();for(const e of this.callbacks)e(t)}[Symbol.iterator](){return this.items[Symbol.iterator]()}subscribe(t){this.callbacks.add(t)}unSubscribe(t){this.callbacks.delete(t)}stream(t){for(const e of this)t(e);return this.subscribe(t),()=>this.unSubscribe(t)}setItems(t){return this.items=t,this.sortItems(),this}setSortingOrder(t){return this.compareFunction=function(t){let e=(t,e)=>0;for(const n in t)if(f.call(t,n)){const[r,i]=t[n];e=h(e,!0===i?(t,e)=>l(e[r],t[r]):!1===i?(t,e)=>l(t[r],e[r]):(t,e)=>d(i,t[r])-d(i,e[r]))}return e}(t),this.sortItems(),this}sortItems(){this.items.sort(this.compareFunction)}}class g extends o.a{static withType(){return{defineEntity:t=>new g(t,t)}}[a.b](){return new p}}var m=n(17),v=n(7),b=n(18);n.d(e,"b",(function(){return r.a})),n.d(e,"c",(function(){return i.b})),n.d(e,"d",(function(){return i.c})),n.d(e,"r",(function(){return i.f})),n.d(e,"a",(function(){return i.a})),n.d(e,"j",(function(){return i.d})),n.d(e,"t",(function(){return i.h})),n.d(e,"p",(function(){return i.e})),n.d(e,"w",(function(){return i.k})),n.d(e,"x",(function(){return i.l})),n.d(e,"s",(function(){return i.g})),n.d(e,"v",(function(){return i.j})),n.d(e,"u",(function(){return i.i})),n.d(e,"n",(function(){return s.b})),n.d(e,"e",(function(){return s.a})),n.d(e,"f",(function(){return o.a})),n.d(e,"h",(function(){return c})),n.d(e,"i",(function(){return u})),n.d(e,"k",(function(){return p})),n.d(e,"l",(function(){return g})),n.d(e,"g",(function(){return m.a})),n.d(e,"o",(function(){return v.a})),n.d(e,"m",(function(){return b.a})),n.d(e,"q",(function(){return b.b}))},function(e,n){e.exports=t},function(t,e,n){"use strict";n.r(e);var r=n(19);for(var i in r)["COM","default"].indexOf(i)<0&&function(t){n.d(e,t,(function(){return r[t]}))}(i);var s=n(2);n.d(e,"deferred",(function(){return s.c})),n.d(e,"EventEmitter",(function(){return s.a})),n.d(e,"SetMultiMap",(function(){return s.b})),n.d(e,"returnsTrue",(function(){return s.e})),n.d(e,"flattenTree",(function(){return s.d}));var o=n(26);n.d(e,"Config",(function(){return o.b})),n.d(e,"Environment",(function(){return o.c})),n.d(e,"EnvironmentContext",(function(){return o.d})),n.d(e,"Universal",(function(){return o.r})),n.d(e,"AllEnvironments",(function(){return o.a})),n.d(e,"NoEnvironments",(function(){return o.j})),n.d(e,"globallyProvidingEnvironments",(function(){return o.t})),n.d(e,"SingleEndpointContextualEnvironment",(function(){return o.p})),n.d(e,"normEnvVisibility",(function(){return o.w})),n.d(e,"testEnvironmentCollision",(function(){return o.x})),n.d(e,"getEnvName",(function(){return o.s})),n.d(e,"isProvidedFrom",(function(){return o.v})),n.d(e,"isGloballyProvided",(function(){return o.u})),n.d(e,"RuntimeFeature",(function(){return o.n})),n.d(e,"Feature",(function(){return o.e})),n.d(e,"FeatureInput",(function(){return o.f})),n.d(e,"MapRegistry",(function(){return o.h})),n.d(e,"MapSlot",(function(){return o.i})),n.d(e,"OrderedRegistry",(function(){return o.k})),n.d(e,"OrderedSlot",(function(){return o.l})),n.d(e,"FeatureOutput",(function(){return o.g})),n.d(e,"Service",(function(){return o.o})),n.d(e,"Registry",(function(){return o.m})),n.d(e,"Slot",(function(){return o.q}));var a=n(24);for(var i in a)["COM","deferred","EventEmitter","SetMultiMap","returnsTrue","flattenTree","Config","Environment","EnvironmentContext","Universal","AllEnvironments","NoEnvironments","globallyProvidingEnvironments","SingleEndpointContextualEnvironment","normEnvVisibility","testEnvironmentCollision","getEnvName","isProvidedFrom","isGloballyProvided","RuntimeFeature","Feature","FeatureInput","MapRegistry","MapSlot","OrderedRegistry","OrderedSlot","FeatureOutput","Service","Registry","Slot","default"].indexOf(i)<0&&function(t){n.d(e,t,(function(){return a[t]}))}(i);var c=n(6);n.d(e,"runtimeType",(function(){return c.a}));var u=n(25);n.d(e,"run",(function(){return u.c})),n.d(e,"getFeaturesDeep",(function(){return u.a})),n.d(e,"runEngineApp",(function(){return u.d})),n.d(e,"getTopWindow",(function(){return u.b}));var d=n(11);n.d(e,"RuntimeEngine",(function(){return d.a}));var l=n(0);n.d(e,"RUN",(function(){return l.f})),n.d(e,"DISPOSE",(function(){return l.c})),n.d(e,"IDENTIFY_API",(function(){return l.d})),n.d(e,"CREATE_RUNTIME",(function(){return l.b})),n.d(e,"REGISTER_VALUE",(function(){return l.e})),n.d(e,"SERVICE_CONFIG",(function(){return l.h})),n.d(e,"RUN_OPTIONS",(function(){return l.g})),n.d(e,"CONFIGURABLE",(function(){return l.a}));var h=n(3);n.d(e,"LogLevel",(function(){return h.a}));var f=n(8);n.d(e,"COM",(function(){return f.a}))},function(t,e){var n,r,i=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(t){n=s}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(t){r=o}}();var c,u=[],d=!1,l=-1;function h(){d&&c&&(d=!1,c.length?u=c.concat(u):l=-1,u.length&&f())}function f(){if(!d){var t=a(h);d=!0;for(var e=u.length;e;){for(c=u,u=[];++l<e;)c&&c[l].run();l=-1,e=u.length}c=null,d=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function g(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new p(t,e)),1!==u.length||d||a(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.prependListener=g,i.prependOnceListener=g,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}}])}));
//# sourceMappingURL=engine-core.min.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc