UNPKG

event-target-shim-es5

Version:

[![npm version](https://img.shields.io/npm/v/event-target-shim-es5.svg)](https://www.npmjs.com/package/event-target-shim-es5) ![Node.js CI](https://github.com/compulim/event-target-shim-es5/workflows/Node.js%20CI/badge.svg)

1 lines 26.3 kB
function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){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 _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function set(t,e,n,r){return(set="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,n,r){var o,a=_superPropBase(t,e);if(a){if((o=Object.getOwnPropertyDescriptor(a,e)).set)return o.set.call(r,n),!0;if(!o.writable)return!1}if(o=Object.getOwnPropertyDescriptor(r,e)){if(!o.writable)return!1;o.value=n,Object.defineProperty(r,e,o)}else _defineProperty(r,e,n);return!0})(t,e,n,r)}function _set(t,e,n,r,o){if(!set(t,e,n,r||t)&&o)throw new Error("failed to set property");return n}function _get(t,e,n){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=_superPropBase(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function _superPropBase(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=_getPrototypeOf(t)););return t}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_setPrototypeOf(t,e)}function _createSuper(t){var e=_isNativeReflectConstruct();return function(){var n,r=_getPrototypeOf(t);if(e){var o=_getPrototypeOf(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return _possibleConstructorReturn(this,n)}}function _possibleConstructorReturn(t,e){return!e||"object"!==_typeof(e)&&"function"!=typeof e?_assertThisInitialized(t):e}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _wrapNativeSuper(t){var e="function"==typeof Map?new Map:void 0;return(_wrapNativeSuper=function(t){if(null===t||!_isNativeFunction(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return _construct(t,arguments,_getPrototypeOf(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(n,t)})(t)}function _construct(t,e,n){return(_construct=_isNativeReflectConstruct()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&_setPrototypeOf(o,n.prototype),o}).apply(null,arguments)}function _isNativeReflectConstruct(){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(t){return!1}}function _isNativeFunction(t){return-1!==Function.toString.call(t).indexOf("[native code]")}function _setPrototypeOf(t,e){return(_setPrototypeOf=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function ownKeys(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(n),!0).forEach((function(e){_defineProperty(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function _defineProperty(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function _createClass(t,e,n){return e&&_defineProperties(t.prototype,e),n&&_defineProperties(t,n),t}function _createForOfIteratorHelper(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=_unsupportedIterableToArray(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){u=!0,a=t},f:function(){try{i||null==n.return||n.return()}finally{if(u)throw a}}}}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(){var t,e=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,a=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,u=function(t,e){return function(){return e||t((e={exports:{}}).exports,e),e.exports}},c=u((function(t,e){var n=function(t){return t&&t.Math==Math&&t};e.exports=n("object"==("undefined"==typeof globalThis?"undefined":_typeof(globalThis))&&globalThis)||n("object"==("undefined"==typeof window?"undefined":_typeof(window))&&window)||n("object"==("undefined"==typeof self?"undefined":_typeof(self))&&self)||n("object"==("undefined"==typeof global?"undefined":_typeof(global))&&global)||function(){return this}()||Function("return this")()})),l=u((function(t,e){e.exports=function(t){try{return!!t()}catch(t){return!0}}})),f=u((function(t,e){var n=l();e.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))})),s=u((function(t){"use strict";var e={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,r=n&&!e.call({1:2},1);t.f=r?function(t){var e=n(this,t);return!!e&&e.enumerable}:e})),p=u((function(t,e){e.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}})),y=u((function(t,e){var n={}.toString;e.exports=function(t){return n.call(t).slice(8,-1)}})),g=u((function(t,e){var n=l(),r=y(),o="".split;e.exports=n((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==r(t)?o.call(t,""):Object(t)}:Object})),b=u((function(t,e){e.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}})),v=u((function(t,e){var n=g(),r=b();e.exports=function(t){return n(r(t))}})),d=u((function(t,e){e.exports=function(t){return"object"==_typeof(t)?null!==t:"function"==typeof t}})),h=u((function(t,e){var n=d();e.exports=function(t,e){if(!n(t))return t;var r,o;if(e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t))||"function"==typeof(r=t.valueOf)&&!n(o=r.call(t))||!e&&"function"==typeof(r=t.toString)&&!n(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}})),_=u((function(t,e){var n=b();e.exports=function(t){return Object(n(t))}})),O=u((function(t,e){var n=_(),r={}.hasOwnProperty;e.exports=Object.hasOwn||function(t,e){return r.call(n(t),e)}})),E=u((function(t,e){var n=c(),r=d(),o=n.document,a=r(o)&&r(o.createElement);e.exports=function(t){return a?o.createElement(t):{}}})),m=u((function(t,e){var n=f(),r=l(),o=E();e.exports=!n&&!r((function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))})),w=u((function(t){var e=f(),n=s(),r=p(),o=v(),a=h(),i=O(),u=m(),c=Object.getOwnPropertyDescriptor;t.f=e?c:function(t,e){if(t=o(t),e=a(e,!0),u)try{return c(t,e)}catch(t){}if(i(t,e))return r(!n.f.call(t,e),t[e])}})),P=u((function(t,e){var n=l(),r=/#|\.prototype\./,o=function(t,e){var r=i[a(t)];return r==c||r!=u&&("function"==typeof e?n(e):!!e)},a=o.normalize=function(t){return String(t).replace(r,".").toLowerCase()},i=o.data={},u=o.NATIVE="N",c=o.POLYFILL="P";e.exports=o})),T=u((function(t,e){e.exports={}})),j=u((function(t,e){e.exports=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}})),R=u((function(t,e){var n=j();e.exports=function(t,e,r){if(n(t),void 0===e)return t;switch(r){case 0:return function(){return t.call(e)};case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}})),S=u((function(t,e){var n=d();e.exports=function(t){if(!n(t))throw TypeError(String(t)+" is not an object");return t}})),k=u((function(t){var e=f(),n=m(),r=S(),o=h(),a=Object.defineProperty;t.f=e?a:function(t,e,i){if(r(t),e=o(e,!0),r(i),n)try{return a(t,e,i)}catch(t){}if("get"in i||"set"in i)throw TypeError("Accessors not supported");return"value"in i&&(t[e]=i.value),t}})),A=u((function(t,e){var n=f(),r=k(),o=p();e.exports=n?function(t,e,n){return r.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}})),I=u((function(t,e){"use strict";var n=c(),r=w().f,o=P(),a=T(),i=R(),u=A(),l=O(),f=function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e.prototype=t.prototype,e};e.exports=function(t,e){var c,s,p,y,g,b,v,d,h=t.target,_=t.global,O=t.stat,E=t.proto,m=_?n:O?n[h]:(n[h]||{}).prototype,w=_?a:a[h]||(a[h]={}),P=w.prototype;for(p in e)c=!o(_?p:h+(O?".":"#")+p,t.forced)&&m&&l(m,p),g=w[p],c&&(t.noTargetGet?b=(d=r(m,p))&&d.value:b=m[p]),y=c&&b?b:e[p],(!c||_typeof(g)!=_typeof(y))&&(v=t.bind&&c?i(y,n):t.wrap&&c?f(y):E&&"function"==typeof y?i(Function.call,y):y,(t.sham||y&&y.sham||g&&g.sham)&&u(v,"sham",!0),w[p]=v,E&&(l(a,s=h+"Prototype")||u(a,s,{}),a[s][p]=y,t.real&&P&&!P[p]&&u(P,p,y)))}})),F=u((function(){I()({global:!0},{globalThis:c()})})),C=u((function(){F()})),D=u((function(t,e){F(),e.exports=c()})),N=u((function(t,e){C();var n=D();e.exports=n})),B=function(t){return function(t,e,a){if(e&&"object"==_typeof(e)||"function"==typeof e){var u,c=_createForOfIteratorHelper(o(e));try{var l=function(){var o=u.value;!i.call(t,o)&&"default"!==o&&n(t,o,{get:function(){return e[o]},enumerable:!(a=r(e,o))||a.enumerable})};for(c.s();!(u=c.n()).done;)l()}catch(t){c.e(t)}finally{c.f()}}return t}(function(t){return n(t,"__esModule",{value:!0})}(n(null!=t?e(a(t)):{},"default",t&&t.__esModule&&"default"in t?{get:function(){return t.default},enumerable:!0}:{value:t,enumerable:!0})),t)}(u((function(t,e){e.exports=N()}))());function L(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];if(!t)throw new TypeError(x(e,r))}function x(t,e){var n=0;return t.replace(/%[os]/g,(function(){return M(e[n++])}))}function M(t){return"object"!=_typeof(t)||null===t?String(t):Object.prototype.toString.call(t)}var U,W="undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:void 0;var H=function(){function t(e,n){_classCallCheck(this,t),this.code=e,this.message=n}return _createClass(t,[{key:"warn",value:function(){var t;try{for(var e,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];if(U)return void U(_objectSpread(_objectSpread({},this),{},{args:r}));var a=(null!==(t=(new Error).stack)&&void 0!==t?t:"").replace(/^(?:(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+?\n){2}/g,"\n");(e=console).warn.apply(e,[this.message].concat(r,[a]))}catch(a){}}}]),t}(),V=new H("W01","Unable to initialize event under dispatching."),G=new H("W02","Assigning any falsy value to 'cancelBubble' property has no effect."),z=new H("W03","Assigning any truthy value to 'returnValue' property has no effect."),Y=new H("W04","Unable to preventDefault on non-cancelable events."),K=new H("W05","Unable to preventDefault inside passive event listener invocation."),X=new H("W06","An event listener wasn't added because it has been added already: %o, %o"),Q=new H("W07","The %o option value was abandoned because the event listener wasn't added as duplicated."),Z=new H("W08","The 'callback' argument must be a function or an object that has 'handleEvent' method: %o"),$=new H("W09","Event attribute handler must be a function: %o"),q=function(){function t(e,n){_classCallCheck(this,t),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});var r=null!=n?n:{};rt.set(this,{type:String(e),bubbles:Boolean(r.bubbles),cancelable:Boolean(r.cancelable),composed:Boolean(r.composed),target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1,inPassiveListenerFlag:!1,dispatchFlag:!1,timeStamp:Date.now()})}return _createClass(t,[{key:"type",get:function(){return ot(this).type}},{key:"target",get:function(){return ot(this).target}},{key:"srcElement",get:function(){return ot(this).target}},{key:"currentTarget",get:function(){return ot(this).currentTarget}},{key:"composedPath",value:function(){var t=ot(this).currentTarget;return t?[t]:[]}},{key:"NONE",get:function(){return J}},{key:"CAPTURING_PHASE",get:function(){return tt}},{key:"AT_TARGET",get:function(){return et}},{key:"BUBBLING_PHASE",get:function(){return nt}},{key:"eventPhase",get:function(){return ot(this).dispatchFlag?2:0}},{key:"stopPropagation",value:function(){ot(this).stopPropagationFlag=!0}},{key:"cancelBubble",get:function(){return ot(this).stopPropagationFlag},set:function(t){t?ot(this).stopPropagationFlag=!0:G.warn()}},{key:"stopImmediatePropagation",value:function(){var t=ot(this);t.stopPropagationFlag=t.stopImmediatePropagationFlag=!0}},{key:"bubbles",get:function(){return ot(this).bubbles}},{key:"cancelable",get:function(){return ot(this).cancelable}},{key:"returnValue",get:function(){return!ot(this).canceledFlag},set:function(t){t?z.warn():at(ot(this))}},{key:"preventDefault",value:function(){at(ot(this))}},{key:"defaultPrevented",get:function(){return ot(this).canceledFlag}},{key:"composed",get:function(){return ot(this).composed}},{key:"isTrusted",get:function(){return!1}},{key:"timeStamp",get:function(){return ot(this).timeStamp}},{key:"initEvent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=ot(this);r.dispatchFlag?V.warn():rt.set(this,_objectSpread(_objectSpread({},r),{},{type:String(t),bubbles:Boolean(e),cancelable:Boolean(n),target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1}))}}],[{key:"NONE",get:function(){return J}},{key:"CAPTURING_PHASE",get:function(){return tt}},{key:"AT_TARGET",get:function(){return et}},{key:"BUBBLING_PHASE",get:function(){return nt}}]),t}(),J=0,tt=1,et=2,nt=3,rt=new WeakMap;function ot(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"this",n=rt.get(t);return L(null!=n,"'%s' must be an object that Event constructor created, but got another one: %o",e,t),n}function at(t){t.inPassiveListenerFlag?K.warn():t.cancelable?t.canceledFlag=!0:Y.warn()}Object.defineProperty(q,"NONE",{enumerable:!0}),Object.defineProperty(q,"CAPTURING_PHASE",{enumerable:!0}),Object.defineProperty(q,"AT_TARGET",{enumerable:!0}),Object.defineProperty(q,"BUBBLING_PHASE",{enumerable:!0});for(var it=Object.getOwnPropertyNames(q.prototype),ut=0;ut<it.length;++ut)"constructor"!==it[ut]&&Object.defineProperty(q.prototype,it[ut],{enumerable:!0});void 0!==W&&void 0!==W.Event&&Object.setPrototypeOf(q.prototype,W.Event.prototype);var ct,lt={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};function ft(t){for(var e=Object.keys(lt),n=function(n){var r=e[n],o=lt[r];Object.defineProperty(t,r,{get:function(){return o},configurable:!0,enumerable:!0})},r=0;r<e.length;++r)n(r)}var st=function(t){_inherits(n,t);var e=_createSuper(n);function n(t){var r,o,a;_classCallCheck(this,n),a=e.call(this,t.type,{bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed}),t.cancelBubble&&_get((r=_assertThisInitialized(a),_getPrototypeOf(n.prototype)),"stopPropagation",r).call(r),t.defaultPrevented&&_get((o=_assertThisInitialized(a),_getPrototypeOf(n.prototype)),"preventDefault",o).call(o),pt.set(_assertThisInitialized(a),{original:t});for(var i=Object.keys(t),u=0;u<i.length;++u){var c=i[u];c in _assertThisInitialized(a)||Object.defineProperty(_assertThisInitialized(a),c,vt(t,c))}return a}return _createClass(n,[{key:"stopPropagation",value:function(){_get(_getPrototypeOf(n.prototype),"stopPropagation",this).call(this);var t=yt(this).original;"stopPropagation"in t&&t.stopPropagation()}},{key:"cancelBubble",get:function(){return _get(_getPrototypeOf(n.prototype),"cancelBubble",this)},set:function(t){_set(_getPrototypeOf(n.prototype),"cancelBubble",t,this,!0);var e=yt(this).original;"cancelBubble"in e&&(e.cancelBubble=t)}},{key:"stopImmediatePropagation",value:function(){_get(_getPrototypeOf(n.prototype),"stopImmediatePropagation",this).call(this);var t=yt(this).original;"stopImmediatePropagation"in t&&t.stopImmediatePropagation()}},{key:"returnValue",get:function(){return _get(_getPrototypeOf(n.prototype),"returnValue",this)},set:function(t){_set(_getPrototypeOf(n.prototype),"returnValue",t,this,!0);var e=yt(this).original;"returnValue"in e&&(e.returnValue=t)}},{key:"preventDefault",value:function(){_get(_getPrototypeOf(n.prototype),"preventDefault",this).call(this);var t=yt(this).original;"preventDefault"in t&&t.preventDefault()}},{key:"timeStamp",get:function(){var t=yt(this).original;return"timeStamp"in t?t.timeStamp:_get(_getPrototypeOf(n.prototype),"timeStamp",this)}}],[{key:"wrap",value:function(t){return new(bt(t))(t)}}]),n}(q),pt=new WeakMap;function yt(t){var e=pt.get(t);return L(null!=e,"'this' is expected an Event object, but got",t),e}var gt=new WeakMap;function bt(t){var e=Object.getPrototypeOf(t);if(null==e)return st;var n=gt.get(e);return null==n&&(n=function(t,e){for(var n=function(t){_inherits(n,t);var e=_createSuper(n);function n(){return _classCallCheck(this,n),e.apply(this,arguments)}return n}(t),r=Object.keys(e),o=0;o<r.length;++o)Object.defineProperty(n.prototype,r[o],vt(e,r[o]));return n}(bt(e),e),gt.set(e,n)),n}function vt(t,e){var n=Object.getOwnPropertyDescriptor(t,e);return{get:function(){var t=yt(this).original,n=t[e];return"function"==typeof n?n.bind(t):n},set:function(t){yt(this).original[e]=t},configurable:n.configurable,enumerable:n.enumerable}}function dt(t){t.flags|=8}function ht(t){return 1==(1&t.flags)}function _t(t){return 2==(2&t.flags)}function Ot(t){return 4==(4&t.flags)}function Et(t){return 8==(8&t.flags)}function mt(e,n,r){var o=e.callback;try{"function"==typeof o?o.call(n,r):"function"==typeof o.handleEvent&&o.handleEvent(r)}catch(e){!function(e){try{var n=e instanceof Error?e:new Error(M(e));if(t)return void t(n);if("function"==typeof dispatchEvent&&"function"==typeof ErrorEvent)dispatchEvent(new ErrorEvent("error",{error:n,message:n.message}));else if("undefined"!=typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",n);console.error(n)}catch(n){}}(e)}}function wt(t,e,n){for(var r=t.listeners,o=0;o<r.length;++o)if(r[o].callback===e&&ht(r[o])===n)return o;return-1}function Pt(t,e,n,r,o,a){var i;a&&(i=Tt.bind(null,t,e,n),a.addEventListener("abort",i));var u=function(t,e,n,r,o,a){return{callback:t,flags:(e?1:0)|(n?2:0)|(r?4:0),signal:o,signalListener:a}}(e,n,r,o,a,i);return t.cow?(t.cow=!1,t.listeners=[].concat(_toConsumableArray(t.listeners),[u])):t.listeners.push(u),u}function Tt(t,e,n){var r=wt(t,e,n);return-1!==r&&jt(t,r)}function jt(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t.listeners[e];return dt(r),r.signal&&r.signal.removeEventListener("abort",r.signalListener),t.cow&&!n?(t.cow=!1,t.listeners=t.listeners.filter((function(t,n){return n!==e})),!1):(t.listeners.splice(e,1),!0)}function Rt(t,e){var n;return null!==(n=t[e])&&void 0!==n?n:t[e]={attrCallback:void 0,attrListener:void 0,cow:!1,listeners:[]}}gt.set(Object.prototype,st),void 0!==W&&void 0!==W.Event&&gt.set(W.Event.prototype,st);var St=function(){function t(){_classCallCheck(this,t),kt.set(this,Object.create(null))}return _createClass(t,[{key:"addEventListener",value:function(t,e,n){var r=At(this),o=function(t,e,n){var r;return It(e),"object"==_typeof(n)&&null!==n?{type:String(t),callback:null!=e?e:void 0,capture:Boolean(n.capture),passive:Boolean(n.passive),once:Boolean(n.once),signal:null!==(r=n.signal)&&void 0!==r?r:void 0}:{type:String(t),callback:null!=e?e:void 0,capture:Boolean(n),passive:!1,once:!1,signal:void 0}}(t,e,n),a=o.callback,i=o.capture,u=o.once,c=o.passive,l=o.signal,f=o.type;if(null!=a&&!(null==l?void 0:l.aborted)){var s=Rt(r,f),p=wt(s,a,i);-1===p?Pt(s,a,i,c,u,l):function(t,e,n,r){X.warn(ht(t)?"capture":"bubble",t.callback),_t(t)!==e&&Q.warn("passive"),Ot(t)!==n&&Q.warn("once"),t.signal!==r&&Q.warn("signal")}(s.listeners[p],c,u,l)}}},{key:"removeEventListener",value:function(t,e,n){var r=At(this),o=function(t,e,n){return It(e),"object"==_typeof(n)&&null!==n?{type:String(t),callback:null!=e?e:void 0,capture:Boolean(n.capture)}:{type:String(t),callback:null!=e?e:void 0,capture:Boolean(n)}}(t,e,n),a=o.callback,i=o.capture,u=r[o.type];null!=a&&u&&Tt(u,a,i)}},{key:"dispatchEvent",value:function(t){var e=At(this)[String(t.type)];if(null==e)return!0;var n=t instanceof q?t:st.wrap(t),r=ot(n,"event");if(r.dispatchFlag)throw function(t){return W.DOMException?new W.DOMException(t,"InvalidStateError"):(null==ct&&(ct=function(t){_inherits(n,_wrapNativeSuper(Error));var e=_createSuper(n);function n(t){var r;return _classCallCheck(this,n),r=e.call(this,t),Error.captureStackTrace&&Error.captureStackTrace(_assertThisInitialized(r),n),r}return _createClass(n,[{key:"code",get:function(){return 11}},{key:"name",get:function(){return"InvalidStateError"}}]),n}(),Object.defineProperties(ct.prototype,{code:{enumerable:!0},name:{enumerable:!0}}),ft(ct),ft(ct.prototype)),new ct(t))}("This event has been in dispatching.");if(r.dispatchFlag=!0,r.target=r.currentTarget=this,!r.stopPropagationFlag){var o=e.cow,a=e.listeners;e.cow=!0;for(var i=0;i<a.length;++i){var u=a[i];if(!Et(u)&&(Ot(u)&&jt(e,i,!o)&&(i-=1),r.inPassiveListenerFlag=_t(u),mt(u,this,n),r.inPassiveListenerFlag=!1,r.stopImmediatePropagationFlag))break}o||(e.cow=!1)}return r.target=null,r.currentTarget=null,r.stopImmediatePropagationFlag=!1,r.stopPropagationFlag=!1,r.dispatchFlag=!1,!r.canceledFlag}}]),t}(),kt=new WeakMap;function At(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"this",n=kt.get(t);return L(null!=n,"'%s' must be an object that EventTarget constructor created, but got another one: %o",e,t),n}function It(t){if("function"!=typeof t&&("object"!=_typeof(t)||null===t||"function"!=typeof t.handleEvent)){if(null==t||"object"==_typeof(t))return void Z.warn(t);throw new TypeError(x(Z.message,[t]))}}for(var Ft=Object.getOwnPropertyNames(St.prototype),Ct=0;Ct<Ft.length;++Ct)"constructor"!==Ft[Ct]&&Object.defineProperty(St.prototype,Ft[Ct],{enumerable:!0});function Dt(t,e){var n,r;return null!==(r=null===(n=At(t,"target")[e])||void 0===n?void 0:n.attrCallback)&&void 0!==r?r:null}function Nt(t,e,n){null!=n&&"function"!=typeof n&&$.warn(n),"function"==typeof n||"object"==_typeof(n)&&null!==n?function(t,e,n){var r=Rt(At(t,"target"),String(e));r.attrCallback=n,null==r.attrListener&&(r.attrListener=Pt(r,function(t){return function(e){var n=t.attrCallback;"function"==typeof n&&n.call(this,e)}}(r),!1,!1,!1,void 0))}(t,e,n):function(t,e){var n=At(t,"target")[String(e)];n&&n.attrListener&&(Tt(n,n.attrListener.callback,!1),n.attrCallback=n.attrListener=void 0)}(t,e)}function Bt(t,e,n){Object.defineProperty(t,"on".concat(e),{get:function(){return Dt(this,e)},set:function(t){Nt(this,e,t)},configurable:!0,enumerable:!0})}void 0!==W&&void 0!==W.EventTarget&&Object.setPrototypeOf(St.prototype,W.EventTarget.prototype);var Lt=St,xt=void 0===B.default?0:B.default;xt&&(Lt.defineCustomEventTarget=function(){for(var t=function(t){_inherits(n,t);var e=_createSuper(n);function n(){return _classCallCheck(this,n),e.apply(this,arguments)}return n}(St),e=0;e<arguments.length;++e)Bt(t.prototype,e<0||arguments.length<=e?void 0:arguments[e]);return t},Lt.defineEventAttribute=Bt,Lt.Event=q,Lt.getEventAttributeValue=Dt,Lt.setErrorHandler=function(e){L("function"==typeof e||void 0===e,"The error handler must be a function or undefined, but got %o.",e),t=e},Lt.setEventAttributeValue=Nt,Lt.setWarningHandler=function(t){L("function"==typeof t||void 0===t,"The warning handler must be a function or undefined, but got %o.",t),U=t},xt.EventTargetShim=Lt,void 0===xt.EventTarget&&(xt.EventTarget=Lt))}();