BetterBlacket

the best client mod for blacket.

  1. // ==UserScript==
  2. // @name BetterBlacket
  3. // @description the best client mod for blacket.
  4. // @version 3.0.8.5
  5. // @icon https://blacket.org/content/logo.png
  6.  
  7. // @author Death / VillainsRule
  8. // @namespace https://bb.villainsrule.xyz
  9.  
  10. // @match *://blacket.org/*
  11. // @match *://blacket.xotic.org/*
  12. // @match *://blacket.monkxy.com/*
  13. // @match *://dashboard.iblooket.com/*
  14. // @match *://b.blooketis.life/*
  15. // @match *://b.fart.services/*
  16.  
  17. // @grant none
  18. // @run-at document-start
  19. // ==/UserScript==
  20.  
  21. /* eslint-disable */
  22.  
  23. var __defProp = Object.defineProperty;
  24. var __typeError = (msg) => {
  25. throw TypeError(msg);
  26. };
  27. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  28. var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
  29. var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
  30. var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
  31. var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
  32. var _subscriptions;
  33. function bind(fn, thisArg) {
  34. return function wrap() {
  35. return fn.apply(thisArg, arguments);
  36. };
  37. }
  38. const { toString } = Object.prototype;
  39. const { getPrototypeOf } = Object;
  40. const { iterator, toStringTag } = Symbol;
  41. const kindOf = /* @__PURE__ */ ((cache) => (thing) => {
  42. const str = toString.call(thing);
  43. return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
  44. })(/* @__PURE__ */ Object.create(null));
  45. const kindOfTest = (type) => {
  46. type = type.toLowerCase();
  47. return (thing) => kindOf(thing) === type;
  48. };
  49. const typeOfTest = (type) => (thing) => typeof thing === type;
  50. const { isArray } = Array;
  51. const isUndefined = typeOfTest("undefined");
  52. function isBuffer(val) {
  53. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
  54. }
  55. const isArrayBuffer = kindOfTest("ArrayBuffer");
  56. function isArrayBufferView(val) {
  57. let result;
  58. if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
  59. result = ArrayBuffer.isView(val);
  60. } else {
  61. result = val && val.buffer && isArrayBuffer(val.buffer);
  62. }
  63. return result;
  64. }
  65. const isString = typeOfTest("string");
  66. const isFunction = typeOfTest("function");
  67. const isNumber = typeOfTest("number");
  68. const isObject = (thing) => thing !== null && typeof thing === "object";
  69. const isBoolean = (thing) => thing === true || thing === false;
  70. const isPlainObject = (val) => {
  71. if (kindOf(val) !== "object") {
  72. return false;
  73. }
  74. const prototype2 = getPrototypeOf(val);
  75. return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
  76. };
  77. const isDate = kindOfTest("Date");
  78. const isFile = kindOfTest("File");
  79. const isBlob = kindOfTest("Blob");
  80. const isFileList = kindOfTest("FileList");
  81. const isStream = (val) => isObject(val) && isFunction(val.pipe);
  82. const isFormData = (thing) => {
  83. let kind;
  84. return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
  85. kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
  86. };
  87. const isURLSearchParams = kindOfTest("URLSearchParams");
  88. const [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
  89. const trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
  90. function forEach(obj, fn, { allOwnKeys = false } = {}) {
  91. if (obj === null || typeof obj === "undefined") {
  92. return;
  93. }
  94. let i;
  95. let l;
  96. if (typeof obj !== "object") {
  97. obj = [obj];
  98. }
  99. if (isArray(obj)) {
  100. for (i = 0, l = obj.length; i < l; i++) {
  101. fn.call(null, obj[i], i, obj);
  102. }
  103. } else {
  104. const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
  105. const len = keys.length;
  106. let key;
  107. for (i = 0; i < len; i++) {
  108. key = keys[i];
  109. fn.call(null, obj[key], key, obj);
  110. }
  111. }
  112. }
  113. function findKey(obj, key) {
  114. key = key.toLowerCase();
  115. const keys = Object.keys(obj);
  116. let i = keys.length;
  117. let _key;
  118. while (i-- > 0) {
  119. _key = keys[i];
  120. if (key === _key.toLowerCase()) {
  121. return _key;
  122. }
  123. }
  124. return null;
  125. }
  126. const _global = (() => {
  127. if (typeof globalThis !== "undefined") return globalThis;
  128. return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
  129. })();
  130. const isContextDefined = (context) => !isUndefined(context) && context !== _global;
  131. function merge() {
  132. const { caseless } = isContextDefined(this) && this || {};
  133. const result = {};
  134. const assignValue = (val, key) => {
  135. const targetKey = caseless && findKey(result, key) || key;
  136. if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
  137. result[targetKey] = merge(result[targetKey], val);
  138. } else if (isPlainObject(val)) {
  139. result[targetKey] = merge({}, val);
  140. } else if (isArray(val)) {
  141. result[targetKey] = val.slice();
  142. } else {
  143. result[targetKey] = val;
  144. }
  145. };
  146. for (let i = 0, l = arguments.length; i < l; i++) {
  147. arguments[i] && forEach(arguments[i], assignValue);
  148. }
  149. return result;
  150. }
  151. const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
  152. forEach(b, (val, key) => {
  153. if (thisArg && isFunction(val)) {
  154. a[key] = bind(val, thisArg);
  155. } else {
  156. a[key] = val;
  157. }
  158. }, { allOwnKeys });
  159. return a;
  160. };
  161. const stripBOM = (content) => {
  162. if (content.charCodeAt(0) === 65279) {
  163. content = content.slice(1);
  164. }
  165. return content;
  166. };
  167. const inherits = (constructor, superConstructor, props, descriptors2) => {
  168. constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
  169. constructor.prototype.constructor = constructor;
  170. Object.defineProperty(constructor, "super", {
  171. value: superConstructor.prototype
  172. });
  173. props && Object.assign(constructor.prototype, props);
  174. };
  175. const toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
  176. let props;
  177. let i;
  178. let prop;
  179. const merged = {};
  180. destObj = destObj || {};
  181. if (sourceObj == null) return destObj;
  182. do {
  183. props = Object.getOwnPropertyNames(sourceObj);
  184. i = props.length;
  185. while (i-- > 0) {
  186. prop = props[i];
  187. if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
  188. destObj[prop] = sourceObj[prop];
  189. merged[prop] = true;
  190. }
  191. }
  192. sourceObj = filter2 !== false && getPrototypeOf(sourceObj);
  193. } while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
  194. return destObj;
  195. };
  196. const endsWith = (str, searchString, position) => {
  197. str = String(str);
  198. if (position === void 0 || position > str.length) {
  199. position = str.length;
  200. }
  201. position -= searchString.length;
  202. const lastIndex = str.indexOf(searchString, position);
  203. return lastIndex !== -1 && lastIndex === position;
  204. };
  205. const toArray = (thing) => {
  206. if (!thing) return null;
  207. if (isArray(thing)) return thing;
  208. let i = thing.length;
  209. if (!isNumber(i)) return null;
  210. const arr = new Array(i);
  211. while (i-- > 0) {
  212. arr[i] = thing[i];
  213. }
  214. return arr;
  215. };
  216. const isTypedArray = /* @__PURE__ */ ((TypedArray) => {
  217. return (thing) => {
  218. return TypedArray && thing instanceof TypedArray;
  219. };
  220. })(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
  221. const forEachEntry = (obj, fn) => {
  222. const generator = obj && obj[iterator];
  223. const _iterator = generator.call(obj);
  224. let result;
  225. while ((result = _iterator.next()) && !result.done) {
  226. const pair = result.value;
  227. fn.call(obj, pair[0], pair[1]);
  228. }
  229. };
  230. const matchAll = (regExp, str) => {
  231. let matches;
  232. const arr = [];
  233. while ((matches = regExp.exec(str)) !== null) {
  234. arr.push(matches);
  235. }
  236. return arr;
  237. };
  238. const isHTMLForm = kindOfTest("HTMLFormElement");
  239. const toCamelCase = (str) => {
  240. return str.toLowerCase().replace(
  241. /[-_\s]([a-z\d])(\w*)/g,
  242. function replacer(m, p1, p2) {
  243. return p1.toUpperCase() + p2;
  244. }
  245. );
  246. };
  247. const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
  248. const isRegExp = kindOfTest("RegExp");
  249. const reduceDescriptors = (obj, reducer) => {
  250. const descriptors2 = Object.getOwnPropertyDescriptors(obj);
  251. const reducedDescriptors = {};
  252. forEach(descriptors2, (descriptor, name) => {
  253. let ret;
  254. if ((ret = reducer(descriptor, name, obj)) !== false) {
  255. reducedDescriptors[name] = ret || descriptor;
  256. }
  257. });
  258. Object.defineProperties(obj, reducedDescriptors);
  259. };
  260. const freezeMethods = (obj) => {
  261. reduceDescriptors(obj, (descriptor, name) => {
  262. if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
  263. return false;
  264. }
  265. const value = obj[name];
  266. if (!isFunction(value)) return;
  267. descriptor.enumerable = false;
  268. if ("writable" in descriptor) {
  269. descriptor.writable = false;
  270. return;
  271. }
  272. if (!descriptor.set) {
  273. descriptor.set = () => {
  274. throw Error("Can not rewrite read-only method '" + name + "'");
  275. };
  276. }
  277. });
  278. };
  279. const toObjectSet = (arrayOrString, delimiter) => {
  280. const obj = {};
  281. const define = (arr) => {
  282. arr.forEach((value) => {
  283. obj[value] = true;
  284. });
  285. };
  286. isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
  287. return obj;
  288. };
  289. const noop = () => {
  290. };
  291. const toFiniteNumber = (value, defaultValue) => {
  292. return value != null && Number.isFinite(value = +value) ? value : defaultValue;
  293. };
  294. function isSpecCompliantForm(thing) {
  295. return !!(thing && isFunction(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
  296. }
  297. const toJSONObject = (obj) => {
  298. const stack = new Array(10);
  299. const visit = (source, i) => {
  300. if (isObject(source)) {
  301. if (stack.indexOf(source) >= 0) {
  302. return;
  303. }
  304. if (!("toJSON" in source)) {
  305. stack[i] = source;
  306. const target = isArray(source) ? [] : {};
  307. forEach(source, (value, key) => {
  308. const reducedValue = visit(value, i + 1);
  309. !isUndefined(reducedValue) && (target[key] = reducedValue);
  310. });
  311. stack[i] = void 0;
  312. return target;
  313. }
  314. }
  315. return source;
  316. };
  317. return visit(obj, 0);
  318. };
  319. const isAsyncFn = kindOfTest("AsyncFunction");
  320. const isThenable = (thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
  321. const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
  322. if (setImmediateSupported) {
  323. return setImmediate;
  324. }
  325. return postMessageSupported ? ((token, callbacks) => {
  326. _global.addEventListener("message", ({ source, data }) => {
  327. if (source === _global && data === token) {
  328. callbacks.length && callbacks.shift()();
  329. }
  330. }, false);
  331. return (cb) => {
  332. callbacks.push(cb);
  333. _global.postMessage(token, "*");
  334. };
  335. })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
  336. })(
  337. typeof setImmediate === "function",
  338. isFunction(_global.postMessage)
  339. );
  340. const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
  341. const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
  342. const utils$1 = {
  343. isArray,
  344. isArrayBuffer,
  345. isBuffer,
  346. isFormData,
  347. isArrayBufferView,
  348. isString,
  349. isNumber,
  350. isBoolean,
  351. isObject,
  352. isPlainObject,
  353. isReadableStream,
  354. isRequest,
  355. isResponse,
  356. isHeaders,
  357. isUndefined,
  358. isDate,
  359. isFile,
  360. isBlob,
  361. isRegExp,
  362. isFunction,
  363. isStream,
  364. isURLSearchParams,
  365. isTypedArray,
  366. isFileList,
  367. forEach,
  368. merge,
  369. extend,
  370. trim,
  371. stripBOM,
  372. inherits,
  373. toFlatObject,
  374. kindOf,
  375. kindOfTest,
  376. endsWith,
  377. toArray,
  378. forEachEntry,
  379. matchAll,
  380. isHTMLForm,
  381. hasOwnProperty,
  382. hasOwnProp: hasOwnProperty,
  383. // an alias to avoid ESLint no-prototype-builtins detection
  384. reduceDescriptors,
  385. freezeMethods,
  386. toObjectSet,
  387. toCamelCase,
  388. noop,
  389. toFiniteNumber,
  390. findKey,
  391. global: _global,
  392. isContextDefined,
  393. isSpecCompliantForm,
  394. toJSONObject,
  395. isAsyncFn,
  396. isThenable,
  397. setImmediate: _setImmediate,
  398. asap,
  399. isIterable
  400. };
  401. function AxiosError$1(message, code, config, request, response) {
  402. Error.call(this);
  403. if (Error.captureStackTrace) {
  404. Error.captureStackTrace(this, this.constructor);
  405. } else {
  406. this.stack = new Error().stack;
  407. }
  408. this.message = message;
  409. this.name = "AxiosError";
  410. code && (this.code = code);
  411. config && (this.config = config);
  412. request && (this.request = request);
  413. if (response) {
  414. this.response = response;
  415. this.status = response.status ? response.status : null;
  416. }
  417. }
  418. utils$1.inherits(AxiosError$1, Error, {
  419. toJSON: function toJSON() {
  420. return {
  421. // Standard
  422. message: this.message,
  423. name: this.name,
  424. // Microsoft
  425. description: this.description,
  426. number: this.number,
  427. // Mozilla
  428. fileName: this.fileName,
  429. lineNumber: this.lineNumber,
  430. columnNumber: this.columnNumber,
  431. stack: this.stack,
  432. // Axios
  433. config: utils$1.toJSONObject(this.config),
  434. code: this.code,
  435. status: this.status
  436. };
  437. }
  438. });
  439. const prototype$1 = AxiosError$1.prototype;
  440. const descriptors = {};
  441. [
  442. "ERR_BAD_OPTION_VALUE",
  443. "ERR_BAD_OPTION",
  444. "ECONNABORTED",
  445. "ETIMEDOUT",
  446. "ERR_NETWORK",
  447. "ERR_FR_TOO_MANY_REDIRECTS",
  448. "ERR_DEPRECATED",
  449. "ERR_BAD_RESPONSE",
  450. "ERR_BAD_REQUEST",
  451. "ERR_CANCELED",
  452. "ERR_NOT_SUPPORT",
  453. "ERR_INVALID_URL"
  454. // eslint-disable-next-line func-names
  455. ].forEach((code) => {
  456. descriptors[code] = { value: code };
  457. });
  458. Object.defineProperties(AxiosError$1, descriptors);
  459. Object.defineProperty(prototype$1, "isAxiosError", { value: true });
  460. AxiosError$1.from = (error, code, config, request, response, customProps) => {
  461. const axiosError = Object.create(prototype$1);
  462. utils$1.toFlatObject(error, axiosError, function filter2(obj) {
  463. return obj !== Error.prototype;
  464. }, (prop) => {
  465. return prop !== "isAxiosError";
  466. });
  467. AxiosError$1.call(axiosError, error.message, code, config, request, response);
  468. axiosError.cause = error;
  469. axiosError.name = error.name;
  470. customProps && Object.assign(axiosError, customProps);
  471. return axiosError;
  472. };
  473. const httpAdapter = null;
  474. function isVisitable(thing) {
  475. return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
  476. }
  477. function removeBrackets(key) {
  478. return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
  479. }
  480. function renderKey(path, key, dots) {
  481. if (!path) return key;
  482. return path.concat(key).map(function each(token, i) {
  483. token = removeBrackets(token);
  484. return !dots && i ? "[" + token + "]" : token;
  485. }).join(dots ? "." : "");
  486. }
  487. function isFlatArray(arr) {
  488. return utils$1.isArray(arr) && !arr.some(isVisitable);
  489. }
  490. const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
  491. return /^is[A-Z]/.test(prop);
  492. });
  493. function toFormData$1(obj, formData, options) {
  494. if (!utils$1.isObject(obj)) {
  495. throw new TypeError("target must be an object");
  496. }
  497. formData = formData || new FormData();
  498. options = utils$1.toFlatObject(options, {
  499. metaTokens: true,
  500. dots: false,
  501. indexes: false
  502. }, false, function defined(option, source) {
  503. return !utils$1.isUndefined(source[option]);
  504. });
  505. const metaTokens = options.metaTokens;
  506. const visitor = options.visitor || defaultVisitor;
  507. const dots = options.dots;
  508. const indexes = options.indexes;
  509. const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
  510. const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
  511. if (!utils$1.isFunction(visitor)) {
  512. throw new TypeError("visitor must be a function");
  513. }
  514. function convertValue(value) {
  515. if (value === null) return "";
  516. if (utils$1.isDate(value)) {
  517. return value.toISOString();
  518. }
  519. if (!useBlob && utils$1.isBlob(value)) {
  520. throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
  521. }
  522. if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
  523. return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
  524. }
  525. return value;
  526. }
  527. function defaultVisitor(value, key, path) {
  528. let arr = value;
  529. if (value && !path && typeof value === "object") {
  530. if (utils$1.endsWith(key, "{}")) {
  531. key = metaTokens ? key : key.slice(0, -2);
  532. value = JSON.stringify(value);
  533. } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
  534. key = removeBrackets(key);
  535. arr.forEach(function each(el, index2) {
  536. !(utils$1.isUndefined(el) || el === null) && formData.append(
  537. // eslint-disable-next-line no-nested-ternary
  538. indexes === true ? renderKey([key], index2, dots) : indexes === null ? key : key + "[]",
  539. convertValue(el)
  540. );
  541. });
  542. return false;
  543. }
  544. }
  545. if (isVisitable(value)) {
  546. return true;
  547. }
  548. formData.append(renderKey(path, key, dots), convertValue(value));
  549. return false;
  550. }
  551. const stack = [];
  552. const exposedHelpers = Object.assign(predicates, {
  553. defaultVisitor,
  554. convertValue,
  555. isVisitable
  556. });
  557. function build(value, path) {
  558. if (utils$1.isUndefined(value)) return;
  559. if (stack.indexOf(value) !== -1) {
  560. throw Error("Circular reference detected in " + path.join("."));
  561. }
  562. stack.push(value);
  563. utils$1.forEach(value, function each(el, key) {
  564. const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
  565. formData,
  566. el,
  567. utils$1.isString(key) ? key.trim() : key,
  568. path,
  569. exposedHelpers
  570. );
  571. if (result === true) {
  572. build(el, path ? path.concat(key) : [key]);
  573. }
  574. });
  575. stack.pop();
  576. }
  577. if (!utils$1.isObject(obj)) {
  578. throw new TypeError("data must be an object");
  579. }
  580. build(obj);
  581. return formData;
  582. }
  583. function encode$1(str) {
  584. const charMap = {
  585. "!": "%21",
  586. "'": "%27",
  587. "(": "%28",
  588. ")": "%29",
  589. "~": "%7E",
  590. "%20": "+",
  591. "%00": "\0"
  592. };
  593. return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
  594. return charMap[match];
  595. });
  596. }
  597. function AxiosURLSearchParams(params, options) {
  598. this._pairs = [];
  599. params && toFormData$1(params, this, options);
  600. }
  601. const prototype = AxiosURLSearchParams.prototype;
  602. prototype.append = function append(name, value) {
  603. this._pairs.push([name, value]);
  604. };
  605. prototype.toString = function toString2(encoder) {
  606. const _encode = encoder ? function(value) {
  607. return encoder.call(this, value, encode$1);
  608. } : encode$1;
  609. return this._pairs.map(function each(pair) {
  610. return _encode(pair[0]) + "=" + _encode(pair[1]);
  611. }, "").join("&");
  612. };
  613. function encode(val) {
  614. return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
  615. }
  616. function buildURL(url, params, options) {
  617. if (!params) {
  618. return url;
  619. }
  620. const _encode = options && options.encode || encode;
  621. if (utils$1.isFunction(options)) {
  622. options = {
  623. serialize: options
  624. };
  625. }
  626. const serializeFn = options && options.serialize;
  627. let serializedParams;
  628. if (serializeFn) {
  629. serializedParams = serializeFn(params, options);
  630. } else {
  631. serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
  632. }
  633. if (serializedParams) {
  634. const hashmarkIndex = url.indexOf("#");
  635. if (hashmarkIndex !== -1) {
  636. url = url.slice(0, hashmarkIndex);
  637. }
  638. url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
  639. }
  640. return url;
  641. }
  642. class InterceptorManager {
  643. constructor() {
  644. this.handlers = [];
  645. }
  646. /**
  647. * Add a new interceptor to the stack
  648. *
  649. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  650. * @param {Function} rejected The function to handle `reject` for a `Promise`
  651. *
  652. * @return {Number} An ID used to remove interceptor later
  653. */
  654. use(fulfilled, rejected, options) {
  655. this.handlers.push({
  656. fulfilled,
  657. rejected,
  658. synchronous: options ? options.synchronous : false,
  659. runWhen: options ? options.runWhen : null
  660. });
  661. return this.handlers.length - 1;
  662. }
  663. /**
  664. * Remove an interceptor from the stack
  665. *
  666. * @param {Number} id The ID that was returned by `use`
  667. *
  668. * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
  669. */
  670. eject(id2) {
  671. if (this.handlers[id2]) {
  672. this.handlers[id2] = null;
  673. }
  674. }
  675. /**
  676. * Clear all interceptors from the stack
  677. *
  678. * @returns {void}
  679. */
  680. clear() {
  681. if (this.handlers) {
  682. this.handlers = [];
  683. }
  684. }
  685. /**
  686. * Iterate over all the registered interceptors
  687. *
  688. * This method is particularly useful for skipping over any
  689. * interceptors that may have become `null` calling `eject`.
  690. *
  691. * @param {Function} fn The function to call for each interceptor
  692. *
  693. * @returns {void}
  694. */
  695. forEach(fn) {
  696. utils$1.forEach(this.handlers, function forEachHandler(h) {
  697. if (h !== null) {
  698. fn(h);
  699. }
  700. });
  701. }
  702. }
  703. const transitionalDefaults = {
  704. silentJSONParsing: true,
  705. forcedJSONParsing: true,
  706. clarifyTimeoutError: false
  707. };
  708. const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
  709. const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
  710. const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
  711. const platform$1 = {
  712. isBrowser: true,
  713. classes: {
  714. URLSearchParams: URLSearchParams$1,
  715. FormData: FormData$1,
  716. Blob: Blob$1
  717. },
  718. protocols: ["http", "https", "file", "blob", "url", "data"]
  719. };
  720. const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
  721. const _navigator = typeof navigator === "object" && navigator || void 0;
  722. const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
  723. const hasStandardBrowserWebWorkerEnv = (() => {
  724. return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
  725. self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
  726. })();
  727. const origin = hasBrowserEnv && window.location.href || "http://localhost";
  728. const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, hasBrowserEnv, hasStandardBrowserEnv, hasStandardBrowserWebWorkerEnv, navigator: _navigator, origin }, Symbol.toStringTag, { value: "Module" }));
  729. const platform = {
  730. ...utils,
  731. ...platform$1
  732. };
  733. function toURLEncodedForm(data, options) {
  734. return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({
  735. visitor: function(value, key, path, helpers) {
  736. if (platform.isNode && utils$1.isBuffer(value)) {
  737. this.append(key, value.toString("base64"));
  738. return false;
  739. }
  740. return helpers.defaultVisitor.apply(this, arguments);
  741. }
  742. }, options));
  743. }
  744. function parsePropPath(name) {
  745. return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
  746. return match[0] === "[]" ? "" : match[1] || match[0];
  747. });
  748. }
  749. function arrayToObject(arr) {
  750. const obj = {};
  751. const keys = Object.keys(arr);
  752. let i;
  753. const len = keys.length;
  754. let key;
  755. for (i = 0; i < len; i++) {
  756. key = keys[i];
  757. obj[key] = arr[key];
  758. }
  759. return obj;
  760. }
  761. function formDataToJSON(formData) {
  762. function buildPath(path, value, target, index2) {
  763. let name = path[index2++];
  764. if (name === "__proto__") return true;
  765. const isNumericKey = Number.isFinite(+name);
  766. const isLast = index2 >= path.length;
  767. name = !name && utils$1.isArray(target) ? target.length : name;
  768. if (isLast) {
  769. if (utils$1.hasOwnProp(target, name)) {
  770. target[name] = [target[name], value];
  771. } else {
  772. target[name] = value;
  773. }
  774. return !isNumericKey;
  775. }
  776. if (!target[name] || !utils$1.isObject(target[name])) {
  777. target[name] = [];
  778. }
  779. const result = buildPath(path, value, target[name], index2);
  780. if (result && utils$1.isArray(target[name])) {
  781. target[name] = arrayToObject(target[name]);
  782. }
  783. return !isNumericKey;
  784. }
  785. if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
  786. const obj = {};
  787. utils$1.forEachEntry(formData, (name, value) => {
  788. buildPath(parsePropPath(name), value, obj, 0);
  789. });
  790. return obj;
  791. }
  792. return null;
  793. }
  794. function stringifySafely(rawValue, parser, encoder) {
  795. if (utils$1.isString(rawValue)) {
  796. try {
  797. (parser || JSON.parse)(rawValue);
  798. return utils$1.trim(rawValue);
  799. } catch (e) {
  800. if (e.name !== "SyntaxError") {
  801. throw e;
  802. }
  803. }
  804. }
  805. return (encoder || JSON.stringify)(rawValue);
  806. }
  807. const defaults = {
  808. transitional: transitionalDefaults,
  809. adapter: ["xhr", "http", "fetch"],
  810. transformRequest: [function transformRequest(data, headers) {
  811. const contentType = headers.getContentType() || "";
  812. const hasJSONContentType = contentType.indexOf("application/json") > -1;
  813. const isObjectPayload = utils$1.isObject(data);
  814. if (isObjectPayload && utils$1.isHTMLForm(data)) {
  815. data = new FormData(data);
  816. }
  817. const isFormData2 = utils$1.isFormData(data);
  818. if (isFormData2) {
  819. return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
  820. }
  821. if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
  822. return data;
  823. }
  824. if (utils$1.isArrayBufferView(data)) {
  825. return data.buffer;
  826. }
  827. if (utils$1.isURLSearchParams(data)) {
  828. headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
  829. return data.toString();
  830. }
  831. let isFileList2;
  832. if (isObjectPayload) {
  833. if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
  834. return toURLEncodedForm(data, this.formSerializer).toString();
  835. }
  836. if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
  837. const _FormData = this.env && this.env.FormData;
  838. return toFormData$1(
  839. isFileList2 ? { "files[]": data } : data,
  840. _FormData && new _FormData(),
  841. this.formSerializer
  842. );
  843. }
  844. }
  845. if (isObjectPayload || hasJSONContentType) {
  846. headers.setContentType("application/json", false);
  847. return stringifySafely(data);
  848. }
  849. return data;
  850. }],
  851. transformResponse: [function transformResponse(data) {
  852. const transitional2 = this.transitional || defaults.transitional;
  853. const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
  854. const JSONRequested = this.responseType === "json";
  855. if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
  856. return data;
  857. }
  858. if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
  859. const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
  860. const strictJSONParsing = !silentJSONParsing && JSONRequested;
  861. try {
  862. return JSON.parse(data);
  863. } catch (e) {
  864. if (strictJSONParsing) {
  865. if (e.name === "SyntaxError") {
  866. throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
  867. }
  868. throw e;
  869. }
  870. }
  871. }
  872. return data;
  873. }],
  874. /**
  875. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  876. * timeout is not created.
  877. */
  878. timeout: 0,
  879. xsrfCookieName: "XSRF-TOKEN",
  880. xsrfHeaderName: "X-XSRF-TOKEN",
  881. maxContentLength: -1,
  882. maxBodyLength: -1,
  883. env: {
  884. FormData: platform.classes.FormData,
  885. Blob: platform.classes.Blob
  886. },
  887. validateStatus: function validateStatus(status) {
  888. return status >= 200 && status < 300;
  889. },
  890. headers: {
  891. common: {
  892. "Accept": "application/json, text/plain, */*",
  893. "Content-Type": void 0
  894. }
  895. }
  896. };
  897. utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
  898. defaults.headers[method] = {};
  899. });
  900. const ignoreDuplicateOf = utils$1.toObjectSet([
  901. "age",
  902. "authorization",
  903. "content-length",
  904. "content-type",
  905. "etag",
  906. "expires",
  907. "from",
  908. "host",
  909. "if-modified-since",
  910. "if-unmodified-since",
  911. "last-modified",
  912. "location",
  913. "max-forwards",
  914. "proxy-authorization",
  915. "referer",
  916. "retry-after",
  917. "user-agent"
  918. ]);
  919. const parseHeaders = (rawHeaders) => {
  920. const parsed = {};
  921. let key;
  922. let val;
  923. let i;
  924. rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
  925. i = line.indexOf(":");
  926. key = line.substring(0, i).trim().toLowerCase();
  927. val = line.substring(i + 1).trim();
  928. if (!key || parsed[key] && ignoreDuplicateOf[key]) {
  929. return;
  930. }
  931. if (key === "set-cookie") {
  932. if (parsed[key]) {
  933. parsed[key].push(val);
  934. } else {
  935. parsed[key] = [val];
  936. }
  937. } else {
  938. parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
  939. }
  940. });
  941. return parsed;
  942. };
  943. const $internals = Symbol("internals");
  944. function normalizeHeader(header) {
  945. return header && String(header).trim().toLowerCase();
  946. }
  947. function normalizeValue(value) {
  948. if (value === false || value == null) {
  949. return value;
  950. }
  951. return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
  952. }
  953. function parseTokens(str) {
  954. const tokens2 = /* @__PURE__ */ Object.create(null);
  955. const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
  956. let match;
  957. while (match = tokensRE.exec(str)) {
  958. tokens2[match[1]] = match[2];
  959. }
  960. return tokens2;
  961. }
  962. const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
  963. function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
  964. if (utils$1.isFunction(filter2)) {
  965. return filter2.call(this, value, header);
  966. }
  967. if (isHeaderNameFilter) {
  968. value = header;
  969. }
  970. if (!utils$1.isString(value)) return;
  971. if (utils$1.isString(filter2)) {
  972. return value.indexOf(filter2) !== -1;
  973. }
  974. if (utils$1.isRegExp(filter2)) {
  975. return filter2.test(value);
  976. }
  977. }
  978. function formatHeader(header) {
  979. return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
  980. return char.toUpperCase() + str;
  981. });
  982. }
  983. function buildAccessors(obj, header) {
  984. const accessorName = utils$1.toCamelCase(" " + header);
  985. ["get", "set", "has"].forEach((methodName) => {
  986. Object.defineProperty(obj, methodName + accessorName, {
  987. value: function(arg1, arg2, arg3) {
  988. return this[methodName].call(this, header, arg1, arg2, arg3);
  989. },
  990. configurable: true
  991. });
  992. });
  993. }
  994. let AxiosHeaders$1 = class AxiosHeaders2 {
  995. constructor(headers) {
  996. headers && this.set(headers);
  997. }
  998. set(header, valueOrRewrite, rewrite) {
  999. const self2 = this;
  1000. function setHeader(_value, _header, _rewrite) {
  1001. const lHeader = normalizeHeader(_header);
  1002. if (!lHeader) {
  1003. throw new Error("header name must be a non-empty string");
  1004. }
  1005. const key = utils$1.findKey(self2, lHeader);
  1006. if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
  1007. self2[key || _header] = normalizeValue(_value);
  1008. }
  1009. }
  1010. const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
  1011. if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
  1012. setHeaders(header, valueOrRewrite);
  1013. } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
  1014. setHeaders(parseHeaders(header), valueOrRewrite);
  1015. } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
  1016. let obj = {}, dest, key;
  1017. for (const entry of header) {
  1018. if (!utils$1.isArray(entry)) {
  1019. throw TypeError("Object iterator must return a key-value pair");
  1020. }
  1021. obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
  1022. }
  1023. setHeaders(obj, valueOrRewrite);
  1024. } else {
  1025. header != null && setHeader(valueOrRewrite, header, rewrite);
  1026. }
  1027. return this;
  1028. }
  1029. get(header, parser) {
  1030. header = normalizeHeader(header);
  1031. if (header) {
  1032. const key = utils$1.findKey(this, header);
  1033. if (key) {
  1034. const value = this[key];
  1035. if (!parser) {
  1036. return value;
  1037. }
  1038. if (parser === true) {
  1039. return parseTokens(value);
  1040. }
  1041. if (utils$1.isFunction(parser)) {
  1042. return parser.call(this, value, key);
  1043. }
  1044. if (utils$1.isRegExp(parser)) {
  1045. return parser.exec(value);
  1046. }
  1047. throw new TypeError("parser must be boolean|regexp|function");
  1048. }
  1049. }
  1050. }
  1051. has(header, matcher) {
  1052. header = normalizeHeader(header);
  1053. if (header) {
  1054. const key = utils$1.findKey(this, header);
  1055. return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
  1056. }
  1057. return false;
  1058. }
  1059. delete(header, matcher) {
  1060. const self2 = this;
  1061. let deleted = false;
  1062. function deleteHeader(_header) {
  1063. _header = normalizeHeader(_header);
  1064. if (_header) {
  1065. const key = utils$1.findKey(self2, _header);
  1066. if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
  1067. delete self2[key];
  1068. deleted = true;
  1069. }
  1070. }
  1071. }
  1072. if (utils$1.isArray(header)) {
  1073. header.forEach(deleteHeader);
  1074. } else {
  1075. deleteHeader(header);
  1076. }
  1077. return deleted;
  1078. }
  1079. clear(matcher) {
  1080. const keys = Object.keys(this);
  1081. let i = keys.length;
  1082. let deleted = false;
  1083. while (i--) {
  1084. const key = keys[i];
  1085. if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
  1086. delete this[key];
  1087. deleted = true;
  1088. }
  1089. }
  1090. return deleted;
  1091. }
  1092. normalize(format) {
  1093. const self2 = this;
  1094. const headers = {};
  1095. utils$1.forEach(this, (value, header) => {
  1096. const key = utils$1.findKey(headers, header);
  1097. if (key) {
  1098. self2[key] = normalizeValue(value);
  1099. delete self2[header];
  1100. return;
  1101. }
  1102. const normalized = format ? formatHeader(header) : String(header).trim();
  1103. if (normalized !== header) {
  1104. delete self2[header];
  1105. }
  1106. self2[normalized] = normalizeValue(value);
  1107. headers[normalized] = true;
  1108. });
  1109. return this;
  1110. }
  1111. concat(...targets) {
  1112. return this.constructor.concat(this, ...targets);
  1113. }
  1114. toJSON(asStrings) {
  1115. const obj = /* @__PURE__ */ Object.create(null);
  1116. utils$1.forEach(this, (value, header) => {
  1117. value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value);
  1118. });
  1119. return obj;
  1120. }
  1121. [Symbol.iterator]() {
  1122. return Object.entries(this.toJSON())[Symbol.iterator]();
  1123. }
  1124. toString() {
  1125. return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
  1126. }
  1127. getSetCookie() {
  1128. return this.get("set-cookie") || [];
  1129. }
  1130. get [Symbol.toStringTag]() {
  1131. return "AxiosHeaders";
  1132. }
  1133. static from(thing) {
  1134. return thing instanceof this ? thing : new this(thing);
  1135. }
  1136. static concat(first, ...targets) {
  1137. const computed = new this(first);
  1138. targets.forEach((target) => computed.set(target));
  1139. return computed;
  1140. }
  1141. static accessor(header) {
  1142. const internals = this[$internals] = this[$internals] = {
  1143. accessors: {}
  1144. };
  1145. const accessors = internals.accessors;
  1146. const prototype2 = this.prototype;
  1147. function defineAccessor(_header) {
  1148. const lHeader = normalizeHeader(_header);
  1149. if (!accessors[lHeader]) {
  1150. buildAccessors(prototype2, _header);
  1151. accessors[lHeader] = true;
  1152. }
  1153. }
  1154. utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
  1155. return this;
  1156. }
  1157. };
  1158. AxiosHeaders$1.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
  1159. utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
  1160. let mapped = key[0].toUpperCase() + key.slice(1);
  1161. return {
  1162. get: () => value,
  1163. set(headerValue) {
  1164. this[mapped] = headerValue;
  1165. }
  1166. };
  1167. });
  1168. utils$1.freezeMethods(AxiosHeaders$1);
  1169. function transformData(fns, response) {
  1170. const config = this || defaults;
  1171. const context = response || config;
  1172. const headers = AxiosHeaders$1.from(context.headers);
  1173. let data = context.data;
  1174. utils$1.forEach(fns, function transform(fn) {
  1175. data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
  1176. });
  1177. headers.normalize();
  1178. return data;
  1179. }
  1180. function isCancel$1(value) {
  1181. return !!(value && value.__CANCEL__);
  1182. }
  1183. function CanceledError$1(message, config, request) {
  1184. AxiosError$1.call(this, message == null ? "canceled" : message, AxiosError$1.ERR_CANCELED, config, request);
  1185. this.name = "CanceledError";
  1186. }
  1187. utils$1.inherits(CanceledError$1, AxiosError$1, {
  1188. __CANCEL__: true
  1189. });
  1190. function settle(resolve, reject, response) {
  1191. const validateStatus2 = response.config.validateStatus;
  1192. if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
  1193. resolve(response);
  1194. } else {
  1195. reject(new AxiosError$1(
  1196. "Request failed with status code " + response.status,
  1197. [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
  1198. response.config,
  1199. response.request,
  1200. response
  1201. ));
  1202. }
  1203. }
  1204. function parseProtocol(url) {
  1205. const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
  1206. return match && match[1] || "";
  1207. }
  1208. function speedometer(samplesCount, min) {
  1209. samplesCount = samplesCount || 10;
  1210. const bytes = new Array(samplesCount);
  1211. const timestamps = new Array(samplesCount);
  1212. let head = 0;
  1213. let tail = 0;
  1214. let firstSampleTS;
  1215. min = min !== void 0 ? min : 1e3;
  1216. return function push(chunkLength) {
  1217. const now = Date.now();
  1218. const startedAt = timestamps[tail];
  1219. if (!firstSampleTS) {
  1220. firstSampleTS = now;
  1221. }
  1222. bytes[head] = chunkLength;
  1223. timestamps[head] = now;
  1224. let i = tail;
  1225. let bytesCount = 0;
  1226. while (i !== head) {
  1227. bytesCount += bytes[i++];
  1228. i = i % samplesCount;
  1229. }
  1230. head = (head + 1) % samplesCount;
  1231. if (head === tail) {
  1232. tail = (tail + 1) % samplesCount;
  1233. }
  1234. if (now - firstSampleTS < min) {
  1235. return;
  1236. }
  1237. const passed = startedAt && now - startedAt;
  1238. return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
  1239. };
  1240. }
  1241. function throttle(fn, freq) {
  1242. let timestamp = 0;
  1243. let threshold = 1e3 / freq;
  1244. let lastArgs;
  1245. let timer;
  1246. const invoke = (args2, now = Date.now()) => {
  1247. timestamp = now;
  1248. lastArgs = null;
  1249. if (timer) {
  1250. clearTimeout(timer);
  1251. timer = null;
  1252. }
  1253. fn.apply(null, args2);
  1254. };
  1255. const throttled = (...args2) => {
  1256. const now = Date.now();
  1257. const passed = now - timestamp;
  1258. if (passed >= threshold) {
  1259. invoke(args2, now);
  1260. } else {
  1261. lastArgs = args2;
  1262. if (!timer) {
  1263. timer = setTimeout(() => {
  1264. timer = null;
  1265. invoke(lastArgs);
  1266. }, threshold - passed);
  1267. }
  1268. }
  1269. };
  1270. const flush = () => lastArgs && invoke(lastArgs);
  1271. return [throttled, flush];
  1272. }
  1273. const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
  1274. let bytesNotified = 0;
  1275. const _speedometer = speedometer(50, 250);
  1276. return throttle((e) => {
  1277. const loaded = e.loaded;
  1278. const total = e.lengthComputable ? e.total : void 0;
  1279. const progressBytes = loaded - bytesNotified;
  1280. const rate = _speedometer(progressBytes);
  1281. const inRange = loaded <= total;
  1282. bytesNotified = loaded;
  1283. const data = {
  1284. loaded,
  1285. total,
  1286. progress: total ? loaded / total : void 0,
  1287. bytes: progressBytes,
  1288. rate: rate ? rate : void 0,
  1289. estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
  1290. event: e,
  1291. lengthComputable: total != null,
  1292. [isDownloadStream ? "download" : "upload"]: true
  1293. };
  1294. listener(data);
  1295. }, freq);
  1296. };
  1297. const progressEventDecorator = (total, throttled) => {
  1298. const lengthComputable = total != null;
  1299. return [(loaded) => throttled[0]({
  1300. lengthComputable,
  1301. total,
  1302. loaded
  1303. }), throttled[1]];
  1304. };
  1305. const asyncDecorator = (fn) => (...args2) => utils$1.asap(() => fn(...args2));
  1306. const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url) => {
  1307. url = new URL(url, platform.origin);
  1308. return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
  1309. })(
  1310. new URL(platform.origin),
  1311. platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
  1312. ) : () => true;
  1313. const cookies = platform.hasStandardBrowserEnv ? (
  1314. // Standard browser envs support document.cookie
  1315. {
  1316. write(name, value, expires, path, domain, secure) {
  1317. const cookie = [name + "=" + encodeURIComponent(value)];
  1318. utils$1.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString());
  1319. utils$1.isString(path) && cookie.push("path=" + path);
  1320. utils$1.isString(domain) && cookie.push("domain=" + domain);
  1321. secure === true && cookie.push("secure");
  1322. document.cookie = cookie.join("; ");
  1323. },
  1324. read(name) {
  1325. const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
  1326. return match ? decodeURIComponent(match[3]) : null;
  1327. },
  1328. remove(name) {
  1329. this.write(name, "", Date.now() - 864e5);
  1330. }
  1331. }
  1332. ) : (
  1333. // Non-standard browser env (web workers, react-native) lack needed support.
  1334. {
  1335. write() {
  1336. },
  1337. read() {
  1338. return null;
  1339. },
  1340. remove() {
  1341. }
  1342. }
  1343. );
  1344. function isAbsoluteURL(url) {
  1345. return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
  1346. }
  1347. function combineURLs(baseURL, relativeURL) {
  1348. return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
  1349. }
  1350. function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
  1351. let isRelativeUrl = !isAbsoluteURL(requestedURL);
  1352. if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
  1353. return combineURLs(baseURL, requestedURL);
  1354. }
  1355. return requestedURL;
  1356. }
  1357. const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
  1358. function mergeConfig$1(config1, config2) {
  1359. config2 = config2 || {};
  1360. const config = {};
  1361. function getMergedValue(target, source, prop, caseless) {
  1362. if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
  1363. return utils$1.merge.call({ caseless }, target, source);
  1364. } else if (utils$1.isPlainObject(source)) {
  1365. return utils$1.merge({}, source);
  1366. } else if (utils$1.isArray(source)) {
  1367. return source.slice();
  1368. }
  1369. return source;
  1370. }
  1371. function mergeDeepProperties(a, b, prop, caseless) {
  1372. if (!utils$1.isUndefined(b)) {
  1373. return getMergedValue(a, b, prop, caseless);
  1374. } else if (!utils$1.isUndefined(a)) {
  1375. return getMergedValue(void 0, a, prop, caseless);
  1376. }
  1377. }
  1378. function valueFromConfig2(a, b) {
  1379. if (!utils$1.isUndefined(b)) {
  1380. return getMergedValue(void 0, b);
  1381. }
  1382. }
  1383. function defaultToConfig2(a, b) {
  1384. if (!utils$1.isUndefined(b)) {
  1385. return getMergedValue(void 0, b);
  1386. } else if (!utils$1.isUndefined(a)) {
  1387. return getMergedValue(void 0, a);
  1388. }
  1389. }
  1390. function mergeDirectKeys(a, b, prop) {
  1391. if (prop in config2) {
  1392. return getMergedValue(a, b);
  1393. } else if (prop in config1) {
  1394. return getMergedValue(void 0, a);
  1395. }
  1396. }
  1397. const mergeMap = {
  1398. url: valueFromConfig2,
  1399. method: valueFromConfig2,
  1400. data: valueFromConfig2,
  1401. baseURL: defaultToConfig2,
  1402. transformRequest: defaultToConfig2,
  1403. transformResponse: defaultToConfig2,
  1404. paramsSerializer: defaultToConfig2,
  1405. timeout: defaultToConfig2,
  1406. timeoutMessage: defaultToConfig2,
  1407. withCredentials: defaultToConfig2,
  1408. withXSRFToken: defaultToConfig2,
  1409. adapter: defaultToConfig2,
  1410. responseType: defaultToConfig2,
  1411. xsrfCookieName: defaultToConfig2,
  1412. xsrfHeaderName: defaultToConfig2,
  1413. onUploadProgress: defaultToConfig2,
  1414. onDownloadProgress: defaultToConfig2,
  1415. decompress: defaultToConfig2,
  1416. maxContentLength: defaultToConfig2,
  1417. maxBodyLength: defaultToConfig2,
  1418. beforeRedirect: defaultToConfig2,
  1419. transport: defaultToConfig2,
  1420. httpAgent: defaultToConfig2,
  1421. httpsAgent: defaultToConfig2,
  1422. cancelToken: defaultToConfig2,
  1423. socketPath: defaultToConfig2,
  1424. responseEncoding: defaultToConfig2,
  1425. validateStatus: mergeDirectKeys,
  1426. headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
  1427. };
  1428. utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
  1429. const merge2 = mergeMap[prop] || mergeDeepProperties;
  1430. const configValue = merge2(config1[prop], config2[prop], prop);
  1431. utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
  1432. });
  1433. return config;
  1434. }
  1435. const resolveConfig = (config) => {
  1436. const newConfig = mergeConfig$1({}, config);
  1437. let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
  1438. newConfig.headers = headers = AxiosHeaders$1.from(headers);
  1439. newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
  1440. if (auth) {
  1441. headers.set(
  1442. "Authorization",
  1443. "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
  1444. );
  1445. }
  1446. let contentType;
  1447. if (utils$1.isFormData(data)) {
  1448. if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
  1449. headers.setContentType(void 0);
  1450. } else if ((contentType = headers.getContentType()) !== false) {
  1451. const [type, ...tokens2] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : [];
  1452. headers.setContentType([type || "multipart/form-data", ...tokens2].join("; "));
  1453. }
  1454. }
  1455. if (platform.hasStandardBrowserEnv) {
  1456. withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
  1457. if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
  1458. const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
  1459. if (xsrfValue) {
  1460. headers.set(xsrfHeaderName, xsrfValue);
  1461. }
  1462. }
  1463. }
  1464. return newConfig;
  1465. };
  1466. const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
  1467. const xhrAdapter = isXHRAdapterSupported && function(config) {
  1468. return new Promise(function dispatchXhrRequest(resolve, reject) {
  1469. const _config = resolveConfig(config);
  1470. let requestData = _config.data;
  1471. const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
  1472. let { responseType, onUploadProgress, onDownloadProgress } = _config;
  1473. let onCanceled;
  1474. let uploadThrottled, downloadThrottled;
  1475. let flushUpload, flushDownload;
  1476. function done() {
  1477. flushUpload && flushUpload();
  1478. flushDownload && flushDownload();
  1479. _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
  1480. _config.signal && _config.signal.removeEventListener("abort", onCanceled);
  1481. }
  1482. let request = new XMLHttpRequest();
  1483. request.open(_config.method.toUpperCase(), _config.url, true);
  1484. request.timeout = _config.timeout;
  1485. function onloadend() {
  1486. if (!request) {
  1487. return;
  1488. }
  1489. const responseHeaders = AxiosHeaders$1.from(
  1490. "getAllResponseHeaders" in request && request.getAllResponseHeaders()
  1491. );
  1492. const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
  1493. const response = {
  1494. data: responseData,
  1495. status: request.status,
  1496. statusText: request.statusText,
  1497. headers: responseHeaders,
  1498. config,
  1499. request
  1500. };
  1501. settle(function _resolve(value) {
  1502. resolve(value);
  1503. done();
  1504. }, function _reject(err) {
  1505. reject(err);
  1506. done();
  1507. }, response);
  1508. request = null;
  1509. }
  1510. if ("onloadend" in request) {
  1511. request.onloadend = onloadend;
  1512. } else {
  1513. request.onreadystatechange = function handleLoad() {
  1514. if (!request || request.readyState !== 4) {
  1515. return;
  1516. }
  1517. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
  1518. return;
  1519. }
  1520. setTimeout(onloadend);
  1521. };
  1522. }
  1523. request.onabort = function handleAbort() {
  1524. if (!request) {
  1525. return;
  1526. }
  1527. reject(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, config, request));
  1528. request = null;
  1529. };
  1530. request.onerror = function handleError() {
  1531. reject(new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config, request));
  1532. request = null;
  1533. };
  1534. request.ontimeout = function handleTimeout() {
  1535. let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
  1536. const transitional2 = _config.transitional || transitionalDefaults;
  1537. if (_config.timeoutErrorMessage) {
  1538. timeoutErrorMessage = _config.timeoutErrorMessage;
  1539. }
  1540. reject(new AxiosError$1(
  1541. timeoutErrorMessage,
  1542. transitional2.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
  1543. config,
  1544. request
  1545. ));
  1546. request = null;
  1547. };
  1548. requestData === void 0 && requestHeaders.setContentType(null);
  1549. if ("setRequestHeader" in request) {
  1550. utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
  1551. request.setRequestHeader(key, val);
  1552. });
  1553. }
  1554. if (!utils$1.isUndefined(_config.withCredentials)) {
  1555. request.withCredentials = !!_config.withCredentials;
  1556. }
  1557. if (responseType && responseType !== "json") {
  1558. request.responseType = _config.responseType;
  1559. }
  1560. if (onDownloadProgress) {
  1561. [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
  1562. request.addEventListener("progress", downloadThrottled);
  1563. }
  1564. if (onUploadProgress && request.upload) {
  1565. [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
  1566. request.upload.addEventListener("progress", uploadThrottled);
  1567. request.upload.addEventListener("loadend", flushUpload);
  1568. }
  1569. if (_config.cancelToken || _config.signal) {
  1570. onCanceled = (cancel) => {
  1571. if (!request) {
  1572. return;
  1573. }
  1574. reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
  1575. request.abort();
  1576. request = null;
  1577. };
  1578. _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
  1579. if (_config.signal) {
  1580. _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
  1581. }
  1582. }
  1583. const protocol = parseProtocol(_config.url);
  1584. if (protocol && platform.protocols.indexOf(protocol) === -1) {
  1585. reject(new AxiosError$1("Unsupported protocol " + protocol + ":", AxiosError$1.ERR_BAD_REQUEST, config));
  1586. return;
  1587. }
  1588. request.send(requestData || null);
  1589. });
  1590. };
  1591. const composeSignals = (signals, timeout) => {
  1592. const { length } = signals = signals ? signals.filter(Boolean) : [];
  1593. if (timeout || length) {
  1594. let controller = new AbortController();
  1595. let aborted;
  1596. const onabort = function(reason) {
  1597. if (!aborted) {
  1598. aborted = true;
  1599. unsubscribe();
  1600. const err = reason instanceof Error ? reason : this.reason;
  1601. controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
  1602. }
  1603. };
  1604. let timer = timeout && setTimeout(() => {
  1605. timer = null;
  1606. onabort(new AxiosError$1(`timeout ${timeout} of ms exceeded`, AxiosError$1.ETIMEDOUT));
  1607. }, timeout);
  1608. const unsubscribe = () => {
  1609. if (signals) {
  1610. timer && clearTimeout(timer);
  1611. timer = null;
  1612. signals.forEach((signal2) => {
  1613. signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
  1614. });
  1615. signals = null;
  1616. }
  1617. };
  1618. signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
  1619. const { signal } = controller;
  1620. signal.unsubscribe = () => utils$1.asap(unsubscribe);
  1621. return signal;
  1622. }
  1623. };
  1624. const streamChunk = function* (chunk, chunkSize) {
  1625. let len = chunk.byteLength;
  1626. if (len < chunkSize) {
  1627. yield chunk;
  1628. return;
  1629. }
  1630. let pos = 0;
  1631. let end;
  1632. while (pos < len) {
  1633. end = pos + chunkSize;
  1634. yield chunk.slice(pos, end);
  1635. pos = end;
  1636. }
  1637. };
  1638. const readBytes = async function* (iterable, chunkSize) {
  1639. for await (const chunk of readStream(iterable)) {
  1640. yield* streamChunk(chunk, chunkSize);
  1641. }
  1642. };
  1643. const readStream = async function* (stream) {
  1644. if (stream[Symbol.asyncIterator]) {
  1645. yield* stream;
  1646. return;
  1647. }
  1648. const reader = stream.getReader();
  1649. try {
  1650. for (; ; ) {
  1651. const { done, value } = await reader.read();
  1652. if (done) {
  1653. break;
  1654. }
  1655. yield value;
  1656. }
  1657. } finally {
  1658. await reader.cancel();
  1659. }
  1660. };
  1661. const trackStream = (stream, chunkSize, onProgress, onFinish) => {
  1662. const iterator2 = readBytes(stream, chunkSize);
  1663. let bytes = 0;
  1664. let done;
  1665. let _onFinish = (e) => {
  1666. if (!done) {
  1667. done = true;
  1668. onFinish && onFinish(e);
  1669. }
  1670. };
  1671. return new ReadableStream({
  1672. async pull(controller) {
  1673. try {
  1674. const { done: done2, value } = await iterator2.next();
  1675. if (done2) {
  1676. _onFinish();
  1677. controller.close();
  1678. return;
  1679. }
  1680. let len = value.byteLength;
  1681. if (onProgress) {
  1682. let loadedBytes = bytes += len;
  1683. onProgress(loadedBytes);
  1684. }
  1685. controller.enqueue(new Uint8Array(value));
  1686. } catch (err) {
  1687. _onFinish(err);
  1688. throw err;
  1689. }
  1690. },
  1691. cancel(reason) {
  1692. _onFinish(reason);
  1693. return iterator2.return();
  1694. }
  1695. }, {
  1696. highWaterMark: 2
  1697. });
  1698. };
  1699. const isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
  1700. const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
  1701. const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Response(str).arrayBuffer()));
  1702. const test = (fn, ...args2) => {
  1703. try {
  1704. return !!fn(...args2);
  1705. } catch (e) {
  1706. return false;
  1707. }
  1708. };
  1709. const supportsRequestStream = isReadableStreamSupported && test(() => {
  1710. let duplexAccessed = false;
  1711. const hasContentType = new Request(platform.origin, {
  1712. body: new ReadableStream(),
  1713. method: "POST",
  1714. get duplex() {
  1715. duplexAccessed = true;
  1716. return "half";
  1717. }
  1718. }).headers.has("Content-Type");
  1719. return duplexAccessed && !hasContentType;
  1720. });
  1721. const DEFAULT_CHUNK_SIZE = 64 * 1024;
  1722. const supportsResponseStream = isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
  1723. const resolvers = {
  1724. stream: supportsResponseStream && ((res) => res.body)
  1725. };
  1726. isFetchSupported && ((res) => {
  1727. ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
  1728. !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res2) => res2[type]() : (_, config) => {
  1729. throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
  1730. });
  1731. });
  1732. })(new Response());
  1733. const getBodyLength = async (body) => {
  1734. if (body == null) {
  1735. return 0;
  1736. }
  1737. if (utils$1.isBlob(body)) {
  1738. return body.size;
  1739. }
  1740. if (utils$1.isSpecCompliantForm(body)) {
  1741. const _request = new Request(platform.origin, {
  1742. method: "POST",
  1743. body
  1744. });
  1745. return (await _request.arrayBuffer()).byteLength;
  1746. }
  1747. if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
  1748. return body.byteLength;
  1749. }
  1750. if (utils$1.isURLSearchParams(body)) {
  1751. body = body + "";
  1752. }
  1753. if (utils$1.isString(body)) {
  1754. return (await encodeText(body)).byteLength;
  1755. }
  1756. };
  1757. const resolveBodyLength = async (headers, body) => {
  1758. const length = utils$1.toFiniteNumber(headers.getContentLength());
  1759. return length == null ? getBodyLength(body) : length;
  1760. };
  1761. const fetchAdapter = isFetchSupported && (async (config) => {
  1762. let {
  1763. url,
  1764. method,
  1765. data,
  1766. signal,
  1767. cancelToken,
  1768. timeout,
  1769. onDownloadProgress,
  1770. onUploadProgress,
  1771. responseType,
  1772. headers,
  1773. withCredentials = "same-origin",
  1774. fetchOptions
  1775. } = resolveConfig(config);
  1776. responseType = responseType ? (responseType + "").toLowerCase() : "text";
  1777. let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
  1778. let request;
  1779. const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
  1780. composedSignal.unsubscribe();
  1781. });
  1782. let requestContentLength;
  1783. try {
  1784. if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
  1785. let _request = new Request(url, {
  1786. method: "POST",
  1787. body: data,
  1788. duplex: "half"
  1789. });
  1790. let contentTypeHeader;
  1791. if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
  1792. headers.setContentType(contentTypeHeader);
  1793. }
  1794. if (_request.body) {
  1795. const [onProgress, flush] = progressEventDecorator(
  1796. requestContentLength,
  1797. progressEventReducer(asyncDecorator(onUploadProgress))
  1798. );
  1799. data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
  1800. }
  1801. }
  1802. if (!utils$1.isString(withCredentials)) {
  1803. withCredentials = withCredentials ? "include" : "omit";
  1804. }
  1805. const isCredentialsSupported = "credentials" in Request.prototype;
  1806. request = new Request(url, {
  1807. ...fetchOptions,
  1808. signal: composedSignal,
  1809. method: method.toUpperCase(),
  1810. headers: headers.normalize().toJSON(),
  1811. body: data,
  1812. duplex: "half",
  1813. credentials: isCredentialsSupported ? withCredentials : void 0
  1814. });
  1815. let response = await fetch(request);
  1816. const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
  1817. if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
  1818. const options = {};
  1819. ["status", "statusText", "headers"].forEach((prop) => {
  1820. options[prop] = response[prop];
  1821. });
  1822. const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
  1823. const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
  1824. responseContentLength,
  1825. progressEventReducer(asyncDecorator(onDownloadProgress), true)
  1826. ) || [];
  1827. response = new Response(
  1828. trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
  1829. flush && flush();
  1830. unsubscribe && unsubscribe();
  1831. }),
  1832. options
  1833. );
  1834. }
  1835. responseType = responseType || "text";
  1836. let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config);
  1837. !isStreamResponse && unsubscribe && unsubscribe();
  1838. return await new Promise((resolve, reject) => {
  1839. settle(resolve, reject, {
  1840. data: responseData,
  1841. headers: AxiosHeaders$1.from(response.headers),
  1842. status: response.status,
  1843. statusText: response.statusText,
  1844. config,
  1845. request
  1846. });
  1847. });
  1848. } catch (err) {
  1849. unsubscribe && unsubscribe();
  1850. if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
  1851. throw Object.assign(
  1852. new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config, request),
  1853. {
  1854. cause: err.cause || err
  1855. }
  1856. );
  1857. }
  1858. throw AxiosError$1.from(err, err && err.code, config, request);
  1859. }
  1860. });
  1861. const knownAdapters = {
  1862. http: httpAdapter,
  1863. xhr: xhrAdapter,
  1864. fetch: fetchAdapter
  1865. };
  1866. utils$1.forEach(knownAdapters, (fn, value) => {
  1867. if (fn) {
  1868. try {
  1869. Object.defineProperty(fn, "name", { value });
  1870. } catch (e) {
  1871. }
  1872. Object.defineProperty(fn, "adapterName", { value });
  1873. }
  1874. });
  1875. const renderReason = (reason) => `- ${reason}`;
  1876. const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
  1877. const adapters = {
  1878. getAdapter: (adapters2) => {
  1879. adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
  1880. const { length } = adapters2;
  1881. let nameOrAdapter;
  1882. let adapter;
  1883. const rejectedReasons = {};
  1884. for (let i = 0; i < length; i++) {
  1885. nameOrAdapter = adapters2[i];
  1886. let id2;
  1887. adapter = nameOrAdapter;
  1888. if (!isResolvedHandle(nameOrAdapter)) {
  1889. adapter = knownAdapters[(id2 = String(nameOrAdapter)).toLowerCase()];
  1890. if (adapter === void 0) {
  1891. throw new AxiosError$1(`Unknown adapter '${id2}'`);
  1892. }
  1893. }
  1894. if (adapter) {
  1895. break;
  1896. }
  1897. rejectedReasons[id2 || "#" + i] = adapter;
  1898. }
  1899. if (!adapter) {
  1900. const reasons = Object.entries(rejectedReasons).map(
  1901. ([id2, state]) => `adapter ${id2} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
  1902. );
  1903. let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
  1904. throw new AxiosError$1(
  1905. `There is no suitable adapter to dispatch the request ` + s,
  1906. "ERR_NOT_SUPPORT"
  1907. );
  1908. }
  1909. return adapter;
  1910. },
  1911. adapters: knownAdapters
  1912. };
  1913. function throwIfCancellationRequested(config) {
  1914. if (config.cancelToken) {
  1915. config.cancelToken.throwIfRequested();
  1916. }
  1917. if (config.signal && config.signal.aborted) {
  1918. throw new CanceledError$1(null, config);
  1919. }
  1920. }
  1921. function dispatchRequest(config) {
  1922. throwIfCancellationRequested(config);
  1923. config.headers = AxiosHeaders$1.from(config.headers);
  1924. config.data = transformData.call(
  1925. config,
  1926. config.transformRequest
  1927. );
  1928. if (["post", "put", "patch"].indexOf(config.method) !== -1) {
  1929. config.headers.setContentType("application/x-www-form-urlencoded", false);
  1930. }
  1931. const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
  1932. return adapter(config).then(function onAdapterResolution(response) {
  1933. throwIfCancellationRequested(config);
  1934. response.data = transformData.call(
  1935. config,
  1936. config.transformResponse,
  1937. response
  1938. );
  1939. response.headers = AxiosHeaders$1.from(response.headers);
  1940. return response;
  1941. }, function onAdapterRejection(reason) {
  1942. if (!isCancel$1(reason)) {
  1943. throwIfCancellationRequested(config);
  1944. if (reason && reason.response) {
  1945. reason.response.data = transformData.call(
  1946. config,
  1947. config.transformResponse,
  1948. reason.response
  1949. );
  1950. reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
  1951. }
  1952. }
  1953. return Promise.reject(reason);
  1954. });
  1955. }
  1956. const VERSION$1 = "1.9.0";
  1957. const validators$1 = {};
  1958. ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
  1959. validators$1[type] = function validator2(thing) {
  1960. return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
  1961. };
  1962. });
  1963. const deprecatedWarnings = {};
  1964. validators$1.transitional = function transitional(validator2, version, message) {
  1965. function formatMessage(opt, desc) {
  1966. return "[Axios v" + VERSION$1 + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
  1967. }
  1968. return (value, opt, opts) => {
  1969. if (validator2 === false) {
  1970. throw new AxiosError$1(
  1971. formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
  1972. AxiosError$1.ERR_DEPRECATED
  1973. );
  1974. }
  1975. if (version && !deprecatedWarnings[opt]) {
  1976. deprecatedWarnings[opt] = true;
  1977. console.warn(
  1978. formatMessage(
  1979. opt,
  1980. " has been deprecated since v" + version + " and will be removed in the near future"
  1981. )
  1982. );
  1983. }
  1984. return validator2 ? validator2(value, opt, opts) : true;
  1985. };
  1986. };
  1987. validators$1.spelling = function spelling(correctSpelling) {
  1988. return (value, opt) => {
  1989. console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
  1990. return true;
  1991. };
  1992. };
  1993. function assertOptions(options, schema, allowUnknown) {
  1994. if (typeof options !== "object") {
  1995. throw new AxiosError$1("options must be an object", AxiosError$1.ERR_BAD_OPTION_VALUE);
  1996. }
  1997. const keys = Object.keys(options);
  1998. let i = keys.length;
  1999. while (i-- > 0) {
  2000. const opt = keys[i];
  2001. const validator2 = schema[opt];
  2002. if (validator2) {
  2003. const value = options[opt];
  2004. const result = value === void 0 || validator2(value, opt, options);
  2005. if (result !== true) {
  2006. throw new AxiosError$1("option " + opt + " must be " + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
  2007. }
  2008. continue;
  2009. }
  2010. if (allowUnknown !== true) {
  2011. throw new AxiosError$1("Unknown option " + opt, AxiosError$1.ERR_BAD_OPTION);
  2012. }
  2013. }
  2014. }
  2015. const validator = {
  2016. assertOptions,
  2017. validators: validators$1
  2018. };
  2019. const validators = validator.validators;
  2020. let Axios$1 = class Axios2 {
  2021. constructor(instanceConfig) {
  2022. this.defaults = instanceConfig || {};
  2023. this.interceptors = {
  2024. request: new InterceptorManager(),
  2025. response: new InterceptorManager()
  2026. };
  2027. }
  2028. /**
  2029. * Dispatch a request
  2030. *
  2031. * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
  2032. * @param {?Object} config
  2033. *
  2034. * @returns {Promise} The Promise to be fulfilled
  2035. */
  2036. async request(configOrUrl, config) {
  2037. try {
  2038. return await this._request(configOrUrl, config);
  2039. } catch (err) {
  2040. if (err instanceof Error) {
  2041. let dummy = {};
  2042. Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
  2043. const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
  2044. try {
  2045. if (!err.stack) {
  2046. err.stack = stack;
  2047. } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
  2048. err.stack += "\n" + stack;
  2049. }
  2050. } catch (e) {
  2051. }
  2052. }
  2053. throw err;
  2054. }
  2055. }
  2056. _request(configOrUrl, config) {
  2057. if (typeof configOrUrl === "string") {
  2058. config = config || {};
  2059. config.url = configOrUrl;
  2060. } else {
  2061. config = configOrUrl || {};
  2062. }
  2063. config = mergeConfig$1(this.defaults, config);
  2064. const { transitional: transitional2, paramsSerializer, headers } = config;
  2065. if (transitional2 !== void 0) {
  2066. validator.assertOptions(transitional2, {
  2067. silentJSONParsing: validators.transitional(validators.boolean),
  2068. forcedJSONParsing: validators.transitional(validators.boolean),
  2069. clarifyTimeoutError: validators.transitional(validators.boolean)
  2070. }, false);
  2071. }
  2072. if (paramsSerializer != null) {
  2073. if (utils$1.isFunction(paramsSerializer)) {
  2074. config.paramsSerializer = {
  2075. serialize: paramsSerializer
  2076. };
  2077. } else {
  2078. validator.assertOptions(paramsSerializer, {
  2079. encode: validators.function,
  2080. serialize: validators.function
  2081. }, true);
  2082. }
  2083. }
  2084. if (config.allowAbsoluteUrls !== void 0) ;
  2085. else if (this.defaults.allowAbsoluteUrls !== void 0) {
  2086. config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
  2087. } else {
  2088. config.allowAbsoluteUrls = true;
  2089. }
  2090. validator.assertOptions(config, {
  2091. baseUrl: validators.spelling("baseURL"),
  2092. withXsrfToken: validators.spelling("withXSRFToken")
  2093. }, true);
  2094. config.method = (config.method || this.defaults.method || "get").toLowerCase();
  2095. let contextHeaders = headers && utils$1.merge(
  2096. headers.common,
  2097. headers[config.method]
  2098. );
  2099. headers && utils$1.forEach(
  2100. ["delete", "get", "head", "post", "put", "patch", "common"],
  2101. (method) => {
  2102. delete headers[method];
  2103. }
  2104. );
  2105. config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
  2106. const requestInterceptorChain = [];
  2107. let synchronousRequestInterceptors = true;
  2108. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  2109. if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
  2110. return;
  2111. }
  2112. synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
  2113. requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
  2114. });
  2115. const responseInterceptorChain = [];
  2116. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  2117. responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
  2118. });
  2119. let promise;
  2120. let i = 0;
  2121. let len;
  2122. if (!synchronousRequestInterceptors) {
  2123. const chain = [dispatchRequest.bind(this), void 0];
  2124. chain.unshift.apply(chain, requestInterceptorChain);
  2125. chain.push.apply(chain, responseInterceptorChain);
  2126. len = chain.length;
  2127. promise = Promise.resolve(config);
  2128. while (i < len) {
  2129. promise = promise.then(chain[i++], chain[i++]);
  2130. }
  2131. return promise;
  2132. }
  2133. len = requestInterceptorChain.length;
  2134. let newConfig = config;
  2135. i = 0;
  2136. while (i < len) {
  2137. const onFulfilled = requestInterceptorChain[i++];
  2138. const onRejected = requestInterceptorChain[i++];
  2139. try {
  2140. newConfig = onFulfilled(newConfig);
  2141. } catch (error) {
  2142. onRejected.call(this, error);
  2143. break;
  2144. }
  2145. }
  2146. try {
  2147. promise = dispatchRequest.call(this, newConfig);
  2148. } catch (error) {
  2149. return Promise.reject(error);
  2150. }
  2151. i = 0;
  2152. len = responseInterceptorChain.length;
  2153. while (i < len) {
  2154. promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
  2155. }
  2156. return promise;
  2157. }
  2158. getUri(config) {
  2159. config = mergeConfig$1(this.defaults, config);
  2160. const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
  2161. return buildURL(fullPath, config.params, config.paramsSerializer);
  2162. }
  2163. };
  2164. utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
  2165. Axios$1.prototype[method] = function(url, config) {
  2166. return this.request(mergeConfig$1(config || {}, {
  2167. method,
  2168. url,
  2169. data: (config || {}).data
  2170. }));
  2171. };
  2172. });
  2173. utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
  2174. function generateHTTPMethod(isForm) {
  2175. return function httpMethod(url, data, config) {
  2176. return this.request(mergeConfig$1(config || {}, {
  2177. method,
  2178. headers: isForm ? {
  2179. "Content-Type": "multipart/form-data"
  2180. } : {},
  2181. url,
  2182. data
  2183. }));
  2184. };
  2185. }
  2186. Axios$1.prototype[method] = generateHTTPMethod();
  2187. Axios$1.prototype[method + "Form"] = generateHTTPMethod(true);
  2188. });
  2189. let CancelToken$1 = class CancelToken2 {
  2190. constructor(executor) {
  2191. if (typeof executor !== "function") {
  2192. throw new TypeError("executor must be a function.");
  2193. }
  2194. let resolvePromise;
  2195. this.promise = new Promise(function promiseExecutor(resolve) {
  2196. resolvePromise = resolve;
  2197. });
  2198. const token = this;
  2199. this.promise.then((cancel) => {
  2200. if (!token._listeners) return;
  2201. let i = token._listeners.length;
  2202. while (i-- > 0) {
  2203. token._listeners[i](cancel);
  2204. }
  2205. token._listeners = null;
  2206. });
  2207. this.promise.then = (onfulfilled) => {
  2208. let _resolve;
  2209. const promise = new Promise((resolve) => {
  2210. token.subscribe(resolve);
  2211. _resolve = resolve;
  2212. }).then(onfulfilled);
  2213. promise.cancel = function reject() {
  2214. token.unsubscribe(_resolve);
  2215. };
  2216. return promise;
  2217. };
  2218. executor(function cancel(message, config, request) {
  2219. if (token.reason) {
  2220. return;
  2221. }
  2222. token.reason = new CanceledError$1(message, config, request);
  2223. resolvePromise(token.reason);
  2224. });
  2225. }
  2226. /**
  2227. * Throws a `CanceledError` if cancellation has been requested.
  2228. */
  2229. throwIfRequested() {
  2230. if (this.reason) {
  2231. throw this.reason;
  2232. }
  2233. }
  2234. /**
  2235. * Subscribe to the cancel signal
  2236. */
  2237. subscribe(listener) {
  2238. if (this.reason) {
  2239. listener(this.reason);
  2240. return;
  2241. }
  2242. if (this._listeners) {
  2243. this._listeners.push(listener);
  2244. } else {
  2245. this._listeners = [listener];
  2246. }
  2247. }
  2248. /**
  2249. * Unsubscribe from the cancel signal
  2250. */
  2251. unsubscribe(listener) {
  2252. if (!this._listeners) {
  2253. return;
  2254. }
  2255. const index2 = this._listeners.indexOf(listener);
  2256. if (index2 !== -1) {
  2257. this._listeners.splice(index2, 1);
  2258. }
  2259. }
  2260. toAbortSignal() {
  2261. const controller = new AbortController();
  2262. const abort = (err) => {
  2263. controller.abort(err);
  2264. };
  2265. this.subscribe(abort);
  2266. controller.signal.unsubscribe = () => this.unsubscribe(abort);
  2267. return controller.signal;
  2268. }
  2269. /**
  2270. * Returns an object that contains a new `CancelToken` and a function that, when called,
  2271. * cancels the `CancelToken`.
  2272. */
  2273. static source() {
  2274. let cancel;
  2275. const token = new CancelToken2(function executor(c) {
  2276. cancel = c;
  2277. });
  2278. return {
  2279. token,
  2280. cancel
  2281. };
  2282. }
  2283. };
  2284. function spread$1(callback) {
  2285. return function wrap(arr) {
  2286. return callback.apply(null, arr);
  2287. };
  2288. }
  2289. function isAxiosError$1(payload) {
  2290. return utils$1.isObject(payload) && payload.isAxiosError === true;
  2291. }
  2292. const HttpStatusCode$1 = {
  2293. Continue: 100,
  2294. SwitchingProtocols: 101,
  2295. Processing: 102,
  2296. EarlyHints: 103,
  2297. Ok: 200,
  2298. Created: 201,
  2299. Accepted: 202,
  2300. NonAuthoritativeInformation: 203,
  2301. NoContent: 204,
  2302. ResetContent: 205,
  2303. PartialContent: 206,
  2304. MultiStatus: 207,
  2305. AlreadyReported: 208,
  2306. ImUsed: 226,
  2307. MultipleChoices: 300,
  2308. MovedPermanently: 301,
  2309. Found: 302,
  2310. SeeOther: 303,
  2311. NotModified: 304,
  2312. UseProxy: 305,
  2313. Unused: 306,
  2314. TemporaryRedirect: 307,
  2315. PermanentRedirect: 308,
  2316. BadRequest: 400,
  2317. Unauthorized: 401,
  2318. PaymentRequired: 402,
  2319. Forbidden: 403,
  2320. NotFound: 404,
  2321. MethodNotAllowed: 405,
  2322. NotAcceptable: 406,
  2323. ProxyAuthenticationRequired: 407,
  2324. RequestTimeout: 408,
  2325. Conflict: 409,
  2326. Gone: 410,
  2327. LengthRequired: 411,
  2328. PreconditionFailed: 412,
  2329. PayloadTooLarge: 413,
  2330. UriTooLong: 414,
  2331. UnsupportedMediaType: 415,
  2332. RangeNotSatisfiable: 416,
  2333. ExpectationFailed: 417,
  2334. ImATeapot: 418,
  2335. MisdirectedRequest: 421,
  2336. UnprocessableEntity: 422,
  2337. Locked: 423,
  2338. FailedDependency: 424,
  2339. TooEarly: 425,
  2340. UpgradeRequired: 426,
  2341. PreconditionRequired: 428,
  2342. TooManyRequests: 429,
  2343. RequestHeaderFieldsTooLarge: 431,
  2344. UnavailableForLegalReasons: 451,
  2345. InternalServerError: 500,
  2346. NotImplemented: 501,
  2347. BadGateway: 502,
  2348. ServiceUnavailable: 503,
  2349. GatewayTimeout: 504,
  2350. HttpVersionNotSupported: 505,
  2351. VariantAlsoNegotiates: 506,
  2352. InsufficientStorage: 507,
  2353. LoopDetected: 508,
  2354. NotExtended: 510,
  2355. NetworkAuthenticationRequired: 511
  2356. };
  2357. Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
  2358. HttpStatusCode$1[value] = key;
  2359. });
  2360. function createInstance(defaultConfig) {
  2361. const context = new Axios$1(defaultConfig);
  2362. const instance = bind(Axios$1.prototype.request, context);
  2363. utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
  2364. utils$1.extend(instance, context, null, { allOwnKeys: true });
  2365. instance.create = function create(instanceConfig) {
  2366. return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
  2367. };
  2368. return instance;
  2369. }
  2370. const axios = createInstance(defaults);
  2371. axios.Axios = Axios$1;
  2372. axios.CanceledError = CanceledError$1;
  2373. axios.CancelToken = CancelToken$1;
  2374. axios.isCancel = isCancel$1;
  2375. axios.VERSION = VERSION$1;
  2376. axios.toFormData = toFormData$1;
  2377. axios.AxiosError = AxiosError$1;
  2378. axios.Cancel = axios.CanceledError;
  2379. axios.all = function all2(promises) {
  2380. return Promise.all(promises);
  2381. };
  2382. axios.spread = spread$1;
  2383. axios.isAxiosError = isAxiosError$1;
  2384. axios.mergeConfig = mergeConfig$1;
  2385. axios.AxiosHeaders = AxiosHeaders$1;
  2386. axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
  2387. axios.getAdapter = adapters.getAdapter;
  2388. axios.HttpStatusCode = HttpStatusCode$1;
  2389. axios.default = axios;
  2390. const {
  2391. Axios,
  2392. AxiosError,
  2393. CanceledError,
  2394. isCancel,
  2395. CancelToken,
  2396. VERSION,
  2397. all,
  2398. Cancel,
  2399. isAxiosError,
  2400. spread,
  2401. toFormData,
  2402. AxiosHeaders,
  2403. HttpStatusCode,
  2404. formToJSON,
  2405. getAdapter,
  2406. mergeConfig
  2407. } = axios;
  2408. class Patcher {
  2409. constructor() {
  2410. __publicField(this, "blacklistedKeywords", ["cdn-cgi", "jquery", "jscolor"]);
  2411. __publicField(this, "patched", []);
  2412. __publicField(this, "observer");
  2413. }
  2414. start() {
  2415. console.log("Called Patcher.start()...");
  2416. this.observer = new MutationObserver((mutations) => {
  2417. mutations.forEach((mutation) => {
  2418. if (mutation.type === "childList" && mutation.addedNodes.length > 0) {
  2419. mutation.addedNodes.forEach(async (node) => {
  2420. if (node.tagName === "SCRIPT" && !this.blacklistedKeywords.some((k) => node.src.includes(k)) && node.src.includes(location.host) && !this.patched.includes(node.src)) {
  2421. console.log("MutationObserver Blocked script", node.src);
  2422. this.patched.push(node.src);
  2423. node.removeAttribute("src");
  2424. }
  2425. });
  2426. }
  2427. });
  2428. });
  2429. this.observer.observe(document.documentElement, {
  2430. childList: true,
  2431. subtree: true
  2432. });
  2433. [...document.querySelectorAll("script")].forEach((script) => {
  2434. if (!this.blacklistedKeywords.some((k) => script.src.includes(k)) && script.src.includes(location.host) && !this.patched.includes(script.src)) {
  2435. console.log("QuerySelector Blocked script", script.src);
  2436. this.patched.push(script.src);
  2437. script.removeAttribute("src");
  2438. }
  2439. });
  2440. }
  2441. async patch() {
  2442. if (!window.$) {
  2443. console.log("Called patch(), but jQuery was not detected. Waiting 100ms...");
  2444. return setTimeout(() => this.patch(), 100);
  2445. }
  2446. console.log("Detected jQuery! Disconnecting Observer & Patching...");
  2447. this.observer.disconnect();
  2448. this.patched.forEach(async (script) => {
  2449. try {
  2450. let { data } = await axios.get(script);
  2451. let filePatches = bb.patches.filter((e) => script.replace(location.origin, "").startsWith(e.file));
  2452. for (const patch of filePatches) for (const replacement of patch.replacement) {
  2453. if (replacement.setting && bb.plugins.settings[patch.plugin]?.[replacement.setting] === false) {
  2454. console.log("Setting", replacement.setting, "is not active, ignoring...");
  2455. continue;
  2456. } else if (replacement.setting) console.log("Setting", replacement.setting, "is active, applying...");
  2457. const matchRegex = new RegExp(replacement.match, "gm");
  2458. if (!matchRegex.test(data)) {
  2459. console.log(`Patch did nothing! Plugin: ${patch.plugin}; Regex: \`${replacement.match}\`.`);
  2460. continue;
  2461. }
  2462. ;
  2463. data = data.replaceAll(matchRegex, replacement.replace.replaceAll("$self", `bb.plugins.list.find(a => a.name === '${patch.plugin}')`));
  2464. }
  2465. ;
  2466. const url = URL.createObjectURL(new Blob([
  2467. `// ${script.replace(location.origin, "")}${filePatches.map((p) => p.replacement).flat().length >= 1 ? ` - Patched by ${filePatches.map((p) => p.plugin).join(", ")}` : ``}
  2468. `,
  2469. data
  2470. ]));
  2471. console.log(`Patched ${script.replace(location.origin, "")}!`);
  2472. let newScript = document.createElement("script");
  2473. newScript.src = url;
  2474. newScript.setAttribute("__nopatch", true);
  2475. newScript.setAttribute("__src", newScript);
  2476. document.head.appendChild(newScript);
  2477. } catch (error) {
  2478. console.error(`Error patching ${script}, ignoring file.`, error);
  2479. }
  2480. });
  2481. let activeStyles = Object.entries(bb.plugins.styles).filter((style) => bb.plugins.active.includes(style[0])).map((s) => s[1]);
  2482. document.head.insertAdjacentHTML("beforeend", `<style>${activeStyles.join("\n\n")}</style>`);
  2483. console.log("Finished Patcher.start() & plugin style injection!");
  2484. }
  2485. }
  2486. const patcher = new Patcher();
  2487. class Events {
  2488. constructor() {
  2489. __privateAdd(this, _subscriptions, /* @__PURE__ */ new Map());
  2490. __publicField(this, "listen", (event, callback) => {
  2491. console.log(`Listening to event '${event}'...`);
  2492. if (!__privateGet(this, _subscriptions).has(event)) __privateGet(this, _subscriptions).set(event, /* @__PURE__ */ new Set());
  2493. __privateGet(this, _subscriptions).get(event).add(callback);
  2494. });
  2495. __publicField(this, "dispatch", (event, payload) => {
  2496. console.log(`Dispatching event '${event}'...`);
  2497. if (__privateGet(this, _subscriptions).has(event))
  2498. __privateGet(this, _subscriptions).get(event).forEach((callback) => callback(payload));
  2499. });
  2500. }
  2501. }
  2502. _subscriptions = new WeakMap();
  2503. const events = new Events();
  2504. class Modal {
  2505. constructor({
  2506. title,
  2507. description,
  2508. inputs,
  2509. buttons,
  2510. autoClose = true
  2511. }) {
  2512. __publicField(this, "element");
  2513. __publicField(this, "autoClose");
  2514. __publicField(this, "listening");
  2515. __publicField(this, "listen", async () => {
  2516. this.listening = true;
  2517. return new Promise((resolve) => {
  2518. [...document.querySelectorAll('[id*="bb_modalButton-"]')].forEach((button) => {
  2519. button.addEventListener("click", () => {
  2520. resolve({
  2521. button: button.id.split("bb_modalButton-")[1],
  2522. inputs: [...document.querySelectorAll('[id*="bb_modalInput-"]')].map((a) => {
  2523. return {
  2524. name: a.placeholder,
  2525. value: a.value
  2526. };
  2527. })
  2528. });
  2529. if (this.autoClose) this.close();
  2530. });
  2531. });
  2532. });
  2533. });
  2534. __publicField(this, "close", () => this.element.remove());
  2535. if (document.querySelector("#modal")) return console.error("Cannot open more than one modal at once.");
  2536. document.body.insertAdjacentHTML("beforeend", `
  2537. <div class="arts__modal___VpEAD-camelCase" id="modal">
  2538. <form class="styles__container___1BPm9-camelCase">
  2539. <div class="styles__text___KSL4--camelCase">${title}</div>
  2540. ${description ? `<div class="bb_modalDescription">${description}</div>` : ""}
  2541. <div class="styles__holder___3CEfN-camelCase">
  2542. ${inputs ? `<div style="flex-direction: column;" class="styles__numRow___xh98F-camelCase">
  2543. ${inputs.map(({ placeholder }, i) => `
  2544. <div class="bb_modalOuterInput">
  2545. <input class="bb_modalInput" placeholder="${placeholder}" type="text" value="" id="${"bb_modalInput-" + i}" />
  2546. </div>
  2547. `).join("<br>")}
  2548. </div>` : ""}
  2549. ${buttons ? `<div class="styles__buttonContainer___2EaVD-camelCase">
  2550. ${buttons.map(({ text }, i) => `
  2551. <div class="styles__button___1_E-G-camelCase styles__button___3zpwV-camelCase" role="button" tabindex="0">
  2552. <div class="styles__shadow___3GMdH-camelCase"></div>
  2553. <div class="styles__edge___3eWfq-camelCase" style="background-color: #2f2f2f;"></div>
  2554. <div class="styles__front___vcvuy-camelCase styles__buttonInside___39vdp-camelCase" style="background-color: #2f2f2f;" id="${"bb_modalButton-" + i}">${text}</div>
  2555. </div>
  2556. `).join("")}
  2557. </div>` : ""}
  2558. </div>
  2559. </form>
  2560. </div>
  2561. `);
  2562. this.element = document.querySelector("#modal");
  2563. this.autoClose = autoClose;
  2564. [...document.querySelectorAll('[id*="bb_modalButton-"]')].forEach((b) => b.addEventListener("click", () => !this.listening ? this.close() : null));
  2565. }
  2566. }
  2567. class Storage {
  2568. constructor() {
  2569. __publicField(this, "storage", {});
  2570. __publicField(this, "refresh", () => {
  2571. Object.keys(localStorage).forEach((key) => delete localStorage[key]);
  2572. Object.entries(this.storage).forEach(([key, value]) => localStorage.setItem(key, value));
  2573. return this.storage;
  2574. });
  2575. __publicField(this, "get", (key, parse, fallback = null) => {
  2576. if (!this.storage[key]) return fallback;
  2577. if (parse) return JSON.parse(this.storage[key]);
  2578. return this.storage[key];
  2579. });
  2580. __publicField(this, "set", (key, value, stringify) => {
  2581. if (stringify) this.storage[key] = JSON.stringify(value);
  2582. else this.storage[key] = value;
  2583. return this.refresh();
  2584. });
  2585. Object.entries(localStorage).forEach(([key, value]) => this.storage[key] = value);
  2586. }
  2587. }
  2588. const storage = new Storage();
  2589. const loadThemes = async (single) => {
  2590. console.log("Called loadThemes()");
  2591. bb.themes.list = [];
  2592. bb.themes.broken = [];
  2593. [...document.querySelectorAll("[id*='bb-theme']")].forEach((v) => v.remove());
  2594. let themes = storage.get("bb_themeData", true).active.filter((a) => a.trim() !== "");
  2595. for (let theme of themes) axios.get(theme).then(async (res) => {
  2596. let data = res.data;
  2597. let meta = {};
  2598. const matches = data.match(/\/\*\*\s*\n([\s\S]*?)\*\//s)[1].split("\n");
  2599. if (matches) matches.forEach((input) => {
  2600. let match = /@(\w+)\s+([\s\S]+)/g.exec(input);
  2601. if (match) meta[match[1]] = match[2].trim();
  2602. });
  2603. else return bb.themes.broken.push({
  2604. url: theme,
  2605. reason: "Theme metadata could not be found."
  2606. });
  2607. const themeStyle = document.createElement("style");
  2608. themeStyle.id = `bb-theme-${btoa(Math.random().toString(36).slice(2))}`;
  2609. themeStyle.innerHTML = data;
  2610. bb.themes.list.push({
  2611. element: themeStyle,
  2612. name: meta.name,
  2613. meta,
  2614. url: theme
  2615. });
  2616. document.head.appendChild(themeStyle);
  2617. console.log(`Loaded theme "${meta.name}".`);
  2618. bb.events.dispatch("themeUpdate");
  2619. }).catch((err) => {
  2620. console.log("Failed to load theme: " + theme + " - ", err.message);
  2621. bb.themes.broken.push({
  2622. url: theme,
  2623. reason: "Theme could not be loaded."
  2624. });
  2625. bb.events.dispatch("themeUpdate");
  2626. });
  2627. if (single) console.log("Reloaded themes.");
  2628. else console.log("Finished initial theme load function.");
  2629. };
  2630. const createPlugin = ({
  2631. name,
  2632. description,
  2633. authors,
  2634. patches,
  2635. settings,
  2636. styles,
  2637. onLoad,
  2638. onStart,
  2639. required,
  2640. disabled,
  2641. ...custom
  2642. }) => {
  2643. if (!name || !authors?.length || !onLoad && !onStart && !patches && !styles) return console.error(`ERROR: Plugin does not have a title, authors, or executable functions.`);
  2644. let plugin = {
  2645. name,
  2646. description: description || "No description.",
  2647. authors,
  2648. patches: patches || [],
  2649. settings: settings || [],
  2650. styles: styles || ``,
  2651. onLoad: onLoad || (() => {
  2652. }),
  2653. onStart: onStart || (() => {
  2654. }),
  2655. required: required || false,
  2656. disabled: disabled || false,
  2657. ...custom
  2658. };
  2659. return plugin;
  2660. };
  2661. const index$l = () => createPlugin({
  2662. name: "Advanced Opener",
  2663. description: "the fastest way to mass open blacket packs.",
  2664. authors: [
  2665. { name: "Syfe", avatar: "https://i.imgur.com/OKpOipQ.gif", url: "https://github.com/ItsSyfe" },
  2666. { name: "Death", avatar: "https://i.imgur.com/PrvNWub.png", url: "https://villainsrule.xyz" }
  2667. ],
  2668. styles: `
  2669. .bb_openModal {
  2670. font-family: "Nunito", sans-serif;
  2671. font-size: 1vw;
  2672. height: 40vw;
  2673. width: 22vw;
  2674. border: 3px solid #262626;
  2675. background: #2f2f2f;
  2676. position: absolute;
  2677. bottom: 1vw;
  2678. right: 1vw;
  2679. border-radius: 7.5px;
  2680. text-align: center;
  2681. color: white;
  2682. overflow: auto;
  2683. padding: 2vw;
  2684. }
  2685.  
  2686. .bb_openIcons {
  2687. position: absolute;
  2688. right: 1vw;
  2689. top: 1vw;
  2690. font-size: 1.5vw;
  2691. }
  2692.  
  2693. .bb_openIcon {
  2694. cursor: pointer;
  2695. }
  2696.  
  2697. .bb_openTitle {
  2698. font-size: 2vw;
  2699. font-weight: 1000;
  2700. }
  2701.  
  2702. .bb_openedCount {
  2703. font-weight: 800;
  2704. font-size: 1.5vw;
  2705. margin-top: 1vw;
  2706. padding-bottom: 1vw;
  2707. }
  2708.  
  2709. .bb_opened {
  2710. margin-top: 1.5vw;
  2711. height: 27vw;
  2712. overflow: auto;
  2713. -ms-overflow-style: none;
  2714. scrollbar-width: none;
  2715. }
  2716.  
  2717. .bb_opened::-webkit-scrollbar {
  2718. display: none;
  2719. }
  2720.  
  2721. .bb_openResult {
  2722. font-size: 1.55vw;
  2723. margin-top: 0.5vw;
  2724. font-weight: 600;
  2725. }
  2726.  
  2727. .bb_openButtons {
  2728. position: absolute;
  2729. bottom: 1.25vw;
  2730. display: flex;
  2731. align-items: center;
  2732. width: calc(100% - 4vw);
  2733. }
  2734.  
  2735. .bb_openButton {
  2736. font-size: 1.8vw;
  2737. cursor: pointer;
  2738. width: 100%;
  2739. height: 2.6vw;
  2740. border: 4px solid white;
  2741. border-radius: 0.4vw;
  2742. display: flex;
  2743. justify-content: center;
  2744. align-items: center;
  2745. }
  2746. `,
  2747. onStart: () => {
  2748. if (!location.pathname.startsWith("/market")) return;
  2749. bb.plugins.massopen = {};
  2750. bb.plugins.massopen.start = async () => {
  2751. let packModal = new bb.Modal({
  2752. title: "Mass Open",
  2753. inputs: [{ placeholder: "Pack" }],
  2754. buttons: [{ text: "Next" }, { text: "Cancel" }]
  2755. });
  2756. let packResponse = await packModal.listen();
  2757. if (packResponse.button !== "0") return;
  2758. let pack = packResponse.inputs[0].value;
  2759. if (!blacket.packs[pack]) return new bb.Modal({
  2760. title: "I cannot find that pack.",
  2761. buttons: [{ text: "Close" }]
  2762. });
  2763. let countModal = new bb.Modal({
  2764. title: "Mass Open",
  2765. inputs: [{ placeholder: "Quantity" }],
  2766. buttons: [{ text: "Next" }, { text: "Cancel" }]
  2767. });
  2768. let countResponse = await countModal.listen();
  2769. if (countResponse.button !== "0") return;
  2770. let qty = Number(countResponse.inputs[0].value) || null;
  2771. if (qty === NaN) return new bb.Modal({
  2772. title: "Invalid quantity.",
  2773. buttons: [{ text: "Close" }]
  2774. });
  2775. let cost = blacket.packs[pack].price * qty;
  2776. if (blacket.user.tokens < cost) return new bb.Modal({
  2777. title: "You do not have enough tokens to open that many packs!",
  2778. buttons: [{ text: "Close" }]
  2779. });
  2780. let extraDelayModal = new bb.Modal({
  2781. title: "Mass Open",
  2782. description: "you can leave this at zero (nothing) if you're not going to be using blacket while running the opener, otherwise recommended is 50-75",
  2783. inputs: [{ placeholder: "Extra Delay" }],
  2784. buttons: [{ text: "Next" }, { text: "Cancel" }]
  2785. });
  2786. let extraDelayResponse = await extraDelayModal.listen();
  2787. if (extraDelayResponse.button !== "0") return;
  2788. let extraDelay = Number(extraDelayResponse.inputs[0].value);
  2789. if (extraDelay === NaN) return new bb.Modal({
  2790. title: "Invalid Extra Delay.",
  2791. buttons: [{ text: "Close" }]
  2792. });
  2793. let confirmModal = new bb.Modal({
  2794. title: "Mass Open",
  2795. description: `Are you sure you want to open ${qty.toLocaleString()}x ${pack}? This will cost ${cost.toLocaleString()} tokens!`,
  2796. buttons: [{ text: "Start!" }, { text: "Cancel" }]
  2797. });
  2798. let confirmResponse = await confirmModal.listen();
  2799. if (confirmResponse.button !== "0") return;
  2800. document.querySelector(".bb_openButton").innerText = "Stop Opening";
  2801. let maxDelay = Object.values(blacket.rarities).map((x) => x.wait).reduce((curr, prev) => curr > prev ? curr : prev) + extraDelay;
  2802. let opened = [];
  2803. let openedCount = 0;
  2804. let openPack = async () => new Promise((resolve, reject) => {
  2805. blacket.requests.post("/worker3/open", { pack }, (data) => {
  2806. if (data.error) reject();
  2807. resolve(data.blook);
  2808. });
  2809. });
  2810. document.querySelector(".bb_openButton").innerText = "Stop Opening";
  2811. document.querySelector(".bb_openButton").onclick = () => openedCount = qty;
  2812. while (openedCount < qty) {
  2813. try {
  2814. const attainedBlook = await openPack();
  2815. blacket.user.tokens -= blacket.packs[pack].price;
  2816. $("#tokenBalance").html(`<img loading="lazy" src="/content/tokenIcon.webp" alt="Token" class="styles__tokenBalanceIcon___3MGhs-camelCase" draggable="false"><div>${blacket.user.tokens.toLocaleString()}</div>`);
  2817. const delay = blacket.rarities[blacket.blooks[attainedBlook].rarity].wait - 45 + extraDelay;
  2818. opened.push(attainedBlook);
  2819. openedCount = opened.length;
  2820. let count = opened.reduce((acc, blook) => {
  2821. acc[blook] = (acc[blook] || 0) + 1;
  2822. return acc;
  2823. }, {});
  2824. Object.entries(count).map((x) => ` ${x[1]} ${x[0]}`).join(`
  2825. `);
  2826. document.querySelector(".bb_openedCount").innerHTML = `${pack} | ${openedCount}/${qty} opened`;
  2827. document.querySelector(".bb_opened").innerHTML = Object.entries(count).map(([blook, qtyOf]) => {
  2828. return `<div class="bb_openResult" style="color: ${blacket.rarities[blacket.blooks[blook].rarity].color};">${blook} x${qtyOf}</div>`;
  2829. }).join("");
  2830. await new Promise((r) => setTimeout(r, delay));
  2831. } catch (err) {
  2832. console.log(err);
  2833. await new Promise((r) => setTimeout(r, maxDelay));
  2834. }
  2835. }
  2836. alert(`Open Complete! Opened ${qty}x ${pack}, spending ${cost.toLocaleString()} tokens!`);
  2837. document.querySelector(".bb_openedCount").innerHTML = "Opening ended!";
  2838. document.querySelector(".bb_openButton").onclick = () => bb.plugins.massopen.start();
  2839. document.querySelector(".bb_openButton").innerText = "Start Opening";
  2840. };
  2841. document.body.insertAdjacentHTML("beforeend", `
  2842. <div class="bb_openModal">
  2843. <div class="bb_openIcons">
  2844. <i class="fas fa-arrows-up-down-left-right bb_openIcon" id="bb_openDragger"></i>
  2845. <i class="fas fa-x bb_openIcon" onclick="document.querySelector('.bb_openModal').remove()"></i>
  2846. </div>
  2847. <div class="bb_openTitle">Pack Opening</div>
  2848. <div class="bb_openedCount">Waiting to open...</div>
  2849. <hr>
  2850. <div class="bb_opened"></div>
  2851. <div class="bb_openButtons">
  2852. <div class="bb_openButton" onclick="bb.plugins.massopen.start()">Start Opening</div>
  2853. </div>
  2854. </div>
  2855. `);
  2856. let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
  2857. let modal = document.querySelector(".bb_openModal");
  2858. let dragger = document.querySelector("#bb_openDragger");
  2859. dragger.onmousedown = (e) => {
  2860. e.preventDefault();
  2861. pos3 = e.clientX;
  2862. pos4 = e.clientY;
  2863. document.onmouseup = () => {
  2864. document.onmouseup = null;
  2865. document.onmousemove = null;
  2866. };
  2867. document.onmousemove = (e2) => {
  2868. e2.preventDefault();
  2869. pos1 = pos3 - e2.clientX;
  2870. pos2 = pos4 - e2.clientY;
  2871. pos3 = e2.clientX;
  2872. pos4 = e2.clientY;
  2873. let top = modal.offsetTop - pos2 > 0 ? modal.offsetTop - pos2 : 0;
  2874. let left = modal.offsetLeft - pos1 > 0 ? modal.offsetLeft - pos1 : 0;
  2875. if (top + modal.offsetHeight + 15 <= window.innerHeight) modal.style.top = top + "px";
  2876. if (left + modal.offsetWidth + 15 <= window.innerWidth) modal.style.left = left + "px";
  2877. };
  2878. };
  2879. window.onresize = () => modal.style.top = modal.style.left = "";
  2880. }
  2881. });
  2882. const __vite_glob_0_0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: index$l }, Symbol.toStringTag, { value: "Module" }));
  2883. const index$k = () => createPlugin({
  2884. name: "April Fools 2023",
  2885. description: "returns the 2023 april fools update.",
  2886. authors: [{ name: "Death", avatar: "https://i.imgur.com/PrvNWub.png", url: "https://villainsrule.xyz" }],
  2887. styles: `
  2888. .styles__sidebar___1XqWi-camelCase,
  2889. .styles__left___9beun-camelCase,
  2890. .styles__postsContainer___39_IQ-camelCase,
  2891. .styles__middleWrapper___hjUyY-camelCase,
  2892. .styles__header___22Ne2-camelCase,
  2893. .styles__container___2VzTy-camelCase,
  2894. .styles__input___2XTSp-camelCase {
  2895. background-color: #dcd9d9;
  2896. }
  2897.  
  2898. .styles__background___2J-JA-camelCase,
  2899. .styles__background___2J-JA-camelCase,
  2900. .styles__blookGridContainer___AK47P-camelCase {
  2901. background-color: #b5b5b5;
  2902. }
  2903.  
  2904. .styles__headerBadges___ffKa4-camelCase,
  2905. .styles__statsContainer___QnrRB-camelCase,
  2906. .styles__profileContainer___CSuIE-camelCase,
  2907. .styles__tokenBalance___1FHgT-camelCase,
  2908. .styles__infoContainer___2uI-S-camelCase,
  2909. .styles__header___2O21B-camelCase,
  2910. .styles__cardContainer___NGmjp-camelCase,
  2911. .styles__plan___1OEy4-camelCase,
  2912. .styles__perkContainer___2rw2I-camelCase,
  2913. .styles__headerSide___1r1-b-camelCase,
  2914. .styles__signUpButton___3_ch3-camelCase,
  2915. .styles__loginButton___1e3jI-camelCase,
  2916. .styles__chatEmojiButton___8RFa2-camelCase,
  2917. .styles__button___2hNZo-camelCase,
  2918. .styles__tradingContainer___B1ABS-camelCase,
  2919. .styles__otherTokenAmount___SEGGS-camelCase,
  2920. .styles__myTokenAmount___ANKHA-camelCase,
  2921. .styles__horizontalBlookGridLine___4SAvz-camelCase,
  2922. .styles__verticalBlookGridLine___rQWaZ-camelCase,
  2923. .styles__profileDropdownMenu___2jUAA-camelCase,
  2924. .styles__profileDropdownOption___ljZXD-camelCase {
  2925. background-color: #9d9d9d;
  2926. }
  2927.  
  2928. .styles__button___2hNZo-camelCase {
  2929. color: #3a3a3a;
  2930. }
  2931.  
  2932. .styles__pageButton___1wFuu-camelCase,
  2933. .styles__bottomIcon___3Fswk-camelCase,
  2934. .styles__containerHeaderInside___2omQm-camelCase,
  2935. .styles__statNum___5RYSd-camelCase {
  2936. color: #5f5a5a;
  2937. }
  2938. .styles__statContainer___QKuOF-camelCase,
  2939. .styles__containerHeaderInside___2omQm-camelCase,
  2940. .styles__containerHeader___3xghM-camelCase,
  2941. .styles__containerHeaderRight___3xghM-camelCase {
  2942. background-color: #d5d4d4;
  2943. }
  2944.  
  2945. #chatBox,
  2946. .styles__chatInputContainer___gkR4A-camelCase {
  2947. background-color: #d2cccc;
  2948. }
  2949.  
  2950. .styles__setText___1PQLQ-camelCase {
  2951. color: #3a3939;
  2952. }
  2953.  
  2954. .styles__edge___3eWfq-camelCase,
  2955. .styles__buttonFilled___23Dcn-camelCase {
  2956. background-color: #ffffff;
  2957. border-color: #ffffff;
  2958. }
  2959.  
  2960. .styles__lockedBlook___3oGaX-camelCase {
  2961. filter: brightness(0.3);
  2962. }
  2963.  
  2964. #packSelector::-webkit-scrollbar,
  2965. #blookSelector::-webkit-scrollbar,
  2966. .styles__bazaarItems___KmNa2-camelCase::-webkit-scrollbar {
  2967. display: none;
  2968. }
  2969.  
  2970. .styles__bazaarItems___KmNa2-camelCase {
  2971. background-color: rgba(0, 0, 0, 0.33);
  2972. }
  2973.  
  2974. .styles__bazaarItem___Meg69-camelCase {
  2975. background-color: #9d9d9d;
  2976. }
  2977.  
  2978. .styles__bazaarItem___Meg69-camelCase:hover {
  2979. background-color: #3a3939;
  2980. }
  2981.  
  2982. .styles__container___3St5B-camelCase {
  2983. background-color: #808080;
  2984. }
  2985. `,
  2986. onLoad: () => {
  2987. if (document.getElementsByClassName("styles__topRightRow___dQvxc-camelCase")[0] && location.pathname === "/market") {
  2988. document.getElementsByClassName("styles__topRightRow___dQvxc-camelCase")[0].children[0].style.backgroundColor = "#9d9d9d";
  2989. }
  2990. if (document.getElementsByClassName("styles__front___vcvuy-camelCase")[0] && location.pathname === "/blooks" || location.pathname === "/store" || location.pathname === "/bazaar") {
  2991. Array.from(document.getElementsByClassName("styles__front___vcvuy-camelCase")).forEach((a) => {
  2992. a.style.backgroundColor = "#9d9d9d";
  2993. });
  2994. Array.from(document.getElementsByClassName("styles__edge___3eWfq-camelCase")).forEach((a) => {
  2995. a.style.backgroundColor = "#9d9a9a";
  2996. });
  2997. setInterval(() => {
  2998. Array.from(document.getElementsByClassName("styles__front___vcvuy-camelCase")).forEach((a) => {
  2999. a.style.backgroundColor = "#9d9d9d";
  3000. });
  3001. Array.from(document.getElementsByClassName("styles__edge___3eWfq-camelCase")).forEach((a) => {
  3002. a.style.backgroundColor = "#9d9a9a";
  3003. });
  3004. }, 25);
  3005. }
  3006. if (document.getElementsByTagName("div")[0] && location.pathname === "/404" || location.pathname === "/502/" || location.pathname === "/blacklisted") {
  3007. document.getElementsByTagName("div")[0].style.backgroundColor = "#b5b5b5";
  3008. document.getElementsByTagName("div")[2].style.backgroundColor = "#d5d4d4";
  3009. document.getElementsByTagName("div")[2].style.filter = "drop-shadow(white 0px 1px 3px)";
  3010. }
  3011. if (document.getElementsByClassName("styles__background___2J-JA-camelCase")[0] && location.pathname === "/trade" || location.pathname === "/store") {
  3012. document.getElementsByClassName("styles__background___2J-JA-camelCase")[0].style.backgroundColor = "#b5b5b5";
  3013. }
  3014. Array.from(document.getElementsByTagName("input")).forEach((n) => {
  3015. n.style.backgroundColor = "#9d9d9d";
  3016. });
  3017. setInterval(() => {
  3018. Array.from(document.getElementsByTagName("div")).forEach((n) => {
  3019. n.style.fontFamily = "Comic Sans MS";
  3020. });
  3021. Array.from(document.getElementsByTagName("a")).forEach((n) => {
  3022. n.style.fontFamily = "Comic Sans MS";
  3023. });
  3024. Array.from(document.getElementsByTagName("text")).forEach((n) => {
  3025. n.style.fontFamily = "Comic Sans MS";
  3026. });
  3027. Array.from(document.getElementsByTagName("div")).forEach((n) => {
  3028. let textNodes = Array.from(n.childNodes).filter((node) => node.nodeType === 3);
  3029. textNodes.forEach((node) => node.nodeValue = node.nodeValue.toLowerCase());
  3030. });
  3031. Array.from(document.getElementsByTagName("a")).forEach((n) => {
  3032. let textNodes = Array.from(n.childNodes).filter((node) => node.nodeType === 3);
  3033. textNodes.forEach((node) => node.nodeValue = node.nodeValue.toLowerCase());
  3034. });
  3035. Array.from(document.getElementsByTagName("text")).forEach((n) => {
  3036. let textNodes = Array.from(n.childNodes).filter((node) => node.nodeType === 3);
  3037. textNodes.forEach((node) => node.nodeValue = node.nodeValue.toLowerCase());
  3038. });
  3039. }, 25);
  3040. setTimeout(() => {
  3041. Array.from(document.getElementsByTagName("div")).forEach((n) => {
  3042. let textNodes = Array.from(n.childNodes).filter((node) => node.nodeType === 3);
  3043. textNodes.forEach((node) => {
  3044. let letters = node.nodeValue.split("");
  3045. let randomIndex = Math.floor(Math.random() * letters.length);
  3046. let randomIndex2 = Math.floor(Math.random() * letters.length);
  3047. let temp = letters[randomIndex];
  3048. letters[randomIndex] = letters[randomIndex2];
  3049. letters[randomIndex2] = temp;
  3050. node.nodeValue = letters.join("");
  3051. });
  3052. });
  3053. Array.from(document.getElementsByTagName("a")).forEach((n) => {
  3054. let textNodes = Array.from(n.childNodes).filter((node) => node.nodeType === 3);
  3055. textNodes.forEach((node) => {
  3056. let letters = node.nodeValue.split("");
  3057. let randomIndex = Math.floor(Math.random() * letters.length);
  3058. let randomIndex2 = Math.floor(Math.random() * letters.length);
  3059. let temp = letters[randomIndex];
  3060. letters[randomIndex] = letters[randomIndex2];
  3061. letters[randomIndex2] = temp;
  3062. node.nodeValue = letters.join("");
  3063. });
  3064. });
  3065. Array.from(document.getElementsByTagName("text")).forEach((n) => {
  3066. let textNodes = Array.from(n.childNodes).filter((node) => node.nodeType === 3);
  3067. textNodes.forEach((node) => {
  3068. let letters = node.nodeValue.split("");
  3069. let randomIndex = Math.floor(Math.random() * letters.length);
  3070. let randomIndex2 = Math.floor(Math.random() * letters.length);
  3071. let temp = letters[randomIndex];
  3072. letters[randomIndex] = letters[randomIndex2];
  3073. letters[randomIndex2] = temp;
  3074. node.nodeValue = letters.join("");
  3075. });
  3076. });
  3077. }, 500);
  3078. }
  3079. });
  3080. const __vite_glob_0_1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: index$k }, Symbol.toStringTag, { value: "Module" }));
  3081. const index$j = () => createPlugin({
  3082. name: "Bazaar Sniper",
  3083. description: "pew pew! sniped right off the bazaar!",
  3084. authors: [{ name: "Death", avatar: "https://i.imgur.com/PrvNWub.png", url: "https://villainsrule.xyz" }],
  3085. onStart: () => {
  3086. let checkBazaar = setInterval(() => {
  3087. if (blacket.login || blacket.config.path === "") return clearInterval(checkBazaar);
  3088. if (!blacket.user) return;
  3089. axios.get("/worker/bazaar").then((bazaar) => {
  3090. bazaar.data.bazaar.forEach((bazaarItem) => {
  3091. let blookData = blacket.blooks[bazaarItem.item];
  3092. if (!!!blookData || blookData.price < bazaarItem.price || bazaarItem.seller === blacket.user.username) return;
  3093. axios.post("/worker/bazaar/buy", { id: bazaarItem.id }).then((purchase) => {
  3094. if (purchase.data.error) return console.log(`[Bazaar Sniper] Error sniping Blook`, bazaarItem, purchase);
  3095. console.log(`[Bazaar Sniper] Sniped a blook!`, bazaarItem);
  3096. blacket.createToast({ message: `Sniped Blook ${bazaarItem.item} from seller ${bazaarItem.seller} with price ${bazaarItem.price}!` });
  3097. });
  3098. });
  3099. });
  3100. }, 750);
  3101. }
  3102. });
  3103. const __vite_glob_0_2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: index$j }, Symbol.toStringTag, { value: "Module" }));
  3104. const index$i = () => createPlugin({
  3105. name: "Better Chat",
  3106. description: "enhances your chatting experience!",
  3107. authors: [{ name: "Death", avatar: "https://i.imgur.com/PrvNWub.png", url: "https://villainsrule.xyz" }],
  3108. patches: [
  3109. {
  3110. file: "/lib/js/game.js",
  3111. replacement: [
  3112. {
  3113. match: /id="\${randomUsernameId}"/,
  3114. replace: "",
  3115. setting: "Click 2 Clan"
  3116. },
  3117. {
  3118. match: /style="color: \${data\.author\.co/,
  3119. replace: `id="\${randomUsernameId}" style="color: \${data.author.co`,
  3120. setting: "Click 2 Clan"
  3121. },
  3122. {
  3123. match: /style="color: \${data\.author\.clan\.color};"/,
  3124. replace: `onclick="window.open('/clans/discover?name=\${encodeURIComponent(data.author.clan.name)}');" style="color: \${data.author.clan.color};"`,
  3125. setting: "Click 2 Clan"
  3126. },
  3127. {
  3128. match: /\$\{blacket\.config\.path !== "trade" \? `<div class="styles__contextMenuItemContainer___m3Xa3-camelCase" id="message-context-quote">/,
  3129. replace: `\${(data.author.id !== blacket.user.id) && blacket.config.path !== "trade" ? \`<div class="styles__contextMenuItemContainer___m3Xa3-camelCase" id="message-context-trade">
  3130. <div class="styles__contextMenuItemName___vj9a3-camelCase">Trade</div>
  3131. <i class="styles__contextMenuItemIcon___2Zq3a-camelCase fas fa-hand-holding"></i>
  3132. </div>\` : ""}
  3133.  
  3134. \${blacket.config.path !== "trade" ? \`<div class="styles__contextMenuItemContainer___m3Xa3-camelCase" id="message-context-quote">`
  3135. },
  3136. {
  3137. match: /\$\(`#message-context-copy-id`\)\.click\(\(\) => navigator\.clipboard\.writeText\(data\.message\.id\)\);/,
  3138. replace: `$('message-context-trade').click(() => blacket.tradeUser(data.author.id));
  3139. $(\`#message-context-copy-id\`).click(() => navigator.clipboard.writeText(data.message.id));`
  3140. }
  3141. ]
  3142. }
  3143. ],
  3144. styles: `
  3145. .styles__chatMessageContainer__G1Z4P-camelCase {
  3146. padding: 1vw 1.5vw;
  3147. }
  3148.  
  3149. .styles__chatContainer___iA8ZU-camelCase {
  3150. height: calc(100% - 4.25vw);
  3151. }
  3152.  
  3153. div[style="position: absolute;bottom: 0;width: 100%;"] {
  3154. bottom: 1.25vw !important;
  3155. left: 2vw;
  3156. width: calc(100% - 3vw) !important;
  3157. }
  3158.  
  3159. .styles__chatInputContainer___gkR4A-camelCase {
  3160. border-radius: 10vw;
  3161. }
  3162.  
  3163. .styles__chatUploadButton___g39Ac-camelCase,
  3164. .styles__chatEmojiButton___8RFa2-camelCase {
  3165. border-radius: 50%;
  3166. }
  3167.  
  3168. .styles__chatEmojiPickerContainer___KR4aN-camelCase {
  3169. border-radius: 0 0 0.5vw 0.5vw;
  3170. bottom: 3.3vw;
  3171. background-color: #2f2f2f;
  3172. width: 19vw;
  3173. }
  3174.  
  3175. .styles__chatEmojiPickerBody___KR4aN-camelCase {
  3176. left: unset;
  3177. gap: 0.5vw;
  3178. justify-content: center;
  3179. }
  3180.  
  3181. .styles__chatEmojiPickerHeader___FK4Ac-camelCase {
  3182. font-size: 1.15vw;
  3183. height: 3vw;
  3184. font-weight: 800;
  3185. background-color: #3f3f3f;
  3186. }
  3187. `,
  3188. settings: [{
  3189. name: "Click 2 Clan",
  3190. default: true
  3191. }]
  3192. });
  3193. const __vite_glob_0_3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: index$i }, Symbol.toStringTag, { value: "Module" }));
  3194. const index$h = () => createPlugin({
  3195. name: "Better Notifications",
  3196. description: "a new and improved notification system.",
  3197. authors: [{ name: "Death", avatar: "https://i.imgur.com/PrvNWub.png", url: "https://villainsrule.xyz" }],
  3198. patches: [
  3199. {
  3200. file: "/lib/js/all.js",
  3201. replacement: [
  3202. {
  3203. match: /\.styles__toastContainer___o4pCa-camelCase/,
  3204. replace: `.toastMessage`
  3205. },
  3206. {
  3207. match: /\$\("body"\)\.append\(`<div class="s.*?<\/div><\/div>`\)/,
  3208. replace: "bb.plugins.notifications(toast.title, toast.message, toast.audio);return;"
  3209. }
  3210. ]
  3211. },
  3212. {
  3213. file: "/lib/js/game.js",
  3214. replacement: [
  3215. {
  3216. match: /Notification\.permission == "granted"/,
  3217. replace: "false",
  3218. setting: "Disable Desktop"
  3219. },
  3220. {
  3221. match: /Notification\.permission !== "granted" && Notification\.permission !== "denied"/,
  3222. replace: "false",
  3223. setting: "Disable Desktop"
  3224. },
  3225. {
  3226. match: /3500/,
  3227. replace: "1000"
  3228. },
  3229. {
  3230. match: /flyOut 0\.35s ease-in-out/,
  3231. replace: `styles__oldGrowOut___3FTko-camelCase 0.5s linear`
  3232. },
  3233. {
  3234. match: /flyIn 0.35s ease-in-out/,
  3235. replace: `styles__oldGrowIn___3FTko-camelCase 0.5s linear`
  3236. }
  3237. ]
  3238. }
  3239. ],
  3240. styles: `
  3241. .toastMessage {
  3242. animation: styles__oldGrowIn___3FTko-camelCase 0.5s linear forwards;
  3243. background-color: #1f1f1f;
  3244. border-radius: 5px;
  3245. left: 0;
  3246. right: 0;
  3247. text-align: center;
  3248. top: 20px;
  3249. display: flex;
  3250. flex-direction: column;
  3251. padding: 5px 20px 10px 20px;
  3252. position: absolute;
  3253. margin: 0 auto;
  3254. height: fit-content;
  3255. cursor: pointer;
  3256. }
  3257. `,
  3258. onLoad: () => {
  3259. bb.plugins.notifications = (title, message, audio = true) => {
  3260. let id2 = Math.random().toString(36).substring(2, 15);
  3261. $("#app").append(`
  3262. <div id='${id2}' class='toastMessage'>
  3263. ${title ? `<text style='color: white; font-size:25px;'>${title}</text>` : ""}
  3264. ${message ? `<text style='color: white; font-size:20px;'>${message}</text>` : ""}
  3265. </div>
  3266. `);
  3267. if (audio) new Audio("/content/notification.ogg").play();
  3268. let timeout = setTimeout(() => {
  3269. document.getElementById(id2).onclick = null;
  3270. $(`#${id2}`).attr("style", "animation: styles__oldGrowOut___3FTko-camelCase 0.5s linear forwards;");
  3271. setTimeout(() => {
  3272. $(`#${id2}`).remove();
  3273. blacket.toasts.shift();
  3274. if (blacket.toasts.length > 0) blacket.createToast(blacket.toasts[0], true);
  3275. }, 1e3);
  3276. }, 5e3);
  3277. document.getElementById(id2).onclick = () => {
  3278. clearTimeout(timeout);
  3279. $(`#${id2}`).remove();
  3280. blacket.toasts.shift();
  3281. if (blacket.toasts.length > 0) blacket.createToast(blacket.toasts[0], true);
  3282. };
  3283. };
  3284. },
  3285. settings: [{
  3286. name: "Disable Desktop",
  3287. default: false
  3288. }]
  3289. });
  3290. const __vite_glob_0_4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: index$h }, Symbol.toStringTag, { value: "Module" }));
  3291. const index$g = () => createPlugin({
  3292. name: "Better Replies",
  3293. description: "overhauls the message reply system.",
  3294. authors: [
  3295. { name: "Death", avatar: "https://i.imgur.com/PrvNWub.png", url: "https://villainsrule.xyz" },
  3296. { name: "Syfe", avatar: "https://i.imgur.com/OKpOipQ.gif", url: "https://github.com/ItsSyfe" }
  3297. ],
  3298. patches: [
  3299. {
  3300. file: "/lib/js/game.js",
  3301. replacement: [
  3302. {
  3303. match: /var tem \= document\.querySelector\('\#chatContainer \.styles__chatMessageContainer__G1Z4P\-camelCase\:last\-child'\);/,
  3304. replace: `
  3305. message = message.replace(/&lt;\\/gradient=.*&gt;/, '');
  3306. message = message.replace(/&lt;gradient=.*&gt;/, '');
  3307. message = message.replace(/&lt;\\/#.*&gt;/, '');
  3308. message = message.replace(/&lt;#.*&gt;/, '');
  3309. var tem = document.querySelector('#chatContainer .styles__chatMessageContainer__G1Z4P-camelCase:last-child');
  3310. `
  3311. },
  3312. {
  3313. match: /quote`\).click\(\(\) => \{/,
  3314. replace: `quote\`).click(() => {return;`
  3315. },
  3316. {
  3317. match: /\$\(`\#message-context-copy`\)/,
  3318. replace: `$('#message-context-quote').click(() => $self.quote(data));$('#message-context-copy')`
  3319. },
  3320. {
  3321. match: /\$\(`\#message-\$\{data.message.id\}-r/,
  3322. replace: `$(\`#message-\${data.message.id}-quote\`).click(() => $self.quote(data));$(\`#message-\${data.message.id}-r`
  3323. },
  3324. {
  3325. match: /let delay = 0;/,
  3326. replace: `window.blacket.chat.update = () => chatBoxUpdate();let delay = 0;`
  3327. }
  3328. ]
  3329. }
  3330. ],
  3331. quote: (data) => {
  3332. let msg = `Γò¡ From <@${data.author.id}> ${localStorage.getItem("chatColor") ? "</c>" : ""}${data.author.clan ? `**<${data.author.clan.color}>[ ${data.author.clan.name} ]</c>**` : ""} ${data.message.content}
  3333. ${localStorage.getItem("chatColor") ? `<${localStorage.getItem("chatColor")}>` : ""}`;
  3334. document.querySelector("#chatBox").value = msg;
  3335. document.querySelector("#chatBox").focus();
  3336. blacket.chat.update();
  3337. }
  3338. });
  3339. const __vite_glob_0_5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: index$g }, Symbol.toStringTag, { value: "Module" }));
  3340. const index$f = () => createPlugin({
  3341. name: "Blook Utilities",
  3342. description: "enhances the blook manager experience.",
  3343. authors: [{ name: "Death", avatar: "https://i.imgur.com/PrvNWub.png", url: "https://villainsrule.xyz" }],
  3344. patches: [
  3345. {
  3346. file: "/lib/js/blooks.js",
  3347. replacement: [
  3348. {
  3349. match: /\`\$\{blacket\.user\.blooks\[blook\]\.toLocaleString\(\)\} Owned\`/,
  3350. replace: `bb.plugins.blookutils ? bb.plugins.blookutils.blooks[blook].toLocaleString() + ' Owned' : \`\${blacket.user.blooks[blook].toLocaleString()} Owned\``
  3351. },
  3352. {
  3353. match: /let packBlooks/,
  3354. replace: "window.packBlooks"
  3355. },
  3356. {
  3357. match: />List<\/div>/,
  3358. replace: `>Next</div>`
  3359. },
  3360. {
  3361. match: /blacket\.listBlook\(\$\(.*?\)\.val\(\)\);/,
  3362. replace: `
  3363. let amount = $('.styles__numRow___xh98F-camelCase > div:nth-child(1) > input:nth-child(1)').val();
  3364. $('.arts__modal___VpEAD-camelCase').remove();
  3365. document.querySelector('body').insertAdjacentHTML('beforeend', \`<div class='arts__modal___VpEAD-camelCase'>
  3366. <form class='styles__container___1BPm9-camelCase'>
  3367. <div class='styles__text___KSL4--camelCase'>List \${blacket.blooks.selected} Blook how many times?</div>
  3368. <div class='styles__holder___3CEfN-camelCase'>
  3369. <div class='styles__numRow___xh98F-camelCase'>
  3370. <div style='border: 0.156vw solid rgba(0, 0, 0, 0.17);border-radius: 0.313vw;width: 90%;height: 2.604vw;margin: 0.000vw;display: flex;flex-direction: row;align-items: center;'>
  3371. <input style=' border: none;height: 2.083vw;line-height: 2.083vw;font-size: 1.458vw;text-align: center;font-weight: 700;font-family: Nunito, sans-serif;color: #ffffff;background-color: #3f3f3f;outline: none;width: 100%;' placeholder='Price' maxlength='3' value='1'>
  3372. </div>
  3373. </div>
  3374. <div class='styles__buttonContainer___2EaVD-camelCase'>
  3375. <div id='yesButton' class='styles__button___1_E-G-camelCase styles__button___3zpwV-camelCase' role='button' tabindex='0'>
  3376. <div class='styles__shadow___3GMdH-camelCase'></div>
  3377. <div class='styles__edge___3eWfq-camelCase' style='background-color: #2f2f2f;'></div>
  3378. <div class='styles__front___vcvuy-camelCase styles__buttonInside___39vdp-camelCase' style='background-color: #2f2f2f;'>List</div>
  3379. </div>
  3380. <div id='noButton' class='styles__button___1_E-G-camelCase styles__button___3zpwV-camelCase' role='button' tabindex='0'>
  3381. <div class='styles__shadow___3GMdH-camelCase'></div>
  3382. <div class='styles__edge___3eWfq-camelCase' style='background-color: #2f2f2f;'></div>
  3383. <div class='styles__front___vcvuy-camelCase styles__buttonInside___39vdp-camelCase' style='background-color: #2f2f2f;'>Cancel</div>
  3384. </div>
  3385. </div>
  3386. </div>
  3387. <input type='submit' style='opacity: 0; display: none;' />
  3388. </form>
  3389. </div>\`);
  3390. $('.styles__container___1BPm9-camelCase').submit((event) => {
  3391. event.preventDefault();
  3392. blacket.listBlook($('.styles__numRow___xh98F-camelCase > div:nth-child(1) > input:nth-child(1)').val());
  3393. });
  3394. $('.styles__numRow___xh98F-camelCase > div:nth-child(1) > input:nth-child(1)').focus();
  3395. $('#yesButton').click(async () => {
  3396. let times = parseInt($('.styles__numRow___xh98F-camelCase > div:nth-child(1) > input:nth-child(1)').val());
  3397. blacket.startLoading();
  3398. for (let i = 0; i < times; i++) {
  3399. blacket.listBlook(amount);
  3400. await new Promise(resolve => setTimeout(resolve, 500 * times));
  3401. };
  3402. blacket.stopLoading();
  3403. });
  3404. $('#noButton').click(() => {
  3405. $('.arts__modal___VpEAD-camelCase').remove();
  3406. });
  3407. `
  3408. }
  3409. ]
  3410. }
  3411. ],
  3412. onStart: () => {
  3413. if (!location.pathname.startsWith("/blooks")) return;
  3414. blacket.listBlook = (price) => {
  3415. if (price == `` || price == 0) return;
  3416. $(".arts__modal___VpEAD-camelCase").remove();
  3417. axios.post("/worker/bazaar/list", {
  3418. item: blacket.blooks.selected,
  3419. price
  3420. }).then((list) => {
  3421. if (list.data.error) {
  3422. blacket.createToast({
  3423. title: "Error",
  3424. message: list.data.reason,
  3425. icon: "/content/blooks/Error.png",
  3426. time: 5e3
  3427. });
  3428. return blacket.stopLoading();
  3429. }
  3430. blacket.user.blooks[blacket.blooks.selected] -= 1;
  3431. if (blacket.user.blooks[blacket.blooks.selected] < 1) {
  3432. $(`#${blacket.blooks.selected.replaceAll(" ", "-").replaceAll("'", "_")} > div:nth-child(2)`).remove();
  3433. $(`#${blacket.blooks.selected.replaceAll(" ", "-").replaceAll("'", "_")}`).append(`<i class='fas fa-lock styles__blookLock___3Kgua-camelCase' aria-hidden='true'></i>`);
  3434. $(`#${blacket.blooks.selected.replaceAll(" ", "-").replaceAll("'", "_")}`).attr("style", "cursor: auto;");
  3435. $(`#${blacket.blooks.selected.replaceAll(" ", "-").replaceAll("'", "_")} > div:nth-child(1)`).attr("class", "styles__blookContainer___36LK2-camelCase styles__blook___bNr_t-camelCase styles__lockedBlook___3oGaX-camelCase");
  3436. delete blacket.user.blooks[blacket.blooks.selected];
  3437. blacket.blooks.selected = Object.keys(blacket.user.blooks)[Math.floor(Math.random() * Object.keys(blacket.user.blooks).length)];
  3438. } else $(`#${blacket.blooks.selected.replaceAll(" ", "-").replaceAll("'", "_")} > div:nth-child(2)`).html(blacket.user.blooks[blacket.blooks.selected].toLocaleString());
  3439. blacket.selectBlook(blacket.blooks.selected);
  3440. });
  3441. };
  3442. $(`<style>.styles__left___9beun-camelCase {
  3443. height: calc(100% - 6.125vw);
  3444. top: 4.563vw;
  3445. }
  3446.  
  3447. .bb_dupeManager {
  3448. display: flex;
  3449. justify-content: space-between;
  3450. gap: 3vw;
  3451. position: absolute;
  3452. left: 2.5%;
  3453. width: calc(95% - 22.396vw);
  3454. }
  3455.  
  3456. .bb_dupeManager > .styles__button___1_E-G-camelCase {
  3457. width: 100%;
  3458. margin-left: 0;
  3459. text-align: center;
  3460. top: 1vw;
  3461. }
  3462.  
  3463. .bb_userSelector {
  3464. position: absolute;
  3465. top: calc(50% + 15.417vw);
  3466. right: 2.5%;
  3467. width: 20.833vw;
  3468. display: flex;
  3469. flex-direction: row;
  3470. align-items: center;
  3471. justify-content: space-evenly;
  3472. }
  3473.  
  3474. .bb_userSelectBtn {
  3475. margin: 0.521vw;
  3476. width: 100%;
  3477. }
  3478.  
  3479. .bb_userSelectText {
  3480. width: 80%;
  3481. justify-content: space-between;
  3482. }
  3483.  
  3484. #bb_userSelectUsername {
  3485. font-family: 'Titan One';
  3486. }</style>
  3487.  
  3488. <div class='bb_userSelector'>
  3489. <div id='sellButton' class='styles__button___1_E-G-camelCase bb_userSelectBtn' role='button' tabindex='0'>
  3490. <div class='styles__shadow___3GMdH-camelCase'></div>
  3491. <div class='styles__edge___3eWfq-camelCase' style='background-color: #2f2f2f;'></div>
  3492. <div class='styles__front___vcvuy-camelCase' style='background-color: #2f2f2f;'>
  3493. <div class='styles__rightButtonInside___14imT-camelCase bb_userSelectText'>
  3494. <span id='bb_userSelectUsername'>User: ${blacket.user.username}</span>
  3495. <i class='bb_userSelectIcon fas fa-caret-down'></i>
  3496. </div>
  3497. </div>
  3498. </div>
  3499. </div>`).insertAfter($(".styles__rightButtonRow___3a0GF-camelCase"));
  3500. document.querySelector(".bb_userSelectBtn").onclick = async () => {
  3501. let modal = new bb.Modal({
  3502. title: "Blook Viewer",
  3503. description: "Enter a username to search their blooks.",
  3504. inputs: [{ placeholder: "Username" }],
  3505. buttons: [{ text: "Search" }, { text: "Cancel" }]
  3506. });
  3507. let result = await modal.listen();
  3508. if (result.button.toString() === "0") {
  3509. axios.get("/worker2/user/" + result.inputs[0].value).then((u) => {
  3510. if (u.data.error) return new bb.Modal({
  3511. title: "User not found.",
  3512. buttons: [{
  3513. text: "Close"
  3514. }]
  3515. });
  3516. const lock = (blook) => {
  3517. let element = document.getElementById(blook.replaceAll("'", "_").replaceAll(" ", "-"));
  3518. if (!element) return;
  3519. element.children[0].classList.add("styles__lockedBlook___3oGaX-camelCase");
  3520. element.children[1].outerHTML = `<i class='fas fa-lock styles__blookLock___3Kgua-camelCase' aria-hidden='true'></i>`;
  3521. };
  3522. const unlock = (blook, qty, rarity) => {
  3523. let element = document.getElementById(blook.replaceAll("'", "_").replaceAll(" ", "-"));
  3524. if (!element) return;
  3525. element.children[0].classList.remove("styles__lockedBlook___3oGaX-camelCase");
  3526. element.children[1].outerHTML = `<div class='styles__blookText___3AMdK-camelCase' style='background-color: ${blacket.rarities[rarity].color};'>${qty}</div>`;
  3527. };
  3528. let blooks2 = [...document.querySelectorAll(".styles__blookContainer___3JrKb-camelCase")].map((a) => a.id);
  3529. blooks2.forEach((b) => lock(b));
  3530. let containers = [...document.querySelectorAll(".styles__setBlooks___3xamH-camelCase")];
  3531. let miscList = containers[containers.length - 1];
  3532. miscList.replaceChildren();
  3533. let user = u.data.user;
  3534. bb.plugins.blookutils = {
  3535. viewingSelf: false,
  3536. blooks: user.blooks
  3537. };
  3538. document.querySelector("#bb_userSelectUsername").innerText = `User: ${user.username}`;
  3539. Object.entries(user.blooks).forEach((blook) => {
  3540. if (packBlooks.includes(blook[0])) return unlock(blook[0], blook[1], blacket.blooks[blook[0]].rarity);
  3541. if (!blacket.blooks[blook[0]]) return;
  3542. let quantity;
  3543. if (blacket.rarities[blacket.blooks[blook[0]].rarity] && blacket.rarities[blacket.blooks[blook[0]].rarity].color == "rainbow") quantity = `<div class='styles__blookText___3AMdK-camelCase' style='background-image: url('/content/rainbow.gif');'>${blook[1].toLocaleString()}</div></div>`;
  3544. else quantity = `<div class='styles__blookText___3AMdK-camelCase' style='background-color: ${blacket.rarities[blacket.blooks[blook[0]].rarity].color};'>${blook[1].toLocaleString()}</div></div>`;
  3545. miscList.insertAdjacentHTML("beforeend", `<div id='${blook[0].replaceAll(" ", "-").replaceAll("'", "_")}' class='styles__blookContainer___3JrKb-camelCase' style='cursor: pointer' role='button' tabindex='0'><div class='styles__blookContainer___36LK2-camelCase styles__blook___bNr_t-camelCase'><img loading='lazy' src='${blacket.blooks[blook[0]].image}' draggable='false' class='styles__blook___1R6So-camelCase' /></div>${quantity}`);
  3546. document.getElementById(blook[0].replaceAll(" ", "-").replaceAll("'", "_")).addEventListener("click", () => blacket.selectBlook(blook[0]));
  3547. });
  3548. });
  3549. modal.close();
  3550. } else modal.close();
  3551. };
  3552. document.querySelector(".arts__profileBody___eNPbH-camelCase").insertAdjacentHTML("afterbegin", `
  3553. <div class="bb_dupeManager">
  3554. <div id='checkDupes' class='styles__button___1_E-G-camelCase' role='button' tabindex='0'>
  3555. <div class='styles__shadow___3GMdH-camelCase'></div>
  3556. <div class='styles__edge___3eWfq-camelCase' style='background-color: #2f2f2f;'></div>
  3557. <div class='styles__front___vcvuy-camelCase' style='background-color: #2f2f2f;'>
  3558. <div class='styles__rightButtonInside___14imT-camelCase'>Check Dupes</div>
  3559. </div>
  3560. </div>
  3561. </div>
  3562. `);
  3563. document.querySelector("#checkDupes").onclick = () => {
  3564. new bb.Modal({
  3565. title: "Duplicate Blooks",
  3566. description: Object.entries(blacket.user.blooks).filter((blook) => blook[1] > 1).map(([blook, qty]) => `<span style="color: ${blacket.rarities[blacket.blooks[blook].rarity].color}">${blook}: ${qty.toLocaleString()}</span>`).join(" | "),
  3567. buttons: [{ text: "Close" }]
  3568. });
  3569. };
  3570. }
  3571. });
  3572. const __vite_glob_0_6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: index$f }, Symbol.toStringTag, { value: "Module" }));
  3573. const badges = async (...args2) => {
  3574. if (args2[0]) axios.get("/worker2/user/" + args2[0]).then((u) => {
  3575. if (u.data.error) bb.plugins.deafbot.send(`Error fetching user ${args2[0]}: **${u.data.reason}**`);
  3576. else bb.plugins.deafbot.send(`**${u.data.user.username}**'s Badges: ${u.data.user.badges.join(" ")}`);
  3577. });
  3578. else bb.plugins.deafbot.send(`Your Badges: ${blacket.user.badges.join(" ")}`);
  3579. };
  3580. const blocks = async (...args2) => {
  3581. switch (args2[0]) {
  3582. case "list":
  3583. axios.get("/worker2/friends").then((f) => {
  3584. if (f.data.error) bb.plugins.deafbot.send(`Error fetching blocks: **${f.data.reason}**`);
  3585. else bb.plugins.deafbot.send(`**${f.data.blocks.length}** blocks: ${f.data.blocks.map((f2) => f2.username).join(", ")}`);
  3586. });
  3587. break;
  3588. case "add":
  3589. if (!args2[1]) return bb.plugins.deafbot.send(`Whoa - you want to block yourself or something? Tell me who to block!`);
  3590. axios.post("/worker/friends/block", { user: args2[1] }).then((f) => {
  3591. if (f.data.error) bb.plugins.deafbot.send(`Error blocking user: **${f.data.reason}**. I guess they get mercy for now.`);
  3592. else bb.plugins.deafbot.send(`Blocked **${args2[1]}**. You must be in a GREAT mood!`);
  3593. });
  3594. break;
  3595. case "remove":
  3596. if (!args2[1]) return bb.plugins.deafbot.send(`Tell me to remove, or keep hating people. I don't care.`);
  3597. axios.post("/worker/friends/unblock", { user: args2[1] }).then((f) => {
  3598. if (f.data.error) bb.plugins.deafbot.send(`Error removing block: **${f.data.reason}**. L them.`);
  3599. else bb.plugins.deafbot.send(`You are no longer blocking **${args2[1]}**. How nice you must feel today!`);
  3600. });
  3601. break;
  3602. case "check":
  3603. if (!args2[1]) return bb.plugins.deafbot.send(`Specify a username to check.`);
  3604. axios.get("/worker2/friends").then((f) => {
  3605. if (f.data.error) bb.plugins.deafbot.send(`Error fetching blocks: **${f.data.reason}**`);
  3606. else bb.plugins.deafbot.send(`**${args2[1]}** is **${f.data.blocks.map((a) => a.username).map((a) => a.toLowerCase()).includes(args2[1].toLowerCase()) ? "blocked" : "not blocked"}**.`);
  3607. });
  3608. break;
  3609. default:
  3610. bb.plugins.deafbot.send(`Subcommands: **list** ~ **add** ~ **remove** ~ **check**`);
  3611. break;
  3612. }
  3613. };
  3614. const blooks = async (...args2) => {
  3615. if (!args2[0]) return bb.plugins.deafbot.send(`You have **${Object.keys(blacket.user.blooks).length}** unique blooks (**${Object.values(blacket.user.blooks).reduce((partialSum, a) => partialSum + a, 0)}** total), consisting of **${Object.keys(blacket.user.blooks).filter((b) => blacket.blooks[b].rarity === "Uncommon").length}** Uncommons, **${Object.keys(blacket.user.blooks).filter((b) => blacket.blooks[b].rarity === "Rare").length}** Rares, **${Object.keys(blacket.user.blooks).filter((b) => blacket.blooks[b].rarity === "Epic").length}** Epics, **${Object.keys(blacket.user.blooks).filter((b) => blacket.blooks[b].rarity === "Legendary").length}** Legendaries, **${Object.keys(blacket.user.blooks).filter((b) => blacket.blooks[b].rarity === "Chroma").length}** Chromas, and **${Object.keys(blacket.user.blooks).filter((b) => blacket.blooks[b].rarity === "Mystical").length}** Mysticals.`);
  3616. if (args2[0] === "check" && args2[1]?.length) {
  3617. let blook = blacket.blooks[args2.slice(1).join(" ")];
  3618. if (!blook) return bb.plugins.deafbot.send(`No blook found for **${args2.slice(1).join(" ")}**. This is case-sensitive.`);
  3619. if (blacket.user.blooks[args2.slice(1).join(" ")]) return bb.plugins.deafbot.send(`You have **${blacket.user.blooks[args2.slice(1).join(" ")]}x** ${args2.slice(1).join(" ")}.`);
  3620. else return bb.plugins.deafbot.send(`You don't have **${args2.slice(1).join(" ")}**.`);
  3621. }
  3622. axios.get("/worker2/user/" + args2[0]).then((u) => {
  3623. if (u.data.error) bb.plugins.deafbot.send(`Error fetching user ${args2[0]}: **${u.data.reason}**`);
  3624. if (args2[1]) {
  3625. let blook = blacket.blooks[args2.slice(1).join(" ")];
  3626. if (!blook) return bb.plugins.deafbot.send(`No blook found for **${args2.slice(1).join(" ")}**. This is case-sensitive.`);
  3627. if (u.data.user.blooks[args2.slice(1).join(" ")]) return bb.plugins.deafbot.send(`**${u.data.user.username}** has **${u.data.user.blooks[args2.slice(1).join(" ")]}x** ${args2.slice(1).join(" ")}.`);
  3628. else return bb.plugins.deafbot.send(`**${u.data.user.username}** doesn't have **${args2.slice(1).join(" ")}**.`);
  3629. }
  3630. bb.plugins.deafbot.send(`**${u.data.user.username}** has **${Object.keys(u.data.user.blooks).length}** unique blooks (**${Object.values(u.data.user.blooks).reduce((partialSum, a) => partialSum + a, 0)}** total), consisting of **${Object.keys(u.data.user.blooks).filter((b) => blacket.blooks[b].rarity === "Uncommon").length}** Uncommons, **${Object.keys(u.data.user.blooks).filter((b) => blacket.blooks[b].rarity === "Rare").length}** Rares, **${Object.keys(u.data.user.blooks).filter((b) => blacket.blooks[b].rarity === "Epic").length}** Epics, **${Object.keys(u.data.user.blooks).filter((b) => blacket.blooks[b].rarity === "Legendary").length}** Legendaries, **${Object.keys(u.data.user.blooks).filter((b) => blacket.blooks[b].rarity === "Chroma").length}** Chromas, and **${Object.keys(u.data.user.blooks).filter((b) => blacket.blooks[b].rarity === "Mystical").length}** Mysticals.`);
  3631. });
  3632. };
  3633. const booster = async () => {
  3634. let b = await axios.get("/data/index.json");
  3635. if (!b.data.booster.active) return bb.plugins.deafbot.send("There is no active booster.");
  3636. let u = await axios.get("/worker2/user/" + b.data.booster.user);
  3637. bb.plugins.deafbot.send(`<@${u.data.user.id}> (${u.data.user.username}) is boosting with a ${b.data.booster.multiplier}x booster until ${new Date(b.data.booster.time * 1e3).toLocaleTimeString().replaceAll("ΓÇ»", " ")}!`);
  3638. };
  3639. const cheapest = async (...args2) => {
  3640. axios.get("/worker/bazaar?item=" + args2.join(" ")).then((b) => {
  3641. if (b.data.error) return bb.plugins.deafbot.send(`Error fetching bazaar: **${b.data.reason}**`);
  3642. let items = b.data.bazaar.filter((i) => i.item.toLowerCase() === args2.join(" ").toLowerCase());
  3643. if (!items.length) return bb.plugins.deafbot.send(`No items found for **${args2.join(" ")}**.`);
  3644. let cheapest2 = items.sort((a, b2) => a.price - b2.price)[0];
  3645. bb.plugins.deafbot.send(`The cheapest listing for **${cheapest2.item}** costs **${cheapest2.price.toLocaleString()}** tokens & is sold by **${cheapest2.seller}**.`);
  3646. });
  3647. };
  3648. const claim = async () => {
  3649. let claim2 = await axios.get("/worker/claim");
  3650. if (claim2.data.error) bb.plugins.deafbot.send(`Error: **${claim2.data.reason}**`);
  3651. else bb.plugins.deafbot.send(`Claimed **${blacket.config.rewards[claim2.data.reward - 1]}** tokens!`);
  3652. };
  3653. const clan = async (...args2) => {
  3654. if (!args2[0]) axios.get("/worker/clans").then((clan2) => {
  3655. if (clan2.data.error) return bb.plugins.deafbot.send(`Error fetching your clan: **${clan2.data.reason}**`);
  3656. let clanData = clan2.data.clan;
  3657. bb.plugins.deafbot.send(`You are in the ${clanData.members.map((a) => a.username).includes("Death") ? "esteemed " : ""}**${clanData.name}** clan, owned by **${clanData.owner.username}**. You have **${clanData.members.length}** (**${clanData.online}** online) members, and **[REDACTED]** investments. The clan **${clanData.safe ? "is" : "is not"}** in safe mode.`);
  3658. });
  3659. else axios.get("/worker/clans/discover/name/" + args2.join(" ")).then((clan2) => {
  3660. if (clan2.data.error) return bb.plugins.deafbot.send(`Error fetching clan: **${clan2.data.reason}**`);
  3661. clan2 = clan2.data.clans[0];
  3662. bb.plugins.deafbot.send(`The ${clan2.members.map((a) => a.username).includes("Death") ? "esteemed " : ""}**${clan2.name}** clan is owned by **${clan2.owner.username}**. They have **${clan2.members.length}** (**${clan2.online}** online) members, and **[REDACTED]** investments. The clan **${clan2.safe ? "is" : "is not"}** in safe mode.`);
  3663. });
  3664. };
  3665. const color = async (...args2) => {
  3666. if (!args2[0]) return bb.plugins.deafbot.send(`Choose a subcommand: **name** or **text**.`);
  3667. if (args2[0].toLowerCase() === "name") axios.post("https://blacket.org/worker/settings/color", {
  3668. color: `#${args2[1].replace("#", "")}`
  3669. }).then((r) => {
  3670. if (r.data.error) return bb.plugins.deafbot.send(`Error changing name color: **${r.data.reason}**`);
  3671. bb.plugins.deafbot.send(`Name color was set to **#${args2[1].replace("#", "")}**!`);
  3672. });
  3673. if (args2[0].toLowerCase() === "text") {
  3674. if (args2[1] === "gradient") {
  3675. let formed = `${args2[1]}=[${args2[2]}: ${args2.slice(3).join(", ")}]`;
  3676. localStorage.setItem("chatColor", formed);
  3677. bb.plugins.deafbot.send(`Gradient was updated!`);
  3678. } else {
  3679. localStorage.setItem("chatColor", args2[1]);
  3680. bb.plugins.deafbot.send(`Text color was set to **${args2[1]}**!`);
  3681. }
  3682. }
  3683. };
  3684. const $eval = async (...args) => {
  3685. eval(`
  3686. let send = (msg) => bb.plugins.deafbot.send(msg);
  3687. ${args.join(" ")}
  3688. `);
  3689. };
  3690. const friends = async (...args2) => {
  3691. switch (args2[0]) {
  3692. case "list":
  3693. axios.get("/worker2/friends").then((f) => {
  3694. if (f.data.error) bb.plugins.deafbot.send(`Error fetching friends: **${f.data.reason}**`);
  3695. else bb.plugins.deafbot.send(`You have **${f.data.friends.length}** friends: ${f.data.friends.map((f2) => f2.username).join(", ")}`);
  3696. });
  3697. break;
  3698. case "request":
  3699. if (!args2[1]) return bb.plugins.deafbot.send(`Tell me who you actually want to request, you friendless fool.`);
  3700. axios.post("/worker/friends/request", { user: args2[1] }).then((f) => {
  3701. if (f.data.error) bb.plugins.deafbot.send(`Error friending: **${f.data.reason}** - ig you just don't want friends.`);
  3702. else bb.plugins.deafbot.send(`Sent a friend request to **${args2[1]}**. How kind of you :3`);
  3703. });
  3704. break;
  3705. case "accept":
  3706. if (!args2[1]) return bb.plugins.deafbot.send(`Tell me who you actually want to accept, you friendless fool.`);
  3707. axios.post("/worker/friends/accept", { user: args2[1] }).then((f) => {
  3708. if (f.data.error) bb.plugins.deafbot.send(`Error accepting: **${f.data.reason}** - ig you just don't want friends.`);
  3709. else bb.plugins.deafbot.send(`Accepted **${args2[1]}**'s friend request! How kind of you :3`);
  3710. });
  3711. break;
  3712. case "remove":
  3713. if (!args2[1]) return bb.plugins.deafbot.send(`So you want to KEEP all your bad friends? Tell me who to get rid of!`);
  3714. axios.post("/worker/friends/remove", { user: args2[1] }).then((f) => {
  3715. if (f.data.error) bb.plugins.deafbot.send(`Error removing: **${f.data.reason}** - L you. With them forever.`);
  3716. else bb.plugins.deafbot.send(`You are no longer friended to **${args2[1]}**. How nice you must feel today!`);
  3717. });
  3718. break;
  3719. case "check":
  3720. if (!args2[1]) return bb.plugins.deafbot.send(`Specify a username to check.`);
  3721. axios.get("/worker2/friends").then((f) => {
  3722. if (f.data.error) bb.plugins.deafbot.send(`Error fetching friends: **${f.data.reason}**`);
  3723. else bb.plugins.deafbot.send(`**${args2[1]}** **${f.data.friends.map((a) => a.username).map((a) => a.toLowerCase()).includes(args2[1].toLowerCase()) ? "is" : "isn't"}** your friend.`);
  3724. });
  3725. break;
  3726. case "requests":
  3727. case "incoming":
  3728. case "pending":
  3729. case "recieving":
  3730. axios.get("/worker2/friends").then((f) => {
  3731. if (f.data.error) bb.plugins.deafbot.send(`Error fetching friends: **${f.data.reason}**`);
  3732. else bb.plugins.deafbot.send(`You have **${f.data.receiving.length}** incoming requests: ${f.data.receiving.map((f2) => f2.username).join(", ")}`);
  3733. });
  3734. break;
  3735. case "requested":
  3736. case "outgoing":
  3737. case "sending":
  3738. axios.get("/worker2/friends").then((f) => {
  3739. if (f.data.error) bb.plugins.deafbot.send(`Error fetching friends: **${f.data.reason}**`);
  3740. else bb.plugins.deafbot.send(`You have **${f.data.sending.length}** outgoing requests: ${f.data.sending.map((f2) => f2.username).join(", ")}`);
  3741. });
  3742. break;
  3743. case "mutual":
  3744. if (!args2[1]) return bb.plugins.deafbot.send(`Tell me who you want to check for mutual friends, fool.`);
  3745. axios.get("/worker2/user/" + args2[1]).then((f) => {
  3746. if (f.data.error) bb.plugins.deafbot.send(`Error: **${f.data.reason}**`);
  3747. else bb.plugins.deafbot.send(`You and **${f.data.user.username}** have **${f.data.user.friends.length}** mutual friends: ${f.data.user.friends.map((f2) => blacket.friends.friends.find((fr) => fr.id === f2)).map((a) => a?.username).filter((a) => a).join(", ")}`);
  3748. });
  3749. break;
  3750. case "count":
  3751. axios.get("/worker2/friends").then((f) => {
  3752. if (f.data.error) bb.plugins.deafbot.send(`Error fetching friends: **${f.data.reason}**`);
  3753. else bb.plugins.deafbot.send(`You have **${f.data.friends.length}** friends.`);
  3754. });
  3755. break;
  3756. default:
  3757. bb.plugins.deafbot.send(`Subcommands: **list** ~ **request** ~ **accept** ~ **remove** ~ **check** ~ **mutual** ~ **requests** ~ **sending** ~ **count**`);
  3758. break;
  3759. }
  3760. };
  3761. const id = async (...args2) => {
  3762. if (args2[0]) axios.get("/worker2/user/" + args2[0]).then((u) => {
  3763. if (u.data.error) bb.plugins.deafbot.send(`Error: **${u.data.reason}**`);
  3764. else bb.plugins.deafbot.send(`**${u.data.user.username}**'s ID: ${u.data.user.id}`);
  3765. });
  3766. else bb.plugins.deafbot.send(`Your ID: ${blacket.user.id}`);
  3767. };
  3768. const level = async (...args2) => {
  3769. let calculate = (exp) => {
  3770. let level2 = 0;
  3771. let needed = 0;
  3772. for (let i = 0; i <= 27915; i++) {
  3773. needed = 5 * Math.pow(level2, blacket.config.exp.difficulty) * level2;
  3774. if (exp >= needed) {
  3775. exp -= needed;
  3776. level2++;
  3777. }
  3778. }
  3779. return { level: level2, needed, exp };
  3780. };
  3781. if (args2[0]) return axios.get("/worker2/user/" + args2[0]).then((u) => {
  3782. if (u.data.error) return bb.plugins.deafbot.send(`Error fetching user ${args2[0]}: **${u.data.reason}**`);
  3783. let levelData2 = calculate(u.data.user.exp);
  3784. bb.plugins.deafbot.send(`**${u.data.user.username}** is level **${levelData2.level}**. They need **${Math.round(levelData2.needed).toLocaleString()} XP** to advance, and they're currently **${Math.round(levelData2.exp / levelData2.needed * 100)}%** complete.`);
  3785. });
  3786. let levelData = blacket.user.level && blacket.user.needed ? blacket.user : calculate(blacket.user.exp);
  3787. bb.plugins.deafbot.send(`You are level **${levelData.level}**. You need **${Math.round(levelData.needed).toLocaleString()} XP** to advance, and you're currently **${Math.round(levelData.exp / levelData.needed * 100)}%** complete.`);
  3788. };
  3789. const tokens = async (...args2) => {
  3790. if (args2[0]) axios.get("/worker2/user/" + args2[0]).then((u) => {
  3791. if (u.data.error) bb.plugins.deafbot.send(`Error fetching user ${args2[0]}: **${u.data.reason}**`);
  3792. else bb.plugins.deafbot.send(`**${u.data.user.username}** currently has **${u.data.user.tokens.toLocaleString()}** tokens.`);
  3793. });
  3794. else bb.plugins.deafbot.send(`You currently have **${blacket.user.tokens.toLocaleString()}** tokens.`);
  3795. };
  3796. const trade = async (...args2) => {
  3797. if (!args2[0]) return bb.plugins.deafbot.send(`Who are you trying to trade, yourself?`);
  3798. axios.get("/worker2/user/" + args2[0]).then((u) => {
  3799. if (u.data.error) return bb.plugins.deafbot.send(`Error fetching user ${args2[0]}: **${u.data.reason}**`);
  3800. axios.post("/worker/trades/requests/send", { user: u.data.user.id.toString() }).then((r) => {
  3801. if (r.data.error) bb.plugins.deafbot.send(`Error sending trade request to ${u.data.user.username}: **${r.data.reason}**`);
  3802. else bb.plugins.deafbot.send(`Sent a trade request to **${u.data.user.username}**.`);
  3803. });
  3804. });
  3805. };
  3806. const commands = {
  3807. badges,
  3808. blocks,
  3809. blooks,
  3810. booster,
  3811. cheapest,
  3812. claim,
  3813. clan,
  3814. color,
  3815. eval: $eval,
  3816. friends,
  3817. id,
  3818. level,
  3819. tokens,
  3820. trade
  3821. };
  3822. const index$e = () => createPlugin({
  3823. name: "DeafBot",
  3824. description: "the chatbot you know and love.",
  3825. authors: [{ name: "Death", avatar: "https://i.imgur.com/PrvNWub.png", url: "https://villainsrule.xyz" }],
  3826. patches: [
  3827. {
  3828. file: "/lib/js/game.js",
  3829. replacement: [
  3830. {
  3831. match: /blacket\.sendMessage =\ async \((.*?)\) => \{/,
  3832. replace: `blacket.sendMessage = async (room, content, instantSend) => {
  3833. let rawContent = content.replace(/<(gradient=\\[(?:up|down|left|right|\\d{1,3}deg)(?: |):(?: |)(?:(?:(?:black|lime|white|brown|magenta|cyan|turquoise|red|orange|yellow|green|blue|purple|\\#[0-9a-fA-F]{6})(?:, |,| ,| , |)){2,7})\\]|black|lime|white|brown|magenta|cyan|turquoise|red|orange|yellow|green|blue|purple|(\\#[0-9a-fA-F]{6}))>(.+?)<\\/([^&]+?)>/g, (...args) => {
  3834. return args[3];
  3835. });
  3836. if (rawContent.startsWith(' ')) rawContent = rawContent.slice(1);
  3837.  
  3838. if (rawContent.startsWith(atob('JA==')) && !instantSend) {
  3839. let data = rawContent.split(' ');
  3840. let command = data[0].slice(1);
  3841. let args = data.slice(1);
  3842. console.log(\`Executed BB command "\${command}" with args\`, args);
  3843. if (!bb.plugins.deafbot.commands[command]) return bb.plugins.deafbot.send('Command not found.');
  3844. bb.plugins.deafbot.commands[command](...args);
  3845. return;
  3846. };
  3847. `
  3848. }
  3849. ]
  3850. }
  3851. ],
  3852. onLoad: () => {
  3853. bb.plugins.deafbot = {
  3854. send: (msg) => {
  3855. let prefix = "**$ sudo node deafbot.js** > > > ";
  3856. blacket.sendMessage(blacket.chat.room, prefix + msg, true);
  3857. },
  3858. commands
  3859. };
  3860. }
  3861. });
  3862. const __vite_glob_0_7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: index$e }, Symbol.toStringTag, { value: "Module" }));
  3863. const index$d = () => createPlugin({
  3864. name: "Double Leaderboard",
  3865. description: "see both leaderboards together.",
  3866. authors: [{ name: "Death", avatar: "https://i.imgur.com/PrvNWub.png", url: "https://villainsrule.xyz" }],
  3867. patches: [
  3868. {
  3869. file: "/lib/js/leaderboard.js",
  3870. replacement: [
  3871. {
  3872. match: /div:nth-child\(4\) > div:nth-child\(1\)/,
  3873. replace: "div:nth-child(3) > div:nth-child(2)"
  3874. },
  3875. {
  3876. match: /\$\(".styles__containerHeaderRight___3xghM-camelCase"/,
  3877. replace: `
  3878. document.querySelector('.styles__topStats___3qffP-camelCase').insertAdjacentHTML('afterend', \`<div class="styles__topStats___3qffP-camelCase" style="text-align: center;font-size: 2.604vw;margin-top: 0.521vw;display:block;"></div>\`);
  3879. document.querySelector('.styles__statsContainer___QnrRB-camelCase > div:nth-child(4)').remove();
  3880.  
  3881. $(".styles__containerHeaderRight___3xghM-camelCase"
  3882. `
  3883. },
  3884. {
  3885. match: / \(\$\{data.me.exp.ex(.*?)">\)/,
  3886. replace: ""
  3887. },
  3888. {
  3889. match: / \(\$\{data.ex(.*?)">\)/,
  3890. replace: ""
  3891. }
  3892. ]
  3893. }
  3894. ],
  3895. onStart: () => {
  3896. if (location.pathname.includes("leaderboard")) document.body.insertAdjacentHTML("beforeend", `<style>
  3897. .styles__statsContainer___QnrRB-camelCase > div:nth-child(3) {
  3898. display: flex;
  3899. gap: 2vw;
  3900. padding: 2vw 1.5vw;
  3901. }
  3902.  
  3903. .styles__topStats___3qffP-camelCase {
  3904. font-size: 1.8vw !important;
  3905. }
  3906.  
  3907. .styles__containerHeaderRight___3xghM-camelCase {
  3908. display: none;
  3909. }
  3910. </style>`);
  3911. }
  3912. });
  3913. const __vite_glob_0_8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: index$d }, Symbol.toStringTag, { value: "Module" }));
  3914. const index$c = () => createPlugin({
  3915. name: "Extra Stats",
  3916. description: "gives you extra stats for users.",
  3917. authors: [{ name: "Death", avatar: "https://i.imgur.com/PrvNWub.png", url: "https://villainsrule.xyz" }],
  3918. patches: [
  3919. {
  3920. file: "/lib/js/stats.js",
  3921. replacement: [
  3922. {
  3923. match: /\$\("#messages"\)\.html\(`\$\{user\.misc\.messages\.toLocaleString\(\)\}`\);/,
  3924. replace: `
  3925. $("#messages").html(user.misc.messages.toLocaleString());
  3926. $("#stat_id").html(user.id);
  3927. $("#stat_created").html(new Date(user.created * 1000).toLocaleString('en-US', {
  3928. year: '2-digit',
  3929. month: '2-digit',
  3930. day: '2-digit',
  3931. timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone
  3932. }));
  3933. $("#stat_lastonline").removeAttr('timestamped');
  3934. $("#stat_lastonline").text(\`<t:\${user.modified}:R>\`);
  3935. `
  3936. }
  3937. ]
  3938. }
  3939. ],
  3940. onLoad: () => {
  3941. if (location.pathname.startsWith("/stats")) document.querySelector(".styles__statsContainer___QnrRB-camelCase").insertAdjacentHTML("afterend", `
  3942. <div class="styles__statsContainer___QnrRB-camelCase">
  3943. <div class="styles__containerHeader___3xghM-camelCase">
  3944. <div class="styles__containerHeaderInside___2omQm-camelCase">Account</div>
  3945. </div>
  3946. <div class="styles__topStats___3qffP-camelCase">
  3947. <div class="styles__statContainer___QKuOF-camelCase" currentitem="false">
  3948. <div class="styles__statTitle___z4wSV-camelCase">ID</div>
  3949. <div id="stat_id" class="styles__statNum___5RYSd-camelCase">0</div>
  3950. <img loading="lazy" src="https://cdn-icons-png.flaticon.com/512/3596/3596097.png" class="styles__statImg___3DBXt-camelCase" draggable="false">
  3951. </div>
  3952. <div class="styles__statContainer___QKuOF-camelCase" currentitem="false">
  3953. <div class="styles__statTitle___z4wSV-camelCase">Created</div>
  3954. <div id="stat_created" class="styles__statNum___5RYSd-camelCase">0/0/0</div>
  3955. <img loading="lazy" src="https://cdn-icons-png.flaticon.com/512/4305/4305432.png" class="styles__statImg___3DBXt-camelCase" draggable="false">
  3956. </div>
  3957. <div class="styles__statContainer___QKuOF-camelCase" currentitem="false">
  3958. <div class="styles__statTitle___z4wSV-camelCase">Last Online</div>
  3959. <div id="stat_lastonline" class="styles__statNum___5RYSd-camelCase" style="font-size: 0.9vw;text-align:center;">0/0/0</div>
  3960. <img loading="lazy" src="https://cdn.discordapp.com/emojis/1102897525192663050.png?size=2048&quality=lossless" class="styles__statImg___3DBXt-camelCase" draggable="false">
  3961. </div>
  3962. </div>
  3963. </div>
  3964. `);
  3965. }
  3966. });
  3967. const __vite_glob_0_9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: index$c }, Symbol.toStringTag, { value: "Module" }));
  3968. const index$b = () => createPlugin({
  3969. name: "Highlight Rarity",
  3970. description: "displays the rarity of Bazaar blooks.",
  3971. authors: [{ name: "Death", avatar: "https://i.imgur.com/PrvNWub.png", url: "https://villainsrule.xyz" }],
  3972. patches: [
  3973. {
  3974. file: "/lib/js/bazaar.js",
  3975. replacement: [
  3976. {
  3977. match: /"\/content\/blooks\/Error\.png"\}" /,
  3978. replace: `"/content/blooks/Error.png"}" style="filter: drop-shadow(0 0 7px \${blacket.rarities[blacket.blooks[blook].rarity].color});" `
  3979. },
  3980. {
  3981. match: /class="styles__bazaarItemImage___KriA4-camelCase" /,
  3982. replace: `class="styles__bazaarItemImage___KriA4-camelCase" \${blacket.blooks[listing.item] ? \`style="filter: drop-shadow(0 0 7px \${blacket.rarities[blacket.blooks[listing.item].rarity].color});"\` : ''} `
  3983. }
  3984. ]
  3985. }
  3986. ]
  3987. });
  3988. const __vite_glob_0_10 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: index$b }, Symbol.toStringTag, { value: "Module" }));
  3989. const index$a = () => createPlugin({
  3990. name: "Internals",
  3991. description: "the internals of BetterBlacket.",
  3992. authors: [{ name: "Internal" }],
  3993. required: true,
  3994. patches: [
  3995. {
  3996. file: "/lib/js/home.js",
  3997. replacement: [
  3998. {
  3999. match: /blacket\.stopLoading\(\);/,
  4000. replace: "blacket.stopLoading();bb.events.dispatch('pageInit');"
  4001. },
  4002. {
  4003. match: /if \(blacket\.config\)/,
  4004. replace: "if (window?.blacket?.config)"
  4005. }
  4006. ]
  4007. },
  4008. {
  4009. file: "/lib/js/auth.js",
  4010. replacement: [
  4011. {
  4012. match: /blacket\.htmlEncode\s*=\s*\(\s*s\s*\)\s*=>\s*{/,
  4013. replace: "bb.events.dispatch('pageInit');blacket.htmlEncode = (s) => {"
  4014. },
  4015. {
  4016. match: /blacket\.config/,
  4017. replace: "window?.blacket?.config"
  4018. }
  4019. ]
  4020. },
  4021. {
  4022. file: "/lib/js/terms.js",
  4023. replacement: [
  4024. {
  4025. match: /blacket\.stopLoading\(\);/,
  4026. replace: "blacket.stopLoading();bb.events.dispatch('pageInit');"
  4027. },
  4028. {
  4029. match: /blacket\.config/,
  4030. replace: "window?.blacket?.config"
  4031. }
  4032. ]
  4033. },
  4034. {
  4035. file: "/lib/js/stats.js",
  4036. replacement: [
  4037. {
  4038. match: /blacket\.setUser\(blacket\.user\)\;/,
  4039. replace: "blacket.setUser(blacket.user);bb.events.dispatch('pageInit');"
  4040. },
  4041. {
  4042. match: /blacket\.user\s*&&\s*blacket\.friends/,
  4043. replace: "window?.blacket?.user && window?.blacket?.friends"
  4044. }
  4045. ]
  4046. },
  4047. {
  4048. file: "/lib/js/leaderboard.js",
  4049. replacement: [
  4050. {
  4051. match: /blacket\.stopLoading\(\);/,
  4052. replace: "blacket.stopLoading();bb.events.dispatch('pageInit');"
  4053. },
  4054. {
  4055. match: /if \(blacket\.user\) \{/,
  4056. replace: "if (window?.blacket?.user) {"
  4057. }
  4058. ]
  4059. },
  4060. {
  4061. file: "/lib/js/clans/my-clan.js",
  4062. replacement: [
  4063. {
  4064. match: /\$\("#clanInvestmentsButton"\)\.click\(\(\) \=\> \{/,
  4065. replace: `bb.events.dispatch('pageInit');$("#clanInvestmentsButton").click(() => {`
  4066. },
  4067. {
  4068. match: /if \(blacket\.user\) \{/,
  4069. replace: "if (window?.blacket?.user) {"
  4070. },
  4071. {
  4072. match: /item.user\).avatar/,
  4073. replace: `item.user)?.avatar || '/content/blooks/Error.png'`
  4074. }
  4075. ]
  4076. },
  4077. {
  4078. file: "/lib/js/clans/discover.js",
  4079. replacement: [
  4080. {
  4081. match: /blacket\.stopLoading\(\)\;/,
  4082. replace: "blacket.stopLoading();bb.events.dispatch('pageInit');"
  4083. },
  4084. {
  4085. match: /if \(blacket\.user\) \{/,
  4086. replace: "if (window?.blacket?.user) {"
  4087. }
  4088. ]
  4089. },
  4090. {
  4091. file: "/lib/js/market.js",
  4092. replacement: [
  4093. {
  4094. match: /blacket\.showBuyItemModal =/,
  4095. replace: "bb.events.dispatch('pageInit');blacket.showBuyItemModal ="
  4096. },
  4097. {
  4098. match: /if \(blacket\.user\) \{/,
  4099. replace: "if (window?.blacket?.user) {"
  4100. }
  4101. ]
  4102. },
  4103. {
  4104. file: "/lib/js/blooks.js",
  4105. replacement: [
  4106. {
  4107. match: /blacket\.appendBlooks\(\)\;/,
  4108. replace: "blacket.appendBlooks();bb.events.dispatch('pageInit');"
  4109. },
  4110. {
  4111. match: /if \(blacket\.user\) \{/,
  4112. replace: "if (window?.blacket?.user) {"
  4113. }
  4114. ]
  4115. },
  4116. {
  4117. file: "/lib/js/bazaar.js",
  4118. replacement: [
  4119. {
  4120. match: /\}\);\s*blacket\.getBazaar\(\);/,
  4121. replace: "});blacket.getBazaar();bb.events.dispatch('pageInit');"
  4122. },
  4123. {
  4124. match: /if \(blacket\.user\) \{/,
  4125. replace: "if (window?.blacket?.user) {"
  4126. }
  4127. ]
  4128. },
  4129. {
  4130. file: "/lib/js/inventory.js",
  4131. replacement: [
  4132. {
  4133. match: /blacket\.stopLoading\(\);\s*\}\s*else\s*setTimeout\(reset,\s*1\);/,
  4134. replace: "blacket.stopLoading();bb.events.dispatch('pageInit');} else setTimeout(reset, 1);"
  4135. },
  4136. {
  4137. match: /if \(blacket\.user\) \{/,
  4138. replace: "if (window?.blacket?.user) {"
  4139. }
  4140. ]
  4141. },
  4142. {
  4143. file: "/lib/js/settings.js",
  4144. replacement: [
  4145. {
  4146. match: /\$\(\"#tradeRequestsButton\"\).click\(\(\) \=\> \{/,
  4147. replace: `bb.events.dispatch('pageInit');$("#tradeRequestsButton").click(() => {`
  4148. },
  4149. {
  4150. match: /if \(blacket\.user\) \{/,
  4151. replace: "if (window?.blacket?.user) {"
  4152. }
  4153. ]
  4154. },
  4155. {
  4156. file: "/lib/js/store.js",
  4157. replacement: [
  4158. {
  4159. match: /\$\("#buy1hBoosterButton"\)\.click\(\(\) => \{/,
  4160. replace: `bb.events.dispatch('pageInit');$("#buy1hBoosterButton").click(() => {`
  4161. },
  4162. {
  4163. match: /if \(blacket\.user\) \{/,
  4164. replace: "if (window?.blacket?.user) {"
  4165. }
  4166. ]
  4167. },
  4168. {
  4169. file: "/lib/js/credits.js",
  4170. replacement: [
  4171. {
  4172. match: /blacket\.stopLoading\(\)\;/,
  4173. replace: "blacket.stopLoading();bb.events.dispatch('pageInit');"
  4174. },
  4175. {
  4176. match: /blacket\.config/,
  4177. replace: "window?.blacket?.config"
  4178. }
  4179. ]
  4180. },
  4181. {
  4182. file: "/lib/js/trade.js",
  4183. replacement: [
  4184. {
  4185. match: /blacket\.appendBlooks\(\)\;/,
  4186. replace: "blacket.appendBlooks();bb.events.dispatch('pageInit');"
  4187. },
  4188. {
  4189. match: /blacket\.user\s*&&\s*blacket\.trade/,
  4190. replace: "window?.blacket?.user && window?.blacket?.trade"
  4191. }
  4192. ]
  4193. },
  4194. {
  4195. file: "/lib/js/all.js",
  4196. replacement: [
  4197. {
  4198. match: /blacket\s*=\s*{/,
  4199. replace: "window.blacket = {"
  4200. },
  4201. {
  4202. match: /mutation\.type === "childList" \? replace/,
  4203. replace: "false ? "
  4204. }
  4205. ]
  4206. },
  4207. {
  4208. file: "/lib/js/game.js",
  4209. replacement: [
  4210. {
  4211. match: /blacket\.config\s*&&\s*blacket\.socket/,
  4212. replace: "window?.blacket?.config && window?.blacket?.socket"
  4213. },
  4214. {
  4215. match: /data\.author\.badges = \[/,
  4216. replace: `if (typeof data.author.badges !== 'object' && !data?.author?.badges?.length) data.author.badges = [`
  4217. },
  4218. {
  4219. match: /data\.friends/,
  4220. replace: `data.friends.filter(f => f.username !== '£')`
  4221. },
  4222. {
  4223. match: /forEach\(post \=\> \{/,
  4224. replace: `forEach(post => {blacket.news[post].body=blacket.news[post].body.replace(/\\<iframe.*?iframe>/, '');`
  4225. }
  4226. ]
  4227. },
  4228. {
  4229. file: "/lib/js/panel/home.js",
  4230. replacement: [
  4231. {
  4232. match: /blacket\.user\)/,
  4233. replace: "window.blacket?.user)"
  4234. },
  4235. {
  4236. match: /Loading\(\)/,
  4237. replace: `Loading();bb.events.dispatch('pageInit')`
  4238. }
  4239. ]
  4240. },
  4241. {
  4242. file: "/lib/js/panel/console.js",
  4243. replacement: [
  4244. {
  4245. match: /blacket\.user && blacket\.socket/,
  4246. replace: `window.blacket?.user && window.blacket?.socket`
  4247. },
  4248. {
  4249. match: /blacket\.socket\.on/,
  4250. replace: `bb.events.dispatch('pageInit');blacket.socket.on`
  4251. }
  4252. ]
  4253. },
  4254. {
  4255. file: "/lib/js/panel/blooks.js",
  4256. replacement: [
  4257. {
  4258. match: /blacket\.config/,
  4259. replace: "window?.blacket?.config"
  4260. },
  4261. {
  4262. match: /\$\("#createButtonBlook"\)\.c/,
  4263. replace: `bb.events.dispatch('pageInit');$("#createButtonBlook").c`
  4264. }
  4265. ]
  4266. },
  4267. {
  4268. file: "/lib/js/panel/rarities.js",
  4269. replacement: [
  4270. {
  4271. match: /blacket\.config && blacket\.user && blacket\.rarities/,
  4272. replace: "window?.blacket?.config && window?.blacket?.user && window?.blacket?.rarities"
  4273. },
  4274. {
  4275. match: /\$\("\#createButtonRarity"\)\.c/,
  4276. replace: `bb.events.dispatch('pageInit');$("#createButtonRarity").c`
  4277. }
  4278. ]
  4279. },
  4280. {
  4281. file: "/lib/js/panel/badges.js",
  4282. replacement: [
  4283. {
  4284. match: /blacket\.config/,
  4285. replace: "window?.blacket?.config"
  4286. },
  4287. {
  4288. match: /blacket\.createBadge \=/,
  4289. replace: `bb.events.dispatch('pageInit');blacket.createBadge = `
  4290. }
  4291. ]
  4292. },
  4293. {
  4294. file: "/lib/js/panel/banners.js",
  4295. replacement: [
  4296. {
  4297. match: /blacket\.config && blacket\.banners/,
  4298. replace: "window?.blacket?.config && window?.blacket?.banners"
  4299. },
  4300. {
  4301. match: /\$\("\#createButtonBanner"\)\.c/,
  4302. replace: `bb.events.dispatch('pageInit');$("#createButtonBanner").c`
  4303. }
  4304. ]
  4305. },
  4306. {
  4307. file: "/lib/js/panel/news.js",
  4308. replacement: [
  4309. {
  4310. match: /blacket\.user && blacket\.news/,
  4311. replace: "window?.blacket?.user && window?.blacket?.news"
  4312. },
  4313. {
  4314. match: /localStorage/,
  4315. replace: "bb.events.dispatch('pageInit');localStorage"
  4316. }
  4317. ]
  4318. },
  4319. {
  4320. file: "/lib/js/panel/emojis.js",
  4321. replacement: [
  4322. {
  4323. match: /blacket\.config/,
  4324. replace: "window?.blacket?.config"
  4325. },
  4326. {
  4327. match: /blacket.showEditModal =/,
  4328. replace: "bb.events.dispatch('pageInit');blacket.showEditModal ="
  4329. }
  4330. ]
  4331. },
  4332. {
  4333. file: "/lib/js/panel/users.js",
  4334. replacement: [
  4335. {
  4336. match: /blacket\.user\) \{/,
  4337. replace: "window?.blacket?.user) {"
  4338. },
  4339. {
  4340. match: /blacket.setUser =/,
  4341. replace: "bb.events.dispatch('pageInit');blacket.setUser ="
  4342. }
  4343. ]
  4344. },
  4345. {
  4346. file: "/lib/js/panel/forms.js",
  4347. replacement: [
  4348. {
  4349. match: /blacket.config/,
  4350. replace: "window?.blacket?.config"
  4351. },
  4352. {
  4353. match: /blacket.reject =/,
  4354. replace: "bb.events.dispatch('pageInit');blacket.reject ="
  4355. }
  4356. ]
  4357. }
  4358. ],
  4359. styles: `
  4360. .bb_topLeftRow {
  4361. position: absolute;
  4362. top: 0;
  4363. left: 11.5vw;
  4364. display: flex;
  4365. flex-direction: row;
  4366. z-index: 14;
  4367. margin: 0.5vw;
  4368. gap: 0.5vw;
  4369. }
  4370.  
  4371. .bb_backButtonContainer {
  4372. position: relative;
  4373. cursor: pointer;
  4374. outline: none;
  4375. user-select: none;
  4376. text-decoration: none;
  4377. transition: filter 0.25s;
  4378. margin-left: 0.521vw;
  4379. margin: auto;
  4380. }
  4381.  
  4382. .bb_settingsContainer {
  4383. display: flex;
  4384. flex-flow: row wrap;
  4385. justify-content: flex-start;
  4386. margin: 0.260vw calc(5% - 0.625vw);
  4387. width: calc(90% - 1.250vw);
  4388. max-width: 62.500vw;
  4389. }
  4390.  
  4391. .bb_pluginContainer {
  4392. border-radius: 0.365vw;
  4393. background-color: #2f2f2f;
  4394. padding: 0.781vw 1.042vw 1.146vw;
  4395. box-shadow: inset 0 -0.365vw rgba(0, 0, 0, 0.2), 0 0 0.208vw rgba(0, 0, 0, 0.15);
  4396. margin: 0.625vw;
  4397. min-width: 23.958vw;
  4398. display: flex;
  4399. flex-direction: column;
  4400. color: #ffffff;
  4401. width: 27.5vw;
  4402. }
  4403.  
  4404. .bb_pluginHeader {
  4405. display: flex;
  4406. align-items: center;
  4407. gap: 1vw;
  4408. }
  4409.  
  4410. .bb_pluginTitle {
  4411. width: 100%;
  4412. }
  4413.  
  4414. .bb_pluginDescription {
  4415. margin-top: 0.7vh;
  4416. font-size: 2.3vh;
  4417. }
  4418.  
  4419. .switch {
  4420. position: relative;
  4421. display: inline-block;
  4422. min-width: 30px;
  4423. max-width: 30px;
  4424. height: 17px;
  4425. }
  4426.  
  4427. .switch input {
  4428. opacity: 0;
  4429. width: 0;
  4430. height: 0;
  4431. }
  4432.  
  4433. .slider {
  4434. position: absolute;
  4435. cursor: pointer;
  4436. top: 0;
  4437. left: 0;
  4438. right: 0;
  4439. bottom: 0;
  4440. background-color: #ccc;
  4441. transition: .4s;
  4442. border-radius: 34px;
  4443. }
  4444.  
  4445. .slider:before {
  4446. position: absolute;
  4447. content: "";
  4448. height: 13px;
  4449. min-width: 13px;
  4450. max-width: 13px;
  4451. left: 2px;
  4452. bottom: 2px;
  4453. background-color: white;
  4454. -webkit-transition: .4s;
  4455. transition: .4s;
  4456. border-radius: 50%;
  4457. }
  4458.  
  4459. input:checked + .slider {
  4460. background-color: #2196F3;
  4461. }
  4462.  
  4463. input:focus + .slider {
  4464. box-shadow: 0 0 1px #2196F3;
  4465. }
  4466.  
  4467. input:checked + .slider:before {
  4468. transform: translateX(13px);
  4469. }
  4470.  
  4471. .bb_requiredPluginSlider {
  4472. background-color: #075c9f;
  4473. cursor: not-allowed;
  4474. }
  4475.  
  4476. .bb_pluginIcon {
  4477. cursor: pointer;
  4478. }
  4479.  
  4480. .bb_pluginAuthors {
  4481. display: flex;
  4482. justify-content: center;
  4483. cursor: pointer;
  4484. margin-top: 1vw;
  4485. margin-right: 6px;
  4486. font-weight: bold;
  4487. }
  4488.  
  4489. .bb_pluginAuthor {
  4490. height: 22px;
  4491. border-radius: 50%;
  4492. margin-right: -6px;
  4493. border: 2px solid #3f3f3f;
  4494. }
  4495.  
  4496. .bb_themeInfo {
  4497. font-family: Nunito, sans-serif;
  4498. line-height: 1.823vw;
  4499. margin: 1.5vh 0 5px 0;
  4500. color: #ffffff;
  4501. font-size: 1.6vw;
  4502. }
  4503.  
  4504. .bb_themeHeader {
  4505. font-family: Nunito, sans-serif;
  4506. line-height: 1.823vw;
  4507. margin: 3.5vw 0 5px 0;
  4508. color: #ffffff;
  4509. font-size: 2.75vw;
  4510. }
  4511.  
  4512. .bb_themeTextarea {
  4513. min-height: 30vh;
  4514. height: auto;
  4515. width: 100%;
  4516. background: #2f2f2f;
  4517. border: 2px solid #1f1f1f;
  4518. border-radius: 3px;
  4519. color: white;
  4520. padding: 10px;
  4521. margin-top: 2.5vh;
  4522. outline: none;
  4523. resize: none;
  4524. }
  4525.  
  4526. .styles__container___1BPm9-camelCase {
  4527. width: 25vw;
  4528. }
  4529.  
  4530. .bb_bigModal {
  4531. position: absolute;
  4532. top: 50%;
  4533. left: 50%;
  4534. transform: translate(-50%, -50%);
  4535. width: 50%;
  4536. background-color: #3f3f3f;
  4537. border-radius: 0.365vw;
  4538. text-align: center;
  4539. box-sizing: border-box;
  4540. padding-bottom: 0.365vw;
  4541. box-shadow: inset 0 -0.365vw rgba(0, 0, 0, 0.2), 0 0 0.208vw rgba(0, 0, 0, 0.15);
  4542. }
  4543.  
  4544. .bb_bigModalTitle {
  4545. font-family: Nunito, sans-serif;
  4546. font-size: 2.8vw;
  4547. line-height: 1.823vw;
  4548. font-weight: 700;
  4549. margin: 2vw 1.563vw;
  4550. color: #ffffff;
  4551. }
  4552.  
  4553. .bb_bigModalDescription {
  4554. font-family: Nunito, sans-serif;
  4555. line-height: 1.823vw;
  4556. font-weight: 700;
  4557. margin: -3px 0 5px 0;
  4558. color: #ffffff;
  4559. font-size: 1.6vw;
  4560. }
  4561.  
  4562. .bb_bigModalDivider {
  4563. height: 1.5px;
  4564. border-top: 1px solid var(--ss-white);
  4565. border-radius: 10px;
  4566. width: 90%;
  4567. margin: 2vh 5%;
  4568. }
  4569.  
  4570. .bb_bigModalHeader {
  4571. font-family: Nunito, sans-serif;
  4572. font-size: 2vw;
  4573. line-height: 1.823vw;
  4574. font-weight: 700;
  4575. margin: 1.8vw 1.3vw;
  4576. color: #ffffff;
  4577. }
  4578.  
  4579. .bb_modalDescription {
  4580. font-family: Nunito, sans-serif;
  4581. line-height: 1.823vw;
  4582. font-weight: 700;
  4583. margin: -7px 0 5px 0;
  4584. color: #ffffff;
  4585. font-size: 1vw;
  4586. padding: 0 1vw;
  4587. }
  4588.  
  4589. .bb_modalOuterInput {
  4590. border: 0.156vw solid rgba(0, 0, 0, 0.17);
  4591. border-radius: 0.313vw;
  4592. width: 90%;
  4593. height: 2.604vw;
  4594. margin: 0.000vw;
  4595. display: flex;
  4596. flex-direction: row;
  4597. align-items: center;
  4598. }
  4599.  
  4600. .bb_modalInput {
  4601. border: none;
  4602. height: 2.083vw;
  4603. line-height: 2.083vw;
  4604. font-size: 1.458vw;
  4605. text-align: center;
  4606. font-weight: 700;
  4607. font-family: Nunito, sans-serif;
  4608. color: #ffffff;
  4609. background-color: #3f3f3f;
  4610. outline: none;
  4611. width: 100%;
  4612. }
  4613.  
  4614. .bb_pluginSettings {
  4615. display: flex;
  4616. align-items: center;
  4617. flex-direction: column;
  4618. gap: 1vh;
  4619. }
  4620.  
  4621. .bb_pluginSetting {
  4622. display: flex;
  4623. align-items: center;
  4624. gap: 1.5vw;
  4625. }
  4626.  
  4627. .bb_settingName {
  4628. color: white;
  4629. font-size: 1.8vw;
  4630. }
  4631. `,
  4632. onStart: () => {
  4633. let mods = {
  4634. "BetterBlacket v2": () => !!(window.pr || window.addCSS),
  4635. "Flybird": () => !!window.gold,
  4636. "Themeify": () => !!document.querySelector("#themifyButton"),
  4637. "Blacket++": () => !!(window.BPP || window.bpp)
  4638. };
  4639. if (Object.entries(mods).some((mod2) => mod2[1]() ? true : false)) return document.body.insertAdjacentHTML("beforeend", `
  4640. <div class="arts__modal___VpEAD-camelCase" id="bigModal">
  4641. <div class="bb_bigModal">
  4642. <div class="bb_bigModalTitle">External Mod Detected</div>
  4643. <div class="bb_bigModalDescription" style="padding-bottom: 1vw;">Our automated systems believe you are running the ${mod[0]} mod. We require that only BetterBlacket v3 is running. This prevents unneeded "IP abuse bans" from Blacket's systems.</div>
  4644. </div>
  4645. </div>
  4646. `);
  4647. if (!location.pathname.startsWith("/settings")) return;
  4648. console.log("Internals started! Patching settings...");
  4649. document.querySelector(".styles__mainContainer___4TLvi-camelCase").id = "settings-main";
  4650. $(`
  4651. <div class="styles__infoContainer___2uI-S-camelCase">
  4652. <div class="styles__headerRow___1tdPa-camelCase">
  4653. <i class="fas fa-code styles__headerIcon___1ykdN-camelCase" aria-hidden="true"></i>
  4654. <div class="styles__infoHeader___1lsZY-camelCase">BetterBlacket</div>
  4655. </div>
  4656. <div><a id="pluginsButton" class="styles__link___5UR6_-camelCase">Manage Plugins</a></div>
  4657. <div><a id="themesButton" class="styles__link___5UR6_-camelCase">Manage Themes</a></div>
  4658. <div><a id="resetDataButton" class="styles__link___5UR6_-camelCase">Reset Data</a></div>
  4659. </div>
  4660. `).insertBefore($(".styles__infoContainer___2uI-S-camelCase")[0]);
  4661. document.querySelector("#app > div > div").insertAdjacentHTML("beforeend", `
  4662. <div class="bb_topLeftRow">
  4663. <div class="bb_backButtonContainer" style="display: none;">
  4664. <div class="styles__shadow___3GMdH-camelCase"></div>
  4665. <div class="styles__edge___3eWfq-camelCase" style="background-color: #2f2f2f;"></div>
  4666. <div class="styles__front___vcvuy-camelCase styles__buttonInsideNoMinWidth___39vdp-camelCase" style="background-color: #2f2f2f;">
  4667. <i class="fas fa-reply" aria-hidden="true"></i>
  4668. </div>
  4669. </div>
  4670. </div>
  4671. `);
  4672. $("#resetDataButton").click(async () => {
  4673. Object.keys(localStorage).forEach((key) => localStorage.removeItem(key));
  4674. location.reload();
  4675. });
  4676. $("#pluginsButton").click(() => {
  4677. document.querySelector("#settings-main").style.display = "none";
  4678. document.querySelector("#plugins-main").style.display = "";
  4679. document.querySelector(".styles__header___WE435-camelCase").innerHTML = "Settings | Plugins";
  4680. document.querySelector(".styles__header___WE435-camelCase").style.textAlign = "center";
  4681. document.querySelector(".bb_backButtonContainer").style.display = "";
  4682. });
  4683. $("#themesButton").click(() => {
  4684. document.querySelector("#settings-main").style.display = "none";
  4685. document.querySelector("#themes-main").style.display = "";
  4686. document.querySelector(".styles__header___WE435-camelCase").innerHTML = "Settings | Themes";
  4687. document.querySelector(".styles__header___WE435-camelCase").style.textAlign = "center";
  4688. document.querySelector(".bb_backButtonContainer").style.display = "";
  4689. });
  4690. $(".bb_backButtonContainer").click(() => {
  4691. document.querySelector("#settings-main").style.display = "";
  4692. document.querySelector("#plugins-main").style.display = "none";
  4693. document.querySelector("#themes-main").style.display = "none";
  4694. document.querySelector(".styles__header___WE435-camelCase").innerHTML = "Settings";
  4695. document.querySelector(".styles__header___WE435-camelCase").style.textAlign = "";
  4696. document.querySelector(".bb_backButtonContainer").style.display = "none";
  4697. });
  4698. let activePlugins = bb.storage.get("bb_pluginData", true).active;
  4699. let themeData = bb.storage.get("bb_themeData", true);
  4700. $(".arts__profileBody___eNPbH-camelCase").append(`
  4701. <div class="bb_settingsContainer" id="plugins-main" style="display: none;">
  4702. ${bb.plugins.list.filter((p) => !p.required && !p.disabled).map((p) => `
  4703. <div class="bb_pluginContainer">
  4704. <div class="bb_pluginHeader">
  4705. <div class="bb_pluginTitle">${p.name}</div>
  4706. ${p.settings.length ? `<i id="bb_pluginIcon_${p.name.replaceAll(" ", "-")}" class="fas fa-gear bb_pluginIcon" aria-hidden="true"></i>` : `<i id="bb_pluginIcon_${p.name.replaceAll(" ", "-")}" class="far fa-circle-info bb_pluginIcon" aria-hidden="true"></i>`}
  4707. <label class="switch">
  4708. <input type="checkbox" ${activePlugins.includes(p.name) || p.required ? "checked" : ""} id="bb_pluginCheckbox_${p.name.replaceAll(" ", "-")}">
  4709. <span class="${p.required ? "slider bb_requiredPluginSlider" : "slider"}"></span>
  4710. </label>
  4711. </div>
  4712. <div class="bb_pluginDescription">${p.description}</div>
  4713. </div>
  4714. `).join("")}
  4715. </div>
  4716.  
  4717. <div class="bb_settingsContainer" id="themes-main" style="display: none;">
  4718. <div class="bb_themeInfo"><b>Paste CSS file links here.</b><br> - Paste one link per line.<br> - Use raw CSS files, like from "raw.githubusercontent.com" or "github.io".<br> - Put "//" in front of a theme link to ignore it.</div>
  4719. <textarea class="bb_themeTextarea">${themeData?.textarea ? themeData.textarea : "https://blacket.org/lib/css/all.css\nhttps://blacket.org/lib/css/game.css"}</textarea>
  4720. <div class="bb_themeHeader">Theme Checker</div>
  4721. <div class="bb_themeValidation">
  4722. ${bb.themes.list.map((t) => `<div class="bb_themeInfo" style="color: green;">${t.name} | ${t.url}</div>`).join("")}
  4723. ${bb.themes.broken.map((t) => `<div class="bb_themeInfo" style="color: red;">${t.url} - ${t.reason}</div>`).join("")}
  4724. </div>
  4725. </div>
  4726. `);
  4727. document.querySelector(".bb_themeTextarea").oninput = (ev) => {
  4728. bb.storage.set("bb_themeData", {
  4729. active: ev.target.value.split("\\n").filter((a) => !a.startsWith("//")),
  4730. textarea: ev.target.value
  4731. }, true);
  4732. bb.themes.reload();
  4733. };
  4734. bb.events.listen("themeUpdate", () => {
  4735. document.querySelector(".bb_themeValidation").innerHTML = `
  4736. ${bb.themes.list.map((t) => `<div class="bb_themeInfo" style="color: green;">${t.name} | ${t.url}</div>`).join("")}
  4737. ${bb.themes.broken.map((t) => `<div class="bb_themeInfo" style="color: red;">${t.url} - ${t.reason}</div>`).join("")}
  4738. `;
  4739. });
  4740. let storedPluginData = bb.storage.get("bb_pluginData", true);
  4741. bb.plugins.list.forEach((p) => {
  4742. if (p.required || p.disabled) return;
  4743. document.querySelector(`#bb_pluginCheckbox_${p.name.replaceAll(" ", "-")}`).onchange = (ev) => {
  4744. if (p.required) return ev.target.checked = true;
  4745. const inform = () => blacket.createToast({
  4746. title: "Pending Changes",
  4747. message: "You have changes in your plugins you have not applied. Reload to apply.",
  4748. time: 5e3
  4749. });
  4750. inform();
  4751. setInterval(() => inform(), 1e4);
  4752. bb.plugins.pendingChanges = true;
  4753. if (storedPluginData.active.includes(p.name)) storedPluginData.active.splice(storedPluginData.active.indexOf(p.name), 1);
  4754. else storedPluginData.active.push(p.name);
  4755. bb.storage.set("bb_pluginData", storedPluginData, true);
  4756. };
  4757. document.querySelector(`#bb_pluginIcon_${p.name.replaceAll(" ", "-")}`).onclick = () => {
  4758. document.body.insertAdjacentHTML("beforeend", `
  4759. <div class="arts__modal___VpEAD-camelCase" id="bigModal">
  4760. <div class="bb_bigModal">
  4761. <div class="bb_bigModalTitle">${p.name}</div>
  4762. <div class="bb_bigModalDescription">${p.description}</div>
  4763. <div class="bb_pluginAuthors">${p.authors.map((a) => `<img src="${a.avatar}" onclick="window.open('${a.url}', '_blank')" class="bb_pluginAuthor" />`).join("")}</div>
  4764. <hr class="bb_bigModalDivider" />
  4765. <div class="bb_bigModalHeader">Settings</div>
  4766. ${p.settings.length ? `<div class="bb_pluginSettings">
  4767. ${p.settings.map((set) => `
  4768. <div class="bb_pluginSetting">
  4769. <div class="bb_settingName">${set.name}</div>
  4770. <label class="switch">
  4771. <input type="checkbox" ${typeof storedPluginData.settings?.[p.name]?.[set.name] === "boolean" ? storedPluginData.settings?.[p.name]?.[set.name] ? "checked" : "" : set.default ? "checked" : ""} id="bb_settingCheck_${p.name.replaceAll(" ", "-")}_${set.name.replaceAll(" ", "-")}">
  4772. <span class="slider"></span>
  4773. </label>
  4774. </div>
  4775. `).join("")}
  4776. </div>` : `<div class="bb_modalDescription">This plugin has no settings.</div>`}
  4777. <hr class="bb_bigModalDivider" />
  4778. <div class="styles__button___1_E-G-camelCase styles__button___3zpwV-camelCase" role="button" tabindex="0" onclick="document.getElementById('bigModal').remove()" style="width: 30%;margin-bottom: 1.5vh;">
  4779. <div class="styles__shadow___3GMdH-camelCase"></div>
  4780. <div class="styles__edge___3eWfq-camelCase" style="background-color: #2f2f2f;"></div>
  4781. <div class="styles__front___vcvuy-camelCase styles__buttonInside___39vdp-camelCase" style="background-color: #2f2f2f;">Close</div>
  4782. </div>
  4783. </div>
  4784. </div>
  4785. `);
  4786. p.settings.forEach((setting) => {
  4787. document.querySelector(`#bb_settingCheck_${p.name.replaceAll(" ", "-")}_${setting.name.replaceAll(" ", "-")}`).onchange = (ev) => {
  4788. if (!storedPluginData.settings) storedPluginData.settings = {};
  4789. if (!storedPluginData.settings[p.name]) storedPluginData.settings[p.name] = {};
  4790. storedPluginData.settings[p.name][setting.name] = ev.target.checked;
  4791. bb.plugins.settings[p.name][setting.name] = ev.target.checked;
  4792. bb.storage.set("bb_pluginData", storedPluginData, true);
  4793. };
  4794. });
  4795. };
  4796. });
  4797. }
  4798. });
  4799. const __vite_glob_0_11 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: index$a }, Symbol.toStringTag, { value: "Module" }));
  4800. const index$9 = () => createPlugin({
  4801. name: "Message Logger",
  4802. description: "view deleted messages like a staff would.",
  4803. authors: [{ name: "Death", avatar: "https://i.imgur.com/PrvNWub.png", url: "https://villainsrule.xyz" }],
  4804. disabled: true,
  4805. patches: [
  4806. {
  4807. file: "/lib/js/game.js",
  4808. replacement: [
  4809. {
  4810. match: /blacket\.user\.perms\.includes\("delete_messages"\) \|\| blacket\.user\.perms\.includes\("\*"\)/,
  4811. replace: "true"
  4812. }
  4813. ]
  4814. }
  4815. ]
  4816. });
  4817. const __vite_glob_0_12 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: index$9 }, Symbol.toStringTag, { value: "Module" }));
  4818. const index$8 = () => createPlugin({
  4819. name: "No Chat Color",
  4820. description: "disables color in chat.",
  4821. authors: [{ name: "Syfe", avatar: "https://i.imgur.com/OKpOipQ.gif", url: "https://github.com/ItsSyfe" }],
  4822. patches: [
  4823. {
  4824. file: "/lib/js/game.js",
  4825. replacement: [
  4826. {
  4827. match: /\$\{data\.author\.color/,
  4828. replace: `\${"#ffffff"`,
  4829. setting: "No Username Colors"
  4830. },
  4831. {
  4832. match: /\$\{blacket\.chat\.cached\.users\[id\]\.color/,
  4833. replace: `\${"#ffffff"`,
  4834. setting: "No Mention Colors"
  4835. },
  4836. {
  4837. match: /\!data\.author\.permissions\.includes\("use_chat_colors"\)/,
  4838. replace: `bb.plugins.settings['No Chat Color']?.['No Message Colors'] ?? true`,
  4839. setting: "No Message Colors"
  4840. },
  4841. {
  4842. match: /\$\{data\.author\.clan\.color\}/,
  4843. replace: `\${"#ffffff"}`,
  4844. setting: "No Clan Colors"
  4845. }
  4846. ]
  4847. }
  4848. ],
  4849. settings: [
  4850. { name: "No Username Colors", default: true },
  4851. { name: "No Mention Colors", default: true },
  4852. { name: "No Message Colors", default: true },
  4853. { name: "No Clan Colors", default: true }
  4854. ]
  4855. });
  4856. const __vite_glob_0_13 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: index$8 }, Symbol.toStringTag, { value: "Module" }));
  4857. const index$7 = () => createPlugin({
  4858. name: "No Chat Ping",
  4859. description: "prevents you from being pinged in chat.",
  4860. authors: [{ name: "Death", avatar: "https://i.imgur.com/PrvNWub.png", url: "https://villainsrule.xyz" }],
  4861. patches: [
  4862. {
  4863. file: "/lib/js/game.js",
  4864. replacement: [
  4865. {
  4866. match: /message\.message\.mentions\.includes\(\w+\.user\.id\.toString\(\)\)/,
  4867. replace: "false"
  4868. },
  4869. {
  4870. match: /data\.data\.message\.mentions\.includes\(blacket\.user\.id\.toString\(\)\)/,
  4871. replace: "false"
  4872. },
  4873. {
  4874. match: /\$\{mentioned/,
  4875. replace: `\${bb.plugins.settings['No Chat Ping']?.['Keep Highlight'] && rawMessage.includes(blacket.user.id.toString()) || mentioned`
  4876. }
  4877. ]
  4878. }
  4879. ],
  4880. settings: [
  4881. {
  4882. name: "Keep Highlight",
  4883. default: false
  4884. }
  4885. ]
  4886. });
  4887. const __vite_glob_0_14 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: index$7 }, Symbol.toStringTag, { value: "Module" }));
  4888. const index$6 = () => createPlugin({
  4889. name: "No Devtools Warning",
  4890. description: "disables the warning in the console.",
  4891. authors: [{ name: "Death", avatar: "https://i.imgur.com/PrvNWub.png", url: "https://villainsrule.xyz" }],
  4892. patches: [
  4893. {
  4894. file: "/lib/js/all.js",
  4895. replacement: [
  4896. {
  4897. match: /console\.log\(`%cWARNING!`, `font-size: 35px;`\);\s*console\.log\(`%cThis is a browser feature intended for developers\. If someone told you to copy and paste something here to enable a \${blacket\.config\.name} feature or "hack" someone else's account, it is most likely a scam and will give them access to your account\.`, `font-size: 20px;`\);\s*console\.log\(`%cIf you ignore this message and the script does work, PLEASE contact a \${blacket\.config\.name} developer immediately\.`, `font-size: 20px;`\);\s*/s,
  4898. replace: ""
  4899. }
  4900. ]
  4901. }
  4902. ]
  4903. });
  4904. const __vite_glob_0_15 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: index$6 }, Symbol.toStringTag, { value: "Module" }));
  4905. const index$5 = () => createPlugin({
  4906. name: "OldBadges",
  4907. description: "reverts the first badge upgrade, returning many badges to the original state.",
  4908. authors: [{ name: "Death", avatar: "https://i.imgur.com/PrvNWub.png", url: "https://villainsrule.xyz" }],
  4909. patches: [
  4910. {
  4911. file: "/lib/js/all.js",
  4912. replacement: [
  4913. {
  4914. match: /Object.assign/,
  4915. replace: `data=$self.modify(data);Object.assign`
  4916. }
  4917. ]
  4918. }
  4919. ],
  4920. modify: (data) => {
  4921. let oldBadges = {
  4922. Plus: "https://i.imgur.com/qu3WJQ6.png",
  4923. Owner: "https://i.imgur.com/w5PV2jw.png",
  4924. Artist: "https://i.imgur.com/2EGHbLG.png",
  4925. "Legacy Ankh": "https://i.imgur.com/m0Vin3j.png",
  4926. Booster: "https://i.imgur.com/7E20vLD.png",
  4927. Verified: "https://i.imgur.com/RwlUTSe.png",
  4928. "Verified Bot": "https://i.imgur.com/0eLB3Xz.png",
  4929. Tester: "https://i.imgur.com/0K816Nj.png",
  4930. Staff: "https://i.imgur.com/dmJ2lIB.png",
  4931. OG: "https://i.imgur.com/kWNfORf.png",
  4932. "Big Spender": "https://i.imgur.com/bpr9QoT.png"
  4933. };
  4934. if (bb.plugins.settings["OldBadges"]["Co-Owner to Owner"]) oldBadges["Co-Owner"] = oldBadges["Owner"];
  4935. Object.entries(oldBadges).forEach(([badge, url]) => data.badges[badge].image = url);
  4936. return data;
  4937. },
  4938. settings: [{
  4939. name: "Co-Owner to Owner",
  4940. default: false
  4941. }]
  4942. });
  4943. const __vite_glob_0_16 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: index$5 }, Symbol.toStringTag, { value: "Module" }));
  4944. const index$4 = () => createPlugin({
  4945. name: "Quick CSS",
  4946. description: "edit CSS for the game and have it applied instantly.",
  4947. authors: [{ name: "Death", avatar: "https://i.imgur.com/PrvNWub.png", url: "https://villainsrule.xyz" }],
  4948. styles: `
  4949. .bb_customCSSBox {
  4950. position: relative;
  4951. display: flex;
  4952. justify-content: center;
  4953. align-items: center;
  4954. cursor: pointer;
  4955. min-width: 5vw;
  4956. height: 2.865vw;
  4957. border-bottom-left-radius: 0.521vw;
  4958. border-bottom-right-radius: 0.521vw;
  4959. box-sizing: border-box;
  4960. box-shadow: inset 0 -0.417vw rgba(0, 0, 0, 0.2), 0 0 0.208vw rgba(0, 0, 0, 0.15);
  4961. padding: 0 0.521vw 0.417vw;
  4962. font-size: 1.042vw;
  4963. color: white;
  4964. background: #2f2f2f;
  4965. }
  4966.  
  4967. .bb_customCSSIcon {
  4968. margin: -0.2vw 0 0 0;
  4969. padding: 0;
  4970. font-size: 1.5vw;
  4971. }
  4972.  
  4973. .bb_customCSSCorner {
  4974. position: absolute;
  4975. bottom: 1vw;
  4976. right: 1vw;
  4977. padding: 10px;
  4978. }
  4979.  
  4980. .bb_customCSSCornerIcon {
  4981. font-size: 2.5vw;
  4982. }
  4983.  
  4984. .bb_customCSSTextarea {
  4985. min-height: 30vh;
  4986. height: 40vh;
  4987. width: 80%;
  4988. background: #2f2f2f;
  4989. border: 2px solid #1f1f1f;
  4990. border-radius: 3px;
  4991. color: white;
  4992. padding: 10px;
  4993. margin-top: 2.5vh;
  4994. outline: none;
  4995. resize: none;
  4996. }
  4997. `,
  4998. onStart: () => {
  4999. let storage2 = bb.storage.get("bb_pluginData", true);
  5000. if ([
  5001. "stats",
  5002. "leaderboard",
  5003. "clans/discover",
  5004. "market",
  5005. "blooks",
  5006. "bazaar",
  5007. "inventory",
  5008. "settings"
  5009. ].some((path) => location.pathname.startsWith(`/${path}`))) {
  5010. document.querySelector("#app > div > div > div").insertAdjacentHTML("afterbegin", `
  5011. <div class="bb_customCSSBox">
  5012. <i class="bb_customCSSIcon fas fa-palette"></i>
  5013. </div>
  5014. `);
  5015. } else if ([
  5016. "trade",
  5017. "store",
  5018. "register",
  5019. "login"
  5020. ].some((path) => location.pathname.startsWith(`/${path}`))) {
  5021. document.querySelector(".arts__body___3acI_-camelCase").insertAdjacentHTML("beforeend", `
  5022. <div class='bb_customCSSCorner styles__button___1_E-G-camelCase' role='button' tabindex='0'>
  5023. <div class='styles__shadow___3GMdH-camelCase'></div>
  5024. <div class='styles__edge___3eWfq-camelCase' style='background-color: #2f2f2f;'></div>
  5025. <div class='styles__front___vcvuy-camelCase''>
  5026. <i class="bb_customCSSCornerIcon fas fa-palette"></i>
  5027. </div>
  5028. </div>
  5029. `);
  5030. } else if (location.pathname.includes("my-clan")) {
  5031. document.querySelector("#clanLeaveButton").insertAdjacentHTML("afterend", `
  5032. <div class="bb_customCSSBox">
  5033. <i class="bb_customCSSIcon fas fa-palette"></i>
  5034. </div>
  5035. `);
  5036. } else return;
  5037. document.body.insertAdjacentHTML("beforeend", `<style id="bb_quickCSS">${storage2?.quickcss || ""}</style>`);
  5038. (document.querySelector(".bb_customCSSBox") || document.querySelector(".bb_customCSSCorner") || document.querySelector(".bb_customCSSSmallBox")).onclick = () => {
  5039. document.body.insertAdjacentHTML("beforeend", `
  5040. <div class="arts__modal___VpEAD-camelCase" id="bigModal">
  5041. <div class="bb_bigModal">
  5042. <div class="bb_bigModalTitle">QuickCSS</div>
  5043. <div class="bb_bigModalDescription">Quickly modify the CSS of Blacket.</div>
  5044. <hr class="bb_bigModalDivider" />
  5045. <textarea class="bb_customCSSTextarea">${document.querySelector("#bb_quickCSS")?.innerHTML || ""}</textarea>
  5046. <hr class="bb_bigModalDivider" />
  5047. <div class="styles__button___1_E-G-camelCase styles__button___3zpwV-camelCase" role="button" tabindex="0" onclick="document.getElementById('bigModal').remove()" style="width: 30%;margin-bottom: 1.5vh;">
  5048. <div class="styles__shadow___3GMdH-camelCase"></div>
  5049. <div class="styles__edge___3eWfq-camelCase" style="background-color: #2f2f2f;"></div>
  5050. <div class="styles__front___vcvuy-camelCase styles__buttonInside___39vdp-camelCase" style="background-color: #2f2f2f;">Close</div>
  5051. </div>
  5052. </div>
  5053. </div>
  5054. `);
  5055. document.querySelector(".bb_customCSSTextarea").oninput = (e) => {
  5056. document.querySelector("#bb_quickCSS").innerHTML = e.target.value;
  5057. let storage3 = bb.storage.get("bb_pluginData", true);
  5058. storage3.quickcss = e.target.value;
  5059. bb.storage.set("bb_pluginData", storage3, true);
  5060. };
  5061. };
  5062. (document.querySelector(".bb_customCSSBox") || document.querySelector(".bb_customCSSCorner") || document.querySelector(".bb_customCSSSmallBox")).oncontextmenu = (r) => {
  5063. r.preventDefault();
  5064. bb.themes.reload();
  5065. };
  5066. }
  5067. });
  5068. const __vite_glob_0_17 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: index$4 }, Symbol.toStringTag, { value: "Module" }));
  5069. const index$3 = () => createPlugin({
  5070. name: "Real Total blooks",
  5071. description: "displays the true number of total blooks on the stats page.",
  5072. authors: [{ name: "Death", avatar: "https://i.imgur.com/PrvNWub.png", url: "https://villainsrule.xyz" }],
  5073. patches: [
  5074. {
  5075. file: "/lib/js/stats.js",
  5076. replacement: [
  5077. {
  5078. match: /maxBlooks\.toLocaleString\(\)/,
  5079. replace: `Object.keys(blacket.blooks).length`
  5080. }
  5081. ]
  5082. }
  5083. ]
  5084. });
  5085. const __vite_glob_0_18 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: index$3 }, Symbol.toStringTag, { value: "Module" }));
  5086. const index$2 = () => createPlugin({
  5087. name: "Staff Tags",
  5088. description: "gives staff who speak in chat a special tag.",
  5089. authors: [{ name: "Death", avatar: "https://i.imgur.com/PrvNWub.png", url: "https://villainsrule.xyz" }],
  5090. patches: [
  5091. {
  5092. file: "/lib/js/game.js",
  5093. replacement: [
  5094. {
  5095. match: /\$\{badges\}/,
  5096. replace: `\${badges} \${['Owner', 'Admin', 'Moderator', 'Helper'].includes(data.author.role) || bb.plugins.settings['Staff Tags']?.['Show Artists'] && data.author.role === 'Artist' || bb.plugins.settings['Staff Tags']?.['Show Testers'] && data.author.role === 'Tester' ? \`<span class="bb_roleTag">\${data.author.role}</span>\` : ''}`
  5097. }
  5098. ]
  5099. }
  5100. ],
  5101. styles: `
  5102. .bb_roleTag {
  5103. margin-left: 0.208vw;
  5104. background: #2f2f2f;
  5105. padding: 1px 8px;
  5106. border-radius: 10px;
  5107. font-size: 1vw;
  5108. color: white;
  5109. }
  5110. `,
  5111. settings: [
  5112. {
  5113. name: "Show Testers",
  5114. default: true
  5115. },
  5116. {
  5117. name: "Show Artists",
  5118. default: true
  5119. }
  5120. ]
  5121. });
  5122. const __vite_glob_0_19 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: index$2 }, Symbol.toStringTag, { value: "Module" }));
  5123. const index$1 = () => createPlugin({
  5124. name: "Test Admin",
  5125. description: "allows anyone to access the forced admin panel.",
  5126. authors: [{ name: "Death", avatar: "https://i.imgur.com/PrvNWub.png", url: "https://villainsrule.xyz" }],
  5127. patches: [
  5128. {
  5129. file: "/lib/js/game.js",
  5130. replacement: [
  5131. {
  5132. match: /perm == "none"/,
  5133. replace: `perm == "none" || page === "Panel"`
  5134. }
  5135. ]
  5136. },
  5137. {
  5138. file: "/lib/js/panel/home.js",
  5139. replacement: [
  5140. {
  5141. match: /\("\*"\)/,
  5142. replace: `("*") || !blacket.panel.buttons[button].disabled`
  5143. },
  5144. {
  5145. match: /"edit_presets"/,
  5146. replace: `"edit_presets",disabled:true`
  5147. },
  5148. {
  5149. match: /\/\*"/,
  5150. replace: `"`
  5151. },
  5152. {
  5153. match: /_packs"/,
  5154. replace: `_packs",disabled:true`
  5155. },
  5156. {
  5157. match: /_reports"/,
  5158. replace: `_reports",disabled:true`
  5159. },
  5160. {
  5161. match: /\},\*\//,
  5162. replace: "},"
  5163. }
  5164. ]
  5165. },
  5166. {
  5167. file: "/lib/js/panel/users.js",
  5168. replacement: [
  5169. {
  5170. match: /let online/,
  5171. replace: `
  5172. user.mute = { muted: Math.random() < 0.6 };
  5173. user.ban = { banned: Math.random() < 0.6 };
  5174. let online
  5175. `
  5176. },
  5177. {
  5178. match: /\("ban_users"\)/,
  5179. replace: `("ban_users") || true`
  5180. }
  5181. ]
  5182. },
  5183. {
  5184. file: "/lib/js/panel/console.js",
  5185. replacement: [
  5186. {
  5187. match: /\$\("\#commandInputBox"\).k/,
  5188. replace: `
  5189. [
  5190. '[Blacket] Started!',
  5191. '[Blacket] Type "help" for commands.',
  5192. '[Blacket] Type "clear" to clear the console.',
  5193. '[Blacket] Type "exit" to exit the console.',
  5194. '[Blacket] Please note that this is populated data written by BetterBlacket',
  5195. '[Blacket] To disable these populations, turn off the TestAdmin plugin.'
  5196. ].forEach(p => blacket.appendConsoleLine(p));
  5197. $('#commandInputBox').k`
  5198. }
  5199. ]
  5200. },
  5201. {
  5202. file: "/lib/js/panel/forms.js",
  5203. replacement: [
  5204. {
  5205. match: /currentPage = 1/,
  5206. replace: `currentPage = 0`
  5207. },
  5208. {
  5209. match: /return blacket/,
  5210. replace: `blacket`
  5211. },
  5212. {
  5213. match: /maxPages = data\.pages/,
  5214. replace: `maxPages = 5`
  5215. },
  5216. {
  5217. match: /blacket\.currentPage = data\.page/,
  5218. replace: `blacket.currentPage++`
  5219. },
  5220. {
  5221. match: /data\.forms\.length/,
  5222. replace: `Math.round(Math.random() * 20)`
  5223. },
  5224. {
  5225. match: /data\.total/,
  5226. replace: `Math.round(Math.random() * 70)`
  5227. },
  5228. {
  5229. match: /data.forms/,
  5230. replace: `
  5231. let createAge = () => Math.round(Math.random() * 3) + 13;
  5232. let createUsername = () => 'Username' + Math.round(Math.random() * 1000);
  5233. let discord = () => 'username' + Math.round(Math.random() * 1000);
  5234. let body = () => 'This body was generated by the Test Admin BetterBlacket Plugin. This is NOT a real form. If you are a staff, you can see real forms by disabling this plugin. '.repeat(Math.round(Math.random() * 3));
  5235.  
  5236. let createForm = () => ({
  5237. username: createUsername(),
  5238. age: createAge(),
  5239. discord: discord(),
  5240. body: body()
  5241. });
  5242.  
  5243. new Array(69).fill().map(() => createForm())`
  5244. }
  5245. ]
  5246. }
  5247. ]
  5248. });
  5249. const __vite_glob_0_20 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: index$1 }, Symbol.toStringTag, { value: "Module" }));
  5250. const index = () => createPlugin({
  5251. name: "Tokens Everywhere",
  5252. description: "shows your token count on ALL pages!",
  5253. authors: [{ name: "Death", avatar: "https://i.imgur.com/PrvNWub.png", url: "https://villainsrule.xyz" }],
  5254. patches: [
  5255. {
  5256. file: "/lib/js/game.js",
  5257. replacement: [
  5258. {
  5259. match: /\$\("#roomDropdownGlobal"\)/,
  5260. replace: `$self.updateTokens();$("#roomDropdownGlobal")`
  5261. }
  5262. ]
  5263. },
  5264. {
  5265. file: "/lib/js/blooks.js",
  5266. replacement: [
  5267. {
  5268. match: /-= quantity;/,
  5269. replace: `-= quantity;blacket.user.tokens += blacket.blooks[blacket.blooks.selected].price*quantity;$self.updateTokens();`
  5270. }
  5271. ]
  5272. }
  5273. ],
  5274. updateTokens: () => $("#tokenBalance > div:nth-child(2)").html(blacket.user.tokens.toLocaleString()),
  5275. onLoad: () => {
  5276. if ([
  5277. "leaderboard",
  5278. "clans/discover",
  5279. "blooks",
  5280. "inventory",
  5281. "settings"
  5282. ].some((path) => location.pathname.startsWith(`/${path}`))) {
  5283. document.querySelector(".styles__topRightRow___dQvxc-camelCase").insertAdjacentHTML("afterbegin", `
  5284. <div id="tokenBalance" class="styles__tokenBalance___1FHgT-camelCase">
  5285. <img loading="lazy" src="/content/tokenIcon.webp" alt="Token" class="styles__tokenBalanceIcon___3MGhs-camelCase" draggable="false">
  5286. <div>tokens</div>
  5287. </div>
  5288. `);
  5289. }
  5290. }
  5291. });
  5292. const __vite_glob_0_21 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: index }, Symbol.toStringTag, { value: "Module" }));
  5293. const loadPlugins = async () => {
  5294. console.log("Called loadPlugins()");
  5295. let pluginData = storage.get("bb_pluginData", true);
  5296. let contentLoaded = false;
  5297. await Promise.all(Object.values(/* @__PURE__ */ Object.assign({ "../plugins/advancedopen/index.js": __vite_glob_0_0, "../plugins/aprilfools/index.js": __vite_glob_0_1, "../plugins/bazaarsniper/index.js": __vite_glob_0_2, "../plugins/betterchat/index.js": __vite_glob_0_3, "../plugins/betternotifications/index.js": __vite_glob_0_4, "../plugins/betterreplies/index.js": __vite_glob_0_5, "../plugins/blookutils/index.js": __vite_glob_0_6, "../plugins/deafbot/index.js": __vite_glob_0_7, "../plugins/doubleleaderboard/index.js": __vite_glob_0_8, "../plugins/extrastats/index.js": __vite_glob_0_9, "../plugins/highlightrarity/index.js": __vite_glob_0_10, "../plugins/internals/index.js": __vite_glob_0_11, "../plugins/messagelogger/index.js": __vite_glob_0_12, "../plugins/nochatcolor/index.js": __vite_glob_0_13, "../plugins/nochatping/index.js": __vite_glob_0_14, "../plugins/nodevtoolswarn/index.js": __vite_glob_0_15, "../plugins/oldbadges/index.js": __vite_glob_0_16, "../plugins/quickcss/index.js": __vite_glob_0_17, "../plugins/realtotalblooks/index.js": __vite_glob_0_18, "../plugins/stafftags/index.js": __vite_glob_0_19, "../plugins/testadmin/index.js": __vite_glob_0_20, "../plugins/tokenseverywhere/index.js": __vite_glob_0_21 })).map(async (pluginFile) => {
  5298. let plugin = pluginFile.default();
  5299. bb.plugins.list.push(plugin);
  5300. if (!!plugin.styles) bb.plugins.styles[plugin.name] = plugin.styles;
  5301. }));
  5302. bb.plugins.active = [...pluginData.active, ...bb.plugins.list.filter((p) => p.required).map((p) => p.name)];
  5303. bb.plugins.settings = pluginData.settings;
  5304. console.log(`Detected readyState ${document.readyState}. Running onLoad listeners...`);
  5305. document.addEventListener("DOMContentLoaded", () => {
  5306. if (contentLoaded) return;
  5307. contentLoaded = true;
  5308. bb.plugins.list.forEach((plugin) => {
  5309. if (pluginData.active.includes(plugin.name) || plugin.required) plugin.onLoad?.();
  5310. });
  5311. });
  5312. if (document.readyState !== "loading" && !contentLoaded) {
  5313. contentLoaded = true;
  5314. bb.plugins.list.forEach((plugin) => {
  5315. if (pluginData.active.includes(plugin.name) || plugin.required) plugin.onLoad?.();
  5316. });
  5317. }
  5318. events.listen("pageInit", () => {
  5319. console.log(`Plugins got pageInit. Starting plugins...`);
  5320. bb.plugins.list.forEach((plugin) => {
  5321. if (pluginData.active.includes(plugin.name) || plugin.required) plugin.onStart?.();
  5322. });
  5323. });
  5324. bb.plugins.list.forEach((plugin) => {
  5325. if (pluginData.active.includes(plugin.name) || plugin.required) plugin.patches.forEach((patch) => bb.patches.push({
  5326. ...patch,
  5327. plugin: plugin.name
  5328. }));
  5329. if (!bb.plugins.settings[plugin.name]) bb.plugins.settings[plugin.name] = {};
  5330. plugin.settings.forEach((setting) => {
  5331. if (!bb.plugins.settings[plugin.name][setting.name]) bb.plugins.settings[plugin.name][setting.name] = setting.default;
  5332. });
  5333. });
  5334. console.log("Done with loadPlugins(), running Patcher.patch()...");
  5335. patcher.patch();
  5336. };
  5337. patcher.start();
  5338. if (!storage.get("bb_pluginData")) storage.set("bb_pluginData", { active: [], settings: {} }, true);
  5339. if (!storage.get("bb_themeData")) storage.set("bb_themeData", { active: [] }, true);
  5340. window.bb = {
  5341. axios,
  5342. events,
  5343. Modal,
  5344. storage,
  5345. plugins: {
  5346. list: [],
  5347. settings: {},
  5348. styles: {},
  5349. pendingChanges: false
  5350. },
  5351. themes: {
  5352. list: [],
  5353. broken: [],
  5354. reload: () => loadThemes(true)
  5355. },
  5356. patches: []
  5357. };
  5358. console.log('Defined global "bb" variable:', bb);
  5359. setTimeout(() => loadThemes(), 0);
  5360. setTimeout(() => loadPlugins(), 0);

QingJ © 2025

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