easy-web-worker 4.0.3 → 4.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -185,7 +185,7 @@ export interface IEasyWebWorkerMessage<TPayload = null, TResult = void> {
185
185
  /**
186
186
  * This method is used to resolve the message from inside the worker
187
187
  * */
188
- readonly resolve: TResult extends void ? () => void : (payload: TResult) => void;
188
+ readonly resolve: [TResult] extends [void] ? () => void : (payload: TResult) => void;
189
189
  /**
190
190
  * This method is used to cancel the message from inside the worker
191
191
  * */
@@ -289,13 +289,13 @@ export declare class EasyWebWorker<TPayload = null, TResult = void, TPrimitivePa
289
289
  * @param {TPayload} payload - whatever json data you want to send to the worker
290
290
  * @returns {IMessagePromise<TResult>} generated defer that will be resolved when the message completed
291
291
  */
292
- sendToMethod<TResult_ = void, TPayload_ = null>(method: string, payload?: TPayload_): CancelablePromise<TResult_>;
292
+ sendToMethod<TResult_ = void, TPayload_ = null>(method: string, payload?: TPayload_, transfer?: Transferable[]): CancelablePromise<TResult_>;
293
293
  /**
294
294
  * Send a message to the worker queue
295
295
  * @param {TPayload} payload - whatever json data you want to send to the worker
296
296
  * @returns {IMessagePromise<TResult>} generated defer that will be resolved when the message completed
297
297
  */
298
- send: TPayload extends null ? () => CancelablePromise<TResult> : (payload: TPayload) => CancelablePromise<TResult>;
298
+ send: [TPayload] extends [null] ? () => CancelablePromise<TResult> : (payload: TPayload) => CancelablePromise<TResult>;
299
299
  private sendToWorker;
300
300
  /**
301
301
  * This method terminate all current messages and send a new one to the worker queue
@@ -303,14 +303,14 @@ export declare class EasyWebWorker<TPayload = null, TResult = void, TPrimitivePa
303
303
  * @param {unknown} reason - reason why the worker was terminated
304
304
  * @returns {IMessagePromise<TResult>} generated defer that will be resolved when the message completed
305
305
  */
306
- override: TPayload extends null ? (reason?: unknown, config?: TOverrideConfig) => CancelablePromise<TResult> : (payload: TPayload, reason?: unknown, config?: TOverrideConfig) => CancelablePromise<TResult>;
306
+ override: [TPayload] extends [null] ? (reason?: unknown, config?: TOverrideConfig) => CancelablePromise<TResult> : (payload: TPayload, reason?: unknown, config?: TOverrideConfig) => CancelablePromise<TResult>;
307
307
  /**
308
308
  * This method will alow the current message to be completed and send a new one to the worker queue after it, all the messages after the current one will be canceled
309
309
  * @param {TPayload} payload - whatever json data you want to send to the worker should be serializable
310
310
  * @param {unknown} reason - reason why the worker was terminated
311
311
  * @returns {IMessagePromise<TResult>} generated defer that will be resolved when the message completed
312
312
  */
313
- overrideAfterCurrent: TPayload extends null ? (reason?: unknown, TOverrideConfig?: any) => CancelablePromise<TResult> : (payload: TPayload, reason?: unknown, config?: TOverrideConfig) => CancelablePromise<TResult>;
313
+ overrideAfterCurrent: [TPayload] extends [null] ? (reason?: unknown, TOverrideConfig?: any) => CancelablePromise<TResult> : (payload: TPayload, reason?: unknown, config?: TOverrideConfig) => CancelablePromise<TResult>;
314
314
  /**
315
315
  * This method will reboot the worker and cancel all the messages in the queue
316
316
  * @param {unknown} reason - reason why the worker will be restarted
package/lib/bundle.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see bundle.js.LICENSE.txt */
2
- !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["easy-web-worker"]=r():e["easy-web-worker"]=r()}(this,(()=>{return e={797:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.createEasyWebWorker=void 0;var n=t(30);r.createEasyWebWorker=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new n.EasyWebWorker(e,r)}},30:(e,r,t)=>{"use strict";function n(e){return n="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},n(e)}function o(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=i.call(t)).done)&&(c.push(n.value),c.length!==r);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,r)||i(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,r){if(e){if("string"==typeof e)return a(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?a(e,r):void 0}}function a(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function c(){c=function(){return e};var e={},r=Object.prototype,t=r.hasOwnProperty,o=Object.defineProperty||function(e,r,t){e[r]=t.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(e,r,t){return Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[r]}try{l({},"")}catch(e){l=function(e,r,t){return e[r]=t}}function f(e,r,t,n){var i=r&&r.prototype instanceof d?r:d,a=Object.create(i.prototype),c=new W(n||[]);return o(a,"_invoke",{value:j(e,t,c)}),a}function p(e,r,t){try{return{type:"normal",arg:e.call(r,t)}}catch(e){return{type:"throw",arg:e}}}e.wrap=f;var h={};function d(){}function v(){}function y(){}var m={};l(m,a,(function(){return this}));var g=Object.getPrototypeOf,b=g&&g(g(_([])));b&&b!==r&&t.call(b,a)&&(m=b);var w=y.prototype=d.prototype=Object.create(m);function k(e){["next","throw","return"].forEach((function(r){l(e,r,(function(e){return this._invoke(r,e)}))}))}function P(e,r){function i(o,a,c,u){var s=p(e[o],e,a);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==n(f)&&t.call(f,"__await")?r.resolve(f.__await).then((function(e){i("next",e,c,u)}),(function(e){i("throw",e,c,u)})):r.resolve(f).then((function(e){l.value=e,c(l)}),(function(e){return i("throw",e,c,u)}))}u(s.arg)}var a;o(this,"_invoke",{value:function(e,t){function n(){return new r((function(r,n){i(e,t,r,n)}))}return a=a?a.then(n,n):n()}})}function j(e,r,t){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(t.method=o,t.arg=i;;){var a=t.delegate;if(a){var c=O(a,t);if(c){if(c===h)continue;return c}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if("suspendedStart"===n)throw n="completed",t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);n="executing";var u=p(e,r,t);if("normal"===u.type){if(n=t.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:t.done}}"throw"===u.type&&(n="completed",t.method="throw",t.arg=u.arg)}}}function O(e,r){var t=r.method,n=e.iterator[t];if(void 0===n)return r.delegate=null,"throw"===t&&e.iterator.return&&(r.method="return",r.arg=void 0,O(e,r),"throw"===r.method)||"return"!==t&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+t+"' method")),h;var o=p(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,h;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,h):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}function E(e){var r={tryLoc:e[0]};1 in e&&(r.catchLoc=e[1]),2 in e&&(r.finallyLoc=e[2],r.afterLoc=e[3]),this.tryEntries.push(r)}function x(e){var r=e.completion||{};r.type="normal",delete r.arg,e.completion=r}function W(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function _(e){if(e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function r(){for(;++n<e.length;)if(t.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return o.next=o}}return{next:S}}function S(){return{value:void 0,done:!0}}return v.prototype=y,o(w,"constructor",{value:y,configurable:!0}),o(y,"constructor",{value:v,configurable:!0}),v.displayName=l(y,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var r="function"==typeof e&&e.constructor;return!!r&&(r===v||"GeneratorFunction"===(r.displayName||r.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,l(e,s,"GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},k(P.prototype),l(P.prototype,u,(function(){return this})),e.AsyncIterator=P,e.async=function(r,t,n,o,i){void 0===i&&(i=Promise);var a=new P(f(r,t,n,o),i);return e.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(w),l(w,s,"Generator"),l(w,a,(function(){return this})),l(w,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var r=Object(e),t=[];for(var n in r)t.push(n);return t.reverse(),function e(){for(;t.length;){var n=t.pop();if(n in r)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=_,W.prototype={constructor:W,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var r in this)"t"===r.charAt(0)&&t.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t,n){return a.type="throw",a.arg=e,r.next=t,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=t.call(i,"catchLoc"),u=t.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&t.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),h},finish:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),x(t),h}},catch:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.tryLoc===e){var n=t.completion;if("throw"===n.type){var o=n.arg;x(t)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,t){return this.delegate={iterator:_(e),resultName:r,nextLoc:t},"next"===this.method&&(this.arg=void 0),h}},e}function u(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(void 0,i=function(e,r){if("object"!==n(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(o.key),"symbol"===n(i)?i:String(i)),o)}var i}var s=function(e,r,t,n){return new(t||(t=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function c(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(a,c)}u((n=n.apply(e,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:!0}),r.EasyWebWorker=r.createBlobWorker=void 0;var l=t(213),f=t(726),p=t(367);r.createBlobWorker=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).primitiveParameters,o=void 0===n?[]:n,i=Array.isArray(e)?e:[e],a="self.primitiveParameters=JSON.parse(`".concat(JSON.stringify(null!=o?o:[]),"`);").concat(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.length?'self.importScripts(["'.concat(e.join('","'),'"]);'):""}(r)).concat((0,f.getWorkerTemplate)()).concat(i.map((function(e){return'self.ew$=self.cw$("'.concat(t,'");(').concat(e,")(self.ew$, self);")})).join(""));return(window.URL||window.webkitURL).createObjectURL(new Blob([a],{type:"application/javascript"}))};var h=function(){function e(r){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.scripts,a=void 0===i?[]:i,u=n.name,h=n.onWorkerError,d=void 0===h?null:h,v=n.url,y=void 0===v?null:v,m=n.maxWorkers,g=void 0===m?1:m,b=n.keepAlive,w=void 0===b?null:b,k=n.terminationDelay,P=void 0===k?1e3:k,j=n.warmUpWorkers,O=void 0===j?null:j,E=n.primitiveParameters,x=n.origin,W=void 0===x?"":x,_=n.workerOptions;!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),this.source=r,this.maxWorkers=1,this.workers=[],this.keepAlive=!0,this.warmUpWorkers=!1,this.terminationDelay=1e3,this.origin="",this.primitiveParameters=[],this.messagesQueue=new Map,this.workerUrl=null,this.scripts=[],this.warmUp=function(){if(t.warmUpWorkers){var e=t.maxWorkers;new Array(e).fill(null).forEach((function(){return t.getWorkerFromPool()}))}},this.fillWorkerMethods=function(e){return e.onmessage=function(e){t.executeMessageCallback(e)},e.onerror=function(e){if(!t.onWorkerError)throw e;t.onWorkerError(e)},e},this.createNewWorker=function(){var e,r=new Worker(t.workerUrl,Object.assign(Object.assign({},t.workerOptions),{name:(e=t.workers.length,0===e?t.name:"".concat(t.name,"-").concat(e))}));return t.fillWorkerMethods(r)},this.getWorkerFromPool=function(){var e=t.maxWorkers,r=t.messagesQueue.size;if(!t.workers.length||t.workers.length<e&&r){var n=t.createNewWorker();return t.workers.push(n),n}var o=t.workers.shift();return t.workers.push(o),o},this.computeWorkerBaseSource=function(){var e=function(){var e,r;if(t.source instanceof Worker)return t.workers=[t.fillWorkerMethods(t.source)],{isArrayOfWebWorkers:!1,workerUrl:null};var n="string"==typeof t.source,o="function"==typeof t.source;if(n||o)return{isArrayOfWebWorkers:!1,workerUrl:null!==(e=t.workerUrl)&&void 0!==e?e:t.getWorkerUrl()};var i=Array.isArray(t.source);if(i&&"function"==typeof t.source[0])return{isArrayOfWebWorkers:!1,workerUrl:null!==(r=t.workerUrl)&&void 0!==r?r:t.getWorkerUrl()};var a=i&&t.source[0]instanceof Worker;return a?(t.workers=t.source.map(t.fillWorkerMethods),{isArrayOfWebWorkers:a,workerUrl:null}):{isArrayOfWebWorkers:!1,workerUrl:null}}(),r=e.workerUrl,n=e.isArrayOfWebWorkers;t.workerUrl=r,t.maxWorkers=n?t.workers.length:t.maxWorkers,t.keepAlive=!!n||t.keepAlive},this.send=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var o=r[0];return t.sendToWorker({payload:o})},this.sendToWorker=function(e){var r,n,o=e.payload,i=e.method,a=new l.EasyWebWorkerMessage,c=a.messageId,u=a.decoupledPromise,s=u.cancel,f=t.getWorkerFromPool();u.promise.cancel=function(e){u.cancel=s;var r={messageId:c,method:i,cancelation:{reason:e}};return t.workers.length?(f.postMessage(r),u.promise):(s(e),(0,p.toCancelablePromise)(Promise.reject(e)))},t.keepAlive||null===(n=null===(r=u.promise)||void 0===r?void 0:r.finally)||void 0===n||n.call(r,(function(){setTimeout((function(){t.messagesQueue.size||(t.workers.forEach((function(e){return e.terminate()})),t.workers=[])}),t.terminationDelay)})),t.addMessageToQueue(a);var h={messageId:c,method:i,execution:{payload:o}};return f.postMessage(h),u.promise},this.override=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var o=r[0],i=r[1],a=r[2];return s(t,void 0,void 0,c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.cancelAll(i,a);case 2:return e.abrupt("return",this.send.apply(this,[o]));case 3:case"end":return e.stop()}}),e,this)})))},this.overrideAfterCurrent=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i=r[0],a=r[1],u=r[2];return s(t,void 0,void 0,c().mark((function e(){var r,t,n,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.messagesQueue.size){e.next=7;break}return r=o(this.messagesQueue,1),t=r[0],n=o(t,2),s=n[1],this.RemoveMessageFromQueue(s.messageId),e.next=6,this.cancelAll(a,u);case 6:this.addMessageToQueue(s);case 7:return e.abrupt("return",this.send.apply(this,[i]));case 8:case"end":return e.stop()}}),e,this)})))};var S=!g||1===g||O,C=S||null!=w&&w;this.workerOptions=null!=_?_:{},this.name=this.workerOptions.name||u||(0,f.generatedId)(),this.scripts=a,this.onWorkerError=d,this.workerUrl=null!=y?y:null,this.maxWorkers=g,this.keepAlive=C,this.terminationDelay=P,this.warmUpWorkers=S,this.primitiveParameters=null!=E?E:[],this.origin=W,this.computeWorkerBaseSource(),this.warmUp()}var t,n;return t=e,n=[{key:"worker",get:function(){return this.workers.length>1?null:this.workers[0]}},{key:"isExternalWorkerFile",get:function(){return"string"==typeof this.source}},{key:"RemoveMessageFromQueue",value:function(e){this.messagesQueue.delete(e)}},{key:"executeMessageCallback",value:function(e){var r,t,n=null!==(r=this.messagesQueue.get(e.data.messageId))&&void 0!==r?r:null;if(n){var o=e.data.progress;if(this.workers.length){var c=n.decoupledPromise;if(o){var u=o.percentage,s=o.payload;c.reportProgress(u,s)}else{this.RemoveMessageFromQueue(n.messageId);var l=e.data.worker_canceled;if(l){var f=l.reason;c.reject(f)}else{var p=e.data.rejected;if(p){var h=p.reason;c.reject(h)}else{var d=e.data.resolved.payload;c.resolve.apply(c,function(e){if(Array.isArray(e))return a(e)}(t=null!=d?d:[])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||i(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}}}}else this.RemoveMessageFromQueue(n.messageId)}}},{key:"getWorkerUrl",value:function(){var e;return this.isExternalWorkerFile?this.source:(0,r.createBlobWorker)(this.source,this.scripts,null!==(e=this.origin)&&void 0!==e?e:"",{primitiveParameters:this.primitiveParameters})}},{key:"cancelAll",value:function(e){var r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).force,t=void 0!==r&&r,n=Array.from(this.messagesQueue.values()),o=100/n.length;if(t)return this.reboot(e);var i=n.map((function(r){var t=r.decoupledPromise.promise;return t.cancel(e).catch((function(e){return t.reportProgress(o,e),e}))}));return Promise.all(i)}},{key:"addMessageToQueue",value:function(e){this.messagesQueue.set(e.messageId,e)}},{key:"sendToMethod",value:function(e,r){return this.sendToWorker({method:e,payload:r})}},{key:"reboot",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Worker was rebooted";if(!this.workerUrl)throw new Error("You can not reboot a worker that was created from a Worker Instance");this.workers.forEach((function(e){return e.terminate()})),this.workers=[];var r=this.cancelAll(e);return this.warmUp(),r}},{key:"dispose",value:function(){return s(this,void 0,void 0,c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.cancelAll(null);case 2:this.workerUrl&&URL.revokeObjectURL(this.workerUrl),this.workers.forEach((function(e){return e.terminate()})),this.workers=[];case 5:case"end":return e.stop()}}),e,this)})))}}],n&&u(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();r.EasyWebWorker=h},726:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getWorkerTemplate=r.generatedId=void 0,r.generatedId=function(){return"".concat(Date.now()).concat(Math.random().toString(36).substring(2,9))},r.getWorkerTemplate=function(){return"self.cw$=a=>{const b=new Map(),c=new Map([['',()=>{throw\"you didn't defined a message-callback, please assign a callback by calling IEasyWorkerInstance.onMessage\"}]]),d=({messageId:e,payload:f,origin:g})=>{const h=new Set(),i=j=>{const{progress:k}=j;k||b.delete(e),self.postMessage({messageId:e,...j},g)},l=(...m)=>{i({resolved:{payload:m}})},n=o=>{i({rejected:{reason:o}})},p=q=>{[...h].forEach(r=>r(q)),i({worker_canceled:{reason:q}})},s=(t,u)=>{i({progress:{percentage:t,payload:u}})},v=w=>(h.add(w),()=>h.delete(w));return{payload:f,resolve:l,reject:n,cancel:p,onCancel:v,reportProgress:s}},x=(...y)=>{self.importScripts(...y)},z=(...A)=>{const[B,C]=A,D=typeof B==='string';if(D){const E=B,F=C;c.set(E,F);return;}const G=B;c.set('',G)},H=()=>{[...b.values()].forEach(I=>I.reject(new Error('worker closed')));self.close();};self.onmessage=J=>{const{data:K,origin:L}=J,{messageId:M,cancelation:N}=K;if(N){const{reason:O}=N,P=b.get(M);P.cancel(O);return;}const{method:Q,execution:R}=K,{payload:S}=R,T=d({messageId:M,payload:S,origin:a||L||undefined});b.set(M,T);const U=c.get(Q||'');U(T,J)};return{importScripts:x,onMessage:z,close:H}};"}},213:(e,r,t)=>{"use strict";function n(e){return n="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},n(e)}function o(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(void 0,i=function(e,r){if("object"!==n(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(o.key),"symbol"===n(i)?i:String(i)),o)}var i}function i(e,r,t){return r&&o(e.prototype,r),t&&o(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(r,"__esModule",{value:!0}),r.EasyWebWorkerMessage=void 0;var a=t(367),c=t(726),u=i((function e(){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),this.messageId=(0,c.generatedId)(),this.decoupledPromise=(0,a.createDecoupledPromise)()}));r.EasyWebWorkerMessage=u},973:(e,r)=>{"use strict";function t(e){return function(e){if(Array.isArray(e))return n(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,r){if(e){if("string"==typeof e)return n(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?n(e,r):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}Object.defineProperty(r,"__esModule",{value:!0}),r.createStaticEasyWebWorker=r.StaticEasyWebWorker=void 0,r.StaticEasyWebWorker=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=new Map,o=new Map([["",function(){throw"you didn't defined a message-callback, please assign a callback by calling IEasyWorkerInstance.onMessage"}]]),i=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];var n=r[0],i=r[1];if("string"==typeof n){var a=n,c=i;o.set(a,c)}else{var u=n;o.set("",u)}};self.onmessage=function(e){var i=e.data,a=e.origin,c=i.messageId,u=i.cancelation;if(u){var s=u.reason;n.get(c).cancel(s)}else{var l=e.data,f=l.method,p=function(e){var r=e.messageId,o=e.payload,i=e.origin,a=new Set,c=function(e){e.progress||n.delete(r),self.postMessage(Object.assign({messageId:r},e),i)};return{payload:o,resolve:function(){var e=Array.from(arguments);c({resolved:{payload:e}})},reject:function(e){c({rejected:{reason:e}})},cancel:function(e){t(a).forEach((function(r){return r(e)})),c({canceled:{reason:e}})},onCancel:function(e){return a.add(e),function(){return a.delete(e)}},reportProgress:function(e,r){c({progress:{percentage:e,payload:r}})}}}({messageId:c,payload:l.execution.payload,origin:r||a||void 0});o.get(f||"")(p,e)}},e&&i(e),this.importScripts=function(){var e;(e=self).importScripts.apply(e,arguments)},this.close=function(){t(n.values()).forEach((function(e){return e.reject(new Error("worker closed"))})),self.close()},this.onMessage=i},r.createStaticEasyWebWorker=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return new r.StaticEasyWebWorker(e,t)}},991:(e,r,t)=>{"use strict";var n=Object.create?function(e,r,t,n){void 0===n&&(n=t);var o=Object.getOwnPropertyDescriptor(r,t);o&&!("get"in o?!r.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,n,o)}:function(e,r,t,n){void 0===n&&(n=t),e[n]=r[t]},o=function(e,r){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(r,t)||n(r,e,t)};Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=t(30);Object.defineProperty(r,"default",{enumerable:!0,get:function(){return i.EasyWebWorker}}),o(t(30),r),o(t(973),r),o(t(797),r)},367:function(e){var r;r=()=>(()=>{"use strict";var e={399:(e,r)=>{function t(e){return t="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},t(e)}function n(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function o(){return o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,r,t){var n=function(e,r){for(;!Object.prototype.hasOwnProperty.call(e,r)&&null!==(e=s(e)););return e}(e,r);if(n){var o=Object.getOwnPropertyDescriptor(n,r);return o.get?o.get.call(arguments.length<3?e:t):o.value}},o.apply(this,arguments)}function i(e){var r="function"==typeof Map?new Map:void 0;return i=function(e){if(null===e||(t=e,-1===Function.toString.call(t).indexOf("[native code]")))return e;var t;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,n)}function n(){return a(e,arguments,s(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),u(n,e)},i(e)}function a(e,r,t){return a=c()?Reflect.construct.bind():function(e,r,t){var n=[null];n.push.apply(n,r);var o=new(Function.bind.apply(e,n));return t&&u(o,t.prototype),o},a.apply(null,arguments)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function u(e,r){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},u(e,r)}function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.CancelablePromise=void 0;var l=function(e){!function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&u(e,r)}(f,e);var r,i,a,l=(i=f,a=c(),function(){var e,r=s(i);if(a){var o=s(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return function(e,r){if(r&&("object"===t(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return n(e)}(this,e)});function f(e){var r,t,i,a,c,u;return function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,f),(a=l.call(this,(function(e,r){c=e,u=r}))).status="pending",a.cancelCallbacks=[],a.ownCancelCallbacks=[],a.onProgressCallbacks=[],a.subscribeToOwnCancelEvent=function(e){a.ownCancelCallbacks.push(e)},a.cancel=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if("pending"===a.status)return a.status="canceled",a.ownCancelCallbacks.forEach((function(r){return r(e)})),a.cancelCallbacks.forEach((function(r){return r(e)})),a.reject(e),a.cancelCallbacks=[],a.ownCancelCallbacks=[],n(a)},a.onCancel=function(e){return a.cancelCallbacks.push(e),n(a)},a.onProgress=function(e){return a.onProgressCallbacks.push(e),n(a)},a.reportProgress=function(e,r){return a.onProgressCallbacks.forEach((function(t){return t(e,r)})),n(a)},a.createChildPromise=function(){var e,r,t=new f((function(t,n,o){e=t,r=n}));return t.onProgressCallbacks=a.onProgressCallbacks,t.onCancel((function(e){a.cancel(e)})),{promise:t,resolve:e,reject:r}},a.resolve=c,a.reject=u,e((function(e){a.status="resolved",a.resolve(e)}),(function(e){a.status="rejected",a.reject(e)}),{cancel:function(e){return a.cancel(e)},onCancel:function(e){return a.subscribeToOwnCancelEvent(e),n(a)},onProgress:function(e){return a.onProgress(e)},reportProgress:function(e,r){a.reportProgress(e,r)}}),a.then=function(e,t){var i=a.createChildPromise(),c=i.promise,u=i.resolve,l=i.reject;return o((r=n(a),s(f.prototype)),"then",r).call(r,e,t).then(u,l),c},a.catch=function(e){var r=a.createChildPromise(),i=r.promise,c=r.resolve,u=r.reject;return o((t=n(a),s(f.prototype)),"catch",t).call(t,e).then(c,u),i},a.finally=function(e){var r=a.createChildPromise(),t=r.promise,c=r.resolve,u=r.reject;return o((i=n(a),s(f.prototype)),"finally",i).call(i,e).then(c,u),t},a}return r=f,Object.defineProperty(r,"prototype",{writable:!1}),r}(i(Promise));r.CancelablePromise=l,l.prototype.constructor=Promise},716:(e,r,t)=>{function n(e){return n="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},n(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.toCancelablePromise=r.isPromise=r.groupAsCancelablePromise=r.createDecoupledPromise=r.allSettledCancelable=void 0;var o=t(335),i=t(399);function a(){a=function(){return e};var e={},r=Object.prototype,t=r.hasOwnProperty,o=Object.defineProperty||function(e,r,t){e[r]=t.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(e,r,t){return Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[r]}try{l({},"")}catch(e){l=function(e,r,t){return e[r]=t}}function f(e,r,t,n){var i=r&&r.prototype instanceof d?r:d,a=Object.create(i.prototype),c=new W(n||[]);return o(a,"_invoke",{value:j(e,t,c)}),a}function p(e,r,t){try{return{type:"normal",arg:e.call(r,t)}}catch(e){return{type:"throw",arg:e}}}e.wrap=f;var h={};function d(){}function v(){}function y(){}var m={};l(m,c,(function(){return this}));var g=Object.getPrototypeOf,b=g&&g(g(_([])));b&&b!==r&&t.call(b,c)&&(m=b);var w=y.prototype=d.prototype=Object.create(m);function k(e){["next","throw","return"].forEach((function(r){l(e,r,(function(e){return this._invoke(r,e)}))}))}function P(e,r){function i(o,a,c,u){var s=p(e[o],e,a);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==n(f)&&t.call(f,"__await")?r.resolve(f.__await).then((function(e){i("next",e,c,u)}),(function(e){i("throw",e,c,u)})):r.resolve(f).then((function(e){l.value=e,c(l)}),(function(e){return i("throw",e,c,u)}))}u(s.arg)}var a;o(this,"_invoke",{value:function(e,t){function n(){return new r((function(r,n){i(e,t,r,n)}))}return a=a?a.then(n,n):n()}})}function j(e,r,t){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(t.method=o,t.arg=i;;){var a=t.delegate;if(a){var c=O(a,t);if(c){if(c===h)continue;return c}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if("suspendedStart"===n)throw n="completed",t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);n="executing";var u=p(e,r,t);if("normal"===u.type){if(n=t.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:t.done}}"throw"===u.type&&(n="completed",t.method="throw",t.arg=u.arg)}}}function O(e,r){var t=r.method,n=e.iterator[t];if(void 0===n)return r.delegate=null,"throw"===t&&e.iterator.return&&(r.method="return",r.arg=void 0,O(e,r),"throw"===r.method)||"return"!==t&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+t+"' method")),h;var o=p(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,h;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,h):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}function E(e){var r={tryLoc:e[0]};1 in e&&(r.catchLoc=e[1]),2 in e&&(r.finallyLoc=e[2],r.afterLoc=e[3]),this.tryEntries.push(r)}function x(e){var r=e.completion||{};r.type="normal",delete r.arg,e.completion=r}function W(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function _(e){if(e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function r(){for(;++n<e.length;)if(t.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return o.next=o}}return{next:S}}function S(){return{value:void 0,done:!0}}return v.prototype=y,o(w,"constructor",{value:y,configurable:!0}),o(y,"constructor",{value:v,configurable:!0}),v.displayName=l(y,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var r="function"==typeof e&&e.constructor;return!!r&&(r===v||"GeneratorFunction"===(r.displayName||r.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,l(e,s,"GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},k(P.prototype),l(P.prototype,u,(function(){return this})),e.AsyncIterator=P,e.async=function(r,t,n,o,i){void 0===i&&(i=Promise);var a=new P(f(r,t,n,o),i);return e.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(w),l(w,s,"Generator"),l(w,c,(function(){return this})),l(w,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var r=Object(e),t=[];for(var n in r)t.push(n);return t.reverse(),function e(){for(;t.length;){var n=t.pop();if(n in r)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=_,W.prototype={constructor:W,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var r in this)"t"===r.charAt(0)&&t.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t,n){return a.type="throw",a.arg=e,r.next=t,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=t.call(i,"catchLoc"),u=t.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&t.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),h},finish:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),x(t),h}},catch:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.tryLoc===e){var n=t.completion;if("throw"===n.type){var o=n.arg;x(t)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,t){return this.delegate={iterator:_(e),resultName:r,nextLoc:t},"next"===this.method&&(this.arg=void 0),h}},e}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}r.createDecoupledPromise=function(){var e,r,t,n=new i.CancelablePromise((function(n,o,i){e=n,r=o,t=i}));return Object.assign(Object.assign({resolve:e,reject:r},t),{promise:n})};var u=function e(r){if(r instanceof i.CancelablePromise)return r;if("function"==typeof r)return e(r());if(!l(r))return new i.CancelablePromise((function(e){return e(r)}));var t,n,o=new i.CancelablePromise((function(e,o,i){t=e,n=o,r.then(t,n)}));return o.onCancel((function(e){n(e)})),o};r.toCancelablePromise=u;var s=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e.length)return null;var t,n=r.maxConcurrent,o=void 0===n?8:n,a=r.executeInOrder,s=void 0!==a&&a,l=r.beforeEachCallback,f=void 0===l?null:l,p=r.afterEachCallback,h=void 0===p?null:p,d=r.onQueueEmptyCallback,v=void 0===d?null:d,y=function(e){if(Array.isArray(e))return c(e)}(t=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),m=[];return new i.CancelablePromise((function(e,r,t){return function e(){if(y.length){var r=y.splice(0,o).map((function(e){var r="function"==typeof e?e():e;null==f||f();var n=u(r);return t.onCancel((function(){n.cancel()})),n.then((function(e){m.push(e),null==h||h(e)})),s?n.then((function(e){return e})):n}));return Promise.all(r).then((function(){return e()}))}}().then((function(){null==v||v(m),e(m)}))}))};r.groupAsCancelablePromise=s;var l=function(e){return Promise.resolve(e)===e};r.isPromise=l,r.allSettledCancelable=function(e){var r=[],t=e.map((function(e){var t=u(e);return r.push(t),(0,o.tryCatchPromise)((function(){return t})).then((function(e){return{error:e.error,result:e.result,promise:t}}))})),n=s(r);return new i.CancelablePromise((function(e,r,o){return i=void 0,c=a().mark((function r(){var i;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return o.onCancel(n.cancel),r.next=3,Promise.all(t);case 3:i=r.sent,e(i);case 5:case"end":return r.stop()}}),r)})),new(i||(i=Promise))((function(e,r){function t(e){try{o(c.next(e))}catch(e){r(e)}}function n(e){try{o(c.throw(e))}catch(e){r(e)}}function o(r){var o;r.done?e(r.value):(o=r.value,o instanceof i?o:new i((function(e){e(o)}))).then(t,n)}o((c=c.apply(void 0,[])).next())}));var i,c}))}},522:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0});var n=t(399);Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===n[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return n[e]}}))}));var o=t(716);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===o[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return o[e]}}))}))},991:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0});var n=t(522);Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===n[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return n[e]}}))}));var o=t(335);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===o[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return o[e]}}))}))},335:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0});var n=t(969);Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===n[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return n[e]}}))}))},969:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0});var n=t(948);Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===n[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return n[e]}}))}));var o=t(667);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===o[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return o[e]}}))}))},948:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tryCatchPromise=r.tryCatch=void 0;var n=t(522);r.tryCatch=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=r.defaultResult,n=void 0===t?null:t,o=r.exceptionHandlingType,i=void 0===o?"error":o;try{return{error:null,result:e()}}catch(e){return"ignore"!==i&&console[i](e),{error:e,result:n}}},r.tryCatchPromise=function(e,r){var t=r||{},o=t.defaultResult,i=void 0===o?null:o,a=t.exceptionHandlingType,c=void 0===a?"error":a,u=t.ignoreCancel,s=void 0===u||u,l=null,f=null,p=function(e){f=e,"ignore"!=c&&("canceled"===l.status&&s||console[c](f))};try{if(e instanceof n.CancelablePromise)return l=e,new Promise((function(e){l.then((function(e){return{error:null,result:e,promise:l}})).catch((function(e){return p(e),{error:e,result:i,promise:l}}))}));var h=e(),d=h instanceof n.CancelablePromise;return l=d?h:(0,n.toCancelablePromise)(h),new Promise((function(e){l.then((function(r){e({error:null,result:r,promise:l})})).catch((function(r){p(r),e({error:r,result:i,promise:l})}))}))}catch(e){return p(e),Promise.resolve({error:f,result:i,promise:l})}}},667:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0})}},r={};return function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n](i,i.exports,t),i.exports}(991)})(),e.exports=r()}},r={},function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n].call(i.exports,i,i.exports,t),i.exports}(991);var e,r}));
2
+ !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["easy-web-worker"]=r():e["easy-web-worker"]=r()}(this,(()=>{return e={797:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.createEasyWebWorker=void 0;var n=t(30);r.createEasyWebWorker=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new n.EasyWebWorker(e,r)}},30:(e,r,t)=>{"use strict";function n(e){return n="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},n(e)}function o(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;u=!1}else for(;!(u=(n=i.call(t)).done)&&(c.push(n.value),c.length!==r);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,r)||i(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,r){if(e){if("string"==typeof e)return a(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?a(e,r):void 0}}function a(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function c(){c=function(){return e};var e={},r=Object.prototype,t=r.hasOwnProperty,o=Object.defineProperty||function(e,r,t){e[r]=t.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(e,r,t){return Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[r]}try{l({},"")}catch(e){l=function(e,r,t){return e[r]=t}}function f(e,r,t,n){var i=r&&r.prototype instanceof d?r:d,a=Object.create(i.prototype),c=new W(n||[]);return o(a,"_invoke",{value:j(e,t,c)}),a}function p(e,r,t){try{return{type:"normal",arg:e.call(r,t)}}catch(e){return{type:"throw",arg:e}}}e.wrap=f;var h={};function d(){}function v(){}function y(){}var m={};l(m,a,(function(){return this}));var g=Object.getPrototypeOf,b=g&&g(g(_([])));b&&b!==r&&t.call(b,a)&&(m=b);var w=y.prototype=d.prototype=Object.create(m);function k(e){["next","throw","return"].forEach((function(r){l(e,r,(function(e){return this._invoke(r,e)}))}))}function P(e,r){function i(o,a,c,u){var s=p(e[o],e,a);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==n(f)&&t.call(f,"__await")?r.resolve(f.__await).then((function(e){i("next",e,c,u)}),(function(e){i("throw",e,c,u)})):r.resolve(f).then((function(e){l.value=e,c(l)}),(function(e){return i("throw",e,c,u)}))}u(s.arg)}var a;o(this,"_invoke",{value:function(e,t){function n(){return new r((function(r,n){i(e,t,r,n)}))}return a=a?a.then(n,n):n()}})}function j(e,r,t){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(t.method=o,t.arg=i;;){var a=t.delegate;if(a){var c=O(a,t);if(c){if(c===h)continue;return c}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if("suspendedStart"===n)throw n="completed",t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);n="executing";var u=p(e,r,t);if("normal"===u.type){if(n=t.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:t.done}}"throw"===u.type&&(n="completed",t.method="throw",t.arg=u.arg)}}}function O(e,r){var t=r.method,n=e.iterator[t];if(void 0===n)return r.delegate=null,"throw"===t&&e.iterator.return&&(r.method="return",r.arg=void 0,O(e,r),"throw"===r.method)||"return"!==t&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+t+"' method")),h;var o=p(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,h;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,h):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}function E(e){var r={tryLoc:e[0]};1 in e&&(r.catchLoc=e[1]),2 in e&&(r.finallyLoc=e[2],r.afterLoc=e[3]),this.tryEntries.push(r)}function x(e){var r=e.completion||{};r.type="normal",delete r.arg,e.completion=r}function W(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function _(e){if(e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function r(){for(;++n<e.length;)if(t.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return o.next=o}}return{next:S}}function S(){return{value:void 0,done:!0}}return v.prototype=y,o(w,"constructor",{value:y,configurable:!0}),o(y,"constructor",{value:v,configurable:!0}),v.displayName=l(y,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var r="function"==typeof e&&e.constructor;return!!r&&(r===v||"GeneratorFunction"===(r.displayName||r.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,l(e,s,"GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},k(P.prototype),l(P.prototype,u,(function(){return this})),e.AsyncIterator=P,e.async=function(r,t,n,o,i){void 0===i&&(i=Promise);var a=new P(f(r,t,n,o),i);return e.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(w),l(w,s,"Generator"),l(w,a,(function(){return this})),l(w,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var r=Object(e),t=[];for(var n in r)t.push(n);return t.reverse(),function e(){for(;t.length;){var n=t.pop();if(n in r)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=_,W.prototype={constructor:W,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var r in this)"t"===r.charAt(0)&&t.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t,n){return a.type="throw",a.arg=e,r.next=t,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=t.call(i,"catchLoc"),u=t.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&t.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),h},finish:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),x(t),h}},catch:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.tryLoc===e){var n=t.completion;if("throw"===n.type){var o=n.arg;x(t)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,t){return this.delegate={iterator:_(e),resultName:r,nextLoc:t},"next"===this.method&&(this.arg=void 0),h}},e}function u(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(void 0,i=function(e,r){if("object"!==n(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(o.key),"symbol"===n(i)?i:String(i)),o)}var i}var s=function(e,r,t,n){return new(t||(t=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function c(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(a,c)}u((n=n.apply(e,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:!0}),r.EasyWebWorker=r.createBlobWorker=void 0;var l=t(213),f=t(726),p=t(367);r.createBlobWorker=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).primitiveParameters,o=void 0===n?[]:n,i=Array.isArray(e)?e:[e],a="self.primitiveParameters=JSON.parse(`".concat(JSON.stringify(null!=o?o:[]),"`);").concat(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.length?'self.importScripts(["'.concat(e.join('","'),'"]);'):""}(r)).concat((0,f.getWorkerTemplate)()).concat(i.map((function(e){return'self.ew$=self.cw$("'.concat(t,'");(').concat(e,")(self.ew$, self);")})).join(""));return(window.URL||window.webkitURL).createObjectURL(new Blob([a],{type:"application/javascript"}))};var h=function(){function e(r){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.scripts,a=void 0===i?[]:i,u=n.name,h=n.onWorkerError,d=void 0===h?null:h,v=n.url,y=void 0===v?null:v,m=n.maxWorkers,g=void 0===m?1:m,b=n.keepAlive,w=void 0===b?null:b,k=n.terminationDelay,P=void 0===k?1e3:k,j=n.warmUpWorkers,O=void 0===j?null:j,E=n.primitiveParameters,x=n.origin,W=void 0===x?"":x,_=n.workerOptions;!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),this.source=r,this.maxWorkers=1,this.workers=[],this.keepAlive=!0,this.warmUpWorkers=!1,this.terminationDelay=1e3,this.origin="",this.primitiveParameters=[],this.messagesQueue=new Map,this.workerUrl=null,this.scripts=[],this.warmUp=function(){if(t.warmUpWorkers){var e=t.maxWorkers;new Array(e).fill(null).forEach((function(){return t.getWorkerFromPool()}))}},this.fillWorkerMethods=function(e){return e.onmessage=function(e){t.executeMessageCallback(e)},e.onerror=function(e){if(!t.onWorkerError)throw e;t.onWorkerError(e)},e},this.createNewWorker=function(){var e,r=new Worker(t.workerUrl,Object.assign(Object.assign({},t.workerOptions),{name:(e=t.workers.length,0===e?t.name:"".concat(t.name,"-").concat(e))}));return t.fillWorkerMethods(r)},this.getWorkerFromPool=function(){var e=t.maxWorkers,r=t.messagesQueue.size;if(!t.workers.length||t.workers.length<e&&r){var n=t.createNewWorker();return t.workers.push(n),n}var o=t.workers.shift();return t.workers.push(o),o},this.computeWorkerBaseSource=function(){var e=function(){var e,r;if(t.source instanceof Worker)return t.workers=[t.fillWorkerMethods(t.source)],{isArrayOfWebWorkers:!1,workerUrl:null};var n="string"==typeof t.source,o="function"==typeof t.source;if(n||o)return{isArrayOfWebWorkers:!1,workerUrl:null!==(e=t.workerUrl)&&void 0!==e?e:t.getWorkerUrl()};var i=Array.isArray(t.source);if(i&&"function"==typeof t.source[0])return{isArrayOfWebWorkers:!1,workerUrl:null!==(r=t.workerUrl)&&void 0!==r?r:t.getWorkerUrl()};var a=i&&t.source[0]instanceof Worker;return a?(t.workers=t.source.map(t.fillWorkerMethods),{isArrayOfWebWorkers:a,workerUrl:null}):{isArrayOfWebWorkers:!1,workerUrl:null}}(),r=e.workerUrl,n=e.isArrayOfWebWorkers;t.workerUrl=r,t.maxWorkers=n?t.workers.length:t.maxWorkers,t.keepAlive=!!n||t.keepAlive},this.send=function(e,r){return t.sendToWorker({payload:e},r)},this.sendToWorker=function(e,r){var n,o,i=e.payload,a=e.method,c=new l.EasyWebWorkerMessage,u=c.messageId,s=c.decoupledPromise,f=s.cancel,h=t.getWorkerFromPool();s.promise.cancel=function(e){s.cancel=f;var n={messageId:u,method:a,cancelation:{reason:e}};return t.workers.length?(h.postMessage(n,r),s.promise):(f(e),(0,p.toCancelablePromise)(Promise.reject(e)))},t.keepAlive||null===(o=null===(n=s.promise)||void 0===n?void 0:n.finally)||void 0===o||o.call(n,(function(){setTimeout((function(){t.messagesQueue.size||(t.workers.forEach((function(e){return e.terminate()})),t.workers=[])}),t.terminationDelay)})),t.addMessageToQueue(c);var d={messageId:u,method:a,execution:{payload:i}};return h.postMessage(d),s.promise},this.override=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var o=r[0],i=r[1],a=r[2];return s(t,void 0,void 0,c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.cancelAll(i,a);case 2:return e.abrupt("return",this.send.apply(this,[o]));case 3:case"end":return e.stop()}}),e,this)})))},this.overrideAfterCurrent=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i=r[0],a=r[1],u=r[2];return s(t,void 0,void 0,c().mark((function e(){var r,t,n,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.messagesQueue.size){e.next=7;break}return r=o(this.messagesQueue,1),t=r[0],n=o(t,2),s=n[1],this.RemoveMessageFromQueue(s.messageId),e.next=6,this.cancelAll(a,u);case 6:this.addMessageToQueue(s);case 7:return e.abrupt("return",this.send.apply(this,[i]));case 8:case"end":return e.stop()}}),e,this)})))};var S=!g||1===g||O,C=S||null!=w&&w;this.workerOptions=null!=_?_:{},this.name=this.workerOptions.name||u||(0,f.generatedId)(),this.scripts=a,this.onWorkerError=d,this.workerUrl=null!=y?y:null,this.maxWorkers=g,this.keepAlive=C,this.terminationDelay=P,this.warmUpWorkers=S,this.primitiveParameters=null!=E?E:[],this.origin=W,this.computeWorkerBaseSource(),this.warmUp()}var t,n;return t=e,n=[{key:"worker",get:function(){return this.workers.length>1?null:this.workers[0]}},{key:"isExternalWorkerFile",get:function(){return"string"==typeof this.source}},{key:"RemoveMessageFromQueue",value:function(e){this.messagesQueue.delete(e)}},{key:"executeMessageCallback",value:function(e){var r,t,n=null!==(r=this.messagesQueue.get(e.data.messageId))&&void 0!==r?r:null;if(n){var o=e.data.progress;if(this.workers.length){var c=n.decoupledPromise;if(o){var u=o.percentage,s=o.payload;c.reportProgress(u,s)}else{this.RemoveMessageFromQueue(n.messageId);var l=e.data.worker_canceled;if(l){var f=l.reason;c.reject(f)}else{var p=e.data.rejected;if(p){var h=p.reason;c.reject(h)}else{var d=e.data.resolved.payload;c.resolve.apply(c,function(e){if(Array.isArray(e))return a(e)}(t=null!=d?d:[])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||i(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}}}}else this.RemoveMessageFromQueue(n.messageId)}}},{key:"getWorkerUrl",value:function(){var e;return this.isExternalWorkerFile?this.source:(0,r.createBlobWorker)(this.source,this.scripts,null!==(e=this.origin)&&void 0!==e?e:"",{primitiveParameters:this.primitiveParameters})}},{key:"cancelAll",value:function(e){var r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).force,t=void 0!==r&&r,n=Array.from(this.messagesQueue.values()),o=100/n.length;if(t)return this.reboot(e);var i=n.map((function(r){var t=r.decoupledPromise.promise;return t.cancel(e).catch((function(e){return t.reportProgress(o,e),e}))}));return Promise.all(i)}},{key:"addMessageToQueue",value:function(e){this.messagesQueue.set(e.messageId,e)}},{key:"sendToMethod",value:function(e,r,t){return this.sendToWorker({method:e,payload:r},t)}},{key:"reboot",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Worker was rebooted";if(!this.workerUrl)throw new Error("You can not reboot a worker that was created from a Worker Instance");this.workers.forEach((function(e){return e.terminate()})),this.workers=[];var r=this.cancelAll(e);return this.warmUp(),r}},{key:"dispose",value:function(){return s(this,void 0,void 0,c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.cancelAll(null);case 2:this.workerUrl&&URL.revokeObjectURL(this.workerUrl),this.workers.forEach((function(e){return e.terminate()})),this.workers=[];case 5:case"end":return e.stop()}}),e,this)})))}}],n&&u(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();r.EasyWebWorker=h},726:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getWorkerTemplate=r.generatedId=void 0,r.generatedId=function(){return"".concat(Date.now()).concat(Math.random().toString(36).substring(2,9))},r.getWorkerTemplate=function(){return"self.cw$=a=>{const b=new Map(),c=new Map([['',()=>{throw\"you didn't defined a message-callback, please assign a callback by calling IEasyWorkerInstance.onMessage\"}]]),d=({messageId:e,payload:f,origin:g})=>{const h=new Set(),i=j=>{const{progress:k}=j;k||b.delete(e),self.postMessage({messageId:e,...j},g)},l=(...m)=>{i({resolved:{payload:m}})},n=o=>{i({rejected:{reason:o}})},p=q=>{[...h].forEach(r=>r(q)),i({worker_canceled:{reason:q}})},s=(t,u)=>{i({progress:{percentage:t,payload:u}})},v=w=>(h.add(w),()=>h.delete(w));return{payload:f,resolve:l,reject:n,cancel:p,onCancel:v,reportProgress:s}},x=(...y)=>{self.importScripts(...y)},z=(...A)=>{const[B,C]=A,D=typeof B==='string';if(D){const E=B,F=C;c.set(E,F);return;}const G=B;c.set('',G)},H=()=>{[...b.values()].forEach(I=>I.reject(new Error('worker closed')));self.close();};self.onmessage=J=>{const{data:K,origin:L}=J,{messageId:M,cancelation:N}=K;if(N){const{reason:O}=N,P=b.get(M);P.cancel(O);return;}const{method:Q,execution:R}=K,{payload:S}=R,T=d({messageId:M,payload:S,origin:a||L||undefined});b.set(M,T);const U=c.get(Q||'');U(T,J)};return{importScripts:x,onMessage:z,close:H}};"}},213:(e,r,t)=>{"use strict";function n(e){return n="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},n(e)}function o(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(void 0,i=function(e,r){if("object"!==n(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(o.key),"symbol"===n(i)?i:String(i)),o)}var i}function i(e,r,t){return r&&o(e.prototype,r),t&&o(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(r,"__esModule",{value:!0}),r.EasyWebWorkerMessage=void 0;var a=t(367),c=t(726),u=i((function e(){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),this.messageId=(0,c.generatedId)(),this.decoupledPromise=(0,a.createDecoupledPromise)()}));r.EasyWebWorkerMessage=u},973:(e,r)=>{"use strict";function t(e){return function(e){if(Array.isArray(e))return n(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,r){if(e){if("string"==typeof e)return n(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?n(e,r):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}Object.defineProperty(r,"__esModule",{value:!0}),r.createStaticEasyWebWorker=r.StaticEasyWebWorker=void 0,r.StaticEasyWebWorker=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=new Map,o=new Map([["",function(){throw"you didn't defined a message-callback, please assign a callback by calling IEasyWorkerInstance.onMessage"}]]),i=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];var n=r[0],i=r[1];if("string"==typeof n){var a=n,c=i;o.set(a,c)}else{var u=n;o.set("",u)}};self.onmessage=function(e){var i=e.data,a=e.origin,c=i.messageId,u=i.cancelation;if(u){var s=u.reason;n.get(c).cancel(s)}else{var l=e.data,f=l.method,p=function(e){var r=e.messageId,o=e.payload,i=e.origin,a=new Set,c=function(e){e.progress||n.delete(r),self.postMessage(Object.assign({messageId:r},e),i)};return{payload:o,resolve:function(){var e=Array.from(arguments);c({resolved:{payload:e}})},reject:function(e){c({rejected:{reason:e}})},cancel:function(e){t(a).forEach((function(r){return r(e)})),c({canceled:{reason:e}})},onCancel:function(e){return a.add(e),function(){return a.delete(e)}},reportProgress:function(e,r){c({progress:{percentage:e,payload:r}})}}}({messageId:c,payload:l.execution.payload,origin:r||a||void 0});o.get(f||"")(p,e)}},e&&i(e),this.importScripts=function(){var e;(e=self).importScripts.apply(e,arguments)},this.close=function(){t(n.values()).forEach((function(e){return e.reject(new Error("worker closed"))})),self.close()},this.onMessage=i},r.createStaticEasyWebWorker=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return new r.StaticEasyWebWorker(e,t)}},991:(e,r,t)=>{"use strict";var n=Object.create?function(e,r,t,n){void 0===n&&(n=t);var o=Object.getOwnPropertyDescriptor(r,t);o&&!("get"in o?!r.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,n,o)}:function(e,r,t,n){void 0===n&&(n=t),e[n]=r[t]},o=function(e,r){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(r,t)||n(r,e,t)};Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=t(30);Object.defineProperty(r,"default",{enumerable:!0,get:function(){return i.EasyWebWorker}}),o(t(30),r),o(t(973),r),o(t(797),r)},367:function(e){var r;r=()=>(()=>{"use strict";var e={399:(e,r)=>{function t(e){return t="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},t(e)}function n(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function o(){return o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,r,t){var n=function(e,r){for(;!Object.prototype.hasOwnProperty.call(e,r)&&null!==(e=s(e)););return e}(e,r);if(n){var o=Object.getOwnPropertyDescriptor(n,r);return o.get?o.get.call(arguments.length<3?e:t):o.value}},o.apply(this,arguments)}function i(e){var r="function"==typeof Map?new Map:void 0;return i=function(e){if(null===e||(t=e,-1===Function.toString.call(t).indexOf("[native code]")))return e;var t;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,n)}function n(){return a(e,arguments,s(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),u(n,e)},i(e)}function a(e,r,t){return a=c()?Reflect.construct.bind():function(e,r,t){var n=[null];n.push.apply(n,r);var o=new(Function.bind.apply(e,n));return t&&u(o,t.prototype),o},a.apply(null,arguments)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function u(e,r){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},u(e,r)}function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.CancelablePromise=void 0;var l=function(e){!function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&u(e,r)}(f,e);var r,i,a,l=(i=f,a=c(),function(){var e,r=s(i);if(a){var o=s(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return function(e,r){if(r&&("object"===t(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return n(e)}(this,e)});function f(e){var r,t,i,a,c,u;return function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,f),(a=l.call(this,(function(e,r){c=e,u=r}))).status="pending",a.cancelCallbacks=[],a.ownCancelCallbacks=[],a.onProgressCallbacks=[],a.subscribeToOwnCancelEvent=function(e){a.ownCancelCallbacks.push(e)},a.cancel=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if("pending"===a.status)return a.status="canceled",a.ownCancelCallbacks.forEach((function(r){return r(e)})),a.cancelCallbacks.forEach((function(r){return r(e)})),a.reject(e),a.cancelCallbacks=[],a.ownCancelCallbacks=[],n(a)},a.onCancel=function(e){return a.cancelCallbacks.push(e),n(a)},a.onProgress=function(e){return a.onProgressCallbacks.push(e),n(a)},a.reportProgress=function(e,r){return a.onProgressCallbacks.forEach((function(t){return t(e,r)})),n(a)},a.createChildPromise=function(){var e,r,t=new f((function(t,n,o){e=t,r=n}));return t.onProgressCallbacks=a.onProgressCallbacks,t.onCancel((function(e){a.cancel(e)})),{promise:t,resolve:e,reject:r}},a.resolve=c,a.reject=u,e((function(e){a.status="resolved",a.resolve(e)}),(function(e){a.status="rejected",a.reject(e)}),{cancel:function(e){return a.cancel(e)},onCancel:function(e){return a.subscribeToOwnCancelEvent(e),n(a)},onProgress:function(e){return a.onProgress(e)},reportProgress:function(e,r){a.reportProgress(e,r)}}),a.then=function(e,t){var i=a.createChildPromise(),c=i.promise,u=i.resolve,l=i.reject;return o((r=n(a),s(f.prototype)),"then",r).call(r,e,t).then(u,l),c},a.catch=function(e){var r=a.createChildPromise(),i=r.promise,c=r.resolve,u=r.reject;return o((t=n(a),s(f.prototype)),"catch",t).call(t,e).then(c,u),i},a.finally=function(e){var r=a.createChildPromise(),t=r.promise,c=r.resolve,u=r.reject;return o((i=n(a),s(f.prototype)),"finally",i).call(i,e).then(c,u),t},a}return r=f,Object.defineProperty(r,"prototype",{writable:!1}),r}(i(Promise));r.CancelablePromise=l,l.prototype.constructor=Promise},716:(e,r,t)=>{function n(e){return n="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},n(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.toCancelablePromise=r.isPromise=r.groupAsCancelablePromise=r.createDecoupledPromise=r.allSettledCancelable=void 0;var o=t(335),i=t(399);function a(){a=function(){return e};var e={},r=Object.prototype,t=r.hasOwnProperty,o=Object.defineProperty||function(e,r,t){e[r]=t.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(e,r,t){return Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[r]}try{l({},"")}catch(e){l=function(e,r,t){return e[r]=t}}function f(e,r,t,n){var i=r&&r.prototype instanceof d?r:d,a=Object.create(i.prototype),c=new W(n||[]);return o(a,"_invoke",{value:j(e,t,c)}),a}function p(e,r,t){try{return{type:"normal",arg:e.call(r,t)}}catch(e){return{type:"throw",arg:e}}}e.wrap=f;var h={};function d(){}function v(){}function y(){}var m={};l(m,c,(function(){return this}));var g=Object.getPrototypeOf,b=g&&g(g(_([])));b&&b!==r&&t.call(b,c)&&(m=b);var w=y.prototype=d.prototype=Object.create(m);function k(e){["next","throw","return"].forEach((function(r){l(e,r,(function(e){return this._invoke(r,e)}))}))}function P(e,r){function i(o,a,c,u){var s=p(e[o],e,a);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==n(f)&&t.call(f,"__await")?r.resolve(f.__await).then((function(e){i("next",e,c,u)}),(function(e){i("throw",e,c,u)})):r.resolve(f).then((function(e){l.value=e,c(l)}),(function(e){return i("throw",e,c,u)}))}u(s.arg)}var a;o(this,"_invoke",{value:function(e,t){function n(){return new r((function(r,n){i(e,t,r,n)}))}return a=a?a.then(n,n):n()}})}function j(e,r,t){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(t.method=o,t.arg=i;;){var a=t.delegate;if(a){var c=O(a,t);if(c){if(c===h)continue;return c}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if("suspendedStart"===n)throw n="completed",t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);n="executing";var u=p(e,r,t);if("normal"===u.type){if(n=t.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:t.done}}"throw"===u.type&&(n="completed",t.method="throw",t.arg=u.arg)}}}function O(e,r){var t=r.method,n=e.iterator[t];if(void 0===n)return r.delegate=null,"throw"===t&&e.iterator.return&&(r.method="return",r.arg=void 0,O(e,r),"throw"===r.method)||"return"!==t&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+t+"' method")),h;var o=p(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,h;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,h):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}function E(e){var r={tryLoc:e[0]};1 in e&&(r.catchLoc=e[1]),2 in e&&(r.finallyLoc=e[2],r.afterLoc=e[3]),this.tryEntries.push(r)}function x(e){var r=e.completion||{};r.type="normal",delete r.arg,e.completion=r}function W(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function _(e){if(e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function r(){for(;++n<e.length;)if(t.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return o.next=o}}return{next:S}}function S(){return{value:void 0,done:!0}}return v.prototype=y,o(w,"constructor",{value:y,configurable:!0}),o(y,"constructor",{value:v,configurable:!0}),v.displayName=l(y,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var r="function"==typeof e&&e.constructor;return!!r&&(r===v||"GeneratorFunction"===(r.displayName||r.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,l(e,s,"GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},k(P.prototype),l(P.prototype,u,(function(){return this})),e.AsyncIterator=P,e.async=function(r,t,n,o,i){void 0===i&&(i=Promise);var a=new P(f(r,t,n,o),i);return e.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(w),l(w,s,"Generator"),l(w,c,(function(){return this})),l(w,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var r=Object(e),t=[];for(var n in r)t.push(n);return t.reverse(),function e(){for(;t.length;){var n=t.pop();if(n in r)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=_,W.prototype={constructor:W,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var r in this)"t"===r.charAt(0)&&t.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t,n){return a.type="throw",a.arg=e,r.next=t,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=t.call(i,"catchLoc"),u=t.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&t.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),h},finish:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),x(t),h}},catch:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.tryLoc===e){var n=t.completion;if("throw"===n.type){var o=n.arg;x(t)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,t){return this.delegate={iterator:_(e),resultName:r,nextLoc:t},"next"===this.method&&(this.arg=void 0),h}},e}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}r.createDecoupledPromise=function(){var e,r,t,n=new i.CancelablePromise((function(n,o,i){e=n,r=o,t=i}));return Object.assign(Object.assign({resolve:e,reject:r},t),{promise:n})};var u=function e(r){if(r instanceof i.CancelablePromise)return r;if("function"==typeof r)return e(r());if(!l(r))return new i.CancelablePromise((function(e){return e(r)}));var t,n,o=new i.CancelablePromise((function(e,o,i){t=e,n=o,r.then(t,n)}));return o.onCancel((function(e){n(e)})),o};r.toCancelablePromise=u;var s=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e.length)return null;var t,n=r.maxConcurrent,o=void 0===n?8:n,a=r.executeInOrder,s=void 0!==a&&a,l=r.beforeEachCallback,f=void 0===l?null:l,p=r.afterEachCallback,h=void 0===p?null:p,d=r.onQueueEmptyCallback,v=void 0===d?null:d,y=function(e){if(Array.isArray(e))return c(e)}(t=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),m=[];return new i.CancelablePromise((function(e,r,t){return function e(){if(y.length){var r=y.splice(0,o).map((function(e){var r="function"==typeof e?e():e;null==f||f();var n=u(r);return t.onCancel((function(){n.cancel()})),n.then((function(e){m.push(e),null==h||h(e)})),s?n.then((function(e){return e})):n}));return Promise.all(r).then((function(){return e()}))}}().then((function(){null==v||v(m),e(m)}))}))};r.groupAsCancelablePromise=s;var l=function(e){return Promise.resolve(e)===e};r.isPromise=l,r.allSettledCancelable=function(e){var r=[],t=e.map((function(e){var t=u(e);return r.push(t),(0,o.tryCatchPromise)((function(){return t})).then((function(e){return{error:e.error,result:e.result,promise:t}}))})),n=s(r);return new i.CancelablePromise((function(e,r,o){return i=void 0,c=a().mark((function r(){var i;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return o.onCancel(n.cancel),r.next=3,Promise.all(t);case 3:i=r.sent,e(i);case 5:case"end":return r.stop()}}),r)})),new(i||(i=Promise))((function(e,r){function t(e){try{o(c.next(e))}catch(e){r(e)}}function n(e){try{o(c.throw(e))}catch(e){r(e)}}function o(r){var o;r.done?e(r.value):(o=r.value,o instanceof i?o:new i((function(e){e(o)}))).then(t,n)}o((c=c.apply(void 0,[])).next())}));var i,c}))}},522:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0});var n=t(399);Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===n[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return n[e]}}))}));var o=t(716);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===o[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return o[e]}}))}))},991:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0});var n=t(522);Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===n[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return n[e]}}))}));var o=t(335);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===o[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return o[e]}}))}))},335:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0});var n=t(969);Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===n[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return n[e]}}))}))},969:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0});var n=t(948);Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===n[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return n[e]}}))}));var o=t(667);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===o[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return o[e]}}))}))},948:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tryCatchPromise=r.tryCatch=void 0;var n=t(522);r.tryCatch=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=r.defaultResult,n=void 0===t?null:t,o=r.exceptionHandlingType,i=void 0===o?"error":o;try{return{error:null,result:e()}}catch(e){return"ignore"!==i&&console[i](e),{error:e,result:n}}},r.tryCatchPromise=function(e,r){var t=r||{},o=t.defaultResult,i=void 0===o?null:o,a=t.exceptionHandlingType,c=void 0===a?"error":a,u=t.ignoreCancel,s=void 0===u||u,l=null,f=null,p=function(e){f=e,"ignore"!=c&&("canceled"===l.status&&s||console[c](f))};try{if(e instanceof n.CancelablePromise)return l=e,new Promise((function(e){l.then((function(e){return{error:null,result:e,promise:l}})).catch((function(e){return p(e),{error:e,result:i,promise:l}}))}));var h=e(),d=h instanceof n.CancelablePromise;return l=d?h:(0,n.toCancelablePromise)(h),new Promise((function(e){l.then((function(r){e({error:null,result:r,promise:l})})).catch((function(r){p(r),e({error:r,result:i,promise:l})}))}))}catch(e){return p(e),Promise.resolve({error:f,result:i,promise:l})}}},667:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0})}},r={};return function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n](i,i.exports,t),i.exports}(991)})(),e.exports=r()}},r={},function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n].call(i.exports,i,i.exports,t),i.exports}(991);var e,r}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-web-worker",
3
- "version": "4.0.3",
3
+ "version": "4.0.7",
4
4
  "description": "This is a library to easily handle and create web-workers, if you are a web developer and never tried this... do not wait any longer! Workers are an amazing option to improve user experience and make your webpages even greater",
5
5
  "main": "lib/bundle.js",
6
6
  "types": "lib/index.d.ts",
@@ -62,7 +62,14 @@
62
62
  "optional": false
63
63
  }
64
64
  },
65
- "easy-web-worker": {
66
- "DEV_MODE": true
67
- }
65
+ "contributors": [
66
+ {
67
+ "name": "Johnny Quesada",
68
+ "url": "https://github.com/johnny-quesada-developer"
69
+ },
70
+ {
71
+ "name": "Gabriele Cirulli",
72
+ "url": "https://github.com/gabrielecirulli"
73
+ }
74
+ ]
68
75
  }