Juejin Activities Enhancer

Enhances Juejin activities

  1. // ==UserScript==
  2. // @name Juejin Activities Enhancer
  3. // @name:zh-CN 掘金活动辅助工具
  4. // @namespace https://gitee.com/curlly-brackets/UserScripts
  5. // @version 0.1.6.7
  6. // @description Enhances Juejin activities
  7. // @author curly brackets
  8. // @match https://juejin.cn/*
  9. // @license MIT License
  10. // @grant GM_xmlhttpRequest
  11. // @grant GM_setValue
  12. // @grant GM_getValue
  13. // @run-at document-end
  14. // @supportURL https://gitee.com/curlly-brackets/UserScripts/issues
  15. // @connect juejin.cn
  16. // ==/UserScript==
  17.  
  18. (function () {
  19. 'use strict';
  20.  
  21. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  22.  
  23. var check = function (it) {
  24. return it && it.Math == Math && it;
  25. };
  26.  
  27. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  28. var global$e =
  29. // eslint-disable-next-line es/no-global-this -- safe
  30. check(typeof globalThis == 'object' && globalThis) ||
  31. check(typeof window == 'object' && window) ||
  32. // eslint-disable-next-line no-restricted-globals -- safe
  33. check(typeof self == 'object' && self) ||
  34. check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
  35. // eslint-disable-next-line no-new-func -- fallback
  36. (function () { return this; })() || Function('return this')();
  37.  
  38. var objectGetOwnPropertyDescriptor = {};
  39.  
  40. var fails$a = function (exec) {
  41. try {
  42. return !!exec();
  43. } catch (error) {
  44. return true;
  45. }
  46. };
  47.  
  48. var fails$9 = fails$a;
  49.  
  50. // Detect IE8's incomplete defineProperty implementation
  51. var descriptors = !fails$9(function () {
  52. // eslint-disable-next-line es/no-object-defineproperty -- required for testing
  53. return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
  54. });
  55.  
  56. var objectPropertyIsEnumerable = {};
  57.  
  58. var $propertyIsEnumerable = {}.propertyIsEnumerable;
  59. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  60. var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
  61.  
  62. // Nashorn ~ JDK8 bug
  63. var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
  64.  
  65. // `Object.prototype.propertyIsEnumerable` method implementation
  66. // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
  67. objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  68. var descriptor = getOwnPropertyDescriptor$1(this, V);
  69. return !!descriptor && descriptor.enumerable;
  70. } : $propertyIsEnumerable;
  71.  
  72. var createPropertyDescriptor$2 = function (bitmap, value) {
  73. return {
  74. enumerable: !(bitmap & 1),
  75. configurable: !(bitmap & 2),
  76. writable: !(bitmap & 4),
  77. value: value
  78. };
  79. };
  80.  
  81. var toString$4 = {}.toString;
  82.  
  83. var classofRaw = function (it) {
  84. return toString$4.call(it).slice(8, -1);
  85. };
  86.  
  87. var fails$8 = fails$a;
  88. var classof$1 = classofRaw;
  89.  
  90. var split = ''.split;
  91.  
  92. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  93. var indexedObject = fails$8(function () {
  94. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  95. // eslint-disable-next-line no-prototype-builtins -- safe
  96. return !Object('z').propertyIsEnumerable(0);
  97. }) ? function (it) {
  98. return classof$1(it) == 'String' ? split.call(it, '') : Object(it);
  99. } : Object;
  100.  
  101. // `RequireObjectCoercible` abstract operation
  102. // https://tc39.es/ecma262/#sec-requireobjectcoercible
  103. var requireObjectCoercible$4 = function (it) {
  104. if (it == undefined) throw TypeError("Can't call method on " + it);
  105. return it;
  106. };
  107.  
  108. // toObject with fallback for non-array-like ES3 strings
  109. var IndexedObject = indexedObject;
  110. var requireObjectCoercible$3 = requireObjectCoercible$4;
  111.  
  112. var toIndexedObject$3 = function (it) {
  113. return IndexedObject(requireObjectCoercible$3(it));
  114. };
  115.  
  116. var isObject$5 = function (it) {
  117. return typeof it === 'object' ? it !== null : typeof it === 'function';
  118. };
  119.  
  120. var global$d = global$e;
  121.  
  122. var aFunction = function (variable) {
  123. return typeof variable == 'function' ? variable : undefined;
  124. };
  125.  
  126. var getBuiltIn$4 = function (namespace, method) {
  127. return arguments.length < 2 ? aFunction(global$d[namespace]) : global$d[namespace] && global$d[namespace][method];
  128. };
  129.  
  130. var getBuiltIn$3 = getBuiltIn$4;
  131.  
  132. var engineUserAgent = getBuiltIn$3('navigator', 'userAgent') || '';
  133.  
  134. var global$c = global$e;
  135. var userAgent = engineUserAgent;
  136.  
  137. var process = global$c.process;
  138. var Deno = global$c.Deno;
  139. var versions = process && process.versions || Deno && Deno.version;
  140. var v8 = versions && versions.v8;
  141. var match, version;
  142.  
  143. if (v8) {
  144. match = v8.split('.');
  145. version = match[0] < 4 ? 1 : match[0] + match[1];
  146. } else if (userAgent) {
  147. match = userAgent.match(/Edge\/(\d+)/);
  148. if (!match || match[1] >= 74) {
  149. match = userAgent.match(/Chrome\/(\d+)/);
  150. if (match) version = match[1];
  151. }
  152. }
  153.  
  154. var engineV8Version = version && +version;
  155.  
  156. /* eslint-disable es/no-symbol -- required for testing */
  157.  
  158. var V8_VERSION = engineV8Version;
  159. var fails$7 = fails$a;
  160.  
  161. // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
  162. var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$7(function () {
  163. var symbol = Symbol();
  164. // Chrome 38 Symbol has incorrect toString conversion
  165. // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
  166. return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
  167. // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
  168. !Symbol.sham && V8_VERSION && V8_VERSION < 41;
  169. });
  170.  
  171. /* eslint-disable es/no-symbol -- required for testing */
  172.  
  173. var NATIVE_SYMBOL$1 = nativeSymbol;
  174.  
  175. var useSymbolAsUid = NATIVE_SYMBOL$1
  176. && !Symbol.sham
  177. && typeof Symbol.iterator == 'symbol';
  178.  
  179. var getBuiltIn$2 = getBuiltIn$4;
  180. var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
  181.  
  182. var isSymbol$3 = USE_SYMBOL_AS_UID$1 ? function (it) {
  183. return typeof it == 'symbol';
  184. } : function (it) {
  185. var $Symbol = getBuiltIn$2('Symbol');
  186. return typeof $Symbol == 'function' && Object(it) instanceof $Symbol;
  187. };
  188.  
  189. var isObject$4 = isObject$5;
  190.  
  191. // `OrdinaryToPrimitive` abstract operation
  192. // https://tc39.es/ecma262/#sec-ordinarytoprimitive
  193. var ordinaryToPrimitive$1 = function (input, pref) {
  194. var fn, val;
  195. if (pref === 'string' && typeof (fn = input.toString) == 'function' && !isObject$4(val = fn.call(input))) return val;
  196. if (typeof (fn = input.valueOf) == 'function' && !isObject$4(val = fn.call(input))) return val;
  197. if (pref !== 'string' && typeof (fn = input.toString) == 'function' && !isObject$4(val = fn.call(input))) return val;
  198. throw TypeError("Can't convert object to primitive value");
  199. };
  200.  
  201. var shared$4 = {exports: {}};
  202.  
  203. var global$b = global$e;
  204.  
  205. var setGlobal$3 = function (key, value) {
  206. try {
  207. // eslint-disable-next-line es/no-object-defineproperty -- safe
  208. Object.defineProperty(global$b, key, { value: value, configurable: true, writable: true });
  209. } catch (error) {
  210. global$b[key] = value;
  211. } return value;
  212. };
  213.  
  214. var global$a = global$e;
  215. var setGlobal$2 = setGlobal$3;
  216.  
  217. var SHARED = '__core-js_shared__';
  218. var store$3 = global$a[SHARED] || setGlobal$2(SHARED, {});
  219.  
  220. var sharedStore = store$3;
  221.  
  222. var store$2 = sharedStore;
  223.  
  224. (shared$4.exports = function (key, value) {
  225. return store$2[key] || (store$2[key] = value !== undefined ? value : {});
  226. })('versions', []).push({
  227. version: '3.17.3',
  228. mode: 'global',
  229. copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
  230. });
  231.  
  232. var requireObjectCoercible$2 = requireObjectCoercible$4;
  233.  
  234. // `ToObject` abstract operation
  235. // https://tc39.es/ecma262/#sec-toobject
  236. var toObject$2 = function (argument) {
  237. return Object(requireObjectCoercible$2(argument));
  238. };
  239.  
  240. var toObject$1 = toObject$2;
  241.  
  242. var hasOwnProperty = {}.hasOwnProperty;
  243.  
  244. var has$6 = Object.hasOwn || function hasOwn(it, key) {
  245. return hasOwnProperty.call(toObject$1(it), key);
  246. };
  247.  
  248. var id = 0;
  249. var postfix = Math.random();
  250.  
  251. var uid$2 = function (key) {
  252. return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
  253. };
  254.  
  255. var global$9 = global$e;
  256. var shared$3 = shared$4.exports;
  257. var has$5 = has$6;
  258. var uid$1 = uid$2;
  259. var NATIVE_SYMBOL = nativeSymbol;
  260. var USE_SYMBOL_AS_UID = useSymbolAsUid;
  261.  
  262. var WellKnownSymbolsStore = shared$3('wks');
  263. var Symbol$1 = global$9.Symbol;
  264. var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
  265.  
  266. var wellKnownSymbol$3 = function (name) {
  267. if (!has$5(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
  268. if (NATIVE_SYMBOL && has$5(Symbol$1, name)) {
  269. WellKnownSymbolsStore[name] = Symbol$1[name];
  270. } else {
  271. WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
  272. }
  273. } return WellKnownSymbolsStore[name];
  274. };
  275.  
  276. var isObject$3 = isObject$5;
  277. var isSymbol$2 = isSymbol$3;
  278. var ordinaryToPrimitive = ordinaryToPrimitive$1;
  279. var wellKnownSymbol$2 = wellKnownSymbol$3;
  280.  
  281. var TO_PRIMITIVE = wellKnownSymbol$2('toPrimitive');
  282.  
  283. // `ToPrimitive` abstract operation
  284. // https://tc39.es/ecma262/#sec-toprimitive
  285. var toPrimitive$1 = function (input, pref) {
  286. if (!isObject$3(input) || isSymbol$2(input)) return input;
  287. var exoticToPrim = input[TO_PRIMITIVE];
  288. var result;
  289. if (exoticToPrim !== undefined) {
  290. if (pref === undefined) pref = 'default';
  291. result = exoticToPrim.call(input, pref);
  292. if (!isObject$3(result) || isSymbol$2(result)) return result;
  293. throw TypeError("Can't convert object to primitive value");
  294. }
  295. if (pref === undefined) pref = 'number';
  296. return ordinaryToPrimitive(input, pref);
  297. };
  298.  
  299. var toPrimitive = toPrimitive$1;
  300. var isSymbol$1 = isSymbol$3;
  301.  
  302. // `ToPropertyKey` abstract operation
  303. // https://tc39.es/ecma262/#sec-topropertykey
  304. var toPropertyKey$2 = function (argument) {
  305. var key = toPrimitive(argument, 'string');
  306. return isSymbol$1(key) ? key : String(key);
  307. };
  308.  
  309. var global$8 = global$e;
  310. var isObject$2 = isObject$5;
  311.  
  312. var document$1 = global$8.document;
  313. // typeof document.createElement is 'object' in old IE
  314. var EXISTS = isObject$2(document$1) && isObject$2(document$1.createElement);
  315.  
  316. var documentCreateElement$1 = function (it) {
  317. return EXISTS ? document$1.createElement(it) : {};
  318. };
  319.  
  320. var DESCRIPTORS$4 = descriptors;
  321. var fails$6 = fails$a;
  322. var createElement = documentCreateElement$1;
  323.  
  324. // Thank's IE8 for his funny defineProperty
  325. var ie8DomDefine = !DESCRIPTORS$4 && !fails$6(function () {
  326. // eslint-disable-next-line es/no-object-defineproperty -- requied for testing
  327. return Object.defineProperty(createElement('div'), 'a', {
  328. get: function () { return 7; }
  329. }).a != 7;
  330. });
  331.  
  332. var DESCRIPTORS$3 = descriptors;
  333. var propertyIsEnumerableModule = objectPropertyIsEnumerable;
  334. var createPropertyDescriptor$1 = createPropertyDescriptor$2;
  335. var toIndexedObject$2 = toIndexedObject$3;
  336. var toPropertyKey$1 = toPropertyKey$2;
  337. var has$4 = has$6;
  338. var IE8_DOM_DEFINE$1 = ie8DomDefine;
  339.  
  340. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  341. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  342.  
  343. // `Object.getOwnPropertyDescriptor` method
  344. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
  345. objectGetOwnPropertyDescriptor.f = DESCRIPTORS$3 ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  346. O = toIndexedObject$2(O);
  347. P = toPropertyKey$1(P);
  348. if (IE8_DOM_DEFINE$1) try {
  349. return $getOwnPropertyDescriptor(O, P);
  350. } catch (error) { /* empty */ }
  351. if (has$4(O, P)) return createPropertyDescriptor$1(!propertyIsEnumerableModule.f.call(O, P), O[P]);
  352. };
  353.  
  354. var objectDefineProperty = {};
  355.  
  356. var isObject$1 = isObject$5;
  357.  
  358. var anObject$6 = function (it) {
  359. if (!isObject$1(it)) {
  360. throw TypeError(String(it) + ' is not an object');
  361. } return it;
  362. };
  363.  
  364. var DESCRIPTORS$2 = descriptors;
  365. var IE8_DOM_DEFINE = ie8DomDefine;
  366. var anObject$5 = anObject$6;
  367. var toPropertyKey = toPropertyKey$2;
  368.  
  369. // eslint-disable-next-line es/no-object-defineproperty -- safe
  370. var $defineProperty = Object.defineProperty;
  371.  
  372. // `Object.defineProperty` method
  373. // https://tc39.es/ecma262/#sec-object.defineproperty
  374. objectDefineProperty.f = DESCRIPTORS$2 ? $defineProperty : function defineProperty(O, P, Attributes) {
  375. anObject$5(O);
  376. P = toPropertyKey(P);
  377. anObject$5(Attributes);
  378. if (IE8_DOM_DEFINE) try {
  379. return $defineProperty(O, P, Attributes);
  380. } catch (error) { /* empty */ }
  381. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
  382. if ('value' in Attributes) O[P] = Attributes.value;
  383. return O;
  384. };
  385.  
  386. var DESCRIPTORS$1 = descriptors;
  387. var definePropertyModule$2 = objectDefineProperty;
  388. var createPropertyDescriptor = createPropertyDescriptor$2;
  389.  
  390. var createNonEnumerableProperty$4 = DESCRIPTORS$1 ? function (object, key, value) {
  391. return definePropertyModule$2.f(object, key, createPropertyDescriptor(1, value));
  392. } : function (object, key, value) {
  393. object[key] = value;
  394. return object;
  395. };
  396.  
  397. var redefine$2 = {exports: {}};
  398.  
  399. var store$1 = sharedStore;
  400.  
  401. var functionToString = Function.toString;
  402.  
  403. // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
  404. if (typeof store$1.inspectSource != 'function') {
  405. store$1.inspectSource = function (it) {
  406. return functionToString.call(it);
  407. };
  408. }
  409.  
  410. var inspectSource$2 = store$1.inspectSource;
  411.  
  412. var global$7 = global$e;
  413. var inspectSource$1 = inspectSource$2;
  414.  
  415. var WeakMap$1 = global$7.WeakMap;
  416.  
  417. var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource$1(WeakMap$1));
  418.  
  419. var shared$2 = shared$4.exports;
  420. var uid = uid$2;
  421.  
  422. var keys = shared$2('keys');
  423.  
  424. var sharedKey$2 = function (key) {
  425. return keys[key] || (keys[key] = uid(key));
  426. };
  427.  
  428. var hiddenKeys$4 = {};
  429.  
  430. var NATIVE_WEAK_MAP = nativeWeakMap;
  431. var global$6 = global$e;
  432. var isObject = isObject$5;
  433. var createNonEnumerableProperty$3 = createNonEnumerableProperty$4;
  434. var objectHas = has$6;
  435. var shared$1 = sharedStore;
  436. var sharedKey$1 = sharedKey$2;
  437. var hiddenKeys$3 = hiddenKeys$4;
  438.  
  439. var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
  440. var WeakMap = global$6.WeakMap;
  441. var set, get, has$3;
  442.  
  443. var enforce = function (it) {
  444. return has$3(it) ? get(it) : set(it, {});
  445. };
  446.  
  447. var getterFor = function (TYPE) {
  448. return function (it) {
  449. var state;
  450. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  451. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  452. } return state;
  453. };
  454. };
  455.  
  456. if (NATIVE_WEAK_MAP || shared$1.state) {
  457. var store = shared$1.state || (shared$1.state = new WeakMap());
  458. var wmget = store.get;
  459. var wmhas = store.has;
  460. var wmset = store.set;
  461. set = function (it, metadata) {
  462. if (wmhas.call(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
  463. metadata.facade = it;
  464. wmset.call(store, it, metadata);
  465. return metadata;
  466. };
  467. get = function (it) {
  468. return wmget.call(store, it) || {};
  469. };
  470. has$3 = function (it) {
  471. return wmhas.call(store, it);
  472. };
  473. } else {
  474. var STATE = sharedKey$1('state');
  475. hiddenKeys$3[STATE] = true;
  476. set = function (it, metadata) {
  477. if (objectHas(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
  478. metadata.facade = it;
  479. createNonEnumerableProperty$3(it, STATE, metadata);
  480. return metadata;
  481. };
  482. get = function (it) {
  483. return objectHas(it, STATE) ? it[STATE] : {};
  484. };
  485. has$3 = function (it) {
  486. return objectHas(it, STATE);
  487. };
  488. }
  489.  
  490. var internalState = {
  491. set: set,
  492. get: get,
  493. has: has$3,
  494. enforce: enforce,
  495. getterFor: getterFor
  496. };
  497.  
  498. var global$5 = global$e;
  499. var createNonEnumerableProperty$2 = createNonEnumerableProperty$4;
  500. var has$2 = has$6;
  501. var setGlobal$1 = setGlobal$3;
  502. var inspectSource = inspectSource$2;
  503. var InternalStateModule = internalState;
  504.  
  505. var getInternalState$1 = InternalStateModule.get;
  506. var enforceInternalState = InternalStateModule.enforce;
  507. var TEMPLATE = String(String).split('String');
  508.  
  509. (redefine$2.exports = function (O, key, value, options) {
  510. var unsafe = options ? !!options.unsafe : false;
  511. var simple = options ? !!options.enumerable : false;
  512. var noTargetGet = options ? !!options.noTargetGet : false;
  513. var state;
  514. if (typeof value == 'function') {
  515. if (typeof key == 'string' && !has$2(value, 'name')) {
  516. createNonEnumerableProperty$2(value, 'name', key);
  517. }
  518. state = enforceInternalState(value);
  519. if (!state.source) {
  520. state.source = TEMPLATE.join(typeof key == 'string' ? key : '');
  521. }
  522. }
  523. if (O === global$5) {
  524. if (simple) O[key] = value;
  525. else setGlobal$1(key, value);
  526. return;
  527. } else if (!unsafe) {
  528. delete O[key];
  529. } else if (!noTargetGet && O[key]) {
  530. simple = true;
  531. }
  532. if (simple) O[key] = value;
  533. else createNonEnumerableProperty$2(O, key, value);
  534. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  535. })(Function.prototype, 'toString', function toString() {
  536. return typeof this == 'function' && getInternalState$1(this).source || inspectSource(this);
  537. });
  538.  
  539. var objectGetOwnPropertyNames = {};
  540.  
  541. var ceil = Math.ceil;
  542. var floor$1 = Math.floor;
  543.  
  544. // `ToInteger` abstract operation
  545. // https://tc39.es/ecma262/#sec-tointeger
  546. var toInteger$4 = function (argument) {
  547. return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor$1 : ceil)(argument);
  548. };
  549.  
  550. var toInteger$3 = toInteger$4;
  551.  
  552. var min$2 = Math.min;
  553.  
  554. // `ToLength` abstract operation
  555. // https://tc39.es/ecma262/#sec-tolength
  556. var toLength$2 = function (argument) {
  557. return argument > 0 ? min$2(toInteger$3(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  558. };
  559.  
  560. var toInteger$2 = toInteger$4;
  561.  
  562. var max$1 = Math.max;
  563. var min$1 = Math.min;
  564.  
  565. // Helper for a popular repeating case of the spec:
  566. // Let integer be ? ToInteger(index).
  567. // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
  568. var toAbsoluteIndex$1 = function (index, length) {
  569. var integer = toInteger$2(index);
  570. return integer < 0 ? max$1(integer + length, 0) : min$1(integer, length);
  571. };
  572.  
  573. var toIndexedObject$1 = toIndexedObject$3;
  574. var toLength$1 = toLength$2;
  575. var toAbsoluteIndex = toAbsoluteIndex$1;
  576.  
  577. // `Array.prototype.{ indexOf, includes }` methods implementation
  578. var createMethod$1 = function (IS_INCLUDES) {
  579. return function ($this, el, fromIndex) {
  580. var O = toIndexedObject$1($this);
  581. var length = toLength$1(O.length);
  582. var index = toAbsoluteIndex(fromIndex, length);
  583. var value;
  584. // Array#includes uses SameValueZero equality algorithm
  585. // eslint-disable-next-line no-self-compare -- NaN check
  586. if (IS_INCLUDES && el != el) while (length > index) {
  587. value = O[index++];
  588. // eslint-disable-next-line no-self-compare -- NaN check
  589. if (value != value) return true;
  590. // Array#indexOf ignores holes, Array#includes - not
  591. } else for (;length > index; index++) {
  592. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  593. } return !IS_INCLUDES && -1;
  594. };
  595. };
  596.  
  597. var arrayIncludes = {
  598. // `Array.prototype.includes` method
  599. // https://tc39.es/ecma262/#sec-array.prototype.includes
  600. includes: createMethod$1(true),
  601. // `Array.prototype.indexOf` method
  602. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  603. indexOf: createMethod$1(false)
  604. };
  605.  
  606. var has$1 = has$6;
  607. var toIndexedObject = toIndexedObject$3;
  608. var indexOf = arrayIncludes.indexOf;
  609. var hiddenKeys$2 = hiddenKeys$4;
  610.  
  611. var objectKeysInternal = function (object, names) {
  612. var O = toIndexedObject(object);
  613. var i = 0;
  614. var result = [];
  615. var key;
  616. for (key in O) !has$1(hiddenKeys$2, key) && has$1(O, key) && result.push(key);
  617. // Don't enum bug & hidden keys
  618. while (names.length > i) if (has$1(O, key = names[i++])) {
  619. ~indexOf(result, key) || result.push(key);
  620. }
  621. return result;
  622. };
  623.  
  624. // IE8- don't enum bug keys
  625. var enumBugKeys$3 = [
  626. 'constructor',
  627. 'hasOwnProperty',
  628. 'isPrototypeOf',
  629. 'propertyIsEnumerable',
  630. 'toLocaleString',
  631. 'toString',
  632. 'valueOf'
  633. ];
  634.  
  635. var internalObjectKeys$1 = objectKeysInternal;
  636. var enumBugKeys$2 = enumBugKeys$3;
  637.  
  638. var hiddenKeys$1 = enumBugKeys$2.concat('length', 'prototype');
  639.  
  640. // `Object.getOwnPropertyNames` method
  641. // https://tc39.es/ecma262/#sec-object.getownpropertynames
  642. // eslint-disable-next-line es/no-object-getownpropertynames -- safe
  643. objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  644. return internalObjectKeys$1(O, hiddenKeys$1);
  645. };
  646.  
  647. var objectGetOwnPropertySymbols = {};
  648.  
  649. // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
  650. objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
  651.  
  652. var getBuiltIn$1 = getBuiltIn$4;
  653. var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
  654. var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
  655. var anObject$4 = anObject$6;
  656.  
  657. // all object keys, includes non-enumerable and symbols
  658. var ownKeys$1 = getBuiltIn$1('Reflect', 'ownKeys') || function ownKeys(it) {
  659. var keys = getOwnPropertyNamesModule.f(anObject$4(it));
  660. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  661. return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
  662. };
  663.  
  664. var has = has$6;
  665. var ownKeys = ownKeys$1;
  666. var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
  667. var definePropertyModule$1 = objectDefineProperty;
  668.  
  669. var copyConstructorProperties$1 = function (target, source) {
  670. var keys = ownKeys(source);
  671. var defineProperty = definePropertyModule$1.f;
  672. var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  673. for (var i = 0; i < keys.length; i++) {
  674. var key = keys[i];
  675. if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  676. }
  677. };
  678.  
  679. var fails$5 = fails$a;
  680.  
  681. var replacement = /#|\.prototype\./;
  682.  
  683. var isForced$1 = function (feature, detection) {
  684. var value = data[normalize(feature)];
  685. return value == POLYFILL ? true
  686. : value == NATIVE ? false
  687. : typeof detection == 'function' ? fails$5(detection)
  688. : !!detection;
  689. };
  690.  
  691. var normalize = isForced$1.normalize = function (string) {
  692. return String(string).replace(replacement, '.').toLowerCase();
  693. };
  694.  
  695. var data = isForced$1.data = {};
  696. var NATIVE = isForced$1.NATIVE = 'N';
  697. var POLYFILL = isForced$1.POLYFILL = 'P';
  698.  
  699. var isForced_1 = isForced$1;
  700.  
  701. var global$4 = global$e;
  702. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  703. var createNonEnumerableProperty$1 = createNonEnumerableProperty$4;
  704. var redefine$1 = redefine$2.exports;
  705. var setGlobal = setGlobal$3;
  706. var copyConstructorProperties = copyConstructorProperties$1;
  707. var isForced = isForced_1;
  708.  
  709. /*
  710. options.target - name of the target object
  711. options.global - target is the global object
  712. options.stat - export as static methods of target
  713. options.proto - export as prototype methods of target
  714. options.real - real prototype method for the `pure` version
  715. options.forced - export even if the native feature is available
  716. options.bind - bind methods to the target, required for the `pure` version
  717. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  718. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  719. options.sham - add a flag to not completely full polyfills
  720. options.enumerable - export as enumerable property
  721. options.noTargetGet - prevent calling a getter on target
  722. */
  723. var _export = function (options, source) {
  724. var TARGET = options.target;
  725. var GLOBAL = options.global;
  726. var STATIC = options.stat;
  727. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  728. if (GLOBAL) {
  729. target = global$4;
  730. } else if (STATIC) {
  731. target = global$4[TARGET] || setGlobal(TARGET, {});
  732. } else {
  733. target = (global$4[TARGET] || {}).prototype;
  734. }
  735. if (target) for (key in source) {
  736. sourceProperty = source[key];
  737. if (options.noTargetGet) {
  738. descriptor = getOwnPropertyDescriptor(target, key);
  739. targetProperty = descriptor && descriptor.value;
  740. } else targetProperty = target[key];
  741. FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  742. // contained in target
  743. if (!FORCED && targetProperty !== undefined) {
  744. if (typeof sourceProperty === typeof targetProperty) continue;
  745. copyConstructorProperties(sourceProperty, targetProperty);
  746. }
  747. // add a flag to not completely full polyfills
  748. if (options.sham || (targetProperty && targetProperty.sham)) {
  749. createNonEnumerableProperty$1(sourceProperty, 'sham', true);
  750. }
  751. // extend global
  752. redefine$1(target, key, sourceProperty, options);
  753. }
  754. };
  755.  
  756. var isSymbol = isSymbol$3;
  757.  
  758. var toString$3 = function (argument) {
  759. if (isSymbol(argument)) throw TypeError('Cannot convert a Symbol value to a string');
  760. return String(argument);
  761. };
  762.  
  763. var anObject$3 = anObject$6;
  764.  
  765. // `RegExp.prototype.flags` getter implementation
  766. // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
  767. var regexpFlags$1 = function () {
  768. var that = anObject$3(this);
  769. var result = '';
  770. if (that.global) result += 'g';
  771. if (that.ignoreCase) result += 'i';
  772. if (that.multiline) result += 'm';
  773. if (that.dotAll) result += 's';
  774. if (that.unicode) result += 'u';
  775. if (that.sticky) result += 'y';
  776. return result;
  777. };
  778.  
  779. var regexpStickyHelpers = {};
  780.  
  781. var fails$4 = fails$a;
  782. var global$3 = global$e;
  783.  
  784. // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
  785. var $RegExp$2 = global$3.RegExp;
  786.  
  787. regexpStickyHelpers.UNSUPPORTED_Y = fails$4(function () {
  788. var re = $RegExp$2('a', 'y');
  789. re.lastIndex = 2;
  790. return re.exec('abcd') != null;
  791. });
  792.  
  793. regexpStickyHelpers.BROKEN_CARET = fails$4(function () {
  794. // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
  795. var re = $RegExp$2('^r', 'gy');
  796. re.lastIndex = 2;
  797. return re.exec('str') != null;
  798. });
  799.  
  800. var internalObjectKeys = objectKeysInternal;
  801. var enumBugKeys$1 = enumBugKeys$3;
  802.  
  803. // `Object.keys` method
  804. // https://tc39.es/ecma262/#sec-object.keys
  805. // eslint-disable-next-line es/no-object-keys -- safe
  806. var objectKeys$1 = Object.keys || function keys(O) {
  807. return internalObjectKeys(O, enumBugKeys$1);
  808. };
  809.  
  810. var DESCRIPTORS = descriptors;
  811. var definePropertyModule = objectDefineProperty;
  812. var anObject$2 = anObject$6;
  813. var objectKeys = objectKeys$1;
  814.  
  815. // `Object.defineProperties` method
  816. // https://tc39.es/ecma262/#sec-object.defineproperties
  817. // eslint-disable-next-line es/no-object-defineproperties -- safe
  818. var objectDefineProperties = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
  819. anObject$2(O);
  820. var keys = objectKeys(Properties);
  821. var length = keys.length;
  822. var index = 0;
  823. var key;
  824. while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]);
  825. return O;
  826. };
  827.  
  828. var getBuiltIn = getBuiltIn$4;
  829.  
  830. var html$1 = getBuiltIn('document', 'documentElement');
  831.  
  832. /* global ActiveXObject -- old IE, WSH */
  833.  
  834. var anObject$1 = anObject$6;
  835. var defineProperties = objectDefineProperties;
  836. var enumBugKeys = enumBugKeys$3;
  837. var hiddenKeys = hiddenKeys$4;
  838. var html = html$1;
  839. var documentCreateElement = documentCreateElement$1;
  840. var sharedKey = sharedKey$2;
  841.  
  842. var GT = '>';
  843. var LT = '<';
  844. var PROTOTYPE = 'prototype';
  845. var SCRIPT = 'script';
  846. var IE_PROTO = sharedKey('IE_PROTO');
  847.  
  848. var EmptyConstructor = function () { /* empty */ };
  849.  
  850. var scriptTag = function (content) {
  851. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  852. };
  853.  
  854. // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
  855. var NullProtoObjectViaActiveX = function (activeXDocument) {
  856. activeXDocument.write(scriptTag(''));
  857. activeXDocument.close();
  858. var temp = activeXDocument.parentWindow.Object;
  859. activeXDocument = null; // avoid memory leak
  860. return temp;
  861. };
  862.  
  863. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  864. var NullProtoObjectViaIFrame = function () {
  865. // Thrash, waste and sodomy: IE GC bug
  866. var iframe = documentCreateElement('iframe');
  867. var JS = 'java' + SCRIPT + ':';
  868. var iframeDocument;
  869. iframe.style.display = 'none';
  870. html.appendChild(iframe);
  871. // https://github.com/zloirock/core-js/issues/475
  872. iframe.src = String(JS);
  873. iframeDocument = iframe.contentWindow.document;
  874. iframeDocument.open();
  875. iframeDocument.write(scriptTag('document.F=Object'));
  876. iframeDocument.close();
  877. return iframeDocument.F;
  878. };
  879.  
  880. // Check for document.domain and active x support
  881. // No need to use active x approach when document.domain is not set
  882. // see https://github.com/es-shims/es5-shim/issues/150
  883. // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
  884. // avoid IE GC bug
  885. var activeXDocument;
  886. var NullProtoObject = function () {
  887. try {
  888. activeXDocument = new ActiveXObject('htmlfile');
  889. } catch (error) { /* ignore */ }
  890. NullProtoObject = typeof document != 'undefined'
  891. ? document.domain && activeXDocument
  892. ? NullProtoObjectViaActiveX(activeXDocument) // old IE
  893. : NullProtoObjectViaIFrame()
  894. : NullProtoObjectViaActiveX(activeXDocument); // WSH
  895. var length = enumBugKeys.length;
  896. while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  897. return NullProtoObject();
  898. };
  899.  
  900. hiddenKeys[IE_PROTO] = true;
  901.  
  902. // `Object.create` method
  903. // https://tc39.es/ecma262/#sec-object.create
  904. var objectCreate = Object.create || function create(O, Properties) {
  905. var result;
  906. if (O !== null) {
  907. EmptyConstructor[PROTOTYPE] = anObject$1(O);
  908. result = new EmptyConstructor();
  909. EmptyConstructor[PROTOTYPE] = null;
  910. // add "__proto__" for Object.getPrototypeOf polyfill
  911. result[IE_PROTO] = O;
  912. } else result = NullProtoObject();
  913. return Properties === undefined ? result : defineProperties(result, Properties);
  914. };
  915.  
  916. var fails$3 = fails$a;
  917. var global$2 = global$e;
  918.  
  919. // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
  920. var $RegExp$1 = global$2.RegExp;
  921.  
  922. var regexpUnsupportedDotAll = fails$3(function () {
  923. var re = $RegExp$1('.', 's');
  924. return !(re.dotAll && re.exec('\n') && re.flags === 's');
  925. });
  926.  
  927. var fails$2 = fails$a;
  928. var global$1 = global$e;
  929.  
  930. // babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
  931. var $RegExp = global$1.RegExp;
  932.  
  933. var regexpUnsupportedNcg = fails$2(function () {
  934. var re = $RegExp('(?<a>b)', 'g');
  935. return re.exec('b').groups.a !== 'b' ||
  936. 'b'.replace(re, '$<a>c') !== 'bc';
  937. });
  938.  
  939. /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
  940. /* eslint-disable regexp/no-useless-quantifier -- testing */
  941. var toString$2 = toString$3;
  942. var regexpFlags = regexpFlags$1;
  943. var stickyHelpers = regexpStickyHelpers;
  944. var shared = shared$4.exports;
  945. var create = objectCreate;
  946. var getInternalState = internalState.get;
  947. var UNSUPPORTED_DOT_ALL = regexpUnsupportedDotAll;
  948. var UNSUPPORTED_NCG = regexpUnsupportedNcg;
  949.  
  950. var nativeExec = RegExp.prototype.exec;
  951. var nativeReplace = shared('native-string-replace', String.prototype.replace);
  952.  
  953. var patchedExec = nativeExec;
  954.  
  955. var UPDATES_LAST_INDEX_WRONG = (function () {
  956. var re1 = /a/;
  957. var re2 = /b*/g;
  958. nativeExec.call(re1, 'a');
  959. nativeExec.call(re2, 'a');
  960. return re1.lastIndex !== 0 || re2.lastIndex !== 0;
  961. })();
  962.  
  963. var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y || stickyHelpers.BROKEN_CARET;
  964.  
  965. // nonparticipating capturing group, copied from es5-shim's String#split patch.
  966. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
  967.  
  968. var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG;
  969.  
  970. if (PATCH) {
  971. // eslint-disable-next-line max-statements -- TODO
  972. patchedExec = function exec(string) {
  973. var re = this;
  974. var state = getInternalState(re);
  975. var str = toString$2(string);
  976. var raw = state.raw;
  977. var result, reCopy, lastIndex, match, i, object, group;
  978.  
  979. if (raw) {
  980. raw.lastIndex = re.lastIndex;
  981. result = patchedExec.call(raw, str);
  982. re.lastIndex = raw.lastIndex;
  983. return result;
  984. }
  985.  
  986. var groups = state.groups;
  987. var sticky = UNSUPPORTED_Y && re.sticky;
  988. var flags = regexpFlags.call(re);
  989. var source = re.source;
  990. var charsAdded = 0;
  991. var strCopy = str;
  992.  
  993. if (sticky) {
  994. flags = flags.replace('y', '');
  995. if (flags.indexOf('g') === -1) {
  996. flags += 'g';
  997. }
  998.  
  999. strCopy = str.slice(re.lastIndex);
  1000. // Support anchored sticky behavior.
  1001. if (re.lastIndex > 0 && (!re.multiline || re.multiline && str.charAt(re.lastIndex - 1) !== '\n')) {
  1002. source = '(?: ' + source + ')';
  1003. strCopy = ' ' + strCopy;
  1004. charsAdded++;
  1005. }
  1006. // ^(? + rx + ) is needed, in combination with some str slicing, to
  1007. // simulate the 'y' flag.
  1008. reCopy = new RegExp('^(?:' + source + ')', flags);
  1009. }
  1010.  
  1011. if (NPCG_INCLUDED) {
  1012. reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
  1013. }
  1014. if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
  1015.  
  1016. match = nativeExec.call(sticky ? reCopy : re, strCopy);
  1017.  
  1018. if (sticky) {
  1019. if (match) {
  1020. match.input = match.input.slice(charsAdded);
  1021. match[0] = match[0].slice(charsAdded);
  1022. match.index = re.lastIndex;
  1023. re.lastIndex += match[0].length;
  1024. } else re.lastIndex = 0;
  1025. } else if (UPDATES_LAST_INDEX_WRONG && match) {
  1026. re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
  1027. }
  1028. if (NPCG_INCLUDED && match && match.length > 1) {
  1029. // Fix browsers whose `exec` methods don't consistently return `undefined`
  1030. // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
  1031. nativeReplace.call(match[0], reCopy, function () {
  1032. for (i = 1; i < arguments.length - 2; i++) {
  1033. if (arguments[i] === undefined) match[i] = undefined;
  1034. }
  1035. });
  1036. }
  1037.  
  1038. if (match && groups) {
  1039. match.groups = object = create(null);
  1040. for (i = 0; i < groups.length; i++) {
  1041. group = groups[i];
  1042. object[group[0]] = match[group[1]];
  1043. }
  1044. }
  1045.  
  1046. return match;
  1047. };
  1048. }
  1049.  
  1050. var regexpExec$2 = patchedExec;
  1051.  
  1052. var $ = _export;
  1053. var exec = regexpExec$2;
  1054.  
  1055. // `RegExp.prototype.exec` method
  1056. // https://tc39.es/ecma262/#sec-regexp.prototype.exec
  1057. $({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
  1058. exec: exec
  1059. });
  1060.  
  1061. // TODO: Remove from `core-js@4` since it's moved to entry points
  1062.  
  1063. var redefine = redefine$2.exports;
  1064. var regexpExec$1 = regexpExec$2;
  1065. var fails$1 = fails$a;
  1066. var wellKnownSymbol$1 = wellKnownSymbol$3;
  1067. var createNonEnumerableProperty = createNonEnumerableProperty$4;
  1068.  
  1069. var SPECIES = wellKnownSymbol$1('species');
  1070. var RegExpPrototype = RegExp.prototype;
  1071.  
  1072. var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
  1073. var SYMBOL = wellKnownSymbol$1(KEY);
  1074.  
  1075. var DELEGATES_TO_SYMBOL = !fails$1(function () {
  1076. // String methods call symbol-named RegEp methods
  1077. var O = {};
  1078. O[SYMBOL] = function () { return 7; };
  1079. return ''[KEY](O) != 7;
  1080. });
  1081.  
  1082. var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails$1(function () {
  1083. // Symbol-named RegExp methods call .exec
  1084. var execCalled = false;
  1085. var re = /a/;
  1086.  
  1087. if (KEY === 'split') {
  1088. // We can't use real regex here since it causes deoptimization
  1089. // and serious performance degradation in V8
  1090. // https://github.com/zloirock/core-js/issues/306
  1091. re = {};
  1092. // RegExp[@@split] doesn't call the regex's exec method, but first creates
  1093. // a new one. We need to return the patched regex when creating the new one.
  1094. re.constructor = {};
  1095. re.constructor[SPECIES] = function () { return re; };
  1096. re.flags = '';
  1097. re[SYMBOL] = /./[SYMBOL];
  1098. }
  1099.  
  1100. re.exec = function () { execCalled = true; return null; };
  1101.  
  1102. re[SYMBOL]('');
  1103. return !execCalled;
  1104. });
  1105.  
  1106. if (
  1107. !DELEGATES_TO_SYMBOL ||
  1108. !DELEGATES_TO_EXEC ||
  1109. FORCED
  1110. ) {
  1111. var nativeRegExpMethod = /./[SYMBOL];
  1112. var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
  1113. var $exec = regexp.exec;
  1114. if ($exec === regexpExec$1 || $exec === RegExpPrototype.exec) {
  1115. if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
  1116. // The native String method already delegates to @@method (this
  1117. // polyfilled function), leasing to infinite recursion.
  1118. // We avoid it by directly calling the native @@method method.
  1119. return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
  1120. }
  1121. return { done: true, value: nativeMethod.call(str, regexp, arg2) };
  1122. }
  1123. return { done: false };
  1124. });
  1125.  
  1126. redefine(String.prototype, KEY, methods[0]);
  1127. redefine(RegExpPrototype, SYMBOL, methods[1]);
  1128. }
  1129.  
  1130. if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);
  1131. };
  1132.  
  1133. var toInteger$1 = toInteger$4;
  1134. var toString$1 = toString$3;
  1135. var requireObjectCoercible$1 = requireObjectCoercible$4;
  1136.  
  1137. // `String.prototype.codePointAt` methods implementation
  1138. var createMethod = function (CONVERT_TO_STRING) {
  1139. return function ($this, pos) {
  1140. var S = toString$1(requireObjectCoercible$1($this));
  1141. var position = toInteger$1(pos);
  1142. var size = S.length;
  1143. var first, second;
  1144. if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
  1145. first = S.charCodeAt(position);
  1146. return first < 0xD800 || first > 0xDBFF || position + 1 === size
  1147. || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
  1148. ? CONVERT_TO_STRING ? S.charAt(position) : first
  1149. : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
  1150. };
  1151. };
  1152.  
  1153. var stringMultibyte = {
  1154. // `String.prototype.codePointAt` method
  1155. // https://tc39.es/ecma262/#sec-string.prototype.codepointat
  1156. codeAt: createMethod(false),
  1157. // `String.prototype.at` method
  1158. // https://github.com/mathiasbynens/String.prototype.at
  1159. charAt: createMethod(true)
  1160. };
  1161.  
  1162. var charAt = stringMultibyte.charAt;
  1163.  
  1164. // `AdvanceStringIndex` abstract operation
  1165. // https://tc39.es/ecma262/#sec-advancestringindex
  1166. var advanceStringIndex$1 = function (S, index, unicode) {
  1167. return index + (unicode ? charAt(S, index).length : 1);
  1168. };
  1169.  
  1170. var toObject = toObject$2;
  1171.  
  1172. var floor = Math.floor;
  1173. var replace = ''.replace;
  1174. var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
  1175. var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
  1176.  
  1177. // `GetSubstitution` abstract operation
  1178. // https://tc39.es/ecma262/#sec-getsubstitution
  1179. var getSubstitution$1 = function (matched, str, position, captures, namedCaptures, replacement) {
  1180. var tailPos = position + matched.length;
  1181. var m = captures.length;
  1182. var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
  1183. if (namedCaptures !== undefined) {
  1184. namedCaptures = toObject(namedCaptures);
  1185. symbols = SUBSTITUTION_SYMBOLS;
  1186. }
  1187. return replace.call(replacement, symbols, function (match, ch) {
  1188. var capture;
  1189. switch (ch.charAt(0)) {
  1190. case '$': return '$';
  1191. case '&': return matched;
  1192. case '`': return str.slice(0, position);
  1193. case "'": return str.slice(tailPos);
  1194. case '<':
  1195. capture = namedCaptures[ch.slice(1, -1)];
  1196. break;
  1197. default: // \d\d?
  1198. var n = +ch;
  1199. if (n === 0) return match;
  1200. if (n > m) {
  1201. var f = floor(n / 10);
  1202. if (f === 0) return match;
  1203. if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
  1204. return match;
  1205. }
  1206. capture = captures[n - 1];
  1207. }
  1208. return capture === undefined ? '' : capture;
  1209. });
  1210. };
  1211.  
  1212. var classof = classofRaw;
  1213. var regexpExec = regexpExec$2;
  1214.  
  1215. // `RegExpExec` abstract operation
  1216. // https://tc39.es/ecma262/#sec-regexpexec
  1217. var regexpExecAbstract = function (R, S) {
  1218. var exec = R.exec;
  1219. if (typeof exec === 'function') {
  1220. var result = exec.call(R, S);
  1221. if (typeof result !== 'object') {
  1222. throw TypeError('RegExp exec method returned something other than an Object or null');
  1223. }
  1224. return result;
  1225. }
  1226.  
  1227. if (classof(R) !== 'RegExp') {
  1228. throw TypeError('RegExp#exec called on incompatible receiver');
  1229. }
  1230.  
  1231. return regexpExec.call(R, S);
  1232. };
  1233.  
  1234. var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
  1235. var fails = fails$a;
  1236. var anObject = anObject$6;
  1237. var toInteger = toInteger$4;
  1238. var toLength = toLength$2;
  1239. var toString = toString$3;
  1240. var requireObjectCoercible = requireObjectCoercible$4;
  1241. var advanceStringIndex = advanceStringIndex$1;
  1242. var getSubstitution = getSubstitution$1;
  1243. var regExpExec = regexpExecAbstract;
  1244. var wellKnownSymbol = wellKnownSymbol$3;
  1245.  
  1246. var REPLACE = wellKnownSymbol('replace');
  1247. var max = Math.max;
  1248. var min = Math.min;
  1249.  
  1250. var maybeToString = function (it) {
  1251. return it === undefined ? it : String(it);
  1252. };
  1253.  
  1254. // IE <= 11 replaces $0 with the whole match, as if it was $&
  1255. // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
  1256. var REPLACE_KEEPS_$0 = (function () {
  1257. // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
  1258. return 'a'.replace(/./, '$0') === '$0';
  1259. })();
  1260.  
  1261. // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
  1262. var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
  1263. if (/./[REPLACE]) {
  1264. return /./[REPLACE]('a', '$0') === '';
  1265. }
  1266. return false;
  1267. })();
  1268.  
  1269. var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
  1270. var re = /./;
  1271. re.exec = function () {
  1272. var result = [];
  1273. result.groups = { a: '7' };
  1274. return result;
  1275. };
  1276. // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
  1277. return ''.replace(re, '$<a>') !== '7';
  1278. });
  1279.  
  1280. // @@replace logic
  1281. fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
  1282. var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
  1283.  
  1284. return [
  1285. // `String.prototype.replace` method
  1286. // https://tc39.es/ecma262/#sec-string.prototype.replace
  1287. function replace(searchValue, replaceValue) {
  1288. var O = requireObjectCoercible(this);
  1289. var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
  1290. return replacer !== undefined
  1291. ? replacer.call(searchValue, O, replaceValue)
  1292. : nativeReplace.call(toString(O), searchValue, replaceValue);
  1293. },
  1294. // `RegExp.prototype[@@replace]` method
  1295. // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
  1296. function (string, replaceValue) {
  1297. var rx = anObject(this);
  1298. var S = toString(string);
  1299.  
  1300. if (
  1301. typeof replaceValue === 'string' &&
  1302. replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1 &&
  1303. replaceValue.indexOf('$<') === -1
  1304. ) {
  1305. var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
  1306. if (res.done) return res.value;
  1307. }
  1308.  
  1309. var functionalReplace = typeof replaceValue === 'function';
  1310. if (!functionalReplace) replaceValue = toString(replaceValue);
  1311.  
  1312. var global = rx.global;
  1313. if (global) {
  1314. var fullUnicode = rx.unicode;
  1315. rx.lastIndex = 0;
  1316. }
  1317. var results = [];
  1318. while (true) {
  1319. var result = regExpExec(rx, S);
  1320. if (result === null) break;
  1321.  
  1322. results.push(result);
  1323. if (!global) break;
  1324.  
  1325. var matchStr = toString(result[0]);
  1326. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  1327. }
  1328.  
  1329. var accumulatedResult = '';
  1330. var nextSourcePosition = 0;
  1331. for (var i = 0; i < results.length; i++) {
  1332. result = results[i];
  1333.  
  1334. var matched = toString(result[0]);
  1335. var position = max(min(toInteger(result.index), S.length), 0);
  1336. var captures = [];
  1337. // NOTE: This is equivalent to
  1338. // captures = result.slice(1).map(maybeToString)
  1339. // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
  1340. // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
  1341. // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
  1342. for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
  1343. var namedCaptures = result.groups;
  1344. if (functionalReplace) {
  1345. var replacerArgs = [matched].concat(captures, position, S);
  1346. if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
  1347. var replacement = toString(replaceValue.apply(undefined, replacerArgs));
  1348. } else {
  1349. replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
  1350. }
  1351. if (position >= nextSourcePosition) {
  1352. accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
  1353. nextSourcePosition = position + matched.length;
  1354. }
  1355. }
  1356. return accumulatedResult + S.slice(nextSourcePosition);
  1357. }
  1358. ];
  1359. }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
  1360.  
  1361. var blockTopics = [
  1362. "树洞一下",
  1363. "掘金相亲角",
  1364. "反馈 & 建议",
  1365. "沸点福利",
  1366. "掘金官方",
  1367. "上班摸鱼"
  1368. ];
  1369. var scriptId$1 = "juejin-activies-enhancer/break-the-circle";
  1370. var startTimeStamp = "1632326400000";
  1371. var endTimeStamp = "1633017600000";
  1372.  
  1373. const states$1 = {
  1374. userId: ""
  1375. };
  1376. function getUserId() {
  1377. return states$1.userId;
  1378. }
  1379. function setUserId(userId) {
  1380. states$1.userId = userId;
  1381. }
  1382.  
  1383. const scriptId = "juejin-activies-enhancer";
  1384. const inPinPage = pathname => {
  1385. return /^\/pins(?:\/|$)/.test(pathname);
  1386. };
  1387. const inProfilePage = pathname => {
  1388. return new RegExp(`^\\/user\\/${getUserId()}(?:\\/|$)`).test(pathname);
  1389. };
  1390. function fetchData({
  1391. url,
  1392. data = {}
  1393. }) {
  1394. return new Promise((resolve, reject) => {
  1395. GM_xmlhttpRequest({
  1396. method: "POST",
  1397. url,
  1398. data: JSON.stringify({
  1399. user_id: getUserId(),
  1400. ...data
  1401. }),
  1402. headers: {
  1403. "User-agent": window.navigator.userAgent,
  1404. "content-type": "application/json"
  1405. },
  1406. onload: function ({
  1407. status,
  1408. response
  1409. }) {
  1410. try {
  1411. if (status === 200) {
  1412. const responseData = JSON.parse(response);
  1413. resolve(responseData);
  1414. } else {
  1415. reject(response);
  1416. }
  1417. } catch (err) {
  1418. console.log(err);
  1419. reject(err);
  1420. }
  1421. }
  1422. });
  1423. });
  1424. }
  1425.  
  1426. class ProfileStatRender {
  1427. constructor() {
  1428. const blockEl = document.createElement("div");
  1429. blockEl.dataset.tampermonkey = scriptId;
  1430. blockEl.className = "block shadow";
  1431. blockEl.style = `margin-bottom: 1rem;background-color: #fff;border-radius: 2px;`;
  1432. const titleEl = document.createElement("div");
  1433. titleEl.style = `padding: 1.333rem;
  1434. font-size: 1.333rem;
  1435. font-weight: 600;
  1436. color: #31445b;
  1437. border-bottom: 1px solid rgba(230,230,231,.5);`;
  1438. titleEl.textContent = "活动状态";
  1439. blockEl.appendChild(titleEl);
  1440. const contentEl = document.createElement("div");
  1441. contentEl.style = `padding: 1.333rem;`;
  1442. blockEl.appendChild(contentEl);
  1443. this.blockEl = blockEl;
  1444. this.contentEl = contentEl;
  1445. this.data = [];
  1446. }
  1447.  
  1448. add(data) {
  1449. const now = new Date().valueOf();
  1450. this.data.push(data);
  1451. this.data.sort((a, b) => {
  1452. const isFinishA = a.endTime > now;
  1453. const isFinishB = b.endTime > now;
  1454. if (isFinishA && !isFinishB) return -1;else if (isFinishB && !isFinishA) return 1;
  1455. return b.startTime - a.startTime;
  1456. });
  1457. this.render();
  1458. }
  1459.  
  1460. render() {
  1461. const container = this.contentEl;
  1462. const currentDOM = container.children;
  1463. this.data.forEach(({
  1464. node
  1465. }, index) => {
  1466. const element = currentDOM[index];
  1467.  
  1468. if (!element) {
  1469. container.appendChild(node);
  1470. return;
  1471. }
  1472.  
  1473. if (element !== node) {
  1474. element.replaceWith(node);
  1475. }
  1476. });
  1477.  
  1478. for (let i = this.data.length, len = currentDOM.length; i < len; i++) {
  1479. container.removeChild(currentDOM[i]);
  1480. }
  1481.  
  1482. if (!this.blockEl.isConnected) {
  1483. const siblingEl = document.querySelector(".user-view .stat-block");
  1484. const parentEl = document.querySelector(".user-view .sticky-wrap");
  1485.  
  1486. if (siblingEl) {
  1487. var _siblingEl$parentElem;
  1488.  
  1489. (_siblingEl$parentElem = siblingEl.parentElement.querySelector(`[data-tampermonkey='${scriptId}']`)) === null || _siblingEl$parentElem === void 0 ? void 0 : _siblingEl$parentElem.remove();
  1490. siblingEl.after(this.blockEl);
  1491. return;
  1492. }
  1493.  
  1494. if (parentEl) {
  1495. var _parentEl$querySelect;
  1496.  
  1497. (_parentEl$querySelect = parentEl.querySelector(`[data-tampermonkey='${scriptId}']`)) === null || _parentEl$querySelect === void 0 ? void 0 : _parentEl$querySelect.remove();
  1498. parentEl.firstChild ? parentEl.insertBefore(this.blockEl, parentEl.firstChild) : parentEl.appendChild(this.blockEl);
  1499. }
  1500. }
  1501. }
  1502.  
  1503. }
  1504.  
  1505. const profileStateRender = new ProfileStatRender();
  1506.  
  1507. const states = GM_getValue(scriptId$1, {
  1508. checkPoint: 0,
  1509. topics: {
  1510. todayEfficientTopicTitles: [],
  1511. efficientDays: 0,
  1512. efficientTopics: {}
  1513. }
  1514. });
  1515.  
  1516. function getCheckPoint() {
  1517. return states.checkPoint;
  1518. }
  1519.  
  1520. function getTopicStates() {
  1521. return states.topics;
  1522. }
  1523. function setTopicStates(value) {
  1524. states.checkPoint = new Date().valueOf();
  1525. states.topics = value;
  1526. GM_setValue(scriptId$1, states);
  1527. }
  1528. async function fetchStates() {
  1529. if (getCheckPoint() > endTimeStamp) {
  1530. return new Promise(resolve => {
  1531. setTimeout(() => {
  1532. resolve(getTopicStates());
  1533. });
  1534. });
  1535. }
  1536.  
  1537. const dailyTopics = await requestShortMsgTopic();
  1538. updateGlobalStates(dailyTopics);
  1539. }
  1540.  
  1541. function requestShortMsgTopic(cursor = "0", dailyTopics = []) {
  1542. return fetchData({
  1543. url: "https://api.juejin.cn/content_api/v1/short_msg/query_list",
  1544. data: {
  1545. sort_type: 4,
  1546. limit: 24,
  1547. cursor
  1548. }
  1549. }).then(responseData => {
  1550. const {
  1551. data,
  1552. cursor,
  1553. has_more
  1554. } = responseData;
  1555. let lastPublishTime = Infinity;
  1556.  
  1557. if (data) {
  1558. for (const msg of data) {
  1559. const {
  1560. topic,
  1561. msg_Info
  1562. } = msg;
  1563. const publishTime = msg_Info.ctime * 1000;
  1564.  
  1565. if (publishTime > startTimeStamp && publishTime < endTimeStamp && !blockTopics.includes(topic.title)) {
  1566. const day = Math.floor((publishTime - startTimeStamp) / 86400000);
  1567.  
  1568. if (!dailyTopics[day]) {
  1569. dailyTopics[day] = [];
  1570. }
  1571.  
  1572. dailyTopics[day].push({
  1573. title: topic.title,
  1574. // wait: 0, pass: 1, fail: 2
  1575. verified: msg_Info.verify_status === 0 ? 0 : msg_Info.audit_status === 2 && msg_Info.verify_status === 1 ? 1 : 2
  1576. });
  1577. }
  1578.  
  1579. lastPublishTime = publishTime;
  1580.  
  1581. if (publishTime < startTimeStamp) {
  1582. break;
  1583. }
  1584. }
  1585. }
  1586.  
  1587. if (lastPublishTime > startTimeStamp && has_more) {
  1588. return requestShortMsgTopic(cursor, dailyTopics);
  1589. } else {
  1590. return dailyTopics;
  1591. }
  1592. });
  1593. }
  1594.  
  1595. function updateGlobalStates(dailyTopics) {
  1596. const allEfficientTopicTitles = new Set();
  1597. const topicCountAndVerified = {};
  1598. const todayIndex = Math.floor((new Date().valueOf() - startTimeStamp) / 86400000);
  1599. const todayEfficientTopicTitles = [];
  1600. let efficientDays = 0;
  1601. dailyTopics.forEach((topics, index) => {
  1602. // 获取一天破解的圈子
  1603. const dailyEfficientTopicTitles = new Set(topics.filter(({
  1604. title,
  1605. verified
  1606. }) => {
  1607. // 破圈:未被破解 + 已通过审核或正在等待审核
  1608. return !allEfficientTopicTitles.has(title) && verified !== 2;
  1609. }).map(({
  1610. title
  1611. }) => title));
  1612. const dailyVerifiedTopicTitles = new Set(topics.filter(({
  1613. title,
  1614. verified
  1615. }) => {
  1616. // 破圈:未被破解 + 已通过审核或正在等待审核
  1617. return !allEfficientTopicTitles.has(title) && verified === 1;
  1618. })); // 更新达标天数
  1619.  
  1620. if (dailyVerifiedTopicTitles.size >= 3) {
  1621. efficientDays++;
  1622. } // 记录今日破圈数据
  1623.  
  1624.  
  1625. if (index === todayIndex) {
  1626. todayEfficientTopicTitles.push(...dailyEfficientTopicTitles);
  1627. } // 更新已破圈集合
  1628.  
  1629.  
  1630. dailyEfficientTopicTitles.forEach(t => allEfficientTopicTitles.add(t)); // 记录已破圈发帖数
  1631.  
  1632. topics.map(({
  1633. title,
  1634. verified
  1635. }) => {
  1636. if (!topicCountAndVerified[title]) {
  1637. topicCountAndVerified[title] = {
  1638. count: 1,
  1639. verified
  1640. };
  1641. } else {
  1642. var _topicCountAndVerifie, _verified;
  1643.  
  1644. topicCountAndVerified[title]["count"]++;
  1645. (_topicCountAndVerifie = topicCountAndVerified[title])[_verified = "verified"] || (_topicCountAndVerifie[_verified] = verified === 1);
  1646. }
  1647. });
  1648. });
  1649. setTopicStates({
  1650. todayEfficientTopicTitles,
  1651. efficientDays,
  1652. efficientTopics: Object.fromEntries([...allEfficientTopicTitles].map(title => {
  1653. return [title, topicCountAndVerified[title]];
  1654. }))
  1655. });
  1656. }
  1657.  
  1658. function renderPinPage() {
  1659. var _containerEl$querySel;
  1660.  
  1661. const containerEl = document.querySelector(".main .userbox");
  1662.  
  1663. if (!containerEl) {
  1664. return;
  1665. }
  1666.  
  1667. (_containerEl$querySel = containerEl.querySelector(`[data-tampermonkey='${scriptId$1}']`)) === null || _containerEl$querySel === void 0 ? void 0 : _containerEl$querySel.remove();
  1668. const wrapperEl = document.createElement("div");
  1669. wrapperEl.dataset.tampermonkey = scriptId$1;
  1670. wrapperEl.appendChild(getRewardElement());
  1671. wrapperEl.style = "padding-top:20px;";
  1672. containerEl.appendChild(wrapperEl);
  1673. }
  1674. function renderProfilePage() {
  1675. profileStateRender.add({
  1676. startTime: new Date(startTimeStamp),
  1677. endTime: new Date(endTimeStamp),
  1678. node: getRewardElement()
  1679. });
  1680. }
  1681.  
  1682. function getRewardElement() {
  1683. const {
  1684. efficientTopics,
  1685. efficientDays
  1686. } = getTopicStates();
  1687. const topicCount = Object.values(efficientTopics).filter(({
  1688. verified
  1689. }) => !!verified).length;
  1690. const reward = ["幸运奖", "三等奖", "二等奖", "一等奖", "全勤奖"][efficientDays >= 8 ? 4 : Math.floor((efficientDays - 1) / 2)] ?? (topicCount > 1 ? "幸运奖" : "无");
  1691. const descriptionHTML = [`🎯 &nbsp;达成 ${efficientDays} 天`, `⭕ &nbsp;${topicCount} 个圈子`, `🏆 &nbsp;${reward}`].map(text => `<span style="color:#939aa3;font-weight:bold">${text}</span>`).join("");
  1692. const rewardEl = document.createElement("div");
  1693. rewardEl.innerHTML = `<h3 style="margin:0;"><a style="color:inherit" href="https://juejin.cn/pin/7010556755855802376" target="__blank">破圈行动</a> <span style="float:right">9/23 - 9/30</span></h3>
  1694. <p style="display:flex;flex-direction:row;justify-content: space-between;">
  1695. ${descriptionHTML}
  1696. </p>
  1697. ${endTimeStamp < new Date().valueOf() || efficientDays >= 8 ? getFinishSummary({
  1698. isJoined: topicCount > 0
  1699. }) : getTodayStatus()}
  1700. `;
  1701. return rewardEl;
  1702. }
  1703.  
  1704. function getTodayStatus() {
  1705. const {
  1706. todayEfficientTopicTitles,
  1707. efficientTopics
  1708. } = getTopicStates();
  1709. const todayTopicsHTML = todayEfficientTopicTitles.map(title => {
  1710. var _efficientTopics$titl;
  1711.  
  1712. const isVerified = (_efficientTopics$titl = efficientTopics[title]) === null || _efficientTopics$titl === void 0 ? void 0 : _efficientTopics$titl.verified;
  1713. return renderTag(title, isVerified);
  1714. }).join("");
  1715. const todayVerifiedCount = todayEfficientTopicTitles.filter(title => {
  1716. var _efficientTopics$titl2;
  1717.  
  1718. return (_efficientTopics$titl2 = efficientTopics[title]) === null || _efficientTopics$titl2 === void 0 ? void 0 : _efficientTopics$titl2.verified;
  1719. }).length;
  1720. const todayVerifyCount = todayEfficientTopicTitles.length - todayVerifiedCount;
  1721. return `<p>📅 &nbsp;今天 ${todayVerifiedCount} / 3 ${todayVerifyCount > 0 ? `&nbsp;🧐 人工审核中&nbsp;${todayVerifyCount} 条` : ""}</p>
  1722. <div>
  1723. ${todayTopicsHTML}
  1724. </div>`;
  1725. }
  1726.  
  1727. function getFinishSummary({
  1728. isJoined
  1729. }) {
  1730. const {
  1731. efficientTopics
  1732. } = getTopicStates();
  1733.  
  1734. if (isJoined) {
  1735. return `<details>
  1736. <summary style="cursor:pointer;margin-bottom:8px">🎉&nbsp;恭喜完成活动!展开查看破解列表</summary>
  1737. ${Object.keys(efficientTopics).map(title => {
  1738. return renderTag(title);
  1739. }).join("")}
  1740. </details>`;
  1741. } else {
  1742. return `<p style="color:#939aa3;">⌛️ 活动已结束</p>`;
  1743. }
  1744. }
  1745.  
  1746. function renderTag(title, isVerified = true) {
  1747. return `<span style="display: inline-block;
  1748. padding:2px 10px;
  1749. background-color: ${isVerified ? "#eaf2ff" : "#e5e7ea"};
  1750. color:${isVerified ? "#1e80ff" : "#717682"};
  1751. font-size:12px;
  1752. line-height:20px;
  1753. border-radius:50px;
  1754. margin-left:2px;margin-bottom:2px;">${title}</span>`;
  1755. }
  1756.  
  1757. function renderTopicSelectMenu(containerEl) {
  1758. if (endTimeStamp < new Date().valueOf()) return;
  1759. const topicPanel = containerEl.querySelector(".topicwrapper .new_topic_picker");
  1760.  
  1761. if (!topicPanel) {
  1762. return;
  1763. }
  1764.  
  1765. const observer = new MutationObserver(function (mutations) {
  1766. mutations.forEach(({
  1767. type,
  1768. addedNodes
  1769. }) => {
  1770. if (type === "childList" && addedNodes.length) {
  1771. addedNodes.forEach(itemEl => {
  1772. var _itemEl$classList;
  1773.  
  1774. if (!itemEl) return;else if (itemEl !== null && itemEl !== void 0 && (_itemEl$classList = itemEl.classList) !== null && _itemEl$classList !== void 0 && _itemEl$classList.contains("contents")) {
  1775. renderWholeContent(itemEl);
  1776. } else {
  1777. renderItem(itemEl);
  1778. }
  1779. });
  1780. }
  1781. });
  1782. });
  1783. observer.observe(topicPanel, {
  1784. childList: true,
  1785. subtree: true
  1786. });
  1787. renderWholeContent(topicPanel.querySelector(".wrapper .contents"));
  1788. }
  1789.  
  1790. function renderWholeContent(contentEl) {
  1791. if (!contentEl) {
  1792. return;
  1793. }
  1794.  
  1795. const allItemEls = contentEl.querySelectorAll(".item");
  1796. allItemEls.forEach(itemEl => {
  1797. renderItem(itemEl);
  1798. });
  1799. }
  1800.  
  1801. function renderItem(itemEl) {
  1802. var _itemEl$parentElement, _itemEl$parentElement2, _itemEl$querySelector, _itemEl$querySelector2, _efficientTopics$titl, _efficientTopics$titl2;
  1803.  
  1804. const {
  1805. efficientTopics
  1806. } = getTopicStates();
  1807. if (!itemEl || !(itemEl.nodeType === 1 && itemEl.nodeName === "DIV" && itemEl.classList.contains("item")) || !((_itemEl$parentElement = itemEl.parentElement) !== null && _itemEl$parentElement !== void 0 && _itemEl$parentElement.classList.contains("contents")) && !((_itemEl$parentElement2 = itemEl.parentElement) !== null && _itemEl$parentElement2 !== void 0 && _itemEl$parentElement2.classList.contains("searchlist"))) return;
  1808. (_itemEl$querySelector = itemEl.querySelector(`[data-tampermonkey='${scriptId$1}']`)) === null || _itemEl$querySelector === void 0 ? void 0 : _itemEl$querySelector.remove();
  1809. const title = (_itemEl$querySelector2 = itemEl.querySelector(".content_main > .title")) === null || _itemEl$querySelector2 === void 0 ? void 0 : _itemEl$querySelector2.textContent;
  1810. const isBlockedTopic = blockTopics.includes(title);
  1811. const count = (_efficientTopics$titl = efficientTopics[title]) === null || _efficientTopics$titl === void 0 ? void 0 : _efficientTopics$titl.count;
  1812. const verified = (_efficientTopics$titl2 = efficientTopics[title]) === null || _efficientTopics$titl2 === void 0 ? void 0 : _efficientTopics$titl2.verified;
  1813. const iconEl = document.createElement("div");
  1814. iconEl.dataset.tampermonkey = scriptId$1;
  1815.  
  1816. if (count) {
  1817. iconEl.style = `width: 18px;
  1818. height: 18px;
  1819. overflow: hidden;
  1820. border-radius: 50%;
  1821. background-color: ${!verified ? "#939aa3" : "#0fbf60"};
  1822. color: #fff;
  1823. font-size: 12px;
  1824. text-align: center;
  1825. line-height: 18px;
  1826. font-weight: bold;
  1827. font-family: monospace;
  1828. margin-left: auto;
  1829. margin-right: 15px;`;
  1830. iconEl.innerText = count;
  1831. } else {
  1832. iconEl.style = `margin-left: auto;margin-right: 15px;color: #c2c6cc`;
  1833.  
  1834. if (isBlockedTopic) {
  1835. iconEl.innerHTML = `<svg
  1836. width="18"
  1837. height="18"
  1838. viewBox="0 0 24 24"
  1839. fill="none"
  1840. xmlns="http://www.w3.org/2000/svg"
  1841. >
  1842. <path
  1843. d="M8.46457 14.1213C8.07404 14.5118 8.07404 15.145 8.46457 15.5355C8.85509 15.926 9.48825 15.926 9.87878 15.5355L15.5356 9.87862C15.9262 9.4881 15.9262 8.85493 15.5356 8.46441C15.1451 8.07388 14.5119 8.07388 14.1214 8.46441L8.46457 14.1213Z"
  1844. fill="currentColor"
  1845. />
  1846. <path
  1847. fill-rule="evenodd"
  1848. clip-rule="evenodd"
  1849. d="M1 12C1 5.92487 5.92487 1 12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12ZM12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21Z"
  1850. fill="currentColor"
  1851. />
  1852. </svg>`;
  1853. } else {
  1854. iconEl.innerHTML = `<svg
  1855. width="18"
  1856. height="18"
  1857. viewBox="0 0 24 24"
  1858. fill="none"
  1859. xmlns="http://www.w3.org/2000/svg"
  1860. >
  1861. <path
  1862. d="M10.2426 16.3137L6 12.071L7.41421 10.6568L10.2426 13.4853L15.8995 7.8284L17.3137 9.24262L10.2426 16.3137Z"
  1863. fill="currentColor"
  1864. />
  1865. <path
  1866. fill-rule="evenodd"
  1867. clip-rule="evenodd"
  1868. d="M1 12C1 5.92487 5.92487 1 12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12ZM12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21Z"
  1869. fill="currentColor"
  1870. />
  1871. </svg>`;
  1872. }
  1873. }
  1874.  
  1875. itemEl.appendChild(iconEl);
  1876. }
  1877.  
  1878. function onRouteChange$1(prevRouterPathname, currentRouterPathname) {
  1879. if (inPinPage(currentRouterPathname) && !inPinPage(prevRouterPathname)) {
  1880. fetchStates().then(() => {
  1881. renderTopicSelectMenu(document);
  1882. renderPinPage();
  1883. });
  1884. } else if (inProfilePage(currentRouterPathname) && !inProfilePage(prevRouterPathname)) {
  1885. fetchStates().then(() => {
  1886. setTimeout(() => {
  1887. renderProfilePage();
  1888. }, 1000);
  1889. });
  1890. }
  1891. }
  1892.  
  1893. function initPopupMutation() {
  1894. const componentBoxEl = document.querySelector(".global-component-box");
  1895.  
  1896. if (componentBoxEl) {
  1897. const observer = new MutationObserver(function (mutations) {
  1898. const mutation = mutations.find(mutation => {
  1899. const {
  1900. type,
  1901. addedNodes
  1902. } = mutation;
  1903.  
  1904. if (type === "childList" && Array.prototype.find.call(addedNodes, node => {
  1905. var _node$classList;
  1906.  
  1907. return (_node$classList = node.classList) === null || _node$classList === void 0 ? void 0 : _node$classList.contains("pin-modal");
  1908. })) {
  1909. return true;
  1910. } else {
  1911. return false;
  1912. }
  1913. });
  1914.  
  1915. if (mutation) {
  1916. mutation.addedNodes.forEach(node => {
  1917. var _node$classList2;
  1918.  
  1919. if ((_node$classList2 = node.classList) !== null && _node$classList2 !== void 0 && _node$classList2.contains("pin-modal")) {
  1920. fetchStates().then(() => {
  1921. renderTopicSelectMenu(node);
  1922. });
  1923. }
  1924. });
  1925. }
  1926. });
  1927. observer.observe(componentBoxEl, {
  1928. childList: true
  1929. });
  1930. }
  1931. }
  1932.  
  1933. var BreakTheCycle = {
  1934. onRouteChange: onRouteChange$1,
  1935. onLoaded: initPopupMutation
  1936. };
  1937.  
  1938. const activities = [BreakTheCycle];
  1939. let currentRouterPathname = "";
  1940.  
  1941. (function start() {
  1942. const userProfileEl = document.querySelector(".user-dropdown-list > .nav-menu-item-group:nth-child(2) > .nav-menu-item > a[href]");
  1943. const userId = userProfileEl === null || userProfileEl === void 0 ? void 0 : userProfileEl.getAttribute("href").replace(/\/user\//, "");
  1944.  
  1945. if (!userId) {
  1946. return;
  1947. }
  1948.  
  1949. setUserId(userId);
  1950. initRouter();
  1951. activities.forEach(({
  1952. onLoaded
  1953. }) => onLoaded === null || onLoaded === void 0 ? void 0 : onLoaded());
  1954. })();
  1955.  
  1956. function initRouter() {
  1957. const _historyPushState = history.pushState;
  1958. const _historyReplaceState = history.replaceState;
  1959.  
  1960. history.pushState = function () {
  1961. _historyPushState.apply(history, arguments);
  1962.  
  1963. onRouteChange();
  1964. };
  1965.  
  1966. history.replaceState = function () {
  1967. _historyReplaceState.apply(history, arguments);
  1968.  
  1969. onRouteChange();
  1970. };
  1971.  
  1972. window.addEventListener("popstate", function () {
  1973. onRouteChange();
  1974. });
  1975. }
  1976.  
  1977. function onRouteChange() {
  1978. const prevRouterPathname = currentRouterPathname;
  1979. currentRouterPathname = document.location.pathname;
  1980.  
  1981. if (prevRouterPathname !== currentRouterPathname) {
  1982. activities.forEach(({
  1983. onRouteChange
  1984. }) => {
  1985. onRouteChange === null || onRouteChange === void 0 ? void 0 : onRouteChange(prevRouterPathname, currentRouterPathname);
  1986. });
  1987. }
  1988. }
  1989.  
  1990. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址