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

futoin-asyncevent

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

futoin-asyncevent - npm Package Compare versions

Comparing version 2.2.1 to 2.2.2

4

CHANGELOG.txt

@@ -0,1 +1,5 @@

=== 2.2.2 (2019-01-11) ===
CHANGED: dependency maintenance
=== 2.2.1 (2018-08-11) ===

@@ -2,0 +6,0 @@ CHANGED: dependency maintenance

2

dist/futoin-asyncevent.js

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["futoin-asyncevent"]=t():e.$asyncevent=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=8)}([function(e,t,n){"use strict";var r=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)};["ConnectError","CommError","UnknownInterface","NotSupportedVersion","NotImplemented","Unauthorized","InternalError","InvokerError","InvalidRequest","DefenseRejected","PleaseReauth","SecurityError","Timeout","LoopBreak","LoopCont"].forEach(function(e){return Object.defineProperty(r,e,{enumerable:!0,value:e})}),e.exports=r},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();var i=n(0),u=(i.InternalError,i.LoopCont),a=i.LoopBreak,c="undefined"==typeof Symbol?function(e){return e}:function(e){return Symbol(e)},s=c("_loop_term_label"),l=function(e,t,n,r,o){o&&o()||e.add(function(e){var i=e.state,c=t._exec_stack,l=c.length,f=[n,function(t,n){!function(e,t,n,r,o){if(t===u){var i=r[s];i&&i!==o||(r.last_exception=null,e._root._handle_success())}else if(t===a){var c=r[s];c&&c!==o||(r.last_exception=null,n._queue.length=0,e._root._handle_success())}}(t,n,e,i,r)}],h=[function(e){o&&o()||(c.length=l,_())},null],_=function(){e._queue=[f,h]};_()})},f=function(e,t,n,r,o){var i=0,u=n;l(e,t,function(e){r(e,i++)},o,function(){return i>=u})},h=[];Object.freeze(h);var _=function(){};e.exports=t={noop:_,makeSym:c,loop:l,repeat:f,forEach:function(e,t,n,r,i){if(Array.isArray(n)){var u=n;f(e,t,u.length,function(e,t){r(e,t,u[t])},i)}else if("undefined"!=typeof Map&&n instanceof Map){var a=n.entries();l(e,t,function(e){var t=a.next();t.done&&e.break();var n=o(t.value,2),i=n[0],u=n[1];r(e,i,u)},i)}else{var c=n,s=Object.keys(c);f(e,t,s.length,function(e,t){r(e,s[t],c[s[t]])},i)}},LOOP_TERM_LABEL:s,as_await:function(e,t,n,r){var o=void 0,i=void 0;n.then(function(e){o?o.state&&t._burst_success([e]):i=function(){t._handle_success([e])}},function(e){o?function(e,t,n){var r=e.state;if(r)if(e._on_cancel=null,n instanceof Error)r.last_exception=n,r.error_info=void 0,t._handle_error("PromiseReject");else{var o=n||"PromiseReject";r.last_exception=new Error(o),r.error_info=void 0,t._handle_error(o)}}(o,t,e):(o=null,i=e instanceof Error?function(){throw e}:function(t){t.error(e||"PromiseReject")})}),e.add(function(e){i?i(e):(o=e,e._on_cancel=function(){if(o){o=null;try{n.cancel()}catch(e){}}})},r)},EMPTY_ARRAY:h,prev_queue:function(e){var t=e._stack,n=t.length;return n>1?t[n-2]._queue:e._queue}},t.isProduction=!0,t.checkFunc=_,t.checkOnError=_;var v=new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,[{key:"push",value:function(){}},{key:"length",get:function(){return 0},set:function(e){}}]),e}());Object.freeze(v),t.newExecStack=function(){return v}},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o=n(0).NotImplemented,i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,[{key:"sync",value:function(e,t,n){e.error(o,"#sync() API")}}]),e}();e.exports=i},function(e,t,n){"use strict";if(t=e.exports={},"undefined"==typeof setImmediate){t.callLater=function(e,t){return setTimeout(e,t)},t.cancelCall=function(e){return clearTimeout(e)},window._FutoInEventLoopQueue=window._FutoInEventLoopQueue||[];var r=window._FutoInEventLoopQueue,o=window.performance,i=null,u=function(){i&&clearTimeout(i),i=setTimeout(a,0)},a=function(){i=null;for(var e=o.now()+10;r.length;){var t=r.shift();try{t()}catch(e){throw u(),e}if(o.now()>=e){u();break}}};t.callImmediate=function(e){r.length||u();var t=function(){e()};return r.push(t),t},t.cancelImmediate=function(e){var t=r.indexOf(e);t>=0&&r.splice(t,1)}}else t.callLater=function(e,t){return setTimeout(e,t)},t.cancelCall=function(e){clearTimeout(e)},t.callImmediate=function(e){return setImmediate(e)},t.cancelImmediate=function(e){clearImmediate(e)}},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o=n(3),i=n(0).InternalError,u=n(16),a=n(5),c=n(1),s=c.isProduction,l=c.checkFunc,f=c.checkOnError,h=c.noop,_=c.loop,v=c.repeat,p=c.forEach,y=c.as_await,d=c.EMPTY_ARRAY,m=c.newExecStack,b=s?h:function(e){e._stack.length>0&&e.error(i,"Top level add in execution")},x=s?h:function(e,t,n){b(e),l(e,t),f(e,n)},g=100,w=g,k=null,E=function(e){e._post_exec=h,e._execute()},q=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),null===n&&(n=function(){return this.state}),this.state=n,this._queue=[],this._stack=[],this._exec_stack=m(),this._in_exec=!1,this._post_exec=h,this._exec_event=null,this._next_args=d,this._async_tool=r;var i=r.callImmediate,u=function(){w=g,k=t,t._exec_event=null,t._execute()};this._scheduleExecute=function(){--w<=0||!t._in_exec||k!==t?t._exec_event=i(u):t._in_exec&&(t._post_exec=E)}}return r(e,[{key:"add",value:function(e,t){return x(this,e,t),this._queue.push([e,t]),this}},{key:"parallel",value:function(e){b(this),f(this,e);var t=new a(this,this);return this._queue.push([function(e){t.executeParallel(e)},e]),t}},{key:"sync",value:function(e,t,n){return x(this,t,n),e.sync(this,t,n),this}},{key:"error",value:function(e,t){this.state.error_info=t;var n=new Error(e);throw this._in_exec||(this.state.last_exception=n,this._handle_error(e)),n}},{key:"copyFrom",value:function(e){this._queue.push.apply(this._queue,e._queue);var t=e.state,n=this.state;for(var r in t)r in n||(n[r]=t[r]);return this}},{key:"_handle_success",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,t=this._stack;t.length||this.error(i,"Invalid success completion"),this._next_args=e;for(var n=t[t.length-1];;){var r=n._limit_event;if(r&&(this._async_tool.cancelCall(r),n._limit_event=null),n._cleanup(),t.pop(),!t.length)break;if((n=t[t.length-1])._queue.length)break}(t.length||this._queue.length)&&this._scheduleExecute()}},{key:"_handle_error",value:function(e){if(this._exec_event)this.cancel();else{this._next_args=d;var t=this._stack,n=this._exec_stack;this.state.async_stack=n;for(var r=this._in_exec,o=!0;t.length;){var i=t[t.length-1],u=i._limit_event,a=i._on_cancel,c=i._on_error;if(u&&(this._async_tool.cancelCall(u),i._limit_event=null),a&&(a.call(null,i),i._on_cancel=null),c){var s=t.length;i._queue=null,i._on_error=null,n.push(c);try{if(this._in_exec=!0,c.call(null,i,e),s!==t.length){o=!1;break}if(null!==i._queue){o=!1,this._scheduleExecute();break}}catch(t){this.state.last_exception=t,e=t.message}finally{this._in_exec=r}}i._cleanup(),t.pop()}o?this._queue=[]:r||this._post_exec(this)}}},{key:"cancel",value:function(){this._next_args=d;var e=this._exec_event;e&&(this._async_tool.cancelImmediate(e),this._exec_event=null);for(var t=this._stack,n=this._async_tool;t.length;){var r=t.pop(),o=r._limit_event,i=r._on_cancel;o&&(n.cancelCall(o),r._limit_event=null),i&&(i.call(null,r),r._on_cancel=null),r._cleanup()}return this._queue=[],this}},{key:"execute",value:function(){var e=k;return k=this,this._execute(),k=e,this}},{key:"_execute",value:function(){var e=this._stack,t=void 0;if((t=e.length?e[e.length-1]._queue:this._queue).length){var n=t.shift(),r=n[0];this._exec_stack.push(r);var o=this._next_args,i=o.length,a=new u(this,n[1],o);e.push(a);try{var c=e.length;this._in_exec=!0,i?(this._next_args=d,r.apply(void 0,[a].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(o)))):r(a),c===e.length&&(null!==a._queue?this._scheduleExecute():a._on_cancel||a._limit_event||this._handle_success(this._next_args))}catch(e){this.state.last_exception=e,this._handle_error(e.message)}finally{this._in_exec=!1}this._post_exec(this)}}},{key:"_burst_success",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d;try{this._in_exec=!0,k=this,this._handle_success(e)}catch(e){this.state.last_exception=e,this._handle_error(e.message)}finally{this._in_exec=!1}this._post_exec(this)}},{key:"loop",value:function(e,t){return x(this,e),_(this,this,e,t),this}},{key:"repeat",value:function(e,t,n){return x(this,t),v(this,this,e,t,n),this}},{key:"forEach",value:function(e,t,n){return x(this,t),p(this,this,e,t,n),this}},{key:"successStep",value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];b(this);var o=this._queue;return o.length>0?o.push([function(){e._handle_success(n)},void 0]):this._next_args=n,this}},{key:"await",value:function(e,t){return b(this),y(this,this,e,t),this}},{key:"promise",value:function(){var e=this;return b(this),new Promise(function(t,n){var r=e._queue;e._queue=[[function(e){e._queue=r},function(e,t){n(new Error(t))}],[function(e,n){t(n)},void 0]],k=e,e._execute()})}},{key:"isAsyncSteps",value:function(){return!0}}]),e}();e.exports=q},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o=n(1),i=o.checkFunc,u=o.checkOnError,a=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._root=t,this._as=n,this._queue=[],this._psteps=[],this._complete_count=0}return r(e,[{key:"add",value:function(e,t){return i(this,e),u(this,t),this._queue.push([e,t]),this}},{key:"_complete",value:function(){this._complete_count+=1,this._complete_count===this._psteps.length&&(this._as._root._handle_success(),this._cleanup())}},{key:"_error",value:function(e,t){try{this._as.error(e,t)}catch(e){}}},{key:"executeParallel",value:function(t){var n=this,r=this._queue,o=this._root;if(o!==t._root){var i=new e(t._root,t);return i._queue.push.apply(i._queue,r),void i.executeParallel(t)}if(this._as=t,r.length){t._on_cancel=function(){n.cancel()};var u=this._psteps,a=function(e){n._complete()},c=function(e,t){n._error(t,e.state.error_info)},s=o.constructor;r.forEach(function(e){var n=new s(t.state,o._async_tool);n._queue.push([function(t){t._queue=[[e[0],e[1]]]},c],[a,void 0]),u.push(n)}),u.forEach(function(e){e.execute()})}else this._complete()}},{key:"cancel",value:function(){this._psteps.forEach(function(e){e.cancel()}),this._cleanup()}},{key:"isAsyncSteps",value:function(){return!0}},{key:"_cleanup",value:function(){this._root=null,this._as=null,this._psteps=null}}]),e}();e.exports=a},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o=n(2),i=n(0).DefenseRejected,u=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r._max=e,r._locked=0,r._owners=new WeakMap,r._queue=[],r._max_queue=n,r._release_handler=function(e){r._release(e._root)},r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o),r(t,[{key:"_lock",value:function(e,t){var n=this._owners,r=n.get(t);if(r)return n.set(t,r+1),!0;if(this._locked>=this._max){var o=this._queue,u=this._max_queue;return null!==u&&o.length>=u&&t.error(i,"Mutex queue limit"),o.push(e),!1}return this._locked+=1,n.set(t,1),!0}},{key:"_release",value:function(e){var t=this._owners,n=t.get(e);if(n){if(n>1)return void t.set(e,n-1);t.delete(e),this._locked-=1;for(var r=this._queue;r.length;){var o=r.shift();if(o.state){var i=o._root;this._lock(o,i),i._handle_success(o._call_args);break}}}else{var u=this._queue.indexOf(e);u>=0&&this._queue.splice(u,1)}}},{key:"sync",value:function(e,t,n){var r=this;e.add(function(e){!function(e,t,n,r){var o=e._root;e._on_cancel=t._release_handler,e._queue=[[function(n){t._lock(e,o)?o._handle_success(e._call_args):(n.waitExternal(),n._call_args=e._call_args)},void 0],[n,r],[function(e){t._release(o),o._handle_success(e._call_args)},void 0]]}(e,r,t,n)})}}]),t}();e.exports=u},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o=n(2),i=n(0).DefenseRejected,u=n(1).prev_queue,a=function(e,t,n,r){var o=e._root;t._lock(e)?(e._on_error=r,n.apply(void 0,[e].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(e._call_args)))):(e._on_cancel=t._cancel_handler,o._next_args=e._call_args,u(o).unshift([n,r]))},c=function(e){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));o._max=e,o._current=0;var i=o._queue=[];return o._timer=null,o._period_ms=n,o._max_queue=r,o._cancel_handler=function(e){var t=i.indexOf(e);t>=0&&i.splice(t,1)},o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o),r(t,[{key:"_lock",value:function(e){if(this._ensureTimer(),this._current>=this._max){var t=this._queue,n=this._max_queue;return null!==n&&t.length>=n&&e.error(i,"Throttle queue limit"),t.push(e),!1}return this._current+=1,!0}},{key:"_ensureTimer",value:function(){var e=this;this._timer||(this._timer=setInterval(function(){e._resetPeriod()},this._period_ms))}},{key:"_resetPeriod",value:function(){this._current=0;var e=this._queue;if(!e.length)return clearInterval(this._timer),void(this._timer=null);for(var t=this._max,n=0;e.length&&n<t;){var r=e.shift();if(r.state){++n;var o=r._root;o._handle_success(o._next_args)}}this._current=n}},{key:"sync",value:function(e,t,n){var r=this;e.add(function(e){a(e,r,t,n)})}}]),t}();e.exports=c},function(e,t,n){"use strict";!function(t){var r=t.FutoIn||t.futoin||{};if(void 0===r.$asyncevent){var o=n(9);t.$asyncevent=o,r.$asyncevent=o,r.EventEmitter=o.EventEmitter,t.FutoIn=r,t.futoin=r}e.exports=r.$asyncevent}(window)},function(e,t,n){"use strict";var r=n(10),o=r.attach;o.EventEmitter=r,e.exports=o},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var i=n(11),u=Symbol("FutoIn Event Emitter"),a="_evt_",c="_evtonce_",s=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._max=n,this._scheduleCall=i.ActiveAsyncTool.callImmediate;var r=!0,o=!1,u=void 0;try{for(var s,l=t[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var f=s.value;this[""+a+f]=[],this[""+c+f]=[]}}catch(e){o=!0,u=e}finally{try{!r&&l.return&&l.return()}finally{if(o)throw u}}}return r(e,[{key:"on",value:function(e,t){try{var n=this[""+a+e];n.length===this._max&&console.warn("Hitting max handler limit for: "+e),n.push(t)}catch(t){throw new Error("Unknown event: "+e)}}},{key:"once",value:function(e,t){try{var n=this[""+c+e];n.length===this._max&&console.warn("Hitting max once handler limit for: "+e),n.push(t)}catch(t){throw new Error("Unknown event: "+e)}}},{key:"off",value:function(e,t){try{var n=""+a+e;this[n]=this[n].filter(function(e){return e!==t});var r=""+c+e;this[r]=this[r].filter(function(e){return e!==t})}catch(t){throw new Error("Unknown event: "+e)}}},{key:"emit",value:function(e){for(var t=this,n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];var i=this[""+a+e],u=this[""+c+e];if(void 0===i)throw new Error("Unknown event: "+e);var s=[],l=!0,f=!1,h=void 0;try{for(var _,v=i[Symbol.iterator]();!(l=(_=v.next()).done);l=!0){var p=_.value;s.push(p)}}catch(e){f=!0,h=e}finally{try{!l&&v.return&&v.return()}finally{if(f)throw h}}if(u.length){var y=!0,d=!1,m=void 0;try{for(var b,x=u[Symbol.iterator]();!(y=(b=x.next()).done);y=!0){var g=b.value;s.push(g)}}catch(e){d=!0,m=e}finally{try{!y&&x.return&&x.return()}finally{if(d)throw m}}this[""+c+e]=[]}this._scheduleCall(function(){var e=!0,n=!1,o=void 0;try{for(var i,u=s[Symbol.iterator]();!(e=(i=u.next()).done);e=!0){var a=i.value;try{a.apply(void 0,r)}catch(e){t._scheduleCall(function(){throw e})}}}catch(e){n=!0,o=e}finally{try{!e&&u.return&&u.return()}finally{if(n)throw o}}})}}],[{key:Symbol.hasInstance,value:function(t){return void 0!==t[u]||t.constructor===e}},{key:"attach",value:function(t,n){var r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,s=t[u];if(void 0===s){var l=new e(n,i);Object.defineProperties(t,(o(r={},u,{configurable:!1,enumerable:!1,writable:!1,value:l}),o(r,"on",{configurable:!1,enumerable:!1,writable:!1,value:function(e,t){return l.on(e,t)}}),o(r,"off",{configurable:!1,enumerable:!1,writable:!1,value:function(e,t){return l.off(e,t)}}),o(r,"once",{configurable:!1,enumerable:!1,writable:!1,value:function(e,t){return l.once(e,t)}}),o(r,"emit",{configurable:!1,enumerable:!1,writable:!1,value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return l.emit.apply(l,[e].concat(n))}}),r))}else{s._max=i;var f=!0,h=!1,_=void 0;try{for(var v,p=n[Symbol.iterator]();!(f=(v=p.next()).done);f=!0){var y=v.value;if(""+a+y in s)throw new Error('Event "'+y+'" has been already registered!');s[""+a+y]=[],s[""+c+y]=[]}}catch(e){h=!0,_=e}finally{try{!f&&p.return&&p.return()}finally{if(h)throw _}}}}},{key:"setMaxListeners",value:function(e,t){e[u]._max=t}},{key:"SYM_EVENT_EMITTER",get:function(){return u}}]),e}();e.exports=s},function(e,t,n){"use strict";!function(t){var r=t.FutoIn||t.futoin||{};if(void 0===r.AsyncSteps){var o=n(12);t.$as=o,r.$as=o,t.FutoInError=o.FutoInError,r.AsyncSteps=o.AsyncSteps,t.FutoIn=r,t.futoin=r}e.exports=r.$as}(window)},function(e,t,n){"use strict";(t=e.exports=n(13)).ISync=n(2),t.Mutex=n(6),t.Throttle=n(7),t.Limiter=n(17),t.testcase=n(18)},function(e,t,n){"use strict";var r=n(3),o=n(14),i=n(0),u=n(4),a=n(1).isProduction;(t=e.exports=function(){return new u(null,t.ActiveAsyncTool)}).ActiveAsyncTool=r,t.AsyncTool=r,t.AsyncToolTest=o,t.FutoInError=i,t.Errors=i,t.AsyncSteps=u,t.isProduction=a,t.installAsyncToolTest=function(e){t.ActiveAsyncTool=!1===e?r:o},t.assertAS=function(e){try{if(e.isAsyncSteps())return}catch(e){}throw new Error("Not an instance of AsyncSteps: "+e)}},function(e,t,n){"use strict";var r=n(15),o=[];(t=e.exports={}).callLater=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=1e3*r();t&&(n+=t);for(var i={f:e,t:n},u=0;u<o.length;++u)if(o[u].t>n)return void o.splice(u,0,i);return o.push(i),i},t.cancelCall=function(e){var t=o.indexOf(e);t>=0&&o.splice(t,1)},t.nextEvent=function(){o.shift().f()},t.hasEvents=function(){return o.length>0},t.getEvents=function(){return o},t.resetEvents=function(){o.splice(0,o.length)},t.run=function(){for(;this.hasEvents();)this.nextEvent()},t.callImmediate=t.callLater,t.cancelImmediate=t.cancelCall},function(e,t){(function(){var t,n,r,o,i,u;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(e.exports=function(){return(t()-i)/1e6},n=process.hrtime,o=(t=function(){var e;return 1e9*(e=n())[0]+e[1]})(),u=1e9*process.uptime(),i=o-u):Date.now?(e.exports=function(){return Date.now()-r},r=Date.now()):(e.exports=function(){return(new Date).getTime()-r},r=(new Date).getTime())}).call(this)},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o=n(5),i=n(0),u=i.InternalError,a=i.Timeout,c=i.LoopBreak,s=i.LoopCont,l=n(1),f=l.isProduction,h=l.checkFunc,_=l.checkOnError,v=l.noop,p=l.loop,y=l.repeat,d=l.forEach,m=l.LOOP_TERM_LABEL,b=l.as_await,x=f?v:function(e){var t=e._root;if(t){var n=t._stack;if(n){if(n[n.length-1]===e)return;t.error(u,"Invalid call (sanity check)")}}throw new Error("InternalError: Unexpected call, object is out of service")},g=f?v:function(e,t,n){x(e),h(e,t),_(e,n)},w=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._root=t,this.state=t.state,this._queue=null,this._call_args=r,this._on_error=n,this._on_cancel=null,this._limit_event=null}return r(e,[{key:"add",value:function(e,t){g(this,e,t);var n=[e,t],r=this._queue;return r?r.push(n):this._queue=[n],this}},{key:"parallel",value:function(e){var t=new o(this._root,this);return this.add(function(e){t.executeParallel(e)},e),t}},{key:"success",value:function(){x(this),null!==this._queue&&this.error(u,"Invalid success() call");for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];this._root._handle_success(t)}},{key:"error",value:function(e,t){x(this),this._root.error(e,t)}},{key:"setTimeout",value:function(e){var t=this;x(this);var n=this._root._async_tool;return null!==this._limit_event&&n.cancelCall(this._limit_event),this._limit_event=n.callLater(function(){!function(e){e._limit_event=null;var t=e.state;t.error_info=void 0,t.last_exception=new Error(a),e._root._handle_error(a)}(t)},e),this}},{key:"setCancel",value:function(e){return this._on_cancel=e,this}},{key:"waitExternal",value:function(){return this._on_cancel=v,this}},{key:"copyFrom",value:function(e){if(x(this),e._queue.length){var t=this._queue;null===t&&(t=[],this._queue=t),t.push.apply(t,e._queue)}var n=e.state,r=this.state;for(var o in n)void 0===r[o]&&(r[o]=n[o]);return this}},{key:"loop",value:function(e,t){return g(this,e),p(this,this._root,e,t),this}},{key:"repeat",value:function(e,t,n){return g(this,t),y(this,this._root,e,t,n),this}},{key:"forEach",value:function(e,t,n){return g(this,t),d(this,this._root,e,t,n),this}},{key:"break",value:function(e){x(this),this.state[m]=e,this._root.error(c)}},{key:"continue",value:function(e){x(this),this.state[m]=e,this._root.error(s)}},{key:"successStep",value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];x(this);var o=this._queue;return o&&o.length?o.push([function(){e._root._handle_success(n)},void 0]):this._root._next_args=n,this}},{key:"await",value:function(e,t){return x(this),b(this,this._root,e,t),this}},{key:"sync",value:function(e,t,n){return g(this,t,n),e.sync(this,t,n),this}},{key:"isAsyncSteps",value:function(){return!0}},{key:"_cleanup",value:function(){this._root=null,this.state=null}}]),e}();e.exports=w},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var o=n(2),i=n(6),u=n(7),a=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n._mutex=new i(e.concurrent||1,e.max_queue||0),n._throttle=new u(e.rate||1,e.period_ms||1e3,e.burst||0),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o),r(t,[{key:"sync",value:function(e,t,n){var r=this;e.sync(this._mutex,function(e){e._root._next_args=e._call_args,e.sync(r._throttle,t,n)})}}]),t}();e.exports=a},function(e,t,n){"use strict";var r=n(4);e.exports=function(e,t){return function(n){var o=this,i=new r;i.add(function(n){n.add(function(n){e.call(o,n),t&&n.add(function(e){e.error("NegativeTestMustThrow")})},t)},function(e,t){console.log("ERROR: "+t+" ("+e.state.error_info+")"),n(e.state.last_exception||new Error("Generic Fail"))}),i.add(function(e){return n()}),i.execute()}}}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["futoin-asyncevent"]=t():e.$asyncevent=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=8)}([function(e,t,n){"use strict";var r=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)};["ConnectError","CommError","UnknownInterface","NotSupportedVersion","NotImplemented","Unauthorized","InternalError","InvokerError","InvalidRequest","DefenseRejected","PleaseReauth","SecurityError","Timeout","LoopBreak","LoopCont"].forEach(function(e){return Object.defineProperty(r,e,{enumerable:!0,value:e})}),e.exports=r},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var u,c=e[Symbol.iterator]();!(r=(u=c.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var i=n(0),u=(i.InternalError,i.LoopCont),c=i.LoopBreak,a="undefined"==typeof Symbol?function(e){return e}:function(e){return Symbol(e)},s=a("_loop_term_label"),l=function(e,t,n,r,o){o&&o()||e.add(function(e){var i=e.state,a=t._exec_stack,l=a.length,f=[n,function(t,n){!function(e,t,n,r,o){if(t===u){var i=r[s];i&&i!==o||(r.last_exception=null,e._root._handle_success())}else if(t===c){var a=r[s];a&&a!==o||(r.last_exception=null,n._queue.length=0,e._root._handle_success())}}(t,n,e,i,r)}],h=[function(e){o&&o()||(a.length=l,_())},null],_=function(){e._queue=[f,h]};_()})},f=function(e,t,n,r,o){var i=0,u=n;l(e,t,function(e){r(e,i++)},o,function(){return i>=u})},h=[];Object.freeze(h);var _=function(){};e.exports=t={noop:_,makeSym:a,loop:l,repeat:f,forEach:function(e,t,n,r,i){if(Array.isArray(n)){var u=n;f(e,t,u.length,function(e,t){r(e,t,u[t])},i)}else if("undefined"!=typeof Map&&n instanceof Map){var c=n.entries();l(e,t,function(e){var t=c.next();t.done&&e.break();var n=o(t.value,2),i=n[0],u=n[1];r(e,i,u)},i)}else{var a=n,s=Object.keys(a);f(e,t,s.length,function(e,t){r(e,s[t],a[s[t]])},i)}},LOOP_TERM_LABEL:s,as_await:function(e,t,n,r){var o,i;n.then(function(e){o?o.state&&t._burst_success([e]):i=function(){t._handle_success([e])}},function(e){o?function(e,t,n){var r=e.state;if(r)if(e._on_cancel=null,n instanceof Error)r.last_exception=n,r.error_info=void 0,t._handle_error("PromiseReject");else{var o=n||"PromiseReject";r.last_exception=new Error(o),r.error_info=void 0,t._handle_error(o)}}(o,t,e):(o=null,i=e instanceof Error?function(){throw e}:function(t){t.error(e||"PromiseReject")})}),e.add(function(e){i?i(e):(o=e,e._on_cancel=function(){if(o){o=null;try{n.cancel()}catch(e){}}})},r)},EMPTY_ARRAY:h,prev_queue:function(e){var t=e._stack,n=t.length;return n>1?t[n-2]._queue:e._queue}},t.isProduction=!0,t.checkFunc=_,t.checkOnError=_;var v=new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,o;return t=e,(n=[{key:"push",value:function(){}},{key:"length",get:function(){return 0},set:function(e){}}])&&r(t.prototype,n),o&&r(t,o),e}());Object.freeze(v),t.newExecStack=function(){return v}},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=n(0).NotImplemented,i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,i;return t=e,(n=[{key:"sync",value:function(e,t,n){e.error(o,"#sync() API")}}])&&r(t.prototype,n),i&&r(t,i),e}();e.exports=i},function(e,t,n){"use strict";if(t=e.exports={},"undefined"==typeof setImmediate){t.callLater=function(e,t){return setTimeout(e,t)},t.cancelCall=function(e){return clearTimeout(e)},window._FutoInEventLoopQueue=window._FutoInEventLoopQueue||[];var r=window._FutoInEventLoopQueue,o=window.performance,i=null,u=function(){i&&clearTimeout(i),i=setTimeout(c,0)},c=function(){i=null;for(var e=o.now()+10;r.length;){var t=r.shift();try{t()}catch(e){throw u(),e}if(o.now()>=e){u();break}}};t.callImmediate=function(e){r.length||u();var t=function(){e()};return r.push(t),t},t.cancelImmediate=function(e){var t=r.indexOf(e);t>=0&&r.splice(t,1)}}else t.callLater=function(e,t){return setTimeout(e,t)},t.cancelCall=function(e){clearTimeout(e)},t.callImmediate=function(e){return setImmediate(e)},t.cancelImmediate=function(e){clearImmediate(e)}},function(e,t,n){"use strict";function r(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var i=n(3),u=n(0).InternalError,c=n(16),a=n(5),s=n(1),l=s.isProduction,f=s.checkFunc,h=s.checkOnError,_=s.noop,v=s.loop,p=s.repeat,y=s.forEach,d=s.as_await,m=s.EMPTY_ARRAY,b=s.newExecStack,w=l?_:function(e){e._stack.length>0&&e.error(u,"Top level add in execution")},g=l?_:function(e,t,n){w(e),f(e,t),h(e,n)},x=100,k=x,E=null,O=function(e){e._post_exec=_,e._execute()},q=function(){function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),null===n&&(n=function(){return this.state}),this.state=n,this._queue=[],this._stack=[],this._exec_stack=b(),this._in_exec=!1,this._post_exec=_,this._exec_event=null,this._next_args=m,this._async_tool=r;var o=r.callImmediate,u=function(){k=x,E=t,t._exec_event=null,t._execute()};this._scheduleExecute=function(){--k<=0||!t._in_exec||E!==t?t._exec_event=o(u):t._in_exec&&(t._post_exec=O)}}var t,n,s;return t=e,(n=[{key:"add",value:function(e,t){return g(this,e,t),this._queue.push([e,t]),this}},{key:"parallel",value:function(e){w(this),h(this,e);var t=new a(this,this);return this._queue.push([function(e){t.executeParallel(e)},e]),t}},{key:"sync",value:function(e,t,n){return g(this,t,n),e.sync(this,t,n),this}},{key:"error",value:function(e,t){this.state.error_info=t;var n=new Error(e);throw this._in_exec||(this.state.last_exception=n,this._handle_error(e)),n}},{key:"copyFrom",value:function(e){this._queue.push.apply(this._queue,e._queue);var t=e.state,n=this.state;for(var r in t)r in n||(n[r]=t[r]);return this}},{key:"_handle_success",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m,t=this._stack;t.length||this.error(u,"Invalid success completion"),this._next_args=e;for(var n=t[t.length-1];;){var r=n._limit_event;if(r&&(this._async_tool.cancelCall(r),n._limit_event=null),n._cleanup(),t.pop(),!t.length)break;if((n=t[t.length-1])._queue.length)break}(t.length||this._queue.length)&&this._scheduleExecute()}},{key:"_handle_error",value:function(e){if(this._exec_event)this.cancel();else{this._next_args=m;var t=this._stack,n=this._exec_stack;this.state.async_stack=n;for(var r=this._in_exec,o=!0;t.length;){var i=t[t.length-1],u=i._limit_event,c=i._on_cancel,a=i._on_error;if(u&&(this._async_tool.cancelCall(u),i._limit_event=null),c&&(c.call(null,i),i._on_cancel=null),a){var s=t.length;i._queue=null,i._on_error=null,n.push(a);try{if(this._in_exec=!0,a.call(null,i,e),s!==t.length){o=!1;break}if(null!==i._queue){o=!1,this._scheduleExecute();break}}catch(t){this.state.last_exception=t,e=t.message}finally{this._in_exec=r}}i._cleanup(),t.pop()}o?this._queue=[]:r||this._post_exec(this)}}},{key:"cancel",value:function(){this._next_args=m;var e=this._exec_event;e&&(this._async_tool.cancelImmediate(e),this._exec_event=null);for(var t=this._stack,n=this._async_tool;t.length;){var r=t.pop(),o=r._limit_event,i=r._on_cancel;o&&(n.cancelCall(o),r._limit_event=null),i&&(i.call(null,r),r._on_cancel=null),r._cleanup()}return this._queue=[],this}},{key:"execute",value:function(){var e=E;return E=this,this._execute(),E=e,this}},{key:"_execute",value:function(){var e,t=this._stack;if((e=t.length?t[t.length-1]._queue:this._queue).length){var n=e.shift(),o=n[0];this._exec_stack.push(o);var i=this._next_args,u=i.length,a=new c(this,n[1],i);t.push(a);try{var s=t.length;this._in_exec=!0,u?(this._next_args=m,o.apply(void 0,[a].concat(r(i)))):o(a),s===t.length&&(null!==a._queue?this._scheduleExecute():a._on_cancel||a._limit_event||this._handle_success(this._next_args))}catch(e){this.state.last_exception=e,this._handle_error(e.message)}finally{this._in_exec=!1}this._post_exec(this)}}},{key:"_burst_success",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m;try{this._in_exec=!0,E=this,this._handle_success(e)}catch(e){this.state.last_exception=e,this._handle_error(e.message)}finally{this._in_exec=!1}this._post_exec(this)}},{key:"loop",value:function(e,t){return g(this,e),v(this,this,e,t),this}},{key:"repeat",value:function(e,t,n){return g(this,t),p(this,this,e,t,n),this}},{key:"forEach",value:function(e,t,n){return g(this,t),y(this,this,e,t,n),this}},{key:"successStep",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];w(this);var o=this._queue;return o.length>0?o.push([function(){e._handle_success(n)},void 0]):this._next_args=n,this}},{key:"await",value:function(e,t){return w(this),d(this,this,e,t),this}},{key:"promise",value:function(){var e=this;return w(this),new Promise(function(t,n){var r=e._queue;e._queue=[[function(e){e._queue=r},function(e,t){n(new Error(t))}],[function(e,n){t(n)},void 0]],E=e,e._execute()})}},{key:"isAsyncSteps",value:function(){return!0}}])&&o(t.prototype,n),s&&o(t,s),e}();e.exports=q},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=n(1),i=o.checkFunc,u=o.checkOnError,c=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._root=t,this._as=n,this._queue=[],this._psteps=[],this._complete_count=0}var t,n,o;return t=e,(n=[{key:"add",value:function(e,t){return i(this,e),u(this,t),this._queue.push([e,t]),this}},{key:"_complete",value:function(){this._complete_count+=1,this._complete_count===this._psteps.length&&(this._as._root._handle_success(),this._cleanup())}},{key:"_error",value:function(e,t){try{this._as.error(e,t)}catch(e){}}},{key:"executeParallel",value:function(t){var n=this,r=this._queue,o=this._root;if(o!==t._root){var i=new e(t._root,t);return i._queue.push.apply(i._queue,r),void i.executeParallel(t)}if(this._as=t,r.length){t._on_cancel=function(){n.cancel()};var u=this._psteps,c=function(e){n._complete()},a=function(e,t){n._error(t,e.state.error_info)},s=o.constructor;r.forEach(function(e){var n=new s(t.state,o._async_tool);n._queue.push([function(t){t._queue=[[e[0],e[1]]]},a],[c,void 0]),u.push(n)}),u.forEach(function(e){e.execute()})}else this._complete()}},{key:"cancel",value:function(){this._psteps.forEach(function(e){e.cancel()}),this._cleanup()}},{key:"isAsyncSteps",value:function(){return!0}},{key:"_cleanup",value:function(){this._root=null,this._as=null,this._psteps=null}}])&&r(t.prototype,n),o&&r(t,o),e}();e.exports=c},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var a=n(2),s=n(0).DefenseRejected,l=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=i(this,u(t).call(this)))._max=n,e._locked=0,e._owners=new WeakMap,e._queue=[],e._max_queue=r,e._release_handler=function(t){e._release(t._root)},e}var n,r,l;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(t,a),n=t,(r=[{key:"_lock",value:function(e,t){var n=this._owners,r=n.get(t);if(r)return n.set(t,r+1),!0;if(this._locked>=this._max){var o=this._queue,i=this._max_queue;return null!==i&&o.length>=i&&t.error(s,"Mutex queue limit"),o.push(e),!1}return this._locked+=1,n.set(t,1),!0}},{key:"_release",value:function(e){var t=this._owners,n=t.get(e);if(n){if(n>1)return void t.set(e,n-1);t.delete(e),this._locked-=1;for(var r=this._queue;r.length;){var o=r.shift();if(o.state){var i=o._root;this._lock(o,i),i._handle_success(o._call_args);break}}}else{var u=this._queue.indexOf(e);u>=0&&this._queue.splice(u,1)}}},{key:"sync",value:function(e,t,n){var r=this;e.add(function(e){!function(e,t,n,r){var o=e._root;e._on_cancel=t._release_handler,e._queue=[[function(n){t._lock(e,o)?o._handle_success(e._call_args):(n.waitExternal(),n._call_args=e._call_args)},void 0],[n,r],[function(e){t._release(o),o._handle_success(e._call_args)},void 0]]}(e,r,t,n)})}}])&&o(n.prototype,r),l&&o(n,l),t}();e.exports=l},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var s=n(2),l=n(0).DefenseRejected,f=n(1).prev_queue,h=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=i(this,u(t).call(this)))._max=e,n._current=0;var c=n._queue=[];return n._timer=null,n._period_ms=r,n._max_queue=o,n._cancel_handler=function(e){var t=c.indexOf(e);t>=0&&c.splice(t,1)},n}var n,r,h;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(t,s),n=t,(r=[{key:"_lock",value:function(e){if(this._ensureTimer(),this._current>=this._max){var t=this._queue,n=this._max_queue;return null!==n&&t.length>=n&&e.error(l,"Throttle queue limit"),t.push(e),!1}return this._current+=1,!0}},{key:"_ensureTimer",value:function(){var e=this;this._timer||(this._timer=setInterval(function(){e._resetPeriod()},this._period_ms))}},{key:"_resetPeriod",value:function(){this._current=0;var e=this._queue;if(!e.length)return clearInterval(this._timer),void(this._timer=null);for(var t=this._max,n=0;e.length&&n<t;){var r=e.shift();if(r.state){++n;var o=r._root;o._handle_success(o._next_args)}}this._current=n}},{key:"sync",value:function(e,t,n){var r=this;e.add(function(e){!function(e,t,n,r){var o=e._root;t._lock(e)?(e._on_error=r,n.apply(void 0,[e].concat(a(e._call_args)))):(e._on_cancel=t._cancel_handler,o._next_args=e._call_args,f(o).unshift([n,r]))}(e,r,t,n)})}}])&&o(n.prototype,r),h&&o(n,h),t}();e.exports=h},function(e,t,n){"use strict";!function(t){var r=t.FutoIn||t.futoin||{};if(void 0===r.$asyncevent){var o=n(9);t.$asyncevent=o,r.$asyncevent=o,r.EventEmitter=o.EventEmitter,t.FutoIn=r,t.futoin=r}e.exports=r.$asyncevent}(window)},function(e,t,n){"use strict";var r=n(10),o=r.attach;o.EventEmitter=r,e.exports=o},function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var i=n(11),u=Symbol("FutoIn Event Emitter"),c="_evt_",a="_evtonce_",s=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._max=n,this._scheduleCall=i.ActiveAsyncTool.callImmediate;var r=!0,o=!1,u=void 0;try{for(var s,l=t[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var f=s.value;this["".concat(c).concat(f)]=[],this["".concat(a).concat(f)]=[]}}catch(e){o=!0,u=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw u}}}var t,n,s;return t=e,n=[{key:"on",value:function(e,t){try{var n=this["".concat(c).concat(e)];n.length===this._max&&console.warn("Hitting max handler limit for: ".concat(e)),n.push(t)}catch(t){throw new Error("Unknown event: ".concat(e))}}},{key:"once",value:function(e,t){try{var n=this["".concat(a).concat(e)];n.length===this._max&&console.warn("Hitting max once handler limit for: ".concat(e)),n.push(t)}catch(t){throw new Error("Unknown event: ".concat(e))}}},{key:"off",value:function(e,t){try{var n="".concat(c).concat(e);this[n]=this[n].filter(function(e){return e!==t});var r="".concat(a).concat(e);this[r]=this[r].filter(function(e){return e!==t})}catch(t){throw new Error("Unknown event: ".concat(e))}}},{key:"emit",value:function(e){for(var t=this,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];var i=this["".concat(c).concat(e)],u=this["".concat(a).concat(e)];if(void 0===i)throw new Error("Unknown event: ".concat(e));var s=[],l=!0,f=!1,h=void 0;try{for(var _,v=i[Symbol.iterator]();!(l=(_=v.next()).done);l=!0){var p=_.value;s.push(p)}}catch(e){f=!0,h=e}finally{try{l||null==v.return||v.return()}finally{if(f)throw h}}if(u.length){var y=!0,d=!1,m=void 0;try{for(var b,w=u[Symbol.iterator]();!(y=(b=w.next()).done);y=!0){var g=b.value;s.push(g)}}catch(e){d=!0,m=e}finally{try{y||null==w.return||w.return()}finally{if(d)throw m}}this["".concat(a).concat(e)]=[]}this._scheduleCall(function(){for(var e=0;e<s.length;e++){var n=s[e];try{n.apply(void 0,r)}catch(e){t._scheduleCall(function(){throw e})}}})}}],s=[{key:Symbol.hasInstance,value:function(t){return void 0!==t[u]||t.constructor===e}},{key:"attach",value:function(t,n){var o,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,s=t[u];if(void 0===s){var l=new e(n,i);Object.defineProperties(t,(r(o={},u,{configurable:!1,enumerable:!1,writable:!1,value:l}),r(o,"on",{configurable:!1,enumerable:!1,writable:!1,value:function(e,t){return l.on(e,t)}}),r(o,"off",{configurable:!1,enumerable:!1,writable:!1,value:function(e,t){return l.off(e,t)}}),r(o,"once",{configurable:!1,enumerable:!1,writable:!1,value:function(e,t){return l.once(e,t)}}),r(o,"emit",{configurable:!1,enumerable:!1,writable:!1,value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return l.emit.apply(l,[e].concat(n))}}),o))}else{s._max=i;var f=!0,h=!1,_=void 0;try{for(var v,p=n[Symbol.iterator]();!(f=(v=p.next()).done);f=!0){var y=v.value;if("".concat(c).concat(y)in s)throw new Error('Event "'.concat(y,'" has been already registered!'));s["".concat(c).concat(y)]=[],s["".concat(a).concat(y)]=[]}}catch(e){h=!0,_=e}finally{try{f||null==p.return||p.return()}finally{if(h)throw _}}}}},{key:"setMaxListeners",value:function(e,t){e[u]._max=t}},{key:"SYM_EVENT_EMITTER",get:function(){return u}}],n&&o(t.prototype,n),s&&o(t,s),e}();e.exports=s},function(e,t,n){"use strict";!function(t){var r=t.FutoIn||t.futoin||{};if(void 0===r.AsyncSteps){var o=n(12);t.$as=o,r.$as=o,t.FutoInError=o.FutoInError,r.AsyncSteps=o.AsyncSteps,t.FutoIn=r,t.futoin=r}e.exports=r.$as}(window)},function(e,t,n){"use strict";(t=e.exports=n(13)).ISync=n(2),t.Mutex=n(6),t.Throttle=n(7),t.Limiter=n(17),t.testcase=n(18)},function(e,t,n){"use strict";var r=n(3),o=n(14),i=n(0),u=n(4),c=n(1).isProduction;(t=e.exports=function(){return new u(null,t.ActiveAsyncTool)}).ActiveAsyncTool=r,t.AsyncTool=r,t.AsyncToolTest=o,t.FutoInError=i,t.Errors=i,t.AsyncSteps=u,t.isProduction=c,t.installAsyncToolTest=function(e){t.ActiveAsyncTool=!1===e?r:o},t.assertAS=function(e){try{if(e.isAsyncSteps())return}catch(e){}throw new Error("Not an instance of AsyncSteps: ".concat(e))}},function(e,t,n){"use strict";var r=n(15),o=[];(t=e.exports={}).callLater=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=1e3*r();t&&(n+=t);for(var i={f:e,t:n},u=0;u<o.length;++u)if(o[u].t>n)return void o.splice(u,0,i);return o.push(i),i},t.cancelCall=function(e){var t=o.indexOf(e);t>=0&&o.splice(t,1)},t.nextEvent=function(){o.shift().f()},t.hasEvents=function(){return o.length>0},t.getEvents=function(){return o},t.resetEvents=function(){o.splice(0,o.length)},t.run=function(){for(;this.hasEvents();)this.nextEvent()},t.callImmediate=t.callLater,t.cancelImmediate=t.cancelCall},function(e,t){(function(){var t,n,r,o,i,u;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(e.exports=function(){return(t()-i)/1e6},n=process.hrtime,o=(t=function(){var e;return 1e9*(e=n())[0]+e[1]})(),u=1e9*process.uptime(),i=o-u):Date.now?(e.exports=function(){return Date.now()-r},r=Date.now()):(e.exports=function(){return(new Date).getTime()-r},r=(new Date).getTime())}).call(this)},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=n(5),i=n(0),u=i.InternalError,c=i.Timeout,a=i.LoopBreak,s=i.LoopCont,l=n(1),f=l.isProduction,h=l.checkFunc,_=l.checkOnError,v=l.noop,p=l.loop,y=l.repeat,d=l.forEach,m=l.LOOP_TERM_LABEL,b=l.as_await,w=f?v:function(e){var t=e._root;if(t){var n=t._stack;if(n){if(n[n.length-1]===e)return;t.error(u,"Invalid call (sanity check)")}}throw new Error("InternalError: Unexpected call, object is out of service")},g=f?v:function(e,t,n){w(e),h(e,t),_(e,n)},x=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._root=t,this.state=t.state,this._queue=null,this._call_args=r,this._on_error=n,this._on_cancel=null,this._limit_event=null}var t,n,i;return t=e,(n=[{key:"add",value:function(e,t){g(this,e,t);var n=[e,t],r=this._queue;return r?r.push(n):this._queue=[n],this}},{key:"parallel",value:function(e){var t=new o(this._root,this);return this.add(function(e){t.executeParallel(e)},e),t}},{key:"success",value:function(){w(this),null!==this._queue&&this.error(u,"Invalid success() call");for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._root._handle_success(t)}},{key:"error",value:function(e,t){w(this),this._root.error(e,t)}},{key:"setTimeout",value:function(e){var t=this;w(this);var n=this._root._async_tool;return null!==this._limit_event&&n.cancelCall(this._limit_event),this._limit_event=n.callLater(function(){!function(e){e._limit_event=null;var t=e.state;t.error_info=void 0,t.last_exception=new Error(c),e._root._handle_error(c)}(t)},e),this}},{key:"setCancel",value:function(e){return this._on_cancel=e,this}},{key:"waitExternal",value:function(){return this._on_cancel=v,this}},{key:"copyFrom",value:function(e){if(w(this),e._queue.length){var t=this._queue;null===t&&(t=[],this._queue=t),t.push.apply(t,e._queue)}var n=e.state,r=this.state;for(var o in n)void 0===r[o]&&(r[o]=n[o]);return this}},{key:"loop",value:function(e,t){return g(this,e),p(this,this._root,e,t),this}},{key:"repeat",value:function(e,t,n){return g(this,t),y(this,this._root,e,t,n),this}},{key:"forEach",value:function(e,t,n){return g(this,t),d(this,this._root,e,t,n),this}},{key:"break",value:function(e){w(this),this.state[m]=e,this._root.error(a)}},{key:"continue",value:function(e){w(this),this.state[m]=e,this._root.error(s)}},{key:"successStep",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];w(this);var o=this._queue;return o&&o.length?o.push([function(){e._root._handle_success(n)},void 0]):this._root._next_args=n,this}},{key:"await",value:function(e,t){return w(this),b(this,this._root,e,t),this}},{key:"sync",value:function(e,t,n){return g(this,t,n),e.sync(this,t,n),this}},{key:"isAsyncSteps",value:function(){return!0}},{key:"_cleanup",value:function(){this._root=null,this.state=null}}])&&r(t.prototype,n),i&&r(t,i),e}();e.exports=x},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var a=n(2),s=n(6),l=n(7),f=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=i(this,u(t).call(this)))._mutex=new s(n.concurrent||1,n.max_queue||0),e._throttle=new l(n.rate||1,n.period_ms||1e3,n.burst||0),e}var n,r,f;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(t,a),n=t,(r=[{key:"sync",value:function(e,t,n){var r=this;e.sync(this._mutex,function(e){e._root._next_args=e._call_args,e.sync(r._throttle,t,n)})}}])&&o(n.prototype,r),f&&o(n,f),t}();e.exports=f},function(e,t,n){"use strict";var r=n(4);e.exports=function(e,t){return function(n){var o=this,i=new r;i.add(function(n){n.add(function(n){e.call(o,n),t&&n.add(function(e){e.error("NegativeTestMustThrow")})},t)},function(e,t){console.log("ERROR: ".concat(t," (").concat(e.state.error_info,")")),n(e.state.last_exception||new Error("Generic Fail"))}),i.add(function(e){return n()}),i.execute()}}}])});

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

!function(t){var n={};function r(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=n,r.d=function(t,n,e){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)r.d(e,o,function(n){return t[n]}.bind(null,o));return e},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="",r(r.s=37)}([function(t,n,r){var e=r(18)("wks"),o=r(10),i=r(1).Symbol,u="function"==typeof i;(t.exports=function(t){return e[t]||(e[t]=u&&i[t]||(u?i:o)("Symbol."+t))}).store=e},function(t,n){var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(t,n){var r={}.hasOwnProperty;t.exports=function(t,n){return r.call(t,n)}},function(t,n,r){var e=r(4),o=r(13);t.exports=r(5)?function(t,n,r){return e.f(t,n,o(1,r))}:function(t,n,r){return t[n]=r,t}},function(t,n,r){var e=r(12),o=r(29),i=r(17),u=Object.defineProperty;n.f=r(5)?Object.defineProperty:function(t,n,r){if(e(t),n=i(n,!0),e(r),o)try{return u(t,n,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[n]=r.value),t}},function(t,n,r){t.exports=!r(11)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n,r){var e=r(44),o=r(22);t.exports=function(t){return e(o(t))}},function(t,n){var r=t.exports={version:"2.5.7"};"number"==typeof __e&&(__e=r)},function(t,n,r){var e=r(1),o=r(3),i=r(2),u=r(10)("src"),c=Function.toString,f=(""+c).split("toString");r(8).inspectSource=function(t){return c.call(t)},(t.exports=function(t,n,r,c){var s="function"==typeof r;s&&(i(r,"name")||o(r,"name",n)),t[n]!==r&&(s&&(i(r,u)||o(r,u,t[n]?""+t[n]:f.join(String(n)))),t===e?t[n]=r:c?t[n]?t[n]=r:o(t,n,r):(delete t[n],o(t,n,r)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[u]||c.call(this)})},function(t,n){var r=0,e=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+e).toString(36))}},function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,n,r){var e=r(6);t.exports=function(t){if(!e(t))throw TypeError(t+" is not an object!");return t}},function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n){t.exports=!1},function(t,n,r){n.f=r(0)},function(t,n,r){var e=r(31),o=r(25);t.exports=Object.keys||function(t){return e(t,o)}},function(t,n,r){var e=r(6);t.exports=function(t,n){if(!e(t))return t;var r,o;if(n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!e(o=r.call(t)))return o;if(!n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,n,r){var e=r(8),o=r(1),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(t.exports=function(t,n){return i[t]||(i[t]=void 0!==n?n:{})})("versions",[]).push({version:e.version,mode:r(14)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(t,n,r){var e=r(4).f,o=r(2),i=r(0)("toStringTag");t.exports=function(t,n,r){t&&!o(t=r?t:t.prototype,i)&&e(t,i,{configurable:!0,value:n})}},function(t,n,r){var e=r(1),o=r(8),i=r(14),u=r(15),c=r(4).f;t.exports=function(t){var n=o.Symbol||(o.Symbol=i?{}:e.Symbol||{});"_"==t.charAt(0)||t in n||c(n,t,{value:u.f(t)})}},function(t,n){var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},function(t,n){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,n){var r=Math.ceil,e=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?e:r)(t)}},function(t,n,r){var e=r(18)("keys"),o=r(10);t.exports=function(t){return e[t]||(e[t]=o(t))}},function(t,n){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,n){n.f={}.propertyIsEnumerable},function(t,n){t.exports={}},function(t,n,r){var e=r(1),o=r(8),i=r(3),u=r(9),c=r(40),f=function(t,n,r){var s,a,p,l,y=t&f.F,v=t&f.G,h=t&f.S,b=t&f.P,g=t&f.B,d=v?e:h?e[n]||(e[n]={}):(e[n]||{}).prototype,m=v?o:o[n]||(o[n]={}),S=m.prototype||(m.prototype={});for(s in v&&(r=n),r)p=((a=!y&&d&&void 0!==d[s])?d:r)[s],l=g&&a?c(p,e):b&&"function"==typeof p?c(Function.call,p):p,d&&u(d,s,p,t&f.U),m[s]!=p&&i(m,s,l),b&&S[s]!=p&&(S[s]=p)};e.core=o,f.F=1,f.G=2,f.S=4,f.P=8,f.B=16,f.W=32,f.U=64,f.R=128,t.exports=f},function(t,n,r){t.exports=!r(5)&&!r(11)(function(){return 7!=Object.defineProperty(r(30)("div"),"a",{get:function(){return 7}}).a})},function(t,n,r){var e=r(6),o=r(1).document,i=e(o)&&e(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,n,r){var e=r(2),o=r(7),i=r(45)(!1),u=r(24)("IE_PROTO");t.exports=function(t,n){var r,c=o(t),f=0,s=[];for(r in c)r!=u&&e(c,r)&&s.push(r);for(;n.length>f;)e(c,r=n[f++])&&(~i(s,r)||s.push(r));return s}},function(t,n){n.f=Object.getOwnPropertySymbols},function(t,n,r){var e=r(12),o=r(49),i=r(25),u=r(24)("IE_PROTO"),c=function(){},f=function(){var t,n=r(30)("iframe"),e=i.length;for(n.style.display="none",r(50).appendChild(n),n.src="javascript:",(t=n.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),f=t.F;e--;)delete f.prototype[i[e]];return f()};t.exports=Object.create||function(t,n){var r;return null!==t?(c.prototype=e(t),r=new c,c.prototype=null,r[u]=t):r=f(),void 0===n?r:o(r,n)}},function(t,n,r){var e=r(31),o=r(25).concat("length","prototype");n.f=Object.getOwnPropertyNames||function(t){return e(t,o)}},function(t,n,r){"use strict";var e=r(14),o=r(28),i=r(9),u=r(3),c=r(27),f=r(60),s=r(19),a=r(36),p=r(0)("iterator"),l=!([].keys&&"next"in[].keys()),y=function(){return this};t.exports=function(t,n,r,v,h,b,g){f(r,n,v);var d,m,S,x=function(t){if(!l&&t in w)return w[t];switch(t){case"keys":case"values":return function(){return new r(this,t)}}return function(){return new r(this,t)}},O=n+" Iterator",j="values"==h,_=!1,w=t.prototype,P=w[p]||w["@@iterator"]||h&&w[h],T=P||x(h),E=h?j?x("entries"):T:void 0,L="Array"==n&&w.entries||P;if(L&&(S=a(L.call(new t)))!==Object.prototype&&S.next&&(s(S,O,!0),e||"function"==typeof S[p]||u(S,p,y)),j&&P&&"values"!==P.name&&(_=!0,T=function(){return P.call(this)}),e&&!g||!l&&!_&&w[p]||u(w,p,T),c[n]=T,c[O]=y,h)if(d={values:j?T:x("values"),keys:b?T:x("keys"),entries:E},g)for(m in d)m in w||i(w,m,d[m]);else o(o.P+o.F*(l||_),n,d);return d}},function(t,n,r){var e=r(2),o=r(61),i=r(24)("IE_PROTO"),u=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=o(t),e(t,i)?t[i]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?u:null}},function(t,n,r){"use strict";r(38),r(57),r(66)},function(t,n,r){r(39),r(53),r(55),r(56),t.exports=r(8).Symbol},function(t,n,r){"use strict";var e=r(1),o=r(2),i=r(5),u=r(28),c=r(9),f=r(42).KEY,s=r(11),a=r(18),p=r(19),l=r(10),y=r(0),v=r(15),h=r(20),b=r(43),g=r(48),d=r(12),m=r(6),S=r(7),x=r(17),O=r(13),j=r(33),_=r(51),w=r(52),P=r(4),T=r(16),E=w.f,L=P.f,M=_.f,k=e.Symbol,A=e.JSON,F=A&&A.stringify,N=y("_hidden"),I=y("toPrimitive"),C={}.propertyIsEnumerable,D=a("symbol-registry"),G=a("symbols"),R=a("op-symbols"),V=Object.prototype,z="function"==typeof k,W=e.QObject,H=!W||!W.prototype||!W.prototype.findChild,J=i&&s(function(){return 7!=j(L({},"a",{get:function(){return L(this,"a",{value:7}).a}})).a})?function(t,n,r){var e=E(V,n);e&&delete V[n],L(t,n,r),e&&t!==V&&L(V,n,e)}:L,B=function(t){var n=G[t]=j(k.prototype);return n._k=t,n},K=z&&"symbol"==typeof k.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof k},U=function(t,n,r){return t===V&&U(R,n,r),d(t),n=x(n,!0),d(r),o(G,n)?(r.enumerable?(o(t,N)&&t[N][n]&&(t[N][n]=!1),r=j(r,{enumerable:O(0,!1)})):(o(t,N)||L(t,N,O(1,{})),t[N][n]=!0),J(t,n,r)):L(t,n,r)},Y=function(t,n){d(t);for(var r,e=b(n=S(n)),o=0,i=e.length;i>o;)U(t,r=e[o++],n[r]);return t},q=function(t){var n=C.call(this,t=x(t,!0));return!(this===V&&o(G,t)&&!o(R,t))&&(!(n||!o(this,t)||!o(G,t)||o(this,N)&&this[N][t])||n)},Q=function(t,n){if(t=S(t),n=x(n,!0),t!==V||!o(G,n)||o(R,n)){var r=E(t,n);return!r||!o(G,n)||o(t,N)&&t[N][n]||(r.enumerable=!0),r}},X=function(t){for(var n,r=M(S(t)),e=[],i=0;r.length>i;)o(G,n=r[i++])||n==N||n==f||e.push(n);return e},Z=function(t){for(var n,r=t===V,e=M(r?R:S(t)),i=[],u=0;e.length>u;)!o(G,n=e[u++])||r&&!o(V,n)||i.push(G[n]);return i};z||(c((k=function(){if(this instanceof k)throw TypeError("Symbol is not a constructor!");var t=l(arguments.length>0?arguments[0]:void 0),n=function(r){this===V&&n.call(R,r),o(this,N)&&o(this[N],t)&&(this[N][t]=!1),J(this,t,O(1,r))};return i&&H&&J(V,t,{configurable:!0,set:n}),B(t)}).prototype,"toString",function(){return this._k}),w.f=Q,P.f=U,r(34).f=_.f=X,r(26).f=q,r(32).f=Z,i&&!r(14)&&c(V,"propertyIsEnumerable",q,!0),v.f=function(t){return B(y(t))}),u(u.G+u.W+u.F*!z,{Symbol:k});for(var $="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),tt=0;$.length>tt;)y($[tt++]);for(var nt=T(y.store),rt=0;nt.length>rt;)h(nt[rt++]);u(u.S+u.F*!z,"Symbol",{for:function(t){return o(D,t+="")?D[t]:D[t]=k(t)},keyFor:function(t){if(!K(t))throw TypeError(t+" is not a symbol!");for(var n in D)if(D[n]===t)return n},useSetter:function(){H=!0},useSimple:function(){H=!1}}),u(u.S+u.F*!z,"Object",{create:function(t,n){return void 0===n?j(t):Y(j(t),n)},defineProperty:U,defineProperties:Y,getOwnPropertyDescriptor:Q,getOwnPropertyNames:X,getOwnPropertySymbols:Z}),A&&u(u.S+u.F*(!z||s(function(){var t=k();return"[null]"!=F([t])||"{}"!=F({a:t})||"{}"!=F(Object(t))})),"JSON",{stringify:function(t){for(var n,r,e=[t],o=1;arguments.length>o;)e.push(arguments[o++]);if(r=n=e[1],(m(n)||void 0!==t)&&!K(t))return g(n)||(n=function(t,n){if("function"==typeof r&&(n=r.call(this,t,n)),!K(n))return n}),e[1]=n,F.apply(A,e)}}),k.prototype[I]||r(3)(k.prototype,I,k.prototype.valueOf),p(k,"Symbol"),p(Math,"Math",!0),p(e.JSON,"JSON",!0)},function(t,n,r){var e=r(41);t.exports=function(t,n,r){if(e(t),void 0===n)return t;switch(r){case 1:return function(r){return t.call(n,r)};case 2:return function(r,e){return t.call(n,r,e)};case 3:return function(r,e,o){return t.call(n,r,e,o)}}return function(){return t.apply(n,arguments)}}},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,n,r){var e=r(10)("meta"),o=r(6),i=r(2),u=r(4).f,c=0,f=Object.isExtensible||function(){return!0},s=!r(11)(function(){return f(Object.preventExtensions({}))}),a=function(t){u(t,e,{value:{i:"O"+ ++c,w:{}}})},p=t.exports={KEY:e,NEED:!1,fastKey:function(t,n){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!i(t,e)){if(!f(t))return"F";if(!n)return"E";a(t)}return t[e].i},getWeak:function(t,n){if(!i(t,e)){if(!f(t))return!0;if(!n)return!1;a(t)}return t[e].w},onFreeze:function(t){return s&&p.NEED&&f(t)&&!i(t,e)&&a(t),t}}},function(t,n,r){var e=r(16),o=r(32),i=r(26);t.exports=function(t){var n=e(t),r=o.f;if(r)for(var u,c=r(t),f=i.f,s=0;c.length>s;)f.call(t,u=c[s++])&&n.push(u);return n}},function(t,n,r){var e=r(21);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==e(t)?t.split(""):Object(t)}},function(t,n,r){var e=r(7),o=r(46),i=r(47);t.exports=function(t){return function(n,r,u){var c,f=e(n),s=o(f.length),a=i(u,s);if(t&&r!=r){for(;s>a;)if((c=f[a++])!=c)return!0}else for(;s>a;a++)if((t||a in f)&&f[a]===r)return t||a||0;return!t&&-1}}},function(t,n,r){var e=r(23),o=Math.min;t.exports=function(t){return t>0?o(e(t),9007199254740991):0}},function(t,n,r){var e=r(23),o=Math.max,i=Math.min;t.exports=function(t,n){return(t=e(t))<0?o(t+n,0):i(t,n)}},function(t,n,r){var e=r(21);t.exports=Array.isArray||function(t){return"Array"==e(t)}},function(t,n,r){var e=r(4),o=r(12),i=r(16);t.exports=r(5)?Object.defineProperties:function(t,n){o(t);for(var r,u=i(n),c=u.length,f=0;c>f;)e.f(t,r=u[f++],n[r]);return t}},function(t,n,r){var e=r(1).document;t.exports=e&&e.documentElement},function(t,n,r){var e=r(7),o=r(34).f,i={}.toString,u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return u&&"[object Window]"==i.call(t)?function(t){try{return o(t)}catch(t){return u.slice()}}(t):o(e(t))}},function(t,n,r){var e=r(26),o=r(13),i=r(7),u=r(17),c=r(2),f=r(29),s=Object.getOwnPropertyDescriptor;n.f=r(5)?s:function(t,n){if(t=i(t),n=u(n,!0),f)try{return s(t,n)}catch(t){}if(c(t,n))return o(!e.f.call(t,n),t[n])}},function(t,n,r){"use strict";var e=r(54),o={};o[r(0)("toStringTag")]="z",o+""!="[object z]"&&r(9)(Object.prototype,"toString",function(){return"[object "+e(this)+"]"},!0)},function(t,n,r){var e=r(21),o=r(0)("toStringTag"),i="Arguments"==e(function(){return arguments}());t.exports=function(t){var n,r,u;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,n){try{return t[n]}catch(t){}}(n=Object(t),o))?r:i?e(n):"Object"==(u=e(n))&&"function"==typeof n.callee?"Arguments":u}},function(t,n,r){r(20)("asyncIterator")},function(t,n,r){r(20)("observable")},function(t,n,r){r(58),r(62),t.exports=r(15).f("iterator")},function(t,n,r){"use strict";var e=r(59)(!0);r(35)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,n=this._t,r=this._i;return r>=n.length?{value:void 0,done:!0}:(t=e(n,r),this._i+=t.length,{value:t,done:!1})})},function(t,n,r){var e=r(23),o=r(22);t.exports=function(t){return function(n,r){var i,u,c=String(o(n)),f=e(r),s=c.length;return f<0||f>=s?t?"":void 0:(i=c.charCodeAt(f))<55296||i>56319||f+1===s||(u=c.charCodeAt(f+1))<56320||u>57343?t?c.charAt(f):i:t?c.slice(f,f+2):u-56320+(i-55296<<10)+65536}}},function(t,n,r){"use strict";var e=r(33),o=r(13),i=r(19),u={};r(3)(u,r(0)("iterator"),function(){return this}),t.exports=function(t,n,r){t.prototype=e(u,{next:o(1,r)}),i(t,n+" Iterator")}},function(t,n,r){var e=r(22);t.exports=function(t){return Object(e(t))}},function(t,n,r){for(var e=r(63),o=r(16),i=r(9),u=r(1),c=r(3),f=r(27),s=r(0),a=s("iterator"),p=s("toStringTag"),l=f.Array,y={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},v=o(y),h=0;h<v.length;h++){var b,g=v[h],d=y[g],m=u[g],S=m&&m.prototype;if(S&&(S[a]||c(S,a,l),S[p]||c(S,p,g),f[g]=l,d))for(b in e)S[b]||i(S,b,e[b],!0)}},function(t,n,r){"use strict";var e=r(64),o=r(65),i=r(27),u=r(7);t.exports=r(35)(Array,"Array",function(t,n){this._t=u(t),this._i=0,this._k=n},function(){var t=this._t,n=this._k,r=this._i++;return!t||r>=t.length?(this._t=void 0,o(1)):o(0,"keys"==n?r:"values"==n?t[r]:[r,t[r]])},"values"),i.Arguments=i.Array,e("keys"),e("values"),e("entries")},function(t,n,r){var e=r(0)("unscopables"),o=Array.prototype;void 0==o[e]&&r(3)(o,e,{}),t.exports=function(t){o[e][t]=!0}},function(t,n){t.exports=function(t,n){return{value:n,done:!!t}}},function(t,n,r){r(67),t.exports=r(15).f("hasInstance")},function(t,n,r){"use strict";var e=r(6),o=r(36),i=r(0)("hasInstance"),u=Function.prototype;i in u||r(4).f(u,i,{value:function(t){if("function"!=typeof this||!e(t))return!1;if(!e(this.prototype))return t instanceof this;for(;t=o(t);)if(this.prototype===t)return!0;return!1}})}]);
!function(t){var n={};function r(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=n,r.d=function(t,n,e){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)r.d(e,o,function(n){return t[n]}.bind(null,o));return e},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="",r(r.s=37)}([function(t,n,r){var e=r(18)("wks"),o=r(10),i=r(1).Symbol,u="function"==typeof i;(t.exports=function(t){return e[t]||(e[t]=u&&i[t]||(u?i:o)("Symbol."+t))}).store=e},function(t,n){var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(t,n){var r={}.hasOwnProperty;t.exports=function(t,n){return r.call(t,n)}},function(t,n,r){var e=r(4),o=r(13);t.exports=r(5)?function(t,n,r){return e.f(t,n,o(1,r))}:function(t,n,r){return t[n]=r,t}},function(t,n,r){var e=r(12),o=r(29),i=r(17),u=Object.defineProperty;n.f=r(5)?Object.defineProperty:function(t,n,r){if(e(t),n=i(n,!0),e(r),o)try{return u(t,n,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[n]=r.value),t}},function(t,n,r){t.exports=!r(11)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n,r){var e=r(44),o=r(22);t.exports=function(t){return e(o(t))}},function(t,n){var r=t.exports={version:"2.6.2"};"number"==typeof __e&&(__e=r)},function(t,n,r){var e=r(1),o=r(3),i=r(2),u=r(10)("src"),c=Function.toString,f=(""+c).split("toString");r(8).inspectSource=function(t){return c.call(t)},(t.exports=function(t,n,r,c){var s="function"==typeof r;s&&(i(r,"name")||o(r,"name",n)),t[n]!==r&&(s&&(i(r,u)||o(r,u,t[n]?""+t[n]:f.join(String(n)))),t===e?t[n]=r:c?t[n]?t[n]=r:o(t,n,r):(delete t[n],o(t,n,r)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[u]||c.call(this)})},function(t,n){var r=0,e=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+e).toString(36))}},function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,n,r){var e=r(6);t.exports=function(t){if(!e(t))throw TypeError(t+" is not an object!");return t}},function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n){t.exports=!1},function(t,n,r){n.f=r(0)},function(t,n,r){var e=r(31),o=r(25);t.exports=Object.keys||function(t){return e(t,o)}},function(t,n,r){var e=r(6);t.exports=function(t,n){if(!e(t))return t;var r,o;if(n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!e(o=r.call(t)))return o;if(!n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,n,r){var e=r(8),o=r(1),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(t.exports=function(t,n){return i[t]||(i[t]=void 0!==n?n:{})})("versions",[]).push({version:e.version,mode:r(14)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(t,n,r){var e=r(4).f,o=r(2),i=r(0)("toStringTag");t.exports=function(t,n,r){t&&!o(t=r?t:t.prototype,i)&&e(t,i,{configurable:!0,value:n})}},function(t,n,r){var e=r(1),o=r(8),i=r(14),u=r(15),c=r(4).f;t.exports=function(t){var n=o.Symbol||(o.Symbol=i?{}:e.Symbol||{});"_"==t.charAt(0)||t in n||c(n,t,{value:u.f(t)})}},function(t,n){var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},function(t,n){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,n){var r=Math.ceil,e=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?e:r)(t)}},function(t,n,r){var e=r(18)("keys"),o=r(10);t.exports=function(t){return e[t]||(e[t]=o(t))}},function(t,n){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,n){n.f={}.propertyIsEnumerable},function(t,n){t.exports={}},function(t,n,r){var e=r(1),o=r(8),i=r(3),u=r(9),c=r(40),f=function(t,n,r){var s,a,p,l,y=t&f.F,v=t&f.G,h=t&f.S,b=t&f.P,g=t&f.B,d=v?e:h?e[n]||(e[n]={}):(e[n]||{}).prototype,m=v?o:o[n]||(o[n]={}),S=m.prototype||(m.prototype={});for(s in v&&(r=n),r)p=((a=!y&&d&&void 0!==d[s])?d:r)[s],l=g&&a?c(p,e):b&&"function"==typeof p?c(Function.call,p):p,d&&u(d,s,p,t&f.U),m[s]!=p&&i(m,s,l),b&&S[s]!=p&&(S[s]=p)};e.core=o,f.F=1,f.G=2,f.S=4,f.P=8,f.B=16,f.W=32,f.U=64,f.R=128,t.exports=f},function(t,n,r){t.exports=!r(5)&&!r(11)(function(){return 7!=Object.defineProperty(r(30)("div"),"a",{get:function(){return 7}}).a})},function(t,n,r){var e=r(6),o=r(1).document,i=e(o)&&e(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,n,r){var e=r(2),o=r(7),i=r(45)(!1),u=r(24)("IE_PROTO");t.exports=function(t,n){var r,c=o(t),f=0,s=[];for(r in c)r!=u&&e(c,r)&&s.push(r);for(;n.length>f;)e(c,r=n[f++])&&(~i(s,r)||s.push(r));return s}},function(t,n){n.f=Object.getOwnPropertySymbols},function(t,n,r){var e=r(12),o=r(49),i=r(25),u=r(24)("IE_PROTO"),c=function(){},f=function(){var t,n=r(30)("iframe"),e=i.length;for(n.style.display="none",r(50).appendChild(n),n.src="javascript:",(t=n.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),f=t.F;e--;)delete f.prototype[i[e]];return f()};t.exports=Object.create||function(t,n){var r;return null!==t?(c.prototype=e(t),r=new c,c.prototype=null,r[u]=t):r=f(),void 0===n?r:o(r,n)}},function(t,n,r){var e=r(31),o=r(25).concat("length","prototype");n.f=Object.getOwnPropertyNames||function(t){return e(t,o)}},function(t,n,r){"use strict";var e=r(14),o=r(28),i=r(9),u=r(3),c=r(27),f=r(60),s=r(19),a=r(36),p=r(0)("iterator"),l=!([].keys&&"next"in[].keys()),y=function(){return this};t.exports=function(t,n,r,v,h,b,g){f(r,n,v);var d,m,S,x=function(t){if(!l&&t in w)return w[t];switch(t){case"keys":case"values":return function(){return new r(this,t)}}return function(){return new r(this,t)}},O=n+" Iterator",j="values"==h,_=!1,w=t.prototype,P=w[p]||w["@@iterator"]||h&&w[h],T=P||x(h),E=h?j?x("entries"):T:void 0,L="Array"==n&&w.entries||P;if(L&&(S=a(L.call(new t)))!==Object.prototype&&S.next&&(s(S,O,!0),e||"function"==typeof S[p]||u(S,p,y)),j&&P&&"values"!==P.name&&(_=!0,T=function(){return P.call(this)}),e&&!g||!l&&!_&&w[p]||u(w,p,T),c[n]=T,c[O]=y,h)if(d={values:j?T:x("values"),keys:b?T:x("keys"),entries:E},g)for(m in d)m in w||i(w,m,d[m]);else o(o.P+o.F*(l||_),n,d);return d}},function(t,n,r){var e=r(2),o=r(61),i=r(24)("IE_PROTO"),u=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=o(t),e(t,i)?t[i]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?u:null}},function(t,n,r){"use strict";r(38),r(57),r(66)},function(t,n,r){r(39),r(53),r(55),r(56),t.exports=r(8).Symbol},function(t,n,r){"use strict";var e=r(1),o=r(2),i=r(5),u=r(28),c=r(9),f=r(42).KEY,s=r(11),a=r(18),p=r(19),l=r(10),y=r(0),v=r(15),h=r(20),b=r(43),g=r(48),d=r(12),m=r(6),S=r(7),x=r(17),O=r(13),j=r(33),_=r(51),w=r(52),P=r(4),T=r(16),E=w.f,L=P.f,M=_.f,k=e.Symbol,A=e.JSON,F=A&&A.stringify,N=y("_hidden"),I=y("toPrimitive"),C={}.propertyIsEnumerable,D=a("symbol-registry"),G=a("symbols"),R=a("op-symbols"),V=Object.prototype,z="function"==typeof k,W=e.QObject,H=!W||!W.prototype||!W.prototype.findChild,J=i&&s(function(){return 7!=j(L({},"a",{get:function(){return L(this,"a",{value:7}).a}})).a})?function(t,n,r){var e=E(V,n);e&&delete V[n],L(t,n,r),e&&t!==V&&L(V,n,e)}:L,B=function(t){var n=G[t]=j(k.prototype);return n._k=t,n},K=z&&"symbol"==typeof k.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof k},U=function(t,n,r){return t===V&&U(R,n,r),d(t),n=x(n,!0),d(r),o(G,n)?(r.enumerable?(o(t,N)&&t[N][n]&&(t[N][n]=!1),r=j(r,{enumerable:O(0,!1)})):(o(t,N)||L(t,N,O(1,{})),t[N][n]=!0),J(t,n,r)):L(t,n,r)},Y=function(t,n){d(t);for(var r,e=b(n=S(n)),o=0,i=e.length;i>o;)U(t,r=e[o++],n[r]);return t},q=function(t){var n=C.call(this,t=x(t,!0));return!(this===V&&o(G,t)&&!o(R,t))&&(!(n||!o(this,t)||!o(G,t)||o(this,N)&&this[N][t])||n)},Q=function(t,n){if(t=S(t),n=x(n,!0),t!==V||!o(G,n)||o(R,n)){var r=E(t,n);return!r||!o(G,n)||o(t,N)&&t[N][n]||(r.enumerable=!0),r}},X=function(t){for(var n,r=M(S(t)),e=[],i=0;r.length>i;)o(G,n=r[i++])||n==N||n==f||e.push(n);return e},Z=function(t){for(var n,r=t===V,e=M(r?R:S(t)),i=[],u=0;e.length>u;)!o(G,n=e[u++])||r&&!o(V,n)||i.push(G[n]);return i};z||(c((k=function(){if(this instanceof k)throw TypeError("Symbol is not a constructor!");var t=l(arguments.length>0?arguments[0]:void 0),n=function(r){this===V&&n.call(R,r),o(this,N)&&o(this[N],t)&&(this[N][t]=!1),J(this,t,O(1,r))};return i&&H&&J(V,t,{configurable:!0,set:n}),B(t)}).prototype,"toString",function(){return this._k}),w.f=Q,P.f=U,r(34).f=_.f=X,r(26).f=q,r(32).f=Z,i&&!r(14)&&c(V,"propertyIsEnumerable",q,!0),v.f=function(t){return B(y(t))}),u(u.G+u.W+u.F*!z,{Symbol:k});for(var $="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),tt=0;$.length>tt;)y($[tt++]);for(var nt=T(y.store),rt=0;nt.length>rt;)h(nt[rt++]);u(u.S+u.F*!z,"Symbol",{for:function(t){return o(D,t+="")?D[t]:D[t]=k(t)},keyFor:function(t){if(!K(t))throw TypeError(t+" is not a symbol!");for(var n in D)if(D[n]===t)return n},useSetter:function(){H=!0},useSimple:function(){H=!1}}),u(u.S+u.F*!z,"Object",{create:function(t,n){return void 0===n?j(t):Y(j(t),n)},defineProperty:U,defineProperties:Y,getOwnPropertyDescriptor:Q,getOwnPropertyNames:X,getOwnPropertySymbols:Z}),A&&u(u.S+u.F*(!z||s(function(){var t=k();return"[null]"!=F([t])||"{}"!=F({a:t})||"{}"!=F(Object(t))})),"JSON",{stringify:function(t){for(var n,r,e=[t],o=1;arguments.length>o;)e.push(arguments[o++]);if(r=n=e[1],(m(n)||void 0!==t)&&!K(t))return g(n)||(n=function(t,n){if("function"==typeof r&&(n=r.call(this,t,n)),!K(n))return n}),e[1]=n,F.apply(A,e)}}),k.prototype[I]||r(3)(k.prototype,I,k.prototype.valueOf),p(k,"Symbol"),p(Math,"Math",!0),p(e.JSON,"JSON",!0)},function(t,n,r){var e=r(41);t.exports=function(t,n,r){if(e(t),void 0===n)return t;switch(r){case 1:return function(r){return t.call(n,r)};case 2:return function(r,e){return t.call(n,r,e)};case 3:return function(r,e,o){return t.call(n,r,e,o)}}return function(){return t.apply(n,arguments)}}},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,n,r){var e=r(10)("meta"),o=r(6),i=r(2),u=r(4).f,c=0,f=Object.isExtensible||function(){return!0},s=!r(11)(function(){return f(Object.preventExtensions({}))}),a=function(t){u(t,e,{value:{i:"O"+ ++c,w:{}}})},p=t.exports={KEY:e,NEED:!1,fastKey:function(t,n){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!i(t,e)){if(!f(t))return"F";if(!n)return"E";a(t)}return t[e].i},getWeak:function(t,n){if(!i(t,e)){if(!f(t))return!0;if(!n)return!1;a(t)}return t[e].w},onFreeze:function(t){return s&&p.NEED&&f(t)&&!i(t,e)&&a(t),t}}},function(t,n,r){var e=r(16),o=r(32),i=r(26);t.exports=function(t){var n=e(t),r=o.f;if(r)for(var u,c=r(t),f=i.f,s=0;c.length>s;)f.call(t,u=c[s++])&&n.push(u);return n}},function(t,n,r){var e=r(21);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==e(t)?t.split(""):Object(t)}},function(t,n,r){var e=r(7),o=r(46),i=r(47);t.exports=function(t){return function(n,r,u){var c,f=e(n),s=o(f.length),a=i(u,s);if(t&&r!=r){for(;s>a;)if((c=f[a++])!=c)return!0}else for(;s>a;a++)if((t||a in f)&&f[a]===r)return t||a||0;return!t&&-1}}},function(t,n,r){var e=r(23),o=Math.min;t.exports=function(t){return t>0?o(e(t),9007199254740991):0}},function(t,n,r){var e=r(23),o=Math.max,i=Math.min;t.exports=function(t,n){return(t=e(t))<0?o(t+n,0):i(t,n)}},function(t,n,r){var e=r(21);t.exports=Array.isArray||function(t){return"Array"==e(t)}},function(t,n,r){var e=r(4),o=r(12),i=r(16);t.exports=r(5)?Object.defineProperties:function(t,n){o(t);for(var r,u=i(n),c=u.length,f=0;c>f;)e.f(t,r=u[f++],n[r]);return t}},function(t,n,r){var e=r(1).document;t.exports=e&&e.documentElement},function(t,n,r){var e=r(7),o=r(34).f,i={}.toString,u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return u&&"[object Window]"==i.call(t)?function(t){try{return o(t)}catch(t){return u.slice()}}(t):o(e(t))}},function(t,n,r){var e=r(26),o=r(13),i=r(7),u=r(17),c=r(2),f=r(29),s=Object.getOwnPropertyDescriptor;n.f=r(5)?s:function(t,n){if(t=i(t),n=u(n,!0),f)try{return s(t,n)}catch(t){}if(c(t,n))return o(!e.f.call(t,n),t[n])}},function(t,n,r){"use strict";var e=r(54),o={};o[r(0)("toStringTag")]="z",o+""!="[object z]"&&r(9)(Object.prototype,"toString",function(){return"[object "+e(this)+"]"},!0)},function(t,n,r){var e=r(21),o=r(0)("toStringTag"),i="Arguments"==e(function(){return arguments}());t.exports=function(t){var n,r,u;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,n){try{return t[n]}catch(t){}}(n=Object(t),o))?r:i?e(n):"Object"==(u=e(n))&&"function"==typeof n.callee?"Arguments":u}},function(t,n,r){r(20)("asyncIterator")},function(t,n,r){r(20)("observable")},function(t,n,r){r(58),r(62),t.exports=r(15).f("iterator")},function(t,n,r){"use strict";var e=r(59)(!0);r(35)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,n=this._t,r=this._i;return r>=n.length?{value:void 0,done:!0}:(t=e(n,r),this._i+=t.length,{value:t,done:!1})})},function(t,n,r){var e=r(23),o=r(22);t.exports=function(t){return function(n,r){var i,u,c=String(o(n)),f=e(r),s=c.length;return f<0||f>=s?t?"":void 0:(i=c.charCodeAt(f))<55296||i>56319||f+1===s||(u=c.charCodeAt(f+1))<56320||u>57343?t?c.charAt(f):i:t?c.slice(f,f+2):u-56320+(i-55296<<10)+65536}}},function(t,n,r){"use strict";var e=r(33),o=r(13),i=r(19),u={};r(3)(u,r(0)("iterator"),function(){return this}),t.exports=function(t,n,r){t.prototype=e(u,{next:o(1,r)}),i(t,n+" Iterator")}},function(t,n,r){var e=r(22);t.exports=function(t){return Object(e(t))}},function(t,n,r){for(var e=r(63),o=r(16),i=r(9),u=r(1),c=r(3),f=r(27),s=r(0),a=s("iterator"),p=s("toStringTag"),l=f.Array,y={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},v=o(y),h=0;h<v.length;h++){var b,g=v[h],d=y[g],m=u[g],S=m&&m.prototype;if(S&&(S[a]||c(S,a,l),S[p]||c(S,p,g),f[g]=l,d))for(b in e)S[b]||i(S,b,e[b],!0)}},function(t,n,r){"use strict";var e=r(64),o=r(65),i=r(27),u=r(7);t.exports=r(35)(Array,"Array",function(t,n){this._t=u(t),this._i=0,this._k=n},function(){var t=this._t,n=this._k,r=this._i++;return!t||r>=t.length?(this._t=void 0,o(1)):o(0,"keys"==n?r:"values"==n?t[r]:[r,t[r]])},"values"),i.Arguments=i.Array,e("keys"),e("values"),e("entries")},function(t,n,r){var e=r(0)("unscopables"),o=Array.prototype;null==o[e]&&r(3)(o,e,{}),t.exports=function(t){o[e][t]=!0}},function(t,n){t.exports=function(t,n){return{value:n,done:!!t}}},function(t,n,r){r(67),t.exports=r(15).f("hasInstance")},function(t,n,r){"use strict";var e=r(6),o=r(36),i=r(0)("hasInstance"),u=Function.prototype;i in u||r(4).f(u,i,{value:function(t){if("function"!=typeof this||!e(t))return!1;if(!e(this.prototype))return t instanceof this;for(;t=o(t);)if(this.prototype===t)return!0;return!1}})}]);
'use strict';
/**

@@ -22,4 +21,2 @@ * @file

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -29,7 +26,11 @@

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var $as = require('futoin-asyncsteps');
var SYM_EVENT_EMITTER = Symbol('FutoIn Event Emitter');
var ON_PREFIX = '_evt_';
var ONCE_PREFIX = '_evtonce_';
/**

@@ -41,38 +42,60 @@ * Asynchronous Event Emitter.

var EventEmitter = function () {
function EventEmitter(allowed_events, max_listeners) {
_classCallCheck(this, EventEmitter);
var EventEmitter =
/*#__PURE__*/
function () {
function EventEmitter(allowed_events, max_listeners) {
_classCallCheck(this, EventEmitter);
this._max = max_listeners;
this._scheduleCall = $as.ActiveAsyncTool.callImmediate;
this._max = max_listeners;
this._scheduleCall = $as.ActiveAsyncTool.callImmediate;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = allowed_events[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var evt = _step.value;
this["".concat(ON_PREFIX).concat(evt)] = [];
this["".concat(ONCE_PREFIX).concat(evt)] = [];
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
}
/**
* Attach event handler.
* @param {string} evt - preconfigured event name
* @param {callable} handler - async event handler
*/
try {
for (var _iterator = allowed_events[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var evt = _step.value;
this['' + ON_PREFIX + evt] = [];
this['' + ONCE_PREFIX + evt] = [];
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
_createClass(EventEmitter, [{
key: "on",
value: function on(evt, handler) {
try {
var hlist = this["".concat(ON_PREFIX).concat(evt)];
if (hlist.length === this._max) {
// eslint-disable-next-line no-console
console.warn("Hitting max handler limit for: ".concat(evt));
}
hlist.push(handler);
} catch (e) {
throw new Error("Unknown event: ".concat(evt));
}
}
/**
* Attach event handler.
* Attach once-only event handler.
* @param {string} evt - preconfigured event name

@@ -82,298 +105,244 @@ * @param {callable} handler - async event handler

}, {
key: "once",
value: function once(evt, handler) {
try {
var hlist = this["".concat(ONCE_PREFIX).concat(evt)];
_createClass(EventEmitter, [{
key: 'on',
value: function on(evt, handler) {
try {
var hlist = this['' + ON_PREFIX + evt];
if (hlist.length === this._max) {
// eslint-disable-next-line no-console
console.warn("Hitting max once handler limit for: ".concat(evt));
}
if (hlist.length === this._max) {
// eslint-disable-next-line no-console
console.warn('Hitting max handler limit for: ' + evt);
}
hlist.push(handler);
} catch (e) {
throw new Error("Unknown event: ".concat(evt));
}
}
/**
* Remove event handler.
* @param {string} evt - preconfigured event name
* @param {callable} handler - async event handler
*/
hlist.push(handler);
} catch (e) {
throw new Error('Unknown event: ' + evt);
}
}
}, {
key: "off",
value: function off(evt, handler) {
try {
var memb = "".concat(ON_PREFIX).concat(evt);
this[memb] = this[memb].filter(function (h) {
return h !== handler;
});
var memb_once = "".concat(ONCE_PREFIX).concat(evt);
this[memb_once] = this[memb_once].filter(function (h) {
return h !== handler;
});
} catch (e) {
throw new Error("Unknown event: ".concat(evt));
}
}
/**
* Emit async event.
* @param {string} evt - event name
*/
/**
* Attach once-only event handler.
* @param {string} evt - preconfigured event name
* @param {callable} handler - async event handler
*/
}, {
key: "emit",
value: function emit(evt) {
var _this = this;
}, {
key: 'once',
value: function once(evt, handler) {
try {
var hlist = this['' + ONCE_PREFIX + evt];
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
if (hlist.length === this._max) {
// eslint-disable-next-line no-console
console.warn('Hitting max once handler limit for: ' + evt);
}
var handlers = this["".concat(ON_PREFIX).concat(evt)];
var once_handlers = this["".concat(ONCE_PREFIX).concat(evt)];
hlist.push(handler);
} catch (e) {
throw new Error('Unknown event: ' + evt);
}
}
if (handlers === undefined) {
throw new Error("Unknown event: ".concat(evt));
}
/**
* Remove event handler.
* @param {string} evt - preconfigured event name
* @param {callable} handler - async event handler
*/
var call_list = [];
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
}, {
key: 'off',
value: function off(evt, handler) {
try {
var memb = '' + ON_PREFIX + evt;
this[memb] = this[memb].filter(function (h) {
return h !== handler;
});
var memb_once = '' + ONCE_PREFIX + evt;
this[memb_once] = this[memb_once].filter(function (h) {
return h !== handler;
});
} catch (e) {
throw new Error('Unknown event: ' + evt);
}
try {
for (var _iterator2 = handlers[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var _h2 = _step2.value;
call_list.push(_h2);
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
_iterator2.return();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
/**
* Emit async event.
* @param {string} evt - event name
*/
if (once_handlers.length) {
var _iteratorNormalCompletion3 = true;
var _didIteratorError3 = false;
var _iteratorError3 = undefined;
}, {
key: 'emit',
value: function emit(evt) {
var _this = this;
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
try {
for (var _iterator3 = once_handlers[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
var h = _step3.value;
call_list.push(h);
}
} catch (err) {
_didIteratorError3 = true;
_iteratorError3 = err;
} finally {
try {
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
_iterator3.return();
}
var handlers = this['' + ON_PREFIX + evt];
var once_handlers = this['' + ONCE_PREFIX + evt];
if (handlers === undefined) {
throw new Error('Unknown event: ' + evt);
} finally {
if (_didIteratorError3) {
throw _iteratorError3;
}
}
}
var call_list = [];
this["".concat(ONCE_PREFIX).concat(evt)] = [];
}
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
this._scheduleCall(function () {
// ---
for (var _i = 0; _i < call_list.length; _i++) {
var _h = call_list[_i];
try {
for (var _iterator2 = handlers[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var h = _step2.value;
try {
_h.apply(void 0, args);
} catch (e) {
// let runtime deal with exceptions
_this._scheduleCall(function () {
throw e;
});
}
}
});
}
}], [{
key: Symbol.hasInstance,
value: function value(instance) {
return instance[SYM_EVENT_EMITTER] !== undefined || instance.constructor === EventEmitter;
}
/**
* Attach event emitter to any instance
* @param {object} instance - target object
* @param {array} allowed_events - list of allowed event names
* @param {integer} max_listeners=8 - maximum allowed handlers per event name
*/
call_list.push(h);
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2.return) {
_iterator2.return();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
}, {
key: "attach",
value: function attach(instance, allowed_events) {
var _Object$definePropert;
if (once_handlers.length) {
var _iteratorNormalCompletion3 = true;
var _didIteratorError3 = false;
var _iteratorError3 = undefined;
var max_listeners = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 8;
var old_ee = instance[SYM_EVENT_EMITTER];
try {
for (var _iterator3 = once_handlers[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
var _h = _step3.value;
if (old_ee !== undefined) {
old_ee._max = max_listeners;
var _iteratorNormalCompletion4 = true;
var _didIteratorError4 = false;
var _iteratorError4 = undefined;
call_list.push(_h);
}
} catch (err) {
_didIteratorError3 = true;
_iteratorError3 = err;
} finally {
try {
if (!_iteratorNormalCompletion3 && _iterator3.return) {
_iterator3.return();
}
} finally {
if (_didIteratorError3) {
throw _iteratorError3;
}
}
}
try {
for (var _iterator4 = allowed_events[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
var evt = _step4.value;
this['' + ONCE_PREFIX + evt] = [];
if ("".concat(ON_PREFIX).concat(evt) in old_ee) {
throw new Error("Event \"".concat(evt, "\" has been already registered!"));
} else {
old_ee["".concat(ON_PREFIX).concat(evt)] = [];
old_ee["".concat(ONCE_PREFIX).concat(evt)] = [];
}
}
} catch (err) {
_didIteratorError4 = true;
_iteratorError4 = err;
} finally {
try {
if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
_iterator4.return();
}
} finally {
if (_didIteratorError4) {
throw _iteratorError4;
}
}
}
this._scheduleCall(function () {
// ---
var _iteratorNormalCompletion4 = true;
var _didIteratorError4 = false;
var _iteratorError4 = undefined;
return;
}
try {
for (var _iterator4 = call_list[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
var _h2 = _step4.value;
try {
_h2.apply(undefined, args);
} catch (e) {
// let runtime deal with exceptions
_this._scheduleCall(function () {
throw e;
});
}
}
} catch (err) {
_didIteratorError4 = true;
_iteratorError4 = err;
} finally {
try {
if (!_iteratorNormalCompletion4 && _iterator4.return) {
_iterator4.return();
}
} finally {
if (_didIteratorError4) {
throw _iteratorError4;
}
}
}
});
var ee = new EventEmitter(allowed_events, max_listeners);
Object.defineProperties(instance, (_Object$definePropert = {}, _defineProperty(_Object$definePropert, SYM_EVENT_EMITTER, {
configurable: false,
enumerable: false,
writable: false,
value: ee
}), _defineProperty(_Object$definePropert, "on", {
configurable: false,
enumerable: false,
writable: false,
value: function value(evt, handler) {
return ee.on(evt, handler);
}
}], [{
key: Symbol.hasInstance,
value: function value(instance) {
return instance[SYM_EVENT_EMITTER] !== undefined || instance.constructor === EventEmitter;
}), _defineProperty(_Object$definePropert, "off", {
configurable: false,
enumerable: false,
writable: false,
value: function value(evt, handler) {
return ee.off(evt, handler);
}
}), _defineProperty(_Object$definePropert, "once", {
configurable: false,
enumerable: false,
writable: false,
value: function value(evt, handler) {
return ee.once(evt, handler);
}
}), _defineProperty(_Object$definePropert, "emit", {
configurable: false,
enumerable: false,
writable: false,
value: function value(evt) {
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
args[_key2 - 1] = arguments[_key2];
}
/**
* Attach event emitter to any instance
* @param {object} instance - target object
* @param {array} allowed_events - list of allowed event names
* @param {integer} max_listeners=8 - maximum allowed handlers per event name
*/
}, {
key: 'attach',
value: function attach(instance, allowed_events) {
var _Object$definePropert;
var max_listeners = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 8;
var old_ee = instance[SYM_EVENT_EMITTER];
if (old_ee !== undefined) {
old_ee._max = max_listeners;
var _iteratorNormalCompletion5 = true;
var _didIteratorError5 = false;
var _iteratorError5 = undefined;
try {
for (var _iterator5 = allowed_events[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
var evt = _step5.value;
if ('' + ON_PREFIX + evt in old_ee) {
throw new Error('Event "' + evt + '" has been already registered!');
} else {
old_ee['' + ON_PREFIX + evt] = [];
old_ee['' + ONCE_PREFIX + evt] = [];
}
}
} catch (err) {
_didIteratorError5 = true;
_iteratorError5 = err;
} finally {
try {
if (!_iteratorNormalCompletion5 && _iterator5.return) {
_iterator5.return();
}
} finally {
if (_didIteratorError5) {
throw _iteratorError5;
}
}
}
return;
}
var ee = new EventEmitter(allowed_events, max_listeners);
Object.defineProperties(instance, (_Object$definePropert = {}, _defineProperty(_Object$definePropert, SYM_EVENT_EMITTER, {
configurable: false,
enumerable: false,
writable: false,
value: ee
}), _defineProperty(_Object$definePropert, 'on', {
configurable: false,
enumerable: false,
writable: false,
value: function value(evt, handler) {
return ee.on(evt, handler);
}
}), _defineProperty(_Object$definePropert, 'off', {
configurable: false,
enumerable: false,
writable: false,
value: function value(evt, handler) {
return ee.off(evt, handler);
}
}), _defineProperty(_Object$definePropert, 'once', {
configurable: false,
enumerable: false,
writable: false,
value: function value(evt, handler) {
return ee.once(evt, handler);
}
}), _defineProperty(_Object$definePropert, 'emit', {
configurable: false,
enumerable: false,
writable: false,
value: function value(evt) {
for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
args[_key2 - 1] = arguments[_key2];
}
return ee.emit.apply(ee, [evt].concat(args));
}
}), _Object$definePropert));
return ee.emit.apply(ee, [evt].concat(args));
}
}), _Object$definePropert));
}
/**
* Dynamically update max listener count
* @param {object} instance - target object
* @param {integer} max_listeners - maximum allowed handlers per event name
*/
/**
* Dynamically update max listener count
* @param {object} instance - target object
* @param {integer} max_listeners - maximum allowed handlers per event name
*/
}, {
key: "setMaxListeners",
value: function setMaxListeners(instance, max_listeners) {
instance[SYM_EVENT_EMITTER]._max = max_listeners;
}
}, {
key: "SYM_EVENT_EMITTER",
get: function get() {
return SYM_EVENT_EMITTER;
}
}]);
}, {
key: 'setMaxListeners',
value: function setMaxListeners(instance, max_listeners) {
instance[SYM_EVENT_EMITTER]._max = max_listeners;
}
}, {
key: 'SYM_EVENT_EMITTER',
get: function get() {
return SYM_EVENT_EMITTER;
}
}]);
return EventEmitter;
return EventEmitter;
}();

@@ -380,0 +349,0 @@

'use strict';
/**

@@ -23,3 +22,2 @@ * @file

var EventEmitter = require('../EventEmitter');
/**

@@ -29,10 +27,11 @@ * Attach event emitter properties to object. Call it in c-tor.

*/
var $asyncevent = EventEmitter.attach;
/**
* Reference to EventEmitter class
*/
$asyncevent.EventEmitter = EventEmitter;
module.exports = $asyncevent;
//# sourceMappingURL=asyncevent.js.map

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

'use strict';
"use strict";

@@ -23,3 +23,2 @@ /**

*/
(function (window) {

@@ -32,3 +31,2 @@ 'use strict';

var $asyncevent = require('./asyncevent.js');
/**

@@ -39,4 +37,5 @@ * **window.$asyncevent** - browser-only reference to futoin-asyncsteps module

*/
window.$asyncevent = $asyncevent;
/**

@@ -47,4 +46,4 @@ * **window.FutoIn.$asyncevent** - browser-only reference to futoin-asyncsteps module

*/
futoin.$asyncevent = $asyncevent;
/**

@@ -55,4 +54,4 @@ * **window.futoin.EventEmitter** - browser-only reference to futoin-asyncsteps.EventEmitter

*/
futoin.EventEmitter = $asyncevent.EventEmitter;
window.FutoIn = futoin;

@@ -59,0 +58,0 @@ window.futoin = futoin;

'use strict';
/**

@@ -23,4 +22,6 @@ * @file

require('core-js/fn/symbol');
require('core-js/fn/symbol/iterator');
require('core-js/fn/symbol/has-instance');
//# sourceMappingURL=polyfill.js.map

@@ -1,8 +0,5 @@

'use strict';
'use strict'; // ensure it works with frozen one
// ensure it works with frozen one
Object.freeze(Object.prototype); //
Object.freeze(Object.prototype);
//
var $asyncevent = typeof window !== 'undefined' ? require('futoin-asyncevent') : module.require('../lib/asyncevent');

@@ -14,327 +11,288 @@

var SYM_EVENT_EMITTER = $asyncevent.EventEmitter.SYM_EVENT_EMITTER;
describe('EventEmitter', function () {
describe('.attach()', function () {
it("should attach", function () {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
});
it("should allow additional registrationk", function () {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
$asyncevent(o, ['d']);
});
it("should fail on double registration", function () {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
expect(function () {
return $asyncevent(o, ['b']);
}).to.throw('Event "b" has been already registered!');
});
describe('.attach()', function () {
it("should attach", function () {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
});
describe('.on()', function () {
it("should attach handlers", function () {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
$asyncevent(o, ['d']);
o.on('a', function () {});
o.on('a', function () {});
o.on('b', function () {});
o.on('d', function () {});
expect(o[SYM_EVENT_EMITTER]._evt_a.length).to.equal(2);
expect(o[SYM_EVENT_EMITTER]._evt_b.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evt_c.length).to.equal(0);
expect(o[SYM_EVENT_EMITTER]._evt_d.length).to.equal(1);
});
it("should fail on unknown event", function () {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
expect(function () {
return o.on('d', function () {});
}).to.throw('Unknown event: d');
});
it("should allow additional registrationk", function () {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
$asyncevent(o, ['d']);
});
describe('.once()', function () {
it("should attach handlers", function () {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
o.once('a', function () {});
o.once('a', function () {});
o.once('b', function () {});
expect(o[SYM_EVENT_EMITTER]._evtonce_a.length).to.equal(2);
expect(o[SYM_EVENT_EMITTER]._evtonce_b.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evtonce_c.length).to.equal(0);
});
it("should fail on unknown event", function () {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
expect(function () {
return o.once('d', function () {});
}).to.throw('Unknown event: d');
});
it("should fail on double registration", function () {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
expect(function () {
return $asyncevent(o, ['b']);
}).to.throw('Event "b" has been already registered!');
});
describe('.off()', function () {
it("should detach handlers", function () {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
var a1 = function a1() {};
var a2 = function a2() {};
var b1 = function b1() {};
var a1o = function a1o() {};
var b1o = function b1o() {};
var b2o = function b2o() {};
o.on('a', a1);
o.on('a', a2);
o.on('b', b1);
o.once('a', a1o);
o.once('b', b1o);
o.once('b', b2o);
expect(o[SYM_EVENT_EMITTER]._evt_a.length).to.equal(2);
expect(o[SYM_EVENT_EMITTER]._evt_b.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evt_c.length).to.equal(0);
expect(o[SYM_EVENT_EMITTER]._evtonce_a.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evtonce_b.length).to.equal(2);
expect(o[SYM_EVENT_EMITTER]._evtonce_c.length).to.equal(0);
// ---
o.off('a');
expect(o[SYM_EVENT_EMITTER]._evt_a.length).to.equal(2);
expect(o[SYM_EVENT_EMITTER]._evt_b.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evt_c.length).to.equal(0);
expect(o[SYM_EVENT_EMITTER]._evtonce_a.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evtonce_b.length).to.equal(2);
expect(o[SYM_EVENT_EMITTER]._evtonce_c.length).to.equal(0);
// ---
o.off('a', a1);
expect(o[SYM_EVENT_EMITTER]._evt_a.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evt_b.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evt_c.length).to.equal(0);
expect(o[SYM_EVENT_EMITTER]._evtonce_a.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evtonce_b.length).to.equal(2);
expect(o[SYM_EVENT_EMITTER]._evtonce_c.length).to.equal(0);
// ---
o.off('a', a1);
expect(o[SYM_EVENT_EMITTER]._evt_a.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evt_b.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evt_c.length).to.equal(0);
expect(o[SYM_EVENT_EMITTER]._evtonce_a.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evtonce_b.length).to.equal(2);
expect(o[SYM_EVENT_EMITTER]._evtonce_c.length).to.equal(0);
// ---
o.off('a', a2);
expect(o[SYM_EVENT_EMITTER]._evt_a.length).to.equal(0);
expect(o[SYM_EVENT_EMITTER]._evt_b.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evt_c.length).to.equal(0);
expect(o[SYM_EVENT_EMITTER]._evtonce_a.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evtonce_b.length).to.equal(2);
expect(o[SYM_EVENT_EMITTER]._evtonce_c.length).to.equal(0);
// ---
o.off('a', a1o);
expect(o[SYM_EVENT_EMITTER]._evt_a.length).to.equal(0);
expect(o[SYM_EVENT_EMITTER]._evt_b.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evt_c.length).to.equal(0);
expect(o[SYM_EVENT_EMITTER]._evtonce_a.length).to.equal(0);
expect(o[SYM_EVENT_EMITTER]._evtonce_b.length).to.equal(2);
expect(o[SYM_EVENT_EMITTER]._evtonce_c.length).to.equal(0);
});
it("should fail on unknown event", function () {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
expect(function () {
return o.off('d', function () {});
}).to.throw('Unknown event: d');
});
});
describe('.on()', function () {
it("should attach handlers", function () {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
$asyncevent(o, ['d']);
o.on('a', function () {});
o.on('a', function () {});
o.on('b', function () {});
o.on('d', function () {});
expect(o[SYM_EVENT_EMITTER]._evt_a.length).to.equal(2);
expect(o[SYM_EVENT_EMITTER]._evt_b.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evt_c.length).to.equal(0);
expect(o[SYM_EVENT_EMITTER]._evt_d.length).to.equal(1);
});
it("should fail on unknown event", function () {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
expect(function () {
return o.on('d', function () {});
}).to.throw('Unknown event: d');
});
});
describe('.once()', function () {
it("should attach handlers", function () {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
o.once('a', function () {});
o.once('a', function () {});
o.once('b', function () {});
expect(o[SYM_EVENT_EMITTER]._evtonce_a.length).to.equal(2);
expect(o[SYM_EVENT_EMITTER]._evtonce_b.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evtonce_c.length).to.equal(0);
});
it("should fail on unknown event", function () {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
expect(function () {
return o.once('d', function () {});
}).to.throw('Unknown event: d');
});
});
describe('.off()', function () {
it("should detach handlers", function () {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
describe('.emit()', function () {
it("should work on empty list", function () {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
o.emit('a');
o.emit('a');
o.emit('b');
});
var a1 = function a1() {};
it("should fail on unknown event", function () {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
var a2 = function a2() {};
expect(function () {
return o.emit('d');
}).to.throw('Unknown event: d');
});
var b1 = function b1() {};
it("should correctly process events", function (done) {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
var a1o = function a1o() {};
var spies = {
a: 0,
b: 0,
c: 0
};
var b1o = function b1o() {};
o.emit('a');
o.emit('a');
o.emit('b');
var b2o = function b2o() {};
// ---
o.on('a', function (a, b, c, d) {
try {
expect(a).to.equal('A');
expect(b).to.equal(1);
expect(c).to.equal(true);
expect(d).to.be.undefined;
} catch (e) {
done(e);
}
o.on('a', a1);
o.on('a', a2);
o.on('b', b1);
o.once('a', a1o);
o.once('b', b1o);
o.once('b', b2o);
expect(o[SYM_EVENT_EMITTER]._evt_a.length).to.equal(2);
expect(o[SYM_EVENT_EMITTER]._evt_b.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evt_c.length).to.equal(0);
expect(o[SYM_EVENT_EMITTER]._evtonce_a.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evtonce_b.length).to.equal(2);
expect(o[SYM_EVENT_EMITTER]._evtonce_c.length).to.equal(0); // ---
spies.a += 1;
});
o.on('a', function () {
spies.a += 1;
});
o.once('a', function () {
spies.a += 1;
});
o.on('b', function () {
spies.b += 1;
});
o.off('a');
expect(o[SYM_EVENT_EMITTER]._evt_a.length).to.equal(2);
expect(o[SYM_EVENT_EMITTER]._evt_b.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evt_c.length).to.equal(0);
expect(o[SYM_EVENT_EMITTER]._evtonce_a.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evtonce_b.length).to.equal(2);
expect(o[SYM_EVENT_EMITTER]._evtonce_c.length).to.equal(0); // ---
o.emit('a', 'A', 1, true);
o.off('a', a1);
expect(o[SYM_EVENT_EMITTER]._evt_a.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evt_b.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evt_c.length).to.equal(0);
expect(o[SYM_EVENT_EMITTER]._evtonce_a.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evtonce_b.length).to.equal(2);
expect(o[SYM_EVENT_EMITTER]._evtonce_c.length).to.equal(0); // ---
// ---
o.once('a', function () {
try {
expect(spies).to.eql({
a: 5,
b: 0,
c: 0
});
done();
} catch (e) {
done(e);
}
});
o.off('a', a1);
expect(o[SYM_EVENT_EMITTER]._evt_a.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evt_b.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evt_c.length).to.equal(0);
expect(o[SYM_EVENT_EMITTER]._evtonce_a.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evtonce_b.length).to.equal(2);
expect(o[SYM_EVENT_EMITTER]._evtonce_c.length).to.equal(0); // ---
o.emit('a', 'A', 1, true);
o.off('a', a2);
expect(o[SYM_EVENT_EMITTER]._evt_a.length).to.equal(0);
expect(o[SYM_EVENT_EMITTER]._evt_b.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evt_c.length).to.equal(0);
expect(o[SYM_EVENT_EMITTER]._evtonce_a.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evtonce_b.length).to.equal(2);
expect(o[SYM_EVENT_EMITTER]._evtonce_c.length).to.equal(0); // ---
expect(spies).to.eql({
a: 0,
b: 0,
c: 0
});
});
o.off('a', a1o);
expect(o[SYM_EVENT_EMITTER]._evt_a.length).to.equal(0);
expect(o[SYM_EVENT_EMITTER]._evt_b.length).to.equal(1);
expect(o[SYM_EVENT_EMITTER]._evt_c.length).to.equal(0);
expect(o[SYM_EVENT_EMITTER]._evtonce_a.length).to.equal(0);
expect(o[SYM_EVENT_EMITTER]._evtonce_b.length).to.equal(2);
expect(o[SYM_EVENT_EMITTER]._evtonce_c.length).to.equal(0);
});
it("should fail on unknown event", function () {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
expect(function () {
return o.off('d', function () {});
}).to.throw('Unknown event: d');
});
});
describe('.emit()', function () {
it("should work on empty list", function () {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
o.emit('a');
o.emit('a');
o.emit('b');
});
it("should fail on unknown event", function () {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
expect(function () {
return o.emit('d');
}).to.throw('Unknown event: d');
});
it("should correctly process events", function (done) {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
var spies = {
a: 0,
b: 0,
c: 0
};
o.emit('a');
o.emit('a');
o.emit('b'); // ---
it("should process events fast enough", function (done) {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
o.on('a', function (a, b, c, d) {
try {
expect(a).to.equal('A');
expect(b).to.equal(1);
expect(c).to.equal(true);
expect(d).to.be.undefined;
} catch (e) {
done(e);
}
var spies = {
a: 0
};
spies.a += 1;
});
o.on('a', function () {
spies.a += 1;
});
o.once('a', function () {
spies.a += 1;
});
o.on('b', function () {
spies.b += 1;
});
o.emit('a', 'A', 1, true); // ---
var EVT_NUM = 1e5;
o.once('a', function () {
try {
expect(spies).to.eql({
a: 5,
b: 0,
c: 0
});
done();
} catch (e) {
done(e);
}
});
o.emit('a', 'A', 1, true);
expect(spies).to.eql({
a: 0,
b: 0,
c: 0
});
});
it("should process events fast enough", function (done) {
var o = {};
$asyncevent(o, ['a', 'b', 'c']);
var spies = {
a: 0
};
var EVT_NUM = 1e5;
o.on('a', function (a, b, c, d) {
spies.a += 1;
o.on('a', function (a, b, c, d) {
spies.a += 1;
if (spies.a === EVT_NUM) {
done();
}
});
if (spies.a === EVT_NUM) {
done();
}
});
for (var i = 0; i < EVT_NUM; ++i) {
o.emit('a', 'A', 1, true);
}
for (var i = 0; i < EVT_NUM; ++i) {
o.emit('a', 'A', 1, true);
}
expect(spies.a).to.equal(0);
});
it("should support max listeners soft threshold", function () {
var o = {
called: 0
};
$asyncevent(o, ['a', 'b', 'c']);
var bak = console.warn;
expect(spies.a).to.equal(0);
});
console.warn = function (m) {
o.called += 1;
expect(m).to.equal("Hitting max ".concat(o.called < 3 ? '' : 'once ', "handler limit for: a"));
};
it("should support max listeners soft threshold", function () {
var o = { called: 0 };
$asyncevent.EventEmitter.setMaxListeners(o, 1);
o.on('a', function () {});
o.on('a', function () {});
o.on('a', function () {});
o.once('a', function () {});
expect(o.called).to.equal(1);
$asyncevent.EventEmitter.setMaxListeners(o, 3);
o.on('a', function () {});
o.on('a', function () {});
expect(o.called).to.equal(2);
o.once('a', function () {});
o.once('a', function () {});
expect(o.called).to.equal(2);
o.once('a', function () {});
expect(o.called).to.equal(3);
console.warn = bak;
});
$asyncevent(o, ['a', 'b', 'c']);
var bak = console.warn;
console.warn = function (m) {
o.called += 1;
expect(m).to.equal('Hitting max ' + (o.called < 3 ? '' : 'once ') + 'handler limit for: a');
};
$asyncevent.EventEmitter.setMaxListeners(o, 1);
o.on('a', function () {});
o.on('a', function () {});
o.on('a', function () {});
o.once('a', function () {});
expect(o.called).to.equal(1);
$asyncevent.EventEmitter.setMaxListeners(o, 3);
o.on('a', function () {});
o.on('a', function () {});
expect(o.called).to.equal(2);
o.once('a', function () {});
o.once('a', function () {});
expect(o.called).to.equal(2);
o.once('a', function () {});
expect(o.called).to.equal(3);
console.warn = bak;
});
if (typeof window === 'undefined') {
it("should support instanceof", function () {
var o = {};
expect(o instanceof $asyncevent.EventEmitter).to.be.false;
$asyncevent(o, ['a', 'b', 'c']);
expect(o instanceof $asyncevent.EventEmitter).to.be.true;
var ee = new $asyncevent.EventEmitter(['evt'], 1);
expect(ee instanceof $asyncevent.EventEmitter).to.be.true;
});
}
});
if (typeof window === 'undefined') {
it("should support instanceof", function () {
var o = {};
expect(o instanceof $asyncevent.EventEmitter).to.be.false;
$asyncevent(o, ['a', 'b', 'c']);
expect(o instanceof $asyncevent.EventEmitter).to.be.true;
var ee = new $asyncevent.EventEmitter(['evt'], 1);
expect(ee instanceof $asyncevent.EventEmitter).to.be.true;
});
}
});
});
if (typeof window !== 'undefined') {
describe('Globals', function () {
it('$asyncevent should be set', function () {
expect(window.$asyncevent).to.equal($asyncevent);
});
it('FutoIn.$asyncevent should be set', function () {
expect(window.FutoIn.$asyncevent).to.equal($asyncevent);
expect(window.futoin.$asyncevent).to.equal($asyncevent);
});
it('FutoIn.EventEmitter should be set', function () {
expect(window.FutoIn.EventEmitter).to.equal($asyncevent.EventEmitter);
expect(window.futoin.EventEmitter).to.equal($asyncevent.EventEmitter);
});
describe('Globals', function () {
it('$asyncevent should be set', function () {
expect(window.$asyncevent).to.equal($asyncevent);
});
it('FutoIn.$asyncevent should be set', function () {
expect(window.FutoIn.$asyncevent).to.equal($asyncevent);
expect(window.futoin.$asyncevent).to.equal($asyncevent);
});
it('FutoIn.EventEmitter should be set', function () {
expect(window.FutoIn.EventEmitter).to.equal($asyncevent.EventEmitter);
expect(window.futoin.EventEmitter).to.equal($asyncevent.EventEmitter);
});
});
}
//# sourceMappingURL=unittest.js.map
{
"name": "futoin-asyncevent",
"version": "2.2.1",
"version": "2.2.2",
"description": "FutoIn AsyncEvent - FTN15 compliant event emitter",

@@ -41,13 +41,13 @@ "main": "lib/asyncevent.js",

"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-preset-env": "^1.7.0",
"chai": "^4.1.2",
"core-js": "^2.5.7",
"eslint": "^5.3.0",
"futoin-asyncsteps": "^2.3.2",
"@babel/core": "^7.2.2",
"@babel/plugin-transform-object-assign": "^7.2.0",
"@babel/preset-env": "^7.2.3",
"babel-loader": "^8.0.5",
"chai": "^4.2.0",
"core-js": "^2.6.2",
"eslint": "^5.12.0",
"futoin-asyncsteps": "^2.3.3",
"grunt": "^1.0.3",
"grunt-babel": "^7.0.0",
"grunt-contrib-connect": "^1.0.2",
"grunt-babel": "^8.0.0",
"grunt-contrib-connect": "^2.0.0",
"grunt-eslint": "^21.0.0",

@@ -58,6 +58,6 @@ "grunt-jsdoc-to-markdown": "^4.0.0",

"grunt-text-replace": "^0.4.0",
"grunt-webpack": "^3.1.2",
"grunt-webpack": "^3.1.3",
"istanbul": "^0.4.5",
"mocha": "^5.2.0",
"webpack": "^4.16.5"
"webpack": "^4.28.4"
},

@@ -64,0 +64,0 @@ "peerDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is 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