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

safe

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

safe - npm Package Compare versions

Comparing version 0.4.7 to 0.4.8

4

lib/safe.min.js

@@ -5,5 +5,5 @@ /*!

*
* Copyright 2012-2021 PushOk Software
* Copyright 2012-2023 PushOk Software
* Licensed under MIT
*/
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(n.safe={})}(this,(function(n){"use strict";function r(n,r){n.prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r}var t=Object.keys,e=Array.isArray,i=Object.prototype.hasOwnProperty,o="Callback was already called.",u=["Array or Object are required","Array is required","Exactly two arguments are required","Function is required"],a=function(){},c=function(n){if(null===n)return!1;var r=typeof n;return"object"===r||"function"===r},f=function(n){return void 0===n},s=function(n){return"function"==typeof n},l=function(n){return n&&s(n.then)},h=function(n){if(n)return n.data},p=function(n){return n&&n.constructor&&"AsyncFunction"===n.constructor.name},v=function(n,r){var t=new TypeError(n);if(!s(r)||r===a)throw t;r(t)},d=function(n){var r=!1;return function(){if(!r&&null!=n)return r=!0,n.apply(void 0,arguments)}},y=function(n){var r=!1;return function(){if(r)throw new Error(o);return r=!0,n.apply(void 0,arguments)}},m=function(n){return e(n)?(r=n,i=-1,{next:function(){return++i<r.length?{value:r[i],key:i,done:!1}:{done:!0}}}):n["function"==typeof Symbol&&Symbol.iterator]?function(n){var r=-1,t=n[Symbol.iterator]();return{next:function(){r++;var n=t.next();return n.done?{done:!0}:{value:n.value,key:r,done:!1}}}}(n):function(n){var r=t(n),e=r.length,i=-1;return{next:function(){i++;var t=r[i];return i<e?{value:n[t],key:t,done:!1}:{done:!0}}}}(n);var r,i},w=function(n,r,t,e){var i=0,o=!1,u=m(n),a=!1,c=d(e);!function n(){if(!o&&!a)for(;i<r&&!1===a;){var e=u.next();if(e.done){o=!0,i<=0&&c();break}i++,t(e.value,e.key,(function(t){i--,t?(a=!0,c(t)):!1===o&&i<r?n():o&&i<=0&&c()}))}}()},g=function(n){return function(r){return r(null,n())}},_="function"==typeof queueMicrotask?function(n){for(var r=arguments.length,t=new Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];queueMicrotask((function(){n.apply(void 0,t)}))}:"function"==typeof setImmediate?setImmediate:"undefined"==typeof process?"function"==typeof Image?function(n){for(var r=arguments.length,t=new Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];var i=new Image;i.onerror=function(){n.apply(void 0,t)},i.src="data:image/png,0"}:function(n){for(var r=arguments.length,t=new Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];setTimeout.apply(void 0,[n,0].concat(t))}:function(n){for(var r=arguments.length,t=new Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];process.nextTick((function(){n.apply(void 0,t)}))},k=function(){if(!s(arguments.length<=0?void 0:arguments[0]))throw new TypeError(u[3]);_.apply(void 0,arguments)},b=function(n,r){n.then((function(n){k(r,null,n)}),(function(n){k(r,n)}))},E=function(n,r){if(p(n))b(n(),r);else{var t,e,i=!1;try{e=n(u)}catch(n){if(!n)throw n;_(u,n)}if(l(e)){if(t="Resolution method is overspecified. Call a callback *or* return a Promise.",i)throw new Error(t);b(e,u)}}function u(){if(i)throw(arguments.length<=0?void 0:arguments[0])||new Error(t||o);i=!0,r.apply(void 0,arguments)}},S=function(n,r,t,e){if(!c(n))return v(u[0],e);var i=[],o=0;w(n,r,(function(n,r,e){var u=o++;E((function(r){return t(n,r)}),(function(n,r){i[u]=r,e(n)}))}),(function(n){e(n,i)}))},L=function(n,r,t,e){if(!c(n))return v(u[0],e);var i={};w(n,r,(function(n,r,e){E((function(e){return t(n,r,e)}),(function(n,t){i[r]=t,e(n)}))}),(function(n){e(n,i)}))},A=function(n,r,t,e){if(!c(n))return v(u[0],e);S(n,r,(function(n,r){E((function(r){return t(n,r)}),(function(t,e){if(t)return r(t);r(t,{key:e,val:n})}))}),(function(n,r){var t={};r.forEach((function(n){i.call(t,n.key)?t[n.key].push(n.val):t[n.key]=[n.val]})),e(n,t)}))},x=function(n,r,t,i,o){if(!e(r))return v(u[1],o);var a=[];w(r,t,(function(r,t,e){E((function(n){return i(r,n)}),(function(i,o){(n&&o||!n&&!o)&&a.push({data:r,i:t}),e(i)}))}),(function(n){o(n,a.sort((function(n,r){return n.i-r.i})).map(h))}))},O=function(n,r,t,e,i){var o=n;w(r,t,(function(r,t,i){E((function(n){return e(r,n)}),(function(r){n?(r||(o=!1),i(!r)):(r&&(o=!0),i(o))}))}),(function(){return i(o)}))},j=function(n,r,t){var i=e(n)?[]:{};w(n,r,(function(n,r,t){E(n,(function(n){for(var e=arguments.length,o=new Array(e>1?e-1:0),u=1;u<e;u++)o[u-1]=arguments[u];o.length?i[r]=1===o.length?o[0]:o:i[r]=null,t(n)}))}),(function(n){t(n,i)}))},T=function(n,r,t,e){for(var i=parseInt(n),o=Array(i),u=0;u<i;u++)o[u]=u;S(o,r,t,e)},P=function(n,r,t,e){var i;w(n,r,(function(n,r,e){E((function(r){return t(n,r)}),(function(r){r&&(i=n),e(i||null)}))}),(function(){return e(i)}))},I=function(n,r,t,i){if(!e(n))return v(u[1],i);S(n,r,t,(function(n,r){var t;i(n,(t=[]).concat.apply(t,r))}))},q=function(n,r){if(!s(r)||!s(n))throw new TypeError(u[2]);return function(){var t;try{for(var e=arguments.length,i=new Array(e),o=0;o<e;o++)i[o]=arguments[o];t=r.apply(this,i)}catch(r){if(!r)throw r;return void n(r)}f(t)?k(n,null):k(n,null,t)}},z=function(n,r){if(!s(r)||!s(n))throw new TypeError(u[2]);return function(t){if(t)n(t);else{var e;try{for(var i=arguments.length,o=new Array(i>1?i-1:0),u=1;u<i;u++)o[u-1]=arguments[u];e=r.apply(this,o)}catch(r){if(!r)throw r;return void k(n,r)}f(e)?k(n,null):k(n,null,e)}}},B=function(n,r){if(f(r)||!s(n))throw new TypeError(u[2]);return function(t){if(t)n(t);else if(s(r))try{for(var e=arguments.length,i=new Array(e>1?e-1:0),o=1;o<e;o++)i[o-1]=arguments[o];return r.apply(this,i)}catch(r){if(!r)throw r;k(n,r)}else k(n,null,r)}},V=function(n,r){if(f(n))throw new TypeError(u[2]);return function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];f(r)&&(r=n,n=e[e.length-1]);try{return r.apply(this,e)}catch(r){if(!r)throw r;k(n,r)}}},M=function(n,r){if(!s(n)||!s(r))throw new TypeError(u[2]);return function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];e.push(r);try{return n.apply(this,e)}catch(n){if(!n)throw n;k(r,n)}}},C=function(n,r){if(f(r)||!s(n))throw new TypeError(u[2]);return function(t){if(t)n(t);else try{return r.apply(this,arguments.length<=1?void 0:arguments[1])}catch(r){if(!r)throw r;k(n,r)}}},F=function(n){return function(r){return n.apply(this,r)}},Q=function(n,r,t,e,i){function o(){E(r,B(i,u))}function u(r){E(n,B(i,(function(n){n==t?i(null,r):o()})))}e?u():o()},R=function(n,r,t,i,o){if(void 0===i&&(i=a),!e(n))return v(u[1],i);var c=m(n),f=n.length;!function r(e,u){if(e)i(e);else{var a=c.next();a.done?i(null,u):E((function(r){return t(u,o?a.value:n[f-1-a.key],r)}),r)}}(null,r)},D=function(n){return function(r){for(var t=function(){for(var t=this,e=arguments.length,i=new Array(e),o=0;o<e;o++)i[o]=arguments[o];var u=i.pop();w(r,n,(function(n,r,e){E((function(r){return n.apply(t,i.concat(r))}),e)}),u)},e=arguments.length,i=new Array(e>1?e-1:0),o=1;o<e;o++)i[o-1]=arguments[o];return 0===i.length?t:t.apply(this,i)}},U=function(){function n(n,r){var t=parseInt(r);if(!t)throw new TypeError("Concurrency must not be zero");Object.defineProperties(this,{__worker:{enumerable:!1,configurable:!1,writable:!1,value:n},__workers:{enumerable:!1,configurable:!1,writable:!0,value:0},__workersList:{enumerable:!1,configurable:!1,writable:!0,value:[]},__isProcessing:{enumerable:!1,configurable:!1,writable:!0,value:!1},__processingScheduled:{enumerable:!1,configurable:!1,writable:!0,value:!1},tasks:{enumerable:!1,configurable:!1,writable:!1,value:[]},concurrency:{enumerable:!0,configurable:!1,writable:!0,value:t},buffer:{enumerable:!0,configurable:!1,writable:!0,value:t/4},started:{enumerable:!0,configurable:!1,writable:!0,value:!1},paused:{enumerable:!0,configurable:!1,writable:!0,value:!1}})}var r=n.prototype;return r.__insert=function(n,r,t){var i=this;if(null!=t&&!s(t))throw new TypeError(u[3]);this.started=!0;var o=e(n)?n:[n];if(0===o.length&&this.idle())return _((function(){i.drain()}));var c,f,l=o.map((function(n){return{data:n,callback:y(t||a)}}));r?(c=this.tasks).unshift.apply(c,l):(f=this.tasks).push.apply(f,l);this.__processingScheduled||(this.__processingScheduled=!0,_((function(){i.__processingScheduled=!1,i.__execute()})))},r.__execute=function(){var n=this;if(!this.__isProcessing){this.__isProcessing=!0;for(var r=function(){var r=n.tasks.shift();n.__workersList.push(r),0===n.tasks.length&&n.empty();var t=r.data;n.__workers++,n.__workers===n.concurrency&&n.saturated(),E((function(r){return n.__worker(t,r)}),(function(){n.__workers--;var e=n.__workersList.indexOf(r);0===e?n.__workersList.shift():e>0&&n.__workersList.splice(e,1),r.callback.apply(r,arguments),(arguments.length<=0?void 0:arguments[0])&&n.error(arguments.length<=0?void 0:arguments[0],t),n.__workers<=n.concurrency-n.buffer&&n.unsaturated(),n.idle()&&n.drain(),n.__execute()}))};!this.paused&&this.__workers<this.concurrency&&this.tasks.length;)r();this.__isProcessing=!1}},r.remove=function(n){var r=this,t=this.tasks.filter((function(r){return!n(r.data)}));this.tasks.length=t.length,t.forEach((function(n,t){r.tasks[t]=n}))},r.push=function(n,r){this.__insert(n,!1,r)},r.saturated=function(){},r.unsaturated=function(){},r.empty=function(){},r.drain=function(){},r.error=function(){},r.kill=function(){delete this.drain,this.tasks.length=0},r.length=function(){return this.tasks.length},r.running=function(){return this.__workers},r.idle=function(){return this.tasks.length+this.__workers===0},r.pause=function(){this.paused=!0},r.resume=function(){var n=this;this.paused&&(this.paused=!1,_((function(){return n.__execute()})))},r.workersList=function(){return this.__workersList},n}(),W=function(n){function t(r,t){return n.call(this,r,t,"Priority Queue")||this}r(t,n);var i=t.prototype;return i.push=function(n,r,t){this.__insert(n,r||0,t)},i.__insert=function(n,r,t){var i=this;if(null!=t&&!s(t))throw new TypeError(u[3]);this.started=!0;var o=e(n)?n:[n];if(0===o.length&&this.idle())return _((function(){i.drain()}));var c,f,l=o.map((function(n){return{data:n,priority:r,callback:y(t||a)}})),h=this.tasks.length,p=h?this.tasks[0].priority:0,v=h?this.tasks[h-1].priority:0;r>p?(c=this.tasks).unshift.apply(c,l):(f=this.tasks).push.apply(f,l);p>=r&&r<v&&this.tasks.sort((function(n,r){return r.priority-n.priority})),this.__processingScheduled||(this.__processingScheduled=!0,_((function(){i.__processingScheduled=!1,i.__execute()})))},t}(U),G=function(n){function t(r,t){return n.call(this,r,t,"Queue")||this}return r(t,n),t.prototype.unshift=function(n,r){this.__insert(n,!0,r)},t}(U),H=function(n){function t(r,t){var e;e=n.call(this,r,1,"Cargo")||this;var i=parseInt(t);if(!i)throw new TypeError("Payload must not be zero");return Object.defineProperties(function(n){if(void 0===n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}(e),{payload:{enumerable:!0,configurable:!1,writable:!0,value:i}}),e}return r(t,n),t.prototype.__execute=function(){var n=this;if(!this.__isProcessing){this.__isProcessing=!0;for(var r=function(){var r,t=n.tasks.splice(0,n.payload);(r=n.__workersList).push.apply(r,t),0===n.tasks.length&&n.empty();var e=t.map(h);n.__workers++,n.__workers===n.concurrency&&n.saturated(),E((function(r){return n.__worker(e,r)}),(function(){for(var r=arguments.length,e=new Array(r),i=0;i<r;i++)e[i]=arguments[i];n.__workers--,t.forEach((function(r){var t=n.__workersList.indexOf(r);0===t?n.__workersList.shift():t>0&&n.__workersList.splice(t,1),r.callback.apply(r,e)})),n.__workers<=n.concurrency-n.buffer&&n.unsaturated(),n.idle()&&n.drain(),n.__execute()}))};!this.paused&&this.__workers<this.concurrency&&this.tasks.length;)r();this.__isProcessing=!1}},t}(U),J="undefined"!=typeof process&&process.nextTick?process.nextTick:"function"==typeof queueMicrotask?queueMicrotask:_,K=function(n){for(var r=arguments.length,t=new Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];var i=function(){for(var r=arguments.length,e=new Array(r),i=0;i<r;i++)e[i]=arguments[i];return n.apply(void 0,t.concat(e))};return i},N=function(){var n=arguments.length,r=parseInt(this);if(r!=r)throw new Error('Pass arguments to "safe.args" only through ".apply" method!');if(0===n||r>n)return[];for(var t=Array(n-r),e=r;e<n;e++)t[e-r]=e<0?null:e<0||arguments.length<=e?void 0:arguments[e];return t},X=function(){for(var n=arguments.length,r=new Array(n),t=0;t<n;t++)r[t]=arguments[t];return function(n){return n.apply(void 0,[null].concat(r))}},Y=function(n){return function(){for(var r=!0,t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var o=e[e.length-1];e[e.length-1]=function(){for(var n=this,t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];r?_((function(){return o.apply(n,e)})):o.apply(this,e)};var u=n.apply(this,e);return r=!1,u}},Z=function(n){return function(){for(var r=this,t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var o=e.pop();E((function(t){var i=n.apply(r,e);return p(n)||l(i)?i:t(null,i)}),o)}},$=function(n,r){n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:!1}})},nn=function(n,r){for(var t=arguments.length,e=new Array(t>2?t-2:0),i=2;i<t;i++)e[i-2]=arguments[i];var o=function(t){try{return n[r].apply(n,e.concat(t))}catch(n){if(!n)throw n;k(t,n)}};return o},rn=function(n,r,t){if(void 0===t&&(t=a),e(n)){var i=[];w(n,1/0,(function(n,t,e){E((function(t){return r(n,t)}),(function(r,o){i[t]={data:n,i:o},e(r)}))}),(function(n){t(n,i.sort((function(n,r){return n.i-r.i})).map(h))}))}else v(u[1],t)},tn=function(n,r){if(void 0===r&&(r=a),e(n)){var t=m(n);!function n(e){for(var i=arguments.length,o=new Array(i>1?i-1:0),u=1;u<i;u++)o[u-1]=arguments[u];if(e)r(e);else{var a=t.next();a.done?r.apply(void 0,[null].concat(o)):E((function(n){return a.value.apply(a,o.concat([n]))}),n)}}()}else v(u[1],r)},en=function(n,r){void 0===r&&(r=a),j(n,1,r)},on=function(n,r){void 0===r&&(r=a),j(n,1/0,r)},un=function(n,r,t){void 0===t&&(t=a),j(n,r,t)},an=function(n,r,t,e){void 0===e&&(e=a),R(n,r,t,e,1)},cn=function(n,r,t,e){void 0===e&&(e=a),R(n,r,t,e,0)},fn=function(n,r,t){void 0===t&&(t=a),e(n)?w(n,1/0,(function(n,t,e){E((function(t){return r(n,t)}),e)}),t):v(u[1],t)},sn=function(n,r,t,i){void 0===i&&(i=a),e(n)?w(n,r,(function(n,r,e){E((function(r){return t(n,r)}),e)}),i):v(u[1],i)},ln=function(n,r,t){void 0===t&&(t=a),e(n)?w(n,1,(function(n,t,e){E((function(t){return r(n,t)}),e)}),t):v(u[1],t)},hn=function(n,r,t){void 0===t&&(t=a),c(n)?w(n,1/0,(function(n,t,e){E((function(e){return r(n,t,e)}),e)}),t):v(u[0],t)},pn=function(n,r,t,e){void 0===e&&(e=a),c(n)?w(n,r,(function(n,r,e){E((function(e){return t(n,r,e)}),e)}),e):v(u[0],e)},vn=function(n,r,t){void 0===t&&(t=a),c(n)?w(n,1,(function(n,t,e){E((function(e){return r(n,t,e)}),e)}),t):v(u[0],t)},dn=function(n,r,t){void 0===t&&(t=a),S(n,1/0,r,t)},yn=function(n,r,t,e){void 0===e&&(e=a),S(n,r,t,e)},mn=function(n,r,t){void 0===t&&(t=a),S(n,1,r,t)},wn=function(n,r,t){void 0===t&&(t=a),L(n,1/0,r,t)},gn=function(n,r,t,e){void 0===e&&(e=a),L(n,r,t,e)},_n=function(n,r,t){void 0===t&&(t=a),L(n,1,r,t)},kn=function(n,r,t){void 0===t&&(t=a),I(n,1/0,r,t)},bn=function(n,r,t,e){void 0===e&&(e=a),I(n,r,t,e)},En=function(n,r,t){void 0===t&&(t=a),I(n,1,r,t)},Sn=function(n,r,t){void 0===t&&(t=a),A(n,1/0,r,t)},Ln=function(n,r,t,e){void 0===e&&(e=a),A(n,r,t,e)},An=function(n,r,t){void 0===t&&(t=a),A(n,1,r,t)},xn=function(n,r,t){void 0===t&&(t=a),x(!0,n,1/0,r,t)},On=function(n,r,t,e){void 0===e&&(e=a),x(!0,n,r,t,e)},jn=function(n,r,t){void 0===t&&(t=a),x(!0,n,1,r,t)},Tn=function(n,r,t){void 0===t&&(t=a),x(!1,n,1/0,r,t)},Pn=function(n,r,t,e){void 0===e&&(e=a),x(!1,n,r,t,e)},In=function(n,r,t){void 0===t&&(t=a),x(!1,n,1,r,t)},qn=function(n,r,t){void 0===t&&(t=a),O(!1,n,1/0,r,t)},zn=function(n,r,t,e){void 0===e&&(e=a),O(!1,n,r,t,e)},Bn=function(n,r,t){void 0===t&&(t=a),O(!1,n,1,r,t)},Vn=function(n,r,t){void 0===t&&(t=a),O(!0,n,1/0,r,t)},Mn=function(n,r,t,e){void 0===e&&(e=a),O(!0,n,r,t,e)},Cn=function(n,r,t){void 0===t&&(t=a),O(!0,n,1,r,t)},Fn=function(n,r,o){var u,a={},c=Object.create(null),f=t(n),l=f.length,h=0,p=null;if(s(r)&&(o=r,r=1/0),f.forEach((function(r){if(!p){var t=n[r];if(e(t))for(var o=t.slice(0,t.length-1),u=0;u<o.length;u++){var a=i.call(n,t[u])?n[t[u]]:null;if(!a){p=new Error("safe.auto task `"+r+"` has a non-existent dependency `"+t[u]+"` in "+o.join(", "));break}if(a===r||e(a)&&-1!==a.indexOf(r)){p=new Error("safe.auto cannot execute tasks due to a recursive dependency");break}}}})),p){if(s(o))return void o(p);throw new Error(p)}var v=d(o);!function t(){f.forEach((function(o){if(!(u||h>=r||c[o])){var f,s=n[o];if(e(s)){for(var p=s.length-1,d=0;d<p;d++)if(!i.call(a,s[d]))return;f=s[p]}else f=s;c[o]=!0,h++,E((function(n){return f(n,a)}),(function(n){if(l--,h--,!u)if(u=n||0===l,n)v(n,a);else{for(var r=arguments.length,e=new Array(r>1?r-1:0),i=1;i<r;i++)e[i-1]=arguments[i];e.length?a[o]=1===e.length?e[0]:e:a[o]=null,u?v(n,a):t()}}))}}))}()},Qn=function(n,r,t){void 0===t&&(t=a),Q(g(n),r,!1,!0,t)},Rn=function(n,r,t){void 0===t&&(t=a),Q(g(r),n,!1,!1,t)},Dn=function(n,r,t){void 0===t&&(t=a),Q(n,r,!1,!0,t)},Un=function(n,r,t){void 0===t&&(t=a),Q(r,n,!1,!1,t)},Wn=function(n,r,t){void 0===t&&(t=a),Q(g(n),r,!0,!0,t)},Gn=function(n,r,t){void 0===t&&(t=a),Q(g(r),n,!0,!1,t)},Hn=function(n,r){void 0===r&&(r=a);var t=y(r),e=Y(n);!function n(){e(B(t,n))}()},Jn=function(n,r){void 0===r&&(r=function(n){return n});var t={},e={},o=function(){for(var o=arguments.length,u=new Array(o),a=0;a<o;a++)u[a]=arguments[a];var c=u.pop(),f=r.apply(void 0,u);i.call(t,f)?_((function(){return c.apply(void 0,t[f])})):i.call(e,f)?e[f].push(c):(e[f]=[c],n.apply(void 0,u.concat([function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t[f]=r;var o=e[f];delete e[f],o.forEach((function(n){n.apply(void 0,r)}))}])))};return o.memo=t,o.unmemoized=n,o},Kn=function(n){return function(){return(n.unmemoized||n).apply(void 0,arguments)}},Nn=function(n,r,t){if(arguments.length<1||arguments.length>3)throw new Error("Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)");var e,i,o,u=0,f=function(){return u};s(n)?(t=r,r=n,i=5):c(n)?(i=parseInt(n.times)||5,s(n.interval)?f=n.interval:u=parseInt(n.interval)||u,n.errorFilter&&(o=n.errorFilter)):i=parseInt(i)||5;var l=function(n,u){var c=u;w(Array(i),1,(function(n,t,u){E((function(n){return r(n,c)}),(function(n,r){if(c={err:e=n||null,result:r},n&&t<i-1)if(o&&!o(n))u(!0);else{var a=f(t+1);a>0?setTimeout(u,a):u()}else u(!n)}))}),(function(){(n||t||a)(e,c)}))};return t?l():l},Xn=function(n,r,t,i){arguments.length<=3&&(i=t,t=r,r=e(n)?[]:{}),i=d(i),w(n,1/0,(function(n,e,i){E((function(i){return t(r,n,e,i)}),i)}),(function(n){return i(n,r)}))},Yn=function(n){return function(){for(var r=arguments.length,t=new Array(r),e=0;e<r;e++)t[e]=arguments[e];var i=t[t.length-1];t[t.length-1]=function(n){if(n)i(null,{error:n});else{for(var r,t=arguments.length,e=new Array(t>1?t-1:0),o=1;o<t;o++)e[o-1]=arguments[o];r=e.length?1===e.length?e[0]:e:null,i(null,{value:r})}};var o=n.apply(this,t);(p(n)||l(o))&&o.then((function(n){k(i,null,{value:n})}),(function(n){k(i,null,{error:n})}))}},Zn=function(n){if(e(n))return n.map(Yn);var r={};return t(n).forEach((function(t){r[t]=Yn(n[t])})),r},$n=function(n,r){if(e(n))if(n.length){var t=d(r);n.forEach((function(n){n(t)}))}else r();else v(u[0],r)},nr=function(n,r){if(void 0===r&&(r=a),c(n)){var t,e=null;w(n,1,(function(n,r,i){E(n,(function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),u=1;u<r;u++)o[u-1]=arguments[u];t=o.length<=1?o[0]:o,e=n,i(!n)}))}),(function(){r(e,t)}))}else v(u[0],r)},rr=function(n,r){return new G(n,r)},tr=function(n,r){return new W(n,r)},er=function(n,r){return new H(n,r)},ir=function(n,r,t){T(n,1/0,r,t)},or=function(n,r,t,e){T(n,r,t,e)},ur=function(n,r,t){T(n,1,r,t)},ar=function(n,r,t){P(n,1/0,r,t)},cr=function(n,r,t,e){P(n,r,t,e)},fr=function(n,r,t){P(n,1,r,t)},sr=D(1/0),lr=D(1),hr={noop:a,nextTick:J,back:k,setImmediate:k,yield:k,apply:K,async:nn,inherits:$,args:N,ensureAsync:Y,constant:X,result:q,sure_result:z,trap_sure_result:z,sure:B,trap_sure:B,sure_spread:C,spread:F,trap:V,wrap:M,run:E,each:fn,forEach:fn,eachLimit:sn,forEachLimit:sn,eachSeries:ln,forEachSeries:ln,eachOf:hn,forEachOf:hn,eachOfLimit:pn,forEachOfLimit:pn,eachOfSeries:vn,forEachOfSeries:vn,map:dn,mapLimit:yn,mapSeries:mn,groupBy:Sn,groupByLimit:Ln,groupBySeries:An,mapValues:wn,mapValuesLimit:gn,mapValuesSeries:_n,concat:kn,concatLimit:bn,concatSeries:En,sortBy:rn,filter:xn,select:xn,filterLimit:On,selectLimit:On,filterSeries:jn,selectSeries:jn,reject:Tn,rejectLimit:Pn,rejectSeries:In,waterfall:tn,series:en,parallel:on,parallelLimit:un,auto:Fn,whilst:Qn,doWhilst:Rn,during:Dn,doDuring:Un,until:Wn,doUntil:Gn,forever:Hn,reduce:an,inject:an,foldl:an,reduceRight:cn,foldr:cn,queue:rr,priorityQueue:tr,cargo:er,retry:Nn,retryable:Nn,times:ir,timesLimit:or,timesSeries:ur,detect:ar,detectLimit:cr,detectSeries:fr,some:qn,any:qn,someLimit:zn,anyLimit:zn,someSeries:Bn,anySeries:Bn,every:Vn,all:Vn,everyLimit:Mn,allLimit:Mn,everySeries:Cn,allSeries:Cn,applyEach:sr,applyEachSeries:lr,asyncify:Z,wrapSync:Z,memoize:Jn,unmemoize:Kn,transform:Xn,reflect:Yn,reflectAll:Zn,race:$n,tryEach:nr};n.default=hr,n.noop=a,n.nextTick=J,n.back=k,n.setImmediate=k,n.yield=k,n.apply=K,n.async=nn,n.inherits=$,n.args=N,n.ensureAsync=Y,n.constant=X,n.result=q,n.sure_result=z,n.trap_sure_result=z,n.sure=B,n.trap_sure=B,n.sure_spread=C,n.spread=F,n.trap=V,n.wrap=M,n.run=E,n.each=fn,n.forEach=fn,n.eachLimit=sn,n.forEachLimit=sn,n.eachSeries=ln,n.forEachSeries=ln,n.eachOf=hn,n.forEachOf=hn,n.eachOfLimit=pn,n.forEachOfLimit=pn,n.eachOfSeries=vn,n.forEachOfSeries=vn,n.map=dn,n.mapLimit=yn,n.mapSeries=mn,n.groupBy=Sn,n.groupByLimit=Ln,n.groupBySeries=An,n.mapValues=wn,n.mapValuesLimit=gn,n.mapValuesSeries=_n,n.concat=kn,n.concatLimit=bn,n.concatSeries=En,n.sortBy=rn,n.filter=xn,n.select=xn,n.filterLimit=On,n.selectLimit=On,n.filterSeries=jn,n.selectSeries=jn,n.reject=Tn,n.rejectLimit=Pn,n.rejectSeries=In,n.waterfall=tn,n.series=en,n.parallel=on,n.parallelLimit=un,n.auto=Fn,n.whilst=Qn,n.doWhilst=Rn,n.during=Dn,n.doDuring=Un,n.until=Wn,n.doUntil=Gn,n.forever=Hn,n.reduce=an,n.inject=an,n.foldl=an,n.reduceRight=cn,n.foldr=cn,n.queue=rr,n.priorityQueue=tr,n.cargo=er,n.retry=Nn,n.retryable=Nn,n.times=ir,n.timesLimit=or,n.timesSeries=ur,n.detect=ar,n.detectLimit=cr,n.detectSeries=fr,n.some=qn,n.any=qn,n.someLimit=zn,n.anyLimit=zn,n.someSeries=Bn,n.anySeries=Bn,n.every=Vn,n.all=Vn,n.everyLimit=Mn,n.allLimit=Mn,n.everySeries=Cn,n.allSeries=Cn,n.applyEach=sr,n.applyEachSeries=lr,n.asyncify=Z,n.wrapSync=Z,n.memoize=Jn,n.unmemoize=Kn,n.transform=Xn,n.reflect=Yn,n.reflectAll=Zn,n.race=$n,n.tryEach=nr,Object.defineProperty(n,"__esModule",{value:!0})}));
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(n.safe={})}(this,(function(n){"use strict";function r(n,r){n.prototype=Object.create(r.prototype),n.prototype.constructor=n,t(n,r)}function t(n,r){return t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},t(n,r)}var e="undefined",i="function",o=Object.keys,u=Array.isArray,a=1/0,c=Object.prototype.hasOwnProperty,f="Callback was already called.",s=["Array or Object are required","Array is required","Exactly two arguments are required","Function is required"],l=function(){},h=function(n){if(null===n)return!1;var r=typeof n;return"object"===r||r===i},p=function(n){return typeof n===e},v=function(n){return typeof n===i},y=function(n){return n&&v(n.then)},d=function(n){if(n)return n.data},m=function(n){return n&&n.constructor&&"AsyncFunction"===n.constructor.name},w=function(n,r){var t=new TypeError(n);if(!v(r)||r===l)throw t;r(t)},g=function(n){var r=!1;return function(){if(!r&&null!=n)return r=!0,n.apply(void 0,arguments)}},_=function(n){var r=!1;return function(){if(r)throw new Error(f);return r=!0,n.apply(void 0,arguments)}},k=function(n){return u(n)?(r=n,t=-1,{next:function(){return++t<r.length?{value:r[t],key:t,done:!1}:{done:!0}}}):n[typeof Symbol===i&&Symbol.iterator]?function(n){var r=-1,t=n[Symbol.iterator]();return{next:function(){r++;var n=t.next();return n.done?{done:!0}:{value:n.value,key:r,done:!1}}}}(n):function(n){var r=o(n),t=r.length,e=-1;return{next:function(){e++;var i=r[e];return e<t?{value:n[i],key:i,done:!1}:{done:!0}}}}(n);var r,t},b=function(n,r,t,e){var i=0,o=!1,u=k(n),a=!1,c=g(e);!function n(){if(!o&&!a)for(;i<r&&!1===a;){var e=u.next();if(e.done){o=!0,i<=0&&c();break}i++,t(e.value,e.key,(function(t){i--,t?(a=!0,c(t)):!1===o&&i<r?n():o&&i<=0&&c()}))}}()},E=function(n){return function(r){return r(null,n())}},S=typeof setImmediate===i?setImmediate:typeof queueMicrotask===i?function(n){for(var r=arguments.length,t=new Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];queueMicrotask((function(){n.apply(void 0,t)}))}:typeof process===e?typeof Image===i?function(n){for(var r=arguments.length,t=new Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];var i=new Image;i.onerror=function(){n.apply(void 0,t)},i.src="data:image/png,0"}:function(n){for(var r=arguments.length,t=new Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];setTimeout.apply(void 0,[n,0].concat(t))}:function(n){for(var r=arguments.length,t=new Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];process.nextTick((function(){n.apply(void 0,t)}))},L=function(){if(!v(arguments.length<=0?void 0:arguments[0]))throw new TypeError(s[3]);S.apply(void 0,arguments)},A=function(n,r){n.then((function(n){L(r,null,n)}),(function(n){L(r,n)}))},O=function(n,r){if(m(n))A(n(),r);else{var t,e,i=!1;try{e=n(o)}catch(n){if(!n)throw n;S(o,n)}if(y(e)){if(t="Resolution method is overspecified. Call a callback *or* return a Promise.",i)throw new Error(t);A(e,o)}}function o(){if(i)throw(arguments.length<=0?void 0:arguments[0])||new Error(t||f);i=!0,r.apply(void 0,arguments)}},x=function(n,r,t,e){if(!h(n))return w(s[0],e);var i=[],o=0;b(n,r,(function(n,r,e){var u=o++;O((function(r){return t(n,r)}),(function(n,r){i[u]=r,e(n)}))}),(function(n){e(n,i)}))},j=function(n,r,t,e){if(!h(n))return w(s[0],e);var i={};b(n,r,(function(n,r,e){O((function(e){return t(n,r,e)}),(function(n,t){i[r]=t,e(n)}))}),(function(n){e(n,i)}))},T=function(n,r,t,e){if(!h(n))return w(s[0],e);x(n,r,(function(n,r){O((function(r){return t(n,r)}),(function(t,e){if(t)return r(t);r(t,{key:e,val:n})}))}),(function(n,r){var t={};r.forEach((function(n){c.call(t,n.key)?t[n.key].push(n.val):t[n.key]=[n.val]})),e(n,t)}))},P=function(n,r,t,e,i){if(!u(r))return w(s[1],i);var o=[];b(r,t,(function(r,t,i){O((function(n){return e(r,n)}),(function(e,u){(n&&u||!n&&!u)&&o.push({data:r,i:t}),i(e)}))}),(function(n){i(n,o.sort((function(n,r){return n.i-r.i})).map(d))}))},I=function(n,r,t,e,i){var o=n;b(r,t,(function(r,t,i){O((function(n){return e(r,n)}),(function(r){n?(r||(o=!1),i(!r)):(r&&(o=!0),i(o))}))}),(function(){return i(o)}))},q=function(n,r,t){var e=u(n)?[]:{};b(n,r,(function(n,r,t){O(n,(function(n){for(var i=arguments.length,o=new Array(i>1?i-1:0),u=1;u<i;u++)o[u-1]=arguments[u];o.length?e[r]=1===o.length?o[0]:o:e[r]=null,t(n)}))}),(function(n){t(n,e)}))},z=function(n,r,t,e){for(var i=parseInt(n),o=Array(i),u=0;u<i;u++)o[u]=u;x(o,r,t,e)},B=function(n,r,t,e){var i;b(n,r,(function(n,r,e){O((function(r){return t(n,r)}),(function(r){r&&(i=n),e(i||null)}))}),(function(){return e(i)}))},V=function(n,r,t,e){if(!u(n))return w(s[1],e);x(n,r,t,(function(n,r){var t;e(n,(t=[]).concat.apply(t,r))}))},M=function(n,r){if(!v(r)||!v(n))throw new TypeError(s[2]);return function(){var t;try{for(var e=arguments.length,i=new Array(e),o=0;o<e;o++)i[o]=arguments[o];t=r.apply(this,i)}catch(r){if(!r)throw r;return void n(r)}p(t)?L(n,null):L(n,null,t)}},C=function(n,r){if(!v(r)||!v(n))throw new TypeError(s[2]);return function(t){if(t)n(t);else{var e;try{for(var i=arguments.length,o=new Array(i>1?i-1:0),u=1;u<i;u++)o[u-1]=arguments[u];e=r.apply(this,o)}catch(r){if(!r)throw r;return void L(n,r)}p(e)?L(n,null):L(n,null,e)}}},F=function(n,r){if(p(r)||!v(n))throw new TypeError(s[2]);return function(t){if(t)n(t);else if(v(r))try{for(var e=arguments.length,i=new Array(e>1?e-1:0),o=1;o<e;o++)i[o-1]=arguments[o];return r.apply(this,i)}catch(r){if(!r)throw r;L(n,r)}else L(n,null,r)}},Q=function(n,r){if(p(n))throw new TypeError(s[2]);return function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];p(r)&&(r=n,n=e[e.length-1]);try{return r.apply(this,e)}catch(r){if(!r)throw r;L(n,r)}}},R=function(n,r){if(!v(n)||!v(r))throw new TypeError(s[2]);return function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];e.push(r);try{return n.apply(this,e)}catch(n){if(!n)throw n;L(r,n)}}},D=function(n,r){if(p(r)||!v(n))throw new TypeError(s[2]);return function(t){if(t)n(t);else try{return r.apply(this,arguments.length<=1?void 0:arguments[1])}catch(r){if(!r)throw r;L(n,r)}}},U=function(n){return function(r){return n.apply(this,r)}},W=function(n,r,t,e,i){function o(){O(r,F(i,u))}function u(r){O(n,F(i,(function(n){n==t?i(null,r):o()})))}e?u():o()},G=function(n,r,t,e,i){if(void 0===e&&(e=l),!u(n))return w(s[1],e);var o=k(n),a=n.length;!function r(u,c){if(u)e(u);else{var f=o.next();f.done?e(null,c):O((function(r){return t(c,i?f.value:n[a-1-f.key],r)}),r)}}(null,r)},H=function(n){return function(r){for(var t=function(){for(var t=this,e=arguments.length,i=new Array(e),o=0;o<e;o++)i[o]=arguments[o];var u=i.pop();b(r,n,(function(n,r,e){O((function(r){return n.apply(t,i.concat(r))}),e)}),u)},e=arguments.length,i=new Array(e>1?e-1:0),o=1;o<e;o++)i[o-1]=arguments[o];return 0===i.length?t:t.apply(this,i)}},J=function(){function n(n,r){var t=parseInt(r);if(!t)throw new TypeError("Concurrency must not be zero");Object.defineProperties(this,{__worker:{enumerable:!1,configurable:!1,writable:!1,value:n},__workers:{enumerable:!1,configurable:!1,writable:!0,value:0},__workersList:{enumerable:!1,configurable:!1,writable:!0,value:[]},__isProcessing:{enumerable:!1,configurable:!1,writable:!0,value:!1},__processingScheduled:{enumerable:!1,configurable:!1,writable:!0,value:!1},tasks:{enumerable:!1,configurable:!1,writable:!1,value:[]},concurrency:{enumerable:!0,configurable:!1,writable:!0,value:t},buffer:{enumerable:!0,configurable:!1,writable:!0,value:t/4},started:{enumerable:!0,configurable:!1,writable:!0,value:!1},paused:{enumerable:!0,configurable:!1,writable:!0,value:!1}})}var r=n.prototype;return r.__insert=function(n,r,t){var e=this;if(null!=t&&!v(t))throw new TypeError(s[3]);this.started=!0;var i=u(n)?n:[n];if(0===i.length&&this.idle())return S((function(){e.drain()}));var o,a,c=i.map((function(n){return{data:n,callback:_(t||l)}}));r?(o=this.tasks).unshift.apply(o,c):(a=this.tasks).push.apply(a,c);this.__processingScheduled||(this.__processingScheduled=!0,S((function(){e.__processingScheduled=!1,e.__execute()})))},r.__execute=function(){var n=this;if(!this.__isProcessing){this.__isProcessing=!0;for(var r=function(){var r=n.tasks.shift();n.__workersList.push(r),0===n.tasks.length&&n.empty();var t=r.data;n.__workers++,n.__workers===n.concurrency&&n.saturated(),O((function(r){return n.__worker(t,r)}),(function(){n.__workers--;var e=n.__workersList.indexOf(r);0===e?n.__workersList.shift():e>0&&n.__workersList.splice(e,1),r.callback.apply(r,arguments),(arguments.length<=0?void 0:arguments[0])&&n.error(arguments.length<=0?void 0:arguments[0],t),n.__workers<=n.concurrency-n.buffer&&n.unsaturated(),n.idle()&&n.drain(),n.__execute()}))};!this.paused&&this.__workers<this.concurrency&&this.tasks.length;)r();this.__isProcessing=!1}},r.remove=function(n){var r=this,t=this.tasks.filter((function(r){return!n(r.data)}));this.tasks.length=t.length,t.forEach((function(n,t){r.tasks[t]=n}))},r.push=function(n,r){this.__insert(n,!1,r)},r.saturated=function(){},r.unsaturated=function(){},r.empty=function(){},r.drain=function(){},r.error=function(){},r.kill=function(){delete this.drain,this.tasks.length=0},r.length=function(){return this.tasks.length},r.running=function(){return this.__workers},r.idle=function(){return this.tasks.length+this.__workers===0},r.pause=function(){this.paused=!0},r.resume=function(){var n=this;this.paused&&(this.paused=!1,S((function(){return n.__execute()})))},r.workersList=function(){return this.__workersList},n}(),K=function(n){function t(r,t){return n.call(this,r,t,"Priority Queue")||this}r(t,n);var e=t.prototype;return e.push=function(n,r,t){this.__insert(n,r||0,t)},e.__insert=function(n,r,t){var e=this;if(null!=t&&!v(t))throw new TypeError(s[3]);this.started=!0;var i=u(n)?n:[n];if(0===i.length&&this.idle())return S((function(){e.drain()}));var o,a,c=i.map((function(n){return{data:n,priority:r,callback:_(t||l)}})),f=this.tasks.length,h=f?this.tasks[0].priority:0,p=f?this.tasks[f-1].priority:0;r>h?(o=this.tasks).unshift.apply(o,c):(a=this.tasks).push.apply(a,c);h>=r&&r<p&&this.tasks.sort((function(n,r){return r.priority-n.priority})),this.__processingScheduled||(this.__processingScheduled=!0,S((function(){e.__processingScheduled=!1,e.__execute()})))},t}(J),N=function(n){function t(r,t){return n.call(this,r,t,"Queue")||this}return r(t,n),t.prototype.unshift=function(n,r){this.__insert(n,!0,r)},t}(J),X=function(n){function t(r,t){var e;e=n.call(this,r,1,"Cargo")||this;var i=parseInt(t);if(!i)throw new TypeError("Payload must not be zero");return Object.defineProperties(function(n){if(void 0===n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}(e),{payload:{enumerable:!0,configurable:!1,writable:!0,value:i}}),e}return r(t,n),t.prototype.__execute=function(){var n=this;if(!this.__isProcessing){this.__isProcessing=!0;for(var r=function(){var r,t=n.tasks.splice(0,n.payload);(r=n.__workersList).push.apply(r,t),0===n.tasks.length&&n.empty();var e=t.map(d);n.__workers++,n.__workers===n.concurrency&&n.saturated(),O((function(r){return n.__worker(e,r)}),(function(){for(var r=arguments.length,e=new Array(r),i=0;i<r;i++)e[i]=arguments[i];n.__workers--,t.forEach((function(r){var t=n.__workersList.indexOf(r);0===t?n.__workersList.shift():t>0&&n.__workersList.splice(t,1),r.callback.apply(r,e)})),n.__workers<=n.concurrency-n.buffer&&n.unsaturated(),n.idle()&&n.drain(),n.__execute()}))};!this.paused&&this.__workers<this.concurrency&&this.tasks.length;)r();this.__isProcessing=!1}},t}(J),Y=typeof process!==e&&process.nextTick?process.nextTick:typeof queueMicrotask===i?queueMicrotask:S,Z=function(n){for(var r=arguments.length,t=new Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];return function(){for(var r=arguments.length,e=new Array(r),i=0;i<r;i++)e[i]=arguments[i];return n.apply(void 0,t.concat(e))}},$=function(){var n=arguments.length,r=parseInt(this);if(r!=r)throw new Error('Pass arguments to "safe.args" only through ".apply" method!');if(0===n||r>n)return[];for(var t=Array(n-r),e=r;e<n;e++)t[e-r]=e<0?null:e<0||arguments.length<=e?void 0:arguments[e];return t},nn=function(){for(var n=arguments.length,r=new Array(n),t=0;t<n;t++)r[t]=arguments[t];return function(n){return n.apply(void 0,[null].concat(r))}},rn=function(n){return function(){for(var r=!0,t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var o=e[e.length-1];e[e.length-1]=function(){for(var n=this,t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];r?S((function(){return o.apply(n,e)})):o.apply(this,e)};var u=n.apply(this,e);return r=!1,u}},tn=function(n){return function(){for(var r=this,t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var o=e.pop();O((function(t){var i=n.apply(r,e);return m(n)||y(i)?i:t(null,i)}),o)}},en=function(n,r){n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:!1}})},on=function(n,r){for(var t=arguments.length,e=new Array(t>2?t-2:0),i=2;i<t;i++)e[i-2]=arguments[i];return function(t){try{return n[r].apply(n,e.concat(t))}catch(n){if(!n)throw n;L(t,n)}}},un=function(n,r,t){if(void 0===t&&(t=l),u(n)){var e=[];b(n,a,(function(n,t,i){O((function(t){return r(n,t)}),(function(r,o){e[t]={data:n,i:o},i(r)}))}),(function(n){t(n,e.sort((function(n,r){return n.i-r.i})).map(d))}))}else w(s[1],t)},an=function(n,r){if(void 0===r&&(r=l),u(n)){var t=k(n);!function n(e){for(var i=arguments.length,o=new Array(i>1?i-1:0),u=1;u<i;u++)o[u-1]=arguments[u];if(e)r(e);else{var a=t.next();a.done?r.apply(void 0,[null].concat(o)):O((function(n){return a.value.apply(a,o.concat([n]))}),n)}}()}else w(s[1],r)},cn=function(n,r){void 0===r&&(r=l),q(n,1,r)},fn=function(n,r){void 0===r&&(r=l),q(n,a,r)},sn=function(n,r,t){void 0===t&&(t=l),q(n,r,t)},ln=function(n,r,t,e){void 0===e&&(e=l),G(n,r,t,e,1)},hn=function(n,r,t,e){void 0===e&&(e=l),G(n,r,t,e,0)},pn=function(n,r,t){void 0===t&&(t=l),u(n)?b(n,a,(function(n,t,e){O((function(t){return r(n,t)}),e)}),t):w(s[1],t)},vn=function(n,r,t,e){void 0===e&&(e=l),u(n)?b(n,r,(function(n,r,e){O((function(r){return t(n,r)}),e)}),e):w(s[1],e)},yn=function(n,r,t){void 0===t&&(t=l),u(n)?b(n,1,(function(n,t,e){O((function(t){return r(n,t)}),e)}),t):w(s[1],t)},dn=function(n,r,t){void 0===t&&(t=l),h(n)?b(n,a,(function(n,t,e){O((function(e){return r(n,t,e)}),e)}),t):w(s[0],t)},mn=function(n,r,t,e){void 0===e&&(e=l),h(n)?b(n,r,(function(n,r,e){O((function(e){return t(n,r,e)}),e)}),e):w(s[0],e)},wn=function(n,r,t){void 0===t&&(t=l),h(n)?b(n,1,(function(n,t,e){O((function(e){return r(n,t,e)}),e)}),t):w(s[0],t)},gn=function(n,r,t){void 0===t&&(t=l),x(n,a,r,t)},_n=function(n,r,t,e){void 0===e&&(e=l),x(n,r,t,e)},kn=function(n,r,t){void 0===t&&(t=l),x(n,1,r,t)},bn=function(n,r,t){void 0===t&&(t=l),j(n,a,r,t)},En=function(n,r,t,e){void 0===e&&(e=l),j(n,r,t,e)},Sn=function(n,r,t){void 0===t&&(t=l),j(n,1,r,t)},Ln=function(n,r,t){void 0===t&&(t=l),V(n,a,r,t)},An=function(n,r,t,e){void 0===e&&(e=l),V(n,r,t,e)},On=function(n,r,t){void 0===t&&(t=l),V(n,1,r,t)},xn=function(n,r,t){void 0===t&&(t=l),T(n,a,r,t)},jn=function(n,r,t,e){void 0===e&&(e=l),T(n,r,t,e)},Tn=function(n,r,t){void 0===t&&(t=l),T(n,1,r,t)},Pn=function(n,r,t){void 0===t&&(t=l),P(!0,n,a,r,t)},In=function(n,r,t,e){void 0===e&&(e=l),P(!0,n,r,t,e)},qn=function(n,r,t){void 0===t&&(t=l),P(!0,n,1,r,t)},zn=function(n,r,t){void 0===t&&(t=l),P(!1,n,a,r,t)},Bn=function(n,r,t,e){void 0===e&&(e=l),P(!1,n,r,t,e)},Vn=function(n,r,t){void 0===t&&(t=l),P(!1,n,1,r,t)},Mn=function(n,r,t){void 0===t&&(t=l),I(!1,n,a,r,t)},Cn=function(n,r,t,e){void 0===e&&(e=l),I(!1,n,r,t,e)},Fn=function(n,r,t){void 0===t&&(t=l),I(!1,n,1,r,t)},Qn=function(n,r,t){void 0===t&&(t=l),I(!0,n,a,r,t)},Rn=function(n,r,t,e){void 0===e&&(e=l),I(!0,n,r,t,e)},Dn=function(n,r,t){void 0===t&&(t=l),I(!0,n,1,r,t)},Un=function(n,r,t){var e,i={},f=Object.create(null),s=o(n),l=s.length,h=0,p=null;if(v(r)&&(t=r,r=a),s.forEach((function(r){if(!p){var t=n[r];if(u(t))for(var e=t.slice(0,t.length-1),i=0;i<e.length;i++){var o=c.call(n,t[i])?n[t[i]]:null;if(!o){p=new Error("safe.auto task `"+r+"` has a non-existent dependency `"+t[i]+"` in "+e.join(", "));break}if(o===r||u(o)&&-1!==o.indexOf(r)){p=new Error("safe.auto cannot execute tasks due to a recursive dependency");break}}}})),p){if(v(t))return void t(p);throw new Error(p)}var y=g(t);!function t(){s.forEach((function(o){if(!(e||h>=r||f[o])){var a,s=n[o];if(u(s)){for(var p=s.length-1,v=0;v<p;v++)if(!c.call(i,s[v]))return;a=s[p]}else a=s;f[o]=!0,h++,O((function(n){return a(n,i)}),(function(n){if(l--,h--,!e)if(e=n||0===l,n)y(n,i);else{for(var r=arguments.length,u=new Array(r>1?r-1:0),a=1;a<r;a++)u[a-1]=arguments[a];u.length?i[o]=1===u.length?u[0]:u:i[o]=null,e?y(n,i):t()}}))}}))}()},Wn=function(n,r,t){void 0===t&&(t=l),W(E(n),r,!1,!0,t)},Gn=function(n,r,t){void 0===t&&(t=l),W(E(r),n,!1,!1,t)},Hn=function(n,r,t){void 0===t&&(t=l),W(n,r,!1,!0,t)},Jn=function(n,r,t){void 0===t&&(t=l),W(r,n,!1,!1,t)},Kn=function(n,r,t){void 0===t&&(t=l),W(E(n),r,!0,!0,t)},Nn=function(n,r,t){void 0===t&&(t=l),W(E(r),n,!0,!1,t)},Xn=function(n,r){void 0===r&&(r=l);var t=_(r),e=rn(n);!function n(){e(F(t,n))}()},Yn=function(n,r){void 0===r&&(r=function(n){return n});var t={},e={},i=function(){for(var i=arguments.length,o=new Array(i),u=0;u<i;u++)o[u]=arguments[u];var a=o.pop(),f=r.apply(void 0,o);c.call(t,f)?S((function(){return a.apply(void 0,t[f])})):c.call(e,f)?e[f].push(a):(e[f]=[a],n.apply(void 0,o.concat([function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t[f]=r;var o=e[f];delete e[f],o.forEach((function(n){n.apply(void 0,r)}))}])))};return i.memo=t,i.unmemoized=n,i},Zn=function(n){return function(){return(n.unmemoized||n).apply(void 0,arguments)}},$n=function(n,r,t){if(arguments.length<1||arguments.length>3)throw new Error("Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)");var e,i,o,u=0,a=function(){return u};v(n)?(t=r,r=n,i=5):h(n)?(i=parseInt(n.times)||5,v(n.interval)?a=n.interval:u=parseInt(n.interval)||u,n.errorFilter&&(o=n.errorFilter)):i=parseInt(i)||5;var c=function(n,u){var c=u;b(Array(i),1,(function(n,t,u){O((function(n){return r(n,c)}),(function(n,r){if(c={err:e=n||null,result:r},n&&t<i-1)if(o&&!o(n))u(!0);else{var f=a(t+1);f>0?setTimeout(u,f):u()}else u(!n)}))}),(function(){(n||t||l)(e,c)}))};return t?c():c},nr=function(n,r,t,e){arguments.length<=3&&(e=t,t=r,r=u(n)?[]:{}),e=g(e),b(n,a,(function(n,e,i){O((function(i){return t(r,n,e,i)}),i)}),(function(n){return e(n,r)}))},rr=function(n){return function(){for(var r=arguments.length,t=new Array(r),e=0;e<r;e++)t[e]=arguments[e];var i=t[t.length-1];t[t.length-1]=function(n){if(n)i(null,{error:n});else{for(var r,t=arguments.length,e=new Array(t>1?t-1:0),o=1;o<t;o++)e[o-1]=arguments[o];r=e.length?1===e.length?e[0]:e:null,i(null,{value:r})}};var o=n.apply(this,t);(m(n)||y(o))&&o.then((function(n){L(i,null,{value:n})}),(function(n){L(i,null,{error:n})}))}},tr=function(n){if(u(n))return n.map(rr);var r={};return o(n).forEach((function(t){r[t]=rr(n[t])})),r},er=function(n,r){if(u(n))if(n.length){var t=g(r);n.forEach((function(n){n(t)}))}else r();else w(s[0],r)},ir=function(n,r){if(void 0===r&&(r=l),h(n)){var t,e=null;b(n,1,(function(n,r,i){O(n,(function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),u=1;u<r;u++)o[u-1]=arguments[u];t=o.length<=1?o[0]:o,e=n,i(!n)}))}),(function(){r(e,t)}))}else w(s[0],r)},or=function(n,r){return new N(n,r)},ur=function(n,r){return new K(n,r)},ar=function(n,r){return new X(n,r)},cr=function(n,r,t){z(n,a,r,t)},fr=function(n,r,t,e){z(n,r,t,e)},sr=function(n,r,t){z(n,1,r,t)},lr=function(n,r,t){B(n,a,r,t)},hr=function(n,r,t,e){B(n,r,t,e)},pr=function(n,r,t){B(n,1,r,t)},vr=H(a),yr=H(1),dr={noop:l,nextTick:Y,back:L,setImmediate:L,yield:L,apply:Z,async:on,inherits:en,args:$,ensureAsync:rn,constant:nn,result:M,sure_result:C,trap_sure_result:C,sure:F,trap_sure:F,sure_spread:D,spread:U,trap:Q,wrap:R,run:O,each:pn,forEach:pn,eachLimit:vn,forEachLimit:vn,eachSeries:yn,forEachSeries:yn,eachOf:dn,forEachOf:dn,eachOfLimit:mn,forEachOfLimit:mn,eachOfSeries:wn,forEachOfSeries:wn,map:gn,mapLimit:_n,mapSeries:kn,groupBy:xn,groupByLimit:jn,groupBySeries:Tn,mapValues:bn,mapValuesLimit:En,mapValuesSeries:Sn,concat:Ln,concatLimit:An,concatSeries:On,sortBy:un,filter:Pn,select:Pn,filterLimit:In,selectLimit:In,filterSeries:qn,selectSeries:qn,reject:zn,rejectLimit:Bn,rejectSeries:Vn,waterfall:an,series:cn,parallel:fn,parallelLimit:sn,auto:Un,whilst:Wn,doWhilst:Gn,during:Hn,doDuring:Jn,until:Kn,doUntil:Nn,forever:Xn,reduce:ln,inject:ln,foldl:ln,reduceRight:hn,foldr:hn,queue:or,priorityQueue:ur,cargo:ar,retry:$n,retryable:$n,times:cr,timesLimit:fr,timesSeries:sr,detect:lr,detectLimit:hr,detectSeries:pr,some:Mn,any:Mn,someLimit:Cn,anyLimit:Cn,someSeries:Fn,anySeries:Fn,every:Qn,all:Qn,everyLimit:Rn,allLimit:Rn,everySeries:Dn,allSeries:Dn,applyEach:vr,applyEachSeries:yr,asyncify:tn,wrapSync:tn,memoize:Yn,unmemoize:Zn,transform:nr,reflect:rr,reflectAll:tr,race:er,tryEach:ir};n.default=dr,n.noop=l,n.nextTick=Y,n.back=L,n.setImmediate=L,n.yield=L,n.apply=Z,n.async=on,n.inherits=en,n.args=$,n.ensureAsync=rn,n.constant=nn,n.result=M,n.sure_result=C,n.trap_sure_result=C,n.sure=F,n.trap_sure=F,n.sure_spread=D,n.spread=U,n.trap=Q,n.wrap=R,n.run=O,n.each=pn,n.forEach=pn,n.eachLimit=vn,n.forEachLimit=vn,n.eachSeries=yn,n.forEachSeries=yn,n.eachOf=dn,n.forEachOf=dn,n.eachOfLimit=mn,n.forEachOfLimit=mn,n.eachOfSeries=wn,n.forEachOfSeries=wn,n.map=gn,n.mapLimit=_n,n.mapSeries=kn,n.groupBy=xn,n.groupByLimit=jn,n.groupBySeries=Tn,n.mapValues=bn,n.mapValuesLimit=En,n.mapValuesSeries=Sn,n.concat=Ln,n.concatLimit=An,n.concatSeries=On,n.sortBy=un,n.filter=Pn,n.select=Pn,n.filterLimit=In,n.selectLimit=In,n.filterSeries=qn,n.selectSeries=qn,n.reject=zn,n.rejectLimit=Bn,n.rejectSeries=Vn,n.waterfall=an,n.series=cn,n.parallel=fn,n.parallelLimit=sn,n.auto=Un,n.whilst=Wn,n.doWhilst=Gn,n.during=Hn,n.doDuring=Jn,n.until=Kn,n.doUntil=Nn,n.forever=Xn,n.reduce=ln,n.inject=ln,n.foldl=ln,n.reduceRight=hn,n.foldr=hn,n.queue=or,n.priorityQueue=ur,n.cargo=ar,n.retry=$n,n.retryable=$n,n.times=cr,n.timesLimit=fr,n.timesSeries=sr,n.detect=lr,n.detectLimit=hr,n.detectSeries=pr,n.some=Mn,n.any=Mn,n.someLimit=Cn,n.anyLimit=Cn,n.someSeries=Fn,n.anySeries=Fn,n.every=Qn,n.all=Qn,n.everyLimit=Rn,n.allLimit=Rn,n.everySeries=Dn,n.allSeries=Dn,n.applyEach=vr,n.applyEachSeries=yr,n.asyncify=tn,n.wrapSync=tn,n.memoize=Yn,n.unmemoize=Zn,n.transform=nr,n.reflect=rr,n.reflectAll=tr,n.race=er,n.tryEach=ir,Object.defineProperty(n,"__esModule",{value:!0})}));

@@ -5,3 +5,3 @@ /*!

*
* Copyright 2012-2021 PushOk Software
* Copyright 2012-2023 PushOk Software
* Licensed under MIT

@@ -220,2 +220,6 @@ */

const _back = (() => {
if (typeof setImmediate === FUNCTION) {
return setImmediate;
}
if (typeof queueMicrotask === FUNCTION) {

@@ -229,6 +233,2 @@ return (callback, ...args) => {

if (typeof setImmediate === FUNCTION) {
return setImmediate;
}
if (typeof process === UNDEFINED) {

@@ -235,0 +235,0 @@ if (typeof Image === FUNCTION) { // browser polyfill

@@ -5,5 +5,5 @@ /*!

*
* Copyright 2012-2021 PushOk Software
* Copyright 2012-2023 PushOk Software
* Licensed under MIT
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.safe={})}(this,(function(e){"use strict";const t=Object.keys,r=Array.isArray,i=Object.prototype.hasOwnProperty,s=["Array or Object are required","Array is required","Exactly two arguments are required","Function is required"],n=()=>{},o=e=>{if(null===e)return!1;const t=typeof e;return"object"===t||"function"===t},a=e=>void 0===e,l=e=>"function"==typeof e,c=e=>e&&l(e.then),u=e=>{if(e)return e.data},h=e=>e&&e.constructor&&"AsyncFunction"===e.constructor.name,f=(e,t)=>{const r=new TypeError(e);if(!l(t)||t===n)throw r;t(r)},p=e=>{let t=!1;return(...r)=>{if(!t&&null!=e)return t=!0,e(...r)}},d=e=>{let t=!1;return(...r)=>{if(t)throw new Error("Callback was already called.");return t=!0,e(...r)}},y=e=>r(e)?(e=>{let t=-1;return{next:()=>(t++,t<e.length?{value:e[t],key:t,done:!1}:{done:!0})}})(e):e["function"==typeof Symbol&&Symbol.iterator]?(e=>{let t=-1;const r=e[Symbol.iterator]();return{next:()=>{t++;const e=r.next();return e.done?{done:!0}:{value:e.value,key:t,done:!1}}}})(e):(e=>{const r=t(e),i=r.length;let s=-1;return{next:()=>{s++;const t=r[s];return s<i?{value:e[t],key:t,done:!1}:{done:!0}}}})(e),m=(e,t,r,i)=>{let s=0,n=!1,o=y(e),a=!1;const l=p(i);!function e(){if(!n&&!a)for(;s<t&&!1===a;){let i=o.next();if(i.done){n=!0,s<=0&&l();break}s++,r(i.value,i.key,r=>{s--,r?(a=!0,l(r)):!1===n&&s<t?e():n&&s<=0&&l()})}}()},_=e=>t=>t(null,e()),w="function"==typeof queueMicrotask?(e,...t)=>{queueMicrotask(()=>{e(...t)})}:"function"==typeof setImmediate?setImmediate:"undefined"==typeof process?"function"==typeof Image?(e,...t)=>{const r=new Image;r.onerror=()=>{e(...t)},r.src="data:image/png,0"}:(e,...t)=>{setTimeout(e,0,...t)}:(e,...t)=>{process.nextTick(()=>{e(...t)})},g=(...e)=>{if(!l(e[0]))throw new TypeError(s[3]);w(...e)},k=(e,t)=>{e.then(e=>{g(t,null,e)},e=>{g(t,e)})},b=(e,t)=>{if(h(e))return void k(e(),t);let r,i,s=!1;try{i=e(n)}catch(e){if(!e)throw e;w(n,e)}if(c(i)){if(r="Resolution method is overspecified. Call a callback *or* return a Promise.",s)throw new Error(r);k(i,n)}function n(...e){if(s)throw e[0]||new Error(r||"Callback was already called.");s=!0,t(...e)}},v=(e,t,r,i)=>{if(!o(e))return f(s[0],i);const n=[];let a=0;m(e,t,(e,t,i)=>{const s=a++;b(t=>r(e,t),(e,t)=>{n[s]=t,i(e)})},e=>{i(e,n)})},S=(e,t,r,i)=>{if(!o(e))return f(s[0],i);const n={};m(e,t,(e,t,i)=>{b(i=>r(e,t,i),(e,r)=>{n[t]=r,i(e)})},e=>{i(e,n)})},E=(e,t,r,n)=>{if(!o(e))return f(s[0],n);v(e,t,(e,t)=>{b(t=>r(e,t),(r,i)=>{if(r)return t(r);t(r,{key:i,val:e})})},(e,t)=>{const r={};t.forEach(e=>{i.call(r,e.key)?r[e.key].push(e.val):r[e.key]=[e.val]}),n(e,r)})},L=(e,t,i,n,o)=>{if(!r(t))return f(s[1],o);const a=[];m(t,i,(t,r,i)=>{b(e=>n(t,e),(s,n)=>{(e&&n||!e&&!n)&&a.push({data:t,i:r}),i(s)})},e=>{o(e,a.sort((e,t)=>e.i-t.i).map(u))})},x=(e,t,r,i,s)=>{let n=e;m(t,r,(t,r,s)=>{b(e=>i(t,e),t=>{e?(t||(n=!1),s(!t)):(t&&(n=!0),s(n))})},()=>s(n))},O=(e,t,i)=>{const s=r(e)?[]:{};m(e,t,(e,t,r)=>{b(e,(e,...i)=>{i.length?s[t]=1===i.length?i[0]:i:s[t]=null,r(e)})},e=>{i(e,s)})},j=(e,t,r,i)=>{const s=parseInt(e),n=Array(s);for(let e=0;e<s;e++)n[e]=e;v(n,t,r,i)},T=(e,t,r,i)=>{let s;m(e,t,(e,t,i)=>{b(t=>r(e,t),t=>{t&&(s=e),i(s||null)})},()=>i(s))},P=(e,t,i,n)=>{if(!r(e))return f(s[1],n);v(e,t,i,(e,t)=>{n(e,[].concat(...t))})},I=(e,t)=>{if(!l(t)||!l(e))throw new TypeError(s[2]);return function(...r){let i;try{i=t.apply(this,r)}catch(t){if(!t)throw t;return void e(t)}a(i)?g(e,null):g(e,null,i)}},A=(e,t)=>{if(!l(t)||!l(e))throw new TypeError(s[2]);return function(r,...i){if(r)return void e(r);let s;try{s=t.apply(this,i)}catch(t){if(!t)throw t;return void g(e,t)}a(s)?g(e,null):g(e,null,s)}},q=(e,t)=>{if(a(t)||!l(e))throw new TypeError(s[2]);return function(r,...i){if(r)e(r);else if(l(t))try{return t.apply(this,i)}catch(t){if(!t)throw t;g(e,t)}else g(e,null,t)}},z=(e,t)=>{if(a(e))throw new TypeError(s[2]);return function(...r){a(t)&&(t=e,e=r[r.length-1]);try{return t.apply(this,r)}catch(t){if(!t)throw t;g(e,t)}}},B=(e,t)=>{if(!l(e)||!l(t))throw new TypeError(s[2]);return function(...r){r.push(t);try{return e.apply(this,r)}catch(e){if(!e)throw e;g(t,e)}}},V=(e,t)=>{if(a(t)||!l(e))throw new TypeError(s[2]);return function(r,...i){if(r)e(r);else try{return t.apply(this,i[0])}catch(t){if(!t)throw t;g(e,t)}}},C=e=>function(t){return e.apply(this,t)},M=(e,t,r,i,s)=>{function n(){b(t,q(s,o))}function o(t){b(e,q(s,e=>{e==r?s(null,t):n()}))}i?o():n()},F=(e,t,i,o=n,a)=>{if(!r(e))return f(s[1],o);const l=y(e),c=e.length,u=(t,r)=>{if(t)return void o(t);const s=l.next();s.done?o(null,r):b(t=>i(r,a?s.value:e[c-1-s.key],t),u)};u(null,t)},Q=e=>function(t,...r){const i=function(...r){const i=r.pop();m(t,e,(e,t,i)=>{b(t=>e.apply(this,r.concat(t)),i)},i)};return 0===r.length?i:i.apply(this,r)};class R{constructor(e,t){const r=parseInt(t);if(!r)throw new TypeError("Concurrency must not be zero");Object.defineProperties(this,{__worker:{enumerable:!1,configurable:!1,writable:!1,value:e},__workers:{enumerable:!1,configurable:!1,writable:!0,value:0},__workersList:{enumerable:!1,configurable:!1,writable:!0,value:[]},__isProcessing:{enumerable:!1,configurable:!1,writable:!0,value:!1},__processingScheduled:{enumerable:!1,configurable:!1,writable:!0,value:!1},tasks:{enumerable:!1,configurable:!1,writable:!1,value:[]},concurrency:{enumerable:!0,configurable:!1,writable:!0,value:r},buffer:{enumerable:!0,configurable:!1,writable:!0,value:r/4},started:{enumerable:!0,configurable:!1,writable:!0,value:!1},paused:{enumerable:!0,configurable:!1,writable:!0,value:!1}})}__insert(e,t,i){if(null!=i&&!l(i))throw new TypeError(s[3]);this.started=!0;const o=r(e)?e:[e];if(0===o.length&&this.idle())return w(()=>{this.drain()});const a=o.map(e=>({data:e,callback:d(i||n)}));t?this.tasks.unshift(...a):this.tasks.push(...a),this.__processingScheduled||(this.__processingScheduled=!0,w(()=>{this.__processingScheduled=!1,this.__execute()}))}__execute(){if(!this.__isProcessing){for(this.__isProcessing=!0;!this.paused&&this.__workers<this.concurrency&&this.tasks.length;){let e=this.tasks.shift();this.__workersList.push(e),0===this.tasks.length&&this.empty();let t=e.data;this.__workers++,this.__workers===this.concurrency&&this.saturated(),b(e=>this.__worker(t,e),(...r)=>{this.__workers--;const i=this.__workersList.indexOf(e);0===i?this.__workersList.shift():i>0&&this.__workersList.splice(i,1),e.callback(...r),r[0]&&this.error(r[0],t),this.__workers<=this.concurrency-this.buffer&&this.unsaturated(),this.idle()&&this.drain(),this.__execute()})}this.__isProcessing=!1}}remove(e){let t=this.tasks.filter(t=>!e(t.data));this.tasks.length=t.length,t.forEach((e,t)=>{this.tasks[t]=e})}push(e,t){this.__insert(e,!1,t)}saturated(){}unsaturated(){}empty(){}drain(){}error(){}kill(){delete this.drain,this.tasks.length=0}length(){return this.tasks.length}running(){return this.__workers}idle(){return this.tasks.length+this.__workers===0}pause(){this.paused=!0}resume(){this.paused&&(this.paused=!1,w(()=>this.__execute()))}workersList(){return this.__workersList}}class $ extends R{constructor(e,t){super(e,t,"Priority Queue")}push(e,t,r){this.__insert(e,t||0,r)}__insert(e,t,i){if(null!=i&&!l(i))throw new TypeError(s[3]);this.started=!0;const o=r(e)?e:[e];if(0===o.length&&this.idle())return w(()=>{this.drain()});const a=o.map(e=>({data:e,priority:t,callback:d(i||n)}));let c=this.tasks.length,u=c?this.tasks[0].priority:0,h=c?this.tasks[c-1].priority:0;t>u?this.tasks.unshift(...a):this.tasks.push(...a),u>=t&&t<h&&this.tasks.sort((e,t)=>t.priority-e.priority),this.__processingScheduled||(this.__processingScheduled=!0,w(()=>{this.__processingScheduled=!1,this.__execute()}))}}class D extends R{constructor(e,t){super(e,t,"Queue")}unshift(e,t){this.__insert(e,!0,t)}}class U extends R{constructor(e,t){super(e,1,"Cargo");const r=parseInt(t);if(!r)throw new TypeError("Payload must not be zero");Object.defineProperties(this,{payload:{enumerable:!0,configurable:!1,writable:!0,value:r}})}__execute(){if(!this.__isProcessing){for(this.__isProcessing=!0;!this.paused&&this.__workers<this.concurrency&&this.tasks.length;){let e=this.tasks.splice(0,this.payload);this.__workersList.push(...e),0===this.tasks.length&&this.empty();let t=e.map(u);this.__workers++,this.__workers===this.concurrency&&this.saturated(),b(e=>this.__worker(t,e),(...t)=>{this.__workers--,e.forEach(e=>{const r=this.__workersList.indexOf(e);0===r?this.__workersList.shift():r>0&&this.__workersList.splice(r,1),e.callback(...t)}),this.__workers<=this.concurrency-this.buffer&&this.unsaturated(),this.idle()&&this.drain(),this.__execute()})}this.__isProcessing=!1}}}const W="undefined"!=typeof process&&process.nextTick?process.nextTick:"function"==typeof queueMicrotask?queueMicrotask:w,G=(e,...t)=>(...r)=>e(...t,...r),H=function(...e){const t=e.length,r=parseInt(this);if(r!=r)throw new Error('Pass arguments to "safe.args" only through ".apply" method!');if(0===t||r>t)return[];const i=Array(t-r);for(let s=r;s<t;s++)i[s-r]=s<0?null:e[s];return i},J=(...e)=>t=>t(null,...e),K=e=>function(...t){let r=!0;const i=t[t.length-1];t[t.length-1]=function(...e){r?w(()=>i.apply(this,e)):i.apply(this,e)};const s=e.apply(this,t);return r=!1,s},N=e=>function(...t){const r=t.pop();b(r=>{const i=e.apply(this,t);return h(e)||c(i)?i:r(null,i)},r)},X=(e,t)=>{e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1}})},Y=(e,t,...r)=>i=>{try{return e[t](...r.concat(i))}catch(e){if(!e)throw e;g(i,e)}},Z=(e,t,i=n)=>{if(!r(e))return void f(s[1],i);const o=[];m(e,1/0,(e,r,i)=>{b(r=>t(e,r),(t,s)=>{o[r]={data:e,i:s},i(t)})},e=>{i(e,o.sort((e,t)=>e.i-t.i).map(u))})},ee=(e,t=n)=>{if(!r(e))return void f(s[1],t);const i=y(e),o=(e,...r)=>{if(e)return void t(e);const s=i.next();s.done?t(null,...r):b(e=>s.value(...r,e),o)};o()},te=(e,t=n)=>{O(e,1,t)},re=(e,t=n)=>{O(e,1/0,t)},ie=(e,t,r=n)=>{O(e,t,r)},se=(e,t,r,i=n)=>{F(e,t,r,i,1)},ne=(e,t,r,i=n)=>{F(e,t,r,i,0)},oe=(e,t,i=n)=>{r(e)?m(e,1/0,(e,r,i)=>{b(r=>t(e,r),i)},i):f(s[1],i)},ae=(e,t,i,o=n)=>{r(e)?m(e,t,(e,t,r)=>{b(t=>i(e,t),r)},o):f(s[1],o)},le=(e,t,i=n)=>{r(e)?m(e,1,(e,r,i)=>{b(r=>t(e,r),i)},i):f(s[1],i)},ce=(e,t,r=n)=>{o(e)?m(e,1/0,(e,r,i)=>{b(i=>t(e,r,i),i)},r):f(s[0],r)},ue=(e,t,r,i=n)=>{o(e)?m(e,t,(e,t,i)=>{b(i=>r(e,t,i),i)},i):f(s[0],i)},he=(e,t,r=n)=>{o(e)?m(e,1,(e,r,i)=>{b(i=>t(e,r,i),i)},r):f(s[0],r)},fe=(e,t,r=n)=>{v(e,1/0,t,r)},pe=(e,t,r,i=n)=>{v(e,t,r,i)},de=(e,t,r=n)=>{v(e,1,t,r)},ye=(e,t,r=n)=>{S(e,1/0,t,r)},me=(e,t,r,i=n)=>{S(e,t,r,i)},_e=(e,t,r=n)=>{S(e,1,t,r)},we=(e,t,r=n)=>{P(e,1/0,t,r)},ge=(e,t,r,i=n)=>{P(e,t,r,i)},ke=(e,t,r=n)=>{P(e,1,t,r)},be=(e,t,r=n)=>{E(e,1/0,t,r)},ve=(e,t,r,i=n)=>{E(e,t,r,i)},Se=(e,t,r=n)=>{E(e,1,t,r)},Ee=(e,t,r=n)=>{L(!0,e,1/0,t,r)},Le=(e,t,r,i=n)=>{L(!0,e,t,r,i)},xe=(e,t,r=n)=>{L(!0,e,1,t,r)},Oe=(e,t,r=n)=>{L(!1,e,1/0,t,r)},je=(e,t,r,i=n)=>{L(!1,e,t,r,i)},Te=(e,t,r=n)=>{L(!1,e,1,t,r)},Pe=(e,t,r=n)=>{x(!1,e,1/0,t,r)},Ie=(e,t,r,i=n)=>{x(!1,e,t,r,i)},Ae=(e,t,r=n)=>{x(!1,e,1,t,r)},qe=(e,t,r=n)=>{x(!0,e,1/0,t,r)},ze=(e,t,r,i=n)=>{x(!0,e,t,r,i)},Be=(e,t,r=n)=>{x(!0,e,1,t,r)},Ve=(e,s,n)=>{const o={},a=Object.create(null),c=t(e);let u,h=c.length,f=0,d=null;if(l(s)&&(n=s,s=1/0),c.forEach(t=>{if(d)return;const s=e[t];if(r(s)){let n=s.slice(0,s.length-1);for(let o=0;o<n.length;o++){let a=i.call(e,s[o])?e[s[o]]:null;if(!a){d=new Error(`safe.auto task \`${t}\` has a non-existent dependency \`${s[o]}\` in ${n.join(", ")}`);break}if(a===t||r(a)&&-1!==a.indexOf(t)){d=new Error("safe.auto cannot execute tasks due to a recursive dependency");break}}}}),d){if(l(n))return void n(d);throw new Error(d)}const y=p(n);!function t(){c.forEach(n=>{if(u||f>=s||a[n])return;let l;const c=e[n];if(r(c)){let e=c.length-1;for(let t=0;t<e;t++)if(!i.call(o,c[t]))return;l=c[e]}else l=c;a[n]=!0,f++,b(e=>l(e,o),(e,...r)=>{h--,f--,u||(u=e||0===h,e?y(e,o):(r.length?o[n]=1===r.length?r[0]:r:o[n]=null,u?y(e,o):t()))})})}()},Ce=(e,t,r=n)=>{M(_(e),t,!1,!0,r)},Me=(e,t,r=n)=>{M(_(t),e,!1,!1,r)},Fe=(e,t,r=n)=>{M(e,t,!1,!0,r)},Qe=(e,t,r=n)=>{M(t,e,!1,!1,r)},Re=(e,t,r=n)=>{M(_(e),t,!0,!0,r)},$e=(e,t,r=n)=>{M(_(t),e,!0,!1,r)},De=(e,t=n)=>{const r=d(t),i=K(e);!function e(){i(q(r,e))}()},Ue=(e,t=(e=>e))=>{const r={},s={},n=(...n)=>{const o=n.pop(),a=t(...n);i.call(r,a)?w(()=>o(...r[a])):i.call(s,a)?s[a].push(o):(s[a]=[o],e(...n,(...e)=>{r[a]=e;const t=s[a];delete s[a],t.forEach(t=>{t(...e)})}))};return n.memo=r,n.unmemoized=e,n},We=e=>(...t)=>(e.unmemoized||e)(...t),Ge=function(e,t,r){if(arguments.length<1||arguments.length>3)throw new Error("Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)");let i,s,a,c=0,u=()=>c;l(e)?(r=t,t=e,s=5):o(e)?(s=parseInt(e.times)||5,l(e.interval)?u=e.interval:c=parseInt(e.interval)||c,e.errorFilter&&(a=e.errorFilter)):s=parseInt(s)||5;const h=(e,o)=>{let l=o;m(Array(s),1,(e,r,n)=>{b(e=>t(e,l),(e,t)=>{if(i=e||null,l={err:i,result:t},e&&r<s-1)if(a&&!a(e))n(!0);else{let e=u(r+1);e>0?setTimeout(n,e):n()}else n(!e)})},()=>{(e||r||n)(i,l)})};return r?h():h},He=function(e,t,i,s){arguments.length<=3&&(s=i,i=t,t=r(e)?[]:{}),s=p(s),m(e,1/0,(e,r,s)=>{b(s=>i(t,e,r,s),s)},e=>s(e,t))},Je=e=>function(...t){const r=t[t.length-1];t[t.length-1]=function(e,...t){if(e)r(null,{error:e});else{let e;e=t.length?1===t.length?t[0]:t:null,r(null,{value:e})}};const i=e.apply(this,t);(h(e)||c(i))&&i.then(e=>{g(r,null,{value:e})},e=>{g(r,null,{error:e})})},Ke=e=>{if(r(e))return e.map(Je);let i={};return t(e).forEach(t=>{i[t]=Je(e[t])}),i},Ne=(e,t)=>{if(r(e))if(e.length){const r=p(t);e.forEach(e=>{e(r)})}else t();else f(s[0],t)},Xe=(e,t=n)=>{if(!o(e))return void f(s[0],t);let r,i=null;m(e,1,(e,t,s)=>{b(e,(e,...t)=>{r=t.length<=1?t[0]:t,i=e,s(!e)})},()=>{t(i,r)})},Ye=(e,t)=>new D(e,t),Ze=(e,t)=>new $(e,t),et=(e,t)=>new U(e,t),tt=(e,t,r)=>{j(e,1/0,t,r)},rt=(e,t,r,i)=>{j(e,t,r,i)},it=(e,t,r)=>{j(e,1,t,r)},st=(e,t,r)=>{T(e,1/0,t,r)},nt=(e,t,r,i)=>{T(e,t,r,i)},ot=(e,t,r)=>{T(e,1,t,r)},at=Q(1/0),lt=Q(1),ct={noop:n,nextTick:W,back:g,setImmediate:g,yield:g,apply:G,async:Y,inherits:X,args:H,ensureAsync:K,constant:J,result:I,sure_result:A,trap_sure_result:A,sure:q,trap_sure:q,sure_spread:V,spread:C,trap:z,wrap:B,run:b,each:oe,forEach:oe,eachLimit:ae,forEachLimit:ae,eachSeries:le,forEachSeries:le,eachOf:ce,forEachOf:ce,eachOfLimit:ue,forEachOfLimit:ue,eachOfSeries:he,forEachOfSeries:he,map:fe,mapLimit:pe,mapSeries:de,groupBy:be,groupByLimit:ve,groupBySeries:Se,mapValues:ye,mapValuesLimit:me,mapValuesSeries:_e,concat:we,concatLimit:ge,concatSeries:ke,sortBy:Z,filter:Ee,select:Ee,filterLimit:Le,selectLimit:Le,filterSeries:xe,selectSeries:xe,reject:Oe,rejectLimit:je,rejectSeries:Te,waterfall:ee,series:te,parallel:re,parallelLimit:ie,auto:Ve,whilst:Ce,doWhilst:Me,during:Fe,doDuring:Qe,until:Re,doUntil:$e,forever:De,reduce:se,inject:se,foldl:se,reduceRight:ne,foldr:ne,queue:Ye,priorityQueue:Ze,cargo:et,retry:Ge,retryable:Ge,times:tt,timesLimit:rt,timesSeries:it,detect:st,detectLimit:nt,detectSeries:ot,some:Pe,any:Pe,someLimit:Ie,anyLimit:Ie,someSeries:Ae,anySeries:Ae,every:qe,all:qe,everyLimit:ze,allLimit:ze,everySeries:Be,allSeries:Be,applyEach:at,applyEachSeries:lt,asyncify:N,wrapSync:N,memoize:Ue,unmemoize:We,transform:He,reflect:Je,reflectAll:Ke,race:Ne,tryEach:Xe};e.default=ct,e.noop=n,e.nextTick=W,e.back=g,e.setImmediate=g,e.yield=g,e.apply=G,e.async=Y,e.inherits=X,e.args=H,e.ensureAsync=K,e.constant=J,e.result=I,e.sure_result=A,e.trap_sure_result=A,e.sure=q,e.trap_sure=q,e.sure_spread=V,e.spread=C,e.trap=z,e.wrap=B,e.run=b,e.each=oe,e.forEach=oe,e.eachLimit=ae,e.forEachLimit=ae,e.eachSeries=le,e.forEachSeries=le,e.eachOf=ce,e.forEachOf=ce,e.eachOfLimit=ue,e.forEachOfLimit=ue,e.eachOfSeries=he,e.forEachOfSeries=he,e.map=fe,e.mapLimit=pe,e.mapSeries=de,e.groupBy=be,e.groupByLimit=ve,e.groupBySeries=Se,e.mapValues=ye,e.mapValuesLimit=me,e.mapValuesSeries=_e,e.concat=we,e.concatLimit=ge,e.concatSeries=ke,e.sortBy=Z,e.filter=Ee,e.select=Ee,e.filterLimit=Le,e.selectLimit=Le,e.filterSeries=xe,e.selectSeries=xe,e.reject=Oe,e.rejectLimit=je,e.rejectSeries=Te,e.waterfall=ee,e.series=te,e.parallel=re,e.parallelLimit=ie,e.auto=Ve,e.whilst=Ce,e.doWhilst=Me,e.during=Fe,e.doDuring=Qe,e.until=Re,e.doUntil=$e,e.forever=De,e.reduce=se,e.inject=se,e.foldl=se,e.reduceRight=ne,e.foldr=ne,e.queue=Ye,e.priorityQueue=Ze,e.cargo=et,e.retry=Ge,e.retryable=Ge,e.times=tt,e.timesLimit=rt,e.timesSeries=it,e.detect=st,e.detectLimit=nt,e.detectSeries=ot,e.some=Pe,e.any=Pe,e.someLimit=Ie,e.anyLimit=Ie,e.someSeries=Ae,e.anySeries=Ae,e.every=qe,e.all=qe,e.everyLimit=ze,e.allLimit=ze,e.everySeries=Be,e.allSeries=Be,e.applyEach=at,e.applyEachSeries=lt,e.asyncify=N,e.wrapSync=N,e.memoize=Ue,e.unmemoize=We,e.transform=He,e.reflect=Je,e.reflectAll=Ke,e.race=Ne,e.tryEach=Xe,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.safe={})}(this,(function(e){"use strict";const t="undefined",r="function",i=Object.keys,s=Array.isArray,n=1/0,o=Object.prototype.hasOwnProperty,a="Callback was already called.",l=["Array or Object are required","Array is required","Exactly two arguments are required","Function is required"],c=()=>{},u=e=>{if(null===e)return!1;const t=typeof e;return"object"===t||t===r},h=e=>typeof e===t,f=e=>typeof e===r,p=e=>e&&f(e.then),y=e=>{if(e)return e.data},d=e=>e&&e.constructor&&"AsyncFunction"===e.constructor.name,m=(e,t)=>{const r=new TypeError(e);if(!f(t)||t===c)throw r;t(r)},_=e=>{let t=!1;return(...r)=>{if(!t&&null!=e)return t=!0,e(...r)}},w=e=>{let t=!1;return(...r)=>{if(t)throw new Error(a);return t=!0,e(...r)}},g=e=>s(e)?(e=>{let t=-1;return{next:()=>(t++,t<e.length?{value:e[t],key:t,done:!1}:{done:!0})}})(e):e[typeof Symbol===r&&Symbol.iterator]?(e=>{let t=-1;const r=e[Symbol.iterator]();return{next:()=>{t++;const e=r.next();return e.done?{done:!0}:{value:e.value,key:t,done:!1}}}})(e):(e=>{const t=i(e),r=t.length;let s=-1;return{next:()=>{s++;const i=t[s];return s<r?{value:e[i],key:i,done:!1}:{done:!0}}}})(e),k=(e,t,r,i)=>{let s=0,n=!1,o=g(e),a=!1;const l=_(i);!function e(){if(!n&&!a)for(;s<t&&!1===a;){let i=o.next();if(i.done){n=!0,s<=0&&l();break}s++,r(i.value,i.key,(r=>{s--,r?(a=!0,l(r)):!1===n&&s<t?e():n&&s<=0&&l()}))}}()},b=e=>t=>t(null,e()),v=typeof setImmediate===r?setImmediate:typeof queueMicrotask===r?(e,...t)=>{queueMicrotask((()=>{e(...t)}))}:typeof process===t?typeof Image===r?(e,...t)=>{const r=new Image;r.onerror=()=>{e(...t)},r.src="data:image/png,0"}:(e,...t)=>{setTimeout(e,0,...t)}:(e,...t)=>{process.nextTick((()=>{e(...t)}))},S=(...e)=>{if(!f(e[0]))throw new TypeError(l[3]);v(...e)},E=(e,t)=>{e.then((e=>{S(t,null,e)}),(e=>{S(t,e)}))},L=(e,t)=>{if(d(e))return void E(e(),t);let r,i,s=!1;try{i=e(n)}catch(e){if(!e)throw e;v(n,e)}if(p(i)){if(r="Resolution method is overspecified. Call a callback *or* return a Promise.",s)throw new Error(r);E(i,n)}function n(...e){if(s)throw e[0]||new Error(r||a);s=!0,t(...e)}},x=(e,t,r,i)=>{if(!u(e))return m(l[0],i);const s=[];let n=0;k(e,t,((e,t,i)=>{const o=n++;L((t=>r(e,t)),((e,t)=>{s[o]=t,i(e)}))}),(e=>{i(e,s)}))},O=(e,t,r,i)=>{if(!u(e))return m(l[0],i);const s={};k(e,t,((e,t,i)=>{L((i=>r(e,t,i)),((e,r)=>{s[t]=r,i(e)}))}),(e=>{i(e,s)}))},j=(e,t,r,i)=>{if(!u(e))return m(l[0],i);x(e,t,((e,t)=>{L((t=>r(e,t)),((r,i)=>{if(r)return t(r);t(r,{key:i,val:e})}))}),((e,t)=>{const r={};t.forEach((e=>{o.call(r,e.key)?r[e.key].push(e.val):r[e.key]=[e.val]})),i(e,r)}))},T=(e,t,r,i,n)=>{if(!s(t))return m(l[1],n);const o=[];k(t,r,((t,r,s)=>{L((e=>i(t,e)),((i,n)=>{(e&&n||!e&&!n)&&o.push({data:t,i:r}),s(i)}))}),(e=>{n(e,o.sort(((e,t)=>e.i-t.i)).map(y))}))},P=(e,t,r,i,s)=>{let n=e;k(t,r,((t,r,s)=>{L((e=>i(t,e)),(t=>{e?(t||(n=!1),s(!t)):(t&&(n=!0),s(n))}))}),(()=>s(n)))},I=(e,t,r)=>{const i=s(e)?[]:{};k(e,t,((e,t,r)=>{L(e,((e,...s)=>{s.length?i[t]=1===s.length?s[0]:s:i[t]=null,r(e)}))}),(e=>{r(e,i)}))},A=(e,t,r,i)=>{const s=parseInt(e),n=Array(s);for(let e=0;e<s;e++)n[e]=e;x(n,t,r,i)},q=(e,t,r,i)=>{let s;k(e,t,((e,t,i)=>{L((t=>r(e,t)),(t=>{t&&(s=e),i(s||null)}))}),(()=>i(s)))},z=(e,t,r,i)=>{if(!s(e))return m(l[1],i);x(e,t,r,((e,t)=>{i(e,[].concat(...t))}))},B=(e,t)=>{if(!f(t)||!f(e))throw new TypeError(l[2]);return function(...r){let i;try{i=t.apply(this,r)}catch(t){if(!t)throw t;return void e(t)}h(i)?S(e,null):S(e,null,i)}},V=(e,t)=>{if(!f(t)||!f(e))throw new TypeError(l[2]);return function(r,...i){if(r)return void e(r);let s;try{s=t.apply(this,i)}catch(t){if(!t)throw t;return void S(e,t)}h(s)?S(e,null):S(e,null,s)}},M=(e,t)=>{if(h(t)||!f(e))throw new TypeError(l[2]);return function(r,...i){if(r)e(r);else if(f(t))try{return t.apply(this,i)}catch(t){if(!t)throw t;S(e,t)}else S(e,null,t)}},C=(e,t)=>{if(h(e))throw new TypeError(l[2]);return function(...r){h(t)&&(t=e,e=r[r.length-1]);try{return t.apply(this,r)}catch(t){if(!t)throw t;S(e,t)}}},F=(e,t)=>{if(!f(e)||!f(t))throw new TypeError(l[2]);return function(...r){r.push(t);try{return e.apply(this,r)}catch(e){if(!e)throw e;S(t,e)}}},Q=(e,t)=>{if(h(t)||!f(e))throw new TypeError(l[2]);return function(r,...i){if(r)e(r);else try{return t.apply(this,i[0])}catch(t){if(!t)throw t;S(e,t)}}},R=e=>function(t){return e.apply(this,t)},$=(e,t,r,i,s)=>{function n(){L(t,M(s,o))}function o(t){L(e,M(s,(e=>{e==r?s(null,t):n()})))}i?o():n()},D=(e,t,r,i=c,n)=>{if(!s(e))return m(l[1],i);const o=g(e),a=e.length,u=(t,s)=>{if(t)return void i(t);const l=o.next();l.done?i(null,s):L((t=>r(s,n?l.value:e[a-1-l.key],t)),u)};u(null,t)},U=e=>function(t,...r){const i=function(...r){const i=r.pop();k(t,e,((e,t,i)=>{L((t=>e.apply(this,r.concat(t))),i)}),i)};return 0===r.length?i:i.apply(this,r)};class W{constructor(e,t){const r=parseInt(t);if(!r)throw new TypeError("Concurrency must not be zero");Object.defineProperties(this,{__worker:{enumerable:!1,configurable:!1,writable:!1,value:e},__workers:{enumerable:!1,configurable:!1,writable:!0,value:0},__workersList:{enumerable:!1,configurable:!1,writable:!0,value:[]},__isProcessing:{enumerable:!1,configurable:!1,writable:!0,value:!1},__processingScheduled:{enumerable:!1,configurable:!1,writable:!0,value:!1},tasks:{enumerable:!1,configurable:!1,writable:!1,value:[]},concurrency:{enumerable:!0,configurable:!1,writable:!0,value:r},buffer:{enumerable:!0,configurable:!1,writable:!0,value:r/4},started:{enumerable:!0,configurable:!1,writable:!0,value:!1},paused:{enumerable:!0,configurable:!1,writable:!0,value:!1}})}__insert(e,t,r){if(null!=r&&!f(r))throw new TypeError(l[3]);this.started=!0;const i=s(e)?e:[e];if(0===i.length&&this.idle())return v((()=>{this.drain()}));const n=i.map((e=>({data:e,callback:w(r||c)})));t?this.tasks.unshift(...n):this.tasks.push(...n),this.__processingScheduled||(this.__processingScheduled=!0,v((()=>{this.__processingScheduled=!1,this.__execute()})))}__execute(){if(!this.__isProcessing){for(this.__isProcessing=!0;!this.paused&&this.__workers<this.concurrency&&this.tasks.length;){let e=this.tasks.shift();this.__workersList.push(e),0===this.tasks.length&&this.empty();let t=e.data;this.__workers++,this.__workers===this.concurrency&&this.saturated(),L((e=>this.__worker(t,e)),((...r)=>{this.__workers--;const i=this.__workersList.indexOf(e);0===i?this.__workersList.shift():i>0&&this.__workersList.splice(i,1),e.callback(...r),r[0]&&this.error(r[0],t),this.__workers<=this.concurrency-this.buffer&&this.unsaturated(),this.idle()&&this.drain(),this.__execute()}))}this.__isProcessing=!1}}remove(e){let t=this.tasks.filter((t=>!e(t.data)));this.tasks.length=t.length,t.forEach(((e,t)=>{this.tasks[t]=e}))}push(e,t){this.__insert(e,!1,t)}saturated(){}unsaturated(){}empty(){}drain(){}error(){}kill(){delete this.drain,this.tasks.length=0}length(){return this.tasks.length}running(){return this.__workers}idle(){return this.tasks.length+this.__workers===0}pause(){this.paused=!0}resume(){this.paused&&(this.paused=!1,v((()=>this.__execute())))}workersList(){return this.__workersList}}class G extends W{constructor(e,t){super(e,t,"Priority Queue")}push(e,t,r){this.__insert(e,t||0,r)}__insert(e,t,r){if(null!=r&&!f(r))throw new TypeError(l[3]);this.started=!0;const i=s(e)?e:[e];if(0===i.length&&this.idle())return v((()=>{this.drain()}));const n=i.map((e=>({data:e,priority:t,callback:w(r||c)})));let o=this.tasks.length,a=o?this.tasks[0].priority:0,u=o?this.tasks[o-1].priority:0;t>a?this.tasks.unshift(...n):this.tasks.push(...n),a>=t&&t<u&&this.tasks.sort(((e,t)=>t.priority-e.priority)),this.__processingScheduled||(this.__processingScheduled=!0,v((()=>{this.__processingScheduled=!1,this.__execute()})))}}class H extends W{constructor(e,t){super(e,t,"Queue")}unshift(e,t){this.__insert(e,!0,t)}}class J extends W{constructor(e,t){super(e,1,"Cargo");const r=parseInt(t);if(!r)throw new TypeError("Payload must not be zero");Object.defineProperties(this,{payload:{enumerable:!0,configurable:!1,writable:!0,value:r}})}__execute(){if(!this.__isProcessing){for(this.__isProcessing=!0;!this.paused&&this.__workers<this.concurrency&&this.tasks.length;){let e=this.tasks.splice(0,this.payload);this.__workersList.push(...e),0===this.tasks.length&&this.empty();let t=e.map(y);this.__workers++,this.__workers===this.concurrency&&this.saturated(),L((e=>this.__worker(t,e)),((...t)=>{this.__workers--,e.forEach((e=>{const r=this.__workersList.indexOf(e);0===r?this.__workersList.shift():r>0&&this.__workersList.splice(r,1),e.callback(...t)})),this.__workers<=this.concurrency-this.buffer&&this.unsaturated(),this.idle()&&this.drain(),this.__execute()}))}this.__isProcessing=!1}}}const K=typeof process!==t&&process.nextTick?process.nextTick:typeof queueMicrotask===r?queueMicrotask:v,N=(e,...t)=>(...r)=>e(...t,...r),X=function(...e){const t=e.length,r=parseInt(this);if(r!=r)throw new Error('Pass arguments to "safe.args" only through ".apply" method!');if(0===t||r>t)return[];const i=Array(t-r);for(let s=r;s<t;s++)i[s-r]=s<0?null:e[s];return i},Y=(...e)=>t=>t(null,...e),Z=e=>function(...t){let r=!0;const i=t[t.length-1];t[t.length-1]=function(...e){r?v((()=>i.apply(this,e))):i.apply(this,e)};const s=e.apply(this,t);return r=!1,s},ee=e=>function(...t){const r=t.pop();L((r=>{const i=e.apply(this,t);return d(e)||p(i)?i:r(null,i)}),r)},te=(e,t)=>{e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1}})},re=(e,t,...r)=>i=>{try{return e[t](...r.concat(i))}catch(e){if(!e)throw e;S(i,e)}},ie=(e,t,r=c)=>{if(!s(e))return void m(l[1],r);const i=[];k(e,n,((e,r,s)=>{L((r=>t(e,r)),((t,n)=>{i[r]={data:e,i:n},s(t)}))}),(e=>{r(e,i.sort(((e,t)=>e.i-t.i)).map(y))}))},se=(e,t=c)=>{if(!s(e))return void m(l[1],t);const r=g(e),i=(e,...s)=>{if(e)return void t(e);const n=r.next();n.done?t(null,...s):L((e=>n.value(...s,e)),i)};i()},ne=(e,t=c)=>{I(e,1,t)},oe=(e,t=c)=>{I(e,n,t)},ae=(e,t,r=c)=>{I(e,t,r)},le=(e,t,r,i=c)=>{D(e,t,r,i,1)},ce=(e,t,r,i=c)=>{D(e,t,r,i,0)},ue=(e,t,r=c)=>{s(e)?k(e,n,((e,r,i)=>{L((r=>t(e,r)),i)}),r):m(l[1],r)},he=(e,t,r,i=c)=>{s(e)?k(e,t,((e,t,i)=>{L((t=>r(e,t)),i)}),i):m(l[1],i)},fe=(e,t,r=c)=>{s(e)?k(e,1,((e,r,i)=>{L((r=>t(e,r)),i)}),r):m(l[1],r)},pe=(e,t,r=c)=>{u(e)?k(e,n,((e,r,i)=>{L((i=>t(e,r,i)),i)}),r):m(l[0],r)},ye=(e,t,r,i=c)=>{u(e)?k(e,t,((e,t,i)=>{L((i=>r(e,t,i)),i)}),i):m(l[0],i)},de=(e,t,r=c)=>{u(e)?k(e,1,((e,r,i)=>{L((i=>t(e,r,i)),i)}),r):m(l[0],r)},me=(e,t,r=c)=>{x(e,n,t,r)},_e=(e,t,r,i=c)=>{x(e,t,r,i)},we=(e,t,r=c)=>{x(e,1,t,r)},ge=(e,t,r=c)=>{O(e,n,t,r)},ke=(e,t,r,i=c)=>{O(e,t,r,i)},be=(e,t,r=c)=>{O(e,1,t,r)},ve=(e,t,r=c)=>{z(e,n,t,r)},Se=(e,t,r,i=c)=>{z(e,t,r,i)},Ee=(e,t,r=c)=>{z(e,1,t,r)},Le=(e,t,r=c)=>{j(e,n,t,r)},xe=(e,t,r,i=c)=>{j(e,t,r,i)},Oe=(e,t,r=c)=>{j(e,1,t,r)},je=(e,t,r=c)=>{T(!0,e,n,t,r)},Te=(e,t,r,i=c)=>{T(!0,e,t,r,i)},Pe=(e,t,r=c)=>{T(!0,e,1,t,r)},Ie=(e,t,r=c)=>{T(!1,e,n,t,r)},Ae=(e,t,r,i=c)=>{T(!1,e,t,r,i)},qe=(e,t,r=c)=>{T(!1,e,1,t,r)},ze=(e,t,r=c)=>{P(!1,e,n,t,r)},Be=(e,t,r,i=c)=>{P(!1,e,t,r,i)},Ve=(e,t,r=c)=>{P(!1,e,1,t,r)},Me=(e,t,r=c)=>{P(!0,e,n,t,r)},Ce=(e,t,r,i=c)=>{P(!0,e,t,r,i)},Fe=(e,t,r=c)=>{P(!0,e,1,t,r)},Qe=(e,t,r)=>{const a={},l=Object.create(null),c=i(e);let u,h=c.length,p=0,y=null;if(f(t)&&(r=t,t=n),c.forEach((t=>{if(y)return;const r=e[t];if(s(r)){let i=r.slice(0,r.length-1);for(let n=0;n<i.length;n++){let a=o.call(e,r[n])?e[r[n]]:null;if(!a){y=new Error(`safe.auto task \`${t}\` has a non-existent dependency \`${r[n]}\` in ${i.join(", ")}`);break}if(a===t||s(a)&&-1!==a.indexOf(t)){y=new Error("safe.auto cannot execute tasks due to a recursive dependency");break}}}})),y){if(f(r))return void r(y);throw new Error(y)}const d=_(r);!function r(){c.forEach((i=>{if(u||p>=t||l[i])return;let n;const c=e[i];if(s(c)){let e=c.length-1;for(let t=0;t<e;t++)if(!o.call(a,c[t]))return;n=c[e]}else n=c;l[i]=!0,p++,L((e=>n(e,a)),((e,...t)=>{h--,p--,u||(u=e||0===h,e?d(e,a):(t.length?a[i]=1===t.length?t[0]:t:a[i]=null,u?d(e,a):r()))}))}))}()},Re=(e,t,r=c)=>{$(b(e),t,!1,!0,r)},$e=(e,t,r=c)=>{$(b(t),e,!1,!1,r)},De=(e,t,r=c)=>{$(e,t,!1,!0,r)},Ue=(e,t,r=c)=>{$(t,e,!1,!1,r)},We=(e,t,r=c)=>{$(b(e),t,!0,!0,r)},Ge=(e,t,r=c)=>{$(b(t),e,!0,!1,r)},He=(e,t=c)=>{const r=w(t),i=Z(e);!function e(){i(M(r,e))}()},Je=(e,t=(e=>e))=>{const r={},i={},s=(...s)=>{const n=s.pop(),a=t(...s);o.call(r,a)?v((()=>n(...r[a]))):o.call(i,a)?i[a].push(n):(i[a]=[n],e(...s,((...e)=>{r[a]=e;const t=i[a];delete i[a],t.forEach((t=>{t(...e)}))})))};return s.memo=r,s.unmemoized=e,s},Ke=e=>(...t)=>(e.unmemoized||e)(...t),Ne=function(e,t,r){if(arguments.length<1||arguments.length>3)throw new Error("Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)");let i,s,n,o=0,a=()=>o;f(e)?(r=t,t=e,s=5):u(e)?(s=parseInt(e.times)||5,f(e.interval)?a=e.interval:o=parseInt(e.interval)||o,e.errorFilter&&(n=e.errorFilter)):s=parseInt(s)||5;const l=(e,o)=>{let l=o;k(Array(s),1,((e,r,o)=>{L((e=>t(e,l)),((e,t)=>{if(i=e||null,l={err:i,result:t},e&&r<s-1)if(n&&!n(e))o(!0);else{let e=a(r+1);e>0?setTimeout(o,e):o()}else o(!e)}))}),(()=>{(e||r||c)(i,l)}))};return r?l():l},Xe=function(e,t,r,i){arguments.length<=3&&(i=r,r=t,t=s(e)?[]:{}),i=_(i),k(e,n,((e,i,s)=>{L((s=>r(t,e,i,s)),s)}),(e=>i(e,t)))},Ye=e=>function(...t){const r=t[t.length-1];t[t.length-1]=function(e,...t){if(e)r(null,{error:e});else{let e;e=t.length?1===t.length?t[0]:t:null,r(null,{value:e})}};const i=e.apply(this,t);(d(e)||p(i))&&i.then((e=>{S(r,null,{value:e})}),(e=>{S(r,null,{error:e})}))},Ze=e=>{if(s(e))return e.map(Ye);let t={};return i(e).forEach((r=>{t[r]=Ye(e[r])})),t},et=(e,t)=>{if(s(e))if(e.length){const r=_(t);e.forEach((e=>{e(r)}))}else t();else m(l[0],t)},tt=(e,t=c)=>{if(!u(e))return void m(l[0],t);let r,i=null;k(e,1,((e,t,s)=>{L(e,((e,...t)=>{r=t.length<=1?t[0]:t,i=e,s(!e)}))}),(()=>{t(i,r)}))},rt=(e,t)=>new H(e,t),it=(e,t)=>new G(e,t),st=(e,t)=>new J(e,t),nt=(e,t,r)=>{A(e,n,t,r)},ot=(e,t,r,i)=>{A(e,t,r,i)},at=(e,t,r)=>{A(e,1,t,r)},lt=(e,t,r)=>{q(e,n,t,r)},ct=(e,t,r,i)=>{q(e,t,r,i)},ut=(e,t,r)=>{q(e,1,t,r)},ht=U(n),ft=U(1),pt={noop:c,nextTick:K,back:S,setImmediate:S,yield:S,apply:N,async:re,inherits:te,args:X,ensureAsync:Z,constant:Y,result:B,sure_result:V,trap_sure_result:V,sure:M,trap_sure:M,sure_spread:Q,spread:R,trap:C,wrap:F,run:L,each:ue,forEach:ue,eachLimit:he,forEachLimit:he,eachSeries:fe,forEachSeries:fe,eachOf:pe,forEachOf:pe,eachOfLimit:ye,forEachOfLimit:ye,eachOfSeries:de,forEachOfSeries:de,map:me,mapLimit:_e,mapSeries:we,groupBy:Le,groupByLimit:xe,groupBySeries:Oe,mapValues:ge,mapValuesLimit:ke,mapValuesSeries:be,concat:ve,concatLimit:Se,concatSeries:Ee,sortBy:ie,filter:je,select:je,filterLimit:Te,selectLimit:Te,filterSeries:Pe,selectSeries:Pe,reject:Ie,rejectLimit:Ae,rejectSeries:qe,waterfall:se,series:ne,parallel:oe,parallelLimit:ae,auto:Qe,whilst:Re,doWhilst:$e,during:De,doDuring:Ue,until:We,doUntil:Ge,forever:He,reduce:le,inject:le,foldl:le,reduceRight:ce,foldr:ce,queue:rt,priorityQueue:it,cargo:st,retry:Ne,retryable:Ne,times:nt,timesLimit:ot,timesSeries:at,detect:lt,detectLimit:ct,detectSeries:ut,some:ze,any:ze,someLimit:Be,anyLimit:Be,someSeries:Ve,anySeries:Ve,every:Me,all:Me,everyLimit:Ce,allLimit:Ce,everySeries:Fe,allSeries:Fe,applyEach:ht,applyEachSeries:ft,asyncify:ee,wrapSync:ee,memoize:Je,unmemoize:Ke,transform:Xe,reflect:Ye,reflectAll:Ze,race:et,tryEach:tt};e.default=pt,e.noop=c,e.nextTick=K,e.back=S,e.setImmediate=S,e.yield=S,e.apply=N,e.async=re,e.inherits=te,e.args=X,e.ensureAsync=Z,e.constant=Y,e.result=B,e.sure_result=V,e.trap_sure_result=V,e.sure=M,e.trap_sure=M,e.sure_spread=Q,e.spread=R,e.trap=C,e.wrap=F,e.run=L,e.each=ue,e.forEach=ue,e.eachLimit=he,e.forEachLimit=he,e.eachSeries=fe,e.forEachSeries=fe,e.eachOf=pe,e.forEachOf=pe,e.eachOfLimit=ye,e.forEachOfLimit=ye,e.eachOfSeries=de,e.forEachOfSeries=de,e.map=me,e.mapLimit=_e,e.mapSeries=we,e.groupBy=Le,e.groupByLimit=xe,e.groupBySeries=Oe,e.mapValues=ge,e.mapValuesLimit=ke,e.mapValuesSeries=be,e.concat=ve,e.concatLimit=Se,e.concatSeries=Ee,e.sortBy=ie,e.filter=je,e.select=je,e.filterLimit=Te,e.selectLimit=Te,e.filterSeries=Pe,e.selectSeries=Pe,e.reject=Ie,e.rejectLimit=Ae,e.rejectSeries=qe,e.waterfall=se,e.series=ne,e.parallel=oe,e.parallelLimit=ae,e.auto=Qe,e.whilst=Re,e.doWhilst=$e,e.during=De,e.doDuring=Ue,e.until=We,e.doUntil=Ge,e.forever=He,e.reduce=le,e.inject=le,e.foldl=le,e.reduceRight=ce,e.foldr=ce,e.queue=rt,e.priorityQueue=it,e.cargo=st,e.retry=Ne,e.retryable=Ne,e.times=nt,e.timesLimit=ot,e.timesSeries=at,e.detect=lt,e.detectLimit=ct,e.detectSeries=ut,e.some=ze,e.any=ze,e.someLimit=Be,e.anyLimit=Be,e.someSeries=Ve,e.anySeries=Ve,e.every=Me,e.all=Me,e.everyLimit=Ce,e.allLimit=Ce,e.everySeries=Fe,e.allSeries=Fe,e.applyEach=ht,e.applyEachSeries=ft,e.asyncify=ee,e.wrapSync=ee,e.memoize=Je,e.unmemoize=Ke,e.transform=Xe,e.reflect=Ye,e.reflectAll=Ze,e.race=et,e.tryEach=tt,Object.defineProperty(e,"__esModule",{value:!0})}));
{
"author": "Sergey Korotkov <sergeyksv@gmail.com>",
"name": "safe",
"version": "0.4.7",
"version": "0.4.8",
"repository": {

@@ -30,14 +30,14 @@ "type": "git",

"devDependencies": {
"@babel/core": "^7.12.10",
"@babel/preset-env": "^7.12.11",
"@babel/core": "^7.23.6",
"@babel/preset-env": "^7.23.6",
"es6-map": "^0.1.5",
"es6-promise": "^4.2.8",
"es6-set": "^0.1.5",
"es6-set": "^0.1.6",
"es6-symbol": "^3.1.3",
"eslint": "^6.8.0",
"eslint": "^8.56.0",
"eslint-plugin-no-inferred-method-name": "^2.0.0",
"eslint-plugin-sonarjs": "^0.5.0",
"grunt": "^1.3.0",
"eslint-plugin-sonarjs": "^0.23.0",
"grunt": "^1.6.1",
"grunt-babel": "^8.0.0",
"grunt-terser": "^1.0.0",
"grunt-terser": "^2.0.0",
"is-async-supported": "^1.2.0",

@@ -44,0 +44,0 @@ "load-grunt-tasks": "^5.1.0",

@@ -207,2 +207,6 @@ "use strict";

const _back = (() => {
if (typeof setImmediate === FUNCTION) {
return setImmediate;
}
if (typeof queueMicrotask === FUNCTION) {

@@ -216,6 +220,2 @@ return (callback, ...args) => {

if (typeof setImmediate === FUNCTION) {
return setImmediate;
}
if (typeof process === UNDEFINED) {

@@ -222,0 +222,0 @@ if (typeof Image === FUNCTION) { // browser polyfill

@@ -5,3 +5,3 @@ /*!

*
* Copyright 2012-2021 PushOk Software
* Copyright 2012-2023 PushOk Software
* Licensed under MIT

@@ -8,0 +8,0 @@ */

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

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