New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@wixc3/engine-core

Package Overview
Dependencies
Maintainers
147
Versions
343
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 11.0.2 to 11.0.3

2

package.json
{
"name": "@wixc3/engine-core",
"version": "11.0.2",
"version": "11.0.3",
"main": "cjs/index.js",

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

@@ -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=29)}([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.for("__ENGINE__RUN"),i=Symbol.for("__ENGINE__DISPOSE"),s=Symbol.for("__ENGINE__IDENTIFY_API"),o=Symbol.for("__ENGINE__CREATE"),a=Symbol.for("__ENGINE__REGISTER_VALUE"),c=Symbol.for("__ENGINE__SERVICE_CONFIG"),u=Symbol.for("__ENGINE__RUN_OPTIONS"),d=Symbol.for("__ENGINE__CONFIGURABLE")},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}}n.d(e,"c",(function(){return r})),n.d(e,"a",(function(){return s})),n.d(e,"b",(function(){return i})),n.d(e,"f",(function(){return o})),n.d(e,"d",(function(){return a})),n.d(e,"e",(function(){return c}));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}function c(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)})}},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 f})),n.d(e,"g",(function(){return h})),n.d(e,"j",(function(){return p})),n.d(e,"i",(function(){return g}));var r=n(7);class i{constructor(t,e,n){this.env=t,this.envType=e,this.endpointType=n}}class s{constructor(t,e){this.env=t,this.activeEnvironmentName=e}}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)}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 f(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 h(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";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 f})),n.d(e,"k",(function(){return h}));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`,f=(t,e)=>`Missing ${t} when trying to get remote service api proxy for ${e}`;function h(t){console.error(t)}},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,"a",(function(){return s}));var r=n(7),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"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";function r(t){return Symbol(t)}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";(function(t){var r=n(9),i=n(18),s=n(13),o=n(14),a=n(2),c=n(15),u=n(11),d=n(17),l=n(0),f=n(4);e.a=new c.a({id:"COM",api:{config:o.a.withType().defineEntity({id:"",loggerSeverity:f.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),startEnvironment: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:f},loggerTransports:h,[l.g]:p,runningEnvironmentName:g,onDispose:m})=>{const v=void 0!==t&&"browser"!==t.title,b=n||e&&e.name||"undefined"!=typeof self&&self.name||g,E={warnOnSlow:p.has("warnOnSlow"),publicPath:f},y=new i.a(v?e||new r.a:self,b,o,d,v,E),w=new s.a(h,{environment:y.getEnvironmentId()},{severity:c,maxLogMessages:a,logToConsole:u});return m(()=>y.dispose()),{loggerService:w,communication:y,startEnvironment:y.startEnvironment.bind(y)}})}).call(this,n(30))},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";n.d(e,"a",(function(){return a}));var r=n(28),i=n.n(r),s=n(9),o=n(1);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()}),this.socketClient.on("reconnect",()=>{this.subscribers.emit("reconnect",void 0)})}postMessage(t){this.socketClient.emit("message",t)}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(0),i=n(2),s=n(16);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");return o.registerAPI({id:a},e),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=>n.apiProxy(t,{id:e},this.options)}}}},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 s}));var r=n(1),i=n(4);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(2),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(2),s=n(1);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),f=l.filter(([t,e])=>"input"!==e.mode&&Object(i.i)(e.providedFrom)),h=new o(this,a,n);t.features.set(this,h);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){h.addRunHandler(t,e)},onDispose(t){h.addOnDisposeHandler(t,e)},[r.g]:t.runOptions,runningEnvironmentName:e}),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>"),E=this.setupHandlers.get(e);v&&m.push(...v),b&&m.push(...b),E&&m.push(...E);for(const t of m){const e=t(p,s,d);if(e){for(const[t]of f)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 h}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(7);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.d(e,"a",(function(){return u})),n.d(e,"b",(function(){return l}));var r=n(3),i=n(6),s=n(0),o=n(1),a=n(9),c=n(10);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 o.b,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}getEnvironmentContext(t){return this.resolvedContexts[t.env]}getEnvironmentInstanceId(t,e){return"single"===e?t:this.generateEnvInstanceID(t)}getPublicPath(){return this.options.publicPath}startEnvironment(t,e){return e(this,t)}setTopology(t,e){this.topology[t]=e}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)}dispose(){for(const{host:t}of Object.values(this.environments))t instanceof c.a&&t.subscribers.clear(),t.removeEventListener("message",this.handleEvent,!0);for(const[t,{timerId:e}]of Object.entries(this.callbacks))clearTimeout(e),delete this.callbacks[t]}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)})}async reconnectHandlers(t){const e=`${this.rootEnvId}__${t}_`;for(const n of this.handlers.keys())n.startsWith(e)&&await this.reconnectHandler(t,this.parseHandlerId(n,e))}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){const{promise:e,resolve:n}=function(){let t,e;return{promise:new Promise((n,r)=>{t=n,e=r}),resolve:t,reject:e}}();return this.pendingEnvs.add(t,()=>n()),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})}}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,f;const h=(null===(u=s[n])||void 0===u?void 0:u.removeAllListeners)||(null===(d=s[n])||void 0===d?void 0:d.removeListener);if(h){const u=this.getHandlerId(t,e,h),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===(f=s[n])||void 0===f||!f.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.deleteKey(t);const n=this.pendingMessages.get(t);if(n){for(const t of n)t();this.pendingMessages.deleteKey(t)}for(const t of e)t()}}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)(d(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,d(t)))},this.slowThreshold);const o=setTimeout(()=>{s(new Error(Object(r.a)(e,this.rootEnvId,d(t))))},this.callbackTimeout);this.callbacks[e]={timerId:o,resolve:t=>{delete this.callbacks[e],clearTimeout(o),n(t)},reject:s}}}const d=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 l(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.r(e);var r=n(9);n.d(e,"BaseHost",(function(){return r.a}));var i=n(18);n.d(e,"Communication",(function(){return i.a})),n.d(e,"declareComEmitter",(function(){return i.b}));var s=n(3);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(6);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(13);n.d(e,"LoggerService",(function(){return a.a}));var c=n(20);for(var u in c)["BaseHost","Communication","declareComEmitter","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(10);n.d(e,"WsClientHost",(function(){return l.a}));var f=n(23);n.d(e,"ManagedIframe",(function(){return f.a}));var h=n(26);n.d(e,"socketServerInitializer",(function(){return h.c})),n.d(e,"windowInitializer",(function(){return h.d})),n.d(e,"initializeContextualEnv",(function(){return h.b})),n.d(e,"workerInitializer",(function(){return h.e})),n.d(e,"iframeInitializer",(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,"d",(function(){return o})),n.d(e,"b",(function(){return a})),n.d(e,"e",(function(){return c})),n.d(e,"c",(function(){return u})),n.d(e,"a",(function(){return d}));var r=n(8),i=n(12),s=n(1);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))]),[f]=l,h=new i.a([r.a.use({config:{resolvedContexts:d,publicPath:a}}),...n],s).run(f,o);return{async dispose(){for(const t of l)await h.dispose(t,o)}}}function u(t){for(;t.parent&&t.parent!==t&&d(t.parent);)t=t.parent;return t}function d(t){try{return"string"==typeof t.location.search}catch(t){return!1}}},function(t,e,n){"use strict";n.d(e,"c",(function(){return i})),n.d(e,"d",(function(){return a})),n.d(e,"b",(function(){return c})),n.d(e,"e",(function(){return u})),n.d(e,"a",(function(){return l}));var r=n(10);function i(){return async(t,{env:e})=>{const n=t.topology[e];if(!n)throw new Error(`Could not find node topology for ${e} environment`);const i=e,s=new r.a(n);return t.registerMessageHandler(s),t.registerEnv(i,s),await s.connected,t.handleReady({from:i}),{id:i,onDisconnect:t=>{s.subscribers.listeners.add("disconnect",t)},onReconnect:t=>{s.subscribers.listeners.add("reconnect",t)}}}}var s=n(6),o=n(1);function a({host:t}){return async(e,{env:n,endpointType:r})=>{const i=e.getEnvironmentInstanceId(n,r),a=Object(s.b)(t)?t.contentWindow:t;if(!a)throw new Error("cannot spawn detached iframe.");return await Object(o.e)(a,i,`${e.getPublicPath()}${n}.web.js${location.search}`),{id:i}}}function c({env:t,environments:e},n){return r=>{const i=r.resolvedContexts[t],s=e.find(t=>t.env===i);if(!s)throw new Error(`${i} cannot be found in definition of ${t} environment`);if(s.env in n){const e=s.env,i=n[e];if(!i)throw new Error(`environment initializer is not set for ${s.env}`);return r.startEnvironment(Object.assign(Object.assign({},s),{env:t}),i)}throw new Error("error")}}function u(){return async(t,{env:e,endpointType:n})=>{const r="single"===n?e:t.generateEnvInstanceID(e),i=new Worker(`${t.getPublicPath()}${e}.webworker.js${location.search}`,{name:r});return t.registerMessageHandler(i),t.registerEnv(r,i),await t.envReady(r),{id:r}}}var d=n(3);function l({hashParams:t,iframeElement:e,managed:n,src:r}){return async(i,{env:a,endpointType:c})=>{const u=i.getEnvironmentInstanceId(a,c);if(!e)throw new Error("should provide a host provider function to the current iframe to initialize");const l=i.getPublicPath();return n?await async function(t,e,n,r){const i=e.contentWindow;if(!i)throw new Error("cannot spawn detached iframe.");await function(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})}(i,e,n,r);const s=()=>t.reconnectHandlers(n);e.addEventListener("load",()=>{t.envReady(n).then(s).catch(d.k)}),t.registerEnv(n,i),await t.envReady(n)}(i,e,u,null!=r?r:f(a,l,t)):await async function(t,e,n,r){const i=Object(s.b)(e)?e.contentWindow:e;if(!i)throw new Error("cannot spawn detached iframe.");t.registerEnv(n,i),await Object(o.e)(i,n,r),await t.envReady(n)}(i,e,u,null!=r?r:h(a,l)),{id:u}}}const f=(t,e="",n)=>`${e}${t}.html${location.search}${null!=n?n:""}`,h=(t,e="")=>`${e}${t}.web.js${location.search}`},function(t,e,n){"use strict";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}));var r=n(14),i=n(2),s=n(15),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 f(t,e){return(n,r)=>t(n,r)||e(n,r)}const{hasOwnProperty:h}=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(h.call(t,n)){const[r,i]=t[n];e=f(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(16),v=n(11),b=n(17)},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(1);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.f})),n.d(e,"flattenTree",(function(){return s.d})),n.d(e,"injectScript",(function(){return s.e}));var o=n(27);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","injectScript","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(7);n.d(e,"runtimeType",(function(){return c.a}));var u=n(25);n.d(e,"run",(function(){return u.d})),n.d(e,"getFeaturesDeep",(function(){return u.b})),n.d(e,"runEngineApp",(function(){return u.e})),n.d(e,"getTopWindow",(function(){return u.c})),n.d(e,"canAccessWindow",(function(){return u.a}));var d=n(12);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 f=n(4);n.d(e,"LogLevel",(function(){return f.a}));var h=n(8);n.d(e,"COM",(function(){return h.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 f(){d&&c&&(d=!1,c.length?u=c.concat(u):l=-1,u.length&&h())}function h(){if(!d){var t=a(f);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(h)},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=29)}([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.for("__ENGINE__RUN"),i=Symbol.for("__ENGINE__DISPOSE"),s=Symbol.for("__ENGINE__IDENTIFY_API"),o=Symbol.for("__ENGINE__CREATE"),a=Symbol.for("__ENGINE__REGISTER_VALUE"),c=Symbol.for("__ENGINE__SERVICE_CONFIG"),u=Symbol.for("__ENGINE__RUN_OPTIONS"),d=Symbol.for("__ENGINE__CONFIGURABLE")},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}}n.d(e,"c",(function(){return r})),n.d(e,"a",(function(){return s})),n.d(e,"b",(function(){return i})),n.d(e,"f",(function(){return o})),n.d(e,"d",(function(){return a})),n.d(e,"e",(function(){return c}));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}function c(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)})}},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 f})),n.d(e,"g",(function(){return h})),n.d(e,"j",(function(){return p})),n.d(e,"i",(function(){return g}));var r=n(7);class i{constructor(t,e,n){this.env=t,this.envType=e,this.endpointType=n}}class s{constructor(t,e){this.env=t,this.activeEnvironmentName=e}}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)}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 f(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 h(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";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 f})),n.d(e,"k",(function(){return h}));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`,f=(t,e)=>`Missing ${t} when trying to get remote service api proxy for ${e}`;function h(t){console.error(t)}},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,"a",(function(){return s}));var r=n(7),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"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";function r(t){return Symbol(t)}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";(function(t){var r=n(9),i=n(18),s=n(13),o=n(14),a=n(2),c=n(15),u=n(11),d=n(17),l=n(0),f=n(4);e.a=new c.a({id:"COM",api:{config:o.a.withType().defineEntity({id:"",loggerSeverity:f.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),startEnvironment: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:f},loggerTransports:h,[l.g]:p,runningEnvironmentName:g,onDispose:m})=>{const v=void 0!==t&&"browser"!==t.title,b=n||e&&e.name||"undefined"!=typeof self&&self.name||g,E={warnOnSlow:p.has("warnOnSlow"),publicPath:f},y=new i.a(v?e||new r.a:self,b,o,d,v,E),w=new s.a(h,{environment:y.getEnvironmentId()},{severity:c,maxLogMessages:a,logToConsole:u});return m(()=>y.dispose()),{loggerService:w,communication:y,startEnvironment:y.startEnvironment.bind(y)}})}).call(this,n(30))},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";n.d(e,"a",(function(){return a}));var r=n(28),i=n.n(r),s=n(9),o=n(1);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()}),this.socketClient.on("reconnect",()=>{this.subscribers.emit("reconnect",void 0)})}postMessage(t){this.socketClient.emit("message",t)}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(0),i=n(2),s=n(16);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");return o.registerAPI({id:a},e),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=>n.apiProxy(t,{id:e},this.options)}}}},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 s}));var r=n(1),i=n(4);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(2),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(2),s=n(1);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),f=l.filter(([t,e])=>"input"!==e.mode&&Object(i.i)(e.providedFrom)),h=new o(this,a,n);t.features.set(this,h);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){h.addRunHandler(t,e)},onDispose(t){h.addOnDisposeHandler(t,e)},[r.g]:t.runOptions,runningEnvironmentName:e}),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>"),E=this.setupHandlers.get(e);v&&m.push(...v),b&&m.push(...b),E&&m.push(...E);for(const t of m){const e=t(p,s,d);if(e){for(const[t]of f)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 h}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(7);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.d(e,"a",(function(){return u})),n.d(e,"b",(function(){return l}));var r=n(3),i=n(6),s=n(0),o=n(1),a=n(9),c=n(10);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 o.b,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}getEnvironmentContext(t){return this.resolvedContexts[t.env]}getEnvironmentInstanceId(t,e){return"single"===e?t:this.generateEnvInstanceID(t)}getPublicPath(){return this.options.publicPath}startEnvironment(t,e){return e(this,t)}setTopology(t,e){this.topology[t]=e}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)}dispose(){for(const{host:t}of Object.values(this.environments))t instanceof c.a&&t.subscribers.clear(),t.removeEventListener("message",this.handleEvent,!0);for(const[t,{timerId:e}]of Object.entries(this.callbacks))clearTimeout(e),delete this.callbacks[t]}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)})}async reconnectHandlers(t){const e=`${this.rootEnvId}__${t}_`;for(const n of this.handlers.keys())n.startsWith(e)&&await this.reconnectHandler(t,this.parseHandlerId(n,e))}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){const{promise:e,resolve:n}=function(){let t,e;return{promise:new Promise((n,r)=>{t=n,e=r}),resolve:t,reject:e}}();return this.pendingEnvs.add(t,()=>n()),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})}}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,f;const h=(null===(u=s[n])||void 0===u?void 0:u.removeAllListeners)||(null===(d=s[n])||void 0===d?void 0:d.removeListener);if(h){const u=this.getHandlerId(t,e,h),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===(f=s[n])||void 0===f?void 0:f.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.deleteKey(t);const n=this.pendingMessages.get(t);if(n){for(const t of n)t();this.pendingMessages.deleteKey(t)}for(const t of e)t()}}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)(d(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,d(t)))},this.slowThreshold);const o=setTimeout(()=>{s(new Error(Object(r.a)(e,this.rootEnvId,d(t))))},this.callbackTimeout);this.callbacks[e]={timerId:o,resolve:t=>{delete this.callbacks[e],clearTimeout(o),n(t)},reject:s}}}const d=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 l(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.r(e);var r=n(9);n.d(e,"BaseHost",(function(){return r.a}));var i=n(18);n.d(e,"Communication",(function(){return i.a})),n.d(e,"declareComEmitter",(function(){return i.b}));var s=n(3);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(6);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(13);n.d(e,"LoggerService",(function(){return a.a}));var c=n(20);for(var u in c)["BaseHost","Communication","declareComEmitter","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(10);n.d(e,"WsClientHost",(function(){return l.a}));var f=n(23);n.d(e,"ManagedIframe",(function(){return f.a}));var h=n(26);n.d(e,"socketServerInitializer",(function(){return h.c})),n.d(e,"windowInitializer",(function(){return h.d})),n.d(e,"initializeContextualEnv",(function(){return h.b})),n.d(e,"workerInitializer",(function(){return h.e})),n.d(e,"iframeInitializer",(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,"d",(function(){return o})),n.d(e,"b",(function(){return a})),n.d(e,"e",(function(){return c})),n.d(e,"c",(function(){return u})),n.d(e,"a",(function(){return d}));var r=n(8),i=n(12),s=n(1);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))]),[f]=l,h=new i.a([r.a.use({config:{resolvedContexts:d,publicPath:a}}),...n],s).run(f,o);return{async dispose(){for(const t of l)await h.dispose(t,o)}}}function u(t){for(;t.parent&&t.parent!==t&&d(t.parent);)t=t.parent;return t}function d(t){try{return"string"==typeof t.location.search}catch(t){return!1}}},function(t,e,n){"use strict";n.d(e,"c",(function(){return i})),n.d(e,"d",(function(){return a})),n.d(e,"b",(function(){return c})),n.d(e,"e",(function(){return u})),n.d(e,"a",(function(){return l}));var r=n(10);function i(){return async(t,{env:e})=>{const n=t.topology[e];if(!n)throw new Error(`Could not find node topology for ${e} environment`);const i=e,s=new r.a(n);return t.registerMessageHandler(s),t.registerEnv(i,s),await s.connected,t.handleReady({from:i}),{id:i,onDisconnect:t=>{s.subscribers.listeners.add("disconnect",t)},onReconnect:t=>{s.subscribers.listeners.add("reconnect",t)}}}}var s=n(6),o=n(1);function a({host:t}){return async(e,{env:n,endpointType:r})=>{const i=e.getEnvironmentInstanceId(n,r),a=Object(s.b)(t)?t.contentWindow:t;if(!a)throw new Error("cannot spawn detached iframe.");return await Object(o.e)(a,i,`${e.getPublicPath()}${n}.web.js${location.search}`),{id:i}}}function c({env:t,environments:e},n){return r=>{const i=r.resolvedContexts[t],s=e.find(t=>t.env===i);if(!s)throw new Error(`${i} cannot be found in definition of ${t} environment`);if(s.env in n){const e=s.env,i=n[e];if(!i)throw new Error(`environment initializer is not set for ${s.env}`);return r.startEnvironment(Object.assign(Object.assign({},s),{env:t}),i)}throw new Error("error")}}function u(){return async(t,{env:e,endpointType:n})=>{const r="single"===n?e:t.generateEnvInstanceID(e),i=new Worker(`${t.getPublicPath()}${e}.webworker.js${location.search}`,{name:r});return t.registerMessageHandler(i),t.registerEnv(r,i),await t.envReady(r),{id:r}}}var d=n(3);function l({hashParams:t,iframeElement:e,managed:n,src:r}){return async(i,{env:a,endpointType:c})=>{const u=i.getEnvironmentInstanceId(a,c);if(!e)throw new Error("should provide a host provider function to the current iframe to initialize");const l=i.getPublicPath();return n?await async function(t,e,n,r){const i=e.contentWindow;if(!i)throw new Error("cannot spawn detached iframe.");await function(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})}(i,e,n,r);const s=()=>t.reconnectHandlers(n);e.addEventListener("load",()=>{t.envReady(n).then(s).catch(d.k)}),t.registerEnv(n,i),await t.envReady(n)}(i,e,u,null!=r?r:f(a,l,t)):await async function(t,e,n,r){const i=Object(s.b)(e)?e.contentWindow:e;if(!i)throw new Error("cannot spawn detached iframe.");t.registerEnv(n,i),await Object(o.e)(i,n,r),await t.envReady(n)}(i,e,u,null!=r?r:h(a,l)),{id:u}}}const f=(t,e="",n)=>`${e}${t}.html${location.search}${null!=n?n:""}`,h=(t,e="")=>`${e}${t}.web.js${location.search}`},function(t,e,n){"use strict";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}));var r=n(14),i=n(2),s=n(15),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 f(t,e){return(n,r)=>t(n,r)||e(n,r)}const{hasOwnProperty:h}=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(h.call(t,n)){const[r,i]=t[n];e=f(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(16),v=n(11),b=n(17)},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(1);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.f})),n.d(e,"flattenTree",(function(){return s.d})),n.d(e,"injectScript",(function(){return s.e}));var o=n(27);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","injectScript","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(7);n.d(e,"runtimeType",(function(){return c.a}));var u=n(25);n.d(e,"run",(function(){return u.d})),n.d(e,"getFeaturesDeep",(function(){return u.b})),n.d(e,"runEngineApp",(function(){return u.e})),n.d(e,"getTopWindow",(function(){return u.c})),n.d(e,"canAccessWindow",(function(){return u.a}));var d=n(12);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 f=n(4);n.d(e,"LogLevel",(function(){return f.a}));var h=n(8);n.d(e,"COM",(function(){return h.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 f(){d&&c&&(d=!1,c.length?u=c.concat(u):l=-1,u.length&&h())}function h(){if(!d){var t=a(f);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(h)},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

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