327 lines
8.3 KiB
JavaScript
327 lines
8.3 KiB
JavaScript
// Metro module 16247 (f16248).
|
|
let hasOwnProperty, c11677_1, EE;
|
|
const Events = function Events() {};
|
|
EE = function EE(a0, a1, a2) {
|
|
let once2 = a2;
|
|
this.fn = a0;
|
|
this.context = a1;
|
|
if (!a2) {
|
|
once2 = false;
|
|
}
|
|
this.once = once2;
|
|
};
|
|
hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
let r11 = "~";
|
|
c11677_1 = "~";
|
|
const create = Object.create;
|
|
let prefixed = "~";
|
|
if (create) {
|
|
Events.prototype = Object.create(null);
|
|
if (!({
|
|
__proto__: Events.prototype
|
|
}).__proto__) {
|
|
c11677_1 = false;
|
|
r11 = false;
|
|
}
|
|
prefixed = r11;
|
|
}
|
|
const EventEmitter = function EventEmitter() {
|
|
this._events = {
|
|
__proto__: Events.prototype
|
|
};
|
|
this._eventsCount = 0;
|
|
};
|
|
EventEmitter.prototype.eventNames = function eventNames() {
|
|
const r3 = [];
|
|
if (this._eventsCount === 0) {
|
|
return r3;
|
|
}
|
|
const _events = this._events;
|
|
for (const key in _events) {
|
|
const call = hasOwnProperty.call;
|
|
if (hasOwnProperty.call(_events, key)) {
|
|
r3.push(c11677_1 ? key.slice(1) : key);
|
|
}
|
|
}
|
|
return Object.getOwnPropertySymbols ? r3.concat(Object.getOwnPropertySymbols(_events)) : r3;
|
|
};
|
|
EventEmitter.prototype.listeners = function listeners(a0) {
|
|
const r13 = this._events[c11677_1 ? c11677_1 + a0 : a0];
|
|
if (r13) {
|
|
if (r13.fn) {
|
|
return [r13.fn];
|
|
}
|
|
const length = r13.length;
|
|
const array = new Array(length);
|
|
let r0 = 0;
|
|
while (r0 < length) {
|
|
array[r0] = r13[r0].fn;
|
|
r0 = r0 + 1;
|
|
}
|
|
return array;
|
|
}
|
|
return [];
|
|
};
|
|
EventEmitter.prototype.listenerCount = function listenerCount(a0) {
|
|
const r7 = this._events[c11677_1 ? c11677_1 + a0 : a0];
|
|
return r7 ? r7.fn ? 1 : r7.length : 0;
|
|
};
|
|
EventEmitter.prototype.emit = function emit(a0, a1, a2, a3, a4, a5) {
|
|
let r45;
|
|
const r12 = c11677_1 ? c11677_1 + a0 : a0;
|
|
if (this._events[r12]) {
|
|
const r38 = this._events[r12];
|
|
const length2 = arguments.length;
|
|
if (r38.fn) {
|
|
if (r38.once) {
|
|
this.removeListener(a0, r38.fn, void 0, true);
|
|
}
|
|
if (length2 === 1) {
|
|
r38.fn.call(r38.context);
|
|
return true;
|
|
}
|
|
if (length2 === 2) {
|
|
r38.fn.call(r38.context, a1);
|
|
return true;
|
|
}
|
|
if (length2 === 3) {
|
|
r38.fn.call(r38.context, a1, a2);
|
|
return true;
|
|
}
|
|
if (length2 === 4) {
|
|
r38.fn.call(r38.context, a1, a2, a3);
|
|
return true;
|
|
}
|
|
if (length2 === 5) {
|
|
r38.fn.call(r38.context, a1, a2, a3, a4);
|
|
return true;
|
|
}
|
|
if (length2 === 6) {
|
|
r38.fn.call(r38.context, a1, a2, a3, a4, a5);
|
|
return true;
|
|
}
|
|
const array2 = new Array(length2 - 1);
|
|
const r113 = 1 < length2;
|
|
let r114 = 1;
|
|
if (r113) {
|
|
do {
|
|
array2[r114 - 1] = arguments[r114];
|
|
r114 = r114 + 1;
|
|
} while (r114 < length2);
|
|
}
|
|
r38.fn.apply(r38.context, array2);
|
|
} else {
|
|
const length = r38.length;
|
|
let r5 = 0;
|
|
const r10 = 0 < length;
|
|
let r41 = void 0;
|
|
if (r10) {
|
|
do {
|
|
const once2 = r38[r5].once;
|
|
const r2 = r5;
|
|
const r23 = r41;
|
|
if (once2) {
|
|
this.removeListener(a0, r38[r2].fn, void 0, true);
|
|
}
|
|
if (length2 === 1) {
|
|
r38[r2].fn.call(r38[r2].context);
|
|
r45 = r23;
|
|
} else if (length2 === 2) {
|
|
r38[r2].fn.call(r38[r2].context, a1);
|
|
r45 = r23;
|
|
} else if (length2 === 3) {
|
|
r38[r2].fn.call(r38[r2].context, a1, a2);
|
|
r45 = r23;
|
|
} else if (length2 === 4) {
|
|
r38[r2].fn.call(r38[r2].context, a1, a2, a3);
|
|
r45 = r23;
|
|
} else {
|
|
r45 = r23;
|
|
if (!r23) {
|
|
const array = new Array(length2 - 1);
|
|
const r51 = 1 < length2;
|
|
let r0 = 1;
|
|
r45 = array;
|
|
if (r51) {
|
|
do {
|
|
array[r0 - 1] = arguments[r0];
|
|
r0 = r0 + 1;
|
|
r45 = array;
|
|
} while (r0 < length2);
|
|
}
|
|
}
|
|
r38[r2].fn.apply(r38[r2].context, r45);
|
|
}
|
|
r5 = r2 + 1;
|
|
r41 = r45;
|
|
} while (r5 < length);
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
EventEmitter.prototype.on = function on(a0, a1, a2) {
|
|
if (typeof a1 !== "function") {
|
|
throw new TypeError("The listener must be a function");
|
|
}
|
|
const context = a2 ? a2 : this;
|
|
const r10 = {
|
|
__proto__: EE.prototype
|
|
};
|
|
r10.fn = a1;
|
|
r10.context = context;
|
|
r10.once = false;
|
|
const r12 = c11677_1 ? c11677_1 + a0 : a0;
|
|
const r14 = this._events[r12];
|
|
const _events = this._events;
|
|
if (r14) {
|
|
const fn = _events[r12].fn;
|
|
const _events2 = this._events;
|
|
if (fn) {
|
|
_events2[r12] = [this._events[r12], r10];
|
|
} else {
|
|
_events2[r12].push(r10);
|
|
}
|
|
} else {
|
|
_events[r12] = r10;
|
|
this._eventsCount = this._eventsCount + 1;
|
|
}
|
|
return this;
|
|
};
|
|
EventEmitter.prototype.once = function once(a0, a1, a2) {
|
|
if (typeof a1 !== "function") {
|
|
throw new TypeError("The listener must be a function");
|
|
}
|
|
const context = a2 ? a2 : this;
|
|
const r10 = {
|
|
__proto__: EE.prototype
|
|
};
|
|
r10.fn = a1;
|
|
r10.context = context;
|
|
r10.once = true;
|
|
const r12 = c11677_1 ? c11677_1 + a0 : a0;
|
|
const r14 = this._events[r12];
|
|
const _events = this._events;
|
|
if (r14) {
|
|
const fn = _events[r12].fn;
|
|
const _events2 = this._events;
|
|
if (fn) {
|
|
_events2[r12] = [this._events[r12], r10];
|
|
} else {
|
|
_events2[r12].push(r10);
|
|
}
|
|
} else {
|
|
_events[r12] = r10;
|
|
this._eventsCount = this._eventsCount + 1;
|
|
}
|
|
return this;
|
|
};
|
|
EventEmitter.prototype.removeListener = function removeListener(a0, a1, a2, a3) {
|
|
const r8 = c11677_1 ? c11677_1 + a0 : a0;
|
|
if (this._events[r8]) {
|
|
if (a1) {
|
|
let r9 = a3;
|
|
const r10 = this._events[r8];
|
|
if (r10.fn) {
|
|
let r52 = r10.fn !== a1;
|
|
if (!r52) {
|
|
if (a3) {
|
|
r9 = !r10.once;
|
|
}
|
|
r52 = r9;
|
|
}
|
|
if (!r52) {
|
|
r52 = a2 ? r10.context !== a2 : a2;
|
|
}
|
|
if (!r52) {
|
|
const _eventsCount3 = this._eventsCount - 1;
|
|
this._eventsCount = _eventsCount3;
|
|
if (_eventsCount3 == 0) {
|
|
this._events = {
|
|
__proto__: Events.prototype
|
|
};
|
|
} else {
|
|
delete this._events[r8];
|
|
}
|
|
}
|
|
} else {
|
|
const r14 = [];
|
|
const length = r10.length;
|
|
const r29 = 0 < length;
|
|
let r0 = 0;
|
|
if (r29) {
|
|
do {
|
|
let r32 = r10[r0].fn !== a1;
|
|
const r1 = r0;
|
|
if (!r32) {
|
|
r32 = a3 ? !r10[r1].once : a3;
|
|
}
|
|
if (!r32) {
|
|
r32 = a2 ? r10[r1].context !== a2 : a2;
|
|
}
|
|
if (r32) {
|
|
r14.push(r10[r1]);
|
|
}
|
|
r0 = r1 + 1;
|
|
} while (r0 < length);
|
|
}
|
|
if (r14.length) {
|
|
this._events[r8] = r14.length === 1 ? r14[0] : r14;
|
|
} else {
|
|
const _eventsCount2 = this._eventsCount - 1;
|
|
this._eventsCount = _eventsCount2;
|
|
if (_eventsCount2 == 0) {
|
|
this._events = {
|
|
__proto__: Events.prototype
|
|
};
|
|
} else {
|
|
delete this._events[r8];
|
|
}
|
|
}
|
|
}
|
|
return this;
|
|
}
|
|
const _eventsCount = this._eventsCount - 1;
|
|
this._eventsCount = _eventsCount;
|
|
if (_eventsCount == 0) {
|
|
this._events = {
|
|
__proto__: Events.prototype
|
|
};
|
|
} else {
|
|
delete this._events[r8];
|
|
}
|
|
return this;
|
|
}
|
|
return this;
|
|
};
|
|
EventEmitter.prototype.removeAllListeners = function removeAllListeners(a0) {
|
|
if (a0) {
|
|
const r5 = c11677_1 ? c11677_1 + a0 : a0;
|
|
if (this._events[r5]) {
|
|
const _eventsCount = this._eventsCount - 1;
|
|
this._eventsCount = _eventsCount;
|
|
if (_eventsCount == 0) {
|
|
this._events = {
|
|
__proto__: Events.prototype
|
|
};
|
|
} else {
|
|
delete this._events[r5];
|
|
}
|
|
}
|
|
} else {
|
|
this._events = {
|
|
__proto__: Events.prototype
|
|
};
|
|
this._eventsCount = 0;
|
|
}
|
|
return this;
|
|
};
|
|
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
|
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
|
|
EventEmitter.prefixed = prefixed;
|
|
EventEmitter.EventEmitter = EventEmitter;
|
|
if (module !== void 0) {
|
|
module.exports = EventEmitter;
|
|
}
|