MWI-Hit-Tracker-Canvas

A Tampermonkey script to track MWI hits on Canvas.

当前为 2025-05-09 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name MWI-Hit-Tracker-Canvas
  3. // @namespace MWI-Hit-Tracker-Canvas
  4. // @version 0.8
  5. // @author Artintel, BKN46
  6. // @description A Tampermonkey script to track MWI hits on Canvas.
  7. // @match https://www.milkywayidle.com/*
  8. // @match https://test.milkywayidle.com/*
  9. // @icon https://www.milkywayidle.com/favicon.svg
  10. // @grant none
  11. // @license MIT
  12. // ==/UserScript==
  13. (function () {
  14. 'use strict';
  15.  
  16. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  17.  
  18. var check = function (it) {
  19. return it && it.Math == Math && it;
  20. };
  21.  
  22. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  23. var global$c =
  24. // eslint-disable-next-line es/no-global-this -- safe
  25. check(typeof globalThis == 'object' && globalThis) ||
  26. check(typeof window == 'object' && window) ||
  27. // eslint-disable-next-line no-restricted-globals -- safe
  28. check(typeof self == 'object' && self) ||
  29. check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
  30. // eslint-disable-next-line no-new-func -- fallback
  31. (function () { return this; })() || Function('return this')();
  32.  
  33. var objectGetOwnPropertyDescriptor = {};
  34.  
  35. var fails$8 = function (exec) {
  36. try {
  37. return !!exec();
  38. } catch (error) {
  39. return true;
  40. }
  41. };
  42.  
  43. var fails$7 = fails$8;
  44.  
  45. // Detect IE8's incomplete defineProperty implementation
  46. var descriptors = !fails$7(function () {
  47. // eslint-disable-next-line es/no-object-defineproperty -- required for testing
  48. return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
  49. });
  50.  
  51. var objectPropertyIsEnumerable = {};
  52.  
  53. var $propertyIsEnumerable = {}.propertyIsEnumerable;
  54. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  55. var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
  56.  
  57. // Nashorn ~ JDK8 bug
  58. var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
  59.  
  60. // `Object.prototype.propertyIsEnumerable` method implementation
  61. // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
  62. objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  63. var descriptor = getOwnPropertyDescriptor$1(this, V);
  64. return !!descriptor && descriptor.enumerable;
  65. } : $propertyIsEnumerable;
  66.  
  67. var createPropertyDescriptor$2 = function (bitmap, value) {
  68. return {
  69. enumerable: !(bitmap & 1),
  70. configurable: !(bitmap & 2),
  71. writable: !(bitmap & 4),
  72. value: value
  73. };
  74. };
  75.  
  76. var toString = {}.toString;
  77.  
  78. var classofRaw$1 = function (it) {
  79. return toString.call(it).slice(8, -1);
  80. };
  81.  
  82. var fails$6 = fails$8;
  83. var classof$2 = classofRaw$1;
  84.  
  85. var split = ''.split;
  86.  
  87. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  88. var indexedObject = fails$6(function () {
  89. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  90. // eslint-disable-next-line no-prototype-builtins -- safe
  91. return !Object('z').propertyIsEnumerable(0);
  92. }) ? function (it) {
  93. return classof$2(it) == 'String' ? split.call(it, '') : Object(it);
  94. } : Object;
  95.  
  96. // `RequireObjectCoercible` abstract operation
  97. // https://tc39.es/ecma262/#sec-requireobjectcoercible
  98. var requireObjectCoercible$2 = function (it) {
  99. if (it == undefined) throw TypeError("Can't call method on " + it);
  100. return it;
  101. };
  102.  
  103. // toObject with fallback for non-array-like ES3 strings
  104. var IndexedObject = indexedObject;
  105. var requireObjectCoercible$1 = requireObjectCoercible$2;
  106.  
  107. var toIndexedObject$3 = function (it) {
  108. return IndexedObject(requireObjectCoercible$1(it));
  109. };
  110.  
  111. // `IsCallable` abstract operation
  112. // https://tc39.es/ecma262/#sec-iscallable
  113. var isCallable$d = function (argument) {
  114. return typeof argument === 'function';
  115. };
  116.  
  117. var isCallable$c = isCallable$d;
  118.  
  119. var isObject$5 = function (it) {
  120. return typeof it === 'object' ? it !== null : isCallable$c(it);
  121. };
  122.  
  123. var global$b = global$c;
  124. var isCallable$b = isCallable$d;
  125.  
  126. var aFunction = function (argument) {
  127. return isCallable$b(argument) ? argument : undefined;
  128. };
  129.  
  130. var getBuiltIn$4 = function (namespace, method) {
  131. return arguments.length < 2 ? aFunction(global$b[namespace]) : global$b[namespace] && global$b[namespace][method];
  132. };
  133.  
  134. var getBuiltIn$3 = getBuiltIn$4;
  135.  
  136. var engineUserAgent = getBuiltIn$3('navigator', 'userAgent') || '';
  137.  
  138. var global$a = global$c;
  139. var userAgent = engineUserAgent;
  140.  
  141. var process = global$a.process;
  142. var Deno = global$a.Deno;
  143. var versions = process && process.versions || Deno && Deno.version;
  144. var v8 = versions && versions.v8;
  145. var match, version;
  146.  
  147. if (v8) {
  148. match = v8.split('.');
  149. version = match[0] < 4 ? 1 : match[0] + match[1];
  150. } else if (userAgent) {
  151. match = userAgent.match(/Edge\/(\d+)/);
  152. if (!match || match[1] >= 74) {
  153. match = userAgent.match(/Chrome\/(\d+)/);
  154. if (match) version = match[1];
  155. }
  156. }
  157.  
  158. var engineV8Version = version && +version;
  159.  
  160. /* eslint-disable es/no-symbol -- required for testing */
  161.  
  162. var V8_VERSION = engineV8Version;
  163. var fails$5 = fails$8;
  164.  
  165. // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
  166. var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$5(function () {
  167. var symbol = Symbol();
  168. // Chrome 38 Symbol has incorrect toString conversion
  169. // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
  170. return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
  171. // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
  172. !Symbol.sham && V8_VERSION && V8_VERSION < 41;
  173. });
  174.  
  175. /* eslint-disable es/no-symbol -- required for testing */
  176.  
  177. var NATIVE_SYMBOL$1 = nativeSymbol;
  178.  
  179. var useSymbolAsUid = NATIVE_SYMBOL$1
  180. && !Symbol.sham
  181. && typeof Symbol.iterator == 'symbol';
  182.  
  183. var isCallable$a = isCallable$d;
  184. var getBuiltIn$2 = getBuiltIn$4;
  185. var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
  186.  
  187. var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
  188. return typeof it == 'symbol';
  189. } : function (it) {
  190. var $Symbol = getBuiltIn$2('Symbol');
  191. return isCallable$a($Symbol) && Object(it) instanceof $Symbol;
  192. };
  193.  
  194. var tryToString$1 = function (argument) {
  195. try {
  196. return String(argument);
  197. } catch (error) {
  198. return 'Object';
  199. }
  200. };
  201.  
  202. var isCallable$9 = isCallable$d;
  203. var tryToString = tryToString$1;
  204.  
  205. // `Assert: IsCallable(argument) is true`
  206. var aCallable$5 = function (argument) {
  207. if (isCallable$9(argument)) return argument;
  208. throw TypeError(tryToString(argument) + ' is not a function');
  209. };
  210.  
  211. var aCallable$4 = aCallable$5;
  212.  
  213. // `GetMethod` abstract operation
  214. // https://tc39.es/ecma262/#sec-getmethod
  215. var getMethod$4 = function (V, P) {
  216. var func = V[P];
  217. return func == null ? undefined : aCallable$4(func);
  218. };
  219.  
  220. var isCallable$8 = isCallable$d;
  221. var isObject$4 = isObject$5;
  222.  
  223. // `OrdinaryToPrimitive` abstract operation
  224. // https://tc39.es/ecma262/#sec-ordinarytoprimitive
  225. var ordinaryToPrimitive$1 = function (input, pref) {
  226. var fn, val;
  227. if (pref === 'string' && isCallable$8(fn = input.toString) && !isObject$4(val = fn.call(input))) return val;
  228. if (isCallable$8(fn = input.valueOf) && !isObject$4(val = fn.call(input))) return val;
  229. if (pref !== 'string' && isCallable$8(fn = input.toString) && !isObject$4(val = fn.call(input))) return val;
  230. throw TypeError("Can't convert object to primitive value");
  231. };
  232.  
  233. var shared$3 = {exports: {}};
  234.  
  235. var global$9 = global$c;
  236.  
  237. var setGlobal$3 = function (key, value) {
  238. try {
  239. // eslint-disable-next-line es/no-object-defineproperty -- safe
  240. Object.defineProperty(global$9, key, { value: value, configurable: true, writable: true });
  241. } catch (error) {
  242. global$9[key] = value;
  243. } return value;
  244. };
  245.  
  246. var global$8 = global$c;
  247. var setGlobal$2 = setGlobal$3;
  248.  
  249. var SHARED = '__core-js_shared__';
  250. var store$3 = global$8[SHARED] || setGlobal$2(SHARED, {});
  251.  
  252. var sharedStore = store$3;
  253.  
  254. var store$2 = sharedStore;
  255.  
  256. (shared$3.exports = function (key, value) {
  257. return store$2[key] || (store$2[key] = value !== undefined ? value : {});
  258. })('versions', []).push({
  259. version: '3.18.3',
  260. mode: 'global',
  261. copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
  262. });
  263.  
  264. var requireObjectCoercible = requireObjectCoercible$2;
  265.  
  266. // `ToObject` abstract operation
  267. // https://tc39.es/ecma262/#sec-toobject
  268. var toObject$2 = function (argument) {
  269. return Object(requireObjectCoercible(argument));
  270. };
  271.  
  272. var toObject$1 = toObject$2;
  273.  
  274. var hasOwnProperty = {}.hasOwnProperty;
  275.  
  276. // `HasOwnProperty` abstract operation
  277. // https://tc39.es/ecma262/#sec-hasownproperty
  278. var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
  279. return hasOwnProperty.call(toObject$1(it), key);
  280. };
  281.  
  282. var id = 0;
  283. var postfix = Math.random();
  284.  
  285. var uid$2 = function (key) {
  286. return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
  287. };
  288.  
  289. var global$7 = global$c;
  290. var shared$2 = shared$3.exports;
  291. var hasOwn$8 = hasOwnProperty_1;
  292. var uid$1 = uid$2;
  293. var NATIVE_SYMBOL = nativeSymbol;
  294. var USE_SYMBOL_AS_UID = useSymbolAsUid;
  295.  
  296. var WellKnownSymbolsStore = shared$2('wks');
  297. var Symbol$1 = global$7.Symbol;
  298. var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
  299.  
  300. var wellKnownSymbol$8 = function (name) {
  301. if (!hasOwn$8(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
  302. if (NATIVE_SYMBOL && hasOwn$8(Symbol$1, name)) {
  303. WellKnownSymbolsStore[name] = Symbol$1[name];
  304. } else {
  305. WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
  306. }
  307. } return WellKnownSymbolsStore[name];
  308. };
  309.  
  310. var isObject$3 = isObject$5;
  311. var isSymbol$1 = isSymbol$2;
  312. var getMethod$3 = getMethod$4;
  313. var ordinaryToPrimitive = ordinaryToPrimitive$1;
  314. var wellKnownSymbol$7 = wellKnownSymbol$8;
  315.  
  316. var TO_PRIMITIVE = wellKnownSymbol$7('toPrimitive');
  317.  
  318. // `ToPrimitive` abstract operation
  319. // https://tc39.es/ecma262/#sec-toprimitive
  320. var toPrimitive$1 = function (input, pref) {
  321. if (!isObject$3(input) || isSymbol$1(input)) return input;
  322. var exoticToPrim = getMethod$3(input, TO_PRIMITIVE);
  323. var result;
  324. if (exoticToPrim) {
  325. if (pref === undefined) pref = 'default';
  326. result = exoticToPrim.call(input, pref);
  327. if (!isObject$3(result) || isSymbol$1(result)) return result;
  328. throw TypeError("Can't convert object to primitive value");
  329. }
  330. if (pref === undefined) pref = 'number';
  331. return ordinaryToPrimitive(input, pref);
  332. };
  333.  
  334. var toPrimitive = toPrimitive$1;
  335. var isSymbol = isSymbol$2;
  336.  
  337. // `ToPropertyKey` abstract operation
  338. // https://tc39.es/ecma262/#sec-topropertykey
  339. var toPropertyKey$2 = function (argument) {
  340. var key = toPrimitive(argument, 'string');
  341. return isSymbol(key) ? key : String(key);
  342. };
  343.  
  344. var global$6 = global$c;
  345. var isObject$2 = isObject$5;
  346.  
  347. var document$1 = global$6.document;
  348. // typeof document.createElement is 'object' in old IE
  349. var EXISTS$1 = isObject$2(document$1) && isObject$2(document$1.createElement);
  350.  
  351. var documentCreateElement$1 = function (it) {
  352. return EXISTS$1 ? document$1.createElement(it) : {};
  353. };
  354.  
  355. var DESCRIPTORS$5 = descriptors;
  356. var fails$4 = fails$8;
  357. var createElement = documentCreateElement$1;
  358.  
  359. // Thank's IE8 for his funny defineProperty
  360. var ie8DomDefine = !DESCRIPTORS$5 && !fails$4(function () {
  361. // eslint-disable-next-line es/no-object-defineproperty -- requied for testing
  362. return Object.defineProperty(createElement('div'), 'a', {
  363. get: function () { return 7; }
  364. }).a != 7;
  365. });
  366.  
  367. var DESCRIPTORS$4 = descriptors;
  368. var propertyIsEnumerableModule = objectPropertyIsEnumerable;
  369. var createPropertyDescriptor$1 = createPropertyDescriptor$2;
  370. var toIndexedObject$2 = toIndexedObject$3;
  371. var toPropertyKey$1 = toPropertyKey$2;
  372. var hasOwn$7 = hasOwnProperty_1;
  373. var IE8_DOM_DEFINE$1 = ie8DomDefine;
  374.  
  375. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  376. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  377.  
  378. // `Object.getOwnPropertyDescriptor` method
  379. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
  380. objectGetOwnPropertyDescriptor.f = DESCRIPTORS$4 ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  381. O = toIndexedObject$2(O);
  382. P = toPropertyKey$1(P);
  383. if (IE8_DOM_DEFINE$1) try {
  384. return $getOwnPropertyDescriptor(O, P);
  385. } catch (error) { /* empty */ }
  386. if (hasOwn$7(O, P)) return createPropertyDescriptor$1(!propertyIsEnumerableModule.f.call(O, P), O[P]);
  387. };
  388.  
  389. var objectDefineProperty = {};
  390.  
  391. var isObject$1 = isObject$5;
  392.  
  393. // `Assert: Type(argument) is Object`
  394. var anObject$b = function (argument) {
  395. if (isObject$1(argument)) return argument;
  396. throw TypeError(String(argument) + ' is not an object');
  397. };
  398.  
  399. var DESCRIPTORS$3 = descriptors;
  400. var IE8_DOM_DEFINE = ie8DomDefine;
  401. var anObject$a = anObject$b;
  402. var toPropertyKey = toPropertyKey$2;
  403.  
  404. // eslint-disable-next-line es/no-object-defineproperty -- safe
  405. var $defineProperty = Object.defineProperty;
  406.  
  407. // `Object.defineProperty` method
  408. // https://tc39.es/ecma262/#sec-object.defineproperty
  409. objectDefineProperty.f = DESCRIPTORS$3 ? $defineProperty : function defineProperty(O, P, Attributes) {
  410. anObject$a(O);
  411. P = toPropertyKey(P);
  412. anObject$a(Attributes);
  413. if (IE8_DOM_DEFINE) try {
  414. return $defineProperty(O, P, Attributes);
  415. } catch (error) { /* empty */ }
  416. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
  417. if ('value' in Attributes) O[P] = Attributes.value;
  418. return O;
  419. };
  420.  
  421. var DESCRIPTORS$2 = descriptors;
  422. var definePropertyModule$2 = objectDefineProperty;
  423. var createPropertyDescriptor = createPropertyDescriptor$2;
  424.  
  425. var createNonEnumerableProperty$5 = DESCRIPTORS$2 ? function (object, key, value) {
  426. return definePropertyModule$2.f(object, key, createPropertyDescriptor(1, value));
  427. } : function (object, key, value) {
  428. object[key] = value;
  429. return object;
  430. };
  431.  
  432. var redefine$3 = {exports: {}};
  433.  
  434. var isCallable$7 = isCallable$d;
  435. var store$1 = sharedStore;
  436.  
  437. var functionToString = Function.toString;
  438.  
  439. // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
  440. if (!isCallable$7(store$1.inspectSource)) {
  441. store$1.inspectSource = function (it) {
  442. return functionToString.call(it);
  443. };
  444. }
  445.  
  446. var inspectSource$2 = store$1.inspectSource;
  447.  
  448. var global$5 = global$c;
  449. var isCallable$6 = isCallable$d;
  450. var inspectSource$1 = inspectSource$2;
  451.  
  452. var WeakMap$1 = global$5.WeakMap;
  453.  
  454. var nativeWeakMap = isCallable$6(WeakMap$1) && /native code/.test(inspectSource$1(WeakMap$1));
  455.  
  456. var shared$1 = shared$3.exports;
  457. var uid = uid$2;
  458.  
  459. var keys = shared$1('keys');
  460.  
  461. var sharedKey$3 = function (key) {
  462. return keys[key] || (keys[key] = uid(key));
  463. };
  464.  
  465. var hiddenKeys$4 = {};
  466.  
  467. var NATIVE_WEAK_MAP = nativeWeakMap;
  468. var global$4 = global$c;
  469. var isObject = isObject$5;
  470. var createNonEnumerableProperty$4 = createNonEnumerableProperty$5;
  471. var hasOwn$6 = hasOwnProperty_1;
  472. var shared = sharedStore;
  473. var sharedKey$2 = sharedKey$3;
  474. var hiddenKeys$3 = hiddenKeys$4;
  475.  
  476. var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
  477. var WeakMap = global$4.WeakMap;
  478. var set, get, has;
  479.  
  480. var enforce = function (it) {
  481. return has(it) ? get(it) : set(it, {});
  482. };
  483.  
  484. var getterFor = function (TYPE) {
  485. return function (it) {
  486. var state;
  487. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  488. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  489. } return state;
  490. };
  491. };
  492.  
  493. if (NATIVE_WEAK_MAP || shared.state) {
  494. var store = shared.state || (shared.state = new WeakMap());
  495. var wmget = store.get;
  496. var wmhas = store.has;
  497. var wmset = store.set;
  498. set = function (it, metadata) {
  499. if (wmhas.call(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
  500. metadata.facade = it;
  501. wmset.call(store, it, metadata);
  502. return metadata;
  503. };
  504. get = function (it) {
  505. return wmget.call(store, it) || {};
  506. };
  507. has = function (it) {
  508. return wmhas.call(store, it);
  509. };
  510. } else {
  511. var STATE = sharedKey$2('state');
  512. hiddenKeys$3[STATE] = true;
  513. set = function (it, metadata) {
  514. if (hasOwn$6(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
  515. metadata.facade = it;
  516. createNonEnumerableProperty$4(it, STATE, metadata);
  517. return metadata;
  518. };
  519. get = function (it) {
  520. return hasOwn$6(it, STATE) ? it[STATE] : {};
  521. };
  522. has = function (it) {
  523. return hasOwn$6(it, STATE);
  524. };
  525. }
  526.  
  527. var internalState = {
  528. set: set,
  529. get: get,
  530. has: has,
  531. enforce: enforce,
  532. getterFor: getterFor
  533. };
  534.  
  535. var DESCRIPTORS$1 = descriptors;
  536. var hasOwn$5 = hasOwnProperty_1;
  537.  
  538. var FunctionPrototype = Function.prototype;
  539. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  540. var getDescriptor = DESCRIPTORS$1 && Object.getOwnPropertyDescriptor;
  541.  
  542. var EXISTS = hasOwn$5(FunctionPrototype, 'name');
  543. // additional protection from minified / mangled / dropped function names
  544. var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
  545. var CONFIGURABLE = EXISTS && (!DESCRIPTORS$1 || (DESCRIPTORS$1 && getDescriptor(FunctionPrototype, 'name').configurable));
  546.  
  547. var functionName = {
  548. EXISTS: EXISTS,
  549. PROPER: PROPER,
  550. CONFIGURABLE: CONFIGURABLE
  551. };
  552.  
  553. var global$3 = global$c;
  554. var isCallable$5 = isCallable$d;
  555. var hasOwn$4 = hasOwnProperty_1;
  556. var createNonEnumerableProperty$3 = createNonEnumerableProperty$5;
  557. var setGlobal$1 = setGlobal$3;
  558. var inspectSource = inspectSource$2;
  559. var InternalStateModule$1 = internalState;
  560. var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
  561.  
  562. var getInternalState$1 = InternalStateModule$1.get;
  563. var enforceInternalState = InternalStateModule$1.enforce;
  564. var TEMPLATE = String(String).split('String');
  565.  
  566. (redefine$3.exports = function (O, key, value, options) {
  567. var unsafe = options ? !!options.unsafe : false;
  568. var simple = options ? !!options.enumerable : false;
  569. var noTargetGet = options ? !!options.noTargetGet : false;
  570. var name = options && options.name !== undefined ? options.name : key;
  571. var state;
  572. if (isCallable$5(value)) {
  573. if (String(name).slice(0, 7) === 'Symbol(') {
  574. name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
  575. }
  576. if (!hasOwn$4(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
  577. createNonEnumerableProperty$3(value, 'name', name);
  578. }
  579. state = enforceInternalState(value);
  580. if (!state.source) {
  581. state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
  582. }
  583. }
  584. if (O === global$3) {
  585. if (simple) O[key] = value;
  586. else setGlobal$1(key, value);
  587. return;
  588. } else if (!unsafe) {
  589. delete O[key];
  590. } else if (!noTargetGet && O[key]) {
  591. simple = true;
  592. }
  593. if (simple) O[key] = value;
  594. else createNonEnumerableProperty$3(O, key, value);
  595. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  596. })(Function.prototype, 'toString', function toString() {
  597. return isCallable$5(this) && getInternalState$1(this).source || inspectSource(this);
  598. });
  599.  
  600. var objectGetOwnPropertyNames = {};
  601.  
  602. var ceil = Math.ceil;
  603. var floor = Math.floor;
  604.  
  605. // `ToIntegerOrInfinity` abstract operation
  606. // https://tc39.es/ecma262/#sec-tointegerorinfinity
  607. var toIntegerOrInfinity$2 = function (argument) {
  608. var number = +argument;
  609. // eslint-disable-next-line no-self-compare -- safe
  610. return number !== number || number === 0 ? 0 : (number > 0 ? floor : ceil)(number);
  611. };
  612.  
  613. var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
  614.  
  615. var max = Math.max;
  616. var min$1 = Math.min;
  617.  
  618. // Helper for a popular repeating case of the spec:
  619. // Let integer be ? ToInteger(index).
  620. // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
  621. var toAbsoluteIndex$1 = function (index, length) {
  622. var integer = toIntegerOrInfinity$1(index);
  623. return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
  624. };
  625.  
  626. var toIntegerOrInfinity = toIntegerOrInfinity$2;
  627.  
  628. var min = Math.min;
  629.  
  630. // `ToLength` abstract operation
  631. // https://tc39.es/ecma262/#sec-tolength
  632. var toLength$1 = function (argument) {
  633. return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  634. };
  635.  
  636. var toLength = toLength$1;
  637.  
  638. // `LengthOfArrayLike` abstract operation
  639. // https://tc39.es/ecma262/#sec-lengthofarraylike
  640. var lengthOfArrayLike$2 = function (obj) {
  641. return toLength(obj.length);
  642. };
  643.  
  644. var toIndexedObject$1 = toIndexedObject$3;
  645. var toAbsoluteIndex = toAbsoluteIndex$1;
  646. var lengthOfArrayLike$1 = lengthOfArrayLike$2;
  647.  
  648. // `Array.prototype.{ indexOf, includes }` methods implementation
  649. var createMethod = function (IS_INCLUDES) {
  650. return function ($this, el, fromIndex) {
  651. var O = toIndexedObject$1($this);
  652. var length = lengthOfArrayLike$1(O);
  653. var index = toAbsoluteIndex(fromIndex, length);
  654. var value;
  655. // Array#includes uses SameValueZero equality algorithm
  656. // eslint-disable-next-line no-self-compare -- NaN check
  657. if (IS_INCLUDES && el != el) while (length > index) {
  658. value = O[index++];
  659. // eslint-disable-next-line no-self-compare -- NaN check
  660. if (value != value) return true;
  661. // Array#indexOf ignores holes, Array#includes - not
  662. } else for (;length > index; index++) {
  663. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  664. } return !IS_INCLUDES && -1;
  665. };
  666. };
  667.  
  668. var arrayIncludes = {
  669. // `Array.prototype.includes` method
  670. // https://tc39.es/ecma262/#sec-array.prototype.includes
  671. includes: createMethod(true),
  672. // `Array.prototype.indexOf` method
  673. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  674. indexOf: createMethod(false)
  675. };
  676.  
  677. var hasOwn$3 = hasOwnProperty_1;
  678. var toIndexedObject = toIndexedObject$3;
  679. var indexOf = arrayIncludes.indexOf;
  680. var hiddenKeys$2 = hiddenKeys$4;
  681.  
  682. var objectKeysInternal = function (object, names) {
  683. var O = toIndexedObject(object);
  684. var i = 0;
  685. var result = [];
  686. var key;
  687. for (key in O) !hasOwn$3(hiddenKeys$2, key) && hasOwn$3(O, key) && result.push(key);
  688. // Don't enum bug & hidden keys
  689. while (names.length > i) if (hasOwn$3(O, key = names[i++])) {
  690. ~indexOf(result, key) || result.push(key);
  691. }
  692. return result;
  693. };
  694.  
  695. // IE8- don't enum bug keys
  696. var enumBugKeys$3 = [
  697. 'constructor',
  698. 'hasOwnProperty',
  699. 'isPrototypeOf',
  700. 'propertyIsEnumerable',
  701. 'toLocaleString',
  702. 'toString',
  703. 'valueOf'
  704. ];
  705.  
  706. var internalObjectKeys$1 = objectKeysInternal;
  707. var enumBugKeys$2 = enumBugKeys$3;
  708.  
  709. var hiddenKeys$1 = enumBugKeys$2.concat('length', 'prototype');
  710.  
  711. // `Object.getOwnPropertyNames` method
  712. // https://tc39.es/ecma262/#sec-object.getownpropertynames
  713. // eslint-disable-next-line es/no-object-getownpropertynames -- safe
  714. objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  715. return internalObjectKeys$1(O, hiddenKeys$1);
  716. };
  717.  
  718. var objectGetOwnPropertySymbols = {};
  719.  
  720. // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
  721. objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
  722.  
  723. var getBuiltIn$1 = getBuiltIn$4;
  724. var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
  725. var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
  726. var anObject$9 = anObject$b;
  727.  
  728. // all object keys, includes non-enumerable and symbols
  729. var ownKeys$1 = getBuiltIn$1('Reflect', 'ownKeys') || function ownKeys(it) {
  730. var keys = getOwnPropertyNamesModule.f(anObject$9(it));
  731. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  732. return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
  733. };
  734.  
  735. var hasOwn$2 = hasOwnProperty_1;
  736. var ownKeys = ownKeys$1;
  737. var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
  738. var definePropertyModule$1 = objectDefineProperty;
  739.  
  740. var copyConstructorProperties$1 = function (target, source) {
  741. var keys = ownKeys(source);
  742. var defineProperty = definePropertyModule$1.f;
  743. var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  744. for (var i = 0; i < keys.length; i++) {
  745. var key = keys[i];
  746. if (!hasOwn$2(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  747. }
  748. };
  749.  
  750. var fails$3 = fails$8;
  751. var isCallable$4 = isCallable$d;
  752.  
  753. var replacement = /#|\.prototype\./;
  754.  
  755. var isForced$1 = function (feature, detection) {
  756. var value = data[normalize(feature)];
  757. return value == POLYFILL ? true
  758. : value == NATIVE ? false
  759. : isCallable$4(detection) ? fails$3(detection)
  760. : !!detection;
  761. };
  762.  
  763. var normalize = isForced$1.normalize = function (string) {
  764. return String(string).replace(replacement, '.').toLowerCase();
  765. };
  766.  
  767. var data = isForced$1.data = {};
  768. var NATIVE = isForced$1.NATIVE = 'N';
  769. var POLYFILL = isForced$1.POLYFILL = 'P';
  770.  
  771. var isForced_1 = isForced$1;
  772.  
  773. var global$2 = global$c;
  774. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  775. var createNonEnumerableProperty$2 = createNonEnumerableProperty$5;
  776. var redefine$2 = redefine$3.exports;
  777. var setGlobal = setGlobal$3;
  778. var copyConstructorProperties = copyConstructorProperties$1;
  779. var isForced = isForced_1;
  780.  
  781. /*
  782. options.target - name of the target object
  783. options.global - target is the global object
  784. options.stat - export as static methods of target
  785. options.proto - export as prototype methods of target
  786. options.real - real prototype method for the `pure` version
  787. options.forced - export even if the native feature is available
  788. options.bind - bind methods to the target, required for the `pure` version
  789. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  790. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  791. options.sham - add a flag to not completely full polyfills
  792. options.enumerable - export as enumerable property
  793. options.noTargetGet - prevent calling a getter on target
  794. options.name - the .name of the function if it does not match the key
  795. */
  796. var _export = function (options, source) {
  797. var TARGET = options.target;
  798. var GLOBAL = options.global;
  799. var STATIC = options.stat;
  800. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  801. if (GLOBAL) {
  802. target = global$2;
  803. } else if (STATIC) {
  804. target = global$2[TARGET] || setGlobal(TARGET, {});
  805. } else {
  806. target = (global$2[TARGET] || {}).prototype;
  807. }
  808. if (target) for (key in source) {
  809. sourceProperty = source[key];
  810. if (options.noTargetGet) {
  811. descriptor = getOwnPropertyDescriptor(target, key);
  812. targetProperty = descriptor && descriptor.value;
  813. } else targetProperty = target[key];
  814. FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  815. // contained in target
  816. if (!FORCED && targetProperty !== undefined) {
  817. if (typeof sourceProperty === typeof targetProperty) continue;
  818. copyConstructorProperties(sourceProperty, targetProperty);
  819. }
  820. // add a flag to not completely full polyfills
  821. if (options.sham || (targetProperty && targetProperty.sham)) {
  822. createNonEnumerableProperty$2(sourceProperty, 'sham', true);
  823. }
  824. // extend global
  825. redefine$2(target, key, sourceProperty, options);
  826. }
  827. };
  828.  
  829. var anInstance$1 = function (it, Constructor, name) {
  830. if (it instanceof Constructor) return it;
  831. throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
  832. };
  833.  
  834. var internalObjectKeys = objectKeysInternal;
  835. var enumBugKeys$1 = enumBugKeys$3;
  836.  
  837. // `Object.keys` method
  838. // https://tc39.es/ecma262/#sec-object.keys
  839. // eslint-disable-next-line es/no-object-keys -- safe
  840. var objectKeys$1 = Object.keys || function keys(O) {
  841. return internalObjectKeys(O, enumBugKeys$1);
  842. };
  843.  
  844. var DESCRIPTORS = descriptors;
  845. var definePropertyModule = objectDefineProperty;
  846. var anObject$8 = anObject$b;
  847. var objectKeys = objectKeys$1;
  848.  
  849. // `Object.defineProperties` method
  850. // https://tc39.es/ecma262/#sec-object.defineproperties
  851. // eslint-disable-next-line es/no-object-defineproperties -- safe
  852. var objectDefineProperties = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
  853. anObject$8(O);
  854. var keys = objectKeys(Properties);
  855. var length = keys.length;
  856. var index = 0;
  857. var key;
  858. while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]);
  859. return O;
  860. };
  861.  
  862. var getBuiltIn = getBuiltIn$4;
  863.  
  864. var html$1 = getBuiltIn('document', 'documentElement');
  865.  
  866. /* global ActiveXObject -- old IE, WSH */
  867.  
  868. var anObject$7 = anObject$b;
  869. var defineProperties = objectDefineProperties;
  870. var enumBugKeys = enumBugKeys$3;
  871. var hiddenKeys = hiddenKeys$4;
  872. var html = html$1;
  873. var documentCreateElement = documentCreateElement$1;
  874. var sharedKey$1 = sharedKey$3;
  875.  
  876. var GT = '>';
  877. var LT = '<';
  878. var PROTOTYPE = 'prototype';
  879. var SCRIPT = 'script';
  880. var IE_PROTO$1 = sharedKey$1('IE_PROTO');
  881.  
  882. var EmptyConstructor = function () { /* empty */ };
  883.  
  884. var scriptTag = function (content) {
  885. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  886. };
  887.  
  888. // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
  889. var NullProtoObjectViaActiveX = function (activeXDocument) {
  890. activeXDocument.write(scriptTag(''));
  891. activeXDocument.close();
  892. var temp = activeXDocument.parentWindow.Object;
  893. activeXDocument = null; // avoid memory leak
  894. return temp;
  895. };
  896.  
  897. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  898. var NullProtoObjectViaIFrame = function () {
  899. // Thrash, waste and sodomy: IE GC bug
  900. var iframe = documentCreateElement('iframe');
  901. var JS = 'java' + SCRIPT + ':';
  902. var iframeDocument;
  903. iframe.style.display = 'none';
  904. html.appendChild(iframe);
  905. // https://github.com/zloirock/core-js/issues/475
  906. iframe.src = String(JS);
  907. iframeDocument = iframe.contentWindow.document;
  908. iframeDocument.open();
  909. iframeDocument.write(scriptTag('document.F=Object'));
  910. iframeDocument.close();
  911. return iframeDocument.F;
  912. };
  913.  
  914. // Check for document.domain and active x support
  915. // No need to use active x approach when document.domain is not set
  916. // see https://github.com/es-shims/es5-shim/issues/150
  917. // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
  918. // avoid IE GC bug
  919. var activeXDocument;
  920. var NullProtoObject = function () {
  921. try {
  922. activeXDocument = new ActiveXObject('htmlfile');
  923. } catch (error) { /* ignore */ }
  924. NullProtoObject = typeof document != 'undefined'
  925. ? document.domain && activeXDocument
  926. ? NullProtoObjectViaActiveX(activeXDocument) // old IE
  927. : NullProtoObjectViaIFrame()
  928. : NullProtoObjectViaActiveX(activeXDocument); // WSH
  929. var length = enumBugKeys.length;
  930. while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  931. return NullProtoObject();
  932. };
  933.  
  934. hiddenKeys[IE_PROTO$1] = true;
  935.  
  936. // `Object.create` method
  937. // https://tc39.es/ecma262/#sec-object.create
  938. var objectCreate = Object.create || function create(O, Properties) {
  939. var result;
  940. if (O !== null) {
  941. EmptyConstructor[PROTOTYPE] = anObject$7(O);
  942. result = new EmptyConstructor();
  943. EmptyConstructor[PROTOTYPE] = null;
  944. // add "__proto__" for Object.getPrototypeOf polyfill
  945. result[IE_PROTO$1] = O;
  946. } else result = NullProtoObject();
  947. return Properties === undefined ? result : defineProperties(result, Properties);
  948. };
  949.  
  950. var fails$2 = fails$8;
  951.  
  952. var correctPrototypeGetter = !fails$2(function () {
  953. function F() { /* empty */ }
  954. F.prototype.constructor = null;
  955. // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
  956. return Object.getPrototypeOf(new F()) !== F.prototype;
  957. });
  958.  
  959. var hasOwn$1 = hasOwnProperty_1;
  960. var isCallable$3 = isCallable$d;
  961. var toObject = toObject$2;
  962. var sharedKey = sharedKey$3;
  963. var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
  964.  
  965. var IE_PROTO = sharedKey('IE_PROTO');
  966. var ObjectPrototype = Object.prototype;
  967.  
  968. // `Object.getPrototypeOf` method
  969. // https://tc39.es/ecma262/#sec-object.getprototypeof
  970. // eslint-disable-next-line es/no-object-getprototypeof -- safe
  971. var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {
  972. var object = toObject(O);
  973. if (hasOwn$1(object, IE_PROTO)) return object[IE_PROTO];
  974. var constructor = object.constructor;
  975. if (isCallable$3(constructor) && object instanceof constructor) {
  976. return constructor.prototype;
  977. } return object instanceof Object ? ObjectPrototype : null;
  978. };
  979.  
  980. var fails$1 = fails$8;
  981. var isCallable$2 = isCallable$d;
  982. var getPrototypeOf = objectGetPrototypeOf;
  983. var redefine$1 = redefine$3.exports;
  984. var wellKnownSymbol$6 = wellKnownSymbol$8;
  985.  
  986. var ITERATOR$2 = wellKnownSymbol$6('iterator');
  987. var BUGGY_SAFARI_ITERATORS = false;
  988.  
  989. // `%IteratorPrototype%` object
  990. // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
  991. var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
  992.  
  993. /* eslint-disable es/no-array-prototype-keys -- safe */
  994. if ([].keys) {
  995. arrayIterator = [].keys();
  996. // Safari 8 has buggy iterators w/o `next`
  997. if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
  998. else {
  999. PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
  1000. if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
  1001. }
  1002. }
  1003.  
  1004. var NEW_ITERATOR_PROTOTYPE = IteratorPrototype$2 == undefined || fails$1(function () {
  1005. var test = {};
  1006. // FF44- legacy iterators case
  1007. return IteratorPrototype$2[ITERATOR$2].call(test) !== test;
  1008. });
  1009.  
  1010. if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
  1011.  
  1012. // `%IteratorPrototype%[@@iterator]()` method
  1013. // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
  1014. if (!isCallable$2(IteratorPrototype$2[ITERATOR$2])) {
  1015. redefine$1(IteratorPrototype$2, ITERATOR$2, function () {
  1016. return this;
  1017. });
  1018. }
  1019.  
  1020. var iteratorsCore = {
  1021. IteratorPrototype: IteratorPrototype$2,
  1022. BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
  1023. };
  1024.  
  1025. // https://github.com/tc39/proposal-iterator-helpers
  1026. var $$2 = _export;
  1027. var global$1 = global$c;
  1028. var anInstance = anInstance$1;
  1029. var isCallable$1 = isCallable$d;
  1030. var createNonEnumerableProperty$1 = createNonEnumerableProperty$5;
  1031. var fails = fails$8;
  1032. var hasOwn = hasOwnProperty_1;
  1033. var wellKnownSymbol$5 = wellKnownSymbol$8;
  1034. var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
  1035.  
  1036. var TO_STRING_TAG$3 = wellKnownSymbol$5('toStringTag');
  1037.  
  1038. var NativeIterator = global$1.Iterator;
  1039.  
  1040. // FF56- have non-standard global helper `Iterator`
  1041. var FORCED = !isCallable$1(NativeIterator)
  1042. || NativeIterator.prototype !== IteratorPrototype$1
  1043. // FF44- non-standard `Iterator` passes previous tests
  1044. || !fails(function () { NativeIterator({}); });
  1045.  
  1046. var IteratorConstructor = function Iterator() {
  1047. anInstance(this, IteratorConstructor);
  1048. };
  1049.  
  1050. if (!hasOwn(IteratorPrototype$1, TO_STRING_TAG$3)) {
  1051. createNonEnumerableProperty$1(IteratorPrototype$1, TO_STRING_TAG$3, 'Iterator');
  1052. }
  1053.  
  1054. if (FORCED || !hasOwn(IteratorPrototype$1, 'constructor') || IteratorPrototype$1.constructor === Object) {
  1055. createNonEnumerableProperty$1(IteratorPrototype$1, 'constructor', IteratorConstructor);
  1056. }
  1057.  
  1058. IteratorConstructor.prototype = IteratorPrototype$1;
  1059.  
  1060. $$2({ global: true, forced: FORCED }, {
  1061. Iterator: IteratorConstructor
  1062. });
  1063.  
  1064. var iterators = {};
  1065.  
  1066. var wellKnownSymbol$4 = wellKnownSymbol$8;
  1067. var Iterators$1 = iterators;
  1068.  
  1069. var ITERATOR$1 = wellKnownSymbol$4('iterator');
  1070. var ArrayPrototype = Array.prototype;
  1071.  
  1072. // check on default Array iterator
  1073. var isArrayIteratorMethod$1 = function (it) {
  1074. return it !== undefined && (Iterators$1.Array === it || ArrayPrototype[ITERATOR$1] === it);
  1075. };
  1076.  
  1077. var aCallable$3 = aCallable$5;
  1078.  
  1079. // optional / simple context binding
  1080. var functionBindContext = function (fn, that, length) {
  1081. aCallable$3(fn);
  1082. if (that === undefined) return fn;
  1083. switch (length) {
  1084. case 0: return function () {
  1085. return fn.call(that);
  1086. };
  1087. case 1: return function (a) {
  1088. return fn.call(that, a);
  1089. };
  1090. case 2: return function (a, b) {
  1091. return fn.call(that, a, b);
  1092. };
  1093. case 3: return function (a, b, c) {
  1094. return fn.call(that, a, b, c);
  1095. };
  1096. }
  1097. return function (/* ...args */) {
  1098. return fn.apply(that, arguments);
  1099. };
  1100. };
  1101.  
  1102. var wellKnownSymbol$3 = wellKnownSymbol$8;
  1103.  
  1104. var TO_STRING_TAG$2 = wellKnownSymbol$3('toStringTag');
  1105. var test = {};
  1106.  
  1107. test[TO_STRING_TAG$2] = 'z';
  1108.  
  1109. var toStringTagSupport = String(test) === '[object z]';
  1110.  
  1111. var TO_STRING_TAG_SUPPORT = toStringTagSupport;
  1112. var isCallable = isCallable$d;
  1113. var classofRaw = classofRaw$1;
  1114. var wellKnownSymbol$2 = wellKnownSymbol$8;
  1115.  
  1116. var TO_STRING_TAG$1 = wellKnownSymbol$2('toStringTag');
  1117. // ES3 wrong here
  1118. var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
  1119.  
  1120. // fallback for IE11 Script Access Denied error
  1121. var tryGet = function (it, key) {
  1122. try {
  1123. return it[key];
  1124. } catch (error) { /* empty */ }
  1125. };
  1126.  
  1127. // getting tag from ES6+ `Object.prototype.toString`
  1128. var classof$1 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
  1129. var O, tag, result;
  1130. return it === undefined ? 'Undefined' : it === null ? 'Null'
  1131. // @@toStringTag case
  1132. : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$1)) == 'string' ? tag
  1133. // builtinTag case
  1134. : CORRECT_ARGUMENTS ? classofRaw(O)
  1135. // ES3 arguments fallback
  1136. : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
  1137. };
  1138.  
  1139. var classof = classof$1;
  1140. var getMethod$2 = getMethod$4;
  1141. var Iterators = iterators;
  1142. var wellKnownSymbol$1 = wellKnownSymbol$8;
  1143.  
  1144. var ITERATOR = wellKnownSymbol$1('iterator');
  1145.  
  1146. var getIteratorMethod$2 = function (it) {
  1147. if (it != undefined) return getMethod$2(it, ITERATOR)
  1148. || getMethod$2(it, '@@iterator')
  1149. || Iterators[classof(it)];
  1150. };
  1151.  
  1152. var aCallable$2 = aCallable$5;
  1153. var anObject$6 = anObject$b;
  1154. var getIteratorMethod$1 = getIteratorMethod$2;
  1155.  
  1156. var getIterator$1 = function (argument, usingIterator) {
  1157. var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
  1158. if (aCallable$2(iteratorMethod)) return anObject$6(iteratorMethod.call(argument));
  1159. throw TypeError(String(argument) + ' is not iterable');
  1160. };
  1161.  
  1162. var anObject$5 = anObject$b;
  1163. var getMethod$1 = getMethod$4;
  1164.  
  1165. var iteratorClose$2 = function (iterator, kind, value) {
  1166. var innerResult, innerError;
  1167. anObject$5(iterator);
  1168. try {
  1169. innerResult = getMethod$1(iterator, 'return');
  1170. if (!innerResult) {
  1171. if (kind === 'throw') throw value;
  1172. return value;
  1173. }
  1174. innerResult = innerResult.call(iterator);
  1175. } catch (error) {
  1176. innerError = true;
  1177. innerResult = error;
  1178. }
  1179. if (kind === 'throw') throw value;
  1180. if (innerError) throw innerResult;
  1181. anObject$5(innerResult);
  1182. return value;
  1183. };
  1184.  
  1185. var anObject$4 = anObject$b;
  1186. var isArrayIteratorMethod = isArrayIteratorMethod$1;
  1187. var lengthOfArrayLike = lengthOfArrayLike$2;
  1188. var bind = functionBindContext;
  1189. var getIterator = getIterator$1;
  1190. var getIteratorMethod = getIteratorMethod$2;
  1191. var iteratorClose$1 = iteratorClose$2;
  1192.  
  1193. var Result = function (stopped, result) {
  1194. this.stopped = stopped;
  1195. this.result = result;
  1196. };
  1197.  
  1198. var iterate$1 = function (iterable, unboundFunction, options) {
  1199. var that = options && options.that;
  1200. var AS_ENTRIES = !!(options && options.AS_ENTRIES);
  1201. var IS_ITERATOR = !!(options && options.IS_ITERATOR);
  1202. var INTERRUPTED = !!(options && options.INTERRUPTED);
  1203. var fn = bind(unboundFunction, that, 1 + AS_ENTRIES + INTERRUPTED);
  1204. var iterator, iterFn, index, length, result, next, step;
  1205.  
  1206. var stop = function (condition) {
  1207. if (iterator) iteratorClose$1(iterator, 'normal', condition);
  1208. return new Result(true, condition);
  1209. };
  1210.  
  1211. var callFn = function (value) {
  1212. if (AS_ENTRIES) {
  1213. anObject$4(value);
  1214. return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
  1215. } return INTERRUPTED ? fn(value, stop) : fn(value);
  1216. };
  1217.  
  1218. if (IS_ITERATOR) {
  1219. iterator = iterable;
  1220. } else {
  1221. iterFn = getIteratorMethod(iterable);
  1222. if (!iterFn) throw TypeError(String(iterable) + ' is not iterable');
  1223. // optimisation for array iterators
  1224. if (isArrayIteratorMethod(iterFn)) {
  1225. for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
  1226. result = callFn(iterable[index]);
  1227. if (result && result instanceof Result) return result;
  1228. } return new Result(false);
  1229. }
  1230. iterator = getIterator(iterable, iterFn);
  1231. }
  1232.  
  1233. next = iterator.next;
  1234. while (!(step = next.call(iterator)).done) {
  1235. try {
  1236. result = callFn(step.value);
  1237. } catch (error) {
  1238. iteratorClose$1(iterator, 'throw', error);
  1239. }
  1240. if (typeof result == 'object' && result && result instanceof Result) return result;
  1241. } return new Result(false);
  1242. };
  1243.  
  1244. // https://github.com/tc39/proposal-iterator-helpers
  1245. var $$1 = _export;
  1246. var iterate = iterate$1;
  1247. var anObject$3 = anObject$b;
  1248.  
  1249. $$1({ target: 'Iterator', proto: true, real: true }, {
  1250. forEach: function forEach(fn) {
  1251. iterate(anObject$3(this), fn, { IS_ITERATOR: true });
  1252. }
  1253. });
  1254.  
  1255. var redefine = redefine$3.exports;
  1256.  
  1257. var redefineAll$1 = function (target, src, options) {
  1258. for (var key in src) redefine(target, key, src[key], options);
  1259. return target;
  1260. };
  1261.  
  1262. var aCallable$1 = aCallable$5;
  1263. var anObject$2 = anObject$b;
  1264. var create = objectCreate;
  1265. var createNonEnumerableProperty = createNonEnumerableProperty$5;
  1266. var redefineAll = redefineAll$1;
  1267. var wellKnownSymbol = wellKnownSymbol$8;
  1268. var InternalStateModule = internalState;
  1269. var getMethod = getMethod$4;
  1270. var IteratorPrototype = iteratorsCore.IteratorPrototype;
  1271.  
  1272. var setInternalState = InternalStateModule.set;
  1273. var getInternalState = InternalStateModule.get;
  1274.  
  1275. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  1276.  
  1277. var iteratorCreateProxy = function (nextHandler, IS_ITERATOR) {
  1278. var IteratorProxy = function Iterator(state) {
  1279. state.next = aCallable$1(state.iterator.next);
  1280. state.done = false;
  1281. state.ignoreArg = !IS_ITERATOR;
  1282. setInternalState(this, state);
  1283. };
  1284.  
  1285. IteratorProxy.prototype = redefineAll(create(IteratorPrototype), {
  1286. next: function next(arg) {
  1287. var state = getInternalState(this);
  1288. var args = arguments.length ? [state.ignoreArg ? undefined : arg] : IS_ITERATOR ? [] : [undefined];
  1289. state.ignoreArg = false;
  1290. var result = state.done ? undefined : nextHandler.call(state, args);
  1291. return { done: state.done, value: result };
  1292. },
  1293. 'return': function (value) {
  1294. var state = getInternalState(this);
  1295. var iterator = state.iterator;
  1296. state.done = true;
  1297. var $$return = getMethod(iterator, 'return');
  1298. return { done: true, value: $$return ? anObject$2($$return.call(iterator, value)).value : value };
  1299. },
  1300. 'throw': function (value) {
  1301. var state = getInternalState(this);
  1302. var iterator = state.iterator;
  1303. state.done = true;
  1304. var $$throw = getMethod(iterator, 'throw');
  1305. if ($$throw) return $$throw.call(iterator, value);
  1306. throw value;
  1307. }
  1308. });
  1309.  
  1310. if (!IS_ITERATOR) {
  1311. createNonEnumerableProperty(IteratorProxy.prototype, TO_STRING_TAG, 'Generator');
  1312. }
  1313.  
  1314. return IteratorProxy;
  1315. };
  1316.  
  1317. var anObject$1 = anObject$b;
  1318. var iteratorClose = iteratorClose$2;
  1319.  
  1320. // call something on iterator step with safe closing on error
  1321. var callWithSafeIterationClosing$1 = function (iterator, fn, value, ENTRIES) {
  1322. try {
  1323. return ENTRIES ? fn(anObject$1(value)[0], value[1]) : fn(value);
  1324. } catch (error) {
  1325. iteratorClose(iterator, 'throw', error);
  1326. }
  1327. };
  1328.  
  1329. // https://github.com/tc39/proposal-iterator-helpers
  1330. var $ = _export;
  1331. var aCallable = aCallable$5;
  1332. var anObject = anObject$b;
  1333. var createIteratorProxy = iteratorCreateProxy;
  1334. var callWithSafeIterationClosing = callWithSafeIterationClosing$1;
  1335.  
  1336. var IteratorProxy = createIteratorProxy(function (args) {
  1337. var iterator = this.iterator;
  1338. var result = anObject(this.next.apply(iterator, args));
  1339. var done = this.done = !!result.done;
  1340. if (!done) return callWithSafeIterationClosing(iterator, this.mapper, result.value);
  1341. });
  1342.  
  1343. $({ target: 'Iterator', proto: true, real: true }, {
  1344. map: function map(mapper) {
  1345. return new IteratorProxy({
  1346. iterator: anObject(this),
  1347. mapper: aCallable(mapper)
  1348. });
  1349. }
  1350. });
  1351.  
  1352. const isZHInGameSetting = localStorage.getItem("i18nextLng")?.toLowerCase()?.startsWith("zh"); // 获取游戏内设置语言
  1353. let isZH = isZHInGameSetting; // MWITools 本身显示的语言默认由游戏内设置语言决定
  1354.  
  1355. let settingsMap = {
  1356. tracker0: {
  1357. id: "tracker0",
  1358. desc: isZH ? "玩家 #1" : "player #1",
  1359. isTrue: true,
  1360. r: 255,
  1361. g: 99,
  1362. b: 132
  1363. },
  1364. tracker1: {
  1365. id: "tracker1",
  1366. desc: isZH ? "玩家 #2" : "player #2",
  1367. isTrue: true,
  1368. r: 54,
  1369. g: 162,
  1370. b: 235
  1371. },
  1372. tracker2: {
  1373. id: "tracker2",
  1374. desc: isZH ? "玩家 #3" : "player #3",
  1375. isTrue: true,
  1376. r: 255,
  1377. g: 206,
  1378. b: 86
  1379. },
  1380. tracker3: {
  1381. id: "tracker3",
  1382. desc: isZH ? "玩家 #4" : "player #4",
  1383. isTrue: true,
  1384. r: 75,
  1385. g: 192,
  1386. b: 192
  1387. },
  1388. tracker4: {
  1389. id: "tracker4",
  1390. desc: isZH ? "玩家 #5" : "player #5",
  1391. isTrue: true,
  1392. r: 153,
  1393. g: 102,
  1394. b: 255
  1395. },
  1396. tracker6: {
  1397. id: "tracker6",
  1398. desc: isZH ? "敌人" : "enemies",
  1399. isTrue: true,
  1400. r: 255,
  1401. g: 0,
  1402. b: 0
  1403. }
  1404. };
  1405. readSettings();
  1406. function waitForSetttins() {
  1407. const targetNode = document.querySelector("div.SettingsPanel_profileTab__214Bj");
  1408. if (targetNode) {
  1409. if (!targetNode.querySelector("#tracker_settings")) {
  1410. targetNode.insertAdjacentHTML("beforeend", `<div id="tracker_settings"></div>`);
  1411. const insertElem = targetNode.querySelector("div#tracker_settings");
  1412. insertElem.insertAdjacentHTML("beforeend", `<div style="float: left; color: orange">${isZH ? "MWI-Hit-Tracker 设置 :" : "MWI-Hit-Tracker Settings: "}</div></br>`);
  1413. for (const setting of Object.values(settingsMap)) {
  1414. insertElem.insertAdjacentHTML("beforeend", `<div class="tracker-option"><input type="checkbox" id="${setting.id}" ${setting.isTrue ? "checked" : ""}></input>${setting.desc}<div class="color-preview" id="colorPreview_${setting.id}"></div></div>`);
  1415. // 颜色自定义
  1416. const colorPreview = document.getElementById('colorPreview_' + setting.id);
  1417. let currentColor = {
  1418. r: setting.r,
  1419. g: setting.g,
  1420. b: setting.b
  1421. };
  1422.  
  1423. // 点击打开颜色选择器
  1424. colorPreview.addEventListener('click', () => {
  1425. const settingColor = {
  1426. r: settingsMap[setting.id].r,
  1427. g: settingsMap[setting.id].g,
  1428. b: settingsMap[setting.id].b
  1429. };
  1430. const modal = createColorPicker(settingColor, newColor => {
  1431. currentColor = newColor;
  1432. settingsMap[setting.id].r = newColor.r;
  1433. settingsMap[setting.id].g = newColor.g;
  1434. settingsMap[setting.id].b = newColor.b;
  1435. localStorage.setItem("tracker_settingsMap", JSON.stringify(settingsMap));
  1436. updatePreview();
  1437. });
  1438. document.body.appendChild(modal);
  1439. });
  1440. function updatePreview() {
  1441. colorPreview.style.backgroundColor = `rgb(${currentColor.r},${currentColor.g},${currentColor.b})`;
  1442. }
  1443. updatePreview();
  1444. function createColorPicker(initialColor, callback) {
  1445. // 创建弹窗容器
  1446. const backdrop = document.createElement('div');
  1447. backdrop.className = 'modal-backdrop';
  1448. const modal = document.createElement('div');
  1449. modal.className = 'color-picker-modal';
  1450.  
  1451. // 颜色预览
  1452. //const preview = document.createElement('div');
  1453. //preview.className = 'color-preview';
  1454. //preview.style.height = '100px';
  1455. // 创建SVG容器
  1456. const preview = document.createElementNS("http://www.w3.org/2000/svg", "svg");
  1457. preview.setAttribute("width", "200");
  1458. preview.setAttribute("height", "150");
  1459. preview.style.display = 'block';
  1460. // 创建抛物线路径
  1461. const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
  1462. Object.assign(path.style, {
  1463. strokeWidth: '5px',
  1464. fill: 'none',
  1465. strokeLinecap: 'round'
  1466. });
  1467. path.setAttribute("d", "M 0 130 Q 100 0 200 130");
  1468. preview.appendChild(path);
  1469.  
  1470. // 颜色控制组件
  1471. const controls = document.createElement('div');
  1472. ['r', 'g', 'b'].forEach(channel => {
  1473. const container = document.createElement('div');
  1474. container.className = 'slider-container';
  1475.  
  1476. // 标签
  1477. const label = document.createElement('label');
  1478. label.textContent = channel.toUpperCase() + ':';
  1479. label.style.color = "white";
  1480.  
  1481. // 滑块
  1482. const slider = document.createElement('input');
  1483. slider.type = 'range';
  1484. slider.min = 0;
  1485. slider.max = 255;
  1486. slider.value = initialColor[channel];
  1487.  
  1488. // 输入框
  1489. const input = document.createElement('input');
  1490. input.type = 'number';
  1491. input.min = 0;
  1492. input.max = 255;
  1493. input.value = initialColor[channel];
  1494. input.style.width = '60px';
  1495.  
  1496. // 双向绑定
  1497. const updateChannel = value => {
  1498. value = Math.min(255, Math.max(0, parseInt(value) || 0));
  1499. slider.value = value;
  1500. input.value = value;
  1501. currentColor[channel] = value;
  1502. path.style.stroke = getColorString(currentColor);
  1503. };
  1504. slider.addEventListener('input', e => updateChannel(e.target.value));
  1505. input.addEventListener('change', e => updateChannel(e.target.value));
  1506. container.append(label, slider, input);
  1507. controls.append(container);
  1508. });
  1509.  
  1510. // 操作按钮
  1511. const actions = document.createElement('div');
  1512. actions.className = 'modal-actions';
  1513. const confirmBtn = document.createElement('button');
  1514. confirmBtn.textContent = isZH ? '确定' : 'OK';
  1515. confirmBtn.onclick = () => {
  1516. callback(currentColor);
  1517. backdrop.remove();
  1518. };
  1519. const cancelBtn = document.createElement('button');
  1520. cancelBtn.textContent = isZH ? '取消' : 'Cancel';
  1521. cancelBtn.onclick = () => backdrop.remove();
  1522. actions.append(cancelBtn, confirmBtn);
  1523.  
  1524. // 组装弹窗
  1525. const getColorString = color => `rgb(${color.r},${color.g},${color.b})`;
  1526. path.style.stroke = getColorString(settingsMap[setting.id]);
  1527. modal.append(preview, controls, actions);
  1528. backdrop.append(modal);
  1529.  
  1530. // 点击背景关闭
  1531. backdrop.addEventListener('click', e => {
  1532. if (e.target === backdrop) backdrop.remove();
  1533. });
  1534. return backdrop;
  1535. }
  1536. }
  1537. insertElem.addEventListener("change", saveSettings);
  1538. }
  1539. }
  1540. setTimeout(waitForSetttins, 500);
  1541. }
  1542. function saveSettings() {
  1543. for (const checkbox of document.querySelectorAll("div#tracker_settings input")) {
  1544. settingsMap[checkbox.id].isTrue = checkbox.checked;
  1545. localStorage.setItem("tracker_settingsMap", JSON.stringify(settingsMap));
  1546. }
  1547. }
  1548. function readSettings() {
  1549. const ls = localStorage.getItem("tracker_settingsMap");
  1550. if (ls) {
  1551. const lsObj = JSON.parse(ls);
  1552. for (const option of Object.values(lsObj)) {
  1553. if (settingsMap.hasOwnProperty(option.id)) {
  1554. settingsMap[option.id].isTrue = option.isTrue;
  1555. settingsMap[option.id].r = option.r;
  1556. settingsMap[option.id].g = option.g;
  1557. settingsMap[option.id].b = option.b;
  1558. }
  1559. }
  1560. }
  1561. }
  1562. const style = document.createElement('style');
  1563. style.textContent = `
  1564. .tracker-option {
  1565. display: flex;
  1566. align-items: center;
  1567. }
  1568.  
  1569. .color-preview {
  1570. cursor: pointer;
  1571. width: 20px;
  1572. height: 20px;
  1573. margin: 3px 3px;
  1574. border: 1px solid #ccc;
  1575. border-radius: 3px;
  1576. }
  1577.  
  1578. .color-picker-modal {
  1579. position: fixed;
  1580. top: 50%;
  1581. left: 50%;
  1582. transform: translate(-50%, -50%);
  1583. background: rgba(0, 0, 0, 0.5);
  1584. padding: 20px;
  1585. border: 1px solid rgba(255, 255, 255, 0.2);
  1586. border-radius: 8px;
  1587. box-shadow: 0 0 20px rgba(0,0,0,0.2);
  1588. z-index: 1000;
  1589. }
  1590.  
  1591. .modal-backdrop {
  1592. position: fixed;
  1593. top: 0;
  1594. left: 0;
  1595. right: 0;
  1596. bottom: 0;
  1597. background: rgba(0,0,0,0.5);
  1598. z-index: 999;
  1599. }
  1600.  
  1601. .modal-actions {
  1602. margin-top: 20px;
  1603. display: flex;
  1604. gap: 10px;
  1605. justify-content: flex-end;
  1606. }
  1607. `;
  1608. document.head.appendChild(style);
  1609.  
  1610. const canvas = initTrackerCanvas();
  1611. const ctx = canvas.getContext('2d');
  1612. function initTrackerCanvas() {
  1613. const gamePanel = document.querySelector("body");
  1614. const canvas = document.createElement('canvas');
  1615. canvas.id = 'hitTrackerCanvas';
  1616. canvas.style.position = 'fixed';
  1617. canvas.style.top = '0';
  1618. canvas.style.left = '0';
  1619. canvas.style.pointerEvents = 'none';
  1620. canvas.style.zIndex = '200';
  1621. canvas.style.width = '100%';
  1622. canvas.style.height = '100%';
  1623. canvas.width = window.innerWidth;
  1624. canvas.height = window.innerHeight;
  1625. canvas.pointerEvents = 'none';
  1626. gamePanel.appendChild(canvas);
  1627. window.addEventListener('resize', () => {
  1628. // canvas.width = battlePanel.offsetWidth;
  1629. // canvas.height = battlePanel.offsetHeight;
  1630. canvas.width = window.innerWidth;
  1631. canvas.height = window.innerHeight;
  1632. });
  1633. return canvas;
  1634. }
  1635.  
  1636. // 更新和渲染所有爆炸
  1637. function updateExplosions() {
  1638. // 遍历所有活跃的爆炸
  1639. for (let i = activeExplosions.length - 1; i >= 0; i--) {
  1640. const explosion = activeExplosions[i];
  1641. explosion.count++;
  1642. if (explosion.count >= explosion.maxCount) {
  1643. // 爆炸结束,从列表中移除
  1644. activeExplosions.splice(i, 1);
  1645. continue;
  1646. }
  1647. ctx.save();
  1648.  
  1649. // 更新和绘制冲击波
  1650. explosion.shockwaves.forEach((wave, index) => {
  1651. wave.radius += (wave.maxRadius - wave.radius) * 0.1;
  1652. wave.life -= 10;
  1653. if (wave.life > 0) {
  1654. const alpha = wave.life / 400;
  1655. ctx.beginPath();
  1656. ctx.strokeStyle = wave.color;
  1657. ctx.arc(wave.x, wave.y, wave.radius, 0, Math.PI * 2);
  1658. // ctx.strokeStyle = `${wave.color.slice(0, -2)}${alpha})`;
  1659. ctx.lineWidth = 5 * alpha;
  1660. ctx.stroke();
  1661. }
  1662. });
  1663.  
  1664. // 更新和绘制主要爆炸粒子
  1665. explosion.particles.forEach((p, index) => {
  1666. p.speed *= 0.96; // 速度衰减
  1667. p.x += Math.cos(p.angle) * p.speed;
  1668. p.y += Math.sin(p.angle) * p.speed + p.gravity;
  1669. p.life -= 5;
  1670. if (p.life > 0) {
  1671. const alpha = p.life / 300;
  1672. ctx.beginPath();
  1673. ctx.arc(p.x, p.y, p.size * (p.life / 300), 0, Math.PI * 2);
  1674. ctx.fillStyle = `${p.color.slice(0, -4)}%, ${alpha})`;
  1675. ctx.fill();
  1676. }
  1677. });
  1678.  
  1679. // 更新和绘制余烬
  1680. explosion.embers.forEach((e, index) => {
  1681. e.speed *= 0.99; // 慢慢减速
  1682. e.x += Math.cos(e.angle) * e.speed;
  1683. e.y += Math.sin(e.angle) * e.speed + e.gravity;
  1684. e.life -= 3;
  1685. if (e.life > 0) {
  1686. const alpha = e.life / 800;
  1687. ctx.beginPath();
  1688. ctx.arc(e.x, e.y, e.size * (e.life / 800), 0, Math.PI * 2);
  1689. ctx.fillStyle = `${e.color.slice(0, -4)}%, ${alpha})`;
  1690. ctx.fill();
  1691.  
  1692. // 余烬偶尔产生的小火花
  1693. if (Math.random() < 0.03) {
  1694. ctx.beginPath();
  1695. ctx.arc(e.x, e.y, e.size * 1.5, 0, Math.PI * 2);
  1696. ctx.fillStyle = `hsla(30, 100%, 70%, ${alpha * 0.7})`;
  1697. ctx.fill();
  1698. }
  1699. }
  1700. });
  1701.  
  1702. // 更新和绘制烟雾
  1703. explosion.smokeParticles.forEach((s, index) => {
  1704. s.x += Math.cos(s.angle) * s.speed;
  1705. s.y += Math.sin(s.angle) * s.speed + s.gravity;
  1706. s.life -= 2;
  1707. s.alpha = Math.max(0, s.alpha - 0.003);
  1708. if (s.life > 0) {
  1709. ctx.beginPath();
  1710. ctx.arc(s.x, s.y, s.size, 0, Math.PI * 2);
  1711. ctx.fillStyle = `rgba(80, 80, 80, ${s.alpha * (s.life / 1200)})`;
  1712. ctx.fill();
  1713. }
  1714. });
  1715.  
  1716. // 伤害文本
  1717. if (explosion.otherInfo.damage) {
  1718. const fontSize = Math.min(Math.max(12, Math.pow(explosion.otherInfo.damage, 0.7) / 2), 80);
  1719. const damageText = `${explosion.otherInfo.damage}`;
  1720. ctx.font = `${fontSize}px Arial`;
  1721. ctx.textAlign = 'center';
  1722. ctx.textBaseline = 'middle';
  1723. // border
  1724. ctx.strokeStyle = explosion.otherInfo.color;
  1725. ctx.lineWidth = 6;
  1726. ctx.strokeText(damageText, explosion.otherInfo.end.x, explosion.otherInfo.end.y - 20);
  1727. // main
  1728. ctx.fillStyle = 'white';
  1729. const textWidth = ctx.measureText(damageText).width;
  1730. if (textWidth < 100) {
  1731. ctx.fillText(damageText, explosion.otherInfo.end.x, explosion.otherInfo.end.y - 20);
  1732. } else {
  1733. ctx.fillText(damageText, explosion.otherInfo.end.x, explosion.otherInfo.end.y - 20, textWidth + 10);
  1734. }
  1735. }
  1736. ctx.restore();
  1737. }
  1738. }
  1739.  
  1740. // 动画循环
  1741. function animate() {
  1742. // 完全清空画布
  1743. ctx.clearRect(0, 0, canvas.width, canvas.height);
  1744.  
  1745. // 如果需要残影效果,可以绘制半透明矩形
  1746. ctx.fillStyle = 'rgba(0, 0, 0, 0.1)';
  1747. ctx.fillRect(0, 0, canvas.width, canvas.height);
  1748.  
  1749. // 更新并绘制所有弹丸
  1750. for (let i = projectiles.length - 1; i >= 0; i--) {
  1751. const proj = projectiles[i];
  1752. proj.update();
  1753. proj.draw(ctx);
  1754. if (proj.isArrived()) {
  1755. createExplosion(proj.x, proj.y, proj.color, proj.size, proj.otherInfo); // 将弹丸大小传递给爆炸效果
  1756. projectiles.splice(i, 1);
  1757. } else if (proj.isOutOfBounds()) {
  1758. // 超出边界则移除弹丸,不产生爆炸效果
  1759. projectiles.splice(i, 1);
  1760. }
  1761. }
  1762.  
  1763. // 更新和渲染所有爆炸效果
  1764. updateExplosions();
  1765. requestAnimationFrame(animate);
  1766. }
  1767. class Projectile {
  1768. constructor(startX, startY, endX, endY, color, initialSpeed = 1, size = 10, otherInfo = {}) {
  1769. // 基础属性
  1770. this.x = startX;
  1771. this.y = startY;
  1772. this.start = {
  1773. x: startX,
  1774. y: startY
  1775. };
  1776. this.target = {
  1777. x: endX,
  1778. y: endY
  1779. };
  1780. this.otherInfo = otherInfo;
  1781.  
  1782. // 运动参数 - 向斜上方抛物线轨迹
  1783. this.gravity = 0.2; // 重力加速度
  1784. this.initialSpeed = initialSpeed; // 初始速度参数
  1785.  
  1786. // 计算水平距离和高度差
  1787. const dx = endX - startX;
  1788. const dy = endY - startY;
  1789.  
  1790. // 重新设计飞行时间计算,确保合理
  1791. // const timeInAir = distance / this.initialSpeed / 10;
  1792. const timeInAir = 80 / this.initialSpeed;
  1793.  
  1794. // 计算初始速度,修正公式确保能够到达目标
  1795. this.velocity = {
  1796. x: dx / timeInAir,
  1797. y: dy / timeInAir - this.gravity * timeInAir / 2
  1798. };
  1799.  
  1800. // 大小参数 (范围1-100)
  1801. this.sizeScale = Math.max(1, Math.min(100, size)) / 10; // 转换为比例因子
  1802.  
  1803. // 外观属性
  1804. this.size = 10 * this.sizeScale;
  1805. this.color = color;
  1806.  
  1807. // 拖尾效果
  1808. this.trail = [];
  1809. this.maxTrailLength = Math.floor(50 * Math.sqrt(this.sizeScale)); // 拖尾长度随大小增加
  1810. }
  1811. update() {
  1812. // 更新速度 (考虑重力)
  1813. this.velocity.y += this.gravity;
  1814.  
  1815. // 更新位置
  1816. this.x += this.velocity.x;
  1817. this.y += this.velocity.y;
  1818.  
  1819. // 更新拖尾
  1820. this.trail.push({
  1821. x: this.x,
  1822. y: this.y
  1823. });
  1824. if (this.trail.length > this.maxTrailLength) {
  1825. this.trail.shift();
  1826. }
  1827. }
  1828. draw(canvas) {
  1829. // 绘制拖尾
  1830. this.trail.forEach((pos, index) => {
  1831. const alpha = index / this.trail.length;
  1832. canvas.beginPath();
  1833. canvas.arc(pos.x, pos.y, this.size * alpha, 0, Math.PI * 2);
  1834. canvas.fillStyle = `${this.color}`;
  1835. canvas.fill();
  1836. });
  1837.  
  1838. // 绘制主体
  1839. canvas.beginPath();
  1840. canvas.arc(this.x, this.y, this.size, 0, Math.PI * 2);
  1841. canvas.fillStyle = this.color;
  1842. canvas.fill();
  1843.  
  1844. // 添加光晕效果
  1845. const gradient = canvas.createRadialGradient(this.x, this.y, 0, this.x, this.y, this.size * 2);
  1846. gradient.addColorStop(0, `${this.color}`);
  1847. gradient.addColorStop(1, `${this.color}`);
  1848. canvas.fillStyle = gradient;
  1849. }
  1850. isArrived() {
  1851. // 判断是否到达目标点 (调整判定距离)
  1852. const arrivalDistance = 20;
  1853. return Math.hypot(this.x - this.target.x, this.y - this.target.y) < arrivalDistance;
  1854. }
  1855. isOutOfBounds() {
  1856. return this.x < 0 || this.x > canvas.width || this.y < 0 || this.y > canvas.height;
  1857. }
  1858. }
  1859.  
  1860. // 项目管理
  1861. let projectiles = [];
  1862.  
  1863. // 存储所有活跃的爆炸效果
  1864. let activeExplosions = [];
  1865.  
  1866. // 爆炸效果函数
  1867. function createExplosion(x, y, color, size = 10, otherInfo = {}) {
  1868. // 计算爆炸大小比例
  1869. const sizeScale = Math.max(1, Math.min(100, size)) / 20;
  1870.  
  1871. // 多种粒子系统
  1872. const particles = [];
  1873. const shockwaves = [];
  1874. const embers = [];
  1875. const smokeParticles = [];
  1876.  
  1877. // 主爆炸粒子 - 数量和大小基于sizeScale
  1878. const particleCount = Math.floor(4 * sizeScale);
  1879. for (let i = 0; i < particleCount; i++) {
  1880. particles.push({
  1881. x,
  1882. y,
  1883. angle: Math.random() * Math.PI * 2,
  1884. speed: (Math.random() * 7 + 3) * Math.sqrt(sizeScale),
  1885. size: (Math.random() * 12 + 8) * sizeScale,
  1886. life: 500 * sizeScale,
  1887. // 生命时间随大小增加
  1888. // color: `hsl(${Math.floor(Math.random()*60 + 10)}, 100%, 60%)`,
  1889. color: color,
  1890. gravity: 0.3 + Math.random() * 0.1
  1891. });
  1892. }
  1893.  
  1894. // 冲击波效果 - 大小基于sizeScale
  1895. for (let i = 0; i < Math.ceil(sizeScale); i++) {
  1896. shockwaves.push({
  1897. x,
  1898. y,
  1899. radius: 7 * sizeScale,
  1900. maxRadius: (100 + Math.random() * 100) * sizeScale,
  1901. life: 800 * Math.sqrt(sizeScale),
  1902. // color: `hsla(${Math.floor(Math.random()*30 + 15)}, 100%, 50%, 0.8)`,
  1903. color: color
  1904. });
  1905. }
  1906.  
  1907. // 余烬效果 - 数量和大小基于sizeScale
  1908. const emberCount = Math.floor(20 * sizeScale);
  1909. for (let i = 0; i < emberCount; i++) {
  1910. embers.push({
  1911. x,
  1912. y,
  1913. angle: Math.random() * Math.PI * 2,
  1914. speed: (Math.random() * 2 + 0.5) * Math.sqrt(sizeScale),
  1915. size: (Math.random() * 6 + 2) * sizeScale,
  1916. life: 1200 * Math.sqrt(sizeScale),
  1917. // color: `hsl(${Math.floor(Math.random()*30 + 10)}, 100%, ${Math.floor(Math.random()*50 + 40)}%)`,
  1918. color: color,
  1919. gravity: 0.3
  1920. });
  1921. }
  1922.  
  1923. // 烟雾效果 - 数量和大小基于sizeScale
  1924. const smokeCount = Math.floor(4 * sizeScale);
  1925. for (let i = 0; i < smokeCount; i++) {
  1926. smokeParticles.push({
  1927. x,
  1928. y,
  1929. angle: Math.random() * Math.PI * 2,
  1930. speed: (Math.random() * 1 + 0.2) * Math.sqrt(sizeScale),
  1931. size: (Math.random() * 15 + 8) * sizeScale,
  1932. life: 2000 * Math.sqrt(sizeScale),
  1933. alpha: 0.7,
  1934. gravity: -1 * Math.sqrt(sizeScale) // 烟雾上升速度基于大小
  1935. });
  1936. }
  1937.  
  1938. // 闪光效果
  1939. function drawFlash() {
  1940. const flashRadius = 150 * sizeScale;
  1941. const gradient = ctx.createRadialGradient(x, y, 0, x, y, flashRadius);
  1942. gradient.addColorStop(0, 'rgba(255, 255, 200, 0.8)');
  1943. gradient.addColorStop(0.1, 'rgba(255, 230, 150, 0.6)');
  1944. gradient.addColorStop(0.4, 'rgba(255, 100, 50, 0.2)');
  1945. gradient.addColorStop(1, 'rgba(255, 50, 0, 0)');
  1946. ctx.fillStyle = gradient;
  1947. ctx.fillRect(x - flashRadius, y - flashRadius, flashRadius * 2, flashRadius * 2);
  1948. }
  1949.  
  1950. // 存储爆炸的活跃状态,用于跟踪
  1951. const explosionData = {
  1952. particles: [...particles],
  1953. shockwaves: [...shockwaves],
  1954. embers: [...embers],
  1955. smokeParticles: [...smokeParticles],
  1956. active: true,
  1957. count: 0,
  1958. maxCount: 120,
  1959. otherInfo: otherInfo
  1960. };
  1961.  
  1962. // 将这个爆炸添加到全局爆炸列表中
  1963. activeExplosions.push(explosionData);
  1964.  
  1965. // 初始闪光
  1966. drawFlash();
  1967. }
  1968. function createProjectile(startElement, endElement, color, initialSpeed = 1, damage = 200) {
  1969. const combatUnitContainer = endElement.querySelector(".CombatUnit_splatsContainer__2xcc0");
  1970. combatUnitContainer.style.visibility = "hidden";
  1971. const padding = 30;
  1972. const randomRange = {
  1973. x: Math.floor(Math.random() * (combatUnitContainer.offsetWidth - 2 * padding) - combatUnitContainer.offsetWidth / 2 + padding),
  1974. y: Math.floor(Math.random() * (combatUnitContainer.offsetHeight - 2 * padding) - combatUnitContainer.offsetHeight / 2 + padding)
  1975. };
  1976. const projectileLimit = 30;
  1977. const start = getElementCenter(startElement);
  1978. const end = getElementCenter(endElement);
  1979. end.x = Math.floor(end.x + randomRange.x);
  1980. end.y = Math.floor(end.y + randomRange.y);
  1981. const size = Math.min(Math.max(Math.pow(damage + 200, 0.8) / 20, 4), 17);
  1982. const otherInfo = {
  1983. start: start,
  1984. end: end,
  1985. damage: damage,
  1986. color: color
  1987. };
  1988. const projectile = new Projectile(start.x, start.y, end.x, end.y, color, initialSpeed, size, otherInfo);
  1989. projectiles.push(projectile);
  1990. if (projectiles.length > projectileLimit) {
  1991. projectiles.shift();
  1992. }
  1993. }
  1994. function getElementCenter(element) {
  1995. const rect = element.getBoundingClientRect();
  1996. if (element.innerText.trim() === '') {
  1997. return {
  1998. x: rect.left + rect.width / 2,
  1999. y: rect.top
  2000. };
  2001. }
  2002. return {
  2003. x: rect.left + rect.width / 2,
  2004. y: rect.top + rect.height / 2
  2005. };
  2006. }
  2007.  
  2008. // #region Setting
  2009. /* 脚本设置面板 */
  2010. waitForSetttins();
  2011. let monstersHP = [];
  2012. let monstersMP = [];
  2013. let playersHP = [];
  2014. let playersMP = [];
  2015. hookWS();
  2016.  
  2017. // #region Hook WS
  2018. function hookWS() {
  2019. const dataProperty = Object.getOwnPropertyDescriptor(MessageEvent.prototype, "data");
  2020. const oriGet = dataProperty.get;
  2021. dataProperty.get = hookedGet;
  2022. Object.defineProperty(MessageEvent.prototype, "data", dataProperty);
  2023. function hookedGet() {
  2024. const socket = this.currentTarget;
  2025. if (!(socket instanceof WebSocket)) {
  2026. return oriGet.call(this);
  2027. }
  2028. if (socket.url.indexOf("api.milkywayidle.com/ws") <= -1 && socket.url.indexOf("api-test.milkywayidle.com/ws") <= -1) {
  2029. return oriGet.call(this);
  2030. }
  2031. const message = oriGet.call(this);
  2032. Object.defineProperty(this, "data", {
  2033. value: message
  2034. }); // Anti-loop
  2035.  
  2036. return handleMessage(message);
  2037. }
  2038. }
  2039. function handleMessage(message) {
  2040. let obj = JSON.parse(message);
  2041. if (obj && obj.type === "new_battle") {
  2042. monstersHP = obj.monsters.map(monster => monster.currentHitpoints);
  2043. monstersMP = obj.monsters.map(monster => monster.currentManapoints);
  2044. playersHP = obj.players.map(player => player.currentHitpoints);
  2045. playersMP = obj.players.map(player => player.currentManapoints);
  2046. } else if (obj && obj.type === "battle_updated" && monstersHP.length) {
  2047. const mMap = obj.mMap;
  2048. const pMap = obj.pMap;
  2049. const monsterIndices = Object.keys(obj.mMap);
  2050. const playerIndices = Object.keys(obj.pMap);
  2051. let castMonster = -1;
  2052. monsterIndices.forEach(monsterIndex => {
  2053. if (mMap[monsterIndex].cMP < monstersMP[monsterIndex]) {
  2054. castMonster = monsterIndex;
  2055. }
  2056. monstersMP[monsterIndex] = mMap[monsterIndex].cMP;
  2057. });
  2058. let castPlayer = -1;
  2059. playerIndices.forEach(userIndex => {
  2060. if (pMap[userIndex].cMP < playersMP[userIndex]) {
  2061. castPlayer = userIndex;
  2062. }
  2063. playersMP[userIndex] = pMap[userIndex].cMP;
  2064. });
  2065. monstersHP.forEach((mHP, mIndex) => {
  2066. const monster = mMap[mIndex];
  2067. if (monster) {
  2068. const hpDiff = mHP - monster.cHP;
  2069. monstersHP[mIndex] = monster.cHP;
  2070. if (hpDiff > 0 && playerIndices.length > 0) {
  2071. if (playerIndices.length > 1) {
  2072. playerIndices.forEach(userIndex => {
  2073. if (userIndex === castPlayer) {
  2074. createLine(userIndex, mIndex, hpDiff);
  2075. }
  2076. });
  2077. } else {
  2078. createLine(playerIndices[0], mIndex, hpDiff);
  2079. }
  2080. }
  2081. }
  2082. });
  2083. playersHP.forEach((pHP, pIndex) => {
  2084. const player = pMap[pIndex];
  2085. if (player) {
  2086. const hpDiff = pHP - player.cHP;
  2087. playersHP[pIndex] = player.cHP;
  2088. if (hpDiff > 0 && monsterIndices.length > 0) {
  2089. if (monsterIndices.length > 1) {
  2090. monsterIndices.forEach(monsterIndex => {
  2091. if (monsterIndex === castMonster) {
  2092. createLine(pIndex, monsterIndex, hpDiff, true);
  2093. }
  2094. });
  2095. } else {
  2096. createLine(pIndex, monsterIndices[0], hpDiff, true);
  2097. }
  2098. }
  2099. }
  2100. });
  2101. }
  2102. return message;
  2103. }
  2104.  
  2105. // #region Main Logic
  2106.  
  2107. // 动画效果
  2108. function createLine(from, to, hpDiff, reversed = false) {
  2109. if (reversed) {
  2110. if (!settingsMap.tracker6.isTrue) {
  2111. return null;
  2112. }
  2113. } else {
  2114. if (!settingsMap["tracker" + from].isTrue) {
  2115. return null;
  2116. }
  2117. }
  2118. const container = document.querySelector(".BattlePanel_playersArea__vvwlB");
  2119. if (container && container.children.length > 0) {
  2120. const playersContainer = container.children[0];
  2121. const effectFrom = playersContainer.children[from];
  2122. const monsterContainer = document.querySelector(".BattlePanel_monstersArea__2dzrY").children[0];
  2123. const effectTo = monsterContainer.children[to];
  2124. const trackerSetting = reversed ? settingsMap[`tracker6`] : settingsMap["tracker" + from];
  2125. const lineColor = "rgba(" + trackerSetting.r + ", " + trackerSetting.g + ", " + trackerSetting.b + ", 1)";
  2126. createProjectile(effectFrom, effectTo, lineColor, 1, hpDiff);
  2127. }
  2128. }
  2129.  
  2130. // 启动动画
  2131. animate();
  2132.  
  2133. })();