define(["exports"],function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=_exports.AbortSignalPolyfill=void 0;var Emitter=function(){function Emitter(){babelHelpers.classCallCheck(this,Emitter),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return babelHelpers.createClass(Emitter,[{key:"addEventListener",value:function(type,callback,options){type in this.listeners||(this.listeners[type]=[]),this.listeners[type].push({callback:callback,options:options})}},{key:"removeEventListener",value:function(type,callback){if(type in this.listeners)for(var stack=this.listeners[type],i=0,l=stack.length;i<l;i++)if(stack[i].callback===callback)return void stack.splice(i,1)}},{key:"dispatchEvent",value:function(event){var _this=this;if(event.type in this.listeners){for(var stackToCall=this.listeners[event.type].slice(),i=0,l=stackToCall.length;i<l;i++){listener=void 0;var listener=stackToCall[i];try{listener.callback.call(_this,event)}catch(e){Promise.resolve().then(function(){throw e})}listener.options&&listener.options.once&&_this.removeEventListener(event.type,listener.callback)}return!event.defaultPrevented}}}]),Emitter}(),AbortSignalPolyfill=_exports.AbortSignalPolyfill=function(){babelHelpers.inherits(AbortSignalPolyfill,Emitter);var _super=_createSuper(AbortSignalPolyfill);function AbortSignalPolyfill(){var _this2;return babelHelpers.classCallCheck(this,AbortSignalPolyfill),(_this2=_super.call(this)).listeners||Emitter.call(babelHelpers.assertThisInitialized(_this2)),Object.defineProperty(babelHelpers.assertThisInitialized(_this2),"aborted",{value:!1,writable:!0,configurable:!0}),Object.defineProperty(babelHelpers.assertThisInitialized(_this2),"onabort",{value:null,writable:!0,configurable:!0}),Object.defineProperty(babelHelpers.assertThisInitialized(_this2),"reason",{value:void 0,writable:!0,configurable:!0}),_this2}return babelHelpers.createClass(AbortSignalPolyfill,[{key:"toString",value:function(){return"[object AbortSignal]"}},{key:"dispatchEvent",value:function(event){"abort"===event.type&&(this.aborted=!0,"function"==typeof this.onabort)&&this.onabort.call(this,event),babelHelpers.get(babelHelpers.getPrototypeOf(AbortSignalPolyfill.prototype),"dispatchEvent",this).call(this,event)}}]),AbortSignalPolyfill}(),isMissingRequestSignalSupport="function"==typeof globalThis.Request&&!Object.prototype.hasOwnProperty.call(globalThis.Request.prototype,"signal");"undefined"!=typeof AbortSignal&&!isMissingRequestSignalSupport||Object.defineProperty(globalThis,"AbortSignal",{writable:!0,enumerable:!1,configurable:!0,value:AbortSignalPolyfill}),AbortSignal.timeout||(AbortSignal.timeout=function(duration){var controller=new AbortController;return setTimeout(function(){return controller.abort()},duration),controller.signal}),AbortSignal.prototype.throwIfAborted||(AbortSignal.prototype.throwIfAborted=function(){var reason;if(this.aborted)throw(reason=this.reason)||((reason=new Error("Aborted")).name="AbortError"),reason}),_exports.default=AbortSignalPolyfill});