@sockethub/client 5.0.0-alpha.3 → 5.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  export interface ActivityObjectManager {
2
- create(obj: any): any;
2
+ create(obj: unknown): unknown;
3
3
  delete(id: string): boolean;
4
4
  list(): Array<string>;
5
- get(id: string, expand: boolean): any;
5
+ get(id: string, expand?: boolean): unknown;
6
6
  }
7
7
  export interface ASManager {
8
- Stream(meta: any): any;
8
+ Stream(meta: unknown): unknown;
9
9
  Object: ActivityObjectManager;
10
10
  emit(event: any, obj: any): void;
11
11
  on(event: any, func: any): void;
@@ -7,7 +7,7 @@
7
7
  var a = factory();
8
8
  for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
9
9
  }
10
- })(self, function() {
10
+ })(self, () => {
11
11
  return /******/ (() => { // webpackBootstrap
12
12
  /******/ var __webpack_modules__ = ({
13
13
 
@@ -131,7 +131,7 @@ var keys = __webpack_require__(255)
131
131
  , value = __webpack_require__(110)
132
132
  , max = Math.max;
133
133
 
134
- module.exports = function (dest, src/*, …srcn*/) {
134
+ module.exports = function (dest, src /*, …srcn*/) {
135
135
  var error, i, length = max(arguments.length, 2), assign;
136
136
  dest = Object(value(dest));
137
137
  assign = function (key) {
@@ -225,7 +225,7 @@ var process = function (src, obj) {
225
225
  };
226
226
 
227
227
  // eslint-disable-next-line no-unused-vars
228
- module.exports = function (opts1/*, …options*/) {
228
+ module.exports = function (opts1 /*, …options*/) {
229
229
  var result = create(null);
230
230
  forEach.call(arguments, function (options) {
231
231
  if (!isValue(options)) return;
@@ -302,7 +302,7 @@ module.exports = function () {
302
302
 
303
303
  var indexOf = String.prototype.indexOf;
304
304
 
305
- module.exports = function (searchString/*, position*/) {
305
+ module.exports = function (searchString /*, position*/) {
306
306
  return indexOf.call(this, searchString, arguments[1]) > -1;
307
307
  };
308
308
 
@@ -582,10 +582,10 @@ const ee = EventEmitter(),
582
582
  'id', 'type', 'context',
583
583
  'alias', 'attachedTo', 'attachment', 'attributedTo', 'attributedWith',
584
584
  'content', 'contentMap', 'context', 'contextOf', 'name', 'endTime', 'generator',
585
- 'generatorOf', 'group', 'icon', 'image', 'inReplyTo', 'members', 'memberOf',
586
- 'message', 'location', 'locationOf', 'objectOf', 'originOf', 'presence',
587
- 'preview', 'previewOf', 'provider', 'providerOf', 'published', 'rating',
588
- 'relationship', 'resultOf', 'replies', 'role', 'scope', 'scopeOf', 'startTime',
585
+ 'generatorOf', 'group', 'icon', 'image', 'inReplyTo', 'members', 'memberOf',
586
+ 'message', 'location', 'locationOf', 'objectOf', 'originOf', 'presence',
587
+ 'preview', 'previewOf', 'provider', 'providerOf', 'published', 'rating',
588
+ 'relationship', 'resultOf', 'replies', 'role', 'scope', 'scopeOf', 'startTime',
589
589
  'status', 'summary', 'topic', 'tag', 'tagOf', 'targetOf', 'title', 'titleMap',
590
590
  'updated', 'url'
591
591
  ]
@@ -615,6 +615,7 @@ const ee = EventEmitter(),
615
615
 
616
616
  let objs = new Map(),
617
617
  failOnUnknownObjectProperties = false,
618
+ warnOnUnknownObjectProperties = true,
618
619
  specialObjs = [], // the objects don't get rejected for bad props
619
620
  customProps = {};
620
621
 
@@ -639,7 +640,7 @@ function validateObject(type, obj = {}) {
639
640
  for (let key of unknownKeys) {
640
641
  if (rename[key]) {
641
642
  // rename property instead of fail
642
- obj = renameProp(obj, key)
643
+ obj = renameProp(obj, key);
643
644
  continue;
644
645
  }
645
646
 
@@ -654,7 +655,7 @@ function validateObject(type, obj = {}) {
654
655
  const err = `invalid property: "${key}"`;
655
656
  if (failOnUnknownObjectProperties) {
656
657
  throw new Error(err);
657
- } else {
658
+ } else if (warnOnUnknownObjectProperties) {
658
659
  console.warn(err);
659
660
  }
660
661
  }
@@ -702,7 +703,7 @@ function Stream(meta) {
702
703
  if (typeof meta.object === 'object') {
703
704
  validateObject('object', meta.object);
704
705
  }
705
- const stream = expandStream(meta)
706
+ const stream = expandStream(meta);
706
707
  ee.emit('activity-stream', stream);
707
708
  return stream;
708
709
  }
@@ -744,7 +745,10 @@ const _Object = {
744
745
 
745
746
  function ASFactory(opts = {}) {
746
747
  specialObjs = opts.specialObjs || [];
747
- failOnUnknownObjectProperties = typeof opts.failOnUnknownObjectProperties === 'boolean' ? opts.failOnUnknownObjectProperties : false;
748
+ failOnUnknownObjectProperties = typeof opts.failOnUnknownObjectProperties === 'boolean' ?
749
+ opts.failOnUnknownObjectProperties : failOnUnknownObjectProperties;
750
+ warnOnUnknownObjectProperties = typeof opts.warnOnUnknownObjectProperties === 'boolean' ?
751
+ opts.warnOnUnknownObjectProperties : warnOnUnknownObjectProperties;
748
752
  for (let propName of Object.keys(opts.customProps || {})) {
749
753
  if (typeof opts.customProps[propName] === 'object') {
750
754
  customProps[propName] = opts.customProps[propName];
@@ -767,7 +771,7 @@ function ASFactory(opts = {}) {
767
771
  }
768
772
 
769
773
  if ( true && module.exports) {
770
- module.exports = ASFactory
774
+ module.exports = ASFactory;
771
775
  }
772
776
  if (typeof window === 'object') {
773
777
  window.ASFactory = ASFactory;
@@ -801,7 +805,6 @@ class SockethubClient {
801
805
  throw new Error('SockethubClient requires a socket.io instance');
802
806
  }
803
807
  this._socket = socket;
804
- // @ts-ignore
805
808
  this.ActivityStreams = (0, activity_streams_1.default)({ specialObjs: ['credentials'] });
806
809
  this.socket = this.createPublicEmitter();
807
810
  this.registerSocketIOHandlers();
@@ -820,12 +823,15 @@ class SockethubClient {
820
823
  });
821
824
  }
822
825
  createPublicEmitter() {
823
- let socket = new eventemitter2_1.EventEmitter2({
826
+ const socket = new eventemitter2_1.EventEmitter2({
824
827
  wildcard: true,
825
828
  verboseMemoryLeak: false
826
829
  });
830
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
827
831
  // @ts-ignore
828
832
  socket._emit = socket.emit;
833
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
834
+ // @ts-ignore
829
835
  socket.emit = (event, content, callback) => {
830
836
  if (event === 'credentials') {
831
837
  this.eventCredentials(content);
@@ -847,7 +853,8 @@ class SockethubClient {
847
853
  }
848
854
  eventCredentials(content) {
849
855
  if ((content.object) && (content.object.type === 'credentials')) {
850
- this.events['credentials'].set(content.actor.id || content.actor, content);
856
+ const key = content.actor.id || content.actor;
857
+ this.events['credentials'].set(key, content);
851
858
  }
852
859
  }
853
860
  eventMessage(content) {
@@ -869,11 +876,11 @@ class SockethubClient {
869
876
  }
870
877
  static getKey(content) {
871
878
  var _a;
872
- let actor = ((_a = content.actor) === null || _a === void 0 ? void 0 : _a.id) || content.actor;
879
+ const actor = ((_a = content.actor) === null || _a === void 0 ? void 0 : _a.id) || content.actor;
873
880
  if (!actor) {
874
881
  throw new Error("actor property not present for message type: " + (content === null || content === void 0 ? void 0 : content.type));
875
882
  }
876
- let target = content.target ? content.target.id || content.target : '';
883
+ const target = content.target ? content.target.id || content.target : '';
877
884
  return actor + '-' + target;
878
885
  }
879
886
  log(msg, obj) {
@@ -915,7 +922,6 @@ class SockethubClient {
915
922
  this._socket.emit(name, obj);
916
923
  });
917
924
  }
918
- ;
919
925
  }
920
926
  if ( true && module.exports) {
921
927
  module.exports = SockethubClient;
@@ -923,8 +929,8 @@ if ( true && module.exports) {
923
929
  if (true) {
924
930
  exports = SockethubClient; // lgtm [js/useless-assignment-to-local]
925
931
  }
926
- // @ts-ignore
927
932
  if (typeof window === 'object') {
933
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
928
934
  // @ts-ignore
929
935
  window.SockethubClient = SockethubClient;
930
936
  }
@@ -1036,7 +1042,7 @@ var __WEBPACK_AMD_DEFINE_RESULT__;/*!
1036
1042
  var obj = {};
1037
1043
  var key;
1038
1044
  var len = keys.length;
1039
- var valuesCount = values ? value.length : 0;
1045
+ var valuesCount = values ? values.length : 0;
1040
1046
  for (var i = 0; i < len; i++) {
1041
1047
  key = keys[i];
1042
1048
  obj[key] = i < valuesCount ? values[i] : undefined;
@@ -1 +1 @@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C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,OAAO,EAAE;IAChD,MAAM,CAAC,OAAO,GAAG,eAAe,CAAC;CAClC;AAED,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;IAC/B,OAAO,GAAG,eAAe,CAAC,CAAE,wCAAwC;CACrE;AAED,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;IAC9B,6DAA6D;IAC7D,aAAa;IACb,MAAM,CAAC,eAAe,GAAG,eAAe,CAAC;CAC1C"}
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see sockethub-client.min.js.LICENSE.txt */
2
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(function(){return e={423:(e,t,r)=>{"use strict";var n=r(132),i=r(421),s=r(240),o=r(343),c=r(50),l=e.exports=function(e,t){var r,i,l,a,f;return arguments.length<2||"string"!=typeof e?(a=t,t=e,e=null):a=arguments[2],n(e)?(r=c.call(e,"c"),i=c.call(e,"e"),l=c.call(e,"w")):(r=l=!0,i=!1),f={value:t,configurable:r,enumerable:i,writable:l},a?s(o(a),f):f};l.gs=function(e,t,r){var l,a,f,u;return"string"!=typeof e?(f=r,r=t,t=e,e=null):f=arguments[3],n(t)?i(t)?n(r)?i(r)||(f=r,r=void 0):r=void 0:(f=t,t=r=void 0):t=void 0,n(e)?(l=c.call(e,"c"),a=c.call(e,"e")):(l=!0,a=!1),u={get:t,set:r,configurable:l,enumerable:a},f?s(o(f),u):u}},91:e=>{"use strict";e.exports=function(){}},240:(e,t,r)=>{"use strict";e.exports=r(229)()?Object.assign:r(640)},229:e=>{"use strict";e.exports=function(){var e,t=Object.assign;return"function"==typeof t&&(t(e={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}},640:(e,t,r)=>{"use strict";var n=r(255),i=r(110),s=Math.max;e.exports=function(e,t){var r,o,c,l=s(arguments.length,2);for(e=Object(i(e)),c=function(n){try{e[n]=t[n]}catch(e){r||(r=e)}},o=1;o<l;++o)n(t=arguments[o]).forEach(c);if(void 0!==r)throw r;return e}},515:(e,t,r)=>{"use strict";var n=r(91)();e.exports=function(e){return e!==n&&null!==e}},255:(e,t,r)=>{"use strict";e.exports=r(291)()?Object.keys:r(184)},291:e=>{"use strict";e.exports=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}},184:(e,t,r)=>{"use strict";var n=r(515),i=Object.keys;e.exports=function(e){return i(n(e)?Object(e):e)}},343:(e,t,r)=>{"use strict";var n=r(515),i=Array.prototype.forEach,s=Object.create,o=function(e,t){var r;for(r in e)t[r]=e[r]};e.exports=function(e){var t=s(null);return i.call(arguments,(function(e){n(e)&&o(Object(e),t)})),t}},979:e=>{"use strict";e.exports=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}},110:(e,t,r)=>{"use strict";var n=r(515);e.exports=function(e){if(!n(e))throw new TypeError("Cannot use null or undefined");return e}},50:(e,t,r)=>{"use strict";e.exports=r(459)()?String.prototype.contains:r(131)},459:e=>{"use strict";var t="razdwatrzy";e.exports=function(){return"function"==typeof t.contains&&!0===t.contains("dwa")&&!1===t.contains("foo")}},131:e=>{"use strict";var t=String.prototype.indexOf;e.exports=function(e){return t.call(this,e,arguments[1])>-1}},360:(e,t,r)=>{"use strict";var n,i,s,o,c,l,a,f=r(423),u=r(979),h=Function.prototype.apply,p=Function.prototype.call,y=Object.create,v=Object.defineProperty,_=Object.defineProperties,m=Object.prototype.hasOwnProperty,d={configurable:!0,enumerable:!1,writable:!0};i=function(e,t){var r,i;return u(t),i=this,n.call(this,e,r=function(){s.call(i,e,r),h.call(t,this,arguments)}),r.__eeOnceListener__=t,this},o=function(e){var t,r,n,i,s;if(m.call(this,"__ee__")&&(i=this.__ee__[e]))if("object"==typeof i){for(r=arguments.length,s=new Array(r-1),t=1;t<r;++t)s[t-1]=arguments[t];for(i=i.slice(),t=0;n=i[t];++t)h.call(n,this,s)}else switch(arguments.length){case 1:p.call(i,this);break;case 2:p.call(i,this,arguments[1]);break;case 3:p.call(i,this,arguments[1],arguments[2]);break;default:for(r=arguments.length,s=new Array(r-1),t=1;t<r;++t)s[t-1]=arguments[t];h.call(i,this,s)}},c={on:n=function(e,t){var r;return u(t),m.call(this,"__ee__")?r=this.__ee__:(r=d.value=y(null),v(this,"__ee__",d),d.value=null),r[e]?"object"==typeof r[e]?r[e].push(t):r[e]=[r[e],t]:r[e]=t,this},once:i,off:s=function(e,t){var r,n,i,s;if(u(t),!m.call(this,"__ee__"))return this;if(!(r=this.__ee__)[e])return this;if("object"==typeof(n=r[e]))for(s=0;i=n[s];++s)i!==t&&i.__eeOnceListener__!==t||(2===n.length?r[e]=n[s?0:1]:n.splice(s,1));else n!==t&&n.__eeOnceListener__!==t||delete r[e];return this},emit:o},l={on:f(n),once:f(i),off:f(s),emit:f(o)},a=_({},l),e.exports=t=function(e){return null==e?y(a):_(Object(e),l)},t.methods=c},414:(e,t,r)=>{"use strict";var n=r(670);e.exports=function(e){if("function"!=typeof e)return!1;if(!hasOwnProperty.call(e,"length"))return!1;try{if("number"!=typeof e.length)return!1;if("function"!=typeof e.call)return!1;if("function"!=typeof e.apply)return!1}catch(e){return!1}return!n(e)}},783:(e,t,r)=>{"use strict";var n=r(132),i={object:!0,function:!0,undefined:!0};e.exports=function(e){return!!n(e)&&hasOwnProperty.call(i,typeof e)}},421:(e,t,r)=>{"use strict";var n=r(414),i=/^\s*class[\s{/}]/,s=Function.prototype.toString;e.exports=function(e){return!!n(e)&&!i.test(s.call(e))}},670:(e,t,r)=>{"use strict";var n=r(783);e.exports=function(e){if(!n(e))return!1;try{return!!e.constructor&&e.constructor.prototype===e}catch(e){return!1}}},132:e=>{"use strict";e.exports=function(e){return null!=e}},744:(e,t,r)=>{const n=r(360)(),i={stream:["id","type","actor","target","object","context","context","published","error"],object:["id","type","context","alias","attachedTo","attachment","attributedTo","attributedWith","content","contentMap","context","contextOf","name","endTime","generator","generatorOf","group","icon","image","inReplyTo","members","memberOf","message","location","locationOf","objectOf","originOf","presence","preview","previewOf","provider","providerOf","published","rating","relationship","resultOf","replies","role","scope","scopeOf","startTime","status","summary","topic","tag","tagOf","targetOf","title","titleMap","updated","url"]},s={"@id":"id","@type":"type",verb:"type",displayName:"name",objectType:"type",platform:"context"},o={actor:{primary:"id",props:i},target:{primary:"id",props:i},object:{primary:"content",props:i}};let c=new Map,l=!1,a=[],f={};function u(e,t){return!("object"!=typeof f[e]||!f[e].includes(t))}function h(e,t){return e[s[t]]=e[t],delete e[t],e}function p(e,t={}){const r=Object.keys(t).filter((t=>{if(!i[e].includes(t))return t}));for(let e of r)if(s[e])t=h(t,e);else if(!u(t.type,e)&&!a.includes(t.type)){const t=`invalid property: "${e}"`;if(l)throw new Error(t);console.warn(t)}}function y(e){p("stream",e),"object"==typeof e.object&&p("object",e.object);const t=function(e){let t={};for(let r of Object.keys(e))if("string"==typeof e[r])t[r]=c.get(e[r])||e[r];else if(Array.isArray(e[r])){t[r]=[];for(let n of e[r])"string"==typeof n&&t[r].push(c.get(n)||n)}else t[r]=e[r];for(let e of Object.keys(o))if("string"==typeof t[e]){let r={};r[o[e].primary]=t[e],t[e]=r}return t}(e);return n.emit("activity-stream",t),t}const v={create:function(e){return p("object",e),e=e,c.set(e.id,e),n.emit("activity-object-create",e),e},delete:function(e){const t=c.delete(e);return t&&n.emit("activity-object-delete",e),t},get:function(e,t){let r=c.get(e);if(!r){if(!t)return e;r={id:e}}return r},list:function(){return c.keys()}};function _(e={}){a=e.specialObjs||[],l="boolean"==typeof e.failOnUnknownObjectProperties&&e.failOnUnknownObjectProperties;for(let t of Object.keys(e.customProps||{}))"object"==typeof e.customProps[t]&&(f[t]=e.customProps[t]);return{Stream:y,Object:v,on:function(e,t){return n.on(e,t)},once:function(e,t){return n.once(e,t)},off:function(e,t){return n.off(e,t)}}}e.exports&&(e.exports=_),"object"==typeof window&&(window.ASFactory=_)},650:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(387),s=n(r(744));class o{constructor(e){if(this.events={credentials:new Map,"activity-object":new Map,connect:new Map,join:new Map},this.online=!1,this.debug=!0,!e)throw new Error("SockethubClient requires a socket.io instance");this._socket=e,this.ActivityStreams=(0,s.default)({specialObjs:["credentials"]}),this.socket=this.createPublicEmitter(),this.registerSocketIOHandlers(),this.ActivityStreams.on("activity-object-create",(t=>{e.emit("activity-object",t,(e=>{e?console.error("failed to create activity-object ",e):this.eventActivityObject(t)}))})),e.on("activity-object",(e=>{this.ActivityStreams.Object.create(e)}))}createPublicEmitter(){let e=new i.EventEmitter2({wildcard:!0,verboseMemoryLeak:!1});return e._emit=e.emit,e.emit=(e,t,r)=>{"credentials"===e?this.eventCredentials(t):"activity-object"===e?this.eventActivityObject(t):"message"===e&&this.eventMessage(t),this._socket.emit(e,t,r)},e}eventActivityObject(e){e.id&&this.events["activity-object"].set(e.id,e)}eventCredentials(e){e.object&&"credentials"===e.object.type&&this.events.credentials.set(e.actor.id||e.actor,e)}eventMessage(e){if(!this.online)return;const t=o.getKey(e);"join"===e.type||"connect"===e.type?this.events[e.type].set(t,e):"leave"===e.type?this.events.join.delete(t):"disconnect"===e.type&&this.events.connect.delete(t)}static getKey(e){var t;let r=(null===(t=e.actor)||void 0===t?void 0:t.id)||e.actor;if(!r)throw new Error("actor property not present for message type: "+(null==e?void 0:e.type));return r+"-"+(e.target?e.target.id||e.target:"")}log(e,t){this.debug&&console.log(e,t)}registerSocketIOHandlers(){const e=e=>(t,r)=>{"connect"===e?(this.online=!0,this.replay("activity-object",this.events["activity-object"]),this.replay("credentials",this.events.credentials),this.replay("message",this.events.connect),this.replay("message",this.events.join)):"disconnect"===e&&(this.online=!1),this.socket._emit(e,t,r)};this._socket.on("connect",e("connect")),this._socket.on("connect_error",e("connect_error")),this._socket.on("disconnect",e("disconnect")),this._socket.on("message",((e,t)=>{this.socket._emit("message",this.ActivityStreams.Stream(e),t)}))}replay(e,t){t.forEach((t=>{this.log(`replaying ${e}`,t),this._socket.emit(e,t)}))}}e.exports&&(e.exports=o),t=o,"object"==typeof window&&(window.SockethubClient=o)},387:(e,t,r)=>{var n;!function(i){var s=Object.hasOwnProperty,o=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},c="object"==typeof process&&"function"==typeof process.nextTick,l="function"==typeof Symbol,a="object"==typeof Reflect,f="function"==typeof setImmediate?setImmediate:setTimeout,u=l?a&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function h(){this._events={},this._conf&&p.call(this,this._conf)}function p(e){e&&(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),e.maxListeners!==i&&(this._maxListeners=e.maxListeners),e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this._newListener=e.newListener),e.removeListener&&(this._removeListener=e.removeListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),e.ignoreErrors&&(this.ignoreErrors=e.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function y(e,t){var r="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(r+=" Event name: "+t+"."),"undefined"!=typeof process&&process.emitWarning){var n=new Error(r);n.name="MaxListenersExceededWarning",n.emitter=this,n.count=e,process.emitWarning(n)}else console.error(r),console.trace&&console.trace()}var v=function(e,t,r){var n=arguments.length;switch(n){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,r];default:for(var i=new Array(n);n--;)i[n]=arguments[n];return i}};function _(e,t){for(var r={},n=e.length,s=t?value.length:0,o=0;o<n;o++)r[e[o]]=o<s?t[o]:i;return r}function m(e,t,r){var n,i;if(this._emitter=e,this._target=t,this._listeners={},this._listenersCount=0,(r.on||r.off)&&(n=r.on,i=r.off),t.addEventListener?(n=t.addEventListener,i=t.removeEventListener):t.addListener?(n=t.addListener,i=t.removeListener):t.on&&(n=t.on,i=t.off),!n&&!i)throw Error("target does not implement any known event API");if("function"!=typeof n)throw TypeError("on method must be a function");if("function"!=typeof i)throw TypeError("off method must be a function");this._on=n,this._off=i;var s=e._observers;s?s.push(this):e._observers=[this]}function d(e,t,r,n){var o=Object.assign({},t);if(!e)return o;if("object"!=typeof e)throw TypeError("options must be an object");var c,l,a,f=Object.keys(e),u=f.length;function h(e){throw Error('Invalid "'+c+'" option value'+(e?". Reason: "+e:""))}for(var p=0;p<u;p++){if(c=f[p],!n&&!s.call(t,c))throw Error('Unknown "'+c+'" option');(l=e[c])!==i&&(a=r[c],o[c]=a?a(l,h):l)}return o}function b(e,t){return"function"==typeof e&&e.hasOwnProperty("prototype")||t("value must be a constructor"),e}function g(e){var t="value must be type of "+e.join("|"),r=e.length,n=e[0],i=e[1];return 1===r?function(e,r){if(typeof e===n)return e;r(t)}:2===r?function(e,r){var s=typeof e;if(s===n||s===i)return e;r(t)}:function(n,i){for(var s=typeof n,o=r;o-- >0;)if(s===e[o])return n;i(t)}}Object.assign(m.prototype,{subscribe:function(e,t,r){var n=this,i=this._target,s=this._emitter,o=this._listeners,c=function(){var n=v.apply(null,arguments),o={data:n,name:t,original:e};if(r){var c=r.call(i,o);!1!==c&&s.emit.apply(s,[o.name].concat(n))}else s.emit.apply(s,[t].concat(n))};if(o[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,s._newListener&&s._removeListener&&!n._onNewListener?(this._onNewListener=function(r){r===t&&null===o[e]&&(o[e]=c,n._on.call(i,e,c))},s.on("newListener",this._onNewListener),this._onRemoveListener=function(r){r===t&&!s.hasListeners(r)&&o[e]&&(o[e]=null,n._off.call(i,e,c))},o[e]=null,s.on("removeListener",this._onRemoveListener)):(o[e]=c,n._on.call(i,e,c))},unsubscribe:function(e){var t,r,n,i=this,s=this._listeners,o=this._emitter,c=this._off,l=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function a(){i._onNewListener&&(o.off("newListener",i._onNewListener),o.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=O.call(o,i);o._observers.splice(e,1)}if(e){if(!(t=s[e]))return;c.call(l,e,t),delete s[e],--this._listenersCount||a()}else{for(n=(r=u(s)).length;n-- >0;)e=r[n],c.call(l,e,s[e]);this._listeners={},this._listenersCount=0,a()}}});var w=g(["function"]),j=g(["object","function"]);function L(e,t,r){var n,i,s,o=0,c=new e((function(l,a,f){function u(){i&&(i=null),o&&(clearTimeout(o),o=0)}r=d(r,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),n=!r.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof f;var h=function(e){u(),l(e)},p=function(e){u(),a(e)};n?t(h,p,f):(i=[function(e){p(e||Error("canceled"))}],t(h,p,(function(e){if(s)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)})),s=!0),r.timeout>0&&(o=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",o=0,c.cancel(e),a(e)}),r.timeout))}));return n||(c.cancel=function(e){if(i){for(var t=i.length,r=1;r<t;r++)i[r](e);i[0](e),i=null}}),c}function O(e){var t=this._observers;if(!t)return-1;for(var r=t.length,n=0;n<r;n++)if(t[n]._target===e)return n;return-1}function x(e,t,r,n,i){if(!r)return null;if(0===n){var s=typeof t;if("string"===s){var o,c,l=0,a=0,f=this.delimiter,h=f.length;if(-1!==(c=t.indexOf(f))){o=new Array(5);do{o[l++]=t.slice(a,c),a=c+h}while(-1!==(c=t.indexOf(f,a)));o[l++]=t.slice(a),t=o,i=l}else t=[t],i=1}else"object"===s?i=t.length:(t=[t],i=1)}var p,y,v,_,m,d,b,g=null,w=t[n],j=t[n+1];if(n===i)r._listeners&&("function"==typeof r._listeners?(e&&e.push(r._listeners),g=[r]):(e&&e.push.apply(e,r._listeners),g=[r]));else{if("*"===w){for(c=(d=u(r)).length;c-- >0;)"_listeners"!==(p=d[c])&&(b=x(e,t,r[p],n+1,i))&&(g?g.push.apply(g,b):g=b);return g}if("**"===w){for((m=n+1===i||n+2===i&&"*"===j)&&r._listeners&&(g=x(e,t,r,i,i)),c=(d=u(r)).length;c-- >0;)"_listeners"!==(p=d[c])&&("*"===p||"**"===p?(r[p]._listeners&&!m&&(b=x(e,t,r[p],i,i))&&(g?g.push.apply(g,b):g=b),b=x(e,t,r[p],n,i)):b=x(e,t,r[p],p===j?n+2:n,i),b&&(g?g.push.apply(g,b):g=b));return g}r[w]&&(g=x(e,t,r[w],n+1,i))}if((y=r["*"])&&x(e,t,y,n+1,i),v=r["**"])if(n<i)for(v._listeners&&x(e,t,v,i,i),c=(d=u(v)).length;c-- >0;)"_listeners"!==(p=d[c])&&(p===j?x(e,t,v[p],n+2,i):p===w?x(e,t,v[p],n+1,i):((_={})[p]=v[p],x(e,t,{"**":_},n+1,i)));else v._listeners?x(e,t,v,i,i):v["*"]&&v["*"]._listeners&&x(e,t,v["*"],i,i);return g}function k(e,t,r){var n,i,s=0,o=0,c=this.delimiter,l=c.length;if("string"==typeof e)if(-1!==(n=e.indexOf(c))){i=new Array(5);do{i[s++]=e.slice(o,n),o=n+l}while(-1!==(n=e.indexOf(c,o)));i[s++]=e.slice(o)}else i=[e],s=1;else i=e,s=e.length;if(s>1)for(n=0;n+1<s;n++)if("**"===i[n]&&"**"===i[n+1])return;var a,f=this.listenerTree;for(n=0;n<s;n++)if(f=f[a=i[n]]||(f[a]={}),n===s-1)return f._listeners?("function"==typeof f._listeners&&(f._listeners=[f._listeners]),r?f._listeners.unshift(t):f._listeners.push(t),!f._listeners.warned&&this._maxListeners>0&&f._listeners.length>this._maxListeners&&(f._listeners.warned=!0,y.call(this,f._listeners.length,a))):f._listeners=t,!0;return!0}function E(e,t,r,n){for(var i,s,o,c,l=u(e),a=l.length,f=e._listeners;a-- >0;)i=e[s=l[a]],o="_listeners"===s?r:r?r.concat(s):[s],c=n||"symbol"==typeof s,f&&t.push(c?o:o.join(this.delimiter)),"object"==typeof i&&E.call(this,i,t,o,c);return t}function T(e){for(var t,r,n,i=u(e),s=i.length;s-- >0;)(t=e[r=i[s]])&&(n=!0,"_listeners"===r||T(t)||delete e[r]);return n}function A(e,t,r){this.emitter=e,this.event=t,this.listener=r}function P(e,t,r){if(!0===r)s=!0;else if(!1===r)n=!0;else{if(!r||"object"!=typeof r)throw TypeError("options should be an object or true");var n=r.async,s=r.promisify,o=r.nextTick,l=r.objectify}if(n||o||s){var a=t,u=t._origin||t;if(o&&!c)throw Error("process.nextTick is not supported");s===i&&(s="AsyncFunction"===t.constructor.name),t=function(){var e=arguments,t=this,r=this.event;return s?o?Promise.resolve():new Promise((function(e){f(e)})).then((function(){return t.event=r,a.apply(t,e)})):(o?process.nextTick:f)((function(){t.event=r,a.apply(t,e)}))},t._async=!0,t._origin=u}return[t,l?new A(this,e,t):this]}function M(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,p.call(this,e)}A.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},M.EventEmitter2=M,M.prototype.listenTo=function(e,t,r){if("object"!=typeof e)throw TypeError("target musts be an object");var n=this;function s(t){if("object"!=typeof t)throw TypeError("events must be an object");var i,s=r.reducers,o=O.call(n,e);i=-1===o?new m(n,e,r):n._observers[o];for(var c,l=u(t),a=l.length,f="function"==typeof s,h=0;h<a;h++)c=l[h],i.subscribe(c,t[c]||c,f?s:s&&s[c])}return r=d(r,{on:i,off:i,reducers:i},{on:w,off:w,reducers:j}),o(t)?s(_(t)):s("string"==typeof t?_(t.split(/\s+/)):t),this},M.prototype.stopListeningTo=function(e,t){var r=this._observers;if(!r)return!1;var n,i=r.length,s=!1;if(e&&"object"!=typeof e)throw TypeError("target should be an object");for(;i-- >0;)n=r[i],e&&n._target!==e||(n.unsubscribe(t),s=!0);return s},M.prototype.delimiter=".",M.prototype.setMaxListeners=function(e){e!==i&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},M.prototype.getMaxListeners=function(){return this._maxListeners},M.prototype.event="",M.prototype.once=function(e,t,r){return this._once(e,t,!1,r)},M.prototype.prependOnceListener=function(e,t,r){return this._once(e,t,!0,r)},M.prototype._once=function(e,t,r,n){return this._many(e,1,t,r,n)},M.prototype.many=function(e,t,r,n){return this._many(e,t,r,!1,n)},M.prototype.prependMany=function(e,t,r,n){return this._many(e,t,r,!0,n)},M.prototype._many=function(e,t,r,n,i){var s=this;if("function"!=typeof r)throw new Error("many only accepts instances of Function");function o(){return 0==--t&&s.off(e,o),r.apply(this,arguments)}return o._origin=r,this._on(e,o,n,i)},M.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||h.call(this);var e,t,r,n,i,s,o=arguments[0],c=this.wildcard;if("newListener"===o&&!this._newListener&&!this._events.newListener)return!1;if(c&&(e=o,"newListener"!==o&&"removeListener"!==o&&"object"==typeof o)){if(r=o.length,l)for(n=0;n<r;n++)if("symbol"==typeof o[n]){s=!0;break}s||(o=o.join(this.delimiter))}var a,f=arguments.length;if(this._all&&this._all.length)for(n=0,r=(a=this._all.slice()).length;n<r;n++)switch(this.event=o,f){case 1:a[n].call(this,o);break;case 2:a[n].call(this,o,arguments[1]);break;case 3:a[n].call(this,o,arguments[1],arguments[2]);break;default:a[n].apply(this,arguments)}if(c)a=[],x.call(this,a,e,this.listenerTree,0,r);else{if("function"==typeof(a=this._events[o])){switch(this.event=o,f){case 1:a.call(this);break;case 2:a.call(this,arguments[1]);break;case 3:a.call(this,arguments[1],arguments[2]);break;default:for(t=new Array(f-1),i=1;i<f;i++)t[i-1]=arguments[i];a.apply(this,t)}return!0}a&&(a=a.slice())}if(a&&a.length){if(f>3)for(t=new Array(f-1),i=1;i<f;i++)t[i-1]=arguments[i];for(n=0,r=a.length;n<r;n++)switch(this.event=o,f){case 1:a[n].call(this);break;case 2:a[n].call(this,arguments[1]);break;case 3:a[n].call(this,arguments[1],arguments[2]);break;default:a[n].apply(this,t)}return!0}if(!this.ignoreErrors&&!this._all&&"error"===o)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},M.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||h.call(this);var e,t,r,n,i,s,o=arguments[0],c=this.wildcard;if("newListener"===o&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(c&&(e=o,"newListener"!==o&&"removeListener"!==o&&"object"==typeof o)){if(n=o.length,l)for(i=0;i<n;i++)if("symbol"==typeof o[i]){t=!0;break}t||(o=o.join(this.delimiter))}var a,f=[],u=arguments.length;if(this._all)for(i=0,n=this._all.length;i<n;i++)switch(this.event=o,u){case 1:f.push(this._all[i].call(this,o));break;case 2:f.push(this._all[i].call(this,o,arguments[1]));break;case 3:f.push(this._all[i].call(this,o,arguments[1],arguments[2]));break;default:f.push(this._all[i].apply(this,arguments))}if(c?(a=[],x.call(this,a,e,this.listenerTree,0)):a=this._events[o],"function"==typeof a)switch(this.event=o,u){case 1:f.push(a.call(this));break;case 2:f.push(a.call(this,arguments[1]));break;case 3:f.push(a.call(this,arguments[1],arguments[2]));break;default:for(r=new Array(u-1),s=1;s<u;s++)r[s-1]=arguments[s];f.push(a.apply(this,r))}else if(a&&a.length){if(a=a.slice(),u>3)for(r=new Array(u-1),s=1;s<u;s++)r[s-1]=arguments[s];for(i=0,n=a.length;i<n;i++)switch(this.event=o,u){case 1:f.push(a[i].call(this));break;case 2:f.push(a[i].call(this,arguments[1]));break;case 3:f.push(a[i].call(this,arguments[1],arguments[2]));break;default:f.push(a[i].apply(this,r))}}else if(!this.ignoreErrors&&!this._all&&"error"===o)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(f)},M.prototype.on=function(e,t,r){return this._on(e,t,!1,r)},M.prototype.prependListener=function(e,t,r){return this._on(e,t,!0,r)},M.prototype.onAny=function(e){return this._onAny(e,!1)},M.prototype.prependAny=function(e){return this._onAny(e,!0)},M.prototype.addListener=M.prototype.on,M.prototype._onAny=function(e,t){if("function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),t?this._all.unshift(e):this._all.push(e),this},M.prototype._on=function(e,t,r,n){if("function"==typeof e)return this._onAny(e,t),this;if("function"!=typeof t)throw new Error("on only accepts instances of Function");this._events||h.call(this);var s,o=this;return n!==i&&(t=(s=P.call(this,e,t,n))[0],o=s[1]),this._newListener&&this.emit("newListener",e,t),this.wildcard?(k.call(this,e,t,r),o):(this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,y.call(this,this._events[e].length,e))):this._events[e]=t,o)},M.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r,n=[];if(this.wildcard){var i="string"==typeof e?e.split(this.delimiter):e.slice();if(!(n=x.call(this,null,i,this.listenerTree,0)))return this}else{if(!this._events[e])return this;r=this._events[e],n.push({_listeners:r})}for(var s=0;s<n.length;s++){var c=n[s];if(r=c._listeners,o(r)){for(var l=-1,a=0,f=r.length;a<f;a++)if(r[a]===t||r[a].listener&&r[a].listener===t||r[a]._origin&&r[a]._origin===t){l=a;break}if(l<0)continue;return this.wildcard?c._listeners.splice(l,1):this._events[e].splice(l,1),0===r.length&&(this.wildcard?delete c._listeners:delete this._events[e]),this._removeListener&&this.emit("removeListener",e,t),this}(r===t||r.listener&&r.listener===t||r._origin&&r._origin===t)&&(this.wildcard?delete c._listeners:delete this._events[e],this._removeListener&&this.emit("removeListener",e,t))}return this.listenerTree&&T(this.listenerTree),this},M.prototype.offAny=function(e){var t,r=0,n=0;if(e&&this._all&&this._all.length>0){for(r=0,n=(t=this._all).length;r<n;r++)if(e===t[r])return t.splice(r,1),this._removeListener&&this.emit("removeListenerAny",e),this}else{if(t=this._all,this._removeListener)for(r=0,n=t.length;r<n;r++)this.emit("removeListenerAny",t[r]);this._all=[]}return this},M.prototype.removeListener=M.prototype.off,M.prototype.removeAllListeners=function(e){if(e===i)return!this._events||h.call(this),this;if(this.wildcard){var t,r=x.call(this,null,e,this.listenerTree,0);if(!r)return this;for(t=0;t<r.length;t++)r[t]._listeners=null;this.listenerTree&&T(this.listenerTree)}else this._events&&(this._events[e]=null);return this},M.prototype.listeners=function(e){var t,r,n,s,o,c=this._events;if(e===i){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!c)return[];for(s=(t=u(c)).length,n=[];s-- >0;)"function"==typeof(r=c[t[s]])?n.push(r):n.push.apply(n,r);return n}if(this.wildcard){if(!(o=this.listenerTree))return[];var l=[],a="string"==typeof e?e.split(this.delimiter):e.slice();return x.call(this,l,a,o,0),l}return c&&(r=c[e])?"function"==typeof r?[r]:r:[]},M.prototype.eventNames=function(e){var t=this._events;return this.wildcard?E.call(this,this.listenerTree,[],null,e):t?u(t):[]},M.prototype.listenerCount=function(e){return this.listeners(e).length},M.prototype.hasListeners=function(e){if(this.wildcard){var t=[],r="string"==typeof e?e.split(this.delimiter):e.slice();return x.call(this,t,r,this.listenerTree,0),t.length>0}var n=this._events,s=this._all;return!!(s&&s.length||n&&(e===i?u(n).length:n[e]))},M.prototype.listenersAny=function(){return this._all?this._all:[]},M.prototype.waitFor=function(e,t){var r=this,n=typeof t;return"number"===n?t={timeout:t}:"function"===n&&(t={filter:t}),L((t=d(t,{timeout:0,filter:i,handleError:!1,Promise,overload:!1},{filter:w,Promise:b})).Promise,(function(n,i,s){function o(){var s=t.filter;if(!s||s.apply(r,arguments))if(r.off(e,o),t.handleError){var c=arguments[0];c?i(c):n(v.apply(null,arguments).slice(1))}else n(v.apply(null,arguments))}s((function(){r.off(e,o)})),r._on(e,o,!1)}),{timeout:t.timeout,overload:t.overload})};var S=M.prototype;Object.defineProperties(M,{defaultMaxListeners:{get:function(){return S._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");S._maxListeners=e},enumerable:!0},once:{value:function(e,t,r){return L((r=d(r,{Promise,timeout:0,overload:!1},{Promise:b})).Promise,(function(r,n,i){var s;if("function"==typeof e.addEventListener)return s=function(){r(v.apply(null,arguments))},i((function(){e.removeEventListener(t,s)})),void e.addEventListener(t,s,{once:!0});var o,c=function(){o&&e.removeListener("error",o),r(v.apply(null,arguments))};"error"!==t&&(o=function(r){e.removeListener(t,c),n(r)},e.once("error",o)),i((function(){o&&e.removeListener("error",o),e.removeListener(t,c)})),e.once(t,c)}),{timeout:r.timeout,overload:r.overload})},writable:!0,configurable:!0}}),Object.defineProperties(S,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),(n=function(){return M}.call(t,r,t,e))===i||(e.exports=n)}()}},t={},function r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}(650);var e,t}));
2
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(()=>{return e={423:(e,t,r)=>{"use strict";var n=r(132),i=r(421),s=r(240),o=r(343),c=r(50);(e.exports=function(e,t){var r,i,l,a,f;return arguments.length<2||"string"!=typeof e?(a=t,t=e,e=null):a=arguments[2],n(e)?(r=c.call(e,"c"),i=c.call(e,"e"),l=c.call(e,"w")):(r=l=!0,i=!1),f={value:t,configurable:r,enumerable:i,writable:l},a?s(o(a),f):f}).gs=function(e,t,r){var l,a,f,u;return"string"!=typeof e?(f=r,r=t,t=e,e=null):f=arguments[3],n(t)?i(t)?n(r)?i(r)||(f=r,r=void 0):r=void 0:(f=t,t=r=void 0):t=void 0,n(e)?(l=c.call(e,"c"),a=c.call(e,"e")):(l=!0,a=!1),u={get:t,set:r,configurable:l,enumerable:a},f?s(o(f),u):u}},91:e=>{"use strict";e.exports=function(){}},240:(e,t,r)=>{"use strict";e.exports=r(229)()?Object.assign:r(640)},229:e=>{"use strict";e.exports=function(){var e,t=Object.assign;return"function"==typeof t&&(t(e={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}},640:(e,t,r)=>{"use strict";var n=r(255),i=r(110),s=Math.max;e.exports=function(e,t){var r,o,c,l=s(arguments.length,2);for(e=Object(i(e)),c=function(n){try{e[n]=t[n]}catch(e){r||(r=e)}},o=1;o<l;++o)n(t=arguments[o]).forEach(c);if(void 0!==r)throw r;return e}},515:(e,t,r)=>{"use strict";var n=r(91)();e.exports=function(e){return e!==n&&null!==e}},255:(e,t,r)=>{"use strict";e.exports=r(291)()?Object.keys:r(184)},291:e=>{"use strict";e.exports=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}},184:(e,t,r)=>{"use strict";var n=r(515),i=Object.keys;e.exports=function(e){return i(n(e)?Object(e):e)}},343:(e,t,r)=>{"use strict";var n=r(515),i=Array.prototype.forEach,s=Object.create,o=function(e,t){var r;for(r in e)t[r]=e[r]};e.exports=function(e){var t=s(null);return i.call(arguments,(function(e){n(e)&&o(Object(e),t)})),t}},979:e=>{"use strict";e.exports=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}},110:(e,t,r)=>{"use strict";var n=r(515);e.exports=function(e){if(!n(e))throw new TypeError("Cannot use null or undefined");return e}},50:(e,t,r)=>{"use strict";e.exports=r(459)()?String.prototype.contains:r(131)},459:e=>{"use strict";var t="razdwatrzy";e.exports=function(){return"function"==typeof t.contains&&!0===t.contains("dwa")&&!1===t.contains("foo")}},131:e=>{"use strict";var t=String.prototype.indexOf;e.exports=function(e){return t.call(this,e,arguments[1])>-1}},360:(e,t,r)=>{"use strict";var n,i,s,o,c,l,a,f=r(423),u=r(979),h=Function.prototype.apply,p=Function.prototype.call,y=Object.create,v=Object.defineProperty,_=Object.defineProperties,m=Object.prototype.hasOwnProperty,d={configurable:!0,enumerable:!1,writable:!0};i=function(e,t){var r,i;return u(t),i=this,n.call(this,e,r=function(){s.call(i,e,r),h.call(t,this,arguments)}),r.__eeOnceListener__=t,this},c={on:n=function(e,t){var r;return u(t),m.call(this,"__ee__")?r=this.__ee__:(r=d.value=y(null),v(this,"__ee__",d),d.value=null),r[e]?"object"==typeof r[e]?r[e].push(t):r[e]=[r[e],t]:r[e]=t,this},once:i,off:s=function(e,t){var r,n,i,s;if(u(t),!m.call(this,"__ee__"))return this;if(!(r=this.__ee__)[e])return this;if("object"==typeof(n=r[e]))for(s=0;i=n[s];++s)i!==t&&i.__eeOnceListener__!==t||(2===n.length?r[e]=n[s?0:1]:n.splice(s,1));else n!==t&&n.__eeOnceListener__!==t||delete r[e];return this},emit:o=function(e){var t,r,n,i,s;if(m.call(this,"__ee__")&&(i=this.__ee__[e]))if("object"==typeof i){for(r=arguments.length,s=new Array(r-1),t=1;t<r;++t)s[t-1]=arguments[t];for(i=i.slice(),t=0;n=i[t];++t)h.call(n,this,s)}else switch(arguments.length){case 1:p.call(i,this);break;case 2:p.call(i,this,arguments[1]);break;case 3:p.call(i,this,arguments[1],arguments[2]);break;default:for(r=arguments.length,s=new Array(r-1),t=1;t<r;++t)s[t-1]=arguments[t];h.call(i,this,s)}}},l={on:f(n),once:f(i),off:f(s),emit:f(o)},a=_({},l),e.exports=t=function(e){return null==e?y(a):_(Object(e),l)},t.methods=c},414:(e,t,r)=>{"use strict";var n=r(670);e.exports=function(e){if("function"!=typeof e)return!1;if(!hasOwnProperty.call(e,"length"))return!1;try{if("number"!=typeof e.length)return!1;if("function"!=typeof e.call)return!1;if("function"!=typeof e.apply)return!1}catch(e){return!1}return!n(e)}},783:(e,t,r)=>{"use strict";var n=r(132),i={object:!0,function:!0,undefined:!0};e.exports=function(e){return!!n(e)&&hasOwnProperty.call(i,typeof e)}},421:(e,t,r)=>{"use strict";var n=r(414),i=/^\s*class[\s{/}]/,s=Function.prototype.toString;e.exports=function(e){return!!n(e)&&!i.test(s.call(e))}},670:(e,t,r)=>{"use strict";var n=r(783);e.exports=function(e){if(!n(e))return!1;try{return!!e.constructor&&e.constructor.prototype===e}catch(e){return!1}}},132:e=>{"use strict";e.exports=function(e){return null!=e}},744:(e,t,r)=>{const n=r(360)(),i={stream:["id","type","actor","target","object","context","context","published","error"],object:["id","type","context","alias","attachedTo","attachment","attributedTo","attributedWith","content","contentMap","context","contextOf","name","endTime","generator","generatorOf","group","icon","image","inReplyTo","members","memberOf","message","location","locationOf","objectOf","originOf","presence","preview","previewOf","provider","providerOf","published","rating","relationship","resultOf","replies","role","scope","scopeOf","startTime","status","summary","topic","tag","tagOf","targetOf","title","titleMap","updated","url"]},s={"@id":"id","@type":"type",verb:"type",displayName:"name",objectType:"type",platform:"context"},o={actor:{primary:"id",props:i},target:{primary:"id",props:i},object:{primary:"content",props:i}};let c=new Map,l=!1,a=!0,f=[],u={};function h(e,t){return!("object"!=typeof u[e]||!u[e].includes(t))}function p(e,t){return e[s[t]]=e[t],delete e[t],e}function y(e,t={}){const r=Object.keys(t).filter((t=>{if(!i[e].includes(t))return t}));for(let e of r)if(s[e])t=p(t,e);else if(!h(t.type,e)&&!f.includes(t.type)){const t=`invalid property: "${e}"`;if(l)throw new Error(t);a&&console.warn(t)}}function v(e){y("stream",e),"object"==typeof e.object&&y("object",e.object);const t=function(e){let t={};for(let r of Object.keys(e))if("string"==typeof e[r])t[r]=c.get(e[r])||e[r];else if(Array.isArray(e[r])){t[r]=[];for(let n of e[r])"string"==typeof n&&t[r].push(c.get(n)||n)}else t[r]=e[r];for(let e of Object.keys(o))if("string"==typeof t[e]){let r={};r[o[e].primary]=t[e],t[e]=r}return t}(e);return n.emit("activity-stream",t),t}const _={create:function(e){return y("object",e),c.set(e.id,e),n.emit("activity-object-create",e),e},delete:function(e){const t=c.delete(e);return t&&n.emit("activity-object-delete",e),t},get:function(e,t){let r=c.get(e);if(!r){if(!t)return e;r={id:e}}return r},list:function(){return c.keys()}};function m(e={}){f=e.specialObjs||[],l="boolean"==typeof e.failOnUnknownObjectProperties?e.failOnUnknownObjectProperties:l,a="boolean"==typeof e.warnOnUnknownObjectProperties?e.warnOnUnknownObjectProperties:a;for(let t of Object.keys(e.customProps||{}))"object"==typeof e.customProps[t]&&(u[t]=e.customProps[t]);return{Stream:v,Object:_,on:function(e,t){return n.on(e,t)},once:function(e,t){return n.once(e,t)},off:function(e,t){return n.off(e,t)}}}e.exports&&(e.exports=m),"object"==typeof window&&(window.ASFactory=m)},650:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(387),s=n(r(744));class o{constructor(e){if(this.events={credentials:new Map,"activity-object":new Map,connect:new Map,join:new Map},this.online=!1,this.debug=!0,!e)throw new Error("SockethubClient requires a socket.io instance");this._socket=e,this.ActivityStreams=(0,s.default)({specialObjs:["credentials"]}),this.socket=this.createPublicEmitter(),this.registerSocketIOHandlers(),this.ActivityStreams.on("activity-object-create",(t=>{e.emit("activity-object",t,(e=>{e?console.error("failed to create activity-object ",e):this.eventActivityObject(t)}))})),e.on("activity-object",(e=>{this.ActivityStreams.Object.create(e)}))}createPublicEmitter(){const e=new i.EventEmitter2({wildcard:!0,verboseMemoryLeak:!1});return e._emit=e.emit,e.emit=(e,t,r)=>{"credentials"===e?this.eventCredentials(t):"activity-object"===e?this.eventActivityObject(t):"message"===e&&this.eventMessage(t),this._socket.emit(e,t,r)},e}eventActivityObject(e){e.id&&this.events["activity-object"].set(e.id,e)}eventCredentials(e){if(e.object&&"credentials"===e.object.type){const t=e.actor.id||e.actor;this.events.credentials.set(t,e)}}eventMessage(e){if(!this.online)return;const t=o.getKey(e);"join"===e.type||"connect"===e.type?this.events[e.type].set(t,e):"leave"===e.type?this.events.join.delete(t):"disconnect"===e.type&&this.events.connect.delete(t)}static getKey(e){var t;const r=(null===(t=e.actor)||void 0===t?void 0:t.id)||e.actor;if(!r)throw new Error("actor property not present for message type: "+(null==e?void 0:e.type));return r+"-"+(e.target?e.target.id||e.target:"")}log(e,t){this.debug&&console.log(e,t)}registerSocketIOHandlers(){const e=e=>(t,r)=>{"connect"===e?(this.online=!0,this.replay("activity-object",this.events["activity-object"]),this.replay("credentials",this.events.credentials),this.replay("message",this.events.connect),this.replay("message",this.events.join)):"disconnect"===e&&(this.online=!1),this.socket._emit(e,t,r)};this._socket.on("connect",e("connect")),this._socket.on("connect_error",e("connect_error")),this._socket.on("disconnect",e("disconnect")),this._socket.on("message",((e,t)=>{this.socket._emit("message",this.ActivityStreams.Stream(e),t)}))}replay(e,t){t.forEach((t=>{this.log(`replaying ${e}`,t),this._socket.emit(e,t)}))}}e.exports&&(e.exports=o),t=o,"object"==typeof window&&(window.SockethubClient=o)},387:(e,t,r)=>{var n;!function(i){var s=Object.hasOwnProperty,o=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},c="object"==typeof process&&"function"==typeof process.nextTick,l="function"==typeof Symbol,a="object"==typeof Reflect,f="function"==typeof setImmediate?setImmediate:setTimeout,u=l?a&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function h(){this._events={},this._conf&&p.call(this,this._conf)}function p(e){e&&(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),e.maxListeners!==i&&(this._maxListeners=e.maxListeners),e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this._newListener=e.newListener),e.removeListener&&(this._removeListener=e.removeListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),e.ignoreErrors&&(this.ignoreErrors=e.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function y(e,t){var r="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(r+=" Event name: "+t+"."),"undefined"!=typeof process&&process.emitWarning){var n=new Error(r);n.name="MaxListenersExceededWarning",n.emitter=this,n.count=e,process.emitWarning(n)}else console.error(r),console.trace&&console.trace()}var v=function(e,t,r){var n=arguments.length;switch(n){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,r];default:for(var i=new Array(n);n--;)i[n]=arguments[n];return i}};function _(e,t){for(var r={},n=e.length,s=t?t.length:0,o=0;o<n;o++)r[e[o]]=o<s?t[o]:i;return r}function m(e,t,r){var n,i;if(this._emitter=e,this._target=t,this._listeners={},this._listenersCount=0,(r.on||r.off)&&(n=r.on,i=r.off),t.addEventListener?(n=t.addEventListener,i=t.removeEventListener):t.addListener?(n=t.addListener,i=t.removeListener):t.on&&(n=t.on,i=t.off),!n&&!i)throw Error("target does not implement any known event API");if("function"!=typeof n)throw TypeError("on method must be a function");if("function"!=typeof i)throw TypeError("off method must be a function");this._on=n,this._off=i;var s=e._observers;s?s.push(this):e._observers=[this]}function d(e,t,r,n){var o=Object.assign({},t);if(!e)return o;if("object"!=typeof e)throw TypeError("options must be an object");var c,l,a,f=Object.keys(e),u=f.length;function h(e){throw Error('Invalid "'+c+'" option value'+(e?". Reason: "+e:""))}for(var p=0;p<u;p++){if(c=f[p],!n&&!s.call(t,c))throw Error('Unknown "'+c+'" option');(l=e[c])!==i&&(a=r[c],o[c]=a?a(l,h):l)}return o}function b(e,t){return"function"==typeof e&&e.hasOwnProperty("prototype")||t("value must be a constructor"),e}function g(e){var t="value must be type of "+e.join("|"),r=e.length,n=e[0],i=e[1];return 1===r?function(e,r){if(typeof e===n)return e;r(t)}:2===r?function(e,r){var s=typeof e;if(s===n||s===i)return e;r(t)}:function(n,i){for(var s=typeof n,o=r;o-- >0;)if(s===e[o])return n;i(t)}}Object.assign(m.prototype,{subscribe:function(e,t,r){var n=this,i=this._target,s=this._emitter,o=this._listeners,c=function(){var n=v.apply(null,arguments),o={data:n,name:t,original:e};if(r){var c=r.call(i,o);!1!==c&&s.emit.apply(s,[o.name].concat(n))}else s.emit.apply(s,[t].concat(n))};if(o[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,s._newListener&&s._removeListener&&!n._onNewListener?(this._onNewListener=function(r){r===t&&null===o[e]&&(o[e]=c,n._on.call(i,e,c))},s.on("newListener",this._onNewListener),this._onRemoveListener=function(r){r===t&&!s.hasListeners(r)&&o[e]&&(o[e]=null,n._off.call(i,e,c))},o[e]=null,s.on("removeListener",this._onRemoveListener)):(o[e]=c,n._on.call(i,e,c))},unsubscribe:function(e){var t,r,n,i=this,s=this._listeners,o=this._emitter,c=this._off,l=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function a(){i._onNewListener&&(o.off("newListener",i._onNewListener),o.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=O.call(o,i);o._observers.splice(e,1)}if(e){if(!(t=s[e]))return;c.call(l,e,t),delete s[e],--this._listenersCount||a()}else{for(n=(r=u(s)).length;n-- >0;)e=r[n],c.call(l,e,s[e]);this._listeners={},this._listenersCount=0,a()}}});var w=g(["function"]),j=g(["object","function"]);function L(e,t,r){var n,i,s,o=0,c=new e((function(l,a,f){function u(){i&&(i=null),o&&(clearTimeout(o),o=0)}r=d(r,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),n=!r.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof f;var h=function(e){u(),l(e)},p=function(e){u(),a(e)};n?t(h,p,f):(i=[function(e){p(e||Error("canceled"))}],t(h,p,(function(e){if(s)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)})),s=!0),r.timeout>0&&(o=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",o=0,c.cancel(e),a(e)}),r.timeout))}));return n||(c.cancel=function(e){if(i){for(var t=i.length,r=1;r<t;r++)i[r](e);i[0](e),i=null}}),c}function O(e){var t=this._observers;if(!t)return-1;for(var r=t.length,n=0;n<r;n++)if(t[n]._target===e)return n;return-1}function x(e,t,r,n,i){if(!r)return null;if(0===n){var s=typeof t;if("string"===s){var o,c,l=0,a=0,f=this.delimiter,h=f.length;if(-1!==(c=t.indexOf(f))){o=new Array(5);do{o[l++]=t.slice(a,c),a=c+h}while(-1!==(c=t.indexOf(f,a)));o[l++]=t.slice(a),t=o,i=l}else t=[t],i=1}else"object"===s?i=t.length:(t=[t],i=1)}var p,y,v,_,m,d,b,g=null,w=t[n],j=t[n+1];if(n===i)r._listeners&&("function"==typeof r._listeners?(e&&e.push(r._listeners),g=[r]):(e&&e.push.apply(e,r._listeners),g=[r]));else{if("*"===w){for(c=(d=u(r)).length;c-- >0;)"_listeners"!==(p=d[c])&&(b=x(e,t,r[p],n+1,i))&&(g?g.push.apply(g,b):g=b);return g}if("**"===w){for((m=n+1===i||n+2===i&&"*"===j)&&r._listeners&&(g=x(e,t,r,i,i)),c=(d=u(r)).length;c-- >0;)"_listeners"!==(p=d[c])&&("*"===p||"**"===p?(r[p]._listeners&&!m&&(b=x(e,t,r[p],i,i))&&(g?g.push.apply(g,b):g=b),b=x(e,t,r[p],n,i)):b=x(e,t,r[p],p===j?n+2:n,i),b&&(g?g.push.apply(g,b):g=b));return g}r[w]&&(g=x(e,t,r[w],n+1,i))}if((y=r["*"])&&x(e,t,y,n+1,i),v=r["**"])if(n<i)for(v._listeners&&x(e,t,v,i,i),c=(d=u(v)).length;c-- >0;)"_listeners"!==(p=d[c])&&(p===j?x(e,t,v[p],n+2,i):p===w?x(e,t,v[p],n+1,i):((_={})[p]=v[p],x(e,t,{"**":_},n+1,i)));else v._listeners?x(e,t,v,i,i):v["*"]&&v["*"]._listeners&&x(e,t,v["*"],i,i);return g}function k(e,t,r){var n,i,s=0,o=0,c=this.delimiter,l=c.length;if("string"==typeof e)if(-1!==(n=e.indexOf(c))){i=new Array(5);do{i[s++]=e.slice(o,n),o=n+l}while(-1!==(n=e.indexOf(c,o)));i[s++]=e.slice(o)}else i=[e],s=1;else i=e,s=e.length;if(s>1)for(n=0;n+1<s;n++)if("**"===i[n]&&"**"===i[n+1])return;var a,f=this.listenerTree;for(n=0;n<s;n++)if(f=f[a=i[n]]||(f[a]={}),n===s-1)return f._listeners?("function"==typeof f._listeners&&(f._listeners=[f._listeners]),r?f._listeners.unshift(t):f._listeners.push(t),!f._listeners.warned&&this._maxListeners>0&&f._listeners.length>this._maxListeners&&(f._listeners.warned=!0,y.call(this,f._listeners.length,a))):f._listeners=t,!0;return!0}function E(e,t,r,n){for(var i,s,o,c,l=u(e),a=l.length,f=e._listeners;a-- >0;)i=e[s=l[a]],o="_listeners"===s?r:r?r.concat(s):[s],c=n||"symbol"==typeof s,f&&t.push(c?o:o.join(this.delimiter)),"object"==typeof i&&E.call(this,i,t,o,c);return t}function T(e){for(var t,r,n,i=u(e),s=i.length;s-- >0;)(t=e[r=i[s]])&&(n=!0,"_listeners"===r||T(t)||delete e[r]);return n}function A(e,t,r){this.emitter=e,this.event=t,this.listener=r}function P(e,t,r){if(!0===r)s=!0;else if(!1===r)n=!0;else{if(!r||"object"!=typeof r)throw TypeError("options should be an object or true");var n=r.async,s=r.promisify,o=r.nextTick,l=r.objectify}if(n||o||s){var a=t,u=t._origin||t;if(o&&!c)throw Error("process.nextTick is not supported");s===i&&(s="AsyncFunction"===t.constructor.name),t=function(){var e=arguments,t=this,r=this.event;return s?o?Promise.resolve():new Promise((function(e){f(e)})).then((function(){return t.event=r,a.apply(t,e)})):(o?process.nextTick:f)((function(){t.event=r,a.apply(t,e)}))},t._async=!0,t._origin=u}return[t,l?new A(this,e,t):this]}function M(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,p.call(this,e)}A.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},M.EventEmitter2=M,M.prototype.listenTo=function(e,t,r){if("object"!=typeof e)throw TypeError("target musts be an object");var n=this;function s(t){if("object"!=typeof t)throw TypeError("events must be an object");var i,s=r.reducers,o=O.call(n,e);i=-1===o?new m(n,e,r):n._observers[o];for(var c,l=u(t),a=l.length,f="function"==typeof s,h=0;h<a;h++)c=l[h],i.subscribe(c,t[c]||c,f?s:s&&s[c])}return r=d(r,{on:i,off:i,reducers:i},{on:w,off:w,reducers:j}),o(t)?s(_(t)):s("string"==typeof t?_(t.split(/\s+/)):t),this},M.prototype.stopListeningTo=function(e,t){var r=this._observers;if(!r)return!1;var n,i=r.length,s=!1;if(e&&"object"!=typeof e)throw TypeError("target should be an object");for(;i-- >0;)n=r[i],e&&n._target!==e||(n.unsubscribe(t),s=!0);return s},M.prototype.delimiter=".",M.prototype.setMaxListeners=function(e){e!==i&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},M.prototype.getMaxListeners=function(){return this._maxListeners},M.prototype.event="",M.prototype.once=function(e,t,r){return this._once(e,t,!1,r)},M.prototype.prependOnceListener=function(e,t,r){return this._once(e,t,!0,r)},M.prototype._once=function(e,t,r,n){return this._many(e,1,t,r,n)},M.prototype.many=function(e,t,r,n){return this._many(e,t,r,!1,n)},M.prototype.prependMany=function(e,t,r,n){return this._many(e,t,r,!0,n)},M.prototype._many=function(e,t,r,n,i){var s=this;if("function"!=typeof r)throw new Error("many only accepts instances of Function");function o(){return 0==--t&&s.off(e,o),r.apply(this,arguments)}return o._origin=r,this._on(e,o,n,i)},M.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||h.call(this);var e,t,r,n,i,s,o=arguments[0],c=this.wildcard;if("newListener"===o&&!this._newListener&&!this._events.newListener)return!1;if(c&&(e=o,"newListener"!==o&&"removeListener"!==o&&"object"==typeof o)){if(r=o.length,l)for(n=0;n<r;n++)if("symbol"==typeof o[n]){s=!0;break}s||(o=o.join(this.delimiter))}var a,f=arguments.length;if(this._all&&this._all.length)for(n=0,r=(a=this._all.slice()).length;n<r;n++)switch(this.event=o,f){case 1:a[n].call(this,o);break;case 2:a[n].call(this,o,arguments[1]);break;case 3:a[n].call(this,o,arguments[1],arguments[2]);break;default:a[n].apply(this,arguments)}if(c)a=[],x.call(this,a,e,this.listenerTree,0,r);else{if("function"==typeof(a=this._events[o])){switch(this.event=o,f){case 1:a.call(this);break;case 2:a.call(this,arguments[1]);break;case 3:a.call(this,arguments[1],arguments[2]);break;default:for(t=new Array(f-1),i=1;i<f;i++)t[i-1]=arguments[i];a.apply(this,t)}return!0}a&&(a=a.slice())}if(a&&a.length){if(f>3)for(t=new Array(f-1),i=1;i<f;i++)t[i-1]=arguments[i];for(n=0,r=a.length;n<r;n++)switch(this.event=o,f){case 1:a[n].call(this);break;case 2:a[n].call(this,arguments[1]);break;case 3:a[n].call(this,arguments[1],arguments[2]);break;default:a[n].apply(this,t)}return!0}if(!this.ignoreErrors&&!this._all&&"error"===o)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},M.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||h.call(this);var e,t,r,n,i,s,o=arguments[0],c=this.wildcard;if("newListener"===o&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(c&&(e=o,"newListener"!==o&&"removeListener"!==o&&"object"==typeof o)){if(n=o.length,l)for(i=0;i<n;i++)if("symbol"==typeof o[i]){t=!0;break}t||(o=o.join(this.delimiter))}var a,f=[],u=arguments.length;if(this._all)for(i=0,n=this._all.length;i<n;i++)switch(this.event=o,u){case 1:f.push(this._all[i].call(this,o));break;case 2:f.push(this._all[i].call(this,o,arguments[1]));break;case 3:f.push(this._all[i].call(this,o,arguments[1],arguments[2]));break;default:f.push(this._all[i].apply(this,arguments))}if(c?(a=[],x.call(this,a,e,this.listenerTree,0)):a=this._events[o],"function"==typeof a)switch(this.event=o,u){case 1:f.push(a.call(this));break;case 2:f.push(a.call(this,arguments[1]));break;case 3:f.push(a.call(this,arguments[1],arguments[2]));break;default:for(r=new Array(u-1),s=1;s<u;s++)r[s-1]=arguments[s];f.push(a.apply(this,r))}else if(a&&a.length){if(a=a.slice(),u>3)for(r=new Array(u-1),s=1;s<u;s++)r[s-1]=arguments[s];for(i=0,n=a.length;i<n;i++)switch(this.event=o,u){case 1:f.push(a[i].call(this));break;case 2:f.push(a[i].call(this,arguments[1]));break;case 3:f.push(a[i].call(this,arguments[1],arguments[2]));break;default:f.push(a[i].apply(this,r))}}else if(!this.ignoreErrors&&!this._all&&"error"===o)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(f)},M.prototype.on=function(e,t,r){return this._on(e,t,!1,r)},M.prototype.prependListener=function(e,t,r){return this._on(e,t,!0,r)},M.prototype.onAny=function(e){return this._onAny(e,!1)},M.prototype.prependAny=function(e){return this._onAny(e,!0)},M.prototype.addListener=M.prototype.on,M.prototype._onAny=function(e,t){if("function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),t?this._all.unshift(e):this._all.push(e),this},M.prototype._on=function(e,t,r,n){if("function"==typeof e)return this._onAny(e,t),this;if("function"!=typeof t)throw new Error("on only accepts instances of Function");this._events||h.call(this);var s,o=this;return n!==i&&(t=(s=P.call(this,e,t,n))[0],o=s[1]),this._newListener&&this.emit("newListener",e,t),this.wildcard?(k.call(this,e,t,r),o):(this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,y.call(this,this._events[e].length,e))):this._events[e]=t,o)},M.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r,n=[];if(this.wildcard){var i="string"==typeof e?e.split(this.delimiter):e.slice();if(!(n=x.call(this,null,i,this.listenerTree,0)))return this}else{if(!this._events[e])return this;r=this._events[e],n.push({_listeners:r})}for(var s=0;s<n.length;s++){var c=n[s];if(r=c._listeners,o(r)){for(var l=-1,a=0,f=r.length;a<f;a++)if(r[a]===t||r[a].listener&&r[a].listener===t||r[a]._origin&&r[a]._origin===t){l=a;break}if(l<0)continue;return this.wildcard?c._listeners.splice(l,1):this._events[e].splice(l,1),0===r.length&&(this.wildcard?delete c._listeners:delete this._events[e]),this._removeListener&&this.emit("removeListener",e,t),this}(r===t||r.listener&&r.listener===t||r._origin&&r._origin===t)&&(this.wildcard?delete c._listeners:delete this._events[e],this._removeListener&&this.emit("removeListener",e,t))}return this.listenerTree&&T(this.listenerTree),this},M.prototype.offAny=function(e){var t,r=0,n=0;if(e&&this._all&&this._all.length>0){for(r=0,n=(t=this._all).length;r<n;r++)if(e===t[r])return t.splice(r,1),this._removeListener&&this.emit("removeListenerAny",e),this}else{if(t=this._all,this._removeListener)for(r=0,n=t.length;r<n;r++)this.emit("removeListenerAny",t[r]);this._all=[]}return this},M.prototype.removeListener=M.prototype.off,M.prototype.removeAllListeners=function(e){if(e===i)return!this._events||h.call(this),this;if(this.wildcard){var t,r=x.call(this,null,e,this.listenerTree,0);if(!r)return this;for(t=0;t<r.length;t++)r[t]._listeners=null;this.listenerTree&&T(this.listenerTree)}else this._events&&(this._events[e]=null);return this},M.prototype.listeners=function(e){var t,r,n,s,o,c=this._events;if(e===i){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!c)return[];for(s=(t=u(c)).length,n=[];s-- >0;)"function"==typeof(r=c[t[s]])?n.push(r):n.push.apply(n,r);return n}if(this.wildcard){if(!(o=this.listenerTree))return[];var l=[],a="string"==typeof e?e.split(this.delimiter):e.slice();return x.call(this,l,a,o,0),l}return c&&(r=c[e])?"function"==typeof r?[r]:r:[]},M.prototype.eventNames=function(e){var t=this._events;return this.wildcard?E.call(this,this.listenerTree,[],null,e):t?u(t):[]},M.prototype.listenerCount=function(e){return this.listeners(e).length},M.prototype.hasListeners=function(e){if(this.wildcard){var t=[],r="string"==typeof e?e.split(this.delimiter):e.slice();return x.call(this,t,r,this.listenerTree,0),t.length>0}var n=this._events,s=this._all;return!!(s&&s.length||n&&(e===i?u(n).length:n[e]))},M.prototype.listenersAny=function(){return this._all?this._all:[]},M.prototype.waitFor=function(e,t){var r=this,n=typeof t;return"number"===n?t={timeout:t}:"function"===n&&(t={filter:t}),L((t=d(t,{timeout:0,filter:i,handleError:!1,Promise,overload:!1},{filter:w,Promise:b})).Promise,(function(n,i,s){function o(){var s=t.filter;if(!s||s.apply(r,arguments))if(r.off(e,o),t.handleError){var c=arguments[0];c?i(c):n(v.apply(null,arguments).slice(1))}else n(v.apply(null,arguments))}s((function(){r.off(e,o)})),r._on(e,o,!1)}),{timeout:t.timeout,overload:t.overload})};var S=M.prototype;Object.defineProperties(M,{defaultMaxListeners:{get:function(){return S._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");S._maxListeners=e},enumerable:!0},once:{value:function(e,t,r){return L((r=d(r,{Promise,timeout:0,overload:!1},{Promise:b})).Promise,(function(r,n,i){var s;if("function"==typeof e.addEventListener)return s=function(){r(v.apply(null,arguments))},i((function(){e.removeEventListener(t,s)})),void e.addEventListener(t,s,{once:!0});var o,c=function(){o&&e.removeListener("error",o),r(v.apply(null,arguments))};"error"!==t&&(o=function(r){e.removeListener(t,c),n(r)},e.once("error",o)),i((function(){o&&e.removeListener("error",o),e.removeListener(t,c)})),e.once(t,c)}),{timeout:r.timeout,overload:r.overload})},writable:!0,configurable:!0}}),Object.defineProperties(S,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),(n=function(){return M}.call(t,r,t,e))===i||(e.exports=n)}()}},t={},function r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}(650);var e,t}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sockethub/client",
3
- "version": "5.0.0-alpha.3",
3
+ "version": "5.0.0-alpha.4",
4
4
  "description": "A JavaScript client for the Sockethub protocol gateway",
5
5
  "main": "dist/sockethub-client.js",
6
6
  "keywords": [
@@ -23,7 +23,7 @@
23
23
  "clean:deps": "npx rimraf node_modules",
24
24
  "compliance": "yarn run lint && yarn run test && yarn run coverage",
25
25
  "test": "c8 -x src/bootstrap -x \"src/**/*.test.*\" mocha -r ts-node/register src/*.test.ts src/**/*.test.ts",
26
- "coverage": "c8 check-coverage --statements 95 --branches 85 --functions 90 --lines 95",
26
+ "coverage": "c8 check-coverage --statements 85 --branches 84 --functions 90 --lines 85",
27
27
  "lint": "eslint \"**/*.ts\"",
28
28
  "lint:fix": "eslint --fix \"**/*.ts\"",
29
29
  "build": "tsc && webpack --config webpack.minified.config.js && webpack --config webpack.normal.config.js"
@@ -31,27 +31,28 @@
31
31
  "author": "Nick Jennings <nick@silverbucket.net>",
32
32
  "license": "LGPL-3.0+",
33
33
  "devDependencies": {
34
- "@sockethub/activity-streams": "^4.4.0-alpha.3",
35
- "@types/chai": "4.3.0",
36
- "@types/eslint": "8.4.1",
34
+ "@sockethub/activity-streams": "^4.4.0-alpha.4",
35
+ "@sockethub/schemas": "^3.0.0-alpha.4",
36
+ "@types/chai": "4.3.3",
37
+ "@types/eslint": "8.4.6",
37
38
  "@types/eventemitter2": "4.1.0",
38
- "@types/mocha": "9.1.0",
39
+ "@types/mocha": "9.1.1",
39
40
  "@types/node": "17.0.21",
40
- "@types/proxyquire": "^1.3.28",
41
- "@types/sinon": "10.0.11",
42
- "@typescript-eslint/parser": "5.13.0",
43
- "c8": "7.11.0",
41
+ "@types/proxyquire": "1.3.28",
42
+ "@types/sinon": "10.0.13",
43
+ "@typescript-eslint/parser": "5.37.0",
44
+ "c8": "7.12.0",
44
45
  "chai": "4.3.6",
45
- "eslint": "8.10.0",
46
+ "eslint": "8.23.1",
46
47
  "eslint-cli": "1.1.1",
47
- "eventemitter2": "6.4.5",
48
- "mocha": "9.2.1",
48
+ "eventemitter2": "6.4.9",
49
+ "mocha": "10.0.0",
49
50
  "proxyquire": "2.1.3",
50
- "sinon": "13.0.1",
51
- "ts-node": "10.6.0",
52
- "typescript": "4.6.2",
53
- "webpack": "5.70.0",
54
- "webpack-cli": "4.9.2"
51
+ "sinon": "14.0.0",
52
+ "ts-node": "10.9.1",
53
+ "typescript": "4.8.3",
54
+ "webpack": "5.74.0",
55
+ "webpack-cli": "4.10.0"
55
56
  },
56
- "gitHead": "f02238a478b7ffd3f31d8deea292eb67e630a86b"
57
+ "gitHead": "c6d34ff44d2be479e4ea42c46da649612342a680"
57
58
  }
@@ -1,15 +1,16 @@
1
1
  import { EventEmitter2 } from 'eventemitter2';
2
2
  import ASFactory from '@sockethub/activity-streams';
3
+ import {IActivityObject, IActivityStream} from "@sockethub/schemas";
3
4
 
4
5
  export interface ActivityObjectManager {
5
- create(obj: any): any;
6
+ create(obj: unknown): unknown;
6
7
  delete(id: string): boolean;
7
8
  list(): Array<string>,
8
- get(id: string, expand: boolean): any;
9
+ get(id: string, expand?: boolean): unknown;
9
10
  }
10
11
 
11
12
  export interface ASManager {
12
- Stream(meta: any): any,
13
+ Stream(meta: unknown): unknown,
13
14
  Object: ActivityObjectManager,
14
15
  emit(event, obj): void;
15
16
  on(event, func): void;
@@ -17,9 +18,16 @@ export interface ASManager {
17
18
  off(event, funcName): void;
18
19
  }
19
20
 
21
+ interface EventMapping {
22
+ credentials: Map<string, IActivityStream>;
23
+ 'activity-object': Map<string, IActivityObject>;
24
+ connect: Map<string, IActivityStream>;
25
+ join: Map<string, IActivityStream>;
26
+ }
27
+
20
28
  class SockethubClient {
21
29
  private _socket;
22
- private events = {
30
+ private events: EventMapping = {
23
31
  'credentials': new Map(),
24
32
  'activity-object': new Map(),
25
33
  'connect': new Map(),
@@ -33,7 +41,6 @@ class SockethubClient {
33
41
  constructor(socket) {
34
42
  if (! socket) { throw new Error('SockethubClient requires a socket.io instance'); }
35
43
  this._socket = socket;
36
- // @ts-ignore
37
44
  this.ActivityStreams = ASFactory({specialObjs: ['credentials']});
38
45
 
39
46
  this.socket = this.createPublicEmitter();
@@ -52,13 +59,16 @@ class SockethubClient {
52
59
  }
53
60
 
54
61
  private createPublicEmitter(): EventEmitter2 {
55
- let socket = new EventEmitter2({
62
+ const socket = new EventEmitter2({
56
63
  wildcard: true,
57
64
  verboseMemoryLeak: false
58
65
  });
66
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
59
67
  // @ts-ignore
60
68
  socket._emit = socket.emit;
61
- socket.emit = (event, content, callback): any => {
69
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
70
+ // @ts-ignore
71
+ socket.emit = (event, content, callback): void => {
62
72
  if (event === 'credentials') {
63
73
  this.eventCredentials(content);
64
74
  } else if (event === 'activity-object') {
@@ -71,25 +81,26 @@ class SockethubClient {
71
81
  return socket;
72
82
  }
73
83
 
74
- private eventActivityObject(content: any) {
84
+ private eventActivityObject(content: IActivityObject) {
75
85
  if (content.id) {
76
86
  this.events['activity-object'].set(content.id, content);
77
87
  }
78
88
  }
79
89
 
80
- private eventCredentials(content: any) {
90
+ private eventCredentials(content: IActivityStream) {
81
91
  if ((content.object) && (content.object.type === 'credentials')) {
82
- this.events['credentials'].set(content.actor.id || content.actor, content);
92
+ const key: string = content.actor.id || content.actor as unknown as string;
93
+ this.events['credentials'].set(key, content);
83
94
  }
84
95
  }
85
96
 
86
- private eventMessage(content: any) {
97
+ private eventMessage(content: IActivityObject) {
87
98
  if (! this.online) { return; }
88
99
  // either store or delete the specified content onto the storedJoins map,
89
100
  // for reply once we're back online.
90
- const key = SockethubClient.getKey(content);
101
+ const key = SockethubClient.getKey(content as IActivityStream);
91
102
  if (content.type === 'join' || content.type === 'connect') {
92
- this.events[content.type].set(key, content);
103
+ this.events[content.type].set(key, content as IActivityStream);
93
104
  } else if (content.type === 'leave') {
94
105
  this.events['join'].delete(key);
95
106
  } else if (content.type === 'disconnect') {
@@ -97,16 +108,16 @@ class SockethubClient {
97
108
  }
98
109
  }
99
110
 
100
- private static getKey(content: any) {
101
- let actor = content.actor?.id || content.actor;
111
+ private static getKey(content: IActivityStream) {
112
+ const actor = content.actor?.id || content.actor;
102
113
  if (! actor) {
103
114
  throw new Error("actor property not present for message type: " + content?.type);
104
115
  }
105
- let target = content.target ? content.target.id || content.target : '';
116
+ const target = content.target ? content.target.id || content.target : '';
106
117
  return actor + '-' + target;
107
118
  }
108
119
 
109
- private log(msg: string, obj?: any) {
120
+ private log(msg: string, obj?: unknown) {
110
121
  if (this.debug) {
111
122
  // eslint-disable-next-line security-node/detect-crlf
112
123
  console.log(msg, obj);
@@ -142,12 +153,12 @@ class SockethubClient {
142
153
  });
143
154
  }
144
155
 
145
- private replay(name: string, asMap: any) {
156
+ private replay(name: string, asMap: Map<string, unknown>) {
146
157
  asMap.forEach((obj) => {
147
158
  this.log(`replaying ${name}`, obj);
148
159
  this._socket.emit(name, obj);
149
160
  });
150
- };
161
+ }
151
162
  }
152
163
 
153
164
  if (typeof module === 'object' && module.exports) {
@@ -158,8 +169,8 @@ if (typeof exports === 'object') {
158
169
  exports = SockethubClient; // lgtm [js/useless-assignment-to-local]
159
170
  }
160
171
 
161
- // @ts-ignore
162
172
  if (typeof window === 'object') {
173
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
163
174
  // @ts-ignore
164
175
  window.SockethubClient = SockethubClient;
165
176
  }
package/tsconfig.json CHANGED
@@ -7,6 +7,9 @@
7
7
  "baseUrl": "/",
8
8
  "sourceRoot": "/",
9
9
  "mapRoot": "/",
10
+ "lib": [
11
+ "dom"
12
+ ]
10
13
  },
11
14
  "include": [
12
15
  "src"